Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 8 Aug 2008 01:14:07 +0000 (18:14 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 8 Aug 2008 01:14:07 +0000 (18:14 -0700)
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband:
  IB/mad: Test ib_create_send_mad() return with IS_ERR(), not == NULL
  IB/mlx4: Allow 4K messages for UD QPs
  mlx4_core: Add ethernet fields to CQE struct
  IB/ipath: Fix printk format warnings
  RDMA/cxgb3: Fix deadlock initializing iw_cxgb3 device
  RDMA/cxgb3: Fix up MW access rights
  RDMA/cxgb3: Fix QP capabilities
  RDMA/cma: Remove padding arrays by using struct sockaddr_storage
  IB/ipath: Use unsigned long for irq flags
  IPoIB/cm: Set correct SG list in ipoib_cm_init_rx_wr()

2396 files changed:
Documentation/00-INDEX
Documentation/ABI/testing/sysfs-class-regulator [new file with mode: 0644]
Documentation/DocBook/Makefile
Documentation/DocBook/kgdb.tmpl
Documentation/DocBook/s390-drivers.tmpl
Documentation/DocBook/sh.tmpl [new file with mode: 0644]
Documentation/DocBook/videobook.tmpl
Documentation/cciss.txt
Documentation/cli-sti-removal.txt [deleted file]
Documentation/filesystems/configfs/configfs.txt
Documentation/filesystems/configfs/configfs_example_explicit.c [moved from Documentation/filesystems/configfs/configfs_example.c with 96% similarity]
Documentation/filesystems/configfs/configfs_example_macros.c [new file with mode: 0644]
Documentation/ftrace.txt
Documentation/hwmon/dme1737
Documentation/hwmon/it87
Documentation/hwmon/lm85
Documentation/hwmon/w83627hf
Documentation/hwmon/w83791d
Documentation/power/pm_qos_interface.txt
Documentation/power/power_supply_class.txt
Documentation/power/regulator/consumer.txt [new file with mode: 0644]
Documentation/power/regulator/machine.txt [new file with mode: 0644]
Documentation/power/regulator/overview.txt [new file with mode: 0644]
Documentation/power/regulator/regulator.txt [new file with mode: 0644]
Documentation/powerpc/00-INDEX
Documentation/powerpc/SBC8260_memory_mapping.txt [deleted file]
Documentation/powerpc/booting-without-of.txt
Documentation/powerpc/dts-bindings/fsl/cpm_qe/serial.txt
Documentation/powerpc/eeh-pci-error-recovery.txt
Documentation/rfkill.txt
Documentation/video4linux/gspca.txt
MAINTAINERS
Makefile
arch/arm/Kconfig
arch/arm/boot/compressed/Makefile
arch/arm/configs/at91cap9adk_defconfig
arch/arm/configs/at91sam9260ek_defconfig
arch/arm/configs/at91sam9261ek_defconfig
arch/arm/configs/at91sam9263ek_defconfig
arch/arm/configs/at91sam9g20ek_defconfig
arch/arm/configs/at91sam9rlek_defconfig
arch/arm/configs/cam60_defconfig
arch/arm/configs/qil-a9260_defconfig
arch/arm/configs/sam9_l9260_defconfig
arch/arm/configs/usb-a9260_defconfig
arch/arm/configs/usb-a9263_defconfig
arch/arm/configs/yl9200_defconfig
arch/arm/include/asm/Kbuild [moved from include/asm-arm/Kbuild with 100% similarity]
arch/arm/include/asm/a.out-core.h [moved from include/asm-arm/a.out-core.h with 100% similarity]
arch/arm/include/asm/a.out.h [moved from include/asm-arm/a.out.h with 100% similarity]
arch/arm/include/asm/assembler.h [moved from include/asm-arm/assembler.h with 98% similarity]
arch/arm/include/asm/atomic.h [moved from include/asm-arm/atomic.h with 99% similarity]
arch/arm/include/asm/auxvec.h [moved from include/asm-arm/auxvec.h with 100% similarity]
arch/arm/include/asm/bitops.h [moved from include/asm-arm/bitops.h with 100% similarity]
arch/arm/include/asm/bug.h [moved from include/asm-arm/bug.h with 100% similarity]
arch/arm/include/asm/bugs.h [moved from include/asm-arm/bugs.h with 93% similarity]
arch/arm/include/asm/byteorder.h [moved from include/asm-arm/byteorder.h with 97% similarity]
arch/arm/include/asm/cache.h [moved from include/asm-arm/cache.h with 80% similarity]
arch/arm/include/asm/cacheflush.h [moved from include/asm-arm/cacheflush.h with 99% similarity]
arch/arm/include/asm/checksum.h [moved from include/asm-arm/checksum.h with 98% similarity]
arch/arm/include/asm/cnt32_to_63.h [moved from include/asm-arm/cnt32_to_63.h with 100% similarity]
arch/arm/include/asm/cpu-multi32.h [moved from include/asm-arm/cpu-multi32.h with 97% similarity]
arch/arm/include/asm/cpu-single.h [moved from include/asm-arm/cpu-single.h with 97% similarity]
arch/arm/include/asm/cpu.h [moved from include/asm-arm/cpu.h with 93% similarity]
arch/arm/include/asm/cputime.h [moved from include/asm-arm/cputime.h with 100% similarity]
arch/arm/include/asm/current.h [moved from include/asm-arm/current.h with 100% similarity]
arch/arm/include/asm/delay.h [moved from include/asm-arm/delay.h with 100% similarity]
arch/arm/include/asm/device.h [moved from include/asm-arm/device.h with 100% similarity]
arch/arm/include/asm/div64.h [moved from include/asm-arm/div64.h with 100% similarity]
arch/arm/include/asm/dma-mapping.h [moved from include/asm-arm/dma-mapping.h with 100% similarity]
arch/arm/include/asm/dma.h [moved from include/asm-arm/dma.h with 100% similarity]
arch/arm/include/asm/domain.h [moved from include/asm-arm/domain.h with 98% similarity]
arch/arm/include/asm/ecard.h [moved from include/asm-arm/ecard.h with 99% similarity]
arch/arm/include/asm/elf.h [moved from include/asm-arm/elf.h with 100% similarity]
arch/arm/include/asm/emergency-restart.h [moved from include/asm-arm/emergency-restart.h with 100% similarity]
arch/arm/include/asm/errno.h [moved from include/asm-arm/errno.h with 100% similarity]
arch/arm/include/asm/fb.h [moved from include/asm-arm/fb.h with 100% similarity]
arch/arm/include/asm/fcntl.h [moved from include/asm-arm/fcntl.h with 100% similarity]
arch/arm/include/asm/fiq.h [moved from include/asm-arm/fiq.h with 96% similarity]
arch/arm/include/asm/flat.h [moved from include/asm-arm/flat.h with 90% similarity]
arch/arm/include/asm/floppy.h [moved from include/asm-arm/floppy.h with 99% similarity]
arch/arm/include/asm/fpstate.h [moved from include/asm-arm/fpstate.h with 97% similarity]
arch/arm/include/asm/ftrace.h [moved from include/asm-arm/ftrace.h with 100% similarity]
arch/arm/include/asm/futex.h [moved from include/asm-arm/futex.h with 100% similarity]
arch/arm/include/asm/glue.h [moved from include/asm-arm/glue.h with 99% similarity]
arch/arm/include/asm/gpio.h [moved from include/asm-arm/gpio.h with 100% similarity]
arch/arm/include/asm/hardirq.h [moved from include/asm-arm/hardirq.h with 100% similarity]
arch/arm/include/asm/hardware.h [moved from include/asm-arm/hardware.h with 90% similarity]
arch/arm/include/asm/hardware/arm_timer.h [moved from include/asm-arm/hardware/arm_timer.h with 100% similarity]
arch/arm/include/asm/hardware/arm_twd.h [moved from include/asm-arm/hardware/arm_twd.h with 100% similarity]
arch/arm/include/asm/hardware/cache-l2x0.h [moved from include/asm-arm/hardware/cache-l2x0.h with 97% similarity]
arch/arm/include/asm/hardware/clps7111.h [moved from include/asm-arm/hardware/clps7111.h with 99% similarity]
arch/arm/include/asm/hardware/cs89712.h [moved from include/asm-arm/hardware/cs89712.h with 97% similarity]
arch/arm/include/asm/hardware/debug-8250.S [moved from include/asm-arm/hardware/debug-8250.S with 93% similarity]
arch/arm/include/asm/hardware/debug-pl01x.S [moved from include/asm-arm/hardware/debug-pl01x.S with 93% similarity]
arch/arm/include/asm/hardware/dec21285.h [moved from include/asm-arm/hardware/dec21285.h with 99% similarity]
arch/arm/include/asm/hardware/entry-macro-iomd.S [moved from include/asm-arm/hardware/entry-macro-iomd.S with 99% similarity]
arch/arm/include/asm/hardware/ep7211.h [moved from include/asm-arm/hardware/ep7211.h with 96% similarity]
arch/arm/include/asm/hardware/ep7212.h [moved from include/asm-arm/hardware/ep7212.h with 98% similarity]
arch/arm/include/asm/hardware/gic.h [moved from include/asm-arm/hardware/gic.h with 96% similarity]
arch/arm/include/asm/hardware/icst307.h [moved from include/asm-arm/hardware/icst307.h with 96% similarity]
arch/arm/include/asm/hardware/icst525.h [moved from include/asm-arm/hardware/icst525.h with 96% similarity]
arch/arm/include/asm/hardware/ioc.h [moved from include/asm-arm/hardware/ioc.h with 97% similarity]
arch/arm/include/asm/hardware/iomd.h [moved from include/asm-arm/hardware/iomd.h with 99% similarity]
arch/arm/include/asm/hardware/iop3xx-adma.h [moved from include/asm-arm/hardware/iop3xx-adma.h with 100% similarity]
arch/arm/include/asm/hardware/iop3xx-gpio.h [moved from include/asm-arm/hardware/iop3xx-gpio.h with 97% similarity]
arch/arm/include/asm/hardware/iop3xx.h [moved from include/asm-arm/hardware/iop3xx.h with 99% similarity]
arch/arm/include/asm/hardware/iop_adma.h [moved from include/asm-arm/hardware/iop_adma.h with 100% similarity]
arch/arm/include/asm/hardware/it8152.h [moved from include/asm-arm/hardware/it8152.h with 100% similarity]
arch/arm/include/asm/hardware/linkup-l1110.h [moved from include/asm-arm/hardware/linkup-l1110.h with 100% similarity]
arch/arm/include/asm/hardware/locomo.h [moved from include/asm-arm/hardware/locomo.h with 99% similarity]
arch/arm/include/asm/hardware/memc.h [moved from include/asm-arm/hardware/memc.h with 93% similarity]
arch/arm/include/asm/hardware/pci_v3.h [moved from include/asm-arm/hardware/pci_v3.h with 99% similarity]
arch/arm/include/asm/hardware/sa1111.h [moved from include/asm-arm/hardware/sa1111.h with 99% similarity]
arch/arm/include/asm/hardware/scoop.h [moved from include/asm-arm/hardware/scoop.h with 100% similarity]
arch/arm/include/asm/hardware/sharpsl_pm.h [moved from include/asm-arm/hardware/sharpsl_pm.h with 100% similarity]
arch/arm/include/asm/hardware/ssp.h [moved from include/asm-arm/hardware/ssp.h with 100% similarity]
arch/arm/include/asm/hardware/uengine.h [moved from include/asm-arm/hardware/uengine.h with 100% similarity]
arch/arm/include/asm/hardware/vic.h [moved from include/asm-arm/hardware/vic.h with 97% similarity]
arch/arm/include/asm/hw_irq.h [moved from include/asm-arm/hw_irq.h with 100% similarity]
arch/arm/include/asm/hwcap.h [moved from include/asm-arm/hwcap.h with 100% similarity]
arch/arm/include/asm/ide.h [moved from include/asm-arm/ide.h with 93% similarity]
arch/arm/include/asm/io.h [moved from include/asm-arm/io.h with 99% similarity]
arch/arm/include/asm/ioctl.h [moved from include/asm-arm/ioctl.h with 100% similarity]
arch/arm/include/asm/ioctls.h [moved from include/asm-arm/ioctls.h with 100% similarity]
arch/arm/include/asm/ipcbuf.h [moved from include/asm-arm/ipcbuf.h with 100% similarity]
arch/arm/include/asm/irq.h [moved from include/asm-arm/irq.h with 100% similarity]
arch/arm/include/asm/irq_regs.h [moved from include/asm-arm/irq_regs.h with 100% similarity]
arch/arm/include/asm/irqflags.h [moved from include/asm-arm/irqflags.h with 100% similarity]
arch/arm/include/asm/kdebug.h [moved from include/asm-arm/kdebug.h with 100% similarity]
arch/arm/include/asm/kexec.h [moved from include/asm-arm/kexec.h with 100% similarity]
arch/arm/include/asm/kgdb.h [moved from include/asm-arm/kgdb.h with 100% similarity]
arch/arm/include/asm/kmap_types.h [moved from include/asm-arm/kmap_types.h with 100% similarity]
arch/arm/include/asm/kprobes.h [moved from include/asm-arm/kprobes.h with 98% similarity]
arch/arm/include/asm/leds.h [moved from include/asm-arm/leds.h with 96% similarity]
arch/arm/include/asm/limits.h [moved from include/asm-arm/limits.h with 100% similarity]
arch/arm/include/asm/linkage.h [moved from include/asm-arm/linkage.h with 100% similarity]
arch/arm/include/asm/local.h [moved from include/asm-arm/local.h with 100% similarity]
arch/arm/include/asm/locks.h [moved from include/asm-arm/locks.h with 99% similarity]
arch/arm/include/asm/mach/arch.h [moved from include/asm-arm/mach/arch.h with 97% similarity]
arch/arm/include/asm/mach/dma.h [moved from include/asm-arm/mach/dma.h with 97% similarity]
arch/arm/include/asm/mach/flash.h [moved from include/asm-arm/mach/flash.h with 96% similarity]
arch/arm/include/asm/mach/irda.h [moved from include/asm-arm/mach/irda.h with 93% similarity]
arch/arm/include/asm/mach/irq.h [moved from include/asm-arm/mach/irq.h with 96% similarity]
arch/arm/include/asm/mach/map.h [moved from include/asm-arm/mach/map.h with 96% similarity]
arch/arm/include/asm/mach/mmc.h [moved from include/asm-arm/mach/mmc.h with 88% similarity]
arch/arm/include/asm/mach/pci.h [moved from include/asm-arm/mach/pci.h with 98% similarity]
arch/arm/include/asm/mach/serial_at91.h [moved from include/asm-arm/mach/serial_at91.h with 94% similarity]
arch/arm/include/asm/mach/serial_sa1100.h [moved from include/asm-arm/mach/serial_sa1100.h with 86% similarity]
arch/arm/include/asm/mach/sharpsl_param.h [moved from include/asm-arm/mach/sharpsl_param.h with 100% similarity]
arch/arm/include/asm/mach/time.h [moved from include/asm-arm/mach/time.h with 97% similarity]
arch/arm/include/asm/mach/udc_pxa2xx.h [moved from include/asm-arm/mach/udc_pxa2xx.h with 95% similarity]
arch/arm/include/asm/mc146818rtc.h [moved from include/asm-arm/mc146818rtc.h with 100% similarity]
arch/arm/include/asm/memory.h [moved from include/asm-arm/memory.h with 99% similarity]
arch/arm/include/asm/mman.h [moved from include/asm-arm/mman.h with 100% similarity]
arch/arm/include/asm/mmu.h [moved from include/asm-arm/mmu.h with 100% similarity]
arch/arm/include/asm/mmu_context.h [moved from include/asm-arm/mmu_context.h with 98% similarity]
arch/arm/include/asm/mmzone.h [moved from include/asm-arm/mmzone.h with 94% similarity]
arch/arm/include/asm/module.h [moved from include/asm-arm/module.h with 100% similarity]
arch/arm/include/asm/msgbuf.h [moved from include/asm-arm/msgbuf.h with 100% similarity]
arch/arm/include/asm/mtd-xip.h [moved from include/asm-arm/mtd-xip.h with 100% similarity]
arch/arm/include/asm/mutex.h [moved from include/asm-arm/mutex.h with 98% similarity]
arch/arm/include/asm/nwflash.h [moved from include/asm-arm/nwflash.h with 100% similarity]
arch/arm/include/asm/page-nommu.h [moved from include/asm-arm/page-nommu.h with 96% similarity]
arch/arm/include/asm/page.h [moved from include/asm-arm/page.h with 99% similarity]
arch/arm/include/asm/param.h [moved from include/asm-arm/param.h with 95% similarity]
arch/arm/include/asm/parport.h [moved from include/asm-arm/parport.h with 86% similarity]
arch/arm/include/asm/pci.h [moved from include/asm-arm/pci.h with 100% similarity]
arch/arm/include/asm/percpu.h [moved from include/asm-arm/percpu.h with 100% similarity]
arch/arm/include/asm/pgalloc.h [moved from include/asm-arm/pgalloc.h with 98% similarity]
arch/arm/include/asm/pgtable-hwdef.h [moved from include/asm-arm/pgtable-hwdef.h with 98% similarity]
arch/arm/include/asm/pgtable-nommu.h [moved from include/asm-arm/pgtable-nommu.h with 98% similarity]
arch/arm/include/asm/pgtable.h [moved from include/asm-arm/pgtable.h with 99% similarity]
arch/arm/include/asm/poll.h [moved from include/asm-arm/poll.h with 100% similarity]
arch/arm/include/asm/posix_types.h [moved from include/asm-arm/posix_types.h with 98% similarity]
arch/arm/include/asm/proc-fns.h [moved from include/asm-arm/proc-fns.h with 99% similarity]
arch/arm/include/asm/processor.h [moved from include/asm-arm/processor.h with 98% similarity]
arch/arm/include/asm/procinfo.h [moved from include/asm-arm/procinfo.h with 97% similarity]
arch/arm/include/asm/ptrace.h [moved from include/asm-arm/ptrace.h with 99% similarity]
arch/arm/include/asm/resource.h [moved from include/asm-arm/resource.h with 100% similarity]
arch/arm/include/asm/scatterlist.h [moved from include/asm-arm/scatterlist.h with 100% similarity]
arch/arm/include/asm/sections.h [moved from include/asm-arm/sections.h with 100% similarity]
arch/arm/include/asm/segment.h [moved from include/asm-arm/segment.h with 100% similarity]
arch/arm/include/asm/sembuf.h [moved from include/asm-arm/sembuf.h with 100% similarity]
arch/arm/include/asm/serial.h [moved from include/asm-arm/serial.h with 91% similarity]
arch/arm/include/asm/setup.h [moved from include/asm-arm/setup.h with 100% similarity]
arch/arm/include/asm/shmbuf.h [moved from include/asm-arm/shmbuf.h with 100% similarity]
arch/arm/include/asm/shmparam.h [moved from include/asm-arm/shmparam.h with 100% similarity]
arch/arm/include/asm/sigcontext.h [moved from include/asm-arm/sigcontext.h with 100% similarity]
arch/arm/include/asm/siginfo.h [moved from include/asm-arm/siginfo.h with 100% similarity]
arch/arm/include/asm/signal.h [moved from include/asm-arm/signal.h with 100% similarity]
arch/arm/include/asm/sizes.h [moved from include/asm-arm/sizes.h with 100% similarity]
arch/arm/include/asm/smp.h [moved from include/asm-arm/smp.h with 97% similarity]
arch/arm/include/asm/socket.h [moved from include/asm-arm/socket.h with 100% similarity]
arch/arm/include/asm/sockios.h [moved from include/asm-arm/sockios.h with 100% similarity]
arch/arm/include/asm/sparsemem.h [moved from include/asm-arm/sparsemem.h with 100% similarity]
arch/arm/include/asm/spinlock.h [moved from include/asm-arm/spinlock.h with 100% similarity]
arch/arm/include/asm/spinlock_types.h [moved from include/asm-arm/spinlock_types.h with 100% similarity]
arch/arm/include/asm/stat.h [moved from include/asm-arm/stat.h with 100% similarity]
arch/arm/include/asm/statfs.h [moved from include/asm-arm/statfs.h with 100% similarity]
arch/arm/include/asm/string.h [moved from include/asm-arm/string.h with 100% similarity]
arch/arm/include/asm/suspend.h [moved from include/asm-arm/suspend.h with 100% similarity]
arch/arm/include/asm/system.h [moved from include/asm-arm/system.h with 100% similarity]
arch/arm/include/asm/termbits.h [moved from include/asm-arm/termbits.h with 100% similarity]
arch/arm/include/asm/termios.h [moved from include/asm-arm/termios.h with 100% similarity]
arch/arm/include/asm/therm.h [moved from include/asm-arm/therm.h with 88% similarity]
arch/arm/include/asm/thread_info.h [moved from include/asm-arm/thread_info.h with 97% similarity]
arch/arm/include/asm/thread_notify.h [moved from include/asm-arm/thread_notify.h with 96% similarity]
arch/arm/include/asm/timex.h [moved from include/asm-arm/timex.h with 93% similarity]
arch/arm/include/asm/tlb.h [moved from include/asm-arm/tlb.h with 98% similarity]
arch/arm/include/asm/tlbflush.h [moved from include/asm-arm/tlbflush.h with 99% similarity]
arch/arm/include/asm/topology.h [moved from include/asm-arm/topology.h with 100% similarity]
arch/arm/include/asm/traps.h [moved from include/asm-arm/traps.h with 100% similarity]
arch/arm/include/asm/types.h [moved from include/asm-arm/types.h with 100% similarity]
arch/arm/include/asm/uaccess.h [moved from include/asm-arm/uaccess.h with 99% similarity]
arch/arm/include/asm/ucontext.h [moved from include/asm-arm/ucontext.h with 100% similarity]
arch/arm/include/asm/unaligned.h [moved from include/asm-arm/unaligned.h with 100% similarity]
arch/arm/include/asm/unistd.h [moved from include/asm-arm/unistd.h with 99% similarity]
arch/arm/include/asm/user.h [moved from include/asm-arm/user.h with 100% similarity]
arch/arm/include/asm/vfp.h [moved from include/asm-arm/vfp.h with 98% similarity]
arch/arm/include/asm/vfpmacros.h [moved from include/asm-arm/vfpmacros.h with 97% similarity]
arch/arm/include/asm/vga.h [moved from include/asm-arm/vga.h with 100% similarity]
arch/arm/include/asm/xor.h [moved from include/asm-arm/xor.h with 99% similarity]
arch/arm/kernel/head-common.S
arch/arm/lib/getuser.S
arch/arm/lib/putuser.S
arch/arm/mach-at91/Kconfig
arch/arm/mach-at91/at91cap9_devices.c
arch/arm/mach-at91/at91rm9200_devices.c
arch/arm/mach-at91/at91sam9260_devices.c
arch/arm/mach-at91/at91sam9261_devices.c
arch/arm/mach-at91/at91sam9263_devices.c
arch/arm/mach-at91/at91sam9rl_devices.c
arch/arm/mach-at91/board-cap9adk.c
arch/arm/mach-at91/board-qil-a9260.c
arch/arm/mach-at91/board-sam9-l9260.c
arch/arm/mach-at91/board-sam9260ek.c
arch/arm/mach-at91/board-sam9261ek.c
arch/arm/mach-at91/board-sam9263ek.c
arch/arm/mach-at91/board-sam9g20ek.c
arch/arm/mach-at91/board-usb-a9260.c
arch/arm/mach-at91/board-usb-a9263.c
arch/arm/mach-imx/clock.c
arch/arm/mach-imx/generic.c
arch/arm/mach-imx/mx1ads.c
arch/arm/mach-kirkwood/rd88f6281-setup.c
arch/arm/mach-ns9xxx/board-a9m9750dev.c
arch/arm/mach-ns9xxx/gpio-ns9360.c
arch/arm/mach-ns9xxx/gpio.c
arch/arm/mach-ns9xxx/irq.c
arch/arm/mach-ns9xxx/mach-cc9p9360dev.c
arch/arm/mach-ns9xxx/mach-cc9p9360js.c
arch/arm/mach-ns9xxx/plat-serial8250.c
arch/arm/mach-ns9xxx/processor-ns9360.c
arch/arm/mach-ns9xxx/time-ns9360.c
arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
arch/arm/mach-orion5x/wnr854t-setup.c
arch/arm/mach-orion5x/wrt350n-v2-setup.c
arch/arm/mach-pxa/pcm990-baseboard.c
arch/arm/mm/Kconfig
arch/arm/mm/cache-xsc3l2.c [new file with mode: 0644]
arch/arm/mm/init.c
arch/arm/mm/ioremap.c
arch/arm/mm/proc-arm720.S
arch/arm/mm/proc-xsc3.S
arch/arm/nwfpe/fpa11.h
arch/frv/kernel/entry.S
arch/ia64/Kconfig
arch/ia64/configs/generic_defconfig
arch/ia64/include/asm/Kbuild [moved from include/asm-ia64/Kbuild with 100% similarity]
arch/ia64/include/asm/a.out.h [moved from include/asm-ia64/a.out.h with 100% similarity]
arch/ia64/include/asm/acpi-ext.h [moved from include/asm-ia64/acpi-ext.h with 100% similarity]
arch/ia64/include/asm/acpi.h [moved from include/asm-ia64/acpi.h with 99% similarity]
arch/ia64/include/asm/agp.h [moved from include/asm-ia64/agp.h with 100% similarity]
arch/ia64/include/asm/asmmacro.h [moved from include/asm-ia64/asmmacro.h with 100% similarity]
arch/ia64/include/asm/atomic.h [moved from include/asm-ia64/atomic.h with 100% similarity]
arch/ia64/include/asm/auxvec.h [moved from include/asm-ia64/auxvec.h with 100% similarity]
arch/ia64/include/asm/bitops.h [moved from include/asm-ia64/bitops.h with 100% similarity]
arch/ia64/include/asm/break.h [moved from include/asm-ia64/break.h with 100% similarity]
arch/ia64/include/asm/bug.h [moved from include/asm-ia64/bug.h with 100% similarity]
arch/ia64/include/asm/bugs.h [moved from include/asm-ia64/bugs.h with 100% similarity]
arch/ia64/include/asm/byteorder.h [moved from include/asm-ia64/byteorder.h with 100% similarity]
arch/ia64/include/asm/cache.h [moved from include/asm-ia64/cache.h with 100% similarity]
arch/ia64/include/asm/cacheflush.h [moved from include/asm-ia64/cacheflush.h with 100% similarity]
arch/ia64/include/asm/checksum.h [moved from include/asm-ia64/checksum.h with 100% similarity]
arch/ia64/include/asm/compat.h [moved from include/asm-ia64/compat.h with 100% similarity]
arch/ia64/include/asm/cpu.h [moved from include/asm-ia64/cpu.h with 100% similarity]
arch/ia64/include/asm/cputime.h [moved from include/asm-ia64/cputime.h with 97% similarity]
arch/ia64/include/asm/current.h [moved from include/asm-ia64/current.h with 100% similarity]
arch/ia64/include/asm/cyclone.h [moved from include/asm-ia64/cyclone.h with 100% similarity]
arch/ia64/include/asm/delay.h [moved from include/asm-ia64/delay.h with 100% similarity]
arch/ia64/include/asm/device.h [moved from include/asm-ia64/device.h with 100% similarity]
arch/ia64/include/asm/div64.h [moved from include/asm-ia64/div64.h with 100% similarity]
arch/ia64/include/asm/dma-mapping.h [moved from include/asm-ia64/dma-mapping.h with 100% similarity]
arch/ia64/include/asm/dma.h [moved from include/asm-ia64/dma.h with 100% similarity]
arch/ia64/include/asm/dmi.h [moved from include/asm-ia64/dmi.h with 100% similarity]
arch/ia64/include/asm/elf.h [moved from include/asm-ia64/elf.h with 100% similarity]
arch/ia64/include/asm/emergency-restart.h [moved from include/asm-ia64/emergency-restart.h with 100% similarity]
arch/ia64/include/asm/errno.h [moved from include/asm-ia64/errno.h with 100% similarity]
arch/ia64/include/asm/esi.h [moved from include/asm-ia64/esi.h with 100% similarity]
arch/ia64/include/asm/fb.h [moved from include/asm-ia64/fb.h with 100% similarity]
arch/ia64/include/asm/fcntl.h [moved from include/asm-ia64/fcntl.h with 100% similarity]
arch/ia64/include/asm/fpswa.h [moved from include/asm-ia64/fpswa.h with 100% similarity]
arch/ia64/include/asm/fpu.h [moved from include/asm-ia64/fpu.h with 100% similarity]
arch/ia64/include/asm/futex.h [moved from include/asm-ia64/futex.h with 100% similarity]
arch/ia64/include/asm/gcc_intrin.h [moved from include/asm-ia64/gcc_intrin.h with 100% similarity]
arch/ia64/include/asm/hardirq.h [moved from include/asm-ia64/hardirq.h with 100% similarity]
arch/ia64/include/asm/hpsim.h [moved from include/asm-ia64/hpsim.h with 100% similarity]
arch/ia64/include/asm/hugetlb.h [moved from include/asm-ia64/hugetlb.h with 100% similarity]
arch/ia64/include/asm/hw_irq.h [moved from include/asm-ia64/hw_irq.h with 100% similarity]
arch/ia64/include/asm/ia32.h [moved from include/asm-ia64/ia32.h with 100% similarity]
arch/ia64/include/asm/ia64regs.h [moved from include/asm-ia64/ia64regs.h with 100% similarity]
arch/ia64/include/asm/intel_intrin.h [moved from include/asm-ia64/intel_intrin.h with 100% similarity]
arch/ia64/include/asm/intrinsics.h [moved from include/asm-ia64/intrinsics.h with 100% similarity]
arch/ia64/include/asm/io.h [moved from include/asm-ia64/io.h with 100% similarity]
arch/ia64/include/asm/ioctl.h [moved from include/asm-ia64/ioctl.h with 100% similarity]
arch/ia64/include/asm/ioctls.h [moved from include/asm-ia64/ioctls.h with 100% similarity]
arch/ia64/include/asm/iosapic.h [moved from include/asm-ia64/iosapic.h with 100% similarity]
arch/ia64/include/asm/ipcbuf.h [moved from include/asm-ia64/ipcbuf.h with 100% similarity]
arch/ia64/include/asm/irq.h [moved from include/asm-ia64/irq.h with 100% similarity]
arch/ia64/include/asm/irq_regs.h [moved from include/asm-ia64/irq_regs.h with 100% similarity]
arch/ia64/include/asm/kdebug.h [moved from include/asm-ia64/kdebug.h with 98% similarity]
arch/ia64/include/asm/kexec.h [moved from include/asm-ia64/kexec.h with 100% similarity]
arch/ia64/include/asm/kmap_types.h [moved from include/asm-ia64/kmap_types.h with 100% similarity]
arch/ia64/include/asm/kprobes.h [moved from include/asm-ia64/kprobes.h with 99% similarity]
arch/ia64/include/asm/kregs.h [moved from include/asm-ia64/kregs.h with 100% similarity]
arch/ia64/include/asm/kvm.h [moved from include/asm-ia64/kvm.h with 98% similarity]
arch/ia64/include/asm/kvm_host.h [moved from include/asm-ia64/kvm_host.h with 100% similarity]
arch/ia64/include/asm/kvm_para.h [moved from include/asm-ia64/kvm_para.h with 97% similarity]
arch/ia64/include/asm/libata-portmap.h [moved from include/asm-ia64/libata-portmap.h with 100% similarity]
arch/ia64/include/asm/linkage.h [moved from include/asm-ia64/linkage.h with 100% similarity]
arch/ia64/include/asm/local.h [moved from include/asm-ia64/local.h with 100% similarity]
arch/ia64/include/asm/machvec.h [moved from include/asm-ia64/machvec.h with 99% similarity]
arch/ia64/include/asm/machvec_dig.h [moved from include/asm-ia64/machvec_dig.h with 100% similarity]
arch/ia64/include/asm/machvec_hpsim.h [moved from include/asm-ia64/machvec_hpsim.h with 100% similarity]
arch/ia64/include/asm/machvec_hpzx1.h [moved from include/asm-ia64/machvec_hpzx1.h with 100% similarity]
arch/ia64/include/asm/machvec_hpzx1_swiotlb.h [moved from include/asm-ia64/machvec_hpzx1_swiotlb.h with 100% similarity]
arch/ia64/include/asm/machvec_init.h [moved from include/asm-ia64/machvec_init.h with 100% similarity]
arch/ia64/include/asm/machvec_sn2.h [moved from include/asm-ia64/machvec_sn2.h with 100% similarity]
arch/ia64/include/asm/machvec_uv.h [moved from include/asm-ia64/machvec_uv.h with 100% similarity]
arch/ia64/include/asm/mc146818rtc.h [moved from include/asm-ia64/mc146818rtc.h with 100% similarity]
arch/ia64/include/asm/mca.h [moved from include/asm-ia64/mca.h with 100% similarity]
arch/ia64/include/asm/mca_asm.h [moved from include/asm-ia64/mca_asm.h with 100% similarity]
arch/ia64/include/asm/meminit.h [moved from include/asm-ia64/meminit.h with 100% similarity]
arch/ia64/include/asm/mman.h [moved from include/asm-ia64/mman.h with 100% similarity]
arch/ia64/include/asm/mmu.h [moved from include/asm-ia64/mmu.h with 100% similarity]
arch/ia64/include/asm/mmu_context.h [moved from include/asm-ia64/mmu_context.h with 100% similarity]
arch/ia64/include/asm/mmzone.h [moved from include/asm-ia64/mmzone.h with 100% similarity]
arch/ia64/include/asm/module.h [moved from include/asm-ia64/module.h with 100% similarity]
arch/ia64/include/asm/msgbuf.h [moved from include/asm-ia64/msgbuf.h with 100% similarity]
arch/ia64/include/asm/mutex.h [moved from include/asm-ia64/mutex.h with 100% similarity]
arch/ia64/include/asm/native/inst.h [moved from include/asm-ia64/native/inst.h with 99% similarity]
arch/ia64/include/asm/native/irq.h [moved from include/asm-ia64/native/irq.h with 93% similarity]
arch/ia64/include/asm/nodedata.h [moved from include/asm-ia64/nodedata.h with 100% similarity]
arch/ia64/include/asm/numa.h [moved from include/asm-ia64/numa.h with 100% similarity]
arch/ia64/include/asm/page.h [moved from include/asm-ia64/page.h with 100% similarity]
arch/ia64/include/asm/pal.h [moved from include/asm-ia64/pal.h with 100% similarity]
arch/ia64/include/asm/param.h [moved from include/asm-ia64/param.h with 100% similarity]
arch/ia64/include/asm/paravirt.h [moved from include/asm-ia64/paravirt.h with 99% similarity]
arch/ia64/include/asm/paravirt_privop.h [moved from include/asm-ia64/paravirt_privop.h with 98% similarity]
arch/ia64/include/asm/parport.h [moved from include/asm-ia64/parport.h with 100% similarity]
arch/ia64/include/asm/patch.h [moved from include/asm-ia64/patch.h with 100% similarity]
arch/ia64/include/asm/pci.h [moved from include/asm-ia64/pci.h with 100% similarity]
arch/ia64/include/asm/percpu.h [moved from include/asm-ia64/percpu.h with 100% similarity]
arch/ia64/include/asm/perfmon.h [moved from include/asm-ia64/perfmon.h with 100% similarity]
arch/ia64/include/asm/perfmon_default_smpl.h [moved from include/asm-ia64/perfmon_default_smpl.h with 100% similarity]
arch/ia64/include/asm/pgalloc.h [moved from include/asm-ia64/pgalloc.h with 100% similarity]
arch/ia64/include/asm/pgtable.h [moved from include/asm-ia64/pgtable.h with 100% similarity]
arch/ia64/include/asm/poll.h [moved from include/asm-ia64/poll.h with 100% similarity]
arch/ia64/include/asm/posix_types.h [moved from include/asm-ia64/posix_types.h with 100% similarity]
arch/ia64/include/asm/processor.h [moved from include/asm-ia64/processor.h with 100% similarity]
arch/ia64/include/asm/ptrace.h [moved from include/asm-ia64/ptrace.h with 100% similarity]
arch/ia64/include/asm/ptrace_offsets.h [moved from include/asm-ia64/ptrace_offsets.h with 100% similarity]
arch/ia64/include/asm/resource.h [moved from include/asm-ia64/resource.h with 100% similarity]
arch/ia64/include/asm/rse.h [moved from include/asm-ia64/rse.h with 100% similarity]
arch/ia64/include/asm/rwsem.h [moved from include/asm-ia64/rwsem.h with 99% similarity]
arch/ia64/include/asm/sal.h [moved from include/asm-ia64/sal.h with 100% similarity]
arch/ia64/include/asm/scatterlist.h [moved from include/asm-ia64/scatterlist.h with 100% similarity]
arch/ia64/include/asm/sections.h [moved from include/asm-ia64/sections.h with 100% similarity]
arch/ia64/include/asm/segment.h [moved from include/asm-ia64/segment.h with 100% similarity]
arch/ia64/include/asm/sembuf.h [moved from include/asm-ia64/sembuf.h with 100% similarity]
arch/ia64/include/asm/serial.h [moved from include/asm-ia64/serial.h with 93% similarity]
arch/ia64/include/asm/setup.h [moved from include/asm-ia64/setup.h with 100% similarity]
arch/ia64/include/asm/shmbuf.h [moved from include/asm-ia64/shmbuf.h with 100% similarity]
arch/ia64/include/asm/shmparam.h [moved from include/asm-ia64/shmparam.h with 100% similarity]
arch/ia64/include/asm/sigcontext.h [moved from include/asm-ia64/sigcontext.h with 100% similarity]
arch/ia64/include/asm/siginfo.h [moved from include/asm-ia64/siginfo.h with 100% similarity]
arch/ia64/include/asm/signal.h [moved from include/asm-ia64/signal.h with 100% similarity]
arch/ia64/include/asm/smp.h [moved from include/asm-ia64/smp.h with 100% similarity]
arch/ia64/include/asm/sn/acpi.h [moved from include/asm-ia64/sn/acpi.h with 100% similarity]
arch/ia64/include/asm/sn/addrs.h [moved from include/asm-ia64/sn/addrs.h with 100% similarity]
arch/ia64/include/asm/sn/arch.h [moved from include/asm-ia64/sn/arch.h with 100% similarity]
arch/ia64/include/asm/sn/bte.h [moved from include/asm-ia64/sn/bte.h with 100% similarity]
arch/ia64/include/asm/sn/clksupport.h [moved from include/asm-ia64/sn/clksupport.h with 100% similarity]
arch/ia64/include/asm/sn/geo.h [moved from include/asm-ia64/sn/geo.h with 100% similarity]
arch/ia64/include/asm/sn/intr.h [moved from include/asm-ia64/sn/intr.h with 100% similarity]
arch/ia64/include/asm/sn/io.h [moved from include/asm-ia64/sn/io.h with 100% similarity]
arch/ia64/include/asm/sn/ioc3.h [moved from include/asm-ia64/sn/ioc3.h with 100% similarity]
arch/ia64/include/asm/sn/klconfig.h [moved from include/asm-ia64/sn/klconfig.h with 100% similarity]
arch/ia64/include/asm/sn/l1.h [moved from include/asm-ia64/sn/l1.h with 100% similarity]
arch/ia64/include/asm/sn/leds.h [moved from include/asm-ia64/sn/leds.h with 100% similarity]
arch/ia64/include/asm/sn/module.h [moved from include/asm-ia64/sn/module.h with 100% similarity]
arch/ia64/include/asm/sn/mspec.h [moved from include/asm-ia64/sn/mspec.h with 76% similarity]
arch/ia64/include/asm/sn/nodepda.h [moved from include/asm-ia64/sn/nodepda.h with 100% similarity]
arch/ia64/include/asm/sn/pcibr_provider.h [moved from include/asm-ia64/sn/pcibr_provider.h with 100% similarity]
arch/ia64/include/asm/sn/pcibus_provider_defs.h [moved from include/asm-ia64/sn/pcibus_provider_defs.h with 100% similarity]
arch/ia64/include/asm/sn/pcidev.h [moved from include/asm-ia64/sn/pcidev.h with 100% similarity]
arch/ia64/include/asm/sn/pda.h [moved from include/asm-ia64/sn/pda.h with 100% similarity]
arch/ia64/include/asm/sn/pic.h [moved from include/asm-ia64/sn/pic.h with 100% similarity]
arch/ia64/include/asm/sn/rw_mmr.h [moved from include/asm-ia64/sn/rw_mmr.h with 100% similarity]
arch/ia64/include/asm/sn/shub_mmr.h [moved from include/asm-ia64/sn/shub_mmr.h with 100% similarity]
arch/ia64/include/asm/sn/shubio.h [moved from include/asm-ia64/sn/shubio.h with 100% similarity]
arch/ia64/include/asm/sn/simulator.h [moved from include/asm-ia64/sn/simulator.h with 100% similarity]
arch/ia64/include/asm/sn/sn2/sn_hwperf.h [moved from include/asm-ia64/sn/sn2/sn_hwperf.h with 100% similarity]
arch/ia64/include/asm/sn/sn_cpuid.h [moved from include/asm-ia64/sn/sn_cpuid.h with 100% similarity]
arch/ia64/include/asm/sn/sn_feature_sets.h [moved from include/asm-ia64/sn/sn_feature_sets.h with 100% similarity]
arch/ia64/include/asm/sn/sn_sal.h [moved from include/asm-ia64/sn/sn_sal.h with 99% similarity]
arch/ia64/include/asm/sn/tioca.h [moved from include/asm-ia64/sn/tioca.h with 100% similarity]
arch/ia64/include/asm/sn/tioca_provider.h [moved from include/asm-ia64/sn/tioca_provider.h with 100% similarity]
arch/ia64/include/asm/sn/tioce.h [moved from include/asm-ia64/sn/tioce.h with 100% similarity]
arch/ia64/include/asm/sn/tioce_provider.h [moved from include/asm-ia64/sn/tioce_provider.h with 100% similarity]
arch/ia64/include/asm/sn/tiocp.h [moved from include/asm-ia64/sn/tiocp.h with 100% similarity]
arch/ia64/include/asm/sn/tiocx.h [moved from include/asm-ia64/sn/tiocx.h with 100% similarity]
arch/ia64/include/asm/sn/types.h [moved from include/asm-ia64/sn/types.h with 100% similarity]
arch/ia64/include/asm/socket.h [moved from include/asm-ia64/socket.h with 100% similarity]
arch/ia64/include/asm/sockios.h [moved from include/asm-ia64/sockios.h with 100% similarity]
arch/ia64/include/asm/sparsemem.h [moved from include/asm-ia64/sparsemem.h with 100% similarity]
arch/ia64/include/asm/spinlock.h [moved from include/asm-ia64/spinlock.h with 100% similarity]
arch/ia64/include/asm/spinlock_types.h [moved from include/asm-ia64/spinlock_types.h with 100% similarity]
arch/ia64/include/asm/stat.h [moved from include/asm-ia64/stat.h with 100% similarity]
arch/ia64/include/asm/statfs.h [moved from include/asm-ia64/statfs.h with 100% similarity]
arch/ia64/include/asm/string.h [moved from include/asm-ia64/string.h with 100% similarity]
arch/ia64/include/asm/suspend.h [moved from include/asm-ia64/suspend.h with 100% similarity]
arch/ia64/include/asm/system.h [moved from include/asm-ia64/system.h with 100% similarity]
arch/ia64/include/asm/termbits.h [moved from include/asm-ia64/termbits.h with 100% similarity]
arch/ia64/include/asm/termios.h [moved from include/asm-ia64/termios.h with 100% similarity]
arch/ia64/include/asm/thread_info.h [moved from include/asm-ia64/thread_info.h with 100% similarity]
arch/ia64/include/asm/timex.h [moved from include/asm-ia64/timex.h with 100% similarity]
arch/ia64/include/asm/tlb.h [moved from include/asm-ia64/tlb.h with 100% similarity]
arch/ia64/include/asm/tlbflush.h [moved from include/asm-ia64/tlbflush.h with 100% similarity]
arch/ia64/include/asm/topology.h [moved from include/asm-ia64/topology.h with 98% similarity]
arch/ia64/include/asm/types.h [moved from include/asm-ia64/types.h with 100% similarity]
arch/ia64/include/asm/uaccess.h [moved from include/asm-ia64/uaccess.h with 100% similarity]
arch/ia64/include/asm/ucontext.h [moved from include/asm-ia64/ucontext.h with 100% similarity]
arch/ia64/include/asm/unaligned.h [moved from include/asm-ia64/unaligned.h with 100% similarity]
arch/ia64/include/asm/uncached.h [moved from include/asm-ia64/uncached.h with 100% similarity]
arch/ia64/include/asm/unistd.h [moved from include/asm-ia64/unistd.h with 100% similarity]
arch/ia64/include/asm/unwind.h [moved from include/asm-ia64/unwind.h with 100% similarity]
arch/ia64/include/asm/user.h [moved from include/asm-ia64/user.h with 100% similarity]
arch/ia64/include/asm/ustack.h [moved from include/asm-ia64/ustack.h with 100% similarity]
arch/ia64/include/asm/uv/uv_hub.h [moved from include/asm-ia64/uv/uv_hub.h with 100% similarity]
arch/ia64/include/asm/uv/uv_mmrs.h [moved from include/asm-ia64/uv/uv_mmrs.h with 100% similarity]
arch/ia64/include/asm/vga.h [moved from include/asm-ia64/vga.h with 100% similarity]
arch/ia64/include/asm/xor.h [moved from include/asm-ia64/xor.h with 97% similarity]
arch/ia64/kernel/.gitignore
arch/ia64/kernel/asm-offsets.c
arch/ia64/kernel/head.S
arch/ia64/kernel/iosapic.c
arch/ia64/kernel/ivt.S
arch/ia64/kernel/jprobes.S
arch/ia64/kernel/nr-irqs.c
arch/ia64/kernel/setup.c
arch/ia64/mm/hugetlbpage.c
arch/ia64/sn/kernel/iomv.c
arch/m68k/mac/baboon.c
arch/m68k/mac/via.c
arch/m68knommu/include/asm/Kbuild [moved from include/asm-m68knommu/Kbuild with 100% similarity]
arch/m68knommu/include/asm/MC68328.h [moved from include/asm-m68knommu/MC68328.h with 100% similarity]
arch/m68knommu/include/asm/MC68332.h [moved from include/asm-m68knommu/MC68332.h with 100% similarity]
arch/m68knommu/include/asm/MC68EZ328.h [moved from include/asm-m68knommu/MC68EZ328.h with 100% similarity]
arch/m68knommu/include/asm/MC68VZ328.h [moved from include/asm-m68knommu/MC68VZ328.h with 100% similarity]
arch/m68knommu/include/asm/a.out.h [moved from include/asm-m68knommu/a.out.h with 100% similarity]
arch/m68knommu/include/asm/anchor.h [moved from include/asm-m68knommu/anchor.h with 100% similarity]
arch/m68knommu/include/asm/atomic.h [moved from include/asm-m68knommu/atomic.h with 100% similarity]
arch/m68knommu/include/asm/auxvec.h [moved from include/asm-m68knommu/auxvec.h with 100% similarity]
arch/m68knommu/include/asm/bitops.h [moved from include/asm-m68knommu/bitops.h with 100% similarity]
arch/m68knommu/include/asm/bootinfo.h [moved from include/asm-m68knommu/bootinfo.h with 100% similarity]
arch/m68knommu/include/asm/bootstd.h [moved from include/asm-m68knommu/bootstd.h with 100% similarity]
arch/m68knommu/include/asm/bug.h [moved from include/asm-m68knommu/bug.h with 100% similarity]
arch/m68knommu/include/asm/bugs.h [moved from include/asm-m68knommu/bugs.h with 100% similarity]
arch/m68knommu/include/asm/byteorder.h [moved from include/asm-m68knommu/byteorder.h with 100% similarity]
arch/m68knommu/include/asm/cache.h [moved from include/asm-m68knommu/cache.h with 100% similarity]
arch/m68knommu/include/asm/cachectl.h [moved from include/asm-m68knommu/cachectl.h with 100% similarity]
arch/m68knommu/include/asm/cacheflush.h [moved from include/asm-m68knommu/cacheflush.h with 100% similarity]
arch/m68knommu/include/asm/checksum.h [moved from include/asm-m68knommu/checksum.h with 100% similarity]
arch/m68knommu/include/asm/coldfire.h [moved from include/asm-m68knommu/coldfire.h with 100% similarity]
arch/m68knommu/include/asm/commproc.h [moved from include/asm-m68knommu/commproc.h with 100% similarity]
arch/m68knommu/include/asm/cputime.h [moved from include/asm-m68knommu/cputime.h with 100% similarity]
arch/m68knommu/include/asm/current.h [moved from include/asm-m68knommu/current.h with 100% similarity]
arch/m68knommu/include/asm/dbg.h [moved from include/asm-m68knommu/dbg.h with 100% similarity]
arch/m68knommu/include/asm/delay.h [moved from include/asm-m68knommu/delay.h with 100% similarity]
arch/m68knommu/include/asm/device.h [moved from include/asm-m68knommu/device.h with 100% similarity]
arch/m68knommu/include/asm/div64.h [moved from include/asm-m68knommu/div64.h with 100% similarity]
arch/m68knommu/include/asm/dma-mapping.h [moved from include/asm-m68knommu/dma-mapping.h with 100% similarity]
arch/m68knommu/include/asm/dma.h [moved from include/asm-m68knommu/dma.h with 100% similarity]
arch/m68knommu/include/asm/elf.h [moved from include/asm-m68knommu/elf.h with 100% similarity]
arch/m68knommu/include/asm/elia.h [moved from include/asm-m68knommu/elia.h with 100% similarity]
arch/m68knommu/include/asm/emergency-restart.h [moved from include/asm-m68knommu/emergency-restart.h with 100% similarity]
arch/m68knommu/include/asm/entry.h [moved from include/asm-m68knommu/entry.h with 100% similarity]
arch/m68knommu/include/asm/errno.h [moved from include/asm-m68knommu/errno.h with 100% similarity]
arch/m68knommu/include/asm/fb.h [moved from include/asm-m68knommu/fb.h with 100% similarity]
arch/m68knommu/include/asm/fcntl.h [moved from include/asm-m68knommu/fcntl.h with 100% similarity]
arch/m68knommu/include/asm/flat.h [moved from include/asm-m68knommu/flat.h with 100% similarity]
arch/m68knommu/include/asm/fpu.h [moved from include/asm-m68knommu/fpu.h with 100% similarity]
arch/m68knommu/include/asm/futex.h [moved from include/asm-m68knommu/futex.h with 100% similarity]
arch/m68knommu/include/asm/hardirq.h [moved from include/asm-m68knommu/hardirq.h with 100% similarity]
arch/m68knommu/include/asm/hw_irq.h [moved from include/asm-m68knommu/hw_irq.h with 100% similarity]
arch/m68knommu/include/asm/hwtest.h [moved from include/asm-m68knommu/hwtest.h with 100% similarity]
arch/m68knommu/include/asm/io.h [moved from include/asm-m68knommu/io.h with 100% similarity]
arch/m68knommu/include/asm/ioctl.h [moved from include/asm-m68knommu/ioctl.h with 100% similarity]
arch/m68knommu/include/asm/ioctls.h [moved from include/asm-m68knommu/ioctls.h with 100% similarity]
arch/m68knommu/include/asm/ipcbuf.h [moved from include/asm-m68knommu/ipcbuf.h with 100% similarity]
arch/m68knommu/include/asm/irq.h [moved from include/asm-m68knommu/irq.h with 100% similarity]
arch/m68knommu/include/asm/irq_regs.h [moved from include/asm-m68knommu/irq_regs.h with 100% similarity]
arch/m68knommu/include/asm/kdebug.h [moved from include/asm-m68knommu/kdebug.h with 100% similarity]
arch/m68knommu/include/asm/kmap_types.h [moved from include/asm-m68knommu/kmap_types.h with 100% similarity]
arch/m68knommu/include/asm/linkage.h [moved from include/asm-m68knommu/linkage.h with 100% similarity]
arch/m68knommu/include/asm/local.h [moved from include/asm-m68knommu/local.h with 100% similarity]
arch/m68knommu/include/asm/m5206sim.h [moved from include/asm-m68knommu/m5206sim.h with 100% similarity]
arch/m68knommu/include/asm/m520xsim.h [moved from include/asm-m68knommu/m520xsim.h with 100% similarity]
arch/m68knommu/include/asm/m523xsim.h [moved from include/asm-m68knommu/m523xsim.h with 100% similarity]
arch/m68knommu/include/asm/m5249sim.h [moved from include/asm-m68knommu/m5249sim.h with 100% similarity]
arch/m68knommu/include/asm/m5272sim.h [moved from include/asm-m68knommu/m5272sim.h with 100% similarity]
arch/m68knommu/include/asm/m527xsim.h [moved from include/asm-m68knommu/m527xsim.h with 100% similarity]
arch/m68knommu/include/asm/m528xsim.h [moved from include/asm-m68knommu/m528xsim.h with 100% similarity]
arch/m68knommu/include/asm/m5307sim.h [moved from include/asm-m68knommu/m5307sim.h with 100% similarity]
arch/m68knommu/include/asm/m532xsim.h [moved from include/asm-m68knommu/m532xsim.h with 100% similarity]
arch/m68knommu/include/asm/m5407sim.h [moved from include/asm-m68knommu/m5407sim.h with 100% similarity]
arch/m68knommu/include/asm/m68360.h [moved from include/asm-m68knommu/m68360.h with 100% similarity]
arch/m68knommu/include/asm/m68360_enet.h [moved from include/asm-m68knommu/m68360_enet.h with 100% similarity]
arch/m68knommu/include/asm/m68360_pram.h [moved from include/asm-m68knommu/m68360_pram.h with 100% similarity]
arch/m68knommu/include/asm/m68360_quicc.h [moved from include/asm-m68knommu/m68360_quicc.h with 100% similarity]
arch/m68knommu/include/asm/m68360_regs.h [moved from include/asm-m68knommu/m68360_regs.h with 100% similarity]
arch/m68knommu/include/asm/machdep.h [moved from include/asm-m68knommu/machdep.h with 100% similarity]
arch/m68knommu/include/asm/math-emu.h [moved from include/asm-m68knommu/math-emu.h with 100% similarity]
arch/m68knommu/include/asm/mc146818rtc.h [moved from include/asm-m68knommu/mc146818rtc.h with 100% similarity]
arch/m68knommu/include/asm/mcfcache.h [moved from include/asm-m68knommu/mcfcache.h with 100% similarity]
arch/m68knommu/include/asm/mcfdma.h [moved from include/asm-m68knommu/mcfdma.h with 100% similarity]
arch/m68knommu/include/asm/mcfmbus.h [moved from include/asm-m68knommu/mcfmbus.h with 100% similarity]
arch/m68knommu/include/asm/mcfne.h [moved from include/asm-m68knommu/mcfne.h with 100% similarity]
arch/m68knommu/include/asm/mcfpci.h [moved from include/asm-m68knommu/mcfpci.h with 100% similarity]
arch/m68knommu/include/asm/mcfpit.h [moved from include/asm-m68knommu/mcfpit.h with 100% similarity]
arch/m68knommu/include/asm/mcfsim.h [moved from include/asm-m68knommu/mcfsim.h with 100% similarity]
arch/m68knommu/include/asm/mcfsmc.h [moved from include/asm-m68knommu/mcfsmc.h with 100% similarity]
arch/m68knommu/include/asm/mcftimer.h [moved from include/asm-m68knommu/mcftimer.h with 100% similarity]
arch/m68knommu/include/asm/mcfuart.h [moved from include/asm-m68knommu/mcfuart.h with 100% similarity]
arch/m68knommu/include/asm/mcfwdebug.h [moved from include/asm-m68knommu/mcfwdebug.h with 100% similarity]
arch/m68knommu/include/asm/md.h [moved from include/asm-m68knommu/md.h with 100% similarity]
arch/m68knommu/include/asm/mman.h [moved from include/asm-m68knommu/mman.h with 100% similarity]
arch/m68knommu/include/asm/mmu.h [moved from include/asm-m68knommu/mmu.h with 100% similarity]
arch/m68knommu/include/asm/mmu_context.h [moved from include/asm-m68knommu/mmu_context.h with 100% similarity]
arch/m68knommu/include/asm/module.h [moved from include/asm-m68knommu/module.h with 100% similarity]
arch/m68knommu/include/asm/movs.h [moved from include/asm-m68knommu/movs.h with 100% similarity]
arch/m68knommu/include/asm/msgbuf.h [moved from include/asm-m68knommu/msgbuf.h with 100% similarity]
arch/m68knommu/include/asm/mutex.h [moved from include/asm-m68knommu/mutex.h with 100% similarity]
arch/m68knommu/include/asm/nettel.h [moved from include/asm-m68knommu/nettel.h with 100% similarity]
arch/m68knommu/include/asm/openprom.h [moved from include/asm-m68knommu/openprom.h with 100% similarity]
arch/m68knommu/include/asm/oplib.h [moved from include/asm-m68knommu/oplib.h with 100% similarity]
arch/m68knommu/include/asm/page.h [moved from include/asm-m68knommu/page.h with 100% similarity]
arch/m68knommu/include/asm/page_offset.h [moved from include/asm-m68knommu/page_offset.h with 100% similarity]
arch/m68knommu/include/asm/param.h [moved from include/asm-m68knommu/param.h with 100% similarity]
arch/m68knommu/include/asm/pci.h [moved from include/asm-m68knommu/pci.h with 100% similarity]
arch/m68knommu/include/asm/percpu.h [moved from include/asm-m68knommu/percpu.h with 100% similarity]
arch/m68knommu/include/asm/pgalloc.h [moved from include/asm-m68knommu/pgalloc.h with 100% similarity]
arch/m68knommu/include/asm/pgtable.h [moved from include/asm-m68knommu/pgtable.h with 100% similarity]
arch/m68knommu/include/asm/poll.h [moved from include/asm-m68knommu/poll.h with 100% similarity]
arch/m68knommu/include/asm/posix_types.h [moved from include/asm-m68knommu/posix_types.h with 100% similarity]
arch/m68knommu/include/asm/processor.h [moved from include/asm-m68knommu/processor.h with 100% similarity]
arch/m68knommu/include/asm/ptrace.h [moved from include/asm-m68knommu/ptrace.h with 100% similarity]
arch/m68knommu/include/asm/quicc_simple.h [moved from include/asm-m68knommu/quicc_simple.h with 100% similarity]
arch/m68knommu/include/asm/resource.h [moved from include/asm-m68knommu/resource.h with 100% similarity]
arch/m68knommu/include/asm/rtc.h [moved from include/asm-m68knommu/rtc.h with 100% similarity]
arch/m68knommu/include/asm/scatterlist.h [moved from include/asm-m68knommu/scatterlist.h with 100% similarity]
arch/m68knommu/include/asm/sections.h [moved from include/asm-m68knommu/sections.h with 100% similarity]
arch/m68knommu/include/asm/segment.h [moved from include/asm-m68knommu/segment.h with 100% similarity]
arch/m68knommu/include/asm/sembuf.h [moved from include/asm-m68knommu/sembuf.h with 100% similarity]
arch/m68knommu/include/asm/setup.h [moved from include/asm-m68knommu/setup.h with 100% similarity]
arch/m68knommu/include/asm/shm.h [moved from include/asm-m68knommu/shm.h with 100% similarity]
arch/m68knommu/include/asm/shmbuf.h [moved from include/asm-m68knommu/shmbuf.h with 100% similarity]
arch/m68knommu/include/asm/shmparam.h [moved from include/asm-m68knommu/shmparam.h with 100% similarity]
arch/m68knommu/include/asm/sigcontext.h [moved from include/asm-m68knommu/sigcontext.h with 100% similarity]
arch/m68knommu/include/asm/siginfo.h [moved from include/asm-m68knommu/siginfo.h with 100% similarity]
arch/m68knommu/include/asm/signal.h [moved from include/asm-m68knommu/signal.h with 100% similarity]
arch/m68knommu/include/asm/smp.h [moved from include/asm-m68knommu/smp.h with 100% similarity]
arch/m68knommu/include/asm/socket.h [moved from include/asm-m68knommu/socket.h with 100% similarity]
arch/m68knommu/include/asm/sockios.h [moved from include/asm-m68knommu/sockios.h with 100% similarity]
arch/m68knommu/include/asm/spinlock.h [moved from include/asm-m68knommu/spinlock.h with 100% similarity]
arch/m68knommu/include/asm/stat.h [moved from include/asm-m68knommu/stat.h with 100% similarity]
arch/m68knommu/include/asm/statfs.h [moved from include/asm-m68knommu/statfs.h with 100% similarity]
arch/m68knommu/include/asm/string.h [moved from include/asm-m68knommu/string.h with 100% similarity]
arch/m68knommu/include/asm/system.h [moved from include/asm-m68knommu/system.h with 100% similarity]
arch/m68knommu/include/asm/termbits.h [moved from include/asm-m68knommu/termbits.h with 100% similarity]
arch/m68knommu/include/asm/termios.h [moved from include/asm-m68knommu/termios.h with 100% similarity]
arch/m68knommu/include/asm/thread_info.h [moved from include/asm-m68knommu/thread_info.h with 100% similarity]
arch/m68knommu/include/asm/timex.h [moved from include/asm-m68knommu/timex.h with 100% similarity]
arch/m68knommu/include/asm/tlb.h [moved from include/asm-m68knommu/tlb.h with 100% similarity]
arch/m68knommu/include/asm/tlbflush.h [moved from include/asm-m68knommu/tlbflush.h with 100% similarity]
arch/m68knommu/include/asm/topology.h [moved from include/asm-m68knommu/topology.h with 100% similarity]
arch/m68knommu/include/asm/traps.h [moved from include/asm-m68knommu/traps.h with 100% similarity]
arch/m68knommu/include/asm/types.h [moved from include/asm-m68knommu/types.h with 100% similarity]
arch/m68knommu/include/asm/uaccess.h [moved from include/asm-m68knommu/uaccess.h with 100% similarity]
arch/m68knommu/include/asm/ucontext.h [moved from include/asm-m68knommu/ucontext.h with 100% similarity]
arch/m68knommu/include/asm/unaligned.h [moved from include/asm-m68knommu/unaligned.h with 100% similarity]
arch/m68knommu/include/asm/unistd.h [moved from include/asm-m68knommu/unistd.h with 100% similarity]
arch/m68knommu/include/asm/user.h [moved from include/asm-m68knommu/user.h with 100% similarity]
arch/mips/Kconfig
arch/mips/Kconfig.debug
arch/mips/au1000/Kconfig
arch/mips/au1000/common/Makefile
arch/mips/au1000/common/dbg_io.c [deleted file]
arch/mips/au1000/db1x00/init.c
arch/mips/au1000/mtx-1/init.c
arch/mips/au1000/pb1000/init.c
arch/mips/au1000/pb1100/init.c
arch/mips/au1000/pb1200/init.c
arch/mips/au1000/pb1500/init.c
arch/mips/au1000/pb1550/init.c
arch/mips/au1000/xxs1500/init.c
arch/mips/basler/excite/Makefile
arch/mips/basler/excite/excite_dbg_io.c [deleted file]
arch/mips/basler/excite/excite_irq.c
arch/mips/basler/excite/excite_setup.c
arch/mips/configs/cobalt_defconfig
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/excite_defconfig
arch/mips/configs/ip27_defconfig
arch/mips/configs/msp71xx_defconfig
arch/mips/configs/mtx1_defconfig
arch/mips/configs/pb1100_defconfig
arch/mips/configs/pb1500_defconfig
arch/mips/configs/pb1550_defconfig
arch/mips/configs/pnx8550-jbs_defconfig
arch/mips/configs/pnx8550-stb810_defconfig
arch/mips/configs/rbtx49xx_defconfig
arch/mips/configs/sb1250-swarm_defconfig
arch/mips/configs/yosemite_defconfig
arch/mips/emma2rh/markeins/platform.c
arch/mips/emma2rh/markeins/setup.c
arch/mips/jazz/setup.c
arch/mips/kernel/Makefile
arch/mips/kernel/gdb-low.S [deleted file]
arch/mips/kernel/gdb-stub.c [deleted file]
arch/mips/kernel/irq.c
arch/mips/kernel/kgdb.c [new file with mode: 0644]
arch/mips/kernel/traps.c
arch/mips/mm/tlb-r3k.c
arch/mips/mti-malta/Makefile
arch/mips/mti-malta/malta-init.c
arch/mips/mti-malta/malta-kgdb.c [deleted file]
arch/mips/mti-malta/malta-setup.c
arch/mips/nxp/pnx8550/common/Makefile
arch/mips/nxp/pnx8550/common/gdb_hook.c [deleted file]
arch/mips/nxp/pnx8550/common/int.c
arch/mips/nxp/pnx8550/common/proc.c
arch/mips/nxp/pnx8550/common/setup.c
arch/mips/pci/ops-tx3927.c
arch/mips/pci/ops-tx4927.c
arch/mips/pci/pci-tx4927.c
arch/mips/pci/pci-tx4938.c
arch/mips/pci/pci.c
arch/mips/pmc-sierra/msp71xx/msp_serial.c
arch/mips/pmc-sierra/yosemite/Makefile
arch/mips/pmc-sierra/yosemite/dbg_io.c [deleted file]
arch/mips/pmc-sierra/yosemite/irq.c
arch/mips/rb532/gpio.c
arch/mips/rb532/time.c
arch/mips/sgi-ip22/ip22-setup.c
arch/mips/sgi-ip27/Makefile
arch/mips/sgi-ip27/ip27-dbgio.c [deleted file]
arch/mips/sibyte/bcm1480/irq.c
arch/mips/sibyte/cfe/setup.c
arch/mips/sibyte/sb1250/irq.c
arch/mips/sibyte/swarm/Makefile
arch/mips/sibyte/swarm/dbg_io.c [deleted file]
arch/mips/txx9/Kconfig
arch/mips/txx9/generic/Makefile
arch/mips/txx9/generic/dbgio.c [deleted file]
arch/mips/txx9/generic/irq_tx3927.c [new file with mode: 0644]
arch/mips/txx9/generic/pci.c
arch/mips/txx9/generic/setup.c
arch/mips/txx9/generic/setup_tx3927.c [new file with mode: 0644]
arch/mips/txx9/generic/setup_tx4927.c
arch/mips/txx9/generic/setup_tx4938.c
arch/mips/txx9/generic/smsc_fdc37m81x.c
arch/mips/txx9/jmr3927/Makefile
arch/mips/txx9/jmr3927/irq.c
arch/mips/txx9/jmr3927/kgdb_io.c [deleted file]
arch/mips/txx9/jmr3927/prom.c
arch/mips/txx9/jmr3927/setup.c
arch/mips/txx9/rbtx4927/irq.c
arch/mips/txx9/rbtx4927/prom.c
arch/mips/txx9/rbtx4927/setup.c
arch/mips/txx9/rbtx4938/irq.c
arch/mips/txx9/rbtx4938/prom.c
arch/mips/txx9/rbtx4938/setup.c
arch/mn10300/kernel/entry.S
arch/mn10300/kernel/module.c
arch/powerpc/Kconfig
arch/powerpc/Kconfig.debug
arch/powerpc/boot/dts/mpc832x_mds.dts
arch/powerpc/boot/dts/mpc832x_rdb.dts
arch/powerpc/boot/dts/mpc8349emitx.dts
arch/powerpc/boot/dts/mpc8349emitxgp.dts
arch/powerpc/boot/dts/mpc834x_mds.dts
arch/powerpc/boot/dts/mpc836x_mds.dts
arch/powerpc/boot/dts/mpc836x_rdk.dts
arch/powerpc/boot/dts/mpc8377_mds.dts
arch/powerpc/boot/dts/mpc8378_mds.dts
arch/powerpc/boot/dts/mpc8379_mds.dts
arch/powerpc/boot/dts/mpc8536ds.dts
arch/powerpc/boot/dts/mpc8540ads.dts
arch/powerpc/boot/dts/mpc8541cds.dts
arch/powerpc/boot/dts/mpc8544ds.dts
arch/powerpc/boot/dts/mpc8548cds.dts
arch/powerpc/boot/dts/mpc8555cds.dts
arch/powerpc/boot/dts/mpc8560ads.dts
arch/powerpc/boot/dts/mpc8568mds.dts
arch/powerpc/boot/dts/mpc8572ds.dts
arch/powerpc/boot/dts/mpc8610_hpcd.dts
arch/powerpc/boot/io.h
arch/powerpc/include/asm/8253pit.h [moved from include/asm-powerpc/8253pit.h with 100% similarity]
arch/powerpc/include/asm/8xx_immap.h [moved from include/asm-powerpc/8xx_immap.h with 100% similarity]
arch/powerpc/include/asm/Kbuild [moved from include/asm-powerpc/Kbuild with 100% similarity]
arch/powerpc/include/asm/a.out.h [moved from include/asm-powerpc/a.out.h with 100% similarity]
arch/powerpc/include/asm/abs_addr.h [moved from include/asm-powerpc/abs_addr.h with 100% similarity]
arch/powerpc/include/asm/agp.h [moved from include/asm-powerpc/agp.h with 100% similarity]
arch/powerpc/include/asm/asm-compat.h [moved from include/asm-powerpc/asm-compat.h with 100% similarity]
arch/powerpc/include/asm/atomic.h [moved from include/asm-powerpc/atomic.h with 100% similarity]
arch/powerpc/include/asm/auxvec.h [moved from include/asm-powerpc/auxvec.h with 100% similarity]
arch/powerpc/include/asm/backlight.h [moved from include/asm-powerpc/backlight.h with 100% similarity]
arch/powerpc/include/asm/bitops.h [moved from include/asm-powerpc/bitops.h with 100% similarity]
arch/powerpc/include/asm/bootx.h [moved from include/asm-powerpc/bootx.h with 100% similarity]
arch/powerpc/include/asm/btext.h [moved from include/asm-powerpc/btext.h with 100% similarity]
arch/powerpc/include/asm/bug.h [moved from include/asm-powerpc/bug.h with 100% similarity]
arch/powerpc/include/asm/bugs.h [moved from include/asm-powerpc/bugs.h with 100% similarity]
arch/powerpc/include/asm/byteorder.h [moved from include/asm-powerpc/byteorder.h with 100% similarity]
arch/powerpc/include/asm/cache.h [moved from include/asm-powerpc/cache.h with 100% similarity]
arch/powerpc/include/asm/cacheflush.h [moved from include/asm-powerpc/cacheflush.h with 100% similarity]
arch/powerpc/include/asm/cell-pmu.h [moved from include/asm-powerpc/cell-pmu.h with 100% similarity]
arch/powerpc/include/asm/cell-regs.h [moved from include/asm-powerpc/cell-regs.h with 100% similarity]
arch/powerpc/include/asm/checksum.h [moved from include/asm-powerpc/checksum.h with 100% similarity]
arch/powerpc/include/asm/clk_interface.h [moved from include/asm-powerpc/clk_interface.h with 100% similarity]
arch/powerpc/include/asm/code-patching.h [moved from include/asm-powerpc/code-patching.h with 100% similarity]
arch/powerpc/include/asm/compat.h [moved from include/asm-powerpc/compat.h with 100% similarity]
arch/powerpc/include/asm/cpm.h [moved from include/asm-powerpc/cpm.h with 98% similarity]
arch/powerpc/include/asm/cpm1.h [moved from include/asm-powerpc/cpm1.h with 100% similarity]
arch/powerpc/include/asm/cpm2.h [moved from include/asm-powerpc/cpm2.h with 98% similarity]
arch/powerpc/include/asm/cputable.h [moved from include/asm-powerpc/cputable.h with 100% similarity]
arch/powerpc/include/asm/cputhreads.h [moved from include/asm-powerpc/cputhreads.h with 100% similarity]
arch/powerpc/include/asm/cputime.h [moved from include/asm-powerpc/cputime.h with 100% similarity]
arch/powerpc/include/asm/current.h [moved from include/asm-powerpc/current.h with 100% similarity]
arch/powerpc/include/asm/dbdma.h [moved from include/asm-powerpc/dbdma.h with 100% similarity]
arch/powerpc/include/asm/dcr-generic.h [moved from include/asm-powerpc/dcr-generic.h with 100% similarity]
arch/powerpc/include/asm/dcr-mmio.h [moved from include/asm-powerpc/dcr-mmio.h with 100% similarity]
arch/powerpc/include/asm/dcr-native.h [moved from include/asm-powerpc/dcr-native.h with 100% similarity]
arch/powerpc/include/asm/dcr-regs.h [moved from include/asm-powerpc/dcr-regs.h with 100% similarity]
arch/powerpc/include/asm/dcr.h [moved from include/asm-powerpc/dcr.h with 94% similarity]
arch/powerpc/include/asm/delay.h [moved from include/asm-powerpc/delay.h with 100% similarity]
arch/powerpc/include/asm/device.h [moved from include/asm-powerpc/device.h with 100% similarity]
arch/powerpc/include/asm/div64.h [moved from include/asm-powerpc/div64.h with 100% similarity]
arch/powerpc/include/asm/dma-mapping.h [moved from include/asm-powerpc/dma-mapping.h with 100% similarity]
arch/powerpc/include/asm/dma.h [moved from include/asm-powerpc/dma.h with 100% similarity]
arch/powerpc/include/asm/edac.h [moved from include/asm-powerpc/edac.h with 100% similarity]
arch/powerpc/include/asm/eeh.h [moved from include/asm-powerpc/eeh.h with 100% similarity]
arch/powerpc/include/asm/eeh_event.h [moved from include/asm-powerpc/eeh_event.h with 100% similarity]
arch/powerpc/include/asm/elf.h [moved from include/asm-powerpc/elf.h with 100% similarity]
arch/powerpc/include/asm/emergency-restart.h [moved from include/asm-powerpc/emergency-restart.h with 100% similarity]
arch/powerpc/include/asm/errno.h [moved from include/asm-powerpc/errno.h with 100% similarity]
arch/powerpc/include/asm/exception.h [moved from include/asm-powerpc/exception.h with 100% similarity]
arch/powerpc/include/asm/fb.h [moved from include/asm-powerpc/fb.h with 100% similarity]
arch/powerpc/include/asm/fcntl.h [moved from include/asm-powerpc/fcntl.h with 100% similarity]
arch/powerpc/include/asm/feature-fixups.h [moved from include/asm-powerpc/feature-fixups.h with 100% similarity]
arch/powerpc/include/asm/firmware.h [moved from include/asm-powerpc/firmware.h with 100% similarity]
arch/powerpc/include/asm/fixmap.h [moved from include/asm-powerpc/fixmap.h with 100% similarity]
arch/powerpc/include/asm/floppy.h [moved from include/asm-powerpc/floppy.h with 100% similarity]
arch/powerpc/include/asm/fs_pd.h [moved from include/asm-powerpc/fs_pd.h with 100% similarity]
arch/powerpc/include/asm/fsl_gtm.h [moved from include/asm-powerpc/fsl_gtm.h with 100% similarity]
arch/powerpc/include/asm/fsl_lbc.h [moved from include/asm-powerpc/fsl_lbc.h with 100% similarity]
arch/powerpc/include/asm/ftrace.h [moved from include/asm-powerpc/ftrace.h with 100% similarity]
arch/powerpc/include/asm/futex.h [moved from include/asm-powerpc/futex.h with 100% similarity]
arch/powerpc/include/asm/gpio.h [moved from include/asm-powerpc/gpio.h with 100% similarity]
arch/powerpc/include/asm/grackle.h [moved from include/asm-powerpc/grackle.h with 100% similarity]
arch/powerpc/include/asm/hardirq.h [moved from include/asm-powerpc/hardirq.h with 100% similarity]
arch/powerpc/include/asm/heathrow.h [moved from include/asm-powerpc/heathrow.h with 100% similarity]
arch/powerpc/include/asm/highmem.h [moved from include/asm-powerpc/highmem.h with 100% similarity]
arch/powerpc/include/asm/hugetlb.h [moved from include/asm-powerpc/hugetlb.h with 100% similarity]
arch/powerpc/include/asm/hvcall.h [moved from include/asm-powerpc/hvcall.h with 100% similarity]
arch/powerpc/include/asm/hvconsole.h [moved from include/asm-powerpc/hvconsole.h with 100% similarity]
arch/powerpc/include/asm/hvcserver.h [moved from include/asm-powerpc/hvcserver.h with 100% similarity]
arch/powerpc/include/asm/hw_irq.h [moved from include/asm-powerpc/hw_irq.h with 100% similarity]
arch/powerpc/include/asm/hydra.h [moved from include/asm-powerpc/hydra.h with 100% similarity]
arch/powerpc/include/asm/i8259.h [moved from include/asm-powerpc/i8259.h with 71% similarity]
arch/powerpc/include/asm/ibmebus.h [moved from include/asm-powerpc/ibmebus.h with 100% similarity]
arch/powerpc/include/asm/ide.h [moved from include/asm-powerpc/ide.h with 98% similarity]
arch/powerpc/include/asm/immap_86xx.h [moved from include/asm-powerpc/immap_86xx.h with 100% similarity]
arch/powerpc/include/asm/immap_cpm2.h [moved from include/asm-powerpc/immap_cpm2.h with 100% similarity]
arch/powerpc/include/asm/immap_qe.h [moved from include/asm-powerpc/immap_qe.h with 99% similarity]
arch/powerpc/include/asm/io-defs.h [moved from include/asm-powerpc/io-defs.h with 100% similarity]
arch/powerpc/include/asm/io.h [moved from include/asm-powerpc/io.h with 100% similarity]
arch/powerpc/include/asm/ioctl.h [moved from include/asm-powerpc/ioctl.h with 100% similarity]
arch/powerpc/include/asm/ioctls.h [moved from include/asm-powerpc/ioctls.h with 100% similarity]
arch/powerpc/include/asm/iommu.h [moved from include/asm-powerpc/iommu.h with 100% similarity]
arch/powerpc/include/asm/ipcbuf.h [moved from include/asm-powerpc/ipcbuf.h with 100% similarity]
arch/powerpc/include/asm/ipic.h [moved from include/asm-powerpc/ipic.h with 93% similarity]
arch/powerpc/include/asm/irq.h [moved from include/asm-powerpc/irq.h with 58% similarity]
arch/powerpc/include/asm/irq_regs.h [moved from include/asm-powerpc/irq_regs.h with 100% similarity]
arch/powerpc/include/asm/irqflags.h [moved from include/asm-powerpc/irqflags.h with 93% similarity]
arch/powerpc/include/asm/iseries/alpaca.h [moved from include/asm-powerpc/iseries/alpaca.h with 100% similarity]
arch/powerpc/include/asm/iseries/hv_call.h [moved from include/asm-powerpc/iseries/hv_call.h with 100% similarity]
arch/powerpc/include/asm/iseries/hv_call_event.h [moved from include/asm-powerpc/iseries/hv_call_event.h with 100% similarity]
arch/powerpc/include/asm/iseries/hv_call_sc.h [moved from include/asm-powerpc/iseries/hv_call_sc.h with 100% similarity]
arch/powerpc/include/asm/iseries/hv_call_xm.h [moved from include/asm-powerpc/iseries/hv_call_xm.h with 100% similarity]
arch/powerpc/include/asm/iseries/hv_lp_config.h [moved from include/asm-powerpc/iseries/hv_lp_config.h with 100% similarity]
arch/powerpc/include/asm/iseries/hv_lp_event.h [moved from include/asm-powerpc/iseries/hv_lp_event.h with 100% similarity]
arch/powerpc/include/asm/iseries/hv_types.h [moved from include/asm-powerpc/iseries/hv_types.h with 100% similarity]
arch/powerpc/include/asm/iseries/iommu.h [moved from include/asm-powerpc/iseries/iommu.h with 100% similarity]
arch/powerpc/include/asm/iseries/it_lp_queue.h [moved from include/asm-powerpc/iseries/it_lp_queue.h with 100% similarity]
arch/powerpc/include/asm/iseries/lpar_map.h [moved from include/asm-powerpc/iseries/lpar_map.h with 100% similarity]
arch/powerpc/include/asm/iseries/mf.h [moved from include/asm-powerpc/iseries/mf.h with 100% similarity]
arch/powerpc/include/asm/iseries/vio.h [moved from include/asm-powerpc/iseries/vio.h with 100% similarity]
arch/powerpc/include/asm/kdebug.h [moved from include/asm-powerpc/kdebug.h with 100% similarity]
arch/powerpc/include/asm/kdump.h [moved from include/asm-powerpc/kdump.h with 100% similarity]
arch/powerpc/include/asm/kexec.h [moved from include/asm-powerpc/kexec.h with 100% similarity]
arch/powerpc/include/asm/keylargo.h [moved from include/asm-powerpc/keylargo.h with 100% similarity]
arch/powerpc/include/asm/kgdb.h [moved from include/asm-powerpc/kgdb.h with 98% similarity]
arch/powerpc/include/asm/kmap_types.h [moved from include/asm-powerpc/kmap_types.h with 100% similarity]
arch/powerpc/include/asm/kprobes.h [moved from include/asm-powerpc/kprobes.h with 100% similarity]
arch/powerpc/include/asm/kvm.h [moved from include/asm-powerpc/kvm.h with 100% similarity]
arch/powerpc/include/asm/kvm_asm.h [moved from include/asm-powerpc/kvm_asm.h with 100% similarity]
arch/powerpc/include/asm/kvm_host.h [moved from include/asm-powerpc/kvm_host.h with 100% similarity]
arch/powerpc/include/asm/kvm_para.h [moved from include/asm-powerpc/kvm_para.h with 100% similarity]
arch/powerpc/include/asm/kvm_ppc.h [moved from include/asm-powerpc/kvm_ppc.h with 100% similarity]
arch/powerpc/include/asm/libata-portmap.h [moved from include/asm-powerpc/libata-portmap.h with 100% similarity]
arch/powerpc/include/asm/linkage.h [moved from include/asm-powerpc/linkage.h with 100% similarity]
arch/powerpc/include/asm/lmb.h [moved from include/asm-powerpc/lmb.h with 100% similarity]
arch/powerpc/include/asm/local.h [moved from include/asm-powerpc/local.h with 100% similarity]
arch/powerpc/include/asm/lppaca.h [moved from include/asm-powerpc/lppaca.h with 100% similarity]
arch/powerpc/include/asm/lv1call.h [moved from include/asm-powerpc/lv1call.h with 100% similarity]
arch/powerpc/include/asm/machdep.h [moved from include/asm-powerpc/machdep.h with 100% similarity]
arch/powerpc/include/asm/macio.h [moved from include/asm-powerpc/macio.h with 100% similarity]
arch/powerpc/include/asm/mc146818rtc.h [moved from include/asm-powerpc/mc146818rtc.h with 100% similarity]
arch/powerpc/include/asm/mediabay.h [moved from include/asm-powerpc/mediabay.h with 100% similarity]
arch/powerpc/include/asm/mman.h [moved from include/asm-powerpc/mman.h with 100% similarity]
arch/powerpc/include/asm/mmu-40x.h [moved from include/asm-powerpc/mmu-40x.h with 100% similarity]
arch/powerpc/include/asm/mmu-44x.h [moved from include/asm-powerpc/mmu-44x.h with 100% similarity]
arch/powerpc/include/asm/mmu-8xx.h [moved from include/asm-powerpc/mmu-8xx.h with 100% similarity]
arch/powerpc/include/asm/mmu-fsl-booke.h [moved from include/asm-powerpc/mmu-fsl-booke.h with 100% similarity]
arch/powerpc/include/asm/mmu-hash32.h [moved from include/asm-powerpc/mmu-hash32.h with 100% similarity]
arch/powerpc/include/asm/mmu-hash64.h [moved from include/asm-powerpc/mmu-hash64.h with 100% similarity]
arch/powerpc/include/asm/mmu.h [moved from include/asm-powerpc/mmu.h with 100% similarity]
arch/powerpc/include/asm/mmu_context.h [moved from include/asm-powerpc/mmu_context.h with 100% similarity]
arch/powerpc/include/asm/mmzone.h [moved from include/asm-powerpc/mmzone.h with 100% similarity]
arch/powerpc/include/asm/module.h [moved from include/asm-powerpc/module.h with 100% similarity]
arch/powerpc/include/asm/mpc512x.h [moved from include/asm-powerpc/mpc512x.h with 100% similarity]
arch/powerpc/include/asm/mpc52xx.h [moved from include/asm-powerpc/mpc52xx.h with 100% similarity]
arch/powerpc/include/asm/mpc52xx_psc.h [moved from include/asm-powerpc/mpc52xx_psc.h with 100% similarity]
arch/powerpc/include/asm/mpc6xx.h [moved from include/asm-powerpc/mpc6xx.h with 100% similarity]
arch/powerpc/include/asm/mpc8260.h [moved from include/asm-powerpc/mpc8260.h with 100% similarity]
arch/powerpc/include/asm/mpc86xx.h [moved from include/asm-powerpc/mpc86xx.h with 100% similarity]
arch/powerpc/include/asm/mpc8xx.h [moved from include/asm-powerpc/mpc8xx.h with 100% similarity]
arch/powerpc/include/asm/mpic.h [moved from include/asm-powerpc/mpic.h with 100% similarity]
arch/powerpc/include/asm/msgbuf.h [moved from include/asm-powerpc/msgbuf.h with 100% similarity]
arch/powerpc/include/asm/mutex.h [moved from include/asm-powerpc/mutex.h with 100% similarity]
arch/powerpc/include/asm/nvram.h [moved from include/asm-powerpc/nvram.h with 100% similarity]
arch/powerpc/include/asm/of_device.h [moved from include/asm-powerpc/of_device.h with 100% similarity]
arch/powerpc/include/asm/of_platform.h [moved from include/asm-powerpc/of_platform.h with 100% similarity]
arch/powerpc/include/asm/ohare.h [moved from include/asm-powerpc/ohare.h with 100% similarity]
arch/powerpc/include/asm/oprofile_impl.h [moved from include/asm-powerpc/oprofile_impl.h with 100% similarity]
arch/powerpc/include/asm/pSeries_reconfig.h [moved from include/asm-powerpc/pSeries_reconfig.h with 100% similarity]
arch/powerpc/include/asm/paca.h [moved from include/asm-powerpc/paca.h with 99% similarity]
arch/powerpc/include/asm/page.h [moved from include/asm-powerpc/page.h with 100% similarity]
arch/powerpc/include/asm/page_32.h [moved from include/asm-powerpc/page_32.h with 100% similarity]
arch/powerpc/include/asm/page_64.h [moved from include/asm-powerpc/page_64.h with 100% similarity]
arch/powerpc/include/asm/param.h [moved from include/asm-powerpc/param.h with 100% similarity]
arch/powerpc/include/asm/parport.h [moved from include/asm-powerpc/parport.h with 100% similarity]
arch/powerpc/include/asm/pasemi_dma.h [moved from include/asm-powerpc/pasemi_dma.h with 100% similarity]
arch/powerpc/include/asm/pci-bridge.h [moved from include/asm-powerpc/pci-bridge.h with 100% similarity]
arch/powerpc/include/asm/pci.h [moved from include/asm-powerpc/pci.h with 100% similarity]
arch/powerpc/include/asm/percpu.h [moved from include/asm-powerpc/percpu.h with 100% similarity]
arch/powerpc/include/asm/pgalloc-32.h [moved from include/asm-powerpc/pgalloc-32.h with 100% similarity]
arch/powerpc/include/asm/pgalloc-64.h [moved from include/asm-powerpc/pgalloc-64.h with 100% similarity]
arch/powerpc/include/asm/pgalloc.h [moved from include/asm-powerpc/pgalloc.h with 100% similarity]
arch/powerpc/include/asm/pgtable-4k.h [moved from include/asm-powerpc/pgtable-4k.h with 100% similarity]
arch/powerpc/include/asm/pgtable-64k.h [moved from include/asm-powerpc/pgtable-64k.h with 100% similarity]
arch/powerpc/include/asm/pgtable-ppc32.h [moved from include/asm-powerpc/pgtable-ppc32.h with 100% similarity]
arch/powerpc/include/asm/pgtable-ppc64.h [moved from include/asm-powerpc/pgtable-ppc64.h with 99% similarity]
arch/powerpc/include/asm/pgtable.h [moved from include/asm-powerpc/pgtable.h with 100% similarity]
arch/powerpc/include/asm/phyp_dump.h [moved from include/asm-powerpc/phyp_dump.h with 100% similarity]
arch/powerpc/include/asm/pmac_feature.h [moved from include/asm-powerpc/pmac_feature.h with 100% similarity]
arch/powerpc/include/asm/pmac_low_i2c.h [moved from include/asm-powerpc/pmac_low_i2c.h with 100% similarity]
arch/powerpc/include/asm/pmac_pfunc.h [moved from include/asm-powerpc/pmac_pfunc.h with 100% similarity]
arch/powerpc/include/asm/pmc.h [moved from include/asm-powerpc/pmc.h with 100% similarity]
arch/powerpc/include/asm/pmi.h [moved from include/asm-powerpc/pmi.h with 100% similarity]
arch/powerpc/include/asm/poll.h [moved from include/asm-powerpc/poll.h with 100% similarity]
arch/powerpc/include/asm/posix_types.h [moved from include/asm-powerpc/posix_types.h with 100% similarity]
arch/powerpc/include/asm/ppc-pci.h [moved from include/asm-powerpc/ppc-pci.h with 100% similarity]
arch/powerpc/include/asm/ppc4xx.h [moved from include/asm-powerpc/ppc4xx.h with 100% similarity]
arch/powerpc/include/asm/ppc_asm.h [moved from include/asm-powerpc/ppc_asm.h with 100% similarity]
arch/powerpc/include/asm/processor.h [moved from include/asm-powerpc/processor.h with 100% similarity]
arch/powerpc/include/asm/prom.h [moved from include/asm-powerpc/prom.h with 100% similarity]
arch/powerpc/include/asm/ps3.h [moved from include/asm-powerpc/ps3.h with 100% similarity]
arch/powerpc/include/asm/ps3av.h [moved from include/asm-powerpc/ps3av.h with 100% similarity]
arch/powerpc/include/asm/ps3fb.h [moved from include/asm-powerpc/ps3fb.h with 100% similarity]
arch/powerpc/include/asm/ps3stor.h [moved from include/asm-powerpc/ps3stor.h with 100% similarity]
arch/powerpc/include/asm/ptrace.h [moved from include/asm-powerpc/ptrace.h with 100% similarity]
arch/powerpc/include/asm/qe.h [moved from include/asm-powerpc/qe.h with 100% similarity]
arch/powerpc/include/asm/qe_ic.h [moved from include/asm-powerpc/qe_ic.h with 99% similarity]
arch/powerpc/include/asm/reg.h [moved from include/asm-powerpc/reg.h with 100% similarity]
arch/powerpc/include/asm/reg_8xx.h [moved from include/asm-powerpc/reg_8xx.h with 100% similarity]
arch/powerpc/include/asm/reg_booke.h [moved from include/asm-powerpc/reg_booke.h with 100% similarity]
arch/powerpc/include/asm/reg_fsl_emb.h [moved from include/asm-powerpc/reg_fsl_emb.h with 100% similarity]
arch/powerpc/include/asm/resource.h [moved from include/asm-powerpc/resource.h with 100% similarity]
arch/powerpc/include/asm/rheap.h [moved from include/asm-powerpc/rheap.h with 100% similarity]
arch/powerpc/include/asm/rio.h [moved from include/asm-powerpc/rio.h with 100% similarity]
arch/powerpc/include/asm/rtas.h [moved from include/asm-powerpc/rtas.h with 100% similarity]
arch/powerpc/include/asm/rtc.h [moved from include/asm-powerpc/rtc.h with 100% similarity]
arch/powerpc/include/asm/rwsem.h [moved from include/asm-powerpc/rwsem.h with 96% similarity]
arch/powerpc/include/asm/scatterlist.h [moved from include/asm-powerpc/scatterlist.h with 100% similarity]
arch/powerpc/include/asm/seccomp.h [moved from include/asm-powerpc/seccomp.h with 100% similarity]
arch/powerpc/include/asm/sections.h [moved from include/asm-powerpc/sections.h with 100% similarity]
arch/powerpc/include/asm/sembuf.h [moved from include/asm-powerpc/sembuf.h with 100% similarity]
arch/powerpc/include/asm/serial.h [moved from include/asm-powerpc/serial.h with 100% similarity]
arch/powerpc/include/asm/setjmp.h [moved from include/asm-powerpc/setjmp.h with 100% similarity]
arch/powerpc/include/asm/setup.h [moved from include/asm-powerpc/setup.h with 100% similarity]
arch/powerpc/include/asm/shmbuf.h [moved from include/asm-powerpc/shmbuf.h with 100% similarity]
arch/powerpc/include/asm/shmparam.h [moved from include/asm-powerpc/shmparam.h with 100% similarity]
arch/powerpc/include/asm/sigcontext.h [moved from include/asm-powerpc/sigcontext.h with 100% similarity]
arch/powerpc/include/asm/siginfo.h [moved from include/asm-powerpc/siginfo.h with 100% similarity]
arch/powerpc/include/asm/signal.h [moved from include/asm-powerpc/signal.h with 100% similarity]
arch/powerpc/include/asm/smp.h [moved from include/asm-powerpc/smp.h with 100% similarity]
arch/powerpc/include/asm/smu.h [moved from include/asm-powerpc/smu.h with 100% similarity]
arch/powerpc/include/asm/socket.h [moved from include/asm-powerpc/socket.h with 100% similarity]
arch/powerpc/include/asm/sockios.h [moved from include/asm-powerpc/sockios.h with 100% similarity]
arch/powerpc/include/asm/sparsemem.h [moved from include/asm-powerpc/sparsemem.h with 100% similarity]
arch/powerpc/include/asm/spinlock.h [moved from include/asm-powerpc/spinlock.h with 100% similarity]
arch/powerpc/include/asm/spinlock_types.h [moved from include/asm-powerpc/spinlock_types.h with 100% similarity]
arch/powerpc/include/asm/spu.h [moved from include/asm-powerpc/spu.h with 100% similarity]
arch/powerpc/include/asm/spu_csa.h [moved from include/asm-powerpc/spu_csa.h with 100% similarity]
arch/powerpc/include/asm/spu_info.h [moved from include/asm-powerpc/spu_info.h with 100% similarity]
arch/powerpc/include/asm/spu_priv1.h [moved from include/asm-powerpc/spu_priv1.h with 100% similarity]
arch/powerpc/include/asm/sstep.h [moved from include/asm-powerpc/sstep.h with 100% similarity]
arch/powerpc/include/asm/stat.h [moved from include/asm-powerpc/stat.h with 100% similarity]
arch/powerpc/include/asm/statfs.h [moved from include/asm-powerpc/statfs.h with 100% similarity]
arch/powerpc/include/asm/string.h [moved from include/asm-powerpc/string.h with 100% similarity]
arch/powerpc/include/asm/suspend.h [moved from include/asm-powerpc/suspend.h with 100% similarity]
arch/powerpc/include/asm/synch.h [moved from include/asm-powerpc/synch.h with 100% similarity]
arch/powerpc/include/asm/syscall.h [moved from include/asm-powerpc/syscall.h with 100% similarity]
arch/powerpc/include/asm/syscalls.h [moved from include/asm-powerpc/syscalls.h with 100% similarity]
arch/powerpc/include/asm/systbl.h [moved from include/asm-powerpc/systbl.h with 100% similarity]
arch/powerpc/include/asm/system.h [moved from include/asm-powerpc/system.h with 100% similarity]
arch/powerpc/include/asm/tce.h [moved from include/asm-powerpc/tce.h with 100% similarity]
arch/powerpc/include/asm/termbits.h [moved from include/asm-powerpc/termbits.h with 100% similarity]
arch/powerpc/include/asm/termios.h [moved from include/asm-powerpc/termios.h with 100% similarity]
arch/powerpc/include/asm/thread_info.h [moved from include/asm-powerpc/thread_info.h with 100% similarity]
arch/powerpc/include/asm/time.h [moved from include/asm-powerpc/time.h with 100% similarity]
arch/powerpc/include/asm/timex.h [moved from include/asm-powerpc/timex.h with 100% similarity]
arch/powerpc/include/asm/tlb.h [moved from include/asm-powerpc/tlb.h with 100% similarity]
arch/powerpc/include/asm/tlbflush.h [moved from include/asm-powerpc/tlbflush.h with 100% similarity]
arch/powerpc/include/asm/topology.h [moved from include/asm-powerpc/topology.h with 100% similarity]
arch/powerpc/include/asm/tsi108.h [moved from include/asm-powerpc/tsi108.h with 100% similarity]
arch/powerpc/include/asm/tsi108_irq.h [moved from include/asm-powerpc/tsi108_irq.h with 100% similarity]
arch/powerpc/include/asm/tsi108_pci.h [moved from include/asm-powerpc/tsi108_pci.h with 100% similarity]
arch/powerpc/include/asm/types.h [moved from include/asm-powerpc/types.h with 100% similarity]
arch/powerpc/include/asm/uaccess.h [moved from include/asm-powerpc/uaccess.h with 100% similarity]
arch/powerpc/include/asm/ucc.h [moved from include/asm-powerpc/ucc.h with 100% similarity]
arch/powerpc/include/asm/ucc_fast.h [moved from include/asm-powerpc/ucc_fast.h with 99% similarity]
arch/powerpc/include/asm/ucc_slow.h [moved from include/asm-powerpc/ucc_slow.h with 100% similarity]
arch/powerpc/include/asm/ucontext.h [moved from include/asm-powerpc/ucontext.h with 100% similarity]
arch/powerpc/include/asm/udbg.h [moved from include/asm-powerpc/udbg.h with 100% similarity]
arch/powerpc/include/asm/uic.h [moved from include/asm-powerpc/uic.h with 95% similarity]
arch/powerpc/include/asm/unaligned.h [moved from include/asm-powerpc/unaligned.h with 100% similarity]
arch/powerpc/include/asm/uninorth.h [moved from include/asm-powerpc/uninorth.h with 100% similarity]
arch/powerpc/include/asm/unistd.h [moved from include/asm-powerpc/unistd.h with 100% similarity]
arch/powerpc/include/asm/user.h [moved from include/asm-powerpc/user.h with 100% similarity]
arch/powerpc/include/asm/vdso.h [moved from include/asm-powerpc/vdso.h with 100% similarity]
arch/powerpc/include/asm/vdso_datapage.h [moved from include/asm-powerpc/vdso_datapage.h with 100% similarity]
arch/powerpc/include/asm/vga.h [moved from include/asm-powerpc/vga.h with 100% similarity]
arch/powerpc/include/asm/vio.h [moved from include/asm-powerpc/vio.h with 100% similarity]
arch/powerpc/include/asm/xilinx_intc.h [moved from include/asm-powerpc/xilinx_intc.h with 100% similarity]
arch/powerpc/include/asm/xmon.h [moved from include/asm-powerpc/xmon.h with 100% similarity]
arch/powerpc/include/asm/xor.h [moved from include/asm-powerpc/xor.h with 100% similarity]
arch/powerpc/kernel/Makefile
arch/powerpc/kernel/cpu_setup_44x.S
arch/powerpc/kernel/irq.c
arch/powerpc/kernel/lparcfg.c
arch/powerpc/kernel/process.c
arch/powerpc/kernel/ptrace.c
arch/powerpc/kernel/ptrace32.c
arch/powerpc/kernel/vdso.c
arch/powerpc/lib/Makefile
arch/powerpc/mm/Makefile
arch/powerpc/mm/gup.c [new file with mode: 0644]
arch/powerpc/mm/mem.c
arch/powerpc/mm/ppc_mmu_32.c
arch/powerpc/mm/tlb_64.c
arch/powerpc/platforms/52xx/Makefile
arch/powerpc/platforms/83xx/mpc832x_mds.c
arch/powerpc/platforms/83xx/mpc832x_rdb.c
arch/powerpc/platforms/83xx/mpc834x_itx.c
arch/powerpc/platforms/83xx/mpc834x_mds.c
arch/powerpc/platforms/83xx/mpc836x_mds.c
arch/powerpc/platforms/83xx/sbc834x.c
arch/powerpc/platforms/85xx/ksi8560.c
arch/powerpc/platforms/85xx/mpc8536_ds.c
arch/powerpc/platforms/85xx/mpc85xx_ads.c
arch/powerpc/platforms/85xx/mpc85xx_ds.c
arch/powerpc/platforms/85xx/mpc85xx_mds.c
arch/powerpc/platforms/85xx/sbc8560.c
arch/powerpc/platforms/86xx/mpc86xx_smp.c
arch/powerpc/platforms/8xx/Kconfig
arch/powerpc/platforms/Kconfig
arch/powerpc/platforms/Makefile
arch/powerpc/platforms/cell/cbe_cpufreq_pmi.c
arch/powerpc/platforms/iseries/Kconfig
arch/powerpc/platforms/powermac/Makefile
arch/powerpc/sysdev/Makefile
arch/powerpc/sysdev/cpm1.c
arch/powerpc/sysdev/cpm2.c
arch/powerpc/sysdev/cpm_common.c
arch/powerpc/sysdev/rtc_cmos_setup.c
arch/s390/Kconfig
arch/s390/include/asm/Kbuild [moved from include/asm-s390/Kbuild with 100% similarity]
arch/s390/include/asm/airq.h [moved from include/asm-s390/airq.h with 100% similarity]
arch/s390/include/asm/appldata.h [moved from include/asm-s390/appldata.h with 100% similarity]
arch/s390/include/asm/atomic.h [moved from include/asm-s390/atomic.h with 100% similarity]
arch/s390/include/asm/auxvec.h [moved from include/asm-s390/auxvec.h with 100% similarity]
arch/s390/include/asm/bitops.h [moved from include/asm-s390/bitops.h with 100% similarity]
arch/s390/include/asm/bug.h [moved from include/asm-s390/bug.h with 100% similarity]
arch/s390/include/asm/bugs.h [moved from include/asm-s390/bugs.h with 100% similarity]
arch/s390/include/asm/byteorder.h [moved from include/asm-s390/byteorder.h with 100% similarity]
arch/s390/include/asm/cache.h [moved from include/asm-s390/cache.h with 100% similarity]
arch/s390/include/asm/cacheflush.h [moved from include/asm-s390/cacheflush.h with 100% similarity]
arch/s390/include/asm/ccwdev.h [moved from include/asm-s390/ccwdev.h with 100% similarity]
arch/s390/include/asm/ccwgroup.h [moved from include/asm-s390/ccwgroup.h with 100% similarity]
arch/s390/include/asm/checksum.h [moved from include/asm-s390/checksum.h with 100% similarity]
arch/s390/include/asm/chpid.h [moved from include/asm-s390/chpid.h with 100% similarity]
arch/s390/include/asm/chsc.h [moved from include/asm-s390/chsc.h with 100% similarity]
arch/s390/include/asm/cio.h [moved from include/asm-s390/cio.h with 100% similarity]
arch/s390/include/asm/cmb.h [moved from include/asm-s390/cmb.h with 100% similarity]
arch/s390/include/asm/compat.h [moved from include/asm-s390/compat.h with 100% similarity]
arch/s390/include/asm/cpcmd.h [moved from include/asm-s390/cpcmd.h with 100% similarity]
arch/s390/include/asm/cpu.h [moved from include/asm-s390/cpu.h with 100% similarity]
arch/s390/include/asm/cputime.h [moved from include/asm-s390/cputime.h with 100% similarity]
arch/s390/include/asm/current.h [moved from include/asm-s390/current.h with 100% similarity]
arch/s390/include/asm/dasd.h [moved from include/asm-s390/dasd.h with 100% similarity]
arch/s390/include/asm/debug.h [moved from include/asm-s390/debug.h with 100% similarity]
arch/s390/include/asm/delay.h [moved from include/asm-s390/delay.h with 100% similarity]
arch/s390/include/asm/device.h [moved from include/asm-s390/device.h with 100% similarity]
arch/s390/include/asm/diag.h [moved from include/asm-s390/diag.h with 100% similarity]
arch/s390/include/asm/div64.h [moved from include/asm-s390/div64.h with 100% similarity]
arch/s390/include/asm/dma.h [moved from include/asm-s390/dma.h with 100% similarity]
arch/s390/include/asm/ebcdic.h [moved from include/asm-s390/ebcdic.h with 100% similarity]
arch/s390/include/asm/elf.h [moved from include/asm-s390/elf.h with 100% similarity]
arch/s390/include/asm/emergency-restart.h [moved from include/asm-s390/emergency-restart.h with 100% similarity]
arch/s390/include/asm/errno.h [moved from include/asm-s390/errno.h with 100% similarity]
arch/s390/include/asm/etr.h [moved from include/asm-s390/etr.h with 100% similarity]
arch/s390/include/asm/extmem.h [moved from include/asm-s390/extmem.h with 100% similarity]
arch/s390/include/asm/fb.h [moved from include/asm-s390/fb.h with 100% similarity]
arch/s390/include/asm/fcntl.h [moved from include/asm-s390/fcntl.h with 100% similarity]
arch/s390/include/asm/fcx.h [moved from include/asm-s390/fcx.h with 100% similarity]
arch/s390/include/asm/futex.h [moved from include/asm-s390/futex.h with 100% similarity]
arch/s390/include/asm/hardirq.h [moved from include/asm-s390/hardirq.h with 76% similarity]
arch/s390/include/asm/hugetlb.h [moved from include/asm-s390/hugetlb.h with 100% similarity]
arch/s390/include/asm/idals.h [moved from include/asm-s390/idals.h with 100% similarity]
arch/s390/include/asm/io.h [moved from include/asm-s390/io.h with 100% similarity]
arch/s390/include/asm/ioctl.h [moved from include/asm-s390/ioctl.h with 100% similarity]
arch/s390/include/asm/ioctls.h [moved from include/asm-s390/ioctls.h with 100% similarity]
arch/s390/include/asm/ipcbuf.h [moved from include/asm-s390/ipcbuf.h with 100% similarity]
arch/s390/include/asm/ipl.h [moved from include/asm-s390/ipl.h with 98% similarity]
arch/s390/include/asm/irq.h [moved from include/asm-s390/irq.h with 100% similarity]
arch/s390/include/asm/irq_regs.h [moved from include/asm-s390/irq_regs.h with 100% similarity]
arch/s390/include/asm/irqflags.h [moved from include/asm-s390/irqflags.h with 100% similarity]
arch/s390/include/asm/isc.h [moved from include/asm-s390/isc.h with 100% similarity]
arch/s390/include/asm/itcw.h [moved from include/asm-s390/itcw.h with 100% similarity]
arch/s390/include/asm/kdebug.h [moved from include/asm-s390/kdebug.h with 100% similarity]
arch/s390/include/asm/kexec.h [moved from include/asm-s390/kexec.h with 100% similarity]
arch/s390/include/asm/kmap_types.h [moved from include/asm-s390/kmap_types.h with 100% similarity]
arch/s390/include/asm/kprobes.h [moved from include/asm-s390/kprobes.h with 100% similarity]
arch/s390/include/asm/kvm.h [moved from include/asm-s390/kvm.h with 100% similarity]
arch/s390/include/asm/kvm_host.h [moved from include/asm-s390/kvm_host.h with 100% similarity]
arch/s390/include/asm/kvm_para.h [moved from include/asm-s390/kvm_para.h with 100% similarity]
arch/s390/include/asm/kvm_virtio.h [moved from include/asm-s390/kvm_virtio.h with 100% similarity]
arch/s390/include/asm/linkage.h [moved from include/asm-s390/linkage.h with 100% similarity]
arch/s390/include/asm/local.h [moved from include/asm-s390/local.h with 100% similarity]
arch/s390/include/asm/lowcore.h [moved from include/asm-s390/lowcore.h with 100% similarity]
arch/s390/include/asm/mathemu.h [moved from include/asm-s390/mathemu.h with 100% similarity]
arch/s390/include/asm/mman.h [moved from include/asm-s390/mman.h with 100% similarity]
arch/s390/include/asm/mmu.h [moved from include/asm-s390/mmu.h with 100% similarity]
arch/s390/include/asm/mmu_context.h [moved from include/asm-s390/mmu_context.h with 100% similarity]
arch/s390/include/asm/module.h [moved from include/asm-s390/module.h with 100% similarity]
arch/s390/include/asm/monwriter.h [moved from include/asm-s390/monwriter.h with 100% similarity]
arch/s390/include/asm/msgbuf.h [moved from include/asm-s390/msgbuf.h with 100% similarity]
arch/s390/include/asm/mutex.h [moved from include/asm-s390/mutex.h with 100% similarity]
arch/s390/include/asm/page.h [moved from include/asm-s390/page.h with 100% similarity]
arch/s390/include/asm/param.h [moved from include/asm-s390/param.h with 100% similarity]
arch/s390/include/asm/pci.h [moved from include/asm-s390/pci.h with 100% similarity]
arch/s390/include/asm/percpu.h [moved from include/asm-s390/percpu.h with 100% similarity]
arch/s390/include/asm/pgalloc.h [moved from include/asm-s390/pgalloc.h with 100% similarity]
arch/s390/include/asm/pgtable.h [moved from include/asm-s390/pgtable.h with 100% similarity]
arch/s390/include/asm/poll.h [moved from include/asm-s390/poll.h with 100% similarity]
arch/s390/include/asm/posix_types.h [moved from include/asm-s390/posix_types.h with 100% similarity]
arch/s390/include/asm/processor.h [moved from include/asm-s390/processor.h with 100% similarity]
arch/s390/include/asm/ptrace.h [moved from include/asm-s390/ptrace.h with 100% similarity]
arch/s390/include/asm/qdio.h [moved from include/asm-s390/qdio.h with 100% similarity]
arch/s390/include/asm/qeth.h [moved from include/asm-s390/qeth.h with 100% similarity]
arch/s390/include/asm/reset.h [moved from include/asm-s390/reset.h with 100% similarity]
arch/s390/include/asm/resource.h [moved from include/asm-s390/resource.h with 100% similarity]
arch/s390/include/asm/rwsem.h [moved from include/asm-s390/rwsem.h with 100% similarity]
arch/s390/include/asm/s390_ext.h [moved from include/asm-s390/s390_ext.h with 100% similarity]
arch/s390/include/asm/s390_rdev.h [moved from include/asm-s390/s390_rdev.h with 100% similarity]
arch/s390/include/asm/scatterlist.h [moved from include/asm-s390/scatterlist.h with 100% similarity]
arch/s390/include/asm/schid.h [moved from include/asm-s390/schid.h with 96% similarity]
arch/s390/include/asm/sclp.h [moved from include/asm-s390/sclp.h with 100% similarity]
arch/s390/include/asm/sections.h [moved from include/asm-s390/sections.h with 100% similarity]
arch/s390/include/asm/segment.h [moved from include/asm-s390/segment.h with 100% similarity]
arch/s390/include/asm/sembuf.h [moved from include/asm-s390/sembuf.h with 100% similarity]
arch/s390/include/asm/setup.h [moved from include/asm-s390/setup.h with 99% similarity]
arch/s390/include/asm/sfp-machine.h [moved from include/asm-s390/sfp-machine.h with 100% similarity]
arch/s390/include/asm/sfp-util.h [moved from include/asm-s390/sfp-util.h with 100% similarity]
arch/s390/include/asm/shmbuf.h [moved from include/asm-s390/shmbuf.h with 100% similarity]
arch/s390/include/asm/shmparam.h [moved from include/asm-s390/shmparam.h with 100% similarity]
arch/s390/include/asm/sigcontext.h [moved from include/asm-s390/sigcontext.h with 100% similarity]
arch/s390/include/asm/siginfo.h [moved from include/asm-s390/siginfo.h with 100% similarity]
arch/s390/include/asm/signal.h [moved from include/asm-s390/signal.h with 100% similarity]
arch/s390/include/asm/sigp.h [moved from include/asm-s390/sigp.h with 100% similarity]
arch/s390/include/asm/smp.h [moved from include/asm-s390/smp.h with 100% similarity]
arch/s390/include/asm/socket.h [moved from include/asm-s390/socket.h with 100% similarity]
arch/s390/include/asm/sockios.h [moved from include/asm-s390/sockios.h with 100% similarity]
arch/s390/include/asm/sparsemem.h [moved from include/asm-s390/sparsemem.h with 100% similarity]
arch/s390/include/asm/spinlock.h [moved from include/asm-s390/spinlock.h with 100% similarity]
arch/s390/include/asm/spinlock_types.h [moved from include/asm-s390/spinlock_types.h with 100% similarity]
arch/s390/include/asm/stat.h [moved from include/asm-s390/stat.h with 100% similarity]
arch/s390/include/asm/statfs.h [moved from include/asm-s390/statfs.h with 100% similarity]
arch/s390/include/asm/string.h [moved from include/asm-s390/string.h with 100% similarity]
arch/s390/include/asm/suspend.h [moved from include/asm-s390/suspend.h with 100% similarity]
arch/s390/include/asm/sysinfo.h [moved from include/asm-s390/sysinfo.h with 100% similarity]
arch/s390/include/asm/system.h [moved from include/asm-s390/system.h with 100% similarity]
arch/s390/include/asm/tape390.h [moved from include/asm-s390/tape390.h with 100% similarity]
arch/s390/include/asm/termbits.h [moved from include/asm-s390/termbits.h with 100% similarity]
arch/s390/include/asm/termios.h [moved from include/asm-s390/termios.h with 100% similarity]
arch/s390/include/asm/thread_info.h [moved from include/asm-s390/thread_info.h with 100% similarity]
arch/s390/include/asm/timer.h [moved from include/asm-s390/timer.h with 100% similarity]
arch/s390/include/asm/timex.h [moved from include/asm-s390/timex.h with 100% similarity]
arch/s390/include/asm/tlb.h [moved from include/asm-s390/tlb.h with 100% similarity]
arch/s390/include/asm/tlbflush.h [moved from include/asm-s390/tlbflush.h with 100% similarity]
arch/s390/include/asm/todclk.h [moved from include/asm-s390/todclk.h with 100% similarity]
arch/s390/include/asm/topology.h [moved from include/asm-s390/topology.h with 100% similarity]
arch/s390/include/asm/types.h [moved from include/asm-s390/types.h with 100% similarity]
arch/s390/include/asm/uaccess.h [moved from include/asm-s390/uaccess.h with 100% similarity]
arch/s390/include/asm/ucontext.h [moved from include/asm-s390/ucontext.h with 100% similarity]
arch/s390/include/asm/unaligned.h [moved from include/asm-s390/unaligned.h with 100% similarity]
arch/s390/include/asm/unistd.h [moved from include/asm-s390/unistd.h with 98% similarity]
arch/s390/include/asm/user.h [moved from include/asm-s390/user.h with 100% similarity]
arch/s390/include/asm/vtoc.h [moved from include/asm-s390/vtoc.h with 100% similarity]
arch/s390/include/asm/xor.h [moved from include/asm-s390/xor.h with 100% similarity]
arch/s390/include/asm/zcrypt.h [moved from include/asm-s390/zcrypt.h with 100% similarity]
arch/s390/kernel/compat_wrapper.S
arch/s390/kernel/ipl.c
arch/s390/kernel/mem_detect.c
arch/s390/kernel/syscalls.S
arch/s390/kernel/time.c
arch/s390/kvm/priv.c
arch/s390/lib/delay.c
arch/s390/mm/init.c
arch/sh/Kconfig
arch/sh/Kconfig.debug
arch/sh/Makefile
arch/sh/boards/Kconfig [new file with mode: 0644]
arch/sh/boards/Makefile [new file with mode: 0644]
arch/sh/boards/board-ap325rxa.c [moved from arch/sh/boards/renesas/ap325rxa/setup.c with 99% similarity]
arch/sh/boards/board-magicpanelr2.c [moved from arch/sh/boards/magicpanelr2/setup.c with 100% similarity]
arch/sh/boards/board-rsk7203.c [moved from arch/sh/boards/renesas/rsk7203/setup.c with 92% similarity]
arch/sh/boards/board-sh7785lcr.c [moved from arch/sh/boards/renesas/sh7785lcr/setup.c with 100% similarity]
arch/sh/boards/board-shmin.c [moved from arch/sh/boards/shmin/setup.c with 100% similarity]
arch/sh/boards/mach-cayman/Makefile [moved from arch/sh/boards/cayman/Makefile with 100% similarity]
arch/sh/boards/mach-cayman/irq.c [moved from arch/sh/boards/cayman/irq.c with 99% similarity]
arch/sh/boards/mach-cayman/led.c [moved from arch/sh/boards/cayman/led.c with 100% similarity]
arch/sh/boards/mach-cayman/setup.c [moved from arch/sh/boards/cayman/setup.c with 99% similarity]
arch/sh/boards/mach-dreamcast/Makefile [moved from arch/sh/boards/dreamcast/Makefile with 100% similarity]
arch/sh/boards/mach-dreamcast/irq.c [moved from arch/sh/boards/dreamcast/irq.c with 99% similarity]
arch/sh/boards/mach-dreamcast/rtc.c [moved from arch/sh/boards/dreamcast/rtc.c with 100% similarity]
arch/sh/boards/mach-dreamcast/setup.c [moved from arch/sh/boards/dreamcast/setup.c with 98% similarity]
arch/sh/boards/mach-edosk7705/Makefile [moved from arch/sh/boards/renesas/edosk7705/Makefile with 100% similarity]
arch/sh/boards/mach-edosk7705/io.c [moved from arch/sh/boards/renesas/edosk7705/io.c with 100% similarity]
arch/sh/boards/mach-edosk7705/setup.c [moved from arch/sh/boards/renesas/edosk7705/setup.c with 100% similarity]
arch/sh/boards/mach-highlander/Kconfig [moved from arch/sh/boards/renesas/r7780rp/Kconfig with 100% similarity]
arch/sh/boards/mach-highlander/Makefile [moved from arch/sh/boards/renesas/r7780rp/Makefile with 100% similarity]
arch/sh/boards/mach-highlander/irq-r7780mp.c [moved from arch/sh/boards/renesas/r7780rp/irq-r7780mp.c with 100% similarity]
arch/sh/boards/mach-highlander/irq-r7780rp.c [moved from arch/sh/boards/renesas/r7780rp/irq-r7780rp.c with 100% similarity]
arch/sh/boards/mach-highlander/irq-r7785rp.c [moved from arch/sh/boards/renesas/r7780rp/irq-r7785rp.c with 100% similarity]
arch/sh/boards/mach-highlander/psw.c [moved from arch/sh/boards/renesas/r7780rp/psw.c with 98% similarity]
arch/sh/boards/mach-highlander/setup.c [moved from arch/sh/boards/renesas/r7780rp/setup.c with 100% similarity]
arch/sh/boards/mach-hp6xx/Makefile [moved from arch/sh/boards/hp6xx/Makefile with 100% similarity]
arch/sh/boards/mach-hp6xx/hp6xx_apm.c [moved from arch/sh/boards/hp6xx/hp6xx_apm.c with 100% similarity]
arch/sh/boards/mach-hp6xx/pm.c [moved from arch/sh/boards/hp6xx/pm.c with 98% similarity]
arch/sh/boards/mach-hp6xx/pm_wakeup.S [moved from arch/sh/boards/hp6xx/pm_wakeup.S with 96% similarity]
arch/sh/boards/mach-hp6xx/setup.c [moved from arch/sh/boards/hp6xx/setup.c with 99% similarity]
arch/sh/boards/mach-landisk/Makefile [moved from arch/sh/boards/landisk/Makefile with 100% similarity]
arch/sh/boards/mach-landisk/gio.c [moved from arch/sh/boards/landisk/gio.c with 97% similarity]
arch/sh/boards/mach-landisk/irq.c [moved from arch/sh/boards/landisk/irq.c with 96% similarity]
arch/sh/boards/mach-landisk/psw.c [moved from arch/sh/boards/landisk/psw.c with 98% similarity]
arch/sh/boards/mach-landisk/setup.c [moved from arch/sh/boards/landisk/setup.c with 98% similarity]
arch/sh/boards/mach-lboxre2/Makefile [moved from arch/sh/boards/lboxre2/Makefile with 100% similarity]
arch/sh/boards/mach-lboxre2/irq.c [moved from arch/sh/boards/lboxre2/irq.c with 100% similarity]
arch/sh/boards/mach-lboxre2/setup.c [moved from arch/sh/boards/lboxre2/setup.c with 100% similarity]
arch/sh/boards/mach-microdev/Makefile [moved from arch/sh/boards/superh/microdev/Makefile with 100% similarity]
arch/sh/boards/mach-microdev/io.c [moved from arch/sh/boards/superh/microdev/io.c with 100% similarity]
arch/sh/boards/mach-microdev/irq.c [moved from arch/sh/boards/superh/microdev/irq.c with 100% similarity]
arch/sh/boards/mach-microdev/led.c [moved from arch/sh/boards/superh/microdev/led.c with 100% similarity]
arch/sh/boards/mach-microdev/setup.c [moved from arch/sh/boards/superh/microdev/setup.c with 100% similarity]
arch/sh/boards/mach-migor/Kconfig [moved from arch/sh/boards/renesas/migor/Kconfig with 100% similarity]
arch/sh/boards/mach-migor/Makefile [moved from arch/sh/boards/renesas/migor/Makefile with 100% similarity]
arch/sh/boards/mach-migor/lcd_qvga.c [moved from arch/sh/boards/renesas/migor/lcd_qvga.c with 100% similarity]
arch/sh/boards/mach-migor/setup.c [moved from arch/sh/boards/renesas/migor/setup.c with 99% similarity]
arch/sh/boards/mach-r2d/Kconfig [moved from arch/sh/boards/renesas/rts7751r2d/Kconfig with 100% similarity]
arch/sh/boards/mach-r2d/Makefile [moved from arch/sh/boards/renesas/rts7751r2d/Makefile with 100% similarity]
arch/sh/boards/mach-r2d/irq.c [moved from arch/sh/boards/renesas/rts7751r2d/irq.c with 100% similarity]
arch/sh/boards/mach-r2d/setup.c [moved from arch/sh/boards/renesas/rts7751r2d/setup.c with 100% similarity]
arch/sh/boards/mach-sdk7780/Kconfig [moved from arch/sh/boards/renesas/sdk7780/Kconfig with 100% similarity]
arch/sh/boards/mach-sdk7780/Makefile [moved from arch/sh/boards/renesas/sdk7780/Makefile with 100% similarity]
arch/sh/boards/mach-sdk7780/irq.c [moved from arch/sh/boards/renesas/sdk7780/irq.c with 100% similarity]
arch/sh/boards/mach-sdk7780/setup.c [moved from arch/sh/boards/renesas/sdk7780/setup.c with 100% similarity]
arch/sh/boards/mach-se/7206/Makefile [moved from arch/sh/boards/se/7206/Makefile with 100% similarity]
arch/sh/boards/mach-se/7206/io.c [moved from arch/sh/boards/se/7206/io.c with 98% similarity]
arch/sh/boards/mach-se/7206/irq.c [moved from arch/sh/boards/se/7206/irq.c with 98% similarity]
arch/sh/boards/mach-se/7206/setup.c [moved from arch/sh/boards/se/7206/setup.c with 98% similarity]
arch/sh/boards/mach-se/7343/Makefile [moved from arch/sh/boards/se/7343/Makefile with 100% similarity]
arch/sh/boards/mach-se/7343/io.c [moved from arch/sh/boards/se/7343/io.c with 99% similarity]
arch/sh/boards/mach-se/7343/irq.c [moved from arch/sh/boards/se/7343/irq.c with 97% similarity]
arch/sh/boards/mach-se/7343/setup.c [moved from arch/sh/boards/se/7343/setup.c with 98% similarity]
arch/sh/boards/mach-se/770x/Makefile [moved from arch/sh/boards/se/770x/Makefile with 100% similarity]
arch/sh/boards/mach-se/770x/io.c [moved from arch/sh/boards/se/770x/io.c with 99% similarity]
arch/sh/boards/mach-se/770x/irq.c [moved from arch/sh/boards/se/770x/irq.c with 98% similarity]
arch/sh/boards/mach-se/770x/setup.c [moved from arch/sh/boards/se/770x/setup.c with 96% similarity]
arch/sh/boards/mach-se/7721/Makefile [moved from arch/sh/boards/se/7721/Makefile with 100% similarity]
arch/sh/boards/mach-se/7721/irq.c [moved from arch/sh/boards/se/7721/irq.c with 96% similarity]
arch/sh/boards/mach-se/7721/setup.c [moved from arch/sh/boards/se/7721/setup.c with 98% similarity]
arch/sh/boards/mach-se/7722/Makefile [moved from arch/sh/boards/se/7722/Makefile with 100% similarity]
arch/sh/boards/mach-se/7722/irq.c [moved from arch/sh/boards/se/7722/irq.c with 98% similarity]
arch/sh/boards/mach-se/7722/setup.c [moved from arch/sh/boards/se/7722/setup.c with 99% similarity]
arch/sh/boards/mach-se/7751/Makefile [moved from arch/sh/boards/se/7751/Makefile with 100% similarity]
arch/sh/boards/mach-se/7751/io.c [moved from arch/sh/boards/se/7751/io.c with 99% similarity]
arch/sh/boards/mach-se/7751/irq.c [moved from arch/sh/boards/se/7751/irq.c with 96% similarity]
arch/sh/boards/mach-se/7751/pci.c [moved from arch/sh/boards/se/7751/pci.c with 100% similarity]
arch/sh/boards/mach-se/7751/setup.c [moved from arch/sh/boards/se/7751/setup.c with 98% similarity]
arch/sh/boards/mach-se/7780/Makefile [moved from arch/sh/boards/se/7780/Makefile with 100% similarity]
arch/sh/boards/mach-se/7780/irq.c [moved from arch/sh/boards/se/7780/irq.c with 97% similarity]
arch/sh/boards/mach-se/7780/setup.c [moved from arch/sh/boards/se/7780/setup.c with 98% similarity]
arch/sh/boards/mach-se/Makefile [new file with mode: 0644]
arch/sh/boards/mach-se/board-se7619.c [moved from arch/sh/boards/se/7619/setup.c with 100% similarity]
arch/sh/boards/mach-sh03/Makefile [moved from arch/sh/boards/sh03/Makefile with 100% similarity]
arch/sh/boards/mach-sh03/rtc.c [moved from arch/sh/boards/sh03/rtc.c with 100% similarity]
arch/sh/boards/mach-sh03/setup.c [moved from arch/sh/boards/sh03/setup.c with 96% similarity]
arch/sh/boards/mach-sh7763rdp/Makefile [moved from arch/sh/boards/renesas/sh7763rdp/Makefile with 100% similarity]
arch/sh/boards/mach-sh7763rdp/irq.c [moved from arch/sh/boards/renesas/sh7763rdp/irq.c with 100% similarity]
arch/sh/boards/mach-sh7763rdp/setup.c [moved from arch/sh/boards/renesas/sh7763rdp/setup.c with 100% similarity]
arch/sh/boards/mach-snapgear/Makefile [moved from arch/sh/boards/snapgear/Makefile with 100% similarity]
arch/sh/boards/mach-snapgear/io.c [moved from arch/sh/boards/snapgear/io.c with 100% similarity]
arch/sh/boards/mach-snapgear/setup.c [moved from arch/sh/boards/snapgear/setup.c with 98% similarity]
arch/sh/boards/mach-systemh/Makefile [moved from arch/sh/boards/renesas/systemh/Makefile with 100% similarity]
arch/sh/boards/mach-systemh/io.c [moved from arch/sh/boards/renesas/systemh/io.c with 100% similarity]
arch/sh/boards/mach-systemh/irq.c [moved from arch/sh/boards/renesas/systemh/irq.c with 98% similarity]
arch/sh/boards/mach-systemh/setup.c [moved from arch/sh/boards/renesas/systemh/setup.c with 100% similarity]
arch/sh/boards/mach-titan/Makefile [moved from arch/sh/boards/titan/Makefile with 100% similarity]
arch/sh/boards/mach-titan/io.c [moved from arch/sh/boards/titan/io.c with 100% similarity]
arch/sh/boards/mach-titan/setup.c [moved from arch/sh/boards/titan/setup.c with 100% similarity]
arch/sh/boards/mach-x3proto/Makefile [moved from arch/sh/boards/renesas/x3proto/Makefile with 100% similarity]
arch/sh/boards/mach-x3proto/ilsel.c [moved from arch/sh/boards/renesas/x3proto/ilsel.c with 100% similarity]
arch/sh/boards/mach-x3proto/setup.c [moved from arch/sh/boards/renesas/x3proto/setup.c with 100% similarity]
arch/sh/boards/magicpanelr2/Kconfig [deleted file]
arch/sh/boards/magicpanelr2/Makefile [deleted file]
arch/sh/boards/renesas/ap325rxa/Makefile [deleted file]
arch/sh/boards/renesas/rsk7203/Makefile [deleted file]
arch/sh/boards/renesas/sh7785lcr/Makefile [deleted file]
arch/sh/boards/se/7619/Makefile [deleted file]
arch/sh/boards/shmin/Makefile [deleted file]
arch/sh/boot/Makefile
arch/sh/boot/compressed/head_64.S
arch/sh/configs/ap325rxa_defconfig
arch/sh/configs/dreamcast_defconfig
arch/sh/configs/hp6xx_defconfig
arch/sh/configs/landisk_defconfig
arch/sh/configs/lboxre2_defconfig
arch/sh/configs/magicpanelr2_defconfig
arch/sh/configs/microdev_defconfig
arch/sh/configs/migor_defconfig
arch/sh/configs/r7780mp_defconfig
arch/sh/configs/r7785rp_defconfig
arch/sh/configs/rsk7203_defconfig
arch/sh/configs/rts7751r2d1_defconfig
arch/sh/configs/rts7751r2dplus_defconfig
arch/sh/configs/sdk7780_defconfig
arch/sh/configs/se7206_defconfig
arch/sh/configs/se7343_defconfig
arch/sh/configs/se7619_defconfig
arch/sh/drivers/dma/dma-g2.c
arch/sh/drivers/dma/dma-pvr2.c
arch/sh/drivers/dma/dma-sh.c
arch/sh/drivers/dma/dma-sh.h
arch/sh/drivers/pci/fixups-dreamcast.c
arch/sh/drivers/pci/ops-cayman.c
arch/sh/drivers/pci/ops-dreamcast.c
arch/sh/drivers/pci/ops-se7780.c
arch/sh/drivers/pci/pci-sh5.c
arch/sh/include/asm/.gitignore [moved from include/asm-sh/.gitignore with 57% similarity]
arch/sh/include/asm/Kbuild [moved from include/asm-sh/Kbuild with 100% similarity]
arch/sh/include/asm/adc.h [moved from include/asm-sh/adc.h with 88% similarity]
arch/sh/include/asm/addrspace.h [moved from include/asm-sh/addrspace.h with 98% similarity]
arch/sh/include/asm/atomic-grb.h [moved from include/asm-sh/atomic-grb.h with 100% similarity]
arch/sh/include/asm/atomic-irq.h [moved from include/asm-sh/atomic-irq.h with 100% similarity]
arch/sh/include/asm/atomic-llsc.h [moved from include/asm-sh/atomic-llsc.h with 100% similarity]
arch/sh/include/asm/atomic.h [moved from include/asm-sh/atomic.h with 100% similarity]
arch/sh/include/asm/auxvec.h [moved from include/asm-sh/auxvec.h with 94% similarity]
arch/sh/include/asm/bitops-grb.h [moved from include/asm-sh/bitops-grb.h with 100% similarity]
arch/sh/include/asm/bitops-irq.h [moved from include/asm-sh/bitops-irq.h with 100% similarity]
arch/sh/include/asm/bitops.h [moved from include/asm-sh/bitops.h with 100% similarity]
arch/sh/include/asm/bug.h [moved from include/asm-sh/bug.h with 100% similarity]
arch/sh/include/asm/bugs.h [moved from include/asm-sh/bugs.h with 100% similarity]
arch/sh/include/asm/byteorder.h [moved from include/asm-sh/byteorder.h with 100% similarity]
arch/sh/include/asm/cache.h [moved from include/asm-sh/cache.h with 97% similarity]
arch/sh/include/asm/cacheflush.h [moved from include/asm-sh/cacheflush.h with 98% similarity]
arch/sh/include/asm/checksum.h [moved from include/asm-sh/checksum.h with 100% similarity]
arch/sh/include/asm/checksum_32.h [moved from include/asm-sh/checksum_32.h with 100% similarity]
arch/sh/include/asm/checksum_64.h [moved from include/asm-sh/checksum_64.h with 100% similarity]
arch/sh/include/asm/clock.h [moved from include/asm-sh/clock.h with 100% similarity]
arch/sh/include/asm/cmpxchg-grb.h [moved from include/asm-sh/cmpxchg-grb.h with 100% similarity]
arch/sh/include/asm/cmpxchg-irq.h [moved from include/asm-sh/cmpxchg-irq.h with 100% similarity]
arch/sh/include/asm/cpu-features.h [moved from include/asm-sh/cpu-features.h with 100% similarity]
arch/sh/include/asm/cputime.h [moved from include/asm-sh/cputime.h with 100% similarity]
arch/sh/include/asm/current.h [moved from include/asm-sh/current.h with 100% similarity]
arch/sh/include/asm/delay.h [moved from include/asm-sh/delay.h with 100% similarity]
arch/sh/include/asm/device.h [moved from include/asm-sh/device.h with 100% similarity]
arch/sh/include/asm/div64.h [moved from include/asm-sh/div64.h with 100% similarity]
arch/sh/include/asm/dma-mapping.h [moved from include/asm-sh/dma-mapping.h with 100% similarity]
arch/sh/include/asm/dma.h [moved from include/asm-sh/dma.h with 99% similarity]
arch/sh/include/asm/dmabrg.h [moved from include/asm-sh/dmabrg.h with 100% similarity]
arch/sh/include/asm/edosk7705.h [moved from include/asm-sh/edosk7705.h with 100% similarity]
arch/sh/include/asm/elf.h [moved from include/asm-sh/elf.h with 100% similarity]
arch/sh/include/asm/emergency-restart.h [moved from include/asm-sh/emergency-restart.h with 100% similarity]
arch/sh/include/asm/entry-macros.S [moved from include/asm-sh/entry-macros.S with 100% similarity]
arch/sh/include/asm/errno.h [moved from include/asm-sh/errno.h with 100% similarity]
arch/sh/include/asm/fb.h [moved from include/asm-sh/fb.h with 100% similarity]
arch/sh/include/asm/fcntl.h [moved from include/asm-sh/fcntl.h with 100% similarity]
arch/sh/include/asm/fixmap.h [moved from include/asm-sh/fixmap.h with 100% similarity]
arch/sh/include/asm/flat.h [moved from include/asm-sh/flat.h with 100% similarity]
arch/sh/include/asm/fpu.h [moved from include/asm-sh/fpu.h with 100% similarity]
arch/sh/include/asm/freq.h [moved from include/asm-sh/freq.h with 94% similarity]
arch/sh/include/asm/futex-irq.h [moved from include/asm-sh/futex-irq.h with 100% similarity]
arch/sh/include/asm/futex.h [moved from include/asm-sh/futex.h with 100% similarity]
arch/sh/include/asm/gpio.h [moved from include/asm-sh/gpio.h with 94% similarity]
arch/sh/include/asm/hardirq.h [moved from include/asm-sh/hardirq.h with 100% similarity]
arch/sh/include/asm/hd64461.h [moved from include/asm-sh/hd64461.h with 100% similarity]
arch/sh/include/asm/hd64465/gpio.h [moved from include/asm-sh/hd64465/gpio.h with 100% similarity]
arch/sh/include/asm/hd64465/hd64465.h [moved from include/asm-sh/hd64465/hd64465.h with 100% similarity]
arch/sh/include/asm/hd64465/io.h [moved from include/asm-sh/hd64465/io.h with 100% similarity]
arch/sh/include/asm/heartbeat.h [moved from include/asm-sh/heartbeat.h with 100% similarity]
arch/sh/include/asm/hp6xx.h [moved from include/asm-sh/hp6xx.h with 100% similarity]
arch/sh/include/asm/hugetlb.h [moved from include/asm-sh/hugetlb.h with 100% similarity]
arch/sh/include/asm/hw_irq.h [moved from include/asm-sh/hw_irq.h with 100% similarity]
arch/sh/include/asm/i2c-sh7760.h [moved from include/asm-sh/i2c-sh7760.h with 100% similarity]
arch/sh/include/asm/ilsel.h [moved from include/asm-sh/ilsel.h with 100% similarity]
arch/sh/include/asm/io.h [moved from include/asm-sh/io.h with 100% similarity]
arch/sh/include/asm/io_generic.h [moved from include/asm-sh/io_generic.h with 100% similarity]
arch/sh/include/asm/io_trapped.h [moved from include/asm-sh/io_trapped.h with 100% similarity]
arch/sh/include/asm/ioctl.h [moved from include/asm-sh/ioctl.h with 100% similarity]
arch/sh/include/asm/ioctls.h [moved from include/asm-sh/ioctls.h with 100% similarity]
arch/sh/include/asm/ipcbuf.h [moved from include/asm-sh/ipcbuf.h with 100% similarity]
arch/sh/include/asm/irq.h [moved from include/asm-sh/irq.h with 97% similarity]
arch/sh/include/asm/irq_regs.h [moved from include/asm-sh/irq_regs.h with 100% similarity]
arch/sh/include/asm/irqflags.h [moved from include/asm-sh/irqflags.h with 100% similarity]
arch/sh/include/asm/irqflags_32.h [moved from include/asm-sh/irqflags_32.h with 100% similarity]
arch/sh/include/asm/irqflags_64.h [moved from include/asm-sh/irqflags_64.h with 98% similarity]
arch/sh/include/asm/kdebug.h [moved from include/asm-sh/kdebug.h with 100% similarity]
arch/sh/include/asm/kexec.h [moved from include/asm-sh/kexec.h with 100% similarity]
arch/sh/include/asm/kgdb.h [moved from include/asm-sh/kgdb.h with 100% similarity]
arch/sh/include/asm/kmap_types.h [moved from include/asm-sh/kmap_types.h with 100% similarity]
arch/sh/include/asm/lboxre2.h [moved from include/asm-sh/lboxre2.h with 100% similarity]
arch/sh/include/asm/linkage.h [moved from include/asm-sh/linkage.h with 100% similarity]
arch/sh/include/asm/local.h [moved from include/asm-sh/local.h with 100% similarity]
arch/sh/include/asm/machvec.h [moved from include/asm-sh/machvec.h with 100% similarity]
arch/sh/include/asm/magicpanelr2.h [moved from include/asm-sh/magicpanelr2.h with 100% similarity]
arch/sh/include/asm/mc146818rtc.h [moved from include/asm-sh/mc146818rtc.h with 100% similarity]
arch/sh/include/asm/microdev.h [moved from include/asm-sh/microdev.h with 100% similarity]
arch/sh/include/asm/migor.h [moved from include/asm-sh/migor.h with 100% similarity]
arch/sh/include/asm/mman.h [moved from include/asm-sh/mman.h with 100% similarity]
arch/sh/include/asm/mmu.h [moved from include/asm-sh/mmu.h with 100% similarity]
arch/sh/include/asm/mmu_context.h [moved from include/asm-sh/mmu_context.h with 99% similarity]
arch/sh/include/asm/mmu_context_32.h [moved from include/asm-sh/mmu_context_32.h with 100% similarity]
arch/sh/include/asm/mmu_context_64.h [moved from include/asm-sh/mmu_context_64.h with 98% similarity]
arch/sh/include/asm/mmzone.h [moved from include/asm-sh/mmzone.h with 100% similarity]
arch/sh/include/asm/module.h [moved from include/asm-sh/module.h with 100% similarity]
arch/sh/include/asm/msgbuf.h [moved from include/asm-sh/msgbuf.h with 100% similarity]
arch/sh/include/asm/mutex.h [moved from include/asm-sh/mutex.h with 100% similarity]
arch/sh/include/asm/page.h [moved from include/asm-sh/page.h with 100% similarity]
arch/sh/include/asm/param.h [moved from include/asm-sh/param.h with 100% similarity]
arch/sh/include/asm/parport.h [moved from include/asm-sh/parport.h with 100% similarity]
arch/sh/include/asm/pci.h [moved from include/asm-sh/pci.h with 100% similarity]
arch/sh/include/asm/percpu.h [moved from include/asm-sh/percpu.h with 100% similarity]
arch/sh/include/asm/pgalloc.h [moved from include/asm-sh/pgalloc.h with 100% similarity]
arch/sh/include/asm/pgtable.h [moved from include/asm-sh/pgtable.h with 100% similarity]
arch/sh/include/asm/pgtable_32.h [moved from include/asm-sh/pgtable_32.h with 100% similarity]
arch/sh/include/asm/pgtable_64.h [moved from include/asm-sh/pgtable_64.h with 100% similarity]
arch/sh/include/asm/pm.h [moved from include/asm-sh/pm.h with 100% similarity]
arch/sh/include/asm/poll.h [moved from include/asm-sh/poll.h with 100% similarity]
arch/sh/include/asm/posix_types.h [moved from include/asm-sh/posix_types.h with 100% similarity]
arch/sh/include/asm/posix_types_32.h [moved from include/asm-sh/posix_types_32.h with 100% similarity]
arch/sh/include/asm/posix_types_64.h [moved from include/asm-sh/posix_types_64.h with 100% similarity]
arch/sh/include/asm/processor.h [moved from include/asm-sh/processor.h with 100% similarity]
arch/sh/include/asm/processor_32.h [moved from include/asm-sh/processor_32.h with 98% similarity]
arch/sh/include/asm/processor_64.h [moved from include/asm-sh/processor_64.h with 99% similarity]
arch/sh/include/asm/ptrace.h [moved from include/asm-sh/ptrace.h with 92% similarity]
arch/sh/include/asm/push-switch.h [moved from include/asm-sh/push-switch.h with 100% similarity]
arch/sh/include/asm/r7780rp.h [moved from include/asm-sh/r7780rp.h with 100% similarity]
arch/sh/include/asm/resource.h [moved from include/asm-sh/resource.h with 100% similarity]
arch/sh/include/asm/rtc.h [moved from include/asm-sh/rtc.h with 92% similarity]
arch/sh/include/asm/rts7751r2d.h [moved from include/asm-sh/rts7751r2d.h with 100% similarity]
arch/sh/include/asm/rwsem.h [moved from include/asm-sh/rwsem.h with 100% similarity]
arch/sh/include/asm/scatterlist.h [moved from include/asm-sh/scatterlist.h with 100% similarity]
arch/sh/include/asm/sdk7780.h [moved from include/asm-sh/sdk7780.h with 100% similarity]
arch/sh/include/asm/seccomp.h [new file with mode: 0644]
arch/sh/include/asm/sections.h [moved from include/asm-sh/sections.h with 100% similarity]
arch/sh/include/asm/segment.h [moved from include/asm-sh/segment.h with 100% similarity]
arch/sh/include/asm/sembuf.h [moved from include/asm-sh/sembuf.h with 100% similarity]
arch/sh/include/asm/serial.h [moved from include/asm-sh/serial.h with 96% similarity]
arch/sh/include/asm/setup.h [moved from include/asm-sh/setup.h with 100% similarity]
arch/sh/include/asm/sfp-machine.h [moved from include/asm-sh/sfp-machine.h with 100% similarity]
arch/sh/include/asm/sh7760fb.h [moved from include/asm-sh/sh7760fb.h with 100% similarity]
arch/sh/include/asm/sh7763rdp.h [moved from include/asm-sh/sh7763rdp.h with 100% similarity]
arch/sh/include/asm/sh7785lcr.h [moved from include/asm-sh/sh7785lcr.h with 100% similarity]
arch/sh/include/asm/sh_bios.h [moved from include/asm-sh/sh_bios.h with 100% similarity]
arch/sh/include/asm/sh_keysc.h [moved from include/asm-sh/sh_keysc.h with 100% similarity]
arch/sh/include/asm/sh_mobile_lcdc.h [moved from include/asm-sh/sh_mobile_lcdc.h with 100% similarity]
arch/sh/include/asm/shmbuf.h [moved from include/asm-sh/shmbuf.h with 100% similarity]
arch/sh/include/asm/shmin.h [moved from include/asm-sh/shmin.h with 100% similarity]
arch/sh/include/asm/shmparam.h [moved from include/asm-sh/shmparam.h with 100% similarity]
arch/sh/include/asm/sigcontext.h [moved from include/asm-sh/sigcontext.h with 100% similarity]
arch/sh/include/asm/siginfo.h [moved from include/asm-sh/siginfo.h with 100% similarity]
arch/sh/include/asm/signal.h [moved from include/asm-sh/signal.h with 100% similarity]
arch/sh/include/asm/smc37c93x.h [moved from include/asm-sh/smc37c93x.h with 100% similarity]
arch/sh/include/asm/smp.h [moved from include/asm-sh/smp.h with 100% similarity]
arch/sh/include/asm/snapgear.h [moved from include/asm-sh/snapgear.h with 100% similarity]
arch/sh/include/asm/socket.h [moved from include/asm-sh/socket.h with 100% similarity]
arch/sh/include/asm/sockios.h [moved from include/asm-sh/sockios.h with 100% similarity]
arch/sh/include/asm/sparsemem.h [moved from include/asm-sh/sparsemem.h with 100% similarity]
arch/sh/include/asm/spi.h [moved from include/asm-sh/spi.h with 100% similarity]
arch/sh/include/asm/spinlock.h [moved from include/asm-sh/spinlock.h with 100% similarity]
arch/sh/include/asm/spinlock_types.h [moved from include/asm-sh/spinlock_types.h with 100% similarity]
arch/sh/include/asm/stat.h [moved from include/asm-sh/stat.h with 100% similarity]
arch/sh/include/asm/statfs.h [moved from include/asm-sh/statfs.h with 100% similarity]
arch/sh/include/asm/string.h [moved from include/asm-sh/string.h with 100% similarity]
arch/sh/include/asm/string_32.h [moved from include/asm-sh/string_32.h with 100% similarity]
arch/sh/include/asm/string_64.h [moved from include/asm-sh/string_64.h with 100% similarity]
arch/sh/include/asm/system.h [moved from include/asm-sh/system.h with 100% similarity]
arch/sh/include/asm/system_32.h [moved from include/asm-sh/system_32.h with 100% similarity]
arch/sh/include/asm/system_64.h [moved from include/asm-sh/system_64.h with 100% similarity]
arch/sh/include/asm/systemh7751.h [moved from include/asm-sh/systemh7751.h with 100% similarity]
arch/sh/include/asm/termbits.h [moved from include/asm-sh/termbits.h with 100% similarity]
arch/sh/include/asm/termios.h [moved from include/asm-sh/termios.h with 100% similarity]
arch/sh/include/asm/thread_info.h [moved from include/asm-sh/thread_info.h with 70% similarity]
arch/sh/include/asm/timer.h [moved from include/asm-sh/timer.h with 96% similarity]
arch/sh/include/asm/timex.h [moved from include/asm-sh/timex.h with 100% similarity]
arch/sh/include/asm/titan.h [moved from include/asm-sh/titan.h with 100% similarity]
arch/sh/include/asm/tlb.h [moved from include/asm-sh/tlb.h with 100% similarity]
arch/sh/include/asm/tlb_64.h [moved from include/asm-sh/tlb_64.h with 90% similarity]
arch/sh/include/asm/tlbflush.h [moved from include/asm-sh/tlbflush.h with 100% similarity]
arch/sh/include/asm/topology.h [moved from include/asm-sh/topology.h with 100% similarity]
arch/sh/include/asm/types.h [moved from include/asm-sh/types.h with 100% similarity]
arch/sh/include/asm/uaccess.h [moved from include/asm-sh/uaccess.h with 97% similarity]
arch/sh/include/asm/uaccess_32.h [moved from include/asm-sh/uaccess_32.h with 98% similarity]
arch/sh/include/asm/uaccess_64.h [moved from include/asm-sh/uaccess_64.h with 100% similarity]
arch/sh/include/asm/ubc.h [moved from include/asm-sh/ubc.h with 98% similarity]
arch/sh/include/asm/ucontext.h [moved from include/asm-sh/ucontext.h with 100% similarity]
arch/sh/include/asm/unaligned.h [moved from include/asm-sh/unaligned.h with 100% similarity]
arch/sh/include/asm/unistd.h [moved from include/asm-sh/unistd.h with 100% similarity]
arch/sh/include/asm/unistd_32.h [moved from include/asm-sh/unistd_32.h with 100% similarity]
arch/sh/include/asm/unistd_64.h [moved from include/asm-sh/unistd_64.h with 100% similarity]
arch/sh/include/asm/user.h [moved from include/asm-sh/user.h with 100% similarity]
arch/sh/include/asm/vga.h [moved from include/asm-sh/vga.h with 100% similarity]
arch/sh/include/asm/watchdog.h [moved from include/asm-sh/watchdog.h with 96% similarity]
arch/sh/include/asm/xor.h [moved from include/asm-sh/xor.h with 100% similarity]
arch/sh/include/cpu-common/cpu/addrspace.h [moved from include/asm-sh/cpu-sh2/addrspace.h with 100% similarity]
arch/sh/include/cpu-common/cpu/cacheflush.h [moved from include/asm-sh/cpu-sh2/cacheflush.h with 99% similarity]
arch/sh/include/cpu-common/cpu/mmu_context.h [moved from include/asm-sh/cpu-sh2/mmu_context.h with 100% similarity]
arch/sh/include/cpu-common/cpu/rtc.h [moved from include/asm-sh/cpu-sh2/rtc.h with 100% similarity]
arch/sh/include/cpu-common/cpu/sigcontext.h [moved from include/asm-sh/cpu-sh2/sigcontext.h with 100% similarity]
arch/sh/include/cpu-common/cpu/timer.h [moved from include/asm-sh/cpu-sh2/timer.h with 100% similarity]
arch/sh/include/cpu-sh2/cpu/cache.h [moved from include/asm-sh/cpu-sh2/cache.h with 88% similarity]
arch/sh/include/cpu-sh2/cpu/dma.h [moved from include/asm-sh/cpu-sh2/dma.h with 100% similarity]
arch/sh/include/cpu-sh2/cpu/freq.h [moved from include/asm-sh/cpu-sh2/freq.h with 100% similarity]
arch/sh/include/cpu-sh2/cpu/ubc.h [moved from include/asm-sh/cpu-sh2/ubc.h with 100% similarity]
arch/sh/include/cpu-sh2/cpu/watchdog.h [moved from include/asm-sh/cpu-sh2/watchdog.h with 100% similarity]
arch/sh/include/cpu-sh2a/cpu/addrspace.h [moved from include/asm-sh/cpu-sh2a/addrspace.h with 79% similarity]
arch/sh/include/cpu-sh2a/cpu/cache.h [moved from include/asm-sh/cpu-sh2a/cache.h with 89% similarity]
arch/sh/include/cpu-sh2a/cpu/cacheflush.h [new file with mode: 0644]
arch/sh/include/cpu-sh2a/cpu/dma.h [new file with mode: 0644]
arch/sh/include/cpu-sh2a/cpu/freq.h [moved from include/asm-sh/cpu-sh2a/freq.h with 100% similarity]
arch/sh/include/cpu-sh2a/cpu/rtc.h [moved from include/asm-sh/cpu-sh2a/rtc.h with 100% similarity]
arch/sh/include/cpu-sh2a/cpu/ubc.h [new file with mode: 0644]
arch/sh/include/cpu-sh2a/cpu/watchdog.h [new file with mode: 0644]
arch/sh/include/cpu-sh3/cpu/adc.h [moved from include/asm-sh/cpu-sh3/adc.h with 100% similarity]
arch/sh/include/cpu-sh3/cpu/cache.h [moved from include/asm-sh/cpu-sh3/cache.h with 100% similarity]
arch/sh/include/cpu-sh3/cpu/cacheflush.h [new file with mode: 0644]
arch/sh/include/cpu-sh3/cpu/dac.h [moved from include/asm-sh/cpu-sh3/dac.h with 100% similarity]
arch/sh/include/cpu-sh3/cpu/dma.h [moved from include/asm-sh/cpu-sh3/dma.h with 100% similarity]
arch/sh/include/cpu-sh3/cpu/freq.h [moved from include/asm-sh/cpu-sh3/freq.h with 100% similarity]
arch/sh/include/cpu-sh3/cpu/gpio.h [moved from include/asm-sh/cpu-sh3/gpio.h with 100% similarity]
arch/sh/include/cpu-sh3/cpu/mmu_context.h [moved from include/asm-sh/cpu-sh3/mmu_context.h with 100% similarity]
arch/sh/include/cpu-sh3/cpu/timer.h [moved from include/asm-sh/cpu-sh3/timer.h with 100% similarity]
arch/sh/include/cpu-sh3/cpu/ubc.h [moved from include/asm-sh/cpu-sh3/ubc.h with 100% similarity]
arch/sh/include/cpu-sh3/cpu/watchdog.h [moved from include/asm-sh/cpu-sh3/watchdog.h with 100% similarity]
arch/sh/include/cpu-sh4/cpu/addrspace.h [moved from include/asm-sh/cpu-sh4/addrspace.h with 100% similarity]
arch/sh/include/cpu-sh4/cpu/cache.h [moved from include/asm-sh/cpu-sh4/cache.h with 100% similarity]
arch/sh/include/cpu-sh4/cpu/cacheflush.h [moved from include/asm-sh/cpu-sh4/cacheflush.h with 100% similarity]
arch/sh/include/cpu-sh4/cpu/dma-sh7780.h [moved from include/asm-sh/cpu-sh4/dma-sh7780.h with 100% similarity]
arch/sh/include/cpu-sh4/cpu/dma.h [moved from include/asm-sh/cpu-sh4/dma.h with 97% similarity]
arch/sh/include/cpu-sh4/cpu/fpu.h [moved from include/asm-sh/cpu-sh4/fpu.h with 100% similarity]
arch/sh/include/cpu-sh4/cpu/freq.h [moved from include/asm-sh/cpu-sh4/freq.h with 100% similarity]
arch/sh/include/cpu-sh4/cpu/mmu_context.h [moved from include/asm-sh/cpu-sh4/mmu_context.h with 100% similarity]
arch/sh/include/cpu-sh4/cpu/rtc.h [moved from include/asm-sh/cpu-sh4/rtc.h with 100% similarity]
arch/sh/include/cpu-sh4/cpu/sigcontext.h [moved from include/asm-sh/cpu-sh4/sigcontext.h with 100% similarity]
arch/sh/include/cpu-sh4/cpu/sq.h [moved from include/asm-sh/cpu-sh4/sq.h with 100% similarity]
arch/sh/include/cpu-sh4/cpu/timer.h [moved from include/asm-sh/cpu-sh4/timer.h with 100% similarity]
arch/sh/include/cpu-sh4/cpu/ubc.h [moved from include/asm-sh/cpu-sh4/ubc.h with 100% similarity]
arch/sh/include/cpu-sh4/cpu/watchdog.h [moved from include/asm-sh/cpu-sh4/watchdog.h with 100% similarity]
arch/sh/include/cpu-sh5/cpu/addrspace.h [moved from include/asm-sh/cpu-sh5/addrspace.h with 100% similarity]
arch/sh/include/cpu-sh5/cpu/cache.h [moved from include/asm-sh/cpu-sh5/cache.h with 100% similarity]
arch/sh/include/cpu-sh5/cpu/cacheflush.h [moved from include/asm-sh/cpu-sh5/cacheflush.h with 100% similarity]
arch/sh/include/cpu-sh5/cpu/dma.h [moved from include/asm-sh/cpu-sh5/dma.h with 100% similarity]
arch/sh/include/cpu-sh5/cpu/irq.h [moved from include/asm-sh/cpu-sh5/irq.h with 100% similarity]
arch/sh/include/cpu-sh5/cpu/mmu_context.h [moved from include/asm-sh/cpu-sh5/mmu_context.h with 100% similarity]
arch/sh/include/cpu-sh5/cpu/registers.h [moved from include/asm-sh/cpu-sh5/registers.h with 100% similarity]
arch/sh/include/cpu-sh5/cpu/rtc.h [moved from include/asm-sh/cpu-sh5/rtc.h with 100% similarity]
arch/sh/include/mach-dreamcast/mach/dma.h [moved from include/asm-sh/dreamcast/dma.h with 100% similarity]
arch/sh/include/mach-dreamcast/mach/maple.h [moved from include/asm-sh/dreamcast/maple.h with 100% similarity]
arch/sh/include/mach-dreamcast/mach/pci.h [moved from include/asm-sh/dreamcast/pci.h with 93% similarity]
arch/sh/include/mach-dreamcast/mach/sysasic.h [moved from include/asm-sh/dreamcast/sysasic.h with 100% similarity]
arch/sh/include/mach-landisk/mach/gio.h [moved from include/asm-sh/landisk/gio.h with 100% similarity]
arch/sh/include/mach-landisk/mach/iodata_landisk.h [moved from include/asm-sh/landisk/iodata_landisk.h with 100% similarity]
arch/sh/include/mach-se/mach/se.h [moved from include/asm-sh/se.h with 100% similarity]
arch/sh/include/mach-se/mach/se7206.h [moved from include/asm-sh/se7206.h with 100% similarity]
arch/sh/include/mach-se/mach/se7343.h [moved from include/asm-sh/se7343.h with 100% similarity]
arch/sh/include/mach-se/mach/se7721.h [moved from include/asm-sh/se7721.h with 100% similarity]
arch/sh/include/mach-se/mach/se7722.h [moved from include/asm-sh/se7722.h with 100% similarity]
arch/sh/include/mach-se/mach/se7751.h [moved from include/asm-sh/se7751.h with 100% similarity]
arch/sh/include/mach-se/mach/se7780.h [moved from include/asm-sh/se7780.h with 100% similarity]
arch/sh/include/mach-sh03/mach/io.h [moved from include/asm-sh/sh03/io.h with 100% similarity]
arch/sh/include/mach-sh03/mach/sh03.h [moved from include/asm-sh/sh03/sh03.h with 100% similarity]
arch/sh/kernel/.gitignore [new file with mode: 0644]
arch/sh/kernel/cf-enabler.c
arch/sh/kernel/cpu/irq/intc-sh5.c
arch/sh/kernel/cpu/sh2/entry.S
arch/sh/kernel/cpu/sh2a/entry.S
arch/sh/kernel/cpu/sh3/entry.S
arch/sh/kernel/cpu/sh4/fpu.c
arch/sh/kernel/cpu/sh4/softfloat.c
arch/sh/kernel/cpu/sh4/sq.c
arch/sh/kernel/cpu/sh5/entry.S
arch/sh/kernel/entry-common.S
arch/sh/kernel/head_64.S
arch/sh/kernel/irq.c
arch/sh/kernel/machine_kexec.c
arch/sh/kernel/module.c
arch/sh/kernel/ptrace_32.c
arch/sh/kernel/ptrace_64.c
arch/sh/kernel/setup.c
arch/sh/kernel/signal_32.c
arch/sh/kernel/signal_64.c
arch/sh/kernel/time_64.c
arch/sh/lib64/panic.c
arch/sh/mm/Kconfig
arch/sh/mm/Makefile_32
arch/sh/mm/cache-sh2.c
arch/sh/mm/cache-sh2a.c [new file with mode: 0644]
arch/sh/mm/fault_64.c
arch/sh/mm/tlb-sh5.c
arch/sparc/include/asm/futex_64.h
arch/sparc/include/asm/irq_64.h
arch/sparc/include/asm/of_platform.h
arch/sparc/include/asm/of_platform_32.h [deleted file]
arch/sparc/include/asm/of_platform_64.h [deleted file]
arch/sparc/include/asm/ptrace_32.h
arch/sparc/include/asm/ptrace_64.h
arch/sparc64/kernel/irq.c
arch/sparc64/kernel/of_device.c
arch/sparc64/kernel/process.c
arch/sparc64/kernel/signal.c
arch/sparc64/kernel/smp.c
arch/sparc64/kernel/sparc64_ksyms.c
arch/sparc64/kernel/traps.c
arch/sparc64/mm/tsb.c
arch/sparc64/mm/ultra.S
arch/um/drivers/line.c
arch/x86/kernel/genapic_64.c
arch/x86/kernel/pci-dma.c
arch/x86/kernel/setup.c
arch/x86/kvm/mmu.c
arch/x86/kvm/paging_tmpl.h
arch/x86/kvm/x86.c
arch/x86/lib/copy_user_64.S
arch/x86/lib/copy_user_nocache_64.S
arch/xtensa/kernel/xtensa_ksyms.c
block/blk-core.c
block/scsi_ioctl.c
crypto/async_tx/async_xor.c
drivers/Makefile
drivers/acpi/asus_acpi.c
drivers/acpi/processor_perflib.c
drivers/ata/ata_piix.c
drivers/ata/libata-core.c
drivers/ata/libata-scsi.c
drivers/ata/libata.h
drivers/ata/pata_ali.c
drivers/ata/pata_it821x.c
drivers/ata/pata_via.c
drivers/atm/iphase.c
drivers/base/class.c
drivers/block/aoe/aoenet.c
drivers/block/cciss.c
drivers/block/cciss.h
drivers/block/cciss_scsi.c
drivers/block/xen-blkfront.c
drivers/bluetooth/hci_usb.c
drivers/cdrom/cdrom.c
drivers/cdrom/gdrom.c
drivers/char/Kconfig
drivers/char/Makefile
drivers/char/amiserial.c
drivers/char/efirtc.c
drivers/char/hvc_console.h
drivers/char/hvcs.c
drivers/char/ipmi/ipmi_si_intf.c
drivers/char/mxser.c
drivers/char/tty_ldisc.c
drivers/char/viocons.c [deleted file]
drivers/char/vt.c
drivers/cpufreq/cpufreq.c
drivers/firewire/fw-cdev.c
drivers/firmware/iscsi_ibft_find.c
drivers/gpu/drm/radeon/radeon_drv.c
drivers/hwmon/Kconfig
drivers/hwmon/Makefile
drivers/hwmon/ad7414.c [new file with mode: 0644]
drivers/hwmon/adt7473.c
drivers/hwmon/dme1737.c
drivers/hwmon/f71882fg.c
drivers/hwmon/hwmon-vid.c
drivers/hwmon/it87.c
drivers/hwmon/lm75.c
drivers/hwmon/lm85.c
drivers/hwmon/thmc50.c
drivers/hwmon/w83627hf.c
drivers/hwmon/w83791d.c
drivers/ide/Kconfig
drivers/ide/arm/palm_bk3710.c
drivers/ide/ide-cd.c
drivers/ide/ide-disk.c
drivers/ide/ide-dma.c
drivers/ide/ide-floppy.c
drivers/ide/ide-iops.c
drivers/ide/ide-tape.c
drivers/ide/pci/aec62xx.c
drivers/ide/pci/alim15x3.c
drivers/ide/pci/amd74xx.c
drivers/ide/pci/atiixp.c
drivers/ide/pci/cmd64x.c
drivers/ide/pci/cs5520.c
drivers/ide/pci/cs5535.c
drivers/ide/pci/hpt366.c
drivers/ide/pci/it8213.c
drivers/ide/pci/it821x.c
drivers/ide/pci/jmicron.c
drivers/ide/pci/pdc202xx_new.c
drivers/ide/pci/pdc202xx_old.c
drivers/ide/pci/piix.c
drivers/ide/pci/scc_pata.c
drivers/ide/pci/serverworks.c
drivers/ide/pci/siimage.c
drivers/ide/pci/sis5513.c
drivers/ide/pci/slc90e66.c
drivers/ide/pci/tc86c001.c
drivers/ide/pci/via82cxxx.c
drivers/ide/ppc/pmac.c
drivers/infiniband/hw/ehca/ehca_reqs.c
drivers/infiniband/hw/ipath/ipath_iba7220.c
drivers/input/keyboard/maple_keyb.c
drivers/isdn/Makefile
drivers/isdn/gigaset/isocdata.c
drivers/isdn/hardware/mISDN/hfcmulti.c
drivers/isdn/hardware/mISDN/hfcpci.c
drivers/isdn/hysdn/hysdn_pof.h
drivers/isdn/mISDN/l1oip_core.c
drivers/isdn/mISDN/socket.c
drivers/macintosh/mediabay.c
drivers/md/bitmap.c
drivers/md/dm-table.c
drivers/md/md.c
drivers/md/raid10.c
drivers/md/raid5.c
drivers/media/dvb/dvb-usb/cxusb.c
drivers/media/dvb/frontends/Kconfig
drivers/media/video/Kconfig
drivers/media/video/arv.c
drivers/media/video/cs5345.c
drivers/media/video/cs53l32a.c
drivers/media/video/em28xx/em28xx-cards.c
drivers/media/video/gspca/conex.c
drivers/media/video/gspca/etoms.c
drivers/media/video/gspca/gspca.c
drivers/media/video/gspca/gspca.h
drivers/media/video/gspca/ov519.c
drivers/media/video/gspca/pac7311.c
drivers/media/video/gspca/sonixb.c
drivers/media/video/gspca/sonixj.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/vc032x.c
drivers/media/video/gspca/zc3xx.c
drivers/media/video/mt9v022.c
drivers/media/video/planb.c [deleted file]
drivers/media/video/planb.h [deleted file]
drivers/media/video/pxa_camera.c
drivers/media/video/saa7196.h [deleted file]
drivers/media/video/sh_mobile_ceu_camera.c
drivers/media/video/soc_camera.c
drivers/media/video/soc_camera_platform.c
drivers/media/video/uvc/uvc_ctrl.c
drivers/media/video/uvc/uvc_driver.c
drivers/media/video/uvc/uvc_video.c
drivers/media/video/v4l2-dev.c
drivers/media/video/videodev.c [deleted file]
drivers/media/video/vino.c
drivers/misc/Kconfig
drivers/misc/Makefile
drivers/misc/sgi-gru/Makefile [new file with mode: 0644]
drivers/misc/sgi-gru/gru.h [new file with mode: 0644]
drivers/misc/sgi-gru/gru_instructions.h [new file with mode: 0644]
drivers/misc/sgi-gru/grufault.c [new file with mode: 0644]
drivers/misc/sgi-gru/grufile.c [new file with mode: 0644]
drivers/misc/sgi-gru/gruhandles.h [new file with mode: 0644]
drivers/misc/sgi-gru/grukservices.c [new file with mode: 0644]
drivers/misc/sgi-gru/grukservices.h [new file with mode: 0644]
drivers/misc/sgi-gru/grulib.h [new file with mode: 0644]
drivers/misc/sgi-gru/grumain.c [new file with mode: 0644]
drivers/misc/sgi-gru/gruprocfs.c [new file with mode: 0644]
drivers/misc/sgi-gru/grutables.h [new file with mode: 0644]
drivers/misc/sgi-gru/grutlbpurge.c [new file with mode: 0644]
drivers/misc/sgi-xp/Makefile
drivers/misc/sgi-xp/xp.h
drivers/misc/sgi-xp/xp_main.c
drivers/misc/sgi-xp/xp_sn2.c [new file with mode: 0644]
drivers/misc/sgi-xp/xp_uv.c [new file with mode: 0644]
drivers/misc/sgi-xp/xpc.h
drivers/misc/sgi-xp/xpc_channel.c
drivers/misc/sgi-xp/xpc_main.c
drivers/misc/sgi-xp/xpc_partition.c
drivers/misc/sgi-xp/xpc_sn2.c [new file with mode: 0644]
drivers/misc/sgi-xp/xpc_uv.c [new file with mode: 0644]
drivers/misc/sgi-xp/xpnet.c
drivers/mmc/card/block.c
drivers/mmc/card/mmc_test.c
drivers/mmc/core/core.c
drivers/mmc/host/au1xmmc.c
drivers/mmc/host/sdhci-pci.c
drivers/mmc/host/sdhci.c
drivers/mmc/host/sdhci.h
drivers/mtd/chips/jedec_probe.c
drivers/mtd/devices/mtd_dataflash.c
drivers/mtd/maps/ipaq-flash.c
drivers/mtd/mtdsuper.c
drivers/mtd/nand/Kconfig
drivers/mtd/nand/bf5xx_nand.c
drivers/mtd/nand/diskonchip.c
drivers/mtd/nand/fsl_elbc_nand.c
drivers/mtd/nand/nandsim.c
drivers/net/Kconfig
drivers/net/bfin_mac.c
drivers/net/cxgb3/t3_hw.c
drivers/net/ehea/ehea_main.c
drivers/net/enc28j60.c
drivers/net/forcedeth.c
drivers/net/ifb.c
drivers/net/irda/act200l-sir.c
drivers/net/irda/actisys-sir.c
drivers/net/irda/ali-ircc.c
drivers/net/irda/donauboe.c
drivers/net/irda/girbil-sir.c
drivers/net/irda/irda-usb.c
drivers/net/irda/irtty-sir.c
drivers/net/irda/kingsun-sir.c
drivers/net/irda/litelink-sir.c
drivers/net/irda/ma600-sir.c
drivers/net/irda/mcp2120-sir.c
drivers/net/irda/nsc-ircc.c
drivers/net/irda/nsc-ircc.h
drivers/net/irda/old_belkin-sir.c
drivers/net/irda/sir_dev.c
drivers/net/irda/sir_dongle.c
drivers/net/irda/smsc-ircc2.c
drivers/net/irda/tekram-sir.c
drivers/net/irda/toim3232-sir.c
drivers/net/irda/via-ircc.c
drivers/net/irda/vlsi_ir.c
drivers/net/irda/vlsi_ir.h
drivers/net/irda/w83977af_ir.c
drivers/net/mv643xx_eth.c
drivers/net/ne.c
drivers/net/netconsole.c
drivers/net/niu.c
drivers/net/ps3_gelic_wireless.c
drivers/net/s2io.c
drivers/net/sh_eth.c
drivers/net/sh_eth.h
drivers/net/skfp/smt.c
drivers/net/stnic.c
drivers/net/tg3.c
drivers/net/tokenring/3c359.c
drivers/net/usb/dm9601.c
drivers/net/wd.c
drivers/net/wireless/Kconfig
drivers/net/wireless/ath5k/ath5k.h
drivers/net/wireless/ath5k/base.c
drivers/net/wireless/ath5k/base.h
drivers/net/wireless/ath5k/debug.c
drivers/net/wireless/ath5k/debug.h
drivers/net/wireless/ath5k/hw.c
drivers/net/wireless/ath5k/initvals.c
drivers/net/wireless/ath5k/phy.c
drivers/net/wireless/ath5k/reg.h
drivers/net/wireless/b43/main.c
drivers/net/wireless/b43/xmit.c
drivers/net/wireless/b43legacy/main.c
drivers/net/wireless/b43legacy/xmit.c
drivers/net/wireless/ipw2100.c
drivers/net/wireless/ipw2200.c
drivers/net/wireless/iwlwifi/Kconfig
drivers/net/wireless/iwlwifi/Makefile
drivers/net/wireless/iwlwifi/iwl-3945-led.c
drivers/net/wireless/iwlwifi/iwl-3945-led.h
drivers/net/wireless/iwlwifi/iwl-3945.c
drivers/net/wireless/iwlwifi/iwl-4965.c
drivers/net/wireless/iwlwifi/iwl-5000.c
drivers/net/wireless/iwlwifi/iwl-agn-rs.c [moved from drivers/net/wireless/iwlwifi/iwl-4965-rs.c with 89% similarity]
drivers/net/wireless/iwlwifi/iwl-agn-rs.h [moved from drivers/net/wireless/iwlwifi/iwl-4965-rs.h with 93% similarity]
drivers/net/wireless/iwlwifi/iwl-agn.c [moved from drivers/net/wireless/iwlwifi/iwl4965-base.c with 96% similarity]
drivers/net/wireless/iwlwifi/iwl-commands.h
drivers/net/wireless/iwlwifi/iwl-core.c
drivers/net/wireless/iwlwifi/iwl-core.h
drivers/net/wireless/iwlwifi/iwl-csr.h
drivers/net/wireless/iwlwifi/iwl-debug.h
drivers/net/wireless/iwlwifi/iwl-debugfs.c
drivers/net/wireless/iwlwifi/iwl-dev.h
drivers/net/wireless/iwlwifi/iwl-eeprom.c
drivers/net/wireless/iwlwifi/iwl-hcmd.c
drivers/net/wireless/iwlwifi/iwl-led.c
drivers/net/wireless/iwlwifi/iwl-led.h
drivers/net/wireless/iwlwifi/iwl-power.c
drivers/net/wireless/iwlwifi/iwl-power.h
drivers/net/wireless/iwlwifi/iwl-prph.h
drivers/net/wireless/iwlwifi/iwl-rx.c
drivers/net/wireless/iwlwifi/iwl-scan.c
drivers/net/wireless/iwlwifi/iwl-sta.c
drivers/net/wireless/iwlwifi/iwl-tx.c
drivers/net/wireless/iwlwifi/iwl3945-base.c
drivers/net/wireless/libertas/main.c
drivers/net/wireless/libertas/persistcfg.c
drivers/net/wireless/mac80211_hwsim.c
drivers/net/wireless/p54/p54.h
drivers/net/wireless/p54/p54common.c
drivers/net/wireless/prism54/isl_ioctl.c
drivers/net/wireless/rt2x00/rt2500pci.c
drivers/net/wireless/rt2x00/rt2500usb.c
drivers/net/wireless/rt2x00/rt2x00.h
drivers/net/wireless/rt2x00/rt2x00config.c
drivers/net/wireless/rt2x00/rt2x00debug.c
drivers/net/wireless/rt2x00/rt2x00dev.c
drivers/net/wireless/rt2x00/rt2x00lib.h
drivers/net/wireless/rt2x00/rt2x00mac.c
drivers/net/wireless/rt2x00/rt2x00queue.c
drivers/net/wireless/rt2x00/rt2x00queue.h
drivers/net/wireless/rt2x00/rt2x00usb.c
drivers/net/wireless/rt2x00/rt2x00usb.h
drivers/net/wireless/rt2x00/rt61pci.c
drivers/net/wireless/rt2x00/rt73usb.c
drivers/net/wireless/rtl8187.h
drivers/net/wireless/rtl8187_dev.c
drivers/net/wireless/zd1211rw/zd_mac.c
drivers/pcmcia/rsrc_nonstatic.c
drivers/pnp/support.c
drivers/power/Kconfig
drivers/power/Makefile
drivers/power/olpc_battery.c
drivers/power/power_supply_sysfs.c
drivers/power/tosa_battery.c [new file with mode: 0644]
drivers/regulator/Kconfig [new file with mode: 0644]
drivers/regulator/Makefile [new file with mode: 0644]
drivers/regulator/bq24022.c [new file with mode: 0644]
drivers/regulator/core.c [new file with mode: 0644]
drivers/regulator/fixed.c [new file with mode: 0644]
drivers/regulator/virtual.c [new file with mode: 0644]
drivers/rtc/interface.c
drivers/rtc/rtc-bfin.c
drivers/rtc/rtc-dev.c
drivers/s390/block/dasd_alias.c
drivers/s390/block/dasd_devmap.c
drivers/s390/block/dasd_eckd.c
drivers/s390/block/dasd_eckd.h
drivers/s390/block/dasd_int.h
drivers/s390/char/sclp.c
drivers/s390/char/sclp_cmd.c
drivers/s390/char/sclp_config.c
drivers/s390/cio/idset.c
drivers/s390/cio/qdio_main.c
drivers/s390/cio/qdio_perf.c
drivers/s390/cio/qdio_setup.c
drivers/s390/kvm/kvm_virtio.c
drivers/s390/net/qeth_core.h
drivers/s390/net/qeth_core_main.c
drivers/s390/net/qeth_l2_main.c
drivers/s390/net/qeth_l3_main.c
drivers/scsi/hptiop.c
drivers/scsi/ide-scsi.c
drivers/scsi/scsi_transport_spi.c
drivers/scsi/ses.c
drivers/scsi/sg.c
drivers/serial/8250.c
drivers/serial/Makefile
drivers/serial/bfin_5xx.c
drivers/serial/cpm_uart/cpm_uart.h
drivers/serial/cpm_uart/cpm_uart_core.c
drivers/serial/crisv10.c
drivers/serial/crisv10.h
drivers/serial/sh-sci.h
drivers/serial/v850e_uart.c [deleted file]
drivers/sh/maple/maple.c
drivers/spi/Kconfig
drivers/spi/Makefile
drivers/spi/atmel_spi.c
drivers/spi/orion_spi.c [new file with mode: 0644]
drivers/spi/spi_s3c24xx.c
drivers/usb/core/message.c
drivers/usb/gadget/m66592-udc.c
drivers/usb/storage/freecom.c
drivers/video/Makefile
drivers/video/arkfb.c
drivers/video/aty/atyfb_base.c
drivers/video/aty/radeon_accel.c
drivers/video/aty/radeon_i2c.c
drivers/video/backlight/hp680_bl.c
drivers/video/backlight/platform_lcd.c
drivers/video/backlight/pwm_bl.c
drivers/video/console/.gitignore [new file with mode: 0644]
drivers/video/console/fbcon.c
drivers/video/console/sticore.c
drivers/video/fsl-diu-fb.c
drivers/video/gbefb.c
drivers/video/hitfb.c
drivers/video/matrox/matroxfb_base.c
drivers/video/pvr2fb.c
drivers/video/s3fb.c
drivers/video/vt8623fb.c
drivers/watchdog/Kconfig
drivers/watchdog/Makefile
drivers/watchdog/acquirewdt.c
drivers/watchdog/advantechwdt.c
drivers/watchdog/alim1535_wdt.c
drivers/watchdog/alim7101_wdt.c
drivers/watchdog/ar7_wdt.c
drivers/watchdog/at32ap700x_wdt.c
drivers/watchdog/at91rm9200_wdt.c
drivers/watchdog/bfin_wdt.c
drivers/watchdog/booke_wdt.c
drivers/watchdog/cpu5wdt.c
drivers/watchdog/davinci_wdt.c
drivers/watchdog/ep93xx_wdt.c
drivers/watchdog/eurotechwdt.c
drivers/watchdog/geodewdt.c
drivers/watchdog/hpwdt.c
drivers/watchdog/i6300esb.c
drivers/watchdog/iTCO_vendor.h [new file with mode: 0644]
drivers/watchdog/iTCO_vendor_support.c
drivers/watchdog/iTCO_wdt.c
drivers/watchdog/ib700wdt.c
drivers/watchdog/ibmasr.c
drivers/watchdog/indydog.c
drivers/watchdog/iop_wdt.c
drivers/watchdog/it8712f_wdt.c
drivers/watchdog/ixp2000_wdt.c
drivers/watchdog/ixp4xx_wdt.c
drivers/watchdog/ks8695_wdt.c
drivers/watchdog/machzwd.c
drivers/watchdog/mixcomwd.c
drivers/watchdog/mpc5200_wdt.c
drivers/watchdog/mpc83xx_wdt.c [deleted file]
drivers/watchdog/mpc8xx_wdt.c
drivers/watchdog/mpc8xxx_wdt.c [new file with mode: 0644]
drivers/watchdog/mpcore_wdt.c
drivers/watchdog/mtx-1_wdt.c
drivers/watchdog/mv64x60_wdt.c
drivers/watchdog/omap_wdt.c
drivers/watchdog/pc87413_wdt.c
drivers/watchdog/pcwd.c
drivers/watchdog/pcwd_pci.c
drivers/watchdog/pcwd_usb.c
drivers/watchdog/pnx4008_wdt.c
drivers/watchdog/rm9k_wdt.c
drivers/watchdog/s3c2410_wdt.c
drivers/watchdog/sa1100_wdt.c
drivers/watchdog/sb_wdog.c
drivers/watchdog/sbc60xxwdt.c
drivers/watchdog/sbc7240_wdt.c
drivers/watchdog/sbc8360.c
drivers/watchdog/sbc_epx_c3.c
drivers/watchdog/sc1200wdt.c
drivers/watchdog/sc520_wdt.c
drivers/watchdog/scx200_wdt.c
drivers/watchdog/shwdt.c
drivers/watchdog/smsc37b787_wdt.c
drivers/watchdog/softdog.c
drivers/watchdog/txx9wdt.c
drivers/watchdog/w83627hf_wdt.c
drivers/watchdog/w83697hf_wdt.c
drivers/watchdog/w83877f_wdt.c
drivers/watchdog/w83977f_wdt.c
drivers/watchdog/wafer5823wdt.c
drivers/watchdog/wd501p.h
drivers/watchdog/wdrtas.c
drivers/watchdog/wdt.c
drivers/watchdog/wdt285.c
drivers/watchdog/wdt977.c
drivers/watchdog/wdt_pci.c
firmware/ihex2fw.c
fs/afs/mntpt.c
fs/afs/write.c
fs/bio.c
fs/block_dev.c
fs/buffer.c
fs/cifs/cifs_dfs_ref.c
fs/cifs/file.c
fs/configfs/configfs_internal.h
fs/configfs/dir.c
fs/configfs/symlink.c
fs/dcache.c
fs/devpts/inode.c
fs/dquot.c
fs/ext3/super.c
fs/ext4/acl.c
fs/ext4/balloc.c
fs/ext4/ext4.h
fs/ext4/extents.c
fs/ext4/ialloc.c
fs/ext4/inode.c
fs/ext4/mballoc.c
fs/ext4/mballoc.h
fs/ext4/resize.c
fs/ext4/super.c
fs/ext4/xattr.c
fs/fat/file.c
fs/fcntl.c
fs/file.c
fs/jbd/commit.c
fs/jbd2/commit.c
fs/jbd2/journal.c
fs/jffs2/summary.c
fs/jffs2/summary.h
fs/libfs.c
fs/namei.c
fs/namespace.c
fs/nfs/namespace.c
fs/nfs/nfsroot.c
fs/ntfs/aops.c
fs/ntfs/compress.c
fs/ntfs/mft.c
fs/ocfs2/aops.c
fs/ocfs2/file.c
fs/ocfs2/journal.c
fs/ocfs2/journal.h
fs/ocfs2/ocfs2.h
fs/ocfs2/ocfs2_fs.h
fs/ocfs2/super.c
fs/omfs/bitmap.c
fs/omfs/dir.c
fs/omfs/file.c
fs/omfs/inode.c
fs/open.c
fs/proc/base.c
fs/proc/generic.c
fs/reiserfs/inode.c
fs/reiserfs/journal.c
fs/reiserfs/super.c
fs/romfs/inode.c
fs/splice.c
fs/ufs/super.c
fs/xfs/Makefile
fs/xfs/linux-2.6/kmem.c
fs/xfs/linux-2.6/kmem.h
fs/xfs/linux-2.6/xfs_aops.c
fs/xfs/linux-2.6/xfs_buf.c
fs/xfs/linux-2.6/xfs_buf.h
fs/xfs/linux-2.6/xfs_export.c
fs/xfs/linux-2.6/xfs_ioctl.c
fs/xfs/linux-2.6/xfs_iops.c
fs/xfs/linux-2.6/xfs_iops.h
fs/xfs/linux-2.6/xfs_linux.h
fs/xfs/linux-2.6/xfs_stats.c
fs/xfs/linux-2.6/xfs_stats.h
fs/xfs/linux-2.6/xfs_super.c
fs/xfs/linux-2.6/xfs_super.h
fs/xfs/linux-2.6/xfs_sysctl.c
fs/xfs/linux-2.6/xfs_sysctl.h
fs/xfs/linux-2.6/xfs_vnode.c
fs/xfs/linux-2.6/xfs_vnode.h
fs/xfs/linux-2.6/xfs_xattr.c [new file with mode: 0644]
fs/xfs/quota/xfs_dquot.c
fs/xfs/quota/xfs_dquot.h
fs/xfs/quota/xfs_dquot_item.c
fs/xfs/quota/xfs_qm.c
fs/xfs/quota/xfs_qm_syscalls.c
fs/xfs/quota/xfs_quota_priv.h
fs/xfs/support/ktrace.c
fs/xfs/support/uuid.c
fs/xfs/support/uuid.h
fs/xfs/xfs_acl.c
fs/xfs/xfs_acl.h
fs/xfs/xfs_attr.c
fs/xfs/xfs_attr.h
fs/xfs/xfs_attr_leaf.c
fs/xfs/xfs_attr_leaf.h
fs/xfs/xfs_attr_sf.h
fs/xfs/xfs_bmap.c
fs/xfs/xfs_bmap.h
fs/xfs/xfs_bmap_btree.c
fs/xfs/xfs_buf_item.c
fs/xfs/xfs_clnt.h
fs/xfs/xfs_da_btree.c
fs/xfs/xfs_da_btree.h
fs/xfs/xfs_dfrag.c
fs/xfs/xfs_dir2.c
fs/xfs/xfs_dir2.h
fs/xfs/xfs_dir2_block.c
fs/xfs/xfs_dir2_data.c
fs/xfs/xfs_dir2_leaf.c
fs/xfs/xfs_dir2_node.c
fs/xfs/xfs_dir2_sf.c
fs/xfs/xfs_dir2_sf.h
fs/xfs/xfs_dir2_trace.c
fs/xfs/xfs_dmapi.h
fs/xfs/xfs_error.c
fs/xfs/xfs_error.h
fs/xfs/xfs_extfree_item.c
fs/xfs/xfs_filestream.c
fs/xfs/xfs_fs.h
fs/xfs/xfs_fsops.c
fs/xfs/xfs_inode.c
fs/xfs/xfs_inode.h
fs/xfs/xfs_inode_item.c
fs/xfs/xfs_iomap.c
fs/xfs/xfs_itable.c
fs/xfs/xfs_log.c
fs/xfs/xfs_log_priv.h
fs/xfs/xfs_log_recover.c
fs/xfs/xfs_mount.c
fs/xfs/xfs_mount.h
fs/xfs/xfs_mru_cache.c
fs/xfs/xfs_rename.c
fs/xfs/xfs_rtalloc.c
fs/xfs/xfs_sb.h
fs/xfs/xfs_trans.c
fs/xfs/xfs_trans_inode.c
fs/xfs/xfs_trans_item.c
fs/xfs/xfs_vfsops.c
fs/xfs/xfs_vfsops.h
fs/xfs/xfs_vnodeops.c
fs/xfs/xfs_vnodeops.h
include/asm-arm/arch-ns9xxx/debug-macro.S
include/asm-arm/arch-ns9xxx/entry-macro.S
include/asm-arm/arch-ns9xxx/processor.h
include/asm-arm/arch-ns9xxx/system.h
include/asm-arm/arch-omap/board.h
include/asm-frv/unistd.h
include/asm-generic/vmlinux.lds.h
include/asm-m68k/contregs.h
include/asm-m68k/fbio.h
include/asm-m68k/idprom.h
include/asm-mips/gdb-stub.h [deleted file]
include/asm-mips/kdebug.h
include/asm-mips/kgdb.h [new file with mode: 0644]
include/asm-mips/pci.h
include/asm-mips/txx9/generic.h
include/asm-mips/txx9/jmr3927.h
include/asm-mips/txx9/pci.h
include/asm-mips/txx9/smsc_fdc37m81x.h
include/asm-mips/txx9/tx3927.h
include/asm-mips/txx9/tx4927.h
include/asm-mips/txx9/tx4927pcic.h
include/asm-mips/txx9/tx4938.h
include/asm-mips/txx9/txx927.h [deleted file]
include/asm-mips/txx9irq.h
include/asm-mn10300/unistd.h
include/asm-sh/a.out.h [deleted file]
include/asm-sh/cpu-sh2a/cacheflush.h [deleted file]
include/asm-sh/cpu-sh2a/dma.h [deleted file]
include/asm-sh/cpu-sh2a/mmu_context.h [deleted file]
include/asm-sh/cpu-sh2a/timer.h [deleted file]
include/asm-sh/cpu-sh2a/ubc.h [deleted file]
include/asm-sh/cpu-sh2a/watchdog.h [deleted file]
include/asm-sh/cpu-sh3/addrspace.h [deleted file]
include/asm-sh/cpu-sh3/cacheflush.h [deleted file]
include/asm-sh/cpu-sh3/rtc.h [deleted file]
include/asm-sh/cpu-sh3/sigcontext.h [deleted file]
include/asm-sh/cpu-sh5/timer.h [deleted file]
include/asm-x86/iommu.h
include/asm-x86/kvm_host.h
include/linux/Kbuild
include/linux/blkdev.h
include/linux/buffer_head.h
include/linux/configfs.h
include/linux/connector.h
include/linux/cpufreq.h
include/linux/cpumask.h
include/linux/dcache.h
include/linux/file.h
include/linux/ide.h
include/linux/ieee80211.h
include/linux/ihex.h
include/linux/interrupt.h
include/linux/iommu-helper.h
include/linux/ioport.h
include/linux/ip_vs.h [new file with mode: 0644]
include/linux/kallsyms.h
include/linux/kernel.h
include/linux/kexec.h
include/linux/kvm.h
include/linux/kvm_host.h
include/linux/libata.h
include/linux/mISDNif.h
include/linux/maple.h
include/linux/mm.h
include/linux/mount.h
include/linux/mtd/mtd.h
include/linux/mtd/nand.h
include/linux/netdevice.h
include/linux/netfilter/nf_conntrack_tcp.h
include/linux/page-flags.h
include/linux/pagemap.h
include/linux/parser.h
include/linux/pm_qos_params.h
include/linux/power_supply.h
include/linux/quotaops.h
include/linux/raid/md_k.h
include/linux/regulator/bq24022.h [new file with mode: 0644]
include/linux/regulator/consumer.h [new file with mode: 0644]
include/linux/regulator/driver.h [new file with mode: 0644]
include/linux/regulator/fixed.h [new file with mode: 0644]
include/linux/regulator/machine.h [new file with mode: 0644]
include/linux/rfkill.h
include/linux/skbuff.h
include/linux/snmp.h
include/linux/spi/orion_spi.h [new file with mode: 0644]
include/linux/tracehook.h
include/linux/vt_kern.h
include/media/audiochip.h [deleted file]
include/media/soc_camera.h
include/net/dst.h
include/net/flow.h
include/net/ip_vs.h
include/net/mac80211.h
include/net/sch_generic.h
include/net/sctp/structs.h
include/sound/soc-dapm.h
include/video/radeon.h
init/Kconfig
init/calibrate.c
init/main.c
kernel/audit.c
kernel/auditfilter.c
kernel/auditsc.c
kernel/cgroup.c
kernel/cpuset.c
kernel/dma-coherent.c
kernel/exit.c
kernel/irq/manage.c
kernel/kgdb.c
kernel/marker.c
kernel/mutex.c
kernel/pm_qos_params.c
kernel/printk.c
kernel/relay.c
kernel/resource.c
kernel/sched.c
kernel/semaphore.c
kernel/workqueue.c
lib/Kconfig.kgdb
lib/iommu-helper.c
lib/random32.c
mm/filemap.c
mm/hugetlb.c
mm/madvise.c
mm/memcontrol.c
mm/memory.c
mm/migrate.c
mm/mlock.c
mm/mm_init.c
mm/mmap.c
mm/nommu.c
mm/page_alloc.c
mm/rmap.c
mm/shmem.c
mm/swap.c
mm/swap_state.c
mm/swapfile.c
mm/truncate.c
mm/vmscan.c
net/Kconfig
net/atm/mpc.c
net/ax25/sysctl_net_ax25.c
net/bridge/br_device.c
net/bridge/br_if.c
net/bridge/br_netfilter.c
net/bridge/br_private.h
net/bridge/br_stp.c
net/core/dev.c
net/core/neighbour.c
net/core/netpoll.c
net/core/pktgen.c
net/core/skbuff.c
net/ipv4/netfilter/ipt_CLUSTERIP.c
net/ipv4/netfilter/ipt_recent.c
net/ipv4/proc.c
net/ipv4/route.c
net/ipv4/sysctl_net_ipv4.c
net/ipv4/tcp_ipv4.c
net/ipv6/datagram.c
net/ipv6/ip6_output.c
net/ipv6/ipv6_sockglue.c
net/ipv6/proc.c
net/ipv6/syncookies.c
net/ipv6/tcp_ipv6.c
net/mac80211/cfg.c
net/mac80211/ieee80211_i.h
net/mac80211/main.c
net/mac80211/mlme.c
net/mac80211/tx.c
net/mac80211/util.c
net/mac80211/wep.c
net/mac80211/wme.c
net/netfilter/nf_conntrack_proto_tcp.c
net/netfilter/xt_hashlimit.c
net/rfkill/rfkill-input.c
net/rfkill/rfkill.c
net/sched/sch_api.c
net/sched/sch_atm.c
net/sched/sch_cbq.c
net/sched/sch_dsmark.c
net/sched/sch_generic.c
net/sched/sch_hfsc.c
net/sched/sch_htb.c
net/sched/sch_netem.c
net/sched/sch_prio.c
net/sched/sch_red.c
net/sched/sch_sfq.c
net/sched/sch_tbf.c
net/sched/sch_teql.c
net/sctp/ipv6.c
net/sctp/output.c
net/sctp/protocol.c
net/wireless/nl80211.c
scripts/Makefile.fwinst
scripts/genksyms/genksyms.c
scripts/genksyms/lex.c_shipped
scripts/genksyms/lex.l
scripts/genksyms/parse.c_shipped
scripts/genksyms/parse.y
scripts/kconfig/conf.c
scripts/kconfig/confdata.c
scripts/kconfig/lex.zconf.c_shipped
scripts/kconfig/zconf.l
scripts/kernel-doc
scripts/mod/modpost.c
scripts/patch-kernel
scripts/ver_linux
security/selinux/hooks.c
sound/core/seq/oss/seq_oss_synth.c
sound/sh/aica.c
sound/soc/fsl/fsl_dma.c
sound/soc/fsl/fsl_ssi.c
sound/soc/pxa/poodle.c
sound/soc/pxa/tosa.c
sound/soc/soc-dapm.c
virt/kvm/kvm_main.c

index 6de7130..5b5aba4 100644 (file)
@@ -89,8 +89,6 @@ cciss.txt
        - info, major/minor #'s for Compaq's SMART Array Controllers.
 cdrom/
        - directory with information on the CD-ROM drivers that Linux has.
-cli-sti-removal.txt
-       - cli()/sti() removal guide.
 computone.txt
        - info on Computone Intelliport II/Plus Multiport Serial Driver.
 connector/
diff --git a/Documentation/ABI/testing/sysfs-class-regulator b/Documentation/ABI/testing/sysfs-class-regulator
new file mode 100644 (file)
index 0000000..79a4a75
--- /dev/null
@@ -0,0 +1,315 @@
+What:          /sys/class/regulator/.../state
+Date:          April 2008
+KernelVersion: 2.6.26
+Contact:       Liam Girdwood <lg@opensource.wolfsonmicro.com>
+Description:
+               Each regulator directory will contain a field called
+               state. This holds the regulator output state.
+
+               This will be one of the following strings:
+
+               'enabled'
+               'disabled'
+               'unknown'
+
+               'enabled' means the regulator output is ON and is supplying
+               power to the system.
+
+               'disabled' means the regulator output is OFF and is not
+               supplying power to the system..
+
+               'unknown' means software cannot determine the state.
+
+               NOTE: this field can be used in conjunction with microvolts
+               and microamps to determine regulator output levels.
+
+
+What:          /sys/class/regulator/.../type
+Date:          April 2008
+KernelVersion: 2.6.26
+Contact:       Liam Girdwood <lg@opensource.wolfsonmicro.com>
+Description:
+               Each regulator directory will contain a field called
+               type. This holds the regulator type.
+
+               This will be one of the following strings:
+
+               'voltage'
+               'current'
+               'unknown'
+
+               'voltage' means the regulator output voltage can be controlled
+               by software.
+
+               'current' means the regulator output current limit can be
+               controlled by software.
+
+               'unknown' means software cannot control either voltage or
+               current limit.
+
+
+What:          /sys/class/regulator/.../microvolts
+Date:          April 2008
+KernelVersion: 2.6.26
+Contact:       Liam Girdwood <lg@opensource.wolfsonmicro.com>
+Description:
+               Each regulator directory will contain a field called
+               microvolts. This holds the regulator output voltage setting
+               measured in microvolts (i.e. E-6 Volts).
+
+               NOTE: This value should not be used to determine the regulator
+               output voltage level as this value is the same regardless of
+               whether the regulator is enabled or disabled.
+
+
+What:          /sys/class/regulator/.../microamps
+Date:          April 2008
+KernelVersion: 2.6.26
+Contact:       Liam Girdwood <lg@opensource.wolfsonmicro.com>
+Description:
+               Each regulator directory will contain a field called
+               microamps. This holds the regulator output current limit
+               setting measured in microamps (i.e. E-6 Amps).
+
+               NOTE: This value should not be used to determine the regulator
+               output current level as this value is the same regardless of
+               whether the regulator is enabled or disabled.
+
+
+What:          /sys/class/regulator/.../opmode
+Date:          April 2008
+KernelVersion: 2.6.26
+Contact:       Liam Girdwood <lg@opensource.wolfsonmicro.com>
+Description:
+               Each regulator directory will contain a field called
+               opmode. This holds the regulator operating mode setting.
+
+               The opmode value can be one of the following strings:
+
+               'fast'
+               'normal'
+               'idle'
+               'standby'
+               'unknown'
+
+               The modes are described in include/linux/regulator/regulator.h
+
+               NOTE: This value should not be used to determine the regulator
+               output operating mode as this value is the same regardless of
+               whether the regulator is enabled or disabled.
+
+
+What:          /sys/class/regulator/.../min_microvolts
+Date:          April 2008
+KernelVersion: 2.6.26
+Contact:       Liam Girdwood <lg@opensource.wolfsonmicro.com>
+Description:
+               Each regulator directory will contain a field called
+               min_microvolts. This holds the minimum safe working regulator
+               output voltage setting for this domain measured in microvolts.
+
+               NOTE: this will return the string 'constraint not defined' if
+               the power domain has no min microvolts constraint defined by
+               platform code.
+
+
+What:          /sys/class/regulator/.../max_microvolts
+Date:          April 2008
+KernelVersion: 2.6.26
+Contact:       Liam Girdwood <lg@opensource.wolfsonmicro.com>
+Description:
+               Each regulator directory will contain a field called
+               max_microvolts. This holds the maximum safe working regulator
+               output voltage setting for this domain measured in microvolts.
+
+               NOTE: this will return the string 'constraint not defined' if
+               the power domain has no max microvolts constraint defined by
+               platform code.
+
+
+What:          /sys/class/regulator/.../min_microamps
+Date:          April 2008
+KernelVersion: 2.6.26
+Contact:       Liam Girdwood <lg@opensource.wolfsonmicro.com>
+Description:
+               Each regulator directory will contain a field called
+               min_microamps. This holds the minimum safe working regulator
+               output current limit setting for this domain measured in
+               microamps.
+
+               NOTE: this will return the string 'constraint not defined' if
+               the power domain has no min microamps constraint defined by
+               platform code.
+
+
+What:          /sys/class/regulator/.../max_microamps
+Date:          April 2008
+KernelVersion: 2.6.26
+Contact:       Liam Girdwood <lg@opensource.wolfsonmicro.com>
+Description:
+               Each regulator directory will contain a field called
+               max_microamps. This holds the maximum safe working regulator
+               output current limit setting for this domain measured in
+               microamps.
+
+               NOTE: this will return the string 'constraint not defined' if
+               the power domain has no max microamps constraint defined by
+               platform code.
+
+
+What:          /sys/class/regulator/.../num_users
+Date:          April 2008
+KernelVersion: 2.6.26
+Contact:       Liam Girdwood <lg@opensource.wolfsonmicro.com>
+Description:
+               Each regulator directory will contain a field called
+               num_users. This holds the number of consumer devices that
+               have called regulator_enable() on this regulator.
+
+
+What:          /sys/class/regulator/.../requested_microamps
+Date:          April 2008
+KernelVersion: 2.6.26
+Contact:       Liam Girdwood <lg@opensource.wolfsonmicro.com>
+Description:
+               Each regulator directory will contain a field called
+               requested_microamps. This holds the total requested load
+               current in microamps for this regulator from all its consumer
+               devices.
+
+
+What:          /sys/class/regulator/.../parent
+Date:          April 2008
+KernelVersion: 2.6.26
+Contact:       Liam Girdwood <lg@opensource.wolfsonmicro.com>
+Description:
+               Some regulator directories will contain a link called parent.
+               This points to the parent or supply regulator if one exists.
+
+What:          /sys/class/regulator/.../suspend_mem_microvolts
+Date:          May 2008
+KernelVersion: 2.6.26
+Contact:       Liam Girdwood <lg@opensource.wolfsonmicro.com>
+Description:
+               Each regulator directory will contain a field called
+               suspend_mem_microvolts. This holds the regulator output
+               voltage setting for this domain measured in microvolts when
+               the system is suspended to memory.
+
+               NOTE: this will return the string 'not defined' if
+               the power domain has no suspend to memory voltage defined by
+               platform code.
+
+What:          /sys/class/regulator/.../suspend_disk_microvolts
+Date:          May 2008
+KernelVersion: 2.6.26
+Contact:       Liam Girdwood <lg@opensource.wolfsonmicro.com>
+Description:
+               Each regulator directory will contain a field called
+               suspend_disk_microvolts. This holds the regulator output
+               voltage setting for this domain measured in microvolts when
+               the system is suspended to disk.
+
+               NOTE: this will return the string 'not defined' if
+               the power domain has no suspend to disk voltage defined by
+               platform code.
+
+What:          /sys/class/regulator/.../suspend_standby_microvolts
+Date:          May 2008
+KernelVersion: 2.6.26
+Contact:       Liam Girdwood <lg@opensource.wolfsonmicro.com>
+Description:
+               Each regulator directory will contain a field called
+               suspend_standby_microvolts. This holds the regulator output
+               voltage setting for this domain measured in microvolts when
+               the system is suspended to standby.
+
+               NOTE: this will return the string 'not defined' if
+               the power domain has no suspend to standby voltage defined by
+               platform code.
+
+What:          /sys/class/regulator/.../suspend_mem_mode
+Date:          May 2008
+KernelVersion: 2.6.26
+Contact:       Liam Girdwood <lg@opensource.wolfsonmicro.com>
+Description:
+               Each regulator directory will contain a field called
+               suspend_mem_mode. This holds the regulator operating mode
+               setting for this domain when the system is suspended to
+               memory.
+
+               NOTE: this will return the string 'not defined' if
+               the power domain has no suspend to memory mode defined by
+               platform code.
+
+What:          /sys/class/regulator/.../suspend_disk_mode
+Date:          May 2008
+KernelVersion: 2.6.26
+Contact:       Liam Girdwood <lg@opensource.wolfsonmicro.com>
+Description:
+               Each regulator directory will contain a field called
+               suspend_disk_mode. This holds the regulator operating mode
+               setting for this domain when the system is suspended to disk.
+
+               NOTE: this will return the string 'not defined' if
+               the power domain has no suspend to disk mode defined by
+               platform code.
+
+What:          /sys/class/regulator/.../suspend_standby_mode
+Date:          May 2008
+KernelVersion: 2.6.26
+Contact:       Liam Girdwood <lg@opensource.wolfsonmicro.com>
+Description:
+               Each regulator directory will contain a field called
+               suspend_standby_mode. This holds the regulator operating mode
+               setting for this domain when the system is suspended to
+               standby.
+
+               NOTE: this will return the string 'not defined' if
+               the power domain has no suspend to standby mode defined by
+               platform code.
+
+What:          /sys/class/regulator/.../suspend_mem_state
+Date:          May 2008
+KernelVersion: 2.6.26
+Contact:       Liam Girdwood <lg@opensource.wolfsonmicro.com>
+Description:
+               Each regulator directory will contain a field called
+               suspend_mem_state. This holds the regulator operating state
+               when suspended to memory.
+
+               This will be one of the following strings:
+
+               'enabled'
+               'disabled'
+               'not defined'
+
+What:          /sys/class/regulator/.../suspend_disk_state
+Date:          May 2008
+KernelVersion: 2.6.26
+Contact:       Liam Girdwood <lg@opensource.wolfsonmicro.com>
+Description:
+               Each regulator directory will contain a field called
+               suspend_disk_state. This holds the regulator operating state
+               when suspended to disk.
+
+               This will be one of the following strings:
+
+               'enabled'
+               'disabled'
+               'not defined'
+
+What:          /sys/class/regulator/.../suspend_standby_state
+Date:          May 2008
+KernelVersion: 2.6.26
+Contact:       Liam Girdwood <lg@opensource.wolfsonmicro.com>
+Description:
+               Each regulator directory will contain a field called
+               suspend_standby_state. This holds the regulator operating
+               state when suspended to standby.
+
+               This will be one of the following strings:
+
+               'enabled'
+               'disabled'
+               'not defined'
index 0eb0d02..1d1b345 100644 (file)
@@ -12,7 +12,7 @@ DOCBOOKS := wanbook.xml z8530book.xml mcabook.xml videobook.xml \
            kernel-api.xml filesystems.xml lsm.xml usb.xml kgdb.xml \
            gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \
            genericirq.xml s390-drivers.xml uio-howto.xml scsi.xml \
-           mac80211.xml debugobjects.xml
+           mac80211.xml debugobjects.xml sh.xml
 
 ###
 # The build process is as follows (targets):
index e8acd1f..372dec2 100644 (file)
     "Kernel debugging" select "KGDB: kernel debugging with remote gdb".
     </para>
     <para>
+    It is advised, but not required that you turn on the
+    CONFIG_FRAME_POINTER kernel option.  This option inserts code to
+    into the compiled executable which saves the frame information in
+    registers or on the stack at different points which will allow a
+    debugger such as gdb to more accurately construct stack back traces
+    while debugging the kernel.
+    </para>
+    <para>
+    If the architecture that you are using supports the kernel option
+    CONFIG_DEBUG_RODATA, you should consider turning it off.  This
+    option will prevent the use of software breakpoints because it
+    marks certain regions of the kernel's memory space as read-only.
+    If kgdb supports it for the architecture you are using, you can
+    use hardware breakpoints if you desire to run with the
+    CONFIG_DEBUG_RODATA option turned on, else you need to turn off
+    this option.
+    </para>
+    <para>
     Next you should choose one of more I/O drivers to interconnect debugging
     host and debugged target.  Early boot debugging requires a KGDB
     I/O driver that supports early debugging and the driver must be
index 4acc732..95bfc12 100644 (file)
       the hardware structures represented here, please consult the Principles
       of Operation.
     </para>
-!Iinclude/asm-s390/cio.h
+!Iarch/s390/include/asm/cio.h
     </sect1>
     <sect1 id="ccwdev">
      <title>ccw devices</title>
       ccw device structure. Device drivers must not bypass those functions
       or strange side effects may happen.
     </para>
-!Iinclude/asm-s390/ccwdev.h
+!Iarch/s390/include/asm/ccwdev.h
 !Edrivers/s390/cio/device.c
 !Edrivers/s390/cio/device_ops.c
     </sect1>
        measurement data which is made available by the channel subsystem
        for each channel attached device.
   </para>
-!Iinclude/asm-s390/cmb.h
+!Iarch/s390/include/asm/cmb.h
 !Edrivers/s390/cio/cmf.c
     </sect1>
   </chapter>
   </para>
    <sect1 id="ccwgroupdevices">
     <title>ccw group devices</title>
-!Iinclude/asm-s390/ccwgroup.h
+!Iarch/s390/include/asm/ccwgroup.h
 !Edrivers/s390/cio/ccwgroup.c
    </sect1>
   </chapter>
diff --git a/Documentation/DocBook/sh.tmpl b/Documentation/DocBook/sh.tmpl
new file mode 100644 (file)
index 0000000..0c3dc4c
--- /dev/null
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+       "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
+
+<book id="sh-drivers">
+ <bookinfo>
+  <title>SuperH Interfaces Guide</title>
+  
+  <authorgroup>
+   <author>
+    <firstname>Paul</firstname>
+    <surname>Mundt</surname>
+    <affiliation>
+     <address>
+      <email>lethal@linux-sh.org</email>
+     </address>
+    </affiliation>
+   </author>
+  </authorgroup>
+
+  <copyright>
+   <year>2008</year>
+   <holder>Paul Mundt</holder>
+  </copyright>
+  <copyright>
+   <year>2008</year>
+   <holder>Renesas Technology Corp.</holder>
+  </copyright>
+
+  <legalnotice>
+   <para>
+     This documentation 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.
+   </para>
+      
+   <para>
+     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.
+   </para>
+      
+   <para>
+     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
+   </para>
+      
+   <para>
+     For more details see the file COPYING in the source
+     distribution of Linux.
+   </para>
+  </legalnotice>
+ </bookinfo>
+
+<toc></toc>
+
+  <chapter id="mm">
+    <title>Memory Management</title>
+    <sect1 id="sh4">
+    <title>SH-4</title>
+      <sect2 id="sq">
+        <title>Store Queue API</title>
+!Earch/sh/kernel/cpu/sh4/sq.c
+      </sect2>
+    </sect1>
+    <sect1 id="sh5">
+      <title>SH-5</title>
+      <sect2 id="tlb">
+       <title>TLB Interfaces</title>
+!Iarch/sh/mm/tlb-sh5.c
+!Iarch/sh/include/asm/tlb_64.h
+      </sect2>
+    </sect1>
+  </chapter>
+  <chapter id="clk">
+    <title>Clock Framework Extensions</title>
+!Iarch/sh/include/asm/clock.h
+  </chapter>
+  <chapter id="mach">
+    <title>Machine Specific Interfaces</title>
+    <sect1 id="dreamcast">
+      <title>mach-dreamcast</title>
+!Iarch/sh/boards/mach-dreamcast/rtc.c
+    </sect1>
+    <sect1 id="x3proto">
+      <title>mach-x3proto</title>
+!Earch/sh/boards/mach-x3proto/ilsel.c
+    </sect1>
+  </chapter>
+  <chapter id="busses">
+    <title>Busses</title>
+    <sect1 id="superhyway">
+      <title>SuperHyway</title>
+!Edrivers/sh/superhyway/superhyway.c
+    </sect1>
+
+    <sect1 id="maple">
+      <title>Maple</title>
+!Edrivers/sh/maple/maple.c
+    </sect1>
+  </chapter>
+</book>
index 8981779..0bc2594 100644 (file)
@@ -1648,7 +1648,7 @@ static struct video_buffer capture_fb;
 
   <chapter id="pubfunctions">
      <title>Public Functions Provided</title>
-!Edrivers/media/video/videodev.c
+!Edrivers/media/video/v4l2-dev.c
   </chapter>
 
 </book>
index 63e59b8..8244c64 100644 (file)
@@ -112,27 +112,18 @@ Hot plug support for SCSI tape drives
 
 Hot plugging of SCSI tape drives is supported, with some caveats.
 The cciss driver must be informed that changes to the SCSI bus
-have been made, in addition to and prior to informing the SCSI 
-mid layer.  This may be done via the /proc filesystem.  For example:
+have been made.  This may be done via the /proc filesystem.
+For example:
 
        echo "rescan" > /proc/scsi/cciss0/1
 
-This causes the adapter to query the adapter about changes to the 
-physical SCSI buses and/or fibre channel arbitrated loop and the 
+This causes the driver to query the adapter about changes to the
+physical SCSI buses and/or fibre channel arbitrated loop and the
 driver to make note of any new or removed sequential access devices
 or medium changers.  The driver will output messages indicating what 
 devices have been added or removed and the controller, bus, target and 
-lun used to address the device.  Once this is done, the SCSI mid layer 
-can be informed of changes to the virtual SCSI bus which the driver 
-presents to it in the usual way. For example: 
-
-       echo scsi add-single-device 3 2 1 0 > /proc/scsi/scsi
-to add a device on controller 3, bus 2, target 1, lun 0.   Note that
-the driver makes an effort to preserve the devices positions
-in the virtual SCSI bus, so if you are only moving tape drives 
-around on the same adapter and not adding or removing tape drives 
-from the adapter, informing the SCSI mid layer may not be necessary.
+lun used to address the device.  It then notifies the SCSI mid layer
+of these changes.
 
 Note that the naming convention of the /proc filesystem entries 
 contains a number in addition to the driver name.  (E.g. "cciss0" 
diff --git a/Documentation/cli-sti-removal.txt b/Documentation/cli-sti-removal.txt
deleted file mode 100644 (file)
index 60932b0..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-
-#### cli()/sti() removal guide, started by Ingo Molnar <mingo@redhat.com>
-
-
-as of 2.5.28, five popular macros have been removed on SMP, and
-are being phased out on UP:
-
- cli(), sti(), save_flags(flags), save_flags_cli(flags), restore_flags(flags)
-
-until now it was possible to protect driver code against interrupt
-handlers via a cli(), but from now on other, more lightweight methods
-have to be used for synchronization, such as spinlocks or semaphores.
-
-for example, driver code that used to do something like:
-
-       struct driver_data;
-
-       irq_handler (...)
-       {
-               ....
-               driver_data.finish = 1;
-               driver_data.new_work = 0;
-               ....
-       }
-
-       ...
-
-       ioctl_func (...)
-       {
-               ...
-               cli();
-               ...
-               driver_data.finish = 0;
-               driver_data.new_work = 2;
-               ...
-               sti();
-               ...
-       }
-
-was SMP-correct because the cli() function ensured that no
-interrupt handler (amongst them the above irq_handler()) function
-would execute while the cli()-ed section is executing.
-
-but from now on a more direct method of locking has to be used:
-
-       DEFINE_SPINLOCK(driver_lock);
-       struct driver_data;
-
-       irq_handler (...)
-       {
-               unsigned long flags;
-               ....
-               spin_lock_irqsave(&driver_lock, flags);
-               ....
-               driver_data.finish = 1;
-               driver_data.new_work = 0;
-               ....
-               spin_unlock_irqrestore(&driver_lock, flags);
-               ....
-       }
-
-       ...
-
-       ioctl_func (...)
-       {
-               ...
-               spin_lock_irq(&driver_lock);
-               ...
-               driver_data.finish = 0;
-               driver_data.new_work = 2;
-               ...
-               spin_unlock_irq(&driver_lock);
-               ...
-       }
-
-the above code has a number of advantages:
-
-- the locking relation is easier to understand - actual lock usage
-  pinpoints the critical sections. cli() usage is too opaque.
-  Easier to understand means it's easier to debug.
-
-- it's faster, because spinlocks are faster to acquire than the
-  potentially heavily-used IRQ lock. Furthermore, your driver does
-  not have to wait eg. for a big heavy SCSI interrupt to finish,
-  because the driver_lock spinlock is only used by your driver.
-  cli() on the other hand was used by many drivers, and extended
-  the critical section to the whole IRQ handler function - creating
-  serious lock contention.
-
-to make the transition easier, we've still kept the cli(), sti(),
-save_flags(), save_flags_cli() and restore_flags() macros defined
-on UP systems - but their usage will be phased out until 2.6 is
-released.
-
-drivers that want to disable local interrupts (interrupts on the
-current CPU), can use the following five macros:
-
-  local_irq_disable(), local_irq_enable(), local_save_flags(flags),
-  local_irq_save(flags), local_irq_restore(flags)
-
-but beware, their meaning and semantics are much simpler, far from
-that of the old cli(), sti(), save_flags(flags) and restore_flags(flags)
-SMP meaning:
-
-    local_irq_disable()       => turn local IRQs off
-
-    local_irq_enable()        => turn local IRQs on
-
-    local_save_flags(flags)   => save the current IRQ state into flags. The
-                                 state can be on or off. (on some
-                                 architectures there's even more bits in it.)
-
-    local_irq_save(flags)     => save the current IRQ state into flags and
-                                 disable interrupts.
-
-    local_irq_restore(flags)  => restore the IRQ state from flags.
-
-(local_irq_save can save both irqs on and irqs off state, and
-local_irq_restore can restore into both irqs on and irqs off state.)
-
-another related change is that synchronize_irq() now takes a parameter:
-synchronize_irq(irq). This change too has the purpose of making SMP
-synchronization more lightweight - this way you can wait for your own
-interrupt handler to finish, no need to wait for other IRQ sources.
-
-
-why were these changes done? The main reason was the architectural burden
-of maintaining the cli()/sti() interface - it became a real problem. The
-new interrupt system is much more streamlined, easier to understand, debug,
-and it's also a bit faster - the same happened to it that will happen to
-cli()/sti() using drivers once they convert to spinlocks :-)
-
index 44c97e6..fabcb0e 100644 (file)
@@ -311,9 +311,20 @@ the subsystem must be ready for it.
 [An Example]
 
 The best example of these basic concepts is the simple_children
-subsystem/group and the simple_child item in configfs_example.c  It
-shows a trivial object displaying and storing an attribute, and a simple
-group creating and destroying these children.
+subsystem/group and the simple_child item in configfs_example_explicit.c
+and configfs_example_macros.c.  It shows a trivial object displaying and
+storing an attribute, and a simple group creating and destroying these
+children.
+
+The only difference between configfs_example_explicit.c and
+configfs_example_macros.c is how the attributes of the childless item
+are defined.  The childless item has extended attributes, each with
+their own show()/store() operation.  This follows a convention commonly
+used in sysfs.  configfs_example_explicit.c creates these attributes
+by explicitly defining the structures involved.  Conversely
+configfs_example_macros.c uses some convenience macros from configfs.h
+to define the attributes.  These macros are similar to their sysfs
+counterparts.
 
 [Hierarchy Navigation and the Subsystem Mutex]
 
@@ -1,8 +1,10 @@
 /*
  * vim: noexpandtab ts=8 sts=0 sw=8:
  *
- * configfs_example.c - This file is a demonstration module containing
- *      a number of configfs subsystems.
+ * configfs_example_explicit.c - This file is a demonstration module
+ *      containing a number of configfs subsystems.  It explicitly defines
+ *      each structure without using the helper macros defined in
+ *      configfs.h.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public
@@ -281,7 +283,6 @@ static struct config_item *simple_children_make_item(struct config_group *group,
        if (!simple_child)
                return ERR_PTR(-ENOMEM);
 
-
        config_item_init_type_name(&simple_child->item, name,
                                   &simple_child_type);
 
@@ -302,8 +303,8 @@ static struct configfs_attribute *simple_children_attrs[] = {
 };
 
 static ssize_t simple_children_attr_show(struct config_item *item,
-                                        struct configfs_attribute *attr,
-                                        char *page)
+                                        struct configfs_attribute *attr,
+                                        char *page)
 {
        return sprintf(page,
 "[02-simple-children]\n"
@@ -318,7 +319,7 @@ static void simple_children_release(struct config_item *item)
 }
 
 static struct configfs_item_operations simple_children_item_ops = {
-       .release        = simple_children_release,
+       .release        = simple_children_release,
        .show_attribute = simple_children_attr_show,
 };
 
@@ -368,7 +369,6 @@ static struct config_group *group_children_make_group(struct config_group *group
        if (!simple_children)
                return ERR_PTR(-ENOMEM);
 
-
        config_group_init_type_name(&simple_children->group, name,
                                    &simple_children_type);
 
@@ -387,8 +387,8 @@ static struct configfs_attribute *group_children_attrs[] = {
 };
 
 static ssize_t group_children_attr_show(struct config_item *item,
-                                       struct configfs_attribute *attr,
-                                       char *page)
+                                       struct configfs_attribute *attr,
+                                       char *page)
 {
        return sprintf(page,
 "[03-group-children]\n"
diff --git a/Documentation/filesystems/configfs/configfs_example_macros.c b/Documentation/filesystems/configfs/configfs_example_macros.c
new file mode 100644 (file)
index 0000000..d8e30a0
--- /dev/null
@@ -0,0 +1,448 @@
+/*
+ * vim: noexpandtab ts=8 sts=0 sw=8:
+ *
+ * configfs_example_macros.c - This file is a demonstration module
+ *      containing a number of configfs subsystems.  It uses the helper
+ *      macros defined by configfs.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 021110-1307, USA.
+ *
+ * Based on sysfs:
+ *     sysfs is Copyright (C) 2001, 2002, 2003 Patrick Mochel
+ *
+ * configfs Copyright (C) 2005 Oracle.  All rights reserved.
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/slab.h>
+
+#include <linux/configfs.h>
+
+
+
+/*
+ * 01-childless
+ *
+ * This first example is a childless subsystem.  It cannot create
+ * any config_items.  It just has attributes.
+ *
+ * Note that we are enclosing the configfs_subsystem inside a container.
+ * This is not necessary if a subsystem has no attributes directly
+ * on the subsystem.  See the next example, 02-simple-children, for
+ * such a subsystem.
+ */
+
+struct childless {
+       struct configfs_subsystem subsys;
+       int showme;
+       int storeme;
+};
+
+static inline struct childless *to_childless(struct config_item *item)
+{
+       return item ? container_of(to_configfs_subsystem(to_config_group(item)), struct childless, subsys) : NULL;
+}
+
+CONFIGFS_ATTR_STRUCT(childless);
+#define CHILDLESS_ATTR(_name, _mode, _show, _store)    \
+struct childless_attribute childless_attr_##_name = __CONFIGFS_ATTR(_name, _mode, _show, _store)
+#define CHILDLESS_ATTR_RO(_name, _show)        \
+struct childless_attribute childless_attr_##_name = __CONFIGFS_ATTR_RO(_name, _show);
+
+static ssize_t childless_showme_read(struct childless *childless,
+                                    char *page)
+{
+       ssize_t pos;
+
+       pos = sprintf(page, "%d\n", childless->showme);
+       childless->showme++;
+
+       return pos;
+}
+
+static ssize_t childless_storeme_read(struct childless *childless,
+                                     char *page)
+{
+       return sprintf(page, "%d\n", childless->storeme);
+}
+
+static ssize_t childless_storeme_write(struct childless *childless,
+                                      const char *page,
+                                      size_t count)
+{
+       unsigned long tmp;
+       char *p = (char *) page;
+
+       tmp = simple_strtoul(p, &p, 10);
+       if (!p || (*p && (*p != '\n')))
+               return -EINVAL;
+
+       if (tmp > INT_MAX)
+               return -ERANGE;
+
+       childless->storeme = tmp;
+
+       return count;
+}
+
+static ssize_t childless_description_read(struct childless *childless,
+                                         char *page)
+{
+       return sprintf(page,
+"[01-childless]\n"
+"\n"
+"The childless subsystem is the simplest possible subsystem in\n"
+"configfs.  It does not support the creation of child config_items.\n"
+"It only has a few attributes.  In fact, it isn't much different\n"
+"than a directory in /proc.\n");
+}
+
+CHILDLESS_ATTR_RO(showme, childless_showme_read);
+CHILDLESS_ATTR(storeme, S_IRUGO | S_IWUSR, childless_storeme_read,
+              childless_storeme_write);
+CHILDLESS_ATTR_RO(description, childless_description_read);
+
+static struct configfs_attribute *childless_attrs[] = {
+       &childless_attr_showme.attr,
+       &childless_attr_storeme.attr,
+       &childless_attr_description.attr,
+       NULL,
+};
+
+CONFIGFS_ATTR_OPS(childless);
+static struct configfs_item_operations childless_item_ops = {
+       .show_attribute         = childless_attr_show,
+       .store_attribute        = childless_attr_store,
+};
+
+static struct config_item_type childless_type = {
+       .ct_item_ops    = &childless_item_ops,
+       .ct_attrs       = childless_attrs,
+       .ct_owner       = THIS_MODULE,
+};
+
+static struct childless childless_subsys = {
+       .subsys = {
+               .su_group = {
+                       .cg_item = {
+                               .ci_namebuf = "01-childless",
+                               .ci_type = &childless_type,
+                       },
+               },
+       },
+};
+
+
+/* ----------------------------------------------------------------- */
+
+/*
+ * 02-simple-children
+ *
+ * This example merely has a simple one-attribute child.  Note that
+ * there is no extra attribute structure, as the child's attribute is
+ * known from the get-go.  Also, there is no container for the
+ * subsystem, as it has no attributes of its own.
+ */
+
+struct simple_child {
+       struct config_item item;
+       int storeme;
+};
+
+static inline struct simple_child *to_simple_child(struct config_item *item)
+{
+       return item ? container_of(item, struct simple_child, item) : NULL;
+}
+
+static struct configfs_attribute simple_child_attr_storeme = {
+       .ca_owner = THIS_MODULE,
+       .ca_name = "storeme",
+       .ca_mode = S_IRUGO | S_IWUSR,
+};
+
+static struct configfs_attribute *simple_child_attrs[] = {
+       &simple_child_attr_storeme,
+       NULL,
+};
+
+static ssize_t simple_child_attr_show(struct config_item *item,
+                                     struct configfs_attribute *attr,
+                                     char *page)
+{
+       ssize_t count;
+       struct simple_child *simple_child = to_simple_child(item);
+
+       count = sprintf(page, "%d\n", simple_child->storeme);
+
+       return count;
+}
+
+static ssize_t simple_child_attr_store(struct config_item *item,
+                                      struct configfs_attribute *attr,
+                                      const char *page, size_t count)
+{
+       struct simple_child *simple_child = to_simple_child(item);
+       unsigned long tmp;
+       char *p = (char *) page;
+
+       tmp = simple_strtoul(p, &p, 10);
+       if (!p || (*p && (*p != '\n')))
+               return -EINVAL;
+
+       if (tmp > INT_MAX)
+               return -ERANGE;
+
+       simple_child->storeme = tmp;
+
+       return count;
+}
+
+static void simple_child_release(struct config_item *item)
+{
+       kfree(to_simple_child(item));
+}
+
+static struct configfs_item_operations simple_child_item_ops = {
+       .release                = simple_child_release,
+       .show_attribute         = simple_child_attr_show,
+       .store_attribute        = simple_child_attr_store,
+};
+
+static struct config_item_type simple_child_type = {
+       .ct_item_ops    = &simple_child_item_ops,
+       .ct_attrs       = simple_child_attrs,
+       .ct_owner       = THIS_MODULE,
+};
+
+
+struct simple_children {
+       struct config_group group;
+};
+
+static inline struct simple_children *to_simple_children(struct config_item *item)
+{
+       return item ? container_of(to_config_group(item), struct simple_children, group) : NULL;
+}
+
+static struct config_item *simple_children_make_item(struct config_group *group, const char *name)
+{
+       struct simple_child *simple_child;
+
+       simple_child = kzalloc(sizeof(struct simple_child), GFP_KERNEL);
+       if (!simple_child)
+               return ERR_PTR(-ENOMEM);
+
+       config_item_init_type_name(&simple_child->item, name,
+                                  &simple_child_type);
+
+       simple_child->storeme = 0;
+
+       return &simple_child->item;
+}
+
+static struct configfs_attribute simple_children_attr_description = {
+       .ca_owner = THIS_MODULE,
+       .ca_name = "description",
+       .ca_mode = S_IRUGO,
+};
+
+static struct configfs_attribute *simple_children_attrs[] = {
+       &simple_children_attr_description,
+       NULL,
+};
+
+static ssize_t simple_children_attr_show(struct config_item *item,
+                                        struct configfs_attribute *attr,
+                                        char *page)
+{
+       return sprintf(page,
+"[02-simple-children]\n"
+"\n"
+"This subsystem allows the creation of child config_items.  These\n"
+"items have only one attribute that is readable and writeable.\n");
+}
+
+static void simple_children_release(struct config_item *item)
+{
+       kfree(to_simple_children(item));
+}
+
+static struct configfs_item_operations simple_children_item_ops = {
+       .release        = simple_children_release,
+       .show_attribute = simple_children_attr_show,
+};
+
+/*
+ * Note that, since no extra work is required on ->drop_item(),
+ * no ->drop_item() is provided.
+ */
+static struct configfs_group_operations simple_children_group_ops = {
+       .make_item      = simple_children_make_item,
+};
+
+static struct config_item_type simple_children_type = {
+       .ct_item_ops    = &simple_children_item_ops,
+       .ct_group_ops   = &simple_children_group_ops,
+       .ct_attrs       = simple_children_attrs,
+       .ct_owner       = THIS_MODULE,
+};
+
+static struct configfs_subsystem simple_children_subsys = {
+       .su_group = {
+               .cg_item = {
+                       .ci_namebuf = "02-simple-children",
+                       .ci_type = &simple_children_type,
+               },
+       },
+};
+
+
+/* ----------------------------------------------------------------- */
+
+/*
+ * 03-group-children
+ *
+ * This example reuses the simple_children group from above.  However,
+ * the simple_children group is not the subsystem itself, it is a
+ * child of the subsystem.  Creation of a group in the subsystem creates
+ * a new simple_children group.  That group can then have simple_child
+ * children of its own.
+ */
+
+static struct config_group *group_children_make_group(struct config_group *group, const char *name)
+{
+       struct simple_children *simple_children;
+
+       simple_children = kzalloc(sizeof(struct simple_children),
+                                 GFP_KERNEL);
+       if (!simple_children)
+               return ERR_PTR(-ENOMEM);
+
+       config_group_init_type_name(&simple_children->group, name,
+                                   &simple_children_type);
+
+       return &simple_children->group;
+}
+
+static struct configfs_attribute group_children_attr_description = {
+       .ca_owner = THIS_MODULE,
+       .ca_name = "description",
+       .ca_mode = S_IRUGO,
+};
+
+static struct configfs_attribute *group_children_attrs[] = {
+       &group_children_attr_description,
+       NULL,
+};
+
+static ssize_t group_children_attr_show(struct config_item *item,
+                                       struct configfs_attribute *attr,
+                                       char *page)
+{
+       return sprintf(page,
+"[03-group-children]\n"
+"\n"
+"This subsystem allows the creation of child config_groups.  These\n"
+"groups are like the subsystem simple-children.\n");
+}
+
+static struct configfs_item_operations group_children_item_ops = {
+       .show_attribute = group_children_attr_show,
+};
+
+/*
+ * Note that, since no extra work is required on ->drop_item(),
+ * no ->drop_item() is provided.
+ */
+static struct configfs_group_operations group_children_group_ops = {
+       .make_group     = group_children_make_group,
+};
+
+static struct config_item_type group_children_type = {
+       .ct_item_ops    = &group_children_item_ops,
+       .ct_group_ops   = &group_children_group_ops,
+       .ct_attrs       = group_children_attrs,
+       .ct_owner       = THIS_MODULE,
+};
+
+static struct configfs_subsystem group_children_subsys = {
+       .su_group = {
+               .cg_item = {
+                       .ci_namebuf = "03-group-children",
+                       .ci_type = &group_children_type,
+               },
+       },
+};
+
+/* ----------------------------------------------------------------- */
+
+/*
+ * We're now done with our subsystem definitions.
+ * For convenience in this module, here's a list of them all.  It
+ * allows the init function to easily register them.  Most modules
+ * will only have one subsystem, and will only call register_subsystem
+ * on it directly.
+ */
+static struct configfs_subsystem *example_subsys[] = {
+       &childless_subsys.subsys,
+       &simple_children_subsys,
+       &group_children_subsys,
+       NULL,
+};
+
+static int __init configfs_example_init(void)
+{
+       int ret;
+       int i;
+       struct configfs_subsystem *subsys;
+
+       for (i = 0; example_subsys[i]; i++) {
+               subsys = example_subsys[i];
+
+               config_group_init(&subsys->su_group);
+               mutex_init(&subsys->su_mutex);
+               ret = configfs_register_subsystem(subsys);
+               if (ret) {
+                       printk(KERN_ERR "Error %d while registering subsystem %s\n",
+                              ret,
+                              subsys->su_group.cg_item.ci_namebuf);
+                       goto out_unregister;
+               }
+       }
+
+       return 0;
+
+out_unregister:
+       for (; i >= 0; i--) {
+               configfs_unregister_subsystem(example_subsys[i]);
+       }
+
+       return ret;
+}
+
+static void __exit configfs_example_exit(void)
+{
+       int i;
+
+       for (i = 0; example_subsys[i]; i++) {
+               configfs_unregister_subsystem(example_subsys[i]);
+       }
+}
+
+module_init(configfs_example_init);
+module_exit(configfs_example_exit);
+MODULE_LICENSE("GPL");
index f218f61..d330fe3 100644 (file)
@@ -4,6 +4,7 @@
 Copyright 2008 Red Hat Inc.
    Author:   Steven Rostedt <srostedt@redhat.com>
   License:   The GNU Free Documentation License, Version 1.2
+               (dual licensed under the GPL v2)
 Reviewers:   Elias Oltmanns, Randy Dunlap, Andrew Morton,
             John Kacur, and David Teigland.
 
index 8f44607..001d2e7 100644 (file)
@@ -10,6 +10,10 @@ Supported chips:
     Prefix: 'sch311x'
     Addresses scanned: none, address read from Super-I/O config space
     Datasheet: http://www.nuhorizons.com/FeaturedProducts/Volume1/SMSC/311x.pdf
+  * SMSC SCH5027
+    Prefix: 'sch5027'
+    Addresses scanned: I2C 0x2c, 0x2d, 0x2e
+    Datasheet: Provided by SMSC upon request and under NDA
 
 Authors:
     Juerg Haefliger <juergh@gmail.com>
@@ -22,34 +26,36 @@ Module Parameters
                        and PWM output control functions. Using this parameter
                        shouldn't be required since the BIOS usually takes care
                        of this.
-
-Note that there is no need to use this parameter if the driver loads without
-complaining. The driver will say so if it is necessary.
+* probe_all_addr: bool Include non-standard LPC addresses 0x162e and 0x164e
+                       when probing for ISA devices. This is required for the
+                       following boards:
+                       - VIA EPIA SN18000
 
 
 Description
 -----------
 
 This driver implements support for the hardware monitoring capabilities of the
-SMSC DME1737 and Asus A8000 (which are the same) and SMSC SCH311x Super-I/O
-chips. These chips feature monitoring of 3 temp sensors temp[1-3] (2 remote
-diodes and 1 internal), 7 voltages in[0-6] (6 external and 1 internal) and up
-to 6 fan speeds fan[1-6]. Additionally, the chips implement up to 5 PWM
-outputs pwm[1-3,5-6] for controlling fan speeds both manually and
+SMSC DME1737 and Asus A8000 (which are the same), SMSC SCH5027, and SMSC
+SCH311x Super-I/O chips. These chips feature monitoring of 3 temp sensors
+temp[1-3] (2 remote diodes and 1 internal), 7 voltages in[0-6] (6 external and
+1 internal) and up to 6 fan speeds fan[1-6]. Additionally, the chips implement
+up to 5 PWM outputs pwm[1-3,5-6] for controlling fan speeds both manually and
 automatically.
 
-For the DME1737 and A8000, fan[1-2] and pwm[1-2] are always present. Fan[3-6]
-and pwm[3,5-6] are optional features and their availability depends on the
-configuration of the chip. The driver will detect which features are present
-during initialization and create the sysfs attributes accordingly.
+For the DME1737, A8000 and SCH5027, fan[1-2] and pwm[1-2] are always present.
+Fan[3-6] and pwm[3,5-6] are optional features and their availability depends on
+the configuration of the chip. The driver will detect which features are
+present during initialization and create the sysfs attributes accordingly.
 
 For the SCH311x, fan[1-3] and pwm[1-3] are always present and fan[4-6] and
 pwm[5-6] don't exist.
 
-The hardware monitoring features of the DME1737 and A8000 are only accessible
-via SMBus, while the SCH311x only provides access via the ISA bus. The driver
-will therefore register itself as an I2C client driver if it detects a DME1737
-or A8000 and as a platform driver if it detects a SCH311x chip.
+The hardware monitoring features of the DME1737, A8000, and SCH5027 are only
+accessible via SMBus, while the SCH311x only provides access via the ISA bus.
+The driver will therefore register itself as an I2C client driver if it detects
+a DME1737, A8000, or SCH5027 and as a platform driver if it detects a SCH311x
+chip.
 
 
 Voltage Monitoring
@@ -60,6 +66,7 @@ scaling resistors. The values returned by the driver therefore reflect true
 millivolts and don't need scaling. The voltage inputs are mapped as follows
 (the last column indicates the input ranges):
 
+DME1737, A8000:
        in0: +5VTR      (+5V standby)           0V - 6.64V
        in1: Vccp       (processor core)        0V - 3V
        in2: VCC        (internal +3.3V)        0V - 4.38V
@@ -68,6 +75,24 @@ millivolts and don't need scaling. The voltage inputs are mapped as follows
        in5: VTR        (+3.3V standby)         0V - 4.38V
        in6: Vbat       (+3.0V)                 0V - 4.38V
 
+SCH311x:
+       in0: +2.5V                              0V - 6.64V
+       in1: Vccp       (processor core)        0V - 2V
+       in2: VCC        (internal +3.3V)        0V - 4.38V
+       in3: +5V                                0V - 6.64V
+       in4: +12V                               0V - 16V
+       in5: VTR        (+3.3V standby)         0V - 4.38V
+       in6: Vbat       (+3.0V)                 0V - 4.38V
+
+SCH5027:
+       in0: +5VTR      (+5V standby)           0V - 6.64V
+       in1: Vccp       (processor core)        0V - 3V
+       in2: VCC        (internal +3.3V)        0V - 4.38V
+       in3: V2_IN                              0V - 1.5V
+       in4: V1_IN                              0V - 1.5V
+       in5: VTR        (+3.3V standby)         0V - 4.38V
+       in6: Vbat       (+3.0V)                 0V - 4.38V
+
 Each voltage input has associated min and max limits which trigger an alarm
 when crossed.
 
index f4ce1fd..3496b70 100644 (file)
@@ -6,12 +6,14 @@ Supported chips:
     Prefix: 'it87'
     Addresses scanned: from Super I/O config space (8 I/O ports)
     Datasheet: Publicly available at the ITE website
-               http://www.ite.com.tw/
+               http://www.ite.com.tw/product_info/file/pc/IT8705F_V.0.4.1.pdf
   * IT8712F
     Prefix: 'it8712'
     Addresses scanned: from Super I/O config space (8 I/O ports)
     Datasheet: Publicly available at the ITE website
-               http://www.ite.com.tw/
+               http://www.ite.com.tw/product_info/file/pc/IT8712F_V0.9.1.pdf
+               http://www.ite.com.tw/product_info/file/pc/Errata%20V0.1%20for%20IT8712F%20V0.9.1.pdf
+               http://www.ite.com.tw/product_info/file/pc/IT8712F_V0.9.3.pdf
   * IT8716F/IT8726F
     Prefix: 'it8716'
     Addresses scanned: from Super I/O config space (8 I/O ports)
@@ -90,14 +92,13 @@ upper VID bits share their pins with voltage inputs (in5 and in6) so you
 can't have both on a given board.
 
 The IT8716F, IT8718F and later IT8712F revisions have support for
-2 additional fans. They are supported by the driver for the IT8716F and
-IT8718F but not for the IT8712F
+2 additional fans. The additional fans are supported by the driver.
 
 The IT8716F and IT8718F, and late IT8712F and IT8705F also have optional
 16-bit tachometer counters for fans 1 to 3. This is better (no more fan
 clock divider mess) but not compatible with the older chips and
-revisions. For now, the driver only uses the 16-bit mode on the
-IT8716F and IT8718F.
+revisions. The 16-bit tachometer mode is enabled by the driver when one
+of the above chips is detected.
 
 The IT8726F is just bit enhanced IT8716F with additional hardware
 for AMD power sequencing. Therefore the chip will appear as IT8716F
index 9549237..6d41db7 100644 (file)
@@ -96,11 +96,6 @@ initial testing of the ADM1027 it was 1.00 degC steps. Analog Devices has
 confirmed this "bug". The ADT7463 is reported to work as described in the
 documentation. The current lm85 driver does not show the offset register.
 
-The ADT7463 has a THERM asserted counter. This counter has a 22.76ms
-resolution and a range of 5.8 seconds. The driver implements a 32-bit
-accumulator of the counter value to extend the range to over a year. The
-counter will stay at it's max value until read.
-
 See the vendor datasheets for more information. There is application note
 from National (AN-1260) with some additional information about the LM85.
 The Analog Devices datasheet is very detailed and describes a procedure for
@@ -206,13 +201,15 @@ Configuration choices:
 
 The National LM85's have two vendor specific configuration
 features. Tach. mode and Spinup Control. For more details on these,
-see the LM85 datasheet or Application Note AN-1260.
+see the LM85 datasheet or Application Note AN-1260. These features
+are not currently supported by the lm85 driver.
 
 The Analog Devices ADM1027 has several vendor specific enhancements.
 The number of pulses-per-rev of the fans can be set, Tach monitoring
 can be optimized for PWM operation, and an offset can be applied to
 the temperatures to compensate for systemic errors in the
-measurements.
+measurements. These features are not currently supported by the lm85
+driver.
 
 In addition to the ADM1027 features, the ADT7463 also has Tmin control
 and THERM asserted counts. Automatic Tmin control acts to adjust the
index 880a59f..6ee36db 100644 (file)
@@ -40,10 +40,6 @@ Module Parameters
   (default is 1)
   Use 'init=0' to bypass initializing the chip.
   Try this if your computer crashes when you load the module.
-* reset: int
-  (default is 0)
-  The driver used to reset the chip on load, but does no more. Use
-  'reset=1' to restore the old behavior. Report if you need to do this.
 
 Description
 -----------
index f153b2f..a67d3b7 100644 (file)
@@ -22,6 +22,7 @@ Credits:
 
 Additional contributors:
     Sven Anders <anders@anduras.de>
+    Marc Hulsman <m.hulsman@tudelft.nl>
 
 Module Parameters
 -----------------
@@ -67,9 +68,8 @@ on until the temperature falls below the Hysteresis value.
 
 Fan rotation speeds are reported in RPM (rotations per minute). An alarm is
 triggered if the rotation speed has dropped below a programmable limit. Fan
-readings can be divided by a programmable divider (1, 2, 4, 8 for fan 1/2/3
-and 1, 2, 4, 8, 16, 32, 64 or 128 for fan 4/5) to give the readings more
-range or accuracy.
+readings can be divided by a programmable divider (1, 2, 4, 8, 16,
+32, 64 or 128 for all fans) to give the readings more range or accuracy.
 
 Voltage sensors (also known as IN sensors) report their values in millivolts.
 An alarm is triggered if the voltage has crossed a programmable minimum
index 49adb1a..c40866e 100644 (file)
@@ -1,4 +1,4 @@
-PM quality of Service interface.
+PM Quality Of Service Interface.
 
 This interface provides a kernel and user mode interface for registering
 performance expectations by drivers, subsystems and user space applications on
@@ -7,6 +7,11 @@ one of the parameters.
 Currently we have {cpu_dma_latency, network_latency, network_throughput} as the
 initial set of pm_qos parameters.
 
+Each parameters have defined units:
+ * latency: usec
+ * timeout: usec
+ * throughput: kbs (kilo bit / sec)
+
 The infrastructure exposes multiple misc device nodes one per implemented
 parameter.  The set of parameters implement is defined by pm_qos_power_init()
 and pm_qos_params.h.  This is done because having the available parameters
index a8686e5..c6cd495 100644 (file)
@@ -101,6 +101,10 @@ of charge when battery became full/empty". It also could mean "value of
 charge when battery considered full/empty at given conditions (temperature,
 age)". I.e. these attributes represents real thresholds, not design values.
 
+CHARGE_COUNTER - the current charge counter (in ÂµAh).  This could easily
+be negative; there is no empty or full value.  It is only useful for
+relative, time-based measurements.
+
 ENERGY_FULL, ENERGY_EMPTY - same as above but for energy.
 
 CAPACITY - capacity in percents.
diff --git a/Documentation/power/regulator/consumer.txt b/Documentation/power/regulator/consumer.txt
new file mode 100644 (file)
index 0000000..82b7a43
--- /dev/null
@@ -0,0 +1,182 @@
+Regulator Consumer Driver Interface
+===================================
+
+This text describes the regulator interface for consumer device drivers.
+Please see overview.txt for a description of the terms used in this text.
+
+
+1. Consumer Regulator Access (static & dynamic drivers)
+=======================================================
+
+A consumer driver can get access to it's supply regulator by calling :-
+
+regulator = regulator_get(dev, "Vcc");
+
+The consumer passes in it's struct device pointer and power supply ID. The core
+then finds the correct regulator by consulting a machine specific lookup table.
+If the lookup is successful then this call will return a pointer to the struct
+regulator that supplies this consumer.
+
+To release the regulator the consumer driver should call :-
+
+regulator_put(regulator);
+
+Consumers can be supplied by more than one regulator e.g. codec consumer with
+analog and digital supplies :-
+
+digital = regulator_get(dev, "Vcc");  /* digital core */
+analog = regulator_get(dev, "Avdd");  /* analog */
+
+The regulator access functions regulator_get() and regulator_put() will
+usually be called in your device drivers probe() and remove() respectively.
+
+
+2. Regulator Output Enable & Disable (static & dynamic drivers)
+====================================================================
+
+A consumer can enable it's power supply by calling:-
+
+int regulator_enable(regulator);
+
+NOTE: The supply may already be enabled before regulator_enabled() is called.
+This may happen if the consumer shares the regulator or the regulator has been
+previously enabled by bootloader or kernel board initialization code.
+
+A consumer can determine if a regulator is enabled by calling :-
+
+int regulator_is_enabled(regulator);
+
+This will return > zero when the regulator is enabled.
+
+
+A consumer can disable it's supply when no longer needed by calling :-
+
+int regulator_disable(regulator);
+
+NOTE: This may not disable the supply if it's shared with other consumers. The
+regulator will only be disabled when the enabled reference count is zero.
+
+Finally, a regulator can be forcefully disabled in the case of an emergency :-
+
+int regulator_force_disable(regulator);
+
+NOTE: this will immediately and forcefully shutdown the regulator output. All
+consumers will be powered off.
+
+
+3. Regulator Voltage Control & Status (dynamic drivers)
+======================================================
+
+Some consumer drivers need to be able to dynamically change their supply
+voltage to match system operating points. e.g. CPUfreq drivers can scale
+voltage along with frequency to save power, SD drivers may need to select the
+correct card voltage, etc.
+
+Consumers can control their supply voltage by calling :-
+
+int regulator_set_voltage(regulator, min_uV, max_uV);
+
+Where min_uV and max_uV are the minimum and maximum acceptable voltages in
+microvolts.
+
+NOTE: this can be called when the regulator is enabled or disabled. If called
+when enabled, then the voltage changes instantly, otherwise the voltage
+configuration changes and the voltage is physically set when the regulator is
+next enabled.
+
+The regulators configured voltage output can be found by calling :-
+
+int regulator_get_voltage(regulator);
+
+NOTE: get_voltage() will return the configured output voltage whether the
+regulator is enabled or disabled and should NOT be used to determine regulator
+output state. However this can be used in conjunction with is_enabled() to
+determine the regulator physical output voltage.
+
+
+4. Regulator Current Limit Control & Status (dynamic drivers)
+===========================================================
+
+Some consumer drivers need to be able to dynamically change their supply
+current limit to match system operating points. e.g. LCD backlight driver can
+change the current limit to vary the backlight brightness, USB drivers may want
+to set the limit to 500mA when supplying power.
+
+Consumers can control their supply current limit by calling :-
+
+int regulator_set_current_limit(regulator, min_uV, max_uV);
+
+Where min_uA and max_uA are the minimum and maximum acceptable current limit in
+microamps.
+
+NOTE: this can be called when the regulator is enabled or disabled. If called
+when enabled, then the current limit changes instantly, otherwise the current
+limit configuration changes and the current limit is physically set when the
+regulator is next enabled.
+
+A regulators current limit can be found by calling :-
+
+int regulator_get_current_limit(regulator);
+
+NOTE: get_current_limit() will return the current limit whether the regulator
+is enabled or disabled and should not be used to determine regulator current
+load.
+
+
+5. Regulator Operating Mode Control & Status (dynamic drivers)
+=============================================================
+
+Some consumers can further save system power by changing the operating mode of
+their supply regulator to be more efficient when the consumers operating state
+changes. e.g. consumer driver is idle and subsequently draws less current
+
+Regulator operating mode can be changed indirectly or directly.
+
+Indirect operating mode control.
+--------------------------------
+Consumer drivers can request a change in their supply regulator operating mode
+by calling :-
+
+int regulator_set_optimum_mode(struct regulator *regulator, int load_uA);
+
+This will cause the core to recalculate the total load on the regulator (based
+on all it's consumers) and change operating mode (if necessary and permitted)
+to best match the current operating load.
+
+The load_uA value can be determined from the consumers datasheet. e.g.most
+datasheets have tables showing the max current consumed in certain situations.
+
+Most consumers will use indirect operating mode control since they have no
+knowledge of the regulator or whether the regulator is shared with other
+consumers.
+
+Direct operating mode control.
+------------------------------
+Bespoke or tightly coupled drivers may want to directly control regulator
+operating mode depending on their operating point. This can be achieved by
+calling :-
+
+int regulator_set_mode(struct regulator *regulator, unsigned int mode);
+unsigned int regulator_get_mode(struct regulator *regulator);
+
+Direct mode will only be used by consumers that *know* about the regulator and
+are not sharing the regulator with other consumers.
+
+
+6. Regulator Events
+===================
+Regulators can notify consumers of external events. Events could be received by
+consumers under regulator stress or failure conditions.
+
+Consumers can register interest in regulator events by calling :-
+
+int regulator_register_notifier(struct regulator *regulator,
+                             struct notifier_block *nb);
+
+Consumers can uregister interest by calling :-
+
+int regulator_unregister_notifier(struct regulator *regulator,
+                               struct notifier_block *nb);
+
+Regulators use the kernel notifier framework to send event to thier interested
+consumers.
diff --git a/Documentation/power/regulator/machine.txt b/Documentation/power/regulator/machine.txt
new file mode 100644 (file)
index 0000000..c9a3566
--- /dev/null
@@ -0,0 +1,101 @@
+Regulator Machine Driver Interface
+===================================
+
+The regulator machine driver interface is intended for board/machine specific
+initialisation code to configure the regulator subsystem. Typical things that
+machine drivers would do are :-
+
+ 1. Regulator -> Device mapping.
+ 2. Regulator supply configuration.
+ 3. Power Domain constraint setting.
+
+
+
+1. Regulator -> device mapping
+==============================
+Consider the following machine :-
+
+  Regulator-1 -+-> Regulator-2 --> [Consumer A @ 1.8 - 2.0V]
+               |
+               +-> [Consumer B @ 3.3V]
+
+The drivers for consumers A & B must be mapped to the correct regulator in
+order to control their power supply. This mapping can be achieved in machine
+initialisation code by calling :-
+
+int regulator_set_device_supply(const char *regulator, struct device *dev,
+                               const char *supply);
+
+and is shown with the following code :-
+
+regulator_set_device_supply("Regulator-1", devB, "Vcc");
+regulator_set_device_supply("Regulator-2", devA, "Vcc");
+
+This maps Regulator-1 to the 'Vcc' supply for Consumer B and maps Regulator-2
+to the 'Vcc' supply for Consumer A.
+
+
+2. Regulator supply configuration.
+==================================
+Consider the following machine (again) :-
+
+  Regulator-1 -+-> Regulator-2 --> [Consumer A @ 1.8 - 2.0V]
+               |
+               +-> [Consumer B @ 3.3V]
+
+Regulator-1 supplies power to Regulator-2. This relationship must be registered
+with the core so that Regulator-1 is also enabled when Consumer A enables it's
+supply (Regulator-2).
+
+This relationship can be register with the core via :-
+
+int regulator_set_supply(const char *regulator, const char *regulator_supply);
+
+In this example we would use the following code :-
+
+regulator_set_supply("Regulator-2", "Regulator-1");
+
+Relationships can be queried by calling :-
+
+const char *regulator_get_supply(const char *regulator);
+
+
+3. Power Domain constraint setting.
+===================================
+Each power domain within a system has physical constraints on voltage and
+current. This must be defined in software so that the power domain is always
+operated within specifications.
+
+Consider the following machine (again) :-
+
+  Regulator-1 -+-> Regulator-2 --> [Consumer A @ 1.8 - 2.0V]
+               |
+               +-> [Consumer B @ 3.3V]
+
+This gives us two regulators and two power domains:
+
+                   Domain 1: Regulator-2, Consumer B.
+                   Domain 2: Consumer A.
+
+Constraints can be registered by calling :-
+
+int regulator_set_platform_constraints(const char *regulator,
+       struct regulation_constraints *constraints);
+
+The example is defined as follows :-
+
+struct regulation_constraints domain_1 = {
+       .min_uV = 3300000,
+       .max_uV = 3300000,
+       .valid_modes_mask = REGULATOR_MODE_NORMAL,
+};
+
+struct regulation_constraints domain_2 = {
+       .min_uV = 1800000,
+       .max_uV = 2000000,
+       .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+       .valid_modes_mask = REGULATOR_MODE_NORMAL,
+};
+
+regulator_set_platform_constraints("Regulator-1", &domain_1);
+regulator_set_platform_constraints("Regulator-2", &domain_2);
diff --git a/Documentation/power/regulator/overview.txt b/Documentation/power/regulator/overview.txt
new file mode 100644 (file)
index 0000000..bdcb332
--- /dev/null
@@ -0,0 +1,171 @@
+Linux voltage and current regulator framework
+=============================================
+
+About
+=====
+
+This framework is designed to provide a standard kernel interface to control
+voltage and current regulators.
+
+The intention is to allow systems to dynamically control regulator power output
+in order to save power and prolong battery life. This applies to both voltage
+regulators (where voltage output is controllable) and current sinks (where
+current limit is controllable).
+
+(C) 2008  Wolfson Microelectronics PLC.
+Author: Liam Girdwood <lg@opensource.wolfsonmicro.com>
+
+
+Nomenclature
+============
+
+Some terms used in this document:-
+
+  o Regulator    - Electronic device that supplies power to other devices.
+                   Most regulators can enable and disable their output whilst
+                   some can control their output voltage and or current.
+
+                   Input Voltage -> Regulator -> Output Voltage
+
+
+  o PMIC         - Power Management IC. An IC that contains numerous regulators
+                   and often contains other susbsystems.
+
+
+  o Consumer     - Electronic device that is supplied power by a regulator.
+                   Consumers can be classified into two types:-
+
+                   Static: consumer does not change it's supply voltage or
+                   current limit. It only needs to enable or disable it's
+                   power supply. It's supply voltage is set by the hardware,
+                   bootloader, firmware or kernel board initialisation code.
+
+                   Dynamic: consumer needs to change it's supply voltage or
+                   current limit to meet operation demands.
+
+
+  o Power Domain - Electronic circuit that is supplied it's input power by the
+                   output power of a regulator, switch or by another power
+                   domain.
+
+                   The supply regulator may be behind a switch(s). i.e.
+
+                   Regulator -+-> Switch-1 -+-> Switch-2 --> [Consumer A]
+                              |             |
+                              |             +-> [Consumer B], [Consumer C]
+                              |
+                              +-> [Consumer D], [Consumer E]
+
+                   That is one regulator and three power domains:
+
+                   Domain 1: Switch-1, Consumers D & E.
+                   Domain 2: Switch-2, Consumers B & C.
+                   Domain 3: Consumer A.
+
+                   and this represents a "supplies" relationship:
+
+                   Domain-1 --> Domain-2 --> Domain-3.
+
+                   A power domain may have regulators that are supplied power
+                   by other regulators. i.e.
+
+                   Regulator-1 -+-> Regulator-2 -+-> [Consumer A]
+                                |
+                                +-> [Consumer B]
+
+                   This gives us two regulators and two power domains:
+
+                   Domain 1: Regulator-2, Consumer B.
+                   Domain 2: Consumer A.
+
+                   and a "supplies" relationship:
+
+                   Domain-1 --> Domain-2
+
+
+  o Constraints  - Constraints are used to define power levels for performance
+                   and hardware protection. Constraints exist at three levels:
+
+                   Regulator Level: This is defined by the regulator hardware
+                   operating parameters and is specified in the regulator
+                   datasheet. i.e.
+
+                     - voltage output is in the range 800mV -> 3500mV.
+                     - regulator current output limit is 20mA @ 5V but is
+                       10mA @ 10V.
+
+                   Power Domain Level: This is defined in software by kernel
+                   level board initialisation code. It is used to constrain a
+                   power domain to a particular power range. i.e.
+
+                     - Domain-1 voltage is 3300mV
+                     - Domain-2 voltage is 1400mV -> 1600mV
+                     - Domain-3 current limit is 0mA -> 20mA.
+
+                   Consumer Level: This is defined by consumer drivers
+                   dynamically setting voltage or current limit levels.
+
+                   e.g. a consumer backlight driver asks for a current increase
+                   from 5mA to 10mA to increase LCD illumination. This passes
+                   to through the levels as follows :-
+
+                   Consumer: need to increase LCD brightness. Lookup and
+                   request next current mA value in brightness table (the
+                   consumer driver could be used on several different
+                   personalities based upon the same reference device).
+
+                   Power Domain: is the new current limit within the domain
+                   operating limits for this domain and system state (e.g.
+                   battery power, USB power)
+
+                   Regulator Domains: is the new current limit within the
+                   regulator operating parameters for input/ouput voltage.
+
+                   If the regulator request passes all the constraint tests
+                   then the new regulator value is applied.
+
+
+Design
+======
+
+The framework is designed and targeted at SoC based devices but may also be
+relevant to non SoC devices and is split into the following four interfaces:-
+
+
+   1. Consumer driver interface.
+
+      This uses a similar API to the kernel clock interface in that consumer
+      drivers can get and put a regulator (like they can with clocks atm) and
+      get/set voltage, current limit, mode, enable and disable. This should
+      allow consumers complete control over their supply voltage and current
+      limit. This also compiles out if not in use so drivers can be reused in
+      systems with no regulator based power control.
+
+        See Documentation/power/regulator/consumer.txt
+
+   2. Regulator driver interface.
+
+      This allows regulator drivers to register their regulators and provide
+      operations to the core. It also has a notifier call chain for propagating
+      regulator events to clients.
+
+        See Documentation/power/regulator/regulator.txt
+
+   3. Machine interface.
+
+      This interface is for machine specific code and allows the creation of
+      voltage/current domains (with constraints) for each regulator. It can
+      provide regulator constraints that will prevent device damage through
+      overvoltage or over current caused by buggy client drivers. It also
+      allows the creation of a regulator tree whereby some regulators are
+      supplied by others (similar to a clock tree).
+
+        See Documentation/power/regulator/machine.txt
+
+   4. Userspace ABI.
+
+      The framework also exports a lot of useful voltage/current/opmode data to
+      userspace via sysfs. This could be used to help monitor device power
+      consumption and status.
+
+        See Documentation/ABI/testing/regulator-sysfs.txt
diff --git a/Documentation/power/regulator/regulator.txt b/Documentation/power/regulator/regulator.txt
new file mode 100644 (file)
index 0000000..a690501
--- /dev/null
@@ -0,0 +1,30 @@
+Regulator Driver Interface
+==========================
+
+The regulator driver interface is relatively simple and designed to allow
+regulator drivers to register their services with the core framework.
+
+
+Registration
+============
+
+Drivers can register a regulator by calling :-
+
+struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
+                                         void *reg_data);
+
+This will register the regulators capabilities and operations the regulator
+core. The core does not touch reg_data (private to regulator driver).
+
+Regulators can be unregistered by calling :-
+
+void regulator_unregister(struct regulator_dev *rdev);
+
+
+Regulator Events
+================
+Regulators can send events (e.g. over temp, under voltage, etc) to consumer
+drivers by calling :-
+
+int regulator_notifier_call_chain(struct regulator_dev *rdev,
+                                 unsigned long event, void *data);
index 3be84aa..29d839c 100644 (file)
@@ -20,8 +20,6 @@ mpc52xx-device-tree-bindings.txt
        - MPC5200 Device Tree Bindings
 ppc_htab.txt
        - info about the Linux/PPC /proc/ppc_htab entry
-SBC8260_memory_mapping.txt
-       - EST SBC8260 board info
 smp.txt
        - use and state info about Linux/PPC on MP machines
 sound.txt
diff --git a/Documentation/powerpc/SBC8260_memory_mapping.txt b/Documentation/powerpc/SBC8260_memory_mapping.txt
deleted file mode 100644 (file)
index e6e9ee0..0000000
+++ /dev/null
@@ -1,197 +0,0 @@
-Please mail me (Jon Diekema, diekema_jon@si.com or diekema@cideas.com)
-if you have questions, comments or corrections.
-
-       * EST SBC8260 Linux memory mapping rules
-
-       http://www.estc.com/ 
-       http://www.estc.com/products/boards/SBC8260-8240_ds.html
-
-       Initial conditions:
-       -------------------
-       
-       Tasks that need to be perform by the boot ROM before control is
-       transferred to zImage (compressed Linux kernel):
-
-       - Define the IMMR to 0xf0000000
-
-       - Initialize the memory controller so that RAM is available at
-         physical address 0x00000000.  On the SBC8260 is this 16M (64M)
-         SDRAM.
-
-       - The boot ROM should only clear the RAM that it is using.
-
-         The reason for doing this is to enhances the chances of a
-         successful post mortem on a Linux panic.  One of the first
-         items to examine is the 16k (LOG_BUF_LEN) circular console
-         buffer called log_buf which is defined in kernel/printk.c.
-
-       - To enhance boot ROM performance, the I-cache can be enabled.
-
-         Date: Mon, 22 May 2000 14:21:10 -0700
-         From: Neil Russell <caret@c-side.com>
-
-         LiMon (LInux MONitor) runs with and starts Linux with MMU
-         off, I-cache enabled, D-cache disabled.  The I-cache doesn't
-         need hints from the MMU to work correctly as the D-cache
-         does.  No D-cache means no special code to handle devices in
-         the presence of cache (no snooping, etc). The use of the
-         I-cache means that the monitor can run acceptably fast
-         directly from ROM, rather than having to copy it to RAM.
-
-       - Build the board information structure (see 
-         include/asm-ppc/est8260.h for its definition)
-
-       - The compressed Linux kernel (zImage) contains a bootstrap loader 
-         that is position independent; you can load it into any RAM, 
-         ROM or FLASH memory address >= 0x00500000 (above 5 MB), or
-         at its link address of 0x00400000 (4 MB).
-
-         Note: If zImage is loaded at its link address of 0x00400000 (4 MB),
-               then zImage will skip the step of moving itself to 
-               its link address.
-
-       - Load R3 with the address of the board information structure
-
-       - Transfer control to zImage
-
-       - The Linux console port is SMC1, and the baud rate is controlled
-         from the bi_baudrate field of the board information structure.
-         On thing to keep in mind when picking the baud rate, is that
-         there is no flow control on the SMC ports.  I would stick
-         with something safe and standard like 19200.
-
-         On the EST SBC8260, the SMC1 port is on the COM1 connector of
-         the board.
-
-       
-       EST SBC8260 defaults:
-       ---------------------
-
-                                Chip
-        Memory                  Sel  Bus   Use
-        ---------------------   ---  ---   ----------------------------------
-       0x00000000-0x03FFFFFF   CS2  60x   (16M or 64M)/64M SDRAM
-       0x04000000-0x04FFFFFF   CS4  local  4M/16M SDRAM (soldered to the board)
-       0x21000000-0x21000000   CS7  60x    1B/64K Flash present detect (from the flash SIMM)
-       0x21000001-0x21000001   CS7  60x    1B/64K Switches (read) and LEDs (write)
-       0x22000000-0x2200FFFF   CS5  60x    8K/64K EEPROM
-       0xFC000000-0xFCFFFFFF   CS6  60x    2M/16M flash (8 bits wide, soldered to the board)
-       0xFE000000-0xFFFFFFFF   CS0  60x    4M/16M flash (SIMM)
-
-       Notes:
-       ------
-
-       - The chip selects can map 32K blocks and up (powers of 2)
-
-       - The SDRAM machine can handled up to 128Mbytes per chip select
-
-       - Linux uses the 60x bus memory (the SDRAM DIMM) for the 
-         communications buffers.
-
-       - BATs can map 128K-256Mbytes each.  There are four data BATs and
-         four instruction BATs.  Generally the data and instruction BATs
-         are mapped the same.
-
-       - The IMMR must be set above the kernel virtual memory addresses,
-         which start at 0xC0000000.  Otherwise, the kernel may crash as
-         soon as you start any threads or processes due to VM collisions 
-         in the kernel or user process space.
-
-
-         Details from Dan Malek <dan_malek@mvista.com> on 10/29/1999:
-
-         The user application virtual space consumes the first 2 Gbytes
-         (0x00000000 to 0x7FFFFFFF).  The kernel virtual text starts at
-         0xC0000000, with data following.  There is a "protection hole"
-         between the end of kernel data and the start of the kernel
-         dynamically allocated space, but this space is still within
-         0xCxxxxxxx.
-
-         Obviously the kernel can't map any physical addresses 1:1 in
-         these ranges.
-
-
-         Details from Dan Malek <dan_malek@mvista.com> on 5/19/2000:
-
-         During the early kernel initialization, the kernel virtual
-         memory allocator is not operational.  Prior to this KVM
-         initialization, we choose to map virtual to physical addresses
-         1:1.  That is, the kernel virtual address exactly matches the
-         physical address on the bus.  These mappings are typically done
-         in arch/ppc/kernel/head.S, or arch/ppc/mm/init.c.  Only
-         absolutely necessary mappings should be done at this time, for
-         example board control registers or a serial uart.  Normal device
-         driver initialization should map resources later when necessary.
-
-         Although platform dependent, and certainly the case for embedded
-         8xx, traditionally memory is mapped at physical address zero,
-         and I/O devices above physical address 0x80000000.  The lowest
-         and highest (above 0xf0000000) I/O addresses are traditionally 
-         used for devices or registers we need to map during kernel 
-         initialization and prior to KVM operation.  For this reason, 
-         and since it followed prior PowerPC platform examples, I chose 
-         to map the embedded 8xx kernel to the 0xc0000000 virtual address.
-         This way, we can enable the MMU to map the kernel for proper 
-         operation, and still map a few windows before the KVM is operational.
-
-         On some systems, you could possibly run the kernel at the 
-         0x80000000 or any other virtual address.  It just depends upon 
-         mapping that must be done prior to KVM operational.  You can never 
-         map devices or kernel spaces that overlap with the user virtual 
-         space.  This is why default IMMR mapping used by most BDM tools 
-         won't work.  They put the IMMR at something like 0x10000000 or 
-         0x02000000 for example.  You simply can't map these addresses early
-         in the kernel, and continue proper system operation.
-
-         The embedded 8xx/82xx kernel is mature enough that all you should 
-         need to do is map the IMMR someplace at or above 0xf0000000 and it 
-         should boot far enough to get serial console messages and KGDB 
-         connected on any platform.  There are lots of other subtle memory 
-         management design features that you simply don't need to worry 
-         about.  If you are changing functions related to MMU initialization,
-         you are likely breaking things that are known to work and are 
-         heading down a path of disaster and frustration.  Your changes 
-         should be to make the flexibility of the processor fit Linux, 
-         not force arbitrary and non-workable memory mappings into Linux.
-
-       - You don't want to change KERNELLOAD or KERNELBASE, otherwise the
-         virtual memory and MMU code will get confused.
-       
-         arch/ppc/Makefile:KERNELLOAD = 0xc0000000
-
-         include/asm-ppc/page.h:#define PAGE_OFFSET    0xc0000000
-         include/asm-ppc/page.h:#define KERNELBASE     PAGE_OFFSET
-
-       - RAM is at physical address 0x00000000, and gets mapped to 
-         virtual address 0xC0000000 for the kernel.
-
-
-       Physical addresses used by the Linux kernel:
-       --------------------------------------------
-
-       0x00000000-0x3FFFFFFF   1GB reserved for RAM
-       0xF0000000-0xF001FFFF   128K IMMR  64K used for dual port memory,
-                                 64K for 8260 registers
-
-       
-        Logical addresses used by the Linux kernel:
-       -------------------------------------------
-
-       0xF0000000-0xFFFFFFFF   256M BAT0 (IMMR: dual port RAM, registers)
-       0xE0000000-0xEFFFFFFF   256M BAT1 (I/O space for custom boards)
-       0xC0000000-0xCFFFFFFF   256M BAT2 (RAM)
-       0xD0000000-0xDFFFFFFF   256M BAT3 (if RAM > 256MByte)
-
-
-       EST SBC8260 Linux mapping:
-       --------------------------
-
-       DBAT0, IBAT0, cache inhibited:
-
-                                Chip
-        Memory                  Sel  Use
-        ---------------------   ---  ---------------------------------
-        0xF0000000-0xF001FFFF   n/a  IMMR: dual port RAM, registers
-
-        DBAT1, IBAT1, cache inhibited:
-
index 928a79c..de4063c 100644 (file)
@@ -278,7 +278,7 @@ it with special cases.
         a 64-bit platform.
 
         d) request and get assigned a platform number (see PLATFORM_*
-        constants in include/asm-powerpc/processor.h
+        constants in arch/powerpc/include/asm/processor.h
 
 32-bit embedded kernels:
 
@@ -340,7 +340,7 @@ the block to RAM before passing it to the kernel.
 ---------
 
    The kernel is entered with r3 pointing to an area of memory that is
-   roughly described in include/asm-powerpc/prom.h by the structure
+   roughly described in arch/powerpc/include/asm/prom.h by the structure
    boot_param_header:
 
 struct boot_param_header {
index b35f348..2ea76d9 100644 (file)
@@ -7,6 +7,15 @@ Currently defined compatibles:
 - fsl,cpm2-scc-uart
 - fsl,qe-uart
 
+Modem control lines connected to GPIO controllers are listed in the gpios
+property as described in booting-without-of.txt, section IX.1 in the following
+order:
+
+CTS, RTS, DCD, DSR, DTR, and RI.
+
+The gpios property is optional and can be left out when control lines are
+not used.
+
 Example:
 
        serial@11a00 {
@@ -18,4 +27,6 @@ Example:
                interrupt-parent = <&PIC>;
                fsl,cpm-brg = <1>;
                fsl,cpm-command = <00800000>;
+               gpios = <&gpio_c 15 0
+                        &gpio_d 29 0>;
        };
index df7afe4..9d4e33d 100644 (file)
@@ -133,7 +133,7 @@ error.  Given an arbitrary address, the routine
 pci_get_device_by_addr() will find the pci device associated
 with that address (if any).
 
-The default include/asm-powerpc/io.h macros readb(), inb(), insb(),
+The default arch/powerpc/include/asm/io.h macros readb(), inb(), insb(),
 etc. include a check to see if the i/o read returned all-0xff's.
 If so, these make a call to eeh_dn_check_failure(), which in turn
 asks the firmware if the all-ff's value is the sign of a true EEH
index 0843ed0..28b6ec8 100644 (file)
@@ -390,9 +390,10 @@ rfkill lines are inactive, it must return RFKILL_STATE_SOFT_BLOCKED if its soft
 rfkill input line is active.  Only if none of the rfkill input lines are
 active, will it return RFKILL_STATE_UNBLOCKED.
 
-If it doesn't implement the get_state() hook, it must make sure that its calls
-to rfkill_force_state() are enough to keep the status always up-to-date, and it
-must do a rfkill_force_state() on resume from sleep.
+Since the device has a hardware rfkill line, it IS subject to state changes
+external to rfkill.  Therefore, the driver must make sure that it calls
+rfkill_force_state() to keep the status always up-to-date, and it must do a
+rfkill_force_state() on resume from sleep.
 
 Every time the driver gets a notification from the card that one of its rfkill
 lines changed state (polling might be needed on badly designed cards that don't
@@ -422,13 +423,24 @@ of the hardware is unknown), or read-write (where the hardware can be queried
 about its current state).
 
 The rfkill class will call the get_state hook of a device every time it needs
-to know the *real* current state of the hardware.  This can happen often.
+to know the *real* current state of the hardware.  This can happen often, but
+it does not do any polling, so it is not enough on hardware that is subject
+to state changes outside of the rfkill subsystem.
+
+Therefore, calling rfkill_force_state() when a state change happens is
+mandatory when the device has a hardware rfkill line, or when something else
+like the firmware could cause its state to be changed without going through the
+rfkill class.
 
 Some hardware provides events when its status changes.  In these cases, it is
 best for the driver to not provide a get_state hook, and instead register the
 rfkill class *already* with the correct status, and keep it updated using
 rfkill_force_state() when it gets an event from the hardware.
 
+rfkill_force_state() must be used on the device resume handlers to update the
+rfkill status, should there be any chance of the device status changing during
+the sleep.
+
 There is no provision for a statically-allocated rfkill struct.  You must
 use rfkill_allocate() to allocate one.
 
index bcaf4ab..78a863a 100644 (file)
@@ -226,6 +226,7 @@ sonixj              0c45:6130       Sonix Pccam
 sonixj         0c45:6138       Sn9c120 Mo4000
 sonixj         0c45:613b       Surfer SN-206
 sonixj         0c45:613c       Sonix Pccam168
+sonixj         0c45:6143       Sonix Pccam168
 sunplus                0d64:0303       Sunplus FashionCam DXG
 etoms          102c:6151       Qcam Sangha CIF
 etoms          102c:6251       Qcam xxxxxx VGA
index deedc0d..8223a52 100644 (file)
@@ -502,6 +502,12 @@ L: openezx-devel@lists.openezx.org (subscribers-only)
 W:     http://www.openezx.org/
 S:     Maintained
 
+ARM/FREESCALE IMX / MXC ARM ARCHITECTURE
+P:     Sascha Hauer
+M:     kernel@pengutronix.de
+L:     linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
+S:     Maintained
+
 ARM/GLOMATION GESBC9312SX MACHINE SUPPORT
 P:     Lennert Buytenhek
 M:     kernel@wantstofly.org
@@ -1878,13 +1884,9 @@ W:       http://gigaset307x.sourceforge.net/
 S:     Maintained
 
 HARDWARE MONITORING
-P:     Mark M. Hoffman
-M:     mhoffman@lightlink.com
 L:     lm-sensors@lm-sensors.org
 W:     http://www.lm-sensors.org/
-T:     git lm-sensors.org:/kernel/mhoffman/hwmon-2.6.git testing
-T:     git lm-sensors.org:/kernel/mhoffman/hwmon-2.6.git release
-S:     Maintained
+S:     Orphaned
 
 HARDWARE RANDOM NUMBER GENERATOR CORE
 S:     Orphaned
@@ -3968,7 +3970,7 @@ M:        lethal@linux-sh.org
 L:     linux-sh@vger.kernel.org
 W:     http://www.linux-sh.org
 T:     git kernel.org:/pub/scm/linux/kernel/git/lethal/sh-2.6.git
-S:     Maintained
+S:     Supported
 
 SUN3/3X
 P:     Sam Creasey
@@ -4504,6 +4506,15 @@ M:       kaber@trash.net
 L:     netdev@vger.kernel.org
 S:     Maintained
 
+VOLTAGE AND CURRENT REGULATOR FRAMEWORK
+P:     Liam Girdwood
+M:     lg@opensource.wolfsonmicro.com
+P:     Mark Brown
+M:     broonie@opensource.wolfsonmicro.com
+W:     http://opensource.wolfsonmicro.com/node/15
+T:     git kernel.org/pub/scm/linux/kernel/git/lrg/voltage-2.6.git
+S:     Supported
+
 VT1211 HARDWARE MONITOR DRIVER
 P:     Juerg Haefliger
 M:     juergh@gmail.com
index aa527a4..f3e2065 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 6
 SUBLEVEL = 27
-EXTRAVERSION = -rc1
+EXTRAVERSION = -rc2
 NAME = Rotary Wombat
 
 # *DOCUMENTATION*
@@ -929,10 +929,10 @@ ifneq ($(KBUILD_SRC),)
                echo "  in the '$(srctree)' directory.";\
                /bin/false; \
        fi;
-       $(Q)if [ ! -d include2 ]; then mkdir -p include2; fi;
-       $(Q)if [ -e $(srctree)/include/asm-$(SRCARCH)/system.h ]; then  \
+       $(Q)if [ ! -d include2 ]; then                                  \
+           mkdir -p include2;                                          \
            ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm;     \
-           fi
+       fi
 endif
 
 # prepare2 creates a makefile if using a separate output directory
@@ -1492,7 +1492,7 @@ quiet_cmd_cscope-file = FILELST cscope.files
       cmd_cscope-file = (echo \-k; echo \-q; $(all-sources)) > cscope.files
 
 quiet_cmd_cscope = MAKE    cscope.out
-      cmd_cscope = cscope -b
+      cmd_cscope = cscope -b -f cscope.out
 
 cscope: FORCE
        $(call cmd,cscope-file)
index 257033c..4b8acd2 100644 (file)
@@ -1225,6 +1225,8 @@ source "drivers/dma/Kconfig"
 
 source "drivers/dca/Kconfig"
 
+source "drivers/regulator/Kconfig"
+
 source "drivers/uio/Kconfig"
 
 endmenu
index 95baac4..94462a0 100644 (file)
@@ -112,6 +112,3 @@ $(obj)/font.c: $(FONTC)
 
 $(obj)/vmlinux.lds: $(obj)/vmlinux.lds.in arch/arm/boot/Makefile .config
        @sed "$(SEDFLAGS)" < $< > $@
-
-$(obj)/misc.o: $(obj)/misc.c include/asm/arch/uncompress.h lib/inflate.c
-
index be2b2f3..bf97801 100644 (file)
@@ -170,7 +170,7 @@ CONFIG_MACH_AT91CAP9ADK=y
 # AT91 Board Options
 #
 CONFIG_MTD_AT91_DATAFLASH_CARD=y
-# CONFIG_MTD_NAND_AT91_BUSWIDTH_16 is not set
+# CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16 is not set
 
 #
 # AT91 Feature Selections
@@ -442,7 +442,7 @@ CONFIG_MTD_NAND=y
 # CONFIG_MTD_NAND_MUSEUM_IDS is not set
 CONFIG_MTD_NAND_IDS=y
 # CONFIG_MTD_NAND_DISKONCHIP is not set
-CONFIG_MTD_NAND_AT91=y
+CONFIG_MTD_NAND_ATMEL=y
 # CONFIG_MTD_NAND_NANDSIM is not set
 # CONFIG_MTD_NAND_PLATFORM is not set
 # CONFIG_MTD_ALAUDA is not set
index 2011adf..38e6a0a 100644 (file)
@@ -176,7 +176,7 @@ CONFIG_MACH_AT91SAM9260EK=y
 # AT91 Board Options
 #
 # CONFIG_MTD_AT91_DATAFLASH_CARD is not set
-# CONFIG_MTD_NAND_AT91_BUSWIDTH_16 is not set
+# CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16 is not set
 
 #
 # AT91 Feature Selections
index 4049768..93b779f 100644 (file)
@@ -169,7 +169,7 @@ CONFIG_MACH_AT91SAM9261EK=y
 # AT91 Board Options
 #
 # CONFIG_MTD_AT91_DATAFLASH_CARD is not set
-# CONFIG_MTD_NAND_AT91_BUSWIDTH_16 is not set
+# CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16 is not set
 
 #
 # AT91 Feature Selections
@@ -433,7 +433,7 @@ CONFIG_MTD_NAND=y
 # CONFIG_MTD_NAND_MUSEUM_IDS is not set
 CONFIG_MTD_NAND_IDS=y
 # CONFIG_MTD_NAND_DISKONCHIP is not set
-CONFIG_MTD_NAND_AT91=y
+CONFIG_MTD_NAND_ATMEL=y
 # CONFIG_MTD_NAND_NANDSIM is not set
 # CONFIG_MTD_NAND_PLATFORM is not set
 # CONFIG_MTD_ALAUDA is not set
index fa1c5ae..a7ddd94 100644 (file)
@@ -169,7 +169,7 @@ CONFIG_MACH_AT91SAM9263EK=y
 # AT91 Board Options
 #
 CONFIG_MTD_AT91_DATAFLASH_CARD=y
-# CONFIG_MTD_NAND_AT91_BUSWIDTH_16 is not set
+# CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16 is not set
 
 #
 # AT91 Feature Selections
@@ -428,7 +428,7 @@ CONFIG_MTD_NAND=y
 # CONFIG_MTD_NAND_MUSEUM_IDS is not set
 CONFIG_MTD_NAND_IDS=y
 # CONFIG_MTD_NAND_DISKONCHIP is not set
-CONFIG_MTD_NAND_AT91=y
+CONFIG_MTD_NAND_ATMEL=y
 # CONFIG_MTD_NAND_NANDSIM is not set
 # CONFIG_MTD_NAND_PLATFORM is not set
 # CONFIG_MTD_ALAUDA is not set
index c068638..df0d6ee 100644 (file)
@@ -168,7 +168,7 @@ CONFIG_MACH_AT91SAM9G20EK=y
 # AT91 Board Options
 #
 # CONFIG_MTD_AT91_DATAFLASH_CARD is not set
-# CONFIG_MTD_NAND_AT91_BUSWIDTH_16 is not set
+# CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16 is not set
 
 #
 # AT91 Feature Selections
@@ -442,10 +442,10 @@ CONFIG_MTD_NAND=y
 # CONFIG_MTD_NAND_MUSEUM_IDS is not set
 CONFIG_MTD_NAND_IDS=y
 # CONFIG_MTD_NAND_DISKONCHIP is not set
-CONFIG_MTD_NAND_AT91=y
-CONFIG_MTD_NAND_AT91_ECC_SOFT=y
-# CONFIG_MTD_NAND_AT91_ECC_HW is not set
-# CONFIG_MTD_NAND_AT91_ECC_NONE is not set
+CONFIG_MTD_NAND_ATMEL=y
+CONFIG_MTD_NAND_ATMEL_ECC_SOFT=y
+# CONFIG_MTD_NAND_ATMEL_ECC_HW is not set
+# CONFIG_MTD_NAND_ATMEL_ECC_NONE is not set
 # CONFIG_MTD_NAND_NANDSIM is not set
 # CONFIG_MTD_NAND_PLATFORM is not set
 # CONFIG_MTD_ALAUDA is not set
index d8ec5f9..1c76642 100644 (file)
@@ -392,7 +392,7 @@ CONFIG_MTD_NAND=y
 # CONFIG_MTD_NAND_MUSEUM_IDS is not set
 CONFIG_MTD_NAND_IDS=y
 # CONFIG_MTD_NAND_DISKONCHIP is not set
-CONFIG_MTD_NAND_AT91=y
+CONFIG_MTD_NAND_ATMEL=y
 # CONFIG_MTD_NAND_NANDSIM is not set
 # CONFIG_MTD_NAND_PLATFORM is not set
 # CONFIG_MTD_ONENAND is not set
index f3cd4a9..f945105 100644 (file)
@@ -466,10 +466,10 @@ CONFIG_MTD_NAND_VERIFY_WRITE=y
 # CONFIG_MTD_NAND_MUSEUM_IDS is not set
 CONFIG_MTD_NAND_IDS=y
 # CONFIG_MTD_NAND_DISKONCHIP is not set
-CONFIG_MTD_NAND_AT91=y
-# CONFIG_MTD_NAND_AT91_ECC_SOFT is not set
-CONFIG_MTD_NAND_AT91_ECC_HW=y
-# CONFIG_MTD_NAND_AT91_ECC_NONE is not set
+CONFIG_MTD_NAND_ATMEL=y
+# CONFIG_MTD_NAND_ATMEL_ECC_SOFT is not set
+CONFIG_MTD_NAND_ATMEL_ECC_HW=y
+# CONFIG_MTD_NAND_ATMEL_ECC_NONE is not set
 # CONFIG_MTD_NAND_NANDSIM is not set
 # CONFIG_MTD_NAND_PLATFORM is not set
 # CONFIG_MTD_ALAUDA is not set
index ef903be..5cbd815 100644 (file)
@@ -458,10 +458,10 @@ CONFIG_MTD_NAND=y
 # CONFIG_MTD_NAND_MUSEUM_IDS is not set
 CONFIG_MTD_NAND_IDS=y
 # CONFIG_MTD_NAND_DISKONCHIP is not set
-CONFIG_MTD_NAND_AT91=y
-CONFIG_MTD_NAND_AT91_ECC_SOFT=y
-# CONFIG_MTD_NAND_AT91_ECC_HW is not set
-# CONFIG_MTD_NAND_AT91_ECC_NONE is not set
+CONFIG_MTD_NAND_ATMEL=y
+CONFIG_MTD_NAND_ATMEL_ECC_SOFT=y
+# CONFIG_MTD_NAND_ATMEL_ECC_HW is not set
+# CONFIG_MTD_NAND_ATMEL_ECC_NONE is not set
 # CONFIG_MTD_NAND_NANDSIM is not set
 # CONFIG_MTD_NAND_PLATFORM is not set
 # CONFIG_MTD_ALAUDA is not set
index 8688362..1174e27 100644 (file)
@@ -429,7 +429,7 @@ CONFIG_MTD_NAND=y
 # CONFIG_MTD_NAND_MUSEUM_IDS is not set
 CONFIG_MTD_NAND_IDS=y
 # CONFIG_MTD_NAND_DISKONCHIP is not set
-CONFIG_MTD_NAND_AT91=y
+CONFIG_MTD_NAND_ATMEL=y
 # CONFIG_MTD_NAND_NANDSIM is not set
 CONFIG_MTD_NAND_PLATFORM=y
 # CONFIG_MTD_ONENAND is not set
index 3680bd2..fcb4aaa 100644 (file)
@@ -458,10 +458,10 @@ CONFIG_MTD_NAND=y
 # CONFIG_MTD_NAND_MUSEUM_IDS is not set
 CONFIG_MTD_NAND_IDS=y
 # CONFIG_MTD_NAND_DISKONCHIP is not set
-CONFIG_MTD_NAND_AT91=y
-CONFIG_MTD_NAND_AT91_ECC_SOFT=y
-# CONFIG_MTD_NAND_AT91_ECC_HW is not set
-# CONFIG_MTD_NAND_AT91_ECC_NONE is not set
+CONFIG_MTD_NAND_ATMEL=y
+CONFIG_MTD_NAND_ATMEL_ECC_SOFT=y
+# CONFIG_MTD_NAND_ATMEL_ECC_HW is not set
+# CONFIG_MTD_NAND_ATMEL_ECC_NONE is not set
 # CONFIG_MTD_NAND_NANDSIM is not set
 # CONFIG_MTD_NAND_PLATFORM is not set
 # CONFIG_MTD_ALAUDA is not set
index 48d455b..b786e04 100644 (file)
@@ -450,10 +450,10 @@ CONFIG_MTD_NAND=y
 # CONFIG_MTD_NAND_MUSEUM_IDS is not set
 CONFIG_MTD_NAND_IDS=y
 # CONFIG_MTD_NAND_DISKONCHIP is not set
-CONFIG_MTD_NAND_AT91=y
-CONFIG_MTD_NAND_AT91_ECC_SOFT=y
-# CONFIG_MTD_NAND_AT91_ECC_HW is not set
-# CONFIG_MTD_NAND_AT91_ECC_NONE is not set
+CONFIG_MTD_NAND_ATMEL=y
+CONFIG_MTD_NAND_ATMEL_ECC_SOFT=y
+# CONFIG_MTD_NAND_ATMEL_ECC_HW is not set
+# CONFIG_MTD_NAND_ATMEL_ECC_NONE is not set
 # CONFIG_MTD_NAND_NANDSIM is not set
 # CONFIG_MTD_NAND_PLATFORM is not set
 # CONFIG_MTD_ALAUDA is not set
index 26de37f..a9f41c2 100644 (file)
@@ -421,7 +421,7 @@ CONFIG_MTD_NAND=y
 # CONFIG_MTD_NAND_ECC_SMC is not set
 # CONFIG_MTD_NAND_MUSEUM_IDS is not set
 CONFIG_MTD_NAND_IDS=y
-CONFIG_MTD_NAND_AT91=y
+CONFIG_MTD_NAND_ATMEL=y
 # CONFIG_MTD_NAND_NANDSIM is not set
 CONFIG_MTD_NAND_PLATFORM=y
 # CONFIG_MTD_ALAUDA is not set
similarity index 98%
rename from include/asm-arm/assembler.h
rename to arch/arm/include/asm/assembler.h
index 911393b..6116e48 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/assembler.h
+ *  arch/arm/include/asm/assembler.h
  *
  *  Copyright (C) 1996-2000 Russell King
  *
similarity index 99%
rename from include/asm-arm/atomic.h
rename to arch/arm/include/asm/atomic.h
index 3b59f94..325f881 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/atomic.h
+ *  arch/arm/include/asm/atomic.h
  *
  *  Copyright (C) 1996 Russell King.
  *  Copyright (C) 2002 Deep Blue Solutions Ltd.
similarity index 93%
rename from include/asm-arm/bugs.h
rename to arch/arm/include/asm/bugs.h
index ca54eb0..a97f1ea 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/bugs.h
+ *  arch/arm/include/asm/bugs.h
  *
  *  Copyright (C) 1995-2003 Russell King
  *
similarity index 97%
rename from include/asm-arm/byteorder.h
rename to arch/arm/include/asm/byteorder.h
index e6f7fcd..4fbfb22 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/byteorder.h
+ *  arch/arm/include/asm/byteorder.h
  *
  * ARM Endian-ness.  In little endian mode, the data bus is connected such
  * that byte accesses appear as:
similarity index 80%
rename from include/asm-arm/cache.h
rename to arch/arm/include/asm/cache.h
index 31332c8..cb7a9e9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/cache.h
+ *  arch/arm/include/asm/cache.h
  */
 #ifndef __ASMARM_CACHE_H
 #define __ASMARM_CACHE_H
similarity index 99%
rename from include/asm-arm/cacheflush.h
rename to arch/arm/include/asm/cacheflush.h
index e68a1cb..9073d9c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/cacheflush.h
+ *  arch/arm/include/asm/cacheflush.h
  *
  *  Copyright (C) 1999-2002 Russell King
  *
similarity index 98%
rename from include/asm-arm/checksum.h
rename to arch/arm/include/asm/checksum.h
index eaa0efd..6dcc164 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/checksum.h
+ *  arch/arm/include/asm/checksum.h
  *
  * IP checksum routines
  *
similarity index 97%
rename from include/asm-arm/cpu-multi32.h
rename to arch/arm/include/asm/cpu-multi32.h
index 3479de9..e2b5b0b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/cpu-multi32.h
+ *  arch/arm/include/asm/cpu-multi32.h
  *
  *  Copyright (C) 2000 Russell King
  *
similarity index 97%
rename from include/asm-arm/cpu-single.h
rename to arch/arm/include/asm/cpu-single.h
index 0b120ee..f073a6d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/cpu-single.h
+ *  arch/arm/include/asm/cpu-single.h
  *
  *  Copyright (C) 2000 Russell King
  *
similarity index 93%
rename from include/asm-arm/cpu.h
rename to arch/arm/include/asm/cpu.h
index 715426b..634b2d7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/cpu.h
+ *  arch/arm/include/asm/cpu.h
  *
  *  Copyright (C) 2004-2005 ARM Ltd.
  *
similarity index 98%
rename from include/asm-arm/domain.h
rename to arch/arm/include/asm/domain.h
index 3c12a76..cc7ef40 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/domain.h
+ *  arch/arm/include/asm/domain.h
  *
  *  Copyright (C) 1999 Russell King.
  *
similarity index 99%
rename from include/asm-arm/ecard.h
rename to arch/arm/include/asm/ecard.h
index 5e22881..29f2610 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * linux/include/asm-arm/ecard.h
+ * arch/arm/include/asm/ecard.h
  *
  * definitions for expansion cards
  *
similarity index 96%
rename from include/asm-arm/fiq.h
rename to arch/arm/include/asm/fiq.h
index a3bad09..2242ce2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/fiq.h
+ *  arch/arm/include/asm/fiq.h
  *
  * Support for FIQ on ARM architectures.
  * Written by Philip Blundell <philb@gnu.org>, 1998
similarity index 90%
rename from include/asm-arm/flat.h
rename to arch/arm/include/asm/flat.h
index 9918aa4..1d77e51 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * include/asm-arm/flat.h -- uClinux flat-format executables
+ * arch/arm/include/asm/flat.h -- uClinux flat-format executables
  */
 
 #ifndef __ARM_FLAT_H__
similarity index 99%
rename from include/asm-arm/floppy.h
rename to arch/arm/include/asm/floppy.h
index 41a5e9d..dce20c2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/floppy.h
+ *  arch/arm/include/asm/floppy.h
  *
  *  Copyright (C) 1996-2000 Russell King
  *
similarity index 97%
rename from include/asm-arm/fpstate.h
rename to arch/arm/include/asm/fpstate.h
index 392eb53..ee5e03e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/fpstate.h
+ *  arch/arm/include/asm/fpstate.h
  *
  *  Copyright (C) 1995 Russell King
  *
similarity index 99%
rename from include/asm-arm/glue.h
rename to arch/arm/include/asm/glue.h
index a97a182..a0e39d5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/glue.h
+ *  arch/arm/include/asm/glue.h
  *
  *  Copyright (C) 1997-1999 Russell King
  *  Copyright (C) 2000-2002 Deep Blue Solutions Ltd.
similarity index 90%
rename from include/asm-arm/hardware.h
rename to arch/arm/include/asm/hardware.h
index 1fd1a5b..eb3b3ab 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/hardware.h
+ *  arch/arm/include/asm/hardware.h
  *
  *  Copyright (C) 1996 Russell King
  *
similarity index 97%
rename from include/asm-arm/hardware/cache-l2x0.h
rename to arch/arm/include/asm/hardware/cache-l2x0.h
index 54029a7..64f2252 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * include/asm-arm/hardware/cache-l2x0.h
+ * arch/arm/include/asm/hardware/cache-l2x0.h
  *
  * Copyright (C) 2007 ARM Limited
  *
similarity index 99%
rename from include/asm-arm/hardware/clps7111.h
rename to arch/arm/include/asm/hardware/clps7111.h
index 8d3228d..4447722 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/hardware/clps7111.h
+ *  arch/arm/include/asm/hardware/clps7111.h
  *
  *  This file contains the hardware definitions of the CLPS7111 internal
  *  registers.
similarity index 97%
rename from include/asm-arm/hardware/cs89712.h
rename to arch/arm/include/asm/hardware/cs89712.h
index ad99a3e..f756269 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/hardware/cs89712.h
+ *  arch/arm/include/asm/hardware/cs89712.h
  *
  *  This file contains the hardware definitions of the CS89712
  *  additional internal registers.
similarity index 93%
rename from include/asm-arm/hardware/debug-8250.S
rename to arch/arm/include/asm/hardware/debug-8250.S
index 07c97fb..22c6892 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * linux/include/asm-arm/hardware/debug-8250.S
+ * arch/arm/include/asm/hardware/debug-8250.S
  *
  *  Copyright (C) 1994-1999 Russell King
  *
similarity index 93%
rename from include/asm-arm/hardware/debug-pl01x.S
rename to arch/arm/include/asm/hardware/debug-pl01x.S
index 23c541a..f9fd083 100644 (file)
@@ -1,4 +1,4 @@
-/* linux/include/asm-arm/hardware/debug-pl01x.S
+/* arch/arm/include/asm/hardware/debug-pl01x.S
  *
  * Debugging macro include header
  *
similarity index 99%
rename from include/asm-arm/hardware/dec21285.h
rename to arch/arm/include/asm/hardware/dec21285.h
index 546f707..7068a1c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/hardware/dec21285.h
+ *  arch/arm/include/asm/hardware/dec21285.h
  *
  *  Copyright (C) 1998 Russell King
  *
@@ -1,5 +1,5 @@
 /*
- * include/asm-arm/hardware/entry-macro-iomd.S
+ * arch/arm/include/asm/hardware/entry-macro-iomd.S
  *
  * Low-level IRQ helper macros for IOC/IOMD based platforms
  *
similarity index 96%
rename from include/asm-arm/hardware/ep7211.h
rename to arch/arm/include/asm/hardware/ep7211.h
index 017aa68..654d5f6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/hardware/ep7211.h
+ *  arch/arm/include/asm/hardware/ep7211.h
  *
  *  This file contains the hardware definitions of the EP7211 internal
  *  registers.
similarity index 98%
rename from include/asm-arm/hardware/ep7212.h
rename to arch/arm/include/asm/hardware/ep7212.h
index 0e952e7..3b43bbe 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/hardware/ep7212.h
+ *  arch/arm/include/asm/hardware/ep7212.h
  *
  *  This file contains the hardware definitions of the EP7212 internal
  *  registers.
similarity index 96%
rename from include/asm-arm/hardware/gic.h
rename to arch/arm/include/asm/hardware/gic.h
index 966e428..4924914 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/hardware/gic.h
+ *  arch/arm/include/asm/hardware/gic.h
  *
  *  Copyright (C) 2002 ARM Limited, All Rights Reserved.
  *
similarity index 96%
rename from include/asm-arm/hardware/icst307.h
rename to arch/arm/include/asm/hardware/icst307.h
index ff8618a..554f128 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/hardware/icst307.h
+ *  arch/arm/include/asm/hardware/icst307.h
  *
  *  Copyright (C) 2003 Deep Blue Solutions, Ltd, All Rights Reserved.
  *
similarity index 96%
rename from include/asm-arm/hardware/icst525.h
rename to arch/arm/include/asm/hardware/icst525.h
index edd5a57..58f0dc4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/hardware/icst525.h
+ *  arch/arm/include/asm/hardware/icst525.h
  *
  *  Copyright (C) 2003 Deep Blue Solutions, Ltd, All Rights Reserved.
  *
similarity index 97%
rename from include/asm-arm/hardware/ioc.h
rename to arch/arm/include/asm/hardware/ioc.h
index b3b46ef..1f6b801 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/hardware/ioc.h
+ *  arch/arm/include/asm/hardware/ioc.h
  *
  *  Copyright (C) Russell King
  *
similarity index 99%
rename from include/asm-arm/hardware/iomd.h
rename to arch/arm/include/asm/hardware/iomd.h
index 396e55a..9c5afbd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/hardware/iomd.h
+ *  arch/arm/include/asm/hardware/iomd.h
  *
  *  Copyright (C) 1999 Russell King
  *
similarity index 97%
rename from include/asm-arm/hardware/iop3xx-gpio.h
rename to arch/arm/include/asm/hardware/iop3xx-gpio.h
index 0c9331f..222e74b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * linux/include/asm-arm/hardware/iop3xx-gpio.h
+ * arch/arm/include/asm/hardware/iop3xx-gpio.h
  *
  * IOP3xx GPIO wrappers
  *
similarity index 99%
rename from include/asm-arm/hardware/iop3xx.h
rename to arch/arm/include/asm/hardware/iop3xx.h
index 18f6937..4b8e7f5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * include/asm-arm/hardware/iop3xx.h
+ * arch/arm/include/asm/hardware/iop3xx.h
  *
  * Intel IOP32X and IOP33X register definitions
  *
similarity index 99%
rename from include/asm-arm/hardware/locomo.h
rename to arch/arm/include/asm/hardware/locomo.h
index fb0645d..954b1be 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * linux/include/asm-arm/hardware/locomo.h
+ * arch/arm/include/asm/hardware/locomo.h
  *
  * This file contains the definitions for the LoCoMo G/A Chip
  *
similarity index 93%
rename from include/asm-arm/hardware/memc.h
rename to arch/arm/include/asm/hardware/memc.h
index 8aef5aa..42ba7c1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/hardware/memc.h
+ *  arch/arm/include/asm/hardware/memc.h
  *
  *  Copyright (C) Russell King.
  *
similarity index 99%
rename from include/asm-arm/hardware/pci_v3.h
rename to arch/arm/include/asm/hardware/pci_v3.h
index 4d497bd..2811c7e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/hardware/pci_v3.h
+ *  arch/arm/include/asm/hardware/pci_v3.h
  *
  *  Internal header file PCI V3 chip
  *
similarity index 99%
rename from include/asm-arm/hardware/sa1111.h
rename to arch/arm/include/asm/hardware/sa1111.h
index 61b1d05..6cf98d4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * linux/include/asm-arm/hardware/sa1111.h
+ * arch/arm/include/asm/hardware/sa1111.h
  *
  * Copyright (C) 2000 John G Dorsey <john+@cs.cmu.edu>
  *
similarity index 97%
rename from include/asm-arm/hardware/vic.h
rename to arch/arm/include/asm/hardware/vic.h
index ed9ca37..263f2c3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/hardware/vic.h
+ *  arch/arm/include/asm/hardware/vic.h
  *
  *  Copyright (c) ARM Limited 2003.  All rights reserved.
  *
similarity index 93%
rename from include/asm-arm/ide.h
rename to arch/arm/include/asm/ide.h
index a48019f..b507ce8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/ide.h
+ *  arch/arm/include/asm/ide.h
  *
  *  Copyright (C) 1994-1996  Linus Torvalds & authors
  */
similarity index 99%
rename from include/asm-arm/io.h
rename to arch/arm/include/asm/io.h
index eebe56e..ffe07c0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/io.h
+ *  arch/arm/include/asm/io.h
  *
  *  Copyright (C) 1996-2000 Russell King
  *
similarity index 98%
rename from include/asm-arm/kprobes.h
rename to arch/arm/include/asm/kprobes.h
index b1a3787..a5d0d99 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * include/asm-arm/kprobes.h
+ * arch/arm/include/asm/kprobes.h
  *
  * Copyright (C) 2006, 2007 Motorola Inc.
  *
similarity index 96%
rename from include/asm-arm/leds.h
rename to arch/arm/include/asm/leds.h
index 12290ea..c545739 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/leds.h
+ *  arch/arm/include/asm/leds.h
  *
  *  Copyright (C) 1998 Russell King
  *
similarity index 99%
rename from include/asm-arm/locks.h
rename to arch/arm/include/asm/locks.h
index 852220e..ef4c897 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/locks.h
+ *  arch/arm/include/asm/locks.h
  *
  *  Copyright (C) 2000 Russell King
  *
similarity index 97%
rename from include/asm-arm/mach/arch.h
rename to arch/arm/include/asm/mach/arch.h
index bcc8aed..c59842d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/mach/arch.h
+ *  arch/arm/include/asm/mach/arch.h
  *
  *  Copyright (C) 2000 Russell King
  *
similarity index 97%
rename from include/asm-arm/mach/dma.h
rename to arch/arm/include/asm/mach/dma.h
index e7c4a20..fc7278e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/mach/dma.h
+ *  arch/arm/include/asm/mach/dma.h
  *
  *  Copyright (C) 1998-2000 Russell King
  *
similarity index 96%
rename from include/asm-arm/mach/flash.h
rename to arch/arm/include/asm/mach/flash.h
index 05b029e..4ca69fe 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/mach/flash.h
+ *  arch/arm/include/asm/mach/flash.h
  *
  *  Copyright (C) 2003 Russell King, All Rights Reserved.
  *
similarity index 93%
rename from include/asm-arm/mach/irda.h
rename to arch/arm/include/asm/mach/irda.h
index 58984d9..38f77b5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/mach/irda.h
+ *  arch/arm/include/asm/mach/irda.h
  *
  *  Copyright (C) 2004 Russell King.
  *
similarity index 96%
rename from include/asm-arm/mach/irq.h
rename to arch/arm/include/asm/mach/irq.h
index eb0bfba..c57b52c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/mach/irq.h
+ *  arch/arm/include/asm/mach/irq.h
  *
  *  Copyright (C) 1995-2000 Russell King.
  *
similarity index 96%
rename from include/asm-arm/mach/map.h
rename to arch/arm/include/asm/mach/map.h
index 7ef3c83..06f583b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/map.h
+ *  arch/arm/include/asm/map.h
  *
  *  Copyright (C) 1999-2000 Russell King
  *
similarity index 88%
rename from include/asm-arm/mach/mmc.h
rename to arch/arm/include/asm/mach/mmc.h
index eb91145..4da332b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/mach/mmc.h
+ *  arch/arm/include/asm/mach/mmc.h
  */
 #ifndef ASMARM_MACH_MMC_H
 #define ASMARM_MACH_MMC_H
similarity index 98%
rename from include/asm-arm/mach/pci.h
rename to arch/arm/include/asm/mach/pci.h
index 9d4f6b5..32da1ae 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/mach/pci.h
+ *  arch/arm/include/asm/mach/pci.h
  *
  *  Copyright (C) 2000 Russell King
  *
similarity index 94%
rename from include/asm-arm/mach/serial_at91.h
rename to arch/arm/include/asm/mach/serial_at91.h
index 55b317a..ea6d063 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/mach/serial_at91.h
+ *  arch/arm/include/asm/mach/serial_at91.h
  *
  *  Based on serial_sa1100.h  by Nicolas Pitre
  *
similarity index 86%
rename from include/asm-arm/mach/serial_sa1100.h
rename to arch/arm/include/asm/mach/serial_sa1100.h
index 20c22bb..d09064b 100644 (file)
@@ -1,9 +1,9 @@
 /*
- *  linux/include/asm-arm/mach/serial_sa1100.h
+ *  arch/arm/include/asm/mach/serial_sa1100.h
  *
  *  Author: Nicolas Pitre
  *
- * Moved to include/asm-arm/mach and changed lots, Russell King
+ * Moved and changed lots, Russell King
  *
  * Low level machine dependent UART functions.
  */
similarity index 97%
rename from include/asm-arm/mach/time.h
rename to arch/arm/include/asm/mach/time.h
index 2fd36ea..b2cc1fc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * linux/include/asm-arm/mach/time.h
+ * arch/arm/include/asm/mach/time.h
  *
  * Copyright (C) 2004 MontaVista Software, Inc.
  *
similarity index 95%
rename from include/asm-arm/mach/udc_pxa2xx.h
rename to arch/arm/include/asm/mach/udc_pxa2xx.h
index 9e5ed7c..270902c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * linux/include/asm-arm/mach/udc_pxa2xx.h
+ * arch/arm/include/asm/mach/udc_pxa2xx.h
  *
  * This supports machine-specific differences in how the PXA2xx
  * USB Device Controller (UDC) is wired.
similarity index 99%
rename from include/asm-arm/memory.h
rename to arch/arm/include/asm/memory.h
index 9ba4d71..9206922 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/memory.h
+ *  arch/arm/include/asm/memory.h
  *
  *  Copyright (C) 2000-2002 Russell King
  *  modification for nommu, Hyok S. Choi, 2004
similarity index 98%
rename from include/asm-arm/mmu_context.h
rename to arch/arm/include/asm/mmu_context.h
index 91b9dfd..a301e44 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/mmu_context.h
+ *  arch/arm/include/asm/mmu_context.h
  *
  *  Copyright (C) 1996 Russell King.
  *
similarity index 94%
rename from include/asm-arm/mmzone.h
rename to arch/arm/include/asm/mmzone.h
index b87de15..f2fbb50 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/mmzone.h
+ *  arch/arm/include/asm/mmzone.h
  *
  *  1999-12-29 Nicolas Pitre           Created
  *
similarity index 98%
rename from include/asm-arm/mutex.h
rename to arch/arm/include/asm/mutex.h
index 020bd98..93226cf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * include/asm-arm/mutex.h
+ * arch/arm/include/asm/mutex.h
  *
  * ARM optimized mutex locking primitives
  *
similarity index 96%
rename from include/asm-arm/page-nommu.h
rename to arch/arm/include/asm/page-nommu.h
index ea1cde8..3574c0d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/page-nommu.h
+ *  arch/arm/include/asm/page-nommu.h
  *
  *  Copyright (C) 2004 Hyok S. Choi
  *
similarity index 99%
rename from include/asm-arm/page.h
rename to arch/arm/include/asm/page.h
index 7c5fc55..cf2e268 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/page.h
+ *  arch/arm/include/asm/page.h
  *
  *  Copyright (C) 1995-2003 Russell King
  *
similarity index 95%
rename from include/asm-arm/param.h
rename to arch/arm/include/asm/param.h
index 1580646..8b24bf9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/param.h
+ *  arch/arm/include/asm/param.h
  *
  *  Copyright (C) 1995-1999 Russell King
  *
similarity index 86%
rename from include/asm-arm/parport.h
rename to arch/arm/include/asm/parport.h
index f2f90c7..26e94b0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/parport.h: ARM-specific parport initialisation
+ *  arch/arm/include/asm/parport.h: ARM-specific parport initialisation
  *
  *  Copyright (C) 1999, 2000  Tim Waugh <tim@cyberelk.demon.co.uk>
  *
similarity index 98%
rename from include/asm-arm/pgalloc.h
rename to arch/arm/include/asm/pgalloc.h
index 163b030..3dcd64b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/pgalloc.h
+ *  arch/arm/include/asm/pgalloc.h
  *
  *  Copyright (C) 2000-2001 Russell King
  *
similarity index 98%
rename from include/asm-arm/pgtable-hwdef.h
rename to arch/arm/include/asm/pgtable-hwdef.h
index f3b5120..fd1521d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/pgtable-hwdef.h
+ *  arch/arm/include/asm/pgtable-hwdef.h
  *
  *  Copyright (C) 1995-2002 Russell King
  *
similarity index 98%
rename from include/asm-arm/pgtable-nommu.h
rename to arch/arm/include/asm/pgtable-nommu.h
index 386fcc1..b011f2e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/pgtable-nommu.h
+ *  arch/arm/include/asm/pgtable-nommu.h
  *
  *  Copyright (C) 1995-2002 Russell King
  *  Copyright (C) 2004  Hyok S. Choi
similarity index 99%
rename from include/asm-arm/pgtable.h
rename to arch/arm/include/asm/pgtable.h
index 5571c13..8ab060a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/pgtable.h
+ *  arch/arm/include/asm/pgtable.h
  *
  *  Copyright (C) 1995-2002 Russell King
  *
similarity index 98%
rename from include/asm-arm/posix_types.h
rename to arch/arm/include/asm/posix_types.h
index c37379d..2446d23 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/posix_types.h
+ *  arch/arm/include/asm/posix_types.h
  *
  *  Copyright (C) 1996-1998 Russell King.
  *
similarity index 99%
rename from include/asm-arm/proc-fns.h
rename to arch/arm/include/asm/proc-fns.h
index 75ec760..db80203 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/proc-fns.h
+ *  arch/arm/include/asm/proc-fns.h
  *
  *  Copyright (C) 1997-1999 Russell King
  *  Copyright (C) 2000 Deep Blue Solutions Ltd
similarity index 98%
rename from include/asm-arm/processor.h
rename to arch/arm/include/asm/processor.h
index bd8029e..b01d5e7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/processor.h
+ *  arch/arm/include/asm/processor.h
  *
  *  Copyright (C) 1995-1999 Russell King
  *
similarity index 97%
rename from include/asm-arm/procinfo.h
rename to arch/arm/include/asm/procinfo.h
index 4d3c685..ca52e58 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/procinfo.h
+ *  arch/arm/include/asm/procinfo.h
  *
  *  Copyright (C) 1996-1999 Russell King
  *
similarity index 99%
rename from include/asm-arm/ptrace.h
rename to arch/arm/include/asm/ptrace.h
index 8382b75..b415c0e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/ptrace.h
+ *  arch/arm/include/asm/ptrace.h
  *
  *  Copyright (C) 1996-2003 Russell King
  *
similarity index 91%
rename from include/asm-arm/serial.h
rename to arch/arm/include/asm/serial.h
index 015b262..ebb0490 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/serial.h
+ *  arch/arm/include/asm/serial.h
  *
  *  Copyright (C) 1996 Russell King.
  *
similarity index 97%
rename from include/asm-arm/smp.h
rename to arch/arm/include/asm/smp.h
index 7fffa24..cc12a52 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/smp.h
+ *  arch/arm/include/asm/smp.h
  *
  *  Copyright (C) 2004-2005 ARM Ltd.
  *
@@ -17,7 +17,7 @@
 #include <asm/arch/smp.h>
 
 #ifndef CONFIG_SMP
-# error "<asm-arm/smp.h> included in non-SMP build"
+# error "<asm/smp.h> included in non-SMP build"
 #endif
 
 #define raw_smp_processor_id() (current_thread_info()->cpu)
similarity index 88%
rename from include/asm-arm/therm.h
rename to arch/arm/include/asm/therm.h
index e51c923..f002f01 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * linux/include/asm-arm/therm.h: Definitions for Dallas Semiconductor
+ * arch/arm/include/asm/therm.h: Definitions for Dallas Semiconductor
  *  DS1620 thermometer driver (as used in the Rebel.com NetWinder)
  */
 #ifndef __ASM_THERM_H
similarity index 97%
rename from include/asm-arm/thread_info.h
rename to arch/arm/include/asm/thread_info.h
index d4be2d6..e56fa48 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/thread_info.h
+ *  arch/arm/include/asm/thread_info.h
  *
  *  Copyright (C) 2002 Russell King.
  *
@@ -117,7 +117,7 @@ extern void iwmmxt_task_switch(struct thread_info *);
 
 /*
  * We use bit 30 of the preempt_count to indicate that kernel
- * preemption is occurring.  See include/asm-arm/hardirq.h.
+ * preemption is occurring.  See <asm/hardirq.h>.
  */
 #define PREEMPT_ACTIVE 0x40000000
 
similarity index 96%
rename from include/asm-arm/thread_notify.h
rename to arch/arm/include/asm/thread_notify.h
index 8866e52..f27379d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/thread_notify.h
+ *  arch/arm/include/asm/thread_notify.h
  *
  *  Copyright (C) 2006 Russell King.
  *
similarity index 93%
rename from include/asm-arm/timex.h
rename to arch/arm/include/asm/timex.h
index 7b8d4cb..e50e292 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/timex.h
+ *  arch/arm/include/asm/timex.h
  *
  *  Copyright (C) 1997,1998 Russell King
  *
similarity index 98%
rename from include/asm-arm/tlb.h
rename to arch/arm/include/asm/tlb.h
index 36bd402..857f1df 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/tlb.h
+ *  arch/arm/include/asm/tlb.h
  *
  *  Copyright (C) 2002 Russell King
  *
similarity index 99%
rename from include/asm-arm/tlbflush.h
rename to arch/arm/include/asm/tlbflush.h
index 909656c..0d0d40f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/tlbflush.h
+ *  arch/arm/include/asm/tlbflush.h
  *
  *  Copyright (C) 1999-2003 Russell King
  *
similarity index 99%
rename from include/asm-arm/uaccess.h
rename to arch/arm/include/asm/uaccess.h
index 4c1a3fa..d0f51ff 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/uaccess.h
+ *  arch/arm/include/asm/uaccess.h
  *
  * 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
similarity index 99%
rename from include/asm-arm/unistd.h
rename to arch/arm/include/asm/unistd.h
index 7c57008..f95fbb2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/unistd.h
+ *  arch/arm/include/asm/unistd.h
  *
  *  Copyright (C) 2001-2005 Russell King
  *
similarity index 98%
rename from include/asm-arm/vfp.h
rename to arch/arm/include/asm/vfp.h
index 5f9a2cb..f4ab34f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * linux/include/asm-arm/vfp.h
+ * arch/arm/include/asm/vfp.h
  *
  * VFP register definitions.
  * First, the standard VFP set.
similarity index 97%
rename from include/asm-arm/vfpmacros.h
rename to arch/arm/include/asm/vfpmacros.h
index cccb389..422f3cc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * linux/include/asm-arm/vfpmacros.h
+ * arch/arm/include/asm/vfpmacros.h
  *
  * Assembler-only file containing VFP macros and register definitions.
  */
similarity index 99%
rename from include/asm-arm/xor.h
rename to arch/arm/include/asm/xor.h
index e7c4cf5..7604673 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/xor.h
+ *  arch/arm/include/asm/xor.h
  *
  *  Copyright (C) 2001 Russell King
  *
index 7e9c00a..1c3c6ea 100644 (file)
@@ -181,7 +181,7 @@ ENTRY(lookup_processor_type)
        ldmfd   sp!, {r4 - r7, r9, pc}
 
 /*
- * Look in include/asm-arm/procinfo.h and arch/arm/kernel/arch.[ch] for
+ * Look in <asm/procinfo.h> and arch/arm/kernel/arch.[ch] for
  * more information about the __proc_info and __arch_info structures.
  */
        .long   __proc_info_begin
index 1dd8ea4..2034d4d 100644 (file)
@@ -20,7 +20,7 @@
  *             r2, r3 contains the zero-extended value
  *             lr corrupted
  *
- * No other registers must be altered.  (see include/asm-arm/uaccess.h
+ * No other registers must be altered.  (see <asm/uaccess.h>
  * for specific ASM register usage).
  *
  * Note that ADDR_LIMIT is either 0 or 0xc0000000.
index 8620afe..08ec7df 100644 (file)
@@ -20,7 +20,7 @@
  * Outputs:    r0 is the error code
  *             lr corrupted
  *
- * No other registers must be altered.  (see include/asm-arm/uaccess.h
+ * No other registers must be altered.  (see <asm/uaccess.h>
  * for specific ASM register usage).
  *
  * Note that ADDR_LIMIT is either 0 or 0xc0000000
index 5bad6b9..a048b92 100644 (file)
@@ -297,7 +297,7 @@ config MTD_AT91_DATAFLASH_CARD
        help
          Enable support for the DataFlash card.
 
-config MTD_NAND_AT91_BUSWIDTH_16
+config MTD_NAND_ATMEL_BUSWIDTH_16
        bool "Enable 16-bit data bus interface to NAND flash"
        depends on (MACH_AT91SAM9260EK || MACH_AT91SAM9261EK || MACH_AT91SAM9263EK || MACH_AT91SAM9G20EK || MACH_AT91CAP9ADK)
        help
index dc8b407..25765f1 100644 (file)
@@ -376,7 +376,7 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {}
  *  NAND / SmartMedia
  * -------------------------------------------------------------------- */
 
-#if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE)
+#if defined(CONFIG_MTD_NAND_ATMEL) || defined(CONFIG_MTD_NAND_ATMEL_MODULE)
 static struct atmel_nand_data nand_data;
 
 #define NAND_BASE      AT91_CHIPSELECT_3
index 8ced9bc..d2c5c84 100644 (file)
@@ -368,7 +368,7 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {}
  *  NAND / SmartMedia
  * -------------------------------------------------------------------- */
 
-#if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE)
+#if defined(CONFIG_MTD_NAND_ATMEL) || defined(CONFIG_MTD_NAND_ATMEL_MODULE)
 static struct atmel_nand_data nand_data;
 
 #define NAND_BASE      AT91_CHIPSELECT_3
index cae5f52..f5fec0a 100644 (file)
@@ -283,7 +283,7 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {}
  *  NAND / SmartMedia
  * -------------------------------------------------------------------- */
 
-#if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE)
+#if defined(CONFIG_MTD_NAND_ATMEL) || defined(CONFIG_MTD_NAND_ATMEL_MODULE)
 static struct atmel_nand_data nand_data;
 
 #define NAND_BASE      AT91_CHIPSELECT_3
index 483d436..b80860e 100644 (file)
@@ -198,7 +198,7 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {}
  *  NAND / SmartMedia
  * -------------------------------------------------------------------- */
 
-#if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE)
+#if defined(CONFIG_MTD_NAND_ATMEL) || defined(CONFIG_MTD_NAND_ATMEL_MODULE)
 static struct atmel_nand_data nand_data;
 
 #define NAND_BASE      AT91_CHIPSELECT_3
index 9762b15..42108d0 100644 (file)
@@ -352,7 +352,7 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {}
  *  NAND / SmartMedia
  * -------------------------------------------------------------------- */
 
-#if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE)
+#if defined(CONFIG_MTD_NAND_ATMEL) || defined(CONFIG_MTD_NAND_ATMEL_MODULE)
 static struct atmel_nand_data nand_data;
 
 #define NAND_BASE      AT91_CHIPSELECT_3
index 5f30948..9c61576 100644 (file)
@@ -194,7 +194,7 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {}
  *  NAND / SmartMedia
  * -------------------------------------------------------------------- */
 
-#if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE)
+#if defined(CONFIG_MTD_NAND_ATMEL) || defined(CONFIG_MTD_NAND_ATMEL_MODULE)
 static struct atmel_nand_data nand_data;
 
 #define NAND_BASE      AT91_CHIPSELECT_3
index 117cf6c..1f47259 100644 (file)
@@ -188,7 +188,7 @@ static struct atmel_nand_data __initdata cap9adk_nand_data = {
 //     .rdy_pin        = ... not connected
        .enable_pin     = AT91_PIN_PD15,
        .partition_info = nand_partitions,
-#if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16)
+#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
        .bus_width_16   = 1,
 #else
        .bus_width_16   = 0,
index 99b4ec3..33b1ccd 100644 (file)
@@ -140,14 +140,14 @@ static struct mtd_partition * __init nand_partitions(int size, int *num_partitio
        return ek_nand_partition;
 }
 
-static struct at91_nand_data __initdata ek_nand_data = {
+static struct atmel_nand_data __initdata ek_nand_data = {
        .ale            = 21,
        .cle            = 22,
 //     .det_pin        = ... not connected
        .rdy_pin        = AT91_PIN_PC13,
        .enable_pin     = AT91_PIN_PC14,
        .partition_info = nand_partitions,
-#if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16)
+#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
        .bus_width_16   = 1,
 #else
        .bus_width_16   = 0,
index 57a6221..3cd5f8d 100644 (file)
@@ -148,7 +148,7 @@ static struct atmel_nand_data __initdata ek_nand_data = {
        .rdy_pin        = AT91_PIN_PC13,
        .enable_pin     = AT91_PIN_PC14,
        .partition_info = nand_partitions,
-#if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16)
+#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
        .bus_width_16   = 1,
 #else
        .bus_width_16   = 0,
index 6a68079..daf93a5 100644 (file)
@@ -185,7 +185,7 @@ static struct atmel_nand_data __initdata ek_nand_data = {
        .rdy_pin        = AT91_PIN_PC13,
        .enable_pin     = AT91_PIN_PC14,
        .partition_info = nand_partitions,
-#if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16)
+#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
        .bus_width_16   = 1,
 #else
        .bus_width_16   = 0,
index 43dfbd0..12bf527 100644 (file)
@@ -190,7 +190,7 @@ static struct atmel_nand_data __initdata ek_nand_data = {
        .rdy_pin        = AT91_PIN_PC15,
        .enable_pin     = AT91_PIN_PC14,
        .partition_info = nand_partitions,
-#if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16)
+#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
        .bus_width_16   = 1,
 #else
        .bus_width_16   = 0,
index 6605a09..6312119 100644 (file)
@@ -194,7 +194,7 @@ static struct atmel_nand_data __initdata ek_nand_data = {
        .rdy_pin        = AT91_PIN_PA22,
        .enable_pin     = AT91_PIN_PD15,
        .partition_info = nand_partitions,
-#if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16)
+#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
        .bus_width_16   = 1,
 #else
        .bus_width_16   = 0,
index 45617c2..e0c0795 100644 (file)
@@ -143,13 +143,13 @@ static struct mtd_partition * __init nand_partitions(int size, int *num_partitio
 }
 
 /* det_pin is not connected */
-static struct at91_nand_data __initdata ek_nand_data = {
+static struct atmel_nand_data __initdata ek_nand_data = {
        .ale            = 21,
        .cle            = 22,
        .rdy_pin        = AT91_PIN_PC13,
        .enable_pin     = AT91_PIN_PC14,
        .partition_info = nand_partitions,
-#if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16)
+#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
        .bus_width_16   = 1,
 #else
        .bus_width_16   = 0,
index 837aedf..2f4ecac 100644 (file)
@@ -114,14 +114,14 @@ static struct mtd_partition * __init nand_partitions(int size, int *num_partitio
        return ek_nand_partition;
 }
 
-static struct at91_nand_data __initdata ek_nand_data = {
+static struct atmel_nand_data __initdata ek_nand_data = {
        .ale            = 21,
        .cle            = 22,
 //     .det_pin        = ... not connected
        .rdy_pin        = AT91_PIN_PC13,
        .enable_pin     = AT91_PIN_PC14,
        .partition_info = nand_partitions,
-#if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16)
+#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
        .bus_width_16   = 1,
 #else
        .bus_width_16   = 0,
index 95800d3..0e9649d 100644 (file)
@@ -127,14 +127,14 @@ static struct mtd_partition * __init nand_partitions(int size, int *num_partitio
        return ek_nand_partition;
 }
 
-static struct at91_nand_data __initdata ek_nand_data = {
+static struct atmel_nand_data __initdata ek_nand_data = {
        .ale            = 21,
        .cle            = 22,
 //     .det_pin        = ... not connected
        .rdy_pin        = AT91_PIN_PA22,
        .enable_pin     = AT91_PIN_PD15,
        .partition_info = nand_partitions,
-#if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16)
+#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
        .bus_width_16   = 1,
 #else
        .bus_width_16   = 0,
index 6a90fe5..8915a5f 100644 (file)
@@ -172,24 +172,29 @@ found:
 
        return clk;
 }
+EXPORT_SYMBOL(clk_get);
 
 void clk_put(struct clk *clk)
 {
 }
+EXPORT_SYMBOL(clk_put);
 
 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->get_rate();
 }
+EXPORT_SYMBOL(clk_get_rate);
 
 int imx_clocks_init(void)
 {
index 98ddd8a..c40650d 100644 (file)
@@ -251,7 +251,6 @@ void __init set_imx_fb_info(struct imxfb_mach_info *hard_imx_fb_info)
 {
        memcpy(&imx_fb_info,hard_imx_fb_info,sizeof(struct imxfb_mach_info));
 }
-EXPORT_SYMBOL(set_imx_fb_info);
 
 static struct resource imxfb_resources[] = {
        [0] = {
index 9635d58..baeff24 100644 (file)
@@ -125,7 +125,7 @@ static struct platform_device *devices[] __initdata = {
        &imx_uart2_device,
 };
 
-#ifdef CONFIG_MMC_IMX
+#if defined(CONFIG_MMC_IMX) || defined(CONFIG_MMC_IMX_MODULE)
 static int mx1ads_mmc_card_present(struct device *dev)
 {
        /* MMC/SD Card Detect is PB 20 on MX1ADS V1.0.7 */
@@ -143,7 +143,7 @@ mx1ads_init(void)
 #ifdef CONFIG_LEDS
        imx_gpio_mode(GPIO_PORTA | GPIO_OUT | 2);
 #endif
-#ifdef CONFIG_MMC_IMX
+#if defined(CONFIG_MMC_IMX) || defined(CONFIG_MMC_IMX_MODULE)
        /* SD/MMC card detect */
        imx_gpio_mode(GPIO_PORTB | GPIO_GIUS | GPIO_IN | 20);
        imx_set_mmc_info(&mx1ads_mmc_info);
index e1f8de2..b6437f4 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/timer.h>
 #include <linux/ata_platform.h>
 #include <linux/mv643xx_eth.h>
+#include <linux/ethtool.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/pci.h>
@@ -69,6 +70,8 @@ static struct platform_device rd88f6281_nand_flash = {
 
 static struct mv643xx_eth_platform_data rd88f6281_ge00_data = {
        .phy_addr       = -1,
+       .speed          = SPEED_1000,
+       .duplex         = DUPLEX_FULL,
 };
 
 static struct mv_sata_platform_data rd88f6281_sata_data = {
index a494b71..46b4f5a 100644 (file)
 #include <asm/mach/map.h>
 #include <asm/gpio.h>
 
-#include <asm/arch-ns9xxx/board.h>
-#include <asm/arch-ns9xxx/processor-ns9360.h>
-#include <asm/arch-ns9xxx/regs-sys-ns9360.h>
-#include <asm/arch-ns9xxx/regs-mem.h>
-#include <asm/arch-ns9xxx/regs-bbu.h>
-#include <asm/arch-ns9xxx/regs-board-a9m9750dev.h>
+#include <asm/arch/board.h>
+#include <asm/arch/processor-ns9360.h>
+#include <asm/arch/regs-sys-ns9360.h>
+#include <asm/arch/regs-mem.h>
+#include <asm/arch/regs-bbu.h>
+#include <asm/arch/regs-board-a9m9750dev.h>
 
 #include "board-a9m9750dev.h"
 
index cabfb87..7bc05a4 100644 (file)
@@ -14,8 +14,8 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 
-#include <asm/arch-ns9xxx/regs-bbu.h>
-#include <asm/arch-ns9xxx/processor-ns9360.h>
+#include <asm/arch/regs-bbu.h>
+#include <asm/arch/processor-ns9360.h>
 
 #include "gpio-ns9360.h"
 
index b3c963b..ed4c833 100644 (file)
@@ -13,9 +13,9 @@
 #include <linux/spinlock.h>
 #include <linux/module.h>
 
-#include <asm/arch-ns9xxx/gpio.h>
-#include <asm/arch-ns9xxx/processor.h>
-#include <asm/arch-ns9xxx/processor-ns9360.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/processor.h>
+#include <asm/arch/processor-ns9360.h>
 #include <asm/bug.h>
 #include <asm/types.h>
 #include <asm/bitops.h>
index ca85d24..d296425 100644 (file)
@@ -13,9 +13,9 @@
 #include <asm/io.h>
 #include <asm/mach/irq.h>
 #include <asm/mach-types.h>
-#include <asm/arch-ns9xxx/regs-sys-common.h>
-#include <asm/arch-ns9xxx/irqs.h>
-#include <asm/arch-ns9xxx/board.h>
+#include <asm/arch/regs-sys-common.h>
+#include <asm/arch/irqs.h>
+#include <asm/arch/board.h>
 
 #include "generic.h"
 
index 9623fff..7714233 100644 (file)
@@ -11,7 +11,7 @@
 #include <asm/mach/arch.h>
 #include <asm/mach-types.h>
 
-#include <asm/arch-ns9xxx/processor-ns9360.h>
+#include <asm/arch/processor-ns9360.h>
 
 #include "board-a9m9750dev.h"
 #include "generic.h"
index fcc815b..bdbd0bb 100644 (file)
@@ -11,7 +11,7 @@
 #include <asm/mach/arch.h>
 #include <asm/mach-types.h>
 
-#include <asm/arch-ns9xxx/processor-ns9360.h>
+#include <asm/arch/processor-ns9360.h>
 
 #include "board-jscc9p9360.h"
 #include "generic.h"
index 5aa5d9b..c9cce9b 100644 (file)
@@ -11,8 +11,8 @@
 #include <linux/platform_device.h>
 #include <linux/serial_8250.h>
 
-#include <asm/arch-ns9xxx/regs-board-a9m9750dev.h>
-#include <asm/arch-ns9xxx/board.h>
+#include <asm/arch/regs-board-a9m9750dev.h>
+#include <asm/arch/board.h>
 
 #define DRIVER_NAME "serial8250"
 
index 2bee0b7..8ee81b5 100644 (file)
@@ -14,8 +14,8 @@
 
 #include <asm/page.h>
 #include <asm/mach/map.h>
-#include <asm/arch-ns9xxx/processor-ns9360.h>
-#include <asm/arch-ns9xxx/regs-sys-ns9360.h>
+#include <asm/arch/processor-ns9360.h>
+#include <asm/arch/regs-sys-ns9360.h>
 
 void ns9360_reset(char mode)
 {
index 4d573c9..66bd582 100644 (file)
@@ -15,9 +15,9 @@
 #include <linux/clocksource.h>
 #include <linux/clockchips.h>
 
-#include <asm/arch-ns9xxx/processor-ns9360.h>
-#include <asm/arch-ns9xxx/regs-sys-ns9360.h>
-#include <asm/arch-ns9xxx/irqs.h>
+#include <asm/arch/processor-ns9360.h>
+#include <asm/arch/regs-sys-ns9360.h>
+#include <asm/arch/irqs.h>
 #include <asm/arch/system.h>
 #include "generic.h"
 
index d50e365..73e9242 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/irq.h>
 #include <linux/mtd/physmap.h>
 #include <linux/mv643xx_eth.h>
+#include <linux/ethtool.h>
 #include <asm/mach-types.h>
 #include <asm/gpio.h>
 #include <asm/leds.h>
@@ -88,6 +89,8 @@ static struct orion5x_mpp_mode rd88f5181l_fxo_mpp_modes[] __initdata = {
 
 static struct mv643xx_eth_platform_data rd88f5181l_fxo_eth_data = {
        .phy_addr       = -1,
+       .speed          = SPEED_1000,
+       .duplex         = DUPLEX_FULL,
 };
 
 static void __init rd88f5181l_fxo_init(void)
index b56447d..ac48201 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/irq.h>
 #include <linux/mtd/physmap.h>
 #include <linux/mv643xx_eth.h>
+#include <linux/ethtool.h>
 #include <linux/i2c.h>
 #include <asm/mach-types.h>
 #include <asm/gpio.h>
@@ -89,6 +90,8 @@ static struct orion5x_mpp_mode rd88f5181l_ge_mpp_modes[] __initdata = {
 
 static struct mv643xx_eth_platform_data rd88f5181l_ge_eth_data = {
        .phy_addr       = -1,
+       .speed          = SPEED_1000,
+       .duplex         = DUPLEX_FULL,
 };
 
 static struct i2c_board_info __initdata rd88f5181l_ge_i2c_rtc = {
index 1af093f..25568c2 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/delay.h>
 #include <linux/mtd/physmap.h>
 #include <linux/mv643xx_eth.h>
+#include <linux/ethtool.h>
 #include <asm/mach-types.h>
 #include <asm/gpio.h>
 #include <asm/mach/arch.h>
@@ -92,6 +93,8 @@ static struct platform_device wnr854t_nor_flash = {
 
 static struct mv643xx_eth_platform_data wnr854t_eth_data = {
        .phy_addr       = -1,
+       .speed          = SPEED_1000,
+       .duplex         = DUPLEX_FULL,
 };
 
 static void __init wnr854t_init(void)
index aeab55c..9b8ee8c 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/delay.h>
 #include <linux/mtd/physmap.h>
 #include <linux/mv643xx_eth.h>
+#include <linux/ethtool.h>
 #include <asm/mach-types.h>
 #include <asm/gpio.h>
 #include <asm/mach/arch.h>
@@ -100,6 +101,8 @@ static struct platform_device wrt350n_v2_nor_flash = {
 
 static struct mv643xx_eth_platform_data wrt350n_v2_eth_data = {
        .phy_addr       = -1,
+       .speed          = SPEED_1000,
+       .duplex         = DUPLEX_FULL,
 };
 
 static void __init wrt350n_v2_init(void)
index 30023b0..90056d5 100644 (file)
@@ -22,7 +22,6 @@
 
 #include <linux/irq.h>
 #include <linux/platform_device.h>
-#include <linux/ide.h>
 #include <linux/i2c.h>
 #include <linux/pwm_backlight.h>
 
index 3a6c8ec..ed15f87 100644 (file)
@@ -187,7 +187,7 @@ config CPU_ARM926T
                ARCH_AT91SAM9260 || ARCH_AT91SAM9261 || \
                ARCH_AT91SAM9263 || ARCH_AT91SAM9RL || \
                ARCH_AT91SAM9G20 || ARCH_AT91CAP9 || \
-               ARCH_NS9XXX || ARCH_DAVINCI
+               ARCH_NS9XXX || ARCH_DAVINCI || ARCH_MX2
        default y if ARCH_VERSATILE_PB || MACH_VERSATILE_AB || \
                ARCH_OMAP730 || ARCH_OMAP16XX || \
                ARCH_PNX4008 || ARCH_NETX || CPU_S3C2412 || \
@@ -742,3 +742,11 @@ config CACHE_L2X0
        select OUTER_CACHE
        help
          This option enables the L2x0 PrimeCell.
+
+config CACHE_XSC3L2
+       bool "Enable the L2 cache on XScale3"
+       depends on CPU_XSC3
+       default y
+       select OUTER_CACHE
+       help
+         This option enables the L2 cache on XScale3.
diff --git a/arch/arm/mm/cache-xsc3l2.c b/arch/arm/mm/cache-xsc3l2.c
new file mode 100644 (file)
index 0000000..158bd96
--- /dev/null
@@ -0,0 +1,182 @@
+/*
+ * arch/arm/mm/cache-xsc3l2.c - XScale3 L2 cache controller support
+ *
+ * Copyright (C) 2007 ARM Limited
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#include <linux/init.h>
+#include <linux/spinlock.h>
+
+#include <asm/system.h>
+#include <asm/cacheflush.h>
+#include <asm/io.h>
+
+#define CR_L2  (1 << 26)
+
+#define CACHE_LINE_SIZE                32
+#define CACHE_LINE_SHIFT       5
+#define CACHE_WAY_PER_SET      8
+
+#define CACHE_WAY_SIZE(l2ctype)        (8192 << (((l2ctype) >> 8) & 0xf))
+#define CACHE_SET_SIZE(l2ctype)        (CACHE_WAY_SIZE(l2ctype) >> CACHE_LINE_SHIFT)
+
+static inline int xsc3_l2_present(void)
+{
+       unsigned long l2ctype;
+
+       __asm__("mrc p15, 1, %0, c0, c0, 1" : "=r" (l2ctype));
+
+       return !!(l2ctype & 0xf8);
+}
+
+static inline void xsc3_l2_clean_mva(unsigned long addr)
+{
+       __asm__("mcr p15, 1, %0, c7, c11, 1" : : "r" (addr));
+}
+
+static inline void xsc3_l2_clean_pa(unsigned long addr)
+{
+       xsc3_l2_clean_mva(__phys_to_virt(addr));
+}
+
+static inline void xsc3_l2_inv_mva(unsigned long addr)
+{
+       __asm__("mcr p15, 1, %0, c7, c7, 1" : : "r" (addr));
+}
+
+static inline void xsc3_l2_inv_pa(unsigned long addr)
+{
+       xsc3_l2_inv_mva(__phys_to_virt(addr));
+}
+
+static inline void xsc3_l2_inv_all(void)
+{
+       unsigned long l2ctype, set_way;
+       int set, way;
+
+       __asm__("mrc p15, 1, %0, c0, c0, 1" : "=r" (l2ctype));
+
+       for (set = 0; set < CACHE_SET_SIZE(l2ctype); set++) {
+               for (way = 0; way < CACHE_WAY_PER_SET; way++) {
+                       set_way = (way << 29) | (set << 5);
+                       __asm__("mcr p15, 1, %0, c7, c11, 2" : : "r"(set_way));
+               }
+       }
+
+       dsb();
+}
+
+static void xsc3_l2_inv_range(unsigned long start, unsigned long end)
+{
+       if (start == 0 && end == -1ul) {
+               xsc3_l2_inv_all();
+               return;
+       }
+
+       /*
+        * Clean and invalidate partial first cache line.
+        */
+       if (start & (CACHE_LINE_SIZE - 1)) {
+               xsc3_l2_clean_pa(start & ~(CACHE_LINE_SIZE - 1));
+               xsc3_l2_inv_pa(start & ~(CACHE_LINE_SIZE - 1));
+               start = (start | (CACHE_LINE_SIZE - 1)) + 1;
+       }
+
+       /*
+        * Clean and invalidate partial last cache line.
+        */
+       if (end & (CACHE_LINE_SIZE - 1)) {
+               xsc3_l2_clean_pa(end & ~(CACHE_LINE_SIZE - 1));
+               xsc3_l2_inv_pa(end & ~(CACHE_LINE_SIZE - 1));
+               end &= ~(CACHE_LINE_SIZE - 1);
+       }
+
+       /*
+        * Invalidate all full cache lines between 'start' and 'end'.
+        */
+       while (start != end) {
+               xsc3_l2_inv_pa(start);
+               start += CACHE_LINE_SIZE;
+       }
+
+       dsb();
+}
+
+static void xsc3_l2_clean_range(unsigned long start, unsigned long end)
+{
+       start &= ~(CACHE_LINE_SIZE - 1);
+       while (start < end) {
+               xsc3_l2_clean_pa(start);
+               start += CACHE_LINE_SIZE;
+       }
+
+       dsb();
+}
+
+/*
+ * optimize L2 flush all operation by set/way format
+ */
+static inline void xsc3_l2_flush_all(void)
+{
+       unsigned long l2ctype, set_way;
+       int set, way;
+
+       __asm__("mrc p15, 1, %0, c0, c0, 1" : "=r" (l2ctype));
+
+       for (set = 0; set < CACHE_SET_SIZE(l2ctype); set++) {
+               for (way = 0; way < CACHE_WAY_PER_SET; way++) {
+                       set_way = (way << 29) | (set << 5);
+                       __asm__("mcr p15, 1, %0, c7, c15, 2" : : "r"(set_way));
+               }
+       }
+
+       dsb();
+}
+
+static void xsc3_l2_flush_range(unsigned long start, unsigned long end)
+{
+       if (start == 0 && end == -1ul) {
+               xsc3_l2_flush_all();
+               return;
+       }
+
+       start &= ~(CACHE_LINE_SIZE - 1);
+       while (start < end) {
+               xsc3_l2_clean_pa(start);
+               xsc3_l2_inv_pa(start);
+               start += CACHE_LINE_SIZE;
+       }
+
+       dsb();
+}
+
+static int __init xsc3_l2_init(void)
+{
+       if (!cpu_is_xsc3() || !xsc3_l2_present())
+               return 0;
+
+       if (!(get_cr() & CR_L2)) {
+               pr_info("XScale3 L2 cache enabled.\n");
+               adjust_cr(CR_L2, CR_L2);
+               xsc3_l2_inv_all();
+       }
+
+       outer_cache.inv_range = xsc3_l2_inv_range;
+       outer_cache.clean_range = xsc3_l2_clean_range;
+       outer_cache.flush_range = xsc3_l2_flush_range;
+
+       return 0;
+}
+core_initcall(xsc3_l2_init);
index e635294..30a69d6 100644 (file)
@@ -156,9 +156,9 @@ static int __init check_initrd(struct meminfo *mi)
        }
 
        if (initrd_node == -1) {
-               printk(KERN_ERR "initrd (0x%08lx - 0x%08lx) extends beyond "
+               printk(KERN_ERR "INITRD: 0x%08lx+0x%08lx extends beyond "
                       "physical memory - disabling initrd\n",
-                      phys_initrd_start, end);
+                      phys_initrd_start, phys_initrd_size);
                phys_initrd_start = phys_initrd_size = 0;
        }
 #endif
@@ -239,24 +239,32 @@ bootmem_init_node(int node, int initrd_node, struct meminfo *mi)
        reserve_bootmem_node(pgdat, boot_pfn << PAGE_SHIFT,
                             boot_pages << PAGE_SHIFT, BOOTMEM_DEFAULT);
 
+       /*
+        * Reserve any special node zero regions.
+        */
+       if (node == 0)
+               reserve_node_zero(pgdat);
+
 #ifdef CONFIG_BLK_DEV_INITRD
        /*
         * If the initrd is in this node, reserve its memory.
         */
        if (node == initrd_node) {
-               reserve_bootmem_node(pgdat, phys_initrd_start,
-                                    phys_initrd_size, BOOTMEM_DEFAULT);
-               initrd_start = __phys_to_virt(phys_initrd_start);
-               initrd_end = initrd_start + phys_initrd_size;
+               int res = reserve_bootmem_node(pgdat, phys_initrd_start,
+                                    phys_initrd_size, BOOTMEM_EXCLUSIVE);
+
+               if (res == 0) {
+                       initrd_start = __phys_to_virt(phys_initrd_start);
+                       initrd_end = initrd_start + phys_initrd_size;
+               } else {
+                       printk(KERN_ERR
+                               "INITRD: 0x%08lx+0x%08lx overlaps in-use "
+                               "memory region - disabling initrd\n",
+                               phys_initrd_start, phys_initrd_size);
+               }
        }
 #endif
 
-       /*
-        * Finally, reserve any node zero regions.
-        */
-       if (node == 0)
-               reserve_node_zero(pgdat);
-
        /*
         * initialise the zones within this node.
         */
index 303a7ff..b81dbf9 100644 (file)
@@ -259,7 +259,7 @@ remap_area_supersections(unsigned long virt, unsigned long pfn,
  * caller shouldn't need to know that small detail.
  *
  * 'flags' are the extra L_PTE_ flags that you want to specify for this
- * mapping.  See include/asm-arm/proc-armv/pgtable.h for more information.
+ * mapping.  See <asm/pgtable.h> for more information.
  */
 void __iomem *
 __arm_ioremap_pfn(unsigned long pfn, unsigned long offset, size_t size,
index d64f8e6..eda733d 100644 (file)
@@ -231,7 +231,7 @@ cpu_arm720_name:
                .align
 
 /*
- * See linux/include/asm-arm/procinfo.h for a definition of this structure.
+ * See <asm/procinfo.h> for a definition of this structure.
  */
        
                .section ".proc.info.init", #alloc, #execinstr
index 3533741..6ff53c2 100644 (file)
  */
 #define CACHESIZE      32768
 
-/*
- * Run with L2 enabled.
- */
-#define L2_CACHE_ENABLE        1
-
 /*
  * This macro is used to wait for a CP15 write and is needed when we
  * have to ensure that the last operation to the coprocessor was
@@ -265,12 +260,9 @@ ENTRY(xsc3_dma_inv_range)
        tst     r0, #CACHELINESIZE - 1
        bic     r0, r0, #CACHELINESIZE - 1
        mcrne   p15, 0, r0, c7, c10, 1          @ clean L1 D line
-       mcrne   p15, 1, r0, c7, c11, 1          @ clean L2 line
        tst     r1, #CACHELINESIZE - 1
        mcrne   p15, 0, r1, c7, c10, 1          @ clean L1 D line
-       mcrne   p15, 1, r1, c7, c11, 1          @ clean L2 line
 1:     mcr     p15, 0, r0, c7, c6, 1           @ invalidate L1 D line
-       mcr     p15, 1, r0, c7, c7, 1           @ invalidate L2 line
        add     r0, r0, #CACHELINESIZE
        cmp     r0, r1
        blo     1b
@@ -288,7 +280,6 @@ ENTRY(xsc3_dma_inv_range)
 ENTRY(xsc3_dma_clean_range)
        bic     r0, r0, #CACHELINESIZE - 1
 1:     mcr     p15, 0, r0, c7, c10, 1          @ clean L1 D line
-       mcr     p15, 1, r0, c7, c11, 1          @ clean L2 line
        add     r0, r0, #CACHELINESIZE
        cmp     r0, r1
        blo     1b
@@ -306,8 +297,6 @@ ENTRY(xsc3_dma_clean_range)
 ENTRY(xsc3_dma_flush_range)
        bic     r0, r0, #CACHELINESIZE - 1
 1:     mcr     p15, 0, r0, c7, c14, 1          @ clean/invalidate L1 D line
-       mcr     p15, 1, r0, c7, c11, 1          @ clean L2 line
-       mcr     p15, 1, r0, c7, c7, 1           @ invalidate L2 line
        add     r0, r0, #CACHELINESIZE
        cmp     r0, r1
        blo     1b
@@ -347,9 +336,7 @@ ENTRY(cpu_xsc3_switch_mm)
        mcr     p15, 0, ip, c7, c5, 0           @ invalidate L1 I cache and BTB
        mcr     p15, 0, ip, c7, c10, 4          @ data write barrier
        mcr     p15, 0, ip, c7, c5, 4           @ prefetch flush
-#ifdef L2_CACHE_ENABLE
        orr     r0, r0, #0x18                   @ cache the page table in L2
-#endif
        mcr     p15, 0, r0, c2, c0, 0           @ load page table pointer
        mcr     p15, 0, ip, c8, c7, 0           @ invalidate I and D TLBs
        cpwait_ret lr, ip
@@ -378,12 +365,10 @@ ENTRY(cpu_xsc3_set_pte_ext)
        orreq   r2, r2, #PTE_EXT_AP_UNO_SRW     @ yes -> user n/a, system r/w
                                                @ combined with user -> user r/w
 
-#if L2_CACHE_ENABLE
        @ If it's cacheable, it needs to be in L2 also.
        eor     ip, r1, #L_PTE_CACHEABLE
        tst     ip, #L_PTE_CACHEABLE
        orreq   r2, r2, #PTE_EXT_TEX(0x5)
-#endif
 
        tst     r3, #L_PTE_PRESENT | L_PTE_YOUNG        @ present and young?
        movne   r2, #0                          @ no -> fault
@@ -408,9 +393,7 @@ __xsc3_setup:
        mcr     p15, 0, ip, c7, c10, 4          @ data write barrier
        mcr     p15, 0, ip, c7, c5, 4           @ prefetch flush
        mcr     p15, 0, ip, c8, c7, 0           @ invalidate I and D TLBs
-#if L2_CACHE_ENABLE
        orr     r4, r4, #0x18                   @ cache the page table in L2
-#endif
        mcr     p15, 0, r4, c2, c0, 0           @ load page table pointer
 
        mov     r0, #0                          @ don't allow CP access
@@ -418,9 +401,7 @@ __xsc3_setup:
 
        mrc     p15, 0, r0, c1, c0, 1           @ get auxiliary control reg
        and     r0, r0, #2                      @ preserve bit P bit setting
-#if L2_CACHE_ENABLE
        orr     r0, r0, #(1 << 10)              @ enable L2 for LLR cache
-#endif
        mcr     p15, 0, r0, c1, c0, 1           @ set auxiliary control reg
 
        adr     r5, xsc3_crval
@@ -429,9 +410,6 @@ __xsc3_setup:
        bic     r0, r0, r5                      @ ..V. ..R. .... ..A.
        orr     r0, r0, r6                      @ ..VI Z..S .... .C.M (mmu)
                                                @ ...I Z..S .... .... (uc)
-#if L2_CACHE_ENABLE
-       orr     r0, r0, #0x04000000             @ L2 enable
-#endif
        mov     pc, lr
 
        .size   __xsc3_setup, . - __xsc3_setup
index 4a4d02c..386cbd1 100644 (file)
@@ -69,7 +69,7 @@ typedef union tagFPREG {
  * This structure is exported to user space.  Do not re-order.
  * Only add new stuff to the end, and do not change the size of
  * any element.  Elements of this structure are used by user
- * space, and must match struct user_fp in include/asm-arm/user.h.
+ * space, and must match struct user_fp in <asm/user.h>.
  * We include the byte offsets below for documentation purposes.
  *
  * The size of this structure and FPREG are checked by fpmodule.c
index b8a4b94..99060ab 100644 (file)
@@ -1519,6 +1519,11 @@ sys_call_table:
        .long sys_fallocate
        .long sys_timerfd_settime       /* 325 */
        .long sys_timerfd_gettime
-
+       .long sys_signalfd4
+       .long sys_eventfd2
+       .long sys_epoll_create1
+       .long sys_dup3                  /* 330 */
+       .long sys_pipe2
+       .long sys_inotify_init1
 
 syscall_table_size = (. - sys_call_table)
index 451f2ff..48e496f 100644 (file)
@@ -171,8 +171,8 @@ config IA64_SGI_SN2
          to select this option.  If in doubt, select ia64 generic support
          instead.
 
-config IA64_SGI_UV`
-       bool "SGI-UV`"
+config IA64_SGI_UV
+       bool "SGI-UV"
        select NUMA
        select ACPI_NUMA
        select SWIOTLB
@@ -321,10 +321,10 @@ config SMP
          If you don't know what to do here, say N.
 
 config NR_CPUS
-       int "Maximum number of CPUs (2-1024)"
-       range 2 1024
+       int "Maximum number of CPUs (2-4096)"
+       range 2 4096
        depends on SMP
-       default "1024"
+       default "4096"
        help
          You should set this to the number of CPUs in your system, but
          keep in mind that a kernel compiled for, e.g., 2 CPUs will boot but
index 0210545..9f48397 100644 (file)
@@ -1,20 +1,16 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.22
-# Thu Jul 19 13:55:32 2007
+# Linux kernel version: 2.6.27-rc1
+# Mon Aug  4 15:38:01 2008
 #
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
 
 #
-# Code maturity level options
+# General setup
 #
 CONFIG_EXPERIMENTAL=y
 CONFIG_LOCK_KERNEL=y
 CONFIG_INIT_ENV_ARG_LIMIT=32
-
-#
-# General setup
-#
 CONFIG_LOCALVERSION=""
 CONFIG_LOCALVERSION_AUTO=y
 CONFIG_SWAP=y
@@ -23,20 +19,34 @@ CONFIG_SYSVIPC_SYSCTL=y
 CONFIG_POSIX_MQUEUE=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
-# CONFIG_USER_NS is not set
 # CONFIG_AUDIT is not set
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_LOG_BUF_SHIFT=20
-# CONFIG_CPUSETS is not set
+CONFIG_CGROUPS=y
+# CONFIG_CGROUP_DEBUG is not set
+# CONFIG_CGROUP_NS is not set
+# CONFIG_CGROUP_DEVICE is not set
+CONFIG_CPUSETS=y
+# CONFIG_GROUP_SCHED is not set
+# CONFIG_CGROUP_CPUACCT is not set
+# CONFIG_RESOURCE_COUNTERS is not set
 CONFIG_SYSFS_DEPRECATED=y
+CONFIG_SYSFS_DEPRECATED_V2=y
+CONFIG_PROC_PID_CPUSET=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_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE=""
 CONFIG_CC_OPTIMIZE_FOR_SIZE=y
 CONFIG_SYSCTL=y
 # CONFIG_EMBEDDED is not set
 CONFIG_SYSCTL_SYSCALL=y
+CONFIG_SYSCTL_SYSCALL_CHECK=y
 CONFIG_KALLSYMS=y
 CONFIG_KALLSYMS_ALL=y
 # CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -44,6 +54,7 @@ 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
@@ -53,12 +64,30 @@ CONFIG_TIMERFD=y
 CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
 CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_SLUB_DEBUG=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 is not set
+# CONFIG_HAVE_IOREMAP_PROT is not set
+CONFIG_HAVE_KPROBES=y
+CONFIG_HAVE_KRETPROBES=y
+# CONFIG_HAVE_ARCH_TRACEHOOK is not set
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_USE_GENERIC_SMP_HELPERS=y
+# CONFIG_HAVE_CLK is not set
+CONFIG_PROC_PAGE_MONITOR=y
+# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
+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=y
@@ -68,6 +97,8 @@ 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_BLOCK_COMPAT=y
 
 #
 # IO Schedulers
@@ -81,6 +112,7 @@ CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_CFQ is not set
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_CLASSIC_RCU=y
 
 #
 # Processor type and features
@@ -91,22 +123,28 @@ CONFIG_ZONE_DMA=y
 CONFIG_QUICKLIST=y
 CONFIG_MMU=y
 CONFIG_SWIOTLB=y
+CONFIG_IOMMU_HELPER=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
 # CONFIG_ARCH_HAS_ILOG2_U32 is not set
 # CONFIG_ARCH_HAS_ILOG2_U64 is not set
+CONFIG_HUGETLB_PAGE_SIZE_VARIABLE=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
 CONFIG_GENERIC_CALIBRATE_DELAY=y
 CONFIG_GENERIC_TIME=y
+CONFIG_GENERIC_TIME_VSYSCALL=y
+CONFIG_HAVE_SETUP_PER_CPU_AREA=y
 CONFIG_DMI=y
 CONFIG_EFI=y
 CONFIG_GENERIC_IOMAP=y
 CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
+CONFIG_IA64_UNCACHED_ALLOCATOR=y
 CONFIG_AUDIT_ARCH=y
 CONFIG_IA64_GENERIC=y
 # CONFIG_IA64_DIG is not set
 # CONFIG_IA64_HP_ZX1 is not set
 # CONFIG_IA64_HP_ZX1_SWIOTLB is not set
 # CONFIG_IA64_SGI_SN2 is not set
+# CONFIG_IA64_SGI_UV is not set
 # CONFIG_IA64_HP_SIM is not set
 # CONFIG_ITANIUM is not set
 CONFIG_MCKINLEY=y
@@ -116,22 +154,26 @@ CONFIG_MCKINLEY=y
 CONFIG_IA64_PAGE_SIZE_64KB=y
 CONFIG_PGTABLE_3=y
 # CONFIG_PGTABLE_4 is not set
+CONFIG_HZ=250
 # 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 is not set
 CONFIG_IA64_L1_CACHE_SHIFT=7
 CONFIG_IA64_CYCLONE=y
 CONFIG_IOSAPIC=y
-# CONFIG_IA64_SGI_SN_XP is not set
 CONFIG_FORCE_MAX_ZONEORDER=17
+# CONFIG_VIRT_CPU_ACCOUNTING is not set
 CONFIG_SMP=y
-CONFIG_NR_CPUS=512
+CONFIG_NR_CPUS=4096
 CONFIG_HOTPLUG_CPU=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
+CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_SCHED_SMT is not set
 # CONFIG_PERMIT_BSP_REMOVE is not set
+CONFIG_PREEMPT_NONE=y
+# CONFIG_PREEMPT_VOLUNTARY is not set
 # CONFIG_PREEMPT is not set
 CONFIG_SELECT_MEMORY_MODEL=y
 # CONFIG_FLATMEM_MANUAL is not set
@@ -141,6 +183,8 @@ CONFIG_DISCONTIGMEM=y
 CONFIG_FLAT_NODE_MEM_MAP=y
 CONFIG_NEED_MULTIPLE_NODES=y
 # CONFIG_SPARSEMEM_STATIC is not set
+CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
+CONFIG_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
 CONFIG_MIGRATION=y
 CONFIG_RESOURCES_64BIT=y
@@ -148,6 +192,7 @@ CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_NR_QUICK=1
 CONFIG_VIRT_TO_BUS=y
+CONFIG_MMU_NOTIFIER=y
 CONFIG_ARCH_SELECT_MEMORY_MODEL=y
 CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
 CONFIG_ARCH_FLATMEM_ENABLE=y
@@ -162,12 +207,14 @@ CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y
 CONFIG_HAVE_ARCH_NODEDATA_EXTENSION=y
 CONFIG_IA32_SUPPORT=y
 CONFIG_COMPAT=y
+CONFIG_COMPAT_FOR_U64_ALIGNMENT=y
 CONFIG_IA64_MCA_RECOVERY=y
 CONFIG_PERFMON=y
 CONFIG_IA64_PALINFO=y
 # CONFIG_IA64_MC_ERR_INJECT is not set
 CONFIG_SGI_SN=y
 # CONFIG_IA64_ESI is not set
+# CONFIG_IA64_HP_AML_NFW is not set
 
 #
 # SN Devices
@@ -179,6 +226,7 @@ CONFIG_CRASH_DUMP=y
 #
 # Firmware Drivers
 #
+# CONFIG_FIRMWARE_MEMMAP is not set
 CONFIG_EFI_VARS=y
 CONFIG_EFI_PCDP=y
 CONFIG_DMIID=y
@@ -189,24 +237,25 @@ CONFIG_BINFMT_MISC=m
 # Power management and ACPI
 #
 CONFIG_PM=y
-CONFIG_PM_LEGACY=y
 # CONFIG_PM_DEBUG is not set
-
-#
-# ACPI (Advanced Configuration and Power Interface) Support
-#
 CONFIG_ACPI=y
 CONFIG_ACPI_PROCFS=y
+CONFIG_ACPI_PROCFS_POWER=y
+CONFIG_ACPI_SYSFS_POWER=y
+CONFIG_ACPI_PROC_EVENT=y
 CONFIG_ACPI_BUTTON=m
 CONFIG_ACPI_FAN=m
-# CONFIG_ACPI_DOCK is not set
+CONFIG_ACPI_DOCK=y
+# CONFIG_ACPI_BAY is not set
 CONFIG_ACPI_PROCESSOR=m
 CONFIG_ACPI_HOTPLUG_CPU=y
 CONFIG_ACPI_THERMAL=m
 CONFIG_ACPI_NUMA=y
+# CONFIG_ACPI_CUSTOM_DSDT is not set
 CONFIG_ACPI_BLACKLIST_YEAR=0
 # CONFIG_ACPI_DEBUG is not set
 CONFIG_ACPI_EC=y
+# CONFIG_ACPI_PCI_SLOT is not set
 CONFIG_ACPI_POWER=y
 CONFIG_ACPI_SYSTEM=y
 CONFIG_ACPI_CONTAINER=m
@@ -225,6 +274,7 @@ CONFIG_PCI_SYSCALL=y
 # CONFIG_PCIEPORTBUS is not set
 CONFIG_ARCH_SUPPORTS_MSI=y
 # CONFIG_PCI_MSI is not set
+CONFIG_PCI_LEGACY=y
 # CONFIG_PCI_DEBUG is not set
 CONFIG_HOTPLUG_PCI=m
 # CONFIG_HOTPLUG_PCI_FAKE is not set
@@ -233,15 +283,7 @@ CONFIG_HOTPLUG_PCI_ACPI=m
 # CONFIG_HOTPLUG_PCI_CPCI is not set
 # CONFIG_HOTPLUG_PCI_SHPC is not set
 # CONFIG_HOTPLUG_PCI_SGI is not set
-
-#
-# PCCARD (PCMCIA/CardBus) support
-#
 # CONFIG_PCCARD is not set
-
-#
-# Networking
-#
 CONFIG_NET=y
 
 #
@@ -254,6 +296,7 @@ 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 is not set
 CONFIG_INET=y
 CONFIG_IP_MULTICAST=y
@@ -273,6 +316,7 @@ CONFIG_SYN_COOKIES=y
 CONFIG_INET_XFRM_MODE_TRANSPORT=y
 CONFIG_INET_XFRM_MODE_TUNNEL=y
 CONFIG_INET_XFRM_MODE_BEET=y
+CONFIG_INET_LRO=m
 CONFIG_INET_DIAG=y
 CONFIG_INET_TCP_DIAG=y
 # CONFIG_TCP_CONG_ADVANCED is not set
@@ -280,8 +324,6 @@ CONFIG_TCP_CONG_CUBIC=y
 CONFIG_DEFAULT_TCP_CONG="cubic"
 # 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 is not set
 # CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
@@ -298,10 +340,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_LAPB is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-
-#
-# QoS and/or fair queueing
-#
 # CONFIG_NET_SCHED is not set
 
 #
@@ -309,6 +347,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 #
 # 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
@@ -330,13 +369,17 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 #
 # Generic Driver Options
 #
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 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
-# CONFIG_CONNECTOR is not set
+CONFIG_CONNECTOR=y
+CONFIG_PROC_EVENTS=y
 # CONFIG_MTD is not set
 # CONFIG_PARPORT is not set
 CONFIG_PNP=y
@@ -360,25 +403,35 @@ CONFIG_BLK_DEV_NBD=m
 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_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_PHANTOM is not set
 # CONFIG_EEPROM_93CX6 is not set
 CONFIG_SGI_IOC4=y
 # CONFIG_TIFM_CORE is not set
+# CONFIG_ENCLOSURE_SERVICES is not set
+CONFIG_SGI_XP=m
+# CONFIG_HP_ILO is not set
+CONFIG_SGI_GRU=m
+# CONFIG_SGI_GRU_DEBUG 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_TIMINGS=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_IDECD=y
+CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=y
 # CONFIG_BLK_DEV_IDETAPE is not set
 CONFIG_BLK_DEV_IDEFLOPPY=y
 CONFIG_BLK_DEV_IDESCSI=m
@@ -390,25 +443,26 @@ CONFIG_IDE_PROC_FS=y
 # IDE chipset support/bugfixes
 #
 # CONFIG_IDE_GENERIC is not set
+# CONFIG_BLK_DEV_PLATFORM is not set
 # CONFIG_BLK_DEV_IDEPNP is not set
+CONFIG_BLK_DEV_IDEDMA_SFF=y
+
+#
+# PCI IDE chipsets support
+#
 CONFIG_BLK_DEV_IDEPCI=y
-CONFIG_IDEPCI_SHARE_IRQ=y
 CONFIG_IDEPCI_PCIBUS_ORDER=y
 # CONFIG_BLK_DEV_OFFBOARD is not set
 CONFIG_BLK_DEV_GENERIC=y
 # CONFIG_BLK_DEV_OPTI621 is not set
 CONFIG_BLK_DEV_IDEDMA_PCI=y
-# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
-# CONFIG_IDEDMA_ONLYDISK 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=y
 # 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_JMICRON is not set
 # CONFIG_BLK_DEV_SC1200 is not set
@@ -425,10 +479,7 @@ CONFIG_BLK_DEV_SGIIOC4=y
 # CONFIG_BLK_DEV_TRM290 is not set
 # CONFIG_BLK_DEV_VIA82CXXX is not set
 # CONFIG_BLK_DEV_TC86C001 is not set
-# CONFIG_IDE_ARM is not set
 CONFIG_BLK_DEV_IDEDMA=y
-# CONFIG_IDEDMA_IVB is not set
-# CONFIG_BLK_DEV_HD is not set
 
 #
 # SCSI device support
@@ -468,10 +519,8 @@ CONFIG_SCSI_FC_ATTRS=y
 # CONFIG_SCSI_ISCSI_ATTRS is not set
 CONFIG_SCSI_SAS_ATTRS=y
 # CONFIG_SCSI_SAS_LIBSAS is not set
-
-#
-# SCSI low-level drivers
-#
+# CONFIG_SCSI_SRP_ATTRS is not set
+CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_ISCSI_TCP is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
 # CONFIG_SCSI_3W_9XXX is not set
@@ -481,6 +530,8 @@ CONFIG_SCSI_SAS_ATTRS=y
 # CONFIG_SCSI_AIC7XXX_OLD is not set
 # CONFIG_SCSI_AIC79XX is not set
 # CONFIG_SCSI_AIC94XX 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
@@ -491,12 +542,14 @@ CONFIG_SCSI_SAS_ATTRS=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=y
 CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
 CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
 CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
 CONFIG_SCSI_SYM53C8XX_MMIO=y
+# CONFIG_SCSI_IPR is not set
 CONFIG_SCSI_QLOGIC_1280=y
 # CONFIG_SCSI_QLA_FC is not set
 # CONFIG_SCSI_QLA_ISCSI is not set
@@ -505,7 +558,68 @@ CONFIG_SCSI_QLOGIC_1280=y
 # CONFIG_SCSI_DC390T is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_SRP is not set
-# CONFIG_ATA is not set
+# CONFIG_SCSI_DH is not set
+CONFIG_ATA=y
+CONFIG_ATA_NONSTANDARD=y
+CONFIG_ATA_ACPI=y
+CONFIG_SATA_PMP=y
+# CONFIG_SATA_AHCI is not set
+# CONFIG_SATA_SIL24 is not set
+CONFIG_ATA_SFF=y
+# CONFIG_SATA_SVW is not set
+CONFIG_ATA_PIIX=y
+# 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_ACPI is not set
+# CONFIG_PATA_ALI is not set
+# CONFIG_PATA_AMD is not set
+# CONFIG_PATA_ARTOP 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_PDC_OLD is not set
+# CONFIG_PATA_RADISYS 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_VIA is not set
+# CONFIG_PATA_WINBOND is not set
+# CONFIG_PATA_SCH is not set
 CONFIG_MD=y
 CONFIG_BLK_DEV_MD=m
 CONFIG_MD_LINEAR=m
@@ -522,36 +636,52 @@ CONFIG_DM_SNAPSHOT=m
 CONFIG_DM_MIRROR=m
 CONFIG_DM_ZERO=m
 CONFIG_DM_MULTIPATH=m
-# CONFIG_DM_MULTIPATH_EMC is not set
-# CONFIG_DM_MULTIPATH_RDAC is not set
 # CONFIG_DM_DELAY is not set
-
-#
-# Fusion MPT device support
-#
+# CONFIG_DM_UEVENT is not set
 CONFIG_FUSION=y
 CONFIG_FUSION_SPI=y
 CONFIG_FUSION_FC=m
 CONFIG_FUSION_SAS=y
 CONFIG_FUSION_MAX_SGE=128
 # CONFIG_FUSION_CTL is not set
+# CONFIG_FUSION_LOGGING is not set
 
 #
 # IEEE 1394 (FireWire) support
 #
+
+#
+# Enable only one of the two stacks, unless you know what you are doing
+#
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
 # CONFIG_I2O is not set
 CONFIG_NETDEVICES=y
-# CONFIG_NETDEVICES_MULTIQUEUE 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_NET_SB1000 is not set
 # CONFIG_ARCNET is not set
-# CONFIG_PHYLIB 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_FIXED_PHY is not set
+# CONFIG_MDIO_BITBANG is not set
 CONFIG_NET_ETHERNET=y
 CONFIG_MII=m
 # CONFIG_HAPPYMEAL is not set
@@ -569,13 +699,16 @@ CONFIG_TULIP=m
 # CONFIG_DM9102 is not set
 # CONFIG_ULI526X 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_NET_PCI=y
 # CONFIG_PCNET32 is not set
 # CONFIG_AMD8111_ETH is not set
 # CONFIG_ADAPTEC_STARFIRE is not set
 # CONFIG_B44 is not set
 # CONFIG_FORCEDETH is not set
-# CONFIG_DGRS is not set
 CONFIG_EEPRO100=m
 CONFIG_E100=m
 # CONFIG_FEALNX is not set
@@ -583,17 +716,22 @@ CONFIG_E100=m
 # CONFIG_NE2K_PCI is not set
 # CONFIG_8139CP is not set
 # CONFIG_8139TOO is not set
+# CONFIG_R6040 is not set
 # CONFIG_SIS900 is not set
 # CONFIG_EPIC100 is not set
 # CONFIG_SUNDANCE is not set
+# CONFIG_TLAN is not set
 # CONFIG_VIA_RHINE is not set
 # CONFIG_SC92031 is not set
 CONFIG_NETDEV_1000=y
 # CONFIG_ACENIC is not set
 # CONFIG_DL2K is not set
 CONFIG_E1000=y
-# CONFIG_E1000_NAPI is not set
 # CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
+# CONFIG_E1000E is not set
+# CONFIG_IP1000 is not set
+CONFIG_IGB=y
+# CONFIG_IGB_LRO is not set
 # CONFIG_NS83820 is not set
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
@@ -606,14 +744,20 @@ CONFIG_TIGON3=y
 # CONFIG_BNX2 is not set
 # CONFIG_QLA3XXX is not set
 # CONFIG_ATL1 is not set
+# CONFIG_ATL1E is not set
 CONFIG_NETDEV_10000=y
 # CONFIG_CHELSIO_T1 is not set
 # CONFIG_CHELSIO_T3 is not set
+# CONFIG_IXGBE is not set
 # CONFIG_IXGB is not set
 # CONFIG_S2IO is not set
 # CONFIG_MYRI10GE is not set
 # CONFIG_NETXEN_NIC is not set
+# CONFIG_NIU is not set
 # CONFIG_MLX4_CORE is not set
+# CONFIG_TEHUTI is not set
+# CONFIG_BNX2X is not set
+# CONFIG_SFC is not set
 # CONFIG_TR is not set
 
 #
@@ -621,6 +765,7 @@ CONFIG_NETDEV_10000=y
 #
 # CONFIG_WLAN_PRE80211 is not set
 # CONFIG_WLAN_80211 is not set
+# CONFIG_IWLWIFI_LEDS is not set
 
 #
 # USB Network Adapters
@@ -629,7 +774,6 @@ CONFIG_NETDEV_10000=y
 # 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_WAN is not set
 # CONFIG_FDDI is not set
@@ -637,8 +781,8 @@ CONFIG_NETDEV_10000=y
 # CONFIG_PPP is not set
 # CONFIG_SLIP is not set
 # CONFIG_NET_FC is not set
-# CONFIG_SHAPER is not set
 CONFIG_NETCONSOLE=y
+# CONFIG_NETCONSOLE_DYNAMIC is not set
 CONFIG_NETPOLL=y
 # CONFIG_NETPOLL_TRAP is not set
 CONFIG_NET_POLL_CONTROLLER=y
@@ -660,7 +804,6 @@ 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_TSDEV is not set
 # CONFIG_INPUT_EVDEV is not set
 # CONFIG_INPUT_EVBUG is not set
 
@@ -709,9 +852,11 @@ CONFIG_GAMEPORT=m
 # 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=y
 # CONFIG_COMPUTONE is not set
 # CONFIG_ROCKETPORT is not set
@@ -719,15 +864,16 @@ CONFIG_SERIAL_NONSTANDARD=y
 # CONFIG_DIGIEPCA is not set
 # CONFIG_MOXA_INTELLIO is not set
 # CONFIG_MOXA_SMARTIO is not set
-# CONFIG_MOXA_SMARTIO_NEW is not set
 # CONFIG_ISI is not set
 # CONFIG_SYNCLINKMP is not set
 # CONFIG_SYNCLINK_GT is not set
 # 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
 CONFIG_SGI_SNSC=y
 CONFIG_SGI_TIOCX=y
 CONFIG_SGI_MBCS=m
@@ -759,76 +905,100 @@ CONFIG_UNIX98_PTYS=y
 CONFIG_LEGACY_PTYS=y
 CONFIG_LEGACY_PTY_COUNT=256
 # CONFIG_IPMI_HANDLER is not set
-# CONFIG_WATCHDOG is not set
 # CONFIG_HW_RANDOM is not set
 CONFIG_EFI_RTC=y
 # CONFIG_R3964 is not set
 # CONFIG_APPLICOM is not set
-CONFIG_AGP=m
-CONFIG_AGP_I460=m
-CONFIG_AGP_HP_ZX1=m
-CONFIG_AGP_SGI_TIOCA=m
-CONFIG_DRM=m
-CONFIG_DRM_TDFX=m
-CONFIG_DRM_R128=m
-CONFIG_DRM_RADEON=m
-CONFIG_DRM_MGA=m
-CONFIG_DRM_SIS=m
-# CONFIG_DRM_VIA is not set
-# CONFIG_DRM_SAVAGE is not set
 CONFIG_RAW_DRIVER=m
 CONFIG_MAX_RAW_DEVS=256
 CONFIG_HPET=y
-# CONFIG_HPET_RTC_IRQ is not set
 CONFIG_HPET_MMAP=y
 # CONFIG_HANGCHECK_TIMER is not set
 CONFIG_MMTIMER=y
 # CONFIG_TCG_TPM is not set
 CONFIG_DEVPORT=y
 # CONFIG_I2C is not set
-
-#
-# SPI support
-#
 # CONFIG_SPI is not set
-# CONFIG_SPI_MASTER is not set
 # CONFIG_W1 is not set
-# CONFIG_POWER_SUPPLY is not set
+CONFIG_POWER_SUPPLY=y
+# CONFIG_POWER_SUPPLY_DEBUG is not set
+# CONFIG_PDA_POWER is not set
+# CONFIG_BATTERY_DS2760 is not set
 CONFIG_HWMON=y
 # CONFIG_HWMON_VID is not set
-# CONFIG_SENSORS_ABITUGURU is not set
+# CONFIG_SENSORS_I5K_AMB is not set
 # CONFIG_SENSORS_F71805F is not set
+# CONFIG_SENSORS_F71882FG is not set
+# CONFIG_SENSORS_IT87 is not set
+# CONFIG_SENSORS_PC87360 is not set
 # CONFIG_SENSORS_PC87427 is not set
+# CONFIG_SENSORS_SIS5595 is not set
 # CONFIG_SENSORS_SMSC47M1 is not set
 # CONFIG_SENSORS_SMSC47B397 is not set
+# CONFIG_SENSORS_VIA686A is not set
 # CONFIG_SENSORS_VT1211 is not set
+# 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=m
+# CONFIG_THERMAL_HWMON is not set
+# CONFIG_WATCHDOG is not set
+
+#
+# Sonics Silicon Backplane
+#
+CONFIG_SSB_POSSIBLE=y
+# 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
 
 #
 # 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_USB_DABUSB is not set
 
 #
 # Graphics support
 #
+CONFIG_AGP=m
+CONFIG_AGP_I460=m
+CONFIG_AGP_HP_ZX1=m
+CONFIG_AGP_SGI_TIOCA=m
+CONFIG_DRM=m
+CONFIG_DRM_TDFX=m
+CONFIG_DRM_R128=m
+CONFIG_DRM_RADEON=m
+CONFIG_DRM_MGA=m
+CONFIG_DRM_SIS=m
+# CONFIG_DRM_VIA is not set
+# CONFIG_DRM_SAVAGE 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
-# CONFIG_VGASTATE is not set
-# CONFIG_FB is not set
 
 #
 # Console display driver support
@@ -836,15 +1006,7 @@ CONFIG_DAB=y
 CONFIG_VGA_CONSOLE=y
 # CONFIG_VGACON_SOFT_SCROLLBACK is not set
 CONFIG_DUMMY_CONSOLE=y
-
-#
-# Sound
-#
 CONFIG_SOUND=m
-
-#
-# Advanced Linux Sound Architecture
-#
 CONFIG_SND=m
 CONFIG_SND_TIMER=m
 CONFIG_SND_PCM=m
@@ -862,22 +1024,18 @@ CONFIG_SND_SUPPORT_OLD_API=y
 CONFIG_SND_VERBOSE_PROCFS=y
 CONFIG_SND_VERBOSE_PRINTK=y
 # CONFIG_SND_DEBUG is not set
-
-#
-# Generic devices
-#
+CONFIG_SND_VMASTER=y
 CONFIG_SND_MPU401_UART=m
 CONFIG_SND_OPL3_LIB=m
 CONFIG_SND_AC97_CODEC=m
+CONFIG_SND_DRIVERS=y
 CONFIG_SND_DUMMY=m
 CONFIG_SND_VIRMIDI=m
 CONFIG_SND_MTPAV=m
 CONFIG_SND_SERIAL_U16550=m
 CONFIG_SND_MPU401=m
-
-#
-# PCI devices
-#
+# CONFIG_SND_AC97_POWER_SAVE is not set
+CONFIG_SND_PCI=y
 # CONFIG_SND_AD1889 is not set
 # CONFIG_SND_ALS300 is not set
 # CONFIG_SND_ALI5451 is not set
@@ -886,10 +1044,12 @@ CONFIG_SND_MPU401=m
 # CONFIG_SND_AU8810 is not set
 # CONFIG_SND_AU8820 is not set
 # CONFIG_SND_AU8830 is not set
+# CONFIG_SND_AW2 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_OXYGEN is not set
 CONFIG_SND_CS4281=m
 CONFIG_SND_CS46XX=m
 CONFIG_SND_CS46XX_NEW_DSP=y
@@ -912,10 +1072,10 @@ CONFIG_SND_EMU10K1=m
 # CONFIG_SND_ES1938 is not set
 # CONFIG_SND_ES1968 is not set
 CONFIG_SND_FM801=m
-# CONFIG_SND_FM801_TEA575X_BOOL is not set
 # CONFIG_SND_HDA_INTEL is not set
 # CONFIG_SND_HDSP is not set
 # CONFIG_SND_HDSPM is not set
+# CONFIG_SND_HIFIER is not set
 # CONFIG_SND_ICE1712 is not set
 # CONFIG_SND_ICE1724 is not set
 # CONFIG_SND_INTEL8X0 is not set
@@ -933,29 +1093,19 @@ CONFIG_SND_FM801=m
 # CONFIG_SND_TRIDENT is not set
 # CONFIG_SND_VIA82XX is not set
 # CONFIG_SND_VIA82XX_MODEM is not set
+# CONFIG_SND_VIRTUOSO is not set
 # CONFIG_SND_VX222 is not set
 # CONFIG_SND_YMFPCI is not set
-# CONFIG_SND_AC97_POWER_SAVE is not set
-
-#
-# USB devices
-#
+CONFIG_SND_USB=y
 # CONFIG_SND_USB_AUDIO is not set
 # CONFIG_SND_USB_CAIAQ is not set
-
-#
-# System on Chip audio support
-#
 # CONFIG_SND_SOC is not set
-
-#
-# Open Sound System
-#
 # CONFIG_SOUND_PRIME is not set
 CONFIG_AC97_BUS=m
 CONFIG_HID_SUPPORT=y
 CONFIG_HID=y
 # CONFIG_HID_DEBUG is not set
+# CONFIG_HIDRAW is not set
 
 #
 # USB Input Devices
@@ -976,6 +1126,7 @@ CONFIG_USB_ARCH_HAS_OHCI=y
 CONFIG_USB_ARCH_HAS_EHCI=y
 CONFIG_USB=m
 # CONFIG_USB_DEBUG is not set
+# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
 
 #
 # Miscellaneous USB options
@@ -984,17 +1135,17 @@ CONFIG_USB_DEVICEFS=y
 CONFIG_USB_DEVICE_CLASS=y
 # CONFIG_USB_DYNAMIC_MINORS is not set
 # CONFIG_USB_SUSPEND is not set
-# CONFIG_USB_PERSIST is not set
 # CONFIG_USB_OTG is not set
 
 #
 # USB Host Controller Drivers
 #
+# CONFIG_USB_C67X00_HCD is not set
 CONFIG_USB_EHCI_HCD=m
-# CONFIG_USB_EHCI_SPLIT_ISO is not set
 # CONFIG_USB_EHCI_ROOT_HUB_TT is not set
 # CONFIG_USB_EHCI_TT_NEWSCHED is not set
 # CONFIG_USB_ISP116X_HCD is not set
+# CONFIG_USB_ISP1760_HCD is not set
 CONFIG_USB_OHCI_HCD=m
 # CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
 # CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
@@ -1008,6 +1159,7 @@ CONFIG_USB_UHCI_HCD=m
 #
 # CONFIG_USB_ACM is not set
 # CONFIG_USB_PRINTER is not set
+# CONFIG_USB_WDM is not set
 
 #
 # NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
@@ -1027,7 +1179,9 @@ CONFIG_USB_STORAGE=m
 # 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
 
 #
@@ -1040,10 +1194,6 @@ CONFIG_USB_MON=y
 #
 # USB port drivers
 #
-
-#
-# USB Serial Converter support
-#
 # CONFIG_USB_SERIAL is not set
 
 #
@@ -1069,67 +1219,32 @@ CONFIG_USB_MON=y
 # CONFIG_USB_TRANCEVIBRATOR is not set
 # CONFIG_USB_IOWARRIOR is not set
 # CONFIG_USB_TEST is not set
-
-#
-# USB DSL modem support
-#
-
-#
-# USB Gadget Support
-#
+# CONFIG_USB_ISIGHTFW is not set
 # CONFIG_USB_GADGET 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
-#
+# CONFIG_ACCESSIBILITY is not set
 CONFIG_INFINIBAND=m
 # CONFIG_INFINIBAND_USER_MAD is not set
 # CONFIG_INFINIBAND_USER_ACCESS is not set
 CONFIG_INFINIBAND_ADDR_TRANS=y
 CONFIG_INFINIBAND_MTHCA=m
 CONFIG_INFINIBAND_MTHCA_DEBUG=y
+# CONFIG_INFINIBAND_IPATH is not set
 # CONFIG_INFINIBAND_AMSO1100 is not set
 # CONFIG_MLX4_INFINIBAND is not set
+# CONFIG_INFINIBAND_NES is not set
 CONFIG_INFINIBAND_IPOIB=m
 # CONFIG_INFINIBAND_IPOIB_CM is not set
 CONFIG_INFINIBAND_IPOIB_DEBUG=y
 # CONFIG_INFINIBAND_IPOIB_DEBUG_DATA is not set
 # CONFIG_INFINIBAND_SRP is not set
 # CONFIG_INFINIBAND_ISER is not set
-
-#
-# Real Time Clock
-#
 # CONFIG_RTC_CLASS is not set
-
-#
-# DMA Engine support
-#
-# CONFIG_DMA_ENGINE is not set
-
-#
-# DMA Clients
-#
-
-#
-# DMA Devices
-#
-
-#
-# Userspace I/O
-#
+# CONFIG_DMADEVICES is not set
 # CONFIG_UIO is not set
-# CONFIG_MSPEC is not set
+CONFIG_MSPEC=m
 
 #
 # File systems
@@ -1145,7 +1260,6 @@ 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=y
 # CONFIG_REISERFS_CHECK is not set
@@ -1157,17 +1271,15 @@ CONFIG_REISERFS_FS_SECURITY=y
 CONFIG_FS_POSIX_ACL=y
 CONFIG_XFS_FS=y
 # CONFIG_XFS_QUOTA is not set
-# CONFIG_XFS_SECURITY is not set
 # CONFIG_XFS_POSIX_ACL is not set
 # 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_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
 # CONFIG_QUOTA is not set
-CONFIG_DNOTIFY=y
 CONFIG_AUTOFS_FS=y
 CONFIG_AUTOFS4_FS=y
 # CONFIG_FUSE_FS is not set
@@ -1205,7 +1317,6 @@ CONFIG_TMPFS=y
 # CONFIG_TMPFS_POSIX_ACL is not set
 CONFIG_HUGETLBFS=y
 CONFIG_HUGETLB_PAGE=y
-CONFIG_RAMFS=y
 # CONFIG_CONFIGFS_FS is not set
 
 #
@@ -1220,32 +1331,30 @@ CONFIG_RAMFS=y
 # CONFIG_EFS_FS is not set
 # CONFIG_CRAMFS 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
-
-#
-# Network File Systems
-#
+CONFIG_NETWORK_FILESYSTEMS=y
 CONFIG_NFS_FS=m
 CONFIG_NFS_V3=y
 # CONFIG_NFS_V3_ACL is not set
 CONFIG_NFS_V4=y
-CONFIG_NFS_DIRECTIO=y
 CONFIG_NFSD=m
 CONFIG_NFSD_V3=y
 # CONFIG_NFSD_V3_ACL is not set
 CONFIG_NFSD_V4=y
-CONFIG_NFSD_TCP=y
 CONFIG_LOCKD=m
 CONFIG_LOCKD_V4=y
 CONFIG_EXPORTFS=m
 CONFIG_NFS_COMMON=y
 CONFIG_SUNRPC=m
 CONFIG_SUNRPC_GSS=m
-# CONFIG_SUNRPC_BIND34 is not set
-CONFIG_RPCSEC_GSS_KRB5=y
+CONFIG_SUNRPC_XPRT_RDMA=m
+CONFIG_RPCSEC_GSS_KRB5=m
 # CONFIG_RPCSEC_GSS_SPKM3 is not set
 CONFIG_SMB_FS=m
 CONFIG_SMB_NLS_DEFAULT=y
@@ -1281,10 +1390,6 @@ CONFIG_SGI_PARTITION=y
 # CONFIG_KARMA_PARTITION is not set
 CONFIG_EFI_PARTITION=y
 # CONFIG_SYSV68_PARTITION is not set
-
-#
-# Native Language Support
-#
 CONFIG_NLS=y
 CONFIG_NLS_DEFAULT="iso8859-1"
 CONFIG_NLS_CODEPAGE_437=y
@@ -1325,22 +1430,24 @@ CONFIG_NLS_ISO8859_15=m
 CONFIG_NLS_KOI8_R=m
 CONFIG_NLS_KOI8_U=m
 CONFIG_NLS_UTF8=m
-
-#
-# Distributed Lock Manager
-#
 # CONFIG_DLM is not set
+CONFIG_HAVE_KVM=y
+CONFIG_VIRTUALIZATION=y
+# CONFIG_KVM is not set
 
 #
 # Library routines
 #
 CONFIG_BITREVERSE=y
+# CONFIG_GENERIC_FIND_FIRST_BIT is not set
 # CONFIG_CRC_CCITT is not set
 # CONFIG_CRC16 is not set
-# CONFIG_CRC_ITU_T is not set
+CONFIG_CRC_T10DIF=y
+CONFIG_CRC_ITU_T=m
 CONFIG_CRC32=y
 # CONFIG_CRC7 is not set
 # CONFIG_LIBCRC32C is not set
+CONFIG_GENERIC_ALLOCATOR=y
 CONFIG_PLIST=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT=y
@@ -1357,17 +1464,13 @@ CONFIG_IRQ_PER_CPU=y
 # CONFIG_HP_SIMSERIAL is not set
 # CONFIG_HP_SIMSCSI is not set
 
-#
-# Instrumentation Support
-#
-# CONFIG_PROFILING is not set
-# CONFIG_KPROBES is not set
-
 #
 # Kernel hacking
 #
 # CONFIG_PRINTK_TIME is not set
+CONFIG_ENABLE_WARN_DEPRECATED=y
 CONFIG_ENABLE_MUST_CHECK=y
+CONFIG_FRAME_WARN=2048
 CONFIG_MAGIC_SYSRQ=y
 # CONFIG_UNUSED_SYMBOLS is not set
 # CONFIG_DEBUG_FS is not set
@@ -1375,10 +1478,14 @@ CONFIG_MAGIC_SYSRQ=y
 CONFIG_DEBUG_KERNEL=y
 # CONFIG_DEBUG_SHIRQ is not set
 CONFIG_DETECT_SOFTLOCKUP=y
+# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
+CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
 CONFIG_SCHED_DEBUG=y
 # CONFIG_SCHEDSTATS is not set
 # CONFIG_TIMER_STATS is not set
-# CONFIG_DEBUG_SLAB is not set
+# CONFIG_DEBUG_OBJECTS is not set
+# CONFIG_SLUB_DEBUG_ON is not set
+# CONFIG_SLUB_STATS is not set
 # CONFIG_DEBUG_RT_MUTEXES is not set
 # CONFIG_RT_MUTEX_TESTER is not set
 # CONFIG_DEBUG_SPINLOCK is not set
@@ -1388,10 +1495,15 @@ CONFIG_DEBUG_MUTEXES=y
 # 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=y
 # CONFIG_DEBUG_LIST is not set
-CONFIG_FORCED_INLINING=y
+# CONFIG_DEBUG_SG 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_FAULT_INJECTION is not set
+# CONFIG_SAMPLES is not set
 CONFIG_IA64_GRANULE_16MB=y
 # CONFIG_IA64_GRANULE_64MB is not set
 # CONFIG_IA64_PRINT_HAZARDS is not set
@@ -1405,41 +1517,85 @@ CONFIG_SYSVIPC_COMPAT=y
 #
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
+# CONFIG_SECURITY_FILE_CAPABILITIES is not set
 CONFIG_CRYPTO=y
+
+#
+# Crypto core or helper
+#
 CONFIG_CRYPTO_ALGAPI=y
 CONFIG_CRYPTO_BLKCIPHER=m
 CONFIG_CRYPTO_MANAGER=m
+# 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=m
+# CONFIG_CRYPTO_CTR is not set
+# CONFIG_CRYPTO_CTS is not set
+CONFIG_CRYPTO_ECB=m
+# CONFIG_CRYPTO_LRW is not set
+CONFIG_CRYPTO_PCBC=m
+# CONFIG_CRYPTO_XTS is not set
+
+#
+# Hash modes
+#
 # CONFIG_CRYPTO_HMAC is not set
 # CONFIG_CRYPTO_XCBC is not set
-# CONFIG_CRYPTO_NULL is not set
+
+#
+# Digest
+#
+# CONFIG_CRYPTO_CRC32C is not set
 # CONFIG_CRYPTO_MD4 is not set
 CONFIG_CRYPTO_MD5=y
+# 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_WP512 is not set
 # CONFIG_CRYPTO_TGR192 is not set
-# CONFIG_CRYPTO_GF128MUL is not set
-CONFIG_CRYPTO_ECB=m
-CONFIG_CRYPTO_CBC=m
-CONFIG_CRYPTO_PCBC=m
-# CONFIG_CRYPTO_LRW is not set
-# CONFIG_CRYPTO_CRYPTD is not set
-CONFIG_CRYPTO_DES=m
-# CONFIG_CRYPTO_FCRYPT is not set
-# CONFIG_CRYPTO_BLOWFISH is not set
-# CONFIG_CRYPTO_TWOFISH is not set
-# CONFIG_CRYPTO_SERPENT 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_TEA is not set
-# CONFIG_CRYPTO_ARC4 is not set
+CONFIG_CRYPTO_DES=m
+# CONFIG_CRYPTO_FCRYPT is not set
 # CONFIG_CRYPTO_KHAZAD is not set
-# CONFIG_CRYPTO_ANUBIS 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_MICHAEL_MIC is not set
-# CONFIG_CRYPTO_CRC32C is not set
-# CONFIG_CRYPTO_CAMELLIA is not set
-# CONFIG_CRYPTO_TEST is not set
+# CONFIG_CRYPTO_LZO is not set
 CONFIG_CRYPTO_HW=y
+# CONFIG_CRYPTO_DEV_HIFN_795X is not set
similarity index 99%
rename from include/asm-ia64/acpi.h
rename to arch/ia64/include/asm/acpi.h
index fcfad32..0f82cc2 100644 (file)
@@ -1,6 +1,4 @@
 /*
- *  asm-ia64/acpi.h
- *
  *  Copyright (C) 1999 VA Linux Systems
  *  Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
  *  Copyright (C) 2000,2001 J.I. Lee <jung-ik.lee@intel.com>
similarity index 97%
rename from include/asm-ia64/cputime.h
rename to arch/ia64/include/asm/cputime.h
index f9abdec..d20b998 100644 (file)
@@ -1,6 +1,5 @@
 /*
- * include/asm-ia64/cputime.h:
- *             Definitions for measuring cputime on ia64 machines.
+ * Definitions for measuring cputime on ia64 machines.
  *
  * Based on <asm-powerpc/cputime.h>.
  *
similarity index 98%
rename from include/asm-ia64/kdebug.h
rename to arch/ia64/include/asm/kdebug.h
index 35e4940..d11a698 100644 (file)
@@ -1,8 +1,6 @@
 #ifndef _IA64_KDEBUG_H
 #define _IA64_KDEBUG_H 1
 /*
- * include/asm-ia64/kdebug.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
similarity index 99%
rename from include/asm-ia64/kprobes.h
rename to arch/ia64/include/asm/kprobes.h
index ef71b57..dbf83fb 100644 (file)
@@ -2,7 +2,6 @@
 #define _ASM_KPROBES_H
 /*
  *  Kernel Probes (KProbes)
- *  include/asm-ia64/kprobes.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
similarity index 98%
rename from include/asm-ia64/kvm.h
rename to arch/ia64/include/asm/kvm.h
index 3f6a090..f38472a 100644 (file)
@@ -2,7 +2,7 @@
 #define __ASM_IA64_KVM_H
 
 /*
- * asm-ia64/kvm.h: kvm structure definitions  for ia64
+ * kvm structure definitions  for ia64
  *
  * Copyright (C) 2007 Xiantao Zhang <xiantao.zhang@intel.com>
  *
similarity index 97%
rename from include/asm-ia64/kvm_para.h
rename to arch/ia64/include/asm/kvm_para.h
index 9f9796b..0d6d8ca 100644 (file)
@@ -2,8 +2,6 @@
 #define __IA64_KVM_PARA_H
 
 /*
- * asm-ia64/kvm_para.h
- *
  * Copyright (C) 2007 Xiantao Zhang <xiantao.zhang@intel.com>
  *
  * This program is free software; you can redistribute it and/or modify it
similarity index 99%
rename from include/asm-ia64/machvec.h
rename to arch/ia64/include/asm/machvec.h
index a6d50c7..2b850cc 100644 (file)
@@ -290,7 +290,7 @@ extern void machvec_init (const char *name);
 extern void machvec_init_from_cmdline(const char *cmdline);
 
 # else
-#  error Unknown configuration.  Update asm-ia64/machvec.h.
+#  error Unknown configuration.  Update arch/ia64/include/asm/machvec.h.
 # endif /* CONFIG_IA64_GENERIC */
 
 /*
similarity index 99%
rename from include/asm-ia64/native/inst.h
rename to arch/ia64/include/asm/native/inst.h
index c953a2c..c8efbf7 100644 (file)
@@ -1,5 +1,5 @@
 /******************************************************************************
- * include/asm-ia64/native/inst.h
+ * arch/ia64/include/asm/native/inst.h
  *
  * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp>
  *                    VA Linux Systems Japan K.K.
similarity index 93%
rename from include/asm-ia64/native/irq.h
rename to arch/ia64/include/asm/native/irq.h
index efe9ff7..887a228 100644 (file)
@@ -1,5 +1,5 @@
 /******************************************************************************
- * include/asm-ia64/native/irq.h
+ * arch/ia64/include/asm/native/irq.h
  *
  * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp>
  *                    VA Linux Systems Japan K.K.
@@ -17,8 +17,6 @@
  * 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
- *
- * moved from linux/include/asm-ia64/irq.h.
  */
 
 #ifndef _ASM_IA64_NATIVE_IRQ_H
similarity index 99%
rename from include/asm-ia64/paravirt.h
rename to arch/ia64/include/asm/paravirt.h
index 1b4df12..660cab0 100644 (file)
@@ -1,6 +1,4 @@
 /******************************************************************************
- * include/asm-ia64/paravirt.h
- *
  * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp>
  *                    VA Linux Systems Japan K.K.
  *
similarity index 98%
rename from include/asm-ia64/paravirt_privop.h
rename to arch/ia64/include/asm/paravirt_privop.h
index 52482e6..d577aac 100644 (file)
@@ -1,6 +1,4 @@
 /******************************************************************************
- * include/asm-ia64/paravirt_privops.h
- *
  * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp>
  *                    VA Linux Systems Japan K.K.
  *
similarity index 99%
rename from include/asm-ia64/rwsem.h
rename to arch/ia64/include/asm/rwsem.h
index 8aba06a..fbee74b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * asm-ia64/rwsem.h: R/W semaphores for ia64
+ * R/W semaphores for ia64
  *
  * Copyright (C) 2003 Ken Chen <kenneth.w.chen@intel.com>
  * Copyright (C) 2003 Asit Mallick <asit.k.mallick@intel.com>
similarity index 93%
rename from include/asm-ia64/serial.h
rename to arch/ia64/include/asm/serial.h
index 0c7a2f3..068be11 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * include/asm-ia64/serial.h
- *
  * Derived from the i386 version.
  */
 
similarity index 76%
rename from include/asm-ia64/sn/mspec.h
rename to arch/ia64/include/asm/sn/mspec.h
index dbe13c6..c1d3c50 100644 (file)
@@ -4,7 +4,7 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (c) 2001-2004 Silicon Graphics, Inc.  All rights reserved.
+ * Copyright (c) 2001-2008 Silicon Graphics, Inc.  All rights reserved.
  */
 
 #ifndef _ASM_IA64_SN_MSPEC_H
 #ifdef __KERNEL__
 
 /*
- * Each Atomic Memory Operation (AMO formerly known as fetchop)
+ * Each Atomic Memory Operation (amo, formerly known as fetchop)
  * variable is 64 bytes long.  The first 8 bytes are used.  The
  * remaining 56 bytes are unaddressable due to the operation taking
  * that portion of the address.
  *
- * NOTE: The AMO_t _MUST_ be placed in either the first or second half
- * of the cache line.  The cache line _MUST NOT_ be used for anything
- * other than additional AMO_t entries.  This is because there are two
+ * NOTE: The amo structure _MUST_ be placed in either the first or second
+ * half of the cache line.  The cache line _MUST NOT_ be used for anything
+ * other than additional amo entries.  This is because there are two
  * addresses which reference the same physical cache line.  One will
  * be a cached entry with the memory type bits all set.  This address
- * may be loaded into processor cache.  The AMO_t will be referenced
+ * may be loaded into processor cache.  The amo will be referenced
  * uncached via the memory special memory type.  If any portion of the
  * cached cache-line is modified, when that line is flushed, it will
  * overwrite the uncached value in physical memory and lead to
  * inconsistency.
  */
-typedef struct {
+struct amo {
         u64 variable;
         u64 unused[7];
-} AMO_t;
+};
 
 
 #endif /* __KERNEL__ */
similarity index 99%
rename from include/asm-ia64/sn/sn_sal.h
rename to arch/ia64/include/asm/sn/sn_sal.h
index 676b31a..57e649d 100644 (file)
@@ -1094,7 +1094,7 @@ ia64_sn_get_sn_info(int fc, u8 *shubtype, u16 *nasid_bitmask, u8 *nasid_shift,
 /*
  * This is the access point to the Altix PROM hardware performance
  * and status monitoring interface. For info on using this, see
- * include/asm-ia64/sn/sn2/sn_hwperf.h
+ * arch/ia64/include/asm/sn/sn2/sn_hwperf.h
  */
 static inline int
 ia64_sn_hwperf_op(nasid_t nasid, u64 opcode, u64 a0, u64 a1, u64 a2,
similarity index 98%
rename from include/asm-ia64/topology.h
rename to arch/ia64/include/asm/topology.h
index 32863b3..35bcb64 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * linux/include/asm-ia64/topology.h
- *
  * Copyright (C) 2002, Erich Focht, NEC
  *
  * All rights reserved.
similarity index 97%
rename from include/asm-ia64/xor.h
rename to arch/ia64/include/asm/xor.h
index 41fb874..a349e23 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * include/asm-ia64/xor.h
- *
  * Optimized RAID-5 checksumming functions for IA-64.
  *
  * This program is free software; you can redistribute it and/or modify
index c64a55a..94c44b1 100644 (file)
 #include <linux/pid.h>
 #include <linux/clocksource.h>
 #include <linux/kbuild.h>
-#include <asm-ia64/processor.h>
-#include <asm-ia64/ptrace.h>
-#include <asm-ia64/siginfo.h>
-#include <asm-ia64/sigcontext.h>
-#include <asm-ia64/mca.h>
+#include <asm/processor.h>
+#include <asm/ptrace.h>
+#include <asm/siginfo.h>
+#include <asm/sigcontext.h>
+#include <asm/mca.h>
 
 #include "../kernel/sigframe.h"
 #include "../kernel/fsyscall_gtod_data.h"
index db540e5..41c7129 100644 (file)
@@ -1123,7 +1123,7 @@ SET_REG(b5);
         *   p15    - used to track flag status.
         *
         * If you patch this code to use more registers, do not forget to update
-        * the clobber lists for spin_lock() in include/asm-ia64/spinlock.h.
+        * the clobber lists for spin_lock() in arch/ia64/include/asm/spinlock.h.
         */
 
 #if (__GNUC__ == 3 && __GNUC_MINOR__ < 3)
index 3bc2fa6..5c4674a 100644 (file)
@@ -69,7 +69,7 @@
  *     systems, we use one-to-one mapping between IA-64 vector and IRQ.  A
  *     platform can implement platform_irq_to_vector(irq) and
  *     platform_local_vector_to_irq(vector) APIs to differentiate the mapping.
- *     Please see also include/asm-ia64/hw_irq.h for those APIs.
+ *     Please see also arch/ia64/include/asm/hw_irq.h for those APIs.
  *
  * To sum up, there are three levels of mappings involved:
  *
index c39627d..416a952 100644 (file)
@@ -1243,11 +1243,11 @@ ENTRY(speculation_vector)
 
        add r17=r17,r18                 // now add the offset
        ;;
-       MOV_FROM_IIP(r17)
+       MOV_TO_IIP(r17, r19)
        dep r16=0,r16,41,2              // clear EI
        ;;
 
-       MOV_FROM_IPSR(p0, r16)
+       MOV_TO_IPSR(p0, r16, r19)
        ;;
 
        RFI
index 6216302..f69389c 100644 (file)
@@ -45,7 +45,7 @@
  * to the correct location.
  */
 #include <asm/asmmacro.h>
-#include <asm-ia64/break.h>
+#include <asm/break.h>
 
        /*
         * void jprobe_break(void)
index 1ae0491..8273afc 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <linux/kbuild.h>
 #include <linux/threads.h>
-#include <asm-ia64/native/irq.h>
+#include <asm/native/irq.h>
 
 void foo(void)
 {
index e5c2de9..593279f 100644 (file)
@@ -314,7 +314,7 @@ static inline void __init setup_crashkernel(unsigned long total, int *n)
  *
  * Setup the reserved memory areas set aside for the boot parameters,
  * initrd, etc.  There are currently %IA64_MAX_RSVD_REGIONS defined,
- * see include/asm-ia64/meminit.h if you need to define more.
+ * see arch/ia64/include/asm/meminit.h if you need to define more.
  */
 void __init
 reserve_memory (void)
index c45fc7f..b0f6157 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/mm.h>
 #include <linux/hugetlb.h>
 #include <linux/pagemap.h>
+#include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/sysctl.h>
 #include <linux/log2.h>
@@ -21,7 +22,8 @@
 #include <asm/tlb.h>
 #include <asm/tlbflush.h>
 
-unsigned int hpage_shift=HPAGE_SHIFT_DEFAULT;
+unsigned int hpage_shift = HPAGE_SHIFT_DEFAULT;
+EXPORT_SYMBOL(hpage_shift);
 
 pte_t *
 huge_pte_alloc(struct mm_struct *mm, unsigned long addr, unsigned long sz)
index ab7e2fd..c77ebdf 100644 (file)
@@ -63,7 +63,7 @@ EXPORT_SYMBOL(sn_io_addr);
 /**
  * __sn_mmiowb - I/O space memory barrier
  *
- * See include/asm-ia64/io.h and Documentation/DocBook/deviceiobook.tmpl
+ * See arch/ia64/include/asm/io.h and Documentation/DocBook/deviceiobook.tmpl
  * for details.
  *
  * On SN2, we wait for the PIO_WRITE_STATUS SHub register to clear.
index dae9c98..c7b25b0 100644 (file)
@@ -11,7 +11,6 @@
 #include <linux/mm.h>
 #include <linux/delay.h>
 #include <linux/init.h>
-#include <linux/ide.h>
 
 #include <asm/traps.h>
 #include <asm/bootinfo.h>
index f3b27d0..1bdb03c 100644 (file)
@@ -27,7 +27,6 @@
 #include <linux/mm.h>
 #include <linux/delay.h>
 #include <linux/init.h>
-#include <linux/ide.h>
 #include <linux/module.h>
 
 #include <asm/bootinfo.h>
index b4c4eaa..4da736e 100644 (file)
@@ -3,6 +3,7 @@ config MIPS
        default y
        select HAVE_IDE
        select HAVE_OPROFILE
+       select HAVE_ARCH_KGDB
        # Horrible source of confusion.  Die, die, die ...
        select EMBEDDED
        select RTC_LIB
@@ -34,7 +35,6 @@ config BASLER_EXCITE
        select SYS_HAS_CPU_RM9000
        select SYS_SUPPORTS_32BIT_KERNEL
        select SYS_SUPPORTS_BIG_ENDIAN
-       select SYS_SUPPORTS_KGDB
        help
          The eXcite is a smart camera platform manufactured by
          Basler Vision Technologies AG.
@@ -280,7 +280,6 @@ config PMC_MSP
        select SYS_HAS_CPU_MIPS32_R2
        select SYS_SUPPORTS_32BIT_KERNEL
        select SYS_SUPPORTS_BIG_ENDIAN
-       select SYS_SUPPORTS_KGDB
        select IRQ_CPU
        select SERIAL_8250
        select SERIAL_8250_CONSOLE
@@ -306,7 +305,6 @@ config PMC_YOSEMITE
        select SYS_SUPPORTS_64BIT_KERNEL
        select SYS_SUPPORTS_BIG_ENDIAN
        select SYS_SUPPORTS_HIGHMEM
-       select SYS_SUPPORTS_KGDB
        select SYS_SUPPORTS_SMP
        help
          Yosemite is an evaluation board for the RM9000x2 processor
@@ -359,7 +357,6 @@ config SGI_IP27
        select SYS_HAS_CPU_R10000
        select SYS_SUPPORTS_64BIT_KERNEL
        select SYS_SUPPORTS_BIG_ENDIAN
-       select SYS_SUPPORTS_KGDB
        select SYS_SUPPORTS_NUMA
        select SYS_SUPPORTS_SMP
        select GENERIC_HARDIRQS_NO__DO_IRQ
@@ -475,7 +472,6 @@ config SIBYTE_SWARM
        select SYS_HAS_CPU_SB1
        select SYS_SUPPORTS_BIG_ENDIAN
        select SYS_SUPPORTS_HIGHMEM
-       select SYS_SUPPORTS_KGDB
        select SYS_SUPPORTS_LITTLE_ENDIAN
        select ZONE_DMA32 if 64BIT
 
@@ -868,7 +864,6 @@ config SOC_PNX8550
        select SYS_HAS_EARLY_PRINTK
        select SYS_SUPPORTS_32BIT_KERNEL
        select GENERIC_HARDIRQS_NO__DO_IRQ
-       select SYS_SUPPORTS_KGDB
        select GENERIC_GPIO
 
 config SWAP_IO_SPACE
index f18cf92..765c8e2 100644 (file)
@@ -34,28 +34,6 @@ config SMTC_IDLE_HOOK_DEBUG
          arch/mips/kernel/smtc.c.  This debugging option result in significant
          overhead so should be disabled in production kernels.
 
-config KGDB
-       bool "Remote GDB kernel debugging"
-       depends on DEBUG_KERNEL && SYS_SUPPORTS_KGDB
-       select DEBUG_INFO
-       help
-         If you say Y here, it will be possible to remotely debug the MIPS
-         kernel using gdb. This enlarges your kernel image disk size by
-         several megabytes and requires a machine with more than 16 MB,
-         better 32 MB RAM to avoid excessive linking time. This is only
-         useful for kernel hackers. If unsure, say N.
-
-config SYS_SUPPORTS_KGDB
-       bool
-
-config GDB_CONSOLE
-       bool "Console output to GDB"
-       depends on KGDB
-       help
-         If you are using GDB for remote debugging over a serial port and
-         would like kernel messages to be formatted into GDB $O packets so
-         that GDB prints them as program output, say 'Y'.
-
 config SB1XXX_CORELIS
        bool "Corelis Debugger"
        depends on SIBYTE_SB1xxx_SOC
index 1fe97cc..e4a057d 100644 (file)
@@ -134,4 +134,3 @@ config SOC_AU1X00
        select SYS_HAS_CPU_MIPS32_R1
        select SYS_SUPPORTS_32BIT_KERNEL
        select SYS_SUPPORTS_APM_EMULATION
-       select SYS_SUPPORTS_KGDB
index dd0e19d..df48fd6 100644 (file)
@@ -9,7 +9,6 @@ obj-y += prom.o irq.o puts.o time.o reset.o \
        au1xxx_irqmap.o clocks.o platform.o power.o setup.o \
        sleeper.o cputable.o dma.o dbdma.o gpio.o
 
-obj-$(CONFIG_KGDB)             += dbg_io.o
 obj-$(CONFIG_PCI)              += pci.o
 
 EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/au1000/common/dbg_io.c b/arch/mips/au1000/common/dbg_io.c
deleted file mode 100644 (file)
index af5be7d..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-#include <linux/types.h>
-
-#include <asm/mach-au1x00/au1000.h>
-
-#ifdef CONFIG_KGDB
-
-/*
- * FIXME the user should be able to select the
- * uart to be used for debugging.
- */
-#define DEBUG_BASE  UART_DEBUG_BASE
-
-#define         UART16550_BAUD_2400             2400
-#define         UART16550_BAUD_4800             4800
-#define         UART16550_BAUD_9600             9600
-#define         UART16550_BAUD_19200            19200
-#define         UART16550_BAUD_38400            38400
-#define         UART16550_BAUD_57600            57600
-#define         UART16550_BAUD_115200           115200
-
-#define         UART16550_PARITY_NONE           0
-#define         UART16550_PARITY_ODD            0x08
-#define         UART16550_PARITY_EVEN           0x18
-#define         UART16550_PARITY_MARK           0x28
-#define         UART16550_PARITY_SPACE          0x38
-
-#define         UART16550_DATA_5BIT             0x0
-#define         UART16550_DATA_6BIT             0x1
-#define         UART16550_DATA_7BIT             0x2
-#define         UART16550_DATA_8BIT             0x3
-
-#define         UART16550_STOP_1BIT             0x0
-#define         UART16550_STOP_2BIT             0x4
-
-
-#define UART_RX                0       /* Receive buffer */
-#define UART_TX                4       /* Transmit buffer */
-#define UART_IER       8       /* Interrupt Enable Register */
-#define UART_IIR       0xC     /* Interrupt ID Register */
-#define UART_FCR       0x10    /* FIFO Control Register */
-#define UART_LCR       0x14    /* Line Control Register */
-#define UART_MCR       0x18    /* Modem Control Register */
-#define UART_LSR       0x1C    /* Line Status Register */
-#define UART_MSR       0x20    /* Modem Status Register */
-#define UART_CLK       0x28    /* Baud Rat4e Clock Divider */
-#define UART_MOD_CNTRL 0x100   /* Module Control */
-
-/* memory-mapped read/write of the port */
-#define UART16550_READ(y)     (au_readl(DEBUG_BASE + y) & 0xff)
-#define UART16550_WRITE(y, z) (au_writel(z & 0xff, DEBUG_BASE + y))
-
-extern unsigned long calc_clock(void);
-
-void debugInit(u32 baud, u8 data, u8 parity, u8 stop)
-{
-       if (UART16550_READ(UART_MOD_CNTRL) != 0x3)
-               UART16550_WRITE(UART_MOD_CNTRL, 3);
-       calc_clock();
-
-       /* disable interrupts */
-       UART16550_WRITE(UART_IER, 0);
-
-       /* set up baud rate */
-       {
-               u32 divisor;
-
-               /* set divisor */
-               divisor = get_au1x00_uart_baud_base() / baud;
-               UART16550_WRITE(UART_CLK, divisor & 0xffff);
-       }
-
-       /* set data format */
-       UART16550_WRITE(UART_LCR, (data | parity | stop));
-}
-
-static int remoteDebugInitialized;
-
-u8 getDebugChar(void)
-{
-       if (!remoteDebugInitialized) {
-               remoteDebugInitialized = 1;
-               debugInit(UART16550_BAUD_115200,
-                         UART16550_DATA_8BIT,
-                         UART16550_PARITY_NONE,
-                         UART16550_STOP_1BIT);
-       }
-
-       while ((UART16550_READ(UART_LSR) & 0x1) == 0);
-       return UART16550_READ(UART_RX);
-}
-
-
-int putDebugChar(u8 byte)
-{
-       if (!remoteDebugInitialized) {
-               remoteDebugInitialized = 1;
-               debugInit(UART16550_BAUD_115200,
-                         UART16550_DATA_8BIT,
-                         UART16550_PARITY_NONE,
-                         UART16550_STOP_1BIT);
-       }
-
-       while ((UART16550_READ(UART_LSR) & 0x40) == 0);
-       UART16550_WRITE(UART_TX, byte);
-
-       return 1;
-}
-
-#endif
index 5ebe0de..8474135 100644 (file)
@@ -57,6 +57,6 @@ void __init prom_init(void)
        if (!memsize_str)
                memsize = 0x04000000;
        else
-               memsize = strict_strtol(memsize_str, 0, NULL);
+               strict_strtol(memsize_str, 0, &memsize);
        add_memory_region(0, memsize, BOOT_MEM_RAM);
 }
index 33a4aeb..3bae13c 100644 (file)
@@ -55,6 +55,6 @@ void __init prom_init(void)
        if (!memsize_str)
                memsize = 0x04000000;
        else
-               memsize = strict_strtol(memsize_str, 0, NULL);
+               strict_strtol(memsize_str, 0, &memsize);
        add_memory_region(0, memsize, BOOT_MEM_RAM);
 }
index 3837365..8a9c7d5 100644 (file)
@@ -52,6 +52,6 @@ void __init prom_init(void)
        if (!memsize_str)
                memsize = 0x04000000;
        else
-               memsize = strict_strtol(memsize_str, 0, NULL);
+               strict_strtol(memsize_str, 0, &memsize);
        add_memory_region(0, memsize, BOOT_MEM_RAM);
 }
index 8355483..7c67923 100644 (file)
@@ -54,7 +54,7 @@ void __init prom_init(void)
        if (!memsize_str)
                memsize = 0x04000000;
        else
-               memsize = strict_strtol(memsize_str, 0, NULL);
+               strict_strtol(memsize_str, 0, &memsize);
 
        add_memory_region(0, memsize, BOOT_MEM_RAM);
 }
index 09fd63b..e9b2a0f 100644 (file)
@@ -53,6 +53,6 @@ void __init prom_init(void)
        if (!memsize_str)
                memsize = 0x08000000;
        else
-               memsize = strict_strtol(memsize_str, 0, NULL);
+               strict_strtol(memsize_str, 0, &memsize);
        add_memory_region(0, memsize, BOOT_MEM_RAM);
 }
index 49f51e1..3b6e395 100644 (file)
@@ -53,6 +53,6 @@ void __init prom_init(void)
        if (!memsize_str)
                memsize = 0x04000000;
        else
-               memsize = strict_strtol(memsize_str, 0, NULL);
+               strict_strtol(memsize_str, 0, &memsize);
        add_memory_region(0, memsize, BOOT_MEM_RAM);
 }
index 1b5f584..e1055a1 100644 (file)
@@ -53,6 +53,6 @@ void __init prom_init(void)
        if (!memsize_str)
                memsize = 0x08000000;
        else
-               memsize = strict_strtol(memsize_str, 0, NULL);
+               strict_strtol(memsize_str, 0, &memsize);
        add_memory_region(0, memsize, BOOT_MEM_RAM);
 }
index b849bf5..7516434 100644 (file)
@@ -53,6 +53,6 @@ void __init prom_init(void)
        if (!memsize_str)
                memsize = 0x04000000;
        else
-               memsize = strict_strtol(memsize_str, 0, NULL);
+               strict_strtol(memsize_str, 0, &memsize);
        add_memory_region(0, memsize, BOOT_MEM_RAM);
 }
index 519142c..cff29cf 100644 (file)
@@ -5,5 +5,4 @@
 obj-$(CONFIG_BASLER_EXCITE)    += excite_irq.o excite_prom.o excite_setup.o \
                                   excite_device.o excite_procfs.o
 
-obj-$(CONFIG_KGDB)             += excite_dbg_io.o
 obj-m                          += excite_iodev.o
diff --git a/arch/mips/basler/excite/excite_dbg_io.c b/arch/mips/basler/excite/excite_dbg_io.c
deleted file mode 100644 (file)
index d289e3a..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- *  Copyright (C) 2004 by Basler Vision Technologies AG
- *  Author: Thomas Koeller <thomas.koeller@baslerweb.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/linkage.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <asm/gdb-stub.h>
-#include <asm/rm9k-ocd.h>
-#include <excite.h>
-
-#if defined(CONFIG_SERIAL_8250) && CONFIG_SERIAL_8250_NR_UARTS > 1
-#error Debug port used by serial driver
-#endif
-
-#define UART_CLK               25000000
-#define BASE_BAUD              (UART_CLK / 16)
-#define REGISTER_BASE_0                0x0208UL
-#define REGISTER_BASE_1                0x0238UL
-
-#define REGISTER_BASE_DBG      REGISTER_BASE_1
-
-#define CPRR   0x0004
-#define UACFG  0x0200
-#define UAINTS 0x0204
-#define UARBR  (REGISTER_BASE_DBG + 0x0000)
-#define UATHR  (REGISTER_BASE_DBG + 0x0004)
-#define UADLL  (REGISTER_BASE_DBG + 0x0008)
-#define UAIER  (REGISTER_BASE_DBG + 0x000c)
-#define UADLH  (REGISTER_BASE_DBG + 0x0010)
-#define UAIIR  (REGISTER_BASE_DBG + 0x0014)
-#define UAFCR  (REGISTER_BASE_DBG + 0x0018)
-#define UALCR  (REGISTER_BASE_DBG + 0x001c)
-#define UAMCR  (REGISTER_BASE_DBG + 0x0020)
-#define UALSR  (REGISTER_BASE_DBG + 0x0024)
-#define UAMSR  (REGISTER_BASE_DBG + 0x0028)
-#define UASCR  (REGISTER_BASE_DBG + 0x002c)
-
-#define        PARITY_NONE     0
-#define        PARITY_ODD      0x08
-#define        PARITY_EVEN     0x18
-#define        PARITY_MARK     0x28
-#define        PARITY_SPACE    0x38
-
-#define        DATA_5BIT       0x0
-#define        DATA_6BIT       0x1
-#define        DATA_7BIT       0x2
-#define        DATA_8BIT       0x3
-
-#define        STOP_1BIT       0x0
-#define        STOP_2BIT       0x4
-
-#define BAUD_DBG       57600
-#define        PARITY_DBG      PARITY_NONE
-#define        DATA_DBG        DATA_8BIT
-#define        STOP_DBG        STOP_1BIT
-
-/* Initialize the serial port for KGDB debugging */
-void __init excite_kgdb_init(void)
-{
-       const u32 divisor = BASE_BAUD / BAUD_DBG;
-
-       /* Take the UART out of reset */
-       titan_writel(0x00ff1cff, CPRR);
-       titan_writel(0x00000000, UACFG);
-       titan_writel(0x00000002, UACFG);
-
-       titan_writel(0x0, UALCR);
-       titan_writel(0x0, UAIER);
-
-       /* Disable FIFOs */
-       titan_writel(0x00, UAFCR);
-
-       titan_writel(0x80, UALCR);
-       titan_writel(divisor & 0xff, UADLL);
-       titan_writel((divisor & 0xff00) >> 8, UADLH);
-       titan_writel(0x0, UALCR);
-
-       titan_writel(DATA_DBG | PARITY_DBG | STOP_DBG, UALCR);
-
-       /* Enable receiver interrupt */
-       titan_readl(UARBR);
-       titan_writel(0x1, UAIER);
-}
-
-int getDebugChar(void)
-{
-       while (!(titan_readl(UALSR) & 0x1));
-       return titan_readl(UARBR);
-}
-
-int putDebugChar(int data)
-{
-       while (!(titan_readl(UALSR) & 0x20));
-       titan_writel(data, UATHR);
-       return 1;
-}
-
-/* KGDB interrupt handler */
-asmlinkage void excite_kgdb_inthdl(void)
-{
-       if (unlikely(
-               ((titan_readl(UAIIR) & 0x7) == 4)
-               && ((titan_readl(UARBR) & 0xff) == 0x3)))
-                       set_async_breakpoint(&regs->cp0_epc);
-}
index 4903e06..934e0a6 100644 (file)
@@ -50,10 +50,6 @@ void __init arch_init_irq(void)
        mips_cpu_irq_init();
        rm7k_cpu_irq_init();
        rm9k_cpu_irq_init();
-
-#ifdef CONFIG_KGDB
-       excite_kgdb_init();
-#endif
 }
 
 asmlinkage void plat_irq_dispatch(void)
@@ -90,9 +86,6 @@ asmlinkage void plat_irq_dispatch(void)
        msgint      = msgintflags & msgintmask & (0x1 << (TITAN_MSGINT % 0x20));
        if ((pending & (1 << TITAN_IRQ)) && msgint) {
                ocd_writel(msgint, INTP0Clear0 + (TITAN_MSGINT / 0x20 * 0x10));
-#if defined(CONFIG_KGDB)
-               excite_kgdb_inthdl();
-#endif
                do_IRQ(TITAN_IRQ);
                return;
        }
index 6dd8f0d..d66b3b8 100644 (file)
@@ -95,13 +95,13 @@ static int __init excite_init_console(void)
        /* Take the DUART out of reset */
        titan_writel(0x00ff1cff, CPRR);
 
-#if defined(CONFIG_KGDB) || (CONFIG_SERIAL_8250_NR_UARTS > 1)
+#if (CONFIG_SERIAL_8250_NR_UARTS > 1)
        /* Enable both ports */
        titan_writel(MASK_SER0 | MASK_SER1, UACFG);
 #else
        /* Enable port #0 only */
        titan_writel(MASK_SER0, UACFG);
-#endif /* defined(CONFIG_KGDB) */
+#endif
 
        /*
         * Set up serial port #0. Do not use autodetection; the result is
index 2678b7e..eb44b72 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.23-rc5
-# Thu Sep  6 13:14:29 2007
+# Linux kernel version: 2.6.26
+# Fri Jul 25 10:25:34 2008
 #
 CONFIG_MIPS=y
 
@@ -10,9 +10,11 @@ CONFIG_MIPS=y
 #
 # CONFIG_MACH_ALCHEMY is not set
 # CONFIG_BASLER_EXCITE is not set
+# CONFIG_BCM47XX is not set
 CONFIG_MIPS_COBALT=y
 # CONFIG_MACH_DECSTATION is not set
 # CONFIG_MACH_JAZZ is not set
+# CONFIG_LASAT is not set
 # CONFIG_LEMOTE_FULONG is not set
 # CONFIG_MIPS_MALTA is not set
 # CONFIG_MIPS_SIM is not set
@@ -24,6 +26,7 @@ CONFIG_MIPS_COBALT=y
 # CONFIG_PMC_YOSEMITE 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
@@ -34,19 +37,25 @@ CONFIG_MIPS_COBALT=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_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_NO_NO_OMIT_FRAME_POINTER=y
 CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
+CONFIG_CEVT_GT641XX=y
+CONFIG_CEVT_R4K=y
+CONFIG_CSRC_R4K=y
 CONFIG_DMA_NONCOHERENT=y
 CONFIG_DMA_NEED_PCI_MAP_STATE=y
 CONFIG_EARLY_PRINTK=y
@@ -108,6 +117,7 @@ CONFIG_CPU_HAS_SYNC=y
 CONFIG_GENERIC_HARDIRQS=y
 CONFIG_GENERIC_IRQ_PROBE=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
@@ -115,10 +125,16 @@ CONFIG_FLATMEM_MANUAL=y
 CONFIG_FLATMEM=y
 CONFIG_FLAT_NODE_MEM_MAP=y
 # CONFIG_SPARSEMEM_STATIC is not set
+# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
+CONFIG_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
 # CONFIG_RESOURCES_64BIT is not set
 CONFIG_ZONE_DMA_FLAG=0
 CONFIG_VIRT_TO_BUS=y
+# CONFIG_TICK_ONESHOT is not set
+# CONFIG_NO_HZ is not set
+# CONFIG_HIGH_RES_TIMERS is not set
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
 # CONFIG_HZ_48 is not set
 # CONFIG_HZ_100 is not set
 # CONFIG_HZ_128 is not set
@@ -151,23 +167,28 @@ CONFIG_SYSVIPC_SYSCTL=y
 # CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
-# CONFIG_USER_NS is not set
 # CONFIG_AUDIT is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
-CONFIG_SYSFS_DEPRECATED=y
+# CONFIG_CGROUPS is not set
+# CONFIG_GROUP_SCHED 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_EMBEDDED=y
 CONFIG_SYSCTL_SYSCALL=y
+CONFIG_SYSCTL_SYSCALL_CHECK=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_PCSPKR_PLATFORM=y
+CONFIG_COMPAT_BRK=y
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
 CONFIG_ANON_INODES=y
@@ -177,23 +198,37 @@ CONFIG_TIMERFD=y
 CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
 CONFIG_VM_EVENT_COUNTERS=y
-CONFIG_SLAB=y
-# CONFIG_SLUB is not set
+CONFIG_SLUB_DEBUG=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_HAVE_IOREMAP_PROT is not set
+# CONFIG_HAVE_KPROBES is not set
+# CONFIG_HAVE_KRETPROBES is not set
+# CONFIG_HAVE_DMA_ATTRS is not set
+# CONFIG_USE_GENERIC_SMP_HELPERS is not set
+# CONFIG_HAVE_CLK is not set
+CONFIG_PROC_PAGE_MONITOR=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 is not set
-# CONFIG_KMOD is not set
+CONFIG_KMOD=y
 CONFIG_BLOCK=y
 # CONFIG_LBD is not set
 # CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_LSF is not set
 # CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
 
 #
 # IO Schedulers
@@ -207,18 +242,18 @@ CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_CFQ is not set
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_CLASSIC_RCU=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_MMU=y
-
-#
-# PCCARD (PCMCIA/CardBus) support
-#
+CONFIG_I8253=y
 # CONFIG_PCCARD is not set
 # CONFIG_HOTPLUG_PCI is not set
 
@@ -232,8 +267,8 @@ CONFIG_TRAD_SIGNALS=y
 #
 # Power management options
 #
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PM is not set
-CONFIG_SUSPEND_UP_POSSIBLE=y
 
 #
 # Networking
@@ -250,6 +285,7 @@ CONFIG_XFRM=y
 CONFIG_XFRM_USER=y
 # CONFIG_XFRM_SUB_POLICY is not set
 CONFIG_XFRM_MIGRATE=y
+# CONFIG_XFRM_STATISTICS is not set
 CONFIG_NET_KEY=y
 CONFIG_NET_KEY_MIGRATE=y
 CONFIG_INET=y
@@ -269,6 +305,7 @@ CONFIG_IP_FIB_HASH=y
 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
@@ -276,8 +313,6 @@ CONFIG_TCP_CONG_CUBIC=y
 CONFIG_DEFAULT_TCP_CONG="cubic"
 # 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 is not set
 # CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
@@ -294,10 +329,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_LAPB is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-
-#
-# QoS and/or fair queueing
-#
 # CONFIG_NET_SCHED is not set
 
 #
@@ -305,6 +336,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 #
 # 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
@@ -326,9 +358,12 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 #
 # Generic Driver Options
 #
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 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 is not set
 CONFIG_MTD=y
@@ -337,6 +372,7 @@ CONFIG_MTD=y
 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
@@ -350,6 +386,7 @@ CONFIG_MTD_BLKDEVS=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
@@ -384,6 +421,7 @@ CONFIG_MTD_PHYSMAP=y
 CONFIG_MTD_PHYSMAP_START=0x0
 CONFIG_MTD_PHYSMAP_LEN=0x0
 CONFIG_MTD_PHYSMAP_BANKWIDTH=0
+# CONFIG_MTD_INTEL_VR_NOR is not set
 # CONFIG_MTD_PLATRAM is not set
 
 #
@@ -423,7 +461,9 @@ CONFIG_BLK_DEV_LOOP=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 is not set
 
 #
@@ -462,10 +502,15 @@ CONFIG_SCSI_WAIT_SCAN=m
 # 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 is not set
+# CONFIG_SCSI_DH is not set
 CONFIG_ATA=y
 # CONFIG_ATA_NONSTANDARD is not set
+CONFIG_SATA_PMP=y
 # CONFIG_SATA_AHCI is not set
+# CONFIG_SATA_SIL24 is not set
+CONFIG_ATA_SFF=y
 # CONFIG_SATA_SVW is not set
 # CONFIG_ATA_PIIX is not set
 # CONFIG_SATA_MV is not set
@@ -475,7 +520,6 @@ CONFIG_ATA=y
 # CONFIG_SATA_PROMISE is not set
 # CONFIG_SATA_SX4 is not set
 # CONFIG_SATA_SIL is not set
-# CONFIG_SATA_SIL24 is not set
 # CONFIG_SATA_SIS is not set
 # CONFIG_SATA_ULI is not set
 # CONFIG_SATA_VIA is not set
@@ -504,7 +548,9 @@ CONFIG_ATA=y
 # 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_PDC_OLD is not set
@@ -518,29 +564,27 @@ CONFIG_ATA=y
 CONFIG_PATA_VIA=y
 # CONFIG_PATA_WINBOND is not set
 # CONFIG_PATA_PLATFORM is not set
+# CONFIG_PATA_SCH is not set
 # CONFIG_MD is not set
+# 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
+# Enable only one of the two stacks, unless you know what you are doing
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
 # CONFIG_I2O is not set
 CONFIG_NETDEVICES=y
-# CONFIG_NETDEVICES_MULTIQUEUE is not set
 # 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 is not set
 CONFIG_NET_ETHERNET=y
@@ -562,7 +606,12 @@ CONFIG_TULIP=y
 # CONFIG_DM9102 is not set
 # CONFIG_ULI526X 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_NET_PCI is not set
+# CONFIG_B44 is not set
 # CONFIG_NETDEV_1000 is not set
 # CONFIG_NETDEV_10000 is not set
 # CONFIG_TR is not set
@@ -572,6 +621,7 @@ CONFIG_TULIP=y
 #
 # CONFIG_WLAN_PRE80211 is not set
 # CONFIG_WLAN_80211 is not set
+# CONFIG_IWLWIFI_LEDS is not set
 
 #
 # USB Network Adapters
@@ -580,7 +630,6 @@ CONFIG_TULIP=y
 # 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_WAN is not set
 # CONFIG_FDDI is not set
@@ -588,7 +637,6 @@ CONFIG_TULIP=y
 # 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
@@ -607,7 +655,6 @@ CONFIG_INPUT_POLLDEV=y
 #
 # 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
 
@@ -642,7 +689,9 @@ CONFIG_VT=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_NOZOMI is not set
 
 #
 # Serial drivers
@@ -664,65 +713,122 @@ CONFIG_UNIX98_PTYS=y
 CONFIG_LEGACY_PTYS=y
 CONFIG_LEGACY_PTY_COUNT=256
 # CONFIG_IPMI_HANDLER is not set
-# CONFIG_WATCHDOG is not set
 # CONFIG_HW_RANDOM is not set
-# CONFIG_RTC is not set
-CONFIG_COBALT_LCD=y
 # 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
-
-#
-# SPI support
-#
 # CONFIG_SPI is not set
-# CONFIG_SPI_MASTER 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
+
+#
+# Sonics Silicon Backplane
+#
+CONFIG_SSB_POSSIBLE=y
+# 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
 
 #
 # 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
 
 #
 # Graphics support
 #
+# CONFIG_DRM 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_CFB_FILLRECT is not set
+# CONFIG_FB_CFB_COPYAREA is not set
+# CONFIG_FB_CFB_IMAGEBLIT is not set
+# 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_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 is not set
+# 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_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_COBALT=y
+# CONFIG_FB_VIRTUAL is not set
 # CONFIG_BACKLIGHT_LCD_SUPPORT is not set
 
 #
 # Display device support
 #
 # CONFIG_DISPLAY_SUPPORT 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
-
-#
-# Sound
-#
+# CONFIG_FRAMEBUFFER_CONSOLE is not set
+# CONFIG_LOGO is not set
 # CONFIG_SOUND is not set
 CONFIG_HID_SUPPORT=y
 CONFIG_HID=m
 # CONFIG_HID_DEBUG is not set
+# CONFIG_HIDRAW is not set
 
 #
 # USB Input Devices
@@ -743,6 +849,7 @@ CONFIG_USB_ARCH_HAS_OHCI=y
 CONFIG_USB_ARCH_HAS_EHCI=y
 CONFIG_USB=m
 # CONFIG_USB_DEBUG is not set
+# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
 
 #
 # Miscellaneous USB options
@@ -751,15 +858,18 @@ CONFIG_USB=m
 # CONFIG_USB_DEVICE_CLASS is not set
 # CONFIG_USB_DYNAMIC_MINORS is not set
 # CONFIG_USB_OTG is not set
+# CONFIG_USB_OTG_WHITELIST is not set
+# CONFIG_USB_OTG_BLACKLIST_HUB is not set
 
 #
 # USB Host Controller Drivers
 #
+# CONFIG_USB_C67X00_HCD is not set
 CONFIG_USB_EHCI_HCD=m
-# CONFIG_USB_EHCI_SPLIT_ISO is not set
 # CONFIG_USB_EHCI_ROOT_HUB_TT is not set
 # CONFIG_USB_EHCI_TT_NEWSCHED is not set
 # CONFIG_USB_ISP116X_HCD is not set
+# CONFIG_USB_ISP1760_HCD is not set
 CONFIG_USB_OHCI_HCD=m
 # CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
 # CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
@@ -773,6 +883,7 @@ CONFIG_USB_OHCI_LITTLE_ENDIAN=y
 #
 # CONFIG_USB_ACM is not set
 # CONFIG_USB_PRINTER is not set
+# CONFIG_USB_WDM is not set
 
 #
 # NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
@@ -785,6 +896,7 @@ CONFIG_USB_STORAGE=m
 # CONFIG_USB_STORAGE_DEBUG is not set
 # CONFIG_USB_STORAGE_DATAFAB is not set
 # CONFIG_USB_STORAGE_FREECOM is not set
+# CONFIG_USB_STORAGE_ISD200 is not set
 # CONFIG_USB_STORAGE_DPCM is not set
 # CONFIG_USB_STORAGE_USBAT is not set
 # CONFIG_USB_STORAGE_SDDR09 is not set
@@ -793,6 +905,7 @@ CONFIG_USB_STORAGE=m
 # 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
 
 #
@@ -800,15 +913,11 @@ CONFIG_USB_STORAGE=m
 #
 # CONFIG_USB_MDC800 is not set
 # CONFIG_USB_MICROTEK is not set
-CONFIG_USB_MON=y
+# CONFIG_USB_MON is not set
 
 #
 # USB port drivers
 #
-
-#
-# USB Serial Converter support
-#
 # CONFIG_USB_SERIAL is not set
 
 #
@@ -833,16 +942,10 @@ CONFIG_USB_MON=y
 # CONFIG_USB_LD is not set
 # CONFIG_USB_TRANCEVIBRATOR is not set
 # CONFIG_USB_IOWARRIOR is not set
-
-#
-# USB DSL modem support
-#
-
-#
-# USB Gadget Support
-#
+# CONFIG_USB_ISIGHTFW is not set
 # CONFIG_USB_GADGET is not set
 # CONFIG_MMC is not set
+# CONFIG_MEMSTICK is not set
 CONFIG_NEW_LEDS=y
 CONFIG_LEDS_CLASS=y
 
@@ -858,6 +961,8 @@ CONFIG_LEDS_COBALT_RAQ=y
 CONFIG_LEDS_TRIGGERS=y
 # CONFIG_LEDS_TRIGGER_TIMER is not set
 # CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
+# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set
+# CONFIG_ACCESSIBILITY is not set
 # CONFIG_INFINIBAND is not set
 CONFIG_RTC_LIB=y
 CONFIG_RTC_CLASS=y
@@ -882,9 +987,10 @@ CONFIG_RTC_INTF_DEV=y
 # Platform RTC drivers
 #
 CONFIG_RTC_DRV_CMOS=y
+# CONFIG_RTC_DRV_DS1511 is not set
 # CONFIG_RTC_DRV_DS1553 is not set
-# CONFIG_RTC_DRV_STK17TA8 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_M48T59 is not set
 # CONFIG_RTC_DRV_V3020 is not set
@@ -892,23 +998,7 @@ CONFIG_RTC_DRV_CMOS=y
 #
 # on-CPU RTC drivers
 #
-
-#
-# DMA Engine support
-#
-# CONFIG_DMA_ENGINE is not set
-
-#
-# DMA Clients
-#
-
-#
-# DMA Devices
-#
-
-#
-# Userspace I/O
-#
+# CONFIG_DMADEVICES is not set
 # CONFIG_UIO is not set
 
 #
@@ -923,22 +1013,22 @@ 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_EXT4DEV_FS=y
+CONFIG_EXT4DEV_FS_XATTR=y
+CONFIG_EXT4DEV_FS_POSIX_ACL=y
+CONFIG_EXT4DEV_FS_SECURITY=y
 CONFIG_JBD=y
-# CONFIG_JBD_DEBUG is not set
+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 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_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
@@ -967,7 +1057,6 @@ CONFIG_SYSFS=y
 CONFIG_TMPFS=y
 CONFIG_TMPFS_POSIX_ACL=y
 # CONFIG_HUGETLB_PAGE is not set
-CONFIG_RAMFS=y
 CONFIG_CONFIGFS_FS=y
 
 #
@@ -983,32 +1072,28 @@ CONFIG_CONFIGFS_FS=y
 # CONFIG_JFFS2_FS is not set
 # CONFIG_CRAMFS is not set
 # CONFIG_VXFS_FS is not set
+# CONFIG_MINIX_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=y
 # CONFIG_NFS_V4 is not set
-# CONFIG_NFS_DIRECTIO is not set
 CONFIG_NFSD=y
 CONFIG_NFSD_V2_ACL=y
 CONFIG_NFSD_V3=y
 CONFIG_NFSD_V3_ACL=y
 # CONFIG_NFSD_V4 is not set
-CONFIG_NFSD_TCP=y
 CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
 CONFIG_EXPORTFS=y
 CONFIG_NFS_ACL_SUPPORT=y
 CONFIG_NFS_COMMON=y
 CONFIG_SUNRPC=y
-# CONFIG_SUNRPC_BIND34 is not set
 # CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_RPCSEC_GSS_SPKM3 is not set
 # CONFIG_SMB_FS is not set
@@ -1022,34 +1107,26 @@ CONFIG_SUNRPC=y
 #
 # CONFIG_PARTITION_ADVANCED is not set
 CONFIG_MSDOS_PARTITION=y
-
-#
-# Native Language Support
-#
 # CONFIG_NLS is not set
-
-#
-# Distributed Lock Manager
-#
 # CONFIG_DLM 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=1024
 # CONFIG_MAGIC_SYSRQ 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_SLUB_DEBUG_ON is not set
+# CONFIG_SLUB_STATS is not set
+# CONFIG_DEBUG_MEMORY_INIT is not set
+# CONFIG_SAMPLES is not set
 CONFIG_CMDLINE=""
 
 #
@@ -1057,14 +1134,95 @@ CONFIG_CMDLINE=""
 #
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
-# CONFIG_CRYPTO is not set
+# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+CONFIG_CRYPTO=y
+
+#
+# Crypto core or helper
+#
+# CONFIG_CRYPTO_MANAGER 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
+
+#
+# Digest
+#
+# CONFIG_CRYPTO_CRC32C 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_LZO is not set
+CONFIG_CRYPTO_HW=y
+# CONFIG_CRYPTO_DEV_HIFN_795X is not set
 
 #
 # Library routines
 #
 CONFIG_BITREVERSE=y
+# CONFIG_GENERIC_FIND_FIRST_BIT is not set
 # CONFIG_CRC_CCITT is not set
-# CONFIG_CRC16 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
index ebb8ad6..a279165 100644 (file)
@@ -1092,7 +1092,6 @@ CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_CROSSCOMPILE=y
 CONFIG_CMDLINE=""
-CONFIG_SYS_SUPPORTS_KGDB=y
 
 #
 # Security options
index ad4e5ef..8944d15 100644 (file)
@@ -1092,7 +1092,6 @@ CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_CROSSCOMPILE=y
 CONFIG_CMDLINE=""
-CONFIG_SYS_SUPPORTS_KGDB=y
 
 #
 # Security options
index d0dc2e8..ab17973 100644 (file)
@@ -1174,7 +1174,6 @@ CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_CROSSCOMPILE=y
 CONFIG_CMDLINE="mem=48M"
-CONFIG_SYS_SUPPORTS_KGDB=y
 
 #
 # Security options
index 9155082..b65803f 100644 (file)
@@ -1392,7 +1392,6 @@ CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_CROSSCOMPILE=y
 CONFIG_CMDLINE=""
-CONFIG_SYS_SUPPORTS_KGDB=y
 
 #
 # Security options
index e4e3244..a190ac0 100644 (file)
@@ -1209,7 +1209,6 @@ CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_CROSSCOMPILE=y
 CONFIG_CMDLINE=""
-CONFIG_SYS_SUPPORTS_KGDB=y
 
 #
 # Security options
index 3572e80..4e465e9 100644 (file)
@@ -1269,7 +1269,6 @@ CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_CROSSCOMPILE=y
 CONFIG_CMDLINE=""
-CONFIG_SYS_SUPPORTS_KGDB=y
 
 #
 # Security options
index 138c575..831d3e5 100644 (file)
@@ -943,7 +943,6 @@ CONFIG_ENABLE_MUST_CHECK=y
 # CONFIG_DEBUG_KERNEL is not set
 CONFIG_CROSSCOMPILE=y
 CONFIG_CMDLINE=""
-CONFIG_SYS_SUPPORTS_KGDB=y
 
 #
 # Security options
index 59d1947..dd13db4 100644 (file)
@@ -1415,8 +1415,6 @@ CONFIG_FORCED_INLINING=y
 CONFIG_CROSSCOMPILE=y
 CONFIG_CMDLINE=""
 # CONFIG_DEBUG_STACK_USAGE is not set
-# CONFIG_KGDB is not set
-CONFIG_SYS_SUPPORTS_KGDB=y
 # CONFIG_RUNTIME_DEBUG is not set
 # CONFIG_MIPS_UNCACHED is not set
 
index bacf0dd..db92726 100644 (file)
@@ -3020,7 +3020,6 @@ CONFIG_MAGIC_SYSRQ=y
 # CONFIG_DEBUG_KERNEL is not set
 CONFIG_CROSSCOMPILE=y
 CONFIG_CMDLINE=""
-CONFIG_SYS_SUPPORTS_KGDB=y
 
 #
 # Security options
index 6dfe6f7..9e21e33 100644 (file)
@@ -1085,7 +1085,6 @@ CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_CROSSCOMPILE=y
 CONFIG_CMDLINE=""
-CONFIG_SYS_SUPPORTS_KGDB=y
 
 #
 # Security options
index c965a87..af67ed4 100644 (file)
@@ -1202,7 +1202,6 @@ CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_CROSSCOMPILE=y
 CONFIG_CMDLINE=""
-CONFIG_SYS_SUPPORTS_KGDB=y
 
 #
 # Security options
index 0778996..7956f56 100644 (file)
@@ -1195,7 +1195,6 @@ CONFIG_ENABLE_MUST_CHECK=y
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_CROSSCOMPILE=y
 CONFIG_CMDLINE=""
-CONFIG_SYS_SUPPORTS_KGDB=y
 
 #
 # Security options
index 37c7b5f..723bd51 100644 (file)
@@ -1216,10 +1216,8 @@ CONFIG_DEBUG_MUTEXES=y
 CONFIG_FORCED_INLINING=y
 # CONFIG_RCU_TORTURE_TEST is not set
 CONFIG_CROSSCOMPILE=y
-CONFIG_CMDLINE="console=ttyS1,38400n8 kgdb=ttyS0 root=/dev/nfs ip=bootp"
+CONFIG_CMDLINE="console=ttyS1,38400n8 root=/dev/nfs ip=bootp"
 # CONFIG_DEBUG_STACK_USAGE is not set
-# CONFIG_KGDB is not set
-CONFIG_SYS_SUPPORTS_KGDB=y
 # CONFIG_RUNTIME_DEBUG is not set
 
 #
index 893e5c4..b5052fb 100644 (file)
@@ -1206,10 +1206,8 @@ CONFIG_DEBUG_SLAB=y
 CONFIG_FORCED_INLINING=y
 # CONFIG_RCU_TORTURE_TEST is not set
 CONFIG_CROSSCOMPILE=y
-CONFIG_CMDLINE="console=ttyS1,38400n8 kgdb=ttyS0 root=/dev/nfs ip=bootp"
+CONFIG_CMDLINE="console=ttyS1,38400n8 root=/dev/nfs ip=bootp"
 # CONFIG_DEBUG_STACK_USAGE is not set
-# CONFIG_KGDB is not set
-CONFIG_SYS_SUPPORTS_KGDB=y
 # CONFIG_RUNTIME_DEBUG is not set
 
 #
index e42aed5..c7c0864 100644 (file)
@@ -742,7 +742,6 @@ CONFIG_DEBUG_FS=y
 # CONFIG_DEBUG_KERNEL is not set
 # CONFIG_SAMPLES is not set
 CONFIG_CMDLINE=""
-CONFIG_SYS_SUPPORTS_KGDB=y
 
 #
 # Security options
index 1ea9786..a9acaa2 100644 (file)
@@ -963,7 +963,6 @@ CONFIG_ENABLE_MUST_CHECK=y
 # CONFIG_DEBUG_KERNEL is not set
 # CONFIG_SAMPLES is not set
 CONFIG_CMDLINE=""
-CONFIG_SYS_SUPPORTS_KGDB=y
 # CONFIG_SB1XXX_CORELIS is not set
 
 #
index 7f86c43..ea8249c 100644 (file)
@@ -827,8 +827,6 @@ CONFIG_FORCED_INLINING=y
 CONFIG_CROSSCOMPILE=y
 CONFIG_CMDLINE=""
 # CONFIG_DEBUG_STACK_USAGE is not set
-# CONFIG_KGDB is not set
-CONFIG_SYS_SUPPORTS_KGDB=y
 # CONFIG_RUNTIME_DEBUG is not set
 
 #
index 1156770..d70627d 100644 (file)
@@ -34,7 +34,6 @@
 #include <asm/bcache.h>
 #include <asm/irq.h>
 #include <asm/reboot.h>
-#include <asm/gdb-stub.h>
 #include <asm/traps.h>
 #include <asm/debug.h>
 
index 62bfb45..822a20e 100644 (file)
@@ -27,7 +27,6 @@
 #include <linux/types.h>
 #include <linux/initrd.h>
 #include <linux/irq.h>
-#include <linux/ide.h>
 #include <linux/ioport.h>
 #include <linux/param.h>       /* for HZ */
 #include <linux/root_dev.h>
@@ -41,7 +40,6 @@
 #include <asm/bcache.h>
 #include <asm/irq.h>
 #include <asm/reboot.h>
-#include <asm/gdb-stub.h>
 #include <asm/traps.h>
 #include <asm/debug.h>
 
index f60524e..b59ba6b 100644 (file)
@@ -10,7 +10,6 @@
  * Copyright (C) 2007 by Thomas Bogendoerfer
  */
 #include <linux/eisa.h>
-#include <linux/hdreg.h>
 #include <linux/init.h>
 #include <linux/ioport.h>
 #include <linux/sched.h>
@@ -18,7 +17,6 @@
 #include <linux/mm.h>
 #include <linux/console.h>
 #include <linux/fb.h>
-#include <linux/ide.h>
 #include <linux/pm.h>
 #include <linux/screen_info.h>
 #include <linux/platform_device.h>
index 0fd3197..706f939 100644 (file)
@@ -71,7 +71,7 @@ obj-$(CONFIG_MIPS32_COMPAT)   += linux32.o ptrace32.o signal32.o
 obj-$(CONFIG_MIPS32_N32)       += binfmt_elfn32.o scall64-n32.o signal_n32.o
 obj-$(CONFIG_MIPS32_O32)       += binfmt_elfo32.o scall64-o32.o
 
-obj-$(CONFIG_KGDB)             += gdb-low.o gdb-stub.o
+obj-$(CONFIG_KGDB)             += kgdb.o
 obj-$(CONFIG_PROC_FS)          += proc.o
 
 obj-$(CONFIG_64BIT)            += cpu-bugs64.o
diff --git a/arch/mips/kernel/gdb-low.S b/arch/mips/kernel/gdb-low.S
deleted file mode 100644 (file)
index 2c44606..0000000
+++ /dev/null
@@ -1,394 +0,0 @@
-/*
- * gdb-low.S contains the low-level trap handler for the GDB stub.
- *
- * Copyright (C) 1995 Andreas Busse
- */
-#include <linux/sys.h>
-
-#include <asm/asm.h>
-#include <asm/errno.h>
-#include <asm/irqflags.h>
-#include <asm/mipsregs.h>
-#include <asm/regdef.h>
-#include <asm/stackframe.h>
-#include <asm/gdb-stub.h>
-
-#ifdef CONFIG_32BIT
-#define DMFC0  mfc0
-#define DMTC0  mtc0
-#define LDC1   lwc1
-#define SDC1   lwc1
-#endif
-#ifdef CONFIG_64BIT
-#define DMFC0  dmfc0
-#define DMTC0  dmtc0
-#define LDC1   ldc1
-#define SDC1   ldc1
-#endif
-
-/*
- * [jsun] We reserves about 2x GDB_FR_SIZE in stack.  The lower (addressed)
- * part is used to store registers and passed to exception handler.
- * The upper part is reserved for "call func" feature where gdb client
- * saves some of the regs, setups call frame and passes args.
- *
- * A trace shows about 200 bytes are used to store about half of all regs.
- * The rest should be big enough for frame setup and passing args.
- */
-
-/*
- * The low level trap handler
- */
-               .align  5
-               NESTED(trap_low, GDB_FR_SIZE, sp)
-               .set    noat
-               .set    noreorder
-
-               mfc0    k0, CP0_STATUS
-               sll     k0, 3                   /* extract cu0 bit */
-               bltz    k0, 1f
-               move    k1, sp
-
-               /*
-                * Called from user mode, go somewhere else.
-                */
-               mfc0    k0, CP0_CAUSE
-               andi    k0, k0, 0x7c
-#ifdef CONFIG_64BIT
-               dsll    k0, k0, 1
-#endif
-               PTR_L   k1, saved_vectors(k0)
-               jr      k1
-               nop
-1:
-               move    k0, sp
-               PTR_SUBU sp, k1, GDB_FR_SIZE*2  # see comment above
-               LONG_S  k0, GDB_FR_REG29(sp)
-               LONG_S  $2, GDB_FR_REG2(sp)
-
-/*
- * First save the CP0 and special registers
- */
-
-               mfc0    v0, CP0_STATUS
-               LONG_S  v0, GDB_FR_STATUS(sp)
-               mfc0    v0, CP0_CAUSE
-               LONG_S  v0, GDB_FR_CAUSE(sp)
-               DMFC0   v0, CP0_EPC
-               LONG_S  v0, GDB_FR_EPC(sp)
-               DMFC0   v0, CP0_BADVADDR
-               LONG_S  v0, GDB_FR_BADVADDR(sp)
-               mfhi    v0
-               LONG_S  v0, GDB_FR_HI(sp)
-               mflo    v0
-               LONG_S  v0, GDB_FR_LO(sp)
-
-/*
- * Now the integer registers
- */
-
-               LONG_S  zero, GDB_FR_REG0(sp)           /* I know... */
-               LONG_S  $1, GDB_FR_REG1(sp)
-               /* v0 already saved */
-               LONG_S  $3, GDB_FR_REG3(sp)
-               LONG_S  $4, GDB_FR_REG4(sp)
-               LONG_S  $5, GDB_FR_REG5(sp)
-               LONG_S  $6, GDB_FR_REG6(sp)
-               LONG_S  $7, GDB_FR_REG7(sp)
-               LONG_S  $8, GDB_FR_REG8(sp)
-               LONG_S  $9, GDB_FR_REG9(sp)
-               LONG_S  $10, GDB_FR_REG10(sp)
-               LONG_S  $11, GDB_FR_REG11(sp)
-               LONG_S  $12, GDB_FR_REG12(sp)
-               LONG_S  $13, GDB_FR_REG13(sp)
-               LONG_S  $14, GDB_FR_REG14(sp)
-               LONG_S  $15, GDB_FR_REG15(sp)
-               LONG_S  $16, GDB_FR_REG16(sp)
-               LONG_S  $17, GDB_FR_REG17(sp)
-               LONG_S  $18, GDB_FR_REG18(sp)
-               LONG_S  $19, GDB_FR_REG19(sp)
-               LONG_S  $20, GDB_FR_REG20(sp)
-               LONG_S  $21, GDB_FR_REG21(sp)
-               LONG_S  $22, GDB_FR_REG22(sp)
-               LONG_S  $23, GDB_FR_REG23(sp)
-               LONG_S  $24, GDB_FR_REG24(sp)
-               LONG_S  $25, GDB_FR_REG25(sp)
-               LONG_S  $26, GDB_FR_REG26(sp)
-               LONG_S  $27, GDB_FR_REG27(sp)
-               LONG_S  $28, GDB_FR_REG28(sp)
-               /* sp already saved */
-               LONG_S  $30, GDB_FR_REG30(sp)
-               LONG_S  $31, GDB_FR_REG31(sp)
-
-               CLI                             /* disable interrupts */
-               TRACE_IRQS_OFF
-
-/*
- * Followed by the floating point registers
- */
-               mfc0    v0, CP0_STATUS          /* FPU enabled? */
-               srl     v0, v0, 16
-               andi    v0, v0, (ST0_CU1 >> 16)
-
-               beqz    v0,2f                   /* disabled, skip */
-                nop
-
-               SDC1    $0, GDB_FR_FPR0(sp)
-               SDC1    $1, GDB_FR_FPR1(sp)
-               SDC1    $2, GDB_FR_FPR2(sp)
-               SDC1    $3, GDB_FR_FPR3(sp)
-               SDC1    $4, GDB_FR_FPR4(sp)
-               SDC1    $5, GDB_FR_FPR5(sp)
-               SDC1    $6, GDB_FR_FPR6(sp)
-               SDC1    $7, GDB_FR_FPR7(sp)
-               SDC1    $8, GDB_FR_FPR8(sp)
-               SDC1    $9, GDB_FR_FPR9(sp)
-               SDC1    $10, GDB_FR_FPR10(sp)
-               SDC1    $11, GDB_FR_FPR11(sp)
-               SDC1    $12, GDB_FR_FPR12(sp)
-               SDC1    $13, GDB_FR_FPR13(sp)
-               SDC1    $14, GDB_FR_FPR14(sp)
-               SDC1    $15, GDB_FR_FPR15(sp)
-               SDC1    $16, GDB_FR_FPR16(sp)
-               SDC1    $17, GDB_FR_FPR17(sp)
-               SDC1    $18, GDB_FR_FPR18(sp)
-               SDC1    $19, GDB_FR_FPR19(sp)
-               SDC1    $20, GDB_FR_FPR20(sp)
-               SDC1    $21, GDB_FR_FPR21(sp)
-               SDC1    $22, GDB_FR_FPR22(sp)
-               SDC1    $23, GDB_FR_FPR23(sp)
-               SDC1    $24, GDB_FR_FPR24(sp)
-               SDC1    $25, GDB_FR_FPR25(sp)
-               SDC1    $26, GDB_FR_FPR26(sp)
-               SDC1    $27, GDB_FR_FPR27(sp)
-               SDC1    $28, GDB_FR_FPR28(sp)
-               SDC1    $29, GDB_FR_FPR29(sp)
-               SDC1    $30, GDB_FR_FPR30(sp)
-               SDC1    $31, GDB_FR_FPR31(sp)
-
-/*
- * FPU control registers
- */
-
-               cfc1    v0, CP1_STATUS
-               LONG_S  v0, GDB_FR_FSR(sp)
-               cfc1    v0, CP1_REVISION
-               LONG_S  v0, GDB_FR_FIR(sp)
-
-/*
- * Current stack frame ptr
- */
-
-2:
-               LONG_S  sp, GDB_FR_FRP(sp)
-
-/*
- * CP0 registers (R4000/R4400 unused registers skipped)
- */
-
-               mfc0    v0, CP0_INDEX
-               LONG_S  v0, GDB_FR_CP0_INDEX(sp)
-               mfc0    v0, CP0_RANDOM
-               LONG_S  v0, GDB_FR_CP0_RANDOM(sp)
-               DMFC0   v0, CP0_ENTRYLO0
-               LONG_S  v0, GDB_FR_CP0_ENTRYLO0(sp)
-               DMFC0   v0, CP0_ENTRYLO1
-               LONG_S  v0, GDB_FR_CP0_ENTRYLO1(sp)
-               DMFC0   v0, CP0_CONTEXT
-               LONG_S  v0, GDB_FR_CP0_CONTEXT(sp)
-               mfc0    v0, CP0_PAGEMASK
-               LONG_S  v0, GDB_FR_CP0_PAGEMASK(sp)
-               mfc0    v0, CP0_WIRED
-               LONG_S  v0, GDB_FR_CP0_WIRED(sp)
-               DMFC0   v0, CP0_ENTRYHI
-               LONG_S  v0, GDB_FR_CP0_ENTRYHI(sp)
-               mfc0    v0, CP0_PRID
-               LONG_S  v0, GDB_FR_CP0_PRID(sp)
-
-               .set    at
-
-/*
- * Continue with the higher level handler
- */
-
-               move    a0,sp
-
-               jal     handle_exception
-                nop
-
-/*
- * Restore all writable registers, in reverse order
- */
-
-               .set    noat
-
-               LONG_L  v0, GDB_FR_CP0_ENTRYHI(sp)
-               LONG_L  v1, GDB_FR_CP0_WIRED(sp)
-               DMTC0   v0, CP0_ENTRYHI
-               mtc0    v1, CP0_WIRED
-               LONG_L  v0, GDB_FR_CP0_PAGEMASK(sp)
-               LONG_L  v1, GDB_FR_CP0_ENTRYLO1(sp)
-               mtc0    v0, CP0_PAGEMASK
-               DMTC0   v1, CP0_ENTRYLO1
-               LONG_L  v0, GDB_FR_CP0_ENTRYLO0(sp)
-               LONG_L  v1, GDB_FR_CP0_INDEX(sp)
-               DMTC0   v0, CP0_ENTRYLO0
-               LONG_L  v0, GDB_FR_CP0_CONTEXT(sp)
-               mtc0    v1, CP0_INDEX
-               DMTC0   v0, CP0_CONTEXT
-
-
-/*
- * Next, the floating point registers
- */
-               mfc0    v0, CP0_STATUS          /* check if the FPU is enabled */
-               srl     v0, v0, 16
-               andi    v0, v0, (ST0_CU1 >> 16)
-
-               beqz    v0, 3f                  /* disabled, skip */
-                nop
-
-               LDC1    $31, GDB_FR_FPR31(sp)
-               LDC1    $30, GDB_FR_FPR30(sp)
-               LDC1    $29, GDB_FR_FPR29(sp)
-               LDC1    $28, GDB_FR_FPR28(sp)
-               LDC1    $27, GDB_FR_FPR27(sp)
-               LDC1    $26, GDB_FR_FPR26(sp)
-               LDC1    $25, GDB_FR_FPR25(sp)
-               LDC1    $24, GDB_FR_FPR24(sp)
-               LDC1    $23, GDB_FR_FPR23(sp)
-               LDC1    $22, GDB_FR_FPR22(sp)
-               LDC1    $21, GDB_FR_FPR21(sp)
-               LDC1    $20, GDB_FR_FPR20(sp)
-               LDC1    $19, GDB_FR_FPR19(sp)
-               LDC1    $18, GDB_FR_FPR18(sp)
-               LDC1    $17, GDB_FR_FPR17(sp)
-               LDC1    $16, GDB_FR_FPR16(sp)
-               LDC1    $15, GDB_FR_FPR15(sp)
-               LDC1    $14, GDB_FR_FPR14(sp)
-               LDC1    $13, GDB_FR_FPR13(sp)
-               LDC1    $12, GDB_FR_FPR12(sp)
-               LDC1    $11, GDB_FR_FPR11(sp)
-               LDC1    $10, GDB_FR_FPR10(sp)
-               LDC1    $9, GDB_FR_FPR9(sp)
-               LDC1    $8, GDB_FR_FPR8(sp)
-               LDC1    $7, GDB_FR_FPR7(sp)
-               LDC1    $6, GDB_FR_FPR6(sp)
-               LDC1    $5, GDB_FR_FPR5(sp)
-               LDC1    $4, GDB_FR_FPR4(sp)
-               LDC1    $3, GDB_FR_FPR3(sp)
-               LDC1    $2, GDB_FR_FPR2(sp)
-               LDC1    $1, GDB_FR_FPR1(sp)
-               LDC1    $0, GDB_FR_FPR0(sp)
-
-/*
- * Now the CP0 and integer registers
- */
-
-3:
-#ifdef CONFIG_MIPS_MT_SMTC
-               /* Read-modify write of Status must be atomic */
-               mfc0    t2, CP0_TCSTATUS
-               ori     t1, t2, TCSTATUS_IXMT
-               mtc0    t1, CP0_TCSTATUS
-               andi    t2, t2, TCSTATUS_IXMT
-               _ehb
-               DMT     9                               # dmt   t1
-               jal     mips_ihb
-               nop
-#endif /* CONFIG_MIPS_MT_SMTC */
-               mfc0    t0, CP0_STATUS
-               ori     t0, 0x1f
-               xori    t0, 0x1f
-               mtc0    t0, CP0_STATUS
-#ifdef CONFIG_MIPS_MT_SMTC
-               andi    t1, t1, VPECONTROL_TE
-               beqz    t1, 9f
-               nop
-               EMT                                     # emt
-9:
-               mfc0    t1, CP0_TCSTATUS
-               xori    t1, t1, TCSTATUS_IXMT
-               or      t1, t1, t2
-               mtc0    t1, CP0_TCSTATUS
-               _ehb
-#endif /* CONFIG_MIPS_MT_SMTC */
-               LONG_L  v0, GDB_FR_STATUS(sp)
-               LONG_L  v1, GDB_FR_EPC(sp)
-               mtc0    v0, CP0_STATUS
-               DMTC0   v1, CP0_EPC
-               LONG_L  v0, GDB_FR_HI(sp)
-               LONG_L  v1, GDB_FR_LO(sp)
-               mthi    v0
-               mtlo    v1
-               LONG_L  $31, GDB_FR_REG31(sp)
-               LONG_L  $30, GDB_FR_REG30(sp)
-               LONG_L  $28, GDB_FR_REG28(sp)
-               LONG_L  $27, GDB_FR_REG27(sp)
-               LONG_L  $26, GDB_FR_REG26(sp)
-               LONG_L  $25, GDB_FR_REG25(sp)
-               LONG_L  $24, GDB_FR_REG24(sp)
-               LONG_L  $23, GDB_FR_REG23(sp)
-               LONG_L  $22, GDB_FR_REG22(sp)
-               LONG_L  $21, GDB_FR_REG21(sp)
-               LONG_L  $20, GDB_FR_REG20(sp)
-               LONG_L  $19, GDB_FR_REG19(sp)
-               LONG_L  $18, GDB_FR_REG18(sp)
-               LONG_L  $17, GDB_FR_REG17(sp)
-               LONG_L  $16, GDB_FR_REG16(sp)
-               LONG_L  $15, GDB_FR_REG15(sp)
-               LONG_L  $14, GDB_FR_REG14(sp)
-               LONG_L  $13, GDB_FR_REG13(sp)
-               LONG_L  $12, GDB_FR_REG12(sp)
-               LONG_L  $11, GDB_FR_REG11(sp)
-               LONG_L  $10, GDB_FR_REG10(sp)
-               LONG_L  $9, GDB_FR_REG9(sp)
-               LONG_L  $8, GDB_FR_REG8(sp)
-               LONG_L  $7, GDB_FR_REG7(sp)
-               LONG_L  $6, GDB_FR_REG6(sp)
-               LONG_L  $5, GDB_FR_REG5(sp)
-               LONG_L  $4, GDB_FR_REG4(sp)
-               LONG_L  $3, GDB_FR_REG3(sp)
-               LONG_L  $2, GDB_FR_REG2(sp)
-               LONG_L  $1, GDB_FR_REG1(sp)
-#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
-               LONG_L  k0, GDB_FR_EPC(sp)
-               LONG_L  $29, GDB_FR_REG29(sp)           /* Deallocate stack */
-               jr      k0
-               rfe
-#else
-               LONG_L  sp, GDB_FR_REG29(sp)            /* Deallocate stack */
-
-               .set    mips3
-               eret
-               .set    mips0
-#endif
-               .set    at
-               .set    reorder
-               END(trap_low)
-
-LEAF(kgdb_read_byte)
-4:             lb      t0, (a0)
-               sb      t0, (a1)
-               li      v0, 0
-               jr      ra
-               .section __ex_table,"a"
-               PTR     4b, kgdbfault
-               .previous
-               END(kgdb_read_byte)
-
-LEAF(kgdb_write_byte)
-5:             sb      a0, (a1)
-               li      v0, 0
-               jr      ra
-               .section __ex_table,"a"
-               PTR     5b, kgdbfault
-               .previous
-               END(kgdb_write_byte)
-
-               .type   kgdbfault@function
-               .ent    kgdbfault
-
-kgdbfault:     li      v0, -EFAULT
-               jr      ra
-               .end    kgdbfault
diff --git a/arch/mips/kernel/gdb-stub.c b/arch/mips/kernel/gdb-stub.c
deleted file mode 100644 (file)
index 25f4eab..0000000
+++ /dev/null
@@ -1,1155 +0,0 @@
-/*
- *  arch/mips/kernel/gdb-stub.c
- *
- *  Originally written by Glenn Engel, Lake Stevens Instrument Division
- *
- *  Contributed by HP Systems
- *
- *  Modified for SPARC by Stu Grossman, Cygnus Support.
- *
- *  Modified for Linux/MIPS (and MIPS in general) by Andreas Busse
- *  Send complaints, suggestions etc. to <andy@waldorf-gmbh.de>
- *
- *  Copyright (C) 1995 Andreas Busse
- *
- *  Copyright (C) 2003 MontaVista Software Inc.
- *  Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
- */
-
-/*
- *  To enable debugger support, two things need to happen.  One, a
- *  call to set_debug_traps() is necessary in order to allow any breakpoints
- *  or error conditions to be properly intercepted and reported to gdb.
- *  Two, a breakpoint needs to be generated to begin communication.  This
- *  is most easily accomplished by a call to breakpoint().  Breakpoint()
- *  simulates a breakpoint by executing a BREAK instruction.
- *
- *
- *    The following gdb commands are supported:
- *
- * command          function                               Return value
- *
- *    g             return the value of the CPU registers  hex data or ENN
- *    G             set the value of the CPU registers     OK or ENN
- *
- *    mAA..AA,LLLL  Read LLLL bytes at address AA..AA      hex data or ENN
- *    MAA..AA,LLLL: Write LLLL bytes at address AA.AA      OK or ENN
- *
- *    c             Resume at current address              SNN   ( signal NN)
- *    cAA..AA       Continue at address AA..AA             SNN
- *
- *    s             Step one instruction                   SNN
- *    sAA..AA       Step one instruction from AA..AA       SNN
- *
- *    k             kill
- *
- *    ?             What was the last sigval ?             SNN   (signal NN)
- *
- *    bBB..BB      Set baud rate to BB..BB                OK or BNN, then sets
- *                                                        baud rate
- *
- * All commands and responses are sent with a packet which includes a
- * checksum.  A packet consists of
- *
- * $<packet info>#<checksum>.
- *
- * where
- * <packet info> :: <characters representing the command or response>
- * <checksum>    :: < two hex digits computed as modulo 256 sum of <packetinfo>>
- *
- * When a packet is received, it is first acknowledged with either '+' or '-'.
- * '+' indicates a successful transfer.  '-' indicates a failed transfer.
- *
- * Example:
- *
- * Host:                  Reply:
- * $m0,10#2a               +$00010203040506070809101112131415#42
- *
- *
- *  ==============
- *  MORE EXAMPLES:
- *  ==============
- *
- *  For reference -- the following are the steps that one
- *  company took (RidgeRun Inc) to get remote gdb debugging
- *  going. In this scenario the host machine was a PC and the
- *  target platform was a Galileo EVB64120A MIPS evaluation
- *  board.
- *
- *  Step 1:
- *  First download gdb-5.0.tar.gz from the internet.
- *  and then build/install the package.
- *
- *  Example:
- *    $ tar zxf gdb-5.0.tar.gz
- *    $ cd gdb-5.0
- *    $ ./configure --target=mips-linux-elf
- *    $ make
- *    $ install
- *    $ which mips-linux-elf-gdb
- *    /usr/local/bin/mips-linux-elf-gdb
- *
- *  Step 2:
- *  Configure linux for remote debugging and build it.
- *
- *  Example:
- *    $ cd ~/linux
- *    $ make menuconfig <go to "Kernel Hacking" and turn on remote debugging>
- *    $ make
- *
- *  Step 3:
- *  Download the kernel to the remote target and start
- *  the kernel running. It will promptly halt and wait
- *  for the host gdb session to connect. It does this
- *  since the "Kernel Hacking" option has defined
- *  CONFIG_KGDB which in turn enables your calls
- *  to:
- *     set_debug_traps();
- *     breakpoint();
- *
- *  Step 4:
- *  Start the gdb session on the host.
- *
- *  Example:
- *    $ mips-linux-elf-gdb vmlinux
- *    (gdb) set remotebaud 115200
- *    (gdb) target remote /dev/ttyS1
- *    ...at this point you are connected to
- *       the remote target and can use gdb
- *       in the normal fasion. Setting
- *       breakpoints, single stepping,
- *       printing variables, etc.
- */
-#include <linux/string.h>
-#include <linux/kernel.h>
-#include <linux/signal.h>
-#include <linux/sched.h>
-#include <linux/mm.h>
-#include <linux/console.h>
-#include <linux/init.h>
-#include <linux/smp.h>
-#include <linux/spinlock.h>
-#include <linux/slab.h>
-#include <linux/reboot.h>
-
-#include <asm/asm.h>
-#include <asm/cacheflush.h>
-#include <asm/mipsregs.h>
-#include <asm/pgtable.h>
-#include <asm/system.h>
-#include <asm/gdb-stub.h>
-#include <asm/inst.h>
-
-/*
- * external low-level support routines
- */
-
-extern int putDebugChar(char c);    /* write a single character      */
-extern char getDebugChar(void);     /* read and return a single char */
-extern void trap_low(void);
-
-/*
- * breakpoint and test functions
- */
-extern void breakpoint(void);
-extern void breakinst(void);
-extern void async_breakpoint(void);
-extern void async_breakinst(void);
-extern void adel(void);
-
-/*
- * local prototypes
- */
-
-static void getpacket(char *buffer);
-static void putpacket(char *buffer);
-static int computeSignal(int tt);
-static int hex(unsigned char ch);
-static int hexToInt(char **ptr, int *intValue);
-static int hexToLong(char **ptr, long *longValue);
-static unsigned char *mem2hex(char *mem, char *buf, int count, int may_fault);
-void handle_exception(struct gdb_regs *regs);
-
-int kgdb_enabled;
-
-/*
- * spin locks for smp case
- */
-static DEFINE_SPINLOCK(kgdb_lock);
-static raw_spinlock_t kgdb_cpulock[NR_CPUS] = {
-       [0 ... NR_CPUS-1] = __RAW_SPIN_LOCK_UNLOCKED,
-};
-
-/*
- * BUFMAX defines the maximum number of characters in inbound/outbound buffers
- * at least NUMREGBYTES*2 are needed for register packets
- */
-#define BUFMAX 2048
-
-static char input_buffer[BUFMAX];
-static char output_buffer[BUFMAX];
-static int initialized;        /* !0 means we've been initialized */
-static int kgdb_started;
-static const char hexchars[]="0123456789abcdef";
-
-/* Used to prevent crashes in memory access.  Note that they'll crash anyway if
-   we haven't set up fault handlers yet... */
-int kgdb_read_byte(unsigned char *address, unsigned char *dest);
-int kgdb_write_byte(unsigned char val, unsigned char *dest);
-
-/*
- * Convert ch from a hex digit to an int
- */
-static int hex(unsigned char ch)
-{
-       if (ch >= 'a' && ch <= 'f')
-               return ch-'a'+10;
-       if (ch >= '0' && ch <= '9')
-               return ch-'0';
-       if (ch >= 'A' && ch <= 'F')
-               return ch-'A'+10;
-       return -1;
-}
-
-/*
- * scan for the sequence $<data>#<checksum>
- */
-static void getpacket(char *buffer)
-{
-       unsigned char checksum;
-       unsigned char xmitcsum;
-       int i;
-       int count;
-       unsigned char ch;
-
-       do {
-               /*
-                * wait around for the start character,
-                * ignore all other characters
-                */
-               while ((ch = (getDebugChar() & 0x7f)) != '$') ;
-
-               checksum = 0;
-               xmitcsum = -1;
-               count = 0;
-
-               /*
-                * now, read until a # or end of buffer is found
-                */
-               while (count < BUFMAX) {
-                       ch = getDebugChar();
-                       if (ch == '#')
-                               break;
-                       checksum = checksum + ch;
-                       buffer[count] = ch;
-                       count = count + 1;
-               }
-
-               if (count >= BUFMAX)
-                       continue;
-
-               buffer[count] = 0;
-
-               if (ch == '#') {
-                       xmitcsum = hex(getDebugChar() & 0x7f) << 4;
-                       xmitcsum |= hex(getDebugChar() & 0x7f);
-
-                       if (checksum != xmitcsum)
-                               putDebugChar('-');      /* failed checksum */
-                       else {
-                               putDebugChar('+'); /* successful transfer */
-
-                               /*
-                                * if a sequence char is present,
-                                * reply the sequence ID
-                                */
-                               if (buffer[2] == ':') {
-                                       putDebugChar(buffer[0]);
-                                       putDebugChar(buffer[1]);
-
-                                       /*
-                                        * remove sequence chars from buffer
-                                        */
-                                       count = strlen(buffer);
-                                       for (i=3; i <= count; i++)
-                                               buffer[i-3] = buffer[i];
-                               }
-                       }
-               }
-       }
-       while (checksum != xmitcsum);
-}
-
-/*
- * send the packet in buffer.
- */
-static void putpacket(char *buffer)
-{
-       unsigned char checksum;
-       int count;
-       unsigned char ch;
-
-       /*
-        * $<packet info>#<checksum>.
-        */
-
-       do {
-               putDebugChar('$');
-               checksum = 0;
-               count = 0;
-
-               while ((ch = buffer[count]) != 0) {
-                       if (!(putDebugChar(ch)))
-                               return;
-                       checksum += ch;
-                       count += 1;
-               }
-
-               putDebugChar('#');
-               putDebugChar(hexchars[checksum >> 4]);
-               putDebugChar(hexchars[checksum & 0xf]);
-
-       }
-       while ((getDebugChar() & 0x7f) != '+');
-}
-
-
-/*
- * Convert the memory pointed to by mem into hex, placing result in buf.
- * Return a pointer to the last char put in buf (null), in case of mem fault,
- * return 0.
- * may_fault is non-zero if we are reading from arbitrary memory, but is currently
- * not used.
- */
-static unsigned char *mem2hex(char *mem, char *buf, int count, int may_fault)
-{
-       unsigned char ch;
-
-       while (count-- > 0) {
-               if (kgdb_read_byte(mem++, &ch) != 0)
-                       return 0;
-               *buf++ = hexchars[ch >> 4];
-               *buf++ = hexchars[ch & 0xf];
-       }
-
-       *buf = 0;
-
-       return buf;
-}
-
-/*
- * convert the hex array pointed to by buf into binary to be placed in mem
- * return a pointer to the character AFTER the last byte written
- * may_fault is non-zero if we are reading from arbitrary memory, but is currently
- * not used.
- */
-static char *hex2mem(char *buf, char *mem, int count, int binary, int may_fault)
-{
-       int i;
-       unsigned char ch;
-
-       for (i=0; i<count; i++)
-       {
-               if (binary) {
-                       ch = *buf++;
-                       if (ch == 0x7d)
-                               ch = 0x20 ^ *buf++;
-               }
-               else {
-                       ch = hex(*buf++) << 4;
-                       ch |= hex(*buf++);
-               }
-               if (kgdb_write_byte(ch, mem++) != 0)
-                       return 0;
-       }
-
-       return mem;
-}
-
-/*
- * This table contains the mapping between SPARC hardware trap types, and
- * signals, which are primarily what GDB understands.  It also indicates
- * which hardware traps we need to commandeer when initializing the stub.
- */
-static struct hard_trap_info {
-       unsigned char tt;               /* Trap type code for MIPS R3xxx and R4xxx */
-       unsigned char signo;            /* Signal that we map this trap into */
-} hard_trap_info[] = {
-       { 6, SIGBUS },                  /* instruction bus error */
-       { 7, SIGBUS },                  /* data bus error */
-       { 9, SIGTRAP },                 /* break */
-       { 10, SIGILL },                 /* reserved instruction */
-/*     { 11, SIGILL },         */      /* CPU unusable */
-       { 12, SIGFPE },                 /* overflow */
-       { 13, SIGTRAP },                /* trap */
-       { 14, SIGSEGV },                /* virtual instruction cache coherency */
-       { 15, SIGFPE },                 /* floating point exception */
-       { 23, SIGSEGV },                /* watch */
-       { 31, SIGSEGV },                /* virtual data cache coherency */
-       { 0, 0}                         /* Must be last */
-};
-
-/* Save the normal trap handlers for user-mode traps. */
-void *saved_vectors[32];
-
-/*
- * Set up exception handlers for tracing and breakpoints
- */
-void set_debug_traps(void)
-{
-       struct hard_trap_info *ht;
-       unsigned long flags;
-       unsigned char c;
-
-       local_irq_save(flags);
-       for (ht = hard_trap_info; ht->tt && ht->signo; ht++)
-               saved_vectors[ht->tt] = set_except_vector(ht->tt, trap_low);
-
-       putDebugChar('+'); /* 'hello world' */
-       /*
-        * In case GDB is started before us, ack any packets
-        * (presumably "$?#xx") sitting there.
-        */
-       while((c = getDebugChar()) != '$');
-       while((c = getDebugChar()) != '#');
-       c = getDebugChar(); /* eat first csum byte */
-       c = getDebugChar(); /* eat second csum byte */
-       putDebugChar('+'); /* ack it */
-
-       initialized = 1;
-       local_irq_restore(flags);
-}
-
-void restore_debug_traps(void)
-{
-       struct hard_trap_info *ht;
-       unsigned long flags;
-
-       local_irq_save(flags);
-       for (ht = hard_trap_info; ht->tt && ht->signo; ht++)
-               set_except_vector(ht->tt, saved_vectors[ht->tt]);
-       local_irq_restore(flags);
-}
-
-/*
- * Convert the MIPS hardware trap type code to a Unix signal number.
- */
-static int computeSignal(int tt)
-{
-       struct hard_trap_info *ht;
-
-       for (ht = hard_trap_info; ht->tt && ht->signo; ht++)
-               if (ht->tt == tt)
-                       return ht->signo;
-
-       return SIGHUP;          /* default for things we don't know about */
-}
-
-/*
- * While we find nice hex chars, build an int.
- * Return number of chars processed.
- */
-static int hexToInt(char **ptr, int *intValue)
-{
-       int numChars = 0;
-       int hexValue;
-
-       *intValue = 0;
-
-       while (**ptr) {
-               hexValue = hex(**ptr);
-               if (hexValue < 0)
-                       break;
-
-               *intValue = (*intValue << 4) | hexValue;
-               numChars ++;
-
-               (*ptr)++;
-       }
-
-       return (numChars);
-}
-
-static int hexToLong(char **ptr, long *longValue)
-{
-       int numChars = 0;
-       int hexValue;
-
-       *longValue = 0;
-
-       while (**ptr) {
-               hexValue = hex(**ptr);
-               if (hexValue < 0)
-                       break;
-
-               *longValue = (*longValue << 4) | hexValue;
-               numChars ++;
-
-               (*ptr)++;
-       }
-
-       return numChars;
-}
-
-
-#if 0
-/*
- * Print registers (on target console)
- * Used only to debug the stub...
- */
-void show_gdbregs(struct gdb_regs * regs)
-{
-       /*
-        * Saved main processor registers
-        */
-       printk("$0 : %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
-              regs->reg0, regs->reg1, regs->reg2, regs->reg3,
-              regs->reg4, regs->reg5, regs->reg6, regs->reg7);
-       printk("$8 : %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
-              regs->reg8, regs->reg9, regs->reg10, regs->reg11,
-              regs->reg12, regs->reg13, regs->reg14, regs->reg15);
-       printk("$16: %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
-              regs->reg16, regs->reg17, regs->reg18, regs->reg19,
-              regs->reg20, regs->reg21, regs->reg22, regs->reg23);
-       printk("$24: %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
-              regs->reg24, regs->reg25, regs->reg26, regs->reg27,
-              regs->reg28, regs->reg29, regs->reg30, regs->reg31);
-
-       /*
-        * Saved cp0 registers
-        */
-       printk("epc  : %08lx\nStatus: %08lx\nCause : %08lx\n",
-              regs->cp0_epc, regs->cp0_status, regs->cp0_cause);
-}
-#endif /* dead code */
-
-/*
- * We single-step by setting breakpoints. When an exception
- * is handled, we need to restore the instructions hoisted
- * when the breakpoints were set.
- *
- * This is where we save the original instructions.
- */
-static struct gdb_bp_save {
-       unsigned long addr;
-       unsigned int val;
-} step_bp[2];
-
-#define BP 0x0000000d  /* break opcode */
-
-/*
- * Set breakpoint instructions for single stepping.
- */
-static void single_step(struct gdb_regs *regs)
-{
-       union mips_instruction insn;
-       unsigned long targ;
-       int is_branch, is_cond, i;
-
-       targ = regs->cp0_epc;
-       insn.word = *(unsigned int *)targ;
-       is_branch = is_cond = 0;
-
-       switch (insn.i_format.opcode) {
-       /*
-        * jr and jalr are in r_format format.
-        */
-       case spec_op:
-               switch (insn.r_format.func) {
-               case jalr_op:
-               case jr_op:
-                       targ = *(&regs->reg0 + insn.r_format.rs);
-                       is_branch = 1;
-                       break;
-               }
-               break;
-
-       /*
-        * This group contains:
-        * bltz_op, bgez_op, bltzl_op, bgezl_op,
-        * bltzal_op, bgezal_op, bltzall_op, bgezall_op.
-        */
-       case bcond_op:
-               is_branch = is_cond = 1;
-               targ += 4 + (insn.i_format.simmediate << 2);
-               break;
-
-       /*
-        * These are unconditional and in j_format.
-        */
-       case jal_op:
-       case j_op:
-               is_branch = 1;
-               targ += 4;
-               targ >>= 28;
-               targ <<= 28;
-               targ |= (insn.j_format.target << 2);
-               break;
-
-       /*
-        * These are conditional.
-        */
-       case beq_op:
-       case beql_op:
-       case bne_op:
-       case bnel_op:
-       case blez_op:
-       case blezl_op:
-       case bgtz_op:
-       case bgtzl_op:
-       case cop0_op:
-       case cop1_op:
-       case cop2_op:
-       case cop1x_op:
-               is_branch = is_cond = 1;
-               targ += 4 + (insn.i_format.simmediate << 2);
-               break;
-       }
-
-       if (is_branch) {
-               i = 0;
-               if (is_cond && targ != (regs->cp0_epc + 8)) {
-                       step_bp[i].addr = regs->cp0_epc + 8;
-                       step_bp[i++].val = *(unsigned *)(regs->cp0_epc + 8);
-                       *(unsigned *)(regs->cp0_epc + 8) = BP;
-               }
-               step_bp[i].addr = targ;
-               step_bp[i].val  = *(unsigned *)targ;
-               *(unsigned *)targ = BP;
-       } else {
-               step_bp[0].addr = regs->cp0_epc + 4;
-               step_bp[0].val  = *(unsigned *)(regs->cp0_epc + 4);
-               *(unsigned *)(regs->cp0_epc + 4) = BP;
-       }
-}
-
-/*
- *  If asynchronously interrupted by gdb, then we need to set a breakpoint
- *  at the interrupted instruction so that we wind up stopped with a
- *  reasonable stack frame.
- */
-static struct gdb_bp_save async_bp;
-
-/*
- * Swap the interrupted EPC with our asynchronous breakpoint routine.
- * This is safer than stuffing the breakpoint in-place, since no cache
- * flushes (or resulting smp_call_functions) are required.  The
- * assumption is that only one CPU will be handling asynchronous bp's,
- * and only one can be active at a time.
- */
-extern spinlock_t smp_call_lock;
-
-void set_async_breakpoint(unsigned long *epc)
-{
-       /* skip breaking into userland */
-       if ((*epc & 0x80000000) == 0)
-               return;
-
-#ifdef CONFIG_SMP
-       /* avoid deadlock if someone is make IPC */
-       if (spin_is_locked(&smp_call_lock))
-               return;
-#endif
-
-       async_bp.addr = *epc;
-       *epc = (unsigned long)async_breakpoint;
-}
-
-#ifdef CONFIG_SMP
-static void kgdb_wait(void *arg)
-{
-       unsigned flags;
-       int cpu = smp_processor_id();
-
-       local_irq_save(flags);
-
-       __raw_spin_lock(&kgdb_cpulock[cpu]);
-       __raw_spin_unlock(&kgdb_cpulock[cpu]);
-
-       local_irq_restore(flags);
-}
-#endif
-
-/*
- * GDB stub needs to call kgdb_wait on all processor with interrupts
- * disabled, so it uses it's own special variant.
- */
-static int kgdb_smp_call_kgdb_wait(void)
-{
-#ifdef CONFIG_SMP
-       cpumask_t mask = cpu_online_map;
-       struct call_data_struct data;
-       int cpu = smp_processor_id();
-       int cpus;
-
-       /*
-        * Can die spectacularly if this CPU isn't yet marked online
-        */
-       BUG_ON(!cpu_online(cpu));
-
-       cpu_clear(cpu, mask);
-       cpus = cpus_weight(mask);
-       if (!cpus)
-               return 0;
-
-       if (spin_is_locked(&smp_call_lock)) {
-               /*
-                * Some other processor is trying to make us do something
-                * but we're not going to respond... give up
-                */
-               return -1;
-               }
-
-       /*
-        * We will continue here, accepting the fact that
-        * the kernel may deadlock if another CPU attempts
-        * to call smp_call_function now...
-        */
-
-       data.func = kgdb_wait;
-       data.info = NULL;
-       atomic_set(&data.started, 0);
-       data.wait = 0;
-
-       spin_lock(&smp_call_lock);
-       call_data = &data;
-       mb();
-
-       core_send_ipi_mask(mask, SMP_CALL_FUNCTION);
-
-       /* Wait for response */
-       /* FIXME: lock-up detection, backtrace on lock-up */
-       while (atomic_read(&data.started) != cpus)
-               barrier();
-
-       call_data = NULL;
-       spin_unlock(&smp_call_lock);
-#endif
-
-       return 0;
-}
-
-/*
- * This function does all command processing for interfacing to gdb.  It
- * returns 1 if you should skip the instruction at the trap address, 0
- * otherwise.
- */
-void handle_exception(struct gdb_regs *regs)
-{
-       int trap;                       /* Trap type */
-       int sigval;
-       long addr;
-       int length;
-       char *ptr;
-       unsigned long *stack;
-       int i;
-       int bflag = 0;
-
-       kgdb_started = 1;
-
-       /*
-        * acquire the big kgdb spinlock
-        */
-       if (!spin_trylock(&kgdb_lock)) {
-               /*
-                * some other CPU has the lock, we should go back to
-                * receive the gdb_wait IPC
-                */
-               return;
-       }
-
-       /*
-        * If we're in async_breakpoint(), restore the real EPC from
-        * the breakpoint.
-        */
-       if (regs->cp0_epc == (unsigned long)async_breakinst) {
-               regs->cp0_epc = async_bp.addr;
-               async_bp.addr = 0;
-       }
-
-       /*
-        * acquire the CPU spinlocks
-        */
-       for_each_online_cpu(i)
-               if (__raw_spin_trylock(&kgdb_cpulock[i]) == 0)
-                       panic("kgdb: couldn't get cpulock %d\n", i);
-
-       /*
-        * force other cpus to enter kgdb
-        */
-       kgdb_smp_call_kgdb_wait();
-
-       /*
-        * If we're in breakpoint() increment the PC
-        */
-       trap = (regs->cp0_cause & 0x7c) >> 2;
-       if (trap == 9 && regs->cp0_epc == (unsigned long)breakinst)
-               regs->cp0_epc += 4;
-
-       /*
-        * If we were single_stepping, restore the opcodes hoisted
-        * for the breakpoint[s].
-        */
-       if (step_bp[0].addr) {
-               *(unsigned *)step_bp[0].addr = step_bp[0].val;
-               step_bp[0].addr = 0;
-
-               if (step_bp[1].addr) {
-                       *(unsigned *)step_bp[1].addr = step_bp[1].val;
-                       step_bp[1].addr = 0;
-               }
-       }
-
-       stack = (long *)regs->reg29;                    /* stack ptr */
-       sigval = computeSignal(trap);
-
-       /*
-        * reply to host that an exception has occurred
-        */
-       ptr = output_buffer;
-
-       /*
-        * Send trap type (converted to signal)
-        */
-       *ptr++ = 'T';
-       *ptr++ = hexchars[sigval >> 4];
-       *ptr++ = hexchars[sigval & 0xf];
-
-       /*
-        * Send Error PC
-        */
-       *ptr++ = hexchars[REG_EPC >> 4];
-       *ptr++ = hexchars[REG_EPC & 0xf];
-       *ptr++ = ':';
-       ptr = mem2hex((char *)&regs->cp0_epc, ptr, sizeof(long), 0);
-       *ptr++ = ';';
-
-       /*
-        * Send frame pointer
-        */
-       *ptr++ = hexchars[REG_FP >> 4];
-       *ptr++ = hexchars[REG_FP & 0xf];
-       *ptr++ = ':';
-       ptr = mem2hex((char *)&regs->reg30, ptr, sizeof(long), 0);
-       *ptr++ = ';';
-
-       /*
-        * Send stack pointer
-        */
-       *ptr++ = hexchars[REG_SP >> 4];
-       *ptr++ = hexchars[REG_SP & 0xf];
-       *ptr++ = ':';
-       ptr = mem2hex((char *)&regs->reg29, ptr, sizeof(long), 0);
-       *ptr++ = ';';
-
-       *ptr++ = 0;
-       putpacket(output_buffer);       /* send it off... */
-
-       /*
-        * Wait for input from remote GDB
-        */
-       while (1) {
-               output_buffer[0] = 0;
-               getpacket(input_buffer);
-
-               switch (input_buffer[0])
-               {
-               case '?':
-                       output_buffer[0] = 'S';
-                       output_buffer[1] = hexchars[sigval >> 4];
-                       output_buffer[2] = hexchars[sigval & 0xf];
-                       output_buffer[3] = 0;
-                       break;
-
-               /*
-                * Detach debugger; let CPU run
-                */
-               case 'D':
-                       putpacket(output_buffer);
-                       goto finish_kgdb;
-                       break;
-
-               case 'd':
-                       /* toggle debug flag */
-                       break;
-
-               /*
-                * Return the value of the CPU registers
-                */
-               case 'g':
-                       ptr = output_buffer;
-                       ptr = mem2hex((char *)&regs->reg0, ptr, 32*sizeof(long), 0); /* r0...r31 */
-                       ptr = mem2hex((char *)&regs->cp0_status, ptr, 6*sizeof(long), 0); /* cp0 */
-                       ptr = mem2hex((char *)&regs->fpr0, ptr, 32*sizeof(long), 0); /* f0...31 */
-                       ptr = mem2hex((char *)&regs->cp1_fsr, ptr, 2*sizeof(long), 0); /* cp1 */
-                       ptr = mem2hex((char *)&regs->frame_ptr, ptr, 2*sizeof(long), 0); /* frp */
-                       ptr = mem2hex((char *)&regs->cp0_index, ptr, 16*sizeof(long), 0); /* cp0 */
-                       break;
-
-               /*
-                * set the value of the CPU registers - return OK
-                */
-               case 'G':
-               {
-                       ptr = &input_buffer[1];
-                       hex2mem(ptr, (char *)&regs->reg0, 32*sizeof(long), 0, 0);
-                       ptr += 32*(2*sizeof(long));
-                       hex2mem(ptr, (char *)&regs->cp0_status, 6*sizeof(long), 0, 0);
-                       ptr += 6*(2*sizeof(long));
-                       hex2mem(ptr, (char *)&regs->fpr0, 32*sizeof(long), 0, 0);
-                       ptr += 32*(2*sizeof(long));
-                       hex2mem(ptr, (char *)&regs->cp1_fsr, 2*sizeof(long), 0, 0);
-                       ptr += 2*(2*sizeof(long));
-                       hex2mem(ptr, (char *)&regs->frame_ptr, 2*sizeof(long), 0, 0);
-                       ptr += 2*(2*sizeof(long));
-                       hex2mem(ptr, (char *)&regs->cp0_index, 16*sizeof(long), 0, 0);
-                       strcpy(output_buffer, "OK");
-                }
-               break;
-
-               /*
-                * mAA..AA,LLLL  Read LLLL bytes at address AA..AA
-                */
-               case 'm':
-                       ptr = &input_buffer[1];
-
-                       if (hexToLong(&ptr, &addr)
-                               && *ptr++ == ','
-                               && hexToInt(&ptr, &length)) {
-                               if (mem2hex((char *)addr, output_buffer, length, 1))
-                                       break;
-                               strcpy(output_buffer, "E03");
-                       } else
-                               strcpy(output_buffer, "E01");
-                       break;
-
-               /*
-                * XAA..AA,LLLL: Write LLLL escaped binary bytes at address AA.AA
-                */
-               case 'X':
-                       bflag = 1;
-                       /* fall through */
-
-               /*
-                * MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK
-                */
-               case 'M':
-                       ptr = &input_buffer[1];
-
-                       if (hexToLong(&ptr, &addr)
-                               && *ptr++ == ','
-                               && hexToInt(&ptr, &length)
-                               && *ptr++ == ':') {
-                               if (hex2mem(ptr, (char *)addr, length, bflag, 1))
-                                       strcpy(output_buffer, "OK");
-                               else
-                                       strcpy(output_buffer, "E03");
-                       }
-                       else
-                               strcpy(output_buffer, "E02");
-                       break;
-
-               /*
-                * cAA..AA    Continue at address AA..AA(optional)
-                */
-               case 'c':
-                       /* try to read optional parameter, pc unchanged if no parm */
-
-                       ptr = &input_buffer[1];
-                       if (hexToLong(&ptr, &addr))
-                               regs->cp0_epc = addr;
-
-                       goto exit_kgdb_exception;
-                       break;
-
-               /*
-                * kill the program; let us try to restart the machine
-                * Reset the whole machine.
-                */
-               case 'k':
-               case 'r':
-                       machine_restart("kgdb restarts machine");
-                       break;
-
-               /*
-                * Step to next instruction
-                */
-               case 's':
-                       /*
-                        * There is no single step insn in the MIPS ISA, so we
-                        * use breakpoints and continue, instead.
-                        */
-                       single_step(regs);
-                       goto exit_kgdb_exception;
-                       /* NOTREACHED */
-                       break;
-
-               /*
-                * Set baud rate (bBB)
-                * FIXME: Needs to be written
-                */
-               case 'b':
-               {
-#if 0
-                       int baudrate;
-                       extern void set_timer_3();
-
-                       ptr = &input_buffer[1];
-                       if (!hexToInt(&ptr, &baudrate))
-                       {
-                               strcpy(output_buffer, "B01");
-                               break;
-                       }
-
-                       /* Convert baud rate to uart clock divider */
-
-                       switch (baudrate)
-                       {
-                               case 38400:
-                                       baudrate = 16;
-                                       break;
-                               case 19200:
-                                       baudrate = 33;
-                                       break;
-                               case 9600:
-                                       baudrate = 65;
-                                       break;
-                               default:
-                                       baudrate = 0;
-                                       strcpy(output_buffer, "B02");
-                                       goto x1;
-                       }
-
-                       if (baudrate) {
-                               putpacket("OK");        /* Ack before changing speed */
-                               set_timer_3(baudrate); /* Set it */
-                       }
-#endif
-               }
-               break;
-
-               }                       /* switch */
-
-               /*
-                * reply to the request
-                */
-
-               putpacket(output_buffer);
-
-       } /* while */
-
-       return;
-
-finish_kgdb:
-       restore_debug_traps();
-
-exit_kgdb_exception:
-       /* release locks so other CPUs can go */
-       for_each_online_cpu(i)
-               __raw_spin_unlock(&kgdb_cpulock[i]);
-       spin_unlock(&kgdb_lock);
-
-       __flush_cache_all();
-       return;
-}
-
-/*
- * This function will generate a breakpoint exception.  It is used at the
- * beginning of a program to sync up with a debugger and can be used
- * otherwise as a quick means to stop program execution and "break" into
- * the debugger.
- */
-void breakpoint(void)
-{
-       if (!initialized)
-               return;
-
-       __asm__ __volatile__(
-                       ".globl breakinst\n\t"
-                       ".set\tnoreorder\n\t"
-                       "nop\n"
-                       "breakinst:\tbreak\n\t"
-                       "nop\n\t"
-                       ".set\treorder"
-                       );
-}
-
-/* Nothing but the break; don't pollute any registers */
-void async_breakpoint(void)
-{
-       __asm__ __volatile__(
-                       ".globl async_breakinst\n\t"
-                       ".set\tnoreorder\n\t"
-                       "nop\n"
-                       "async_breakinst:\tbreak\n\t"
-                       "nop\n\t"
-                       ".set\treorder"
-                       );
-}
-
-void adel(void)
-{
-       __asm__ __volatile__(
-                       ".globl\tadel\n\t"
-                       "lui\t$8,0x8000\n\t"
-                       "lw\t$9,1($8)\n\t"
-                       );
-}
-
-/*
- * malloc is needed by gdb client in "call func()", even a private one
- * will make gdb happy
- */
-static void __used *malloc(size_t size)
-{
-       return kmalloc(size, GFP_ATOMIC);
-}
-
-static void __used free(void *where)
-{
-       kfree(where);
-}
-
-#ifdef CONFIG_GDB_CONSOLE
-
-void gdb_putsn(const char *str, int l)
-{
-       char outbuf[18];
-
-       if (!kgdb_started)
-               return;
-
-       outbuf[0]='O';
-
-       while(l) {
-               int i = (l>8)?8:l;
-               mem2hex((char *)str, &outbuf[1], i, 0);
-               outbuf[(i*2)+1]=0;
-               putpacket(outbuf);
-               str += i;
-               l -= i;
-       }
-}
-
-static void gdb_console_write(struct console *con, const char *s, unsigned n)
-{
-       gdb_putsn(s, n);
-}
-
-static struct console gdb_console = {
-       .name   = "gdb",
-       .write  = gdb_console_write,
-       .flags  = CON_PRINTBUFFER,
-       .index  = -1
-};
-
-static int __init register_gdb_console(void)
-{
-       register_console(&gdb_console);
-
-       return 0;
-}
-
-console_initcall(register_gdb_console);
-
-#endif
index 6045b9a..4b4007b 100644 (file)
 #include <linux/sched.h>
 #include <linux/seq_file.h>
 #include <linux/kallsyms.h>
+#include <linux/kgdb.h>
 
 #include <asm/atomic.h>
 #include <asm/system.h>
 #include <asm/uaccess.h>
 
+#ifdef CONFIG_KGDB
+int kgdb_early_setup;
+#endif
+
 static unsigned long irq_map[NR_IRQS / BITS_PER_LONG];
 
 int allocate_irqno(void)
@@ -126,33 +131,22 @@ asmlinkage void spurious_interrupt(void)
        atomic_inc(&irq_err_count);
 }
 
-#ifdef CONFIG_KGDB
-extern void breakpoint(void);
-extern void set_debug_traps(void);
-
-static int kgdb_flag = 1;
-static int __init nokgdb(char *str)
-{
-       kgdb_flag = 0;
-       return 1;
-}
-__setup("nokgdb", nokgdb);
-#endif
-
 void __init init_IRQ(void)
 {
        int i;
 
+#ifdef CONFIG_KGDB
+       if (kgdb_early_setup)
+               return;
+#endif
+
        for (i = 0; i < NR_IRQS; i++)
                set_irq_noprobe(i);
 
        arch_init_irq();
 
 #ifdef CONFIG_KGDB
-       if (kgdb_flag) {
-               printk("Wait for gdb client connection ...\n");
-               set_debug_traps();
-               breakpoint();
-       }
+       if (!kgdb_early_setup)
+               kgdb_early_setup = 1;
 #endif
 }
diff --git a/arch/mips/kernel/kgdb.c b/arch/mips/kernel/kgdb.c
new file mode 100644 (file)
index 0000000..c5a8b2d
--- /dev/null
@@ -0,0 +1,281 @@
+/*
+ *  Originally written by Glenn Engel, Lake Stevens Instrument Division
+ *
+ *  Contributed by HP Systems
+ *
+ *  Modified for Linux/MIPS (and MIPS in general) by Andreas Busse
+ *  Send complaints, suggestions etc. to <andy@waldorf-gmbh.de>
+ *
+ *  Copyright (C) 1995 Andreas Busse
+ *
+ *  Copyright (C) 2003 MontaVista Software Inc.
+ *  Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
+ *
+ *  Copyright (C) 2004-2005 MontaVista Software Inc.
+ *  Author: Manish Lachwani, mlachwani@mvista.com or manish@koffee-break.com
+ *
+ *  Copyright (C) 2007-2008 Wind River Systems, Inc.
+ *  Author/Maintainer: Jason Wessel, jason.wessel@windriver.com
+ *
+ *  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/ptrace.h>              /* for linux pt_regs struct */
+#include <linux/kgdb.h>
+#include <linux/kdebug.h>
+#include <linux/sched.h>
+#include <asm/inst.h>
+#include <asm/fpu.h>
+#include <asm/cacheflush.h>
+#include <asm/processor.h>
+#include <asm/sigcontext.h>
+
+static struct hard_trap_info {
+       unsigned char tt;       /* Trap type code for MIPS R3xxx and R4xxx */
+       unsigned char signo;    /* Signal that we map this trap into */
+} hard_trap_info[] = {
+       { 6, SIGBUS },          /* instruction bus error */
+       { 7, SIGBUS },          /* data bus error */
+       { 9, SIGTRAP },         /* break */
+/*     { 11, SIGILL }, */      /* CPU unusable */
+       { 12, SIGFPE },         /* overflow */
+       { 13, SIGTRAP },        /* trap */
+       { 14, SIGSEGV },        /* virtual instruction cache coherency */
+       { 15, SIGFPE },         /* floating point exception */
+       { 23, SIGSEGV },        /* watch */
+       { 31, SIGSEGV },        /* virtual data cache coherency */
+       { 0, 0}                 /* Must be last */
+};
+
+void arch_kgdb_breakpoint(void)
+{
+       __asm__ __volatile__(
+               ".globl breakinst\n\t"
+               ".set\tnoreorder\n\t"
+               "nop\n"
+               "breakinst:\tbreak\n\t"
+               "nop\n\t"
+               ".set\treorder");
+}
+
+static void kgdb_call_nmi_hook(void *ignored)
+{
+       kgdb_nmicallback(raw_smp_processor_id(), (void *)0);
+}
+
+void kgdb_roundup_cpus(unsigned long flags)
+{
+       local_irq_enable();
+       smp_call_function(kgdb_call_nmi_hook, NULL, NULL);
+       local_irq_disable();
+}
+
+static int compute_signal(int tt)
+{
+       struct hard_trap_info *ht;
+
+       for (ht = hard_trap_info; ht->tt && ht->signo; ht++)
+               if (ht->tt == tt)
+                       return ht->signo;
+
+       return SIGHUP;          /* default for things we don't know about */
+}
+
+void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
+{
+       int reg;
+
+#if (KGDB_GDB_REG_SIZE == 32)
+       u32 *ptr = (u32 *)gdb_regs;
+#else
+       u64 *ptr = (u64 *)gdb_regs;
+#endif
+
+       for (reg = 0; reg < 32; reg++)
+               *(ptr++) = regs->regs[reg];
+
+       *(ptr++) = regs->cp0_status;
+       *(ptr++) = regs->lo;
+       *(ptr++) = regs->hi;
+       *(ptr++) = regs->cp0_badvaddr;
+       *(ptr++) = regs->cp0_cause;
+       *(ptr++) = regs->cp0_epc;
+
+       /* FP REGS */
+       if (!(current && (regs->cp0_status & ST0_CU1)))
+               return;
+
+       save_fp(current);
+       for (reg = 0; reg < 32; reg++)
+               *(ptr++) = current->thread.fpu.fpr[reg];
+}
+
+void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs)
+{
+       int reg;
+
+#if (KGDB_GDB_REG_SIZE == 32)
+       const u32 *ptr = (u32 *)gdb_regs;
+#else
+       const u64 *ptr = (u64 *)gdb_regs;
+#endif
+
+       for (reg = 0; reg < 32; reg++)
+               regs->regs[reg] = *(ptr++);
+
+       regs->cp0_status = *(ptr++);
+       regs->lo = *(ptr++);
+       regs->hi = *(ptr++);
+       regs->cp0_badvaddr = *(ptr++);
+       regs->cp0_cause = *(ptr++);
+       regs->cp0_epc = *(ptr++);
+
+       /* FP REGS from current */
+       if (!(current && (regs->cp0_status & ST0_CU1)))
+               return;
+
+       for (reg = 0; reg < 32; reg++)
+               current->thread.fpu.fpr[reg] = *(ptr++);
+       restore_fp(current);
+}
+
+/*
+ * Similar to regs_to_gdb_regs() except that process is sleeping and so
+ * we may not be able to get all the info.
+ */
+void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
+{
+       int reg;
+       struct thread_info *ti = task_thread_info(p);
+       unsigned long ksp = (unsigned long)ti + THREAD_SIZE - 32;
+       struct pt_regs *regs = (struct pt_regs *)ksp - 1;
+#if (KGDB_GDB_REG_SIZE == 32)
+       u32 *ptr = (u32 *)gdb_regs;
+#else
+       u64 *ptr = (u64 *)gdb_regs;
+#endif
+
+       for (reg = 0; reg < 16; reg++)
+               *(ptr++) = regs->regs[reg];
+
+       /* S0 - S7 */
+       for (reg = 16; reg < 24; reg++)
+               *(ptr++) = regs->regs[reg];
+
+       for (reg = 24; reg < 28; reg++)
+               *(ptr++) = 0;
+
+       /* GP, SP, FP, RA */
+       for (reg = 28; reg < 32; reg++)
+               *(ptr++) = regs->regs[reg];
+
+       *(ptr++) = regs->cp0_status;
+       *(ptr++) = regs->lo;
+       *(ptr++) = regs->hi;
+       *(ptr++) = regs->cp0_badvaddr;
+       *(ptr++) = regs->cp0_cause;
+       *(ptr++) = regs->cp0_epc;
+}
+
+/*
+ * Calls linux_debug_hook before the kernel dies. If KGDB is enabled,
+ * then try to fall into the debugger
+ */
+static int kgdb_mips_notify(struct notifier_block *self, unsigned long cmd,
+                           void *ptr)
+{
+       struct die_args *args = (struct die_args *)ptr;
+       struct pt_regs *regs = args->regs;
+       int trap = (regs->cp0_cause & 0x7c) >> 2;
+
+       if (fixup_exception(regs))
+               return NOTIFY_DONE;
+
+       /* Userpace events, ignore. */
+       if (user_mode(regs))
+               return NOTIFY_DONE;
+
+       if (atomic_read(&kgdb_active) != -1)
+               kgdb_nmicallback(smp_processor_id(), regs);
+
+       if (kgdb_handle_exception(trap, compute_signal(trap), 0, regs))
+               return NOTIFY_DONE;
+
+       if (atomic_read(&kgdb_setting_breakpoint))
+               if ((trap == 9) && (regs->cp0_epc == (unsigned long)breakinst))
+                       regs->cp0_epc += 4;
+
+       /* In SMP mode, __flush_cache_all does IPI */
+       local_irq_enable();
+       __flush_cache_all();
+
+       return NOTIFY_STOP;
+}
+
+static struct notifier_block kgdb_notifier = {
+       .notifier_call = kgdb_mips_notify,
+};
+
+/*
+ * Handle the 's' and 'c' commands
+ */
+int kgdb_arch_handle_exception(int vector, int signo, int err_code,
+                              char *remcom_in_buffer, char *remcom_out_buffer,
+                              struct pt_regs *regs)
+{
+       char *ptr;
+       unsigned long address;
+       int cpu = smp_processor_id();
+
+       switch (remcom_in_buffer[0]) {
+       case 's':
+       case 'c':
+               /* handle the optional parameter */
+               ptr = &remcom_in_buffer[1];
+               if (kgdb_hex2long(&ptr, &address))
+                       regs->cp0_epc = address;
+
+               atomic_set(&kgdb_cpu_doing_single_step, -1);
+               if (remcom_in_buffer[0] == 's')
+                       if (kgdb_contthread)
+                               atomic_set(&kgdb_cpu_doing_single_step, cpu);
+
+               return 0;
+       }
+
+       return -1;
+}
+
+struct kgdb_arch arch_kgdb_ops;
+
+/*
+ * We use kgdb_early_setup so that functions we need to call now don't
+ * cause trouble when called again later.
+ */
+int kgdb_arch_init(void)
+{
+       union mips_instruction insn = {
+               .r_format = {
+                       .opcode = spec_op,
+                       .func   = break_op,
+               }
+       };
+       memcpy(arch_kgdb_ops.gdb_bpt_instr, insn.byte, BREAK_INSTR_SIZE);
+
+       register_die_notifier(&kgdb_notifier);
+
+       return 0;
+}
+
+/*
+ *     kgdb_arch_exit - Perform any architecture specific uninitalization.
+ *
+ *     This function will handle the uninitalization of any architecture
+ *     specific callbacks, for dynamic registration and unregistration.
+ */
+void kgdb_arch_exit(void)
+{
+       unregister_die_notifier(&kgdb_notifier);
+}
index b8ea4e9..426cced 100644 (file)
@@ -23,6 +23,8 @@
 #include <linux/bootmem.h>
 #include <linux/interrupt.h>
 #include <linux/ptrace.h>
+#include <linux/kgdb.h>
+#include <linux/kdebug.h>
 
 #include <asm/bootinfo.h>
 #include <asm/branch.h>
@@ -425,6 +427,10 @@ asmlinkage void do_be(struct pt_regs *regs)
        printk(KERN_ALERT "%s bus error, epc == %0*lx, ra == %0*lx\n",
               data ? "Data" : "Instruction",
               field, regs->cp0_epc, field, regs->regs[31]);
+       if (notify_die(DIE_OOPS, "bus error", regs, SIGBUS, 0, 0)
+           == NOTIFY_STOP)
+               return;
+
        die_if_kernel("Oops", regs);
        force_sig(SIGBUS, current);
 }
@@ -623,6 +629,9 @@ asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31)
 {
        siginfo_t info;
 
+       if (notify_die(DIE_FP, "FP exception", regs, SIGFPE, 0, 0)
+           == NOTIFY_STOP)
+               return;
        die_if_kernel("FP exception in kernel code", regs);
 
        if (fcr31 & FPU_CSR_UNI_X) {
@@ -682,6 +691,9 @@ static void do_trap_or_bp(struct pt_regs *regs, unsigned int code,
        siginfo_t info;
        char b[40];
 
+       if (notify_die(DIE_TRAP, str, regs, code, 0, 0) == NOTIFY_STOP)
+               return;
+
        /*
         * A short test says that IRIX 5.3 sends SIGTRAP for all trap
         * insns, even for trap and break codes that indicate arithmetic
@@ -762,6 +774,10 @@ asmlinkage void do_ri(struct pt_regs *regs)
        unsigned int opcode = 0;
        int status = -1;
 
+       if (notify_die(DIE_RI, "RI Fault", regs, SIGSEGV, 0, 0)
+           == NOTIFY_STOP)
+               return;
+
        die_if_kernel("Reserved instruction in kernel code", regs);
 
        if (unlikely(compute_return_epc(regs) < 0))
@@ -1537,6 +1553,11 @@ void __init trap_init(void)
        extern char except_vec4;
        unsigned long i;
 
+#if defined(CONFIG_KGDB)
+       if (kgdb_early_setup)
+               return; /* Already done */
+#endif
+
        if (cpu_has_veic || cpu_has_vint)
                ebase = (unsigned long) alloc_bootmem_low_pages(0x200 + VECTORSPACING*64);
        else
index a782549..f0cf46a 100644 (file)
@@ -246,10 +246,6 @@ void __init add_wired_entry(unsigned long entrylo0, unsigned long entrylo1,
                old_pagemask = read_c0_pagemask();
                w = read_c0_wired();
                write_c0_wired(w + 1);
-               if (read_c0_wired() != w + 1) {
-                       printk("[tlbwired] No WIRED reg?\n");
-                       return;
-               }
                write_c0_index(w << 8);
                write_c0_pagemask(pagemask);
                write_c0_entryhi(entryhi);
index f806444..3b7dd72 100644 (file)
@@ -13,7 +13,6 @@ obj-y                         := malta-amon.o malta-cmdline.o \
 
 obj-$(CONFIG_EARLY_PRINTK)     += malta-console.o
 obj-$(CONFIG_PCI)              += malta-pci.o
-obj-$(CONFIG_KGDB)             += malta-kgdb.o
 
 # FIXME FIXME FIXME
 obj-$(CONFIG_MIPS_MT_SMTC)     += malta_smtc.o
index c065302..4832af2 100644 (file)
 
 #include <asm/mips-boards/malta.h>
 
-#ifdef CONFIG_KGDB
-extern int rs_kgdb_hook(int, int);
-extern int rs_putDebugChar(char);
-extern char rs_getDebugChar(void);
-extern int saa9730_kgdb_hook(int);
-extern int saa9730_putDebugChar(char);
-extern char saa9730_getDebugChar(void);
-#endif
-
 int prom_argc;
 int *_prom_argv, *_prom_envp;
 
@@ -173,51 +164,6 @@ static void __init console_config(void)
 }
 #endif
 
-#ifdef CONFIG_KGDB
-void __init kgdb_config(void)
-{
-       extern int (*generic_putDebugChar)(char);
-       extern char (*generic_getDebugChar)(void);
-       char *argptr;
-       int line, speed;
-
-       argptr = prom_getcmdline();
-       if ((argptr = strstr(argptr, "kgdb=ttyS")) != NULL) {
-               argptr += strlen("kgdb=ttyS");
-               if (*argptr != '0' && *argptr != '1')
-                       printk("KGDB: Unknown serial line /dev/ttyS%c, "
-                              "falling back to /dev/ttyS1\n", *argptr);
-               line = *argptr == '0' ? 0 : 1;
-               printk("KGDB: Using serial line /dev/ttyS%d for session\n", line);
-
-               speed = 0;
-               if (*++argptr == ',')
-               {
-                       int c;
-                       while ((c = *++argptr) && ('0' <= c && c <= '9'))
-                               speed = speed * 10 + c - '0';
-               }
-               {
-                       speed = rs_kgdb_hook(line, speed);
-                       generic_putDebugChar = rs_putDebugChar;
-                       generic_getDebugChar = rs_getDebugChar;
-               }
-
-               pr_info("KGDB: Using serial line /dev/ttyS%d at %d for "
-                       "session, please connect your debugger\n",
-                       line ? 1 : 0, speed);
-
-               {
-                       char *s;
-                       for (s = "Please connect GDB to this port\r\n"; *s; )
-                               generic_putDebugChar(*s++);
-               }
-
-               /* Breakpoint is invoked after interrupts are initialised */
-       }
-}
-#endif
-
 static void __init mips_nmi_setup(void)
 {
        void *base;
diff --git a/arch/mips/mti-malta/malta-kgdb.c b/arch/mips/mti-malta/malta-kgdb.c
deleted file mode 100644 (file)
index 6a1854d..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Carsten Langgaard, carstenl@mips.com
- * Copyright (C) 2000 MIPS Technologies, Inc.  All rights reserved.
- *
- *  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.
- *
- * This is the interface to the remote debugger stub.
- */
-#include <linux/types.h>
-#include <linux/serial.h>
-#include <linux/serialP.h>
-#include <linux/serial_reg.h>
-
-#include <asm/serial.h>
-#include <asm/io.h>
-
-static struct serial_state rs_table[] = {
-       SERIAL_PORT_DFNS        /* Defined in serial.h */
-};
-
-static struct async_struct kdb_port_info = {0};
-
-int (*generic_putDebugChar)(char);
-char (*generic_getDebugChar)(void);
-
-static __inline__ unsigned int serial_in(struct async_struct *info, int offset)
-{
-       return inb(info->port + offset);
-}
-
-static __inline__ void serial_out(struct async_struct *info, int offset,
-                               int value)
-{
-       outb(value, info->port+offset);
-}
-
-int rs_kgdb_hook(int tty_no, int speed) {
-       int t;
-       struct serial_state *ser = &rs_table[tty_no];
-
-       kdb_port_info.state = ser;
-       kdb_port_info.magic = SERIAL_MAGIC;
-       kdb_port_info.port = ser->port;
-       kdb_port_info.flags = ser->flags;
-
-       /*
-        * Clear all interrupts
-        */
-       serial_in(&kdb_port_info, UART_LSR);
-       serial_in(&kdb_port_info, UART_RX);
-       serial_in(&kdb_port_info, UART_IIR);
-       serial_in(&kdb_port_info, UART_MSR);
-
-       /*
-        * Now, initialize the UART
-        */
-       serial_out(&kdb_port_info, UART_LCR, UART_LCR_WLEN8);   /* reset DLAB */
-       if (kdb_port_info.flags & ASYNC_FOURPORT) {
-               kdb_port_info.MCR = UART_MCR_DTR | UART_MCR_RTS;
-               t = UART_MCR_DTR | UART_MCR_OUT1;
-       } else {
-               kdb_port_info.MCR
-                       = UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2;
-               t = UART_MCR_DTR | UART_MCR_RTS;
-       }
-
-       kdb_port_info.MCR = t;          /* no interrupts, please */
-       serial_out(&kdb_port_info, UART_MCR, kdb_port_info.MCR);
-
-       /*
-        * and set the speed of the serial port
-        */
-       if (speed == 0)
-               speed = 9600;
-
-       t = kdb_port_info.state->baud_base / speed;
-       /* set DLAB */
-       serial_out(&kdb_port_info, UART_LCR, UART_LCR_WLEN8 | UART_LCR_DLAB);
-       serial_out(&kdb_port_info, UART_DLL, t & 0xff);/* LS of divisor */
-       serial_out(&kdb_port_info, UART_DLM, t >> 8);  /* MS of divisor */
-       /* reset DLAB */
-       serial_out(&kdb_port_info, UART_LCR, UART_LCR_WLEN8);
-
-       return speed;
-}
-
-int putDebugChar(char c)
-{
-       return generic_putDebugChar(c);
-}
-
-char getDebugChar(void)
-{
-       return generic_getDebugChar();
-}
-
-int rs_putDebugChar(char c)
-{
-
-       if (!kdb_port_info.state) {     /* need to init device first */
-               return 0;
-       }
-
-       while ((serial_in(&kdb_port_info, UART_LSR) & UART_LSR_THRE) == 0)
-               ;
-
-       serial_out(&kdb_port_info, UART_TX, c);
-
-       return 1;
-}
-
-char rs_getDebugChar(void)
-{
-       if (!kdb_port_info.state) {     /* need to init device first */
-               return 0;
-       }
-
-       while (!(serial_in(&kdb_port_info, UART_LSR) & 1))
-               ;
-
-       return serial_in(&kdb_port_info, UART_RX);
-}
index e7cad54..dc78b89 100644 (file)
@@ -199,10 +199,6 @@ void __init plat_mem_setup(void)
         */
        enable_dma(4);
 
-#ifdef CONFIG_KGDB
-       kgdb_config();
-#endif
-
 #ifdef CONFIG_DMA_COHERENT
        if (mips_revision_sconid != MIPS_REVISION_SCON_BONITO)
                panic("Hardware DMA cache coherency not supported");
index 31cc1a5..dd9e7b1 100644 (file)
@@ -24,6 +24,5 @@
 
 obj-y := setup.o prom.o int.o reset.o time.o proc.o platform.o
 obj-$(CONFIG_PCI) += pci.o
-obj-$(CONFIG_KGDB) += gdb_hook.o
 
 EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/nxp/pnx8550/common/gdb_hook.c b/arch/mips/nxp/pnx8550/common/gdb_hook.c
deleted file mode 100644 (file)
index ad4624f..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Carsten Langgaard, carstenl@mips.com
- * Copyright (C) 2000 MIPS Technologies, Inc.  All rights reserved.
- *
- * ########################################################################
- *
- *  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.
- *
- * ########################################################################
- *
- * This is the interface to the remote debugger stub.
- *
- */
-#include <linux/types.h>
-#include <linux/serial.h>
-#include <linux/serialP.h>
-#include <linux/serial_reg.h>
-#include <linux/serial_ip3106.h>
-
-#include <asm/serial.h>
-#include <asm/io.h>
-
-#include <uart.h>
-
-static struct serial_state rs_table[IP3106_NR_PORTS] = {
-};
-static struct async_struct kdb_port_info = {0};
-
-void rs_kgdb_hook(int tty_no)
-{
-       struct serial_state *ser = &rs_table[tty_no];
-
-       kdb_port_info.state = ser;
-       kdb_port_info.magic = SERIAL_MAGIC;
-       kdb_port_info.port  = tty_no;
-       kdb_port_info.flags = ser->flags;
-
-       /*
-        * Clear all interrupts
-        */
-       /* Clear all the transmitter FIFO counters (pointer and status) */
-       ip3106_lcr(UART_BASE, tty_no) |= IP3106_UART_LCR_TX_RST;
-       /* Clear all the receiver FIFO counters (pointer and status) */
-       ip3106_lcr(UART_BASE, tty_no) |= IP3106_UART_LCR_RX_RST;
-       /* Clear all interrupts */
-       ip3106_iclr(UART_BASE, tty_no) = IP3106_UART_INT_ALLRX |
-               IP3106_UART_INT_ALLTX;
-
-       /*
-        * Now, initialize the UART
-        */
-       ip3106_lcr(UART_BASE, tty_no) = IP3106_UART_LCR_8BIT;
-       ip3106_baud(UART_BASE, tty_no) = 5; // 38400 Baud
-}
-
-int putDebugChar(char c)
-{
-       /* Wait until FIFO not full */
-       while (((ip3106_fifo(UART_BASE, kdb_port_info.port) & IP3106_UART_FIFO_TXFIFO) >> 16) >= 16)
-               ;
-       /* Send one char */
-       ip3106_fifo(UART_BASE, kdb_port_info.port) = c;
-
-       return 1;
-}
-
-char getDebugChar(void)
-{
-       char ch;
-
-       /* Wait until there is a char in the FIFO */
-       while (!((ip3106_fifo(UART_BASE, kdb_port_info.port) &
-                                       IP3106_UART_FIFO_RXFIFO) >> 8))
-               ;
-       /* Read one char */
-       ch = ip3106_fifo(UART_BASE, kdb_port_info.port) &
-               IP3106_UART_FIFO_RBRTHR;
-       /* Advance the RX FIFO read pointer */
-       ip3106_lcr(UART_BASE, kdb_port_info.port) |= IP3106_UART_LCR_RX_NEXT;
-       return (ch);
-}
-
-void rs_disable_debug_interrupts(void)
-{
-       ip3106_ien(UART_BASE, kdb_port_info.port) = 0; /* Disable all interrupts */
-}
-
-void rs_enable_debug_interrupts(void)
-{
-       /* Clear all the transmitter FIFO counters (pointer and status) */
-       ip3106_lcr(UART_BASE, kdb_port_info.port) |= IP3106_UART_LCR_TX_RST;
-       /* Clear all the receiver FIFO counters (pointer and status) */
-       ip3106_lcr(UART_BASE, kdb_port_info.port) |= IP3106_UART_LCR_RX_RST;
-       /* Clear all interrupts */
-       ip3106_iclr(UART_BASE, kdb_port_info.port) = IP3106_UART_INT_ALLRX |
-               IP3106_UART_INT_ALLTX;
-       ip3106_ien(UART_BASE, kdb_port_info.port)  = IP3106_UART_INT_ALLRX; /* Enable RX interrupts */
-}
index aad0342..f080f11 100644 (file)
@@ -34,7 +34,6 @@
 #include <linux/module.h>
 
 #include <asm/io.h>
-#include <asm/gdb-stub.h>
 #include <int.h>
 #include <uart.h>
 
index 18b125e..acf1fa8 100644 (file)
@@ -22,7 +22,6 @@
 #include <linux/random.h>
 
 #include <asm/io.h>
-#include <asm/gdb-stub.h>
 #include <int.h>
 #include <uart.h>
 
index 92d764c..2aed50f 100644 (file)
@@ -47,7 +47,6 @@ extern void pnx8550_machine_halt(void);
 extern void pnx8550_machine_power_off(void);
 extern struct resource ioport_resource;
 extern struct resource iomem_resource;
-extern void rs_kgdb_hook(int tty_no);
 extern char *prom_getcmdline(void);
 
 struct resource standard_io_resources[] = {
@@ -142,16 +141,5 @@ void __init plat_mem_setup(void)
                ip3106_baud(UART_BASE, pnx8550_console_port) = 5;
        }
 
-#ifdef CONFIG_KGDB
-       argptr = prom_getcmdline();
-       if ((argptr = strstr(argptr, "kgdb=ttyS")) != NULL) {
-               int line;
-               argptr += strlen("kgdb=ttyS");
-               line = *argptr == '0' ? 0 : 1;
-               rs_kgdb_hook(line);
-               pr_info("KGDB: Using ttyS%i for session, "
-                       "please connect your debugger\n", line ? 1 : 0);
-       }
-#endif
        return;
 }
index 8a17a39..31c1501 100644 (file)
 #include <linux/pci.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/interrupt.h>
 
 #include <asm/addrspace.h>
+#include <asm/txx9irq.h>
+#include <asm/txx9/pci.h>
 #include <asm/txx9/tx3927.h>
 
-static inline int mkaddr(unsigned char bus, unsigned char dev_fn,
-       unsigned char where)
+static int mkaddr(struct pci_bus *bus, unsigned char devfn, unsigned char where)
 {
-       if (bus == 0 && dev_fn >= PCI_DEVFN(TX3927_PCIC_MAX_DEVNU, 0))
-               return PCIBIOS_DEVICE_NOT_FOUND;
-
-       tx3927_pcicptr->ica = ((bus & 0xff) << 0x10) |
-                             ((dev_fn & 0xff) << 0x08) |
-                             (where & 0xfc);
+       if (bus->parent == NULL &&
+           devfn >= PCI_DEVFN(TX3927_PCIC_MAX_DEVNU, 0))
+               return -1;
+       tx3927_pcicptr->ica =
+               ((bus->number & 0xff) << 0x10) |
+               ((devfn & 0xff) << 0x08) |
+               (where & 0xfc) | (bus->parent ? 1 : 0);
 
        /* clear M_ABORT and Disable M_ABORT Int. */
        tx3927_pcicptr->pcistat |= PCI_STATUS_REC_MASTER_ABORT;
        tx3927_pcicptr->pcistatim &= ~PCI_STATUS_REC_MASTER_ABORT;
-
-       return PCIBIOS_SUCCESSFUL;
+       return 0;
 }
 
 static inline int check_abort(void)
 {
-       if (tx3927_pcicptr->pcistat & PCI_STATUS_REC_MASTER_ABORT)
+       if (tx3927_pcicptr->pcistat & PCI_STATUS_REC_MASTER_ABORT) {
                tx3927_pcicptr->pcistat |= PCI_STATUS_REC_MASTER_ABORT;
                tx3927_pcicptr->pcistatim |= PCI_STATUS_REC_MASTER_ABORT;
+               /* flush write buffer */
+               iob();
                return PCIBIOS_DEVICE_NOT_FOUND;
-
+       }
        return PCIBIOS_SUCCESSFUL;
 }
 
 static int tx3927_pci_read_config(struct pci_bus *bus, unsigned int devfn,
        int where, int size, u32 * val)
 {
-       int ret;
-
-       ret = mkaddr(bus->number, devfn, where);
-       if (ret)
-               return ret;
+       if (mkaddr(bus, devfn, where)) {
+               *val = 0xffffffff;
+               return PCIBIOS_DEVICE_NOT_FOUND;
+       }
 
        switch (size) {
        case 1:
@@ -97,11 +100,8 @@ static int tx3927_pci_read_config(struct pci_bus *bus, unsigned int devfn,
 static int tx3927_pci_write_config(struct pci_bus *bus, unsigned int devfn,
        int where, int size, u32 val)
 {
-       int ret;
-
-       ret = mkaddr(bus->number, devfn, where);
-       if (ret)
-               return ret;
+       if (mkaddr(bus, devfn, where))
+               return PCIBIOS_DEVICE_NOT_FOUND;
 
        switch (size) {
        case 1:
@@ -117,11 +117,6 @@ static int tx3927_pci_write_config(struct pci_bus *bus, unsigned int devfn,
                tx3927_pcicptr->icd = cpu_to_le32(val);
        }
 
-       if (tx3927_pcicptr->pcistat & PCI_STATUS_REC_MASTER_ABORT)
-               tx3927_pcicptr->pcistat |= PCI_STATUS_REC_MASTER_ABORT;
-               tx3927_pcicptr->pcistatim |= PCI_STATUS_REC_MASTER_ABORT;
-               return PCIBIOS_DEVICE_NOT_FOUND;
-
        return check_abort();
 }
 
@@ -202,3 +197,34 @@ void __init tx3927_pcic_setup(struct pci_controller *channel,
                PCI_COMMAND_PARITY | PCI_COMMAND_SERR;
        local_irq_restore(flags);
 }
+
+static irqreturn_t tx3927_pcierr_interrupt(int irq, void *dev_id)
+{
+       struct pt_regs *regs = get_irq_regs();
+
+       if (txx9_pci_err_action != TXX9_PCI_ERR_IGNORE) {
+               printk(KERN_WARNING "PCI error interrupt at 0x%08lx.\n",
+                      regs->cp0_epc);
+               printk(KERN_WARNING "pcistat:%02x, lbstat:%04lx\n",
+                      tx3927_pcicptr->pcistat, tx3927_pcicptr->lbstat);
+       }
+       if (txx9_pci_err_action != TXX9_PCI_ERR_PANIC) {
+               /* clear all pci errors */
+               tx3927_pcicptr->pcistat |= TX3927_PCIC_PCISTATIM_ALL;
+               tx3927_pcicptr->istat = TX3927_PCIC_IIM_ALL;
+               tx3927_pcicptr->tstat = TX3927_PCIC_TIM_ALL;
+               tx3927_pcicptr->lbstat = TX3927_PCIC_LBIM_ALL;
+               return IRQ_HANDLED;
+       }
+       console_verbose();
+       panic("PCI error.");
+}
+
+void __init tx3927_setup_pcierr_irq(void)
+{
+       if (request_irq(TXX9_IRQ_BASE + TX3927_IR_PCI,
+                       tx3927_pcierr_interrupt,
+                       IRQF_DISABLED, "PCI error",
+                       (void *)TX3927_PCIC_REG))
+               printk(KERN_WARNING "Failed to request irq for PCIERR\n");
+}
index c6b49bc..5989e74 100644 (file)
@@ -16,6 +16,8 @@
  * option) any later version.
  */
 #include <linux/kernel.h>
+#include <linux/interrupt.h>
+#include <asm/txx9/pci.h>
 #include <asm/txx9/tx4927pcic.h>
 
 static struct {
@@ -85,6 +87,8 @@ static int check_abort(struct tx4927_pcic_reg __iomem *pcicptr)
                __raw_writel((__raw_readl(&pcicptr->pcistatus) & 0x0000ffff)
                             | (PCI_STATUS_REC_MASTER_ABORT << 16),
                             &pcicptr->pcistatus);
+               /* flush write buffer */
+               iob();
                code = PCIBIOS_DEVICE_NOT_FOUND;
        }
        return code;
@@ -192,6 +196,28 @@ static struct {
        .gbwc = 0xfe0,  /* 4064 GBUSCLK for CCFG.GTOT=0b11 */
 };
 
+char *__devinit tx4927_pcibios_setup(char *str)
+{
+       unsigned long val;
+
+       if (!strncmp(str, "trdyto=", 7)) {
+               if (strict_strtoul(str + 7, 0, &val) == 0)
+                       tx4927_pci_opts.trdyto = val;
+               return NULL;
+       }
+       if (!strncmp(str, "retryto=", 8)) {
+               if (strict_strtoul(str + 8, 0, &val) == 0)
+                       tx4927_pci_opts.retryto = val;
+               return NULL;
+       }
+       if (!strncmp(str, "gbwc=", 5)) {
+               if (strict_strtoul(str + 5, 0, &val) == 0)
+                       tx4927_pci_opts.gbwc = val;
+               return NULL;
+       }
+       return str;
+}
+
 void __init tx4927_pcic_setup(struct tx4927_pcic_reg __iomem *pcicptr,
                              struct pci_controller *channel, int extarb)
 {
@@ -406,3 +432,95 @@ void tx4927_report_pcic_status(void)
                        tx4927_report_pcic_status1(pcicptrs[i].pcicptr);
        }
 }
+
+static void tx4927_dump_pcic_settings1(struct tx4927_pcic_reg __iomem *pcicptr)
+{
+       int i;
+       __u32 __iomem *preg = (__u32 __iomem *)pcicptr;
+
+       printk(KERN_INFO "tx4927 pcic (0x%p) settings:", pcicptr);
+       for (i = 0; i < sizeof(struct tx4927_pcic_reg); i += 4, preg++) {
+               if (i % 32 == 0) {
+                       printk(KERN_CONT "\n");
+                       printk(KERN_INFO "%04x:", i);
+               }
+               /* skip registers with side-effects */
+               if (i == offsetof(struct tx4927_pcic_reg, g2pintack)
+                   || i == offsetof(struct tx4927_pcic_reg, g2pspc)
+                   || i == offsetof(struct tx4927_pcic_reg, g2pcfgadrs)
+                   || i == offsetof(struct tx4927_pcic_reg, g2pcfgdata)) {
+                       printk(KERN_CONT " XXXXXXXX");
+                       continue;
+               }
+               printk(KERN_CONT " %08x", __raw_readl(preg));
+       }
+       printk(KERN_CONT "\n");
+}
+
+void tx4927_dump_pcic_settings(void)
+{
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(pcicptrs); i++) {
+               if (pcicptrs[i].pcicptr)
+                       tx4927_dump_pcic_settings1(pcicptrs[i].pcicptr);
+       }
+}
+
+irqreturn_t tx4927_pcierr_interrupt(int irq, void *dev_id)
+{
+       struct pt_regs *regs = get_irq_regs();
+       struct tx4927_pcic_reg __iomem *pcicptr =
+               (struct tx4927_pcic_reg __iomem *)(unsigned long)dev_id;
+
+       if (txx9_pci_err_action != TXX9_PCI_ERR_IGNORE) {
+               printk(KERN_WARNING "PCIERR interrupt at 0x%0*lx\n",
+                      (int)(2 * sizeof(unsigned long)), regs->cp0_epc);
+               tx4927_report_pcic_status1(pcicptr);
+       }
+       if (txx9_pci_err_action != TXX9_PCI_ERR_PANIC) {
+               /* clear all pci errors */
+               __raw_writel((__raw_readl(&pcicptr->pcistatus) & 0x0000ffff)
+                            | (TX4927_PCIC_PCISTATUS_ALL << 16),
+                            &pcicptr->pcistatus);
+               __raw_writel(TX4927_PCIC_G2PSTATUS_ALL, &pcicptr->g2pstatus);
+               __raw_writel(TX4927_PCIC_PBASTATUS_ALL, &pcicptr->pbastatus);
+               __raw_writel(TX4927_PCIC_PCICSTATUS_ALL, &pcicptr->pcicstatus);
+               return IRQ_HANDLED;
+       }
+       console_verbose();
+       tx4927_dump_pcic_settings1(pcicptr);
+       panic("PCI error.");
+}
+
+#ifdef CONFIG_TOSHIBA_FPCIB0
+static void __init tx4927_quirk_slc90e66_bridge(struct pci_dev *dev)
+{
+       struct tx4927_pcic_reg __iomem *pcicptr = pci_bus_to_pcicptr(dev->bus);
+
+       if (!pcicptr)
+               return;
+       if (__raw_readl(&pcicptr->pbacfg) & TX4927_PCIC_PBACFG_PBAEN) {
+               /* Reset Bus Arbiter */
+               __raw_writel(TX4927_PCIC_PBACFG_RPBA, &pcicptr->pbacfg);
+               /*
+                * swap reqBP and reqXP (raise priority of SLC90E66).
+                * SLC90E66(PCI-ISA bridge) is connected to REQ2 on
+                * PCI Backplane board.
+                */
+               __raw_writel(0x72543610, &pcicptr->pbareqport);
+               __raw_writel(0, &pcicptr->pbabm);
+               /* Use Fixed ParkMaster (required by SLC90E66) */
+               __raw_writel(TX4927_PCIC_PBACFG_FIXPA, &pcicptr->pbacfg);
+               /* Enable Bus Arbiter */
+               __raw_writel(TX4927_PCIC_PBACFG_FIXPA |
+                            TX4927_PCIC_PBACFG_PBAEN,
+                            &pcicptr->pbacfg);
+               printk(KERN_INFO "PCI: Use Fixed Park Master (REQPORT %08x)\n",
+                      __raw_readl(&pcicptr->pbareqport));
+       }
+}
+#define PCI_DEVICE_ID_EFAR_SLC90E66_0 0x9460
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_EFAR, PCI_DEVICE_ID_EFAR_SLC90E66_0,
+       tx4927_quirk_slc90e66_bridge);
+#endif
index 27e86a0..aaa9005 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/kernel.h>
+#include <linux/interrupt.h>
 #include <asm/txx9/generic.h>
 #include <asm/txx9/tx4927.h>
 
@@ -81,3 +82,12 @@ int __init tx4927_pciclk66_setup(void)
                pciclk = -1;
        return pciclk;
 }
+
+void __init tx4927_setup_pcierr_irq(void)
+{
+       if (request_irq(TXX9_IRQ_BASE + TX4927_IR_PCIERR,
+                       tx4927_pcierr_interrupt,
+                       IRQF_DISABLED, "PCI error",
+                       (void *)TX4927_PCIC_REG))
+               printk(KERN_WARNING "Failed to request irq for PCIERR\n");
+}
index e537551..60e2c52 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/kernel.h>
+#include <linux/interrupt.h>
 #include <asm/txx9/generic.h>
 #include <asm/txx9/tx4938.h>
 
@@ -132,3 +133,12 @@ int tx4938_pcic1_map_irq(const struct pci_dev *dev, u8 slot)
        }
        return -1;
 }
+
+void __init tx4938_setup_pcierr_irq(void)
+{
+       if (request_irq(TXX9_IRQ_BASE + TX4938_IR_PCIERR,
+                       tx4927_pcierr_interrupt,
+                       IRQF_DISABLED, "PCI error",
+                       (void *)TX4927_PCIC_REG))
+               printk(KERN_WARNING "Failed to request irq for PCIERR\n");
+}
index 77bd5b6..c7fe6ec 100644 (file)
@@ -328,7 +328,11 @@ EXPORT_SYMBOL(PCIBIOS_MIN_IO);
 EXPORT_SYMBOL(PCIBIOS_MIN_MEM);
 #endif
 
-char *pcibios_setup(char *str)
+char * (*pcibios_plat_setup)(char *str) __devinitdata;
+
+char *__devinit pcibios_setup(char *str)
 {
+       if (pcibios_plat_setup)
+               return pcibios_plat_setup(str);
        return str;
 }
index 9de3430..f726162 100644 (file)
 #include <msp_int.h>
 #include <msp_regs.h>
 
-#ifdef CONFIG_KGDB
-/*
- * kgdb uses serial port 1 so the console can remain on port 0.
- * To use port 0 change the definition to read as follows:
- * #define DEBUG_PORT_BASE KSEG1ADDR(MSP_UART0_BASE)
- */
-#define DEBUG_PORT_BASE KSEG1ADDR(MSP_UART1_BASE)
-
-int putDebugChar(char c)
-{
-       volatile uint32_t *uart = (volatile uint32_t *)DEBUG_PORT_BASE;
-       uint32_t val = (uint32_t)c;
-
-       local_irq_disable();
-       while( !(uart[5] & 0x20) ); /* Wait for TXRDY */
-       uart[0] = val;
-       while( !(uart[5] & 0x20) ); /* Wait for TXRDY */
-       local_irq_enable();
-
-       return 1;
-}
-
-char getDebugChar(void)
-{
-       volatile uint32_t *uart = (volatile uint32_t *)DEBUG_PORT_BASE;
-       uint32_t val;
-
-       while( !(uart[5] & 0x01) ); /* Wait for RXRDY */
-       val = uart[0];
-
-       return (char)val;
-}
-
-void initDebugPort(unsigned int uartclk, unsigned int baudrate)
-{
-       unsigned int baud_divisor = (uartclk + 8 * baudrate)/(16 * baudrate);
-
-       /* Enable FIFOs */
-       writeb(UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR |
-                       UART_FCR_CLEAR_XMIT | UART_FCR_TRIGGER_4,
-               (char *)DEBUG_PORT_BASE + (UART_FCR * 4));
-
-       /* Select brtc divisor */
-       writeb(UART_LCR_DLAB, (char *)DEBUG_PORT_BASE + (UART_LCR * 4));
-
-       /* Store divisor lsb */
-       writeb(baud_divisor, (char *)DEBUG_PORT_BASE + (UART_TX * 4));
-
-       /* Store divisor msb */
-       writeb(baud_divisor >> 8, (char *)DEBUG_PORT_BASE + (UART_IER * 4));
-
-       /* Set 8N1 mode */
-       writeb(UART_LCR_WLEN8, (char *)DEBUG_PORT_BASE + (UART_LCR * 4));
-
-       /* Disable flow control */
-       writeb(0, (char *)DEBUG_PORT_BASE + (UART_MCR * 4));
-
-       /* Disable receive interrupt(!) */
-       writeb(0, (char *)DEBUG_PORT_BASE + (UART_IER * 4));
-}
-#endif
-
 void __init msp_serial_setup(void)
 {
        char    *s;
@@ -139,17 +77,6 @@ void __init msp_serial_setup(void)
                case MACH_MSP7120_FPGA:
                        /* Enable UART1 on MSP4200 and MSP7120 */
                        *GPIO_CFG2_REG = 0x00002299;
-
-#ifdef CONFIG_KGDB
-                       /* Initialize UART1 for kgdb since PMON doesn't */
-                       if( DEBUG_PORT_BASE == KSEG1ADDR(MSP_UART1_BASE) ) {
-                               if( mips_machtype == MACH_MSP4200_FPGA
-                                || mips_machtype == MACH_MSP7120_FPGA )
-                                       initDebugPort(uartclk, 19200);
-                               else
-                                       initDebugPort(uartclk, 57600);
-                       }
-#endif
                        break;
 
                default:
index 8fd9a04..b16f95c 100644 (file)
@@ -4,7 +4,6 @@
 
 obj-y    += irq.o prom.o py-console.o setup.o
 
-obj-$(CONFIG_KGDB)             += dbg_io.o
 obj-$(CONFIG_SMP)              += smp.o
 
 EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/pmc-sierra/yosemite/dbg_io.c b/arch/mips/pmc-sierra/yosemite/dbg_io.c
deleted file mode 100644 (file)
index 6362c70..0000000
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Copyright 2003 PMC-Sierra
- * Author: Manish Lachwani (lachwani@pmc-sierra.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.
- */
-
-/*
- * Support for KGDB for the Yosemite board. We make use of single serial
- * port to be used for KGDB as well as console. The second serial port
- * seems to be having a problem. Single IRQ is allocated for both the
- * ports. Hence, the interrupt routing code needs to figure out whether
- * the interrupt came from channel A or B.
- */
-
-#include <asm/serial.h>
-
-/*
- * Baud rate, Parity, Data and Stop bit settings for the
- * serial port on the Yosemite. Note that the Early printk
- * patch has been added. So, we should be all set to go
- */
-#define        YOSEMITE_BAUD_2400      2400
-#define        YOSEMITE_BAUD_4800      4800
-#define        YOSEMITE_BAUD_9600      9600
-#define        YOSEMITE_BAUD_19200     19200
-#define        YOSEMITE_BAUD_38400     38400
-#define        YOSEMITE_BAUD_57600     57600
-#define        YOSEMITE_BAUD_115200    115200
-
-#define        YOSEMITE_PARITY_NONE    0
-#define        YOSEMITE_PARITY_ODD     0x08
-#define        YOSEMITE_PARITY_EVEN    0x18
-#define        YOSEMITE_PARITY_MARK    0x28
-#define        YOSEMITE_PARITY_SPACE   0x38
-
-#define        YOSEMITE_DATA_5BIT      0x0
-#define        YOSEMITE_DATA_6BIT      0x1
-#define        YOSEMITE_DATA_7BIT      0x2
-#define        YOSEMITE_DATA_8BIT      0x3
-
-#define        YOSEMITE_STOP_1BIT      0x0
-#define        YOSEMITE_STOP_2BIT      0x4
-
-/* This is crucial */
-#define        SERIAL_REG_OFS          0x1
-
-#define        SERIAL_RCV_BUFFER       0x0
-#define        SERIAL_TRANS_HOLD       0x0
-#define        SERIAL_SEND_BUFFER      0x0
-#define        SERIAL_INTR_ENABLE      (1 * SERIAL_REG_OFS)
-#define        SERIAL_INTR_ID          (2 * SERIAL_REG_OFS)
-#define        SERIAL_DATA_FORMAT      (3 * SERIAL_REG_OFS)
-#define        SERIAL_LINE_CONTROL     (3 * SERIAL_REG_OFS)
-#define        SERIAL_MODEM_CONTROL    (4 * SERIAL_REG_OFS)
-#define        SERIAL_RS232_OUTPUT     (4 * SERIAL_REG_OFS)
-#define        SERIAL_LINE_STATUS      (5 * SERIAL_REG_OFS)
-#define        SERIAL_MODEM_STATUS     (6 * SERIAL_REG_OFS)
-#define        SERIAL_RS232_INPUT      (6 * SERIAL_REG_OFS)
-#define        SERIAL_SCRATCH_PAD      (7 * SERIAL_REG_OFS)
-
-#define        SERIAL_DIVISOR_LSB      (0 * SERIAL_REG_OFS)
-#define        SERIAL_DIVISOR_MSB      (1 * SERIAL_REG_OFS)
-
-/*
- * Functions to READ and WRITE to serial port 0
- */
-#define        SERIAL_READ(ofs)                (*((volatile unsigned char*)    \
-                                       (TITAN_SERIAL_BASE + ofs)))
-
-#define        SERIAL_WRITE(ofs, val)          ((*((volatile unsigned char*)   \
-                                       (TITAN_SERIAL_BASE + ofs))) = val)
-
-/*
- * Functions to READ and WRITE to serial port 1
- */
-#define        SERIAL_READ_1(ofs)              (*((volatile unsigned char*)    \
-                                       (TITAN_SERIAL_BASE_1 + ofs)))
-
-#define        SERIAL_WRITE_1(ofs, val)        ((*((volatile unsigned char*)   \
-                                       (TITAN_SERIAL_BASE_1 + ofs))) = val)
-
-/*
- * Second serial port initialization
- */
-void init_second_port(void)
-{
-       /* Disable Interrupts */
-       SERIAL_WRITE_1(SERIAL_LINE_CONTROL, 0x0);
-       SERIAL_WRITE_1(SERIAL_INTR_ENABLE, 0x0);
-
-       {
-               unsigned int divisor;
-
-               SERIAL_WRITE_1(SERIAL_LINE_CONTROL, 0x80);
-               divisor = TITAN_SERIAL_BASE_BAUD / YOSEMITE_BAUD_115200;
-               SERIAL_WRITE_1(SERIAL_DIVISOR_LSB, divisor & 0xff);
-
-               SERIAL_WRITE_1(SERIAL_DIVISOR_MSB,
-                              (divisor & 0xff00) >> 8);
-               SERIAL_WRITE_1(SERIAL_LINE_CONTROL, 0x0);
-       }
-
-       SERIAL_WRITE_1(SERIAL_DATA_FORMAT, YOSEMITE_DATA_8BIT |
-                      YOSEMITE_PARITY_NONE | YOSEMITE_STOP_1BIT);
-
-       /* Enable Interrupts */
-       SERIAL_WRITE_1(SERIAL_INTR_ENABLE, 0xf);
-}
-
-/* Initialize the serial port for KGDB debugging */
-void debugInit(unsigned int baud, unsigned char data, unsigned char parity,
-              unsigned char stop)
-{
-       /* Disable Interrupts */
-       SERIAL_WRITE(SERIAL_LINE_CONTROL, 0x0);
-       SERIAL_WRITE(SERIAL_INTR_ENABLE, 0x0);
-
-       {
-               unsigned int divisor;
-
-               SERIAL_WRITE(SERIAL_LINE_CONTROL, 0x80);
-
-               divisor = TITAN_SERIAL_BASE_BAUD / baud;
-               SERIAL_WRITE(SERIAL_DIVISOR_LSB, divisor & 0xff);
-
-               SERIAL_WRITE(SERIAL_DIVISOR_MSB, (divisor & 0xff00) >> 8);
-               SERIAL_WRITE(SERIAL_LINE_CONTROL, 0x0);
-       }
-
-       SERIAL_WRITE(SERIAL_DATA_FORMAT, data | parity | stop);
-}
-
-static int remoteDebugInitialized = 0;
-
-unsigned char getDebugChar(void)
-{
-       if (!remoteDebugInitialized) {
-               remoteDebugInitialized = 1;
-               debugInit(YOSEMITE_BAUD_115200,
-                         YOSEMITE_DATA_8BIT,
-                         YOSEMITE_PARITY_NONE, YOSEMITE_STOP_1BIT);
-       }
-
-       while ((SERIAL_READ(SERIAL_LINE_STATUS) & 0x1) == 0);
-       return SERIAL_READ(SERIAL_RCV_BUFFER);
-}
-
-int putDebugChar(unsigned char byte)
-{
-       if (!remoteDebugInitialized) {
-               remoteDebugInitialized = 1;
-               debugInit(YOSEMITE_BAUD_115200,
-                         YOSEMITE_DATA_8BIT,
-                         YOSEMITE_PARITY_NONE, YOSEMITE_STOP_1BIT);
-       }
-
-       while ((SERIAL_READ(SERIAL_LINE_STATUS) & 0x20) == 0);
-       SERIAL_WRITE(SERIAL_SEND_BUFFER, byte);
-
-       return 1;
-}
index 4decc28..5f673eb 100644 (file)
@@ -141,10 +141,6 @@ asmlinkage void plat_irq_dispatch(void)
        }
 }
 
-#ifdef CONFIG_KGDB
-extern void init_second_port(void);
-#endif
-
 /*
  * Initialize the next level interrupt handler
  */
@@ -156,11 +152,6 @@ void __init arch_init_irq(void)
        rm7k_cpu_irq_init();
        rm9k_cpu_irq_init();
 
-#ifdef CONFIG_KGDB
-       /* At this point, initialize the second serial port */
-       init_second_port();
-#endif
-
 #ifdef CONFIG_GDB_CONSOLE
        register_gdb_console();
 #endif
index b2fe82d..00a1c78 100644 (file)
@@ -64,7 +64,8 @@ static struct resource rb532_dev3_ctl_res[] = {
 
 void set_434_reg(unsigned reg_offs, unsigned bit, unsigned len, unsigned val)
 {
-       unsigned flags, data;
+       unsigned long flags;
+       unsigned data;
        unsigned i = 0;
 
        spin_lock_irqsave(&dev3.lock, flags);
@@ -90,7 +91,7 @@ EXPORT_SYMBOL(get_434_reg);
 
 void set_latch_u5(unsigned char or_mask, unsigned char nand_mask)
 {
-       unsigned flags;
+       unsigned long flags;
 
        spin_lock_irqsave(&dev3.lock, flags);
 
index db74edf..8e7a468 100644 (file)
@@ -49,8 +49,8 @@ static unsigned long __init cal_r4koff(void)
 
 void __init plat_time_init(void)
 {
-       unsigned int est_freq, flags;
-       unsigned long r4k_offset;
+       unsigned int est_freq;
+       unsigned long flags, r4k_offset;
 
        local_irq_save(flags);
 
index 5f389ee..896a1ef 100644 (file)
@@ -20,7 +20,6 @@
 #include <asm/irq.h>
 #include <asm/reboot.h>
 #include <asm/time.h>
-#include <asm/gdb-stub.h>
 #include <asm/io.h>
 #include <asm/traps.h>
 #include <asm/sgialib.h>
@@ -81,30 +80,6 @@ void __init plat_mem_setup(void)
                add_preferred_console("arc", 0, NULL);
        }
 
-#ifdef CONFIG_KGDB
-       {
-       char *kgdb_ttyd = prom_getcmdline();
-
-       if ((kgdb_ttyd = strstr(kgdb_ttyd, "kgdb=ttyd")) != NULL) {
-               int line;
-               kgdb_ttyd += strlen("kgdb=ttyd");
-               if (*kgdb_ttyd != '1' && *kgdb_ttyd != '2')
-                       printk(KERN_INFO "KGDB: Uknown serial line /dev/ttyd%c"
-                              ", falling back to /dev/ttyd1\n", *kgdb_ttyd);
-               line = *kgdb_ttyd == '2' ? 0 : 1;
-               printk(KERN_INFO "KGDB: Using serial line /dev/ttyd%d for "
-                      "session\n", line ? 1 : 2);
-               rs_kgdb_hook(line);
-
-               printk(KERN_INFO "KGDB: Using serial line /dev/ttyd%d for "
-                      "session, please connect your debugger\n", line ? 1:2);
-
-               kgdb_enabled = 1;
-               /* Breakpoints and stuff are in sgi_irq_setup() */
-       }
-       }
-#endif
-
 #if defined(CONFIG_VT) && defined(CONFIG_SGI_NEWPORT_CONSOLE)
        {
                ULONG *gfxinfo;
index e0a6871..31f4931 100644 (file)
@@ -7,7 +7,6 @@ obj-y   := ip27-berr.o ip27-irq.o ip27-init.o ip27-klconfig.o ip27-klnuma.o \
           ip27-xtalk.o
 
 obj-$(CONFIG_EARLY_PRINTK)     += ip27-console.o
-obj-$(CONFIG_KGDB)             += ip27-dbgio.o
 obj-$(CONFIG_SMP)              += ip27-smp.o
 
 EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/sgi-ip27/ip27-dbgio.c b/arch/mips/sgi-ip27/ip27-dbgio.c
deleted file mode 100644 (file)
index 08fd88b..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- *  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.
- *
- * Copyright 2004 Ralf Baechle <ralf@linux-mips.org>
- */
-#include <asm/sn/addrs.h>
-#include <asm/sn/sn0/hub.h>
-#include <asm/sn/klconfig.h>
-#include <asm/sn/ioc3.h>
-#include <asm/sn/sn_private.h>
-
-#include <linux/serial.h>
-#include <linux/serial_core.h>
-#include <linux/serial_reg.h>
-
-#define IOC3_CLK        (22000000 / 3)
-#define IOC3_FLAGS      (0)
-
-static inline struct ioc3_uartregs *console_uart(void)
-{
-       struct ioc3 *ioc3;
-
-       ioc3 = (struct ioc3 *)KL_CONFIG_CH_CONS_INFO(get_nasid())->memory_base;
-
-       return &ioc3->sregs.uarta;
-}
-
-unsigned char getDebugChar(void)
-{
-       struct ioc3_uartregs *uart = console_uart();
-
-       while ((uart->iu_lsr & UART_LSR_DR) == 0);
-       return uart->iu_rbr;
-}
-
-void putDebugChar(unsigned char c)
-{
-       struct ioc3_uartregs *uart = console_uart();
-
-       while ((uart->iu_lsr & UART_LSR_THRE) == 0);
-       uart->iu_thr = c;
-}
index db372a0..a35818e 100644 (file)
@@ -57,30 +57,6 @@ static void bcm1480_set_affinity(unsigned int irq, cpumask_t mask);
 extern unsigned long ht_eoi_space;
 #endif
 
-#ifdef CONFIG_KGDB
-#include <asm/gdb-stub.h>
-extern void breakpoint(void);
-static int kgdb_irq;
-#ifdef CONFIG_GDB_CONSOLE
-extern void register_gdb_console(void);
-#endif
-
-/* kgdb is on when configured.  Pass "nokgdb" kernel arg to turn it off */
-static int kgdb_flag = 1;
-static int __init nokgdb(char *str)
-{
-       kgdb_flag = 0;
-       return 1;
-}
-__setup("nokgdb", nokgdb);
-
-/* Default to UART1 */
-int kgdb_port = 1;
-#ifdef CONFIG_SERIAL_SB1250_DUART
-extern char sb1250_duart_present[];
-#endif
-#endif
-
 static struct irq_chip bcm1480_irq_type = {
        .name = "BCM1480-IMR",
        .ack = ack_bcm1480_irq,
@@ -355,61 +331,10 @@ void __init arch_init_irq(void)
         * does its own management of IP7.
         */
 
-#ifdef CONFIG_KGDB
-       imask |= STATUSF_IP6;
-#endif
        /* Enable necessary IPs, disable the rest */
        change_c0_status(ST0_IM, imask);
-
-#ifdef CONFIG_KGDB
-       if (kgdb_flag) {
-               kgdb_irq = K_BCM1480_INT_UART_0 + kgdb_port;
-
-#ifdef CONFIG_SERIAL_SB1250_DUART
-               sb1250_duart_present[kgdb_port] = 0;
-#endif
-               /* Setup uart 1 settings, mapper */
-               /* QQQ FIXME */
-               __raw_writeq(M_DUART_IMR_BRK, IOADDR(A_DUART_IMRREG(kgdb_port)));
-
-               __raw_writeq(IMR_IP6_VAL,
-                            IOADDR(A_BCM1480_IMR_REGISTER(0, R_BCM1480_IMR_INTERRUPT_MAP_BASE_H) +
-                            (kgdb_irq << 3)));
-               bcm1480_unmask_irq(0, kgdb_irq);
-
-#ifdef CONFIG_GDB_CONSOLE
-               register_gdb_console();
-#endif
-               printk("Waiting for GDB on UART port %d\n", kgdb_port);
-               set_debug_traps();
-               breakpoint();
-       }
-#endif
-}
-
-#ifdef CONFIG_KGDB
-
-#include <linux/delay.h>
-
-#define duart_out(reg, val)     csr_out32(val, IOADDR(A_DUART_CHANREG(kgdb_port, reg)))
-#define duart_in(reg)           csr_in32(IOADDR(A_DUART_CHANREG(kgdb_port, reg)))
-
-static void bcm1480_kgdb_interrupt(void)
-{
-       /*
-        * Clear break-change status (allow some time for the remote
-        * host to stop the break, since we would see another
-        * interrupt on the end-of-break too)
-        */
-       kstat.irqs[smp_processor_id()][kgdb_irq]++;
-       mdelay(500);
-       duart_out(R_DUART_CMD, V_DUART_MISC_CMD_RESET_BREAK_INT |
-                               M_DUART_RX_EN | M_DUART_TX_EN);
-       set_async_breakpoint(&get_irq_regs()->cp0_epc);
 }
 
-#endif         /* CONFIG_KGDB */
-
 extern void bcm1480_mailbox_interrupt(void);
 
 static inline void dispatch_ip2(void)
@@ -462,11 +387,6 @@ asmlinkage void plat_irq_dispatch(void)
                bcm1480_mailbox_interrupt();
 #endif
 
-#ifdef CONFIG_KGDB
-       else if (pending & CAUSEF_IP6)
-               bcm1480_kgdb_interrupt();               /* KGDB (uart 1) */
-#endif
-
        else if (pending & CAUSEF_IP2)
                dispatch_ip2();
 }
index fd9604d..3de30f7 100644 (file)
@@ -59,10 +59,6 @@ int cfe_cons_handle;
 extern unsigned long initrd_start, initrd_end;
 #endif
 
-#ifdef CONFIG_KGDB
-extern int kgdb_port;
-#endif
-
 static void __noreturn cfe_linux_exit(void *arg)
 {
        int warm = *(int *)arg;
@@ -246,9 +242,6 @@ void __init prom_init(void)
        int argc = fw_arg0;
        char **envp = (char **) fw_arg2;
        int *prom_vec = (int *) fw_arg3;
-#ifdef CONFIG_KGDB
-       char *arg;
-#endif
 
        _machine_restart   = cfe_linux_restart;
        _machine_halt      = cfe_linux_halt;
@@ -309,13 +302,6 @@ void __init prom_init(void)
                }
        }
 
-#ifdef CONFIG_KGDB
-       if ((arg = strstr(arcs_cmdline, "kgdb=duart")) != NULL)
-               kgdb_port = (arg[10] == '0') ? 0 : 1;
-       else
-               kgdb_port = 1;
-#endif
-
 #ifdef CONFIG_BLK_DEV_INITRD
        {
                char *ptr;
index eac9065..a515848 100644 (file)
@@ -57,16 +57,6 @@ static void sb1250_set_affinity(unsigned int irq, cpumask_t mask);
 extern unsigned long ldt_eoi_space;
 #endif
 
-#ifdef CONFIG_KGDB
-static int kgdb_irq;
-
-/* Default to UART1 */
-int kgdb_port = 1;
-#ifdef CONFIG_SERIAL_SB1250_DUART
-extern char sb1250_duart_present[];
-#endif
-#endif
-
 static struct irq_chip sb1250_irq_type = {
        .name = "SB1250-IMR",
        .ack = ack_sb1250_irq,
@@ -313,55 +303,10 @@ void __init arch_init_irq(void)
         * does its own management of IP7.
         */
 
-#ifdef CONFIG_KGDB
-       imask |= STATUSF_IP6;
-#endif
        /* Enable necessary IPs, disable the rest */
        change_c0_status(ST0_IM, imask);
-
-#ifdef CONFIG_KGDB
-       if (kgdb_flag) {
-               kgdb_irq = K_INT_UART_0 + kgdb_port;
-
-#ifdef CONFIG_SERIAL_SB1250_DUART
-               sb1250_duart_present[kgdb_port] = 0;
-#endif
-               /* Setup uart 1 settings, mapper */
-               __raw_writeq(M_DUART_IMR_BRK,
-                            IOADDR(A_DUART_IMRREG(kgdb_port)));
-
-               __raw_writeq(IMR_IP6_VAL,
-                            IOADDR(A_IMR_REGISTER(0,
-                                                  R_IMR_INTERRUPT_MAP_BASE) +
-                                   (kgdb_irq << 3)));
-               sb1250_unmask_irq(0, kgdb_irq);
-       }
-#endif
-}
-
-#ifdef CONFIG_KGDB
-
-#include <linux/delay.h>
-
-#define duart_out(reg, val)     csr_out32(val, IOADDR(A_DUART_CHANREG(kgdb_port, reg)))
-#define duart_in(reg)           csr_in32(IOADDR(A_DUART_CHANREG(kgdb_port, reg)))
-
-static void sb1250_kgdb_interrupt(void)
-{
-       /*
-        * Clear break-change status (allow some time for the remote
-        * host to stop the break, since we would see another
-        * interrupt on the end-of-break too)
-        */
-       kstat_this_cpu.irqs[kgdb_irq]++;
-       mdelay(500);
-       duart_out(R_DUART_CMD, V_DUART_MISC_CMD_RESET_BREAK_INT |
-                               M_DUART_RX_EN | M_DUART_TX_EN);
-       set_async_breakpoint(&get_irq_regs()->cp0_epc);
 }
 
-#endif         /* CONFIG_KGDB */
-
 extern void sb1250_mailbox_interrupt(void);
 
 static inline void dispatch_ip2(void)
@@ -407,11 +352,6 @@ asmlinkage void plat_irq_dispatch(void)
                sb1250_mailbox_interrupt();
 #endif
 
-#ifdef CONFIG_KGDB
-       else if (pending & CAUSEF_IP6)                  /* KGDB (uart 1) */
-               sb1250_kgdb_interrupt();
-#endif
-
        else if (pending & CAUSEF_IP2)
                dispatch_ip2();
        else
index 255d692..f18ba92 100644 (file)
@@ -1,4 +1,3 @@
 obj-y                          := setup.o rtc_xicor1241.o rtc_m41t81.o
 
 obj-$(CONFIG_I2C_BOARDINFO)    += swarm-i2c.o
-obj-$(CONFIG_KGDB)             += dbg_io.o
diff --git a/arch/mips/sibyte/swarm/dbg_io.c b/arch/mips/sibyte/swarm/dbg_io.c
deleted file mode 100644 (file)
index b97ae30..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * kgdb debug routines for SiByte boards.
- *
- * Copyright (C) 2001 MontaVista Software Inc.
- * Author: Jun Sun, jsun@mvista.com or jsun@junsun.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.
- *
- */
-
-/* -------------------- BEGINNING OF CONFIG --------------------- */
-
-#include <linux/delay.h>
-#include <asm/io.h>
-#include <asm/sibyte/sb1250.h>
-#include <asm/sibyte/sb1250_regs.h>
-#include <asm/sibyte/sb1250_uart.h>
-#include <asm/sibyte/sb1250_int.h>
-#include <asm/addrspace.h>
-
-/*
- * We use the second serial port for kgdb traffic.
- *     115200, 8, N, 1.
- */
-
-#define        BAUD_RATE               115200
-#define        CLK_DIVISOR             V_DUART_BAUD_RATE(BAUD_RATE)
-#define        DATA_BITS               V_DUART_BITS_PER_CHAR_8         /* or 7    */
-#define        PARITY                  V_DUART_PARITY_MODE_NONE        /* or even */
-#define        STOP_BITS               M_DUART_STOP_BIT_LEN_1          /* or 2    */
-
-static int duart_initialized = 0;      /* 0: need to be init'ed by kgdb */
-
-/* -------------------- END OF CONFIG --------------------- */
-extern int kgdb_port;
-
-#define        duart_out(reg, val)     csr_out32(val, IOADDR(A_DUART_CHANREG(kgdb_port, reg)))
-#define duart_in(reg)          csr_in32(IOADDR(A_DUART_CHANREG(kgdb_port, reg)))
-
-void putDebugChar(unsigned char c);
-unsigned char getDebugChar(void);
-static void
-duart_init(int clk_divisor, int data, int parity, int stop)
-{
-       duart_out(R_DUART_MODE_REG_1, data | parity);
-       duart_out(R_DUART_MODE_REG_2, stop);
-       duart_out(R_DUART_CLK_SEL, clk_divisor);
-
-       duart_out(R_DUART_CMD, M_DUART_RX_EN | M_DUART_TX_EN);  /* enable rx and tx */
-}
-
-void
-putDebugChar(unsigned char c)
-{
-       if (!duart_initialized) {
-               duart_initialized = 1;
-               duart_init(CLK_DIVISOR, DATA_BITS, PARITY, STOP_BITS);
-       }
-       while ((duart_in(R_DUART_STATUS) & M_DUART_TX_RDY) == 0);
-       duart_out(R_DUART_TX_HOLD, c);
-}
-
-unsigned char
-getDebugChar(void)
-{
-       if (!duart_initialized) {
-               duart_initialized = 1;
-               duart_init(CLK_DIVISOR, DATA_BITS, PARITY, STOP_BITS);
-       }
-       while ((duart_in(R_DUART_STATUS) & M_DUART_RX_RDY) == 0) ;
-       return duart_in(R_DUART_RX_HOLD);
-}
-
index 6de4c5a..840fe75 100644 (file)
@@ -1,3 +1,27 @@
+config MACH_TX39XX
+       bool
+       select MACH_TXX9
+       select SYS_HAS_CPU_TX39XX
+
+config MACH_TX49XX
+       bool
+       select MACH_TXX9
+       select CEVT_R4K
+       select CSRC_R4K
+       select IRQ_CPU
+       select SYS_HAS_CPU_TX49XX
+       select SYS_SUPPORTS_64BIT_KERNEL
+
+config MACH_TXX9
+       bool
+       select DMA_NONCOHERENT
+       select SWAP_IO_SPACE
+       select SYS_HAS_EARLY_PRINTK
+       select SYS_SUPPORTS_32BIT_KERNEL
+       select SYS_SUPPORTS_LITTLE_ENDIAN
+       select SYS_SUPPORTS_BIG_ENDIAN
+       select GENERIC_HARDIRQS_NO__DO_IRQ
+
 config TOSHIBA_JMR3927
        bool "Toshiba JMR-TX3927 board"
        depends on MACH_TX39XX
@@ -24,68 +48,37 @@ config TOSHIBA_RBTX4938
 config SOC_TX3927
        bool
        select CEVT_TXX9
-       select DMA_NONCOHERENT
        select HAS_TXX9_SERIAL
        select HW_HAS_PCI
        select IRQ_TXX9
-       select SWAP_IO_SPACE
-       select SYS_HAS_CPU_TX39XX
-       select SYS_SUPPORTS_32BIT_KERNEL
-       select SYS_SUPPORTS_LITTLE_ENDIAN
-       select SYS_SUPPORTS_BIG_ENDIAN
-       select GENERIC_HARDIRQS_NO__DO_IRQ
        select GPIO_TXX9
 
 config SOC_TX4927
        bool
-       select CEVT_R4K
-       select CSRC_R4K
        select CEVT_TXX9
-       select DMA_NONCOHERENT
        select HAS_TXX9_SERIAL
        select HW_HAS_PCI
-       select IRQ_CPU
        select IRQ_TXX9
        select PCI_TX4927
-       select SWAP_IO_SPACE
-       select SYS_HAS_CPU_TX49XX
-       select SYS_SUPPORTS_32BIT_KERNEL
-       select SYS_SUPPORTS_64BIT_KERNEL
-       select SYS_SUPPORTS_LITTLE_ENDIAN
-       select SYS_SUPPORTS_BIG_ENDIAN
-       select SYS_SUPPORTS_KGDB
-       select GENERIC_HARDIRQS_NO__DO_IRQ
        select GPIO_TXX9
 
 config SOC_TX4938
        bool
-       select CEVT_R4K
-       select CSRC_R4K
        select CEVT_TXX9
-       select DMA_NONCOHERENT
        select HAS_TXX9_SERIAL
        select HW_HAS_PCI
-       select IRQ_CPU
        select IRQ_TXX9
        select PCI_TX4927
-       select SWAP_IO_SPACE
-       select SYS_HAS_CPU_TX49XX
-       select SYS_SUPPORTS_32BIT_KERNEL
-       select SYS_SUPPORTS_64BIT_KERNEL
-       select SYS_SUPPORTS_LITTLE_ENDIAN
-       select SYS_SUPPORTS_BIG_ENDIAN
-       select SYS_SUPPORTS_KGDB
-       select GENERIC_HARDIRQS_NO__DO_IRQ
        select GPIO_TXX9
 
 config TOSHIBA_FPCIB0
        bool "FPCIB0 Backplane Support"
-       depends on PCI && (MACH_TX39XX || MACH_TX49XX)
+       depends on PCI && MACH_TXX9
        select I8259
 
 config PICMG_PCI_BACKPLANE_DEFAULT
        bool "Support for PICMG PCI Backplane"
-       depends on PCI && (MACH_TX39XX || MACH_TX49XX)
+       depends on PCI && MACH_TXX9
        default y if !TOSHIBA_FPCIB0
 
 if TOSHIBA_RBTX4938
index 9c12077..9bb34af 100644 (file)
@@ -4,9 +4,9 @@
 
 obj-y  += setup.o
 obj-$(CONFIG_PCI)      += pci.o
+obj-$(CONFIG_SOC_TX3927)       += setup_tx3927.o irq_tx3927.o
 obj-$(CONFIG_SOC_TX4927)       += mem_tx4927.o setup_tx4927.o irq_tx4927.o
 obj-$(CONFIG_SOC_TX4938)       += mem_tx4927.o setup_tx4938.o irq_tx4938.o
 obj-$(CONFIG_TOSHIBA_FPCIB0)   += smsc_fdc37m81x.o
-obj-$(CONFIG_KGDB)     += dbgio.o
 
 EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/txx9/generic/dbgio.c b/arch/mips/txx9/generic/dbgio.c
deleted file mode 100644 (file)
index 33b9c67..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * linux/arch/mips/tx4938/common/dbgio.c
- *
- * kgdb interface for gdb
- *
- * Author: MontaVista Software, Inc.
- *         source@mvista.com
- *
- * Copyright 2005 MontaVista Software 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 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.
- *
- * Support for TX4938 in 2.6 - Hiroshi DOYU <Hiroshi_DOYU@montavista.co.jp>
- */
-
-#include <linux/types>
-
-extern u8 txx9_sio_kdbg_rd(void);
-extern int txx9_sio_kdbg_wr( u8 ch );
-
-u8 getDebugChar(void)
-{
-       return (txx9_sio_kdbg_rd());
-}
-
-int putDebugChar(u8 byte)
-{
-       return (txx9_sio_kdbg_wr(byte));
-}
-
diff --git a/arch/mips/txx9/generic/irq_tx3927.c b/arch/mips/txx9/generic/irq_tx3927.c
new file mode 100644 (file)
index 0000000..c683f59
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Common tx3927 irq handler
+ *
+ * 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 2001 MontaVista Software Inc.
+ * Copyright (C) 2000-2001 Toshiba Corporation
+ */
+#include <linux/init.h>
+#include <asm/txx9irq.h>
+#include <asm/txx9/tx3927.h>
+
+void __init tx3927_irq_init(void)
+{
+       int i;
+
+       txx9_irq_init(TX3927_IRC_REG);
+       /* raise priority for timers, sio */
+       for (i = 0; i < TX3927_NR_TMR; i++)
+               txx9_irq_set_pri(TX3927_IR_TMR(i), 6);
+       for (i = 0; i < TX3927_NR_SIO; i++)
+               txx9_irq_set_pri(TX3927_IR_SIO(i), 7);
+}
index 0b92d8c..7b637a7 100644 (file)
@@ -386,3 +386,39 @@ int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
 {
        return txx9_board_vec->pci_map_irq(dev, slot, pin);
 }
+
+char * (*txx9_board_pcibios_setup)(char *str) __devinitdata;
+
+char *__devinit txx9_pcibios_setup(char *str)
+{
+       if (txx9_board_pcibios_setup && !txx9_board_pcibios_setup(str))
+               return NULL;
+       if (!strcmp(str, "picmg")) {
+               /* PICMG compliant backplane (TOSHIBA JMB-PICMG-ATX
+                  (5V or 3.3V), JMB-PICMG-L2 (5V only), etc.) */
+               txx9_pci_option |= TXX9_PCI_OPT_PICMG;
+               return NULL;
+       } else if (!strcmp(str, "nopicmg")) {
+               /* non-PICMG compliant backplane (TOSHIBA
+                  RBHBK4100,RBHBK4200, Interface PCM-PCM05, etc.) */
+               txx9_pci_option &= ~TXX9_PCI_OPT_PICMG;
+               return NULL;
+       } else if (!strncmp(str, "clk=", 4)) {
+               char *val = str + 4;
+               txx9_pci_option &= ~TXX9_PCI_OPT_CLK_MASK;
+               if (strcmp(val, "33") == 0)
+                       txx9_pci_option |= TXX9_PCI_OPT_CLK_33;
+               else if (strcmp(val, "66") == 0)
+                       txx9_pci_option |= TXX9_PCI_OPT_CLK_66;
+               else /* "auto" */
+                       txx9_pci_option |= TXX9_PCI_OPT_CLK_AUTO;
+               return NULL;
+       } else if (!strncmp(str, "err=", 4)) {
+               if (!strcmp(str + 4, "panic"))
+                       txx9_pci_err_action = TXX9_PCI_ERR_PANIC;
+               else if (!strcmp(str + 4, "ignore"))
+                       txx9_pci_err_action = TXX9_PCI_ERR_IGNORE;
+               return NULL;
+       }
+       return str;
+}
index 8c60c78..1bc57d0 100644 (file)
 #include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/gpio.h>
+#include <linux/platform_device.h>
+#include <linux/serial_core.h>
 #include <asm/bootinfo.h>
 #include <asm/time.h>
+#include <asm/reboot.h>
 #include <asm/txx9/generic.h>
+#include <asm/txx9/pci.h>
 #ifdef CONFIG_CPU_TX49XX
 #include <asm/txx9/tx4938.h>
 #endif
@@ -187,6 +191,117 @@ char * __init prom_getcmdline(void)
        return &(arcs_cmdline[0]);
 }
 
+static void __noreturn txx9_machine_halt(void)
+{
+       local_irq_disable();
+       clear_c0_status(ST0_IM);
+       while (1) {
+               if (cpu_wait) {
+                       (*cpu_wait)();
+                       if (cpu_has_counter) {
+                               /*
+                                * Clear counter interrupt while it
+                                * breaks WAIT instruction even if
+                                * masked.
+                                */
+                               write_c0_compare(0);
+                       }
+               }
+       }
+}
+
+/* Watchdog support */
+void __init txx9_wdt_init(unsigned long base)
+{
+       struct resource res = {
+               .start  = base,
+               .end    = base + 0x100 - 1,
+               .flags  = IORESOURCE_MEM,
+       };
+       platform_device_register_simple("txx9wdt", -1, &res, 1);
+}
+
+/* SPI support */
+void __init txx9_spi_init(int busid, unsigned long base, int irq)
+{
+       struct resource res[] = {
+               {
+                       .start  = base,
+                       .end    = base + 0x20 - 1,
+                       .flags  = IORESOURCE_MEM,
+               }, {
+                       .start  = irq,
+                       .flags  = IORESOURCE_IRQ,
+               },
+       };
+       platform_device_register_simple("spi_txx9", busid,
+                                       res, ARRAY_SIZE(res));
+}
+
+void __init txx9_ethaddr_init(unsigned int id, unsigned char *ethaddr)
+{
+       struct platform_device *pdev =
+               platform_device_alloc("tc35815-mac", id);
+       if (!pdev ||
+           platform_device_add_data(pdev, ethaddr, 6) ||
+           platform_device_add(pdev))
+               platform_device_put(pdev);
+}
+
+void __init txx9_sio_init(unsigned long baseaddr, int irq,
+                         unsigned int line, unsigned int sclk, int nocts)
+{
+#ifdef CONFIG_SERIAL_TXX9
+       struct uart_port req;
+
+       memset(&req, 0, sizeof(req));
+       req.line = line;
+       req.iotype = UPIO_MEM;
+       req.membase = ioremap(baseaddr, 0x24);
+       req.mapbase = baseaddr;
+       req.irq = irq;
+       if (!nocts)
+               req.flags |= UPF_BUGGY_UART /*HAVE_CTS_LINE*/;
+       if (sclk) {
+               req.flags |= UPF_MAGIC_MULTIPLIER /*USE_SCLK*/;
+               req.uartclk = sclk;
+       } else
+               req.uartclk = TXX9_IMCLK;
+       early_serial_txx9_setup(&req);
+#endif /* CONFIG_SERIAL_TXX9 */
+}
+
+#ifdef CONFIG_EARLY_PRINTK
+static void __init null_prom_putchar(char c)
+{
+}
+void (*txx9_prom_putchar)(char c) __initdata = null_prom_putchar;
+
+void __init prom_putchar(char c)
+{
+       txx9_prom_putchar(c);
+}
+
+static void __iomem *early_txx9_sio_port;
+
+static void __init early_txx9_sio_putchar(char c)
+{
+#define TXX9_SICISR    0x0c
+#define TXX9_SITFIFO   0x1c
+#define TXX9_SICISR_TXALS      0x00000002
+       while (!(__raw_readl(early_txx9_sio_port + TXX9_SICISR) &
+                TXX9_SICISR_TXALS))
+               ;
+       __raw_writel(c, early_txx9_sio_port + TXX9_SITFIFO);
+}
+
+void __init txx9_sio_putchar_init(unsigned long baseaddr)
+{
+       early_txx9_sio_port = ioremap(baseaddr, 0x24);
+       txx9_prom_putchar = early_txx9_sio_putchar;
+}
+#endif /* CONFIG_EARLY_PRINTK */
+
 /* wrappers */
 void __init plat_mem_setup(void)
 {
@@ -194,6 +309,15 @@ void __init plat_mem_setup(void)
        ioport_resource.end = ~0UL;     /* no limit */
        iomem_resource.start = 0;
        iomem_resource.end = ~0UL;      /* no limit */
+
+       /* fallback restart/halt routines */
+       _machine_restart = (void (*)(char *))txx9_machine_halt;
+       _machine_halt = txx9_machine_halt;
+       pm_power_off = txx9_machine_halt;
+
+#ifdef CONFIG_PCI
+       pcibios_plat_setup = txx9_pcibios_setup;
+#endif
        txx9_board_vec->mem_setup();
 }
 
diff --git a/arch/mips/txx9/generic/setup_tx3927.c b/arch/mips/txx9/generic/setup_tx3927.c
new file mode 100644 (file)
index 0000000..7bd963d
--- /dev/null
@@ -0,0 +1,130 @@
+/*
+ * TX3927 setup routines
+ * Based on linux/arch/mips/txx9/jmr3927/setup.c
+ *
+ * Copyright 2001 MontaVista Software Inc.
+ * Copyright (C) 2000-2001 Toshiba Corporation
+ * Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org)
+ *
+ * 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/ioport.h>
+#include <linux/delay.h>
+#include <linux/param.h>
+#include <linux/io.h>
+#include <asm/mipsregs.h>
+#include <asm/txx9irq.h>
+#include <asm/txx9tmr.h>
+#include <asm/txx9pio.h>
+#include <asm/txx9/generic.h>
+#include <asm/txx9/tx3927.h>
+
+void __init tx3927_wdt_init(void)
+{
+       txx9_wdt_init(TX3927_TMR_REG(2));
+}
+
+void __init tx3927_setup(void)
+{
+       int i;
+       unsigned int conf;
+
+       /* don't enable - see errata */
+       txx9_ccfg_toeon = 0;
+       if (strstr(prom_getcmdline(), "toeon") != NULL)
+               txx9_ccfg_toeon = 1;
+
+       txx9_reg_res_init(TX3927_REV_PCODE(), TX3927_REG_BASE,
+                         TX3927_REG_SIZE);
+
+       /* SDRAMC,ROMC are configured by PROM */
+       for (i = 0; i < 8; i++) {
+               if (!(tx3927_romcptr->cr[i] & 0x8))
+                       continue;       /* disabled */
+               txx9_ce_res[i].start = (unsigned long)TX3927_ROMC_BA(i);
+               txx9_ce_res[i].end =
+                       txx9_ce_res[i].start + TX3927_ROMC_SIZE(i) - 1;
+               request_resource(&iomem_resource, &txx9_ce_res[i]);
+       }
+
+       /* clocks */
+       txx9_gbus_clock = txx9_cpu_clock / 2;
+       /* change default value to udelay/mdelay take reasonable time */
+       loops_per_jiffy = txx9_cpu_clock / HZ / 2;
+
+       /* CCFG */
+       /* enable Timeout BusError */
+       if (txx9_ccfg_toeon)
+               tx3927_ccfgptr->ccfg |= TX3927_CCFG_TOE;
+
+       /* clear BusErrorOnWrite flag */
+       tx3927_ccfgptr->ccfg &= ~TX3927_CCFG_BEOW;
+       if (read_c0_conf() & TX39_CONF_WBON)
+               /* Disable PCI snoop */
+               tx3927_ccfgptr->ccfg &= ~TX3927_CCFG_PSNP;
+       else
+               /* Enable PCI SNOOP - with write through only */
+               tx3927_ccfgptr->ccfg |= TX3927_CCFG_PSNP;
+       /* do reset on watchdog */
+       tx3927_ccfgptr->ccfg |= TX3927_CCFG_WR;
+
+       printk(KERN_INFO "TX3927 -- CRIR:%08lx CCFG:%08lx PCFG:%08lx\n",
+              tx3927_ccfgptr->crir,
+              tx3927_ccfgptr->ccfg, tx3927_ccfgptr->pcfg);
+
+       /* TMR */
+       for (i = 0; i < TX3927_NR_TMR; i++)
+               txx9_tmr_init(TX3927_TMR_REG(i));
+
+       /* DMA */
+       tx3927_dmaptr->mcr = 0;
+       for (i = 0; i < ARRAY_SIZE(tx3927_dmaptr->ch); i++) {
+               /* reset channel */
+               tx3927_dmaptr->ch[i].ccr = TX3927_DMA_CCR_CHRST;
+               tx3927_dmaptr->ch[i].ccr = 0;
+       }
+       /* enable DMA */
+#ifdef __BIG_ENDIAN
+       tx3927_dmaptr->mcr = TX3927_DMA_MCR_MSTEN;
+#else
+       tx3927_dmaptr->mcr = TX3927_DMA_MCR_MSTEN | TX3927_DMA_MCR_LE;
+#endif
+
+       /* PIO */
+       __raw_writel(0, &tx3927_pioptr->maskcpu);
+       __raw_writel(0, &tx3927_pioptr->maskext);
+       txx9_gpio_init(TX3927_PIO_REG, 0, 16);
+
+       conf = read_c0_conf();
+       if (!(conf & TX39_CONF_ICE))
+               printk(KERN_INFO "TX3927 I-Cache disabled.\n");
+       if (!(conf & TX39_CONF_DCE))
+               printk(KERN_INFO "TX3927 D-Cache disabled.\n");
+       else if (!(conf & TX39_CONF_WBON))
+               printk(KERN_INFO "TX3927 D-Cache WriteThrough.\n");
+       else if (!(conf & TX39_CONF_CWFON))
+               printk(KERN_INFO "TX3927 D-Cache WriteBack.\n");
+       else
+               printk(KERN_INFO "TX3927 D-Cache WriteBack (CWF) .\n");
+}
+
+void __init tx3927_time_init(unsigned int evt_tmrnr, unsigned int src_tmrnr)
+{
+       txx9_clockevent_init(TX3927_TMR_REG(evt_tmrnr),
+                            TXX9_IRQ_BASE + TX3927_IR_TMR(evt_tmrnr),
+                            TXX9_IMCLK);
+       txx9_clocksource_init(TX3927_TMR_REG(src_tmrnr), TXX9_IMCLK);
+}
+
+void __init tx3927_sio_init(unsigned int sclk, unsigned int cts_mask)
+{
+       int i;
+
+       for (i = 0; i < 2; i++)
+               txx9_sio_init(TX3927_SIO_REG(i),
+                             TXX9_IRQ_BASE + TX3927_IR_SIO(i),
+                             i, sclk, (1 << i) & cts_mask);
+}
index 89d6e28..f80d4b7 100644 (file)
@@ -13,7 +13,6 @@
 #include <linux/init.h>
 #include <linux/ioport.h>
 #include <linux/delay.h>
-#include <linux/serial_core.h>
 #include <linux/param.h>
 #include <asm/txx9irq.h>
 #include <asm/txx9tmr.h>
@@ -21,7 +20,7 @@
 #include <asm/txx9/generic.h>
 #include <asm/txx9/tx4927.h>
 
-void __init tx4927_wdr_init(void)
+static void __init tx4927_wdr_init(void)
 {
        /* clear WatchDogReset (W1C) */
        tx4927_ccfg_set(TX4927_CCFG_WDRST);
@@ -29,6 +28,11 @@ void __init tx4927_wdr_init(void)
        tx4927_ccfg_set(TX4927_CCFG_WR);
 }
 
+void __init tx4927_wdt_init(void)
+{
+       txx9_wdt_init(TX4927_TMR_REG(2) & 0xfffffffffULL);
+}
+
 static struct resource tx4927_sdram_resource[4];
 
 void __init tx4927_setup(void)
@@ -173,22 +177,12 @@ void __init tx4927_time_init(unsigned int tmrnr)
                                     TXX9_IMCLK);
 }
 
-void __init tx4927_setup_serial(void)
+void __init tx4927_sio_init(unsigned int sclk, unsigned int cts_mask)
 {
-#ifdef CONFIG_SERIAL_TXX9
        int i;
-       struct uart_port req;
-
-       for (i = 0; i < 2; i++) {
-               memset(&req, 0, sizeof(req));
-               req.line = i;
-               req.iotype = UPIO_MEM;
-               req.membase = (unsigned char __iomem *)TX4927_SIO_REG(i);
-               req.mapbase = TX4927_SIO_REG(i) & 0xfffffffffULL;
-               req.irq = TXX9_IRQ_BASE + TX4927_IR_SIO(i);
-               req.flags |= UPF_BUGGY_UART /*HAVE_CTS_LINE*/;
-               req.uartclk = TXX9_IMCLK;
-               early_serial_txx9_setup(&req);
-       }
-#endif /* CONFIG_SERIAL_TXX9 */
+
+       for (i = 0; i < 2; i++)
+               txx9_sio_init(TX4927_SIO_REG(i) & 0xfffffffffULL,
+                             TXX9_IRQ_BASE + TX4927_IR_SIO(i),
+                             i, sclk, (1 << i) & cts_mask);
 }
index 317378d..f3040b9 100644 (file)
@@ -13,7 +13,6 @@
 #include <linux/init.h>
 #include <linux/ioport.h>
 #include <linux/delay.h>
-#include <linux/serial_core.h>
 #include <linux/param.h>
 #include <asm/txx9irq.h>
 #include <asm/txx9tmr.h>
@@ -21,7 +20,7 @@
 #include <asm/txx9/generic.h>
 #include <asm/txx9/tx4938.h>
 
-void __init tx4938_wdr_init(void)
+static void __init tx4938_wdr_init(void)
 {
        /* clear WatchDogReset (W1C) */
        tx4938_ccfg_set(TX4938_CCFG_WDRST);
@@ -29,6 +28,11 @@ void __init tx4938_wdr_init(void)
        tx4938_ccfg_set(TX4938_CCFG_WR);
 }
 
+void __init tx4938_wdt_init(void)
+{
+       txx9_wdt_init(TX4938_TMR_REG(2) & 0xfffffffffULL);
+}
+
 static struct resource tx4938_sdram_resource[4];
 static struct resource tx4938_sram_resource;
 
@@ -233,11 +237,9 @@ void __init tx4938_time_init(unsigned int tmrnr)
                                     TXX9_IMCLK);
 }
 
-void __init tx4938_setup_serial(void)
+void __init tx4938_sio_init(unsigned int sclk, unsigned int cts_mask)
 {
-#ifdef CONFIG_SERIAL_TXX9
        int i;
-       struct uart_port req;
        unsigned int ch_mask = 0;
 
        if (__raw_readq(&tx4938_ccfgptr->pcfg) & TX4938_PCFG_ETH0_SEL)
@@ -245,15 +247,24 @@ void __init tx4938_setup_serial(void)
        for (i = 0; i < 2; i++) {
                if ((1 << i) & ch_mask)
                        continue;
-               memset(&req, 0, sizeof(req));
-               req.line = i;
-               req.iotype = UPIO_MEM;
-               req.membase = (unsigned char __iomem *)TX4938_SIO_REG(i);
-               req.mapbase = TX4938_SIO_REG(i) & 0xfffffffffULL;
-               req.irq = TXX9_IRQ_BASE + TX4938_IR_SIO(i);
-               req.flags |= UPF_BUGGY_UART /*HAVE_CTS_LINE*/;
-               req.uartclk = TXX9_IMCLK;
-               early_serial_txx9_setup(&req);
+               txx9_sio_init(TX4938_SIO_REG(i) & 0xfffffffffULL,
+                             TXX9_IRQ_BASE + TX4938_IR_SIO(i),
+                             i, sclk, (1 << i) & cts_mask);
        }
-#endif /* CONFIG_SERIAL_TXX9 */
+}
+
+void __init tx4938_spi_init(int busid)
+{
+       txx9_spi_init(busid, TX4938_SPI_REG & 0xfffffffffULL,
+                     TXX9_IRQ_BASE + TX4938_IR_SPI);
+}
+
+void __init tx4938_ethaddr_init(unsigned char *addr0, unsigned char *addr1)
+{
+       u64 pcfg = __raw_readq(&tx4938_ccfgptr->pcfg);
+
+       if (addr0 && (pcfg & TX4938_PCFG_ETH0_SEL))
+               txx9_ethaddr_init(TXX9_IRQ_BASE + TX4938_IR_ETH0, addr0);
+       if (addr1 && (pcfg & TX4938_PCFG_ETH1_SEL))
+               txx9_ethaddr_init(TXX9_IRQ_BASE + TX4938_IR_ETH1, addr1);
 }
index 69e4874..a2b2d62 100644 (file)
@@ -15,8 +15,6 @@
 #include <asm/io.h>
 #include <asm/txx9/smsc_fdc37m81x.h>
 
-#define DEBUG
-
 /* Common Registers */
 #define SMSC_FDC37M81X_CONFIG_INDEX  0x00
 #define SMSC_FDC37M81X_CONFIG_DATA   0x01
@@ -55,7 +53,7 @@
 #define SMSC_FDC37M81X_CONFIG_EXIT   0xaa
 #define SMSC_FDC37M81X_CHIP_ID       0x4d
 
-static unsigned long g_smsc_fdc37m81x_base = 0;
+static unsigned long g_smsc_fdc37m81x_base;
 
 static inline unsigned char smsc_fdc37m81x_rd(unsigned char index)
 {
@@ -107,7 +105,8 @@ unsigned long __init smsc_fdc37m81x_init(unsigned long port)
        u8 chip_id;
 
        if (g_smsc_fdc37m81x_base)
-               printk("smsc_fdc37m81x_init() stepping on old base=0x%0*lx\n",
+               printk(KERN_WARNING "%s: stepping on old base=0x%0*lx\n",
+                      __func__,
                       field, g_smsc_fdc37m81x_base);
 
        g_smsc_fdc37m81x_base = port;
@@ -118,7 +117,7 @@ unsigned long __init smsc_fdc37m81x_init(unsigned long port)
        if (chip_id == SMSC_FDC37M81X_CHIP_ID)
                smsc_fdc37m81x_config_end();
        else {
-               printk("smsc_fdc37m81x_init() unknow chip id 0x%02x\n",
+               printk(KERN_WARNING "%s: unknow chip id 0x%02x\n", __func__,
                       chip_id);
                g_smsc_fdc37m81x_base = 0;
        }
@@ -127,22 +126,23 @@ unsigned long __init smsc_fdc37m81x_init(unsigned long port)
 }
 
 #ifdef DEBUG
-void smsc_fdc37m81x_config_dump_one(char *key, u8 dev, u8 reg)
+static void smsc_fdc37m81x_config_dump_one(const char *key, u8 dev, u8 reg)
 {
-       printk("%s: dev=0x%02x reg=0x%02x val=0x%02x\n", key, dev, reg,
+       printk(KERN_INFO "%s: dev=0x%02x reg=0x%02x val=0x%02x\n",
+              key, dev, reg,
               smsc_fdc37m81x_rd(reg));
 }
 
 void smsc_fdc37m81x_config_dump(void)
 {
        u8 orig;
-       char *fname = "smsc_fdc37m81x_config_dump()";
+       const char *fname = __func__;
 
        smsc_fdc37m81x_config_beg();
 
        orig = smsc_fdc37m81x_rd(SMSC_FDC37M81X_DNUM);
 
-       printk("%s: common\n", fname);
+       printk(KERN_INFO "%s: common\n", fname);
        smsc_fdc37m81x_config_dump_one(fname, SMSC_FDC37M81X_NONE,
                                       SMSC_FDC37M81X_DNUM);
        smsc_fdc37m81x_config_dump_one(fname, SMSC_FDC37M81X_NONE,
@@ -154,7 +154,7 @@ void smsc_fdc37m81x_config_dump(void)
        smsc_fdc37m81x_config_dump_one(fname, SMSC_FDC37M81X_NONE,
                                       SMSC_FDC37M81X_PMGT);
 
-       printk("%s: keyboard\n", fname);
+       printk(KERN_INFO "%s: keyboard\n", fname);
        smsc_dc37m81x_wr(SMSC_FDC37M81X_DNUM, SMSC_FDC37M81X_KBD);
        smsc_fdc37m81x_config_dump_one(fname, SMSC_FDC37M81X_KBD,
                                       SMSC_FDC37M81X_ACTIVE);
index ba292c9..20d61ac 100644 (file)
@@ -3,6 +3,5 @@
 #
 
 obj-y  += prom.o irq.o setup.o
-obj-$(CONFIG_KGDB)     += kgdb_io.o
 
 EXTRA_CFLAGS += -Werror
index 070c9a1..6ec626c 100644 (file)
  *  675 Mass Ave, Cambridge, MA 02139, USA.
  */
 #include <linux/init.h>
-#include <linux/sched.h>
 #include <linux/types.h>
 #include <linux/interrupt.h>
 
 #include <asm/io.h>
 #include <asm/mipsregs.h>
-#include <asm/system.h>
-
-#include <asm/processor.h>
 #include <asm/txx9/generic.h>
 #include <asm/txx9/jmr3927.h>
 
 #error JMR3927_IRQ_END > NR_IRQS
 #endif
 
-static unsigned char irc_level[TX3927_NUM_IR] = {
-       5, 5, 5, 5, 5, 5,       /* INT[5:0] */
-       7, 7,                   /* SIO */
-       5, 5, 5, 0, 0,          /* DMA, PIO, PCI */
-       6, 6, 6                 /* TMR */
-};
-
 /*
  * CP0_STATUS is a thread's resource (saved/restored on context switch).
  * So disable_irq/enable_irq MUST handle IOC/IRC registers.
@@ -103,26 +92,18 @@ static int jmr3927_irq_dispatch(int pending)
        return irq;
 }
 
-#ifdef CONFIG_PCI
-static irqreturn_t jmr3927_pcierr_interrupt(int irq, void *dev_id)
-{
-       printk(KERN_WARNING "PCI error interrupt (irq 0x%x).\n", irq);
-       printk(KERN_WARNING "pcistat:%02x, lbstat:%04lx\n",
-              tx3927_pcicptr->pcistat, tx3927_pcicptr->lbstat);
-
-       return IRQ_HANDLED;
-}
-static struct irqaction pcierr_action = {
-       .handler = jmr3927_pcierr_interrupt,
-       .mask = CPU_MASK_NONE,
-       .name = "PCI error",
+static struct irq_chip jmr3927_irq_ioc = {
+       .name = "jmr3927_ioc",
+       .ack = mask_irq_ioc,
+       .mask = mask_irq_ioc,
+       .mask_ack = mask_irq_ioc,
+       .unmask = unmask_irq_ioc,
 };
-#endif
-
-static void __init jmr3927_irq_init(void);
 
 void __init jmr3927_irq_setup(void)
 {
+       int i;
+
        txx9_irq_dispatch = jmr3927_irq_dispatch;
        /* Now, interrupt control disabled, */
        /* all IRC interrupts are masked, */
@@ -138,34 +119,10 @@ void __init jmr3927_irq_setup(void)
        /* clear PCI Reset interrupts */
        jmr3927_ioc_reg_out(0, JMR3927_IOC_RESET_ADDR);
 
-       jmr3927_irq_init();
+       tx3927_irq_init();
+       for (i = JMR3927_IRQ_IOC; i < JMR3927_IRQ_IOC + JMR3927_NR_IRQ_IOC; i++)
+               set_irq_chip_and_handler(i, &jmr3927_irq_ioc, handle_level_irq);
 
        /* setup IOC interrupt 1 (PCI, MODEM) */
        set_irq_chained_handler(JMR3927_IRQ_IOCINT, handle_simple_irq);
-
-#ifdef CONFIG_PCI
-       setup_irq(JMR3927_IRQ_IRC_PCI, &pcierr_action);
-#endif
-
-       /* enable all CPU interrupt bits. */
-       set_c0_status(ST0_IM);  /* IE bit is still 0. */
-}
-
-static struct irq_chip jmr3927_irq_ioc = {
-       .name = "jmr3927_ioc",
-       .ack = mask_irq_ioc,
-       .mask = mask_irq_ioc,
-       .mask_ack = mask_irq_ioc,
-       .unmask = unmask_irq_ioc,
-};
-
-static void __init jmr3927_irq_init(void)
-{
-       u32 i;
-
-       txx9_irq_init(TX3927_IRC_REG);
-       for (i = 0; i < TXx9_MAX_IR; i++)
-               txx9_irq_set_pri(i, irc_level[i]);
-       for (i = JMR3927_IRQ_IOC; i < JMR3927_IRQ_IOC + JMR3927_NR_IRQ_IOC; i++)
-               set_irq_chip_and_handler(i, &jmr3927_irq_ioc, handle_level_irq);
 }
diff --git a/arch/mips/txx9/jmr3927/kgdb_io.c b/arch/mips/txx9/jmr3927/kgdb_io.c
deleted file mode 100644 (file)
index 5bd757e..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * BRIEF MODULE DESCRIPTION
- *     Low level uart routines to directly access a TX[34]927 SIO.
- *
- * Copyright 2001 MontaVista Software Inc.
- * Author: MontaVista Software, Inc.
- *             ahennessy@mvista.com or source@mvista.com
- *
- * Based on arch/mips/ddb5xxx/ddb5477/kgdb_io.c
- *
- * Copyright (C) 2000-2001 Toshiba Corporation
- *
- *  This program is free software; you can redistribute  it and/or modify it
- *  under  the terms of  the GNU General  Public License as published by the
- *  Free Software Foundation;  either version 2 of the  License, or (at your
- *  option) any later version.
- *
- *  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/txx9/jmr3927.h>
-
-#define TIMEOUT       0xffffff
-
-static int remoteDebugInitialized = 0;
-static void debugInit(int baud);
-
-int putDebugChar(unsigned char c)
-{
-        int i = 0;
-
-       if (!remoteDebugInitialized) {
-               remoteDebugInitialized = 1;
-               debugInit(38400);
-       }
-
-        do {
-            slow_down();
-            i++;
-            if (i>TIMEOUT) {
-                break;
-            }
-        } while (!(tx3927_sioptr(0)->cisr & TXx927_SICISR_TXALS));
-       tx3927_sioptr(0)->tfifo = c;
-
-       return 1;
-}
-
-unsigned char getDebugChar(void)
-{
-        int i = 0;
-       int dicr;
-       char c;
-
-       if (!remoteDebugInitialized) {
-               remoteDebugInitialized = 1;
-               debugInit(38400);
-       }
-
-       /* diable RX int. */
-       dicr = tx3927_sioptr(0)->dicr;
-       tx3927_sioptr(0)->dicr = 0;
-
-        do {
-            slow_down();
-            i++;
-            if (i>TIMEOUT) {
-                break;
-            }
-        } while (tx3927_sioptr(0)->disr & TXx927_SIDISR_UVALID)
-               ;
-       c = tx3927_sioptr(0)->rfifo;
-
-       /* clear RX int. status */
-       tx3927_sioptr(0)->disr &= ~TXx927_SIDISR_RDIS;
-       /* enable RX int. */
-       tx3927_sioptr(0)->dicr = dicr;
-
-       return c;
-}
-
-static void debugInit(int baud)
-{
-       tx3927_sioptr(0)->lcr = 0x020;
-       tx3927_sioptr(0)->dicr = 0;
-       tx3927_sioptr(0)->disr = 0x4100;
-       tx3927_sioptr(0)->cisr = 0x014;
-       tx3927_sioptr(0)->fcr = 0;
-       tx3927_sioptr(0)->flcr = 0x02;
-       tx3927_sioptr(0)->bgr = ((JMR3927_BASE_BAUD + baud / 2) / baud) |
-               TXx927_SIBGR_BCLK_T0;
-}
index 2cadb42..70c4c8e 100644 (file)
  *  675 Mass Ave, Cambridge, MA 02139, USA.
  */
 #include <linux/init.h>
+#include <linux/kernel.h>
 #include <asm/bootinfo.h>
 #include <asm/txx9/generic.h>
 #include <asm/txx9/jmr3927.h>
 
-#define TIMEOUT       0xffffff
-
-void
-prom_putchar(char c)
-{
-        int i = 0;
-
-        do {
-            i++;
-            if (i>TIMEOUT)
-                break;
-        } while (!(tx3927_sioptr(1)->cisr & TXx927_SICISR_TXALS));
-       tx3927_sioptr(1)->tfifo = c;
-       return;
-}
-
-void
-puts(const char *cp)
-{
-    while (*cp)
-       prom_putchar(*cp++);
-    prom_putchar('\r');
-    prom_putchar('\n');
-}
-
 void __init jmr3927_prom_init(void)
 {
        /* CCFG */
        if ((tx3927_ccfgptr->ccfg & TX3927_CCFG_TLBOFF) == 0)
-               puts("Warning: TX3927 TLB off\n");
+               printk(KERN_ERR "TX3927 TLB off\n");
 
        prom_init_cmdline();
        add_memory_region(0, JMR3927_SDRAM_SIZE, BOOT_MEM_RAM);
+       txx9_sio_putchar_init(TX3927_SIO_REG(1));
 }
index 03647eb..87db41b 100644 (file)
 #include <linux/types.h>
 #include <linux/ioport.h>
 #include <linux/delay.h>
-#include <linux/pm.h>
 #include <linux/platform_device.h>
 #include <linux/gpio.h>
-#ifdef CONFIG_SERIAL_TXX9
-#include <linux/serial_core.h>
-#endif
-#include <asm/txx9tmr.h>
-#include <asm/txx9pio.h>
 #include <asm/reboot.h>
+#include <asm/txx9pio.h>
 #include <asm/txx9/generic.h>
 #include <asm/txx9/pci.h>
 #include <asm/txx9/jmr3927.h>
 #include <asm/mipsregs.h>
 
-extern void puts(const char *cp);
-
-/* don't enable - see errata */
-static int jmr3927_ccfg_toeon;
-
-static inline void do_reset(void)
+static void jmr3927_machine_restart(char *command)
 {
+       local_irq_disable();
 #if 1  /* Resetting PCI bus */
        jmr3927_ioc_reg_out(0, JMR3927_IOC_RESET_ADDR);
        jmr3927_ioc_reg_out(JMR3927_IOC_RESET_PCI, JMR3927_IOC_RESET_ADDR);
@@ -61,33 +52,13 @@ static inline void do_reset(void)
        jmr3927_ioc_reg_out(0, JMR3927_IOC_RESET_ADDR);
 #endif
        jmr3927_ioc_reg_out(JMR3927_IOC_RESET_CPU, JMR3927_IOC_RESET_ADDR);
-}
-
-static void jmr3927_machine_restart(char *command)
-{
-       local_irq_disable();
-       puts("Rebooting...");
-       do_reset();
-}
-
-static void jmr3927_machine_halt(void)
-{
-       puts("JMR-TX3927 halted.\n");
-       while (1);
-}
-
-static void jmr3927_machine_power_off(void)
-{
-       puts("JMR-TX3927 halted. Please turn off the power.\n");
-       while (1);
+       /* fallback */
+       (*_machine_halt)();
 }
 
 static void __init jmr3927_time_init(void)
 {
-       txx9_clockevent_init(TX3927_TMR_REG(0),
-                            TXX9_IRQ_BASE + JMR3927_IRQ_IRC_TMR(0),
-                            JMR3927_IMCLK);
-       txx9_clocksource_init(TX3927_TMR_REG(1), JMR3927_IMCLK);
+       tx3927_time_init(0, 1);
 }
 
 #define DO_WRITE_THROUGH
@@ -102,11 +73,6 @@ static void __init jmr3927_mem_setup(void)
        set_io_port_base(JMR3927_PORT_BASE + JMR3927_PCIIO);
 
        _machine_restart = jmr3927_machine_restart;
-       _machine_halt = jmr3927_machine_halt;
-       pm_power_off = jmr3927_machine_power_off;
-
-       /* Reboot on panic */
-       panic_timeout = 180;
 
        /* cache setup */
        {
@@ -125,7 +91,8 @@ static void __init jmr3927_mem_setup(void)
 #endif
 
                conf = read_c0_conf();
-               conf &= ~(TX39_CONF_ICE | TX39_CONF_DCE | TX39_CONF_WBON | TX39_CONF_CWFON);
+               conf &= ~(TX39_CONF_ICE | TX39_CONF_DCE |
+                         TX39_CONF_WBON | TX39_CONF_CWFON);
                conf |= mips_ic_disable ? 0 : TX39_CONF_ICE;
                conf |= mips_dc_disable ? 0 : TX39_CONF_DCE;
                conf |= mips_config_wbon ? TX39_CONF_WBON : 0;
@@ -138,47 +105,14 @@ static void __init jmr3927_mem_setup(void)
        /* initialize board */
        jmr3927_board_init();
 
-       argptr = prom_getcmdline();
-
-       if ((argptr = strstr(argptr, "toeon")) != NULL)
-               jmr3927_ccfg_toeon = 1;
-       argptr = prom_getcmdline();
-       if ((argptr = strstr(argptr, "ip=")) == NULL) {
-               argptr = prom_getcmdline();
-               strcat(argptr, " ip=bootp");
-       }
-
-#ifdef CONFIG_SERIAL_TXX9
-       {
-               extern int early_serial_txx9_setup(struct uart_port *port);
-               int i;
-               struct uart_port req;
-               for(i = 0; i < 2; i++) {
-                       memset(&req, 0, sizeof(req));
-                       req.line = i;
-                       req.iotype = UPIO_MEM;
-                       req.membase = (unsigned char __iomem *)TX3927_SIO_REG(i);
-                       req.mapbase = TX3927_SIO_REG(i);
-                       req.irq = i == 0 ?
-                               JMR3927_IRQ_IRC_SIO0 : JMR3927_IRQ_IRC_SIO1;
-                       if (i == 0)
-                               req.flags |= UPF_BUGGY_UART /*HAVE_CTS_LINE*/;
-                       req.uartclk = JMR3927_IMCLK;
-                       early_serial_txx9_setup(&req);
-               }
-       }
+       tx3927_sio_init(0, 1 << 1); /* ch1: noCTS */
 #ifdef CONFIG_SERIAL_TXX9_CONSOLE
        argptr = prom_getcmdline();
-       if ((argptr = strstr(argptr, "console=")) == NULL) {
-               argptr = prom_getcmdline();
+       if (!strstr(argptr, "console="))
                strcat(argptr, " console=ttyS1,115200");
-       }
-#endif
 #endif
 }
 
-static void tx3927_setup(void);
-
 static void __init jmr3927_pci_setup(void)
 {
 #ifdef CONFIG_PCI
@@ -199,32 +133,13 @@ static void __init jmr3927_pci_setup(void)
                jmr3927_ioc_reg_out(0, JMR3927_IOC_RESET_ADDR);
        }
        tx3927_pcic_setup(c, JMR3927_SDRAM_SIZE, extarb);
+       tx3927_setup_pcierr_irq();
 #endif /* CONFIG_PCI */
 }
 
 static void __init jmr3927_board_init(void)
 {
-       tx3927_setup();
-       jmr3927_pci_setup();
-
-       /* SIO0 DTR on */
-       jmr3927_ioc_reg_out(0, JMR3927_IOC_DTR_ADDR);
-
-       jmr3927_led_set(0);
-
-       printk("JMR-TX3927 (Rev %d) --- IOC(Rev %d) DIPSW:%d,%d,%d,%d\n",
-              jmr3927_ioc_reg_in(JMR3927_IOC_BREV_ADDR) & JMR3927_REV_MASK,
-              jmr3927_ioc_reg_in(JMR3927_IOC_REV_ADDR) & JMR3927_REV_MASK,
-              jmr3927_dipsw1(), jmr3927_dipsw2(),
-              jmr3927_dipsw3(), jmr3927_dipsw4());
-}
-
-static void __init tx3927_setup(void)
-{
-       int i;
-
        txx9_cpu_clock = JMR3927_CORECLK;
-       txx9_gbus_clock = JMR3927_GBUSCLK;
        /* SDRAMC are configured by PROM */
 
        /* ROMC */
@@ -233,74 +148,32 @@ static void __init tx3927_setup(void)
        tx3927_romcptr->cr[3] = JMR3927_ROMCE3 | 0x0003f698;
        tx3927_romcptr->cr[5] = JMR3927_ROMCE5 | 0x0000f218;
 
-       /* CCFG */
-       /* enable Timeout BusError */
-       if (jmr3927_ccfg_toeon)
-               tx3927_ccfgptr->ccfg |= TX3927_CCFG_TOE;
-
-       /* clear BusErrorOnWrite flag */
-       tx3927_ccfgptr->ccfg &= ~TX3927_CCFG_BEOW;
-       /* Disable PCI snoop */
-       tx3927_ccfgptr->ccfg &= ~TX3927_CCFG_PSNP;
-       /* do reset on watchdog */
-       tx3927_ccfgptr->ccfg |= TX3927_CCFG_WR;
-
-#ifdef DO_WRITE_THROUGH
-       /* Enable PCI SNOOP - with write through only */
-       tx3927_ccfgptr->ccfg |= TX3927_CCFG_PSNP;
-#endif
-
        /* Pin selection */
        tx3927_ccfgptr->pcfg &= ~TX3927_PCFG_SELALL;
        tx3927_ccfgptr->pcfg |=
                TX3927_PCFG_SELSIOC(0) | TX3927_PCFG_SELSIO_ALL |
                (TX3927_PCFG_SELDMA_ALL & ~TX3927_PCFG_SELDMA(1));
 
-       printk("TX3927 -- CRIR:%08lx CCFG:%08lx PCFG:%08lx\n",
-              tx3927_ccfgptr->crir,
-              tx3927_ccfgptr->ccfg, tx3927_ccfgptr->pcfg);
-
-       /* TMR */
-       for (i = 0; i < TX3927_NR_TMR; i++)
-               txx9_tmr_init(TX3927_TMR_REG(i));
-
-       /* DMA */
-       tx3927_dmaptr->mcr = 0;
-       for (i = 0; i < ARRAY_SIZE(tx3927_dmaptr->ch); i++) {
-               /* reset channel */
-               tx3927_dmaptr->ch[i].ccr = TX3927_DMA_CCR_CHRST;
-               tx3927_dmaptr->ch[i].ccr = 0;
-       }
-       /* enable DMA */
-#ifdef __BIG_ENDIAN
-       tx3927_dmaptr->mcr = TX3927_DMA_MCR_MSTEN;
-#else
-       tx3927_dmaptr->mcr = TX3927_DMA_MCR_MSTEN | TX3927_DMA_MCR_LE;
-#endif
+       tx3927_setup();
 
-       /* PIO */
        /* PIO[15:12] connected to LEDs */
        __raw_writel(0x0000f000, &tx3927_pioptr->dir);
-       __raw_writel(0, &tx3927_pioptr->maskcpu);
-       __raw_writel(0, &tx3927_pioptr->maskext);
-       txx9_gpio_init(TX3927_PIO_REG, 0, 16);
        gpio_request(11, "dipsw1");
        gpio_request(10, "dipsw2");
-       {
-               unsigned int conf;
 
-       conf = read_c0_conf();
-               if (!(conf & TX39_CONF_ICE))
-                       printk("TX3927 I-Cache disabled.\n");
-               if (!(conf & TX39_CONF_DCE))
-                       printk("TX3927 D-Cache disabled.\n");
-               else if (!(conf & TX39_CONF_WBON))
-                       printk("TX3927 D-Cache WriteThrough.\n");
-               else if (!(conf & TX39_CONF_CWFON))
-                       printk("TX3927 D-Cache WriteBack.\n");
-               else
-                       printk("TX3927 D-Cache WriteBack (CWF) .\n");
-       }
+       jmr3927_pci_setup();
+
+       /* SIO0 DTR on */
+       jmr3927_ioc_reg_out(0, JMR3927_IOC_DTR_ADDR);
+
+       jmr3927_led_set(0);
+
+       printk(KERN_INFO
+              "JMR-TX3927 (Rev %d) --- IOC(Rev %d) DIPSW:%d,%d,%d,%d\n",
+              jmr3927_ioc_reg_in(JMR3927_IOC_BREV_ADDR) & JMR3927_REV_MASK,
+              jmr3927_ioc_reg_in(JMR3927_IOC_REV_ADDR) & JMR3927_REV_MASK,
+              jmr3927_dipsw1(), jmr3927_dipsw2(),
+              jmr3927_dipsw3(), jmr3927_dipsw4());
 }
 
 /* This trick makes rtc-ds1742 driver usable as is. */
@@ -316,42 +189,21 @@ static unsigned long jmr3927_swizzle_addr_b(unsigned long port)
 #endif
 }
 
-static int __init jmr3927_rtc_init(void)
+static void __init jmr3927_rtc_init(void)
 {
        static struct resource __initdata res = {
                .start  = JMR3927_IOC_NVRAMB_ADDR - IO_BASE,
                .end    = JMR3927_IOC_NVRAMB_ADDR - IO_BASE + 0x800 - 1,
                .flags  = IORESOURCE_MEM,
        };
-       struct platform_device *dev;
-       dev = platform_device_register_simple("rtc-ds1742", -1, &res, 1);
-       return IS_ERR(dev) ? PTR_ERR(dev) : 0;
-}
-
-/* Watchdog support */
-
-static int __init txx9_wdt_init(unsigned long base)
-{
-       struct resource res = {
-               .start  = base,
-               .end    = base + 0x100 - 1,
-               .flags  = IORESOURCE_MEM,
-       };
-       struct platform_device *dev =
-               platform_device_register_simple("txx9wdt", -1, &res, 1);
-       return IS_ERR(dev) ? PTR_ERR(dev) : 0;
-}
-
-static int __init jmr3927_wdt_init(void)
-{
-       return txx9_wdt_init(TX3927_TMR_REG(2));
+       platform_device_register_simple("rtc-ds1742", -1, &res, 1);
 }
 
 static void __init jmr3927_device_init(void)
 {
        __swizzle_addr_b = jmr3927_swizzle_addr_b;
        jmr3927_rtc_init();
-       jmr3927_wdt_init();
+       tx3927_wdt_init();
 }
 
 struct txx9_board_vec jmr3927_vec __initdata = {
index cd748a9..00cd523 100644 (file)
  *  675 Mass Ave, Cambridge, MA 02139, USA.
  */
 /*
-IRQ  Device
-00   RBTX4927-ISA/00
-01   RBTX4927-ISA/01 PS2/Keyboard
-02   RBTX4927-ISA/02 Cascade RBTX4927-ISA (irqs 8-15)
-03   RBTX4927-ISA/03
-04   RBTX4927-ISA/04
-05   RBTX4927-ISA/05
-06   RBTX4927-ISA/06
-07   RBTX4927-ISA/07
-08   RBTX4927-ISA/08
-09   RBTX4927-ISA/09
-10   RBTX4927-ISA/10
-11   RBTX4927-ISA/11
-12   RBTX4927-ISA/12 PS2/Mouse (not supported at this time)
-13   RBTX4927-ISA/13
-14   RBTX4927-ISA/14 IDE
-15   RBTX4927-ISA/15
-
-16   TX4927-CP0/00 Software 0
-17   TX4927-CP0/01 Software 1
-18   TX4927-CP0/02 Cascade TX4927-CP0
-19   TX4927-CP0/03 Multiplexed -- do not use
-20   TX4927-CP0/04 Multiplexed -- do not use
-21   TX4927-CP0/05 Multiplexed -- do not use
-22   TX4927-CP0/06 Multiplexed -- do not use
-23   TX4927-CP0/07 CPU TIMER
-
-24   TX4927-PIC/00
-25   TX4927-PIC/01
-26   TX4927-PIC/02
-27   TX4927-PIC/03 Cascade RBTX4927-IOC
-28   TX4927-PIC/04
-29   TX4927-PIC/05 RBTX4927 RTL-8019AS ethernet
-30   TX4927-PIC/06
-31   TX4927-PIC/07
-32   TX4927-PIC/08 TX4927 SerialIO Channel 0
-33   TX4927-PIC/09 TX4927 SerialIO Channel 1
-34   TX4927-PIC/10
-35   TX4927-PIC/11
-36   TX4927-PIC/12
-37   TX4927-PIC/13
-38   TX4927-PIC/14
-39   TX4927-PIC/15
-40   TX4927-PIC/16 TX4927 PCI PCI-C
-41   TX4927-PIC/17
-42   TX4927-PIC/18
-43   TX4927-PIC/19
-44   TX4927-PIC/20
-45   TX4927-PIC/21
-46   TX4927-PIC/22 TX4927 PCI PCI-ERR
-47   TX4927-PIC/23 TX4927 PCI PCI-PMA (not used)
-48   TX4927-PIC/24
-49   TX4927-PIC/25
-50   TX4927-PIC/26
-51   TX4927-PIC/27
-52   TX4927-PIC/28
-53   TX4927-PIC/29
-54   TX4927-PIC/30
-55   TX4927-PIC/31
-
-56 RBTX4927-IOC/00 FPCIB0 PCI-D PJ4/A PJ5/B SB/C PJ6/D PJ7/A (SouthBridge/NotUsed)        [RTL-8139=PJ4]
-57 RBTX4927-IOC/01 FPCIB0 PCI-C PJ4/D PJ5/A SB/B PJ6/C PJ7/D (SouthBridge/NotUsed)        [RTL-8139=PJ5]
-58 RBTX4927-IOC/02 FPCIB0 PCI-B PJ4/C PJ5/D SB/A PJ6/B PJ7/C (SouthBridge/IDE/pin=1,INTR) [RTL-8139=NotSupported]
-59 RBTX4927-IOC/03 FPCIB0 PCI-A PJ4/B PJ5/C SB/D PJ6/A PJ7/B (SouthBridge/USB/pin=4)      [RTL-8139=PJ6]
-60 RBTX4927-IOC/04
-61 RBTX4927-IOC/05
-62 RBTX4927-IOC/06
-63 RBTX4927-IOC/07
-
-NOTES:
-SouthBridge/INTR is mapped to SouthBridge/A=PCI-B/#58
-SouthBridge/ISA/pin=0 no pci irq used by this device
-SouthBridge/IDE/pin=1 no pci irq used by this device, using INTR via ISA IRQ14
-SouthBridge/USB/pin=4 using pci irq SouthBridge/D=PCI-A=#59
-SouthBridge/PMC/pin=0 no pci irq used by this device
-SuperIO/PS2/Keyboard, using INTR via ISA IRQ1
-SuperIO/PS2/Mouse, using INTR via ISA IRQ12 (mouse not currently supported)
-JP7 is not bus master -- do NOT use -- only 4 pci bus master's allowed -- SouthBridge, JP4, JP5, JP6
-*/
+ * I8259A_IRQ_BASE+00
+ * I8259A_IRQ_BASE+01 PS2/Keyboard
+ * I8259A_IRQ_BASE+02 Cascade RBTX4927-ISA (irqs 8-15)
+ * I8259A_IRQ_BASE+03
+ * I8259A_IRQ_BASE+04
+ * I8259A_IRQ_BASE+05
+ * I8259A_IRQ_BASE+06
+ * I8259A_IRQ_BASE+07
+ * I8259A_IRQ_BASE+08
+ * I8259A_IRQ_BASE+09
+ * I8259A_IRQ_BASE+10
+ * I8259A_IRQ_BASE+11
+ * I8259A_IRQ_BASE+12 PS2/Mouse (not supported at this time)
+ * I8259A_IRQ_BASE+13
+ * I8259A_IRQ_BASE+14 IDE
+ * I8259A_IRQ_BASE+15
+ *
+ * MIPS_CPU_IRQ_BASE+00 Software 0
+ * MIPS_CPU_IRQ_BASE+01 Software 1
+ * MIPS_CPU_IRQ_BASE+02 Cascade TX4927-CP0
+ * MIPS_CPU_IRQ_BASE+03 Multiplexed -- do not use
+ * MIPS_CPU_IRQ_BASE+04 Multiplexed -- do not use
+ * MIPS_CPU_IRQ_BASE+05 Multiplexed -- do not use
+ * MIPS_CPU_IRQ_BASE+06 Multiplexed -- do not use
+ * MIPS_CPU_IRQ_BASE+07 CPU TIMER
+ *
+ * TXX9_IRQ_BASE+00
+ * TXX9_IRQ_BASE+01
+ * TXX9_IRQ_BASE+02
+ * TXX9_IRQ_BASE+03 Cascade RBTX4927-IOC
+ * TXX9_IRQ_BASE+04
+ * TXX9_IRQ_BASE+05 RBTX4927 RTL-8019AS ethernet
+ * TXX9_IRQ_BASE+06
+ * TXX9_IRQ_BASE+07
+ * TXX9_IRQ_BASE+08 TX4927 SerialIO Channel 0
+ * TXX9_IRQ_BASE+09 TX4927 SerialIO Channel 1
+ * TXX9_IRQ_BASE+10
+ * TXX9_IRQ_BASE+11
+ * TXX9_IRQ_BASE+12
+ * TXX9_IRQ_BASE+13
+ * TXX9_IRQ_BASE+14
+ * TXX9_IRQ_BASE+15
+ * TXX9_IRQ_BASE+16 TX4927 PCI PCI-C
+ * TXX9_IRQ_BASE+17
+ * TXX9_IRQ_BASE+18
+ * TXX9_IRQ_BASE+19
+ * TXX9_IRQ_BASE+20
+ * TXX9_IRQ_BASE+21
+ * TXX9_IRQ_BASE+22 TX4927 PCI PCI-ERR
+ * TXX9_IRQ_BASE+23 TX4927 PCI PCI-PMA (not used)
+ * TXX9_IRQ_BASE+24
+ * TXX9_IRQ_BASE+25
+ * TXX9_IRQ_BASE+26
+ * TXX9_IRQ_BASE+27
+ * TXX9_IRQ_BASE+28
+ * TXX9_IRQ_BASE+29
+ * TXX9_IRQ_BASE+30
+ * TXX9_IRQ_BASE+31
+ *
+ * RBTX4927_IRQ_IOC+00 FPCIB0 PCI-D (SouthBridge)
+ * RBTX4927_IRQ_IOC+01 FPCIB0 PCI-C (SouthBridge)
+ * RBTX4927_IRQ_IOC+02 FPCIB0 PCI-B (SouthBridge/IDE/pin=1,INTR)
+ * RBTX4927_IRQ_IOC+03 FPCIB0 PCI-A (SouthBridge/USB/pin=4)
+ * RBTX4927_IRQ_IOC+04
+ * RBTX4927_IRQ_IOC+05
+ * RBTX4927_IRQ_IOC+06
+ * RBTX4927_IRQ_IOC+07
+ *
+ * NOTES:
+ * SouthBridge/INTR is mapped to SouthBridge/A=PCI-B/#58
+ * SouthBridge/ISA/pin=0 no pci irq used by this device
+ * SouthBridge/IDE/pin=1 no pci irq used by this device, using INTR
+ * via ISA IRQ14
+ * SouthBridge/USB/pin=4 using pci irq SouthBridge/D=PCI-A=#59
+ * SouthBridge/PMC/pin=0 no pci irq used by this device
+ * SuperIO/PS2/Keyboard, using INTR via ISA IRQ1
+ * SuperIO/PS2/Mouse, using INTR via ISA IRQ12 (mouse not currently supported)
+ * JP7 is not bus master -- do NOT use -- only 4 pci bus master's
+ * allowed -- SouthBridge, JP4, JP5, JP6
+ */
 
 #include <linux/init.h>
 #include <linux/types.h>
@@ -134,7 +135,7 @@ static int toshiba_rbtx4927_irq_nested(int sw_irq)
        level3 = readb(rbtx4927_imstat_addr) & 0x1f;
        if (level3)
                sw_irq = RBTX4927_IRQ_IOC + fls(level3) - 1;
-       return (sw_irq);
+       return sw_irq;
 }
 
 static void __init toshiba_rbtx4927_irq_ioc_init(void)
index 5c0de54..1dc0a5b 100644 (file)
@@ -38,4 +38,5 @@ void __init rbtx4927_prom_init(void)
 {
        prom_init_cmdline();
        add_memory_region(0, tx4927_get_mem_size(), BOOT_MEM_RAM);
+       txx9_sio_putchar_init(TX4927_SIO_REG(0) & 0xfffffffffULL);
 }
index 3da20ea..0d39baf 100644 (file)
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/ioport.h>
-#include <linux/interrupt.h>
-#include <linux/pm.h>
 #include <linux/platform_device.h>
 #include <linux/delay.h>
 #include <asm/io.h>
-#include <asm/processor.h>
 #include <asm/reboot.h>
 #include <asm/txx9/generic.h>
 #include <asm/txx9/pci.h>
@@ -103,6 +100,7 @@ static void __init tx4927_pci_setup(void)
                tx4927_report_pciclk();
                tx4927_pcic_setup(tx4927_pcicptr, c, extarb);
        }
+       tx4927_setup_pcierr_irq();
 }
 
 static void __init tx4937_pci_setup(void)
@@ -149,6 +147,7 @@ static void __init tx4937_pci_setup(void)
                tx4938_report_pciclk();
                tx4927_pcic_setup(tx4938_pcicptr, c, extarb);
        }
+       tx4938_setup_pcierr_irq();
 }
 
 static void __init rbtx4927_arch_init(void)
@@ -165,17 +164,8 @@ static void __init rbtx4937_arch_init(void)
 #define rbtx4937_arch_init NULL
 #endif /* CONFIG_PCI */
 
-static void __noreturn wait_forever(void)
-{
-       while (1)
-               if (cpu_wait)
-                       (*cpu_wait)();
-}
-
 static void toshiba_rbtx4927_restart(char *command)
 {
-       printk(KERN_NOTICE "System Rebooting...\n");
-
        /* enable the s/w reset register */
        writeb(1, rbtx4927_softresetlock_addr);
 
@@ -186,24 +176,8 @@ static void toshiba_rbtx4927_restart(char *command)
        /* do a s/w reset */
        writeb(1, rbtx4927_softreset_addr);
 
-       /* do something passive while waiting for reset */
-       local_irq_disable();
-       wait_forever();
-       /* no return */
-}
-
-static void toshiba_rbtx4927_halt(void)
-{
-       printk(KERN_NOTICE "System Halted\n");
-       local_irq_disable();
-       wait_forever();
-       /* no return */
-}
-
-static void toshiba_rbtx4927_power_off(void)
-{
-       toshiba_rbtx4927_halt();
-       /* no return */
+       /* fallback */
+       (*_machine_halt)();
 }
 
 static void __init rbtx4927_clock_init(void);
@@ -214,9 +188,6 @@ static void __init rbtx4927_mem_setup(void)
        u32 cp0_config;
        char *argptr;
 
-       /* f/w leaves this on at startup */
-       clear_c0_status(ST0_ERL);
-
        /* enable caches -- HCP5 does this, pmon does not */
        cp0_config = read_c0_config();
        cp0_config = cp0_config & ~(TX49_CONF_IC | TX49_CONF_DC);
@@ -231,37 +202,21 @@ static void __init rbtx4927_mem_setup(void)
        }
 
        _machine_restart = toshiba_rbtx4927_restart;
-       _machine_halt = toshiba_rbtx4927_halt;
-       pm_power_off = toshiba_rbtx4927_power_off;
 
 #ifdef CONFIG_PCI
        txx9_alloc_pci_controller(&txx9_primary_pcic,
                                  RBTX4927_PCIMEM, RBTX4927_PCIMEM_SIZE,
                                  RBTX4927_PCIIO, RBTX4927_PCIIO_SIZE);
+       txx9_board_pcibios_setup = tx4927_pcibios_setup;
 #else
        set_io_port_base(KSEG1 + RBTX4927_ISA_IO_OFFSET);
 #endif
 
-       tx4927_setup_serial();
+       tx4927_sio_init(0, 0);
 #ifdef CONFIG_SERIAL_TXX9_CONSOLE
-        argptr = prom_getcmdline();
-        if (strstr(argptr, "console=") == NULL) {
-                strcat(argptr, " console=ttyS0,38400");
-        }
-#endif
-
-#ifdef CONFIG_ROOT_NFS
-        argptr = prom_getcmdline();
-        if (strstr(argptr, "root=") == NULL) {
-                strcat(argptr, " root=/dev/nfs rw");
-        }
-#endif
-
-#ifdef CONFIG_IP_PNP
-        argptr = prom_getcmdline();
-        if (strstr(argptr, "ip=") == NULL) {
-                strcat(argptr, " ip=any");
-        }
+       argptr = prom_getcmdline();
+       if (!strstr(argptr, "console="))
+               strcat(argptr, " console=ttyS0,38400");
 #endif
 }
 
@@ -324,19 +279,17 @@ static void __init rbtx4927_time_init(void)
        tx4927_time_init(0);
 }
 
-static int __init toshiba_rbtx4927_rtc_init(void)
+static void __init toshiba_rbtx4927_rtc_init(void)
 {
        struct resource res = {
                .start  = RBTX4927_BRAMRTC_BASE - IO_BASE,
                .end    = RBTX4927_BRAMRTC_BASE - IO_BASE + 0x800 - 1,
                .flags  = IORESOURCE_MEM,
        };
-       struct platform_device *dev =
-               platform_device_register_simple("rtc-ds1742", -1, &res, 1);
-       return IS_ERR(dev) ? PTR_ERR(dev) : 0;
+       platform_device_register_simple("rtc-ds1742", -1, &res, 1);
 }
 
-static int __init rbtx4927_ne_init(void)
+static void __init rbtx4927_ne_init(void)
 {
        struct resource res[] = {
                {
@@ -348,36 +301,14 @@ static int __init rbtx4927_ne_init(void)
                        .flags  = IORESOURCE_IRQ,
                }
        };
-       struct platform_device *dev =
-               platform_device_register_simple("ne", -1,
-                                               res, ARRAY_SIZE(res));
-       return IS_ERR(dev) ? PTR_ERR(dev) : 0;
-}
-
-/* Watchdog support */
-
-static int __init txx9_wdt_init(unsigned long base)
-{
-       struct resource res = {
-               .start  = base,
-               .end    = base + 0x100 - 1,
-               .flags  = IORESOURCE_MEM,
-       };
-       struct platform_device *dev =
-               platform_device_register_simple("txx9wdt", -1, &res, 1);
-       return IS_ERR(dev) ? PTR_ERR(dev) : 0;
-}
-
-static int __init rbtx4927_wdt_init(void)
-{
-       return txx9_wdt_init(TX4927_TMR_REG(2) & 0xfffffffffULL);
+       platform_device_register_simple("ne", -1, res, ARRAY_SIZE(res));
 }
 
 static void __init rbtx4927_device_init(void)
 {
        toshiba_rbtx4927_rtc_init();
        rbtx4927_ne_init();
-       rbtx4927_wdt_init();
+       tx4927_wdt_init();
 }
 
 struct txx9_board_vec rbtx4927_vec __initdata = {
index 3971a06..ca2f830 100644 (file)
  */
 
 /*
-IRQ  Device
-
-16   TX4938-CP0/00 Software 0
-17   TX4938-CP0/01 Software 1
-18   TX4938-CP0/02 Cascade TX4938-CP0
-19   TX4938-CP0/03 Multiplexed -- do not use
-20   TX4938-CP0/04 Multiplexed -- do not use
-21   TX4938-CP0/05 Multiplexed -- do not use
-22   TX4938-CP0/06 Multiplexed -- do not use
-23   TX4938-CP0/07 CPU TIMER
-
-24   TX4938-PIC/00
-25   TX4938-PIC/01
-26   TX4938-PIC/02 Cascade RBTX4938-IOC
-27   TX4938-PIC/03 RBTX4938 RTL-8019AS Ethernet
-28   TX4938-PIC/04
-29   TX4938-PIC/05 TX4938 ETH1
-30   TX4938-PIC/06 TX4938 ETH0
-31   TX4938-PIC/07
-32   TX4938-PIC/08 TX4938 SIO 0
-33   TX4938-PIC/09 TX4938 SIO 1
-34   TX4938-PIC/10 TX4938 DMA0
-35   TX4938-PIC/11 TX4938 DMA1
-36   TX4938-PIC/12 TX4938 DMA2
-37   TX4938-PIC/13 TX4938 DMA3
-38   TX4938-PIC/14
-39   TX4938-PIC/15
-40   TX4938-PIC/16 TX4938 PCIC
-41   TX4938-PIC/17 TX4938 TMR0
-42   TX4938-PIC/18 TX4938 TMR1
-43   TX4938-PIC/19 TX4938 TMR2
-44   TX4938-PIC/20
-45   TX4938-PIC/21
-46   TX4938-PIC/22 TX4938 PCIERR
-47   TX4938-PIC/23
-48   TX4938-PIC/24
-49   TX4938-PIC/25
-50   TX4938-PIC/26
-51   TX4938-PIC/27
-52   TX4938-PIC/28
-53   TX4938-PIC/29
-54   TX4938-PIC/30
-55   TX4938-PIC/31 TX4938 SPI
-
-56 RBTX4938-IOC/00 PCI-D
-57 RBTX4938-IOC/01 PCI-C
-58 RBTX4938-IOC/02 PCI-B
-59 RBTX4938-IOC/03 PCI-A
-60 RBTX4938-IOC/04 RTC
-61 RBTX4938-IOC/05 ATA
-62 RBTX4938-IOC/06 MODEM
-63 RBTX4938-IOC/07 SWINT
-*/
+ * MIPS_CPU_IRQ_BASE+00 Software 0
+ * MIPS_CPU_IRQ_BASE+01 Software 1
+ * MIPS_CPU_IRQ_BASE+02 Cascade TX4938-CP0
+ * MIPS_CPU_IRQ_BASE+03 Multiplexed -- do not use
+ * MIPS_CPU_IRQ_BASE+04 Multiplexed -- do not use
+ * MIPS_CPU_IRQ_BASE+05 Multiplexed -- do not use
+ * MIPS_CPU_IRQ_BASE+06 Multiplexed -- do not use
+ * MIPS_CPU_IRQ_BASE+07 CPU TIMER
+ *
+ * TXX9_IRQ_BASE+00
+ * TXX9_IRQ_BASE+01
+ * TXX9_IRQ_BASE+02 Cascade RBTX4938-IOC
+ * TXX9_IRQ_BASE+03 RBTX4938 RTL-8019AS Ethernet
+ * TXX9_IRQ_BASE+04
+ * TXX9_IRQ_BASE+05 TX4938 ETH1
+ * TXX9_IRQ_BASE+06 TX4938 ETH0
+ * TXX9_IRQ_BASE+07
+ * TXX9_IRQ_BASE+08 TX4938 SIO 0
+ * TXX9_IRQ_BASE+09 TX4938 SIO 1
+ * TXX9_IRQ_BASE+10 TX4938 DMA0
+ * TXX9_IRQ_BASE+11 TX4938 DMA1
+ * TXX9_IRQ_BASE+12 TX4938 DMA2
+ * TXX9_IRQ_BASE+13 TX4938 DMA3
+ * TXX9_IRQ_BASE+14
+ * TXX9_IRQ_BASE+15
+ * TXX9_IRQ_BASE+16 TX4938 PCIC
+ * TXX9_IRQ_BASE+17 TX4938 TMR0
+ * TXX9_IRQ_BASE+18 TX4938 TMR1
+ * TXX9_IRQ_BASE+19 TX4938 TMR2
+ * TXX9_IRQ_BASE+20
+ * TXX9_IRQ_BASE+21
+ * TXX9_IRQ_BASE+22 TX4938 PCIERR
+ * TXX9_IRQ_BASE+23
+ * TXX9_IRQ_BASE+24
+ * TXX9_IRQ_BASE+25
+ * TXX9_IRQ_BASE+26
+ * TXX9_IRQ_BASE+27
+ * TXX9_IRQ_BASE+28
+ * TXX9_IRQ_BASE+29
+ * TXX9_IRQ_BASE+30
+ * TXX9_IRQ_BASE+31 TX4938 SPI
+ *
+ * RBTX4938_IRQ_IOC+00 PCI-D
+ * RBTX4938_IRQ_IOC+01 PCI-C
+ * RBTX4938_IRQ_IOC+02 PCI-B
+ * RBTX4938_IRQ_IOC+03 PCI-A
+ * RBTX4938_IRQ_IOC+04 RTC
+ * RBTX4938_IRQ_IOC+05 ATA
+ * RBTX4938_IRQ_IOC+06 MODEM
+ * RBTX4938_IRQ_IOC+07 SWINT
+ */
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <asm/mipsregs.h>
@@ -93,9 +91,6 @@ static int toshiba_rbtx4938_irq_nested(int sw_irq)
        return sw_irq;
 }
 
-/**********************************************************************************/
-/* Functions for ioc                                                              */
-/**********************************************************************************/
 static void __init
 toshiba_rbtx4938_irq_ioc_init(void)
 {
index ee18951..d73123c 100644 (file)
@@ -22,4 +22,5 @@ void __init rbtx4938_prom_init(void)
        prom_init_cmdline();
 #endif
        add_memory_region(0, tx4938_get_mem_size(), BOOT_MEM_RAM);
+       txx9_sio_putchar_init(TX4938_SIO_REG(0) & 0xfffffffffULL);
 }
index 6c2b99b..9ab48de 100644 (file)
@@ -13,9 +13,6 @@
 #include <linux/types.h>
 #include <linux/ioport.h>
 #include <linux/delay.h>
-#include <linux/interrupt.h>
-#include <linux/console.h>
-#include <linux/pm.h>
 #include <linux/platform_device.h>
 #include <linux/gpio.h>
 
 #include <asm/txx9/spi.h>
 #include <asm/txx9pio.h>
 
-static void rbtx4938_machine_halt(void)
-{
-        printk(KERN_NOTICE "System Halted\n");
-       local_irq_disable();
-
-       while (1)
-               __asm__(".set\tmips3\n\t"
-                       "wait\n\t"
-                       ".set\tmips0");
-}
-
-static void rbtx4938_machine_power_off(void)
-{
-        rbtx4938_machine_halt();
-        /* no return */
-}
-
 static void rbtx4938_machine_restart(char *command)
 {
        local_irq_disable();
-
-       printk("Rebooting...");
        writeb(1, rbtx4938_softresetlock_addr);
        writeb(1, rbtx4938_sfvol_addr);
        writeb(1, rbtx4938_softreset_addr);
-       while(1)
-               ;
+       /* fallback */
+       (*_machine_halt)();
 }
 
 static void __init rbtx4938_pci_setup(void)
@@ -121,6 +99,7 @@ static void __init rbtx4938_pci_setup(void)
                register_pci_controller(c);
                tx4927_pcic_setup(tx4938_pcic1ptr, c, 0);
        }
+       tx4938_setup_pcierr_irq();
 #endif /* CONFIG_PCI */
 }
 
@@ -151,19 +130,7 @@ static int __init rbtx4938_ethaddr_init(void)
                if (sum)
                        printk(KERN_WARNING "seeprom: bad checksum.\n");
        }
-       for (i = 0; i < 2; i++) {
-               unsigned int id =
-                       TXX9_IRQ_BASE + (i ? TX4938_IR_ETH1 : TX4938_IR_ETH0);
-               struct platform_device *pdev;
-               if (!(__raw_readq(&tx4938_ccfgptr->pcfg) &
-                     (i ? TX4938_PCFG_ETH1_SEL : TX4938_PCFG_ETH0_SEL)))
-                       continue;
-               pdev = platform_device_alloc("tc35815-mac", id);
-               if (!pdev ||
-                   platform_device_add_data(pdev, &dat[4 + 6 * i], 6) ||
-                   platform_device_add(pdev))
-                       platform_device_put(pdev);
-       }
+       tx4938_ethaddr_init(&dat[4], &dat[4 + 6]);
 #endif /* CONFIG_PCI */
        return 0;
 }
@@ -193,51 +160,36 @@ static void __init rbtx4938_mem_setup(void)
 
 #ifdef CONFIG_PCI
        txx9_alloc_pci_controller(&txx9_primary_pcic, 0, 0, 0, 0);
+       txx9_board_pcibios_setup = tx4927_pcibios_setup;
 #else
        set_io_port_base(RBTX4938_ETHER_BASE);
 #endif
 
-       tx4938_setup_serial();
+       tx4938_sio_init(7372800, 0);
 #ifdef CONFIG_SERIAL_TXX9_CONSOLE
-        argptr = prom_getcmdline();
-        if (strstr(argptr, "console=") == NULL) {
-                strcat(argptr, " console=ttyS0,38400");
-        }
+       argptr = prom_getcmdline();
+       if (!strstr(argptr, "console="))
+               strcat(argptr, " console=ttyS0,38400");
 #endif
 
 #ifdef CONFIG_TOSHIBA_RBTX4938_MPLEX_PIO58_61
-       printk("PIOSEL: disabling both ata and nand selection\n");
-       local_irq_disable();
+       printk(KERN_INFO "PIOSEL: disabling both ata and nand selection\n");
        txx9_clear64(&tx4938_ccfgptr->pcfg,
                     TX4938_PCFG_NDF_SEL | TX4938_PCFG_ATA_SEL);
 #endif
 
 #ifdef CONFIG_TOSHIBA_RBTX4938_MPLEX_NAND
-       printk("PIOSEL: enabling nand selection\n");
+       printk(KERN_INFO "PIOSEL: enabling nand selection\n");
        txx9_set64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_NDF_SEL);
        txx9_clear64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_ATA_SEL);
 #endif
 
 #ifdef CONFIG_TOSHIBA_RBTX4938_MPLEX_ATA
-       printk("PIOSEL: enabling ata selection\n");
+       printk(KERN_INFO "PIOSEL: enabling ata selection\n");
        txx9_set64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_ATA_SEL);
        txx9_clear64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_NDF_SEL);
 #endif
 
-#ifdef CONFIG_IP_PNP
-       argptr = prom_getcmdline();
-       if (strstr(argptr, "ip=") == NULL) {
-               strcat(argptr, " ip=any");
-       }
-#endif
-
-
-#ifdef CONFIG_FB
-       {
-               conswitchp = &dummy_con;
-       }
-#endif
-
        rbtx4938_spi_setup();
        pcfg = ____raw_readq(&tx4938_ccfgptr->pcfg);    /* updated */
        /* fixup piosel */
@@ -258,11 +210,9 @@ static void __init rbtx4938_mem_setup(void)
        rbtx4938_fpga_resource.end = CPHYSADDR(RBTX4938_FPGA_REG_ADDR) + 0xffff;
        rbtx4938_fpga_resource.flags = IORESOURCE_MEM | IORESOURCE_BUSY;
        if (request_resource(&txx9_ce_res[2], &rbtx4938_fpga_resource))
-               printk("request resource for fpga failed\n");
+               printk(KERN_ERR "request resource for fpga failed\n");
 
        _machine_restart = rbtx4938_machine_restart;
-       _machine_halt = rbtx4938_machine_halt;
-       pm_power_off = rbtx4938_machine_power_off;
 
        writeb(0xff, rbtx4938_led_addr);
        printk(KERN_INFO "RBTX4938 --- FPGA(Rev %02x) DIPSW:%02x,%02x\n",
@@ -270,7 +220,7 @@ static void __init rbtx4938_mem_setup(void)
               readb(rbtx4938_dipsw_addr), readb(rbtx4938_bdipsw_addr));
 }
 
-static int __init rbtx4938_ne_init(void)
+static void __init rbtx4938_ne_init(void)
 {
        struct resource res[] = {
                {
@@ -282,10 +232,7 @@ static int __init rbtx4938_ne_init(void)
                        .flags  = IORESOURCE_IRQ,
                }
        };
-       struct platform_device *dev =
-               platform_device_register_simple("ne", -1,
-                                               res, ARRAY_SIZE(res));
-       return IS_ERR(dev) ? PTR_ERR(dev) : 0;
+       platform_device_register_simple("ne", -1, res, ARRAY_SIZE(res));
 }
 
 static DEFINE_SPINLOCK(rbtx4938_spi_gpio_lock);
@@ -321,24 +268,6 @@ static struct gpio_chip rbtx4938_spi_gpio_chip = {
        .ngpio = 3,
 };
 
-/* SPI support */
-
-static void __init txx9_spi_init(unsigned long base, int irq)
-{
-       struct resource res[] = {
-               {
-                       .start  = base,
-                       .end    = base + 0x20 - 1,
-                       .flags  = IORESOURCE_MEM,
-               }, {
-                       .start  = irq,
-                       .flags  = IORESOURCE_IRQ,
-               },
-       };
-       platform_device_register_simple("spi_txx9", 0,
-                                       res, ARRAY_SIZE(res));
-}
-
 static int __init rbtx4938_spi_init(void)
 {
        struct spi_board_info srtc_info = {
@@ -361,7 +290,7 @@ static int __init rbtx4938_spi_init(void)
        gpio_direction_output(16 + SEEPROM2_CS, 1);
        gpio_request(16 + SEEPROM3_CS, "seeprom3");
        gpio_direction_output(16 + SEEPROM3_CS, 1);
-       txx9_spi_init(TX4938_SPI_REG & 0xfffffffffULL, RBTX4938_IRQ_IRC_SPI);
+       tx4938_spi_init(0);
        return 0;
 }
 
@@ -372,30 +301,11 @@ static void __init rbtx4938_arch_init(void)
        rbtx4938_spi_init();
 }
 
-/* Watchdog support */
-
-static int __init txx9_wdt_init(unsigned long base)
-{
-       struct resource res = {
-               .start  = base,
-               .end    = base + 0x100 - 1,
-               .flags  = IORESOURCE_MEM,
-       };
-       struct platform_device *dev =
-               platform_device_register_simple("txx9wdt", -1, &res, 1);
-       return IS_ERR(dev) ? PTR_ERR(dev) : 0;
-}
-
-static int __init rbtx4938_wdt_init(void)
-{
-       return txx9_wdt_init(TX4938_TMR_REG(2) & 0xfffffffffULL);
-}
-
 static void __init rbtx4938_device_init(void)
 {
        rbtx4938_ethaddr_init();
        rbtx4938_ne_init();
-       rbtx4938_wdt_init();
+       tx4938_wdt_init();
 }
 
 struct txx9_board_vec rbtx4938_vec __initdata = {
index 11de360..b7cbb14 100644 (file)
@@ -716,6 +716,12 @@ ENTRY(sys_call_table)
        .long sys_fallocate             /* 325 */
        .long sys_timerfd_settime
        .long sys_timerfd_gettime
+       .long sys_signalfd4
+       .long sys_eventfd2
+       .long sys_epoll_create1         /* 330 */
+       .long sys_dup3
+       .long sys_pipe2
+       .long sys_inotify_init1
 
 
 nr_syscalls=(.-sys_call_table)/4
index 0e4d2f6..8fa3689 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/fs.h>
 #include <linux/string.h>
 #include <linux/kernel.h>
+#include <linux/bug.h>
 
 #if 0
 #define DEBUGP printk
@@ -195,7 +196,7 @@ int module_finalize(const Elf_Ehdr *hdr,
                    const Elf_Shdr *sechdrs,
                    struct module *me)
 {
-       return 0;
+       return module_bug_finalize(hdr, sechdrs, me);
 }
 
 /*
@@ -203,4 +204,5 @@ int module_finalize(const Elf_Ehdr *hdr,
  */
 void module_arch_cleanup(struct module *mod)
 {
+       module_bug_cleanup(mod);
 }
index 587da5e..63c9caf 100644 (file)
@@ -42,6 +42,9 @@ config GENERIC_HARDIRQS
        bool
        default y
 
+config HAVE_GET_USER_PAGES_FAST
+       def_bool PPC64
+
 config HAVE_SETUP_PER_CPU_AREA
        def_bool PPC64
 
index 8c8aadb..4ebc52a 100644 (file)
@@ -97,7 +97,7 @@ config IRQSTACKS
 
 config VIRQ_DEBUG
        bool "Expose hardware/virtual IRQ mapping via debugfs"
-       depends on DEBUG_FS && PPC_MERGE
+       depends on DEBUG_FS
        help
          This option will show the mapping relationship between hardware irq
          numbers and virtual irq numbers. The mapping is exposed via debugfs
index 7345743..fbc9304 100644 (file)
@@ -68,6 +68,7 @@
                #address-cells = <1>;
                #size-cells = <1>;
                device_type = "soc";
+               compatible = "simple-bus";
                ranges = <0x0 0xe0000000 0x00100000>;
                reg = <0xe0000000 0x00000200>;
                bus-frequency = <132000000>;
index e74c045..b157d18 100644 (file)
@@ -51,6 +51,7 @@
                #address-cells = <1>;
                #size-cells = <1>;
                device_type = "soc";
+               compatible = "simple-bus";
                ranges = <0x0 0xe0000000 0x00100000>;
                reg = <0xe0000000 0x00000200>;
                bus-frequency = <0>;
index 8dfab56..700e076 100644 (file)
@@ -52,6 +52,7 @@
                #address-cells = <1>;
                #size-cells = <1>;
                device_type = "soc";
+               compatible = "simple-bus";
                ranges = <0x0 0xe0000000 0x00100000>;
                reg = <0xe0000000 0x00000200>;
                bus-frequency = <0>;                    // from bootloader
index 49ca349..cdd3063 100644 (file)
@@ -50,6 +50,7 @@
                #address-cells = <1>;
                #size-cells = <1>;
                device_type = "soc";
+               compatible = "simple-bus";
                ranges = <0x0 0xe0000000 0x00100000>;
                reg = <0xe0000000 0x00000200>;
                bus-frequency = <0>;                    // from bootloader
index ba586cb..783241c 100644 (file)
@@ -57,6 +57,7 @@
                #address-cells = <1>;
                #size-cells = <1>;
                device_type = "soc";
+               compatible = "simple-bus";
                ranges = <0x0 0xe0000000 0x00100000>;
                reg = <0xe0000000 0x00000200>;
                bus-frequency = <0>;
index 3701dae..a3b76a7 100644 (file)
@@ -61,6 +61,7 @@
                #address-cells = <1>;
                #size-cells = <1>;
                device_type = "soc";
+               compatible = "simple-bus";
                ranges = <0x0 0xe0000000 0x00100000>;
                reg = <0xe0000000 0x00000200>;
                bus-frequency = <264000000>;
index 8acd1d6..89c9202 100644 (file)
                };
 
                crypto@30000 {
-                       compatible = "fsl,sec2-crypto";
+                       compatible = "fsl,sec2.0";
                        reg = <0x30000 0x10000>;
-                       interrupts = <11 8>;
+                       interrupts = <11 0x8>;
                        interrupt-parent = <&ipic>;
-                       num-channels = <4>;
-                       channel-fifo-len = <24>;
-                       exec-units-mask = <0x7e>;
-                       /*
-                        * desc mask is for rev1.x, we need runtime fixup
-                        * for >=2.x
-                        */
-                       descriptor-types-mask = <0x1010ebf>;
+                       fsl,num-channels = <4>;
+                       fsl,channel-fifo-len = <24>;
+                       fsl,exec-units-mask = <0x7e>;
+                       fsl,descriptor-types-mask = <0x01010ebf>;
                };
 
                ipic: interrupt-controller@700 {
index 0a700cb..432782b 100644 (file)
                #address-cells = <1>;
                #size-cells = <1>;
                device_type = "soc";
+               compatible = "simple-bus";
                ranges = <0x0 0xe0000000 0x00100000>;
                reg = <0xe0000000 0x00000200>;
                bus-frequency = <0>;
index 29c8c76..ed32c8d 100644 (file)
                #address-cells = <1>;
                #size-cells = <1>;
                device_type = "soc";
+               compatible = "simple-bus";
                ranges = <0x0 0xe0000000 0x00100000>;
                reg = <0xe0000000 0x00000200>;
                bus-frequency = <0>;
index d641a89..f4db9ed 100644 (file)
                #address-cells = <1>;
                #size-cells = <1>;
                device_type = "soc";
+               compatible = "simple-bus";
                ranges = <0x0 0xe0000000 0x00100000>;
                reg = <0xe0000000 0x00000200>;
                bus-frequency = <0>;
index 02cfa24..1505d68 100644 (file)
@@ -49,6 +49,7 @@
                #address-cells = <1>;
                #size-cells = <1>;
                device_type = "soc";
+               compatible = "simple-bus";
                ranges = <0x0 0xffe00000 0x100000>;
                reg = <0xffe00000 0x1000>;
                bus-frequency = <0>;            // Filled out by uboot.
index f2273a8..9568bfa 100644 (file)
@@ -53,6 +53,7 @@
                #address-cells = <1>;
                #size-cells = <1>;
                device_type = "soc";
+               compatible = "simple-bus";
                ranges = <0x0 0xe0000000 0x100000>;
                reg = <0xe0000000 0x100000>;    // CCSRBAR 1M
                bus-frequency = <0>;
index c4469f1..6480f4f 100644 (file)
@@ -53,6 +53,7 @@
                #address-cells = <1>;
                #size-cells = <1>;
                device_type = "soc";
+               compatible = "simple-bus";
                ranges = <0x0 0xe0000000 0x100000>;
                reg = <0xe0000000 0x1000>;      // CCSRBAR 1M
                bus-frequency = <0>;
index 7d3829d..f1fb207 100644 (file)
@@ -54,6 +54,7 @@
                #address-cells = <1>;
                #size-cells = <1>;
                device_type = "soc";
+               compatible = "simple-bus";
 
                ranges = <0x0 0xe0000000 0x100000>;
                reg = <0xe0000000 0x1000>;      // CCSRBAR 1M
index d84466b..431b496 100644 (file)
@@ -58,6 +58,7 @@
                #address-cells = <1>;
                #size-cells = <1>;
                device_type = "soc";
+               compatible = "simple-bus";
                ranges = <0x0 0xe0000000 0x100000>;
                reg = <0xe0000000 0x1000>;      // CCSRBAR
                bus-frequency = <0>;
index e03a780..d833a5c 100644 (file)
@@ -53,6 +53,7 @@
                #address-cells = <1>;
                #size-cells = <1>;
                device_type = "soc";
+               compatible = "simple-bus";
                ranges = <0x0 0xe0000000 0x100000>;
                reg = <0xe0000000 0x1000>;      // CCSRBAR 1M
                bus-frequency = <0>;
index ba8159d..4d1f2f2 100644 (file)
@@ -53,6 +53,7 @@
                #address-cells = <1>;
                #size-cells = <1>;
                device_type = "soc";
+               compatible = "simple-bus";
                ranges = <0x0 0xe0000000 0x100000>;
                reg = <0xe0000000 0x200>;
                bus-frequency = <330000000>;
index 9c30a34..a15f103 100644 (file)
@@ -60,6 +60,7 @@
                #address-cells = <1>;
                #size-cells = <1>;
                device_type = "soc";
+               compatible = "simple-bus";
                ranges = <0x0 0xe0000000 0x100000>;
                reg = <0xe0000000 0x1000>;
                bus-frequency = <0>;
index 08c61e3..e124dd1 100644 (file)
@@ -68,6 +68,7 @@
                #address-cells = <1>;
                #size-cells = <1>;
                device_type = "soc";
+               compatible = "simple-bus";
                ranges = <0x0 0xffe00000 0x100000>;
                reg = <0xffe00000 0x1000>;      // CCSRBAR & soc regs, remove once parse code for immrbase fixed
                bus-frequency = <0>;            // Filled out by uboot.
index 666185f..3b3a106 100644 (file)
                        fsl,has-rstcr;
                };
 
+               wdt@e4000 {
+                       compatible = "fsl,mpc8610-wdt";
+                       reg = <0xe4000 0x100>;
+               };
+
                i2s@16000 {
                        compatible = "fsl,mpc8610-ssi";
                        cell-index = <0>;
index ccaedae..7c09f48 100644 (file)
@@ -6,7 +6,7 @@
 /*
  * Low-level I/O routines.
  *
- * Copied from <file:include/asm-powerpc/io.h> (which has no copyright)
+ * Copied from <file:arch/powerpc/include/asm/io.h> (which has no copyright)
  */
 static inline int in_8(const volatile unsigned char *addr)
 {
similarity index 98%
rename from include/asm-powerpc/cpm.h
rename to arch/powerpc/include/asm/cpm.h
index 63a5533..24d79e3 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <linux/compiler.h>
 #include <linux/types.h>
+#include <linux/of.h>
 
 /* Opcodes common to CPM1 and CPM2
 */
@@ -100,4 +101,6 @@ unsigned long cpm_muram_offset(void __iomem *addr);
 dma_addr_t cpm_muram_dma(void __iomem *addr);
 int cpm_command(u32 command, u8 opcode);
 
+int cpm2_gpiochip_add32(struct device_node *np);
+
 #endif
similarity index 98%
rename from include/asm-powerpc/cpm2.h
rename to arch/powerpc/include/asm/cpm2.h
index 2c7fd9c..2a6fa01 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <asm/immap_cpm2.h>
 #include <asm/cpm.h>
+#include <sysdev/fsl_soc.h>
 
 #ifdef CONFIG_PPC_85xx
 #define CPM_MAP_ADDR (get_immrbase() + 0x80000)
@@ -93,10 +94,40 @@ extern cpm_cpm2_t __iomem *cpmp; /* Pointer to comm processor */
 #define cpm_dpfree cpm_muram_free
 #define cpm_dpram_addr cpm_muram_addr
 
-extern void cpm_setbrg(uint brg, uint rate);
-extern void cpm2_fastbrg(uint brg, uint rate, int div16);
 extern void cpm2_reset(void);
 
+/* Baud rate generators.
+*/
+#define CPM_BRG_RST            ((uint)0x00020000)
+#define CPM_BRG_EN             ((uint)0x00010000)
+#define CPM_BRG_EXTC_INT       ((uint)0x00000000)
+#define CPM_BRG_EXTC_CLK3_9    ((uint)0x00004000)
+#define CPM_BRG_EXTC_CLK5_15   ((uint)0x00008000)
+#define CPM_BRG_ATB            ((uint)0x00002000)
+#define CPM_BRG_CD_MASK                ((uint)0x00001ffe)
+#define CPM_BRG_DIV16          ((uint)0x00000001)
+
+#define CPM2_BRG_INT_CLK       (get_brgfreq())
+#define CPM2_BRG_UART_CLK      (CPM2_BRG_INT_CLK/16)
+
+extern void __cpm2_setbrg(uint brg, uint rate, uint clk, int div16, int src);
+
+/* This function is used by UARTS, or anything else that uses a 16x
+ * oversampled clock.
+ */
+static inline void cpm_setbrg(uint brg, uint rate)
+{
+       __cpm2_setbrg(brg, rate, CPM2_BRG_UART_CLK, 0, CPM_BRG_EXTC_INT);
+}
+
+/* This function is used to set high speed synchronous baud rate
+ * clocks.
+ */
+static inline void cpm2_fastbrg(uint brg, uint rate, int div16)
+{
+       __cpm2_setbrg(brg, rate, CPM2_BRG_INT_CLK, div16, CPM_BRG_EXTC_INT);
+}
+
 /* Function code bits, usually generic to devices.
 */
 #define CPMFCR_GBL     ((u_char)0x20)  /* Set memory snooping */
@@ -195,17 +226,6 @@ typedef struct smc_uart {
 #define SMCM_TX                ((unsigned char)0x02)
 #define SMCM_RX                ((unsigned char)0x01)
 
-/* Baud rate generators.
-*/
-#define CPM_BRG_RST            ((uint)0x00020000)
-#define CPM_BRG_EN             ((uint)0x00010000)
-#define CPM_BRG_EXTC_INT       ((uint)0x00000000)
-#define CPM_BRG_EXTC_CLK3_9    ((uint)0x00004000)
-#define CPM_BRG_EXTC_CLK5_15   ((uint)0x00008000)
-#define CPM_BRG_ATB            ((uint)0x00002000)
-#define CPM_BRG_CD_MASK                ((uint)0x00001ffe)
-#define CPM_BRG_DIV16          ((uint)0x00000001)
-
 /* SCCs.
 */
 #define SCC_GSMRH_IRP          ((uint)0x00040000)
similarity index 94%
rename from include/asm-powerpc/dcr.h
rename to arch/powerpc/include/asm/dcr.h
index 53b2830..d13fb68 100644 (file)
@@ -65,17 +65,13 @@ typedef dcr_host_mmio_t dcr_host_t;
 #endif /* defined(CONFIG_PPC_DCR_NATIVE) && defined(CONFIG_PPC_DCR_MMIO) */
 
 /*
- * On CONFIG_PPC_MERGE, we have additional helpers to read the DCR
- * base from the device-tree
+ * additional helpers to read the DCR * base from the device-tree
  */
-#ifdef CONFIG_PPC_MERGE
 struct device_node;
 extern unsigned int dcr_resource_start(struct device_node *np,
                                       unsigned int index);
 extern unsigned int dcr_resource_len(struct device_node *np,
                                     unsigned int index);
-#endif /* CONFIG_PPC_MERGE */
-
 #endif /* CONFIG_PPC_DCR */
 #endif /* __ASSEMBLY__ */
 #endif /* __KERNEL__ */
similarity index 71%
rename from include/asm-powerpc/i8259.h
rename to arch/powerpc/include/asm/i8259.h
index db1362f..105ade2 100644 (file)
@@ -4,14 +4,9 @@
 
 #include <linux/irq.h>
 
-#ifdef CONFIG_PPC_MERGE
 extern void i8259_init(struct device_node *node, unsigned long intack_addr);
 extern unsigned int i8259_irq(void);
 extern struct irq_host *i8259_get_host(void);
-#else
-extern void i8259_init(unsigned long intack_addr, int offset);
-extern int i8259_irq(void);
-#endif
 
 #endif /* __KERNEL__ */
 #endif /* _ASM_POWERPC_I8259_H */
similarity index 98%
rename from include/asm-powerpc/ide.h
rename to arch/powerpc/include/asm/ide.h
index 1aaf27b..048480e 100644 (file)
@@ -20,7 +20,6 @@
 #define __ide_mm_outsl(p, a, c)        writesl((void __iomem *)(p), (a), (c))
 
 #ifndef  __powerpc64__
-#include <linux/hdreg.h>
 #include <linux/ioport.h>
 
 /* FIXME: use ide_platform host driver */
similarity index 99%
rename from include/asm-powerpc/immap_qe.h
rename to arch/powerpc/include/asm/immap_qe.h
index 7b6f411..3c2fced 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * include/asm-powerpc/immap_qe.h
- *
  * QUICC Engine (QE) Internal Memory Map.
  * The Internal Memory Map for devices with QE on them. This
  * is the superset of all QE devices (8360, etc.).
similarity index 93%
rename from include/asm-powerpc/ipic.h
rename to arch/powerpc/include/asm/ipic.h
index 8ff08be..fb59829 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * include/asm-powerpc/ipic.h
- *
  * IPIC external definitions and structure.
  *
  * Maintainer: Kumar Gala <galak@kernel.crashing.org>
@@ -79,15 +77,8 @@ extern void ipic_disable_mcp(enum ipic_mcp_irq mcp_irq);
 extern u32 ipic_get_mcp_status(void);
 extern void ipic_clear_mcp_status(u32 mask);
 
-#ifdef CONFIG_PPC_MERGE
 extern struct ipic * ipic_init(struct device_node *node, unsigned int flags);
 extern unsigned int ipic_get_irq(void);
-#else
-extern void ipic_init(phys_addr_t phys_addr, unsigned int flags,
-               unsigned int irq_offset,
-               unsigned char *senses, unsigned int senses_count);
-extern int ipic_get_irq(void);
-#endif
 
 #endif /* __ASM_IPIC_H__ */
 #endif /* __KERNEL__ */
similarity index 58%
rename from include/asm-powerpc/irq.h
rename to arch/powerpc/include/asm/irq.h
index 1ef8e30..a372f76 100644 (file)
@@ -25,8 +25,6 @@
 
 extern atomic_t ppc_n_lost_interrupts;
 
-#ifdef CONFIG_PPC_MERGE
-
 /* This number is used when no interrupt has been assigned */
 #define NO_IRQ                 (0)
 
@@ -326,292 +324,6 @@ static __inline__ int irq_canonicalize(int irq)
        return irq;
 }
 
-
-#else /* CONFIG_PPC_MERGE */
-
-/* This number is used when no interrupt has been assigned */
-#define NO_IRQ                 (-1)
-#define NO_IRQ_IGNORE          (-2)
-
-
-/*
- * These constants are used for passing information about interrupt
- * signal polarity and level/edge sensing to the low-level PIC chip
- * drivers.
- */
-#define IRQ_SENSE_MASK         0x1
-#define IRQ_SENSE_LEVEL                0x1     /* interrupt on active level */
-#define IRQ_SENSE_EDGE         0x0     /* interrupt triggered by edge */
-
-#define IRQ_POLARITY_MASK      0x2
-#define IRQ_POLARITY_POSITIVE  0x2     /* high level or low->high edge */
-#define IRQ_POLARITY_NEGATIVE  0x0     /* low level or high->low edge */
-
-
-#if defined(CONFIG_40x)
-#include <asm/ibm4xx.h>
-
-#ifndef NR_BOARD_IRQS
-#define NR_BOARD_IRQS 0
-#endif
-
-#ifndef UIC_WIDTH /* Number of interrupts per device */
-#define UIC_WIDTH 32
-#endif
-
-#ifndef NR_UICS /* number  of UIC devices */
-#define NR_UICS 1
-#endif
-
-#if defined (CONFIG_403)
-/*
- * The PowerPC 403 cores' Asynchronous Interrupt Controller (AIC) has
- * 32 possible interrupts, a majority of which are not implemented on
- * all cores. There are six configurable, external interrupt pins and
- * there are eight internal interrupts for the on-chip serial port
- * (SPU), DMA controller, and JTAG controller.
- *
- */
-
-#define        NR_AIC_IRQS 32
-#define        NR_IRQS  (NR_AIC_IRQS + NR_BOARD_IRQS)
-
-#elif !defined (CONFIG_403)
-
-/*
- *  The PowerPC 405 cores' Universal Interrupt Controller (UIC) has 32
- * possible interrupts as well. There are seven, configurable external
- * interrupt pins and there are 17 internal interrupts for the on-chip
- * serial port, DMA controller, on-chip Ethernet controller, PCI, etc.
- *
- */
-
-
-#define NR_UIC_IRQS UIC_WIDTH
-#define NR_IRQS                ((NR_UIC_IRQS * NR_UICS) + NR_BOARD_IRQS)
-#endif
-
-#elif defined(CONFIG_44x)
-#include <asm/ibm44x.h>
-
-#define        NR_UIC_IRQS     32
-#define        NR_IRQS         ((NR_UIC_IRQS * NR_UICS) + NR_BOARD_IRQS)
-
-#elif defined(CONFIG_8xx)
-
-/* Now include the board configuration specific associations.
-*/
-#include <asm/mpc8xx.h>
-
-/* The MPC8xx cores have 16 possible interrupts.  There are eight
- * possible level sensitive interrupts assigned and generated internally
- * from such devices as CPM, PCMCIA, RTC, PIT, TimeBase and Decrementer.
- * There are eight external interrupts (IRQs) that can be configured
- * as either level or edge sensitive.
- *
- * On some implementations, there is also the possibility of an 8259
- * through the PCI and PCI-ISA bridges.
- *
- * We are "flattening" the interrupt vectors of the cascaded CPM
- * and 8259 interrupt controllers so that we can uniquely identify
- * any interrupt source with a single integer.
- */
-#define NR_SIU_INTS    16
-#define NR_CPM_INTS    32
-#ifndef NR_8259_INTS
-#define NR_8259_INTS 0
-#endif
-
-#define SIU_IRQ_OFFSET         0
-#define CPM_IRQ_OFFSET         (SIU_IRQ_OFFSET + NR_SIU_INTS)
-#define I8259_IRQ_OFFSET       (CPM_IRQ_OFFSET + NR_CPM_INTS)
-
-#define NR_IRQS        (NR_SIU_INTS + NR_CPM_INTS + NR_8259_INTS)
-
-/* These values must be zero-based and map 1:1 with the SIU configuration.
- * They are used throughout the 8xx I/O subsystem to generate
- * interrupt masks, flags, and other control patterns.  This is why the
- * current kernel assumption of the 8259 as the base controller is such
- * a pain in the butt.
- */
-#define        SIU_IRQ0        (0)     /* Highest priority */
-#define        SIU_LEVEL0      (1)
-#define        SIU_IRQ1        (2)
-#define        SIU_LEVEL1      (3)
-#define        SIU_IRQ2        (4)
-#define        SIU_LEVEL2      (5)
-#define        SIU_IRQ3        (6)
-#define        SIU_LEVEL3      (7)
-#define        SIU_IRQ4        (8)
-#define        SIU_LEVEL4      (9)
-#define        SIU_IRQ5        (10)
-#define        SIU_LEVEL5      (11)
-#define        SIU_IRQ6        (12)
-#define        SIU_LEVEL6      (13)
-#define        SIU_IRQ7        (14)
-#define        SIU_LEVEL7      (15)
-
-#define MPC8xx_INT_FEC1                SIU_LEVEL1
-#define MPC8xx_INT_FEC2                SIU_LEVEL3
-
-#define MPC8xx_INT_SCC1                (CPM_IRQ_OFFSET + CPMVEC_SCC1)
-#define MPC8xx_INT_SCC2                (CPM_IRQ_OFFSET + CPMVEC_SCC2)
-#define MPC8xx_INT_SCC3                (CPM_IRQ_OFFSET + CPMVEC_SCC3)
-#define MPC8xx_INT_SCC4                (CPM_IRQ_OFFSET + CPMVEC_SCC4)
-#define MPC8xx_INT_SMC1                (CPM_IRQ_OFFSET + CPMVEC_SMC1)
-#define MPC8xx_INT_SMC2                (CPM_IRQ_OFFSET + CPMVEC_SMC2)
-
-/* The internal interrupts we can configure as we see fit.
- * My personal preference is CPM at level 2, which puts it above the
- * MBX PCI/ISA/IDE interrupts.
- */
-#ifndef PIT_INTERRUPT
-#define PIT_INTERRUPT          SIU_LEVEL0
-#endif
-#ifndef        CPM_INTERRUPT
-#define CPM_INTERRUPT          SIU_LEVEL2
-#endif
-#ifndef        PCMCIA_INTERRUPT
-#define PCMCIA_INTERRUPT       SIU_LEVEL6
-#endif
-#ifndef        DEC_INTERRUPT
-#define DEC_INTERRUPT          SIU_LEVEL7
-#endif
-
-/* Some internal interrupt registers use an 8-bit mask for the interrupt
- * level instead of a number.
- */
-#define        mk_int_int_mask(IL) (1 << (7 - (IL/2)))
-
-#else /* CONFIG_40x + CONFIG_8xx */
-/*
- * this is the # irq's for all ppc arch's (pmac/chrp/prep)
- * so it is the max of them all
- */
-#define NR_IRQS                        256
-#define __DO_IRQ_CANON 1
-
-#ifndef CONFIG_8260
-
-#define NUM_8259_INTERRUPTS    16
-
-#else /* CONFIG_8260 */
-
-/* The 8260 has an internal interrupt controller with a maximum of
- * 64 IRQs.  We will use NR_IRQs from above since it is large enough.
- * Don't be confused by the 8260 documentation where they list an
- * "interrupt number" and "interrupt vector".  We are only interested
- * in the interrupt vector.  There are "reserved" holes where the
- * vector number increases, but the interrupt number in the table does not.
- * (Document errata updates have fixed this...make sure you have up to
- * date processor documentation -- Dan).
- */
-
-#ifndef CPM_IRQ_OFFSET
-#define CPM_IRQ_OFFSET 0
-#endif
-
-#define NR_CPM_INTS    64
-
-#define        SIU_INT_ERROR           ((uint)0x00 + CPM_IRQ_OFFSET)
-#define        SIU_INT_I2C             ((uint)0x01 + CPM_IRQ_OFFSET)
-#define        SIU_INT_SPI             ((uint)0x02 + CPM_IRQ_OFFSET)
-#define        SIU_INT_RISC            ((uint)0x03 + CPM_IRQ_OFFSET)
-#define        SIU_INT_SMC1            ((uint)0x04 + CPM_IRQ_OFFSET)
-#define        SIU_INT_SMC2            ((uint)0x05 + CPM_IRQ_OFFSET)
-#define        SIU_INT_IDMA1           ((uint)0x06 + CPM_IRQ_OFFSET)
-#define        SIU_INT_IDMA2           ((uint)0x07 + CPM_IRQ_OFFSET)
-#define        SIU_INT_IDMA3           ((uint)0x08 + CPM_IRQ_OFFSET)
-#define        SIU_INT_IDMA4           ((uint)0x09 + CPM_IRQ_OFFSET)
-#define        SIU_INT_SDMA            ((uint)0x0a + CPM_IRQ_OFFSET)
-#define        SIU_INT_USB             ((uint)0x0b + CPM_IRQ_OFFSET)
-#define        SIU_INT_TIMER1          ((uint)0x0c + CPM_IRQ_OFFSET)
-#define        SIU_INT_TIMER2          ((uint)0x0d + CPM_IRQ_OFFSET)
-#define        SIU_INT_TIMER3          ((uint)0x0e + CPM_IRQ_OFFSET)
-#define        SIU_INT_TIMER4          ((uint)0x0f + CPM_IRQ_OFFSET)
-#define        SIU_INT_TMCNT           ((uint)0x10 + CPM_IRQ_OFFSET)
-#define        SIU_INT_PIT             ((uint)0x11 + CPM_IRQ_OFFSET)
-#define        SIU_INT_PCI             ((uint)0x12 + CPM_IRQ_OFFSET)
-#define        SIU_INT_IRQ1            ((uint)0x13 + CPM_IRQ_OFFSET)
-#define        SIU_INT_IRQ2            ((uint)0x14 + CPM_IRQ_OFFSET)
-#define        SIU_INT_IRQ3            ((uint)0x15 + CPM_IRQ_OFFSET)
-#define        SIU_INT_IRQ4            ((uint)0x16 + CPM_IRQ_OFFSET)
-#define        SIU_INT_IRQ5            ((uint)0x17 + CPM_IRQ_OFFSET)
-#define        SIU_INT_IRQ6            ((uint)0x18 + CPM_IRQ_OFFSET)
-#define        SIU_INT_IRQ7            ((uint)0x19 + CPM_IRQ_OFFSET)
-#define        SIU_INT_FCC1            ((uint)0x20 + CPM_IRQ_OFFSET)
-#define        SIU_INT_FCC2            ((uint)0x21 + CPM_IRQ_OFFSET)
-#define        SIU_INT_FCC3            ((uint)0x22 + CPM_IRQ_OFFSET)
-#define        SIU_INT_MCC1            ((uint)0x24 + CPM_IRQ_OFFSET)
-#define        SIU_INT_MCC2            ((uint)0x25 + CPM_IRQ_OFFSET)
-#define        SIU_INT_SCC1            ((uint)0x28 + CPM_IRQ_OFFSET)
-#define        SIU_INT_SCC2            ((uint)0x29 + CPM_IRQ_OFFSET)
-#define        SIU_INT_SCC3            ((uint)0x2a + CPM_IRQ_OFFSET)
-#define        SIU_INT_SCC4            ((uint)0x2b + CPM_IRQ_OFFSET)
-#define        SIU_INT_PC15            ((uint)0x30 + CPM_IRQ_OFFSET)
-#define        SIU_INT_PC14            ((uint)0x31 + CPM_IRQ_OFFSET)
-#define        SIU_INT_PC13            ((uint)0x32 + CPM_IRQ_OFFSET)
-#define        SIU_INT_PC12            ((uint)0x33 + CPM_IRQ_OFFSET)
-#define        SIU_INT_PC11            ((uint)0x34 + CPM_IRQ_OFFSET)
-#define        SIU_INT_PC10            ((uint)0x35 + CPM_IRQ_OFFSET)
-#define        SIU_INT_PC9             ((uint)0x36 + CPM_IRQ_OFFSET)
-#define        SIU_INT_PC8             ((uint)0x37 + CPM_IRQ_OFFSET)
-#define        SIU_INT_PC7             ((uint)0x38 + CPM_IRQ_OFFSET)
-#define        SIU_INT_PC6             ((uint)0x39 + CPM_IRQ_OFFSET)
-#define        SIU_INT_PC5             ((uint)0x3a + CPM_IRQ_OFFSET)
-#define        SIU_INT_PC4             ((uint)0x3b + CPM_IRQ_OFFSET)
-#define        SIU_INT_PC3             ((uint)0x3c + CPM_IRQ_OFFSET)
-#define        SIU_INT_PC2             ((uint)0x3d + CPM_IRQ_OFFSET)
-#define        SIU_INT_PC1             ((uint)0x3e + CPM_IRQ_OFFSET)
-#define        SIU_INT_PC0             ((uint)0x3f + CPM_IRQ_OFFSET)
-
-#endif /* CONFIG_8260 */
-
-#endif /* Whatever way too big #ifdef */
-
-#define NR_MASK_WORDS  ((NR_IRQS + 31) / 32)
-/* pedantic: these are long because they are used with set_bit --RR */
-extern unsigned long ppc_cached_irq_mask[NR_MASK_WORDS];
-
-/*
- * Because many systems have two overlapping names spaces for
- * interrupts (ISA and XICS for example), and the ISA interrupts
- * have historically not been easy to renumber, we allow ISA
- * interrupts to take values 0 - 15, and shift up the remaining
- * interrupts by 0x10.
- */
-#define NUM_ISA_INTERRUPTS     0x10
-extern int __irq_offset_value;
-
-static inline int irq_offset_up(int irq)
-{
-       return(irq + __irq_offset_value);
-}
-
-static inline int irq_offset_down(int irq)
-{
-       return(irq - __irq_offset_value);
-}
-
-static inline int irq_offset_value(void)
-{
-       return __irq_offset_value;
-}
-
-#ifdef __DO_IRQ_CANON
-extern int ppc_do_canonicalize_irqs;
-#else
-#define ppc_do_canonicalize_irqs       0
-#endif
-
-static __inline__ int irq_canonicalize(int irq)
-{
-       if (ppc_do_canonicalize_irqs && irq == 2)
-               irq = 9;
-       return irq;
-}
-#endif /* CONFIG_PPC_MERGE */
-
 extern int distribute_irqs;
 
 struct irqaction;
similarity index 93%
rename from include/asm-powerpc/irqflags.h
rename to arch/powerpc/include/asm/irqflags.h
index cc6fdba..17ba3a8 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * include/asm-powerpc/irqflags.h
- *
  * IRQ flags handling
  */
 #ifndef _ASM_IRQFLAGS_H
@@ -10,7 +8,7 @@
 /*
  * Get definitions for raw_local_save_flags(x), etc.
  */
-#include <asm-powerpc/hw_irq.h>
+#include <asm/hw_irq.h>
 
 #else
 #ifdef CONFIG_TRACE_IRQFLAGS
similarity index 98%
rename from include/asm-powerpc/kgdb.h
rename to arch/powerpc/include/asm/kgdb.h
index 1399caf..edd2170 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * include/asm-powerpc/kgdb.h
- *
  * The PowerPC (32/64) specific defines / externs for KGDB.  Based on
  * the previous 32bit and 64bit specific files, which had the following
  * copyrights:
similarity index 99%
rename from include/asm-powerpc/paca.h
rename to arch/powerpc/include/asm/paca.h
index 7b56444..6493a39 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * include/asm-powerpc/paca.h
- *
  * This control block defines the PACA which defines the processor
  * specific data for each logical processor on the system.
  * There are some pointers defined that are utilized by PLIC.
similarity index 99%
rename from include/asm-powerpc/pgtable-ppc64.h
rename to arch/powerpc/include/asm/pgtable-ppc64.h
index 5fc78c0..db0b8f3 100644 (file)
 
 #define _PAGE_WRENABLE (_PAGE_RW | _PAGE_DIRTY)
 
-/* __pgprot defined in asm-powerpc/page.h */
+/* __pgprot defined in arch/powerpc/incliude/asm/page.h */
 #define PAGE_NONE      __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED)
 
 #define PAGE_SHARED    __pgprot(_PAGE_BASE | _PAGE_RW | _PAGE_USER)
@@ -461,6 +461,8 @@ void pgtable_cache_init(void);
        return pt;
 }
 
+pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long address);
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* _ASM_POWERPC_PGTABLE_PPC64_H_ */
similarity index 99%
rename from include/asm-powerpc/qe_ic.h
rename to arch/powerpc/include/asm/qe_ic.h
index a779b2c..56a7745 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * include/asm-powerpc/qe_ic.h
- *
  * Copyright (C) 2006 Freescale Semicondutor, Inc. All rights reserved.
  *
  * Authors:    Shlomi Gridish <gridish@freescale.com>
similarity index 96%
rename from include/asm-powerpc/rwsem.h
rename to arch/powerpc/include/asm/rwsem.h
index a6cc93b..24cd928 100644 (file)
@@ -8,8 +8,8 @@
 #ifdef __KERNEL__
 
 /*
- * include/asm-powerpc/rwsem.h: R/W semaphores for PPC using the stuff
- * in lib/rwsem.c.  Adapted largely from include/asm-i386/rwsem.h
+ * R/W semaphores for PPC using the stuff in lib/rwsem.c.
+ * Adapted largely from include/asm-i386/rwsem.h
  * by Paul Mackerras <paulus@samba.org>.
  */
 
similarity index 99%
rename from include/asm-powerpc/ucc_fast.h
rename to arch/powerpc/include/asm/ucc_fast.h
index fce16ab..839aab8 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * include/asm-powerpc/ucc_fast.h
- *
  * Internal header file for UCC FAST unit routines.
  *
  * Copyright (C) 2006 Freescale Semicondutor, Inc. All rights reserved.
similarity index 95%
rename from include/asm-powerpc/uic.h
rename to arch/powerpc/include/asm/uic.h
index 970eb7e..597edfc 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * include/asm-powerpc/uic.h
- *
  * IBM PPC4xx UIC external definitions and structure.
  *
  * Maintainer: David Gibson <dwg@au1.ibm.com>
index 1a40947..64f5948 100644 (file)
@@ -59,8 +59,6 @@ obj64-$(CONFIG_HIBERNATION)   += swsusp_asm64.o
 obj-$(CONFIG_MODULES)          += module.o module_$(CONFIG_WORD_SIZE).o
 obj-$(CONFIG_44x)              += cpu_setup_44x.o
 
-ifeq ($(CONFIG_PPC_MERGE),y)
-
 extra-$(CONFIG_PPC_STD_MMU)    := head_32.o
 extra-$(CONFIG_PPC64)          := head_64.o
 extra-$(CONFIG_40x)            := head_40x.o
@@ -100,12 +98,6 @@ ifneq ($(CONFIG_PPC_INDIRECT_IO),y)
 obj-y                          += iomap.o
 endif
 
-else
-# stuff used from here for ARCH=ppc
-smpobj-$(CONFIG_SMP)           += smp.o
-
-endif
-
 obj-$(CONFIG_PPC64)            += $(obj64-y)
 
 extra-$(CONFIG_PPC_FPU)                += fpu.o
@@ -121,9 +113,6 @@ PHONY += systbl_chk
 systbl_chk: $(src)/systbl_chk.sh $(obj)/systbl_chk.i
        $(call cmd,systbl_chk)
 
-
-ifeq ($(CONFIG_PPC_MERGE),y)
-
 $(obj)/built-in.o:             prom_init_check
 
 quiet_cmd_prom_init_check = CALL    $<
@@ -133,7 +122,4 @@ PHONY += prom_init_check
 prom_init_check: $(src)/prom_init_check.sh $(obj)/prom_init.o
        $(call cmd,prom_init_check)
 
-endif
-
-
 clean-files := vmlinux.lds
index 5465e8d..80cac98 100644 (file)
@@ -39,12 +39,6 @@ _GLOBAL(__setup_cpu_440gx)
 _GLOBAL(__setup_cpu_440spe)
        b       __fixup_440A_mcheck
 
- /* Temporary fixup for arch/ppc until we kill the whole thing */
-#ifndef CONFIG_PPC_MERGE
-_GLOBAL(__fixup_440A_mcheck)
-       blr
-#endif
-
 /* enable APU between CPU and FPU */
 _GLOBAL(__init_fpu_44x)
        mfspr   r3,SPRN_CCR0
index 6ac8612..d972dec 100644 (file)
@@ -77,22 +77,12 @@ static int ppc_spurious_interrupts;
 EXPORT_SYMBOL(__irq_offset_value);
 atomic_t ppc_n_lost_interrupts;
 
-#ifndef CONFIG_PPC_MERGE
-#define NR_MASK_WORDS  ((NR_IRQS + 31) / 32)
-unsigned long ppc_cached_irq_mask[NR_MASK_WORDS];
-#endif
-
 #ifdef CONFIG_TAU_INT
 extern int tau_initialized;
 extern int tau_interrupts(int);
 #endif
 #endif /* CONFIG_PPC32 */
 
-#if defined(CONFIG_SMP) && !defined(CONFIG_PPC_MERGE)
-extern atomic_t ipi_recv;
-extern atomic_t ipi_sent;
-#endif
-
 #ifdef CONFIG_PPC64
 EXPORT_SYMBOL(irq_desc);
 
@@ -216,21 +206,14 @@ int show_interrupts(struct seq_file *p, void *v)
 skip:
                spin_unlock_irqrestore(&desc->lock, flags);
        } else if (i == NR_IRQS) {
-#ifdef CONFIG_PPC32
-#ifdef CONFIG_TAU_INT
+#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
-#if defined(CONFIG_SMP) && !defined(CONFIG_PPC_MERGE)
-               /* should this be per processor send/receive? */
-               seq_printf(p, "IPI (recv/sent): %10u/%u\n",
-                               atomic_read(&ipi_recv), atomic_read(&ipi_sent));
-#endif
-#endif /* CONFIG_PPC32 */
+#endif /* CONFIG_PPC32 && CONFIG_TAU_INT*/
                seq_printf(p, "BAD: %10u\n", ppc_spurious_interrupts);
        }
        return 0;
@@ -454,8 +437,6 @@ void do_softirq(void)
  * IRQ controller and virtual interrupts
  */
 
-#ifdef CONFIG_PPC_MERGE
-
 static LIST_HEAD(irq_hosts);
 static DEFINE_SPINLOCK(irq_big_lock);
 static DEFINE_PER_CPU(unsigned int, irq_radix_reader);
@@ -1114,8 +1095,6 @@ static int __init irq_debugfs_init(void)
 __initcall(irq_debugfs_init);
 #endif /* CONFIG_VIRQ_DEBUG */
 
-#endif /* CONFIG_PPC_MERGE */
-
 #ifdef CONFIG_PPC64
 static int __init setup_noirqdistrib(char *str)
 {
index 9f856a0..1a09719 100644 (file)
@@ -636,10 +636,6 @@ static ssize_t lparcfg_write(struct file *file, const char __user * buf,
                retval = -EIO;
        } else if (retval == H_PARAMETER) {
                retval = -EINVAL;
-       } else {
-               printk(KERN_WARNING "%s: received unknown hv return code %ld",
-                      __func__, retval);
-               retval = -EIO;
        }
 
        return retval;
index e030f3b..957bded 100644 (file)
@@ -276,10 +276,8 @@ int set_dabr(unsigned long dabr)
 {
        __get_cpu_var(current_dabr) = dabr;
 
-#ifdef CONFIG_PPC_MERGE                /* XXX for now */
        if (ppc_md.set_dabr)
                return ppc_md.set_dabr(dabr);
-#endif
 
        /* XXX should we have a CPU_FTR_HAS_DABR ? */
 #if defined(CONFIG_PPC64) || defined(CONFIG_6xx)
index 6b66cd8..3635be6 100644 (file)
@@ -375,7 +375,7 @@ static int vsr_get(struct task_struct *target, const struct user_regset *regset,
        flush_vsx_to_thread(target);
 
        for (i = 0; i < 32 ; i++)
-               buf[i] = current->thread.fpr[i][TS_VSRLOWOFFSET];
+               buf[i] = target->thread.fpr[i][TS_VSRLOWOFFSET];
        ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
                                  buf, 0, 32 * sizeof(double));
 
@@ -394,7 +394,7 @@ static int vsr_set(struct task_struct *target, const struct user_regset *regset,
        ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
                                 buf, 0, 32 * sizeof(double));
        for (i = 0; i < 32 ; i++)
-               current->thread.fpr[i][TS_VSRLOWOFFSET] = buf[i];
+               target->thread.fpr[i][TS_VSRLOWOFFSET] = buf[i];
 
 
        return ret;
@@ -975,15 +975,13 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
        case PTRACE_GETVSRREGS:
                return copy_regset_to_user(child, &user_ppc_native_view,
                                           REGSET_VSX,
-                                          0, (32 * sizeof(vector128) +
-                                              sizeof(u32)),
+                                          0, 32 * sizeof(double),
                                           (void __user *) data);
 
        case PTRACE_SETVSRREGS:
                return copy_regset_from_user(child, &user_ppc_native_view,
                                             REGSET_VSX,
-                                            0, (32 * sizeof(vector128) +
-                                                sizeof(u32)),
+                                            0, 32 * sizeof(double),
                                             (const void __user *) data);
 #endif
 #ifdef CONFIG_SPE
index 67bf1a1..197d49c 100644 (file)
@@ -294,6 +294,8 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
        case PTRACE_SETFPREGS:
        case PTRACE_GETVRREGS:
        case PTRACE_SETVRREGS:
+       case PTRACE_GETVSRREGS:
+       case PTRACE_SETVSRREGS:
        case PTRACE_GETREGS64:
        case PTRACE_SETREGS64:
        case PPC_PTRACE_GETFPREGS:
index f177c60..65639a4 100644 (file)
@@ -788,9 +788,7 @@ static int __init vdso_init(void)
 
        return 0;
 }
-#ifdef CONFIG_PPC_MERGE
 arch_initcall(vdso_init);
-#endif
 
 int in_gate_area_no_task(unsigned long addr)
 {
index 2a88e8b..d69912c 100644 (file)
@@ -6,12 +6,10 @@ ifeq ($(CONFIG_PPC64),y)
 EXTRA_CFLAGS           += -mno-minimal-toc
 endif
 
-ifeq ($(CONFIG_PPC_MERGE),y)
 obj-y                  := string.o alloc.o \
                           checksum_$(CONFIG_WORD_SIZE).o
 obj-$(CONFIG_PPC32)    += div64.o copy_32.o crtsavres.o
 obj-$(CONFIG_HAS_IOMEM)        += devres.o
-endif
 
 obj-$(CONFIG_PPC64)    += copypage_64.o copyuser_64.o \
                           memcpy_64.o usercopy_64.o mem_64.o string.o
index 1c00e01..e7392b4 100644 (file)
@@ -12,7 +12,8 @@ obj-y                         := fault.o mem.o \
                                   mmu_context_$(CONFIG_WORD_SIZE).o
 hash-$(CONFIG_PPC_NATIVE)      := hash_native_64.o
 obj-$(CONFIG_PPC64)            += hash_utils_64.o \
-                                  slb_low.o slb.o stab.o mmap.o $(hash-y)
+                                  slb_low.o slb.o stab.o \
+                                  gup.o mmap.o $(hash-y)
 obj-$(CONFIG_PPC_STD_MMU_32)   += ppc_mmu_32.o
 obj-$(CONFIG_PPC_STD_MMU)      += hash_low_$(CONFIG_WORD_SIZE).o \
                                   tlb_$(CONFIG_WORD_SIZE).o
diff --git a/arch/powerpc/mm/gup.c b/arch/powerpc/mm/gup.c
new file mode 100644 (file)
index 0000000..9fdf4d6
--- /dev/null
@@ -0,0 +1,280 @@
+/*
+ * Lockless get_user_pages_fast for powerpc
+ *
+ * Copyright (C) 2008 Nick Piggin
+ * Copyright (C) 2008 Novell Inc.
+ */
+#undef DEBUG
+
+#include <linux/sched.h>
+#include <linux/mm.h>
+#include <linux/hugetlb.h>
+#include <linux/vmstat.h>
+#include <linux/pagemap.h>
+#include <linux/rwsem.h>
+#include <asm/pgtable.h>
+
+/*
+ * The performance critical leaf functions are made noinline otherwise gcc
+ * inlines everything into a single function which results in too much
+ * register pressure.
+ */
+static noinline int gup_pte_range(pmd_t pmd, unsigned long addr,
+               unsigned long end, int write, struct page **pages, int *nr)
+{
+       unsigned long mask, result;
+       pte_t *ptep;
+
+       result = _PAGE_PRESENT|_PAGE_USER;
+       if (write)
+               result |= _PAGE_RW;
+       mask = result | _PAGE_SPECIAL;
+
+       ptep = pte_offset_kernel(&pmd, addr);
+       do {
+               pte_t pte = *ptep;
+               struct page *page;
+
+               if ((pte_val(pte) & mask) != result)
+                       return 0;
+               VM_BUG_ON(!pfn_valid(pte_pfn(pte)));
+               page = pte_page(pte);
+               if (!page_cache_get_speculative(page))
+                       return 0;
+               if (unlikely(pte != *ptep)) {
+                       put_page(page);
+                       return 0;
+               }
+               pages[*nr] = page;
+               (*nr)++;
+
+       } while (ptep++, addr += PAGE_SIZE, addr != end);
+
+       return 1;
+}
+
+#ifdef CONFIG_HUGETLB_PAGE
+static noinline int gup_huge_pte(pte_t *ptep, struct hstate *hstate,
+                                unsigned long *addr, unsigned long end,
+                                int write, struct page **pages, int *nr)
+{
+       unsigned long mask;
+       unsigned long pte_end;
+       struct page *head, *page;
+       pte_t pte;
+       int refs;
+
+       pte_end = (*addr + huge_page_size(hstate)) & huge_page_mask(hstate);
+       if (pte_end < end)
+               end = pte_end;
+
+       pte = *ptep;
+       mask = _PAGE_PRESENT|_PAGE_USER;
+       if (write)
+               mask |= _PAGE_RW;
+       if ((pte_val(pte) & mask) != mask)
+               return 0;
+       /* hugepages are never "special" */
+       VM_BUG_ON(!pfn_valid(pte_pfn(pte)));
+
+       refs = 0;
+       head = pte_page(pte);
+       page = head + ((*addr & ~huge_page_mask(hstate)) >> PAGE_SHIFT);
+       do {
+               VM_BUG_ON(compound_head(page) != head);
+               pages[*nr] = page;
+               (*nr)++;
+               page++;
+               refs++;
+       } while (*addr += PAGE_SIZE, *addr != end);
+
+       if (!page_cache_add_speculative(head, refs)) {
+               *nr -= refs;
+               return 0;
+       }
+       if (unlikely(pte != *ptep)) {
+               /* Could be optimized better */
+               while (*nr) {
+                       put_page(page);
+                       (*nr)--;
+               }
+       }
+
+       return 1;
+}
+#endif /* CONFIG_HUGETLB_PAGE */
+
+static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end,
+               int write, struct page **pages, int *nr)
+{
+       unsigned long next;
+       pmd_t *pmdp;
+
+       pmdp = pmd_offset(&pud, addr);
+       do {
+               pmd_t pmd = *pmdp;
+
+               next = pmd_addr_end(addr, end);
+               if (pmd_none(pmd))
+                       return 0;
+               if (!gup_pte_range(pmd, addr, next, write, pages, nr))
+                       return 0;
+       } while (pmdp++, addr = next, addr != end);
+
+       return 1;
+}
+
+static int gup_pud_range(pgd_t pgd, unsigned long addr, unsigned long end,
+               int write, struct page **pages, int *nr)
+{
+       unsigned long next;
+       pud_t *pudp;
+
+       pudp = pud_offset(&pgd, addr);
+       do {
+               pud_t pud = *pudp;
+
+               next = pud_addr_end(addr, end);
+               if (pud_none(pud))
+                       return 0;
+               if (!gup_pmd_range(pud, addr, next, write, pages, nr))
+                       return 0;
+       } while (pudp++, addr = next, addr != end);
+
+       return 1;
+}
+
+int get_user_pages_fast(unsigned long start, int nr_pages, int write,
+                       struct page **pages)
+{
+       struct mm_struct *mm = current->mm;
+       unsigned long addr, len, end;
+       unsigned long next;
+       pgd_t *pgdp;
+       int psize, nr = 0;
+       unsigned int shift;
+
+       pr_debug("%s(%lx,%x,%s)\n", __func__, start, nr_pages, write ? "write" : "read");
+
+       start &= PAGE_MASK;
+       addr = start;
+       len = (unsigned long) nr_pages << PAGE_SHIFT;
+       end = start + len;
+
+       if (unlikely(!access_ok(write ? VERIFY_WRITE : VERIFY_READ,
+                                       start, len)))
+               goto slow_irqon;
+
+       pr_debug("  aligned: %lx .. %lx\n", start, end);
+
+#ifdef CONFIG_HUGETLB_PAGE
+       /* We bail out on slice boundary crossing when hugetlb is
+        * enabled in order to not have to deal with two different
+        * page table formats
+        */
+       if (addr < SLICE_LOW_TOP) {
+               if (end > SLICE_LOW_TOP)
+                       goto slow_irqon;
+
+               if (unlikely(GET_LOW_SLICE_INDEX(addr) !=
+                            GET_LOW_SLICE_INDEX(end - 1)))
+                       goto slow_irqon;
+       } else {
+               if (unlikely(GET_HIGH_SLICE_INDEX(addr) !=
+                            GET_HIGH_SLICE_INDEX(end - 1)))
+                       goto slow_irqon;
+       }
+#endif /* CONFIG_HUGETLB_PAGE */
+
+       /*
+        * XXX: batch / limit 'nr', to avoid large irq off latency
+        * needs some instrumenting to determine the common sizes used by
+        * important workloads (eg. DB2), and whether limiting the batch size
+        * will decrease performance.
+        *
+        * It seems like we're in the clear for the moment. Direct-IO is
+        * the main guy that batches up lots of get_user_pages, and even
+        * they are limited to 64-at-a-time which is not so many.
+        */
+       /*
+        * This doesn't prevent pagetable teardown, but does prevent
+        * the pagetables from being freed on powerpc.
+        *
+        * So long as we atomically load page table pointers versus teardown,
+        * we can follow the address down to the the page and take a ref on it.
+        */
+       local_irq_disable();
+
+       psize = get_slice_psize(mm, addr);
+       shift = mmu_psize_defs[psize].shift;
+
+#ifdef CONFIG_HUGETLB_PAGE
+       if (unlikely(mmu_huge_psizes[psize])) {
+               pte_t *ptep;
+               unsigned long a = addr;
+               unsigned long sz = ((1UL) << shift);
+               struct hstate *hstate = size_to_hstate(sz);
+
+               BUG_ON(!hstate);
+               /*
+                * XXX: could be optimized to avoid hstate
+                * lookup entirely (just use shift)
+                */
+
+               do {
+                       VM_BUG_ON(shift != mmu_psize_defs[get_slice_psize(mm, a)].shift);
+                       ptep = huge_pte_offset(mm, a);
+                       pr_debug(" %016lx: huge ptep %p\n", a, ptep);
+                       if (!ptep || !gup_huge_pte(ptep, hstate, &a, end, write, pages,
+                                                  &nr))
+                               goto slow;
+               } while (a != end);
+       } else
+#endif /* CONFIG_HUGETLB_PAGE */
+       {
+               pgdp = pgd_offset(mm, addr);
+               do {
+                       pgd_t pgd = *pgdp;
+
+                       VM_BUG_ON(shift != mmu_psize_defs[get_slice_psize(mm, addr)].shift);
+                       pr_debug("  %016lx: normal pgd %p\n", addr, (void *)pgd);
+                       next = pgd_addr_end(addr, end);
+                       if (pgd_none(pgd))
+                               goto slow;
+                       if (!gup_pud_range(pgd, addr, next, write, pages, &nr))
+                               goto slow;
+               } while (pgdp++, addr = next, addr != end);
+       }
+       local_irq_enable();
+
+       VM_BUG_ON(nr != (end - start) >> PAGE_SHIFT);
+       return nr;
+
+       {
+               int ret;
+
+slow:
+               local_irq_enable();
+slow_irqon:
+               pr_debug("  slow path ! nr = %d\n", nr);
+
+               /* Try to get the remaining pages with get_user_pages */
+               start += nr << PAGE_SHIFT;
+               pages += nr;
+
+               down_read(&mm->mmap_sem);
+               ret = get_user_pages(current, mm, start,
+                       (end - start) >> PAGE_SHIFT, write, 0, pages, NULL);
+               up_read(&mm->mmap_sem);
+
+               /* Have to be a bit careful with return values */
+               if (nr > 0) {
+                       if (ret < 0)
+                               ret = nr;
+                       else
+                               ret += nr;
+               }
+
+               return ret;
+       }
+}
index 702691c..1c93c25 100644 (file)
@@ -311,7 +311,7 @@ void __init paging_init(void)
 #endif /* CONFIG_HIGHMEM */
 
        printk(KERN_DEBUG "Top of RAM: 0x%llx, Total RAM: 0x%lx\n",
-              (u64)top_of_ram, total_ram);
+              (unsigned long long)top_of_ram, total_ram);
        printk(KERN_DEBUG "Memory hole size: %ldMB\n",
               (long int)((top_of_ram - total_ram) >> 20));
        memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
index c53145f..6aa1208 100644 (file)
@@ -236,8 +236,8 @@ void __init MMU_init_hw(void)
 
        Hash_end = (struct hash_pte *) ((unsigned long)Hash + Hash_size);
 
-       printk("Total memory = %ldMB; using %ldkB for hash table (at %p)\n",
-              total_memory >> 20, Hash_size >> 10, Hash);
+       printk("Total memory = %lldMB; using %ldkB for hash table (at %p)\n",
+              (unsigned long long)(total_memory >> 20), Hash_size >> 10, Hash);
 
 
        /*
index 409fcc7..be7dd42 100644 (file)
@@ -34,7 +34,7 @@
 DEFINE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch);
 
 /* This is declared as we are using the more or less generic
- * include/asm-powerpc/tlb.h file -- tgall
+ * arch/powerpc/include/asm/tlb.h file -- tgall
  */
 DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
 static DEFINE_PER_CPU(struct pte_freelist_batch *, pte_freelist_cur);
index daf0e15..b8a5206 100644 (file)
@@ -1,10 +1,8 @@
 #
 # Makefile for 52xx based boards
 #
-ifeq ($(CONFIG_PPC_MERGE),y)
 obj-y                          += mpc52xx_pic.o mpc52xx_common.o
 obj-$(CONFIG_PCI)              += mpc52xx_pci.o
-endif
 
 obj-$(CONFIG_PPC_MPC5200_SIMPLE) += mpc5200_simple.o
 obj-$(CONFIG_PPC_EFIKA)                += efika.o
@@ -15,4 +13,4 @@ ifeq ($(CONFIG_PPC_LITE5200),y)
        obj-$(CONFIG_PM)        += lite5200_sleep.o lite5200_pm.o
 endif
 
-obj-$(CONFIG_PPC_MPC5200_GPIO) += mpc52xx_gpio.o
\ No newline at end of file
+obj-$(CONFIG_PPC_MPC5200_GPIO) += mpc52xx_gpio.o
index dd4be4a..ec43477 100644 (file)
@@ -105,6 +105,7 @@ static void __init mpc832x_sys_setup_arch(void)
 static struct of_device_id mpc832x_ids[] = {
        { .type = "soc", },
        { .compatible = "soc", },
+       { .compatible = "simple-bus", },
        { .type = "qe", },
        { .compatible = "fsl,qe", },
        {},
index f049d69..0300268 100644 (file)
@@ -115,6 +115,7 @@ static void __init mpc832x_rdb_setup_arch(void)
 static struct of_device_id mpc832x_ids[] = {
        { .type = "soc", },
        { .compatible = "soc", },
+       { .compatible = "simple-bus", },
        { .type = "qe", },
        { .compatible = "fsl,qe", },
        {},
index 7301d77..76092d3 100644 (file)
@@ -41,6 +41,7 @@
 
 static struct of_device_id __initdata mpc834x_itx_ids[] = {
        { .compatible = "fsl,pq2pro-localbus", },
+       { .compatible = "simple-bus", },
        {},
 };
 
index 30d509a..fc3f2ed 100644 (file)
@@ -111,6 +111,7 @@ static void __init mpc834x_mds_init_IRQ(void)
 static struct of_device_id mpc834x_ids[] = {
        { .type = "soc", },
        { .compatible = "soc", },
+       { .compatible = "simple-bus", },
        {},
 };
 
index 75b80e8..9d46e5b 100644 (file)
@@ -136,6 +136,7 @@ static void __init mpc836x_mds_setup_arch(void)
 static struct of_device_id mpc836x_ids[] = {
        { .type = "soc", },
        { .compatible = "soc", },
+       { .compatible = "simple-bus", },
        { .type = "qe", },
        { .compatible = "fsl,qe", },
        {},
index fc21f5c..156c4e2 100644 (file)
@@ -83,6 +83,7 @@ static void __init sbc834x_init_IRQ(void)
 static struct __initdata of_device_id sbc834x_ids[] = {
        { .type = "soc", },
        { .compatible = "soc", },
+       { .compatible = "simple-bus", },
        {},
 };
 
index 2145ade..8a3b117 100644 (file)
@@ -222,6 +222,7 @@ static void ksi8560_show_cpuinfo(struct seq_file *m)
 
 static struct of_device_id __initdata of_bus_ids[] = {
        { .type = "soc", },
+       { .type = "simple-bus", },
        { .name = "cpm", },
        { .name = "localbus", },
        {},
index 6b846aa..1bf5aef 100644 (file)
@@ -91,6 +91,7 @@ static void __init mpc8536_ds_setup_arch(void)
 static struct of_device_id __initdata mpc8536_ds_ids[] = {
        { .type = "soc", },
        { .compatible = "soc", },
+       { .compatible = "simple-bus", },
        {},
 };
 
index ba498d6..d17807a 100644 (file)
@@ -230,6 +230,7 @@ static struct of_device_id __initdata of_bus_ids[] = {
        { .type = "soc", },
        { .name = "cpm", },
        { .name = "localbus", },
+       { .compatible = "simple-bus", },
        {},
 };
 
index 00c5358..483b65c 100644 (file)
@@ -186,6 +186,7 @@ static int __init mpc8544_ds_probe(void)
 static struct of_device_id __initdata mpc85xxds_ids[] = {
        { .type = "soc", },
        { .compatible = "soc", },
+       { .compatible = "simple-bus", },
        {},
 };
 
index 43a459f..2494c51 100644 (file)
@@ -260,6 +260,7 @@ machine_arch_initcall(mpc85xx_mds, board_fixups);
 static struct of_device_id mpc85xx_ids[] = {
        { .type = "soc", },
        { .compatible = "soc", },
+       { .compatible = "simple-bus", },
        { .type = "qe", },
        { .compatible = "fsl,qe", },
        {},
index 2c580cd..6509ade 100644 (file)
@@ -217,6 +217,7 @@ static struct of_device_id __initdata of_bus_ids[] = {
        { .type = "soc", },
        { .name = "cpm", },
        { .name = "localbus", },
+       { .compatible = "simple-bus", },
        {},
 };
 
index 835f2dc..014e26c 100644 (file)
@@ -19,7 +19,7 @@
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include <asm/pci-bridge.h>
-#include <asm-powerpc/mpic.h>
+#include <asm/mpic.h>
 #include <asm/mpc86xx.h>
 #include <asm/cacheflush.h>
 
index 6fc849e..71d7562 100644 (file)
@@ -105,6 +105,16 @@ config 8xx_COPYBACK
 
          If in doubt, say Y here.
 
+config 8xx_GPIO
+       bool "GPIO API Support"
+       select GENERIC_GPIO
+       select ARCH_REQUIRE_GPIOLIB
+       help
+         Saying Y here will cause the ports on an MPC8xx processor to be used
+         with the GPIO API.  If you say N here, the kernel needs less memory.
+
+         If in doubt, say Y here.
+
 config 8xx_CPU6
        bool "CPU6 Silicon Errata (860 Pre Rev. C)"
        help
index 1d09687..4c900ef 100644 (file)
@@ -254,6 +254,8 @@ config CPM2
        select CPM
        select PPC_LIB_RHEAP
        select PPC_PCI_CHOICE
+       select ARCH_REQUIRE_GPIOLIB
+       select GENERIC_GPIO
        help
          The CPM2 (Communications Processor Module) is a coprocessor on
          embedded CPUs made by Freescale.  Selecting this option means that
@@ -281,6 +283,7 @@ config FSL_ULI1575
 
 config CPM
        bool
+       select PPC_CLOCK
 
 config OF_RTC
        bool
index 423a023..8079e0b 100644 (file)
@@ -1,13 +1,7 @@
 
 obj-$(CONFIG_FSL_ULI1575)      += fsl_uli1575.o
 
-ifeq ($(CONFIG_PPC_MERGE),y)
 obj-$(CONFIG_PPC_PMAC)         += powermac/
-else
-ifeq ($(CONFIG_PPC64),y)
-obj-$(CONFIG_PPC_PMAC)         += powermac/
-endif
-endif
 obj-$(CONFIG_PPC_CHRP)         += chrp/
 obj-$(CONFIG_40x)              += 40x/
 obj-$(CONFIG_44x)              += 44x/
index 69288f6..3233fe8 100644 (file)
@@ -96,6 +96,12 @@ static int pmi_notifier(struct notifier_block *nb,
        struct cpufreq_frequency_table *cbe_freqs;
        u8 node;
 
+       /* Should this really be called for CPUFREQ_ADJUST, CPUFREQ_INCOMPATIBLE
+        * and CPUFREQ_NOTIFY policy events?)
+        */
+       if (event == CPUFREQ_START)
+               return 0;
+
        cbe_freqs = cpufreq_frequency_get_table(policy->cpu);
        node = cbe_cpu_to_node(policy->cpu);
 
index ea3e541..45ffd8e 100644 (file)
@@ -7,15 +7,6 @@ config PPC_ISERIES
 menu "iSeries device drivers"
        depends on PPC_ISERIES
 
-config VIOCONS
-       bool "iSeries Virtual Console Support (Obsolete)"
-       depends on !HVC_ISERIES
-       default n
-       help
-         This is the old virtual console driver for legacy iSeries.
-         You should use the iSeries Hypervisor Virtual Console
-         support instead.
-
 config VIODASD
        tristate "iSeries Virtual I/O disk support"
        help
@@ -38,5 +29,5 @@ endmenu
 
 config VIOPATH
        bool
-       depends on VIOCONS || VIODASD || VIOCD || VIOTAPE || ISERIES_VETH
+       depends on VIODASD || VIOCD || VIOTAPE || ISERIES_VETH
        default y
index 8977417..58ecdd7 100644 (file)
@@ -7,7 +7,7 @@ endif
 
 obj-y                          += pic.o setup.o time.o feature.o pci.o \
                                   sleep.o low_i2c.o cache.o pfunc_core.o \
-                                  pfunc_base.o
+                                  pfunc_base.o udbg_scc.o udbg_adb.o
 obj-$(CONFIG_PMAC_BACKLIGHT)   += backlight.o
 obj-$(CONFIG_CPU_FREQ_PMAC)    += cpufreq_32.o
 obj-$(CONFIG_CPU_FREQ_PMAC64)  += cpufreq_64.o
@@ -19,4 +19,3 @@ obj-$(CONFIG_NVRAM:m=y)               += nvram.o
 obj-$(CONFIG_PPC64)            += nvram.o
 obj-$(CONFIG_PPC32)            += bootx_init.o
 obj-$(CONFIG_SMP)              += smp.o
-obj-$(CONFIG_PPC_MERGE)                += udbg_scc.o udbg_adb.o
index 16a0ed2..a90054b 100644 (file)
@@ -25,7 +25,6 @@ obj-$(CONFIG_MV64X60)         += $(mv64x60-y) mv64x60_pic.o mv64x60_dev.o \
 obj-$(CONFIG_RTC_DRV_CMOS)     += rtc_cmos_setup.o
 obj-$(CONFIG_AXON_RAM)         += axonram.o
 
-ifeq ($(CONFIG_PPC_MERGE),y)
 obj-$(CONFIG_PPC_INDIRECT_PCI) += indirect_pci.o
 obj-$(CONFIG_PPC_I8259)                += i8259.o
 obj-$(CONFIG_IPIC)             += ipic.o
@@ -36,7 +35,6 @@ obj-$(CONFIG_OF_RTC)          += of_rtc.o
 ifeq ($(CONFIG_PCI),y)
 obj-$(CONFIG_4xx)              += ppc4xx_pci.o
 endif
-endif
 
 # Temporary hack until we have migrated to asm-powerpc
 ifeq ($(ARCH),powerpc)
index 661df42..4a04823 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/module.h>
+#include <linux/spinlock.h>
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include <asm/8xx_immap.h>
 
 #include <asm/fs_pd.h>
 
+#ifdef CONFIG_8xx_GPIO
+#include <linux/of_gpio.h>
+#endif
+
 #define CPM_MAP_SIZE    (0x4000)
 
 cpm8xx_t __iomem *cpmp;  /* Pointer to comm processor space */
@@ -290,20 +295,24 @@ struct cpm_ioport16 {
        __be16 res[3];
 };
 
-struct cpm_ioport32 {
-       __be32 dir, par, sor;
+struct cpm_ioport32b {
+       __be32 dir, par, odr, dat;
+};
+
+struct cpm_ioport32e {
+       __be32 dir, par, sor, odr, dat;
 };
 
 static void cpm1_set_pin32(int port, int pin, int flags)
 {
-       struct cpm_ioport32 __iomem *iop;
+       struct cpm_ioport32e __iomem *iop;
        pin = 1 << (31 - pin);
 
        if (port == CPM_PORTB)
-               iop = (struct cpm_ioport32 __iomem *)
+               iop = (struct cpm_ioport32e __iomem *)
                      &mpc8xx_immr->im_cpm.cp_pbdir;
        else
-               iop = (struct cpm_ioport32 __iomem *)
+               iop = (struct cpm_ioport32e __iomem *)
                      &mpc8xx_immr->im_cpm.cp_pedir;
 
        if (flags & CPM_PIN_OUTPUT)
@@ -498,3 +507,251 @@ int cpm1_clk_setup(enum cpm_clk_target target, int clock, int mode)
 
        return 0;
 }
+
+/*
+ * GPIO LIB API implementation
+ */
+#ifdef CONFIG_8xx_GPIO
+
+struct cpm1_gpio16_chip {
+       struct of_mm_gpio_chip mm_gc;
+       spinlock_t lock;
+
+       /* shadowed data register to clear/set bits safely */
+       u16 cpdata;
+};
+
+static inline struct cpm1_gpio16_chip *
+to_cpm1_gpio16_chip(struct of_mm_gpio_chip *mm_gc)
+{
+       return container_of(mm_gc, struct cpm1_gpio16_chip, mm_gc);
+}
+
+static void cpm1_gpio16_save_regs(struct of_mm_gpio_chip *mm_gc)
+{
+       struct cpm1_gpio16_chip *cpm1_gc = to_cpm1_gpio16_chip(mm_gc);
+       struct cpm_ioport16 __iomem *iop = mm_gc->regs;
+
+       cpm1_gc->cpdata = in_be16(&iop->dat);
+}
+
+static int cpm1_gpio16_get(struct gpio_chip *gc, unsigned int gpio)
+{
+       struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
+       struct cpm_ioport16 __iomem *iop = mm_gc->regs;
+       u16 pin_mask;
+
+       pin_mask = 1 << (15 - gpio);
+
+       return !!(in_be16(&iop->dat) & pin_mask);
+}
+
+static void cpm1_gpio16_set(struct gpio_chip *gc, unsigned int gpio, int value)
+{
+       struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
+       struct cpm1_gpio16_chip *cpm1_gc = to_cpm1_gpio16_chip(mm_gc);
+       struct cpm_ioport16 __iomem *iop = mm_gc->regs;
+       unsigned long flags;
+       u16 pin_mask = 1 << (15 - gpio);
+
+       spin_lock_irqsave(&cpm1_gc->lock, flags);
+
+       if (value)
+               cpm1_gc->cpdata |= pin_mask;
+       else
+               cpm1_gc->cpdata &= ~pin_mask;
+
+       out_be16(&iop->dat, cpm1_gc->cpdata);
+
+       spin_unlock_irqrestore(&cpm1_gc->lock, flags);
+}
+
+static int cpm1_gpio16_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
+{
+       struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
+       struct cpm_ioport16 __iomem *iop = mm_gc->regs;
+       u16 pin_mask;
+
+       pin_mask = 1 << (15 - gpio);
+
+       setbits16(&iop->dir, pin_mask);
+
+       cpm1_gpio16_set(gc, gpio, val);
+
+       return 0;
+}
+
+static int cpm1_gpio16_dir_in(struct gpio_chip *gc, unsigned int gpio)
+{
+       struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
+       struct cpm_ioport16 __iomem *iop = mm_gc->regs;
+       u16 pin_mask;
+
+       pin_mask = 1 << (15 - gpio);
+
+       clrbits16(&iop->dir, pin_mask);
+
+       return 0;
+}
+
+int cpm1_gpiochip_add16(struct device_node *np)
+{
+       struct cpm1_gpio16_chip *cpm1_gc;
+       struct of_mm_gpio_chip *mm_gc;
+       struct of_gpio_chip *of_gc;
+       struct gpio_chip *gc;
+
+       cpm1_gc = kzalloc(sizeof(*cpm1_gc), GFP_KERNEL);
+       if (!cpm1_gc)
+               return -ENOMEM;
+
+       spin_lock_init(&cpm1_gc->lock);
+
+       mm_gc = &cpm1_gc->mm_gc;
+       of_gc = &mm_gc->of_gc;
+       gc = &of_gc->gc;
+
+       mm_gc->save_regs = cpm1_gpio16_save_regs;
+       of_gc->gpio_cells = 2;
+       gc->ngpio = 16;
+       gc->direction_input = cpm1_gpio16_dir_in;
+       gc->direction_output = cpm1_gpio16_dir_out;
+       gc->get = cpm1_gpio16_get;
+       gc->set = cpm1_gpio16_set;
+
+       return of_mm_gpiochip_add(np, mm_gc);
+}
+
+struct cpm1_gpio32_chip {
+       struct of_mm_gpio_chip mm_gc;
+       spinlock_t lock;
+
+       /* shadowed data register to clear/set bits safely */
+       u32 cpdata;
+};
+
+static inline struct cpm1_gpio32_chip *
+to_cpm1_gpio32_chip(struct of_mm_gpio_chip *mm_gc)
+{
+       return container_of(mm_gc, struct cpm1_gpio32_chip, mm_gc);
+}
+
+static void cpm1_gpio32_save_regs(struct of_mm_gpio_chip *mm_gc)
+{
+       struct cpm1_gpio32_chip *cpm1_gc = to_cpm1_gpio32_chip(mm_gc);
+       struct cpm_ioport32b __iomem *iop = mm_gc->regs;
+
+       cpm1_gc->cpdata = in_be32(&iop->dat);
+}
+
+static int cpm1_gpio32_get(struct gpio_chip *gc, unsigned int gpio)
+{
+       struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
+       struct cpm_ioport32b __iomem *iop = mm_gc->regs;
+       u32 pin_mask;
+
+       pin_mask = 1 << (31 - gpio);
+
+       return !!(in_be32(&iop->dat) & pin_mask);
+}
+
+static void cpm1_gpio32_set(struct gpio_chip *gc, unsigned int gpio, int value)
+{
+       struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
+       struct cpm1_gpio32_chip *cpm1_gc = to_cpm1_gpio32_chip(mm_gc);
+       struct cpm_ioport32b __iomem *iop = mm_gc->regs;
+       unsigned long flags;
+       u32 pin_mask = 1 << (31 - gpio);
+
+       spin_lock_irqsave(&cpm1_gc->lock, flags);
+
+       if (value)
+               cpm1_gc->cpdata |= pin_mask;
+       else
+               cpm1_gc->cpdata &= ~pin_mask;
+
+       out_be32(&iop->dat, cpm1_gc->cpdata);
+
+       spin_unlock_irqrestore(&cpm1_gc->lock, flags);
+}
+
+static int cpm1_gpio32_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
+{
+       struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
+       struct cpm_ioport32b __iomem *iop = mm_gc->regs;
+       u32 pin_mask;
+
+       pin_mask = 1 << (31 - gpio);
+
+       setbits32(&iop->dir, pin_mask);
+
+       cpm1_gpio32_set(gc, gpio, val);
+
+       return 0;
+}
+
+static int cpm1_gpio32_dir_in(struct gpio_chip *gc, unsigned int gpio)
+{
+       struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
+       struct cpm_ioport32b __iomem *iop = mm_gc->regs;
+       u32 pin_mask;
+
+       pin_mask = 1 << (31 - gpio);
+
+       clrbits32(&iop->dir, pin_mask);
+
+       return 0;
+}
+
+int cpm1_gpiochip_add32(struct device_node *np)
+{
+       struct cpm1_gpio32_chip *cpm1_gc;
+       struct of_mm_gpio_chip *mm_gc;
+       struct of_gpio_chip *of_gc;
+       struct gpio_chip *gc;
+
+       cpm1_gc = kzalloc(sizeof(*cpm1_gc), GFP_KERNEL);
+       if (!cpm1_gc)
+               return -ENOMEM;
+
+       spin_lock_init(&cpm1_gc->lock);
+
+       mm_gc = &cpm1_gc->mm_gc;
+       of_gc = &mm_gc->of_gc;
+       gc = &of_gc->gc;
+
+       mm_gc->save_regs = cpm1_gpio32_save_regs;
+       of_gc->gpio_cells = 2;
+       gc->ngpio = 32;
+       gc->direction_input = cpm1_gpio32_dir_in;
+       gc->direction_output = cpm1_gpio32_dir_out;
+       gc->get = cpm1_gpio32_get;
+       gc->set = cpm1_gpio32_set;
+
+       return of_mm_gpiochip_add(np, mm_gc);
+}
+
+static int cpm_init_par_io(void)
+{
+       struct device_node *np;
+
+       for_each_compatible_node(np, NULL, "fsl,cpm1-pario-bank-a")
+               cpm1_gpiochip_add16(np);
+
+       for_each_compatible_node(np, NULL, "fsl,cpm1-pario-bank-b")
+               cpm1_gpiochip_add32(np);
+
+       for_each_compatible_node(np, NULL, "fsl,cpm1-pario-bank-c")
+               cpm1_gpiochip_add16(np);
+
+       for_each_compatible_node(np, NULL, "fsl,cpm1-pario-bank-d")
+               cpm1_gpiochip_add16(np);
+
+       /* Port E uses CPM2 layout */
+       for_each_compatible_node(np, NULL, "fsl,cpm1-pario-bank-e")
+               cpm2_gpiochip_add32(np);
+       return 0;
+}
+arch_initcall(cpm_init_par_io);
+
+#endif /* CONFIG_8xx_GPIO */
index 5a6c5df..f1c3395 100644 (file)
@@ -115,16 +115,10 @@ EXPORT_SYMBOL(cpm_command);
  * Baud rate clocks are zero-based in the driver code (as that maps
  * to port numbers).  Documentation uses 1-based numbering.
  */
-#define BRG_INT_CLK    (get_brgfreq())
-#define BRG_UART_CLK   (BRG_INT_CLK/16)
-
-/* This function is used by UARTS, or anything else that uses a 16x
- * oversampled clock.
- */
-void
-cpm_setbrg(uint brg, uint rate)
+void __cpm2_setbrg(uint brg, uint rate, uint clk, int div16, int src)
 {
        u32 __iomem *bp;
+       u32 val;
 
        /* This is good enough to get SMCs running.....
        */
@@ -135,34 +129,14 @@ cpm_setbrg(uint brg, uint rate)
                brg -= 4;
        }
        bp += brg;
-       out_be32(bp, (((BRG_UART_CLK / rate) - 1) << 1) | CPM_BRG_EN);
-
-       cpm2_unmap(bp);
-}
-
-/* This function is used to set high speed synchronous baud rate
- * clocks.
- */
-void
-cpm2_fastbrg(uint brg, uint rate, int div16)
-{
-       u32 __iomem *bp;
-       u32 val;
-
-       if (brg < 4) {
-               bp = cpm2_map_size(im_brgc1, 16);
-       } else {
-               bp = cpm2_map_size(im_brgc5, 16);
-               brg -= 4;
-       }
-       bp += brg;
-       val = ((BRG_INT_CLK / rate) << 1) | CPM_BRG_EN;
+       val = (((clk / rate) - 1) << 1) | CPM_BRG_EN | src;
        if (div16)
                val |= CPM_BRG_DIV16;
 
        out_be32(bp, val);
        cpm2_unmap(bp);
 }
+EXPORT_SYMBOL(__cpm2_setbrg);
 
 int cpm2_clk_setup(enum cpm_clk_target target, int clock, int mode)
 {
@@ -377,3 +351,14 @@ void cpm2_set_pin(int port, int pin, int flags)
        else
                clrbits32(&iop[port].odr, pin);
 }
+
+static int cpm_init_par_io(void)
+{
+       struct device_node *np;
+
+       for_each_compatible_node(np, NULL, "fsl,cpm2-pario-bank")
+               cpm2_gpiochip_add32(np);
+       return 0;
+}
+arch_initcall(cpm_init_par_io);
+
index e4b7296..53da8a0 100644 (file)
@@ -19,6 +19,8 @@
 
 #include <linux/init.h>
 #include <linux/of_device.h>
+#include <linux/spinlock.h>
+#include <linux/of.h>
 
 #include <asm/udbg.h>
 #include <asm/io.h>
 
 #include <mm/mmu_decl.h>
 
+#if defined(CONFIG_CPM2) || defined(CONFIG_8xx_GPIO)
+#include <linux/of_gpio.h>
+#endif
+
 #ifdef CONFIG_PPC_EARLY_DEBUG_CPM
 static u32 __iomem *cpm_udbg_txdesc =
        (u32 __iomem __force *)CONFIG_PPC_EARLY_DEBUG_CPM_ADDR;
@@ -207,3 +213,120 @@ dma_addr_t cpm_muram_dma(void __iomem *addr)
        return muram_pbase + ((u8 __iomem *)addr - muram_vbase);
 }
 EXPORT_SYMBOL(cpm_muram_dma);
+
+#if defined(CONFIG_CPM2) || defined(CONFIG_8xx_GPIO)
+
+struct cpm2_ioports {
+       u32 dir, par, sor, odr, dat;
+       u32 res[3];
+};
+
+struct cpm2_gpio32_chip {
+       struct of_mm_gpio_chip mm_gc;
+       spinlock_t lock;
+
+       /* shadowed data register to clear/set bits safely */
+       u32 cpdata;
+};
+
+static inline struct cpm2_gpio32_chip *
+to_cpm2_gpio32_chip(struct of_mm_gpio_chip *mm_gc)
+{
+       return container_of(mm_gc, struct cpm2_gpio32_chip, mm_gc);
+}
+
+static void cpm2_gpio32_save_regs(struct of_mm_gpio_chip *mm_gc)
+{
+       struct cpm2_gpio32_chip *cpm2_gc = to_cpm2_gpio32_chip(mm_gc);
+       struct cpm2_ioports __iomem *iop = mm_gc->regs;
+
+       cpm2_gc->cpdata = in_be32(&iop->dat);
+}
+
+static int cpm2_gpio32_get(struct gpio_chip *gc, unsigned int gpio)
+{
+       struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
+       struct cpm2_ioports __iomem *iop = mm_gc->regs;
+       u32 pin_mask;
+
+       pin_mask = 1 << (31 - gpio);
+
+       return !!(in_be32(&iop->dat) & pin_mask);
+}
+
+static void cpm2_gpio32_set(struct gpio_chip *gc, unsigned int gpio, int value)
+{
+       struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
+       struct cpm2_gpio32_chip *cpm2_gc = to_cpm2_gpio32_chip(mm_gc);
+       struct cpm2_ioports __iomem *iop = mm_gc->regs;
+       unsigned long flags;
+       u32 pin_mask = 1 << (31 - gpio);
+
+       spin_lock_irqsave(&cpm2_gc->lock, flags);
+
+       if (value)
+               cpm2_gc->cpdata |= pin_mask;
+       else
+               cpm2_gc->cpdata &= ~pin_mask;
+
+       out_be32(&iop->dat, cpm2_gc->cpdata);
+
+       spin_unlock_irqrestore(&cpm2_gc->lock, flags);
+}
+
+static int cpm2_gpio32_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
+{
+       struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
+       struct cpm2_ioports __iomem *iop = mm_gc->regs;
+       u32 pin_mask;
+
+       pin_mask = 1 << (31 - gpio);
+
+       setbits32(&iop->dir, pin_mask);
+
+       cpm2_gpio32_set(gc, gpio, val);
+
+       return 0;
+}
+
+static int cpm2_gpio32_dir_in(struct gpio_chip *gc, unsigned int gpio)
+{
+       struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
+       struct cpm2_ioports __iomem *iop = mm_gc->regs;
+       u32 pin_mask;
+
+       pin_mask = 1 << (31 - gpio);
+
+       clrbits32(&iop->dir, pin_mask);
+
+       return 0;
+}
+
+int cpm2_gpiochip_add32(struct device_node *np)
+{
+       struct cpm2_gpio32_chip *cpm2_gc;
+       struct of_mm_gpio_chip *mm_gc;
+       struct of_gpio_chip *of_gc;
+       struct gpio_chip *gc;
+
+       cpm2_gc = kzalloc(sizeof(*cpm2_gc), GFP_KERNEL);
+       if (!cpm2_gc)
+               return -ENOMEM;
+
+       spin_lock_init(&cpm2_gc->lock);
+
+       mm_gc = &cpm2_gc->mm_gc;
+       of_gc = &mm_gc->of_gc;
+       gc = &of_gc->gc;
+
+       mm_gc->save_regs = cpm2_gpio32_save_regs;
+       of_gc->gpio_cells = 2;
+       gc->ngpio = 32;
+       gc->direction_input = cpm2_gpio32_dir_in;
+       gc->direction_output = cpm2_gpio32_dir_out;
+       gc->get = cpm2_gpio32_get;
+       gc->set = cpm2_gpio32_set;
+
+       return of_mm_gpiochip_add(np, mm_gc);
+}
+#endif /* CONFIG_CPM2 || CONFIG_8xx_GPIO */
index c09ddc0..c1879eb 100644 (file)
@@ -21,6 +21,7 @@ static int  __init add_rtc(void)
        struct device_node *np;
        struct platform_device *pd;
        struct resource res[2];
+       unsigned int num_res = 1;
        int ret;
 
        memset(&res, 0, sizeof(res));
@@ -41,14 +42,24 @@ static int  __init add_rtc(void)
        if (res[0].start != RTC_PORT(0))
                return -EINVAL;
 
-       /* Use a fixed interrupt value of 8 since on PPC if we are using this
-        * its off an i8259 which we ensure has interrupt numbers 0..15. */
-       res[1].start = 8;
-       res[1].end = 8;
-       res[1].flags = IORESOURCE_IRQ;
+       np = of_find_compatible_node(NULL, NULL, "chrp,iic");
+       if (!np)
+               np = of_find_compatible_node(NULL, NULL, "pnpPNP,000");
+       if (np) {
+               of_node_put(np);
+               /*
+                * Use a fixed interrupt value of 8 since on PPC if we are
+                * using this its off an i8259 which we ensure has interrupt
+                * numbers 0..15.
+                */
+               res[1].start = 8;
+               res[1].end = 8;
+               res[1].flags = IORESOURCE_IRQ;
+               num_res++;
+       }
 
        pd = platform_device_register_simple("rtc_cmos", -1,
-                                            &res[0], 2);
+                                            &res[0], num_res);
 
        if (IS_ERR(pd))
                return PTR_ERR(pd);
index 2ed8812..8d41908 100644 (file)
@@ -317,6 +317,9 @@ config ARCH_ENABLE_MEMORY_HOTPLUG
        def_bool y
        depends on SPARSEMEM
 
+config ARCH_ENABLE_MEMORY_HOTREMOVE
+       def_bool y
+
 source "mm/Kconfig"
 
 comment "I/O subsystem configuration"
similarity index 76%
rename from include/asm-s390/hardirq.h
rename to arch/s390/include/asm/hardirq.h
index 4b7cb96..89ec705 100644 (file)
@@ -34,4 +34,18 @@ typedef struct {
 
 void clock_comparator_work(void);
 
+static inline unsigned long long local_tick_disable(void)
+{
+       unsigned long long old;
+
+       old = S390_lowcore.clock_comparator;
+       S390_lowcore.clock_comparator = -1ULL;
+       return old;
+}
+
+static inline void local_tick_enable(unsigned long long comp)
+{
+       S390_lowcore.clock_comparator = comp;
+}
+
 #endif /* __ASM_HARDIRQ_H */
similarity index 98%
rename from include/asm-s390/ipl.h
rename to arch/s390/include/asm/ipl.h
index eaca6df..1171e6d 100644 (file)
@@ -159,7 +159,8 @@ enum diag308_vm_flags {
 };
 
 enum diag308_rc {
-       DIAG308_RC_OK   = 1,
+       DIAG308_RC_OK           = 0x0001,
+       DIAG308_RC_NOCONFIG     = 0x0102,
 };
 
 extern int diag308(unsigned long subcode, void *addr);
similarity index 96%
rename from include/asm-s390/schid.h
rename to arch/s390/include/asm/schid.h
index 7bdc0fe..825503c 100644 (file)
@@ -11,6 +11,7 @@ struct subchannel_id {
 } __attribute__ ((packed, aligned(4)));
 
 #ifdef __KERNEL__
+#include <linux/string.h>
 
 /* Helper function for sane state of pre-allocated subchannel_id. */
 static inline void
similarity index 99%
rename from include/asm-s390/setup.h
rename to arch/s390/include/asm/setup.h
index 4ba14e4..2bd9fae 100644 (file)
@@ -65,7 +65,6 @@ extern unsigned long machine_flags;
 
 #define MACHINE_FLAG_VM                (1UL << 0)
 #define MACHINE_FLAG_IEEE      (1UL << 1)
-#define MACHINE_FLAG_P390      (1UL << 2)
 #define MACHINE_FLAG_CSP       (1UL << 3)
 #define MACHINE_FLAG_MVPG      (1UL << 4)
 #define MACHINE_FLAG_DIAG44    (1UL << 5)
similarity index 98%
rename from include/asm-s390/unistd.h
rename to arch/s390/include/asm/unistd.h
index 583da80..c8ad350 100644 (file)
 #define __NR_timerfd_create    319
 #define __NR_timerfd_settime   320
 #define __NR_timerfd_gettime   321
-#define NR_syscalls 322
+#define __NR_signalfd4         322
+#define __NR_eventfd2          323
+#define __NR_inotify_init1     324
+#define __NR_pipe2             325
+#define __NR_dup3              326
+#define __NR_epoll_create1     327
+#define NR_syscalls 328
 
 /* 
  * There are some system calls that are not present on 64 bit, some
index d003a6e..328a20e 100644 (file)
@@ -1732,3 +1732,40 @@ compat_sys_timerfd_gettime_wrapper:
        lgfr    %r2,%r2                 # int
        llgtr   %r3,%r3                 # struct compat_itimerspec *
        jg      compat_sys_timerfd_gettime
+
+       .globl compat_sys_signalfd4_wrapper
+compat_sys_signalfd4_wrapper:
+       lgfr    %r2,%r2                 # int
+       llgtr   %r3,%r3                 # compat_sigset_t *
+       llgfr   %r4,%r4                 # compat_size_t
+       lgfr    %r5,%r5                 # int
+       jg      compat_sys_signalfd4
+
+       .globl sys_eventfd2_wrapper
+sys_eventfd2_wrapper:
+       llgfr   %r2,%r2                 # unsigned int
+       lgfr    %r3,%r3                 # int
+       jg      sys_eventfd2
+
+       .globl  sys_inotify_init1_wrapper
+sys_inotify_init1_wrapper:
+       lgfr    %r2,%r2                 # int
+       jg      sys_inotify_init1
+
+       .globl  sys_pipe2_wrapper
+sys_pipe2_wrapper:
+       llgtr   %r2,%r2                 # u32 *
+       lgfr    %r3,%r3                 # int
+       jg      sys_pipe2               # branch to system call
+
+       .globl  sys_dup3_wrapper
+sys_dup3_wrapper:
+       llgfr   %r2,%r2                 # unsigned int
+       llgfr   %r3,%r3                 # unsigned int
+       lgfr    %r4,%r4                 # int
+       jg      sys_dup3                # branch to system call
+
+       .globl  sys_epoll_create1_wrapper
+sys_epoll_create1_wrapper:
+       lgfr    %r2,%r2                 # int
+       jg      sys_epoll_create1       # branch to system call
index 54b2779..2dcf590 100644 (file)
@@ -1705,7 +1705,10 @@ void __init setup_ipl(void)
 
 void __init ipl_update_parameters(void)
 {
-       if (diag308(DIAG308_STORE, &ipl_block) == DIAG308_RC_OK)
+       int rc;
+
+       rc = diag308(DIAG308_STORE, &ipl_block);
+       if ((rc == DIAG308_RC_OK) || (rc == DIAG308_RC_NOCONFIG))
                diag308_set_works = 1;
 }
 
index 18ed7ab..9872999 100644 (file)
@@ -9,27 +9,6 @@
 #include <asm/sclp.h>
 #include <asm/setup.h>
 
-static int memory_fast_detect(struct mem_chunk *chunk)
-{
-       unsigned long val0 = 0;
-       unsigned long val1 = 0xc;
-       int rc = -EOPNOTSUPP;
-
-       if (ipl_flags & IPL_NSS_VALID)
-               return -EOPNOTSUPP;
-       asm volatile(
-               "       diag    %1,%2,0x260\n"
-               "0:     lhi     %0,0\n"
-               "1:\n"
-               EX_TABLE(0b,1b)
-               : "+d" (rc), "+d" (val0), "+d" (val1) : : "cc");
-
-       if (rc || val0 != val1)
-               return -EOPNOTSUPP;
-       chunk->size = val0 + 1;
-       return 0;
-}
-
 static inline int tprot(unsigned long addr)
 {
        int rc = -EFAULT;
@@ -84,8 +63,6 @@ void detect_memory_layout(struct mem_chunk chunk[])
        unsigned long flags, cr0;
 
        memset(chunk, 0, MEMORY_CHUNKS * sizeof(struct mem_chunk));
-       if (memory_fast_detect(&chunk[0]) == 0)
-               return;
        /* Disable IRQs, DAT and low address protection so tprot does the
         * right thing and we don't get scheduled away with low address
         * protection disabled.
index c87ec68..c66d35e 100644 (file)
@@ -330,3 +330,9 @@ SYSCALL(sys_eventfd,sys_eventfd,sys_eventfd_wrapper)
 SYSCALL(sys_timerfd_create,sys_timerfd_create,sys_timerfd_create_wrapper)
 SYSCALL(sys_timerfd_settime,sys_timerfd_settime,compat_sys_timerfd_settime_wrapper) /* 320 */
 SYSCALL(sys_timerfd_gettime,sys_timerfd_gettime,compat_sys_timerfd_gettime_wrapper)
+SYSCALL(sys_signalfd4,sys_signalfd4,compat_sys_signalfd4_wrapper)
+SYSCALL(sys_eventfd2,sys_eventfd2,sys_eventfd2_wrapper)
+SYSCALL(sys_inotify_init1,sys_inotify_init1,sys_inotify_init1_wrapper)
+SYSCALL(sys_pipe2,sys_pipe2,sys_pipe2_wrapper) /* 325 */
+SYSCALL(sys_dup3,sys_dup3,sys_dup3_wrapper)
+SYSCALL(sys_epoll_create1,sys_epoll_create1,sys_epoll_create1_wrapper)
index ab70d9b..ca114fe 100644 (file)
@@ -1348,7 +1348,7 @@ early_param("stp", early_parse_stp);
 /*
  * Reset STP attachment.
  */
-static void stp_reset(void)
+static void __init stp_reset(void)
 {
        int rc;
 
index 2e2d2ff..d1faf5c 100644 (file)
@@ -158,6 +158,7 @@ static int handle_stfl(struct kvm_vcpu *vcpu)
 
        vcpu->stat.instruction_stfl++;
        facility_list &= ~(1UL<<24); /* no stfle */
+       facility_list &= ~(1UL<<23); /* no large pages */
 
        rc = copy_to_guest(vcpu, offsetof(struct _lowcore, stfl_fac_list),
                           &facility_list, sizeof(facility_list));
index eae21a8..fc6ab60 100644 (file)
@@ -43,7 +43,7 @@ void __udelay(unsigned long usecs)
                local_bh_disable();
        local_irq_save(flags);
        if (raw_irqs_disabled_flags(flags)) {
-               old_cc = S390_lowcore.clock_comparator;
+               old_cc = local_tick_disable();
                S390_lowcore.clock_comparator = -1ULL;
                __ctl_store(cr0, 0, 0);
                dummy = (cr0 & 0xffff00e0) | 0x00000800;
@@ -65,7 +65,7 @@ void __udelay(unsigned long usecs)
 
        if (raw_irqs_disabled_flags(flags)) {
                __ctl_load(cr0, 0, 0);
-               S390_lowcore.clock_comparator = old_cc;
+               local_tick_enable(old_cc);
        }
        if (!irq_context)
                _local_bh_enable();
index 4993b0f..1169130 100644 (file)
@@ -179,7 +179,7 @@ int arch_add_memory(int nid, u64 start, u64 size)
        int rc;
 
        pgdat = NODE_DATA(nid);
-       zone = pgdat->node_zones + ZONE_NORMAL;
+       zone = pgdat->node_zones + ZONE_MOVABLE;
        rc = vmem_add_mapping(start, size);
        if (rc)
                return rc;
@@ -189,3 +189,14 @@ int arch_add_memory(int nid, u64 start, u64 size)
        return rc;
 }
 #endif /* CONFIG_MEMORY_HOTPLUG */
+
+#ifdef CONFIG_MEMORY_HOTREMOVE
+int remove_memory(u64 start, u64 size)
+{
+       unsigned long start_pfn, end_pfn;
+
+       start_pfn = PFN_DOWN(start);
+       end_pfn = start_pfn + PFN_DOWN(size);
+       return offline_pages(start_pfn, end_pfn, 120 * HZ);
+}
+#endif /* CONFIG_MEMORY_HOTREMOVE */
index 0b88dc4..5131d50 100644 (file)
@@ -24,6 +24,11 @@ config SUPERH32
 config SUPERH64
        def_bool y if CPU_SH5
 
+config ARCH_DEFCONFIG
+       string
+       default "arch/sh/configs/shx3_defconfig" if SUPERH32
+       default "arch/sh/configs/cayman_defconfig" if SUPERH64
+
 config RWSEM_GENERIC_SPINLOCK
        def_bool y
 
@@ -43,6 +48,9 @@ config GENERIC_HWEIGHT
 config GENERIC_HARDIRQS
        def_bool y
 
+config GENERIC_HARDIRQS_NO__DO_IRQ
+       def_bool y
+
 config GENERIC_IRQ_PROBE
        def_bool y
 
@@ -58,6 +66,10 @@ config GENERIC_TIME
 config GENERIC_CLOCKEVENTS
        def_bool n
 
+config GENERIC_LOCKBREAK
+       def_bool y
+       depends on SMP && PREEMPT
+
 config SYS_SUPPORTS_PM
        bool
 
@@ -89,9 +101,6 @@ config ARCH_HAS_ILOG2_U64
 config ARCH_NO_VIRT_TO_BUS
        def_bool y
 
-config ARCH_SUPPORTS_AOUT
-       def_bool y
-
 config IO_TRAPPED
        bool
 
@@ -348,253 +357,10 @@ config CPU_SUBTYPE_SH5_103
 endchoice
 
 source "arch/sh/mm/Kconfig"
 source "arch/sh/Kconfig.cpu"
 
-menu "Board support"
-
-config SOLUTION_ENGINE
-       bool
-
-config SH_SOLUTION_ENGINE
-       bool "SolutionEngine"
-       select SOLUTION_ENGINE
-       select CPU_HAS_IPR_IRQ
-       depends on CPU_SUBTYPE_SH7705 || CPU_SUBTYPE_SH7709 || CPU_SUBTYPE_SH7710 || \
-         CPU_SUBTYPE_SH7712 || CPU_SUBTYPE_SH7750 || CPU_SUBTYPE_SH7750S || \
-         CPU_SUBTYPE_SH7750R 
-       help
-         Select SolutionEngine if configuring for a Hitachi SH7705, SH7709,
-         SH7710, SH7712, SH7750, SH7750S or SH7750R evaluation board.
-
-config SH_7206_SOLUTION_ENGINE
-       bool "SolutionEngine7206"
-       select SOLUTION_ENGINE
-       depends on CPU_SUBTYPE_SH7206
-       help
-         Select 7206 SolutionEngine if configuring for a Hitachi SH7206
-         evaluation board.
-
-config SH_7619_SOLUTION_ENGINE
-       bool "SolutionEngine7619"
-       select SOLUTION_ENGINE
-       depends on CPU_SUBTYPE_SH7619
-       help
-         Select 7619 SolutionEngine if configuring for a Hitachi SH7619
-         evaluation board.
-       
-config SH_7721_SOLUTION_ENGINE
-       bool "SolutionEngine7721"
-       select SOLUTION_ENGINE
-       depends on CPU_SUBTYPE_SH7721
-       help
-         Select 7721 SolutionEngine if configuring for a Hitachi SH7721
-         evaluation board.
-
-config SH_7722_SOLUTION_ENGINE
-       bool "SolutionEngine7722"
-       select SOLUTION_ENGINE
-       depends on CPU_SUBTYPE_SH7722
-       help
-         Select 7722 SolutionEngine if configuring for a Hitachi SH772
-         evaluation board.
-
-config SH_7751_SOLUTION_ENGINE
-       bool "SolutionEngine7751"
-       select SOLUTION_ENGINE
-       select CPU_HAS_IPR_IRQ
-       depends on CPU_SUBTYPE_SH7751
-       help
-         Select 7751 SolutionEngine if configuring for a Hitachi SH7751
-         evaluation board.
-         
-config SH_7780_SOLUTION_ENGINE
-       bool "SolutionEngine7780"
-       select SOLUTION_ENGINE
-       select SYS_SUPPORTS_PCI
-       depends on CPU_SUBTYPE_SH7780
-       help
-         Select 7780 SolutionEngine if configuring for a Renesas SH7780
-         evaluation board.
-
-config SH_7343_SOLUTION_ENGINE
-       bool "SolutionEngine7343"
-       select SOLUTION_ENGINE
-       depends on CPU_SUBTYPE_SH7343
-       help
-         Select 7343 SolutionEngine if configuring for a Hitachi
-         SH7343 (SH-Mobile 3AS) evaluation board.
-
-config SH_7751_SYSTEMH
-       bool "SystemH7751R"
-       depends on CPU_SUBTYPE_SH7751R
-       help
-         Select SystemH if you are configuring for a Renesas SystemH
-         7751R evaluation board.
-
-config SH_HP6XX
-       bool "HP6XX"
-       select SYS_SUPPORTS_APM_EMULATION
-       select HD6446X_SERIES
-       depends on CPU_SUBTYPE_SH7709
-       help
-         Select HP6XX if configuring for a HP jornada HP6xx.
-         More information (hardware only) at
-         <http://www.hp.com/jornada/>.
-
-config SH_DREAMCAST
-       bool "Dreamcast"
-       select SYS_SUPPORTS_PCI
-       depends on CPU_SUBTYPE_SH7091
-       help
-         Select Dreamcast if configuring for a SEGA Dreamcast.
-         More information at <http://www.linux-sh.org>
-
-config SH_SH03
-       bool "Interface CTP/PCI-SH03"
-       depends on CPU_SUBTYPE_SH7751
-       select CPU_HAS_IPR_IRQ
-       select SYS_SUPPORTS_PCI
-       help
-         CTP/PCI-SH03 is a CPU module computer that is produced
-         by Interface Corporation.
-         More information at <http://www.interface.co.jp>
-
-config SH_SECUREEDGE5410
-       bool "SecureEdge5410"
-       depends on CPU_SUBTYPE_SH7751R
-       select CPU_HAS_IPR_IRQ
-       select SYS_SUPPORTS_PCI
-       help
-         Select SecureEdge5410 if configuring for a SnapGear SH board.
-         This includes both the OEM SecureEdge products as well as the
-         SME product line.
-
-config SH_RTS7751R2D
-       bool "RTS7751R2D"
-       depends on CPU_SUBTYPE_SH7751R
-       select SYS_SUPPORTS_PCI
-       select IO_TRAPPED
-       help
-         Select RTS7751R2D if configuring for a Renesas Technology
-         Sales SH-Graphics board.
-
-config SH_RSK7203
-       bool "RSK7203"
-       depends on CPU_SUBTYPE_SH7203
-
-config SH_SDK7780
-       bool "SDK7780R3"
-       depends on CPU_SUBTYPE_SH7780
-       select SYS_SUPPORTS_PCI
-       help
-         Select SDK7780 if configuring for a Renesas SH7780 SDK7780R3
-         evaluation board.
-
-config SH_HIGHLANDER
-       bool "Highlander"
-       depends on CPU_SUBTYPE_SH7780 || CPU_SUBTYPE_SH7785
-       select SYS_SUPPORTS_PCI
-       select IO_TRAPPED
-
-config SH_SH7785LCR
-       bool "SH7785LCR"
-       depends on CPU_SUBTYPE_SH7785
-       select SYS_SUPPORTS_PCI
-       select IO_TRAPPED
-
-config SH_SH7785LCR_29BIT_PHYSMAPS
-       bool "SH7785LCR 29bit physmaps"
-       depends on SH_SH7785LCR
-       default y
-       help
-         This board has 2 physical memory maps. It can be changed with
-         DIP switch(S2-5). If you set the DIP switch for S2-5 = ON,
-         you can access all on-board device in 29bit address mode.
-
-config SH_MIGOR
-       bool "Migo-R"
-       depends on CPU_SUBTYPE_SH7722
-       help
-         Select Migo-R if configuring for the SH7722 Migo-R platform
-          by Renesas System Solutions Asia Pte. Ltd.
-
-config SH_AP325RXA
-       bool "AP-325RXA"
-       depends on CPU_SUBTYPE_SH7723
-       help
-         Renesas "AP-325RXA" support.
-         Compatible with ALGO SYSTEM CO.,LTD. "AP-320A"
-
-config SH_SH7763RDP
-       bool "SH7763RDP"
-       depends on CPU_SUBTYPE_SH7763
-       help
-         Select SH7763RDP if configuring for a Renesas SH7763
-         evaluation board.
-
-config SH_EDOSK7705
-       bool "EDOSK7705"
-       depends on CPU_SUBTYPE_SH7705
-
-config SH_SH4202_MICRODEV
-       bool "SH4-202 MicroDev"
-       depends on CPU_SUBTYPE_SH4_202
-       help
-         Select SH4-202 MicroDev if configuring for a SuperH MicroDev board
-         with an SH4-202 CPU.
-
-config SH_LANDISK
-       bool "LANDISK"
-       depends on CPU_SUBTYPE_SH7751R
-       select SYS_SUPPORTS_PCI
-       help
-         I-O DATA DEVICE, INC. "LANDISK Series" support.
-
-config SH_TITAN
-       bool "TITAN"
-       depends on CPU_SUBTYPE_SH7751R
-       select CPU_HAS_IPR_IRQ
-       select SYS_SUPPORTS_PCI
-       help
-         Select Titan if you are configuring for a Nimble Microsystems
-         NetEngine NP51R.
-
-config SH_SHMIN
-       bool "SHMIN"
-       depends on CPU_SUBTYPE_SH7706
-       select CPU_HAS_IPR_IRQ
-       help
-         Select SHMIN if configuring for the SHMIN board.
-
-config SH_LBOX_RE2
-       bool "L-BOX RE2"
-       depends on CPU_SUBTYPE_SH7751R
-       select SYS_SUPPORTS_PCI
-       help
-         Select L-BOX RE2 if configuring for the NTT COMWARE L-BOX RE2.
-
-config SH_X3PROTO
-       bool "SH-X3 Prototype board"
-       depends on CPU_SUBTYPE_SHX3
-
-config SH_MAGIC_PANEL_R2
-       bool "Magic Panel R2"
-       depends on CPU_SUBTYPE_SH7720
-       help
-         Select Magic Panel R2 if configuring for Magic Panel R2.
-
-config SH_CAYMAN
-       bool "Hitachi Cayman"
-       depends on CPU_SUBTYPE_SH5_101 || CPU_SUBTYPE_SH5_103
-       select SYS_SUPPORTS_PCI
-
-endmenu
-
-source "arch/sh/boards/renesas/rts7751r2d/Kconfig"
-source "arch/sh/boards/renesas/r7780rp/Kconfig"
-source "arch/sh/boards/renesas/sdk7780/Kconfig"
-source "arch/sh/boards/renesas/migor/Kconfig"
-source "arch/sh/boards/magicpanelr2/Kconfig"
+source "arch/sh/boards/Kconfig"
 
 menu "Timer and clock configuration"
 
@@ -721,6 +487,23 @@ config CRASH_DUMP
 
          For more details see Documentation/kdump/kdump.txt
 
+config SECCOMP
+       bool "Enable seccomp to safely compute untrusted bytecode"
+       depends on PROC_FS
+       default y
+       help
+         This kernel feature is useful for number crunching applications
+         that may need to compute untrusted bytecode during their
+         execution. By using pipes or other transports made available to
+         the process as file descriptors supporting the read/write
+         syscalls, it's possible to isolate those applications in
+         their own address space using seccomp. Once seccomp is
+         enabled via prctl, it cannot be disabled and the task is only
+         allowed to execute a few safe syscalls defined by each seccomp
+         mode.
+
+         If unsure, say N.
+
 config SMP
        bool "Symmetric multi-processing support"
        depends on SYS_SUPPORTS_SMP
index 36f4b1f..4d2d102 100644 (file)
@@ -182,7 +182,7 @@ if SUPERH64
 
 config SH64_PROC_ASIDS
        bool "Debug: report ASIDs through /proc/asids"
-       depends on PROC_FS
+       depends on PROC_FS && MMU
 
 config SH64_SR_WATCH
        bool "Debug: set SR.WATCH to enable hardware watchpoints and trace"
index c627e45..01d85c7 100644 (file)
@@ -68,7 +68,7 @@ OBJCOPYFLAGS  := -O binary -R .note -R .note.gnu.build-id -R .comment \
 defaultimage-$(CONFIG_SUPERH32)        := zImage
 
 # Set some sensible Kbuild defaults
-KBUILD_DEFCONFIG       := r7780mp_defconfig
+KBUILD_DEFCONFIG       := shx3_defconfig
 KBUILD_IMAGE           := $(defaultimage-y)
 
 #
@@ -91,51 +91,32 @@ LDFLAGS_vmlinux             += --defsym 'jiffies=jiffies_64+4'
 LDFLAGS                        += -EB
 endif
 
-KBUILD_CFLAGS          += -pipe $(cflags-y)
-KBUILD_AFLAGS          += $(cflags-y)
-
 head-y                 := arch/sh/kernel/init_task.o
 head-$(CONFIG_SUPERH32)        += arch/sh/kernel/head_32.o
 head-$(CONFIG_SUPERH64)        += arch/sh/kernel/head_64.o
 
-LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
-
-core-y                         += arch/sh/kernel/ arch/sh/mm/
+core-y                         += arch/sh/kernel/ arch/sh/mm/ arch/sh/boards/
 core-$(CONFIG_SH_FPU_EMU)      += arch/sh/math-emu/
 
-# Boards
-machdir-$(CONFIG_SH_SOLUTION_ENGINE)           += se/770x
-machdir-$(CONFIG_SH_7722_SOLUTION_ENGINE)      += se/7722
-machdir-$(CONFIG_SH_7751_SOLUTION_ENGINE)      += se/7751
-machdir-$(CONFIG_SH_7780_SOLUTION_ENGINE)      += se/7780
-machdir-$(CONFIG_SH_7343_SOLUTION_ENGINE)      += se/7343
-machdir-$(CONFIG_SH_7721_SOLUTION_ENGINE)      += se/7721
-machdir-$(CONFIG_SH_HP6XX)                     += hp6xx
-machdir-$(CONFIG_SH_DREAMCAST)                 += dreamcast
-machdir-$(CONFIG_SH_SH03)                      += sh03
-machdir-$(CONFIG_SH_SECUREEDGE5410)            += snapgear
-machdir-$(CONFIG_SH_RTS7751R2D)                        += renesas/rts7751r2d
-machdir-$(CONFIG_SH_7751_SYSTEMH)              += renesas/systemh
-machdir-$(CONFIG_SH_EDOSK7705)                 += renesas/edosk7705
-machdir-$(CONFIG_SH_HIGHLANDER)                        += renesas/r7780rp
-machdir-$(CONFIG_SH_MIGOR)                     += renesas/migor
-machdir-$(CONFIG_SH_SDK7780)                   += renesas/sdk7780
-machdir-$(CONFIG_SH_X3PROTO)                   += renesas/x3proto
-machdir-$(CONFIG_SH_RSK7203)                   += renesas/rsk7203
-machdir-$(CONFIG_SH_AP325RXA)                  += renesas/ap325rxa
-machdir-$(CONFIG_SH_SH7763RDP)                 += renesas/sh7763rdp
-machdir-$(CONFIG_SH_SH7785LCR)                 += renesas/sh7785lcr
-machdir-$(CONFIG_SH_SH4202_MICRODEV)           += superh/microdev
-machdir-$(CONFIG_SH_LANDISK)                   += landisk
-machdir-$(CONFIG_SH_TITAN)                     += titan
-machdir-$(CONFIG_SH_SHMIN)                     += shmin
-machdir-$(CONFIG_SH_7206_SOLUTION_ENGINE)      += se/7206
-machdir-$(CONFIG_SH_7619_SOLUTION_ENGINE)      += se/7619
-machdir-$(CONFIG_SH_LBOX_RE2)                  += lboxre2
-machdir-$(CONFIG_SH_MAGIC_PANEL_R2)            += magicpanelr2
-machdir-$(CONFIG_SH_CAYMAN)                    += cayman
-
-incdir-y       := $(notdir $(machdir-y))
+# Mach groups
+machdir-$(CONFIG_SOLUTION_ENGINE)              += mach-se
+machdir-$(CONFIG_SH_HP6XX)                     += mach-hp6xx
+machdir-$(CONFIG_SH_DREAMCAST)                 += mach-dreamcast
+machdir-$(CONFIG_SH_SH03)                      += mach-sh03
+machdir-$(CONFIG_SH_SECUREEDGE5410)            += mach-snapgear
+machdir-$(CONFIG_SH_RTS7751R2D)                        += mach-r2d
+machdir-$(CONFIG_SH_7751_SYSTEMH)              += mach-systemh
+machdir-$(CONFIG_SH_EDOSK7705)                 += mach-edosk7705
+machdir-$(CONFIG_SH_HIGHLANDER)                        += mach-highlander
+machdir-$(CONFIG_SH_MIGOR)                     += mach-migor
+machdir-$(CONFIG_SH_SDK7780)                   += mach-sdk7780
+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
 
 ifneq ($(machdir-y),)
 core-y += $(addprefix arch/sh/boards/, \
@@ -145,67 +126,40 @@ endif
 # Companion chips
 core-$(CONFIG_HD6446X_SERIES)  += arch/sh/cchips/hd6446x/
 
-cpuincdir-$(CONFIG_CPU_SH2)    := cpu-sh2
-cpuincdir-$(CONFIG_CPU_SH2A)   := cpu-sh2a
-cpuincdir-$(CONFIG_CPU_SH3)    := cpu-sh3
-cpuincdir-$(CONFIG_CPU_SH4)    := cpu-sh4
-cpuincdir-$(CONFIG_CPU_SH5)    := cpu-sh5
-
-libs-$(CONFIG_SUPERH32)                := arch/sh/lib/ $(libs-y)
-libs-$(CONFIG_SUPERH64)                := arch/sh/lib64/ $(libs-y)
-libs-y                         += $(LIBGCC)
+#
+# CPU header paths
+#
+# These are ordered by optimization level. A CPU family that is a subset
+# of another (ie, SH-2A / SH-2), is picked up first, with increasing
+# levels of genericness if nothing more suitable is situated in the
+# hierarchy.
+#
+# As an example, in order of preference, SH-2A > SH-2 > common definitions.
+#
+cpuincdir-$(CONFIG_CPU_SH2A)   += cpu-sh2a
+cpuincdir-$(CONFIG_CPU_SH2)    += cpu-sh2
+cpuincdir-$(CONFIG_CPU_SH3)    += cpu-sh3
+cpuincdir-$(CONFIG_CPU_SH4)    += cpu-sh4
+cpuincdir-$(CONFIG_CPU_SH5)    += cpu-sh5
+cpuincdir-y                    += cpu-common   # Must be last
 
 drivers-y                      += arch/sh/drivers/
 drivers-$(CONFIG_OPROFILE)     += arch/sh/oprofile/
 
 boot := arch/sh/boot
 
-ifneq ($(KBUILD_SRC),)
-incdir-prefix  := $(srctree)/include/asm-sh/
-else
-incdir-prefix  :=
-endif
+cflags-y       += $(foreach d, $(cpuincdir-y), -Iarch/sh/include/$(d)) \
+                  $(foreach d, $(machdir-y), -Iarch/sh/include/$(d))
 
-#      Update machine arch and proc symlinks if something which affects
-#      them changed.  We use .arch and .mach to indicate when they were
-#      updated last, otherwise make uses the target directory mtime.
+KBUILD_CFLAGS          += -pipe $(cflags-y)
+KBUILD_CPPFLAGS                += $(cflags-y)
+KBUILD_AFLAGS          += $(cflags-y)
 
-include/asm-sh/.cpu: $(wildcard include/config/cpu/*.h) \
-                    include/config/auto.conf FORCE
-       @echo '  SYMLINK include/asm-sh/cpu -> include/asm-sh/$(cpuincdir-y)'
-       $(Q)if [ ! -d include/asm-sh ]; then mkdir -p include/asm-sh; fi
-       $(Q)ln -fsn $(incdir-prefix)$(cpuincdir-y) include/asm-sh/cpu
-       @touch $@
+LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
 
-#      Most boards have their own mach directories.  For the ones that
-#      don't, just reference the parent directory so the semantics are
-#      kept roughly the same.
-#
-#      When multiple boards are compiled in at the same time, preference
-#      for the mach link is given to whichever has a directory for its
-#      headers. However, this is only a workaround until platforms that
-#      can live in the same kernel image back away from relying on the
-#      mach link.
-
-include/asm-sh/.mach: $(wildcard include/config/sh/*.h) \
-                     include/config/auto.conf FORCE
-       $(Q)if [ ! -d include/asm-sh ]; then mkdir -p include/asm-sh; fi
-       $(Q)rm -f include/asm-sh/mach
-       $(Q)for i in $(incdir-y); do \
-       if [ -d $(srctree)/include/asm-sh/$$i ]; then \
-               echo -n '  SYMLINK include/asm-sh/mach -> '; \
-               echo -e "include/asm-sh/$$i"; \
-               ln -fsn $(incdir-prefix)$$i \
-                       include/asm-sh/mach; \
-       else \
-               if [ ! -d include/asm-sh/mach ]; then \
-                       echo -n '  SYMLINK include/asm-sh/mach -> '; \
-                       echo -e 'include/asm-sh'; \
-                       ln -fsn $(incdir-prefix)../asm-sh include/asm-sh/mach; \
-               fi; \
-       fi; \
-       done
-       @touch $@
+libs-$(CONFIG_SUPERH32)                := arch/sh/lib/ $(libs-y)
+libs-$(CONFIG_SUPERH64)                := arch/sh/lib64/ $(libs-y)
+libs-y                         += $(LIBGCC)
 
 PHONY += maketools FORCE
 
@@ -219,8 +173,7 @@ zImage uImage uImage.srec vmlinux.srec: vmlinux
 
 compressed: zImage
 
-archprepare: include/asm-sh/.cpu include/asm-sh/.mach maketools \
-            arch/sh/lib64/syscalltab.h
+archprepare: maketools arch/sh/lib64/syscalltab.h
 
 archclean:
        $(Q)$(MAKE) $(clean)=$(boot)
@@ -262,6 +215,4 @@ arch/sh/lib64/syscalltab.h: arch/sh/kernel/syscalls_64.S
        $(call filechk,gen-syscalltab)
 
 CLEAN_FILES += arch/sh/lib64/syscalltab.h \
-              include/asm-sh/machtypes.h \
-              include/asm-sh/cpu include/asm-sh/.cpu \
-              include/asm-sh/mach include/asm-sh/.mach
+              include/asm-sh/machtypes.h
diff --git a/arch/sh/boards/Kconfig b/arch/sh/boards/Kconfig
new file mode 100644 (file)
index 0000000..ae19486
--- /dev/null
@@ -0,0 +1,258 @@
+menu "Board support"
+
+config SOLUTION_ENGINE
+       bool
+
+config SH_SOLUTION_ENGINE
+       bool "SolutionEngine"
+       select SOLUTION_ENGINE
+       select CPU_HAS_IPR_IRQ
+       depends on CPU_SUBTYPE_SH7705 || CPU_SUBTYPE_SH7709 || CPU_SUBTYPE_SH7710 || \
+         CPU_SUBTYPE_SH7712 || CPU_SUBTYPE_SH7750 || CPU_SUBTYPE_SH7750S || \
+         CPU_SUBTYPE_SH7750R 
+       help
+         Select SolutionEngine if configuring for a Hitachi SH7705, SH7709,
+         SH7710, SH7712, SH7750, SH7750S or SH7750R evaluation board.
+
+config SH_7206_SOLUTION_ENGINE
+       bool "SolutionEngine7206"
+       select SOLUTION_ENGINE
+       depends on CPU_SUBTYPE_SH7206
+       help
+         Select 7206 SolutionEngine if configuring for a Hitachi SH7206
+         evaluation board.
+
+config SH_7619_SOLUTION_ENGINE
+       bool "SolutionEngine7619"
+       select SOLUTION_ENGINE
+       depends on CPU_SUBTYPE_SH7619
+       help
+         Select 7619 SolutionEngine if configuring for a Hitachi SH7619
+         evaluation board.
+       
+config SH_7721_SOLUTION_ENGINE
+       bool "SolutionEngine7721"
+       select SOLUTION_ENGINE
+       depends on CPU_SUBTYPE_SH7721
+       help
+         Select 7721 SolutionEngine if configuring for a Hitachi SH7721
+         evaluation board.
+
+config SH_7722_SOLUTION_ENGINE
+       bool "SolutionEngine7722"
+       select SOLUTION_ENGINE
+       depends on CPU_SUBTYPE_SH7722
+       help
+         Select 7722 SolutionEngine if configuring for a Hitachi SH772
+         evaluation board.
+
+config SH_7751_SOLUTION_ENGINE
+       bool "SolutionEngine7751"
+       select SOLUTION_ENGINE
+       select CPU_HAS_IPR_IRQ
+       depends on CPU_SUBTYPE_SH7751
+       help
+         Select 7751 SolutionEngine if configuring for a Hitachi SH7751
+         evaluation board.
+         
+config SH_7780_SOLUTION_ENGINE
+       bool "SolutionEngine7780"
+       select SOLUTION_ENGINE
+       select SYS_SUPPORTS_PCI
+       depends on CPU_SUBTYPE_SH7780
+       help
+         Select 7780 SolutionEngine if configuring for a Renesas SH7780
+         evaluation board.
+
+config SH_7343_SOLUTION_ENGINE
+       bool "SolutionEngine7343"
+       select SOLUTION_ENGINE
+       depends on CPU_SUBTYPE_SH7343
+       help
+         Select 7343 SolutionEngine if configuring for a Hitachi
+         SH7343 (SH-Mobile 3AS) evaluation board.
+
+config SH_7751_SYSTEMH
+       bool "SystemH7751R"
+       depends on CPU_SUBTYPE_SH7751R
+       help
+         Select SystemH if you are configuring for a Renesas SystemH
+         7751R evaluation board.
+
+config SH_HP6XX
+       bool "HP6XX"
+       select SYS_SUPPORTS_APM_EMULATION
+       select HD6446X_SERIES
+       depends on CPU_SUBTYPE_SH7709
+       help
+         Select HP6XX if configuring for a HP jornada HP6xx.
+         More information (hardware only) at
+         <http://www.hp.com/jornada/>.
+
+config SH_DREAMCAST
+       bool "Dreamcast"
+       select SYS_SUPPORTS_PCI
+       depends on CPU_SUBTYPE_SH7091
+       help
+         Select Dreamcast if configuring for a SEGA Dreamcast.
+         More information at <http://www.linux-sh.org>
+
+config SH_SH03
+       bool "Interface CTP/PCI-SH03"
+       depends on CPU_SUBTYPE_SH7751
+       select CPU_HAS_IPR_IRQ
+       select SYS_SUPPORTS_PCI
+       help
+         CTP/PCI-SH03 is a CPU module computer that is produced
+         by Interface Corporation.
+         More information at <http://www.interface.co.jp>
+
+config SH_SECUREEDGE5410
+       bool "SecureEdge5410"
+       depends on CPU_SUBTYPE_SH7751R
+       select CPU_HAS_IPR_IRQ
+       select SYS_SUPPORTS_PCI
+       help
+         Select SecureEdge5410 if configuring for a SnapGear SH board.
+         This includes both the OEM SecureEdge products as well as the
+         SME product line.
+
+config SH_RTS7751R2D
+       bool "RTS7751R2D"
+       depends on CPU_SUBTYPE_SH7751R
+       select SYS_SUPPORTS_PCI
+       select IO_TRAPPED
+       help
+         Select RTS7751R2D if configuring for a Renesas Technology
+         Sales SH-Graphics board.
+
+config SH_RSK7203
+       bool "RSK7203"
+       depends on CPU_SUBTYPE_SH7203
+
+config SH_SDK7780
+       bool "SDK7780R3"
+       depends on CPU_SUBTYPE_SH7780
+       select SYS_SUPPORTS_PCI
+       help
+         Select SDK7780 if configuring for a Renesas SH7780 SDK7780R3
+         evaluation board.
+
+config SH_HIGHLANDER
+       bool "Highlander"
+       depends on CPU_SUBTYPE_SH7780 || CPU_SUBTYPE_SH7785
+       select SYS_SUPPORTS_PCI
+       select IO_TRAPPED
+
+config SH_SH7785LCR
+       bool "SH7785LCR"
+       depends on CPU_SUBTYPE_SH7785
+       select SYS_SUPPORTS_PCI
+       select IO_TRAPPED
+
+config SH_SH7785LCR_29BIT_PHYSMAPS
+       bool "SH7785LCR 29bit physmaps"
+       depends on SH_SH7785LCR
+       default y
+       help
+         This board has 2 physical memory maps. It can be changed with
+         DIP switch(S2-5). If you set the DIP switch for S2-5 = ON,
+         you can access all on-board device in 29bit address mode.
+
+config SH_MIGOR
+       bool "Migo-R"
+       depends on CPU_SUBTYPE_SH7722
+       help
+         Select Migo-R if configuring for the SH7722 Migo-R platform
+          by Renesas System Solutions Asia Pte. Ltd.
+
+config SH_AP325RXA
+       bool "AP-325RXA"
+       depends on CPU_SUBTYPE_SH7723
+       help
+         Renesas "AP-325RXA" support.
+         Compatible with ALGO SYSTEM CO.,LTD. "AP-320A"
+
+config SH_SH7763RDP
+       bool "SH7763RDP"
+       depends on CPU_SUBTYPE_SH7763
+       help
+         Select SH7763RDP if configuring for a Renesas SH7763
+         evaluation board.
+
+config SH_EDOSK7705
+       bool "EDOSK7705"
+       depends on CPU_SUBTYPE_SH7705
+
+config SH_SH4202_MICRODEV
+       bool "SH4-202 MicroDev"
+       depends on CPU_SUBTYPE_SH4_202
+       help
+         Select SH4-202 MicroDev if configuring for a SuperH MicroDev board
+         with an SH4-202 CPU.
+
+config SH_LANDISK
+       bool "LANDISK"
+       depends on CPU_SUBTYPE_SH7751R
+       select SYS_SUPPORTS_PCI
+       help
+         I-O DATA DEVICE, INC. "LANDISK Series" support.
+
+config SH_TITAN
+       bool "TITAN"
+       depends on CPU_SUBTYPE_SH7751R
+       select CPU_HAS_IPR_IRQ
+       select SYS_SUPPORTS_PCI
+       help
+         Select Titan if you are configuring for a Nimble Microsystems
+         NetEngine NP51R.
+
+config SH_SHMIN
+       bool "SHMIN"
+       depends on CPU_SUBTYPE_SH7706
+       select CPU_HAS_IPR_IRQ
+       help
+         Select SHMIN if configuring for the SHMIN board.
+
+config SH_LBOX_RE2
+       bool "L-BOX RE2"
+       depends on CPU_SUBTYPE_SH7751R
+       select SYS_SUPPORTS_PCI
+       help
+         Select L-BOX RE2 if configuring for the NTT COMWARE L-BOX RE2.
+
+config SH_X3PROTO
+       bool "SH-X3 Prototype board"
+       depends on CPU_SUBTYPE_SHX3
+
+config SH_MAGIC_PANEL_R2
+       bool "Magic Panel R2"
+       depends on CPU_SUBTYPE_SH7720
+       help
+         Select Magic Panel R2 if configuring for Magic Panel R2.
+
+config SH_CAYMAN
+       bool "Hitachi Cayman"
+       depends on CPU_SUBTYPE_SH5_101 || CPU_SUBTYPE_SH5_103
+       select SYS_SUPPORTS_PCI
+
+endmenu
+
+source "arch/sh/boards/mach-r2d/Kconfig"
+source "arch/sh/boards/mach-highlander/Kconfig"
+source "arch/sh/boards/mach-sdk7780/Kconfig"
+source "arch/sh/boards/mach-migor/Kconfig"
+
+if SH_MAGIC_PANEL_R2
+
+menu "Magic Panel R2 options"
+
+config SH_MAGIC_PANEL_R2_VERSION
+       int SH_MAGIC_PANEL_R2_VERSION
+       default "3"
+       help
+         Set the version of the Magic Panel R2
+
+endmenu
+
+endif
diff --git a/arch/sh/boards/Makefile b/arch/sh/boards/Makefile
new file mode 100644 (file)
index 0000000..463022c
--- /dev/null
@@ -0,0 +1,8 @@
+#
+# Specific board support, not covered by a mach group.
+#
+obj-$(CONFIG_SH_AP325RXA)      += board-ap325rxa.o
+obj-$(CONFIG_SH_MAGIC_PANEL_R2)        += board-magicpanelr2.o
+obj-$(CONFIG_SH_RSK7203)       += board-rsk7203.o
+obj-$(CONFIG_SH_SH7785LCR)     += board-sh7785lcr.o
+obj-$(CONFIG_SH_SHMIN)         += board-shmin.o
similarity index 99%
rename from arch/sh/boards/renesas/ap325rxa/setup.c
rename to arch/sh/boards/board-ap325rxa.c
index 7fa7446..025d4fe 100644 (file)
@@ -17,7 +17,6 @@
 #include <linux/mtd/physmap.h>
 #include <linux/delay.h>
 #include <linux/i2c.h>
-#include <linux/delay.h>
 #include <linux/smc911x.h>
 #include <media/soc_camera_platform.h>
 #include <media/sh_mobile_ceu.h>
@@ -165,6 +164,7 @@ static struct platform_device lcdc_device = {
        },
 };
 
+#ifdef CONFIG_I2C
 static unsigned char camera_ncm03j_magic[] =
 {
        0x87, 0x00, 0x88, 0x08, 0x89, 0x01, 0x8A, 0xE8,
@@ -234,6 +234,7 @@ static struct platform_device camera_device = {
                .platform_data  = &camera_info,
        },
 };
+#endif /* CONFIG_I2C */
 
 static struct sh_mobile_ceu_info sh_mobile_ceu_info = {
        .flags = SOCAM_PCLK_SAMPLE_RISING | SOCAM_HSYNC_ACTIVE_HIGH |
@@ -270,7 +271,9 @@ static struct platform_device *ap325rxa_devices[] __initdata = {
        &ap325rxa_nor_flash_device,
        &lcdc_device,
        &ceu_device,
+#ifdef CONFIG_I2C
        &camera_device,
+#endif
 };
 
 static struct i2c_board_info __initdata ap325rxa_i2c_devices[] = {
similarity index 92%
rename from arch/sh/boards/renesas/rsk7203/setup.c
rename to arch/sh/boards/board-rsk7203.c
index 0bbda04..ffbedc5 100644 (file)
 #include <linux/init.h>
 #include <linux/types.h>
 #include <linux/platform_device.h>
+#include <linux/interrupt.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/physmap.h>
 #include <linux/mtd/map.h>
+#include <linux/smc911x.h>
 #include <asm/machvec.h>
 #include <asm/io.h>
 
+static struct smc911x_platdata smc911x_info = {
+       .flags          = SMC911X_USE_16BIT,
+       .irq_flags      = IRQF_TRIGGER_LOW,
+};
+
 static struct resource smc911x_resources[] = {
        [0] = {
                .start          = 0x24000000,
@@ -35,6 +42,9 @@ static struct platform_device smc911x_device = {
        .id             = -1,
        .num_resources  = ARRAY_SIZE(smc911x_resources),
        .resource       = smc911x_resources,
+       .dev            = {
+               .platform_data = &smc911x_info,
+       },
 };
 
 static const char *probes[] = { "cmdlinepart", NULL };
similarity index 99%
rename from arch/sh/boards/cayman/irq.c
rename to arch/sh/boards/mach-cayman/irq.c
index 30ec7be..ceb37ae 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/irq.h>
 #include <linux/interrupt.h>
 #include <linux/signal.h>
-#include <asm/cpu/irq.h>
+#include <cpu/irq.h>
 #include <asm/page.h>
 
 /* Setup for the SMSC FDC37C935 / LAN91C100FD */
similarity index 99%
rename from arch/sh/boards/cayman/setup.c
rename to arch/sh/boards/mach-cayman/setup.c
index 8c9fa47..e7f9cc5 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/init.h>
 #include <linux/io.h>
 #include <linux/kernel.h>
-#include <asm/cpu/irq.h>
+#include <cpu/irq.h>
 
 /*
  * Platform Dependent Interrupt Priorities.
similarity index 99%
rename from arch/sh/boards/dreamcast/irq.c
rename to arch/sh/boards/mach-dreamcast/irq.c
index 9d0673a..67bdc33 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/irq.h>
 #include <asm/io.h>
 #include <asm/irq.h>
-#include <asm/dreamcast/sysasic.h>
+#include <mach/sysasic.h>
 
 /* Dreamcast System ASIC Hardware Events -
 
similarity index 98%
rename from arch/sh/boards/dreamcast/setup.c
rename to arch/sh/boards/mach-dreamcast/setup.c
index 2581c8c..7d944fc 100644 (file)
@@ -26,7 +26,7 @@
 #include <asm/irq.h>
 #include <asm/rtc.h>
 #include <asm/machvec.h>
-#include <asm/mach/sysasic.h>
+#include <mach/sysasic.h>
 
 extern struct hw_interrupt_type systemasic_int;
 extern void aica_time_init(void);
similarity index 98%
rename from arch/sh/boards/renesas/r7780rp/psw.c
rename to arch/sh/boards/mach-highlander/psw.c
index c844dfa..be8d547 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
-#include <asm/mach/r7780rp.h>
+#include <asm/r7780rp.h>
 #include <asm/push-switch.h>
 
 static irqreturn_t psw_irq_handler(int irq, void *arg)
similarity index 98%
rename from arch/sh/boards/hp6xx/pm.c
rename to arch/sh/boards/mach-hp6xx/pm.c
index d22f6ea..e96684d 100644 (file)
@@ -13,7 +13,7 @@
 #include <asm/io.h>
 #include <asm/hd64461.h>
 #include <asm/hp6xx.h>
-#include <asm/cpu/dac.h>
+#include <cpu/dac.h>
 #include <asm/pm.h>
 
 #define STBCR          0xffffff82
similarity index 96%
rename from arch/sh/boards/hp6xx/pm_wakeup.S
rename to arch/sh/boards/mach-hp6xx/pm_wakeup.S
index 45e9bf0..44b648c 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include <linux/linkage.h>
-#include <asm/cpu/mmu_context.h>
+#include <cpu/mmu_context.h>
 
 #define k0     r0
 #define k1     r1
similarity index 99%
rename from arch/sh/boards/hp6xx/setup.c
rename to arch/sh/boards/mach-hp6xx/setup.c
index 2f414ac..475b46c 100644 (file)
@@ -16,7 +16,7 @@
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/hp6xx.h>
-#include <asm/cpu/dac.h>
+#include <cpu/dac.h>
 
 #define        SCPCR   0xa4000116
 #define        SCPDR   0xa4000136
similarity index 97%
rename from arch/sh/boards/landisk/gio.c
rename to arch/sh/boards/mach-landisk/gio.c
index 0c15b0a..25cdf73 100644 (file)
@@ -20,8 +20,8 @@
 #include <linux/fs.h>
 #include <asm/io.h>
 #include <asm/uaccess.h>
-#include <asm/landisk/gio.h>
-#include <asm/landisk/iodata_landisk.h>
+#include <mach-landisk/mach/gio.h>
+#include <mach-landisk/mach/iodata_landisk.h>
 
 #define DEVCOUNT                4
 #define GIO_MINOR              2       /* GIO minor no. */
similarity index 96%
rename from arch/sh/boards/landisk/irq.c
rename to arch/sh/boards/mach-landisk/irq.c
index 2586494..7b284cd 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/irq.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
-#include <asm/landisk/iodata_landisk.h>
+#include <mach-landisk/mach/iodata_landisk.h>
 
 static void disable_landisk_irq(unsigned int irq)
 {
similarity index 98%
rename from arch/sh/boards/landisk/psw.c
rename to arch/sh/boards/mach-landisk/psw.c
index 5a9b70b..e6b0efa 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
-#include <asm/landisk/iodata_landisk.h>
+#include <mach-landisk/mach/iodata_landisk.h>
 #include <asm/push-switch.h>
 
 static irqreturn_t psw_irq_handler(int irq, void *arg)
similarity index 98%
rename from arch/sh/boards/landisk/setup.c
rename to arch/sh/boards/mach-landisk/setup.c
index 2b708ec..db22ea2 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/pm.h>
 #include <linux/mm.h>
 #include <asm/machvec.h>
-#include <asm/landisk/iodata_landisk.h>
+#include <mach-landisk/mach/iodata_landisk.h>
 #include <asm/io.h>
 
 void init_landisk_IRQ(void);
similarity index 99%
rename from arch/sh/boards/renesas/migor/setup.c
rename to arch/sh/boards/mach-migor/setup.c
index 7bd365a..e499ee3 100644 (file)
@@ -304,6 +304,7 @@ static void camera_power_off(void)
        ctrl_outb(ctrl_inb(PORT_PTDR) & ~0x08, PORT_PTDR);
 }
 
+#ifdef CONFIG_I2C
 static unsigned char camera_ov772x_magic[] =
 {
        0x09, 0x01, 0x0c, 0x10, 0x0d, 0x41, 0x0e, 0x01,
@@ -391,6 +392,7 @@ static struct platform_device migor_camera_device = {
                .platform_data  = &ov772x_info,
        },
 };
+#endif /* CONFIG_I2C */
 
 static struct sh_mobile_ceu_info sh_mobile_ceu_info = {
        .flags = SOCAM_MASTER | SOCAM_DATAWIDTH_8 | SOCAM_PCLK_SAMPLE_RISING \
@@ -429,7 +431,9 @@ static struct platform_device *migor_devices[] __initdata = {
        &sh_keysc_device,
        &migor_lcdc_device,
        &migor_ceu_device,
+#ifdef CONFIG_I2C
        &migor_camera_device,
+#endif
        &migor_nor_flash_device,
        &migor_nand_flash_device,
 };
similarity index 98%
rename from arch/sh/boards/se/7206/io.c
rename to arch/sh/boards/mach-se/7206/io.c
index 1308e61..9c3a332 100644 (file)
@@ -11,7 +11,7 @@
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <asm/io.h>
-#include <asm/se7206.h>
+#include <mach-se/mach/se7206.h>
 
 
 static inline void delay(void)
similarity index 98%
rename from arch/sh/boards/se/7206/irq.c
rename to arch/sh/boards/mach-se/7206/irq.c
index 9d5bfc7..aef7f05 100644 (file)
@@ -10,7 +10,7 @@
 #include <linux/irq.h>
 #include <linux/io.h>
 #include <linux/interrupt.h>
-#include <asm/se7206.h>
+#include <mach-se/mach/se7206.h>
 
 #define INTSTS0 0x31800000
 #define INTSTS1 0x31800002
similarity index 98%
rename from arch/sh/boards/se/7206/setup.c
rename to arch/sh/boards/mach-se/7206/setup.c
index 4fe84cc..f546638 100644 (file)
@@ -10,7 +10,7 @@
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/smc91x.h>
-#include <asm/se7206.h>
+#include <mach-se/mach/se7206.h>
 #include <asm/io.h>
 #include <asm/machvec.h>
 #include <asm/heartbeat.h>
similarity index 99%
rename from arch/sh/boards/se/7343/io.c
rename to arch/sh/boards/mach-se/7343/io.c
index 3a6d114..8741abc 100644 (file)
@@ -6,7 +6,7 @@
  */
 #include <linux/kernel.h>
 #include <asm/io.h>
-#include <asm/mach/se7343.h>
+#include <mach-se/mach/se7343.h>
 
 #define badio(fn, a) panic("bad i/o operation %s for %08lx.", #fn, a)
 
similarity index 97%
rename from arch/sh/boards/se/7343/irq.c
rename to arch/sh/boards/mach-se/7343/irq.c
index 1112e86..051c29d 100644 (file)
@@ -13,9 +13,8 @@
 #include <linux/init.h>
 #include <linux/irq.h>
 #include <linux/interrupt.h>
-#include <asm/irq.h>
-#include <asm/io.h>
-#include <asm/se7343.h>
+#include <linux/io.h>
+#include <mach-se/mach/se7343.h>
 
 static void disable_se7343_irq(unsigned int irq)
 {
similarity index 98%
rename from arch/sh/boards/se/7343/setup.c
rename to arch/sh/boards/mach-se/7343/setup.c
index 8ae718d..486f40b 100644 (file)
@@ -2,7 +2,7 @@
 #include <linux/platform_device.h>
 #include <linux/mtd/physmap.h>
 #include <asm/machvec.h>
-#include <asm/mach/se7343.h>
+#include <mach-se/mach/se7343.h>
 #include <asm/heartbeat.h>
 #include <asm/irq.h>
 #include <asm/io.h>
similarity index 99%
rename from arch/sh/boards/se/770x/io.c
rename to arch/sh/boards/mach-se/770x/io.c
index b1ec085..28833c8 100644 (file)
@@ -6,7 +6,7 @@
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <asm/io.h>
-#include <asm/se.h>
+#include <mach-se/mach/se.h>
 
 /* MS7750 requires special versions of in*, out* routines, since
    PC-like io ports are located at upper half byte of 16-bit word which
similarity index 98%
rename from arch/sh/boards/se/770x/irq.c
rename to arch/sh/boards/mach-se/770x/irq.c
index cdb0807..ec1fea5 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/irq.h>
 #include <asm/irq.h>
 #include <asm/io.h>
-#include <asm/se.h>
+#include <mach-se/mach/se.h>
 
 static struct ipr_data ipr_irq_table[] = {
        /*
similarity index 96%
rename from arch/sh/boards/se/770x/setup.c
rename to arch/sh/boards/mach-se/770x/setup.c
index cf4a5ba..9123d96 100644 (file)
@@ -9,7 +9,7 @@
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <asm/machvec.h>
-#include <asm/se.h>
+#include <mach-se/mach/se.h>
 #include <asm/io.h>
 #include <asm/smc37c93x.h>
 #include <asm/heartbeat.h>
@@ -113,6 +113,8 @@ static struct platform_device heartbeat_device = {
        .resource       = heartbeat_resources,
 };
 
+#if defined(CONFIG_CPU_SUBTYPE_SH7710) ||\
+       defined(CONFIG_CPU_SUBTYPE_SH7712)
 /* SH771X Ethernet driver */
 static struct resource sh_eth0_resources[] = {
        [0] = {
@@ -159,12 +161,16 @@ static struct platform_device sh_eth1_device = {
        .num_resources = ARRAY_SIZE(sh_eth1_resources),
        .resource = sh_eth1_resources,
 };
+#endif
 
 static struct platform_device *se_devices[] __initdata = {
        &heartbeat_device,
        &cf_ide_device,
+#if defined(CONFIG_CPU_SUBTYPE_SH7710) ||\
+       defined(CONFIG_CPU_SUBTYPE_SH7712)
        &sh_eth0_device,
        &sh_eth1_device,
+#endif
 };
 
 static int __init se_devices_setup(void)
similarity index 96%
rename from arch/sh/boards/se/7721/irq.c
rename to arch/sh/boards/mach-se/7721/irq.c
index c4fdd62..b417acc 100644 (file)
@@ -11,7 +11,7 @@
 #include <linux/irq.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
-#include <asm/se7721.h>
+#include <mach-se/mach/se7721.h>
 
 enum {
        UNUSED = 0,
similarity index 98%
rename from arch/sh/boards/se/7721/setup.c
rename to arch/sh/boards/mach-se/7721/setup.c
index 1be3e92..d3fc80f 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <asm/machvec.h>
-#include <asm/se7721.h>
+#include <mach-se/mach/se7721.h>
 #include <asm/io.h>
 #include <asm/heartbeat.h>
 
similarity index 98%
rename from arch/sh/boards/se/7722/irq.c
rename to arch/sh/boards/mach-se/7722/irq.c
index 0b03f3f..02d21a3 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/interrupt.h>
 #include <asm/irq.h>
 #include <asm/io.h>
-#include <asm/se7722.h>
+#include <mach-se/mach/se7722.h>
 
 static void disable_se7722_irq(unsigned int irq)
 {
similarity index 99%
rename from arch/sh/boards/se/7722/setup.c
rename to arch/sh/boards/mach-se/7722/setup.c
index 6e228ea..fe6f965 100644 (file)
@@ -17,7 +17,7 @@
 #include <linux/smc91x.h>
 #include <asm/machvec.h>
 #include <asm/clock.h>
-#include <asm/se7722.h>
+#include <mach-se/mach/se7722.h>
 #include <asm/io.h>
 #include <asm/heartbeat.h>
 #include <asm/sh_keysc.h>
similarity index 99%
rename from arch/sh/boards/se/7751/io.c
rename to arch/sh/boards/mach-se/7751/io.c
index e8d846c..6287ae5 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/types.h>
 #include <linux/pci.h>
 #include <asm/io.h>
-#include <asm/se7751.h>
+#include <mach-se/mach/se7751.h>
 #include <asm/addrspace.h>
 
 static inline volatile u16 *port2adr(unsigned int port)
similarity index 96%
rename from arch/sh/boards/se/7751/irq.c
rename to arch/sh/boards/mach-se/7751/irq.c
index c3d1259..5c9847e 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/init.h>
 #include <linux/irq.h>
 #include <asm/irq.h>
-#include <asm/se7751.h>
+#include <mach-se/mach/se7751.h>
 
 static struct ipr_data ipr_irq_table[] = {
        { 13, 3, 3, 2 },
similarity index 98%
rename from arch/sh/boards/se/7751/setup.c
rename to arch/sh/boards/mach-se/7751/setup.c
index deefbfd..5057251 100644 (file)
@@ -11,7 +11,7 @@
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <asm/machvec.h>
-#include <asm/se7751.h>
+#include <mach-se/mach/se7751.h>
 #include <asm/io.h>
 #include <asm/heartbeat.h>
 
similarity index 97%
rename from arch/sh/boards/se/7780/irq.c
rename to arch/sh/boards/mach-se/7780/irq.c
index 6bd70da..66ad292 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/interrupt.h>
 #include <asm/irq.h>
 #include <asm/io.h>
-#include <asm/se7780.h>
+#include <mach-se/mach/se7780.h>
 
 /*
  * Initialize IRQ setting
similarity index 98%
rename from arch/sh/boards/se/7780/setup.c
rename to arch/sh/boards/mach-se/7780/setup.c
index 0f08ab3..1d3a867 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <asm/machvec.h>
-#include <asm/se7780.h>
+#include <mach-se/mach/se7780.h>
 #include <asm/io.h>
 #include <asm/heartbeat.h>
 
diff --git a/arch/sh/boards/mach-se/Makefile b/arch/sh/boards/mach-se/Makefile
new file mode 100644 (file)
index 0000000..2de42ba
--- /dev/null
@@ -0,0 +1,9 @@
+obj-$(CONFIG_SH_7619_SOLUTION_ENGINE)  += board-se7619.o
+
+obj-$(CONFIG_SH_SOLUTION_ENGINE)       += 770x/
+obj-$(CONFIG_SH_7206_SOLUTION_ENGINE)  += 7206/
+obj-$(CONFIG_SH_7722_SOLUTION_ENGINE)  += 7722/
+obj-$(CONFIG_SH_7751_SOLUTION_ENGINE)  += 7751/
+obj-$(CONFIG_SH_7780_SOLUTION_ENGINE)  += 7780/
+obj-$(CONFIG_SH_7343_SOLUTION_ENGINE)  += 7343/
+obj-$(CONFIG_SH_7721_SOLUTION_ENGINE)  += 7721/
similarity index 96%
rename from arch/sh/boards/sh03/setup.c
rename to arch/sh/boards/mach-sh03/setup.c
index 934ac4f..5771219 100644 (file)
@@ -11,8 +11,8 @@
 #include <linux/platform_device.h>
 #include <asm/io.h>
 #include <asm/rtc.h>
-#include <asm/sh03/io.h>
-#include <asm/sh03/sh03.h>
+#include <mach-sh03/mach/io.h>
+#include <mach-sh03/mach/sh03.h>
 #include <asm/addrspace.h>
 
 static void __init init_sh03_IRQ(void)
similarity index 98%
rename from arch/sh/boards/snapgear/setup.c
rename to arch/sh/boards/mach-snapgear/setup.c
index 7022483..a5e349d 100644 (file)
@@ -22,7 +22,7 @@
 #include <asm/snapgear.h>
 #include <asm/irq.h>
 #include <asm/io.h>
-#include <asm/cpu/timer.h>
+#include <cpu/timer.h>
 
 /*
  * EraseConfig handling functions
similarity index 98%
rename from arch/sh/boards/renesas/systemh/irq.c
rename to arch/sh/boards/mach-systemh/irq.c
index 0ba2fe6..601c9c8 100644 (file)
@@ -11,9 +11,8 @@
 
 #include <linux/init.h>
 #include <linux/irq.h>
+#include <linux/interrupt.h>
 
-#include <linux/hdreg.h>
-#include <linux/ide.h>
 #include <asm/io.h>
 #include <asm/systemh7751.h>
 #include <asm/smc37c93x.h>
diff --git a/arch/sh/boards/magicpanelr2/Kconfig b/arch/sh/boards/magicpanelr2/Kconfig
deleted file mode 100644 (file)
index b0abddc..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-if SH_MAGIC_PANEL_R2
-
-menu "Magic Panel R2 options"
-
-config SH_MAGIC_PANEL_R2_VERSION
-       int SH_MAGIC_PANEL_R2_VERSION
-       default "3"
-       help
-         Set the version of the Magic Panel R2
-
-endmenu
-
-endif
diff --git a/arch/sh/boards/magicpanelr2/Makefile b/arch/sh/boards/magicpanelr2/Makefile
deleted file mode 100644 (file)
index 7a6d586..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-# Makefile for the Magic Panel specific parts
-#
-
-obj-y   := setup.o
\ No newline at end of file
diff --git a/arch/sh/boards/renesas/ap325rxa/Makefile b/arch/sh/boards/renesas/ap325rxa/Makefile
deleted file mode 100644 (file)
index f663768..0000000
+++ /dev/null
@@ -1 +0,0 @@
-obj-y  := setup.o
diff --git a/arch/sh/boards/renesas/rsk7203/Makefile b/arch/sh/boards/renesas/rsk7203/Makefile
deleted file mode 100644 (file)
index f663768..0000000
+++ /dev/null
@@ -1 +0,0 @@
-obj-y  := setup.o
diff --git a/arch/sh/boards/renesas/sh7785lcr/Makefile b/arch/sh/boards/renesas/sh7785lcr/Makefile
deleted file mode 100644 (file)
index 7703756..0000000
+++ /dev/null
@@ -1 +0,0 @@
-obj-y   := setup.o
diff --git a/arch/sh/boards/se/7619/Makefile b/arch/sh/boards/se/7619/Makefile
deleted file mode 100644 (file)
index d21775c..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-# Makefile for the 7619 SolutionEngine specific parts of the kernel
-#
-
-obj-y   := setup.o
diff --git a/arch/sh/boards/shmin/Makefile b/arch/sh/boards/shmin/Makefile
deleted file mode 100644 (file)
index 3190cc7..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-# Makefile for the SHMIN board.
-#
-
-obj-y   := setup.o
index 8b37869..5b54965 100644 (file)
@@ -18,9 +18,10 @@ CONFIG_PAGE_OFFSET   ?= 0x80000000
 CONFIG_MEMORY_START    ?= 0x0c000000
 CONFIG_BOOT_LINK_OFFSET        ?= 0x00800000
 CONFIG_ZERO_PAGE_OFFSET        ?= 0x00001000
+CONFIG_ENTRY_OFFSET    ?= 0x00001000
 
 export CONFIG_PAGE_OFFSET CONFIG_MEMORY_START CONFIG_BOOT_LINK_OFFSET \
-       CONFIG_ZERO_PAGE_OFFSET
+       CONFIG_ZERO_PAGE_OFFSET CONFIG_ENTRY_OFFSET
 
 targets := zImage vmlinux.srec uImage uImage.srec
 subdir- := compressed
index f72c198..622eac3 100644 (file)
@@ -14,8 +14,8 @@
  *   Copyright (C) 2002 Stuart Menefy (stuart.menefy@st.com)
  */
 #include <asm/cache.h>
-#include <asm/cpu/mmu_context.h>
-#include <asm/cpu/registers.h>
+#include <cpu/mmu_context.h>
+#include <cpu/registers.h>
 
 /*
  * Fixed TLB entries to identity map the beginning of RAM
index 5471df5..29926a9 100644 (file)
@@ -1,10 +1,11 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.26-rc4
-# Wed Jun  4 17:30:00 2008
+# Linux kernel version: 2.6.26
+# Wed Jul 30 01:18:59 2008
 #
 CONFIG_SUPERH=y
 CONFIG_SUPERH32=y
+CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
 CONFIG_GENERIC_BUG=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -79,9 +80,14 @@ CONFIG_SLAB=y
 # CONFIG_PROFILING is not set
 # CONFIG_MARKERS is not set
 CONFIG_HAVE_OPROFILE=y
+# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
+# CONFIG_HAVE_IOREMAP_PROT is not set
 # CONFIG_HAVE_KPROBES is not set
 # CONFIG_HAVE_KRETPROBES is not set
+# CONFIG_HAVE_ARCH_TRACEHOOK is not set
 # CONFIG_HAVE_DMA_ATTRS is not set
+# CONFIG_USE_GENERIC_SMP_HELPERS is not set
+CONFIG_HAVE_CLK=y
 CONFIG_PROC_PAGE_MONITOR=y
 CONFIG_SLABINFO=y
 CONFIG_RT_MUTEXES=y
@@ -99,6 +105,7 @@ CONFIG_BLOCK=y
 # CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_LSF is not set
 # CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
 
 #
 # IO Schedulers
@@ -175,6 +182,7 @@ 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_ENTRY_OFFSET=0x00001000
 CONFIG_SELECT_MEMORY_MODEL=y
 CONFIG_FLATMEM_MANUAL=y
 # CONFIG_DISCONTIGMEM_MANUAL is not set
@@ -376,6 +384,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 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 is not set
 CONFIG_MTD=y
@@ -466,6 +476,7 @@ 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_EEPROM_93CX6 is not set
 # CONFIG_ENCLOSURE_SERVICES is not set
@@ -512,10 +523,10 @@ CONFIG_SCSI_WAIT_SCAN=m
 CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_ISCSI_TCP is not set
 # CONFIG_SCSI_DEBUG is not set
+# CONFIG_SCSI_DH is not set
 # CONFIG_ATA is not set
 # CONFIG_MD is not set
 CONFIG_NETDEVICES=y
-# CONFIG_NETDEVICES_MULTIQUEUE is not set
 # CONFIG_DUMMY is not set
 # CONFIG_BONDING is not set
 # CONFIG_MACVLAN is not set
@@ -587,6 +598,7 @@ CONFIG_INPUT=y
 # Character devices
 #
 CONFIG_VT=y
+CONFIG_CONSOLE_TRANSLATIONS=y
 CONFIG_VT_CONSOLE=y
 CONFIG_HW_CONSOLE=y
 CONFIG_VT_HW_CONSOLE_BINDING=y
@@ -620,6 +632,7 @@ CONFIG_HW_RANDOM=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
 
 #
@@ -631,6 +644,7 @@ CONFIG_SSB_POSSIBLE=y
 #
 # Multifunction device drivers
 #
+# CONFIG_MFD_CORE is not set
 # CONFIG_MFD_SM501 is not set
 # CONFIG_HTC_PASIC3 is not set
 
@@ -667,10 +681,6 @@ CONFIG_SSB_POSSIBLE=y
 # Console display driver support
 #
 CONFIG_DUMMY_CONSOLE=y
-
-#
-# Sound
-#
 # CONFIG_SOUND is not set
 # CONFIG_HID_SUPPORT is not set
 # CONFIG_USB_SUPPORT is not set
@@ -679,6 +689,7 @@ CONFIG_DUMMY_CONSOLE=y
 # CONFIG_NEW_LEDS is not set
 # CONFIG_ACCESSIBILITY is not set
 # CONFIG_RTC_CLASS is not set
+# CONFIG_DMADEVICES is not set
 # CONFIG_UIO is not set
 
 #
@@ -752,6 +763,7 @@ CONFIG_TMPFS=y
 # CONFIG_CRAMFS 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
@@ -762,17 +774,16 @@ 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=y
 CONFIG_NFSD_V3=y
 # CONFIG_NFSD_V3_ACL is not set
 # CONFIG_NFSD_V4 is not set
-CONFIG_ROOT_NFS=y
 CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
 CONFIG_EXPORTFS=y
 CONFIG_NFS_COMMON=y
 CONFIG_SUNRPC=y
-# CONFIG_SUNRPC_BIND34 is not set
 # CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_RPCSEC_GSS_SPKM3 is not set
 # CONFIG_SMB_FS is not set
@@ -842,6 +853,7 @@ CONFIG_FRAME_WARN=1024
 # CONFIG_HEADERS_CHECK is not set
 # CONFIG_DEBUG_KERNEL is not set
 # CONFIG_DEBUG_BUGVERBOSE is not set
+# CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_SAMPLES is not set
 # CONFIG_SH_STANDARD_BIOS is not set
 # CONFIG_EARLY_SCIF_CONSOLE is not set
@@ -898,6 +910,10 @@ CONFIG_CRYPTO_CBC=y
 # 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
@@ -937,6 +953,7 @@ CONFIG_BITREVERSE=y
 # CONFIG_GENERIC_FIND_FIRST_BIT is not set
 # CONFIG_CRC_CCITT is not set
 # CONFIG_CRC16 is not set
+CONFIG_CRC_T10DIF=y
 # CONFIG_CRC_ITU_T is not set
 CONFIG_CRC32=y
 # CONFIG_CRC7 is not set
index 5772878..3dc1cbd 100644 (file)
@@ -1,14 +1,17 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.23-rc7
-# Fri Sep 21 15:46:27 2007
+# Linux kernel version: 2.6.27-rc1
+# Mon Aug  4 16:49:13 2008
 #
 CONFIG_SUPERH=y
+CONFIG_SUPERH32=y
+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_GENERIC_IRQ_PROBE=y
 CONFIG_GENERIC_CALIBRATE_DELAY=y
 CONFIG_GENERIC_TIME=y
@@ -37,12 +40,15 @@ CONFIG_SYSVIPC_SYSCTL=y
 CONFIG_BSD_PROCESS_ACCT=y
 # CONFIG_BSD_PROCESS_ACCT_V3 is not set
 # CONFIG_TASKSTATS is not set
-# CONFIG_USER_NS is not set
 # CONFIG_AUDIT is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_CGROUPS is not set
+# CONFIG_GROUP_SCHED is not set
 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_CC_OPTIMIZE_FOR_SIZE=y
 CONFIG_SYSCTL=y
@@ -55,21 +61,39 @@ 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_VM_EVENT_COUNTERS=y
 CONFIG_SLAB=y
 # CONFIG_SLUB is not set
 # CONFIG_SLOB is not set
+CONFIG_PROFILING=y
+# CONFIG_MARKERS is not set
+# CONFIG_OPROFILE is not set
+CONFIG_HAVE_OPROFILE=y
+# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
+# CONFIG_HAVE_IOREMAP_PROT is not set
+# CONFIG_HAVE_KPROBES is not set
+# CONFIG_HAVE_KRETPROBES is not set
+# CONFIG_HAVE_ARCH_TRACEHOOK is not set
+# CONFIG_HAVE_DMA_ATTRS is not set
+# CONFIG_USE_GENERIC_SMP_HELPERS is not set
+CONFIG_HAVE_CLK=y
+CONFIG_PROC_PAGE_MONITOR=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
@@ -80,6 +104,7 @@ CONFIG_BLOCK=y
 # CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_LSF is not set
 # CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
 
 #
 # IO Schedulers
@@ -93,13 +118,17 @@ CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_CFQ is not set
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_CLASSIC_RCU=y
 
 #
 # System type
 #
 CONFIG_CPU_SH4=y
 # CONFIG_CPU_SUBTYPE_SH7619 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
@@ -108,6 +137,7 @@ CONFIG_CPU_SH4=y
 # 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=y
 # CONFIG_CPU_SUBTYPE_SH7750R is not set
@@ -116,14 +146,17 @@ CONFIG_CPU_SUBTYPE_SH7091=y
 # 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_ST40STB1 is not set
-# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
+# CONFIG_CPU_SUBTYPE_SH7723 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_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
+# CONFIG_CPU_SUBTYPE_SH5_101 is not set
+# CONFIG_CPU_SUBTYPE_SH5_103 is not set
 
 #
 # Memory management options
@@ -133,6 +166,7 @@ CONFIG_MMU=y
 CONFIG_PAGE_OFFSET=0x80000000
 CONFIG_MEMORY_START=0x0c000000
 CONFIG_MEMORY_SIZE=0x01000000
+CONFIG_29BIT=y
 CONFIG_VSYSCALL=y
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_SPARSEMEM_ENABLE=y
@@ -142,12 +176,15 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_ARCH_SELECT_MEMORY_MODEL=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_ENTRY_OFFSET=0x00001000
 CONFIG_HUGETLB_PAGE_SIZE_64K=y
 # CONFIG_HUGETLB_PAGE_SIZE_256K is not set
 # CONFIG_HUGETLB_PAGE_SIZE_1MB is not set
 # 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=y
 # CONFIG_DISCONTIGMEM_MANUAL is not set
@@ -155,6 +192,8 @@ CONFIG_FLATMEM_MANUAL=y
 CONFIG_FLATMEM=y
 CONFIG_FLAT_NODE_MEM_MAP=y
 CONFIG_SPARSEMEM_STATIC=y
+# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
+CONFIG_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
 # CONFIG_RESOURCES_64BIT is not set
 CONFIG_ZONE_DMA_FLAG=0
@@ -194,6 +233,7 @@ CONFIG_SH_PCLK_FREQ=49876504
 # CONFIG_TICK_ONESHOT is not set
 # CONFIG_NO_HZ is not set
 # CONFIG_HIGH_RES_TIMERS is not set
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
 
 #
 # CPU Frequency scaling
@@ -204,7 +244,10 @@ CONFIG_CPU_FREQ_TABLE=y
 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=y
 CONFIG_CPU_FREQ_GOV_USERSPACE=y
@@ -239,12 +282,16 @@ CONFIG_HZ_250=y
 # CONFIG_HZ_300 is not set
 # CONFIG_HZ_1000 is not set
 CONFIG_HZ=250
+# CONFIG_SCHED_HRTICK is not set
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
+CONFIG_SECCOMP=y
 # CONFIG_PREEMPT_NONE is not set
 # CONFIG_PREEMPT_VOLUNTARY is not set
 CONFIG_PREEMPT=y
-CONFIG_PREEMPT_BKL=y
+# CONFIG_PREEMPT_RCU is not set
+CONFIG_GUSA=y
+# CONFIG_GUSA_RB is not set
 
 #
 # Boot options
@@ -263,10 +310,7 @@ CONFIG_PCI=y
 CONFIG_SH_PCIDMA_NONCOHERENT=y
 CONFIG_PCI_AUTO=y
 # CONFIG_ARCH_SUPPORTS_MSI is not set
-
-#
-# PCCARD (PCMCIA/CardBus) support
-#
+CONFIG_PCI_LEGACY=y
 # CONFIG_PCCARD is not set
 # CONFIG_HOTPLUG_PCI is not set
 
@@ -275,10 +319,6 @@ CONFIG_PCI_AUTO=y
 #
 CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
-
-#
-# Networking
-#
 CONFIG_NET=y
 
 #
@@ -291,6 +331,7 @@ 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 is not set
 CONFIG_INET=y
 # CONFIG_IP_MULTICAST is not set
@@ -309,6 +350,7 @@ CONFIG_IP_FIB_HASH=y
 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
@@ -316,8 +358,6 @@ CONFIG_TCP_CONG_CUBIC=y
 CONFIG_DEFAULT_TCP_CONG="cubic"
 # 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 is not set
 # CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
@@ -334,10 +374,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_LAPB is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-
-#
-# QoS and/or fair queueing
-#
 # CONFIG_NET_SCHED is not set
 
 #
@@ -345,6 +381,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 #
 # 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
@@ -366,6 +403,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 #
 # Generic Driver Options
 #
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 # CONFIG_STANDALONE is not set
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 # CONFIG_FW_LOADER is not set
@@ -374,6 +412,7 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
 # CONFIG_MTD is not set
 # CONFIG_PARPORT is not set
 CONFIG_BLK_DEV=y
+CONFIG_GDROM=y
 # CONFIG_BLK_CPQ_CISS_DA is not set
 # CONFIG_BLK_DEV_DAC960 is not set
 # CONFIG_BLK_DEV_UMEM is not set
@@ -384,11 +423,15 @@ CONFIG_BLK_DEV=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=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_HAVE_IDE=y
 # CONFIG_IDE is not set
 
 #
@@ -400,44 +443,49 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_SCSI_NETLINK is not set
 # CONFIG_ATA is not set
 # CONFIG_MD is not set
+# CONFIG_FUSION is not set
 
 #
-# Fusion MPT device support
+# IEEE 1394 (FireWire) support
 #
-# CONFIG_FUSION is not set
 
 #
-# IEEE 1394 (FireWire) support
+# Enable only one of the two stacks, unless you know what you are doing
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
 # CONFIG_I2O is not set
 CONFIG_NETDEVICES=y
-# CONFIG_NETDEVICES_MULTIQUEUE is not set
 # 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 is not set
 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 is not set
+# CONFIG_SMC911X 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_NET_PCI=y
 # CONFIG_PCNET32 is not set
 # CONFIG_AMD8111_ETH is not set
 # CONFIG_ADAPTEC_STARFIRE is not set
 # CONFIG_B44 is not set
 # CONFIG_FORCEDETH is not set
-# CONFIG_DGRS is not set
 # CONFIG_EEPRO100 is not set
 # CONFIG_E100 is not set
 # CONFIG_FEALNX is not set
@@ -449,6 +497,7 @@ CONFIG_8139TOO=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
 # CONFIG_SIS900 is not set
 # CONFIG_EPIC100 is not set
 # CONFIG_SUNDANCE is not set
@@ -464,12 +513,12 @@ CONFIG_8139TOO=y
 #
 # CONFIG_WLAN_PRE80211 is not set
 # CONFIG_WLAN_80211 is not set
+# CONFIG_IWLWIFI_LEDS 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_SHAPER is not set
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
@@ -491,7 +540,6 @@ 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_TSDEV is not set
 # CONFIG_INPUT_EVDEV is not set
 # CONFIG_INPUT_EVBUG is not set
 
@@ -505,6 +553,8 @@ CONFIG_INPUT_KEYBOARD=y
 # CONFIG_KEYBOARD_XTKBD is not set
 # CONFIG_KEYBOARD_NEWTON is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
+CONFIG_KEYBOARD_MAPLE=y
+# CONFIG_KEYBOARD_SH_KEYSC is not set
 CONFIG_INPUT_MOUSE=y
 # CONFIG_MOUSE_PS2 is not set
 # CONFIG_MOUSE_SERIAL is not set
@@ -530,10 +580,13 @@ CONFIG_SERIO_LIBPS2=y
 # 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
@@ -553,6 +606,19 @@ CONFIG_UNIX98_PTYS=y
 CONFIG_LEGACY_PTYS=y
 CONFIG_LEGACY_PTY_COUNT=256
 # CONFIG_IPMI_HANDLER is not set
+CONFIG_HW_RANDOM=y
+# 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 is not set
+# CONFIG_SPI 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=y
 # CONFIG_WATCHDOG_NOWAYOUT is not set
 
@@ -568,45 +634,40 @@ CONFIG_SH_WDT=y
 #
 # CONFIG_PCIPCWATCHDOG is not set
 # CONFIG_WDTPCI is not set
-CONFIG_HW_RANDOM=y
-# 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
 
 #
-# SPI support
+# Sonics Silicon Backplane
 #
-# CONFIG_SPI is not set
-# CONFIG_SPI_MASTER is not set
-# CONFIG_W1 is not set
-# CONFIG_POWER_SUPPLY is not set
-# CONFIG_HWMON is not set
+CONFIG_SSB_POSSIBLE=y
+# 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
 
 #
 # Multimedia devices
 #
+
+#
+# Multimedia core support
+#
 # CONFIG_VIDEO_DEV is not set
 # CONFIG_DVB_CORE is not set
-# CONFIG_DAB is not set
+# CONFIG_VIDEO_MEDIA is not set
 
 #
-# Graphics support
+# Multimedia drivers
 #
-# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
+# CONFIG_DAB is not set
 
 #
-# Display device support
+# Graphics support
 #
-# CONFIG_DISPLAY_SUPPORT is not set
+# CONFIG_DRM is not set
 # CONFIG_VGASTATE is not set
 CONFIG_VIDEO_OUTPUT_CONTROL=m
 CONFIG_FB=y
@@ -615,11 +676,12 @@ CONFIG_FIRMWARE_EDID=y
 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_DEFERRED_IO=y
 # CONFIG_FB_SVGALIB is not set
 # CONFIG_FB_MACMODES is not set
 # CONFIG_FB_BACKLIGHT is not set
@@ -653,7 +715,15 @@ CONFIG_FB_PVR2=y
 # 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_SH_MOBILE_LCDC is not set
 # CONFIG_FB_VIRTUAL is not set
+# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
+
+#
+# Display device support
+#
+# CONFIG_DISPLAY_SUPPORT is not set
 
 #
 # Console display driver support
@@ -680,49 +750,30 @@ CONFIG_LOGO=y
 # CONFIG_LOGO_SUPERH_MONO is not set
 # CONFIG_LOGO_SUPERH_VGA16 is not set
 CONFIG_LOGO_SUPERH_CLUT224=y
-
-#
-# Sound
-#
 # CONFIG_SOUND is not set
 CONFIG_HID_SUPPORT=y
 CONFIG_HID=y
 # CONFIG_HID_DEBUG is not set
+# CONFIG_HIDRAW 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'
 #
-
-#
-# USB Gadget Support
-#
 # CONFIG_USB_GADGET 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_CLASS is not set
-
-#
-# DMA Engine support
-#
-# CONFIG_DMA_ENGINE is not set
-
-#
-# DMA Clients
-#
-
-#
-# DMA Devices
-#
-
-#
-# Userspace I/O
-#
+# CONFIG_DMADEVICES is not set
 # CONFIG_UIO is not set
 
 #
@@ -735,14 +786,11 @@ CONFIG_USB_ARCH_HAS_EHCI=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_DNOTIFY is not set
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
 # CONFIG_QUOTA is not set
-# CONFIG_DNOTIFY is not set
 # CONFIG_AUTOFS_FS is not set
 # CONFIG_AUTOFS4_FS is not set
 # CONFIG_FUSE_FS is not set
@@ -771,7 +819,6 @@ CONFIG_TMPFS=y
 # CONFIG_TMPFS_POSIX_ACL is not set
 CONFIG_HUGETLBFS=y
 CONFIG_HUGETLB_PAGE=y
-CONFIG_RAMFS=y
 # CONFIG_CONFIGFS_FS is not set
 
 #
@@ -786,14 +833,14 @@ CONFIG_RAMFS=y
 # CONFIG_EFS_FS is not set
 # CONFIG_CRAMFS 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
-
-#
-# Network File Systems
-#
+CONFIG_NETWORK_FILESYSTEMS=y
 # CONFIG_NFS_FS is not set
 # CONFIG_NFSD is not set
 # CONFIG_SMB_FS is not set
@@ -807,35 +854,25 @@ CONFIG_RAMFS=y
 #
 # CONFIG_PARTITION_ADVANCED is not set
 CONFIG_MSDOS_PARTITION=y
-
-#
-# Native Language Support
-#
 # CONFIG_NLS is not set
-
-#
-# Distributed Lock Manager
-#
 # CONFIG_DLM is not set
 
-#
-# Profiling support
-#
-CONFIG_PROFILING=y
-# CONFIG_OPROFILE 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_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 is not set
+# CONFIG_DEBUG_MEMORY_INIT is not set
+# CONFIG_SAMPLES is not set
 # CONFIG_SH_STANDARD_BIOS is not set
 # CONFIG_EARLY_SCIF_CONSOLE is not set
 # CONFIG_SH_KGDB is not set
@@ -845,14 +882,95 @@ CONFIG_ENABLE_MUST_CHECK=y
 #
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
-# CONFIG_CRYPTO is not set
+# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+CONFIG_CRYPTO=y
+
+#
+# Crypto core or helper
+#
+# CONFIG_CRYPTO_MANAGER 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
+
+#
+# Digest
+#
+# CONFIG_CRYPTO_CRC32C 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_LZO is not set
+CONFIG_CRYPTO_HW=y
+# CONFIG_CRYPTO_DEV_HIFN_795X is not set
 
 #
 # Library routines
 #
 CONFIG_BITREVERSE=y
+# CONFIG_GENERIC_FIND_FIRST_BIT is not set
 # 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
index 756d38d..41e25b3 100644 (file)
@@ -1,9 +1,11 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.23-rc4
-# Tue Sep 11 19:42:44 2007
+# Linux kernel version: 2.6.26
+# Wed Jul 30 01:24:57 2008
 #
 CONFIG_SUPERH=y
+CONFIG_SUPERH32=y
+CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
 CONFIG_GENERIC_BUG=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -20,6 +22,7 @@ CONFIG_LOCKDEP_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_SUPPORTS_AOUT=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
 
 #
@@ -34,12 +37,15 @@ CONFIG_SWAP=y
 # CONFIG_SYSVIPC is not set
 CONFIG_BSD_PROCESS_ACCT=y
 # CONFIG_BSD_PROCESS_ACCT_V3 is not set
-# CONFIG_USER_NS is not set
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_CGROUPS is not set
+# CONFIG_GROUP_SCHED is not set
 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_CC_OPTIMIZE_FOR_SIZE is not set
 CONFIG_SYSCTL=y
@@ -52,6 +58,7 @@ 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
@@ -64,6 +71,19 @@ CONFIG_VM_EVENT_COUNTERS=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_EFFICIENT_UNALIGNED_ACCESS is not set
+# CONFIG_HAVE_IOREMAP_PROT is not set
+# CONFIG_HAVE_KPROBES is not set
+# CONFIG_HAVE_KRETPROBES is not set
+# CONFIG_HAVE_ARCH_TRACEHOOK is not set
+# CONFIG_HAVE_DMA_ATTRS is not set
+# CONFIG_USE_GENERIC_SMP_HELPERS is not set
+CONFIG_HAVE_CLK=y
+CONFIG_PROC_PAGE_MONITOR=y
+CONFIG_SLABINFO=y
 CONFIG_RT_MUTEXES=y
 # CONFIG_TINY_SHMEM is not set
 CONFIG_BASE_SMALL=0
@@ -73,6 +93,7 @@ CONFIG_BLOCK=y
 # CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_LSF is not set
 # CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
 
 #
 # IO Schedulers
@@ -86,13 +107,17 @@ CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_CFQ is not set
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_CLASSIC_RCU=y
 
 #
 # System type
 #
 CONFIG_CPU_SH3=y
 # CONFIG_CPU_SUBTYPE_SH7619 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
@@ -101,6 +126,7 @@ CONFIG_CPU_SUBTYPE_SH7709=y
 # 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
@@ -109,14 +135,17 @@ CONFIG_CPU_SUBTYPE_SH7709=y
 # 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_ST40STB1 is not set
-# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
+# CONFIG_CPU_SUBTYPE_SH7723 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_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
+# CONFIG_CPU_SUBTYPE_SH5_101 is not set
+# CONFIG_CPU_SUBTYPE_SH5_103 is not set
 
 #
 # Memory management options
@@ -126,6 +155,7 @@ CONFIG_MMU=y
 CONFIG_PAGE_OFFSET=0x80000000
 CONFIG_MEMORY_START=0x0d000000
 CONFIG_MEMORY_SIZE=0x00400000
+CONFIG_29BIT=y
 CONFIG_VSYSCALL=y
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_SPARSEMEM_ENABLE=y
@@ -135,7 +165,9 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_ARCH_SELECT_MEMORY_MODEL=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_ENTRY_OFFSET=0x00001000
 CONFIG_SELECT_MEMORY_MODEL=y
 CONFIG_FLATMEM_MANUAL=y
 # CONFIG_DISCONTIGMEM_MANUAL is not set
@@ -143,6 +175,8 @@ CONFIG_FLATMEM_MANUAL=y
 CONFIG_FLATMEM=y
 CONFIG_FLAT_NODE_MEM_MAP=y
 CONFIG_SPARSEMEM_STATIC=y
+# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
+CONFIG_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
 # CONFIG_RESOURCES_64BIT is not set
 CONFIG_ZONE_DMA_FLAG=0
@@ -181,6 +215,7 @@ CONFIG_SH_PCLK_FREQ=22110000
 # CONFIG_TICK_ONESHOT is not set
 # CONFIG_NO_HZ is not set
 # CONFIG_HIGH_RES_TIMERS is not set
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
 
 #
 # CPU Frequency scaling
@@ -219,11 +254,14 @@ CONFIG_HZ_250=y
 # CONFIG_HZ_300 is not set
 # CONFIG_HZ_1000 is not set
 CONFIG_HZ=250
+# CONFIG_SCHED_HRTICK is not set
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
 CONFIG_PREEMPT_NONE=y
 # CONFIG_PREEMPT_VOLUNTARY is not set
 # CONFIG_PREEMPT is not set
+CONFIG_GUSA=y
+# CONFIG_GUSA_RB is not set
 
 #
 # Boot options
@@ -237,10 +275,6 @@ CONFIG_BOOT_LINK_OFFSET=0x00800000
 #
 CONFIG_ISA=y
 # CONFIG_ARCH_SUPPORTS_MSI is not set
-
-#
-# PCCARD (PCMCIA/CardBus) support
-#
 CONFIG_PCCARD=y
 # CONFIG_PCMCIA_DEBUG is not set
 CONFIG_PCMCIA=y
@@ -263,11 +297,12 @@ CONFIG_BINFMT_ELF=y
 #
 # Power management options (EXPERIMENTAL)
 #
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
 CONFIG_PM=y
-CONFIG_PM_LEGACY=y
 # CONFIG_PM_DEBUG is not set
 CONFIG_PM_SLEEP=y
 CONFIG_SUSPEND=y
+CONFIG_SUSPEND_FREEZER=y
 CONFIG_APM_EMULATION=y
 
 #
@@ -282,9 +317,12 @@ CONFIG_APM_EMULATION=y
 #
 # Generic Driver Options
 #
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 # CONFIG_STANDALONE is not set
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 CONFIG_FW_LOADER=y
+CONFIG_FIRMWARE_IN_KERNEL=y
+CONFIG_EXTRA_FIRMWARE=""
 # CONFIG_SYS_HYPERVISOR is not set
 # CONFIG_MTD is not set
 # CONFIG_PARPORT is not set
@@ -294,8 +332,11 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_LOOP is not set
 # CONFIG_BLK_DEV_RAM is not set
 # CONFIG_CDROM_PKTCDVD is not set
+# CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
 # CONFIG_EEPROM_93CX6 is not set
+# CONFIG_ENCLOSURE_SERVICES is not set
+CONFIG_HAVE_IDE=y
 # CONFIG_IDE is not set
 
 #
@@ -332,6 +373,7 @@ CONFIG_BLK_DEV_SD=y
 # CONFIG_SCSI_SPI_ATTRS is not set
 # CONFIG_SCSI_FC_ATTRS is not set
 # CONFIG_SCSI_SAS_LIBSAS is not set
+# CONFIG_SCSI_SRP_ATTRS is not set
 CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_AHA152X is not set
 # CONFIG_SCSI_AIC7XXX_OLD is not set
@@ -342,14 +384,17 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
 # CONFIG_SCSI_NCR53C406A is not set
 # CONFIG_SCSI_PAS16 is not set
-# CONFIG_SCSI_PSI240I is not set
 # CONFIG_SCSI_QLOGIC_FAS is not set
 # CONFIG_SCSI_SYM53C416 is not set
 # CONFIG_SCSI_T128 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_LOWLEVEL_PCMCIA is not set
+# CONFIG_SCSI_DH is not set
 CONFIG_ATA=y
 # CONFIG_ATA_NONSTANDARD is not set
+CONFIG_SATA_PMP=y
+CONFIG_ATA_SFF=y
+# CONFIG_SATA_MV is not set
 # CONFIG_PATA_LEGACY is not set
 # CONFIG_PATA_PCMCIA is not set
 # CONFIG_PATA_QDI is not set
@@ -370,11 +415,9 @@ CONFIG_INPUT_POLLDEV=y
 #
 # CONFIG_INPUT_MOUSEDEV is not set
 # CONFIG_INPUT_JOYDEV is not set
-CONFIG_INPUT_TSDEV=y
-CONFIG_INPUT_TSDEV_SCREEN_X=240
-CONFIG_INPUT_TSDEV_SCREEN_Y=320
 CONFIG_INPUT_EVDEV=y
 # CONFIG_INPUT_EVBUG is not set
+# CONFIG_INPUT_APMPOWER is not set
 
 #
 # Input Device Drivers
@@ -387,6 +430,7 @@ CONFIG_INPUT_KEYBOARD=y
 # CONFIG_KEYBOARD_NEWTON is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
 CONFIG_KEYBOARD_HP6XX=y
+# CONFIG_KEYBOARD_SH_KEYSC is not set
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_INPUT_JOYSTICK is not set
 # CONFIG_INPUT_TABLET is not set
@@ -395,12 +439,15 @@ CONFIG_INPUT_TOUCHSCREEN=y
 # CONFIG_TOUCHSCREEN_GUNZE is not set
 # CONFIG_TOUCHSCREEN_ELO is not set
 # CONFIG_TOUCHSCREEN_MTOUCH is not set
+# CONFIG_TOUCHSCREEN_INEXIO is not set
 # CONFIG_TOUCHSCREEN_MK712 is not set
 CONFIG_TOUCHSCREEN_HP600=y
+# CONFIG_TOUCHSCREEN_HTCPEN is not set
 # CONFIG_TOUCHSCREEN_PENMOUNT is not set
 # CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
 # CONFIG_TOUCHSCREEN_TOUCHWIN is not set
 # CONFIG_TOUCHSCREEN_UCB1400 is not set
+# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set
 # CONFIG_INPUT_MISC is not set
 
 #
@@ -417,9 +464,11 @@ CONFIG_SERIO=y
 # 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
 
 #
@@ -439,7 +488,6 @@ CONFIG_UNIX98_PTYS=y
 CONFIG_LEGACY_PTYS=y
 CONFIG_LEGACY_PTY_COUNT=64
 # CONFIG_IPMI_HANDLER is not set
-# CONFIG_WATCHDOG is not set
 CONFIG_HW_RANDOM=y
 # CONFIG_DTLK is not set
 # CONFIG_R3964 is not set
@@ -454,39 +502,45 @@ CONFIG_HW_RANDOM=y
 # CONFIG_TCG_TPM is not set
 CONFIG_DEVPORT=y
 # CONFIG_I2C is not set
-
-#
-# SPI support
-#
 # CONFIG_SPI is not set
-# CONFIG_SPI_MASTER 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
+
+#
+# Sonics Silicon Backplane
+#
+CONFIG_SSB_POSSIBLE=y
+# 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
 
 #
 # Multimedia devices
 #
+
+#
+# Multimedia core support
+#
 # CONFIG_VIDEO_DEV is not set
-# CONFIG_DAB is not set
+# CONFIG_VIDEO_MEDIA is not set
 
 #
-# Graphics support
+# Multimedia drivers
 #
-CONFIG_BACKLIGHT_LCD_SUPPORT=y
-CONFIG_LCD_CLASS_DEVICE=y
-CONFIG_BACKLIGHT_CLASS_DEVICE=y
-CONFIG_BACKLIGHT_HP680=y
+# CONFIG_DAB is not set
 
 #
-# Display device support
+# Graphics support
 #
-# CONFIG_DISPLAY_SUPPORT is not set
 # CONFIG_VGASTATE is not set
 CONFIG_VIDEO_OUTPUT_CONTROL=y
 CONFIG_FB=y
@@ -495,11 +549,12 @@ CONFIG_FIRMWARE_EDID=y
 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_DEFERRED_IO=y
 # CONFIG_FB_SVGALIB is not set
 # CONFIG_FB_MACMODES is not set
 # CONFIG_FB_BACKLIGHT is not set
@@ -511,7 +566,20 @@ CONFIG_FB_DEFERRED_IO=y
 #
 # CONFIG_FB_S1D13XXX is not set
 CONFIG_FB_HIT=y
+CONFIG_FB_SH_MOBILE_LCDC=y
 # CONFIG_FB_VIRTUAL is not set
+CONFIG_BACKLIGHT_LCD_SUPPORT=y
+CONFIG_LCD_CLASS_DEVICE=y
+# CONFIG_LCD_ILI9320 is not set
+# CONFIG_LCD_PLATFORM is not set
+CONFIG_BACKLIGHT_CLASS_DEVICE=y
+# CONFIG_BACKLIGHT_CORGI is not set
+CONFIG_BACKLIGHT_HP680=y
+
+#
+# Display device support
+#
+# CONFIG_DISPLAY_SUPPORT is not set
 
 #
 # Console display driver support
@@ -533,15 +601,13 @@ CONFIG_FONT_PEARL_8x8=y
 # CONFIG_FONT_SUN12x22 is not set
 # CONFIG_FONT_10x18 is not set
 # CONFIG_LOGO is not set
-
-#
-# Sound
-#
 # CONFIG_SOUND is not set
 # CONFIG_HID_SUPPORT is not set
 # CONFIG_USB_SUPPORT 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
@@ -564,9 +630,10 @@ CONFIG_RTC_INTF_DEV=y
 #
 # Platform RTC drivers
 #
+# CONFIG_RTC_DRV_DS1511 is not set
 # CONFIG_RTC_DRV_DS1553 is not set
-# CONFIG_RTC_DRV_STK17TA8 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_M48T59 is not set
 # CONFIG_RTC_DRV_V3020 is not set
@@ -575,23 +642,7 @@ CONFIG_RTC_INTF_DEV=y
 # on-CPU RTC drivers
 #
 CONFIG_RTC_DRV_SH=y
-
-#
-# DMA Engine support
-#
-# CONFIG_DMA_ENGINE is not set
-
-#
-# DMA Clients
-#
-
-#
-# DMA Devices
-#
-
-#
-# Userspace I/O
-#
+# CONFIG_DMADEVICES is not set
 # CONFIG_UIO is not set
 
 #
@@ -606,13 +657,10 @@ CONFIG_EXT2_FS=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_MINIX_FS is not set
-# CONFIG_ROMFS_FS is not set
+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
@@ -643,7 +691,6 @@ CONFIG_SYSFS=y
 # CONFIG_TMPFS is not set
 # CONFIG_HUGETLBFS is not set
 # CONFIG_HUGETLB_PAGE is not set
-CONFIG_RAMFS=y
 # CONFIG_CONFIGFS_FS is not set
 
 #
@@ -658,8 +705,11 @@ CONFIG_RAMFS=y
 # CONFIG_EFS_FS is not set
 # CONFIG_CRAMFS 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
 
@@ -668,10 +718,6 @@ CONFIG_RAMFS=y
 #
 # CONFIG_PARTITION_ADVANCED is not set
 CONFIG_MSDOS_PARTITION=y
-
-#
-# Native Language Support
-#
 CONFIG_NLS=y
 CONFIG_NLS_DEFAULT="iso8859-1"
 # CONFIG_NLS_CODEPAGE_437 is not set
@@ -713,23 +759,22 @@ CONFIG_NLS_CODEPAGE_850=y
 # CONFIG_NLS_KOI8_U is not set
 # CONFIG_NLS_UTF8 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=1024
 # CONFIG_MAGIC_SYSRQ 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 is not set
+# CONFIG_DEBUG_MEMORY_INIT is not set
+# CONFIG_SAMPLES is not set
 # CONFIG_SH_STANDARD_BIOS is not set
 # CONFIG_EARLY_SCIF_CONSOLE is not set
 # CONFIG_SH_KGDB is not set
@@ -739,50 +784,95 @@ CONFIG_ENABLE_MUST_CHECK=y
 #
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
+# CONFIG_SECURITY_FILE_CAPABILITIES is not set
 CONFIG_CRYPTO=y
+
+#
+# Crypto core or helper
+#
 CONFIG_CRYPTO_ALGAPI=y
 CONFIG_CRYPTO_BLKCIPHER=y
 CONFIG_CRYPTO_MANAGER=y
+# CONFIG_CRYPTO_GF128MUL is not set
+# CONFIG_CRYPTO_NULL is not set
+# CONFIG_CRYPTO_CRYPTD is not set
+# CONFIG_CRYPTO_AUTHENC 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=y
+# CONFIG_CRYPTO_CTR is not set
+# CONFIG_CRYPTO_CTS is not set
+CONFIG_CRYPTO_ECB=y
+# CONFIG_CRYPTO_LRW is not set
+CONFIG_CRYPTO_PCBC=y
+# CONFIG_CRYPTO_XTS is not set
+
+#
+# Hash modes
+#
 # CONFIG_CRYPTO_HMAC is not set
 # CONFIG_CRYPTO_XCBC is not set
-# CONFIG_CRYPTO_NULL is not set
+
+#
+# Digest
+#
+# CONFIG_CRYPTO_CRC32C is not set
 # CONFIG_CRYPTO_MD4 is not set
 CONFIG_CRYPTO_MD5=y
+# 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_WP512 is not set
 # CONFIG_CRYPTO_TGR192 is not set
-# CONFIG_CRYPTO_GF128MUL is not set
-CONFIG_CRYPTO_ECB=y
-CONFIG_CRYPTO_CBC=y
-CONFIG_CRYPTO_PCBC=y
-# CONFIG_CRYPTO_LRW is not set
-# CONFIG_CRYPTO_CRYPTD is not set
-# CONFIG_CRYPTO_DES is not set
-# CONFIG_CRYPTO_FCRYPT is not set
-# CONFIG_CRYPTO_BLOWFISH is not set
-# CONFIG_CRYPTO_TWOFISH is not set
-# CONFIG_CRYPTO_SERPENT 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_TEA is not set
-# CONFIG_CRYPTO_ARC4 is not set
+# CONFIG_CRYPTO_DES is not set
+# CONFIG_CRYPTO_FCRYPT is not set
 # CONFIG_CRYPTO_KHAZAD is not set
-# CONFIG_CRYPTO_ANUBIS 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_MICHAEL_MIC is not set
-# CONFIG_CRYPTO_CRC32C is not set
-# CONFIG_CRYPTO_CAMELLIA is not set
+# CONFIG_CRYPTO_LZO is not set
 # CONFIG_CRYPTO_HW is not set
 
 #
 # Library routines
 #
 CONFIG_BITREVERSE=y
+# CONFIG_GENERIC_FIND_FIRST_BIT is not set
 # CONFIG_CRC_CCITT 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
index 38f934a..99cc39c 100644 (file)
@@ -1,44 +1,53 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.19
-# Thu Dec  7 17:13:04 2006
+# Linux kernel version: 2.6.26
+# Wed Jul 30 01:35:07 2008
 #
 CONFIG_SUPERH=y
+CONFIG_SUPERH32=y
+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_IRQ_PROBE=y
 CONFIG_GENERIC_CALIBRATE_DELAY=y
-# CONFIG_GENERIC_TIME is not set
+CONFIG_GENERIC_TIME=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_SYS_SUPPORTS_PCI=y
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_LOCKDEP_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_SUPPORTS_AOUT=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
 
 #
-# 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_AUTO=y
 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
 # CONFIG_IKCONFIG is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_CGROUPS is not set
+# CONFIG_GROUP_SCHED is not set
 CONFIG_SYSFS_DEPRECATED=y
+CONFIG_SYSFS_DEPRECATED_V2=y
 # CONFIG_RELAY is not set
-CONFIG_INITRAMFS_SOURCE=""
+# CONFIG_NAMESPACES is not set
+# CONFIG_BLK_DEV_INITRD is not set
 CONFIG_CC_OPTIMIZE_FOR_SIZE=y
 CONFIG_SYSCTL=y
 CONFIG_EMBEDDED=y
@@ -50,34 +59,48 @@ 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_SLAB=y
 CONFIG_VM_EVENT_COUNTERS=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_EFFICIENT_UNALIGNED_ACCESS is not set
+# CONFIG_HAVE_IOREMAP_PROT is not set
+# CONFIG_HAVE_KPROBES is not set
+# CONFIG_HAVE_KRETPROBES is not set
+# CONFIG_HAVE_ARCH_TRACEHOOK is not set
+# CONFIG_HAVE_DMA_ATTRS is not set
+# CONFIG_USE_GENERIC_SMP_HELPERS is not set
+CONFIG_HAVE_CLK=y
+CONFIG_PROC_PAGE_MONITOR=y
+CONFIG_SLABINFO=y
 CONFIG_RT_MUTEXES=y
 # CONFIG_TINY_SHMEM is not set
 CONFIG_BASE_SMALL=0
-# CONFIG_SLOB is not set
-
-#
-# Loadable module support
-#
 CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
 CONFIG_MODULE_UNLOAD=y
 CONFIG_MODULE_FORCE_UNLOAD=y
 # CONFIG_MODVERSIONS is not set
 # CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_KMOD=y
-
-#
-# Block layer
-#
 CONFIG_BLOCK=y
 # CONFIG_LBD is not set
 # CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_LSF is not set
+# CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
 
 #
 # IO Schedulers
@@ -91,67 +114,26 @@ CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_CFQ is not set
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_CLASSIC_RCU=y
 
 #
 # System type
 #
-# CONFIG_SH_SOLUTION_ENGINE is not set
-# CONFIG_SH_7751_SOLUTION_ENGINE is not set
-# CONFIG_SH_7300_SOLUTION_ENGINE is not set
-# CONFIG_SH_7343_SOLUTION_ENGINE is not set
-# CONFIG_SH_73180_SOLUTION_ENGINE is not set
-# CONFIG_SH_7751_SYSTEMH is not set
-# CONFIG_SH_HP6XX is not set
-# CONFIG_SH_EC3104 is not set
-# CONFIG_SH_SATURN is not set
-# CONFIG_SH_DREAMCAST is not set
-# CONFIG_SH_BIGSUR is not set
-# CONFIG_SH_MPC1211 is not set
-# CONFIG_SH_SH03 is not set
-# CONFIG_SH_SECUREEDGE5410 is not set
-# CONFIG_SH_HS7751RVOIP is not set
-# CONFIG_SH_7710VOIPGW is not set
-# CONFIG_SH_RTS7751R2D is not set
-# CONFIG_SH_R7780RP is not set
-# CONFIG_SH_EDOSK7705 is not set
-# CONFIG_SH_SH4202_MICRODEV is not set
-CONFIG_SH_LANDISK=y
-# CONFIG_SH_TITAN is not set
-# CONFIG_SH_SHMIN is not set
-# CONFIG_SH_7206_SOLUTION_ENGINE is not set
-# CONFIG_SH_7619_SOLUTION_ENGINE is not set
-# CONFIG_SH_UNKNOWN is not set
-
-#
-# Processor selection
-#
 CONFIG_CPU_SH4=y
-
-#
-# SH-2 Processor Support
-#
-# CONFIG_CPU_SUBTYPE_SH7604 is not set
 # CONFIG_CPU_SUBTYPE_SH7619 is not set
-
-#
-# SH-2A Processor Support
-#
+# CONFIG_CPU_SUBTYPE_SH7203 is not set
 # CONFIG_CPU_SUBTYPE_SH7206 is not set
-
-#
-# SH-3 Processor Support
-#
-# CONFIG_CPU_SUBTYPE_SH7300 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
-
-#
-# SH-4 Processor Support
-#
+# 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
@@ -160,53 +142,60 @@ CONFIG_CPU_SH4=y
 CONFIG_CPU_SUBTYPE_SH7751R=y
 # CONFIG_CPU_SUBTYPE_SH7760 is not set
 # CONFIG_CPU_SUBTYPE_SH4_202 is not set
-
-#
-# ST40 Processor Support
-#
-# CONFIG_CPU_SUBTYPE_ST40STB1 is not set
-# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
-
-#
-# SH-4A Processor Support
-#
+# CONFIG_CPU_SUBTYPE_SH7723 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
-
-#
-# SH4AL-DSP Processor Support
-#
-# CONFIG_CPU_SUBTYPE_SH73180 is not set
+# 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
+# CONFIG_CPU_SUBTYPE_SH5_101 is not set
+# CONFIG_CPU_SUBTYPE_SH5_103 is not set
 
 #
 # Memory management options
 #
+CONFIG_QUICKLIST=y
 CONFIG_MMU=y
 CONFIG_PAGE_OFFSET=0x80000000
 CONFIG_MEMORY_START=0x0c000000
 CONFIG_MEMORY_SIZE=0x04000000
+CONFIG_29BIT=y
 CONFIG_VSYSCALL=y
+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_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_ENTRY_OFFSET=0x00001000
 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_SPARSEMEM_STATIC=y
+# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
+CONFIG_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
 # CONFIG_RESOURCES_64BIT is not set
+CONFIG_ZONE_DMA_FLAG=0
+CONFIG_NR_QUICK=2
 
 #
 # Cache configuration
 #
 # CONFIG_SH_DIRECT_MAPPED is not set
-# CONFIG_SH_WRITETHROUGH is not set
-# CONFIG_SH_OCRAM is not set
+CONFIG_CACHE_WRITEBACK=y
+# CONFIG_CACHE_WRITETHROUGH is not set
+# CONFIG_CACHE_OFF is not set
 
 #
 # Processor features
@@ -214,19 +203,32 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
 CONFIG_CPU_LITTLE_ENDIAN=y
 # CONFIG_CPU_BIG_ENDIAN is not set
 CONFIG_SH_FPU=y
-# CONFIG_SH_DSP is not set
 # CONFIG_SH_STORE_QUEUES is not set
 CONFIG_CPU_HAS_INTEVT=y
-CONFIG_CPU_HAS_INTC_IRQ=y
 CONFIG_CPU_HAS_SR_RB=y
 CONFIG_CPU_HAS_PTEA=y
+CONFIG_CPU_HAS_FPU=y
 
 #
-# Timer support
+# Board support
+#
+# CONFIG_SH_7751_SYSTEMH is not set
+# CONFIG_SH_SECUREEDGE5410 is not set
+# CONFIG_SH_RTS7751R2D is not set
+CONFIG_SH_LANDISK=y
+# CONFIG_SH_TITAN is not set
+# CONFIG_SH_LBOX_RE2 is not set
+
+#
+# Timer and clock configuration
 #
 CONFIG_SH_TMU=y
 CONFIG_SH_TIMER_IRQ=16
 CONFIG_SH_PCLK_FREQ=33333333
+# CONFIG_TICK_ONESHOT is not set
+# CONFIG_NO_HZ is not set
+# CONFIG_HIGH_RES_TIMERS is not set
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
 
 #
 # CPU Frequency scaling
@@ -241,12 +243,11 @@ CONFIG_SH_PCLK_FREQ=33333333
 #
 # Companion Chips
 #
-# CONFIG_HD6446X_SERIES is not set
-CONFIG_HEARTBEAT=y
 
 #
 # Additional SuperH Device Drivers
 #
+CONFIG_HEARTBEAT=y
 # CONFIG_PUSH_SWITCH is not set
 
 #
@@ -254,13 +255,17 @@ CONFIG_HEARTBEAT=y
 #
 # 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 is not set
 CONFIG_KEXEC=y
-# CONFIG_SMP is not set
+# CONFIG_CRASH_DUMP is not set
 CONFIG_PREEMPT_NONE=y
 # CONFIG_PREEMPT_VOLUNTARY is not set
 # CONFIG_PREEMPT is not set
+CONFIG_GUSA=y
+# CONFIG_GUSA_RB is not set
 
 #
 # Boot options
@@ -273,16 +278,12 @@ CONFIG_BOOT_LINK_OFFSET=0x00800000
 #
 # Bus options
 #
-CONFIG_ISA=y
 CONFIG_PCI=y
 CONFIG_SH_PCIDMA_NONCOHERENT=y
 CONFIG_PCI_AUTO=y
 CONFIG_PCI_AUTO_UPDATE_RESOURCES=y
-# CONFIG_PCI_MULTITHREAD_PROBE is not set
-
-#
-# PCCARD (PCMCIA/CardBus) support
-#
+# CONFIG_ARCH_SUPPORTS_MSI is not set
+CONFIG_PCI_LEGACY=y
 CONFIG_PCCARD=y
 # CONFIG_PCMCIA_DEBUG is not set
 CONFIG_PCMCIA=y
@@ -301,28 +302,15 @@ CONFIG_YENTA_ENE_TUNE=y
 CONFIG_YENTA_TOSHIBA=y
 # CONFIG_PD6729 is not set
 # CONFIG_I82092 is not set
-# CONFIG_I82365 is not set
-# CONFIG_TCIC is not set
-CONFIG_PCMCIA_PROBE=y
 CONFIG_PCCARD_NONSTATIC=y
-
-#
-# PCI Hotplug Support
-#
 # CONFIG_HOTPLUG_PCI is not set
 
 #
 # Executable file formats
 #
 CONFIG_BINFMT_ELF=y
-# CONFIG_BINFMT_FLAT is not set
 # CONFIG_BINFMT_MISC is not set
 
-#
-# Power management options (EXPERIMENTAL)
-#
-# CONFIG_PM is not set
-
 #
 # Networking
 #
@@ -331,13 +319,14 @@ 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 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 is not set
 CONFIG_INET=y
 # CONFIG_IP_MULTICAST is not set
@@ -364,49 +353,36 @@ CONFIG_IP_PNP=y
 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
-
-#
-# IP: Virtual Server Configuration
-#
 # CONFIG_IP_VS is not set
 # CONFIG_IPV6 is not set
-# CONFIG_INET6_XFRM_TUNNEL is not set
-# CONFIG_INET6_TUNNEL is not set
 # CONFIG_NETWORK_SECMARK is not set
 CONFIG_NETFILTER=y
 # CONFIG_NETFILTER_DEBUG is not set
+CONFIG_NETFILTER_ADVANCED=y
 
 #
 # Core Netfilter Configuration
 #
-# CONFIG_NETFILTER_NETLINK is not set
-# CONFIG_NF_CONNTRACK_ENABLED is not set
+# CONFIG_NETFILTER_NETLINK_QUEUE is not set
+# CONFIG_NETFILTER_NETLINK_LOG is not set
+# CONFIG_NF_CONNTRACK is not set
 # CONFIG_NETFILTER_XTABLES is not set
 
 #
 # IP: Netfilter Configuration
 #
 CONFIG_IP_NF_QUEUE=m
-
-#
-# DCCP Configuration (EXPERIMENTAL)
-#
+# CONFIG_IP_NF_IPTABLES is not set
+# CONFIG_IP_NF_ARPTABLES is not set
 # CONFIG_IP_DCCP is not set
-
-#
-# SCTP Configuration (EXPERIMENTAL)
-#
 # CONFIG_IP_SCTP is not set
-
-#
-# TIPC Configuration (EXPERIMENTAL)
-#
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
@@ -421,10 +397,6 @@ CONFIG_ATALK=m
 # CONFIG_LAPB is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-
-#
-# QoS and/or fair queueing
-#
 # CONFIG_NET_SCHED is not set
 
 #
@@ -432,9 +404,20 @@ CONFIG_ATALK=m
 #
 # 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 is not set
+# CONFIG_WIRELESS_EXT is not set
+# CONFIG_MAC80211 is not set
 # CONFIG_IEEE80211 is not set
+# CONFIG_RFKILL is not set
+# CONFIG_NET_9P is not set
 
 #
 # Device Drivers
@@ -443,35 +426,17 @@ CONFIG_ATALK=m
 #
 # Generic Driver Options
 #
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 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
-
-#
-# Connector - unified userspace <-> kernelspace linker
-#
 # CONFIG_CONNECTOR is not set
-
-#
-# Memory Technology Devices (MTD)
-#
 # CONFIG_MTD is not set
-
-#
-# Parallel port support
-#
 # CONFIG_PARPORT is not set
-
-#
-# Plug and Play support
-#
-# CONFIG_PNP is not set
-
-#
-# Block devices
-#
-# CONFIG_BLK_CPQ_DA 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
@@ -484,63 +449,66 @@ CONFIG_BLK_DEV_LOOP=y
 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_BLK_DEV_XIP is not set
 # CONFIG_CDROM_PKTCDVD is not set
 # CONFIG_ATA_OVER_ETH is not set
-
-#
-# Misc devices
-#
+# 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
-
-#
-# ATA/ATAPI/MFM/RLL support
-#
+# CONFIG_ENCLOSURE_SERVICES is not set
+# CONFIG_HP_ILO 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_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 is not set
+# CONFIG_BLK_DEV_DELKIN is not set
 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=y
 # CONFIG_IDE_TASK_IOCTL is not set
+CONFIG_IDE_PROC_FS=y
 
 #
 # IDE chipset support/bugfixes
 #
-CONFIG_IDE_GENERIC=y
+# 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=y
+CONFIG_IDEPCI_PCIBUS_ORDER=y
 CONFIG_BLK_DEV_OFFBOARD=y
 CONFIG_BLK_DEV_GENERIC=y
 # 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=y
-CONFIG_IDEDMA_ONLYDISK=y
 CONFIG_BLK_DEV_AEC62XX=y
 # 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_JMICRON is not set
 # CONFIG_BLK_DEV_SC1200 is not set
 # CONFIG_BLK_DEV_PIIX 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
@@ -550,18 +518,15 @@ CONFIG_BLK_DEV_AEC62XX=y
 # CONFIG_BLK_DEV_SLC90E66 is not set
 # CONFIG_BLK_DEV_TRM290 is not set
 # CONFIG_BLK_DEV_VIA82CXXX is not set
-# CONFIG_IDE_ARM is not set
-# CONFIG_IDE_CHIPSETS is not set
+# CONFIG_BLK_DEV_TC86C001 is not set
 CONFIG_BLK_DEV_IDEDMA=y
-# CONFIG_IDEDMA_IVB is not set
-CONFIG_IDEDMA_AUTO=y
-# CONFIG_BLK_DEV_HD 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
@@ -583,6 +548,7 @@ CONFIG_SCSI_MULTI_LUN=y
 # 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
@@ -590,77 +556,43 @@ CONFIG_SCSI_MULTI_LUN=y
 # 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_SCSI_SRP_ATTRS is not set
+CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_ISCSI_TCP is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
 # CONFIG_SCSI_3W_9XXX is not set
 # CONFIG_SCSI_ACARD is not set
-# CONFIG_SCSI_AHA152X 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_DPT_I2O is not set
-# CONFIG_SCSI_IN2000 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_HPTIOP is not set
 # CONFIG_SCSI_DMX3191D is not set
-# CONFIG_SCSI_DTC3280 is not set
 # CONFIG_SCSI_FUTURE_DOMAIN is not set
-# CONFIG_SCSI_GENERIC_NCR5380 is not set
-# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
 # CONFIG_SCSI_IPS is not set
 # CONFIG_SCSI_INITIO is not set
 # CONFIG_SCSI_INIA100 is not set
-# CONFIG_SCSI_NCR53C406A is not set
+# CONFIG_SCSI_MVSAS is not set
 # CONFIG_SCSI_STEX is not set
 # CONFIG_SCSI_SYM53C8XX_2 is not set
-# CONFIG_SCSI_PAS16 is not set
-# CONFIG_SCSI_PSI240I is not set
-# CONFIG_SCSI_QLOGIC_FAS 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_SYM53C416 is not set
 # CONFIG_SCSI_DC395x is not set
 # CONFIG_SCSI_DC390T is not set
-# CONFIG_SCSI_T128 is not set
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_SRP 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_SCSI_LOWLEVEL_PCMCIA is not set
+# CONFIG_SCSI_DH is not set
 # CONFIG_ATA is not set
-
-#
-# Old CD-ROM drivers (not SCSI, not IDE)
-#
-# CONFIG_CD_NO_IDESCSI is not set
-
-#
-# Multi-device support (RAID and LVM)
-#
 CONFIG_MD=y
 CONFIG_BLK_DEV_MD=m
 CONFIG_MD_LINEAR=m
@@ -671,76 +603,49 @@ CONFIG_MD_RAID1=m
 # CONFIG_MD_MULTIPATH is not set
 # CONFIG_MD_FAULTY is not set
 # CONFIG_BLK_DEV_DM is not set
-
-#
-# Fusion MPT device 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
 #
-# CONFIG_IEEE1394 is not set
 
 #
-# I2O device support
+# Enable only one of the two stacks, unless you know what you are doing
 #
+# CONFIG_FIREWIRE is not set
+# CONFIG_IEEE1394 is not set
 # CONFIG_I2O is not set
-
-#
-# 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=m
-
-#
-# ARCnet devices
-#
+# CONFIG_VETH is not set
 # CONFIG_ARCNET is not set
-
-#
-# PHY device support
-#
 # CONFIG_PHYLIB is not set
-
-#
-# Ethernet (10 or 100Mbit)
-#
 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_NET_VENDOR_SMC is not set
 # CONFIG_SMC91X is not set
-# CONFIG_NET_VENDOR_RACAL is not set
-
-#
-# Tulip family network device support
-#
+# CONFIG_SMC911X is not set
 # CONFIG_NET_TULIP is not set
-# CONFIG_AT1700 is not set
-# CONFIG_DEPCA is not set
 # CONFIG_HP100 is not set
-# CONFIG_NET_ISA 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_NET_PCI=y
 # CONFIG_PCNET32 is not set
 # CONFIG_AMD8111_ETH is not set
 # CONFIG_ADAPTEC_STARFIRE is not set
-# CONFIG_AC3200 is not set
-# CONFIG_APRICOT is not set
 # CONFIG_B44 is not set
 # CONFIG_FORCEDETH is not set
-# CONFIG_CS89x0 is not set
-# CONFIG_DGRS is not set
 # CONFIG_EEPRO100 is not set
 # CONFIG_E100 is not set
 # CONFIG_FEALNX is not set
@@ -748,18 +653,20 @@ CONFIG_NET_PCI=y
 # CONFIG_NE2K_PCI is not set
 CONFIG_8139CP=y
 # CONFIG_8139TOO is not set
+# CONFIG_R6040 is not set
 # CONFIG_SIS900 is not set
 # CONFIG_EPIC100 is not set
 # CONFIG_SUNDANCE is not set
 # CONFIG_TLAN is not set
 # CONFIG_VIA_RHINE is not set
-
-#
-# Ethernet (1000 Mbit)
-#
+# CONFIG_SC92031 is not set
+CONFIG_NETDEV_1000=y
 # CONFIG_ACENIC is not set
 # CONFIG_DL2K is not set
 # CONFIG_E1000 is not set
+# CONFIG_E1000E is not set
+# CONFIG_IP1000 is not set
+# CONFIG_IGB is not set
 # CONFIG_NS83820 is not set
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
@@ -767,58 +674,53 @@ CONFIG_8139CP=y
 # CONFIG_SIS190 is not set
 # CONFIG_SKGE is not set
 # CONFIG_SKY2 is not set
-# CONFIG_SK98LIN is not set
 # CONFIG_VIA_VELOCITY is not set
 # CONFIG_TIGON3 is not set
 # CONFIG_BNX2 is not set
 # CONFIG_QLA3XXX is not set
-
-#
-# Ethernet (10000 Mbit)
-#
+# CONFIG_ATL1 is not set
+# CONFIG_ATL1E is not set
+CONFIG_NETDEV_10000=y
 # CONFIG_CHELSIO_T1 is not set
+# CONFIG_CHELSIO_T3 is not set
+# CONFIG_IXGBE is not set
 # CONFIG_IXGB is not set
 # CONFIG_S2IO is not set
 # CONFIG_MYRI10GE is not set
 # CONFIG_NETXEN_NIC is not set
-
-#
-# Token Ring devices
-#
+# CONFIG_NIU is not set
+# CONFIG_MLX4_CORE is not set
+# CONFIG_TEHUTI is not set
+# CONFIG_BNX2X is not set
+# CONFIG_SFC is not set
 # CONFIG_TR is not set
 
 #
-# Wireless LAN (non-hamradio)
+# Wireless LAN
 #
-# CONFIG_NET_RADIO is not set
+# CONFIG_WLAN_PRE80211 is not set
+# CONFIG_WLAN_80211 is not set
+# CONFIG_IWLWIFI_LEDS 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=m
+CONFIG_USB_RTL8150=m
+# 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 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
-
-#
-# ISDN subsystem
-#
 # CONFIG_ISDN is not set
-
-#
-# Telephony Support
-#
 # CONFIG_PHONE is not set
 
 #
@@ -826,6 +728,7 @@ CONFIG_8139CP=y
 #
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
+# CONFIG_INPUT_POLLDEV is not set
 
 #
 # Userland interfaces
@@ -835,7 +738,6 @@ CONFIG_INPUT_MOUSEDEV=y
 CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
 CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
 # CONFIG_INPUT_JOYDEV is not set
-# CONFIG_INPUT_TSDEV is not set
 # CONFIG_INPUT_EVDEV is not set
 # CONFIG_INPUT_EVBUG is not set
 
@@ -845,6 +747,7 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
 # 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
 
@@ -858,10 +761,13 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
 # 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
@@ -880,22 +786,10 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_UNIX98_PTYS=y
 CONFIG_LEGACY_PTYS=y
 CONFIG_LEGACY_PTY_COUNT=256
-
-#
-# IPMI
-#
 # CONFIG_IPMI_HANDLER is not set
-
-#
-# Watchdog Cards
-#
-# CONFIG_WATCHDOG is not set
 CONFIG_HW_RANDOM=y
-# 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
@@ -903,65 +797,77 @@ CONFIG_HW_RANDOM=y
 # 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
-#
 # CONFIG_W1 is not set
-
-#
-# Hardware Monitoring support
-#
+# CONFIG_POWER_SUPPLY is not set
 CONFIG_HWMON=y
 # CONFIG_HWMON_VID is not set
-# CONFIG_SENSORS_ABITUGURU is not set
+# CONFIG_SENSORS_I5K_AMB is not set
 # CONFIG_SENSORS_F71805F is not set
+# CONFIG_SENSORS_F71882FG is not set
+# CONFIG_SENSORS_IT87 is not set
+# CONFIG_SENSORS_PC87360 is not set
+# CONFIG_SENSORS_PC87427 is not set
+# CONFIG_SENSORS_SIS5595 is not set
+# CONFIG_SENSORS_SMSC47M1 is not set
+# CONFIG_SENSORS_SMSC47B397 is not set
+# CONFIG_SENSORS_VIA686A is not set
 # CONFIG_SENSORS_VT1211 is not set
+# 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
+
+#
+# Sonics Silicon Backplane
+#
+CONFIG_SSB_POSSIBLE=y
+# 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
 
 #
 # Multimedia devices
 #
-CONFIG_VIDEO_DEV=m
-CONFIG_VIDEO_V4L1=y
-CONFIG_VIDEO_V4L1_COMPAT=y
-CONFIG_VIDEO_V4L2=y
 
 #
-# Video Capture Adapters
+# Multimedia core support
 #
+CONFIG_VIDEO_DEV=m
+CONFIG_VIDEO_V4L2_COMMON=m
+CONFIG_VIDEO_ALLOW_V4L1=y
+CONFIG_VIDEO_V4L1_COMPAT=y
+# CONFIG_DVB_CORE is not set
+CONFIG_VIDEO_MEDIA=m
 
 #
-# Video Capture Adapters
+# Multimedia drivers
 #
+# CONFIG_MEDIA_ATTACH is not set
+CONFIG_VIDEO_V4L2=m
+CONFIG_VIDEO_V4L1=m
+CONFIG_VIDEO_CAPTURE_DRIVERS=y
 # CONFIG_VIDEO_ADV_DEBUG is not set
 CONFIG_VIDEO_HELPER_CHIPS_AUTO=y
 # CONFIG_VIDEO_VIVI is not set
-# CONFIG_VIDEO_PMS is not set
 # CONFIG_VIDEO_CPIA is not set
 # CONFIG_VIDEO_CPIA2 is not set
-# CONFIG_VIDEO_STRADIS is not set
-
-#
-# V4L USB devices
-#
+CONFIG_V4L_USB_DRIVERS=y
+# CONFIG_USB_VIDEO_CLASS is not set
+# CONFIG_USB_GSPCA is not set
 CONFIG_VIDEO_USBVIDEO=m
 CONFIG_USB_VICAM=m
 CONFIG_USB_IBMCAM=m
@@ -975,106 +881,100 @@ CONFIG_USB_STV680=m
 # CONFIG_USB_ZC0301 is not set
 CONFIG_USB_PWC=m
 # CONFIG_USB_PWC_DEBUG is not set
-
-#
-# Radio Adapters
-#
-# CONFIG_RADIO_CADET is not set
-# CONFIG_RADIO_RTRACK is not set
-# CONFIG_RADIO_RTRACK2 is not set
-# CONFIG_RADIO_AZTECH is not set
-# CONFIG_RADIO_GEMTEK is not set
+# CONFIG_USB_ZR364XX is not set
+# CONFIG_USB_STKWEBCAM is not set
+# CONFIG_USB_S2255 is not set
+# CONFIG_SOC_CAMERA is not set
+# CONFIG_VIDEO_SH_MOBILE_CEU is not set
+CONFIG_RADIO_ADAPTERS=y
 # CONFIG_RADIO_GEMTEK_PCI is not set
 # CONFIG_RADIO_MAXIRADIO is not set
 # CONFIG_RADIO_MAESTRO is not set
-# CONFIG_RADIO_SF16FMI is not set
-# CONFIG_RADIO_SF16FMR2 is not set
-# CONFIG_RADIO_TERRATEC is not set
-# CONFIG_RADIO_TRUST is not set
-# CONFIG_RADIO_TYPHOON is not set
-# CONFIG_RADIO_ZOLTRIX is not set
 CONFIG_USB_DSBR=m
+# CONFIG_USB_SI470X is not set
+# CONFIG_DAB is not set
 
 #
-# Digital Video Broadcasting Devices
+# Graphics support
 #
-# CONFIG_DVB is not set
-CONFIG_USB_DABUSB=m
+# 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
 
 #
-# Graphics support
+# Display device support
 #
-CONFIG_FIRMWARE_EDID=y
-# CONFIG_FB is not set
+# CONFIG_DISPLAY_SUPPORT is not set
 
 #
 # Console display driver support
 #
-# CONFIG_MDA_CONSOLE is not set
 CONFIG_DUMMY_CONSOLE=y
 CONFIG_FONT_8x16=y
-# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
-
-#
-# Sound
-#
 CONFIG_SOUND=m
-
-#
-# Advanced Linux Sound Architecture
-#
 # CONFIG_SND is not set
+CONFIG_SOUND_PRIME=m
+CONFIG_HID_SUPPORT=y
+CONFIG_HID=y
+# CONFIG_HID_DEBUG is not set
+# CONFIG_HIDRAW is not set
 
 #
-# Open Sound System
+# USB Input Devices
 #
-CONFIG_SOUND_PRIME=m
-# CONFIG_OSS_OBSOLETE_DRIVER is not set
-# CONFIG_SOUND_BT878 is not set
-# CONFIG_SOUND_ES1371 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_USB_HID=m
+# CONFIG_USB_HIDINPUT_POWERBOOK is not set
+# CONFIG_HID_FF is not set
+# CONFIG_USB_HIDDEV is not set
 
 #
-# USB support
+# USB HID Boot Protocol drivers
 #
+# CONFIG_USB_KBD is not set
+# CONFIG_USB_MOUSE 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=y
-# CONFIG_USB_BANDWIDTH is not set
+CONFIG_USB_DEVICE_CLASS=y
 # CONFIG_USB_DYNAMIC_MINORS is not set
-# CONFIG_USB_MULTITHREAD_PROBE is not set
 # CONFIG_USB_OTG is not set
+# CONFIG_USB_OTG_WHITELIST is not set
+# CONFIG_USB_OTG_BLACKLIST_HUB is not set
 
 #
 # USB Host Controller Drivers
 #
+# CONFIG_USB_C67X00_HCD is not set
 CONFIG_USB_EHCI_HCD=y
-# CONFIG_USB_EHCI_SPLIT_ISO is not set
 # CONFIG_USB_EHCI_ROOT_HUB_TT is not set
 # CONFIG_USB_EHCI_TT_NEWSCHED is not set
 # CONFIG_USB_ISP116X_HCD is not set
+# CONFIG_USB_ISP1760_HCD is not set
 CONFIG_USB_OHCI_HCD=y
-# CONFIG_USB_OHCI_BIG_ENDIAN is not set
+# 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
 
 #
 # USB Device Class drivers
 #
 # CONFIG_USB_ACM is not set
 CONFIG_USB_PRINTER=m
+# CONFIG_USB_WDM is not set
 
 #
 # NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
@@ -1094,66 +994,28 @@ CONFIG_USB_STORAGE_SDDR09=y
 CONFIG_USB_STORAGE_SDDR55=y
 CONFIG_USB_STORAGE_JUMPSHOT=y
 # 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 Input Devices
-#
-CONFIG_USB_HID=m
-CONFIG_USB_HIDINPUT=y
-# CONFIG_USB_HIDINPUT_POWERBOOK is not set
-# CONFIG_HID_FF is not set
-# CONFIG_USB_HIDDEV is not set
-
-#
-# USB HID Boot Protocol drivers
-#
-# CONFIG_USB_KBD is not set
-# CONFIG_USB_MOUSE 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 is not set
-# 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
-
 #
 # USB Imaging devices
 #
 # CONFIG_USB_MDC800 is not set
 # CONFIG_USB_MICROTEK is not set
-
-#
-# USB Network Adapters
-#
-# CONFIG_USB_CATC is not set
-# CONFIG_USB_KAWETH is not set
-CONFIG_USB_PEGASUS=m
-CONFIG_USB_RTL8150=m
-# 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=m
+# CONFIG_USB_EZUSB is not set
 # CONFIG_USB_SERIAL_GENERIC is not set
 # CONFIG_USB_SERIAL_AIRCABLE is not set
-# CONFIG_USB_SERIAL_AIRPRIME is not set
 # CONFIG_USB_SERIAL_ARK3116 is not set
 # CONFIG_USB_SERIAL_BELKIN is not set
+# CONFIG_USB_SERIAL_CH341 is not set
 # CONFIG_USB_SERIAL_WHITEHEAT is not set
 # CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set
 # CONFIG_USB_SERIAL_CP2101 is not set
@@ -1168,6 +1030,7 @@ CONFIG_USB_SERIAL_FTDI_SIO=m
 # CONFIG_USB_SERIAL_EDGEPORT_TI is not set
 # CONFIG_USB_SERIAL_GARMIN is not set
 # CONFIG_USB_SERIAL_IPW is not set
+# CONFIG_USB_SERIAL_IUU is not set
 # CONFIG_USB_SERIAL_KEYSPAN_PDA is not set
 # CONFIG_USB_SERIAL_KEYSPAN is not set
 # CONFIG_USB_SERIAL_KLSI is not set
@@ -1175,8 +1038,11 @@ CONFIG_USB_SERIAL_FTDI_SIO=m
 # CONFIG_USB_SERIAL_MCT_U232 is not set
 # CONFIG_USB_SERIAL_MOS7720 is not set
 # CONFIG_USB_SERIAL_MOS7840 is not set
+# CONFIG_USB_SERIAL_MOTOROLA is not set
 # CONFIG_USB_SERIAL_NAVMAN is not set
 CONFIG_USB_SERIAL_PL2303=m
+# CONFIG_USB_SERIAL_OTI6858 is not set
+# CONFIG_USB_SERIAL_SPCP8X5 is not set
 # CONFIG_USB_SERIAL_HP4X is not set
 # CONFIG_USB_SERIAL_SAFE is not set
 # CONFIG_USB_SERIAL_SIERRAWIRELESS is not set
@@ -1197,6 +1063,7 @@ CONFIG_USB_EMI26=m
 # 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
@@ -1208,61 +1075,18 @@ CONFIG_USB_SISUSBVGA=m
 CONFIG_USB_SISUSBVGA_CON=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
-
-#
-# USB DSL modem support
-#
-
-#
-# USB Gadget Support
-#
+# CONFIG_USB_ISIGHTFW is not set
 # CONFIG_USB_GADGET is not set
-
-#
-# MMC/SD Card support
-#
 # 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
-
-#
-# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
-#
-
-#
-# Real Time Clock
-#
 # CONFIG_RTC_CLASS is not set
-
-#
-# DMA Engine support
-#
-# CONFIG_DMA_ENGINE is not set
-
-#
-# DMA Clients
-#
-
-#
-# DMA Devices
-#
+# CONFIG_DMADEVICES is not set
+# CONFIG_UIO is not set
 
 #
 # File systems
@@ -1276,7 +1100,6 @@ CONFIG_EXT3_FS_XATTR=y
 # CONFIG_EXT3_FS_SECURITY is not set
 # CONFIG_EXT4DEV_FS is not set
 CONFIG_JBD=y
-# CONFIG_JBD_DEBUG is not set
 CONFIG_FS_MBCACHE=y
 CONFIG_REISERFS_FS=y
 # CONFIG_REISERFS_CHECK is not set
@@ -1285,14 +1108,11 @@ CONFIG_REISERFS_FS=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=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
@@ -1328,7 +1148,6 @@ CONFIG_TMPFS=y
 # CONFIG_TMPFS_POSIX_ACL is not set
 # CONFIG_HUGETLBFS is not set
 # CONFIG_HUGETLB_PAGE is not set
-CONFIG_RAMFS=y
 # CONFIG_CONFIGFS_FS is not set
 
 #
@@ -1343,26 +1162,24 @@ CONFIG_RAMFS=y
 # CONFIG_EFS_FS is not set
 # CONFIG_CRAMFS 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=y
 # CONFIG_SYSV_FS is not set
 CONFIG_UFS_FS=m
 # CONFIG_UFS_FS_WRITE is not set
 # CONFIG_UFS_DEBUG is not set
-
-#
-# Network File Systems
-#
+CONFIG_NETWORK_FILESYSTEMS=y
 CONFIG_NFS_FS=m
 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=y
 # CONFIG_NFSD_V3_ACL is not set
 # CONFIG_NFSD_V4 is not set
-CONFIG_NFSD_TCP=y
 CONFIG_LOCKD=m
 CONFIG_LOCKD_V4=y
 CONFIG_EXPORTFS=m
@@ -1376,17 +1193,12 @@ CONFIG_SMB_FS=m
 # CONFIG_NCP_FS is not set
 # CONFIG_CODA_FS is not set
 # CONFIG_AFS_FS is not set
-# CONFIG_9P_FS is not set
 
 #
 # Partition Types
 #
 # CONFIG_PARTITION_ADVANCED is not set
 CONFIG_MSDOS_PARTITION=y
-
-#
-# Native Language Support
-#
 CONFIG_NLS=y
 CONFIG_NLS_DEFAULT="iso8859-1"
 CONFIG_NLS_CODEPAGE_437=y
@@ -1427,46 +1239,128 @@ CONFIG_NLS_CODEPAGE_932=y
 # CONFIG_NLS_KOI8_R is not set
 # CONFIG_NLS_KOI8_U is not set
 # CONFIG_NLS_UTF8 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_UNUSED_SYMBOLS is not set
-# CONFIG_DEBUG_KERNEL is not set
-CONFIG_LOG_BUF_SHIFT=14
-# CONFIG_DEBUG_BUGVERBOSE is not set
 # 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_MEMORY_INIT is not set
+# CONFIG_SAMPLES is not set
 CONFIG_SH_STANDARD_BIOS=y
 # CONFIG_EARLY_SCIF_CONSOLE is not set
 # CONFIG_EARLY_PRINTK is not set
-# CONFIG_KGDB is not set
+# CONFIG_SH_KGDB is not set
 
 #
 # Security options
 #
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
+# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+CONFIG_CRYPTO=y
+
+#
+# Crypto core or helper
+#
+# CONFIG_CRYPTO_MANAGER 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
+
+#
+# Digest
+#
+# CONFIG_CRYPTO_CRC32C 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
 
 #
-# Cryptographic options
+# Compression
 #
-# CONFIG_CRYPTO is not set
+# CONFIG_CRYPTO_DEFLATE is not set
+# CONFIG_CRYPTO_LZO is not set
+CONFIG_CRYPTO_HW=y
+# CONFIG_CRYPTO_DEV_HIFN_795X is not set
 
 #
 # Library routines
 #
+CONFIG_BITREVERSE=y
+# CONFIG_GENERIC_FIND_FIRST_BIT is not set
 # CONFIG_CRC_CCITT is not set
 # CONFIG_CRC16 is not set
+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_PLIST=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
index b68b6cd..aecdfd3 100644 (file)
@@ -1,9 +1,11 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.21-rc4
-# Sat Mar 24 22:04:27 2007
+# Linux kernel version: 2.6.26
+# Wed Jul 30 01:39:41 2008
 #
 CONFIG_SUPERH=y
+CONFIG_SUPERH32=y
+CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
 CONFIG_GENERIC_BUG=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -11,37 +13,40 @@ CONFIG_GENERIC_HWEIGHT=y
 CONFIG_GENERIC_HARDIRQS=y
 CONFIG_GENERIC_IRQ_PROBE=y
 CONFIG_GENERIC_CALIBRATE_DELAY=y
-# CONFIG_GENERIC_TIME is not set
+CONFIG_GENERIC_TIME=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_SYS_SUPPORTS_PCI=y
 CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_LOCKDEP_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_SUPPORTS_AOUT=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
 
 #
-# 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_AUTO=y
 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
 # CONFIG_IKCONFIG is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_CGROUPS is not set
+# CONFIG_GROUP_SCHED is not set
 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_CC_OPTIMIZE_FOR_SIZE=y
 CONFIG_SYSCTL=y
@@ -54,34 +59,48 @@ 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_SLAB=y
 CONFIG_VM_EVENT_COUNTERS=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_EFFICIENT_UNALIGNED_ACCESS is not set
+# CONFIG_HAVE_IOREMAP_PROT is not set
+# CONFIG_HAVE_KPROBES is not set
+# CONFIG_HAVE_KRETPROBES is not set
+# CONFIG_HAVE_ARCH_TRACEHOOK is not set
+# CONFIG_HAVE_DMA_ATTRS is not set
+# CONFIG_USE_GENERIC_SMP_HELPERS is not set
+CONFIG_HAVE_CLK=y
+CONFIG_PROC_PAGE_MONITOR=y
+CONFIG_SLABINFO=y
 CONFIG_RT_MUTEXES=y
 # CONFIG_TINY_SHMEM is not set
 CONFIG_BASE_SMALL=0
-# CONFIG_SLOB is not set
-
-#
-# Loadable module support
-#
 CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
 CONFIG_MODULE_UNLOAD=y
 CONFIG_MODULE_FORCE_UNLOAD=y
 # CONFIG_MODVERSIONS is not set
 # CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_KMOD=y
-
-#
-# Block layer
-#
 CONFIG_BLOCK=y
 # CONFIG_LBD is not set
 # CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_LSF is not set
+# CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
 
 #
 # IO Schedulers
@@ -95,66 +114,26 @@ CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_CFQ is not set
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_CLASSIC_RCU=y
 
 #
 # System type
 #
-# CONFIG_SH_SOLUTION_ENGINE is not set
-# CONFIG_SH_7751_SOLUTION_ENGINE is not set
-# CONFIG_SH_7300_SOLUTION_ENGINE is not set
-# CONFIG_SH_7343_SOLUTION_ENGINE is not set
-# CONFIG_SH_73180_SOLUTION_ENGINE is not set
-# CONFIG_SH_7751_SYSTEMH is not set
-# CONFIG_SH_HP6XX is not set
-# CONFIG_SH_SATURN is not set
-# CONFIG_SH_DREAMCAST is not set
-# CONFIG_SH_MPC1211 is not set
-# CONFIG_SH_SH03 is not set
-# CONFIG_SH_SECUREEDGE5410 is not set
-# CONFIG_SH_HS7751RVOIP is not set
-# CONFIG_SH_7710VOIPGW is not set
-# CONFIG_SH_RTS7751R2D is not set
-# CONFIG_SH_HIGHLANDER is not set
-# CONFIG_SH_EDOSK7705 is not set
-# CONFIG_SH_SH4202_MICRODEV is not set
-# CONFIG_SH_LANDISK is not set
-# CONFIG_SH_TITAN is not set
-# CONFIG_SH_SHMIN is not set
-# CONFIG_SH_7206_SOLUTION_ENGINE is not set
-# CONFIG_SH_7619_SOLUTION_ENGINE is not set
-CONFIG_SH_LBOX_RE2=y
-# CONFIG_SH_UNKNOWN is not set
-
-#
-# Processor selection
-#
 CONFIG_CPU_SH4=y
-
-#
-# SH-2 Processor Support
-#
-# CONFIG_CPU_SUBTYPE_SH7604 is not set
 # CONFIG_CPU_SUBTYPE_SH7619 is not set
-
-#
-# SH-2A Processor Support
-#
+# CONFIG_CPU_SUBTYPE_SH7203 is not set
 # CONFIG_CPU_SUBTYPE_SH7206 is not set
-
-#
-# SH-3 Processor Support
-#
-# CONFIG_CPU_SUBTYPE_SH7300 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
-
-#
-# SH-4 Processor Support
-#
+# 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
@@ -163,55 +142,60 @@ CONFIG_CPU_SH4=y
 CONFIG_CPU_SUBTYPE_SH7751R=y
 # CONFIG_CPU_SUBTYPE_SH7760 is not set
 # CONFIG_CPU_SUBTYPE_SH4_202 is not set
-
-#
-# ST40 Processor Support
-#
-# CONFIG_CPU_SUBTYPE_ST40STB1 is not set
-# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
-
-#
-# SH-4A Processor Support
-#
+# CONFIG_CPU_SUBTYPE_SH7723 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
-
-#
-# SH4AL-DSP Processor Support
-#
-# CONFIG_CPU_SUBTYPE_SH73180 is not set
+# 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
+# CONFIG_CPU_SUBTYPE_SH5_101 is not set
+# CONFIG_CPU_SUBTYPE_SH5_103 is not set
 
 #
 # Memory management options
 #
+CONFIG_QUICKLIST=y
 CONFIG_MMU=y
 CONFIG_PAGE_OFFSET=0x80000000
 CONFIG_MEMORY_START=0x0c000000
 CONFIG_MEMORY_SIZE=0x04000000
+CONFIG_29BIT=y
 CONFIG_VSYSCALL=y
+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_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_ENTRY_OFFSET=0x00001000
 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_SPARSEMEM_STATIC=y
+# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
+CONFIG_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
 # CONFIG_RESOURCES_64BIT is not set
 CONFIG_ZONE_DMA_FLAG=0
+CONFIG_NR_QUICK=2
 
 #
 # Cache configuration
 #
 # CONFIG_SH_DIRECT_MAPPED is not set
-# CONFIG_SH_WRITETHROUGH is not set
-# CONFIG_SH_OCRAM is not set
+CONFIG_CACHE_WRITEBACK=y
+# CONFIG_CACHE_WRITETHROUGH is not set
+# CONFIG_CACHE_OFF is not set
 
 #
 # Processor features
@@ -219,12 +203,21 @@ CONFIG_ZONE_DMA_FLAG=0
 CONFIG_CPU_LITTLE_ENDIAN=y
 # CONFIG_CPU_BIG_ENDIAN is not set
 CONFIG_SH_FPU=y
-# CONFIG_SH_DSP is not set
 # CONFIG_SH_STORE_QUEUES is not set
 CONFIG_CPU_HAS_INTEVT=y
-CONFIG_CPU_HAS_INTC_IRQ=y
 CONFIG_CPU_HAS_SR_RB=y
 CONFIG_CPU_HAS_PTEA=y
+CONFIG_CPU_HAS_FPU=y
+
+#
+# Board support
+#
+# CONFIG_SH_7751_SYSTEMH is not set
+# CONFIG_SH_SECUREEDGE5410 is not set
+# CONFIG_SH_RTS7751R2D is not set
+# CONFIG_SH_LANDISK is not set
+# CONFIG_SH_TITAN is not set
+CONFIG_SH_LBOX_RE2=y
 
 #
 # Timer and clock configuration
@@ -232,6 +225,10 @@ CONFIG_CPU_HAS_PTEA=y
 CONFIG_SH_TMU=y
 CONFIG_SH_TIMER_IRQ=16
 CONFIG_SH_PCLK_FREQ=40000000
+# CONFIG_TICK_ONESHOT is not set
+# CONFIG_NO_HZ is not set
+# CONFIG_HIGH_RES_TIMERS is not set
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
 
 #
 # CPU Frequency scaling
@@ -246,7 +243,6 @@ CONFIG_SH_PCLK_FREQ=40000000
 #
 # Companion Chips
 #
-# CONFIG_HD6446X_SERIES is not set
 
 #
 # Additional SuperH Device Drivers
@@ -262,11 +258,14 @@ CONFIG_HZ_250=y
 # CONFIG_HZ_300 is not set
 # CONFIG_HZ_1000 is not set
 CONFIG_HZ=250
+# CONFIG_SCHED_HRTICK is not set
 CONFIG_KEXEC=y
-# CONFIG_SMP is not set
+# CONFIG_CRASH_DUMP is not set
 CONFIG_PREEMPT_NONE=y
 # CONFIG_PREEMPT_VOLUNTARY is not set
 # CONFIG_PREEMPT is not set
+CONFIG_GUSA=y
+# CONFIG_GUSA_RB is not set
 
 #
 # Boot options
@@ -280,15 +279,12 @@ CONFIG_CMDLINE="console=ttySC1,115200 root=/dev/sda1"
 #
 # Bus options
 #
-CONFIG_ISA=y
 CONFIG_PCI=y
 CONFIG_SH_PCIDMA_NONCOHERENT=y
 CONFIG_PCI_AUTO=y
 CONFIG_PCI_AUTO_UPDATE_RESOURCES=y
-
-#
-# PCCARD (PCMCIA/CardBus) support
-#
+# CONFIG_ARCH_SUPPORTS_MSI is not set
+CONFIG_PCI_LEGACY=y
 CONFIG_PCCARD=y
 CONFIG_PCMCIA_DEBUG=y
 CONFIG_PCMCIA=y
@@ -306,28 +302,15 @@ CONFIG_YENTA_O2=y
 # CONFIG_YENTA_TOSHIBA is not set
 # CONFIG_PD6729 is not set
 # CONFIG_I82092 is not set
-# CONFIG_I82365 is not set
-# CONFIG_TCIC is not set
-CONFIG_PCMCIA_PROBE=y
 CONFIG_PCCARD_NONSTATIC=y
-
-#
-# PCI Hotplug Support
-#
 # CONFIG_HOTPLUG_PCI is not set
 
 #
 # Executable file formats
 #
 CONFIG_BINFMT_ELF=y
-# CONFIG_BINFMT_FLAT is not set
 # CONFIG_BINFMT_MISC is not set
 
-#
-# Power management options (EXPERIMENTAL)
-#
-# CONFIG_PM is not set
-
 #
 # Networking
 #
@@ -336,7 +319,6 @@ CONFIG_NET=y
 #
 # Networking options
 #
-# CONFIG_NETDEBUG is not set
 CONFIG_PACKET=y
 # CONFIG_PACKET_MMAP is not set
 CONFIG_UNIX=y
@@ -344,6 +326,7 @@ 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 is not set
 CONFIG_INET=y
 # CONFIG_IP_MULTICAST is not set
@@ -370,29 +353,26 @@ CONFIG_IP_PNP=y
 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
-
-#
-# IP: Virtual Server Configuration
-#
 # CONFIG_IP_VS is not set
 # CONFIG_IPV6 is not set
-# CONFIG_INET6_XFRM_TUNNEL is not set
-# CONFIG_INET6_TUNNEL is not set
 # CONFIG_NETWORK_SECMARK is not set
 CONFIG_NETFILTER=y
 # CONFIG_NETFILTER_DEBUG is not set
+CONFIG_NETFILTER_ADVANCED=y
 
 #
 # Core Netfilter Configuration
 #
-# CONFIG_NETFILTER_NETLINK is not set
-# CONFIG_NF_CONNTRACK_ENABLED is not set
+# CONFIG_NETFILTER_NETLINK_QUEUE is not set
+# CONFIG_NETFILTER_NETLINK_LOG is not set
+# CONFIG_NF_CONNTRACK is not set
 # CONFIG_NETFILTER_XTABLES is not set
 
 #
@@ -401,20 +381,8 @@ CONFIG_NETFILTER=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_IP_DCCP is not set
-
-#
-# SCTP Configuration (EXPERIMENTAL)
-#
 # CONFIG_IP_SCTP is not set
-
-#
-# TIPC Configuration (EXPERIMENTAL)
-#
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
@@ -427,10 +395,6 @@ CONFIG_NETFILTER=y
 # CONFIG_LAPB is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-
-#
-# QoS and/or fair queueing
-#
 # CONFIG_NET_SCHED is not set
 
 #
@@ -438,9 +402,20 @@ CONFIG_NETFILTER=y
 #
 # 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 is not set
+# CONFIG_WIRELESS_EXT is not set
+# CONFIG_MAC80211 is not set
 # CONFIG_IEEE80211 is not set
+# CONFIG_RFKILL is not set
+# CONFIG_NET_9P is not set
 
 #
 # Device Drivers
@@ -449,36 +424,17 @@ CONFIG_NETFILTER=y
 #
 # Generic Driver Options
 #
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 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
-
-#
-# Connector - unified userspace <-> kernelspace linker
-#
 # CONFIG_CONNECTOR is not set
-
-#
-# Memory Technology Devices (MTD)
-#
 # CONFIG_MTD is not set
-
-#
-# Parallel port support
-#
 # CONFIG_PARPORT is not set
-
-#
-# Plug and Play support
-#
-# CONFIG_PNP is not set
-# CONFIG_PNPACPI is not set
-
-#
-# Block devices
-#
-# CONFIG_BLK_CPQ_DA 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
@@ -490,19 +446,18 @@ CONFIG_BLK_DEV_LOOP=y
 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_XIP is not set
 # CONFIG_CDROM_PKTCDVD is not set
 # CONFIG_ATA_OVER_ETH is not set
-
-#
-# Misc devices
-#
+# 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
-
-#
-# ATA/ATAPI/MFM/RLL support
-#
+# CONFIG_ENCLOSURE_SERVICES is not set
+# CONFIG_HP_ILO is not set
+CONFIG_HAVE_IDE=y
 # CONFIG_IDE is not set
 
 #
@@ -510,6 +465,7 @@ CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
 #
 # 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
@@ -531,6 +487,7 @@ CONFIG_BLK_DEV_SD=y
 # 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
@@ -538,71 +495,49 @@ CONFIG_BLK_DEV_SD=y
 # 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_SCSI_SRP_ATTRS is not set
+CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_ISCSI_TCP is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
 # CONFIG_SCSI_3W_9XXX is not set
 # CONFIG_SCSI_ACARD is not set
-# CONFIG_SCSI_AHA152X 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_DPT_I2O is not set
-# CONFIG_SCSI_IN2000 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_HPTIOP is not set
 # CONFIG_SCSI_DMX3191D is not set
-# CONFIG_SCSI_DTC3280 is not set
 # CONFIG_SCSI_FUTURE_DOMAIN is not set
-# CONFIG_SCSI_GENERIC_NCR5380 is not set
-# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
 # CONFIG_SCSI_IPS is not set
 # CONFIG_SCSI_INITIO is not set
 # CONFIG_SCSI_INIA100 is not set
-# CONFIG_SCSI_NCR53C406A is not set
+# CONFIG_SCSI_MVSAS is not set
 # CONFIG_SCSI_STEX is not set
 # CONFIG_SCSI_SYM53C8XX_2 is not set
 # CONFIG_SCSI_IPR is not set
-# CONFIG_SCSI_PAS16 is not set
-# CONFIG_SCSI_PSI240I is not set
-# CONFIG_SCSI_QLOGIC_FAS 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_SYM53C416 is not set
 # CONFIG_SCSI_DC395x is not set
 # CONFIG_SCSI_DC390T is not set
-# CONFIG_SCSI_T128 is not set
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_SRP 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_SCSI_LOWLEVEL_PCMCIA is not set
+# CONFIG_SCSI_DH is not set
 CONFIG_ATA=y
 # CONFIG_ATA_NONSTANDARD is not set
+CONFIG_SATA_PMP=y
 # CONFIG_SATA_AHCI is not set
+# CONFIG_SATA_SIL24 is not set
+CONFIG_ATA_SFF=y
 # CONFIG_SATA_SVW is not set
 # CONFIG_ATA_PIIX is not set
 # CONFIG_SATA_MV is not set
@@ -612,7 +547,6 @@ CONFIG_ATA=y
 # CONFIG_SATA_PROMISE is not set
 # CONFIG_SATA_SX4 is not set
 # CONFIG_SATA_SIL is not set
-# CONFIG_SATA_SIL24 is not set
 # CONFIG_SATA_SIS is not set
 # CONFIG_SATA_ULI is not set
 # CONFIG_SATA_VIA is not set
@@ -622,6 +556,7 @@ CONFIG_ATA=y
 # CONFIG_PATA_AMD is not set
 # CONFIG_PATA_ARTOP 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
@@ -635,18 +570,18 @@ CONFIG_ATA=y
 # CONFIG_PATA_IT821X is not set
 # CONFIG_PATA_IT8213 is not set
 # CONFIG_PATA_JMICRON is not set
-# CONFIG_PATA_LEGACY 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_PCMCIA is not set
 # CONFIG_PATA_PDC_OLD is not set
-# CONFIG_PATA_QDI is not set
 # CONFIG_PATA_RADISYS is not set
 # CONFIG_PATA_RZ1000 is not set
 # CONFIG_PATA_SC1200 is not set
@@ -656,88 +591,52 @@ CONFIG_ATA=y
 # CONFIG_PATA_SIS is not set
 # CONFIG_PATA_VIA is not set
 # CONFIG_PATA_WINBOND is not set
-# CONFIG_PATA_WINBOND_VLB is not set
 CONFIG_PATA_PLATFORM=y
-
-#
-# Old CD-ROM drivers (not SCSI, not IDE)
-#
-# CONFIG_CD_NO_IDESCSI is not set
-
-#
-# Multi-device support (RAID and LVM)
-#
+# CONFIG_PATA_SCH is not set
 # CONFIG_MD is not set
-
-#
-# Fusion MPT device 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
 #
-# CONFIG_IEEE1394 is not set
 
 #
-# I2O device support
+# Enable only one of the two stacks, unless you know what you are doing
 #
+# CONFIG_FIREWIRE is not set
+# CONFIG_IEEE1394 is not set
 # CONFIG_I2O is not set
-
-#
-# 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
-
-#
-# ARCnet devices
-#
+# CONFIG_VETH is not set
 # CONFIG_ARCNET is not set
-
-#
-# PHY device support
-#
 # CONFIG_PHYLIB is not set
-
-#
-# Ethernet (10 or 100Mbit)
-#
 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_NET_VENDOR_SMC is not set
 # CONFIG_SMC91X is not set
-# CONFIG_NET_VENDOR_RACAL is not set
-
-#
-# Tulip family network device support
-#
+# CONFIG_SMC911X is not set
 # CONFIG_NET_TULIP is not set
-# CONFIG_AT1700 is not set
-# CONFIG_DEPCA is not set
 # CONFIG_HP100 is not set
-# CONFIG_NET_ISA 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_NET_PCI=y
 # CONFIG_PCNET32 is not set
 # CONFIG_AMD8111_ETH is not set
 # CONFIG_ADAPTEC_STARFIRE is not set
-# CONFIG_AC3200 is not set
-# CONFIG_APRICOT is not set
 # CONFIG_B44 is not set
 # CONFIG_FORCEDETH is not set
-# CONFIG_CS89x0 is not set
-# CONFIG_DGRS is not set
 # CONFIG_EEPRO100 is not set
 # CONFIG_E100 is not set
 # CONFIG_FEALNX is not set
@@ -749,19 +648,20 @@ CONFIG_8139TOO_PIO=y
 CONFIG_8139TOO_TUNE_TWISTER=y
 # CONFIG_8139TOO_8129 is not set
 # CONFIG_8139_OLD_RX_RESET is not set
+# CONFIG_R6040 is not set
 # CONFIG_SIS900 is not set
 # CONFIG_EPIC100 is not set
 # CONFIG_SUNDANCE is not set
 # CONFIG_TLAN is not set
 # CONFIG_VIA_RHINE is not set
 # CONFIG_SC92031 is not set
-
-#
-# Ethernet (1000 Mbit)
-#
+CONFIG_NETDEV_1000=y
 # CONFIG_ACENIC is not set
 # CONFIG_DL2K is not set
 # CONFIG_E1000 is not set
+# CONFIG_E1000E is not set
+# CONFIG_IP1000 is not set
+# CONFIG_IGB is not set
 # CONFIG_NS83820 is not set
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
@@ -769,36 +669,33 @@ CONFIG_8139TOO_TUNE_TWISTER=y
 # CONFIG_SIS190 is not set
 # CONFIG_SKGE is not set
 # CONFIG_SKY2 is not set
-# CONFIG_SK98LIN is not set
 # CONFIG_VIA_VELOCITY is not set
 # CONFIG_TIGON3 is not set
 # CONFIG_BNX2 is not set
 # CONFIG_QLA3XXX is not set
 # CONFIG_ATL1 is not set
-
-#
-# Ethernet (10000 Mbit)
-#
+# CONFIG_ATL1E is not set
+CONFIG_NETDEV_10000=y
 # CONFIG_CHELSIO_T1 is not set
 # CONFIG_CHELSIO_T3 is not set
+# CONFIG_IXGBE is not set
 # CONFIG_IXGB is not set
 # CONFIG_S2IO is not set
 # CONFIG_MYRI10GE is not set
 # CONFIG_NETXEN_NIC is not set
-
-#
-# Token Ring devices
-#
+# CONFIG_NIU is not set
+# CONFIG_MLX4_CORE is not set
+# CONFIG_TEHUTI is not set
+# CONFIG_BNX2X is not set
+# CONFIG_SFC is not set
 # CONFIG_TR is not set
 
 #
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
-
-#
-# PCMCIA network device support
+# Wireless LAN
 #
+# CONFIG_WLAN_PRE80211 is not set
+# CONFIG_WLAN_80211 is not set
+# CONFIG_IWLWIFI_LEDS is not set
 CONFIG_NET_PCMCIA=y
 # CONFIG_PCMCIA_3C589 is not set
 # CONFIG_PCMCIA_3C574 is not set
@@ -808,29 +705,16 @@ CONFIG_PCMCIA_PCNET=y
 # CONFIG_PCMCIA_SMC91C92 is not set
 # CONFIG_PCMCIA_XIRC2PS is not set
 # CONFIG_PCMCIA_AXNET is not set
-
-#
-# Wan interfaces
-#
 # CONFIG_WAN is not set
 # CONFIG_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
-
-#
-# ISDN subsystem
-#
 # CONFIG_ISDN is not set
-
-#
-# Telephony Support
-#
 # CONFIG_PHONE is not set
 
 #
@@ -838,6 +722,7 @@ CONFIG_PCMCIA_PCNET=y
 #
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
+# CONFIG_INPUT_POLLDEV is not set
 
 #
 # Userland interfaces
@@ -847,7 +732,6 @@ CONFIG_INPUT_MOUSEDEV=y
 CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
 CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
 # CONFIG_INPUT_JOYDEV is not set
-# CONFIG_INPUT_TSDEV is not set
 # CONFIG_INPUT_EVDEV is not set
 # CONFIG_INPUT_EVBUG is not set
 
@@ -857,6 +741,7 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
 # 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
 
@@ -870,10 +755,13 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
 # 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
@@ -892,22 +780,10 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_UNIX98_PTYS=y
 CONFIG_LEGACY_PTYS=y
 CONFIG_LEGACY_PTY_COUNT=256
-
-#
-# IPMI
-#
 # CONFIG_IPMI_HANDLER is not set
-
-#
-# Watchdog Cards
-#
-# CONFIG_WATCHDOG is not set
 CONFIG_HW_RANDOM=y
-# 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
@@ -915,125 +791,104 @@ CONFIG_HW_RANDOM=y
 # 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
-#
 # CONFIG_W1 is not set
-
-#
-# Hardware Monitoring support
-#
+# CONFIG_POWER_SUPPLY is not set
 CONFIG_HWMON=y
 # CONFIG_HWMON_VID is not set
-# CONFIG_SENSORS_ABITUGURU is not set
+# CONFIG_SENSORS_I5K_AMB is not set
 # CONFIG_SENSORS_F71805F is not set
+# CONFIG_SENSORS_F71882FG is not set
+# CONFIG_SENSORS_IT87 is not set
+# CONFIG_SENSORS_PC87360 is not set
 # CONFIG_SENSORS_PC87427 is not set
+# CONFIG_SENSORS_SIS5595 is not set
+# CONFIG_SENSORS_SMSC47M1 is not set
+# CONFIG_SENSORS_SMSC47B397 is not set
+# CONFIG_SENSORS_VIA686A is not set
 # CONFIG_SENSORS_VT1211 is not set
+# 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
+
+#
+# Sonics Silicon Backplane
+#
+CONFIG_SSB_POSSIBLE=y
+# 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
 
 #
 # Multimedia devices
 #
+
+#
+# Multimedia core support
+#
 # CONFIG_VIDEO_DEV is not set
+# CONFIG_DVB_CORE is not set
+# CONFIG_VIDEO_MEDIA is not set
 
 #
-# Digital Video Broadcasting Devices
+# Multimedia drivers
 #
-# CONFIG_DVB is not set
+# CONFIG_DAB is not set
 
 #
 # Graphics support
 #
-# CONFIG_BACKLIGHT_LCD_SUPPORT 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
 
 #
-# Console display driver support
+# Display device support
 #
-# CONFIG_MDA_CONSOLE is not set
-CONFIG_DUMMY_CONSOLE=y
+# CONFIG_DISPLAY_SUPPORT is not set
 
 #
-# Sound
+# Console display driver support
 #
+CONFIG_DUMMY_CONSOLE=y
 # CONFIG_SOUND is not set
-
-#
-# HID Devices
-#
+CONFIG_HID_SUPPORT=y
 CONFIG_HID=y
 # CONFIG_HID_DEBUG is not set
-
-#
-# USB support
-#
+# CONFIG_HIDRAW 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'
 #
-
-#
-# USB Gadget Support
-#
 # CONFIG_USB_GADGET is not set
-
-#
-# MMC/SD Card support
-#
 # 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
-
-#
-# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
-#
-
-#
-# Real Time Clock
-#
 CONFIG_RTC_LIB=y
 CONFIG_RTC_CLASS=y
 CONFIG_RTC_HCTOSYS=y
@@ -1047,37 +902,29 @@ CONFIG_RTC_INTF_SYSFS=y
 CONFIG_RTC_INTF_PROC=y
 CONFIG_RTC_INTF_DEV=y
 # CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
-
-#
-# RTC drivers
-#
-# CONFIG_RTC_DRV_DS1553 is not set
-# CONFIG_RTC_DRV_DS1742 is not set
-# CONFIG_RTC_DRV_M48T86 is not set
-# CONFIG_RTC_DRV_SH is not set
 # CONFIG_RTC_DRV_TEST is not set
-# CONFIG_RTC_DRV_V3020 is not set
-
-#
-# DMA Engine support
-#
-# CONFIG_DMA_ENGINE is not set
-
-#
-# DMA Clients
-#
 
 #
-# DMA Devices
+# SPI RTC drivers
 #
 
 #
-# Auxiliary Display support
+# Platform RTC drivers
 #
+# 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_M48T59 is not set
+# CONFIG_RTC_DRV_V3020 is not set
 
 #
-# Virtualization
+# on-CPU RTC drivers
 #
+# CONFIG_RTC_DRV_SH is not set
+# CONFIG_DMADEVICES is not set
+# CONFIG_UIO is not set
 
 #
 # File systems
@@ -1091,20 +938,16 @@ CONFIG_EXT3_FS_XATTR=y
 # CONFIG_EXT3_FS_SECURITY is not set
 # CONFIG_EXT4DEV_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_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
-# CONFIG_MINIX_FS is not set
-CONFIG_ROMFS_FS=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
@@ -1136,7 +979,6 @@ CONFIG_TMPFS=y
 # CONFIG_TMPFS_POSIX_ACL is not set
 # CONFIG_HUGETLBFS is not set
 # CONFIG_HUGETLB_PAGE is not set
-CONFIG_RAMFS=y
 # CONFIG_CONFIGFS_FS is not set
 
 #
@@ -1151,14 +993,14 @@ CONFIG_RAMFS=y
 # CONFIG_EFS_FS is not set
 # CONFIG_CRAMFS 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=y
 # CONFIG_SYSV_FS is not set
 # CONFIG_UFS_FS is not set
-
-#
-# Network File Systems
-#
+CONFIG_NETWORK_FILESYSTEMS=y
 # CONFIG_NFS_FS is not set
 # CONFIG_NFSD is not set
 # CONFIG_SMB_FS is not set
@@ -1166,17 +1008,12 @@ CONFIG_RAMFS=y
 # CONFIG_NCP_FS is not set
 # CONFIG_CODA_FS is not set
 # CONFIG_AFS_FS is not set
-# CONFIG_9P_FS is not set
 
 #
 # Partition Types
 #
 # CONFIG_PARTITION_ADVANCED is not set
 CONFIG_MSDOS_PARTITION=y
-
-#
-# Native Language Support
-#
 CONFIG_NLS=y
 CONFIG_NLS_DEFAULT="iso8859-1"
 CONFIG_NLS_CODEPAGE_437=y
@@ -1217,30 +1054,24 @@ CONFIG_NLS_CODEPAGE_437=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 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=1024
 # CONFIG_MAGIC_SYSRQ 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_DEBUG_BUGVERBOSE is not set
+# CONFIG_DEBUG_MEMORY_INIT is not set
+# CONFIG_SAMPLES is not set
 CONFIG_SH_STANDARD_BIOS=y
 # CONFIG_EARLY_SCIF_CONSOLE is not set
 # CONFIG_EARLY_PRINTK is not set
@@ -1251,20 +1082,100 @@ CONFIG_SH_STANDARD_BIOS=y
 #
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
+# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+CONFIG_CRYPTO=y
+
+#
+# Crypto core or helper
+#
+# CONFIG_CRYPTO_MANAGER 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
+
+#
+# Digest
+#
+# CONFIG_CRYPTO_CRC32C 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
 
 #
-# Cryptographic options
+# Compression
 #
-# CONFIG_CRYPTO is not set
+# CONFIG_CRYPTO_DEFLATE is not set
+# CONFIG_CRYPTO_LZO is not set
+CONFIG_CRYPTO_HW=y
+# CONFIG_CRYPTO_DEV_HIFN_795X is not set
 
 #
 # Library routines
 #
 CONFIG_BITREVERSE=y
+# CONFIG_GENERIC_FIND_FIRST_BIT is not set
 # CONFIG_CRC_CCITT is not set
 # CONFIG_CRC16 is not set
+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_PLIST=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
index f8398a5..a3a80f3 100644 (file)
@@ -1,9 +1,11 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.23-rc2
-# Fri Aug 17 12:15:16 2007
+# Linux kernel version: 2.6.26
+# Wed Jul 30 01:41:08 2008
 #
 CONFIG_SUPERH=y
+CONFIG_SUPERH32=y
+CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
 CONFIG_GENERIC_BUG=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -18,6 +20,7 @@ CONFIG_LOCKDEP_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_SUPPORTS_AOUT=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
 
 #
@@ -35,12 +38,16 @@ CONFIG_POSIX_MQUEUE=y
 CONFIG_BSD_PROCESS_ACCT=y
 CONFIG_BSD_PROCESS_ACCT_V3=y
 # CONFIG_TASKSTATS is not set
-# CONFIG_USER_NS is not set
 CONFIG_AUDIT=y
+# CONFIG_AUDITSYSCALL is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=17
+# CONFIG_CGROUPS is not set
+# CONFIG_GROUP_SCHED is not set
 CONFIG_SYSFS_DEPRECATED=y
+CONFIG_SYSFS_DEPRECATED_V2=y
 CONFIG_RELAY=y
+# CONFIG_NAMESPACES is not set
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE=""
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -48,6 +55,7 @@ CONFIG_SYSCTL=y
 CONFIG_EMBEDDED=y
 CONFIG_UID16=y
 CONFIG_SYSCTL_SYSCALL=y
+CONFIG_SYSCTL_SYSCALL_CHECK=y
 CONFIG_KALLSYMS=y
 CONFIG_KALLSYMS_ALL=y
 # CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -55,6 +63,7 @@ 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
@@ -67,10 +76,24 @@ CONFIG_VM_EVENT_COUNTERS=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_EFFICIENT_UNALIGNED_ACCESS is not set
+# CONFIG_HAVE_IOREMAP_PROT is not set
+# CONFIG_HAVE_KPROBES is not set
+# CONFIG_HAVE_KRETPROBES is not set
+# CONFIG_HAVE_ARCH_TRACEHOOK is not set
+# CONFIG_HAVE_DMA_ATTRS is not set
+# CONFIG_USE_GENERIC_SMP_HELPERS is not set
+CONFIG_HAVE_CLK=y
+CONFIG_PROC_PAGE_MONITOR=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=y
@@ -81,6 +104,7 @@ CONFIG_BLOCK=y
 # CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_LSF is not set
 # CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
 
 #
 # IO Schedulers
@@ -94,13 +118,17 @@ CONFIG_IOSCHED_NOOP=y
 # CONFIG_DEFAULT_CFQ is not set
 CONFIG_DEFAULT_NOOP=y
 CONFIG_DEFAULT_IOSCHED="noop"
+CONFIG_CLASSIC_RCU=y
 
 #
 # System type
 #
 CONFIG_CPU_SH3=y
 # CONFIG_CPU_SUBTYPE_SH7619 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
@@ -109,6 +137,7 @@ CONFIG_CPU_SH3=y
 # CONFIG_CPU_SUBTYPE_SH7710 is not set
 # CONFIG_CPU_SUBTYPE_SH7712 is not set
 CONFIG_CPU_SUBTYPE_SH7720=y
+# 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
@@ -117,14 +146,17 @@ CONFIG_CPU_SUBTYPE_SH7720=y
 # 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_ST40STB1 is not set
-# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
+# CONFIG_CPU_SUBTYPE_SH7723 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_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
+# CONFIG_CPU_SUBTYPE_SH5_101 is not set
+# CONFIG_CPU_SUBTYPE_SH5_103 is not set
 
 #
 # Memory management options
@@ -134,6 +166,7 @@ CONFIG_MMU=y
 CONFIG_PAGE_OFFSET=0x80000000
 CONFIG_MEMORY_START=0x0C000000
 CONFIG_MEMORY_SIZE=0x03F00000
+CONFIG_29BIT=y
 CONFIG_VSYSCALL=y
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_SPARSEMEM_ENABLE=y
@@ -143,7 +176,9 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_ARCH_SELECT_MEMORY_MODEL=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_ENTRY_OFFSET=0x00001000
 CONFIG_SELECT_MEMORY_MODEL=y
 CONFIG_FLATMEM_MANUAL=y
 # CONFIG_DISCONTIGMEM_MANUAL is not set
@@ -151,6 +186,8 @@ CONFIG_FLATMEM_MANUAL=y
 CONFIG_FLATMEM=y
 CONFIG_FLAT_NODE_MEM_MAP=y
 CONFIG_SPARSEMEM_STATIC=y
+# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
+CONFIG_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
 # CONFIG_RESOURCES_64BIT is not set
 CONFIG_ZONE_DMA_FLAG=0
@@ -173,7 +210,6 @@ CONFIG_CPU_LITTLE_ENDIAN=y
 CONFIG_SH_DSP=y
 CONFIG_SH_ADC=y
 CONFIG_CPU_HAS_INTEVT=y
-CONFIG_CPU_HAS_INTC_IRQ=y
 CONFIG_CPU_HAS_SR_RB=y
 CONFIG_CPU_HAS_DSP=y
 
@@ -196,6 +232,7 @@ CONFIG_SH_PCLK_FREQ=24000000
 # CONFIG_TICK_ONESHOT is not set
 # CONFIG_NO_HZ is not set
 # CONFIG_HIGH_RES_TIMERS is not set
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
 
 #
 # CPU Frequency scaling
@@ -228,11 +265,14 @@ CONFIG_HZ_250=y
 # CONFIG_HZ_300 is not set
 # CONFIG_HZ_1000 is not set
 CONFIG_HZ=250
+# CONFIG_SCHED_HRTICK is not set
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
 CONFIG_PREEMPT_NONE=y
 # CONFIG_PREEMPT_VOLUNTARY is not set
 # CONFIG_PREEMPT is not set
+CONFIG_GUSA=y
+# CONFIG_GUSA_RB is not set
 
 #
 # Boot options
@@ -245,10 +285,6 @@ CONFIG_BOOT_LINK_OFFSET=0x00800000
 # Bus options
 #
 # CONFIG_ARCH_SUPPORTS_MSI is not set
-
-#
-# PCCARD (PCMCIA/CardBus) support
-#
 # CONFIG_PCCARD is not set
 
 #
@@ -289,6 +325,7 @@ CONFIG_IP_PNP_DHCP=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 is not set
 CONFIG_INET_DIAG=y
 CONFIG_INET_TCP_DIAG=y
 # CONFIG_TCP_CONG_ADVANCED is not set
@@ -296,8 +333,6 @@ CONFIG_TCP_CONG_CUBIC=y
 CONFIG_DEFAULT_TCP_CONG="cubic"
 # 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 is not set
 # CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
@@ -314,10 +349,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_LAPB is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-
-#
-# QoS and/or fair queueing
-#
 # CONFIG_NET_SCHED is not set
 
 #
@@ -325,6 +356,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 #
 # 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
@@ -346,9 +378,12 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 #
 # Generic Driver Options
 #
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 # CONFIG_STANDALONE is not set
 # CONFIG_PREVENT_FIRMWARE_BUILD 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
@@ -362,6 +397,7 @@ CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1
 # CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set
 # CONFIG_MTD_REDBOOT_PARTS_READONLY is not set
 CONFIG_MTD_CMDLINE_PARTS=y
+# CONFIG_MTD_AR7_PARTS is not set
 
 #
 # User Modules And Translation Layers
@@ -374,6 +410,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
@@ -408,7 +445,6 @@ CONFIG_MTD_PHYSMAP=y
 CONFIG_MTD_PHYSMAP_START=0x0000000
 CONFIG_MTD_PHYSMAP_LEN=0
 CONFIG_MTD_PHYSMAP_BANKWIDTH=0
-# CONFIG_MTD_SOLUTIONENGINE is not set
 # CONFIG_MTD_PLATRAM is not set
 
 #
@@ -440,11 +476,14 @@ CONFIG_BLK_DEV=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=16
 CONFIG_BLK_DEV_RAM_SIZE=65536
-CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
+# 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_EEPROM_93CX6 is not set
+# CONFIG_ENCLOSURE_SERVICES is not set
+CONFIG_HAVE_IDE=y
 # CONFIG_IDE is not set
 
 #
@@ -457,18 +496,24 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_ATA is not set
 # CONFIG_MD is not set
 CONFIG_NETDEVICES=y
-# CONFIG_NETDEVICES_MULTIQUEUE is not set
 # 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_STNIC is not set
 # CONFIG_SMC91X is not set
 CONFIG_SMC911X=y
+# 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_B44 is not set
 # CONFIG_NETDEV_1000 is not set
 # CONFIG_NETDEV_10000 is not set
 
@@ -477,10 +522,10 @@ CONFIG_SMC911X=y
 #
 # CONFIG_WLAN_PRE80211 is not set
 # CONFIG_WLAN_80211 is not set
+# CONFIG_IWLWIFI_LEDS is not set
 # 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
@@ -502,7 +547,6 @@ 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_TSDEV is not set
 CONFIG_INPUT_EVDEV=y
 # CONFIG_INPUT_EVBUG is not set
 
@@ -516,6 +560,7 @@ CONFIG_KEYBOARD_ATKBD=y
 # CONFIG_KEYBOARD_XTKBD is not set
 # CONFIG_KEYBOARD_NEWTON is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
+# CONFIG_KEYBOARD_SH_KEYSC is not set
 CONFIG_INPUT_MOUSE=y
 # CONFIG_MOUSE_PS2 is not set
 # CONFIG_MOUSE_SERIAL is not set
@@ -539,9 +584,11 @@ CONFIG_SERIO_LIBPS2=y
 # 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
 
 #
@@ -569,60 +616,72 @@ CONFIG_UNIX98_PTYS=y
 CONFIG_LEGACY_PTYS=y
 CONFIG_LEGACY_PTY_COUNT=256
 # CONFIG_IPMI_HANDLER is not set
-# CONFIG_WATCHDOG is not set
 # CONFIG_HW_RANDOM is not set
 # CONFIG_R3964 is not set
 # CONFIG_RAW_DRIVER is not set
 # CONFIG_TCG_TPM is not set
 # CONFIG_I2C is not set
-
-#
-# SPI support
-#
 # CONFIG_SPI is not set
-# CONFIG_SPI_MASTER 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
+
+#
+# Sonics Silicon Backplane
+#
+CONFIG_SSB_POSSIBLE=y
+# 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
 
 #
 # 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
 
 #
 # Graphics support
 #
+# 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
-# CONFIG_VGASTATE is not set
-# CONFIG_VIDEO_OUTPUT_CONTROL is not set
-# CONFIG_FB is not set
 
 #
 # Console display driver support
 #
 CONFIG_DUMMY_CONSOLE=y
-
-#
-# Sound
-#
 # CONFIG_SOUND is not set
 # CONFIG_HID_SUPPORT is not set
 # CONFIG_USB_SUPPORT 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 is not set
@@ -644,9 +703,10 @@ CONFIG_RTC_INTF_DEV=y
 #
 # Platform RTC drivers
 #
+# CONFIG_RTC_DRV_DS1511 is not set
 # CONFIG_RTC_DRV_DS1553 is not set
-# CONFIG_RTC_DRV_STK17TA8 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_M48T59 is not set
 # CONFIG_RTC_DRV_V3020 is not set
@@ -655,23 +715,7 @@ CONFIG_RTC_INTF_DEV=y
 # on-CPU RTC drivers
 #
 CONFIG_RTC_DRV_SH=y
-
-#
-# DMA Engine support
-#
-# CONFIG_DMA_ENGINE is not set
-
-#
-# DMA Clients
-#
-
-#
-# DMA Devices
-#
-
-#
-# Userspace I/O
-#
+# CONFIG_DMADEVICES is not set
 # CONFIG_UIO is not set
 
 #
@@ -684,18 +728,14 @@ CONFIG_EXT3_FS=y
 # CONFIG_EXT3_FS_XATTR is not set
 # CONFIG_EXT4DEV_FS is not set
 CONFIG_JBD=y
-# CONFIG_JBD_DEBUG 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_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
-# CONFIG_MINIX_FS is not set
-# CONFIG_ROMFS_FS is not set
+# CONFIG_DNOTIFY is not set
 # CONFIG_INOTIFY is not set
 # CONFIG_QUOTA is not set
-# CONFIG_DNOTIFY is not set
 # CONFIG_AUTOFS_FS is not set
 # CONFIG_AUTOFS4_FS is not set
 # CONFIG_FUSE_FS is not set
@@ -724,7 +764,6 @@ CONFIG_TMPFS=y
 # CONFIG_TMPFS_POSIX_ACL is not set
 # CONFIG_HUGETLBFS is not set
 # CONFIG_HUGETLB_PAGE is not set
-CONFIG_RAMFS=y
 # CONFIG_CONFIGFS_FS is not set
 
 #
@@ -744,30 +783,29 @@ CONFIG_JFFS2_FS_DEBUG=0
 # 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_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_NFSD 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_SUNRPC_BIND34=y
 # CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_RPCSEC_GSS_SPKM3 is not set
 # CONFIG_SMB_FS is not set
@@ -781,10 +819,6 @@ CONFIG_SUNRPC_BIND34=y
 #
 # CONFIG_PARTITION_ADVANCED is not set
 CONFIG_MSDOS_PARTITION=y
-
-#
-# Native Language Support
-#
 CONFIG_NLS=y
 CONFIG_NLS_DEFAULT="cp437"
 CONFIG_NLS_CODEPAGE_437=y
@@ -825,23 +859,16 @@ CONFIG_NLS_ISO8859_1=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 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=1024
 CONFIG_MAGIC_SYSRQ=y
 # CONFIG_UNUSED_SYMBOLS is not set
 # CONFIG_DEBUG_FS is not set
@@ -852,6 +879,7 @@ CONFIG_DEBUG_KERNEL=y
 # 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
@@ -866,11 +894,16 @@ CONFIG_DEBUG_KOBJECT=y
 CONFIG_DEBUG_BUGVERBOSE=y
 CONFIG_DEBUG_INFO=y
 # 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_FRAME_POINTER=y
-# CONFIG_FORCED_INLINING 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_FAULT_INJECTION is not set
+# CONFIG_SAMPLES is not set
 # CONFIG_SH_STANDARD_BIOS is not set
 CONFIG_EARLY_SCIF_CONSOLE=y
 CONFIG_EARLY_SCIF_CONSOLE_PORT=0xa4430000
@@ -879,6 +912,7 @@ CONFIG_EARLY_PRINTK=y
 # CONFIG_DEBUG_STACKOVERFLOW is not set
 # CONFIG_DEBUG_STACK_USAGE is not set
 # CONFIG_4KSTACKS is not set
+# CONFIG_IRQSTACKS is not set
 CONFIG_SH_KGDB=y
 
 #
@@ -904,14 +938,17 @@ CONFIG_KGDB_DEFBITS_8=y
 #
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
+# CONFIG_SECURITY_FILE_CAPABILITIES is not set
 # CONFIG_CRYPTO is not set
 
 #
 # Library routines
 #
 CONFIG_BITREVERSE=y
+# CONFIG_GENERIC_FIND_FIRST_BIT is not set
 CONFIG_CRC_CCITT=m
 CONFIG_CRC16=m
+# CONFIG_CRC_T10DIF is not set
 # CONFIG_CRC_ITU_T is not set
 CONFIG_CRC32=y
 # CONFIG_CRC7 is not set
index e89d951..e4b900e 100644 (file)
@@ -1,28 +1,35 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.18
-# Tue Oct  3 11:27:01 2006
+# Linux kernel version: 2.6.26
+# Wed Jul 30 01:47:16 2008
 #
 CONFIG_SUPERH=y
+CONFIG_SUPERH32=y
+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_IRQ_PROBE=y
 CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_GENERIC_TIME=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_LOCKDEP_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_SUPPORTS_AOUT=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
 
 #
-# Code maturity level options
+# General setup
 #
 CONFIG_EXPERIMENTAL=y
 CONFIG_BROKEN_ON_SMP=y
 CONFIG_LOCK_KERNEL=y
 CONFIG_INIT_ENV_ARG_LIMIT=32
-
-#
-# General setup
-#
 CONFIG_LOCALVERSION=""
 CONFIG_LOCALVERSION_AUTO=y
 CONFIG_SWAP=y
@@ -31,10 +38,16 @@ CONFIG_SWAP=y
 CONFIG_BSD_PROCESS_ACCT=y
 # CONFIG_BSD_PROCESS_ACCT_V3 is not set
 # CONFIG_TASKSTATS is not set
-# CONFIG_UTS_NS is not set
 # CONFIG_AUDIT is not set
 # CONFIG_IKCONFIG is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_CGROUPS is not set
+# CONFIG_GROUP_SCHED is not set
+CONFIG_SYSFS_DEPRECATED=y
+CONFIG_SYSFS_DEPRECATED_V2=y
 # CONFIG_RELAY is not set
+# CONFIG_NAMESPACES is not set
+CONFIG_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE=""
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 CONFIG_SYSCTL=y
@@ -47,29 +60,42 @@ 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_SLAB=y
 CONFIG_VM_EVENT_COUNTERS=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_EFFICIENT_UNALIGNED_ACCESS is not set
+# CONFIG_HAVE_IOREMAP_PROT is not set
+# CONFIG_HAVE_KPROBES is not set
+# CONFIG_HAVE_KRETPROBES is not set
+# CONFIG_HAVE_ARCH_TRACEHOOK is not set
+# CONFIG_HAVE_DMA_ATTRS is not set
+# CONFIG_USE_GENERIC_SMP_HELPERS is not set
+CONFIG_HAVE_CLK=y
+CONFIG_PROC_PAGE_MONITOR=y
+CONFIG_SLABINFO=y
 CONFIG_RT_MUTEXES=y
 # CONFIG_TINY_SHMEM is not set
 CONFIG_BASE_SMALL=0
-# CONFIG_SLOB is not set
-
-#
-# Loadable module support
-#
 # CONFIG_MODULES is not set
-
-#
-# Block layer
-#
 CONFIG_BLOCK=y
 # CONFIG_LBD is not set
 # CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_LSF is not set
+# CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
 
 #
 # IO Schedulers
@@ -83,59 +109,26 @@ CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_CFQ is not set
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_CLASSIC_RCU=y
 
 #
 # System type
 #
-# CONFIG_SH_SOLUTION_ENGINE is not set
-# CONFIG_SH_7751_SOLUTION_ENGINE is not set
-# CONFIG_SH_7300_SOLUTION_ENGINE is not set
-# CONFIG_SH_7343_SOLUTION_ENGINE is not set
-# CONFIG_SH_73180_SOLUTION_ENGINE is not set
-# CONFIG_SH_7751_SYSTEMH is not set
-# CONFIG_SH_HP6XX is not set
-# CONFIG_SH_EC3104 is not set
-# CONFIG_SH_SATURN is not set
-# CONFIG_SH_DREAMCAST is not set
-# CONFIG_SH_BIGSUR is not set
-# CONFIG_SH_MPC1211 is not set
-# CONFIG_SH_SH03 is not set
-# CONFIG_SH_SECUREEDGE5410 is not set
-# CONFIG_SH_HS7751RVOIP is not set
-# CONFIG_SH_7710VOIPGW is not set
-# CONFIG_SH_RTS7751R2D is not set
-# CONFIG_SH_R7780RP is not set
-# CONFIG_SH_EDOSK7705 is not set
-CONFIG_SH_SH4202_MICRODEV=y
-# CONFIG_SH_LANDISK is not set
-# CONFIG_SH_TITAN is not set
-# CONFIG_SH_SHMIN is not set
-# CONFIG_SH_UNKNOWN is not set
-
-#
-# Processor selection
-#
 CONFIG_CPU_SH4=y
-
-#
-# SH-2 Processor Support
-#
-# CONFIG_CPU_SUBTYPE_SH7604 is not set
-
-#
-# SH-3 Processor Support
-#
-# CONFIG_CPU_SUBTYPE_SH7300 is not set
+# CONFIG_CPU_SUBTYPE_SH7619 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
-
-#
-# SH-4 Processor Support
-#
+# 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
@@ -144,67 +137,94 @@ CONFIG_CPU_SH4=y
 # CONFIG_CPU_SUBTYPE_SH7751R is not set
 # CONFIG_CPU_SUBTYPE_SH7760 is not set
 CONFIG_CPU_SUBTYPE_SH4_202=y
-
-#
-# ST40 Processor Support
-#
-# CONFIG_CPU_SUBTYPE_ST40STB1 is not set
-# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
-
-#
-# SH-4A Processor Support
-#
+# CONFIG_CPU_SUBTYPE_SH7723 is not set
+# CONFIG_CPU_SUBTYPE_SH7763 is not set
 # CONFIG_CPU_SUBTYPE_SH7770 is not set
 # CONFIG_CPU_SUBTYPE_SH7780 is not set
-
-#
-# SH4AL-DSP Processor Support
-#
-# CONFIG_CPU_SUBTYPE_SH73180 is not set
+# CONFIG_CPU_SUBTYPE_SH7785 is not set
+# 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
+# CONFIG_CPU_SUBTYPE_SH5_101 is not set
+# CONFIG_CPU_SUBTYPE_SH5_103 is not set
 
 #
 # Memory management options
 #
+CONFIG_QUICKLIST=y
 CONFIG_MMU=y
 CONFIG_PAGE_OFFSET=0x80000000
 CONFIG_MEMORY_START=0x08000000
 CONFIG_MEMORY_SIZE=0x04000000
+CONFIG_29BIT=y
 CONFIG_VSYSCALL=y
+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_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_ENTRY_OFFSET=0x00001000
 CONFIG_HUGETLB_PAGE_SIZE_64K=y
+# CONFIG_HUGETLB_PAGE_SIZE_256K is not set
 # CONFIG_HUGETLB_PAGE_SIZE_1MB is not set
+# 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=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_SPARSEMEM_STATIC=y
+# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
+CONFIG_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
 # CONFIG_RESOURCES_64BIT is not set
+CONFIG_ZONE_DMA_FLAG=0
+CONFIG_NR_QUICK=2
 
 #
 # Cache configuration
 #
 # CONFIG_SH_DIRECT_MAPPED is not set
-CONFIG_SH_WRITETHROUGH=y
-# CONFIG_SH_OCRAM is not set
+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_DSP is not set
 # CONFIG_SH_STORE_QUEUES is not set
 CONFIG_CPU_HAS_INTEVT=y
 CONFIG_CPU_HAS_SR_RB=y
+CONFIG_CPU_HAS_PTEA=y
+CONFIG_CPU_HAS_FPU=y
 
 #
-# Timer support
+# Board support
+#
+CONFIG_SH_SH4202_MICRODEV=y
+
+#
+# Timer and clock configuration
 #
 CONFIG_SH_TMU=y
+CONFIG_SH_TIMER_IRQ=16
 CONFIG_SH_PCLK_FREQ=66000000
+# CONFIG_TICK_ONESHOT is not set
+# CONFIG_NO_HZ is not set
+# CONFIG_HIGH_RES_TIMERS is not set
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
 
 #
 # CPU Frequency scaling
@@ -214,6 +234,7 @@ CONFIG_SH_PCLK_FREQ=66000000
 #
 # DMA support
 #
+CONFIG_SH_DMA_API=y
 CONFIG_SH_DMA=y
 CONFIG_NR_ONCHIP_DMA_CHANNELS=4
 # CONFIG_NR_DMA_CHANNELS_BOOL is not set
@@ -221,22 +242,30 @@ CONFIG_NR_ONCHIP_DMA_CHANNELS=4
 #
 # Companion Chips
 #
-# CONFIG_HD6446X_SERIES is not set
+
+#
+# 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 is not set
 # CONFIG_KEXEC is not set
-# CONFIG_SMP is not set
+# CONFIG_CRASH_DUMP is not set
 # CONFIG_PREEMPT_NONE is not set
 # CONFIG_PREEMPT_VOLUNTARY is not set
 CONFIG_PREEMPT=y
-CONFIG_PREEMPT_BKL=y
+# CONFIG_PREEMPT_RCU is not set
+CONFIG_GUSA=y
+# CONFIG_GUSA_RB is not set
 
 #
 # Boot options
@@ -251,29 +280,15 @@ CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/hda1"
 # Bus options
 #
 CONFIG_SUPERHYWAY=y
-# CONFIG_PCI is not set
-
-#
-# PCCARD (PCMCIA/CardBus) support
-#
+# CONFIG_ARCH_SUPPORTS_MSI is not set
 # CONFIG_PCCARD is not set
 
-#
-# PCI Hotplug Support
-#
-
 #
 # Executable file formats
 #
 CONFIG_BINFMT_ELF=y
-# CONFIG_BINFMT_FLAT is not set
 # CONFIG_BINFMT_MISC is not set
 
-#
-# Power management options (EXPERIMENTAL)
-#
-# CONFIG_PM is not set
-
 #
 # Networking
 #
@@ -282,12 +297,13 @@ CONFIG_NET=y
 #
 # Networking options
 #
-# CONFIG_NETDEBUG is not set
 # CONFIG_PACKET is not set
 # CONFIG_UNIX is not set
 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 is not set
 CONFIG_INET=y
 # CONFIG_IP_MULTICAST is not set
@@ -308,30 +324,19 @@ CONFIG_IP_PNP=y
 # 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_INET6_XFRM_TUNNEL is not set
-# CONFIG_INET6_TUNNEL is not set
 # CONFIG_NETWORK_SECMARK is not set
 # CONFIG_NETFILTER is not set
-
-#
-# DCCP Configuration (EXPERIMENTAL)
-#
 # CONFIG_IP_DCCP is not set
-
-#
-# SCTP Configuration (EXPERIMENTAL)
-#
 # CONFIG_IP_SCTP is not set
-
-#
-# TIPC Configuration (EXPERIMENTAL)
-#
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
@@ -344,10 +349,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_LAPB is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-
-#
-# QoS and/or fair queueing
-#
 # CONFIG_NET_SCHED is not set
 
 #
@@ -355,9 +356,20 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 #
 # 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 is not set
+# CONFIG_WIRELESS_EXT is not set
+# CONFIG_MAC80211 is not set
 # CONFIG_IEEE80211 is not set
+# CONFIG_RFKILL is not set
+# CONFIG_NET_9P is not set
 
 #
 # Device Drivers
@@ -366,159 +378,96 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 #
 # Generic Driver Options
 #
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 # CONFIG_FW_LOADER 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 is not set
-
-#
-# Parallel port support
-#
 # CONFIG_PARPORT is not set
-
-#
-# Plug and Play support
-#
-
-#
-# Block devices
-#
+CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP 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=y
+# CONFIG_BLK_DEV_XIP is not set
 # CONFIG_CDROM_PKTCDVD is not set
 # CONFIG_ATA_OVER_ETH is not set
-
-#
-# ATA/ATAPI/MFM/RLL support
-#
+# CONFIG_BLK_DEV_HD is not set
+CONFIG_MISC_DEVICES=y
+# CONFIG_EEPROM_93CX6 is not set
+# CONFIG_ENCLOSURE_SERVICES is not set
+CONFIG_HAVE_IDE=y
 CONFIG_IDE=y
 CONFIG_IDE_MAX_HWIFS=1
 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_BLK_DEV_IDE_SATA is not set
 CONFIG_BLK_DEV_IDEDISK=y
 # CONFIG_IDEDISK_MULTI_MODE is not set
 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_PROC_FS=y
 
 #
 # IDE chipset support/bugfixes
 #
-CONFIG_IDE_GENERIC=y
-# CONFIG_IDE_ARM is not set
+# CONFIG_BLK_DEV_PLATFORM is not set
 # CONFIG_BLK_DEV_IDEDMA is not set
-# CONFIG_IDEDMA_AUTO is not set
-# CONFIG_BLK_DEV_HD is not set
 
 #
 # SCSI device support
 #
 # CONFIG_RAID_ATTRS is not set
 # CONFIG_SCSI is not set
+# 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 is not set
-
-#
-# Ethernet (10 or 100Mbit)
-#
 CONFIG_NET_ETHERNET=y
 CONFIG_MII=y
+# CONFIG_AX88796 is not set
 # CONFIG_STNIC is not set
 CONFIG_SMC91X=y
+# CONFIG_SMC911X 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_B44 is not set
+CONFIG_NETDEV_1000=y
+CONFIG_NETDEV_10000=y
 
 #
-# Ethernet (1000 Mbit)
-#
-
-#
-# Ethernet (10000 Mbit)
-#
-
-#
-# Token Ring devices
-#
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
-
-#
-# Wan interfaces
+# Wireless LAN
 #
+# CONFIG_WLAN_PRE80211 is not set
+# CONFIG_WLAN_80211 is not set
+# CONFIG_IWLWIFI_LEDS is not set
 # 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
 
 #
@@ -536,6 +485,7 @@ CONFIG_SMC91X=y
 # Character devices
 #
 # CONFIG_VT is not set
+CONFIG_DEVKMEM=y
 # CONFIG_SERIAL_NONSTANDARD is not set
 
 #
@@ -554,143 +504,93 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_UNIX98_PTYS=y
 CONFIG_LEGACY_PTYS=y
 CONFIG_LEGACY_PTY_COUNT=256
-
-#
-# IPMI
-#
 # CONFIG_IPMI_HANDLER is not set
-
-#
-# Watchdog Cards
-#
-# CONFIG_WATCHDOG is not set
 CONFIG_HW_RANDOM=y
-# CONFIG_GEN_RTC is not set
-# CONFIG_DTLK is not set
 # CONFIG_R3964 is not set
-
-#
-# Ftape, the floppy tape device driver
-#
 # CONFIG_RAW_DRIVER is not set
-
-#
-# TPM devices
-#
 # CONFIG_TCG_TPM is not set
-# CONFIG_TELCLOCK 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
-#
-
-#
-# Hardware Monitoring support
-#
+# CONFIG_W1 is not set
+# CONFIG_POWER_SUPPLY is not set
 CONFIG_HWMON=y
 # CONFIG_HWMON_VID is not set
-# CONFIG_SENSORS_ABITUGURU is not set
 # CONFIG_SENSORS_F71805F is not set
+# CONFIG_SENSORS_F71882FG is not set
+# CONFIG_SENSORS_IT87 is not set
+# CONFIG_SENSORS_PC87360 is not set
+# CONFIG_SENSORS_PC87427 is not set
+# CONFIG_SENSORS_SMSC47M1 is not set
+# CONFIG_SENSORS_SMSC47B397 is not set
 # CONFIG_SENSORS_VT1211 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
 
 #
-# Misc devices
+# Sonics Silicon Backplane
 #
+CONFIG_SSB_POSSIBLE=y
+# 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
 
 #
 # Multimedia devices
 #
+
+#
+# Multimedia core support
+#
 # CONFIG_VIDEO_DEV is not set
-CONFIG_VIDEO_V4L2=y
+# CONFIG_DVB_CORE is not set
+# CONFIG_VIDEO_MEDIA is not set
 
 #
-# Digital Video Broadcasting Devices
+# Multimedia drivers
 #
-# CONFIG_DVB is not set
+# CONFIG_DAB is not set
 
 #
 # Graphics support
 #
-CONFIG_FIRMWARE_EDID=y
+# 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
-
-#
-# USB support
-#
-# CONFIG_USB_ARCH_HAS_HCD 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 is not set
+# 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'
 #
-
-#
-# USB Gadget Support
-#
 # CONFIG_USB_GADGET is not set
-
-#
-# MMC/SD Card support
-#
 # CONFIG_MMC is not set
-
-#
-# LED devices
-#
+# CONFIG_MEMSTICK is not set
 # CONFIG_NEW_LEDS is not set
-
-#
-# LED drivers
-#
-
-#
-# LED Triggers
-#
-
-#
-# InfiniBand support
-#
-
-#
-# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
-#
-
-#
-# Real Time Clock
-#
+# CONFIG_ACCESSIBILITY is not set
 # CONFIG_RTC_CLASS is not set
-
-#
-# DMA Engine support
-#
-# CONFIG_DMA_ENGINE is not set
-
-#
-# DMA Clients
-#
-
-#
-# DMA Devices
-#
+# CONFIG_DMADEVICES is not set
+# CONFIG_UIO is not set
 
 #
 # File systems
@@ -702,20 +602,18 @@ CONFIG_EXT3_FS=y
 CONFIG_EXT3_FS_XATTR=y
 # CONFIG_EXT3_FS_POSIX_ACL is not set
 # CONFIG_EXT3_FS_SECURITY is not set
+# CONFIG_EXT4DEV_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_MINIX_FS is not set
-# CONFIG_ROMFS_FS is not set
+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
@@ -747,7 +645,6 @@ CONFIG_TMPFS=y
 # CONFIG_TMPFS_POSIX_ACL is not set
 CONFIG_HUGETLBFS=y
 CONFIG_HUGETLB_PAGE=y
-CONFIG_RAMFS=y
 # CONFIG_CONFIGFS_FS is not set
 
 #
@@ -762,21 +659,20 @@ CONFIG_RAMFS=y
 # CONFIG_EFS_FS is not set
 # CONFIG_CRAMFS 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
-
-#
-# 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=y
-# CONFIG_NFS_DIRECTIO is not set
-# CONFIG_NFSD is not set
 CONFIG_ROOT_NFS=y
+# CONFIG_NFSD is not set
 CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
 CONFIG_NFS_COMMON=y
@@ -789,17 +685,12 @@ CONFIG_RPCSEC_GSS_KRB5=y
 # CONFIG_NCP_FS is not set
 # CONFIG_CODA_FS is not set
 # CONFIG_AFS_FS is not set
-# CONFIG_9P_FS is not set
 
 #
 # Partition Types
 #
 # CONFIG_PARTITION_ADVANCED is not set
 CONFIG_MSDOS_PARTITION=y
-
-#
-# Native Language Support
-#
 CONFIG_NLS=y
 CONFIG_NLS_DEFAULT="iso8859-1"
 # CONFIG_NLS_CODEPAGE_437 is not set
@@ -840,76 +731,127 @@ 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
-
-#
-# 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_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_DEBUG_BUGVERBOSE is not set
-# CONFIG_DEBUG_FS is not set
-# CONFIG_UNWIND_INFO is not set
+# CONFIG_DEBUG_MEMORY_INIT is not set
+# CONFIG_SAMPLES is not set
 # CONFIG_SH_STANDARD_BIOS is not set
 # CONFIG_EARLY_SCIF_CONSOLE is not set
-# CONFIG_KGDB is not set
+# CONFIG_SH_KGDB is not set
 
 #
 # Security options
 #
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
+# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+CONFIG_CRYPTO=y
 
 #
-# Cryptographic options
+# Crypto core or helper
 #
-CONFIG_CRYPTO=y
 CONFIG_CRYPTO_ALGAPI=y
 CONFIG_CRYPTO_BLKCIPHER=y
 CONFIG_CRYPTO_MANAGER=y
-# CONFIG_CRYPTO_HMAC 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
+
+#
+# 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=y
+# CONFIG_CRYPTO_CTR is not set
+# CONFIG_CRYPTO_CTS is not set
+CONFIG_CRYPTO_ECB=y
+# 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
+
+#
+# Digest
+#
+# CONFIG_CRYPTO_CRC32C is not set
 # CONFIG_CRYPTO_MD4 is not set
 CONFIG_CRYPTO_MD5=y
+# 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_WP512 is not set
 # CONFIG_CRYPTO_TGR192 is not set
-CONFIG_CRYPTO_ECB=y
-CONFIG_CRYPTO_CBC=y
-CONFIG_CRYPTO_DES=y
-# CONFIG_CRYPTO_BLOWFISH is not set
-# CONFIG_CRYPTO_TWOFISH is not set
-# CONFIG_CRYPTO_SERPENT 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_TEA is not set
-# CONFIG_CRYPTO_ARC4 is not set
+CONFIG_CRYPTO_DES=y
+# CONFIG_CRYPTO_FCRYPT is not set
 # CONFIG_CRYPTO_KHAZAD is not set
-# CONFIG_CRYPTO_ANUBIS is not set
-# CONFIG_CRYPTO_DEFLATE is not set
-# CONFIG_CRYPTO_MICHAEL_MIC is not set
-# CONFIG_CRYPTO_CRC32C 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
 
 #
-# Hardware crypto devices
+# Compression
 #
+# CONFIG_CRYPTO_DEFLATE is not set
+# CONFIG_CRYPTO_LZO is not set
+CONFIG_CRYPTO_HW=y
 
 #
 # Library routines
 #
+CONFIG_BITREVERSE=y
+# CONFIG_GENERIC_FIND_FIRST_BIT is not set
 # 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_PLIST=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
index 287408b..c4b3e1d 100644 (file)
@@ -1,10 +1,11 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.26-rc3
-# Thu May 22 14:30:07 2008
+# Linux kernel version: 2.6.26
+# Wed Jul 30 01:44:41 2008
 #
 CONFIG_SUPERH=y
 CONFIG_SUPERH32=y
+CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
 CONFIG_GENERIC_BUG=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -77,9 +78,14 @@ CONFIG_PROFILING=y
 # CONFIG_MARKERS is not set
 CONFIG_OPROFILE=y
 CONFIG_HAVE_OPROFILE=y
+# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
+# CONFIG_HAVE_IOREMAP_PROT is not set
 # CONFIG_HAVE_KPROBES is not set
 # CONFIG_HAVE_KRETPROBES is not set
+# CONFIG_HAVE_ARCH_TRACEHOOK is not set
 # CONFIG_HAVE_DMA_ATTRS is not set
+# CONFIG_USE_GENERIC_SMP_HELPERS is not set
+CONFIG_HAVE_CLK=y
 CONFIG_PROC_PAGE_MONITOR=y
 CONFIG_SLABINFO=y
 CONFIG_RT_MUTEXES=y
@@ -90,12 +96,13 @@ CONFIG_MODULES=y
 # CONFIG_MODULE_UNLOAD is not set
 # CONFIG_MODVERSIONS is not set
 # CONFIG_MODULE_SRCVERSION_ALL is not set
-# CONFIG_KMOD is not set
+CONFIG_KMOD=y
 CONFIG_BLOCK=y
 # CONFIG_LBD is not set
 # CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_LSF is not set
 # CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
 
 #
 # IO Schedulers
@@ -173,7 +180,9 @@ CONFIG_ARCH_SELECT_MEMORY_MODEL=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=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_ENTRY_OFFSET=0x00001000
 CONFIG_SELECT_MEMORY_MODEL=y
 # CONFIG_FLATMEM_MANUAL is not set
 # CONFIG_DISCONTIGMEM_MANUAL is not set
@@ -216,6 +225,8 @@ CONFIG_CPU_HAS_DSP=y
 #
 # CONFIG_SH_7722_SOLUTION_ENGINE is not set
 CONFIG_SH_MIGOR=y
+CONFIG_SH_MIGOR_QVGA=y
+# CONFIG_SH_MIGOR_RTA_WVGA is not set
 
 #
 # Timer and clock configuration
@@ -362,6 +373,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 #
 # CONFIG_CFG80211 is not set
 CONFIG_WIRELESS_EXT=y
+CONFIG_WIRELESS_EXT_SYSFS=y
 # CONFIG_MAC80211 is not set
 # CONFIG_IEEE80211 is not set
 # CONFIG_RFKILL is not set
@@ -378,6 +390,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 CONFIG_FW_LOADER=m
+CONFIG_FIRMWARE_IN_KERNEL=y
+CONFIG_EXTRA_FIRMWARE=""
 # CONFIG_SYS_HYPERVISOR is not set
 # CONFIG_CONNECTOR is not set
 CONFIG_MTD=y
@@ -475,6 +489,7 @@ 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_EEPROM_93CX6 is not set
 # CONFIG_ENCLOSURE_SERVICES is not set
@@ -521,10 +536,10 @@ CONFIG_SCSI_WAIT_SCAN=m
 CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_ISCSI_TCP is not set
 # CONFIG_SCSI_DEBUG is not set
+# CONFIG_SCSI_DH is not set
 # CONFIG_ATA is not set
 # CONFIG_MD is not set
 CONFIG_NETDEVICES=y
-# CONFIG_NETDEVICES_MULTIQUEUE is not set
 # CONFIG_DUMMY is not set
 # CONFIG_BONDING is not set
 # CONFIG_MACVLAN is not set
@@ -537,6 +552,7 @@ CONFIG_MII=y
 # CONFIG_AX88796 is not set
 # CONFIG_STNIC is not set
 CONFIG_SMC91X=y
+# CONFIG_SMC911X 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
@@ -602,6 +618,7 @@ CONFIG_KEYBOARD_SH_KEYSC=y
 # Character devices
 #
 CONFIG_VT=y
+CONFIG_CONSOLE_TRANSLATIONS=y
 CONFIG_VT_CONSOLE=y
 CONFIG_HW_CONSOLE=y
 CONFIG_VT_HW_CONSOLE_BINDING=y
@@ -636,21 +653,35 @@ CONFIG_I2C_BOARDINFO=y
 #
 # I2C Hardware Bus support
 #
+
+#
+# I2C system bus drivers (mostly embedded / system-on-chip)
+#
 # CONFIG_I2C_OCORES is not set
-# CONFIG_I2C_PARPORT_LIGHT is not set
+CONFIG_I2C_SH_MOBILE=y
 # 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_STUB is not set
+
+#
+# Other I2C/SMBus bus drivers
+#
 # CONFIG_I2C_PCA_PLATFORM is not set
-CONFIG_I2C_SH_MOBILE=y
+# CONFIG_I2C_STUB is not set
 
 #
 # Miscellaneous I2C Chip support
 #
 # CONFIG_DS1682 is not set
+# CONFIG_AT24 is not set
 # CONFIG_SENSORS_EEPROM 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
@@ -663,6 +694,7 @@ CONFIG_I2C_SH_MOBILE=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
 
 #
@@ -674,6 +706,7 @@ CONFIG_SSB_POSSIBLE=y
 #
 # Multifunction device drivers
 #
+# CONFIG_MFD_CORE is not set
 # CONFIG_MFD_SM501 is not set
 # CONFIG_HTC_PASIC3 is not set
 
@@ -710,10 +743,6 @@ CONFIG_SSB_POSSIBLE=y
 # Console display driver support
 #
 CONFIG_DUMMY_CONSOLE=y
-
-#
-# Sound
-#
 # CONFIG_SOUND is not set
 CONFIG_HID_SUPPORT=y
 CONFIG_HID=y
@@ -738,7 +767,7 @@ CONFIG_USB_GADGET_SELECTED=y
 # CONFIG_USB_GADGET_ATMEL_USBA is not set
 # CONFIG_USB_GADGET_FSL_USB2 is not set
 # CONFIG_USB_GADGET_NET2280 is not set
-# CONFIG_USB_GADGET_PXA2XX is not set
+# CONFIG_USB_GADGET_PXA25X is not set
 CONFIG_USB_GADGET_M66592=y
 CONFIG_USB_M66592=y
 CONFIG_SUPERH_BUILT_IN_M66592=y
@@ -757,6 +786,7 @@ CONFIG_USB_GADGET_DUALSPEED=y
 CONFIG_USB_G_SERIAL=y
 # CONFIG_USB_MIDI_GADGET is not set
 # CONFIG_USB_G_PRINTER is not set
+# CONFIG_USB_CDC_COMPOSITE is not set
 # CONFIG_MMC is not set
 # CONFIG_MEMSTICK is not set
 # CONFIG_NEW_LEDS is not set
@@ -790,6 +820,7 @@ CONFIG_RTC_DRV_RS5C372=y
 # CONFIG_RTC_DRV_PCF8583 is not set
 # CONFIG_RTC_DRV_M41T80 is not set
 # CONFIG_RTC_DRV_S35390A is not set
+# CONFIG_RTC_DRV_FM3130 is not set
 
 #
 # SPI RTC drivers
@@ -810,6 +841,7 @@ CONFIG_RTC_DRV_RS5C372=y
 # on-CPU RTC drivers
 #
 CONFIG_RTC_DRV_SH=y
+# CONFIG_DMADEVICES is not set
 # CONFIG_UIO is not set
 
 #
@@ -870,6 +902,7 @@ CONFIG_TMPFS=y
 # CONFIG_CRAMFS 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
@@ -899,6 +932,7 @@ CONFIG_DEBUG_FS=y
 # CONFIG_HEADERS_CHECK is not set
 # CONFIG_DEBUG_KERNEL is not set
 # CONFIG_DEBUG_BUGVERBOSE is not set
+# CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_SAMPLES is not set
 # CONFIG_SH_STANDARD_BIOS is not set
 CONFIG_EARLY_SCIF_CONSOLE=y
@@ -955,6 +989,10 @@ CONFIG_CRYPTO=y
 # 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
@@ -994,6 +1032,7 @@ CONFIG_BITREVERSE=y
 # CONFIG_GENERIC_FIND_FIRST_BIT is not set
 # CONFIG_CRC_CCITT is not set
 # CONFIG_CRC16 is not set
+CONFIG_CRC_T10DIF=y
 # CONFIG_CRC_ITU_T is not set
 CONFIG_CRC32=y
 # CONFIG_CRC7 is not set
index 1a07261..57a3007 100644 (file)
@@ -1,10 +1,11 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.25-rc4
-# Thu Mar  6 15:39:59 2008
+# Linux kernel version: 2.6.26
+# Wed Jul 30 01:51:13 2008
 #
 CONFIG_SUPERH=y
 CONFIG_SUPERH32=y
+CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
 CONFIG_GENERIC_BUG=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -84,13 +85,20 @@ CONFIG_PROFILING=y
 # CONFIG_MARKERS is not set
 CONFIG_OPROFILE=m
 CONFIG_HAVE_OPROFILE=y
+# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
+# CONFIG_HAVE_IOREMAP_PROT is not set
 # CONFIG_HAVE_KPROBES is not set
 # CONFIG_HAVE_KRETPROBES is not set
+# CONFIG_HAVE_ARCH_TRACEHOOK is not set
+# CONFIG_HAVE_DMA_ATTRS is not set
+# CONFIG_USE_GENERIC_SMP_HELPERS is not set
+CONFIG_HAVE_CLK=y
 CONFIG_PROC_PAGE_MONITOR=y
 CONFIG_SLABINFO=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
@@ -101,6 +109,7 @@ CONFIG_BLOCK=y
 # CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_LSF is not set
 # CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
 
 #
 # IO Schedulers
@@ -115,7 +124,6 @@ CONFIG_IOSCHED_NOOP=y
 CONFIG_DEFAULT_NOOP=y
 CONFIG_DEFAULT_IOSCHED="noop"
 CONFIG_CLASSIC_RCU=y
-# CONFIG_PREEMPT_RCU is not set
 
 #
 # System type
@@ -126,6 +134,7 @@ CONFIG_CPU_SH4A=y
 # 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
@@ -143,6 +152,7 @@ CONFIG_CPU_SH4A=y
 # 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_SH7763 is not set
 # CONFIG_CPU_SUBTYPE_SH7770 is not set
 CONFIG_CPU_SUBTYPE_SH7780=y
@@ -173,7 +183,9 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_ARCH_SELECT_MEMORY_MODEL=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_ENTRY_OFFSET=0x00001000
 CONFIG_HUGETLB_PAGE_SIZE_64K=y
 # CONFIG_HUGETLB_PAGE_SIZE_256K is not set
 # CONFIG_HUGETLB_PAGE_SIZE_1MB is not set
@@ -188,6 +200,7 @@ CONFIG_FLATMEM=y
 CONFIG_FLAT_NODE_MEM_MAP=y
 CONFIG_SPARSEMEM_STATIC=y
 # CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
+CONFIG_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
 # CONFIG_RESOURCES_64BIT is not set
 CONFIG_ZONE_DMA_FLAG=0
@@ -268,7 +281,7 @@ CONFIG_KEXEC=y
 # CONFIG_PREEMPT_NONE is not set
 # CONFIG_PREEMPT_VOLUNTARY is not set
 CONFIG_PREEMPT=y
-CONFIG_RCU_TRACE=y
+# CONFIG_PREEMPT_RCU is not set
 CONFIG_GUSA=y
 
 #
@@ -348,14 +361,13 @@ CONFIG_TCP_CONG_CUBIC=y
 CONFIG_DEFAULT_TCP_CONG="cubic"
 # 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 is not set
 # CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
 # CONFIG_IP_SCTP is not set
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
+CONFIG_STP=m
 CONFIG_BRIDGE=m
 # CONFIG_VLAN_8021Q is not set
 # CONFIG_DECNET is not set
@@ -384,6 +396,7 @@ CONFIG_LLC=m
 #
 # CONFIG_CFG80211 is not set
 CONFIG_WIRELESS_EXT=y
+CONFIG_WIRELESS_EXT_SYSFS=y
 # CONFIG_MAC80211 is not set
 # CONFIG_IEEE80211 is not set
 # CONFIG_RFKILL is not set
@@ -400,6 +413,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 CONFIG_FW_LOADER=m
+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
@@ -420,12 +435,14 @@ 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_PHANTOM is not set
 CONFIG_EEPROM_93CX6=y
 # 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_HAVE_IDE=y
 # CONFIG_IDE is not set
 
@@ -499,9 +516,13 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_SRP is not set
+# CONFIG_SCSI_DH is not set
 CONFIG_ATA=y
 # CONFIG_ATA_NONSTANDARD is not set
+CONFIG_SATA_PMP=y
 # CONFIG_SATA_AHCI is not set
+# CONFIG_SATA_SIL24 is not set
+CONFIG_ATA_SFF=y
 # CONFIG_SATA_SVW is not set
 # CONFIG_ATA_PIIX is not set
 # CONFIG_SATA_MV is not set
@@ -511,7 +532,6 @@ CONFIG_ATA=y
 # CONFIG_SATA_PROMISE is not set
 # CONFIG_SATA_SX4 is not set
 CONFIG_SATA_SIL=y
-# CONFIG_SATA_SIL24 is not set
 # CONFIG_SATA_SIS is not set
 # CONFIG_SATA_ULI is not set
 # CONFIG_SATA_VIA is not set
@@ -556,17 +576,21 @@ CONFIG_SATA_SIL=y
 # 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
 #
+
+#
+# Enable only one of the two stacks, unless you know what you are doing
+#
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
 # CONFIG_I2O is not set
 CONFIG_NETDEVICES=y
-# CONFIG_NETDEVICES_MULTIQUEUE is not set
 # CONFIG_DUMMY is not set
 # CONFIG_BONDING is not set
 # CONFIG_MACVLAN is not set
@@ -585,6 +609,7 @@ CONFIG_AX88796_93CX6=y
 # CONFIG_CASSINI is not set
 # CONFIG_NET_VENDOR_3COM is not set
 # CONFIG_SMC91X is not set
+# CONFIG_SMC911X is not set
 # CONFIG_NET_TULIP is not set
 # CONFIG_HP100 is not set
 # CONFIG_IBM_NEW_EMAC_ZMII is not set
@@ -593,7 +618,6 @@ CONFIG_AX88796_93CX6=y
 # CONFIG_IBM_NEW_EMAC_EMAC4 is not set
 CONFIG_NET_PCI=y
 CONFIG_PCNET32=m
-# CONFIG_PCNET32_NAPI is not set
 # CONFIG_AMD8111_ETH is not set
 # CONFIG_ADAPTEC_STARFIRE is not set
 # CONFIG_B44 is not set
@@ -616,32 +640,28 @@ CONFIG_8139TOO_8129=y
 # CONFIG_TLAN is not set
 CONFIG_VIA_RHINE=m
 CONFIG_VIA_RHINE_MMIO=y
-# CONFIG_VIA_RHINE_NAPI is not set
 # CONFIG_SC92031 is not set
 CONFIG_NETDEV_1000=y
 # CONFIG_ACENIC is not set
 # CONFIG_DL2K is not set
 CONFIG_E1000=m
-# CONFIG_E1000_NAPI is not set
 # CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
 # CONFIG_E1000E is not set
-# CONFIG_E1000E_ENABLED is not set
 # CONFIG_IP1000 is not set
 # CONFIG_IGB is not set
 # CONFIG_NS83820 is not set
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 CONFIG_R8169=y
-# CONFIG_R8169_NAPI is not set
 # CONFIG_SIS190 is not set
 # CONFIG_SKGE is not set
 # CONFIG_SKY2 is not set
-# CONFIG_SK98LIN is not set
 # CONFIG_VIA_VELOCITY is not set
 # CONFIG_TIGON3 is not set
 # CONFIG_BNX2 is not set
 # CONFIG_QLA3XXX is not set
 # CONFIG_ATL1 is not set
+# CONFIG_ATL1E is not set
 CONFIG_NETDEV_10000=y
 # CONFIG_CHELSIO_T1 is not set
 # CONFIG_CHELSIO_T3 is not set
@@ -654,6 +674,7 @@ CONFIG_NETDEV_10000=y
 # CONFIG_MLX4_CORE is not set
 # CONFIG_TEHUTI is not set
 # CONFIG_BNX2X is not set
+# CONFIG_SFC is not set
 # CONFIG_TR is not set
 
 #
@@ -661,6 +682,7 @@ CONFIG_NETDEV_10000=y
 #
 # CONFIG_WLAN_PRE80211 is not set
 # CONFIG_WLAN_80211 is not set
+# CONFIG_IWLWIFI_LEDS is not set
 # CONFIG_WAN is not set
 # CONFIG_FDDI is not set
 # CONFIG_HIPPI is not set
@@ -701,6 +723,7 @@ CONFIG_KEYBOARD_ATKBD=y
 # CONFIG_KEYBOARD_XTKBD is not set
 # CONFIG_KEYBOARD_NEWTON is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
+# CONFIG_KEYBOARD_SH_KEYSC is not set
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_INPUT_JOYSTICK is not set
 # CONFIG_INPUT_TABLET is not set
@@ -722,6 +745,7 @@ CONFIG_SERIO_LIBPS2=y
 # Character devices
 #
 # CONFIG_VT is not set
+CONFIG_DEVKMEM=y
 # CONFIG_SERIAL_NONSTANDARD is not set
 # CONFIG_NOZOMI is not set
 
@@ -750,12 +774,7 @@ CONFIG_HW_RANDOM=y
 # CONFIG_TCG_TPM is not set
 CONFIG_DEVPORT=y
 # CONFIG_I2C is not set
-
-#
-# SPI support
-#
 # CONFIG_SPI is not set
-# CONFIG_SPI_MASTER is not set
 # CONFIG_W1 is not set
 # CONFIG_POWER_SUPPLY is not set
 CONFIG_HWMON=y
@@ -776,6 +795,7 @@ CONFIG_HWMON=y
 # 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
 
 #
@@ -787,13 +807,24 @@ CONFIG_SSB_POSSIBLE=y
 #
 # Multifunction device drivers
 #
+# CONFIG_MFD_CORE is not set
 # CONFIG_MFD_SM501 is not set
+# CONFIG_HTC_PASIC3 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
 
 #
@@ -809,24 +840,9 @@ CONFIG_DAB=y
 # Display device support
 #
 # CONFIG_DISPLAY_SUPPORT is not set
-
-#
-# Sound
-#
 CONFIG_SOUND=m
-
-#
-# Advanced Linux Sound Architecture
-#
 # CONFIG_SND is not set
-
-#
-# Open Sound System
-#
 CONFIG_SOUND_PRIME=m
-# CONFIG_SOUND_TRIDENT is not set
-# CONFIG_SOUND_MSNDCLAS is not set
-# CONFIG_SOUND_MSNDPIN is not set
 CONFIG_HID_SUPPORT=y
 CONFIG_HID=y
 # CONFIG_HID_DEBUG is not set
@@ -836,6 +852,8 @@ 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'
@@ -844,6 +862,7 @@ CONFIG_USB_ARCH_HAS_EHCI=y
 # 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
@@ -879,10 +898,7 @@ CONFIG_RTC_INTF_DEV=y
 # on-CPU RTC drivers
 #
 CONFIG_RTC_DRV_SH=y
-
-#
-# Userspace I/O
-#
+# CONFIG_DMADEVICES is not set
 # CONFIG_UIO is not set
 
 #
@@ -903,7 +919,6 @@ CONFIG_FS_MBCACHE=y
 # 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_DNOTIFY=y
 CONFIG_INOTIFY=y
@@ -957,6 +972,7 @@ CONFIG_CONFIGFS_FS=m
 # CONFIG_CRAMFS is not set
 # CONFIG_VXFS_FS is not set
 CONFIG_MINIX_FS=y
+# CONFIG_OMFS_FS is not set
 # CONFIG_HPFS_FS is not set
 # CONFIG_QNX4FS_FS is not set
 # CONFIG_ROMFS_FS is not set
@@ -967,20 +983,17 @@ CONFIG_NFS_FS=y
 CONFIG_NFS_V3=y
 # CONFIG_NFS_V3_ACL is not set
 CONFIG_NFS_V4=y
-# CONFIG_NFS_DIRECTIO is not set
+CONFIG_ROOT_NFS=y
 CONFIG_NFSD=y
 CONFIG_NFSD_V3=y
 # CONFIG_NFSD_V3_ACL is not set
 CONFIG_NFSD_V4=y
-CONFIG_NFSD_TCP=y
-CONFIG_ROOT_NFS=y
 CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
 CONFIG_EXPORTFS=y
 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
@@ -1043,6 +1056,7 @@ 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=y
 # CONFIG_UNUSED_SYMBOLS is not set
 CONFIG_DEBUG_FS=y
@@ -1050,9 +1064,12 @@ CONFIG_DEBUG_FS=y
 CONFIG_DEBUG_KERNEL=y
 # CONFIG_DEBUG_SHIRQ is not set
 CONFIG_DETECT_SOFTLOCKUP=y
+# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
+CONFIG_BOOTPARAM_SOFTLOCKUP_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 is not set
 # CONFIG_DEBUG_SPINLOCK is not set
@@ -1066,6 +1083,8 @@ CONFIG_SCHED_DEBUG=y
 CONFIG_DEBUG_BUGVERBOSE=y
 CONFIG_DEBUG_INFO=y
 # 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_FRAME_POINTER is not set
@@ -1091,51 +1110,84 @@ CONFIG_DEBUG_STACKOVERFLOW=y
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITY_FILE_CAPABILITIES is not set
 CONFIG_CRYPTO=y
+
+#
+# Crypto core or helper
+#
 CONFIG_CRYPTO_ALGAPI=y
 CONFIG_CRYPTO_BLKCIPHER=y
-# CONFIG_CRYPTO_SEQIV is not set
 CONFIG_CRYPTO_HASH=y
 CONFIG_CRYPTO_MANAGER=y
+# 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=y
+# CONFIG_CRYPTO_CTR is not set
+# CONFIG_CRYPTO_CTS is not set
+CONFIG_CRYPTO_ECB=m
+# CONFIG_CRYPTO_LRW is not set
+CONFIG_CRYPTO_PCBC=m
+# CONFIG_CRYPTO_XTS is not set
+
+#
+# Hash modes
+#
 CONFIG_CRYPTO_HMAC=y
 # CONFIG_CRYPTO_XCBC is not set
-# CONFIG_CRYPTO_NULL is not set
+
+#
+# Digest
+#
+# CONFIG_CRYPTO_CRC32C is not set
 # CONFIG_CRYPTO_MD4 is not set
 CONFIG_CRYPTO_MD5=y
+# 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_WP512 is not set
 # CONFIG_CRYPTO_TGR192 is not set
-# CONFIG_CRYPTO_GF128MUL is not set
-CONFIG_CRYPTO_ECB=m
-CONFIG_CRYPTO_CBC=y
-CONFIG_CRYPTO_PCBC=m
-# CONFIG_CRYPTO_LRW is not set
-# CONFIG_CRYPTO_XTS is not set
-# CONFIG_CRYPTO_CTR is not set
-# CONFIG_CRYPTO_GCM is not set
-# CONFIG_CRYPTO_CCM is not set
-# CONFIG_CRYPTO_CRYPTD is not set
-CONFIG_CRYPTO_DES=y
-# CONFIG_CRYPTO_FCRYPT is not set
-# CONFIG_CRYPTO_BLOWFISH is not set
-# CONFIG_CRYPTO_TWOFISH is not set
-# CONFIG_CRYPTO_SERPENT 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_TEA is not set
-# CONFIG_CRYPTO_ARC4 is not set
+CONFIG_CRYPTO_DES=y
+# CONFIG_CRYPTO_FCRYPT is not set
 # CONFIG_CRYPTO_KHAZAD is not set
-# CONFIG_CRYPTO_ANUBIS is not set
-# CONFIG_CRYPTO_SEED 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_MICHAEL_MIC is not set
-# CONFIG_CRYPTO_CRC32C is not set
-# CONFIG_CRYPTO_CAMELLIA is not set
-# CONFIG_CRYPTO_TEST is not set
-# CONFIG_CRYPTO_AUTHENC is not set
 # CONFIG_CRYPTO_LZO is not set
 CONFIG_CRYPTO_HW=y
 # CONFIG_CRYPTO_DEV_HIFN_795X is not set
@@ -1144,8 +1196,10 @@ CONFIG_CRYPTO_HW=y
 # Library routines
 #
 CONFIG_BITREVERSE=y
+# CONFIG_GENERIC_FIND_FIRST_BIT is not set
 # CONFIG_CRC_CCITT is not set
 # CONFIG_CRC16 is not set
+CONFIG_CRC_T10DIF=y
 # CONFIG_CRC_ITU_T is not set
 CONFIG_CRC32=y
 # CONFIG_CRC7 is not set
index 0dc1ce7..1d09d24 100644 (file)
@@ -1,10 +1,11 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.24-rc3
-# Fri Nov 23 14:03:57 2007
+# Linux kernel version: 2.6.26
+# Wed Jul 30 00:59:19 2008
 #
 CONFIG_SUPERH=y
 CONFIG_SUPERH32=y
+CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
 CONFIG_GENERIC_BUG=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -21,6 +22,8 @@ CONFIG_LOCKDEP_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_SUPPORTS_AOUT=y
+CONFIG_IO_TRAPPED=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
 
 #
@@ -39,18 +42,16 @@ CONFIG_SYSVIPC_SYSCTL=y
 CONFIG_BSD_PROCESS_ACCT=y
 # CONFIG_BSD_PROCESS_ACCT_V3 is not set
 # CONFIG_TASKSTATS is not set
-# CONFIG_USER_NS is not set
-# CONFIG_PID_NS is not set
 # CONFIG_AUDIT is not set
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_LOG_BUF_SHIFT=14
 # CONFIG_CGROUPS is not set
-CONFIG_FAIR_GROUP_SCHED=y
-CONFIG_FAIR_USER_SCHED=y
-# CONFIG_FAIR_CGROUP_SCHED is not set
-# CONFIG_SYSFS_DEPRECATED is not set
+# CONFIG_GROUP_SCHED is not set
+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_CC_OPTIMIZE_FOR_SIZE=y
 CONFIG_SYSCTL=y
@@ -64,20 +65,37 @@ CONFIG_HOTPLUG=y
 CONFIG_PRINTK=y
 CONFIG_BUG=y
 CONFIG_ELF_CORE=y
+CONFIG_COMPAT_BRK=y
 CONFIG_BASE_FULL=y
 # CONFIG_FUTEX is not set
 CONFIG_ANON_INODES=y
 # CONFIG_EPOLL is not set
 CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
 CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
 CONFIG_VM_EVENT_COUNTERS=y
 CONFIG_SLAB=y
 # CONFIG_SLUB is not set
 # CONFIG_SLOB is not set
+CONFIG_PROFILING=y
+# CONFIG_MARKERS is not set
+CONFIG_OPROFILE=m
+CONFIG_HAVE_OPROFILE=y
+# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
+# CONFIG_HAVE_IOREMAP_PROT is not set
+# CONFIG_HAVE_KPROBES is not set
+# CONFIG_HAVE_KRETPROBES is not set
+# CONFIG_HAVE_ARCH_TRACEHOOK is not set
+# CONFIG_HAVE_DMA_ATTRS is not set
+# CONFIG_USE_GENERIC_SMP_HELPERS is not set
+CONFIG_HAVE_CLK=y
+CONFIG_PROC_PAGE_MONITOR=y
+CONFIG_SLABINFO=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
@@ -88,6 +106,7 @@ CONFIG_BLOCK=y
 # CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_LSF is not set
 # CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
 
 #
 # IO Schedulers
@@ -101,6 +120,7 @@ CONFIG_IOSCHED_NOOP=y
 # CONFIG_DEFAULT_CFQ is not set
 CONFIG_DEFAULT_NOOP=y
 CONFIG_DEFAULT_IOSCHED="noop"
+CONFIG_CLASSIC_RCU=y
 
 #
 # System type
@@ -109,7 +129,10 @@ CONFIG_CPU_SH4=y
 CONFIG_CPU_SH4A=y
 CONFIG_CPU_SHX2=y
 # CONFIG_CPU_SUBTYPE_SH7619 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
@@ -118,6 +141,7 @@ CONFIG_CPU_SHX2=y
 # 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
@@ -126,12 +150,15 @@ CONFIG_CPU_SHX2=y
 # 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_SH7763 is not set
 # CONFIG_CPU_SUBTYPE_SH7770 is not set
 # CONFIG_CPU_SUBTYPE_SH7780 is not set
 CONFIG_CPU_SUBTYPE_SH7785=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
 # CONFIG_CPU_SUBTYPE_SH5_101 is not set
 # CONFIG_CPU_SUBTYPE_SH5_103 is not set
 
@@ -157,7 +184,9 @@ CONFIG_ARCH_SELECT_MEMORY_MODEL=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=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_ENTRY_OFFSET=0x00001000
 # CONFIG_HUGETLB_PAGE_SIZE_64K is not set
 # CONFIG_HUGETLB_PAGE_SIZE_256K is not set
 CONFIG_HUGETLB_PAGE_SIZE_1MB=y
@@ -173,6 +202,7 @@ CONFIG_HAVE_MEMORY_PRESENT=y
 CONFIG_SPARSEMEM_STATIC=y
 # CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
 # CONFIG_MEMORY_HOTPLUG is not set
+CONFIG_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
 # CONFIG_RESOURCES_64BIT is not set
 CONFIG_ZONE_DMA_FLAG=0
@@ -202,6 +232,7 @@ CONFIG_CPU_HAS_FPU=y
 # Board support
 #
 CONFIG_SH_HIGHLANDER=y
+# CONFIG_SH_SH7785LCR is not set
 # CONFIG_SH_R7780RP is not set
 # CONFIG_SH_R7780MP is not set
 CONFIG_SH_R7785RP=y
@@ -245,12 +276,13 @@ CONFIG_HZ_250=y
 # CONFIG_HZ_300 is not set
 # CONFIG_HZ_1000 is not set
 CONFIG_HZ=250
+# CONFIG_SCHED_HRTICK is not set
 CONFIG_KEXEC=y
 # CONFIG_CRASH_DUMP is not set
 # CONFIG_PREEMPT_NONE is not set
 # CONFIG_PREEMPT_VOLUNTARY is not set
 CONFIG_PREEMPT=y
-CONFIG_PREEMPT_BKL=y
+# CONFIG_PREEMPT_RCU is not set
 CONFIG_GUSA=y
 
 #
@@ -295,6 +327,7 @@ 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 is not set
 CONFIG_INET=y
 # CONFIG_IP_MULTICAST is not set
@@ -329,14 +362,13 @@ CONFIG_TCP_CONG_CUBIC=y
 CONFIG_DEFAULT_TCP_CONG="cubic"
 # 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 is not set
 # CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
 # CONFIG_IP_SCTP is not set
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
+CONFIG_STP=m
 CONFIG_BRIDGE=m
 # CONFIG_VLAN_8021Q is not set
 # CONFIG_DECNET is not set
@@ -355,6 +387,7 @@ CONFIG_LLC=m
 #
 # 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
@@ -364,6 +397,7 @@ CONFIG_LLC=m
 #
 # CONFIG_CFG80211 is not set
 CONFIG_WIRELESS_EXT=y
+CONFIG_WIRELESS_EXT_SYSFS=y
 # CONFIG_MAC80211 is not set
 # CONFIG_IEEE80211 is not set
 # CONFIG_RFKILL is not set
@@ -380,6 +414,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 CONFIG_FW_LOADER=m
+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
@@ -397,14 +433,18 @@ CONFIG_BLK_DEV=y
 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_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_PHANTOM is not set
 CONFIG_EEPROM_93CX6=y
 # 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_HAVE_IDE=y
 # CONFIG_IDE is not set
 
 #
@@ -464,6 +504,7 @@ 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_IPR is not set
@@ -476,9 +517,13 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_SRP is not set
+# CONFIG_SCSI_DH is not set
 CONFIG_ATA=y
 # CONFIG_ATA_NONSTANDARD is not set
+CONFIG_SATA_PMP=y
 # CONFIG_SATA_AHCI is not set
+# CONFIG_SATA_SIL24 is not set
+CONFIG_ATA_SFF=y
 # CONFIG_SATA_SVW is not set
 # CONFIG_ATA_PIIX is not set
 # CONFIG_SATA_MV is not set
@@ -488,7 +533,6 @@ CONFIG_ATA=y
 # CONFIG_SATA_PROMISE is not set
 # CONFIG_SATA_SX4 is not set
 CONFIG_SATA_SIL=y
-# CONFIG_SATA_SIL24 is not set
 # CONFIG_SATA_SIS is not set
 # CONFIG_SATA_ULI is not set
 # CONFIG_SATA_VIA is not set
@@ -517,6 +561,7 @@ CONFIG_SATA_SIL=y
 # 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
@@ -532,24 +577,27 @@ CONFIG_SATA_SIL=y
 # 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
 #
+
+#
+# Enable only one of the two stacks, unless you know what you are doing
+#
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
 # CONFIG_I2O is not set
 CONFIG_NETDEVICES=y
-# CONFIG_NETDEVICES_MULTIQUEUE is not set
 # 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_IP1000 is not set
 # CONFIG_ARCNET is not set
 # CONFIG_PHYLIB is not set
 CONFIG_NET_ETHERNET=y
@@ -576,20 +624,21 @@ CONFIG_NETDEV_1000=y
 # CONFIG_DL2K is not set
 # CONFIG_E1000 is not set
 # CONFIG_E1000E is not set
+# CONFIG_IP1000 is not set
+# CONFIG_IGB is not set
 # CONFIG_NS83820 is not set
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 CONFIG_R8169=y
-# CONFIG_R8169_NAPI is not set
 # CONFIG_SIS190 is not set
 # CONFIG_SKGE is not set
 # CONFIG_SKY2 is not set
-# CONFIG_SK98LIN is not set
 # CONFIG_VIA_VELOCITY is not set
 # CONFIG_TIGON3 is not set
 # CONFIG_BNX2 is not set
 # CONFIG_QLA3XXX is not set
 # CONFIG_ATL1 is not set
+# CONFIG_ATL1E is not set
 CONFIG_NETDEV_10000=y
 # CONFIG_CHELSIO_T1 is not set
 # CONFIG_CHELSIO_T3 is not set
@@ -601,6 +650,8 @@ CONFIG_NETDEV_10000=y
 # CONFIG_NIU is not set
 # CONFIG_MLX4_CORE is not set
 # CONFIG_TEHUTI is not set
+# CONFIG_BNX2X is not set
+# CONFIG_SFC is not set
 # CONFIG_TR is not set
 
 #
@@ -608,13 +659,13 @@ CONFIG_NETDEV_10000=y
 #
 # CONFIG_WLAN_PRE80211 is not set
 # CONFIG_WLAN_80211 is not set
+# CONFIG_IWLWIFI_LEDS 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_SHAPER is not set
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
@@ -649,6 +700,7 @@ CONFIG_KEYBOARD_ATKBD=y
 # CONFIG_KEYBOARD_XTKBD is not set
 # CONFIG_KEYBOARD_NEWTON is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
+# CONFIG_KEYBOARD_SH_KEYSC is not set
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_INPUT_JOYSTICK is not set
 # CONFIG_INPUT_TABLET is not set
@@ -670,7 +722,9 @@ CONFIG_SERIO_LIBPS2=y
 # Character devices
 #
 # CONFIG_VT is not set
+CONFIG_DEVKMEM=y
 # CONFIG_SERIAL_NONSTANDARD is not set
+# CONFIG_NOZOMI is not set
 
 #
 # Serial drivers
@@ -697,12 +751,7 @@ CONFIG_HW_RANDOM=y
 # CONFIG_TCG_TPM is not set
 CONFIG_DEVPORT=y
 # CONFIG_I2C is not set
-
-#
-# SPI support
-#
 # CONFIG_SPI is not set
-# CONFIG_SPI_MASTER is not set
 # CONFIG_W1 is not set
 # CONFIG_POWER_SUPPLY is not set
 CONFIG_HWMON=y
@@ -722,6 +771,8 @@ CONFIG_HWMON=y
 # 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
 
 #
@@ -733,13 +784,24 @@ CONFIG_SSB_POSSIBLE=y
 #
 # Multifunction device drivers
 #
+# CONFIG_MFD_CORE is not set
 # CONFIG_MFD_SM501 is not set
+# CONFIG_HTC_PASIC3 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
 
 #
@@ -751,15 +813,15 @@ CONFIG_SSB_POSSIBLE=y
 CONFIG_FB=y
 # CONFIG_FIRMWARE_EDID is not set
 # CONFIG_FB_DDC is not set
-# CONFIG_FB_CFB_FILLRECT is not set
-# CONFIG_FB_CFB_COPYAREA is not set
-# CONFIG_FB_CFB_IMAGEBLIT is not set
+CONFIG_FB_CFB_FILLRECT=m
+CONFIG_FB_CFB_COPYAREA=m
+CONFIG_FB_CFB_IMAGEBLIT=m
 # 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_DEFERRED_IO=y
 # CONFIG_FB_SVGALIB is not set
 # CONFIG_FB_MACMODES is not set
 # CONFIG_FB_BACKLIGHT is not set
@@ -792,6 +854,8 @@ CONFIG_FB_DEFERRED_IO=y
 # 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_SH_MOBILE_LCDC=m
 # CONFIG_FB_VIRTUAL is not set
 # CONFIG_BACKLIGHT_LCD_SUPPORT is not set
 
@@ -800,24 +864,9 @@ CONFIG_FB_DEFERRED_IO=y
 #
 # CONFIG_DISPLAY_SUPPORT is not set
 # CONFIG_LOGO is not set
-
-#
-# Sound
-#
 CONFIG_SOUND=m
-
-#
-# Advanced Linux Sound Architecture
-#
 # CONFIG_SND is not set
-
-#
-# Open Sound System
-#
 CONFIG_SOUND_PRIME=m
-# CONFIG_SOUND_TRIDENT is not set
-# CONFIG_SOUND_MSNDCLAS is not set
-# CONFIG_SOUND_MSNDPIN is not set
 CONFIG_HID_SUPPORT=y
 CONFIG_HID=y
 # CONFIG_HID_DEBUG is not set
@@ -827,17 +876,17 @@ 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'
 #
-
-#
-# USB Gadget Support
-#
 # CONFIG_USB_GADGET 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
@@ -861,9 +910,10 @@ CONFIG_RTC_INTF_DEV=y
 #
 # Platform RTC drivers
 #
+# CONFIG_RTC_DRV_DS1511 is not set
 # CONFIG_RTC_DRV_DS1553 is not set
-# CONFIG_RTC_DRV_STK17TA8 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_M48T59 is not set
 # CONFIG_RTC_DRV_V3020 is not set
@@ -872,10 +922,7 @@ CONFIG_RTC_INTF_DEV=y
 # on-CPU RTC drivers
 #
 CONFIG_RTC_DRV_SH=y
-
-#
-# Userspace I/O
-#
+# CONFIG_DMADEVICES is not set
 # CONFIG_UIO is not set
 
 #
@@ -896,14 +943,11 @@ CONFIG_FS_MBCACHE=y
 # 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=y
-# CONFIG_ROMFS_FS is not set
+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=m
@@ -951,8 +995,11 @@ CONFIG_CONFIGFS_FS=m
 # CONFIG_EFS_FS is not set
 # CONFIG_CRAMFS is not set
 # CONFIG_VXFS_FS is not set
+CONFIG_MINIX_FS=y
+# 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
@@ -960,20 +1007,17 @@ CONFIG_NFS_FS=y
 CONFIG_NFS_V3=y
 # CONFIG_NFS_V3_ACL is not set
 CONFIG_NFS_V4=y
-# CONFIG_NFS_DIRECTIO is not set
+CONFIG_ROOT_NFS=y
 CONFIG_NFSD=y
 CONFIG_NFSD_V3=y
 # CONFIG_NFSD_V3_ACL is not set
 CONFIG_NFSD_V4=y
-CONFIG_NFSD_TCP=y
-CONFIG_ROOT_NFS=y
 CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
 CONFIG_EXPORTFS=y
 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
@@ -1028,10 +1072,6 @@ CONFIG_NLS_ISO8859_1=y
 # CONFIG_NLS_KOI8_U is not set
 # CONFIG_NLS_UTF8 is not set
 # CONFIG_DLM is not set
-CONFIG_INSTRUMENTATION=y
-CONFIG_PROFILING=y
-CONFIG_OPROFILE=m
-# CONFIG_MARKERS is not set
 
 #
 # Kernel hacking
@@ -1040,6 +1080,7 @@ 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=y
 # CONFIG_UNUSED_SYMBOLS is not set
 CONFIG_DEBUG_FS=y
@@ -1050,6 +1091,7 @@ CONFIG_DEBUG_KERNEL=y
 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 is not set
 CONFIG_DEBUG_SPINLOCK=y
@@ -1066,12 +1108,14 @@ CONFIG_STACKTRACE=y
 CONFIG_DEBUG_BUGVERBOSE=y
 CONFIG_DEBUG_INFO=y
 # 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_FRAME_POINTER=y
-CONFIG_FORCED_INLINING=y
 # CONFIG_BOOT_PRINTK_DELAY is not set
 # CONFIG_RCU_TORTURE_TEST is not set
+# CONFIG_BACKTRACE_SELF_TEST is not set
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_SAMPLES is not set
 CONFIG_SH_STANDARD_BIOS=y
@@ -1091,54 +1135,96 @@ CONFIG_4KSTACKS=y
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITY_FILE_CAPABILITIES is not set
 CONFIG_CRYPTO=y
+
+#
+# Crypto core or helper
+#
 CONFIG_CRYPTO_ALGAPI=y
 CONFIG_CRYPTO_BLKCIPHER=y
 CONFIG_CRYPTO_HASH=y
 CONFIG_CRYPTO_MANAGER=y
+# 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=y
+# CONFIG_CRYPTO_CTR is not set
+# CONFIG_CRYPTO_CTS is not set
+CONFIG_CRYPTO_ECB=m
+# CONFIG_CRYPTO_LRW is not set
+CONFIG_CRYPTO_PCBC=m
+# CONFIG_CRYPTO_XTS is not set
+
+#
+# Hash modes
+#
 CONFIG_CRYPTO_HMAC=y
 # CONFIG_CRYPTO_XCBC is not set
-# CONFIG_CRYPTO_NULL is not set
+
+#
+# Digest
+#
+# CONFIG_CRYPTO_CRC32C is not set
 # CONFIG_CRYPTO_MD4 is not set
 CONFIG_CRYPTO_MD5=y
+# 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_WP512 is not set
 # CONFIG_CRYPTO_TGR192 is not set
-# CONFIG_CRYPTO_GF128MUL is not set
-CONFIG_CRYPTO_ECB=m
-CONFIG_CRYPTO_CBC=y
-CONFIG_CRYPTO_PCBC=m
-# CONFIG_CRYPTO_LRW is not set
-# CONFIG_CRYPTO_XTS is not set
-# CONFIG_CRYPTO_CRYPTD is not set
-CONFIG_CRYPTO_DES=y
-# CONFIG_CRYPTO_FCRYPT is not set
-# CONFIG_CRYPTO_BLOWFISH is not set
-# CONFIG_CRYPTO_TWOFISH is not set
-# CONFIG_CRYPTO_SERPENT 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_TEA is not set
-# CONFIG_CRYPTO_ARC4 is not set
+CONFIG_CRYPTO_DES=y
+# CONFIG_CRYPTO_FCRYPT is not set
 # CONFIG_CRYPTO_KHAZAD is not set
-# CONFIG_CRYPTO_ANUBIS 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_MICHAEL_MIC is not set
-# CONFIG_CRYPTO_CRC32C is not set
-# CONFIG_CRYPTO_CAMELLIA is not set
-# CONFIG_CRYPTO_TEST is not set
-# CONFIG_CRYPTO_AUTHENC is not set
+# CONFIG_CRYPTO_LZO is not set
 CONFIG_CRYPTO_HW=y
+# CONFIG_CRYPTO_DEV_HIFN_795X is not set
 
 #
 # Library routines
 #
 CONFIG_BITREVERSE=y
+# CONFIG_GENERIC_FIND_FIRST_BIT is not set
 # CONFIG_CRC_CCITT is not set
 # CONFIG_CRC16 is not set
+CONFIG_CRC_T10DIF=y
 # CONFIG_CRC_ITU_T is not set
 CONFIG_CRC32=y
 # CONFIG_CRC7 is not set
index a0ebd43..840fe38 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.26-rc4
-# Tue Jun  3 13:02:42 2008
+# Linux kernel version: 2.6.26
+# Mon Jul 28 22:23:03 2008
 #
 CONFIG_SUPERH=y
 CONFIG_SUPERH32=y
@@ -33,21 +33,22 @@ CONFIG_LOCALVERSION=""
 CONFIG_SYSVIPC=y
 CONFIG_SYSVIPC_SYSCTL=y
 CONFIG_POSIX_MQUEUE=y
-# CONFIG_BSD_PROCESS_ACCT is not set
+CONFIG_BSD_PROCESS_ACCT=y
+# CONFIG_BSD_PROCESS_ACCT_V3 is not set
 # CONFIG_TASKSTATS is not set
 # CONFIG_AUDIT is not set
-# CONFIG_IKCONFIG is not set
+CONFIG_IKCONFIG=y
+# CONFIG_IKCONFIG_PROC is not set
 CONFIG_LOG_BUF_SHIFT=14
 # CONFIG_CGROUPS is not set
-CONFIG_GROUP_SCHED=y
-CONFIG_FAIR_GROUP_SCHED=y
-# CONFIG_RT_GROUP_SCHED is not set
-CONFIG_USER_SCHED=y
-# CONFIG_CGROUP_SCHED is not set
-CONFIG_SYSFS_DEPRECATED=y
-CONFIG_SYSFS_DEPRECATED_V2=y
+# CONFIG_GROUP_SCHED is not set
+# CONFIG_SYSFS_DEPRECATED_V2 is not set
 # CONFIG_RELAY is not set
-# CONFIG_NAMESPACES is not set
+CONFIG_NAMESPACES=y
+CONFIG_UTS_NS=y
+CONFIG_IPC_NS=y
+CONFIG_USER_NS=y
+CONFIG_PID_NS=y
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE=""
 CONFIG_CC_OPTIMIZE_FOR_SIZE=y
@@ -72,26 +73,36 @@ CONFIG_SIGNALFD=y
 CONFIG_TIMERFD=y
 CONFIG_EVENTFD=y
 CONFIG_VM_EVENT_COUNTERS=y
-CONFIG_SLAB=y
+# CONFIG_SLAB is not set
 # CONFIG_SLUB is not set
-# CONFIG_SLOB is not set
+CONFIG_SLOB=y
 CONFIG_PROFILING=y
 # CONFIG_MARKERS is not set
 CONFIG_OPROFILE=y
 CONFIG_HAVE_OPROFILE=y
+# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
+# CONFIG_HAVE_IOREMAP_PROT is not set
 # CONFIG_HAVE_KPROBES is not set
 # CONFIG_HAVE_KRETPROBES is not set
+# CONFIG_HAVE_ARCH_TRACEHOOK is not set
 # CONFIG_HAVE_DMA_ATTRS is not set
-CONFIG_SLABINFO=y
+# CONFIG_USE_GENERIC_SMP_HELPERS is not set
+CONFIG_HAVE_CLK=y
 CONFIG_RT_MUTEXES=y
 CONFIG_TINY_SHMEM=y
 CONFIG_BASE_SMALL=0
-# CONFIG_MODULES is not set
+CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
+# CONFIG_MODULE_UNLOAD is not set
+# CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+CONFIG_KMOD=y
 CONFIG_BLOCK=y
 # CONFIG_LBD is not set
 # CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_LSF is not set
 # CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
 
 #
 # IO Schedulers
@@ -162,7 +173,9 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_ARCH_SELECT_MEMORY_MODEL=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_ENTRY_OFFSET=0x00001000
 CONFIG_SELECT_MEMORY_MODEL=y
 CONFIG_FLATMEM_MANUAL=y
 # CONFIG_DISCONTIGMEM_MANUAL is not set
@@ -196,6 +209,7 @@ CONFIG_CPU_HAS_FPU=y
 #
 # Board support
 #
+CONFIG_SH_RSK7203=y
 
 #
 # Timer and clock configuration
@@ -274,6 +288,7 @@ CONFIG_CMDLINE="console=ttySC0,115200 earlyprintk=serial ignore_loglevel"
 #
 # Executable file formats
 #
+CONFIG_BINFMT_ELF_FDPIC=y
 CONFIG_BINFMT_FLAT=y
 CONFIG_BINFMT_ZFLAT=y
 CONFIG_BINFMT_SHARED_FLAT=y
@@ -424,8 +439,8 @@ CONFIG_MTD_CFI_UTIL=y
 #
 # CONFIG_MTD_COMPLEX_MAPPINGS is not set
 CONFIG_MTD_PHYSMAP=y
-CONFIG_MTD_PHYSMAP_START=0x20000000
-CONFIG_MTD_PHYSMAP_LEN=0x01000000
+CONFIG_MTD_PHYSMAP_START=0x0
+CONFIG_MTD_PHYSMAP_LEN=0x0
 CONFIG_MTD_PHYSMAP_BANKWIDTH=4
 # CONFIG_MTD_UCLINUX is not set
 # CONFIG_MTD_PLATRAM is not set
@@ -456,9 +471,11 @@ CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP 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_CDROM_PKTCDVD is not set
 # CONFIG_ATA_OVER_ETH is not set
+# CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
 # CONFIG_EEPROM_93CX6 is not set
 # CONFIG_ENCLOSURE_SERVICES is not set
@@ -475,7 +492,6 @@ CONFIG_HAVE_IDE=y
 # CONFIG_ATA is not set
 # CONFIG_MD is not set
 CONFIG_NETDEVICES=y
-# CONFIG_NETDEVICES_MULTIQUEUE is not set
 # CONFIG_DUMMY is not set
 # CONFIG_BONDING is not set
 # CONFIG_MACVLAN is not set
@@ -487,15 +503,15 @@ CONFIG_NET_ETHERNET=y
 CONFIG_MII=y
 # CONFIG_AX88796 is not set
 # CONFIG_STNIC is not set
-CONFIG_SMC91X=y
+# CONFIG_SMC91X is not set
+CONFIG_SMC911X=y
 # 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_B44 is not set
-CONFIG_NETDEV_1000=y
-# CONFIG_E1000E_ENABLED is not set
-CONFIG_NETDEV_10000=y
+# CONFIG_NETDEV_1000 is not set
+# CONFIG_NETDEV_10000 is not set
 
 #
 # Wireless LAN
@@ -503,6 +519,15 @@ CONFIG_NETDEV_10000=y
 # CONFIG_WLAN_PRE80211 is not set
 # CONFIG_WLAN_80211 is not set
 # CONFIG_IWLWIFI_LEDS 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 is not set
 # CONFIG_WAN is not set
 # CONFIG_PPP is not set
 # CONFIG_SLIP is not set
@@ -587,6 +612,7 @@ CONFIG_SSB_POSSIBLE=y
 #
 # Multifunction device drivers
 #
+# CONFIG_MFD_CORE is not set
 # CONFIG_MFD_SM501 is not set
 # CONFIG_HTC_PASIC3 is not set
 
@@ -605,6 +631,7 @@ CONFIG_SSB_POSSIBLE=y
 # Multimedia drivers
 #
 CONFIG_DAB=y
+# CONFIG_USB_DABUSB is not set
 
 #
 # Graphics support
@@ -618,26 +645,96 @@ CONFIG_VIDEO_OUTPUT_CONTROL=y
 # Display device support
 #
 # CONFIG_DISPLAY_SUPPORT is not set
-
-#
-# Sound
-#
 # CONFIG_SOUND is not set
 CONFIG_HID_SUPPORT=y
 CONFIG_HID=y
 # CONFIG_HID_DEBUG is not set
 # CONFIG_HIDRAW 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_SUPPORT=y
 CONFIG_USB_ARCH_HAS_HCD=y
 # CONFIG_USB_ARCH_HAS_OHCI is not set
 # 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=y
+
+#
+# Miscellaneous USB options
+#
+CONFIG_USB_DEVICEFS=y
+CONFIG_USB_DEVICE_CLASS=y
+# CONFIG_USB_DYNAMIC_MINORS is not set
+# CONFIG_USB_OTG is not set
 # CONFIG_USB_OTG_WHITELIST is not set
 # CONFIG_USB_OTG_BLACKLIST_HUB is not set
 
+#
+# USB Host Controller Drivers
+#
+# CONFIG_USB_C67X00_HCD is not set
+# CONFIG_USB_ISP116X_HCD is not set
+# CONFIG_USB_ISP1760_HCD is not set
+# CONFIG_USB_SL811_HCD is not set
+CONFIG_USB_R8A66597_HCD=y
+
+#
+# USB Device Class drivers
+#
+# CONFIG_USB_ACM is not set
+# CONFIG_USB_PRINTER is not set
+# CONFIG_USB_WDM is not set
+
 #
 # NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
 #
+
+#
+# may also be needed; see USB_STORAGE Help for more information
+#
+# CONFIG_USB_LIBUSUAL is not set
+
+#
+# USB Imaging devices
+#
+# CONFIG_USB_MDC800 is not set
+CONFIG_USB_MON=y
+
+#
+# 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_AUERSWALD 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_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 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_GADGET is not set
 # CONFIG_MMC is not set
 # CONFIG_MEMSTICK is not set
@@ -677,6 +774,7 @@ CONFIG_RTC_INTF_DEV=y
 # on-CPU RTC drivers
 #
 CONFIG_RTC_DRV_SH=y
+# CONFIG_DMADEVICES is not set
 # CONFIG_UIO is not set
 
 #
@@ -734,6 +832,7 @@ CONFIG_SYSFS=y
 # CONFIG_CRAMFS 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=y
@@ -743,12 +842,11 @@ CONFIG_NETWORK_FILESYSTEMS=y
 CONFIG_NFS_FS=y
 # CONFIG_NFS_V3 is not set
 # CONFIG_NFS_V4 is not set
-# CONFIG_NFSD is not set
 CONFIG_ROOT_NFS=y
+# CONFIG_NFSD is not set
 CONFIG_LOCKD=y
 CONFIG_NFS_COMMON=y
 CONFIG_SUNRPC=y
-# CONFIG_SUNRPC_BIND34 is not set
 # CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_RPCSEC_GSS_SPKM3 is not set
 # CONFIG_SMB_FS is not set
@@ -775,16 +873,20 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
 CONFIG_FRAME_WARN=1024
 CONFIG_MAGIC_SYSRQ=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=y
 CONFIG_DEBUG_SHIRQ=y
 CONFIG_DETECT_SOFTLOCKUP=y
+# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
+CONFIG_BOOTPARAM_SOFTLOCKUP_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_OBJECTS=y
+# CONFIG_DEBUG_OBJECTS_SELFTEST is not set
+# CONFIG_DEBUG_OBJECTS_FREE is not set
+# CONFIG_DEBUG_OBJECTS_TIMERS is not set
 # CONFIG_DEBUG_RT_MUTEXES is not set
 # CONFIG_RT_MUTEX_TESTER is not set
 # CONFIG_DEBUG_SPINLOCK is not set
@@ -797,12 +899,14 @@ CONFIG_DEBUG_SPINLOCK_SLEEP=y
 # CONFIG_DEBUG_KOBJECT is not set
 CONFIG_DEBUG_BUGVERBOSE=y
 CONFIG_DEBUG_INFO=y
-# CONFIG_DEBUG_VM is not set
-# CONFIG_DEBUG_WRITECOUNT is not set
-# CONFIG_DEBUG_LIST is not set
-# CONFIG_DEBUG_SG is not set
+CONFIG_DEBUG_VM=y
+CONFIG_DEBUG_WRITECOUNT=y
+# CONFIG_DEBUG_MEMORY_INIT is not set
+CONFIG_DEBUG_LIST=y
+CONFIG_DEBUG_SG=y
 CONFIG_FRAME_POINTER=y
 # CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_RCU_TORTURE_TEST is not set
 # CONFIG_BACKTRACE_SELF_TEST is not set
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_SAMPLES is not set
@@ -830,6 +934,7 @@ CONFIG_BITREVERSE=y
 # CONFIG_GENERIC_FIND_FIRST_BIT is not set
 # 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
index 3a915fd..8413236 100644 (file)
@@ -1,10 +1,11 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.24
-# Thu Feb  7 16:25:55 2008
+# Linux kernel version: 2.6.26
+# Wed Jul 30 01:55:52 2008
 #
 CONFIG_SUPERH=y
 CONFIG_SUPERH32=y
+CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
 CONFIG_GENERIC_BUG=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -20,6 +21,8 @@ CONFIG_LOCKDEP_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_SUPPORTS_AOUT=y
+CONFIG_IO_TRAPPED=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
 
 #
@@ -36,17 +39,15 @@ CONFIG_SYSVIPC_SYSCTL=y
 # CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
-# CONFIG_USER_NS is not set
-# CONFIG_PID_NS is not set
 # CONFIG_AUDIT is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
 # CONFIG_CGROUPS is not set
-CONFIG_FAIR_GROUP_SCHED=y
-CONFIG_FAIR_USER_SCHED=y
-# CONFIG_FAIR_CGROUP_SCHED is not set
+# CONFIG_GROUP_SCHED is not set
 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_CC_OPTIMIZE_FOR_SIZE is not set
 CONFIG_SYSCTL=y
@@ -76,22 +77,31 @@ CONFIG_PROFILING=y
 # CONFIG_MARKERS is not set
 CONFIG_OPROFILE=y
 CONFIG_HAVE_OPROFILE=y
+# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
+# CONFIG_HAVE_IOREMAP_PROT is not set
 # CONFIG_HAVE_KPROBES is not set
+# CONFIG_HAVE_KRETPROBES is not set
+# CONFIG_HAVE_ARCH_TRACEHOOK is not set
+# CONFIG_HAVE_DMA_ATTRS is not set
+# CONFIG_USE_GENERIC_SMP_HELPERS is not set
+CONFIG_HAVE_CLK=y
 CONFIG_PROC_PAGE_MONITOR=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 is not set
 # CONFIG_MODVERSIONS is not set
 # CONFIG_MODULE_SRCVERSION_ALL is not set
-# CONFIG_KMOD is not set
+CONFIG_KMOD=y
 CONFIG_BLOCK=y
 # CONFIG_LBD is not set
 # CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_LSF is not set
 # CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
 
 #
 # IO Schedulers
@@ -106,7 +116,6 @@ CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="anticipatory"
 CONFIG_CLASSIC_RCU=y
-# CONFIG_PREEMPT_RCU is not set
 
 #
 # System type
@@ -116,6 +125,7 @@ CONFIG_CPU_SH4=y
 # 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
@@ -133,6 +143,7 @@ CONFIG_CPU_SH4=y
 CONFIG_CPU_SUBTYPE_SH7751R=y
 # 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_SH7763 is not set
 # CONFIG_CPU_SUBTYPE_SH7770 is not set
 # CONFIG_CPU_SUBTYPE_SH7780 is not set
@@ -140,6 +151,7 @@ CONFIG_CPU_SUBTYPE_SH7751R=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
 # CONFIG_CPU_SUBTYPE_SH5_101 is not set
 # CONFIG_CPU_SUBTYPE_SH5_103 is not set
 
@@ -161,7 +173,9 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_ARCH_SELECT_MEMORY_MODEL=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_ENTRY_OFFSET=0x00001000
 CONFIG_SELECT_MEMORY_MODEL=y
 CONFIG_FLATMEM_MANUAL=y
 # CONFIG_DISCONTIGMEM_MANUAL is not set
@@ -170,6 +184,7 @@ CONFIG_FLATMEM=y
 CONFIG_FLAT_NODE_MEM_MAP=y
 CONFIG_SPARSEMEM_STATIC=y
 # CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
+CONFIG_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
 # CONFIG_RESOURCES_64BIT is not set
 CONFIG_ZONE_DMA_FLAG=0
@@ -256,7 +271,6 @@ CONFIG_HZ=250
 CONFIG_PREEMPT_NONE=y
 # CONFIG_PREEMPT_VOLUNTARY is not set
 # CONFIG_PREEMPT is not set
-CONFIG_RCU_TRACE=y
 CONFIG_GUSA=y
 # CONFIG_GUSA_RB is not set
 
@@ -332,8 +346,6 @@ CONFIG_TCP_CONG_CUBIC=y
 CONFIG_DEFAULT_TCP_CONG="cubic"
 # 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 is not set
 # CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
@@ -367,6 +379,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 #
 # CONFIG_CFG80211 is not set
 CONFIG_WIRELESS_EXT=y
+CONFIG_WIRELESS_EXT_SYSFS=y
 # CONFIG_MAC80211 is not set
 # CONFIG_IEEE80211 is not set
 # CONFIG_RFKILL is not set
@@ -383,6 +396,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 CONFIG_FW_LOADER=m
+CONFIG_FIRMWARE_IN_KERNEL=y
+CONFIG_EXTRA_FIRMWARE=""
 # CONFIG_SYS_HYPERVISOR is not set
 # CONFIG_CONNECTOR is not set
 # CONFIG_MTD is not set
@@ -399,14 +414,18 @@ CONFIG_BLK_DEV=y
 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_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_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_HAVE_IDE=y
 # CONFIG_IDE is not set
 
 #
@@ -466,6 +485,7 @@ 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_IPR is not set
@@ -478,9 +498,13 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_SRP is not set
+# CONFIG_SCSI_DH is not set
 CONFIG_ATA=y
 # CONFIG_ATA_NONSTANDARD is not set
+CONFIG_SATA_PMP=y
 # CONFIG_SATA_AHCI is not set
+# CONFIG_SATA_SIL24 is not set
+CONFIG_ATA_SFF=y
 # CONFIG_SATA_SVW is not set
 # CONFIG_ATA_PIIX is not set
 # CONFIG_SATA_MV is not set
@@ -490,7 +514,6 @@ CONFIG_ATA=y
 # CONFIG_SATA_PROMISE is not set
 # CONFIG_SATA_SX4 is not set
 # CONFIG_SATA_SIL is not set
-# CONFIG_SATA_SIL24 is not set
 # CONFIG_SATA_SIS is not set
 # CONFIG_SATA_ULI is not set
 # CONFIG_SATA_VIA is not set
@@ -535,17 +558,21 @@ CONFIG_ATA=y
 # 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
 #
+
+#
+# Enable only one of the two stacks, unless you know what you are doing
+#
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
 # CONFIG_I2O is not set
 CONFIG_NETDEVICES=y
-# CONFIG_NETDEVICES_MULTIQUEUE is not set
 # CONFIG_DUMMY is not set
 # CONFIG_BONDING is not set
 # CONFIG_MACVLAN is not set
@@ -564,6 +591,7 @@ CONFIG_MII=y
 # CONFIG_NET_VENDOR_3COM is not set
 # CONFIG_SMC91X is not set
 # CONFIG_ENC28J60 is not set
+# CONFIG_SMC911X is not set
 # CONFIG_NET_TULIP is not set
 # CONFIG_HP100 is not set
 # CONFIG_IBM_NEW_EMAC_ZMII is not set
@@ -599,7 +627,6 @@ CONFIG_NETDEV_1000=y
 # CONFIG_DL2K is not set
 # CONFIG_E1000 is not set
 # CONFIG_E1000E is not set
-# CONFIG_E1000E_ENABLED is not set
 # CONFIG_IP1000 is not set
 # CONFIG_IGB is not set
 # CONFIG_NS83820 is not set
@@ -609,12 +636,12 @@ CONFIG_NETDEV_1000=y
 # CONFIG_SIS190 is not set
 # CONFIG_SKGE is not set
 # CONFIG_SKY2 is not set
-# CONFIG_SK98LIN is not set
 # CONFIG_VIA_VELOCITY is not set
 # CONFIG_TIGON3 is not set
 # CONFIG_BNX2 is not set
 # CONFIG_QLA3XXX is not set
 # CONFIG_ATL1 is not set
+# CONFIG_ATL1E is not set
 CONFIG_NETDEV_10000=y
 # CONFIG_CHELSIO_T1 is not set
 # CONFIG_CHELSIO_T3 is not set
@@ -627,6 +654,7 @@ CONFIG_NETDEV_10000=y
 # CONFIG_MLX4_CORE is not set
 # CONFIG_TEHUTI is not set
 # CONFIG_BNX2X is not set
+# CONFIG_SFC is not set
 # CONFIG_TR is not set
 
 #
@@ -634,6 +662,7 @@ CONFIG_NETDEV_10000=y
 #
 # CONFIG_WLAN_PRE80211 is not set
 # CONFIG_WLAN_80211 is not set
+# CONFIG_IWLWIFI_LEDS is not set
 
 #
 # USB Network Adapters
@@ -690,9 +719,11 @@ CONFIG_INPUT=y
 # 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_NOZOMI is not set
 
@@ -726,10 +757,6 @@ CONFIG_HW_RANDOM=y
 # CONFIG_TCG_TPM is not set
 CONFIG_DEVPORT=y
 # CONFIG_I2C is not set
-
-#
-# SPI support
-#
 CONFIG_SPI=y
 CONFIG_SPI_MASTER=y
 
@@ -765,6 +792,8 @@ CONFIG_HWMON=y
 # 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
 
 #
@@ -776,13 +805,24 @@ CONFIG_SSB_POSSIBLE=y
 #
 # Multifunction device drivers
 #
+# CONFIG_MFD_CORE is not set
 CONFIG_MFD_SM501=y
+# CONFIG_HTC_PASIC3 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_USB_DABUSB is not set
 
@@ -802,8 +842,8 @@ CONFIG_FB_CFB_IMAGEBLIT=y
 # 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_DEFERRED_IO=y
 # CONFIG_FB_SVGALIB is not set
 # CONFIG_FB_MACMODES is not set
 # CONFIG_FB_BACKLIGHT is not set
@@ -836,6 +876,8 @@ CONFIG_FB_DEFERRED_IO=y
 # 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_SH_MOBILE_LCDC=m
 CONFIG_FB_SM501=y
 # CONFIG_FB_VIRTUAL is not set
 # CONFIG_BACKLIGHT_LCD_SUPPORT is not set
@@ -862,15 +904,7 @@ CONFIG_LOGO=y
 # CONFIG_LOGO_SUPERH_MONO is not set
 # CONFIG_LOGO_SUPERH_VGA16 is not set
 CONFIG_LOGO_SUPERH_CLUT224=y
-
-#
-# Sound
-#
 CONFIG_SOUND=y
-
-#
-# Advanced Linux Sound Architecture
-#
 CONFIG_SND=m
 CONFIG_SND_TIMER=m
 CONFIG_SND_PCM=m
@@ -884,21 +918,17 @@ 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_VMASTER=y
 CONFIG_SND_MPU401_UART=m
 CONFIG_SND_OPL3_LIB=m
 CONFIG_SND_AC97_CODEC=m
+CONFIG_SND_DRIVERS=y
 # CONFIG_SND_DUMMY is not set
 # CONFIG_SND_MTPAV is not set
 # CONFIG_SND_SERIAL_U16550 is not set
 # CONFIG_SND_MPU401 is not set
-
-#
-# PCI devices
-#
+# CONFIG_SND_AC97_POWER_SAVE is not set
+CONFIG_SND_PCI=y
 # CONFIG_SND_AD1889 is not set
 # CONFIG_SND_ALS300 is not set
 # CONFIG_SND_ALI5451 is not set
@@ -907,6 +937,7 @@ CONFIG_SND_AC97_CODEC=m
 # CONFIG_SND_AU8810 is not set
 # CONFIG_SND_AU8820 is not set
 # CONFIG_SND_AU8830 is not set
+# CONFIG_SND_AW2 is not set
 # CONFIG_SND_AZT3328 is not set
 # CONFIG_SND_BT87X is not set
 # CONFIG_SND_CA0106 is not set
@@ -957,43 +988,13 @@ CONFIG_SND_AC97_CODEC=m
 # CONFIG_SND_VIRTUOSO is not set
 # CONFIG_SND_VX222 is not set
 CONFIG_SND_YMFPCI=m
-CONFIG_SND_YMFPCI_FIRMWARE_IN_KERNEL=y
-# CONFIG_SND_AC97_POWER_SAVE is not set
-
-#
-# SPI devices
-#
-
-#
-# SUPERH devices
-#
-
-#
-# USB devices
-#
+CONFIG_SND_SPI=y
+CONFIG_SND_SUPERH=y
+CONFIG_SND_USB=y
 # CONFIG_SND_USB_AUDIO is not set
 # CONFIG_SND_USB_CAIAQ is not set
-
-#
-# System on Chip audio support
-#
 # CONFIG_SND_SOC is not set
-
-#
-# SoC Audio support for SuperH
-#
-
-#
-# ALSA SoC audio for Freescale SOCs
-#
-
-#
-# Open Sound System
-#
 CONFIG_SOUND_PRIME=m
-# CONFIG_SOUND_TRIDENT is not set
-# CONFIG_SOUND_MSNDCLAS is not set
-# CONFIG_SOUND_MSNDPIN is not set
 CONFIG_AC97_BUS=m
 CONFIG_HID_SUPPORT=y
 CONFIG_HID=y
@@ -1022,12 +1023,16 @@ CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
 CONFIG_USB_DEVICE_CLASS=y
 # CONFIG_USB_DYNAMIC_MINORS is not set
 # CONFIG_USB_OTG is not set
+# CONFIG_USB_OTG_WHITELIST is not set
+# CONFIG_USB_OTG_BLACKLIST_HUB is not set
 
 #
 # USB Host Controller Drivers
 #
+# CONFIG_USB_C67X00_HCD is not set
 # CONFIG_USB_EHCI_HCD is not set
 # CONFIG_USB_ISP116X_HCD is not set
+# CONFIG_USB_ISP1760_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
@@ -1041,6 +1046,7 @@ CONFIG_USB_OHCI_LITTLE_ENDIAN=y
 #
 # CONFIG_USB_ACM is not set
 # CONFIG_USB_PRINTER is not set
+# CONFIG_USB_WDM is not set
 
 #
 # NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
@@ -1060,7 +1066,9 @@ 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 is not set
 # CONFIG_USB_STORAGE_KARMA is not set
+# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
 CONFIG_USB_LIBUSUAL=y
 
 #
@@ -1096,9 +1104,12 @@ CONFIG_USB_LIBUSUAL=y
 # CONFIG_USB_LD is not set
 # CONFIG_USB_TRANCEVIBRATOR is not set
 # CONFIG_USB_IOWARRIOR is not set
+# CONFIG_USB_ISIGHTFW is not set
 # CONFIG_USB_GADGET 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
@@ -1118,6 +1129,8 @@ CONFIG_RTC_INTF_DEV=y
 #
 # SPI RTC drivers
 #
+# CONFIG_RTC_DRV_M41T94 is not set
+# CONFIG_RTC_DRV_DS1305 is not set
 # CONFIG_RTC_DRV_MAX6902 is not set
 CONFIG_RTC_DRV_R9701=y
 # CONFIG_RTC_DRV_RS5C348 is not set
@@ -1137,10 +1150,7 @@ CONFIG_RTC_DRV_R9701=y
 # on-CPU RTC drivers
 #
 # CONFIG_RTC_DRV_SH is not set
-
-#
-# Userspace I/O
-#
+# CONFIG_DMADEVICES is not set
 # CONFIG_UIO is not set
 
 #
@@ -1155,14 +1165,11 @@ CONFIG_EXT2_FS=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=y
-# CONFIG_ROMFS_FS is not set
+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
@@ -1208,8 +1215,11 @@ CONFIG_TMPFS=y
 # CONFIG_EFS_FS is not set
 # CONFIG_CRAMFS is not set
 # CONFIG_VXFS_FS is not set
+CONFIG_MINIX_FS=y
+# 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
@@ -1275,12 +1285,14 @@ 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_UNUSED_SYMBOLS is not set
 CONFIG_DEBUG_FS=y
 # CONFIG_HEADERS_CHECK is not set
 # CONFIG_DEBUG_KERNEL is not set
 # CONFIG_DEBUG_BUGVERBOSE is not set
+# CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_SAMPLES is not set
 # CONFIG_SH_STANDARD_BIOS is not set
 CONFIG_EARLY_SCIF_CONSOLE=y
@@ -1295,48 +1307,81 @@ CONFIG_EARLY_PRINTK=y
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITY_FILE_CAPABILITIES is not set
 CONFIG_CRYPTO=y
-# CONFIG_CRYPTO_SEQIV is not set
+
+#
+# Crypto core or helper
+#
 # CONFIG_CRYPTO_MANAGER 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_NULL is not set
+
+#
+# Digest
+#
+# CONFIG_CRYPTO_CRC32C 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_WP512 is not set
 # CONFIG_CRYPTO_TGR192 is not set
-# CONFIG_CRYPTO_GF128MUL is not set
-# CONFIG_CRYPTO_ECB is not set
-# CONFIG_CRYPTO_CBC is not set
-# CONFIG_CRYPTO_PCBC is not set
-# CONFIG_CRYPTO_LRW is not set
-# CONFIG_CRYPTO_XTS is not set
-# CONFIG_CRYPTO_CTR is not set
-# CONFIG_CRYPTO_GCM is not set
-# CONFIG_CRYPTO_CCM is not set
-# CONFIG_CRYPTO_CRYPTD is not set
-# CONFIG_CRYPTO_DES is not set
-# CONFIG_CRYPTO_FCRYPT is not set
-# CONFIG_CRYPTO_BLOWFISH is not set
-# CONFIG_CRYPTO_TWOFISH is not set
-# CONFIG_CRYPTO_SERPENT 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_TEA is not set
-# CONFIG_CRYPTO_ARC4 is not set
+# CONFIG_CRYPTO_DES is not set
+# CONFIG_CRYPTO_FCRYPT is not set
 # CONFIG_CRYPTO_KHAZAD is not set
-# CONFIG_CRYPTO_ANUBIS is not set
-# CONFIG_CRYPTO_SEED 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_MICHAEL_MIC is not set
-# CONFIG_CRYPTO_CRC32C is not set
-# CONFIG_CRYPTO_CAMELLIA is not set
-# CONFIG_CRYPTO_TEST is not set
-# CONFIG_CRYPTO_AUTHENC is not set
 # CONFIG_CRYPTO_LZO is not set
 CONFIG_CRYPTO_HW=y
 # CONFIG_CRYPTO_DEV_HIFN_795X is not set
@@ -1345,8 +1390,10 @@ CONFIG_CRYPTO_HW=y
 # Library routines
 #
 CONFIG_BITREVERSE=y
+# CONFIG_GENERIC_FIND_FIRST_BIT is not set
 # CONFIG_CRC_CCITT is not set
 # CONFIG_CRC16 is not set
+CONFIG_CRC_T10DIF=y
 # CONFIG_CRC_ITU_T is not set
 CONFIG_CRC32=y
 # CONFIG_CRC7 is not set
index 0a6d3b9..7d9fa6e 100644 (file)
@@ -1,10 +1,11 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.24
-# Thu Feb  7 16:17:47 2008
+# Linux kernel version: 2.6.26
+# Wed Jul 30 01:59:18 2008
 #
 CONFIG_SUPERH=y
 CONFIG_SUPERH32=y
+CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
 CONFIG_GENERIC_BUG=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -20,6 +21,8 @@ CONFIG_LOCKDEP_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_SUPPORTS_AOUT=y
+CONFIG_IO_TRAPPED=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
 
 #
@@ -36,17 +39,15 @@ CONFIG_SYSVIPC_SYSCTL=y
 # CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
-# CONFIG_USER_NS is not set
-# CONFIG_PID_NS is not set
 # CONFIG_AUDIT is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
 # CONFIG_CGROUPS is not set
-CONFIG_FAIR_GROUP_SCHED=y
-CONFIG_FAIR_USER_SCHED=y
-# CONFIG_FAIR_CGROUP_SCHED is not set
+# CONFIG_GROUP_SCHED is not set
 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_CC_OPTIMIZE_FOR_SIZE is not set
 CONFIG_SYSCTL=y
@@ -76,22 +77,31 @@ CONFIG_PROFILING=y
 # CONFIG_MARKERS is not set
 CONFIG_OPROFILE=y
 CONFIG_HAVE_OPROFILE=y
+# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
+# CONFIG_HAVE_IOREMAP_PROT is not set
 # CONFIG_HAVE_KPROBES is not set
+# CONFIG_HAVE_KRETPROBES is not set
+# CONFIG_HAVE_ARCH_TRACEHOOK is not set
+# CONFIG_HAVE_DMA_ATTRS is not set
+# CONFIG_USE_GENERIC_SMP_HELPERS is not set
+CONFIG_HAVE_CLK=y
 CONFIG_PROC_PAGE_MONITOR=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 is not set
 # CONFIG_MODVERSIONS is not set
 # CONFIG_MODULE_SRCVERSION_ALL is not set
-# CONFIG_KMOD is not set
+CONFIG_KMOD=y
 CONFIG_BLOCK=y
 # CONFIG_LBD is not set
 # CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_LSF is not set
 # CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
 
 #
 # IO Schedulers
@@ -106,7 +116,6 @@ CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="anticipatory"
 CONFIG_CLASSIC_RCU=y
-# CONFIG_PREEMPT_RCU is not set
 
 #
 # System type
@@ -116,6 +125,7 @@ CONFIG_CPU_SH4=y
 # 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
@@ -133,6 +143,7 @@ CONFIG_CPU_SH4=y
 CONFIG_CPU_SUBTYPE_SH7751R=y
 # 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_SH7763 is not set
 # CONFIG_CPU_SUBTYPE_SH7770 is not set
 # CONFIG_CPU_SUBTYPE_SH7780 is not set
@@ -140,6 +151,7 @@ CONFIG_CPU_SUBTYPE_SH7751R=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
 # CONFIG_CPU_SUBTYPE_SH5_101 is not set
 # CONFIG_CPU_SUBTYPE_SH5_103 is not set
 
@@ -161,7 +173,9 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_ARCH_SELECT_MEMORY_MODEL=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_ENTRY_OFFSET=0x00001000
 CONFIG_SELECT_MEMORY_MODEL=y
 CONFIG_FLATMEM_MANUAL=y
 # CONFIG_DISCONTIGMEM_MANUAL is not set
@@ -170,6 +184,7 @@ CONFIG_FLATMEM=y
 CONFIG_FLAT_NODE_MEM_MAP=y
 CONFIG_SPARSEMEM_STATIC=y
 # CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
+CONFIG_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
 # CONFIG_RESOURCES_64BIT is not set
 CONFIG_ZONE_DMA_FLAG=0
@@ -256,7 +271,6 @@ CONFIG_HZ=250
 CONFIG_PREEMPT_NONE=y
 # CONFIG_PREEMPT_VOLUNTARY is not set
 # CONFIG_PREEMPT is not set
-CONFIG_RCU_TRACE=y
 CONFIG_GUSA=y
 # CONFIG_GUSA_RB is not set
 
@@ -332,8 +346,6 @@ CONFIG_TCP_CONG_CUBIC=y
 CONFIG_DEFAULT_TCP_CONG="cubic"
 # 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 is not set
 # CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
@@ -367,6 +379,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 #
 # CONFIG_CFG80211 is not set
 CONFIG_WIRELESS_EXT=y
+CONFIG_WIRELESS_EXT_SYSFS=y
 # CONFIG_MAC80211 is not set
 # CONFIG_IEEE80211 is not set
 # CONFIG_RFKILL is not set
@@ -383,6 +396,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 CONFIG_FW_LOADER=m
+CONFIG_FIRMWARE_IN_KERNEL=y
+CONFIG_EXTRA_FIRMWARE=""
 # CONFIG_SYS_HYPERVISOR is not set
 # CONFIG_CONNECTOR is not set
 # CONFIG_MTD is not set
@@ -399,14 +414,18 @@ CONFIG_BLK_DEV=y
 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_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_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_HAVE_IDE=y
 # CONFIG_IDE is not set
 
 #
@@ -466,6 +485,7 @@ 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_IPR is not set
@@ -478,9 +498,13 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_SRP is not set
+# CONFIG_SCSI_DH is not set
 CONFIG_ATA=y
 # CONFIG_ATA_NONSTANDARD is not set
+CONFIG_SATA_PMP=y
 # CONFIG_SATA_AHCI is not set
+# CONFIG_SATA_SIL24 is not set
+CONFIG_ATA_SFF=y
 # CONFIG_SATA_SVW is not set
 # CONFIG_ATA_PIIX is not set
 # CONFIG_SATA_MV is not set
@@ -490,7 +514,6 @@ CONFIG_ATA=y
 # CONFIG_SATA_PROMISE is not set
 # CONFIG_SATA_SX4 is not set
 # CONFIG_SATA_SIL is not set
-# CONFIG_SATA_SIL24 is not set
 # CONFIG_SATA_SIS is not set
 # CONFIG_SATA_ULI is not set
 # CONFIG_SATA_VIA is not set
@@ -535,17 +558,21 @@ CONFIG_ATA=y
 # 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
 #
+
+#
+# Enable only one of the two stacks, unless you know what you are doing
+#
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
 # CONFIG_I2O is not set
 CONFIG_NETDEVICES=y
-# CONFIG_NETDEVICES_MULTIQUEUE is not set
 # CONFIG_DUMMY is not set
 # CONFIG_BONDING is not set
 # CONFIG_MACVLAN is not set
@@ -564,6 +591,7 @@ CONFIG_MII=y
 # CONFIG_NET_VENDOR_3COM is not set
 # CONFIG_SMC91X is not set
 # CONFIG_ENC28J60 is not set
+# CONFIG_SMC911X is not set
 # CONFIG_NET_TULIP is not set
 # CONFIG_HP100 is not set
 # CONFIG_IBM_NEW_EMAC_ZMII is not set
@@ -599,7 +627,6 @@ CONFIG_NETDEV_1000=y
 # CONFIG_DL2K is not set
 # CONFIG_E1000 is not set
 # CONFIG_E1000E is not set
-# CONFIG_E1000E_ENABLED is not set
 # CONFIG_IP1000 is not set
 # CONFIG_IGB is not set
 # CONFIG_NS83820 is not set
@@ -609,12 +636,12 @@ CONFIG_NETDEV_1000=y
 # CONFIG_SIS190 is not set
 # CONFIG_SKGE is not set
 # CONFIG_SKY2 is not set
-# CONFIG_SK98LIN is not set
 # CONFIG_VIA_VELOCITY is not set
 # CONFIG_TIGON3 is not set
 # CONFIG_BNX2 is not set
 # CONFIG_QLA3XXX is not set
 # CONFIG_ATL1 is not set
+# CONFIG_ATL1E is not set
 CONFIG_NETDEV_10000=y
 # CONFIG_CHELSIO_T1 is not set
 # CONFIG_CHELSIO_T3 is not set
@@ -627,6 +654,7 @@ CONFIG_NETDEV_10000=y
 # CONFIG_MLX4_CORE is not set
 # CONFIG_TEHUTI is not set
 # CONFIG_BNX2X is not set
+# CONFIG_SFC is not set
 # CONFIG_TR is not set
 
 #
@@ -634,6 +662,7 @@ CONFIG_NETDEV_10000=y
 #
 # CONFIG_WLAN_PRE80211 is not set
 # CONFIG_WLAN_80211 is not set
+# CONFIG_IWLWIFI_LEDS is not set
 
 #
 # USB Network Adapters
@@ -690,9 +719,11 @@ CONFIG_INPUT=y
 # 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_NOZOMI is not set
 
@@ -726,10 +757,6 @@ CONFIG_HW_RANDOM=y
 # CONFIG_TCG_TPM is not set
 CONFIG_DEVPORT=y
 # CONFIG_I2C is not set
-
-#
-# SPI support
-#
 CONFIG_SPI=y
 CONFIG_SPI_MASTER=y
 
@@ -765,6 +792,8 @@ CONFIG_HWMON=y
 # 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
 
 #
@@ -776,13 +805,24 @@ CONFIG_SSB_POSSIBLE=y
 #
 # Multifunction device drivers
 #
+# CONFIG_MFD_CORE is not set
 CONFIG_MFD_SM501=y
+# CONFIG_HTC_PASIC3 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_USB_DABUSB is not set
 
@@ -802,8 +842,8 @@ CONFIG_FB_CFB_IMAGEBLIT=y
 # 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_DEFERRED_IO=y
 # CONFIG_FB_SVGALIB is not set
 # CONFIG_FB_MACMODES is not set
 # CONFIG_FB_BACKLIGHT is not set
@@ -836,6 +876,8 @@ CONFIG_FB_DEFERRED_IO=y
 # 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_SH_MOBILE_LCDC=m
 CONFIG_FB_SM501=y
 # CONFIG_FB_VIRTUAL is not set
 # CONFIG_BACKLIGHT_LCD_SUPPORT is not set
@@ -862,15 +904,7 @@ CONFIG_LOGO=y
 # CONFIG_LOGO_SUPERH_MONO is not set
 # CONFIG_LOGO_SUPERH_VGA16 is not set
 CONFIG_LOGO_SUPERH_CLUT224=y
-
-#
-# Sound
-#
 CONFIG_SOUND=y
-
-#
-# Advanced Linux Sound Architecture
-#
 CONFIG_SND=m
 CONFIG_SND_TIMER=m
 CONFIG_SND_PCM=m
@@ -884,21 +918,17 @@ 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_VMASTER=y
 CONFIG_SND_MPU401_UART=m
 CONFIG_SND_OPL3_LIB=m
 CONFIG_SND_AC97_CODEC=m
+CONFIG_SND_DRIVERS=y
 # CONFIG_SND_DUMMY is not set
 # CONFIG_SND_MTPAV is not set
 # CONFIG_SND_SERIAL_U16550 is not set
 # CONFIG_SND_MPU401 is not set
-
-#
-# PCI devices
-#
+# CONFIG_SND_AC97_POWER_SAVE is not set
+CONFIG_SND_PCI=y
 # CONFIG_SND_AD1889 is not set
 # CONFIG_SND_ALS300 is not set
 # CONFIG_SND_ALI5451 is not set
@@ -907,6 +937,7 @@ CONFIG_SND_AC97_CODEC=m
 # CONFIG_SND_AU8810 is not set
 # CONFIG_SND_AU8820 is not set
 # CONFIG_SND_AU8830 is not set
+# CONFIG_SND_AW2 is not set
 # CONFIG_SND_AZT3328 is not set
 # CONFIG_SND_BT87X is not set
 # CONFIG_SND_CA0106 is not set
@@ -957,43 +988,13 @@ CONFIG_SND_AC97_CODEC=m
 # CONFIG_SND_VIRTUOSO is not set
 # CONFIG_SND_VX222 is not set
 CONFIG_SND_YMFPCI=m
-CONFIG_SND_YMFPCI_FIRMWARE_IN_KERNEL=y
-# CONFIG_SND_AC97_POWER_SAVE is not set
-
-#
-# SPI devices
-#
-
-#
-# SUPERH devices
-#
-
-#
-# USB devices
-#
+CONFIG_SND_SPI=y
+CONFIG_SND_SUPERH=y
+CONFIG_SND_USB=y
 # CONFIG_SND_USB_AUDIO is not set
 # CONFIG_SND_USB_CAIAQ is not set
-
-#
-# System on Chip audio support
-#
 # CONFIG_SND_SOC is not set
-
-#
-# SoC Audio support for SuperH
-#
-
-#
-# ALSA SoC audio for Freescale SOCs
-#
-
-#
-# Open Sound System
-#
 CONFIG_SOUND_PRIME=m
-# CONFIG_SOUND_TRIDENT is not set
-# CONFIG_SOUND_MSNDCLAS is not set
-# CONFIG_SOUND_MSNDPIN is not set
 CONFIG_AC97_BUS=m
 CONFIG_HID_SUPPORT=y
 CONFIG_HID=y
@@ -1022,12 +1023,16 @@ CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
 CONFIG_USB_DEVICE_CLASS=y
 # CONFIG_USB_DYNAMIC_MINORS is not set
 # CONFIG_USB_OTG is not set
+# CONFIG_USB_OTG_WHITELIST is not set
+# CONFIG_USB_OTG_BLACKLIST_HUB is not set
 
 #
 # USB Host Controller Drivers
 #
+# CONFIG_USB_C67X00_HCD is not set
 # CONFIG_USB_EHCI_HCD is not set
 # CONFIG_USB_ISP116X_HCD is not set
+# CONFIG_USB_ISP1760_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
@@ -1041,6 +1046,7 @@ CONFIG_USB_OHCI_LITTLE_ENDIAN=y
 #
 # CONFIG_USB_ACM is not set
 # CONFIG_USB_PRINTER is not set
+# CONFIG_USB_WDM is not set
 
 #
 # NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
@@ -1060,7 +1066,9 @@ 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 is not set
 # CONFIG_USB_STORAGE_KARMA is not set
+# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
 CONFIG_USB_LIBUSUAL=y
 
 #
@@ -1096,9 +1104,12 @@ CONFIG_USB_LIBUSUAL=y
 # CONFIG_USB_LD is not set
 # CONFIG_USB_TRANCEVIBRATOR is not set
 # CONFIG_USB_IOWARRIOR is not set
+# CONFIG_USB_ISIGHTFW is not set
 # CONFIG_USB_GADGET 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
@@ -1118,6 +1129,8 @@ CONFIG_RTC_INTF_DEV=y
 #
 # SPI RTC drivers
 #
+# CONFIG_RTC_DRV_M41T94 is not set
+# CONFIG_RTC_DRV_DS1305 is not set
 # CONFIG_RTC_DRV_MAX6902 is not set
 CONFIG_RTC_DRV_R9701=y
 # CONFIG_RTC_DRV_RS5C348 is not set
@@ -1137,10 +1150,7 @@ CONFIG_RTC_DRV_R9701=y
 # on-CPU RTC drivers
 #
 # CONFIG_RTC_DRV_SH is not set
-
-#
-# Userspace I/O
-#
+# CONFIG_DMADEVICES is not set
 # CONFIG_UIO is not set
 
 #
@@ -1155,14 +1165,11 @@ CONFIG_EXT2_FS=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=y
-# CONFIG_ROMFS_FS is not set
+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
@@ -1208,8 +1215,11 @@ CONFIG_TMPFS=y
 # CONFIG_EFS_FS is not set
 # CONFIG_CRAMFS is not set
 # CONFIG_VXFS_FS is not set
+CONFIG_MINIX_FS=y
+# 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
@@ -1275,12 +1285,14 @@ 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_UNUSED_SYMBOLS is not set
 CONFIG_DEBUG_FS=y
 # CONFIG_HEADERS_CHECK is not set
 # CONFIG_DEBUG_KERNEL is not set
 # CONFIG_DEBUG_BUGVERBOSE is not set
+# CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_SAMPLES is not set
 # CONFIG_SH_STANDARD_BIOS is not set
 CONFIG_EARLY_SCIF_CONSOLE=y
@@ -1295,48 +1307,81 @@ CONFIG_EARLY_PRINTK=y
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITY_FILE_CAPABILITIES is not set
 CONFIG_CRYPTO=y
-# CONFIG_CRYPTO_SEQIV is not set
+
+#
+# Crypto core or helper
+#
 # CONFIG_CRYPTO_MANAGER 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_NULL is not set
+
+#
+# Digest
+#
+# CONFIG_CRYPTO_CRC32C 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_WP512 is not set
 # CONFIG_CRYPTO_TGR192 is not set
-# CONFIG_CRYPTO_GF128MUL is not set
-# CONFIG_CRYPTO_ECB is not set
-# CONFIG_CRYPTO_CBC is not set
-# CONFIG_CRYPTO_PCBC is not set
-# CONFIG_CRYPTO_LRW is not set
-# CONFIG_CRYPTO_XTS is not set
-# CONFIG_CRYPTO_CTR is not set
-# CONFIG_CRYPTO_GCM is not set
-# CONFIG_CRYPTO_CCM is not set
-# CONFIG_CRYPTO_CRYPTD is not set
-# CONFIG_CRYPTO_DES is not set
-# CONFIG_CRYPTO_FCRYPT is not set
-# CONFIG_CRYPTO_BLOWFISH is not set
-# CONFIG_CRYPTO_TWOFISH is not set
-# CONFIG_CRYPTO_SERPENT 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_TEA is not set
-# CONFIG_CRYPTO_ARC4 is not set
+# CONFIG_CRYPTO_DES is not set
+# CONFIG_CRYPTO_FCRYPT is not set
 # CONFIG_CRYPTO_KHAZAD is not set
-# CONFIG_CRYPTO_ANUBIS is not set
-# CONFIG_CRYPTO_SEED 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_MICHAEL_MIC is not set
-# CONFIG_CRYPTO_CRC32C is not set
-# CONFIG_CRYPTO_CAMELLIA is not set
-# CONFIG_CRYPTO_TEST is not set
-# CONFIG_CRYPTO_AUTHENC is not set
 # CONFIG_CRYPTO_LZO is not set
 CONFIG_CRYPTO_HW=y
 # CONFIG_CRYPTO_DEV_HIFN_795X is not set
@@ -1345,8 +1390,10 @@ CONFIG_CRYPTO_HW=y
 # Library routines
 #
 CONFIG_BITREVERSE=y
+# CONFIG_GENERIC_FIND_FIRST_BIT is not set
 # CONFIG_CRC_CCITT is not set
 # CONFIG_CRC16 is not set
+CONFIG_CRC_T10DIF=y
 # CONFIG_CRC_ITU_T is not set
 CONFIG_CRC32=y
 # CONFIG_CRC7 is not set
index bb9bcd6..6d834f2 100644 (file)
@@ -1,10 +1,11 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.24-rc7
-# Tue Jan 22 11:34:03 2008
+# Linux kernel version: 2.6.26
+# Wed Jul 30 02:00:12 2008
 #
 CONFIG_SUPERH=y
 CONFIG_SUPERH32=y
+CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
 CONFIG_GENERIC_BUG=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -20,6 +21,7 @@ CONFIG_LOCKDEP_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_SUPPORTS_AOUT=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
 
 #
@@ -38,24 +40,23 @@ CONFIG_POSIX_MQUEUE=y
 CONFIG_BSD_PROCESS_ACCT=y
 # CONFIG_BSD_PROCESS_ACCT_V3 is not set
 # CONFIG_TASKSTATS is not set
-# CONFIG_USER_NS is not set
-# CONFIG_PID_NS is not set
 # CONFIG_AUDIT is not set
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_LOG_BUF_SHIFT=18
 # CONFIG_CGROUPS is not set
-CONFIG_FAIR_GROUP_SCHED=y
-CONFIG_FAIR_USER_SCHED=y
-# CONFIG_FAIR_CGROUP_SCHED is not set
+# CONFIG_GROUP_SCHED is not set
 CONFIG_SYSFS_DEPRECATED=y
+CONFIG_SYSFS_DEPRECATED_V2=y
 CONFIG_RELAY=y
+# CONFIG_NAMESPACES is not set
 # CONFIG_BLK_DEV_INITRD is not set
 CONFIG_CC_OPTIMIZE_FOR_SIZE=y
 CONFIG_SYSCTL=y
 CONFIG_EMBEDDED=y
 CONFIG_UID16=y
 CONFIG_SYSCTL_SYSCALL=y
+CONFIG_SYSCTL_SYSCALL_CHECK=y
 CONFIG_KALLSYMS=y
 CONFIG_KALLSYMS_ALL=y
 # CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -63,11 +64,13 @@ 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_VM_EVENT_COUNTERS=y
@@ -75,11 +78,24 @@ CONFIG_SLUB_DEBUG=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_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
+# CONFIG_HAVE_IOREMAP_PROT is not set
+# CONFIG_HAVE_KPROBES is not set
+# CONFIG_HAVE_KRETPROBES is not set
+# CONFIG_HAVE_ARCH_TRACEHOOK is not set
+# CONFIG_HAVE_DMA_ATTRS is not set
+# CONFIG_USE_GENERIC_SMP_HELPERS is not set
+CONFIG_HAVE_CLK=y
+CONFIG_PROC_PAGE_MONITOR=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=y
 # CONFIG_MODVERSIONS is not set
@@ -90,6 +106,7 @@ CONFIG_LBD=y
 # CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_LSF is not set
 # CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
 
 #
 # IO Schedulers
@@ -103,6 +120,7 @@ CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_CFQ is not set
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_CLASSIC_RCU=y
 
 #
 # System type
@@ -113,6 +131,7 @@ CONFIG_CPU_SH4A=y
 # 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
@@ -130,6 +149,7 @@ CONFIG_CPU_SH4A=y
 # 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_SH7763 is not set
 # CONFIG_CPU_SUBTYPE_SH7770 is not set
 CONFIG_CPU_SUBTYPE_SH7780=y
@@ -137,6 +157,7 @@ CONFIG_CPU_SUBTYPE_SH7780=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
 # CONFIG_CPU_SUBTYPE_SH5_101 is not set
 # CONFIG_CPU_SUBTYPE_SH5_103 is not set
 
@@ -159,7 +180,9 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_ARCH_SELECT_MEMORY_MODEL=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_ENTRY_OFFSET=0x00001000
 CONFIG_HUGETLB_PAGE_SIZE_64K=y
 # CONFIG_HUGETLB_PAGE_SIZE_256K is not set
 # CONFIG_HUGETLB_PAGE_SIZE_1MB is not set
@@ -174,6 +197,7 @@ CONFIG_FLATMEM=y
 CONFIG_FLAT_NODE_MEM_MAP=y
 CONFIG_SPARSEMEM_STATIC=y
 # CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
+CONFIG_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
 CONFIG_RESOURCES_64BIT=y
 CONFIG_ZONE_DMA_FLAG=0
@@ -205,7 +229,6 @@ CONFIG_CPU_HAS_FPU=y
 # CONFIG_SH_7780_SOLUTION_ENGINE is not set
 CONFIG_SH_SDK7780=y
 # CONFIG_SH_HIGHLANDER is not set
-# CONFIG_SH_SDK7780_STANDALONE is not set
 CONFIG_SH_SDK7780_BASE=y
 
 #
@@ -250,12 +273,13 @@ CONFIG_HZ_250=y
 # CONFIG_HZ_300 is not set
 # CONFIG_HZ_1000 is not set
 CONFIG_HZ=250
+# CONFIG_SCHED_HRTICK is not set
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
 # CONFIG_PREEMPT_NONE is not set
 # CONFIG_PREEMPT_VOLUNTARY is not set
 CONFIG_PREEMPT=y
-CONFIG_PREEMPT_BKL=y
+# CONFIG_PREEMPT_RCU is not set
 CONFIG_GUSA=y
 
 #
@@ -321,6 +345,7 @@ 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 is not set
 CONFIG_INET=y
 CONFIG_IP_MULTICAST=y
@@ -370,8 +395,10 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=y
 # CONFIG_INET6_XFRM_MODE_BEET is not set
 # CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
 CONFIG_IPV6_SIT=y
+CONFIG_IPV6_NDISC_NODETYPE=y
 # CONFIG_IPV6_TUNNEL is not set
 # CONFIG_IPV6_MULTIPLE_TABLES is not set
+# CONFIG_IPV6_MROUTE is not set
 # CONFIG_NETWORK_SECMARK is not set
 # CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
@@ -397,7 +424,6 @@ CONFIG_NET_SCHED=y
 # CONFIG_NET_SCH_HTB is not set
 # CONFIG_NET_SCH_HFSC is not set
 # CONFIG_NET_SCH_PRIO is not set
-# CONFIG_NET_SCH_RR is not set
 # CONFIG_NET_SCH_RED is not set
 # CONFIG_NET_SCH_SFQ is not set
 # CONFIG_NET_SCH_TEQL is not set
@@ -405,7 +431,6 @@ CONFIG_NET_SCHED=y
 # CONFIG_NET_SCH_GRED is not set
 # CONFIG_NET_SCH_DSMARK is not set
 # CONFIG_NET_SCH_NETEM is not set
-# CONFIG_NET_SCH_INGRESS is not set
 
 #
 # Classification
@@ -417,9 +442,9 @@ CONFIG_NET_SCHED=y
 # CONFIG_NET_CLS_U32 is not set
 # CONFIG_NET_CLS_RSVP is not set
 # CONFIG_NET_CLS_RSVP6 is not set
+# CONFIG_NET_CLS_FLOW is not set
 # CONFIG_NET_EMATCH is not set
 # CONFIG_NET_CLS_ACT is not set
-# CONFIG_NET_CLS_POLICE is not set
 CONFIG_NET_SCH_FIFO=y
 
 #
@@ -427,6 +452,7 @@ CONFIG_NET_SCH_FIFO=y
 #
 # 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
@@ -452,6 +478,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 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
@@ -475,16 +503,18 @@ CONFIG_BLK_DEV_LOOP=y
 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_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 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_BLK_DEV_IDE_SATA is not set
 CONFIG_BLK_DEV_IDEDISK=y
@@ -492,6 +522,7 @@ CONFIG_IDEDISK_MULTI_MODE=y
 # CONFIG_BLK_DEV_IDECS is not set
 # CONFIG_BLK_DEV_DELKIN is not set
 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
@@ -501,14 +532,12 @@ CONFIG_IDE_PROC_FS=y
 #
 # IDE chipset support/bugfixes
 #
-CONFIG_IDE_GENERIC=y
 CONFIG_BLK_DEV_PLATFORM=y
 
 #
 # PCI IDE chipsets support
 #
 CONFIG_BLK_DEV_IDEPCI=y
-# CONFIG_IDEPCI_SHARE_IRQ is not set
 CONFIG_IDEPCI_PCIBUS_ORDER=y
 # CONFIG_BLK_DEV_OFFBOARD is not set
 CONFIG_BLK_DEV_GENERIC=y
@@ -518,10 +547,8 @@ CONFIG_BLK_DEV_GENERIC=y
 # 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_JMICRON is not set
 # CONFIG_BLK_DEV_SC1200 is not set
@@ -537,10 +564,7 @@ CONFIG_BLK_DEV_GENERIC=y
 # CONFIG_BLK_DEV_TRM290 is not set
 # CONFIG_BLK_DEV_VIA82CXXX is not set
 # CONFIG_BLK_DEV_TC86C001 is not set
-# CONFIG_IDE_ARM is not set
 # CONFIG_BLK_DEV_IDEDMA is not set
-# CONFIG_IDE_ARCH_OBSOLETE_INIT is not set
-# CONFIG_BLK_DEV_HD is not set
 
 #
 # SCSI device support
@@ -600,6 +624,7 @@ 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_IPR is not set
@@ -613,9 +638,13 @@ CONFIG_SCSI_LOWLEVEL=y
 # 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
 CONFIG_ATA=y
 # CONFIG_ATA_NONSTANDARD is not set
+CONFIG_SATA_PMP=y
 # CONFIG_SATA_AHCI is not set
+# CONFIG_SATA_SIL24 is not set
+CONFIG_ATA_SFF=y
 # CONFIG_SATA_SVW is not set
 # CONFIG_ATA_PIIX is not set
 # CONFIG_SATA_MV is not set
@@ -625,7 +654,6 @@ CONFIG_ATA=y
 # CONFIG_SATA_PROMISE is not set
 # CONFIG_SATA_SX4 is not set
 # CONFIG_SATA_SIL is not set
-# CONFIG_SATA_SIL24 is not set
 # CONFIG_SATA_SIS is not set
 # CONFIG_SATA_ULI is not set
 # CONFIG_SATA_VIA is not set
@@ -654,6 +682,7 @@ CONFIG_ATA=y
 # 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
@@ -670,6 +699,7 @@ CONFIG_ATA=y
 # CONFIG_PATA_VIA is not set
 # CONFIG_PATA_WINBOND is not set
 # CONFIG_PATA_PLATFORM is not set
+# CONFIG_PATA_SCH is not set
 CONFIG_MD=y
 # CONFIG_BLK_DEV_MD is not set
 CONFIG_BLK_DEV_DM=y
@@ -686,11 +716,14 @@ CONFIG_BLK_DEV_DM=y
 #
 # IEEE 1394 (FireWire) support
 #
+
+#
+# Enable only one of the two stacks, unless you know what you are doing
+#
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
 # CONFIG_I2O is not set
 CONFIG_NETDEVICES=y
-# CONFIG_NETDEVICES_MULTIQUEUE is not set
 # CONFIG_DUMMY is not set
 # CONFIG_BONDING is not set
 # CONFIG_MACVLAN is not set
@@ -708,6 +741,7 @@ CONFIG_MII=y
 # CONFIG_CASSINI is not set
 # CONFIG_NET_VENDOR_3COM is not set
 CONFIG_SMC91X=y
+# CONFIG_SMC911X is not set
 # CONFIG_NET_TULIP is not set
 # CONFIG_HP100 is not set
 # CONFIG_IBM_NEW_EMAC_ZMII is not set
@@ -726,6 +760,7 @@ CONFIG_SMC91X=y
 #
 # CONFIG_WLAN_PRE80211 is not set
 # CONFIG_WLAN_80211 is not set
+# CONFIG_IWLWIFI_LEDS is not set
 
 #
 # USB Network Adapters
@@ -743,7 +778,6 @@ CONFIG_SMC91X=y
 # CONFIG_PPP is not set
 # CONFIG_SLIP is not set
 # CONFIG_NET_FC is not set
-# CONFIG_SHAPER is not set
 CONFIG_NETCONSOLE=y
 # CONFIG_NETCONSOLE_DYNAMIC is not set
 CONFIG_NETPOLL=y
@@ -780,6 +814,7 @@ CONFIG_KEYBOARD_ATKBD=y
 # CONFIG_KEYBOARD_XTKBD is not set
 # CONFIG_KEYBOARD_NEWTON is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
+# CONFIG_KEYBOARD_SH_KEYSC is not set
 CONFIG_INPUT_MOUSE=y
 CONFIG_MOUSE_PS2=y
 CONFIG_MOUSE_PS2_ALPS=y
@@ -812,10 +847,13 @@ CONFIG_SERIO_LIBPS2=y
 # 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
@@ -847,22 +885,20 @@ CONFIG_HW_RANDOM=y
 # 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 is not set
-
-#
-# SPI support
-#
 # CONFIG_SPI is not set
-# CONFIG_SPI_MASTER is not set
 # CONFIG_W1 is not set
 CONFIG_POWER_SUPPLY=y
 # CONFIG_POWER_SUPPLY_DEBUG is not set
 # CONFIG_PDA_POWER is not set
 # CONFIG_BATTERY_DS2760 is not set
 # CONFIG_HWMON is not set
+# CONFIG_THERMAL is not set
+# CONFIG_THERMAL_HWMON is not set
 # CONFIG_WATCHDOG is not set
 
 #
@@ -870,8 +906,10 @@ CONFIG_POWER_SUPPLY=y
 #
 CONFIG_SSB_POSSIBLE=y
 CONFIG_SSB=y
+CONFIG_SSB_SPROM=y
 CONFIG_SSB_PCIHOST_POSSIBLE=y
 CONFIG_SSB_PCIHOST=y
+# CONFIG_SSB_B43_PCI_BRIDGE is not set
 CONFIG_SSB_PCMCIAHOST_POSSIBLE=y
 # CONFIG_SSB_PCMCIAHOST is not set
 # CONFIG_SSB_SILENT is not set
@@ -882,13 +920,24 @@ CONFIG_SSB_DRIVER_PCICORE=y
 #
 # Multifunction device drivers
 #
+# CONFIG_MFD_CORE is not set
 # CONFIG_MFD_SM501 is not set
+# CONFIG_HTC_PASIC3 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
 
 #
@@ -900,15 +949,15 @@ CONFIG_SSB_DRIVER_PCICORE=y
 CONFIG_FB=y
 # CONFIG_FIRMWARE_EDID is not set
 # CONFIG_FB_DDC is not set
-# CONFIG_FB_CFB_FILLRECT is not set
-# CONFIG_FB_CFB_COPYAREA is not set
-# CONFIG_FB_CFB_IMAGEBLIT is not set
+CONFIG_FB_CFB_FILLRECT=m
+CONFIG_FB_CFB_COPYAREA=m
+CONFIG_FB_CFB_IMAGEBLIT=m
 # 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_DEFERRED_IO=y
 # CONFIG_FB_SVGALIB is not set
 # CONFIG_FB_MACMODES is not set
 # CONFIG_FB_BACKLIGHT is not set
@@ -941,6 +990,8 @@ CONFIG_FB_DEFERRED_IO=y
 # 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_SH_MOBILE_LCDC=m
 # CONFIG_FB_VIRTUAL is not set
 # CONFIG_BACKLIGHT_LCD_SUPPORT is not set
 
@@ -970,24 +1021,9 @@ CONFIG_LOGO_LINUX_CLUT224=y
 CONFIG_LOGO_SUPERH_MONO=y
 CONFIG_LOGO_SUPERH_VGA16=y
 CONFIG_LOGO_SUPERH_CLUT224=y
-
-#
-# Sound
-#
 CONFIG_SOUND=y
-
-#
-# Advanced Linux Sound Architecture
-#
 # CONFIG_SND is not set
-
-#
-# Open Sound System
-#
 CONFIG_SOUND_PRIME=y
-# CONFIG_SOUND_TRIDENT is not set
-# CONFIG_SOUND_MSNDCLAS is not set
-# CONFIG_SOUND_MSNDPIN is not set
 CONFIG_HID_SUPPORT=y
 CONFIG_HID=y
 # CONFIG_HID_DEBUG is not set
@@ -1006,6 +1042,7 @@ CONFIG_USB_ARCH_HAS_OHCI=y
 CONFIG_USB_ARCH_HAS_EHCI=y
 CONFIG_USB=y
 CONFIG_USB_DEBUG=y
+# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
 
 #
 # Miscellaneous USB options
@@ -1014,15 +1051,18 @@ CONFIG_USB_DEVICEFS=y
 # CONFIG_USB_DEVICE_CLASS is not set
 # CONFIG_USB_DYNAMIC_MINORS is not set
 # CONFIG_USB_OTG is not set
+# CONFIG_USB_OTG_WHITELIST is not set
+# CONFIG_USB_OTG_BLACKLIST_HUB is not set
 
 #
 # USB Host Controller Drivers
 #
+# CONFIG_USB_C67X00_HCD is not set
 CONFIG_USB_EHCI_HCD=y
-# CONFIG_USB_EHCI_SPLIT_ISO is not set
 # CONFIG_USB_EHCI_ROOT_HUB_TT is not set
 # CONFIG_USB_EHCI_TT_NEWSCHED is not set
 # CONFIG_USB_ISP116X_HCD is not set
+# CONFIG_USB_ISP1760_HCD is not set
 # CONFIG_USB_OHCI_HCD is not set
 # CONFIG_USB_UHCI_HCD is not set
 # CONFIG_USB_SL811_HCD is not set
@@ -1033,6 +1073,7 @@ CONFIG_USB_EHCI_HCD=y
 #
 # CONFIG_USB_ACM is not set
 CONFIG_USB_PRINTER=y
+# CONFIG_USB_WDM is not set
 
 #
 # NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
@@ -1054,6 +1095,7 @@ CONFIG_USB_STORAGE=y
 # 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
 
 #
@@ -1067,10 +1109,6 @@ CONFIG_USB_MON=y
 # USB port drivers
 #
 # CONFIG_USB_USS720 is not set
-
-#
-# USB Serial Converter support
-#
 # CONFIG_USB_SERIAL is not set
 
 #
@@ -1096,16 +1134,10 @@ CONFIG_USB_MON=y
 # CONFIG_USB_TRANCEVIBRATOR is not set
 # CONFIG_USB_IOWARRIOR is not set
 # CONFIG_USB_TEST is not set
-
-#
-# USB DSL modem support
-#
-
-#
-# USB Gadget Support
-#
+# CONFIG_USB_ISIGHTFW is not set
 # CONFIG_USB_GADGET is not set
 # CONFIG_MMC is not set
+# CONFIG_MEMSTICK is not set
 CONFIG_NEW_LEDS=y
 CONFIG_LEDS_CLASS=y
 
@@ -1117,13 +1149,11 @@ CONFIG_LEDS_CLASS=y
 # LED Triggers
 #
 # CONFIG_LEDS_TRIGGERS is not set
+# CONFIG_ACCESSIBILITY is not set
 # CONFIG_INFINIBAND is not set
 # CONFIG_RTC_CLASS is not set
+# CONFIG_DMADEVICES is not set
 # CONFIG_AUXDISPLAY is not set
-
-#
-# Userspace I/O
-#
 # CONFIG_UIO is not set
 
 #
@@ -1145,14 +1175,11 @@ CONFIG_FS_MBCACHE=y
 # 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=y
-# CONFIG_ROMFS_FS is not set
+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=y
 # CONFIG_FUSE_FS is not set
@@ -1203,8 +1230,11 @@ CONFIG_HUGETLB_PAGE=y
 # CONFIG_EFS_FS is not set
 # CONFIG_CRAMFS is not set
 # CONFIG_VXFS_FS is not set
+CONFIG_MINIX_FS=y
+# 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
@@ -1212,19 +1242,16 @@ 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=y
 CONFIG_NFSD_V3=y
 # CONFIG_NFSD_V3_ACL is not set
 # CONFIG_NFSD_V4 is not set
-CONFIG_NFSD_TCP=y
-CONFIG_ROOT_NFS=y
 CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
 CONFIG_EXPORTFS=y
 CONFIG_NFS_COMMON=y
 CONFIG_SUNRPC=y
-# CONFIG_SUNRPC_BIND34 is not set
 # CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_RPCSEC_GSS_SPKM3 is not set
 # CONFIG_SMB_FS is not set
@@ -1279,7 +1306,6 @@ CONFIG_NLS_ISO8859_15=y
 # CONFIG_NLS_KOI8_U is not set
 CONFIG_NLS_UTF8=y
 # CONFIG_DLM is not set
-# CONFIG_INSTRUMENTATION is not set
 
 #
 # Kernel hacking
@@ -1288,6 +1314,7 @@ CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 # CONFIG_PRINTK_TIME is not set
 CONFIG_ENABLE_WARN_DEPRECATED=y
 # CONFIG_ENABLE_MUST_CHECK is not set
+CONFIG_FRAME_WARN=1024
 CONFIG_MAGIC_SYSRQ=y
 CONFIG_UNUSED_SYMBOLS=y
 # CONFIG_DEBUG_FS is not set
@@ -1295,10 +1322,14 @@ CONFIG_UNUSED_SYMBOLS=y
 CONFIG_DEBUG_KERNEL=y
 # CONFIG_DEBUG_SHIRQ is not set
 CONFIG_DETECT_SOFTLOCKUP=y
+# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
+CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
 # CONFIG_SCHED_DEBUG is not set
 # CONFIG_SCHEDSTATS is not set
 CONFIG_TIMER_STATS=y
+# CONFIG_DEBUG_OBJECTS is not set
 # CONFIG_SLUB_DEBUG_ON is not set
+# CONFIG_SLUB_STATS is not set
 CONFIG_DEBUG_PREEMPT=y
 # CONFIG_DEBUG_RT_MUTEXES is not set
 # CONFIG_RT_MUTEX_TESTER is not set
@@ -1313,12 +1344,14 @@ CONFIG_DEBUG_PREEMPT=y
 CONFIG_DEBUG_BUGVERBOSE=y
 CONFIG_DEBUG_INFO=y
 # 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_FRAME_POINTER is not set
-# CONFIG_FORCED_INLINING 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_FAULT_INJECTION is not set
 # CONFIG_SAMPLES is not set
 CONFIG_SH_STANDARD_BIOS=y
@@ -1338,52 +1371,94 @@ CONFIG_DEBUG_STACKOVERFLOW=y
 # CONFIG_SECURITY is not set
 # CONFIG_SECURITY_FILE_CAPABILITIES is not set
 CONFIG_CRYPTO=y
+
+#
+# Crypto core or helper
+#
 CONFIG_CRYPTO_ALGAPI=y
 # CONFIG_CRYPTO_MANAGER 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_NULL is not set
+
+#
+# Digest
+#
+# CONFIG_CRYPTO_CRC32C is not set
 # CONFIG_CRYPTO_MD4 is not set
 CONFIG_CRYPTO_MD5=y
+# 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_WP512 is not set
 # CONFIG_CRYPTO_TGR192 is not set
-# CONFIG_CRYPTO_GF128MUL is not set
-# CONFIG_CRYPTO_ECB is not set
-# CONFIG_CRYPTO_CBC is not set
-# CONFIG_CRYPTO_PCBC is not set
-# CONFIG_CRYPTO_LRW is not set
-# CONFIG_CRYPTO_XTS is not set
-# CONFIG_CRYPTO_CRYPTD is not set
-CONFIG_CRYPTO_DES=y
-# CONFIG_CRYPTO_FCRYPT is not set
-# CONFIG_CRYPTO_BLOWFISH is not set
-# CONFIG_CRYPTO_TWOFISH is not set
-# CONFIG_CRYPTO_SERPENT 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_TEA is not set
-# CONFIG_CRYPTO_ARC4 is not set
+CONFIG_CRYPTO_DES=y
+# CONFIG_CRYPTO_FCRYPT is not set
 # CONFIG_CRYPTO_KHAZAD is not set
-# CONFIG_CRYPTO_ANUBIS 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_MICHAEL_MIC is not set
-# CONFIG_CRYPTO_CRC32C is not set
-# CONFIG_CRYPTO_CAMELLIA is not set
-# CONFIG_CRYPTO_TEST is not set
-# CONFIG_CRYPTO_AUTHENC is not set
+# CONFIG_CRYPTO_LZO is not set
 CONFIG_CRYPTO_HW=y
+# CONFIG_CRYPTO_DEV_HIFN_795X is not set
 
 #
 # Library routines
 #
 CONFIG_BITREVERSE=y
+# CONFIG_GENERIC_FIND_FIRST_BIT is not set
 # CONFIG_CRC_CCITT is not set
 # CONFIG_CRC16 is not set
+CONFIG_CRC_T10DIF=y
 # CONFIG_CRC_ITU_T is not set
 CONFIG_CRC32=y
 # CONFIG_CRC7 is not set
index 6b34baa..af15cbe 100644 (file)
@@ -1,10 +1,11 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.26-rc4
-# Tue Jun  3 20:27:08 2008
+# Linux kernel version: 2.6.26
+# Wed Jul 30 02:06:07 2008
 #
 CONFIG_SUPERH=y
 CONFIG_SUPERH32=y
+CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
 CONFIG_GENERIC_BUG=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -87,9 +88,14 @@ CONFIG_PROFILING=y
 # CONFIG_MARKERS is not set
 CONFIG_OPROFILE=y
 CONFIG_HAVE_OPROFILE=y
+# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
+# CONFIG_HAVE_IOREMAP_PROT is not set
 # CONFIG_HAVE_KPROBES is not set
 # CONFIG_HAVE_KRETPROBES is not set
+# CONFIG_HAVE_ARCH_TRACEHOOK is not set
 # CONFIG_HAVE_DMA_ATTRS is not set
+# CONFIG_USE_GENERIC_SMP_HELPERS is not set
+CONFIG_HAVE_CLK=y
 CONFIG_RT_MUTEXES=y
 CONFIG_TINY_SHMEM=y
 CONFIG_BASE_SMALL=0
@@ -99,12 +105,13 @@ CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODULE_FORCE_UNLOAD is not set
 # CONFIG_MODVERSIONS is not set
 # CONFIG_MODULE_SRCVERSION_ALL is not set
-# CONFIG_KMOD is not set
+CONFIG_KMOD=y
 CONFIG_BLOCK=y
 # CONFIG_LBD is not set
 # CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_LSF is not set
 # CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
 
 #
 # IO Schedulers
@@ -175,7 +182,9 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_ARCH_SELECT_MEMORY_MODEL=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_ENTRY_OFFSET=0x00001000
 CONFIG_SELECT_MEMORY_MODEL=y
 CONFIG_FLATMEM_MANUAL=y
 # CONFIG_DISCONTIGMEM_MANUAL is not set
@@ -294,6 +303,7 @@ CONFIG_CF_BASE_ADDR=0xb8000000
 #
 # Executable file formats
 #
+CONFIG_BINFMT_ELF_FDPIC=y
 CONFIG_BINFMT_FLAT=y
 CONFIG_BINFMT_ZFLAT=y
 CONFIG_BINFMT_SHARED_FLAT=y
@@ -487,6 +497,7 @@ 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_EEPROM_93CX6=y
 # CONFIG_ENCLOSURE_SERVICES is not set
@@ -503,7 +514,6 @@ CONFIG_HAVE_IDE=y
 # CONFIG_ATA is not set
 # CONFIG_MD is not set
 CONFIG_NETDEVICES=y
-# CONFIG_NETDEVICES_MULTIQUEUE is not set
 # CONFIG_DUMMY is not set
 # CONFIG_BONDING is not set
 # CONFIG_MACVLAN is not set
@@ -516,6 +526,7 @@ CONFIG_MII=y
 # CONFIG_AX88796 is not set
 # CONFIG_STNIC is not set
 CONFIG_SMC91X=y
+# CONFIG_SMC911X 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
@@ -583,6 +594,7 @@ CONFIG_SERIAL_CORE_CONSOLE=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
 
 #
@@ -594,6 +606,7 @@ CONFIG_SSB_POSSIBLE=y
 #
 # Multifunction device drivers
 #
+# CONFIG_MFD_CORE is not set
 # CONFIG_MFD_SM501 is not set
 # CONFIG_HTC_PASIC3 is not set
 
@@ -625,10 +638,6 @@ CONFIG_SSB_POSSIBLE=y
 # Display device support
 #
 # CONFIG_DISPLAY_SUPPORT is not set
-
-#
-# Sound
-#
 # CONFIG_SOUND is not set
 # CONFIG_USB_SUPPORT is not set
 # CONFIG_MMC is not set
@@ -669,6 +678,7 @@ CONFIG_RTC_INTF_DEV=y
 # on-CPU RTC drivers
 #
 CONFIG_RTC_DRV_SH=y
+# CONFIG_DMADEVICES is not set
 # CONFIG_UIO is not set
 
 #
@@ -728,6 +738,7 @@ CONFIG_CONFIGFS_FS=y
 CONFIG_CRAMFS=y
 # 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=y
@@ -738,13 +749,12 @@ CONFIG_NFS_FS=y
 CONFIG_NFS_V3=y
 # CONFIG_NFS_V3_ACL is not set
 # CONFIG_NFS_V4 is not set
-# CONFIG_NFSD 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_SUNRPC_BIND34 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 +786,8 @@ CONFIG_DEBUG_FS=y
 CONFIG_DEBUG_KERNEL=y
 # CONFIG_DEBUG_SHIRQ is not set
 CONFIG_DETECT_SOFTLOCKUP=y
+# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
+CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
 CONFIG_SCHED_DEBUG=y
 # CONFIG_SCHEDSTATS is not set
 # CONFIG_TIMER_STATS is not set
@@ -795,6 +807,7 @@ 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=y
 # CONFIG_DEBUG_SG is not set
 CONFIG_FRAME_POINTER=y
@@ -860,6 +873,10 @@ CONFIG_CRYPTO_ALGAPI=y
 # 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
@@ -899,6 +916,7 @@ CONFIG_BITREVERSE=y
 # CONFIG_GENERIC_FIND_FIRST_BIT is not set
 CONFIG_CRC_CCITT=y
 CONFIG_CRC16=y
+# CONFIG_CRC_T10DIF is not set
 CONFIG_CRC_ITU_T=y
 CONFIG_CRC32=y
 CONFIG_CRC7=y
index 7b72736..4e30b70 100644 (file)
@@ -1,10 +1,11 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.26-rc8
-# Mon Jul  7 13:12:45 2008
+# Linux kernel version: 2.6.26
+# Wed Jul 30 02:08:38 2008
 #
 CONFIG_SUPERH=y
 CONFIG_SUPERH32=y
+CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
 CONFIG_GENERIC_BUG=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -77,9 +78,14 @@ CONFIG_SLAB=y
 # CONFIG_PROFILING is not set
 # CONFIG_MARKERS is not set
 CONFIG_HAVE_OPROFILE=y
+# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
+# CONFIG_HAVE_IOREMAP_PROT is not set
 # CONFIG_HAVE_KPROBES is not set
 # CONFIG_HAVE_KRETPROBES is not set
+# CONFIG_HAVE_ARCH_TRACEHOOK is not set
 # CONFIG_HAVE_DMA_ATTRS is not set
+# CONFIG_USE_GENERIC_SMP_HELPERS is not set
+CONFIG_HAVE_CLK=y
 CONFIG_PROC_PAGE_MONITOR=y
 CONFIG_SLABINFO=y
 CONFIG_TINY_SHMEM=y
@@ -90,12 +96,13 @@ CONFIG_MODULE_UNLOAD=y
 CONFIG_MODULE_FORCE_UNLOAD=y
 # CONFIG_MODVERSIONS is not set
 # CONFIG_MODULE_SRCVERSION_ALL is not set
-# CONFIG_KMOD is not set
+CONFIG_KMOD=y
 CONFIG_BLOCK=y
 # CONFIG_LBD is not set
 # CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_LSF is not set
 # CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
 
 #
 # IO Schedulers
@@ -171,6 +178,7 @@ 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_ENTRY_OFFSET=0x00001000
 CONFIG_SELECT_MEMORY_MODEL=y
 CONFIG_FLATMEM_MANUAL=y
 # CONFIG_DISCONTIGMEM_MANUAL is not set
@@ -368,6 +376,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 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 is not set
 CONFIG_MTD=y
@@ -455,6 +465,7 @@ CONFIG_BLK_DEV=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 is not set
@@ -497,10 +508,10 @@ CONFIG_SCSI_WAIT_SCAN=m
 # CONFIG_SCSI_SAS_LIBSAS is not set
 # CONFIG_SCSI_SRP_ATTRS is not set
 # CONFIG_SCSI_LOWLEVEL is not set
+# CONFIG_SCSI_DH is not set
 # CONFIG_ATA is not set
 # CONFIG_MD is not set
 CONFIG_NETDEVICES=y
-# CONFIG_NETDEVICES_MULTIQUEUE is not set
 # CONFIG_DUMMY is not set
 # CONFIG_BONDING is not set
 # CONFIG_MACVLAN is not set
@@ -513,13 +524,13 @@ CONFIG_MII=y
 # CONFIG_AX88796 is not set
 # CONFIG_STNIC is not set
 CONFIG_SMC91X=y
+# CONFIG_SMC911X 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_B44 is not set
 CONFIG_NETDEV_1000=y
-# CONFIG_E1000E_ENABLED is not set
 CONFIG_NETDEV_10000=y
 
 #
@@ -572,6 +583,7 @@ CONFIG_INPUT=y
 # 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
@@ -617,6 +629,7 @@ CONFIG_SSB_POSSIBLE=y
 #
 # Multifunction device drivers
 #
+# CONFIG_MFD_CORE is not set
 # CONFIG_MFD_SM501 is not set
 # CONFIG_HTC_PASIC3 is not set
 
@@ -646,6 +659,7 @@ CONFIG_VIDEO_HELPER_CHIPS_AUTO=y
 # CONFIG_VIDEO_VIVI is not set
 # CONFIG_VIDEO_CPIA is not set
 # CONFIG_SOC_CAMERA is not set
+# CONFIG_VIDEO_SH_MOBILE_CEU is not set
 CONFIG_RADIO_ADAPTERS=y
 # CONFIG_DAB is not set
 
@@ -657,9 +671,9 @@ CONFIG_RADIO_ADAPTERS=y
 CONFIG_FB=y
 CONFIG_FIRMWARE_EDID=y
 # CONFIG_FB_DDC is not set
-# CONFIG_FB_CFB_FILLRECT is not set
-# CONFIG_FB_CFB_COPYAREA is not set
-# CONFIG_FB_CFB_IMAGEBLIT is not set
+CONFIG_FB_CFB_FILLRECT=m
+CONFIG_FB_CFB_COPYAREA=m
+CONFIG_FB_CFB_IMAGEBLIT=m
 # CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
 # CONFIG_FB_SYS_FILLRECT is not set
 # CONFIG_FB_SYS_COPYAREA is not set
@@ -676,6 +690,7 @@ CONFIG_FIRMWARE_EDID=y
 # Frame buffer hardware drivers
 #
 # CONFIG_FB_S1D13XXX is not set
+CONFIG_FB_SH_MOBILE_LCDC=m
 # CONFIG_FB_VIRTUAL is not set
 # CONFIG_BACKLIGHT_LCD_SUPPORT is not set
 
@@ -690,15 +705,7 @@ CONFIG_FIRMWARE_EDID=y
 CONFIG_DUMMY_CONSOLE=y
 # CONFIG_FRAMEBUFFER_CONSOLE is not set
 # CONFIG_LOGO is not set
-
-#
-# Sound
-#
 CONFIG_SOUND=y
-
-#
-# Advanced Linux Sound Architecture
-#
 CONFIG_SND=y
 CONFIG_SND_TIMER=y
 CONFIG_SND_PCM=y
@@ -714,40 +721,14 @@ 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_DRIVERS=y
 # CONFIG_SND_DUMMY is not set
 # CONFIG_SND_VIRMIDI is not set
 # CONFIG_SND_MTPAV is not set
 # CONFIG_SND_SERIAL_U16550 is not set
 # CONFIG_SND_MPU401 is not set
-
-#
-# SUPERH devices
-#
-
-#
-# System on Chip audio support
-#
+CONFIG_SND_SUPERH=y
 # CONFIG_SND_SOC is not set
-
-#
-# SoC Audio support for SuperH
-#
-
-#
-# ALSA SoC audio for Freescale SOCs
-#
-
-#
-# SoC Audio for the Texas Instruments OMAP
-#
-
-#
-# Open Sound System
-#
 # CONFIG_SOUND_PRIME is not set
 CONFIG_HID_SUPPORT=y
 CONFIG_HID=y
@@ -759,6 +740,7 @@ CONFIG_HID=y
 # CONFIG_NEW_LEDS is not set
 # CONFIG_ACCESSIBILITY is not set
 # CONFIG_RTC_CLASS is not set
+# CONFIG_DMADEVICES is not set
 # CONFIG_UIO is not set
 
 #
@@ -836,6 +818,7 @@ CONFIG_JFFS2_RTIME=y
 CONFIG_CRAMFS=y
 # 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
@@ -854,7 +837,6 @@ CONFIG_LOCKD_V4=y
 CONFIG_EXPORTFS=y
 CONFIG_NFS_COMMON=y
 CONFIG_SUNRPC=y
-# CONFIG_SUNRPC_BIND34 is not set
 # CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_RPCSEC_GSS_SPKM3 is not set
 # CONFIG_SMB_FS is not set
@@ -885,6 +867,7 @@ CONFIG_FRAME_WARN=1024
 # CONFIG_HEADERS_CHECK is not set
 # CONFIG_DEBUG_KERNEL is not set
 # CONFIG_DEBUG_BUGVERBOSE is not set
+# CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_SAMPLES is not set
 # CONFIG_SH_STANDARD_BIOS is not set
 CONFIG_EARLY_SCIF_CONSOLE=y
@@ -941,6 +924,10 @@ CONFIG_CRYPTO=y
 # 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
@@ -980,6 +967,7 @@ CONFIG_BITREVERSE=y
 # CONFIG_GENERIC_FIND_FIRST_BIT is not set
 # 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
index 3a3c3c1..80c1c72 100644 (file)
@@ -1,9 +1,11 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.22-rc4
-# Fri Jun 15 19:43:06 2007
+# Linux kernel version: 2.6.26
+# Wed Jul 30 02:12:32 2008
 #
 CONFIG_SUPERH=y
+CONFIG_SUPERH32=y
+CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
 CONFIG_GENERIC_BUG=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -17,27 +19,26 @@ CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_LOCKDEP_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_SUPPORTS_AOUT=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
 
 #
-# 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_AUTO is not set
 # CONFIG_SYSVIPC is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
-# CONFIG_UTS_NS is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
-CONFIG_SYSFS_DEPRECATED=y
+# CONFIG_CGROUPS is not set
+# CONFIG_GROUP_SCHED 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
@@ -49,6 +50,7 @@ CONFIG_EMBEDDED=y
 CONFIG_PRINTK=y
 CONFIG_BUG=y
 # CONFIG_ELF_CORE is not set
+CONFIG_COMPAT_BRK=y
 # CONFIG_BASE_FULL is not set
 # CONFIG_FUTEX is not set
 CONFIG_ANON_INODES=y
@@ -60,20 +62,26 @@ CONFIG_EVENTFD=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_EFFICIENT_UNALIGNED_ACCESS is not set
+# CONFIG_HAVE_IOREMAP_PROT is not set
+# CONFIG_HAVE_KPROBES is not set
+# CONFIG_HAVE_KRETPROBES is not set
+# CONFIG_HAVE_ARCH_TRACEHOOK is not set
+# CONFIG_HAVE_DMA_ATTRS is not set
+# CONFIG_USE_GENERIC_SMP_HELPERS is not set
+CONFIG_HAVE_CLK=y
+CONFIG_SLABINFO=y
 CONFIG_TINY_SHMEM=y
 CONFIG_BASE_SMALL=1
-
-#
-# Loadable module support
-#
 # CONFIG_MODULES is not set
-
-#
-# Block layer
-#
 CONFIG_BLOCK=y
 # CONFIG_LBD is not set
 # CONFIG_LSF is not set
+# CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
 
 #
 # IO Schedulers
@@ -87,14 +95,17 @@ CONFIG_IOSCHED_NOOP=y
 # CONFIG_DEFAULT_CFQ is not set
 CONFIG_DEFAULT_NOOP=y
 CONFIG_DEFAULT_IOSCHED="noop"
+CONFIG_CLASSIC_RCU=y
 
 #
 # System type
 #
 CONFIG_CPU_SH2=y
 CONFIG_CPU_SUBTYPE_SH7619=y
+# CONFIG_CPU_SUBTYPE_SH7203 is not set
 # CONFIG_CPU_SUBTYPE_SH7206 is not set
-# CONFIG_CPU_SUBTYPE_SH7300 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
@@ -102,6 +113,8 @@ CONFIG_CPU_SUBTYPE_SH7619=y
 # 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
@@ -110,14 +123,17 @@ CONFIG_CPU_SUBTYPE_SH7619=y
 # 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_ST40STB1 is not set
-# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
+# CONFIG_CPU_SUBTYPE_SH7723 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_SH73180 is not set
+# 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
+# CONFIG_CPU_SUBTYPE_SH5_101 is not set
+# CONFIG_CPU_SUBTYPE_SH5_103 is not set
 
 #
 # Memory management options
@@ -126,6 +142,7 @@ CONFIG_QUICKLIST=y
 CONFIG_PAGE_OFFSET=0x00000000
 CONFIG_MEMORY_START=0x0c000000
 CONFIG_MEMORY_SIZE=0x04000000
+CONFIG_29BIT=y
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_SPARSEMEM_ENABLE=y
 CONFIG_ARCH_SPARSEMEM_DEFAULT=y
@@ -134,7 +151,9 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_ARCH_SELECT_MEMORY_MODEL=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_ENTRY_OFFSET=0x00001000
 CONFIG_SELECT_MEMORY_MODEL=y
 CONFIG_FLATMEM_MANUAL=y
 # CONFIG_DISCONTIGMEM_MANUAL is not set
@@ -142,6 +161,8 @@ CONFIG_FLATMEM_MANUAL=y
 CONFIG_FLATMEM=y
 CONFIG_FLAT_NODE_MEM_MAP=y
 CONFIG_SPARSEMEM_STATIC=y
+# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
+CONFIG_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
 # CONFIG_RESOURCES_64BIT is not set
 CONFIG_ZONE_DMA_FLAG=0
@@ -151,7 +172,9 @@ CONFIG_NR_QUICK=2
 # Cache configuration
 #
 # CONFIG_SH_DIRECT_MAPPED is not set
-CONFIG_SH_WRITETHROUGH=y
+# CONFIG_CACHE_WRITEBACK is not set
+CONFIG_CACHE_WRITETHROUGH=y
+# CONFIG_CACHE_OFF is not set
 
 #
 # Processor features
@@ -159,8 +182,6 @@ CONFIG_SH_WRITETHROUGH=y
 # CONFIG_CPU_LITTLE_ENDIAN is not set
 CONFIG_CPU_BIG_ENDIAN=y
 # CONFIG_SH_FPU_EMU is not set
-# CONFIG_SH_DSP is not set
-CONFIG_CPU_HAS_IPR_IRQ=y
 
 #
 # Board support
@@ -185,7 +206,6 @@ CONFIG_SH_CLK_MD=5
 #
 # DMA support
 #
-# CONFIG_SH_DMA is not set
 
 #
 # Companion Chips
@@ -205,11 +225,13 @@ CONFIG_HZ_100=y
 # CONFIG_HZ_300 is not set
 # CONFIG_HZ_1000 is not set
 CONFIG_HZ=100
+# CONFIG_SCHED_HRTICK is not set
 # CONFIG_KEXEC is not set
 # CONFIG_CRASH_DUMP is not set
 CONFIG_PREEMPT_NONE=y
 # CONFIG_PREEMPT_VOLUNTARY is not set
 # CONFIG_PREEMPT is not set
+CONFIG_GUSA=y
 
 #
 # Boot options
@@ -221,15 +243,13 @@ CONFIG_BOOT_LINK_OFFSET=0x00800000
 #
 # Bus options
 #
+# CONFIG_CF_ENABLER is not set
 # CONFIG_ARCH_SUPPORTS_MSI is not set
 
-#
-# PCCARD (PCMCIA/CardBus) support
-#
-
 #
 # Executable file formats
 #
+CONFIG_BINFMT_ELF_FDPIC=y
 CONFIG_BINFMT_FLAT=y
 CONFIG_BINFMT_ZFLAT=y
 # CONFIG_BINFMT_SHARED_FLAT is not set
@@ -250,10 +270,6 @@ CONFIG_BINFMT_ZFLAT=y
 # CONFIG_STANDALONE is not set
 # CONFIG_PREVENT_FIRMWARE_BUILD is not set
 # CONFIG_SYS_HYPERVISOR is not set
-
-#
-# Connector - unified userspace <-> kernelspace linker
-#
 CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
 CONFIG_MTD_CONCAT=y
@@ -263,6 +279,7 @@ CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1
 # CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set
 # CONFIG_MTD_REDBOOT_PARTS_READONLY is not set
 # CONFIG_MTD_CMDLINE_PARTS is not set
+# CONFIG_MTD_AR7_PARTS is not set
 
 #
 # User Modules And Translation Layers
@@ -275,6 +292,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
@@ -334,29 +352,17 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=2
 # UBI - Unsorted block images
 #
 # CONFIG_MTD_UBI is not set
-
-#
-# Parallel port support
-#
 # CONFIG_PARPORT is not set
-
-#
-# Plug and Play support
-#
-# CONFIG_PNPACPI is not set
-
-#
-# Block devices
-#
+CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
 # CONFIG_BLK_DEV_RAM is not set
 # CONFIG_CDROM_PKTCDVD is not set
-
-#
-# Misc devices
-#
-# CONFIG_BLINK is not set
+# CONFIG_BLK_DEV_HD is not set
+CONFIG_MISC_DEVICES=y
+# CONFIG_EEPROM_93CX6 is not set
+# CONFIG_ENCLOSURE_SERVICES is not set
+CONFIG_HAVE_IDE=y
 # CONFIG_IDE is not set
 
 #
@@ -364,21 +370,10 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=2
 #
 # 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
-
-#
-# Multi-device support (RAID and LVM)
-#
 # CONFIG_MD is not set
-
-#
-# ISDN subsystem
-#
-
-#
-# Telephony Support
-#
 # CONFIG_PHONE is not set
 
 #
@@ -386,13 +381,13 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=2
 #
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
+# CONFIG_INPUT_POLLDEV is not set
 
 #
 # Userland interfaces
 #
 # CONFIG_INPUT_MOUSEDEV is not set
 # CONFIG_INPUT_JOYDEV is not set
-# CONFIG_INPUT_TSDEV is not set
 # CONFIG_INPUT_EVDEV is not set
 # CONFIG_INPUT_EVBUG is not set
 
@@ -416,6 +411,7 @@ CONFIG_INPUT=y
 # Character devices
 #
 # CONFIG_VT is not set
+CONFIG_DEVKMEM=y
 # CONFIG_SERIAL_NONSTANDARD is not set
 
 #
@@ -433,123 +429,84 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_UNIX98_PTYS is not set
 # CONFIG_LEGACY_PTYS is not set
-
-#
-# IPMI
-#
 # CONFIG_IPMI_HANDLER is not set
-# CONFIG_WATCHDOG is not set
 # CONFIG_HW_RANDOM is not set
 # CONFIG_R3964 is not set
 # CONFIG_RAW_DRIVER is not set
-
-#
-# TPM devices
-#
 # CONFIG_TCG_TPM is not set
 # CONFIG_I2C is not set
-
-#
-# SPI support
-#
 # CONFIG_SPI is not set
-# CONFIG_SPI_MASTER 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
 
 #
-# Dallas's 1-wire bus
+# Sonics Silicon Backplane
 #
-# CONFIG_W1 is not set
-# CONFIG_HWMON is not set
+CONFIG_SSB_POSSIBLE=y
+# 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
 
 #
 # Multimedia devices
 #
+
+#
+# Multimedia core support
+#
 # CONFIG_VIDEO_DEV is not set
-CONFIG_DAB=y
+# CONFIG_VIDEO_MEDIA is not set
 
 #
-# Graphics support
+# Multimedia drivers
 #
-# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
+CONFIG_DAB=y
 
 #
-# Display device support
+# Graphics support
 #
-# CONFIG_DISPLAY_SUPPORT 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
-
-#
-# HID Devices
-#
+CONFIG_HID_SUPPORT=y
 CONFIG_HID=y
 # CONFIG_HID_DEBUG is not set
-
-#
-# USB support
-#
-# CONFIG_USB_ARCH_HAS_HCD is not set
+# CONFIG_HIDRAW 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 is not set
+# 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'
 #
-
-#
-# USB Gadget Support
-#
 # CONFIG_USB_GADGET 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
-#
-
-#
-# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
-#
-
-#
-# Real Time Clock
-#
+# CONFIG_ACCESSIBILITY is not set
 # CONFIG_RTC_CLASS is not set
-
-#
-# DMA Engine support
-#
-# CONFIG_DMA_ENGINE is not set
-
-#
-# DMA Clients
-#
-
-#
-# DMA Devices
-#
+# CONFIG_DMADEVICES is not set
+# CONFIG_UIO is not set
 
 #
 # File systems
@@ -561,12 +518,9 @@ CONFIG_HID=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_MINIX_FS is not set
-CONFIG_ROMFS_FS=y
+# CONFIG_DNOTIFY is not set
 # CONFIG_INOTIFY is not set
 # CONFIG_QUOTA is not set
-# CONFIG_DNOTIFY is not set
 # CONFIG_AUTOFS_FS is not set
 # CONFIG_AUTOFS4_FS is not set
 # CONFIG_FUSE_FS is not set
@@ -592,7 +546,6 @@ CONFIG_PROC_SYSCTL=y
 # CONFIG_SYSFS is not set
 # CONFIG_TMPFS is not set
 # CONFIG_HUGETLB_PAGE is not set
-CONFIG_RAMFS=y
 
 #
 # Miscellaneous filesystems
@@ -607,8 +560,11 @@ CONFIG_RAMFS=y
 # CONFIG_JFFS2_FS is not set
 # CONFIG_CRAMFS 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=y
 # CONFIG_SYSV_FS is not set
 # CONFIG_UFS_FS is not set
 
@@ -617,28 +573,23 @@ CONFIG_RAMFS=y
 #
 # CONFIG_PARTITION_ADVANCED is not set
 CONFIG_MSDOS_PARTITION=y
-
-#
-# Native Language Support
-#
 # CONFIG_NLS 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 is not set
+CONFIG_FRAME_WARN=1024
 # CONFIG_MAGIC_SYSRQ is not set
 # CONFIG_UNUSED_SYMBOLS is not set
 # CONFIG_HEADERS_CHECK is not set
 # CONFIG_DEBUG_KERNEL is not set
 # CONFIG_DEBUG_BUGVERBOSE is not set
+# CONFIG_DEBUG_MEMORY_INIT is not set
+# CONFIG_SAMPLES is not set
 # CONFIG_SH_STANDARD_BIOS is not set
 # CONFIG_EARLY_SCIF_CONSOLE is not set
 
@@ -646,20 +597,20 @@ CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 # Security options
 #
 # CONFIG_KEYS is not set
-
-#
-# Cryptographic options
-#
+# CONFIG_SECURITY_FILE_CAPABILITIES is not set
 # CONFIG_CRYPTO is not set
 
 #
 # Library routines
 #
 CONFIG_BITREVERSE=y
+# CONFIG_GENERIC_FIND_FIRST_BIT is not set
 # 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_ZLIB_INFLATE=y
 CONFIG_HAS_IOMEM=y
index 0caf11b..af7bb58 100644 (file)
@@ -14,8 +14,8 @@
 #include <linux/module.h>
 #include <linux/interrupt.h>
 #include <asm/cacheflush.h>
-#include <asm/mach/sysasic.h>
-#include <asm/mach/dma.h>
+#include <mach/sysasic.h>
+#include <mach/dma.h>
 #include <asm/dma.h>
 
 struct g2_channel {
index 838fad5..391cbe1 100644 (file)
@@ -13,8 +13,8 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
-#include <asm/mach/sysasic.h>
-#include <asm/mach/dma.h>
+#include <mach/sysasic.h>
+#include <mach/dma.h>
 #include <asm/dma.h>
 #include <asm/io.h>
 
index 71ff3d6..b2ffe64 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/module.h>
-#include <asm/dreamcast/dma.h>
+#include <mach-dreamcast/mach/dma.h>
 #include <asm/dma.h>
 #include <asm/io.h>
 #include "dma-sh.h"
index 0f591fb..b05af34 100644 (file)
@@ -11,7 +11,7 @@
 #ifndef __DMA_SH_H
 #define __DMA_SH_H
 
-#include <asm/cpu/dma.h>
+#include <cpu/dma.h>
 
 /* Definitions for the SuperH DMAC */
 #define REQ_L  0x00000000
index c446993..2bf85cf 100644 (file)
@@ -26,7 +26,7 @@
 
 #include <asm/io.h>
 #include <asm/irq.h>
-#include <asm/mach/pci.h>
+#include <mach/pci.h>
 
 static void __init gapspci_fixup_resources(struct pci_dev *dev)
 {
index 980275f..5ccf9ea 100644 (file)
@@ -2,7 +2,7 @@
 #include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/types.h>
-#include <asm/cpu/irq.h>
+#include <cpu/irq.h>
 #include "pci-sh5.h"
 
 static inline u8 bridge_swizzle(u8 pin, u8 slot)
index f54c291..f5d2a2a 100644 (file)
@@ -26,7 +26,7 @@
 
 #include <asm/io.h>
 #include <asm/irq.h>
-#include <asm/mach/pci.h>
+#include <mach/pci.h>
 
 static struct resource gapspci_io_resource = {
        .name   = "GAPSPCI IO",
index bbdb48c..3145c62 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/pci.h>
-#include <asm/se7780.h>
+#include <mach-se/mach/se7780.h>
 #include <asm/io.h>
 #include "pci-sh4.h"
 
index a00a4df..7a97438 100644 (file)
@@ -19,7 +19,7 @@
 #include <linux/delay.h>
 #include <linux/types.h>
 #include <linux/irq.h>
-#include <asm/cpu/irq.h>
+#include <cpu/irq.h>
 #include <asm/pci.h>
 #include <asm/io.h>
 #include "pci-sh5.h"
similarity index 57%
rename from include/asm-sh/.gitignore
rename to arch/sh/include/asm/.gitignore
index 9218ef8..378db77 100644 (file)
@@ -1,3 +1 @@
-cpu
-mach
 machtypes.h
similarity index 88%
rename from include/asm-sh/adc.h
rename to arch/sh/include/asm/adc.h
index 5f85cf7..48824c1 100644 (file)
@@ -5,7 +5,7 @@
  * Copyright (C) 2004  Andriy Skulysh
  */
 
-#include <asm/cpu/adc.h>
+#include <cpu/adc.h>
 
 int adc_single(unsigned int channel);
 
similarity index 98%
rename from include/asm-sh/addrspace.h
rename to arch/sh/include/asm/addrspace.h
index fa544fc..2702d81 100644 (file)
@@ -12,7 +12,7 @@
 
 #ifdef __KERNEL__
 
-#include <asm/cpu/addrspace.h>
+#include <cpu/addrspace.h>
 
 /* If this CPU supports segmentation, hook up the helpers */
 #ifdef P1SEG
similarity index 94%
rename from include/asm-sh/auxvec.h
rename to arch/sh/include/asm/auxvec.h
index a6b9d4f..483effd 100644 (file)
@@ -12,7 +12,7 @@
  */
 #define AT_FPUCW               18      /* Used FPU control word.  */
 
-#ifdef CONFIG_VSYSCALL
+#if defined(CONFIG_VSYSCALL) || !defined(__KERNEL__)
 /*
  * Only define this in the vsyscall case, the entry point to
  * the vsyscall page gets placed here. The kernel will attempt
similarity index 97%
rename from include/asm-sh/cache.h
rename to arch/sh/include/asm/cache.h
index 083419f..02df18e 100644 (file)
@@ -10,7 +10,7 @@
 #ifdef __KERNEL__
 
 #include <linux/init.h>
-#include <asm/cpu/cache.h>
+#include <cpu/cache.h>
 
 #define L1_CACHE_BYTES         (1 << L1_CACHE_SHIFT)
 
similarity index 98%
rename from include/asm-sh/cacheflush.h
rename to arch/sh/include/asm/cacheflush.h
index e034c36..09acbc3 100644 (file)
@@ -27,7 +27,7 @@
 #define __flush_purge_region(start, size)      do { (void)(start); } while (0)
 #define __flush_invalidate_region(start, size) do { (void)(start); } while (0)
 #else
-#include <asm/cpu/cacheflush.h>
+#include <cpu/cacheflush.h>
 
 /*
  * Consistent DMA requires that the __flush_xxx() primitives must be set
similarity index 99%
rename from include/asm-sh/dma.h
rename to arch/sh/include/asm/dma.h
index a65b02f..beca712 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/wait.h>
 #include <linux/sched.h>
 #include <linux/sysdev.h>
-#include <asm/cpu/dma.h>
+#include <cpu/dma.h>
 
 /* The maximum address that we can perform a DMA transfer to on this platform */
 /* Don't define MAX_DMA_ADDRESS; it's useless on the SuperH and any
similarity index 100%
rename from include/asm-sh/fb.h
rename to arch/sh/include/asm/fb.h
similarity index 94%
rename from include/asm-sh/freq.h
rename to arch/sh/include/asm/freq.h
index 39c0e09..4ece90b 100644 (file)
@@ -12,7 +12,7 @@
 #define __ASM_SH_FREQ_H
 #ifdef __KERNEL__
 
-#include <asm/cpu/freq.h>
+#include <cpu/freq.h>
 
 #endif /* __KERNEL__ */
 #endif /* __ASM_SH_FREQ_H */
similarity index 94%
rename from include/asm-sh/gpio.h
rename to arch/sh/include/asm/gpio.h
index 9bb27e0..cf32bd2 100644 (file)
@@ -13,7 +13,7 @@
 #define __ASM_SH_GPIO_H
 
 #if defined(CONFIG_CPU_SH3)
-#include <asm/cpu/gpio.h>
+#include <cpu/gpio.h>
 #endif
 
 #endif /* __ASM_SH_GPIO_H */
similarity index 100%
rename from include/asm-sh/io.h
rename to arch/sh/include/asm/io.h
similarity index 97%
rename from include/asm-sh/irq.h
rename to arch/sh/include/asm/irq.h
index ca66e5d..6195a53 100644 (file)
@@ -51,7 +51,7 @@ extern void irq_ctx_exit(int cpu);
 #endif
 
 #ifdef CONFIG_CPU_SH5
-#include <asm/cpu/irq.h>
+#include <cpu/irq.h>
 #endif
 
 #endif /* __ASM_SH_IRQ_H */
similarity index 98%
rename from include/asm-sh/irqflags_64.h
rename to arch/sh/include/asm/irqflags_64.h
index 4f6b8a5..88f6522 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef __ASM_SH_IRQFLAGS_64_H
 #define __ASM_SH_IRQFLAGS_64_H
 
-#include <asm/cpu/registers.h>
+#include <cpu/registers.h>
 
 #define SR_MASK_LL     0x00000000000000f0LL
 #define SR_BL_LL       0x0000000010000000LL
similarity index 99%
rename from include/asm-sh/mmu_context.h
rename to arch/sh/include/asm/mmu_context.h
index 8589a50..04c0c97 100644 (file)
@@ -8,7 +8,7 @@
 #define __ASM_SH_MMU_CONTEXT_H
 
 #ifdef __KERNEL__
-#include <asm/cpu/mmu_context.h>
+#include <cpu/mmu_context.h>
 #include <asm/tlbflush.h>
 #include <asm/uaccess.h>
 #include <asm/io.h>
similarity index 98%
rename from include/asm-sh/mmu_context_64.h
rename to arch/sh/include/asm/mmu_context_64.h
index 9649f1c..de12102 100644 (file)
@@ -11,7 +11,7 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  */
-#include <asm/cpu/registers.h>
+#include <cpu/registers.h>
 #include <asm/cacheflush.h>
 
 #define SR_ASID_MASK           0xffffffffff00ffffULL
similarity index 100%
rename from include/asm-sh/pm.h
rename to arch/sh/include/asm/pm.h
similarity index 98%
rename from include/asm-sh/processor_32.h
rename to arch/sh/include/asm/processor_32.h
index c6583f2..0dadd75 100644 (file)
@@ -19,7 +19,7 @@
  * Default implementation of macro that returns current
  * instruction pointer ("program counter").
  */
-#define current_text_addr() ({ void *pc; __asm__("mova 1f, %0\n1:":"=z" (pc)); pc; })
+#define current_text_addr() ({ void *pc; __asm__("mova 1f, %0\n.align 2\n1:":"=z" (pc)); pc; })
 
 /* Core Processor Version Register */
 #define CCN_PVR                0xff000030
similarity index 99%
rename from include/asm-sh/processor_64.h
rename to arch/sh/include/asm/processor_64.h
index fc7fc68..770d516 100644 (file)
@@ -19,7 +19,7 @@
 #include <asm/types.h>
 #include <asm/cache.h>
 #include <asm/ptrace.h>
-#include <asm/cpu/registers.h>
+#include <cpu/registers.h>
 
 /*
  * Default implementation of macro that returns current
similarity index 92%
rename from include/asm-sh/ptrace.h
rename to arch/sh/include/asm/ptrace.h
index 643ab5a..b86aeab 100644 (file)
@@ -104,6 +104,15 @@ struct pt_dspregs {
 
 extern void show_regs(struct pt_regs *);
 
+/*
+ * These are defined as per linux/ptrace.h.
+ */
+struct task_struct;
+
+#define arch_has_single_step() (1)
+extern void user_enable_single_step(struct task_struct *);
+extern void user_disable_single_step(struct task_struct *);
+
 #ifdef CONFIG_SH_DSP
 #define task_pt_regs(task) \
        ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \
similarity index 92%
rename from include/asm-sh/rtc.h
rename to arch/sh/include/asm/rtc.h
index ec45ba8..1813f42 100644 (file)
@@ -11,6 +11,6 @@ struct sh_rtc_platform_info {
        unsigned long capabilities;
 };
 
-#include <asm/cpu/rtc.h>
+#include <cpu/rtc.h>
 
 #endif /* _ASM_RTC_H */
diff --git a/arch/sh/include/asm/seccomp.h b/arch/sh/include/asm/seccomp.h
new file mode 100644 (file)
index 0000000..3280ed3
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef __ASM_SECCOMP_H
+
+#include <linux/unistd.h>
+
+#define __NR_seccomp_read __NR_read
+#define __NR_seccomp_write __NR_write
+#define __NR_seccomp_exit __NR_exit
+#define __NR_seccomp_sigreturn __NR_rt_sigreturn
+
+#endif /* __ASM_SECCOMP_H */
similarity index 96%
rename from include/asm-sh/serial.h
rename to arch/sh/include/asm/serial.h
index 21f6d33..e13cc94 100644 (file)
@@ -21,7 +21,7 @@
 #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
 
 #ifdef CONFIG_HD64465
-#include <asm/hd64465.h>
+#include <asm/hd64465/hd64465.h>
 
 #define SERIAL_PORT_DFNS                   \
         /* UART CLK   PORT IRQ     FLAGS        */                      \
similarity index 70%
rename from include/asm-sh/thread_info.h
rename to arch/sh/include/asm/thread_info.h
index eeb4c74..0a894ca 100644 (file)
@@ -117,24 +117,45 @@ static inline struct thread_info *current_thread_info(void)
 #define TIF_NEED_RESCHED       2       /* rescheduling necessary */
 #define TIF_RESTORE_SIGMASK    3       /* restore signal mask in do_signal() */
 #define TIF_SINGLESTEP         4       /* singlestepping active */
-#define TIF_SYSCALL_AUDIT      5
+#define TIF_SYSCALL_AUDIT      5       /* syscall auditing active */
+#define TIF_SECCOMP            6       /* secure computing */
+#define TIF_NOTIFY_RESUME      7       /* callback before returning to user */
 #define TIF_USEDFPU            16      /* FPU was used by this task this quantum (SMP) */
 #define TIF_POLLING_NRFLAG     17      /* true if poll_idle() is polling TIF_NEED_RESCHED */
 #define TIF_MEMDIE             18
-#define TIF_FREEZE             19
-
-#define _TIF_SYSCALL_TRACE     (1<<TIF_SYSCALL_TRACE)
-#define _TIF_SIGPENDING                (1<<TIF_SIGPENDING)
-#define _TIF_NEED_RESCHED      (1<<TIF_NEED_RESCHED)
-#define _TIF_RESTORE_SIGMASK   (1<<TIF_RESTORE_SIGMASK)
-#define _TIF_SINGLESTEP                (1<<TIF_SINGLESTEP)
-#define _TIF_SYSCALL_AUDIT             (1<<TIF_SYSCALL_AUDIT)
-#define _TIF_USEDFPU           (1<<TIF_USEDFPU)
-#define _TIF_POLLING_NRFLAG    (1<<TIF_POLLING_NRFLAG)
-#define _TIF_FREEZE            (1<<TIF_FREEZE)
-
-#define _TIF_WORK_MASK         0x000000FE      /* work to do on interrupt/exception return */
-#define _TIF_ALLWORK_MASK      0x000000FF      /* work to do on any return to u-space */
+#define TIF_FREEZE             19      /* Freezing for suspend */
+
+#define _TIF_SYSCALL_TRACE     (1 << TIF_SYSCALL_TRACE)
+#define _TIF_SIGPENDING                (1 << TIF_SIGPENDING)
+#define _TIF_NEED_RESCHED      (1 << TIF_NEED_RESCHED)
+#define _TIF_RESTORE_SIGMASK   (1 << TIF_RESTORE_SIGMASK)
+#define _TIF_SINGLESTEP                (1 << TIF_SINGLESTEP)
+#define _TIF_SYSCALL_AUDIT     (1 << TIF_SYSCALL_AUDIT)
+#define _TIF_SECCOMP           (1 << TIF_SECCOMP)
+#define _TIF_NOTIFY_RESUME     (1 << TIF_NOTIFY_RESUME)
+#define _TIF_USEDFPU           (1 << TIF_USEDFPU)
+#define _TIF_POLLING_NRFLAG    (1 << TIF_POLLING_NRFLAG)
+#define _TIF_FREEZE            (1 << TIF_FREEZE)
+
+/*
+ * _TIF_ALLWORK_MASK and _TIF_WORK_MASK need to fit within a byte, or we
+ * blow the tst immediate size constraints and need to fix up
+ * arch/sh/kernel/entry-common.S.
+ */
+
+/* work to do in syscall trace */
+#define _TIF_WORK_SYSCALL_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \
+                                _TIF_SYSCALL_AUDIT | _TIF_SECCOMP)
+
+/* work to do on any return to u-space */
+#define _TIF_ALLWORK_MASK      (_TIF_SYSCALL_TRACE | _TIF_SIGPENDING      | \
+                                _TIF_NEED_RESCHED  | _TIF_SYSCALL_AUDIT   | \
+                                _TIF_SINGLESTEP    | _TIF_RESTORE_SIGMASK | \
+                                _TIF_NOTIFY_RESUME)
+
+/* work to do on interrupt/exception return */
+#define _TIF_WORK_MASK         (_TIF_ALLWORK_MASK & ~(_TIF_SYSCALL_TRACE | \
+                                _TIF_SYSCALL_AUDIT | _TIF_SINGLESTEP))
 
 #endif /* __KERNEL__ */
 
similarity index 96%
rename from include/asm-sh/timer.h
rename to arch/sh/include/asm/timer.h
index 327f7eb..a7ca3a1 100644 (file)
@@ -3,7 +3,7 @@
 
 #include <linux/sysdev.h>
 #include <linux/clocksource.h>
-#include <asm/cpu/timer.h>
+#include <cpu/timer.h>
 
 struct sys_timer_ops {
        int (*init)(void);
similarity index 90%
rename from include/asm-sh/tlb_64.h
rename to arch/sh/include/asm/tlb_64.h
index 0a96f3a..ef0ae2a 100644 (file)
 #ifndef __ASSEMBLY__
 
 /**
- * for_each_dtlb_entry
+ * for_each_dtlb_entry - Iterate over free (non-wired) DTLB entries
  *
  * @tlb:       TLB entry
- *
- * Iterate over free (non-wired) DTLB entries
  */
 #define for_each_dtlb_entry(tlb)               \
        for (tlb  = cpu_data->dtlb.first;       \
             tlb += cpu_data->dtlb.step)
 
 /**
- * for_each_itlb_entry
+ * for_each_itlb_entry - Iterate over free (non-wired) ITLB entries
  *
  * @tlb:       TLB entry
- *
- * Iterate over free (non-wired) ITLB entries
  */
 #define for_each_itlb_entry(tlb)               \
        for (tlb  = cpu_data->itlb.first;       \
             tlb += cpu_data->itlb.step)
 
 /**
- * __flush_tlb_slot
+ * __flush_tlb_slot - Flushes TLB slot @slot.
  *
  * @slot:      Address of TLB slot.
- *
- * Flushes TLB slot @slot.
  */
 static inline void __flush_tlb_slot(unsigned long long slot)
 {
similarity index 97%
rename from include/asm-sh/uaccess.h
rename to arch/sh/include/asm/uaccess.h
index 45c2c9b..075848f 100644 (file)
@@ -77,8 +77,9 @@ struct __large_struct { unsigned long buf[100]; };
 ({                                                             \
        long __pu_err;                                          \
        __typeof__(*(ptr)) __user *__pu_addr = (ptr);           \
+       __typeof__(*(ptr)) __pu_val = x;                        \
        __chk_user_ptr(ptr);                                    \
-       __put_user_size((x), __pu_addr, (size), __pu_err);      \
+       __put_user_size(__pu_val, __pu_addr, (size), __pu_err); \
        __pu_err;                                               \
 })
 
@@ -86,8 +87,9 @@ struct __large_struct { unsigned long buf[100]; };
 ({                                                             \
        long __pu_err = -EFAULT;                                \
        __typeof__(*(ptr)) __user *__pu_addr = (ptr);           \
+       __typeof__(*(ptr)) __pu_val = x;                        \
        if (likely(access_ok(VERIFY_WRITE, __pu_addr, size)))   \
-               __put_user_size((x), __pu_addr, (size),         \
+               __put_user_size(__pu_val, __pu_addr, (size),    \
                                __pu_err);                      \
        __pu_err;                                               \
 })
similarity index 98%
rename from include/asm-sh/uaccess_32.h
rename to arch/sh/include/asm/uaccess_32.h
index 892fd6d..ae0d24f 100644 (file)
@@ -76,8 +76,7 @@ do {                                                  \
                __put_user_asm(x, ptr, retval, "w");    \
                break;                                  \
        case 4:                                         \
-               __put_user_asm((u32)x, ptr,             \
-                              retval, "l");            \
+               __put_user_asm(x, ptr, retval, "l");    \
                break;                                  \
        case 8:                                         \
                __put_user_u64(x, ptr, retval);         \
similarity index 98%
rename from include/asm-sh/ubc.h
rename to arch/sh/include/asm/ubc.h
index 56f4e30..a7b9028 100644 (file)
@@ -12,7 +12,7 @@
 #define __ASM_SH_UBC_H
 #ifdef __KERNEL__
 
-#include <asm/cpu/ubc.h>
+#include <cpu/ubc.h>
 
 /* User Break Controller */
 #if defined(CONFIG_CPU_SUBTYPE_SH7707) || defined(CONFIG_CPU_SUBTYPE_SH7709)
similarity index 96%
rename from include/asm-sh/watchdog.h
rename to arch/sh/include/asm/watchdog.h
index d19ea62..f024fed 100644 (file)
 #ifdef __KERNEL__
 
 #include <linux/types.h>
-#include <asm/cpu/watchdog.h>
+#include <cpu/watchdog.h>
 #include <asm/io.h>
 
 /* 
- * See asm/cpu-sh2/watchdog.h for explanation of this stupidity..
+ * See cpu-sh2/watchdog.h for explanation of this stupidity..
  */
 #ifndef WTCNT_R
 #  define WTCNT_R      WTCNT
similarity index 99%
rename from include/asm-sh/cpu-sh2/cacheflush.h
rename to arch/sh/include/cpu-common/cpu/cacheflush.h
index 2979efb..c3db00b 100644 (file)
@@ -10,7 +10,7 @@
 #ifndef __ASM_CPU_SH2_CACHEFLUSH_H
 #define __ASM_CPU_SH2_CACHEFLUSH_H
 
-/* 
+/*
  * Cache flushing:
  *
  *  - flush_cache_all() flushes entire cache
@@ -40,5 +40,5 @@
 #define flush_cache_sigtramp(vaddr)            do { } while (0)
 
 #define p3_cache_init()                                do { } while (0)
-#endif /* __ASM_CPU_SH2_CACHEFLUSH_H */
 
+#endif /* __ASM_CPU_SH2_CACHEFLUSH_H */
similarity index 88%
rename from include/asm-sh/cpu-sh2/cache.h
rename to arch/sh/include/cpu-sh2/cpu/cache.h
index 4e0b165..673515b 100644 (file)
 #define CCR            0xffffffec
 
 #define CCR_CACHE_CE   0x01    /* Cache enable */
-#define CCR_CACHE_WT   0x06    /* CCR[bit1=1,bit2=1] */
+#define CCR_CACHE_WT   0x02    /* CCR[bit1=1,bit2=1] */
                                /* 0x00000000-0x7fffffff: Write-through  */
                                /* 0x80000000-0x9fffffff: Write-back     */
                                 /* 0xc0000000-0xdfffffff: Write-through  */
-#define CCR_CACHE_CB   0x00    /* CCR[bit1=0,bit2=0] */
+#define CCR_CACHE_CB   0x04    /* CCR[bit1=0,bit2=0] */
                                /* 0x00000000-0x7fffffff: Write-back     */
                                /* 0x80000000-0x9fffffff: Write-through  */
                                 /* 0xc0000000-0xdfffffff: Write-back     */
@@ -36,6 +36,8 @@
 
 #define CCR_CACHE_ENABLE       CCR_CACHE_CE
 #define CCR_CACHE_INVALIDATE   CCR_CACHE_CF
+#define CACHE_PHYSADDR_MASK    0x1ffffc00
+
 #endif
 
 #endif /* __ASM_CPU_SH2_CACHE_H */
similarity index 79%
rename from include/asm-sh/cpu-sh2a/addrspace.h
rename to arch/sh/include/cpu-sh2a/cpu/addrspace.h
index 795ddd6..31eb4b5 100644 (file)
@@ -4,7 +4,7 @@
 #define P0SEG          0x00000000
 #define P1SEG          0x00000000
 #define P2SEG          0x20000000
-#define P3SEG          0x00000000
-#define P4SEG          0x80000000
+#define P3SEG          0x40000000
+#define P4SEG          0x60000000
 
 #endif /* __ASM_SH_CPU_SH2A_ADDRSPACE_H */
similarity index 89%
rename from include/asm-sh/cpu-sh2a/cache.h
rename to arch/sh/include/cpu-sh2a/cpu/cache.h
index afe228b..defb0ba 100644 (file)
@@ -36,5 +36,8 @@
 
 #define CCR_CACHE_ENABLE       (CCR_CACHE_OCE | CCR_CACHE_ICE)
 #define CCR_CACHE_INVALIDATE   (CCR_CACHE_OCI | CCR_CACHE_ICI)
+#define CCR_ICACHE_INVALIDATE  CCR_CACHE_ICI
+#define CCR_OCACHE_INVALIDATE  CCR_CACHE_OCI
+#define CACHE_PHYSADDR_MASK    0x1ffffc00
 
 #endif /* __ASM_CPU_SH2A_CACHE_H */
diff --git a/arch/sh/include/cpu-sh2a/cpu/cacheflush.h b/arch/sh/include/cpu-sh2a/cpu/cacheflush.h
new file mode 100644 (file)
index 0000000..3d3b920
--- /dev/null
@@ -0,0 +1,34 @@
+#ifndef __ASM_CPU_SH2A_CACHEFLUSH_H
+#define __ASM_CPU_SH2A_CACHEFLUSH_H
+
+/* 
+ * Cache flushing:
+ *
+ *  - flush_cache_all() flushes entire cache
+ *  - flush_cache_mm(mm) flushes the specified mm context's cache lines
+ *  - flush_cache_dup mm(mm) handles cache flushing when forking
+ *  - flush_cache_page(mm, vmaddr, pfn) flushes a single page
+ *  - flush_cache_range(vma, start, end) flushes a range of pages
+ *
+ *  - flush_dcache_page(pg) flushes(wback&invalidates) a page for dcache
+ *  - flush_icache_range(start, end) flushes(invalidates) a range for icache
+ *  - flush_icache_page(vma, pg) flushes(invalidates) a page for icache
+ *
+ *  Caches are indexed (effectively) by physical address on SH-2, so
+ *  we don't need them.
+ */
+#define flush_cache_all()                      do { } while (0)
+#define flush_cache_mm(mm)                     do { } while (0)
+#define flush_cache_dup_mm(mm)                 do { } while (0)
+#define flush_cache_range(vma, start, end)     do { } while (0)
+#define flush_cache_page(vma, vmaddr, pfn)     do { } while (0)
+#define flush_dcache_page(page)                        do { } while (0)
+#define flush_dcache_mmap_lock(mapping)                do { } while (0)
+#define flush_dcache_mmap_unlock(mapping)      do { } while (0)
+void flush_icache_range(unsigned long start, unsigned long end);
+#define flush_icache_page(vma,pg)              do { } while (0)
+#define flush_icache_user_range(vma,pg,adr,len)        do { } while (0)
+#define flush_cache_sigtramp(vaddr)            do { } while (0)
+
+#define p3_cache_init()                                do { } while (0)
+#endif /* __ASM_CPU_SH2A_CACHEFLUSH_H */
diff --git a/arch/sh/include/cpu-sh2a/cpu/dma.h b/arch/sh/include/cpu-sh2a/cpu/dma.h
new file mode 100644 (file)
index 0000000..27a13ef
--- /dev/null
@@ -0,0 +1 @@
+#include <cpu-sh2/cpu/dma.h>
diff --git a/arch/sh/include/cpu-sh2a/cpu/ubc.h b/arch/sh/include/cpu-sh2a/cpu/ubc.h
new file mode 100644 (file)
index 0000000..8ce2fc1
--- /dev/null
@@ -0,0 +1 @@
+#include <cpu-sh2/cpu/ubc.h>
diff --git a/arch/sh/include/cpu-sh2a/cpu/watchdog.h b/arch/sh/include/cpu-sh2a/cpu/watchdog.h
new file mode 100644 (file)
index 0000000..e7e8259
--- /dev/null
@@ -0,0 +1 @@
+#include <cpu-sh2/cpu/watchdog.h>
diff --git a/arch/sh/include/cpu-sh3/cpu/cacheflush.h b/arch/sh/include/cpu-sh3/cpu/cacheflush.h
new file mode 100644 (file)
index 0000000..abc9098
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * include/asm-sh/cpu-sh3/cacheflush.h
+ *
+ * Copyright (C) 1999 Niibe Yutaka
+ *
+ * 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_CACHEFLUSH_H
+#define __ASM_CPU_SH3_CACHEFLUSH_H
+
+#if defined(CONFIG_SH7705_CACHE_32KB)
+/* SH7705 is an SH3 processor with 32KB cache. This has alias issues like the
+ * SH4. Unlike the SH4 this is a unified cache so we need to do some work
+ * in mmap when 'exec'ing a new binary
+ */
+ /* 32KB cache, 4kb PAGE sizes need to check bit 12 */
+#define CACHE_ALIAS 0x00001000
+
+#define PG_mapped      PG_arch_1
+
+void flush_cache_all(void);
+void flush_cache_mm(struct mm_struct *mm);
+#define flush_cache_dup_mm(mm) flush_cache_mm(mm)
+void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
+                              unsigned long end);
+void flush_cache_page(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn);
+void flush_dcache_page(struct page *pg);
+void flush_icache_range(unsigned long start, unsigned long end);
+void flush_icache_page(struct vm_area_struct *vma, struct page *page);
+#else
+#include <cpu-common/cpu/cacheflush.h>
+#endif
+
+#endif /* __ASM_CPU_SH3_CACHEFLUSH_H */
similarity index 97%
rename from include/asm-sh/cpu-sh4/dma.h
rename to arch/sh/include/cpu-sh4/cpu/dma.h
index aaf71b0..235b7cd 100644 (file)
@@ -20,7 +20,7 @@
 #define CHCR_TS_MASK   0x18
 #define CHCR_TS_SHIFT  3
 
-#include <asm/cpu/dma-sh7780.h>
+#include <cpu/dma-sh7780.h>
 #else
 #define SH_DMAC_BASE   0xffa00000
 
similarity index 93%
rename from include/asm-sh/dreamcast/pci.h
rename to arch/sh/include/mach-dreamcast/mach/pci.h
index e401b24..75fc900 100644 (file)
@@ -11,7 +11,7 @@
 #ifndef __ASM_SH_DREAMCAST_PCI_H
 #define __ASM_SH_DREAMCAST_PCI_H
 
-#include <asm/mach/sysasic.h>
+#include <mach-dreamcast/mach/sysasic.h>
 
 #define        GAPSPCI_REGS            0x01001400
 #define GAPSPCI_DMA_BASE       0x01840000
diff --git a/arch/sh/kernel/.gitignore b/arch/sh/kernel/.gitignore
new file mode 100644 (file)
index 0000000..c5f676c
--- /dev/null
@@ -0,0 +1 @@
+vmlinux.lds
index d3d9f32..bea4033 100644 (file)
@@ -80,11 +80,11 @@ static int __init cf_init_default(void)
 }
 
 #if defined(CONFIG_SH_SOLUTION_ENGINE)
-#include <asm/se.h>
+#include <mach-se/mach/se.h>
 #elif defined(CONFIG_SH_7722_SOLUTION_ENGINE)
-#include <asm/se7722.h>
+#include <mach-se/mach/se7722.h>
 #elif defined(CONFIG_SH_7721_SOLUTION_ENGINE)
-#include <asm/se7721.h>
+#include <mach-se/mach/se7721.h>
 #endif
 
 /*
index 79baa47..726f033 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/bitops.h>
-#include <asm/cpu/irq.h>
+#include <cpu/irq.h>
 #include <asm/page.h>
 
 /*
index ee894e5..becc54c 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/linkage.h>
 #include <asm/asm-offsets.h>
 #include <asm/thread_info.h>
-#include <asm/cpu/mmu_context.h>
+#include <cpu/mmu_context.h>
 #include <asm/unistd.h>
 #include <asm/errno.h>
 #include <asm/page.h>
index 47096dc..ab3903e 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/linkage.h>
 #include <asm/asm-offsets.h>
 #include <asm/thread_info.h>
-#include <asm/cpu/mmu_context.h>
+#include <cpu/mmu_context.h>
 #include <asm/unistd.h>
 #include <asm/errno.h>
 #include <asm/page.h>
index 4004073..3fe482d 100644 (file)
@@ -14,7 +14,7 @@
 #include <asm/asm-offsets.h>
 #include <asm/thread_info.h>
 #include <asm/unistd.h>
-#include <asm/cpu/mmu_context.h>
+#include <cpu/mmu_context.h>
 #include <asm/page.h>
 
 ! NOTE:
index 8020796..2d452f6 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/sched.h>
 #include <linux/signal.h>
 #include <linux/io.h>
-#include <asm/cpu/fpu.h>
+#include <cpu/fpu.h>
 #include <asm/processor.h>
 #include <asm/system.h>
 #include <asm/fpu.h>
index 7b2d337..828cb57 100644 (file)
@@ -36,7 +36,7 @@
  * and Kamel Khelifi <kamel.khelifi@st.com>
  */
 #include <linux/kernel.h>
-#include <asm/cpu/fpu.h>
+#include <cpu/fpu.h>
 
 #define LIT64( a ) a##LL
 
index 9561b02..8a8a993 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/io.h>
 #include <asm/page.h>
 #include <asm/cacheflush.h>
-#include <asm/cpu/sq.h>
+#include <cpu/sq.h>
 
 struct sq_mapping;
 
@@ -199,7 +199,7 @@ EXPORT_SYMBOL(sq_remap);
 
 /**
  * sq_unmap - Unmap a Store Queue allocation
- * @map: Pre-allocated Store Queue mapping.
+ * @vaddr: Pre-allocated Store Queue mapping.
  *
  * Unmaps the store queue allocation @map that was previously created by
  * sq_remap(). Also frees up the pte that was previously inserted into
index 05372ed..04c7da9 100644 (file)
@@ -11,7 +11,7 @@
  */
 #include <linux/errno.h>
 #include <linux/sys.h>
-#include <asm/cpu/registers.h>
+#include <cpu/registers.h>
 #include <asm/processor.h>
 #include <asm/unistd.h>
 #include <asm/thread_info.h>
@@ -987,11 +987,11 @@ work_resched:
 work_notifysig:
        gettr   tr1, LINK
 
-       movi    do_signal, r6
+       movi    do_notify_resume, r6
        ptabs   r6, tr0
        or      SP, ZERO, r2
-       or      ZERO, ZERO, r3
-       blink   tr0, LINK           /* Call do_signal(regs, 0), return here */
+       or      r7, ZERO, r3
+       blink   tr0, LINK           /* Call do_notify_resume(regs, current_thread_info->flags), return here */
 
 restore_all:
        /* Do prefetches */
@@ -1300,18 +1300,20 @@ syscall_allowed:
 
        getcon  KCR0, r2
        ld.l    r2, TI_FLAGS, r4
-       movi    (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | _TIF_SYSCALL_AUDIT), r6
+       movi    _TIF_WORK_SYSCALL_MASK, r6
        and     r6, r4, r6
        beq/l   r6, ZERO, tr0
 
        /* Trace it by calling syscall_trace before and after */
-       movi    syscall_trace, r4
+       movi    do_syscall_trace_enter, r4
        or      SP, ZERO, r2
-       or      ZERO, ZERO, r3
        ptabs   r4, tr0
        blink   tr0, LINK
 
-       /* Reload syscall number as r5 is trashed by syscall_trace */
+       /* Save the retval */
+       st.q    SP, FRAME_R(2), r2
+
+       /* Reload syscall number as r5 is trashed by do_syscall_trace_enter */
        ld.q    SP, FRAME_S(FSYSCALL_ID), r5
        andi    r5, 0x1ff, r5
 
@@ -1343,9 +1345,8 @@ syscall_ret_trace:
        /* We get back here only if under trace */
        st.q    SP, FRAME_R(9), r2      /* Save return value */
 
-       movi    syscall_trace, LINK
+       movi    do_syscall_trace_leave, LINK
        or      SP, ZERO, r2
-       movi    1, r3
        ptabs   LINK, tr0
        blink   tr0, LINK
 
index 5e0dd19..0bc17de 100644 (file)
@@ -202,7 +202,7 @@ work_resched:
 syscall_exit_work:
        ! r0: current_thread_info->flags
        ! r8: current_thread_info
-       tst     #_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | _TIF_SYSCALL_AUDIT, r0
+       tst     #_TIF_WORK_SYSCALL_MASK, r0
        bt/s    work_pending
         tst    #_TIF_NEED_RESCHED, r0
 #ifdef CONFIG_TRACE_IRQFLAGS
@@ -211,10 +211,8 @@ syscall_exit_work:
         nop
 #endif
        sti
-       ! XXX setup arguments...
        mov     r15, r4
-       mov     #1, r5
-       mov.l   4f, r0                  ! do_syscall_trace
+       mov.l   8f, r0                  ! do_syscall_trace_leave
        jsr     @r0
         nop
        bra     resume_userspace
@@ -223,12 +221,11 @@ syscall_exit_work:
        .align  2
 syscall_trace_entry:
        !                       Yes it is traced.
-       ! XXX setup arguments...
        mov     r15, r4
-       mov     #0, r5
-       mov.l   4f, r11         ! Call do_syscall_trace which notifies
+       mov.l   7f, r11         ! Call do_syscall_trace_enter which notifies
        jsr     @r11            ! superior (will chomp R[0-7])
         nop
+       mov.l   r0, @(OFF_R0,r15)       ! Save return value
        !                       Reload R0-R4 from kernel stack, where the
        !                       parent may have modified them using
        !                       ptrace(POKEUSR).  (Note that R0-R2 are
@@ -351,7 +348,7 @@ ENTRY(system_call)
        !
        get_current_thread_info r8, r10
        mov.l   @(TI_FLAGS,r8), r8
-       mov     #(_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT), r10
+       mov     #_TIF_WORK_SYSCALL_MASK, r10
        tst     r10, r8
        bf      syscall_trace_entry
        !
@@ -389,8 +386,9 @@ syscall_exit:
 #endif
 2:     .long   NR_syscalls
 3:     .long   sys_call_table
-4:     .long   do_syscall_trace
 #ifdef CONFIG_TRACE_IRQFLAGS
 5:     .long   trace_hardirqs_on
 6:     .long   trace_hardirqs_off
 #endif
+7:     .long   do_syscall_trace_enter
+8:     .long   do_syscall_trace_leave
index f42d4c0..7ccfb99 100644 (file)
@@ -11,8 +11,8 @@
 #include <asm/page.h>
 #include <asm/cache.h>
 #include <asm/tlb.h>
-#include <asm/cpu/registers.h>
-#include <asm/cpu/mmu_context.h>
+#include <cpu/registers.h>
+#include <cpu/mmu_context.h>
 #include <asm/thread_info.h>
 
 /*
index a2a99e4..64b7690 100644 (file)
@@ -15,7 +15,7 @@
 #include <asm/machvec.h>
 #include <asm/uaccess.h>
 #include <asm/thread_info.h>
-#include <asm/cpu/mmu_context.h>
+#include <cpu/mmu_context.h>
 
 atomic_t irq_err_count;
 
index ec1eadc..4703dff 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/kexec.h>
 #include <linux/delay.h>
 #include <linux/reboot.h>
+#include <linux/numa.h>
 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
 #include <asm/mmu_context.h>
@@ -104,3 +105,10 @@ void machine_kexec(struct kimage *image)
        (*rnk)(page_list, reboot_code_buffer, image->start, vbr_reg);
 }
 
+void arch_crash_save_vmcoreinfo(void)
+{
+#ifdef CONFIG_NUMA
+       VMCOREINFO_SYMBOL(node_data);
+       VMCOREINFO_LENGTH(node_data, MAX_NUMNODES);
+#endif
+}
index 5482e65..c430810 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/moduleloader.h>
 #include <linux/elf.h>
 #include <linux/vmalloc.h>
+#include <linux/bug.h>
 #include <linux/fs.h>
 #include <linux/string.h>
 #include <linux/kernel.h>
@@ -36,7 +37,8 @@ void *module_alloc(unsigned long size)
 {
        if (size == 0)
                return NULL;
-       return vmalloc(size);
+
+       return vmalloc_exec(size);
 }
 
 
@@ -145,9 +147,10 @@ int module_finalize(const Elf_Ehdr *hdr,
                    const Elf_Shdr *sechdrs,
                    struct module *me)
 {
-       return 0;
+       return module_bug_finalize(hdr, sechdrs, me);
 }
 
 void module_arch_cleanup(struct module *mod)
 {
+       module_bug_cleanup(mod);
 }
index 2bc72de..035cb30 100644 (file)
@@ -20,6 +20,8 @@
 #include <linux/signal.h>
 #include <linux/io.h>
 #include <linux/audit.h>
+#include <linux/seccomp.h>
+#include <linux/tracehook.h>
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/system.h>
@@ -57,7 +59,23 @@ static inline int put_stack_long(struct task_struct *task, int offset,
        return 0;
 }
 
-static void ptrace_disable_singlestep(struct task_struct *child)
+void user_enable_single_step(struct task_struct *child)
+{
+       struct pt_regs *regs = task_pt_regs(child);
+       long pc;
+
+       pc = get_stack_long(child, (long)&regs->pc);
+
+       /* Next scheduling will set up UBC */
+       if (child->thread.ubc_pc == 0)
+               ubc_usercnt += 1;
+
+       child->thread.ubc_pc = pc;
+
+       set_tsk_thread_flag(child, TIF_SINGLESTEP);
+}
+
+void user_disable_single_step(struct task_struct *child)
 {
        clear_tsk_thread_flag(child, TIF_SINGLESTEP);
 
@@ -81,7 +99,7 @@ static void ptrace_disable_singlestep(struct task_struct *child)
  */
 void ptrace_disable(struct task_struct *child)
 {
-       ptrace_disable_singlestep(child);
+       user_disable_single_step(child);
 }
 
 long arch_ptrace(struct task_struct *child, long request, long addr, long data)
@@ -90,12 +108,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
        int ret;
 
        switch (request) {
-       /* when I and D space are separate, these will need to be fixed. */
-       case PTRACE_PEEKTEXT: /* read word at location addr. */
-       case PTRACE_PEEKDATA:
-               ret = generic_ptrace_peekdata(child, addr, data);
-               break;
-
        /* read the word at location addr in the USER area. */
        case PTRACE_PEEKUSR: {
                unsigned long tmp;
@@ -125,12 +137,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                break;
        }
 
-       /* when I and D space are separate, this will have to be fixed. */
-       case PTRACE_POKETEXT: /* write the word at location addr. */
-       case PTRACE_POKEDATA:
-               ret = generic_ptrace_pokedata(child, addr, data);
-               break;
-
        case PTRACE_POKEUSR: /* write the word at location addr in the USER area */
                ret = -EIO;
                if ((addr & 3) || addr < 0 ||
@@ -151,67 +157,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                }
                break;
 
-       case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */
-       case PTRACE_CONT: { /* restart after signal. */
-               ret = -EIO;
-               if (!valid_signal(data))
-                       break;
-               if (request == PTRACE_SYSCALL)
-                       set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
-               else
-                       clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
-
-               ptrace_disable_singlestep(child);
-
-               child->exit_code = data;
-               wake_up_process(child);
-               ret = 0;
-               break;
-       }
-
-/*
- * make the child exit.  Best I can do is send it a sigkill.
- * perhaps it should be put in the status that it wants to
- * exit.
- */
-       case PTRACE_KILL: {
-               ret = 0;
-               if (child->exit_state == EXIT_ZOMBIE)   /* already dead */
-                       break;
-               ptrace_disable_singlestep(child);
-               child->exit_code = SIGKILL;
-               wake_up_process(child);
-               break;
-       }
-
-       case PTRACE_SINGLESTEP: {  /* set the trap flag. */
-               long pc;
-               struct pt_regs *regs = NULL;
-
-               ret = -EIO;
-               if (!valid_signal(data))
-                       break;
-               clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
-               if ((child->ptrace & PT_DTRACE) == 0) {
-                       /* Spurious delayed TF traps may occur */
-                       child->ptrace |= PT_DTRACE;
-               }
-
-               pc = get_stack_long(child, (long)&regs->pc);
-
-               /* Next scheduling will set up UBC */
-               if (child->thread.ubc_pc == 0)
-                       ubc_usercnt += 1;
-               child->thread.ubc_pc = pc;
-
-               set_tsk_thread_flag(child, TIF_SINGLESTEP);
-               child->exit_code = data;
-               /* give it a chance to run. */
-               wake_up_process(child);
-               ret = 0;
-               break;
-       }
-
 #ifdef CONFIG_SH_DSP
        case PTRACE_GETDSPREGS: {
                unsigned long dp;
@@ -272,39 +217,49 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
        return ret;
 }
 
-asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit)
+static inline int audit_arch(void)
 {
-       struct task_struct *tsk = current;
+       int arch = EM_SH;
 
-       if (unlikely(current->audit_context) && entryexit)
-               audit_syscall_exit(AUDITSC_RESULT(regs->regs[0]),
-                                  regs->regs[0]);
+#ifdef CONFIG_CPU_LITTLE_ENDIAN
+       arch |= __AUDIT_ARCH_LE;
+#endif
 
-       if (!test_thread_flag(TIF_SYSCALL_TRACE) &&
-           !test_thread_flag(TIF_SINGLESTEP))
-               goto out;
-       if (!(tsk->ptrace & PT_PTRACED))
-               goto out;
+       return arch;
+}
 
-       /* the 0x80 provides a way for the tracing parent to distinguish
-          between a syscall stop and SIGTRAP delivery */
-       ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) &&
-                                !test_thread_flag(TIF_SINGLESTEP) ? 0x80 : 0));
+asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
+{
+       long ret = 0;
 
-       /*
-        * this isn't the same as continuing with a signal, but it will do
-        * for normal use.  strace only continues with a signal if the
-        * stopping signal is not SIGTRAP.  -brl
-        */
-       if (tsk->exit_code) {
-               send_sig(tsk->exit_code, tsk, 1);
-               tsk->exit_code = 0;
-       }
+       secure_computing(regs->regs[0]);
+
+       if (test_thread_flag(TIF_SYSCALL_TRACE) &&
+           tracehook_report_syscall_entry(regs))
+               /*
+                * Tracing decided this syscall should not happen.
+                * We'll return a bogus call number to get an ENOSYS
+                * error, but leave the original number in regs->regs[0].
+                */
+               ret = -1L;
 
-out:
-       if (unlikely(current->audit_context) && !entryexit)
-               audit_syscall_entry(AUDIT_ARCH_SH, regs->regs[3],
+       if (unlikely(current->audit_context))
+               audit_syscall_entry(audit_arch(), regs->regs[3],
                                    regs->regs[4], regs->regs[5],
                                    regs->regs[6], regs->regs[7]);
 
+       return ret ?: regs->regs[0];
+}
+
+asmlinkage void do_syscall_trace_leave(struct pt_regs *regs)
+{
+       int step;
+
+       if (unlikely(current->audit_context))
+               audit_syscall_exit(AUDITSC_RESULT(regs->regs[0]),
+                                  regs->regs[0]);
+
+       step = test_thread_flag(TIF_SINGLESTEP);
+       if (step || test_thread_flag(TIF_SYSCALL_TRACE))
+               tracehook_report_syscall_exit(regs, step);
 }
index d453c47..5922edd 100644 (file)
@@ -27,6 +27,8 @@
 #include <linux/signal.h>
 #include <linux/syscalls.h>
 #include <linux/audit.h>
+#include <linux/seccomp.h>
+#include <linux/tracehook.h>
 #include <asm/io.h>
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
@@ -120,18 +122,23 @@ put_fpu_long(struct task_struct *task, unsigned long addr, unsigned long data)
        return 0;
 }
 
+void user_enable_single_step(struct task_struct *child)
+{
+       struct pt_regs *regs = child->thread.uregs;
+
+       regs->sr |= SR_SSTEP;   /* auto-resetting upon exception */
+}
+
+void user_disable_single_step(struct task_struct *child)
+{
+       regs->sr &= ~SR_SSTEP;
+}
 
 long arch_ptrace(struct task_struct *child, long request, long addr, long data)
 {
        int ret;
 
        switch (request) {
-       /* when I and D space are separate, these will need to be fixed. */
-       case PTRACE_PEEKTEXT: /* read word at location addr. */
-       case PTRACE_PEEKDATA:
-               ret = generic_ptrace_peekdata(child, addr, data);
-               break;
-
        /* read the word at location addr in the USER area. */
        case PTRACE_PEEKUSR: {
                unsigned long tmp;
@@ -154,12 +161,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                break;
        }
 
-       /* when I and D space are separate, this will have to be fixed. */
-       case PTRACE_POKETEXT: /* write the word at location addr. */
-       case PTRACE_POKEDATA:
-               ret = generic_ptrace_pokedata(child, addr, data);
-               break;
-
        case PTRACE_POKEUSR:
                 /* write the word at location addr in the USER area. We must
                    disallow any changes to certain SR bits or u_fpvalid, since
@@ -191,58 +192,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                }
                break;
 
-       case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */
-       case PTRACE_CONT: { /* restart after signal. */
-               ret = -EIO;
-               if (!valid_signal(data))
-                       break;
-               if (request == PTRACE_SYSCALL)
-                       set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
-               else
-                       clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
-               child->exit_code = data;
-               wake_up_process(child);
-               ret = 0;
-               break;
-       }
-
-/*
- * make the child exit.  Best I can do is send it a sigkill.
- * perhaps it should be put in the status that it wants to
- * exit.
- */
-       case PTRACE_KILL: {
-               ret = 0;
-               if (child->exit_state == EXIT_ZOMBIE)   /* already dead */
-                       break;
-               child->exit_code = SIGKILL;
-               wake_up_process(child);
-               break;
-       }
-
-       case PTRACE_SINGLESTEP: {  /* set the trap flag. */
-               struct pt_regs *regs;
-
-               ret = -EIO;
-               if (!valid_signal(data))
-                       break;
-               clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
-               if ((child->ptrace & PT_DTRACE) == 0) {
-                       /* Spurious delayed TF traps may occur */
-                       child->ptrace |= PT_DTRACE;
-               }
-
-               regs = child->thread.uregs;
-
-               regs->sr |= SR_SSTEP;   /* auto-resetting upon exception */
-
-               child->exit_code = data;
-               /* give it a chance to run. */
-               wake_up_process(child);
-               ret = 0;
-               break;
-       }
-
        default:
                ret = ptrace_request(child, request, addr, data);
                break;
@@ -273,38 +222,51 @@ asmlinkage int sh64_ptrace(long request, long pid, long addr, long data)
        return sys_ptrace(request, pid, addr, data);
 }
 
-asmlinkage void syscall_trace(struct pt_regs *regs, int entryexit)
+static inline int audit_arch(void)
 {
-       struct task_struct *tsk = current;
+       int arch = EM_SH;
 
-       if (unlikely(current->audit_context) && entryexit)
-               audit_syscall_exit(AUDITSC_RESULT(regs->regs[9]),
-                                  regs->regs[9]);
+#ifdef CONFIG_64BIT
+       arch |= __AUDIT_ARCH_64BIT;
+#endif
+#ifdef CONFIG_CPU_LITTLE_ENDIAN
+       arch |= __AUDIT_ARCH_LE;
+#endif
 
-       if (!test_thread_flag(TIF_SYSCALL_TRACE) &&
-           !test_thread_flag(TIF_SINGLESTEP))
-               goto out;
-       if (!(tsk->ptrace & PT_PTRACED))
-               goto out;
-
-       ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) &&
-                               !test_thread_flag(TIF_SINGLESTEP) ? 0x80 : 0));
-
-       /*
-        * this isn't the same as continuing with a signal, but it will do
-        * for normal use.  strace only continues with a signal if the
-        * stopping signal is not SIGTRAP.  -brl
-        */
-       if (tsk->exit_code) {
-               send_sig(tsk->exit_code, tsk, 1);
-               tsk->exit_code = 0;
-       }
+       return arch;
+}
 
-out:
-       if (unlikely(current->audit_context) && !entryexit)
-               audit_syscall_entry(AUDIT_ARCH_SH, regs->regs[1],
+asmlinkage long long do_syscall_trace_enter(struct pt_regs *regs)
+{
+       long long ret = 0;
+
+       secure_computing(regs->regs[9]);
+
+       if (test_thread_flag(TIF_SYSCALL_TRACE) &&
+           tracehook_report_syscall_entry(regs))
+               /*
+                * Tracing decided this syscall should not happen.
+                * We'll return a bogus call number to get an ENOSYS
+                * error, but leave the original number in regs->regs[0].
+                */
+               ret = -1LL;
+
+       if (unlikely(current->audit_context))
+               audit_syscall_entry(audit_arch(), regs->regs[1],
                                    regs->regs[2], regs->regs[3],
                                    regs->regs[4], regs->regs[5]);
+
+       return ret ?: regs->regs[9];
+}
+
+asmlinkage void do_syscall_trace_leave(struct pt_regs *regs)
+{
+       if (unlikely(current->audit_context))
+               audit_syscall_exit(AUDITSC_RESULT(regs->regs[9]),
+                                  regs->regs[9]);
+
+       if (test_thread_flag(TIF_SYSCALL_TRACE))
+               tracehook_report_syscall_exit(regs, 0);
 }
 
 /* Called with interrupts disabled */
@@ -338,5 +300,5 @@ asmlinkage void do_software_break_point(unsigned long long vec,
  */
 void ptrace_disable(struct task_struct *child)
 {
-        /* nothing to do.. */
+       user_disable_single_step(child);
 }
index 6339d0c..a352076 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/smp.h>
 #include <linux/err.h>
 #include <linux/debugfs.h>
+#include <linux/crash_dump.h>
 #include <asm/uaccess.h>
 #include <asm/io.h>
 #include <asm/page.h>
@@ -286,6 +287,25 @@ static void __init setup_memory(void)
 extern void __init setup_memory(void);
 #endif
 
+/*
+ * Note: elfcorehdr_addr is not just limited to vmcore. It is also used by
+ * is_kdump_kernel() to determine if we are booting after a panic. Hence
+ * ifdef it under CONFIG_CRASH_DUMP and not CONFIG_PROC_VMCORE.
+ */
+#ifdef CONFIG_CRASH_DUMP
+/* elfcorehdr= specifies the location of elf core header
+ * stored by the crashed kernel.
+ */
+static int __init parse_elfcorehdr(char *arg)
+{
+       if (!arg)
+               return -EINVAL;
+       elfcorehdr_addr = memparse(arg, &arg);
+       return 0;
+}
+early_param("elfcorehdr", parse_elfcorehdr);
+#endif
+
 void __init setup_arch(char **cmdline_p)
 {
        enable_mmu();
index 4bbbde8..51689d2 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/binfmts.h>
 #include <linux/freezer.h>
 #include <linux/io.h>
+#include <linux/tracehook.h>
 #include <asm/system.h>
 #include <asm/ucontext.h>
 #include <asm/uaccess.h>
@@ -507,14 +508,13 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
                switch (regs->regs[0]) {
                        case -ERESTART_RESTARTBLOCK:
                        case -ERESTARTNOHAND:
+                       no_system_call_restart:
                                regs->regs[0] = -EINTR;
                                break;
 
                        case -ERESTARTSYS:
-                               if (!(ka->sa.sa_flags & SA_RESTART)) {
-                                       regs->regs[0] = -EINTR;
-                                       break;
-                               }
+                               if (!(ka->sa.sa_flags & SA_RESTART))
+                                       goto no_system_call_restart;
                        /* fallthrough */
                        case -ERESTARTNOINTR:
                                regs->regs[0] = save_r0;
@@ -589,12 +589,15 @@ static void do_signal(struct pt_regs *regs, unsigned int save_r0)
                         * clear the TIF_RESTORE_SIGMASK flag */
                        if (test_thread_flag(TIF_RESTORE_SIGMASK))
                                clear_thread_flag(TIF_RESTORE_SIGMASK);
+
+                       tracehook_signal_handler(signr, &info, &ka, regs,
+                                       test_thread_flag(TIF_SINGLESTEP));
                }
 
                return;
        }
 
- no_signal:
+no_signal:
        /* Did we come from a system call? */
        if (regs->tra >= 0) {
                /* Restart the system call - no handlers present */
@@ -618,9 +621,14 @@ static void do_signal(struct pt_regs *regs, unsigned int save_r0)
 }
 
 asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned int save_r0,
-                                __u32 thread_info_flags)
+                                unsigned long thread_info_flags)
 {
        /* deal with pending signal delivery */
-       if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK))
+       if (thread_info_flags & _TIF_SIGPENDING)
                do_signal(regs, save_r0);
+
+       if (thread_info_flags & _TIF_NOTIFY_RESUME) {
+               clear_thread_flag(TIF_NOTIFY_RESUME);
+               tracehook_notify_resume(regs);
+       }
 }
index 552eb81..1d62dfe 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/ptrace.h>
 #include <linux/unistd.h>
 #include <linux/stddef.h>
+#include <linux/tracehook.h>
 #include <asm/ucontext.h>
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
 
 #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
 
-asmlinkage int do_signal(struct pt_regs *regs, sigset_t *oldset);
+/*
+ * Note that 'init' is a special process: it doesn't get signals it doesn't
+ * want to handle. Thus you cannot kill init even with a SIGKILL even by
+ * mistake.
+ *
+ * Note that we go through the signals twice: once to check the signals that
+ * the kernel can handle, and then we build all the user-level signal handling
+ * stack-frames in one go after that.
+ */
+static int do_signal(struct pt_regs *regs, sigset_t *oldset)
+{
+       siginfo_t info;
+       int signr;
+       struct k_sigaction ka;
+
+       /*
+        * We want the common case to go fast, which
+        * is why we may in certain cases get here from
+        * kernel mode. Just return without doing anything
+        * if so.
+        */
+       if (!user_mode(regs))
+               return 1;
+
+       if (try_to_freeze())
+               goto no_signal;
+
+       if (test_thread_flag(TIF_RESTORE_SIGMASK))
+               oldset = &current->saved_sigmask;
+       else if (!oldset)
+               oldset = &current->blocked;
+
+       signr = get_signal_to_deliver(&info, &ka, regs, 0);
+
+       if (signr > 0) {
+               /* Whee!  Actually deliver the signal.  */
+               handle_signal(signr, &info, &ka, oldset, regs);
+
+               /*
+                * If a signal was successfully delivered, the saved sigmask
+                * is in its frame, and we can clear the TIF_RESTORE_SIGMASK
+                * flag.
+                */
+               if (test_thread_flag(TIF_RESTORE_SIGMASK))
+                       clear_thread_flag(TIF_RESTORE_SIGMASK);
+
+               tracehook_signal_handler(signr, &info, &ka, regs, 0);
+               return 1;
+       }
+
+no_signal:
+       /* Did we come from a system call? */
+       if (regs->syscall_nr >= 0) {
+               /* Restart the system call - no handlers present */
+               switch (regs->regs[REG_RET]) {
+               case -ERESTARTNOHAND:
+               case -ERESTARTSYS:
+               case -ERESTARTNOINTR:
+                       /* Decode Syscall # */
+                       regs->regs[REG_RET] = regs->syscall_nr;
+                       regs->pc -= 4;
+                       break;
+
+               case -ERESTART_RESTARTBLOCK:
+                       regs->regs[REG_RET] = __NR_restart_syscall;
+                       regs->pc -= 4;
+                       break;
+               }
+       }
+
+       /* No signal to deliver -- put the saved sigmask back */
+       if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
+               clear_thread_flag(TIF_RESTORE_SIGMASK);
+               sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
+       }
+
+       return 0;
+}
 
 /*
  * Atomically swap in the new signal mask, and wait for a signal.
@@ -643,14 +721,13 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
                switch (regs->regs[REG_RET]) {
                        case -ERESTART_RESTARTBLOCK:
                        case -ERESTARTNOHAND:
+                       no_system_call_restart:
                                regs->regs[REG_RET] = -EINTR;
                                break;
 
                        case -ERESTARTSYS:
-                               if (!(ka->sa.sa_flags & SA_RESTART)) {
-                                       regs->regs[REG_RET] = -EINTR;
-                                       break;
-                               }
+                               if (!(ka->sa.sa_flags & SA_RESTART))
+                                       goto no_system_call_restart;
                        /* fallthrough */
                        case -ERESTARTNOINTR:
                                /* Decode syscall # */
@@ -673,80 +750,13 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
        spin_unlock_irq(&current->sighand->siglock);
 }
 
-/*
- * Note that 'init' is a special process: it doesn't get signals it doesn't
- * want to handle. Thus you cannot kill init even with a SIGKILL even by
- * mistake.
- *
- * Note that we go through the signals twice: once to check the signals that
- * the kernel can handle, and then we build all the user-level signal handling
- * stack-frames in one go after that.
- */
-int do_signal(struct pt_regs *regs, sigset_t *oldset)
+asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags)
 {
-       siginfo_t info;
-       int signr;
-       struct k_sigaction ka;
-
-       /*
-        * We want the common case to go fast, which
-        * is why we may in certain cases get here from
-        * kernel mode. Just return without doing anything
-        * if so.
-        */
-       if (!user_mode(regs))
-               return 1;
-
-       if (try_to_freeze())
-               goto no_signal;
-
-       if (test_thread_flag(TIF_RESTORE_SIGMASK))
-               oldset = &current->saved_sigmask;
-       else if (!oldset)
-               oldset = &current->blocked;
-
-       signr = get_signal_to_deliver(&info, &ka, regs, 0);
-
-       if (signr > 0) {
-               /* Whee!  Actually deliver the signal.  */
-               handle_signal(signr, &info, &ka, oldset, regs);
+       if (thread_info_flags & _TIF_SIGPENDING)
+               do_signal(regs, 0);
 
-               /*
-                * If a signal was successfully delivered, the saved sigmask
-                * is in its frame, and we can clear the TIF_RESTORE_SIGMASK
-                * flag.
-                */
-               if (test_thread_flag(TIF_RESTORE_SIGMASK))
-                       clear_thread_flag(TIF_RESTORE_SIGMASK);
-
-               return 1;
+       if (thread_info_flags & _TIF_NOTIFY_RESUME) {
+               clear_thread_flag(TIF_NOTIFY_RESUME);
+               tracehook_notify_resume(regs);
        }
-
-no_signal:
-       /* Did we come from a system call? */
-       if (regs->syscall_nr >= 0) {
-               /* Restart the system call - no handlers present */
-               switch (regs->regs[REG_RET]) {
-               case -ERESTARTNOHAND:
-               case -ERESTARTSYS:
-               case -ERESTARTNOINTR:
-                       /* Decode Syscall # */
-                       regs->regs[REG_RET] = regs->syscall_nr;
-                       regs->pc -= 4;
-                       break;
-
-               case -ERESTART_RESTARTBLOCK:
-                       regs->regs[REG_RET] = __NR_restart_syscall;
-                       regs->pc -= 4;
-                       break;
-               }
-       }
-
-       /* No signal to deliver -- put the saved sigmask back */
-       if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
-               clear_thread_flag(TIF_RESTORE_SIGMASK);
-               sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
-       }
-
-       return 0;
 }
index 022a55f..791edab 100644 (file)
@@ -33,8 +33,8 @@
 #include <linux/irq.h>
 #include <linux/io.h>
 #include <linux/platform_device.h>
-#include <asm/cpu/registers.h>  /* required by inline __asm__ stmt. */
-#include <asm/cpu/irq.h>
+#include <cpu/registers.h>      /* required by inline __asm__ stmt. */
+#include <cpu/irq.h>
 #include <asm/addrspace.h>
 #include <asm/processor.h>
 #include <asm/uaccess.h>
index ff559e2..da32ba7 100644 (file)
@@ -8,7 +8,7 @@
 
 #include <linux/kernel.h>
 #include <asm/io.h>
-#include <asm/cpu/registers.h>
+#include <cpu/registers.h>
 
 /* THIS IS A PHYSICAL ADDRESS */
 #define HDSP2534_ADDR (0x04002100)
index 56d0a7d..9c131ca 100644 (file)
@@ -237,7 +237,6 @@ choice
 
 config CACHE_WRITEBACK
        bool "Write-back"
-       depends on CPU_SH2A || CPU_SH3 || CPU_SH4 || CPU_SH5
 
 config CACHE_WRITETHROUGH
        bool "Write-through"
index e295db6..70e0906 100644 (file)
@@ -5,12 +5,15 @@
 obj-y                  := init.o extable_32.o consistent.o
 
 ifndef CONFIG_CACHE_OFF
-obj-$(CONFIG_CPU_SH2)          += cache-sh2.o
-obj-$(CONFIG_CPU_SH3)          += cache-sh3.o
-obj-$(CONFIG_CPU_SH4)          += cache-sh4.o
-obj-$(CONFIG_SH7705_CACHE_32KB)        += cache-sh7705.o
+cache-$(CONFIG_CPU_SH2)                := cache-sh2.o
+cache-$(CONFIG_CPU_SH2A)       := cache-sh2a.o
+cache-$(CONFIG_CPU_SH3)                := cache-sh3.o
+cache-$(CONFIG_CPU_SH4)                := cache-sh4.o
+cache-$(CONFIG_SH7705_CACHE_32KB)      += cache-sh7705.o
 endif
 
+obj-y                  += $(cache-y)
+
 mmu-y                  := tlb-nommu.o pg-nommu.o
 mmu-$(CONFIG_MMU)      := fault_32.o tlbflush_32.o ioremap_32.o
 
index 6614033..c4e80d2 100644 (file)
@@ -2,6 +2,7 @@
  * arch/sh/mm/cache-sh2.c
  *
  * Copyright (C) 2002 Paul Mundt
+ * Copyright (C) 2008 Yoshinori Sato
  *
  * Released under the terms of the GNU GPL v2.0.
  */
@@ -24,8 +25,15 @@ void __flush_wback_region(void *start, int size)
        end = ((unsigned long)start + size + L1_CACHE_BYTES-1)
                & ~(L1_CACHE_BYTES-1);
        for (v = begin; v < end; v+=L1_CACHE_BYTES) {
-               /* FIXME cache purge */
-               ctrl_outl((v & 0x1ffffc00), (v & 0x00000ff0) | 0x00000008);
+               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));
+                       if ((data & CACHE_PHYSADDR_MASK) == (v & CACHE_PHYSADDR_MASK)) {
+                               data &= ~SH_CACHE_UPDATED;
+                               ctrl_outl(data, addr | (way << 12));
+                       }
+               }
        }
 }
 
@@ -37,21 +45,40 @@ void __flush_purge_region(void *start, int size)
        begin = (unsigned long)start & ~(L1_CACHE_BYTES-1);
        end = ((unsigned long)start + size + L1_CACHE_BYTES-1)
                & ~(L1_CACHE_BYTES-1);
-       for (v = begin; v < end; v+=L1_CACHE_BYTES) {
-               ctrl_outl((v & 0x1ffffc00), (v & 0x00000ff0) | 0x00000008);
-       }
+
+       for (v = begin; v < end; v+=L1_CACHE_BYTES)
+               ctrl_outl((v & CACHE_PHYSADDR_MASK),
+                         CACHE_OC_ADDRESS_ARRAY | (v & 0x00000ff0) | 0x00000008);
 }
 
 void __flush_invalidate_region(void *start, int size)
 {
+#ifdef CONFIG_CACHE_WRITEBACK
+       /*
+        * SH-2 does not support individual line invalidation, only a
+        * global invalidate.
+        */
+       unsigned long ccr;
+       unsigned long flags;
+       local_irq_save(flags);
+       jump_to_uncached();
+
+       ccr = ctrl_inl(CCR);
+       ccr |= CCR_CACHE_INVALIDATE;
+       ctrl_outl(ccr, CCR);
+
+       back_to_cached();
+       local_irq_restore(flags);
+#else
        unsigned long v;
        unsigned long begin, end;
 
        begin = (unsigned long)start & ~(L1_CACHE_BYTES-1);
        end = ((unsigned long)start + size + L1_CACHE_BYTES-1)
                & ~(L1_CACHE_BYTES-1);
-       for (v = begin; v < end; v+=L1_CACHE_BYTES) {
-               ctrl_outl((v & 0x1ffffc00), (v & 0x00000ff0) | 0x00000008);
-       }
-}
 
+       for (v = begin; v < end; v+=L1_CACHE_BYTES)
+               ctrl_outl((v & CACHE_PHYSADDR_MASK),
+                         CACHE_OC_ADDRESS_ARRAY | (v & 0x00000ff0) | 0x00000008);
+#endif
+}
diff --git a/arch/sh/mm/cache-sh2a.c b/arch/sh/mm/cache-sh2a.c
new file mode 100644 (file)
index 0000000..62c0c5f
--- /dev/null
@@ -0,0 +1,129 @@
+/*
+ * arch/sh/mm/cache-sh2a.c
+ *
+ * Copyright (C) 2008 Yoshinori Sato
+ *
+ * Released under the terms of the GNU GPL v2.0.
+ */
+
+#include <linux/init.h>
+#include <linux/mm.h>
+
+#include <asm/cache.h>
+#include <asm/addrspace.h>
+#include <asm/processor.h>
+#include <asm/cacheflush.h>
+#include <asm/io.h>
+
+void __flush_wback_region(void *start, int size)
+{
+       unsigned long v;
+       unsigned long begin, end;
+       unsigned long flags;
+
+       begin = (unsigned long)start & ~(L1_CACHE_BYTES-1);
+       end = ((unsigned long)start + size + L1_CACHE_BYTES-1)
+               & ~(L1_CACHE_BYTES-1);
+
+       local_irq_save(flags);
+       jump_to_uncached();
+
+       for (v = begin; v < end; v+=L1_CACHE_BYTES) {
+               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));
+                       if ((data & CACHE_PHYSADDR_MASK) == (v & CACHE_PHYSADDR_MASK)) {
+                               data &= ~SH_CACHE_UPDATED;
+                               ctrl_outl(data, addr | (way << 11));
+                       }
+               }
+       }
+
+       back_to_cached();
+       local_irq_restore(flags);
+}
+
+void __flush_purge_region(void *start, int size)
+{
+       unsigned long v;
+       unsigned long begin, end;
+       unsigned long flags;
+
+       begin = (unsigned long)start & ~(L1_CACHE_BYTES-1);
+       end = ((unsigned long)start + size + L1_CACHE_BYTES-1)
+               & ~(L1_CACHE_BYTES-1);
+
+       local_irq_save(flags);
+       jump_to_uncached();
+
+       for (v = begin; v < end; v+=L1_CACHE_BYTES) {
+               ctrl_outl((v & CACHE_PHYSADDR_MASK),
+                         CACHE_OC_ADDRESS_ARRAY | (v & 0x000003f0) | 0x00000008);
+       }
+       back_to_cached();
+       local_irq_restore(flags);
+}
+
+void __flush_invalidate_region(void *start, int size)
+{
+       unsigned long v;
+       unsigned long begin, end;
+       unsigned long flags;
+
+       begin = (unsigned long)start & ~(L1_CACHE_BYTES-1);
+       end = ((unsigned long)start + size + L1_CACHE_BYTES-1)
+               & ~(L1_CACHE_BYTES-1);
+       local_irq_save(flags);
+       jump_to_uncached();
+
+#ifdef CONFIG_CACHE_WRITEBACK
+       ctrl_outl(ctrl_inl(CCR) | CCR_OCACHE_INVALIDATE, CCR);
+       /* I-cache invalidate */
+       for (v = begin; v < end; v+=L1_CACHE_BYTES) {
+               ctrl_outl((v & CACHE_PHYSADDR_MASK),
+                         CACHE_IC_ADDRESS_ARRAY | (v & 0x000003f0) | 0x00000008);
+       }
+#else
+       for (v = begin; v < end; v+=L1_CACHE_BYTES) {
+               ctrl_outl((v & CACHE_PHYSADDR_MASK),
+                         CACHE_IC_ADDRESS_ARRAY | (v & 0x000003f0) | 0x00000008);
+               ctrl_outl((v & CACHE_PHYSADDR_MASK),
+                         CACHE_OC_ADDRESS_ARRAY | (v & 0x000003f0) | 0x00000008);
+       }
+#endif
+       back_to_cached();
+       local_irq_restore(flags);
+}
+
+/* WBack O-Cache and flush I-Cache */
+void flush_icache_range(unsigned long start, unsigned long end)
+{
+       unsigned long v;
+       unsigned long flags;
+
+       start = start & ~(L1_CACHE_BYTES-1);
+       end = (end + L1_CACHE_BYTES-1) & ~(L1_CACHE_BYTES-1);
+
+       local_irq_save(flags);
+       jump_to_uncached();
+
+       for (v = start; v < end; v+=L1_CACHE_BYTES) {
+               unsigned long addr = (v & 0x000007f0);
+               int way;
+               /* O-Cache writeback */
+               for (way = 0; way < 4; way++) {
+                       unsigned long data =  ctrl_inl(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));
+                       }
+               }
+               /* I-Cache invalidate */
+               ctrl_outl(addr,
+                         CACHE_IC_ADDRESS_ARRAY | addr | 0x00000008);
+       }
+
+       back_to_cached();
+       local_irq_restore(flags);
+}
index 399d537..bd63b96 100644 (file)
@@ -39,7 +39,7 @@
 #include <asm/uaccess.h>
 #include <asm/pgalloc.h>
 #include <asm/mmu_context.h>
-#include <asm/cpu/registers.h>
+#include <cpu/registers.h>
 
 /* Callable from fault.c, so not static */
 inline void __do_tlb_refill(unsigned long address,
index f34274a..dae1312 100644 (file)
@@ -15,9 +15,7 @@
 #include <asm/mmu_context.h>
 
 /**
- * sh64_tlb_init
- *
- * Perform initial setup for the DTLB and ITLB.
+ * sh64_tlb_init - Perform initial setup for the DTLB and ITLB.
  */
 int __init sh64_tlb_init(void)
 {
@@ -46,9 +44,7 @@ int __init sh64_tlb_init(void)
 }
 
 /**
- * sh64_next_free_dtlb_entry
- *
- * Find the next available DTLB entry
+ * sh64_next_free_dtlb_entry - Find the next available DTLB entry
  */
 unsigned long long sh64_next_free_dtlb_entry(void)
 {
@@ -56,9 +52,7 @@ unsigned long long sh64_next_free_dtlb_entry(void)
 }
 
 /**
- * sh64_get_wired_dtlb_entry
- *
- * Allocate a wired (locked-in) entry in the DTLB
+ * sh64_get_wired_dtlb_entry - Allocate a wired (locked-in) entry in the DTLB
  */
 unsigned long long sh64_get_wired_dtlb_entry(void)
 {
@@ -71,12 +65,10 @@ unsigned long long sh64_get_wired_dtlb_entry(void)
 }
 
 /**
- * sh64_put_wired_dtlb_entry
+ * sh64_put_wired_dtlb_entry - Free a wired (locked-in) entry in the DTLB.
  *
  * @entry:     Address of TLB slot.
  *
- * Free a wired (locked-in) entry in the DTLB.
- *
  * Works like a stack, last one to allocate must be first one to free.
  */
 int sh64_put_wired_dtlb_entry(unsigned long long entry)
@@ -115,7 +107,7 @@ int sh64_put_wired_dtlb_entry(unsigned long long entry)
 }
 
 /**
- * sh64_setup_tlb_slot
+ * sh64_setup_tlb_slot - Load up a translation in a wired slot.
  *
  * @config_addr:       Address of TLB slot.
  * @eaddr:             Virtual address.
@@ -154,7 +146,7 @@ inline void sh64_setup_tlb_slot(unsigned long long config_addr,
 }
 
 /**
- * sh64_teardown_tlb_slot
+ * sh64_teardown_tlb_slot - Teardown a translation.
  *
  * @config_addr:       Address of TLB slot.
  *
index d837893..47f9583 100644 (file)
@@ -59,7 +59,7 @@ static inline int futex_atomic_op_inuser(int encoded_op, int __user *uaddr)
                __futex_cas_op("or\t%2, %4, %1", ret, oldval, uaddr, oparg);
                break;
        case FUTEX_OP_ANDN:
-               __futex_cas_op("and\t%2, %4, %1", ret, oldval, uaddr, oparg);
+               __futex_cas_op("andn\t%2, %4, %1", ret, oldval, uaddr, oparg);
                break;
        case FUTEX_OP_XOR:
                __futex_cas_op("xor\t%2, %4, %1", ret, oldval, uaddr, oparg);
index 0bb9bf5..3473e25 100644 (file)
@@ -90,4 +90,7 @@ static inline unsigned long get_softint(void)
        return retval;
 }
 
+void __trigger_all_cpu_backtrace(void);
+#define trigger_all_cpu_backtrace() __trigger_all_cpu_backtrace()
+
 #endif
index aa69977..93a262c 100644 (file)
@@ -1,8 +1,24 @@
 #ifndef ___ASM_SPARC_OF_PLATFORM_H
 #define ___ASM_SPARC_OF_PLATFORM_H
-#if defined(__sparc__) && defined(__arch64__)
-#include <asm/of_platform_64.h>
-#else
-#include <asm/of_platform_32.h>
-#endif
+/*
+ *    Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
+ *                      <benh@kernel.crashing.org>
+ *    Modified for Sparc by merging parts of asm/of_device.h
+ *             by Stephen Rothwell
+ *
+ *  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 is just here during the transition */
+#include <linux/of_platform.h>
+
+extern struct bus_type ebus_bus_type;
+extern struct bus_type sbus_bus_type;
+
+#define of_bus_type    of_platform_bus_type    /* for compatibility */
+
 #endif
diff --git a/arch/sparc/include/asm/of_platform_32.h b/arch/sparc/include/asm/of_platform_32.h
deleted file mode 100644 (file)
index 723f7c9..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef _ASM_SPARC_OF_PLATFORM_H
-#define _ASM_SPARC_OF_PLATFORM_H
-/*
- *    Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
- *                      <benh@kernel.crashing.org>
- *    Modified for Sparc by merging parts of asm/of_device.h
- *             by Stephen Rothwell
- *
- *  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 is just here during the transition */
-#include <linux/of_platform.h>
-
-extern struct bus_type ebus_bus_type;
-extern struct bus_type sbus_bus_type;
-
-#define of_bus_type    of_platform_bus_type    /* for compatibility */
-
-#endif /* _ASM_SPARC_OF_PLATFORM_H */
diff --git a/arch/sparc/include/asm/of_platform_64.h b/arch/sparc/include/asm/of_platform_64.h
deleted file mode 100644 (file)
index 4f66a5f..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef _ASM_SPARC64_OF_PLATFORM_H
-#define _ASM_SPARC64_OF_PLATFORM_H
-/*
- *    Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
- *                      <benh@kernel.crashing.org>
- *    Modified for Sparc by merging parts of asm/of_device.h
- *             by Stephen Rothwell
- *
- *  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 is just here during the transition */
-#include <linux/of_platform.h>
-
-extern struct bus_type isa_bus_type;
-extern struct bus_type ebus_bus_type;
-extern struct bus_type sbus_bus_type;
-
-#define of_bus_type    of_platform_bus_type    /* for compatibility */
-
-#endif /* _ASM_SPARC64_OF_PLATFORM_H */
index d43c88b..d409c4f 100644 (file)
@@ -40,16 +40,6 @@ struct pt_regs {
 #define UREG_FP        UREG_I6
 #define UREG_RETPC     UREG_I7
 
-static inline bool pt_regs_is_syscall(struct pt_regs *regs)
-{
-       return (regs->psr & PSR_SYSCALL);
-}
-
-static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
-{
-       return (regs->psr &= ~PSR_SYSCALL);
-}
-
 /* A register window */
 struct reg_window {
        unsigned long locals[8];
@@ -72,6 +62,16 @@ struct sparc_stackf {
 
 #ifdef __KERNEL__
 
+static inline bool pt_regs_is_syscall(struct pt_regs *regs)
+{
+       return (regs->psr & PSR_SYSCALL);
+}
+
+static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
+{
+       return (regs->psr &= ~PSR_SYSCALL);
+}
+
 #define user_mode(regs) (!((regs)->psr & PSR_PS))
 #define instruction_pointer(regs) ((regs)->pc)
 #define user_stack_pointer(regs) ((regs)->u_regs[UREG_FP])
index ec6d45c..06e4914 100644 (file)
@@ -37,21 +37,6 @@ struct pt_regs {
        unsigned int magic;
 };
 
-static inline int pt_regs_trap_type(struct pt_regs *regs)
-{
-       return regs->magic & 0x1ff;
-}
-
-static inline bool pt_regs_is_syscall(struct pt_regs *regs)
-{
-       return (regs->tstate & TSTATE_SYSCALL);
-}
-
-static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
-{
-       return (regs->tstate &= ~TSTATE_SYSCALL);
-}
-
 struct pt_regs32 {
        unsigned int psr;
        unsigned int pc;
@@ -128,15 +113,30 @@ struct sparc_trapf {
 
 #ifdef __KERNEL__
 
+static inline int pt_regs_trap_type(struct pt_regs *regs)
+{
+       return regs->magic & 0x1ff;
+}
+
+static inline bool pt_regs_is_syscall(struct pt_regs *regs)
+{
+       return (regs->tstate & TSTATE_SYSCALL);
+}
+
+static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
+{
+       return (regs->tstate &= ~TSTATE_SYSCALL);
+}
+
 struct global_reg_snapshot {
        unsigned long           tstate;
        unsigned long           tpc;
        unsigned long           tnpc;
        unsigned long           o7;
        unsigned long           i7;
+       unsigned long           rpc;
        struct thread_info      *thread;
        unsigned long           pad1;
-       unsigned long           pad2;
 };
 
 #define __ARCH_WANT_COMPAT_SYS_PTRACE
@@ -154,7 +154,6 @@ extern unsigned long profile_pc(struct pt_regs *);
 #define profile_pc(regs) instruction_pointer(regs)
 #endif
 extern void show_regs(struct pt_regs *);
-extern void __show_regs(struct pt_regs *);
 #endif
 
 #else /* __ASSEMBLY__ */
@@ -315,9 +314,9 @@ extern void __show_regs(struct pt_regs *);
 #define GR_SNAP_TNPC   0x10
 #define GR_SNAP_O7     0x18
 #define GR_SNAP_I7     0x20
-#define GR_SNAP_THREAD 0x28
-#define GR_SNAP_PAD1   0x30
-#define GR_SNAP_PAD2   0x38
+#define GR_SNAP_RPC    0x28
+#define GR_SNAP_THREAD 0x30
+#define GR_SNAP_PAD1   0x38
 
 #endif  /*  __KERNEL__  */
 
index c481673..ba43d85 100644 (file)
@@ -915,12 +915,18 @@ static void __init sun4v_init_mondo_queues(void)
                alloc_one_mondo(&tb->nonresum_mondo_pa, tb->nonresum_qmask);
                alloc_one_kbuf(&tb->nonresum_kernel_buf_pa,
                               tb->nonresum_qmask);
+       }
+}
+
+static void __init init_send_mondo_info(void)
+{
+       int cpu;
+
+       for_each_possible_cpu(cpu) {
+               struct trap_per_cpu *tb = &trap_block[cpu];
 
                init_cpu_send_mondo_info(tb);
        }
-
-       /* Load up the boot cpu's entries.  */
-       sun4v_register_mondo_queues(hard_smp_processor_id());
 }
 
 static struct irqaction timer_irq_action = {
@@ -949,6 +955,13 @@ void __init init_IRQ(void)
        if (tlb_type == hypervisor)
                sun4v_init_mondo_queues();
 
+       init_send_mondo_info();
+
+       if (tlb_type == hypervisor) {
+               /* Load up the boot cpu's entries.  */
+               sun4v_register_mondo_queues(hard_smp_processor_id());
+       }
+
        /* We need to clear any IRQ's pending in the soft interrupt
         * registers, a spurious one could be left around from the
         * PROM timer which we just disabled.
index 4fd48ab..f8b50cb 100644 (file)
@@ -56,9 +56,6 @@ struct of_device *of_find_device_by_node(struct device_node *dp)
 EXPORT_SYMBOL(of_find_device_by_node);
 
 #ifdef CONFIG_PCI
-struct bus_type isa_bus_type;
-EXPORT_SYMBOL(isa_bus_type);
-
 struct bus_type ebus_bus_type;
 EXPORT_SYMBOL(ebus_bus_type);
 #endif
@@ -841,8 +838,6 @@ static int __init of_bus_driver_init(void)
 
        err = of_bus_type_init(&of_platform_bus_type, "of");
 #ifdef CONFIG_PCI
-       if (!err)
-               err = of_bus_type_init(&isa_bus_type, "isa");
        if (!err)
                err = of_bus_type_init(&ebus_bus_type, "ebus");
 #endif
index 8a9cd3e..7f5debd 100644 (file)
@@ -52,8 +52,6 @@
 #include <asm/irq_regs.h>
 #include <asm/smp.h>
 
-/* #define VERBOSE_SHOWREGS */
-
 static void sparc64_yield(int cpu)
 {
        if (tlb_type != hypervisor)
@@ -213,22 +211,8 @@ static void show_regwindow(struct pt_regs *regs)
                printk("I7: <%pS>\n", (void *) rwk->ins[7]);
 }
 
-#ifdef CONFIG_SMP
-static DEFINE_SPINLOCK(regdump_lock);
-#endif
-
-void __show_regs(struct pt_regs * regs)
+void show_regs(struct pt_regs *regs)
 {
-#ifdef CONFIG_SMP
-       unsigned long flags;
-
-       /* Protect against xcall ipis which might lead to livelock on the lock */
-       __asm__ __volatile__("rdpr      %%pstate, %0\n\t"
-                            "wrpr      %0, %1, %%pstate"
-                            : "=r" (flags)
-                            : "i" (PSTATE_IE));
-       spin_lock(&regdump_lock);
-#endif
        printk("TSTATE: %016lx TPC: %016lx TNPC: %016lx Y: %08x    %s\n", regs->tstate,
               regs->tpc, regs->tnpc, regs->y, print_tainted());
        printk("TPC: <%pS>\n", (void *) regs->tpc);
@@ -246,64 +230,24 @@ void __show_regs(struct pt_regs * regs)
               regs->u_regs[15]);
        printk("RPC: <%pS>\n", (void *) regs->u_regs[15]);
        show_regwindow(regs);
-#ifdef CONFIG_SMP
-       spin_unlock(&regdump_lock);
-       __asm__ __volatile__("wrpr      %0, 0, %%pstate"
-                            : : "r" (flags));
-#endif
 }
 
-#ifdef VERBOSE_SHOWREGS
-static void idump_from_user (unsigned int *pc)
-{
-       int i;
-       int code;
-       
-       if((((unsigned long) pc) & 3))
-               return;
-       
-       pc -= 3;
-       for(i = -3; i < 6; i++) {
-               get_user(code, pc);
-               printk("%c%08x%c",i?' ':'<',code,i?' ':'>');
-               pc++;
-       }
-       printk("\n");
-}
-#endif
+struct global_reg_snapshot global_reg_snapshot[NR_CPUS];
+static DEFINE_SPINLOCK(global_reg_snapshot_lock);
 
-void show_regs(struct pt_regs *regs)
+static bool kstack_valid(struct thread_info *tp, struct reg_window *rw)
 {
-#ifdef VERBOSE_SHOWREGS
-       extern long etrap, etraptl1;
-#endif
-       __show_regs(regs);
-#if 0
-#ifdef CONFIG_SMP
-       {
-               extern void smp_report_regs(void);
+       unsigned long thread_base, fp;
 
-               smp_report_regs();
-       }
-#endif
-#endif
+       thread_base = (unsigned long) tp;
+       fp = (unsigned long) rw;
 
-#ifdef VERBOSE_SHOWREGS        
-       if (regs->tpc >= &etrap && regs->tpc < &etraptl1 &&
-           regs->u_regs[14] >= (long)current - PAGE_SIZE &&
-           regs->u_regs[14] < (long)current + 6 * PAGE_SIZE) {
-               printk ("*********parent**********\n");
-               __show_regs((struct pt_regs *)(regs->u_regs[14] + PTREGS_OFF));
-               idump_from_user(((struct pt_regs *)(regs->u_regs[14] + PTREGS_OFF))->tpc);
-               printk ("*********endpar**********\n");
-       }
-#endif
+       if (fp < (thread_base + sizeof(struct thread_info)) ||
+           fp >= (thread_base + THREAD_SIZE))
+               return false;
+       return true;
 }
 
-#ifdef CONFIG_MAGIC_SYSRQ
-struct global_reg_snapshot global_reg_snapshot[NR_CPUS];
-static DEFINE_SPINLOCK(global_reg_snapshot_lock);
-
 static void __global_reg_self(struct thread_info *tp, struct pt_regs *regs,
                              int this_cpu)
 {
@@ -315,14 +259,22 @@ static void __global_reg_self(struct thread_info *tp, struct pt_regs *regs,
        global_reg_snapshot[this_cpu].o7 = regs->u_regs[UREG_I7];
 
        if (regs->tstate & TSTATE_PRIV) {
+               struct thread_info *tp = current_thread_info();
                struct reg_window *rw;
 
                rw = (struct reg_window *)
                        (regs->u_regs[UREG_FP] + STACK_BIAS);
-               global_reg_snapshot[this_cpu].i7 = rw->ins[6];
-       } else
+               if (kstack_valid(tp, rw)) {
+                       global_reg_snapshot[this_cpu].i7 = rw->ins[7];
+                       rw = (struct reg_window *)
+                               (rw->ins[6] + STACK_BIAS);
+                       if (kstack_valid(tp, rw))
+                               global_reg_snapshot[this_cpu].rpc = rw->ins[7];
+               }
+       } else {
                global_reg_snapshot[this_cpu].i7 = 0;
-
+               global_reg_snapshot[this_cpu].rpc = 0;
+       }
        global_reg_snapshot[this_cpu].thread = tp;
 }
 
@@ -341,7 +293,7 @@ static void __global_reg_poll(struct global_reg_snapshot *gp)
        }
 }
 
-static void sysrq_handle_globreg(int key, struct tty_struct *tty)
+void __trigger_all_cpu_backtrace(void)
 {
        struct thread_info *tp = current_thread_info();
        struct pt_regs *regs = get_irq_regs();
@@ -375,13 +327,14 @@ static void sysrq_handle_globreg(int key, struct tty_struct *tty)
                       ((tp && tp->task) ? tp->task->pid : -1));
 
                if (gp->tstate & TSTATE_PRIV) {
-                       printk("             TPC[%pS] O7[%pS] I7[%pS]\n",
+                       printk("             TPC[%pS] O7[%pS] I7[%pS] RPC[%pS]\n",
                               (void *) gp->tpc,
                               (void *) gp->o7,
-                              (void *) gp->i7);
+                              (void *) gp->i7,
+                              (void *) gp->rpc);
                } else {
-                       printk("             TPC[%lx] O7[%lx] I7[%lx]\n",
-                              gp->tpc, gp->o7, gp->i7);
+                       printk("             TPC[%lx] O7[%lx] I7[%lx] RPC[%lx]\n",
+                              gp->tpc, gp->o7, gp->i7, gp->rpc);
                }
        }
 
@@ -390,6 +343,13 @@ static void sysrq_handle_globreg(int key, struct tty_struct *tty)
        spin_unlock_irqrestore(&global_reg_snapshot_lock, flags);
 }
 
+#ifdef CONFIG_MAGIC_SYSRQ
+
+static void sysrq_handle_globreg(int key, struct tty_struct *tty)
+{
+       __trigger_all_cpu_backtrace();
+}
+
 static struct sysrq_key_op sparc_globalreg_op = {
        .handler        = sysrq_handle_globreg,
        .help_msg       = "Globalregs",
index d1b8445..ec82d76 100644 (file)
@@ -2,7 +2,7 @@
  *  arch/sparc64/kernel/signal.c
  *
  *  Copyright (C) 1991, 1992  Linus Torvalds
- *  Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
+ *  Copyright (C) 1995, 2008 David S. Miller (davem@davemloft.net)
  *  Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx)
  *  Copyright (C) 1997 Eddie C. Dost   (ecd@skynet.be)
  *  Copyright (C) 1997,1998 Jakub Jelinek   (jj@sunsite.mff.cuni.cz)
@@ -23,7 +23,6 @@
 #include <linux/tty.h>
 #include <linux/binfmts.h>
 #include <linux/bitops.h>
-#include <linux/tracehook.h>
 
 #include <asm/uaccess.h>
 #include <asm/ptrace.h>
@@ -91,7 +90,9 @@ asmlinkage void sparc64_set_context(struct pt_regs *regs)
        err |= __get_user(regs->u_regs[UREG_G4], (&(*grp)[MC_G4]));
        err |= __get_user(regs->u_regs[UREG_G5], (&(*grp)[MC_G5]));
        err |= __get_user(regs->u_regs[UREG_G6], (&(*grp)[MC_G6]));
-       err |= __get_user(regs->u_regs[UREG_G7], (&(*grp)[MC_G7]));
+
+       /* Skip %g7 as that's the thread register in userspace.  */
+
        err |= __get_user(regs->u_regs[UREG_I0], (&(*grp)[MC_O0]));
        err |= __get_user(regs->u_regs[UREG_I1], (&(*grp)[MC_O1]));
        err |= __get_user(regs->u_regs[UREG_I2], (&(*grp)[MC_O2]));
index 7cf72b4..27b8177 100644 (file)
@@ -459,27 +459,35 @@ again:
        }
 }
 
-static inline void spitfire_xcall_deliver(u64 data0, u64 data1, u64 data2, cpumask_t mask)
+static void spitfire_xcall_deliver(struct trap_per_cpu *tb, int cnt)
 {
+       u64 *mondo, data0, data1, data2;
+       u16 *cpu_list;
        u64 pstate;
        int i;
 
        __asm__ __volatile__("rdpr %%pstate, %0" : "=r" (pstate));
-       for_each_cpu_mask(i, mask)
-               spitfire_xcall_helper(data0, data1, data2, pstate, i);
+       cpu_list = __va(tb->cpu_list_pa);
+       mondo = __va(tb->cpu_mondo_block_pa);
+       data0 = mondo[0];
+       data1 = mondo[1];
+       data2 = mondo[2];
+       for (i = 0; i < cnt; i++)
+               spitfire_xcall_helper(data0, data1, data2, pstate, cpu_list[i]);
 }
 
 /* Cheetah now allows to send the whole 64-bytes of data in the interrupt
  * packet, but we have no use for that.  However we do take advantage of
  * the new pipelining feature (ie. dispatch to multiple cpus simultaneously).
  */
-static void cheetah_xcall_deliver(u64 data0, u64 data1, u64 data2, cpumask_t mask)
+static void cheetah_xcall_deliver(struct trap_per_cpu *tb, int cnt)
 {
-       u64 pstate, ver, busy_mask;
        int nack_busy_id, is_jbus, need_more;
+       u64 *mondo, pstate, ver, busy_mask;
+       u16 *cpu_list;
 
-       if (cpus_empty(mask))
-               return;
+       cpu_list = __va(tb->cpu_list_pa);
+       mondo = __va(tb->cpu_mondo_block_pa);
 
        /* Unfortunately, someone at Sun had the brilliant idea to make the
         * busy/nack fields hard-coded by ITID number for this Ultra-III
@@ -502,7 +510,7 @@ retry:
                             "stxa      %2, [%5] %6\n\t"
                             "membar    #Sync\n\t"
                             : /* no outputs */
-                            : "r" (data0), "r" (data1), "r" (data2),
+                            : "r" (mondo[0]), "r" (mondo[1]), "r" (mondo[2]),
                               "r" (0x40), "r" (0x50), "r" (0x60),
                               "i" (ASI_INTR_W));
 
@@ -511,11 +519,16 @@ retry:
        {
                int i;
 
-               for_each_cpu_mask(i, mask) {
-                       u64 target = (i << 14) | 0x70;
+               for (i = 0; i < cnt; i++) {
+                       u64 target, nr;
 
+                       nr = cpu_list[i];
+                       if (nr == 0xffff)
+                               continue;
+
+                       target = (nr << 14) | 0x70;
                        if (is_jbus) {
-                               busy_mask |= (0x1UL << (i * 2));
+                               busy_mask |= (0x1UL << (nr * 2));
                        } else {
                                target |= (nack_busy_id << 24);
                                busy_mask |= (0x1UL <<
@@ -549,11 +562,13 @@ retry:
                                __asm__ __volatile__("wrpr %0, 0x0, %%pstate"
                                                     : : "r" (pstate));
                                if (unlikely(need_more)) {
-                                       int i, cnt = 0;
-                                       for_each_cpu_mask(i, mask) {
-                                               cpu_clear(i, mask);
-                                               cnt++;
-                                               if (cnt == 32)
+                                       int i, this_cnt = 0;
+                                       for (i = 0; i < cnt; i++) {
+                                               if (cpu_list[i] == 0xffff)
+                                                       continue;
+                                               cpu_list[i] = 0xffff;
+                                               this_cnt++;
+                                               if (this_cnt == 32)
                                                        break;
                                        }
                                        goto retry;
@@ -584,16 +599,20 @@ retry:
                        /* Clear out the mask bits for cpus which did not
                         * NACK us.
                         */
-                       for_each_cpu_mask(i, mask) {
-                               u64 check_mask;
+                       for (i = 0; i < cnt; i++) {
+                               u64 check_mask, nr;
+
+                               nr = cpu_list[i];
+                               if (nr == 0xffff)
+                                       continue;
 
                                if (is_jbus)
-                                       check_mask = (0x2UL << (2*i));
+                                       check_mask = (0x2UL << (2*nr));
                                else
                                        check_mask = (0x2UL <<
                                                      this_busy_nack);
                                if ((dispatch_stat & check_mask) == 0)
-                                       cpu_clear(i, mask);
+                                       cpu_list[i] = 0xffff;
                                this_busy_nack += 2;
                                if (this_busy_nack == 64)
                                        break;
@@ -605,47 +624,17 @@ retry:
 }
 
 /* Multi-cpu list version.  */
-static void hypervisor_xcall_deliver(u64 data0, u64 data1, u64 data2, cpumask_t mask)
+static void hypervisor_xcall_deliver(struct trap_per_cpu *tb, int cnt)
 {
-       struct trap_per_cpu *tb;
+       int retries, this_cpu, prev_sent, i, saw_cpu_error;
+       unsigned long status;
        u16 *cpu_list;
-       u64 *mondo;
-       cpumask_t error_mask;
-       unsigned long flags, status;
-       int cnt, retries, this_cpu, prev_sent, i;
-
-       if (cpus_empty(mask))
-               return;
-
-       /* We have to do this whole thing with interrupts fully disabled.
-        * Otherwise if we send an xcall from interrupt context it will
-        * corrupt both our mondo block and cpu list state.
-        *
-        * One consequence of this is that we cannot use timeout mechanisms
-        * that depend upon interrupts being delivered locally.  So, for
-        * example, we cannot sample jiffies and expect it to advance.
-        *
-        * Fortunately, udelay() uses %stick/%tick so we can use that.
-        */
-       local_irq_save(flags);
 
        this_cpu = smp_processor_id();
-       tb = &trap_block[this_cpu];
-
-       mondo = __va(tb->cpu_mondo_block_pa);
-       mondo[0] = data0;
-       mondo[1] = data1;
-       mondo[2] = data2;
-       wmb();
 
        cpu_list = __va(tb->cpu_list_pa);
 
-       /* Setup the initial cpu list.  */
-       cnt = 0;
-       for_each_cpu_mask(i, mask)
-               cpu_list[cnt++] = i;
-
-       cpus_clear(error_mask);
+       saw_cpu_error = 0;
        retries = 0;
        prev_sent = 0;
        do {
@@ -690,10 +679,9 @@ static void hypervisor_xcall_deliver(u64 data0, u64 data1, u64 data2, cpumask_t
                                        continue;
 
                                err = sun4v_cpu_state(cpu);
-                               if (err >= 0 &&
-                                   err == HV_CPU_STATE_ERROR) {
+                               if (err == HV_CPU_STATE_ERROR) {
+                                       saw_cpu_error = (cpu + 1);
                                        cpu_list[i] = 0xffff;
-                                       cpu_set(cpu, error_mask);
                                }
                        }
                } else if (unlikely(status != HV_EWOULDBLOCK))
@@ -717,32 +705,24 @@ static void hypervisor_xcall_deliver(u64 data0, u64 data1, u64 data2, cpumask_t
                }
        } while (1);
 
-       local_irq_restore(flags);
-
-       if (unlikely(!cpus_empty(error_mask)))
+       if (unlikely(saw_cpu_error))
                goto fatal_mondo_cpu_error;
 
        return;
 
 fatal_mondo_cpu_error:
        printk(KERN_CRIT "CPU[%d]: SUN4V mondo cpu error, some target cpus "
-              "were in error state\n",
-              this_cpu);
-       printk(KERN_CRIT "CPU[%d]: Error mask [ ", this_cpu);
-       for_each_cpu_mask(i, error_mask)
-               printk("%d ", i);
-       printk("]\n");
+              "(including %d) were in error state\n",
+              this_cpu, saw_cpu_error - 1);
        return;
 
 fatal_mondo_timeout:
-       local_irq_restore(flags);
        printk(KERN_CRIT "CPU[%d]: SUN4V mondo timeout, no forward "
               " progress after %d retries.\n",
               this_cpu, retries);
        goto dump_cpu_list_and_out;
 
 fatal_mondo_error:
-       local_irq_restore(flags);
        printk(KERN_CRIT "CPU[%d]: Unexpected SUN4V mondo error %lu\n",
               this_cpu, status);
        printk(KERN_CRIT "CPU[%d]: Args were cnt(%d) cpulist_pa(%lx) "
@@ -756,58 +736,93 @@ dump_cpu_list_and_out:
        printk("]\n");
 }
 
-/* Send cross call to all processors mentioned in MASK
- * except self.
+static void (*xcall_deliver_impl)(struct trap_per_cpu *, int);
+
+static void xcall_deliver(u64 data0, u64 data1, u64 data2, const cpumask_t *mask)
+{
+       struct trap_per_cpu *tb;
+       int this_cpu, i, cnt;
+       unsigned long flags;
+       u16 *cpu_list;
+       u64 *mondo;
+
+       /* We have to do this whole thing with interrupts fully disabled.
+        * Otherwise if we send an xcall from interrupt context it will
+        * corrupt both our mondo block and cpu list state.
+        *
+        * One consequence of this is that we cannot use timeout mechanisms
+        * that depend upon interrupts being delivered locally.  So, for
+        * example, we cannot sample jiffies and expect it to advance.
+        *
+        * Fortunately, udelay() uses %stick/%tick so we can use that.
+        */
+       local_irq_save(flags);
+
+       this_cpu = smp_processor_id();
+       tb = &trap_block[this_cpu];
+
+       mondo = __va(tb->cpu_mondo_block_pa);
+       mondo[0] = data0;
+       mondo[1] = data1;
+       mondo[2] = data2;
+       wmb();
+
+       cpu_list = __va(tb->cpu_list_pa);
+
+       /* Setup the initial cpu list.  */
+       cnt = 0;
+       for_each_cpu_mask_nr(i, *mask) {
+               if (i == this_cpu || !cpu_online(i))
+                       continue;
+               cpu_list[cnt++] = i;
+       }
+
+       if (cnt)
+               xcall_deliver_impl(tb, cnt);
+
+       local_irq_restore(flags);
+}
+
+/* Send cross call to all processors mentioned in MASK_P
+ * except self.  Really, there are only two cases currently,
+ * "&cpu_online_map" and "&mm->cpu_vm_mask".
  */
-static void smp_cross_call_masked(unsigned long *func, u32 ctx, u64 data1, u64 data2, cpumask_t mask)
+static void smp_cross_call_masked(unsigned long *func, u32 ctx, u64 data1, u64 data2, const cpumask_t *mask)
 {
        u64 data0 = (((u64)ctx)<<32 | (((u64)func) & 0xffffffff));
-       int this_cpu = get_cpu();
-
-       cpus_and(mask, mask, cpu_online_map);
-       cpu_clear(this_cpu, mask);
 
-       if (tlb_type == spitfire)
-               spitfire_xcall_deliver(data0, data1, data2, mask);
-       else if (tlb_type == cheetah || tlb_type == cheetah_plus)
-               cheetah_xcall_deliver(data0, data1, data2, mask);
-       else
-               hypervisor_xcall_deliver(data0, data1, data2, mask);
-       /* NOTE: Caller runs local copy on master. */
+       xcall_deliver(data0, data1, data2, mask);
+}
 
-       put_cpu();
+/* Send cross call to all processors except self. */
+static void smp_cross_call(unsigned long *func, u32 ctx, u64 data1, u64 data2)
+{
+       smp_cross_call_masked(func, ctx, data1, data2, &cpu_online_map);
 }
 
 extern unsigned long xcall_sync_tick;
 
 static void smp_start_sync_tick_client(int cpu)
 {
-       cpumask_t mask = cpumask_of_cpu(cpu);
-
-       smp_cross_call_masked(&xcall_sync_tick,
-                             0, 0, 0, mask);
+       xcall_deliver((u64) &xcall_sync_tick, 0, 0,
+                     &cpumask_of_cpu(cpu));
 }
 
 extern unsigned long xcall_call_function;
 
 void arch_send_call_function_ipi(cpumask_t mask)
 {
-       smp_cross_call_masked(&xcall_call_function, 0, 0, 0, mask);
+       xcall_deliver((u64) &xcall_call_function, 0, 0, &mask);
 }
 
 extern unsigned long xcall_call_function_single;
 
 void arch_send_call_function_single_ipi(int cpu)
 {
-       cpumask_t mask = cpumask_of_cpu(cpu);
-
-       smp_cross_call_masked(&xcall_call_function_single, 0, 0, 0, mask);
+       xcall_deliver((u64) &xcall_call_function_single, 0, 0,
+                     &cpumask_of_cpu(cpu));
 }
 
-/* Send cross call to all processors except self. */
-#define smp_cross_call(func, ctx, data1, data2) \
-       smp_cross_call_masked(func, ctx, data1, data2, cpu_online_map)
-
 void smp_call_function_client(int irq, struct pt_regs *regs)
 {
        clear_softint(1 << irq);
@@ -843,7 +858,6 @@ void smp_tsb_sync(struct mm_struct *mm)
 extern unsigned long xcall_flush_tlb_mm;
 extern unsigned long xcall_flush_tlb_pending;
 extern unsigned long xcall_flush_tlb_kernel_range;
-extern unsigned long xcall_report_regs;
 #ifdef CONFIG_MAGIC_SYSRQ
 extern unsigned long xcall_fetch_glob_regs;
 #endif
@@ -878,7 +892,6 @@ static inline void __local_flush_dcache_page(struct page *page)
 
 void smp_flush_dcache_page_impl(struct page *page, int cpu)
 {
-       cpumask_t mask = cpumask_of_cpu(cpu);
        int this_cpu;
 
        if (tlb_type == hypervisor)
@@ -894,29 +907,24 @@ void smp_flush_dcache_page_impl(struct page *page, int cpu)
                __local_flush_dcache_page(page);
        } else if (cpu_online(cpu)) {
                void *pg_addr = page_address(page);
-               u64 data0;
+               u64 data0 = 0;
 
                if (tlb_type == spitfire) {
-                       data0 =
-                               ((u64)&xcall_flush_dcache_page_spitfire);
+                       data0 = ((u64)&xcall_flush_dcache_page_spitfire);
                        if (page_mapping(page) != NULL)
                                data0 |= ((u64)1 << 32);
-                       spitfire_xcall_deliver(data0,
-                                              __pa(pg_addr),
-                                              (u64) pg_addr,
-                                              mask);
                } else if (tlb_type == cheetah || tlb_type == cheetah_plus) {
 #ifdef DCACHE_ALIASING_POSSIBLE
-                       data0 =
-                               ((u64)&xcall_flush_dcache_page_cheetah);
-                       cheetah_xcall_deliver(data0,
-                                             __pa(pg_addr),
-                                             0, mask);
+                       data0 = ((u64)&xcall_flush_dcache_page_cheetah);
 #endif
                }
+               if (data0) {
+                       xcall_deliver(data0, __pa(pg_addr),
+                                     (u64) pg_addr, &cpumask_of_cpu(cpu));
 #ifdef CONFIG_DEBUG_DCFLUSH
-               atomic_inc(&dcpage_flushes_xcall);
+                       atomic_inc(&dcpage_flushes_xcall);
 #endif
+               }
        }
 
        put_cpu();
@@ -924,66 +932,41 @@ void smp_flush_dcache_page_impl(struct page *page, int cpu)
 
 void flush_dcache_page_all(struct mm_struct *mm, struct page *page)
 {
-       void *pg_addr = page_address(page);
-       cpumask_t mask = cpu_online_map;
-       u64 data0;
+       void *pg_addr;
        int this_cpu;
+       u64 data0;
 
        if (tlb_type == hypervisor)
                return;
 
        this_cpu = get_cpu();
 
-       cpu_clear(this_cpu, mask);
-
 #ifdef CONFIG_DEBUG_DCFLUSH
        atomic_inc(&dcpage_flushes);
 #endif
-       if (cpus_empty(mask))
-               goto flush_self;
+       data0 = 0;
+       pg_addr = page_address(page);
        if (tlb_type == spitfire) {
                data0 = ((u64)&xcall_flush_dcache_page_spitfire);
                if (page_mapping(page) != NULL)
                        data0 |= ((u64)1 << 32);
-               spitfire_xcall_deliver(data0,
-                                      __pa(pg_addr),
-                                      (u64) pg_addr,
-                                      mask);
        } else if (tlb_type == cheetah || tlb_type == cheetah_plus) {
 #ifdef DCACHE_ALIASING_POSSIBLE
                data0 = ((u64)&xcall_flush_dcache_page_cheetah);
-               cheetah_xcall_deliver(data0,
-                                     __pa(pg_addr),
-                                     0, mask);
 #endif
        }
+       if (data0) {
+               xcall_deliver(data0, __pa(pg_addr),
+                             (u64) pg_addr, &cpu_online_map);
 #ifdef CONFIG_DEBUG_DCFLUSH
-       atomic_inc(&dcpage_flushes_xcall);
+               atomic_inc(&dcpage_flushes_xcall);
 #endif
- flush_self:
+       }
        __local_flush_dcache_page(page);
 
        put_cpu();
 }
 
-static void __smp_receive_signal_mask(cpumask_t mask)
-{
-       smp_cross_call_masked(&xcall_receive_signal, 0, 0, 0, mask);
-}
-
-void smp_receive_signal(int cpu)
-{
-       cpumask_t mask = cpumask_of_cpu(cpu);
-
-       if (cpu_online(cpu))
-               __smp_receive_signal_mask(mask);
-}
-
-void smp_receive_signal_client(int irq, struct pt_regs *regs)
-{
-       clear_softint(1 << irq);
-}
-
 void smp_new_mmu_context_version_client(int irq, struct pt_regs *regs)
 {
        struct mm_struct *mm;
@@ -1022,11 +1005,6 @@ void kgdb_roundup_cpus(unsigned long flags)
 }
 #endif
 
-void smp_report_regs(void)
-{
-       smp_cross_call(&xcall_report_regs, 0, 0, 0);
-}
-
 #ifdef CONFIG_MAGIC_SYSRQ
 void smp_fetch_global_regs(void)
 {
@@ -1089,7 +1067,7 @@ void smp_flush_tlb_mm(struct mm_struct *mm)
 
        smp_cross_call_masked(&xcall_flush_tlb_mm,
                              ctx, 0, 0,
-                             mm->cpu_vm_mask);
+                             &mm->cpu_vm_mask);
 
 local_flush_and_out:
        __flush_tlb_mm(ctx, SECONDARY_CONTEXT);
@@ -1107,7 +1085,7 @@ void smp_flush_tlb_pending(struct mm_struct *mm, unsigned long nr, unsigned long
        else
                smp_cross_call_masked(&xcall_flush_tlb_pending,
                                      ctx, nr, (unsigned long) vaddrs,
-                                     mm->cpu_vm_mask);
+                                     &mm->cpu_vm_mask);
 
        __flush_tlb_pending(ctx, nr, vaddrs);
 
@@ -1208,6 +1186,16 @@ void __devinit smp_prepare_boot_cpu(void)
 {
 }
 
+void __init smp_setup_processor_id(void)
+{
+       if (tlb_type == spitfire)
+               xcall_deliver_impl = spitfire_xcall_deliver;
+       else if (tlb_type == cheetah || tlb_type == cheetah_plus)
+               xcall_deliver_impl = cheetah_xcall_deliver;
+       else
+               xcall_deliver_impl = hypervisor_xcall_deliver;
+}
+
 void __devinit smp_fill_in_sib_core_maps(void)
 {
        unsigned int i;
@@ -1376,7 +1364,13 @@ void __init smp_cpus_done(unsigned int max_cpus)
 
 void smp_send_reschedule(int cpu)
 {
-       smp_receive_signal(cpu);
+       xcall_deliver((u64) &xcall_receive_signal, 0, 0,
+                     &cpumask_of_cpu(cpu));
+}
+
+void smp_receive_signal_client(int irq, struct pt_regs *regs)
+{
+       clear_softint(1 << irq);
 }
 
 /* This is a nop because we capture all other cpus
index 504e678..0804f71 100644 (file)
@@ -68,7 +68,6 @@ extern void *__memscan_zero(void *, size_t);
 extern void *__memscan_generic(void *, int, size_t);
 extern int __memcmp(const void *, const void *, __kernel_size_t);
 extern __kernel_size_t strlen(const char *);
-extern void show_regs(struct pt_regs *);
 extern void syscall_trace(struct pt_regs *, int);
 extern void sys_sigsuspend(void);
 extern int compat_sys_ioctl(unsigned int fd, unsigned int cmd, u32 arg);
index bd30ecb..404e856 100644 (file)
@@ -1777,7 +1777,7 @@ static void sun4v_log_error(struct pt_regs *regs, struct sun4v_error_entry *ent,
               pfx,
               ent->err_raddr, ent->err_size, ent->err_cpu);
 
-       __show_regs(regs);
+       show_regs(regs);
 
        if ((cnt = atomic_read(ocnt)) != 0) {
                atomic_set(ocnt, 0);
@@ -2177,7 +2177,6 @@ static inline struct reg_window *kernel_stack_up(struct reg_window *rw)
 void die_if_kernel(char *str, struct pt_regs *regs)
 {
        static int die_counter;
-       extern void smp_report_regs(void);
        int count = 0;
        
        /* Amuse the user. */
@@ -2190,7 +2189,7 @@ void die_if_kernel(char *str, struct pt_regs *regs)
        printk("%s(%d): %s [#%d]\n", current->comm, task_pid_nr(current), str, ++die_counter);
        notify_die(DIE_OOPS, str, regs, 0, 255, SIGSEGV);
        __asm__ __volatile__("flushw");
-       __show_regs(regs);
+       show_regs(regs);
        add_taint(TAINT_DIE);
        if (regs->tstate & TSTATE_PRIV) {
                struct reg_window *rw = (struct reg_window *)
@@ -2215,11 +2214,6 @@ void die_if_kernel(char *str, struct pt_regs *regs)
                }
                user_instruction_dump ((unsigned int __user *) regs->tpc);
        }
-#if 0
-#ifdef CONFIG_SMP
-       smp_report_regs();
-#endif
-#endif                                                 
        if (regs->tstate & TSTATE_PRIV)
                do_exit(SIGKILL);
        do_exit(SIGSEGV);
index 3547937..587f8ef 100644 (file)
@@ -1,9 +1,10 @@
 /* arch/sparc64/mm/tsb.c
  *
- * Copyright (C) 2006 David S. Miller <davem@davemloft.net>
+ * Copyright (C) 2006, 2008 David S. Miller <davem@davemloft.net>
  */
 
 #include <linux/kernel.h>
+#include <linux/preempt.h>
 #include <asm/system.h>
 #include <asm/page.h>
 #include <asm/tlbflush.h>
@@ -415,7 +416,9 @@ retry_tsb_alloc:
                tsb_context_switch(mm);
 
                /* Now force other processors to do the same.  */
+               preempt_disable();
                smp_tsb_sync(mm);
+               preempt_enable();
 
                /* Now it is safe to free the old tsb.  */
                kmem_cache_free(tsb_caches[old_cache_index], old_tsb);
index 4c8ca13..ff1dc44 100644 (file)
@@ -480,41 +480,6 @@ xcall_sync_tick:
        b               rtrap_xcall
         ldx            [%sp + PTREGS_OFF + PT_V9_TSTATE], %l1
 
-       /* NOTE: This is SPECIAL!!  We do etrap/rtrap however
-        *       we choose to deal with the "BH's run with
-        *       %pil==15" problem (described in asm/pil.h)
-        *       by just invoking rtrap directly past where
-        *       BH's are checked for.
-        *
-        *       We do it like this because we do not want %pil==15
-        *       lockups to prevent regs being reported.
-        */
-       .globl          xcall_report_regs
-xcall_report_regs:
-
-661:   rdpr            %pstate, %g2
-       wrpr            %g2, PSTATE_IG | PSTATE_AG, %pstate
-       .section        .sun4v_2insn_patch, "ax"
-       .word           661b
-       nop
-       nop
-       .previous
-
-       rdpr            %pil, %g2
-       wrpr            %g0, 15, %pil
-       sethi           %hi(109f), %g7
-       b,pt            %xcc, etrap_irq
-109:    or             %g7, %lo(109b), %g7
-#ifdef CONFIG_TRACE_IRQFLAGS
-       call            trace_hardirqs_off
-        nop
-#endif
-       call            __show_regs
-        add            %sp, PTREGS_OFF, %o0
-       /* Has to be a non-v9 branch due to the large distance. */
-       b               rtrap_xcall
-        ldx            [%sp + PTREGS_OFF + PT_V9_TSTATE], %l1
-
 #ifdef CONFIG_MAGIC_SYSRQ
        .globl          xcall_fetch_glob_regs
 xcall_fetch_glob_regs:
@@ -531,6 +496,13 @@ xcall_fetch_glob_regs:
        stx             %g7, [%g1 + GR_SNAP_TNPC]
        stx             %o7, [%g1 + GR_SNAP_O7]
        stx             %i7, [%g1 + GR_SNAP_I7]
+       /* Don't try this at home kids... */
+       rdpr            %cwp, %g2
+       sub             %g2, 1, %g7
+       wrpr            %g7, %cwp
+       mov             %i7, %g7
+       wrpr            %g2, %cwp
+       stx             %g7, [%g1 + GR_SNAP_RPC]
        sethi           %hi(trap_block), %g7
        or              %g7, %lo(trap_block), %g7
        sllx            %g2, TRAP_BLOCK_SZ_SHIFT, %g2
index 5047490..d741f35 100644 (file)
@@ -362,19 +362,7 @@ static irqreturn_t line_write_interrupt(int irq, void *data)
        if (tty == NULL)
                return IRQ_NONE;
 
-       if (test_bit(TTY_DO_WRITE_WAKEUP, &tty->flags) &&
-          (tty->ldisc.write_wakeup != NULL))
-               (tty->ldisc.write_wakeup)(tty);
-
-       /*
-        * BLOCKING mode
-        * In blocking mode, everything sleeps on tty->write_wait.
-        * Sleeping in the console driver would break non-blocking
-        * writes.
-        */
-
-       if (waitqueue_active(&tty->write_wait))
-               wake_up_interruptible(&tty->write_wait);
+       tty_wakeup(tty);
        return IRQ_HANDLED;
 }
 
index 1fa8be5..eaff0bb 100644 (file)
@@ -99,3 +99,4 @@ int is_uv_system(void)
 {
        return uv_system_type != UV_NONE;
 }
+EXPORT_SYMBOL_GPL(is_uv_system);
index 8dbffb8..87d4d69 100644 (file)
@@ -123,6 +123,14 @@ void __init pci_iommu_alloc(void)
 
        pci_swiotlb_init();
 }
+
+unsigned long iommu_num_pages(unsigned long addr, unsigned long len)
+{
+       unsigned long size = roundup((addr & ~PAGE_MASK) + len, PAGE_SIZE);
+
+       return size >> PAGE_SHIFT;
+}
+EXPORT_SYMBOL(iommu_num_pages);
 #endif
 
 /*
index b520dae..2d88858 100644 (file)
@@ -788,10 +788,6 @@ void __init setup_arch(char **cmdline_p)
 
        initmem_init(0, max_pfn);
 
-#ifdef CONFIG_X86_64
-       dma32_reserve_bootmem();
-#endif
-
 #ifdef CONFIG_ACPI_SLEEP
        /*
         * Reserve low memory region for sleep support.
@@ -806,6 +802,15 @@ void __init setup_arch(char **cmdline_p)
 #endif
        reserve_crashkernel();
 
+#ifdef CONFIG_X86_64
+       /*
+        * dma32_reserve_bootmem() allocates bootmem which may conflict
+        * with the crashkernel command line, so do that after
+        * reserve_crashkernel()
+        */
+       dma32_reserve_bootmem();
+#endif
+
        reserve_ibft_region();
 
 #ifdef CONFIG_KVM_CLOCK
index 2fa2319..0bfe2bd 100644 (file)
@@ -653,6 +653,84 @@ static void rmap_write_protect(struct kvm *kvm, u64 gfn)
        account_shadowed(kvm, gfn);
 }
 
+static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp)
+{
+       u64 *spte;
+       int need_tlb_flush = 0;
+
+       while ((spte = rmap_next(kvm, rmapp, NULL))) {
+               BUG_ON(!(*spte & PT_PRESENT_MASK));
+               rmap_printk("kvm_rmap_unmap_hva: spte %p %llx\n", spte, *spte);
+               rmap_remove(kvm, spte);
+               set_shadow_pte(spte, shadow_trap_nonpresent_pte);
+               need_tlb_flush = 1;
+       }
+       return need_tlb_flush;
+}
+
+static int kvm_handle_hva(struct kvm *kvm, unsigned long hva,
+                         int (*handler)(struct kvm *kvm, unsigned long *rmapp))
+{
+       int i;
+       int retval = 0;
+
+       /*
+        * If mmap_sem isn't taken, we can look the memslots with only
+        * the mmu_lock by skipping over the slots with userspace_addr == 0.
+        */
+       for (i = 0; i < kvm->nmemslots; i++) {
+               struct kvm_memory_slot *memslot = &kvm->memslots[i];
+               unsigned long start = memslot->userspace_addr;
+               unsigned long end;
+
+               /* mmu_lock protects userspace_addr */
+               if (!start)
+                       continue;
+
+               end = start + (memslot->npages << PAGE_SHIFT);
+               if (hva >= start && hva < end) {
+                       gfn_t gfn_offset = (hva - start) >> PAGE_SHIFT;
+                       retval |= handler(kvm, &memslot->rmap[gfn_offset]);
+                       retval |= handler(kvm,
+                                         &memslot->lpage_info[
+                                                 gfn_offset /
+                                                 KVM_PAGES_PER_HPAGE].rmap_pde);
+               }
+       }
+
+       return retval;
+}
+
+int kvm_unmap_hva(struct kvm *kvm, unsigned long hva)
+{
+       return kvm_handle_hva(kvm, hva, kvm_unmap_rmapp);
+}
+
+static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp)
+{
+       u64 *spte;
+       int young = 0;
+
+       spte = rmap_next(kvm, rmapp, NULL);
+       while (spte) {
+               int _young;
+               u64 _spte = *spte;
+               BUG_ON(!(_spte & PT_PRESENT_MASK));
+               _young = _spte & PT_ACCESSED_MASK;
+               if (_young) {
+                       young = 1;
+                       clear_bit(PT_ACCESSED_SHIFT, (unsigned long *)spte);
+               }
+               spte = rmap_next(kvm, rmapp, spte);
+       }
+       return young;
+}
+
+int kvm_age_hva(struct kvm *kvm, unsigned long hva)
+{
+       return kvm_handle_hva(kvm, hva, kvm_age_rmapp);
+}
+
 #ifdef MMU_DEBUG
 static int is_empty_shadow_page(u64 *spt)
 {
@@ -1203,6 +1281,7 @@ static int nonpaging_map(struct kvm_vcpu *vcpu, gva_t v, int write, gfn_t gfn)
        int r;
        int largepage = 0;
        pfn_t pfn;
+       unsigned long mmu_seq;
 
        down_read(&current->mm->mmap_sem);
        if (is_largepage_backed(vcpu, gfn & ~(KVM_PAGES_PER_HPAGE-1))) {
@@ -1210,6 +1289,8 @@ static int nonpaging_map(struct kvm_vcpu *vcpu, gva_t v, int write, gfn_t gfn)
                largepage = 1;
        }
 
+       mmu_seq = vcpu->kvm->mmu_notifier_seq;
+       /* implicit mb(), we'll read before PT lock is unlocked */
        pfn = gfn_to_pfn(vcpu->kvm, gfn);
        up_read(&current->mm->mmap_sem);
 
@@ -1220,6 +1301,8 @@ static int nonpaging_map(struct kvm_vcpu *vcpu, gva_t v, int write, gfn_t gfn)
        }
 
        spin_lock(&vcpu->kvm->mmu_lock);
+       if (mmu_notifier_retry(vcpu, mmu_seq))
+               goto out_unlock;
        kvm_mmu_free_some_pages(vcpu);
        r = __direct_map(vcpu, v, write, largepage, gfn, pfn,
                         PT32E_ROOT_LEVEL);
@@ -1227,6 +1310,11 @@ static int nonpaging_map(struct kvm_vcpu *vcpu, gva_t v, int write, gfn_t gfn)
 
 
        return r;
+
+out_unlock:
+       spin_unlock(&vcpu->kvm->mmu_lock);
+       kvm_release_pfn_clean(pfn);
+       return 0;
 }
 
 
@@ -1345,6 +1433,7 @@ static int tdp_page_fault(struct kvm_vcpu *vcpu, gva_t gpa,
        int r;
        int largepage = 0;
        gfn_t gfn = gpa >> PAGE_SHIFT;
+       unsigned long mmu_seq;
 
        ASSERT(vcpu);
        ASSERT(VALID_PAGE(vcpu->arch.mmu.root_hpa));
@@ -1358,6 +1447,8 @@ static int tdp_page_fault(struct kvm_vcpu *vcpu, gva_t gpa,
                gfn &= ~(KVM_PAGES_PER_HPAGE-1);
                largepage = 1;
        }
+       mmu_seq = vcpu->kvm->mmu_notifier_seq;
+       /* implicit mb(), we'll read before PT lock is unlocked */
        pfn = gfn_to_pfn(vcpu->kvm, gfn);
        up_read(&current->mm->mmap_sem);
        if (is_error_pfn(pfn)) {
@@ -1365,12 +1456,19 @@ static int tdp_page_fault(struct kvm_vcpu *vcpu, gva_t gpa,
                return 1;
        }
        spin_lock(&vcpu->kvm->mmu_lock);
+       if (mmu_notifier_retry(vcpu, mmu_seq))
+               goto out_unlock;
        kvm_mmu_free_some_pages(vcpu);
        r = __direct_map(vcpu, gpa, error_code & PFERR_WRITE_MASK,
                         largepage, gfn, pfn, kvm_x86_ops->get_tdp_level());
        spin_unlock(&vcpu->kvm->mmu_lock);
 
        return r;
+
+out_unlock:
+       spin_unlock(&vcpu->kvm->mmu_lock);
+       kvm_release_pfn_clean(pfn);
+       return 0;
 }
 
 static void nonpaging_free(struct kvm_vcpu *vcpu)
@@ -1670,6 +1768,8 @@ static void mmu_guess_page_from_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
                gfn &= ~(KVM_PAGES_PER_HPAGE-1);
                vcpu->arch.update_pte.largepage = 1;
        }
+       vcpu->arch.update_pte.mmu_seq = vcpu->kvm->mmu_notifier_seq;
+       /* implicit mb(), we'll read before PT lock is unlocked */
        pfn = gfn_to_pfn(vcpu->kvm, gfn);
        up_read(&current->mm->mmap_sem);
 
index 4d91822..f72ac1f 100644 (file)
@@ -263,6 +263,8 @@ static void FNAME(update_pte)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *page,
        pfn = vcpu->arch.update_pte.pfn;
        if (is_error_pfn(pfn))
                return;
+       if (mmu_notifier_retry(vcpu, vcpu->arch.update_pte.mmu_seq))
+               return;
        kvm_get_pfn(pfn);
        mmu_set_spte(vcpu, spte, page->role.access, pte_access, 0, 0,
                     gpte & PT_DIRTY_MASK, NULL, largepage, gpte_to_gfn(gpte),
@@ -380,6 +382,7 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr,
        int r;
        pfn_t pfn;
        int largepage = 0;
+       unsigned long mmu_seq;
 
        pgprintk("%s: addr %lx err %x\n", __func__, addr, error_code);
        kvm_mmu_audit(vcpu, "pre page fault");
@@ -413,6 +416,8 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr,
                        largepage = 1;
                }
        }
+       mmu_seq = vcpu->kvm->mmu_notifier_seq;
+       /* implicit mb(), we'll read before PT lock is unlocked */
        pfn = gfn_to_pfn(vcpu->kvm, walker.gfn);
        up_read(&current->mm->mmap_sem);
 
@@ -424,6 +429,8 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr,
        }
 
        spin_lock(&vcpu->kvm->mmu_lock);
+       if (mmu_notifier_retry(vcpu, mmu_seq))
+               goto out_unlock;
        kvm_mmu_free_some_pages(vcpu);
        shadow_pte = FNAME(fetch)(vcpu, addr, &walker, user_fault, write_fault,
                                  largepage, &write_pt, pfn);
@@ -439,6 +446,11 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr,
        spin_unlock(&vcpu->kvm->mmu_lock);
 
        return write_pt;
+
+out_unlock:
+       spin_unlock(&vcpu->kvm->mmu_lock);
+       kvm_release_pfn_clean(pfn);
+       return 0;
 }
 
 static gpa_t FNAME(gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t vaddr)
index 5916191..0d682fc 100644 (file)
@@ -883,6 +883,7 @@ int kvm_dev_ioctl_check_extension(long ext)
        case KVM_CAP_PIT:
        case KVM_CAP_NOP_IO_DELAY:
        case KVM_CAP_MP_STATE:
+       case KVM_CAP_SYNC_MMU:
                r = 1;
                break;
        case KVM_CAP_COALESCED_MMIO:
@@ -1495,6 +1496,7 @@ static int kvm_vm_ioctl_set_memory_alias(struct kvm *kvm,
                goto out;
 
        down_write(&kvm->slots_lock);
+       spin_lock(&kvm->mmu_lock);
 
        p = &kvm->arch.aliases[alias->slot];
        p->base_gfn = alias->guest_phys_addr >> PAGE_SHIFT;
@@ -1506,6 +1508,7 @@ static int kvm_vm_ioctl_set_memory_alias(struct kvm *kvm,
                        break;
        kvm->arch.naliases = n;
 
+       spin_unlock(&kvm->mmu_lock);
        kvm_mmu_zap_all(kvm);
 
        up_write(&kvm->slots_lock);
@@ -3972,16 +3975,23 @@ int kvm_arch_set_memory_region(struct kvm *kvm,
         */
        if (!user_alloc) {
                if (npages && !old.rmap) {
+                       unsigned long userspace_addr;
+
                        down_write(&current->mm->mmap_sem);
-                       memslot->userspace_addr = do_mmap(NULL, 0,
-                                                    npages * PAGE_SIZE,
-                                                    PROT_READ | PROT_WRITE,
-                                                    MAP_SHARED | MAP_ANONYMOUS,
-                                                    0);
+                       userspace_addr = do_mmap(NULL, 0,
+                                                npages * PAGE_SIZE,
+                                                PROT_READ | PROT_WRITE,
+                                                MAP_SHARED | MAP_ANONYMOUS,
+                                                0);
                        up_write(&current->mm->mmap_sem);
 
-                       if (IS_ERR((void *)memslot->userspace_addr))
-                               return PTR_ERR((void *)memslot->userspace_addr);
+                       if (IS_ERR((void *)userspace_addr))
+                               return PTR_ERR((void *)userspace_addr);
+
+                       /* set userspace_addr atomically for kvm_hva_to_rmapp */
+                       spin_lock(&kvm->mmu_lock);
+                       memslot->userspace_addr = userspace_addr;
+                       spin_unlock(&kvm->mmu_lock);
                } else {
                        if (!old.user_alloc && old.rmap) {
                                int ret;
index dfdf428..f118c11 100644 (file)
@@ -52,7 +52,7 @@
        jnz 100b
 102:
        .section .fixup,"ax"
-103:   addl %r8d,%edx                  /* ecx is zerorest also */
+103:   addl %ecx,%edx                  /* ecx is zerorest also */
        jmp copy_user_handle_tail
        .previous
 
index 40e0e30..cb0c112 100644 (file)
@@ -32,7 +32,7 @@
        jnz 100b
 102:
        .section .fixup,"ax"
-103:   addl %r8d,%edx                  /* ecx is zerorest also */
+103:   addl %ecx,%edx                  /* ecx is zerorest also */
        jmp copy_user_handle_tail
        .previous
 
@@ -108,7 +108,6 @@ ENTRY(__copy_user_nocache)
        jmp 60f
 50:    movl %ecx,%edx
 60:    sfence
-       movl %r8d,%ecx
        jmp copy_user_handle_tail
        .previous
 
index 6e52cdd..c9a7c5b 100644 (file)
@@ -18,7 +18,6 @@
 #include <linux/interrupt.h>
 #include <asm/irq.h>
 #include <linux/in6.h>
-#include <linux/ide.h>
 
 #include <asm/uaccess.h>
 #include <asm/checksum.h>
index fef79cc..4889eb8 100644 (file)
@@ -212,6 +212,24 @@ void blk_plug_device(struct request_queue *q)
 }
 EXPORT_SYMBOL(blk_plug_device);
 
+/**
+ * blk_plug_device_unlocked - plug a device without queue lock held
+ * @q:    The &struct request_queue to plug
+ *
+ * Description:
+ *   Like @blk_plug_device(), but grabs the queue lock and disables
+ *   interrupts.
+ **/
+void blk_plug_device_unlocked(struct request_queue *q)
+{
+       unsigned long flags;
+
+       spin_lock_irqsave(q->queue_lock, flags);
+       blk_plug_device(q);
+       spin_unlock_irqrestore(q->queue_lock, flags);
+}
+EXPORT_SYMBOL(blk_plug_device_unlocked);
+
 /*
  * remove the queue from the plugged list, if present. called with
  * queue lock held and interrupts disabled.
index c5b9bcf..12a5182 100644 (file)
@@ -518,7 +518,7 @@ int scsi_cmd_ioctl(struct file *file, struct request_queue *q,
                        hdr.sbp = cgc.sense;
                        if (hdr.sbp)
                                hdr.mx_sb_len = sizeof(struct request_sense);
-                       hdr.timeout = cgc.timeout;
+                       hdr.timeout = jiffies_to_msecs(cgc.timeout);
                        hdr.cmdp = ((struct cdrom_generic_command __user*) arg)->cmd;
                        hdr.cmd_len = sizeof(cgc.cmd);
 
index 65974c6..c029d3e 100644 (file)
@@ -263,11 +263,12 @@ async_xor_zero_sum(struct page *dest, struct page **src_list,
                if (unlikely(!tx)) {
                        async_tx_quiesce(&depend_tx);
 
-                       while (!tx)
+                       while (!tx) {
                                dma_async_issue_pending(chan);
                                tx = device->device_prep_dma_zero_sum(chan,
                                        dma_src, src_cnt, len, result,
                                        dma_prep_flags);
+                       }
                }
 
                async_tx_submit(chan, tx, flags, depend_tx, cb_fn, cb_param);
index 54ec5e7..a280ab3 100644 (file)
@@ -97,3 +97,4 @@ obj-$(CONFIG_PPC_PS3)         += ps3/
 obj-$(CONFIG_OF)               += of/
 obj-$(CONFIG_SSB)              += ssb/
 obj-$(CONFIG_VIRTIO)           += virtio/
+obj-$(CONFIG_REGULATOR)                += regulator/
index 44ad90c..d3d0886 100644 (file)
@@ -78,9 +78,9 @@ MODULE_LICENSE("GPL");
 static uid_t asus_uid;
 static gid_t asus_gid;
 module_param(asus_uid, uint, 0);
-MODULE_PARM_DESC(asus_uid, "UID for entries in /proc/acpi/asus.\n");
+MODULE_PARM_DESC(asus_uid, "UID for entries in /proc/acpi/asus");
 module_param(asus_gid, uint, 0);
-MODULE_PARM_DESC(asus_gid, "GID for entries in /proc/acpi/asus.\n");
+MODULE_PARM_DESC(asus_gid, "GID for entries in /proc/acpi/asus");
 
 /* For each model, all features implemented, 
  * those marked with R are relative to HOTK, A for absolute */
index b474996..0133af4 100644 (file)
@@ -64,7 +64,13 @@ static DEFINE_MUTEX(performance_mutex);
  * policy is adjusted accordingly.
  */
 
-static unsigned int ignore_ppc = 0;
+/* ignore_ppc:
+ * -1 -> cpufreq low level drivers not initialized -> _PSS, etc. not called yet
+ *       ignore _PPC
+ *  0 -> cpufreq low level drivers initialized -> consider _PPC values
+ *  1 -> ignore _PPC totally -> forced by user through boot param
+ */
+static unsigned int ignore_ppc = -1;
 module_param(ignore_ppc, uint, 0644);
 MODULE_PARM_DESC(ignore_ppc, "If the frequency of your machine gets wrongly" \
                 "limited by BIOS, this should help");
@@ -72,7 +78,7 @@ MODULE_PARM_DESC(ignore_ppc, "If the frequency of your machine gets wrongly" \
 #define PPC_REGISTERED   1
 #define PPC_IN_USE       2
 
-static int acpi_processor_ppc_status = 0;
+static int acpi_processor_ppc_status;
 
 static int acpi_processor_ppc_notifier(struct notifier_block *nb,
                                       unsigned long event, void *data)
@@ -81,13 +87,18 @@ static int acpi_processor_ppc_notifier(struct notifier_block *nb,
        struct acpi_processor *pr;
        unsigned int ppc = 0;
 
-       if (ignore_ppc)
+       if (event == CPUFREQ_START && ignore_ppc <= 0) {
+               ignore_ppc = 0;
                return 0;
+       }
 
-       mutex_lock(&performance_mutex);
+       if (ignore_ppc)
+               return 0;
 
        if (event != CPUFREQ_INCOMPATIBLE)
-               goto out;
+               return 0;
+
+       mutex_lock(&performance_mutex);
 
        pr = per_cpu(processors, policy->cpu);
        if (!pr || !pr->performance)
index a90ae03..c294121 100644 (file)
@@ -250,6 +250,7 @@ static const struct pci_device_id piix_pci_tbl[] = {
        /* Mobile SATA Controller IDE (ICH8M), Apple */
        { 0x8086, 0x2828, 0x106b, 0x00a0, 0, 0, ich8m_apple_sata },
        { 0x8086, 0x2828, 0x106b, 0x00a1, 0, 0, ich8m_apple_sata },
+       { 0x8086, 0x2828, 0x106b, 0x00a3, 0, 0, ich8m_apple_sata },
        /* Mobile SATA Controller IDE (ICH8M) */
        { 0x8086, 0x2828, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata },
        /* SATA Controller IDE (ICH9) */
index 9bef1a8..5ba96c5 100644 (file)
@@ -120,7 +120,7 @@ static char ata_force_param_buf[PAGE_SIZE] __initdata;
 module_param_string(force, ata_force_param_buf, sizeof(ata_force_param_buf), 0);
 MODULE_PARM_DESC(force, "Force ATA configurations including cable type, link speed and transfer mode (see Documentation/kernel-parameters.txt for details)");
 
-int atapi_enabled = 1;
+static int atapi_enabled = 1;
 module_param(atapi_enabled, int, 0444);
 MODULE_PARM_DESC(atapi_enabled, "Enable discovery of ATAPI devices (0=off, 1=on)");
 
@@ -1132,6 +1132,8 @@ void ata_id_string(const u16 *id, unsigned char *s,
 {
        unsigned int c;
 
+       BUG_ON(len & 1);
+
        while (len > 0) {
                c = id[ofs] >> 8;
                *s = c;
@@ -1165,8 +1167,6 @@ void ata_id_c_string(const u16 *id, unsigned char *s,
 {
        unsigned char *p;
 
-       WARN_ON(!(len & 1));
-
        ata_id_string(id, s, ofs, len - 1);
 
        p = s + strnlen(s, len - 1);
@@ -1885,6 +1885,23 @@ static u32 ata_pio_mask_no_iordy(const struct ata_device *adev)
        return 3 << ATA_SHIFT_PIO;
 }
 
+/**
+ *     ata_do_dev_read_id              -       default ID read method
+ *     @dev: device
+ *     @tf: proposed taskfile
+ *     @id: data buffer
+ *
+ *     Issue the identify taskfile and hand back the buffer containing
+ *     identify data. For some RAID controllers and for pre ATA devices
+ *     this function is wrapped or replaced by the driver
+ */
+unsigned int ata_do_dev_read_id(struct ata_device *dev,
+                                       struct ata_taskfile *tf, u16 *id)
+{
+       return ata_exec_internal(dev, tf, NULL, DMA_FROM_DEVICE,
+                                    id, sizeof(id[0]) * ATA_ID_WORDS, 0);
+}
+
 /**
  *     ata_dev_read_id - Read ID data from the specified device
  *     @dev: target device
@@ -1920,7 +1937,7 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,
        if (ata_msg_ctl(ap))
                ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __func__);
 
- retry:
+retry:
        ata_tf_init(dev, &tf);
 
        switch (class) {
@@ -1948,8 +1965,11 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,
         */
        tf.flags |= ATA_TFLAG_POLLING;
 
-       err_mask = ata_exec_internal(dev, &tf, NULL, DMA_FROM_DEVICE,
-                                    id, sizeof(id[0]) * ATA_ID_WORDS, 0);
+       if (ap->ops->read_id)
+               err_mask = ap->ops->read_id(dev, &tf, id);
+       else
+               err_mask = ata_do_dev_read_id(dev, &tf, id);
+
        if (err_mask) {
                if (err_mask & AC_ERR_NODEV_HINT) {
                        ata_dev_printk(dev, KERN_DEBUG,
@@ -2142,6 +2162,16 @@ int ata_dev_configure(struct ata_device *dev)
                return 0;
        }
 
+       if ((!atapi_enabled || (ap->flags & ATA_FLAG_NO_ATAPI)) &&
+           dev->class == ATA_DEV_ATAPI) {
+               ata_dev_printk(dev, KERN_WARNING,
+                       "WARNING: ATAPI is %s, device ignored.\n",
+                       atapi_enabled ? "not supported with this driver"
+                                     : "disabled");
+               ata_dev_disable(dev);
+               return 0;
+       }
+
        /* let ACPI work its magic */
        rc = ata_acpi_on_devcfg(dev);
        if (rc)
@@ -6088,16 +6118,20 @@ static int __init ata_init(void)
 
        ata_wq = create_workqueue("ata");
        if (!ata_wq)
-               return -ENOMEM;
+               goto free_force_tbl;
 
        ata_aux_wq = create_singlethread_workqueue("ata_aux");
-       if (!ata_aux_wq) {
-               destroy_workqueue(ata_wq);
-               return -ENOMEM;
-       }
+       if (!ata_aux_wq)
+               goto free_wq;
 
        printk(KERN_DEBUG "libata version " DRV_VERSION " loaded.\n");
        return 0;
+
+free_wq:
+       destroy_workqueue(ata_wq);
+free_force_tbl:
+       kfree(ata_force_tbl);
+       return -ENOMEM;
 }
 
 static void __exit ata_exit(void)
@@ -6269,6 +6303,7 @@ EXPORT_SYMBOL_GPL(ata_host_resume);
 #endif /* CONFIG_PM */
 EXPORT_SYMBOL_GPL(ata_id_string);
 EXPORT_SYMBOL_GPL(ata_id_c_string);
+EXPORT_SYMBOL_GPL(ata_do_dev_read_id);
 EXPORT_SYMBOL_GPL(ata_scsi_simulate);
 
 EXPORT_SYMBOL_GPL(ata_pio_need_iordy);
index f3b4b15..b9d3ba4 100644 (file)
@@ -2550,36 +2550,6 @@ static struct ata_device *__ata_scsi_find_dev(struct ata_port *ap,
        return ata_find_dev(ap, devno);
 }
 
-/**
- *     ata_scsi_dev_enabled - determine if device is enabled
- *     @dev: ATA device
- *
- *     Determine if commands should be sent to the specified device.
- *
- *     LOCKING:
- *     spin_lock_irqsave(host lock)
- *
- *     RETURNS:
- *     0 if commands are not allowed / 1 if commands are allowed
- */
-
-static int ata_scsi_dev_enabled(struct ata_device *dev)
-{
-       if (unlikely(!ata_dev_enabled(dev)))
-               return 0;
-
-       if (!atapi_enabled || (dev->link->ap->flags & ATA_FLAG_NO_ATAPI)) {
-               if (unlikely(dev->class == ATA_DEV_ATAPI)) {
-                       ata_dev_printk(dev, KERN_WARNING,
-                                      "WARNING: ATAPI is %s, device ignored.\n",
-                                      atapi_enabled ? "not supported with this driver" : "disabled");
-                       return 0;
-               }
-       }
-
-       return 1;
-}
-
 /**
  *     ata_scsi_find_dev - lookup ata_device from scsi_cmnd
  *     @ap: ATA port to which the device is attached
@@ -2601,7 +2571,7 @@ ata_scsi_find_dev(struct ata_port *ap, const struct scsi_device *scsidev)
 {
        struct ata_device *dev = __ata_scsi_find_dev(ap, scsidev);
 
-       if (unlikely(!dev || !ata_scsi_dev_enabled(dev)))
+       if (unlikely(!dev || !ata_dev_enabled(dev)))
                return NULL;
 
        return dev;
@@ -3622,7 +3592,7 @@ int ata_sas_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *),
 
        ata_scsi_dump_cdb(ap, cmd);
 
-       if (likely(ata_scsi_dev_enabled(ap->link.device)))
+       if (likely(ata_dev_enabled(ap->link.device)))
                rc = __ata_scsi_queuecmd(cmd, done, ap->link.device);
        else {
                cmd->result = (DID_BAD_TARGET << 16);
index f6f9c28..ade5c75 100644 (file)
@@ -66,7 +66,6 @@ enum {
 
 extern unsigned int ata_print_id;
 extern struct workqueue_struct *ata_aux_wq;
-extern int atapi_enabled;
 extern int atapi_passthru16;
 extern int libata_fua;
 extern int libata_noacpi;
index 0f3e659..5ca70fa 100644 (file)
@@ -550,8 +550,9 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
                pci_read_config_byte(isa_bridge, 0x5E, &tmp);
                if ((tmp & 0x1E) == 0x12)
                        ppi[0] = &info_20_udma;
-               pci_dev_put(isa_bridge);
        }
+       pci_dev_put(isa_bridge);
+
        return ata_pci_sff_init_one(pdev, ppi, &ali_sht, NULL);
 }
 
index e108169..27843c7 100644 (file)
@@ -80,7 +80,7 @@
 
 
 #define DRV_NAME "pata_it821x"
-#define DRV_VERSION "0.3.8"
+#define DRV_VERSION "0.4.0"
 
 struct it821x_dev
 {
@@ -425,6 +425,8 @@ static unsigned int it821x_smart_qc_issue(struct ata_queued_cmd *qc)
                case ATA_CMD_WRITE_MULTI:
                case ATA_CMD_WRITE_MULTI_EXT:
                case ATA_CMD_ID_ATA:
+               case ATA_CMD_INIT_DEV_PARAMS:
+               case 0xFC:      /* Internal 'report rebuild state' */
                /* Arguably should just no-op this one */
                case ATA_CMD_SET_FEATURES:
                        return ata_sff_qc_issue(qc);
@@ -509,7 +511,7 @@ static void it821x_dev_config(struct ata_device *adev)
 
        if (strstr(model_num, "Integrated Technology Express")) {
                /* RAID mode */
-               printk(KERN_INFO "IT821x %sRAID%d volume",
+               ata_dev_printk(adev, KERN_INFO, "%sRAID%d volume",
                        adev->id[147]?"Bootable ":"",
                        adev->id[129]);
                if (adev->id[129] != 1)
@@ -519,37 +521,51 @@ static void it821x_dev_config(struct ata_device *adev)
        /* This is a controller firmware triggered funny, don't
           report the drive faulty! */
        adev->horkage &= ~ATA_HORKAGE_DIAGNOSTIC;
+       /* No HPA in 'smart' mode */
+       adev->horkage |= ATA_HORKAGE_BROKEN_HPA;
 }
 
 /**
- *     it821x_ident_hack       -       Hack identify data up
- *     @ap: Port
+ *     it821x_read_id  -       Hack identify data up
+ *     @adev: device to read
+ *     @tf: proposed taskfile
+ *     @id: buffer for returned ident data
  *
- *     Walk the devices on this firmware driven port and slightly
+ *     Query the devices on this firmware driven port and slightly
  *     mash the identify data to stop us and common tools trying to
  *     use features not firmware supported. The firmware itself does
  *     some masking (eg SMART) but not enough.
- *
- *     This is a bit of an abuse of the cable method, but it is the
- *     only method called at the right time. We could modify the libata
- *     core specifically for ident hacking but while we have one offender
- *     it seems better to keep the fallout localised.
  */
 
-static int it821x_ident_hack(struct ata_port *ap)
+static unsigned int it821x_read_id(struct ata_device *adev,
+                                       struct ata_taskfile *tf, u16 *id)
 {
-       struct ata_device *adev;
-       ata_link_for_each_dev(adev, &ap->link) {
-               if (ata_dev_enabled(adev)) {
-                       adev->id[84] &= ~(1 << 6);      /* No FUA */
-                       adev->id[85] &= ~(1 << 10);     /* No HPA */
-                       adev->id[76] = 0;               /* No NCQ/AN etc */
-               }
+       unsigned int err_mask;
+       unsigned char model_num[ATA_ID_PROD_LEN + 1];
+
+       err_mask = ata_do_dev_read_id(adev, tf, id);
+       if (err_mask)
+               return err_mask;
+       ata_id_c_string(id, model_num, ATA_ID_PROD, sizeof(model_num));
+
+       id[83] &= ~(1 << 12);   /* Cache flush is firmware handled */
+       id[83] &= ~(1 << 13);   /* Ditto for LBA48 flushes */
+       id[84] &= ~(1 << 6);    /* No FUA */
+       id[85] &= ~(1 << 10);   /* No HPA */
+       id[76] = 0;             /* No NCQ/AN etc */
+
+       if (strstr(model_num, "Integrated Technology Express")) {
+               /* Set feature bits the firmware neglects */
+               id[49] |= 0x0300;       /* LBA, DMA */
+               id[82] |= 0x0400;       /* LBA48 */
+               id[83] &= 0x7FFF;
+               id[83] |= 0x4000;       /* Word 83 is valid */
+               id[86] |= 0x0400;       /* LBA48 on */
+               id[ATA_ID_MAJOR_VER] |= 0x1F;
        }
-       return ata_cable_unknown(ap);
+       return err_mask;
 }
 
-
 /**
  *     it821x_check_atapi_dma  -       ATAPI DMA handler
  *     @qc: Command we are about to issue
@@ -577,6 +593,136 @@ static int it821x_check_atapi_dma(struct ata_queued_cmd *qc)
        return 0;
 }
 
+/**
+ *     it821x_display_disk     -       display disk setup
+ *     @n: Device number
+ *     @buf: Buffer block from firmware
+ *
+ *     Produce a nice informative display of the device setup as provided
+ *     by the firmware.
+ */
+
+static void it821x_display_disk(int n, u8 *buf)
+{
+       unsigned char id[41];
+       int mode = 0;
+       char *mtype;
+       char mbuf[8];
+       char *cbl = "(40 wire cable)";
+
+       static const char *types[5] = {
+               "RAID0", "RAID1" "RAID 0+1", "JBOD", "DISK"
+       };
+
+       if (buf[52] > 4)        /* No Disk */
+               return;
+
+       ata_id_c_string((u16 *)buf, id, 0, 41); 
+
+       if (buf[51]) {
+               mode = ffs(buf[51]);
+               mtype = "UDMA";
+       } else if (buf[49]) {
+               mode = ffs(buf[49]);
+               mtype = "MWDMA";
+       }
+
+       if (buf[76])
+               cbl = "";
+
+       if (mode)
+               snprintf(mbuf, 8, "%5s%d", mtype, mode - 1);
+       else
+               strcpy(mbuf, "PIO");
+       if (buf[52] == 4)
+               printk(KERN_INFO "%d: %-6s %-8s          %s %s\n",
+                               n, mbuf, types[buf[52]], id, cbl);
+       else
+               printk(KERN_INFO "%d: %-6s %-8s Volume: %1d %s %s\n",
+                               n, mbuf, types[buf[52]], buf[53], id, cbl);
+       if (buf[125] < 100)
+               printk(KERN_INFO "%d: Rebuilding: %d%%\n", n, buf[125]);
+}
+
+/**
+ *     it821x_firmware_command         -       issue firmware command
+ *     @ap: IT821x port to interrogate
+ *     @cmd: command
+ *     @len: length
+ *
+ *     Issue firmware commands expecting data back from the controller. We
+ *     use this to issue commands that do not go via the normal paths. Other
+ *     commands such as 0xFC can be issued normally.
+ */
+
+static u8 *it821x_firmware_command(struct ata_port *ap, u8 cmd, int len)
+{
+       u8 status;
+       int n = 0;
+       u16 *buf = kmalloc(len, GFP_KERNEL);
+       if (buf == NULL) {
+               printk(KERN_ERR "it821x_firmware_command: Out of memory\n");
+               return NULL;
+       }
+       /* This isn't quite a normal ATA command as we are talking to the
+          firmware not the drives */
+       ap->ctl |= ATA_NIEN;
+       iowrite8(ap->ctl, ap->ioaddr.ctl_addr);
+       ata_wait_idle(ap);
+       iowrite8(ATA_DEVICE_OBS, ap->ioaddr.device_addr);
+       iowrite8(cmd, ap->ioaddr.command_addr);
+       udelay(1);
+       /* This should be almost immediate but a little paranoia goes a long
+          way. */
+       while(n++ < 10) {
+               status = ioread8(ap->ioaddr.status_addr);
+               if (status & ATA_ERR) {
+                       kfree(buf);
+                       printk(KERN_ERR "it821x_firmware_command: rejected\n");
+                       return NULL;
+               }
+               if (status & ATA_DRQ) {
+                       ioread16_rep(ap->ioaddr.data_addr, buf, len/2);
+                       return (u8 *)buf;
+               }
+               mdelay(1);
+       }
+       kfree(buf);
+       printk(KERN_ERR "it821x_firmware_command: timeout\n");
+       return NULL;
+}
+
+/**
+ *     it821x_probe_firmware   -       firmware reporting/setup
+ *     @ap: IT821x port being probed
+ *
+ *     Probe the firmware of the controller by issuing firmware command
+ *     0xFA and analysing the returned data.
+ */
+
+static void it821x_probe_firmware(struct ata_port *ap)
+{
+       u8 *buf;
+       int i;
+
+       /* This is a bit ugly as we can't just issue a task file to a device
+          as this is controller magic */
+
+       buf = it821x_firmware_command(ap, 0xFA, 512);
+
+       if (buf != NULL) {
+               printk(KERN_INFO "pata_it821x: Firmware %02X/%02X/%02X%02X\n",
+                               buf[505],
+                               buf[506],
+                               buf[507],
+                               buf[508]);
+               for (i = 0; i < 4; i++)
+                       it821x_display_disk(i, buf + 128 * i);
+               kfree(buf);
+       }
+}
+
+
 
 /**
  *     it821x_port_start       -       port setup
@@ -610,6 +756,8 @@ static int it821x_port_start(struct ata_port *ap)
                /* Long I/O's although allowed in LBA48 space cause the
                   onboard firmware to enter the twighlight zone */
                /* No ATAPI DMA in this mode either */
+               if (ap->port_no == 0)
+                       it821x_probe_firmware(ap);
        }
        /* Pull the current clocks from 0x50 */
        if (conf & (1 << (1 + ap->port_no)))
@@ -631,6 +779,25 @@ static int it821x_port_start(struct ata_port *ap)
        return 0;
 }
 
+/**
+ *     it821x_rdc_cable        -       Cable detect for RDC1010
+ *     @ap: port we are checking
+ *
+ *     Return the RDC1010 cable type. Unlike the IT821x we know how to do
+ *     this and can do host side cable detect
+ */
+
+static int it821x_rdc_cable(struct ata_port *ap)
+{
+       u16 r40;
+       struct pci_dev *pdev = to_pci_dev(ap->host->dev);
+
+       pci_read_config_word(pdev, 0x40, &r40);
+       if (r40 & (1 << (2 + ap->port_no)))
+               return ATA_CBL_PATA40;
+       return ATA_CBL_PATA80;
+}
+
 static struct scsi_host_template it821x_sht = {
        ATA_BMDMA_SHT(DRV_NAME),
 };
@@ -641,9 +808,10 @@ static struct ata_port_operations it821x_smart_port_ops = {
        .check_atapi_dma= it821x_check_atapi_dma,
        .qc_issue       = it821x_smart_qc_issue,
 
-       .cable_detect   = it821x_ident_hack,
+       .cable_detect   = ata_cable_80wire,
        .set_mode       = it821x_smart_set_mode,
        .dev_config     = it821x_dev_config,
+       .read_id        = it821x_read_id,
 
        .port_start     = it821x_port_start,
 };
@@ -664,8 +832,29 @@ static struct ata_port_operations it821x_passthru_port_ops = {
        .port_start     = it821x_port_start,
 };
 
+static struct ata_port_operations it821x_rdc_port_ops = {
+       .inherits       = &ata_bmdma_port_ops,
+
+       .check_atapi_dma= it821x_check_atapi_dma,
+       .sff_dev_select = it821x_passthru_dev_select,
+       .bmdma_start    = it821x_passthru_bmdma_start,
+       .bmdma_stop     = it821x_passthru_bmdma_stop,
+       .qc_issue       = it821x_passthru_qc_issue,
+
+       .cable_detect   = it821x_rdc_cable,
+       .set_piomode    = it821x_passthru_set_piomode,
+       .set_dmamode    = it821x_passthru_set_dmamode,
+
+       .port_start     = it821x_port_start,
+};
+
 static void it821x_disable_raid(struct pci_dev *pdev)
 {
+       /* Neither the RDC nor the IT8211 */
+       if (pdev->vendor != PCI_VENDOR_ID_ITE ||
+                       pdev->device != PCI_DEVICE_ID_ITE_8212)
+                       return;
+
        /* Reset local CPU, and set BIOS not ready */
        pci_write_config_byte(pdev, 0x5E, 0x01);
 
@@ -690,6 +879,7 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
                .flags = ATA_FLAG_SLAVE_POSS,
                .pio_mask = 0x1f,
                .mwdma_mask = 0x07,
+               .udma_mask = ATA_UDMA6,
                .port_ops = &it821x_smart_port_ops
        };
        static const struct ata_port_info info_passthru = {
@@ -699,6 +889,13 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
                .udma_mask = ATA_UDMA6,
                .port_ops = &it821x_passthru_port_ops
        };
+       static const struct ata_port_info info_rdc = {
+               .flags = ATA_FLAG_SLAVE_POSS,
+               .pio_mask = 0x1f,
+               .mwdma_mask = 0x07,
+               /* No UDMA */
+               .port_ops = &it821x_rdc_port_ops
+       };
 
        const struct ata_port_info *ppi[] = { NULL, NULL };
        static char *mode[2] = { "pass through", "smart" };
@@ -707,21 +904,25 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
        rc = pcim_enable_device(pdev);
        if (rc)
                return rc;
+               
+       if (pdev->vendor == PCI_VENDOR_ID_RDC) {
+               ppi[0] = &info_rdc;
+       } else {
+               /* Force the card into bypass mode if so requested */
+               if (it8212_noraid) {
+                       printk(KERN_INFO DRV_NAME ": forcing bypass mode.\n");
+                       it821x_disable_raid(pdev);
+               }
+               pci_read_config_byte(pdev, 0x50, &conf);
+               conf &= 1;
 
-       /* Force the card into bypass mode if so requested */
-       if (it8212_noraid) {
-               printk(KERN_INFO DRV_NAME ": forcing bypass mode.\n");
-               it821x_disable_raid(pdev);
+               printk(KERN_INFO DRV_NAME": controller in %s mode.\n",
+                                                               mode[conf]);
+               if (conf == 0)
+                       ppi[0] = &info_passthru;
+               else
+                       ppi[0] = &info_smart;
        }
-       pci_read_config_byte(pdev, 0x50, &conf);
-       conf &= 1;
-
-       printk(KERN_INFO DRV_NAME ": controller in %s mode.\n", mode[conf]);
-       if (conf == 0)
-               ppi[0] = &info_passthru;
-       else
-               ppi[0] = &info_smart;
-
        return ata_pci_sff_init_one(pdev, ppi, &it821x_sht, NULL);
 }
 
@@ -745,6 +946,7 @@ static int it821x_reinit_one(struct pci_dev *pdev)
 static const struct pci_device_id it821x[] = {
        { PCI_VDEVICE(ITE, PCI_DEVICE_ID_ITE_8211), },
        { PCI_VDEVICE(ITE, PCI_DEVICE_ID_ITE_8212), },
+       { PCI_VDEVICE(RDC, 0x1010), },
 
        { },
 };
index 708ed14..57d951b 100644 (file)
@@ -98,7 +98,8 @@ static const struct via_isa_bridge {
        u8 rev_max;
        u16 flags;
 } via_isa_bridges[] = {
-       { "vx800",      PCI_DEVICE_ID_VIA_VX800,    0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
+       { "vx800",      PCI_DEVICE_ID_VIA_VX800,    0x00, 0x2f, VIA_UDMA_133 |
+       VIA_BAD_AST | VIA_SATA_PATA },
        { "vt8237s",    PCI_DEVICE_ID_VIA_8237S,    0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
        { "vt8251",     PCI_DEVICE_ID_VIA_8251,     0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
        { "cx700",      PCI_DEVICE_ID_VIA_CX700,    0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_SATA_PATA },
@@ -322,6 +323,65 @@ static void via_set_dmamode(struct ata_port *ap, struct ata_device *adev)
        via_do_set_mode(ap, adev, adev->dma_mode, tclock[mode], set_ast, udma[mode]);
 }
 
+/**
+ *     via_ata_sff_tf_load - send taskfile registers to host controller
+ *     @ap: Port to which output is sent
+ *     @tf: ATA taskfile register set
+ *
+ *     Outputs ATA taskfile to standard ATA host controller.
+ *
+ *     Note: This is to fix the internal bug of via chipsets, which
+ *  will reset the device register after changing the IEN bit on
+ *  ctl register
+ */
+static void via_ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf)
+{
+       struct ata_ioports *ioaddr = &ap->ioaddr;
+       unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR;
+
+       if (tf->ctl != ap->last_ctl) {
+               iowrite8(tf->ctl, ioaddr->ctl_addr);
+               iowrite8(tf->device, ioaddr->device_addr);
+               ap->last_ctl = tf->ctl;
+               ata_wait_idle(ap);
+       }
+
+       if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) {
+               iowrite8(tf->hob_feature, ioaddr->feature_addr);
+               iowrite8(tf->hob_nsect, ioaddr->nsect_addr);
+               iowrite8(tf->hob_lbal, ioaddr->lbal_addr);
+               iowrite8(tf->hob_lbam, ioaddr->lbam_addr);
+               iowrite8(tf->hob_lbah, ioaddr->lbah_addr);
+               VPRINTK("hob: feat 0x%X nsect 0x%X, lba 0x%X 0x%X 0x%X\n",
+                       tf->hob_feature,
+                       tf->hob_nsect,
+                       tf->hob_lbal,
+                       tf->hob_lbam,
+                       tf->hob_lbah);
+       }
+
+       if (is_addr) {
+               iowrite8(tf->feature, ioaddr->feature_addr);
+               iowrite8(tf->nsect, ioaddr->nsect_addr);
+               iowrite8(tf->lbal, ioaddr->lbal_addr);
+               iowrite8(tf->lbam, ioaddr->lbam_addr);
+               iowrite8(tf->lbah, ioaddr->lbah_addr);
+               VPRINTK("feat 0x%X nsect 0x%X lba 0x%X 0x%X 0x%X\n",
+                       tf->feature,
+                       tf->nsect,
+                       tf->lbal,
+                       tf->lbam,
+                       tf->lbah);
+       }
+
+       if (tf->flags & ATA_TFLAG_DEVICE) {
+               iowrite8(tf->device, ioaddr->device_addr);
+               VPRINTK("device 0x%X\n", tf->device);
+       }
+
+       ata_wait_idle(ap);
+}
+
 static struct scsi_host_template via_sht = {
        ATA_BMDMA_SHT(DRV_NAME),
 };
@@ -332,11 +392,13 @@ static struct ata_port_operations via_port_ops = {
        .set_piomode    = via_set_piomode,
        .set_dmamode    = via_set_dmamode,
        .prereset       = via_pre_reset,
+       .sff_tf_load = via_ata_tf_load,
 };
 
 static struct ata_port_operations via_port_ops_noirq = {
        .inherits       = &via_port_ops,
        .sff_data_xfer  = ata_sff_data_xfer_noirq,
+       .sff_tf_load = via_ata_tf_load,
 };
 
 /**
index 24df73a..088885e 100644 (file)
@@ -156,8 +156,8 @@ static void ia_hack_tcq(IADEV *dev) {
         }
         iavcc_r->vc_desc_cnt--;
         dev->desc_tbl[desc1 -1].timestamp = 0;
-        IF_EVENT(printk("ia_hack: return_q skb = 0x%x desc = %d\n", 
-                                   (u32)dev->desc_tbl[desc1 -1].txskb, desc1);)
+        IF_EVENT(printk("ia_hack: return_q skb = 0x%p desc = %d\n",
+                                   dev->desc_tbl[desc1 -1].txskb, desc1);)
         if (iavcc_r->pcr < dev->rate_limit) {
            IA_SKB_STATE (dev->desc_tbl[desc1-1].txskb) |= IA_TX_DONE;
            if (ia_enque_rtn_q(&dev->tx_return_q, dev->desc_tbl[desc1 -1]) < 0)
@@ -527,8 +527,8 @@ static int ia_cbr_setup (IADEV *dev, struct atm_vcc *vcc) {
       inc = 0;
       testSlot = idealSlot;
       TstSchedTbl = (u16*)(SchedTbl+testSlot);  //set index and read in value
-      IF_CBR(printk("CBR Testslot 0x%x AT Location 0x%x, NumToAssign=%d\n",
-                                testSlot, (u32)TstSchedTbl,toBeAssigned);) 
+      IF_CBR(printk("CBR Testslot 0x%x AT Location 0x%p, NumToAssign=%d\n",
+                                testSlot, TstSchedTbl,toBeAssigned);)
       memcpy((caddr_t)&cbrVC,(caddr_t)TstSchedTbl,sizeof(cbrVC));
       while (cbrVC)  // If another VC at this location, we have to keep looking
       {
@@ -536,8 +536,8 @@ static int ia_cbr_setup (IADEV *dev, struct atm_vcc *vcc) {
           testSlot = idealSlot - inc;
           if (testSlot < 0) { // Wrap if necessary
              testSlot += dev->CbrTotEntries;
-             IF_CBR(printk("Testslot Wrap. STable Start=0x%x,Testslot=%d\n",
-                                                       (u32)SchedTbl,testSlot);)
+             IF_CBR(printk("Testslot Wrap. STable Start=0x%p,Testslot=%d\n",
+                                                       SchedTbl,testSlot);)
           }
           TstSchedTbl = (u16 *)(SchedTbl + testSlot);  // set table index
           memcpy((caddr_t)&cbrVC,(caddr_t)TstSchedTbl,sizeof(cbrVC)); 
@@ -552,8 +552,8 @@ static int ia_cbr_setup (IADEV *dev, struct atm_vcc *vcc) {
           } 
           // set table index and read in value
           TstSchedTbl = (u16*)(SchedTbl + testSlot);
-          IF_CBR(printk("Reading CBR Tbl from 0x%x, CbrVal=0x%x Iteration %d\n",
-                          (u32)TstSchedTbl,cbrVC,inc);) 
+          IF_CBR(printk("Reading CBR Tbl from 0x%p, CbrVal=0x%x Iteration %d\n",
+                          TstSchedTbl,cbrVC,inc);)
           memcpy((caddr_t)&cbrVC,(caddr_t)TstSchedTbl,sizeof(cbrVC));
        } /* while */
        // Move this VCI number into this location of the CBR Sched table.
@@ -1427,11 +1427,11 @@ static int rx_init(struct atm_dev *dev)
        /* We know this is 32bit bus addressed so the following is safe */
        writel(iadev->rx_dle_dma & 0xfffff000,
               iadev->dma + IPHASE5575_RX_LIST_ADDR);  
-       IF_INIT(printk("Tx Dle list addr: 0x%08x value: 0x%0x\n", 
-                      (u32)(iadev->dma+IPHASE5575_TX_LIST_ADDR), 
+       IF_INIT(printk("Tx Dle list addr: 0x%p value: 0x%0x\n",
+                      iadev->dma+IPHASE5575_TX_LIST_ADDR,
                       *(u32*)(iadev->dma+IPHASE5575_TX_LIST_ADDR));  
-       printk("Rx Dle list addr: 0x%08x value: 0x%0x\n", 
-                      (u32)(iadev->dma+IPHASE5575_RX_LIST_ADDR), 
+       printk("Rx Dle list addr: 0x%p value: 0x%0x\n",
+                      iadev->dma+IPHASE5575_RX_LIST_ADDR,
                       *(u32*)(iadev->dma+IPHASE5575_RX_LIST_ADDR));)  
   
        writew(0xffff, iadev->reass_reg+REASS_MASK_REG);  
@@ -1470,7 +1470,7 @@ static int rx_init(struct atm_dev *dev)
                buf_desc_ptr++;           
                rx_pkt_start += iadev->rx_buf_sz;  
        }  
-       IF_INIT(printk("Rx Buffer desc ptr: 0x%0x\n", (u32)(buf_desc_ptr));)  
+       IF_INIT(printk("Rx Buffer desc ptr: 0x%p\n", buf_desc_ptr);)
         i = FREE_BUF_DESC_Q*iadev->memSize; 
        writew(i >> 16,  iadev->reass_reg+REASS_QUEUE_BASE); 
         writew(i, iadev->reass_reg+FREEQ_ST_ADR);
@@ -1487,7 +1487,7 @@ static int rx_init(struct atm_dev *dev)
                *freeq_start = (u_short)i;  
                freeq_start++;  
        }  
-       IF_INIT(printk("freeq_start: 0x%0x\n", (u32)freeq_start);)  
+       IF_INIT(printk("freeq_start: 0x%p\n", freeq_start);)
         /* Packet Complete Queue */
         i = (PKT_COMP_Q * iadev->memSize) & 0xffff;
         writew(i, iadev->reass_reg+PCQ_ST_ADR);
@@ -1713,7 +1713,7 @@ static void tx_dle_intr(struct atm_dev *dev)
                IA_SKB_STATE(skb) |= IA_DLED;
                skb_queue_tail(&iavcc->txing_skb, skb);
             }
-            IF_EVENT(printk("tx_dle_intr: enque skb = 0x%x \n", (u32)skb);)
+            IF_EVENT(printk("tx_dle_intr: enque skb = 0x%p \n", skb);)
             if (++dle == iadev->tx_dle_q.end)
                  dle = iadev->tx_dle_q.start;
         }
@@ -2044,8 +2044,8 @@ static int tx_init(struct atm_dev *dev)
         writew(tmp16, iadev->seg_reg+CBR_TAB_END+1); // CBR_PTR;
         tmp16 = (CBR_SCHED_TABLE*iadev->memSize + iadev->num_vc*6 - 2) >> 1;
         writew(tmp16, iadev->seg_reg+CBR_TAB_END);
-        IF_INIT(printk("iadev->seg_reg = 0x%x CBR_PTR_BASE = 0x%x\n",
-               (u32)iadev->seg_reg, readw(iadev->seg_reg+CBR_PTR_BASE));)
+        IF_INIT(printk("iadev->seg_reg = 0x%p CBR_PTR_BASE = 0x%x\n",
+               iadev->seg_reg, readw(iadev->seg_reg+CBR_PTR_BASE));)
         IF_INIT(printk("CBR_TAB_BEG = 0x%x, CBR_TAB_END = 0x%x, CBR_PTR = 0x%x\n",
           readw(iadev->seg_reg+CBR_TAB_BEG), readw(iadev->seg_reg+CBR_TAB_END),
           readw(iadev->seg_reg+CBR_TAB_END+1));)
@@ -2963,8 +2963,8 @@ static int ia_pkt_tx (struct atm_vcc *vcc, struct sk_buff *skb) {
  
        /* Put the packet in a tx buffer */   
        trailer = iadev->tx_buf[desc-1].cpcs;
-        IF_TX(printk("Sent: skb = 0x%x skb->data: 0x%x len: %d, desc: %d\n",
-                  (u32)skb, (u32)skb->data, skb->len, desc);)
+        IF_TX(printk("Sent: skb = 0x%p skb->data: 0x%p len: %d, desc: %d\n",
+                  skb, skb->data, skb->len, desc);)
        trailer->control = 0; 
         /*big endian*/ 
        trailer->length = ((skb->len & 0xff) << 8) | ((skb->len & 0xff00) >> 8);
@@ -3181,7 +3181,7 @@ static int __devinit ia_init_one(struct pci_dev *pdev,
        }
        dev->dev_data = iadev;
        IF_INIT(printk(DEV_LABEL "registered at (itf :%d)\n", dev->number);)
-       IF_INIT(printk("dev_id = 0x%x iadev->LineRate = %d \n", (u32)dev,
+       IF_INIT(printk("dev_id = 0x%p iadev->LineRate = %d \n", dev,
                iadev->LineRate);)
 
        pci_set_drvdata(pdev, dev);
index 839d27c..5667c2f 100644 (file)
@@ -198,6 +198,7 @@ static void class_create_release(struct class *cls)
  * class_create - create a struct class structure
  * @owner: pointer to the module that is to "own" this struct class
  * @name: pointer to a string for the name of this class.
+ * @key: the lock_class_key for this class; used by mutex lock debugging
  *
  * This is used to create a struct class pointer that can then be used
  * in calls to device_create().
index d625169..0c81ca7 100644 (file)
@@ -30,7 +30,7 @@ enum {
 
 static char aoe_iflist[IFLISTSZ];
 module_param_string(aoe_iflist, aoe_iflist, IFLISTSZ, 0600);
-MODULE_PARM_DESC(aoe_iflist, "aoe_iflist=\"dev1 [dev2 ...]\"\n");
+MODULE_PARM_DESC(aoe_iflist, "aoe_iflist=\"dev1 [dev2 ...]\"");
 
 #ifndef MODULE
 static int __init aoe_iflist_setup(char *str)
index d81632c..b73116e 100644 (file)
@@ -159,7 +159,7 @@ static int cciss_ioctl(struct inode *inode, struct file *filep,
 static int cciss_getgeo(struct block_device *bdev, struct hd_geometry *geo);
 
 static int cciss_revalidate(struct gendisk *disk);
-static int rebuild_lun_table(ctlr_info_t *h, struct gendisk *del_disk);
+static int rebuild_lun_table(ctlr_info_t *h, int first_time);
 static int deregister_disk(struct gendisk *disk, drive_info_struct *drv,
                           int clear_all);
 
@@ -171,7 +171,6 @@ static void cciss_geometry_inquiry(int ctlr, int logvol,
                        int withirq, sector_t total_size,
                        unsigned int block_size, InquiryData_struct *inq_buff,
                                   drive_info_struct *drv);
-static void cciss_getgeometry(int cntl_num);
 static void __devinit cciss_interrupt_mode(ctlr_info_t *, struct pci_dev *,
                                           __u32);
 static void start_io(ctlr_info_t *h);
@@ -929,8 +928,10 @@ static int cciss_ioctl(struct inode *inode, struct file *filep,
                        return 0;
                }
 
+       case CCISS_DEREGDISK:
+       case CCISS_REGNEWD:
        case CCISS_REVALIDVOLS:
-               return rebuild_lun_table(host, NULL);
+               return rebuild_lun_table(host, 0);
 
        case CCISS_GETLUNINFO:{
                        LogvolInfo_struct luninfo;
@@ -943,12 +944,6 @@ static int cciss_ioctl(struct inode *inode, struct file *filep,
                                return -EFAULT;
                        return 0;
                }
-       case CCISS_DEREGDISK:
-               return rebuild_lun_table(host, disk);
-
-       case CCISS_REGNEWD:
-               return rebuild_lun_table(host, NULL);
-
        case CCISS_PASSTHRU:
                {
                        IOCTL_Command_struct iocommand;
@@ -1134,7 +1129,7 @@ static int cciss_ioctl(struct inode *inode, struct file *filep,
                                if (ioc->Request.Type.Direction == XFER_WRITE) {
                                        if (copy_from_user
                                            (buff[sg_used], data_ptr, sz)) {
-                                               status = -ENOMEM;
+                                               status = -EFAULT;
                                                goto cleanup1;
                                        }
                                } else {
@@ -1292,8 +1287,6 @@ static void cciss_check_queues(ctlr_info_t *h)
                                h->next_to_run = curr_queue;
                                break;
                        }
-               } else {
-                       curr_queue = (curr_queue + 1) % (h->highest_lun + 1);
                }
        }
 }
@@ -1332,15 +1325,84 @@ static void cciss_softirq_done(struct request *rq)
        spin_unlock_irqrestore(&h->lock, flags);
 }
 
+/* This function gets the serial number of a logical drive via
+ * inquiry page 0x83.  Serial no. is 16 bytes.  If the serial
+ * number cannot be had, for whatever reason, 16 bytes of 0xff
+ * are returned instead.
+ */
+static void cciss_get_serial_no(int ctlr, int logvol, int withirq,
+                               unsigned char *serial_no, int buflen)
+{
+#define PAGE_83_INQ_BYTES 64
+       int rc;
+       unsigned char *buf;
+
+       if (buflen > 16)
+               buflen = 16;
+       memset(serial_no, 0xff, buflen);
+       buf = kzalloc(PAGE_83_INQ_BYTES, GFP_KERNEL);
+       if (!buf)
+               return;
+       memset(serial_no, 0, buflen);
+       if (withirq)
+               rc = sendcmd_withirq(CISS_INQUIRY, ctlr, buf,
+                       PAGE_83_INQ_BYTES, 1, logvol, 0x83, TYPE_CMD);
+       else
+               rc = sendcmd(CISS_INQUIRY, ctlr, buf,
+                       PAGE_83_INQ_BYTES, 1, logvol, 0x83, NULL, TYPE_CMD);
+       if (rc == IO_OK)
+               memcpy(serial_no, &buf[8], buflen);
+       kfree(buf);
+       return;
+}
+
+static void cciss_add_disk(ctlr_info_t *h, struct gendisk *disk,
+                               int drv_index)
+{
+       disk->queue = blk_init_queue(do_cciss_request, &h->lock);
+       sprintf(disk->disk_name, "cciss/c%dd%d", h->ctlr, drv_index);
+       disk->major = h->major;
+       disk->first_minor = drv_index << NWD_SHIFT;
+       disk->fops = &cciss_fops;
+       disk->private_data = &h->drv[drv_index];
+
+       /* Set up queue information */
+       blk_queue_bounce_limit(disk->queue, h->pdev->dma_mask);
+
+       /* This is a hardware imposed limit. */
+       blk_queue_max_hw_segments(disk->queue, MAXSGENTRIES);
+
+       /* This is a limit in the driver and could be eliminated. */
+       blk_queue_max_phys_segments(disk->queue, MAXSGENTRIES);
+
+       blk_queue_max_sectors(disk->queue, h->cciss_max_sectors);
+
+       blk_queue_softirq_done(disk->queue, cciss_softirq_done);
+
+       disk->queue->queuedata = h;
+
+       blk_queue_hardsect_size(disk->queue,
+                               h->drv[drv_index].block_size);
+
+       /* Make sure all queue data is written out before */
+       /* setting h->drv[drv_index].queue, as setting this */
+       /* allows the interrupt handler to start the queue */
+       wmb();
+       h->drv[drv_index].queue = disk->queue;
+       add_disk(disk);
+}
+
 /* This function will check the usage_count of the drive to be updated/added.
- * If the usage_count is zero then the drive information will be updated and
- * the disk will be re-registered with the kernel.  If not then it will be
- * left alone for the next reboot.  The exception to this is disk 0 which
- * will always be left registered with the kernel since it is also the
- * controller node.  Any changes to disk 0 will show up on the next
- * reboot.
+ * If the usage_count is zero and it is a heretofore unknown drive, or,
+ * the drive's capacity, geometry, or serial number has changed,
+ * then the drive information will be updated and the disk will be
+ * re-registered with the kernel.  If these conditions don't hold,
+ * then it will be left alone for the next reboot.  The exception to this
+ * is disk 0 which will always be left registered with the kernel since it
+ * is also the controller node.  Any changes to disk 0 will show up on
+ * the next reboot.
  */
-static void cciss_update_drive_info(int ctlr, int drv_index)
+static void cciss_update_drive_info(int ctlr, int drv_index, int first_time)
 {
        ctlr_info_t *h = hba[ctlr];
        struct gendisk *disk;
@@ -1349,16 +1411,81 @@ static void cciss_update_drive_info(int ctlr, int drv_index)
        sector_t total_size;
        unsigned long flags = 0;
        int ret = 0;
+       drive_info_struct *drvinfo;
+       int was_only_controller_node;
+
+       /* Get information about the disk and modify the driver structure */
+       inq_buff = kmalloc(sizeof(InquiryData_struct), GFP_KERNEL);
+       drvinfo = kmalloc(sizeof(*drvinfo), GFP_KERNEL);
+       if (inq_buff == NULL || drvinfo == NULL)
+               goto mem_msg;
+
+       /* See if we're trying to update the "controller node"
+        * this will happen the when the first logical drive gets
+        * created by ACU.
+        */
+       was_only_controller_node = (drv_index == 0 &&
+                               h->drv[0].raid_level == -1);
 
-       /* if the disk already exists then deregister it before proceeding */
-       if (h->drv[drv_index].raid_level != -1) {
+       /* testing to see if 16-byte CDBs are already being used */
+       if (h->cciss_read == CCISS_READ_16) {
+               cciss_read_capacity_16(h->ctlr, drv_index, 1,
+                       &total_size, &block_size);
+
+       } else {
+               cciss_read_capacity(ctlr, drv_index, 1,
+                                   &total_size, &block_size);
+
+               /* if read_capacity returns all F's this volume is >2TB */
+               /* in size so we switch to 16-byte CDB's for all */
+               /* read/write ops */
+               if (total_size == 0xFFFFFFFFULL) {
+                       cciss_read_capacity_16(ctlr, drv_index, 1,
+                       &total_size, &block_size);
+                       h->cciss_read = CCISS_READ_16;
+                       h->cciss_write = CCISS_WRITE_16;
+               } else {
+                       h->cciss_read = CCISS_READ_10;
+                       h->cciss_write = CCISS_WRITE_10;
+               }
+       }
+
+       cciss_geometry_inquiry(ctlr, drv_index, 1, total_size, block_size,
+                              inq_buff, drvinfo);
+       drvinfo->block_size = block_size;
+       drvinfo->nr_blocks = total_size + 1;
+
+       cciss_get_serial_no(ctlr, drv_index, 1, drvinfo->serial_no,
+                       sizeof(drvinfo->serial_no));
+
+       /* Is it the same disk we already know, and nothing's changed? */
+       if (h->drv[drv_index].raid_level != -1 &&
+               ((memcmp(drvinfo->serial_no,
+                               h->drv[drv_index].serial_no, 16) == 0) &&
+               drvinfo->block_size == h->drv[drv_index].block_size &&
+               drvinfo->nr_blocks == h->drv[drv_index].nr_blocks &&
+               drvinfo->heads == h->drv[drv_index].heads &&
+               drvinfo->sectors == h->drv[drv_index].sectors &&
+               drvinfo->cylinders == h->drv[drv_index].cylinders))
+                       /* The disk is unchanged, nothing to update */
+                       goto freeret;
+
+       /* If we get here it's not the same disk, or something's changed,
+        * so we need to * deregister it, and re-register it, if it's not
+        * in use.
+        * If the disk already exists then deregister it before proceeding
+        * (unless it's the first disk (for the controller node).
+        */
+       if (h->drv[drv_index].raid_level != -1 && drv_index != 0) {
+               printk(KERN_WARNING "disk %d has changed.\n", drv_index);
                spin_lock_irqsave(CCISS_LOCK(h->ctlr), flags);
                h->drv[drv_index].busy_configuring = 1;
                spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags);
 
-               /* deregister_disk sets h->drv[drv_index].queue = NULL */
-               /* which keeps the interrupt handler from starting */
-               /* the queue. */
+               /* deregister_disk sets h->drv[drv_index].queue = NULL
+                * which keeps the interrupt handler from starting
+                * the queue.
+                */
                ret = deregister_disk(h->gendisk[drv_index],
                                      &h->drv[drv_index], 0);
                h->drv[drv_index].busy_configuring = 0;
@@ -1366,81 +1493,37 @@ static void cciss_update_drive_info(int ctlr, int drv_index)
 
        /* If the disk is in use return */
        if (ret)
-               return;
+               goto freeret;
 
-       /* Get information about the disk and modify the driver structure */
-       inq_buff = kmalloc(sizeof(InquiryData_struct), GFP_KERNEL);
-       if (inq_buff == NULL)
-               goto mem_msg;
-
-       /* testing to see if 16-byte CDBs are already being used */
-       if (h->cciss_read == CCISS_READ_16) {
-               cciss_read_capacity_16(h->ctlr, drv_index, 1,
-                       &total_size, &block_size);
-               goto geo_inq;
-       }
-
-       cciss_read_capacity(ctlr, drv_index, 1,
-                           &total_size, &block_size);
-
-       /* if read_capacity returns all F's this volume is >2TB in size */
-       /* so we switch to 16-byte CDB's for all read/write ops */
-       if (total_size == 0xFFFFFFFFULL) {
-               cciss_read_capacity_16(ctlr, drv_index, 1,
-               &total_size, &block_size);
-               h->cciss_read = CCISS_READ_16;
-               h->cciss_write = CCISS_WRITE_16;
-       } else {
-               h->cciss_read = CCISS_READ_10;
-               h->cciss_write = CCISS_WRITE_10;
-       }
-geo_inq:
-       cciss_geometry_inquiry(ctlr, drv_index, 1, total_size, block_size,
-                              inq_buff, &h->drv[drv_index]);
+       /* Save the new information from cciss_geometry_inquiry
+        * and serial number inquiry.
+        */
+       h->drv[drv_index].block_size = drvinfo->block_size;
+       h->drv[drv_index].nr_blocks = drvinfo->nr_blocks;
+       h->drv[drv_index].heads = drvinfo->heads;
+       h->drv[drv_index].sectors = drvinfo->sectors;
+       h->drv[drv_index].cylinders = drvinfo->cylinders;
+       h->drv[drv_index].raid_level = drvinfo->raid_level;
+       memcpy(h->drv[drv_index].serial_no, drvinfo->serial_no, 16);
 
        ++h->num_luns;
        disk = h->gendisk[drv_index];
        set_capacity(disk, h->drv[drv_index].nr_blocks);
 
-       /* if it's the controller it's already added */
-       if (drv_index) {
-               disk->queue = blk_init_queue(do_cciss_request, &h->lock);
-               sprintf(disk->disk_name, "cciss/c%dd%d", ctlr, drv_index);
-               disk->major = h->major;
-               disk->first_minor = drv_index << NWD_SHIFT;
-               disk->fops = &cciss_fops;
-               disk->private_data = &h->drv[drv_index];
-
-               /* Set up queue information */
-               blk_queue_bounce_limit(disk->queue, hba[ctlr]->pdev->dma_mask);
-
-               /* This is a hardware imposed limit. */
-               blk_queue_max_hw_segments(disk->queue, MAXSGENTRIES);
-
-               /* This is a limit in the driver and could be eliminated. */
-               blk_queue_max_phys_segments(disk->queue, MAXSGENTRIES);
-
-               blk_queue_max_sectors(disk->queue, h->cciss_max_sectors);
-
-               blk_queue_softirq_done(disk->queue, cciss_softirq_done);
-
-               disk->queue->queuedata = hba[ctlr];
-
-               blk_queue_hardsect_size(disk->queue,
-                                       hba[ctlr]->drv[drv_index].block_size);
-
-               /* Make sure all queue data is written out before */
-               /* setting h->drv[drv_index].queue, as setting this */
-               /* allows the interrupt handler to start the queue */
-               wmb();
-               h->drv[drv_index].queue = disk->queue;
-               add_disk(disk);
-       }
+       /* If it's not disk 0 (drv_index != 0)
+        * or if it was disk 0, but there was previously
+        * no actual corresponding configured logical drive
+        * (raid_leve == -1) then we want to update the
+        * logical drive's information.
+        */
+       if (drv_index || first_time)
+               cciss_add_disk(h, disk, drv_index);
 
-      freeret:
+freeret:
        kfree(inq_buff);
+       kfree(drvinfo);
        return;
-      mem_msg:
+mem_msg:
        printk(KERN_ERR "cciss: out of memory\n");
        goto freeret;
 }
@@ -1450,21 +1533,91 @@ geo_inq:
  * where new drives will be added.  If the index to be returned is greater
  * than the highest_lun index for the controller then highest_lun is set
  * to this new index.  If there are no available indexes then -1 is returned.
+ * "controller_node" is used to know if this is a real logical drive, or just
+ * the controller node, which determines if this counts towards highest_lun.
  */
-static int cciss_find_free_drive_index(int ctlr)
+static int cciss_find_free_drive_index(int ctlr, int controller_node)
 {
        int i;
 
        for (i = 0; i < CISS_MAX_LUN; i++) {
                if (hba[ctlr]->drv[i].raid_level == -1) {
                        if (i > hba[ctlr]->highest_lun)
-                               hba[ctlr]->highest_lun = i;
+                               if (!controller_node)
+                                       hba[ctlr]->highest_lun = i;
                        return i;
                }
        }
        return -1;
 }
 
+/* cciss_add_gendisk finds a free hba[]->drv structure
+ * and allocates a gendisk if needed, and sets the lunid
+ * in the drvinfo structure.   It returns the index into
+ * the ->drv[] array, or -1 if none are free.
+ * is_controller_node indicates whether highest_lun should
+ * count this disk, or if it's only being added to provide
+ * a means to talk to the controller in case no logical
+ * drives have yet been configured.
+ */
+static int cciss_add_gendisk(ctlr_info_t *h, __u32 lunid, int controller_node)
+{
+       int drv_index;
+
+       drv_index = cciss_find_free_drive_index(h->ctlr, controller_node);
+       if (drv_index == -1)
+               return -1;
+       /*Check if the gendisk needs to be allocated */
+       if (!h->gendisk[drv_index]) {
+               h->gendisk[drv_index] =
+                       alloc_disk(1 << NWD_SHIFT);
+               if (!h->gendisk[drv_index]) {
+                       printk(KERN_ERR "cciss%d: could not "
+                               "allocate a new disk %d\n",
+                               h->ctlr, drv_index);
+                       return -1;
+               }
+       }
+       h->drv[drv_index].LunID = lunid;
+
+       /* Don't need to mark this busy because nobody */
+       /* else knows about this disk yet to contend */
+       /* for access to it. */
+       h->drv[drv_index].busy_configuring = 0;
+       wmb();
+       return drv_index;
+}
+
+/* This is for the special case of a controller which
+ * has no logical drives.  In this case, we still need
+ * to register a disk so the controller can be accessed
+ * by the Array Config Utility.
+ */
+static void cciss_add_controller_node(ctlr_info_t *h)
+{
+       struct gendisk *disk;
+       int drv_index;
+
+       if (h->gendisk[0] != NULL) /* already did this? Then bail. */
+               return;
+
+       drv_index = cciss_add_gendisk(h, 0, 1);
+       if (drv_index == -1) {
+               printk(KERN_WARNING "cciss%d: could not "
+                       "add disk 0.\n", h->ctlr);
+               return;
+       }
+       h->drv[drv_index].block_size = 512;
+       h->drv[drv_index].nr_blocks = 0;
+       h->drv[drv_index].heads = 0;
+       h->drv[drv_index].sectors = 0;
+       h->drv[drv_index].cylinders = 0;
+       h->drv[drv_index].raid_level = -1;
+       memset(h->drv[drv_index].serial_no, 0, 16);
+       disk = h->gendisk[drv_index];
+       cciss_add_disk(h, disk, drv_index);
+}
+
 /* This function will add and remove logical drives from the Logical
  * drive array of the controller and maintain persistency of ordering
  * so that mount points are preserved until the next reboot.  This allows
@@ -1472,15 +1625,12 @@ static int cciss_find_free_drive_index(int ctlr)
  * without a re-ordering of those drives.
  * INPUT
  * h           = The controller to perform the operations on
- * del_disk    = The disk to remove if specified.  If the value given
- *               is NULL then no disk is removed.
  */
-static int rebuild_lun_table(ctlr_info_t *h, struct gendisk *del_disk)
+static int rebuild_lun_table(ctlr_info_t *h, int first_time)
 {
        int ctlr = h->ctlr;
        int num_luns;
        ReportLunData_struct *ld_buff = NULL;
-       drive_info_struct *drv = NULL;
        int return_code;
        int listlength = 0;
        int i;
@@ -1489,6 +1639,9 @@ static int rebuild_lun_table(ctlr_info_t *h, struct gendisk *del_disk)
        __u32 lunid = 0;
        unsigned long flags;
 
+       if (!capable(CAP_SYS_RAWIO))
+               return -EPERM;
+
        /* Set busy_configuring flag for this operation */
        spin_lock_irqsave(CCISS_LOCK(h->ctlr), flags);
        if (h->busy_configuring) {
@@ -1496,100 +1649,100 @@ static int rebuild_lun_table(ctlr_info_t *h, struct gendisk *del_disk)
                return -EBUSY;
        }
        h->busy_configuring = 1;
+       spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags);
 
-       /* if del_disk is NULL then we are being called to add a new disk
-        * and update the logical drive table.  If it is not NULL then
-        * we will check if the disk is in use or not.
-        */
-       if (del_disk != NULL) {
-               drv = get_drv(del_disk);
-               drv->busy_configuring = 1;
-               spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags);
-               return_code = deregister_disk(del_disk, drv, 1);
-               drv->busy_configuring = 0;
-               h->busy_configuring = 0;
-               return return_code;
-       } else {
-               spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags);
-               if (!capable(CAP_SYS_RAWIO))
-                       return -EPERM;
+       ld_buff = kzalloc(sizeof(ReportLunData_struct), GFP_KERNEL);
+       if (ld_buff == NULL)
+               goto mem_msg;
 
-               ld_buff = kzalloc(sizeof(ReportLunData_struct), GFP_KERNEL);
-               if (ld_buff == NULL)
-                       goto mem_msg;
-
-               return_code = sendcmd_withirq(CISS_REPORT_LOG, ctlr, ld_buff,
-                                             sizeof(ReportLunData_struct), 0,
-                                             0, 0, TYPE_CMD);
-
-               if (return_code == IO_OK) {
-                       listlength =
-                               be32_to_cpu(*(__be32 *) ld_buff->LUNListLength);
-               } else {        /* reading number of logical volumes failed */
-                       printk(KERN_WARNING "cciss: report logical volume"
-                              " command failed\n");
-                       listlength = 0;
-                       goto freeret;
-               }
+       return_code = sendcmd_withirq(CISS_REPORT_LOG, ctlr, ld_buff,
+                                     sizeof(ReportLunData_struct), 0,
+                                     0, 0, TYPE_CMD);
+
+       if (return_code == IO_OK)
+               listlength = be32_to_cpu(*(__be32 *) ld_buff->LUNListLength);
+       else {  /* reading number of logical volumes failed */
+               printk(KERN_WARNING "cciss: report logical volume"
+                      " command failed\n");
+               listlength = 0;
+               goto freeret;
+       }
+
+       num_luns = listlength / 8;      /* 8 bytes per entry */
+       if (num_luns > CISS_MAX_LUN) {
+               num_luns = CISS_MAX_LUN;
+               printk(KERN_WARNING "cciss: more luns configured"
+                      " on controller than can be handled by"
+                      " this driver.\n");
+       }
 
-               num_luns = listlength / 8;      /* 8 bytes per entry */
-               if (num_luns > CISS_MAX_LUN) {
-                       num_luns = CISS_MAX_LUN;
-                       printk(KERN_WARNING "cciss: more luns configured"
-                              " on controller than can be handled by"
-                              " this driver.\n");
+       if (num_luns == 0)
+               cciss_add_controller_node(h);
+
+       /* Compare controller drive array to driver's drive array
+        * to see if any drives are missing on the controller due
+        * to action of Array Config Utility (user deletes drive)
+        * and deregister logical drives which have disappeared.
+        */
+       for (i = 0; i <= h->highest_lun; i++) {
+               int j;
+               drv_found = 0;
+               for (j = 0; j < num_luns; j++) {
+                       memcpy(&lunid, &ld_buff->LUN[j][0], 4);
+                       lunid = le32_to_cpu(lunid);
+                       if (h->drv[i].LunID == lunid) {
+                               drv_found = 1;
+                               break;
+                       }
+               }
+               if (!drv_found) {
+                       /* Deregister it from the OS, it's gone. */
+                       spin_lock_irqsave(CCISS_LOCK(h->ctlr), flags);
+                       h->drv[i].busy_configuring = 1;
+                       spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags);
+                       return_code = deregister_disk(h->gendisk[i],
+                               &h->drv[i], 1);
+                       h->drv[i].busy_configuring = 0;
                }
+       }
+
+       /* Compare controller drive array to driver's drive array.
+        * Check for updates in the drive information and any new drives
+        * on the controller due to ACU adding logical drives, or changing
+        * a logical drive's size, etc.  Reregister any new/changed drives
+        */
+       for (i = 0; i < num_luns; i++) {
+               int j;
+
+               drv_found = 0;
+
+               memcpy(&lunid, &ld_buff->LUN[i][0], 4);
+               lunid = le32_to_cpu(lunid);
 
-               /* Compare controller drive array to drivers drive array.
-                * Check for updates in the drive information and any new drives
-                * on the controller.
+               /* Find if the LUN is already in the drive array
+                * of the driver.  If so then update its info
+                * if not in use.  If it does not exist then find
+                * the first free index and add it.
                 */
-               for (i = 0; i < num_luns; i++) {
-                       int j;
-
-                       drv_found = 0;
-
-                       lunid = (0xff &
-                                (unsigned int)(ld_buff->LUN[i][3])) << 24;
-                       lunid |= (0xff &
-                                 (unsigned int)(ld_buff->LUN[i][2])) << 16;
-                       lunid |= (0xff &
-                                 (unsigned int)(ld_buff->LUN[i][1])) << 8;
-                       lunid |= 0xff & (unsigned int)(ld_buff->LUN[i][0]);
-
-                       /* Find if the LUN is already in the drive array
-                        * of the controller.  If so then update its info
-                        * if not is use.  If it does not exist then find
-                        * the first free index and add it.
-                        */
-                       for (j = 0; j <= h->highest_lun; j++) {
-                               if (h->drv[j].LunID == lunid) {
-                                       drv_index = j;
-                                       drv_found = 1;
-                               }
+               for (j = 0; j <= h->highest_lun; j++) {
+                       if (h->drv[j].raid_level != -1 &&
+                               h->drv[j].LunID == lunid) {
+                               drv_index = j;
+                               drv_found = 1;
+                               break;
                        }
+               }
 
-                       /* check if the drive was found already in the array */
-                       if (!drv_found) {
-                               drv_index = cciss_find_free_drive_index(ctlr);
-                               if (drv_index == -1)
-                                       goto freeret;
-
-                               /*Check if the gendisk needs to be allocated */
-                               if (!h->gendisk[drv_index]){
-                                       h->gendisk[drv_index] = alloc_disk(1 << NWD_SHIFT);
-                                       if (!h->gendisk[drv_index]){
-                                               printk(KERN_ERR "cciss: could not allocate new disk %d\n", drv_index);
-                                               goto mem_msg;
-                                       }
-                               }
-                       }
-                       h->drv[drv_index].LunID = lunid;
-                       cciss_update_drive_info(ctlr, drv_index);
-               }               /* end for */
-       }                       /* end else */
+               /* check if the drive was found already in the array */
+               if (!drv_found) {
+                       drv_index = cciss_add_gendisk(h, lunid, 0);
+                       if (drv_index == -1)
+                               goto freeret;
+               }
+               cciss_update_drive_info(ctlr, drv_index, first_time);
+       }               /* end for */
 
-      freeret:
+freeret:
        kfree(ld_buff);
        h->busy_configuring = 0;
        /* We return -1 here to tell the ACU that we have registered/updated
@@ -1597,8 +1750,9 @@ static int rebuild_lun_table(ctlr_info_t *h, struct gendisk *del_disk)
         * additional times.
         */
        return -1;
-      mem_msg:
+mem_msg:
        printk(KERN_ERR "cciss: out of memory\n");
+       h->busy_configuring = 0;
        goto freeret;
 }
 
@@ -1654,15 +1808,15 @@ static int deregister_disk(struct gendisk *disk, drive_info_struct *drv,
                 * other than disk 0 we will call put_disk.  We do not
                 * do this for disk 0 as we need it to be able to
                 * configure the controller.
-               */
+                */
                if (clear_all){
                        /* This isn't pretty, but we need to find the
                         * disk in our array and NULL our the pointer.
                         * This is so that we will call alloc_disk if
                         * this index is used again later.
-                       */
+                        */
                        for (i=0; i < CISS_MAX_LUN; i++){
-                               if(h->gendisk[i] == disk){
+                               if (h->gendisk[i] == disk) {
                                        h->gendisk[i] = NULL;
                                        break;
                                }
@@ -1690,7 +1844,7 @@ static int deregister_disk(struct gendisk *disk, drive_info_struct *drv,
                if (drv == h->drv + h->highest_lun) {
                        /* if so, find the new hightest lun */
                        int i, newhighest = -1;
-                       for (i = 0; i < h->highest_lun; i++) {
+                       for (i = 0; i <= h->highest_lun; i++) {
                                /* if the disk has size > 0, it is available */
                                if (h->drv[i].heads)
                                        newhighest = i;
@@ -3201,136 +3355,9 @@ err_out_free_res:
        return err;
 }
 
-/*
- * Gets information about the local volumes attached to the controller.
+/* Function to find the first free pointer into our hba[] array
+ * Returns -1 if no free entries are left.
  */
-static void cciss_getgeometry(int cntl_num)
-{
-       ReportLunData_struct *ld_buff;
-       InquiryData_struct *inq_buff;
-       int return_code;
-       int i;
-       int listlength = 0;
-       __u32 lunid = 0;
-       unsigned block_size;
-       sector_t total_size;
-
-       ld_buff = kzalloc(sizeof(ReportLunData_struct), GFP_KERNEL);
-       if (ld_buff == NULL) {
-               printk(KERN_ERR "cciss: out of memory\n");
-               return;
-       }
-       inq_buff = kmalloc(sizeof(InquiryData_struct), GFP_KERNEL);
-       if (inq_buff == NULL) {
-               printk(KERN_ERR "cciss: out of memory\n");
-               kfree(ld_buff);
-               return;
-       }
-       /* Get the firmware version */
-       return_code = sendcmd(CISS_INQUIRY, cntl_num, inq_buff,
-                             sizeof(InquiryData_struct), 0, 0, 0, NULL,
-                             TYPE_CMD);
-       if (return_code == IO_OK) {
-               hba[cntl_num]->firm_ver[0] = inq_buff->data_byte[32];
-               hba[cntl_num]->firm_ver[1] = inq_buff->data_byte[33];
-               hba[cntl_num]->firm_ver[2] = inq_buff->data_byte[34];
-               hba[cntl_num]->firm_ver[3] = inq_buff->data_byte[35];
-       } else {                /* send command failed */
-
-               printk(KERN_WARNING "cciss: unable to determine firmware"
-                      " version of controller\n");
-       }
-       /* Get the number of logical volumes */
-       return_code = sendcmd(CISS_REPORT_LOG, cntl_num, ld_buff,
-                             sizeof(ReportLunData_struct), 0, 0, 0, NULL,
-                             TYPE_CMD);
-
-       if (return_code == IO_OK) {
-#ifdef CCISS_DEBUG
-               printk("LUN Data\n--------------------------\n");
-#endif                         /* CCISS_DEBUG */
-
-               listlength |=
-                   (0xff & (unsigned int)(ld_buff->LUNListLength[0])) << 24;
-               listlength |=
-                   (0xff & (unsigned int)(ld_buff->LUNListLength[1])) << 16;
-               listlength |=
-                   (0xff & (unsigned int)(ld_buff->LUNListLength[2])) << 8;
-               listlength |= 0xff & (unsigned int)(ld_buff->LUNListLength[3]);
-       } else {                /* reading number of logical volumes failed */
-
-               printk(KERN_WARNING "cciss: report logical volume"
-                      " command failed\n");
-               listlength = 0;
-       }
-       hba[cntl_num]->num_luns = listlength / 8;       // 8 bytes pre entry
-       if (hba[cntl_num]->num_luns > CISS_MAX_LUN) {
-               printk(KERN_ERR
-                      "ciss:  only %d number of logical volumes supported\n",
-                      CISS_MAX_LUN);
-               hba[cntl_num]->num_luns = CISS_MAX_LUN;
-       }
-#ifdef CCISS_DEBUG
-       printk(KERN_DEBUG "Length = %x %x %x %x = %d\n",
-              ld_buff->LUNListLength[0], ld_buff->LUNListLength[1],
-              ld_buff->LUNListLength[2], ld_buff->LUNListLength[3],
-              hba[cntl_num]->num_luns);
-#endif                         /* CCISS_DEBUG */
-
-       hba[cntl_num]->highest_lun = hba[cntl_num]->num_luns - 1;
-       for (i = 0; i < CISS_MAX_LUN; i++) {
-               if (i < hba[cntl_num]->num_luns) {
-                       lunid = (0xff & (unsigned int)(ld_buff->LUN[i][3]))
-                           << 24;
-                       lunid |= (0xff & (unsigned int)(ld_buff->LUN[i][2]))
-                           << 16;
-                       lunid |= (0xff & (unsigned int)(ld_buff->LUN[i][1]))
-                           << 8;
-                       lunid |= 0xff & (unsigned int)(ld_buff->LUN[i][0]);
-
-                       hba[cntl_num]->drv[i].LunID = lunid;
-
-#ifdef CCISS_DEBUG
-                       printk(KERN_DEBUG "LUN[%d]:  %x %x %x %x = %x\n", i,
-                              ld_buff->LUN[i][0], ld_buff->LUN[i][1],
-                              ld_buff->LUN[i][2], ld_buff->LUN[i][3],
-                              hba[cntl_num]->drv[i].LunID);
-#endif                         /* CCISS_DEBUG */
-
-               /* testing to see if 16-byte CDBs are already being used */
-               if(hba[cntl_num]->cciss_read == CCISS_READ_16) {
-                       cciss_read_capacity_16(cntl_num, i, 0,
-                                           &total_size, &block_size);
-                       goto geo_inq;
-               }
-               cciss_read_capacity(cntl_num, i, 0, &total_size, &block_size);
-
-               /* If read_capacity returns all F's the logical is >2TB */
-               /* so we switch to 16-byte CDBs for all read/write ops */
-               if(total_size == 0xFFFFFFFFULL) {
-                       cciss_read_capacity_16(cntl_num, i, 0,
-                       &total_size, &block_size);
-                       hba[cntl_num]->cciss_read = CCISS_READ_16;
-                       hba[cntl_num]->cciss_write = CCISS_WRITE_16;
-               } else {
-                       hba[cntl_num]->cciss_read = CCISS_READ_10;
-                       hba[cntl_num]->cciss_write = CCISS_WRITE_10;
-               }
-geo_inq:
-                       cciss_geometry_inquiry(cntl_num, i, 0, total_size,
-                                              block_size, inq_buff,
-                                              &hba[cntl_num]->drv[i]);
-               } else {
-                       /* initialize raid_level to indicate a free space */
-                       hba[cntl_num]->drv[i].raid_level = -1;
-               }
-       }
-       kfree(ld_buff);
-       kfree(inq_buff);
-}
-
-/* Function to find the first free pointer into our hba[] array */
-/* Returns -1 if no free entries are left.  */
 static int alloc_cciss_hba(void)
 {
        int i;
@@ -3342,11 +3369,6 @@ static int alloc_cciss_hba(void)
                        p = kzalloc(sizeof(ctlr_info_t), GFP_KERNEL);
                        if (!p)
                                goto Enomem;
-                       p->gendisk[0] = alloc_disk(1 << NWD_SHIFT);
-                       if (!p->gendisk[0]) {
-                               kfree(p);
-                               goto Enomem;
-                       }
                        hba[i] = p;
                        return i;
                }
@@ -3474,11 +3496,13 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
               ((hba[i]->nr_cmds + BITS_PER_LONG -
                 1) / BITS_PER_LONG) * sizeof(unsigned long));
 
-#ifdef CCISS_DEBUG
-       printk(KERN_DEBUG "Scanning for drives on controller cciss%d\n", i);
-#endif                         /* CCISS_DEBUG */
-
-       cciss_getgeometry(i);
+       hba[i]->num_luns = 0;
+       hba[i]->highest_lun = -1;
+       for (j = 0; j < CISS_MAX_LUN; j++) {
+               hba[i]->drv[j].raid_level = -1;
+               hba[i]->drv[j].queue = NULL;
+               hba[i]->gendisk[j] = NULL;
+       }
 
        cciss_scsi_setup(i);
 
@@ -3491,76 +3515,10 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
 
        hba[i]->busy_initializing = 0;
 
-       do {
-               drive_info_struct *drv = &(hba[i]->drv[j]);
-               struct gendisk *disk = hba[i]->gendisk[j];
-               struct request_queue *q;
-
-               /* Check if the disk was allocated already */
-               if (!disk){
-                       hba[i]->gendisk[j] = alloc_disk(1 << NWD_SHIFT);
-                       disk = hba[i]->gendisk[j];
-               }
-
-               /* Check that the disk was able to be allocated */
-               if (!disk) {
-                       printk(KERN_ERR "cciss: unable to allocate memory for disk %d\n", j);
-                       goto clean4;
-               }
-
-               q = blk_init_queue(do_cciss_request, &hba[i]->lock);
-               if (!q) {
-                       printk(KERN_ERR
-                              "cciss:  unable to allocate queue for disk %d\n",
-                              j);
-                       goto clean4;
-               }
-               drv->queue = q;
-
-               blk_queue_bounce_limit(q, hba[i]->pdev->dma_mask);
-
-               /* This is a hardware imposed limit. */
-               blk_queue_max_hw_segments(q, MAXSGENTRIES);
-
-               /* This is a limit in the driver and could be eliminated. */
-               blk_queue_max_phys_segments(q, MAXSGENTRIES);
-
-               blk_queue_max_sectors(q, hba[i]->cciss_max_sectors);
-
-               blk_queue_softirq_done(q, cciss_softirq_done);
-
-               q->queuedata = hba[i];
-               sprintf(disk->disk_name, "cciss/c%dd%d", i, j);
-               disk->major = hba[i]->major;
-               disk->first_minor = j << NWD_SHIFT;
-               disk->fops = &cciss_fops;
-               disk->queue = q;
-               disk->private_data = drv;
-               disk->driverfs_dev = &pdev->dev;
-               /* we must register the controller even if no disks exist */
-               /* this is for the online array utilities */
-               if (!drv->heads && j)
-                       continue;
-               blk_queue_hardsect_size(q, drv->block_size);
-               set_capacity(disk, drv->nr_blocks);
-               j++;
-       } while (j <= hba[i]->highest_lun);
-
-       /* Make sure all queue data is written out before */
-       /* interrupt handler, triggered by add_disk,  */
-       /* is allowed to start them. */
-       wmb();
-
-       for (j = 0; j <= hba[i]->highest_lun; j++)
-               add_disk(hba[i]->gendisk[j]);
-
-       /* we must register the controller even if no disks exist */
-       if (hba[i]->highest_lun == -1)
-               add_disk(hba[i]->gendisk[0]);
-
+       rebuild_lun_table(hba[i], 1);
        return 1;
 
-      clean4:
+clean4:
 #ifdef CONFIG_CISS_SCSI_TAPE
        kfree(hba[i]->scsi_rejects.complete);
 #endif
@@ -3575,9 +3533,9 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
                                    hba[i]->errinfo_pool,
                                    hba[i]->errinfo_pool_dhandle);
        free_irq(hba[i]->intr[SIMPLE_MODE_INT], hba[i]);
-      clean2:
+clean2:
        unregister_blkdev(hba[i]->major, hba[i]->devname);
-      clean1:
+clean1:
        hba[i]->busy_initializing = 0;
        /* cleanup any queues that may have been initialized */
        for (j=0; j <= hba[i]->highest_lun; j++){
@@ -3656,7 +3614,9 @@ static void __devexit cciss_remove_one(struct pci_dev *pdev)
                }
        }
 
+#ifdef CONFIG_CISS_SCSI_TAPE
        cciss_unregister_scsi(i);       /* unhook from SCSI subsystem */
+#endif
 
        cciss_shutdown(pdev);
 
index b70988d..24a7efa 100644 (file)
@@ -39,6 +39,8 @@ typedef struct _drive_info_struct
                                   *to prevent it from being opened or it's queue
                                   *from being started.
                                  */
+       __u8 serial_no[16]; /* from inquiry page 0x83, */
+                           /* not necc. null terminated. */
 } drive_info_struct;
 
 #ifdef CONFIG_CISS_SCSI_TAPE
index e4bf9a1..e1233aa 100644 (file)
@@ -358,23 +358,68 @@ find_bus_target_lun(int ctlr, int *bus, int *target, int *lun)
        }
        return (!found);        
 }
+struct scsi2map {
+       char scsi3addr[8];
+       int bus, target, lun;
+};
 
 static int 
 cciss_scsi_add_entry(int ctlr, int hostno, 
-               unsigned char *scsi3addr, int devtype)
+               unsigned char *scsi3addr, int devtype,
+               struct scsi2map *added, int *nadded)
 {
        /* assumes hba[ctlr]->scsi_ctlr->lock is held */ 
        int n = ccissscsi[ctlr].ndevices;
        struct cciss_scsi_dev_t *sd;
+       int i, bus, target, lun;
+       unsigned char addr1[8], addr2[8];
 
        if (n >= CCISS_MAX_SCSI_DEVS_PER_HBA) {
                printk("cciss%d: Too many devices, "
                        "some will be inaccessible.\n", ctlr);
                return -1;
        }
+
+       bus = target = -1;
+       lun = 0;
+       /* Is this device a non-zero lun of a multi-lun device */
+       /* byte 4 of the 8-byte LUN addr will contain the logical unit no. */
+       if (scsi3addr[4] != 0) {
+               /* Search through our list and find the device which */
+               /* has the same 8 byte LUN address, excepting byte 4. */
+               /* Assign the same bus and target for this new LUN. */
+               /* Use the logical unit number from the firmware. */
+               memcpy(addr1, scsi3addr, 8);
+               addr1[4] = 0;
+               for (i = 0; i < n; i++) {
+                       sd = &ccissscsi[ctlr].dev[i];
+                       memcpy(addr2, sd->scsi3addr, 8);
+                       addr2[4] = 0;
+                       /* differ only in byte 4? */
+                       if (memcmp(addr1, addr2, 8) == 0) {
+                               bus = sd->bus;
+                               target = sd->target;
+                               lun = scsi3addr[4];
+                               break;
+                       }
+               }
+       }
+
        sd = &ccissscsi[ctlr].dev[n];
-       if (find_bus_target_lun(ctlr, &sd->bus, &sd->target, &sd->lun) != 0)
-               return -1;
+       if (lun == 0) {
+               if (find_bus_target_lun(ctlr,
+                       &sd->bus, &sd->target, &sd->lun) != 0)
+                       return -1;
+       } else {
+               sd->bus = bus;
+               sd->target = target;
+               sd->lun = lun;
+       }
+       added[*nadded].bus = sd->bus;
+       added[*nadded].target = sd->target;
+       added[*nadded].lun = sd->lun;
+       (*nadded)++;
+
        memcpy(&sd->scsi3addr[0], scsi3addr, 8);
        sd->devtype = devtype;
        ccissscsi[ctlr].ndevices++;
@@ -390,7 +435,8 @@ cciss_scsi_add_entry(int ctlr, int hostno,
 }
 
 static void
-cciss_scsi_remove_entry(int ctlr, int hostno, int entry)
+cciss_scsi_remove_entry(int ctlr, int hostno, int entry,
+       struct scsi2map *removed, int *nremoved)
 {
        /* assumes hba[ctlr]->scsi_ctlr->lock is held */ 
        int i;
@@ -398,6 +444,10 @@ cciss_scsi_remove_entry(int ctlr, int hostno, int entry)
 
        if (entry < 0 || entry >= CCISS_MAX_SCSI_DEVS_PER_HBA) return;
        sd = ccissscsi[ctlr].dev[entry];
+       removed[*nremoved].bus    = sd.bus;
+       removed[*nremoved].target = sd.target;
+       removed[*nremoved].lun    = sd.lun;
+       (*nremoved)++;
        for (i=entry;i<ccissscsi[ctlr].ndevices-1;i++)
                ccissscsi[ctlr].dev[i] = ccissscsi[ctlr].dev[i+1];
        ccissscsi[ctlr].ndevices--;
@@ -417,6 +467,26 @@ cciss_scsi_remove_entry(int ctlr, int hostno, int entry)
        (a)[1] == (b)[1] && \
        (a)[0] == (b)[0])
 
+static void fixup_botched_add(int ctlr, char *scsi3addr)
+{
+       /* called when scsi_add_device fails in order to re-adjust */
+       /* ccissscsi[] to match the mid layer's view. */
+       unsigned long flags;
+       int i, j;
+       CPQ_TAPE_LOCK(ctlr, flags);
+       for (i = 0; i < ccissscsi[ctlr].ndevices; i++) {
+               if (memcmp(scsi3addr,
+                               ccissscsi[ctlr].dev[i].scsi3addr, 8) == 0) {
+                       for (j = i; j < ccissscsi[ctlr].ndevices-1; j++)
+                               ccissscsi[ctlr].dev[j] =
+                                       ccissscsi[ctlr].dev[j+1];
+                       ccissscsi[ctlr].ndevices--;
+                       break;
+               }
+       }
+       CPQ_TAPE_UNLOCK(ctlr, flags);
+}
+
 static int
 adjust_cciss_scsi_table(int ctlr, int hostno,
        struct cciss_scsi_dev_t sd[], int nsds)
@@ -429,13 +499,33 @@ adjust_cciss_scsi_table(int ctlr, int hostno,
        int i,j, found, changes=0;
        struct cciss_scsi_dev_t *csd;
        unsigned long flags;
+       struct scsi2map *added, *removed;
+       int nadded, nremoved;
+       struct Scsi_Host *sh = NULL;
+
+       added = kzalloc(sizeof(*added) * CCISS_MAX_SCSI_DEVS_PER_HBA,
+                       GFP_KERNEL);
+       removed = kzalloc(sizeof(*removed) * CCISS_MAX_SCSI_DEVS_PER_HBA,
+                       GFP_KERNEL);
+
+       if (!added || !removed) {
+               printk(KERN_WARNING "cciss%d: Out of memory in "
+                       "adjust_cciss_scsi_table\n", ctlr);
+               goto free_and_out;
+       }
 
        CPQ_TAPE_LOCK(ctlr, flags);
 
+       if (hostno != -1)  /* if it's not the first time... */
+               sh = ((struct cciss_scsi_adapter_data_t *)
+                       hba[ctlr]->scsi_ctlr)->scsi_host;
+
        /* find any devices in ccissscsi[] that are not in 
           sd[] and remove them from ccissscsi[] */
 
        i = 0;
+       nremoved = 0;
+       nadded = 0;
        while(i<ccissscsi[ctlr].ndevices) {
                csd = &ccissscsi[ctlr].dev[i];
                found=0;
@@ -455,8 +545,9 @@ adjust_cciss_scsi_table(int ctlr, int hostno,
                        /* printk("cciss%d: %s device c%db%dt%dl%d removed.\n",
                                ctlr, scsi_device_type(csd->devtype), hostno,
                                        csd->bus, csd->target, csd->lun); */
-                       cciss_scsi_remove_entry(ctlr, hostno, i);
-                       /* note, i not incremented */
+                       cciss_scsi_remove_entry(ctlr, hostno, i,
+                               removed, &nremoved);
+                       /* remove ^^^, hence i not incremented */
                } 
                else if (found == 1) { /* device is different kind */
                        changes++;
@@ -464,8 +555,15 @@ adjust_cciss_scsi_table(int ctlr, int hostno,
                                "(device type now %s).\n",
                                ctlr, hostno, csd->bus, csd->target, csd->lun,
                                        scsi_device_type(csd->devtype));
+                       cciss_scsi_remove_entry(ctlr, hostno, i,
+                               removed, &nremoved);
+                       /* remove ^^^, hence i not incremented */
+                       if (cciss_scsi_add_entry(ctlr, hostno,
+                               &sd[j].scsi3addr[0], sd[j].devtype,
+                               added, &nadded) != 0)
+                               /* we just removed one, so add can't fail. */
+                                       BUG();
                        csd->devtype = sd[j].devtype;
-                       i++;    /* so just move along. */
                } else          /* device is same as it ever was, */
                        i++;    /* so just move along. */
        }
@@ -489,7 +587,9 @@ adjust_cciss_scsi_table(int ctlr, int hostno,
                if (!found) {
                        changes++;
                        if (cciss_scsi_add_entry(ctlr, hostno, 
-                               &sd[i].scsi3addr[0], sd[i].devtype) != 0)
+
+                               &sd[i].scsi3addr[0], sd[i].devtype,
+                               added, &nadded) != 0)
                                break;
                } else if (found == 1) {
                        /* should never happen... */
@@ -501,9 +601,50 @@ adjust_cciss_scsi_table(int ctlr, int hostno,
        }
        CPQ_TAPE_UNLOCK(ctlr, flags);
 
-       if (!changes) 
-               printk("cciss%d: No device changes detected.\n", ctlr);
+       /* Don't notify scsi mid layer of any changes the first time through */
+       /* (or if there are no changes) scsi_scan_host will do it later the */
+       /* first time through. */
+       if (hostno == -1 || !changes)
+               goto free_and_out;
+
+       /* Notify scsi mid layer of any removed devices */
+       for (i = 0; i < nremoved; i++) {
+               struct scsi_device *sdev =
+                       scsi_device_lookup(sh, removed[i].bus,
+                               removed[i].target, removed[i].lun);
+               if (sdev != NULL) {
+                       scsi_remove_device(sdev);
+                       scsi_device_put(sdev);
+               } else {
+                       /* We don't expect to get here. */
+                       /* future cmds to this device will get selection */
+                       /* timeout as if the device was gone. */
+                       printk(KERN_WARNING "cciss%d: didn't find "
+                               "c%db%dt%dl%d\n for removal.",
+                               ctlr, hostno, removed[i].bus,
+                               removed[i].target, removed[i].lun);
+               }
+       }
+
+       /* Notify scsi mid layer of any added devices */
+       for (i = 0; i < nadded; i++) {
+               int rc;
+               rc = scsi_add_device(sh, added[i].bus,
+                       added[i].target, added[i].lun);
+               if (rc == 0)
+                       continue;
+               printk(KERN_WARNING "cciss%d: scsi_add_device "
+                       "c%db%dt%dl%d failed, device not added.\n",
+                       ctlr, hostno,
+                       added[i].bus, added[i].target, added[i].lun);
+               /* now we have to remove it from ccissscsi, */
+               /* since it didn't get added to scsi mid layer */
+               fixup_botched_add(ctlr, added[i].scsi3addr);
+       }
 
+free_and_out:
+       kfree(added);
+       kfree(removed);
        return 0;
 }
 
@@ -1354,32 +1495,6 @@ cciss_unregister_scsi(int ctlr)
        kfree(sa);
 }
 
-static int 
-cciss_register_scsi(int ctlr)
-{
-       unsigned long flags;
-
-       CPQ_TAPE_LOCK(ctlr, flags);
-
-       /* Since this is really a block driver, the SCSI core may not be 
-          initialized at init time, in which case, calling scsi_register_host
-          would hang.  Instead, we do it later, via /proc filesystem
-          and rc scripts, when we know SCSI core is good to go. */
-
-       /* Only register if SCSI devices are detected. */
-       if (ccissscsi[ctlr].ndevices != 0) {
-               ((struct cciss_scsi_adapter_data_t *) 
-                       hba[ctlr]->scsi_ctlr)->registered = 1;
-               CPQ_TAPE_UNLOCK(ctlr, flags);
-               return cciss_scsi_detect(ctlr);
-       }
-       CPQ_TAPE_UNLOCK(ctlr, flags);
-       printk(KERN_INFO 
-               "cciss%d: No appropriate SCSI device detected, "
-               "SCSI subsystem not engaged.\n", ctlr);
-       return 0;
-}
-
 static int 
 cciss_engage_scsi(int ctlr)
 {
@@ -1391,15 +1506,15 @@ cciss_engage_scsi(int ctlr)
        sa = (struct cciss_scsi_adapter_data_t *) hba[ctlr]->scsi_ctlr;
        stk = &sa->cmd_stack; 
 
-       if (((struct cciss_scsi_adapter_data_t *) 
-               hba[ctlr]->scsi_ctlr)->registered) {
+       if (sa->registered) {
                printk("cciss%d: SCSI subsystem already engaged.\n", ctlr);
                spin_unlock_irqrestore(CCISS_LOCK(ctlr), flags);
                return ENXIO;
        }
+       sa->registered = 1;
        spin_unlock_irqrestore(CCISS_LOCK(ctlr), flags);
        cciss_update_non_disk_devices(ctlr, -1);
-       cciss_register_scsi(ctlr);
+       cciss_scsi_detect(ctlr);
        return 0;
 }
 
@@ -1493,7 +1608,5 @@ static int  cciss_eh_abort_handler(struct scsi_cmnd *scsicmd)
 /* If no tape support, then these become defined out of existence */
 
 #define cciss_scsi_setup(cntl_num)
-#define cciss_unregister_scsi(ctlr)
-#define cciss_register_scsi(ctlr)
 
 #endif /* CONFIG_CISS_SCSI_TAPE */
index 9ae05c5..3ca643c 100644 (file)
@@ -154,8 +154,8 @@ static int blkif_getgeo(struct block_device *bd, struct hd_geometry *hg)
        return 0;
 }
 
-int blkif_ioctl(struct inode *inode, struct file *filep,
-               unsigned command, unsigned long argument)
+static int blkif_ioctl(struct inode *inode, struct file *filep,
+                      unsigned command, unsigned long argument)
 {
        struct blkfront_info *info =
                inode->i_bdev->bd_disk->private_data;
index 192522e..c33bb59 100644 (file)
@@ -134,6 +134,13 @@ static struct usb_device_id blacklist_ids[] = {
 
        /* Dell laptop with Broadcom chip */
        { USB_DEVICE(0x413c, 0x8126), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU },
+       /* Dell Wireless 370 */
+       { USB_DEVICE(0x413c, 0x8156), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU },
+       /* Dell Wireless 410 */
+       { USB_DEVICE(0x413c, 0x8152), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU },
+
+       /* Broadcom 2046 */
+       { USB_DEVICE(0x0a5c, 0x2151), .driver_info = HCI_RESET },
 
        /* Microsoft Wireless Transceiver for Bluetooth 2.0 */
        { USB_DEVICE(0x045e, 0x009c), .driver_info = HCI_RESET },
index a5da356..d9d1b65 100644 (file)
@@ -1436,10 +1436,6 @@ static void cdrom_count_tracks(struct cdrom_device_info *cdi, tracktype* tracks)
        tracks->xa=0;
        tracks->error=0;
        cdinfo(CD_COUNT_TRACKS, "entering cdrom_count_tracks\n"); 
-        if (!CDROM_CAN(CDC_PLAY_AUDIO)) { 
-                tracks->error=CDS_NO_INFO;
-                return;
-        }        
        /* Grab the TOC header so we can see how many tracks there are */
        if ((ret = cdi->ops->audio_ioctl(cdi, CDROMREADTOCHDR, &header))) {
                if (ret == -ENOMEDIUM)
index 71ec426..1e0455b 100644 (file)
@@ -39,8 +39,8 @@
 #include <asm/io.h>
 #include <asm/dma.h>
 #include <asm/delay.h>
-#include <asm/mach/dma.h>
-#include <asm/mach/sysasic.h>
+#include <mach/dma.h>
+#include <mach/sysasic.h>
 
 #define GDROM_DEV_NAME "gdrom"
 #define GD_SESSION_OFFSET 150
index d0ac944..caff851 100644 (file)
@@ -8,7 +8,7 @@ config VT
        bool "Virtual terminal" if EMBEDDED
        depends on !S390
        select INPUT
-       default y if !VIOCONS
+       default y
        ---help---
          If you say Y here, you will get support for terminal devices with
          display and keyboard devices. These are called "virtual" because you
index 8a161c3..6850f6d 100644 (file)
@@ -55,7 +55,6 @@ obj-$(CONFIG_RAW_DRIVER)      += raw.o
 obj-$(CONFIG_SGI_SNSC)         += snsc.o snsc_event.o
 obj-$(CONFIG_MSPEC)            += mspec.o
 obj-$(CONFIG_MMTIMER)          += mmtimer.o
-obj-$(CONFIG_VIOCONS)          += viocons.o
 obj-$(CONFIG_VIOTAPE)          += viotape.o
 obj-$(CONFIG_HVCS)             += hvcs.o
 obj-$(CONFIG_IBM_BSR)          += bsr.o
index 3530ff4..6e763e3 100644 (file)
@@ -1254,7 +1254,7 @@ static int rs_break(struct tty_struct *tty, int break_state)
        unsigned long flags;
 
        if (serial_paranoia_check(info, tty->name, "rs_break"))
-               return;
+               return -EINVAL;
 
        local_irq_save(flags);
        if (break_state == -1)
index 67fbd7a..34d15d5 100644 (file)
@@ -37,7 +37,6 @@
 #include <linux/rtc.h>
 #include <linux/proc_fs.h>
 #include <linux/efi.h>
-#include <linux/smp_lock.h>
 #include <linux/uaccess.h>
 
 #include <asm/system.h>
index d9ce109..9790201 100644 (file)
@@ -6,7 +6,7 @@
  *     Ryan S. Arnold <rsa@us.ibm.com>
  *
  * hvc_console header information:
- *      moved here from include/asm-powerpc/hvconsole.h
+ *      moved here from arch/powerpc/include/asm/hvconsole.h
  *      and drivers/char/hvc_console.c
  *
  * This program is free software; you can redistribute it and/or modify
index 786d518..473d9b1 100644 (file)
  * the hvcs_final_close() function in order to get it out of the spinlock.
  * Rearranged hvcs_close().  Cleaned up some printks and did some housekeeping
  * on the changelog.  Removed local CLC_LENGTH and used HVCS_CLC_LENGTH from
- * include/asm-powerpc/hvcserver.h 
+ * arch/powerepc/include/asm/hvcserver.h
  *
  * 1.3.2 -> 1.3.3 Replaced yield() in hvcs_close() with tty_wait_until_sent() to
  * prevent possible lockup with realtime scheduling as similarily pointed out by
index 1926883..f52931e 100644 (file)
@@ -66,8 +66,8 @@
 #include <linux/ctype.h>
 
 #ifdef CONFIG_PPC_OF
-#include <asm/of_device.h>
-#include <asm/of_platform.h>
+#include <linux/of_device.h>
+#include <linux/of_platform.h>
 #endif
 
 #define PFX "ipmi_si: "
index e30575e..b638403 100644 (file)
@@ -1612,8 +1612,10 @@ static int mxser_ioctl_special(unsigned int cmd, void __user *argp)
 
        switch (cmd) {
        case MOXA_GET_MAJOR:
-               printk(KERN_WARNING "mxser: '%s' uses deprecated ioctl %x, fix "
-                               "your userspace\n", current->comm, cmd);
+               if (printk_ratelimit())
+                       printk(KERN_WARNING "mxser: '%s' uses deprecated ioctl "
+                                       "%x (GET_MAJOR), fix your userspace\n",
+                                       current->comm, cmd);
                return put_user(ttymajor, (int __user *)argp);
 
        case MOXA_CHKPORTENABLE:
index 241cbde..f307f13 100644 (file)
@@ -169,7 +169,7 @@ static int tty_ldisc_get(int disc, struct tty_ldisc *ld)
        if (disc < N_TTY || disc >= NR_LDISCS)
                return -EINVAL;
        err = tty_ldisc_try_get(disc, ld);
-       if (err == -EAGAIN) {
+       if (err < 0) {
                request_module("tty-ldisc-%d", disc);
                err = tty_ldisc_try_get(disc, ld);
        }
diff --git a/drivers/char/viocons.c b/drivers/char/viocons.c
deleted file mode 100644 (file)
index 65fb848..0000000
+++ /dev/null
@@ -1,1171 +0,0 @@
-/* -*- linux-c -*-
- *
- *  drivers/char/viocons.c
- *
- *  iSeries Virtual Terminal
- *
- *  Authors: Dave Boutcher <boutcher@us.ibm.com>
- *           Ryan Arnold <ryanarn@us.ibm.com>
- *           Colin Devilbiss <devilbis@us.ibm.com>
- *           Stephen Rothwell
- *
- * (C) Copyright 2000, 2001, 2002, 2003, 2004 IBM Corporation
- *
- * This program is free software;  you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) anyu 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/kernel.h>
-#include <linux/proc_fs.h>
-#include <linux/errno.h>
-#include <linux/vmalloc.h>
-#include <linux/mm.h>
-#include <linux/console.h>
-#include <linux/module.h>
-#include <asm/uaccess.h>
-#include <linux/init.h>
-#include <linux/wait.h>
-#include <linux/spinlock.h>
-#include <asm/ioctls.h>
-#include <linux/kd.h>
-#include <linux/tty.h>
-#include <linux/tty_flip.h>
-#include <linux/sysrq.h>
-
-#include <asm/firmware.h>
-#include <asm/iseries/vio.h>
-#include <asm/iseries/hv_lp_event.h>
-#include <asm/iseries/hv_call_event.h>
-#include <asm/iseries/hv_lp_config.h>
-#include <asm/iseries/hv_call.h>
-
-#ifdef CONFIG_VT
-#error You must turn off CONFIG_VT to use CONFIG_VIOCONS
-#endif
-
-#define VIOTTY_MAGIC (0x0DCB)
-#define VTTY_PORTS 10
-
-#define VIOCONS_KERN_WARN      KERN_WARNING "viocons: "
-#define VIOCONS_KERN_INFO      KERN_INFO "viocons: "
-
-static DEFINE_SPINLOCK(consolelock);
-static DEFINE_SPINLOCK(consoleloglock);
-
-static int vio_sysrq_pressed;
-
-#define VIOCHAR_NUM_BUF                16
-
-/*
- * Our port information.  We store a pointer to one entry in the
- * tty_driver_data
- */
-static struct port_info {
-       int magic;
-       struct tty_struct *tty;
-       HvLpIndex lp;
-       u8 vcons;
-       u64 seq;        /* sequence number of last HV send */
-       u64 ack;        /* last ack from HV */
-/*
- * When we get writes faster than we can send it to the partition,
- * buffer the data here. Note that used is a bit map of used buffers.
- * It had better have enough bits to hold VIOCHAR_NUM_BUF the bitops assume
- * it is a multiple of unsigned long
- */
-       unsigned long used;
-       u8 *buffer[VIOCHAR_NUM_BUF];
-       int bufferBytes[VIOCHAR_NUM_BUF];
-       int curbuf;
-       int bufferOverflow;
-       int overflowMessage;
-} port_info[VTTY_PORTS];
-
-#define viochar_is_console(pi) ((pi) == &port_info[0])
-#define viochar_port(pi)       ((pi) - &port_info[0])
-
-static void initDataEvent(struct viocharlpevent *viochar, HvLpIndex lp);
-
-static struct tty_driver *viotty_driver;
-
-static void hvlog(char *fmt, ...)
-{
-       int i;
-       unsigned long flags;
-       va_list args;
-       static char buf[256];
-
-       spin_lock_irqsave(&consoleloglock, flags);
-       va_start(args, fmt);
-       i = vscnprintf(buf, sizeof(buf) - 1, fmt, args);
-       va_end(args);
-       buf[i++] = '\r';
-       HvCall_writeLogBuffer(buf, i);
-       spin_unlock_irqrestore(&consoleloglock, flags);
-}
-
-static void hvlogOutput(const char *buf, int count)
-{
-       unsigned long flags;
-       int begin;
-       int index;
-       static const char cr = '\r';
-
-       begin = 0;
-       spin_lock_irqsave(&consoleloglock, flags);
-       for (index = 0; index < count; index++) {
-               if (buf[index] == '\n') {
-                       /*
-                        * Start right after the last '\n' or at the zeroth
-                        * array position and output the number of characters
-                        * including the newline.
-                        */
-                       HvCall_writeLogBuffer(&buf[begin], index - begin + 1);
-                       begin = index + 1;
-                       HvCall_writeLogBuffer(&cr, 1);
-               }
-       }
-       if ((index - begin) > 0)
-               HvCall_writeLogBuffer(&buf[begin], index - begin);
-       spin_unlock_irqrestore(&consoleloglock, flags);
-}
-
-/*
- * Make sure we're pointing to a valid port_info structure.  Shamelessly
- * plagerized from serial.c
- */
-static inline int viotty_paranoia_check(struct port_info *pi,
-                                       char *name, const char *routine)
-{
-       static const char *bad_pi_addr = VIOCONS_KERN_WARN
-               "warning: bad address for port_info struct (%s) in %s\n";
-       static const char *badmagic = VIOCONS_KERN_WARN
-               "warning: bad magic number for port_info struct (%s) in %s\n";
-
-       if ((pi < &port_info[0]) || (viochar_port(pi) > VTTY_PORTS)) {
-               printk(bad_pi_addr, name, routine);
-               return 1;
-       }
-       if (pi->magic != VIOTTY_MAGIC) {
-               printk(badmagic, name, routine);
-               return 1;
-       }
-       return 0;
-}
-
-/*
- * Add data to our pending-send buffers.  
- *
- * NOTE: Don't use printk in here because it gets nastily recursive.
- * hvlog can be used to log to the hypervisor buffer
- */
-static int buffer_add(struct port_info *pi, const char *buf, size_t len)
-{
-       size_t bleft;
-       size_t curlen;
-       const char *curbuf;
-       int nextbuf;
-
-       curbuf = buf;
-       bleft = len;
-       while (bleft > 0) {
-               /*
-                * If there is no space left in the current buffer, we have
-                * filled everything up, so return.  If we filled the previous
-                * buffer we would already have moved to the next one.
-                */
-               if (pi->bufferBytes[pi->curbuf] == VIOCHAR_MAX_DATA) {
-                       hvlog ("\n\rviocons: No overflow buffer available for memcpy().\n");
-                       pi->bufferOverflow++;
-                       pi->overflowMessage = 1;
-                       break;
-               }
-
-               /*
-                * Turn on the "used" bit for this buffer.  If it's already on,
-                * that's fine.
-                */
-               set_bit(pi->curbuf, &pi->used);
-
-               /*
-                * See if this buffer has been allocated.  If not, allocate it.
-                */
-               if (pi->buffer[pi->curbuf] == NULL) {
-                       pi->buffer[pi->curbuf] =
-                           kmalloc(VIOCHAR_MAX_DATA, GFP_ATOMIC);
-                       if (pi->buffer[pi->curbuf] == NULL) {
-                               hvlog("\n\rviocons: kmalloc failed allocating spaces for buffer %d.",
-                                       pi->curbuf);
-                               break;
-                       }
-               }
-
-               /* Figure out how much we can copy into this buffer. */
-               if (bleft < (VIOCHAR_MAX_DATA - pi->bufferBytes[pi->curbuf]))
-                       curlen = bleft;
-               else
-                       curlen = VIOCHAR_MAX_DATA - pi->bufferBytes[pi->curbuf];
-
-               /* Copy the data into the buffer. */
-               memcpy(pi->buffer[pi->curbuf] + pi->bufferBytes[pi->curbuf],
-                               curbuf, curlen);
-
-               pi->bufferBytes[pi->curbuf] += curlen;
-               curbuf += curlen;
-               bleft -= curlen;
-
-               /*
-                * Now see if we've filled this buffer.  If not then
-                * we'll try to use it again later.  If we've filled it
-                * up then we'll advance the curbuf to the next in the
-                * circular queue.
-                */
-               if (pi->bufferBytes[pi->curbuf] == VIOCHAR_MAX_DATA) {
-                       nextbuf = (pi->curbuf + 1) % VIOCHAR_NUM_BUF;
-                       /*
-                        * Move to the next buffer if it hasn't been used yet
-                        */
-                       if (test_bit(nextbuf, &pi->used) == 0)
-                               pi->curbuf = nextbuf;
-               }
-       }
-       return len - bleft;
-}
-
-/*
- * Send pending data
- *
- * NOTE: Don't use printk in here because it gets nastily recursive.
- * hvlog can be used to log to the hypervisor buffer
- */
-static void send_buffers(struct port_info *pi)
-{
-       HvLpEvent_Rc hvrc;
-       int nextbuf;
-       struct viocharlpevent *viochar;
-       unsigned long flags;
-
-       spin_lock_irqsave(&consolelock, flags);
-
-       viochar = (struct viocharlpevent *)
-           vio_get_event_buffer(viomajorsubtype_chario);
-
-       /* Make sure we got a buffer */
-       if (viochar == NULL) {
-               hvlog("\n\rviocons: Can't get viochar buffer in sendBuffers().");
-               spin_unlock_irqrestore(&consolelock, flags);
-               return;
-       }
-
-       if (pi->used == 0) {
-               hvlog("\n\rviocons: in sendbuffers(), but no buffers used.\n");
-               vio_free_event_buffer(viomajorsubtype_chario, viochar);
-               spin_unlock_irqrestore(&consolelock, flags);
-               return;
-       }
-
-       /*
-        * curbuf points to the buffer we're filling.  We want to
-        * start sending AFTER this one.  
-        */
-       nextbuf = (pi->curbuf + 1) % VIOCHAR_NUM_BUF;
-
-       /*
-        * Loop until we find a buffer with the used bit on
-        */
-       while (test_bit(nextbuf, &pi->used) == 0)
-               nextbuf = (nextbuf + 1) % VIOCHAR_NUM_BUF;
-
-       initDataEvent(viochar, pi->lp);
-
-       /*
-        * While we have buffers with data, and our send window
-        * is open, send them
-        */
-       while ((test_bit(nextbuf, &pi->used)) &&
-              ((pi->seq - pi->ack) < VIOCHAR_WINDOW)) {
-               viochar->len = pi->bufferBytes[nextbuf];
-               viochar->event.xCorrelationToken = pi->seq++;
-               viochar->event.xSizeMinus1 =
-                       offsetof(struct viocharlpevent, data) + viochar->len;
-
-               memcpy(viochar->data, pi->buffer[nextbuf], viochar->len);
-
-               hvrc = HvCallEvent_signalLpEvent(&viochar->event);
-               if (hvrc) {
-                       /*
-                        * MUST unlock the spinlock before doing a printk
-                        */
-                       vio_free_event_buffer(viomajorsubtype_chario, viochar);
-                       spin_unlock_irqrestore(&consolelock, flags);
-
-                       printk(VIOCONS_KERN_WARN
-                              "error sending event! return code %d\n",
-                              (int)hvrc);
-                       return;
-               }
-
-               /*
-                * clear the used bit, zero the number of bytes in
-                * this buffer, and move to the next buffer
-                */
-               clear_bit(nextbuf, &pi->used);
-               pi->bufferBytes[nextbuf] = 0;
-               nextbuf = (nextbuf + 1) % VIOCHAR_NUM_BUF;
-       }
-
-       /*
-        * If we have emptied all the buffers, start at 0 again.
-        * this will re-use any allocated buffers
-        */
-       if (pi->used == 0) {
-               pi->curbuf = 0;
-
-               if (pi->overflowMessage)
-                       pi->overflowMessage = 0;
-
-               if (pi->tty) {
-                       tty_wakeup(pi->tty);
-               }
-       }
-
-       vio_free_event_buffer(viomajorsubtype_chario, viochar);
-       spin_unlock_irqrestore(&consolelock, flags);
-}
-
-/*
- * Our internal writer.  Gets called both from the console device and
- * the tty device.  the tty pointer will be NULL if called from the console.
- * Return total number of bytes "written".
- *
- * NOTE: Don't use printk in here because it gets nastily recursive.  hvlog
- * can be used to log to the hypervisor buffer
- */
-static int internal_write(struct port_info *pi, const char *buf, size_t len)
-{
-       HvLpEvent_Rc hvrc;
-       size_t bleft;
-       size_t curlen;
-       const char *curbuf;
-       unsigned long flags;
-       struct viocharlpevent *viochar;
-
-       /*
-        * Write to the hvlog of inbound data are now done prior to
-        * calling internal_write() since internal_write() is only called in
-        * the event that an lp event path is active, which isn't the case for
-        * logging attempts prior to console initialization.
-        *
-        * If there is already data queued for this port, send it prior to
-        * attempting to send any new data.
-        */
-       if (pi->used)
-               send_buffers(pi);
-
-       spin_lock_irqsave(&consolelock, flags);
-
-       viochar = vio_get_event_buffer(viomajorsubtype_chario);
-       if (viochar == NULL) {
-               spin_unlock_irqrestore(&consolelock, flags);
-               hvlog("\n\rviocons: Can't get vio buffer in internal_write().");
-               return -EAGAIN;
-       }
-       initDataEvent(viochar, pi->lp);
-
-       curbuf = buf;
-       bleft = len;
-
-       while ((bleft > 0) && (pi->used == 0) &&
-              ((pi->seq - pi->ack) < VIOCHAR_WINDOW)) {
-               if (bleft > VIOCHAR_MAX_DATA)
-                       curlen = VIOCHAR_MAX_DATA;
-               else
-                       curlen = bleft;
-
-               viochar->event.xCorrelationToken = pi->seq++;
-               memcpy(viochar->data, curbuf, curlen);
-               viochar->len = curlen;
-               viochar->event.xSizeMinus1 =
-                   offsetof(struct viocharlpevent, data) + curlen;
-
-               hvrc = HvCallEvent_signalLpEvent(&viochar->event);
-               if (hvrc) {
-                       hvlog("viocons: error sending event! %d\n", (int)hvrc);
-                       goto out;
-               }
-               curbuf += curlen;
-               bleft -= curlen;
-       }
-
-       /* If we didn't send it all, buffer as much of it as we can. */
-       if (bleft > 0)
-               bleft -= buffer_add(pi, curbuf, bleft);
-out:
-       vio_free_event_buffer(viomajorsubtype_chario, viochar);
-       spin_unlock_irqrestore(&consolelock, flags);
-       return len - bleft;
-}
-
-static struct port_info *get_port_data(struct tty_struct *tty)
-{
-       unsigned long flags;
-       struct port_info *pi;
-
-       spin_lock_irqsave(&consolelock, flags);
-       if (tty) {
-               pi = (struct port_info *)tty->driver_data;
-               if (!pi || viotty_paranoia_check(pi, tty->name,
-                                            "get_port_data")) {
-                       pi = NULL;
-               }
-       } else
-               /*
-                * If this is the console device, use the lp from
-                * the first port entry
-                */
-               pi = &port_info[0];
-       spin_unlock_irqrestore(&consolelock, flags);
-       return pi;
-}
-
-/*
- * Initialize the common fields in a charLpEvent
- */
-static void initDataEvent(struct viocharlpevent *viochar, HvLpIndex lp)
-{
-       struct HvLpEvent *hev = &viochar->event;
-
-       memset(viochar, 0, sizeof(struct viocharlpevent));
-
-       hev->flags = HV_LP_EVENT_VALID | HV_LP_EVENT_DEFERRED_ACK |
-               HV_LP_EVENT_INT;
-       hev->xType = HvLpEvent_Type_VirtualIo;
-       hev->xSubtype = viomajorsubtype_chario | viochardata;
-       hev->xSourceLp = HvLpConfig_getLpIndex();
-       hev->xTargetLp = lp;
-       hev->xSizeMinus1 = sizeof(struct viocharlpevent);
-       hev->xSourceInstanceId = viopath_sourceinst(lp);
-       hev->xTargetInstanceId = viopath_targetinst(lp);
-}
-
-/*
- * early console device write
- */
-static void viocons_write_early(struct console *co, const char *s, unsigned count)
-{
-       hvlogOutput(s, count);
-}
-
-/*
- * console device write
- */
-static void viocons_write(struct console *co, const char *s, unsigned count)
-{
-       int index;
-       int begin;
-       struct port_info *pi;
-
-       static const char cr = '\r';
-
-       /*
-        * Check port data first because the target LP might be valid but
-        * simply not active, in which case we want to hvlog the output.
-        */
-       pi = get_port_data(NULL);
-       if (pi == NULL) {
-               hvlog("\n\rviocons_write: unable to get port data.");
-               return;
-       }
-
-       hvlogOutput(s, count);
-
-       if (!viopath_isactive(pi->lp))
-               return;
-
-       /* 
-        * Any newline character found will cause a
-        * carriage return character to be emitted as well. 
-        */
-       begin = 0;
-       for (index = 0; index < count; index++) {
-               if (s[index] == '\n') {
-                       /* 
-                        * Newline found. Print everything up to and 
-                        * including the newline
-                        */
-                       internal_write(pi, &s[begin], index - begin + 1);
-                       begin = index + 1;
-                       /* Emit a carriage return as well */
-                       internal_write(pi, &cr, 1);
-               }
-       }
-
-       /* If any characters left to write, write them now */
-       if ((index - begin) > 0)
-               internal_write(pi, &s[begin], index - begin);
-}
-
-/*
- * Work out the device associate with this console
- */
-static struct tty_driver *viocons_device(struct console *c, int *index)
-{
-       *index = c->index;
-       return viotty_driver;
-}
-
-/*
- * console device I/O methods
- */
-static struct console viocons_early = {
-       .name = "viocons",
-       .write = viocons_write_early,
-       .flags = CON_PRINTBUFFER,
-       .index = -1,
-};
-
-static struct console viocons = {
-       .name = "viocons",
-       .write = viocons_write,
-       .device = viocons_device,
-       .flags = CON_PRINTBUFFER,
-       .index = -1,
-};
-
-/*
- * TTY Open method
- */
-static int viotty_open(struct tty_struct *tty, struct file *filp)
-{
-       int port;
-       unsigned long flags;
-       struct port_info *pi;
-
-       port = tty->index;
-
-       if ((port < 0) || (port >= VTTY_PORTS))
-               return -ENODEV;
-
-       spin_lock_irqsave(&consolelock, flags);
-
-       pi = &port_info[port];
-       /* If some other TTY is already connected here, reject the open */
-       if ((pi->tty) && (pi->tty != tty)) {
-               spin_unlock_irqrestore(&consolelock, flags);
-               printk(VIOCONS_KERN_WARN
-                      "attempt to open device twice from different ttys\n");
-               return -EBUSY;
-       }
-       tty->driver_data = pi;
-       pi->tty = tty;
-       spin_unlock_irqrestore(&consolelock, flags);
-
-       return 0;
-}
-
-/*
- * TTY Close method
- */
-static void viotty_close(struct tty_struct *tty, struct file *filp)
-{
-       unsigned long flags;
-       struct port_info *pi;
-
-       spin_lock_irqsave(&consolelock, flags);
-       pi = (struct port_info *)tty->driver_data;
-
-       if (!pi || viotty_paranoia_check(pi, tty->name, "viotty_close")) {
-               spin_unlock_irqrestore(&consolelock, flags);
-               return;
-       }
-       if (tty->count == 1)
-               pi->tty = NULL;
-       spin_unlock_irqrestore(&consolelock, flags);
-}
-
-/*
- * TTY Write method
- */
-static int viotty_write(struct tty_struct *tty, const unsigned char *buf,
-               int count)
-{
-       struct port_info *pi;
-
-       pi = get_port_data(tty);
-       if (pi == NULL) {
-               hvlog("\n\rviotty_write: no port data.");
-               return -ENODEV;
-       }
-
-       if (viochar_is_console(pi))
-               hvlogOutput(buf, count);
-
-       /*
-        * If the path to this LP is closed, don't bother doing anything more.
-        * just dump the data on the floor and return count.  For some reason
-        * some user level programs will attempt to probe available tty's and
-        * they'll attempt a viotty_write on an invalid port which maps to an
-        * invalid target lp.  If this is the case then ignore the
-        * viotty_write call and, since the viopath isn't active to this
-        * partition, return count.
-        */
-       if (!viopath_isactive(pi->lp))
-               return count;
-
-       return internal_write(pi, buf, count);
-}
-
-/*
- * TTY put_char method
- */
-static int viotty_put_char(struct tty_struct *tty, unsigned char ch)
-{
-       struct port_info *pi;
-
-       pi = get_port_data(tty);
-       if (pi == NULL)
-               return 0;
-
-       /* This will append '\r' as well if the char is '\n' */
-       if (viochar_is_console(pi))
-               hvlogOutput(&ch, 1);
-
-       if (viopath_isactive(pi->lp))
-               internal_write(pi, &ch, 1);
-       return 1;
-}
-
-/*
- * TTY write_room method
- */
-static int viotty_write_room(struct tty_struct *tty)
-{
-       int i;
-       int room = 0;
-       struct port_info *pi;
-       unsigned long flags;
-
-       spin_lock_irqsave(&consolelock, flags);
-       pi = (struct port_info *)tty->driver_data;
-       if (!pi || viotty_paranoia_check(pi, tty->name, "viotty_write_room")) {
-               spin_unlock_irqrestore(&consolelock, flags);
-               return 0;
-       }
-
-       /* If no buffers are used, return the max size. */
-       if (pi->used == 0) {
-               spin_unlock_irqrestore(&consolelock, flags);
-               return VIOCHAR_MAX_DATA * VIOCHAR_NUM_BUF;
-       }
-
-       /*
-        * We retain the spinlock because we want to get an accurate
-        * count and it can change on us between each operation if we
-        * don't hold the spinlock.
-        */
-       for (i = 0; ((i < VIOCHAR_NUM_BUF) && (room < VIOCHAR_MAX_DATA)); i++)
-               room += (VIOCHAR_MAX_DATA - pi->bufferBytes[i]);
-       spin_unlock_irqrestore(&consolelock, flags);
-
-       if (room > VIOCHAR_MAX_DATA)
-               room = VIOCHAR_MAX_DATA;
-       return room;
-}
-
-/*
- * TTY chars_in_buffer method
- */
-static int viotty_chars_in_buffer(struct tty_struct *tty)
-{
-       return 0;
-}
-
-static int viotty_ioctl(struct tty_struct *tty, struct file *file,
-                       unsigned int cmd, unsigned long arg)
-{
-       switch (cmd) {
-       /*
-        * the ioctls below read/set the flags usually shown in the leds
-        * don't use them - they will go away without warning
-        */
-       case KDGETLED:
-       case KDGKBLED:
-               return put_user(0, (char *)arg);
-
-       case KDSKBLED:
-               return 0;
-       }
-       /* FIXME: WTF is this being called for ??? */
-       lock_kernel();
-       ret =  n_tty_ioctl(tty, file, cmd, arg);
-       unlock_kernel();
-       return ret;
-}
-
-/*
- * Handle an open charLpEvent.  Could be either interrupt or ack
- */
-static void vioHandleOpenEvent(struct HvLpEvent *event)
-{
-       unsigned long flags;
-       struct viocharlpevent *cevent = (struct viocharlpevent *)event;
-       u8 port = cevent->virtual_device;
-       struct port_info *pi;
-       int reject = 0;
-
-       if (hvlpevent_is_ack(event)) {
-               if (port >= VTTY_PORTS)
-                       return;
-
-               spin_lock_irqsave(&consolelock, flags);
-               /* Got the lock, don't cause console output */
-
-               pi = &port_info[port];
-               if (event->xRc == HvLpEvent_Rc_Good) {
-                       pi->seq = pi->ack = 0;
-                       /*
-                        * This line allows connections from the primary
-                        * partition but once one is connected from the
-                        * primary partition nothing short of a reboot
-                        * of linux will allow access from the hosting
-                        * partition again without a required iSeries fix.
-                        */
-                       pi->lp = event->xTargetLp;
-               }
-
-               spin_unlock_irqrestore(&consolelock, flags);
-               if (event->xRc != HvLpEvent_Rc_Good)
-                       printk(VIOCONS_KERN_WARN
-                              "handle_open_event: event->xRc == (%d).\n",
-                              event->xRc);
-
-               if (event->xCorrelationToken != 0) {
-                       atomic_t *aptr= (atomic_t *)event->xCorrelationToken;
-                       atomic_set(aptr, 1);
-               } else
-                       printk(VIOCONS_KERN_WARN
-                              "weird...got open ack without atomic\n");
-               return;
-       }
-
-       /* This had better require an ack, otherwise complain */
-       if (!hvlpevent_need_ack(event)) {
-               printk(VIOCONS_KERN_WARN "viocharopen without ack bit!\n");
-               return;
-       }
-
-       spin_lock_irqsave(&consolelock, flags);
-       /* Got the lock, don't cause console output */
-
-       /* Make sure this is a good virtual tty */
-       if (port >= VTTY_PORTS) {
-               event->xRc = HvLpEvent_Rc_SubtypeError;
-               cevent->subtype_result_code = viorc_openRejected;
-               /*
-                * Flag state here since we can't printk while holding
-                * a spinlock.
-                */
-               reject = 1;
-       } else {
-               pi = &port_info[port];
-               if ((pi->lp != HvLpIndexInvalid) &&
-                               (pi->lp != event->xSourceLp)) {
-                       /*
-                        * If this is tty is already connected to a different
-                        * partition, fail.
-                        */
-                       event->xRc = HvLpEvent_Rc_SubtypeError;
-                       cevent->subtype_result_code = viorc_openRejected;
-                       reject = 2;
-               } else {
-                       pi->lp = event->xSourceLp;
-                       event->xRc = HvLpEvent_Rc_Good;
-                       cevent->subtype_result_code = viorc_good;
-                       pi->seq = pi->ack = 0;
-                       reject = 0;
-               }
-       }
-
-       spin_unlock_irqrestore(&consolelock, flags);
-
-       if (reject == 1)
-               printk(VIOCONS_KERN_WARN "open rejected: bad virtual tty.\n");
-       else if (reject == 2)
-               printk(VIOCONS_KERN_WARN
-                       "open rejected: console in exclusive use by another partition.\n");
-
-       /* Return the acknowledgement */
-       HvCallEvent_ackLpEvent(event);
-}
-
-/*
- * Handle a close charLpEvent.  This should ONLY be an Interrupt because the
- * virtual console should never actually issue a close event to the hypervisor
- * because the virtual console never goes away.  A close event coming from the
- * hypervisor simply means that there are no client consoles connected to the
- * virtual console.
- *
- * Regardless of the number of connections masqueraded on the other side of
- * the hypervisor ONLY ONE close event should be called to accompany the ONE
- * open event that is called.  The close event should ONLY be called when NO
- * MORE connections (masqueraded or not) exist on the other side of the
- * hypervisor.
- */
-static void vioHandleCloseEvent(struct HvLpEvent *event)
-{
-       unsigned long flags;
-       struct viocharlpevent *cevent = (struct viocharlpevent *)event;
-       u8 port = cevent->virtual_device;
-
-       if (hvlpevent_is_int(event)) {
-               if (port >= VTTY_PORTS) {
-                       printk(VIOCONS_KERN_WARN
-                                       "close message from invalid virtual device.\n");
-                       return;
-               }
-
-               /* For closes, just mark the console partition invalid */
-               spin_lock_irqsave(&consolelock, flags);
-               /* Got the lock, don't cause console output */
-
-               if (port_info[port].lp == event->xSourceLp)
-                       port_info[port].lp = HvLpIndexInvalid;
-
-               spin_unlock_irqrestore(&consolelock, flags);
-               printk(VIOCONS_KERN_INFO "close from %d\n", event->xSourceLp);
-       } else
-               printk(VIOCONS_KERN_WARN
-                               "got unexpected close acknowlegement\n");
-}
-
-/*
- * Handle a config charLpEvent.  Could be either interrupt or ack
- */
-static void vioHandleConfig(struct HvLpEvent *event)
-{
-       struct viocharlpevent *cevent = (struct viocharlpevent *)event;
-
-       HvCall_writeLogBuffer(cevent->data, cevent->len);
-
-       if (cevent->data[0] == 0x01)
-               printk(VIOCONS_KERN_INFO "window resized to %d: %d: %d: %d\n",
-                      cevent->data[1], cevent->data[2],
-                      cevent->data[3], cevent->data[4]);
-       else
-               printk(VIOCONS_KERN_WARN "unknown config event\n");
-}
-
-/*
- * Handle a data charLpEvent. 
- */
-static void vioHandleData(struct HvLpEvent *event)
-{
-       struct tty_struct *tty;
-       unsigned long flags;
-       struct viocharlpevent *cevent = (struct viocharlpevent *)event;
-       struct port_info *pi;
-       int index;
-       int num_pushed;
-       u8 port = cevent->virtual_device;
-
-       if (port >= VTTY_PORTS) {
-               printk(VIOCONS_KERN_WARN "data on invalid virtual device %d\n",
-                               port);
-               return;
-       }
-
-       /*
-        * Hold the spinlock so that we don't take an interrupt that
-        * changes tty between the time we fetch the port_info
-        * pointer and the time we paranoia check.
-        */
-       spin_lock_irqsave(&consolelock, flags);
-       pi = &port_info[port];
-
-       /*
-        * Change 05/01/2003 - Ryan Arnold: If a partition other than
-        * the current exclusive partition tries to send us data
-        * events then just drop them on the floor because we don't
-        * want his stinking data.  He isn't authorized to receive
-        * data because he wasn't the first one to get the console,
-        * therefore he shouldn't be allowed to send data either.
-        * This will work without an iSeries fix.
-        */
-       if (pi->lp != event->xSourceLp) {
-               spin_unlock_irqrestore(&consolelock, flags);
-               return;
-       }
-
-       tty = pi->tty;
-       if (tty == NULL) {
-               spin_unlock_irqrestore(&consolelock, flags);
-               printk(VIOCONS_KERN_WARN "no tty for virtual device %d\n",
-                               port);
-               return;
-       }
-
-       if (tty->magic != TTY_MAGIC) {
-               spin_unlock_irqrestore(&consolelock, flags);
-               printk(VIOCONS_KERN_WARN "tty bad magic\n");
-               return;
-       }
-
-       /*
-        * Just to be paranoid, make sure the tty points back to this port
-        */
-       pi = (struct port_info *)tty->driver_data;
-       if (!pi || viotty_paranoia_check(pi, tty->name, "vioHandleData")) {
-               spin_unlock_irqrestore(&consolelock, flags);
-               return;
-       }
-       spin_unlock_irqrestore(&consolelock, flags);
-
-       /*
-        * Change 07/21/2003 - Ryan Arnold: functionality added to
-        * support sysrq utilizing ^O as the sysrq key.  The sysrq
-        * functionality will only work if built into the kernel and
-        * then only if sysrq is enabled through the proc filesystem.
-        */
-       num_pushed = 0;
-       for (index = 0; index < cevent->len; index++) {
-               /*
-                * Will be optimized away if !CONFIG_MAGIC_SYSRQ:
-                */
-               if (sysrq_on()) {
-                       /* 0x0f is the ascii character for ^O */
-                       if (cevent->data[index] == '\x0f') {
-                               vio_sysrq_pressed = 1;
-                               /*
-                                * continue because we don't want to add
-                                * the sysrq key into the data string.
-                                */
-                               continue;
-                       } else if (vio_sysrq_pressed) {
-                               handle_sysrq(cevent->data[index], tty);
-                               vio_sysrq_pressed = 0;
-                               /*
-                                * continue because we don't want to add
-                                * the sysrq sequence into the data string.
-                                */
-                               continue;
-                       }
-               }
-               /*
-                * The sysrq sequence isn't included in this check if
-                * sysrq is enabled and compiled into the kernel because
-                * the sequence will never get inserted into the buffer.
-                * Don't attempt to copy more data into the buffer than we
-                * have room for because it would fail without indication.
-                */
-               if(tty_insert_flip_char(tty, cevent->data[index], TTY_NORMAL) == 0) {
-                       printk(VIOCONS_KERN_WARN "input buffer overflow!\n");
-                       break;
-               }
-               num_pushed++;
-       }
-
-       if (num_pushed)
-               tty_flip_buffer_push(tty);
-}
-
-/*
- * Handle an ack charLpEvent. 
- */
-static void vioHandleAck(struct HvLpEvent *event)
-{
-       struct viocharlpevent *cevent = (struct viocharlpevent *)event;
-       unsigned long flags;
-       u8 port = cevent->virtual_device;
-
-       if (port >= VTTY_PORTS) {
-               printk(VIOCONS_KERN_WARN "data on invalid virtual device\n");
-               return;
-       }
-
-       spin_lock_irqsave(&consolelock, flags);
-       port_info[port].ack = event->xCorrelationToken;
-       spin_unlock_irqrestore(&consolelock, flags);
-
-       if (port_info[port].used)
-               send_buffers(&port_info[port]);
-}
-
-/*
- * Handle charLpEvents and route to the appropriate routine
- */
-static void vioHandleCharEvent(struct HvLpEvent *event)
-{
-       int charminor;
-
-       if (event == NULL)
-               return;
-
-       charminor = event->xSubtype & VIOMINOR_SUBTYPE_MASK;
-       switch (charminor) {
-       case viocharopen:
-               vioHandleOpenEvent(event);
-               break;
-       case viocharclose:
-               vioHandleCloseEvent(event);
-               break;
-       case viochardata:
-               vioHandleData(event);
-               break;
-       case viocharack:
-               vioHandleAck(event);
-               break;
-       case viocharconfig:
-               vioHandleConfig(event);
-               break;
-       default:
-               if (hvlpevent_is_int(event) && hvlpevent_need_ack(event)) {
-                       event->xRc = HvLpEvent_Rc_InvalidSubtype;
-                       HvCallEvent_ackLpEvent(event);
-               }
-       }
-}
-
-/*
- * Send an open event
- */
-static int send_open(HvLpIndex remoteLp, void *sem)
-{
-       return HvCallEvent_signalLpEventFast(remoteLp,
-                       HvLpEvent_Type_VirtualIo,
-                       viomajorsubtype_chario | viocharopen,
-                       HvLpEvent_AckInd_DoAck, HvLpEvent_AckType_ImmediateAck,
-                       viopath_sourceinst(remoteLp),
-                       viopath_targetinst(remoteLp),
-                       (u64)(unsigned long)sem, VIOVERSION << 16,
-                       0, 0, 0, 0);
-}
-
-static const struct tty_operations serial_ops = {
-       .open = viotty_open,
-       .close = viotty_close,
-       .write = viotty_write,
-       .put_char = viotty_put_char,
-       .write_room = viotty_write_room,
-       .chars_in_buffer = viotty_chars_in_buffer,
-       .ioctl = viotty_ioctl,
-};
-
-static int __init viocons_init2(void)
-{
-       atomic_t wait_flag;
-       int rc;
-
-       if (!firmware_has_feature(FW_FEATURE_ISERIES))
-               return -ENODEV;
-
-       /* +2 for fudge */
-       rc = viopath_open(HvLpConfig_getPrimaryLpIndex(),
-                       viomajorsubtype_chario, VIOCHAR_WINDOW + 2);
-       if (rc)
-               printk(VIOCONS_KERN_WARN "error opening to primary %d\n", rc);
-
-       if (viopath_hostLp == HvLpIndexInvalid)
-               vio_set_hostlp();
-
-       /*
-        * And if the primary is not the same as the hosting LP, open to the 
-        * hosting lp
-        */
-       if ((viopath_hostLp != HvLpIndexInvalid) &&
-           (viopath_hostLp != HvLpConfig_getPrimaryLpIndex())) {
-               printk(VIOCONS_KERN_INFO "open path to hosting (%d)\n",
-                               viopath_hostLp);
-               rc = viopath_open(viopath_hostLp, viomajorsubtype_chario,
-                               VIOCHAR_WINDOW + 2);    /* +2 for fudge */
-               if (rc)
-                       printk(VIOCONS_KERN_WARN
-                               "error opening to partition %d: %d\n",
-                               viopath_hostLp, rc);
-       }
-
-       if (vio_setHandler(viomajorsubtype_chario, vioHandleCharEvent) < 0)
-               printk(VIOCONS_KERN_WARN
-                               "error seting handler for console events!\n");
-
-       /*
-        * First, try to open the console to the hosting lp.
-        * Wait on a semaphore for the response.
-        */
-       atomic_set(&wait_flag, 0);
-       if ((viopath_isactive(viopath_hostLp)) &&
-           (send_open(viopath_hostLp, (void *)&wait_flag) == 0)) {
-               printk(VIOCONS_KERN_INFO "hosting partition %d\n",
-                       viopath_hostLp);
-               while (atomic_read(&wait_flag) == 0)
-                       mb();
-               atomic_set(&wait_flag, 0);
-       }
-
-       /*
-        * If we don't have an active console, try the primary
-        */
-       if ((!viopath_isactive(port_info[0].lp)) &&
-           (viopath_isactive(HvLpConfig_getPrimaryLpIndex())) &&
-           (send_open(HvLpConfig_getPrimaryLpIndex(), (void *)&wait_flag)
-            == 0)) {
-               printk(VIOCONS_KERN_INFO "opening console to primary partition\n");
-               while (atomic_read(&wait_flag) == 0)
-                       mb();
-       }
-
-       /* Initialize the tty_driver structure */
-       viotty_driver = alloc_tty_driver(VTTY_PORTS);
-       viotty_driver->owner = THIS_MODULE;
-       viotty_driver->driver_name = "vioconsole";
-       viotty_driver->name = "tty";
-       viotty_driver->name_base = 1;
-       viotty_driver->major = TTY_MAJOR;
-       viotty_driver->minor_start = 1;
-       viotty_driver->type = TTY_DRIVER_TYPE_CONSOLE;
-       viotty_driver->subtype = 1;
-       viotty_driver->init_termios = tty_std_termios;
-       viotty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_RESET_TERMIOS;
-       tty_set_operations(viotty_driver, &serial_ops);
-
-       if (tty_register_driver(viotty_driver)) {
-               printk(VIOCONS_KERN_WARN "couldn't register console driver\n");
-               put_tty_driver(viotty_driver);
-               viotty_driver = NULL;
-       }
-
-       unregister_console(&viocons_early);
-       register_console(&viocons);
-
-       return 0;
-}
-
-static int __init viocons_init(void)
-{
-       int i;
-
-       if (!firmware_has_feature(FW_FEATURE_ISERIES))
-               return -ENODEV;
-
-       printk(VIOCONS_KERN_INFO "registering console\n");
-       for (i = 0; i < VTTY_PORTS; i++) {
-               port_info[i].lp = HvLpIndexInvalid;
-               port_info[i].magic = VIOTTY_MAGIC;
-       }
-       HvCall_setLogBufferFormatAndCodepage(HvCall_LogBuffer_ASCII, 437);
-       add_preferred_console("viocons", 0, NULL);
-       register_console(&viocons_early);
-       return 0;
-}
-
-console_initcall(viocons_init);
-module_init(viocons_init2);
index 82a51f3..1bc00c9 100644 (file)
@@ -916,7 +916,6 @@ int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int lines)
                ws.ws_col = vc->vc_cols;
                ws.ws_ypixel = vc->vc_scan_lines;
 
-               mutex_lock(&vc->vc_tty->termios_mutex);
                spin_lock_irq(&vc->vc_tty->ctrl_lock);
                if ((ws.ws_row != cws->ws_row || ws.ws_col != cws->ws_col))
                        pgrp = get_pid(vc->vc_tty->pgrp);
@@ -926,7 +925,6 @@ int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int lines)
                        put_pid(pgrp);
                }
                *cws = ws;
-               mutex_unlock(&vc->vc_tty->termios_mutex);
        }
 
        if (CON_IS_VISIBLE(vc))
index 8d6a3ff..8a67f16 100644 (file)
@@ -825,6 +825,9 @@ static int cpufreq_add_dev(struct sys_device *sys_dev)
        policy->user_policy.min = policy->cpuinfo.min_freq;
        policy->user_policy.max = policy->cpuinfo.max_freq;
 
+       blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
+                                    CPUFREQ_START, policy);
+
 #ifdef CONFIG_SMP
 
 #ifdef CONFIG_HOTPLUG_CPU
index bc81d6f..2e6d584 100644 (file)
@@ -369,22 +369,33 @@ complete_transaction(struct fw_card *card, int rcode,
        struct response *response = data;
        struct client *client = response->client;
        unsigned long flags;
+       struct fw_cdev_event_response *r = &response->response;
 
-       if (length < response->response.length)
-               response->response.length = length;
+       if (length < r->length)
+               r->length = length;
        if (rcode == RCODE_COMPLETE)
-               memcpy(response->response.data, payload,
-                      response->response.length);
+               memcpy(r->data, payload, r->length);
 
        spin_lock_irqsave(&client->lock, flags);
        list_del(&response->resource.link);
        spin_unlock_irqrestore(&client->lock, flags);
 
-       response->response.type   = FW_CDEV_EVENT_RESPONSE;
-       response->response.rcode  = rcode;
-       queue_event(client, &response->event, &response->response,
-                   sizeof(response->response) + response->response.length,
-                   NULL, 0);
+       r->type   = FW_CDEV_EVENT_RESPONSE;
+       r->rcode  = rcode;
+
+       /*
+        * In the case that sizeof(*r) doesn't align with the position of the
+        * data, and the read is short, preserve an extra copy of the data
+        * to stay compatible with a pre-2.6.27 bug.  Since the bug is harmless
+        * for short reads and some apps depended on it, this is both safe
+        * and prudent for compatibility.
+        */
+       if (r->length <= sizeof(*r) - offsetof(typeof(*r), data))
+               queue_event(client, &response->event, r, sizeof(*r),
+                           r->data, r->length);
+       else
+               queue_event(client, &response->event, r, sizeof(*r) + r->length,
+                           NULL, 0);
 }
 
 static int ioctl_send_request(struct client *client, void *buffer)
index 11f1744..d53fbbf 100644 (file)
@@ -81,4 +81,3 @@ void __init reserve_ibft_region(void)
        if (ibft_addr)
                reserve_bootmem(pos, PAGE_ALIGN(len), BOOTMEM_DEFAULT);
 }
-EXPORT_SYMBOL_GPL(reserve_ibft_region);
index 349ac3d..637bd7f 100644 (file)
@@ -38,7 +38,7 @@
 
 int radeon_no_wb;
 
-MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers\n");
+MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers");
 module_param_named(no_wb, radeon_no_wb, int, 0444);
 
 static int dri_library_name(struct drm_device *dev, char *buf)
index 00ff533..bf4ebfb 100644 (file)
@@ -57,6 +57,16 @@ config SENSORS_ABITUGURU3
          This driver can also be built as a module.  If so, the module
          will be called abituguru3.
 
+config SENSORS_AD7414
+       tristate "Analog Devices AD7414"
+       depends on I2C && EXPERIMENTAL
+       help
+         If you say yes here you get support for the Analog Devices
+         AD7414 temperature monitoring chip.
+
+         This driver can also be built as a module. If so, the module
+         will be called ad7414.
+
 config SENSORS_AD7418
        tristate "Analog Devices AD7416, AD7417 and AD7418"
        depends on I2C && EXPERIMENTAL
@@ -124,7 +134,7 @@ config SENSORS_ADM1031
 
 config SENSORS_ADM9240
        tristate "Analog Devices ADM9240 and compatibles"
-       depends on I2C && EXPERIMENTAL
+       depends on I2C
        select HWMON_VID
        help
          If you say yes here you get support for Analog Devices ADM9240,
@@ -394,13 +404,24 @@ config SENSORS_LM75
        tristate "National Semiconductor LM75 and compatibles"
        depends on I2C
        help
-         If you say yes here you get support for National Semiconductor LM75
-         sensor chips and clones: Dallas Semiconductor DS75 and DS1775 (in
-         9-bit precision mode), and TelCom (now Microchip) TCN75.
+         If you say yes here you get support for one common type of
+         temperature sensor chip, with models including:
+
+               - Dallas Semiconductor DS75 and DS1775
+               - Maxim MAX6625 and MAX6626
+               - Microchip MCP980x
+               - National Semiconductor LM75
+               - NXP's LM75A
+               - ST Microelectronics STDS75
+               - TelCom (now Microchip) TCN75
+               - Texas Instruments TMP100, TMP101, TMP75, TMP175, TMP275
+
+         This driver supports driver model based binding through board
+         specific I2C device tables.
 
-         The DS75 and DS1775 in 10- to 12-bit precision modes will require
-         a force module parameter. The driver will not handle the extra
-         precision anyhow.
+         It also supports the "legacy" style of driver binding.  To use
+         that with some chips which don't replicate LM75 quirks exactly,
+         you may need the "force" module parameter.
 
          This driver can also be built as a module.  If so, the module
          will be called lm75.
@@ -564,8 +585,8 @@ config SENSORS_DME1737
        select HWMON_VID
        help
          If you say yes here you get support for the hardware monitoring
-         and fan control features of the SMSC DME1737 (and compatibles
-         like the Asus A8000) and SCH311x Super-I/O chips.
+         and fan control features of the SMSC DME1737, SCH311x, SCH5027, and
+         Asus A8000 Super-I/O chips.
 
          This driver can also be built as a module.  If so, the module
          will be called dme1737.
index d098677..7943e5c 100644 (file)
@@ -15,6 +15,7 @@ obj-$(CONFIG_SENSORS_W83791D) += w83791d.o
 
 obj-$(CONFIG_SENSORS_ABITUGURU)        += abituguru.o
 obj-$(CONFIG_SENSORS_ABITUGURU3)+= abituguru3.o
+obj-$(CONFIG_SENSORS_AD7414)   += ad7414.o
 obj-$(CONFIG_SENSORS_AD7418)   += ad7418.o
 obj-$(CONFIG_SENSORS_ADM1021)  += adm1021.o
 obj-$(CONFIG_SENSORS_ADM1025)  += adm1025.o
diff --git a/drivers/hwmon/ad7414.c b/drivers/hwmon/ad7414.c
new file mode 100644 (file)
index 0000000..ce8d94f
--- /dev/null
@@ -0,0 +1,268 @@
+/*
+ * An hwmon driver for the Analog Devices AD7414
+ *
+ * Copyright 2006 Stefan Roese <sr at denx.de>, DENX Software Engineering
+ *
+ * Copyright (c) 2008 PIKA Technologies
+ *   Sean MacLennan <smaclennan@pikatech.com>
+ *
+ * Copyright (c) 2008 Spansion Inc.
+ *   Frank Edelhaeuser <frank.edelhaeuser at spansion.com>
+ *   (converted to "new style" I2C driver model, removed checkpatch.pl warnings)
+ *
+ * Based on ad7418.c
+ * Copyright 2006 Tower Technologies, Alessandro Zummo <a.zummo at towertech.it>
+ *
+ * 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/module.h>
+#include <linux/jiffies.h>
+#include <linux/i2c.h>
+#include <linux/hwmon.h>
+#include <linux/hwmon-sysfs.h>
+#include <linux/err.h>
+#include <linux/mutex.h>
+#include <linux/sysfs.h>
+
+
+/* AD7414 registers */
+#define AD7414_REG_TEMP                0x00
+#define AD7414_REG_CONF                0x01
+#define AD7414_REG_T_HIGH      0x02
+#define AD7414_REG_T_LOW       0x03
+
+static u8 AD7414_REG_LIMIT[] = { AD7414_REG_T_HIGH, AD7414_REG_T_LOW };
+
+struct ad7414_data {
+       struct device           *hwmon_dev;
+       struct mutex            lock;   /* atomic read data updates */
+       char                    valid;  /* !=0 if following fields are valid */
+       unsigned long           next_update;    /* In jiffies */
+       s16                     temp_input;     /* Register values */
+       s8                      temps[ARRAY_SIZE(AD7414_REG_LIMIT)];
+};
+
+/* REG: (0.25C/bit, two's complement) << 6 */
+static inline int ad7414_temp_from_reg(s16 reg)
+{
+       /* use integer division instead of equivalent right shift to
+        * guarantee arithmetic shift and preserve the sign
+        */
+       return ((int)reg / 64) * 250;
+}
+
+static inline int ad7414_read(struct i2c_client *client, u8 reg)
+{
+       if (reg == AD7414_REG_TEMP) {
+               int value = i2c_smbus_read_word_data(client, reg);
+               return (value < 0) ? value : swab16(value);
+       } else
+               return i2c_smbus_read_byte_data(client, reg);
+}
+
+static inline int ad7414_write(struct i2c_client *client, u8 reg, u8 value)
+{
+       return i2c_smbus_write_byte_data(client, reg, value);
+}
+
+struct ad7414_data *ad7414_update_device(struct device *dev)
+{
+       struct i2c_client *client = to_i2c_client(dev);
+       struct ad7414_data *data = i2c_get_clientdata(client);
+
+       mutex_lock(&data->lock);
+
+       if (time_after(jiffies, data->next_update) || !data->valid) {
+               int value, i;
+
+               dev_dbg(&client->dev, "starting ad7414 update\n");
+
+               value = ad7414_read(client, AD7414_REG_TEMP);
+               if (value < 0)
+                       dev_dbg(&client->dev, "AD7414_REG_TEMP err %d\n",
+                               value);
+               else
+                       data->temp_input = value;
+
+               for (i = 0; i < ARRAY_SIZE(AD7414_REG_LIMIT); ++i) {
+                       value = ad7414_read(client, AD7414_REG_LIMIT[i]);
+                       if (value < 0)
+                               dev_dbg(&client->dev, "AD7414 reg %d err %d\n",
+                                       AD7414_REG_LIMIT[i], value);
+                       else
+                               data->temps[i] = value;
+               }
+
+               data->next_update = jiffies + HZ + HZ / 2;
+               data->valid = 1;
+       }
+
+       mutex_unlock(&data->lock);
+
+       return data;
+}
+
+static ssize_t show_temp_input(struct device *dev,
+                              struct device_attribute *attr, char *buf)
+{
+       struct ad7414_data *data = ad7414_update_device(dev);
+       return sprintf(buf, "%d\n", ad7414_temp_from_reg(data->temp_input));
+}
+static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp_input, NULL, 0);
+
+static ssize_t show_max_min(struct device *dev, struct device_attribute *attr,
+                         char *buf)
+{
+       int index = to_sensor_dev_attr(attr)->index;
+       struct ad7414_data *data = ad7414_update_device(dev);
+       return sprintf(buf, "%d\n", data->temps[index] * 1000);
+}
+
+static ssize_t set_max_min(struct device *dev,
+                          struct device_attribute *attr,
+                          const char *buf, size_t count)
+{
+       struct i2c_client *client = to_i2c_client(dev);
+       struct ad7414_data *data = i2c_get_clientdata(client);
+       int index = to_sensor_dev_attr(attr)->index;
+       u8 reg = AD7414_REG_LIMIT[index];
+       long temp = simple_strtol(buf, NULL, 10);
+
+       temp = SENSORS_LIMIT(temp, -40000, 85000);
+       temp = (temp + (temp < 0 ? -500 : 500)) / 1000;
+
+       mutex_lock(&data->lock);
+       data->temps[index] = temp;
+       ad7414_write(client, reg, temp);
+       mutex_unlock(&data->lock);
+       return count;
+}
+
+static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO,
+                         show_max_min, set_max_min, 0);
+static SENSOR_DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO,
+                         show_max_min, set_max_min, 1);
+
+static ssize_t show_alarm(struct device *dev, struct device_attribute *attr,
+                         char *buf)
+{
+       int bitnr = to_sensor_dev_attr(attr)->index;
+       struct ad7414_data *data = ad7414_update_device(dev);
+       int value = (data->temp_input >> bitnr) & 1;
+       return sprintf(buf, "%d\n", value);
+}
+
+static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, show_alarm, NULL, 3);
+static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, 4);
+
+static struct attribute *ad7414_attributes[] = {
+       &sensor_dev_attr_temp1_input.dev_attr.attr,
+       &sensor_dev_attr_temp1_max.dev_attr.attr,
+       &sensor_dev_attr_temp1_min.dev_attr.attr,
+       &sensor_dev_attr_temp1_max_alarm.dev_attr.attr,
+       &sensor_dev_attr_temp1_min_alarm.dev_attr.attr,
+       NULL
+};
+
+static const struct attribute_group ad7414_group = {
+       .attrs = ad7414_attributes,
+};
+
+static int ad7414_probe(struct i2c_client *client,
+                       const struct i2c_device_id *dev_id)
+{
+       struct ad7414_data *data;
+       int conf;
+       int err = 0;
+
+       if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA |
+                                    I2C_FUNC_SMBUS_READ_WORD_DATA))
+               goto exit;
+
+       data = kzalloc(sizeof(struct ad7414_data), GFP_KERNEL);
+       if (!data) {
+               err = -ENOMEM;
+               goto exit;
+       }
+
+       i2c_set_clientdata(client, data);
+       mutex_init(&data->lock);
+
+       dev_info(&client->dev, "chip found\n");
+
+       /* Make sure the chip is powered up. */
+       conf = i2c_smbus_read_byte_data(client, AD7414_REG_CONF);
+       if (conf < 0)
+               dev_warn(&client->dev,
+                        "ad7414_probe unable to read config register.\n");
+       else {
+               conf &= ~(1 << 7);
+               i2c_smbus_write_byte_data(client, AD7414_REG_CONF, conf);
+       }
+
+       /* Register sysfs hooks */
+       err = sysfs_create_group(&client->dev.kobj, &ad7414_group);
+       if (err)
+               goto exit_free;
+
+       data->hwmon_dev = hwmon_device_register(&client->dev);
+       if (IS_ERR(data->hwmon_dev)) {
+               err = PTR_ERR(data->hwmon_dev);
+               goto exit_remove;
+       }
+
+       return 0;
+
+exit_remove:
+       sysfs_remove_group(&client->dev.kobj, &ad7414_group);
+exit_free:
+       kfree(data);
+exit:
+       return err;
+}
+
+static int __devexit ad7414_remove(struct i2c_client *client)
+{
+       struct ad7414_data *data = i2c_get_clientdata(client);
+
+       hwmon_device_unregister(data->hwmon_dev);
+       sysfs_remove_group(&client->dev.kobj, &ad7414_group);
+       kfree(data);
+       return 0;
+}
+
+static const struct i2c_device_id ad7414_id[] = {
+       { "ad7414", 0 },
+       {}
+};
+
+static struct i2c_driver ad7414_driver = {
+       .driver = {
+               .name   = "ad7414",
+       },
+       .probe  = ad7414_probe,
+       .remove = __devexit_p(ad7414_remove),
+       .id_table = ad7414_id,
+};
+
+static int __init ad7414_init(void)
+{
+       return i2c_add_driver(&ad7414_driver);
+}
+module_init(ad7414_init);
+
+static void __exit ad7414_exit(void)
+{
+       i2c_del_driver(&ad7414_driver);
+}
+module_exit(ad7414_exit);
+
+MODULE_AUTHOR("Stefan Roese <sr at denx.de>, "
+             "Frank Edelhaeuser <frank.edelhaeuser at spansion.com>");
+
+MODULE_DESCRIPTION("AD7414 driver");
+MODULE_LICENSE("GPL");
index ce4a7cb..3a0b631 100644 (file)
@@ -39,32 +39,20 @@ I2C_CLIENT_INSMOD_1(adt7473);
 #define ADT7473_REG_BASE_ADDR                  0x20
 
 #define ADT7473_REG_VOLT_BASE_ADDR             0x21
-#define ADT7473_REG_VOLT_MAX_ADDR              0x22
 #define ADT7473_REG_VOLT_MIN_BASE_ADDR         0x46
-#define ADT7473_REG_VOLT_MIN_MAX_ADDR          0x49
 
 #define ADT7473_REG_TEMP_BASE_ADDR             0x25
-#define ADT7473_REG_TEMP_MAX_ADDR              0x27
 #define ADT7473_REG_TEMP_LIMITS_BASE_ADDR      0x4E
-#define ADT7473_REG_TEMP_LIMITS_MAX_ADDR       0x53
 #define ADT7473_REG_TEMP_TMIN_BASE_ADDR                0x67
-#define ADT7473_REG_TEMP_TMIN_MAX_ADDR         0x69
 #define ADT7473_REG_TEMP_TMAX_BASE_ADDR                0x6A
-#define ADT7473_REG_TEMP_TMAX_MAX_ADDR         0x6C
 
 #define ADT7473_REG_FAN_BASE_ADDR              0x28
-#define ADT7473_REG_FAN_MAX_ADDR               0x2F
 #define ADT7473_REG_FAN_MIN_BASE_ADDR          0x54
-#define ADT7473_REG_FAN_MIN_MAX_ADDR           0x5B
 
 #define ADT7473_REG_PWM_BASE_ADDR              0x30
-#define ADT7473_REG_PWM_MAX_ADDR               0x32
 #define        ADT7473_REG_PWM_MIN_BASE_ADDR           0x64
-#define ADT7473_REG_PWM_MIN_MAX_ADDR           0x66
 #define ADT7473_REG_PWM_MAX_BASE_ADDR          0x38
-#define ADT7473_REG_PWM_MAX_MAX_ADDR           0x3A
 #define ADT7473_REG_PWM_BHVR_BASE_ADDR         0x5C
-#define ADT7473_REG_PWM_BHVR_MAX_ADDR          0x5E
 #define                ADT7473_PWM_BHVR_MASK           0xE0
 #define                ADT7473_PWM_BHVR_SHIFT          5
 
@@ -102,7 +90,6 @@ I2C_CLIENT_INSMOD_1(adt7473);
 #define                ADT7473_FAN4_ALARM              0x20
 #define                ADT7473_R1T_SHORT               0x40
 #define                ADT7473_R2T_SHORT               0x80
-#define ADT7473_REG_MAX_ADDR                   0x80
 
 #define ALARM2(x)      ((x) << 8)
 
@@ -583,10 +570,9 @@ static ssize_t set_max_duty_at_crit(struct device *dev,
        struct i2c_client *client = to_i2c_client(dev);
        struct adt7473_data *data = i2c_get_clientdata(client);
        int temp = simple_strtol(buf, NULL, 10);
-       temp = temp && 0xFF;
 
        mutex_lock(&data->lock);
-       data->max_duty_at_overheat = temp;
+       data->max_duty_at_overheat = !!temp;
        reg = i2c_smbus_read_byte_data(client, ADT7473_REG_CFG4);
        if (temp)
                reg |= ADT7473_CFG4_MAX_DUTY_AT_OVT;
index 7673f65..cdb8311 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * dme1737.c - Driver for the SMSC DME1737, Asus A8000, and SMSC SCH311x
- *             Super-I/O chips integrated hardware monitoring features.
- * Copyright (c) 2007 Juerg Haefliger <juergh@gmail.com>
+ * dme1737.c - Driver for the SMSC DME1737, Asus A8000, SMSC SCH311x and
+ *             SCH5027 Super-I/O chips integrated hardware monitoring features.
+ * Copyright (c) 2007, 2008 Juerg Haefliger <juergh@gmail.com>
  *
  * This driver is an I2C/ISA hybrid, meaning that it uses the I2C bus to access
- * the chip registers if a DME1737 (or A8000) is found and the ISA bus if a
- * SCH311x chip is found. Both types of chips have very similar hardware
+ * the chip registers if a DME1737, A8000, or SCH5027 is found and the ISA bus
+ * if a SCH311x chip is found. Both types of chips have very similar hardware
  * monitoring capabilities but differ in the way they can be accessed.
  *
  * This program is free software; you can redistribute it and/or modify
@@ -48,11 +48,19 @@ static unsigned short force_id;
 module_param(force_id, ushort, 0);
 MODULE_PARM_DESC(force_id, "Override the detected device ID");
 
+static int probe_all_addr;
+module_param(probe_all_addr, bool, 0);
+MODULE_PARM_DESC(probe_all_addr, "Include probing of non-standard LPC "
+                "addresses");
+
 /* Addresses to scan */
 static const unsigned short normal_i2c[] = {0x2c, 0x2d, 0x2e, I2C_CLIENT_END};
 
 /* Insmod parameters */
-I2C_CLIENT_INSMOD_1(dme1737);
+I2C_CLIENT_INSMOD_2(dme1737, sch5027);
+
+/* ISA chip types */
+enum isa_chips { sch311x = sch5027 + 1 };
 
 /* ---------------------------------------------------------------------
  * Registers
@@ -158,6 +166,7 @@ static const u8 DME1737_BIT_ALARM_FAN[] = {10, 11, 12, 13, 22, 23};
 #define DME1737_VERSTEP                0x88
 #define DME1737_VERSTEP_MASK   0xf8
 #define SCH311X_DEVICE         0x8c
+#define SCH5027_VERSTEP                0x69
 
 /* Length of ISA address segment */
 #define DME1737_EXTENT 2
@@ -176,6 +185,8 @@ struct dme1737_data {
        int valid;                      /* !=0 if following fields are valid */
        unsigned long last_update;      /* in jiffies */
        unsigned long last_vbat;        /* in jiffies */
+       enum chips type;
+       const int *in_nominal;          /* pointer to IN_NOMINAL array */
 
        u8 vid;
        u8 pwm_rr_en;
@@ -210,20 +221,27 @@ struct dme1737_data {
 };
 
 /* Nominal voltage values */
-static const int IN_NOMINAL[] = {5000, 2250, 3300, 5000, 12000, 3300, 3300};
+static const int IN_NOMINAL_DME1737[] = {5000, 2250, 3300, 5000, 12000, 3300,
+                                        3300};
+static const int IN_NOMINAL_SCH311x[] = {2500, 1500, 3300, 5000, 12000, 3300,
+                                        3300};
+static const int IN_NOMINAL_SCH5027[] = {5000, 2250, 3300, 1125, 1125, 3300,
+                                        3300};
+#define IN_NOMINAL(type)       ((type) == sch311x ? IN_NOMINAL_SCH311x : \
+                                (type) == sch5027 ? IN_NOMINAL_SCH5027 : \
+                                IN_NOMINAL_DME1737)
 
 /* Voltage input
  * Voltage inputs have 16 bits resolution, limit values have 8 bits
  * resolution. */
-static inline int IN_FROM_REG(int reg, int ix, int res)
+static inline int IN_FROM_REG(int reg, int nominal, int res)
 {
-       return (reg * IN_NOMINAL[ix] + (3 << (res - 3))) / (3 << (res - 2));
+       return (reg * nominal + (3 << (res - 3))) / (3 << (res - 2));
 }
 
-static inline int IN_TO_REG(int val, int ix)
+static inline int IN_TO_REG(int val, int nominal)
 {
-       return SENSORS_LIMIT((val * 192 + IN_NOMINAL[ix] / 2) /
-                            IN_NOMINAL[ix], 0, 255);
+       return SENSORS_LIMIT((val * 192 + nominal / 2) / nominal, 0, 255);
 }
 
 /* Temperature input
@@ -552,7 +570,10 @@ static struct dme1737_data *dme1737_update_device(struct device *dev)
 
        /* Sample register contents every 1 sec */
        if (time_after(jiffies, data->last_update + HZ) || !data->valid) {
-               data->vid = dme1737_read(client, DME1737_REG_VID) & 0x3f;
+               if (data->type != sch5027) {
+                       data->vid = dme1737_read(client, DME1737_REG_VID) &
+                               0x3f;
+               }
 
                /* In (voltage) registers */
                for (ix = 0; ix < ARRAY_SIZE(data->in); ix++) {
@@ -580,8 +601,10 @@ static struct dme1737_data *dme1737_update_device(struct device *dev)
                                        DME1737_REG_TEMP_MIN(ix));
                        data->temp_max[ix] = dme1737_read(client,
                                        DME1737_REG_TEMP_MAX(ix));
-                       data->temp_offset[ix] = dme1737_read(client,
-                                       DME1737_REG_TEMP_OFFSET(ix));
+                       if (data->type != sch5027) {
+                               data->temp_offset[ix] = dme1737_read(client,
+                                               DME1737_REG_TEMP_OFFSET(ix));
+                       }
                }
 
                /* In and temp LSB registers
@@ -656,9 +679,11 @@ static struct dme1737_data *dme1737_update_device(struct device *dev)
                        data->zone_abs[ix] = dme1737_read(client,
                                        DME1737_REG_ZONE_ABS(ix));
                }
-               for (ix = 0; ix < ARRAY_SIZE(data->zone_hyst); ix++) {
-                       data->zone_hyst[ix] = dme1737_read(client,
+               if (data->type != sch5027) {
+                       for (ix = 0; ix < ARRAY_SIZE(data->zone_hyst); ix++) {
+                               data->zone_hyst[ix] = dme1737_read(client,
                                                DME1737_REG_ZONE_HYST(ix));
+                       }
                }
 
                /* Alarm registers */
@@ -722,13 +747,13 @@ static ssize_t show_in(struct device *dev, struct device_attribute *attr,
 
        switch (fn) {
        case SYS_IN_INPUT:
-               res = IN_FROM_REG(data->in[ix], ix, 16);
+               res = IN_FROM_REG(data->in[ix], data->in_nominal[ix], 16);
                break;
        case SYS_IN_MIN:
-               res = IN_FROM_REG(data->in_min[ix], ix, 8);
+               res = IN_FROM_REG(data->in_min[ix], data->in_nominal[ix], 8);
                break;
        case SYS_IN_MAX:
-               res = IN_FROM_REG(data->in_max[ix], ix, 8);
+               res = IN_FROM_REG(data->in_max[ix], data->in_nominal[ix], 8);
                break;
        case SYS_IN_ALARM:
                res = (data->alarms >> DME1737_BIT_ALARM_IN[ix]) & 0x01;
@@ -755,12 +780,12 @@ static ssize_t set_in(struct device *dev, struct device_attribute *attr,
        mutex_lock(&data->update_lock);
        switch (fn) {
        case SYS_IN_MIN:
-               data->in_min[ix] = IN_TO_REG(val, ix);
+               data->in_min[ix] = IN_TO_REG(val, data->in_nominal[ix]);
                dme1737_write(client, DME1737_REG_IN_MIN(ix),
                              data->in_min[ix]);
                break;
        case SYS_IN_MAX:
-               data->in_max[ix] = IN_TO_REG(val, ix);
+               data->in_max[ix] = IN_TO_REG(val, data->in_nominal[ix]);
                dme1737_write(client, DME1737_REG_IN_MAX(ix),
                              data->in_max[ix]);
                break;
@@ -1153,7 +1178,7 @@ static ssize_t show_pwm(struct device *dev, struct device_attribute *attr,
        return sprintf(buf, "%d\n", res);
 }
 
-static struct attribute *dme1737_attr_pwm[];
+static struct attribute *dme1737_pwm_chmod_attr[];
 static void dme1737_chmod_file(struct device*, struct attribute*, mode_t);
 
 static ssize_t set_pwm(struct device *dev, struct device_attribute *attr,
@@ -1217,7 +1242,7 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute *attr,
                switch (val) {
                case 0:
                        /* Change permissions of pwm[ix] to read-only */
-                       dme1737_chmod_file(dev, dme1737_attr_pwm[ix],
+                       dme1737_chmod_file(dev, dme1737_pwm_chmod_attr[ix],
                                           S_IRUGO);
                        /* Turn fan fully on */
                        data->pwm_config[ix] = PWM_EN_TO_REG(0,
@@ -1232,12 +1257,12 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute *attr,
                        dme1737_write(client, DME1737_REG_PWM_CONFIG(ix),
                                      data->pwm_config[ix]);
                        /* Change permissions of pwm[ix] to read-writeable */
-                       dme1737_chmod_file(dev, dme1737_attr_pwm[ix],
+                       dme1737_chmod_file(dev, dme1737_pwm_chmod_attr[ix],
                                           S_IRUGO | S_IWUSR);
                        break;
                case 2:
                        /* Change permissions of pwm[ix] to read-only */
-                       dme1737_chmod_file(dev, dme1737_attr_pwm[ix],
+                       dme1737_chmod_file(dev, dme1737_pwm_chmod_attr[ix],
                                           S_IRUGO);
                        /* Turn on auto mode using the saved zone channel
                         * assignment */
@@ -1501,9 +1526,9 @@ SENSOR_DEVICE_ATTR_PWM_1TO3(3);
 /* PWMs 5-6 */
 
 #define SENSOR_DEVICE_ATTR_PWM_5TO6(ix) \
-static SENSOR_DEVICE_ATTR_2(pwm##ix, S_IRUGO | S_IWUSR, \
+static SENSOR_DEVICE_ATTR_2(pwm##ix, S_IRUGO, \
        show_pwm, set_pwm, SYS_PWM, ix-1); \
-static SENSOR_DEVICE_ATTR_2(pwm##ix##_freq, S_IRUGO | S_IWUSR, \
+static SENSOR_DEVICE_ATTR_2(pwm##ix##_freq, S_IRUGO, \
        show_pwm, set_pwm, SYS_PWM_FREQ, ix-1); \
 static SENSOR_DEVICE_ATTR_2(pwm##ix##_enable, S_IRUGO, \
        show_pwm, NULL, SYS_PWM_ENABLE, ix-1)
@@ -1517,225 +1542,286 @@ static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm, set_vrm);
 static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL);
 static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);   /* for ISA devices */
 
-#define SENSOR_DEV_ATTR_IN(ix) \
-&sensor_dev_attr_in##ix##_input.dev_attr.attr, \
-&sensor_dev_attr_in##ix##_min.dev_attr.attr, \
-&sensor_dev_attr_in##ix##_max.dev_attr.attr, \
-&sensor_dev_attr_in##ix##_alarm.dev_attr.attr
-
-/* These attributes are read-writeable only if the chip is *not* locked */
-#define SENSOR_DEV_ATTR_TEMP_LOCK(ix) \
-&sensor_dev_attr_temp##ix##_offset.dev_attr.attr
-
-#define SENSOR_DEV_ATTR_TEMP(ix) \
-SENSOR_DEV_ATTR_TEMP_LOCK(ix), \
-&sensor_dev_attr_temp##ix##_input.dev_attr.attr, \
-&sensor_dev_attr_temp##ix##_min.dev_attr.attr, \
-&sensor_dev_attr_temp##ix##_max.dev_attr.attr, \
-&sensor_dev_attr_temp##ix##_alarm.dev_attr.attr, \
-&sensor_dev_attr_temp##ix##_fault.dev_attr.attr
-
-/* These attributes are read-writeable only if the chip is *not* locked */
-#define SENSOR_DEV_ATTR_ZONE_LOCK(ix) \
-&sensor_dev_attr_zone##ix##_auto_point1_temp_hyst.dev_attr.attr, \
-&sensor_dev_attr_zone##ix##_auto_point1_temp.dev_attr.attr, \
-&sensor_dev_attr_zone##ix##_auto_point2_temp.dev_attr.attr, \
-&sensor_dev_attr_zone##ix##_auto_point3_temp.dev_attr.attr
-
-#define SENSOR_DEV_ATTR_ZONE(ix) \
-SENSOR_DEV_ATTR_ZONE_LOCK(ix), \
-&sensor_dev_attr_zone##ix##_auto_channels_temp.dev_attr.attr
-
-#define SENSOR_DEV_ATTR_FAN_1TO4(ix) \
-&sensor_dev_attr_fan##ix##_input.dev_attr.attr, \
-&sensor_dev_attr_fan##ix##_min.dev_attr.attr, \
-&sensor_dev_attr_fan##ix##_alarm.dev_attr.attr, \
-&sensor_dev_attr_fan##ix##_type.dev_attr.attr
-
-#define SENSOR_DEV_ATTR_FAN_5TO6(ix) \
-&sensor_dev_attr_fan##ix##_input.dev_attr.attr, \
-&sensor_dev_attr_fan##ix##_min.dev_attr.attr, \
-&sensor_dev_attr_fan##ix##_alarm.dev_attr.attr, \
-&sensor_dev_attr_fan##ix##_max.dev_attr.attr
-
-/* These attributes are read-writeable only if the chip is *not* locked */
-#define SENSOR_DEV_ATTR_PWM_1TO3_LOCK(ix) \
-&sensor_dev_attr_pwm##ix##_freq.dev_attr.attr, \
-&sensor_dev_attr_pwm##ix##_enable.dev_attr.attr, \
-&sensor_dev_attr_pwm##ix##_ramp_rate.dev_attr.attr, \
-&sensor_dev_attr_pwm##ix##_auto_channels_zone.dev_attr.attr, \
-&sensor_dev_attr_pwm##ix##_auto_pwm_min.dev_attr.attr, \
-&sensor_dev_attr_pwm##ix##_auto_point1_pwm.dev_attr.attr
-
-#define SENSOR_DEV_ATTR_PWM_1TO3(ix) \
-SENSOR_DEV_ATTR_PWM_1TO3_LOCK(ix), \
-&sensor_dev_attr_pwm##ix.dev_attr.attr, \
-&sensor_dev_attr_pwm##ix##_auto_point2_pwm.dev_attr.attr
-
-/* These attributes are read-writeable only if the chip is *not* locked */
-#define SENSOR_DEV_ATTR_PWM_5TO6_LOCK(ix) \
-&sensor_dev_attr_pwm##ix.dev_attr.attr, \
-&sensor_dev_attr_pwm##ix##_freq.dev_attr.attr
-
-#define SENSOR_DEV_ATTR_PWM_5TO6(ix) \
-SENSOR_DEV_ATTR_PWM_5TO6_LOCK(ix), \
-&sensor_dev_attr_pwm##ix##_enable.dev_attr.attr
-
 /* This struct holds all the attributes that are always present and need to be
  * created unconditionally. The attributes that need modification of their
  * permissions are created read-only and write permissions are added or removed
  * on the fly when required */
 static struct attribute *dme1737_attr[] ={
        /* Voltages */
-       SENSOR_DEV_ATTR_IN(0),
-       SENSOR_DEV_ATTR_IN(1),
-       SENSOR_DEV_ATTR_IN(2),
-       SENSOR_DEV_ATTR_IN(3),
-       SENSOR_DEV_ATTR_IN(4),
-       SENSOR_DEV_ATTR_IN(5),
-       SENSOR_DEV_ATTR_IN(6),
+       &sensor_dev_attr_in0_input.dev_attr.attr,
+       &sensor_dev_attr_in0_min.dev_attr.attr,
+       &sensor_dev_attr_in0_max.dev_attr.attr,
+       &sensor_dev_attr_in0_alarm.dev_attr.attr,
+       &sensor_dev_attr_in1_input.dev_attr.attr,
+       &sensor_dev_attr_in1_min.dev_attr.attr,
+       &sensor_dev_attr_in1_max.dev_attr.attr,
+       &sensor_dev_attr_in1_alarm.dev_attr.attr,
+       &sensor_dev_attr_in2_input.dev_attr.attr,
+       &sensor_dev_attr_in2_min.dev_attr.attr,
+       &sensor_dev_attr_in2_max.dev_attr.attr,
+       &sensor_dev_attr_in2_alarm.dev_attr.attr,
+       &sensor_dev_attr_in3_input.dev_attr.attr,
+       &sensor_dev_attr_in3_min.dev_attr.attr,
+       &sensor_dev_attr_in3_max.dev_attr.attr,
+       &sensor_dev_attr_in3_alarm.dev_attr.attr,
+       &sensor_dev_attr_in4_input.dev_attr.attr,
+       &sensor_dev_attr_in4_min.dev_attr.attr,
+       &sensor_dev_attr_in4_max.dev_attr.attr,
+       &sensor_dev_attr_in4_alarm.dev_attr.attr,
+       &sensor_dev_attr_in5_input.dev_attr.attr,
+       &sensor_dev_attr_in5_min.dev_attr.attr,
+       &sensor_dev_attr_in5_max.dev_attr.attr,
+       &sensor_dev_attr_in5_alarm.dev_attr.attr,
+       &sensor_dev_attr_in6_input.dev_attr.attr,
+       &sensor_dev_attr_in6_min.dev_attr.attr,
+       &sensor_dev_attr_in6_max.dev_attr.attr,
+       &sensor_dev_attr_in6_alarm.dev_attr.attr,
+       /* Temperatures */
+       &sensor_dev_attr_temp1_input.dev_attr.attr,
+       &sensor_dev_attr_temp1_min.dev_attr.attr,
+       &sensor_dev_attr_temp1_max.dev_attr.attr,
+       &sensor_dev_attr_temp1_alarm.dev_attr.attr,
+       &sensor_dev_attr_temp1_fault.dev_attr.attr,
+       &sensor_dev_attr_temp2_input.dev_attr.attr,
+       &sensor_dev_attr_temp2_min.dev_attr.attr,
+       &sensor_dev_attr_temp2_max.dev_attr.attr,
+       &sensor_dev_attr_temp2_alarm.dev_attr.attr,
+       &sensor_dev_attr_temp2_fault.dev_attr.attr,
+       &sensor_dev_attr_temp3_input.dev_attr.attr,
+       &sensor_dev_attr_temp3_min.dev_attr.attr,
+       &sensor_dev_attr_temp3_max.dev_attr.attr,
+       &sensor_dev_attr_temp3_alarm.dev_attr.attr,
+       &sensor_dev_attr_temp3_fault.dev_attr.attr,
+       /* Zones */
+       &sensor_dev_attr_zone1_auto_point1_temp.dev_attr.attr,
+       &sensor_dev_attr_zone1_auto_point2_temp.dev_attr.attr,
+       &sensor_dev_attr_zone1_auto_point3_temp.dev_attr.attr,
+       &sensor_dev_attr_zone1_auto_channels_temp.dev_attr.attr,
+       &sensor_dev_attr_zone2_auto_point1_temp.dev_attr.attr,
+       &sensor_dev_attr_zone2_auto_point2_temp.dev_attr.attr,
+       &sensor_dev_attr_zone2_auto_point3_temp.dev_attr.attr,
+       &sensor_dev_attr_zone2_auto_channels_temp.dev_attr.attr,
+       &sensor_dev_attr_zone3_auto_point1_temp.dev_attr.attr,
+       &sensor_dev_attr_zone3_auto_point2_temp.dev_attr.attr,
+       &sensor_dev_attr_zone3_auto_point3_temp.dev_attr.attr,
+       &sensor_dev_attr_zone3_auto_channels_temp.dev_attr.attr,
+       NULL
+};
+
+static const struct attribute_group dme1737_group = {
+       .attrs = dme1737_attr,
+};
+
+/* The following struct holds misc attributes, which are not available in all
+ * chips. Their creation depends on the chip type which is determined during
+ * module load. */
+static struct attribute *dme1737_misc_attr[] = {
        /* Temperatures */
-       SENSOR_DEV_ATTR_TEMP(1),
-       SENSOR_DEV_ATTR_TEMP(2),
-       SENSOR_DEV_ATTR_TEMP(3),
+       &sensor_dev_attr_temp1_offset.dev_attr.attr,
+       &sensor_dev_attr_temp2_offset.dev_attr.attr,
+       &sensor_dev_attr_temp3_offset.dev_attr.attr,
        /* Zones */
-       SENSOR_DEV_ATTR_ZONE(1),
-       SENSOR_DEV_ATTR_ZONE(2),
-       SENSOR_DEV_ATTR_ZONE(3),
+       &sensor_dev_attr_zone1_auto_point1_temp_hyst.dev_attr.attr,
+       &sensor_dev_attr_zone2_auto_point1_temp_hyst.dev_attr.attr,
+       &sensor_dev_attr_zone3_auto_point1_temp_hyst.dev_attr.attr,
        /* Misc */
        &dev_attr_vrm.attr,
        &dev_attr_cpu0_vid.attr,
        NULL
 };
 
-static const struct attribute_group dme1737_group = {
-       .attrs = dme1737_attr,
+static const struct attribute_group dme1737_misc_group = {
+       .attrs = dme1737_misc_attr,
 };
 
 /* The following structs hold the PWM attributes, some of which are optional.
  * Their creation depends on the chip configuration which is determined during
  * module load. */
-static struct attribute *dme1737_attr_pwm1[] = {
-       SENSOR_DEV_ATTR_PWM_1TO3(1),
+static struct attribute *dme1737_pwm1_attr[] = {
+       &sensor_dev_attr_pwm1.dev_attr.attr,
+       &sensor_dev_attr_pwm1_freq.dev_attr.attr,
+       &sensor_dev_attr_pwm1_enable.dev_attr.attr,
+       &sensor_dev_attr_pwm1_ramp_rate.dev_attr.attr,
+       &sensor_dev_attr_pwm1_auto_channels_zone.dev_attr.attr,
+       &sensor_dev_attr_pwm1_auto_point1_pwm.dev_attr.attr,
+       &sensor_dev_attr_pwm1_auto_point2_pwm.dev_attr.attr,
        NULL
 };
-static struct attribute *dme1737_attr_pwm2[] = {
-       SENSOR_DEV_ATTR_PWM_1TO3(2),
+static struct attribute *dme1737_pwm2_attr[] = {
+       &sensor_dev_attr_pwm2.dev_attr.attr,
+       &sensor_dev_attr_pwm2_freq.dev_attr.attr,
+       &sensor_dev_attr_pwm2_enable.dev_attr.attr,
+       &sensor_dev_attr_pwm2_ramp_rate.dev_attr.attr,
+       &sensor_dev_attr_pwm2_auto_channels_zone.dev_attr.attr,
+       &sensor_dev_attr_pwm2_auto_point1_pwm.dev_attr.attr,
+       &sensor_dev_attr_pwm2_auto_point2_pwm.dev_attr.attr,
        NULL
 };
-static struct attribute *dme1737_attr_pwm3[] = {
-       SENSOR_DEV_ATTR_PWM_1TO3(3),
+static struct attribute *dme1737_pwm3_attr[] = {
+       &sensor_dev_attr_pwm3.dev_attr.attr,
+       &sensor_dev_attr_pwm3_freq.dev_attr.attr,
+       &sensor_dev_attr_pwm3_enable.dev_attr.attr,
+       &sensor_dev_attr_pwm3_ramp_rate.dev_attr.attr,
+       &sensor_dev_attr_pwm3_auto_channels_zone.dev_attr.attr,
+       &sensor_dev_attr_pwm3_auto_point1_pwm.dev_attr.attr,
+       &sensor_dev_attr_pwm3_auto_point2_pwm.dev_attr.attr,
        NULL
 };
-static struct attribute *dme1737_attr_pwm5[] = {
-       SENSOR_DEV_ATTR_PWM_5TO6(5),
+static struct attribute *dme1737_pwm5_attr[] = {
+       &sensor_dev_attr_pwm5.dev_attr.attr,
+       &sensor_dev_attr_pwm5_freq.dev_attr.attr,
+       &sensor_dev_attr_pwm5_enable.dev_attr.attr,
        NULL
 };
-static struct attribute *dme1737_attr_pwm6[] = {
-       SENSOR_DEV_ATTR_PWM_5TO6(6),
+static struct attribute *dme1737_pwm6_attr[] = {
+       &sensor_dev_attr_pwm6.dev_attr.attr,
+       &sensor_dev_attr_pwm6_freq.dev_attr.attr,
+       &sensor_dev_attr_pwm6_enable.dev_attr.attr,
        NULL
 };
 
 static const struct attribute_group dme1737_pwm_group[] = {
-       { .attrs = dme1737_attr_pwm1 },
-       { .attrs = dme1737_attr_pwm2 },
-       { .attrs = dme1737_attr_pwm3 },
+       { .attrs = dme1737_pwm1_attr },
+       { .attrs = dme1737_pwm2_attr },
+       { .attrs = dme1737_pwm3_attr },
        { .attrs = NULL },
-       { .attrs = dme1737_attr_pwm5 },
-       { .attrs = dme1737_attr_pwm6 },
+       { .attrs = dme1737_pwm5_attr },
+       { .attrs = dme1737_pwm6_attr },
+};
+
+/* The following struct holds misc PWM attributes, which are not available in
+ * all chips. Their creation depends on the chip type which is determined
+ * during module load. */
+static struct attribute *dme1737_pwm_misc_attr[] = {
+       &sensor_dev_attr_pwm1_auto_pwm_min.dev_attr.attr,
+       &sensor_dev_attr_pwm2_auto_pwm_min.dev_attr.attr,
+       &sensor_dev_attr_pwm3_auto_pwm_min.dev_attr.attr,
 };
 
 /* The following structs hold the fan attributes, some of which are optional.
  * Their creation depends on the chip configuration which is determined during
  * module load. */
-static struct attribute *dme1737_attr_fan1[] = {
-       SENSOR_DEV_ATTR_FAN_1TO4(1),
+static struct attribute *dme1737_fan1_attr[] = {
+       &sensor_dev_attr_fan1_input.dev_attr.attr,
+       &sensor_dev_attr_fan1_min.dev_attr.attr,
+       &sensor_dev_attr_fan1_alarm.dev_attr.attr,
+       &sensor_dev_attr_fan1_type.dev_attr.attr,
        NULL
 };
-static struct attribute *dme1737_attr_fan2[] = {
-       SENSOR_DEV_ATTR_FAN_1TO4(2),
+static struct attribute *dme1737_fan2_attr[] = {
+       &sensor_dev_attr_fan2_input.dev_attr.attr,
+       &sensor_dev_attr_fan2_min.dev_attr.attr,
+       &sensor_dev_attr_fan2_alarm.dev_attr.attr,
+       &sensor_dev_attr_fan2_type.dev_attr.attr,
        NULL
 };
-static struct attribute *dme1737_attr_fan3[] = {
-       SENSOR_DEV_ATTR_FAN_1TO4(3),
+static struct attribute *dme1737_fan3_attr[] = {
+       &sensor_dev_attr_fan3_input.dev_attr.attr,
+       &sensor_dev_attr_fan3_min.dev_attr.attr,
+       &sensor_dev_attr_fan3_alarm.dev_attr.attr,
+       &sensor_dev_attr_fan3_type.dev_attr.attr,
        NULL
 };
-static struct attribute *dme1737_attr_fan4[] = {
-       SENSOR_DEV_ATTR_FAN_1TO4(4),
+static struct attribute *dme1737_fan4_attr[] = {
+       &sensor_dev_attr_fan4_input.dev_attr.attr,
+       &sensor_dev_attr_fan4_min.dev_attr.attr,
+       &sensor_dev_attr_fan4_alarm.dev_attr.attr,
+       &sensor_dev_attr_fan4_type.dev_attr.attr,
        NULL
 };
-static struct attribute *dme1737_attr_fan5[] = {
-       SENSOR_DEV_ATTR_FAN_5TO6(5),
+static struct attribute *dme1737_fan5_attr[] = {
+       &sensor_dev_attr_fan5_input.dev_attr.attr,
+       &sensor_dev_attr_fan5_min.dev_attr.attr,
+       &sensor_dev_attr_fan5_alarm.dev_attr.attr,
+       &sensor_dev_attr_fan5_max.dev_attr.attr,
        NULL
 };
-static struct attribute *dme1737_attr_fan6[] = {
-       SENSOR_DEV_ATTR_FAN_5TO6(6),
+static struct attribute *dme1737_fan6_attr[] = {
+       &sensor_dev_attr_fan6_input.dev_attr.attr,
+       &sensor_dev_attr_fan6_min.dev_attr.attr,
+       &sensor_dev_attr_fan6_alarm.dev_attr.attr,
+       &sensor_dev_attr_fan6_max.dev_attr.attr,
        NULL
 };
 
 static const struct attribute_group dme1737_fan_group[] = {
-       { .attrs = dme1737_attr_fan1 },
-       { .attrs = dme1737_attr_fan2 },
-       { .attrs = dme1737_attr_fan3 },
-       { .attrs = dme1737_attr_fan4 },
-       { .attrs = dme1737_attr_fan5 },
-       { .attrs = dme1737_attr_fan6 },
+       { .attrs = dme1737_fan1_attr },
+       { .attrs = dme1737_fan2_attr },
+       { .attrs = dme1737_fan3_attr },
+       { .attrs = dme1737_fan4_attr },
+       { .attrs = dme1737_fan5_attr },
+       { .attrs = dme1737_fan6_attr },
 };
 
-/* The permissions of all of the following attributes are changed to read-
+/* The permissions of the following zone attributes are changed to read-
  * writeable if the chip is *not* locked. Otherwise they stay read-only. */
-static struct attribute *dme1737_attr_lock[] = {
-       /* Temperatures */
-       SENSOR_DEV_ATTR_TEMP_LOCK(1),
-       SENSOR_DEV_ATTR_TEMP_LOCK(2),
-       SENSOR_DEV_ATTR_TEMP_LOCK(3),
-       /* Zones */
-       SENSOR_DEV_ATTR_ZONE_LOCK(1),
-       SENSOR_DEV_ATTR_ZONE_LOCK(2),
-       SENSOR_DEV_ATTR_ZONE_LOCK(3),
+static struct attribute *dme1737_zone_chmod_attr[] = {
+       &sensor_dev_attr_zone1_auto_point1_temp.dev_attr.attr,
+       &sensor_dev_attr_zone1_auto_point2_temp.dev_attr.attr,
+       &sensor_dev_attr_zone1_auto_point3_temp.dev_attr.attr,
+       &sensor_dev_attr_zone2_auto_point1_temp.dev_attr.attr,
+       &sensor_dev_attr_zone2_auto_point2_temp.dev_attr.attr,
+       &sensor_dev_attr_zone2_auto_point3_temp.dev_attr.attr,
+       &sensor_dev_attr_zone3_auto_point1_temp.dev_attr.attr,
+       &sensor_dev_attr_zone3_auto_point2_temp.dev_attr.attr,
+       &sensor_dev_attr_zone3_auto_point3_temp.dev_attr.attr,
        NULL
 };
 
-static const struct attribute_group dme1737_lock_group = {
-       .attrs = dme1737_attr_lock,
+static const struct attribute_group dme1737_zone_chmod_group = {
+       .attrs = dme1737_zone_chmod_attr,
 };
 
 /* The permissions of the following PWM attributes are changed to read-
  * writeable if the chip is *not* locked and the respective PWM is available.
  * Otherwise they stay read-only. */
-static struct attribute *dme1737_attr_pwm1_lock[] = {
-       SENSOR_DEV_ATTR_PWM_1TO3_LOCK(1),
+static struct attribute *dme1737_pwm1_chmod_attr[] = {
+       &sensor_dev_attr_pwm1_freq.dev_attr.attr,
+       &sensor_dev_attr_pwm1_enable.dev_attr.attr,
+       &sensor_dev_attr_pwm1_ramp_rate.dev_attr.attr,
+       &sensor_dev_attr_pwm1_auto_channels_zone.dev_attr.attr,
+       &sensor_dev_attr_pwm1_auto_point1_pwm.dev_attr.attr,
        NULL
 };
-static struct attribute *dme1737_attr_pwm2_lock[] = {
-       SENSOR_DEV_ATTR_PWM_1TO3_LOCK(2),
+static struct attribute *dme1737_pwm2_chmod_attr[] = {
+       &sensor_dev_attr_pwm2_freq.dev_attr.attr,
+       &sensor_dev_attr_pwm2_enable.dev_attr.attr,
+       &sensor_dev_attr_pwm2_ramp_rate.dev_attr.attr,
+       &sensor_dev_attr_pwm2_auto_channels_zone.dev_attr.attr,
+       &sensor_dev_attr_pwm2_auto_point1_pwm.dev_attr.attr,
        NULL
 };
-static struct attribute *dme1737_attr_pwm3_lock[] = {
-       SENSOR_DEV_ATTR_PWM_1TO3_LOCK(3),
+static struct attribute *dme1737_pwm3_chmod_attr[] = {
+       &sensor_dev_attr_pwm3_freq.dev_attr.attr,
+       &sensor_dev_attr_pwm3_enable.dev_attr.attr,
+       &sensor_dev_attr_pwm3_ramp_rate.dev_attr.attr,
+       &sensor_dev_attr_pwm3_auto_channels_zone.dev_attr.attr,
+       &sensor_dev_attr_pwm3_auto_point1_pwm.dev_attr.attr,
        NULL
 };
-static struct attribute *dme1737_attr_pwm5_lock[] = {
-       SENSOR_DEV_ATTR_PWM_5TO6_LOCK(5),
+static struct attribute *dme1737_pwm5_chmod_attr[] = {
+       &sensor_dev_attr_pwm5.dev_attr.attr,
+       &sensor_dev_attr_pwm5_freq.dev_attr.attr,
        NULL
 };
-static struct attribute *dme1737_attr_pwm6_lock[] = {
-       SENSOR_DEV_ATTR_PWM_5TO6_LOCK(6),
+static struct attribute *dme1737_pwm6_chmod_attr[] = {
+       &sensor_dev_attr_pwm6.dev_attr.attr,
+       &sensor_dev_attr_pwm6_freq.dev_attr.attr,
        NULL
 };
 
-static const struct attribute_group dme1737_pwm_lock_group[] = {
-       { .attrs = dme1737_attr_pwm1_lock },
-       { .attrs = dme1737_attr_pwm2_lock },
-       { .attrs = dme1737_attr_pwm3_lock },
+static const struct attribute_group dme1737_pwm_chmod_group[] = {
+       { .attrs = dme1737_pwm1_chmod_attr },
+       { .attrs = dme1737_pwm2_chmod_attr },
+       { .attrs = dme1737_pwm3_chmod_attr },
        { .attrs = NULL },
-       { .attrs = dme1737_attr_pwm5_lock },
-       { .attrs = dme1737_attr_pwm6_lock },
+       { .attrs = dme1737_pwm5_chmod_attr },
+       { .attrs = dme1737_pwm6_chmod_attr },
 };
 
 /* Pwm[1-3] are read-writeable if the associated pwm is in manual mode and the
  * chip is not locked. Otherwise they are read-only. */
-static struct attribute *dme1737_attr_pwm[] = {
+static struct attribute *dme1737_pwm_chmod_attr[] = {
        &sensor_dev_attr_pwm1.dev_attr.attr,
        &sensor_dev_attr_pwm2.dev_attr.attr,
        &sensor_dev_attr_pwm3.dev_attr.attr,
@@ -1809,9 +1895,17 @@ static void dme1737_remove_files(struct device *dev)
                if (data->has_pwm & (1 << ix)) {
                        sysfs_remove_group(&dev->kobj,
                                           &dme1737_pwm_group[ix]);
+                       if (data->type != sch5027 && ix < 3) {
+                               sysfs_remove_file(&dev->kobj,
+                                                 dme1737_pwm_misc_attr[ix]);
+                       }
                }
        }
 
+       if (data->type != sch5027) {
+               sysfs_remove_group(&dev->kobj, &dme1737_misc_group);
+       }
+
        sysfs_remove_group(&dev->kobj, &dme1737_group);
 
        if (!data->client.driver) {
@@ -1835,6 +1929,13 @@ static int dme1737_create_files(struct device *dev)
                goto exit_remove;
        }
 
+       /* Create misc sysfs attributes */
+       if ((data->type != sch5027) &&
+           (err = sysfs_create_group(&dev->kobj,
+                                     &dme1737_misc_group))) {
+               goto exit_remove;
+       }
+
        /* Create fan sysfs attributes */
        for (ix = 0; ix < ARRAY_SIZE(dme1737_fan_group); ix++) {
                if (data->has_fan & (1 << ix)) {
@@ -1852,6 +1953,11 @@ static int dme1737_create_files(struct device *dev)
                                                &dme1737_pwm_group[ix]))) {
                                goto exit_remove;
                        }
+                       if (data->type != sch5027 && ix < 3 &&
+                           (err = sysfs_create_file(&dev->kobj,
+                                               dme1737_pwm_misc_attr[ix]))) {
+                               goto exit_remove;
+                       }
                }
        }
 
@@ -1861,16 +1967,27 @@ static int dme1737_create_files(struct device *dev)
                dev_info(dev, "Device is locked. Some attributes "
                         "will be read-only.\n");
        } else {
-               /* Change permissions of standard attributes */
-               dme1737_chmod_group(dev, &dme1737_lock_group,
+               /* Change permissions of zone sysfs attributes */
+               dme1737_chmod_group(dev, &dme1737_zone_chmod_group,
                                    S_IRUGO | S_IWUSR);
 
-               /* Change permissions of PWM attributes */
-               for (ix = 0; ix < ARRAY_SIZE(dme1737_pwm_lock_group); ix++) {
+               /* Change permissions of misc sysfs attributes */
+               if (data->type != sch5027) {
+                       dme1737_chmod_group(dev, &dme1737_misc_group,
+                                           S_IRUGO | S_IWUSR);
+               }
+
+               /* Change permissions of PWM sysfs attributes */
+               for (ix = 0; ix < ARRAY_SIZE(dme1737_pwm_chmod_group); ix++) {
                        if (data->has_pwm & (1 << ix)) {
                                dme1737_chmod_group(dev,
-                                               &dme1737_pwm_lock_group[ix],
+                                               &dme1737_pwm_chmod_group[ix],
+                                               S_IRUGO | S_IWUSR);
+                               if (data->type != sch5027 && ix < 3) {
+                                       dme1737_chmod_file(dev,
+                                               dme1737_pwm_misc_attr[ix],
                                                S_IRUGO | S_IWUSR);
+                               }
                        }
                }
 
@@ -1879,7 +1996,7 @@ static int dme1737_create_files(struct device *dev)
                        if ((data->has_pwm & (1 << ix)) &&
                            (PWM_EN_FROM_REG(data->pwm_config[ix]) == 1)) {
                                dme1737_chmod_file(dev,
-                                               dme1737_attr_pwm[ix],
+                                               dme1737_pwm_chmod_attr[ix],
                                                S_IRUGO | S_IWUSR);
                        }
                }
@@ -1900,6 +2017,9 @@ static int dme1737_init_device(struct device *dev)
        int ix;
        u8 reg;
 
+       /* Point to the right nominal voltages array */
+       data->in_nominal = IN_NOMINAL(data->type);
+
        data->config = dme1737_read(client, DME1737_REG_CONFIG);
        /* Inform if part is not monitoring/started */
        if (!(data->config & 0x01)) {
@@ -2010,7 +2130,9 @@ static int dme1737_init_device(struct device *dev)
        data->pwm_acz[2] = 4;   /* pwm3 -> zone3 */
 
        /* Set VRM */
-       data->vrm = vid_which_vrm();
+       if (data->type != sch5027) {
+               data->vrm = vid_which_vrm();
+       }
 
        return 0;
 }
@@ -2029,9 +2151,10 @@ static int dme1737_i2c_get_features(int sio_cip, struct dme1737_data *data)
        dme1737_sio_enter(sio_cip);
 
        /* Check device ID
-        * The DME1737 can return either 0x78 or 0x77 as its device ID. */
+        * The DME1737 can return either 0x78 or 0x77 as its device ID.
+        * The SCH5027 returns 0x89 as its device ID. */
        reg = force_id ? force_id : dme1737_sio_inb(sio_cip, 0x20);
-       if (!(reg == 0x77 || reg == 0x78)) {
+       if (!(reg == 0x77 || reg == 0x78 || reg == 0x89)) {
                err = -ENODEV;
                goto exit;
        }
@@ -2100,15 +2223,25 @@ static int dme1737_i2c_detect(struct i2c_adapter *adapter, int address,
                company = dme1737_read(client, DME1737_REG_COMPANY);
                verstep = dme1737_read(client, DME1737_REG_VERSTEP);
 
-               if (!((company == DME1737_COMPANY_SMSC) &&
-                     ((verstep & DME1737_VERSTEP_MASK) == DME1737_VERSTEP))) {
+               if (company == DME1737_COMPANY_SMSC &&
+                   (verstep & DME1737_VERSTEP_MASK) == DME1737_VERSTEP) {
+                       kind = dme1737;
+               } else if (company == DME1737_COMPANY_SMSC &&
+                          verstep == SCH5027_VERSTEP) {
+                       kind = sch5027;
+               } else {
                        err = -ENODEV;
                        goto exit_kfree;
                }
        }
 
-       kind = dme1737;
-       name = "dme1737";
+       if (kind == sch5027) {
+               name = "sch5027";
+       } else {
+               kind = dme1737;
+               name = "dme1737";
+       }
+       data->type = kind;
 
        /* Fill in the remaining client fields and put it into the global
         * list */
@@ -2120,8 +2253,9 @@ static int dme1737_i2c_detect(struct i2c_adapter *adapter, int address,
                goto exit_kfree;
        }
 
-       dev_info(dev, "Found a DME1737 chip at 0x%02x (rev 0x%02x).\n",
-                client->addr, verstep);
+       dev_info(dev, "Found a %s chip at 0x%02x (rev 0x%02x).\n",
+                kind == sch5027 ? "SCH5027" : "DME1737", client->addr,
+                verstep);
 
        /* Initialize the DME1737 chip */
        if ((err = dme1737_init_device(dev))) {
@@ -2293,14 +2427,18 @@ static int __devinit dme1737_isa_probe(struct platform_device *pdev)
        client->addr = res->start;
        platform_set_drvdata(pdev, data);
 
-       company = dme1737_read(client, DME1737_REG_COMPANY);
-       device = dme1737_read(client, DME1737_REG_DEVICE);
+       /* Skip chip detection if module is loaded with force_id parameter */
+       if (!force_id) {
+               company = dme1737_read(client, DME1737_REG_COMPANY);
+               device = dme1737_read(client, DME1737_REG_DEVICE);
 
-       if (!((company == DME1737_COMPANY_SMSC) &&
-             (device == SCH311X_DEVICE))) {
-               err = -ENODEV;
-               goto exit_kfree;
+               if (!((company == DME1737_COMPANY_SMSC) &&
+                     (device == SCH311X_DEVICE))) {
+                       err = -ENODEV;
+                       goto exit_kfree;
+               }
        }
+       data->type = sch311x;
 
        /* Fill in the remaining client fields and initialize the mutex */
        strlcpy(client->name, "sch311x", I2C_NAME_SIZE);
@@ -2377,7 +2515,10 @@ static int __init dme1737_init(void)
        }
 
        if (dme1737_isa_detect(0x2e, &addr) &&
-           dme1737_isa_detect(0x4e, &addr)) {
+           dme1737_isa_detect(0x4e, &addr) &&
+           (!probe_all_addr ||
+            (dme1737_isa_detect(0x162e, &addr) &&
+             dme1737_isa_detect(0x164e, &addr)))) {
                /* Return 0 if we didn't find an ISA device */
                return 0;
        }
index cbeb498..67067e9 100644 (file)
@@ -87,8 +87,6 @@ static inline void superio_enter(int base);
 static inline void superio_select(int base, int ld);
 static inline void superio_exit(int base);
 
-static inline u16 fan_from_reg ( u16 reg );
-
 struct f71882fg_data {
        unsigned short addr;
        struct device *hwmon_dev;
@@ -116,10 +114,6 @@ struct f71882fg_data {
        u8      temp_diode_open;
 };
 
-static u8 f71882fg_read8(struct f71882fg_data *data, u8 reg);
-static u16 f71882fg_read16(struct f71882fg_data *data, u8 reg);
-static void f71882fg_write8(struct f71882fg_data *data, u8 reg, u8 val);
-
 /* Sysfs in*/
 static ssize_t show_in(struct device *dev, struct device_attribute *devattr,
        char *buf);
index 3330667..7b0a32c 100644 (file)
@@ -1,76 +1,74 @@
 /*
   hwmon-vid.c - VID/VRM/VRD voltage conversions
-
   Copyright (c) 2004 Rudolf Marek <r.marek@assembler.cz>
-
   Partly imported from i2c-vid.h of the lm_sensors project
   Copyright (c) 2002 Mark D. Studebaker <mdsxyz123@yahoo.com>
   With assistance from Trent Piepho <xyzzy@speakeasy.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.
-
   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.
-*/
* hwmon-vid.c - VID/VRM/VRD voltage conversions
+ *
* Copyright (c) 2004 Rudolf Marek <r.marek@assembler.cz>
+ *
* Partly imported from i2c-vid.h of the lm_sensors project
* Copyright (c) 2002 Mark D. Studebaker <mdsxyz123@yahoo.com>
* With assistance from Trent Piepho <xyzzy@speakeasy.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.
+ *
* 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/kernel.h>
 #include <linux/hwmon-vid.h>
 
 /*
-    Common code for decoding VID pins.
-
-    References:
-
-    For VRM 8.4 to 9.1, "VRM x.y DC-DC Converter Design Guidelines",
-    available at http://developer.intel.com/.
-
-    For VRD 10.0 and up, "VRD x.y Design Guide",
-    available at http://developer.intel.com/.
-
-    AMD Opteron processors don't follow the Intel specifications.
-    I'm going to "make up" 2.4 as the spec number for the Opterons.
-    No good reason just a mnemonic for the 24x Opteron processor
-    series.
-
-    Opteron VID encoding is:
-       00000  =  1.550 V
-       00001  =  1.525 V
-        . . . .
-       11110  =  0.800 V
-       11111  =  0.000 V (off)
-
-    The 17 specification is in fact Intel Mobile Voltage Positioning -
-    (IMVP-II). You can find more information in the datasheet of Max1718
-    http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2452
-
-    The 13 specification corresponds to the Intel Pentium M series. There
-    doesn't seem to be any named specification for these. The conversion
-    tables are detailed directly in the various Pentium M datasheets:
-    http://www.intel.com/design/intarch/pentiumm/docs_pentiumm.htm
-
-    The 14 specification corresponds to Intel Core series. There
-    doesn't seem to be any named specification for these. The conversion
-    tables are detailed directly in the various Pentium Core datasheets:
-    http://www.intel.com/design/mobile/datashts/309221.htm
-
-    The 110 (VRM 11) specification corresponds to Intel Conroe based series.
-    http://www.intel.com/design/processor/applnots/313214.htm
-*/
-
-/* vrm is the VRM/VRD document version multiplied by 10.
-   val is the 4-bit or more VID code.
-   Returned value is in mV to avoid floating point in the kernel.
-   Some VID have some bits in uV scale, this is rounded to mV */
+ * Common code for decoding VID pins.
+ *
+ * References:
+ *
+ * For VRM 8.4 to 9.1, "VRM x.y DC-DC Converter Design Guidelines",
+ * available at http://developer.intel.com/.
+ *
+ * For VRD 10.0 and up, "VRD x.y Design Guide",
+ * available at http://developer.intel.com/.
+ *
+ * AMD NPT 0Fh (Athlon64 & Opteron), AMD Publication 32559,
+ * http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/32559.pdf
+ * Table 71. VID Code Voltages
+ * AMD Opteron processors don't follow the Intel specifications.
+ * I'm going to "make up" 2.4 as the spec number for the Opterons.
+ * No good reason just a mnemonic for the 24x Opteron processor
+ * series.
+ *
+ * The 17 specification is in fact Intel Mobile Voltage Positioning -
+ * (IMVP-II). You can find more information in the datasheet of Max1718
+ * http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2452
+ *
+ * The 13 specification corresponds to the Intel Pentium M series. There
+ * doesn't seem to be any named specification for these. The conversion
+ * tables are detailed directly in the various Pentium M datasheets:
+ * http://www.intel.com/design/intarch/pentiumm/docs_pentiumm.htm
+ *
+ * The 14 specification corresponds to Intel Core series. There
+ * doesn't seem to be any named specification for these. The conversion
+ * tables are detailed directly in the various Pentium Core datasheets:
+ * http://www.intel.com/design/mobile/datashts/309221.htm
+ *
+ * The 110 (VRM 11) specification corresponds to Intel Conroe based series.
+ * http://www.intel.com/design/processor/applnots/313214.htm
+ */
+
+/*
+ * vrm is the VRM/VRD document version multiplied by 10.
+ * val is the 4-bit or more VID code.
+ * Returned value is in mV to avoid floating point in the kernel.
+ * Some VID have some bits in uV scale, this is rounded to mV.
+ */
 int vid_from_reg(int val, u8 vrm)
 {
        int vid;
@@ -96,9 +94,11 @@ int vid_from_reg(int val, u8 vrm)
                if (val < 0x02 || val > 0xb2)
                        return 0;
                return((1600000 - (val - 2) * 6250 + 500) / 1000);
-       case 24:                /* Opteron processor */
-               val &= 0x1f;
-               return(val == 0x1f ? 0 : 1550 - val * 25);
+
+       case 24:                /* AMD NPT 0Fh (Athlon64 & Opteron) */
+               val &= 0x3f;
+               return (val < 32) ? 1550 - 25 * val
+                       : 775 - (25 * (val - 31)) / 2;
 
        case 91:                /* VRM 9.1 */
        case 90:                /* VRM 9.0 */
@@ -141,9 +141,9 @@ int vid_from_reg(int val, u8 vrm)
 
 
 /*
   After this point is the code to automatically determine which
   VRM/VRD specification should be used depending on the CPU.
-*/
* After this point is the code to automatically determine which
* VRM/VRD specification should be used depending on the CPU.
+ */
 
 struct vrm_model {
        u8 vendor;
index e12c132..30cdb09 100644 (file)
@@ -151,9 +151,9 @@ static int fix_pwm_polarity;
 /* The IT8718F has the VID value in a different register, in Super-I/O
    configuration space. */
 #define IT87_REG_VID           0x0a
-/* Warning: register 0x0b is used for something completely different in
-   new chips/revisions. I suspect only 16-bit tachometer mode will work
-   for these. */
+/* The IT8705F and IT8712F earlier than revision 0x08 use register 0x0b
+   for fan divisors. Later IT8712F revisions must use 16-bit tachometer
+   mode. */
 #define IT87_REG_FAN_DIV       0x0b
 #define IT87_REG_FAN_16BIT     0x0c
 
@@ -234,6 +234,7 @@ static const unsigned int pwm_freq[8] = {
 struct it87_sio_data {
        enum chips type;
        /* Values read from Super-I/O config space */
+       u8 revision;
        u8 vid_value;
 };
 
@@ -242,6 +243,7 @@ struct it87_sio_data {
 struct it87_data {
        struct device *hwmon_dev;
        enum chips type;
+       u8 revision;
 
        unsigned short addr;
        const char *name;
@@ -268,6 +270,16 @@ struct it87_data {
        u8 manual_pwm_ctl[3];   /* manual PWM value set by user */
 };
 
+static inline int has_16bit_fans(const struct it87_data *data)
+{
+       /* IT8705F Datasheet 0.4.1, 3h == Version G.
+          IT8712F Datasheet 0.9.1, section 8.3.5 indicates 7h == Version I.
+          These are the first revisions with 16bit tachometer support. */
+       return (data->type == it87 && data->revision >= 0x03)
+           || (data->type == it8712 && data->revision >= 0x07)
+           || data->type == it8716
+           || data->type == it8718;
+}
 
 static int it87_probe(struct platform_device *pdev);
 static int __devexit it87_remove(struct platform_device *pdev);
@@ -991,8 +1003,9 @@ static int __init it87_find(unsigned short *address,
        }
 
        err = 0;
+       sio_data->revision = superio_inb(DEVREV) & 0x0f;
        pr_info("it87: Found IT%04xF chip at 0x%x, revision %d\n",
-               chip_type, *address, superio_inb(DEVREV) & 0x0f);
+               chip_type, *address, sio_data->revision);
 
        /* Read GPIO config and VID value from LDN 7 (GPIO) */
        if (chip_type != IT8705F_DEVID) {
@@ -1045,6 +1058,7 @@ static int __devinit it87_probe(struct platform_device *pdev)
 
        data->addr = res->start;
        data->type = sio_data->type;
+       data->revision = sio_data->revision;
        data->name = names[sio_data->type];
 
        /* Now, we do the remaining detection. */
@@ -1069,7 +1083,7 @@ static int __devinit it87_probe(struct platform_device *pdev)
                goto ERROR2;
 
        /* Do not create fan files for disabled fans */
-       if (data->type == it8716 || data->type == it8718) {
+       if (has_16bit_fans(data)) {
                /* 16-bit tachometers */
                if (data->has_fan & (1 << 0)) {
                        if ((err = device_create_file(dev,
@@ -1350,7 +1364,7 @@ static void __devinit it87_init_device(struct platform_device *pdev)
        data->has_fan = (data->fan_main_ctrl >> 4) & 0x07;
 
        /* Set tachometers to 16-bit mode if needed */
-       if (data->type == it8716 || data->type == it8718) {
+       if (has_16bit_fans(data)) {
                tmp = it87_read_value(data, IT87_REG_FAN_16BIT);
                if (~tmp & 0x07 & data->has_fan) {
                        dev_dbg(&pdev->dev,
@@ -1358,10 +1372,13 @@ static void __devinit it87_init_device(struct platform_device *pdev)
                        it87_write_value(data, IT87_REG_FAN_16BIT,
                                         tmp | 0x07);
                }
-               if (tmp & (1 << 4))
-                       data->has_fan |= (1 << 3);      /* fan4 enabled */
-               if (tmp & (1 << 5))
-                       data->has_fan |= (1 << 4);      /* fan5 enabled */
+               /* IT8705F only supports three fans. */
+               if (data->type != it87) {
+                       if (tmp & (1 << 4))
+                               data->has_fan |= (1 << 3); /* fan4 enabled */
+                       if (tmp & (1 << 5))
+                               data->has_fan |= (1 << 4); /* fan5 enabled */
+               }
        }
 
        /* Set current fan mode registers and the default settings for the
@@ -1426,7 +1443,7 @@ static struct it87_data *it87_update_device(struct device *dev)
                        data->fan[i] = it87_read_value(data,
                                       IT87_REG_FAN[i]);
                        /* Add high byte if in 16-bit mode */
-                       if (data->type == it8716 || data->type == it8718) {
+                       if (has_16bit_fans(data)) {
                                data->fan[i] |= it87_read_value(data,
                                                IT87_REG_FANX[i]) << 8;
                                data->fan_min[i] |= it87_read_value(data,
@@ -1443,8 +1460,7 @@ static struct it87_data *it87_update_device(struct device *dev)
                }
 
                /* Newer chips don't have clock dividers */
-               if ((data->has_fan & 0x07) && data->type != it8716
-                && data->type != it8718) {
+               if ((data->has_fan & 0x07) && !has_16bit_fans(data)) {
                        i = it87_read_value(data, IT87_REG_FAN_DIV);
                        data->fan_div[0] = i & 0x07;
                        data->fan_div[1] = (i >> 3) & 0x07;
@@ -1460,7 +1476,8 @@ static struct it87_data *it87_update_device(struct device *dev)
                data->fan_ctl = it87_read_value(data, IT87_REG_FAN_CTL);
 
                data->sensor = it87_read_value(data, IT87_REG_TEMP_ENABLE);
-               /* The 8705 does not have VID capability */
+               /* The 8705 does not have VID capability.
+                  The 8718 does not use IT87_REG_VID for the same purpose. */
                if (data->type == it8712 || data->type == it8716) {
                        data->vid = it87_read_value(data, IT87_REG_VID);
                        /* The older IT8712F revisions had only 5 VID pins,
index de698dc..7880c27 100644 (file)
 #include "lm75.h"
 
 
-/* Addresses to scan */
+/*
+ * This driver handles the LM75 and compatible digital temperature sensors.
+ * Only types which are _not_ listed in I2C_CLIENT_INSMOD_*() need to be
+ * listed here.  We start at 9 since I2C_CLIENT_INSMOD_*() currently allow
+ * definition of up to 8 chip types (plus zero).
+ */
+
+enum lm75_type {               /* keep sorted in alphabetical order */
+       ds1775 = 9,
+       ds75,
+       /* lm75 -- in I2C_CLIENT_INSMOD_1() */
+       lm75a,
+       max6625,
+       max6626,
+       mcp980x,
+       stds75,
+       tcn75,
+       tmp100,
+       tmp101,
+       tmp175,
+       tmp275,
+       tmp75,
+};
+
+/* Addresses scanned by legacy style driver binding */
 static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c,
                                        0x4d, 0x4e, 0x4f, I2C_CLIENT_END };
 
-/* Insmod parameters */
+/* Insmod parameters (only for legacy style driver binding) */
 I2C_CLIENT_INSMOD_1(lm75);
 
-/* Many LM75 constants specified below */
 
 /* The LM75 registers */
 #define LM75_REG_CONF          0x01
@@ -49,10 +72,11 @@ static const u8 LM75_REG_TEMP[3] = {
 
 /* Each client has this additional data */
 struct lm75_data {
-       struct i2c_client       client;
-       struct device *hwmon_dev;
+       struct i2c_client       *client;
+       struct device           *hwmon_dev;
        struct mutex            update_lock;
-       char                    valid;          /* !=0 if following fields are valid */
+       u8                      orig_conf;
+       char                    valid;          /* !=0 if registers are valid */
        unsigned long           last_updated;   /* In jiffies */
        u16                     temp[3];        /* Register values,
                                                   0 = input
@@ -60,23 +84,14 @@ struct lm75_data {
                                                   2 = hyst */
 };
 
-static int lm75_attach_adapter(struct i2c_adapter *adapter);
-static int lm75_detect(struct i2c_adapter *adapter, int address, int kind);
-static void lm75_init_client(struct i2c_client *client);
-static int lm75_detach_client(struct i2c_client *client);
 static int lm75_read_value(struct i2c_client *client, u8 reg);
 static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value);
 static struct lm75_data *lm75_update_device(struct device *dev);
 
 
-/* This is the driver that will be inserted */
-static struct i2c_driver lm75_driver = {
-       .driver = {
-               .name   = "lm75",
-       },
-       .attach_adapter = lm75_attach_adapter,
-       .detach_client  = lm75_detach_client,
-};
+/*-----------------------------------------------------------------------*/
+
+/* sysfs attributes for hwmon */
 
 static ssize_t show_temp(struct device *dev, struct device_attribute *da,
                         char *buf)
@@ -109,13 +124,6 @@ static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IWUSR | S_IRUGO,
                        show_temp, set_temp, 2);
 static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0);
 
-static int lm75_attach_adapter(struct i2c_adapter *adapter)
-{
-       if (!(adapter->class & I2C_CLASS_HWMON))
-               return 0;
-       return i2c_probe(adapter, &addr_data, lm75_detect);
-}
-
 static struct attribute *lm75_attributes[] = {
        &sensor_dev_attr_temp1_input.dev_attr.attr,
        &sensor_dev_attr_temp1_max.dev_attr.attr,
@@ -128,32 +136,144 @@ static const struct attribute_group lm75_group = {
        .attrs = lm75_attributes,
 };
 
+/*-----------------------------------------------------------------------*/
+
+/* "New style" I2C driver binding -- following the driver model */
+
+static int
+lm75_probe(struct i2c_client *client, const struct i2c_device_id *id)
+{
+       struct lm75_data *data;
+       int status;
+       u8 set_mask, clr_mask;
+       int new;
+
+       if (!i2c_check_functionality(client->adapter,
+                       I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA))
+               return -EIO;
+
+       data = kzalloc(sizeof(struct lm75_data), GFP_KERNEL);
+       if (!data)
+               return -ENOMEM;
+
+       i2c_set_clientdata(client, data);
+
+       data->client = client;
+       mutex_init(&data->update_lock);
+
+       /* Set to LM75 resolution (9 bits, 1/2 degree C) and range.
+        * Then tweak to be more precise when appropriate.
+        */
+       set_mask = 0;
+       clr_mask = (1 << 0)                     /* continuous conversions */
+               | (1 << 6) | (1 << 5);          /* 9-bit mode */
+
+       /* configure as specified */
+       status = lm75_read_value(client, LM75_REG_CONF);
+       if (status < 0) {
+               dev_dbg(&client->dev, "Can't read config? %d\n", status);
+               goto exit_free;
+       }
+       data->orig_conf = status;
+       new = status & ~clr_mask;
+       new |= set_mask;
+       if (status != new)
+               lm75_write_value(client, LM75_REG_CONF, new);
+       dev_dbg(&client->dev, "Config %02x\n", new);
+
+       /* Register sysfs hooks */
+       status = sysfs_create_group(&client->dev.kobj, &lm75_group);
+       if (status)
+               goto exit_free;
+
+       data->hwmon_dev = hwmon_device_register(&client->dev);
+       if (IS_ERR(data->hwmon_dev)) {
+               status = PTR_ERR(data->hwmon_dev);
+               goto exit_remove;
+       }
+
+       dev_info(&client->dev, "%s: sensor '%s'\n",
+               data->hwmon_dev->bus_id, client->name);
+
+       return 0;
+
+exit_remove:
+       sysfs_remove_group(&client->dev.kobj, &lm75_group);
+exit_free:
+       i2c_set_clientdata(client, NULL);
+       kfree(data);
+       return status;
+}
+
+static int lm75_remove(struct i2c_client *client)
+{
+       struct lm75_data *data = i2c_get_clientdata(client);
+
+       hwmon_device_unregister(data->hwmon_dev);
+       sysfs_remove_group(&client->dev.kobj, &lm75_group);
+       lm75_write_value(client, LM75_REG_CONF, data->orig_conf);
+       i2c_set_clientdata(client, NULL);
+       kfree(data);
+       return 0;
+}
+
+static const struct i2c_device_id lm75_ids[] = {
+       { "ds1775", ds1775, },
+       { "ds75", ds75, },
+       { "lm75", lm75, },
+       { "lm75a", lm75a, },
+       { "max6625", max6625, },
+       { "max6626", max6626, },
+       { "mcp980x", mcp980x, },
+       { "stds75", stds75, },
+       { "tcn75", tcn75, },
+       { "tmp100", tmp100, },
+       { "tmp101", tmp101, },
+       { "tmp175", tmp175, },
+       { "tmp275", tmp275, },
+       { "tmp75", tmp75, },
+       { /* LIST END */ }
+};
+MODULE_DEVICE_TABLE(i2c, lm75_ids);
+
+static struct i2c_driver lm75_driver = {
+       .driver = {
+               .name   = "lm75",
+       },
+       .probe          = lm75_probe,
+       .remove         = lm75_remove,
+       .id_table       = lm75_ids,
+};
+
+/*-----------------------------------------------------------------------*/
+
+/* "Legacy" I2C driver binding */
+
+static struct i2c_driver lm75_legacy_driver;
+
 /* This function is called by i2c_probe */
 static int lm75_detect(struct i2c_adapter *adapter, int address, int kind)
 {
        int i;
        struct i2c_client *new_client;
-       struct lm75_data *data;
        int err = 0;
-       const char *name = "";
 
        if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA |
                                     I2C_FUNC_SMBUS_WORD_DATA))
                goto exit;
 
-       /* OK. For now, we presume we have a valid client. We now create the
-          client structure, even though we cannot fill it completely yet.
-          But it allows us to access lm75_{read,write}_value. */
-       if (!(data = kzalloc(sizeof(struct lm75_data), GFP_KERNEL))) {
+       /* OK. For now, we presume we have a valid address. We create the
+          client structure, even though there may be no sensor present.
+          But it allows us to use i2c_smbus_read_*_data() calls. */
+       new_client = kzalloc(sizeof *new_client, GFP_KERNEL);
+       if (!new_client) {
                err = -ENOMEM;
                goto exit;
        }
 
-       new_client = &data->client;
-       i2c_set_clientdata(new_client, data);
        new_client->addr = address;
        new_client->adapter = adapter;
-       new_client->driver = &lm75_driver;
+       new_client->driver = &lm75_legacy_driver;
        new_client->flags = 0;
 
        /* Now, we do the remaining detection. There is no identification-
@@ -174,17 +294,17 @@ static int lm75_detect(struct i2c_adapter *adapter, int address, int kind)
                 || i2c_smbus_read_word_data(new_client, 5) != hyst
                 || i2c_smbus_read_word_data(new_client, 6) != hyst
                 || i2c_smbus_read_word_data(new_client, 7) != hyst)
-                       goto exit_free;
+                       goto exit_free;
                os = i2c_smbus_read_word_data(new_client, 3);
                if (i2c_smbus_read_word_data(new_client, 4) != os
                 || i2c_smbus_read_word_data(new_client, 5) != os
                 || i2c_smbus_read_word_data(new_client, 6) != os
                 || i2c_smbus_read_word_data(new_client, 7) != os)
-                       goto exit_free;
+                       goto exit_free;
 
                /* Unused bits */
                if (conf & 0xe0)
-                       goto exit_free;
+                       goto exit_free;
 
                /* Addresses cycling */
                for (i = 8; i < 0xff; i += 8)
@@ -194,58 +314,57 @@ static int lm75_detect(struct i2c_adapter *adapter, int address, int kind)
                                goto exit_free;
        }
 
-       /* Determine the chip type - only one kind supported! */
-       if (kind <= 0)
-               kind = lm75;
-
-       if (kind == lm75) {
-               name = "lm75";
-       }
-
-       /* Fill in the remaining client fields and put it into the global list */
-       strlcpy(new_client->name, name, I2C_NAME_SIZE);
-       data->valid = 0;
-       mutex_init(&data->update_lock);
+       /* NOTE: we treat "force=..." and "force_lm75=..." the same.
+        * Only new-style driver binding distinguishes chip types.
+        */
+       strlcpy(new_client->name, "lm75", I2C_NAME_SIZE);
 
        /* Tell the I2C layer a new client has arrived */
-       if ((err = i2c_attach_client(new_client)))
+       err = i2c_attach_client(new_client);
+       if (err)
                goto exit_free;
 
-       /* Initialize the LM75 chip */
-       lm75_init_client(new_client);
-       
-       /* Register sysfs hooks */
-       if ((err = sysfs_create_group(&new_client->dev.kobj, &lm75_group)))
+       err = lm75_probe(new_client, NULL);
+       if (err < 0)
                goto exit_detach;
 
-       data->hwmon_dev = hwmon_device_register(&new_client->dev);
-       if (IS_ERR(data->hwmon_dev)) {
-               err = PTR_ERR(data->hwmon_dev);
-               goto exit_remove;
-       }
-
        return 0;
 
-exit_remove:
-       sysfs_remove_group(&new_client->dev.kobj, &lm75_group);
 exit_detach:
        i2c_detach_client(new_client);
 exit_free:
-       kfree(data);
+       kfree(new_client);
 exit:
        return err;
 }
 
+static int lm75_attach_adapter(struct i2c_adapter *adapter)
+{
+       if (!(adapter->class & I2C_CLASS_HWMON))
+               return 0;
+       return i2c_probe(adapter, &addr_data, lm75_detect);
+}
+
 static int lm75_detach_client(struct i2c_client *client)
 {
-       struct lm75_data *data = i2c_get_clientdata(client);
-       hwmon_device_unregister(data->hwmon_dev);
-       sysfs_remove_group(&client->dev.kobj, &lm75_group);
+       lm75_remove(client);
        i2c_detach_client(client);
-       kfree(data);
+       kfree(client);
        return 0;
 }
 
+static struct i2c_driver lm75_legacy_driver = {
+       .driver = {
+               .name   = "lm75_legacy",
+       },
+       .attach_adapter = lm75_attach_adapter,
+       .detach_client  = lm75_detach_client,
+};
+
+/*-----------------------------------------------------------------------*/
+
+/* register access */
+
 /* All registers are word-sized, except for the configuration register.
    LM75 uses a high-byte first convention, which is exactly opposite to
    the SMBus standard. */
@@ -268,16 +387,6 @@ static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value)
                return i2c_smbus_write_word_data(client, reg, swab16(value));
 }
 
-static void lm75_init_client(struct i2c_client *client)
-{
-       int reg;
-
-       /* Enable if in shutdown mode */
-       reg = lm75_read_value(client, LM75_REG_CONF);
-       if (reg >= 0 && (reg & 0x01))
-               lm75_write_value(client, LM75_REG_CONF, reg & 0xfe);
-}
-
 static struct lm75_data *lm75_update_device(struct device *dev)
 {
        struct i2c_client *client = to_i2c_client(dev);
@@ -309,13 +418,28 @@ static struct lm75_data *lm75_update_device(struct device *dev)
        return data;
 }
 
+/*-----------------------------------------------------------------------*/
+
+/* module glue */
+
 static int __init sensors_lm75_init(void)
 {
-       return i2c_add_driver(&lm75_driver);
+       int status;
+
+       status = i2c_add_driver(&lm75_driver);
+       if (status < 0)
+               return status;
+
+       status = i2c_add_driver(&lm75_legacy_driver);
+       if (status < 0)
+               i2c_del_driver(&lm75_driver);
+
+       return status;
 }
 
 static void __exit sensors_lm75_exit(void)
 {
+       i2c_del_driver(&lm75_legacy_driver);
        i2c_del_driver(&lm75_driver);
 }
 
index ee5eca1..12d446f 100644 (file)
@@ -1,7 +1,7 @@
 /*
     lm85.c - Part of lm_sensors, Linux kernel modules for hardware
              monitoring
-    Copyright (c) 1998, 1999  Frodo Looijaard <frodol@dds.nl> 
+    Copyright (c) 1998, 1999  Frodo Looijaard <frodol@dds.nl>
     Copyright (c) 2002, 2003  Philip Pokorny <ppokorny@penguincomputing.com>
     Copyright (c) 2003        Margit Schubert-While <margitsw@t-online.de>
     Copyright (c) 2004        Justin Thiessen <jthiessen@penguincomputing.com>
@@ -51,24 +51,17 @@ I2C_CLIENT_INSMOD_6(lm85b, lm85c, adm1027, adt7463, emc6d100, emc6d102);
 #define        LM85_REG_TEMP_MAX(nr)           (0x4f + (nr) * 2)
 
 /* Fan speeds are LSB, MSB (2 bytes) */
-#define        LM85_REG_FAN(nr)                (0x28 + (nr) *2)
-#define        LM85_REG_FAN_MIN(nr)            (0x54 + (nr) *2)
+#define        LM85_REG_FAN(nr)                (0x28 + (nr) * 2)
+#define        LM85_REG_FAN_MIN(nr)            (0x54 + (nr) * 2)
 
 #define        LM85_REG_PWM(nr)                (0x30 + (nr))
 
-#define        ADT7463_REG_OPPOINT(nr)         (0x33 + (nr))
-
-#define        ADT7463_REG_TMIN_CTL1           0x36
-#define        ADT7463_REG_TMIN_CTL2           0x37
-
-#define        LM85_REG_DEVICE                 0x3d
 #define        LM85_REG_COMPANY                0x3e
 #define        LM85_REG_VERSTEP                0x3f
 /* These are the recognized values for the above regs */
-#define        LM85_DEVICE_ADX                 0x27
 #define        LM85_COMPANY_NATIONAL           0x01
 #define        LM85_COMPANY_ANALOG_DEV         0x41
-#define        LM85_COMPANY_SMSC               0x5c
+#define        LM85_COMPANY_SMSC               0x5c
 #define        LM85_VERSTEP_VMASK              0xf0
 #define        LM85_VERSTEP_GENERIC            0x60
 #define        LM85_VERSTEP_LM85C              0x60
@@ -91,58 +84,45 @@ I2C_CLIENT_INSMOD_6(lm85b, lm85c, adm1027, adt7463, emc6d100, emc6d102);
 #define        LM85_REG_AFAN_CONFIG(nr)        (0x5c + (nr))
 #define        LM85_REG_AFAN_RANGE(nr)         (0x5f + (nr))
 #define        LM85_REG_AFAN_SPIKE1            0x62
-#define        LM85_REG_AFAN_SPIKE2            0x63
 #define        LM85_REG_AFAN_MINPWM(nr)        (0x64 + (nr))
 #define        LM85_REG_AFAN_LIMIT(nr)         (0x67 + (nr))
 #define        LM85_REG_AFAN_CRITICAL(nr)      (0x6a + (nr))
 #define        LM85_REG_AFAN_HYST1             0x6d
 #define        LM85_REG_AFAN_HYST2             0x6e
 
-#define        LM85_REG_TACH_MODE              0x74
-#define        LM85_REG_SPINUP_CTL             0x75
-
-#define        ADM1027_REG_TEMP_OFFSET(nr)     (0x70 + (nr))
-#define        ADM1027_REG_CONFIG2             0x73
-#define        ADM1027_REG_INTMASK1            0x74
-#define        ADM1027_REG_INTMASK2            0x75
 #define        ADM1027_REG_EXTEND_ADC1         0x76
 #define        ADM1027_REG_EXTEND_ADC2         0x77
-#define        ADM1027_REG_CONFIG3             0x78
-#define        ADM1027_REG_FAN_PPR             0x7b
-
-#define        ADT7463_REG_THERM               0x79
-#define        ADT7463_REG_THERM_LIMIT         0x7A
 
 #define EMC6D100_REG_ALARM3             0x7d
 /* IN5, IN6 and IN7 */
-#define        EMC6D100_REG_IN(nr)             (0x70 + ((nr)-5))
-#define        EMC6D100_REG_IN_MIN(nr)         (0x73 + ((nr)-5) * 2)
-#define        EMC6D100_REG_IN_MAX(nr)         (0x74 + ((nr)-5) * 2)
+#define        EMC6D100_REG_IN(nr)             (0x70 + ((nr) - 5))
+#define        EMC6D100_REG_IN_MIN(nr)         (0x73 + ((nr) - 5) * 2)
+#define        EMC6D100_REG_IN_MAX(nr)         (0x74 + ((nr) - 5) * 2)
 #define        EMC6D102_REG_EXTEND_ADC1        0x85
 #define        EMC6D102_REG_EXTEND_ADC2        0x86
 #define        EMC6D102_REG_EXTEND_ADC3        0x87
 #define        EMC6D102_REG_EXTEND_ADC4        0x88
 
 
-/* Conversions. Rounding and limit checking is only done on the TO_REG 
+/* Conversions. Rounding and limit checking is only done on the TO_REG
    variants. Note that you should be a bit careful with which arguments
    these macros are called: arguments may be evaluated more than once.
  */
 
 /* IN are scaled acording to built-in resistors */
-static int lm85_scaling[] = {  /* .001 Volts */
-               2500, 2250, 3300, 5000, 12000,
-               3300, 1500, 1800 /*EMC6D100*/
-       };
-#define SCALE(val,from,to)             (((val)*(to) + ((from)/2))/(from))
+static const int lm85_scaling[] = {  /* .001 Volts */
+       2500, 2250, 3300, 5000, 12000,
+       3300, 1500, 1800 /*EMC6D100*/
+};
+#define SCALE(val, from, to)   (((val) * (to) + ((from) / 2)) / (from))
 
-#define INS_TO_REG(n,val)      \
-               SENSORS_LIMIT(SCALE(val,lm85_scaling[n],192),0,255)
+#define INS_TO_REG(n, val)     \
+               SENSORS_LIMIT(SCALE(val, lm85_scaling[n], 192), 0, 255)
 
-#define INSEXT_FROM_REG(n,val,ext)     \
+#define INSEXT_FROM_REG(n, val, ext)   \
                SCALE(((val) << 4) + (ext), 192 << 4, lm85_scaling[n])
 
-#define INS_FROM_REG(n,val)    SCALE((val), 192, lm85_scaling[n])
+#define INS_FROM_REG(n, val)   SCALE((val), 192, lm85_scaling[n])
 
 /* FAN speed is measured using 90kHz clock */
 static inline u16 FAN_TO_REG(unsigned long val)
@@ -151,16 +131,17 @@ static inline u16 FAN_TO_REG(unsigned long val)
                return 0xffff;
        return SENSORS_LIMIT(5400000 / val, 1, 0xfffe);
 }
-#define FAN_FROM_REG(val)      ((val)==0?-1:(val)==0xffff?0:5400000/(val))
+#define FAN_FROM_REG(val)      ((val) == 0 ? -1 : (val) == 0xffff ? 0 : \
+                                5400000 / (val))
 
 /* Temperature is reported in .001 degC increments */
 #define TEMP_TO_REG(val)       \
-               SENSORS_LIMIT(SCALE(val,1000,1),-127,127)
-#define TEMPEXT_FROM_REG(val,ext)      \
+               SENSORS_LIMIT(SCALE(val, 1000, 1), -127, 127)
+#define TEMPEXT_FROM_REG(val, ext)     \
                SCALE(((val) << 4) + (ext), 16, 1000)
 #define TEMP_FROM_REG(val)     ((val) * 1000)
 
-#define PWM_TO_REG(val)                        (SENSORS_LIMIT(val,0,255))
+#define PWM_TO_REG(val)                        SENSORS_LIMIT(val, 0, 255)
 #define PWM_FROM_REG(val)              (val)
 
 
@@ -183,17 +164,17 @@ static inline u16 FAN_TO_REG(unsigned long val)
  */
 
 /* These are the zone temperature range encodings in .001 degree C */
-static int lm85_range_map[] = {   
-               2000,  2500,  3300,  4000,  5000,  6600,
-               8000, 10000, 13300, 16000, 20000, 26600,
-               32000, 40000, 53300, 80000
-       };
-static int RANGE_TO_REG( int range )
+static const int lm85_range_map[] = {
+       2000, 2500, 3300, 4000, 5000, 6600, 8000, 10000,
+       13300, 16000, 20000, 26600, 32000, 40000, 53300, 80000
+};
+
+static int RANGE_TO_REG(int range)
 {
        int i;
 
        if (range >= lm85_range_map[15])
-               return 15 ;
+               return 15;
 
        /* Find the closest match */
        for (i = 14; i >= 0; --i) {
@@ -207,28 +188,25 @@ static int RANGE_TO_REG( int range )
 
        return 0;
 }
-#define RANGE_FROM_REG(val) (lm85_range_map[(val)&0x0f])
+#define RANGE_FROM_REG(val)    lm85_range_map[(val) & 0x0f]
 
-/* These are the Acoustic Enhancement, or Temperature smoothing encodings
- * NOTE: The enable/disable bit is INCLUDED in these encodings as the
- *       MSB (bit 3, value 8).  If the enable bit is 0, the encoded value
- *       is ignored, or set to 0.
- */
 /* These are the PWM frequency encodings */
-static int lm85_freq_map[] = { /* .1 Hz */
-               100, 150, 230, 300, 380, 470, 620, 940
-       };
-static int FREQ_TO_REG( int freq )
+static const int lm85_freq_map[] = { /* .1 Hz */
+       100, 150, 230, 300, 380, 470, 620, 940
+};
+
+static int FREQ_TO_REG(int freq)
 {
        int i;
 
-       if( freq >= lm85_freq_map[7] ) { return 7 ; }
-       for( i = 0 ; i < 7 ; ++i )
-               if( freq <= lm85_freq_map[i] )
-                       break ;
-       return( i & 0x07 );
+       if (freq >= lm85_freq_map[7])
+               return 7;
+       for (i = 0; i < 7; ++i)
+               if (freq <= lm85_freq_map[i])
+                       break;
+       return i;
 }
-#define FREQ_FROM_REG(val) (lm85_freq_map[(val)&0x07])
+#define FREQ_FROM_REG(val)     lm85_freq_map[(val) & 0x07]
 
 /* Since we can't use strings, I'm abusing these numbers
  *   to stand in for the following meanings:
@@ -242,30 +220,23 @@ static int FREQ_TO_REG( int freq )
  *     -2 -- PWM responds to manual control
  */
 
-static int lm85_zone_map[] = { 1, 2, 3, -1, 0, 23, 123, -2 };
-#define ZONE_FROM_REG(val) (lm85_zone_map[((val)>>5)&0x07])
+static const int lm85_zone_map[] = { 1, 2, 3, -1, 0, 23, 123, -2 };
+#define ZONE_FROM_REG(val)     lm85_zone_map[(val) >> 5]
 
-static int ZONE_TO_REG( int zone )
+static int ZONE_TO_REG(int zone)
 {
        int i;
 
-       for( i = 0 ; i <= 7 ; ++i )
-               if( zone == lm85_zone_map[i] )
-                       break ;
-       if( i > 7 )   /* Not found. */
+       for (i = 0; i <= 7; ++i)
+               if (zone == lm85_zone_map[i])
+                       break;
+       if (i > 7)   /* Not found. */
                i = 3;  /* Always 100% */
-       return( (i & 0x07)<<5 );
+       return i << 5;
 }
 
-#define HYST_TO_REG(val) (SENSORS_LIMIT(((val)+500)/1000,0,15))
-#define HYST_FROM_REG(val) ((val)*1000)
-
-#define OFFSET_TO_REG(val) (SENSORS_LIMIT((val)/25,-127,127))
-#define OFFSET_FROM_REG(val) ((val)*25)
-
-#define PPR_MASK(fan) (0x03<<(fan *2))
-#define PPR_TO_REG(val,fan) (SENSORS_LIMIT((val)-1,0,3)<<(fan *2))
-#define PPR_FROM_REG(val,fan) ((((val)>>(fan * 2))&0x03)+1)
+#define HYST_TO_REG(val)       SENSORS_LIMIT(((val) + 500) / 1000, 0, 15)
+#define HYST_FROM_REG(val)     ((val) * 1000)
 
 /* Chip sampling rates
  *
@@ -292,11 +263,11 @@ struct lm85_zone {
        u8 hyst;        /* Low limit hysteresis. (0-15) */
        u8 range;       /* Temp range, encoded */
        s8 critical;    /* "All fans ON" temp limit */
-       u8 off_desired; /* Actual "off" temperature specified.  Preserved 
+       u8 off_desired; /* Actual "off" temperature specified.  Preserved
                         * to prevent "drift" as other autofan control
                         * values change.
                         */
-       u8 max_desired; /* Actual "max" temperature specified.  Preserved 
+       u8 max_desired; /* Actual "max" temperature specified.  Preserved
                         * to prevent "drift" as other autofan control
                         * values change.
                         */
@@ -327,23 +298,13 @@ struct lm85_data {
        s8 temp[3];             /* Register value */
        s8 temp_min[3];         /* Register value */
        s8 temp_max[3];         /* Register value */
-       s8 temp_offset[3];      /* Register value */
        u16 fan[4];             /* Register value */
        u16 fan_min[4];         /* Register value */
        u8 pwm[3];              /* Register value */
-       u8 spinup_ctl;          /* Register encoding, combined */
-       u8 tach_mode;           /* Register encoding, combined */
        u8 temp_ext[3];         /* Decoded values */
        u8 in_ext[8];           /* Decoded values */
-       u8 fan_ppr;             /* Register value */
-       u8 smooth[3];           /* Register encoding */
        u8 vid;                 /* Register value */
        u8 vrm;                 /* VRM version */
-       u8 syncpwm3;            /* Saved PWM3 for TACH 2,3,4 config */
-       u8 oppoint[3];          /* Register value */
-       u16 tmin_ctl;           /* Register value */
-       unsigned long therm_total; /* Cummulative therm count */
-       u8 therm_limit;         /* Register value */
        u32 alarms;             /* Register encoding, combined */
        struct lm85_autofan autofan[3];
        struct lm85_zone zone[3];
@@ -355,9 +316,8 @@ static int lm85_detect(struct i2c_adapter *adapter, int address,
 static int lm85_detach_client(struct i2c_client *client);
 
 static int lm85_read_value(struct i2c_client *client, u8 reg);
-static int lm85_write_value(struct i2c_client *client, u8 reg, int value);
+static void lm85_write_value(struct i2c_client *client, u8 reg, int value);
 static struct lm85_data *lm85_update_device(struct device *dev);
-static void lm85_init_client(struct i2c_client *client);
 
 
 static struct i2c_driver lm85_driver = {
@@ -375,7 +335,7 @@ static ssize_t show_fan(struct device *dev, struct device_attribute *attr,
 {
        int nr = to_sensor_dev_attr(attr)->index;
        struct lm85_data *data = lm85_update_device(dev);
-       return sprintf(buf,"%d\n", FAN_FROM_REG(data->fan[nr]) );
+       return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan[nr]));
 }
 
 static ssize_t show_fan_min(struct device *dev, struct device_attribute *attr,
@@ -383,7 +343,7 @@ static ssize_t show_fan_min(struct device *dev, struct device_attribute *attr,
 {
        int nr = to_sensor_dev_attr(attr)->index;
        struct lm85_data *data = lm85_update_device(dev);
-       return sprintf(buf,"%d\n", FAN_FROM_REG(data->fan_min[nr]) );
+       return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan_min[nr]));
 }
 
 static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr,
@@ -414,7 +374,8 @@ show_fan_offset(4);
 
 /* vid, vrm, alarms */
 
-static ssize_t show_vid_reg(struct device *dev, struct device_attribute *attr, char *buf)
+static ssize_t show_vid_reg(struct device *dev, struct device_attribute *attr,
+               char *buf)
 {
        struct lm85_data *data = lm85_update_device(dev);
        int vid;
@@ -432,13 +393,15 @@ static ssize_t show_vid_reg(struct device *dev, struct device_attribute *attr, c
 
 static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid_reg, NULL);
 
-static ssize_t show_vrm_reg(struct device *dev, struct device_attribute *attr, char *buf)
+static ssize_t show_vrm_reg(struct device *dev, struct device_attribute *attr,
+               char *buf)
 {
        struct lm85_data *data = dev_get_drvdata(dev);
        return sprintf(buf, "%ld\n", (long) data->vrm);
 }
 
-static ssize_t store_vrm_reg(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
+static ssize_t store_vrm_reg(struct device *dev, struct device_attribute *attr,
+               const char *buf, size_t count)
 {
        struct lm85_data *data = dev_get_drvdata(dev);
        data->vrm = simple_strtoul(buf, NULL, 10);
@@ -447,7 +410,8 @@ static ssize_t store_vrm_reg(struct device *dev, struct device_attribute *attr,
 
 static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm_reg, store_vrm_reg);
 
-static ssize_t show_alarms_reg(struct device *dev, struct device_attribute *attr, char *buf)
+static ssize_t show_alarms_reg(struct device *dev, struct device_attribute
+               *attr, char *buf)
 {
        struct lm85_data *data = lm85_update_device(dev);
        return sprintf(buf, "%u\n", data->alarms);
@@ -488,7 +452,7 @@ static ssize_t show_pwm(struct device *dev, struct device_attribute *attr,
 {
        int nr = to_sensor_dev_attr(attr)->index;
        struct lm85_data *data = lm85_update_device(dev);
-       return sprintf(buf,"%d\n", PWM_FROM_REG(data->pwm[nr]) );
+       return sprintf(buf, "%d\n", PWM_FROM_REG(data->pwm[nr]));
 }
 
 static ssize_t set_pwm(struct device *dev, struct device_attribute *attr,
@@ -581,17 +545,16 @@ static ssize_t show_in(struct device *dev, struct device_attribute *attr,
 {
        int nr = to_sensor_dev_attr(attr)->index;
        struct lm85_data *data = lm85_update_device(dev);
-       return sprintf( buf, "%d\n", INSEXT_FROM_REG(nr,
-                                                    data->in[nr],
-                                                    data->in_ext[nr]));
+       return sprintf(buf, "%d\n", INSEXT_FROM_REG(nr, data->in[nr],
+                                                   data->in_ext[nr]));
 }
 
-static ssize_t show_in_min(struct device *dev,  struct device_attribute *attr,
+static ssize_t show_in_min(struct device *dev, struct device_attribute *attr,
                char *buf)
 {
        int nr = to_sensor_dev_attr(attr)->index;
        struct lm85_data *data = lm85_update_device(dev);
-       return sprintf(buf,"%d\n", INS_FROM_REG(nr, data->in_min[nr]) );
+       return sprintf(buf, "%d\n", INS_FROM_REG(nr, data->in_min[nr]));
 }
 
 static ssize_t set_in_min(struct device *dev, struct device_attribute *attr,
@@ -614,7 +577,7 @@ static ssize_t show_in_max(struct device *dev, struct device_attribute *attr,
 {
        int nr = to_sensor_dev_attr(attr)->index;
        struct lm85_data *data = lm85_update_device(dev);
-       return sprintf(buf,"%d\n", INS_FROM_REG(nr, data->in_max[nr]) );
+       return sprintf(buf, "%d\n", INS_FROM_REG(nr, data->in_max[nr]));
 }
 
 static ssize_t set_in_max(struct device *dev, struct device_attribute *attr,
@@ -656,8 +619,8 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *attr,
 {
        int nr = to_sensor_dev_attr(attr)->index;
        struct lm85_data *data = lm85_update_device(dev);
-       return sprintf(buf,"%d\n", TEMPEXT_FROM_REG(data->temp[nr],
-                                                   data->temp_ext[nr]));
+       return sprintf(buf, "%d\n", TEMPEXT_FROM_REG(data->temp[nr],
+                                                    data->temp_ext[nr]));
 }
 
 static ssize_t show_temp_min(struct device *dev, struct device_attribute *attr,
@@ -665,7 +628,7 @@ static ssize_t show_temp_min(struct device *dev, struct device_attribute *attr,
 {
        int nr = to_sensor_dev_attr(attr)->index;
        struct lm85_data *data = lm85_update_device(dev);
-       return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_min[nr]) );
+       return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_min[nr]));
 }
 
 static ssize_t set_temp_min(struct device *dev, struct device_attribute *attr,
@@ -688,7 +651,7 @@ static ssize_t show_temp_max(struct device *dev, struct device_attribute *attr,
 {
        int nr = to_sensor_dev_attr(attr)->index;
        struct lm85_data *data = lm85_update_device(dev);
-       return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_max[nr]) );
+       return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_max[nr]));
 }
 
 static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr,
@@ -697,7 +660,7 @@ static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr,
        int nr = to_sensor_dev_attr(attr)->index;
        struct i2c_client *client = to_i2c_client(dev);
        struct lm85_data *data = i2c_get_clientdata(client);
-       long val = simple_strtol(buf, NULL, 10);        
+       long val = simple_strtol(buf, NULL, 10);
 
        mutex_lock(&data->update_lock);
        data->temp_max[nr] = TEMP_TO_REG(val);
@@ -726,7 +689,7 @@ static ssize_t show_pwm_auto_channels(struct device *dev,
 {
        int nr = to_sensor_dev_attr(attr)->index;
        struct lm85_data *data = lm85_update_device(dev);
-       return sprintf(buf,"%d\n", ZONE_FROM_REG(data->autofan[nr].config));
+       return sprintf(buf, "%d\n", ZONE_FROM_REG(data->autofan[nr].config));
 }
 
 static ssize_t set_pwm_auto_channels(struct device *dev,
@@ -735,11 +698,11 @@ static ssize_t set_pwm_auto_channels(struct device *dev,
        int nr = to_sensor_dev_attr(attr)->index;
        struct i2c_client *client = to_i2c_client(dev);
        struct lm85_data *data = i2c_get_clientdata(client);
-       long val = simple_strtol(buf, NULL, 10);   
+       long val = simple_strtol(buf, NULL, 10);
 
        mutex_lock(&data->update_lock);
        data->autofan[nr].config = (data->autofan[nr].config & (~0xe0))
-               | ZONE_TO_REG(val) ;
+               | ZONE_TO_REG(val);
        lm85_write_value(client, LM85_REG_AFAN_CONFIG(nr),
                data->autofan[nr].config);
        mutex_unlock(&data->update_lock);
@@ -751,7 +714,7 @@ static ssize_t show_pwm_auto_pwm_min(struct device *dev,
 {
        int nr = to_sensor_dev_attr(attr)->index;
        struct lm85_data *data = lm85_update_device(dev);
-       return sprintf(buf,"%d\n", PWM_FROM_REG(data->autofan[nr].min_pwm));
+       return sprintf(buf, "%d\n", PWM_FROM_REG(data->autofan[nr].min_pwm));
 }
 
 static ssize_t set_pwm_auto_pwm_min(struct device *dev,
@@ -775,7 +738,7 @@ static ssize_t show_pwm_auto_pwm_minctl(struct device *dev,
 {
        int nr = to_sensor_dev_attr(attr)->index;
        struct lm85_data *data = lm85_update_device(dev);
-       return sprintf(buf,"%d\n", data->autofan[nr].min_off);
+       return sprintf(buf, "%d\n", data->autofan[nr].min_off);
 }
 
 static ssize_t set_pwm_auto_pwm_minctl(struct device *dev,
@@ -785,15 +748,15 @@ static ssize_t set_pwm_auto_pwm_minctl(struct device *dev,
        struct i2c_client *client = to_i2c_client(dev);
        struct lm85_data *data = i2c_get_clientdata(client);
        long val = simple_strtol(buf, NULL, 10);
+       u8 tmp;
 
        mutex_lock(&data->update_lock);
        data->autofan[nr].min_off = val;
-       lm85_write_value(client, LM85_REG_AFAN_SPIKE1, data->smooth[0]
-               | data->syncpwm3
-               | (data->autofan[0].min_off ? 0x20 : 0)
-               | (data->autofan[1].min_off ? 0x40 : 0)
-               | (data->autofan[2].min_off ? 0x80 : 0)
-       );
+       tmp = lm85_read_value(client, LM85_REG_AFAN_SPIKE1);
+       tmp &= ~(0x20 << nr);
+       if (data->autofan[nr].min_off)
+               tmp |= 0x20 << nr;
+       lm85_write_value(client, LM85_REG_AFAN_SPIKE1, tmp);
        mutex_unlock(&data->update_lock);
        return count;
 }
@@ -803,7 +766,7 @@ static ssize_t show_pwm_auto_pwm_freq(struct device *dev,
 {
        int nr = to_sensor_dev_attr(attr)->index;
        struct lm85_data *data = lm85_update_device(dev);
-       return sprintf(buf,"%d\n", FREQ_FROM_REG(data->autofan[nr].freq));
+       return sprintf(buf, "%d\n", FREQ_FROM_REG(data->autofan[nr].freq));
 }
 
 static ssize_t set_pwm_auto_pwm_freq(struct device *dev,
@@ -818,8 +781,7 @@ static ssize_t set_pwm_auto_pwm_freq(struct device *dev,
        data->autofan[nr].freq = FREQ_TO_REG(val);
        lm85_write_value(client, LM85_REG_AFAN_RANGE(nr),
                (data->zone[nr].range << 4)
-               | data->autofan[nr].freq
-       ); 
+               | data->autofan[nr].freq);
        mutex_unlock(&data->update_lock);
        return count;
 }
@@ -849,7 +811,7 @@ static ssize_t show_temp_auto_temp_off(struct device *dev,
 {
        int nr = to_sensor_dev_attr(attr)->index;
        struct lm85_data *data = lm85_update_device(dev);
-       return sprintf(buf,"%d\n", TEMP_FROM_REG(data->zone[nr].limit) -
+       return sprintf(buf, "%d\n", TEMP_FROM_REG(data->zone[nr].limit) -
                HYST_FROM_REG(data->zone[nr].hyst));
 }
 
@@ -866,15 +828,13 @@ static ssize_t set_temp_auto_temp_off(struct device *dev,
        min = TEMP_FROM_REG(data->zone[nr].limit);
        data->zone[nr].off_desired = TEMP_TO_REG(val);
        data->zone[nr].hyst = HYST_TO_REG(min - val);
-       if ( nr == 0 || nr == 1 ) {
+       if (nr == 0 || nr == 1) {
                lm85_write_value(client, LM85_REG_AFAN_HYST1,
                        (data->zone[0].hyst << 4)
-                       | data->zone[1].hyst
-                       );
+                       | data->zone[1].hyst);
        } else {
                lm85_write_value(client, LM85_REG_AFAN_HYST2,
-                       (data->zone[2].hyst << 4)
-               );
+                       (data->zone[2].hyst << 4));
        }
        mutex_unlock(&data->update_lock);
        return count;
@@ -885,7 +845,7 @@ static ssize_t show_temp_auto_temp_min(struct device *dev,
 {
        int nr = to_sensor_dev_attr(attr)->index;
        struct lm85_data *data = lm85_update_device(dev);
-       return sprintf(buf,"%d\n", TEMP_FROM_REG(data->zone[nr].limit) );
+       return sprintf(buf, "%d\n", TEMP_FROM_REG(data->zone[nr].limit));
 }
 
 static ssize_t set_temp_auto_temp_min(struct device *dev,
@@ -913,15 +873,13 @@ static ssize_t set_temp_auto_temp_min(struct device *dev,
        data->zone[nr].hyst = HYST_TO_REG(TEMP_FROM_REG(
                data->zone[nr].limit) - TEMP_FROM_REG(
                data->zone[nr].off_desired));
-       if ( nr == 0 || nr == 1 ) {
+       if (nr == 0 || nr == 1) {
                lm85_write_value(client, LM85_REG_AFAN_HYST1,
                        (data->zone[0].hyst << 4)
-                       | data->zone[1].hyst
-                       );
+                       | data->zone[1].hyst);
        } else {
                lm85_write_value(client, LM85_REG_AFAN_HYST2,
-                       (data->zone[2].hyst << 4)
-               );
+                       (data->zone[2].hyst << 4));
        }
        mutex_unlock(&data->update_lock);
        return count;
@@ -932,7 +890,7 @@ static ssize_t show_temp_auto_temp_max(struct device *dev,
 {
        int nr = to_sensor_dev_attr(attr)->index;
        struct lm85_data *data = lm85_update_device(dev);
-       return sprintf(buf,"%d\n", TEMP_FROM_REG(data->zone[nr].limit) +
+       return sprintf(buf, "%d\n", TEMP_FROM_REG(data->zone[nr].limit) +
                RANGE_FROM_REG(data->zone[nr].range));
 }
 
@@ -962,11 +920,11 @@ static ssize_t show_temp_auto_temp_crit(struct device *dev,
 {
        int nr = to_sensor_dev_attr(attr)->index;
        struct lm85_data *data = lm85_update_device(dev);
-       return sprintf(buf,"%d\n", TEMP_FROM_REG(data->zone[nr].critical));
+       return sprintf(buf, "%d\n", TEMP_FROM_REG(data->zone[nr].critical));
 }
 
 static ssize_t set_temp_auto_temp_crit(struct device *dev,
-               struct device_attribute *attr,const char *buf, size_t count)
+               struct device_attribute *attr, const char *buf, size_t count)
 {
        int nr = to_sensor_dev_attr(attr)->index;
        struct i2c_client *client = to_i2c_client(dev);
@@ -1127,20 +1085,37 @@ static const struct attribute_group lm85_group_in567 = {
        .attrs = lm85_attributes_in567,
 };
 
+static void lm85_init_client(struct i2c_client *client)
+{
+       int value;
+
+       /* Start monitoring if needed */
+       value = lm85_read_value(client, LM85_REG_CONFIG);
+       if (!(value & 0x01)) {
+               dev_info(&client->dev, "Starting monitoring\n");
+               lm85_write_value(client, LM85_REG_CONFIG, value | 0x01);
+       }
+
+       /* Warn about unusual configuration bits */
+       if (value & 0x02)
+               dev_warn(&client->dev, "Device configuration is locked\n");
+       if (!(value & 0x04))
+               dev_warn(&client->dev, "Device is not ready\n");
+}
+
 static int lm85_detect(struct i2c_adapter *adapter, int address,
                int kind)
 {
-       int company, verstep ;
-       struct i2c_client *new_client = NULL;
+       int company, verstep;
+       struct i2c_client *client;
        struct lm85_data *data;
        int err = 0;
-       const char *type_name = "";
+       const char *type_name;
 
-       if (!i2c_check_functionality(adapter,
-                                       I2C_FUNC_SMBUS_BYTE_DATA)) {
+       if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
                /* We need to be able to do byte I/O */
-               goto ERROR0 ;
-       };
+               goto ERROR0;
+       }
 
        /* OK. For now, we presume we have a valid client. We now create the
           client structure, even though we cannot fill it completely yet.
@@ -1151,138 +1126,145 @@ static int lm85_detect(struct i2c_adapter *adapter, int address,
                goto ERROR0;
        }
 
-       new_client = &data->client;
-       i2c_set_clientdata(new_client, data);
-       new_client->addr = address;
-       new_client->adapter = adapter;
-       new_client->driver = &lm85_driver;
-       new_client->flags = 0;
+       client = &data->client;
+       i2c_set_clientdata(client, data);
+       client->addr = address;
+       client->adapter = adapter;
+       client->driver = &lm85_driver;
 
        /* Now, we do the remaining detection. */
 
-       company = lm85_read_value(new_client, LM85_REG_COMPANY);
-       verstep = lm85_read_value(new_client, LM85_REG_VERSTEP);
+       company = lm85_read_value(client, LM85_REG_COMPANY);
+       verstep = lm85_read_value(client, LM85_REG_VERSTEP);
 
        dev_dbg(&adapter->dev, "Detecting device at %d,0x%02x with"
                " COMPANY: 0x%02x and VERSTEP: 0x%02x\n",
-               i2c_adapter_id(new_client->adapter), new_client->addr,
+               i2c_adapter_id(client->adapter), client->addr,
                company, verstep);
 
        /* If auto-detecting, Determine the chip type. */
        if (kind <= 0) {
                dev_dbg(&adapter->dev, "Autodetecting device at %d,0x%02x ...\n",
-                       i2c_adapter_id(adapter), address );
-               ifcompany == LM85_COMPANY_NATIONAL
-                   && verstep == LM85_VERSTEP_LM85C ) {
-                       kind = lm85c ;
-               } else ifcompany == LM85_COMPANY_NATIONAL
-                   && verstep == LM85_VERSTEP_LM85B ) {
-                       kind = lm85b ;
-               } else ifcompany == LM85_COMPANY_NATIONAL
-                   && (verstep & LM85_VERSTEP_VMASK) == LM85_VERSTEP_GENERIC ) {
+                       i2c_adapter_id(adapter), address);
+               if (company == LM85_COMPANY_NATIONAL
+                   && verstep == LM85_VERSTEP_LM85C) {
+                       kind = lm85c;
+               } else if (company == LM85_COMPANY_NATIONAL
+                   && verstep == LM85_VERSTEP_LM85B) {
+                       kind = lm85b;
+               } else if (company == LM85_COMPANY_NATIONAL
+                   && (verstep & LM85_VERSTEP_VMASK) == LM85_VERSTEP_GENERIC) {
                        dev_err(&adapter->dev, "Unrecognized version/stepping 0x%02x"
                                " Defaulting to LM85.\n", verstep);
-                       kind = any_chip ;
-               } else ifcompany == LM85_COMPANY_ANALOG_DEV
-                   && verstep == LM85_VERSTEP_ADM1027 ) {
-                       kind = adm1027 ;
-               } else ifcompany == LM85_COMPANY_ANALOG_DEV
+                       kind = any_chip;
+               } else if (company == LM85_COMPANY_ANALOG_DEV
+                   && verstep == LM85_VERSTEP_ADM1027) {
+                       kind = adm1027;
+               } else if (company == LM85_COMPANY_ANALOG_DEV
                    && (verstep == LM85_VERSTEP_ADT7463
-                        || verstep == LM85_VERSTEP_ADT7463C) ) {
-                       kind = adt7463 ;
-               } else ifcompany == LM85_COMPANY_ANALOG_DEV
-                   && (verstep & LM85_VERSTEP_VMASK) == LM85_VERSTEP_GENERIC ) {
+                        || verstep == LM85_VERSTEP_ADT7463C)) {
+                       kind = adt7463;
+               } else if (company == LM85_COMPANY_ANALOG_DEV
+                   && (verstep & LM85_VERSTEP_VMASK) == LM85_VERSTEP_GENERIC) {
                        dev_err(&adapter->dev, "Unrecognized version/stepping 0x%02x"
-                               " Defaulting to Generic LM85.\n", verstep );
-                       kind = any_chip ;
-               } else ifcompany == LM85_COMPANY_SMSC
+                               " Defaulting to Generic LM85.\n", verstep);
+                       kind = any_chip;
+               } else if (company == LM85_COMPANY_SMSC
                    && (verstep == LM85_VERSTEP_EMC6D100_A0
-                        || verstep == LM85_VERSTEP_EMC6D100_A1) ) {
+                        || verstep == LM85_VERSTEP_EMC6D100_A1)) {
                        /* Unfortunately, we can't tell a '100 from a '101
                         * from the registers.  Since a '101 is a '100
                         * in a package with fewer pins and therefore no
                         * 3.3V, 1.5V or 1.8V inputs, perhaps if those
                         * inputs read 0, then it's a '101.
                         */
-                       kind = emc6d100 ;
-               } else ifcompany == LM85_COMPANY_SMSC
+                       kind = emc6d100;
+               } else if (company == LM85_COMPANY_SMSC
                    && verstep == LM85_VERSTEP_EMC6D102) {
-                       kind = emc6d102 ;
-               } else ifcompany == LM85_COMPANY_SMSC
+                       kind = emc6d102;
+               } else if (company == LM85_COMPANY_SMSC
                    && (verstep & LM85_VERSTEP_VMASK) == LM85_VERSTEP_GENERIC) {
                        dev_err(&adapter->dev, "lm85: Detected SMSC chip\n");
                        dev_err(&adapter->dev, "lm85: Unrecognized version/stepping 0x%02x"
-                           " Defaulting to Generic LM85.\n", verstep );
-                       kind = any_chip ;
-               } else ifkind == any_chip
+                           " Defaulting to Generic LM85.\n", verstep);
+                       kind = any_chip;
+               } else if (kind == any_chip
                    && (verstep & LM85_VERSTEP_VMASK) == LM85_VERSTEP_GENERIC) {
                        dev_err(&adapter->dev, "Generic LM85 Version 6 detected\n");
                        /* Leave kind as "any_chip" */
                } else {
                        dev_dbg(&adapter->dev, "Autodetection failed\n");
-                       /* Not an LM85 ... */
-                       if( kind == any_chip ) {  /* User used force=x,y */
+                       /* Not an LM85... */
+                       if (kind == any_chip) {  /* User used force=x,y */
                                dev_err(&adapter->dev, "Generic LM85 Version 6 not"
                                        " found at %d,0x%02x. Try force_lm85c.\n",
-                                       i2c_adapter_id(adapter), address );
+                                       i2c_adapter_id(adapter), address);
                        }
-                       err = 0 ;
+                       err = 0;
                        goto ERROR1;
                }
        }
 
        /* Fill in the chip specific driver values */
-       if ( kind == any_chip ) {
-               type_name = "lm85";
-       } else if ( kind == lm85b ) {
+       switch (kind) {
+       case lm85b:
                type_name = "lm85b";
-       } else if ( kind == lm85c ) {
+               break;
+       case lm85c:
                type_name = "lm85c";
-       } else if ( kind == adm1027 ) {
+               break;
+       case adm1027:
                type_name = "adm1027";
-       } else if ( kind == adt7463 ) {
+               break;
+       case adt7463:
                type_name = "adt7463";
-       } else if ( kind == emc6d100){
+               break;
+       case emc6d100:
                type_name = "emc6d100";
-       } else if ( kind == emc6d102 ) {
+               break;
+       case emc6d102:
                type_name = "emc6d102";
+               break;
+       default:
+               type_name = "lm85";
        }
-       strlcpy(new_client->name, type_name, I2C_NAME_SIZE);
+       strlcpy(client->name, type_name, I2C_NAME_SIZE);
 
        /* Fill in the remaining client fields */
        data->type = kind;
-       data->valid = 0;
        mutex_init(&data->update_lock);
 
        /* Tell the I2C layer a new client has arrived */
-       if ((err = i2c_attach_client(new_client)))
+       err = i2c_attach_client(client);
+       if (err)
                goto ERROR1;
 
        /* Set the VRM version */
        data->vrm = vid_which_vrm();
 
        /* Initialize the LM85 chip */
-       lm85_init_client(new_client);
+       lm85_init_client(client);
 
        /* Register sysfs hooks */
-       if ((err = sysfs_create_group(&new_client->dev.kobj, &lm85_group)))
+       err = sysfs_create_group(&client->dev.kobj, &lm85_group);
+       if (err)
                goto ERROR2;
 
        /* The ADT7463 has an optional VRM 10 mode where pin 21 is used
           as a sixth digital VID input rather than an analog input. */
-       data->vid = lm85_read_value(new_client, LM85_REG_VID);
+       data->vid = lm85_read_value(client, LM85_REG_VID);
        if (!(kind == adt7463 && (data->vid & 0x80)))
-               if ((err = sysfs_create_group(&new_client->dev.kobj,
+               if ((err = sysfs_create_group(&client->dev.kobj,
                                        &lm85_group_in4)))
                        goto ERROR3;
 
        /* The EMC6D100 has 3 additional voltage inputs */
        if (kind == emc6d100)
-               if ((err = sysfs_create_group(&new_client->dev.kobj,
+               if ((err = sysfs_create_group(&client->dev.kobj,
                                        &lm85_group_in567)))
                        goto ERROR3;
 
-       data->hwmon_dev = hwmon_device_register(&new_client->dev);
+       data->hwmon_dev = hwmon_device_register(&client->dev);
        if (IS_ERR(data->hwmon_dev)) {
                err = PTR_ERR(data->hwmon_dev);
                goto ERROR3;
@@ -1291,16 +1273,16 @@ static int lm85_detect(struct i2c_adapter *adapter, int address,
        return 0;
 
        /* Error out and cleanup code */
   ERROR3:
-       sysfs_remove_group(&new_client->dev.kobj, &lm85_group);
-       sysfs_remove_group(&new_client->dev.kobj, &lm85_group_in4);
+ ERROR3:
+       sysfs_remove_group(&client->dev.kobj, &lm85_group);
+       sysfs_remove_group(&client->dev.kobj, &lm85_group_in4);
        if (kind == emc6d100)
-               sysfs_remove_group(&new_client->dev.kobj, &lm85_group_in567);
   ERROR2:
-       i2c_detach_client(new_client);
   ERROR1:
+               sysfs_remove_group(&client->dev.kobj, &lm85_group_in567);
+ ERROR2:
+       i2c_detach_client(client);
+ ERROR1:
        kfree(data);
   ERROR0:
+ ERROR0:
        return err;
 }
 
@@ -1323,100 +1305,46 @@ static int lm85_read_value(struct i2c_client *client, u8 reg)
        int res;
 
        /* What size location is it? */
-       switch( reg ) {
-       case LM85_REG_FAN(0) :  /* Read WORD data */
-       case LM85_REG_FAN(1) :
-       case LM85_REG_FAN(2) :
-       case LM85_REG_FAN(3) :
-       case LM85_REG_FAN_MIN(0) :
-       case LM85_REG_FAN_MIN(1) :
-       case LM85_REG_FAN_MIN(2) :
-       case LM85_REG_FAN_MIN(3) :
-       case LM85_REG_ALARM1 :  /* Read both bytes at once */
-               res = i2c_smbus_read_byte_data(client, reg) & 0xff ;
-               res |= i2c_smbus_read_byte_data(client, reg+1) << 8 ;
-               break ;
-       case ADT7463_REG_TMIN_CTL1 :  /* Read WORD MSB, LSB */
-               res = i2c_smbus_read_byte_data(client, reg) << 8 ;
-               res |= i2c_smbus_read_byte_data(client, reg+1) & 0xff ;
-               break ;
+       switch (reg) {
+       case LM85_REG_FAN(0):  /* Read WORD data */
+       case LM85_REG_FAN(1):
+       case LM85_REG_FAN(2):
+       case LM85_REG_FAN(3):
+       case LM85_REG_FAN_MIN(0):
+       case LM85_REG_FAN_MIN(1):
+       case LM85_REG_FAN_MIN(2):
+       case LM85_REG_FAN_MIN(3):
+       case LM85_REG_ALARM1:   /* Read both bytes at once */
+               res = i2c_smbus_read_byte_data(client, reg) & 0xff;
+               res |= i2c_smbus_read_byte_data(client, reg + 1) << 8;
+               break;
        default:        /* Read BYTE data */
                res = i2c_smbus_read_byte_data(client, reg);
-               break ;
+               break;
        }
 
-       return res ;
+       return res;
 }
 
-static int lm85_write_value(struct i2c_client *client, u8 reg, int value)
+static void lm85_write_value(struct i2c_client *client, u8 reg, int value)
 {
-       int res ;
-
-       switch( reg ) {
-       case LM85_REG_FAN(0) :  /* Write WORD data */
-       case LM85_REG_FAN(1) :
-       case LM85_REG_FAN(2) :
-       case LM85_REG_FAN(3) :
-       case LM85_REG_FAN_MIN(0) :
-       case LM85_REG_FAN_MIN(1) :
-       case LM85_REG_FAN_MIN(2) :
-       case LM85_REG_FAN_MIN(3) :
+       switch (reg) {
+       case LM85_REG_FAN(0):  /* Write WORD data */
+       case LM85_REG_FAN(1):
+       case LM85_REG_FAN(2):
+       case LM85_REG_FAN(3):
+       case LM85_REG_FAN_MIN(0):
+       case LM85_REG_FAN_MIN(1):
+       case LM85_REG_FAN_MIN(2):
+       case LM85_REG_FAN_MIN(3):
        /* NOTE: ALARM is read only, so not included here */
-               res = i2c_smbus_write_byte_data(client, reg, value & 0xff) ;
-               res |= i2c_smbus_write_byte_data(client, reg+1, (value>>8) & 0xff) ;
-               break ;
-       case ADT7463_REG_TMIN_CTL1 :  /* Write WORD MSB, LSB */
-               res = i2c_smbus_write_byte_data(client, reg, (value>>8) & 0xff);
-               res |= i2c_smbus_write_byte_data(client, reg+1, value & 0xff) ;
-               break ;
+               i2c_smbus_write_byte_data(client, reg, value & 0xff);
+               i2c_smbus_write_byte_data(client, reg + 1, value >> 8);
+               break;
        default:        /* Write BYTE data */
-               res = i2c_smbus_write_byte_data(client, reg, value);
-               break ;
+               i2c_smbus_write_byte_data(client, reg, value);
+               break;
        }
-
-       return res ;
-}
-
-static void lm85_init_client(struct i2c_client *client)
-{
-       int value;
-       struct lm85_data *data = i2c_get_clientdata(client);
-
-       dev_dbg(&client->dev, "Initializing device\n");
-
-       /* Warn if part was not "READY" */
-       value = lm85_read_value(client, LM85_REG_CONFIG);
-       dev_dbg(&client->dev, "LM85_REG_CONFIG is: 0x%02x\n", value);
-       if( value & 0x02 ) {
-               dev_err(&client->dev, "Client (%d,0x%02x) config is locked.\n",
-                           i2c_adapter_id(client->adapter), client->addr );
-       };
-       if( ! (value & 0x04) ) {
-               dev_err(&client->dev, "Client (%d,0x%02x) is not ready.\n",
-                           i2c_adapter_id(client->adapter), client->addr );
-       };
-       if( value & 0x10
-           && ( data->type == adm1027
-               || data->type == adt7463 ) ) {
-               dev_err(&client->dev, "Client (%d,0x%02x) VxI mode is set.  "
-                       "Please report this to the lm85 maintainer.\n",
-                           i2c_adapter_id(client->adapter), client->addr );
-       };
-
-       /* WE INTENTIONALLY make no changes to the limits,
-        *   offsets, pwms, fans and zones.  If they were
-        *   configured, we don't want to mess with them.
-        *   If they weren't, the default is 100% PWM, no
-        *   control and will suffice until 'sensors -s'
-        *   can be run by the user.
-        */
-
-       /* Start monitoring */
-       value = lm85_read_value(client, LM85_REG_CONFIG);
-       /* Try to clear LOCK, Set START, save everything else */
-       value = (value & ~ 0x02) | 0x01 ;
-       dev_dbg(&client->dev, "Setting CONFIG to: 0x%02x\n", value);
-       lm85_write_value(client, LM85_REG_CONFIG, value);
 }
 
 static struct lm85_data *lm85_update_device(struct device *dev)
@@ -1427,28 +1355,30 @@ static struct lm85_data *lm85_update_device(struct device *dev)
 
        mutex_lock(&data->update_lock);
 
-       if ( !data->valid ||
-            time_after(jiffies, data->last_reading + LM85_DATA_INTERVAL) ) {
+       if (!data->valid ||
+            time_after(jiffies, data->last_reading + LM85_DATA_INTERVAL)) {
                /* Things that change quickly */
                dev_dbg(&client->dev, "Reading sensor values\n");
-               
+
                /* Have to read extended bits first to "freeze" the
                 * more significant bits that are read later.
                 * There are 2 additional resolution bits per channel and we
                 * have room for 4, so we shift them to the left.
                 */
-               if ( (data->type == adm1027) || (data->type == adt7463) ) {
+               if (data->type == adm1027 || data->type == adt7463) {
                        int ext1 = lm85_read_value(client,
                                                   ADM1027_REG_EXTEND_ADC1);
                        int ext2 =  lm85_read_value(client,
                                                    ADM1027_REG_EXTEND_ADC2);
                        int val = (ext1 << 8) + ext2;
 
-                       for(i = 0; i <= 4; i++)
-                               data->in_ext[i] = ((val>>(i * 2))&0x03) << 2;
+                       for (i = 0; i <= 4; i++)
+                               data->in_ext[i] =
+                                       ((val >> (i * 2)) & 0x03) << 2;
 
-                       for(i = 0; i <= 2; i++)
-                               data->temp_ext[i] = (val>>((i + 4) * 2))&0x0c;
+                       for (i = 0; i <= 2; i++)
+                               data->temp_ext[i] =
+                                       (val >> ((i + 4) * 2)) & 0x0c;
                }
 
                data->vid = lm85_read_value(client, LM85_REG_VID);
@@ -1456,6 +1386,8 @@ static struct lm85_data *lm85_update_device(struct device *dev)
                for (i = 0; i <= 3; ++i) {
                        data->in[i] =
                            lm85_read_value(client, LM85_REG_IN(i));
+                       data->fan[i] =
+                           lm85_read_value(client, LM85_REG_FAN(i));
                }
 
                if (!(data->type == adt7463 && (data->vid & 0x80))) {
@@ -1463,38 +1395,25 @@ static struct lm85_data *lm85_update_device(struct device *dev)
                                      LM85_REG_IN(4));
                }
 
-               for (i = 0; i <= 3; ++i) {
-                       data->fan[i] =
-                           lm85_read_value(client, LM85_REG_FAN(i));
-               }
-
                for (i = 0; i <= 2; ++i) {
                        data->temp[i] =
                            lm85_read_value(client, LM85_REG_TEMP(i));
-               }
-
-               for (i = 0; i <= 2; ++i) {
                        data->pwm[i] =
                            lm85_read_value(client, LM85_REG_PWM(i));
                }
 
                data->alarms = lm85_read_value(client, LM85_REG_ALARM1);
 
-               if ( data->type == adt7463 ) {
-                       if( data->therm_total < ULONG_MAX - 256 ) {
-                           data->therm_total +=
-                               lm85_read_value(client, ADT7463_REG_THERM );
-                       }
-               } else if ( data->type == emc6d100 ) {
+               if (data->type == emc6d100) {
                        /* Three more voltage sensors */
                        for (i = 5; i <= 7; ++i) {
-                               data->in[i] =
-                                       lm85_read_value(client, EMC6D100_REG_IN(i));
+                               data->in[i] = lm85_read_value(client,
+                                                       EMC6D100_REG_IN(i));
                        }
                        /* More alarm bits */
-                       data->alarms |=
-                               lm85_read_value(client, EMC6D100_REG_ALARM3) << 16;
-               } else if (data->type == emc6d102 ) {
+                       data->alarms |= lm85_read_value(client,
+                                               EMC6D100_REG_ALARM3) << 16;
+               } else if (data->type == emc6d102) {
                        /* Have to read LSB bits after the MSB ones because
                           the reading of the MSB bits has frozen the
                           LSBs (backward from the ADM1027).
@@ -1509,20 +1428,20 @@ static struct lm85_data *lm85_update_device(struct device *dev)
                                                   EMC6D102_REG_EXTEND_ADC4);
                        data->in_ext[0] = ext3 & 0x0f;
                        data->in_ext[1] = ext4 & 0x0f;
-                       data->in_ext[2] = (ext4 >> 4) & 0x0f;
-                       data->in_ext[3] = (ext3 >> 4) & 0x0f;
-                       data->in_ext[4] = (ext2 >> 4) & 0x0f;
+                       data->in_ext[2] = ext4 >> 4;
+                       data->in_ext[3] = ext3 >> 4;
+                       data->in_ext[4] = ext2 >> 4;
 
                        data->temp_ext[0] = ext1 & 0x0f;
                        data->temp_ext[1] = ext2 & 0x0f;
-                       data->temp_ext[2] = (ext1 >> 4) & 0x0f;
+                       data->temp_ext[2] = ext1 >> 4;
                }
 
-               data->last_reading = jiffies ;
-       };  /* last_reading */
+               data->last_reading = jiffies;
+       }  /* last_reading */
 
-       if ( !data->valid ||
-            time_after(jiffies, data->last_config + LM85_CONFIG_INTERVAL) ) {
+       if (!data->valid ||
+            time_after(jiffies, data->last_config + LM85_CONFIG_INTERVAL)) {
                /* Things that don't change often */
                dev_dbg(&client->dev, "Reading config values\n");
 
@@ -1531,6 +1450,8 @@ static struct lm85_data *lm85_update_device(struct device *dev)
                            lm85_read_value(client, LM85_REG_IN_MIN(i));
                        data->in_max[i] =
                            lm85_read_value(client, LM85_REG_IN_MAX(i));
+                       data->fan_min[i] =
+                           lm85_read_value(client, LM85_REG_FAN_MIN(i));
                }
 
                if (!(data->type == adt7463 && (data->vid & 0x80))) {
@@ -1540,34 +1461,28 @@ static struct lm85_data *lm85_update_device(struct device *dev)
                                          LM85_REG_IN_MAX(4));
                }
 
-               if ( data->type == emc6d100 ) {
+               if (data->type == emc6d100) {
                        for (i = 5; i <= 7; ++i) {
-                               data->in_min[i] =
-                                       lm85_read_value(client, EMC6D100_REG_IN_MIN(i));
-                               data->in_max[i] =
-                                       lm85_read_value(client, EMC6D100_REG_IN_MAX(i));
+                               data->in_min[i] = lm85_read_value(client,
+                                               EMC6D100_REG_IN_MIN(i));
+                               data->in_max[i] = lm85_read_value(client,
+                                               EMC6D100_REG_IN_MAX(i));
                        }
                }
 
-               for (i = 0; i <= 3; ++i) {
-                       data->fan_min[i] =
-                           lm85_read_value(client, LM85_REG_FAN_MIN(i));
-               }
-
                for (i = 0; i <= 2; ++i) {
+                       int val;
+
                        data->temp_min[i] =
                            lm85_read_value(client, LM85_REG_TEMP_MIN(i));
                        data->temp_max[i] =
                            lm85_read_value(client, LM85_REG_TEMP_MAX(i));
-               }
 
-               for (i = 0; i <= 2; ++i) {
-                       int val ;
                        data->autofan[i].config =
                            lm85_read_value(client, LM85_REG_AFAN_CONFIG(i));
                        val = lm85_read_value(client, LM85_REG_AFAN_RANGE(i));
-                       data->autofan[i].freq = val & 0x07 ;
-                       data->zone[i].range = (val >> 4) & 0x0f ;
+                       data->autofan[i].freq = val & 0x07;
+                       data->zone[i].range = val >> 4;
                        data->autofan[i].min_pwm =
                            lm85_read_value(client, LM85_REG_AFAN_MINPWM(i));
                        data->zone[i].limit =
@@ -1577,50 +1492,19 @@ static struct lm85_data *lm85_update_device(struct device *dev)
                }
 
                i = lm85_read_value(client, LM85_REG_AFAN_SPIKE1);
-               data->smooth[0] = i & 0x0f ;
-               data->syncpwm3 = i & 0x10 ;  /* Save PWM3 config */
-               data->autofan[0].min_off = (i & 0x20) != 0 ;
-               data->autofan[1].min_off = (i & 0x40) != 0 ;
-               data->autofan[2].min_off = (i & 0x80) != 0 ;
-               i = lm85_read_value(client, LM85_REG_AFAN_SPIKE2);
-               data->smooth[1] = (i>>4) & 0x0f ;
-               data->smooth[2] = i & 0x0f ;
+               data->autofan[0].min_off = (i & 0x20) != 0;
+               data->autofan[1].min_off = (i & 0x40) != 0;
+               data->autofan[2].min_off = (i & 0x80) != 0;
 
                i = lm85_read_value(client, LM85_REG_AFAN_HYST1);
-               data->zone[0].hyst = (i>>4) & 0x0f ;
-               data->zone[1].hyst = i & 0x0f ;
+               data->zone[0].hyst = i >> 4;
+               data->zone[1].hyst = i & 0x0f;
 
                i = lm85_read_value(client, LM85_REG_AFAN_HYST2);
-               data->zone[2].hyst = (i>>4) & 0x0f ;
-
-               if ( (data->type == lm85b) || (data->type == lm85c) ) {
-                       data->tach_mode = lm85_read_value(client,
-                               LM85_REG_TACH_MODE );
-                       data->spinup_ctl = lm85_read_value(client,
-                               LM85_REG_SPINUP_CTL );
-               } else if ( (data->type == adt7463) || (data->type == adm1027) ) {
-                       if ( data->type == adt7463 ) {
-                               for (i = 0; i <= 2; ++i) {
-                                   data->oppoint[i] = lm85_read_value(client,
-                                       ADT7463_REG_OPPOINT(i) );
-                               }
-                               data->tmin_ctl = lm85_read_value(client,
-                                       ADT7463_REG_TMIN_CTL1 );
-                               data->therm_limit = lm85_read_value(client,
-                                       ADT7463_REG_THERM_LIMIT );
-                       }
-                       for (i = 0; i <= 2; ++i) {
-                           data->temp_offset[i] = lm85_read_value(client,
-                               ADM1027_REG_TEMP_OFFSET(i) );
-                       }
-                       data->tach_mode = lm85_read_value(client,
-                               ADM1027_REG_CONFIG3 );
-                       data->fan_ppr = lm85_read_value(client,
-                               ADM1027_REG_FAN_PPR );
-               }
-       
+               data->zone[2].hyst = i >> 4;
+
                data->last_config = jiffies;
-       };  /* last_config */
+       }  /* last_config */
 
        data->valid = 1;
 
@@ -1635,17 +1519,15 @@ static int __init sm_lm85_init(void)
        return i2c_add_driver(&lm85_driver);
 }
 
-static void  __exit sm_lm85_exit(void)
+static void __exit sm_lm85_exit(void)
 {
        i2c_del_driver(&lm85_driver);
 }
 
-/* Thanks to Richard Barrington for adding the LM85 to sensors-detect.
- * Thanks to Margit Schubert-While <margitsw@t-online.de> for help with
- *     post 2.7.0 CVS changes.
- */
 MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Philip Pokorny <ppokorny@penguincomputing.com>, Margit Schubert-While <margitsw@t-online.de>, Justin Thiessen <jthiessen@penguincomputing.com");
+MODULE_AUTHOR("Philip Pokorny <ppokorny@penguincomputing.com>, "
+       "Margit Schubert-While <margitsw@t-online.de>, "
+       "Justin Thiessen <jthiessen@penguincomputing.com>");
 MODULE_DESCRIPTION("LM85-B, LM85-C driver");
 
 module_init(sm_lm85_init);
index 3b01001..7d97431 100644 (file)
@@ -55,8 +55,11 @@ I2C_CLIENT_MODULE_PARM(adm1022_temp3, "List of adapter,address pairs "
 static const u8 THMC50_REG_TEMP[] = { 0x27, 0x26, 0x20 };
 static const u8 THMC50_REG_TEMP_MIN[] = { 0x3A, 0x38, 0x2C };
 static const u8 THMC50_REG_TEMP_MAX[] = { 0x39, 0x37, 0x2B };
+static const u8 THMC50_REG_TEMP_CRITICAL[] = { 0x13, 0x14, 0x14 };
+static const u8 THMC50_REG_TEMP_DEFAULT[] = { 0x17, 0x18, 0x18 };
 
 #define THMC50_REG_CONF_nFANOFF                        0x20
+#define THMC50_REG_CONF_PROGRAMMED             0x08
 
 /* Each client has this additional data */
 struct thmc50_data {
@@ -72,6 +75,7 @@ struct thmc50_data {
        s8 temp_input[3];
        s8 temp_max[3];
        s8 temp_min[3];
+       s8 temp_critical[3];
        u8 analog_out;
        u8 alarms;
 };
@@ -199,6 +203,15 @@ static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr,
        return count;
 }
 
+static ssize_t show_temp_critical(struct device *dev,
+                                 struct device_attribute *attr,
+                                 char *buf)
+{
+       int nr = to_sensor_dev_attr(attr)->index;
+       struct thmc50_data *data = thmc50_update_device(dev);
+       return sprintf(buf, "%d\n", data->temp_critical[nr] * 1000);
+}
+
 static ssize_t show_alarm(struct device *dev, struct device_attribute *attr,
                          char *buf)
 {
@@ -214,7 +227,9 @@ static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, show_temp, \
 static SENSOR_DEVICE_ATTR(temp##offset##_min, S_IRUGO | S_IWUSR,       \
                        show_temp_min, set_temp_min, offset - 1);       \
 static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IRUGO | S_IWUSR,       \
-                       show_temp_max, set_temp_max, offset - 1);
+                       show_temp_max, set_temp_max, offset - 1);       \
+static SENSOR_DEVICE_ATTR(temp##offset##_crit, S_IRUGO,                        \
+                       show_temp_critical, NULL, offset - 1);
 
 temp_reg(1);
 temp_reg(2);
@@ -234,10 +249,12 @@ static struct attribute *thmc50_attributes[] = {
        &sensor_dev_attr_temp1_max.dev_attr.attr,
        &sensor_dev_attr_temp1_min.dev_attr.attr,
        &sensor_dev_attr_temp1_input.dev_attr.attr,
+       &sensor_dev_attr_temp1_crit.dev_attr.attr,
        &sensor_dev_attr_temp1_alarm.dev_attr.attr,
        &sensor_dev_attr_temp2_max.dev_attr.attr,
        &sensor_dev_attr_temp2_min.dev_attr.attr,
        &sensor_dev_attr_temp2_input.dev_attr.attr,
+       &sensor_dev_attr_temp2_crit.dev_attr.attr,
        &sensor_dev_attr_temp2_alarm.dev_attr.attr,
        &sensor_dev_attr_temp2_fault.dev_attr.attr,
        &sensor_dev_attr_pwm1.dev_attr.attr,
@@ -254,6 +271,7 @@ static struct attribute *temp3_attributes[] = {
        &sensor_dev_attr_temp3_max.dev_attr.attr,
        &sensor_dev_attr_temp3_min.dev_attr.attr,
        &sensor_dev_attr_temp3_input.dev_attr.attr,
+       &sensor_dev_attr_temp3_crit.dev_attr.attr,
        &sensor_dev_attr_temp3_alarm.dev_attr.attr,
        &sensor_dev_attr_temp3_fault.dev_attr.attr,
        NULL
@@ -429,6 +447,10 @@ static struct thmc50_data *thmc50_update_device(struct device *dev)
 
                int temps = data->has_temp3 ? 3 : 2;
                int i;
+               int prog = i2c_smbus_read_byte_data(client, THMC50_REG_CONF);
+
+               prog &= THMC50_REG_CONF_PROGRAMMED;
+
                for (i = 0; i < temps; i++) {
                        data->temp_input[i] = i2c_smbus_read_byte_data(client,
                                                THMC50_REG_TEMP[i]);
@@ -436,6 +458,10 @@ static struct thmc50_data *thmc50_update_device(struct device *dev)
                                                THMC50_REG_TEMP_MAX[i]);
                        data->temp_min[i] = i2c_smbus_read_byte_data(client,
                                                THMC50_REG_TEMP_MIN[i]);
+                       data->temp_critical[i] =
+                               i2c_smbus_read_byte_data(client,
+                                       prog ? THMC50_REG_TEMP_CRITICAL[i]
+                                            : THMC50_REG_TEMP_DEFAULT[i]);
                }
                data->analog_out =
                    i2c_smbus_read_byte_data(client, THMC50_REG_ANALOG_OUT);
index 9564fb0..b30e579 100644 (file)
@@ -67,10 +67,6 @@ module_param(force_i2c, byte, 0);
 MODULE_PARM_DESC(force_i2c,
                 "Initialize the i2c address of the sensors");
 
-static int reset;
-module_param(reset, bool, 0);
-MODULE_PARM_DESC(reset, "Set to one to reset chip on load");
-
 static int init = 1;
 module_param(init, bool, 0);
 MODULE_PARM_DESC(init, "Set to zero to bypass chip initialization");
@@ -209,6 +205,13 @@ static const u16 w83627hf_reg_temp_over[]  = { 0x39, 0x155, 0x255 };
 #define W83627HF_REG_PWM1 0x5A
 #define W83627HF_REG_PWM2 0x5B
 
+static const u8 W83627THF_REG_PWM_ENABLE[] = {
+       0x04,           /* FAN 1 mode */
+       0x04,           /* FAN 2 mode */
+       0x12,           /* FAN AUX mode */
+};
+static const u8 W83627THF_PWM_ENABLE_SHIFT[] = { 2, 4, 1 };
+
 #define W83627THF_REG_PWM1             0x01    /* 697HF/637HF/687THF too */
 #define W83627THF_REG_PWM2             0x03    /* 697HF/637HF/687THF too */
 #define W83627THF_REG_PWM3             0x11    /* 637HF/687THF too */
@@ -366,6 +369,9 @@ struct w83627hf_data {
        u32 alarms;             /* Register encoding, combined */
        u32 beep_mask;          /* Register encoding, combined */
        u8 pwm[3];              /* Register value */
+       u8 pwm_enable[3];       /* 1 = manual
+                                  2 = thermal cruise (also called SmartFan I)
+                                  3 = fan speed cruise */
        u8 pwm_freq[3];         /* Register value */
        u16 sens[3];            /* 1 = pentium diode; 2 = 3904 diode;
                                   4 = thermistor */
@@ -956,6 +962,42 @@ static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO|S_IWUSR, show_pwm, store_pwm, 0);
 static SENSOR_DEVICE_ATTR(pwm2, S_IRUGO|S_IWUSR, show_pwm, store_pwm, 1);
 static SENSOR_DEVICE_ATTR(pwm3, S_IRUGO|S_IWUSR, show_pwm, store_pwm, 2);
 
+static ssize_t
+show_pwm_enable(struct device *dev, struct device_attribute *devattr, char *buf)
+{
+       int nr = to_sensor_dev_attr(devattr)->index;
+       struct w83627hf_data *data = w83627hf_update_device(dev);
+       return sprintf(buf, "%d\n", data->pwm_enable[nr]);
+}
+
+static ssize_t
+store_pwm_enable(struct device *dev, struct device_attribute *devattr,
+         const char *buf, size_t count)
+{
+       int nr = to_sensor_dev_attr(devattr)->index;
+       struct w83627hf_data *data = dev_get_drvdata(dev);
+       unsigned long val = simple_strtoul(buf, NULL, 10);
+       u8 reg;
+
+       if (!val || (val > 3))  /* modes 1, 2 and 3 are supported */
+               return -EINVAL;
+       mutex_lock(&data->update_lock);
+       data->pwm_enable[nr] = val;
+       reg = w83627hf_read_value(data, W83627THF_REG_PWM_ENABLE[nr]);
+       reg &= ~(0x03 << W83627THF_PWM_ENABLE_SHIFT[nr]);
+       reg |= (val - 1) << W83627THF_PWM_ENABLE_SHIFT[nr];
+       w83627hf_write_value(data, W83627THF_REG_PWM_ENABLE[nr], reg);
+       mutex_unlock(&data->update_lock);
+       return count;
+}
+
+static SENSOR_DEVICE_ATTR(pwm1_enable, S_IRUGO|S_IWUSR, show_pwm_enable,
+                                                 store_pwm_enable, 0);
+static SENSOR_DEVICE_ATTR(pwm2_enable, S_IRUGO|S_IWUSR, show_pwm_enable,
+                                                 store_pwm_enable, 1);
+static SENSOR_DEVICE_ATTR(pwm3_enable, S_IRUGO|S_IWUSR, show_pwm_enable,
+                                                 store_pwm_enable, 2);
+
 static ssize_t
 show_pwm_freq(struct device *dev, struct device_attribute *devattr, char *buf)
 {
@@ -1223,6 +1265,11 @@ static struct attribute *w83627hf_attributes_opt[] = {
        &sensor_dev_attr_pwm1_freq.dev_attr.attr,
        &sensor_dev_attr_pwm2_freq.dev_attr.attr,
        &sensor_dev_attr_pwm3_freq.dev_attr.attr,
+
+       &sensor_dev_attr_pwm1_enable.dev_attr.attr,
+       &sensor_dev_attr_pwm2_enable.dev_attr.attr,
+       &sensor_dev_attr_pwm3_enable.dev_attr.attr,
+
        NULL
 };
 
@@ -1366,6 +1413,19 @@ static int __devinit w83627hf_probe(struct platform_device *pdev)
                                &sensor_dev_attr_pwm3_freq.dev_attr)))
                        goto ERROR4;
 
+       if (data->type != w83627hf)
+               if ((err = device_create_file(dev,
+                               &sensor_dev_attr_pwm1_enable.dev_attr))
+                || (err = device_create_file(dev,
+                               &sensor_dev_attr_pwm2_enable.dev_attr)))
+                       goto ERROR4;
+
+       if (data->type == w83627thf || data->type == w83637hf
+        || data->type == w83687thf)
+               if ((err = device_create_file(dev,
+                               &sensor_dev_attr_pwm3_enable.dev_attr)))
+                       goto ERROR4;
+
        data->hwmon_dev = hwmon_device_register(dev);
        if (IS_ERR(data->hwmon_dev)) {
                err = PTR_ERR(data->hwmon_dev);
@@ -1536,29 +1596,6 @@ static void __devinit w83627hf_init_device(struct platform_device *pdev)
        enum chips type = data->type;
        u8 tmp;
 
-       if (reset) {
-               /* Resetting the chip has been the default for a long time,
-                  but repeatedly caused problems (fans going to full
-                  speed...) so it is now optional. It might even go away if
-                  nobody reports it as being useful, as I see very little
-                  reason why this would be needed at all. */
-               dev_info(&pdev->dev, "If reset=1 solved a problem you were "
-                        "having, please report!\n");
-
-               /* save this register */
-               i = w83627hf_read_value(data, W83781D_REG_BEEP_CONFIG);
-               /* Reset all except Watchdog values and last conversion values
-                  This sets fan-divs to 2, among others */
-               w83627hf_write_value(data, W83781D_REG_CONFIG, 0x80);
-               /* Restore the register and disable power-on abnormal beep.
-                  This saves FAN 1/2/3 input/output values set by BIOS. */
-               w83627hf_write_value(data, W83781D_REG_BEEP_CONFIG, i | 0x80);
-               /* Disable master beep-enable (reset turns it on).
-                  Individual beeps should be reset to off but for some reason
-                  disabling this bit helps some people not get beeped */
-               w83627hf_write_value(data, W83781D_REG_BEEP_INTS2, 0);
-       }
-
        /* Minimize conflicts with other winbond i2c-only clients...  */
        /* disable i2c subclients... how to disable main i2c client?? */
        /* force i2c address to relatively uncommon address */
@@ -1655,6 +1692,7 @@ static struct w83627hf_data *w83627hf_update_device(struct device *dev)
 {
        struct w83627hf_data *data = dev_get_drvdata(dev);
        int i, num_temps = (data->type == w83697hf) ? 2 : 3;
+       int num_pwms = (data->type == w83697hf) ? 2 : 3;
 
        mutex_lock(&data->update_lock);
 
@@ -1707,6 +1745,15 @@ static struct w83627hf_data *w83627hf_update_device(struct device *dev)
                                        break;
                        }
                }
+               if (data->type != w83627hf) {
+                       for (i = 0; i < num_pwms; i++) {
+                               u8 tmp = w83627hf_read_value(data,
+                                       W83627THF_REG_PWM_ENABLE[i]);
+                               data->pwm_enable[i] =
+                                       ((tmp >> W83627THF_PWM_ENABLE_SHIFT[i])
+                                       & 0x03) + 1;
+                       }
+               }
                for (i = 0; i < num_temps; i++) {
                        data->temp[i] = w83627hf_read_value(
                                                data, w83627hf_reg_temp[i]);
index e4e91c9..daa7d12 100644 (file)
@@ -233,11 +233,9 @@ static u8 fan_to_reg(long rpm, int div)
 static u8 div_to_reg(int nr, long val)
 {
        int i;
-       int max;
 
-       /* first three fan's divisor max out at 8, rest max out at 128 */
-       max = (nr < 3) ? 8 : 128;
-       val = SENSORS_LIMIT(val, 1, max) >> 1;
+       /* fan divisors max out at 128 */
+       val = SENSORS_LIMIT(val, 1, 128) >> 1;
        for (i = 0; i < 7; i++) {
                if (val == 0)
                        break;
@@ -530,6 +528,7 @@ static ssize_t store_fan_div(struct device *dev, struct device_attribute *attr,
        unsigned long min;
        u8 tmp_fan_div;
        u8 fan_div_reg;
+       u8 vbat_reg;
        int indx = 0;
        u8 keep_mask = 0;
        u8 new_shift = 0;
@@ -581,6 +580,16 @@ static ssize_t store_fan_div(struct device *dev, struct device_attribute *attr,
        w83791d_write(client, W83791D_REG_FAN_DIV[indx],
                                fan_div_reg | tmp_fan_div);
 
+       /* Bit 2 of fans 0-2 is stored in the vbat register (bits 5-7) */
+       if (nr < 3) {
+               keep_mask = ~(1 << (nr + 5));
+               vbat_reg = w83791d_read(client, W83791D_REG_VBAT)
+                               & keep_mask;
+               tmp_fan_div = (data->fan_div[nr] << (3 + nr)) & ~keep_mask;
+               w83791d_write(client, W83791D_REG_VBAT,
+                               vbat_reg | tmp_fan_div);
+       }
+
        /* Restore fan_min */
        data->fan_min[nr] = fan_to_reg(min, DIV_FROM_REG(data->fan_div[nr]));
        w83791d_write(client, W83791D_REG_FAN_MIN[nr], data->fan_min[nr]);
@@ -1182,6 +1191,7 @@ static struct w83791d_data *w83791d_update_device(struct device *dev)
        struct w83791d_data *data = i2c_get_clientdata(client);
        int i, j;
        u8 reg_array_tmp[3];
+       u8 vbat_reg;
 
        mutex_lock(&data->update_lock);
 
@@ -1219,6 +1229,12 @@ static struct w83791d_data *w83791d_update_device(struct device *dev)
                data->fan_div[3] = reg_array_tmp[2] & 0x07;
                data->fan_div[4] = (reg_array_tmp[2] >> 4) & 0x07;
 
+               /* The fan divisor for fans 0-2 get bit 2 from
+                  bits 5-7 respectively of vbat register */
+               vbat_reg = w83791d_read(client, W83791D_REG_VBAT);
+               for (i = 0; i < 3; i++)
+                       data->fan_div[i] |= (vbat_reg >> (3 + i)) & 0x04;
+
                /* Update the first temperature sensor */
                for (i = 0; i < 3; i++) {
                        data->temp1[i] = w83791d_read(client,
index 130ef64..a34758d 100644 (file)
@@ -54,16 +54,6 @@ menuconfig IDE
 
 if IDE
 
-config IDE_MAX_HWIFS
-       int "Max IDE interfaces"
-       depends on ALPHA || SUPERH || IA64 || EMBEDDED
-       range 1 10
-       default 4
-       help
-         This is the maximum number of IDE hardware interfaces that will
-         be supported by the driver. Make sure it is at least as high as
-         the number of IDE interfaces in your system.
-
 config BLK_DEV_IDE
        tristate "Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support"
        ---help---
index 3e842d6..f788fa5 100644 (file)
@@ -309,7 +309,7 @@ static void __devinit palm_bk3710_chipinit(void __iomem *base)
        palm_bk3710_setpiomode(base, NULL, 1, 600, 0);
 }
 
-static u8 __devinit palm_bk3710_cable_detect(ide_hwif_t *hwif)
+static u8 palm_bk3710_cable_detect(ide_hwif_t *hwif)
 {
        return ATA_CBL_PATA80;
 }
index e617cf0..89a112d 100644 (file)
@@ -66,11 +66,11 @@ static struct cdrom_info *ide_cd_get(struct gendisk *disk)
        mutex_lock(&idecd_ref_mutex);
        cd = ide_cd_g(disk);
        if (cd) {
-               kref_get(&cd->kref);
-               if (ide_device_get(cd->drive)) {
-                       kref_put(&cd->kref, ide_cd_release);
+               if (ide_device_get(cd->drive))
                        cd = NULL;
-               }
+               else
+                       kref_get(&cd->kref);
+
        }
        mutex_unlock(&idecd_ref_mutex);
        return cd;
@@ -78,9 +78,11 @@ static struct cdrom_info *ide_cd_get(struct gendisk *disk)
 
 static void ide_cd_put(struct cdrom_info *cd)
 {
+       ide_drive_t *drive = cd->drive;
+
        mutex_lock(&idecd_ref_mutex);
-       ide_device_put(cd->drive);
        kref_put(&cd->kref, ide_cd_release);
+       ide_device_put(drive);
        mutex_unlock(&idecd_ref_mutex);
 }
 
@@ -1305,6 +1307,7 @@ static int cdrom_read_capacity(ide_drive_t *drive, unsigned long *capacity,
        int stat;
        unsigned char cmd[BLK_MAX_CDB];
        unsigned len = sizeof(capbuf);
+       u32 blocklen;
 
        memset(cmd, 0, BLK_MAX_CDB);
        cmd[0] = GPCMD_READ_CDVD_CAPACITY;
@@ -1317,23 +1320,24 @@ static int cdrom_read_capacity(ide_drive_t *drive, unsigned long *capacity,
        /*
         * Sanity check the given block size
         */
-       switch (capbuf.blocklen) {
-       case __constant_cpu_to_be32(512):
-       case __constant_cpu_to_be32(1024):
-       case __constant_cpu_to_be32(2048):
-       case __constant_cpu_to_be32(4096):
+       blocklen = be32_to_cpu(capbuf.blocklen);
+       switch (blocklen) {
+       case 512:
+       case 1024:
+       case 2048:
+       case 4096:
                break;
        default:
                printk(KERN_ERR "%s: weird block size %u\n",
-                       drive->name, capbuf.blocklen);
+                       drive->name, blocklen);
                printk(KERN_ERR "%s: default to 2kb block size\n",
                        drive->name);
-               capbuf.blocklen = __constant_cpu_to_be32(2048);
+               blocklen = 2048;
                break;
        }
 
        *capacity = 1 + be32_to_cpu(capbuf.lba);
-       *sectors_per_frame = be32_to_cpu(capbuf.blocklen) >> SECTOR_BITS;
+       *sectors_per_frame = blocklen >> SECTOR_BITS;
        return 0;
 }
 
index 28d85b4..68b9cf0 100644 (file)
@@ -65,11 +65,10 @@ static struct ide_disk_obj *ide_disk_get(struct gendisk *disk)
        mutex_lock(&idedisk_ref_mutex);
        idkp = ide_disk_g(disk);
        if (idkp) {
-               kref_get(&idkp->kref);
-               if (ide_device_get(idkp->drive)) {
-                       kref_put(&idkp->kref, ide_disk_release);
+               if (ide_device_get(idkp->drive))
                        idkp = NULL;
-               }
+               else
+                       kref_get(&idkp->kref);
        }
        mutex_unlock(&idedisk_ref_mutex);
        return idkp;
@@ -77,9 +76,11 @@ static struct ide_disk_obj *ide_disk_get(struct gendisk *disk)
 
 static void ide_disk_put(struct ide_disk_obj *idkp)
 {
+       ide_drive_t *drive = idkp->drive;
+
        mutex_lock(&idedisk_ref_mutex);
-       ide_device_put(idkp->drive);
        kref_put(&idkp->kref, ide_disk_release);
+       ide_device_put(drive);
        mutex_unlock(&idedisk_ref_mutex);
 }
 
index 71c377a..adc6827 100644 (file)
@@ -649,11 +649,7 @@ static unsigned int ide_get_mode_mask(ide_drive_t *drive, u8 base, u8 req_mode)
                if (id->field_valid & 2) {
                        mask = id->dma_1word & hwif->swdma_mask;
                } else if (id->tDMA) {
-                       /*
-                        * ide_fix_driveid() doesn't convert ->tDMA to the
-                        * CPU endianness so we need to do it here
-                        */
-                       u8 mode = le16_to_cpu(id->tDMA);
+                       u8 mode = id->tDMA;
 
                        /*
                         * if the mode is valid convert it to the mask
index ca11a26..e9034c0 100644 (file)
@@ -167,11 +167,10 @@ static struct ide_floppy_obj *ide_floppy_get(struct gendisk *disk)
        mutex_lock(&idefloppy_ref_mutex);
        floppy = ide_floppy_g(disk);
        if (floppy) {
-               kref_get(&floppy->kref);
-               if (ide_device_get(floppy->drive)) {
-                       kref_put(&floppy->kref, idefloppy_cleanup_obj);
+               if (ide_device_get(floppy->drive))
                        floppy = NULL;
-               }
+               else
+                       kref_get(&floppy->kref);
        }
        mutex_unlock(&idefloppy_ref_mutex);
        return floppy;
@@ -179,9 +178,11 @@ static struct ide_floppy_obj *ide_floppy_get(struct gendisk *disk)
 
 static void ide_floppy_put(struct ide_floppy_obj *floppy)
 {
+       ide_drive_t *drive = floppy->drive;
+
        mutex_lock(&idefloppy_ref_mutex);
-       ide_device_put(floppy->drive);
        kref_put(&floppy->kref, idefloppy_cleanup_obj);
+       ide_device_put(drive);
        mutex_unlock(&idefloppy_ref_mutex);
 }
 
index 8aae917..2cbadff 100644 (file)
@@ -484,11 +484,11 @@ void ide_fix_driveid (struct hd_driveid *id)
        for (i = 0; i < 3; i++)
                id->words157_159[i] = __le16_to_cpu(id->words157_159[i]);
        id->cfa_power      = __le16_to_cpu(id->cfa_power);
-       for (i = 0; i < 14; i++)
+       for (i = 0; i < 15; i++)
                id->words161_175[i] = __le16_to_cpu(id->words161_175[i]);
-       for (i = 0; i < 31; i++)
+       for (i = 0; i < 30; i++)
                id->words176_205[i] = __le16_to_cpu(id->words176_205[i]);
-       for (i = 0; i < 48; i++)
+       for (i = 0; i < 49; i++)
                id->words206_254[i] = __le16_to_cpu(id->words206_254[i]);
        id->integrity_word  = __le16_to_cpu(id->integrity_word);
 # else
index 82c2afe..1bce84b 100644 (file)
@@ -331,11 +331,10 @@ static struct ide_tape_obj *ide_tape_get(struct gendisk *disk)
        mutex_lock(&idetape_ref_mutex);
        tape = ide_tape_g(disk);
        if (tape) {
-               kref_get(&tape->kref);
-               if (ide_device_get(tape->drive)) {
-                       kref_put(&tape->kref, ide_tape_release);
+               if (ide_device_get(tape->drive))
                        tape = NULL;
-               }
+               else
+                       kref_get(&tape->kref);
        }
        mutex_unlock(&idetape_ref_mutex);
        return tape;
@@ -343,9 +342,11 @@ static struct ide_tape_obj *ide_tape_get(struct gendisk *disk)
 
 static void ide_tape_put(struct ide_tape_obj *tape)
 {
+       ide_drive_t *drive = tape->drive;
+
        mutex_lock(&idetape_ref_mutex);
-       ide_device_put(tape->drive);
        kref_put(&tape->kref, ide_tape_release);
+       ide_device_put(drive);
        mutex_unlock(&idetape_ref_mutex);
 }
 
index e0c8fe7..40644b6 100644 (file)
@@ -160,7 +160,7 @@ static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev)
        return dev->irq;
 }
 
-static u8 __devinit atp86x_cable_detect(ide_hwif_t *hwif)
+static u8 atp86x_cable_detect(ide_hwif_t *hwif)
 {
        struct pci_dev *dev = to_pci_dev(hwif->dev);
        u8 ata66 = 0, mask = hwif->channel ? 0x02 : 0x01;
index b582687..d647526 100644 (file)
@@ -371,7 +371,7 @@ static int ali_cable_override(struct pci_dev *pdev)
  *     FIXME: frobs bits that are not defined on newer ALi devicea
  */
 
-static u8 __devinit ali_cable_detect(ide_hwif_t *hwif)
+static u8 ali_cable_detect(ide_hwif_t *hwif)
 {
        struct pci_dev *dev = to_pci_dev(hwif->dev);
        unsigned long flags;
index 2cea7bf..1e66a96 100644 (file)
@@ -175,7 +175,7 @@ static unsigned int __devinit init_chipset_amd74xx(struct pci_dev *dev)
        return dev->irq;
 }
 
-static u8 __devinit amd_cable_detect(ide_hwif_t *hwif)
+static u8 amd_cable_detect(ide_hwif_t *hwif)
 {
        if ((amd_80w >> hwif->channel) & 1)
                return ATA_CBL_PATA80;
index 332f08f..41f6cb6 100644 (file)
@@ -119,7 +119,7 @@ static void atiixp_set_dma_mode(ide_drive_t *drive, const u8 speed)
        spin_unlock_irqrestore(&atiixp_lock, flags);
 }
 
-static u8 __devinit atiixp_cable_detect(ide_hwif_t *hwif)
+static u8 atiixp_cable_detect(ide_hwif_t *hwif)
 {
        struct pci_dev *pdev = to_pci_dev(hwif->dev);
        u8 udma_mode = 0, ch = hwif->channel;
index 1360b4f..e064398 100644 (file)
@@ -354,7 +354,7 @@ static unsigned int __devinit init_chipset_cmd64x(struct pci_dev *dev)
        return 0;
 }
 
-static u8 __devinit cmd64x_cable_detect(ide_hwif_t *hwif)
+static u8 cmd64x_cable_detect(ide_hwif_t *hwif)
 {
        struct pci_dev  *dev    = to_pci_dev(hwif->dev);
        u8 bmidecsr = 0, mask   = hwif->channel ? 0x02 : 0x01;
index c0364b2..151844f 100644 (file)
@@ -96,6 +96,7 @@ static const struct ide_port_ops cs5520_port_ops = {
 
 static const struct ide_port_info cyrix_chipset __devinitdata = {
        .name           = DRV_NAME,
+       .enablebits     = { { 0x60, 0x01, 0x01 }, { 0x60, 0x02, 0x02 } },
        .port_ops       = &cs5520_port_ops,
        .host_flags     = IDE_HFLAG_ISA_PORTS | IDE_HFLAG_CS5520,
        .pio_mask       = ATA_PIO4,
index f7b50cd..dd3dc23 100644 (file)
@@ -153,7 +153,7 @@ static void cs5535_set_pio_mode(ide_drive_t *drive, const u8 pio)
        cs5535_set_speed(drive, XFER_PIO_0 + pio);
 }
 
-static u8 __devinit cs5535_cable_detect(ide_hwif_t *hwif)
+static u8 cs5535_cable_detect(ide_hwif_t *hwif)
 {
        struct pci_dev *dev = to_pci_dev(hwif->dev);
        u8 bit;
index 5271b24..748793a 100644 (file)
@@ -1214,7 +1214,7 @@ static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev)
        return dev->irq;
 }
 
-static u8 __devinit hpt3xx_cable_detect(ide_hwif_t *hwif)
+static u8 hpt3xx_cable_detect(ide_hwif_t *hwif)
 {
        struct pci_dev  *dev    = to_pci_dev(hwif->dev);
        struct ide_host *host   = pci_get_drvdata(dev);
index 6eba8f1..652e47d 100644 (file)
@@ -141,7 +141,7 @@ static void it8213_set_dma_mode(ide_drive_t *drive, const u8 speed)
        }
 }
 
-static u8 __devinit it8213_cable_detect(ide_hwif_t *hwif)
+static u8 it8213_cable_detect(ide_hwif_t *hwif)
 {
        struct pci_dev *dev = to_pci_dev(hwif->dev);
        u8 reg42h = 0;
index e16a1d1..b6dc723 100644 (file)
@@ -428,7 +428,7 @@ static void it821x_set_dma_mode(ide_drive_t *drive, const u8 speed)
  *     the needed logic onboard.
  */
 
-static u8 __devinit it821x_cable_detect(ide_hwif_t *hwif)
+static u8 it821x_cable_detect(ide_hwif_t *hwif)
 {
        /* The reference driver also only does disk side */
        return ATA_CBL_PATA80;
@@ -443,7 +443,7 @@ static u8 __devinit it821x_cable_detect(ide_hwif_t *hwif)
  *     final tuning that is needed, or fixups to work around bugs.
  */
 
-static void __devinit it821x_quirkproc(ide_drive_t *drive)
+static void it821x_quirkproc(ide_drive_t *drive)
 {
        struct it821x_dev *itdev = ide_get_hwifdata(drive->hwif);
        struct hd_driveid *id = drive->id;
index 545b6e1..bb9d09d 100644 (file)
@@ -27,7 +27,7 @@ typedef enum {
  *     Returns the cable type.
  */
 
-static u8 __devinit jmicron_cable_detect(ide_hwif_t *hwif)
+static u8 jmicron_cable_detect(ide_hwif_t *hwif)
 {
        struct pci_dev *pdev = to_pci_dev(hwif->dev);
 
index 998615f..0f609b7 100644 (file)
@@ -193,7 +193,7 @@ static void pdcnew_set_pio_mode(ide_drive_t *drive, const u8 pio)
        }
 }
 
-static u8 __devinit pdcnew_cable_detect(ide_hwif_t *hwif)
+static u8 pdcnew_cable_detect(ide_hwif_t *hwif)
 {
        if (get_indexed_reg(hwif, 0x0b) & 0x04)
                return ATA_CBL_PATA40;
index 6ff2def..de9a274 100644 (file)
@@ -117,7 +117,7 @@ static void pdc202xx_set_pio_mode(ide_drive_t *drive, const u8 pio)
        pdc202xx_set_mode(drive, XFER_PIO_0 + pio);
 }
 
-static u8 __devinit pdc2026x_cable_detect(ide_hwif_t *hwif)
+static u8 pdc2026x_cable_detect(ide_hwif_t *hwif)
 {
        struct pci_dev *dev = to_pci_dev(hwif->dev);
        u16 CIS, mask = hwif->channel ? (1 << 11) : (1 << 10);
index 7fc3022..30cfc81 100644 (file)
@@ -256,7 +256,7 @@ static const struct ich_laptop ich_laptop[] = {
        { 0, }
 };
 
-static u8 __devinit piix_cable_detect(ide_hwif_t *hwif)
+static u8 piix_cable_detect(ide_hwif_t *hwif)
 {
        struct pci_dev *pdev = to_pci_dev(hwif->dev);
        const struct ich_laptop *lap = &ich_laptop[0];
index 94a7ab8..6cde48b 100644 (file)
@@ -827,7 +827,7 @@ static void __devinit init_iops_scc(ide_hwif_t *hwif)
        init_mmio_iops_scc(hwif);
 }
 
-static u8 __devinit scc_cable_detect(ide_hwif_t *hwif)
+static u8 scc_cable_detect(ide_hwif_t *hwif)
 {
        return ATA_CBL_PATA80;
 }
index d173f29..c3bdc6e 100644 (file)
@@ -272,7 +272,7 @@ static unsigned int __devinit init_chipset_svwks(struct pci_dev *dev)
        return dev->irq;
 }
 
-static u8 __devinit ata66_svwks_svwks(ide_hwif_t *hwif)
+static u8 ata66_svwks_svwks(ide_hwif_t *hwif)
 {
        return ATA_CBL_PATA80;
 }
@@ -284,7 +284,7 @@ static u8 __devinit ata66_svwks_svwks(ide_hwif_t *hwif)
  * Bit 14 clear = primary IDE channel does not have 80-pin cable.
  * Bit 14 set   = primary IDE channel has 80-pin cable.
  */
-static u8 __devinit ata66_svwks_dell(ide_hwif_t *hwif)
+static u8 ata66_svwks_dell(ide_hwif_t *hwif)
 {
        struct pci_dev *dev = to_pci_dev(hwif->dev);
 
@@ -303,7 +303,7 @@ static u8 __devinit ata66_svwks_dell(ide_hwif_t *hwif)
  *
  * WARNING: this only works on Alpine hardware!
  */
-static u8 __devinit ata66_svwks_cobalt(ide_hwif_t *hwif)
+static u8 ata66_svwks_cobalt(ide_hwif_t *hwif)
 {
        struct pci_dev *dev = to_pci_dev(hwif->dev);
 
@@ -315,7 +315,7 @@ static u8 __devinit ata66_svwks_cobalt(ide_hwif_t *hwif)
        return ATA_CBL_PATA40;
 }
 
-static u8 __devinit svwks_cable_detect(ide_hwif_t *hwif)
+static u8 svwks_cable_detect(ide_hwif_t *hwif)
 {
        struct pci_dev *dev = to_pci_dev(hwif->dev);
 
index b8ad9ad..445ce6f 100644 (file)
@@ -639,7 +639,7 @@ static int is_dev_seagate_sata(ide_drive_t *drive)
  *     that can occur before we know what drives are present.
  */
 
-static void __devinit sil_quirkproc(ide_drive_t *drive)
+static void sil_quirkproc(ide_drive_t *drive)
 {
        ide_hwif_t *hwif = drive->hwif;
 
@@ -679,7 +679,7 @@ static void __devinit init_iops_siimage(ide_hwif_t *hwif)
  *     Check for the presence of an ATA66 capable cable on the interface.
  */
 
-static u8 __devinit sil_cable_detect(ide_hwif_t *hwif)
+static u8 sil_cable_detect(ide_hwif_t *hwif)
 {
        struct pci_dev *dev     = to_pci_dev(hwif->dev);
        unsigned long addr      = siimage_selreg(hwif, 0);
index cc95f90..e5a4b42 100644 (file)
@@ -518,7 +518,7 @@ static const struct sis_laptop sis_laptop[] = {
        { 0, }
 };
 
-static u8 __devinit sis_cable_detect(ide_hwif_t *hwif)
+static u8 sis_cable_detect(ide_hwif_t *hwif)
 {
        struct pci_dev *pdev = to_pci_dev(hwif->dev);
        const struct sis_laptop *lap = &sis_laptop[0];
index 13d1fa4..866d6c6 100644 (file)
@@ -116,7 +116,7 @@ static void slc90e66_set_dma_mode(ide_drive_t *drive, const u8 speed)
        }
 }
 
-static u8 __devinit slc90e66_cable_detect(ide_hwif_t *hwif)
+static u8 slc90e66_cable_detect(ide_hwif_t *hwif)
 {
        struct pci_dev *dev = to_pci_dev(hwif->dev);
        u8 reg47 = 0, mask = hwif->channel ? 0x01 : 0x02;
index b1cb8a9..7fc88c3 100644 (file)
@@ -131,7 +131,7 @@ static void tc86c001_dma_start(ide_drive_t *drive)
        ide_dma_start(drive);
 }
 
-static u8 __devinit tc86c001_cable_detect(ide_hwif_t *hwif)
+static u8 tc86c001_cable_detect(ide_hwif_t *hwif)
 {
        struct pci_dev *dev = to_pci_dev(hwif->dev);
        unsigned long sc_base = pci_resource_start(dev, 5);
index 454d2bf..a6b2cc8 100644 (file)
@@ -352,7 +352,7 @@ static int via_cable_override(struct pci_dev *pdev)
        return 0;
 }
 
-static u8 __devinit via82cxxx_cable_detect(ide_hwif_t *hwif)
+static u8 via82cxxx_cable_detect(ide_hwif_t *hwif)
 {
        struct pci_dev *pdev = to_pci_dev(hwif->dev);
        struct ide_host *host = pci_get_drvdata(pdev);
index c521bf6..fa2be26 100644 (file)
@@ -1086,6 +1086,11 @@ static int __devinit pmac_ide_setup_device(pmac_ide_hwif_t *pmif, hw_regs_t *hw)
        /* Make sure we have sane timings */
        sanitize_timings(pmif);
 
+       host = ide_host_alloc(&d, hws);
+       if (host == NULL)
+               return -ENOMEM;
+       hwif = host->ports[0];
+
 #ifndef CONFIG_PPC64
        /* XXX FIXME: Media bay stuff need re-organizing */
        if (np->parent && np->parent->name
@@ -1119,11 +1124,11 @@ static int __devinit pmac_ide_setup_device(pmac_ide_hwif_t *pmif, hw_regs_t *hw)
                         pmif->mdev ? "macio" : "PCI", pmif->aapl_bus_id,
                         pmif->mediabay ? " (mediabay)" : "", hw->irq);
 
-       rc = ide_host_add(&d, hws, &host);
-       if (rc)
+       rc = ide_host_register(host, &d, hws);
+       if (rc) {
+               ide_host_free(host);
                return rc;
-
-       hwif = host->ports[0];
+       }
 
        return 0;
 }
index dd9bc68..898c8b5 100644 (file)
@@ -42,7 +42,7 @@
  */
 
 
-#include <asm-powerpc/system.h>
+#include <asm/system.h>
 #include "ehca_classes.h"
 #include "ehca_tools.h"
 #include "ehca_qes.h"
index 85b2cd0..d90f5e9 100644 (file)
@@ -528,7 +528,7 @@ static const struct ipath_cregs ipath_7220_cregs = {
 
 static char int_type[16] = "auto";
 module_param_string(interrupt_type, int_type, sizeof(int_type), 0444);
-MODULE_PARM_DESC(int_type, " interrupt_type=auto|force_msi|force_intx\n");
+MODULE_PARM_DESC(int_type, " interrupt_type=auto|force_msi|force_intx");
 
 /* packet rate matching delay; chip has support */
 static u8 rate_to_delay[2][2] = {
index 2b40428..22f17a5 100644 (file)
@@ -2,7 +2,7 @@
  * SEGA Dreamcast keyboard driver
  * Based on drivers/usb/usbkbd.c
  * Copyright YAEGASHI Takeshi, 2001
- * Porting to 2.6 Copyright Adrian McMenamin, 2007
+ * Porting to 2.6 Copyright Adrian McMenamin, 2007, 2008
  *
  * 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
@@ -27,7 +27,6 @@
 #include <linux/init.h>
 #include <linux/timer.h>
 #include <linux/maple.h>
-#include <asm/mach/maple.h>
 
 /* Very simple mutex to ensure proper cleanup */
 static DEFINE_MUTEX(maple_keyb_mutex);
@@ -46,39 +45,51 @@ struct dc_kbd {
 };
 
 static const unsigned short dc_kbd_keycode[NR_SCANCODES] = {
-       KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_A, KEY_B, KEY_C, KEY_D,
-       KEY_E, KEY_F, KEY_G, KEY_H, KEY_I, KEY_J, KEY_K, KEY_L,
-       KEY_M, KEY_N, KEY_O, KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T,
-       KEY_U, KEY_V, KEY_W, KEY_X, KEY_Y, KEY_Z, KEY_1, KEY_2,
-       KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9, KEY_0,
-       KEY_ENTER, KEY_ESC, KEY_BACKSPACE, KEY_TAB, KEY_SPACE, KEY_MINUS, KEY_EQUAL, KEY_LEFTBRACE,
-       KEY_RIGHTBRACE, KEY_BACKSLASH, KEY_BACKSLASH, KEY_SEMICOLON, KEY_APOSTROPHE, KEY_GRAVE, KEY_COMMA,
-       KEY_DOT, KEY_SLASH, KEY_CAPSLOCK, KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6,
+       KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_A, KEY_B,
+       KEY_C, KEY_D, KEY_E, KEY_F, KEY_G, KEY_H, KEY_I, KEY_J, KEY_K, KEY_L,
+       KEY_M, KEY_N, KEY_O, KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T, KEY_U, KEY_V,
+       KEY_W, KEY_X, KEY_Y, KEY_Z, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6,
+       KEY_7, KEY_8, KEY_9, KEY_0, KEY_ENTER, KEY_ESC, KEY_BACKSPACE,
+       KEY_TAB, KEY_SPACE, KEY_MINUS, KEY_EQUAL, KEY_LEFTBRACE,
+       KEY_RIGHTBRACE, KEY_BACKSLASH, KEY_BACKSLASH, KEY_SEMICOLON,
+       KEY_APOSTROPHE, KEY_GRAVE, KEY_COMMA, KEY_DOT, KEY_SLASH,
+       KEY_CAPSLOCK, KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6,
        KEY_F7, KEY_F8, KEY_F9, KEY_F10, KEY_F11, KEY_F12, KEY_SYSRQ,
-       KEY_SCROLLLOCK, KEY_PAUSE, KEY_INSERT, KEY_HOME, KEY_PAGEUP, KEY_DELETE,
-       KEY_END, KEY_PAGEDOWN, KEY_RIGHT, KEY_LEFT, KEY_DOWN, KEY_UP,
-       KEY_NUMLOCK, KEY_KPSLASH, KEY_KPASTERISK, KEY_KPMINUS, KEY_KPPLUS, KEY_KPENTER, KEY_KP1, KEY_KP2,
-       KEY_KP3, KEY_KP4, KEY_KP5, KEY_KP6, KEY_KP7, KEY_KP8, KEY_KP9, KEY_KP0, KEY_KPDOT,
-       KEY_102ND, KEY_COMPOSE, KEY_POWER, KEY_KPEQUAL, KEY_F13, KEY_F14, KEY_F15,
-       KEY_F16, KEY_F17, KEY_F18, KEY_F19, KEY_F20,
-       KEY_F21, KEY_F22, KEY_F23, KEY_F24, KEY_OPEN, KEY_HELP, KEY_PROPS, KEY_FRONT,
-       KEY_STOP, KEY_AGAIN, KEY_UNDO, KEY_CUT, KEY_COPY, KEY_PASTE, KEY_FIND, KEY_MUTE,
-       KEY_VOLUMEUP, KEY_VOLUMEDOWN, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_KPCOMMA, KEY_RESERVED, KEY_RO, KEY_KATAKANAHIRAGANA , KEY_YEN,
-       KEY_HENKAN, KEY_MUHENKAN, KEY_KPJPCOMMA, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
-       KEY_HANGEUL, KEY_HANJA, KEY_KATAKANA, KEY_HIRAGANA, KEY_ZENKAKUHANKAKU, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
-       KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
-       KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
-       KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
-       KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
-       KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
-       KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
-       KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
-       KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
-       KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
-       KEY_LEFTCTRL, KEY_LEFTSHIFT, KEY_LEFTALT, KEY_LEFTMETA, KEY_RIGHTCTRL, KEY_RIGHTSHIFT, KEY_RIGHTALT, KEY_RIGHTMETA,
-       KEY_PLAYPAUSE, KEY_STOPCD, KEY_PREVIOUSSONG, KEY_NEXTSONG, KEY_EJECTCD, KEY_VOLUMEUP, KEY_VOLUMEDOWN, KEY_MUTE,
-       KEY_WWW, KEY_BACK, KEY_FORWARD, KEY_STOP, KEY_FIND, KEY_SCROLLUP, KEY_SCROLLDOWN, KEY_EDIT, KEY_SLEEP,
-       KEY_SCREENLOCK, KEY_REFRESH, KEY_CALC, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED
+       KEY_SCROLLLOCK, KEY_PAUSE, KEY_INSERT, KEY_HOME, KEY_PAGEUP,
+       KEY_DELETE, KEY_END, KEY_PAGEDOWN, KEY_RIGHT, KEY_LEFT, KEY_DOWN,
+       KEY_UP, KEY_NUMLOCK, KEY_KPSLASH, KEY_KPASTERISK, KEY_KPMINUS,
+       KEY_KPPLUS, KEY_KPENTER, KEY_KP1, KEY_KP2, KEY_KP3, KEY_KP4, KEY_KP5,
+       KEY_KP6, KEY_KP7, KEY_KP8, KEY_KP9, KEY_KP0, KEY_KPDOT, KEY_102ND,
+       KEY_COMPOSE, KEY_POWER, KEY_KPEQUAL, KEY_F13, KEY_F14, KEY_F15,
+       KEY_F16, KEY_F17, KEY_F18, KEY_F19, KEY_F20, KEY_F21, KEY_F22,
+       KEY_F23, KEY_F24, KEY_OPEN, KEY_HELP, KEY_PROPS, KEY_FRONT, KEY_STOP,
+       KEY_AGAIN, KEY_UNDO, KEY_CUT, KEY_COPY, KEY_PASTE, KEY_FIND, KEY_MUTE,
+       KEY_VOLUMEUP, KEY_VOLUMEDOWN, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
+       KEY_KPCOMMA, KEY_RESERVED, KEY_RO, KEY_KATAKANAHIRAGANA , KEY_YEN,
+       KEY_HENKAN, KEY_MUHENKAN, KEY_KPJPCOMMA, KEY_RESERVED, KEY_RESERVED,
+       KEY_RESERVED, KEY_HANGEUL, KEY_HANJA, KEY_KATAKANA, KEY_HIRAGANA,
+       KEY_ZENKAKUHANKAKU, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
+       KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
+       KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
+       KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
+       KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
+       KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
+       KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
+       KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
+       KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
+       KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
+       KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
+       KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
+       KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
+       KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
+       KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
+       KEY_RESERVED, KEY_RESERVED, KEY_LEFTCTRL, KEY_LEFTSHIFT, KEY_LEFTALT,
+       KEY_LEFTMETA, KEY_RIGHTCTRL, KEY_RIGHTSHIFT, KEY_RIGHTALT,
+       KEY_RIGHTMETA, KEY_PLAYPAUSE, KEY_STOPCD, KEY_PREVIOUSSONG,
+       KEY_NEXTSONG, KEY_EJECTCD, KEY_VOLUMEUP, KEY_VOLUMEDOWN, KEY_MUTE,
+       KEY_WWW, KEY_BACK, KEY_FORWARD, KEY_STOP, KEY_FIND, KEY_SCROLLUP,
+       KEY_SCROLLDOWN, KEY_EDIT, KEY_SLEEP, KEY_SCREENLOCK, KEY_REFRESH,
+       KEY_CALC, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED
 };
 
 static void dc_scan_kbd(struct dc_kbd *kbd)
@@ -128,12 +139,12 @@ static void dc_scan_kbd(struct dc_kbd *kbd)
 static void dc_kbd_callback(struct mapleq *mq)
 {
        struct maple_device *mapledev = mq->dev;
-       struct dc_kbd *kbd = mapledev->private_data;
+       struct dc_kbd *kbd = maple_get_drvdata(mapledev);
        unsigned long *buf = mq->recvbuf;
 
        /*
-        * We should always be getting the lock because the only
-        * time it may be locked if driver is in cleanup phase.
+        * We should always get the lock because the only
+        * time it may be locked is if the driver is in the cleanup phase.
         */
        if (likely(mutex_trylock(&maple_keyb_mutex))) {
 
@@ -146,106 +157,96 @@ static void dc_kbd_callback(struct mapleq *mq)
        }
 }
 
-static int dc_kbd_connect(struct maple_device *mdev)
+static int probe_maple_kbd(struct device *dev)
 {
+       struct maple_device *mdev = to_maple_dev(dev);
+       struct maple_driver *mdrv = to_maple_driver(dev->driver);
        int i, error;
        struct dc_kbd *kbd;
-       struct input_dev *dev;
+       struct input_dev *idev;
 
        if (!(mdev->function & MAPLE_FUNC_KEYBOARD))
                return -EINVAL;
 
        kbd = kzalloc(sizeof(struct dc_kbd), GFP_KERNEL);
-       dev = input_allocate_device();
-       if (!kbd || !dev) {
+       idev = input_allocate_device();
+       if (!kbd || !idev) {
                error = -ENOMEM;
                goto fail;
        }
 
-       mdev->private_data = kbd;
-
-       kbd->dev = dev;
+       kbd->dev = idev;
        memcpy(kbd->keycode, dc_kbd_keycode, sizeof(kbd->keycode));
 
-       dev->name = mdev->product_name;
-       dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
-       dev->keycode = kbd->keycode;
-       dev->keycodesize = sizeof (unsigned short);
-       dev->keycodemax = ARRAY_SIZE(kbd->keycode);
-       dev->id.bustype = BUS_HOST;
-       dev->dev.parent = &mdev->dev;
+       idev->name = mdev->product_name;
+       idev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
+       idev->keycode = kbd->keycode;
+       idev->keycodesize = sizeof(unsigned short);
+       idev->keycodemax = ARRAY_SIZE(kbd->keycode);
+       idev->id.bustype = BUS_HOST;
+       idev->dev.parent = &mdev->dev;
 
        for (i = 0; i < NR_SCANCODES; i++)
-               __set_bit(dc_kbd_keycode[i], dev->keybit);
-       __clear_bit(KEY_RESERVED, dev->keybit);
+               __set_bit(dc_kbd_keycode[i], idev->keybit);
+       __clear_bit(KEY_RESERVED, idev->keybit);
 
-       input_set_capability(dev, EV_MSC, MSC_SCAN);
-       input_set_drvdata(dev, kbd);
+       input_set_capability(idev, EV_MSC, MSC_SCAN);
+       input_set_drvdata(idev, kbd);
 
-       error = input_register_device(dev);
+       error = input_register_device(idev);
        if (error)
                goto fail;
 
        /* Maple polling is locked to VBLANK - which may be just 50/s */
-       maple_getcond_callback(mdev, dc_kbd_callback, HZ/50, MAPLE_FUNC_KEYBOARD);
-       return 0;
+       maple_getcond_callback(mdev, dc_kbd_callback, HZ/50,
+               MAPLE_FUNC_KEYBOARD);
 
- fail:
-       input_free_device(dev);
+       mdev->driver = mdrv;
+
+       maple_set_drvdata(mdev, kbd);
+
+       return error;
+
+fail:
+       input_free_device(idev);
        kfree(kbd);
-       mdev->private_data = NULL;
+       maple_set_drvdata(mdev, NULL);
        return error;
 }
 
-static void dc_kbd_disconnect(struct maple_device *mdev)
+static int remove_maple_kbd(struct device *dev)
 {
-       struct dc_kbd *kbd;
+       struct maple_device *mdev = to_maple_dev(dev);
+       struct dc_kbd *kbd = maple_get_drvdata(mdev);
 
        mutex_lock(&maple_keyb_mutex);
 
-       kbd = mdev->private_data;
-       mdev->private_data = NULL;
        input_unregister_device(kbd->dev);
        kfree(kbd);
 
-       mutex_unlock(&maple_keyb_mutex);
-}
-
-/* allow the keyboard to be used */
-static int probe_maple_kbd(struct device *dev)
-{
-       struct maple_device *mdev = to_maple_dev(dev);
-       struct maple_driver *mdrv = to_maple_driver(dev->driver);
-       int error;
-
-       error = dc_kbd_connect(mdev);
-       if (error)
-               return error;
-
-       mdev->driver = mdrv;
-       mdev->registered = 1;
+       maple_set_drvdata(mdev, NULL);
 
+       mutex_unlock(&maple_keyb_mutex);
        return 0;
 }
 
 static struct maple_driver dc_kbd_driver = {
        .function = MAPLE_FUNC_KEYBOARD,
-       .connect = dc_kbd_connect,
-       .disconnect = dc_kbd_disconnect,
        .drv = {
                .name = "Dreamcast_keyboard",
                .probe = probe_maple_kbd,
-       },
+               .remove = remove_maple_kbd,
+       },
 };
 
 static int __init dc_kbd_init(void)
 {
-       return maple_driver_register(&dc_kbd_driver.drv);
+       return maple_driver_register(&dc_kbd_driver);
 }
 
 static void __exit dc_kbd_exit(void)
 {
-       driver_unregister(&dc_kbd_driver.drv);
+       maple_driver_unregister(&dc_kbd_driver);
 }
 
 module_init(dc_kbd_init);
index 8380a45..f1f7775 100644 (file)
@@ -5,7 +5,7 @@
 obj-$(CONFIG_ISDN_I4L)                 += i4l/
 obj-$(CONFIG_ISDN_CAPI)                        += capi/
 obj-$(CONFIG_MISDN)                    += mISDN/
-obj-$(CONFIG_ISDN_CAPI)                        += hardware/
+obj-$(CONFIG_ISDN)                     += hardware/
 obj-$(CONFIG_ISDN_DIVERSION)           += divert/
 obj-$(CONFIG_ISDN_DRV_HISAX)           += hisax/
 obj-$(CONFIG_ISDN_DRV_ICN)             += icn/
index e30a777..fbce522 100644 (file)
@@ -247,7 +247,6 @@ static inline void dump_bytes(enum debuglevel level, const char *tag,
 #ifdef CONFIG_GIGASET_DEBUG
        unsigned char c;
        static char dbgline[3 * 32 + 1];
-       static const char hexdigit[] = "0123456789abcdef";
        int i = 0;
        while (count-- > 0) {
                if (i > sizeof(dbgline) - 4) {
@@ -258,8 +257,8 @@ static inline void dump_bytes(enum debuglevel level, const char *tag,
                c = *bytes++;
                dbgline[i] = (i && !(i % 12)) ? '-' : ' ';
                i++;
-               dbgline[i++] = hexdigit[(c >> 4) & 0x0f];
-               dbgline[i++] = hexdigit[c & 0x0f];
+               dbgline[i++] = hex_asc_hi(c);
+               dbgline[i++] = hex_asc_lo(c);
        }
        dbgline[i] = '\0';
        gig_dbg(level, "%s:%s", tag, dbgline);
index 2649ea5..1eac03f 100644 (file)
  * #define HFC_REGISTER_DEBUG
  */
 
-static const char *hfcmulti_revision = "2.00";
+static const char *hfcmulti_revision = "2.02";
 
 #include <linux/module.h>
 #include <linux/pci.h>
@@ -427,12 +427,12 @@ write_fifo_regio(struct hfc_multi *hc, u_char *data, int len)
 {
        outb(A_FIFO_DATA0, (hc->pci_iobase)+4);
        while (len>>2) {
-               outl(*(u32 *)data, hc->pci_iobase);
+               outl(cpu_to_le32(*(u32 *)data), hc->pci_iobase);
                data += 4;
                len -= 4;
        }
        while (len>>1) {
-               outw(*(u16 *)data, hc->pci_iobase);
+               outw(cpu_to_le16(*(u16 *)data), hc->pci_iobase);
                data += 2;
                len -= 2;
        }
@@ -447,17 +447,19 @@ void
 write_fifo_pcimem(struct hfc_multi *hc, u_char *data, int len)
 {
        while (len>>2) {
-               writel(*(u32 *)data, (hc->pci_membase)+A_FIFO_DATA0);
+               writel(cpu_to_le32(*(u32 *)data),
+                       hc->pci_membase + A_FIFO_DATA0);
                data += 4;
                len -= 4;
        }
        while (len>>1) {
-               writew(*(u16 *)data, (hc->pci_membase)+A_FIFO_DATA0);
+               writew(cpu_to_le16(*(u16 *)data),
+                       hc->pci_membase + A_FIFO_DATA0);
                data += 2;
                len -= 2;
        }
        while (len) {
-               writeb(*data, (hc->pci_membase)+A_FIFO_DATA0);
+               writeb(*data, hc->pci_membase + A_FIFO_DATA0);
                data++;
                len--;
        }
@@ -468,12 +470,12 @@ read_fifo_regio(struct hfc_multi *hc, u_char *data, int len)
 {
        outb(A_FIFO_DATA0, (hc->pci_iobase)+4);
        while (len>>2) {
-               *(u32 *)data = inl(hc->pci_iobase);
+               *(u32 *)data = le32_to_cpu(inl(hc->pci_iobase));
                data += 4;
                len -= 4;
        }
        while (len>>1) {
-               *(u16 *)data = inw(hc->pci_iobase);
+               *(u16 *)data = le16_to_cpu(inw(hc->pci_iobase));
                data += 2;
                len -= 2;
        }
@@ -490,18 +492,18 @@ read_fifo_pcimem(struct hfc_multi *hc, u_char *data, int len)
 {
        while (len>>2) {
                *(u32 *)data =
-                       readl((hc->pci_membase)+A_FIFO_DATA0);
+                       le32_to_cpu(readl(hc->pci_membase + A_FIFO_DATA0));
                data += 4;
                len -= 4;
        }
        while (len>>1) {
                *(u16 *)data =
-                       readw((hc->pci_membase)+A_FIFO_DATA0);
+                       le16_to_cpu(readw(hc->pci_membase + A_FIFO_DATA0));
                data += 2;
                len -= 2;
        }
        while (len) {
-               *data = readb((hc->pci_membase)+A_FIFO_DATA0);
+               *data = readb(hc->pci_membase + A_FIFO_DATA0);
                data++;
                len--;
        }
@@ -3971,7 +3973,7 @@ open_bchannel(struct hfc_multi *hc, struct dchannel *dch,
        struct bchannel *bch;
        int             ch;
 
-       if (!test_bit(rq->adr.channel, &dch->dev.channelmap[0]))
+       if (!test_channelmap(rq->adr.channel, dch->dev.channelmap))
                return -EINVAL;
        if (rq->protocol == ISDN_P_NONE)
                return -EINVAL;
@@ -4587,7 +4589,7 @@ init_e1_port(struct hfc_multi *hc, struct hm_map *m)
                list_add(&bch->ch.list, &dch->dev.bchannels);
                hc->chan[ch].bch = bch;
                hc->chan[ch].port = 0;
-               test_and_set_bit(bch->nr, &dch->dev.channelmap[0]);
+               set_channelmap(bch->nr, dch->dev.channelmap);
        }
        /* set optical line type */
        if (port[Port_cnt] & 0x001) {
@@ -4755,7 +4757,7 @@ init_multi_port(struct hfc_multi *hc, int pt)
                list_add(&bch->ch.list, &dch->dev.bchannels);
                hc->chan[i + ch].bch = bch;
                hc->chan[i + ch].port = pt;
-               test_and_set_bit(bch->nr, &dch->dev.channelmap[0]);
+               set_channelmap(bch->nr, dch->dev.channelmap);
        }
        /* set master clock */
        if (port[Port_cnt] & 0x001) {
@@ -5050,12 +5052,12 @@ static void __devexit hfc_remove_pci(struct pci_dev *pdev)
 
 static const struct hm_map hfcm_map[] = {
 /*0*/  {VENDOR_BN, "HFC-1S Card (mini PCI)", 4, 1, 1, 3, 0, DIP_4S, 0},
-/*1*/  {VENDOR_BN, "HFC-2S Card", 4, 2, 1, 3, 0, DIP_4S},
+/*1*/  {VENDOR_BN, "HFC-2S Card", 4, 2, 1, 3, 0, DIP_4S, 0},
 /*2*/  {VENDOR_BN, "HFC-2S Card (mini PCI)", 4, 2, 1, 3, 0, DIP_4S, 0},
 /*3*/  {VENDOR_BN, "HFC-4S Card", 4, 4, 1, 2, 0, DIP_4S, 0},
 /*4*/  {VENDOR_BN, "HFC-4S Card (mini PCI)", 4, 4, 1, 2, 0, 0, 0},
 /*5*/  {VENDOR_CCD, "HFC-4S Eval (old)", 4, 4, 0, 0, 0, 0, 0},
-/*6*/  {VENDOR_CCD, "HFC-4S IOB4ST", 4, 4, 1, 2, 0, 0, 0},
+/*6*/  {VENDOR_CCD, "HFC-4S IOB4ST", 4, 4, 1, 2, 0, DIP_4S, 0},
 /*7*/  {VENDOR_CCD, "HFC-4S", 4, 4, 1, 2, 0, 0, 0},
 /*8*/  {VENDOR_DIG, "HFC-4S Card", 4, 4, 0, 2, 0, 0, HFC_IO_MODE_REGIO},
 /*9*/  {VENDOR_CCD, "HFC-4S Swyx 4xS0 SX2 QuadBri", 4, 4, 1, 2, 0, 0, 0},
@@ -5251,9 +5253,6 @@ HFCmulti_init(void)
        if (debug & DEBUG_HFCMULTI_INIT)
                printk(KERN_DEBUG "%s: init entered\n", __func__);
 
-#ifdef __BIG_ENDIAN
-#error "not running on big endian machines now"
-#endif
        hfc_interrupt = symbol_get(ztdummy_extern_interrupt);
        register_interrupt = symbol_get(ztdummy_register_interrupt);
        unregister_interrupt = symbol_get(ztdummy_unregister_interrupt);
index 3231814..9cf5edb 100644 (file)
@@ -2056,7 +2056,7 @@ setup_card(struct hfc_pci *card)
        card->dch.dev.nrbchan = 2;
        for (i = 0; i < 2; i++) {
                card->bch[i].nr = i + 1;
-               test_and_set_bit(i + 1, &card->dch.dev.channelmap[0]);
+               set_channelmap(i + 1, card->dch.dev.channelmap);
                card->bch[i].debug = debug;
                mISDN_initbchannel(&card->bch[i], MAX_DATA_MEM);
                card->bch[i].hw = card;
index a368d6c..3a72b90 100644 (file)
@@ -60,7 +60,7 @@ typedef struct PofRecHdr_tag {        /* Pof record header */
 
 typedef struct PofTimeStamp_tag {
 /*00 */ unsigned long UnixTime __attribute__((packed));
-       /*04 */ unsigned char DateTimeText[0x28] __attribute__((packed));
+       /*04 */ unsigned char DateTimeText[0x28];
        /* =40 */
 /*2C */
 } tPofTimeStamp;
index 155b997..e42150a 100644 (file)
@@ -1006,8 +1006,7 @@ open_bchannel(struct l1oip *hc, struct dchannel *dch, struct channel_req *rq)
        struct bchannel *bch;
        int             ch;
 
-       if (!test_bit(rq->adr.channel & 0x1f,
-               &dch->dev.channelmap[rq->adr.channel >> 5]))
+       if (!test_channelmap(rq->adr.channel, dch->dev.channelmap))
                return -EINVAL;
        if (rq->protocol == ISDN_P_NONE)
                return -EINVAL;
@@ -1412,8 +1411,7 @@ init_card(struct l1oip *hc, int pri, int bundle)
                bch->ch.nr = i + ch;
                list_add(&bch->ch.list, &dch->dev.bchannels);
                hc->chan[i + ch].bch = bch;
-               test_and_set_bit(bch->nr & 0x1f,
-                       &dch->dev.channelmap[bch->nr >> 5]);
+               set_channelmap(bch->nr, dch->dev.channelmap);
        }
        ret = mISDN_register_device(&dch->dev, hc->name);
        if (ret)
index 4ba4cc3..e5a20f9 100644 (file)
@@ -379,7 +379,7 @@ data_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
                        di.Bprotocols = dev->Bprotocols | get_all_Bprotocols();
                        di.protocol = dev->D.protocol;
                        memcpy(di.channelmap, dev->channelmap,
-                               MISDN_CHMAP_SIZE * 4);
+                               sizeof(di.channelmap));
                        di.nrbchan = dev->nrbchan;
                        strcpy(di.name, dev->name);
                        if (copy_to_user((void __user *)arg, &di, sizeof(di)))
@@ -637,7 +637,7 @@ base_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
                        di.Bprotocols = dev->Bprotocols | get_all_Bprotocols();
                        di.protocol = dev->D.protocol;
                        memcpy(di.channelmap, dev->channelmap,
-                               MISDN_CHMAP_SIZE * 4);
+                               sizeof(di.channelmap));
                        di.nrbchan = dev->nrbchan;
                        strcpy(di.name, dev->name);
                        if (copy_to_user((void __user *)arg, &di, sizeof(di)))
index b1e5b47..d7e46d3 100644 (file)
@@ -16,7 +16,6 @@
 #include <linux/delay.h>
 #include <linux/sched.h>
 #include <linux/timer.h>
-#include <linux/hdreg.h>
 #include <linux/stddef.h>
 #include <linux/init.h>
 #include <linux/ide.h>
index 621a272..7e65bad 100644 (file)
@@ -1234,7 +1234,7 @@ int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sect
                case 0:
                        bitmap_file_set_bit(bitmap, offset);
                        bitmap_count_page(bitmap,offset, 1);
-                       blk_plug_device(bitmap->mddev->queue);
+                       blk_plug_device_unlocked(bitmap->mddev->queue);
                        /* fall through */
                case 1:
                        *bmc = 2;
index 798e468..61f4414 100644 (file)
@@ -316,29 +316,12 @@ static inline int check_space(struct dm_table *t)
  */
 static int lookup_device(const char *path, dev_t *dev)
 {
-       int r;
-       struct nameidata nd;
-       struct inode *inode;
-
-       if ((r = path_lookup(path, LOOKUP_FOLLOW, &nd)))
-               return r;
-
-       inode = nd.path.dentry->d_inode;
-       if (!inode) {
-               r = -ENOENT;
-               goto out;
-       }
-
-       if (!S_ISBLK(inode->i_mode)) {
-               r = -ENOTBLK;
-               goto out;
-       }
-
-       *dev = inode->i_rdev;
-
- out:
-       path_put(&nd.path);
-       return r;
+       struct block_device *bdev = lookup_bdev(path);
+       if (IS_ERR(bdev))
+               return PTR_ERR(bdev);
+       *dev = bdev->bd_dev;
+       bdput(bdev);
+       return 0;
 }
 
 /*
index c2ff77c..c7aae66 100644 (file)
@@ -3483,7 +3483,7 @@ static void md_safemode_timeout(unsigned long data)
        if (!atomic_read(&mddev->writes_pending)) {
                mddev->safemode = 1;
                if (mddev->external)
-                       sysfs_notify(&mddev->kobj, NULL, "array_state");
+                       set_bit(MD_NOTIFY_ARRAY_STATE, &mddev->flags);
        }
        md_wakeup_thread(mddev->thread);
 }
@@ -5996,7 +5996,8 @@ static int remove_and_add_spares(mddev_t *mddev)
        if (mddev->degraded) {
                rdev_for_each(rdev, rtmp, mddev) {
                        if (rdev->raid_disk >= 0 &&
-                           !test_bit(In_sync, &rdev->flags))
+                           !test_bit(In_sync, &rdev->flags) &&
+                           !test_bit(Blocked, &rdev->flags))
                                spares++;
                        if (rdev->raid_disk < 0
                            && !test_bit(Faulty, &rdev->flags)) {
@@ -6051,6 +6052,9 @@ void md_check_recovery(mddev_t *mddev)
        if (mddev->bitmap)
                bitmap_daemon_work(mddev->bitmap);
 
+       if (test_and_clear_bit(MD_NOTIFY_ARRAY_STATE, &mddev->flags))
+               sysfs_notify(&mddev->kobj, NULL, "array_state");
+
        if (mddev->ro)
                return;
 
index 159535d..d41bebb 100644 (file)
@@ -215,6 +215,9 @@ static void reschedule_retry(r10bio_t *r10_bio)
        conf->nr_queued ++;
        spin_unlock_irqrestore(&conf->device_lock, flags);
 
+       /* wake up frozen array... */
+       wake_up(&conf->wait_barrier);
+
        md_wakeup_thread(mddev->thread);
 }
 
index 55e7c56..40e9396 100644 (file)
@@ -2507,7 +2507,7 @@ static void handle_stripe_expansion(raid5_conf_t *conf, struct stripe_head *sh,
  *
  */
 
-static void handle_stripe5(struct stripe_head *sh)
+static bool handle_stripe5(struct stripe_head *sh)
 {
        raid5_conf_t *conf = sh->raid_conf;
        int disks = sh->disks, i;
@@ -2717,10 +2717,11 @@ static void handle_stripe5(struct stripe_head *sh)
        if (sh->reconstruct_state == reconstruct_state_result) {
                sh->reconstruct_state = reconstruct_state_idle;
                clear_bit(STRIPE_EXPANDING, &sh->state);
-               for (i = conf->raid_disks; i--; )
+               for (i = conf->raid_disks; i--; ) {
                        set_bit(R5_Wantwrite, &sh->dev[i].flags);
-                       set_bit(R5_LOCKED, &dev->flags);
+                       set_bit(R5_LOCKED, &sh->dev[i].flags);
                        s.locked++;
+               }
        }
 
        if (s.expanded && test_bit(STRIPE_EXPANDING, &sh->state) &&
@@ -2754,9 +2755,11 @@ static void handle_stripe5(struct stripe_head *sh)
        ops_run_io(sh, &s);
 
        return_io(return_bi);
+
+       return blocked_rdev == NULL;
 }
 
-static void handle_stripe6(struct stripe_head *sh, struct page *tmp_page)
+static bool handle_stripe6(struct stripe_head *sh, struct page *tmp_page)
 {
        raid6_conf_t *conf = sh->raid_conf;
        int disks = sh->disks;
@@ -2967,14 +2970,17 @@ static void handle_stripe6(struct stripe_head *sh, struct page *tmp_page)
        ops_run_io(sh, &s);
 
        return_io(return_bi);
+
+       return blocked_rdev == NULL;
 }
 
-static void handle_stripe(struct stripe_head *sh, struct page *tmp_page)
+/* returns true if the stripe was handled */
+static bool handle_stripe(struct stripe_head *sh, struct page *tmp_page)
 {
        if (sh->raid_conf->level == 6)
-               handle_stripe6(sh, tmp_page);
+               return handle_stripe6(sh, tmp_page);
        else
-               handle_stripe5(sh);
+               return handle_stripe5(sh);
 }
 
 
@@ -3692,7 +3698,9 @@ static inline sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *ski
        clear_bit(STRIPE_INSYNC, &sh->state);
        spin_unlock(&sh->lock);
 
-       handle_stripe(sh, NULL);
+       /* wait for any blocked device to be handled */
+       while(unlikely(!handle_stripe(sh, NULL)))
+               ;
        release_stripe(sh);
 
        return STRIPE_SECTORS;
@@ -3811,10 +3819,8 @@ static void raid5d(mddev_t *mddev)
 
                sh = __get_priority_stripe(conf);
 
-               if (!sh) {
-                       async_tx_issue_pending_all();
+               if (!sh)
                        break;
-               }
                spin_unlock_irq(&conf->device_lock);
                
                handled++;
@@ -3827,6 +3833,7 @@ static void raid5d(mddev_t *mddev)
 
        spin_unlock_irq(&conf->device_lock);
 
+       async_tx_issue_pending_all();
        unplug_slaves(mddev);
 
        pr_debug("--- raid5d inactive\n");
index 578afce..aaa0b6f 100644 (file)
@@ -565,7 +565,8 @@ static int cxusb_lgh064f_tuner_attach(struct dvb_usb_adapter *adap)
 
 static int dvico_bluebird_xc2028_callback(void *ptr, int command, int arg)
 {
-       struct dvb_usb_device *d = ptr;
+       struct dvb_usb_adapter *adap = ptr;
+       struct dvb_usb_device *d = adap->dev;
 
        switch (command) {
        case XC2028_TUNER_RESET:
@@ -593,9 +594,9 @@ static int cxusb_dvico_xc3028_tuner_attach(struct dvb_usb_adapter *adap)
                .callback  = dvico_bluebird_xc2028_callback,
        };
        static struct xc2028_ctrl ctl = {
-               .fname       = "xc3028-dvico-au-01.fw",
+               .fname       = "xc3028-v27.fw",
                .max_len     = 64,
-               .scode_table = XC3028_FE_ZARLINK456,
+               .demod       = XC3028_FE_ZARLINK456,
        };
 
        fe = dvb_attach(xc2028_attach, adap->fe, &cfg);
index 574dffe..7dbb4a2 100644 (file)
@@ -135,9 +135,8 @@ config DVB_CX22702
 
 config DVB_DRX397XD
        tristate "Micronas DRX3975D/DRX3977D based"
-       depends on DVB_CORE && I2C && HOTPLUG
+       depends on DVB_CORE && I2C
        default m if DVB_FE_CUSTOMISE
-       select FW_LOADER
        help
          A DVB-T tuner module. Say Y when you want to support this frontend.
 
index d4a6e56..ecbfa1b 100644 (file)
@@ -630,7 +630,7 @@ config VIDEO_ZORAN_ZR36060
        depends on VIDEO_ZORAN
        help
          Say Y to support Zoran boards based on 36060 chips.
-         This includes Iomega Bus, Pinnacle DC10, Linux media Labs 33
+         This includes Iomega Buz, Pinnacle DC10, Linux media Labs 33
          and 33 R10 and AverMedia 6 boards.
 
 config VIDEO_ZORAN_BUZ
index 56ebfd5..9e436ad 100644 (file)
@@ -29,6 +29,7 @@
 #include <linux/sched.h>
 #include <linux/videodev.h>
 #include <media/v4l2-common.h>
+#include <media/v4l2-ioctl.h>
 #include <linux/mutex.h>
 
 #include <asm/uaccess.h>
@@ -755,7 +756,6 @@ static const struct file_operations ar_fops = {
 
 static struct video_device ar_template = {
        .name           = "Colour AR VGA",
-       .type           = VID_TYPE_CAPTURE,
        .fops           = &ar_fops,
        .release        = ar_release,
        .minor          = -1,
index 61d14d2..a662b15 100644 (file)
@@ -35,7 +35,7 @@ static int debug;
 
 module_param(debug, bool, 0644);
 
-MODULE_PARM_DESC(debug, "Debugging messages\n\t\t\t0=Off (default), 1=On");
+MODULE_PARM_DESC(debug, "Debugging messages0=Off (default), 1=On");
 
 
 /* ----------------------------------------------------------------------- */
index e30a589..c444450 100644 (file)
@@ -39,7 +39,7 @@ static int debug;
 
 module_param(debug, bool, 0644);
 
-MODULE_PARM_DESC(debug, "Debugging messages\n\t\t\t0=Off (default), 1=On");
+MODULE_PARM_DESC(debug, "Debugging messages0=Off (default), 1=On");
 
 static unsigned short normal_i2c[] = { 0x22 >> 1, I2C_CLIENT_END };
 
index 476ae44..452da70 100644 (file)
@@ -1015,6 +1015,7 @@ struct em28xx_board em28xx_boards[] = {
                .valid        = EM28XX_BOARD_NOT_VALIDATED,
                .vchannels    = 3,
                .tuner_type   = TUNER_XC2028,
+               .mts_firmware = 1,
                .decoder      = EM28XX_TVP5150,
                .input          = { {
                        .type     = EM28XX_VMUX_TELEVISION,
index 44b0bff..cd3a3f5 100644 (file)
@@ -123,7 +123,7 @@ static void reg_r(struct gspca_dev *gspca_dev,
 {
        struct usb_device *dev = gspca_dev->dev;
 
-#ifdef CONFIG_VIDEO_ADV_DEBUG
+#ifdef GSPCA_DEBUG
        if (len > sizeof gspca_dev->usb_buf) {
                err("reg_r: buffer overflow");
                return;
@@ -163,7 +163,7 @@ static void reg_w(struct gspca_dev *gspca_dev,
 {
        struct usb_device *dev = gspca_dev->dev;
 
-#ifdef CONFIG_VIDEO_ADV_DEBUG
+#ifdef GSPCA_DEBUG
        if (len > sizeof gspca_dev->usb_buf) {
                err("reg_w: buffer overflow");
                return;
index c8c2f02..1dbe92d 100644 (file)
@@ -233,7 +233,7 @@ static void reg_r(struct gspca_dev *gspca_dev,
 {
        struct usb_device *dev = gspca_dev->dev;
 
-#ifdef CONFIG_VIDEO_ADV_DEBUG
+#ifdef GSPCA_DEBUG
        if (len > sizeof gspca_dev->usb_buf) {
                err("reg_r: buffer overflow");
                return;
@@ -271,7 +271,7 @@ static void reg_w(struct gspca_dev *gspca_dev,
 {
        struct usb_device *dev = gspca_dev->dev;
 
-#ifdef CONFIG_VIDEO_ADV_DEBUG
+#ifdef GSPCA_DEBUG
        if (len > sizeof gspca_dev->usb_buf) {
                err("reg_w: buffer overflow");
                return;
@@ -461,6 +461,52 @@ static void Et_init2(struct gspca_dev *gspca_dev)
        reg_w_val(gspca_dev, 0x80, 0x20);       /* 0x20; */
 }
 
+static void setbrightness(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+       int i;
+       __u8 brightness = sd->brightness;
+
+       for (i = 0; i < 4; i++)
+               reg_w_val(gspca_dev, ET_O_RED + i, brightness);
+}
+
+static void getbrightness(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+       int i;
+       int brightness = 0;
+
+       for (i = 0; i < 4; i++) {
+               reg_r(gspca_dev, ET_O_RED + i, 1);
+               brightness += gspca_dev->usb_buf[0];
+       }
+       sd->brightness = brightness >> 3;
+}
+
+static void setcontrast(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+       __u8 RGBG[] = { 0x80, 0x80, 0x80, 0x80, 0x00, 0x00 };
+       __u8 contrast = sd->contrast;
+
+       memset(RGBG, contrast, sizeof(RGBG) - 2);
+       reg_w(gspca_dev, ET_G_RED, RGBG, 6);
+}
+
+static void getcontrast(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+       int i;
+       int contrast = 0;
+
+       for (i = 0; i < 4; i++) {
+               reg_r(gspca_dev, ET_G_RED + i, 1);
+               contrast += gspca_dev->usb_buf[0];
+       }
+       sd->contrast = contrast >> 2;
+}
+
 static void setcolors(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
@@ -492,6 +538,16 @@ static void getcolors(struct gspca_dev *gspca_dev)
        }
 }
 
+static void setautogain(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       if (sd->autogain)
+               sd->ag_cnt = AG_CNT_START;
+       else
+               sd->ag_cnt = -1;
+}
+
 static void Et_init1(struct gspca_dev *gspca_dev)
 {
        __u8 value;
@@ -614,6 +670,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
        sd->contrast = CONTRAST_DEF;
        sd->colors = COLOR_DEF;
        sd->autogain = AUTOGAIN_DEF;
+       sd->ag_cnt = -1;
        return 0;
 }
 
@@ -641,6 +698,8 @@ static void sd_start(struct gspca_dev *gspca_dev)
        else
                Et_init2(gspca_dev);
 
+       setautogain(gspca_dev);
+
        reg_w_val(gspca_dev, ET_RESET_ALL, 0x08);
        et_video(gspca_dev, 1);         /* video on */
 }
@@ -658,52 +717,6 @@ static void sd_close(struct gspca_dev *gspca_dev)
 {
 }
 
-static void setbrightness(struct gspca_dev *gspca_dev)
-{
-       struct sd *sd = (struct sd *) gspca_dev;
-       int i;
-       __u8 brightness = sd->brightness;
-
-       for (i = 0; i < 4; i++)
-               reg_w_val(gspca_dev, ET_O_RED + i, brightness);
-}
-
-static void getbrightness(struct gspca_dev *gspca_dev)
-{
-       struct sd *sd = (struct sd *) gspca_dev;
-       int i;
-       int brightness = 0;
-
-       for (i = 0; i < 4; i++) {
-               reg_r(gspca_dev, ET_O_RED + i, 1);
-               brightness += gspca_dev->usb_buf[0];
-       }
-       sd->brightness = brightness >> 3;
-}
-
-static void setcontrast(struct gspca_dev *gspca_dev)
-{
-       struct sd *sd = (struct sd *) gspca_dev;
-       __u8 RGBG[] = { 0x80, 0x80, 0x80, 0x80, 0x00, 0x00 };
-       __u8 contrast = sd->contrast;
-
-       memset(RGBG, contrast, sizeof(RGBG) - 2);
-       reg_w(gspca_dev, ET_G_RED, RGBG, 6);
-}
-
-static void getcontrast(struct gspca_dev *gspca_dev)
-{
-       struct sd *sd = (struct sd *) gspca_dev;
-       int i;
-       int contrast = 0;
-
-       for (i = 0; i < 4; i++) {
-               reg_r(gspca_dev, ET_G_RED + i, 1);
-               contrast += gspca_dev->usb_buf[0];
-       }
-       sd->contrast = contrast >> 2;
-}
-
 static __u8 Et_getgainG(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
@@ -733,15 +746,22 @@ static void Et_setgainG(struct gspca_dev *gspca_dev, __u8 gain)
 #define LIMIT(color) \
        (unsigned char)((color > 0xff)?0xff:((color < 0)?0:color))
 
-static void setautogain(struct gspca_dev *gspca_dev)
+static void do_autogain(struct gspca_dev *gspca_dev)
 {
-       __u8 luma = 0;
+       struct sd *sd = (struct sd *) gspca_dev;
+       __u8 luma;
        __u8 luma_mean = 128;
        __u8 luma_delta = 20;
        __u8 spring = 4;
-       int Gbright = 0;
+       int Gbright;
        __u8 r, g, b;
 
+       if (sd->ag_cnt < 0)
+               return;
+       if (--sd->ag_cnt >= 0)
+               return;
+       sd->ag_cnt = AG_CNT_START;
+
        Gbright = Et_getgainG(gspca_dev);
        reg_r(gspca_dev, ET_LUMA_CENTER, 4);
        g = (gspca_dev->usb_buf[0] + gspca_dev->usb_buf[3]) >> 1;
@@ -768,7 +788,6 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
                        __u8 *data,                     /* isoc packet */
                        int len)                        /* iso packet length */
 {
-       struct sd *sd;
        int seqframe;
 
        seqframe = data[0] & 0x3f;
@@ -783,13 +802,6 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
                frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame,
                                        data, 0);
                gspca_frame_add(gspca_dev, FIRST_PACKET, frame, data, len);
-               sd = (struct sd *) gspca_dev;
-               if (sd->ag_cnt >= 0) {
-                       if (--sd->ag_cnt < 0) {
-                               sd->ag_cnt = AG_CNT_START;
-                               setautogain(gspca_dev);
-                       }
-               }
                return;
        }
        if (len) {
@@ -862,10 +874,8 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val)
        struct sd *sd = (struct sd *) gspca_dev;
 
        sd->autogain = val;
-       if (val)
-               sd->ag_cnt = AG_CNT_START;
-       else
-               sd->ag_cnt = -1;
+       if (gspca_dev->streaming)
+               setautogain(gspca_dev);
        return 0;
 }
 
@@ -889,6 +899,7 @@ static struct sd_desc sd_desc = {
        .stop0 = sd_stop0,
        .close = sd_close,
        .pkt_scan = sd_pkt_scan,
+       .dq_callback = do_autogain,
 };
 
 /* -- module initialisation -- */
index 3a051c9..15d302b 100644 (file)
@@ -47,7 +47,7 @@ MODULE_LICENSE("GPL");
 
 static int video_nr = -1;
 
-#ifdef CONFIG_VIDEO_ADV_DEBUG
+#ifdef GSPCA_DEBUG
 int gspca_debug = D_ERR | D_PROBE;
 EXPORT_SYMBOL(gspca_debug);
 
@@ -677,7 +677,7 @@ static int try_fmt_vid_cap(struct gspca_dev *gspca_dev,
        w = fmt->fmt.pix.width;
        h = fmt->fmt.pix.height;
 
-#ifdef CONFIG_VIDEO_ADV_DEBUG
+#ifdef GSPCA_DEBUG
        if (gspca_debug & D_CONF)
                PDEBUG_MODE("try fmt cap", fmt->fmt.pix.pixelformat, w, h);
 #endif
@@ -785,7 +785,7 @@ static int dev_open(struct inode *inode, struct file *file)
        }
        gspca_dev->users++;
        file->private_data = gspca_dev;
-#ifdef CONFIG_VIDEO_ADV_DEBUG
+#ifdef GSPCA_DEBUG
        /* activate the v4l2 debug */
        if (gspca_debug & D_V4L2)
                gspca_dev->vdev.debug |= 3;
@@ -904,7 +904,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
                if (ctrl->id != ctrls->qctrl.id)
                        continue;
                if (ctrl->value < ctrls->qctrl.minimum
-                   && ctrl->value > ctrls->qctrl.maximum)
+                   || ctrl->value > ctrls->qctrl.maximum)
                        return -ERANGE;
                PDEBUG(D_CONF, "set ctrl [%08x] = %d", ctrl->id, ctrl->value);
                if (mutex_lock_interruptible(&gspca_dev->usb_lock))
@@ -1080,7 +1080,7 @@ static int vidioc_streamon(struct file *file, void *priv,
                if (ret < 0)
                        goto out;
        }
-#ifdef CONFIG_VIDEO_ADV_DEBUG
+#ifdef GSPCA_DEBUG
        if (gspca_debug & D_STREAM) {
                PDEBUG_MODE("stream on OK",
                        gspca_dev->pixfmt,
@@ -1913,7 +1913,7 @@ static void __exit gspca_exit(void)
 module_init(gspca_init);
 module_exit(gspca_exit);
 
-#ifdef CONFIG_VIDEO_ADV_DEBUG
+#ifdef GSPCA_DEBUG
 module_param_named(debug, gspca_debug, int, 0644);
 MODULE_PARM_DESC(debug,
                "Debug (bit) 0x01:error 0x02:probe 0x04:config"
index 3fd2c4e..67e4489 100644 (file)
@@ -9,7 +9,10 @@
 #include <media/v4l2-common.h>
 #include <linux/mutex.h>
 
-#ifdef CONFIG_VIDEO_ADV_DEBUG
+/* compilation option */
+#define GSPCA_DEBUG 1
+
+#ifdef GSPCA_DEBUG
 /* GSPCA our debug messages */
 extern int gspca_debug;
 #define PDEBUG(level, fmt, args...) \
index 83139ef..b4f00ec 100644 (file)
@@ -40,14 +40,15 @@ struct sd {
        struct gspca_dev gspca_dev;             /* !! must be the first item */
 
        /* Determined by sensor type */
-       short maxwidth;
-       short maxheight;
+       char sif;
 
        unsigned char primary_i2c_slave;        /* I2C write id of sensor */
 
        unsigned char brightness;
        unsigned char contrast;
        unsigned char colors;
+       __u8 hflip;
+       __u8 vflip;
 
        char compress;          /* Should the next frame be compressed? */
        char compress_inited;   /* Are compression params uploaded? */
@@ -77,9 +78,12 @@ 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);
+static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val);
 
 static struct ctrl sd_ctrls[] = {
-#define SD_BRIGHTNESS 0
        {
            {
                .id      = V4L2_CID_BRIGHTNESS,
@@ -88,12 +92,12 @@ static struct ctrl sd_ctrls[] = {
                .minimum = 0,
                .maximum = 255,
                .step    = 1,
-               .default_value = 127,
+#define BRIGHTNESS_DEF 127
+               .default_value = BRIGHTNESS_DEF,
            },
            .set = sd_setbrightness,
            .get = sd_getbrightness,
        },
-#define SD_CONTRAST 1
        {
            {
                .id      = V4L2_CID_CONTRAST,
@@ -102,31 +106,61 @@ static struct ctrl sd_ctrls[] = {
                .minimum = 0,
                .maximum = 255,
                .step    = 1,
-               .default_value = 127,
+#define CONTRAST_DEF 127
+               .default_value = CONTRAST_DEF,
            },
            .set = sd_setcontrast,
            .get = sd_getcontrast,
        },
-#define SD_COLOR 2
        {
            {
                .id      = V4L2_CID_SATURATION,
                .type    = V4L2_CTRL_TYPE_INTEGER,
-               .name    = "Saturation",
+               .name    = "Color",
                .minimum = 0,
                .maximum = 255,
                .step    = 1,
-               .default_value = 127,
+#define COLOR_DEF 127
+               .default_value = COLOR_DEF,
            },
            .set = sd_setcolors,
            .get = sd_getcolors,
        },
+/* next controls work with ov7670 only */
+       {
+           {
+               .id      = V4L2_CID_HFLIP,
+               .type    = V4L2_CTRL_TYPE_BOOLEAN,
+               .name    = "Mirror",
+               .minimum = 0,
+               .maximum = 1,
+               .step    = 1,
+#define HFLIP_DEF 0
+               .default_value = HFLIP_DEF,
+           },
+           .set = sd_sethflip,
+           .get = sd_gethflip,
+       },
+       {
+           {
+               .id      = V4L2_CID_VFLIP,
+               .type    = V4L2_CTRL_TYPE_BOOLEAN,
+               .name    = "Vflip",
+               .minimum = 0,
+               .maximum = 1,
+               .step    = 1,
+#define VFLIP_DEF 0
+               .default_value = VFLIP_DEF,
+           },
+           .set = sd_setvflip,
+           .get = sd_getvflip,
+       },
 };
 
 static struct v4l2_pix_format vga_mode[] = {
        {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
                .bytesperline = 320,
-               .sizeimage = 320 * 240 * 3 / 8 + 589,
+               .sizeimage = 320 * 240 * 3 / 8 + 590,
                .colorspace = V4L2_COLORSPACE_JPEG,
                .priv = 1},
        {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
@@ -138,12 +172,12 @@ static struct v4l2_pix_format vga_mode[] = {
 static struct v4l2_pix_format sif_mode[] = {
        {176, 144, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
                .bytesperline = 176,
-               .sizeimage = 176 * 144 * 3 / 8 + 589,
+               .sizeimage = 176 * 144 * 3 / 8 + 590,
                .colorspace = V4L2_COLORSPACE_JPEG,
                .priv = 1},
        {352, 288, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
                .bytesperline = 352,
-               .sizeimage = 352 * 288 * 3 / 8 + 589,
+               .sizeimage = 352 * 288 * 3 / 8 + 590,
                .colorspace = V4L2_COLORSPACE_JPEG,
                .priv = 0},
 };
@@ -225,6 +259,7 @@ static struct v4l2_pix_format sif_mode[] = {
 #define OV7670_REG_VSTART      0x19    /* Vert start high bits */
 #define OV7670_REG_VSTOP       0x1a    /* Vert stop high bits */
 #define OV7670_REG_MVFP        0x1e    /* Mirror / vflip */
+#define   OV7670_MVFP_VFLIP     0x10    /* vertical flip */
 #define   OV7670_MVFP_MIRROR     0x20    /* Mirror image */
 #define OV7670_REG_AEW         0x24    /* AGC upper limit */
 #define OV7670_REG_AEB         0x25    /* AGC lower limit */
@@ -258,16 +293,6 @@ static struct v4l2_pix_format sif_mode[] = {
 #define OV7670_REG_HAECC7      0xaa    /* Hist AEC/AGC control 7 */
 #define OV7670_REG_BD60MAX     0xab    /* 60hz banding step limit */
 
-struct ovsensor_window {
-       short x;
-       short y;
-       short width;
-       short height;
-/*     int format; */
-       short quarter;          /* Scale width and height down 2x */
-       short clockdiv;         /* Clock divisor setting */
-};
-
 static unsigned char ov7670_abs_to_sm(unsigned char v)
 {
        if (v > 127)
@@ -499,19 +524,6 @@ static int init_ov_sensor(struct sd *sd)
        return 0;
 }
 
-/* Switch on standard JPEG compression. Returns 0 for success. */
-static int ov519_init_compression(struct sd *sd)
-{
-       if (!sd->compress_inited) {
-               if (reg_w_mask(sd, OV519_SYS_EN_CLK1, 1 << 2, 1 << 2) < 0) {
-                       PDEBUG(D_ERR, "Error switching to compressed mode");
-                       return -EIO;
-               }
-               sd->compress_inited = 1;
-       }
-       return 0;
-}
-
 /* Set the read and write slave IDs. The "slave" argument is the write slave,
  * and the read slave will be set to (slave + 1).
  * This should not be called from outside the i2c I/O functions.
@@ -681,21 +693,17 @@ static int ov8xx0_configure(struct sd *sd)
                return -1;
        }
        if ((rc & 3) == 1) {
-               PDEBUG(D_PROBE, "Sensor is an OV8610");
                sd->sensor = SEN_OV8610;
        } else {
                PDEBUG(D_ERR, "Unknown image sensor version: %d", rc & 3);
                return -1;
        }
        PDEBUG(D_PROBE, "Writing 8610 registers");
-       if (write_i2c_regvals(sd,
-                       norm_8610,
-                       sizeof norm_8610 / sizeof norm_8610[0]))
+       if (write_i2c_regvals(sd, norm_8610, ARRAY_SIZE(norm_8610)))
                return -1;
 
        /* Set sensor-specific vars */
-       sd->maxwidth = 640;
-       sd->maxheight = 480;
+/*     sd->sif = 0;            already done */
        return 0;
 }
 
@@ -825,7 +833,7 @@ static int ov7xx0_configure(struct sd *sd)
                { OV7670_REG_COM7, OV7670_COM7_RESET },
                { OV7670_REG_TSLB, 0x04 },              /* OV */
                { OV7670_REG_COM7, OV7670_COM7_FMT_VGA }, /* VGA */
-               { OV7670_REG_CLKRC, 0x1 },
+               { OV7670_REG_CLKRC, 0x01 },
        /*
         * Set the hardware window.  These values from OV don't entirely
         * make sense - hstop is less than hstart.  But they work...
@@ -839,16 +847,12 @@ static int ov7xx0_configure(struct sd *sd)
                { 0x70, 0x3a },         { 0x71, 0x35 },
                { 0x72, 0x11 },         { 0x73, 0xf0 },
                { 0xa2, 0x02 },
-/* jfm */
-/* { OV7670_REG_COM10, 0x0 }, */
+/*             { OV7670_REG_COM10, 0x0 }, */
 
        /* Gamma curve values */
                { 0x7a, 0x20 },
-/* jfm:win 7b=1c */
                { 0x7b, 0x10 },
-/* jfm:win 7c=28 */
                { 0x7c, 0x1e },
-/* jfm:win 7d=3c */
                { 0x7d, 0x35 },
                { 0x7e, 0x5a },         { 0x7f, 0x69 },
                { 0x80, 0x76 },         { 0x81, 0x80 },
@@ -864,13 +868,11 @@ static int ov7xx0_configure(struct sd *sd)
                                 | OV7670_COM8_BFILT },
                { OV7670_REG_GAIN, 0 }, { OV7670_REG_AECH, 0 },
                { OV7670_REG_COM4, 0x40 }, /* magic reserved bit */
-/* jfm:win 14=38 */
                { OV7670_REG_COM9, 0x18 }, /* 4x gain + magic rsvd bit */
                { OV7670_REG_BD50MAX, 0x05 },   { OV7670_REG_BD60MAX, 0x07 },
                { OV7670_REG_AEW, 0x95 },       { OV7670_REG_AEB, 0x33 },
                { OV7670_REG_VPT, 0xe3 },       { OV7670_REG_HAECC1, 0x78 },
                { OV7670_REG_HAECC2, 0x68 },
-/* jfm:win a1=0b */
                { 0xa1, 0x03 }, /* magic */
                { OV7670_REG_HAECC3, 0xd8 },    { OV7670_REG_HAECC4, 0xd8 },
                { OV7670_REG_HAECC5, 0xf0 },    { OV7670_REG_HAECC6, 0x90 },
@@ -884,8 +886,6 @@ static int ov7xx0_configure(struct sd *sd)
        /* Almost all of these are magic "reserved" values.  */
                { OV7670_REG_COM5, 0x61 },      { OV7670_REG_COM6, 0x4b },
                { 0x16, 0x02 },
-/* jfm */
-/*             { OV7670_REG_MVFP, 0x07|OV7670_MVFP_MIRROR }, */
                { OV7670_REG_MVFP, 0x07 },
                { 0x21, 0x02 },         { 0x22, 0x91 },
                { 0x29, 0x07 },         { 0x33, 0x0b },
@@ -930,7 +930,10 @@ static int ov7xx0_configure(struct sd *sd)
                { OV7670_REG_EDGE, 0 },
                { 0x75, 0x05 },         { 0x76, 0xe1 },
                { 0x4c, 0 },            { 0x77, 0x01 },
-               { OV7670_REG_COM13, 0xc3 },     { 0x4b, 0x09 },
+               { OV7670_REG_COM13, OV7670_COM13_GAMMA
+                                 | OV7670_COM13_UVSAT
+                                 | 2},         /* was 3 */
+               { 0x4b, 0x09 },
                { 0xc9, 0x60 },         { OV7670_REG_COM16, 0x38 },
                { 0x56, 0x40 },
 
@@ -956,30 +959,10 @@ static int ov7xx0_configure(struct sd *sd)
                { 0x79, 0x03 },         { 0xc8, 0x40 },
                { 0x79, 0x05 },         { 0xc8, 0x30 },
                { 0x79, 0x26 },
-
-       /* Format YUV422 */
-               { OV7670_REG_COM7, OV7670_COM7_YUV },  /* Selects YUV mode */
-               { OV7670_REG_RGB444, 0 },       /* No RGB444 please */
-               { OV7670_REG_COM1, 0 },
-               { OV7670_REG_COM15, OV7670_COM15_R00FF },
-               { OV7670_REG_COM9, 0x18 },
-                               /* 4x gain ceiling; 0x8 is reserved bit */
-               { 0x4f, 0x80 },         /* "matrix coefficient 1" */
-               { 0x50, 0x80 },         /* "matrix coefficient 2" */
-               { 0x52, 0x22 },         /* "matrix coefficient 4" */
-               { 0x53, 0x5e },         /* "matrix coefficient 5" */
-               { 0x54, 0x80 },         /* "matrix coefficient 6" */
-               { OV7670_REG_COM13, OV7670_COM13_GAMMA|OV7670_COM13_UVSAT },
-};
+       };
 
        PDEBUG(D_PROBE, "starting OV7xx0 configuration");
 
-/* jfm:already done? */
-       if (init_ov_sensor(sd) < 0)
-               PDEBUG(D_ERR, "Failed to read sensor ID");
-       else
-               PDEBUG(D_PROBE, "OV7xx0 initialized");
-
        /* Detect sensor (sub)type */
        rc = i2c_r(sd, OV7610_REG_COM_I);
 
@@ -1025,20 +1008,25 @@ static int ov7xx0_configure(struct sd *sd)
                        return low;
                }
                if (high == 0x76) {
-                       if (low == 0x30) {
+                       switch (low) {
+                       case 0x30:
                                PDEBUG(D_PROBE, "Sensor is an OV7630/OV7635");
                                sd->sensor = SEN_OV7630;
-                       } else if (low == 0x40) {
+                               break;
+                       case 0x40:
                                PDEBUG(D_PROBE, "Sensor is an OV7645");
                                sd->sensor = SEN_OV7640; /* FIXME */
-                       } else if (low == 0x45) {
+                               break;
+                       case 0x45:
                                PDEBUG(D_PROBE, "Sensor is an OV7645B");
                                sd->sensor = SEN_OV7640; /* FIXME */
-                       } else if (low == 0x48) {
+                               break;
+                       case 0x48:
                                PDEBUG(D_PROBE, "Sensor is an OV7648");
                                sd->sensor = SEN_OV7640; /* FIXME */
-                       } else {
-                               PDEBUG(D_PROBE, "Unknown sensor: 0x76%X", low);
+                               break;
+                       default:
+                               PDEBUG(D_PROBE, "Unknown sensor: 0x76%x", low);
                                return -1;
                        }
                } else {
@@ -1050,34 +1038,34 @@ static int ov7xx0_configure(struct sd *sd)
                return -1;
        }
 
-       if (sd->sensor == SEN_OV7620) {
+       switch (sd->sensor) {
+       case SEN_OV7620:
                PDEBUG(D_PROBE, "Writing 7620 registers");
-               if (write_i2c_regvals(sd, norm_7620,
-                               sizeof norm_7620 / sizeof norm_7620[0]))
+               if (write_i2c_regvals(sd, norm_7620, ARRAY_SIZE(norm_7620)))
                        return -1;
-       } else if (sd->sensor == SEN_OV7630) {
+               break;
+       case SEN_OV7630:
                PDEBUG(D_ERR, "7630 is not supported by this driver version");
                return -1;
-       } else if (sd->sensor == SEN_OV7640) {
+       case SEN_OV7640:
                PDEBUG(D_PROBE, "Writing 7640 registers");
-               if (write_i2c_regvals(sd, norm_7640,
-                               sizeof norm_7640 / sizeof norm_7640[0]))
+               if (write_i2c_regvals(sd, norm_7640, ARRAY_SIZE(norm_7640)))
                        return -1;
-       } else if (sd->sensor == SEN_OV7670) {
+               break;
+       case SEN_OV7670:
                PDEBUG(D_PROBE, "Writing 7670 registers");
-               if (write_i2c_regvals(sd, norm_7670,
-                               sizeof norm_7670 / sizeof norm_7670[0]))
+               if (write_i2c_regvals(sd, norm_7670, ARRAY_SIZE(norm_7670)))
                        return -1;
-       } else {
+               break;
+       default:
                PDEBUG(D_PROBE, "Writing 7610 registers");
-               if (write_i2c_regvals(sd, norm_7610,
-                               sizeof norm_7610 / sizeof norm_7610[0]))
+               if (write_i2c_regvals(sd, norm_7610, ARRAY_SIZE(norm_7610)))
                        return -1;
+               break;
        }
 
        /* Set sensor-specific vars */
-       sd->maxwidth = 640;
-       sd->maxheight = 480;
+/*     sd->sif = 0;            already done */
        return 0;
 }
 
@@ -1231,43 +1219,45 @@ static int ov6xx0_configure(struct sd *sd)
        /* Ugh. The first two bits are the version bits, but
         * the entire register value must be used. I guess OVT
         * underestimated how many variants they would make. */
-       if (rc == 0x00) {
+       switch (rc) {
+       case 0x00:
                sd->sensor = SEN_OV6630;
                PDEBUG(D_ERR,
                        "WARNING: Sensor is an OV66308. Your camera may have");
                PDEBUG(D_ERR, "been misdetected in previous driver versions.");
-       } else if (rc == 0x01) {
+               break;
+       case 0x01:
                sd->sensor = SEN_OV6620;
-               PDEBUG(D_PROBE, "Sensor is an OV6620");
-       } else if (rc == 0x02) {
+               break;
+       case 0x02:
                sd->sensor = SEN_OV6630;
                PDEBUG(D_PROBE, "Sensor is an OV66308AE");
-       } else if (rc == 0x03) {
+               break;
+       case 0x03:
                sd->sensor = SEN_OV6630;
                PDEBUG(D_PROBE, "Sensor is an OV66308AF");
-       } else if (rc == 0x90) {
+               break;
+       case 0x90:
                sd->sensor = SEN_OV6630;
                PDEBUG(D_ERR,
                        "WARNING: Sensor is an OV66307. Your camera may have");
                PDEBUG(D_ERR, "been misdetected in previous driver versions.");
-       } else {
+               break;
+       default:
                PDEBUG(D_ERR, "FATAL: Unknown sensor version: 0x%02x", rc);
                return -1;
        }
 
        /* Set sensor-specific vars */
-       sd->maxwidth = 352;
-       sd->maxheight = 288;
+       sd->sif = 1;
 
        if (sd->sensor == SEN_OV6620) {
                PDEBUG(D_PROBE, "Writing 6x20 registers");
-               if (write_i2c_regvals(sd, norm_6x20,
-                               sizeof norm_6x20 / sizeof norm_6x20[0]))
+               if (write_i2c_regvals(sd, norm_6x20, ARRAY_SIZE(norm_6x20)))
                        return -1;
        } else {
                PDEBUG(D_PROBE, "Writing 6x30 registers");
-               if (write_i2c_regvals(sd, norm_6x30,
-                               sizeof norm_6x30 / sizeof norm_6x30[0]))
+               if (write_i2c_regvals(sd, norm_6x30, ARRAY_SIZE(norm_6x30)))
                        return -1;
        }
        return 0;
@@ -1276,14 +1266,8 @@ static int ov6xx0_configure(struct sd *sd)
 /* Turns on or off the LED. Only has an effect with OV511+/OV518(+)/OV519 */
 static void ov51x_led_control(struct sd *sd, int on)
 {
-       PDEBUG(D_STREAM, "LED (%s)", on ? "on" : "off");
-
-/*     if (sd->bridge == BRG_OV511PLUS) */
-/*             reg_w(sd, R511_SYS_LED_CTL, on ? 1 : 0); */
-/*     else if (sd->bridge == BRG_OV519) */
-               reg_w_mask(sd, OV519_GPIO_DATA_OUT0, !on, 1);   /* 0 / 1 */
-/*     else if (sd->bclass == BCL_OV518) */
-/*             reg_w_mask(sd, R518_GPIO_OUT, on ? 0x02 : 0x00, 0x02); */
+/*     PDEBUG(D_STREAM, "LED (%s)", on ? "on" : "off"); */
+       reg_w_mask(sd, OV519_GPIO_DATA_OUT0, !on, 1);   /* 0 / 1 */
 }
 
 /* this function is called at probe time */
@@ -1293,11 +1277,8 @@ static int sd_config(struct gspca_dev *gspca_dev,
        struct sd *sd = (struct sd *) gspca_dev;
        struct cam *cam;
 
-/* (from ov519_configure) */
        static const struct ov_regvals init_519[] = {
                { 0x5a,  0x6d }, /* EnableSystem */
-/* jfm trace usbsnoop3-1.txt */
-/* jfm 53 = fb */
                { 0x53,  0x9b },
                { 0x54,  0xff }, /* set bit2 to enable jpeg */
                { 0x5d,  0x03 },
@@ -1314,9 +1295,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
 
        if (write_regvals(sd, init_519, ARRAY_SIZE(init_519)))
                goto error;
-/* jfm: not seen in windows trace */
-       if (ov519_init_compression(sd))
-               goto error;
        ov51x_led_control(sd, 0);       /* turn LED off */
 
        /* Test for 76xx */
@@ -1365,16 +1343,18 @@ static int sd_config(struct gspca_dev *gspca_dev,
 
        cam = &gspca_dev->cam;
        cam->epaddr = OV511_ENDPOINT_ADDRESS;
-       if (sd->maxwidth == 640) {
+       if (!sd->sif) {
                cam->cam_mode = vga_mode;
-               cam->nmodes = sizeof vga_mode / sizeof vga_mode[0];
+               cam->nmodes = ARRAY_SIZE(vga_mode);
        } else {
                cam->cam_mode = sif_mode;
-               cam->nmodes = sizeof sif_mode / sizeof sif_mode[0];
+               cam->nmodes = ARRAY_SIZE(sif_mode);
        }
-       sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value;
-       sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value;
-       sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value;
+       sd->brightness = BRIGHTNESS_DEF;
+       sd->contrast = CONTRAST_DEF;
+       sd->colors = COLOR_DEF;
+       sd->hflip = HFLIP_DEF;
+       sd->vflip = VFLIP_DEF;
        return 0;
 error:
        PDEBUG(D_ERR, "OV519 Config failed");
@@ -1394,8 +1374,7 @@ static int sd_open(struct gspca_dev *gspca_dev)
  *
  * Do not put any sensor-specific code in here (including I2C I/O functions)
  */
-static int ov519_mode_init_regs(struct sd *sd,
-                               int width, int height)
+static int ov519_mode_init_regs(struct sd *sd)
 {
        static const struct ov_regvals mode_init_519_ov7670[] = {
                { 0x5d, 0x03 }, /* Turn off suspend mode */
@@ -1441,36 +1420,23 @@ static int ov519_mode_init_regs(struct sd *sd,
                /* windows reads 0x55 at this point, why? */
        };
 
-/* int hi_res; */
-
-       PDEBUG(D_CONF, "mode init %dx%d", width, height);
-
-/*     if (width >= 800 && height >= 600)
-               hi_res = 1;
-       else
-               hi_res = 0; */
-
-/*     if (ov51x_stop(sd) < 0)
-               return -EIO; */
-
        /******** Set the mode ********/
        if (sd->sensor != SEN_OV7670) {
                if (write_regvals(sd, mode_init_519,
                                  ARRAY_SIZE(mode_init_519)))
                        return -EIO;
+               if (sd->sensor == SEN_OV7640) {
+                       /* Select 8-bit input mode */
+                       reg_w_mask(sd, OV519_CAM_DFR, 0x10, 0x10);
+               }
        } else {
                if (write_regvals(sd, mode_init_519_ov7670,
                                  ARRAY_SIZE(mode_init_519_ov7670)))
                        return -EIO;
        }
 
-       if (sd->sensor == SEN_OV7640) {
-               /* Select 8-bit input mode */
-               reg_w_mask(sd, OV519_CAM_DFR, 0x10, 0x10);
-       }
-
-       reg_w(sd, OV519_CAM_H_SIZE,     width >> 4);
-       reg_w(sd, OV519_CAM_V_SIZE,     height >> 3);
+       reg_w(sd, OV519_CAM_H_SIZE,     sd->gspca_dev.width >> 4);
+       reg_w(sd, OV519_CAM_V_SIZE,     sd->gspca_dev.height >> 3);
        reg_w(sd, OV519_CAM_X_OFFSETL,  0x00);
        reg_w(sd, OV519_CAM_X_OFFSETH,  0x00);
        reg_w(sd, OV519_CAM_Y_OFFSETL,  0x00);
@@ -1485,9 +1451,10 @@ static int ov519_mode_init_regs(struct sd *sd,
 
 /* FIXME: These are only valid at the max resolution. */
        sd->clockdiv = 0;
-       if (sd->sensor == SEN_OV7640) {
+       switch (sd->sensor) {
+       case SEN_OV7640:
                switch (sd->frame_rate) {
-/*jfm: default was 30 fps */
+/*fixme: default was 30 fps */
                case 30:
                        reg_w(sd, 0xa4, 0x0c);
                        reg_w(sd, 0x23, 0xff);
@@ -1517,7 +1484,8 @@ static int ov519_mode_init_regs(struct sd *sd,
                        sd->clockdiv = 1;
                        break;
                }
-       } else if (sd->sensor == SEN_OV8610) {
+               break;
+       case SEN_OV8610:
                switch (sd->frame_rate) {
                default:        /* 15 fps */
 /*             case 15: */
@@ -1533,41 +1501,37 @@ static int ov519_mode_init_regs(struct sd *sd,
                        reg_w(sd, 0x23, 0x1b);
                        break;
                }
-               sd->clockdiv = 0;
-       } else if (sd->sensor == SEN_OV7670) { /* guesses, based on 7640 */
+               break;
+       case SEN_OV7670:                /* guesses, based on 7640 */
                PDEBUG(D_STREAM, "Setting framerate to %d fps",
                                 (sd->frame_rate == 0) ? 15 : sd->frame_rate);
+               reg_w(sd, 0xa4, 0x10);
                switch (sd->frame_rate) {
                case 30:
-                       reg_w(sd, 0xa4, 0x10);
                        reg_w(sd, 0x23, 0xff);
                        break;
                case 20:
-                       reg_w(sd, 0xa4, 0x10);
                        reg_w(sd, 0x23, 0x1b);
                        break;
-               default: /* 15 fps */
-/*                     case 15: */
-                       reg_w(sd, 0xa4, 0x10);
+               default:
+/*             case 15: */
                        reg_w(sd, 0x23, 0xff);
                        sd->clockdiv = 1;
                        break;
                }
+               break;
        }
 
-/*     if (ov51x_restart(sd) < 0)
-               return -EIO; */
-
-       /* Reset it just for good measure */
-/*     if (ov51x_reset(sd, OV511_RESET_NOREGS) < 0)
-               return -EIO; */
        return 0;
 }
 
-static int mode_init_ov_sensor_regs(struct sd *sd,
-                               struct ovsensor_window *win)
+static int mode_init_ov_sensor_regs(struct sd *sd)
 {
-       int qvga = win->quarter;
+       struct gspca_dev *gspca_dev;
+       int qvga;
+
+       gspca_dev = &sd->gspca_dev;
+       qvga = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
 
        /******** Mode (VGA/QVGA) and sensor specific regs ********/
        switch (sd->sensor) {
@@ -1611,8 +1575,6 @@ static int mode_init_ov_sensor_regs(struct sd *sd,
                         OV7670_COM7_FMT_MASK);
                break;
        case SEN_OV6620:
-               i2c_w_mask(sd, 0x14, qvga ? 0x20 : 0x00, 0x20);
-               break;
        case SEN_OV6630:
                i2c_w_mask(sd, 0x14, qvga ? 0x20 : 0x00, 0x20);
                break;
@@ -1621,24 +1583,21 @@ static int mode_init_ov_sensor_regs(struct sd *sd,
        }
 
        /******** Palette-specific regs ********/
-/* Need to do work here for the OV7670 */
-
-               if (sd->sensor == SEN_OV7610 || sd->sensor == SEN_OV76BE) {
-                       /* not valid on the OV6620/OV7620/6630? */
-                       i2c_w_mask(sd, 0x0e, 0x00, 0x40);
-               }
+       if (sd->sensor == SEN_OV7610 || sd->sensor == SEN_OV76BE) {
+               /* not valid on the OV6620/OV7620/6630? */
+               i2c_w_mask(sd, 0x0e, 0x00, 0x40);
+       }
 
-               /* The OV518 needs special treatment. Although both the OV518
-                * and the OV6630 support a 16-bit video bus, only the 8 bit Y
-                * bus is actually used. The UV bus is tied to ground.
-                * Therefore, the OV6630 needs to be in 8-bit multiplexed
-                * output mode */
+       /* The OV518 needs special treatment. Although both the OV518
+        * and the OV6630 support a 16-bit video bus, only the 8 bit Y
+        * bus is actually used. The UV bus is tied to ground.
+        * Therefore, the OV6630 needs to be in 8-bit multiplexed
+        * output mode */
 
-               /* OV7640 is 8-bit only */
+       /* OV7640 is 8-bit only */
 
-               if (sd->sensor != SEN_OV6630 && sd->sensor != SEN_OV7640)
-                       i2c_w_mask(sd, 0x13, 0x00, 0x20);
-/*     } */
+       if (sd->sensor != SEN_OV6630 && sd->sensor != SEN_OV7640)
+               i2c_w_mask(sd, 0x13, 0x00, 0x20);
 
        /******** Clock programming ********/
        /* The OV6620 needs special handling. This prevents the
@@ -1647,14 +1606,14 @@ static int mode_init_ov_sensor_regs(struct sd *sd,
 
                /* Clock down */
                i2c_w(sd, 0x2a, 0x04);
-               i2c_w(sd, 0x11, win->clockdiv);
+               i2c_w(sd, 0x11, sd->clockdiv);
                i2c_w(sd, 0x2a, 0x84);
                /* This next setting is critical. It seems to improve
                 * the gain or the contrast. The "reserved" bits seem
                 * to have some effect in this case. */
                i2c_w(sd, 0x2d, 0x85);
-       } else if (win->clockdiv >= 0) {
-               i2c_w(sd, 0x11, win->clockdiv);
+       } else if (sd->clockdiv >= 0) {
+               i2c_w(sd, 0x11, sd->clockdiv);
        }
 
        /******** Special Features ********/
@@ -1674,7 +1633,7 @@ static int mode_init_ov_sensor_regs(struct sd *sd,
        /* is fully tested. */
        /* 7620/6620/6630? don't have register 0x35, so play it safe */
        if (sd->sensor == SEN_OV7610 || sd->sensor == SEN_OV76BE) {
-               if (win->width == 640 /*&& win->height == 480*/)
+               if (!qvga)
                        i2c_w(sd, 0x35, 0x9e);
                else
                        i2c_w(sd, 0x35, 0x1e);
@@ -1682,13 +1641,31 @@ static int mode_init_ov_sensor_regs(struct sd *sd,
        return 0;
 }
 
-static int set_ov_sensor_window(struct sd *sd,
-                               struct ovsensor_window *win)
+static void sethvflip(struct sd *sd)
 {
+       if (sd->sensor != SEN_OV7670)
+               return;
+       if (sd->gspca_dev.streaming)
+               ov51x_stop(sd);
+       i2c_w_mask(sd, OV7670_REG_MVFP,
+               OV7670_MVFP_MIRROR * sd->hflip
+                       | OV7670_MVFP_VFLIP * sd->vflip,
+               OV7670_MVFP_MIRROR | OV7670_MVFP_VFLIP);
+       if (sd->gspca_dev.streaming)
+               ov51x_restart(sd);
+}
+
+static int set_ov_sensor_window(struct sd *sd)
+{
+       struct gspca_dev *gspca_dev;
+       int qvga;
        int hwsbase, hwebase, vwsbase, vwebase, hwscale, vwscale;
        int ret, hstart, hstop, vstop, vstart;
        __u8 v;
 
+       gspca_dev = &sd->gspca_dev;
+       qvga = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
+
        /* The different sensor ICs handle setting up of window differently.
         * IF YOU SET IT WRONG, YOU WILL GET ALL ZERO ISOC DATA FROM OV51x!! */
        switch (sd->sensor) {
@@ -1733,7 +1710,7 @@ static int set_ov_sensor_window(struct sd *sd,
        switch (sd->sensor) {
        case SEN_OV6620:
        case SEN_OV6630:
-               if (win->quarter) {     /* QCIF */
+               if (qvga) {             /* QCIF */
                        hwscale = 0;
                        vwscale = 0;
                } else {                /* CIF */
@@ -1743,7 +1720,7 @@ static int set_ov_sensor_window(struct sd *sd,
                }
                break;
        case SEN_OV8610:
-               if (win->quarter) {     /* QSVGA */
+               if (qvga) {             /* QSVGA */
                        hwscale = 1;
                        vwscale = 1;
                } else {                /* SVGA */
@@ -1752,7 +1729,7 @@ static int set_ov_sensor_window(struct sd *sd,
                }
                break;
        default:                        /* SEN_OV7xx0 */
-               if (win->quarter) {     /* QVGA */
+               if (qvga) {             /* QVGA */
                        hwscale = 1;
                        vwscale = 0;
                } else {                /* VGA */
@@ -1761,7 +1738,7 @@ static int set_ov_sensor_window(struct sd *sd,
                }
        }
 
-       ret = mode_init_ov_sensor_regs(sd, win);
+       ret = mode_init_ov_sensor_regs(sd);
        if (ret < 0)
                return ret;
 
@@ -1782,7 +1759,7 @@ static int set_ov_sensor_window(struct sd *sd,
        /* I can hard code this for OV7670s */
        /* Yes, these numbers do look odd, but they're tested and work! */
        if (sd->sensor == SEN_OV7670) {
-               if (win->quarter) {     /* QVGA from ov7670.c by
+               if (qvga) {             /* QVGA from ov7670.c by
                                         * Jonathan Corbet */
                        hstart = 164;
                        hstop = 20;
@@ -1796,75 +1773,45 @@ static int set_ov_sensor_window(struct sd *sd,
                }
                /* OV7670 hardware window registers are split across
                 * multiple locations */
-               i2c_w(sd, OV7670_REG_HSTART, (hstart >> 3) & 0xff);
-               i2c_w(sd, OV7670_REG_HSTOP, (hstop >> 3) & 0xff);
+               i2c_w(sd, OV7670_REG_HSTART, hstart >> 3);
+               i2c_w(sd, OV7670_REG_HSTOP, hstop >> 3);
                v = i2c_r(sd, OV7670_REG_HREF);
                v = (v & 0xc0) | ((hstop & 0x7) << 3) | (hstart & 0x07);
                msleep(10);     /* need to sleep between read and write to
                                 * same reg! */
                i2c_w(sd, OV7670_REG_HREF, v);
 
-               i2c_w(sd, OV7670_REG_VSTART, (vstart >> 2) & 0xff);
-               i2c_w(sd, OV7670_REG_VSTOP, (vstop >> 2) & 0xff);
+               i2c_w(sd, OV7670_REG_VSTART, vstart >> 2);
+               i2c_w(sd, OV7670_REG_VSTOP, vstop >> 2);
                v = i2c_r(sd, OV7670_REG_VREF);
                v = (v & 0xc0) | ((vstop & 0x3) << 2) | (vstart & 0x03);
                msleep(10);     /* need to sleep between read and write to
                                 * same reg! */
                i2c_w(sd, OV7670_REG_VREF, v);
-
+               sethvflip(sd);
        } else {
-               i2c_w(sd, 0x17, hwsbase + (win->x >> hwscale));
-               i2c_w(sd, 0x18, hwebase + ((win->x + win->width) >> hwscale));
-               i2c_w(sd, 0x19, vwsbase + (win->y >> vwscale));
-               i2c_w(sd, 0x1a, vwebase + ((win->y + win->height) >> vwscale));
+               i2c_w(sd, 0x17, hwsbase);
+               i2c_w(sd, 0x18, hwebase + (sd->gspca_dev.width >> hwscale));
+               i2c_w(sd, 0x19, vwsbase);
+               i2c_w(sd, 0x1a, vwebase + (sd->gspca_dev.height >> vwscale));
        }
        return 0;
 }
 
-static int ov_sensor_mode_setup(struct sd *sd,
-                               int width, int height)
-{
-       struct ovsensor_window win;
-
-/*     win.format = mode; */
-
-       /* Unless subcapture is enabled,
-        * center the image window and downsample
-        * if possible to increase the field of view */
-       /* NOTE: OV518(+) and OV519 does downsampling on its own */
-       win.width = width;
-       win.height = height;
-       if (width == sd->maxwidth)
-               win.quarter = 0;
-       else
-               win.quarter = 1;
-
-       /* Center it */
-       win.x = (win.width - width) / 2;
-       win.y = (win.height - height) / 2;
-
-       /* Clock is determined by OV519 frame rate code */
-       win.clockdiv = sd->clockdiv;
-
-       PDEBUG(D_CONF, "Setting clock divider to %d", win.clockdiv);
-       return set_ov_sensor_window(sd, &win);
-}
-
 /* -- start the camera -- */
 static void sd_start(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
        int ret;
 
-
-       ret = ov519_mode_init_regs(sd, gspca_dev->width, gspca_dev->height);
+       ret = ov519_mode_init_regs(sd);
        if (ret < 0)
                goto out;
-       ret = ov_sensor_mode_setup(sd, gspca_dev->width, gspca_dev->height);
+       ret = set_ov_sensor_window(sd);
        if (ret < 0)
                goto out;
 
-       ret = ov51x_restart((struct sd *) gspca_dev);
+       ret = ov51x_restart(sd);
        if (ret < 0)
                goto out;
        PDEBUG(D_STREAM, "camera started alt: 0x%02x", gspca_dev->alt);
@@ -1938,12 +1885,10 @@ static void setbrightness(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
        int val;
-/*     int was_streaming; */
 
        val = sd->brightness;
        PDEBUG(D_CONF, "brightness:%d", val);
-/*     was_streaming = gspca_dev->streaming;
- *     if (was_streaming)
+/*     if (gspca_dev->streaming)
  *             ov51x_stop(sd); */
        switch (sd->sensor) {
        case SEN_OV8610:
@@ -1961,12 +1906,12 @@ static void setbrightness(struct gspca_dev *gspca_dev)
                        i2c_w(sd, OV7610_REG_BRT, val);
                break;
        case SEN_OV7670:
-/*jfm - from windblows
+/*win trace
  *             i2c_w_mask(sd, OV7670_REG_COM8, 0, OV7670_COM8_AEC); */
                i2c_w(sd, OV7670_REG_BRIGHT, ov7670_abs_to_sm(val));
                break;
        }
-/*     if (was_streaming)
+/*     if (gspca_dev->streaming)
  *             ov51x_restart(sd); */
 }
 
@@ -1974,12 +1919,10 @@ static void setcontrast(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
        int val;
-/*     int was_streaming; */
 
        val = sd->contrast;
        PDEBUG(D_CONF, "contrast:%d", val);
-/*     was_streaming = gspca_dev->streaming;
-       if (was_streaming)
+/*     if (gspca_dev->streaming)
                ov51x_stop(sd); */
        switch (sd->sensor) {
        case SEN_OV7610:
@@ -2016,7 +1959,7 @@ static void setcontrast(struct gspca_dev *gspca_dev)
                i2c_w(sd, OV7670_REG_CONTRAS, val >> 1);
                break;
        }
-/*     if (was_streaming)
+/*     if (gspca_dev->streaming)
                ov51x_restart(sd); */
 }
 
@@ -2024,12 +1967,10 @@ static void setcolors(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
        int val;
-/*     int was_streaming; */
 
        val = sd->colors;
        PDEBUG(D_CONF, "saturation:%d", val);
-/*     was_streaming = gspca_dev->streaming;
-       if (was_streaming)
+/*     if (gspca_dev->streaming)
                ov51x_stop(sd); */
        switch (sd->sensor) {
        case SEN_OV8610:
@@ -2055,7 +1996,7 @@ static void setcolors(struct gspca_dev *gspca_dev)
                /* set REG_COM13 values for UV sat auto mode */
                break;
        }
-/*     if (was_streaming)
+/*     if (gspca_dev->streaming)
                ov51x_restart(sd); */
 }
 
@@ -2110,6 +2051,40 @@ static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val)
        return 0;
 }
 
+static int sd_sethflip(struct gspca_dev *gspca_dev, __s32 val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       sd->hflip = val;
+       sethvflip(sd);
+       return 0;
+}
+
+static int sd_gethflip(struct gspca_dev *gspca_dev, __s32 *val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       *val = sd->hflip;
+       return 0;
+}
+
+static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       sd->vflip = val;
+       sethvflip(sd);
+       return 0;
+}
+
+static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       *val = sd->vflip;
+       return 0;
+}
+
 /* sub-driver description */
 static const struct sd_desc sd_desc = {
        .name = MODULE_NAME,
@@ -2178,4 +2153,3 @@ module_exit(sd_mod_exit);
 
 module_param(frame_rate, int, 0644);
 MODULE_PARM_DESC(frame_rate, "Frame rate (5, 10, 15, 20 or 30 fps)");
-
index ea3d702..815bea6 100644 (file)
@@ -31,7 +31,9 @@ MODULE_LICENSE("GPL");
 struct sd {
        struct gspca_dev gspca_dev;             /* !! must be the first item */
 
-       int avg_lum;
+       int lum_sum;
+       atomic_t avg_lum;
+       atomic_t do_gain;
 
        unsigned char brightness;
        unsigned char contrast;
@@ -271,6 +273,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
        sd->contrast = CONTRAST_DEF;
        sd->colors = COLOR_DEF;
        sd->autogain = AUTOGAIN_DEF;
+       sd->ag_cnt = -1;
        return 0;
 }
 
@@ -311,6 +314,18 @@ static void setcolors(struct gspca_dev *gspca_dev)
        PDEBUG(D_CONF|D_STREAM, "color: %i", sd->colors);
 }
 
+static void setautogain(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       if (sd->autogain) {
+               sd->lum_sum = 0;
+               sd->ag_cnt = AG_CNT_START;
+       } else {
+               sd->ag_cnt = -1;
+       }
+}
+
 /* this function is called at open time */
 static int sd_open(struct gspca_dev *gspca_dev)
 {
@@ -320,8 +335,6 @@ static int sd_open(struct gspca_dev *gspca_dev)
 
 static void sd_start(struct gspca_dev *gspca_dev)
 {
-       struct sd *sd = (struct sd *) gspca_dev;
-
        reg_w(gspca_dev, 0xff, 0x01);
        reg_w_buf(gspca_dev, 0x0002, "\x48\x0a\x40\x08\x00\x00\x08\x00", 8);
        reg_w_buf(gspca_dev, 0x000a, "\x06\xff\x11\xff\x5a\x30\x90\x4c", 8);
@@ -394,6 +407,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
        setcontrast(gspca_dev);
        setbrightness(gspca_dev);
        setcolors(gspca_dev);
+       setautogain(gspca_dev);
 
        /* set correct resolution */
        switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) {
@@ -431,13 +445,6 @@ static void sd_start(struct gspca_dev *gspca_dev)
        reg_w(gspca_dev, 0xff, 0x01);
        reg_w(gspca_dev, 0x78, 0x04);
        reg_w(gspca_dev, 0x78, 0x05);
-
-       if (sd->autogain) {
-               sd->ag_cnt = AG_CNT_START;
-               sd->avg_lum = 0;
-       } else {
-               sd->ag_cnt = -1;
-       }
 }
 
 static void sd_stopN(struct gspca_dev *gspca_dev)
@@ -473,13 +480,20 @@ static void sd_close(struct gspca_dev *gspca_dev)
        reg_w(gspca_dev, 0x78, 0x44); /* Bit_0=start stream, Bit_7=LED */
 }
 
-static void setautogain(struct gspca_dev *gspca_dev, int luma)
+static void do_autogain(struct gspca_dev *gspca_dev)
 {
+       struct sd *sd = (struct sd *) gspca_dev;
+       int luma;
        int luma_mean = 128;
        int luma_delta = 20;
        __u8 spring = 5;
        int Gbright;
 
+       if (!atomic_read(&sd->do_gain))
+               return;
+       atomic_set(&sd->do_gain, 0);
+
+       luma = atomic_read(&sd->avg_lum);
        Gbright = reg_r(gspca_dev, 0x02);
        PDEBUG(D_FRAM, "luma mean %d", luma);
        if (luma < luma_mean - luma_delta ||
@@ -523,12 +537,13 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
 
                        /* start of frame */
                        if (sd->ag_cnt >= 0 && p > 28) {
-                               sd->avg_lum += data[p - 23];
+                               sd->lum_sum += data[p - 23];
                                if (--sd->ag_cnt < 0) {
                                        sd->ag_cnt = AG_CNT_START;
-                                       setautogain(gspca_dev,
-                                               sd->avg_lum / AG_CNT_START);
-                                       sd->avg_lum = 0;
+                                       atomic_set(&sd->avg_lum,
+                                               sd->lum_sum / AG_CNT_START);
+                                       sd->lum_sum = 0;
+                                       atomic_set(&sd->do_gain, 1);
                                }
                        }
 
@@ -677,12 +692,8 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val)
        struct sd *sd = (struct sd *) gspca_dev;
 
        sd->autogain = val;
-       if (val) {
-               sd->ag_cnt = AG_CNT_START;
-               sd->avg_lum = 0;
-       } else {
-               sd->ag_cnt = -1;
-       }
+       if (gspca_dev->streaming)
+               setautogain(gspca_dev);
        return 0;
 }
 
@@ -706,6 +717,7 @@ static struct sd_desc sd_desc = {
        .stop0 = sd_stop0,
        .close = sd_close,
        .pkt_scan = sd_pkt_scan,
+       .dq_callback = do_autogain,
 };
 
 /* -- module initialisation -- */
index e18748c..11210c7 100644 (file)
@@ -408,7 +408,7 @@ static void reg_w(struct gspca_dev *gspca_dev,
                  const __u8 *buffer,
                  int len)
 {
-#ifdef CONFIG_VIDEO_ADV_DEBUG
+#ifdef GSPCA_DEBUG
        if (len > sizeof gspca_dev->usb_buf) {
                PDEBUG(D_ERR|D_PACK, "reg_w: buffer overflow");
                return;
index 33a3df1..245a30e 100644 (file)
@@ -32,7 +32,7 @@ MODULE_LICENSE("GPL");
 struct sd {
        struct gspca_dev gspca_dev;     /* !! must be the first item */
 
-       int avg_lum;
+       atomic_t avg_lum;
        unsigned int exposure;
 
        unsigned short brightness;
@@ -148,55 +148,58 @@ static struct v4l2_pix_format vga_mode[] = {
 
 /*Data from sn9c102p+hv71331r */
 static const __u8 sn_hv7131[] = {
-/*     reg0  reg1  reg2  reg3  reg4  reg5  reg6  reg7  reg8  reg9 */
-       0x00, 0x03, 0x64, 0x00, 0x1A, 0x20, 0x20, 0x20, 0xA1, 0x11,
-/*     rega  regb  regc  regd  rege  regf  reg10 reg11 */
-       0x02, 0x09, 0x00, 0x00, 0x00, 0x10, 0x03, 0x00,         /* 00 */
-/*     reg12 reg13 reg14 reg15 reg16 reg17 reg18 reg19 reg1a reg1b */
-       0x00, 0x01, 0x03, 0x28, 0x1e, 0x41, 0x0a, 0x00, 0x00, 0x00,
-/*     reg1c reg1d reg1e reg1f reg20 reg21 reg22 reg23 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+/*     reg0    reg1    reg2    reg3    reg4    reg5    reg6    reg7 */
+       0x00,   0x03,   0x64,   0x00,   0x1a,   0x20,   0x20,   0x20,
+/*     reg8    reg9    rega    regb    regc    regd    rege    regf */
+       0xa1,   0x11,   0x02,   0x09,   0x00,   0x00,   0x00,   0x10,
+/*     reg10   reg11   reg12   reg13   reg14   reg15   reg16   reg17 */
+       0x03,   0x00,   0x00,   0x01,   0x03,   0x28,   0x1e,   0x41,
+/*     reg18   reg19   reg1a   reg1b   reg1c   reg1d   reg1e   reg1f */
+       0x0a,   0x00,   0x00,   0x00,   0x00,   0x00,   0x00,   0x00
 };
 
 static const __u8 sn_mi0360[] = {
-/*     reg0  reg1  reg2  reg3  reg4  reg5  reg6  reg7  reg8  reg9 */
-       0x00, 0x61, 0x44, 0x00, 0x1a, 0x20, 0x20, 0x20, 0xb1, 0x5d,
-/*     rega  regb  regc  regd  rege  regf  reg10 reg11 */
-       0x07, 0x00, 0x00, 0x00, 0x00, 0x10, 0x03, 0x00,
-/*     reg12 reg13 reg14 reg15 reg16 reg17 reg18 reg19 reg1a reg1b */
-       0x00, 0x02, 0x0a, 0x28, 0x1e, 0x61, 0x06, 0x00, 0x00, 0x00,
-/*     reg1c reg1d reg1e reg1f reg20 reg21 reg22 reg23 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+/*     reg0    reg1    reg2    reg3    reg4    reg5    reg6    reg7 */
+       0x00,   0x61,   0x44,   0x00,   0x1a,   0x20,   0x20,   0x20,
+/*     reg8    reg9    rega    regb    regc    regd    rege    regf */
+       0xb1,   0x5d,   0x07,   0x00,   0x00,   0x00,   0x00,   0x10,
+/*     reg10   reg11   reg12   reg13   reg14   reg15   reg16   reg17 */
+       0x03,   0x00,   0x00,   0x02,   0x0a,   0x28,   0x1e,   0x61,
+/*     reg18   reg19   reg1a   reg1b   reg1c   reg1d   reg1e   reg1f */
+       0x06,   0x00,   0x00,   0x00,   0x00,   0x00,   0x00,   0x00
 };
 
 static const __u8 sn_mo4000[] = {
-/*     reg0    reg1    reg2    reg3    reg4    reg5    reg6    reg7    reg8 */
-       0x12,   0x23,   0x60,   0x00,   0x1A,   0x00,   0x20,   0x18,   0x81,
-/*     reg9    rega    regb    regc    regd    rege    regf    reg10   reg11*/
-       0x21,   0x00,   0x00,   0x00,   0x00,   0x00,   0x00,   0x03,   0x00,
-/*     reg12   reg13   reg14   reg15   reg16   reg17   reg18   reg19   reg1a*/
-       0x0b,   0x0f,   0x14,   0x28,   0x1e,   0x40,   0x08,   0x00,   0x00,
-/*     reg1b   reg1c   reg1d   reg1e   reg1f   reg20   reg21   reg22   reg23*/
-       0x00,   0x00,   0x00,   0x00,   0x00,   0x08,   0x25,   0x39,   0x4b,
-       0x5c,   0x6b,   0x79,   0x87,   0x95,   0xa2,   0xaf,   0xbb,   0xc7,
-       0xd3,   0xdf,   0xea,   0xf5
+/*     reg0    reg1    reg2    reg3    reg4    reg5    reg6    reg7 */
+       0x12,   0x23,   0x60,   0x00,   0x1a,   0x00,   0x20,   0x18,
+/*     reg8    reg9    rega    regb    regc    regd    rege    regf */
+       0x81,   0x21,   0x00,   0x00,   0x00,   0x00,   0x00,   0x00,
+/*     reg10   reg11   reg12   reg13   reg14   reg15   reg16   reg17 */
+       0x03,    0x00,  0x0b,   0x0f,   0x14,   0x28,   0x1e,   0x40,
+/*     reg18   reg19   reg1a   reg1b   reg1c   reg1d   reg1e   reg1f */
+       0x08,   0x00,   0x00,   0x00,   0x00,   0x00,   0x00,   0x00
 };
 
 static const __u8 sn_ov7648[] = {
-       0x00, 0x21, 0x62, 0x00, 0x1a, 0x20, 0x20, 0x20, 0xA1, 0x6E, 0x18, 0x65,
-       0x00, 0x00, 0x00, 0x10, 0x03, 0x00, 0x00, 0x06, 0x06, 0x28, 0x1E, 0x82,
-       0x07, 0x00, 0x00, 0x00, 0x00, 0x00
+/*     reg0    reg1    reg2    reg3    reg4    reg5    reg6    reg7 */
+       0x00,   0x21,   0x62,   0x00,   0x1a,   0x20,   0x20,   0x20,
+/*     reg8    reg9    rega    regb    regc    regd    rege    regf */
+       0xa1,   0x6e,   0x18,   0x65,   0x00,   0x00,   0x00,   0x10,
+/*     reg10   reg11   reg12   reg13   reg14   reg15   reg16   reg17 */
+       0x03,   0x00,   0x00,   0x06,   0x06,   0x28,   0x1e,   0x82,
+/*     reg18   reg19   reg1a   reg1b   reg1c   reg1d   reg1e   reg1f */
+       0x07,   0x00,   0x00,   0x00,   0x00,   0x00
 };
 
 static const __u8 sn_ov7660[]  = {
-/*     reg0    reg1    reg2    reg3    reg4    reg5    reg6    reg7    reg8 */
-       0x00,   0x61,   0x40,   0x00,   0x1a,   0x00,   0x00,   0x00,   0x81,
-/*     reg9    rega    regb    regc    regd    rege    regf    reg10   reg11*/
-       0x21,   0x00,   0x00,   0x00,   0x00,   0x00,   0x00,   0x03,   0x00,
-/*     reg12   reg13   reg14   reg15   reg16   reg17   reg18   reg19   reg1a*/
-       0x01,   0x01,   0x14,   0x28,   0x1e,   0x00,   0x07,   0x00,   0x00,
-/*     reg1b   reg1c   reg1d   reg1e   reg1f   reg20   reg21   reg22   reg23*/
-       0x00,   0x00,   0x00,   0x00,   0x00,   0x00,   0x00,   0x00,   0x00
+/*     reg0    reg1    reg2    reg3    reg4    reg5    reg6    reg7 */
+       0x00,   0x61,   0x40,   0x00,   0x1a,   0x20,   0x20,   0x20,
+/*     reg8    reg9    rega    regb    regc    regd    rege    regf */
+       0x81,   0x21,   0x07,   0x00,   0x00,   0x00,   0x00,   0x10,
+/*     reg10   reg11   reg12   reg13   reg14   reg15   reg16   reg17 */
+       0x03,   0x00,   0x01,   0x01,   0x08,   0x28,   0x1e,   0x20,
+/*     reg18   reg19   reg1a   reg1b   reg1c   reg1d   reg1e   reg1f */
+       0x07,   0x00,   0x00,   0x00,   0x00,   0x00,   0x00,   0x00,
 };
 
 /* sequence specific to the sensors - !! index = SENSOR_xxx */
@@ -212,10 +215,6 @@ static const __u8 regsn20[] = {
        0x00, 0x2d, 0x46, 0x5a, 0x6c, 0x7c, 0x8b, 0x99,
        0xa6, 0xb2, 0xbf, 0xca, 0xd5, 0xe0, 0xeb, 0xf5, 0xff
 };
-static const __u8 regsn20_sn9c120[] = {
-       0x00, 0x25, 0x3c, 0x50, 0x62, 0x72, 0x81, 0x90,
-       0x9e, 0xab, 0xb8, 0xc5, 0xd1, 0xdd, 0xe9, 0xf4, 0xff
-};
 static const __u8 regsn20_sn9c325[] = {
        0x0a, 0x3a, 0x56, 0x6c, 0x7e, 0x8d, 0x9a, 0xa4,
        0xaf, 0xbb, 0xc5, 0xcd, 0xd5, 0xde, 0xe8, 0xed, 0xf5
@@ -227,21 +226,6 @@ static const __u8 reg84[] = {
 /*     0x00, 0x00, 0x00, 0x00, 0x00 */
        0xf7, 0x0f, 0x0a, 0x00, 0x00
 };
-static const __u8 reg84_sn9c120_1[] = {
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-       0x00, 0x00, 0x0c, 0x00, 0x00
-};
-static const __u8 reg84_sn9c120_2[] = {
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-       0x00, 0x00, 0x0c, 0x02, 0x3b
-};
-static const __u8 reg84_sn9c120_3[] = {
-       0x14, 0x00, 0x27, 0x00, 0x08, 0x00, 0xeb, 0x0f,
-       0xd5, 0x0f, 0x42, 0x00, 0x41, 0x00, 0xca, 0x0f,
-       0xf5, 0x0f, 0x0c, 0x02, 0x3b
-};
 static const __u8 reg84_sn9c325[] = {
        0x14, 0x00, 0x27, 0x00, 0x07, 0x00, 0xe4, 0x0f,
        0xd3, 0x0f, 0x4b, 0x00, 0x48, 0x00, 0xc0, 0x0f,
@@ -360,17 +344,15 @@ static const __u8 ov7660_sensor_init[][8] = {
        {0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, /* reset SCCB */
 /*             (delay 20ms) */
        {0xa1, 0x21, 0x12, 0x05, 0x00, 0x00, 0x00, 0x10},
-                                               /* Outformat ?? rawRGB */
+                                               /* Outformat = rawRGB */
        {0xa1, 0x21, 0x13, 0xb8, 0x00, 0x00, 0x00, 0x10}, /* init COM8 */
-       {0xd1, 0x21, 0x00, 0x01, 0x74, 0x92, 0x00, 0x10},
-/*     {0xd1, 0x21, 0x00, 0x01, 0x74, 0x74, 0x00, 0x10}, */
+       {0xd1, 0x21, 0x00, 0x01, 0x74, 0x74, 0x00, 0x10},
                                                /* GAIN BLUE RED VREF */
        {0xd1, 0x21, 0x04, 0x00, 0x7d, 0x62, 0x00, 0x10},
                                                /* COM 1 BAVE GEAVE AECHH */
        {0xb1, 0x21, 0x08, 0x83, 0x01, 0x00, 0x00, 0x10}, /* RAVE COM2 */
        {0xd1, 0x21, 0x0c, 0x00, 0x08, 0x04, 0x4f, 0x10}, /* COM 3 4 5 6 */
-       {0xd1, 0x21, 0x10, 0x7f, 0x40, 0x05, 0xf8, 0x10},
-/*     {0xd1, 0x21, 0x10, 0x7f, 0x40, 0x05, 0xff, 0x10}, */
+       {0xd1, 0x21, 0x10, 0x7f, 0x40, 0x05, 0xff, 0x10},
                                                /* AECH CLKRC COM7 COM8 */
        {0xc1, 0x21, 0x14, 0x2c, 0x00, 0x02, 0x00, 0x10}, /* COM9 COM10 */
        {0xd1, 0x21, 0x17, 0x10, 0x60, 0x02, 0x7b, 0x10},
@@ -379,8 +361,8 @@ static const __u8 ov7660_sensor_init[][8] = {
        {0xb1, 0x21, 0x1e, 0x01, 0x0e, 0x00, 0x00, 0x10}, /* MVFP LAEC */
        {0xd1, 0x21, 0x20, 0x07, 0x07, 0x07, 0x07, 0x10},
                                        /* BOS GBOS GROS ROS (BGGR offset) */
-       {0xd1, 0x21, 0x24, 0x68, 0x58, 0xd4, 0x80, 0x10},
-/*     {0xd1, 0x21, 0x24, 0x78, 0x68, 0xd4, 0x80, 0x10}, */
+/*     {0xd1, 0x21, 0x24, 0x68, 0x58, 0xd4, 0x80, 0x10}, */
+       {0xd1, 0x21, 0x24, 0x78, 0x68, 0xd4, 0x80, 0x10},
                                                /* AEW AEB VPT BBIAS */
        {0xd1, 0x21, 0x28, 0x80, 0x30, 0x00, 0x00, 0x10},
                                                /* GbBIAS RSVD EXHCH EXHCL */
@@ -407,9 +389,9 @@ static const __u8 ov7660_sensor_init[][8] = {
        {0xd1, 0x21, 0x62, 0x00, 0x00, 0x50, 0x30, 0x10},
                                                /* LCC1 LCC2 LCC3 LCC4 */
        {0xa1, 0x21, 0x66, 0x00, 0x00, 0x00, 0x00, 0x10}, /* LCC5 */
-       {0xd1, 0x21, 0x67, 0x80, 0x7a, 0x90, 0x80, 0x10},
+       {0xd1, 0x21, 0x67, 0x80, 0x7a, 0x90, 0x80, 0x10}, /* MANU */
        {0xa1, 0x21, 0x6b, 0x0a, 0x00, 0x00, 0x00, 0x10},
-                                       /* band gap reference [0..3] DBLV */
+                                       /* band gap reference [0:3] DBLV */
        {0xd1, 0x21, 0x6c, 0x30, 0x48, 0x80, 0x74, 0x10}, /* gamma curve */
        {0xd1, 0x21, 0x70, 0x64, 0x60, 0x5c, 0x58, 0x10}, /* gamma curve */
        {0xd1, 0x21, 0x74, 0x54, 0x4c, 0x40, 0x38, 0x10}, /* gamma curve */
@@ -419,37 +401,35 @@ static const __u8 ov7660_sensor_init[][8] = {
        {0xd1, 0x21, 0x84, 0x6e, 0x77, 0x87, 0x95, 0x10}, /* gamma curve */
        {0xc1, 0x21, 0x88, 0xaf, 0xc7, 0xdf, 0x00, 0x10}, /* gamma curve */
        {0xc1, 0x21, 0x8b, 0x99, 0x99, 0xcf, 0x00, 0x10}, /* reserved */
-       {0xb1, 0x21, 0x92, 0x00, 0x00, 0x00, 0x00, 0x10},
+       {0xb1, 0x21, 0x92, 0x00, 0x00, 0x00, 0x00, 0x10}, /* DM_LNL/H */
 /****** (some exchanges in the win trace) ******/
-       {0xa1, 0x21, 0x1e, 0x01, 0x00, 0x00, 0x00, 0x10},
+       {0xa1, 0x21, 0x1e, 0x01, 0x00, 0x00, 0x00, 0x10}, /* MVFP */
                                                /* bits[3..0]reserved */
        {0xa1, 0x21, 0x1e, 0x01, 0x00, 0x00, 0x00, 0x10},
        {0xa1, 0x21, 0x03, 0x00, 0x00, 0x00, 0x00, 0x10},
                                                /* VREF vertical frame ctrl */
        {0xa1, 0x21, 0x03, 0x00, 0x00, 0x00, 0x00, 0x10},
-       {0xa1, 0x21, 0x10, 0x20, 0x00, 0x00, 0x00, 0x10}, /* 0x20 */
-       {0xa1, 0x21, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x10},
-       {0xa1, 0x21, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x10},
-/*     {0xa1, 0x21, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x10}, */
-       {0xa1, 0x21, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x10},
-       {0xb1, 0x21, 0x01, 0x78, 0x78, 0x00, 0x00, 0x10},
+       {0xa1, 0x21, 0x10, 0x20, 0x00, 0x00, 0x00, 0x10}, /* AECH 0x20 */
+       {0xa1, 0x21, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x10}, /* ADVFL */
+       {0xa1, 0x21, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x10}, /* ADVFH */
+       {0xa1, 0x21, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x10}, /* GAIN */
+/*     {0xb1, 0x21, 0x01, 0x78, 0x78, 0x00, 0x00, 0x10}, * BLUE */
 /****** (some exchanges in the win trace) ******/
        {0xa1, 0x21, 0x93, 0x00, 0x00, 0x00, 0x00, 0x10},/* dummy line hight */
-       {0xa1, 0x21, 0x92, 0x25, 0x00, 0x00, 0x00, 0x10},/* dummy line low */
-       {0xa1, 0x21, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x10},
-       {0xa1, 0x21, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x10},
-       {0xa1, 0x21, 0x02, 0x90, 0x00, 0x00, 0x00, 0x10},
+       {0xa1, 0x21, 0x92, 0x25, 0x00, 0x00, 0x00, 0x10}, /* dummy line low */
+       {0xa1, 0x21, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x10}, /* EXHCH */
+       {0xa1, 0x21, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x10}, /* EXHCL */
+/*     {0xa1, 0x21, 0x02, 0x90, 0x00, 0x00, 0x00, 0x10},  * RED */
 /****** (some exchanges in the win trace) ******/
-/**********startsensor KO if changed !!****/
+/******!! startsensor KO if changed !!****/
        {0xa1, 0x21, 0x93, 0x01, 0x00, 0x00, 0x00, 0x10},
        {0xa1, 0x21, 0x92, 0xff, 0x00, 0x00, 0x00, 0x10},
        {0xa1, 0x21, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x10},
        {0xa1, 0x21, 0x2b, 0xc3, 0x00, 0x00, 0x00, 0x10},
-/* here may start the isoc exchanges */
        {}
 };
-/* reg0x04             reg0x07         reg 0x10 */
-/* expo  = (COM1 & 0x02) | (AECHH & 0x2f <<10) [ (AECh << 2) */
+/*       reg 0x04        reg 0x07                 reg 0x10 */
+/* expo = (COM1 & 0x02) | ((AECHH & 0x2f) << 10) | (AECh << 2) */
 
 static const __u8 ov7648_sensor_init[][8] = {
        {0xC1, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00},
@@ -680,13 +660,12 @@ static int configure_gpio(struct gspca_dev *gspca_dev,
        const __u8 *reg9a;
        static const __u8 reg9a_def[] =
                {0x08, 0x40, 0x20, 0x10, 0x00, 0x04};
-       static const __u8 reg9a_sn9c120[] =             /* from win trace */
-               {0x00, 0x40, 0x38, 0x30, 0x00, 0x20};
        static const __u8 reg9a_sn9c325[] =
                {0x0a, 0x40, 0x38, 0x30, 0x00, 0x20};
+       static const __u8 regd4[] = {0x60, 0x00, 0x00};
 
        reg_w1(gspca_dev, 0xf1, 0x00);
-       reg_w1(gspca_dev, 0x01, sn9c1xx[0]);    /*fixme:jfm was [1] en v1*/
+       reg_w1(gspca_dev, 0x01, 0x00);          /*jfm was sn9c1xx[1] in v1*/
 
        /* configure gpio */
        reg_w(gspca_dev, 0x01, &sn9c1xx[1], 2);
@@ -696,25 +675,17 @@ static int configure_gpio(struct gspca_dev *gspca_dev,
        case BRIDGE_SN9C325:
                reg9a = reg9a_sn9c325;
                break;
-       case BRIDGE_SN9C120:
-               reg9a = reg9a_sn9c120;
-               break;
        default:
                reg9a = reg9a_def;
                break;
        }
        reg_w(gspca_dev, 0x9a, reg9a, 6);
 
-       reg_w1(gspca_dev, 0xd4, 0x60);  /*fixme:jfm 60 00 00 (3) ? */
+       reg_w(gspca_dev, 0xd4, regd4, sizeof regd4); /*fixme:jfm was 60 only*/
 
        reg_w(gspca_dev, 0x03, &sn9c1xx[3], 0x0f);
 
        switch (sd->bridge) {
-       case BRIDGE_SN9C120:                    /* from win trace */
-               reg_w1(gspca_dev, 0x01, 0x61);
-               reg_w1(gspca_dev, 0x17, 0x20);
-               reg_w1(gspca_dev, 0x01, 0x60);
-               break;
        case BRIDGE_SN9C325:
                reg_w1(gspca_dev, 0x01, 0x43);
                reg_w1(gspca_dev, 0x17, 0xae);
@@ -810,6 +781,8 @@ static int sd_config(struct gspca_dev *gspca_dev,
        sd->contrast = CONTRAST_DEF;
        sd->colors = COLOR_DEF;
        sd->autogain = AUTOGAIN_DEF;
+       sd->ag_cnt = -1;
+
        return 0;
 }
 
@@ -823,10 +796,11 @@ static int sd_open(struct gspca_dev *gspca_dev)
 
        /* setup a selector by bridge */
        reg_w1(gspca_dev, 0xf1, 0x01);
-       reg_r(gspca_dev, 0x00, 1);              /* -> regF1 = 0x00 */
-       reg_w1(gspca_dev, 0xf1, gspca_dev->usb_buf[0]);
        reg_r(gspca_dev, 0x00, 1);
+       reg_w1(gspca_dev, 0xf1, gspca_dev->usb_buf[0]);
+       reg_r(gspca_dev, 0x00, 1);              /* get sonix chip id */
        regF1 = gspca_dev->usb_buf[0];
+       PDEBUG(D_PROBE, "Sonix chip id: %02x", regF1);
        switch (sd->bridge) {
        case BRIDGE_SN9C102P:
                if (regF1 != 0x11)
@@ -937,15 +911,10 @@ static void setbrightness(struct gspca_dev *gspca_dev)
                sd->exposure = setexposure(gspca_dev, expo);
                break;
        case SENSOR_MI0360:
-               expo = sd->brightness >> 4;
-               sd->exposure = setexposure(gspca_dev, expo);
-               break;
        case SENSOR_MO4000:
                expo = sd->brightness >> 4;
                sd->exposure = setexposure(gspca_dev, expo);
                break;
-       case SENSOR_OV7660:
-               return;                         /*jfm??*/
        }
 
        k2 = sd->brightness >> 10;
@@ -958,8 +927,6 @@ static void setcontrast(struct gspca_dev *gspca_dev)
        __u8 k2;
        __u8 contrast[] = { 0x00, 0x00, 0x28, 0x00, 0x07, 0x00 };
 
-       if (sd->sensor == SENSOR_OV7660)
-               return;                         /*jfm??*/
        k2 = sd->contrast;
        contrast[2] = k2;
        contrast[0] = (k2 + 1) >> 1;
@@ -981,20 +948,32 @@ static void setcolors(struct gspca_dev *gspca_dev)
        reg_w1(gspca_dev, 0x05, data);
 }
 
+static void setautogain(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       switch (sd->sensor) {
+       case SENSOR_HV7131R:
+       case SENSOR_MO4000:
+       case SENSOR_MI0360:
+               if (sd->autogain)
+                       sd->ag_cnt = AG_CNT_START;
+               else
+                       sd->ag_cnt = -1;
+               break;
+       }
+}
+
 /* -- start the camera -- */
 static void sd_start(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
        int i;
-       __u8 data;
-       __u8 reg1;
-       __u8 reg17;
+       __u8 reg1, reg17, reg18;
        const __u8 *sn9c1xx;
        int mode;
        static const __u8 C0[] = { 0x2d, 0x2d, 0x3a, 0x05, 0x04, 0x3f };
        static const __u8 CA[] = { 0x28, 0xd8, 0x14, 0xec };
-       static const __u8 CA_sn9c120[] =
-                                { 0x14, 0xec, 0x0a, 0xf6 };    /* SN9C120 */
        static const __u8 CE[] = { 0x32, 0xdd, 0x2d, 0xdd };    /* MI0360 */
        static const __u8 CE_sn9c325[] =
                        { 0x32, 0xdd, 0x32, 0xdd };     /* OV7648 - SN9C325 */
@@ -1002,9 +981,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
        sn9c1xx = sn_tb[(int) sd->sensor];
        configure_gpio(gspca_dev, sn9c1xx);
 
-/*fixme:jfm this sequence should appear at end of sd_start */
-/* with
-       reg_w1(gspca_dev, 0x01, 0x44); */
+/*     reg_w1(gspca_dev, 0x01, 0x44);          jfm from win trace*/
        reg_w1(gspca_dev, 0x15, sn9c1xx[0x15]);
        reg_w1(gspca_dev, 0x16, sn9c1xx[0x16]);
        reg_w1(gspca_dev, 0x12, sn9c1xx[0x12]);
@@ -1016,20 +993,16 @@ static void sd_start(struct gspca_dev *gspca_dev)
        reg_w1(gspca_dev, 0xc7, 0x00);
        reg_w1(gspca_dev, 0xc8, 0x50);
        reg_w1(gspca_dev, 0xc9, 0x3c);
-/*fixme:jfm end of ending sequence */
        reg_w1(gspca_dev, 0x18, sn9c1xx[0x18]);
        switch (sd->bridge) {
        case BRIDGE_SN9C325:
-               data = 0xae;
-               break;
-       case BRIDGE_SN9C120:
-               data = 0xa0;
+               reg17 = 0xae;
                break;
        default:
-               data = 0x60;
+               reg17 = 0x60;
                break;
        }
-       reg_w1(gspca_dev, 0x17, data);
+       reg_w1(gspca_dev, 0x17, reg17);
        reg_w1(gspca_dev, 0x05, sn9c1xx[5]);
        reg_w1(gspca_dev, 0x07, sn9c1xx[7]);
        reg_w1(gspca_dev, 0x06, sn9c1xx[6]);
@@ -1044,20 +1017,6 @@ static void sd_start(struct gspca_dev *gspca_dev)
                reg_w1(gspca_dev, 0x9a, 0x0a);
                reg_w1(gspca_dev, 0x99, 0x60);
                break;
-       case BRIDGE_SN9C120:
-               reg_w(gspca_dev, 0x20, regsn20_sn9c120,
-                               sizeof regsn20_sn9c120);
-               for (i = 0; i < 2; i++)
-                       reg_w(gspca_dev, 0x84, reg84_sn9c120_1,
-                                       sizeof reg84_sn9c120_1);
-               for (i = 0; i < 6; i++)
-                       reg_w(gspca_dev, 0x84, reg84_sn9c120_2,
-                                       sizeof reg84_sn9c120_2);
-               reg_w(gspca_dev, 0x84, reg84_sn9c120_3,
-                               sizeof reg84_sn9c120_3);
-               reg_w1(gspca_dev, 0x9a, 0x05);
-               reg_w1(gspca_dev, 0x99, 0x5b);
-               break;
        default:
                reg_w(gspca_dev, 0x20, regsn20, sizeof regsn20);
                for (i = 0; i < 8; i++)
@@ -1107,22 +1066,14 @@ static void sd_start(struct gspca_dev *gspca_dev)
 /*                     reg1 = 0x44; */
 /*                     reg1 = 0x46;    (done) */
                } else {
-                       reg17 = 0xa2;   /* 640 */
-                       reg1 = 0x40;
+                       reg17 = 0x22;   /* 640 MCKSIZE */
+                       reg1 = 0x06;
                }
                break;
        }
        reg_w(gspca_dev, 0xc0, C0, 6);
+       reg_w(gspca_dev, 0xca, CA, 4);
        switch (sd->bridge) {
-       case BRIDGE_SN9C120:                    /*jfm ?? */
-               reg_w(gspca_dev, 0xca, CA_sn9c120, 4);
-               break;
-       default:
-               reg_w(gspca_dev, 0xca, CA, 4);
-               break;
-       }
-       switch (sd->bridge) {
-       case BRIDGE_SN9C120:                    /*jfm ?? */
        case BRIDGE_SN9C325:
                reg_w(gspca_dev, 0xce, CE_sn9c325, 4);
                break;
@@ -1133,19 +1084,19 @@ static void sd_start(struct gspca_dev *gspca_dev)
        }
 
        /* here change size mode 0 -> VGA; 1 -> CIF */
-       data = 0x40 | sn9c1xx[0x18] | (mode << 4);
-       reg_w1(gspca_dev, 0x18, data);
+       reg18 = sn9c1xx[0x18] | (mode << 4);
+       reg_w1(gspca_dev, 0x18, reg18 | 0x40);
 
        reg_w(gspca_dev, 0x100, qtable4, 0x40);
        reg_w(gspca_dev, 0x140, qtable4 + 0x40, 0x40);
 
-       data = sn9c1xx[0x18] | (mode << 4);
-       reg_w1(gspca_dev, 0x18, data);
+       reg_w1(gspca_dev, 0x18, reg18);
 
        reg_w1(gspca_dev, 0x17, reg17);
        reg_w1(gspca_dev, 0x01, reg1);
        setbrightness(gspca_dev);
        setcontrast(gspca_dev);
+       setautogain(gspca_dev);
 }
 
 static void sd_stopN(struct gspca_dev *gspca_dev)
@@ -1168,12 +1119,11 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
                i2c_w8(gspca_dev, stopmi0360);
                data = 0x29;
                break;
-       case SENSOR_MO4000:
-               break;
        case SENSOR_OV7648:
                data = 0x29;
                break;
        default:
+/*     case SENSOR_MO4000: */
 /*     case SENSOR_OV7660: */
                break;
        }
@@ -1193,16 +1143,23 @@ static void sd_close(struct gspca_dev *gspca_dev)
 {
 }
 
-static void setautogain(struct gspca_dev *gspca_dev)
+static void do_autogain(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
-       /* Thanks S., without your advice, autobright should not work :) */
        int delta;
-       int expotimes = 0;
+       int expotimes;
        __u8 luma_mean = 130;
        __u8 luma_delta = 20;
 
-       delta = sd->avg_lum;
+       /* Thanks S., without your advice, autobright should not work :) */
+       if (sd->ag_cnt < 0)
+               return;
+       if (--sd->ag_cnt >= 0)
+               return;
+       sd->ag_cnt = AG_CNT_START;
+
+       delta = atomic_read(&sd->avg_lum);
+       PDEBUG(D_FRAM, "mean lum %d", delta);
        if (delta < luma_mean - luma_delta ||
            delta > luma_mean + luma_delta) {
                switch (sd->sensor) {
@@ -1214,8 +1171,9 @@ static void setautogain(struct gspca_dev *gspca_dev)
                        sd->exposure = setexposure(gspca_dev,
                                        (unsigned int) (expotimes << 8));
                        break;
-               case SENSOR_MO4000:
-               case SENSOR_MI0360:
+               default:
+/*             case SENSOR_MO4000: */
+/*             case SENSOR_MI0360: */
                        expotimes = sd->exposure;
                        expotimes += (luma_mean - delta) >> 6;
                        if (expotimes < 0)
@@ -1228,6 +1186,8 @@ static void setautogain(struct gspca_dev *gspca_dev)
        }
 }
 
+/* scan the URB packets */
+/* This function is run at interrupt level. */
 static void sd_pkt_scan(struct gspca_dev *gspca_dev,
                        struct gspca_frame *frame,      /* target */
                        __u8 *data,                     /* isoc packet */
@@ -1244,9 +1204,6 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
                                frame, data, sof + 2);
                if (sd->ag_cnt < 0)
                        return;
-               if (--sd->ag_cnt >= 0)
-                       return;
-               sd->ag_cnt = AG_CNT_START;
 /* w1 w2 w3 */
 /* w4 w5 w6 */
 /* w7 w8 */
@@ -1261,9 +1218,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
 /* w5 */
                avg_lum += ((data[sof + 31] << 8) | data[sof + 32]) >> 4;
                avg_lum >>= 4;
-               sd->avg_lum = avg_lum;
-               PDEBUG(D_PACK, "mean lum %d", avg_lum);
-               setautogain(gspca_dev);
+               atomic_set(&sd->avg_lum, avg_lum);
                return;
        }
        if (gspca_dev->last_packet_type == LAST_PACKET) {
@@ -1300,6 +1255,7 @@ static unsigned int getexposure(struct gspca_dev *gspca_dev)
                        (hexpo << 10) | (mexpo << 2) | lexpo);
                return (hexpo << 10) | (mexpo << 2) | lexpo;
        default:
+/*     case SENSOR_OV7648:             * jfm: is it ok for 7648? */
 /*     case SENSOR_OV7660: */
                /* read sensor exposure */
                i2c_r5(gspca_dev, 0x04);
@@ -1318,14 +1274,12 @@ static void getbrightness(struct gspca_dev *gspca_dev)
        /* hardcoded registers seem not readable */
        switch (sd->sensor) {
        case SENSOR_HV7131R:
-/*             sd->brightness = 0x7fff; */
                sd->brightness = getexposure(gspca_dev) >> 4;
                break;
        case SENSOR_MI0360:
                sd->brightness = getexposure(gspca_dev) << 4;
                break;
        case SENSOR_MO4000:
-/*             sd->brightness = 0x1fff; */
                sd->brightness = getexposure(gspca_dev) << 4;
                break;
        }
@@ -1391,10 +1345,8 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val)
        struct sd *sd = (struct sd *) gspca_dev;
 
        sd->autogain = val;
-       if (val)
-               sd->ag_cnt = AG_CNT_START;
-       else
-               sd->ag_cnt = -1;
+       if (gspca_dev->streaming)
+               setautogain(gspca_dev);
        return 0;
 }
 
@@ -1418,6 +1370,7 @@ static const struct sd_desc sd_desc = {
        .stop0 = sd_stop0,
        .close = sd_close,
        .pkt_scan = sd_pkt_scan,
+       .dq_callback = do_autogain,
 };
 
 /* -- module initialisation -- */
index 3c2be80..eda29d6 100644 (file)
@@ -61,27 +61,27 @@ static struct ctrl sd_ctrls[] = {
 
 static struct v4l2_pix_format vga_mode[] = {
        {160, 120, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
-               .bytesperline = 160 * 3,
+               .bytesperline = 160,
                .sizeimage = 160 * 120 * 3 / 2,
                .colorspace = V4L2_COLORSPACE_SRGB,
                .priv = 5},
        {176, 144, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
-               .bytesperline = 176 * 3,
+               .bytesperline = 176,
                .sizeimage = 176 * 144 * 3 / 2,
                .colorspace = V4L2_COLORSPACE_SRGB,
                .priv = 4},
        {320, 240, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
-               .bytesperline = 320 * 3,
+               .bytesperline = 320,
                .sizeimage = 320 * 240 * 3 / 2,
                .colorspace = V4L2_COLORSPACE_SRGB,
                .priv = 2},
        {352, 288, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
-               .bytesperline = 352 * 3,
+               .bytesperline = 352,
                .sizeimage = 352 * 288 * 3 / 2,
                .colorspace = V4L2_COLORSPACE_SRGB,
                .priv = 1},
        {640, 480, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
-               .bytesperline = 640 * 3,
+               .bytesperline = 640,
                .sizeimage = 640 * 480 * 3 / 2,
                .colorspace = V4L2_COLORSPACE_SRGB,
                .priv = 0},
@@ -776,7 +776,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
        default:
                data += 1;
                len -= 1;
-               gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
+               gspca_frame_add(gspca_dev, INTER_PACKET, frame,
                                data, len);
                break;
        }
index 6fe715c..f622fa7 100644 (file)
@@ -112,27 +112,27 @@ static struct ctrl sd_ctrls[] = {
 
 static struct v4l2_pix_format vga_mode[] = {
        {160, 120, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
-               .bytesperline = 160 * 3,
+               .bytesperline = 160,
                .sizeimage = 160 * 120 * 3 / 2,
                .colorspace = V4L2_COLORSPACE_SRGB,
                .priv = 5},
        {176, 144, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
-               .bytesperline = 176 * 3,
+               .bytesperline = 176,
                .sizeimage = 176 * 144 * 3 / 2,
                .colorspace = V4L2_COLORSPACE_SRGB,
                .priv = 4},
        {320, 240, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
-               .bytesperline = 320 * 3,
+               .bytesperline = 320,
                .sizeimage = 320 * 240 * 3 / 2,
                .colorspace = V4L2_COLORSPACE_SRGB,
                .priv = 2},
        {352, 288, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
-               .bytesperline = 352 * 3,
+               .bytesperline = 352,
                .sizeimage = 352 * 288 * 3 / 2,
                .colorspace = V4L2_COLORSPACE_SRGB,
                .priv = 1},
        {640, 480, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
-               .bytesperline = 640 * 3,
+               .bytesperline = 640,
                .sizeimage = 640 * 480 * 3 / 2,
                .colorspace = V4L2_COLORSPACE_SRGB,
                .priv = 0},
@@ -588,7 +588,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
        default:
                data += 1;
                len -= 1;
-               gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
+               gspca_frame_add(gspca_dev, INTER_PACKET, frame,
                                data, len);
                break;
        }
index b608a27..699340c 100644 (file)
@@ -63,23 +63,23 @@ static struct ctrl sd_ctrls[] = {
 };
 
 static struct v4l2_pix_format sif_mode[] = {
-       {160, 120, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
-               .bytesperline = 160 * 3,
+       {160, 120, V4L2_PIX_FMT_SPCA508, V4L2_FIELD_NONE,
+               .bytesperline = 160,
                .sizeimage = 160 * 120 * 3 / 2,
                .colorspace = V4L2_COLORSPACE_SRGB,
                .priv = 3},
-       {176, 144, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
-               .bytesperline = 176 * 3,
+       {176, 144, V4L2_PIX_FMT_SPCA508, V4L2_FIELD_NONE,
+               .bytesperline = 176,
                .sizeimage = 176 * 144 * 3 / 2,
                .colorspace = V4L2_COLORSPACE_SRGB,
                .priv = 2},
-       {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
-               .bytesperline = 320 * 3,
+       {320, 240, V4L2_PIX_FMT_SPCA508, V4L2_FIELD_NONE,
+               .bytesperline = 320,
                .sizeimage = 320 * 240 * 3 / 2,
                .colorspace = V4L2_COLORSPACE_SRGB,
                .priv = 1},
-       {352, 288, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
-               .bytesperline = 352 * 3,
+       {352, 288, V4L2_PIX_FMT_SPCA508, V4L2_FIELD_NONE,
+               .bytesperline = 352,
                .sizeimage = 352 * 288 * 3 / 2,
                .colorspace = V4L2_COLORSPACE_SRGB,
                .priv = 0},
@@ -1583,7 +1583,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
        default:
                data += 1;
                len -= 1;
-               gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
+               gspca_frame_add(gspca_dev, INTER_PACKET, frame,
                                data, len);
                break;
        }
index a261745..1073ac3 100644 (file)
@@ -644,6 +644,18 @@ static void setcontrast(struct gspca_dev *gspca_dev)
        }
 }
 
+static void setautogain(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       if (sd->chip_revision == Rev072A) {
+               if (sd->autogain)
+                       sd->ag_cnt = AG_CNT_START;
+               else
+                       sd->ag_cnt = -1;
+       }
+}
+
 static void sd_start(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
@@ -671,6 +683,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
                reg_w_val(dev, 0x8500, mode);   /* mode */
                reg_w_val(dev, 0x8700, Clck);   /* 0x27 clock */
                reg_w_val(dev, 0x8112, 0x10 | 0x20);
+               setautogain(gspca_dev);
                break;
        default:
 /*     case Rev012A: */
@@ -720,18 +733,24 @@ static void sd_close(struct gspca_dev *gspca_dev)
        reg_w_val(gspca_dev->dev, 0x8114, 0);
 }
 
-static void setautogain(struct gspca_dev *gspca_dev)
+static void do_autogain(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
-       int expotimes = 0;
-       int pixelclk = 0;
-       int gainG = 0;
+       int expotimes;
+       int pixelclk;
+       int gainG;
        __u8 R, Gr, Gb, B;
        int y;
        __u8 luma_mean = 110;
        __u8 luma_delta = 20;
        __u8 spring = 4;
 
+       if (sd->ag_cnt < 0)
+               return;
+       if (--sd->ag_cnt >= 0)
+               return;
+       sd->ag_cnt = AG_CNT_START;
+
        switch (sd->chip_revision) {
        case Rev072A:
                reg_r(gspca_dev, 0x8621, 1);
@@ -795,18 +814,10 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
                        __u8 *data,             /* isoc packet */
                        int len)                /* iso packet length */
 {
-       struct sd *sd = (struct sd *) gspca_dev;
-
        switch (data[0]) {
        case 0:         /* start of frame */
                frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame,
                                        data, 0);
-               if (sd->ag_cnt >= 0) {
-                       if (--sd->ag_cnt < 0) {
-                               sd->ag_cnt = AG_CNT_START;
-                               setautogain(gspca_dev);
-                       }
-               }
                data += SPCA561_OFFSET_DATA;
                len -= SPCA561_OFFSET_DATA;
                if (data[1] & 0x10) {
@@ -944,10 +955,8 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val)
        struct sd *sd = (struct sd *) gspca_dev;
 
        sd->autogain = val;
-       if (val)
-               sd->ag_cnt = AG_CNT_START;
-       else
-               sd->ag_cnt = -1;
+       if (gspca_dev->streaming)
+               setautogain(gspca_dev);
        return 0;
 }
 
@@ -971,6 +980,7 @@ static const struct sd_desc sd_desc = {
        .stop0 = sd_stop0,
        .close = sd_close,
        .pkt_scan = sd_pkt_scan,
+       .dq_callback = do_autogain,
 };
 
 /* -- module initialisation -- */
index a422175..f4a5295 100644 (file)
@@ -88,12 +88,12 @@ static struct ctrl sd_ctrls[] = {
 
 static struct v4l2_pix_format vc0321_mode[] = {
        {320, 240, V4L2_PIX_FMT_YUV420, V4L2_FIELD_NONE,
-               .bytesperline = 320 * 2,
+               .bytesperline = 320,
                .sizeimage = 320 * 240 * 2,
                .colorspace = V4L2_COLORSPACE_SRGB,
                .priv = 1},
        {640, 480, V4L2_PIX_FMT_YUV420, V4L2_FIELD_NONE,
-               .bytesperline = 640 * 2,
+               .bytesperline = 640,
                .sizeimage = 640 * 480 * 2,
                .colorspace = V4L2_COLORSPACE_SRGB,
                .priv = 0},
index 22a994c..bc7d0ee 100644 (file)
@@ -6469,7 +6469,7 @@ static void setcontrast(struct gspca_dev *gspca_dev)
                NULL, Tgradient_1, Tgradient_2,
                Tgradient_3, Tgradient_4, Tgradient_5, Tgradient_6
        };
-#ifdef CONFIG_VIDEO_ADV_DEBUG
+#ifdef GSPCA_DEBUG
        __u8 v[16];
 #endif
 
@@ -6487,7 +6487,7 @@ static void setcontrast(struct gspca_dev *gspca_dev)
                else if (g <= 0)
                        g = 1;
                reg_w(dev, g, 0x0120 + i);      /* gamma */
-#ifdef CONFIG_VIDEO_ADV_DEBUG
+#ifdef GSPCA_DEBUG
                if (gspca_debug & D_CONF)
                        v[i] = g;
 #endif
@@ -6507,7 +6507,7 @@ static void setcontrast(struct gspca_dev *gspca_dev)
                                g = 1;
                }
                reg_w(dev, g, 0x0130 + i);      /* gradient */
-#ifdef CONFIG_VIDEO_ADV_DEBUG
+#ifdef GSPCA_DEBUG
                if (gspca_debug & D_CONF)
                        v[i] = g;
 #endif
index b31ba4e..56808cd 100644 (file)
@@ -25,7 +25,7 @@
 
 static char *sensor_type;
 module_param(sensor_type, charp, S_IRUGO);
-MODULE_PARM_DESC(sensor_type, "Sensor type: \"colour\" or \"monochrome\"\n");
+MODULE_PARM_DESC(sensor_type, "Sensor type: \"colour\" or \"monochrome\"");
 
 /* mt9v022 selected register addresses */
 #define MT9V022_CHIP_VERSION           0x00
diff --git a/drivers/media/video/planb.c b/drivers/media/video/planb.c
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/drivers/media/video/planb.h b/drivers/media/video/planb.h
deleted file mode 100644 (file)
index e69de29..0000000
index b15f82c..ead87dd 100644 (file)
@@ -128,6 +128,8 @@ struct pxa_camera_dev {
 
        struct pxa_buffer       *active;
        struct pxa_dma_desc     *sg_tail[3];
+
+       u32                     save_cicr[5];
 };
 
 static const char *pxa_cam_driver_description = "PXA_Camera";
@@ -997,10 +999,64 @@ static int pxa_camera_querycap(struct soc_camera_host *ici,
        return 0;
 }
 
+static int pxa_camera_suspend(struct soc_camera_device *icd, pm_message_t state)
+{
+       struct soc_camera_host *ici =
+               to_soc_camera_host(icd->dev.parent);
+       struct pxa_camera_dev *pcdev = ici->priv;
+       int i = 0, ret = 0;
+
+       pcdev->save_cicr[i++] = CICR0;
+       pcdev->save_cicr[i++] = CICR1;
+       pcdev->save_cicr[i++] = CICR2;
+       pcdev->save_cicr[i++] = CICR3;
+       pcdev->save_cicr[i++] = CICR4;
+
+       if ((pcdev->icd) && (pcdev->icd->ops->suspend))
+               ret = pcdev->icd->ops->suspend(pcdev->icd, state);
+
+       return ret;
+}
+
+static int pxa_camera_resume(struct soc_camera_device *icd)
+{
+       struct soc_camera_host *ici =
+               to_soc_camera_host(icd->dev.parent);
+       struct pxa_camera_dev *pcdev = ici->priv;
+       int i = 0, ret = 0;
+
+       DRCMR68 = pcdev->dma_chans[0] | DRCMR_MAPVLD;
+       DRCMR69 = pcdev->dma_chans[1] | DRCMR_MAPVLD;
+       DRCMR70 = pcdev->dma_chans[2] | DRCMR_MAPVLD;
+
+       CICR0 = pcdev->save_cicr[i++] & ~CICR0_ENB;
+       CICR1 = pcdev->save_cicr[i++];
+       CICR2 = pcdev->save_cicr[i++];
+       CICR3 = pcdev->save_cicr[i++];
+       CICR4 = pcdev->save_cicr[i++];
+
+       if ((pcdev->icd) && (pcdev->icd->ops->resume))
+               ret = pcdev->icd->ops->resume(pcdev->icd);
+
+       /* Restart frame capture if active buffer exists */
+       if (!ret && pcdev->active) {
+               /* Reset the FIFOs */
+               CIFR |= CIFR_RESET_F;
+               /* Enable End-Of-Frame Interrupt */
+               CICR0 &= ~CICR0_EOFM;
+               /* Restart the Capture Interface */
+               CICR0 |= CICR0_ENB;
+       }
+
+       return ret;
+}
+
 static struct soc_camera_host_ops pxa_soc_camera_host_ops = {
        .owner          = THIS_MODULE,
        .add            = pxa_camera_add_device,
        .remove         = pxa_camera_remove_device,
+       .suspend        = pxa_camera_suspend,
+       .resume         = pxa_camera_resume,
        .set_fmt_cap    = pxa_camera_set_fmt_cap,
        .try_fmt_cap    = pxa_camera_try_fmt_cap,
        .init_videobuf  = pxa_camera_init_videobuf,
@@ -1198,7 +1254,7 @@ static int __devinit pxa_camera_init(void)
 
 static void __exit pxa_camera_exit(void)
 {
-       return platform_driver_unregister(&pxa_camera_driver);
+       platform_driver_unregister(&pxa_camera_driver);
 }
 
 module_init(pxa_camera_init);
diff --git a/drivers/media/video/saa7196.h b/drivers/media/video/saa7196.h
deleted file mode 100644 (file)
index e69de29..0000000
index f7ca3cb..318754e 100644 (file)
@@ -647,7 +647,7 @@ static int __init sh_mobile_ceu_init(void)
 
 static void __exit sh_mobile_ceu_exit(void)
 {
-       return platform_driver_unregister(&sh_mobile_ceu_driver);
+       platform_driver_unregister(&sh_mobile_ceu_driver);
 }
 
 module_init(sh_mobile_ceu_init);
index b6be5ee..66ebe59 100644 (file)
@@ -732,10 +732,36 @@ static int soc_camera_remove(struct device *dev)
        return 0;
 }
 
+static int soc_camera_suspend(struct device *dev, pm_message_t state)
+{
+       struct soc_camera_device *icd = to_soc_camera_dev(dev);
+       struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
+       int ret = 0;
+
+       if (ici->ops->suspend)
+               ret = ici->ops->suspend(icd, state);
+
+       return ret;
+}
+
+static int soc_camera_resume(struct device *dev)
+{
+       struct soc_camera_device *icd = to_soc_camera_dev(dev);
+       struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
+       int ret = 0;
+
+       if (ici->ops->resume)
+               ret = ici->ops->resume(icd);
+
+       return ret;
+}
+
 static struct bus_type soc_camera_bus_type = {
        .name           = "soc-camera",
        .probe          = soc_camera_probe,
        .remove         = soc_camera_remove,
+       .suspend        = soc_camera_suspend,
+       .resume         = soc_camera_resume,
 };
 
 static struct device_driver ic_drv = {
index eefb032..1adc257 100644 (file)
@@ -187,7 +187,7 @@ static int __init soc_camera_platform_module_init(void)
 
 static void __exit soc_camera_platform_module_exit(void)
 {
-       return platform_driver_unregister(&soc_camera_platform_driver);
+       platform_driver_unregister(&soc_camera_platform_driver);
 }
 
 module_init(soc_camera_platform_module_init);
index 626f4ad..6ef3e52 100644 (file)
@@ -585,13 +585,17 @@ int uvc_query_v4l2_ctrl(struct uvc_video_device *video,
        struct uvc_control_mapping *mapping;
        struct uvc_menu_info *menu;
        unsigned int i;
-       __u8 data[8];
+       __u8 *data;
        int ret;
 
        ctrl = uvc_find_control(video, v4l2_ctrl->id, &mapping);
        if (ctrl == NULL)
                return -EINVAL;
 
+       data = kmalloc(8, 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;
@@ -604,8 +608,8 @@ int uvc_query_v4l2_ctrl(struct uvc_video_device *video,
        if (ctrl->info->flags & UVC_CONTROL_GET_DEF) {
                if ((ret = uvc_query_ctrl(video->dev, GET_DEF, ctrl->entity->id,
                                video->dev->intfnum, ctrl->info->selector,
-                               &data, ctrl->info->size)) < 0)
-                       return ret;
+                               data, ctrl->info->size)) < 0)
+                       goto out;
                v4l2_ctrl->default_value = uvc_get_le_value(data, mapping);
        }
 
@@ -623,13 +627,15 @@ int uvc_query_v4l2_ctrl(struct uvc_video_device *video,
                        }
                }
 
-               return 0;
+               ret = 0;
+               goto out;
 
        case V4L2_CTRL_TYPE_BOOLEAN:
                v4l2_ctrl->minimum = 0;
                v4l2_ctrl->maximum = 1;
                v4l2_ctrl->step = 1;
-               return 0;
+               ret = 0;
+               goto out;
 
        default:
                break;
@@ -638,26 +644,29 @@ int uvc_query_v4l2_ctrl(struct uvc_video_device *video,
        if (ctrl->info->flags & UVC_CONTROL_GET_MIN) {
                if ((ret = uvc_query_ctrl(video->dev, GET_MIN, ctrl->entity->id,
                                video->dev->intfnum, ctrl->info->selector,
-                               &data, ctrl->info->size)) < 0)
-                       return ret;
+                               data, ctrl->info->size)) < 0)
+                       goto out;
                v4l2_ctrl->minimum = uvc_get_le_value(data, mapping);
        }
        if (ctrl->info->flags & UVC_CONTROL_GET_MAX) {
                if ((ret = uvc_query_ctrl(video->dev, GET_MAX, ctrl->entity->id,
                                video->dev->intfnum, ctrl->info->selector,
-                               &data, ctrl->info->size)) < 0)
-                       return ret;
+                               data, ctrl->info->size)) < 0)
+                       goto out;
                v4l2_ctrl->maximum = uvc_get_le_value(data, mapping);
        }
        if (ctrl->info->flags & UVC_CONTROL_GET_RES) {
                if ((ret = uvc_query_ctrl(video->dev, GET_RES, ctrl->entity->id,
                                video->dev->intfnum, ctrl->info->selector,
-                               &data, ctrl->info->size)) < 0)
-                       return ret;
+                               data, ctrl->info->size)) < 0)
+                       goto out;
                v4l2_ctrl->step = uvc_get_le_value(data, mapping);
        }
 
-       return 0;
+       ret = 0;
+out:
+       kfree(data);
+       return ret;
 }
 
 
index b3c4d75..7e10203 100644 (file)
@@ -1884,7 +1884,7 @@ static struct usb_device_id uvc_ids[] = {
          .bInterfaceSubClass   = 1,
          .bInterfaceProtocol   = 0,
          .driver_info          = UVC_QUIRK_PROBE_MINMAX },
-       /* Packard Bell OEM Webcam */
+       /* Packard Bell OEM Webcam - Bison Electronics */
        { .match_flags          = USB_DEVICE_ID_MATCH_DEVICE
                                | USB_DEVICE_ID_MATCH_INT_INFO,
          .idVendor             = 0x5986,
@@ -1893,7 +1893,7 @@ static struct usb_device_id uvc_ids[] = {
          .bInterfaceSubClass   = 1,
          .bInterfaceProtocol   = 0,
          .driver_info          = UVC_QUIRK_PROBE_MINMAX },
-       /* Acer Crystal Eye webcam */
+       /* Acer Crystal Eye webcam - Bison Electronics */
        { .match_flags          = USB_DEVICE_ID_MATCH_DEVICE
                                | USB_DEVICE_ID_MATCH_INT_INFO,
          .idVendor             = 0x5986,
@@ -1902,7 +1902,7 @@ static struct usb_device_id uvc_ids[] = {
          .bInterfaceSubClass   = 1,
          .bInterfaceProtocol   = 0,
          .driver_info          = UVC_QUIRK_PROBE_MINMAX },
-       /* Medion Akoya Mini E1210 */
+       /* Medion Akoya Mini E1210 - Bison Electronics */
        { .match_flags          = USB_DEVICE_ID_MATCH_DEVICE
                                | USB_DEVICE_ID_MATCH_INT_INFO,
          .idVendor             = 0x5986,
@@ -1911,7 +1911,7 @@ static struct usb_device_id uvc_ids[] = {
          .bInterfaceSubClass   = 1,
          .bInterfaceProtocol   = 0,
          .driver_info          = UVC_QUIRK_PROBE_MINMAX },
-       /* Acer OrbiCam - Unknown vendor */
+       /* Acer OrbiCam - Bison Electronics */
        { .match_flags          = USB_DEVICE_ID_MATCH_DEVICE
                                | USB_DEVICE_ID_MATCH_INT_INFO,
          .idVendor             = 0x5986,
@@ -1920,6 +1920,24 @@ static struct usb_device_id uvc_ids[] = {
          .bInterfaceSubClass   = 1,
          .bInterfaceProtocol   = 0,
          .driver_info          = UVC_QUIRK_PROBE_MINMAX },
+       /* Bison Electronics */
+       { .match_flags          = USB_DEVICE_ID_MATCH_DEVICE
+                               | USB_DEVICE_ID_MATCH_INT_INFO,
+         .idVendor             = 0x5986,
+         .idProduct            = 0x0300,
+         .bInterfaceClass      = USB_CLASS_VIDEO,
+         .bInterfaceSubClass   = 1,
+         .bInterfaceProtocol   = 0,
+         .driver_info          = UVC_QUIRK_PROBE_MINMAX },
+       /* Clevo M570TU - Bison Electronics */
+       { .match_flags          = USB_DEVICE_ID_MATCH_DEVICE
+                               | USB_DEVICE_ID_MATCH_INT_INFO,
+         .idVendor             = 0x5986,
+         .idProduct            = 0x0303,
+         .bInterfaceClass      = USB_CLASS_VIDEO,
+         .bInterfaceSubClass   = 1,
+         .bInterfaceProtocol   = 0,
+         .driver_info          = UVC_QUIRK_PROBE_MINMAX },
        /* Generic USB Video Class */
        { USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, 0) },
        {}
index ad63794..6854ac7 100644 (file)
@@ -90,17 +90,20 @@ static void uvc_fixup_buffer_size(struct uvc_video_device *video,
 static int uvc_get_video_ctrl(struct uvc_video_device *video,
        struct uvc_streaming_control *ctrl, int probe, __u8 query)
 {
-       __u8 data[34];
-       __u8 size;
+       __u8 *data;
+       __u16 size;
        int ret;
 
        size = video->dev->uvc_version >= 0x0110 ? 34 : 26;
+       data = kmalloc(size, GFP_KERNEL);
+       if (data == NULL)
+               return -ENOMEM;
+
        ret = __uvc_query_ctrl(video->dev, query, 0, video->streaming->intfnum,
-               probe ? VS_PROBE_CONTROL : VS_COMMIT_CONTROL, &data, size,
+               probe ? VS_PROBE_CONTROL : VS_COMMIT_CONTROL, data, size,
                UVC_CTRL_STREAMING_TIMEOUT);
-
        if (ret < 0)
-               return ret;
+               goto out;
 
        ctrl->bmHint = le16_to_cpup((__le16 *)&data[0]);
        ctrl->bFormatIndex = data[2];
@@ -136,17 +139,22 @@ static int uvc_get_video_ctrl(struct uvc_video_device *video,
         */
        uvc_fixup_buffer_size(video, ctrl);
 
-       return 0;
+out:
+       kfree(data);
+       return ret;
 }
 
 int uvc_set_video_ctrl(struct uvc_video_device *video,
        struct uvc_streaming_control *ctrl, int probe)
 {
-       __u8 data[34];
-       __u8 size;
+       __u8 *data;
+       __u16 size;
+       int ret;
 
        size = video->dev->uvc_version >= 0x0110 ? 34 : 26;
-       memset(data, 0, sizeof data);
+       data = kzalloc(size, GFP_KERNEL);
+       if (data == NULL)
+               return -ENOMEM;
 
        *(__le16 *)&data[0] = cpu_to_le16(ctrl->bmHint);
        data[2] = ctrl->bFormatIndex;
@@ -174,10 +182,13 @@ int uvc_set_video_ctrl(struct uvc_video_device *video,
                data[33] = ctrl->bMaxVersion;
        }
 
-       return __uvc_query_ctrl(video->dev, SET_CUR, 0,
+       ret = __uvc_query_ctrl(video->dev, SET_CUR, 0,
                video->streaming->intfnum,
-               probe ? VS_PROBE_CONTROL : VS_COMMIT_CONTROL, &data, size,
+               probe ? VS_PROBE_CONTROL : VS_COMMIT_CONTROL, data, size,
                UVC_CTRL_STREAMING_TIMEOUT);
+
+       kfree(data);
+       return ret;
 }
 
 int uvc_probe_video(struct uvc_video_device *video,
index 556615f..6f36006 100644 (file)
@@ -222,11 +222,13 @@ int video_register_device(struct video_device *vfd, int type, int nr)
 EXPORT_SYMBOL(video_register_device);
 
 /**
- *     video_register_device - register video4linux devices
+ *     video_register_device_index - register video4linux devices
  *     @vfd:  video device structure we want to register
  *     @type: type of device to register
  *     @nr:   which device number (0 == /dev/video0, 1 == /dev/video1, ...
  *             -1 == first free)
+ *     @index: stream number based on parent device;
+ *             -1 if auto assign, requested number otherwise
  *
  *     The registration code assigns minor numbers based on the type
  *     requested. -ENFILE is returned in all the device slots for this
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c
deleted file mode 100644 (file)
index e69de29..0000000
index 3989b0e..1edda45 100644 (file)
@@ -39,7 +39,9 @@
 #include <linux/i2c-algo-sgi.h>
 
 #include <linux/videodev2.h>
+#include <media/v4l2-ioctl.h>
 #include <media/v4l2-common.h>
+#include <media/v4l2-ioctl.h>
 #include <linux/video_decoder.h>
 #include <linux/mutex.h>
 
index f5ade19..a726f3b 100644 (file)
@@ -426,9 +426,11 @@ config ENCLOSURE_SERVICES
 
 config SGI_XP
        tristate "Support communication between SGI SSIs"
-       depends on IA64_GENERIC || IA64_SGI_SN2
+       depends on NET
+       depends on (IA64_GENERIC || IA64_SGI_SN2 || IA64_SGI_UV || X86_64) && SMP
        select IA64_UNCACHED_ALLOCATOR if IA64_GENERIC || IA64_SGI_SN2
        select GENERIC_ALLOCATOR if IA64_GENERIC || IA64_SGI_SN2
+       select SGI_GRU if (IA64_GENERIC || IA64_SGI_UV || X86_64) && SMP
        ---help---
          An SGI machine can be divided into multiple Single System
          Images which act independently of each other and have
@@ -450,4 +452,27 @@ config HP_ILO
          To compile this driver as a module, choose M here: the
          module will be called hpilo.
 
+config SGI_GRU
+       tristate "SGI GRU driver"
+       depends on (X86_64 || IA64_SGI_UV || IA64_GENERIC) && SMP
+       default n
+       select MMU_NOTIFIER
+       ---help---
+       The GRU is a hardware resource located in the system chipset. The GRU
+       contains memory that can be mmapped into the user address space. This memory is
+       used to communicate with the GRU to perform functions such as load/store,
+       scatter/gather, bcopy, AMOs, etc.  The GRU is directly accessed by user
+       instructions using user virtual addresses. GRU instructions (ex., bcopy) use
+       user virtual addresses for operands.
+
+       If you are not running on a SGI UV system, say N.
+
+config SGI_GRU_DEBUG
+       bool  "SGI GRU driver debug"
+       depends on SGI_GRU
+       default n
+       ---help---
+       This option enables addition debugging code for the SGI GRU driver. If
+       you are unsure, say N.
+
 endif # MISC_DEVICES
index f5e2734..c6c13f6 100644 (file)
@@ -28,4 +28,5 @@ obj-$(CONFIG_INTEL_MENLOW)    += intel_menlow.o
 obj-$(CONFIG_ENCLOSURE_SERVICES) += enclosure.o
 obj-$(CONFIG_KGDB_TESTS)       += kgdbts.o
 obj-$(CONFIG_SGI_XP)           += sgi-xp/
+obj-$(CONFIG_SGI_GRU)          += sgi-gru/
 obj-$(CONFIG_HP_ILO)           += hpilo.o
diff --git a/drivers/misc/sgi-gru/Makefile b/drivers/misc/sgi-gru/Makefile
new file mode 100644 (file)
index 0000000..d03597a
--- /dev/null
@@ -0,0 +1,3 @@
+obj-$(CONFIG_SGI_GRU) := gru.o
+gru-y := grufile.o grumain.o grufault.o grutlbpurge.o gruprocfs.o grukservices.o
+
diff --git a/drivers/misc/sgi-gru/gru.h b/drivers/misc/sgi-gru/gru.h
new file mode 100644 (file)
index 0000000..40df7cb
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ *  Copyright (c) 2008 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Lesser General Public License as published by
+ *  the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser 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 __GRU_H__
+#define __GRU_H__
+
+/*
+ * GRU architectural definitions
+ */
+#define GRU_CACHE_LINE_BYTES           64
+#define GRU_HANDLE_STRIDE              256
+#define GRU_CB_BASE                    0
+#define GRU_DS_BASE                    0x20000
+
+/*
+ * Size used to map GRU GSeg
+ */
+#if defined CONFIG_IA64
+#define GRU_GSEG_PAGESIZE      (256 * 1024UL)
+#elif defined CONFIG_X86_64
+#define GRU_GSEG_PAGESIZE      (256 * 1024UL)          /* ZZZ 2MB ??? */
+#else
+#error "Unsupported architecture"
+#endif
+
+/*
+ * Structure for obtaining GRU resource information
+ */
+struct gru_chiplet_info {
+       int     node;
+       int     chiplet;
+       int     blade;
+       int     total_dsr_bytes;
+       int     total_cbr;
+       int     total_user_dsr_bytes;
+       int     total_user_cbr;
+       int     free_user_dsr_bytes;
+       int     free_user_cbr;
+};
+
+/* Flags for GRU options on the gru_create_context() call */
+/* Select one of the follow 4 options to specify how TLB misses are handled */
+#define GRU_OPT_MISS_DEFAULT   0x0000  /* Use default mode */
+#define GRU_OPT_MISS_USER_POLL 0x0001  /* User will poll CB for faults */
+#define GRU_OPT_MISS_FMM_INTR  0x0002  /* Send interrupt to cpu to
+                                          handle fault */
+#define GRU_OPT_MISS_FMM_POLL  0x0003  /* Use system polling thread */
+#define GRU_OPT_MISS_MASK      0x0003  /* Mask for TLB MISS option */
+
+
+
+#endif         /* __GRU_H__ */
diff --git a/drivers/misc/sgi-gru/gru_instructions.h b/drivers/misc/sgi-gru/gru_instructions.h
new file mode 100644 (file)
index 0000000..0dc3622
--- /dev/null
@@ -0,0 +1,669 @@
+/*
+ *  Copyright (c) 2008 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Lesser General Public License as published by
+ *  the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser 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 __GRU_INSTRUCTIONS_H__
+#define __GRU_INSTRUCTIONS_H__
+
+#define gru_flush_cache_hook(p)
+#define gru_emulator_wait_hook(p, w)
+
+/*
+ * Architecture dependent functions
+ */
+
+#if defined CONFIG_IA64
+#include <linux/compiler.h>
+#include <asm/intrinsics.h>
+#define __flush_cache(p)               ia64_fc(p)
+/* Use volatile on IA64 to ensure ordering via st4.rel */
+#define gru_ordered_store_int(p,v)                                     \
+               do {                                                    \
+                       barrier();                                      \
+                       *((volatile int *)(p)) = v; /* force st.rel */  \
+               } while (0)
+#elif defined CONFIG_X86_64
+#define __flush_cache(p)               clflush(p)
+#define gru_ordered_store_int(p,v)                                     \
+               do {                                                    \
+                       barrier();                                      \
+                       *(int *)p = v;                                  \
+               } while (0)
+#else
+#error "Unsupported architecture"
+#endif
+
+/*
+ * Control block status and exception codes
+ */
+#define CBS_IDLE                       0
+#define CBS_EXCEPTION                  1
+#define CBS_ACTIVE                     2
+#define CBS_CALL_OS                    3
+
+/* CB substatus bitmasks */
+#define CBSS_MSG_QUEUE_MASK            7
+#define CBSS_IMPLICIT_ABORT_ACTIVE_MASK        8
+
+/* CB substatus message queue values (low 3 bits of substatus) */
+#define CBSS_NO_ERROR                  0
+#define CBSS_LB_OVERFLOWED             1
+#define CBSS_QLIMIT_REACHED            2
+#define CBSS_PAGE_OVERFLOW             3
+#define CBSS_AMO_NACKED                        4
+#define CBSS_PUT_NACKED                        5
+
+/*
+ * Structure used to fetch exception detail for CBs that terminate with
+ * CBS_EXCEPTION
+ */
+struct control_block_extended_exc_detail {
+       unsigned long   cb;
+       int             opc;
+       int             ecause;
+       int             exopc;
+       long            exceptdet0;
+       int             exceptdet1;
+};
+
+/*
+ * Instruction formats
+ */
+
+/*
+ * Generic instruction format.
+ * This definition has precise bit field definitions.
+ */
+struct gru_instruction_bits {
+    /* DW 0  - low */
+    unsigned int               icmd:      1;
+    unsigned char              ima:       3;   /* CB_DelRep, unmapped mode */
+    unsigned char              reserved0: 4;
+    unsigned int               xtype:     3;
+    unsigned int               iaa0:      2;
+    unsigned int               iaa1:      2;
+    unsigned char              reserved1: 1;
+    unsigned char              opc:       8;   /* opcode */
+    unsigned char              exopc:     8;   /* extended opcode */
+    /* DW 0  - high */
+    unsigned int               idef2:    22;   /* TRi0 */
+    unsigned char              reserved2: 2;
+    unsigned char              istatus:   2;
+    unsigned char              isubstatus:4;
+    unsigned char              reserved3: 2;
+    /* DW 1 */
+    unsigned long              idef4;          /* 42 bits: TRi1, BufSize */
+    /* DW 2-6 */
+    unsigned long              idef1;          /* BAddr0 */
+    unsigned long              idef5;          /* Nelem */
+    unsigned long              idef6;          /* Stride, Operand1 */
+    unsigned long              idef3;          /* BAddr1, Value, Operand2 */
+    unsigned long              reserved4;
+    /* DW 7 */
+    unsigned long              avalue;          /* AValue */
+};
+
+/*
+ * Generic instruction with friendlier names. This format is used
+ * for inline instructions.
+ */
+struct gru_instruction {
+    /* DW 0 */
+    unsigned int               op32;    /* icmd,xtype,iaa0,ima,opc */
+    unsigned int               tri0;
+    unsigned long              tri1_bufsize;           /* DW 1 */
+    unsigned long              baddr0;                 /* DW 2 */
+    unsigned long              nelem;                  /* DW 3 */
+    unsigned long              op1_stride;             /* DW 4 */
+    unsigned long              op2_value_baddr1;       /* DW 5 */
+    unsigned long              reserved0;              /* DW 6 */
+    unsigned long              avalue;                 /* DW 7 */
+};
+
+/* Some shifts and masks for the low 32 bits of a GRU command */
+#define GRU_CB_ICMD_SHFT       0
+#define GRU_CB_ICMD_MASK       0x1
+#define GRU_CB_XTYPE_SHFT      8
+#define GRU_CB_XTYPE_MASK      0x7
+#define GRU_CB_IAA0_SHFT       11
+#define GRU_CB_IAA0_MASK       0x3
+#define GRU_CB_IAA1_SHFT       13
+#define GRU_CB_IAA1_MASK       0x3
+#define GRU_CB_IMA_SHFT                1
+#define GRU_CB_IMA_MASK                0x3
+#define GRU_CB_OPC_SHFT                16
+#define GRU_CB_OPC_MASK                0xff
+#define GRU_CB_EXOPC_SHFT      24
+#define GRU_CB_EXOPC_MASK      0xff
+
+/* GRU instruction opcodes (opc field) */
+#define OP_NOP         0x00
+#define OP_BCOPY       0x01
+#define OP_VLOAD       0x02
+#define OP_IVLOAD      0x03
+#define OP_VSTORE      0x04
+#define OP_IVSTORE     0x05
+#define OP_VSET                0x06
+#define OP_IVSET       0x07
+#define OP_MESQ                0x08
+#define OP_GAMXR       0x09
+#define OP_GAMIR       0x0a
+#define OP_GAMIRR      0x0b
+#define OP_GAMER       0x0c
+#define OP_GAMERR      0x0d
+#define OP_BSTORE      0x0e
+#define OP_VFLUSH      0x0f
+
+
+/* Extended opcodes values (exopc field) */
+
+/* GAMIR - AMOs with implicit operands */
+#define EOP_IR_FETCH   0x01 /* Plain fetch of memory */
+#define EOP_IR_CLR     0x02 /* Fetch and clear */
+#define EOP_IR_INC     0x05 /* Fetch and increment */
+#define EOP_IR_DEC     0x07 /* Fetch and decrement */
+#define EOP_IR_QCHK1   0x0d /* Queue check, 64 byte msg */
+#define EOP_IR_QCHK2   0x0e /* Queue check, 128 byte msg */
+
+/* GAMIRR - Registered AMOs with implicit operands */
+#define EOP_IRR_FETCH  0x01 /* Registered fetch of memory */
+#define EOP_IRR_CLR    0x02 /* Registered fetch and clear */
+#define EOP_IRR_INC    0x05 /* Registered fetch and increment */
+#define EOP_IRR_DEC    0x07 /* Registered fetch and decrement */
+#define EOP_IRR_DECZ   0x0f /* Registered fetch and decrement, update on zero*/
+
+/* GAMER - AMOs with explicit operands */
+#define EOP_ER_SWAP    0x00 /* Exchange argument and memory */
+#define EOP_ER_OR      0x01 /* Logical OR with memory */
+#define EOP_ER_AND     0x02 /* Logical AND with memory */
+#define EOP_ER_XOR     0x03 /* Logical XOR with memory */
+#define EOP_ER_ADD     0x04 /* Add value to memory */
+#define EOP_ER_CSWAP   0x08 /* Compare with operand2, write operand1 if match*/
+#define EOP_ER_CADD    0x0c /* Queue check, operand1*64 byte msg */
+
+/* GAMERR - Registered AMOs with explicit operands */
+#define EOP_ERR_SWAP   0x00 /* Exchange argument and memory */
+#define EOP_ERR_OR     0x01 /* Logical OR with memory */
+#define EOP_ERR_AND    0x02 /* Logical AND with memory */
+#define EOP_ERR_XOR    0x03 /* Logical XOR with memory */
+#define EOP_ERR_ADD    0x04 /* Add value to memory */
+#define EOP_ERR_CSWAP  0x08 /* Compare with operand2, write operand1 if match*/
+#define EOP_ERR_EPOLL  0x09 /* Poll for equality */
+#define EOP_ERR_NPOLL  0x0a /* Poll for inequality */
+
+/* GAMXR - SGI Arithmetic unit */
+#define EOP_XR_CSWAP   0x0b /* Masked compare exchange */
+
+
+/* Transfer types (xtype field) */
+#define XTYPE_B                0x0     /* byte */
+#define XTYPE_S                0x1     /* short (2-byte) */
+#define XTYPE_W                0x2     /* word (4-byte) */
+#define XTYPE_DW       0x3     /* doubleword (8-byte) */
+#define XTYPE_CL       0x6     /* cacheline (64-byte) */
+
+
+/* Instruction access attributes (iaa0, iaa1 fields) */
+#define IAA_RAM                0x0     /* normal cached RAM access */
+#define IAA_NCRAM      0x2     /* noncoherent RAM access */
+#define IAA_MMIO       0x1     /* noncoherent memory-mapped I/O space */
+#define IAA_REGISTER   0x3     /* memory-mapped registers, etc. */
+
+
+/* Instruction mode attributes (ima field) */
+#define IMA_MAPPED     0x0     /* Virtual mode  */
+#define IMA_CB_DELAY   0x1     /* hold read responses until status changes */
+#define IMA_UNMAPPED   0x2     /* bypass the TLBs (OS only) */
+#define IMA_INTERRUPT  0x4     /* Interrupt when instruction completes */
+
+/* CBE ecause bits */
+#define CBE_CAUSE_RI                           (1 << 0)
+#define CBE_CAUSE_INVALID_INSTRUCTION          (1 << 1)
+#define CBE_CAUSE_UNMAPPED_MODE_FORBIDDEN      (1 << 2)
+#define CBE_CAUSE_PE_CHECK_DATA_ERROR          (1 << 3)
+#define CBE_CAUSE_IAA_GAA_MISMATCH             (1 << 4)
+#define CBE_CAUSE_DATA_SEGMENT_LIMIT_EXCEPTION (1 << 5)
+#define CBE_CAUSE_OS_FATAL_TLB_FAULT           (1 << 6)
+#define CBE_CAUSE_EXECUTION_HW_ERROR           (1 << 7)
+#define CBE_CAUSE_TLBHW_ERROR                  (1 << 8)
+#define CBE_CAUSE_RA_REQUEST_TIMEOUT           (1 << 9)
+#define CBE_CAUSE_HA_REQUEST_TIMEOUT           (1 << 10)
+#define CBE_CAUSE_RA_RESPONSE_FATAL            (1 << 11)
+#define CBE_CAUSE_RA_RESPONSE_NON_FATAL                (1 << 12)
+#define CBE_CAUSE_HA_RESPONSE_FATAL            (1 << 13)
+#define CBE_CAUSE_HA_RESPONSE_NON_FATAL                (1 << 14)
+#define CBE_CAUSE_ADDRESS_SPACE_DECODE_ERROR   (1 << 15)
+#define CBE_CAUSE_RESPONSE_DATA_ERROR          (1 << 16)
+#define CBE_CAUSE_PROTOCOL_STATE_DATA_ERROR    (1 << 17)
+
+/*
+ * Exceptions are retried for the following cases. If any OTHER bits are set
+ * in ecause, the exception is not retryable.
+ */
+#define EXCEPTION_RETRY_BITS (CBE_CAUSE_RESPONSE_DATA_ERROR |          \
+                             CBE_CAUSE_RA_REQUEST_TIMEOUT |            \
+                             CBE_CAUSE_TLBHW_ERROR |                   \
+                             CBE_CAUSE_HA_REQUEST_TIMEOUT)
+
+/* Message queue head structure */
+union gru_mesqhead {
+       unsigned long   val;
+       struct {
+               unsigned int    head;
+               unsigned int    limit;
+       };
+};
+
+
+/* Generate the low word of a GRU instruction */
+static inline unsigned int
+__opword(unsigned char opcode, unsigned char exopc, unsigned char xtype,
+       unsigned char iaa0, unsigned char iaa1,
+       unsigned char ima)
+{
+    return (1 << GRU_CB_ICMD_SHFT) |
+          (iaa0 << GRU_CB_IAA0_SHFT) |
+          (iaa1 << GRU_CB_IAA1_SHFT) |
+          (ima << GRU_CB_IMA_SHFT) |
+          (xtype << GRU_CB_XTYPE_SHFT) |
+          (opcode << GRU_CB_OPC_SHFT) |
+          (exopc << GRU_CB_EXOPC_SHFT);
+}
+
+/*
+ * Architecture specific intrinsics
+ */
+static inline void gru_flush_cache(void *p)
+{
+       __flush_cache(p);
+}
+
+/*
+ * Store the lower 32 bits of the command including the "start" bit. Then
+ * start the instruction executing.
+ */
+static inline void gru_start_instruction(struct gru_instruction *ins, int op32)
+{
+       gru_ordered_store_int(ins, op32);
+}
+
+
+/* Convert "hints" to IMA */
+#define CB_IMA(h)              ((h) | IMA_UNMAPPED)
+
+/* Convert data segment cache line index into TRI0 / TRI1 value */
+#define GRU_DINDEX(i)          ((i) * GRU_CACHE_LINE_BYTES)
+
+/* Inline functions for GRU instructions.
+ *     Note:
+ *             - nelem and stride are in elements
+ *             - tri0/tri1 is in bytes for the beginning of the data segment.
+ */
+static inline void gru_vload(void *cb, unsigned long mem_addr,
+               unsigned int tri0, unsigned char xtype, unsigned long nelem,
+               unsigned long stride, unsigned long hints)
+{
+       struct gru_instruction *ins = (struct gru_instruction *)cb;
+
+       ins->baddr0 = (long)mem_addr;
+       ins->nelem = nelem;
+       ins->tri0 = tri0;
+       ins->op1_stride = stride;
+       gru_start_instruction(ins, __opword(OP_VLOAD, 0, xtype, IAA_RAM, 0,
+                                       CB_IMA(hints)));
+}
+
+static inline void gru_vstore(void *cb, unsigned long mem_addr,
+               unsigned int tri0, unsigned char xtype, unsigned long nelem,
+               unsigned long stride, unsigned long hints)
+{
+       struct gru_instruction *ins = (void *)cb;
+
+       ins->baddr0 = (long)mem_addr;
+       ins->nelem = nelem;
+       ins->tri0 = tri0;
+       ins->op1_stride = stride;
+       gru_start_instruction(ins, __opword(OP_VSTORE, 0, xtype, IAA_RAM, 0,
+                                       CB_IMA(hints)));
+}
+
+static inline void gru_ivload(void *cb, unsigned long mem_addr,
+               unsigned int tri0, unsigned int tri1, unsigned char xtype,
+               unsigned long nelem, unsigned long hints)
+{
+       struct gru_instruction *ins = (void *)cb;
+
+       ins->baddr0 = (long)mem_addr;
+       ins->nelem = nelem;
+       ins->tri0 = tri0;
+       ins->tri1_bufsize = tri1;
+       gru_start_instruction(ins, __opword(OP_IVLOAD, 0, xtype, IAA_RAM, 0,
+                                       CB_IMA(hints)));
+}
+
+static inline void gru_ivstore(void *cb, unsigned long mem_addr,
+               unsigned int tri0, unsigned int tri1,
+               unsigned char xtype, unsigned long nelem, unsigned long hints)
+{
+       struct gru_instruction *ins = (void *)cb;
+
+       ins->baddr0 = (long)mem_addr;
+       ins->nelem = nelem;
+       ins->tri0 = tri0;
+       ins->tri1_bufsize = tri1;
+       gru_start_instruction(ins, __opword(OP_IVSTORE, 0, xtype, IAA_RAM, 0,
+                                       CB_IMA(hints)));
+}
+
+static inline void gru_vset(void *cb, unsigned long mem_addr,
+               unsigned long value, unsigned char xtype, unsigned long nelem,
+               unsigned long stride, unsigned long hints)
+{
+       struct gru_instruction *ins = (void *)cb;
+
+       ins->baddr0 = (long)mem_addr;
+       ins->op2_value_baddr1 = value;
+       ins->nelem = nelem;
+       ins->op1_stride = stride;
+       gru_start_instruction(ins, __opword(OP_VSET, 0, xtype, IAA_RAM, 0,
+                                        CB_IMA(hints)));
+}
+
+static inline void gru_ivset(void *cb, unsigned long mem_addr,
+               unsigned int tri1, unsigned long value, unsigned char xtype,
+               unsigned long nelem, unsigned long hints)
+{
+       struct gru_instruction *ins = (void *)cb;
+
+       ins->baddr0 = (long)mem_addr;
+       ins->op2_value_baddr1 = value;
+       ins->nelem = nelem;
+       ins->tri1_bufsize = tri1;
+       gru_start_instruction(ins, __opword(OP_IVSET, 0, xtype, IAA_RAM, 0,
+                                       CB_IMA(hints)));
+}
+
+static inline void gru_vflush(void *cb, unsigned long mem_addr,
+               unsigned long nelem, unsigned char xtype, unsigned long stride,
+               unsigned long hints)
+{
+       struct gru_instruction *ins = (void *)cb;
+
+       ins->baddr0 = (long)mem_addr;
+       ins->op1_stride = stride;
+       ins->nelem = nelem;
+       gru_start_instruction(ins, __opword(OP_VFLUSH, 0, xtype, IAA_RAM, 0,
+                                       CB_IMA(hints)));
+}
+
+static inline void gru_nop(void *cb, int hints)
+{
+       struct gru_instruction *ins = (void *)cb;
+
+       gru_start_instruction(ins, __opword(OP_NOP, 0, 0, 0, 0, CB_IMA(hints)));
+}
+
+
+static inline void gru_bcopy(void *cb, const unsigned long src,
+               unsigned long dest,
+               unsigned int tri0, unsigned int xtype, unsigned long nelem,
+               unsigned int bufsize, unsigned long hints)
+{
+       struct gru_instruction *ins = (void *)cb;
+
+       ins->baddr0 = (long)src;
+       ins->op2_value_baddr1 = (long)dest;
+       ins->nelem = nelem;
+       ins->tri0 = tri0;
+       ins->tri1_bufsize = bufsize;
+       gru_start_instruction(ins, __opword(OP_BCOPY, 0, xtype, IAA_RAM,
+                                       IAA_RAM, CB_IMA(hints)));
+}
+
+static inline void gru_bstore(void *cb, const unsigned long src,
+               unsigned long dest, unsigned int tri0, unsigned int xtype,
+               unsigned long nelem, unsigned long hints)
+{
+       struct gru_instruction *ins = (void *)cb;
+
+       ins->baddr0 = (long)src;
+       ins->op2_value_baddr1 = (long)dest;
+       ins->nelem = nelem;
+       ins->tri0 = tri0;
+       gru_start_instruction(ins, __opword(OP_BSTORE, 0, xtype, 0, IAA_RAM,
+                                       CB_IMA(hints)));
+}
+
+static inline void gru_gamir(void *cb, int exopc, unsigned long src,
+               unsigned int xtype, unsigned long hints)
+{
+       struct gru_instruction *ins = (void *)cb;
+
+       ins->baddr0 = (long)src;
+       gru_start_instruction(ins, __opword(OP_GAMIR, exopc, xtype, IAA_RAM, 0,
+                                       CB_IMA(hints)));
+}
+
+static inline void gru_gamirr(void *cb, int exopc, unsigned long src,
+               unsigned int xtype, unsigned long hints)
+{
+       struct gru_instruction *ins = (void *)cb;
+
+       ins->baddr0 = (long)src;
+       gru_start_instruction(ins, __opword(OP_GAMIRR, exopc, xtype, IAA_RAM, 0,
+                                       CB_IMA(hints)));
+}
+
+static inline void gru_gamer(void *cb, int exopc, unsigned long src,
+               unsigned int xtype,
+               unsigned long operand1, unsigned long operand2,
+               unsigned long hints)
+{
+       struct gru_instruction *ins = (void *)cb;
+
+       ins->baddr0 = (long)src;
+       ins->op1_stride = operand1;
+       ins->op2_value_baddr1 = operand2;
+       gru_start_instruction(ins, __opword(OP_GAMER, exopc, xtype, IAA_RAM, 0,
+                                       CB_IMA(hints)));
+}
+
+static inline void gru_gamerr(void *cb, int exopc, unsigned long src,
+               unsigned int xtype, unsigned long operand1,
+               unsigned long operand2, unsigned long hints)
+{
+       struct gru_instruction *ins = (void *)cb;
+
+       ins->baddr0 = (long)src;
+       ins->op1_stride = operand1;
+       ins->op2_value_baddr1 = operand2;
+       gru_start_instruction(ins, __opword(OP_GAMERR, exopc, xtype, IAA_RAM, 0,
+                                       CB_IMA(hints)));
+}
+
+static inline void gru_gamxr(void *cb, unsigned long src,
+               unsigned int tri0, unsigned long hints)
+{
+       struct gru_instruction *ins = (void *)cb;
+
+       ins->baddr0 = (long)src;
+       ins->nelem = 4;
+       gru_start_instruction(ins, __opword(OP_GAMXR, EOP_XR_CSWAP, XTYPE_DW,
+                                IAA_RAM, 0, CB_IMA(hints)));
+}
+
+static inline void gru_mesq(void *cb, unsigned long queue,
+               unsigned long tri0, unsigned long nelem,
+               unsigned long hints)
+{
+       struct gru_instruction *ins = (void *)cb;
+
+       ins->baddr0 = (long)queue;
+       ins->nelem = nelem;
+       ins->tri0 = tri0;
+       gru_start_instruction(ins, __opword(OP_MESQ, 0, XTYPE_CL, IAA_RAM, 0,
+                                       CB_IMA(hints)));
+}
+
+static inline unsigned long gru_get_amo_value(void *cb)
+{
+       struct gru_instruction *ins = (void *)cb;
+
+       return ins->avalue;
+}
+
+static inline int gru_get_amo_value_head(void *cb)
+{
+       struct gru_instruction *ins = (void *)cb;
+
+       return ins->avalue & 0xffffffff;
+}
+
+static inline int gru_get_amo_value_limit(void *cb)
+{
+       struct gru_instruction *ins = (void *)cb;
+
+       return ins->avalue >> 32;
+}
+
+static inline union gru_mesqhead  gru_mesq_head(int head, int limit)
+{
+       union gru_mesqhead mqh;
+
+       mqh.head = head;
+       mqh.limit = limit;
+       return mqh;
+}
+
+/*
+ * Get struct control_block_extended_exc_detail for CB.
+ */
+extern int gru_get_cb_exception_detail(void *cb,
+                      struct control_block_extended_exc_detail *excdet);
+
+#define GRU_EXC_STR_SIZE               256
+
+extern int gru_check_status_proc(void *cb);
+extern int gru_wait_proc(void *cb);
+extern void gru_wait_abort_proc(void *cb);
+
+/*
+ * Control block definition for checking status
+ */
+struct gru_control_block_status {
+       unsigned int    icmd            :1;
+       unsigned int    unused1         :31;
+       unsigned int    unused2         :24;
+       unsigned int    istatus         :2;
+       unsigned int    isubstatus      :4;
+       unsigned int    inused3         :2;
+};
+
+/* Get CB status */
+static inline int gru_get_cb_status(void *cb)
+{
+       struct gru_control_block_status *cbs = (void *)cb;
+
+       return cbs->istatus;
+}
+
+/* Get CB message queue substatus */
+static inline int gru_get_cb_message_queue_substatus(void *cb)
+{
+       struct gru_control_block_status *cbs = (void *)cb;
+
+       return cbs->isubstatus & CBSS_MSG_QUEUE_MASK;
+}
+
+/* Get CB substatus */
+static inline int gru_get_cb_substatus(void *cb)
+{
+       struct gru_control_block_status *cbs = (void *)cb;
+
+       return cbs->isubstatus;
+}
+
+/* Check the status of a CB. If the CB is in UPM mode, call the
+ * OS to handle the UPM status.
+ * Returns the CB status field value (0 for normal completion)
+ */
+static inline int gru_check_status(void *cb)
+{
+       struct gru_control_block_status *cbs = (void *)cb;
+       int ret = cbs->istatus;
+
+       if (ret == CBS_CALL_OS)
+               ret = gru_check_status_proc(cb);
+       return ret;
+}
+
+/* Wait for CB to complete.
+ * Returns the CB status field value (0 for normal completion)
+ */
+static inline int gru_wait(void *cb)
+{
+       struct gru_control_block_status *cbs = (void *)cb;
+       int ret = cbs->istatus;;
+
+       if (ret != CBS_IDLE)
+               ret = gru_wait_proc(cb);
+       return ret;
+}
+
+/* Wait for CB to complete. Aborts program if error. (Note: error does NOT
+ * mean TLB mis - only fatal errors such as memory parity error or user
+ * bugs will cause termination.
+ */
+static inline void gru_wait_abort(void *cb)
+{
+       struct gru_control_block_status *cbs = (void *)cb;
+
+       if (cbs->istatus != CBS_IDLE)
+               gru_wait_abort_proc(cb);
+}
+
+
+/*
+ * Get a pointer to a control block
+ *     gseg    - GSeg address returned from gru_get_thread_gru_segment()
+ *     index   - index of desired CB
+ */
+static inline void *gru_get_cb_pointer(void *gseg,
+                                                     int index)
+{
+       return gseg + GRU_CB_BASE + index * GRU_HANDLE_STRIDE;
+}
+
+/*
+ * Get a pointer to a cacheline in the data segment portion of a GSeg
+ *     gseg    - GSeg address returned from gru_get_thread_gru_segment()
+ *     index   - index of desired cache line
+ */
+static inline void *gru_get_data_pointer(void *gseg, int index)
+{
+       return gseg + GRU_DS_BASE + index * GRU_CACHE_LINE_BYTES;
+}
+
+/*
+ * Convert a vaddr into the tri index within the GSEG
+ *     vaddr           - virtual address of within gseg
+ */
+static inline int gru_get_tri(void *vaddr)
+{
+       return ((unsigned long)vaddr & (GRU_GSEG_PAGESIZE - 1)) - GRU_DS_BASE;
+}
+#endif         /* __GRU_INSTRUCTIONS_H__ */
diff --git a/drivers/misc/sgi-gru/grufault.c b/drivers/misc/sgi-gru/grufault.c
new file mode 100644 (file)
index 0000000..3d33015
--- /dev/null
@@ -0,0 +1,633 @@
+/*
+ * SN Platform GRU Driver
+ *
+ *              FAULT HANDLER FOR GRU DETECTED TLB MISSES
+ *
+ * This file contains code that handles TLB misses within the GRU.
+ * These misses are reported either via interrupts or user polling of
+ * the user CB.
+ *
+ *  Copyright (c) 2008 Silicon Graphics, 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 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/kernel.h>
+#include <linux/errno.h>
+#include <linux/spinlock.h>
+#include <linux/mm.h>
+#include <linux/hugetlb.h>
+#include <linux/device.h>
+#include <linux/io.h>
+#include <linux/uaccess.h>
+#include <asm/pgtable.h>
+#include "gru.h"
+#include "grutables.h"
+#include "grulib.h"
+#include "gru_instructions.h"
+#include <asm/uv/uv_hub.h>
+
+/*
+ * Test if a physical address is a valid GRU GSEG address
+ */
+static inline int is_gru_paddr(unsigned long paddr)
+{
+       return paddr >= gru_start_paddr && paddr < gru_end_paddr;
+}
+
+/*
+ * Find the vma of a GRU segment. Caller must hold mmap_sem.
+ */
+struct vm_area_struct *gru_find_vma(unsigned long vaddr)
+{
+       struct vm_area_struct *vma;
+
+       vma = find_vma(current->mm, vaddr);
+       if (vma && vma->vm_start <= vaddr && vma->vm_ops == &gru_vm_ops)
+               return vma;
+       return NULL;
+}
+
+/*
+ * Find and lock the gts that contains the specified user vaddr.
+ *
+ * Returns:
+ *     - *gts with the mmap_sem locked for read and the GTS locked.
+ *     - NULL if vaddr invalid OR is not a valid GSEG vaddr.
+ */
+
+static struct gru_thread_state *gru_find_lock_gts(unsigned long vaddr)
+{
+       struct mm_struct *mm = current->mm;
+       struct vm_area_struct *vma;
+       struct gru_thread_state *gts = NULL;
+
+       down_read(&mm->mmap_sem);
+       vma = gru_find_vma(vaddr);
+       if (vma)
+               gts = gru_find_thread_state(vma, TSID(vaddr, vma));
+       if (gts)
+               mutex_lock(&gts->ts_ctxlock);
+       else
+               up_read(&mm->mmap_sem);
+       return gts;
+}
+
+static struct gru_thread_state *gru_alloc_locked_gts(unsigned long vaddr)
+{
+       struct mm_struct *mm = current->mm;
+       struct vm_area_struct *vma;
+       struct gru_thread_state *gts = NULL;
+
+       down_write(&mm->mmap_sem);
+       vma = gru_find_vma(vaddr);
+       if (vma)
+               gts = gru_alloc_thread_state(vma, TSID(vaddr, vma));
+       if (gts) {
+               mutex_lock(&gts->ts_ctxlock);
+               downgrade_write(&mm->mmap_sem);
+       } else {
+               up_write(&mm->mmap_sem);
+       }
+
+       return gts;
+}
+
+/*
+ * Unlock a GTS that was previously locked with gru_find_lock_gts().
+ */
+static void gru_unlock_gts(struct gru_thread_state *gts)
+{
+       mutex_unlock(&gts->ts_ctxlock);
+       up_read(&current->mm->mmap_sem);
+}
+
+/*
+ * Set a CB.istatus to active using a user virtual address. This must be done
+ * just prior to a TFH RESTART. The new cb.istatus is an in-cache status ONLY.
+ * If the line is evicted, the status may be lost. The in-cache update
+ * is necessary to prevent the user from seeing a stale cb.istatus that will
+ * change as soon as the TFH restart is complete. Races may cause an
+ * occasional failure to clear the cb.istatus, but that is ok.
+ *
+ * If the cb address is not valid (should not happen, but...), nothing
+ * bad will happen.. The get_user()/put_user() will fail but there
+ * are no bad side-effects.
+ */
+static void gru_cb_set_istatus_active(unsigned long __user *cb)
+{
+       union {
+               struct gru_instruction_bits bits;
+               unsigned long dw;
+       } u;
+
+       if (cb) {
+               get_user(u.dw, cb);
+               u.bits.istatus = CBS_ACTIVE;
+               put_user(u.dw, cb);
+       }
+}
+
+/*
+ * Convert a interrupt IRQ to a pointer to the GRU GTS that caused the
+ * interrupt. Interrupts are always sent to a cpu on the blade that contains the
+ * GRU (except for headless blades which are not currently supported). A blade
+ * has N grus; a block of N consecutive IRQs is assigned to the GRUs. The IRQ
+ * number uniquely identifies the GRU chiplet on the local blade that caused the
+ * interrupt. Always called in interrupt context.
+ */
+static inline struct gru_state *irq_to_gru(int irq)
+{
+       return &gru_base[uv_numa_blade_id()]->bs_grus[irq - IRQ_GRU];
+}
+
+/*
+ * Read & clear a TFM
+ *
+ * The GRU has an array of fault maps. A map is private to a cpu
+ * Only one cpu will be accessing a cpu's fault map.
+ *
+ * This function scans the cpu-private fault map & clears all bits that
+ * are set. The function returns a bitmap that indicates the bits that
+ * were cleared. Note that sense the maps may be updated asynchronously by
+ * the GRU, atomic operations must be used to clear bits.
+ */
+static void get_clear_fault_map(struct gru_state *gru,
+                               struct gru_tlb_fault_map *map)
+{
+       unsigned long i, k;
+       struct gru_tlb_fault_map *tfm;
+
+       tfm = get_tfm_for_cpu(gru, gru_cpu_fault_map_id());
+       prefetchw(tfm);         /* Helps on hardware, required for emulator */
+       for (i = 0; i < BITS_TO_LONGS(GRU_NUM_CBE); i++) {
+               k = tfm->fault_bits[i];
+               if (k)
+                       k = xchg(&tfm->fault_bits[i], 0UL);
+               map->fault_bits[i] = k;
+       }
+
+       /*
+        * Not functionally required but helps performance. (Required
+        * on emulator)
+        */
+       gru_flush_cache(tfm);
+}
+
+/*
+ * Atomic (interrupt context) & non-atomic (user context) functions to
+ * convert a vaddr into a physical address. The size of the page
+ * is returned in pageshift.
+ *     returns:
+ *               0 - successful
+ *             < 0 - error code
+ *               1 - (atomic only) try again in non-atomic context
+ */
+static int non_atomic_pte_lookup(struct vm_area_struct *vma,
+                                unsigned long vaddr, int write,
+                                unsigned long *paddr, int *pageshift)
+{
+       struct page *page;
+
+       /* ZZZ Need to handle HUGE pages */
+       if (is_vm_hugetlb_page(vma))
+               return -EFAULT;
+       *pageshift = PAGE_SHIFT;
+       if (get_user_pages
+           (current, current->mm, vaddr, 1, write, 0, &page, NULL) <= 0)
+               return -EFAULT;
+       *paddr = page_to_phys(page);
+       put_page(page);
+       return 0;
+}
+
+/*
+ *
+ * atomic_pte_lookup
+ *
+ * Convert a user virtual address to a physical address
+ * Only supports Intel large pages (2MB only) on x86_64.
+ *     ZZZ - hugepage support is incomplete
+ */
+static int atomic_pte_lookup(struct vm_area_struct *vma, unsigned long vaddr,
+       int write, unsigned long *paddr, int *pageshift)
+{
+       pgd_t *pgdp;
+       pmd_t *pmdp;
+       pud_t *pudp;
+       pte_t pte;
+
+       WARN_ON(irqs_disabled());               /* ZZZ debug */
+
+       local_irq_disable();
+       pgdp = pgd_offset(vma->vm_mm, vaddr);
+       if (unlikely(pgd_none(*pgdp)))
+               goto err;
+
+       pudp = pud_offset(pgdp, vaddr);
+       if (unlikely(pud_none(*pudp)))
+               goto err;
+
+       pmdp = pmd_offset(pudp, vaddr);
+       if (unlikely(pmd_none(*pmdp)))
+               goto err;
+#ifdef CONFIG_X86_64
+       if (unlikely(pmd_large(*pmdp)))
+               pte = *(pte_t *) pmdp;
+       else
+#endif
+               pte = *pte_offset_kernel(pmdp, vaddr);
+
+       local_irq_enable();
+
+       if (unlikely(!pte_present(pte) ||
+                    (write && (!pte_write(pte) || !pte_dirty(pte)))))
+               return 1;
+
+       *paddr = pte_pfn(pte) << PAGE_SHIFT;
+       *pageshift = is_vm_hugetlb_page(vma) ? HPAGE_SHIFT : PAGE_SHIFT;
+       return 0;
+
+err:
+       local_irq_enable();
+       return 1;
+}
+
+/*
+ * Drop a TLB entry into the GRU. The fault is described by info in an TFH.
+ *     Input:
+ *             cb    Address of user CBR. Null if not running in user context
+ *     Return:
+ *               0 = dropin, exception, or switch to UPM successful
+ *               1 = range invalidate active
+ *             < 0 = error code
+ *
+ */
+static int gru_try_dropin(struct gru_thread_state *gts,
+                         struct gru_tlb_fault_handle *tfh,
+                         unsigned long __user *cb)
+{
+       struct mm_struct *mm = gts->ts_mm;
+       struct vm_area_struct *vma;
+       int pageshift, asid, write, ret;
+       unsigned long paddr, gpa, vaddr;
+
+       /*
+        * NOTE: The GRU contains magic hardware that eliminates races between
+        * TLB invalidates and TLB dropins. If an invalidate occurs
+        * in the window between reading the TFH and the subsequent TLB dropin,
+        * the dropin is ignored. This eliminates the need for additional locks.
+        */
+
+       /*
+        * Error if TFH state is IDLE or FMM mode & the user issuing a UPM call.
+        * Might be a hardware race OR a stupid user. Ignore FMM because FMM
+        * is a transient state.
+        */
+       if (tfh->state == TFHSTATE_IDLE)
+               goto failidle;
+       if (tfh->state == TFHSTATE_MISS_FMM && cb)
+               goto failfmm;
+
+       write = (tfh->cause & TFHCAUSE_TLB_MOD) != 0;
+       vaddr = tfh->missvaddr;
+       asid = tfh->missasid;
+       if (asid == 0)
+               goto failnoasid;
+
+       rmb();  /* TFH must be cache resident before reading ms_range_active */
+
+       /*
+        * TFH is cache resident - at least briefly. Fail the dropin
+        * if a range invalidate is active.
+        */
+       if (atomic_read(&gts->ts_gms->ms_range_active))
+               goto failactive;
+
+       vma = find_vma(mm, vaddr);
+       if (!vma)
+               goto failinval;
+
+       /*
+        * Atomic lookup is faster & usually works even if called in non-atomic
+        * context.
+        */
+       ret = atomic_pte_lookup(vma, vaddr, write, &paddr, &pageshift);
+       if (ret) {
+               if (!cb)
+                       goto failupm;
+               if (non_atomic_pte_lookup(vma, vaddr, write, &paddr,
+                                         &pageshift))
+                       goto failinval;
+       }
+       if (is_gru_paddr(paddr))
+               goto failinval;
+
+       paddr = paddr & ~((1UL << pageshift) - 1);
+       gpa = uv_soc_phys_ram_to_gpa(paddr);
+       gru_cb_set_istatus_active(cb);
+       tfh_write_restart(tfh, gpa, GAA_RAM, vaddr, asid, write,
+                         GRU_PAGESIZE(pageshift));
+       STAT(tlb_dropin);
+       gru_dbg(grudev,
+               "%s: tfh 0x%p, vaddr 0x%lx, asid 0x%x, ps %d, gpa 0x%lx\n",
+               ret ? "non-atomic" : "atomic", tfh, vaddr, asid,
+               pageshift, gpa);
+       return 0;
+
+failnoasid:
+       /* No asid (delayed unload). */
+       STAT(tlb_dropin_fail_no_asid);
+       gru_dbg(grudev, "FAILED no_asid tfh: 0x%p, vaddr 0x%lx\n", tfh, vaddr);
+       if (!cb)
+               tfh_user_polling_mode(tfh);
+       else
+               gru_flush_cache(tfh);
+       return -EAGAIN;
+
+failupm:
+       /* Atomic failure switch CBR to UPM */
+       tfh_user_polling_mode(tfh);
+       STAT(tlb_dropin_fail_upm);
+       gru_dbg(grudev, "FAILED upm tfh: 0x%p, vaddr 0x%lx\n", tfh, vaddr);
+       return 1;
+
+failfmm:
+       /* FMM state on UPM call */
+       STAT(tlb_dropin_fail_fmm);
+       gru_dbg(grudev, "FAILED fmm tfh: 0x%p, state %d\n", tfh, tfh->state);
+       return 0;
+
+failidle:
+       /* TFH was idle  - no miss pending */
+       gru_flush_cache(tfh);
+       if (cb)
+               gru_flush_cache(cb);
+       STAT(tlb_dropin_fail_idle);
+       gru_dbg(grudev, "FAILED idle tfh: 0x%p, state %d\n", tfh, tfh->state);
+       return 0;
+
+failinval:
+       /* All errors (atomic & non-atomic) switch CBR to EXCEPTION state */
+       tfh_exception(tfh);
+       STAT(tlb_dropin_fail_invalid);
+       gru_dbg(grudev, "FAILED inval tfh: 0x%p, vaddr 0x%lx\n", tfh, vaddr);
+       return -EFAULT;
+
+failactive:
+       /* Range invalidate active. Switch to UPM iff atomic */
+       if (!cb)
+               tfh_user_polling_mode(tfh);
+       else
+               gru_flush_cache(tfh);
+       STAT(tlb_dropin_fail_range_active);
+       gru_dbg(grudev, "FAILED range active: tfh 0x%p, vaddr 0x%lx\n",
+               tfh, vaddr);
+       return 1;
+}
+
+/*
+ * Process an external interrupt from the GRU. This interrupt is
+ * caused by a TLB miss.
+ * Note that this is the interrupt handler that is registered with linux
+ * interrupt handlers.
+ */
+irqreturn_t gru_intr(int irq, void *dev_id)
+{
+       struct gru_state *gru;
+       struct gru_tlb_fault_map map;
+       struct gru_thread_state *gts;
+       struct gru_tlb_fault_handle *tfh = NULL;
+       int cbrnum, ctxnum;
+
+       STAT(intr);
+
+       gru = irq_to_gru(irq);
+       if (!gru) {
+               dev_err(grudev, "GRU: invalid interrupt: cpu %d, irq %d\n",
+                       raw_smp_processor_id(), irq);
+               return IRQ_NONE;
+       }
+       get_clear_fault_map(gru, &map);
+       gru_dbg(grudev, "irq %d, gru %x, map 0x%lx\n", irq, gru->gs_gid,
+               map.fault_bits[0]);
+
+       for_each_cbr_in_tfm(cbrnum, map.fault_bits) {
+               tfh = get_tfh_by_index(gru, cbrnum);
+               prefetchw(tfh); /* Helps on hdw, required for emulator */
+
+               /*
+                * When hardware sets a bit in the faultmap, it implicitly
+                * locks the GRU context so that it cannot be unloaded.
+                * The gts cannot change until a TFH start/writestart command
+                * is issued.
+                */
+               ctxnum = tfh->ctxnum;
+               gts = gru->gs_gts[ctxnum];
+
+               /*
+                * This is running in interrupt context. Trylock the mmap_sem.
+                * If it fails, retry the fault in user context.
+                */
+               if (down_read_trylock(&gts->ts_mm->mmap_sem)) {
+                       gru_try_dropin(gts, tfh, NULL);
+                       up_read(&gts->ts_mm->mmap_sem);
+               } else {
+                       tfh_user_polling_mode(tfh);
+               }
+       }
+       return IRQ_HANDLED;
+}
+
+
+static int gru_user_dropin(struct gru_thread_state *gts,
+                          struct gru_tlb_fault_handle *tfh,
+                          unsigned long __user *cb)
+{
+       struct gru_mm_struct *gms = gts->ts_gms;
+       int ret;
+
+       while (1) {
+               wait_event(gms->ms_wait_queue,
+                          atomic_read(&gms->ms_range_active) == 0);
+               prefetchw(tfh); /* Helps on hdw, required for emulator */
+               ret = gru_try_dropin(gts, tfh, cb);
+               if (ret <= 0)
+                       return ret;
+               STAT(call_os_wait_queue);
+       }
+}
+
+/*
+ * This interface is called as a result of a user detecting a "call OS" bit
+ * in a user CB. Normally means that a TLB fault has occurred.
+ *     cb - user virtual address of the CB
+ */
+int gru_handle_user_call_os(unsigned long cb)
+{
+       struct gru_tlb_fault_handle *tfh;
+       struct gru_thread_state *gts;
+       unsigned long __user *cbp;
+       int ucbnum, cbrnum, ret = -EINVAL;
+
+       STAT(call_os);
+       gru_dbg(grudev, "address 0x%lx\n", cb);
+
+       /* sanity check the cb pointer */
+       ucbnum = get_cb_number((void *)cb);
+       if ((cb & (GRU_HANDLE_STRIDE - 1)) || ucbnum >= GRU_NUM_CB)
+               return -EINVAL;
+       cbp = (unsigned long *)cb;
+
+       gts = gru_find_lock_gts(cb);
+       if (!gts)
+               return -EINVAL;
+
+       if (ucbnum >= gts->ts_cbr_au_count * GRU_CBR_AU_SIZE) {
+               ret = -EINVAL;
+               goto exit;
+       }
+
+       /*
+        * If force_unload is set, the UPM TLB fault is phony. The task
+        * has migrated to another node and the GSEG must be moved. Just
+        * unload the context. The task will page fault and assign a new
+        * context.
+        */
+       ret = -EAGAIN;
+       cbrnum = thread_cbr_number(gts, ucbnum);
+       if (gts->ts_force_unload) {
+               gru_unload_context(gts, 1);
+       } else if (gts->ts_gru) {
+               tfh = get_tfh_by_index(gts->ts_gru, cbrnum);
+               ret = gru_user_dropin(gts, tfh, cbp);
+       }
+exit:
+       gru_unlock_gts(gts);
+       return ret;
+}
+
+/*
+ * Fetch the exception detail information for a CB that terminated with
+ * an exception.
+ */
+int gru_get_exception_detail(unsigned long arg)
+{
+       struct control_block_extended_exc_detail excdet;
+       struct gru_control_block_extended *cbe;
+       struct gru_thread_state *gts;
+       int ucbnum, cbrnum, ret;
+
+       STAT(user_exception);
+       if (copy_from_user(&excdet, (void __user *)arg, sizeof(excdet)))
+               return -EFAULT;
+
+       gru_dbg(grudev, "address 0x%lx\n", excdet.cb);
+       gts = gru_find_lock_gts(excdet.cb);
+       if (!gts)
+               return -EINVAL;
+
+       if (gts->ts_gru) {
+               ucbnum = get_cb_number((void *)excdet.cb);
+               cbrnum = thread_cbr_number(gts, ucbnum);
+               cbe = get_cbe_by_index(gts->ts_gru, cbrnum);
+               excdet.opc = cbe->opccpy;
+               excdet.exopc = cbe->exopccpy;
+               excdet.ecause = cbe->ecause;
+               excdet.exceptdet0 = cbe->idef1upd;
+               excdet.exceptdet1 = cbe->idef3upd;
+               ret = 0;
+       } else {
+               ret = -EAGAIN;
+       }
+       gru_unlock_gts(gts);
+
+       gru_dbg(grudev, "address 0x%lx, ecause 0x%x\n", excdet.cb,
+               excdet.ecause);
+       if (!ret && copy_to_user((void __user *)arg, &excdet, sizeof(excdet)))
+               ret = -EFAULT;
+       return ret;
+}
+
+/*
+ * User request to unload a context. Content is saved for possible reload.
+ */
+int gru_user_unload_context(unsigned long arg)
+{
+       struct gru_thread_state *gts;
+       struct gru_unload_context_req req;
+
+       STAT(user_unload_context);
+       if (copy_from_user(&req, (void __user *)arg, sizeof(req)))
+               return -EFAULT;
+
+       gru_dbg(grudev, "gseg 0x%lx\n", req.gseg);
+
+       gts = gru_find_lock_gts(req.gseg);
+       if (!gts)
+               return -EINVAL;
+
+       if (gts->ts_gru)
+               gru_unload_context(gts, 1);
+       gru_unlock_gts(gts);
+
+       return 0;
+}
+
+/*
+ * User request to flush a range of virtual addresses from the GRU TLB
+ * (Mainly for testing).
+ */
+int gru_user_flush_tlb(unsigned long arg)
+{
+       struct gru_thread_state *gts;
+       struct gru_flush_tlb_req req;
+
+       STAT(user_flush_tlb);
+       if (copy_from_user(&req, (void __user *)arg, sizeof(req)))
+               return -EFAULT;
+
+       gru_dbg(grudev, "gseg 0x%lx, vaddr 0x%lx, len 0x%lx\n", req.gseg,
+               req.vaddr, req.len);
+
+       gts = gru_find_lock_gts(req.gseg);
+       if (!gts)
+               return -EINVAL;
+
+       gru_flush_tlb_range(gts->ts_gms, req.vaddr, req.vaddr + req.len);
+       gru_unlock_gts(gts);
+
+       return 0;
+}
+
+/*
+ * Register the current task as the user of the GSEG slice.
+ * Needed for TLB fault interrupt targeting.
+ */
+int gru_set_task_slice(long address)
+{
+       struct gru_thread_state *gts;
+
+       STAT(set_task_slice);
+       gru_dbg(grudev, "address 0x%lx\n", address);
+       gts = gru_alloc_locked_gts(address);
+       if (!gts)
+               return -EINVAL;
+
+       gts->ts_tgid_owner = current->tgid;
+       gru_unlock_gts(gts);
+
+       return 0;
+}
diff --git a/drivers/misc/sgi-gru/grufile.c b/drivers/misc/sgi-gru/grufile.c
new file mode 100644 (file)
index 0000000..23c91f5
--- /dev/null
@@ -0,0 +1,485 @@
+/*
+ * SN Platform GRU Driver
+ *
+ *              FILE OPERATIONS & DRIVER INITIALIZATION
+ *
+ * This file supports the user system call for file open, close, mmap, etc.
+ * This also incudes the driver initialization code.
+ *
+ *  Copyright (c) 2008 Silicon Graphics, 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 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/errno.h>
+#include <linux/slab.h>
+#include <linux/mm.h>
+#include <linux/io.h>
+#include <linux/smp_lock.h>
+#include <linux/spinlock.h>
+#include <linux/device.h>
+#include <linux/miscdevice.h>
+#include <linux/interrupt.h>
+#include <linux/proc_fs.h>
+#include <linux/uaccess.h>
+#include "gru.h"
+#include "grulib.h"
+#include "grutables.h"
+
+#if defined CONFIG_X86_64
+#include <asm/genapic.h>
+#include <asm/irq.h>
+#define IS_UV()                is_uv_system()
+#elif defined CONFIG_IA64
+#include <asm/system.h>
+#include <asm/sn/simulator.h>
+/* temp support for running on hardware simulator */
+#define IS_UV()                IS_MEDUSA() || ia64_platform_is("uv")
+#else
+#define IS_UV()                0
+#endif
+
+#include <asm/uv/uv_hub.h>
+#include <asm/uv/uv_mmrs.h>
+
+struct gru_blade_state *gru_base[GRU_MAX_BLADES] __read_mostly;
+unsigned long gru_start_paddr, gru_end_paddr __read_mostly;
+struct gru_stats_s gru_stats;
+
+/* Guaranteed user available resources on each node */
+static int max_user_cbrs, max_user_dsr_bytes;
+
+static struct file_operations gru_fops;
+static struct miscdevice gru_miscdev;
+
+
+/*
+ * gru_vma_close
+ *
+ * Called when unmapping a device mapping. Frees all gru resources
+ * and tables belonging to the vma.
+ */
+static void gru_vma_close(struct vm_area_struct *vma)
+{
+       struct gru_vma_data *vdata;
+       struct gru_thread_state *gts;
+       struct list_head *entry, *next;
+
+       if (!vma->vm_private_data)
+               return;
+
+       vdata = vma->vm_private_data;
+       vma->vm_private_data = NULL;
+       gru_dbg(grudev, "vma %p, file %p, vdata %p\n", vma, vma->vm_file,
+                               vdata);
+       list_for_each_safe(entry, next, &vdata->vd_head) {
+               gts =
+                   list_entry(entry, struct gru_thread_state, ts_next);
+               list_del(&gts->ts_next);
+               mutex_lock(&gts->ts_ctxlock);
+               if (gts->ts_gru)
+                       gru_unload_context(gts, 0);
+               mutex_unlock(&gts->ts_ctxlock);
+               gts_drop(gts);
+       }
+       kfree(vdata);
+       STAT(vdata_free);
+}
+
+/*
+ * gru_file_mmap
+ *
+ * Called when mmaping the device.  Initializes the vma with a fault handler
+ * and private data structure necessary to allocate, track, and free the
+ * underlying pages.
+ */
+static int gru_file_mmap(struct file *file, struct vm_area_struct *vma)
+{
+       if ((vma->vm_flags & (VM_SHARED | VM_WRITE)) != (VM_SHARED | VM_WRITE))
+               return -EPERM;
+
+       if (vma->vm_start & (GRU_GSEG_PAGESIZE - 1) ||
+                       vma->vm_end & (GRU_GSEG_PAGESIZE - 1))
+               return -EINVAL;
+
+       vma->vm_flags |=
+           (VM_IO | VM_DONTCOPY | VM_LOCKED | VM_DONTEXPAND | VM_PFNMAP |
+                       VM_RESERVED);
+       vma->vm_page_prot = PAGE_SHARED;
+       vma->vm_ops = &gru_vm_ops;
+
+       vma->vm_private_data = gru_alloc_vma_data(vma, 0);
+       if (!vma->vm_private_data)
+               return -ENOMEM;
+
+       gru_dbg(grudev, "file %p, vaddr 0x%lx, vma %p, vdata %p\n",
+               file, vma->vm_start, vma, vma->vm_private_data);
+       return 0;
+}
+
+/*
+ * Create a new GRU context
+ */
+static int gru_create_new_context(unsigned long arg)
+{
+       struct gru_create_context_req req;
+       struct vm_area_struct *vma;
+       struct gru_vma_data *vdata;
+       int ret = -EINVAL;
+
+
+       if (copy_from_user(&req, (void __user *)arg, sizeof(req)))
+               return -EFAULT;
+
+       if (req.data_segment_bytes == 0 ||
+                               req.data_segment_bytes > max_user_dsr_bytes)
+               return -EINVAL;
+       if (!req.control_blocks || !req.maximum_thread_count ||
+                               req.control_blocks > max_user_cbrs)
+               return -EINVAL;
+
+       if (!(req.options & GRU_OPT_MISS_MASK))
+               req.options |= GRU_OPT_MISS_FMM_INTR;
+
+       down_write(&current->mm->mmap_sem);
+       vma = gru_find_vma(req.gseg);
+       if (vma) {
+               vdata = vma->vm_private_data;
+               vdata->vd_user_options = req.options;
+               vdata->vd_dsr_au_count =
+                   GRU_DS_BYTES_TO_AU(req.data_segment_bytes);
+               vdata->vd_cbr_au_count = GRU_CB_COUNT_TO_AU(req.control_blocks);
+               ret = 0;
+       }
+       up_write(&current->mm->mmap_sem);
+
+       return ret;
+}
+
+/*
+ * Get GRU configuration info (temp - for emulator testing)
+ */
+static long gru_get_config_info(unsigned long arg)
+{
+       struct gru_config_info info;
+       int nodesperblade;
+
+       if (num_online_nodes() > 1 &&
+                       (uv_node_to_blade_id(1) == uv_node_to_blade_id(0)))
+               nodesperblade = 2;
+       else
+               nodesperblade = 1;
+       info.cpus = num_online_cpus();
+       info.nodes = num_online_nodes();
+       info.blades = info.nodes / nodesperblade;
+       info.chiplets = GRU_CHIPLETS_PER_BLADE * info.blades;
+
+       if (copy_to_user((void __user *)arg, &info, sizeof(info)))
+               return -EFAULT;
+       return 0;
+}
+
+/*
+ * Get GRU chiplet status
+ */
+static long gru_get_chiplet_status(unsigned long arg)
+{
+       struct gru_state *gru;
+       struct gru_chiplet_info info;
+
+       if (copy_from_user(&info, (void __user *)arg, sizeof(info)))
+               return -EFAULT;
+
+       if (info.node == -1)
+               info.node = numa_node_id();
+       if (info.node >= num_possible_nodes() ||
+                       info.chiplet >= GRU_CHIPLETS_PER_HUB ||
+                       info.node < 0 || info.chiplet < 0)
+               return -EINVAL;
+
+       info.blade = uv_node_to_blade_id(info.node);
+       gru = get_gru(info.blade, info.chiplet);
+
+       info.total_dsr_bytes = GRU_NUM_DSR_BYTES;
+       info.total_cbr = GRU_NUM_CB;
+       info.total_user_dsr_bytes = GRU_NUM_DSR_BYTES -
+               gru->gs_reserved_dsr_bytes;
+       info.total_user_cbr = GRU_NUM_CB - gru->gs_reserved_cbrs;
+       info.free_user_dsr_bytes = hweight64(gru->gs_dsr_map) *
+                       GRU_DSR_AU_BYTES;
+       info.free_user_cbr = hweight64(gru->gs_cbr_map) * GRU_CBR_AU_SIZE;
+
+       if (copy_to_user((void __user *)arg, &info, sizeof(info)))
+               return -EFAULT;
+       return 0;
+}
+
+/*
+ * gru_file_unlocked_ioctl
+ *
+ * Called to update file attributes via IOCTL calls.
+ */
+static long gru_file_unlocked_ioctl(struct file *file, unsigned int req,
+                                   unsigned long arg)
+{
+       int err = -EBADRQC;
+
+       gru_dbg(grudev, "file %p\n", file);
+
+       switch (req) {
+       case GRU_CREATE_CONTEXT:
+               err = gru_create_new_context(arg);
+               break;
+       case GRU_SET_TASK_SLICE:
+               err = gru_set_task_slice(arg);
+               break;
+       case GRU_USER_GET_EXCEPTION_DETAIL:
+               err = gru_get_exception_detail(arg);
+               break;
+       case GRU_USER_UNLOAD_CONTEXT:
+               err = gru_user_unload_context(arg);
+               break;
+       case GRU_GET_CHIPLET_STATUS:
+               err = gru_get_chiplet_status(arg);
+               break;
+       case GRU_USER_FLUSH_TLB:
+               err = gru_user_flush_tlb(arg);
+               break;
+       case GRU_USER_CALL_OS:
+               err = gru_handle_user_call_os(arg);
+               break;
+       case GRU_GET_CONFIG_INFO:
+               err = gru_get_config_info(arg);
+               break;
+       }
+       return err;
+}
+
+/*
+ * Called at init time to build tables for all GRUs that are present in the
+ * system.
+ */
+static void gru_init_chiplet(struct gru_state *gru, unsigned long paddr,
+                            void *vaddr, int nid, int bid, int grunum)
+{
+       spin_lock_init(&gru->gs_lock);
+       spin_lock_init(&gru->gs_asid_lock);
+       gru->gs_gru_base_paddr = paddr;
+       gru->gs_gru_base_vaddr = vaddr;
+       gru->gs_gid = bid * GRU_CHIPLETS_PER_BLADE + grunum;
+       gru->gs_blade = gru_base[bid];
+       gru->gs_blade_id = bid;
+       gru->gs_cbr_map = (GRU_CBR_AU == 64) ? ~0 : (1UL << GRU_CBR_AU) - 1;
+       gru->gs_dsr_map = (1UL << GRU_DSR_AU) - 1;
+       gru_tgh_flush_init(gru);
+       gru_dbg(grudev, "bid %d, nid %d, gru %x, vaddr %p (0x%lx)\n",
+               bid, nid, gru->gs_gid, gru->gs_gru_base_vaddr,
+               gru->gs_gru_base_paddr);
+       gru_kservices_init(gru);
+}
+
+static int gru_init_tables(unsigned long gru_base_paddr, void *gru_base_vaddr)
+{
+       int pnode, nid, bid, chip;
+       int cbrs, dsrbytes, n;
+       int order = get_order(sizeof(struct gru_blade_state));
+       struct page *page;
+       struct gru_state *gru;
+       unsigned long paddr;
+       void *vaddr;
+
+       max_user_cbrs = GRU_NUM_CB;
+       max_user_dsr_bytes = GRU_NUM_DSR_BYTES;
+       for_each_online_node(nid) {
+               bid = uv_node_to_blade_id(nid);
+               pnode = uv_node_to_pnode(nid);
+               if (gru_base[bid])
+                       continue;
+               page = alloc_pages_node(nid, GFP_KERNEL, order);
+               if (!page)
+                       goto fail;
+               gru_base[bid] = page_address(page);
+               memset(gru_base[bid], 0, sizeof(struct gru_blade_state));
+               gru_base[bid]->bs_lru_gru = &gru_base[bid]->bs_grus[0];
+               spin_lock_init(&gru_base[bid]->bs_lock);
+
+               dsrbytes = 0;
+               cbrs = 0;
+               for (gru = gru_base[bid]->bs_grus, chip = 0;
+                               chip < GRU_CHIPLETS_PER_BLADE;
+                               chip++, gru++) {
+                       paddr = gru_chiplet_paddr(gru_base_paddr, pnode, chip);
+                       vaddr = gru_chiplet_vaddr(gru_base_vaddr, pnode, chip);
+                       gru_init_chiplet(gru, paddr, vaddr, bid, nid, chip);
+                       n = hweight64(gru->gs_cbr_map) * GRU_CBR_AU_SIZE;
+                       cbrs = max(cbrs, n);
+                       n = hweight64(gru->gs_dsr_map) * GRU_DSR_AU_BYTES;
+                       dsrbytes = max(dsrbytes, n);
+               }
+               max_user_cbrs = min(max_user_cbrs, cbrs);
+               max_user_dsr_bytes = min(max_user_dsr_bytes, dsrbytes);
+       }
+
+       return 0;
+
+fail:
+       for (nid--; nid >= 0; nid--)
+               free_pages((unsigned long)gru_base[nid], order);
+       return -ENOMEM;
+}
+
+#ifdef CONFIG_IA64
+
+static int get_base_irq(void)
+{
+       return IRQ_GRU;
+}
+
+#elif defined CONFIG_X86_64
+
+static void noop(unsigned int irq)
+{
+}
+
+static struct irq_chip gru_chip = {
+       .name           = "gru",
+       .mask           = noop,
+       .unmask         = noop,
+       .ack            = noop,
+};
+
+static int get_base_irq(void)
+{
+       set_irq_chip(IRQ_GRU, &gru_chip);
+       set_irq_chip(IRQ_GRU + 1, &gru_chip);
+       return IRQ_GRU;
+}
+#endif
+
+/*
+ * gru_init
+ *
+ * Called at boot or module load time to initialize the GRUs.
+ */
+static int __init gru_init(void)
+{
+       int ret, irq, chip;
+       char id[10];
+       void *gru_start_vaddr;
+
+       if (!IS_UV())
+               return 0;
+
+#if defined CONFIG_IA64
+       gru_start_paddr = 0xd000000000UL; /* ZZZZZZZZZZZZZZZZZZZ fixme */
+#else
+       gru_start_paddr = uv_read_local_mmr(UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR) &
+                               0x7fffffffffffUL;
+
+#endif
+       gru_start_vaddr = __va(gru_start_paddr);
+       gru_end_paddr = gru_start_paddr + MAX_NUMNODES * GRU_SIZE;
+       printk(KERN_INFO "GRU space: 0x%lx - 0x%lx\n",
+              gru_start_paddr, gru_end_paddr);
+       irq = get_base_irq();
+       for (chip = 0; chip < GRU_CHIPLETS_PER_BLADE; chip++) {
+               ret = request_irq(irq + chip, gru_intr, 0, id, NULL);
+               if (ret) {
+                       printk(KERN_ERR "%s: request_irq failed\n",
+                              GRU_DRIVER_ID_STR);
+                       goto exit1;
+               }
+       }
+
+       ret = misc_register(&gru_miscdev);
+       if (ret) {
+               printk(KERN_ERR "%s: misc_register failed\n",
+                      GRU_DRIVER_ID_STR);
+               goto exit1;
+       }
+
+       ret = gru_proc_init();
+       if (ret) {
+               printk(KERN_ERR "%s: proc init failed\n", GRU_DRIVER_ID_STR);
+               goto exit2;
+       }
+
+       ret = gru_init_tables(gru_start_paddr, gru_start_vaddr);
+       if (ret) {
+               printk(KERN_ERR "%s: init tables failed\n", GRU_DRIVER_ID_STR);
+               goto exit3;
+       }
+
+       printk(KERN_INFO "%s: v%s\n", GRU_DRIVER_ID_STR,
+              GRU_DRIVER_VERSION_STR);
+       return 0;
+
+exit3:
+       gru_proc_exit();
+exit2:
+       misc_deregister(&gru_miscdev);
+exit1:
+       for (--chip; chip >= 0; chip--)
+               free_irq(irq + chip, NULL);
+       return ret;
+
+}
+
+static void __exit gru_exit(void)
+{
+       int i, bid;
+       int order = get_order(sizeof(struct gru_state) *
+                             GRU_CHIPLETS_PER_BLADE);
+
+       for (i = 0; i < GRU_CHIPLETS_PER_BLADE; i++)
+               free_irq(IRQ_GRU + i, NULL);
+
+       for (bid = 0; bid < GRU_MAX_BLADES; bid++)
+               free_pages((unsigned long)gru_base[bid], order);
+
+       misc_deregister(&gru_miscdev);
+       gru_proc_exit();
+}
+
+static struct file_operations gru_fops = {
+       .owner          = THIS_MODULE,
+       .unlocked_ioctl = gru_file_unlocked_ioctl,
+       .mmap           = gru_file_mmap,
+};
+
+static struct miscdevice gru_miscdev = {
+       .minor          = MISC_DYNAMIC_MINOR,
+       .name           = "gru",
+       .fops           = &gru_fops,
+};
+
+struct vm_operations_struct gru_vm_ops = {
+       .close          = gru_vma_close,
+       .fault          = gru_fault,
+};
+
+module_init(gru_init);
+module_exit(gru_exit);
+
+module_param(gru_options, ulong, 0644);
+MODULE_PARM_DESC(gru_options, "Various debug options");
+
+MODULE_AUTHOR("Silicon Graphics, Inc.");
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION(GRU_DRIVER_ID_STR GRU_DRIVER_VERSION_STR);
+MODULE_VERSION(GRU_DRIVER_VERSION_STR);
+
diff --git a/drivers/misc/sgi-gru/gruhandles.h b/drivers/misc/sgi-gru/gruhandles.h
new file mode 100644 (file)
index 0000000..d16031d
--- /dev/null
@@ -0,0 +1,663 @@
+/*
+ * SN Platform GRU Driver
+ *
+ *              GRU HANDLE DEFINITION
+ *
+ *  Copyright (c) 2008 Silicon Graphics, 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 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 __GRUHANDLES_H__
+#define __GRUHANDLES_H__
+#include "gru_instructions.h"
+
+/*
+ * Manifest constants for GRU Memory Map
+ */
+#define GRU_GSEG0_BASE         0
+#define GRU_MCS_BASE           (64 * 1024 * 1024)
+#define GRU_SIZE               (128UL * 1024 * 1024)
+
+/* Handle & resource counts */
+#define GRU_NUM_CB             128
+#define GRU_NUM_DSR_BYTES      (32 * 1024)
+#define GRU_NUM_TFM            16
+#define GRU_NUM_TGH            24
+#define GRU_NUM_CBE            128
+#define GRU_NUM_TFH            128
+#define GRU_NUM_CCH            16
+#define GRU_NUM_GSH            1
+
+/* Maximum resource counts that can be reserved by user programs */
+#define GRU_NUM_USER_CBR       GRU_NUM_CBE
+#define GRU_NUM_USER_DSR_BYTES GRU_NUM_DSR_BYTES
+
+/* Bytes per handle & handle stride. Code assumes all cb, tfh, cbe handles
+ * are the same */
+#define GRU_HANDLE_BYTES       64
+#define GRU_HANDLE_STRIDE      256
+
+/* Base addresses of handles */
+#define GRU_TFM_BASE           (GRU_MCS_BASE + 0x00000)
+#define GRU_TGH_BASE           (GRU_MCS_BASE + 0x08000)
+#define GRU_CBE_BASE           (GRU_MCS_BASE + 0x10000)
+#define GRU_TFH_BASE           (GRU_MCS_BASE + 0x18000)
+#define GRU_CCH_BASE           (GRU_MCS_BASE + 0x20000)
+#define GRU_GSH_BASE           (GRU_MCS_BASE + 0x30000)
+
+/* User gseg constants */
+#define GRU_GSEG_STRIDE                (4 * 1024 * 1024)
+#define GSEG_BASE(a)           ((a) & ~(GRU_GSEG_PAGESIZE - 1))
+
+/* Data segment constants */
+#define GRU_DSR_AU_BYTES       1024
+#define GRU_DSR_CL             (GRU_NUM_DSR_BYTES / GRU_CACHE_LINE_BYTES)
+#define GRU_DSR_AU_CL          (GRU_DSR_AU_BYTES / GRU_CACHE_LINE_BYTES)
+#define GRU_DSR_AU             (GRU_NUM_DSR_BYTES / GRU_DSR_AU_BYTES)
+
+/* Control block constants */
+#define GRU_CBR_AU_SIZE                2
+#define GRU_CBR_AU             (GRU_NUM_CBE / GRU_CBR_AU_SIZE)
+
+/* Convert resource counts to the number of AU */
+#define GRU_DS_BYTES_TO_AU(n)  DIV_ROUND_UP(n, GRU_DSR_AU_BYTES)
+#define GRU_CB_COUNT_TO_AU(n)  DIV_ROUND_UP(n, GRU_CBR_AU_SIZE)
+
+/* UV limits */
+#define GRU_CHIPLETS_PER_HUB   2
+#define GRU_HUBS_PER_BLADE     1
+#define GRU_CHIPLETS_PER_BLADE (GRU_HUBS_PER_BLADE * GRU_CHIPLETS_PER_HUB)
+
+/* User GRU Gseg offsets */
+#define GRU_CB_BASE            0
+#define GRU_CB_LIMIT           (GRU_CB_BASE + GRU_HANDLE_STRIDE * GRU_NUM_CBE)
+#define GRU_DS_BASE            0x20000
+#define GRU_DS_LIMIT           (GRU_DS_BASE + GRU_NUM_DSR_BYTES)
+
+/* Convert a GRU physical address to the chiplet offset */
+#define GSEGPOFF(h)            ((h) & (GRU_SIZE - 1))
+
+/* Convert an arbitrary handle address to the beginning of the GRU segment */
+#ifndef __PLUGIN__
+#define GRUBASE(h)             ((void *)((unsigned long)(h) & ~(GRU_SIZE - 1)))
+#else
+extern void *gmu_grubase(void *h);
+#define GRUBASE(h)             gmu_grubase(h)
+#endif
+
+/* General addressing macros. */
+static inline void *get_gseg_base_address(void *base, int ctxnum)
+{
+       return (void *)(base + GRU_GSEG0_BASE + GRU_GSEG_STRIDE * ctxnum);
+}
+
+static inline void *get_gseg_base_address_cb(void *base, int ctxnum, int line)
+{
+       return (void *)(get_gseg_base_address(base, ctxnum) +
+                       GRU_CB_BASE + GRU_HANDLE_STRIDE * line);
+}
+
+static inline void *get_gseg_base_address_ds(void *base, int ctxnum, int line)
+{
+       return (void *)(get_gseg_base_address(base, ctxnum) + GRU_DS_BASE +
+                       GRU_CACHE_LINE_BYTES * line);
+}
+
+static inline struct gru_tlb_fault_map *get_tfm(void *base, int ctxnum)
+{
+       return (struct gru_tlb_fault_map *)(base + GRU_TFM_BASE +
+                                       ctxnum * GRU_HANDLE_STRIDE);
+}
+
+static inline struct gru_tlb_global_handle *get_tgh(void *base, int ctxnum)
+{
+       return (struct gru_tlb_global_handle *)(base + GRU_TGH_BASE +
+                                       ctxnum * GRU_HANDLE_STRIDE);
+}
+
+static inline struct gru_control_block_extended *get_cbe(void *base, int ctxnum)
+{
+       return (struct gru_control_block_extended *)(base + GRU_CBE_BASE +
+                                       ctxnum * GRU_HANDLE_STRIDE);
+}
+
+static inline struct gru_tlb_fault_handle *get_tfh(void *base, int ctxnum)
+{
+       return (struct gru_tlb_fault_handle *)(base + GRU_TFH_BASE +
+                                       ctxnum * GRU_HANDLE_STRIDE);
+}
+
+static inline struct gru_context_configuration_handle *get_cch(void *base,
+                                       int ctxnum)
+{
+       return (struct gru_context_configuration_handle *)(base +
+                               GRU_CCH_BASE + ctxnum * GRU_HANDLE_STRIDE);
+}
+
+static inline unsigned long get_cb_number(void *cb)
+{
+       return (((unsigned long)cb - GRU_CB_BASE) % GRU_GSEG_PAGESIZE) /
+                                       GRU_HANDLE_STRIDE;
+}
+
+/* byte offset to a specific GRU chiplet. (p=pnode, c=chiplet (0 or 1)*/
+static inline unsigned long gru_chiplet_paddr(unsigned long paddr, int pnode,
+                                                       int chiplet)
+{
+       return paddr + GRU_SIZE * (2 * pnode  + chiplet);
+}
+
+static inline void *gru_chiplet_vaddr(void *vaddr, int pnode, int chiplet)
+{
+       return vaddr + GRU_SIZE * (2 * pnode  + chiplet);
+}
+
+
+
+/*
+ * Global TLB Fault Map
+ *     Bitmap of outstanding TLB misses needing interrupt/polling service.
+ *
+ */
+struct gru_tlb_fault_map {
+       unsigned long fault_bits[BITS_TO_LONGS(GRU_NUM_CBE)];
+       unsigned long fill0[2];
+       unsigned long done_bits[BITS_TO_LONGS(GRU_NUM_CBE)];
+       unsigned long fill1[2];
+};
+
+/*
+ * TGH - TLB Global Handle
+ *     Used for TLB flushing.
+ *
+ */
+struct gru_tlb_global_handle {
+       unsigned int cmd:1;             /* DW 0 */
+       unsigned int delresp:1;
+       unsigned int opc:1;
+       unsigned int fill1:5;
+
+       unsigned int fill2:8;
+
+       unsigned int status:2;
+       unsigned long fill3:2;
+       unsigned int state:3;
+       unsigned long fill4:1;
+
+       unsigned int cause:3;
+       unsigned long fill5:37;
+
+       unsigned long vaddr:64;         /* DW 1 */
+
+       unsigned int asid:24;           /* DW 2 */
+       unsigned int fill6:8;
+
+       unsigned int pagesize:5;
+       unsigned int fill7:11;
+
+       unsigned int global:1;
+       unsigned int fill8:15;
+
+       unsigned long vaddrmask:39;     /* DW 3 */
+       unsigned int fill9:9;
+       unsigned int n:10;
+       unsigned int fill10:6;
+
+       unsigned int ctxbitmap:16;      /* DW4 */
+       unsigned long fill11[3];
+};
+
+enum gru_tgh_cmd {
+       TGHCMD_START
+};
+
+enum gru_tgh_opc {
+       TGHOP_TLBNOP,
+       TGHOP_TLBINV
+};
+
+enum gru_tgh_status {
+       TGHSTATUS_IDLE,
+       TGHSTATUS_EXCEPTION,
+       TGHSTATUS_ACTIVE
+};
+
+enum gru_tgh_state {
+       TGHSTATE_IDLE,
+       TGHSTATE_PE_INVAL,
+       TGHSTATE_INTERRUPT_INVAL,
+       TGHSTATE_WAITDONE,
+       TGHSTATE_RESTART_CTX,
+};
+
+/*
+ * TFH - TLB Global Handle
+ *     Used for TLB dropins into the GRU TLB.
+ *
+ */
+struct gru_tlb_fault_handle {
+       unsigned int cmd:1;             /* DW 0 - low 32*/
+       unsigned int delresp:1;
+       unsigned int fill0:2;
+       unsigned int opc:3;
+       unsigned int fill1:9;
+
+       unsigned int status:2;
+       unsigned int fill2:1;
+       unsigned int color:1;
+       unsigned int state:3;
+       unsigned int fill3:1;
+
+       unsigned int cause:7;           /* DW 0 - high 32 */
+       unsigned int fill4:1;
+
+       unsigned int indexway:12;
+       unsigned int fill5:4;
+
+       unsigned int ctxnum:4;
+       unsigned int fill6:12;
+
+       unsigned long missvaddr:64;     /* DW 1 */
+
+       unsigned int missasid:24;       /* DW 2 */
+       unsigned int fill7:8;
+       unsigned int fillasid:24;
+       unsigned int dirty:1;
+       unsigned int gaa:2;
+       unsigned long fill8:5;
+
+       unsigned long pfn:41;           /* DW 3 */
+       unsigned int fill9:7;
+       unsigned int pagesize:5;
+       unsigned int fill10:11;
+
+       unsigned long fillvaddr:64;     /* DW 4 */
+
+       unsigned long fill11[3];
+};
+
+enum gru_tfh_opc {
+       TFHOP_NOOP,
+       TFHOP_RESTART,
+       TFHOP_WRITE_ONLY,
+       TFHOP_WRITE_RESTART,
+       TFHOP_EXCEPTION,
+       TFHOP_USER_POLLING_MODE = 7,
+};
+
+enum tfh_status {
+       TFHSTATUS_IDLE,
+       TFHSTATUS_EXCEPTION,
+       TFHSTATUS_ACTIVE,
+};
+
+enum tfh_state {
+       TFHSTATE_INACTIVE,
+       TFHSTATE_IDLE,
+       TFHSTATE_MISS_UPM,
+       TFHSTATE_MISS_FMM,
+       TFHSTATE_HW_ERR,
+       TFHSTATE_WRITE_TLB,
+       TFHSTATE_RESTART_CBR,
+};
+
+/* TFH cause bits */
+enum tfh_cause {
+       TFHCAUSE_NONE,
+       TFHCAUSE_TLB_MISS,
+       TFHCAUSE_TLB_MOD,
+       TFHCAUSE_HW_ERROR_RR,
+       TFHCAUSE_HW_ERROR_MAIN_ARRAY,
+       TFHCAUSE_HW_ERROR_VALID,
+       TFHCAUSE_HW_ERROR_PAGESIZE,
+       TFHCAUSE_INSTRUCTION_EXCEPTION,
+       TFHCAUSE_UNCORRECTIBLE_ERROR,
+};
+
+/* GAA values */
+#define GAA_RAM                                0x0
+#define GAA_NCRAM                      0x2
+#define GAA_MMIO                       0x1
+#define GAA_REGISTER                   0x3
+
+/* GRU paddr shift for pfn. (NOTE: shift is NOT by actual pagesize) */
+#define GRU_PADDR_SHIFT                        12
+
+/*
+ * Context Configuration handle
+ *     Used to allocate resources to a GSEG context.
+ *
+ */
+struct gru_context_configuration_handle {
+       unsigned int cmd:1;                     /* DW0 */
+       unsigned int delresp:1;
+       unsigned int opc:3;
+       unsigned int unmap_enable:1;
+       unsigned int req_slice_set_enable:1;
+       unsigned int req_slice:2;
+       unsigned int cb_int_enable:1;
+       unsigned int tlb_int_enable:1;
+       unsigned int tfm_fault_bit_enable:1;
+       unsigned int tlb_int_select:4;
+
+       unsigned int status:2;
+       unsigned int state:2;
+       unsigned int reserved2:4;
+
+       unsigned int cause:4;
+       unsigned int tfm_done_bit_enable:1;
+       unsigned int unused:3;
+
+       unsigned int dsr_allocation_map;
+
+       unsigned long cbr_allocation_map;       /* DW1 */
+
+       unsigned int asid[8];                   /* DW 2 - 5 */
+       unsigned short sizeavail[8];            /* DW 6 - 7 */
+} __attribute__ ((packed));
+
+enum gru_cch_opc {
+       CCHOP_START = 1,
+       CCHOP_ALLOCATE,
+       CCHOP_INTERRUPT,
+       CCHOP_DEALLOCATE,
+       CCHOP_INTERRUPT_SYNC,
+};
+
+enum gru_cch_status {
+       CCHSTATUS_IDLE,
+       CCHSTATUS_EXCEPTION,
+       CCHSTATUS_ACTIVE,
+};
+
+enum gru_cch_state {
+       CCHSTATE_INACTIVE,
+       CCHSTATE_MAPPED,
+       CCHSTATE_ACTIVE,
+       CCHSTATE_INTERRUPTED,
+};
+
+/* CCH Exception cause */
+enum gru_cch_cause {
+       CCHCAUSE_REGION_REGISTER_WRITE_ERROR = 1,
+       CCHCAUSE_ILLEGAL_OPCODE = 2,
+       CCHCAUSE_INVALID_START_REQUEST = 3,
+       CCHCAUSE_INVALID_ALLOCATION_REQUEST = 4,
+       CCHCAUSE_INVALID_DEALLOCATION_REQUEST = 5,
+       CCHCAUSE_INVALID_INTERRUPT_REQUEST = 6,
+       CCHCAUSE_CCH_BUSY = 7,
+       CCHCAUSE_NO_CBRS_TO_ALLOCATE = 8,
+       CCHCAUSE_BAD_TFM_CONFIG = 9,
+       CCHCAUSE_CBR_RESOURCES_OVERSUBSCRIPED = 10,
+       CCHCAUSE_DSR_RESOURCES_OVERSUBSCRIPED = 11,
+       CCHCAUSE_CBR_DEALLOCATION_ERROR = 12,
+};
+/*
+ * CBE - Control Block Extended
+ *     Maintains internal GRU state for active CBs.
+ *
+ */
+struct gru_control_block_extended {
+       unsigned int reserved0:1;       /* DW 0  - low */
+       unsigned int imacpy:3;
+       unsigned int reserved1:4;
+       unsigned int xtypecpy:3;
+       unsigned int iaa0cpy:2;
+       unsigned int iaa1cpy:2;
+       unsigned int reserved2:1;
+       unsigned int opccpy:8;
+       unsigned int exopccpy:8;
+
+       unsigned int idef2cpy:22;       /* DW 0  - high */
+       unsigned int reserved3:10;
+
+       unsigned int idef4cpy:22;       /* DW 1 */
+       unsigned int reserved4:10;
+       unsigned int idef4upd:22;
+       unsigned int reserved5:10;
+
+       unsigned long idef1upd:64;      /* DW 2 */
+
+       unsigned long idef5cpy:64;      /* DW 3 */
+
+       unsigned long idef6cpy:64;      /* DW 4 */
+
+       unsigned long idef3upd:64;      /* DW 5 */
+
+       unsigned long idef5upd:64;      /* DW 6 */
+
+       unsigned int idef2upd:22;       /* DW 7 */
+       unsigned int reserved6:10;
+
+       unsigned int ecause:20;
+       unsigned int cbrstate:4;
+       unsigned int cbrexecstatus:8;
+};
+
+enum gru_cbr_state {
+       CBRSTATE_INACTIVE,
+       CBRSTATE_IDLE,
+       CBRSTATE_PE_CHECK,
+       CBRSTATE_QUEUED,
+       CBRSTATE_WAIT_RESPONSE,
+       CBRSTATE_INTERRUPTED,
+       CBRSTATE_INTERRUPTED_MISS_FMM,
+       CBRSTATE_BUSY_INTERRUPT_MISS_FMM,
+       CBRSTATE_INTERRUPTED_MISS_UPM,
+       CBRSTATE_BUSY_INTERRUPTED_MISS_UPM,
+       CBRSTATE_REQUEST_ISSUE,
+       CBRSTATE_BUSY_INTERRUPT,
+};
+
+/* CBE cbrexecstatus bits */
+#define CBR_EXS_ABORT_OCC_BIT                  0
+#define CBR_EXS_INT_OCC_BIT                    1
+#define CBR_EXS_PENDING_BIT                    2
+#define CBR_EXS_QUEUED_BIT                     3
+#define CBR_EXS_TLBHW_BIT                      4
+#define CBR_EXS_EXCEPTION_BIT                  5
+
+#define CBR_EXS_ABORT_OCC                      (1 << CBR_EXS_ABORT_OCC_BIT)
+#define CBR_EXS_INT_OCC                                (1 << CBR_EXS_INT_OCC_BIT)
+#define CBR_EXS_PENDING                                (1 << CBR_EXS_PENDING_BIT)
+#define CBR_EXS_QUEUED                         (1 << CBR_EXS_QUEUED_BIT)
+#define CBR_EXS_TLBHW                          (1 << CBR_EXS_TLBHW_BIT)
+#define CBR_EXS_EXCEPTION                      (1 << CBR_EXS_EXCEPTION_BIT)
+
+/* CBE ecause bits  - defined in gru_instructions.h */
+
+/*
+ * Convert a processor pagesize into the strange encoded pagesize used by the
+ * GRU. Processor pagesize is encoded as log of bytes per page. (or PAGE_SHIFT)
+ *     pagesize        log pagesize    grupagesize
+ *       4k                    12      0
+ *      16k                    14      1
+ *      64k                    16      2
+ *     256k                    18      3
+ *       1m                    20      4
+ *       2m                    21      5
+ *       4m                    22      6
+ *      16m                    24      7
+ *      64m                    26      8
+ *     ...
+ */
+#define GRU_PAGESIZE(sh)       ((((sh) > 20 ? (sh) + 2: (sh)) >> 1) - 6)
+#define GRU_SIZEAVAIL(sh)      (1UL << GRU_PAGESIZE(sh))
+
+/* minimum TLB purge count to ensure a full purge */
+#define GRUMAXINVAL            1024UL
+
+
+/* Extract the status field from a kernel handle */
+#define GET_MSEG_HANDLE_STATUS(h)      (((*(unsigned long *)(h)) >> 16) & 3)
+
+static inline void start_instruction(void *h)
+{
+       unsigned long *w0 = h;
+
+       wmb();          /* setting CMD bit must be last */
+       *w0 = *w0 | 1;
+       gru_flush_cache(h);
+}
+
+static inline int wait_instruction_complete(void *h)
+{
+       int status;
+
+       do {
+               cpu_relax();
+               barrier();
+               status = GET_MSEG_HANDLE_STATUS(h);
+       } while (status == CCHSTATUS_ACTIVE);
+       return status;
+}
+
+#if defined CONFIG_IA64
+static inline void cch_allocate_set_asids(
+                 struct gru_context_configuration_handle *cch, int asidval)
+{
+       int i;
+
+       for (i = 0; i <= RGN_HPAGE; i++) {  /*  assume HPAGE is last region */
+               cch->asid[i] = (asidval++);
+#if 0
+               /* ZZZ hugepages not supported yet */
+               if (i == RGN_HPAGE)
+                       cch->sizeavail[i] = GRU_SIZEAVAIL(hpage_shift);
+               else
+#endif
+                       cch->sizeavail[i] = GRU_SIZEAVAIL(PAGE_SHIFT);
+       }
+}
+#elif defined CONFIG_X86_64
+static inline void cch_allocate_set_asids(
+                 struct gru_context_configuration_handle *cch, int asidval)
+{
+       int i;
+
+       for (i = 0; i < 8; i++) {
+               cch->asid[i] = asidval++;
+               cch->sizeavail[i] = GRU_SIZEAVAIL(PAGE_SHIFT) |
+                       GRU_SIZEAVAIL(21);
+       }
+}
+#endif
+
+static inline int cch_allocate(struct gru_context_configuration_handle *cch,
+                              int asidval, unsigned long cbrmap,
+                              unsigned long dsrmap)
+{
+       cch_allocate_set_asids(cch, asidval);
+       cch->dsr_allocation_map = dsrmap;
+       cch->cbr_allocation_map = cbrmap;
+       cch->opc = CCHOP_ALLOCATE;
+       start_instruction(cch);
+       return wait_instruction_complete(cch);
+}
+
+static inline int cch_start(struct gru_context_configuration_handle *cch)
+{
+       cch->opc = CCHOP_START;
+       start_instruction(cch);
+       return wait_instruction_complete(cch);
+}
+
+static inline int cch_interrupt(struct gru_context_configuration_handle *cch)
+{
+       cch->opc = CCHOP_INTERRUPT;
+       start_instruction(cch);
+       return wait_instruction_complete(cch);
+}
+
+static inline int cch_deallocate(struct gru_context_configuration_handle *cch)
+{
+       cch->opc = CCHOP_DEALLOCATE;
+       start_instruction(cch);
+       return wait_instruction_complete(cch);
+}
+
+static inline int cch_interrupt_sync(struct gru_context_configuration_handle
+                                    *cch)
+{
+       cch->opc = CCHOP_INTERRUPT_SYNC;
+       start_instruction(cch);
+       return wait_instruction_complete(cch);
+}
+
+static inline int tgh_invalidate(struct gru_tlb_global_handle *tgh,
+                                unsigned long vaddr, unsigned long vaddrmask,
+                                int asid, int pagesize, int global, int n,
+                                unsigned short ctxbitmap)
+{
+       tgh->vaddr = vaddr;
+       tgh->asid = asid;
+       tgh->pagesize = pagesize;
+       tgh->n = n;
+       tgh->global = global;
+       tgh->vaddrmask = vaddrmask;
+       tgh->ctxbitmap = ctxbitmap;
+       tgh->opc = TGHOP_TLBINV;
+       start_instruction(tgh);
+       return wait_instruction_complete(tgh);
+}
+
+static inline void tfh_write_only(struct gru_tlb_fault_handle *tfh,
+                                 unsigned long pfn, unsigned long vaddr,
+                                 int asid, int dirty, int pagesize)
+{
+       tfh->fillasid = asid;
+       tfh->fillvaddr = vaddr;
+       tfh->pfn = pfn;
+       tfh->dirty = dirty;
+       tfh->pagesize = pagesize;
+       tfh->opc = TFHOP_WRITE_ONLY;
+       start_instruction(tfh);
+}
+
+static inline void tfh_write_restart(struct gru_tlb_fault_handle *tfh,
+                                    unsigned long paddr, int gaa,
+                                    unsigned long vaddr, int asid, int dirty,
+                                    int pagesize)
+{
+       tfh->fillasid = asid;
+       tfh->fillvaddr = vaddr;
+       tfh->pfn = paddr >> GRU_PADDR_SHIFT;
+       tfh->gaa = gaa;
+       tfh->dirty = dirty;
+       tfh->pagesize = pagesize;
+       tfh->opc = TFHOP_WRITE_RESTART;
+       start_instruction(tfh);
+}
+
+static inline void tfh_restart(struct gru_tlb_fault_handle *tfh)
+{
+       tfh->opc = TFHOP_RESTART;
+       start_instruction(tfh);
+}
+
+static inline void tfh_user_polling_mode(struct gru_tlb_fault_handle *tfh)
+{
+       tfh->opc = TFHOP_USER_POLLING_MODE;
+       start_instruction(tfh);
+}
+
+static inline void tfh_exception(struct gru_tlb_fault_handle *tfh)
+{
+       tfh->opc = TFHOP_EXCEPTION;
+       start_instruction(tfh);
+}
+
+#endif /* __GRUHANDLES_H__ */
diff --git a/drivers/misc/sgi-gru/grukservices.c b/drivers/misc/sgi-gru/grukservices.c
new file mode 100644 (file)
index 0000000..dfd49af
--- /dev/null
@@ -0,0 +1,679 @@
+/*
+ * SN Platform GRU Driver
+ *
+ *              KERNEL SERVICES THAT USE THE GRU
+ *
+ *  Copyright (c) 2008 Silicon Graphics, 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 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/kernel.h>
+#include <linux/errno.h>
+#include <linux/slab.h>
+#include <linux/mm.h>
+#include <linux/smp_lock.h>
+#include <linux/spinlock.h>
+#include <linux/device.h>
+#include <linux/miscdevice.h>
+#include <linux/proc_fs.h>
+#include <linux/interrupt.h>
+#include <linux/uaccess.h>
+#include "gru.h"
+#include "grulib.h"
+#include "grutables.h"
+#include "grukservices.h"
+#include "gru_instructions.h"
+#include <asm/uv/uv_hub.h>
+
+/*
+ * Kernel GRU Usage
+ *
+ * The following is an interim algorithm for management of kernel GRU
+ * resources. This will likely be replaced when we better understand the
+ * kernel/user requirements.
+ *
+ * At boot time, the kernel permanently reserves a fixed number of
+ * CBRs/DSRs for each cpu to use. The resources are all taken from
+ * the GRU chiplet 1 on the blade. This leaves the full set of resources
+ * of chiplet 0 available to be allocated to a single user.
+ */
+
+/* Blade percpu resources PERMANENTLY reserved for kernel use */
+#define GRU_NUM_KERNEL_CBR      1
+#define GRU_NUM_KERNEL_DSR_BYTES 256
+#define KERNEL_CTXNUM           15
+
+/* GRU instruction attributes for all instructions */
+#define IMA                    IMA_CB_DELAY
+
+/* GRU cacheline size is always 64 bytes - even on arches with 128 byte lines */
+#define __gru_cacheline_aligned__                               \
+       __attribute__((__aligned__(GRU_CACHE_LINE_BYTES)))
+
+#define MAGIC  0x1234567887654321UL
+
+/* Default retry count for GRU errors on kernel instructions */
+#define EXCEPTION_RETRY_LIMIT  3
+
+/* Status of message queue sections */
+#define MQS_EMPTY              0
+#define MQS_FULL               1
+#define MQS_NOOP               2
+
+/*----------------- RESOURCE MANAGEMENT -------------------------------------*/
+/* optimized for x86_64 */
+struct message_queue {
+       union gru_mesqhead      head __gru_cacheline_aligned__; /* CL 0 */
+       int                     qlines;                         /* DW 1 */
+       long                    hstatus[2];
+       void                    *next __gru_cacheline_aligned__;/* CL 1 */
+       void                    *limit;
+       void                    *start;
+       void                    *start2;
+       char                    data ____cacheline_aligned;     /* CL 2 */
+};
+
+/* First word in every message - used by mesq interface */
+struct message_header {
+       char    present;
+       char    present2;
+       char    lines;
+       char    fill;
+};
+
+#define QLINES(mq)     ((mq) + offsetof(struct message_queue, qlines))
+#define HSTATUS(mq, h) ((mq) + offsetof(struct message_queue, hstatus[h]))
+
+static int gru_get_cpu_resources(int dsr_bytes, void **cb, void **dsr)
+{
+       struct gru_blade_state *bs;
+       int lcpu;
+
+       BUG_ON(dsr_bytes > GRU_NUM_KERNEL_DSR_BYTES);
+       preempt_disable();
+       bs = gru_base[uv_numa_blade_id()];
+       lcpu = uv_blade_processor_id();
+       *cb = bs->kernel_cb + lcpu * GRU_HANDLE_STRIDE;
+       *dsr = bs->kernel_dsr + lcpu * GRU_NUM_KERNEL_DSR_BYTES;
+       return 0;
+}
+
+static void gru_free_cpu_resources(void *cb, void *dsr)
+{
+       preempt_enable();
+}
+
+int gru_get_cb_exception_detail(void *cb,
+               struct control_block_extended_exc_detail *excdet)
+{
+       struct gru_control_block_extended *cbe;
+
+       cbe = get_cbe(GRUBASE(cb), get_cb_number(cb));
+       excdet->opc = cbe->opccpy;
+       excdet->exopc = cbe->exopccpy;
+       excdet->ecause = cbe->ecause;
+       excdet->exceptdet0 = cbe->idef1upd;
+       excdet->exceptdet1 = cbe->idef3upd;
+       return 0;
+}
+
+char *gru_get_cb_exception_detail_str(int ret, void *cb,
+                                     char *buf, int size)
+{
+       struct gru_control_block_status *gen = (void *)cb;
+       struct control_block_extended_exc_detail excdet;
+
+       if (ret > 0 && gen->istatus == CBS_EXCEPTION) {
+               gru_get_cb_exception_detail(cb, &excdet);
+               snprintf(buf, size,
+                       "GRU exception: cb %p, opc %d, exopc %d, ecause 0x%x,"
+                       "excdet0 0x%lx, excdet1 0x%x",
+                       gen, excdet.opc, excdet.exopc, excdet.ecause,
+                       excdet.exceptdet0, excdet.exceptdet1);
+       } else {
+               snprintf(buf, size, "No exception");
+       }
+       return buf;
+}
+
+static int gru_wait_idle_or_exception(struct gru_control_block_status *gen)
+{
+       while (gen->istatus >= CBS_ACTIVE) {
+               cpu_relax();
+               barrier();
+       }
+       return gen->istatus;
+}
+
+static int gru_retry_exception(void *cb)
+{
+       struct gru_control_block_status *gen = (void *)cb;
+       struct control_block_extended_exc_detail excdet;
+       int retry = EXCEPTION_RETRY_LIMIT;
+
+       while (1)  {
+               if (gru_get_cb_message_queue_substatus(cb))
+                       break;
+               if (gru_wait_idle_or_exception(gen) == CBS_IDLE)
+                       return CBS_IDLE;
+
+               gru_get_cb_exception_detail(cb, &excdet);
+               if (excdet.ecause & ~EXCEPTION_RETRY_BITS)
+                       break;
+               if (retry-- == 0)
+                       break;
+               gen->icmd = 1;
+               gru_flush_cache(gen);
+       }
+       return CBS_EXCEPTION;
+}
+
+int gru_check_status_proc(void *cb)
+{
+       struct gru_control_block_status *gen = (void *)cb;
+       int ret;
+
+       ret = gen->istatus;
+       if (ret != CBS_EXCEPTION)
+               return ret;
+       return gru_retry_exception(cb);
+
+}
+
+int gru_wait_proc(void *cb)
+{
+       struct gru_control_block_status *gen = (void *)cb;
+       int ret;
+
+       ret = gru_wait_idle_or_exception(gen);
+       if (ret == CBS_EXCEPTION)
+               ret = gru_retry_exception(cb);
+
+       return ret;
+}
+
+void gru_abort(int ret, void *cb, char *str)
+{
+       char buf[GRU_EXC_STR_SIZE];
+
+       panic("GRU FATAL ERROR: %s - %s\n", str,
+             gru_get_cb_exception_detail_str(ret, cb, buf, sizeof(buf)));
+}
+
+void gru_wait_abort_proc(void *cb)
+{
+       int ret;
+
+       ret = gru_wait_proc(cb);
+       if (ret)
+               gru_abort(ret, cb, "gru_wait_abort");
+}
+
+
+/*------------------------------ MESSAGE QUEUES -----------------------------*/
+
+/* Internal status . These are NOT returned to the user. */
+#define MQIE_AGAIN             -1      /* try again */
+
+
+/*
+ * Save/restore the "present" flag that is in the second line of 2-line
+ * messages
+ */
+static inline int get_present2(void *p)
+{
+       struct message_header *mhdr = p + GRU_CACHE_LINE_BYTES;
+       return mhdr->present;
+}
+
+static inline void restore_present2(void *p, int val)
+{
+       struct message_header *mhdr = p + GRU_CACHE_LINE_BYTES;
+       mhdr->present = val;
+}
+
+/*
+ * Create a message queue.
+ *     qlines - message queue size in cache lines. Includes 2-line header.
+ */
+int gru_create_message_queue(void *p, unsigned int bytes)
+{
+       struct message_queue *mq = p;
+       unsigned int qlines;
+
+       qlines = bytes / GRU_CACHE_LINE_BYTES - 2;
+       memset(mq, 0, bytes);
+       mq->start = &mq->data;
+       mq->start2 = &mq->data + (qlines / 2 - 1) * GRU_CACHE_LINE_BYTES;
+       mq->next = &mq->data;
+       mq->limit = &mq->data + (qlines - 2) * GRU_CACHE_LINE_BYTES;
+       mq->qlines = qlines;
+       mq->hstatus[0] = 0;
+       mq->hstatus[1] = 1;
+       mq->head = gru_mesq_head(2, qlines / 2 + 1);
+       return 0;
+}
+EXPORT_SYMBOL_GPL(gru_create_message_queue);
+
+/*
+ * Send a NOOP message to a message queue
+ *     Returns:
+ *              0 - if queue is full after the send. This is the normal case
+ *                  but various races can change this.
+ *             -1 - if mesq sent successfully but queue not full
+ *             >0 - unexpected error. MQE_xxx returned
+ */
+static int send_noop_message(void *cb,
+                               unsigned long mq, void *mesg)
+{
+       const struct message_header noop_header = {
+                                       .present = MQS_NOOP, .lines = 1};
+       unsigned long m;
+       int substatus, ret;
+       struct message_header save_mhdr, *mhdr = mesg;
+
+       STAT(mesq_noop);
+       save_mhdr = *mhdr;
+       *mhdr = noop_header;
+       gru_mesq(cb, mq, gru_get_tri(mhdr), 1, IMA);
+       ret = gru_wait(cb);
+
+       if (ret) {
+               substatus = gru_get_cb_message_queue_substatus(cb);
+               switch (substatus) {
+               case CBSS_NO_ERROR:
+                       STAT(mesq_noop_unexpected_error);
+                       ret = MQE_UNEXPECTED_CB_ERR;
+                       break;
+               case CBSS_LB_OVERFLOWED:
+                       STAT(mesq_noop_lb_overflow);
+                       ret = MQE_CONGESTION;
+                       break;
+               case CBSS_QLIMIT_REACHED:
+                       STAT(mesq_noop_qlimit_reached);
+                       ret = 0;
+                       break;
+               case CBSS_AMO_NACKED:
+                       STAT(mesq_noop_amo_nacked);
+                       ret = MQE_CONGESTION;
+                       break;
+               case CBSS_PUT_NACKED:
+                       STAT(mesq_noop_put_nacked);
+                       m = mq + (gru_get_amo_value_head(cb) << 6);
+                       gru_vstore(cb, m, gru_get_tri(mesg), XTYPE_CL, 1, 1,
+                                               IMA);
+                       if (gru_wait(cb) == CBS_IDLE)
+                               ret = MQIE_AGAIN;
+                       else
+                               ret = MQE_UNEXPECTED_CB_ERR;
+                       break;
+               case CBSS_PAGE_OVERFLOW:
+               default:
+                       BUG();
+               }
+       }
+       *mhdr = save_mhdr;
+       return ret;
+}
+
+/*
+ * Handle a gru_mesq full.
+ */
+static int send_message_queue_full(void *cb,
+                          unsigned long mq, void *mesg, int lines)
+{
+       union gru_mesqhead mqh;
+       unsigned int limit, head;
+       unsigned long avalue;
+       int half, qlines, save;
+
+       /* Determine if switching to first/second half of q */
+       avalue = gru_get_amo_value(cb);
+       head = gru_get_amo_value_head(cb);
+       limit = gru_get_amo_value_limit(cb);
+
+       /*
+        * Fetch "qlines" from the queue header. Since the queue may be
+        * in memory that can't be accessed using socket addresses, use
+        * the GRU to access the data. Use DSR space from the message.
+        */
+       save = *(int *)mesg;
+       gru_vload(cb, QLINES(mq), gru_get_tri(mesg), XTYPE_W, 1, 1, IMA);
+       if (gru_wait(cb) != CBS_IDLE)
+               goto cberr;
+       qlines = *(int *)mesg;
+       *(int *)mesg = save;
+       half = (limit != qlines);
+
+       if (half)
+               mqh = gru_mesq_head(qlines / 2 + 1, qlines);
+       else
+               mqh = gru_mesq_head(2, qlines / 2 + 1);
+
+       /* Try to get lock for switching head pointer */
+       gru_gamir(cb, EOP_IR_CLR, HSTATUS(mq, half), XTYPE_DW, IMA);
+       if (gru_wait(cb) != CBS_IDLE)
+               goto cberr;
+       if (!gru_get_amo_value(cb)) {
+               STAT(mesq_qf_locked);
+               return MQE_QUEUE_FULL;
+       }
+
+       /* Got the lock. Send optional NOP if queue not full, */
+       if (head != limit) {
+               if (send_noop_message(cb, mq, mesg)) {
+                       gru_gamir(cb, EOP_IR_INC, HSTATUS(mq, half),
+                                       XTYPE_DW, IMA);
+                       if (gru_wait(cb) != CBS_IDLE)
+                               goto cberr;
+                       STAT(mesq_qf_noop_not_full);
+                       return MQIE_AGAIN;
+               }
+               avalue++;
+       }
+
+       /* Then flip queuehead to other half of queue. */
+       gru_gamer(cb, EOP_ERR_CSWAP, mq, XTYPE_DW, mqh.val, avalue, IMA);
+       if (gru_wait(cb) != CBS_IDLE)
+               goto cberr;
+
+       /* If not successfully in swapping queue head, clear the hstatus lock */
+       if (gru_get_amo_value(cb) != avalue) {
+               STAT(mesq_qf_switch_head_failed);
+               gru_gamir(cb, EOP_IR_INC, HSTATUS(mq, half), XTYPE_DW, IMA);
+               if (gru_wait(cb) != CBS_IDLE)
+                       goto cberr;
+       }
+       return MQIE_AGAIN;
+cberr:
+       STAT(mesq_qf_unexpected_error);
+       return MQE_UNEXPECTED_CB_ERR;
+}
+
+
+/*
+ * Handle a gru_mesq failure. Some of these failures are software recoverable
+ * or retryable.
+ */
+static int send_message_failure(void *cb,
+                               unsigned long mq,
+                               void *mesg,
+                               int lines)
+{
+       int substatus, ret = 0;
+       unsigned long m;
+
+       substatus = gru_get_cb_message_queue_substatus(cb);
+       switch (substatus) {
+       case CBSS_NO_ERROR:
+               STAT(mesq_send_unexpected_error);
+               ret = MQE_UNEXPECTED_CB_ERR;
+               break;
+       case CBSS_LB_OVERFLOWED:
+               STAT(mesq_send_lb_overflow);
+               ret = MQE_CONGESTION;
+               break;
+       case CBSS_QLIMIT_REACHED:
+               STAT(mesq_send_qlimit_reached);
+               ret = send_message_queue_full(cb, mq, mesg, lines);
+               break;
+       case CBSS_AMO_NACKED:
+               STAT(mesq_send_amo_nacked);
+               ret = MQE_CONGESTION;
+               break;
+       case CBSS_PUT_NACKED:
+               STAT(mesq_send_put_nacked);
+               m =mq + (gru_get_amo_value_head(cb) << 6);
+               gru_vstore(cb, m, gru_get_tri(mesg), XTYPE_CL, lines, 1, IMA);
+               if (gru_wait(cb) == CBS_IDLE)
+                       ret = MQE_OK;
+               else
+                       ret = MQE_UNEXPECTED_CB_ERR;
+               break;
+       default:
+               BUG();
+       }
+       return ret;
+}
+
+/*
+ * Send a message to a message queue
+ *     cb      GRU control block to use to send message
+ *     mq      message queue
+ *     mesg    message. ust be vaddr within a GSEG
+ *     bytes   message size (<= 2 CL)
+ */
+int gru_send_message_gpa(unsigned long mq, void *mesg, unsigned int bytes)
+{
+       struct message_header *mhdr;
+       void *cb;
+       void *dsr;
+       int istatus, clines, ret;
+
+       STAT(mesq_send);
+       BUG_ON(bytes < sizeof(int) || bytes > 2 * GRU_CACHE_LINE_BYTES);
+
+       clines = (bytes + GRU_CACHE_LINE_BYTES - 1) / GRU_CACHE_LINE_BYTES;
+       if (gru_get_cpu_resources(bytes, &cb, &dsr))
+               return MQE_BUG_NO_RESOURCES;
+       memcpy(dsr, mesg, bytes);
+       mhdr = dsr;
+       mhdr->present = MQS_FULL;
+       mhdr->lines = clines;
+       if (clines == 2) {
+               mhdr->present2 = get_present2(mhdr);
+               restore_present2(mhdr, MQS_FULL);
+       }
+
+       do {
+               ret = MQE_OK;
+               gru_mesq(cb, mq, gru_get_tri(mhdr), clines, IMA);
+               istatus = gru_wait(cb);
+               if (istatus != CBS_IDLE)
+                       ret = send_message_failure(cb, mq, dsr, clines);
+       } while (ret == MQIE_AGAIN);
+       gru_free_cpu_resources(cb, dsr);
+
+       if (ret)
+               STAT(mesq_send_failed);
+       return ret;
+}
+EXPORT_SYMBOL_GPL(gru_send_message_gpa);
+
+/*
+ * Advance the receive pointer for the queue to the next message.
+ */
+void gru_free_message(void *rmq, void *mesg)
+{
+       struct message_queue *mq = rmq;
+       struct message_header *mhdr = mq->next;
+       void *next, *pnext;
+       int half = -1;
+       int lines = mhdr->lines;
+
+       if (lines == 2)
+               restore_present2(mhdr, MQS_EMPTY);
+       mhdr->present = MQS_EMPTY;
+
+       pnext = mq->next;
+       next = pnext + GRU_CACHE_LINE_BYTES * lines;
+       if (next == mq->limit) {
+               next = mq->start;
+               half = 1;
+       } else if (pnext < mq->start2 && next >= mq->start2) {
+               half = 0;
+       }
+
+       if (half >= 0)
+               mq->hstatus[half] = 1;
+       mq->next = next;
+}
+EXPORT_SYMBOL_GPL(gru_free_message);
+
+/*
+ * Get next message from message queue. Return NULL if no message
+ * present. User must call next_message() to move to next message.
+ *     rmq     message queue
+ */
+void *gru_get_next_message(void *rmq)
+{
+       struct message_queue *mq = rmq;
+       struct message_header *mhdr = mq->next;
+       int present = mhdr->present;
+
+       /* skip NOOP messages */
+       STAT(mesq_receive);
+       while (present == MQS_NOOP) {
+               gru_free_message(rmq, mhdr);
+               mhdr = mq->next;
+               present = mhdr->present;
+       }
+
+       /* Wait for both halves of 2 line messages */
+       if (present == MQS_FULL && mhdr->lines == 2 &&
+                               get_present2(mhdr) == MQS_EMPTY)
+               present = MQS_EMPTY;
+
+       if (!present) {
+               STAT(mesq_receive_none);
+               return NULL;
+       }
+
+       if (mhdr->lines == 2)
+               restore_present2(mhdr, mhdr->present2);
+
+       return mhdr;
+}
+EXPORT_SYMBOL_GPL(gru_get_next_message);
+
+/* ---------------------- GRU DATA COPY FUNCTIONS ---------------------------*/
+
+/*
+ * Copy a block of data using the GRU resources
+ */
+int gru_copy_gpa(unsigned long dest_gpa, unsigned long src_gpa,
+                               unsigned int bytes)
+{
+       void *cb;
+       void *dsr;
+       int ret;
+
+       STAT(copy_gpa);
+       if (gru_get_cpu_resources(GRU_NUM_KERNEL_DSR_BYTES, &cb, &dsr))
+               return MQE_BUG_NO_RESOURCES;
+       gru_bcopy(cb, src_gpa, dest_gpa, gru_get_tri(dsr),
+                 XTYPE_B, bytes, GRU_NUM_KERNEL_DSR_BYTES, IMA);
+       ret = gru_wait(cb);
+       gru_free_cpu_resources(cb, dsr);
+       return ret;
+}
+EXPORT_SYMBOL_GPL(gru_copy_gpa);
+
+/* ------------------- KERNEL QUICKTESTS RUN AT STARTUP ----------------*/
+/*     Temp - will delete after we gain confidence in the GRU          */
+static __cacheline_aligned unsigned long word0;
+static __cacheline_aligned unsigned long word1;
+
+static int quicktest(struct gru_state *gru)
+{
+       void *cb;
+       void *ds;
+       unsigned long *p;
+
+       cb = get_gseg_base_address_cb(gru->gs_gru_base_vaddr, KERNEL_CTXNUM, 0);
+       ds = get_gseg_base_address_ds(gru->gs_gru_base_vaddr, KERNEL_CTXNUM, 0);
+       p = ds;
+       word0 = MAGIC;
+
+       gru_vload(cb, uv_gpa(&word0), 0, XTYPE_DW, 1, 1, IMA);
+       if (gru_wait(cb) != CBS_IDLE)
+               BUG();
+
+       if (*(unsigned long *)ds != MAGIC)
+               BUG();
+       gru_vstore(cb, uv_gpa(&word1), 0, XTYPE_DW, 1, 1, IMA);
+       if (gru_wait(cb) != CBS_IDLE)
+               BUG();
+
+       if (word0 != word1 || word0 != MAGIC) {
+               printk
+                   ("GRU quicktest err: gru %d, found 0x%lx, expected 0x%lx\n",
+                    gru->gs_gid, word1, MAGIC);
+               BUG();          /* ZZZ should not be fatal */
+       }
+
+       return 0;
+}
+
+
+int gru_kservices_init(struct gru_state *gru)
+{
+       struct gru_blade_state *bs;
+       struct gru_context_configuration_handle *cch;
+       unsigned long cbr_map, dsr_map;
+       int err, num, cpus_possible;
+
+       /*
+        * Currently, resources are reserved ONLY on the second chiplet
+        * on each blade. This leaves ALL resources on chiplet 0 available
+        * for user code.
+        */
+       bs = gru->gs_blade;
+       if (gru != &bs->bs_grus[1])
+               return 0;
+
+       cpus_possible = uv_blade_nr_possible_cpus(gru->gs_blade_id);
+
+       num = GRU_NUM_KERNEL_CBR * cpus_possible;
+       cbr_map = gru_reserve_cb_resources(gru, GRU_CB_COUNT_TO_AU(num), NULL);
+       gru->gs_reserved_cbrs += num;
+
+       num = GRU_NUM_KERNEL_DSR_BYTES * cpus_possible;
+       dsr_map = gru_reserve_ds_resources(gru, GRU_DS_BYTES_TO_AU(num), NULL);
+       gru->gs_reserved_dsr_bytes += num;
+
+       gru->gs_active_contexts++;
+       __set_bit(KERNEL_CTXNUM, &gru->gs_context_map);
+       cch = get_cch(gru->gs_gru_base_vaddr, KERNEL_CTXNUM);
+
+       bs->kernel_cb = get_gseg_base_address_cb(gru->gs_gru_base_vaddr,
+                                       KERNEL_CTXNUM, 0);
+       bs->kernel_dsr = get_gseg_base_address_ds(gru->gs_gru_base_vaddr,
+                                       KERNEL_CTXNUM, 0);
+
+       lock_cch_handle(cch);
+       cch->tfm_fault_bit_enable = 0;
+       cch->tlb_int_enable = 0;
+       cch->tfm_done_bit_enable = 0;
+       cch->unmap_enable = 1;
+       err = cch_allocate(cch, 0, cbr_map, dsr_map);
+       if (err) {
+               gru_dbg(grudev,
+                       "Unable to allocate kernel CCH: gru %d, err %d\n",
+                       gru->gs_gid, err);
+               BUG();
+       }
+       if (cch_start(cch)) {
+               gru_dbg(grudev, "Unable to start kernel CCH: gru %d, err %d\n",
+                       gru->gs_gid, err);
+               BUG();
+       }
+       unlock_cch_handle(cch);
+
+       if (gru_options & GRU_QUICKLOOK)
+               quicktest(gru);
+       return 0;
+}
diff --git a/drivers/misc/sgi-gru/grukservices.h b/drivers/misc/sgi-gru/grukservices.h
new file mode 100644 (file)
index 0000000..eb17e0a
--- /dev/null
@@ -0,0 +1,134 @@
+
+/*
+ *  Copyright (c) 2008 Silicon Graphics, 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 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 __GRU_KSERVICES_H_
+#define __GRU_KSERVICES_H_
+
+
+/*
+ * Message queues using the GRU to send/receive messages.
+ *
+ * These function allow the user to create a message queue for
+ * sending/receiving 1 or 2 cacheline messages using the GRU.
+ *
+ * Processes SENDING messages will use a kernel CBR/DSR to send
+ * the message. This is transparent to the caller.
+ *
+ * The receiver does not use any GRU resources.
+ *
+ * The functions support:
+ *     - single receiver
+ *     - multiple senders
+ *     - cross partition message
+ *
+ * Missing features ZZZ:
+ *     - user options for dealing with timeouts, queue full, etc.
+ *     - gru_create_message_queue() needs interrupt vector info
+ */
+
+/*
+ * Initialize a user allocated chunk of memory to be used as
+ * a message queue. The caller must ensure that the queue is
+ * in contiguous physical memory and is cacheline aligned.
+ *
+ * Message queue size is the total number of bytes allocated
+ * to the queue including a 2 cacheline header that is used
+ * to manage the queue.
+ *
+ *  Input:
+ *     p       pointer to user allocated memory.
+ *     bytes   size of message queue in bytes
+ *
+ *  Errors:
+ *     0       OK
+ *     >0      error
+ */
+extern int gru_create_message_queue(void *p, unsigned int bytes);
+
+/*
+ * Send a message to a message queue.
+ *
+ * Note: The message queue transport mechanism uses the first 32
+ * bits of the message. Users should avoid using these bits.
+ *
+ *
+ *   Input:
+ *     xmq     message queue - must be a UV global physical address
+ *     mesg    pointer to message. Must be 64-bit aligned
+ *     bytes   size of message in bytes
+ *
+ *   Output:
+ *      0      message sent
+ *     >0      Send failure - see error codes below
+ *
+ */
+extern int gru_send_message_gpa(unsigned long mq_gpa, void *mesg,
+                                               unsigned int bytes);
+
+/* Status values for gru_send_message() */
+#define MQE_OK                 0       /* message sent successfully */
+#define MQE_CONGESTION         1       /* temporary congestion, try again */
+#define MQE_QUEUE_FULL         2       /* queue is full */
+#define MQE_UNEXPECTED_CB_ERR  3       /* unexpected CB error */
+#define MQE_PAGE_OVERFLOW      10      /* BUG - queue overflowed a page */
+#define MQE_BUG_NO_RESOURCES   11      /* BUG - could not alloc GRU cb/dsr */
+
+/*
+ * Advance the receive pointer for the message queue to the next message.
+ * Note: current API requires messages to be gotten & freed in order. Future
+ * API extensions may allow for out-of-order freeing.
+ *
+ *   Input
+ *     mq      message queue
+ *     mesq    message being freed
+ */
+extern void gru_free_message(void *mq, void *mesq);
+
+/*
+ * Get next message from message queue. Returns pointer to
+ * message OR NULL if no message present.
+ * User must call gru_free_message() after message is processed
+ * in order to move the queue pointers to next message.
+ *
+ *   Input
+ *     mq      message queue
+ *
+ *   Output:
+ *     p       pointer to message
+ *     NULL    no message available
+ */
+extern void *gru_get_next_message(void *mq);
+
+
+/*
+ * Copy data using the GRU. Source or destination can be located in a remote
+ * partition.
+ *
+ *    Input:
+ *     dest_gpa        destination global physical address
+ *     src_gpa         source global physical address
+ *     bytes           number of bytes to copy
+ *
+ *    Output:
+ *     0               OK
+ *     >0              error
+ */
+extern int gru_copy_gpa(unsigned long dest_gpa, unsigned long src_gpa,
+                                                       unsigned int bytes);
+
+#endif                 /* __GRU_KSERVICES_H_ */
diff --git a/drivers/misc/sgi-gru/grulib.h b/drivers/misc/sgi-gru/grulib.h
new file mode 100644 (file)
index 0000000..e56e196
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ *  Copyright (c) 2008 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Lesser General Public License as published by
+ *  the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser 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 __GRULIB_H__
+#define __GRULIB_H__
+
+#define GRU_BASENAME           "gru"
+#define GRU_FULLNAME           "/dev/gru"
+#define GRU_IOCTL_NUM           'G'
+
+/*
+ * Maximum number of GRU segments that a user can have open
+ * ZZZ temp - set high for testing. Revisit.
+ */
+#define GRU_MAX_OPEN_CONTEXTS          32
+
+/* Set Number of Request Blocks */
+#define GRU_CREATE_CONTEXT             _IOWR(GRU_IOCTL_NUM, 1, void *)
+
+/* Register task as using the slice */
+#define GRU_SET_TASK_SLICE             _IOWR(GRU_IOCTL_NUM, 5, void *)
+
+/* Fetch exception detail */
+#define GRU_USER_GET_EXCEPTION_DETAIL  _IOWR(GRU_IOCTL_NUM, 6, void *)
+
+/* For user call_os handling - normally a TLB fault */
+#define GRU_USER_CALL_OS               _IOWR(GRU_IOCTL_NUM, 8, void *)
+
+/* For user unload context */
+#define GRU_USER_UNLOAD_CONTEXT                _IOWR(GRU_IOCTL_NUM, 9, void *)
+
+/* For fetching GRU chiplet status */
+#define GRU_GET_CHIPLET_STATUS         _IOWR(GRU_IOCTL_NUM, 10, void *)
+
+/* For user TLB flushing (primarily for tests) */
+#define GRU_USER_FLUSH_TLB             _IOWR(GRU_IOCTL_NUM, 50, void *)
+
+/* Get some config options (primarily for tests & emulator) */
+#define GRU_GET_CONFIG_INFO            _IOWR(GRU_IOCTL_NUM, 51, void *)
+
+#define CONTEXT_WINDOW_BYTES(th)        (GRU_GSEG_PAGESIZE * (th))
+#define THREAD_POINTER(p, th)          (p + GRU_GSEG_PAGESIZE * (th))
+
+/*
+ * Structure used to pass TLB flush parameters to the driver
+ */
+struct gru_create_context_req {
+       unsigned long           gseg;
+       unsigned int            data_segment_bytes;
+       unsigned int            control_blocks;
+       unsigned int            maximum_thread_count;
+       unsigned int            options;
+};
+
+/*
+ * Structure used to pass unload context parameters to the driver
+ */
+struct gru_unload_context_req {
+       unsigned long   gseg;
+};
+
+/*
+ * Structure used to pass TLB flush parameters to the driver
+ */
+struct gru_flush_tlb_req {
+       unsigned long   gseg;
+       unsigned long   vaddr;
+       size_t          len;
+};
+
+/*
+ * GRU configuration info (temp - for testing)
+ */
+struct gru_config_info {
+       int             cpus;
+       int             blades;
+       int             nodes;
+       int             chiplets;
+       int             fill[16];
+};
+
+#endif /* __GRULIB_H__ */
diff --git a/drivers/misc/sgi-gru/grumain.c b/drivers/misc/sgi-gru/grumain.c
new file mode 100644 (file)
index 0000000..0eeb8dd
--- /dev/null
@@ -0,0 +1,802 @@
+/*
+ * SN Platform GRU Driver
+ *
+ *            DRIVER TABLE MANAGER + GRU CONTEXT LOAD/UNLOAD
+ *
+ * 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) 2008 Silicon Graphics, Inc.  All Rights Reserved.
+ */
+
+#include <linux/kernel.h>
+#include <linux/slab.h>
+#include <linux/mm.h>
+#include <linux/spinlock.h>
+#include <linux/sched.h>
+#include <linux/device.h>
+#include <linux/list.h>
+#include <asm/uv/uv_hub.h>
+#include "gru.h"
+#include "grutables.h"
+#include "gruhandles.h"
+
+unsigned long gru_options __read_mostly;
+
+static struct device_driver gru_driver = {
+       .name = "gru"
+};
+
+static struct device gru_device = {
+       .bus_id = {0},
+       .driver = &gru_driver,
+};
+
+struct device *grudev = &gru_device;
+
+/*
+ * Select a gru fault map to be used by the current cpu. Note that
+ * multiple cpus may be using the same map.
+ *     ZZZ should "shift" be used?? Depends on HT cpu numbering
+ *     ZZZ should be inline but did not work on emulator
+ */
+int gru_cpu_fault_map_id(void)
+{
+       return uv_blade_processor_id() % GRU_NUM_TFM;
+}
+
+/*--------- ASID Management -------------------------------------------
+ *
+ *  Initially, assign asids sequentially from MIN_ASID .. MAX_ASID.
+ *  Once MAX is reached, flush the TLB & start over. However,
+ *  some asids may still be in use. There won't be many (percentage wise) still
+ *  in use. Search active contexts & determine the value of the first
+ *  asid in use ("x"s below). Set "limit" to this value.
+ *  This defines a block of assignable asids.
+ *
+ *  When "limit" is reached, search forward from limit+1 and determine the
+ *  next block of assignable asids.
+ *
+ *  Repeat until MAX_ASID is reached, then start over again.
+ *
+ *  Each time MAX_ASID is reached, increment the asid generation. Since
+ *  the search for in-use asids only checks contexts with GRUs currently
+ *  assigned, asids in some contexts will be missed. Prior to loading
+ *  a context, the asid generation of the GTS asid is rechecked. If it
+ *  doesn't match the current generation, a new asid will be assigned.
+ *
+ *     0---------------x------------x---------------------x----|
+ *       ^-next        ^-limit                                 ^-MAX_ASID
+ *
+ * All asid manipulation & context loading/unloading is protected by the
+ * gs_lock.
+ */
+
+/* Hit the asid limit. Start over */
+static int gru_wrap_asid(struct gru_state *gru)
+{
+       gru_dbg(grudev, "gru %p\n", gru);
+       STAT(asid_wrap);
+       gru->gs_asid_gen++;
+       gru_flush_all_tlb(gru);
+       return MIN_ASID;
+}
+
+/* Find the next chunk of unused asids */
+static int gru_reset_asid_limit(struct gru_state *gru, int asid)
+{
+       int i, gid, inuse_asid, limit;
+
+       gru_dbg(grudev, "gru %p, asid 0x%x\n", gru, asid);
+       STAT(asid_next);
+       limit = MAX_ASID;
+       if (asid >= limit)
+               asid = gru_wrap_asid(gru);
+       gid = gru->gs_gid;
+again:
+       for (i = 0; i < GRU_NUM_CCH; i++) {
+               if (!gru->gs_gts[i])
+                       continue;
+               inuse_asid = gru->gs_gts[i]->ts_gms->ms_asids[gid].mt_asid;
+               gru_dbg(grudev, "gru %p, inuse_asid 0x%x, cxtnum %d, gts %p\n",
+                       gru, inuse_asid, i, gru->gs_gts[i]);
+               if (inuse_asid == asid) {
+                       asid += ASID_INC;
+                       if (asid >= limit) {
+                               /*
+                                * empty range: reset the range limit and
+                                * start over
+                                */
+                               limit = MAX_ASID;
+                               if (asid >= MAX_ASID)
+                                       asid = gru_wrap_asid(gru);
+                               goto again;
+                       }
+               }
+
+               if ((inuse_asid > asid) && (inuse_asid < limit))
+                       limit = inuse_asid;
+       }
+       gru->gs_asid_limit = limit;
+       gru->gs_asid = asid;
+       gru_dbg(grudev, "gru %p, new asid 0x%x, new_limit 0x%x\n", gru, asid,
+               limit);
+       return asid;
+}
+
+/* Assign a new ASID to a thread context.  */
+static int gru_assign_asid(struct gru_state *gru)
+{
+       int asid;
+
+       spin_lock(&gru->gs_asid_lock);
+       gru->gs_asid += ASID_INC;
+       asid = gru->gs_asid;
+       if (asid >= gru->gs_asid_limit)
+               asid = gru_reset_asid_limit(gru, asid);
+       spin_unlock(&gru->gs_asid_lock);
+
+       gru_dbg(grudev, "gru %p, asid 0x%x\n", gru, asid);
+       return asid;
+}
+
+/*
+ * Clear n bits in a word. Return a word indicating the bits that were cleared.
+ * Optionally, build an array of chars that contain the bit numbers allocated.
+ */
+static unsigned long reserve_resources(unsigned long *p, int n, int mmax,
+                                      char *idx)
+{
+       unsigned long bits = 0;
+       int i;
+
+       do {
+               i = find_first_bit(p, mmax);
+               if (i == mmax)
+                       BUG();
+               __clear_bit(i, p);
+               __set_bit(i, &bits);
+               if (idx)
+                       *idx++ = i;
+       } while (--n);
+       return bits;
+}
+
+unsigned long gru_reserve_cb_resources(struct gru_state *gru, int cbr_au_count,
+                                      char *cbmap)
+{
+       return reserve_resources(&gru->gs_cbr_map, cbr_au_count, GRU_CBR_AU,
+                                cbmap);
+}
+
+unsigned long gru_reserve_ds_resources(struct gru_state *gru, int dsr_au_count,
+                                      char *dsmap)
+{
+       return reserve_resources(&gru->gs_dsr_map, dsr_au_count, GRU_DSR_AU,
+                                dsmap);
+}
+
+static void reserve_gru_resources(struct gru_state *gru,
+                                 struct gru_thread_state *gts)
+{
+       gru->gs_active_contexts++;
+       gts->ts_cbr_map =
+           gru_reserve_cb_resources(gru, gts->ts_cbr_au_count,
+                                    gts->ts_cbr_idx);
+       gts->ts_dsr_map =
+           gru_reserve_ds_resources(gru, gts->ts_dsr_au_count, NULL);
+}
+
+static void free_gru_resources(struct gru_state *gru,
+                              struct gru_thread_state *gts)
+{
+       gru->gs_active_contexts--;
+       gru->gs_cbr_map |= gts->ts_cbr_map;
+       gru->gs_dsr_map |= gts->ts_dsr_map;
+}
+
+/*
+ * Check if a GRU has sufficient free resources to satisfy an allocation
+ * request. Note: GRU locks may or may not be held when this is called. If
+ * not held, recheck after acquiring the appropriate locks.
+ *
+ * Returns 1 if sufficient resources, 0 if not
+ */
+static int check_gru_resources(struct gru_state *gru, int cbr_au_count,
+                              int dsr_au_count, int max_active_contexts)
+{
+       return hweight64(gru->gs_cbr_map) >= cbr_au_count
+               && hweight64(gru->gs_dsr_map) >= dsr_au_count
+               && gru->gs_active_contexts < max_active_contexts;
+}
+
+/*
+ * TLB manangment requires tracking all GRU chiplets that have loaded a GSEG
+ * context.
+ */
+static int gru_load_mm_tracker(struct gru_state *gru, struct gru_mm_struct *gms,
+                              int ctxnum)
+{
+       struct gru_mm_tracker *asids = &gms->ms_asids[gru->gs_gid];
+       unsigned short ctxbitmap = (1 << ctxnum);
+       int asid;
+
+       spin_lock(&gms->ms_asid_lock);
+       asid = asids->mt_asid;
+
+       if (asid == 0 || asids->mt_asid_gen != gru->gs_asid_gen) {
+               asid = gru_assign_asid(gru);
+               asids->mt_asid = asid;
+               asids->mt_asid_gen = gru->gs_asid_gen;
+               STAT(asid_new);
+       } else {
+               STAT(asid_reuse);
+       }
+
+       BUG_ON(asids->mt_ctxbitmap & ctxbitmap);
+       asids->mt_ctxbitmap |= ctxbitmap;
+       if (!test_bit(gru->gs_gid, gms->ms_asidmap))
+               __set_bit(gru->gs_gid, gms->ms_asidmap);
+       spin_unlock(&gms->ms_asid_lock);
+
+       gru_dbg(grudev,
+               "gru %x, gms %p, ctxnum 0x%d, asid 0x%x, asidmap 0x%lx\n",
+               gru->gs_gid, gms, ctxnum, asid, gms->ms_asidmap[0]);
+       return asid;
+}
+
+static void gru_unload_mm_tracker(struct gru_state *gru,
+                                 struct gru_mm_struct *gms, int ctxnum)
+{
+       struct gru_mm_tracker *asids;
+       unsigned short ctxbitmap;
+
+       asids = &gms->ms_asids[gru->gs_gid];
+       ctxbitmap = (1 << ctxnum);
+       spin_lock(&gms->ms_asid_lock);
+       BUG_ON((asids->mt_ctxbitmap & ctxbitmap) != ctxbitmap);
+       asids->mt_ctxbitmap ^= ctxbitmap;
+       gru_dbg(grudev, "gru %x, gms %p, ctxnum 0x%d, asidmap 0x%lx\n",
+               gru->gs_gid, gms, ctxnum, gms->ms_asidmap[0]);
+       spin_unlock(&gms->ms_asid_lock);
+}
+
+/*
+ * Decrement the reference count on a GTS structure. Free the structure
+ * if the reference count goes to zero.
+ */
+void gts_drop(struct gru_thread_state *gts)
+{
+       if (gts && atomic_dec_return(&gts->ts_refcnt) == 0) {
+               gru_drop_mmu_notifier(gts->ts_gms);
+               kfree(gts);
+               STAT(gts_free);
+       }
+}
+
+/*
+ * Locate the GTS structure for the current thread.
+ */
+static struct gru_thread_state *gru_find_current_gts_nolock(struct gru_vma_data
+                           *vdata, int tsid)
+{
+       struct gru_thread_state *gts;
+
+       list_for_each_entry(gts, &vdata->vd_head, ts_next)
+           if (gts->ts_tsid == tsid)
+               return gts;
+       return NULL;
+}
+
+/*
+ * Allocate a thread state structure.
+ */
+static struct gru_thread_state *gru_alloc_gts(struct vm_area_struct *vma,
+                                             struct gru_vma_data *vdata,
+                                             int tsid)
+{
+       struct gru_thread_state *gts;
+       int bytes;
+
+       bytes = DSR_BYTES(vdata->vd_dsr_au_count) +
+                               CBR_BYTES(vdata->vd_cbr_au_count);
+       bytes += sizeof(struct gru_thread_state);
+       gts = kzalloc(bytes, GFP_KERNEL);
+       if (!gts)
+               return NULL;
+
+       STAT(gts_alloc);
+       atomic_set(&gts->ts_refcnt, 1);
+       mutex_init(&gts->ts_ctxlock);
+       gts->ts_cbr_au_count = vdata->vd_cbr_au_count;
+       gts->ts_dsr_au_count = vdata->vd_dsr_au_count;
+       gts->ts_user_options = vdata->vd_user_options;
+       gts->ts_tsid = tsid;
+       gts->ts_user_options = vdata->vd_user_options;
+       gts->ts_ctxnum = NULLCTX;
+       gts->ts_mm = current->mm;
+       gts->ts_vma = vma;
+       gts->ts_tlb_int_select = -1;
+       gts->ts_gms = gru_register_mmu_notifier();
+       if (!gts->ts_gms)
+               goto err;
+
+       gru_dbg(grudev, "alloc vdata %p, new gts %p\n", vdata, gts);
+       return gts;
+
+err:
+       gts_drop(gts);
+       return NULL;
+}
+
+/*
+ * Allocate a vma private data structure.
+ */
+struct gru_vma_data *gru_alloc_vma_data(struct vm_area_struct *vma, int tsid)
+{
+       struct gru_vma_data *vdata = NULL;
+
+       vdata = kmalloc(sizeof(*vdata), GFP_KERNEL);
+       if (!vdata)
+               return NULL;
+
+       INIT_LIST_HEAD(&vdata->vd_head);
+       spin_lock_init(&vdata->vd_lock);
+       gru_dbg(grudev, "alloc vdata %p\n", vdata);
+       return vdata;
+}
+
+/*
+ * Find the thread state structure for the current thread.
+ */
+struct gru_thread_state *gru_find_thread_state(struct vm_area_struct *vma,
+                                       int tsid)
+{
+       struct gru_vma_data *vdata = vma->vm_private_data;
+       struct gru_thread_state *gts;
+
+       spin_lock(&vdata->vd_lock);
+       gts = gru_find_current_gts_nolock(vdata, tsid);
+       spin_unlock(&vdata->vd_lock);
+       gru_dbg(grudev, "vma %p, gts %p\n", vma, gts);
+       return gts;
+}
+
+/*
+ * Allocate a new thread state for a GSEG. Note that races may allow
+ * another thread to race to create a gts.
+ */
+struct gru_thread_state *gru_alloc_thread_state(struct vm_area_struct *vma,
+                                       int tsid)
+{
+       struct gru_vma_data *vdata = vma->vm_private_data;
+       struct gru_thread_state *gts, *ngts;
+
+       gts = gru_alloc_gts(vma, vdata, tsid);
+       if (!gts)
+               return NULL;
+
+       spin_lock(&vdata->vd_lock);
+       ngts = gru_find_current_gts_nolock(vdata, tsid);
+       if (ngts) {
+               gts_drop(gts);
+               gts = ngts;
+               STAT(gts_double_allocate);
+       } else {
+               list_add(&gts->ts_next, &vdata->vd_head);
+       }
+       spin_unlock(&vdata->vd_lock);
+       gru_dbg(grudev, "vma %p, gts %p\n", vma, gts);
+       return gts;
+}
+
+/*
+ * Free the GRU context assigned to the thread state.
+ */
+static void gru_free_gru_context(struct gru_thread_state *gts)
+{
+       struct gru_state *gru;
+
+       gru = gts->ts_gru;
+       gru_dbg(grudev, "gts %p, gru %p\n", gts, gru);
+
+       spin_lock(&gru->gs_lock);
+       gru->gs_gts[gts->ts_ctxnum] = NULL;
+       free_gru_resources(gru, gts);
+       BUG_ON(test_bit(gts->ts_ctxnum, &gru->gs_context_map) == 0);
+       __clear_bit(gts->ts_ctxnum, &gru->gs_context_map);
+       gts->ts_ctxnum = NULLCTX;
+       gts->ts_gru = NULL;
+       spin_unlock(&gru->gs_lock);
+
+       gts_drop(gts);
+       STAT(free_context);
+}
+
+/*
+ * Prefetching cachelines help hardware performance.
+ * (Strictly a performance enhancement. Not functionally required).
+ */
+static void prefetch_data(void *p, int num, int stride)
+{
+       while (num-- > 0) {
+               prefetchw(p);
+               p += stride;
+       }
+}
+
+static inline long gru_copy_handle(void *d, void *s)
+{
+       memcpy(d, s, GRU_HANDLE_BYTES);
+       return GRU_HANDLE_BYTES;
+}
+
+/* rewrite in assembly & use lots of prefetch */
+static void gru_load_context_data(void *save, void *grubase, int ctxnum,
+                                 unsigned long cbrmap, unsigned long dsrmap)
+{
+       void *gseg, *cb, *cbe;
+       unsigned long length;
+       int i, scr;
+
+       gseg = grubase + ctxnum * GRU_GSEG_STRIDE;
+       length = hweight64(dsrmap) * GRU_DSR_AU_BYTES;
+       prefetch_data(gseg + GRU_DS_BASE, length / GRU_CACHE_LINE_BYTES,
+                     GRU_CACHE_LINE_BYTES);
+
+       cb = gseg + GRU_CB_BASE;
+       cbe = grubase + GRU_CBE_BASE;
+       for_each_cbr_in_allocation_map(i, &cbrmap, scr) {
+               prefetch_data(cb, 1, GRU_CACHE_LINE_BYTES);
+               prefetch_data(cbe + i * GRU_HANDLE_STRIDE, 1,
+                             GRU_CACHE_LINE_BYTES);
+               cb += GRU_HANDLE_STRIDE;
+       }
+
+       cb = gseg + GRU_CB_BASE;
+       for_each_cbr_in_allocation_map(i, &cbrmap, scr) {
+               save += gru_copy_handle(cb, save);
+               save += gru_copy_handle(cbe + i * GRU_HANDLE_STRIDE, save);
+               cb += GRU_HANDLE_STRIDE;
+       }
+
+       memcpy(gseg + GRU_DS_BASE, save, length);
+}
+
+static void gru_unload_context_data(void *save, void *grubase, int ctxnum,
+                                   unsigned long cbrmap, unsigned long dsrmap)
+{
+       void *gseg, *cb, *cbe;
+       unsigned long length;
+       int i, scr;
+
+       gseg = grubase + ctxnum * GRU_GSEG_STRIDE;
+
+       cb = gseg + GRU_CB_BASE;
+       cbe = grubase + GRU_CBE_BASE;
+       for_each_cbr_in_allocation_map(i, &cbrmap, scr) {
+               save += gru_copy_handle(save, cb);
+               save += gru_copy_handle(save, cbe + i * GRU_HANDLE_STRIDE);
+               cb += GRU_HANDLE_STRIDE;
+       }
+       length = hweight64(dsrmap) * GRU_DSR_AU_BYTES;
+       memcpy(save, gseg + GRU_DS_BASE, length);
+}
+
+void gru_unload_context(struct gru_thread_state *gts, int savestate)
+{
+       struct gru_state *gru = gts->ts_gru;
+       struct gru_context_configuration_handle *cch;
+       int ctxnum = gts->ts_ctxnum;
+
+       zap_vma_ptes(gts->ts_vma, UGRUADDR(gts), GRU_GSEG_PAGESIZE);
+       cch = get_cch(gru->gs_gru_base_vaddr, ctxnum);
+
+       lock_cch_handle(cch);
+       if (cch_interrupt_sync(cch))
+               BUG();
+       gru_dbg(grudev, "gts %p\n", gts);
+
+       gru_unload_mm_tracker(gru, gts->ts_gms, gts->ts_ctxnum);
+       if (savestate)
+               gru_unload_context_data(gts->ts_gdata, gru->gs_gru_base_vaddr,
+                                       ctxnum, gts->ts_cbr_map,
+                                       gts->ts_dsr_map);
+
+       if (cch_deallocate(cch))
+               BUG();
+       gts->ts_force_unload = 0;       /* ts_force_unload locked by CCH lock */
+       unlock_cch_handle(cch);
+
+       gru_free_gru_context(gts);
+       STAT(unload_context);
+}
+
+/*
+ * Load a GRU context by copying it from the thread data structure in memory
+ * to the GRU.
+ */
+static void gru_load_context(struct gru_thread_state *gts)
+{
+       struct gru_state *gru = gts->ts_gru;
+       struct gru_context_configuration_handle *cch;
+       int err, asid, ctxnum = gts->ts_ctxnum;
+
+       gru_dbg(grudev, "gts %p\n", gts);
+       cch = get_cch(gru->gs_gru_base_vaddr, ctxnum);
+
+       lock_cch_handle(cch);
+       asid = gru_load_mm_tracker(gru, gts->ts_gms, gts->ts_ctxnum);
+       cch->tfm_fault_bit_enable =
+           (gts->ts_user_options == GRU_OPT_MISS_FMM_POLL
+            || gts->ts_user_options == GRU_OPT_MISS_FMM_INTR);
+       cch->tlb_int_enable = (gts->ts_user_options == GRU_OPT_MISS_FMM_INTR);
+       if (cch->tlb_int_enable) {
+               gts->ts_tlb_int_select = gru_cpu_fault_map_id();
+               cch->tlb_int_select = gts->ts_tlb_int_select;
+       }
+       cch->tfm_done_bit_enable = 0;
+       err = cch_allocate(cch, asid, gts->ts_cbr_map, gts->ts_dsr_map);
+       if (err) {
+               gru_dbg(grudev,
+                       "err %d: cch %p, gts %p, cbr 0x%lx, dsr 0x%lx\n",
+                       err, cch, gts, gts->ts_cbr_map, gts->ts_dsr_map);
+               BUG();
+       }
+
+       gru_load_context_data(gts->ts_gdata, gru->gs_gru_base_vaddr, ctxnum,
+                             gts->ts_cbr_map, gts->ts_dsr_map);
+
+       if (cch_start(cch))
+               BUG();
+       unlock_cch_handle(cch);
+
+       STAT(load_context);
+}
+
+/*
+ * Update fields in an active CCH:
+ *     - retarget interrupts on local blade
+ *     - force a delayed context unload by clearing the CCH asids. This
+ *       forces TLB misses for new GRU instructions. The context is unloaded
+ *       when the next TLB miss occurs.
+ */
+static int gru_update_cch(struct gru_thread_state *gts, int int_select)
+{
+       struct gru_context_configuration_handle *cch;
+       struct gru_state *gru = gts->ts_gru;
+       int i, ctxnum = gts->ts_ctxnum, ret = 0;
+
+       cch = get_cch(gru->gs_gru_base_vaddr, ctxnum);
+
+       lock_cch_handle(cch);
+       if (cch->state == CCHSTATE_ACTIVE) {
+               if (gru->gs_gts[gts->ts_ctxnum] != gts)
+                       goto exit;
+               if (cch_interrupt(cch))
+                       BUG();
+               if (int_select >= 0) {
+                       gts->ts_tlb_int_select = int_select;
+                       cch->tlb_int_select = int_select;
+               } else {
+                       for (i = 0; i < 8; i++)
+                               cch->asid[i] = 0;
+                       cch->tfm_fault_bit_enable = 0;
+                       cch->tlb_int_enable = 0;
+                       gts->ts_force_unload = 1;
+               }
+               if (cch_start(cch))
+                       BUG();
+               ret = 1;
+       }
+exit:
+       unlock_cch_handle(cch);
+       return ret;
+}
+
+/*
+ * Update CCH tlb interrupt select. Required when all the following is true:
+ *     - task's GRU context is loaded into a GRU
+ *     - task is using interrupt notification for TLB faults
+ *     - task has migrated to a different cpu on the same blade where
+ *       it was previously running.
+ */
+static int gru_retarget_intr(struct gru_thread_state *gts)
+{
+       if (gts->ts_tlb_int_select < 0
+           || gts->ts_tlb_int_select == gru_cpu_fault_map_id())
+               return 0;
+
+       gru_dbg(grudev, "retarget from %d to %d\n", gts->ts_tlb_int_select,
+               gru_cpu_fault_map_id());
+       return gru_update_cch(gts, gru_cpu_fault_map_id());
+}
+
+
+/*
+ * Insufficient GRU resources available on the local blade. Steal a context from
+ * a process. This is a hack until a _real_ resource scheduler is written....
+ */
+#define next_ctxnum(n) ((n) <  GRU_NUM_CCH - 2 ? (n) + 1 : 0)
+#define next_gru(b, g) (((g) < &(b)->bs_grus[GRU_CHIPLETS_PER_BLADE - 1]) ?  \
+                                ((g)+1) : &(b)->bs_grus[0])
+
+static void gru_steal_context(struct gru_thread_state *gts)
+{
+       struct gru_blade_state *blade;
+       struct gru_state *gru, *gru0;
+       struct gru_thread_state *ngts = NULL;
+       int ctxnum, ctxnum0, flag = 0, cbr, dsr;
+
+       cbr = gts->ts_cbr_au_count;
+       dsr = gts->ts_dsr_au_count;
+
+       preempt_disable();
+       blade = gru_base[uv_numa_blade_id()];
+       spin_lock(&blade->bs_lock);
+
+       ctxnum = next_ctxnum(blade->bs_lru_ctxnum);
+       gru = blade->bs_lru_gru;
+       if (ctxnum == 0)
+               gru = next_gru(blade, gru);
+       ctxnum0 = ctxnum;
+       gru0 = gru;
+       while (1) {
+               if (check_gru_resources(gru, cbr, dsr, GRU_NUM_CCH))
+                       break;
+               spin_lock(&gru->gs_lock);
+               for (; ctxnum < GRU_NUM_CCH; ctxnum++) {
+                       if (flag && gru == gru0 && ctxnum == ctxnum0)
+                               break;
+                       ngts = gru->gs_gts[ctxnum];
+                       /*
+                        * We are grabbing locks out of order, so trylock is
+                        * needed. GTSs are usually not locked, so the odds of
+                        * success are high. If trylock fails, try to steal a
+                        * different GSEG.
+                        */
+                       if (ngts && mutex_trylock(&ngts->ts_ctxlock))
+                               break;
+                       ngts = NULL;
+                       flag = 1;
+               }
+               spin_unlock(&gru->gs_lock);
+               if (ngts || (flag && gru == gru0 && ctxnum == ctxnum0))
+                       break;
+               ctxnum = 0;
+               gru = next_gru(blade, gru);
+       }
+       blade->bs_lru_gru = gru;
+       blade->bs_lru_ctxnum = ctxnum;
+       spin_unlock(&blade->bs_lock);
+       preempt_enable();
+
+       if (ngts) {
+               STAT(steal_context);
+               ngts->ts_steal_jiffies = jiffies;
+               gru_unload_context(ngts, 1);
+               mutex_unlock(&ngts->ts_ctxlock);
+       } else {
+               STAT(steal_context_failed);
+       }
+       gru_dbg(grudev,
+               "stole gru %x, ctxnum %d from gts %p. Need cb %d, ds %d;"
+               " avail cb %ld, ds %ld\n",
+               gru->gs_gid, ctxnum, ngts, cbr, dsr, hweight64(gru->gs_cbr_map),
+               hweight64(gru->gs_dsr_map));
+}
+
+/*
+ * Scan the GRUs on the local blade & assign a GRU context.
+ */
+static struct gru_state *gru_assign_gru_context(struct gru_thread_state *gts)
+{
+       struct gru_state *gru, *grux;
+       int i, max_active_contexts;
+
+       preempt_disable();
+
+again:
+       gru = NULL;
+       max_active_contexts = GRU_NUM_CCH;
+       for_each_gru_on_blade(grux, uv_numa_blade_id(), i) {
+               if (check_gru_resources(grux, gts->ts_cbr_au_count,
+                                       gts->ts_dsr_au_count,
+                                       max_active_contexts)) {
+                       gru = grux;
+                       max_active_contexts = grux->gs_active_contexts;
+                       if (max_active_contexts == 0)
+                               break;
+               }
+       }
+
+       if (gru) {
+               spin_lock(&gru->gs_lock);
+               if (!check_gru_resources(gru, gts->ts_cbr_au_count,
+                                        gts->ts_dsr_au_count, GRU_NUM_CCH)) {
+                       spin_unlock(&gru->gs_lock);
+                       goto again;
+               }
+               reserve_gru_resources(gru, gts);
+               gts->ts_gru = gru;
+               gts->ts_ctxnum =
+                   find_first_zero_bit(&gru->gs_context_map, GRU_NUM_CCH);
+               BUG_ON(gts->ts_ctxnum == GRU_NUM_CCH);
+               atomic_inc(&gts->ts_refcnt);
+               gru->gs_gts[gts->ts_ctxnum] = gts;
+               __set_bit(gts->ts_ctxnum, &gru->gs_context_map);
+               spin_unlock(&gru->gs_lock);
+
+               STAT(assign_context);
+               gru_dbg(grudev,
+                       "gseg %p, gts %p, gru %x, ctx %d, cbr %d, dsr %d\n",
+                       gseg_virtual_address(gts->ts_gru, gts->ts_ctxnum), gts,
+                       gts->ts_gru->gs_gid, gts->ts_ctxnum,
+                       gts->ts_cbr_au_count, gts->ts_dsr_au_count);
+       } else {
+               gru_dbg(grudev, "failed to allocate a GTS %s\n", "");
+               STAT(assign_context_failed);
+       }
+
+       preempt_enable();
+       return gru;
+}
+
+/*
+ * gru_nopage
+ *
+ * Map the user's GRU segment
+ *
+ *     Note: gru segments alway mmaped on GRU_GSEG_PAGESIZE boundaries.
+ */
+int gru_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
+{
+       struct gru_thread_state *gts;
+       unsigned long paddr, vaddr;
+
+       vaddr = (unsigned long)vmf->virtual_address;
+       gru_dbg(grudev, "vma %p, vaddr 0x%lx (0x%lx)\n",
+               vma, vaddr, GSEG_BASE(vaddr));
+       STAT(nopfn);
+
+       /* The following check ensures vaddr is a valid address in the VMA */
+       gts = gru_find_thread_state(vma, TSID(vaddr, vma));
+       if (!gts)
+               return VM_FAULT_SIGBUS;
+
+again:
+       preempt_disable();
+       mutex_lock(&gts->ts_ctxlock);
+       if (gts->ts_gru) {
+               if (gts->ts_gru->gs_blade_id != uv_numa_blade_id()) {
+                       STAT(migrated_nopfn_unload);
+                       gru_unload_context(gts, 1);
+               } else {
+                       if (gru_retarget_intr(gts))
+                               STAT(migrated_nopfn_retarget);
+               }
+       }
+
+       if (!gts->ts_gru) {
+               if (!gru_assign_gru_context(gts)) {
+                       mutex_unlock(&gts->ts_ctxlock);
+                       preempt_enable();
+                       schedule_timeout(GRU_ASSIGN_DELAY);  /* true hack ZZZ */
+                       if (gts->ts_steal_jiffies + GRU_STEAL_DELAY < jiffies)
+                               gru_steal_context(gts);
+                       goto again;
+               }
+               gru_load_context(gts);
+               paddr = gseg_physical_address(gts->ts_gru, gts->ts_ctxnum);
+               remap_pfn_range(vma, vaddr & ~(GRU_GSEG_PAGESIZE - 1),
+                               paddr >> PAGE_SHIFT, GRU_GSEG_PAGESIZE,
+                               vma->vm_page_prot);
+       }
+
+       mutex_unlock(&gts->ts_ctxlock);
+       preempt_enable();
+
+       return VM_FAULT_NOPAGE;
+}
+
diff --git a/drivers/misc/sgi-gru/gruprocfs.c b/drivers/misc/sgi-gru/gruprocfs.c
new file mode 100644 (file)
index 0000000..533923f
--- /dev/null
@@ -0,0 +1,336 @@
+/*
+ * SN Platform GRU Driver
+ *
+ *              PROC INTERFACES
+ *
+ * This file supports the /proc interfaces for the GRU driver
+ *
+ *  Copyright (c) 2008 Silicon Graphics, 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 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/proc_fs.h>
+#include <linux/device.h>
+#include <linux/seq_file.h>
+#include <linux/uaccess.h>
+#include "gru.h"
+#include "grulib.h"
+#include "grutables.h"
+
+#define printstat(s, f)                printstat_val(s, &gru_stats.f, #f)
+
+static void printstat_val(struct seq_file *s, atomic_long_t *v, char *id)
+{
+       unsigned long val = atomic_long_read(v);
+
+       if (val)
+               seq_printf(s, "%16lu %s\n", val, id);
+}
+
+static int statistics_show(struct seq_file *s, void *p)
+{
+       printstat(s, vdata_alloc);
+       printstat(s, vdata_free);
+       printstat(s, gts_alloc);
+       printstat(s, gts_free);
+       printstat(s, vdata_double_alloc);
+       printstat(s, gts_double_allocate);
+       printstat(s, assign_context);
+       printstat(s, assign_context_failed);
+       printstat(s, free_context);
+       printstat(s, load_context);
+       printstat(s, unload_context);
+       printstat(s, steal_context);
+       printstat(s, steal_context_failed);
+       printstat(s, nopfn);
+       printstat(s, break_cow);
+       printstat(s, asid_new);
+       printstat(s, asid_next);
+       printstat(s, asid_wrap);
+       printstat(s, asid_reuse);
+       printstat(s, intr);
+       printstat(s, call_os);
+       printstat(s, call_os_check_for_bug);
+       printstat(s, call_os_wait_queue);
+       printstat(s, user_flush_tlb);
+       printstat(s, user_unload_context);
+       printstat(s, user_exception);
+       printstat(s, set_task_slice);
+       printstat(s, migrate_check);
+       printstat(s, migrated_retarget);
+       printstat(s, migrated_unload);
+       printstat(s, migrated_unload_delay);
+       printstat(s, migrated_nopfn_retarget);
+       printstat(s, migrated_nopfn_unload);
+       printstat(s, tlb_dropin);
+       printstat(s, tlb_dropin_fail_no_asid);
+       printstat(s, tlb_dropin_fail_upm);
+       printstat(s, tlb_dropin_fail_invalid);
+       printstat(s, tlb_dropin_fail_range_active);
+       printstat(s, tlb_dropin_fail_idle);
+       printstat(s, tlb_dropin_fail_fmm);
+       printstat(s, mmu_invalidate_range);
+       printstat(s, mmu_invalidate_page);
+       printstat(s, mmu_clear_flush_young);
+       printstat(s, flush_tlb);
+       printstat(s, flush_tlb_gru);
+       printstat(s, flush_tlb_gru_tgh);
+       printstat(s, flush_tlb_gru_zero_asid);
+       printstat(s, copy_gpa);
+       printstat(s, mesq_receive);
+       printstat(s, mesq_receive_none);
+       printstat(s, mesq_send);
+       printstat(s, mesq_send_failed);
+       printstat(s, mesq_noop);
+       printstat(s, mesq_send_unexpected_error);
+       printstat(s, mesq_send_lb_overflow);
+       printstat(s, mesq_send_qlimit_reached);
+       printstat(s, mesq_send_amo_nacked);
+       printstat(s, mesq_send_put_nacked);
+       printstat(s, mesq_qf_not_full);
+       printstat(s, mesq_qf_locked);
+       printstat(s, mesq_qf_noop_not_full);
+       printstat(s, mesq_qf_switch_head_failed);
+       printstat(s, mesq_qf_unexpected_error);
+       printstat(s, mesq_noop_unexpected_error);
+       printstat(s, mesq_noop_lb_overflow);
+       printstat(s, mesq_noop_qlimit_reached);
+       printstat(s, mesq_noop_amo_nacked);
+       printstat(s, mesq_noop_put_nacked);
+       return 0;
+}
+
+static ssize_t statistics_write(struct file *file, const char __user *userbuf,
+                               size_t count, loff_t *data)
+{
+       memset(&gru_stats, 0, sizeof(gru_stats));
+       return count;
+}
+
+static int options_show(struct seq_file *s, void *p)
+{
+       seq_printf(s, "0x%lx\n", gru_options);
+       return 0;
+}
+
+static ssize_t options_write(struct file *file, const char __user *userbuf,
+                            size_t count, loff_t *data)
+{
+       unsigned long val;
+       char buf[80];
+
+       if (copy_from_user
+           (buf, userbuf, count < sizeof(buf) ? count : sizeof(buf)))
+               return -EFAULT;
+       if (!strict_strtoul(buf, 10, &val))
+               gru_options = val;
+
+       return count;
+}
+
+static int cch_seq_show(struct seq_file *file, void *data)
+{
+       long gid = *(long *)data;
+       int i;
+       struct gru_state *gru = GID_TO_GRU(gid);
+       struct gru_thread_state *ts;
+       const char *mode[] = { "??", "UPM", "INTR", "OS_POLL" };
+
+       if (gid == 0)
+               seq_printf(file, "#%5s%5s%6s%9s%6s%8s%8s\n", "gid", "bid",
+                          "ctx#", "pid", "cbrs", "dsbytes", "mode");
+       if (gru)
+               for (i = 0; i < GRU_NUM_CCH; i++) {
+                       ts = gru->gs_gts[i];
+                       if (!ts)
+                               continue;
+                       seq_printf(file, " %5d%5d%6d%9d%6d%8d%8s\n",
+                                  gru->gs_gid, gru->gs_blade_id, i,
+                                  ts->ts_tgid_owner,
+                                  ts->ts_cbr_au_count * GRU_CBR_AU_SIZE,
+                                  ts->ts_cbr_au_count * GRU_DSR_AU_BYTES,
+                                  mode[ts->ts_user_options &
+                                       GRU_OPT_MISS_MASK]);
+               }
+
+       return 0;
+}
+
+static int gru_seq_show(struct seq_file *file, void *data)
+{
+       long gid = *(long *)data, ctxfree, cbrfree, dsrfree;
+       struct gru_state *gru = GID_TO_GRU(gid);
+
+       if (gid == 0) {
+               seq_printf(file, "#%5s%5s%7s%6s%6s%8s%6s%6s\n", "gid", "nid",
+                          "ctx", "cbr", "dsr", "ctx", "cbr", "dsr");
+               seq_printf(file, "#%5s%5s%7s%6s%6s%8s%6s%6s\n", "", "", "busy",
+                          "busy", "busy", "free", "free", "free");
+       }
+       if (gru) {
+               ctxfree = GRU_NUM_CCH - gru->gs_active_contexts;
+               cbrfree = hweight64(gru->gs_cbr_map) * GRU_CBR_AU_SIZE;
+               dsrfree = hweight64(gru->gs_dsr_map) * GRU_DSR_AU_BYTES;
+               seq_printf(file, " %5d%5d%7ld%6ld%6ld%8ld%6ld%6ld\n",
+                          gru->gs_gid, gru->gs_blade_id, GRU_NUM_CCH - ctxfree,
+                          GRU_NUM_CBE - cbrfree, GRU_NUM_DSR_BYTES - dsrfree,
+                          ctxfree, cbrfree, dsrfree);
+       }
+
+       return 0;
+}
+
+static void seq_stop(struct seq_file *file, void *data)
+{
+}
+
+static void *seq_start(struct seq_file *file, loff_t *gid)
+{
+       if (*gid < GRU_MAX_GRUS)
+               return gid;
+       return NULL;
+}
+
+static void *seq_next(struct seq_file *file, void *data, loff_t *gid)
+{
+       (*gid)++;
+       if (*gid < GRU_MAX_GRUS)
+               return gid;
+       return NULL;
+}
+
+static const struct seq_operations cch_seq_ops = {
+       .start  = seq_start,
+       .next   = seq_next,
+       .stop   = seq_stop,
+       .show   = cch_seq_show
+};
+
+static const struct seq_operations gru_seq_ops = {
+       .start  = seq_start,
+       .next   = seq_next,
+       .stop   = seq_stop,
+       .show   = gru_seq_show
+};
+
+static int statistics_open(struct inode *inode, struct file *file)
+{
+       return single_open(file, statistics_show, NULL);
+}
+
+static int options_open(struct inode *inode, struct file *file)
+{
+       return single_open(file, options_show, NULL);
+}
+
+static int cch_open(struct inode *inode, struct file *file)
+{
+       return seq_open(file, &cch_seq_ops);
+}
+
+static int gru_open(struct inode *inode, struct file *file)
+{
+       return seq_open(file, &gru_seq_ops);
+}
+
+/* *INDENT-OFF* */
+static const struct file_operations statistics_fops = {
+       .open           = statistics_open,
+       .read           = seq_read,
+       .write          = statistics_write,
+       .llseek         = seq_lseek,
+       .release        = single_release,
+};
+
+static const struct file_operations options_fops = {
+       .open           = options_open,
+       .read           = seq_read,
+       .write          = options_write,
+       .llseek         = seq_lseek,
+       .release        = single_release,
+};
+
+static const struct file_operations cch_fops = {
+       .open           = cch_open,
+       .read           = seq_read,
+       .llseek         = seq_lseek,
+       .release        = seq_release,
+};
+static const struct file_operations gru_fops = {
+       .open           = gru_open,
+       .read           = seq_read,
+       .llseek         = seq_lseek,
+       .release        = seq_release,
+};
+
+static struct proc_entry {
+       char *name;
+       int mode;
+       const struct file_operations *fops;
+       struct proc_dir_entry *entry;
+} proc_files[] = {
+       {"statistics", 0644, &statistics_fops},
+       {"debug_options", 0644, &options_fops},
+       {"cch_status", 0444, &cch_fops},
+       {"gru_status", 0444, &gru_fops},
+       {NULL}
+};
+/* *INDENT-ON* */
+
+static struct proc_dir_entry *proc_gru __read_mostly;
+
+static int create_proc_file(struct proc_entry *p)
+{
+       p->entry = create_proc_entry(p->name, p->mode, proc_gru);
+       if (!p->entry)
+               return -1;
+       p->entry->proc_fops = p->fops;
+       return 0;
+}
+
+static void delete_proc_files(void)
+{
+       struct proc_entry *p;
+
+       if (proc_gru) {
+               for (p = proc_files; p->name; p++)
+                       if (p->entry)
+                               remove_proc_entry(p->name, proc_gru);
+               remove_proc_entry("gru", NULL);
+       }
+}
+
+int gru_proc_init(void)
+{
+       struct proc_entry *p;
+
+       proc_mkdir("sgi_uv", NULL);
+       proc_gru = proc_mkdir("sgi_uv/gru", NULL);
+
+       for (p = proc_files; p->name; p++)
+               if (create_proc_file(p))
+                       goto err;
+       return 0;
+
+err:
+       delete_proc_files();
+       return -1;
+}
+
+void gru_proc_exit(void)
+{
+       delete_proc_files();
+}
diff --git a/drivers/misc/sgi-gru/grutables.h b/drivers/misc/sgi-gru/grutables.h
new file mode 100644 (file)
index 0000000..4251018
--- /dev/null
@@ -0,0 +1,609 @@
+/*
+ * SN Platform GRU Driver
+ *
+ *            GRU DRIVER TABLES, MACROS, externs, etc
+ *
+ *  Copyright (c) 2008 Silicon Graphics, 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 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 __GRUTABLES_H__
+#define __GRUTABLES_H__
+
+/*
+ * GRU Chiplet:
+ *   The GRU is a user addressible memory accelerator. It provides
+ *   several forms of load, store, memset, bcopy instructions. In addition, it
+ *   contains special instructions for AMOs, sending messages to message
+ *   queues, etc.
+ *
+ *   The GRU is an integral part of the node controller. It connects
+ *   directly to the cpu socket. In its current implementation, there are 2
+ *   GRU chiplets in the node controller on each blade (~node).
+ *
+ *   The entire GRU memory space is fully coherent and cacheable by the cpus.
+ *
+ *   Each GRU chiplet has a physical memory map that looks like the following:
+ *
+ *     +-----------------+
+ *     |/////////////////|
+ *     |/////////////////|
+ *     |/////////////////|
+ *     |/////////////////|
+ *     |/////////////////|
+ *     |/////////////////|
+ *     |/////////////////|
+ *     |/////////////////|
+ *     +-----------------+
+ *     |  system control |
+ *     +-----------------+        _______ +-------------+
+ *     |/////////////////|       /        |             |
+ *     |/////////////////|      /         |             |
+ *     |/////////////////|     /          | instructions|
+ *     |/////////////////|    /           |             |
+ *     |/////////////////|   /            |             |
+ *     |/////////////////|  /             |-------------|
+ *     |/////////////////| /              |             |
+ *     +-----------------+                |             |
+ *     |   context 15    |                |  data       |
+ *     +-----------------+                |             |
+ *     |    ......       | \              |             |
+ *     +-----------------+  \____________ +-------------+
+ *     |   context 1     |
+ *     +-----------------+
+ *     |   context 0     |
+ *     +-----------------+
+ *
+ *   Each of the "contexts" is a chunk of memory that can be mmaped into user
+ *   space. The context consists of 2 parts:
+ *
+ *     - an instruction space that can be directly accessed by the user
+ *       to issue GRU instructions and to check instruction status.
+ *
+ *     - a data area that acts as normal RAM.
+ *
+ *   User instructions contain virtual addresses of data to be accessed by the
+ *   GRU. The GRU contains a TLB that is used to convert these user virtual
+ *   addresses to physical addresses.
+ *
+ *   The "system control" area of the GRU chiplet is used by the kernel driver
+ *   to manage user contexts and to perform functions such as TLB dropin and
+ *   purging.
+ *
+ *   One context may be reserved for the kernel and used for cross-partition
+ *   communication. The GRU will also be used to asynchronously zero out
+ *   large blocks of memory (not currently implemented).
+ *
+ *
+ * Tables:
+ *
+ *     VDATA-VMA Data          - Holds a few parameters. Head of linked list of
+ *                               GTS tables for threads using the GSEG
+ *     GTS - Gru Thread State  - contains info for managing a GSEG context. A
+ *                               GTS is allocated for each thread accessing a
+ *                               GSEG.
+ *             GTD - GRU Thread Data   - contains shadow copy of GRU data when GSEG is
+ *                                       not loaded into a GRU
+ *     GMS - GRU Memory Struct - Used to manage TLB shootdowns. Tracks GRUs
+ *                               where a GSEG has been loaded. Similar to
+ *                               an mm_struct but for GRU.
+ *
+ *     GS  - GRU State         - Used to manage the state of a GRU chiplet
+ *     BS  - Blade State       - Used to manage state of all GRU chiplets
+ *                               on a blade
+ *
+ *
+ *  Normal task tables for task using GRU.
+ *             - 2 threads in process
+ *             - 2 GSEGs open in process
+ *             - GSEG1 is being used by both threads
+ *             - GSEG2 is used only by thread 2
+ *
+ *       task -->|
+ *       task ---+---> mm ->------ (notifier) -------+-> gms
+ *                     |                             |
+ *                     |--> vma -> vdata ---> gts--->|         GSEG1 (thread1)
+ *                     |                  |          |
+ *                     |                  +-> gts--->|         GSEG1 (thread2)
+ *                     |                             |
+ *                     |--> vma -> vdata ---> gts--->|         GSEG2 (thread2)
+ *                     .
+ *                     .
+ *
+ *  GSEGs are marked DONTCOPY on fork
+ *
+ * At open
+ *     file.private_data -> NULL
+ *
+ * At mmap,
+ *     vma -> vdata
+ *
+ * After gseg reference
+ *     vma -> vdata ->gts
+ *
+ * After fork
+ *   parent
+ *     vma -> vdata -> gts
+ *   child
+ *     (vma is not copied)
+ *
+ */
+
+#include <linux/rmap.h>
+#include <linux/interrupt.h>
+#include <linux/mutex.h>
+#include <linux/wait.h>
+#include <linux/mmu_notifier.h>
+#include "gru.h"
+#include "gruhandles.h"
+
+extern struct gru_stats_s gru_stats;
+extern struct gru_blade_state *gru_base[];
+extern unsigned long gru_start_paddr, gru_end_paddr;
+
+#define GRU_MAX_BLADES         MAX_NUMNODES
+#define GRU_MAX_GRUS           (GRU_MAX_BLADES * GRU_CHIPLETS_PER_BLADE)
+
+#define GRU_DRIVER_ID_STR      "SGI GRU Device Driver"
+#define GRU_DRIVER_VERSION_STR "0.80"
+
+/*
+ * GRU statistics.
+ */
+struct gru_stats_s {
+       atomic_long_t vdata_alloc;
+       atomic_long_t vdata_free;
+       atomic_long_t gts_alloc;
+       atomic_long_t gts_free;
+       atomic_long_t vdata_double_alloc;
+       atomic_long_t gts_double_allocate;
+       atomic_long_t assign_context;
+       atomic_long_t assign_context_failed;
+       atomic_long_t free_context;
+       atomic_long_t load_context;
+       atomic_long_t unload_context;
+       atomic_long_t steal_context;
+       atomic_long_t steal_context_failed;
+       atomic_long_t nopfn;
+       atomic_long_t break_cow;
+       atomic_long_t asid_new;
+       atomic_long_t asid_next;
+       atomic_long_t asid_wrap;
+       atomic_long_t asid_reuse;
+       atomic_long_t intr;
+       atomic_long_t call_os;
+       atomic_long_t call_os_check_for_bug;
+       atomic_long_t call_os_wait_queue;
+       atomic_long_t user_flush_tlb;
+       atomic_long_t user_unload_context;
+       atomic_long_t user_exception;
+       atomic_long_t set_task_slice;
+       atomic_long_t migrate_check;
+       atomic_long_t migrated_retarget;
+       atomic_long_t migrated_unload;
+       atomic_long_t migrated_unload_delay;
+       atomic_long_t migrated_nopfn_retarget;
+       atomic_long_t migrated_nopfn_unload;
+       atomic_long_t tlb_dropin;
+       atomic_long_t tlb_dropin_fail_no_asid;
+       atomic_long_t tlb_dropin_fail_upm;
+       atomic_long_t tlb_dropin_fail_invalid;
+       atomic_long_t tlb_dropin_fail_range_active;
+       atomic_long_t tlb_dropin_fail_idle;
+       atomic_long_t tlb_dropin_fail_fmm;
+       atomic_long_t mmu_invalidate_range;
+       atomic_long_t mmu_invalidate_page;
+       atomic_long_t mmu_clear_flush_young;
+       atomic_long_t flush_tlb;
+       atomic_long_t flush_tlb_gru;
+       atomic_long_t flush_tlb_gru_tgh;
+       atomic_long_t flush_tlb_gru_zero_asid;
+
+       atomic_long_t copy_gpa;
+
+       atomic_long_t mesq_receive;
+       atomic_long_t mesq_receive_none;
+       atomic_long_t mesq_send;
+       atomic_long_t mesq_send_failed;
+       atomic_long_t mesq_noop;
+       atomic_long_t mesq_send_unexpected_error;
+       atomic_long_t mesq_send_lb_overflow;
+       atomic_long_t mesq_send_qlimit_reached;
+       atomic_long_t mesq_send_amo_nacked;
+       atomic_long_t mesq_send_put_nacked;
+       atomic_long_t mesq_qf_not_full;
+       atomic_long_t mesq_qf_locked;
+       atomic_long_t mesq_qf_noop_not_full;
+       atomic_long_t mesq_qf_switch_head_failed;
+       atomic_long_t mesq_qf_unexpected_error;
+       atomic_long_t mesq_noop_unexpected_error;
+       atomic_long_t mesq_noop_lb_overflow;
+       atomic_long_t mesq_noop_qlimit_reached;
+       atomic_long_t mesq_noop_amo_nacked;
+       atomic_long_t mesq_noop_put_nacked;
+
+};
+
+#define OPT_DPRINT     1
+#define OPT_STATS      2
+#define GRU_QUICKLOOK  4
+
+
+#define IRQ_GRU                        110     /* Starting IRQ number for interrupts */
+
+/* Delay in jiffies between attempts to assign a GRU context */
+#define GRU_ASSIGN_DELAY       ((HZ * 20) / 1000)
+
+/*
+ * If a process has it's context stolen, min delay in jiffies before trying to
+ * steal a context from another process.
+ */
+#define GRU_STEAL_DELAY                ((HZ * 200) / 1000)
+
+#define STAT(id)       do {                                            \
+                               if (gru_options & OPT_STATS)            \
+                                       atomic_long_inc(&gru_stats.id); \
+                       } while (0)
+
+#ifdef CONFIG_SGI_GRU_DEBUG
+#define gru_dbg(dev, fmt, x...)                                                \
+       do {                                                            \
+               if (gru_options & OPT_DPRINT)                           \
+                       dev_dbg(dev, "%s: " fmt, __func__, x);          \
+       } while (0)
+#else
+#define gru_dbg(x...)
+#endif
+
+/*-----------------------------------------------------------------------------
+ * ASID management
+ */
+#define MAX_ASID       0xfffff0
+#define MIN_ASID       8
+#define ASID_INC       8       /* number of regions */
+
+/* Generate a GRU asid value from a GRU base asid & a virtual address. */
+#if defined CONFIG_IA64
+#define VADDR_HI_BIT           64
+#define GRUREGION(addr)                ((addr) >> (VADDR_HI_BIT - 3) & 3)
+#elif defined __x86_64
+#define VADDR_HI_BIT           48
+#define GRUREGION(addr)                (0)             /* ZZZ could do better */
+#else
+#error "Unsupported architecture"
+#endif
+#define GRUASID(asid, addr)    ((asid) + GRUREGION(addr))
+
+/*------------------------------------------------------------------------------
+ *  File & VMS Tables
+ */
+
+struct gru_state;
+
+/*
+ * This structure is pointed to from the mmstruct via the notifier pointer.
+ * There is one of these per address space.
+ */
+struct gru_mm_tracker {
+       unsigned int            mt_asid_gen;    /* ASID wrap count */
+       int                     mt_asid;        /* current base ASID for gru */
+       unsigned short          mt_ctxbitmap;   /* bitmap of contexts using
+                                                  asid */
+};
+
+struct gru_mm_struct {
+       struct mmu_notifier     ms_notifier;
+       atomic_t                ms_refcnt;
+       spinlock_t              ms_asid_lock;   /* protects ASID assignment */
+       atomic_t                ms_range_active;/* num range_invals active */
+       char                    ms_released;
+       wait_queue_head_t       ms_wait_queue;
+       DECLARE_BITMAP(ms_asidmap, GRU_MAX_GRUS);
+       struct gru_mm_tracker   ms_asids[GRU_MAX_GRUS];
+};
+
+/*
+ * One of these structures is allocated when a GSEG is mmaped. The
+ * structure is pointed to by the vma->vm_private_data field in the vma struct.
+ */
+struct gru_vma_data {
+       spinlock_t              vd_lock;        /* Serialize access to vma */
+       struct list_head        vd_head;        /* head of linked list of gts */
+       long                    vd_user_options;/* misc user option flags */
+       int                     vd_cbr_au_count;
+       int                     vd_dsr_au_count;
+};
+
+/*
+ * One of these is allocated for each thread accessing a mmaped GRU. A linked
+ * list of these structure is hung off the struct gru_vma_data in the mm_struct.
+ */
+struct gru_thread_state {
+       struct list_head        ts_next;        /* list - head at vma-private */
+       struct mutex            ts_ctxlock;     /* load/unload CTX lock */
+       struct mm_struct        *ts_mm;         /* mm currently mapped to
+                                                  context */
+       struct vm_area_struct   *ts_vma;        /* vma of GRU context */
+       struct gru_state        *ts_gru;        /* GRU where the context is
+                                                  loaded */
+       struct gru_mm_struct    *ts_gms;        /* asid & ioproc struct */
+       unsigned long           ts_cbr_map;     /* map of allocated CBRs */
+       unsigned long           ts_dsr_map;     /* map of allocated DATA
+                                                  resources */
+       unsigned long           ts_steal_jiffies;/* jiffies when context last
+                                                   stolen */
+       long                    ts_user_options;/* misc user option flags */
+       pid_t                   ts_tgid_owner;  /* task that is using the
+                                                  context - for migration */
+       int                     ts_tsid;        /* thread that owns the
+                                                  structure */
+       int                     ts_tlb_int_select;/* target cpu if interrupts
+                                                    enabled */
+       int                     ts_ctxnum;      /* context number where the
+                                                  context is loaded */
+       atomic_t                ts_refcnt;      /* reference count GTS */
+       unsigned char           ts_dsr_au_count;/* Number of DSR resources
+                                                  required for contest */
+       unsigned char           ts_cbr_au_count;/* Number of CBR resources
+                                                  required for contest */
+       char                    ts_force_unload;/* force context to be unloaded
+                                                  after migration */
+       char                    ts_cbr_idx[GRU_CBR_AU];/* CBR numbers of each
+                                                         allocated CB */
+       unsigned long           ts_gdata[0];    /* save area for GRU data (CB,
+                                                  DS, CBE) */
+};
+
+/*
+ * Threaded programs actually allocate an array of GSEGs when a context is
+ * created. Each thread uses a separate GSEG. TSID is the index into the GSEG
+ * array.
+ */
+#define TSID(a, v)             (((a) - (v)->vm_start) / GRU_GSEG_PAGESIZE)
+#define UGRUADDR(gts)          ((gts)->ts_vma->vm_start +              \
+                                       (gts)->ts_tsid * GRU_GSEG_PAGESIZE)
+
+#define NULLCTX                        (-1)    /* if context not loaded into GRU */
+
+/*-----------------------------------------------------------------------------
+ *  GRU State Tables
+ */
+
+/*
+ * One of these exists for each GRU chiplet.
+ */
+struct gru_state {
+       struct gru_blade_state  *gs_blade;              /* GRU state for entire
+                                                          blade */
+       unsigned long           gs_gru_base_paddr;      /* Physical address of
+                                                          gru segments (64) */
+       void                    *gs_gru_base_vaddr;     /* Virtual address of
+                                                          gru segments (64) */
+       unsigned char           gs_gid;                 /* unique GRU number */
+       unsigned char           gs_tgh_local_shift;     /* used to pick TGH for
+                                                          local flush */
+       unsigned char           gs_tgh_first_remote;    /* starting TGH# for
+                                                          remote flush */
+       unsigned short          gs_blade_id;            /* blade of GRU */
+       spinlock_t              gs_asid_lock;           /* lock used for
+                                                          assigning asids */
+       spinlock_t              gs_lock;                /* lock used for
+                                                          assigning contexts */
+
+       /* -- the following are protected by the gs_asid_lock spinlock ---- */
+       unsigned int            gs_asid;                /* Next availe ASID */
+       unsigned int            gs_asid_limit;          /* Limit of available
+                                                          ASIDs */
+       unsigned int            gs_asid_gen;            /* asid generation.
+                                                          Inc on wrap */
+
+       /* --- the following fields are protected by the gs_lock spinlock --- */
+       unsigned long           gs_context_map;         /* bitmap to manage
+                                                          contexts in use */
+       unsigned long           gs_cbr_map;             /* bitmap to manage CB
+                                                          resources */
+       unsigned long           gs_dsr_map;             /* bitmap used to manage
+                                                          DATA resources */
+       unsigned int            gs_reserved_cbrs;       /* Number of kernel-
+                                                          reserved cbrs */
+       unsigned int            gs_reserved_dsr_bytes;  /* Bytes of kernel-
+                                                          reserved dsrs */
+       unsigned short          gs_active_contexts;     /* number of contexts
+                                                          in use */
+       struct gru_thread_state *gs_gts[GRU_NUM_CCH];   /* GTS currently using
+                                                          the context */
+};
+
+/*
+ * This structure contains the GRU state for all the GRUs on a blade.
+ */
+struct gru_blade_state {
+       void                    *kernel_cb;             /* First kernel
+                                                          reserved cb */
+       void                    *kernel_dsr;            /* First kernel
+                                                          reserved DSR */
+       /* ---- the following are protected by the bs_lock spinlock ---- */
+       spinlock_t              bs_lock;                /* lock used for
+                                                          stealing contexts */
+       int                     bs_lru_ctxnum;          /* STEAL - last context
+                                                          stolen */
+       struct gru_state        *bs_lru_gru;            /* STEAL - last gru
+                                                          stolen */
+
+       struct gru_state        bs_grus[GRU_CHIPLETS_PER_BLADE];
+};
+
+/*-----------------------------------------------------------------------------
+ * Address Primitives
+ */
+#define get_tfm_for_cpu(g, c)                                          \
+       ((struct gru_tlb_fault_map *)get_tfm((g)->gs_gru_base_vaddr, (c)))
+#define get_tfh_by_index(g, i)                                         \
+       ((struct gru_tlb_fault_handle *)get_tfh((g)->gs_gru_base_vaddr, (i)))
+#define get_tgh_by_index(g, i)                                         \
+       ((struct gru_tlb_global_handle *)get_tgh((g)->gs_gru_base_vaddr, (i)))
+#define get_cbe_by_index(g, i)                                         \
+       ((struct gru_control_block_extended *)get_cbe((g)->gs_gru_base_vaddr,\
+                       (i)))
+
+/*-----------------------------------------------------------------------------
+ * Useful Macros
+ */
+
+/* Given a blade# & chiplet#, get a pointer to the GRU */
+#define get_gru(b, c)          (&gru_base[b]->bs_grus[c])
+
+/* Number of bytes to save/restore when unloading/loading GRU contexts */
+#define DSR_BYTES(dsr)         ((dsr) * GRU_DSR_AU_BYTES)
+#define CBR_BYTES(cbr)         ((cbr) * GRU_HANDLE_BYTES * GRU_CBR_AU_SIZE * 2)
+
+/* Convert a user CB number to the actual CBRNUM */
+#define thread_cbr_number(gts, n) ((gts)->ts_cbr_idx[(n) / GRU_CBR_AU_SIZE] \
+                                 * GRU_CBR_AU_SIZE + (n) % GRU_CBR_AU_SIZE)
+
+/* Convert a gid to a pointer to the GRU */
+#define GID_TO_GRU(gid)                                                        \
+       (gru_base[(gid) / GRU_CHIPLETS_PER_BLADE] ?                     \
+               (&gru_base[(gid) / GRU_CHIPLETS_PER_BLADE]->            \
+                       bs_grus[(gid) % GRU_CHIPLETS_PER_BLADE]) :      \
+        NULL)
+
+/* Scan all active GRUs in a GRU bitmap */
+#define for_each_gru_in_bitmap(gid, map)                               \
+       for ((gid) = find_first_bit((map), GRU_MAX_GRUS); (gid) < GRU_MAX_GRUS;\
+               (gid)++, (gid) = find_next_bit((map), GRU_MAX_GRUS, (gid)))
+
+/* Scan all active GRUs on a specific blade */
+#define for_each_gru_on_blade(gru, nid, i)                             \
+       for ((gru) = gru_base[nid]->bs_grus, (i) = 0;                   \
+                       (i) < GRU_CHIPLETS_PER_BLADE;                   \
+                       (i)++, (gru)++)
+
+/* Scan all active GTSs on a gru. Note: must hold ss_lock to use this macro. */
+#define for_each_gts_on_gru(gts, gru, ctxnum)                          \
+       for ((ctxnum) = 0; (ctxnum) < GRU_NUM_CCH; (ctxnum)++)          \
+               if (((gts) = (gru)->gs_gts[ctxnum]))
+
+/* Scan each CBR whose bit is set in a TFM (or copy of) */
+#define for_each_cbr_in_tfm(i, map)                                    \
+       for ((i) = find_first_bit(map, GRU_NUM_CBE);                    \
+                       (i) < GRU_NUM_CBE;                              \
+                       (i)++, (i) = find_next_bit(map, GRU_NUM_CBE, i))
+
+/* Scan each CBR in a CBR bitmap. Note: multiple CBRs in an allocation unit */
+#define for_each_cbr_in_allocation_map(i, map, k)                      \
+       for ((k) = find_first_bit(map, GRU_CBR_AU); (k) < GRU_CBR_AU;   \
+                       (k) = find_next_bit(map, GRU_CBR_AU, (k) + 1))  \
+               for ((i) = (k)*GRU_CBR_AU_SIZE;                         \
+                               (i) < ((k) + 1) * GRU_CBR_AU_SIZE; (i)++)
+
+/* Scan each DSR in a DSR bitmap. Note: multiple DSRs in an allocation unit */
+#define for_each_dsr_in_allocation_map(i, map, k)                      \
+       for ((k) = find_first_bit((const unsigned long *)map, GRU_DSR_AU);\
+                       (k) < GRU_DSR_AU;                               \
+                       (k) = find_next_bit((const unsigned long *)map, \
+                                         GRU_DSR_AU, (k) + 1))         \
+               for ((i) = (k) * GRU_DSR_AU_CL;                         \
+                               (i) < ((k) + 1) * GRU_DSR_AU_CL; (i)++)
+
+#define gseg_physical_address(gru, ctxnum)                             \
+               ((gru)->gs_gru_base_paddr + ctxnum * GRU_GSEG_STRIDE)
+#define gseg_virtual_address(gru, ctxnum)                              \
+               ((gru)->gs_gru_base_vaddr + ctxnum * GRU_GSEG_STRIDE)
+
+/*-----------------------------------------------------------------------------
+ * Lock / Unlock GRU handles
+ *     Use the "delresp" bit in the handle as a "lock" bit.
+ */
+
+/* Lock hierarchy checking enabled only in emulator */
+
+static inline void __lock_handle(void *h)
+{
+       while (test_and_set_bit(1, h))
+               cpu_relax();
+}
+
+static inline void __unlock_handle(void *h)
+{
+       clear_bit(1, h);
+}
+
+static inline void lock_cch_handle(struct gru_context_configuration_handle *cch)
+{
+       __lock_handle(cch);
+}
+
+static inline void unlock_cch_handle(struct gru_context_configuration_handle
+                                    *cch)
+{
+       __unlock_handle(cch);
+}
+
+static inline void lock_tgh_handle(struct gru_tlb_global_handle *tgh)
+{
+       __lock_handle(tgh);
+}
+
+static inline void unlock_tgh_handle(struct gru_tlb_global_handle *tgh)
+{
+       __unlock_handle(tgh);
+}
+
+/*-----------------------------------------------------------------------------
+ * Function prototypes & externs
+ */
+struct gru_unload_context_req;
+
+extern struct vm_operations_struct gru_vm_ops;
+extern struct device *grudev;
+
+extern struct gru_vma_data *gru_alloc_vma_data(struct vm_area_struct *vma,
+                               int tsid);
+extern struct gru_thread_state *gru_find_thread_state(struct vm_area_struct
+                               *vma, int tsid);
+extern struct gru_thread_state *gru_alloc_thread_state(struct vm_area_struct
+                               *vma, int tsid);
+extern void gru_unload_context(struct gru_thread_state *gts, int savestate);
+extern void gts_drop(struct gru_thread_state *gts);
+extern void gru_tgh_flush_init(struct gru_state *gru);
+extern int gru_kservices_init(struct gru_state *gru);
+extern irqreturn_t gru_intr(int irq, void *dev_id);
+extern int gru_handle_user_call_os(unsigned long address);
+extern int gru_user_flush_tlb(unsigned long arg);
+extern int gru_user_unload_context(unsigned long arg);
+extern int gru_get_exception_detail(unsigned long arg);
+extern int gru_set_task_slice(long address);
+extern int gru_cpu_fault_map_id(void);
+extern struct vm_area_struct *gru_find_vma(unsigned long vaddr);
+extern void gru_flush_all_tlb(struct gru_state *gru);
+extern int gru_proc_init(void);
+extern void gru_proc_exit(void);
+
+extern unsigned long gru_reserve_cb_resources(struct gru_state *gru,
+               int cbr_au_count, char *cbmap);
+extern unsigned long gru_reserve_ds_resources(struct gru_state *gru,
+               int dsr_au_count, char *dsmap);
+extern int gru_fault(struct vm_area_struct *, struct vm_fault *vmf);
+extern struct gru_mm_struct *gru_register_mmu_notifier(void);
+extern void gru_drop_mmu_notifier(struct gru_mm_struct *gms);
+
+extern void gru_flush_tlb_range(struct gru_mm_struct *gms, unsigned long start,
+                                       unsigned long len);
+
+extern unsigned long gru_options;
+
+#endif /* __GRUTABLES_H__ */
diff --git a/drivers/misc/sgi-gru/grutlbpurge.c b/drivers/misc/sgi-gru/grutlbpurge.c
new file mode 100644 (file)
index 0000000..c84496a
--- /dev/null
@@ -0,0 +1,371 @@
+/*
+ * SN Platform GRU Driver
+ *
+ *             MMUOPS callbacks  + TLB flushing
+ *
+ * This file handles emu notifier callbacks from the core kernel. The callbacks
+ * are used to update the TLB in the GRU as a result of changes in the
+ * state of a process address space. This file also handles TLB invalidates
+ * from the GRU driver.
+ *
+ *  Copyright (c) 2008 Silicon Graphics, 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 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/kernel.h>
+#include <linux/list.h>
+#include <linux/spinlock.h>
+#include <linux/mm.h>
+#include <linux/slab.h>
+#include <linux/device.h>
+#include <linux/hugetlb.h>
+#include <linux/delay.h>
+#include <linux/timex.h>
+#include <linux/srcu.h>
+#include <asm/processor.h>
+#include "gru.h"
+#include "grutables.h"
+#include <asm/uv/uv_hub.h>
+
+#define gru_random()   get_cycles()
+
+/* ---------------------------------- TLB Invalidation functions --------
+ * get_tgh_handle
+ *
+ * Find a TGH to use for issuing a TLB invalidate. For GRUs that are on the
+ * local blade, use a fixed TGH that is a function of the blade-local cpu
+ * number. Normally, this TGH is private to the cpu & no contention occurs for
+ * the TGH. For offblade GRUs, select a random TGH in the range above the
+ * private TGHs. A spinlock is required to access this TGH & the lock must be
+ * released when the invalidate is completes. This sucks, but it is the best we
+ * can do.
+ *
+ * Note that the spinlock is IN the TGH handle so locking does not involve
+ * additional cache lines.
+ *
+ */
+static inline int get_off_blade_tgh(struct gru_state *gru)
+{
+       int n;
+
+       n = GRU_NUM_TGH - gru->gs_tgh_first_remote;
+       n = gru_random() % n;
+       n += gru->gs_tgh_first_remote;
+       return n;
+}
+
+static inline int get_on_blade_tgh(struct gru_state *gru)
+{
+       return uv_blade_processor_id() >> gru->gs_tgh_local_shift;
+}
+
+static struct gru_tlb_global_handle *get_lock_tgh_handle(struct gru_state
+                                                        *gru)
+{
+       struct gru_tlb_global_handle *tgh;
+       int n;
+
+       preempt_disable();
+       if (uv_numa_blade_id() == gru->gs_blade_id)
+               n = get_on_blade_tgh(gru);
+       else
+               n = get_off_blade_tgh(gru);
+       tgh = get_tgh_by_index(gru, n);
+       lock_tgh_handle(tgh);
+
+       return tgh;
+}
+
+static void get_unlock_tgh_handle(struct gru_tlb_global_handle *tgh)
+{
+       unlock_tgh_handle(tgh);
+       preempt_enable();
+}
+
+/*
+ * gru_flush_tlb_range
+ *
+ * General purpose TLB invalidation function. This function scans every GRU in
+ * the ENTIRE system (partition) looking for GRUs where the specified MM has
+ * been accessed by the GRU. For each GRU found, the TLB must be invalidated OR
+ * the ASID invalidated. Invalidating an ASID causes a new ASID to be assigned
+ * on the next fault. This effectively flushes the ENTIRE TLB for the MM at the
+ * cost of (possibly) a large number of future TLBmisses.
+ *
+ * The current algorithm is optimized based on the following (somewhat true)
+ * assumptions:
+ *     - GRU contexts are not loaded into a GRU unless a reference is made to
+ *       the data segment or control block (this is true, not an assumption).
+ *       If a DS/CB is referenced, the user will also issue instructions that
+ *       cause TLBmisses. It is not necessary to optimize for the case where
+ *       contexts are loaded but no instructions cause TLB misses. (I know
+ *       this will happen but I'm not optimizing for it).
+ *     - GRU instructions to invalidate TLB entries are SLOOOOWWW - normally
+ *       a few usec but in unusual cases, it could be longer. Avoid if
+ *       possible.
+ *     - intrablade process migration between cpus is not frequent but is
+ *       common.
+ *     - a GRU context is not typically migrated to a different GRU on the
+ *       blade because of intrablade migration
+ *     - interblade migration is rare. Processes migrate their GRU context to
+ *       the new blade.
+ *     - if interblade migration occurs, migration back to the original blade
+ *       is very very rare (ie., no optimization for this case)
+ *     - most GRU instruction operate on a subset of the user REGIONS. Code
+ *       & shared library regions are not likely targets of GRU instructions.
+ *
+ * To help improve the efficiency of TLB invalidation, the GMS data
+ * structure is maintained for EACH address space (MM struct). The GMS is
+ * also the structure that contains the pointer to the mmu callout
+ * functions. This structure is linked to the mm_struct for the address space
+ * using the mmu "register" function. The mmu interfaces are used to
+ * provide the callbacks for TLB invalidation. The GMS contains:
+ *
+ *     - asid[maxgrus] array. ASIDs are assigned to a GRU when a context is
+ *       loaded into the GRU.
+ *     - asidmap[maxgrus]. bitmap to make it easier to find non-zero asids in
+ *       the above array
+ *     - ctxbitmap[maxgrus]. Indicates the contexts that are currently active
+ *       in the GRU for the address space. This bitmap must be passed to the
+ *       GRU to do an invalidate.
+ *
+ * The current algorithm for invalidating TLBs is:
+ *     - scan the asidmap for GRUs where the context has been loaded, ie,
+ *       asid is non-zero.
+ *     - for each gru found:
+ *             - if the ctxtmap is non-zero, there are active contexts in the
+ *               GRU. TLB invalidate instructions must be issued to the GRU.
+ *             - if the ctxtmap is zero, no context is active. Set the ASID to
+ *               zero to force a full TLB invalidation. This is fast but will
+ *               cause a lot of TLB misses if the context is reloaded onto the
+ *               GRU
+ *
+ */
+
+void gru_flush_tlb_range(struct gru_mm_struct *gms, unsigned long start,
+                        unsigned long len)
+{
+       struct gru_state *gru;
+       struct gru_mm_tracker *asids;
+       struct gru_tlb_global_handle *tgh;
+       unsigned long num;
+       int grupagesize, pagesize, pageshift, gid, asid;
+
+       /* ZZZ TODO - handle huge pages */
+       pageshift = PAGE_SHIFT;
+       pagesize = (1UL << pageshift);
+       grupagesize = GRU_PAGESIZE(pageshift);
+       num = min(((len + pagesize - 1) >> pageshift), GRUMAXINVAL);
+
+       STAT(flush_tlb);
+       gru_dbg(grudev, "gms %p, start 0x%lx, len 0x%lx, asidmap 0x%lx\n", gms,
+               start, len, gms->ms_asidmap[0]);
+
+       spin_lock(&gms->ms_asid_lock);
+       for_each_gru_in_bitmap(gid, gms->ms_asidmap) {
+               STAT(flush_tlb_gru);
+               gru = GID_TO_GRU(gid);
+               asids = gms->ms_asids + gid;
+               asid = asids->mt_asid;
+               if (asids->mt_ctxbitmap && asid) {
+                       STAT(flush_tlb_gru_tgh);
+                       asid = GRUASID(asid, start);
+                       gru_dbg(grudev,
+       "  FLUSH gruid %d, asid 0x%x, num %ld, cbmap 0x%x\n",
+                               gid, asid, num, asids->mt_ctxbitmap);
+                       tgh = get_lock_tgh_handle(gru);
+                       tgh_invalidate(tgh, start, 0, asid, grupagesize, 0,
+                                      num - 1, asids->mt_ctxbitmap);
+                       get_unlock_tgh_handle(tgh);
+               } else {
+                       STAT(flush_tlb_gru_zero_asid);
+                       asids->mt_asid = 0;
+                       __clear_bit(gru->gs_gid, gms->ms_asidmap);
+                       gru_dbg(grudev,
+       "  CLEARASID gruid %d, asid 0x%x, cbtmap 0x%x, asidmap 0x%lx\n",
+                               gid, asid, asids->mt_ctxbitmap,
+                               gms->ms_asidmap[0]);
+               }
+       }
+       spin_unlock(&gms->ms_asid_lock);
+}
+
+/*
+ * Flush the entire TLB on a chiplet.
+ */
+void gru_flush_all_tlb(struct gru_state *gru)
+{
+       struct gru_tlb_global_handle *tgh;
+
+       gru_dbg(grudev, "gru %p, gid %d\n", gru, gru->gs_gid);
+       tgh = get_lock_tgh_handle(gru);
+       tgh_invalidate(tgh, 0, ~0, 0, 1, 1, GRUMAXINVAL - 1, 0);
+       get_unlock_tgh_handle(tgh);
+       preempt_enable();
+}
+
+/*
+ * MMUOPS notifier callout functions
+ */
+static void gru_invalidate_range_start(struct mmu_notifier *mn,
+                                      struct mm_struct *mm,
+                                      unsigned long start, unsigned long end)
+{
+       struct gru_mm_struct *gms = container_of(mn, struct gru_mm_struct,
+                                                ms_notifier);
+
+       STAT(mmu_invalidate_range);
+       atomic_inc(&gms->ms_range_active);
+       gru_dbg(grudev, "gms %p, start 0x%lx, end 0x%lx, act %d\n", gms,
+               start, end, atomic_read(&gms->ms_range_active));
+       gru_flush_tlb_range(gms, start, end - start);
+}
+
+static void gru_invalidate_range_end(struct mmu_notifier *mn,
+                                    struct mm_struct *mm, unsigned long start,
+                                    unsigned long end)
+{
+       struct gru_mm_struct *gms = container_of(mn, struct gru_mm_struct,
+                                                ms_notifier);
+
+       /* ..._and_test() provides needed barrier */
+       (void)atomic_dec_and_test(&gms->ms_range_active);
+
+       wake_up_all(&gms->ms_wait_queue);
+       gru_dbg(grudev, "gms %p, start 0x%lx, end 0x%lx\n", gms, start, end);
+}
+
+static void gru_invalidate_page(struct mmu_notifier *mn, struct mm_struct *mm,
+                               unsigned long address)
+{
+       struct gru_mm_struct *gms = container_of(mn, struct gru_mm_struct,
+                                                ms_notifier);
+
+       STAT(mmu_invalidate_page);
+       gru_flush_tlb_range(gms, address, PAGE_SIZE);
+       gru_dbg(grudev, "gms %p, address 0x%lx\n", gms, address);
+}
+
+static void gru_release(struct mmu_notifier *mn, struct mm_struct *mm)
+{
+       struct gru_mm_struct *gms = container_of(mn, struct gru_mm_struct,
+                                                ms_notifier);
+
+       gms->ms_released = 1;
+       gru_dbg(grudev, "gms %p\n", gms);
+}
+
+
+static const struct mmu_notifier_ops gru_mmuops = {
+       .invalidate_page        = gru_invalidate_page,
+       .invalidate_range_start = gru_invalidate_range_start,
+       .invalidate_range_end   = gru_invalidate_range_end,
+       .release                = gru_release,
+};
+
+/* Move this to the basic mmu_notifier file. But for now... */
+static struct mmu_notifier *mmu_find_ops(struct mm_struct *mm,
+                       const struct mmu_notifier_ops *ops)
+{
+       struct mmu_notifier *mn, *gru_mn = NULL;
+       struct hlist_node *n;
+
+       if (mm->mmu_notifier_mm) {
+               rcu_read_lock();
+               hlist_for_each_entry_rcu(mn, n, &mm->mmu_notifier_mm->list,
+                                        hlist)
+                   if (mn->ops == ops) {
+                       gru_mn = mn;
+                       break;
+               }
+               rcu_read_unlock();
+       }
+       return gru_mn;
+}
+
+struct gru_mm_struct *gru_register_mmu_notifier(void)
+{
+       struct gru_mm_struct *gms;
+       struct mmu_notifier *mn;
+
+       mn = mmu_find_ops(current->mm, &gru_mmuops);
+       if (mn) {
+               gms = container_of(mn, struct gru_mm_struct, ms_notifier);
+               atomic_inc(&gms->ms_refcnt);
+       } else {
+               gms = kzalloc(sizeof(*gms), GFP_KERNEL);
+               if (gms) {
+                       spin_lock_init(&gms->ms_asid_lock);
+                       gms->ms_notifier.ops = &gru_mmuops;
+                       atomic_set(&gms->ms_refcnt, 1);
+                       init_waitqueue_head(&gms->ms_wait_queue);
+                       __mmu_notifier_register(&gms->ms_notifier, current->mm);
+               }
+       }
+       gru_dbg(grudev, "gms %p, refcnt %d\n", gms,
+               atomic_read(&gms->ms_refcnt));
+       return gms;
+}
+
+void gru_drop_mmu_notifier(struct gru_mm_struct *gms)
+{
+       gru_dbg(grudev, "gms %p, refcnt %d, released %d\n", gms,
+               atomic_read(&gms->ms_refcnt), gms->ms_released);
+       if (atomic_dec_return(&gms->ms_refcnt) == 0) {
+               if (!gms->ms_released)
+                       mmu_notifier_unregister(&gms->ms_notifier, current->mm);
+               kfree(gms);
+       }
+}
+
+/*
+ * Setup TGH parameters. There are:
+ *     - 24 TGH handles per GRU chiplet
+ *     - a portion (MAX_LOCAL_TGH) of the handles are reserved for
+ *       use by blade-local cpus
+ *     - the rest are used by off-blade cpus. This usage is
+ *       less frequent than blade-local usage.
+ *
+ * For now, use 16 handles for local flushes, 8 for remote flushes. If the blade
+ * has less tan or equal to 16 cpus, each cpu has a unique handle that it can
+ * use.
+ */
+#define MAX_LOCAL_TGH  16
+
+void gru_tgh_flush_init(struct gru_state *gru)
+{
+       int cpus, shift = 0, n;
+
+       cpus = uv_blade_nr_possible_cpus(gru->gs_blade_id);
+
+       /* n = cpus rounded up to next power of 2 */
+       if (cpus) {
+               n = 1 << fls(cpus - 1);
+
+               /*
+                * shift count for converting local cpu# to TGH index
+                *      0 if cpus <= MAX_LOCAL_TGH,
+                *      1 if cpus <= 2*MAX_LOCAL_TGH,
+                *      etc
+                */
+               shift = max(0, fls(n - 1) - fls(MAX_LOCAL_TGH - 1));
+       }
+       gru->gs_tgh_local_shift = shift;
+
+       /* first starting TGH index to use for remote purges */
+       gru->gs_tgh_first_remote = (cpus + (1 << shift) - 1) >> shift;
+
+}
index b6e40a7..35ce285 100644 (file)
@@ -3,9 +3,17 @@
 #
 
 obj-$(CONFIG_SGI_XP)           += xp.o
-xp-y                           := xp_main.o xp_nofault.o
+xp-y                           := xp_main.o
+xp-$(CONFIG_IA64_SGI_SN2)      += xp_sn2.o xp_nofault.o
+xp-$(CONFIG_IA64_GENERIC)      += xp_sn2.o xp_nofault.o xp_uv.o
+xp-$(CONFIG_IA64_SGI_UV)       += xp_uv.o
+xp-$(CONFIG_X86_64)            += xp_uv.o
 
 obj-$(CONFIG_SGI_XP)           += xpc.o
 xpc-y                          := xpc_main.o xpc_channel.o xpc_partition.o
+xpc-$(CONFIG_IA64_SGI_SN2)     += xpc_sn2.o
+xpc-$(CONFIG_IA64_GENERIC)     += xpc_sn2.o xpc_uv.o
+xpc-$(CONFIG_IA64_SGI_UV)      += xpc_uv.o
+xpc-$(CONFIG_X86_64)           += xpc_uv.o
 
 obj-$(CONFIG_SGI_XP)           += xpnet.o
index 03a87a3..859a528 100644 (file)
 #ifndef _DRIVERS_MISC_SGIXP_XP_H
 #define _DRIVERS_MISC_SGIXP_XP_H
 
-#include <linux/cache.h>
-#include <linux/hardirq.h>
 #include <linux/mutex.h>
-#include <asm/sn/types.h>
-#include <asm/sn/bte.h>
+
+#ifdef CONFIG_IA64
+#include <asm/system.h>
+#include <asm/sn/arch.h>       /* defines is_shub1() and is_shub2() */
+#define is_shub()      ia64_platform_is("sn2")
+#define is_uv()                ia64_platform_is("uv")
+#endif
+#ifdef CONFIG_X86_64
+#include <asm/genapic.h>
+#define is_uv()                is_uv_system()
+#endif
+
+#ifndef is_shub1
+#define is_shub1()     0
+#endif
+
+#ifndef is_shub2
+#define is_shub2()     0
+#endif
+
+#ifndef is_shub
+#define is_shub()      0
+#endif
+
+#ifndef is_uv
+#define is_uv()                0
+#endif
 
 #ifdef USE_DBUG_ON
 #define DBUG_ON(condition)     BUG_ON(condition)
 #endif
 
 /*
- * Define the maximum number of logically defined partitions the system
- * can support. It is constrained by the maximum number of hardware
- * partitionable regions. The term 'region' in this context refers to the
- * minimum number of nodes that can comprise an access protection grouping.
- * The access protection is in regards to memory, IPI and IOI.
+ * Define the maximum number of partitions the system can possibly support.
+ * It is based on the maximum number of hardware partitionable regions. The
+ * term 'region' in this context refers to the minimum number of nodes that
+ * can comprise an access protection grouping. The access protection is in
+ * regards to memory, IPI and IOI.
  *
  * The maximum number of hardware partitionable regions is equal to the
  * maximum number of nodes in the entire system divided by the minimum number
  * of nodes that comprise an access protection grouping.
  */
-#define XP_MAX_PARTITIONS      64
-
-/*
- * Define the number of u64s required to represent all the C-brick nasids
- * as a bitmap.  The cross-partition kernel modules deal only with
- * C-brick nasids, thus the need for bitmaps which don't account for
- * odd-numbered (non C-brick) nasids.
- */
-#define XP_MAX_PHYSNODE_ID     (MAX_NUMALINK_NODES / 2)
-#define XP_NASID_MASK_BYTES    ((XP_MAX_PHYSNODE_ID + 7) / 8)
-#define XP_NASID_MASK_WORDS    ((XP_MAX_PHYSNODE_ID + 63) / 64)
-
-/*
- * Wrapper for bte_copy() that should it return a failure status will retry
- * the bte_copy() once in the hope that the failure was due to a temporary
- * aberration (i.e., the link going down temporarily).
- *
- *     src - physical address of the source of the transfer.
- *     vdst - virtual address of the destination of the transfer.
- *     len - number of bytes to transfer from source to destination.
- *     mode - see bte_copy() for definition.
- *     notification - see bte_copy() for definition.
- *
- * Note: xp_bte_copy() should never be called while holding a spinlock.
- */
-static inline bte_result_t
-xp_bte_copy(u64 src, u64 vdst, u64 len, u64 mode, void *notification)
-{
-       bte_result_t ret;
-       u64 pdst = ia64_tpa(vdst);
-
-       /*
-        * Ensure that the physically mapped memory is contiguous.
-        *
-        * We do this by ensuring that the memory is from region 7 only.
-        * If the need should arise to use memory from one of the other
-        * regions, then modify the BUG_ON() statement to ensure that the
-        * memory from that region is always physically contiguous.
-        */
-       BUG_ON(REGION_NUMBER(vdst) != RGN_KERNEL);
-
-       ret = bte_copy(src, pdst, len, mode, notification);
-       if ((ret != BTE_SUCCESS) && BTE_ERROR_RETRY(ret)) {
-               if (!in_interrupt())
-                       cond_resched();
-
-               ret = bte_copy(src, pdst, len, mode, notification);
-       }
-
-       return ret;
-}
+#define XP_MAX_NPARTITIONS_SN2 64
+#define XP_MAX_NPARTITIONS_UV  256
 
 /*
  * XPC establishes channel connections between the local partition and any
  * other partition that is currently up. Over these channels, kernel-level
  * `users' can communicate with their counterparts on the other partitions.
  *
- * The maxinum number of channels is limited to eight. For performance reasons,
- * the internal cross partition structures require sixteen bytes per channel,
- * and eight allows all of this interface-shared info to fit in one cache line.
- *
- * XPC_NCHANNELS reflects the total number of channels currently defined.
  * If the need for additional channels arises, one can simply increase
- * XPC_NCHANNELS accordingly. If the day should come where that number
- * exceeds the MAXIMUM number of channels allowed (eight), then one will need
- * to make changes to the XPC code to allow for this.
+ * XPC_MAX_NCHANNELS accordingly. If the day should come where that number
+ * exceeds the absolute MAXIMUM number of channels possible (eight), then one
+ * will need to make changes to the XPC code to accommodate for this.
+ *
+ * The absolute maximum number of channels possible is limited to eight for
+ * performance reasons on sn2 hardware. The internal cross partition structures
+ * require sixteen bytes per channel, and eight allows all of this
+ * interface-shared info to fit in one 128-byte cacheline.
  */
 #define XPC_MEM_CHANNEL                0       /* memory channel number */
 #define        XPC_NET_CHANNEL         1       /* network channel number */
 
-#define        XPC_NCHANNELS           2       /* #of defined channels */
-#define XPC_MAX_NCHANNELS      8       /* max #of channels allowed */
+#define XPC_MAX_NCHANNELS      2       /* max #of channels allowed */
 
-#if XPC_NCHANNELS > XPC_MAX_NCHANNELS
-#error XPC_NCHANNELS exceeds MAXIMUM allowed.
+#if XPC_MAX_NCHANNELS > 8
+#error XPC_MAX_NCHANNELS exceeds absolute MAXIMUM possible.
 #endif
 
 /*
- * The format of an XPC message is as follows:
- *
- *      +-------+--------------------------------+
- *      | flags |////////////////////////////////|
- *      +-------+--------------------------------+
- *      |             message #                  |
- *      +----------------------------------------+
- *      |     payload (user-defined message)     |
- *      |                                        |
- *                     :
- *      |                                        |
- *      +----------------------------------------+
- *
- * The size of the payload is defined by the user via xpc_connect(). A user-
- * defined message resides in the payload area.
- *
- * The user should have no dealings with the message header, but only the
- * message's payload. When a message entry is allocated (via xpc_allocate())
- * a pointer to the payload area is returned and not the actual beginning of
- * the XPC message. The user then constructs a message in the payload area
- * and passes that pointer as an argument on xpc_send() or xpc_send_notify().
- *
- * The size of a message entry (within a message queue) must be a cacheline
- * sized multiple in order to facilitate the BTE transfer of messages from one
- * message queue to another. A macro, XPC_MSG_SIZE(), is provided for the user
+ * Define macro, XPC_MSG_SIZE(), is provided for the user
  * that wants to fit as many msg entries as possible in a given memory size
  * (e.g. a memory page).
  */
-struct xpc_msg {
-       u8 flags;               /* FOR XPC INTERNAL USE ONLY */
-       u8 reserved[7];         /* FOR XPC INTERNAL USE ONLY */
-       s64 number;             /* FOR XPC INTERNAL USE ONLY */
-
-       u64 payload;            /* user defined portion of message */
-};
+#define XPC_MSG_MAX_SIZE       128
+#define XPC_MSG_HDR_MAX_SIZE   16
+#define XPC_MSG_PAYLOAD_MAX_SIZE (XPC_MSG_MAX_SIZE - XPC_MSG_HDR_MAX_SIZE)
 
-#define XPC_MSG_PAYLOAD_OFFSET (u64) (&((struct xpc_msg *)0)->payload)
 #define XPC_MSG_SIZE(_payload_size) \
-               L1_CACHE_ALIGN(XPC_MSG_PAYLOAD_OFFSET + (_payload_size))
+                               ALIGN(XPC_MSG_HDR_MAX_SIZE + (_payload_size), \
+                                     is_uv() ? 64 : 128)
+
 
 /*
  * Define the return values and values passed to user's callout functions.
@@ -233,8 +179,20 @@ enum xp_retval {
        xpDisconnected,         /* 51: channel disconnected (closed) */
 
        xpBteCopyError,         /* 52: bte_copy() returned error */
+       xpSalError,             /* 53: sn SAL error */
+       xpRsvdPageNotSet,       /* 54: the reserved page is not set up */
+       xpPayloadTooBig,        /* 55: payload too large for message slot */
+
+       xpUnsupported,          /* 56: unsupported functionality or resource */
+       xpNeedMoreInfo,         /* 57: more info is needed by SAL */
 
-       xpUnknownReason         /* 53: unknown reason - must be last in enum */
+       xpGruCopyError,         /* 58: gru_copy_gru() returned error */
+       xpGruSendMqError,       /* 59: gru send message queue related error */
+
+       xpBadChannelNumber,     /* 60: invalid channel number */
+       xpBadMsgType,           /* 60: invalid message type */
+
+       xpUnknownReason         /* 61: unknown reason - must be last in enum */
 };
 
 /*
@@ -285,6 +243,9 @@ typedef void (*xpc_channel_func) (enum xp_retval reason, short partid,
  * calling xpc_received().
  *
  * All other reason codes indicate failure.
+ *
+ * NOTE: The user defined function must be callable by an interrupt handler
+ *       and thus cannot block.
  */
 typedef void (*xpc_notify_func) (enum xp_retval reason, short partid,
                                 int ch_number, void *key);
@@ -308,23 +269,22 @@ struct xpc_registration {
        xpc_channel_func func;  /* function to call */
        void *key;              /* pointer to user's key */
        u16 nentries;           /* #of msg entries in local msg queue */
-       u16 msg_size;           /* message queue's message size */
+       u16 entry_size;         /* message queue's message entry size */
        u32 assigned_limit;     /* limit on #of assigned kthreads */
        u32 idle_limit;         /* limit on #of idle kthreads */
 } ____cacheline_aligned;
 
 #define XPC_CHANNEL_REGISTERED(_c)     (xpc_registrations[_c].func != NULL)
 
-/* the following are valid xpc_allocate() flags */
+/* the following are valid xpc_send() or xpc_send_notify() flags */
 #define XPC_WAIT       0       /* wait flag */
 #define XPC_NOWAIT     1       /* no wait flag */
 
 struct xpc_interface {
        void (*connect) (int);
        void (*disconnect) (int);
-       enum xp_retval (*allocate) (short, int, u32, void **);
-       enum xp_retval (*send) (short, int, void *);
-       enum xp_retval (*send_notify) (short, int, void *,
+       enum xp_retval (*send) (short, int, u32, void *, u16);
+       enum xp_retval (*send_notify) (short, int, u32, void *, u16,
                                        xpc_notify_func, void *);
        void (*received) (short, int, void *);
        enum xp_retval (*partid_to_nasids) (short, void *);
@@ -334,10 +294,9 @@ extern struct xpc_interface xpc_interface;
 
 extern void xpc_set_interface(void (*)(int),
                              void (*)(int),
-                             enum xp_retval (*)(short, int, u32, void **),
-                             enum xp_retval (*)(short, int, void *),
-                             enum xp_retval (*)(short, int, void *,
-                                                 xpc_notify_func, void *),
+                             enum xp_retval (*)(short, int, u32, void *, u16),
+                             enum xp_retval (*)(short, int, u32, void *, u16,
+                                                xpc_notify_func, void *),
                              void (*)(short, int, void *),
                              enum xp_retval (*)(short, void *));
 extern void xpc_clear_interface(void);
@@ -347,22 +306,19 @@ extern enum xp_retval xpc_connect(int, xpc_channel_func, void *, u16,
 extern void xpc_disconnect(int);
 
 static inline enum xp_retval
-xpc_allocate(short partid, int ch_number, u32 flags, void **payload)
-{
-       return xpc_interface.allocate(partid, ch_number, flags, payload);
-}
-
-static inline enum xp_retval
-xpc_send(short partid, int ch_number, void *payload)
+xpc_send(short partid, int ch_number, u32 flags, void *payload,
+        u16 payload_size)
 {
-       return xpc_interface.send(partid, ch_number, payload);
+       return xpc_interface.send(partid, ch_number, flags, payload,
+                                 payload_size);
 }
 
 static inline enum xp_retval
-xpc_send_notify(short partid, int ch_number, void *payload,
-               xpc_notify_func func, void *key)
+xpc_send_notify(short partid, int ch_number, u32 flags, void *payload,
+               u16 payload_size, xpc_notify_func func, void *key)
 {
-       return xpc_interface.send_notify(partid, ch_number, payload, func, key);
+       return xpc_interface.send_notify(partid, ch_number, flags, payload,
+                                        payload_size, func, key);
 }
 
 static inline void
@@ -377,8 +333,23 @@ xpc_partid_to_nasids(short partid, void *nasids)
        return xpc_interface.partid_to_nasids(partid, nasids);
 }
 
+extern short xp_max_npartitions;
+extern short xp_partition_id;
+extern u8 xp_region_size;
+
+extern unsigned long (*xp_pa) (void *);
+extern enum xp_retval (*xp_remote_memcpy) (unsigned long, const unsigned long,
+                      size_t);
+extern int (*xp_cpu_to_nasid) (int);
+
 extern u64 xp_nofault_PIOR_target;
 extern int xp_nofault_PIOR(void *);
 extern int xp_error_PIOR(void);
 
+extern struct device *xp;
+extern enum xp_retval xp_init_sn2(void);
+extern enum xp_retval xp_init_uv(void);
+extern void xp_exit_sn2(void);
+extern void xp_exit_uv(void);
+
 #endif /* _DRIVERS_MISC_SGIXP_XP_H */
index 196480b..66a1d19 100644 (file)
  *
  */
 
-#include <linux/kernel.h>
-#include <linux/interrupt.h>
 #include <linux/module.h>
-#include <linux/mutex.h>
-#include <asm/sn/intr.h>
-#include <asm/sn/sn_sal.h>
+#include <linux/device.h>
 #include "xp.h"
 
-/*
- * The export of xp_nofault_PIOR needs to happen here since it is defined
- * in drivers/misc/sgi-xp/xp_nofault.S. The target of the nofault read is
- * defined here.
- */
-EXPORT_SYMBOL_GPL(xp_nofault_PIOR);
+/* define the XP debug device structures to be used with dev_dbg() et al */
+
+struct device_driver xp_dbg_name = {
+       .name = "xp"
+};
+
+struct device xp_dbg_subname = {
+       .bus_id = {0},          /* set to "" */
+       .driver = &xp_dbg_name
+};
+
+struct device *xp = &xp_dbg_subname;
+
+/* max #of partitions possible */
+short xp_max_npartitions;
+EXPORT_SYMBOL_GPL(xp_max_npartitions);
+
+short xp_partition_id;
+EXPORT_SYMBOL_GPL(xp_partition_id);
+
+u8 xp_region_size;
+EXPORT_SYMBOL_GPL(xp_region_size);
+
+unsigned long (*xp_pa) (void *addr);
+EXPORT_SYMBOL_GPL(xp_pa);
+
+enum xp_retval (*xp_remote_memcpy) (unsigned long dst_gpa,
+                                   const unsigned long src_gpa, size_t len);
+EXPORT_SYMBOL_GPL(xp_remote_memcpy);
 
-u64 xp_nofault_PIOR_target;
-EXPORT_SYMBOL_GPL(xp_nofault_PIOR_target);
+int (*xp_cpu_to_nasid) (int cpuid);
+EXPORT_SYMBOL_GPL(xp_cpu_to_nasid);
 
 /*
  * xpc_registrations[] keeps track of xpc_connect()'s done by the kernel-level
  * users of XPC.
  */
-struct xpc_registration xpc_registrations[XPC_NCHANNELS];
+struct xpc_registration xpc_registrations[XPC_MAX_NCHANNELS];
 EXPORT_SYMBOL_GPL(xpc_registrations);
 
 /*
@@ -51,10 +70,9 @@ xpc_notloaded(void)
 struct xpc_interface xpc_interface = {
        (void (*)(int))xpc_notloaded,
        (void (*)(int))xpc_notloaded,
-       (enum xp_retval(*)(short, int, u32, void **))xpc_notloaded,
-       (enum xp_retval(*)(short, int, void *))xpc_notloaded,
-       (enum xp_retval(*)(short, int, void *, xpc_notify_func, void *))
-           xpc_notloaded,
+       (enum xp_retval(*)(short, int, u32, void *, u16))xpc_notloaded,
+       (enum xp_retval(*)(short, int, u32, void *, u16, xpc_notify_func,
+                          void *))xpc_notloaded,
        (void (*)(short, int, void *))xpc_notloaded,
        (enum xp_retval(*)(short, void *))xpc_notloaded
 };
@@ -66,16 +84,14 @@ EXPORT_SYMBOL_GPL(xpc_interface);
 void
 xpc_set_interface(void (*connect) (int),
                  void (*disconnect) (int),
-                 enum xp_retval (*allocate) (short, int, u32, void **),
-                 enum xp_retval (*send) (short, int, void *),
-                 enum xp_retval (*send_notify) (short, int, void *,
+                 enum xp_retval (*send) (short, int, u32, void *, u16),
+                 enum xp_retval (*send_notify) (short, int, u32, void *, u16,
                                                  xpc_notify_func, void *),
                  void (*received) (short, int, void *),
                  enum xp_retval (*partid_to_nasids) (short, void *))
 {
        xpc_interface.connect = connect;
        xpc_interface.disconnect = disconnect;
-       xpc_interface.allocate = allocate;
        xpc_interface.send = send;
        xpc_interface.send_notify = send_notify;
        xpc_interface.received = received;
@@ -91,13 +107,11 @@ xpc_clear_interface(void)
 {
        xpc_interface.connect = (void (*)(int))xpc_notloaded;
        xpc_interface.disconnect = (void (*)(int))xpc_notloaded;
-       xpc_interface.allocate = (enum xp_retval(*)(short, int, u32,
-                                                    void **))xpc_notloaded;
-       xpc_interface.send = (enum xp_retval(*)(short, int, void *))
+       xpc_interface.send = (enum xp_retval(*)(short, int, u32, void *, u16))
            xpc_notloaded;
-       xpc_interface.send_notify = (enum xp_retval(*)(short, int, void *,
-                                                       xpc_notify_func,
-                                                       void *))xpc_notloaded;
+       xpc_interface.send_notify = (enum xp_retval(*)(short, int, u32, void *,
+                                                      u16, xpc_notify_func,
+                                                      void *))xpc_notloaded;
        xpc_interface.received = (void (*)(short, int, void *))
            xpc_notloaded;
        xpc_interface.partid_to_nasids = (enum xp_retval(*)(short, void *))
@@ -135,11 +149,14 @@ xpc_connect(int ch_number, xpc_channel_func func, void *key, u16 payload_size,
 {
        struct xpc_registration *registration;
 
-       DBUG_ON(ch_number < 0 || ch_number >= XPC_NCHANNELS);
+       DBUG_ON(ch_number < 0 || ch_number >= XPC_MAX_NCHANNELS);
        DBUG_ON(payload_size == 0 || nentries == 0);
        DBUG_ON(func == NULL);
        DBUG_ON(assigned_limit == 0 || idle_limit > assigned_limit);
 
+       if (XPC_MSG_SIZE(payload_size) > XPC_MSG_MAX_SIZE)
+               return xpPayloadTooBig;
+
        registration = &xpc_registrations[ch_number];
 
        if (mutex_lock_interruptible(&registration->mutex) != 0)
@@ -152,7 +169,7 @@ xpc_connect(int ch_number, xpc_channel_func func, void *key, u16 payload_size,
        }
 
        /* register the channel for connection */
-       registration->msg_size = XPC_MSG_SIZE(payload_size);
+       registration->entry_size = XPC_MSG_SIZE(payload_size);
        registration->nentries = nentries;
        registration->assigned_limit = assigned_limit;
        registration->idle_limit = idle_limit;
@@ -185,7 +202,7 @@ xpc_disconnect(int ch_number)
 {
        struct xpc_registration *registration;
 
-       DBUG_ON(ch_number < 0 || ch_number >= XPC_NCHANNELS);
+       DBUG_ON(ch_number < 0 || ch_number >= XPC_MAX_NCHANNELS);
 
        registration = &xpc_registrations[ch_number];
 
@@ -206,7 +223,7 @@ xpc_disconnect(int ch_number)
        registration->func = NULL;
        registration->key = NULL;
        registration->nentries = 0;
-       registration->msg_size = 0;
+       registration->entry_size = 0;
        registration->assigned_limit = 0;
        registration->idle_limit = 0;
 
@@ -221,39 +238,21 @@ EXPORT_SYMBOL_GPL(xpc_disconnect);
 int __init
 xp_init(void)
 {
-       int ret, ch_number;
-       u64 func_addr = *(u64 *)xp_nofault_PIOR;
-       u64 err_func_addr = *(u64 *)xp_error_PIOR;
-
-       if (!ia64_platform_is("sn2"))
-               return -ENODEV;
+       enum xp_retval ret;
+       int ch_number;
 
-       /*
-        * Register a nofault code region which performs a cross-partition
-        * PIO read. If the PIO read times out, the MCA handler will consume
-        * the error and return to a kernel-provided instruction to indicate
-        * an error. This PIO read exists because it is guaranteed to timeout
-        * if the destination is down (AMO operations do not timeout on at
-        * least some CPUs on Shubs <= v1.2, which unfortunately we have to
-        * work around).
-        */
-       ret = sn_register_nofault_code(func_addr, err_func_addr, err_func_addr,
-                                      1, 1);
-       if (ret != 0) {
-               printk(KERN_ERR "XP: can't register nofault code, error=%d\n",
-                      ret);
-       }
-       /*
-        * Setup the nofault PIO read target. (There is no special reason why
-        * SH_IPI_ACCESS was selected.)
-        */
-       if (is_shub2())
-               xp_nofault_PIOR_target = SH2_IPI_ACCESS0;
+       if (is_shub())
+               ret = xp_init_sn2();
+       else if (is_uv())
+               ret = xp_init_uv();
        else
-               xp_nofault_PIOR_target = SH1_IPI_ACCESS;
+               ret = xpUnsupported;
+
+       if (ret != xpSuccess)
+               return -ENODEV;
 
        /* initialize the connection registration mutex */
-       for (ch_number = 0; ch_number < XPC_NCHANNELS; ch_number++)
+       for (ch_number = 0; ch_number < XPC_MAX_NCHANNELS; ch_number++)
                mutex_init(&xpc_registrations[ch_number].mutex);
 
        return 0;
@@ -264,12 +263,10 @@ module_init(xp_init);
 void __exit
 xp_exit(void)
 {
-       u64 func_addr = *(u64 *)xp_nofault_PIOR;
-       u64 err_func_addr = *(u64 *)xp_error_PIOR;
-
-       /* unregister the PIO read nofault code region */
-       (void)sn_register_nofault_code(func_addr, err_func_addr,
-                                      err_func_addr, 1, 0);
+       if (is_shub())
+               xp_exit_sn2();
+       else if (is_uv())
+               xp_exit_uv();
 }
 
 module_exit(xp_exit);
diff --git a/drivers/misc/sgi-xp/xp_sn2.c b/drivers/misc/sgi-xp/xp_sn2.c
new file mode 100644 (file)
index 0000000..1440134
--- /dev/null
@@ -0,0 +1,146 @@
+/*
+ * 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) 2008 Silicon Graphics, Inc.  All Rights Reserved.
+ */
+
+/*
+ * Cross Partition (XP) sn2-based functions.
+ *
+ *      Architecture specific implementation of common functions.
+ */
+
+#include <linux/module.h>
+#include <linux/device.h>
+#include <asm/sn/bte.h>
+#include <asm/sn/sn_sal.h>
+#include "xp.h"
+
+/*
+ * The export of xp_nofault_PIOR needs to happen here since it is defined
+ * in drivers/misc/sgi-xp/xp_nofault.S. The target of the nofault read is
+ * defined here.
+ */
+EXPORT_SYMBOL_GPL(xp_nofault_PIOR);
+
+u64 xp_nofault_PIOR_target;
+EXPORT_SYMBOL_GPL(xp_nofault_PIOR_target);
+
+/*
+ * Register a nofault code region which performs a cross-partition PIO read.
+ * If the PIO read times out, the MCA handler will consume the error and
+ * return to a kernel-provided instruction to indicate an error. This PIO read
+ * exists because it is guaranteed to timeout if the destination is down
+ * (amo operations do not timeout on at least some CPUs on Shubs <= v1.2,
+ * which unfortunately we have to work around).
+ */
+static enum xp_retval
+xp_register_nofault_code_sn2(void)
+{
+       int ret;
+       u64 func_addr;
+       u64 err_func_addr;
+
+       func_addr = *(u64 *)xp_nofault_PIOR;
+       err_func_addr = *(u64 *)xp_error_PIOR;
+       ret = sn_register_nofault_code(func_addr, err_func_addr, err_func_addr,
+                                      1, 1);
+       if (ret != 0) {
+               dev_err(xp, "can't register nofault code, error=%d\n", ret);
+               return xpSalError;
+       }
+       /*
+        * Setup the nofault PIO read target. (There is no special reason why
+        * SH_IPI_ACCESS was selected.)
+        */
+       if (is_shub1())
+               xp_nofault_PIOR_target = SH1_IPI_ACCESS;
+       else if (is_shub2())
+               xp_nofault_PIOR_target = SH2_IPI_ACCESS0;
+
+       return xpSuccess;
+}
+
+static void
+xp_unregister_nofault_code_sn2(void)
+{
+       u64 func_addr = *(u64 *)xp_nofault_PIOR;
+       u64 err_func_addr = *(u64 *)xp_error_PIOR;
+
+       /* unregister the PIO read nofault code region */
+       (void)sn_register_nofault_code(func_addr, err_func_addr,
+                                      err_func_addr, 1, 0);
+}
+
+/*
+ * Convert a virtual memory address to a physical memory address.
+ */
+static unsigned long
+xp_pa_sn2(void *addr)
+{
+       return __pa(addr);
+}
+
+/*
+ * Wrapper for bte_copy().
+ *
+ *     dst_pa - physical address of the destination of the transfer.
+ *     src_pa - physical address of the source of the transfer.
+ *     len - number of bytes to transfer from source to destination.
+ *
+ * Note: xp_remote_memcpy_sn2() should never be called while holding a spinlock.
+ */
+static enum xp_retval
+xp_remote_memcpy_sn2(unsigned long dst_pa, const unsigned long src_pa,
+                    size_t len)
+{
+       bte_result_t ret;
+
+       ret = bte_copy(src_pa, dst_pa, len, (BTE_NOTIFY | BTE_WACQUIRE), NULL);
+       if (ret == BTE_SUCCESS)
+               return xpSuccess;
+
+       if (is_shub2()) {
+               dev_err(xp, "bte_copy() on shub2 failed, error=0x%x dst_pa="
+                       "0x%016lx src_pa=0x%016lx len=%ld\\n", ret, dst_pa,
+                       src_pa, len);
+       } else {
+               dev_err(xp, "bte_copy() failed, error=%d dst_pa=0x%016lx "
+                       "src_pa=0x%016lx len=%ld\\n", ret, dst_pa, src_pa, len);
+       }
+
+       return xpBteCopyError;
+}
+
+static int
+xp_cpu_to_nasid_sn2(int cpuid)
+{
+       return cpuid_to_nasid(cpuid);
+}
+
+enum xp_retval
+xp_init_sn2(void)
+{
+       BUG_ON(!is_shub());
+
+       xp_max_npartitions = XP_MAX_NPARTITIONS_SN2;
+       xp_partition_id = sn_partition_id;
+       xp_region_size = sn_region_size;
+
+       xp_pa = xp_pa_sn2;
+       xp_remote_memcpy = xp_remote_memcpy_sn2;
+       xp_cpu_to_nasid = xp_cpu_to_nasid_sn2;
+
+       return xp_register_nofault_code_sn2();
+}
+
+void
+xp_exit_sn2(void)
+{
+       BUG_ON(!is_shub());
+
+       xp_unregister_nofault_code_sn2();
+}
+
diff --git a/drivers/misc/sgi-xp/xp_uv.c b/drivers/misc/sgi-xp/xp_uv.c
new file mode 100644 (file)
index 0000000..d9f7ce2
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * 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) 2008 Silicon Graphics, Inc.  All Rights Reserved.
+ */
+
+/*
+ * Cross Partition (XP) uv-based functions.
+ *
+ *      Architecture specific implementation of common functions.
+ *
+ */
+
+#include <linux/device.h>
+#include <asm/uv/uv_hub.h>
+#include "../sgi-gru/grukservices.h"
+#include "xp.h"
+
+/*
+ * Convert a virtual memory address to a physical memory address.
+ */
+static unsigned long
+xp_pa_uv(void *addr)
+{
+       return uv_gpa(addr);
+}
+
+static enum xp_retval
+xp_remote_memcpy_uv(unsigned long dst_gpa, const unsigned long src_gpa,
+                   size_t len)
+{
+       int ret;
+
+       ret = gru_copy_gpa(dst_gpa, src_gpa, len);
+       if (ret == 0)
+               return xpSuccess;
+
+       dev_err(xp, "gru_copy_gpa() failed, dst_gpa=0x%016lx src_gpa=0x%016lx "
+               "len=%ld\n", dst_gpa, src_gpa, len);
+       return xpGruCopyError;
+}
+
+static int
+xp_cpu_to_nasid_uv(int cpuid)
+{
+       /* ??? Is this same as sn2 nasid in mach/part bitmaps set up by SAL? */
+       return UV_PNODE_TO_NASID(uv_cpu_to_pnode(cpuid));
+}
+
+enum xp_retval
+xp_init_uv(void)
+{
+       BUG_ON(!is_uv());
+
+       xp_max_npartitions = XP_MAX_NPARTITIONS_UV;
+       xp_partition_id = 0;    /* !!! not correct value */
+       xp_region_size = 0;     /* !!! not correct value */
+
+       xp_pa = xp_pa_uv;
+       xp_remote_memcpy = xp_remote_memcpy_uv;
+       xp_cpu_to_nasid = xp_cpu_to_nasid_uv;
+
+       return xpSuccess;
+}
+
+void
+xp_exit_uv(void)
+{
+       BUG_ON(!is_uv());
+}
index 11ac267..619208d 100644 (file)
 #ifndef _DRIVERS_MISC_SGIXP_XPC_H
 #define _DRIVERS_MISC_SGIXP_XPC_H
 
-#include <linux/interrupt.h>
-#include <linux/sysctl.h>
-#include <linux/device.h>
-#include <linux/mutex.h>
+#include <linux/wait.h>
 #include <linux/completion.h>
-#include <asm/pgtable.h>
-#include <asm/processor.h>
-#include <asm/sn/bte.h>
-#include <asm/sn/clksupport.h>
-#include <asm/sn/addrs.h>
-#include <asm/sn/mspec.h>
-#include <asm/sn/shub_mmr.h>
+#include <linux/timer.h>
+#include <linux/sched.h>
 #include "xp.h"
 
 /*
 #define XPC_VERSION_MAJOR(_v)          ((_v) >> 4)
 #define XPC_VERSION_MINOR(_v)          ((_v) & 0xf)
 
-/*
- * The next macros define word or bit representations for given
- * C-brick nasid in either the SAL provided bit array representing
- * nasids in the partition/machine or the AMO_t array used for
- * inter-partition initiation communications.
- *
- * For SN2 machines, C-Bricks are alway even numbered NASIDs.  As
- * such, some space will be saved by insisting that nasid information
- * passed from SAL always be packed for C-Bricks and the
- * cross-partition interrupts use the same packing scheme.
- */
-#define XPC_NASID_W_INDEX(_n)  (((_n) / 64) / 2)
-#define XPC_NASID_B_INDEX(_n)  (((_n) / 2) & (64 - 1))
-#define XPC_NASID_IN_ARRAY(_n, _p) ((_p)[XPC_NASID_W_INDEX(_n)] & \
-                                   (1UL << XPC_NASID_B_INDEX(_n)))
-#define XPC_NASID_FROM_W_B(_w, _b) (((_w) * 64 + (_b)) * 2)
-
+/* define frequency of the heartbeat and frequency how often it's checked */
 #define XPC_HB_DEFAULT_INTERVAL                5       /* incr HB every x secs */
 #define XPC_HB_CHECK_DEFAULT_INTERVAL  20      /* check HB every x secs */
 
  *
  *   reserved page header
  *
- *     The first cacheline of the reserved page contains the header
- *     (struct xpc_rsvd_page). Before SAL initialization has completed,
+ *     The first two 64-byte cachelines of the reserved page contain the
+ *     header (struct xpc_rsvd_page). Before SAL initialization has completed,
  *     SAL has set up the following fields of the reserved page header:
- *     SAL_signature, SAL_version, partid, and nasids_size. The other
- *     fields are set up by XPC. (xpc_rsvd_page points to the local
+ *     SAL_signature, SAL_version, SAL_partid, and SAL_nasids_size. The
+ *     other fields are set up by XPC. (xpc_rsvd_page points to the local
  *     partition's reserved page.)
  *
  *   part_nasids mask
  *     the actual nasids in the entire machine (mach_nasids). We're only
  *     interested in the even numbered nasids (which contain the processors
  *     and/or memory), so we only need half as many bits to represent the
- *     nasids. The part_nasids mask is located starting at the first cacheline
- *     following the reserved page header. The mach_nasids mask follows right
- *     after the part_nasids mask. The size in bytes of each mask is reflected
- *     by the reserved page header field 'nasids_size'. (Local partition's
- *     mask pointers are xpc_part_nasids and xpc_mach_nasids.)
+ *     nasids. When mapping nasid to bit in a mask (or bit to nasid) be sure
+ *     to either divide or multiply by 2. The part_nasids mask is located
+ *     starting at the first cacheline following the reserved page header. The
+ *     mach_nasids mask follows right after the part_nasids mask. The size in
+ *     bytes of each mask is reflected by the reserved page header field
+ *     'SAL_nasids_size'. (Local partition's mask pointers are xpc_part_nasids
+ *     and xpc_mach_nasids.)
  *
- *   vars
- *   vars part
+ *   vars      (ia64-sn2 only)
+ *   vars part (ia64-sn2 only)
  *
  *     Immediately following the mach_nasids mask are the XPC variables
  *     required by other partitions. First are those that are generic to all
  *     which are partition specific (vars part). These are setup by XPC.
  *     (Local partition's vars pointers are xpc_vars and xpc_vars_part.)
  *
- * Note: Until vars_pa is set, the partition XPC code has not been initialized.
+ * Note: Until 'ts_jiffies' is set non-zero, the partition XPC code has not been
+ *       initialized.
  */
 struct xpc_rsvd_page {
        u64 SAL_signature;      /* SAL: unique signature */
        u64 SAL_version;        /* SAL: version */
-       u8 partid;              /* SAL: partition ID */
+       short SAL_partid;       /* SAL: partition ID */
+       short max_npartitions;  /* value of XPC_MAX_PARTITIONS */
        u8 version;
-       u8 pad1[6];             /* align to next u64 in cacheline */
-       u64 vars_pa;            /* physical address of struct xpc_vars */
-       struct timespec stamp;  /* time when reserved page was setup by XPC */
-       u64 pad2[9];            /* align to last u64 in cacheline */
-       u64 nasids_size;        /* SAL: size of each nasid mask in bytes */
+       u8 pad1[3];             /* align to next u64 in 1st 64-byte cacheline */
+       union {
+               unsigned long vars_pa;  /* phys address of struct xpc_vars */
+               unsigned long activate_mq_gpa; /* gru phy addr of activate_mq */
+       } sn;
+       unsigned long ts_jiffies; /* timestamp when rsvd pg was setup by XPC */
+       u64 pad2[10];           /* align to last u64 in 2nd 64-byte cacheline */
+       u64 SAL_nasids_size;    /* SAL: size of each nasid mask in bytes */
 };
 
-#define XPC_RP_VERSION _XPC_VERSION(1, 1) /* version 1.1 of the reserved page */
-
-#define XPC_SUPPORTS_RP_STAMP(_version) \
-                       (_version >= _XPC_VERSION(1, 1))
-
-/*
- * compare stamps - the return value is:
- *
- *     < 0,    if stamp1 < stamp2
- *     = 0,    if stamp1 == stamp2
- *     > 0,    if stamp1 > stamp2
- */
-static inline int
-xpc_compare_stamps(struct timespec *stamp1, struct timespec *stamp2)
-{
-       int ret;
-
-       ret = stamp1->tv_sec - stamp2->tv_sec;
-       if (ret == 0)
-               ret = stamp1->tv_nsec - stamp2->tv_nsec;
-
-       return ret;
-}
+#define XPC_RP_VERSION _XPC_VERSION(2, 0) /* version 2.0 of the reserved page */
 
 /*
  * Define the structures by which XPC variables can be exported to other
@@ -154,85 +115,40 @@ xpc_compare_stamps(struct timespec *stamp1, struct timespec *stamp2)
  * reflected by incrementing either the major or minor version numbers
  * of struct xpc_vars.
  */
-struct xpc_vars {
+struct xpc_vars_sn2 {
        u8 version;
        u64 heartbeat;
-       u64 heartbeating_to_mask;
+       DECLARE_BITMAP(heartbeating_to_mask, XP_MAX_NPARTITIONS_SN2);
        u64 heartbeat_offline;  /* if 0, heartbeat should be changing */
-       int act_nasid;
-       int act_phys_cpuid;
-       u64 vars_part_pa;
-       u64 amos_page_pa;       /* paddr of page of AMOs from MSPEC driver */
-       AMO_t *amos_page;       /* vaddr of page of AMOs from MSPEC driver */
+       int activate_IRQ_nasid;
+       int activate_IRQ_phys_cpuid;
+       unsigned long vars_part_pa;
+       unsigned long amos_page_pa;/* paddr of page of amos from MSPEC driver */
+       struct amo *amos_page;  /* vaddr of page of amos from MSPEC driver */
 };
 
 #define XPC_V_VERSION _XPC_VERSION(3, 1)    /* version 3.1 of the cross vars */
 
-#define XPC_SUPPORTS_DISENGAGE_REQUEST(_version) \
-                       (_version >= _XPC_VERSION(3, 1))
-
-static inline int
-xpc_hb_allowed(short partid, struct xpc_vars *vars)
-{
-       return ((vars->heartbeating_to_mask & (1UL << partid)) != 0);
-}
-
-static inline void
-xpc_allow_hb(short partid, struct xpc_vars *vars)
-{
-       u64 old_mask, new_mask;
-
-       do {
-               old_mask = vars->heartbeating_to_mask;
-               new_mask = (old_mask | (1UL << partid));
-       } while (cmpxchg(&vars->heartbeating_to_mask, old_mask, new_mask) !=
-                old_mask);
-}
-
-static inline void
-xpc_disallow_hb(short partid, struct xpc_vars *vars)
-{
-       u64 old_mask, new_mask;
-
-       do {
-               old_mask = vars->heartbeating_to_mask;
-               new_mask = (old_mask & ~(1UL << partid));
-       } while (cmpxchg(&vars->heartbeating_to_mask, old_mask, new_mask) !=
-                old_mask);
-}
-
-/*
- * The AMOs page consists of a number of AMO variables which are divided into
- * four groups, The first two groups are used to identify an IRQ's sender.
- * These two groups consist of 64 and 128 AMO variables respectively. The last
- * two groups, consisting of just one AMO variable each, are used to identify
- * the remote partitions that are currently engaged (from the viewpoint of
- * the XPC running on the remote partition).
- */
-#define XPC_NOTIFY_IRQ_AMOS       0
-#define XPC_ACTIVATE_IRQ_AMOS     (XPC_NOTIFY_IRQ_AMOS + XP_MAX_PARTITIONS)
-#define XPC_ENGAGED_PARTITIONS_AMO (XPC_ACTIVATE_IRQ_AMOS + XP_NASID_MASK_WORDS)
-#define XPC_DISENGAGE_REQUEST_AMO  (XPC_ENGAGED_PARTITIONS_AMO + 1)
-
 /*
  * The following structure describes the per partition specific variables.
  *
  * An array of these structures, one per partition, will be defined. As a
  * partition becomes active XPC will copy the array entry corresponding to
- * itself from that partition. It is desirable that the size of this
- * structure evenly divide into a cacheline, such that none of the entries
- * in this array crosses a cacheline boundary. As it is now, each entry
- * occupies half a cacheline.
+ * itself from that partition. It is desirable that the size of this structure
+ * evenly divides into a 128-byte cacheline, such that none of the entries in
+ * this array crosses a 128-byte cacheline boundary. As it is now, each entry
+ * occupies 64-bytes.
  */
-struct xpc_vars_part {
+struct xpc_vars_part_sn2 {
        u64 magic;
 
-       u64 openclose_args_pa;  /* physical address of open and close args */
-       u64 GPs_pa;             /* physical address of Get/Put values */
+       unsigned long openclose_args_pa; /* phys addr of open and close args */
+       unsigned long GPs_pa;   /* physical address of Get/Put values */
+
+       unsigned long chctl_amo_pa; /* physical address of chctl flags' amo */
 
-       u64 IPI_amo_pa;         /* physical address of IPI AMO_t structure */
-       int IPI_nasid;          /* nasid of where to send IPIs */
-       int IPI_phys_cpuid;     /* physical CPU ID of where to send IPIs */
+       int notify_IRQ_nasid;   /* nasid of where to send notify IRQs */
+       int notify_IRQ_phys_cpuid;      /* CPUID of where to send notify IRQs */
 
        u8 nchannels;           /* #of defined channels supported */
 
@@ -248,20 +164,95 @@ struct xpc_vars_part {
  * MAGIC2 indicates that this partition has pulled the remote partititions
  * per partition variables that pertain to this partition.
  */
-#define XPC_VP_MAGIC1  0x0053524156435058L   /* 'XPCVARS\0'L (little endian) */
-#define XPC_VP_MAGIC2  0x0073726176435058L   /* 'XPCvars\0'L (little endian) */
+#define XPC_VP_MAGIC1_SN2 0x0053524156435058L /* 'XPCVARS\0'L (little endian) */
+#define XPC_VP_MAGIC2_SN2 0x0073726176435058L /* 'XPCvars\0'L (little endian) */
 
 /* the reserved page sizes and offsets */
 
 #define XPC_RP_HEADER_SIZE     L1_CACHE_ALIGN(sizeof(struct xpc_rsvd_page))
-#define XPC_RP_VARS_SIZE       L1_CACHE_ALIGN(sizeof(struct xpc_vars))
+#define XPC_RP_VARS_SIZE       L1_CACHE_ALIGN(sizeof(struct xpc_vars_sn2))
 
-#define XPC_RP_PART_NASIDS(_rp) ((u64 *)((u8 *)(_rp) + XPC_RP_HEADER_SIZE))
-#define XPC_RP_MACH_NASIDS(_rp) (XPC_RP_PART_NASIDS(_rp) + xp_nasid_mask_words)
-#define XPC_RP_VARS(_rp)       ((struct xpc_vars *)(XPC_RP_MACH_NASIDS(_rp) + \
-                                   xp_nasid_mask_words))
-#define XPC_RP_VARS_PART(_rp)  ((struct xpc_vars_part *) \
-                                   ((u8 *)XPC_RP_VARS(_rp) + XPC_RP_VARS_SIZE))
+#define XPC_RP_PART_NASIDS(_rp) ((unsigned long *)((u8 *)(_rp) + \
+                                XPC_RP_HEADER_SIZE))
+#define XPC_RP_MACH_NASIDS(_rp) (XPC_RP_PART_NASIDS(_rp) + \
+                                xpc_nasid_mask_nlongs)
+#define XPC_RP_VARS(_rp)       ((struct xpc_vars_sn2 *) \
+                                (XPC_RP_MACH_NASIDS(_rp) + \
+                                 xpc_nasid_mask_nlongs))
+
+/*
+ * The activate_mq is used to send/receive GRU messages that affect XPC's
+ * heartbeat, partition active state, and channel state. This is UV only.
+ */
+struct xpc_activate_mq_msghdr_uv {
+       short partid;           /* sender's partid */
+       u8 act_state;           /* sender's act_state at time msg sent */
+       u8 type;                /* message's type */
+       unsigned long rp_ts_jiffies; /* timestamp of sender's rp setup by XPC */
+};
+
+/* activate_mq defined message types */
+#define XPC_ACTIVATE_MQ_MSG_SYNC_ACT_STATE_UV          0
+#define XPC_ACTIVATE_MQ_MSG_INC_HEARTBEAT_UV           1
+#define XPC_ACTIVATE_MQ_MSG_OFFLINE_HEARTBEAT_UV       2
+#define XPC_ACTIVATE_MQ_MSG_ONLINE_HEARTBEAT_UV                3
+
+#define XPC_ACTIVATE_MQ_MSG_ACTIVATE_REQ_UV            4
+#define XPC_ACTIVATE_MQ_MSG_DEACTIVATE_REQ_UV          5
+
+#define XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREQUEST_UV      6
+#define XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREPLY_UV                7
+#define XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREQUEST_UV       8
+#define XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREPLY_UV         9
+
+#define XPC_ACTIVATE_MQ_MSG_MARK_ENGAGED_UV            10
+#define XPC_ACTIVATE_MQ_MSG_MARK_DISENGAGED_UV         11
+
+struct xpc_activate_mq_msg_uv {
+       struct xpc_activate_mq_msghdr_uv hdr;
+};
+
+struct xpc_activate_mq_msg_heartbeat_req_uv {
+       struct xpc_activate_mq_msghdr_uv hdr;
+       u64 heartbeat;
+};
+
+struct xpc_activate_mq_msg_activate_req_uv {
+       struct xpc_activate_mq_msghdr_uv hdr;
+       unsigned long rp_gpa;
+       unsigned long activate_mq_gpa;
+};
+
+struct xpc_activate_mq_msg_deactivate_req_uv {
+       struct xpc_activate_mq_msghdr_uv hdr;
+       enum xp_retval reason;
+};
+
+struct xpc_activate_mq_msg_chctl_closerequest_uv {
+       struct xpc_activate_mq_msghdr_uv hdr;
+       short ch_number;
+       enum xp_retval reason;
+};
+
+struct xpc_activate_mq_msg_chctl_closereply_uv {
+       struct xpc_activate_mq_msghdr_uv hdr;
+       short ch_number;
+};
+
+struct xpc_activate_mq_msg_chctl_openrequest_uv {
+       struct xpc_activate_mq_msghdr_uv hdr;
+       short ch_number;
+       short entry_size;       /* size of notify_mq's GRU messages */
+       short local_nentries;   /* ??? Is this needed? What is? */
+};
+
+struct xpc_activate_mq_msg_chctl_openreply_uv {
+       struct xpc_activate_mq_msghdr_uv hdr;
+       short ch_number;
+       short remote_nentries;  /* ??? Is this needed? What is? */
+       short local_nentries;   /* ??? Is this needed? What is? */
+       unsigned long local_notify_mq_gpa;
+};
 
 /*
  * Functions registered by add_timer() or called by kernel_thread() only
@@ -270,22 +261,22 @@ struct xpc_vars_part {
  * the passed argument.
  */
 #define XPC_PACK_ARGS(_arg1, _arg2) \
-                       ((((u64) _arg1) & 0xffffffff) | \
-                       ((((u64) _arg2) & 0xffffffff) << 32))
+                       ((((u64)_arg1) & 0xffffffff) | \
+                       ((((u64)_arg2) & 0xffffffff) << 32))
 
-#define XPC_UNPACK_ARG1(_args) (((u64) _args) & 0xffffffff)
-#define XPC_UNPACK_ARG2(_args) ((((u64) _args) >> 32) & 0xffffffff)
+#define XPC_UNPACK_ARG1(_args) (((u64)_args) & 0xffffffff)
+#define XPC_UNPACK_ARG2(_args) ((((u64)_args) >> 32) & 0xffffffff)
 
 /*
  * Define a Get/Put value pair (pointers) used with a message queue.
  */
-struct xpc_gp {
+struct xpc_gp_sn2 {
        s64 get;                /* Get value */
        s64 put;                /* Put value */
 };
 
 #define XPC_GP_SIZE \
-               L1_CACHE_ALIGN(sizeof(struct xpc_gp) * XPC_NCHANNELS)
+               L1_CACHE_ALIGN(sizeof(struct xpc_gp_sn2) * XPC_MAX_NCHANNELS)
 
 /*
  * Define a structure that contains arguments associated with opening and
@@ -293,31 +284,89 @@ struct xpc_gp {
  */
 struct xpc_openclose_args {
        u16 reason;             /* reason why channel is closing */
-       u16 msg_size;           /* sizeof each message entry */
+       u16 entry_size;         /* sizeof each message entry */
        u16 remote_nentries;    /* #of message entries in remote msg queue */
        u16 local_nentries;     /* #of message entries in local msg queue */
-       u64 local_msgqueue_pa;  /* physical address of local message queue */
+       unsigned long local_msgqueue_pa; /* phys addr of local message queue */
 };
 
 #define XPC_OPENCLOSE_ARGS_SIZE \
-             L1_CACHE_ALIGN(sizeof(struct xpc_openclose_args) * XPC_NCHANNELS)
+             L1_CACHE_ALIGN(sizeof(struct xpc_openclose_args) * \
+             XPC_MAX_NCHANNELS)
 
-/* struct xpc_msg flags */
 
-#define        XPC_M_DONE              0x01    /* msg has been received/consumed */
-#define        XPC_M_READY             0x02    /* msg is ready to be sent */
-#define        XPC_M_INTERRUPT         0x04    /* send interrupt when msg consumed */
+/*
+ * Structures to define a fifo singly-linked list.
+ */
 
-#define XPC_MSG_ADDRESS(_payload) \
-               ((struct xpc_msg *)((u8 *)(_payload) - XPC_MSG_PAYLOAD_OFFSET))
+struct xpc_fifo_entry_uv {
+       struct xpc_fifo_entry_uv *next;
+};
+
+struct xpc_fifo_head_uv {
+       struct xpc_fifo_entry_uv *first;
+       struct xpc_fifo_entry_uv *last;
+       spinlock_t lock;
+       int n_entries;
+};
 
 /*
- * Defines notify entry.
+ * Define a sn2 styled message.
+ *
+ * A user-defined message resides in the payload area. The max size of the
+ * payload is defined by the user via xpc_connect().
+ *
+ * The size of a message entry (within a message queue) must be a 128-byte
+ * cacheline sized multiple in order to facilitate the BTE transfer of messages
+ * from one message queue to another.
+ */
+struct xpc_msg_sn2 {
+       u8 flags;               /* FOR XPC INTERNAL USE ONLY */
+       u8 reserved[7];         /* FOR XPC INTERNAL USE ONLY */
+       s64 number;             /* FOR XPC INTERNAL USE ONLY */
+
+       u64 payload;            /* user defined portion of message */
+};
+
+/* struct xpc_msg_sn2 flags */
+
+#define        XPC_M_SN2_DONE          0x01    /* msg has been received/consumed */
+#define        XPC_M_SN2_READY         0x02    /* msg is ready to be sent */
+#define        XPC_M_SN2_INTERRUPT     0x04    /* send interrupt when msg consumed */
+
+/*
+ * The format of a uv XPC notify_mq GRU message is as follows:
+ *
+ * A user-defined message resides in the payload area. The max size of the
+ * payload is defined by the user via xpc_connect().
+ *
+ * The size of a message (payload and header) sent via the GRU must be either 1
+ * or 2 GRU_CACHE_LINE_BYTES in length.
+ */
+
+struct xpc_notify_mq_msghdr_uv {
+       union {
+               unsigned int gru_msg_hdr;       /* FOR GRU INTERNAL USE ONLY */
+               struct xpc_fifo_entry_uv next;  /* FOR XPC INTERNAL USE ONLY */
+       } u;
+       short partid;           /* FOR XPC INTERNAL USE ONLY */
+       u8 ch_number;           /* FOR XPC INTERNAL USE ONLY */
+       u8 size;                /* FOR XPC INTERNAL USE ONLY */
+       unsigned int msg_slot_number;   /* FOR XPC INTERNAL USE ONLY */
+};
+
+struct xpc_notify_mq_msg_uv {
+       struct xpc_notify_mq_msghdr_uv hdr;
+       unsigned long payload;
+};
+
+/*
+ * Define sn2's notify entry.
  *
  * This is used to notify a message's sender that their message was received
  * and consumed by the intended recipient.
  */
-struct xpc_notify {
+struct xpc_notify_sn2 {
        u8 type;                /* type of notification */
 
        /* the following two fields are only used if type == XPC_N_CALL */
@@ -325,9 +374,20 @@ struct xpc_notify {
        void *key;              /* pointer to user's key */
 };
 
-/* struct xpc_notify type of notification */
+/* struct xpc_notify_sn2 type of notification */
+
+#define        XPC_N_CALL      0x01    /* notify function provided by user */
 
-#define        XPC_N_CALL              0x01    /* notify function provided by user */
+/*
+ * Define uv's version of the notify entry. It additionally is used to allocate
+ * a msg slot on the remote partition into which is copied a sent message.
+ */
+struct xpc_send_msg_slot_uv {
+       struct xpc_fifo_entry_uv next;
+       unsigned int msg_slot_number;
+       xpc_notify_func func;   /* user's notify function */
+       void *key;              /* pointer to user's key */
+};
 
 /*
  * Define the structure that manages all the stuff required by a channel. In
@@ -339,8 +399,12 @@ struct xpc_notify {
  * There is an array of these structures for each remote partition. It is
  * allocated at the time a partition becomes active. The array contains one
  * of these structures for each potential channel connection to that partition.
+ */
+
+/*
+ * The following is sn2 only.
  *
- * Each of these structures manages two message queues (circular buffers).
+ * Each channel structure manages two message queues (circular buffers).
  * They are allocated at the time a channel connection is made. One of
  * these message queues (local_msgqueue) holds the locally created messages
  * that are destined for the remote partition. The other of these message
@@ -407,58 +471,72 @@ struct xpc_notify {
  *     new messages, by the clearing of the message flags of the acknowledged
  *     messages.
  */
+
+struct xpc_channel_sn2 {
+       struct xpc_openclose_args *local_openclose_args; /* args passed on */
+                                            /* opening or closing of channel */
+
+       void *local_msgqueue_base;      /* base address of kmalloc'd space */
+       struct xpc_msg_sn2 *local_msgqueue;     /* local message queue */
+       void *remote_msgqueue_base;     /* base address of kmalloc'd space */
+       struct xpc_msg_sn2 *remote_msgqueue; /* cached copy of remote */
+                                          /* partition's local message queue */
+       unsigned long remote_msgqueue_pa; /* phys addr of remote partition's */
+                                         /* local message queue */
+
+       struct xpc_notify_sn2 *notify_queue;/* notify queue for messages sent */
+
+       /* various flavors of local and remote Get/Put values */
+
+       struct xpc_gp_sn2 *local_GP;    /* local Get/Put values */
+       struct xpc_gp_sn2 remote_GP;    /* remote Get/Put values */
+       struct xpc_gp_sn2 w_local_GP;   /* working local Get/Put values */
+       struct xpc_gp_sn2 w_remote_GP;  /* working remote Get/Put values */
+       s64 next_msg_to_pull;   /* Put value of next msg to pull */
+
+       struct mutex msg_to_pull_mutex; /* next msg to pull serialization */
+};
+
+struct xpc_channel_uv {
+       unsigned long remote_notify_mq_gpa;     /* gru phys address of remote */
+                                               /* partition's notify mq */
+
+       struct xpc_send_msg_slot_uv *send_msg_slots;
+       struct xpc_notify_mq_msg_uv *recv_msg_slots;
+
+       struct xpc_fifo_head_uv msg_slot_free_list;
+       struct xpc_fifo_head_uv recv_msg_list;  /* deliverable payloads */
+};
+
 struct xpc_channel {
        short partid;           /* ID of remote partition connected */
        spinlock_t lock;        /* lock for updating this structure */
-       u32 flags;              /* general flags */
+       unsigned int flags;     /* general flags */
 
        enum xp_retval reason;  /* reason why channel is disconnect'g */
        int reason_line;        /* line# disconnect initiated from */
 
        u16 number;             /* channel # */
 
-       u16 msg_size;           /* sizeof each msg entry */
+       u16 entry_size;         /* sizeof each msg entry */
        u16 local_nentries;     /* #of msg entries in local msg queue */
        u16 remote_nentries;    /* #of msg entries in remote msg queue */
 
-       void *local_msgqueue_base;      /* base address of kmalloc'd space */
-       struct xpc_msg *local_msgqueue; /* local message queue */
-       void *remote_msgqueue_base;     /* base address of kmalloc'd space */
-       struct xpc_msg *remote_msgqueue; /* cached copy of remote partition's */
-                                        /* local message queue */
-       u64 remote_msgqueue_pa; /* phys addr of remote partition's */
-                               /* local message queue */
-
        atomic_t references;    /* #of external references to queues */
 
        atomic_t n_on_msg_allocate_wq;  /* #on msg allocation wait queue */
        wait_queue_head_t msg_allocate_wq;      /* msg allocation wait queue */
 
-       u8 delayed_IPI_flags;   /* IPI flags received, but delayed */
+       u8 delayed_chctl_flags; /* chctl flags received, but delayed */
                                /* action until channel disconnected */
 
-       /* queue of msg senders who want to be notified when msg received */
-
        atomic_t n_to_notify;   /* #of msg senders to notify */
-       struct xpc_notify *notify_queue;    /* notify queue for messages sent */
 
        xpc_channel_func func;  /* user's channel function */
        void *key;              /* pointer to user's key */
 
-       struct mutex msg_to_pull_mutex; /* next msg to pull serialization */
        struct completion wdisconnect_wait;    /* wait for channel disconnect */
 
-       struct xpc_openclose_args *local_openclose_args; /* args passed on */
-                                            /* opening or closing of channel */
-
-       /* various flavors of local and remote Get/Put values */
-
-       struct xpc_gp *local_GP;        /* local Get/Put values */
-       struct xpc_gp remote_GP;        /* remote Get/Put values */
-       struct xpc_gp w_local_GP;       /* working local Get/Put values */
-       struct xpc_gp w_remote_GP;      /* working remote Get/Put values */
-       s64 next_msg_to_pull;   /* Put value of next msg to pull */
-
        /* kthread management related fields */
 
        atomic_t kthreads_assigned;     /* #of kthreads assigned to channel */
@@ -469,6 +547,11 @@ struct xpc_channel {
 
        wait_queue_head_t idle_wq;      /* idle kthread wait queue */
 
+       union {
+               struct xpc_channel_sn2 sn2;
+               struct xpc_channel_uv uv;
+       } sn;
+
 } ____cacheline_aligned;
 
 /* struct xpc_channel flags */
@@ -501,33 +584,128 @@ struct xpc_channel {
 #define        XPC_C_WDISCONNECT       0x00040000  /* waiting for channel disconnect */
 
 /*
- * Manages channels on a partition basis. There is one of these structures
+ * The channel control flags (chctl) union consists of a 64-bit variable which
+ * is divided up into eight bytes, ordered from right to left. Byte zero
+ * pertains to channel 0, byte one to channel 1, and so on. Each channel's byte
+ * can have one or more of the chctl flags set in it.
+ */
+
+union xpc_channel_ctl_flags {
+       u64 all_flags;
+       u8 flags[XPC_MAX_NCHANNELS];
+};
+
+/* chctl flags */
+#define        XPC_CHCTL_CLOSEREQUEST  0x01
+#define        XPC_CHCTL_CLOSEREPLY    0x02
+#define        XPC_CHCTL_OPENREQUEST   0x04
+#define        XPC_CHCTL_OPENREPLY     0x08
+#define        XPC_CHCTL_MSGREQUEST    0x10
+
+#define XPC_OPENCLOSE_CHCTL_FLAGS \
+                       (XPC_CHCTL_CLOSEREQUEST | XPC_CHCTL_CLOSEREPLY | \
+                        XPC_CHCTL_OPENREQUEST | XPC_CHCTL_OPENREPLY)
+#define XPC_MSG_CHCTL_FLAGS    XPC_CHCTL_MSGREQUEST
+
+static inline int
+xpc_any_openclose_chctl_flags_set(union xpc_channel_ctl_flags *chctl)
+{
+       int ch_number;
+
+       for (ch_number = 0; ch_number < XPC_MAX_NCHANNELS; ch_number++) {
+               if (chctl->flags[ch_number] & XPC_OPENCLOSE_CHCTL_FLAGS)
+                       return 1;
+       }
+       return 0;
+}
+
+static inline int
+xpc_any_msg_chctl_flags_set(union xpc_channel_ctl_flags *chctl)
+{
+       int ch_number;
+
+       for (ch_number = 0; ch_number < XPC_MAX_NCHANNELS; ch_number++) {
+               if (chctl->flags[ch_number] & XPC_MSG_CHCTL_FLAGS)
+                       return 1;
+       }
+       return 0;
+}
+
+/*
+ * Manage channels on a partition basis. There is one of these structures
  * for each partition (a partition will never utilize the structure that
  * represents itself).
  */
+
+struct xpc_partition_sn2 {
+       unsigned long remote_amos_page_pa; /* paddr of partition's amos page */
+       int activate_IRQ_nasid; /* active partition's act/deact nasid */
+       int activate_IRQ_phys_cpuid;    /* active part's act/deact phys cpuid */
+
+       unsigned long remote_vars_pa;   /* phys addr of partition's vars */
+       unsigned long remote_vars_part_pa; /* paddr of partition's vars part */
+       u8 remote_vars_version; /* version# of partition's vars */
+
+       void *local_GPs_base;   /* base address of kmalloc'd space */
+       struct xpc_gp_sn2 *local_GPs;   /* local Get/Put values */
+       void *remote_GPs_base;  /* base address of kmalloc'd space */
+       struct xpc_gp_sn2 *remote_GPs;  /* copy of remote partition's local */
+                                       /* Get/Put values */
+       unsigned long remote_GPs_pa; /* phys addr of remote partition's local */
+                                    /* Get/Put values */
+
+       void *local_openclose_args_base;   /* base address of kmalloc'd space */
+       struct xpc_openclose_args *local_openclose_args;      /* local's args */
+       unsigned long remote_openclose_args_pa; /* phys addr of remote's args */
+
+       int notify_IRQ_nasid;   /* nasid of where to send notify IRQs */
+       int notify_IRQ_phys_cpuid;      /* CPUID of where to send notify IRQs */
+       char notify_IRQ_owner[8];       /* notify IRQ's owner's name */
+
+       struct amo *remote_chctl_amo_va; /* addr of remote chctl flags' amo */
+       struct amo *local_chctl_amo_va; /* address of chctl flags' amo */
+
+       struct timer_list dropped_notify_IRQ_timer;     /* dropped IRQ timer */
+};
+
+struct xpc_partition_uv {
+       unsigned long remote_activate_mq_gpa;   /* gru phys address of remote */
+                                               /* partition's activate mq */
+       spinlock_t flags_lock;  /* protect updating of flags */
+       unsigned int flags;     /* general flags */
+       u8 remote_act_state;    /* remote partition's act_state */
+       u8 act_state_req;       /* act_state request from remote partition */
+       enum xp_retval reason;  /* reason for deactivate act_state request */
+       u64 heartbeat;          /* incremented by remote partition */
+};
+
+/* struct xpc_partition_uv flags */
+
+#define XPC_P_HEARTBEAT_OFFLINE_UV     0x00000001
+#define XPC_P_ENGAGED_UV               0x00000002
+
+/* struct xpc_partition_uv act_state change requests */
+
+#define XPC_P_ASR_ACTIVATE_UV          0x01
+#define XPC_P_ASR_REACTIVATE_UV                0x02
+#define XPC_P_ASR_DEACTIVATE_UV                0x03
+
 struct xpc_partition {
 
        /* XPC HB infrastructure */
 
        u8 remote_rp_version;   /* version# of partition's rsvd pg */
-       struct timespec remote_rp_stamp; /* time when rsvd pg was initialized */
-       u64 remote_rp_pa;       /* phys addr of partition's rsvd pg */
-       u64 remote_vars_pa;     /* phys addr of partition's vars */
-       u64 remote_vars_part_pa;        /* phys addr of partition's vars part */
+       unsigned long remote_rp_ts_jiffies; /* timestamp when rsvd pg setup */
+       unsigned long remote_rp_pa;     /* phys addr of partition's rsvd pg */
        u64 last_heartbeat;     /* HB at last read */
-       u64 remote_amos_page_pa;        /* phys addr of partition's amos page */
-       int remote_act_nasid;   /* active part's act/deact nasid */
-       int remote_act_phys_cpuid;      /* active part's act/deact phys cpuid */
-       u32 act_IRQ_rcvd;       /* IRQs since activation */
+       u32 activate_IRQ_rcvd;  /* IRQs since activation */
        spinlock_t act_lock;    /* protect updating of act_state */
        u8 act_state;           /* from XPC HB viewpoint */
-       u8 remote_vars_version; /* version# of partition's vars */
        enum xp_retval reason;  /* reason partition is deactivating */
        int reason_line;        /* line# deactivation initiated from */
-       int reactivate_nasid;   /* nasid in partition to reactivate */
 
-       unsigned long disengage_request_timeout;        /* timeout in jiffies */
-       struct timer_list disengage_request_timer;
+       unsigned long disengage_timeout;        /* timeout in jiffies */
+       struct timer_list disengage_timer;
 
        /* XPC infrastructure referencing and teardown control */
 
@@ -535,85 +713,63 @@ struct xpc_partition {
        wait_queue_head_t teardown_wq;  /* kthread waiting to teardown infra */
        atomic_t references;    /* #of references to infrastructure */
 
-       /*
-        * NONE OF THE PRECEDING FIELDS OF THIS STRUCTURE WILL BE CLEARED WHEN
-        * XPC SETS UP THE NECESSARY INFRASTRUCTURE TO SUPPORT CROSS PARTITION
-        * COMMUNICATION. ALL OF THE FOLLOWING FIELDS WILL BE CLEARED. (THE
-        * 'nchannels' FIELD MUST BE THE FIRST OF THE FIELDS TO BE CLEARED.)
-        */
-
        u8 nchannels;           /* #of defined channels supported */
        atomic_t nchannels_active;  /* #of channels that are not DISCONNECTED */
        atomic_t nchannels_engaged;  /* #of channels engaged with remote part */
        struct xpc_channel *channels;   /* array of channel structures */
 
-       void *local_GPs_base;   /* base address of kmalloc'd space */
-       struct xpc_gp *local_GPs;       /* local Get/Put values */
-       void *remote_GPs_base;  /* base address of kmalloc'd space */
-       struct xpc_gp *remote_GPs;      /* copy of remote partition's local */
-                                       /* Get/Put values */
-       u64 remote_GPs_pa;      /* phys address of remote partition's local */
-                               /* Get/Put values */
+       /* fields used for managing channel avialability and activity */
 
-       /* fields used to pass args when opening or closing a channel */
+       union xpc_channel_ctl_flags chctl; /* chctl flags yet to be processed */
+       spinlock_t chctl_lock;  /* chctl flags lock */
 
-       void *local_openclose_args_base;   /* base address of kmalloc'd space */
-       struct xpc_openclose_args *local_openclose_args;      /* local's args */
        void *remote_openclose_args_base;  /* base address of kmalloc'd space */
        struct xpc_openclose_args *remote_openclose_args; /* copy of remote's */
                                                          /* args */
-       u64 remote_openclose_args_pa;   /* phys addr of remote's args */
-
-       /* IPI sending, receiving and handling related fields */
-
-       int remote_IPI_nasid;   /* nasid of where to send IPIs */
-       int remote_IPI_phys_cpuid;      /* phys CPU ID of where to send IPIs */
-       AMO_t *remote_IPI_amo_va;    /* address of remote IPI AMO_t structure */
-
-       AMO_t *local_IPI_amo_va;        /* address of IPI AMO_t structure */
-       u64 local_IPI_amo;      /* IPI amo flags yet to be handled */
-       char IPI_owner[8];      /* IPI owner's name */
-       struct timer_list dropped_IPI_timer;    /* dropped IPI timer */
-
-       spinlock_t IPI_lock;    /* IPI handler lock */
 
        /* channel manager related fields */
 
        atomic_t channel_mgr_requests;  /* #of requests to activate chan mgr */
        wait_queue_head_t channel_mgr_wq;       /* channel mgr's wait queue */
 
+       union {
+               struct xpc_partition_sn2 sn2;
+               struct xpc_partition_uv uv;
+       } sn;
+
 } ____cacheline_aligned;
 
 /* struct xpc_partition act_state values (for XPC HB) */
 
-#define        XPC_P_INACTIVE          0x00    /* partition is not active */
-#define XPC_P_ACTIVATION_REQ   0x01    /* created thread to activate */
-#define XPC_P_ACTIVATING       0x02    /* activation thread started */
-#define XPC_P_ACTIVE           0x03    /* xpc_partition_up() was called */
-#define XPC_P_DEACTIVATING     0x04    /* partition deactivation initiated */
+#define        XPC_P_AS_INACTIVE       0x00    /* partition is not active */
+#define XPC_P_AS_ACTIVATION_REQ        0x01    /* created thread to activate */
+#define XPC_P_AS_ACTIVATING    0x02    /* activation thread started */
+#define XPC_P_AS_ACTIVE                0x03    /* xpc_partition_up() was called */
+#define XPC_P_AS_DEACTIVATING  0x04    /* partition deactivation initiated */
 
 #define XPC_DEACTIVATE_PARTITION(_p, _reason) \
                        xpc_deactivate_partition(__LINE__, (_p), (_reason))
 
 /* struct xpc_partition setup_state values */
 
-#define XPC_P_UNSET            0x00    /* infrastructure was never setup */
-#define XPC_P_SETUP            0x01    /* infrastructure is setup */
-#define XPC_P_WTEARDOWN                0x02    /* waiting to teardown infrastructure */
-#define XPC_P_TORNDOWN         0x03    /* infrastructure is torndown */
+#define XPC_P_SS_UNSET         0x00    /* infrastructure was never setup */
+#define XPC_P_SS_SETUP         0x01    /* infrastructure is setup */
+#define XPC_P_SS_WTEARDOWN     0x02    /* waiting to teardown infrastructure */
+#define XPC_P_SS_TORNDOWN      0x03    /* infrastructure is torndown */
 
 /*
- * struct xpc_partition IPI_timer #of seconds to wait before checking for
- * dropped IPIs. These occur whenever an IPI amo write doesn't complete until
- * after the IPI was received.
+ * struct xpc_partition_sn2's dropped notify IRQ timer is set to wait the
+ * following interval #of seconds before checking for dropped notify IRQs.
+ * These can occur whenever an IRQ's associated amo write doesn't complete
+ * until after the IRQ was received.
  */
-#define XPC_P_DROPPED_IPI_WAIT (0.25 * HZ)
+#define XPC_DROPPED_NOTIFY_IRQ_WAIT_INTERVAL   (0.25 * HZ)
 
 /* number of seconds to wait for other partitions to disengage */
-#define XPC_DISENGAGE_REQUEST_DEFAULT_TIMELIMIT        90
+#define XPC_DISENGAGE_DEFAULT_TIMELIMIT                90
 
-/* interval in seconds to print 'waiting disengagement' messages */
-#define XPC_DISENGAGE_PRINTMSG_INTERVAL                10
+/* interval in seconds to print 'waiting deactivation' messages */
+#define XPC_DEACTIVATE_PRINTMSG_INTERVAL       10
 
 #define XPC_PARTID(_p) ((short)((_p) - &xpc_partitions[0]))
 
@@ -623,33 +779,92 @@ extern struct xpc_registration xpc_registrations[];
 /* found in xpc_main.c */
 extern struct device *xpc_part;
 extern struct device *xpc_chan;
-extern int xpc_disengage_request_timelimit;
-extern int xpc_disengage_request_timedout;
-extern irqreturn_t xpc_notify_IRQ_handler(int, void *);
-extern void xpc_dropped_IPI_check(struct xpc_partition *);
+extern int xpc_disengage_timelimit;
+extern int xpc_disengage_timedout;
+extern int xpc_activate_IRQ_rcvd;
+extern spinlock_t xpc_activate_IRQ_rcvd_lock;
+extern wait_queue_head_t xpc_activate_IRQ_wq;
+extern void *xpc_heartbeating_to_mask;
+extern void *xpc_kzalloc_cacheline_aligned(size_t, gfp_t, void **);
 extern void xpc_activate_partition(struct xpc_partition *);
 extern void xpc_activate_kthreads(struct xpc_channel *, int);
 extern void xpc_create_kthreads(struct xpc_channel *, int, int);
 extern void xpc_disconnect_wait(int);
+extern int (*xpc_setup_partitions_sn) (void);
+extern enum xp_retval (*xpc_get_partition_rsvd_page_pa) (void *, u64 *,
+                                                        unsigned long *,
+                                                        size_t *);
+extern int (*xpc_setup_rsvd_page_sn) (struct xpc_rsvd_page *);
+extern void (*xpc_heartbeat_init) (void);
+extern void (*xpc_heartbeat_exit) (void);
+extern void (*xpc_increment_heartbeat) (void);
+extern void (*xpc_offline_heartbeat) (void);
+extern void (*xpc_online_heartbeat) (void);
+extern enum xp_retval (*xpc_get_remote_heartbeat) (struct xpc_partition *);
+extern enum xp_retval (*xpc_make_first_contact) (struct xpc_partition *);
+extern u64 (*xpc_get_chctl_all_flags) (struct xpc_partition *);
+extern enum xp_retval (*xpc_setup_msg_structures) (struct xpc_channel *);
+extern void (*xpc_teardown_msg_structures) (struct xpc_channel *);
+extern void (*xpc_notify_senders_of_disconnect) (struct xpc_channel *);
+extern void (*xpc_process_msg_chctl_flags) (struct xpc_partition *, int);
+extern int (*xpc_n_of_deliverable_payloads) (struct xpc_channel *);
+extern void *(*xpc_get_deliverable_payload) (struct xpc_channel *);
+extern void (*xpc_request_partition_activation) (struct xpc_rsvd_page *,
+                                                unsigned long, int);
+extern void (*xpc_request_partition_reactivation) (struct xpc_partition *);
+extern void (*xpc_request_partition_deactivation) (struct xpc_partition *);
+extern void (*xpc_cancel_partition_deactivation_request) (
+                                                       struct xpc_partition *);
+extern void (*xpc_process_activate_IRQ_rcvd) (void);
+extern enum xp_retval (*xpc_setup_ch_structures_sn) (struct xpc_partition *);
+extern void (*xpc_teardown_ch_structures_sn) (struct xpc_partition *);
+
+extern void (*xpc_indicate_partition_engaged) (struct xpc_partition *);
+extern int (*xpc_partition_engaged) (short);
+extern int (*xpc_any_partition_engaged) (void);
+extern void (*xpc_indicate_partition_disengaged) (struct xpc_partition *);
+extern void (*xpc_assume_partition_disengaged) (short);
+
+extern void (*xpc_send_chctl_closerequest) (struct xpc_channel *,
+                                           unsigned long *);
+extern void (*xpc_send_chctl_closereply) (struct xpc_channel *,
+                                         unsigned long *);
+extern void (*xpc_send_chctl_openrequest) (struct xpc_channel *,
+                                          unsigned long *);
+extern void (*xpc_send_chctl_openreply) (struct xpc_channel *, unsigned long *);
+
+extern void (*xpc_save_remote_msgqueue_pa) (struct xpc_channel *,
+                                           unsigned long);
+
+extern enum xp_retval (*xpc_send_payload) (struct xpc_channel *, u32, void *,
+                                          u16, u8, xpc_notify_func, void *);
+extern void (*xpc_received_payload) (struct xpc_channel *, void *);
+
+/* found in xpc_sn2.c */
+extern int xpc_init_sn2(void);
+extern void xpc_exit_sn2(void);
+
+/* found in xpc_uv.c */
+extern int xpc_init_uv(void);
+extern void xpc_exit_uv(void);
 
 /* found in xpc_partition.c */
 extern int xpc_exiting;
-extern struct xpc_vars *xpc_vars;
+extern int xpc_nasid_mask_nlongs;
 extern struct xpc_rsvd_page *xpc_rsvd_page;
-extern struct xpc_vars_part *xpc_vars_part;
-extern struct xpc_partition xpc_partitions[XP_MAX_PARTITIONS + 1];
-extern char *xpc_remote_copy_buffer;
-extern void *xpc_remote_copy_buffer_base;
+extern unsigned long *xpc_mach_nasids;
+extern struct xpc_partition *xpc_partitions;
 extern void *xpc_kmalloc_cacheline_aligned(size_t, gfp_t, void **);
-extern struct xpc_rsvd_page *xpc_rsvd_page_init(void);
-extern void xpc_allow_IPI_ops(void);
-extern void xpc_restrict_IPI_ops(void);
-extern int xpc_identify_act_IRQ_sender(void);
+extern int xpc_setup_rsvd_page(void);
+extern void xpc_teardown_rsvd_page(void);
+extern int xpc_identify_activate_IRQ_sender(void);
 extern int xpc_partition_disengaged(struct xpc_partition *);
 extern enum xp_retval xpc_mark_partition_active(struct xpc_partition *);
 extern void xpc_mark_partition_inactive(struct xpc_partition *);
 extern void xpc_discovery(void);
-extern void xpc_check_remote_hb(void);
+extern enum xp_retval xpc_get_remote_rp(int, unsigned long *,
+                                       struct xpc_rsvd_page *,
+                                       unsigned long *);
 extern void xpc_deactivate_partition(const int, struct xpc_partition *,
                                     enum xp_retval);
 extern enum xp_retval xpc_initiate_partid_to_nasids(short, void *);
@@ -657,21 +872,52 @@ extern enum xp_retval xpc_initiate_partid_to_nasids(short, void *);
 /* found in xpc_channel.c */
 extern void xpc_initiate_connect(int);
 extern void xpc_initiate_disconnect(int);
-extern enum xp_retval xpc_initiate_allocate(short, int, u32, void **);
-extern enum xp_retval xpc_initiate_send(short, int, void *);
-extern enum xp_retval xpc_initiate_send_notify(short, int, void *,
+extern enum xp_retval xpc_allocate_msg_wait(struct xpc_channel *);
+extern enum xp_retval xpc_initiate_send(short, int, u32, void *, u16);
+extern enum xp_retval xpc_initiate_send_notify(short, int, u32, void *, u16,
                                               xpc_notify_func, void *);
 extern void xpc_initiate_received(short, int, void *);
-extern enum xp_retval xpc_setup_infrastructure(struct xpc_partition *);
-extern enum xp_retval xpc_pull_remote_vars_part(struct xpc_partition *);
-extern void xpc_process_channel_activity(struct xpc_partition *);
+extern void xpc_process_sent_chctl_flags(struct xpc_partition *);
 extern void xpc_connected_callout(struct xpc_channel *);
-extern void xpc_deliver_msg(struct xpc_channel *);
+extern void xpc_deliver_payload(struct xpc_channel *);
 extern void xpc_disconnect_channel(const int, struct xpc_channel *,
                                   enum xp_retval, unsigned long *);
 extern void xpc_disconnect_callout(struct xpc_channel *, enum xp_retval);
 extern void xpc_partition_going_down(struct xpc_partition *, enum xp_retval);
-extern void xpc_teardown_infrastructure(struct xpc_partition *);
+
+static inline int
+xpc_hb_allowed(short partid, void *heartbeating_to_mask)
+{
+       return test_bit(partid, heartbeating_to_mask);
+}
+
+static inline int
+xpc_any_hbs_allowed(void)
+{
+       DBUG_ON(xpc_heartbeating_to_mask == NULL);
+       return !bitmap_empty(xpc_heartbeating_to_mask, xp_max_npartitions);
+}
+
+static inline void
+xpc_allow_hb(short partid)
+{
+       DBUG_ON(xpc_heartbeating_to_mask == NULL);
+       set_bit(partid, xpc_heartbeating_to_mask);
+}
+
+static inline void
+xpc_disallow_hb(short partid)
+{
+       DBUG_ON(xpc_heartbeating_to_mask == NULL);
+       clear_bit(partid, xpc_heartbeating_to_mask);
+}
+
+static inline void
+xpc_disallow_all_hbs(void)
+{
+       DBUG_ON(xpc_heartbeating_to_mask == NULL);
+       bitmap_zero(xpc_heartbeating_to_mask, xp_max_npartitions);
+}
 
 static inline void
 xpc_wakeup_channel_mgr(struct xpc_partition *part)
@@ -713,7 +959,7 @@ xpc_part_deref(struct xpc_partition *part)
        s32 refs = atomic_dec_return(&part->references);
 
        DBUG_ON(refs < 0);
-       if (refs == 0 && part->setup_state == XPC_P_WTEARDOWN)
+       if (refs == 0 && part->setup_state == XPC_P_SS_WTEARDOWN)
                wake_up(&part->teardown_wq);
 }
 
@@ -723,7 +969,7 @@ xpc_part_ref(struct xpc_partition *part)
        int setup;
 
        atomic_inc(&part->references);
-       setup = (part->setup_state == XPC_P_SETUP);
+       setup = (part->setup_state == XPC_P_SS_SETUP);
        if (!setup)
                xpc_part_deref(part);
 
@@ -741,416 +987,4 @@ xpc_part_ref(struct xpc_partition *part)
                (_p)->reason_line = _line; \
        }
 
-/*
- * This next set of inlines are used to keep track of when a partition is
- * potentially engaged in accessing memory belonging to another partition.
- */
-
-static inline void
-xpc_mark_partition_engaged(struct xpc_partition *part)
-{
-       unsigned long irq_flags;
-       AMO_t *amo = (AMO_t *)__va(part->remote_amos_page_pa +
-                                  (XPC_ENGAGED_PARTITIONS_AMO *
-                                   sizeof(AMO_t)));
-
-       local_irq_save(irq_flags);
-
-       /* set bit corresponding to our partid in remote partition's AMO */
-       FETCHOP_STORE_OP(TO_AMO((u64)&amo->variable), FETCHOP_OR,
-                        (1UL << sn_partition_id));
-       /*
-        * We must always use the nofault function regardless of whether we
-        * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
-        * didn't, we'd never know that the other partition is down and would
-        * keep sending IPIs and AMOs to it until the heartbeat times out.
-        */
-       (void)xp_nofault_PIOR((u64 *)GLOBAL_MMR_ADDR(NASID_GET(&amo->
-                                                              variable),
-                                                    xp_nofault_PIOR_target));
-
-       local_irq_restore(irq_flags);
-}
-
-static inline void
-xpc_mark_partition_disengaged(struct xpc_partition *part)
-{
-       unsigned long irq_flags;
-       AMO_t *amo = (AMO_t *)__va(part->remote_amos_page_pa +
-                                  (XPC_ENGAGED_PARTITIONS_AMO *
-                                   sizeof(AMO_t)));
-
-       local_irq_save(irq_flags);
-
-       /* clear bit corresponding to our partid in remote partition's AMO */
-       FETCHOP_STORE_OP(TO_AMO((u64)&amo->variable), FETCHOP_AND,
-                        ~(1UL << sn_partition_id));
-       /*
-        * We must always use the nofault function regardless of whether we
-        * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
-        * didn't, we'd never know that the other partition is down and would
-        * keep sending IPIs and AMOs to it until the heartbeat times out.
-        */
-       (void)xp_nofault_PIOR((u64 *)GLOBAL_MMR_ADDR(NASID_GET(&amo->
-                                                              variable),
-                                                    xp_nofault_PIOR_target));
-
-       local_irq_restore(irq_flags);
-}
-
-static inline void
-xpc_request_partition_disengage(struct xpc_partition *part)
-{
-       unsigned long irq_flags;
-       AMO_t *amo = (AMO_t *)__va(part->remote_amos_page_pa +
-                                  (XPC_DISENGAGE_REQUEST_AMO * sizeof(AMO_t)));
-
-       local_irq_save(irq_flags);
-
-       /* set bit corresponding to our partid in remote partition's AMO */
-       FETCHOP_STORE_OP(TO_AMO((u64)&amo->variable), FETCHOP_OR,
-                        (1UL << sn_partition_id));
-       /*
-        * We must always use the nofault function regardless of whether we
-        * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
-        * didn't, we'd never know that the other partition is down and would
-        * keep sending IPIs and AMOs to it until the heartbeat times out.
-        */
-       (void)xp_nofault_PIOR((u64 *)GLOBAL_MMR_ADDR(NASID_GET(&amo->
-                                                              variable),
-                                                    xp_nofault_PIOR_target));
-
-       local_irq_restore(irq_flags);
-}
-
-static inline void
-xpc_cancel_partition_disengage_request(struct xpc_partition *part)
-{
-       unsigned long irq_flags;
-       AMO_t *amo = (AMO_t *)__va(part->remote_amos_page_pa +
-                                  (XPC_DISENGAGE_REQUEST_AMO * sizeof(AMO_t)));
-
-       local_irq_save(irq_flags);
-
-       /* clear bit corresponding to our partid in remote partition's AMO */
-       FETCHOP_STORE_OP(TO_AMO((u64)&amo->variable), FETCHOP_AND,
-                        ~(1UL << sn_partition_id));
-       /*
-        * We must always use the nofault function regardless of whether we
-        * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
-        * didn't, we'd never know that the other partition is down and would
-        * keep sending IPIs and AMOs to it until the heartbeat times out.
-        */
-       (void)xp_nofault_PIOR((u64 *)GLOBAL_MMR_ADDR(NASID_GET(&amo->
-                                                              variable),
-                                                    xp_nofault_PIOR_target));
-
-       local_irq_restore(irq_flags);
-}
-
-static inline u64
-xpc_partition_engaged(u64 partid_mask)
-{
-       AMO_t *amo = xpc_vars->amos_page + XPC_ENGAGED_PARTITIONS_AMO;
-
-       /* return our partition's AMO variable ANDed with partid_mask */
-       return (FETCHOP_LOAD_OP(TO_AMO((u64)&amo->variable), FETCHOP_LOAD) &
-               partid_mask);
-}
-
-static inline u64
-xpc_partition_disengage_requested(u64 partid_mask)
-{
-       AMO_t *amo = xpc_vars->amos_page + XPC_DISENGAGE_REQUEST_AMO;
-
-       /* return our partition's AMO variable ANDed with partid_mask */
-       return (FETCHOP_LOAD_OP(TO_AMO((u64)&amo->variable), FETCHOP_LOAD) &
-               partid_mask);
-}
-
-static inline void
-xpc_clear_partition_engaged(u64 partid_mask)
-{
-       AMO_t *amo = xpc_vars->amos_page + XPC_ENGAGED_PARTITIONS_AMO;
-
-       /* clear bit(s) based on partid_mask in our partition's AMO */
-       FETCHOP_STORE_OP(TO_AMO((u64)&amo->variable), FETCHOP_AND,
-                        ~partid_mask);
-}
-
-static inline void
-xpc_clear_partition_disengage_request(u64 partid_mask)
-{
-       AMO_t *amo = xpc_vars->amos_page + XPC_DISENGAGE_REQUEST_AMO;
-
-       /* clear bit(s) based on partid_mask in our partition's AMO */
-       FETCHOP_STORE_OP(TO_AMO((u64)&amo->variable), FETCHOP_AND,
-                        ~partid_mask);
-}
-
-/*
- * The following set of macros and inlines are used for the sending and
- * receiving of IPIs (also known as IRQs). There are two flavors of IPIs,
- * one that is associated with partition activity (SGI_XPC_ACTIVATE) and
- * the other that is associated with channel activity (SGI_XPC_NOTIFY).
- */
-
-static inline u64
-xpc_IPI_receive(AMO_t *amo)
-{
-       return FETCHOP_LOAD_OP(TO_AMO((u64)&amo->variable), FETCHOP_CLEAR);
-}
-
-static inline enum xp_retval
-xpc_IPI_send(AMO_t *amo, u64 flag, int nasid, int phys_cpuid, int vector)
-{
-       int ret = 0;
-       unsigned long irq_flags;
-
-       local_irq_save(irq_flags);
-
-       FETCHOP_STORE_OP(TO_AMO((u64)&amo->variable), FETCHOP_OR, flag);
-       sn_send_IPI_phys(nasid, phys_cpuid, vector, 0);
-
-       /*
-        * We must always use the nofault function regardless of whether we
-        * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
-        * didn't, we'd never know that the other partition is down and would
-        * keep sending IPIs and AMOs to it until the heartbeat times out.
-        */
-       ret = xp_nofault_PIOR((u64 *)GLOBAL_MMR_ADDR(NASID_GET(&amo->variable),
-                                                    xp_nofault_PIOR_target));
-
-       local_irq_restore(irq_flags);
-
-       return ((ret == 0) ? xpSuccess : xpPioReadError);
-}
-
-/*
- * IPIs associated with SGI_XPC_ACTIVATE IRQ.
- */
-
-/*
- * Flag the appropriate AMO variable and send an IPI to the specified node.
- */
-static inline void
-xpc_activate_IRQ_send(u64 amos_page_pa, int from_nasid, int to_nasid,
-                     int to_phys_cpuid)
-{
-       int w_index = XPC_NASID_W_INDEX(from_nasid);
-       int b_index = XPC_NASID_B_INDEX(from_nasid);
-       AMO_t *amos = (AMO_t *)__va(amos_page_pa +
-                                   (XPC_ACTIVATE_IRQ_AMOS * sizeof(AMO_t)));
-
-       (void)xpc_IPI_send(&amos[w_index], (1UL << b_index), to_nasid,
-                          to_phys_cpuid, SGI_XPC_ACTIVATE);
-}
-
-static inline void
-xpc_IPI_send_activate(struct xpc_vars *vars)
-{
-       xpc_activate_IRQ_send(vars->amos_page_pa, cnodeid_to_nasid(0),
-                             vars->act_nasid, vars->act_phys_cpuid);
-}
-
-static inline void
-xpc_IPI_send_activated(struct xpc_partition *part)
-{
-       xpc_activate_IRQ_send(part->remote_amos_page_pa, cnodeid_to_nasid(0),
-                             part->remote_act_nasid,
-                             part->remote_act_phys_cpuid);
-}
-
-static inline void
-xpc_IPI_send_reactivate(struct xpc_partition *part)
-{
-       xpc_activate_IRQ_send(xpc_vars->amos_page_pa, part->reactivate_nasid,
-                             xpc_vars->act_nasid, xpc_vars->act_phys_cpuid);
-}
-
-static inline void
-xpc_IPI_send_disengage(struct xpc_partition *part)
-{
-       xpc_activate_IRQ_send(part->remote_amos_page_pa, cnodeid_to_nasid(0),
-                             part->remote_act_nasid,
-                             part->remote_act_phys_cpuid);
-}
-
-/*
- * IPIs associated with SGI_XPC_NOTIFY IRQ.
- */
-
-/*
- * Send an IPI to the remote partition that is associated with the
- * specified channel.
- */
-#define XPC_NOTIFY_IRQ_SEND(_ch, _ipi_f, _irq_f) \
-               xpc_notify_IRQ_send(_ch, _ipi_f, #_ipi_f, _irq_f)
-
-static inline void
-xpc_notify_IRQ_send(struct xpc_channel *ch, u8 ipi_flag, char *ipi_flag_string,
-                   unsigned long *irq_flags)
-{
-       struct xpc_partition *part = &xpc_partitions[ch->partid];
-       enum xp_retval ret;
-
-       if (likely(part->act_state != XPC_P_DEACTIVATING)) {
-               ret = xpc_IPI_send(part->remote_IPI_amo_va,
-                                  (u64)ipi_flag << (ch->number * 8),
-                                  part->remote_IPI_nasid,
-                                  part->remote_IPI_phys_cpuid, SGI_XPC_NOTIFY);
-               dev_dbg(xpc_chan, "%s sent to partid=%d, channel=%d, ret=%d\n",
-                       ipi_flag_string, ch->partid, ch->number, ret);
-               if (unlikely(ret != xpSuccess)) {
-                       if (irq_flags != NULL)
-                               spin_unlock_irqrestore(&ch->lock, *irq_flags);
-                       XPC_DEACTIVATE_PARTITION(part, ret);
-                       if (irq_flags != NULL)
-                               spin_lock_irqsave(&ch->lock, *irq_flags);
-               }
-       }
-}
-
-/*
- * Make it look like the remote partition, which is associated with the
- * specified channel, sent us an IPI. This faked IPI will be handled
- * by xpc_dropped_IPI_check().
- */
-#define XPC_NOTIFY_IRQ_SEND_LOCAL(_ch, _ipi_f) \
-               xpc_notify_IRQ_send_local(_ch, _ipi_f, #_ipi_f)
-
-static inline void
-xpc_notify_IRQ_send_local(struct xpc_channel *ch, u8 ipi_flag,
-                         char *ipi_flag_string)
-{
-       struct xpc_partition *part = &xpc_partitions[ch->partid];
-
-       FETCHOP_STORE_OP(TO_AMO((u64)&part->local_IPI_amo_va->variable),
-                        FETCHOP_OR, ((u64)ipi_flag << (ch->number * 8)));
-       dev_dbg(xpc_chan, "%s sent local from partid=%d, channel=%d\n",
-               ipi_flag_string, ch->partid, ch->number);
-}
-
-/*
- * The sending and receiving of IPIs includes the setting of an AMO variable
- * to indicate the reason the IPI was sent. The 64-bit variable is divided
- * up into eight bytes, ordered from right to left. Byte zero pertains to
- * channel 0, byte one to channel 1, and so on. Each byte is described by
- * the following IPI flags.
- */
-
-#define        XPC_IPI_CLOSEREQUEST    0x01
-#define        XPC_IPI_CLOSEREPLY      0x02
-#define        XPC_IPI_OPENREQUEST     0x04
-#define        XPC_IPI_OPENREPLY       0x08
-#define        XPC_IPI_MSGREQUEST      0x10
-
-/* given an AMO variable and a channel#, get its associated IPI flags */
-#define XPC_GET_IPI_FLAGS(_amo, _c)    ((u8) (((_amo) >> ((_c) * 8)) & 0xff))
-#define XPC_SET_IPI_FLAGS(_amo, _c, _f)        (_amo) |= ((u64) (_f) << ((_c) * 8))
-
-#define        XPC_ANY_OPENCLOSE_IPI_FLAGS_SET(_amo) ((_amo) & 0x0f0f0f0f0f0f0f0fUL)
-#define XPC_ANY_MSG_IPI_FLAGS_SET(_amo)       ((_amo) & 0x1010101010101010UL)
-
-static inline void
-xpc_IPI_send_closerequest(struct xpc_channel *ch, unsigned long *irq_flags)
-{
-       struct xpc_openclose_args *args = ch->local_openclose_args;
-
-       args->reason = ch->reason;
-
-       XPC_NOTIFY_IRQ_SEND(ch, XPC_IPI_CLOSEREQUEST, irq_flags);
-}
-
-static inline void
-xpc_IPI_send_closereply(struct xpc_channel *ch, unsigned long *irq_flags)
-{
-       XPC_NOTIFY_IRQ_SEND(ch, XPC_IPI_CLOSEREPLY, irq_flags);
-}
-
-static inline void
-xpc_IPI_send_openrequest(struct xpc_channel *ch, unsigned long *irq_flags)
-{
-       struct xpc_openclose_args *args = ch->local_openclose_args;
-
-       args->msg_size = ch->msg_size;
-       args->local_nentries = ch->local_nentries;
-
-       XPC_NOTIFY_IRQ_SEND(ch, XPC_IPI_OPENREQUEST, irq_flags);
-}
-
-static inline void
-xpc_IPI_send_openreply(struct xpc_channel *ch, unsigned long *irq_flags)
-{
-       struct xpc_openclose_args *args = ch->local_openclose_args;
-
-       args->remote_nentries = ch->remote_nentries;
-       args->local_nentries = ch->local_nentries;
-       args->local_msgqueue_pa = __pa(ch->local_msgqueue);
-
-       XPC_NOTIFY_IRQ_SEND(ch, XPC_IPI_OPENREPLY, irq_flags);
-}
-
-static inline void
-xpc_IPI_send_msgrequest(struct xpc_channel *ch)
-{
-       XPC_NOTIFY_IRQ_SEND(ch, XPC_IPI_MSGREQUEST, NULL);
-}
-
-static inline void
-xpc_IPI_send_local_msgrequest(struct xpc_channel *ch)
-{
-       XPC_NOTIFY_IRQ_SEND_LOCAL(ch, XPC_IPI_MSGREQUEST);
-}
-
-/*
- * Memory for XPC's AMO variables is allocated by the MSPEC driver. These
- * pages are located in the lowest granule. The lowest granule uses 4k pages
- * for cached references and an alternate TLB handler to never provide a
- * cacheable mapping for the entire region. This will prevent speculative
- * reading of cached copies of our lines from being issued which will cause
- * a PI FSB Protocol error to be generated by the SHUB. For XPC, we need 64
- * AMO variables (based on XP_MAX_PARTITIONS) for message notification and an
- * additional 128 AMO variables (based on XP_NASID_MASK_WORDS) for partition
- * activation and 2 AMO variables for partition deactivation.
- */
-static inline AMO_t *
-xpc_IPI_init(int index)
-{
-       AMO_t *amo = xpc_vars->amos_page + index;
-
-       (void)xpc_IPI_receive(amo);     /* clear AMO variable */
-       return amo;
-}
-
-static inline enum xp_retval
-xpc_map_bte_errors(bte_result_t error)
-{
-       return ((error == BTE_SUCCESS) ? xpSuccess : xpBteCopyError);
-}
-
-/*
- * Check to see if there is any channel activity to/from the specified
- * partition.
- */
-static inline void
-xpc_check_for_channel_activity(struct xpc_partition *part)
-{
-       u64 IPI_amo;
-       unsigned long irq_flags;
-
-       IPI_amo = xpc_IPI_receive(part->local_IPI_amo_va);
-       if (IPI_amo == 0)
-               return;
-
-       spin_lock_irqsave(&part->IPI_lock, irq_flags);
-       part->local_IPI_amo |= IPI_amo;
-       spin_unlock_irqrestore(&part->IPI_lock, irq_flags);
-
-       dev_dbg(xpc_chan, "received IPI from partid=%d, IPI_amo=0x%lx\n",
-               XPC_PARTID(part), IPI_amo);
-
-       xpc_wakeup_channel_mgr(part);
-}
-
 #endif /* _DRIVERS_MISC_SGIXP_XPC_H */
index 9c90c2d..9cd2ebe 100644 (file)
  *
  */
 
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/sched.h>
-#include <linux/cache.h>
-#include <linux/interrupt.h>
-#include <linux/mutex.h>
-#include <linux/completion.h>
-#include <asm/sn/bte.h>
-#include <asm/sn/sn_sal.h>
+#include <linux/device.h>
 #include "xpc.h"
 
-/*
- * Guarantee that the kzalloc'd memory is cacheline aligned.
- */
-static void *
-xpc_kzalloc_cacheline_aligned(size_t size, gfp_t flags, void **base)
-{
-       /* see if kzalloc will give us cachline aligned memory by default */
-       *base = kzalloc(size, flags);
-       if (*base == NULL)
-               return NULL;
-
-       if ((u64)*base == L1_CACHE_ALIGN((u64)*base))
-               return *base;
-
-       kfree(*base);
-
-       /* nope, we'll have to do it ourselves */
-       *base = kzalloc(size + L1_CACHE_BYTES, flags);
-       if (*base == NULL)
-               return NULL;
-
-       return (void *)L1_CACHE_ALIGN((u64)*base);
-}
-
-/*
- * Set up the initial values for the XPartition Communication channels.
- */
-static void
-xpc_initialize_channels(struct xpc_partition *part, short partid)
-{
-       int ch_number;
-       struct xpc_channel *ch;
-
-       for (ch_number = 0; ch_number < part->nchannels; ch_number++) {
-               ch = &part->channels[ch_number];
-
-               ch->partid = partid;
-               ch->number = ch_number;
-               ch->flags = XPC_C_DISCONNECTED;
-
-               ch->local_GP = &part->local_GPs[ch_number];
-               ch->local_openclose_args =
-                   &part->local_openclose_args[ch_number];
-
-               atomic_set(&ch->kthreads_assigned, 0);
-               atomic_set(&ch->kthreads_idle, 0);
-               atomic_set(&ch->kthreads_active, 0);
-
-               atomic_set(&ch->references, 0);
-               atomic_set(&ch->n_to_notify, 0);
-
-               spin_lock_init(&ch->lock);
-               mutex_init(&ch->msg_to_pull_mutex);
-               init_completion(&ch->wdisconnect_wait);
-
-               atomic_set(&ch->n_on_msg_allocate_wq, 0);
-               init_waitqueue_head(&ch->msg_allocate_wq);
-               init_waitqueue_head(&ch->idle_wq);
-       }
-}
-
-/*
- * Setup the infrastructure necessary to support XPartition Communication
- * between the specified remote partition and the local one.
- */
-enum xp_retval
-xpc_setup_infrastructure(struct xpc_partition *part)
-{
-       int ret, cpuid;
-       struct timer_list *timer;
-       short partid = XPC_PARTID(part);
-
-       /*
-        * Zero out MOST of the entry for this partition. Only the fields
-        * starting with `nchannels' will be zeroed. The preceding fields must
-        * remain `viable' across partition ups and downs, since they may be
-        * referenced during this memset() operation.
-        */
-       memset(&part->nchannels, 0, sizeof(struct xpc_partition) -
-              offsetof(struct xpc_partition, nchannels));
-
-       /*
-        * Allocate all of the channel structures as a contiguous chunk of
-        * memory.
-        */
-       part->channels = kzalloc(sizeof(struct xpc_channel) * XPC_NCHANNELS,
-                                GFP_KERNEL);
-       if (part->channels == NULL) {
-               dev_err(xpc_chan, "can't get memory for channels\n");
-               return xpNoMemory;
-       }
-
-       part->nchannels = XPC_NCHANNELS;
-
-       /* allocate all the required GET/PUT values */
-
-       part->local_GPs = xpc_kzalloc_cacheline_aligned(XPC_GP_SIZE,
-                                                       GFP_KERNEL,
-                                                       &part->local_GPs_base);
-       if (part->local_GPs == NULL) {
-               kfree(part->channels);
-               part->channels = NULL;
-               dev_err(xpc_chan, "can't get memory for local get/put "
-                       "values\n");
-               return xpNoMemory;
-       }
-
-       part->remote_GPs = xpc_kzalloc_cacheline_aligned(XPC_GP_SIZE,
-                                                        GFP_KERNEL,
-                                                        &part->
-                                                        remote_GPs_base);
-       if (part->remote_GPs == NULL) {
-               dev_err(xpc_chan, "can't get memory for remote get/put "
-                       "values\n");
-               kfree(part->local_GPs_base);
-               part->local_GPs = NULL;
-               kfree(part->channels);
-               part->channels = NULL;
-               return xpNoMemory;
-       }
-
-       /* allocate all the required open and close args */
-
-       part->local_openclose_args =
-           xpc_kzalloc_cacheline_aligned(XPC_OPENCLOSE_ARGS_SIZE, GFP_KERNEL,
-                                         &part->local_openclose_args_base);
-       if (part->local_openclose_args == NULL) {
-               dev_err(xpc_chan, "can't get memory for local connect args\n");
-               kfree(part->remote_GPs_base);
-               part->remote_GPs = NULL;
-               kfree(part->local_GPs_base);
-               part->local_GPs = NULL;
-               kfree(part->channels);
-               part->channels = NULL;
-               return xpNoMemory;
-       }
-
-       part->remote_openclose_args =
-           xpc_kzalloc_cacheline_aligned(XPC_OPENCLOSE_ARGS_SIZE, GFP_KERNEL,
-                                         &part->remote_openclose_args_base);
-       if (part->remote_openclose_args == NULL) {
-               dev_err(xpc_chan, "can't get memory for remote connect args\n");
-               kfree(part->local_openclose_args_base);
-               part->local_openclose_args = NULL;
-               kfree(part->remote_GPs_base);
-               part->remote_GPs = NULL;
-               kfree(part->local_GPs_base);
-               part->local_GPs = NULL;
-               kfree(part->channels);
-               part->channels = NULL;
-               return xpNoMemory;
-       }
-
-       xpc_initialize_channels(part, partid);
-
-       atomic_set(&part->nchannels_active, 0);
-       atomic_set(&part->nchannels_engaged, 0);
-
-       /* local_IPI_amo were set to 0 by an earlier memset() */
-
-       /* Initialize this partitions AMO_t structure */
-       part->local_IPI_amo_va = xpc_IPI_init(partid);
-
-       spin_lock_init(&part->IPI_lock);
-
-       atomic_set(&part->channel_mgr_requests, 1);
-       init_waitqueue_head(&part->channel_mgr_wq);
-
-       sprintf(part->IPI_owner, "xpc%02d", partid);
-       ret = request_irq(SGI_XPC_NOTIFY, xpc_notify_IRQ_handler, IRQF_SHARED,
-                         part->IPI_owner, (void *)(u64)partid);
-       if (ret != 0) {
-               dev_err(xpc_chan, "can't register NOTIFY IRQ handler, "
-                       "errno=%d\n", -ret);
-               kfree(part->remote_openclose_args_base);
-               part->remote_openclose_args = NULL;
-               kfree(part->local_openclose_args_base);
-               part->local_openclose_args = NULL;
-               kfree(part->remote_GPs_base);
-               part->remote_GPs = NULL;
-               kfree(part->local_GPs_base);
-               part->local_GPs = NULL;
-               kfree(part->channels);
-               part->channels = NULL;
-               return xpLackOfResources;
-       }
-
-       /* Setup a timer to check for dropped IPIs */
-       timer = &part->dropped_IPI_timer;
-       init_timer(timer);
-       timer->function = (void (*)(unsigned long))xpc_dropped_IPI_check;
-       timer->data = (unsigned long)part;
-       timer->expires = jiffies + XPC_P_DROPPED_IPI_WAIT;
-       add_timer(timer);
-
-       /*
-        * With the setting of the partition setup_state to XPC_P_SETUP, we're
-        * declaring that this partition is ready to go.
-        */
-       part->setup_state = XPC_P_SETUP;
-
-       /*
-        * Setup the per partition specific variables required by the
-        * remote partition to establish channel connections with us.
-        *
-        * The setting of the magic # indicates that these per partition
-        * specific variables are ready to be used.
-        */
-       xpc_vars_part[partid].GPs_pa = __pa(part->local_GPs);
-       xpc_vars_part[partid].openclose_args_pa =
-           __pa(part->local_openclose_args);
-       xpc_vars_part[partid].IPI_amo_pa = __pa(part->local_IPI_amo_va);
-       cpuid = raw_smp_processor_id(); /* any CPU in this partition will do */
-       xpc_vars_part[partid].IPI_nasid = cpuid_to_nasid(cpuid);
-       xpc_vars_part[partid].IPI_phys_cpuid = cpu_physical_id(cpuid);
-       xpc_vars_part[partid].nchannels = part->nchannels;
-       xpc_vars_part[partid].magic = XPC_VP_MAGIC1;
-
-       return xpSuccess;
-}
-
-/*
- * Create a wrapper that hides the underlying mechanism for pulling a cacheline
- * (or multiple cachelines) from a remote partition.
- *
- * src must be a cacheline aligned physical address on the remote partition.
- * dst must be a cacheline aligned virtual address on this partition.
- * cnt must be an cacheline sized
- */
-static enum xp_retval
-xpc_pull_remote_cachelines(struct xpc_partition *part, void *dst,
-                          const void *src, size_t cnt)
-{
-       bte_result_t bte_ret;
-
-       DBUG_ON((u64)src != L1_CACHE_ALIGN((u64)src));
-       DBUG_ON((u64)dst != L1_CACHE_ALIGN((u64)dst));
-       DBUG_ON(cnt != L1_CACHE_ALIGN(cnt));
-
-       if (part->act_state == XPC_P_DEACTIVATING)
-               return part->reason;
-
-       bte_ret = xp_bte_copy((u64)src, (u64)dst, (u64)cnt,
-                             (BTE_NORMAL | BTE_WACQUIRE), NULL);
-       if (bte_ret == BTE_SUCCESS)
-               return xpSuccess;
-
-       dev_dbg(xpc_chan, "xp_bte_copy() from partition %d failed, ret=%d\n",
-               XPC_PARTID(part), bte_ret);
-
-       return xpc_map_bte_errors(bte_ret);
-}
-
-/*
- * Pull the remote per partition specific variables from the specified
- * partition.
- */
-enum xp_retval
-xpc_pull_remote_vars_part(struct xpc_partition *part)
-{
-       u8 buffer[L1_CACHE_BYTES * 2];
-       struct xpc_vars_part *pulled_entry_cacheline =
-           (struct xpc_vars_part *)L1_CACHE_ALIGN((u64)buffer);
-       struct xpc_vars_part *pulled_entry;
-       u64 remote_entry_cacheline_pa, remote_entry_pa;
-       short partid = XPC_PARTID(part);
-       enum xp_retval ret;
-
-       /* pull the cacheline that contains the variables we're interested in */
-
-       DBUG_ON(part->remote_vars_part_pa !=
-               L1_CACHE_ALIGN(part->remote_vars_part_pa));
-       DBUG_ON(sizeof(struct xpc_vars_part) != L1_CACHE_BYTES / 2);
-
-       remote_entry_pa = part->remote_vars_part_pa +
-           sn_partition_id * sizeof(struct xpc_vars_part);
-
-       remote_entry_cacheline_pa = (remote_entry_pa & ~(L1_CACHE_BYTES - 1));
-
-       pulled_entry = (struct xpc_vars_part *)((u64)pulled_entry_cacheline +
-                                               (remote_entry_pa &
-                                                (L1_CACHE_BYTES - 1)));
-
-       ret = xpc_pull_remote_cachelines(part, pulled_entry_cacheline,
-                                        (void *)remote_entry_cacheline_pa,
-                                        L1_CACHE_BYTES);
-       if (ret != xpSuccess) {
-               dev_dbg(xpc_chan, "failed to pull XPC vars_part from "
-                       "partition %d, ret=%d\n", partid, ret);
-               return ret;
-       }
-
-       /* see if they've been set up yet */
-
-       if (pulled_entry->magic != XPC_VP_MAGIC1 &&
-           pulled_entry->magic != XPC_VP_MAGIC2) {
-
-               if (pulled_entry->magic != 0) {
-                       dev_dbg(xpc_chan, "partition %d's XPC vars_part for "
-                               "partition %d has bad magic value (=0x%lx)\n",
-                               partid, sn_partition_id, pulled_entry->magic);
-                       return xpBadMagic;
-               }
-
-               /* they've not been initialized yet */
-               return xpRetry;
-       }
-
-       if (xpc_vars_part[partid].magic == XPC_VP_MAGIC1) {
-
-               /* validate the variables */
-
-               if (pulled_entry->GPs_pa == 0 ||
-                   pulled_entry->openclose_args_pa == 0 ||
-                   pulled_entry->IPI_amo_pa == 0) {
-
-                       dev_err(xpc_chan, "partition %d's XPC vars_part for "
-                               "partition %d are not valid\n", partid,
-                               sn_partition_id);
-                       return xpInvalidAddress;
-               }
-
-               /* the variables we imported look to be valid */
-
-               part->remote_GPs_pa = pulled_entry->GPs_pa;
-               part->remote_openclose_args_pa =
-                   pulled_entry->openclose_args_pa;
-               part->remote_IPI_amo_va =
-                   (AMO_t *)__va(pulled_entry->IPI_amo_pa);
-               part->remote_IPI_nasid = pulled_entry->IPI_nasid;
-               part->remote_IPI_phys_cpuid = pulled_entry->IPI_phys_cpuid;
-
-               if (part->nchannels > pulled_entry->nchannels)
-                       part->nchannels = pulled_entry->nchannels;
-
-               /* let the other side know that we've pulled their variables */
-
-               xpc_vars_part[partid].magic = XPC_VP_MAGIC2;
-       }
-
-       if (pulled_entry->magic == XPC_VP_MAGIC1)
-               return xpRetry;
-
-       return xpSuccess;
-}
-
-/*
- * Get the IPI flags and pull the openclose args and/or remote GPs as needed.
- */
-static u64
-xpc_get_IPI_flags(struct xpc_partition *part)
-{
-       unsigned long irq_flags;
-       u64 IPI_amo;
-       enum xp_retval ret;
-
-       /*
-        * See if there are any IPI flags to be handled.
-        */
-
-       spin_lock_irqsave(&part->IPI_lock, irq_flags);
-       IPI_amo = part->local_IPI_amo;
-       if (IPI_amo != 0)
-               part->local_IPI_amo = 0;
-
-       spin_unlock_irqrestore(&part->IPI_lock, irq_flags);
-
-       if (XPC_ANY_OPENCLOSE_IPI_FLAGS_SET(IPI_amo)) {
-               ret = xpc_pull_remote_cachelines(part,
-                                                part->remote_openclose_args,
-                                                (void *)part->
-                                                remote_openclose_args_pa,
-                                                XPC_OPENCLOSE_ARGS_SIZE);
-               if (ret != xpSuccess) {
-                       XPC_DEACTIVATE_PARTITION(part, ret);
-
-                       dev_dbg(xpc_chan, "failed to pull openclose args from "
-                               "partition %d, ret=%d\n", XPC_PARTID(part),
-                               ret);
-
-                       /* don't bother processing IPIs anymore */
-                       IPI_amo = 0;
-               }
-       }
-
-       if (XPC_ANY_MSG_IPI_FLAGS_SET(IPI_amo)) {
-               ret = xpc_pull_remote_cachelines(part, part->remote_GPs,
-                                                (void *)part->remote_GPs_pa,
-                                                XPC_GP_SIZE);
-               if (ret != xpSuccess) {
-                       XPC_DEACTIVATE_PARTITION(part, ret);
-
-                       dev_dbg(xpc_chan, "failed to pull GPs from partition "
-                               "%d, ret=%d\n", XPC_PARTID(part), ret);
-
-                       /* don't bother processing IPIs anymore */
-                       IPI_amo = 0;
-               }
-       }
-
-       return IPI_amo;
-}
-
-/*
- * Allocate the local message queue and the notify queue.
- */
-static enum xp_retval
-xpc_allocate_local_msgqueue(struct xpc_channel *ch)
-{
-       unsigned long irq_flags;
-       int nentries;
-       size_t nbytes;
-
-       for (nentries = ch->local_nentries; nentries > 0; nentries--) {
-
-               nbytes = nentries * ch->msg_size;
-               ch->local_msgqueue = xpc_kzalloc_cacheline_aligned(nbytes,
-                                                                  GFP_KERNEL,
-                                                     &ch->local_msgqueue_base);
-               if (ch->local_msgqueue == NULL)
-                       continue;
-
-               nbytes = nentries * sizeof(struct xpc_notify);
-               ch->notify_queue = kzalloc(nbytes, GFP_KERNEL);
-               if (ch->notify_queue == NULL) {
-                       kfree(ch->local_msgqueue_base);
-                       ch->local_msgqueue = NULL;
-                       continue;
-               }
-
-               spin_lock_irqsave(&ch->lock, irq_flags);
-               if (nentries < ch->local_nentries) {
-                       dev_dbg(xpc_chan, "nentries=%d local_nentries=%d, "
-                               "partid=%d, channel=%d\n", nentries,
-                               ch->local_nentries, ch->partid, ch->number);
-
-                       ch->local_nentries = nentries;
-               }
-               spin_unlock_irqrestore(&ch->lock, irq_flags);
-               return xpSuccess;
-       }
-
-       dev_dbg(xpc_chan, "can't get memory for local message queue and notify "
-               "queue, partid=%d, channel=%d\n", ch->partid, ch->number);
-       return xpNoMemory;
-}
-
-/*
- * Allocate the cached remote message queue.
- */
-static enum xp_retval
-xpc_allocate_remote_msgqueue(struct xpc_channel *ch)
-{
-       unsigned long irq_flags;
-       int nentries;
-       size_t nbytes;
-
-       DBUG_ON(ch->remote_nentries <= 0);
-
-       for (nentries = ch->remote_nentries; nentries > 0; nentries--) {
-
-               nbytes = nentries * ch->msg_size;
-               ch->remote_msgqueue = xpc_kzalloc_cacheline_aligned(nbytes,
-                                                                   GFP_KERNEL,
-                                                    &ch->remote_msgqueue_base);
-               if (ch->remote_msgqueue == NULL)
-                       continue;
-
-               spin_lock_irqsave(&ch->lock, irq_flags);
-               if (nentries < ch->remote_nentries) {
-                       dev_dbg(xpc_chan, "nentries=%d remote_nentries=%d, "
-                               "partid=%d, channel=%d\n", nentries,
-                               ch->remote_nentries, ch->partid, ch->number);
-
-                       ch->remote_nentries = nentries;
-               }
-               spin_unlock_irqrestore(&ch->lock, irq_flags);
-               return xpSuccess;
-       }
-
-       dev_dbg(xpc_chan, "can't get memory for cached remote message queue, "
-               "partid=%d, channel=%d\n", ch->partid, ch->number);
-       return xpNoMemory;
-}
-
-/*
- * Allocate message queues and other stuff associated with a channel.
- *
- * Note: Assumes all of the channel sizes are filled in.
- */
-static enum xp_retval
-xpc_allocate_msgqueues(struct xpc_channel *ch)
-{
-       unsigned long irq_flags;
-       enum xp_retval ret;
-
-       DBUG_ON(ch->flags & XPC_C_SETUP);
-
-       ret = xpc_allocate_local_msgqueue(ch);
-       if (ret != xpSuccess)
-               return ret;
-
-       ret = xpc_allocate_remote_msgqueue(ch);
-       if (ret != xpSuccess) {
-               kfree(ch->local_msgqueue_base);
-               ch->local_msgqueue = NULL;
-               kfree(ch->notify_queue);
-               ch->notify_queue = NULL;
-               return ret;
-       }
-
-       spin_lock_irqsave(&ch->lock, irq_flags);
-       ch->flags |= XPC_C_SETUP;
-       spin_unlock_irqrestore(&ch->lock, irq_flags);
-
-       return xpSuccess;
-}
-
 /*
  * Process a connect message from a remote partition.
  *
@@ -565,30 +39,29 @@ xpc_process_connect(struct xpc_channel *ch, unsigned long *irq_flags)
 
        if (!(ch->flags & XPC_C_SETUP)) {
                spin_unlock_irqrestore(&ch->lock, *irq_flags);
-               ret = xpc_allocate_msgqueues(ch);
+               ret = xpc_setup_msg_structures(ch);
                spin_lock_irqsave(&ch->lock, *irq_flags);
 
                if (ret != xpSuccess)
                        XPC_DISCONNECT_CHANNEL(ch, ret, irq_flags);
 
+               ch->flags |= XPC_C_SETUP;
+
                if (ch->flags & (XPC_C_CONNECTED | XPC_C_DISCONNECTING))
                        return;
 
-               DBUG_ON(!(ch->flags & XPC_C_SETUP));
                DBUG_ON(ch->local_msgqueue == NULL);
                DBUG_ON(ch->remote_msgqueue == NULL);
        }
 
        if (!(ch->flags & XPC_C_OPENREPLY)) {
                ch->flags |= XPC_C_OPENREPLY;
-               xpc_IPI_send_openreply(ch, irq_flags);
+               xpc_send_chctl_openreply(ch, irq_flags);
        }
 
        if (!(ch->flags & XPC_C_ROPENREPLY))
                return;
 
-       DBUG_ON(ch->remote_msgqueue_pa == 0);
-
        ch->flags = (XPC_C_CONNECTED | XPC_C_SETUP);    /* clear all else */
 
        dev_info(xpc_chan, "channel %d to partition %d connected\n",
@@ -599,99 +72,6 @@ xpc_process_connect(struct xpc_channel *ch, unsigned long *irq_flags)
        spin_lock_irqsave(&ch->lock, *irq_flags);
 }
 
-/*
- * Notify those who wanted to be notified upon delivery of their message.
- */
-static void
-xpc_notify_senders(struct xpc_channel *ch, enum xp_retval reason, s64 put)
-{
-       struct xpc_notify *notify;
-       u8 notify_type;
-       s64 get = ch->w_remote_GP.get - 1;
-
-       while (++get < put && atomic_read(&ch->n_to_notify) > 0) {
-
-               notify = &ch->notify_queue[get % ch->local_nentries];
-
-               /*
-                * See if the notify entry indicates it was associated with
-                * a message who's sender wants to be notified. It is possible
-                * that it is, but someone else is doing or has done the
-                * notification.
-                */
-               notify_type = notify->type;
-               if (notify_type == 0 ||
-                   cmpxchg(&notify->type, notify_type, 0) != notify_type) {
-                       continue;
-               }
-
-               DBUG_ON(notify_type != XPC_N_CALL);
-
-               atomic_dec(&ch->n_to_notify);
-
-               if (notify->func != NULL) {
-                       dev_dbg(xpc_chan, "notify->func() called, notify=0x%p, "
-                               "msg_number=%ld, partid=%d, channel=%d\n",
-                               (void *)notify, get, ch->partid, ch->number);
-
-                       notify->func(reason, ch->partid, ch->number,
-                                    notify->key);
-
-                       dev_dbg(xpc_chan, "notify->func() returned, "
-                               "notify=0x%p, msg_number=%ld, partid=%d, "
-                               "channel=%d\n", (void *)notify, get,
-                               ch->partid, ch->number);
-               }
-       }
-}
-
-/*
- * Free up message queues and other stuff that were allocated for the specified
- * channel.
- *
- * Note: ch->reason and ch->reason_line are left set for debugging purposes,
- * they're cleared when XPC_C_DISCONNECTED is cleared.
- */
-static void
-xpc_free_msgqueues(struct xpc_channel *ch)
-{
-       DBUG_ON(!spin_is_locked(&ch->lock));
-       DBUG_ON(atomic_read(&ch->n_to_notify) != 0);
-
-       ch->remote_msgqueue_pa = 0;
-       ch->func = NULL;
-       ch->key = NULL;
-       ch->msg_size = 0;
-       ch->local_nentries = 0;
-       ch->remote_nentries = 0;
-       ch->kthreads_assigned_limit = 0;
-       ch->kthreads_idle_limit = 0;
-
-       ch->local_GP->get = 0;
-       ch->local_GP->put = 0;
-       ch->remote_GP.get = 0;
-       ch->remote_GP.put = 0;
-       ch->w_local_GP.get = 0;
-       ch->w_local_GP.put = 0;
-       ch->w_remote_GP.get = 0;
-       ch->w_remote_GP.put = 0;
-       ch->next_msg_to_pull = 0;
-
-       if (ch->flags & XPC_C_SETUP) {
-               ch->flags &= ~XPC_C_SETUP;
-
-               dev_dbg(xpc_chan, "ch->flags=0x%x, partid=%d, channel=%d\n",
-                       ch->flags, ch->partid, ch->number);
-
-               kfree(ch->local_msgqueue_base);
-               ch->local_msgqueue = NULL;
-               kfree(ch->remote_msgqueue_base);
-               ch->remote_msgqueue = NULL;
-               kfree(ch->notify_queue);
-               ch->notify_queue = NULL;
-       }
-}
-
 /*
  * spin_lock_irqsave() is expected to be held on entry.
  */
@@ -717,9 +97,9 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
        DBUG_ON((ch->flags & XPC_C_CONNECTEDCALLOUT_MADE) &&
                !(ch->flags & XPC_C_DISCONNECTINGCALLOUT_MADE));
 
-       if (part->act_state == XPC_P_DEACTIVATING) {
+       if (part->act_state == XPC_P_AS_DEACTIVATING) {
                /* can't proceed until the other side disengages from us */
-               if (xpc_partition_engaged(1UL << ch->partid))
+               if (xpc_partition_engaged(ch->partid))
                        return;
 
        } else {
@@ -731,7 +111,7 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
 
                if (!(ch->flags & XPC_C_CLOSEREPLY)) {
                        ch->flags |= XPC_C_CLOSEREPLY;
-                       xpc_IPI_send_closereply(ch, irq_flags);
+                       xpc_send_chctl_closereply(ch, irq_flags);
                }
 
                if (!(ch->flags & XPC_C_RCLOSEREPLY))
@@ -740,8 +120,8 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
 
        /* wake those waiting for notify completion */
        if (atomic_read(&ch->n_to_notify) > 0) {
-               /* >>> we do callout while holding ch->lock */
-               xpc_notify_senders(ch, ch->reason, ch->w_local_GP.put);
+               /* we do callout while holding ch->lock, callout can't block */
+               xpc_notify_senders_of_disconnect(ch);
        }
 
        /* both sides are disconnected now */
@@ -752,10 +132,24 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
                spin_lock_irqsave(&ch->lock, *irq_flags);
        }
 
+       DBUG_ON(atomic_read(&ch->n_to_notify) != 0);
+
        /* it's now safe to free the channel's message queues */
-       xpc_free_msgqueues(ch);
+       xpc_teardown_msg_structures(ch);
 
-       /* mark disconnected, clear all other flags except XPC_C_WDISCONNECT */
+       ch->func = NULL;
+       ch->key = NULL;
+       ch->entry_size = 0;
+       ch->local_nentries = 0;
+       ch->remote_nentries = 0;
+       ch->kthreads_assigned_limit = 0;
+       ch->kthreads_idle_limit = 0;
+
+       /*
+        * Mark the channel disconnected and clear all other flags, including
+        * XPC_C_SETUP (because of call to xpc_teardown_msg_structures()) but
+        * not including XPC_C_WDISCONNECT (if it was set).
+        */
        ch->flags = (XPC_C_DISCONNECTED | (ch->flags & XPC_C_WDISCONNECT));
 
        atomic_dec(&part->nchannels_active);
@@ -768,15 +162,15 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
        if (ch->flags & XPC_C_WDISCONNECT) {
                /* we won't lose the CPU since we're holding ch->lock */
                complete(&ch->wdisconnect_wait);
-       } else if (ch->delayed_IPI_flags) {
-               if (part->act_state != XPC_P_DEACTIVATING) {
-                       /* time to take action on any delayed IPI flags */
-                       spin_lock(&part->IPI_lock);
-                       XPC_SET_IPI_FLAGS(part->local_IPI_amo, ch->number,
-                                         ch->delayed_IPI_flags);
-                       spin_unlock(&part->IPI_lock);
+       } else if (ch->delayed_chctl_flags) {
+               if (part->act_state != XPC_P_AS_DEACTIVATING) {
+                       /* time to take action on any delayed chctl flags */
+                       spin_lock(&part->chctl_lock);
+                       part->chctl.flags[ch->number] |=
+                           ch->delayed_chctl_flags;
+                       spin_unlock(&part->chctl_lock);
                }
-               ch->delayed_IPI_flags = 0;
+               ch->delayed_chctl_flags = 0;
        }
 }
 
@@ -784,8 +178,8 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
  * Process a change in the channel's remote connection state.
  */
 static void
-xpc_process_openclose_IPI(struct xpc_partition *part, int ch_number,
-                         u8 IPI_flags)
+xpc_process_openclose_chctl_flags(struct xpc_partition *part, int ch_number,
+                                 u8 chctl_flags)
 {
        unsigned long irq_flags;
        struct xpc_openclose_args *args =
@@ -800,24 +194,24 @@ again:
        if ((ch->flags & XPC_C_DISCONNECTED) &&
            (ch->flags & XPC_C_WDISCONNECT)) {
                /*
-                * Delay processing IPI flags until thread waiting disconnect
+                * Delay processing chctl flags until thread waiting disconnect
                 * has had a chance to see that the channel is disconnected.
                 */
-               ch->delayed_IPI_flags |= IPI_flags;
+               ch->delayed_chctl_flags |= chctl_flags;
                spin_unlock_irqrestore(&ch->lock, irq_flags);
                return;
        }
 
-       if (IPI_flags & XPC_IPI_CLOSEREQUEST) {
+       if (chctl_flags & XPC_CHCTL_CLOSEREQUEST) {
 
-               dev_dbg(xpc_chan, "XPC_IPI_CLOSEREQUEST (reason=%d) received "
+               dev_dbg(xpc_chan, "XPC_CHCTL_CLOSEREQUEST (reason=%d) received "
                        "from partid=%d, channel=%d\n", args->reason,
                        ch->partid, ch->number);
 
                /*
                 * If RCLOSEREQUEST is set, we're probably waiting for
                 * RCLOSEREPLY. We should find it and a ROPENREQUEST packed
-                * with this RCLOSEREQUEST in the IPI_flags.
+                * with this RCLOSEREQUEST in the chctl_flags.
                 */
 
                if (ch->flags & XPC_C_RCLOSEREQUEST) {
@@ -826,8 +220,8 @@ again:
                        DBUG_ON(!(ch->flags & XPC_C_CLOSEREPLY));
                        DBUG_ON(ch->flags & XPC_C_RCLOSEREPLY);
 
-                       DBUG_ON(!(IPI_flags & XPC_IPI_CLOSEREPLY));
-                       IPI_flags &= ~XPC_IPI_CLOSEREPLY;
+                       DBUG_ON(!(chctl_flags & XPC_CHCTL_CLOSEREPLY));
+                       chctl_flags &= ~XPC_CHCTL_CLOSEREPLY;
                        ch->flags |= XPC_C_RCLOSEREPLY;
 
                        /* both sides have finished disconnecting */
@@ -837,17 +231,15 @@ again:
                }
 
                if (ch->flags & XPC_C_DISCONNECTED) {
-                       if (!(IPI_flags & XPC_IPI_OPENREQUEST)) {
-                               if ((XPC_GET_IPI_FLAGS(part->local_IPI_amo,
-                                                      ch_number) &
-                                    XPC_IPI_OPENREQUEST)) {
-
-                                       DBUG_ON(ch->delayed_IPI_flags != 0);
-                                       spin_lock(&part->IPI_lock);
-                                       XPC_SET_IPI_FLAGS(part->local_IPI_amo,
-                                                         ch_number,
-                                                         XPC_IPI_CLOSEREQUEST);
-                                       spin_unlock(&part->IPI_lock);
+                       if (!(chctl_flags & XPC_CHCTL_OPENREQUEST)) {
+                               if (part->chctl.flags[ch_number] &
+                                   XPC_CHCTL_OPENREQUEST) {
+
+                                       DBUG_ON(ch->delayed_chctl_flags != 0);
+                                       spin_lock(&part->chctl_lock);
+                                       part->chctl.flags[ch_number] |=
+                                           XPC_CHCTL_CLOSEREQUEST;
+                                       spin_unlock(&part->chctl_lock);
                                }
                                spin_unlock_irqrestore(&ch->lock, irq_flags);
                                return;
@@ -860,7 +252,7 @@ again:
                        ch->flags |= (XPC_C_CONNECTING | XPC_C_ROPENREQUEST);
                }
 
-               IPI_flags &= ~(XPC_IPI_OPENREQUEST | XPC_IPI_OPENREPLY);
+               chctl_flags &= ~(XPC_CHCTL_OPENREQUEST | XPC_CHCTL_OPENREPLY);
 
                /*
                 * The meaningful CLOSEREQUEST connection state fields are:
@@ -878,7 +270,7 @@ again:
 
                        XPC_DISCONNECT_CHANNEL(ch, reason, &irq_flags);
 
-                       DBUG_ON(IPI_flags & XPC_IPI_CLOSEREPLY);
+                       DBUG_ON(chctl_flags & XPC_CHCTL_CLOSEREPLY);
                        spin_unlock_irqrestore(&ch->lock, irq_flags);
                        return;
                }
@@ -886,13 +278,13 @@ again:
                xpc_process_disconnect(ch, &irq_flags);
        }
 
-       if (IPI_flags & XPC_IPI_CLOSEREPLY) {
+       if (chctl_flags & XPC_CHCTL_CLOSEREPLY) {
 
-               dev_dbg(xpc_chan, "XPC_IPI_CLOSEREPLY received from partid=%d,"
-                       " channel=%d\n", ch->partid, ch->number);
+               dev_dbg(xpc_chan, "XPC_CHCTL_CLOSEREPLY received from partid="
+                       "%d, channel=%d\n", ch->partid, ch->number);
 
                if (ch->flags & XPC_C_DISCONNECTED) {
-                       DBUG_ON(part->act_state != XPC_P_DEACTIVATING);
+                       DBUG_ON(part->act_state != XPC_P_AS_DEACTIVATING);
                        spin_unlock_irqrestore(&ch->lock, irq_flags);
                        return;
                }
@@ -900,15 +292,14 @@ again:
                DBUG_ON(!(ch->flags & XPC_C_CLOSEREQUEST));
 
                if (!(ch->flags & XPC_C_RCLOSEREQUEST)) {
-                       if ((XPC_GET_IPI_FLAGS(part->local_IPI_amo, ch_number)
-                            & XPC_IPI_CLOSEREQUEST)) {
-
-                               DBUG_ON(ch->delayed_IPI_flags != 0);
-                               spin_lock(&part->IPI_lock);
-                               XPC_SET_IPI_FLAGS(part->local_IPI_amo,
-                                                 ch_number,
-                                                 XPC_IPI_CLOSEREPLY);
-                               spin_unlock(&part->IPI_lock);
+                       if (part->chctl.flags[ch_number] &
+                           XPC_CHCTL_CLOSEREQUEST) {
+
+                               DBUG_ON(ch->delayed_chctl_flags != 0);
+                               spin_lock(&part->chctl_lock);
+                               part->chctl.flags[ch_number] |=
+                                   XPC_CHCTL_CLOSEREPLY;
+                               spin_unlock(&part->chctl_lock);
                        }
                        spin_unlock_irqrestore(&ch->lock, irq_flags);
                        return;
@@ -922,21 +313,21 @@ again:
                }
        }
 
-       if (IPI_flags & XPC_IPI_OPENREQUEST) {
+       if (chctl_flags & XPC_CHCTL_OPENREQUEST) {
 
-               dev_dbg(xpc_chan, "XPC_IPI_OPENREQUEST (msg_size=%d, "
+               dev_dbg(xpc_chan, "XPC_CHCTL_OPENREQUEST (entry_size=%d, "
                        "local_nentries=%d) received from partid=%d, "
-                       "channel=%d\n", args->msg_size, args->local_nentries,
+                       "channel=%d\n", args->entry_size, args->local_nentries,
                        ch->partid, ch->number);
 
-               if (part->act_state == XPC_P_DEACTIVATING ||
+               if (part->act_state == XPC_P_AS_DEACTIVATING ||
                    (ch->flags & XPC_C_ROPENREQUEST)) {
                        spin_unlock_irqrestore(&ch->lock, irq_flags);
                        return;
                }
 
                if (ch->flags & (XPC_C_DISCONNECTING | XPC_C_WDISCONNECT)) {
-                       ch->delayed_IPI_flags |= XPC_IPI_OPENREQUEST;
+                       ch->delayed_chctl_flags |= XPC_CHCTL_OPENREQUEST;
                        spin_unlock_irqrestore(&ch->lock, irq_flags);
                        return;
                }
@@ -947,10 +338,10 @@ again:
 
                /*
                 * The meaningful OPENREQUEST connection state fields are:
-                *      msg_size = size of channel's messages in bytes
+                *      entry_size = size of channel's messages in bytes
                 *      local_nentries = remote partition's local_nentries
                 */
-               if (args->msg_size == 0 || args->local_nentries == 0) {
+               if (args->entry_size == 0 || args->local_nentries == 0) {
                        /* assume OPENREQUEST was delayed by mistake */
                        spin_unlock_irqrestore(&ch->lock, irq_flags);
                        return;
@@ -960,14 +351,14 @@ again:
                ch->remote_nentries = args->local_nentries;
 
                if (ch->flags & XPC_C_OPENREQUEST) {
-                       if (args->msg_size != ch->msg_size) {
+                       if (args->entry_size != ch->entry_size) {
                                XPC_DISCONNECT_CHANNEL(ch, xpUnequalMsgSizes,
                                                       &irq_flags);
                                spin_unlock_irqrestore(&ch->lock, irq_flags);
                                return;
                        }
                } else {
-                       ch->msg_size = args->msg_size;
+                       ch->entry_size = args->entry_size;
 
                        XPC_SET_REASON(ch, 0, 0);
                        ch->flags &= ~XPC_C_DISCONNECTED;
@@ -978,13 +369,13 @@ again:
                xpc_process_connect(ch, &irq_flags);
        }
 
-       if (IPI_flags & XPC_IPI_OPENREPLY) {
+       if (chctl_flags & XPC_CHCTL_OPENREPLY) {
 
-               dev_dbg(xpc_chan, "XPC_IPI_OPENREPLY (local_msgqueue_pa=0x%lx, "
-                       "local_nentries=%d, remote_nentries=%d) received from "
-                       "partid=%d, channel=%d\n", args->local_msgqueue_pa,
-                       args->local_nentries, args->remote_nentries,
-                       ch->partid, ch->number);
+               dev_dbg(xpc_chan, "XPC_CHCTL_OPENREPLY (local_msgqueue_pa="
+                       "0x%lx, local_nentries=%d, remote_nentries=%d) "
+                       "received from partid=%d, channel=%d\n",
+                       args->local_msgqueue_pa, args->local_nentries,
+                       args->remote_nentries, ch->partid, ch->number);
 
                if (ch->flags & (XPC_C_DISCONNECTING | XPC_C_DISCONNECTED)) {
                        spin_unlock_irqrestore(&ch->lock, irq_flags);
@@ -1012,10 +403,10 @@ again:
                DBUG_ON(args->remote_nentries == 0);
 
                ch->flags |= XPC_C_ROPENREPLY;
-               ch->remote_msgqueue_pa = args->local_msgqueue_pa;
+               xpc_save_remote_msgqueue_pa(ch, args->local_msgqueue_pa);
 
                if (args->local_nentries < ch->remote_nentries) {
-                       dev_dbg(xpc_chan, "XPC_IPI_OPENREPLY: new "
+                       dev_dbg(xpc_chan, "XPC_CHCTL_OPENREPLY: new "
                                "remote_nentries=%d, old remote_nentries=%d, "
                                "partid=%d, channel=%d\n",
                                args->local_nentries, ch->remote_nentries,
@@ -1024,7 +415,7 @@ again:
                        ch->remote_nentries = args->local_nentries;
                }
                if (args->remote_nentries < ch->local_nentries) {
-                       dev_dbg(xpc_chan, "XPC_IPI_OPENREPLY: new "
+                       dev_dbg(xpc_chan, "XPC_CHCTL_OPENREPLY: new "
                                "local_nentries=%d, old local_nentries=%d, "
                                "partid=%d, channel=%d\n",
                                args->remote_nentries, ch->local_nentries,
@@ -1082,7 +473,7 @@ xpc_connect_channel(struct xpc_channel *ch)
        ch->local_nentries = registration->nentries;
 
        if (ch->flags & XPC_C_ROPENREQUEST) {
-               if (registration->msg_size != ch->msg_size) {
+               if (registration->entry_size != ch->entry_size) {
                        /* the local and remote sides aren't the same */
 
                        /*
@@ -1101,7 +492,7 @@ xpc_connect_channel(struct xpc_channel *ch)
                        return xpUnequalMsgSizes;
                }
        } else {
-               ch->msg_size = registration->msg_size;
+               ch->entry_size = registration->entry_size;
 
                XPC_SET_REASON(ch, 0, 0);
                ch->flags &= ~XPC_C_DISCONNECTED;
@@ -1114,7 +505,7 @@ xpc_connect_channel(struct xpc_channel *ch)
        /* initiate the connection */
 
        ch->flags |= (XPC_C_OPENREQUEST | XPC_C_CONNECTING);
-       xpc_IPI_send_openrequest(ch, &irq_flags);
+       xpc_send_chctl_openrequest(ch, &irq_flags);
 
        xpc_process_connect(ch, &irq_flags);
 
@@ -1123,152 +514,16 @@ xpc_connect_channel(struct xpc_channel *ch)
        return xpSuccess;
 }
 
-/*
- * Clear some of the msg flags in the local message queue.
- */
-static inline void
-xpc_clear_local_msgqueue_flags(struct xpc_channel *ch)
+void
+xpc_process_sent_chctl_flags(struct xpc_partition *part)
 {
-       struct xpc_msg *msg;
-       s64 get;
-
-       get = ch->w_remote_GP.get;
-       do {
-               msg = (struct xpc_msg *)((u64)ch->local_msgqueue +
-                                        (get % ch->local_nentries) *
-                                        ch->msg_size);
-               msg->flags = 0;
-       } while (++get < ch->remote_GP.get);
-}
+       unsigned long irq_flags;
+       union xpc_channel_ctl_flags chctl;
+       struct xpc_channel *ch;
+       int ch_number;
+       u32 ch_flags;
 
-/*
- * Clear some of the msg flags in the remote message queue.
- */
-static inline void
-xpc_clear_remote_msgqueue_flags(struct xpc_channel *ch)
-{
-       struct xpc_msg *msg;
-       s64 put;
-
-       put = ch->w_remote_GP.put;
-       do {
-               msg = (struct xpc_msg *)((u64)ch->remote_msgqueue +
-                                        (put % ch->remote_nentries) *
-                                        ch->msg_size);
-               msg->flags = 0;
-       } while (++put < ch->remote_GP.put);
-}
-
-static void
-xpc_process_msg_IPI(struct xpc_partition *part, int ch_number)
-{
-       struct xpc_channel *ch = &part->channels[ch_number];
-       int nmsgs_sent;
-
-       ch->remote_GP = part->remote_GPs[ch_number];
-
-       /* See what, if anything, has changed for each connected channel */
-
-       xpc_msgqueue_ref(ch);
-
-       if (ch->w_remote_GP.get == ch->remote_GP.get &&
-           ch->w_remote_GP.put == ch->remote_GP.put) {
-               /* nothing changed since GPs were last pulled */
-               xpc_msgqueue_deref(ch);
-               return;
-       }
-
-       if (!(ch->flags & XPC_C_CONNECTED)) {
-               xpc_msgqueue_deref(ch);
-               return;
-       }
-
-       /*
-        * First check to see if messages recently sent by us have been
-        * received by the other side. (The remote GET value will have
-        * changed since we last looked at it.)
-        */
-
-       if (ch->w_remote_GP.get != ch->remote_GP.get) {
-
-               /*
-                * We need to notify any senders that want to be notified
-                * that their sent messages have been received by their
-                * intended recipients. We need to do this before updating
-                * w_remote_GP.get so that we don't allocate the same message
-                * queue entries prematurely (see xpc_allocate_msg()).
-                */
-               if (atomic_read(&ch->n_to_notify) > 0) {
-                       /*
-                        * Notify senders that messages sent have been
-                        * received and delivered by the other side.
-                        */
-                       xpc_notify_senders(ch, xpMsgDelivered,
-                                          ch->remote_GP.get);
-               }
-
-               /*
-                * Clear msg->flags in previously sent messages, so that
-                * they're ready for xpc_allocate_msg().
-                */
-               xpc_clear_local_msgqueue_flags(ch);
-
-               ch->w_remote_GP.get = ch->remote_GP.get;
-
-               dev_dbg(xpc_chan, "w_remote_GP.get changed to %ld, partid=%d, "
-                       "channel=%d\n", ch->w_remote_GP.get, ch->partid,
-                       ch->number);
-
-               /*
-                * If anyone was waiting for message queue entries to become
-                * available, wake them up.
-                */
-               if (atomic_read(&ch->n_on_msg_allocate_wq) > 0)
-                       wake_up(&ch->msg_allocate_wq);
-       }
-
-       /*
-        * Now check for newly sent messages by the other side. (The remote
-        * PUT value will have changed since we last looked at it.)
-        */
-
-       if (ch->w_remote_GP.put != ch->remote_GP.put) {
-               /*
-                * Clear msg->flags in previously received messages, so that
-                * they're ready for xpc_get_deliverable_msg().
-                */
-               xpc_clear_remote_msgqueue_flags(ch);
-
-               ch->w_remote_GP.put = ch->remote_GP.put;
-
-               dev_dbg(xpc_chan, "w_remote_GP.put changed to %ld, partid=%d, "
-                       "channel=%d\n", ch->w_remote_GP.put, ch->partid,
-                       ch->number);
-
-               nmsgs_sent = ch->w_remote_GP.put - ch->w_local_GP.get;
-               if (nmsgs_sent > 0) {
-                       dev_dbg(xpc_chan, "msgs waiting to be copied and "
-                               "delivered=%d, partid=%d, channel=%d\n",
-                               nmsgs_sent, ch->partid, ch->number);
-
-                       if (ch->flags & XPC_C_CONNECTEDCALLOUT_MADE)
-                               xpc_activate_kthreads(ch, nmsgs_sent);
-               }
-       }
-
-       xpc_msgqueue_deref(ch);
-}
-
-void
-xpc_process_channel_activity(struct xpc_partition *part)
-{
-       unsigned long irq_flags;
-       u64 IPI_amo, IPI_flags;
-       struct xpc_channel *ch;
-       int ch_number;
-       u32 ch_flags;
-
-       IPI_amo = xpc_get_IPI_flags(part);
+       chctl.all_flags = xpc_get_chctl_all_flags(part);
 
        /*
         * Initiate channel connections for registered channels.
@@ -1281,14 +536,14 @@ xpc_process_channel_activity(struct xpc_partition *part)
                ch = &part->channels[ch_number];
 
                /*
-                * Process any open or close related IPI flags, and then deal
+                * Process any open or close related chctl flags, and then deal
                 * with connecting or disconnecting the channel as required.
                 */
 
-               IPI_flags = XPC_GET_IPI_FLAGS(IPI_amo, ch_number);
-
-               if (XPC_ANY_OPENCLOSE_IPI_FLAGS_SET(IPI_flags))
-                       xpc_process_openclose_IPI(part, ch_number, IPI_flags);
+               if (chctl.flags[ch_number] & XPC_OPENCLOSE_CHCTL_FLAGS) {
+                       xpc_process_openclose_chctl_flags(part, ch_number,
+                                                       chctl.flags[ch_number]);
+               }
 
                ch_flags = ch->flags;   /* need an atomic snapshot of flags */
 
@@ -1299,7 +554,7 @@ xpc_process_channel_activity(struct xpc_partition *part)
                        continue;
                }
 
-               if (part->act_state == XPC_P_DEACTIVATING)
+               if (part->act_state == XPC_P_AS_DEACTIVATING)
                        continue;
 
                if (!(ch_flags & XPC_C_CONNECTED)) {
@@ -1315,13 +570,13 @@ xpc_process_channel_activity(struct xpc_partition *part)
                }
 
                /*
-                * Process any message related IPI flags, this may involve the
-                * activation of kthreads to deliver any pending messages sent
-                * from the other partition.
+                * Process any message related chctl flags, this may involve
+                * the activation of kthreads to deliver any pending messages
+                * sent from the other partition.
                 */
 
-               if (XPC_ANY_MSG_IPI_FLAGS_SET(IPI_flags))
-                       xpc_process_msg_IPI(part, ch_number);
+               if (chctl.flags[ch_number] & XPC_MSG_CHCTL_FLAGS)
+                       xpc_process_msg_chctl_flags(part, ch_number);
        }
 }
 
@@ -1368,59 +623,6 @@ xpc_partition_going_down(struct xpc_partition *part, enum xp_retval reason)
        xpc_part_deref(part);
 }
 
-/*
- * Teardown the infrastructure necessary to support XPartition Communication
- * between the specified remote partition and the local one.
- */
-void
-xpc_teardown_infrastructure(struct xpc_partition *part)
-{
-       short partid = XPC_PARTID(part);
-
-       /*
-        * We start off by making this partition inaccessible to local
-        * processes by marking it as no longer setup. Then we make it
-        * inaccessible to remote processes by clearing the XPC per partition
-        * specific variable's magic # (which indicates that these variables
-        * are no longer valid) and by ignoring all XPC notify IPIs sent to
-        * this partition.
-        */
-
-       DBUG_ON(atomic_read(&part->nchannels_engaged) != 0);
-       DBUG_ON(atomic_read(&part->nchannels_active) != 0);
-       DBUG_ON(part->setup_state != XPC_P_SETUP);
-       part->setup_state = XPC_P_WTEARDOWN;
-
-       xpc_vars_part[partid].magic = 0;
-
-       free_irq(SGI_XPC_NOTIFY, (void *)(u64)partid);
-
-       /*
-        * Before proceeding with the teardown we have to wait until all
-        * existing references cease.
-        */
-       wait_event(part->teardown_wq, (atomic_read(&part->references) == 0));
-
-       /* now we can begin tearing down the infrastructure */
-
-       part->setup_state = XPC_P_TORNDOWN;
-
-       /* in case we've still got outstanding timers registered... */
-       del_timer_sync(&part->dropped_IPI_timer);
-
-       kfree(part->remote_openclose_args_base);
-       part->remote_openclose_args = NULL;
-       kfree(part->local_openclose_args_base);
-       part->local_openclose_args = NULL;
-       kfree(part->remote_GPs_base);
-       part->remote_GPs = NULL;
-       kfree(part->local_GPs_base);
-       part->local_GPs = NULL;
-       kfree(part->channels);
-       part->channels = NULL;
-       part->local_IPI_amo_va = NULL;
-}
-
 /*
  * Called by XP at the time of channel connection registration to cause
  * XPC to establish connections to all currently active partitions.
@@ -1432,9 +634,9 @@ xpc_initiate_connect(int ch_number)
        struct xpc_partition *part;
        struct xpc_channel *ch;
 
-       DBUG_ON(ch_number < 0 || ch_number >= XPC_NCHANNELS);
+       DBUG_ON(ch_number < 0 || ch_number >= XPC_MAX_NCHANNELS);
 
-       for (partid = 1; partid < XP_MAX_PARTITIONS; partid++) {
+       for (partid = 0; partid < xp_max_npartitions; partid++) {
                part = &xpc_partitions[partid];
 
                if (xpc_part_ref(part)) {
@@ -1488,10 +690,10 @@ xpc_initiate_disconnect(int ch_number)
        struct xpc_partition *part;
        struct xpc_channel *ch;
 
-       DBUG_ON(ch_number < 0 || ch_number >= XPC_NCHANNELS);
+       DBUG_ON(ch_number < 0 || ch_number >= XPC_MAX_NCHANNELS);
 
        /* initiate the channel disconnect for every active partition */
-       for (partid = 1; partid < XP_MAX_PARTITIONS; partid++) {
+       for (partid = 0; partid < xp_max_npartitions; partid++) {
                part = &xpc_partitions[partid];
 
                if (xpc_part_ref(part)) {
@@ -1550,7 +752,7 @@ xpc_disconnect_channel(const int line, struct xpc_channel *ch,
                       XPC_C_ROPENREQUEST | XPC_C_ROPENREPLY |
                       XPC_C_CONNECTING | XPC_C_CONNECTED);
 
-       xpc_IPI_send_closerequest(ch, irq_flags);
+       xpc_send_chctl_closerequest(ch, irq_flags);
 
        if (channel_was_connected)
                ch->flags |= XPC_C_WASCONNECTED;
@@ -1598,7 +800,7 @@ xpc_disconnect_callout(struct xpc_channel *ch, enum xp_retval reason)
  * Wait for a message entry to become available for the specified channel,
  * but don't wait any longer than 1 jiffy.
  */
-static enum xp_retval
+enum xp_retval
 xpc_allocate_msg_wait(struct xpc_channel *ch)
 {
        enum xp_retval ret;
@@ -1625,315 +827,54 @@ xpc_allocate_msg_wait(struct xpc_channel *ch)
 }
 
 /*
- * Allocate an entry for a message from the message queue associated with the
- * specified channel.
- */
-static enum xp_retval
-xpc_allocate_msg(struct xpc_channel *ch, u32 flags,
-                struct xpc_msg **address_of_msg)
-{
-       struct xpc_msg *msg;
-       enum xp_retval ret;
-       s64 put;
-
-       /* this reference will be dropped in xpc_send_msg() */
-       xpc_msgqueue_ref(ch);
-
-       if (ch->flags & XPC_C_DISCONNECTING) {
-               xpc_msgqueue_deref(ch);
-               return ch->reason;
-       }
-       if (!(ch->flags & XPC_C_CONNECTED)) {
-               xpc_msgqueue_deref(ch);
-               return xpNotConnected;
-       }
-
-       /*
-        * Get the next available message entry from the local message queue.
-        * If none are available, we'll make sure that we grab the latest
-        * GP values.
-        */
-       ret = xpTimeout;
-
-       while (1) {
-
-               put = ch->w_local_GP.put;
-               rmb();  /* guarantee that .put loads before .get */
-               if (put - ch->w_remote_GP.get < ch->local_nentries) {
-
-                       /* There are available message entries. We need to try
-                        * to secure one for ourselves. We'll do this by trying
-                        * to increment w_local_GP.put as long as someone else
-                        * doesn't beat us to it. If they do, we'll have to
-                        * try again.
-                        */
-                       if (cmpxchg(&ch->w_local_GP.put, put, put + 1) == put) {
-                               /* we got the entry referenced by put */
-                               break;
-                       }
-                       continue;       /* try again */
-               }
-
-               /*
-                * There aren't any available msg entries at this time.
-                *
-                * In waiting for a message entry to become available,
-                * we set a timeout in case the other side is not
-                * sending completion IPIs. This lets us fake an IPI
-                * that will cause the IPI handler to fetch the latest
-                * GP values as if an IPI was sent by the other side.
-                */
-               if (ret == xpTimeout)
-                       xpc_IPI_send_local_msgrequest(ch);
-
-               if (flags & XPC_NOWAIT) {
-                       xpc_msgqueue_deref(ch);
-                       return xpNoWait;
-               }
-
-               ret = xpc_allocate_msg_wait(ch);
-               if (ret != xpInterrupted && ret != xpTimeout) {
-                       xpc_msgqueue_deref(ch);
-                       return ret;
-               }
-       }
-
-       /* get the message's address and initialize it */
-       msg = (struct xpc_msg *)((u64)ch->local_msgqueue +
-                                (put % ch->local_nentries) * ch->msg_size);
-
-       DBUG_ON(msg->flags != 0);
-       msg->number = put;
-
-       dev_dbg(xpc_chan, "w_local_GP.put changed to %ld; msg=0x%p, "
-               "msg_number=%ld, partid=%d, channel=%d\n", put + 1,
-               (void *)msg, msg->number, ch->partid, ch->number);
-
-       *address_of_msg = msg;
-
-       return xpSuccess;
-}
-
-/*
- * Allocate an entry for a message from the message queue associated with the
- * specified channel. NOTE that this routine can sleep waiting for a message
- * entry to become available. To not sleep, pass in the XPC_NOWAIT flag.
- *
- * Arguments:
- *
- *     partid - ID of partition to which the channel is connected.
- *     ch_number - channel #.
- *     flags - see xpc.h for valid flags.
- *     payload - address of the allocated payload area pointer (filled in on
- *               return) in which the user-defined message is constructed.
- */
-enum xp_retval
-xpc_initiate_allocate(short partid, int ch_number, u32 flags, void **payload)
-{
-       struct xpc_partition *part = &xpc_partitions[partid];
-       enum xp_retval ret = xpUnknownReason;
-       struct xpc_msg *msg = NULL;
-
-       DBUG_ON(partid <= 0 || partid >= XP_MAX_PARTITIONS);
-       DBUG_ON(ch_number < 0 || ch_number >= part->nchannels);
-
-       *payload = NULL;
-
-       if (xpc_part_ref(part)) {
-               ret = xpc_allocate_msg(&part->channels[ch_number], flags, &msg);
-               xpc_part_deref(part);
-
-               if (msg != NULL)
-                       *payload = &msg->payload;
-       }
-
-       return ret;
-}
-
-/*
- * Now we actually send the messages that are ready to be sent by advancing
- * the local message queue's Put value and then send an IPI to the recipient
- * partition.
- */
-static void
-xpc_send_msgs(struct xpc_channel *ch, s64 initial_put)
-{
-       struct xpc_msg *msg;
-       s64 put = initial_put + 1;
-       int send_IPI = 0;
-
-       while (1) {
-
-               while (1) {
-                       if (put == ch->w_local_GP.put)
-                               break;
-
-                       msg = (struct xpc_msg *)((u64)ch->local_msgqueue +
-                                                (put % ch->local_nentries) *
-                                                ch->msg_size);
-
-                       if (!(msg->flags & XPC_M_READY))
-                               break;
-
-                       put++;
-               }
-
-               if (put == initial_put) {
-                       /* nothing's changed */
-                       break;
-               }
-
-               if (cmpxchg_rel(&ch->local_GP->put, initial_put, put) !=
-                   initial_put) {
-                       /* someone else beat us to it */
-                       DBUG_ON(ch->local_GP->put < initial_put);
-                       break;
-               }
-
-               /* we just set the new value of local_GP->put */
-
-               dev_dbg(xpc_chan, "local_GP->put changed to %ld, partid=%d, "
-                       "channel=%d\n", put, ch->partid, ch->number);
-
-               send_IPI = 1;
-
-               /*
-                * We need to ensure that the message referenced by
-                * local_GP->put is not XPC_M_READY or that local_GP->put
-                * equals w_local_GP.put, so we'll go have a look.
-                */
-               initial_put = put;
-       }
-
-       if (send_IPI)
-               xpc_IPI_send_msgrequest(ch);
-}
-
-/*
- * Common code that does the actual sending of the message by advancing the
- * local message queue's Put value and sends an IPI to the partition the
- * message is being sent to.
- */
-static enum xp_retval
-xpc_send_msg(struct xpc_channel *ch, struct xpc_msg *msg, u8 notify_type,
-            xpc_notify_func func, void *key)
-{
-       enum xp_retval ret = xpSuccess;
-       struct xpc_notify *notify = notify;
-       s64 put, msg_number = msg->number;
-
-       DBUG_ON(notify_type == XPC_N_CALL && func == NULL);
-       DBUG_ON((((u64)msg - (u64)ch->local_msgqueue) / ch->msg_size) !=
-               msg_number % ch->local_nentries);
-       DBUG_ON(msg->flags & XPC_M_READY);
-
-       if (ch->flags & XPC_C_DISCONNECTING) {
-               /* drop the reference grabbed in xpc_allocate_msg() */
-               xpc_msgqueue_deref(ch);
-               return ch->reason;
-       }
-
-       if (notify_type != 0) {
-               /*
-                * Tell the remote side to send an ACK interrupt when the
-                * message has been delivered.
-                */
-               msg->flags |= XPC_M_INTERRUPT;
-
-               atomic_inc(&ch->n_to_notify);
-
-               notify = &ch->notify_queue[msg_number % ch->local_nentries];
-               notify->func = func;
-               notify->key = key;
-               notify->type = notify_type;
-
-               /* >>> is a mb() needed here? */
-
-               if (ch->flags & XPC_C_DISCONNECTING) {
-                       /*
-                        * An error occurred between our last error check and
-                        * this one. We will try to clear the type field from
-                        * the notify entry. If we succeed then
-                        * xpc_disconnect_channel() didn't already process
-                        * the notify entry.
-                        */
-                       if (cmpxchg(&notify->type, notify_type, 0) ==
-                           notify_type) {
-                               atomic_dec(&ch->n_to_notify);
-                               ret = ch->reason;
-                       }
-
-                       /* drop the reference grabbed in xpc_allocate_msg() */
-                       xpc_msgqueue_deref(ch);
-                       return ret;
-               }
-       }
-
-       msg->flags |= XPC_M_READY;
-
-       /*
-        * The preceding store of msg->flags must occur before the following
-        * load of ch->local_GP->put.
-        */
-       mb();
-
-       /* see if the message is next in line to be sent, if so send it */
-
-       put = ch->local_GP->put;
-       if (put == msg_number)
-               xpc_send_msgs(ch, put);
-
-       /* drop the reference grabbed in xpc_allocate_msg() */
-       xpc_msgqueue_deref(ch);
-       return ret;
-}
-
-/*
- * Send a message previously allocated using xpc_initiate_allocate() on the
- * specified channel connected to the specified partition.
+ * Send a message that contains the user's payload on the specified channel
+ * connected to the specified partition.
  *
- * This routine will not wait for the message to be received, nor will
- * notification be given when it does happen. Once this routine has returned
- * the message entry allocated via xpc_initiate_allocate() is no longer
- * accessable to the caller.
+ * NOTE that this routine can sleep waiting for a message entry to become
+ * available. To not sleep, pass in the XPC_NOWAIT flag.
  *
- * This routine, although called by users, does not call xpc_part_ref() to
- * ensure that the partition infrastructure is in place. It relies on the
- * fact that we called xpc_msgqueue_ref() in xpc_allocate_msg().
+ * Once sent, this routine will not wait for the message to be received, nor
+ * will notification be given when it does happen.
  *
  * Arguments:
  *
  *     partid - ID of partition to which the channel is connected.
  *     ch_number - channel # to send message on.
- *     payload - pointer to the payload area allocated via
- *                     xpc_initiate_allocate().
+ *     flags - see xp.h for valid flags.
+ *     payload - pointer to the payload which is to be sent.
+ *     payload_size - size of the payload in bytes.
  */
 enum xp_retval
-xpc_initiate_send(short partid, int ch_number, void *payload)
+xpc_initiate_send(short partid, int ch_number, u32 flags, void *payload,
+                 u16 payload_size)
 {
        struct xpc_partition *part = &xpc_partitions[partid];
-       struct xpc_msg *msg = XPC_MSG_ADDRESS(payload);
-       enum xp_retval ret;
+       enum xp_retval ret = xpUnknownReason;
 
-       dev_dbg(xpc_chan, "msg=0x%p, partid=%d, channel=%d\n", (void *)msg,
+       dev_dbg(xpc_chan, "payload=0x%p, partid=%d, channel=%d\n", payload,
                partid, ch_number);
 
-       DBUG_ON(partid <= 0 || partid >= XP_MAX_PARTITIONS);
+       DBUG_ON(partid < 0 || partid >= xp_max_npartitions);
        DBUG_ON(ch_number < 0 || ch_number >= part->nchannels);
-       DBUG_ON(msg == NULL);
+       DBUG_ON(payload == NULL);
 
-       ret = xpc_send_msg(&part->channels[ch_number], msg, 0, NULL, NULL);
+       if (xpc_part_ref(part)) {
+               ret = xpc_send_payload(&part->channels[ch_number], flags,
+                                      payload, payload_size, 0, NULL, NULL);
+               xpc_part_deref(part);
+       }
 
        return ret;
 }
 
 /*
- * Send a message previously allocated using xpc_initiate_allocate on the
- * specified channel connected to the specified partition.
+ * Send a message that contains the user's payload on the specified channel
+ * connected to the specified partition.
+ *
+ * NOTE that this routine can sleep waiting for a message entry to become
+ * available. To not sleep, pass in the XPC_NOWAIT flag.
  *
- * This routine will not wait for the message to be sent. Once this routine
- * has returned the message entry allocated via xpc_initiate_allocate() is no
- * longer accessable to the caller.
+ * This routine will not wait for the message to be sent or received.
  *
  * Once the remote end of the channel has received the message, the function
  * passed as an argument to xpc_initiate_send_notify() will be called. This
@@ -1943,158 +884,51 @@ xpc_initiate_send(short partid, int ch_number, void *payload)
  *
  * If this routine returns an error, the caller's function will NOT be called.
  *
- * This routine, although called by users, does not call xpc_part_ref() to
- * ensure that the partition infrastructure is in place. It relies on the
- * fact that we called xpc_msgqueue_ref() in xpc_allocate_msg().
- *
  * Arguments:
  *
  *     partid - ID of partition to which the channel is connected.
  *     ch_number - channel # to send message on.
- *     payload - pointer to the payload area allocated via
- *                     xpc_initiate_allocate().
+ *     flags - see xp.h for valid flags.
+ *     payload - pointer to the payload which is to be sent.
+ *     payload_size - size of the payload in bytes.
  *     func - function to call with asynchronous notification of message
  *               receipt. THIS FUNCTION MUST BE NON-BLOCKING.
  *     key - user-defined key to be passed to the function when it's called.
  */
 enum xp_retval
-xpc_initiate_send_notify(short partid, int ch_number, void *payload,
-                        xpc_notify_func func, void *key)
+xpc_initiate_send_notify(short partid, int ch_number, u32 flags, void *payload,
+                        u16 payload_size, xpc_notify_func func, void *key)
 {
        struct xpc_partition *part = &xpc_partitions[partid];
-       struct xpc_msg *msg = XPC_MSG_ADDRESS(payload);
-       enum xp_retval ret;
+       enum xp_retval ret = xpUnknownReason;
 
-       dev_dbg(xpc_chan, "msg=0x%p, partid=%d, channel=%d\n", (void *)msg,
+       dev_dbg(xpc_chan, "payload=0x%p, partid=%d, channel=%d\n", payload,
                partid, ch_number);
 
-       DBUG_ON(partid <= 0 || partid >= XP_MAX_PARTITIONS);
+       DBUG_ON(partid < 0 || partid >= xp_max_npartitions);
        DBUG_ON(ch_number < 0 || ch_number >= part->nchannels);
-       DBUG_ON(msg == NULL);
+       DBUG_ON(payload == NULL);
        DBUG_ON(func == NULL);
 
-       ret = xpc_send_msg(&part->channels[ch_number], msg, XPC_N_CALL,
-                          func, key);
-       return ret;
-}
-
-static struct xpc_msg *
-xpc_pull_remote_msg(struct xpc_channel *ch, s64 get)
-{
-       struct xpc_partition *part = &xpc_partitions[ch->partid];
-       struct xpc_msg *remote_msg, *msg;
-       u32 msg_index, nmsgs;
-       u64 msg_offset;
-       enum xp_retval ret;
-
-       if (mutex_lock_interruptible(&ch->msg_to_pull_mutex) != 0) {
-               /* we were interrupted by a signal */
-               return NULL;
-       }
-
-       while (get >= ch->next_msg_to_pull) {
-
-               /* pull as many messages as are ready and able to be pulled */
-
-               msg_index = ch->next_msg_to_pull % ch->remote_nentries;
-
-               DBUG_ON(ch->next_msg_to_pull >= ch->w_remote_GP.put);
-               nmsgs = ch->w_remote_GP.put - ch->next_msg_to_pull;
-               if (msg_index + nmsgs > ch->remote_nentries) {
-                       /* ignore the ones that wrap the msg queue for now */
-                       nmsgs = ch->remote_nentries - msg_index;
-               }
-
-               msg_offset = msg_index * ch->msg_size;
-               msg = (struct xpc_msg *)((u64)ch->remote_msgqueue + msg_offset);
-               remote_msg = (struct xpc_msg *)(ch->remote_msgqueue_pa +
-                                               msg_offset);
-
-               ret = xpc_pull_remote_cachelines(part, msg, remote_msg,
-                                                nmsgs * ch->msg_size);
-               if (ret != xpSuccess) {
-
-                       dev_dbg(xpc_chan, "failed to pull %d msgs starting with"
-                               " msg %ld from partition %d, channel=%d, "
-                               "ret=%d\n", nmsgs, ch->next_msg_to_pull,
-                               ch->partid, ch->number, ret);
-
-                       XPC_DEACTIVATE_PARTITION(part, ret);
-
-                       mutex_unlock(&ch->msg_to_pull_mutex);
-                       return NULL;
-               }
-
-               ch->next_msg_to_pull += nmsgs;
+       if (xpc_part_ref(part)) {
+               ret = xpc_send_payload(&part->channels[ch_number], flags,
+                                      payload, payload_size, XPC_N_CALL, func,
+                                      key);
+               xpc_part_deref(part);
        }
-
-       mutex_unlock(&ch->msg_to_pull_mutex);
-
-       /* return the message we were looking for */
-       msg_offset = (get % ch->remote_nentries) * ch->msg_size;
-       msg = (struct xpc_msg *)((u64)ch->remote_msgqueue + msg_offset);
-
-       return msg;
-}
-
-/*
- * Get a message to be delivered.
- */
-static struct xpc_msg *
-xpc_get_deliverable_msg(struct xpc_channel *ch)
-{
-       struct xpc_msg *msg = NULL;
-       s64 get;
-
-       do {
-               if (ch->flags & XPC_C_DISCONNECTING)
-                       break;
-
-               get = ch->w_local_GP.get;
-               rmb();  /* guarantee that .get loads before .put */
-               if (get == ch->w_remote_GP.put)
-                       break;
-
-               /* There are messages waiting to be pulled and delivered.
-                * We need to try to secure one for ourselves. We'll do this
-                * by trying to increment w_local_GP.get and hope that no one
-                * else beats us to it. If they do, we'll we'll simply have
-                * to try again for the next one.
-                */
-
-               if (cmpxchg(&ch->w_local_GP.get, get, get + 1) == get) {
-                       /* we got the entry referenced by get */
-
-                       dev_dbg(xpc_chan, "w_local_GP.get changed to %ld, "
-                               "partid=%d, channel=%d\n", get + 1,
-                               ch->partid, ch->number);
-
-                       /* pull the message from the remote partition */
-
-                       msg = xpc_pull_remote_msg(ch, get);
-
-                       DBUG_ON(msg != NULL && msg->number != get);
-                       DBUG_ON(msg != NULL && (msg->flags & XPC_M_DONE));
-                       DBUG_ON(msg != NULL && !(msg->flags & XPC_M_READY));
-
-                       break;
-               }
-
-       } while (1);
-
-       return msg;
+       return ret;
 }
 
 /*
- * Deliver a message to its intended recipient.
+ * Deliver a message's payload to its intended recipient.
  */
 void
-xpc_deliver_msg(struct xpc_channel *ch)
+xpc_deliver_payload(struct xpc_channel *ch)
 {
-       struct xpc_msg *msg;
+       void *payload;
 
-       msg = xpc_get_deliverable_msg(ch);
-       if (msg != NULL) {
+       payload = xpc_get_deliverable_payload(ch);
+       if (payload != NULL) {
 
                /*
                 * This ref is taken to protect the payload itself from being
@@ -2106,18 +940,16 @@ xpc_deliver_msg(struct xpc_channel *ch)
                atomic_inc(&ch->kthreads_active);
 
                if (ch->func != NULL) {
-                       dev_dbg(xpc_chan, "ch->func() called, msg=0x%p, "
-                               "msg_number=%ld, partid=%d, channel=%d\n",
-                               (void *)msg, msg->number, ch->partid,
+                       dev_dbg(xpc_chan, "ch->func() called, payload=0x%p "
+                               "partid=%d channel=%d\n", payload, ch->partid,
                                ch->number);
 
                        /* deliver the message to its intended recipient */
-                       ch->func(xpMsgReceived, ch->partid, ch->number,
-                                &msg->payload, ch->key);
+                       ch->func(xpMsgReceived, ch->partid, ch->number, payload,
+                                ch->key);
 
-                       dev_dbg(xpc_chan, "ch->func() returned, msg=0x%p, "
-                               "msg_number=%ld, partid=%d, channel=%d\n",
-                               (void *)msg, msg->number, ch->partid,
+                       dev_dbg(xpc_chan, "ch->func() returned, payload=0x%p "
+                               "partid=%d channel=%d\n", payload, ch->partid,
                                ch->number);
                }
 
@@ -2126,118 +958,31 @@ xpc_deliver_msg(struct xpc_channel *ch)
 }
 
 /*
- * Now we actually acknowledge the messages that have been delivered and ack'd
- * by advancing the cached remote message queue's Get value and if requested
- * send an IPI to the message sender's partition.
- */
-static void
-xpc_acknowledge_msgs(struct xpc_channel *ch, s64 initial_get, u8 msg_flags)
-{
-       struct xpc_msg *msg;
-       s64 get = initial_get + 1;
-       int send_IPI = 0;
-
-       while (1) {
-
-               while (1) {
-                       if (get == ch->w_local_GP.get)
-                               break;
-
-                       msg = (struct xpc_msg *)((u64)ch->remote_msgqueue +
-                                                (get % ch->remote_nentries) *
-                                                ch->msg_size);
-
-                       if (!(msg->flags & XPC_M_DONE))
-                               break;
-
-                       msg_flags |= msg->flags;
-                       get++;
-               }
-
-               if (get == initial_get) {
-                       /* nothing's changed */
-                       break;
-               }
-
-               if (cmpxchg_rel(&ch->local_GP->get, initial_get, get) !=
-                   initial_get) {
-                       /* someone else beat us to it */
-                       DBUG_ON(ch->local_GP->get <= initial_get);
-                       break;
-               }
-
-               /* we just set the new value of local_GP->get */
-
-               dev_dbg(xpc_chan, "local_GP->get changed to %ld, partid=%d, "
-                       "channel=%d\n", get, ch->partid, ch->number);
-
-               send_IPI = (msg_flags & XPC_M_INTERRUPT);
-
-               /*
-                * We need to ensure that the message referenced by
-                * local_GP->get is not XPC_M_DONE or that local_GP->get
-                * equals w_local_GP.get, so we'll go have a look.
-                */
-               initial_get = get;
-       }
-
-       if (send_IPI)
-               xpc_IPI_send_msgrequest(ch);
-}
-
-/*
- * Acknowledge receipt of a delivered message.
- *
- * If a message has XPC_M_INTERRUPT set, send an interrupt to the partition
- * that sent the message.
+ * Acknowledge receipt of a delivered message's payload.
  *
  * This function, although called by users, does not call xpc_part_ref() to
  * ensure that the partition infrastructure is in place. It relies on the
- * fact that we called xpc_msgqueue_ref() in xpc_deliver_msg().
+ * fact that we called xpc_msgqueue_ref() in xpc_deliver_payload().
  *
  * Arguments:
  *
  *     partid - ID of partition to which the channel is connected.
  *     ch_number - channel # message received on.
  *     payload - pointer to the payload area allocated via
- *                     xpc_initiate_allocate().
+ *                     xpc_initiate_send() or xpc_initiate_send_notify().
  */
 void
 xpc_initiate_received(short partid, int ch_number, void *payload)
 {
        struct xpc_partition *part = &xpc_partitions[partid];
        struct xpc_channel *ch;
-       struct xpc_msg *msg = XPC_MSG_ADDRESS(payload);
-       s64 get, msg_number = msg->number;
 
-       DBUG_ON(partid <= 0 || partid >= XP_MAX_PARTITIONS);
+       DBUG_ON(partid < 0 || partid >= xp_max_npartitions);
        DBUG_ON(ch_number < 0 || ch_number >= part->nchannels);
 
        ch = &part->channels[ch_number];
+       xpc_received_payload(ch, payload);
 
-       dev_dbg(xpc_chan, "msg=0x%p, msg_number=%ld, partid=%d, channel=%d\n",
-               (void *)msg, msg_number, ch->partid, ch->number);
-
-       DBUG_ON((((u64)msg - (u64)ch->remote_msgqueue) / ch->msg_size) !=
-               msg_number % ch->remote_nentries);
-       DBUG_ON(msg->flags & XPC_M_DONE);
-
-       msg->flags |= XPC_M_DONE;
-
-       /*
-        * The preceding store of msg->flags must occur before the following
-        * load of ch->local_GP->get.
-        */
-       mb();
-
-       /*
-        * See if this message is next in line to be acknowledged as having
-        * been delivered.
-        */
-       get = ch->local_GP->get;
-       if (get == msg_number)
-               xpc_acknowledge_msgs(ch, get, msg->flags);
-
-       /* the call to xpc_msgqueue_ref() was done by xpc_deliver_msg()  */
+       /* the call to xpc_msgqueue_ref() was done by xpc_deliver_payload()  */
        xpc_msgqueue_deref(ch);
 }
index c3b4227..46325fc 100644 (file)
  *
  *     Caveats:
  *
- *       . We currently have no way to determine which nasid an IPI came
- *         from. Thus, xpc_IPI_send() does a remote AMO write followed by
- *         an IPI. The AMO indicates where data is to be pulled from, so
- *         after the IPI arrives, the remote partition checks the AMO word.
- *         The IPI can actually arrive before the AMO however, so other code
- *         must periodically check for this case. Also, remote AMO operations
- *         do not reliably time out. Thus we do a remote PIO read solely to
- *         know whether the remote partition is down and whether we should
- *         stop sending IPIs to it. This remote PIO read operation is set up
- *         in a special nofault region so SAL knows to ignore (and cleanup)
- *         any errors due to the remote AMO write, PIO read, and/or PIO
- *         write operations.
+ *       . Currently on sn2, we have no way to determine which nasid an IRQ
+ *         came from. Thus, xpc_send_IRQ_sn2() does a remote amo write
+ *         followed by an IPI. The amo indicates where data is to be pulled
+ *         from, so after the IPI arrives, the remote partition checks the amo
+ *         word. The IPI can actually arrive before the amo however, so other
+ *         code must periodically check for this case. Also, remote amo
+ *         operations do not reliably time out. Thus we do a remote PIO read
+ *         solely to know whether the remote partition is down and whether we
+ *         should stop sending IPIs to it. This remote PIO read operation is
+ *         set up in a special nofault region so SAL knows to ignore (and
+ *         cleanup) any errors due to the remote amo write, PIO read, and/or
+ *         PIO write operations.
  *
  *         If/when new hardware solves this IPI problem, we should abandon
  *         the current approach.
  *
  */
 
-#include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/init.h>
-#include <linux/cache.h>
-#include <linux/interrupt.h>
+#include <linux/sysctl.h>
+#include <linux/device.h>
 #include <linux/delay.h>
 #include <linux/reboot.h>
-#include <linux/completion.h>
 #include <linux/kdebug.h>
 #include <linux/kthread.h>
-#include <linux/uaccess.h>
-#include <asm/sn/intr.h>
-#include <asm/sn/sn_sal.h>
 #include "xpc.h"
 
 /* define two XPC debug device structures to be used with dev_dbg() et al */
@@ -89,9 +83,9 @@ static int xpc_hb_check_interval = XPC_HB_CHECK_DEFAULT_INTERVAL;
 static int xpc_hb_check_min_interval = 10;
 static int xpc_hb_check_max_interval = 120;
 
-int xpc_disengage_request_timelimit = XPC_DISENGAGE_REQUEST_DEFAULT_TIMELIMIT;
-static int xpc_disengage_request_min_timelimit;        /* = 0 */
-static int xpc_disengage_request_max_timelimit = 120;
+int xpc_disengage_timelimit = XPC_DISENGAGE_DEFAULT_TIMELIMIT;
+static int xpc_disengage_min_timelimit;        /* = 0 */
+static int xpc_disengage_max_timelimit = 120;
 
 static ctl_table xpc_sys_xpc_hb_dir[] = {
        {
@@ -124,14 +118,14 @@ static ctl_table xpc_sys_xpc_dir[] = {
         .child = xpc_sys_xpc_hb_dir},
        {
         .ctl_name = CTL_UNNUMBERED,
-        .procname = "disengage_request_timelimit",
-        .data = &xpc_disengage_request_timelimit,
+        .procname = "disengage_timelimit",
+        .data = &xpc_disengage_timelimit,
         .maxlen = sizeof(int),
         .mode = 0644,
         .proc_handler = &proc_dointvec_minmax,
         .strategy = &sysctl_intvec,
-        .extra1 = &xpc_disengage_request_min_timelimit,
-        .extra2 = &xpc_disengage_request_max_timelimit},
+        .extra1 = &xpc_disengage_min_timelimit,
+        .extra2 = &xpc_disengage_max_timelimit},
        {}
 };
 static ctl_table xpc_sys_dir[] = {
@@ -144,16 +138,19 @@ static ctl_table xpc_sys_dir[] = {
 };
 static struct ctl_table_header *xpc_sysctl;
 
-/* non-zero if any remote partition disengage request was timed out */
-int xpc_disengage_request_timedout;
+/* non-zero if any remote partition disengage was timed out */
+int xpc_disengage_timedout;
 
-/* #of IRQs received */
-static atomic_t xpc_act_IRQ_rcvd;
+/* #of activate IRQs received and not yet processed */
+int xpc_activate_IRQ_rcvd;
+DEFINE_SPINLOCK(xpc_activate_IRQ_rcvd_lock);
 
 /* IRQ handler notifies this wait queue on receipt of an IRQ */
-static DECLARE_WAIT_QUEUE_HEAD(xpc_act_IRQ_wq);
+DECLARE_WAIT_QUEUE_HEAD(xpc_activate_IRQ_wq);
 
 static unsigned long xpc_hb_check_timeout;
+static struct timer_list xpc_hb_timer;
+void *xpc_heartbeating_to_mask;
 
 /* notification that the xpc_hb_checker thread has exited */
 static DECLARE_COMPLETION(xpc_hb_checker_exited);
@@ -161,8 +158,6 @@ static DECLARE_COMPLETION(xpc_hb_checker_exited);
 /* notification that the xpc_discovery thread has exited */
 static DECLARE_COMPLETION(xpc_discovery_exited);
 
-static struct timer_list xpc_hb_timer;
-
 static void xpc_kthread_waitmsgs(struct xpc_partition *, struct xpc_channel *);
 
 static int xpc_system_reboot(struct notifier_block *, unsigned long, void *);
@@ -175,31 +170,76 @@ static struct notifier_block xpc_die_notifier = {
        .notifier_call = xpc_system_die,
 };
 
+int (*xpc_setup_partitions_sn) (void);
+enum xp_retval (*xpc_get_partition_rsvd_page_pa) (void *buf, u64 *cookie,
+                                                 unsigned long *rp_pa,
+                                                 size_t *len);
+int (*xpc_setup_rsvd_page_sn) (struct xpc_rsvd_page *rp);
+void (*xpc_heartbeat_init) (void);
+void (*xpc_heartbeat_exit) (void);
+void (*xpc_increment_heartbeat) (void);
+void (*xpc_offline_heartbeat) (void);
+void (*xpc_online_heartbeat) (void);
+enum xp_retval (*xpc_get_remote_heartbeat) (struct xpc_partition *part);
+
+enum xp_retval (*xpc_make_first_contact) (struct xpc_partition *part);
+void (*xpc_notify_senders_of_disconnect) (struct xpc_channel *ch);
+u64 (*xpc_get_chctl_all_flags) (struct xpc_partition *part);
+enum xp_retval (*xpc_setup_msg_structures) (struct xpc_channel *ch);
+void (*xpc_teardown_msg_structures) (struct xpc_channel *ch);
+void (*xpc_process_msg_chctl_flags) (struct xpc_partition *part, int ch_number);
+int (*xpc_n_of_deliverable_payloads) (struct xpc_channel *ch);
+void *(*xpc_get_deliverable_payload) (struct xpc_channel *ch);
+
+void (*xpc_request_partition_activation) (struct xpc_rsvd_page *remote_rp,
+                                         unsigned long remote_rp_pa,
+                                         int nasid);
+void (*xpc_request_partition_reactivation) (struct xpc_partition *part);
+void (*xpc_request_partition_deactivation) (struct xpc_partition *part);
+void (*xpc_cancel_partition_deactivation_request) (struct xpc_partition *part);
+
+void (*xpc_process_activate_IRQ_rcvd) (void);
+enum xp_retval (*xpc_setup_ch_structures_sn) (struct xpc_partition *part);
+void (*xpc_teardown_ch_structures_sn) (struct xpc_partition *part);
+
+void (*xpc_indicate_partition_engaged) (struct xpc_partition *part);
+int (*xpc_partition_engaged) (short partid);
+int (*xpc_any_partition_engaged) (void);
+void (*xpc_indicate_partition_disengaged) (struct xpc_partition *part);
+void (*xpc_assume_partition_disengaged) (short partid);
+
+void (*xpc_send_chctl_closerequest) (struct xpc_channel *ch,
+                                    unsigned long *irq_flags);
+void (*xpc_send_chctl_closereply) (struct xpc_channel *ch,
+                                  unsigned long *irq_flags);
+void (*xpc_send_chctl_openrequest) (struct xpc_channel *ch,
+                                   unsigned long *irq_flags);
+void (*xpc_send_chctl_openreply) (struct xpc_channel *ch,
+                                 unsigned long *irq_flags);
+
+void (*xpc_save_remote_msgqueue_pa) (struct xpc_channel *ch,
+                                    unsigned long msgqueue_pa);
+
+enum xp_retval (*xpc_send_payload) (struct xpc_channel *ch, u32 flags,
+                                   void *payload, u16 payload_size,
+                                   u8 notify_type, xpc_notify_func func,
+                                   void *key);
+void (*xpc_received_payload) (struct xpc_channel *ch, void *payload);
+
 /*
- * Timer function to enforce the timelimit on the partition disengage request.
+ * Timer function to enforce the timelimit on the partition disengage.
  */
 static void
-xpc_timeout_partition_disengage_request(unsigned long data)
+xpc_timeout_partition_disengage(unsigned long data)
 {
        struct xpc_partition *part = (struct xpc_partition *)data;
 
-       DBUG_ON(time_before(jiffies, part->disengage_request_timeout));
+       DBUG_ON(time_is_after_jiffies(part->disengage_timeout));
 
        (void)xpc_partition_disengaged(part);
 
-       DBUG_ON(part->disengage_request_timeout != 0);
-       DBUG_ON(xpc_partition_engaged(1UL << XPC_PARTID(part)) != 0);
-}
-
-/*
- * Notify the heartbeat check thread that an IRQ has been received.
- */
-static irqreturn_t
-xpc_act_IRQ_handler(int irq, void *dev_id)
-{
-       atomic_inc(&xpc_act_IRQ_rcvd);
-       wake_up_interruptible(&xpc_act_IRQ_wq);
-       return IRQ_HANDLED;
+       DBUG_ON(part->disengage_timeout != 0);
+       DBUG_ON(xpc_partition_engaged(XPC_PARTID(part)));
 }
 
 /*
@@ -210,15 +250,63 @@ xpc_act_IRQ_handler(int irq, void *dev_id)
 static void
 xpc_hb_beater(unsigned long dummy)
 {
-       xpc_vars->heartbeat++;
+       xpc_increment_heartbeat();
 
-       if (time_after_eq(jiffies, xpc_hb_check_timeout))
-               wake_up_interruptible(&xpc_act_IRQ_wq);
+       if (time_is_before_eq_jiffies(xpc_hb_check_timeout))
+               wake_up_interruptible(&xpc_activate_IRQ_wq);
 
        xpc_hb_timer.expires = jiffies + (xpc_hb_interval * HZ);
        add_timer(&xpc_hb_timer);
 }
 
+static void
+xpc_start_hb_beater(void)
+{
+       xpc_heartbeat_init();
+       init_timer(&xpc_hb_timer);
+       xpc_hb_timer.function = xpc_hb_beater;
+       xpc_hb_beater(0);
+}
+
+static void
+xpc_stop_hb_beater(void)
+{
+       del_timer_sync(&xpc_hb_timer);
+       xpc_heartbeat_exit();
+}
+
+/*
+ * At periodic intervals, scan through all active partitions and ensure
+ * their heartbeat is still active.  If not, the partition is deactivated.
+ */
+static void
+xpc_check_remote_hb(void)
+{
+       struct xpc_partition *part;
+       short partid;
+       enum xp_retval ret;
+
+       for (partid = 0; partid < xp_max_npartitions; partid++) {
+
+               if (xpc_exiting)
+                       break;
+
+               if (partid == xp_partition_id)
+                       continue;
+
+               part = &xpc_partitions[partid];
+
+               if (part->act_state == XPC_P_AS_INACTIVE ||
+                   part->act_state == XPC_P_AS_DEACTIVATING) {
+                       continue;
+               }
+
+               ret = xpc_get_remote_heartbeat(part);
+               if (ret != xpSuccess)
+                       XPC_DEACTIVATE_PARTITION(part, ret);
+       }
+}
+
 /*
  * This thread is responsible for nearly all of the partition
  * activation/deactivation.
@@ -226,8 +314,6 @@ xpc_hb_beater(unsigned long dummy)
 static int
 xpc_hb_checker(void *ignore)
 {
-       int last_IRQ_count = 0;
-       int new_IRQ_count;
        int force_IRQ = 0;
 
        /* this thread was marked active by xpc_hb_init() */
@@ -236,56 +322,49 @@ xpc_hb_checker(void *ignore)
 
        /* set our heartbeating to other partitions into motion */
        xpc_hb_check_timeout = jiffies + (xpc_hb_check_interval * HZ);
-       xpc_hb_beater(0);
+       xpc_start_hb_beater();
 
        while (!xpc_exiting) {
 
                dev_dbg(xpc_part, "woke up with %d ticks rem; %d IRQs have "
                        "been received\n",
                        (int)(xpc_hb_check_timeout - jiffies),
-                       atomic_read(&xpc_act_IRQ_rcvd) - last_IRQ_count);
+                       xpc_activate_IRQ_rcvd);
 
                /* checking of remote heartbeats is skewed by IRQ handling */
-               if (time_after_eq(jiffies, xpc_hb_check_timeout)) {
+               if (time_is_before_eq_jiffies(xpc_hb_check_timeout)) {
+                       xpc_hb_check_timeout = jiffies +
+                           (xpc_hb_check_interval * HZ);
+
                        dev_dbg(xpc_part, "checking remote heartbeats\n");
                        xpc_check_remote_hb();
 
                        /*
-                        * We need to periodically recheck to ensure no
-                        * IPI/AMO pairs have been missed.  That check
-                        * must always reset xpc_hb_check_timeout.
+                        * On sn2 we need to periodically recheck to ensure no
+                        * IRQ/amo pairs have been missed.
                         */
-                       force_IRQ = 1;
+                       if (is_shub())
+                               force_IRQ = 1;
                }
 
                /* check for outstanding IRQs */
-               new_IRQ_count = atomic_read(&xpc_act_IRQ_rcvd);
-               if (last_IRQ_count < new_IRQ_count || force_IRQ != 0) {
+               if (xpc_activate_IRQ_rcvd > 0 || force_IRQ != 0) {
                        force_IRQ = 0;
-
-                       dev_dbg(xpc_part, "found an IRQ to process; will be "
-                               "resetting xpc_hb_check_timeout\n");
-
-                       last_IRQ_count += xpc_identify_act_IRQ_sender();
-                       if (last_IRQ_count < new_IRQ_count) {
-                               /* retry once to help avoid missing AMO */
-                               (void)xpc_identify_act_IRQ_sender();
-                       }
-                       last_IRQ_count = new_IRQ_count;
-
-                       xpc_hb_check_timeout = jiffies +
-                           (xpc_hb_check_interval * HZ);
+                       dev_dbg(xpc_part, "processing activate IRQs "
+                               "received\n");
+                       xpc_process_activate_IRQ_rcvd();
                }
 
                /* wait for IRQ or timeout */
-               (void)wait_event_interruptible(xpc_act_IRQ_wq,
-                                              (last_IRQ_count <
-                                               atomic_read(&xpc_act_IRQ_rcvd)
-                                               || time_after_eq(jiffies,
-                                                       xpc_hb_check_timeout) ||
+               (void)wait_event_interruptible(xpc_activate_IRQ_wq,
+                                              (time_is_before_eq_jiffies(
+                                               xpc_hb_check_timeout) ||
+                                               xpc_activate_IRQ_rcvd > 0 ||
                                                xpc_exiting));
        }
 
+       xpc_stop_hb_beater();
+
        dev_dbg(xpc_part, "heartbeat checker is exiting\n");
 
        /* mark this thread as having exited */
@@ -310,38 +389,9 @@ xpc_initiate_discovery(void *ignore)
        return 0;
 }
 
-/*
- * Establish first contact with the remote partititon. This involves pulling
- * the XPC per partition variables from the remote partition and waiting for
- * the remote partition to pull ours.
- */
-static enum xp_retval
-xpc_make_first_contact(struct xpc_partition *part)
-{
-       enum xp_retval ret;
-
-       while ((ret = xpc_pull_remote_vars_part(part)) != xpSuccess) {
-               if (ret != xpRetry) {
-                       XPC_DEACTIVATE_PARTITION(part, ret);
-                       return ret;
-               }
-
-               dev_dbg(xpc_chan, "waiting to make first contact with "
-                       "partition %d\n", XPC_PARTID(part));
-
-               /* wait a 1/4 of a second or so */
-               (void)msleep_interruptible(250);
-
-               if (part->act_state == XPC_P_DEACTIVATING)
-                       return part->reason;
-       }
-
-       return xpc_mark_partition_active(part);
-}
-
 /*
  * The first kthread assigned to a newly activated partition is the one
- * created by XPC HB with which it calls xpc_partition_up(). XPC hangs on to
+ * created by XPC HB with which it calls xpc_activating(). XPC hangs on to
  * that kthread until the partition is brought down, at which time that kthread
  * returns back to XPC HB. (The return of that kthread will signify to XPC HB
  * that XPC has dismantled all communication infrastructure for the associated
@@ -354,11 +404,11 @@ xpc_make_first_contact(struct xpc_partition *part)
 static void
 xpc_channel_mgr(struct xpc_partition *part)
 {
-       while (part->act_state != XPC_P_DEACTIVATING ||
+       while (part->act_state != XPC_P_AS_DEACTIVATING ||
               atomic_read(&part->nchannels_active) > 0 ||
               !xpc_partition_disengaged(part)) {
 
-               xpc_process_channel_activity(part);
+               xpc_process_sent_chctl_flags(part);
 
                /*
                 * Wait until we've been requested to activate kthreads or
@@ -376,8 +426,8 @@ xpc_channel_mgr(struct xpc_partition *part)
                atomic_dec(&part->channel_mgr_requests);
                (void)wait_event_interruptible(part->channel_mgr_wq,
                                (atomic_read(&part->channel_mgr_requests) > 0 ||
-                                part->local_IPI_amo != 0 ||
-                                (part->act_state == XPC_P_DEACTIVATING &&
+                                part->chctl.all_flags != 0 ||
+                                (part->act_state == XPC_P_AS_DEACTIVATING &&
                                 atomic_read(&part->nchannels_active) == 0 &&
                                 xpc_partition_disengaged(part))));
                atomic_set(&part->channel_mgr_requests, 1);
@@ -385,47 +435,163 @@ xpc_channel_mgr(struct xpc_partition *part)
 }
 
 /*
- * When XPC HB determines that a partition has come up, it will create a new
- * kthread and that kthread will call this function to attempt to set up the
- * basic infrastructure used for Cross Partition Communication with the newly
- * upped partition.
- *
- * The kthread that was created by XPC HB and which setup the XPC
- * infrastructure will remain assigned to the partition until the partition
- * goes down. At which time the kthread will teardown the XPC infrastructure
- * and then exit.
- *
- * XPC HB will put the remote partition's XPC per partition specific variables
- * physical address into xpc_partitions[partid].remote_vars_part_pa prior to
- * calling xpc_partition_up().
+ * Guarantee that the kzalloc'd memory is cacheline aligned.
  */
-static void
-xpc_partition_up(struct xpc_partition *part)
+void *
+xpc_kzalloc_cacheline_aligned(size_t size, gfp_t flags, void **base)
+{
+       /* see if kzalloc will give us cachline aligned memory by default */
+       *base = kzalloc(size, flags);
+       if (*base == NULL)
+               return NULL;
+
+       if ((u64)*base == L1_CACHE_ALIGN((u64)*base))
+               return *base;
+
+       kfree(*base);
+
+       /* nope, we'll have to do it ourselves */
+       *base = kzalloc(size + L1_CACHE_BYTES, flags);
+       if (*base == NULL)
+               return NULL;
+
+       return (void *)L1_CACHE_ALIGN((u64)*base);
+}
+
+/*
+ * Setup the channel structures necessary to support XPartition Communication
+ * between the specified remote partition and the local one.
+ */
+static enum xp_retval
+xpc_setup_ch_structures(struct xpc_partition *part)
 {
+       enum xp_retval ret;
+       int ch_number;
+       struct xpc_channel *ch;
+       short partid = XPC_PARTID(part);
+
+       /*
+        * Allocate all of the channel structures as a contiguous chunk of
+        * memory.
+        */
        DBUG_ON(part->channels != NULL);
+       part->channels = kzalloc(sizeof(struct xpc_channel) * XPC_MAX_NCHANNELS,
+                                GFP_KERNEL);
+       if (part->channels == NULL) {
+               dev_err(xpc_chan, "can't get memory for channels\n");
+               return xpNoMemory;
+       }
 
-       dev_dbg(xpc_chan, "activating partition %d\n", XPC_PARTID(part));
+       /* allocate the remote open and close args */
 
-       if (xpc_setup_infrastructure(part) != xpSuccess)
-               return;
+       part->remote_openclose_args =
+           xpc_kzalloc_cacheline_aligned(XPC_OPENCLOSE_ARGS_SIZE,
+                                         GFP_KERNEL, &part->
+                                         remote_openclose_args_base);
+       if (part->remote_openclose_args == NULL) {
+               dev_err(xpc_chan, "can't get memory for remote connect args\n");
+               ret = xpNoMemory;
+               goto out_1;
+       }
+
+       part->chctl.all_flags = 0;
+       spin_lock_init(&part->chctl_lock);
+
+       atomic_set(&part->channel_mgr_requests, 1);
+       init_waitqueue_head(&part->channel_mgr_wq);
+
+       part->nchannels = XPC_MAX_NCHANNELS;
+
+       atomic_set(&part->nchannels_active, 0);
+       atomic_set(&part->nchannels_engaged, 0);
+
+       for (ch_number = 0; ch_number < part->nchannels; ch_number++) {
+               ch = &part->channels[ch_number];
+
+               ch->partid = partid;
+               ch->number = ch_number;
+               ch->flags = XPC_C_DISCONNECTED;
+
+               atomic_set(&ch->kthreads_assigned, 0);
+               atomic_set(&ch->kthreads_idle, 0);
+               atomic_set(&ch->kthreads_active, 0);
+
+               atomic_set(&ch->references, 0);
+               atomic_set(&ch->n_to_notify, 0);
+
+               spin_lock_init(&ch->lock);
+               init_completion(&ch->wdisconnect_wait);
+
+               atomic_set(&ch->n_on_msg_allocate_wq, 0);
+               init_waitqueue_head(&ch->msg_allocate_wq);
+               init_waitqueue_head(&ch->idle_wq);
+       }
+
+       ret = xpc_setup_ch_structures_sn(part);
+       if (ret != xpSuccess)
+               goto out_2;
+
+       /*
+        * With the setting of the partition setup_state to XPC_P_SS_SETUP,
+        * we're declaring that this partition is ready to go.
+        */
+       part->setup_state = XPC_P_SS_SETUP;
+
+       return xpSuccess;
+
+       /* setup of ch structures failed */
+out_2:
+       kfree(part->remote_openclose_args_base);
+       part->remote_openclose_args = NULL;
+out_1:
+       kfree(part->channels);
+       part->channels = NULL;
+       return ret;
+}
+
+/*
+ * Teardown the channel structures necessary to support XPartition Communication
+ * between the specified remote partition and the local one.
+ */
+static void
+xpc_teardown_ch_structures(struct xpc_partition *part)
+{
+       DBUG_ON(atomic_read(&part->nchannels_engaged) != 0);
+       DBUG_ON(atomic_read(&part->nchannels_active) != 0);
 
        /*
-        * The kthread that XPC HB called us with will become the
-        * channel manager for this partition. It will not return
-        * back to XPC HB until the partition's XPC infrastructure
-        * has been dismantled.
+        * Make this partition inaccessible to local processes by marking it
+        * as no longer setup. Then wait before proceeding with the teardown
+        * until all existing references cease.
         */
+       DBUG_ON(part->setup_state != XPC_P_SS_SETUP);
+       part->setup_state = XPC_P_SS_WTEARDOWN;
 
-       (void)xpc_part_ref(part);       /* this will always succeed */
+       wait_event(part->teardown_wq, (atomic_read(&part->references) == 0));
 
-       if (xpc_make_first_contact(part) == xpSuccess)
-               xpc_channel_mgr(part);
+       /* now we can begin tearing down the infrastructure */
 
-       xpc_part_deref(part);
+       xpc_teardown_ch_structures_sn(part);
 
-       xpc_teardown_infrastructure(part);
+       kfree(part->remote_openclose_args_base);
+       part->remote_openclose_args = NULL;
+       kfree(part->channels);
+       part->channels = NULL;
+
+       part->setup_state = XPC_P_SS_TORNDOWN;
 }
 
+/*
+ * When XPC HB determines that a partition has come up, it will create a new
+ * kthread and that kthread will call this function to attempt to set up the
+ * basic infrastructure used for Cross Partition Communication with the newly
+ * upped partition.
+ *
+ * The kthread that was created by XPC HB and which setup the XPC
+ * infrastructure will remain assigned to the partition becoming the channel
+ * manager for that partition until the partition is deactivating, at which
+ * time the kthread will teardown the XPC infrastructure and then exit.
+ */
 static int
 xpc_activating(void *__partid)
 {
@@ -433,64 +599,47 @@ xpc_activating(void *__partid)
        struct xpc_partition *part = &xpc_partitions[partid];
        unsigned long irq_flags;
 
-       DBUG_ON(partid <= 0 || partid >= XP_MAX_PARTITIONS);
+       DBUG_ON(partid < 0 || partid >= xp_max_npartitions);
 
        spin_lock_irqsave(&part->act_lock, irq_flags);
 
-       if (part->act_state == XPC_P_DEACTIVATING) {
-               part->act_state = XPC_P_INACTIVE;
+       if (part->act_state == XPC_P_AS_DEACTIVATING) {
+               part->act_state = XPC_P_AS_INACTIVE;
                spin_unlock_irqrestore(&part->act_lock, irq_flags);
                part->remote_rp_pa = 0;
                return 0;
        }
 
        /* indicate the thread is activating */
-       DBUG_ON(part->act_state != XPC_P_ACTIVATION_REQ);
-       part->act_state = XPC_P_ACTIVATING;
+       DBUG_ON(part->act_state != XPC_P_AS_ACTIVATION_REQ);
+       part->act_state = XPC_P_AS_ACTIVATING;
 
        XPC_SET_REASON(part, 0, 0);
        spin_unlock_irqrestore(&part->act_lock, irq_flags);
 
-       dev_dbg(xpc_part, "bringing partition %d up\n", partid);
+       dev_dbg(xpc_part, "activating partition %d\n", partid);
 
-       /*
-        * Register the remote partition's AMOs with SAL so it can handle
-        * and cleanup errors within that address range should the remote
-        * partition go down. We don't unregister this range because it is
-        * difficult to tell when outstanding writes to the remote partition
-        * are finished and thus when it is safe to unregister. This should
-        * not result in wasted space in the SAL xp_addr_region table because
-        * we should get the same page for remote_amos_page_pa after module
-        * reloads and system reboots.
-        */
-       if (sn_register_xp_addr_region(part->remote_amos_page_pa,
-                                      PAGE_SIZE, 1) < 0) {
-               dev_warn(xpc_part, "xpc_partition_up(%d) failed to register "
-                        "xp_addr region\n", partid);
+       xpc_allow_hb(partid);
 
-               spin_lock_irqsave(&part->act_lock, irq_flags);
-               part->act_state = XPC_P_INACTIVE;
-               XPC_SET_REASON(part, xpPhysAddrRegFailed, __LINE__);
-               spin_unlock_irqrestore(&part->act_lock, irq_flags);
-               part->remote_rp_pa = 0;
-               return 0;
-       }
+       if (xpc_setup_ch_structures(part) == xpSuccess) {
+               (void)xpc_part_ref(part);       /* this will always succeed */
 
-       xpc_allow_hb(partid, xpc_vars);
-       xpc_IPI_send_activated(part);
+               if (xpc_make_first_contact(part) == xpSuccess) {
+                       xpc_mark_partition_active(part);
+                       xpc_channel_mgr(part);
+                       /* won't return until partition is deactivating */
+               }
 
-       /*
-        * xpc_partition_up() holds this thread and marks this partition as
-        * XPC_P_ACTIVE by calling xpc_hb_mark_active().
-        */
-       (void)xpc_partition_up(part);
+               xpc_part_deref(part);
+               xpc_teardown_ch_structures(part);
+       }
 
-       xpc_disallow_hb(partid, xpc_vars);
+       xpc_disallow_hb(partid);
        xpc_mark_partition_inactive(part);
 
        if (part->reason == xpReactivating) {
                /* interrupting ourselves results in activating partition */
-               xpc_IPI_send_reactivate(part);
+               xpc_request_partition_reactivation(part);
        }
 
        return 0;
@@ -505,9 +654,9 @@ xpc_activate_partition(struct xpc_partition *part)
 
        spin_lock_irqsave(&part->act_lock, irq_flags);
 
-       DBUG_ON(part->act_state != XPC_P_INACTIVE);
+       DBUG_ON(part->act_state != XPC_P_AS_INACTIVE);
 
-       part->act_state = XPC_P_ACTIVATION_REQ;
+       part->act_state = XPC_P_AS_ACTIVATION_REQ;
        XPC_SET_REASON(part, xpCloneKThread, __LINE__);
 
        spin_unlock_irqrestore(&part->act_lock, irq_flags);
@@ -516,62 +665,12 @@ xpc_activate_partition(struct xpc_partition *part)
                              partid);
        if (IS_ERR(kthread)) {
                spin_lock_irqsave(&part->act_lock, irq_flags);
-               part->act_state = XPC_P_INACTIVE;
+               part->act_state = XPC_P_AS_INACTIVE;
                XPC_SET_REASON(part, xpCloneKThreadFailed, __LINE__);
                spin_unlock_irqrestore(&part->act_lock, irq_flags);
        }
 }
 
-/*
- * Handle the receipt of a SGI_XPC_NOTIFY IRQ by seeing whether the specified
- * partition actually sent it. Since SGI_XPC_NOTIFY IRQs may be shared by more
- * than one partition, we use an AMO_t structure per partition to indicate
- * whether a partition has sent an IPI or not.  If it has, then wake up the
- * associated kthread to handle it.
- *
- * All SGI_XPC_NOTIFY IRQs received by XPC are the result of IPIs sent by XPC
- * running on other partitions.
- *
- * Noteworthy Arguments:
- *
- *     irq - Interrupt ReQuest number. NOT USED.
- *
- *     dev_id - partid of IPI's potential sender.
- */
-irqreturn_t
-xpc_notify_IRQ_handler(int irq, void *dev_id)
-{
-       short partid = (short)(u64)dev_id;
-       struct xpc_partition *part = &xpc_partitions[partid];
-
-       DBUG_ON(partid <= 0 || partid >= XP_MAX_PARTITIONS);
-
-       if (xpc_part_ref(part)) {
-               xpc_check_for_channel_activity(part);
-
-               xpc_part_deref(part);
-       }
-       return IRQ_HANDLED;
-}
-
-/*
- * Check to see if xpc_notify_IRQ_handler() dropped any IPIs on the floor
- * because the write to their associated IPI amo completed after the IRQ/IPI
- * was received.
- */
-void
-xpc_dropped_IPI_check(struct xpc_partition *part)
-{
-       if (xpc_part_ref(part)) {
-               xpc_check_for_channel_activity(part);
-
-               part->dropped_IPI_timer.expires = jiffies +
-                   XPC_P_DROPPED_IPI_WAIT;
-               add_timer(&part->dropped_IPI_timer);
-               xpc_part_deref(part);
-       }
-}
-
 void
 xpc_activate_kthreads(struct xpc_channel *ch, int needed)
 {
@@ -616,9 +715,9 @@ xpc_kthread_waitmsgs(struct xpc_partition *part, struct xpc_channel *ch)
        do {
                /* deliver messages to their intended recipients */
 
-               while (ch->w_local_GP.get < ch->w_remote_GP.put &&
+               while (xpc_n_of_deliverable_payloads(ch) > 0 &&
                       !(ch->flags & XPC_C_DISCONNECTING)) {
-                       xpc_deliver_msg(ch);
+                       xpc_deliver_payload(ch);
                }
 
                if (atomic_inc_return(&ch->kthreads_idle) >
@@ -632,7 +731,7 @@ xpc_kthread_waitmsgs(struct xpc_partition *part, struct xpc_channel *ch)
                        "wait_event_interruptible_exclusive()\n");
 
                (void)wait_event_interruptible_exclusive(ch->idle_wq,
-                               (ch->w_local_GP.get < ch->w_remote_GP.put ||
+                               (xpc_n_of_deliverable_payloads(ch) > 0 ||
                                 (ch->flags & XPC_C_DISCONNECTING)));
 
                atomic_dec(&ch->kthreads_idle);
@@ -677,7 +776,7 @@ xpc_kthread_start(void *args)
                         * additional kthreads to help deliver them. We only
                         * need one less than total #of messages to deliver.
                         */
-                       n_needed = ch->w_remote_GP.put - ch->w_local_GP.get - 1;
+                       n_needed = xpc_n_of_deliverable_payloads(ch) - 1;
                        if (n_needed > 0 && !(ch->flags & XPC_C_DISCONNECTING))
                                xpc_activate_kthreads(ch, n_needed);
 
@@ -703,11 +802,9 @@ xpc_kthread_start(void *args)
        }
        spin_unlock_irqrestore(&ch->lock, irq_flags);
 
-       if (atomic_dec_return(&ch->kthreads_assigned) == 0) {
-               if (atomic_dec_return(&part->nchannels_engaged) == 0) {
-                       xpc_mark_partition_disengaged(part);
-                       xpc_IPI_send_disengage(part);
-               }
+       if (atomic_dec_return(&ch->kthreads_assigned) == 0 &&
+           atomic_dec_return(&part->nchannels_engaged) == 0) {
+               xpc_indicate_partition_disengaged(part);
        }
 
        xpc_msgqueue_deref(ch);
@@ -758,9 +855,9 @@ xpc_create_kthreads(struct xpc_channel *ch, int needed,
                } else if (ch->flags & XPC_C_DISCONNECTING) {
                        break;
 
-               } else if (atomic_inc_return(&ch->kthreads_assigned) == 1) {
-                       if (atomic_inc_return(&part->nchannels_engaged) == 1)
-                               xpc_mark_partition_engaged(part);
+               } else if (atomic_inc_return(&ch->kthreads_assigned) == 1 &&
+                          atomic_inc_return(&part->nchannels_engaged) == 1) {
+                               xpc_indicate_partition_engaged(part);
                }
                (void)xpc_part_ref(part);
                xpc_msgqueue_ref(ch);
@@ -782,8 +879,7 @@ xpc_create_kthreads(struct xpc_channel *ch, int needed,
 
                        if (atomic_dec_return(&ch->kthreads_assigned) == 0 &&
                            atomic_dec_return(&part->nchannels_engaged) == 0) {
-                               xpc_mark_partition_disengaged(part);
-                               xpc_IPI_send_disengage(part);
+                               xpc_indicate_partition_disengaged(part);
                        }
                        xpc_msgqueue_deref(ch);
                        xpc_part_deref(part);
@@ -815,7 +911,7 @@ xpc_disconnect_wait(int ch_number)
        int wakeup_channel_mgr;
 
        /* now wait for all callouts to the caller's function to cease */
-       for (partid = 1; partid < XP_MAX_PARTITIONS; partid++) {
+       for (partid = 0; partid < xp_max_npartitions; partid++) {
                part = &xpc_partitions[partid];
 
                if (!xpc_part_ref(part))
@@ -834,16 +930,15 @@ xpc_disconnect_wait(int ch_number)
                DBUG_ON(!(ch->flags & XPC_C_DISCONNECTED));
                wakeup_channel_mgr = 0;
 
-               if (ch->delayed_IPI_flags) {
-                       if (part->act_state != XPC_P_DEACTIVATING) {
-                               spin_lock(&part->IPI_lock);
-                               XPC_SET_IPI_FLAGS(part->local_IPI_amo,
-                                                 ch->number,
-                                                 ch->delayed_IPI_flags);
-                               spin_unlock(&part->IPI_lock);
+               if (ch->delayed_chctl_flags) {
+                       if (part->act_state != XPC_P_AS_DEACTIVATING) {
+                               spin_lock(&part->chctl_lock);
+                               part->chctl.flags[ch->number] |=
+                                   ch->delayed_chctl_flags;
+                               spin_unlock(&part->chctl_lock);
                                wakeup_channel_mgr = 1;
                        }
-                       ch->delayed_IPI_flags = 0;
+                       ch->delayed_chctl_flags = 0;
                }
 
                ch->flags &= ~XPC_C_WDISCONNECT;
@@ -856,13 +951,63 @@ xpc_disconnect_wait(int ch_number)
        }
 }
 
+static int
+xpc_setup_partitions(void)
+{
+       short partid;
+       struct xpc_partition *part;
+
+       xpc_partitions = kzalloc(sizeof(struct xpc_partition) *
+                                xp_max_npartitions, GFP_KERNEL);
+       if (xpc_partitions == NULL) {
+               dev_err(xpc_part, "can't get memory for partition structure\n");
+               return -ENOMEM;
+       }
+
+       /*
+        * The first few fields of each entry of xpc_partitions[] need to
+        * be initialized now so that calls to xpc_connect() and
+        * xpc_disconnect() can be made prior to the activation of any remote
+        * partition. NOTE THAT NONE OF THE OTHER FIELDS BELONGING TO THESE
+        * ENTRIES ARE MEANINGFUL UNTIL AFTER AN ENTRY'S CORRESPONDING
+        * PARTITION HAS BEEN ACTIVATED.
+        */
+       for (partid = 0; partid < xp_max_npartitions; partid++) {
+               part = &xpc_partitions[partid];
+
+               DBUG_ON((u64)part != L1_CACHE_ALIGN((u64)part));
+
+               part->activate_IRQ_rcvd = 0;
+               spin_lock_init(&part->act_lock);
+               part->act_state = XPC_P_AS_INACTIVE;
+               XPC_SET_REASON(part, 0, 0);
+
+               init_timer(&part->disengage_timer);
+               part->disengage_timer.function =
+                   xpc_timeout_partition_disengage;
+               part->disengage_timer.data = (unsigned long)part;
+
+               part->setup_state = XPC_P_SS_UNSET;
+               init_waitqueue_head(&part->teardown_wq);
+               atomic_set(&part->references, 0);
+       }
+
+       return xpc_setup_partitions_sn();
+}
+
+static void
+xpc_teardown_partitions(void)
+{
+       kfree(xpc_partitions);
+}
+
 static void
 xpc_do_exit(enum xp_retval reason)
 {
        short partid;
        int active_part_count, printed_waiting_msg = 0;
        struct xpc_partition *part;
-       unsigned long printmsg_time, disengage_request_timeout = 0;
+       unsigned long printmsg_time, disengage_timeout = 0;
 
        /* a 'rmmod XPC' and a 'reboot' cannot both end up here together */
        DBUG_ON(xpc_exiting == 1);
@@ -873,10 +1018,7 @@ xpc_do_exit(enum xp_retval reason)
         * the heartbeat checker thread in case it's sleeping.
         */
        xpc_exiting = 1;
-       wake_up_interruptible(&xpc_act_IRQ_wq);
-
-       /* ignore all incoming interrupts */
-       free_irq(SGI_XPC_ACTIVATE, NULL);
+       wake_up_interruptible(&xpc_activate_IRQ_wq);
 
        /* wait for the discovery thread to exit */
        wait_for_completion(&xpc_discovery_exited);
@@ -889,17 +1031,17 @@ xpc_do_exit(enum xp_retval reason)
 
        /* wait for all partitions to become inactive */
 
-       printmsg_time = jiffies + (XPC_DISENGAGE_PRINTMSG_INTERVAL * HZ);
-       xpc_disengage_request_timedout = 0;
+       printmsg_time = jiffies + (XPC_DEACTIVATE_PRINTMSG_INTERVAL * HZ);
+       xpc_disengage_timedout = 0;
 
        do {
                active_part_count = 0;
 
-               for (partid = 1; partid < XP_MAX_PARTITIONS; partid++) {
+               for (partid = 0; partid < xp_max_npartitions; partid++) {
                        part = &xpc_partitions[partid];
 
                        if (xpc_partition_disengaged(part) &&
-                           part->act_state == XPC_P_INACTIVE) {
+                           part->act_state == XPC_P_AS_INACTIVE) {
                                continue;
                        }
 
@@ -907,36 +1049,32 @@ xpc_do_exit(enum xp_retval reason)
 
                        XPC_DEACTIVATE_PARTITION(part, reason);
 
-                       if (part->disengage_request_timeout >
-                           disengage_request_timeout) {
-                               disengage_request_timeout =
-                                   part->disengage_request_timeout;
-                       }
+                       if (part->disengage_timeout > disengage_timeout)
+                               disengage_timeout = part->disengage_timeout;
                }
 
-               if (xpc_partition_engaged(-1UL)) {
-                       if (time_after(jiffies, printmsg_time)) {
+               if (xpc_any_partition_engaged()) {
+                       if (time_is_before_jiffies(printmsg_time)) {
                                dev_info(xpc_part, "waiting for remote "
-                                        "partitions to disengage, timeout in "
-                                        "%ld seconds\n",
-                                        (disengage_request_timeout - jiffies)
-                                        / HZ);
+                                        "partitions to deactivate, timeout in "
+                                        "%ld seconds\n", (disengage_timeout -
+                                        jiffies) / HZ);
                                printmsg_time = jiffies +
-                                   (XPC_DISENGAGE_PRINTMSG_INTERVAL * HZ);
+                                   (XPC_DEACTIVATE_PRINTMSG_INTERVAL * HZ);
                                printed_waiting_msg = 1;
                        }
 
                } else if (active_part_count > 0) {
                        if (printed_waiting_msg) {
                                dev_info(xpc_part, "waiting for local partition"
-                                        " to disengage\n");
+                                        " to deactivate\n");
                                printed_waiting_msg = 0;
                        }
 
                } else {
-                       if (!xpc_disengage_request_timedout) {
+                       if (!xpc_disengage_timedout) {
                                dev_info(xpc_part, "all partitions have "
-                                        "disengaged\n");
+                                        "deactivated\n");
                        }
                        break;
                }
@@ -946,33 +1084,28 @@ xpc_do_exit(enum xp_retval reason)
 
        } while (1);
 
-       DBUG_ON(xpc_partition_engaged(-1UL));
+       DBUG_ON(xpc_any_partition_engaged());
+       DBUG_ON(xpc_any_hbs_allowed() != 0);
 
-       /* indicate to others that our reserved page is uninitialized */
-       xpc_rsvd_page->vars_pa = 0;
-
-       /* now it's time to eliminate our heartbeat */
-       del_timer_sync(&xpc_hb_timer);
-       DBUG_ON(xpc_vars->heartbeating_to_mask != 0);
+       xpc_teardown_rsvd_page();
 
        if (reason == xpUnloading) {
-               /* take ourselves off of the reboot_notifier_list */
-               (void)unregister_reboot_notifier(&xpc_reboot_notifier);
-
-               /* take ourselves off of the die_notifier list */
                (void)unregister_die_notifier(&xpc_die_notifier);
+               (void)unregister_reboot_notifier(&xpc_reboot_notifier);
        }
 
-       /* close down protections for IPI operations */
-       xpc_restrict_IPI_ops();
-
        /* clear the interface to XPC's functions */
        xpc_clear_interface();
 
        if (xpc_sysctl)
                unregister_sysctl_table(xpc_sysctl);
 
-       kfree(xpc_remote_copy_buffer_base);
+       xpc_teardown_partitions();
+
+       if (is_shub())
+               xpc_exit_sn2();
+       else
+               xpc_exit_uv();
 }
 
 /*
@@ -1002,60 +1135,57 @@ xpc_system_reboot(struct notifier_block *nb, unsigned long event, void *unused)
 }
 
 /*
- * Notify other partitions to disengage from all references to our memory.
+ * Notify other partitions to deactivate from us by first disengaging from all
+ * references to our memory.
  */
 static void
-xpc_die_disengage(void)
+xpc_die_deactivate(void)
 {
        struct xpc_partition *part;
        short partid;
-       unsigned long engaged;
-       long time, printmsg_time, disengage_request_timeout;
+       int any_engaged;
+       long keep_waiting;
+       long wait_to_print;
 
        /* keep xpc_hb_checker thread from doing anything (just in case) */
        xpc_exiting = 1;
 
-       xpc_vars->heartbeating_to_mask = 0;     /* indicate we're deactivated */
+       xpc_disallow_all_hbs(); /*indicate we're deactivated */
 
-       for (partid = 1; partid < XP_MAX_PARTITIONS; partid++) {
+       for (partid = 0; partid < xp_max_npartitions; partid++) {
                part = &xpc_partitions[partid];
 
-               if (!XPC_SUPPORTS_DISENGAGE_REQUEST(part->
-                   remote_vars_version)) {
-
-                       /* just in case it was left set by an earlier XPC */
-                       xpc_clear_partition_engaged(1UL << partid);
-                       continue;
-               }
-
-               if (xpc_partition_engaged(1UL << partid) ||
-                   part->act_state != XPC_P_INACTIVE) {
-                       xpc_request_partition_disengage(part);
-                       xpc_mark_partition_disengaged(part);
-                       xpc_IPI_send_disengage(part);
+               if (xpc_partition_engaged(partid) ||
+                   part->act_state != XPC_P_AS_INACTIVE) {
+                       xpc_request_partition_deactivation(part);
+                       xpc_indicate_partition_disengaged(part);
                }
        }
 
-       time = rtc_time();
-       printmsg_time = time +
-           (XPC_DISENGAGE_PRINTMSG_INTERVAL * sn_rtc_cycles_per_second);
-       disengage_request_timeout = time +
-           (xpc_disengage_request_timelimit * sn_rtc_cycles_per_second);
-
-       /* wait for all other partitions to disengage from us */
+       /*
+        * Though we requested that all other partitions deactivate from us,
+        * we only wait until they've all disengaged or we've reached the
+        * defined timelimit.
+        *
+        * Given that one iteration through the following while-loop takes
+        * approximately 200 microseconds, calculate the #of loops to take
+        * before bailing and the #of loops before printing a waiting message.
+        */
+       keep_waiting = xpc_disengage_timelimit * 1000 * 5;
+       wait_to_print = XPC_DEACTIVATE_PRINTMSG_INTERVAL * 1000 * 5;
 
        while (1) {
-               engaged = xpc_partition_engaged(-1UL);
-               if (!engaged) {
-                       dev_info(xpc_part, "all partitions have disengaged\n");
+               any_engaged = xpc_any_partition_engaged();
+               if (!any_engaged) {
+                       dev_info(xpc_part, "all partitions have deactivated\n");
                        break;
                }
 
-               time = rtc_time();
-               if (time >= disengage_request_timeout) {
-                       for (partid = 1; partid < XP_MAX_PARTITIONS; partid++) {
-                               if (engaged & (1UL << partid)) {
-                                       dev_info(xpc_part, "disengage from "
+               if (!keep_waiting--) {
+                       for (partid = 0; partid < xp_max_npartitions;
+                            partid++) {
+                               if (xpc_partition_engaged(partid)) {
+                                       dev_info(xpc_part, "deactivate from "
                                                 "remote partition %d timed "
                                                 "out\n", partid);
                                }
@@ -1063,15 +1193,15 @@ xpc_die_disengage(void)
                        break;
                }
 
-               if (time >= printmsg_time) {
+               if (!wait_to_print--) {
                        dev_info(xpc_part, "waiting for remote partitions to "
-                                "disengage, timeout in %ld seconds\n",
-                                (disengage_request_timeout - time) /
-                                sn_rtc_cycles_per_second);
-                       printmsg_time = time +
-                           (XPC_DISENGAGE_PRINTMSG_INTERVAL *
-                            sn_rtc_cycles_per_second);
+                                "deactivate, timeout in %ld seconds\n",
+                                keep_waiting / (1000 * 5));
+                       wait_to_print = XPC_DEACTIVATE_PRINTMSG_INTERVAL *
+                           1000 * 5;
                }
+
+               udelay(200);
        }
 }
 
@@ -1086,10 +1216,11 @@ xpc_die_disengage(void)
 static int
 xpc_system_die(struct notifier_block *nb, unsigned long event, void *unused)
 {
+#ifdef CONFIG_IA64             /* !!! temporary kludge */
        switch (event) {
        case DIE_MACHINE_RESTART:
        case DIE_MACHINE_HALT:
-               xpc_die_disengage();
+               xpc_die_deactivate();
                break;
 
        case DIE_KDEBUG_ENTER:
@@ -1100,8 +1231,7 @@ xpc_system_die(struct notifier_block *nb, unsigned long event, void *unused)
                /* fall through */
        case DIE_MCA_MONARCH_ENTER:
        case DIE_INIT_MONARCH_ENTER:
-               xpc_vars->heartbeat++;
-               xpc_vars->heartbeat_offline = 1;
+               xpc_offline_heartbeat();
                break;
 
        case DIE_KDEBUG_LEAVE:
@@ -1112,10 +1242,12 @@ xpc_system_die(struct notifier_block *nb, unsigned long event, void *unused)
                /* fall through */
        case DIE_MCA_MONARCH_LEAVE:
        case DIE_INIT_MONARCH_LEAVE:
-               xpc_vars->heartbeat++;
-               xpc_vars->heartbeat_offline = 0;
+               xpc_online_heartbeat();
                break;
        }
+#else
+       xpc_die_deactivate();
+#endif
 
        return NOTIFY_DONE;
 }
@@ -1124,105 +1256,52 @@ int __init
 xpc_init(void)
 {
        int ret;
-       short partid;
-       struct xpc_partition *part;
        struct task_struct *kthread;
-       size_t buf_size;
-
-       if (!ia64_platform_is("sn2"))
-               return -ENODEV;
-
-       buf_size = max(XPC_RP_VARS_SIZE,
-                      XPC_RP_HEADER_SIZE + XP_NASID_MASK_BYTES);
-       xpc_remote_copy_buffer = xpc_kmalloc_cacheline_aligned(buf_size,
-                                                              GFP_KERNEL,
-                                                 &xpc_remote_copy_buffer_base);
-       if (xpc_remote_copy_buffer == NULL)
-               return -ENOMEM;
 
        snprintf(xpc_part->bus_id, BUS_ID_SIZE, "part");
        snprintf(xpc_chan->bus_id, BUS_ID_SIZE, "chan");
 
-       xpc_sysctl = register_sysctl_table(xpc_sys_dir);
-
-       /*
-        * The first few fields of each entry of xpc_partitions[] need to
-        * be initialized now so that calls to xpc_connect() and
-        * xpc_disconnect() can be made prior to the activation of any remote
-        * partition. NOTE THAT NONE OF THE OTHER FIELDS BELONGING TO THESE
-        * ENTRIES ARE MEANINGFUL UNTIL AFTER AN ENTRY'S CORRESPONDING
-        * PARTITION HAS BEEN ACTIVATED.
-        */
-       for (partid = 1; partid < XP_MAX_PARTITIONS; partid++) {
-               part = &xpc_partitions[partid];
-
-               DBUG_ON((u64)part != L1_CACHE_ALIGN((u64)part));
-
-               part->act_IRQ_rcvd = 0;
-               spin_lock_init(&part->act_lock);
-               part->act_state = XPC_P_INACTIVE;
-               XPC_SET_REASON(part, 0, 0);
+       if (is_shub()) {
+               /*
+                * The ia64-sn2 architecture supports at most 64 partitions.
+                * And the inability to unregister remote amos restricts us
+                * further to only support exactly 64 partitions on this
+                * architecture, no less.
+                */
+               if (xp_max_npartitions != 64) {
+                       dev_err(xpc_part, "max #of partitions not set to 64\n");
+                       ret = -EINVAL;
+               } else {
+                       ret = xpc_init_sn2();
+               }
 
-               init_timer(&part->disengage_request_timer);
-               part->disengage_request_timer.function =
-                   xpc_timeout_partition_disengage_request;
-               part->disengage_request_timer.data = (unsigned long)part;
+       } else if (is_uv()) {
+               ret = xpc_init_uv();
 
-               part->setup_state = XPC_P_UNSET;
-               init_waitqueue_head(&part->teardown_wq);
-               atomic_set(&part->references, 0);
+       } else {
+               ret = -ENODEV;
        }
 
-       /*
-        * Open up protections for IPI operations (and AMO operations on
-        * Shub 1.1 systems).
-        */
-       xpc_allow_IPI_ops();
-
-       /*
-        * Interrupts being processed will increment this atomic variable and
-        * awaken the heartbeat thread which will process the interrupts.
-        */
-       atomic_set(&xpc_act_IRQ_rcvd, 0);
+       if (ret != 0)
+               return ret;
 
-       /*
-        * This is safe to do before the xpc_hb_checker thread has started
-        * because the handler releases a wait queue.  If an interrupt is
-        * received before the thread is waiting, it will not go to sleep,
-        * but rather immediately process the interrupt.
-        */
-       ret = request_irq(SGI_XPC_ACTIVATE, xpc_act_IRQ_handler, 0,
-                         "xpc hb", NULL);
+       ret = xpc_setup_partitions();
        if (ret != 0) {
-               dev_err(xpc_part, "can't register ACTIVATE IRQ handler, "
-                       "errno=%d\n", -ret);
-
-               xpc_restrict_IPI_ops();
-
-               if (xpc_sysctl)
-                       unregister_sysctl_table(xpc_sysctl);
-
-               kfree(xpc_remote_copy_buffer_base);
-               return -EBUSY;
+               dev_err(xpc_part, "can't get memory for partition structure\n");
+               goto out_1;
        }
 
+       xpc_sysctl = register_sysctl_table(xpc_sys_dir);
+
        /*
         * Fill the partition reserved page with the information needed by
         * other partitions to discover we are alive and establish initial
         * communications.
         */
-       xpc_rsvd_page = xpc_rsvd_page_init();
-       if (xpc_rsvd_page == NULL) {
-               dev_err(xpc_part, "could not setup our reserved page\n");
-
-               free_irq(SGI_XPC_ACTIVATE, NULL);
-               xpc_restrict_IPI_ops();
-
-               if (xpc_sysctl)
-                       unregister_sysctl_table(xpc_sysctl);
-
-               kfree(xpc_remote_copy_buffer_base);
-               return -EBUSY;
+       ret = xpc_setup_rsvd_page();
+       if (ret != 0) {
+               dev_err(xpc_part, "can't setup our reserved page\n");
+               goto out_2;
        }
 
        /* add ourselves to the reboot_notifier_list */
@@ -1235,9 +1314,6 @@ xpc_init(void)
        if (ret != 0)
                dev_warn(xpc_part, "can't register die notifier\n");
 
-       init_timer(&xpc_hb_timer);
-       xpc_hb_timer.function = xpc_hb_beater;
-
        /*
         * The real work-horse behind xpc.  This processes incoming
         * interrupts and monitors remote heartbeats.
@@ -1245,25 +1321,8 @@ xpc_init(void)
        kthread = kthread_run(xpc_hb_checker, NULL, XPC_HB_CHECK_THREAD_NAME);
        if (IS_ERR(kthread)) {
                dev_err(xpc_part, "failed while forking hb check thread\n");
-
-               /* indicate to others that our reserved page is uninitialized */
-               xpc_rsvd_page->vars_pa = 0;
-
-               /* take ourselves off of the reboot_notifier_list */
-               (void)unregister_reboot_notifier(&xpc_reboot_notifier);
-
-               /* take ourselves off of the die_notifier list */
-               (void)unregister_die_notifier(&xpc_die_notifier);
-
-               del_timer_sync(&xpc_hb_timer);
-               free_irq(SGI_XPC_ACTIVATE, NULL);
-               xpc_restrict_IPI_ops();
-
-               if (xpc_sysctl)
-                       unregister_sysctl_table(xpc_sysctl);
-
-               kfree(xpc_remote_copy_buffer_base);
-               return -EBUSY;
+               ret = -EBUSY;
+               goto out_3;
        }
 
        /*
@@ -1285,11 +1344,28 @@ xpc_init(void)
 
        /* set the interface to point at XPC's functions */
        xpc_set_interface(xpc_initiate_connect, xpc_initiate_disconnect,
-                         xpc_initiate_allocate, xpc_initiate_send,
-                         xpc_initiate_send_notify, xpc_initiate_received,
-                         xpc_initiate_partid_to_nasids);
+                         xpc_initiate_send, xpc_initiate_send_notify,
+                         xpc_initiate_received, xpc_initiate_partid_to_nasids);
 
        return 0;
+
+       /* initialization was not successful */
+out_3:
+       xpc_teardown_rsvd_page();
+
+       (void)unregister_die_notifier(&xpc_die_notifier);
+       (void)unregister_reboot_notifier(&xpc_reboot_notifier);
+out_2:
+       if (xpc_sysctl)
+               unregister_sysctl_table(xpc_sysctl);
+
+       xpc_teardown_partitions();
+out_1:
+       if (is_shub())
+               xpc_exit_sn2();
+       else
+               xpc_exit_uv();
+       return ret;
 }
 
 module_init(xpc_init);
@@ -1314,9 +1390,9 @@ module_param(xpc_hb_check_interval, int, 0);
 MODULE_PARM_DESC(xpc_hb_check_interval, "Number of seconds between "
                 "heartbeat checks.");
 
-module_param(xpc_disengage_request_timelimit, int, 0);
-MODULE_PARM_DESC(xpc_disengage_request_timelimit, "Number of seconds to wait "
-                "for disengage request to complete.");
+module_param(xpc_disengage_timelimit, int, 0);
+MODULE_PARM_DESC(xpc_disengage_timelimit, "Number of seconds to wait "
+                "for disengage to complete.");
 
 module_param(xpc_kdebug_ignore, int, 0);
 MODULE_PARM_DESC(xpc_kdebug_ignore, "Should lack of heartbeat be ignored by "
index 7dd4b58..6722f6f 100644 (file)
  *
  */
 
-#include <linux/kernel.h>
-#include <linux/sysctl.h>
-#include <linux/cache.h>
-#include <linux/mmzone.h>
-#include <linux/nodemask.h>
-#include <asm/uncached.h>
-#include <asm/sn/bte.h>
-#include <asm/sn/intr.h>
-#include <asm/sn/sn_sal.h>
-#include <asm/sn/nodepda.h>
-#include <asm/sn/addrs.h>
+#include <linux/device.h>
+#include <linux/hardirq.h>
 #include "xpc.h"
 
 /* XPC is exiting flag */
 int xpc_exiting;
 
-/* SH_IPI_ACCESS shub register value on startup */
-static u64 xpc_sh1_IPI_access;
-static u64 xpc_sh2_IPI_access0;
-static u64 xpc_sh2_IPI_access1;
-static u64 xpc_sh2_IPI_access2;
-static u64 xpc_sh2_IPI_access3;
-
-/* original protection values for each node */
-u64 xpc_prot_vec[MAX_NUMNODES];
-
 /* this partition's reserved page pointers */
 struct xpc_rsvd_page *xpc_rsvd_page;
-static u64 *xpc_part_nasids;
-static u64 *xpc_mach_nasids;
-struct xpc_vars *xpc_vars;
-struct xpc_vars_part *xpc_vars_part;
+static unsigned long *xpc_part_nasids;
+unsigned long *xpc_mach_nasids;
 
-static int xp_nasid_mask_bytes;        /* actual size in bytes of nasid mask */
-static int xp_nasid_mask_words;        /* actual size in words of nasid mask */
-
-/*
- * For performance reasons, each entry of xpc_partitions[] is cacheline
- * aligned. And xpc_partitions[] is padded with an additional entry at the
- * end so that the last legitimate entry doesn't share its cacheline with
- * another variable.
- */
-struct xpc_partition xpc_partitions[XP_MAX_PARTITIONS + 1];
+static int xpc_nasid_mask_nbytes;      /* #of bytes in nasid mask */
+int xpc_nasid_mask_nlongs;     /* #of longs in nasid mask */
 
-/*
- * Generic buffer used to store a local copy of portions of a remote
- * partition's reserved page (either its header and part_nasids mask,
- * or its vars).
- */
-char *xpc_remote_copy_buffer;
-void *xpc_remote_copy_buffer_base;
+struct xpc_partition *xpc_partitions;
 
 /*
  * Guarantee that the kmalloc'd memory is cacheline aligned.
@@ -95,56 +60,59 @@ xpc_kmalloc_cacheline_aligned(size_t size, gfp_t flags, void **base)
  * Given a nasid, get the physical address of the  partition's reserved page
  * for that nasid. This function returns 0 on any error.
  */
-static u64
+static unsigned long
 xpc_get_rsvd_page_pa(int nasid)
 {
-       bte_result_t bte_res;
-       s64 status;
+       enum xp_retval ret;
        u64 cookie = 0;
-       u64 rp_pa = nasid;      /* seed with nasid */
-       u64 len = 0;
-       u64 buf = buf;
-       u64 buf_len = 0;
+       unsigned long rp_pa = nasid;    /* seed with nasid */
+       size_t len = 0;
+       size_t buf_len = 0;
+       void *buf = buf;
        void *buf_base = NULL;
 
        while (1) {
 
-               status = sn_partition_reserved_page_pa(buf, &cookie, &rp_pa,
-                                                      &len);
+               /* !!! rp_pa will need to be _gpa on UV.
+                * ??? So do we save it into the architecture specific parts
+                * ??? of the xpc_partition structure? Do we rename this
+                * ??? function or have two versions? Rename rp_pa for UV to
+                * ??? rp_gpa?
+                */
+               ret = xpc_get_partition_rsvd_page_pa(buf, &cookie, &rp_pa,
+                                                    &len);
 
-               dev_dbg(xpc_part, "SAL returned with status=%li, cookie="
-                       "0x%016lx, address=0x%016lx, len=0x%016lx\n",
-                       status, cookie, rp_pa, len);
+               dev_dbg(xpc_part, "SAL returned with ret=%d, cookie=0x%016lx, "
+                       "address=0x%016lx, len=0x%016lx\n", ret,
+                       (unsigned long)cookie, rp_pa, len);
 
-               if (status != SALRET_MORE_PASSES)
+               if (ret != xpNeedMoreInfo)
                        break;
 
+               /* !!! L1_CACHE_ALIGN() is only a sn2-bte_copy requirement */
                if (L1_CACHE_ALIGN(len) > buf_len) {
                        kfree(buf_base);
                        buf_len = L1_CACHE_ALIGN(len);
-                       buf = (u64)xpc_kmalloc_cacheline_aligned(buf_len,
-                                                                GFP_KERNEL,
-                                                                &buf_base);
+                       buf = xpc_kmalloc_cacheline_aligned(buf_len, GFP_KERNEL,
+                                                           &buf_base);
                        if (buf_base == NULL) {
                                dev_err(xpc_part, "unable to kmalloc "
                                        "len=0x%016lx\n", buf_len);
-                               status = SALRET_ERROR;
+                               ret = xpNoMemory;
                                break;
                        }
                }
 
-               bte_res = xp_bte_copy(rp_pa, buf, buf_len,
-                                     (BTE_NOTIFY | BTE_WACQUIRE), NULL);
-               if (bte_res != BTE_SUCCESS) {
-                       dev_dbg(xpc_part, "xp_bte_copy failed %i\n", bte_res);
-                       status = SALRET_ERROR;
+               ret = xp_remote_memcpy(xp_pa(buf), rp_pa, buf_len);
+               if (ret != xpSuccess) {
+                       dev_dbg(xpc_part, "xp_remote_memcpy failed %d\n", ret);
                        break;
                }
        }
 
        kfree(buf_base);
 
-       if (status != SALRET_OK)
+       if (ret != xpSuccess)
                rp_pa = 0;
 
        dev_dbg(xpc_part, "reserved page at phys address 0x%016lx\n", rp_pa);
@@ -156,300 +124,77 @@ xpc_get_rsvd_page_pa(int nasid)
  * other partitions to discover we are alive and establish initial
  * communications.
  */
-struct xpc_rsvd_page *
-xpc_rsvd_page_init(void)
+int
+xpc_setup_rsvd_page(void)
 {
+       int ret;
        struct xpc_rsvd_page *rp;
-       AMO_t *amos_page;
-       u64 rp_pa, nasid_array = 0;
-       int i, ret;
+       unsigned long rp_pa;
+       unsigned long new_ts_jiffies;
 
        /* get the local reserved page's address */
 
        preempt_disable();
-       rp_pa = xpc_get_rsvd_page_pa(cpuid_to_nasid(smp_processor_id()));
+       rp_pa = xpc_get_rsvd_page_pa(xp_cpu_to_nasid(smp_processor_id()));
        preempt_enable();
        if (rp_pa == 0) {
                dev_err(xpc_part, "SAL failed to locate the reserved page\n");
-               return NULL;
+               return -ESRCH;
        }
        rp = (struct xpc_rsvd_page *)__va(rp_pa);
 
-       if (rp->partid != sn_partition_id) {
-               dev_err(xpc_part, "the reserved page's partid of %d should be "
-                       "%d\n", rp->partid, sn_partition_id);
-               return NULL;
+       if (rp->SAL_version < 3) {
+               /* SAL_versions < 3 had a SAL_partid defined as a u8 */
+               rp->SAL_partid &= 0xff;
+       }
+       BUG_ON(rp->SAL_partid != xp_partition_id);
+
+       if (rp->SAL_partid < 0 || rp->SAL_partid >= xp_max_npartitions) {
+               dev_err(xpc_part, "the reserved page's partid of %d is outside "
+                       "supported range (< 0 || >= %d)\n", rp->SAL_partid,
+                       xp_max_npartitions);
+               return -EINVAL;
        }
 
        rp->version = XPC_RP_VERSION;
+       rp->max_npartitions = xp_max_npartitions;
 
        /* establish the actual sizes of the nasid masks */
        if (rp->SAL_version == 1) {
                /* SAL_version 1 didn't set the nasids_size field */
-               rp->nasids_size = 128;
+               rp->SAL_nasids_size = 128;
        }
-       xp_nasid_mask_bytes = rp->nasids_size;
-       xp_nasid_mask_words = xp_nasid_mask_bytes / 8;
+       xpc_nasid_mask_nbytes = rp->SAL_nasids_size;
+       xpc_nasid_mask_nlongs = BITS_TO_LONGS(rp->SAL_nasids_size *
+                                             BITS_PER_BYTE);
 
        /* setup the pointers to the various items in the reserved page */
        xpc_part_nasids = XPC_RP_PART_NASIDS(rp);
        xpc_mach_nasids = XPC_RP_MACH_NASIDS(rp);
-       xpc_vars = XPC_RP_VARS(rp);
-       xpc_vars_part = XPC_RP_VARS_PART(rp);
-
-       /*
-        * Before clearing xpc_vars, see if a page of AMOs had been previously
-        * allocated. If not we'll need to allocate one and set permissions
-        * so that cross-partition AMOs are allowed.
-        *
-        * The allocated AMO page needs MCA reporting to remain disabled after
-        * XPC has unloaded.  To make this work, we keep a copy of the pointer
-        * to this page (i.e., amos_page) in the struct xpc_vars structure,
-        * which is pointed to by the reserved page, and re-use that saved copy
-        * on subsequent loads of XPC. This AMO page is never freed, and its
-        * memory protections are never restricted.
-        */
-       amos_page = xpc_vars->amos_page;
-       if (amos_page == NULL) {
-               amos_page = (AMO_t *)TO_AMO(uncached_alloc_page(0, 1));
-               if (amos_page == NULL) {
-                       dev_err(xpc_part, "can't allocate page of AMOs\n");
-                       return NULL;
-               }
-
-               /*
-                * Open up AMO-R/W to cpu.  This is done for Shub 1.1 systems
-                * when xpc_allow_IPI_ops() is called via xpc_hb_init().
-                */
-               if (!enable_shub_wars_1_1()) {
-                       ret = sn_change_memprotect(ia64_tpa((u64)amos_page),
-                                                  PAGE_SIZE,
-                                                  SN_MEMPROT_ACCESS_CLASS_1,
-                                                  &nasid_array);
-                       if (ret != 0) {
-                               dev_err(xpc_part, "can't change memory "
-                                       "protections\n");
-                               uncached_free_page(__IA64_UNCACHED_OFFSET |
-                                                  TO_PHYS((u64)amos_page), 1);
-                               return NULL;
-                       }
-               }
-       } else if (!IS_AMO_ADDRESS((u64)amos_page)) {
-               /*
-                * EFI's XPBOOT can also set amos_page in the reserved page,
-                * but it happens to leave it as an uncached physical address
-                * and we need it to be an uncached virtual, so we'll have to
-                * convert it.
-                */
-               if (!IS_AMO_PHYS_ADDRESS((u64)amos_page)) {
-                       dev_err(xpc_part, "previously used amos_page address "
-                               "is bad = 0x%p\n", (void *)amos_page);
-                       return NULL;
-               }
-               amos_page = (AMO_t *)TO_AMO((u64)amos_page);
-       }
-
-       /* clear xpc_vars */
-       memset(xpc_vars, 0, sizeof(struct xpc_vars));
-
-       xpc_vars->version = XPC_V_VERSION;
-       xpc_vars->act_nasid = cpuid_to_nasid(0);
-       xpc_vars->act_phys_cpuid = cpu_physical_id(0);
-       xpc_vars->vars_part_pa = __pa(xpc_vars_part);
-       xpc_vars->amos_page_pa = ia64_tpa((u64)amos_page);
-       xpc_vars->amos_page = amos_page;        /* save for next load of XPC */
-
-       /* clear xpc_vars_part */
-       memset((u64 *)xpc_vars_part, 0, sizeof(struct xpc_vars_part) *
-              XP_MAX_PARTITIONS);
-
-       /* initialize the activate IRQ related AMO variables */
-       for (i = 0; i < xp_nasid_mask_words; i++)
-               (void)xpc_IPI_init(XPC_ACTIVATE_IRQ_AMOS + i);
-
-       /* initialize the engaged remote partitions related AMO variables */
-       (void)xpc_IPI_init(XPC_ENGAGED_PARTITIONS_AMO);
-       (void)xpc_IPI_init(XPC_DISENGAGE_REQUEST_AMO);
 
-       /* timestamp of when reserved page was setup by XPC */
-       rp->stamp = CURRENT_TIME;
+       ret = xpc_setup_rsvd_page_sn(rp);
+       if (ret != 0)
+               return ret;
 
        /*
+        * Set timestamp of when reserved page was setup by XPC.
         * This signifies to the remote partition that our reserved
         * page is initialized.
         */
-       rp->vars_pa = __pa(xpc_vars);
+       new_ts_jiffies = jiffies;
+       if (new_ts_jiffies == 0 || new_ts_jiffies == rp->ts_jiffies)
+               new_ts_jiffies++;
+       rp->ts_jiffies = new_ts_jiffies;
 
-       return rp;
+       xpc_rsvd_page = rp;
+       return 0;
 }
 
-/*
- * Change protections to allow IPI operations (and AMO operations on
- * Shub 1.1 systems).
- */
 void
-xpc_allow_IPI_ops(void)
+xpc_teardown_rsvd_page(void)
 {
-       int node;
-       int nasid;
-
-       /* >>> Change SH_IPI_ACCESS code to use SAL call once it is available */
-
-       if (is_shub2()) {
-               xpc_sh2_IPI_access0 =
-                   (u64)HUB_L((u64 *)LOCAL_MMR_ADDR(SH2_IPI_ACCESS0));
-               xpc_sh2_IPI_access1 =
-                   (u64)HUB_L((u64 *)LOCAL_MMR_ADDR(SH2_IPI_ACCESS1));
-               xpc_sh2_IPI_access2 =
-                   (u64)HUB_L((u64 *)LOCAL_MMR_ADDR(SH2_IPI_ACCESS2));
-               xpc_sh2_IPI_access3 =
-                   (u64)HUB_L((u64 *)LOCAL_MMR_ADDR(SH2_IPI_ACCESS3));
-
-               for_each_online_node(node) {
-                       nasid = cnodeid_to_nasid(node);
-                       HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS0),
-                             -1UL);
-                       HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS1),
-                             -1UL);
-                       HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS2),
-                             -1UL);
-                       HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS3),
-                             -1UL);
-               }
-
-       } else {
-               xpc_sh1_IPI_access =
-                   (u64)HUB_L((u64 *)LOCAL_MMR_ADDR(SH1_IPI_ACCESS));
-
-               for_each_online_node(node) {
-                       nasid = cnodeid_to_nasid(node);
-                       HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH1_IPI_ACCESS),
-                             -1UL);
-
-                       /*
-                        * Since the BIST collides with memory operations on
-                        * SHUB 1.1 sn_change_memprotect() cannot be used.
-                        */
-                       if (enable_shub_wars_1_1()) {
-                               /* open up everything */
-                               xpc_prot_vec[node] = (u64)HUB_L((u64 *)
-                                                               GLOBAL_MMR_ADDR
-                                                               (nasid,
-                                                 SH1_MD_DQLP_MMR_DIR_PRIVEC0));
-                               HUB_S((u64 *)
-                                     GLOBAL_MMR_ADDR(nasid,
-                                                  SH1_MD_DQLP_MMR_DIR_PRIVEC0),
-                                     -1UL);
-                               HUB_S((u64 *)
-                                     GLOBAL_MMR_ADDR(nasid,
-                                                  SH1_MD_DQRP_MMR_DIR_PRIVEC0),
-                                     -1UL);
-                       }
-               }
-       }
-}
-
-/*
- * Restrict protections to disallow IPI operations (and AMO operations on
- * Shub 1.1 systems).
- */
-void
-xpc_restrict_IPI_ops(void)
-{
-       int node;
-       int nasid;
-
-       /* >>> Change SH_IPI_ACCESS code to use SAL call once it is available */
-
-       if (is_shub2()) {
-
-               for_each_online_node(node) {
-                       nasid = cnodeid_to_nasid(node);
-                       HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS0),
-                             xpc_sh2_IPI_access0);
-                       HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS1),
-                             xpc_sh2_IPI_access1);
-                       HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS2),
-                             xpc_sh2_IPI_access2);
-                       HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS3),
-                             xpc_sh2_IPI_access3);
-               }
-
-       } else {
-
-               for_each_online_node(node) {
-                       nasid = cnodeid_to_nasid(node);
-                       HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH1_IPI_ACCESS),
-                             xpc_sh1_IPI_access);
-
-                       if (enable_shub_wars_1_1()) {
-                               HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid,
-                                                  SH1_MD_DQLP_MMR_DIR_PRIVEC0),
-                                     xpc_prot_vec[node]);
-                               HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid,
-                                                  SH1_MD_DQRP_MMR_DIR_PRIVEC0),
-                                     xpc_prot_vec[node]);
-                       }
-               }
-       }
-}
-
-/*
- * At periodic intervals, scan through all active partitions and ensure
- * their heartbeat is still active.  If not, the partition is deactivated.
- */
-void
-xpc_check_remote_hb(void)
-{
-       struct xpc_vars *remote_vars;
-       struct xpc_partition *part;
-       short partid;
-       bte_result_t bres;
-
-       remote_vars = (struct xpc_vars *)xpc_remote_copy_buffer;
-
-       for (partid = 1; partid < XP_MAX_PARTITIONS; partid++) {
-
-               if (xpc_exiting)
-                       break;
-
-               if (partid == sn_partition_id)
-                       continue;
-
-               part = &xpc_partitions[partid];
-
-               if (part->act_state == XPC_P_INACTIVE ||
-                   part->act_state == XPC_P_DEACTIVATING) {
-                       continue;
-               }
-
-               /* pull the remote_hb cache line */
-               bres = xp_bte_copy(part->remote_vars_pa,
-                                  (u64)remote_vars,
-                                  XPC_RP_VARS_SIZE,
-                                  (BTE_NOTIFY | BTE_WACQUIRE), NULL);
-               if (bres != BTE_SUCCESS) {
-                       XPC_DEACTIVATE_PARTITION(part,
-                                                xpc_map_bte_errors(bres));
-                       continue;
-               }
-
-               dev_dbg(xpc_part, "partid = %d, heartbeat = %ld, last_heartbeat"
-                       " = %ld, heartbeat_offline = %ld, HB_mask = 0x%lx\n",
-                       partid, remote_vars->heartbeat, part->last_heartbeat,
-                       remote_vars->heartbeat_offline,
-                       remote_vars->heartbeating_to_mask);
-
-               if (((remote_vars->heartbeat == part->last_heartbeat) &&
-                    (remote_vars->heartbeat_offline == 0)) ||
-                   !xpc_hb_allowed(sn_partition_id, remote_vars)) {
-
-                       XPC_DEACTIVATE_PARTITION(part, xpNoHeartbeat);
-                       continue;
-               }
-
-               part->last_heartbeat = remote_vars->heartbeat;
-       }
+       /* a zero timestamp indicates our rsvd page is not initialized */
+       xpc_rsvd_page->ts_jiffies = 0;
 }
 
 /*
@@ -459,11 +204,12 @@ xpc_check_remote_hb(void)
  * is large enough to contain a copy of their reserved page header and
  * part_nasids mask.
  */
-static enum xp_retval
-xpc_get_remote_rp(int nasid, u64 *discovered_nasids,
-                 struct xpc_rsvd_page *remote_rp, u64 *remote_rp_pa)
+enum xp_retval
+xpc_get_remote_rp(int nasid, unsigned long *discovered_nasids,
+                 struct xpc_rsvd_page *remote_rp, unsigned long *remote_rp_pa)
 {
-       int bres, i;
+       int l;
+       enum xp_retval ret;
 
        /* get the reserved page's physical address */
 
@@ -472,355 +218,45 @@ xpc_get_remote_rp(int nasid, u64 *discovered_nasids,
                return xpNoRsvdPageAddr;
 
        /* pull over the reserved page header and part_nasids mask */
-       bres = xp_bte_copy(*remote_rp_pa, (u64)remote_rp,
-                          XPC_RP_HEADER_SIZE + xp_nasid_mask_bytes,
-                          (BTE_NOTIFY | BTE_WACQUIRE), NULL);
-       if (bres != BTE_SUCCESS)
-               return xpc_map_bte_errors(bres);
+       ret = xp_remote_memcpy(xp_pa(remote_rp), *remote_rp_pa,
+                              XPC_RP_HEADER_SIZE + xpc_nasid_mask_nbytes);
+       if (ret != xpSuccess)
+               return ret;
 
        if (discovered_nasids != NULL) {
-               u64 *remote_part_nasids = XPC_RP_PART_NASIDS(remote_rp);
-
-               for (i = 0; i < xp_nasid_mask_words; i++)
-                       discovered_nasids[i] |= remote_part_nasids[i];
-       }
-
-       /* check that the partid is for another partition */
+               unsigned long *remote_part_nasids =
+                   XPC_RP_PART_NASIDS(remote_rp);
 
-       if (remote_rp->partid < 1 ||
-           remote_rp->partid > (XP_MAX_PARTITIONS - 1)) {
-               return xpInvalidPartid;
+               for (l = 0; l < xpc_nasid_mask_nlongs; l++)
+                       discovered_nasids[l] |= remote_part_nasids[l];
        }
 
-       if (remote_rp->partid == sn_partition_id)
-               return xpLocalPartid;
+       /* zero timestamp indicates the reserved page has not been setup */
+       if (remote_rp->ts_jiffies == 0)
+               return xpRsvdPageNotSet;
 
        if (XPC_VERSION_MAJOR(remote_rp->version) !=
            XPC_VERSION_MAJOR(XPC_RP_VERSION)) {
                return xpBadVersion;
        }
 
-       return xpSuccess;
-}
-
-/*
- * Get a copy of the remote partition's XPC variables from the reserved page.
- *
- * remote_vars points to a buffer that is cacheline aligned for BTE copies and
- * assumed to be of size XPC_RP_VARS_SIZE.
- */
-static enum xp_retval
-xpc_get_remote_vars(u64 remote_vars_pa, struct xpc_vars *remote_vars)
-{
-       int bres;
-
-       if (remote_vars_pa == 0)
-               return xpVarsNotSet;
-
-       /* pull over the cross partition variables */
-       bres = xp_bte_copy(remote_vars_pa, (u64)remote_vars, XPC_RP_VARS_SIZE,
-                          (BTE_NOTIFY | BTE_WACQUIRE), NULL);
-       if (bres != BTE_SUCCESS)
-               return xpc_map_bte_errors(bres);
-
-       if (XPC_VERSION_MAJOR(remote_vars->version) !=
-           XPC_VERSION_MAJOR(XPC_V_VERSION)) {
-               return xpBadVersion;
-       }
-
-       return xpSuccess;
-}
-
-/*
- * Update the remote partition's info.
- */
-static void
-xpc_update_partition_info(struct xpc_partition *part, u8 remote_rp_version,
-                         struct timespec *remote_rp_stamp, u64 remote_rp_pa,
-                         u64 remote_vars_pa, struct xpc_vars *remote_vars)
-{
-       part->remote_rp_version = remote_rp_version;
-       dev_dbg(xpc_part, "  remote_rp_version = 0x%016x\n",
-               part->remote_rp_version);
-
-       part->remote_rp_stamp = *remote_rp_stamp;
-       dev_dbg(xpc_part, "  remote_rp_stamp (tv_sec = 0x%lx tv_nsec = 0x%lx\n",
-               part->remote_rp_stamp.tv_sec, part->remote_rp_stamp.tv_nsec);
-
-       part->remote_rp_pa = remote_rp_pa;
-       dev_dbg(xpc_part, "  remote_rp_pa = 0x%016lx\n", part->remote_rp_pa);
-
-       part->remote_vars_pa = remote_vars_pa;
-       dev_dbg(xpc_part, "  remote_vars_pa = 0x%016lx\n",
-               part->remote_vars_pa);
-
-       part->last_heartbeat = remote_vars->heartbeat;
-       dev_dbg(xpc_part, "  last_heartbeat = 0x%016lx\n",
-               part->last_heartbeat);
-
-       part->remote_vars_part_pa = remote_vars->vars_part_pa;
-       dev_dbg(xpc_part, "  remote_vars_part_pa = 0x%016lx\n",
-               part->remote_vars_part_pa);
-
-       part->remote_act_nasid = remote_vars->act_nasid;
-       dev_dbg(xpc_part, "  remote_act_nasid = 0x%x\n",
-               part->remote_act_nasid);
-
-       part->remote_act_phys_cpuid = remote_vars->act_phys_cpuid;
-       dev_dbg(xpc_part, "  remote_act_phys_cpuid = 0x%x\n",
-               part->remote_act_phys_cpuid);
-
-       part->remote_amos_page_pa = remote_vars->amos_page_pa;
-       dev_dbg(xpc_part, "  remote_amos_page_pa = 0x%lx\n",
-               part->remote_amos_page_pa);
-
-       part->remote_vars_version = remote_vars->version;
-       dev_dbg(xpc_part, "  remote_vars_version = 0x%x\n",
-               part->remote_vars_version);
-}
-
-/*
- * Prior code has determined the nasid which generated an IPI.  Inspect
- * that nasid to determine if its partition needs to be activated or
- * deactivated.
- *
- * A partition is consider "awaiting activation" if our partition
- * flags indicate it is not active and it has a heartbeat.  A
- * partition is considered "awaiting deactivation" if our partition
- * flags indicate it is active but it has no heartbeat or it is not
- * sending its heartbeat to us.
- *
- * To determine the heartbeat, the remote nasid must have a properly
- * initialized reserved page.
- */
-static void
-xpc_identify_act_IRQ_req(int nasid)
-{
-       struct xpc_rsvd_page *remote_rp;
-       struct xpc_vars *remote_vars;
-       u64 remote_rp_pa;
-       u64 remote_vars_pa;
-       int remote_rp_version;
-       int reactivate = 0;
-       int stamp_diff;
-       struct timespec remote_rp_stamp = { 0, 0 };
-       short partid;
-       struct xpc_partition *part;
-       enum xp_retval ret;
-
-       /* pull over the reserved page structure */
-
-       remote_rp = (struct xpc_rsvd_page *)xpc_remote_copy_buffer;
-
-       ret = xpc_get_remote_rp(nasid, NULL, remote_rp, &remote_rp_pa);
-       if (ret != xpSuccess) {
-               dev_warn(xpc_part, "unable to get reserved page from nasid %d, "
-                        "which sent interrupt, reason=%d\n", nasid, ret);
-               return;
-       }
-
-       remote_vars_pa = remote_rp->vars_pa;
-       remote_rp_version = remote_rp->version;
-       if (XPC_SUPPORTS_RP_STAMP(remote_rp_version))
-               remote_rp_stamp = remote_rp->stamp;
-
-       partid = remote_rp->partid;
-       part = &xpc_partitions[partid];
-
-       /* pull over the cross partition variables */
-
-       remote_vars = (struct xpc_vars *)xpc_remote_copy_buffer;
-
-       ret = xpc_get_remote_vars(remote_vars_pa, remote_vars);
-       if (ret != xpSuccess) {
-
-               dev_warn(xpc_part, "unable to get XPC variables from nasid %d, "
-                        "which sent interrupt, reason=%d\n", nasid, ret);
-
-               XPC_DEACTIVATE_PARTITION(part, ret);
-               return;
-       }
-
-       part->act_IRQ_rcvd++;
-
-       dev_dbg(xpc_part, "partid for nasid %d is %d; IRQs = %d; HB = "
-               "%ld:0x%lx\n", (int)nasid, (int)partid, part->act_IRQ_rcvd,
-               remote_vars->heartbeat, remote_vars->heartbeating_to_mask);
-
-       if (xpc_partition_disengaged(part) &&
-           part->act_state == XPC_P_INACTIVE) {
-
-               xpc_update_partition_info(part, remote_rp_version,
-                                         &remote_rp_stamp, remote_rp_pa,
-                                         remote_vars_pa, remote_vars);
-
-               if (XPC_SUPPORTS_DISENGAGE_REQUEST(part->remote_vars_version)) {
-                       if (xpc_partition_disengage_requested(1UL << partid)) {
-                               /*
-                                * Other side is waiting on us to disengage,
-                                * even though we already have.
-                                */
-                               return;
-                       }
-               } else {
-                       /* other side doesn't support disengage requests */
-                       xpc_clear_partition_disengage_request(1UL << partid);
-               }
-
-               xpc_activate_partition(part);
-               return;
-       }
-
-       DBUG_ON(part->remote_rp_version == 0);
-       DBUG_ON(part->remote_vars_version == 0);
-
-       if (!XPC_SUPPORTS_RP_STAMP(part->remote_rp_version)) {
-               DBUG_ON(XPC_SUPPORTS_DISENGAGE_REQUEST(part->
-                                                      remote_vars_version));
-
-               if (!XPC_SUPPORTS_RP_STAMP(remote_rp_version)) {
-                       DBUG_ON(XPC_SUPPORTS_DISENGAGE_REQUEST(remote_vars->
-                                                              version));
-                       /* see if the other side rebooted */
-                       if (part->remote_amos_page_pa ==
-                           remote_vars->amos_page_pa &&
-                           xpc_hb_allowed(sn_partition_id, remote_vars)) {
-                               /* doesn't look that way, so ignore the IPI */
-                               return;
-                       }
-               }
-
-               /*
-                * Other side rebooted and previous XPC didn't support the
-                * disengage request, so we don't need to do anything special.
-                */
-
-               xpc_update_partition_info(part, remote_rp_version,
-                                         &remote_rp_stamp, remote_rp_pa,
-                                         remote_vars_pa, remote_vars);
-               part->reactivate_nasid = nasid;
-               XPC_DEACTIVATE_PARTITION(part, xpReactivating);
-               return;
-       }
-
-       DBUG_ON(!XPC_SUPPORTS_DISENGAGE_REQUEST(part->remote_vars_version));
-
-       if (!XPC_SUPPORTS_RP_STAMP(remote_rp_version)) {
-               DBUG_ON(!XPC_SUPPORTS_DISENGAGE_REQUEST(remote_vars->version));
-
-               /*
-                * Other side rebooted and previous XPC did support the
-                * disengage request, but the new one doesn't.
-                */
-
-               xpc_clear_partition_engaged(1UL << partid);
-               xpc_clear_partition_disengage_request(1UL << partid);
-
-               xpc_update_partition_info(part, remote_rp_version,
-                                         &remote_rp_stamp, remote_rp_pa,
-                                         remote_vars_pa, remote_vars);
-               reactivate = 1;
-
-       } else {
-               DBUG_ON(!XPC_SUPPORTS_DISENGAGE_REQUEST(remote_vars->version));
-
-               stamp_diff = xpc_compare_stamps(&part->remote_rp_stamp,
-                                               &remote_rp_stamp);
-               if (stamp_diff != 0) {
-                       DBUG_ON(stamp_diff >= 0);
-
-                       /*
-                        * Other side rebooted and the previous XPC did support
-                        * the disengage request, as does the new one.
-                        */
-
-                       DBUG_ON(xpc_partition_engaged(1UL << partid));
-                       DBUG_ON(xpc_partition_disengage_requested(1UL <<
-                                                                 partid));
-
-                       xpc_update_partition_info(part, remote_rp_version,
-                                                 &remote_rp_stamp,
-                                                 remote_rp_pa, remote_vars_pa,
-                                                 remote_vars);
-                       reactivate = 1;
-               }
-       }
-
-       if (part->disengage_request_timeout > 0 &&
-           !xpc_partition_disengaged(part)) {
-               /* still waiting on other side to disengage from us */
-               return;
-       }
-
-       if (reactivate) {
-               part->reactivate_nasid = nasid;
-               XPC_DEACTIVATE_PARTITION(part, xpReactivating);
-
-       } else if (XPC_SUPPORTS_DISENGAGE_REQUEST(part->remote_vars_version) &&
-                  xpc_partition_disengage_requested(1UL << partid)) {
-               XPC_DEACTIVATE_PARTITION(part, xpOtherGoingDown);
+       /* check that both remote and local partids are valid for each side */
+       if (remote_rp->SAL_partid < 0 ||
+           remote_rp->SAL_partid >= xp_max_npartitions ||
+           remote_rp->max_npartitions <= xp_partition_id) {
+               return xpInvalidPartid;
        }
-}
 
-/*
- * Loop through the activation AMO variables and process any bits
- * which are set.  Each bit indicates a nasid sending a partition
- * activation or deactivation request.
- *
- * Return #of IRQs detected.
- */
-int
-xpc_identify_act_IRQ_sender(void)
-{
-       int word, bit;
-       u64 nasid_mask;
-       u64 nasid;              /* remote nasid */
-       int n_IRQs_detected = 0;
-       AMO_t *act_amos;
-
-       act_amos = xpc_vars->amos_page + XPC_ACTIVATE_IRQ_AMOS;
-
-       /* scan through act AMO variable looking for non-zero entries */
-       for (word = 0; word < xp_nasid_mask_words; word++) {
-
-               if (xpc_exiting)
-                       break;
-
-               nasid_mask = xpc_IPI_receive(&act_amos[word]);
-               if (nasid_mask == 0) {
-                       /* no IRQs from nasids in this variable */
-                       continue;
-               }
-
-               dev_dbg(xpc_part, "AMO[%d] gave back 0x%lx\n", word,
-                       nasid_mask);
-
-               /*
-                * If this nasid has been added to the machine since
-                * our partition was reset, this will retain the
-                * remote nasid in our reserved pages machine mask.
-                * This is used in the event of module reload.
-                */
-               xpc_mach_nasids[word] |= nasid_mask;
-
-               /* locate the nasid(s) which sent interrupts */
+       if (remote_rp->SAL_partid == xp_partition_id)
+               return xpLocalPartid;
 
-               for (bit = 0; bit < (8 * sizeof(u64)); bit++) {
-                       if (nasid_mask & (1UL << bit)) {
-                               n_IRQs_detected++;
-                               nasid = XPC_NASID_FROM_W_B(word, bit);
-                               dev_dbg(xpc_part, "interrupt from nasid %ld\n",
-                                       nasid);
-                               xpc_identify_act_IRQ_req(nasid);
-                       }
-               }
-       }
-       return n_IRQs_detected;
+       return xpSuccess;
 }
 
 /*
- * See if the other side has responded to a partition disengage request
- * from us.
+ * See if the other side has responded to a partition deactivate request
+ * from us. Though we requested the remote partition to deactivate with regard
+ * to us, we really only need to wait for the other side to disengage from us.
  */
 int
 xpc_partition_disengaged(struct xpc_partition *part)
@@ -828,41 +264,37 @@ xpc_partition_disengaged(struct xpc_partition *part)
        short partid = XPC_PARTID(part);
        int disengaged;
 
-       disengaged = (xpc_partition_engaged(1UL << partid) == 0);
-       if (part->disengage_request_timeout) {
+       disengaged = !xpc_partition_engaged(partid);
+       if (part->disengage_timeout) {
                if (!disengaged) {
-                       if (time_before(jiffies,
-                           part->disengage_request_timeout)) {
+                       if (time_is_after_jiffies(part->disengage_timeout)) {
                                /* timelimit hasn't been reached yet */
                                return 0;
                        }
 
                        /*
-                        * Other side hasn't responded to our disengage
+                        * Other side hasn't responded to our deactivate
                         * request in a timely fashion, so assume it's dead.
                         */
 
-                       dev_info(xpc_part, "disengage from remote partition %d "
-                                "timed out\n", partid);
-                       xpc_disengage_request_timedout = 1;
-                       xpc_clear_partition_engaged(1UL << partid);
+                       dev_info(xpc_part, "deactivate request to remote "
+                                "partition %d timed out\n", partid);
+                       xpc_disengage_timedout = 1;
+                       xpc_assume_partition_disengaged(partid);
                        disengaged = 1;
                }
-               part->disengage_request_timeout = 0;
+               part->disengage_timeout = 0;
 
                /* cancel the timer function, provided it's not us */
-               if (!in_interrupt()) {
-                       del_singleshot_timer_sync(&part->
-                                                 disengage_request_timer);
-               }
+               if (!in_interrupt())
+                       del_singleshot_timer_sync(&part->disengage_timer);
 
-               DBUG_ON(part->act_state != XPC_P_DEACTIVATING &&
-                       part->act_state != XPC_P_INACTIVE);
-               if (part->act_state != XPC_P_INACTIVE)
+               DBUG_ON(part->act_state != XPC_P_AS_DEACTIVATING &&
+                       part->act_state != XPC_P_AS_INACTIVE);
+               if (part->act_state != XPC_P_AS_INACTIVE)
                        xpc_wakeup_channel_mgr(part);
 
-               if (XPC_SUPPORTS_DISENGAGE_REQUEST(part->remote_vars_version))
-                       xpc_cancel_partition_disengage_request(part);
+               xpc_cancel_partition_deactivation_request(part);
        }
        return disengaged;
 }
@@ -879,8 +311,8 @@ xpc_mark_partition_active(struct xpc_partition *part)
        dev_dbg(xpc_part, "setting partition %d to ACTIVE\n", XPC_PARTID(part));
 
        spin_lock_irqsave(&part->act_lock, irq_flags);
-       if (part->act_state == XPC_P_ACTIVATING) {
-               part->act_state = XPC_P_ACTIVE;
+       if (part->act_state == XPC_P_AS_ACTIVATING) {
+               part->act_state = XPC_P_AS_ACTIVE;
                ret = xpSuccess;
        } else {
                DBUG_ON(part->reason == xpSuccess);
@@ -892,7 +324,7 @@ xpc_mark_partition_active(struct xpc_partition *part)
 }
 
 /*
- * Notify XPC that the partition is down.
+ * Start the process of deactivating the specified partition.
  */
 void
 xpc_deactivate_partition(const int line, struct xpc_partition *part,
@@ -902,16 +334,16 @@ xpc_deactivate_partition(const int line, struct xpc_partition *part,
 
        spin_lock_irqsave(&part->act_lock, irq_flags);
 
-       if (part->act_state == XPC_P_INACTIVE) {
+       if (part->act_state == XPC_P_AS_INACTIVE) {
                XPC_SET_REASON(part, reason, line);
                spin_unlock_irqrestore(&part->act_lock, irq_flags);
                if (reason == xpReactivating) {
                        /* we interrupt ourselves to reactivate partition */
-                       xpc_IPI_send_reactivate(part);
+                       xpc_request_partition_reactivation(part);
                }
                return;
        }
-       if (part->act_state == XPC_P_DEACTIVATING) {
+       if (part->act_state == XPC_P_AS_DEACTIVATING) {
                if ((part->reason == xpUnloading && reason != xpUnloading) ||
                    reason == xpReactivating) {
                        XPC_SET_REASON(part, reason, line);
@@ -920,22 +352,18 @@ xpc_deactivate_partition(const int line, struct xpc_partition *part,
                return;
        }
 
-       part->act_state = XPC_P_DEACTIVATING;
+       part->act_state = XPC_P_AS_DEACTIVATING;
        XPC_SET_REASON(part, reason, line);
 
        spin_unlock_irqrestore(&part->act_lock, irq_flags);
 
-       if (XPC_SUPPORTS_DISENGAGE_REQUEST(part->remote_vars_version)) {
-               xpc_request_partition_disengage(part);
-               xpc_IPI_send_disengage(part);
+       /* ask remote partition to deactivate with regard to us */
+       xpc_request_partition_deactivation(part);
 
-               /* set a timelimit on the disengage request */
-               part->disengage_request_timeout = jiffies +
-                   (xpc_disengage_request_timelimit * HZ);
-               part->disengage_request_timer.expires =
-                   part->disengage_request_timeout;
-               add_timer(&part->disengage_request_timer);
-       }
+       /* set a timelimit on the disengage phase of the deactivation request */
+       part->disengage_timeout = jiffies + (xpc_disengage_timelimit * HZ);
+       part->disengage_timer.expires = part->disengage_timeout;
+       add_timer(&part->disengage_timer);
 
        dev_dbg(xpc_part, "bringing partition %d down, reason = %d\n",
                XPC_PARTID(part), reason);
@@ -955,7 +383,7 @@ xpc_mark_partition_inactive(struct xpc_partition *part)
                XPC_PARTID(part));
 
        spin_lock_irqsave(&part->act_lock, irq_flags);
-       part->act_state = XPC_P_INACTIVE;
+       part->act_state = XPC_P_AS_INACTIVE;
        spin_unlock_irqrestore(&part->act_lock, irq_flags);
        part->remote_rp_pa = 0;
 }
@@ -974,28 +402,22 @@ xpc_discovery(void)
 {
        void *remote_rp_base;
        struct xpc_rsvd_page *remote_rp;
-       struct xpc_vars *remote_vars;
-       u64 remote_rp_pa;
-       u64 remote_vars_pa;
+       unsigned long remote_rp_pa;
        int region;
        int region_size;
        int max_regions;
        int nasid;
        struct xpc_rsvd_page *rp;
-       short partid;
-       struct xpc_partition *part;
-       u64 *discovered_nasids;
+       unsigned long *discovered_nasids;
        enum xp_retval ret;
 
        remote_rp = xpc_kmalloc_cacheline_aligned(XPC_RP_HEADER_SIZE +
-                                                 xp_nasid_mask_bytes,
+                                                 xpc_nasid_mask_nbytes,
                                                  GFP_KERNEL, &remote_rp_base);
        if (remote_rp == NULL)
                return;
 
-       remote_vars = (struct xpc_vars *)remote_rp;
-
-       discovered_nasids = kzalloc(sizeof(u64) * xp_nasid_mask_words,
+       discovered_nasids = kzalloc(sizeof(long) * xpc_nasid_mask_nlongs,
                                    GFP_KERNEL);
        if (discovered_nasids == NULL) {
                kfree(remote_rp_base);
@@ -1010,7 +432,7 @@ xpc_discovery(void)
         * protection is in regards to memory, IOI and IPI.
         */
        max_regions = 64;
-       region_size = sn_region_size;
+       region_size = xp_region_size;
 
        switch (region_size) {
        case 128:
@@ -1038,28 +460,28 @@ xpc_discovery(void)
 
                        dev_dbg(xpc_part, "checking nasid %d\n", nasid);
 
-                       if (XPC_NASID_IN_ARRAY(nasid, xpc_part_nasids)) {
+                       if (test_bit(nasid / 2, xpc_part_nasids)) {
                                dev_dbg(xpc_part, "PROM indicates Nasid %d is "
                                        "part of the local partition; skipping "
                                        "region\n", nasid);
                                break;
                        }
 
-                       if (!(XPC_NASID_IN_ARRAY(nasid, xpc_mach_nasids))) {
+                       if (!(test_bit(nasid / 2, xpc_mach_nasids))) {
                                dev_dbg(xpc_part, "PROM indicates Nasid %d was "
                                        "not on Numa-Link network at reset\n",
                                        nasid);
                                continue;
                        }
 
-                       if (XPC_NASID_IN_ARRAY(nasid, discovered_nasids)) {
+                       if (test_bit(nasid / 2, discovered_nasids)) {
                                dev_dbg(xpc_part, "Nasid %d is part of a "
                                        "partition which was previously "
                                        "discovered\n", nasid);
                                continue;
                        }
 
-                       /* pull over the reserved page structure */
+                       /* pull over the rsvd page header & part_nasids mask */
 
                        ret = xpc_get_remote_rp(nasid, discovered_nasids,
                                                remote_rp, &remote_rp_pa);
@@ -1074,72 +496,8 @@ xpc_discovery(void)
                                continue;
                        }
 
-                       remote_vars_pa = remote_rp->vars_pa;
-
-                       partid = remote_rp->partid;
-                       part = &xpc_partitions[partid];
-
-                       /* pull over the cross partition variables */
-
-                       ret = xpc_get_remote_vars(remote_vars_pa, remote_vars);
-                       if (ret != xpSuccess) {
-                               dev_dbg(xpc_part, "unable to get XPC variables "
-                                       "from nasid %d, reason=%d\n", nasid,
-                                       ret);
-
-                               XPC_DEACTIVATE_PARTITION(part, ret);
-                               continue;
-                       }
-
-                       if (part->act_state != XPC_P_INACTIVE) {
-                               dev_dbg(xpc_part, "partition %d on nasid %d is "
-                                       "already activating\n", partid, nasid);
-                               break;
-                       }
-
-                       /*
-                        * Register the remote partition's AMOs with SAL so it
-                        * can handle and cleanup errors within that address
-                        * range should the remote partition go down. We don't
-                        * unregister this range because it is difficult to
-                        * tell when outstanding writes to the remote partition
-                        * are finished and thus when it is thus safe to
-                        * unregister. This should not result in wasted space
-                        * in the SAL xp_addr_region table because we should
-                        * get the same page for remote_act_amos_pa after
-                        * module reloads and system reboots.
-                        */
-                       if (sn_register_xp_addr_region
-                           (remote_vars->amos_page_pa, PAGE_SIZE, 1) < 0) {
-                               dev_dbg(xpc_part,
-                                       "partition %d failed to "
-                                       "register xp_addr region 0x%016lx\n",
-                                       partid, remote_vars->amos_page_pa);
-
-                               XPC_SET_REASON(part, xpPhysAddrRegFailed,
-                                              __LINE__);
-                               break;
-                       }
-
-                       /*
-                        * The remote nasid is valid and available.
-                        * Send an interrupt to that nasid to notify
-                        * it that we are ready to begin activation.
-                        */
-                       dev_dbg(xpc_part, "sending an interrupt to AMO 0x%lx, "
-                               "nasid %d, phys_cpuid 0x%x\n",
-                               remote_vars->amos_page_pa,
-                               remote_vars->act_nasid,
-                               remote_vars->act_phys_cpuid);
-
-                       if (XPC_SUPPORTS_DISENGAGE_REQUEST(remote_vars->
-                                                          version)) {
-                               part->remote_amos_page_pa =
-                                   remote_vars->amos_page_pa;
-                               xpc_mark_partition_disengaged(part);
-                               xpc_cancel_partition_disengage_request(part);
-                       }
-                       xpc_IPI_send_activate(remote_vars);
+                       xpc_request_partition_activation(remote_rp,
+                                                        remote_rp_pa, nasid);
                }
        }
 
@@ -1155,20 +513,16 @@ enum xp_retval
 xpc_initiate_partid_to_nasids(short partid, void *nasid_mask)
 {
        struct xpc_partition *part;
-       u64 part_nasid_pa;
-       int bte_res;
+       unsigned long part_nasid_pa;
 
        part = &xpc_partitions[partid];
        if (part->remote_rp_pa == 0)
                return xpPartitionDown;
 
-       memset(nasid_mask, 0, XP_NASID_MASK_BYTES);
-
-       part_nasid_pa = (u64)XPC_RP_PART_NASIDS(part->remote_rp_pa);
+       memset(nasid_mask, 0, xpc_nasid_mask_nbytes);
 
-       bte_res = xp_bte_copy(part_nasid_pa, (u64)nasid_mask,
-                             xp_nasid_mask_bytes, (BTE_NOTIFY | BTE_WACQUIRE),
-                             NULL);
+       part_nasid_pa = (unsigned long)XPC_RP_PART_NASIDS(part->remote_rp_pa);
 
-       return xpc_map_bte_errors(bte_res);
+       return xp_remote_memcpy(xp_pa(nasid_mask), part_nasid_pa,
+                               xpc_nasid_mask_nbytes);
 }
diff --git a/drivers/misc/sgi-xp/xpc_sn2.c b/drivers/misc/sgi-xp/xpc_sn2.c
new file mode 100644 (file)
index 0000000..b4882cc
--- /dev/null
@@ -0,0 +1,2404 @@
+/*
+ * 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) 2008 Silicon Graphics, Inc.  All Rights Reserved.
+ */
+
+/*
+ * Cross Partition Communication (XPC) sn2-based functions.
+ *
+ *     Architecture specific implementation of common functions.
+ *
+ */
+
+#include <linux/delay.h>
+#include <asm/uncached.h>
+#include <asm/sn/mspec.h>
+#include <asm/sn/sn_sal.h>
+#include "xpc.h"
+
+/*
+ * Define the number of u64s required to represent all the C-brick nasids
+ * as a bitmap.  The cross-partition kernel modules deal only with
+ * C-brick nasids, thus the need for bitmaps which don't account for
+ * odd-numbered (non C-brick) nasids.
+ */
+#define XPC_MAX_PHYSNODES_SN2  (MAX_NUMALINK_NODES / 2)
+#define XP_NASID_MASK_BYTES_SN2        ((XPC_MAX_PHYSNODES_SN2 + 7) / 8)
+#define XP_NASID_MASK_WORDS_SN2        ((XPC_MAX_PHYSNODES_SN2 + 63) / 64)
+
+/*
+ * Memory for XPC's amo variables is allocated by the MSPEC driver. These
+ * pages are located in the lowest granule. The lowest granule uses 4k pages
+ * for cached references and an alternate TLB handler to never provide a
+ * cacheable mapping for the entire region. This will prevent speculative
+ * reading of cached copies of our lines from being issued which will cause
+ * a PI FSB Protocol error to be generated by the SHUB. For XPC, we need 64
+ * amo variables (based on XP_MAX_NPARTITIONS_SN2) to identify the senders of
+ * NOTIFY IRQs, 128 amo variables (based on XP_NASID_MASK_WORDS_SN2) to identify
+ * the senders of ACTIVATE IRQs, 1 amo variable to identify which remote
+ * partitions (i.e., XPCs) consider themselves currently engaged with the
+ * local XPC and 1 amo variable to request partition deactivation.
+ */
+#define XPC_NOTIFY_IRQ_AMOS_SN2                0
+#define XPC_ACTIVATE_IRQ_AMOS_SN2      (XPC_NOTIFY_IRQ_AMOS_SN2 + \
+                                        XP_MAX_NPARTITIONS_SN2)
+#define XPC_ENGAGED_PARTITIONS_AMO_SN2 (XPC_ACTIVATE_IRQ_AMOS_SN2 + \
+                                        XP_NASID_MASK_WORDS_SN2)
+#define XPC_DEACTIVATE_REQUEST_AMO_SN2 (XPC_ENGAGED_PARTITIONS_AMO_SN2 + 1)
+
+/*
+ * Buffer used to store a local copy of portions of a remote partition's
+ * reserved page (either its header and part_nasids mask, or its vars).
+ */
+static void *xpc_remote_copy_buffer_base_sn2;
+static char *xpc_remote_copy_buffer_sn2;
+
+static struct xpc_vars_sn2 *xpc_vars_sn2;
+static struct xpc_vars_part_sn2 *xpc_vars_part_sn2;
+
+static int
+xpc_setup_partitions_sn_sn2(void)
+{
+       /* nothing needs to be done */
+       return 0;
+}
+
+/* SH_IPI_ACCESS shub register value on startup */
+static u64 xpc_sh1_IPI_access_sn2;
+static u64 xpc_sh2_IPI_access0_sn2;
+static u64 xpc_sh2_IPI_access1_sn2;
+static u64 xpc_sh2_IPI_access2_sn2;
+static u64 xpc_sh2_IPI_access3_sn2;
+
+/*
+ * Change protections to allow IPI operations.
+ */
+static void
+xpc_allow_IPI_ops_sn2(void)
+{
+       int node;
+       int nasid;
+
+       /* !!! The following should get moved into SAL. */
+       if (is_shub2()) {
+               xpc_sh2_IPI_access0_sn2 =
+                   (u64)HUB_L((u64 *)LOCAL_MMR_ADDR(SH2_IPI_ACCESS0));
+               xpc_sh2_IPI_access1_sn2 =
+                   (u64)HUB_L((u64 *)LOCAL_MMR_ADDR(SH2_IPI_ACCESS1));
+               xpc_sh2_IPI_access2_sn2 =
+                   (u64)HUB_L((u64 *)LOCAL_MMR_ADDR(SH2_IPI_ACCESS2));
+               xpc_sh2_IPI_access3_sn2 =
+                   (u64)HUB_L((u64 *)LOCAL_MMR_ADDR(SH2_IPI_ACCESS3));
+
+               for_each_online_node(node) {
+                       nasid = cnodeid_to_nasid(node);
+                       HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS0),
+                             -1UL);
+                       HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS1),
+                             -1UL);
+                       HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS2),
+                             -1UL);
+                       HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS3),
+                             -1UL);
+               }
+       } else {
+               xpc_sh1_IPI_access_sn2 =
+                   (u64)HUB_L((u64 *)LOCAL_MMR_ADDR(SH1_IPI_ACCESS));
+
+               for_each_online_node(node) {
+                       nasid = cnodeid_to_nasid(node);
+                       HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH1_IPI_ACCESS),
+                             -1UL);
+               }
+       }
+}
+
+/*
+ * Restrict protections to disallow IPI operations.
+ */
+static void
+xpc_disallow_IPI_ops_sn2(void)
+{
+       int node;
+       int nasid;
+
+       /* !!! The following should get moved into SAL. */
+       if (is_shub2()) {
+               for_each_online_node(node) {
+                       nasid = cnodeid_to_nasid(node);
+                       HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS0),
+                             xpc_sh2_IPI_access0_sn2);
+                       HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS1),
+                             xpc_sh2_IPI_access1_sn2);
+                       HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS2),
+                             xpc_sh2_IPI_access2_sn2);
+                       HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS3),
+                             xpc_sh2_IPI_access3_sn2);
+               }
+       } else {
+               for_each_online_node(node) {
+                       nasid = cnodeid_to_nasid(node);
+                       HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH1_IPI_ACCESS),
+                             xpc_sh1_IPI_access_sn2);
+               }
+       }
+}
+
+/*
+ * The following set of functions are used for the sending and receiving of
+ * IRQs (also known as IPIs). There are two flavors of IRQs, one that is
+ * associated with partition activity (SGI_XPC_ACTIVATE) and the other that
+ * is associated with channel activity (SGI_XPC_NOTIFY).
+ */
+
+static u64
+xpc_receive_IRQ_amo_sn2(struct amo *amo)
+{
+       return FETCHOP_LOAD_OP(TO_AMO((u64)&amo->variable), FETCHOP_CLEAR);
+}
+
+static enum xp_retval
+xpc_send_IRQ_sn2(struct amo *amo, u64 flag, int nasid, int phys_cpuid,
+                int vector)
+{
+       int ret = 0;
+       unsigned long irq_flags;
+
+       local_irq_save(irq_flags);
+
+       FETCHOP_STORE_OP(TO_AMO((u64)&amo->variable), FETCHOP_OR, flag);
+       sn_send_IPI_phys(nasid, phys_cpuid, vector, 0);
+
+       /*
+        * We must always use the nofault function regardless of whether we
+        * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
+        * didn't, we'd never know that the other partition is down and would
+        * keep sending IRQs and amos to it until the heartbeat times out.
+        */
+       ret = xp_nofault_PIOR((u64 *)GLOBAL_MMR_ADDR(NASID_GET(&amo->variable),
+                                                    xp_nofault_PIOR_target));
+
+       local_irq_restore(irq_flags);
+
+       return (ret == 0) ? xpSuccess : xpPioReadError;
+}
+
+static struct amo *
+xpc_init_IRQ_amo_sn2(int index)
+{
+       struct amo *amo = xpc_vars_sn2->amos_page + index;
+
+       (void)xpc_receive_IRQ_amo_sn2(amo);     /* clear amo variable */
+       return amo;
+}
+
+/*
+ * Functions associated with SGI_XPC_ACTIVATE IRQ.
+ */
+
+/*
+ * Notify the heartbeat check thread that an activate IRQ has been received.
+ */
+static irqreturn_t
+xpc_handle_activate_IRQ_sn2(int irq, void *dev_id)
+{
+       unsigned long irq_flags;
+
+       spin_lock_irqsave(&xpc_activate_IRQ_rcvd_lock, irq_flags);
+       xpc_activate_IRQ_rcvd++;
+       spin_unlock_irqrestore(&xpc_activate_IRQ_rcvd_lock, irq_flags);
+
+       wake_up_interruptible(&xpc_activate_IRQ_wq);
+       return IRQ_HANDLED;
+}
+
+/*
+ * Flag the appropriate amo variable and send an IRQ to the specified node.
+ */
+static void
+xpc_send_activate_IRQ_sn2(unsigned long amos_page_pa, int from_nasid,
+                         int to_nasid, int to_phys_cpuid)
+{
+       struct amo *amos = (struct amo *)__va(amos_page_pa +
+                                             (XPC_ACTIVATE_IRQ_AMOS_SN2 *
+                                             sizeof(struct amo)));
+
+       (void)xpc_send_IRQ_sn2(&amos[BIT_WORD(from_nasid / 2)],
+                              BIT_MASK(from_nasid / 2), to_nasid,
+                              to_phys_cpuid, SGI_XPC_ACTIVATE);
+}
+
+static void
+xpc_send_local_activate_IRQ_sn2(int from_nasid)
+{
+       unsigned long irq_flags;
+       struct amo *amos = (struct amo *)__va(xpc_vars_sn2->amos_page_pa +
+                                             (XPC_ACTIVATE_IRQ_AMOS_SN2 *
+                                             sizeof(struct amo)));
+
+       /* fake the sending and receipt of an activate IRQ from remote nasid */
+       FETCHOP_STORE_OP(TO_AMO((u64)&amos[BIT_WORD(from_nasid / 2)].variable),
+                        FETCHOP_OR, BIT_MASK(from_nasid / 2));
+
+       spin_lock_irqsave(&xpc_activate_IRQ_rcvd_lock, irq_flags);
+       xpc_activate_IRQ_rcvd++;
+       spin_unlock_irqrestore(&xpc_activate_IRQ_rcvd_lock, irq_flags);
+
+       wake_up_interruptible(&xpc_activate_IRQ_wq);
+}
+
+/*
+ * Functions associated with SGI_XPC_NOTIFY IRQ.
+ */
+
+/*
+ * Check to see if any chctl flags were sent from the specified partition.
+ */
+static void
+xpc_check_for_sent_chctl_flags_sn2(struct xpc_partition *part)
+{
+       union xpc_channel_ctl_flags chctl;
+       unsigned long irq_flags;
+
+       chctl.all_flags = xpc_receive_IRQ_amo_sn2(part->sn.sn2.
+                                                 local_chctl_amo_va);
+       if (chctl.all_flags == 0)
+               return;
+
+       spin_lock_irqsave(&part->chctl_lock, irq_flags);
+       part->chctl.all_flags |= chctl.all_flags;
+       spin_unlock_irqrestore(&part->chctl_lock, irq_flags);
+
+       dev_dbg(xpc_chan, "received notify IRQ from partid=%d, chctl.all_flags="
+               "0x%lx\n", XPC_PARTID(part), chctl.all_flags);
+
+       xpc_wakeup_channel_mgr(part);
+}
+
+/*
+ * Handle the receipt of a SGI_XPC_NOTIFY IRQ by seeing whether the specified
+ * partition actually sent it. Since SGI_XPC_NOTIFY IRQs may be shared by more
+ * than one partition, we use an amo structure per partition to indicate
+ * whether a partition has sent an IRQ or not.  If it has, then wake up the
+ * associated kthread to handle it.
+ *
+ * All SGI_XPC_NOTIFY IRQs received by XPC are the result of IRQs sent by XPC
+ * running on other partitions.
+ *
+ * Noteworthy Arguments:
+ *
+ *     irq - Interrupt ReQuest number. NOT USED.
+ *
+ *     dev_id - partid of IRQ's potential sender.
+ */
+static irqreturn_t
+xpc_handle_notify_IRQ_sn2(int irq, void *dev_id)
+{
+       short partid = (short)(u64)dev_id;
+       struct xpc_partition *part = &xpc_partitions[partid];
+
+       DBUG_ON(partid < 0 || partid >= XP_MAX_NPARTITIONS_SN2);
+
+       if (xpc_part_ref(part)) {
+               xpc_check_for_sent_chctl_flags_sn2(part);
+
+               xpc_part_deref(part);
+       }
+       return IRQ_HANDLED;
+}
+
+/*
+ * Check to see if xpc_handle_notify_IRQ_sn2() dropped any IRQs on the floor
+ * because the write to their associated amo variable completed after the IRQ
+ * was received.
+ */
+static void
+xpc_check_for_dropped_notify_IRQ_sn2(struct xpc_partition *part)
+{
+       struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2;
+
+       if (xpc_part_ref(part)) {
+               xpc_check_for_sent_chctl_flags_sn2(part);
+
+               part_sn2->dropped_notify_IRQ_timer.expires = jiffies +
+                   XPC_DROPPED_NOTIFY_IRQ_WAIT_INTERVAL;
+               add_timer(&part_sn2->dropped_notify_IRQ_timer);
+               xpc_part_deref(part);
+       }
+}
+
+/*
+ * Send a notify IRQ to the remote partition that is associated with the
+ * specified channel.
+ */
+static void
+xpc_send_notify_IRQ_sn2(struct xpc_channel *ch, u8 chctl_flag,
+                       char *chctl_flag_string, unsigned long *irq_flags)
+{
+       struct xpc_partition *part = &xpc_partitions[ch->partid];
+       struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2;
+       union xpc_channel_ctl_flags chctl = { 0 };
+       enum xp_retval ret;
+
+       if (likely(part->act_state != XPC_P_AS_DEACTIVATING)) {
+               chctl.flags[ch->number] = chctl_flag;
+               ret = xpc_send_IRQ_sn2(part_sn2->remote_chctl_amo_va,
+                                      chctl.all_flags,
+                                      part_sn2->notify_IRQ_nasid,
+                                      part_sn2->notify_IRQ_phys_cpuid,
+                                      SGI_XPC_NOTIFY);
+               dev_dbg(xpc_chan, "%s sent to partid=%d, channel=%d, ret=%d\n",
+                       chctl_flag_string, ch->partid, ch->number, ret);
+               if (unlikely(ret != xpSuccess)) {
+                       if (irq_flags != NULL)
+                               spin_unlock_irqrestore(&ch->lock, *irq_flags);
+                       XPC_DEACTIVATE_PARTITION(part, ret);
+                       if (irq_flags != NULL)
+                               spin_lock_irqsave(&ch->lock, *irq_flags);
+               }
+       }
+}
+
+#define XPC_SEND_NOTIFY_IRQ_SN2(_ch, _ipi_f, _irq_f) \
+               xpc_send_notify_IRQ_sn2(_ch, _ipi_f, #_ipi_f, _irq_f)
+
+/*
+ * Make it look like the remote partition, which is associated with the
+ * specified channel, sent us a notify IRQ. This faked IRQ will be handled
+ * by xpc_check_for_dropped_notify_IRQ_sn2().
+ */
+static void
+xpc_send_local_notify_IRQ_sn2(struct xpc_channel *ch, u8 chctl_flag,
+                             char *chctl_flag_string)
+{
+       struct xpc_partition *part = &xpc_partitions[ch->partid];
+       union xpc_channel_ctl_flags chctl = { 0 };
+
+       chctl.flags[ch->number] = chctl_flag;
+       FETCHOP_STORE_OP(TO_AMO((u64)&part->sn.sn2.local_chctl_amo_va->
+                               variable), FETCHOP_OR, chctl.all_flags);
+       dev_dbg(xpc_chan, "%s sent local from partid=%d, channel=%d\n",
+               chctl_flag_string, ch->partid, ch->number);
+}
+
+#define XPC_SEND_LOCAL_NOTIFY_IRQ_SN2(_ch, _ipi_f) \
+               xpc_send_local_notify_IRQ_sn2(_ch, _ipi_f, #_ipi_f)
+
+static void
+xpc_send_chctl_closerequest_sn2(struct xpc_channel *ch,
+                               unsigned long *irq_flags)
+{
+       struct xpc_openclose_args *args = ch->sn.sn2.local_openclose_args;
+
+       args->reason = ch->reason;
+       XPC_SEND_NOTIFY_IRQ_SN2(ch, XPC_CHCTL_CLOSEREQUEST, irq_flags);
+}
+
+static void
+xpc_send_chctl_closereply_sn2(struct xpc_channel *ch, unsigned long *irq_flags)
+{
+       XPC_SEND_NOTIFY_IRQ_SN2(ch, XPC_CHCTL_CLOSEREPLY, irq_flags);
+}
+
+static void
+xpc_send_chctl_openrequest_sn2(struct xpc_channel *ch, unsigned long *irq_flags)
+{
+       struct xpc_openclose_args *args = ch->sn.sn2.local_openclose_args;
+
+       args->entry_size = ch->entry_size;
+       args->local_nentries = ch->local_nentries;
+       XPC_SEND_NOTIFY_IRQ_SN2(ch, XPC_CHCTL_OPENREQUEST, irq_flags);
+}
+
+static void
+xpc_send_chctl_openreply_sn2(struct xpc_channel *ch, unsigned long *irq_flags)
+{
+       struct xpc_openclose_args *args = ch->sn.sn2.local_openclose_args;
+
+       args->remote_nentries = ch->remote_nentries;
+       args->local_nentries = ch->local_nentries;
+       args->local_msgqueue_pa = xp_pa(ch->sn.sn2.local_msgqueue);
+       XPC_SEND_NOTIFY_IRQ_SN2(ch, XPC_CHCTL_OPENREPLY, irq_flags);
+}
+
+static void
+xpc_send_chctl_msgrequest_sn2(struct xpc_channel *ch)
+{
+       XPC_SEND_NOTIFY_IRQ_SN2(ch, XPC_CHCTL_MSGREQUEST, NULL);
+}
+
+static void
+xpc_send_chctl_local_msgrequest_sn2(struct xpc_channel *ch)
+{
+       XPC_SEND_LOCAL_NOTIFY_IRQ_SN2(ch, XPC_CHCTL_MSGREQUEST);
+}
+
+static void
+xpc_save_remote_msgqueue_pa_sn2(struct xpc_channel *ch,
+                               unsigned long msgqueue_pa)
+{
+       ch->sn.sn2.remote_msgqueue_pa = msgqueue_pa;
+}
+
+/*
+ * This next set of functions are used to keep track of when a partition is
+ * potentially engaged in accessing memory belonging to another partition.
+ */
+
+static void
+xpc_indicate_partition_engaged_sn2(struct xpc_partition *part)
+{
+       unsigned long irq_flags;
+       struct amo *amo = (struct amo *)__va(part->sn.sn2.remote_amos_page_pa +
+                                            (XPC_ENGAGED_PARTITIONS_AMO_SN2 *
+                                            sizeof(struct amo)));
+
+       local_irq_save(irq_flags);
+
+       /* set bit corresponding to our partid in remote partition's amo */
+       FETCHOP_STORE_OP(TO_AMO((u64)&amo->variable), FETCHOP_OR,
+                        BIT(sn_partition_id));
+
+       /*
+        * We must always use the nofault function regardless of whether we
+        * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
+        * didn't, we'd never know that the other partition is down and would
+        * keep sending IRQs and amos to it until the heartbeat times out.
+        */
+       (void)xp_nofault_PIOR((u64 *)GLOBAL_MMR_ADDR(NASID_GET(&amo->
+                                                              variable),
+                                                    xp_nofault_PIOR_target));
+
+       local_irq_restore(irq_flags);
+}
+
+static void
+xpc_indicate_partition_disengaged_sn2(struct xpc_partition *part)
+{
+       struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2;
+       unsigned long irq_flags;
+       struct amo *amo = (struct amo *)__va(part_sn2->remote_amos_page_pa +
+                                            (XPC_ENGAGED_PARTITIONS_AMO_SN2 *
+                                            sizeof(struct amo)));
+
+       local_irq_save(irq_flags);
+
+       /* clear bit corresponding to our partid in remote partition's amo */
+       FETCHOP_STORE_OP(TO_AMO((u64)&amo->variable), FETCHOP_AND,
+                        ~BIT(sn_partition_id));
+
+       /*
+        * We must always use the nofault function regardless of whether we
+        * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
+        * didn't, we'd never know that the other partition is down and would
+        * keep sending IRQs and amos to it until the heartbeat times out.
+        */
+       (void)xp_nofault_PIOR((u64 *)GLOBAL_MMR_ADDR(NASID_GET(&amo->
+                                                              variable),
+                                                    xp_nofault_PIOR_target));
+
+       local_irq_restore(irq_flags);
+
+       /*
+        * Send activate IRQ to get other side to see that we've cleared our
+        * bit in their engaged partitions amo.
+        */
+       xpc_send_activate_IRQ_sn2(part_sn2->remote_amos_page_pa,
+                                 cnodeid_to_nasid(0),
+                                 part_sn2->activate_IRQ_nasid,
+                                 part_sn2->activate_IRQ_phys_cpuid);
+}
+
+static void
+xpc_assume_partition_disengaged_sn2(short partid)
+{
+       struct amo *amo = xpc_vars_sn2->amos_page +
+                         XPC_ENGAGED_PARTITIONS_AMO_SN2;
+
+       /* clear bit(s) based on partid mask in our partition's amo */
+       FETCHOP_STORE_OP(TO_AMO((u64)&amo->variable), FETCHOP_AND,
+                        ~BIT(partid));
+}
+
+static int
+xpc_partition_engaged_sn2(short partid)
+{
+       struct amo *amo = xpc_vars_sn2->amos_page +
+                         XPC_ENGAGED_PARTITIONS_AMO_SN2;
+
+       /* our partition's amo variable ANDed with partid mask */
+       return (FETCHOP_LOAD_OP(TO_AMO((u64)&amo->variable), FETCHOP_LOAD) &
+               BIT(partid)) != 0;
+}
+
+static int
+xpc_any_partition_engaged_sn2(void)
+{
+       struct amo *amo = xpc_vars_sn2->amos_page +
+                         XPC_ENGAGED_PARTITIONS_AMO_SN2;
+
+       /* our partition's amo variable */
+       return FETCHOP_LOAD_OP(TO_AMO((u64)&amo->variable), FETCHOP_LOAD) != 0;
+}
+
+/* original protection values for each node */
+static u64 xpc_prot_vec_sn2[MAX_NUMNODES];
+
+/*
+ * Change protections to allow amo operations on non-Shub 1.1 systems.
+ */
+static enum xp_retval
+xpc_allow_amo_ops_sn2(struct amo *amos_page)
+{
+       u64 nasid_array = 0;
+       int ret;
+
+       /*
+        * On SHUB 1.1, we cannot call sn_change_memprotect() since the BIST
+        * collides with memory operations. On those systems we call
+        * xpc_allow_amo_ops_shub_wars_1_1_sn2() instead.
+        */
+       if (!enable_shub_wars_1_1()) {
+               ret = sn_change_memprotect(ia64_tpa((u64)amos_page), PAGE_SIZE,
+                                          SN_MEMPROT_ACCESS_CLASS_1,
+                                          &nasid_array);
+               if (ret != 0)
+                       return xpSalError;
+       }
+       return xpSuccess;
+}
+
+/*
+ * Change protections to allow amo operations on Shub 1.1 systems.
+ */
+static void
+xpc_allow_amo_ops_shub_wars_1_1_sn2(void)
+{
+       int node;
+       int nasid;
+
+       if (!enable_shub_wars_1_1())
+               return;
+
+       for_each_online_node(node) {
+               nasid = cnodeid_to_nasid(node);
+               /* save current protection values */
+               xpc_prot_vec_sn2[node] =
+                   (u64)HUB_L((u64 *)GLOBAL_MMR_ADDR(nasid,
+                                                 SH1_MD_DQLP_MMR_DIR_PRIVEC0));
+               /* open up everything */
+               HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid,
+                                            SH1_MD_DQLP_MMR_DIR_PRIVEC0),
+                     -1UL);
+               HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid,
+                                            SH1_MD_DQRP_MMR_DIR_PRIVEC0),
+                     -1UL);
+       }
+}
+
+static enum xp_retval
+xpc_get_partition_rsvd_page_pa_sn2(void *buf, u64 *cookie, unsigned long *rp_pa,
+                                  size_t *len)
+{
+       s64 status;
+       enum xp_retval ret;
+
+       status = sn_partition_reserved_page_pa((u64)buf, cookie, rp_pa, len);
+       if (status == SALRET_OK)
+               ret = xpSuccess;
+       else if (status == SALRET_MORE_PASSES)
+               ret = xpNeedMoreInfo;
+       else
+               ret = xpSalError;
+
+       return ret;
+}
+
+
+static int
+xpc_setup_rsvd_page_sn_sn2(struct xpc_rsvd_page *rp)
+{
+       struct amo *amos_page;
+       int i;
+       int ret;
+
+       xpc_vars_sn2 = XPC_RP_VARS(rp);
+
+       rp->sn.vars_pa = xp_pa(xpc_vars_sn2);
+
+       /* vars_part array follows immediately after vars */
+       xpc_vars_part_sn2 = (struct xpc_vars_part_sn2 *)((u8 *)XPC_RP_VARS(rp) +
+                                                        XPC_RP_VARS_SIZE);
+
+       /*
+        * Before clearing xpc_vars_sn2, see if a page of amos had been
+        * previously allocated. If not we'll need to allocate one and set
+        * permissions so that cross-partition amos are allowed.
+        *
+        * The allocated amo page needs MCA reporting to remain disabled after
+        * XPC has unloaded.  To make this work, we keep a copy of the pointer
+        * to this page (i.e., amos_page) in the struct xpc_vars_sn2 structure,
+        * which is pointed to by the reserved page, and re-use that saved copy
+        * on subsequent loads of XPC. This amo page is never freed, and its
+        * memory protections are never restricted.
+        */
+       amos_page = xpc_vars_sn2->amos_page;
+       if (amos_page == NULL) {
+               amos_page = (struct amo *)TO_AMO(uncached_alloc_page(0, 1));
+               if (amos_page == NULL) {
+                       dev_err(xpc_part, "can't allocate page of amos\n");
+                       return -ENOMEM;
+               }
+
+               /*
+                * Open up amo-R/W to cpu.  This is done on Shub 1.1 systems
+                * when xpc_allow_amo_ops_shub_wars_1_1_sn2() is called.
+                */
+               ret = xpc_allow_amo_ops_sn2(amos_page);
+               if (ret != xpSuccess) {
+                       dev_err(xpc_part, "can't allow amo operations\n");
+                       uncached_free_page(__IA64_UNCACHED_OFFSET |
+                                          TO_PHYS((u64)amos_page), 1);
+                       return -EPERM;
+               }
+       }
+
+       /* clear xpc_vars_sn2 */
+       memset(xpc_vars_sn2, 0, sizeof(struct xpc_vars_sn2));
+
+       xpc_vars_sn2->version = XPC_V_VERSION;
+       xpc_vars_sn2->activate_IRQ_nasid = cpuid_to_nasid(0);
+       xpc_vars_sn2->activate_IRQ_phys_cpuid = cpu_physical_id(0);
+       xpc_vars_sn2->vars_part_pa = xp_pa(xpc_vars_part_sn2);
+       xpc_vars_sn2->amos_page_pa = ia64_tpa((u64)amos_page);
+       xpc_vars_sn2->amos_page = amos_page;    /* save for next load of XPC */
+
+       /* clear xpc_vars_part_sn2 */
+       memset((u64 *)xpc_vars_part_sn2, 0, sizeof(struct xpc_vars_part_sn2) *
+              XP_MAX_NPARTITIONS_SN2);
+
+       /* initialize the activate IRQ related amo variables */
+       for (i = 0; i < xpc_nasid_mask_nlongs; i++)
+               (void)xpc_init_IRQ_amo_sn2(XPC_ACTIVATE_IRQ_AMOS_SN2 + i);
+
+       /* initialize the engaged remote partitions related amo variables */
+       (void)xpc_init_IRQ_amo_sn2(XPC_ENGAGED_PARTITIONS_AMO_SN2);
+       (void)xpc_init_IRQ_amo_sn2(XPC_DEACTIVATE_REQUEST_AMO_SN2);
+
+       return 0;
+}
+
+static void
+xpc_increment_heartbeat_sn2(void)
+{
+       xpc_vars_sn2->heartbeat++;
+}
+
+static void
+xpc_offline_heartbeat_sn2(void)
+{
+       xpc_increment_heartbeat_sn2();
+       xpc_vars_sn2->heartbeat_offline = 1;
+}
+
+static void
+xpc_online_heartbeat_sn2(void)
+{
+       xpc_increment_heartbeat_sn2();
+       xpc_vars_sn2->heartbeat_offline = 0;
+}
+
+static void
+xpc_heartbeat_init_sn2(void)
+{
+       DBUG_ON(xpc_vars_sn2 == NULL);
+
+       bitmap_zero(xpc_vars_sn2->heartbeating_to_mask, XP_MAX_NPARTITIONS_SN2);
+       xpc_heartbeating_to_mask = &xpc_vars_sn2->heartbeating_to_mask[0];
+       xpc_online_heartbeat_sn2();
+}
+
+static void
+xpc_heartbeat_exit_sn2(void)
+{
+       xpc_offline_heartbeat_sn2();
+}
+
+static enum xp_retval
+xpc_get_remote_heartbeat_sn2(struct xpc_partition *part)
+{
+       struct xpc_vars_sn2 *remote_vars;
+       enum xp_retval ret;
+
+       remote_vars = (struct xpc_vars_sn2 *)xpc_remote_copy_buffer_sn2;
+
+       /* pull the remote vars structure that contains the heartbeat */
+       ret = xp_remote_memcpy(xp_pa(remote_vars),
+                              part->sn.sn2.remote_vars_pa,
+                              XPC_RP_VARS_SIZE);
+       if (ret != xpSuccess)
+               return ret;
+
+       dev_dbg(xpc_part, "partid=%d, heartbeat=%ld, last_heartbeat=%ld, "
+               "heartbeat_offline=%ld, HB_mask[0]=0x%lx\n", XPC_PARTID(part),
+               remote_vars->heartbeat, part->last_heartbeat,
+               remote_vars->heartbeat_offline,
+               remote_vars->heartbeating_to_mask[0]);
+
+       if ((remote_vars->heartbeat == part->last_heartbeat &&
+           remote_vars->heartbeat_offline == 0) ||
+           !xpc_hb_allowed(sn_partition_id,
+                           &remote_vars->heartbeating_to_mask)) {
+               ret = xpNoHeartbeat;
+       } else {
+               part->last_heartbeat = remote_vars->heartbeat;
+       }
+
+       return ret;
+}
+
+/*
+ * Get a copy of the remote partition's XPC variables from the reserved page.
+ *
+ * remote_vars points to a buffer that is cacheline aligned for BTE copies and
+ * assumed to be of size XPC_RP_VARS_SIZE.
+ */
+static enum xp_retval
+xpc_get_remote_vars_sn2(unsigned long remote_vars_pa,
+                       struct xpc_vars_sn2 *remote_vars)
+{
+       enum xp_retval ret;
+
+       if (remote_vars_pa == 0)
+               return xpVarsNotSet;
+
+       /* pull over the cross partition variables */
+       ret = xp_remote_memcpy(xp_pa(remote_vars), remote_vars_pa,
+                              XPC_RP_VARS_SIZE);
+       if (ret != xpSuccess)
+               return ret;
+
+       if (XPC_VERSION_MAJOR(remote_vars->version) !=
+           XPC_VERSION_MAJOR(XPC_V_VERSION)) {
+               return xpBadVersion;
+       }
+
+       return xpSuccess;
+}
+
+static void
+xpc_request_partition_activation_sn2(struct xpc_rsvd_page *remote_rp,
+                                    unsigned long remote_rp_pa, int nasid)
+{
+       xpc_send_local_activate_IRQ_sn2(nasid);
+}
+
+static void
+xpc_request_partition_reactivation_sn2(struct xpc_partition *part)
+{
+       xpc_send_local_activate_IRQ_sn2(part->sn.sn2.activate_IRQ_nasid);
+}
+
+static void
+xpc_request_partition_deactivation_sn2(struct xpc_partition *part)
+{
+       struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2;
+       unsigned long irq_flags;
+       struct amo *amo = (struct amo *)__va(part_sn2->remote_amos_page_pa +
+                                            (XPC_DEACTIVATE_REQUEST_AMO_SN2 *
+                                            sizeof(struct amo)));
+
+       local_irq_save(irq_flags);
+
+       /* set bit corresponding to our partid in remote partition's amo */
+       FETCHOP_STORE_OP(TO_AMO((u64)&amo->variable), FETCHOP_OR,
+                        BIT(sn_partition_id));
+
+       /*
+        * We must always use the nofault function regardless of whether we
+        * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
+        * didn't, we'd never know that the other partition is down and would
+        * keep sending IRQs and amos to it until the heartbeat times out.
+        */
+       (void)xp_nofault_PIOR((u64 *)GLOBAL_MMR_ADDR(NASID_GET(&amo->
+                                                              variable),
+                                                    xp_nofault_PIOR_target));
+
+       local_irq_restore(irq_flags);
+
+       /*
+        * Send activate IRQ to get other side to see that we've set our
+        * bit in their deactivate request amo.
+        */
+       xpc_send_activate_IRQ_sn2(part_sn2->remote_amos_page_pa,
+                                 cnodeid_to_nasid(0),
+                                 part_sn2->activate_IRQ_nasid,
+                                 part_sn2->activate_IRQ_phys_cpuid);
+}
+
+static void
+xpc_cancel_partition_deactivation_request_sn2(struct xpc_partition *part)
+{
+       unsigned long irq_flags;
+       struct amo *amo = (struct amo *)__va(part->sn.sn2.remote_amos_page_pa +
+                                            (XPC_DEACTIVATE_REQUEST_AMO_SN2 *
+                                            sizeof(struct amo)));
+
+       local_irq_save(irq_flags);
+
+       /* clear bit corresponding to our partid in remote partition's amo */
+       FETCHOP_STORE_OP(TO_AMO((u64)&amo->variable), FETCHOP_AND,
+                        ~BIT(sn_partition_id));
+
+       /*
+        * We must always use the nofault function regardless of whether we
+        * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
+        * didn't, we'd never know that the other partition is down and would
+        * keep sending IRQs and amos to it until the heartbeat times out.
+        */
+       (void)xp_nofault_PIOR((u64 *)GLOBAL_MMR_ADDR(NASID_GET(&amo->
+                                                              variable),
+                                                    xp_nofault_PIOR_target));
+
+       local_irq_restore(irq_flags);
+}
+
+static int
+xpc_partition_deactivation_requested_sn2(short partid)
+{
+       struct amo *amo = xpc_vars_sn2->amos_page +
+                         XPC_DEACTIVATE_REQUEST_AMO_SN2;
+
+       /* our partition's amo variable ANDed with partid mask */
+       return (FETCHOP_LOAD_OP(TO_AMO((u64)&amo->variable), FETCHOP_LOAD) &
+               BIT(partid)) != 0;
+}
+
+/*
+ * Update the remote partition's info.
+ */
+static void
+xpc_update_partition_info_sn2(struct xpc_partition *part, u8 remote_rp_version,
+                             unsigned long *remote_rp_ts_jiffies,
+                             unsigned long remote_rp_pa,
+                             unsigned long remote_vars_pa,
+                             struct xpc_vars_sn2 *remote_vars)
+{
+       struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2;
+
+       part->remote_rp_version = remote_rp_version;
+       dev_dbg(xpc_part, "  remote_rp_version = 0x%016x\n",
+               part->remote_rp_version);
+
+       part->remote_rp_ts_jiffies = *remote_rp_ts_jiffies;
+       dev_dbg(xpc_part, "  remote_rp_ts_jiffies = 0x%016lx\n",
+               part->remote_rp_ts_jiffies);
+
+       part->remote_rp_pa = remote_rp_pa;
+       dev_dbg(xpc_part, "  remote_rp_pa = 0x%016lx\n", part->remote_rp_pa);
+
+       part_sn2->remote_vars_pa = remote_vars_pa;
+       dev_dbg(xpc_part, "  remote_vars_pa = 0x%016lx\n",
+               part_sn2->remote_vars_pa);
+
+       part->last_heartbeat = remote_vars->heartbeat;
+       dev_dbg(xpc_part, "  last_heartbeat = 0x%016lx\n",
+               part->last_heartbeat);
+
+       part_sn2->remote_vars_part_pa = remote_vars->vars_part_pa;
+       dev_dbg(xpc_part, "  remote_vars_part_pa = 0x%016lx\n",
+               part_sn2->remote_vars_part_pa);
+
+       part_sn2->activate_IRQ_nasid = remote_vars->activate_IRQ_nasid;
+       dev_dbg(xpc_part, "  activate_IRQ_nasid = 0x%x\n",
+               part_sn2->activate_IRQ_nasid);
+
+       part_sn2->activate_IRQ_phys_cpuid =
+           remote_vars->activate_IRQ_phys_cpuid;
+       dev_dbg(xpc_part, "  activate_IRQ_phys_cpuid = 0x%x\n",
+               part_sn2->activate_IRQ_phys_cpuid);
+
+       part_sn2->remote_amos_page_pa = remote_vars->amos_page_pa;
+       dev_dbg(xpc_part, "  remote_amos_page_pa = 0x%lx\n",
+               part_sn2->remote_amos_page_pa);
+
+       part_sn2->remote_vars_version = remote_vars->version;
+       dev_dbg(xpc_part, "  remote_vars_version = 0x%x\n",
+               part_sn2->remote_vars_version);
+}
+
+/*
+ * Prior code has determined the nasid which generated a activate IRQ.
+ * Inspect that nasid to determine if its partition needs to be activated
+ * or deactivated.
+ *
+ * A partition is considered "awaiting activation" if our partition
+ * flags indicate it is not active and it has a heartbeat.  A
+ * partition is considered "awaiting deactivation" if our partition
+ * flags indicate it is active but it has no heartbeat or it is not
+ * sending its heartbeat to us.
+ *
+ * To determine the heartbeat, the remote nasid must have a properly
+ * initialized reserved page.
+ */
+static void
+xpc_identify_activate_IRQ_req_sn2(int nasid)
+{
+       struct xpc_rsvd_page *remote_rp;
+       struct xpc_vars_sn2 *remote_vars;
+       unsigned long remote_rp_pa;
+       unsigned long remote_vars_pa;
+       int remote_rp_version;
+       int reactivate = 0;
+       unsigned long remote_rp_ts_jiffies = 0;
+       short partid;
+       struct xpc_partition *part;
+       struct xpc_partition_sn2 *part_sn2;
+       enum xp_retval ret;
+
+       /* pull over the reserved page structure */
+
+       remote_rp = (struct xpc_rsvd_page *)xpc_remote_copy_buffer_sn2;
+
+       ret = xpc_get_remote_rp(nasid, NULL, remote_rp, &remote_rp_pa);
+       if (ret != xpSuccess) {
+               dev_warn(xpc_part, "unable to get reserved page from nasid %d, "
+                        "which sent interrupt, reason=%d\n", nasid, ret);
+               return;
+       }
+
+       remote_vars_pa = remote_rp->sn.vars_pa;
+       remote_rp_version = remote_rp->version;
+       remote_rp_ts_jiffies = remote_rp->ts_jiffies;
+
+       partid = remote_rp->SAL_partid;
+       part = &xpc_partitions[partid];
+       part_sn2 = &part->sn.sn2;
+
+       /* pull over the cross partition variables */
+
+       remote_vars = (struct xpc_vars_sn2 *)xpc_remote_copy_buffer_sn2;
+
+       ret = xpc_get_remote_vars_sn2(remote_vars_pa, remote_vars);
+       if (ret != xpSuccess) {
+               dev_warn(xpc_part, "unable to get XPC variables from nasid %d, "
+                        "which sent interrupt, reason=%d\n", nasid, ret);
+
+               XPC_DEACTIVATE_PARTITION(part, ret);
+               return;
+       }
+
+       part->activate_IRQ_rcvd++;
+
+       dev_dbg(xpc_part, "partid for nasid %d is %d; IRQs = %d; HB = "
+               "%ld:0x%lx\n", (int)nasid, (int)partid, part->activate_IRQ_rcvd,
+               remote_vars->heartbeat, remote_vars->heartbeating_to_mask[0]);
+
+       if (xpc_partition_disengaged(part) &&
+           part->act_state == XPC_P_AS_INACTIVE) {
+
+               xpc_update_partition_info_sn2(part, remote_rp_version,
+                                             &remote_rp_ts_jiffies,
+                                             remote_rp_pa, remote_vars_pa,
+                                             remote_vars);
+
+               if (xpc_partition_deactivation_requested_sn2(partid)) {
+                       /*
+                        * Other side is waiting on us to deactivate even though
+                        * we already have.
+                        */
+                       return;
+               }
+
+               xpc_activate_partition(part);
+               return;
+       }
+
+       DBUG_ON(part->remote_rp_version == 0);
+       DBUG_ON(part_sn2->remote_vars_version == 0);
+
+       if (remote_rp_ts_jiffies != part->remote_rp_ts_jiffies) {
+
+               /* the other side rebooted */
+
+               DBUG_ON(xpc_partition_engaged_sn2(partid));
+               DBUG_ON(xpc_partition_deactivation_requested_sn2(partid));
+
+               xpc_update_partition_info_sn2(part, remote_rp_version,
+                                             &remote_rp_ts_jiffies,
+                                             remote_rp_pa, remote_vars_pa,
+                                             remote_vars);
+               reactivate = 1;
+       }
+
+       if (part->disengage_timeout > 0 && !xpc_partition_disengaged(part)) {
+               /* still waiting on other side to disengage from us */
+               return;
+       }
+
+       if (reactivate)
+               XPC_DEACTIVATE_PARTITION(part, xpReactivating);
+       else if (xpc_partition_deactivation_requested_sn2(partid))
+               XPC_DEACTIVATE_PARTITION(part, xpOtherGoingDown);
+}
+
+/*
+ * Loop through the activation amo variables and process any bits
+ * which are set.  Each bit indicates a nasid sending a partition
+ * activation or deactivation request.
+ *
+ * Return #of IRQs detected.
+ */
+int
+xpc_identify_activate_IRQ_sender_sn2(void)
+{
+       int l;
+       int b;
+       unsigned long nasid_mask_long;
+       u64 nasid;              /* remote nasid */
+       int n_IRQs_detected = 0;
+       struct amo *act_amos;
+
+       act_amos = xpc_vars_sn2->amos_page + XPC_ACTIVATE_IRQ_AMOS_SN2;
+
+       /* scan through activate amo variables looking for non-zero entries */
+       for (l = 0; l < xpc_nasid_mask_nlongs; l++) {
+
+               if (xpc_exiting)
+                       break;
+
+               nasid_mask_long = xpc_receive_IRQ_amo_sn2(&act_amos[l]);
+
+               b = find_first_bit(&nasid_mask_long, BITS_PER_LONG);
+               if (b >= BITS_PER_LONG) {
+                       /* no IRQs from nasids in this amo variable */
+                       continue;
+               }
+
+               dev_dbg(xpc_part, "amo[%d] gave back 0x%lx\n", l,
+                       nasid_mask_long);
+
+               /*
+                * If this nasid has been added to the machine since
+                * our partition was reset, this will retain the
+                * remote nasid in our reserved pages machine mask.
+                * This is used in the event of module reload.
+                */
+               xpc_mach_nasids[l] |= nasid_mask_long;
+
+               /* locate the nasid(s) which sent interrupts */
+
+               do {
+                       n_IRQs_detected++;
+                       nasid = (l * BITS_PER_LONG + b) * 2;
+                       dev_dbg(xpc_part, "interrupt from nasid %ld\n", nasid);
+                       xpc_identify_activate_IRQ_req_sn2(nasid);
+
+                       b = find_next_bit(&nasid_mask_long, BITS_PER_LONG,
+                                         b + 1);
+               } while (b < BITS_PER_LONG);
+       }
+       return n_IRQs_detected;
+}
+
+static void
+xpc_process_activate_IRQ_rcvd_sn2(void)
+{
+       unsigned long irq_flags;
+       int n_IRQs_expected;
+       int n_IRQs_detected;
+
+       DBUG_ON(xpc_activate_IRQ_rcvd == 0);
+
+       spin_lock_irqsave(&xpc_activate_IRQ_rcvd_lock, irq_flags);
+       n_IRQs_expected = xpc_activate_IRQ_rcvd;
+       xpc_activate_IRQ_rcvd = 0;
+       spin_unlock_irqrestore(&xpc_activate_IRQ_rcvd_lock, irq_flags);
+
+       n_IRQs_detected = xpc_identify_activate_IRQ_sender_sn2();
+       if (n_IRQs_detected < n_IRQs_expected) {
+               /* retry once to help avoid missing amo */
+               (void)xpc_identify_activate_IRQ_sender_sn2();
+       }
+}
+
+/*
+ * Setup the channel structures that are sn2 specific.
+ */
+static enum xp_retval
+xpc_setup_ch_structures_sn_sn2(struct xpc_partition *part)
+{
+       struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2;
+       struct xpc_channel_sn2 *ch_sn2;
+       enum xp_retval retval;
+       int ret;
+       int cpuid;
+       int ch_number;
+       struct timer_list *timer;
+       short partid = XPC_PARTID(part);
+
+       /* allocate all the required GET/PUT values */
+
+       part_sn2->local_GPs =
+           xpc_kzalloc_cacheline_aligned(XPC_GP_SIZE, GFP_KERNEL,
+                                         &part_sn2->local_GPs_base);
+       if (part_sn2->local_GPs == NULL) {
+               dev_err(xpc_chan, "can't get memory for local get/put "
+                       "values\n");
+               return xpNoMemory;
+       }
+
+       part_sn2->remote_GPs =
+           xpc_kzalloc_cacheline_aligned(XPC_GP_SIZE, GFP_KERNEL,
+                                         &part_sn2->remote_GPs_base);
+       if (part_sn2->remote_GPs == NULL) {
+               dev_err(xpc_chan, "can't get memory for remote get/put "
+                       "values\n");
+               retval = xpNoMemory;
+               goto out_1;
+       }
+
+       part_sn2->remote_GPs_pa = 0;
+
+       /* allocate all the required open and close args */
+
+       part_sn2->local_openclose_args =
+           xpc_kzalloc_cacheline_aligned(XPC_OPENCLOSE_ARGS_SIZE,
+                                         GFP_KERNEL, &part_sn2->
+                                         local_openclose_args_base);
+       if (part_sn2->local_openclose_args == NULL) {
+               dev_err(xpc_chan, "can't get memory for local connect args\n");
+               retval = xpNoMemory;
+               goto out_2;
+       }
+
+       part_sn2->remote_openclose_args_pa = 0;
+
+       part_sn2->local_chctl_amo_va = xpc_init_IRQ_amo_sn2(partid);
+
+       part_sn2->notify_IRQ_nasid = 0;
+       part_sn2->notify_IRQ_phys_cpuid = 0;
+       part_sn2->remote_chctl_amo_va = NULL;
+
+       sprintf(part_sn2->notify_IRQ_owner, "xpc%02d", partid);
+       ret = request_irq(SGI_XPC_NOTIFY, xpc_handle_notify_IRQ_sn2,
+                         IRQF_SHARED, part_sn2->notify_IRQ_owner,
+                         (void *)(u64)partid);
+       if (ret != 0) {
+               dev_err(xpc_chan, "can't register NOTIFY IRQ handler, "
+                       "errno=%d\n", -ret);
+               retval = xpLackOfResources;
+               goto out_3;
+       }
+
+       /* Setup a timer to check for dropped notify IRQs */
+       timer = &part_sn2->dropped_notify_IRQ_timer;
+       init_timer(timer);
+       timer->function =
+           (void (*)(unsigned long))xpc_check_for_dropped_notify_IRQ_sn2;
+       timer->data = (unsigned long)part;
+       timer->expires = jiffies + XPC_DROPPED_NOTIFY_IRQ_WAIT_INTERVAL;
+       add_timer(timer);
+
+       for (ch_number = 0; ch_number < part->nchannels; ch_number++) {
+               ch_sn2 = &part->channels[ch_number].sn.sn2;
+
+               ch_sn2->local_GP = &part_sn2->local_GPs[ch_number];
+               ch_sn2->local_openclose_args =
+                   &part_sn2->local_openclose_args[ch_number];
+
+               mutex_init(&ch_sn2->msg_to_pull_mutex);
+       }
+
+       /*
+        * Setup the per partition specific variables required by the
+        * remote partition to establish channel connections with us.
+        *
+        * The setting of the magic # indicates that these per partition
+        * specific variables are ready to be used.
+        */
+       xpc_vars_part_sn2[partid].GPs_pa = xp_pa(part_sn2->local_GPs);
+       xpc_vars_part_sn2[partid].openclose_args_pa =
+           xp_pa(part_sn2->local_openclose_args);
+       xpc_vars_part_sn2[partid].chctl_amo_pa =
+           xp_pa(part_sn2->local_chctl_amo_va);
+       cpuid = raw_smp_processor_id(); /* any CPU in this partition will do */
+       xpc_vars_part_sn2[partid].notify_IRQ_nasid = cpuid_to_nasid(cpuid);
+       xpc_vars_part_sn2[partid].notify_IRQ_phys_cpuid =
+           cpu_physical_id(cpuid);
+       xpc_vars_part_sn2[partid].nchannels = part->nchannels;
+       xpc_vars_part_sn2[partid].magic = XPC_VP_MAGIC1_SN2;
+
+       return xpSuccess;
+
+       /* setup of ch structures failed */
+out_3:
+       kfree(part_sn2->local_openclose_args_base);
+       part_sn2->local_openclose_args = NULL;
+out_2:
+       kfree(part_sn2->remote_GPs_base);
+       part_sn2->remote_GPs = NULL;
+out_1:
+       kfree(part_sn2->local_GPs_base);
+       part_sn2->local_GPs = NULL;
+       return retval;
+}
+
+/*
+ * Teardown the channel structures that are sn2 specific.
+ */
+static void
+xpc_teardown_ch_structures_sn_sn2(struct xpc_partition *part)
+{
+       struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2;
+       short partid = XPC_PARTID(part);
+
+       /*
+        * Indicate that the variables specific to the remote partition are no
+        * longer available for its use.
+        */
+       xpc_vars_part_sn2[partid].magic = 0;
+
+       /* in case we've still got outstanding timers registered... */
+       del_timer_sync(&part_sn2->dropped_notify_IRQ_timer);
+       free_irq(SGI_XPC_NOTIFY, (void *)(u64)partid);
+
+       kfree(part_sn2->local_openclose_args_base);
+       part_sn2->local_openclose_args = NULL;
+       kfree(part_sn2->remote_GPs_base);
+       part_sn2->remote_GPs = NULL;
+       kfree(part_sn2->local_GPs_base);
+       part_sn2->local_GPs = NULL;
+       part_sn2->local_chctl_amo_va = NULL;
+}
+
+/*
+ * Create a wrapper that hides the underlying mechanism for pulling a cacheline
+ * (or multiple cachelines) from a remote partition.
+ *
+ * src_pa must be a cacheline aligned physical address on the remote partition.
+ * dst must be a cacheline aligned virtual address on this partition.
+ * cnt must be cacheline sized
+ */
+/* ??? Replace this function by call to xp_remote_memcpy() or bte_copy()? */
+static enum xp_retval
+xpc_pull_remote_cachelines_sn2(struct xpc_partition *part, void *dst,
+                              const unsigned long src_pa, size_t cnt)
+{
+       enum xp_retval ret;
+
+       DBUG_ON(src_pa != L1_CACHE_ALIGN(src_pa));
+       DBUG_ON((unsigned long)dst != L1_CACHE_ALIGN((unsigned long)dst));
+       DBUG_ON(cnt != L1_CACHE_ALIGN(cnt));
+
+       if (part->act_state == XPC_P_AS_DEACTIVATING)
+               return part->reason;
+
+       ret = xp_remote_memcpy(xp_pa(dst), src_pa, cnt);
+       if (ret != xpSuccess) {
+               dev_dbg(xpc_chan, "xp_remote_memcpy() from partition %d failed,"
+                       " ret=%d\n", XPC_PARTID(part), ret);
+       }
+       return ret;
+}
+
+/*
+ * Pull the remote per partition specific variables from the specified
+ * partition.
+ */
+static enum xp_retval
+xpc_pull_remote_vars_part_sn2(struct xpc_partition *part)
+{
+       struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2;
+       u8 buffer[L1_CACHE_BYTES * 2];
+       struct xpc_vars_part_sn2 *pulled_entry_cacheline =
+           (struct xpc_vars_part_sn2 *)L1_CACHE_ALIGN((u64)buffer);
+       struct xpc_vars_part_sn2 *pulled_entry;
+       unsigned long remote_entry_cacheline_pa;
+       unsigned long remote_entry_pa;
+       short partid = XPC_PARTID(part);
+       enum xp_retval ret;
+
+       /* pull the cacheline that contains the variables we're interested in */
+
+       DBUG_ON(part_sn2->remote_vars_part_pa !=
+               L1_CACHE_ALIGN(part_sn2->remote_vars_part_pa));
+       DBUG_ON(sizeof(struct xpc_vars_part_sn2) != L1_CACHE_BYTES / 2);
+
+       remote_entry_pa = part_sn2->remote_vars_part_pa +
+           sn_partition_id * sizeof(struct xpc_vars_part_sn2);
+
+       remote_entry_cacheline_pa = (remote_entry_pa & ~(L1_CACHE_BYTES - 1));
+
+       pulled_entry = (struct xpc_vars_part_sn2 *)((u64)pulled_entry_cacheline
+                                                   + (remote_entry_pa &
+                                                   (L1_CACHE_BYTES - 1)));
+
+       ret = xpc_pull_remote_cachelines_sn2(part, pulled_entry_cacheline,
+                                            remote_entry_cacheline_pa,
+                                            L1_CACHE_BYTES);
+       if (ret != xpSuccess) {
+               dev_dbg(xpc_chan, "failed to pull XPC vars_part from "
+                       "partition %d, ret=%d\n", partid, ret);
+               return ret;
+       }
+
+       /* see if they've been set up yet */
+
+       if (pulled_entry->magic != XPC_VP_MAGIC1_SN2 &&
+           pulled_entry->magic != XPC_VP_MAGIC2_SN2) {
+
+               if (pulled_entry->magic != 0) {
+                       dev_dbg(xpc_chan, "partition %d's XPC vars_part for "
+                               "partition %d has bad magic value (=0x%lx)\n",
+                               partid, sn_partition_id, pulled_entry->magic);
+                       return xpBadMagic;
+               }
+
+               /* they've not been initialized yet */
+               return xpRetry;
+       }
+
+       if (xpc_vars_part_sn2[partid].magic == XPC_VP_MAGIC1_SN2) {
+
+               /* validate the variables */
+
+               if (pulled_entry->GPs_pa == 0 ||
+                   pulled_entry->openclose_args_pa == 0 ||
+                   pulled_entry->chctl_amo_pa == 0) {
+
+                       dev_err(xpc_chan, "partition %d's XPC vars_part for "
+                               "partition %d are not valid\n", partid,
+                               sn_partition_id);
+                       return xpInvalidAddress;
+               }
+
+               /* the variables we imported look to be valid */
+
+               part_sn2->remote_GPs_pa = pulled_entry->GPs_pa;
+               part_sn2->remote_openclose_args_pa =
+                   pulled_entry->openclose_args_pa;
+               part_sn2->remote_chctl_amo_va =
+                   (struct amo *)__va(pulled_entry->chctl_amo_pa);
+               part_sn2->notify_IRQ_nasid = pulled_entry->notify_IRQ_nasid;
+               part_sn2->notify_IRQ_phys_cpuid =
+                   pulled_entry->notify_IRQ_phys_cpuid;
+
+               if (part->nchannels > pulled_entry->nchannels)
+                       part->nchannels = pulled_entry->nchannels;
+
+               /* let the other side know that we've pulled their variables */
+
+               xpc_vars_part_sn2[partid].magic = XPC_VP_MAGIC2_SN2;
+       }
+
+       if (pulled_entry->magic == XPC_VP_MAGIC1_SN2)
+               return xpRetry;
+
+       return xpSuccess;
+}
+
+/*
+ * Establish first contact with the remote partititon. This involves pulling
+ * the XPC per partition variables from the remote partition and waiting for
+ * the remote partition to pull ours.
+ */
+static enum xp_retval
+xpc_make_first_contact_sn2(struct xpc_partition *part)
+{
+       struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2;
+       enum xp_retval ret;
+
+       /*
+        * Register the remote partition's amos with SAL so it can handle
+        * and cleanup errors within that address range should the remote
+        * partition go down. We don't unregister this range because it is
+        * difficult to tell when outstanding writes to the remote partition
+        * are finished and thus when it is safe to unregister. This should
+        * not result in wasted space in the SAL xp_addr_region table because
+        * we should get the same page for remote_amos_page_pa after module
+        * reloads and system reboots.
+        */
+       if (sn_register_xp_addr_region(part_sn2->remote_amos_page_pa,
+                                      PAGE_SIZE, 1) < 0) {
+               dev_warn(xpc_part, "xpc_activating(%d) failed to register "
+                        "xp_addr region\n", XPC_PARTID(part));
+
+               ret = xpPhysAddrRegFailed;
+               XPC_DEACTIVATE_PARTITION(part, ret);
+               return ret;
+       }
+
+       /*
+        * Send activate IRQ to get other side to activate if they've not
+        * already begun to do so.
+        */
+       xpc_send_activate_IRQ_sn2(part_sn2->remote_amos_page_pa,
+                                 cnodeid_to_nasid(0),
+                                 part_sn2->activate_IRQ_nasid,
+                                 part_sn2->activate_IRQ_phys_cpuid);
+
+       while ((ret = xpc_pull_remote_vars_part_sn2(part)) != xpSuccess) {
+               if (ret != xpRetry) {
+                       XPC_DEACTIVATE_PARTITION(part, ret);
+                       return ret;
+               }
+
+               dev_dbg(xpc_part, "waiting to make first contact with "
+                       "partition %d\n", XPC_PARTID(part));
+
+               /* wait a 1/4 of a second or so */
+               (void)msleep_interruptible(250);
+
+               if (part->act_state == XPC_P_AS_DEACTIVATING)
+                       return part->reason;
+       }
+
+       return xpSuccess;
+}
+
+/*
+ * Get the chctl flags and pull the openclose args and/or remote GPs as needed.
+ */
+static u64
+xpc_get_chctl_all_flags_sn2(struct xpc_partition *part)
+{
+       struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2;
+       unsigned long irq_flags;
+       union xpc_channel_ctl_flags chctl;
+       enum xp_retval ret;
+
+       /*
+        * See if there are any chctl flags to be handled.
+        */
+
+       spin_lock_irqsave(&part->chctl_lock, irq_flags);
+       chctl = part->chctl;
+       if (chctl.all_flags != 0)
+               part->chctl.all_flags = 0;
+
+       spin_unlock_irqrestore(&part->chctl_lock, irq_flags);
+
+       if (xpc_any_openclose_chctl_flags_set(&chctl)) {
+               ret = xpc_pull_remote_cachelines_sn2(part, part->
+                                                    remote_openclose_args,
+                                                    part_sn2->
+                                                    remote_openclose_args_pa,
+                                                    XPC_OPENCLOSE_ARGS_SIZE);
+               if (ret != xpSuccess) {
+                       XPC_DEACTIVATE_PARTITION(part, ret);
+
+                       dev_dbg(xpc_chan, "failed to pull openclose args from "
+                               "partition %d, ret=%d\n", XPC_PARTID(part),
+                               ret);
+
+                       /* don't bother processing chctl flags anymore */
+                       chctl.all_flags = 0;
+               }
+       }
+
+       if (xpc_any_msg_chctl_flags_set(&chctl)) {
+               ret = xpc_pull_remote_cachelines_sn2(part, part_sn2->remote_GPs,
+                                                    part_sn2->remote_GPs_pa,
+                                                    XPC_GP_SIZE);
+               if (ret != xpSuccess) {
+                       XPC_DEACTIVATE_PARTITION(part, ret);
+
+                       dev_dbg(xpc_chan, "failed to pull GPs from partition "
+                               "%d, ret=%d\n", XPC_PARTID(part), ret);
+
+                       /* don't bother processing chctl flags anymore */
+                       chctl.all_flags = 0;
+               }
+       }
+
+       return chctl.all_flags;
+}
+
+/*
+ * Allocate the local message queue and the notify queue.
+ */
+static enum xp_retval
+xpc_allocate_local_msgqueue_sn2(struct xpc_channel *ch)
+{
+       struct xpc_channel_sn2 *ch_sn2 = &ch->sn.sn2;
+       unsigned long irq_flags;
+       int nentries;
+       size_t nbytes;
+
+       for (nentries = ch->local_nentries; nentries > 0; nentries--) {
+
+               nbytes = nentries * ch->entry_size;
+               ch_sn2->local_msgqueue =
+                   xpc_kzalloc_cacheline_aligned(nbytes, GFP_KERNEL,
+                                                 &ch_sn2->local_msgqueue_base);
+               if (ch_sn2->local_msgqueue == NULL)
+                       continue;
+
+               nbytes = nentries * sizeof(struct xpc_notify_sn2);
+               ch_sn2->notify_queue = kzalloc(nbytes, GFP_KERNEL);
+               if (ch_sn2->notify_queue == NULL) {
+                       kfree(ch_sn2->local_msgqueue_base);
+                       ch_sn2->local_msgqueue = NULL;
+                       continue;
+               }
+
+               spin_lock_irqsave(&ch->lock, irq_flags);
+               if (nentries < ch->local_nentries) {
+                       dev_dbg(xpc_chan, "nentries=%d local_nentries=%d, "
+                               "partid=%d, channel=%d\n", nentries,
+                               ch->local_nentries, ch->partid, ch->number);
+
+                       ch->local_nentries = nentries;
+               }
+               spin_unlock_irqrestore(&ch->lock, irq_flags);
+               return xpSuccess;
+       }
+
+       dev_dbg(xpc_chan, "can't get memory for local message queue and notify "
+               "queue, partid=%d, channel=%d\n", ch->partid, ch->number);
+       return xpNoMemory;
+}
+
+/*
+ * Allocate the cached remote message queue.
+ */
+static enum xp_retval
+xpc_allocate_remote_msgqueue_sn2(struct xpc_channel *ch)
+{
+       struct xpc_channel_sn2 *ch_sn2 = &ch->sn.sn2;
+       unsigned long irq_flags;
+       int nentries;
+       size_t nbytes;
+
+       DBUG_ON(ch->remote_nentries <= 0);
+
+       for (nentries = ch->remote_nentries; nentries > 0; nentries--) {
+
+               nbytes = nentries * ch->entry_size;
+               ch_sn2->remote_msgqueue =
+                   xpc_kzalloc_cacheline_aligned(nbytes, GFP_KERNEL, &ch_sn2->
+                                                 remote_msgqueue_base);
+               if (ch_sn2->remote_msgqueue == NULL)
+                       continue;
+
+               spin_lock_irqsave(&ch->lock, irq_flags);
+               if (nentries < ch->remote_nentries) {
+                       dev_dbg(xpc_chan, "nentries=%d remote_nentries=%d, "
+                               "partid=%d, channel=%d\n", nentries,
+                               ch->remote_nentries, ch->partid, ch->number);
+
+                       ch->remote_nentries = nentries;
+               }
+               spin_unlock_irqrestore(&ch->lock, irq_flags);
+               return xpSuccess;
+       }
+
+       dev_dbg(xpc_chan, "can't get memory for cached remote message queue, "
+               "partid=%d, channel=%d\n", ch->partid, ch->number);
+       return xpNoMemory;
+}
+
+/*
+ * Allocate message queues and other stuff associated with a channel.
+ *
+ * Note: Assumes all of the channel sizes are filled in.
+ */
+static enum xp_retval
+xpc_setup_msg_structures_sn2(struct xpc_channel *ch)
+{
+       struct xpc_channel_sn2 *ch_sn2 = &ch->sn.sn2;
+       enum xp_retval ret;
+
+       DBUG_ON(ch->flags & XPC_C_SETUP);
+
+       ret = xpc_allocate_local_msgqueue_sn2(ch);
+       if (ret == xpSuccess) {
+
+               ret = xpc_allocate_remote_msgqueue_sn2(ch);
+               if (ret != xpSuccess) {
+                       kfree(ch_sn2->local_msgqueue_base);
+                       ch_sn2->local_msgqueue = NULL;
+                       kfree(ch_sn2->notify_queue);
+                       ch_sn2->notify_queue = NULL;
+               }
+       }
+       return ret;
+}
+
+/*
+ * Free up message queues and other stuff that were allocated for the specified
+ * channel.
+ */
+static void
+xpc_teardown_msg_structures_sn2(struct xpc_channel *ch)
+{
+       struct xpc_channel_sn2 *ch_sn2 = &ch->sn.sn2;
+
+       DBUG_ON(!spin_is_locked(&ch->lock));
+
+       ch_sn2->remote_msgqueue_pa = 0;
+
+       ch_sn2->local_GP->get = 0;
+       ch_sn2->local_GP->put = 0;
+       ch_sn2->remote_GP.get = 0;
+       ch_sn2->remote_GP.put = 0;
+       ch_sn2->w_local_GP.get = 0;
+       ch_sn2->w_local_GP.put = 0;
+       ch_sn2->w_remote_GP.get = 0;
+       ch_sn2->w_remote_GP.put = 0;
+       ch_sn2->next_msg_to_pull = 0;
+
+       if (ch->flags & XPC_C_SETUP) {
+               dev_dbg(xpc_chan, "ch->flags=0x%x, partid=%d, channel=%d\n",
+                       ch->flags, ch->partid, ch->number);
+
+               kfree(ch_sn2->local_msgqueue_base);
+               ch_sn2->local_msgqueue = NULL;
+               kfree(ch_sn2->remote_msgqueue_base);
+               ch_sn2->remote_msgqueue = NULL;
+               kfree(ch_sn2->notify_queue);
+               ch_sn2->notify_queue = NULL;
+       }
+}
+
+/*
+ * Notify those who wanted to be notified upon delivery of their message.
+ */
+static void
+xpc_notify_senders_sn2(struct xpc_channel *ch, enum xp_retval reason, s64 put)
+{
+       struct xpc_notify_sn2 *notify;
+       u8 notify_type;
+       s64 get = ch->sn.sn2.w_remote_GP.get - 1;
+
+       while (++get < put && atomic_read(&ch->n_to_notify) > 0) {
+
+               notify = &ch->sn.sn2.notify_queue[get % ch->local_nentries];
+
+               /*
+                * See if the notify entry indicates it was associated with
+                * a message who's sender wants to be notified. It is possible
+                * that it is, but someone else is doing or has done the
+                * notification.
+                */
+               notify_type = notify->type;
+               if (notify_type == 0 ||
+                   cmpxchg(&notify->type, notify_type, 0) != notify_type) {
+                       continue;
+               }
+
+               DBUG_ON(notify_type != XPC_N_CALL);
+
+               atomic_dec(&ch->n_to_notify);
+
+               if (notify->func != NULL) {
+                       dev_dbg(xpc_chan, "notify->func() called, notify=0x%p "
+                               "msg_number=%ld partid=%d channel=%d\n",
+                               (void *)notify, get, ch->partid, ch->number);
+
+                       notify->func(reason, ch->partid, ch->number,
+                                    notify->key);
+
+                       dev_dbg(xpc_chan, "notify->func() returned, notify=0x%p"
+                               " msg_number=%ld partid=%d channel=%d\n",
+                               (void *)notify, get, ch->partid, ch->number);
+               }
+       }
+}
+
+static void
+xpc_notify_senders_of_disconnect_sn2(struct xpc_channel *ch)
+{
+       xpc_notify_senders_sn2(ch, ch->reason, ch->sn.sn2.w_local_GP.put);
+}
+
+/*
+ * Clear some of the msg flags in the local message queue.
+ */
+static inline void
+xpc_clear_local_msgqueue_flags_sn2(struct xpc_channel *ch)
+{
+       struct xpc_channel_sn2 *ch_sn2 = &ch->sn.sn2;
+       struct xpc_msg_sn2 *msg;
+       s64 get;
+
+       get = ch_sn2->w_remote_GP.get;
+       do {
+               msg = (struct xpc_msg_sn2 *)((u64)ch_sn2->local_msgqueue +
+                                            (get % ch->local_nentries) *
+                                            ch->entry_size);
+               msg->flags = 0;
+       } while (++get < ch_sn2->remote_GP.get);
+}
+
+/*
+ * Clear some of the msg flags in the remote message queue.
+ */
+static inline void
+xpc_clear_remote_msgqueue_flags_sn2(struct xpc_channel *ch)
+{
+       struct xpc_channel_sn2 *ch_sn2 = &ch->sn.sn2;
+       struct xpc_msg_sn2 *msg;
+       s64 put;
+
+       put = ch_sn2->w_remote_GP.put;
+       do {
+               msg = (struct xpc_msg_sn2 *)((u64)ch_sn2->remote_msgqueue +
+                                            (put % ch->remote_nentries) *
+                                            ch->entry_size);
+               msg->flags = 0;
+       } while (++put < ch_sn2->remote_GP.put);
+}
+
+static int
+xpc_n_of_deliverable_payloads_sn2(struct xpc_channel *ch)
+{
+       return ch->sn.sn2.w_remote_GP.put - ch->sn.sn2.w_local_GP.get;
+}
+
+static void
+xpc_process_msg_chctl_flags_sn2(struct xpc_partition *part, int ch_number)
+{
+       struct xpc_channel *ch = &part->channels[ch_number];
+       struct xpc_channel_sn2 *ch_sn2 = &ch->sn.sn2;
+       int npayloads_sent;
+
+       ch_sn2->remote_GP = part->sn.sn2.remote_GPs[ch_number];
+
+       /* See what, if anything, has changed for each connected channel */
+
+       xpc_msgqueue_ref(ch);
+
+       if (ch_sn2->w_remote_GP.get == ch_sn2->remote_GP.get &&
+           ch_sn2->w_remote_GP.put == ch_sn2->remote_GP.put) {
+               /* nothing changed since GPs were last pulled */
+               xpc_msgqueue_deref(ch);
+               return;
+       }
+
+       if (!(ch->flags & XPC_C_CONNECTED)) {
+               xpc_msgqueue_deref(ch);
+               return;
+       }
+
+       /*
+        * First check to see if messages recently sent by us have been
+        * received by the other side. (The remote GET value will have
+        * changed since we last looked at it.)
+        */
+
+       if (ch_sn2->w_remote_GP.get != ch_sn2->remote_GP.get) {
+
+               /*
+                * We need to notify any senders that want to be notified
+                * that their sent messages have been received by their
+                * intended recipients. We need to do this before updating
+                * w_remote_GP.get so that we don't allocate the same message
+                * queue entries prematurely (see xpc_allocate_msg()).
+                */
+               if (atomic_read(&ch->n_to_notify) > 0) {
+                       /*
+                        * Notify senders that messages sent have been
+                        * received and delivered by the other side.
+                        */
+                       xpc_notify_senders_sn2(ch, xpMsgDelivered,
+                                              ch_sn2->remote_GP.get);
+               }
+
+               /*
+                * Clear msg->flags in previously sent messages, so that
+                * they're ready for xpc_allocate_msg().
+                */
+               xpc_clear_local_msgqueue_flags_sn2(ch);
+
+               ch_sn2->w_remote_GP.get = ch_sn2->remote_GP.get;
+
+               dev_dbg(xpc_chan, "w_remote_GP.get changed to %ld, partid=%d, "
+                       "channel=%d\n", ch_sn2->w_remote_GP.get, ch->partid,
+                       ch->number);
+
+               /*
+                * If anyone was waiting for message queue entries to become
+                * available, wake them up.
+                */
+               if (atomic_read(&ch->n_on_msg_allocate_wq) > 0)
+                       wake_up(&ch->msg_allocate_wq);
+       }
+
+       /*
+        * Now check for newly sent messages by the other side. (The remote
+        * PUT value will have changed since we last looked at it.)
+        */
+
+       if (ch_sn2->w_remote_GP.put != ch_sn2->remote_GP.put) {
+               /*
+                * Clear msg->flags in previously received messages, so that
+                * they're ready for xpc_get_deliverable_payload_sn2().
+                */
+               xpc_clear_remote_msgqueue_flags_sn2(ch);
+
+               ch_sn2->w_remote_GP.put = ch_sn2->remote_GP.put;
+
+               dev_dbg(xpc_chan, "w_remote_GP.put changed to %ld, partid=%d, "
+                       "channel=%d\n", ch_sn2->w_remote_GP.put, ch->partid,
+                       ch->number);
+
+               npayloads_sent = xpc_n_of_deliverable_payloads_sn2(ch);
+               if (npayloads_sent > 0) {
+                       dev_dbg(xpc_chan, "msgs waiting to be copied and "
+                               "delivered=%d, partid=%d, channel=%d\n",
+                               npayloads_sent, ch->partid, ch->number);
+
+                       if (ch->flags & XPC_C_CONNECTEDCALLOUT_MADE)
+                               xpc_activate_kthreads(ch, npayloads_sent);
+               }
+       }
+
+       xpc_msgqueue_deref(ch);
+}
+
+static struct xpc_msg_sn2 *
+xpc_pull_remote_msg_sn2(struct xpc_channel *ch, s64 get)
+{
+       struct xpc_partition *part = &xpc_partitions[ch->partid];
+       struct xpc_channel_sn2 *ch_sn2 = &ch->sn.sn2;
+       unsigned long remote_msg_pa;
+       struct xpc_msg_sn2 *msg;
+       u32 msg_index;
+       u32 nmsgs;
+       u64 msg_offset;
+       enum xp_retval ret;
+
+       if (mutex_lock_interruptible(&ch_sn2->msg_to_pull_mutex) != 0) {
+               /* we were interrupted by a signal */
+               return NULL;
+       }
+
+       while (get >= ch_sn2->next_msg_to_pull) {
+
+               /* pull as many messages as are ready and able to be pulled */
+
+               msg_index = ch_sn2->next_msg_to_pull % ch->remote_nentries;
+
+               DBUG_ON(ch_sn2->next_msg_to_pull >= ch_sn2->w_remote_GP.put);
+               nmsgs = ch_sn2->w_remote_GP.put - ch_sn2->next_msg_to_pull;
+               if (msg_index + nmsgs > ch->remote_nentries) {
+                       /* ignore the ones that wrap the msg queue for now */
+                       nmsgs = ch->remote_nentries - msg_index;
+               }
+
+               msg_offset = msg_index * ch->entry_size;
+               msg = (struct xpc_msg_sn2 *)((u64)ch_sn2->remote_msgqueue +
+                   msg_offset);
+               remote_msg_pa = ch_sn2->remote_msgqueue_pa + msg_offset;
+
+               ret = xpc_pull_remote_cachelines_sn2(part, msg, remote_msg_pa,
+                                                    nmsgs * ch->entry_size);
+               if (ret != xpSuccess) {
+
+                       dev_dbg(xpc_chan, "failed to pull %d msgs starting with"
+                               " msg %ld from partition %d, channel=%d, "
+                               "ret=%d\n", nmsgs, ch_sn2->next_msg_to_pull,
+                               ch->partid, ch->number, ret);
+
+                       XPC_DEACTIVATE_PARTITION(part, ret);
+
+                       mutex_unlock(&ch_sn2->msg_to_pull_mutex);
+                       return NULL;
+               }
+
+               ch_sn2->next_msg_to_pull += nmsgs;
+       }
+
+       mutex_unlock(&ch_sn2->msg_to_pull_mutex);
+
+       /* return the message we were looking for */
+       msg_offset = (get % ch->remote_nentries) * ch->entry_size;
+       msg = (struct xpc_msg_sn2 *)((u64)ch_sn2->remote_msgqueue + msg_offset);
+
+       return msg;
+}
+
+/*
+ * Get the next deliverable message's payload.
+ */
+static void *
+xpc_get_deliverable_payload_sn2(struct xpc_channel *ch)
+{
+       struct xpc_channel_sn2 *ch_sn2 = &ch->sn.sn2;
+       struct xpc_msg_sn2 *msg;
+       void *payload = NULL;
+       s64 get;
+
+       do {
+               if (ch->flags & XPC_C_DISCONNECTING)
+                       break;
+
+               get = ch_sn2->w_local_GP.get;
+               rmb();  /* guarantee that .get loads before .put */
+               if (get == ch_sn2->w_remote_GP.put)
+                       break;
+
+               /* There are messages waiting to be pulled and delivered.
+                * We need to try to secure one for ourselves. We'll do this
+                * by trying to increment w_local_GP.get and hope that no one
+                * else beats us to it. If they do, we'll we'll simply have
+                * to try again for the next one.
+                */
+
+               if (cmpxchg(&ch_sn2->w_local_GP.get, get, get + 1) == get) {
+                       /* we got the entry referenced by get */
+
+                       dev_dbg(xpc_chan, "w_local_GP.get changed to %ld, "
+                               "partid=%d, channel=%d\n", get + 1,
+                               ch->partid, ch->number);
+
+                       /* pull the message from the remote partition */
+
+                       msg = xpc_pull_remote_msg_sn2(ch, get);
+
+                       DBUG_ON(msg != NULL && msg->number != get);
+                       DBUG_ON(msg != NULL && (msg->flags & XPC_M_SN2_DONE));
+                       DBUG_ON(msg != NULL && !(msg->flags & XPC_M_SN2_READY));
+
+                       payload = &msg->payload;
+                       break;
+               }
+
+       } while (1);
+
+       return payload;
+}
+
+/*
+ * Now we actually send the messages that are ready to be sent by advancing
+ * the local message queue's Put value and then send a chctl msgrequest to the
+ * recipient partition.
+ */
+static void
+xpc_send_msgs_sn2(struct xpc_channel *ch, s64 initial_put)
+{
+       struct xpc_channel_sn2 *ch_sn2 = &ch->sn.sn2;
+       struct xpc_msg_sn2 *msg;
+       s64 put = initial_put + 1;
+       int send_msgrequest = 0;
+
+       while (1) {
+
+               while (1) {
+                       if (put == ch_sn2->w_local_GP.put)
+                               break;
+
+                       msg = (struct xpc_msg_sn2 *)((u64)ch_sn2->
+                                                    local_msgqueue + (put %
+                                                    ch->local_nentries) *
+                                                    ch->entry_size);
+
+                       if (!(msg->flags & XPC_M_SN2_READY))
+                               break;
+
+                       put++;
+               }
+
+               if (put == initial_put) {
+                       /* nothing's changed */
+                       break;
+               }
+
+               if (cmpxchg_rel(&ch_sn2->local_GP->put, initial_put, put) !=
+                   initial_put) {
+                       /* someone else beat us to it */
+                       DBUG_ON(ch_sn2->local_GP->put < initial_put);
+                       break;
+               }
+
+               /* we just set the new value of local_GP->put */
+
+               dev_dbg(xpc_chan, "local_GP->put changed to %ld, partid=%d, "
+                       "channel=%d\n", put, ch->partid, ch->number);
+
+               send_msgrequest = 1;
+
+               /*
+                * We need to ensure that the message referenced by
+                * local_GP->put is not XPC_M_SN2_READY or that local_GP->put
+                * equals w_local_GP.put, so we'll go have a look.
+                */
+               initial_put = put;
+       }
+
+       if (send_msgrequest)
+               xpc_send_chctl_msgrequest_sn2(ch);
+}
+
+/*
+ * Allocate an entry for a message from the message queue associated with the
+ * specified channel.
+ */
+static enum xp_retval
+xpc_allocate_msg_sn2(struct xpc_channel *ch, u32 flags,
+                    struct xpc_msg_sn2 **address_of_msg)
+{
+       struct xpc_channel_sn2 *ch_sn2 = &ch->sn.sn2;
+       struct xpc_msg_sn2 *msg;
+       enum xp_retval ret;
+       s64 put;
+
+       /*
+        * Get the next available message entry from the local message queue.
+        * If none are available, we'll make sure that we grab the latest
+        * GP values.
+        */
+       ret = xpTimeout;
+
+       while (1) {
+
+               put = ch_sn2->w_local_GP.put;
+               rmb();  /* guarantee that .put loads before .get */
+               if (put - ch_sn2->w_remote_GP.get < ch->local_nentries) {
+
+                       /* There are available message entries. We need to try
+                        * to secure one for ourselves. We'll do this by trying
+                        * to increment w_local_GP.put as long as someone else
+                        * doesn't beat us to it. If they do, we'll have to
+                        * try again.
+                        */
+                       if (cmpxchg(&ch_sn2->w_local_GP.put, put, put + 1) ==
+                           put) {
+                               /* we got the entry referenced by put */
+                               break;
+                       }
+                       continue;       /* try again */
+               }
+
+               /*
+                * There aren't any available msg entries at this time.
+                *
+                * In waiting for a message entry to become available,
+                * we set a timeout in case the other side is not sending
+                * completion interrupts. This lets us fake a notify IRQ
+                * that will cause the notify IRQ handler to fetch the latest
+                * GP values as if an interrupt was sent by the other side.
+                */
+               if (ret == xpTimeout)
+                       xpc_send_chctl_local_msgrequest_sn2(ch);
+
+               if (flags & XPC_NOWAIT)
+                       return xpNoWait;
+
+               ret = xpc_allocate_msg_wait(ch);
+               if (ret != xpInterrupted && ret != xpTimeout)
+                       return ret;
+       }
+
+       /* get the message's address and initialize it */
+       msg = (struct xpc_msg_sn2 *)((u64)ch_sn2->local_msgqueue +
+                                    (put % ch->local_nentries) *
+                                    ch->entry_size);
+
+       DBUG_ON(msg->flags != 0);
+       msg->number = put;
+
+       dev_dbg(xpc_chan, "w_local_GP.put changed to %ld; msg=0x%p, "
+               "msg_number=%ld, partid=%d, channel=%d\n", put + 1,
+               (void *)msg, msg->number, ch->partid, ch->number);
+
+       *address_of_msg = msg;
+       return xpSuccess;
+}
+
+/*
+ * Common code that does the actual sending of the message by advancing the
+ * local message queue's Put value and sends a chctl msgrequest to the
+ * partition the message is being sent to.
+ */
+static enum xp_retval
+xpc_send_payload_sn2(struct xpc_channel *ch, u32 flags, void *payload,
+                    u16 payload_size, u8 notify_type, xpc_notify_func func,
+                    void *key)
+{
+       enum xp_retval ret = xpSuccess;
+       struct xpc_channel_sn2 *ch_sn2 = &ch->sn.sn2;
+       struct xpc_msg_sn2 *msg = msg;
+       struct xpc_notify_sn2 *notify = notify;
+       s64 msg_number;
+       s64 put;
+
+       DBUG_ON(notify_type == XPC_N_CALL && func == NULL);
+
+       if (XPC_MSG_SIZE(payload_size) > ch->entry_size)
+               return xpPayloadTooBig;
+
+       xpc_msgqueue_ref(ch);
+
+       if (ch->flags & XPC_C_DISCONNECTING) {
+               ret = ch->reason;
+               goto out_1;
+       }
+       if (!(ch->flags & XPC_C_CONNECTED)) {
+               ret = xpNotConnected;
+               goto out_1;
+       }
+
+       ret = xpc_allocate_msg_sn2(ch, flags, &msg);
+       if (ret != xpSuccess)
+               goto out_1;
+
+       msg_number = msg->number;
+
+       if (notify_type != 0) {
+               /*
+                * Tell the remote side to send an ACK interrupt when the
+                * message has been delivered.
+                */
+               msg->flags |= XPC_M_SN2_INTERRUPT;
+
+               atomic_inc(&ch->n_to_notify);
+
+               notify = &ch_sn2->notify_queue[msg_number % ch->local_nentries];
+               notify->func = func;
+               notify->key = key;
+               notify->type = notify_type;
+
+               /* ??? Is a mb() needed here? */
+
+               if (ch->flags & XPC_C_DISCONNECTING) {
+                       /*
+                        * An error occurred between our last error check and
+                        * this one. We will try to clear the type field from
+                        * the notify entry. If we succeed then
+                        * xpc_disconnect_channel() didn't already process
+                        * the notify entry.
+                        */
+                       if (cmpxchg(&notify->type, notify_type, 0) ==
+                           notify_type) {
+                               atomic_dec(&ch->n_to_notify);
+                               ret = ch->reason;
+                       }
+                       goto out_1;
+               }
+       }
+
+       memcpy(&msg->payload, payload, payload_size);
+
+       msg->flags |= XPC_M_SN2_READY;
+
+       /*
+        * The preceding store of msg->flags must occur before the following
+        * load of local_GP->put.
+        */
+       mb();
+
+       /* see if the message is next in line to be sent, if so send it */
+
+       put = ch_sn2->local_GP->put;
+       if (put == msg_number)
+               xpc_send_msgs_sn2(ch, put);
+
+out_1:
+       xpc_msgqueue_deref(ch);
+       return ret;
+}
+
+/*
+ * Now we actually acknowledge the messages that have been delivered and ack'd
+ * by advancing the cached remote message queue's Get value and if requested
+ * send a chctl msgrequest to the message sender's partition.
+ *
+ * If a message has XPC_M_SN2_INTERRUPT set, send an interrupt to the partition
+ * that sent the message.
+ */
+static void
+xpc_acknowledge_msgs_sn2(struct xpc_channel *ch, s64 initial_get, u8 msg_flags)
+{
+       struct xpc_channel_sn2 *ch_sn2 = &ch->sn.sn2;
+       struct xpc_msg_sn2 *msg;
+       s64 get = initial_get + 1;
+       int send_msgrequest = 0;
+
+       while (1) {
+
+               while (1) {
+                       if (get == ch_sn2->w_local_GP.get)
+                               break;
+
+                       msg = (struct xpc_msg_sn2 *)((u64)ch_sn2->
+                                                    remote_msgqueue + (get %
+                                                    ch->remote_nentries) *
+                                                    ch->entry_size);
+
+                       if (!(msg->flags & XPC_M_SN2_DONE))
+                               break;
+
+                       msg_flags |= msg->flags;
+                       get++;
+               }
+
+               if (get == initial_get) {
+                       /* nothing's changed */
+                       break;
+               }
+
+               if (cmpxchg_rel(&ch_sn2->local_GP->get, initial_get, get) !=
+                   initial_get) {
+                       /* someone else beat us to it */
+                       DBUG_ON(ch_sn2->local_GP->get <= initial_get);
+                       break;
+               }
+
+               /* we just set the new value of local_GP->get */
+
+               dev_dbg(xpc_chan, "local_GP->get changed to %ld, partid=%d, "
+                       "channel=%d\n", get, ch->partid, ch->number);
+
+               send_msgrequest = (msg_flags & XPC_M_SN2_INTERRUPT);
+
+               /*
+                * We need to ensure that the message referenced by
+                * local_GP->get is not XPC_M_SN2_DONE or that local_GP->get
+                * equals w_local_GP.get, so we'll go have a look.
+                */
+               initial_get = get;
+       }
+
+       if (send_msgrequest)
+               xpc_send_chctl_msgrequest_sn2(ch);
+}
+
+static void
+xpc_received_payload_sn2(struct xpc_channel *ch, void *payload)
+{
+       struct xpc_msg_sn2 *msg;
+       s64 msg_number;
+       s64 get;
+
+       msg = container_of(payload, struct xpc_msg_sn2, payload);
+       msg_number = msg->number;
+
+       dev_dbg(xpc_chan, "msg=0x%p, msg_number=%ld, partid=%d, channel=%d\n",
+               (void *)msg, msg_number, ch->partid, ch->number);
+
+       DBUG_ON((((u64)msg - (u64)ch->remote_msgqueue) / ch->entry_size) !=
+               msg_number % ch->remote_nentries);
+       DBUG_ON(msg->flags & XPC_M_SN2_DONE);
+
+       msg->flags |= XPC_M_SN2_DONE;
+
+       /*
+        * The preceding store of msg->flags must occur before the following
+        * load of local_GP->get.
+        */
+       mb();
+
+       /*
+        * See if this message is next in line to be acknowledged as having
+        * been delivered.
+        */
+       get = ch->sn.sn2.local_GP->get;
+       if (get == msg_number)
+               xpc_acknowledge_msgs_sn2(ch, get, msg->flags);
+}
+
+int
+xpc_init_sn2(void)
+{
+       int ret;
+       size_t buf_size;
+
+       xpc_setup_partitions_sn = xpc_setup_partitions_sn_sn2;
+       xpc_get_partition_rsvd_page_pa = xpc_get_partition_rsvd_page_pa_sn2;
+       xpc_setup_rsvd_page_sn = xpc_setup_rsvd_page_sn_sn2;
+       xpc_increment_heartbeat = xpc_increment_heartbeat_sn2;
+       xpc_offline_heartbeat = xpc_offline_heartbeat_sn2;
+       xpc_online_heartbeat = xpc_online_heartbeat_sn2;
+       xpc_heartbeat_init = xpc_heartbeat_init_sn2;
+       xpc_heartbeat_exit = xpc_heartbeat_exit_sn2;
+       xpc_get_remote_heartbeat = xpc_get_remote_heartbeat_sn2;
+
+       xpc_request_partition_activation = xpc_request_partition_activation_sn2;
+       xpc_request_partition_reactivation =
+           xpc_request_partition_reactivation_sn2;
+       xpc_request_partition_deactivation =
+           xpc_request_partition_deactivation_sn2;
+       xpc_cancel_partition_deactivation_request =
+           xpc_cancel_partition_deactivation_request_sn2;
+
+       xpc_process_activate_IRQ_rcvd = xpc_process_activate_IRQ_rcvd_sn2;
+       xpc_setup_ch_structures_sn = xpc_setup_ch_structures_sn_sn2;
+       xpc_teardown_ch_structures_sn = xpc_teardown_ch_structures_sn_sn2;
+       xpc_make_first_contact = xpc_make_first_contact_sn2;
+
+       xpc_get_chctl_all_flags = xpc_get_chctl_all_flags_sn2;
+       xpc_send_chctl_closerequest = xpc_send_chctl_closerequest_sn2;
+       xpc_send_chctl_closereply = xpc_send_chctl_closereply_sn2;
+       xpc_send_chctl_openrequest = xpc_send_chctl_openrequest_sn2;
+       xpc_send_chctl_openreply = xpc_send_chctl_openreply_sn2;
+
+       xpc_save_remote_msgqueue_pa = xpc_save_remote_msgqueue_pa_sn2;
+
+       xpc_setup_msg_structures = xpc_setup_msg_structures_sn2;
+       xpc_teardown_msg_structures = xpc_teardown_msg_structures_sn2;
+
+       xpc_notify_senders_of_disconnect = xpc_notify_senders_of_disconnect_sn2;
+       xpc_process_msg_chctl_flags = xpc_process_msg_chctl_flags_sn2;
+       xpc_n_of_deliverable_payloads = xpc_n_of_deliverable_payloads_sn2;
+       xpc_get_deliverable_payload = xpc_get_deliverable_payload_sn2;
+
+       xpc_indicate_partition_engaged = xpc_indicate_partition_engaged_sn2;
+       xpc_indicate_partition_disengaged =
+           xpc_indicate_partition_disengaged_sn2;
+       xpc_partition_engaged = xpc_partition_engaged_sn2;
+       xpc_any_partition_engaged = xpc_any_partition_engaged_sn2;
+       xpc_assume_partition_disengaged = xpc_assume_partition_disengaged_sn2;
+
+       xpc_send_payload = xpc_send_payload_sn2;
+       xpc_received_payload = xpc_received_payload_sn2;
+
+       if (offsetof(struct xpc_msg_sn2, payload) > XPC_MSG_HDR_MAX_SIZE) {
+               dev_err(xpc_part, "header portion of struct xpc_msg_sn2 is "
+                       "larger than %d\n", XPC_MSG_HDR_MAX_SIZE);
+               return -E2BIG;
+       }
+
+       buf_size = max(XPC_RP_VARS_SIZE,
+                      XPC_RP_HEADER_SIZE + XP_NASID_MASK_BYTES_SN2);
+       xpc_remote_copy_buffer_sn2 = xpc_kmalloc_cacheline_aligned(buf_size,
+                                                                  GFP_KERNEL,
+                                             &xpc_remote_copy_buffer_base_sn2);
+       if (xpc_remote_copy_buffer_sn2 == NULL) {
+               dev_err(xpc_part, "can't get memory for remote copy buffer\n");
+               return -ENOMEM;
+       }
+
+       /* open up protections for IPI and [potentially] amo operations */
+       xpc_allow_IPI_ops_sn2();
+       xpc_allow_amo_ops_shub_wars_1_1_sn2();
+
+       /*
+        * This is safe to do before the xpc_hb_checker thread has started
+        * because the handler releases a wait queue.  If an interrupt is
+        * received before the thread is waiting, it will not go to sleep,
+        * but rather immediately process the interrupt.
+        */
+       ret = request_irq(SGI_XPC_ACTIVATE, xpc_handle_activate_IRQ_sn2, 0,
+                         "xpc hb", NULL);
+       if (ret != 0) {
+               dev_err(xpc_part, "can't register ACTIVATE IRQ handler, "
+                       "errno=%d\n", -ret);
+               xpc_disallow_IPI_ops_sn2();
+               kfree(xpc_remote_copy_buffer_base_sn2);
+       }
+       return ret;
+}
+
+void
+xpc_exit_sn2(void)
+{
+       free_irq(SGI_XPC_ACTIVATE, NULL);
+       xpc_disallow_IPI_ops_sn2();
+       kfree(xpc_remote_copy_buffer_base_sn2);
+}
diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c
new file mode 100644 (file)
index 0000000..1ac694c
--- /dev/null
@@ -0,0 +1,1443 @@
+/*
+ * 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) 2008 Silicon Graphics, Inc.  All Rights Reserved.
+ */
+
+/*
+ * Cross Partition Communication (XPC) uv-based functions.
+ *
+ *     Architecture specific implementation of common functions.
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/mm.h>
+#include <linux/interrupt.h>
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <asm/uv/uv_hub.h>
+#include "../sgi-gru/gru.h"
+#include "../sgi-gru/grukservices.h"
+#include "xpc.h"
+
+static atomic64_t xpc_heartbeat_uv;
+static DECLARE_BITMAP(xpc_heartbeating_to_mask_uv, XP_MAX_NPARTITIONS_UV);
+
+#define XPC_ACTIVATE_MSG_SIZE_UV       (1 * GRU_CACHE_LINE_BYTES)
+#define XPC_NOTIFY_MSG_SIZE_UV         (2 * GRU_CACHE_LINE_BYTES)
+
+#define XPC_ACTIVATE_MQ_SIZE_UV        (4 * XP_MAX_NPARTITIONS_UV * \
+                                XPC_ACTIVATE_MSG_SIZE_UV)
+#define XPC_NOTIFY_MQ_SIZE_UV  (4 * XP_MAX_NPARTITIONS_UV * \
+                                XPC_NOTIFY_MSG_SIZE_UV)
+
+static void *xpc_activate_mq_uv;
+static void *xpc_notify_mq_uv;
+
+static int
+xpc_setup_partitions_sn_uv(void)
+{
+       short partid;
+       struct xpc_partition_uv *part_uv;
+
+       for (partid = 0; partid < XP_MAX_NPARTITIONS_UV; partid++) {
+               part_uv = &xpc_partitions[partid].sn.uv;
+
+               spin_lock_init(&part_uv->flags_lock);
+               part_uv->remote_act_state = XPC_P_AS_INACTIVE;
+       }
+       return 0;
+}
+
+static void *
+xpc_create_gru_mq_uv(unsigned int mq_size, int cpuid, unsigned int irq,
+                    irq_handler_t irq_handler)
+{
+       int ret;
+       int nid;
+       int mq_order;
+       struct page *page;
+       void *mq;
+
+       nid = cpu_to_node(cpuid);
+       mq_order = get_order(mq_size);
+       page = alloc_pages_node(nid, GFP_KERNEL | __GFP_ZERO | GFP_THISNODE,
+                               mq_order);
+       if (page == NULL) {
+               dev_err(xpc_part, "xpc_create_gru_mq_uv() failed to alloc %d "
+                       "bytes of memory on nid=%d for GRU mq\n", mq_size, nid);
+               return NULL;
+       }
+
+       mq = page_address(page);
+       ret = gru_create_message_queue(mq, mq_size);
+       if (ret != 0) {
+               dev_err(xpc_part, "gru_create_message_queue() returned "
+                       "error=%d\n", ret);
+               free_pages((unsigned long)mq, mq_order);
+               return NULL;
+       }
+
+       /* !!! Need to do some other things to set up IRQ */
+
+       ret = request_irq(irq, irq_handler, 0, "xpc", NULL);
+       if (ret != 0) {
+               dev_err(xpc_part, "request_irq(irq=%d) returned error=%d\n",
+                       irq, ret);
+               free_pages((unsigned long)mq, mq_order);
+               return NULL;
+       }
+
+       /* !!! enable generation of irq when GRU mq op occurs to this mq */
+
+       /* ??? allow other partitions to access GRU mq? */
+
+       return mq;
+}
+
+static void
+xpc_destroy_gru_mq_uv(void *mq, unsigned int mq_size, unsigned int irq)
+{
+       /* ??? disallow other partitions to access GRU mq? */
+
+       /* !!! disable generation of irq when GRU mq op occurs to this mq */
+
+       free_irq(irq, NULL);
+
+       free_pages((unsigned long)mq, get_order(mq_size));
+}
+
+static enum xp_retval
+xpc_send_gru_msg(unsigned long mq_gpa, void *msg, size_t msg_size)
+{
+       enum xp_retval xp_ret;
+       int ret;
+
+       while (1) {
+               ret = gru_send_message_gpa(mq_gpa, msg, msg_size);
+               if (ret == MQE_OK) {
+                       xp_ret = xpSuccess;
+                       break;
+               }
+
+               if (ret == MQE_QUEUE_FULL) {
+                       dev_dbg(xpc_chan, "gru_send_message_gpa() returned "
+                               "error=MQE_QUEUE_FULL\n");
+                       /* !!! handle QLimit reached; delay & try again */
+                       /* ??? Do we add a limit to the number of retries? */
+                       (void)msleep_interruptible(10);
+               } else if (ret == MQE_CONGESTION) {
+                       dev_dbg(xpc_chan, "gru_send_message_gpa() returned "
+                               "error=MQE_CONGESTION\n");
+                       /* !!! handle LB Overflow; simply try again */
+                       /* ??? Do we add a limit to the number of retries? */
+               } else {
+                       /* !!! Currently this is MQE_UNEXPECTED_CB_ERR */
+                       dev_err(xpc_chan, "gru_send_message_gpa() returned "
+                               "error=%d\n", ret);
+                       xp_ret = xpGruSendMqError;
+                       break;
+               }
+       }
+       return xp_ret;
+}
+
+static void
+xpc_process_activate_IRQ_rcvd_uv(void)
+{
+       unsigned long irq_flags;
+       short partid;
+       struct xpc_partition *part;
+       u8 act_state_req;
+
+       DBUG_ON(xpc_activate_IRQ_rcvd == 0);
+
+       spin_lock_irqsave(&xpc_activate_IRQ_rcvd_lock, irq_flags);
+       for (partid = 0; partid < XP_MAX_NPARTITIONS_UV; partid++) {
+               part = &xpc_partitions[partid];
+
+               if (part->sn.uv.act_state_req == 0)
+                       continue;
+
+               xpc_activate_IRQ_rcvd--;
+               BUG_ON(xpc_activate_IRQ_rcvd < 0);
+
+               act_state_req = part->sn.uv.act_state_req;
+               part->sn.uv.act_state_req = 0;
+               spin_unlock_irqrestore(&xpc_activate_IRQ_rcvd_lock, irq_flags);
+
+               if (act_state_req == XPC_P_ASR_ACTIVATE_UV) {
+                       if (part->act_state == XPC_P_AS_INACTIVE)
+                               xpc_activate_partition(part);
+                       else if (part->act_state == XPC_P_AS_DEACTIVATING)
+                               XPC_DEACTIVATE_PARTITION(part, xpReactivating);
+
+               } else if (act_state_req == XPC_P_ASR_REACTIVATE_UV) {
+                       if (part->act_state == XPC_P_AS_INACTIVE)
+                               xpc_activate_partition(part);
+                       else
+                               XPC_DEACTIVATE_PARTITION(part, xpReactivating);
+
+               } else if (act_state_req == XPC_P_ASR_DEACTIVATE_UV) {
+                       XPC_DEACTIVATE_PARTITION(part, part->sn.uv.reason);
+
+               } else {
+                       BUG();
+               }
+
+               spin_lock_irqsave(&xpc_activate_IRQ_rcvd_lock, irq_flags);
+               if (xpc_activate_IRQ_rcvd == 0)
+                       break;
+       }
+       spin_unlock_irqrestore(&xpc_activate_IRQ_rcvd_lock, irq_flags);
+
+}
+
+static void
+xpc_handle_activate_mq_msg_uv(struct xpc_partition *part,
+                             struct xpc_activate_mq_msghdr_uv *msg_hdr,
+                             int *wakeup_hb_checker)
+{
+       unsigned long irq_flags;
+       struct xpc_partition_uv *part_uv = &part->sn.uv;
+       struct xpc_openclose_args *args;
+
+       part_uv->remote_act_state = msg_hdr->act_state;
+
+       switch (msg_hdr->type) {
+       case XPC_ACTIVATE_MQ_MSG_SYNC_ACT_STATE_UV:
+               /* syncing of remote_act_state was just done above */
+               break;
+
+       case XPC_ACTIVATE_MQ_MSG_INC_HEARTBEAT_UV: {
+               struct xpc_activate_mq_msg_heartbeat_req_uv *msg;
+
+               msg = container_of(msg_hdr,
+                                  struct xpc_activate_mq_msg_heartbeat_req_uv,
+                                  hdr);
+               part_uv->heartbeat = msg->heartbeat;
+               break;
+       }
+       case XPC_ACTIVATE_MQ_MSG_OFFLINE_HEARTBEAT_UV: {
+               struct xpc_activate_mq_msg_heartbeat_req_uv *msg;
+
+               msg = container_of(msg_hdr,
+                                  struct xpc_activate_mq_msg_heartbeat_req_uv,
+                                  hdr);
+               part_uv->heartbeat = msg->heartbeat;
+
+               spin_lock_irqsave(&part_uv->flags_lock, irq_flags);
+               part_uv->flags |= XPC_P_HEARTBEAT_OFFLINE_UV;
+               spin_unlock_irqrestore(&part_uv->flags_lock, irq_flags);
+               break;
+       }
+       case XPC_ACTIVATE_MQ_MSG_ONLINE_HEARTBEAT_UV: {
+               struct xpc_activate_mq_msg_heartbeat_req_uv *msg;
+
+               msg = container_of(msg_hdr,
+                                  struct xpc_activate_mq_msg_heartbeat_req_uv,
+                                  hdr);
+               part_uv->heartbeat = msg->heartbeat;
+
+               spin_lock_irqsave(&part_uv->flags_lock, irq_flags);
+               part_uv->flags &= ~XPC_P_HEARTBEAT_OFFLINE_UV;
+               spin_unlock_irqrestore(&part_uv->flags_lock, irq_flags);
+               break;
+       }
+       case XPC_ACTIVATE_MQ_MSG_ACTIVATE_REQ_UV: {
+               struct xpc_activate_mq_msg_activate_req_uv *msg;
+
+               /*
+                * ??? Do we deal here with ts_jiffies being different
+                * ??? if act_state != XPC_P_AS_INACTIVE instead of
+                * ??? below?
+                */
+               msg = container_of(msg_hdr, struct
+                                  xpc_activate_mq_msg_activate_req_uv, hdr);
+
+               spin_lock_irqsave(&xpc_activate_IRQ_rcvd_lock, irq_flags);
+               if (part_uv->act_state_req == 0)
+                       xpc_activate_IRQ_rcvd++;
+               part_uv->act_state_req = XPC_P_ASR_ACTIVATE_UV;
+               part->remote_rp_pa = msg->rp_gpa; /* !!! _pa is _gpa */
+               part->remote_rp_ts_jiffies = msg_hdr->rp_ts_jiffies;
+               part_uv->remote_activate_mq_gpa = msg->activate_mq_gpa;
+               spin_unlock_irqrestore(&xpc_activate_IRQ_rcvd_lock, irq_flags);
+
+               (*wakeup_hb_checker)++;
+               break;
+       }
+       case XPC_ACTIVATE_MQ_MSG_DEACTIVATE_REQ_UV: {
+               struct xpc_activate_mq_msg_deactivate_req_uv *msg;
+
+               msg = container_of(msg_hdr, struct
+                                  xpc_activate_mq_msg_deactivate_req_uv, hdr);
+
+               spin_lock_irqsave(&xpc_activate_IRQ_rcvd_lock, irq_flags);
+               if (part_uv->act_state_req == 0)
+                       xpc_activate_IRQ_rcvd++;
+               part_uv->act_state_req = XPC_P_ASR_DEACTIVATE_UV;
+               part_uv->reason = msg->reason;
+               spin_unlock_irqrestore(&xpc_activate_IRQ_rcvd_lock, irq_flags);
+
+               (*wakeup_hb_checker)++;
+               return;
+       }
+       case XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREQUEST_UV: {
+               struct xpc_activate_mq_msg_chctl_closerequest_uv *msg;
+
+               msg = container_of(msg_hdr, struct
+                                  xpc_activate_mq_msg_chctl_closerequest_uv,
+                                  hdr);
+               args = &part->remote_openclose_args[msg->ch_number];
+               args->reason = msg->reason;
+
+               spin_lock_irqsave(&part->chctl_lock, irq_flags);
+               part->chctl.flags[msg->ch_number] |= XPC_CHCTL_CLOSEREQUEST;
+               spin_unlock_irqrestore(&part->chctl_lock, irq_flags);
+
+               xpc_wakeup_channel_mgr(part);
+               break;
+       }
+       case XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREPLY_UV: {
+               struct xpc_activate_mq_msg_chctl_closereply_uv *msg;
+
+               msg = container_of(msg_hdr, struct
+                                  xpc_activate_mq_msg_chctl_closereply_uv,
+                                  hdr);
+
+               spin_lock_irqsave(&part->chctl_lock, irq_flags);
+               part->chctl.flags[msg->ch_number] |= XPC_CHCTL_CLOSEREPLY;
+               spin_unlock_irqrestore(&part->chctl_lock, irq_flags);
+
+               xpc_wakeup_channel_mgr(part);
+               break;
+       }
+       case XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREQUEST_UV: {
+               struct xpc_activate_mq_msg_chctl_openrequest_uv *msg;
+
+               msg = container_of(msg_hdr, struct
+                                  xpc_activate_mq_msg_chctl_openrequest_uv,
+                                  hdr);
+               args = &part->remote_openclose_args[msg->ch_number];
+               args->entry_size = msg->entry_size;
+               args->local_nentries = msg->local_nentries;
+
+               spin_lock_irqsave(&part->chctl_lock, irq_flags);
+               part->chctl.flags[msg->ch_number] |= XPC_CHCTL_OPENREQUEST;
+               spin_unlock_irqrestore(&part->chctl_lock, irq_flags);
+
+               xpc_wakeup_channel_mgr(part);
+               break;
+       }
+       case XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREPLY_UV: {
+               struct xpc_activate_mq_msg_chctl_openreply_uv *msg;
+
+               msg = container_of(msg_hdr, struct
+                                  xpc_activate_mq_msg_chctl_openreply_uv, hdr);
+               args = &part->remote_openclose_args[msg->ch_number];
+               args->remote_nentries = msg->remote_nentries;
+               args->local_nentries = msg->local_nentries;
+               args->local_msgqueue_pa = msg->local_notify_mq_gpa;
+
+               spin_lock_irqsave(&part->chctl_lock, irq_flags);
+               part->chctl.flags[msg->ch_number] |= XPC_CHCTL_OPENREPLY;
+               spin_unlock_irqrestore(&part->chctl_lock, irq_flags);
+
+               xpc_wakeup_channel_mgr(part);
+               break;
+       }
+       case XPC_ACTIVATE_MQ_MSG_MARK_ENGAGED_UV:
+               spin_lock_irqsave(&part_uv->flags_lock, irq_flags);
+               part_uv->flags |= XPC_P_ENGAGED_UV;
+               spin_unlock_irqrestore(&part_uv->flags_lock, irq_flags);
+               break;
+
+       case XPC_ACTIVATE_MQ_MSG_MARK_DISENGAGED_UV:
+               spin_lock_irqsave(&part_uv->flags_lock, irq_flags);
+               part_uv->flags &= ~XPC_P_ENGAGED_UV;
+               spin_unlock_irqrestore(&part_uv->flags_lock, irq_flags);
+               break;
+
+       default:
+               dev_err(xpc_part, "received unknown activate_mq msg type=%d "
+                       "from partition=%d\n", msg_hdr->type, XPC_PARTID(part));
+
+               /* get hb checker to deactivate from the remote partition */
+               spin_lock_irqsave(&xpc_activate_IRQ_rcvd_lock, irq_flags);
+               if (part_uv->act_state_req == 0)
+                       xpc_activate_IRQ_rcvd++;
+               part_uv->act_state_req = XPC_P_ASR_DEACTIVATE_UV;
+               part_uv->reason = xpBadMsgType;
+               spin_unlock_irqrestore(&xpc_activate_IRQ_rcvd_lock, irq_flags);
+
+               (*wakeup_hb_checker)++;
+               return;
+       }
+
+       if (msg_hdr->rp_ts_jiffies != part->remote_rp_ts_jiffies &&
+           part->remote_rp_ts_jiffies != 0) {
+               /*
+                * ??? Does what we do here need to be sensitive to
+                * ??? act_state or remote_act_state?
+                */
+               spin_lock_irqsave(&xpc_activate_IRQ_rcvd_lock, irq_flags);
+               if (part_uv->act_state_req == 0)
+                       xpc_activate_IRQ_rcvd++;
+               part_uv->act_state_req = XPC_P_ASR_REACTIVATE_UV;
+               spin_unlock_irqrestore(&xpc_activate_IRQ_rcvd_lock, irq_flags);
+
+               (*wakeup_hb_checker)++;
+       }
+}
+
+static irqreturn_t
+xpc_handle_activate_IRQ_uv(int irq, void *dev_id)
+{
+       struct xpc_activate_mq_msghdr_uv *msg_hdr;
+       short partid;
+       struct xpc_partition *part;
+       int wakeup_hb_checker = 0;
+
+       while ((msg_hdr = gru_get_next_message(xpc_activate_mq_uv)) != NULL) {
+
+               partid = msg_hdr->partid;
+               if (partid < 0 || partid >= XP_MAX_NPARTITIONS_UV) {
+                       dev_err(xpc_part, "xpc_handle_activate_IRQ_uv() "
+                               "received invalid partid=0x%x in message\n",
+                               partid);
+               } else {
+                       part = &xpc_partitions[partid];
+                       if (xpc_part_ref(part)) {
+                               xpc_handle_activate_mq_msg_uv(part, msg_hdr,
+                                                           &wakeup_hb_checker);
+                               xpc_part_deref(part);
+                       }
+               }
+
+               gru_free_message(xpc_activate_mq_uv, msg_hdr);
+       }
+
+       if (wakeup_hb_checker)
+               wake_up_interruptible(&xpc_activate_IRQ_wq);
+
+       return IRQ_HANDLED;
+}
+
+static enum xp_retval
+xpc_send_activate_IRQ_uv(struct xpc_partition *part, void *msg, size_t msg_size,
+                        int msg_type)
+{
+       struct xpc_activate_mq_msghdr_uv *msg_hdr = msg;
+
+       DBUG_ON(msg_size > XPC_ACTIVATE_MSG_SIZE_UV);
+
+       msg_hdr->type = msg_type;
+       msg_hdr->partid = XPC_PARTID(part);
+       msg_hdr->act_state = part->act_state;
+       msg_hdr->rp_ts_jiffies = xpc_rsvd_page->ts_jiffies;
+
+       /* ??? Is holding a spin_lock (ch->lock) during this call a bad idea? */
+       return xpc_send_gru_msg(part->sn.uv.remote_activate_mq_gpa, msg,
+                               msg_size);
+}
+
+static void
+xpc_send_activate_IRQ_part_uv(struct xpc_partition *part, void *msg,
+                             size_t msg_size, int msg_type)
+{
+       enum xp_retval ret;
+
+       ret = xpc_send_activate_IRQ_uv(part, msg, msg_size, msg_type);
+       if (unlikely(ret != xpSuccess))
+               XPC_DEACTIVATE_PARTITION(part, ret);
+}
+
+static void
+xpc_send_activate_IRQ_ch_uv(struct xpc_channel *ch, unsigned long *irq_flags,
+                        void *msg, size_t msg_size, int msg_type)
+{
+       struct xpc_partition *part = &xpc_partitions[ch->number];
+       enum xp_retval ret;
+
+       ret = xpc_send_activate_IRQ_uv(part, msg, msg_size, msg_type);
+       if (unlikely(ret != xpSuccess)) {
+               if (irq_flags != NULL)
+                       spin_unlock_irqrestore(&ch->lock, *irq_flags);
+
+               XPC_DEACTIVATE_PARTITION(part, ret);
+
+               if (irq_flags != NULL)
+                       spin_lock_irqsave(&ch->lock, *irq_flags);
+       }
+}
+
+static void
+xpc_send_local_activate_IRQ_uv(struct xpc_partition *part, int act_state_req)
+{
+       unsigned long irq_flags;
+       struct xpc_partition_uv *part_uv = &part->sn.uv;
+
+       /*
+        * !!! Make our side think that the remote parition sent an activate
+        * !!! message our way by doing what the activate IRQ handler would
+        * !!! do had one really been sent.
+        */
+
+       spin_lock_irqsave(&xpc_activate_IRQ_rcvd_lock, irq_flags);
+       if (part_uv->act_state_req == 0)
+               xpc_activate_IRQ_rcvd++;
+       part_uv->act_state_req = act_state_req;
+       spin_unlock_irqrestore(&xpc_activate_IRQ_rcvd_lock, irq_flags);
+
+       wake_up_interruptible(&xpc_activate_IRQ_wq);
+}
+
+static enum xp_retval
+xpc_get_partition_rsvd_page_pa_uv(void *buf, u64 *cookie, unsigned long *rp_pa,
+                                 size_t *len)
+{
+       /* !!! call the UV version of sn_partition_reserved_page_pa() */
+       return xpUnsupported;
+}
+
+static int
+xpc_setup_rsvd_page_sn_uv(struct xpc_rsvd_page *rp)
+{
+       rp->sn.activate_mq_gpa = uv_gpa(xpc_activate_mq_uv);
+       return 0;
+}
+
+static void
+xpc_send_heartbeat_uv(int msg_type)
+{
+       short partid;
+       struct xpc_partition *part;
+       struct xpc_activate_mq_msg_heartbeat_req_uv msg;
+
+       /*
+        * !!! On uv we're broadcasting a heartbeat message every 5 seconds.
+        * !!! Whereas on sn2 we're bte_copy'ng the heartbeat info every 20
+        * !!! seconds. This is an increase in numalink traffic.
+        * ??? Is this good?
+        */
+
+       msg.heartbeat = atomic64_inc_return(&xpc_heartbeat_uv);
+
+       partid = find_first_bit(xpc_heartbeating_to_mask_uv,
+                               XP_MAX_NPARTITIONS_UV);
+
+       while (partid < XP_MAX_NPARTITIONS_UV) {
+               part = &xpc_partitions[partid];
+
+               xpc_send_activate_IRQ_part_uv(part, &msg, sizeof(msg),
+                                             msg_type);
+
+               partid = find_next_bit(xpc_heartbeating_to_mask_uv,
+                                      XP_MAX_NPARTITIONS_UV, partid + 1);
+       }
+}
+
+static void
+xpc_increment_heartbeat_uv(void)
+{
+       xpc_send_heartbeat_uv(XPC_ACTIVATE_MQ_MSG_INC_HEARTBEAT_UV);
+}
+
+static void
+xpc_offline_heartbeat_uv(void)
+{
+       xpc_send_heartbeat_uv(XPC_ACTIVATE_MQ_MSG_OFFLINE_HEARTBEAT_UV);
+}
+
+static void
+xpc_online_heartbeat_uv(void)
+{
+       xpc_send_heartbeat_uv(XPC_ACTIVATE_MQ_MSG_ONLINE_HEARTBEAT_UV);
+}
+
+static void
+xpc_heartbeat_init_uv(void)
+{
+       atomic64_set(&xpc_heartbeat_uv, 0);
+       bitmap_zero(xpc_heartbeating_to_mask_uv, XP_MAX_NPARTITIONS_UV);
+       xpc_heartbeating_to_mask = &xpc_heartbeating_to_mask_uv[0];
+}
+
+static void
+xpc_heartbeat_exit_uv(void)
+{
+       xpc_send_heartbeat_uv(XPC_ACTIVATE_MQ_MSG_OFFLINE_HEARTBEAT_UV);
+}
+
+static enum xp_retval
+xpc_get_remote_heartbeat_uv(struct xpc_partition *part)
+{
+       struct xpc_partition_uv *part_uv = &part->sn.uv;
+       enum xp_retval ret = xpNoHeartbeat;
+
+       if (part_uv->remote_act_state != XPC_P_AS_INACTIVE &&
+           part_uv->remote_act_state != XPC_P_AS_DEACTIVATING) {
+
+               if (part_uv->heartbeat != part->last_heartbeat ||
+                   (part_uv->flags & XPC_P_HEARTBEAT_OFFLINE_UV)) {
+
+                       part->last_heartbeat = part_uv->heartbeat;
+                       ret = xpSuccess;
+               }
+       }
+       return ret;
+}
+
+static void
+xpc_request_partition_activation_uv(struct xpc_rsvd_page *remote_rp,
+                                   unsigned long remote_rp_gpa, int nasid)
+{
+       short partid = remote_rp->SAL_partid;
+       struct xpc_partition *part = &xpc_partitions[partid];
+       struct xpc_activate_mq_msg_activate_req_uv msg;
+
+       part->remote_rp_pa = remote_rp_gpa; /* !!! _pa here is really _gpa */
+       part->remote_rp_ts_jiffies = remote_rp->ts_jiffies;
+       part->sn.uv.remote_activate_mq_gpa = remote_rp->sn.activate_mq_gpa;
+
+       /*
+        * ??? Is it a good idea to make this conditional on what is
+        * ??? potentially stale state information?
+        */
+       if (part->sn.uv.remote_act_state == XPC_P_AS_INACTIVE) {
+               msg.rp_gpa = uv_gpa(xpc_rsvd_page);
+               msg.activate_mq_gpa = xpc_rsvd_page->sn.activate_mq_gpa;
+               xpc_send_activate_IRQ_part_uv(part, &msg, sizeof(msg),
+                                          XPC_ACTIVATE_MQ_MSG_ACTIVATE_REQ_UV);
+       }
+
+       if (part->act_state == XPC_P_AS_INACTIVE)
+               xpc_send_local_activate_IRQ_uv(part, XPC_P_ASR_ACTIVATE_UV);
+}
+
+static void
+xpc_request_partition_reactivation_uv(struct xpc_partition *part)
+{
+       xpc_send_local_activate_IRQ_uv(part, XPC_P_ASR_ACTIVATE_UV);
+}
+
+static void
+xpc_request_partition_deactivation_uv(struct xpc_partition *part)
+{
+       struct xpc_activate_mq_msg_deactivate_req_uv msg;
+
+       /*
+        * ??? Is it a good idea to make this conditional on what is
+        * ??? potentially stale state information?
+        */
+       if (part->sn.uv.remote_act_state != XPC_P_AS_DEACTIVATING &&
+           part->sn.uv.remote_act_state != XPC_P_AS_INACTIVE) {
+
+               msg.reason = part->reason;
+               xpc_send_activate_IRQ_part_uv(part, &msg, sizeof(msg),
+                                        XPC_ACTIVATE_MQ_MSG_DEACTIVATE_REQ_UV);
+       }
+}
+
+static void
+xpc_cancel_partition_deactivation_request_uv(struct xpc_partition *part)
+{
+       /* nothing needs to be done */
+       return;
+}
+
+static void
+xpc_init_fifo_uv(struct xpc_fifo_head_uv *head)
+{
+       head->first = NULL;
+       head->last = NULL;
+       spin_lock_init(&head->lock);
+       head->n_entries = 0;
+}
+
+static void *
+xpc_get_fifo_entry_uv(struct xpc_fifo_head_uv *head)
+{
+       unsigned long irq_flags;
+       struct xpc_fifo_entry_uv *first;
+
+       spin_lock_irqsave(&head->lock, irq_flags);
+       first = head->first;
+       if (head->first != NULL) {
+               head->first = first->next;
+               if (head->first == NULL)
+                       head->last = NULL;
+       }
+       head->n_entries++;
+       spin_unlock_irqrestore(&head->lock, irq_flags);
+       first->next = NULL;
+       return first;
+}
+
+static void
+xpc_put_fifo_entry_uv(struct xpc_fifo_head_uv *head,
+                     struct xpc_fifo_entry_uv *last)
+{
+       unsigned long irq_flags;
+
+       last->next = NULL;
+       spin_lock_irqsave(&head->lock, irq_flags);
+       if (head->last != NULL)
+               head->last->next = last;
+       else
+               head->first = last;
+       head->last = last;
+       head->n_entries--;
+       BUG_ON(head->n_entries < 0);
+       spin_unlock_irqrestore(&head->lock, irq_flags);
+}
+
+static int
+xpc_n_of_fifo_entries_uv(struct xpc_fifo_head_uv *head)
+{
+       return head->n_entries;
+}
+
+/*
+ * Setup the channel structures that are uv specific.
+ */
+static enum xp_retval
+xpc_setup_ch_structures_sn_uv(struct xpc_partition *part)
+{
+       struct xpc_channel_uv *ch_uv;
+       int ch_number;
+
+       for (ch_number = 0; ch_number < part->nchannels; ch_number++) {
+               ch_uv = &part->channels[ch_number].sn.uv;
+
+               xpc_init_fifo_uv(&ch_uv->msg_slot_free_list);
+               xpc_init_fifo_uv(&ch_uv->recv_msg_list);
+       }
+
+       return xpSuccess;
+}
+
+/*
+ * Teardown the channel structures that are uv specific.
+ */
+static void
+xpc_teardown_ch_structures_sn_uv(struct xpc_partition *part)
+{
+       /* nothing needs to be done */
+       return;
+}
+
+static enum xp_retval
+xpc_make_first_contact_uv(struct xpc_partition *part)
+{
+       struct xpc_activate_mq_msg_uv msg;
+
+       /*
+        * We send a sync msg to get the remote partition's remote_act_state
+        * updated to our current act_state which at this point should
+        * be XPC_P_AS_ACTIVATING.
+        */
+       xpc_send_activate_IRQ_part_uv(part, &msg, sizeof(msg),
+                                     XPC_ACTIVATE_MQ_MSG_SYNC_ACT_STATE_UV);
+
+       while (part->sn.uv.remote_act_state != XPC_P_AS_ACTIVATING) {
+
+               dev_dbg(xpc_part, "waiting to make first contact with "
+                       "partition %d\n", XPC_PARTID(part));
+
+               /* wait a 1/4 of a second or so */
+               (void)msleep_interruptible(250);
+
+               if (part->act_state == XPC_P_AS_DEACTIVATING)
+                       return part->reason;
+       }
+
+       return xpSuccess;
+}
+
+static u64
+xpc_get_chctl_all_flags_uv(struct xpc_partition *part)
+{
+       unsigned long irq_flags;
+       union xpc_channel_ctl_flags chctl;
+
+       spin_lock_irqsave(&part->chctl_lock, irq_flags);
+       chctl = part->chctl;
+       if (chctl.all_flags != 0)
+               part->chctl.all_flags = 0;
+
+       spin_unlock_irqrestore(&part->chctl_lock, irq_flags);
+       return chctl.all_flags;
+}
+
+static enum xp_retval
+xpc_allocate_send_msg_slot_uv(struct xpc_channel *ch)
+{
+       struct xpc_channel_uv *ch_uv = &ch->sn.uv;
+       struct xpc_send_msg_slot_uv *msg_slot;
+       unsigned long irq_flags;
+       int nentries;
+       int entry;
+       size_t nbytes;
+
+       for (nentries = ch->local_nentries; nentries > 0; nentries--) {
+               nbytes = nentries * sizeof(struct xpc_send_msg_slot_uv);
+               ch_uv->send_msg_slots = kzalloc(nbytes, GFP_KERNEL);
+               if (ch_uv->send_msg_slots == NULL)
+                       continue;
+
+               for (entry = 0; entry < nentries; entry++) {
+                       msg_slot = &ch_uv->send_msg_slots[entry];
+
+                       msg_slot->msg_slot_number = entry;
+                       xpc_put_fifo_entry_uv(&ch_uv->msg_slot_free_list,
+                                             &msg_slot->next);
+               }
+
+               spin_lock_irqsave(&ch->lock, irq_flags);
+               if (nentries < ch->local_nentries)
+                       ch->local_nentries = nentries;
+               spin_unlock_irqrestore(&ch->lock, irq_flags);
+               return xpSuccess;
+       }
+
+       return xpNoMemory;
+}
+
+static enum xp_retval
+xpc_allocate_recv_msg_slot_uv(struct xpc_channel *ch)
+{
+       struct xpc_channel_uv *ch_uv = &ch->sn.uv;
+       struct xpc_notify_mq_msg_uv *msg_slot;
+       unsigned long irq_flags;
+       int nentries;
+       int entry;
+       size_t nbytes;
+
+       for (nentries = ch->remote_nentries; nentries > 0; nentries--) {
+               nbytes = nentries * ch->entry_size;
+               ch_uv->recv_msg_slots = kzalloc(nbytes, GFP_KERNEL);
+               if (ch_uv->recv_msg_slots == NULL)
+                       continue;
+
+               for (entry = 0; entry < nentries; entry++) {
+                       msg_slot = ch_uv->recv_msg_slots + entry *
+                           ch->entry_size;
+
+                       msg_slot->hdr.msg_slot_number = entry;
+               }
+
+               spin_lock_irqsave(&ch->lock, irq_flags);
+               if (nentries < ch->remote_nentries)
+                       ch->remote_nentries = nentries;
+               spin_unlock_irqrestore(&ch->lock, irq_flags);
+               return xpSuccess;
+       }
+
+       return xpNoMemory;
+}
+
+/*
+ * Allocate msg_slots associated with the channel.
+ */
+static enum xp_retval
+xpc_setup_msg_structures_uv(struct xpc_channel *ch)
+{
+       static enum xp_retval ret;
+       struct xpc_channel_uv *ch_uv = &ch->sn.uv;
+
+       DBUG_ON(ch->flags & XPC_C_SETUP);
+
+       ret = xpc_allocate_send_msg_slot_uv(ch);
+       if (ret == xpSuccess) {
+
+               ret = xpc_allocate_recv_msg_slot_uv(ch);
+               if (ret != xpSuccess) {
+                       kfree(ch_uv->send_msg_slots);
+                       xpc_init_fifo_uv(&ch_uv->msg_slot_free_list);
+               }
+       }
+       return ret;
+}
+
+/*
+ * Free up msg_slots and clear other stuff that were setup for the specified
+ * channel.
+ */
+static void
+xpc_teardown_msg_structures_uv(struct xpc_channel *ch)
+{
+       struct xpc_channel_uv *ch_uv = &ch->sn.uv;
+
+       DBUG_ON(!spin_is_locked(&ch->lock));
+
+       ch_uv->remote_notify_mq_gpa = 0;
+
+       if (ch->flags & XPC_C_SETUP) {
+               xpc_init_fifo_uv(&ch_uv->msg_slot_free_list);
+               kfree(ch_uv->send_msg_slots);
+               xpc_init_fifo_uv(&ch_uv->recv_msg_list);
+               kfree(ch_uv->recv_msg_slots);
+       }
+}
+
+static void
+xpc_send_chctl_closerequest_uv(struct xpc_channel *ch, unsigned long *irq_flags)
+{
+       struct xpc_activate_mq_msg_chctl_closerequest_uv msg;
+
+       msg.ch_number = ch->number;
+       msg.reason = ch->reason;
+       xpc_send_activate_IRQ_ch_uv(ch, irq_flags, &msg, sizeof(msg),
+                                   XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREQUEST_UV);
+}
+
+static void
+xpc_send_chctl_closereply_uv(struct xpc_channel *ch, unsigned long *irq_flags)
+{
+       struct xpc_activate_mq_msg_chctl_closereply_uv msg;
+
+       msg.ch_number = ch->number;
+       xpc_send_activate_IRQ_ch_uv(ch, irq_flags, &msg, sizeof(msg),
+                                   XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREPLY_UV);
+}
+
+static void
+xpc_send_chctl_openrequest_uv(struct xpc_channel *ch, unsigned long *irq_flags)
+{
+       struct xpc_activate_mq_msg_chctl_openrequest_uv msg;
+
+       msg.ch_number = ch->number;
+       msg.entry_size = ch->entry_size;
+       msg.local_nentries = ch->local_nentries;
+       xpc_send_activate_IRQ_ch_uv(ch, irq_flags, &msg, sizeof(msg),
+                                   XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREQUEST_UV);
+}
+
+static void
+xpc_send_chctl_openreply_uv(struct xpc_channel *ch, unsigned long *irq_flags)
+{
+       struct xpc_activate_mq_msg_chctl_openreply_uv msg;
+
+       msg.ch_number = ch->number;
+       msg.local_nentries = ch->local_nentries;
+       msg.remote_nentries = ch->remote_nentries;
+       msg.local_notify_mq_gpa = uv_gpa(xpc_notify_mq_uv);
+       xpc_send_activate_IRQ_ch_uv(ch, irq_flags, &msg, sizeof(msg),
+                                   XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREPLY_UV);
+}
+
+static void
+xpc_send_chctl_local_msgrequest_uv(struct xpc_partition *part, int ch_number)
+{
+       unsigned long irq_flags;
+
+       spin_lock_irqsave(&part->chctl_lock, irq_flags);
+       part->chctl.flags[ch_number] |= XPC_CHCTL_MSGREQUEST;
+       spin_unlock_irqrestore(&part->chctl_lock, irq_flags);
+
+       xpc_wakeup_channel_mgr(part);
+}
+
+static void
+xpc_save_remote_msgqueue_pa_uv(struct xpc_channel *ch,
+                              unsigned long msgqueue_pa)
+{
+       ch->sn.uv.remote_notify_mq_gpa = msgqueue_pa;
+}
+
+static void
+xpc_indicate_partition_engaged_uv(struct xpc_partition *part)
+{
+       struct xpc_activate_mq_msg_uv msg;
+
+       xpc_send_activate_IRQ_part_uv(part, &msg, sizeof(msg),
+                                     XPC_ACTIVATE_MQ_MSG_MARK_ENGAGED_UV);
+}
+
+static void
+xpc_indicate_partition_disengaged_uv(struct xpc_partition *part)
+{
+       struct xpc_activate_mq_msg_uv msg;
+
+       xpc_send_activate_IRQ_part_uv(part, &msg, sizeof(msg),
+                                     XPC_ACTIVATE_MQ_MSG_MARK_DISENGAGED_UV);
+}
+
+static void
+xpc_assume_partition_disengaged_uv(short partid)
+{
+       struct xpc_partition_uv *part_uv = &xpc_partitions[partid].sn.uv;
+       unsigned long irq_flags;
+
+       spin_lock_irqsave(&part_uv->flags_lock, irq_flags);
+       part_uv->flags &= ~XPC_P_ENGAGED_UV;
+       spin_unlock_irqrestore(&part_uv->flags_lock, irq_flags);
+}
+
+static int
+xpc_partition_engaged_uv(short partid)
+{
+       return (xpc_partitions[partid].sn.uv.flags & XPC_P_ENGAGED_UV) != 0;
+}
+
+static int
+xpc_any_partition_engaged_uv(void)
+{
+       struct xpc_partition_uv *part_uv;
+       short partid;
+
+       for (partid = 0; partid < XP_MAX_NPARTITIONS_UV; partid++) {
+               part_uv = &xpc_partitions[partid].sn.uv;
+               if ((part_uv->flags & XPC_P_ENGAGED_UV) != 0)
+                       return 1;
+       }
+       return 0;
+}
+
+static enum xp_retval
+xpc_allocate_msg_slot_uv(struct xpc_channel *ch, u32 flags,
+                        struct xpc_send_msg_slot_uv **address_of_msg_slot)
+{
+       enum xp_retval ret;
+       struct xpc_send_msg_slot_uv *msg_slot;
+       struct xpc_fifo_entry_uv *entry;
+
+       while (1) {
+               entry = xpc_get_fifo_entry_uv(&ch->sn.uv.msg_slot_free_list);
+               if (entry != NULL)
+                       break;
+
+               if (flags & XPC_NOWAIT)
+                       return xpNoWait;
+
+               ret = xpc_allocate_msg_wait(ch);
+               if (ret != xpInterrupted && ret != xpTimeout)
+                       return ret;
+       }
+
+       msg_slot = container_of(entry, struct xpc_send_msg_slot_uv, next);
+       *address_of_msg_slot = msg_slot;
+       return xpSuccess;
+}
+
+static void
+xpc_free_msg_slot_uv(struct xpc_channel *ch,
+                    struct xpc_send_msg_slot_uv *msg_slot)
+{
+       xpc_put_fifo_entry_uv(&ch->sn.uv.msg_slot_free_list, &msg_slot->next);
+
+       /* wakeup anyone waiting for a free msg slot */
+       if (atomic_read(&ch->n_on_msg_allocate_wq) > 0)
+               wake_up(&ch->msg_allocate_wq);
+}
+
+static void
+xpc_notify_sender_uv(struct xpc_channel *ch,
+                    struct xpc_send_msg_slot_uv *msg_slot,
+                    enum xp_retval reason)
+{
+       xpc_notify_func func = msg_slot->func;
+
+       if (func != NULL && cmpxchg(&msg_slot->func, func, NULL) == func) {
+
+               atomic_dec(&ch->n_to_notify);
+
+               dev_dbg(xpc_chan, "msg_slot->func() called, msg_slot=0x%p "
+                       "msg_slot_number=%d partid=%d channel=%d\n", msg_slot,
+                       msg_slot->msg_slot_number, ch->partid, ch->number);
+
+               func(reason, ch->partid, ch->number, msg_slot->key);
+
+               dev_dbg(xpc_chan, "msg_slot->func() returned, msg_slot=0x%p "
+                       "msg_slot_number=%d partid=%d channel=%d\n", msg_slot,
+                       msg_slot->msg_slot_number, ch->partid, ch->number);
+       }
+}
+
+static void
+xpc_handle_notify_mq_ack_uv(struct xpc_channel *ch,
+                           struct xpc_notify_mq_msg_uv *msg)
+{
+       struct xpc_send_msg_slot_uv *msg_slot;
+       int entry = msg->hdr.msg_slot_number % ch->local_nentries;
+
+       msg_slot = &ch->sn.uv.send_msg_slots[entry];
+
+       BUG_ON(msg_slot->msg_slot_number != msg->hdr.msg_slot_number);
+       msg_slot->msg_slot_number += ch->local_nentries;
+
+       if (msg_slot->func != NULL)
+               xpc_notify_sender_uv(ch, msg_slot, xpMsgDelivered);
+
+       xpc_free_msg_slot_uv(ch, msg_slot);
+}
+
+static void
+xpc_handle_notify_mq_msg_uv(struct xpc_partition *part,
+                           struct xpc_notify_mq_msg_uv *msg)
+{
+       struct xpc_partition_uv *part_uv = &part->sn.uv;
+       struct xpc_channel *ch;
+       struct xpc_channel_uv *ch_uv;
+       struct xpc_notify_mq_msg_uv *msg_slot;
+       unsigned long irq_flags;
+       int ch_number = msg->hdr.ch_number;
+
+       if (unlikely(ch_number >= part->nchannels)) {
+               dev_err(xpc_part, "xpc_handle_notify_IRQ_uv() received invalid "
+                       "channel number=0x%x in message from partid=%d\n",
+                       ch_number, XPC_PARTID(part));
+
+               /* get hb checker to deactivate from the remote partition */
+               spin_lock_irqsave(&xpc_activate_IRQ_rcvd_lock, irq_flags);
+               if (part_uv->act_state_req == 0)
+                       xpc_activate_IRQ_rcvd++;
+               part_uv->act_state_req = XPC_P_ASR_DEACTIVATE_UV;
+               part_uv->reason = xpBadChannelNumber;
+               spin_unlock_irqrestore(&xpc_activate_IRQ_rcvd_lock, irq_flags);
+
+               wake_up_interruptible(&xpc_activate_IRQ_wq);
+               return;
+       }
+
+       ch = &part->channels[ch_number];
+       xpc_msgqueue_ref(ch);
+
+       if (!(ch->flags & XPC_C_CONNECTED)) {
+               xpc_msgqueue_deref(ch);
+               return;
+       }
+
+       /* see if we're really dealing with an ACK for a previously sent msg */
+       if (msg->hdr.size == 0) {
+               xpc_handle_notify_mq_ack_uv(ch, msg);
+               xpc_msgqueue_deref(ch);
+               return;
+       }
+
+       /* we're dealing with a normal message sent via the notify_mq */
+       ch_uv = &ch->sn.uv;
+
+       msg_slot = (struct xpc_notify_mq_msg_uv *)((u64)ch_uv->recv_msg_slots +
+                   (msg->hdr.msg_slot_number % ch->remote_nentries) *
+                   ch->entry_size);
+
+       BUG_ON(msg->hdr.msg_slot_number != msg_slot->hdr.msg_slot_number);
+       BUG_ON(msg_slot->hdr.size != 0);
+
+       memcpy(msg_slot, msg, msg->hdr.size);
+
+       xpc_put_fifo_entry_uv(&ch_uv->recv_msg_list, &msg_slot->hdr.u.next);
+
+       if (ch->flags & XPC_C_CONNECTEDCALLOUT_MADE) {
+               /*
+                * If there is an existing idle kthread get it to deliver
+                * the payload, otherwise we'll have to get the channel mgr
+                * for this partition to create a kthread to do the delivery.
+                */
+               if (atomic_read(&ch->kthreads_idle) > 0)
+                       wake_up_nr(&ch->idle_wq, 1);
+               else
+                       xpc_send_chctl_local_msgrequest_uv(part, ch->number);
+       }
+       xpc_msgqueue_deref(ch);
+}
+
+static irqreturn_t
+xpc_handle_notify_IRQ_uv(int irq, void *dev_id)
+{
+       struct xpc_notify_mq_msg_uv *msg;
+       short partid;
+       struct xpc_partition *part;
+
+       while ((msg = gru_get_next_message(xpc_notify_mq_uv)) != NULL) {
+
+               partid = msg->hdr.partid;
+               if (partid < 0 || partid >= XP_MAX_NPARTITIONS_UV) {
+                       dev_err(xpc_part, "xpc_handle_notify_IRQ_uv() received "
+                               "invalid partid=0x%x in message\n", partid);
+               } else {
+                       part = &xpc_partitions[partid];
+
+                       if (xpc_part_ref(part)) {
+                               xpc_handle_notify_mq_msg_uv(part, msg);
+                               xpc_part_deref(part);
+                       }
+               }
+
+               gru_free_message(xpc_notify_mq_uv, msg);
+       }
+
+       return IRQ_HANDLED;
+}
+
+static int
+xpc_n_of_deliverable_payloads_uv(struct xpc_channel *ch)
+{
+       return xpc_n_of_fifo_entries_uv(&ch->sn.uv.recv_msg_list);
+}
+
+static void
+xpc_process_msg_chctl_flags_uv(struct xpc_partition *part, int ch_number)
+{
+       struct xpc_channel *ch = &part->channels[ch_number];
+       int ndeliverable_payloads;
+
+       xpc_msgqueue_ref(ch);
+
+       ndeliverable_payloads = xpc_n_of_deliverable_payloads_uv(ch);
+
+       if (ndeliverable_payloads > 0 &&
+           (ch->flags & XPC_C_CONNECTED) &&
+           (ch->flags & XPC_C_CONNECTEDCALLOUT_MADE)) {
+
+               xpc_activate_kthreads(ch, ndeliverable_payloads);
+       }
+
+       xpc_msgqueue_deref(ch);
+}
+
+static enum xp_retval
+xpc_send_payload_uv(struct xpc_channel *ch, u32 flags, void *payload,
+                   u16 payload_size, u8 notify_type, xpc_notify_func func,
+                   void *key)
+{
+       enum xp_retval ret = xpSuccess;
+       struct xpc_send_msg_slot_uv *msg_slot = NULL;
+       struct xpc_notify_mq_msg_uv *msg;
+       u8 msg_buffer[XPC_NOTIFY_MSG_SIZE_UV];
+       size_t msg_size;
+
+       DBUG_ON(notify_type != XPC_N_CALL);
+
+       msg_size = sizeof(struct xpc_notify_mq_msghdr_uv) + payload_size;
+       if (msg_size > ch->entry_size)
+               return xpPayloadTooBig;
+
+       xpc_msgqueue_ref(ch);
+
+       if (ch->flags & XPC_C_DISCONNECTING) {
+               ret = ch->reason;
+               goto out_1;
+       }
+       if (!(ch->flags & XPC_C_CONNECTED)) {
+               ret = xpNotConnected;
+               goto out_1;
+       }
+
+       ret = xpc_allocate_msg_slot_uv(ch, flags, &msg_slot);
+       if (ret != xpSuccess)
+               goto out_1;
+
+       if (func != NULL) {
+               atomic_inc(&ch->n_to_notify);
+
+               msg_slot->key = key;
+               wmb(); /* a non-NULL func must hit memory after the key */
+               msg_slot->func = func;
+
+               if (ch->flags & XPC_C_DISCONNECTING) {
+                       ret = ch->reason;
+                       goto out_2;
+               }
+       }
+
+       msg = (struct xpc_notify_mq_msg_uv *)&msg_buffer;
+       msg->hdr.partid = xp_partition_id;
+       msg->hdr.ch_number = ch->number;
+       msg->hdr.size = msg_size;
+       msg->hdr.msg_slot_number = msg_slot->msg_slot_number;
+       memcpy(&msg->payload, payload, payload_size);
+
+       ret = xpc_send_gru_msg(ch->sn.uv.remote_notify_mq_gpa, msg, msg_size);
+       if (ret == xpSuccess)
+               goto out_1;
+
+       XPC_DEACTIVATE_PARTITION(&xpc_partitions[ch->partid], ret);
+out_2:
+       if (func != NULL) {
+               /*
+                * Try to NULL the msg_slot's func field. If we fail, then
+                * xpc_notify_senders_of_disconnect_uv() beat us to it, in which
+                * case we need to pretend we succeeded to send the message
+                * since the user will get a callout for the disconnect error
+                * by xpc_notify_senders_of_disconnect_uv(), and to also get an
+                * error returned here will confuse them. Additionally, since
+                * in this case the channel is being disconnected we don't need
+                * to put the the msg_slot back on the free list.
+                */
+               if (cmpxchg(&msg_slot->func, func, NULL) != func) {
+                       ret = xpSuccess;
+                       goto out_1;
+               }
+
+               msg_slot->key = NULL;
+               atomic_dec(&ch->n_to_notify);
+       }
+       xpc_free_msg_slot_uv(ch, msg_slot);
+out_1:
+       xpc_msgqueue_deref(ch);
+       return ret;
+}
+
+/*
+ * Tell the callers of xpc_send_notify() that the status of their payloads
+ * is unknown because the channel is now disconnecting.
+ *
+ * We don't worry about putting these msg_slots on the free list since the
+ * msg_slots themselves are about to be kfree'd.
+ */
+static void
+xpc_notify_senders_of_disconnect_uv(struct xpc_channel *ch)
+{
+       struct xpc_send_msg_slot_uv *msg_slot;
+       int entry;
+
+       DBUG_ON(!(ch->flags & XPC_C_DISCONNECTING));
+
+       for (entry = 0; entry < ch->local_nentries; entry++) {
+
+               if (atomic_read(&ch->n_to_notify) == 0)
+                       break;
+
+               msg_slot = &ch->sn.uv.send_msg_slots[entry];
+               if (msg_slot->func != NULL)
+                       xpc_notify_sender_uv(ch, msg_slot, ch->reason);
+       }
+}
+
+/*
+ * Get the next deliverable message's payload.
+ */
+static void *
+xpc_get_deliverable_payload_uv(struct xpc_channel *ch)
+{
+       struct xpc_fifo_entry_uv *entry;
+       struct xpc_notify_mq_msg_uv *msg;
+       void *payload = NULL;
+
+       if (!(ch->flags & XPC_C_DISCONNECTING)) {
+               entry = xpc_get_fifo_entry_uv(&ch->sn.uv.recv_msg_list);
+               if (entry != NULL) {
+                       msg = container_of(entry, struct xpc_notify_mq_msg_uv,
+                                          hdr.u.next);
+                       payload = &msg->payload;
+               }
+       }
+       return payload;
+}
+
+static void
+xpc_received_payload_uv(struct xpc_channel *ch, void *payload)
+{
+       struct xpc_notify_mq_msg_uv *msg;
+       enum xp_retval ret;
+
+       msg = container_of(payload, struct xpc_notify_mq_msg_uv, payload);
+
+       /* return an ACK to the sender of this message */
+
+       msg->hdr.partid = xp_partition_id;
+       msg->hdr.size = 0;      /* size of zero indicates this is an ACK */
+
+       ret = xpc_send_gru_msg(ch->sn.uv.remote_notify_mq_gpa, msg,
+                              sizeof(struct xpc_notify_mq_msghdr_uv));
+       if (ret != xpSuccess)
+               XPC_DEACTIVATE_PARTITION(&xpc_partitions[ch->partid], ret);
+
+       msg->hdr.msg_slot_number += ch->remote_nentries;
+}
+
+int
+xpc_init_uv(void)
+{
+       xpc_setup_partitions_sn = xpc_setup_partitions_sn_uv;
+       xpc_process_activate_IRQ_rcvd = xpc_process_activate_IRQ_rcvd_uv;
+       xpc_get_partition_rsvd_page_pa = xpc_get_partition_rsvd_page_pa_uv;
+       xpc_setup_rsvd_page_sn = xpc_setup_rsvd_page_sn_uv;
+       xpc_increment_heartbeat = xpc_increment_heartbeat_uv;
+       xpc_offline_heartbeat = xpc_offline_heartbeat_uv;
+       xpc_online_heartbeat = xpc_online_heartbeat_uv;
+       xpc_heartbeat_init = xpc_heartbeat_init_uv;
+       xpc_heartbeat_exit = xpc_heartbeat_exit_uv;
+       xpc_get_remote_heartbeat = xpc_get_remote_heartbeat_uv;
+
+       xpc_request_partition_activation = xpc_request_partition_activation_uv;
+       xpc_request_partition_reactivation =
+           xpc_request_partition_reactivation_uv;
+       xpc_request_partition_deactivation =
+           xpc_request_partition_deactivation_uv;
+       xpc_cancel_partition_deactivation_request =
+           xpc_cancel_partition_deactivation_request_uv;
+
+       xpc_setup_ch_structures_sn = xpc_setup_ch_structures_sn_uv;
+       xpc_teardown_ch_structures_sn = xpc_teardown_ch_structures_sn_uv;
+
+       xpc_make_first_contact = xpc_make_first_contact_uv;
+
+       xpc_get_chctl_all_flags = xpc_get_chctl_all_flags_uv;
+       xpc_send_chctl_closerequest = xpc_send_chctl_closerequest_uv;
+       xpc_send_chctl_closereply = xpc_send_chctl_closereply_uv;
+       xpc_send_chctl_openrequest = xpc_send_chctl_openrequest_uv;
+       xpc_send_chctl_openreply = xpc_send_chctl_openreply_uv;
+
+       xpc_save_remote_msgqueue_pa = xpc_save_remote_msgqueue_pa_uv;
+
+       xpc_setup_msg_structures = xpc_setup_msg_structures_uv;
+       xpc_teardown_msg_structures = xpc_teardown_msg_structures_uv;
+
+       xpc_indicate_partition_engaged = xpc_indicate_partition_engaged_uv;
+       xpc_indicate_partition_disengaged =
+           xpc_indicate_partition_disengaged_uv;
+       xpc_assume_partition_disengaged = xpc_assume_partition_disengaged_uv;
+       xpc_partition_engaged = xpc_partition_engaged_uv;
+       xpc_any_partition_engaged = xpc_any_partition_engaged_uv;
+
+       xpc_n_of_deliverable_payloads = xpc_n_of_deliverable_payloads_uv;
+       xpc_process_msg_chctl_flags = xpc_process_msg_chctl_flags_uv;
+       xpc_send_payload = xpc_send_payload_uv;
+       xpc_notify_senders_of_disconnect = xpc_notify_senders_of_disconnect_uv;
+       xpc_get_deliverable_payload = xpc_get_deliverable_payload_uv;
+       xpc_received_payload = xpc_received_payload_uv;
+
+       if (sizeof(struct xpc_notify_mq_msghdr_uv) > XPC_MSG_HDR_MAX_SIZE) {
+               dev_err(xpc_part, "xpc_notify_mq_msghdr_uv is larger than %d\n",
+                       XPC_MSG_HDR_MAX_SIZE);
+               return -E2BIG;
+       }
+
+       /* ??? The cpuid argument's value is 0, is that what we want? */
+       /* !!! The irq argument's value isn't correct. */
+       xpc_activate_mq_uv = xpc_create_gru_mq_uv(XPC_ACTIVATE_MQ_SIZE_UV, 0, 0,
+                                                 xpc_handle_activate_IRQ_uv);
+       if (xpc_activate_mq_uv == NULL)
+               return -ENOMEM;
+
+       /* ??? The cpuid argument's value is 0, is that what we want? */
+       /* !!! The irq argument's value isn't correct. */
+       xpc_notify_mq_uv = xpc_create_gru_mq_uv(XPC_NOTIFY_MQ_SIZE_UV, 0, 0,
+                                               xpc_handle_notify_IRQ_uv);
+       if (xpc_notify_mq_uv == NULL) {
+               /* !!! The irq argument's value isn't correct. */
+               xpc_destroy_gru_mq_uv(xpc_activate_mq_uv,
+                                     XPC_ACTIVATE_MQ_SIZE_UV, 0);
+               return -ENOMEM;
+       }
+
+       return 0;
+}
+
+void
+xpc_exit_uv(void)
+{
+       /* !!! The irq argument's value isn't correct. */
+       xpc_destroy_gru_mq_uv(xpc_notify_mq_uv, XPC_NOTIFY_MQ_SIZE_UV, 0);
+
+       /* !!! The irq argument's value isn't correct. */
+       xpc_destroy_gru_mq_uv(xpc_activate_mq_uv, XPC_ACTIVATE_MQ_SIZE_UV, 0);
+}
index 822dc8e..71513b3 100644 (file)
  */
 
 #include <linux/module.h>
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/ioport.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
-#include <linux/delay.h>
-#include <linux/ethtool.h>
-#include <linux/mii.h>
-#include <linux/smp.h>
-#include <linux/string.h>
-#include <asm/sn/bte.h>
-#include <asm/sn/io.h>
-#include <asm/sn/sn_sal.h>
-#include <asm/atomic.h>
 #include "xp.h"
 
 /*
@@ -57,7 +44,7 @@ struct xpnet_message {
        u16 version;            /* Version for this message */
        u16 embedded_bytes;     /* #of bytes embedded in XPC message */
        u32 magic;              /* Special number indicating this is xpnet */
-       u64 buf_pa;             /* phys address of buffer to retrieve */
+       unsigned long buf_pa;   /* phys address of buffer to retrieve */
        u32 size;               /* #of bytes in buffer */
        u8 leadin_ignore;       /* #of bytes to ignore at the beginning */
        u8 tailout_ignore;      /* #of bytes to ignore at the end */
@@ -70,11 +57,10 @@ struct xpnet_message {
  *
  * XPC expects each message to exist in an individual cacheline.
  */
-#define XPNET_MSG_SIZE         (L1_CACHE_BYTES - XPC_MSG_PAYLOAD_OFFSET)
+#define XPNET_MSG_SIZE         XPC_MSG_PAYLOAD_MAX_SIZE
 #define XPNET_MSG_DATA_MAX     \
-               (XPNET_MSG_SIZE - (u64)(&((struct xpnet_message *)0)->data))
-#define XPNET_MSG_ALIGNED_SIZE (L1_CACHE_ALIGN(XPNET_MSG_SIZE))
-#define XPNET_MSG_NENTRIES     (PAGE_SIZE / XPNET_MSG_ALIGNED_SIZE)
+               (XPNET_MSG_SIZE - offsetof(struct xpnet_message, data))
+#define XPNET_MSG_NENTRIES     (PAGE_SIZE / XPC_MSG_MAX_SIZE)
 
 #define XPNET_MAX_KTHREADS     (XPNET_MSG_NENTRIES + 1)
 #define XPNET_MAX_IDLE_KTHREADS        (XPNET_MSG_NENTRIES + 1)
@@ -105,7 +91,6 @@ struct xpnet_message {
  * then be released.
  */
 struct xpnet_pending_msg {
-       struct list_head free_list;
        struct sk_buff *skb;
        atomic_t use_count;
 };
@@ -121,7 +106,7 @@ struct net_device *xpnet_device;
  * When we are notified of other partitions activating, we add them to
  * our bitmask of partitions to which we broadcast.
  */
-static u64 xpnet_broadcast_partitions;
+static unsigned long *xpnet_broadcast_partitions;
 /* protect above */
 static DEFINE_SPINLOCK(xpnet_broadcast_lock);
 
@@ -141,16 +126,13 @@ static DEFINE_SPINLOCK(xpnet_broadcast_lock);
 #define XPNET_DEF_MTU (0x8000UL)
 
 /*
- * The partition id is encapsulated in the MAC address.  The following
- * define locates the octet the partid is in.
+ * The partid is encapsulated in the MAC address beginning in the following
+ * octet and it consists of two octets.
  */
-#define XPNET_PARTID_OCTET     1
-#define XPNET_LICENSE_OCTET    2
+#define XPNET_PARTID_OCTET     2
+
+/* Define the XPNET debug device structures to be used with dev_dbg() et al */
 
-/*
- * Define the XPNET debug device structure that is to be used with dev_dbg(),
- * dev_err(), dev_warn(), and dev_info().
- */
 struct device_driver xpnet_dbg_name = {
        .name = "xpnet"
 };
@@ -169,7 +151,8 @@ static void
 xpnet_receive(short partid, int channel, struct xpnet_message *msg)
 {
        struct sk_buff *skb;
-       bte_result_t bret;
+       void *dst;
+       enum xp_retval ret;
        struct xpnet_dev_private *priv =
            (struct xpnet_dev_private *)xpnet_device->priv;
 
@@ -201,7 +184,7 @@ xpnet_receive(short partid, int channel, struct xpnet_message *msg)
 
        /*
         * The allocated skb has some reserved space.
-        * In order to use bte_copy, we need to get the
+        * In order to use xp_remote_memcpy(), we need to get the
         * skb->data pointer moved forward.
         */
        skb_reserve(skb, (L1_CACHE_BYTES - ((u64)skb->data &
@@ -226,26 +209,21 @@ xpnet_receive(short partid, int channel, struct xpnet_message *msg)
                skb_copy_to_linear_data(skb, &msg->data,
                                        (size_t)msg->embedded_bytes);
        } else {
+               dst = (void *)((u64)skb->data & ~(L1_CACHE_BYTES - 1));
                dev_dbg(xpnet, "transferring buffer to the skb->data area;\n\t"
-                       "bte_copy(0x%p, 0x%p, %hu)\n", (void *)msg->buf_pa,
-                       (void *)__pa((u64)skb->data & ~(L1_CACHE_BYTES - 1)),
-                       msg->size);
-
-               bret = bte_copy(msg->buf_pa,
-                               __pa((u64)skb->data & ~(L1_CACHE_BYTES - 1)),
-                               msg->size, (BTE_NOTIFY | BTE_WACQUIRE), NULL);
+                       "xp_remote_memcpy(0x%p, 0x%p, %hu)\n", dst,
+                                         (void *)msg->buf_pa, msg->size);
 
-               if (bret != BTE_SUCCESS) {
+               ret = xp_remote_memcpy(xp_pa(dst), msg->buf_pa, msg->size);
+               if (ret != xpSuccess) {
                        /*
-                        * >>> Need better way of cleaning skb.  Currently skb
-                        * >>> appears in_use and we can't just call
-                        * >>> dev_kfree_skb.
+                        * !!! Need better way of cleaning skb.  Currently skb
+                        * !!! appears in_use and we can't just call
+                        * !!! dev_kfree_skb.
                         */
-                       dev_err(xpnet, "bte_copy(0x%p, 0x%p, 0x%hx) returned "
-                               "error=0x%x\n", (void *)msg->buf_pa,
-                               (void *)__pa((u64)skb->data &
-                                            ~(L1_CACHE_BYTES - 1)),
-                               msg->size, bret);
+                       dev_err(xpnet, "xp_remote_memcpy(0x%p, 0x%p, 0x%hx) "
+                               "returned error=0x%x\n", dst,
+                               (void *)msg->buf_pa, msg->size, ret);
 
                        xpc_received(partid, channel, (void *)msg);
 
@@ -285,9 +263,7 @@ static void
 xpnet_connection_activity(enum xp_retval reason, short partid, int channel,
                          void *data, void *key)
 {
-       long bp;
-
-       DBUG_ON(partid <= 0 || partid >= XP_MAX_PARTITIONS);
+       DBUG_ON(partid < 0 || partid >= xp_max_npartitions);
        DBUG_ON(channel != XPC_NET_CHANNEL);
 
        switch (reason) {
@@ -299,31 +275,28 @@ xpnet_connection_activity(enum xp_retval reason, short partid, int channel,
 
        case xpConnected:       /* connection completed to a partition */
                spin_lock_bh(&xpnet_broadcast_lock);
-               xpnet_broadcast_partitions |= 1UL << (partid - 1);
-               bp = xpnet_broadcast_partitions;
+               __set_bit(partid, xpnet_broadcast_partitions);
                spin_unlock_bh(&xpnet_broadcast_lock);
 
                netif_carrier_on(xpnet_device);
 
-               dev_dbg(xpnet, "%s connection created to partition %d; "
-                       "xpnet_broadcast_partitions=0x%lx\n",
-                       xpnet_device->name, partid, bp);
+               dev_dbg(xpnet, "%s connected to partition %d\n",
+                       xpnet_device->name, partid);
                break;
 
        default:
                spin_lock_bh(&xpnet_broadcast_lock);
-               xpnet_broadcast_partitions &= ~(1UL << (partid - 1));
-               bp = xpnet_broadcast_partitions;
+               __clear_bit(partid, xpnet_broadcast_partitions);
                spin_unlock_bh(&xpnet_broadcast_lock);
 
-               if (bp == 0)
+               if (bitmap_empty((unsigned long *)xpnet_broadcast_partitions,
+                                xp_max_npartitions)) {
                        netif_carrier_off(xpnet_device);
+               }
 
-               dev_dbg(xpnet, "%s disconnected from partition %d; "
-                       "xpnet_broadcast_partitions=0x%lx\n",
-                       xpnet_device->name, partid, bp);
+               dev_dbg(xpnet, "%s disconnected from partition %d\n",
+                       xpnet_device->name, partid);
                break;
-
        }
 }
 
@@ -334,8 +307,10 @@ xpnet_dev_open(struct net_device *dev)
 
        dev_dbg(xpnet, "calling xpc_connect(%d, 0x%p, NULL, %ld, %ld, %ld, "
                "%ld)\n", XPC_NET_CHANNEL, xpnet_connection_activity,
-               XPNET_MSG_SIZE, XPNET_MSG_NENTRIES, XPNET_MAX_KTHREADS,
-               XPNET_MAX_IDLE_KTHREADS);
+               (unsigned long)XPNET_MSG_SIZE,
+               (unsigned long)XPNET_MSG_NENTRIES,
+               (unsigned long)XPNET_MAX_KTHREADS,
+               (unsigned long)XPNET_MAX_IDLE_KTHREADS);
 
        ret = xpc_connect(XPC_NET_CHANNEL, xpnet_connection_activity, NULL,
                          XPNET_MSG_SIZE, XPNET_MSG_NENTRIES,
@@ -426,35 +401,74 @@ xpnet_send_completed(enum xp_retval reason, short partid, int channel,
        }
 }
 
+static void
+xpnet_send(struct sk_buff *skb, struct xpnet_pending_msg *queued_msg,
+          u64 start_addr, u64 end_addr, u16 embedded_bytes, int dest_partid)
+{
+       u8 msg_buffer[XPNET_MSG_SIZE];
+       struct xpnet_message *msg = (struct xpnet_message *)&msg_buffer;
+       u16 msg_size = sizeof(struct xpnet_message);
+       enum xp_retval ret;
+
+       msg->embedded_bytes = embedded_bytes;
+       if (unlikely(embedded_bytes != 0)) {
+               msg->version = XPNET_VERSION_EMBED;
+               dev_dbg(xpnet, "calling memcpy(0x%p, 0x%p, 0x%lx)\n",
+                       &msg->data, skb->data, (size_t)embedded_bytes);
+               skb_copy_from_linear_data(skb, &msg->data,
+                                         (size_t)embedded_bytes);
+               msg_size += embedded_bytes - 1;
+       } else {
+               msg->version = XPNET_VERSION;
+       }
+       msg->magic = XPNET_MAGIC;
+       msg->size = end_addr - start_addr;
+       msg->leadin_ignore = (u64)skb->data - start_addr;
+       msg->tailout_ignore = end_addr - (u64)skb_tail_pointer(skb);
+       msg->buf_pa = xp_pa((void *)start_addr);
+
+       dev_dbg(xpnet, "sending XPC message to %d:%d\n"
+               KERN_DEBUG "msg->buf_pa=0x%lx, msg->size=%u, "
+               "msg->leadin_ignore=%u, msg->tailout_ignore=%u\n",
+               dest_partid, XPC_NET_CHANNEL, msg->buf_pa, msg->size,
+               msg->leadin_ignore, msg->tailout_ignore);
+
+       atomic_inc(&queued_msg->use_count);
+
+       ret = xpc_send_notify(dest_partid, XPC_NET_CHANNEL, XPC_NOWAIT, msg,
+                             msg_size, xpnet_send_completed, queued_msg);
+       if (unlikely(ret != xpSuccess))
+               atomic_dec(&queued_msg->use_count);
+}
+
 /*
  * Network layer has formatted a packet (skb) and is ready to place it
  * "on the wire".  Prepare and send an xpnet_message to all partitions
  * which have connected with us and are targets of this packet.
  *
  * MAC-NOTE:  For the XPNET driver, the MAC address contains the
- * destination partition_id.  If the destination partition id word
- * is 0xff, this packet is to broadcast to all partitions.
+ * destination partid.  If the destination partid octets are 0xffff,
+ * this packet is to be broadcast to all connected partitions.
  */
 static int
 xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
        struct xpnet_pending_msg *queued_msg;
-       enum xp_retval ret;
-       struct xpnet_message *msg;
        u64 start_addr, end_addr;
-       long dp;
-       u8 second_mac_octet;
        short dest_partid;
-       struct xpnet_dev_private *priv;
-       u16 embedded_bytes;
-
-       priv = (struct xpnet_dev_private *)dev->priv;
+       struct xpnet_dev_private *priv = (struct xpnet_dev_private *)dev->priv;
+       u16 embedded_bytes = 0;
 
        dev_dbg(xpnet, ">skb->head=0x%p skb->data=0x%p skb->tail=0x%p "
                "skb->end=0x%p skb->len=%d\n", (void *)skb->head,
                (void *)skb->data, skb_tail_pointer(skb), skb_end_pointer(skb),
                skb->len);
 
+       if (skb->data[0] == 0x33) {
+               dev_kfree_skb(skb);
+               return 0;       /* nothing needed to be done */
+       }
+
        /*
         * The xpnet_pending_msg tracks how many outstanding
         * xpc_send_notifies are relying on this skb.  When none
@@ -466,7 +480,6 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
                         "packet\n", sizeof(struct xpnet_pending_msg));
 
                priv->stats.tx_errors++;
-
                return -ENOMEM;
        }
 
@@ -475,7 +488,6 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
        end_addr = L1_CACHE_ALIGN((u64)skb_tail_pointer(skb));
 
        /* calculate how many bytes to embed in the XPC message */
-       embedded_bytes = 0;
        if (unlikely(skb->len <= XPNET_MSG_DATA_MAX)) {
                /* skb->data does fit so embed */
                embedded_bytes = skb->len;
@@ -491,82 +503,28 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
        atomic_set(&queued_msg->use_count, 1);
        queued_msg->skb = skb;
 
-       second_mac_octet = skb->data[XPNET_PARTID_OCTET];
-       if (second_mac_octet == 0xff) {
+       if (skb->data[0] == 0xff) {
                /* we are being asked to broadcast to all partitions */
-               dp = xpnet_broadcast_partitions;
-       } else if (second_mac_octet != 0) {
-               dp = xpnet_broadcast_partitions &
-                   (1UL << (second_mac_octet - 1));
-       } else {
-               /* 0 is an invalid partid.  Ignore */
-               dp = 0;
-       }
-       dev_dbg(xpnet, "destination Partitions mask (dp) = 0x%lx\n", dp);
-
-       /*
-        * If we wanted to allow promiscuous mode to work like an
-        * unswitched network, this would be a good point to OR in a
-        * mask of partitions which should be receiving all packets.
-        */
-
-       /*
-        * Main send loop.
-        */
-       for (dest_partid = 1; dp && dest_partid < XP_MAX_PARTITIONS;
-            dest_partid++) {
+               for_each_bit(dest_partid, xpnet_broadcast_partitions,
+                            xp_max_npartitions) {
 
-               if (!(dp & (1UL << (dest_partid - 1)))) {
-                       /* not destined for this partition */
-                       continue;
+                       xpnet_send(skb, queued_msg, start_addr, end_addr,
+                                  embedded_bytes, dest_partid);
                }
+       } else {
+               dest_partid = (short)skb->data[XPNET_PARTID_OCTET + 1];
+               dest_partid |= (short)skb->data[XPNET_PARTID_OCTET + 0] << 8;
 
-               /* remove this partition from the destinations mask */
-               dp &= ~(1UL << (dest_partid - 1));
-
-               /* found a partition to send to */
-
-               ret = xpc_allocate(dest_partid, XPC_NET_CHANNEL,
-                                  XPC_NOWAIT, (void **)&msg);
-               if (unlikely(ret != xpSuccess))
-                       continue;
-
-               msg->embedded_bytes = embedded_bytes;
-               if (unlikely(embedded_bytes != 0)) {
-                       msg->version = XPNET_VERSION_EMBED;
-                       dev_dbg(xpnet, "calling memcpy(0x%p, 0x%p, 0x%lx)\n",
-                               &msg->data, skb->data, (size_t)embedded_bytes);
-                       skb_copy_from_linear_data(skb, &msg->data,
-                                                 (size_t)embedded_bytes);
-               } else {
-                       msg->version = XPNET_VERSION;
-               }
-               msg->magic = XPNET_MAGIC;
-               msg->size = end_addr - start_addr;
-               msg->leadin_ignore = (u64)skb->data - start_addr;
-               msg->tailout_ignore = end_addr - (u64)skb_tail_pointer(skb);
-               msg->buf_pa = __pa(start_addr);
-
-               dev_dbg(xpnet, "sending XPC message to %d:%d\n"
-                       KERN_DEBUG "msg->buf_pa=0x%lx, msg->size=%u, "
-                       "msg->leadin_ignore=%u, msg->tailout_ignore=%u\n",
-                       dest_partid, XPC_NET_CHANNEL, msg->buf_pa, msg->size,
-                       msg->leadin_ignore, msg->tailout_ignore);
-
-               atomic_inc(&queued_msg->use_count);
-
-               ret = xpc_send_notify(dest_partid, XPC_NET_CHANNEL, msg,
-                                     xpnet_send_completed, queued_msg);
-               if (unlikely(ret != xpSuccess)) {
-                       atomic_dec(&queued_msg->use_count);
-                       continue;
+               if (dest_partid >= 0 &&
+                   dest_partid < xp_max_npartitions &&
+                   test_bit(dest_partid, xpnet_broadcast_partitions) != 0) {
+
+                       xpnet_send(skb, queued_msg, start_addr, end_addr,
+                                  embedded_bytes, dest_partid);
                }
        }
 
        if (atomic_dec_return(&queued_msg->use_count) == 0) {
-               dev_dbg(xpnet, "no partitions to receive packet destined for "
-                       "%d\n", dest_partid);
-
                dev_kfree_skb(skb);
                kfree(queued_msg);
        }
@@ -594,23 +552,28 @@ xpnet_dev_tx_timeout(struct net_device *dev)
 static int __init
 xpnet_init(void)
 {
-       int i;
-       u32 license_num;
-       int result = -ENOMEM;
+       int result;
 
-       if (!ia64_platform_is("sn2"))
+       if (!is_shub() && !is_uv())
                return -ENODEV;
 
        dev_info(xpnet, "registering network device %s\n", XPNET_DEVICE_NAME);
 
+       xpnet_broadcast_partitions = kzalloc(BITS_TO_LONGS(xp_max_npartitions) *
+                                            sizeof(long), GFP_KERNEL);
+       if (xpnet_broadcast_partitions == NULL)
+               return -ENOMEM;
+
        /*
         * use ether_setup() to init the majority of our device
         * structure and then override the necessary pieces.
         */
        xpnet_device = alloc_netdev(sizeof(struct xpnet_dev_private),
                                    XPNET_DEVICE_NAME, ether_setup);
-       if (xpnet_device == NULL)
+       if (xpnet_device == NULL) {
+               kfree(xpnet_broadcast_partitions);
                return -ENOMEM;
+       }
 
        netif_carrier_off(xpnet_device);
 
@@ -628,14 +591,10 @@ xpnet_init(void)
         * MAC addresses.  We chose the first octet of the MAC to be unlikely
         * to collide with any vendor's officially issued MAC.
         */
-       xpnet_device->dev_addr[0] = 0xfe;
-       xpnet_device->dev_addr[XPNET_PARTID_OCTET] = sn_partition_id;
-       license_num = sn_partition_serial_number_val();
-       for (i = 3; i >= 0; i--) {
-               xpnet_device->dev_addr[XPNET_LICENSE_OCTET + i] =
-                   license_num & 0xff;
-               license_num = license_num >> 8;
-       }
+       xpnet_device->dev_addr[0] = 0x02;     /* locally administered, no OUI */
+
+       xpnet_device->dev_addr[XPNET_PARTID_OCTET + 1] = xp_partition_id;
+       xpnet_device->dev_addr[XPNET_PARTID_OCTET + 0] = (xp_partition_id >> 8);
 
        /*
         * ether_setup() sets this to a multicast device.  We are
@@ -651,8 +610,10 @@ xpnet_init(void)
        xpnet_device->features = NETIF_F_NO_CSUM;
 
        result = register_netdev(xpnet_device);
-       if (result != 0)
+       if (result != 0) {
                free_netdev(xpnet_device);
+               kfree(xpnet_broadcast_partitions);
+       }
 
        return result;
 }
@@ -666,8 +627,8 @@ xpnet_exit(void)
                 xpnet_device[0].name);
 
        unregister_netdev(xpnet_device);
-
        free_netdev(xpnet_device);
+       kfree(xpnet_broadcast_partitions);
 }
 
 module_exit(xpnet_exit);
index 66e5a54..86dbb36 100644 (file)
@@ -213,7 +213,8 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
        struct mmc_blk_data *md = mq->data;
        struct mmc_card *card = md->queue.card;
        struct mmc_blk_request brq;
-       int ret = 1, sg_pos, data_size;
+       int ret = 1, data_size, i;
+       struct scatterlist *sg;
 
        mmc_claim_host(card->host);
 
@@ -267,18 +268,22 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
 
                mmc_queue_bounce_pre(mq);
 
+               /*
+                * Adjust the sg list so it is the same size as the
+                * request.
+                */
                if (brq.data.blocks !=
                    (req->nr_sectors >> (md->block_bits - 9))) {
                        data_size = brq.data.blocks * brq.data.blksz;
-                       for (sg_pos = 0; sg_pos < brq.data.sg_len; sg_pos++) {
-                               data_size -= mq->sg[sg_pos].length;
+                       for_each_sg(brq.data.sg, sg, brq.data.sg_len, i) {
+                               data_size -= sg->length;
                                if (data_size <= 0) {
-                                       mq->sg[sg_pos].length += data_size;
-                                       sg_pos++;
+                                       sg->length += data_size;
+                                       i++;
                                        break;
                                }
                        }
-                       brq.data.sg_len = sg_pos;
+                       brq.data.sg_len = i;
                }
 
                mmc_wait_for_req(card->host, &brq.mrq);
index a067fe4..f26b01d 100644 (file)
@@ -388,16 +388,14 @@ static int mmc_test_transfer(struct mmc_test_card *test,
        int ret, i;
        unsigned long flags;
 
-       BUG_ON(blocks * blksz > BUFFER_SIZE);
-
        if (write) {
                for (i = 0;i < blocks * blksz;i++)
                        test->scratch[i] = i;
        } else {
-               memset(test->scratch, 0, blocks * blksz);
+               memset(test->scratch, 0, BUFFER_SIZE);
        }
        local_irq_save(flags);
-       sg_copy_from_buffer(sg, sg_len, test->scratch, blocks * blksz);
+       sg_copy_from_buffer(sg, sg_len, test->scratch, BUFFER_SIZE);
        local_irq_restore(flags);
 
        ret = mmc_test_set_blksize(test, blksz);
@@ -444,7 +442,7 @@ static int mmc_test_transfer(struct mmc_test_card *test,
                }
        } else {
                local_irq_save(flags);
-               sg_copy_to_buffer(sg, sg_len, test->scratch, blocks * blksz);
+               sg_copy_to_buffer(sg, sg_len, test->scratch, BUFFER_SIZE);
                local_irq_restore(flags);
                for (i = 0;i < blocks * blksz;i++) {
                        if (test->scratch[i] != (u8)i)
@@ -805,69 +803,6 @@ static int mmc_test_multi_xfersize_read(struct mmc_test_card *test)
        return 0;
 }
 
-static int mmc_test_bigsg_write(struct mmc_test_card *test)
-{
-       int ret;
-       unsigned int size;
-       struct scatterlist sg;
-
-       if (test->card->host->max_blk_count == 1)
-               return RESULT_UNSUP_HOST;
-
-       size = PAGE_SIZE * 2;
-       size = min(size, test->card->host->max_req_size);
-       size = min(size, test->card->host->max_seg_size);
-       size = min(size, test->card->host->max_blk_count * 512);
-
-       memset(test->buffer, 0, BUFFER_SIZE);
-
-       if (size < 1024)
-               return RESULT_UNSUP_HOST;
-
-       sg_init_table(&sg, 1);
-       sg_init_one(&sg, test->buffer, BUFFER_SIZE);
-
-       ret = mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 1);
-       if (ret)
-               return ret;
-
-       return 0;
-}
-
-static int mmc_test_bigsg_read(struct mmc_test_card *test)
-{
-       int ret, i;
-       unsigned int size;
-       struct scatterlist sg;
-
-       if (test->card->host->max_blk_count == 1)
-               return RESULT_UNSUP_HOST;
-
-       size = PAGE_SIZE * 2;
-       size = min(size, test->card->host->max_req_size);
-       size = min(size, test->card->host->max_seg_size);
-       size = min(size, test->card->host->max_blk_count * 512);
-
-       if (size < 1024)
-               return RESULT_UNSUP_HOST;
-
-       memset(test->buffer, 0xCD, BUFFER_SIZE);
-
-       sg_init_table(&sg, 1);
-       sg_init_one(&sg, test->buffer, BUFFER_SIZE);
-       ret = mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 0);
-       if (ret)
-               return ret;
-
-       /* mmc_test_transfer() doesn't check for read overflows */
-       for (i = size;i < BUFFER_SIZE;i++) {
-               if (test->buffer[i] != 0xCD)
-                       return RESULT_FAIL;
-       }
-
-       return 0;
-}
-
 #ifdef CONFIG_HIGHMEM
 
 static int mmc_test_write_high(struct mmc_test_card *test)
@@ -1071,20 +1006,6 @@ static const struct mmc_test_case mmc_test_cases[] = {
                .run = mmc_test_multi_xfersize_read,
        },
 
-       {
-               .name = "Over-sized SG list write",
-               .prepare = mmc_test_prepare_write,
-               .run = mmc_test_bigsg_write,
-               .cleanup = mmc_test_cleanup,
-       },
-
-       {
-               .name = "Over-sized SG list read",
-               .prepare = mmc_test_prepare_read,
-               .run = mmc_test_bigsg_read,
-               .cleanup = mmc_test_cleanup,
-       },
-
 #ifdef CONFIG_HIGHMEM
 
        {
index 3ee5b8c..044d84e 100644 (file)
@@ -121,6 +121,7 @@ mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
 {
 #ifdef CONFIG_MMC_DEBUG
        unsigned int i, sz;
+       struct scatterlist *sg;
 #endif
 
        pr_debug("%s: starting CMD%u arg %08x flags %08x\n",
@@ -156,8 +157,8 @@ mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
 
 #ifdef CONFIG_MMC_DEBUG
                sz = 0;
-               for (i = 0;i < mrq->data->sg_len;i++)
-                       sz += mrq->data->sg[i].length;
+               for_each_sg(mrq->data->sg, sg, mrq->data->sg_len, i)
+                       sz += sg->length;
                BUG_ON(sz != mrq->data->blocks * mrq->data->blksz);
 #endif
 
index 99b2091..d3f5561 100644 (file)
 
 /* Hardware definitions */
 #define AU1XMMC_DESCRIPTOR_COUNT 1
-#define AU1XMMC_DESCRIPTOR_SIZE  2048
+
+/* max DMA seg size: 64KB on Au1100, 4MB on Au1200 */
+#ifdef CONFIG_SOC_AU1100
+#define AU1XMMC_DESCRIPTOR_SIZE 0x0000ffff
+#else  /* Au1200 */
+#define AU1XMMC_DESCRIPTOR_SIZE 0x003fffff
+#endif
 
 #define AU1XMMC_OCR (MMC_VDD_27_28 | MMC_VDD_28_29 | MMC_VDD_29_30 | \
                     MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 | \
index deb607c..fcb14c2 100644 (file)
@@ -143,7 +143,8 @@ static int jmicron_probe(struct sdhci_pci_chip *chip)
                chip->quirks |= SDHCI_QUIRK_32BIT_DMA_ADDR |
                          SDHCI_QUIRK_32BIT_DMA_SIZE |
                          SDHCI_QUIRK_32BIT_ADMA_SIZE |
-                         SDHCI_QUIRK_RESET_AFTER_REQUEST;
+                         SDHCI_QUIRK_RESET_AFTER_REQUEST |
+                         SDHCI_QUIRK_BROKEN_SMALL_PIO;
        }
 
        /*
index 5f95e10..e3a8133 100644 (file)
@@ -278,6 +278,15 @@ static void sdhci_transfer_pio(struct sdhci_host *host)
        else
                mask = SDHCI_SPACE_AVAILABLE;
 
+       /*
+        * Some controllers (JMicron JMB38x) mess up the buffer bits
+        * for transfers < 4 bytes. As long as it is just one block,
+        * we can ignore the bits.
+        */
+       if ((host->quirks & SDHCI_QUIRK_BROKEN_SMALL_PIO) &&
+               (host->data->blocks == 1))
+               mask = ~0;
+
        while (readl(host->ioaddr + SDHCI_PRESENT_STATE) & mask) {
                if (host->data->flags & MMC_DATA_READ)
                        sdhci_read_block_pio(host);
@@ -439,7 +448,7 @@ static int sdhci_adma_table_pre(struct sdhci_host *host,
 
        host->adma_addr = dma_map_single(mmc_dev(host->mmc),
                host->adma_desc, (128 * 2 + 1) * 4, DMA_TO_DEVICE);
-       if (dma_mapping_error(mmc_dev(host->mmc), host->align_addr))
+       if (dma_mapping_error(mmc_dev(host->mmc), host->adma_addr))
                goto unmap_entries;
        BUG_ON(host->adma_addr & 0x3);
 
@@ -645,7 +654,7 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data)
                                 * us an invalid request.
                                 */
                                WARN_ON(1);
-                               host->flags &= ~SDHCI_USE_DMA;
+                               host->flags &= ~SDHCI_REQ_USE_DMA;
                        } else {
                                writel(host->adma_addr,
                                        host->ioaddr + SDHCI_ADMA_ADDRESS);
@@ -664,7 +673,7 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data)
                                 * us an invalid request.
                                 */
                                WARN_ON(1);
-                               host->flags &= ~SDHCI_USE_DMA;
+                               host->flags &= ~SDHCI_REQ_USE_DMA;
                        } else {
                                WARN_ON(sg_cnt != 1);
                                writel(sg_dma_address(data->sg),
index e354fae..197d4a0 100644 (file)
@@ -206,6 +206,8 @@ struct sdhci_host {
 #define SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER            (1<<11)
 /* Controller provides an incorrect timeout value for transfers */
 #define SDHCI_QUIRK_BROKEN_TIMEOUT_VAL                 (1<<12)
+/* Controller has an issue with buffer bits for small transfers */
+#define SDHCI_QUIRK_BROKEN_SMALL_PIO                   (1<<13)
 
        int                     irq;            /* Device IRQ */
        void __iomem *          ioaddr;         /* Mapped address */
index dbba5ab..f84ab61 100644 (file)
@@ -41,7 +41,7 @@
 
 
 /* AMD */
-#define AM29DL800BB    0x22C8
+#define AM29DL800BB    0x22CB
 #define AM29DL800BT    0x224A
 
 #define AM29F800BB     0x2258
index 54e36bf..8bd0dea 100644 (file)
@@ -15,6 +15,8 @@
 #include <linux/delay.h>
 #include <linux/device.h>
 #include <linux/mutex.h>
+#include <linux/err.h>
+
 #include <linux/spi/spi.h>
 #include <linux/spi/flash.h>
 
@@ -487,9 +489,8 @@ add_dataflash(struct spi_device *spi, char *name,
        device->write = dataflash_write;
        device->priv = priv;
 
-       dev_info(&spi->dev, "%s (%d KBytes) pagesize %d bytes, "
-               "erasesize %d bytes\n", name, device->size/1024,
-                pagesize, pagesize * 8);       /* 8 pages = 1 block */
+       dev_info(&spi->dev, "%s (%d KBytes) pagesize %d bytes\n",
+                       name, DIV_ROUND_UP(device->size, 1024), pagesize);
        dev_set_drvdata(&spi->dev, priv);
 
        if (mtd_has_partitions()) {
@@ -518,65 +519,57 @@ add_dataflash(struct spi_device *spi, char *name,
        return add_mtd_device(device) == 1 ? -ENODEV : 0;
 }
 
-/*
- * Detect and initialize DataFlash device:
- *
- *   Device      Density         ID code          #Pages PageSize  Offset
- *   AT45DB011B  1Mbit   (128K)  xx0011xx (0x0c)    512    264      9
- *   AT45DB021B  2Mbit   (256K)  xx0101xx (0x14)   1024    264      9
- *   AT45DB041B  4Mbit   (512K)  xx0111xx (0x1c)   2048    264      9
- *   AT45DB081B  8Mbit   (1M)    xx1001xx (0x24)   4096    264      9
- *   AT45DB0161B 16Mbit  (2M)    xx1011xx (0x2c)   4096    528     10
- *   AT45DB0321B 32Mbit  (4M)    xx1101xx (0x34)   8192    528     10
- *   AT45DB0642  64Mbit  (8M)    xx111xxx (0x3c)   8192   1056     11
- *   AT45DB1282  128Mbit (16M)   xx0100xx (0x10)  16384   1056     11
- */
-
 struct flash_info {
        char            *name;
 
-       /* JEDEC id zero means "no ID" (most older chips); otherwise it has
-        * a high byte of zero plus three data bytes: the manufacturer id,
-        * then a two byte device id.
+       /* JEDEC id has a high byte of zero plus three data bytes:
+        * the manufacturer id, then a two byte device id.
         */
        uint32_t        jedec_id;
 
-       /* The size listed here is what works with OPCODE_SE, which isn't
-        * necessarily called a "sector" by the vendor.
-        */
+       /* The size listed here is what works with OP_ERASE_PAGE. */
        unsigned        nr_pages;
        uint16_t        pagesize;
        uint16_t        pageoffset;
 
        uint16_t        flags;
-#define        SUP_POW2PS      0x02
-#define        IS_POW2PS       0x01
+#define SUP_POW2PS     0x0002          /* supports 2^N byte pages */
+#define IS_POW2PS      0x0001          /* uses 2^N byte pages */
 };
 
 static struct flash_info __devinitdata dataflash_data [] = {
 
-       { "at45db011d",  0x1f2200, 512, 264, 9, SUP_POW2PS},
+       /*
+        * NOTE:  chips with SUP_POW2PS (rev D and up) need two entries,
+        * one with IS_POW2PS and the other without.  The entry with the
+        * non-2^N byte page size can't name exact chip revisions without
+        * losing backwards compatibility for cmdlinepart.
+        *
+        * These newer chips also support 128-byte security registers (with
+        * 64 bytes one-time-programmable) and software write-protection.
+        */
+       { "AT45DB011B",  0x1f2200, 512, 264, 9, SUP_POW2PS},
        { "at45db011d",  0x1f2200, 512, 256, 8, SUP_POW2PS | IS_POW2PS},
 
-       { "at45db021d",  0x1f2300, 1024, 264, 9, SUP_POW2PS},
+       { "AT45DB021B",  0x1f2300, 1024, 264, 9, SUP_POW2PS},
        { "at45db021d",  0x1f2300, 1024, 256, 8, SUP_POW2PS | IS_POW2PS},
 
-       { "at45db041d",  0x1f2400, 2048, 264, 9, SUP_POW2PS},
+       { "AT45DB041x",  0x1f2400, 2048, 264, 9, SUP_POW2PS},
        { "at45db041d",  0x1f2400, 2048, 256, 8, SUP_POW2PS | IS_POW2PS},
 
-       { "at45db081d",  0x1f2500, 4096, 264, 9, SUP_POW2PS},
+       { "AT45DB081B",  0x1f2500, 4096, 264, 9, SUP_POW2PS},
        { "at45db081d",  0x1f2500, 4096, 256, 8, SUP_POW2PS | IS_POW2PS},
 
-       { "at45db161d",  0x1f2600, 4096, 528, 10, SUP_POW2PS},
+       { "AT45DB161x",  0x1f2600, 4096, 528, 10, SUP_POW2PS},
        { "at45db161d",  0x1f2600, 4096, 512, 9, SUP_POW2PS | IS_POW2PS},
 
-       { "at45db321c",  0x1f2700, 8192, 528, 10, },
+       { "AT45DB321x",  0x1f2700, 8192, 528, 10, 0},           /* rev C */
 
-       { "at45db321d",  0x1f2701, 8192, 528, 10, SUP_POW2PS},
+       { "AT45DB321x",  0x1f2701, 8192, 528, 10, SUP_POW2PS},
        { "at45db321d",  0x1f2701, 8192, 512, 9, SUP_POW2PS | IS_POW2PS},
 
-       { "at45db641d",  0x1f2800, 8192, 1056, 11, SUP_POW2PS},
-       { "at45db641d",  0x1f2800, 8192, 1024, 10, SUP_POW2PS | IS_POW2PS},
+       { "AT45DB642x",  0x1f2800, 8192, 1056, 11, SUP_POW2PS},
+       { "at45db642d",  0x1f2800, 8192, 1024, 10, SUP_POW2PS | IS_POW2PS},
 };
 
 static struct flash_info *__devinit jedec_probe(struct spi_device *spi)
@@ -588,17 +581,23 @@ static struct flash_info *__devinit jedec_probe(struct spi_device *spi)
        struct flash_info       *info;
        int status;
 
-
        /* JEDEC also defines an optional "extended device information"
         * string for after vendor-specific data, after the three bytes
         * we use here.  Supporting some chips might require using it.
+        *
+        * If the vendor ID isn't Atmel's (0x1f), assume this call failed.
+        * That's not an error; only rev C and newer chips handle it, and
+        * only Atmel sells these chips.
         */
        tmp = spi_write_then_read(spi, &code, 1, id, 3);
        if (tmp < 0) {
                DEBUG(MTD_DEBUG_LEVEL0, "%s: error %d reading JEDEC ID\n",
                        spi->dev.bus_id, tmp);
-               return NULL;
+               return ERR_PTR(tmp);
        }
+       if (id[0] != 0x1f)
+               return NULL;
+
        jedec = id[0];
        jedec = jedec << 8;
        jedec |= id[1];
@@ -609,19 +608,53 @@ static struct flash_info *__devinit jedec_probe(struct spi_device *spi)
                        tmp < ARRAY_SIZE(dataflash_data);
                        tmp++, info++) {
                if (info->jedec_id == jedec) {
+                       DEBUG(MTD_DEBUG_LEVEL1, "%s: OTP, sector protect%s\n",
+                               dev_name(&spi->dev),
+                               (info->flags & SUP_POW2PS)
+                                       ? ", binary pagesize" : ""
+                               );
                        if (info->flags & SUP_POW2PS) {
                                status = dataflash_status(spi);
-                               if (status & 0x1)
-                                       /* return power of 2 pagesize */
-                                       return ++info;
-                               else
-                                       return info;
+                               if (status < 0) {
+                                       DEBUG(MTD_DEBUG_LEVEL1,
+                                               "%s: status error %d\n",
+                                               dev_name(&spi->dev), status);
+                                       return ERR_PTR(status);
+                               }
+                               if (status & 0x1) {
+                                       if (info->flags & IS_POW2PS)
+                                               return info;
+                               } else {
+                                       if (!(info->flags & IS_POW2PS))
+                                               return info;
+                               }
                        }
                }
        }
-       return NULL;
+
+       /*
+        * Treat other chips as errors ... we won't know the right page
+        * size (it might be binary) even when we can tell which density
+        * class is involved (legacy chip id scheme).
+        */
+       dev_warn(&spi->dev, "JEDEC id %06x not handled\n", jedec);
+       return ERR_PTR(-ENODEV);
 }
 
+/*
+ * Detect and initialize DataFlash device, using JEDEC IDs on newer chips
+ * or else the ID code embedded in the status bits:
+ *
+ *   Device      Density         ID code          #Pages PageSize  Offset
+ *   AT45DB011B  1Mbit   (128K)  xx0011xx (0x0c)    512    264      9
+ *   AT45DB021B  2Mbit   (256K)  xx0101xx (0x14)   1024    264      9
+ *   AT45DB041B  4Mbit   (512K)  xx0111xx (0x1c)   2048    264      9
+ *   AT45DB081B  8Mbit   (1M)    xx1001xx (0x24)   4096    264      9
+ *   AT45DB0161B 16Mbit  (2M)    xx1011xx (0x2c)   4096    528     10
+ *   AT45DB0321B 32Mbit  (4M)    xx1101xx (0x34)   8192    528     10
+ *   AT45DB0642  64Mbit  (8M)    xx111xxx (0x3c)   8192   1056     11
+ *   AT45DB1282  128Mbit (16M)   xx0100xx (0x10)  16384   1056     11
+ */
 static int __devinit dataflash_probe(struct spi_device *spi)
 {
        int status;
@@ -632,14 +665,17 @@ static int __devinit dataflash_probe(struct spi_device *spi)
         * If it succeeds we know we have either a C or D part.
         * D will support power of 2 pagesize option.
         */
-
        info = jedec_probe(spi);
-
+       if (IS_ERR(info))
+               return PTR_ERR(info);
        if (info != NULL)
                return add_dataflash(spi, info->name, info->nr_pages,
                                 info->pagesize, info->pageoffset);
 
-
+       /*
+        * Older chips support only legacy commands, identifing
+        * capacity using bits in the status byte.
+        */
        status = dataflash_status(spi);
        if (status <= 0 || status == 0xff) {
                DEBUG(MTD_DEBUG_LEVEL1, "%s: status error %d\n",
@@ -661,13 +697,13 @@ static int __devinit dataflash_probe(struct spi_device *spi)
                status = add_dataflash(spi, "AT45DB021B", 1024, 264, 9);
                break;
        case 0x1c:      /* 0 1 1 1 x x */
-               status = add_dataflash(spi, "AT45DB041B", 2048, 264, 9);
+               status = add_dataflash(spi, "AT45DB041x", 2048, 264, 9);
                break;
        case 0x24:      /* 1 0 0 1 x x */
                status = add_dataflash(spi, "AT45DB081B", 4096, 264, 9);
                break;
        case 0x2c:      /* 1 0 1 1 x x */
-               status = add_dataflash(spi, "AT45DB161B", 4096, 528, 10);
+               status = add_dataflash(spi, "AT45DB161x", 4096, 528, 10);
                break;
        case 0x34:      /* 1 1 0 1 x x */
                status = add_dataflash(spi, "AT45DB321x", 8192, 528, 10);
index a806119..113b106 100644 (file)
@@ -25,7 +25,7 @@
 #endif
 
 #include <asm/hardware.h>
-#include <asm/arch-sa1100/h3600.h>
+#include <asm/arch/h3600.h>
 #include <asm/io.h>
 
 
index 28cc678..00d46e1 100644 (file)
@@ -125,8 +125,11 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
               int (*fill_super)(struct super_block *, void *, int),
               struct vfsmount *mnt)
 {
-       struct nameidata nd;
-       int mtdnr, ret;
+#ifdef CONFIG_BLOCK
+       struct block_device *bdev;
+       int ret, major;
+#endif
+       int mtdnr;
 
        if (!dev_name)
                return -EINVAL;
@@ -178,45 +181,38 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
                }
        }
 
+#ifdef CONFIG_BLOCK
        /* try the old way - the hack where we allowed users to mount
         * /dev/mtdblock$(n) but didn't actually _use_ the blockdev
         */
-       ret = path_lookup(dev_name, LOOKUP_FOLLOW, &nd);
-
-       DEBUG(1, "MTDSB: path_lookup() returned %d, inode %p\n",
-             ret, nd.path.dentry ? nd.path.dentry->d_inode : NULL);
-
-       if (ret)
+       bdev = lookup_bdev(dev_name);
+       if (IS_ERR(bdev)) {
+               ret = PTR_ERR(bdev);
+               DEBUG(1, "MTDSB: lookup_bdev() returned %d\n", ret);
                return ret;
+       }
+       DEBUG(1, "MTDSB: lookup_bdev() returned 0\n");
 
        ret = -EINVAL;
 
-       if (!S_ISBLK(nd.path.dentry->d_inode->i_mode))
-               goto out;
-
-       if (nd.path.mnt->mnt_flags & MNT_NODEV) {
-               ret = -EACCES;
-               goto out;
-       }
+       major = MAJOR(bdev->bd_dev);
+       mtdnr = MINOR(bdev->bd_dev);
+       bdput(bdev);
 
-       if (imajor(nd.path.dentry->d_inode) != MTD_BLOCK_MAJOR)
+       if (major != MTD_BLOCK_MAJOR)
                goto not_an_MTD_device;
 
-       mtdnr = iminor(nd.path.dentry->d_inode);
-       path_put(&nd.path);
-
        return get_sb_mtd_nr(fs_type, flags, dev_name, data, mtdnr, fill_super,
                             mnt);
 
 not_an_MTD_device:
+#endif /* CONFIG_BLOCK */
+
        if (!(flags & MS_SILENT))
                printk(KERN_NOTICE
                       "MTD: Attempt to mount non-MTD device \"%s\"\n",
                       dev_name);
-out:
-       path_put(&nd.path);
-       return ret;
-
+       return -EINVAL;
 }
 
 EXPORT_SYMBOL_GPL(get_sb_mtd);
index 71406e5..02f9cc3 100644 (file)
@@ -104,11 +104,24 @@ config MTD_NAND_BF5XX
 
 config MTD_NAND_BF5XX_HWECC
        bool "BF5XX NAND Hardware ECC"
+       default y
        depends on MTD_NAND_BF5XX
        help
          Enable the use of the BF5XX's internal ECC generator when
          using NAND.
 
+config MTD_NAND_BF5XX_BOOTROM_ECC
+       bool "Use Blackfin BootROM ECC Layout"
+       default n
+       depends on MTD_NAND_BF5XX_HWECC
+       help
+         If you wish to modify NAND pages and allow the Blackfin on-chip
+         BootROM to boot from them, say Y here.  This is only necessary
+         if you are booting U-Boot out of NAND and you wish to update
+         U-Boot from Linux' userspace.  Otherwise, you should say N here.
+
+         If unsure, say N.
+
 config MTD_NAND_RTC_FROM4
        tristate "Renesas Flash ROM 4-slot interface board (FROM_BOARD4)"
        depends on SH_SOLUTION_ENGINE
index e87a572..9af2a2c 100644 (file)
@@ -91,6 +91,41 @@ static const unsigned short bfin_nfc_pin_req[] =
         P_NAND_ALE,
         0};
 
+#ifdef CONFIG_MTD_NAND_BF5XX_BOOTROM_ECC
+static uint8_t bbt_pattern[] = { 0xff };
+
+static struct nand_bbt_descr bootrom_bbt = {
+       .options = 0,
+       .offs = 63,
+       .len = 1,
+       .pattern = bbt_pattern,
+};
+
+static struct nand_ecclayout bootrom_ecclayout = {
+       .eccbytes = 24,
+       .eccpos = {
+               0x8 * 0, 0x8 * 0 + 1, 0x8 * 0 + 2,
+               0x8 * 1, 0x8 * 1 + 1, 0x8 * 1 + 2,
+               0x8 * 2, 0x8 * 2 + 1, 0x8 * 2 + 2,
+               0x8 * 3, 0x8 * 3 + 1, 0x8 * 3 + 2,
+               0x8 * 4, 0x8 * 4 + 1, 0x8 * 4 + 2,
+               0x8 * 5, 0x8 * 5 + 1, 0x8 * 5 + 2,
+               0x8 * 6, 0x8 * 6 + 1, 0x8 * 6 + 2,
+               0x8 * 7, 0x8 * 7 + 1, 0x8 * 7 + 2
+       },
+       .oobfree = {
+               { 0x8 * 0 + 3, 5 },
+               { 0x8 * 1 + 3, 5 },
+               { 0x8 * 2 + 3, 5 },
+               { 0x8 * 3 + 3, 5 },
+               { 0x8 * 4 + 3, 5 },
+               { 0x8 * 5 + 3, 5 },
+               { 0x8 * 6 + 3, 5 },
+               { 0x8 * 7 + 3, 5 },
+       }
+};
+#endif
+
 /*
  * Data structures for bf5xx nand flash controller driver
  */
@@ -273,7 +308,7 @@ static int bf5xx_nand_correct_data(struct mtd_info *mtd, u_char *dat,
                dat += 256;
                read_ecc += 8;
                calc_ecc += 8;
-               ret = bf5xx_nand_correct_data_256(mtd, dat, read_ecc, calc_ecc);
+               ret |= bf5xx_nand_correct_data_256(mtd, dat, read_ecc, calc_ecc);
        }
 
        return ret;
@@ -298,7 +333,7 @@ static int bf5xx_nand_calculate_ecc(struct mtd_info *mtd,
        ecc0 = bfin_read_NFC_ECC0();
        ecc1 = bfin_read_NFC_ECC1();
 
-       code[0] = (ecc0 & 0x3FF) | ((ecc1 & 0x3FF) << 11);
+       code[0] = (ecc0 & 0x7ff) | ((ecc1 & 0x7ff) << 11);
 
        dev_dbg(info->device, "returning ecc 0x%08x\n", code[0]);
 
@@ -310,7 +345,7 @@ static int bf5xx_nand_calculate_ecc(struct mtd_info *mtd,
        if (page_size == 512) {
                ecc0 = bfin_read_NFC_ECC2();
                ecc1 = bfin_read_NFC_ECC3();
-               code[1] = (ecc0 & 0x3FF) | ((ecc1 & 0x3FF) << 11);
+               code[1] = (ecc0 & 0x7ff) | ((ecc1 & 0x7ff) << 11);
 
                /* second 3 bytes in ecc_code for second 256
                 * bytes of 512 page size
@@ -514,7 +549,6 @@ static void bf5xx_nand_dma_write_buf(struct mtd_info *mtd,
 /*
  * System initialization functions
  */
-
 static int bf5xx_nand_dma_init(struct bf5xx_nand_info *info)
 {
        int ret;
@@ -547,6 +581,13 @@ static int bf5xx_nand_dma_init(struct bf5xx_nand_info *info)
        return 0;
 }
 
+static void bf5xx_nand_dma_remove(struct bf5xx_nand_info *info)
+{
+       /* Free NFC DMA channel */
+       if (hardware_ecc)
+               free_dma(CH_NFC);
+}
+
 /*
  * BF5XX NFC hardware initialization
  *  - pin mux setup
@@ -605,7 +646,7 @@ static int bf5xx_nand_add_partition(struct bf5xx_nand_info *info)
 #endif
 }
 
-static int bf5xx_nand_remove(struct platform_device *pdev)
+static int __devexit bf5xx_nand_remove(struct platform_device *pdev)
 {
        struct bf5xx_nand_info *info = to_nand_info(pdev);
        struct mtd_info *mtd = NULL;
@@ -623,6 +664,7 @@ static int bf5xx_nand_remove(struct platform_device *pdev)
        }
 
        peripheral_free_list(bfin_nfc_pin_req);
+       bf5xx_nand_dma_remove(info);
 
        /* free the common resources */
        kfree(info);
@@ -638,7 +680,7 @@ static int bf5xx_nand_remove(struct platform_device *pdev)
  * it can allocate all necessary resources then calls the
  * nand layer to look for devices
  */
-static int bf5xx_nand_probe(struct platform_device *pdev)
+static int __devinit bf5xx_nand_probe(struct platform_device *pdev)
 {
        struct bf5xx_nand_platform *plat = to_nand_plat(pdev);
        struct bf5xx_nand_info *info = NULL;
@@ -648,22 +690,21 @@ static int bf5xx_nand_probe(struct platform_device *pdev)
 
        dev_dbg(&pdev->dev, "(%p)\n", pdev);
 
-       if (peripheral_request_list(bfin_nfc_pin_req, DRV_NAME)) {
-               printk(KERN_ERR DRV_NAME
-               ": Requesting Peripherals failed\n");
-               return -EFAULT;
-       }
-
        if (!plat) {
                dev_err(&pdev->dev, "no platform specific information\n");
-               goto exit_error;
+               return -EINVAL;
+       }
+
+       if (peripheral_request_list(bfin_nfc_pin_req, DRV_NAME)) {
+               dev_err(&pdev->dev, "requesting Peripherals failed\n");
+               return -EFAULT;
        }
 
        info = kzalloc(sizeof(*info), GFP_KERNEL);
        if (info == NULL) {
                dev_err(&pdev->dev, "no memory for flash info\n");
                err = -ENOMEM;
-               goto exit_error;
+               goto out_err_kzalloc;
        }
 
        platform_set_drvdata(pdev, info);
@@ -707,11 +748,16 @@ static int bf5xx_nand_probe(struct platform_device *pdev)
 
        /* initialise the hardware */
        err = bf5xx_nand_hw_init(info);
-       if (err != 0)
-               goto exit_error;
+       if (err)
+               goto out_err_hw_init;
 
        /* setup hardware ECC data struct */
        if (hardware_ecc) {
+#ifdef CONFIG_MTD_NAND_BF5XX_BOOTROM_ECC
+               chip->badblock_pattern = &bootrom_bbt;
+               chip->ecc.layout = &bootrom_ecclayout;
+#endif
+
                if (plat->page_size == NFC_PG_SIZE_256) {
                        chip->ecc.bytes = 3;
                        chip->ecc.size = 256;
@@ -733,7 +779,7 @@ static int bf5xx_nand_probe(struct platform_device *pdev)
        /* scan hardware nand chip and setup mtd info data struct */
        if (nand_scan(mtd, 1)) {
                err = -ENXIO;
-               goto exit_error;
+               goto out_err_nand_scan;
        }
 
        /* add NAND partition */
@@ -742,11 +788,14 @@ static int bf5xx_nand_probe(struct platform_device *pdev)
        dev_dbg(&pdev->dev, "initialised ok\n");
        return 0;
 
-exit_error:
-       bf5xx_nand_remove(pdev);
+out_err_nand_scan:
+       bf5xx_nand_dma_remove(info);
+out_err_hw_init:
+       platform_set_drvdata(pdev, NULL);
+       kfree(info);
+out_err_kzalloc:
+       peripheral_free_list(bfin_nfc_pin_req);
 
-       if (err == 0)
-               err = -EINVAL;
        return err;
 }
 
@@ -775,7 +824,7 @@ static int bf5xx_nand_resume(struct platform_device *dev)
 /* driver device registration */
 static struct platform_driver bf5xx_nand_driver = {
        .probe          = bf5xx_nand_probe,
-       .remove         = bf5xx_nand_remove,
+       .remove         = __devexit_p(bf5xx_nand_remove),
        .suspend        = bf5xx_nand_suspend,
        .resume         = bf5xx_nand_resume,
        .driver         = {
index 765d4f0..e4226e0 100644 (file)
@@ -1125,9 +1125,9 @@ static inline int __init nftl_partscan(struct mtd_info *mtd, struct mtd_partitio
                goto out;
        mh = (struct NFTLMediaHeader *)buf;
 
-       mh->NumEraseUnits = le16_to_cpu(mh->NumEraseUnits);
-       mh->FirstPhysicalEUN = le16_to_cpu(mh->FirstPhysicalEUN);
-       mh->FormattedSize = le32_to_cpu(mh->FormattedSize);
+       le16_to_cpus(&mh->NumEraseUnits);
+       le16_to_cpus(&mh->FirstPhysicalEUN);
+       le32_to_cpus(&mh->FormattedSize);
 
        printk(KERN_INFO "    DataOrgID        = %s\n"
                         "    NumEraseUnits    = %d\n"
@@ -1235,12 +1235,12 @@ static inline int __init inftl_partscan(struct mtd_info *mtd, struct mtd_partiti
        doc->mh1_page = doc->mh0_page + (4096 >> this->page_shift);
        mh = (struct INFTLMediaHeader *)buf;
 
-       mh->NoOfBootImageBlocks = le32_to_cpu(mh->NoOfBootImageBlocks);
-       mh->NoOfBinaryPartitions = le32_to_cpu(mh->NoOfBinaryPartitions);
-       mh->NoOfBDTLPartitions = le32_to_cpu(mh->NoOfBDTLPartitions);
-       mh->BlockMultiplierBits = le32_to_cpu(mh->BlockMultiplierBits);
-       mh->FormatFlags = le32_to_cpu(mh->FormatFlags);
-       mh->PercentUsed = le32_to_cpu(mh->PercentUsed);
+       le32_to_cpus(&mh->NoOfBootImageBlocks);
+       le32_to_cpus(&mh->NoOfBinaryPartitions);
+       le32_to_cpus(&mh->NoOfBDTLPartitions);
+       le32_to_cpus(&mh->BlockMultiplierBits);
+       le32_to_cpus(&mh->FormatFlags);
+       le32_to_cpus(&mh->PercentUsed);
 
        printk(KERN_INFO "    bootRecordID          = %s\n"
                         "    NoOfBootImageBlocks   = %d\n"
@@ -1277,12 +1277,12 @@ static inline int __init inftl_partscan(struct mtd_info *mtd, struct mtd_partiti
        /* Scan the partitions */
        for (i = 0; (i < 4); i++) {
                ip = &(mh->Partitions[i]);
-               ip->virtualUnits = le32_to_cpu(ip->virtualUnits);
-               ip->firstUnit = le32_to_cpu(ip->firstUnit);
-               ip->lastUnit = le32_to_cpu(ip->lastUnit);
-               ip->flags = le32_to_cpu(ip->flags);
-               ip->spareUnits = le32_to_cpu(ip->spareUnits);
-               ip->Reserved0 = le32_to_cpu(ip->Reserved0);
+               le32_to_cpus(&ip->virtualUnits);
+               le32_to_cpus(&ip->firstUnit);
+               le32_to_cpus(&ip->lastUnit);
+               le32_to_cpus(&ip->flags);
+               le32_to_cpus(&ip->spareUnits);
+               le32_to_cpus(&ip->Reserved0);
 
                printk(KERN_INFO        "    PARTITION[%d] ->\n"
                        "        virtualUnits    = %d\n"
index 9dff513..98ad3ce 100644 (file)
@@ -887,7 +887,7 @@ static int __devinit fsl_elbc_chip_probe(struct fsl_elbc_ctrl *ctrl,
                goto err;
        }
 
-       priv->mtd.name = kasprintf(GFP_KERNEL, "%x.flash", res.start);
+       priv->mtd.name = kasprintf(GFP_KERNEL, "%x.flash", (unsigned)res.start);
        if (!priv->mtd.name) {
                ret = -ENOMEM;
                goto err;
index ecd70e2..556e813 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/vmalloc.h>
+#include <asm/div64.h>
 #include <linux/slab.h>
 #include <linux/errno.h>
 #include <linux/string.h>
@@ -207,13 +208,16 @@ MODULE_PARM_DESC(overridesize,   "Specifies the NAND Flash size overriding the I
 #define STATE_CMD_READID       0x0000000A /* read ID */
 #define STATE_CMD_ERASE2       0x0000000B /* sector erase second command */
 #define STATE_CMD_RESET        0x0000000C /* reset */
+#define STATE_CMD_RNDOUT       0x0000000D /* random output command */
+#define STATE_CMD_RNDOUTSTART  0x0000000E /* random output start command */
 #define STATE_CMD_MASK         0x0000000F /* command states mask */
 
 /* After an address is input, the simulator goes to one of these states */
 #define STATE_ADDR_PAGE        0x00000010 /* full (row, column) address is accepted */
 #define STATE_ADDR_SEC         0x00000020 /* sector address was accepted */
-#define STATE_ADDR_ZERO        0x00000030 /* one byte zero address was accepted */
-#define STATE_ADDR_MASK        0x00000030 /* address states mask */
+#define STATE_ADDR_COLUMN      0x00000030 /* column address was accepted */
+#define STATE_ADDR_ZERO        0x00000040 /* one byte zero address was accepted */
+#define STATE_ADDR_MASK        0x00000070 /* address states mask */
 
 /* Durind data input/output the simulator is in these states */
 #define STATE_DATAIN           0x00000100 /* waiting for data input */
@@ -240,7 +244,7 @@ MODULE_PARM_DESC(overridesize,   "Specifies the NAND Flash size overriding the I
 #define ACTION_OOBOFF    0x00600000 /* add to address OOB offset */
 #define ACTION_MASK      0x00700000 /* action mask */
 
-#define NS_OPER_NUM      12 /* Number of operations supported by the simulator */
+#define NS_OPER_NUM      13 /* Number of operations supported by the simulator */
 #define NS_OPER_STATES   6  /* Maximum number of states in operation */
 
 #define OPT_ANY          0xFFFFFFFF /* any chip supports this operation */
@@ -373,7 +377,10 @@ static struct nandsim_operations {
        {OPT_ANY, {STATE_CMD_READID, STATE_ADDR_ZERO, STATE_DATAOUT_ID, STATE_READY}},
        /* Large page devices read page */
        {OPT_LARGEPAGE, {STATE_CMD_READ0, STATE_ADDR_PAGE, STATE_CMD_READSTART | ACTION_CPY,
-                              STATE_DATAOUT, STATE_READY}}
+                              STATE_DATAOUT, STATE_READY}},
+       /* Large page devices random page read */
+       {OPT_LARGEPAGE, {STATE_CMD_RNDOUT, STATE_ADDR_COLUMN, STATE_CMD_RNDOUTSTART | ACTION_CPY,
+                              STATE_DATAOUT, STATE_READY}},
 };
 
 struct weak_block {
@@ -579,7 +586,8 @@ static int init_nandsim(struct mtd_info *mtd)
        if (ns->busw == 16)
                NS_WARN("16-bit flashes support wasn't tested\n");
 
-       printk("flash size: %llu MiB\n",        ns->geom.totsz >> 20);
+       printk("flash size: %llu MiB\n",
+                       (unsigned long long)ns->geom.totsz >> 20);
        printk("page size: %u bytes\n",         ns->geom.pgsz);
        printk("OOB area size: %u bytes\n",     ns->geom.oobsz);
        printk("sector size: %u KiB\n",         ns->geom.secsz >> 10);
@@ -588,8 +596,9 @@ static int init_nandsim(struct mtd_info *mtd)
        printk("bus width: %u\n",               ns->busw);
        printk("bits in sector size: %u\n",     ns->geom.secshift);
        printk("bits in page size: %u\n",       ns->geom.pgshift);
-       printk("bits in OOB size: %u\n",        ns->geom.oobshift);
-       printk("flash size with OOB: %llu KiB\n", ns->geom.totszoob >> 10);
+       printk("bits in OOB size: %u\n",        ns->geom.oobshift);
+       printk("flash size with OOB: %llu KiB\n",
+                       (unsigned long long)ns->geom.totszoob >> 10);
        printk("page address bytes: %u\n",      ns->geom.pgaddrbytes);
        printk("sector address bytes: %u\n",    ns->geom.secaddrbytes);
        printk("options: %#x\n",                ns->options);
@@ -937,12 +946,18 @@ static char *get_state_name(uint32_t state)
                        return "STATE_CMD_ERASE2";
                case STATE_CMD_RESET:
                        return "STATE_CMD_RESET";
+               case STATE_CMD_RNDOUT:
+                       return "STATE_CMD_RNDOUT";
+               case STATE_CMD_RNDOUTSTART:
+                       return "STATE_CMD_RNDOUTSTART";
                case STATE_ADDR_PAGE:
                        return "STATE_ADDR_PAGE";
                case STATE_ADDR_SEC:
                        return "STATE_ADDR_SEC";
                case STATE_ADDR_ZERO:
                        return "STATE_ADDR_ZERO";
+               case STATE_ADDR_COLUMN:
+                       return "STATE_ADDR_COLUMN";
                case STATE_DATAIN:
                        return "STATE_DATAIN";
                case STATE_DATAOUT:
@@ -973,6 +988,7 @@ static int check_command(int cmd)
        switch (cmd) {
 
        case NAND_CMD_READ0:
+       case NAND_CMD_READ1:
        case NAND_CMD_READSTART:
        case NAND_CMD_PAGEPROG:
        case NAND_CMD_READOOB:
@@ -982,7 +998,8 @@ static int check_command(int cmd)
        case NAND_CMD_READID:
        case NAND_CMD_ERASE2:
        case NAND_CMD_RESET:
-       case NAND_CMD_READ1:
+       case NAND_CMD_RNDOUT:
+       case NAND_CMD_RNDOUTSTART:
                return 0;
 
        case NAND_CMD_STATUS_MULTI:
@@ -1021,6 +1038,10 @@ static uint32_t get_state_by_command(unsigned command)
                        return STATE_CMD_ERASE2;
                case NAND_CMD_RESET:
                        return STATE_CMD_RESET;
+               case NAND_CMD_RNDOUT:
+                       return STATE_CMD_RNDOUT;
+               case NAND_CMD_RNDOUTSTART:
+                       return STATE_CMD_RNDOUTSTART;
        }
 
        NS_ERR("get_state_by_command: unknown command, BUG\n");
@@ -1582,6 +1603,11 @@ static void switch_state(struct nandsim *ns)
                                ns->regs.num = 1;
                                break;
 
+                       case STATE_ADDR_COLUMN:
+                               /* Column address is always 2 bytes */
+                               ns->regs.num = ns->geom.pgaddrbytes - ns->geom.secaddrbytes;
+                               break;
+
                        default:
                                NS_ERR("switch_state: BUG! unknown address state\n");
                }
@@ -1693,15 +1719,21 @@ static void ns_nand_write_byte(struct mtd_info *mtd, u_char byte)
                        return;
                }
 
-               /*
-                * Chip might still be in STATE_DATAOUT
-                * (if OPT_AUTOINCR feature is supported), STATE_DATAOUT_STATUS or
-                * STATE_DATAOUT_STATUS_M state. If so, switch state.
-                */
+               /* Check that the command byte is correct */
+               if (check_command(byte)) {
+                       NS_ERR("write_byte: unknown command %#x\n", (uint)byte);
+                       return;
+               }
+
                if (NS_STATE(ns->state) == STATE_DATAOUT_STATUS
                        || NS_STATE(ns->state) == STATE_DATAOUT_STATUS_M
-                       || ((ns->options & OPT_AUTOINCR) && NS_STATE(ns->state) == STATE_DATAOUT))
+                       || NS_STATE(ns->state) == STATE_DATAOUT) {
+                       int row = ns->regs.row;
+
                        switch_state(ns);
+                       if (byte == NAND_CMD_RNDOUT)
+                               ns->regs.row = row;
+               }
 
                /* Check if chip is expecting command */
                if (NS_STATE(ns->nxstate) != STATE_UNKNOWN && !(ns->nxstate & STATE_CMD_MASK)) {
@@ -1715,12 +1747,6 @@ static void ns_nand_write_byte(struct mtd_info *mtd, u_char byte)
                        switch_to_ready_state(ns, NS_STATUS_FAILED(ns));
                }
 
-               /* Check that the command byte is correct */
-               if (check_command(byte)) {
-                       NS_ERR("write_byte: unknown command %#x\n", (uint)byte);
-                       return;
-               }
-
                NS_DBG("command byte corresponding to %s state accepted\n",
                        get_state_name(get_state_by_command(byte)));
                ns->regs.command = byte;
index fa533c2..8a03875 100644 (file)
@@ -510,14 +510,14 @@ config STNIC
 config SH_ETH
        tristate "Renesas SuperH Ethernet support"
        depends on SUPERH && \
-               (CPU_SUBTYPE_SH7710 || CPU_SUBTYPE_SH7712)
+               (CPU_SUBTYPE_SH7710 || CPU_SUBTYPE_SH7712 || CPU_SUBTYPE_SH7763)
        select CRC32
        select MII
        select MDIO_BITBANG
        select PHYLIB
        help
          Renesas SuperH Ethernet device driver.
-         This driver support SH7710 and SH7712.
+         This driver support SH7710, SH7712 and SH7763.
 
 config SUNLANCE
        tristate "Sun LANCE support"
index a8ec60e..3db7db1 100644 (file)
@@ -605,36 +605,87 @@ adjust_head:
 static int bfin_mac_hard_start_xmit(struct sk_buff *skb,
                                struct net_device *dev)
 {
-       unsigned int data;
+       u16 *data;
 
        current_tx_ptr->skb = skb;
 
-       /*
-        * Is skb->data always 16-bit aligned?
-        * Do we need to memcpy((char *)(tail->packet + 2), skb->data, len)?
-        */
-       if ((((unsigned int)(skb->data)) & 0x02) == 2) {
-               /* move skb->data to current_tx_ptr payload */
-               data = (unsigned int)(skb->data) - 2;
-               *((unsigned short *)data) = (unsigned short)(skb->len);
-               current_tx_ptr->desc_a.start_addr = (unsigned long)data;
-               /* this is important! */
-               blackfin_dcache_flush_range(data, (data + (skb->len)) + 2);
-
+       if (ANOMALY_05000285) {
+               /*
+                * TXDWA feature is not avaible to older revision < 0.3 silicon
+                * of BF537
+                *
+                * Only if data buffer is ODD WORD alignment, we do not
+                * need to memcpy
+                */
+               u32 data_align = (u32)(skb->data) & 0x3;
+               if (data_align == 0x2) {
+                       /* move skb->data to current_tx_ptr payload */
+                       data = (u16 *)(skb->data) - 1;
+                       *data = (u16)(skb->len);
+                       current_tx_ptr->desc_a.start_addr = (u32)data;
+                       /* this is important! */
+                       blackfin_dcache_flush_range((u32)data,
+                                       (u32)((u8 *)data + skb->len + 4));
+               } else {
+                       *((u16 *)(current_tx_ptr->packet)) = (u16)(skb->len);
+                       memcpy((u8 *)(current_tx_ptr->packet + 2), skb->data,
+                               skb->len);
+                       current_tx_ptr->desc_a.start_addr =
+                               (u32)current_tx_ptr->packet;
+                       if (current_tx_ptr->status.status_word != 0)
+                               current_tx_ptr->status.status_word = 0;
+                       blackfin_dcache_flush_range(
+                               (u32)current_tx_ptr->packet,
+                               (u32)(current_tx_ptr->packet + skb->len + 2));
+               }
        } else {
-               *((unsigned short *)(current_tx_ptr->packet)) =
-                   (unsigned short)(skb->len);
-               memcpy((char *)(current_tx_ptr->packet + 2), skb->data,
-                      (skb->len));
-               current_tx_ptr->desc_a.start_addr =
-                   (unsigned long)current_tx_ptr->packet;
-               if (current_tx_ptr->status.status_word != 0)
-                       current_tx_ptr->status.status_word = 0;
-               blackfin_dcache_flush_range((unsigned int)current_tx_ptr->
-                                           packet,
-                                           (unsigned int)(current_tx_ptr->
-                                                          packet + skb->len) +
-                                           2);
+               /*
+                * TXDWA feature is avaible to revision < 0.3 silicon of
+                * BF537 and always avaible to BF52x
+                */
+               u32 data_align = (u32)(skb->data) & 0x3;
+               if (data_align == 0x0) {
+                       u16 sysctl = bfin_read_EMAC_SYSCTL();
+                       sysctl |= TXDWA;
+                       bfin_write_EMAC_SYSCTL(sysctl);
+
+                       /* move skb->data to current_tx_ptr payload */
+                       data = (u16 *)(skb->data) - 2;
+                       *data = (u16)(skb->len);
+                       current_tx_ptr->desc_a.start_addr = (u32)data;
+                       /* this is important! */
+                       blackfin_dcache_flush_range(
+                                       (u32)data,
+                                       (u32)((u8 *)data + skb->len + 4));
+               } else if (data_align == 0x2) {
+                       u16 sysctl = bfin_read_EMAC_SYSCTL();
+                       sysctl &= ~TXDWA;
+                       bfin_write_EMAC_SYSCTL(sysctl);
+
+                       /* move skb->data to current_tx_ptr payload */
+                       data = (u16 *)(skb->data) - 1;
+                       *data = (u16)(skb->len);
+                       current_tx_ptr->desc_a.start_addr = (u32)data;
+                       /* this is important! */
+                       blackfin_dcache_flush_range(
+                                       (u32)data,
+                                       (u32)((u8 *)data + skb->len + 4));
+               } else {
+                       u16 sysctl = bfin_read_EMAC_SYSCTL();
+                       sysctl &= ~TXDWA;
+                       bfin_write_EMAC_SYSCTL(sysctl);
+
+                       *((u16 *)(current_tx_ptr->packet)) = (u16)(skb->len);
+                       memcpy((u8 *)(current_tx_ptr->packet + 2), skb->data,
+                               skb->len);
+                       current_tx_ptr->desc_a.start_addr =
+                               (u32)current_tx_ptr->packet;
+                       if (current_tx_ptr->status.status_word != 0)
+                               current_tx_ptr->status.status_word = 0;
+                       blackfin_dcache_flush_range(
+                               (u32)current_tx_ptr->packet,
+                               (u32)(current_tx_ptr->packet + skb->len + 2));
+               }
        }
 
        /* enable this packet's dma */
@@ -691,7 +742,6 @@ static void bfin_mac_rx(struct net_device *dev)
                                         (unsigned long)skb->tail);
 
        dev->last_rx = jiffies;
-       skb->dev = dev;
        skb->protocol = eth_type_trans(skb, dev);
 #if defined(BFIN_MAC_CSUM_OFFLOAD)
        skb->csum = current_rx_ptr->status.ip_payload_csum;
@@ -920,6 +970,7 @@ static int bfin_mac_open(struct net_device *dev)
        phy_start(lp->phydev);
        phy_write(lp->phydev, MII_BMCR, BMCR_RESET);
        setup_system_regs(dev);
+       setup_mac_addr(dev->dev_addr);
        bfin_mac_disable();
        bfin_mac_enable();
        pr_debug("hardware init finished\n");
@@ -955,7 +1006,7 @@ static int bfin_mac_close(struct net_device *dev)
        return 0;
 }
 
-static int __init bfin_mac_probe(struct platform_device *pdev)
+static int __devinit bfin_mac_probe(struct platform_device *pdev)
 {
        struct net_device *ndev;
        struct bfin_mac_local *lp;
@@ -1081,7 +1132,7 @@ out_err_probe_mac:
        return rc;
 }
 
-static int bfin_mac_remove(struct platform_device *pdev)
+static int __devexit bfin_mac_remove(struct platform_device *pdev)
 {
        struct net_device *ndev = platform_get_drvdata(pdev);
        struct bfin_mac_local *lp = netdev_priv(ndev);
@@ -1128,7 +1179,7 @@ static int bfin_mac_resume(struct platform_device *pdev)
 
 static struct platform_driver bfin_mac_driver = {
        .probe = bfin_mac_probe,
-       .remove = bfin_mac_remove,
+       .remove = __devexit_p(bfin_mac_remove),
        .resume = bfin_mac_resume,
        .suspend = bfin_mac_suspend,
        .driver = {
index 47d5178..04c0e90 100644 (file)
@@ -683,7 +683,7 @@ enum {
        SF_ERASE_SECTOR = 0xd8, /* erase sector */
 
        FW_FLASH_BOOT_ADDR = 0x70000,   /* start address of FW in flash */
-       FW_VERS_ADDR = 0x77ffc,    /* flash address holding FW version */
+       FW_VERS_ADDR = 0x7fffc,    /* flash address holding FW version */
        FW_MIN_SIZE = 8            /* at least version and csum */
 };
 
index 0920b79..b70c531 100644 (file)
@@ -2937,9 +2937,9 @@ static void ehea_rereg_mrs(struct work_struct *work)
                                }
                        }
                }
-       mutex_unlock(&dlpar_mem_lock);
-       ehea_info("re-initializing driver complete");
+       ehea_info("re-initializing driver complete");
 out:
+       mutex_unlock(&dlpar_mem_lock);
        return;
 }
 
index c05cb15..aa0bf6e 100644 (file)
@@ -1547,8 +1547,10 @@ static int __devinit enc28j60_probe(struct spi_device *spi)
        random_ether_addr(dev->dev_addr);
        enc28j60_set_hw_macaddr(dev);
 
-       ret = request_irq(spi->irq, enc28j60_irq, IRQF_TRIGGER_FALLING,
-                         DRV_NAME, priv);
+       /* Board setup must set the relevant edge trigger type;
+        * level triggers won't currently work.
+        */
+       ret = request_irq(spi->irq, enc28j60_irq, 0, DRV_NAME, priv);
        if (ret < 0) {
                if (netif_msg_probe(priv))
                        dev_err(&spi->dev, DRV_NAME ": request irq %d failed "
index 4ed89fa..01b38b0 100644 (file)
@@ -333,6 +333,7 @@ enum {
        NvRegPowerState2 = 0x600,
 #define NVREG_POWERSTATE2_POWERUP_MASK         0x0F11
 #define NVREG_POWERSTATE2_POWERUP_REV_A3       0x0001
+#define NVREG_POWERSTATE2_PHY_RESET            0x0004
 };
 
 /* Big endian: should work, but is untested */
@@ -529,6 +530,7 @@ union ring_type {
 #define PHY_REALTEK_INIT_REG4  0x14
 #define PHY_REALTEK_INIT_REG5  0x18
 #define PHY_REALTEK_INIT_REG6  0x11
+#define PHY_REALTEK_INIT_REG7  0x01
 #define PHY_REALTEK_INIT1      0x0000
 #define PHY_REALTEK_INIT2      0x8e00
 #define PHY_REALTEK_INIT3      0x0001
@@ -537,6 +539,9 @@ union ring_type {
 #define PHY_REALTEK_INIT6      0xf5c7
 #define PHY_REALTEK_INIT7      0x1000
 #define PHY_REALTEK_INIT8      0x0003
+#define PHY_REALTEK_INIT9      0x0008
+#define PHY_REALTEK_INIT10     0x0005
+#define PHY_REALTEK_INIT11     0x0200
 #define PHY_REALTEK_INIT_MSK1  0x0003
 
 #define PHY_GIGABIT    0x0100
@@ -1149,6 +1154,42 @@ static int phy_init(struct net_device *dev)
                                return PHY_ERROR;
                        }
                }
+               if (np->phy_model == PHY_MODEL_REALTEK_8211 &&
+                   np->phy_rev == PHY_REV_REALTEK_8211C) {
+                       u32 powerstate = readl(base + NvRegPowerState2);
+
+                       /* need to perform hw phy reset */
+                       powerstate |= NVREG_POWERSTATE2_PHY_RESET;
+                       writel(powerstate, base + NvRegPowerState2);
+                       msleep(25);
+
+                       powerstate &= ~NVREG_POWERSTATE2_PHY_RESET;
+                       writel(powerstate, base + NvRegPowerState2);
+                       msleep(25);
+
+                       reg = mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG6, MII_READ);
+                       reg |= PHY_REALTEK_INIT9;
+                       if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG6, reg)) {
+                               printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
+                               return PHY_ERROR;
+                       }
+                       if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG1, PHY_REALTEK_INIT10)) {
+                               printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
+                               return PHY_ERROR;
+                       }
+                       reg = mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG7, MII_READ);
+                       if (!(reg & PHY_REALTEK_INIT11)) {
+                               reg |= PHY_REALTEK_INIT11;
+                               if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG7, reg)) {
+                                       printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
+                                       return PHY_ERROR;
+                               }
+                       }
+                       if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG1, PHY_REALTEK_INIT1)) {
+                               printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
+                               return PHY_ERROR;
+                       }
+               }
                if (np->phy_model == PHY_MODEL_REALTEK_8201) {
                        if (np->device_id == PCI_DEVICE_ID_NVIDIA_NVENET_32 ||
                            np->device_id == PCI_DEVICE_ID_NVIDIA_NVENET_33 ||
@@ -1201,12 +1242,23 @@ static int phy_init(struct net_device *dev)
        mii_control = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ);
        mii_control |= BMCR_ANENABLE;
 
-       /* reset the phy
-        * (certain phys need bmcr to be setup with reset)
-        */
-       if (phy_reset(dev, mii_control)) {
-               printk(KERN_INFO "%s: phy reset failed\n", pci_name(np->pci_dev));
-               return PHY_ERROR;
+       if (np->phy_oui == PHY_OUI_REALTEK &&
+           np->phy_model == PHY_MODEL_REALTEK_8211 &&
+           np->phy_rev == PHY_REV_REALTEK_8211C) {
+               /* start autoneg since we already performed hw reset above */
+               mii_control |= BMCR_ANRESTART;
+               if (mii_rw(dev, np->phyaddr, MII_BMCR, mii_control)) {
+                       printk(KERN_INFO "%s: phy init failed\n", pci_name(np->pci_dev));
+                       return PHY_ERROR;
+               }
+       } else {
+               /* reset the phy
+                * (certain phys need bmcr to be setup with reset)
+                */
+               if (phy_reset(dev, mii_control)) {
+                       printk(KERN_INFO "%s: phy reset failed\n", pci_name(np->pci_dev));
+                       return PHY_ERROR;
+               }
        }
 
        /* phy vendor specific configuration */
index 0960e69..e4fbefc 100644 (file)
@@ -69,18 +69,20 @@ static void ri_tasklet(unsigned long dev)
        struct net_device *_dev = (struct net_device *)dev;
        struct ifb_private *dp = netdev_priv(_dev);
        struct net_device_stats *stats = &_dev->stats;
+       struct netdev_queue *txq;
        struct sk_buff *skb;
 
+       txq = netdev_get_tx_queue(_dev, 0);
        dp->st_task_enter++;
        if ((skb = skb_peek(&dp->tq)) == NULL) {
                dp->st_txq_refl_try++;
-               if (netif_tx_trylock(_dev)) {
+               if (__netif_tx_trylock(txq)) {
                        dp->st_rxq_enter++;
                        while ((skb = skb_dequeue(&dp->rq)) != NULL) {
                                skb_queue_tail(&dp->tq, skb);
                                dp->st_rx2tx_tran++;
                        }
-                       netif_tx_unlock(_dev);
+                       __netif_tx_unlock(txq);
                } else {
                        /* reschedule */
                        dp->st_rxq_notenter++;
@@ -115,7 +117,7 @@ static void ri_tasklet(unsigned long dev)
                        BUG();
        }
 
-       if (netif_tx_trylock(_dev)) {
+       if (__netif_tx_trylock(txq)) {
                dp->st_rxq_check++;
                if ((skb = skb_peek(&dp->rq)) == NULL) {
                        dp->tasklet_pending = 0;
@@ -123,10 +125,10 @@ static void ri_tasklet(unsigned long dev)
                                netif_wake_queue(_dev);
                } else {
                        dp->st_rxq_rsch++;
-                       netif_tx_unlock(_dev);
+                       __netif_tx_unlock(txq);
                        goto resched;
                }
-               netif_tx_unlock(_dev);
+               __netif_tx_unlock(txq);
        } else {
 resched:
                dp->tasklet_pending = 1;
index d8b89c7..37ab8c8 100644 (file)
@@ -107,7 +107,7 @@ static int act200l_open(struct sir_dev *dev)
 {
        struct qos_info *qos = &dev->qos;
 
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
+       IRDA_DEBUG(2, "%s()\n", __func__ );
 
        /* Power on the dongle */
        sirdev_set_dtr_rts(dev, TRUE, TRUE);
@@ -124,7 +124,7 @@ static int act200l_open(struct sir_dev *dev)
 
 static int act200l_close(struct sir_dev *dev)
 {
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
+       IRDA_DEBUG(2, "%s()\n", __func__ );
 
        /* Power off the dongle */
        sirdev_set_dtr_rts(dev, FALSE, FALSE);
@@ -143,7 +143,7 @@ static int act200l_change_speed(struct sir_dev *dev, unsigned speed)
        u8 control[3];
        int ret = 0;
 
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
+       IRDA_DEBUG(2, "%s()\n", __func__ );
 
        /* Clear DTR and set RTS to enter command mode */
        sirdev_set_dtr_rts(dev, FALSE, TRUE);
@@ -212,7 +212,7 @@ static int act200l_reset(struct sir_dev *dev)
        };
        int ret = 0;
 
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
+       IRDA_DEBUG(2, "%s()\n", __func__ );
 
        switch (state) {
        case SIRDEV_STATE_DONGLE_RESET:
@@ -240,7 +240,7 @@ static int act200l_reset(struct sir_dev *dev)
                dev->speed = 9600;
                break;
        default:
-               IRDA_ERROR("%s(), unknown state %d\n", __FUNCTION__, state);
+               IRDA_ERROR("%s(), unknown state %d\n", __func__, state);
                ret = -1;
                break;
        }
index 736d247..50b2141 100644 (file)
@@ -165,7 +165,7 @@ static int actisys_change_speed(struct sir_dev *dev, unsigned speed)
        int ret = 0;
        int i = 0;
 
-        IRDA_DEBUG(4, "%s(), speed=%d (was %d)\n", __FUNCTION__,
+        IRDA_DEBUG(4, "%s(), speed=%d (was %d)\n", __func__,
                speed, dev->speed);
 
        /* dongle was already resetted from irda_request state machine,
index 083b0dd..2ff1818 100644 (file)
@@ -152,7 +152,7 @@ static int __init ali_ircc_init(void)
        int reg, revision;
        int i = 0;
        
-       IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __func__);
 
        ret = platform_driver_register(&ali_ircc_driver);
         if (ret) {
@@ -166,7 +166,7 @@ static int __init ali_ircc_init(void)
        /* Probe for all the ALi chipsets we know about */
        for (chip= chips; chip->name; chip++, i++) 
        {
-               IRDA_DEBUG(2, "%s(), Probing for %s ...\n", __FUNCTION__, chip->name);
+               IRDA_DEBUG(2, "%s(), Probing for %s ...\n", __func__, chip->name);
                                
                /* Try all config registers for this chip */
                for (cfg=0; cfg<2; cfg++)
@@ -196,11 +196,11 @@ static int __init ali_ircc_init(void)
                                
                        if (reg == chip->cid_value)
                        {
-                               IRDA_DEBUG(2, "%s(), Chip found at 0x%03x\n", __FUNCTION__, cfg_base);
+                               IRDA_DEBUG(2, "%s(), Chip found at 0x%03x\n", __func__, cfg_base);
                                           
                                outb(0x1F, cfg_base);
                                revision = inb(cfg_base+1);
-                               IRDA_DEBUG(2, "%s(), Found %s chip, revision=%d\n", __FUNCTION__,
+                               IRDA_DEBUG(2, "%s(), Found %s chip, revision=%d\n", __func__,
                                           chip->name, revision);                                       
                                
                                /* 
@@ -223,14 +223,14 @@ static int __init ali_ircc_init(void)
                        }
                        else
                        {
-                               IRDA_DEBUG(2, "%s(), No %s chip at 0x%03x\n", __FUNCTION__, chip->name, cfg_base);
+                               IRDA_DEBUG(2, "%s(), No %s chip at 0x%03x\n", __func__, chip->name, cfg_base);
                        }
                        /* Exit configuration */
                        outb(0xbb, cfg_base);
                }
        }               
                
-       IRDA_DEBUG(2, "%s(), ----------------- End -----------------\n", __FUNCTION__);                                                 
+       IRDA_DEBUG(2, "%s(), ----------------- End -----------------\n", __func__);
 
        if (ret)
                platform_driver_unregister(&ali_ircc_driver);
@@ -248,7 +248,7 @@ static void __exit ali_ircc_cleanup(void)
 {
        int i;
 
-       IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__); 
+       IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __func__);
 
        for (i=0; i < ARRAY_SIZE(dev_self); i++) {
                if (dev_self[i])
@@ -257,7 +257,7 @@ static void __exit ali_ircc_cleanup(void)
        
        platform_driver_unregister(&ali_ircc_driver);
 
-       IRDA_DEBUG(2, "%s(), ----------------- End -----------------\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s(), ----------------- End -----------------\n", __func__);
 }
 
 /*
@@ -273,11 +273,11 @@ static int ali_ircc_open(int i, chipio_t *info)
        int dongle_id;
        int err;
                        
-       IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__); 
+       IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __func__);
 
        if (i >= ARRAY_SIZE(dev_self)) {
                IRDA_ERROR("%s(), maximum number of supported chips reached!\n",
-                          __FUNCTION__);
+                          __func__);
                return -ENOMEM;
        }
        
@@ -288,7 +288,7 @@ static int ali_ircc_open(int i, chipio_t *info)
        dev = alloc_irdadev(sizeof(*self));
        if (dev == NULL) {
                IRDA_ERROR("%s(), can't allocate memory for control block!\n",
-                          __FUNCTION__);
+                          __func__);
                return -ENOMEM;
        }
 
@@ -312,7 +312,7 @@ static int ali_ircc_open(int i, chipio_t *info)
        /* Reserve the ioports that we need */
        if (!request_region(self->io.fir_base, self->io.fir_ext,
                            ALI_IRCC_DRIVER_NAME)) {
-               IRDA_WARNING("%s(), can't get iobase of 0x%03x\n", __FUNCTION__,
+               IRDA_WARNING("%s(), can't get iobase of 0x%03x\n", __func__,
                        self->io.fir_base);
                err = -ENODEV;
                goto err_out1;
@@ -370,19 +370,19 @@ static int ali_ircc_open(int i, chipio_t *info)
 
        err = register_netdev(dev);
        if (err) {
-               IRDA_ERROR("%s(), register_netdev() failed!\n", __FUNCTION__);
+               IRDA_ERROR("%s(), register_netdev() failed!\n", __func__);
                goto err_out4;
        }
        IRDA_MESSAGE("IrDA: Registered device %s\n", dev->name);
 
        /* Check dongle id */
        dongle_id = ali_ircc_read_dongle_id(i, info);
-       IRDA_MESSAGE("%s(), %s, Found dongle: %s\n", __FUNCTION__,
+       IRDA_MESSAGE("%s(), %s, Found dongle: %s\n", __func__,
                     ALI_IRCC_DRIVER_NAME, dongle_types[dongle_id]);
                
        self->io.dongle_id = dongle_id;
 
-       IRDA_DEBUG(2, "%s(), ----------------- End -----------------\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s(), ----------------- End -----------------\n", __func__);
        
        return 0;
 
@@ -411,7 +411,7 @@ static int __exit ali_ircc_close(struct ali_ircc_cb *self)
 {
        int iobase;
 
-       IRDA_DEBUG(4, "%s(), ---------------- Start ----------------\n", __FUNCTION__);
+       IRDA_DEBUG(4, "%s(), ---------------- Start ----------------\n", __func__);
 
        IRDA_ASSERT(self != NULL, return -1;);
 
@@ -421,7 +421,7 @@ static int __exit ali_ircc_close(struct ali_ircc_cb *self)
        unregister_netdev(self->netdev);
 
        /* Release the PORT that this driver is using */
-       IRDA_DEBUG(4, "%s(), Releasing Region %03x\n", __FUNCTION__, self->io.fir_base);
+       IRDA_DEBUG(4, "%s(), Releasing Region %03x\n", __func__, self->io.fir_base);
        release_region(self->io.fir_base, self->io.fir_ext);
 
        if (self->tx_buff.head)
@@ -435,7 +435,7 @@ static int __exit ali_ircc_close(struct ali_ircc_cb *self)
        dev_self[self->index] = NULL;
        free_netdev(self->netdev);
        
-       IRDA_DEBUG(2, "%s(), ----------------- End -----------------\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s(), ----------------- End -----------------\n", __func__);
        
        return 0;
 }
@@ -478,7 +478,7 @@ static int ali_ircc_probe_53(ali_chip_t *chip, chipio_t *info)
        int cfg_base = info->cfg_base;
        int hi, low, reg;
        
-       IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __func__);
        
        /* Enter Configuration */
        outb(chip->entr1, cfg_base);
@@ -497,13 +497,13 @@ static int ali_ircc_probe_53(ali_chip_t *chip, chipio_t *info)
        
        info->sir_base = info->fir_base;
        
-       IRDA_DEBUG(2, "%s(), probing fir_base=0x%03x\n", __FUNCTION__, info->fir_base);
+       IRDA_DEBUG(2, "%s(), probing fir_base=0x%03x\n", __func__, info->fir_base);
                
        /* Read IRQ control register */
        outb(0x70, cfg_base);
        reg = inb(cfg_base+1);
        info->irq = reg & 0x0f;
-       IRDA_DEBUG(2, "%s(), probing irq=%d\n", __FUNCTION__, info->irq);
+       IRDA_DEBUG(2, "%s(), probing irq=%d\n", __func__, info->irq);
        
        /* Read DMA channel */
        outb(0x74, cfg_base);
@@ -511,26 +511,26 @@ static int ali_ircc_probe_53(ali_chip_t *chip, chipio_t *info)
        info->dma = reg & 0x07;
        
        if(info->dma == 0x04)
-               IRDA_WARNING("%s(), No DMA channel assigned !\n", __FUNCTION__);
+               IRDA_WARNING("%s(), No DMA channel assigned !\n", __func__);
        else
-               IRDA_DEBUG(2, "%s(), probing dma=%d\n", __FUNCTION__, info->dma);
+               IRDA_DEBUG(2, "%s(), probing dma=%d\n", __func__, info->dma);
        
        /* Read Enabled Status */
        outb(0x30, cfg_base);
        reg = inb(cfg_base+1);
        info->enabled = (reg & 0x80) && (reg & 0x01);
-       IRDA_DEBUG(2, "%s(), probing enabled=%d\n", __FUNCTION__, info->enabled);
+       IRDA_DEBUG(2, "%s(), probing enabled=%d\n", __func__, info->enabled);
        
        /* Read Power Status */
        outb(0x22, cfg_base);
        reg = inb(cfg_base+1);
        info->suspended = (reg & 0x20);
-       IRDA_DEBUG(2, "%s(), probing suspended=%d\n", __FUNCTION__, info->suspended);
+       IRDA_DEBUG(2, "%s(), probing suspended=%d\n", __func__, info->suspended);
        
        /* Exit configuration */
        outb(0xbb, cfg_base);
                
-       IRDA_DEBUG(2, "%s(), ----------------- End -----------------\n", __FUNCTION__); 
+       IRDA_DEBUG(2, "%s(), ----------------- End -----------------\n", __func__);
        
        return 0;       
 }
@@ -548,7 +548,7 @@ static int ali_ircc_setup(chipio_t *info)
        int version;
        int iobase = info->fir_base;
        
-       IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __func__);
        
        /* Locking comments :
         * Most operations here need to be protected. We are called before
@@ -609,7 +609,7 @@ static int ali_ircc_setup(chipio_t *info)
        // outb(UART_IER_RDI, iobase+UART_IER); //benjamin 2000/11/23 01:25PM
        // Turn on the interrupts in ali_ircc_net_open
        
-       IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __FUNCTION__);        
+       IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __func__);
        
        return 0;
 }
@@ -626,7 +626,7 @@ static int ali_ircc_read_dongle_id (int i, chipio_t *info)
        int dongle_id, reg;
        int cfg_base = info->cfg_base;
        
-       IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __func__);
                
        /* Enter Configuration */
        outb(chips[i].entr1, cfg_base);
@@ -640,13 +640,13 @@ static int ali_ircc_read_dongle_id (int i, chipio_t *info)
        outb(0xf0, cfg_base);
        reg = inb(cfg_base+1);  
        dongle_id = ((reg>>6)&0x02) | ((reg>>5)&0x01);
-       IRDA_DEBUG(2, "%s(), probing dongle_id=%d, dongle_types=%s\n", __FUNCTION__, 
+       IRDA_DEBUG(2, "%s(), probing dongle_id=%d, dongle_types=%s\n", __func__,
                dongle_id, dongle_types[dongle_id]);
        
        /* Exit configuration */
        outb(0xbb, cfg_base);
                        
-       IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __FUNCTION__);        
+       IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __func__);
        
        return dongle_id;
 }
@@ -663,7 +663,7 @@ static irqreturn_t ali_ircc_interrupt(int irq, void *dev_id)
        struct ali_ircc_cb *self;
        int ret;
                
-       IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __func__);
                
        self = dev->priv;
        
@@ -677,7 +677,7 @@ static irqreturn_t ali_ircc_interrupt(int irq, void *dev_id)
                
        spin_unlock(&self->lock);
        
-       IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __func__);
        return ret;
 }
 /*
@@ -691,7 +691,7 @@ static irqreturn_t ali_ircc_fir_interrupt(struct ali_ircc_cb *self)
        __u8 eir, OldMessageCount;
        int iobase, tmp;
        
-       IRDA_DEBUG(1, "%s(), ---------------- Start ----------------\n", __FUNCTION__);
+       IRDA_DEBUG(1, "%s(), ---------------- Start ----------------\n", __func__);
        
        iobase = self->io.fir_base;
        
@@ -704,10 +704,10 @@ static irqreturn_t ali_ircc_fir_interrupt(struct ali_ircc_cb *self)
        //self->ier = inb(iobase+FIR_IER);              2000/12/1 04:32PM
        eir = self->InterruptID & self->ier; /* Mask out the interesting ones */ 
        
-       IRDA_DEBUG(1, "%s(), self->InterruptID = %x\n", __FUNCTION__,self->InterruptID);
-       IRDA_DEBUG(1, "%s(), self->LineStatus = %x\n", __FUNCTION__,self->LineStatus);
-       IRDA_DEBUG(1, "%s(), self->ier = %x\n", __FUNCTION__,self->ier);
-       IRDA_DEBUG(1, "%s(), eir = %x\n", __FUNCTION__,eir);
+       IRDA_DEBUG(1, "%s(), self->InterruptID = %x\n", __func__,self->InterruptID);
+       IRDA_DEBUG(1, "%s(), self->LineStatus = %x\n", __func__,self->LineStatus);
+       IRDA_DEBUG(1, "%s(), self->ier = %x\n", __func__,self->ier);
+       IRDA_DEBUG(1, "%s(), eir = %x\n", __func__,eir);
        
        /* Disable interrupts */
         SetCOMInterrupts(self, FALSE);
@@ -718,7 +718,7 @@ static irqreturn_t ali_ircc_fir_interrupt(struct ali_ircc_cb *self)
        {               
                if (self->io.direction == IO_XMIT) /* TX */
                {
-                       IRDA_DEBUG(1, "%s(), ******* IIR_EOM (Tx) *******\n", __FUNCTION__);
+                       IRDA_DEBUG(1, "%s(), ******* IIR_EOM (Tx) *******\n", __func__);
                        
                        if(ali_ircc_dma_xmit_complete(self))
                        {
@@ -737,23 +737,23 @@ static irqreturn_t ali_ircc_fir_interrupt(struct ali_ircc_cb *self)
                }       
                else /* RX */
                {
-                       IRDA_DEBUG(1, "%s(), ******* IIR_EOM (Rx) *******\n", __FUNCTION__);
+                       IRDA_DEBUG(1, "%s(), ******* IIR_EOM (Rx) *******\n", __func__);
                        
                        if(OldMessageCount > ((self->LineStatus+1) & 0x07))
                        {
                                self->rcvFramesOverflow = TRUE; 
-                               IRDA_DEBUG(1, "%s(), ******* self->rcvFramesOverflow = TRUE ******** \n", __FUNCTION__);
+                               IRDA_DEBUG(1, "%s(), ******* self->rcvFramesOverflow = TRUE ******** \n", __func__);
                        }
                                                
                        if (ali_ircc_dma_receive_complete(self))
                        {
-                               IRDA_DEBUG(1, "%s(), ******* receive complete ******** \n", __FUNCTION__);
+                               IRDA_DEBUG(1, "%s(), ******* receive complete ******** \n", __func__);
                                
                                self->ier = IER_EOM;                            
                        }
                        else
                        {
-                               IRDA_DEBUG(1, "%s(), ******* Not receive complete ******** \n", __FUNCTION__);
+                               IRDA_DEBUG(1, "%s(), ******* Not receive complete ******** \n", __func__);
                                
                                self->ier = IER_EOM | IER_TIMER;                                                                
                        }       
@@ -766,7 +766,7 @@ static irqreturn_t ali_ircc_fir_interrupt(struct ali_ircc_cb *self)
                if(OldMessageCount > ((self->LineStatus+1) & 0x07))
                {
                        self->rcvFramesOverflow = TRUE; 
-                       IRDA_DEBUG(1, "%s(), ******* self->rcvFramesOverflow = TRUE ******* \n", __FUNCTION__);
+                       IRDA_DEBUG(1, "%s(), ******* self->rcvFramesOverflow = TRUE ******* \n", __func__);
                }
                /* Disable Timer */
                switch_bank(iobase, BANK1);
@@ -798,7 +798,7 @@ static irqreturn_t ali_ircc_fir_interrupt(struct ali_ircc_cb *self)
        /* Restore Interrupt */ 
        SetCOMInterrupts(self, TRUE);   
                
-       IRDA_DEBUG(1, "%s(), ----------------- End ---------------\n", __FUNCTION__);
+       IRDA_DEBUG(1, "%s(), ----------------- End ---------------\n", __func__);
        return IRQ_RETVAL(eir);
 }
 
@@ -813,7 +813,7 @@ static irqreturn_t ali_ircc_sir_interrupt(struct ali_ircc_cb *self)
        int iobase;
        int iir, lsr;
        
-       IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __func__);
        
        iobase = self->io.sir_base;
 
@@ -822,13 +822,13 @@ static irqreturn_t ali_ircc_sir_interrupt(struct ali_ircc_cb *self)
                /* Clear interrupt */
                lsr = inb(iobase+UART_LSR);
 
-               IRDA_DEBUG(4, "%s(), iir=%02x, lsr=%02x, iobase=%#x\n", __FUNCTION__, 
+               IRDA_DEBUG(4, "%s(), iir=%02x, lsr=%02x, iobase=%#x\n", __func__,
                           iir, lsr, iobase);
 
                switch (iir) 
                {
                        case UART_IIR_RLSI:
-                               IRDA_DEBUG(2, "%s(), RLSI\n", __FUNCTION__);
+                               IRDA_DEBUG(2, "%s(), RLSI\n", __func__);
                                break;
                        case UART_IIR_RDI:
                                /* Receive interrupt */
@@ -842,14 +842,14 @@ static irqreturn_t ali_ircc_sir_interrupt(struct ali_ircc_cb *self)
                                }                               
                                break;
                        default:
-                               IRDA_DEBUG(0, "%s(), unhandled IIR=%#x\n", __FUNCTION__, iir);
+                               IRDA_DEBUG(0, "%s(), unhandled IIR=%#x\n", __func__, iir);
                                break;
                } 
                
        }
        
        
-       IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __FUNCTION__);        
+       IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __func__);
 
        return IRQ_RETVAL(iir);
 }
@@ -866,7 +866,7 @@ static void ali_ircc_sir_receive(struct ali_ircc_cb *self)
        int boguscount = 0;
        int iobase;
        
-       IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __func__);
        IRDA_ASSERT(self != NULL, return;);
 
        iobase = self->io.sir_base;
@@ -881,12 +881,12 @@ static void ali_ircc_sir_receive(struct ali_ircc_cb *self)
 
                /* Make sure we don't stay here too long */
                if (boguscount++ > 32) {
-                       IRDA_DEBUG(2,"%s(), breaking!\n", __FUNCTION__);
+                       IRDA_DEBUG(2,"%s(), breaking!\n", __func__);
                        break;
                }
        } while (inb(iobase+UART_LSR) & UART_LSR_DR);   
        
-       IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __FUNCTION__ );       
+       IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __func__ );
 }
 
 /*
@@ -903,7 +903,7 @@ static void ali_ircc_sir_write_wakeup(struct ali_ircc_cb *self)
 
        IRDA_ASSERT(self != NULL, return;);
 
-       IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__ );
+       IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __func__ );
        
        iobase = self->io.sir_base;
 
@@ -922,16 +922,16 @@ static void ali_ircc_sir_write_wakeup(struct ali_ircc_cb *self)
                {
                        /* We must wait until all data are gone */
                        while(!(inb(iobase+UART_LSR) & UART_LSR_TEMT))
-                               IRDA_DEBUG(1, "%s(), UART_LSR_THRE\n", __FUNCTION__ );
+                               IRDA_DEBUG(1, "%s(), UART_LSR_THRE\n", __func__ );
                        
-                       IRDA_DEBUG(1, "%s(), Changing speed! self->new_speed = %d\n", __FUNCTION__ , self->new_speed);
+                       IRDA_DEBUG(1, "%s(), Changing speed! self->new_speed = %d\n", __func__ , self->new_speed);
                        ali_ircc_change_speed(self, self->new_speed);
                        self->new_speed = 0;                    
                        
                        // benjamin 2000/11/10 06:32PM
                        if (self->io.speed > 115200)
                        {
-                               IRDA_DEBUG(2, "%s(), ali_ircc_change_speed from UART_LSR_TEMT \n", __FUNCTION__ );                              
+                               IRDA_DEBUG(2, "%s(), ali_ircc_change_speed from UART_LSR_TEMT \n", __func__ );
                                        
                                self->ier = IER_EOM;
                                // SetCOMInterrupts(self, TRUE);                                                        
@@ -949,7 +949,7 @@ static void ali_ircc_sir_write_wakeup(struct ali_ircc_cb *self)
                outb(UART_IER_RDI, iobase+UART_IER);
        }
                
-       IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __FUNCTION__ );       
+       IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __func__ );
 }
 
 static void ali_ircc_change_speed(struct ali_ircc_cb *self, __u32 baud)
@@ -957,9 +957,9 @@ static void ali_ircc_change_speed(struct ali_ircc_cb *self, __u32 baud)
        struct net_device *dev = self->netdev;
        int iobase;
        
-       IRDA_DEBUG(1, "%s(), ---------------- Start ----------------\n", __FUNCTION__ );
+       IRDA_DEBUG(1, "%s(), ---------------- Start ----------------\n", __func__ );
        
-       IRDA_DEBUG(2, "%s(), setting speed = %d \n", __FUNCTION__ , baud);
+       IRDA_DEBUG(2, "%s(), setting speed = %d \n", __func__ , baud);
        
        /* This function *must* be called with irq off and spin-lock.
         * - Jean II */
@@ -998,7 +998,7 @@ static void ali_ircc_change_speed(struct ali_ircc_cb *self, __u32 baud)
                
        netif_wake_queue(self->netdev); 
        
-       IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __FUNCTION__ );       
+       IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __func__ );
 }
 
 static void ali_ircc_fir_change_speed(struct ali_ircc_cb *priv, __u32 baud)
@@ -1008,14 +1008,14 @@ static void ali_ircc_fir_change_speed(struct ali_ircc_cb *priv, __u32 baud)
        struct ali_ircc_cb *self = (struct ali_ircc_cb *) priv;
        struct net_device *dev;
 
-       IRDA_DEBUG(1, "%s(), ---------------- Start ----------------\n", __FUNCTION__ );
+       IRDA_DEBUG(1, "%s(), ---------------- Start ----------------\n", __func__ );
                
        IRDA_ASSERT(self != NULL, return;);
 
        dev = self->netdev;
        iobase = self->io.fir_base;
        
-       IRDA_DEBUG(1, "%s(), self->io.speed = %d, change to speed = %d\n", __FUNCTION__ ,self->io.speed,baud);
+       IRDA_DEBUG(1, "%s(), self->io.speed = %d, change to speed = %d\n", __func__ ,self->io.speed,baud);
        
        /* Come from SIR speed */
        if(self->io.speed <=115200)
@@ -1029,7 +1029,7 @@ static void ali_ircc_fir_change_speed(struct ali_ircc_cb *priv, __u32 baud)
        // Set Dongle Speed mode
        ali_ircc_change_dongle_speed(self, baud);
                
-       IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __FUNCTION__ );       
+       IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __func__ );
 }
 
 /*
@@ -1047,9 +1047,9 @@ static void ali_ircc_sir_change_speed(struct ali_ircc_cb *priv, __u32 speed)
        int lcr;    /* Line control reg */
        int divisor;
 
-       IRDA_DEBUG(1, "%s(), ---------------- Start ----------------\n", __FUNCTION__ );
+       IRDA_DEBUG(1, "%s(), ---------------- Start ----------------\n", __func__ );
        
-       IRDA_DEBUG(1, "%s(), Setting speed to: %d\n", __FUNCTION__ , speed);
+       IRDA_DEBUG(1, "%s(), Setting speed to: %d\n", __func__ , speed);
 
        IRDA_ASSERT(self != NULL, return;);
 
@@ -1103,7 +1103,7 @@ static void ali_ircc_sir_change_speed(struct ali_ircc_cb *priv, __u32 speed)
        
        spin_unlock_irqrestore(&self->lock, flags);
        
-       IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __FUNCTION__ );       
+       IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __func__ );
 }
 
 static void ali_ircc_change_dongle_speed(struct ali_ircc_cb *priv, int speed)
@@ -1113,14 +1113,14 @@ static void ali_ircc_change_dongle_speed(struct ali_ircc_cb *priv, int speed)
        int iobase,dongle_id;
        int tmp = 0;
                        
-       IRDA_DEBUG(1, "%s(), ---------------- Start ----------------\n", __FUNCTION__ );        
+       IRDA_DEBUG(1, "%s(), ---------------- Start ----------------\n", __func__ );
        
        iobase = self->io.fir_base;     /* or iobase = self->io.sir_base; */
        dongle_id = self->io.dongle_id;
        
        /* We are already locked, no need to do it again */
                
-       IRDA_DEBUG(1, "%s(), Set Speed for %s , Speed = %d\n", __FUNCTION__ , dongle_types[dongle_id], speed);          
+       IRDA_DEBUG(1, "%s(), Set Speed for %s , Speed = %d\n", __func__ , dongle_types[dongle_id], speed);
        
        switch_bank(iobase, BANK2);
        tmp = inb(iobase+FIR_IRDA_CR);
@@ -1284,7 +1284,7 @@ static void ali_ircc_change_dongle_speed(struct ali_ircc_cb *priv, int speed)
                        
        switch_bank(iobase, BANK0);
        
-       IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __FUNCTION__ );               
+       IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __func__ );
 }
 
 /*
@@ -1297,11 +1297,11 @@ static int ali_ircc_sir_write(int iobase, int fifo_size, __u8 *buf, int len)
 {
        int actual = 0;
        
-       IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__ );
+       IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __func__ );
                
        /* Tx FIFO should be empty! */
        if (!(inb(iobase+UART_LSR) & UART_LSR_THRE)) {
-               IRDA_DEBUG(0, "%s(), failed, fifo not empty!\n", __FUNCTION__ );
+               IRDA_DEBUG(0, "%s(), failed, fifo not empty!\n", __func__ );
                return 0;
        }
         
@@ -1313,7 +1313,7 @@ static int ali_ircc_sir_write(int iobase, int fifo_size, __u8 *buf, int len)
                actual++;
        }
        
-        IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __FUNCTION__ );      
+        IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __func__ );
        return actual;
 }
 
@@ -1329,7 +1329,7 @@ static int ali_ircc_net_open(struct net_device *dev)
        int iobase;
        char hwname[32];
                
-       IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__ );
+       IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __func__ );
        
        IRDA_ASSERT(dev != NULL, return -1;);
        
@@ -1375,7 +1375,7 @@ static int ali_ircc_net_open(struct net_device *dev)
         */
        self->irlap = irlap_open(dev, &self->qos, hwname);
                
-       IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __FUNCTION__ );       
+       IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __func__ );
        
        return 0;
 }
@@ -1392,7 +1392,7 @@ static int ali_ircc_net_close(struct net_device *dev)
        struct ali_ircc_cb *self;
        //int iobase;
                        
-       IRDA_DEBUG(4, "%s(), ---------------- Start ----------------\n", __FUNCTION__ );
+       IRDA_DEBUG(4, "%s(), ---------------- Start ----------------\n", __func__ );
                
        IRDA_ASSERT(dev != NULL, return -1;);
 
@@ -1415,7 +1415,7 @@ static int ali_ircc_net_close(struct net_device *dev)
        free_irq(self->io.irq, dev);
        free_dma(self->io.dma);
 
-       IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __FUNCTION__ );       
+       IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __func__ );
        
        return 0;
 }
@@ -1434,7 +1434,7 @@ static int ali_ircc_fir_hard_xmit(struct sk_buff *skb, struct net_device *dev)
        __u32 speed;
        int mtt, diff;
        
-       IRDA_DEBUG(1, "%s(), ---------------- Start -----------------\n", __FUNCTION__ );       
+       IRDA_DEBUG(1, "%s(), ---------------- Start -----------------\n", __func__ );
        
        self = (struct ali_ircc_cb *) dev->priv;
        iobase = self->io.fir_base;
@@ -1488,7 +1488,7 @@ static int ali_ircc_fir_hard_xmit(struct sk_buff *skb, struct net_device *dev)
                        diff = self->now.tv_usec - self->stamp.tv_usec;
                        /* self->stamp is set from ali_ircc_dma_receive_complete() */
                                                        
-                       IRDA_DEBUG(1, "%s(), ******* diff = %d ******* \n", __FUNCTION__ , diff);       
+                       IRDA_DEBUG(1, "%s(), ******* diff = %d ******* \n", __func__ , diff);
                        
                        if (diff < 0) 
                                diff += 1000000;
@@ -1510,7 +1510,7 @@ static int ali_ircc_fir_hard_xmit(struct sk_buff *skb, struct net_device *dev)
                                        /* Adjust for timer resolution */
                                        mtt = (mtt+250) / 500;  /* 4 discard, 5 get advanced, Let's round off */
                                        
-                                       IRDA_DEBUG(1, "%s(), ************** mtt = %d ***********\n", __FUNCTION__ , mtt);       
+                                       IRDA_DEBUG(1, "%s(), ************** mtt = %d ***********\n", __func__ , mtt);
                                        
                                        /* Setup timer */
                                        if (mtt == 1) /* 500 us */
@@ -1567,7 +1567,7 @@ static int ali_ircc_fir_hard_xmit(struct sk_buff *skb, struct net_device *dev)
        spin_unlock_irqrestore(&self->lock, flags);
        dev_kfree_skb(skb);
 
-       IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __FUNCTION__ );       
+       IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __func__ );
        return 0;       
 }
 
@@ -1578,7 +1578,7 @@ static void ali_ircc_dma_xmit(struct ali_ircc_cb *self)
        unsigned char FIFO_OPTI, Hi, Lo;
        
        
-       IRDA_DEBUG(1, "%s(), ---------------- Start -----------------\n", __FUNCTION__ );       
+       IRDA_DEBUG(1, "%s(), ---------------- Start -----------------\n", __func__ );
        
        iobase = self->io.fir_base;
        
@@ -1629,7 +1629,7 @@ static void ali_ircc_dma_xmit(struct ali_ircc_cb *self)
        tmp = inb(iobase+FIR_LCR_B);
        tmp &= ~0x20; // Disable SIP
        outb(((unsigned char)(tmp & 0x3f) | LCR_B_TX_MODE) & ~LCR_B_BW, iobase+FIR_LCR_B);
-       IRDA_DEBUG(1, "%s(), ******* Change to TX mode: FIR_LCR_B = 0x%x ******* \n", __FUNCTION__ , inb(iobase+FIR_LCR_B));
+       IRDA_DEBUG(1, "%s(), ******* Change to TX mode: FIR_LCR_B = 0x%x ******* \n", __func__ , inb(iobase+FIR_LCR_B));
        
        outb(0, iobase+FIR_LSR);
                        
@@ -1639,7 +1639,7 @@ static void ali_ircc_dma_xmit(struct ali_ircc_cb *self)
        
        switch_bank(iobase, BANK0); 
        
-       IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __FUNCTION__ );
+       IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __func__ );
 }
 
 static int  ali_ircc_dma_xmit_complete(struct ali_ircc_cb *self)
@@ -1647,7 +1647,7 @@ static int  ali_ircc_dma_xmit_complete(struct ali_ircc_cb *self)
        int iobase;
        int ret = TRUE;
        
-       IRDA_DEBUG(1, "%s(), ---------------- Start -----------------\n", __FUNCTION__ );       
+       IRDA_DEBUG(1, "%s(), ---------------- Start -----------------\n", __func__ );
        
        iobase = self->io.fir_base;
        
@@ -1660,7 +1660,7 @@ static int  ali_ircc_dma_xmit_complete(struct ali_ircc_cb *self)
        if((inb(iobase+FIR_LSR) & LSR_FRAME_ABORT) == LSR_FRAME_ABORT)
        
        {
-               IRDA_ERROR("%s(), ********* LSR_FRAME_ABORT *********\n", __FUNCTION__);        
+               IRDA_ERROR("%s(), ********* LSR_FRAME_ABORT *********\n", __func__);
                self->stats.tx_errors++;
                self->stats.tx_fifo_errors++;           
        }
@@ -1703,7 +1703,7 @@ static int  ali_ircc_dma_xmit_complete(struct ali_ircc_cb *self)
                
        switch_bank(iobase, BANK0); 
        
-       IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __FUNCTION__ );       
+       IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __func__ );
        return ret;
 }
 
@@ -1718,7 +1718,7 @@ static int ali_ircc_dma_receive(struct ali_ircc_cb *self)
 {
        int iobase, tmp;
        
-       IRDA_DEBUG(1, "%s(), ---------------- Start -----------------\n", __FUNCTION__ );       
+       IRDA_DEBUG(1, "%s(), ---------------- Start -----------------\n", __func__ );
        
        iobase = self->io.fir_base;
        
@@ -1756,7 +1756,7 @@ static int ali_ircc_dma_receive(struct ali_ircc_cb *self)
        //switch_bank(iobase, BANK0);
        tmp = inb(iobase+FIR_LCR_B);
        outb((unsigned char)(tmp &0x3f) | LCR_B_RX_MODE | LCR_B_BW , iobase + FIR_LCR_B); // 2000/12/1 05:16PM
-       IRDA_DEBUG(1, "%s(), *** Change To RX mode: FIR_LCR_B = 0x%x *** \n", __FUNCTION__ , inb(iobase+FIR_LCR_B));
+       IRDA_DEBUG(1, "%s(), *** Change To RX mode: FIR_LCR_B = 0x%x *** \n", __func__ , inb(iobase+FIR_LCR_B));
                        
        /* Set Rx Threshold */
        switch_bank(iobase, BANK1);
@@ -1768,7 +1768,7 @@ static int ali_ircc_dma_receive(struct ali_ircc_cb *self)
        outb(CR_DMA_EN | CR_DMA_BURST, iobase+FIR_CR);
                                
        switch_bank(iobase, BANK0); 
-       IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __FUNCTION__ );       
+       IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __func__ );
        return 0;
 }
 
@@ -1779,7 +1779,7 @@ static int  ali_ircc_dma_receive_complete(struct ali_ircc_cb *self)
        __u8 status, MessageCount;
        int len, i, iobase, val;        
 
-       IRDA_DEBUG(1, "%s(), ---------------- Start -----------------\n", __FUNCTION__ );       
+       IRDA_DEBUG(1, "%s(), ---------------- Start -----------------\n", __func__ );
 
        st_fifo = &self->st_fifo;               
        iobase = self->io.fir_base;     
@@ -1788,7 +1788,7 @@ static int  ali_ircc_dma_receive_complete(struct ali_ircc_cb *self)
        MessageCount = inb(iobase+ FIR_LSR)&0x07;
        
        if (MessageCount > 0)   
-               IRDA_DEBUG(0, "%s(), Messsage count = %d,\n", __FUNCTION__ , MessageCount);     
+               IRDA_DEBUG(0, "%s(), Messsage count = %d,\n", __func__ , MessageCount);
                
        for (i=0; i<=MessageCount; i++)
        {
@@ -1801,11 +1801,11 @@ static int  ali_ircc_dma_receive_complete(struct ali_ircc_cb *self)
                len = len << 8; 
                len |= inb(iobase+FIR_RX_DSR_LO);
                
-               IRDA_DEBUG(1, "%s(), RX Length = 0x%.2x,\n", __FUNCTION__ , len);       
-               IRDA_DEBUG(1, "%s(), RX Status = 0x%.2x,\n", __FUNCTION__ , status);
+               IRDA_DEBUG(1, "%s(), RX Length = 0x%.2x,\n", __func__ , len);
+               IRDA_DEBUG(1, "%s(), RX Status = 0x%.2x,\n", __func__ , status);
                
                if (st_fifo->tail >= MAX_RX_WINDOW) {
-                       IRDA_DEBUG(0, "%s(), window is full!\n", __FUNCTION__ );
+                       IRDA_DEBUG(0, "%s(), window is full!\n", __func__ );
                        continue;
                }
                        
@@ -1828,7 +1828,7 @@ static int  ali_ircc_dma_receive_complete(struct ali_ircc_cb *self)
                /* Check for errors */
                if ((status & 0xd8) || self->rcvFramesOverflow || (len==0))             
                {
-                       IRDA_DEBUG(0,"%s(), ************* RX Errors ************ \n", __FUNCTION__ );   
+                       IRDA_DEBUG(0,"%s(), ************* RX Errors ************ \n", __func__ );
                        
                        /* Skip frame */
                        self->stats.rx_errors++;
@@ -1838,29 +1838,29 @@ static int  ali_ircc_dma_receive_complete(struct ali_ircc_cb *self)
                        if (status & LSR_FIFO_UR) 
                        {
                                self->stats.rx_frame_errors++;
-                               IRDA_DEBUG(0,"%s(), ************* FIFO Errors ************ \n", __FUNCTION__ );
+                               IRDA_DEBUG(0,"%s(), ************* FIFO Errors ************ \n", __func__ );
                        }       
                        if (status & LSR_FRAME_ERROR)
                        {
                                self->stats.rx_frame_errors++;
-                               IRDA_DEBUG(0,"%s(), ************* FRAME Errors ************ \n", __FUNCTION__ );
+                               IRDA_DEBUG(0,"%s(), ************* FRAME Errors ************ \n", __func__ );
                        }
                                                        
                        if (status & LSR_CRC_ERROR) 
                        {
                                self->stats.rx_crc_errors++;
-                               IRDA_DEBUG(0,"%s(), ************* CRC Errors ************ \n", __FUNCTION__ );
+                               IRDA_DEBUG(0,"%s(), ************* CRC Errors ************ \n", __func__ );
                        }
                        
                        if(self->rcvFramesOverflow)
                        {
                                self->stats.rx_frame_errors++;
-                               IRDA_DEBUG(0,"%s(), ************* Overran DMA buffer ************ \n", __FUNCTION__ );                                                          
+                               IRDA_DEBUG(0,"%s(), ************* Overran DMA buffer ************ \n", __func__ );
                        }
                        if(len == 0)
                        {
                                self->stats.rx_frame_errors++;
-                               IRDA_DEBUG(0,"%s(), ********** Receive Frame Size = 0 ********* \n", __FUNCTION__ );
+                               IRDA_DEBUG(0,"%s(), ********** Receive Frame Size = 0 ********* \n", __func__ );
                        }
                }        
                else 
@@ -1872,7 +1872,7 @@ static int  ali_ircc_dma_receive_complete(struct ali_ircc_cb *self)
                                val = inb(iobase+FIR_BSR);      
                                if ((val& BSR_FIFO_NOT_EMPTY)== 0x80) 
                                {
-                                       IRDA_DEBUG(0, "%s(), ************* BSR_FIFO_NOT_EMPTY ************ \n", __FUNCTION__ );
+                                       IRDA_DEBUG(0, "%s(), ************* BSR_FIFO_NOT_EMPTY ************ \n", __func__ );
                                        
                                        /* Put this entry back in fifo */
                                        st_fifo->head--;
@@ -1909,7 +1909,7 @@ static int  ali_ircc_dma_receive_complete(struct ali_ircc_cb *self)
                        {
                                IRDA_WARNING("%s(), memory squeeze, "
                                             "dropping frame.\n",
-                                            __FUNCTION__);
+                                            __func__);
                                self->stats.rx_dropped++;
 
                                return FALSE;
@@ -1937,7 +1937,7 @@ static int  ali_ircc_dma_receive_complete(struct ali_ircc_cb *self)
        
        switch_bank(iobase, BANK0);     
                
-       IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __FUNCTION__ );       
+       IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __func__ );
        return TRUE;
 }
 
@@ -1956,7 +1956,7 @@ static int ali_ircc_sir_hard_xmit(struct sk_buff *skb, struct net_device *dev)
        int iobase;
        __u32 speed;
        
-       IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__ );
+       IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __func__ );
        
        IRDA_ASSERT(dev != NULL, return 0;);
        
@@ -2005,7 +2005,7 @@ static int ali_ircc_sir_hard_xmit(struct sk_buff *skb, struct net_device *dev)
 
        dev_kfree_skb(skb);
        
-       IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __FUNCTION__ );       
+       IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __func__ );
        
        return 0;       
 }
@@ -2024,7 +2024,7 @@ static int ali_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
        unsigned long flags;
        int ret = 0;
        
-       IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__ );
+       IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __func__ );
        
        IRDA_ASSERT(dev != NULL, return -1;);
 
@@ -2032,11 +2032,11 @@ static int ali_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 
        IRDA_ASSERT(self != NULL, return -1;);
 
-       IRDA_DEBUG(2, "%s(), %s, (cmd=0x%X)\n", __FUNCTION__ , dev->name, cmd);
+       IRDA_DEBUG(2, "%s(), %s, (cmd=0x%X)\n", __func__ , dev->name, cmd);
        
        switch (cmd) {
        case SIOCSBANDWIDTH: /* Set bandwidth */
-               IRDA_DEBUG(1, "%s(), SIOCSBANDWIDTH\n", __FUNCTION__ );
+               IRDA_DEBUG(1, "%s(), SIOCSBANDWIDTH\n", __func__ );
                /*
                 * This function will also be used by IrLAP to change the
                 * speed, so we still must allow for speed change within
@@ -2050,13 +2050,13 @@ static int ali_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
                spin_unlock_irqrestore(&self->lock, flags);
                break;
        case SIOCSMEDIABUSY: /* Set media busy */
-               IRDA_DEBUG(1, "%s(), SIOCSMEDIABUSY\n", __FUNCTION__ );
+               IRDA_DEBUG(1, "%s(), SIOCSMEDIABUSY\n", __func__ );
                if (!capable(CAP_NET_ADMIN))
                        return -EPERM;
                irda_device_set_media_busy(self->netdev, TRUE);
                break;
        case SIOCGRECEIVING: /* Check if we are receiving right now */
-               IRDA_DEBUG(2, "%s(), SIOCGRECEIVING\n", __FUNCTION__ );
+               IRDA_DEBUG(2, "%s(), SIOCGRECEIVING\n", __func__ );
                /* This is protected */
                irq->ifr_receiving = ali_ircc_is_receiving(self);
                break;
@@ -2064,7 +2064,7 @@ static int ali_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
                ret = -EOPNOTSUPP;
        }
        
-       IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __FUNCTION__ );       
+       IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __func__ );
        
        return ret;
 }
@@ -2081,7 +2081,7 @@ static int ali_ircc_is_receiving(struct ali_ircc_cb *self)
        int status = FALSE;
        int iobase;             
        
-       IRDA_DEBUG(2, "%s(), ---------------- Start -----------------\n", __FUNCTION__ );
+       IRDA_DEBUG(2, "%s(), ---------------- Start -----------------\n", __func__ );
        
        IRDA_ASSERT(self != NULL, return FALSE;);
 
@@ -2095,7 +2095,7 @@ static int ali_ircc_is_receiving(struct ali_ircc_cb *self)
                if((inb(iobase+FIR_FIFO_FR) & 0x3f) != 0)               
                {
                        /* We are receiving something */
-                       IRDA_DEBUG(1, "%s(), We are receiving something\n", __FUNCTION__ );
+                       IRDA_DEBUG(1, "%s(), We are receiving something\n", __func__ );
                        status = TRUE;
                }
                switch_bank(iobase, BANK0);             
@@ -2107,7 +2107,7 @@ static int ali_ircc_is_receiving(struct ali_ircc_cb *self)
        
        spin_unlock_irqrestore(&self->lock, flags);
        
-       IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __FUNCTION__ );
+       IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __func__ );
        
        return status;
 }
@@ -2116,9 +2116,9 @@ static struct net_device_stats *ali_ircc_net_get_stats(struct net_device *dev)
 {
        struct ali_ircc_cb *self = (struct ali_ircc_cb *) dev->priv;
        
-       IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__ );
+       IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __func__ );
                
-       IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __FUNCTION__ );       
+       IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __func__ );
        
        return &self->stats;
 }
@@ -2164,7 +2164,7 @@ static void SetCOMInterrupts(struct ali_ircc_cb *self , unsigned char enable)
        
        int iobase = self->io.fir_base; /* or sir_base */
 
-       IRDA_DEBUG(2, "%s(), -------- Start -------- ( Enable = %d )\n", __FUNCTION__ , enable);        
+       IRDA_DEBUG(2, "%s(), -------- Start -------- ( Enable = %d )\n", __func__ , enable);
        
        /* Enable the interrupt which we wish to */
        if (enable){
@@ -2205,14 +2205,14 @@ static void SetCOMInterrupts(struct ali_ircc_cb *self , unsigned char enable)
        else
                outb(newMask, iobase+UART_IER);
                
-       IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __FUNCTION__ );       
+       IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __func__ );
 }
 
 static void SIR2FIR(int iobase)
 {
        //unsigned char tmp;
                
-       IRDA_DEBUG(1, "%s(), ---------------- Start ----------------\n", __FUNCTION__ );
+       IRDA_DEBUG(1, "%s(), ---------------- Start ----------------\n", __func__ );
        
        /* Already protected (change_speed() or setup()), no need to lock.
         * Jean II */
@@ -2228,14 +2228,14 @@ static void SIR2FIR(int iobase)
        //tmp |= 0x20;
        //outb(tmp, iobase+FIR_LCR_B);  
        
-       IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __FUNCTION__ );       
+       IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __func__ );
 }
 
 static void FIR2SIR(int iobase)
 {
        unsigned char val;
        
-       IRDA_DEBUG(1, "%s(), ---------------- Start ----------------\n", __FUNCTION__ );
+       IRDA_DEBUG(1, "%s(), ---------------- Start ----------------\n", __func__ );
        
        /* Already protected (change_speed() or setup()), no need to lock.
         * Jean II */
@@ -2251,7 +2251,7 @@ static void FIR2SIR(int iobase)
        val = inb(iobase+UART_LSR);
        val = inb(iobase+UART_MSR);
        
-       IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __FUNCTION__ );
+       IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __func__ );
 }
 
 MODULE_AUTHOR("Benjamin Kong <benjamin_kong@ali.com.tw>");
index 34ad189..69d16b3 100644 (file)
@@ -245,7 +245,7 @@ toshoboe_dumpregs (struct toshoboe_cb *self)
 {
   __u32 ringbase;
 
-  IRDA_DEBUG (4, "%s()\n", __FUNCTION__);
+  IRDA_DEBUG (4, "%s()\n", __func__);
 
   ringbase = INB (OBOE_RING_BASE0) << 10;
   ringbase |= INB (OBOE_RING_BASE1) << 18;
@@ -293,7 +293,7 @@ static void
 toshoboe_disablebm (struct toshoboe_cb *self)
 {
   __u8 command;
-  IRDA_DEBUG (4, "%s()\n", __FUNCTION__);
+  IRDA_DEBUG (4, "%s()\n", __func__);
 
   pci_read_config_byte (self->pdev, PCI_COMMAND, &command);
   command &= ~PCI_COMMAND_MASTER;
@@ -305,7 +305,7 @@ toshoboe_disablebm (struct toshoboe_cb *self)
 static void
 toshoboe_stopchip (struct toshoboe_cb *self)
 {
-  IRDA_DEBUG (4, "%s()\n", __FUNCTION__);
+  IRDA_DEBUG (4, "%s()\n", __func__);
 
   /*Disable interrupts */
   OUTB (0x0, OBOE_IER);
@@ -350,7 +350,7 @@ toshoboe_setbaud (struct toshoboe_cb *self)
   __u16 pconfig = 0;
   __u8 config0l = 0;
 
-  IRDA_DEBUG (2, "%s(%d/%d)\n", __FUNCTION__, self->speed, self->io.speed);
+  IRDA_DEBUG (2, "%s(%d/%d)\n", __func__, self->speed, self->io.speed);
 
   switch (self->speed)
     {
@@ -482,7 +482,7 @@ toshoboe_setbaud (struct toshoboe_cb *self)
 static void
 toshoboe_enablebm (struct toshoboe_cb *self)
 {
-  IRDA_DEBUG (4, "%s()\n", __FUNCTION__);
+  IRDA_DEBUG (4, "%s()\n", __func__);
   pci_set_master (self->pdev);
 }
 
@@ -492,7 +492,7 @@ toshoboe_initring (struct toshoboe_cb *self)
 {
   int i;
 
-  IRDA_DEBUG (4, "%s()\n", __FUNCTION__);
+  IRDA_DEBUG (4, "%s()\n", __func__);
 
   for (i = 0; i < TX_SLOTS; ++i)
     {
@@ -550,7 +550,7 @@ toshoboe_startchip (struct toshoboe_cb *self)
 {
   __u32 physaddr;
 
-  IRDA_DEBUG (4, "%s()\n", __FUNCTION__);
+  IRDA_DEBUG (4, "%s()\n", __func__);
 
   toshoboe_initring (self);
   toshoboe_enablebm (self);
@@ -824,7 +824,7 @@ toshoboe_probe (struct toshoboe_cb *self)
 #endif
   unsigned long flags;
 
-  IRDA_DEBUG (4, "%s()\n", __FUNCTION__);
+  IRDA_DEBUG (4, "%s()\n", __func__);
 
   if (request_irq (self->io.irq, toshoboe_probeinterrupt,
                    self->io.irqflags, "toshoboe", (void *) self))
@@ -983,10 +983,10 @@ toshoboe_hard_xmit (struct sk_buff *skb, struct net_device *dev)
 
   IRDA_ASSERT (self != NULL, return 0; );
 
-  IRDA_DEBUG (1, "%s.tx:%x(%x)%x\n", __FUNCTION__
+  IRDA_DEBUG (1, "%s.tx:%x(%x)%x\n", __func__
       ,skb->len,self->txpending,INB (OBOE_ENABLEH));
   if (!cb->magic) {
-      IRDA_DEBUG (2, "%s.Not IrLAP:%x\n", __FUNCTION__, cb->magic);
+      IRDA_DEBUG (2, "%s.Not IrLAP:%x\n", __func__, cb->magic);
 #ifdef DUMP_PACKETS
       _dumpbufs(skb->data,skb->len,'>');
 #endif
@@ -1015,7 +1015,7 @@ toshoboe_hard_xmit (struct sk_buff *skb, struct net_device *dev)
         {
           self->new_speed = speed;
           IRDA_DEBUG (1, "%s: Queued TxDone scheduled speed change %d\n" ,
-                     __FUNCTION__, speed);
+                     __func__, speed);
           /* if no data, that's all! */
           if (!skb->len)
             {
@@ -1057,7 +1057,7 @@ toshoboe_hard_xmit (struct sk_buff *skb, struct net_device *dev)
       /* which we will add a wrong checksum to */
 
       mtt = toshoboe_makemttpacket (self, self->tx_bufs[self->txs], mtt);
-      IRDA_DEBUG (1, "%s.mtt:%x(%x)%d\n", __FUNCTION__
+      IRDA_DEBUG (1, "%s.mtt:%x(%x)%d\n", __func__
           ,skb->len,mtt,self->txpending);
       if (mtt)
         {
@@ -1101,7 +1101,7 @@ dumpbufs(skb->data,skb->len,'>');
 
   if (self->ring->tx[self->txs].control & OBOE_CTL_TX_HW_OWNS)
     {
-      IRDA_DEBUG (0, "%s.ful:%x(%x)%x\n", __FUNCTION__
+      IRDA_DEBUG (0, "%s.ful:%x(%x)%x\n", __func__
           ,skb->len, self->ring->tx[self->txs].control, self->txpending);
       toshoboe_start_DMA(self, OBOE_CONFIG0H_ENTX);
       spin_unlock_irqrestore(&self->spinlock, flags);
@@ -1179,7 +1179,7 @@ toshoboe_interrupt (int irq, void *dev_id)
           if (self->ring->tx[i].control & OBOE_CTL_TX_HW_OWNS)
               self->txpending++;
         }
-      IRDA_DEBUG (1, "%s.txd(%x)%x/%x\n", __FUNCTION__
+      IRDA_DEBUG (1, "%s.txd(%x)%x/%x\n", __func__
           ,irqstat,txp,self->txpending);
 
       txp = INB (OBOE_TXSLOT) & OBOE_SLOT_MASK;
@@ -1209,7 +1209,7 @@ toshoboe_interrupt (int irq, void *dev_id)
         {
           self->speed = self->new_speed;
           IRDA_DEBUG (1, "%s: Executed TxDone scheduled speed change %d\n",
-                     __FUNCTION__, self->speed);
+                     __func__, self->speed);
           toshoboe_setbaud (self);
         }
 
@@ -1224,7 +1224,7 @@ toshoboe_interrupt (int irq, void *dev_id)
         {
           int len = self->ring->rx[self->rxs].len;
           skb = NULL;
-          IRDA_DEBUG (3, "%s.rcv:%x(%x)\n", __FUNCTION__
+          IRDA_DEBUG (3, "%s.rcv:%x(%x)\n", __func__
                      ,len,self->ring->rx[self->rxs].control);
 
 #ifdef DUMP_PACKETS
@@ -1246,7 +1246,7 @@ dumpbufs(self->rx_bufs[self->rxs],len,'<');
                       len -= 2;
                   else
                       len = 0;
-                  IRDA_DEBUG (1, "%s.SIR:%x(%x)\n", __FUNCTION__, len,enable);
+                  IRDA_DEBUG (1, "%s.SIR:%x(%x)\n", __func__, len,enable);
                 }
 
 #ifdef USE_MIR
@@ -1256,7 +1256,7 @@ dumpbufs(self->rx_bufs[self->rxs],len,'<');
                       len -= 2;
                   else
                       len = 0;
-                  IRDA_DEBUG (2, "%s.MIR:%x(%x)\n", __FUNCTION__, len,enable);
+                  IRDA_DEBUG (2, "%s.MIR:%x(%x)\n", __func__, len,enable);
                 }
 #endif
               else if (enable & OBOE_ENABLEH_FIRON)
@@ -1265,10 +1265,10 @@ dumpbufs(self->rx_bufs[self->rxs],len,'<');
                       len -= 4;   /*FIXME: check this */
                   else
                       len = 0;
-                  IRDA_DEBUG (1, "%s.FIR:%x(%x)\n", __FUNCTION__, len,enable);
+                  IRDA_DEBUG (1, "%s.FIR:%x(%x)\n", __func__, len,enable);
                 }
               else
-                  IRDA_DEBUG (0, "%s.?IR:%x(%x)\n", __FUNCTION__, len,enable);
+                  IRDA_DEBUG (0, "%s.?IR:%x(%x)\n", __func__, len,enable);
 
               if (len)
                 {
@@ -1289,7 +1289,7 @@ dumpbufs(self->rx_bufs[self->rxs],len,'<');
                     {
                       printk (KERN_INFO
                               "%s(), memory squeeze, dropping frame.\n",
-                             __FUNCTION__);
+                             __func__);
                     }
                 }
             }
@@ -1301,7 +1301,7 @@ dumpbufs(self->rx_bufs[self->rxs],len,'<');
             /* (SIR) data is splitted in several slots. */
             /* we have to join all the received buffers received */
             /*in a large buffer before checking CRC. */
-            IRDA_DEBUG (0, "%s.err:%x(%x)\n", __FUNCTION__
+            IRDA_DEBUG (0, "%s.err:%x(%x)\n", __func__
                 ,len,self->ring->rx[self->rxs].control);
             }
 
@@ -1329,7 +1329,7 @@ dumpbufs(self->rx_bufs[self->rxs],len,'<');
   if (irqstat & OBOE_INT_SIP)
     {
       self->int_sip++;
-      IRDA_DEBUG (1, "%s.sip:%x(%x)%x\n", __FUNCTION__
+      IRDA_DEBUG (1, "%s.sip:%x(%x)%x\n", __func__
              ,self->int_sip,irqstat,self->txpending);
     }
   return IRQ_HANDLED;
@@ -1343,7 +1343,7 @@ toshoboe_net_open (struct net_device *dev)
   unsigned long flags;
   int rc;
 
-  IRDA_DEBUG (4, "%s()\n", __FUNCTION__);
+  IRDA_DEBUG (4, "%s()\n", __func__);
 
   self = netdev_priv(dev);
 
@@ -1381,7 +1381,7 @@ toshoboe_net_close (struct net_device *dev)
 {
   struct toshoboe_cb *self;
 
-  IRDA_DEBUG (4, "%s()\n", __FUNCTION__);
+  IRDA_DEBUG (4, "%s()\n", __func__);
 
   IRDA_ASSERT (dev != NULL, return -1; );
   self = (struct toshoboe_cb *) dev->priv;
@@ -1426,7 +1426,7 @@ toshoboe_net_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
 
   IRDA_ASSERT (self != NULL, return -1; );
 
-  IRDA_DEBUG (5, "%s(), %s, (cmd=0x%X)\n", __FUNCTION__, dev->name, cmd);
+  IRDA_DEBUG (5, "%s(), %s, (cmd=0x%X)\n", __func__, dev->name, cmd);
 
   /* Disable interrupts & save flags */
   spin_lock_irqsave(&self->spinlock, flags);
@@ -1438,7 +1438,7 @@ toshoboe_net_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
        * speed, so we still must allow for speed change within
        * interrupt context.
        */
-      IRDA_DEBUG (1, "%s(BANDWIDTH), %s, (%X/%ld\n", __FUNCTION__
+      IRDA_DEBUG (1, "%s(BANDWIDTH), %s, (%X/%ld\n", __func__
           ,dev->name, INB (OBOE_STATUS), irq->ifr_baudrate );
       if (!in_interrupt () && !capable (CAP_NET_ADMIN)) {
        ret = -EPERM;
@@ -1451,7 +1451,7 @@ toshoboe_net_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
       self->new_speed = irq->ifr_baudrate;
       break;
     case SIOCSMEDIABUSY:       /* Set media busy */
-      IRDA_DEBUG (1, "%s(MEDIABUSY), %s, (%X/%x)\n", __FUNCTION__
+      IRDA_DEBUG (1, "%s(MEDIABUSY), %s, (%X/%x)\n", __func__
           ,dev->name, INB (OBOE_STATUS), capable (CAP_NET_ADMIN) );
       if (!capable (CAP_NET_ADMIN)) {
        ret = -EPERM;
@@ -1461,11 +1461,11 @@ toshoboe_net_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
       break;
     case SIOCGRECEIVING:       /* Check if we are receiving right now */
       irq->ifr_receiving = (INB (OBOE_STATUS) & OBOE_STATUS_RXBUSY) ? 1 : 0;
-      IRDA_DEBUG (3, "%s(RECEIVING), %s, (%X/%x)\n", __FUNCTION__
+      IRDA_DEBUG (3, "%s(RECEIVING), %s, (%X/%x)\n", __func__
           ,dev->name, INB (OBOE_STATUS), irq->ifr_receiving );
       break;
     default:
-      IRDA_DEBUG (1, "%s(?), %s, (cmd=0x%X)\n", __FUNCTION__, dev->name, cmd);
+      IRDA_DEBUG (1, "%s(?), %s, (cmd=0x%X)\n", __func__, dev->name, cmd);
       ret = -EOPNOTSUPP;
     }
 out:
@@ -1492,7 +1492,7 @@ toshoboe_close (struct pci_dev *pci_dev)
   int i;
   struct toshoboe_cb *self = (struct toshoboe_cb*)pci_get_drvdata(pci_dev);
 
-  IRDA_DEBUG (4, "%s()\n", __FUNCTION__);
+  IRDA_DEBUG (4, "%s()\n", __func__);
 
   IRDA_ASSERT (self != NULL, return; );
 
@@ -1533,7 +1533,7 @@ toshoboe_open (struct pci_dev *pci_dev, const struct pci_device_id *pdid)
   int ok = 0;
   int err;
 
-  IRDA_DEBUG (4, "%s()\n", __FUNCTION__);
+  IRDA_DEBUG (4, "%s()\n", __func__);
 
   if ((err=pci_enable_device(pci_dev)))
     return err;
@@ -1700,7 +1700,7 @@ toshoboe_gotosleep (struct pci_dev *pci_dev, pm_message_t crap)
   unsigned long flags;
   int i = 10;
 
-  IRDA_DEBUG (4, "%s()\n", __FUNCTION__);
+  IRDA_DEBUG (4, "%s()\n", __func__);
 
   if (!self || self->stopped)
     return 0;
@@ -1728,7 +1728,7 @@ toshoboe_wakeup (struct pci_dev *pci_dev)
   struct toshoboe_cb *self = (struct toshoboe_cb*)pci_get_drvdata(pci_dev);
   unsigned long flags;
 
-  IRDA_DEBUG (4, "%s()\n", __FUNCTION__);
+  IRDA_DEBUG (4, "%s()\n", __func__);
 
   if (!self || !self->stopped)
     return 0;
index 738531b..a31b8fa 100644 (file)
@@ -86,7 +86,7 @@ static int girbil_open(struct sir_dev *dev)
 {
        struct qos_info *qos = &dev->qos;
 
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
 
        /* Power on dongle */
        sirdev_set_dtr_rts(dev, TRUE, TRUE);
@@ -102,7 +102,7 @@ static int girbil_open(struct sir_dev *dev)
 
 static int girbil_close(struct sir_dev *dev)
 {
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
 
        /* Power off dongle */
        sirdev_set_dtr_rts(dev, FALSE, FALSE);
@@ -126,7 +126,7 @@ static int girbil_change_speed(struct sir_dev *dev, unsigned speed)
        u8 control[2];
        static int ret = 0;
 
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
 
        /* dongle alread reset - port and dongle at default speed */
 
@@ -179,7 +179,7 @@ static int girbil_change_speed(struct sir_dev *dev, unsigned speed)
                break;
 
        default:
-               IRDA_ERROR("%s - undefined state %d\n", __FUNCTION__, state);
+               IRDA_ERROR("%s - undefined state %d\n", __func__, state);
                ret = -EINVAL;
                break;
        }
@@ -209,7 +209,7 @@ static int girbil_reset(struct sir_dev *dev)
        u8 control = GIRBIL_TXEN | GIRBIL_RXEN;
        int ret = 0;
 
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
 
        switch (state) {
        case SIRDEV_STATE_DONGLE_RESET:
@@ -241,7 +241,7 @@ static int girbil_reset(struct sir_dev *dev)
                break;
 
        default:
-               IRDA_ERROR("%s(), undefined state %d\n", __FUNCTION__, state);
+               IRDA_ERROR("%s(), undefined state %d\n", __func__, state);
                ret = -1;
                break;
        }
index 18b471c..b5d6b9a 100644 (file)
@@ -177,12 +177,12 @@ static void irda_usb_build_header(struct irda_usb_cb *self,
                    (!force) && (self->speed != -1)) {
                        /* No speed and xbofs change here
                         * (we'll do it later in the write callback) */
-                       IRDA_DEBUG(2, "%s(), not changing speed yet\n", __FUNCTION__);
+                       IRDA_DEBUG(2, "%s(), not changing speed yet\n", __func__);
                        *header = 0;
                        return;
                }
 
-               IRDA_DEBUG(2, "%s(), changing speed to %d\n", __FUNCTION__, self->new_speed);
+               IRDA_DEBUG(2, "%s(), changing speed to %d\n", __func__, self->new_speed);
                self->speed = self->new_speed;
                /* We will do ` self->new_speed = -1; ' in the completion
                 * handler just in case the current URB fail - Jean II */
@@ -228,7 +228,7 @@ static void irda_usb_build_header(struct irda_usb_cb *self,
        
        /* Set the negotiated additional XBOFS */
        if (self->new_xbofs != -1) {
-               IRDA_DEBUG(2, "%s(), changing xbofs to %d\n", __FUNCTION__, self->new_xbofs);
+               IRDA_DEBUG(2, "%s(), changing xbofs to %d\n", __func__, self->new_xbofs);
                self->xbofs = self->new_xbofs;
                /* We will do ` self->new_xbofs = -1; ' in the completion
                 * handler just in case the current URB fail - Jean II */
@@ -302,13 +302,13 @@ static void irda_usb_change_speed_xbofs(struct irda_usb_cb *self)
        struct urb *urb;
        int ret;
 
-       IRDA_DEBUG(2, "%s(), speed=%d, xbofs=%d\n", __FUNCTION__,
+       IRDA_DEBUG(2, "%s(), speed=%d, xbofs=%d\n", __func__,
                   self->new_speed, self->new_xbofs);
 
        /* Grab the speed URB */
        urb = self->speed_urb;
        if (urb->status != 0) {
-               IRDA_WARNING("%s(), URB still in use!\n", __FUNCTION__);
+               IRDA_WARNING("%s(), URB still in use!\n", __func__);
                return;
        }
 
@@ -334,7 +334,7 @@ static void irda_usb_change_speed_xbofs(struct irda_usb_cb *self)
 
        /* Irq disabled -> GFP_ATOMIC */
        if ((ret = usb_submit_urb(urb, GFP_ATOMIC))) {
-               IRDA_WARNING("%s(), failed Speed URB\n", __FUNCTION__);
+               IRDA_WARNING("%s(), failed Speed URB\n", __func__);
        }
 }
 
@@ -347,7 +347,7 @@ static void speed_bulk_callback(struct urb *urb)
 {
        struct irda_usb_cb *self = urb->context;
        
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
 
        /* We should always have a context */
        IRDA_ASSERT(self != NULL, return;);
@@ -357,7 +357,7 @@ static void speed_bulk_callback(struct urb *urb)
        /* Check for timeout and other USB nasties */
        if (urb->status != 0) {
                /* I get a lot of -ECONNABORTED = -103 here - Jean II */
-               IRDA_DEBUG(0, "%s(), URB complete status %d, transfer_flags 0x%04X\n", __FUNCTION__, urb->status, urb->transfer_flags);
+               IRDA_DEBUG(0, "%s(), URB complete status %d, transfer_flags 0x%04X\n", __func__, urb->status, urb->transfer_flags);
 
                /* Don't do anything here, that might confuse the USB layer.
                 * Instead, we will wait for irda_usb_net_timeout(), the
@@ -392,7 +392,7 @@ static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
        int res, mtt;
        int     err = 1;        /* Failed */
 
-       IRDA_DEBUG(4, "%s() on %s\n", __FUNCTION__, netdev->name);
+       IRDA_DEBUG(4, "%s() on %s\n", __func__, netdev->name);
 
        netif_stop_queue(netdev);
 
@@ -403,7 +403,7 @@ static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
         * We need to check self->present under the spinlock because
         * of irda_usb_disconnect() is synchronous - Jean II */
        if (!self->present) {
-               IRDA_DEBUG(0, "%s(), Device is gone...\n", __FUNCTION__);
+               IRDA_DEBUG(0, "%s(), Device is gone...\n", __func__);
                goto drop;
        }
 
@@ -437,7 +437,7 @@ static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
        }
 
        if (urb->status != 0) {
-               IRDA_WARNING("%s(), URB still in use!\n", __FUNCTION__);
+               IRDA_WARNING("%s(), URB still in use!\n", __func__);
                goto drop;
        }
 
@@ -524,7 +524,7 @@ static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
        
        /* Ask USB to send the packet - Irq disabled -> GFP_ATOMIC */
        if ((res = usb_submit_urb(urb, GFP_ATOMIC))) {
-               IRDA_WARNING("%s(), failed Tx URB\n", __FUNCTION__);
+               IRDA_WARNING("%s(), failed Tx URB\n", __func__);
                self->stats.tx_errors++;
                /* Let USB recover : We will catch that in the watchdog */
                /*netif_start_queue(netdev);*/
@@ -556,7 +556,7 @@ static void write_bulk_callback(struct urb *urb)
        struct sk_buff *skb = urb->context;
        struct irda_usb_cb *self = ((struct irda_skb_cb *) skb->cb)->context;
        
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
 
        /* We should always have a context */
        IRDA_ASSERT(self != NULL, return;);
@@ -570,7 +570,7 @@ static void write_bulk_callback(struct urb *urb)
        /* Check for timeout and other USB nasties */
        if (urb->status != 0) {
                /* I get a lot of -ECONNABORTED = -103 here - Jean II */
-               IRDA_DEBUG(0, "%s(), URB complete status %d, transfer_flags 0x%04X\n", __FUNCTION__, urb->status, urb->transfer_flags);
+               IRDA_DEBUG(0, "%s(), URB complete status %d, transfer_flags 0x%04X\n", __func__, urb->status, urb->transfer_flags);
 
                /* Don't do anything here, that might confuse the USB layer,
                 * and we could go in recursion and blow the kernel stack...
@@ -589,7 +589,7 @@ static void write_bulk_callback(struct urb *urb)
 
        /* If the network is closed, stop everything */
        if ((!self->netopen) || (!self->present)) {
-               IRDA_DEBUG(0, "%s(), Network is gone...\n", __FUNCTION__);
+               IRDA_DEBUG(0, "%s(), Network is gone...\n", __func__);
                spin_unlock_irqrestore(&self->lock, flags);
                return;
        }
@@ -600,7 +600,7 @@ static void write_bulk_callback(struct urb *urb)
                    (self->new_xbofs != self->xbofs)) {
                        /* We haven't changed speed yet (because of
                         * IUC_SPEED_BUG), so do it now - Jean II */
-                       IRDA_DEBUG(1, "%s(), Changing speed now...\n", __FUNCTION__);
+                       IRDA_DEBUG(1, "%s(), Changing speed now...\n", __func__);
                        irda_usb_change_speed_xbofs(self);
                } else {
                        /* New speed and xbof is now commited in hardware */
@@ -632,7 +632,7 @@ static void irda_usb_net_timeout(struct net_device *netdev)
        struct urb *urb;
        int     done = 0;       /* If we have made any progress */
 
-       IRDA_DEBUG(0, "%s(), Network layer thinks we timed out!\n", __FUNCTION__);
+       IRDA_DEBUG(0, "%s(), Network layer thinks we timed out!\n", __func__);
        IRDA_ASSERT(self != NULL, return;);
 
        /* Protect us from USB callbacks, net Tx and else. */
@@ -640,7 +640,7 @@ static void irda_usb_net_timeout(struct net_device *netdev)
 
        /* self->present *MUST* be read under spinlock */
        if (!self->present) {
-               IRDA_WARNING("%s(), device not present!\n", __FUNCTION__);
+               IRDA_WARNING("%s(), device not present!\n", __func__);
                netif_stop_queue(netdev);
                spin_unlock_irqrestore(&self->lock, flags);
                return;
@@ -763,7 +763,7 @@ static void irda_usb_submit(struct irda_usb_cb *self, struct sk_buff *skb, struc
        struct irda_skb_cb *cb;
        int ret;
 
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
 
        /* This should never happen */
        IRDA_ASSERT(skb != NULL, return;);
@@ -786,7 +786,7 @@ static void irda_usb_submit(struct irda_usb_cb *self, struct sk_buff *skb, struc
                /* If this ever happen, we are in deep s***.
                 * Basically, the Rx path will stop... */
                IRDA_WARNING("%s(), Failed to submit Rx URB %d\n",
-                            __FUNCTION__, ret);
+                            __func__, ret);
        }
 }
 
@@ -807,7 +807,7 @@ static void irda_usb_receive(struct urb *urb)
        struct urb *next_urb;
        unsigned int len, docopy;
 
-       IRDA_DEBUG(2, "%s(), len=%d\n", __FUNCTION__, urb->actual_length);
+       IRDA_DEBUG(2, "%s(), len=%d\n", __func__, urb->actual_length);
        
        /* Find ourselves */
        cb = (struct irda_skb_cb *) skb->cb;
@@ -817,7 +817,7 @@ static void irda_usb_receive(struct urb *urb)
 
        /* If the network is closed or the device gone, stop everything */
        if ((!self->netopen) || (!self->present)) {
-               IRDA_DEBUG(0, "%s(), Network is gone!\n", __FUNCTION__);
+               IRDA_DEBUG(0, "%s(), Network is gone!\n", __func__);
                /* Don't re-submit the URB : will stall the Rx path */
                return;
        }
@@ -840,7 +840,7 @@ static void irda_usb_receive(struct urb *urb)
                        /* Usually precursor to a hot-unplug on OHCI. */
                default:
                        self->stats.rx_errors++;
-                       IRDA_DEBUG(0, "%s(), RX status %d, transfer_flags 0x%04X \n", __FUNCTION__, urb->status, urb->transfer_flags);
+                       IRDA_DEBUG(0, "%s(), RX status %d, transfer_flags 0x%04X \n", __func__, urb->status, urb->transfer_flags);
                        break;
                }
                /* If we received an error, we don't want to resubmit the
@@ -861,7 +861,7 @@ static void irda_usb_receive(struct urb *urb)
        
        /* Check for empty frames */
        if (urb->actual_length <= self->header_length) {
-               IRDA_WARNING("%s(), empty frame!\n", __FUNCTION__);
+               IRDA_WARNING("%s(), empty frame!\n", __func__);
                goto done;
        }
 
@@ -967,7 +967,7 @@ static void irda_usb_rx_defer_expired(unsigned long data)
        struct irda_skb_cb *cb;
        struct urb *next_urb;
 
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
 
        /* Find ourselves */
        cb = (struct irda_skb_cb *) skb->cb;
@@ -1053,7 +1053,7 @@ static int stir421x_fw_upload(struct irda_usb_cb *self,
                                   patch_block, block_size,
                                   &actual_len, msecs_to_jiffies(500));
                IRDA_DEBUG(3,"%s(): Bulk send %u bytes, ret=%d\n",
-                          __FUNCTION__, actual_len, ret);
+                          __func__, actual_len, ret);
 
                if (ret < 0)
                        break;
@@ -1092,7 +1092,7 @@ static int stir421x_patch_device(struct irda_usb_cb *self)
 
         /* We get a patch from userspace */
         IRDA_MESSAGE("%s(): Received firmware %s (%zu bytes)\n",
-                     __FUNCTION__, stir421x_fw_name, fw->size);
+                     __func__, stir421x_fw_name, fw->size);
 
         ret = -EINVAL;
 
@@ -1116,7 +1116,7 @@ static int stir421x_patch_device(struct irda_usb_cb *self)
                                + (build % 10);
 
                        IRDA_DEBUG(3, "%s(): Firmware Product version %ld\n",
-                                   __FUNCTION__, fw_version);
+                                   __func__, fw_version);
                 }
         }
 
@@ -1172,7 +1172,7 @@ static int irda_usb_net_open(struct net_device *netdev)
        char    hwname[16];
        int i;
        
-       IRDA_DEBUG(1, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(1, "%s()\n", __func__);
 
        IRDA_ASSERT(netdev != NULL, return -1;);
        self = (struct irda_usb_cb *) netdev->priv;
@@ -1182,13 +1182,13 @@ static int irda_usb_net_open(struct net_device *netdev)
        /* Can only open the device if it's there */
        if(!self->present) {
                spin_unlock_irqrestore(&self->lock, flags);
-               IRDA_WARNING("%s(), device not present!\n", __FUNCTION__);
+               IRDA_WARNING("%s(), device not present!\n", __func__);
                return -1;
        }
 
        if(self->needspatch) {
                spin_unlock_irqrestore(&self->lock, flags);
-               IRDA_WARNING("%s(), device needs patch\n", __FUNCTION__) ;
+               IRDA_WARNING("%s(), device needs patch\n", __func__) ;
                return -EIO ;
        }
 
@@ -1231,7 +1231,7 @@ static int irda_usb_net_open(struct net_device *netdev)
                        /* If this ever happen, we are in deep s***.
                         * Basically, we can't start the Rx path... */
                        IRDA_WARNING("%s(), Failed to allocate Rx skb\n",
-                                    __FUNCTION__);
+                                    __func__);
                        return -1;
                }
                //skb_reserve(newskb, USB_IRDA_HEADER - 1);
@@ -1254,7 +1254,7 @@ static int irda_usb_net_close(struct net_device *netdev)
        struct irda_usb_cb *self;
        int     i;
 
-       IRDA_DEBUG(1, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(1, "%s()\n", __func__);
 
        IRDA_ASSERT(netdev != NULL, return -1;);
        self = (struct irda_usb_cb *) netdev->priv;
@@ -1309,7 +1309,7 @@ static int irda_usb_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
        self = dev->priv;
        IRDA_ASSERT(self != NULL, return -1;);
 
-       IRDA_DEBUG(2, "%s(), %s, (cmd=0x%X)\n", __FUNCTION__, dev->name, cmd);
+       IRDA_DEBUG(2, "%s(), %s, (cmd=0x%X)\n", __func__, dev->name, cmd);
 
        switch (cmd) {
        case SIOCSBANDWIDTH: /* Set bandwidth */
@@ -1367,7 +1367,7 @@ static inline void irda_usb_init_qos(struct irda_usb_cb *self)
 {
        struct irda_class_desc *desc;
 
-       IRDA_DEBUG(3, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(3, "%s()\n", __func__);
        
        desc = self->irda_desc;
        
@@ -1384,7 +1384,7 @@ static inline void irda_usb_init_qos(struct irda_usb_cb *self)
        self->qos.data_size.bits       = desc->bmDataSize;
 
        IRDA_DEBUG(0, "%s(), dongle says speed=0x%X, size=0x%X, window=0x%X, bofs=0x%X, turn=0x%X\n", 
-               __FUNCTION__, self->qos.baud_rate.bits, self->qos.data_size.bits, self->qos.window_size.bits, self->qos.additional_bofs.bits, self->qos.min_turn_time.bits);
+               __func__, self->qos.baud_rate.bits, self->qos.data_size.bits, self->qos.window_size.bits, self->qos.additional_bofs.bits, self->qos.min_turn_time.bits);
 
        /* Don't always trust what the dongle tell us */
        if(self->capability & IUC_SIR_ONLY)
@@ -1419,7 +1419,7 @@ static inline int irda_usb_open(struct irda_usb_cb *self)
 {
        struct net_device *netdev = self->netdev;
 
-       IRDA_DEBUG(1, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(1, "%s()\n", __func__);
 
        irda_usb_init_qos(self);
 
@@ -1442,7 +1442,7 @@ static inline int irda_usb_open(struct irda_usb_cb *self)
  */
 static inline void irda_usb_close(struct irda_usb_cb *self)
 {
-       IRDA_DEBUG(1, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(1, "%s()\n", __func__);
 
        /* Remove netdevice */
        unregister_netdev(self->netdev);
@@ -1515,13 +1515,13 @@ static inline int irda_usb_parse_endpoints(struct irda_usb_cb *self, struct usb_
                                /* This is our interrupt endpoint */
                                self->bulk_int_ep = ep;
                        } else {
-                               IRDA_ERROR("%s(), Unrecognised endpoint %02X.\n", __FUNCTION__, ep);
+                               IRDA_ERROR("%s(), Unrecognised endpoint %02X.\n", __func__, ep);
                        }
                }
        }
 
        IRDA_DEBUG(0, "%s(), And our endpoints are : in=%02X, out=%02X (%d), int=%02X\n",
-               __FUNCTION__, self->bulk_in_ep, self->bulk_out_ep, self->bulk_out_mtu, self->bulk_int_ep);
+               __func__, self->bulk_in_ep, self->bulk_out_ep, self->bulk_out_mtu, self->bulk_int_ep);
 
        return((self->bulk_in_ep != 0) && (self->bulk_out_ep != 0));
 }
@@ -1583,7 +1583,7 @@ static inline struct irda_class_desc *irda_usb_find_class_desc(struct usb_interf
                0, intf->altsetting->desc.bInterfaceNumber, desc,
                sizeof(*desc), 500);
        
-       IRDA_DEBUG(1, "%s(), ret=%d\n", __FUNCTION__, ret);
+       IRDA_DEBUG(1, "%s(), ret=%d\n", __func__, ret);
        if (ret < sizeof(*desc)) {
                IRDA_WARNING("usb-irda: class_descriptor read %s (%d)\n",
                             (ret<0) ? "failed" : "too short", ret);
@@ -1696,10 +1696,10 @@ static int irda_usb_probe(struct usb_interface *intf,
                        /* Martin Diehl says if we get a -EPIPE we should
                         * be fine and we don't need to do a usb_clear_halt().
                         * - Jean II */
-                       IRDA_DEBUG(0, "%s(), Received -EPIPE, ignoring...\n", __FUNCTION__);
+                       IRDA_DEBUG(0, "%s(), Received -EPIPE, ignoring...\n", __func__);
                        break;
                default:
-                       IRDA_DEBUG(0, "%s(), Unknown error %d\n", __FUNCTION__, ret);
+                       IRDA_DEBUG(0, "%s(), Unknown error %d\n", __func__, ret);
                        ret = -EIO;
                        goto err_out_3;
        }
@@ -1708,7 +1708,7 @@ static int irda_usb_probe(struct usb_interface *intf,
        interface = intf->cur_altsetting;
        if(!irda_usb_parse_endpoints(self, interface->endpoint,
                                     interface->desc.bNumEndpoints)) {
-               IRDA_ERROR("%s(), Bogus endpoints...\n", __FUNCTION__);
+               IRDA_ERROR("%s(), Bogus endpoints...\n", __func__);
                ret = -EIO;
                goto err_out_3;
        }
@@ -1815,7 +1815,7 @@ static void irda_usb_disconnect(struct usb_interface *intf)
        struct irda_usb_cb *self = usb_get_intfdata(intf);
        int i;
 
-       IRDA_DEBUG(1, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(1, "%s()\n", __func__);
 
        usb_set_intfdata(intf, NULL);
        if (!self)
@@ -1865,7 +1865,7 @@ static void irda_usb_disconnect(struct usb_interface *intf)
 
        /* Free self and network device */
        free_netdev(self->netdev);
-       IRDA_DEBUG(0, "%s(), USB IrDA Disconnected\n", __FUNCTION__);
+       IRDA_DEBUG(0, "%s(), USB IrDA Disconnected\n", __func__);
 }
 
 /*------------------------------------------------------------------*/
index 9e33196..6bcee01 100644 (file)
@@ -231,7 +231,7 @@ static void irtty_receive_buf(struct tty_struct *tty, const unsigned char *cp,
 
        dev = priv->dev;
        if (!dev) {
-               IRDA_WARNING("%s(), not ready yet!\n", __FUNCTION__);
+               IRDA_WARNING("%s(), not ready yet!\n", __func__);
                return;
        }
 
@@ -388,7 +388,7 @@ static int irtty_ioctl(struct tty_struct *tty, struct file *file, unsigned int c
        IRDA_ASSERT(priv != NULL, return -ENODEV;);
        IRDA_ASSERT(priv->magic == IRTTY_MAGIC, return -EBADR;);
 
-       IRDA_DEBUG(3, "%s(cmd=0x%X)\n", __FUNCTION__, cmd);
+       IRDA_DEBUG(3, "%s(cmd=0x%X)\n", __func__, cmd);
 
        dev = priv->dev;
        IRDA_ASSERT(dev != NULL, return -1;);
@@ -476,7 +476,7 @@ static int irtty_open(struct tty_struct *tty)
 
        mutex_unlock(&irtty_mutex);
 
-       IRDA_DEBUG(0, "%s - %s: irda line discipline opened\n", __FUNCTION__, tty->name);
+       IRDA_DEBUG(0, "%s - %s: irda line discipline opened\n", __func__, tty->name);
 
        return 0;
 
@@ -528,7 +528,7 @@ static void irtty_close(struct tty_struct *tty)
 
        kfree(priv);
 
-       IRDA_DEBUG(0, "%s - %s: irda line discipline closed\n", __FUNCTION__, tty->name);
+       IRDA_DEBUG(0, "%s - %s: irda line discipline closed\n", __func__, tty->name);
 }
 
 /* ------------------------------------------------------- */
@@ -566,7 +566,7 @@ static void __exit irtty_sir_cleanup(void)
 
        if ((err = tty_unregister_ldisc(N_IRDA))) {
                IRDA_ERROR("%s(), can't unregister line discipline (err = %d)\n",
-                          __FUNCTION__, err);
+                          __func__, err);
        }
 }
 
index 648e54b..73fe83b 100644 (file)
@@ -243,7 +243,7 @@ static void kingsun_rcv_irq(struct urb *urb)
                }
        } else if (urb->actual_length > 0) {
                err("%s(): Unexpected response length, expected %d got %d",
-                   __FUNCTION__, kingsun->max_rx, urb->actual_length);
+                   __func__, kingsun->max_rx, urb->actual_length);
        }
        /* This urb has already been filled in kingsun_net_open */
        ret = usb_submit_urb(urb, GFP_ATOMIC);
index 73261c5..d6d9d2e 100644 (file)
@@ -78,7 +78,7 @@ static int litelink_open(struct sir_dev *dev)
 {
        struct qos_info *qos = &dev->qos;
 
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
 
        /* Power up dongle */
        sirdev_set_dtr_rts(dev, TRUE, TRUE);
@@ -95,7 +95,7 @@ static int litelink_open(struct sir_dev *dev)
 
 static int litelink_close(struct sir_dev *dev)
 {
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
 
        /* Power off dongle */
        sirdev_set_dtr_rts(dev, FALSE, FALSE);
@@ -113,7 +113,7 @@ static int litelink_change_speed(struct sir_dev *dev, unsigned speed)
 {
         int i;
 
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
 
        /* dongle already reset by irda-thread - current speed (dongle and
         * port) is the default speed (115200 for litelink!)
@@ -156,7 +156,7 @@ static int litelink_change_speed(struct sir_dev *dev, unsigned speed)
  */
 static int litelink_reset(struct sir_dev *dev)
 {
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
 
        /* probably the power-up can be dropped here, but with only
         * 15 usec delay it's not worth the risk unless somebody with
index 809906d..1ceed9c 100644 (file)
@@ -67,13 +67,13 @@ static struct dongle_driver ma600 = {
 
 static int __init ma600_sir_init(void)
 {
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
        return irda_register_dongle(&ma600);
 }
 
 static void __exit ma600_sir_cleanup(void)
 {
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
        irda_unregister_dongle(&ma600);
 }
 
@@ -88,7 +88,7 @@ static int ma600_open(struct sir_dev *dev)
 {
        struct qos_info *qos = &dev->qos;
 
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
 
        sirdev_set_dtr_rts(dev, TRUE, TRUE);
 
@@ -106,7 +106,7 @@ static int ma600_open(struct sir_dev *dev)
 
 static int ma600_close(struct sir_dev *dev)
 {
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
 
        /* Power off dongle */
        sirdev_set_dtr_rts(dev, FALSE, FALSE);
@@ -176,7 +176,7 @@ static int ma600_change_speed(struct sir_dev *dev, unsigned speed)
 {
        u8      byte;
        
-       IRDA_DEBUG(2, "%s(), speed=%d (was %d)\n", __FUNCTION__,
+       IRDA_DEBUG(2, "%s(), speed=%d (was %d)\n", __func__,
                speed, dev->speed);
 
        /* dongle already reset, dongle and port at default speed (9600) */
@@ -201,12 +201,12 @@ static int ma600_change_speed(struct sir_dev *dev, unsigned speed)
        sirdev_raw_read(dev, &byte, sizeof(byte));
        if (byte != get_control_byte(speed))  {
                IRDA_WARNING("%s(): bad control byte read-back %02x != %02x\n",
-                            __FUNCTION__, (unsigned) byte,
+                            __func__, (unsigned) byte,
                             (unsigned) get_control_byte(speed));
                return -1;
        }
        else
-               IRDA_DEBUG(2, "%s() control byte write read OK\n", __FUNCTION__);
+               IRDA_DEBUG(2, "%s() control byte write read OK\n", __func__);
 #endif
 
        /* Set DTR, Set RTS */
@@ -238,7 +238,7 @@ static int ma600_change_speed(struct sir_dev *dev, unsigned speed)
 
 int ma600_reset(struct sir_dev *dev)
 {
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
 
        /* Reset the dongle : set DTR low for 10 ms */
        sirdev_set_dtr_rts(dev, FALSE, TRUE);
index 67bd016..5e2f485 100644 (file)
@@ -63,7 +63,7 @@ static int mcp2120_open(struct sir_dev *dev)
 {
        struct qos_info *qos = &dev->qos;
 
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
 
        /* seems no explicit power-on required here and reset switching it on anyway */
 
@@ -76,7 +76,7 @@ static int mcp2120_open(struct sir_dev *dev)
 
 static int mcp2120_close(struct sir_dev *dev)
 {
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
 
        /* Power off dongle */
         /* reset and inhibit mcp2120 */
@@ -102,7 +102,7 @@ static int mcp2120_change_speed(struct sir_dev *dev, unsigned speed)
        u8 control[2];
        static int ret = 0;
 
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
 
        switch (state) {
        case SIRDEV_STATE_DONGLE_SPEED:
@@ -155,7 +155,7 @@ static int mcp2120_change_speed(struct sir_dev *dev, unsigned speed)
                break;
 
        default:
-               IRDA_ERROR("%s(), undefine state %d\n", __FUNCTION__, state);
+               IRDA_ERROR("%s(), undefine state %d\n", __func__, state);
                ret = -EINVAL;
                break;
        }
@@ -187,7 +187,7 @@ static int mcp2120_reset(struct sir_dev *dev)
        unsigned delay = 0;
        int ret = 0;
 
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
 
        switch (state) {
        case SIRDEV_STATE_DONGLE_RESET:
@@ -213,7 +213,7 @@ static int mcp2120_reset(struct sir_dev *dev)
                break;
 
        default:
-               IRDA_ERROR("%s(), undefined state %d\n", __FUNCTION__, state);
+               IRDA_ERROR("%s(), undefined state %d\n", __func__, state);
                ret = -EINVAL;
                break;
        }
index effc1ce..8583d95 100644 (file)
@@ -151,8 +151,8 @@ static char *dongle_types[] = {
 static chipio_t pnp_info;
 static const struct pnp_device_id nsc_ircc_pnp_table[] = {
        { .id = "NSC6001", .driver_data = 0 },
-       { .id = "IBM0071", .driver_data = 0 },
        { .id = "HWPC224", .driver_data = 0 },
+       { .id = "IBM0071", .driver_data = NSC_FORCE_DONGLE_TYPE9 },
        { }
 };
 
@@ -223,7 +223,7 @@ static int __init nsc_ircc_init(void)
 
        /* Probe for all the NSC chipsets we know about */
        for (chip = chips; chip->name ; chip++) {
-               IRDA_DEBUG(2, "%s(), Probing for %s ...\n", __FUNCTION__,
+               IRDA_DEBUG(2, "%s(), Probing for %s ...\n", __func__,
                           chip->name);
                
                /* Try all config registers for this chip */
@@ -235,7 +235,7 @@ static int __init nsc_ircc_init(void)
                        /* Read index register */
                        reg = inb(cfg_base);
                        if (reg == 0xff) {
-                               IRDA_DEBUG(2, "%s() no chip at 0x%03x\n", __FUNCTION__, cfg_base);
+                               IRDA_DEBUG(2, "%s() no chip at 0x%03x\n", __func__, cfg_base);
                                continue;
                        }
                        
@@ -244,7 +244,7 @@ static int __init nsc_ircc_init(void)
                        id = inb(cfg_base+1);
                        if ((id & chip->cid_mask) == chip->cid_value) {
                                IRDA_DEBUG(2, "%s() Found %s chip, revision=%d\n",
-                                          __FUNCTION__, chip->name, id & ~chip->cid_mask);
+                                          __func__, chip->name, id & ~chip->cid_mask);
 
                                /*
                                 * If we found a correct PnP setting,
@@ -295,7 +295,7 @@ static int __init nsc_ircc_init(void)
                                }
                                i++;
                        } else {
-                               IRDA_DEBUG(2, "%s(), Wrong chip id=0x%02x\n", __FUNCTION__, id);
+                               IRDA_DEBUG(2, "%s(), Wrong chip id=0x%02x\n", __func__, id);
                        }
                } 
        }
@@ -345,7 +345,7 @@ static int __init nsc_ircc_open(chipio_t *info)
        void *ret;
        int err, chip_index;
 
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
 
 
        for (chip_index = 0; chip_index < ARRAY_SIZE(dev_self); chip_index++) {
@@ -354,7 +354,7 @@ static int __init nsc_ircc_open(chipio_t *info)
        }
 
        if (chip_index == ARRAY_SIZE(dev_self)) {
-               IRDA_ERROR("%s(), maximum number of supported chips reached!\n", __FUNCTION__);
+               IRDA_ERROR("%s(), maximum number of supported chips reached!\n", __func__);
                return -ENOMEM;
        }
 
@@ -369,7 +369,7 @@ static int __init nsc_ircc_open(chipio_t *info)
        dev = alloc_irdadev(sizeof(struct nsc_ircc_cb));
        if (dev == NULL) {
                IRDA_ERROR("%s(), can't allocate memory for "
-                          "control block!\n", __FUNCTION__);
+                          "control block!\n", __func__);
                return -ENOMEM;
        }
 
@@ -393,7 +393,7 @@ static int __init nsc_ircc_open(chipio_t *info)
        ret = request_region(self->io.fir_base, self->io.fir_ext, driver_name);
        if (!ret) {
                IRDA_WARNING("%s(), can't get iobase of 0x%03x\n",
-                            __FUNCTION__, self->io.fir_base);
+                            __func__, self->io.fir_base);
                err = -ENODEV;
                goto out1;
        }
@@ -450,7 +450,7 @@ static int __init nsc_ircc_open(chipio_t *info)
 
        err = register_netdev(dev);
        if (err) {
-               IRDA_ERROR("%s(), register_netdev() failed!\n", __FUNCTION__);
+               IRDA_ERROR("%s(), register_netdev() failed!\n", __func__);
                goto out4;
        }
        IRDA_MESSAGE("IrDA: Registered device %s\n", dev->name);
@@ -506,7 +506,7 @@ static int __exit nsc_ircc_close(struct nsc_ircc_cb *self)
 {
        int iobase;
 
-       IRDA_DEBUG(4, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(4, "%s()\n", __func__);
 
        IRDA_ASSERT(self != NULL, return -1;);
 
@@ -519,7 +519,7 @@ static int __exit nsc_ircc_close(struct nsc_ircc_cb *self)
 
        /* Release the PORT that this driver is using */
        IRDA_DEBUG(4, "%s(), Releasing Region %03x\n", 
-                  __FUNCTION__, self->io.fir_base);
+                  __func__, self->io.fir_base);
        release_region(self->io.fir_base, self->io.fir_ext);
 
        if (self->tx_buff.head)
@@ -557,7 +557,7 @@ static int nsc_ircc_init_108(nsc_chip_t *chip, chipio_t *info)
        case 0x2e8: outb(0x15, cfg_base+1); break;
        case 0x3f8: outb(0x16, cfg_base+1); break;
        case 0x2f8: outb(0x17, cfg_base+1); break;
-       default: IRDA_ERROR("%s(), invalid base_address", __FUNCTION__);
+       default: IRDA_ERROR("%s(), invalid base_address", __func__);
        }
        
        /* Control Signal Routing Register (CSRT) */
@@ -569,7 +569,7 @@ static int nsc_ircc_init_108(nsc_chip_t *chip, chipio_t *info)
        case 9:  temp = 0x05; break;
        case 11: temp = 0x06; break;
        case 15: temp = 0x07; break;
-       default: IRDA_ERROR("%s(), invalid irq", __FUNCTION__);
+       default: IRDA_ERROR("%s(), invalid irq", __func__);
        }
        outb(CFG_108_CSRT, cfg_base);
        
@@ -577,7 +577,7 @@ static int nsc_ircc_init_108(nsc_chip_t *chip, chipio_t *info)
        case 0: outb(0x08+temp, cfg_base+1); break;
        case 1: outb(0x10+temp, cfg_base+1); break;
        case 3: outb(0x18+temp, cfg_base+1); break;
-       default: IRDA_ERROR("%s(), invalid dma", __FUNCTION__);
+       default: IRDA_ERROR("%s(), invalid dma", __func__);
        }
        
        outb(CFG_108_MCTL, cfg_base);      /* Mode Control Register (MCTL) */
@@ -616,7 +616,7 @@ static int nsc_ircc_probe_108(nsc_chip_t *chip, chipio_t *info)
                break;
        }
        info->sir_base = info->fir_base;
-       IRDA_DEBUG(2, "%s(), probing fir_base=0x%03x\n", __FUNCTION__,
+       IRDA_DEBUG(2, "%s(), probing fir_base=0x%03x\n", __func__,
                   info->fir_base);
 
        /* Read control signals routing register (CSRT) */
@@ -649,7 +649,7 @@ static int nsc_ircc_probe_108(nsc_chip_t *chip, chipio_t *info)
                info->irq = 15;
                break;
        }
-       IRDA_DEBUG(2, "%s(), probing irq=%d\n", __FUNCTION__, info->irq);
+       IRDA_DEBUG(2, "%s(), probing irq=%d\n", __func__, info->irq);
 
        /* Currently we only read Rx DMA but it will also be used for Tx */
        switch ((reg >> 3) & 0x03) {
@@ -666,7 +666,7 @@ static int nsc_ircc_probe_108(nsc_chip_t *chip, chipio_t *info)
                info->dma = 3;
                break;
        }
-       IRDA_DEBUG(2, "%s(), probing dma=%d\n", __FUNCTION__, info->dma);
+       IRDA_DEBUG(2, "%s(), probing dma=%d\n", __func__, info->dma);
 
        /* Read mode control register (MCTL) */
        outb(CFG_108_MCTL, cfg_base);
@@ -823,7 +823,7 @@ static int nsc_ircc_init_39x(nsc_chip_t *chip, chipio_t *info)
        /* User is sure about his config... accept it. */
        IRDA_DEBUG(2, "%s(): nsc_ircc_init_39x (user settings): "
                   "io=0x%04x, irq=%d, dma=%d\n", 
-                  __FUNCTION__, info->fir_base, info->irq, info->dma);
+                  __func__, info->fir_base, info->irq, info->dma);
 
        /* Access bank for SP2 */
        outb(CFG_39X_LDN, cfg_base);
@@ -864,7 +864,7 @@ static int nsc_ircc_probe_39x(nsc_chip_t *chip, chipio_t *info)
        int enabled, susp;
 
        IRDA_DEBUG(2, "%s(), nsc_ircc_probe_39x, base=%d\n",
-                  __FUNCTION__, cfg_base);
+                  __func__, cfg_base);
 
        /* This function should be executed with irq off to avoid
         * another driver messing with the Super I/O bank - Jean II */
@@ -898,7 +898,7 @@ static int nsc_ircc_probe_39x(nsc_chip_t *chip, chipio_t *info)
        outb(CFG_39X_SPC, cfg_base);
        susp = 1 - ((inb(cfg_base+1) & 0x02) >> 1);
 
-       IRDA_DEBUG(2, "%s(): io=0x%02x%02x, irq=%d (type %d), rxdma=%d, txdma=%d, enabled=%d (suspended=%d)\n", __FUNCTION__, reg1,reg2,irq,irqt,dma1,dma2,enabled,susp);
+       IRDA_DEBUG(2, "%s(): io=0x%02x%02x, irq=%d (type %d), rxdma=%d, txdma=%d, enabled=%d (suspended=%d)\n", __func__, reg1,reg2,irq,irqt,dma1,dma2,enabled,susp);
 
        /* Configure SP2 */
 
@@ -930,7 +930,10 @@ static int nsc_ircc_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *i
        pnp_info.dma = -1;
        pnp_succeeded = 1;
 
-       /* There don't seem to be any way to get the cfg_base.
+       if (id->driver_data & NSC_FORCE_DONGLE_TYPE9)
+               dongle_id = 0x9;
+
+       /* There doesn't seem to be any way of getting the cfg_base.
         * On my box, cfg_base is in the PnP descriptor of the
         * motherboard. Oh well... Jean II */
 
@@ -947,7 +950,7 @@ static int nsc_ircc_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *i
                pnp_info.dma = pnp_dma(dev, 0);
 
        IRDA_DEBUG(0, "%s() : From PnP, found firbase 0x%03X ; irq %d ; dma %d.\n",
-                  __FUNCTION__, pnp_info.fir_base, pnp_info.irq, pnp_info.dma);
+                  __func__, pnp_info.fir_base, pnp_info.irq, pnp_info.dma);
 
        if((pnp_info.fir_base == 0) ||
           (pnp_info.irq == -1) || (pnp_info.dma == -1)) {
@@ -976,7 +979,7 @@ static int nsc_ircc_setup(chipio_t *info)
        version = inb(iobase+MID);
 
        IRDA_DEBUG(2, "%s() Driver %s Found chip version %02x\n",
-                  __FUNCTION__, driver_name, version);
+                  __func__, driver_name, version);
 
        /* Should be 0x2? */
        if (0x20 != (version & 0xf0)) {
@@ -1080,30 +1083,30 @@ static void nsc_ircc_init_dongle_interface (int iobase, int dongle_id)
        case 0x00: /* same as */
        case 0x01: /* Differential serial interface */
                IRDA_DEBUG(0, "%s(), %s not defined by irda yet\n",
-                          __FUNCTION__, dongle_types[dongle_id]); 
+                          __func__, dongle_types[dongle_id]);
                break;
        case 0x02: /* same as */
        case 0x03: /* Reserved */
                IRDA_DEBUG(0, "%s(), %s not defined by irda yet\n",
-                          __FUNCTION__, dongle_types[dongle_id]); 
+                          __func__, dongle_types[dongle_id]);
                break;
        case 0x04: /* Sharp RY5HD01 */
                break;
        case 0x05: /* Reserved, but this is what the Thinkpad reports */
                IRDA_DEBUG(0, "%s(), %s not defined by irda yet\n",
-                          __FUNCTION__, dongle_types[dongle_id]); 
+                          __func__, dongle_types[dongle_id]);
                break;
        case 0x06: /* Single-ended serial interface */
                IRDA_DEBUG(0, "%s(), %s not defined by irda yet\n",
-                          __FUNCTION__, dongle_types[dongle_id]); 
+                          __func__, dongle_types[dongle_id]);
                break;
        case 0x07: /* Consumer-IR only */
                IRDA_DEBUG(0, "%s(), %s is not for IrDA mode\n",
-                          __FUNCTION__, dongle_types[dongle_id]); 
+                          __func__, dongle_types[dongle_id]);
                break;
        case 0x08: /* HP HSDL-2300, HP HSDL-3600/HSDL-3610 */
                IRDA_DEBUG(0, "%s(), %s\n",
-                          __FUNCTION__, dongle_types[dongle_id]);
+                          __func__, dongle_types[dongle_id]);
                break;
        case 0x09: /* IBM31T1100 or Temic TFDS6000/TFDS6500 */
                outb(0x28, iobase+7); /* Set irsl[0-2] as output */
@@ -1111,7 +1114,7 @@ static void nsc_ircc_init_dongle_interface (int iobase, int dongle_id)
        case 0x0A: /* same as */
        case 0x0B: /* Reserved */
                IRDA_DEBUG(0, "%s(), %s not defined by irda yet\n",
-                          __FUNCTION__, dongle_types[dongle_id]); 
+                          __func__, dongle_types[dongle_id]);
                break;
        case 0x0C: /* same as */
        case 0x0D: /* HP HSDL-1100/HSDL-2100 */
@@ -1126,14 +1129,14 @@ static void nsc_ircc_init_dongle_interface (int iobase, int dongle_id)
                break;
        case 0x0F: /* No dongle connected */
                IRDA_DEBUG(0, "%s(), %s\n",
-                          __FUNCTION__, dongle_types[dongle_id]); 
+                          __func__, dongle_types[dongle_id]);
 
                switch_bank(iobase, BANK0);
                outb(0x62, iobase+MCR);
                break;
        default: 
                IRDA_DEBUG(0, "%s(), invalid dongle_id %#x", 
-                          __FUNCTION__, dongle_id);
+                          __func__, dongle_id);
        }
        
        /* IRCFG1: IRSL1 and 2 are set to IrDA mode */
@@ -1165,30 +1168,30 @@ static void nsc_ircc_change_dongle_speed(int iobase, int speed, int dongle_id)
        case 0x00: /* same as */
        case 0x01: /* Differential serial interface */
                IRDA_DEBUG(0, "%s(), %s not defined by irda yet\n",
-                          __FUNCTION__, dongle_types[dongle_id]); 
+                          __func__, dongle_types[dongle_id]);
                break;
        case 0x02: /* same as */
        case 0x03: /* Reserved */
                IRDA_DEBUG(0, "%s(), %s not defined by irda yet\n",
-                          __FUNCTION__, dongle_types[dongle_id]); 
+                          __func__, dongle_types[dongle_id]);
                break;
        case 0x04: /* Sharp RY5HD01 */
                break;
        case 0x05: /* Reserved */
                IRDA_DEBUG(0, "%s(), %s not defined by irda yet\n",
-                          __FUNCTION__, dongle_types[dongle_id]); 
+                          __func__, dongle_types[dongle_id]);
                break;
        case 0x06: /* Single-ended serial interface */
                IRDA_DEBUG(0, "%s(), %s not defined by irda yet\n",
-                          __FUNCTION__, dongle_types[dongle_id]); 
+                          __func__, dongle_types[dongle_id]);
                break;
        case 0x07: /* Consumer-IR only */
                IRDA_DEBUG(0, "%s(), %s is not for IrDA mode\n",
-                          __FUNCTION__, dongle_types[dongle_id]); 
+                          __func__, dongle_types[dongle_id]);
                break;
        case 0x08: /* HP HSDL-2300, HP HSDL-3600/HSDL-3610 */
                IRDA_DEBUG(0, "%s(), %s\n", 
-                          __FUNCTION__, dongle_types[dongle_id]); 
+                          __func__, dongle_types[dongle_id]);
                outb(0x00, iobase+4);
                if (speed > 115200)
                        outb(0x01, iobase+4);
@@ -1207,7 +1210,7 @@ static void nsc_ircc_change_dongle_speed(int iobase, int speed, int dongle_id)
        case 0x0A: /* same as */
        case 0x0B: /* Reserved */
                IRDA_DEBUG(0, "%s(), %s not defined by irda yet\n",
-                          __FUNCTION__, dongle_types[dongle_id]); 
+                          __func__, dongle_types[dongle_id]);
                break;
        case 0x0C: /* same as */
        case 0x0D: /* HP HSDL-1100/HSDL-2100 */
@@ -1216,13 +1219,13 @@ static void nsc_ircc_change_dongle_speed(int iobase, int speed, int dongle_id)
                break;
        case 0x0F: /* No dongle connected */
                IRDA_DEBUG(0, "%s(), %s is not for IrDA mode\n",
-                          __FUNCTION__, dongle_types[dongle_id]);
+                          __func__, dongle_types[dongle_id]);
 
                switch_bank(iobase, BANK0); 
                outb(0x62, iobase+MCR);
                break;
        default: 
-               IRDA_DEBUG(0, "%s(), invalid data_rate\n", __FUNCTION__);
+               IRDA_DEBUG(0, "%s(), invalid data_rate\n", __func__);
        }
        /* Restore bank register */
        outb(bank, iobase+BSR);
@@ -1243,7 +1246,7 @@ static __u8 nsc_ircc_change_speed(struct nsc_ircc_cb *self, __u32 speed)
        __u8 bank;
        __u8 ier;                  /* Interrupt enable register */
 
-       IRDA_DEBUG(2, "%s(), speed=%d\n", __FUNCTION__, speed);
+       IRDA_DEBUG(2, "%s(), speed=%d\n", __func__, speed);
 
        IRDA_ASSERT(self != NULL, return 0;);
 
@@ -1276,20 +1279,20 @@ static __u8 nsc_ircc_change_speed(struct nsc_ircc_cb *self, __u32 speed)
                outb(inb(iobase+4) | 0x04, iobase+4);
               
                mcr = MCR_MIR;
-               IRDA_DEBUG(0, "%s(), handling baud of 576000\n", __FUNCTION__);
+               IRDA_DEBUG(0, "%s(), handling baud of 576000\n", __func__);
                break;
        case 1152000:
                mcr = MCR_MIR;
-               IRDA_DEBUG(0, "%s(), handling baud of 1152000\n", __FUNCTION__);
+               IRDA_DEBUG(0, "%s(), handling baud of 1152000\n", __func__);
                break;
        case 4000000:
                mcr = MCR_FIR;
-               IRDA_DEBUG(0, "%s(), handling baud of 4000000\n", __FUNCTION__);
+               IRDA_DEBUG(0, "%s(), handling baud of 4000000\n", __func__);
                break;
        default:
                mcr = MCR_FIR;
                IRDA_DEBUG(0, "%s(), unknown baud rate of %d\n", 
-                          __FUNCTION__, speed);
+                          __func__, speed);
                break;
        }
 
@@ -1594,7 +1597,7 @@ static int nsc_ircc_pio_write(int iobase, __u8 *buf, int len, int fifo_size)
        int actual = 0;
        __u8 bank;
        
-       IRDA_DEBUG(4, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(4, "%s()\n", __func__);
 
        /* Save current bank */
        bank = inb(iobase+BSR);
@@ -1602,7 +1605,7 @@ static int nsc_ircc_pio_write(int iobase, __u8 *buf, int len, int fifo_size)
        switch_bank(iobase, BANK0);
        if (!(inb_p(iobase+LSR) & LSR_TXEMP)) {
                IRDA_DEBUG(4, "%s(), warning, FIFO not empty yet!\n",
-                          __FUNCTION__);
+                          __func__);
 
                /* FIFO may still be filled to the Tx interrupt threshold */
                fifo_size -= 17;
@@ -1615,7 +1618,7 @@ static int nsc_ircc_pio_write(int iobase, __u8 *buf, int len, int fifo_size)
        }
         
        IRDA_DEBUG(4, "%s(), fifo_size %d ; %d sent of %d\n", 
-                  __FUNCTION__, fifo_size, actual, len);
+                  __func__, fifo_size, actual, len);
        
        /* Restore bank */
        outb(bank, iobase+BSR);
@@ -1636,7 +1639,7 @@ static int nsc_ircc_dma_xmit_complete(struct nsc_ircc_cb *self)
        __u8 bank;
        int ret = TRUE;
 
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
 
        iobase = self->io.fir_base;
 
@@ -1767,7 +1770,7 @@ static int nsc_ircc_dma_receive_complete(struct nsc_ircc_cb *self, int iobase)
                len = inb(iobase+RFLFL) | ((inb(iobase+RFLFH) & 0x1f) << 8);
 
                if (st_fifo->tail >= MAX_RX_WINDOW) {
-                       IRDA_DEBUG(0, "%s(), window is full!\n", __FUNCTION__);
+                       IRDA_DEBUG(0, "%s(), window is full!\n", __func__);
                        continue;
                }
                        
@@ -1859,7 +1862,7 @@ static int nsc_ircc_dma_receive_complete(struct nsc_ircc_cb *self, int iobase)
                        if (skb == NULL)  {
                                IRDA_WARNING("%s(), memory squeeze, "
                                             "dropping frame.\n",
-                                            __FUNCTION__);
+                                            __func__);
                                self->stats.rx_dropped++;
 
                                /* Restore bank register */
@@ -1965,7 +1968,7 @@ static void nsc_ircc_sir_interrupt(struct nsc_ircc_cb *self, int eir)
                 * Need to be after self->io.direction to avoid race with
                 * nsc_ircc_hard_xmit_sir() - Jean II */
                if (self->new_speed) {
-                       IRDA_DEBUG(2, "%s(), Changing speed!\n", __FUNCTION__);
+                       IRDA_DEBUG(2, "%s(), Changing speed!\n", __func__);
                        self->ier = nsc_ircc_change_speed(self,
                                                          self->new_speed);
                        self->new_speed = 0;
@@ -2051,7 +2054,7 @@ static void nsc_ircc_fir_interrupt(struct nsc_ircc_cb *self, int iobase,
                                } else
                                        IRDA_WARNING("%s(), potential "
                                                     "Tx queue lockup !\n",
-                                                    __FUNCTION__);
+                                                    __func__);
                        }
                } else {
                        /*  Not finished yet, so interrupt on DMA again */
@@ -2160,7 +2163,7 @@ static int nsc_ircc_net_open(struct net_device *dev)
        char hwname[32];
        __u8 bank;
        
-       IRDA_DEBUG(4, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(4, "%s()\n", __func__);
        
        IRDA_ASSERT(dev != NULL, return -1;);
        self = (struct nsc_ircc_cb *) dev->priv;
@@ -2222,7 +2225,7 @@ static int nsc_ircc_net_close(struct net_device *dev)
        int iobase;
        __u8 bank;
 
-       IRDA_DEBUG(4, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(4, "%s()\n", __func__);
        
        IRDA_ASSERT(dev != NULL, return -1;);
 
@@ -2276,7 +2279,7 @@ static int nsc_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 
        IRDA_ASSERT(self != NULL, return -1;);
 
-       IRDA_DEBUG(2, "%s(), %s, (cmd=0x%X)\n", __FUNCTION__, dev->name, cmd);
+       IRDA_DEBUG(2, "%s(), %s, (cmd=0x%X)\n", __func__, dev->name, cmd);
        
        switch (cmd) {
        case SIOCSBANDWIDTH: /* Set bandwidth */
index 29398a4..71cd3c5 100644 (file)
@@ -35,6 +35,9 @@
 #include <linux/types.h>
 #include <asm/io.h>
 
+/* Features for chips (set in driver_data) */
+#define NSC_FORCE_DONGLE_TYPE9 0x00000001
+
 /* DMA modes needed */
 #define DMA_TX_MODE     0x08    /* Mem to I/O, ++, demand. */
 #define DMA_RX_MODE     0x04    /* I/O to mem, ++, demand. */
index 8c22c73..75714bc 100644 (file)
@@ -92,7 +92,7 @@ static int old_belkin_open(struct sir_dev *dev)
 {
        struct qos_info *qos = &dev->qos;
 
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
 
        /* Power on dongle */
        sirdev_set_dtr_rts(dev, TRUE, TRUE);
@@ -110,7 +110,7 @@ static int old_belkin_open(struct sir_dev *dev)
 
 static int old_belkin_close(struct sir_dev *dev)
 {
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
 
        /* Power off dongle */
        sirdev_set_dtr_rts(dev, FALSE, FALSE);
@@ -125,7 +125,7 @@ static int old_belkin_close(struct sir_dev *dev)
  */
 static int old_belkin_change_speed(struct sir_dev *dev, unsigned speed)
 {
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
 
        dev->speed = 9600;
        return (speed==dev->speed) ? 0 : -EINVAL;
@@ -139,7 +139,7 @@ static int old_belkin_change_speed(struct sir_dev *dev, unsigned speed)
  */
 static int old_belkin_reset(struct sir_dev *dev)
 {
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
 
        /* This dongles speed "defaults" to 9600 bps ;-) */
        dev->speed = 9600;
index 6078e03..3f32909 100644 (file)
@@ -80,7 +80,7 @@ static int sirdev_tx_complete_fsm(struct sir_dev *dev)
                        return 0;
 
                default:
-                       IRDA_ERROR("%s - undefined state\n", __FUNCTION__);
+                       IRDA_ERROR("%s - undefined state\n", __func__);
                        return -EINVAL;
                }
                fsm->substate = next_state;
@@ -107,11 +107,11 @@ static void sirdev_config_fsm(struct work_struct *work)
        int ret = -1;
        unsigned delay;
 
-       IRDA_DEBUG(2, "%s(), <%ld>\n", __FUNCTION__, jiffies);
+       IRDA_DEBUG(2, "%s(), <%ld>\n", __func__, jiffies);
 
        do {
                IRDA_DEBUG(3, "%s - state=0x%04x / substate=0x%04x\n",
-                       __FUNCTION__, fsm->state, fsm->substate);
+                       __func__, fsm->state, fsm->substate);
 
                next_state = fsm->state;
                delay = 0;
@@ -249,12 +249,12 @@ static void sirdev_config_fsm(struct work_struct *work)
                        break;
 
                default:
-                       IRDA_ERROR("%s - undefined state\n", __FUNCTION__);
+                       IRDA_ERROR("%s - undefined state\n", __func__);
                        fsm->result = -EINVAL;
                        /* fall thru */
 
                case SIRDEV_STATE_ERROR:
-                       IRDA_ERROR("%s - error: %d\n", __FUNCTION__, fsm->result);
+                       IRDA_ERROR("%s - error: %d\n", __func__, fsm->result);
 
 #if 0  /* don't enable this before we have netdev->tx_timeout to recover */
                        netif_stop_queue(dev->netdev);
@@ -284,11 +284,12 @@ int sirdev_schedule_request(struct sir_dev *dev, int initial_state, unsigned par
 {
        struct sir_fsm *fsm = &dev->fsm;
 
-       IRDA_DEBUG(2, "%s - state=0x%04x / param=%u\n", __FUNCTION__, initial_state, param);
+       IRDA_DEBUG(2, "%s - state=0x%04x / param=%u\n", __func__,
+                       initial_state, param);
 
        if (down_trylock(&fsm->sem)) {
                if (in_interrupt()  ||  in_atomic()  ||  irqs_disabled()) {
-                       IRDA_DEBUG(1, "%s(), state machine busy!\n", __FUNCTION__);
+                       IRDA_DEBUG(1, "%s(), state machine busy!\n", __func__);
                        return -EWOULDBLOCK;
                } else
                        down(&fsm->sem);
@@ -296,7 +297,7 @@ int sirdev_schedule_request(struct sir_dev *dev, int initial_state, unsigned par
 
        if (fsm->state == SIRDEV_STATE_DEAD) {
                /* race with sirdev_close should never happen */
-               IRDA_ERROR("%s(), instance staled!\n", __FUNCTION__);
+               IRDA_ERROR("%s(), instance staled!\n", __func__);
                up(&fsm->sem);
                return -ESTALE;         /* or better EPIPE? */
        }
@@ -341,7 +342,7 @@ int sirdev_set_dongle(struct sir_dev *dev, IRDA_DONGLE type)
 {
        int err;
 
-       IRDA_DEBUG(3, "%s : requesting dongle %d.\n", __FUNCTION__, type);
+       IRDA_DEBUG(3, "%s : requesting dongle %d.\n", __func__, type);
 
        err = sirdev_schedule_dongle_open(dev, type);
        if (unlikely(err))
@@ -376,7 +377,7 @@ int sirdev_raw_write(struct sir_dev *dev, const char *buf, int len)
 
        ret = dev->drv->do_write(dev, dev->tx_buff.data, dev->tx_buff.len);
        if (ret > 0) {
-               IRDA_DEBUG(3, "%s(), raw-tx started\n", __FUNCTION__);
+               IRDA_DEBUG(3, "%s(), raw-tx started\n", __func__);
 
                dev->tx_buff.data += ret;
                dev->tx_buff.len -= ret;
@@ -437,7 +438,7 @@ void sirdev_write_complete(struct sir_dev *dev)
        spin_lock_irqsave(&dev->tx_lock, flags);
 
        IRDA_DEBUG(3, "%s() - dev->tx_buff.len = %d\n",
-                  __FUNCTION__, dev->tx_buff.len);
+                  __func__, dev->tx_buff.len);
 
        if (likely(dev->tx_buff.len > 0))  {
                /* Write data left in transmit buffer */
@@ -450,7 +451,7 @@ void sirdev_write_complete(struct sir_dev *dev)
                else if (unlikely(actual<0)) {
                        /* could be dropped later when we have tx_timeout to recover */
                        IRDA_ERROR("%s: drv->do_write failed (%d)\n",
-                                  __FUNCTION__, actual);
+                                  __func__, actual);
                        if ((skb=dev->tx_skb) != NULL) {
                                dev->tx_skb = NULL;
                                dev_kfree_skb_any(skb);
@@ -471,7 +472,7 @@ void sirdev_write_complete(struct sir_dev *dev)
                 * restarted when the irda-thread has completed the request.
                 */
 
-               IRDA_DEBUG(3, "%s(), raw-tx done\n", __FUNCTION__);
+               IRDA_DEBUG(3, "%s(), raw-tx done\n", __func__);
                dev->raw_tx = 0;
                goto done;      /* no post-frame handling in raw mode */
        }
@@ -488,7 +489,7 @@ void sirdev_write_complete(struct sir_dev *dev)
         * re-activated.
         */
 
-       IRDA_DEBUG(5, "%s(), finished with frame!\n", __FUNCTION__);
+       IRDA_DEBUG(5, "%s(), finished with frame!\n", __func__);
                
        if ((skb=dev->tx_skb) != NULL) {
                dev->tx_skb = NULL;
@@ -498,14 +499,14 @@ void sirdev_write_complete(struct sir_dev *dev)
        }
 
        if (unlikely(dev->new_speed > 0)) {
-               IRDA_DEBUG(5, "%s(), Changing speed!\n", __FUNCTION__);
+               IRDA_DEBUG(5, "%s(), Changing speed!\n", __func__);
                err = sirdev_schedule_speed(dev, dev->new_speed);
                if (unlikely(err)) {
                        /* should never happen
                         * forget the speed change and hope the stack recovers
                         */
                        IRDA_ERROR("%s - schedule speed change failed: %d\n",
-                                  __FUNCTION__, err);
+                                  __func__, err);
                        netif_wake_queue(dev->netdev);
                }
                /* else: success
@@ -532,13 +533,13 @@ EXPORT_SYMBOL(sirdev_write_complete);
 int sirdev_receive(struct sir_dev *dev, const unsigned char *cp, size_t count) 
 {
        if (!dev || !dev->netdev) {
-               IRDA_WARNING("%s(), not ready yet!\n", __FUNCTION__);
+               IRDA_WARNING("%s(), not ready yet!\n", __func__);
                return -1;
        }
 
        if (!dev->irlap) {
                IRDA_WARNING("%s - too early: %p / %zd!\n",
-                            __FUNCTION__, cp, count);
+                            __func__, cp, count);
                return -1;
        }
 
@@ -548,7 +549,7 @@ int sirdev_receive(struct sir_dev *dev, const unsigned char *cp, size_t count)
                 */
                irda_device_set_media_busy(dev->netdev, TRUE);
                dev->stats.rx_dropped++;
-               IRDA_DEBUG(0, "%s; rx-drop: %zd\n", __FUNCTION__, count);
+               IRDA_DEBUG(0, "%s; rx-drop: %zd\n", __func__, count);
                return 0;
        }
 
@@ -600,7 +601,7 @@ static int sirdev_hard_xmit(struct sk_buff *skb, struct net_device *ndev)
 
        netif_stop_queue(ndev);
 
-       IRDA_DEBUG(3, "%s(), skb->len = %d\n", __FUNCTION__, skb->len);
+       IRDA_DEBUG(3, "%s(), skb->len = %d\n", __func__, skb->len);
 
        speed = irda_get_next_speed(skb);
        if ((speed != dev->speed) && (speed != -1)) {
@@ -637,7 +638,7 @@ static int sirdev_hard_xmit(struct sk_buff *skb, struct net_device *ndev)
 
        /* Check problems */
        if(spin_is_locked(&dev->tx_lock)) {
-               IRDA_DEBUG(3, "%s(), write not completed\n", __FUNCTION__);
+               IRDA_DEBUG(3, "%s(), write not completed\n", __func__);
        }
 
        /* serialize with write completion */
@@ -666,7 +667,7 @@ static int sirdev_hard_xmit(struct sk_buff *skb, struct net_device *ndev)
        else if (unlikely(actual < 0)) {
                /* could be dropped later when we have tx_timeout to recover */
                IRDA_ERROR("%s: drv->do_write failed (%d)\n",
-                          __FUNCTION__, actual);
+                          __func__, actual);
                dev_kfree_skb_any(skb);
                dev->stats.tx_errors++;               
                dev->stats.tx_dropped++;                      
@@ -687,7 +688,7 @@ static int sirdev_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)
 
        IRDA_ASSERT(dev != NULL, return -1;);
 
-       IRDA_DEBUG(3, "%s(), %s, (cmd=0x%X)\n", __FUNCTION__, ndev->name, cmd);
+       IRDA_DEBUG(3, "%s(), %s, (cmd=0x%X)\n", __func__, ndev->name, cmd);
        
        switch (cmd) {
        case SIOCSBANDWIDTH: /* Set bandwidth */
@@ -804,7 +805,7 @@ static int sirdev_open(struct net_device *ndev)
        if (!try_module_get(drv->owner))
                return -ESTALE;
 
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
 
        if (sirdev_alloc_buffers(dev))
                goto errout_dec;
@@ -822,7 +823,7 @@ static int sirdev_open(struct net_device *ndev)
 
        netif_wake_queue(ndev);
 
-       IRDA_DEBUG(2, "%s - done, speed = %d\n", __FUNCTION__, dev->speed);
+       IRDA_DEBUG(2, "%s - done, speed = %d\n", __func__, dev->speed);
 
        return 0;
 
@@ -842,7 +843,7 @@ static int sirdev_close(struct net_device *ndev)
        struct sir_dev *dev = ndev->priv;
        const struct sir_driver *drv;
 
-//     IRDA_DEBUG(0, "%s\n", __FUNCTION__);
+//     IRDA_DEBUG(0, "%s\n", __func__);
 
        netif_stop_queue(ndev);
 
@@ -878,7 +879,7 @@ struct sir_dev * sirdev_get_instance(const struct sir_driver *drv, const char *n
        struct net_device *ndev;
        struct sir_dev *dev;
 
-       IRDA_DEBUG(0, "%s - %s\n", __FUNCTION__, name);
+       IRDA_DEBUG(0, "%s - %s\n", __func__, name);
 
        /* instead of adding tests to protect against drv->do_write==NULL
         * at several places we refuse to create a sir_dev instance for
@@ -892,7 +893,7 @@ struct sir_dev * sirdev_get_instance(const struct sir_driver *drv, const char *n
         */
        ndev = alloc_irdadev(sizeof(*dev));
        if (ndev == NULL) {
-               IRDA_ERROR("%s - Can't allocate memory for IrDA control block!\n", __FUNCTION__);
+               IRDA_ERROR("%s - Can't allocate memory for IrDA control block!\n", __func__);
                goto out;
        }
        dev = ndev->priv;
@@ -921,7 +922,7 @@ struct sir_dev * sirdev_get_instance(const struct sir_driver *drv, const char *n
        ndev->do_ioctl = sirdev_ioctl;
 
        if (register_netdev(ndev)) {
-               IRDA_ERROR("%s(), register_netdev() failed!\n", __FUNCTION__);
+               IRDA_ERROR("%s(), register_netdev() failed!\n", __func__);
                goto out_freenetdev;
        }
 
@@ -938,7 +939,7 @@ int sirdev_put_instance(struct sir_dev *dev)
 {
        int err = 0;
 
-       IRDA_DEBUG(0, "%s\n", __FUNCTION__);
+       IRDA_DEBUG(0, "%s\n", __func__);
 
        atomic_set(&dev->enable_rx, 0);
 
@@ -948,7 +949,7 @@ int sirdev_put_instance(struct sir_dev *dev)
        if (dev->dongle_drv)
                err = sirdev_schedule_dongle_close(dev);
        if (err)
-               IRDA_ERROR("%s - error %d\n", __FUNCTION__, err);
+               IRDA_ERROR("%s - error %d\n", __func__, err);
 
        sirdev_close(dev->netdev);
 
index 25d5b8a..3603024 100644 (file)
@@ -36,7 +36,7 @@ int irda_register_dongle(struct dongle_driver *new)
        struct dongle_driver *drv;
 
        IRDA_DEBUG(0, "%s : registering dongle \"%s\" (%d).\n",
-                  __FUNCTION__, new->driver_name, new->type);
+                  __func__, new->driver_name, new->type);
 
        mutex_lock(&dongle_list_lock);
        list_for_each(entry, &dongle_list) {
index 78dc8e7..b5360fe 100644 (file)
@@ -460,7 +460,7 @@ static int __init smsc_ircc_init(void)
 {
        int ret;
 
-       IRDA_DEBUG(1, "%s\n", __FUNCTION__);
+       IRDA_DEBUG(1, "%s\n", __func__);
 
        ret = platform_driver_register(&smsc_ircc_driver);
        if (ret) {
@@ -500,7 +500,7 @@ static int __init smsc_ircc_open(unsigned int fir_base, unsigned int sir_base, u
        struct net_device *dev;
        int err;
 
-       IRDA_DEBUG(1, "%s\n", __FUNCTION__);
+       IRDA_DEBUG(1, "%s\n", __func__);
 
        err = smsc_ircc_present(fir_base, sir_base);
        if (err)
@@ -508,7 +508,7 @@ static int __init smsc_ircc_open(unsigned int fir_base, unsigned int sir_base, u
 
        err = -ENOMEM;
        if (dev_count >= ARRAY_SIZE(dev_self)) {
-               IRDA_WARNING("%s(), too many devices!\n", __FUNCTION__);
+               IRDA_WARNING("%s(), too many devices!\n", __func__);
                goto err_out1;
        }
 
@@ -517,7 +517,7 @@ static int __init smsc_ircc_open(unsigned int fir_base, unsigned int sir_base, u
         */
        dev = alloc_irdadev(sizeof(struct smsc_ircc_cb));
        if (!dev) {
-               IRDA_WARNING("%s() can't allocate net device\n", __FUNCTION__);
+               IRDA_WARNING("%s() can't allocate net device\n", __func__);
                goto err_out1;
        }
 
@@ -633,14 +633,14 @@ static int smsc_ircc_present(unsigned int fir_base, unsigned int sir_base)
        if (!request_region(fir_base, SMSC_IRCC2_FIR_CHIP_IO_EXTENT,
                            driver_name)) {
                IRDA_WARNING("%s: can't get fir_base of 0x%03x\n",
-                            __FUNCTION__, fir_base);
+                            __func__, fir_base);
                goto out1;
        }
 
        if (!request_region(sir_base, SMSC_IRCC2_SIR_CHIP_IO_EXTENT,
                            driver_name)) {
                IRDA_WARNING("%s: can't get sir_base of 0x%03x\n",
-                            __FUNCTION__, sir_base);
+                            __func__, sir_base);
                goto out2;
        }
 
@@ -656,7 +656,7 @@ static int smsc_ircc_present(unsigned int fir_base, unsigned int sir_base)
 
        if (high != 0x10 || low != 0xb8 || (chip != 0xf1 && chip != 0xf2)) {
                IRDA_WARNING("%s(), addr 0x%04x - no device found!\n",
-                            __FUNCTION__, fir_base);
+                            __func__, fir_base);
                goto out3;
        }
        IRDA_MESSAGE("SMsC IrDA Controller found\n IrCC version %d.%d, "
@@ -793,7 +793,7 @@ static int smsc_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd
 
        IRDA_ASSERT(self != NULL, return -1;);
 
-       IRDA_DEBUG(2, "%s(), %s, (cmd=0x%X)\n", __FUNCTION__, dev->name, cmd);
+       IRDA_DEBUG(2, "%s(), %s, (cmd=0x%X)\n", __func__, dev->name, cmd);
 
        switch (cmd) {
        case SIOCSBANDWIDTH: /* Set bandwidth */
@@ -878,7 +878,7 @@ int smsc_ircc_hard_xmit_sir(struct sk_buff *skb, struct net_device *dev)
        unsigned long flags;
        s32 speed;
 
-       IRDA_DEBUG(1, "%s\n", __FUNCTION__);
+       IRDA_DEBUG(1, "%s\n", __func__);
 
        IRDA_ASSERT(dev != NULL, return 0;);
 
@@ -953,21 +953,21 @@ static void smsc_ircc_set_fir_speed(struct smsc_ircc_cb *self, u32 speed)
                ir_mode = IRCC_CFGA_IRDA_HDLC;
                ctrl = IRCC_CRC;
                fast = 0;
-               IRDA_DEBUG(0, "%s(), handling baud of 576000\n", __FUNCTION__);
+               IRDA_DEBUG(0, "%s(), handling baud of 576000\n", __func__);
                break;
        case 1152000:
                ir_mode = IRCC_CFGA_IRDA_HDLC;
                ctrl = IRCC_1152 | IRCC_CRC;
                fast = IRCC_LCR_A_FAST | IRCC_LCR_A_GP_DATA;
                IRDA_DEBUG(0, "%s(), handling baud of 1152000\n",
-                          __FUNCTION__);
+                          __func__);
                break;
        case 4000000:
                ir_mode = IRCC_CFGA_IRDA_4PPM;
                ctrl = IRCC_CRC;
                fast = IRCC_LCR_A_FAST;
                IRDA_DEBUG(0, "%s(), handling baud of 4000000\n",
-                          __FUNCTION__);
+                          __func__);
                break;
        }
        #if 0
@@ -995,7 +995,7 @@ static void smsc_ircc_fir_start(struct smsc_ircc_cb *self)
        struct net_device *dev;
        int fir_base;
 
-       IRDA_DEBUG(1, "%s\n", __FUNCTION__);
+       IRDA_DEBUG(1, "%s\n", __func__);
 
        IRDA_ASSERT(self != NULL, return;);
        dev = self->netdev;
@@ -1043,7 +1043,7 @@ static void smsc_ircc_fir_stop(struct smsc_ircc_cb *self)
 {
        int fir_base;
 
-       IRDA_DEBUG(1, "%s\n", __FUNCTION__);
+       IRDA_DEBUG(1, "%s\n", __func__);
 
        IRDA_ASSERT(self != NULL, return;);
 
@@ -1067,7 +1067,7 @@ static void smsc_ircc_change_speed(struct smsc_ircc_cb *self, u32 speed)
        struct net_device *dev;
        int last_speed_was_sir;
 
-       IRDA_DEBUG(0, "%s() changing speed to: %d\n", __FUNCTION__, speed);
+       IRDA_DEBUG(0, "%s() changing speed to: %d\n", __func__, speed);
 
        IRDA_ASSERT(self != NULL, return;);
        dev = self->netdev;
@@ -1135,7 +1135,7 @@ void smsc_ircc_set_sir_speed(struct smsc_ircc_cb *self, __u32 speed)
        int lcr;    /* Line control reg */
        int divisor;
 
-       IRDA_DEBUG(0, "%s(), Setting speed to: %d\n", __FUNCTION__, speed);
+       IRDA_DEBUG(0, "%s(), Setting speed to: %d\n", __func__, speed);
 
        IRDA_ASSERT(self != NULL, return;);
        iobase = self->io.sir_base;
@@ -1170,7 +1170,7 @@ void smsc_ircc_set_sir_speed(struct smsc_ircc_cb *self, __u32 speed)
        /* Turn on interrups */
        outb(UART_IER_RLSI | UART_IER_RDI | UART_IER_THRI, iobase + UART_IER);
 
-       IRDA_DEBUG(2, "%s() speed changed to: %d\n", __FUNCTION__, speed);
+       IRDA_DEBUG(2, "%s() speed changed to: %d\n", __func__, speed);
 }
 
 
@@ -1253,7 +1253,7 @@ static void smsc_ircc_dma_xmit(struct smsc_ircc_cb *self, int bofs)
        int iobase = self->io.fir_base;
        u8 ctrl;
 
-       IRDA_DEBUG(3, "%s\n", __FUNCTION__);
+       IRDA_DEBUG(3, "%s\n", __func__);
 #if 1
        /* Disable Rx */
        register_bank(iobase, 0);
@@ -1307,7 +1307,7 @@ static void smsc_ircc_dma_xmit_complete(struct smsc_ircc_cb *self)
 {
        int iobase = self->io.fir_base;
 
-       IRDA_DEBUG(3, "%s\n", __FUNCTION__);
+       IRDA_DEBUG(3, "%s\n", __func__);
 #if 0
        /* Disable Tx */
        register_bank(iobase, 0);
@@ -1411,7 +1411,7 @@ static void smsc_ircc_dma_receive_complete(struct smsc_ircc_cb *self)
 
        register_bank(iobase, 0);
 
-       IRDA_DEBUG(3, "%s\n", __FUNCTION__);
+       IRDA_DEBUG(3, "%s\n", __func__);
 #if 0
        /* Disable Rx */
        register_bank(iobase, 0);
@@ -1422,7 +1422,7 @@ static void smsc_ircc_dma_receive_complete(struct smsc_ircc_cb *self)
        lsr= inb(iobase + IRCC_LSR);
        msgcnt = inb(iobase + IRCC_LCR_B) & 0x08;
 
-       IRDA_DEBUG(2, "%s: dma count = %d\n", __FUNCTION__,
+       IRDA_DEBUG(2, "%s: dma count = %d\n", __func__,
                   get_dma_residue(self->io.dma));
 
        len = self->rx_buff.truesize - get_dma_residue(self->io.dma);
@@ -1445,15 +1445,15 @@ static void smsc_ircc_dma_receive_complete(struct smsc_ircc_cb *self)
        len -= self->io.speed < 4000000 ? 2 : 4;
 
        if (len < 2 || len > 2050) {
-               IRDA_WARNING("%s(), bogus len=%d\n", __FUNCTION__, len);
+               IRDA_WARNING("%s(), bogus len=%d\n", __func__, len);
                return;
        }
-       IRDA_DEBUG(2, "%s: msgcnt = %d, len=%d\n", __FUNCTION__, msgcnt, len);
+       IRDA_DEBUG(2, "%s: msgcnt = %d, len=%d\n", __func__, msgcnt, len);
 
        skb = dev_alloc_skb(len + 1);
        if (!skb) {
                IRDA_WARNING("%s(), memory squeeze, dropping frame.\n",
-                            __FUNCTION__);
+                            __func__);
                return;
        }
        /* Make sure IP header gets aligned */
@@ -1494,7 +1494,7 @@ static void smsc_ircc_sir_receive(struct smsc_ircc_cb *self)
 
                /* Make sure we don't stay here to long */
                if (boguscount++ > 32) {
-                       IRDA_DEBUG(2, "%s(), breaking!\n", __FUNCTION__);
+                       IRDA_DEBUG(2, "%s(), breaking!\n", __func__);
                        break;
                }
        } while (inb(iobase + UART_LSR) & UART_LSR_DR);
@@ -1536,7 +1536,7 @@ static irqreturn_t smsc_ircc_interrupt(int dummy, void *dev_id)
        lcra = inb(iobase + IRCC_LCR_A);
        lsr = inb(iobase + IRCC_LSR);
 
-       IRDA_DEBUG(2, "%s(), iir = 0x%02x\n", __FUNCTION__, iir);
+       IRDA_DEBUG(2, "%s(), iir = 0x%02x\n", __func__, iir);
 
        if (iir & IRCC_IIR_EOM) {
                if (self->io.direction == IO_RECV)
@@ -1548,7 +1548,7 @@ static irqreturn_t smsc_ircc_interrupt(int dummy, void *dev_id)
        }
 
        if (iir & IRCC_IIR_ACTIVE_FRAME) {
-               /*printk(KERN_WARNING "%s(): Active Frame\n", __FUNCTION__);*/
+               /*printk(KERN_WARNING "%s(): Active Frame\n", __func__);*/
        }
 
        /* Enable interrupts again */
@@ -1587,11 +1587,11 @@ static irqreturn_t smsc_ircc_interrupt_sir(struct net_device *dev)
                lsr = inb(iobase + UART_LSR);
 
                IRDA_DEBUG(4, "%s(), iir=%02x, lsr=%02x, iobase=%#x\n",
-                           __FUNCTION__, iir, lsr, iobase);
+                           __func__, iir, lsr, iobase);
 
                switch (iir) {
                case UART_IIR_RLSI:
-                       IRDA_DEBUG(2, "%s(), RLSI\n", __FUNCTION__);
+                       IRDA_DEBUG(2, "%s(), RLSI\n", __func__);
                        break;
                case UART_IIR_RDI:
                        /* Receive interrupt */
@@ -1604,7 +1604,7 @@ static irqreturn_t smsc_ircc_interrupt_sir(struct net_device *dev)
                        break;
                default:
                        IRDA_DEBUG(0, "%s(), unhandled IIR=%#x\n",
-                                  __FUNCTION__, iir);
+                                  __func__, iir);
                        break;
                }
 
@@ -1631,11 +1631,11 @@ static int ircc_is_receiving(struct smsc_ircc_cb *self)
        int status = FALSE;
        /* int iobase; */
 
-       IRDA_DEBUG(1, "%s\n", __FUNCTION__);
+       IRDA_DEBUG(1, "%s\n", __func__);
 
        IRDA_ASSERT(self != NULL, return FALSE;);
 
-       IRDA_DEBUG(0, "%s: dma count = %d\n", __FUNCTION__,
+       IRDA_DEBUG(0, "%s: dma count = %d\n", __func__,
                   get_dma_residue(self->io.dma));
 
        status = (self->rx_buff.state != OUTSIDE_FRAME);
@@ -1652,7 +1652,7 @@ static int smsc_ircc_request_irq(struct smsc_ircc_cb *self)
                            self->netdev->name, self->netdev);
        if (error)
                IRDA_DEBUG(0, "%s(), unable to allocate irq=%d, err=%d\n",
-                          __FUNCTION__, self->io.irq, error);
+                          __func__, self->io.irq, error);
 
        return error;
 }
@@ -1696,21 +1696,21 @@ static int smsc_ircc_net_open(struct net_device *dev)
        struct smsc_ircc_cb *self;
        char hwname[16];
 
-       IRDA_DEBUG(1, "%s\n", __FUNCTION__);
+       IRDA_DEBUG(1, "%s\n", __func__);
 
        IRDA_ASSERT(dev != NULL, return -1;);
        self = netdev_priv(dev);
        IRDA_ASSERT(self != NULL, return 0;);
 
        if (self->io.suspended) {
-               IRDA_DEBUG(0, "%s(), device is suspended\n", __FUNCTION__);
+               IRDA_DEBUG(0, "%s(), device is suspended\n", __func__);
                return -EAGAIN;
        }
 
        if (request_irq(self->io.irq, smsc_ircc_interrupt, 0, dev->name,
                        (void *) dev)) {
                IRDA_DEBUG(0, "%s(), unable to allocate irq=%d\n",
-                          __FUNCTION__, self->io.irq);
+                          __func__, self->io.irq);
                return -EAGAIN;
        }
 
@@ -1734,7 +1734,7 @@ static int smsc_ircc_net_open(struct net_device *dev)
                smsc_ircc_net_close(dev);
 
                IRDA_WARNING("%s(), unable to allocate DMA=%d\n",
-                            __FUNCTION__, self->io.dma);
+                            __func__, self->io.dma);
                return -EAGAIN;
        }
 
@@ -1753,7 +1753,7 @@ static int smsc_ircc_net_close(struct net_device *dev)
 {
        struct smsc_ircc_cb *self;
 
-       IRDA_DEBUG(1, "%s\n", __FUNCTION__);
+       IRDA_DEBUG(1, "%s\n", __func__);
 
        IRDA_ASSERT(dev != NULL, return -1;);
        self = netdev_priv(dev);
@@ -1836,7 +1836,7 @@ static int smsc_ircc_resume(struct platform_device *dev)
  */
 static int __exit smsc_ircc_close(struct smsc_ircc_cb *self)
 {
-       IRDA_DEBUG(1, "%s\n", __FUNCTION__);
+       IRDA_DEBUG(1, "%s\n", __func__);
 
        IRDA_ASSERT(self != NULL, return -1;);
 
@@ -1848,12 +1848,12 @@ static int __exit smsc_ircc_close(struct smsc_ircc_cb *self)
        smsc_ircc_stop_interrupts(self);
 
        /* Release the PORTS that this driver is using */
-       IRDA_DEBUG(0, "%s(), releasing 0x%03x\n",  __FUNCTION__,
+       IRDA_DEBUG(0, "%s(), releasing 0x%03x\n",  __func__,
                   self->io.fir_base);
 
        release_region(self->io.fir_base, self->io.fir_ext);
 
-       IRDA_DEBUG(0, "%s(), releasing 0x%03x\n", __FUNCTION__,
+       IRDA_DEBUG(0, "%s(), releasing 0x%03x\n", __func__,
                   self->io.sir_base);
 
        release_region(self->io.sir_base, self->io.sir_ext);
@@ -1875,7 +1875,7 @@ static void __exit smsc_ircc_cleanup(void)
 {
        int i;
 
-       IRDA_DEBUG(1, "%s\n", __FUNCTION__);
+       IRDA_DEBUG(1, "%s\n", __func__);
 
        for (i = 0; i < 2; i++) {
                if (dev_self[i])
@@ -1899,7 +1899,7 @@ void smsc_ircc_sir_start(struct smsc_ircc_cb *self)
        struct net_device *dev;
        int fir_base, sir_base;
 
-       IRDA_DEBUG(3, "%s\n", __FUNCTION__);
+       IRDA_DEBUG(3, "%s\n", __func__);
 
        IRDA_ASSERT(self != NULL, return;);
        dev = self->netdev;
@@ -1926,7 +1926,7 @@ void smsc_ircc_sir_start(struct smsc_ircc_cb *self)
        /* Turn on interrups */
        outb(UART_IER_RLSI | UART_IER_RDI |UART_IER_THRI, sir_base + UART_IER);
 
-       IRDA_DEBUG(3, "%s() - exit\n", __FUNCTION__);
+       IRDA_DEBUG(3, "%s() - exit\n", __func__);
 
        outb(0x00, fir_base + IRCC_MASTER);
 }
@@ -1936,7 +1936,7 @@ void smsc_ircc_sir_stop(struct smsc_ircc_cb *self)
 {
        int iobase;
 
-       IRDA_DEBUG(3, "%s\n", __FUNCTION__);
+       IRDA_DEBUG(3, "%s\n", __func__);
        iobase = self->io.sir_base;
 
        /* Reset UART */
@@ -1962,7 +1962,7 @@ static void smsc_ircc_sir_write_wakeup(struct smsc_ircc_cb *self)
 
        IRDA_ASSERT(self != NULL, return;);
 
-       IRDA_DEBUG(4, "%s\n", __FUNCTION__);
+       IRDA_DEBUG(4, "%s\n", __func__);
 
        iobase = self->io.sir_base;
 
@@ -1984,7 +1984,7 @@ static void smsc_ircc_sir_write_wakeup(struct smsc_ircc_cb *self)
                 */
                if (self->new_speed) {
                        IRDA_DEBUG(5, "%s(), Changing speed to %d.\n",
-                                  __FUNCTION__, self->new_speed);
+                                  __func__, self->new_speed);
                        smsc_ircc_sir_wait_hw_transmitter_finish(self);
                        smsc_ircc_change_speed(self, self->new_speed);
                        self->new_speed = 0;
@@ -2023,7 +2023,7 @@ static int smsc_ircc_sir_write(int iobase, int fifo_size, __u8 *buf, int len)
 
        /* Tx FIFO should be empty! */
        if (!(inb(iobase + UART_LSR) & UART_LSR_THRE)) {
-               IRDA_WARNING("%s(), failed, fifo not empty!\n", __FUNCTION__);
+               IRDA_WARNING("%s(), failed, fifo not empty!\n", __func__);
                return 0;
        }
 
@@ -2123,7 +2123,7 @@ static void smsc_ircc_sir_wait_hw_transmitter_finish(struct smsc_ircc_cb *self)
                udelay(1);
 
        if (count == 0)
-               IRDA_DEBUG(0, "%s(): stuck transmitter\n", __FUNCTION__);
+               IRDA_DEBUG(0, "%s(): stuck transmitter\n", __func__);
 }
 
 
@@ -2145,7 +2145,7 @@ static int __init smsc_ircc_look_for_chips(void)
        while (address->cfg_base) {
                cfg_base = address->cfg_base;
 
-               /*printk(KERN_WARNING "%s(): probing: 0x%02x for: 0x%02x\n", __FUNCTION__, cfg_base, address->type);*/
+               /*printk(KERN_WARNING "%s(): probing: 0x%02x for: 0x%02x\n", __func__, cfg_base, address->type);*/
 
                if (address->type & SMSCSIO_TYPE_FDC) {
                        type = "FDC";
@@ -2184,7 +2184,7 @@ static int __init smsc_superio_flat(const struct smsc_chip *chips, unsigned shor
        u8 mode, dma, irq;
        int ret = -ENODEV;
 
-       IRDA_DEBUG(1, "%s\n", __FUNCTION__);
+       IRDA_DEBUG(1, "%s\n", __func__);
 
        if (smsc_ircc_probe(cfgbase, SMSCSIOFLAT_DEVICEID_REG, chips, type) == NULL)
                return ret;
@@ -2192,10 +2192,10 @@ static int __init smsc_superio_flat(const struct smsc_chip *chips, unsigned shor
        outb(SMSCSIOFLAT_UARTMODE0C_REG, cfgbase);
        mode = inb(cfgbase + 1);
 
-       /*printk(KERN_WARNING "%s(): mode: 0x%02x\n", __FUNCTION__, mode);*/
+       /*printk(KERN_WARNING "%s(): mode: 0x%02x\n", __func__, mode);*/
 
        if (!(mode & SMSCSIOFLAT_UART2MODE_VAL_IRDA))
-               IRDA_WARNING("%s(): IrDA not enabled\n", __FUNCTION__);
+               IRDA_WARNING("%s(): IrDA not enabled\n", __func__);
 
        outb(SMSCSIOFLAT_UART2BASEADDR_REG, cfgbase);
        sirbase = inb(cfgbase + 1) << 2;
@@ -2212,7 +2212,7 @@ static int __init smsc_superio_flat(const struct smsc_chip *chips, unsigned shor
        outb(SMSCSIOFLAT_UARTIRQSELECT_REG, cfgbase);
        irq = inb(cfgbase + 1) & SMSCSIOFLAT_UART2IRQSELECT_MASK;
 
-       IRDA_MESSAGE("%s(): fir: 0x%02x, sir: 0x%02x, dma: %02d, irq: %d, mode: 0x%02x\n", __FUNCTION__, firbase, sirbase, dma, irq, mode);
+       IRDA_MESSAGE("%s(): fir: 0x%02x, sir: 0x%02x, dma: %02d, irq: %d, mode: 0x%02x\n", __func__, firbase, sirbase, dma, irq, mode);
 
        if (firbase && smsc_ircc_open(firbase, sirbase, dma, irq) == 0)
                ret = 0;
@@ -2234,7 +2234,7 @@ static int __init smsc_superio_paged(const struct smsc_chip *chips, unsigned sho
        unsigned short fir_io, sir_io;
        int ret = -ENODEV;
 
-       IRDA_DEBUG(1, "%s\n", __FUNCTION__);
+       IRDA_DEBUG(1, "%s\n", __func__);
 
        if (smsc_ircc_probe(cfg_base, 0x20, chips, type) == NULL)
                return ret;
@@ -2268,7 +2268,7 @@ static int __init smsc_superio_paged(const struct smsc_chip *chips, unsigned sho
 
 static int __init smsc_access(unsigned short cfg_base, unsigned char reg)
 {
-       IRDA_DEBUG(1, "%s\n", __FUNCTION__);
+       IRDA_DEBUG(1, "%s\n", __func__);
 
        outb(reg, cfg_base);
        return inb(cfg_base) != reg ? -1 : 0;
@@ -2278,7 +2278,7 @@ static const struct smsc_chip * __init smsc_ircc_probe(unsigned short cfg_base,
 {
        u8 devid, xdevid, rev;
 
-       IRDA_DEBUG(1, "%s\n", __FUNCTION__);
+       IRDA_DEBUG(1, "%s\n", __func__);
 
        /* Leave configuration */
 
@@ -2353,7 +2353,7 @@ static int __init smsc_superio_fdc(unsigned short cfg_base)
 
        if (!request_region(cfg_base, 2, driver_name)) {
                IRDA_WARNING("%s: can't get cfg_base of 0x%03x\n",
-                            __FUNCTION__, cfg_base);
+                            __func__, cfg_base);
        } else {
                if (!smsc_superio_flat(fdc_chips_flat, cfg_base, "FDC") ||
                    !smsc_superio_paged(fdc_chips_paged, cfg_base, "FDC"))
@@ -2371,7 +2371,7 @@ static int __init smsc_superio_lpc(unsigned short cfg_base)
 
        if (!request_region(cfg_base, 2, driver_name)) {
                IRDA_WARNING("%s: can't get cfg_base of 0x%03x\n",
-                            __FUNCTION__, cfg_base);
+                            __func__, cfg_base);
        } else {
                if (!smsc_superio_flat(lpc_chips_flat, cfg_base, "LPC") ||
                    !smsc_superio_paged(lpc_chips_paged, cfg_base, "LPC"))
@@ -2932,7 +2932,7 @@ static void smsc_ircc_set_transceiver_smsc_ircc_atc(int fir_base, u32 speed)
                /* empty */;
 
        if (val)
-               IRDA_WARNING("%s(): ATC: 0x%02x\n", __FUNCTION__,
+               IRDA_WARNING("%s(): ATC: 0x%02x\n", __func__,
                             inb(fir_base + IRCC_ATC));
 }
 
index d1ce5ae..048a154 100644 (file)
@@ -77,7 +77,7 @@ static int tekram_open(struct sir_dev *dev)
 {
        struct qos_info *qos = &dev->qos;
 
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
 
        sirdev_set_dtr_rts(dev, TRUE, TRUE);
 
@@ -92,7 +92,7 @@ static int tekram_open(struct sir_dev *dev)
 
 static int tekram_close(struct sir_dev *dev)
 {
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
 
        /* Power off dongle */
        sirdev_set_dtr_rts(dev, FALSE, FALSE);
@@ -130,7 +130,7 @@ static int tekram_change_speed(struct sir_dev *dev, unsigned speed)
        u8 byte;
        static int ret = 0;
        
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
 
        switch(state) {
        case SIRDEV_STATE_DONGLE_SPEED:
@@ -179,7 +179,7 @@ static int tekram_change_speed(struct sir_dev *dev, unsigned speed)
                break;
 
        default:
-               IRDA_ERROR("%s - undefined state %d\n", __FUNCTION__, state);
+               IRDA_ERROR("%s - undefined state %d\n", __func__, state);
                ret = -EINVAL;
                break;
        }
@@ -204,7 +204,7 @@ static int tekram_change_speed(struct sir_dev *dev, unsigned speed)
 
 static int tekram_reset(struct sir_dev *dev)
 {
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
 
        /* Clear DTR, Set RTS */
        sirdev_set_dtr_rts(dev, FALSE, TRUE); 
index aa1a9b0..fcf287b 100644 (file)
@@ -181,7 +181,7 @@ static int toim3232_open(struct sir_dev *dev)
 {
        struct qos_info *qos = &dev->qos;
 
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
 
        /* Pull the lines high to start with.
         *
@@ -209,7 +209,7 @@ static int toim3232_open(struct sir_dev *dev)
 
 static int toim3232_close(struct sir_dev *dev)
 {
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
 
        /* Power off dongle */
        sirdev_set_dtr_rts(dev, FALSE, FALSE);
@@ -241,7 +241,7 @@ static int toim3232_change_speed(struct sir_dev *dev, unsigned speed)
        u8 byte;
        static int ret = 0;
 
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
 
        switch(state) {
        case SIRDEV_STATE_DONGLE_SPEED:
@@ -299,7 +299,7 @@ static int toim3232_change_speed(struct sir_dev *dev, unsigned speed)
                break;
 
        default:
-               printk(KERN_ERR "%s - undefined state %d\n", __FUNCTION__, state);
+               printk(KERN_ERR "%s - undefined state %d\n", __func__, state);
                ret = -EINVAL;
                break;
        }
@@ -344,7 +344,7 @@ static int toim3232_change_speed(struct sir_dev *dev, unsigned speed)
 
 static int toim3232_reset(struct sir_dev *dev)
 {
-       IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(2, "%s()\n", __func__);
 
        /* Switch off both DTR and RTS to switch off dongle */
        sirdev_set_dtr_rts(dev, FALSE, FALSE);
index 04ad357..84e609e 100644 (file)
@@ -152,12 +152,12 @@ static int __init via_ircc_init(void)
 {
        int rc;
 
-       IRDA_DEBUG(3, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(3, "%s()\n", __func__);
 
        rc = pci_register_driver(&via_driver);
        if (rc < 0) {
                IRDA_DEBUG(0, "%s(): error rc = %d, returning  -ENODEV...\n",
-                          __FUNCTION__, rc);
+                          __func__, rc);
                return -ENODEV;
        }
        return 0;
@@ -170,11 +170,11 @@ static int __devinit via_init_one (struct pci_dev *pcidev, const struct pci_devi
        u16 Chipset,FirDRQ1,FirDRQ0,FirIRQ,FirIOBase;
        chipio_t info;
 
-       IRDA_DEBUG(2, "%s(): Device ID=(0X%X)\n", __FUNCTION__, id->device);
+       IRDA_DEBUG(2, "%s(): Device ID=(0X%X)\n", __func__, id->device);
 
        rc = pci_enable_device (pcidev);
        if (rc) {
-               IRDA_DEBUG(0, "%s(): error rc = %d\n", __FUNCTION__, rc);
+               IRDA_DEBUG(0, "%s(): error rc = %d\n", __func__, rc);
                return -ENODEV;
        }
 
@@ -185,7 +185,7 @@ static int __devinit via_init_one (struct pci_dev *pcidev, const struct pci_devi
                Chipset=0x3076;
 
        if (Chipset==0x3076) {
-               IRDA_DEBUG(2, "%s(): Chipset = 3076\n", __FUNCTION__);
+               IRDA_DEBUG(2, "%s(): Chipset = 3076\n", __func__);
 
                WriteLPCReg(7,0x0c );
                temp=ReadLPCReg(0x30);//check if BIOS Enable Fir
@@ -222,7 +222,7 @@ static int __devinit via_init_one (struct pci_dev *pcidev, const struct pci_devi
                } else
                        rc = -ENODEV; //IR not turn on   
        } else { //Not VT1211
-               IRDA_DEBUG(2, "%s(): Chipset = 3096\n", __FUNCTION__);
+               IRDA_DEBUG(2, "%s(): Chipset = 3096\n", __func__);
 
                pci_read_config_byte(pcidev,0x67,&bTmp);//check if BIOS Enable Fir
                if((bTmp&0x01)==1) {  // BIOS enable FIR
@@ -262,7 +262,7 @@ static int __devinit via_init_one (struct pci_dev *pcidev, const struct pci_devi
                        rc = -ENODEV; //IR not turn on !!!!!
        }//Not VT1211
 
-       IRDA_DEBUG(2, "%s(): End - rc = %d\n", __FUNCTION__, rc);
+       IRDA_DEBUG(2, "%s(): End - rc = %d\n", __func__, rc);
        return rc;
 }
 
@@ -276,7 +276,7 @@ static void via_ircc_clean(void)
 {
        int i;
 
-       IRDA_DEBUG(3, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(3, "%s()\n", __func__);
 
        for (i=0; i < ARRAY_SIZE(dev_self); i++) {
                if (dev_self[i])
@@ -286,7 +286,7 @@ static void via_ircc_clean(void)
 
 static void __devexit via_remove_one (struct pci_dev *pdev)
 {
-       IRDA_DEBUG(3, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(3, "%s()\n", __func__);
 
        /* FIXME : This is ugly. We should use pci_get_drvdata(pdev);
         * to get our driver instance and call directly via_ircc_close().
@@ -301,7 +301,7 @@ static void __devexit via_remove_one (struct pci_dev *pdev)
 
 static void __exit via_ircc_cleanup(void)
 {
-       IRDA_DEBUG(3, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(3, "%s()\n", __func__);
 
        /* FIXME : This should be redundant, as pci_unregister_driver()
         * should call via_remove_one() on each device.
@@ -324,7 +324,7 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id)
        struct via_ircc_cb *self;
        int err;
 
-       IRDA_DEBUG(3, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(3, "%s()\n", __func__);
 
        if (i >= ARRAY_SIZE(dev_self))
                return -ENOMEM;
@@ -360,7 +360,7 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id)
        /* Reserve the ioports that we need */
        if (!request_region(self->io.fir_base, self->io.fir_ext, driver_name)) {
                IRDA_DEBUG(0, "%s(), can't get iobase of 0x%03x\n",
-                          __FUNCTION__, self->io.fir_base);
+                          __func__, self->io.fir_base);
                err = -ENODEV;
                goto err_out1;
        }
@@ -471,7 +471,7 @@ static int via_ircc_close(struct via_ircc_cb *self)
 {
        int iobase;
 
-       IRDA_DEBUG(3, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(3, "%s()\n", __func__);
 
        IRDA_ASSERT(self != NULL, return -1;);
 
@@ -483,7 +483,7 @@ static int via_ircc_close(struct via_ircc_cb *self)
 
        /* Release the PORT that this driver is using */
        IRDA_DEBUG(2, "%s(), Releasing Region %03x\n",
-                  __FUNCTION__, self->io.fir_base);
+                  __func__, self->io.fir_base);
        release_region(self->io.fir_base, self->io.fir_ext);
        if (self->tx_buff.head)
                dma_free_coherent(NULL, self->tx_buff.truesize,
@@ -509,7 +509,7 @@ static void via_hw_init(struct via_ircc_cb *self)
 {
        int iobase = self->io.fir_base;
 
-       IRDA_DEBUG(3, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(3, "%s()\n", __func__);
 
        SetMaxRxPacketSize(iobase, 0x0fff);     //set to max:4095
        // FIFO Init
@@ -582,7 +582,7 @@ static void via_ircc_change_dongle_speed(int iobase, int speed,
        speed = speed;
 
        IRDA_DEBUG(1, "%s(): change_dongle_speed to %d for 0x%x, %d\n",
-                  __FUNCTION__, speed, iobase, dongle_id);
+                  __func__, speed, iobase, dongle_id);
 
        switch (dongle_id) {
 
@@ -671,7 +671,7 @@ static void via_ircc_change_dongle_speed(int iobase, int speed,
 
        case 0x11:              /* Temic TFDS4500 */
 
-               IRDA_DEBUG(2, "%s: Temic TFDS4500: One RX pin, TX normal, RX inverted.\n", __FUNCTION__);
+               IRDA_DEBUG(2, "%s: Temic TFDS4500: One RX pin, TX normal, RX inverted.\n", __func__);
 
                UseOneRX(iobase, ON);   //use ONE RX....RX1
                InvertTX(iobase, OFF);
@@ -689,7 +689,7 @@ static void via_ircc_change_dongle_speed(int iobase, int speed,
                        SlowIRRXLowActive(iobase, OFF);
 
                } else{
-                       IRDA_DEBUG(0, "%s: Warning: TFDS4500 not running in SIR mode !\n", __FUNCTION__);
+                       IRDA_DEBUG(0, "%s: Warning: TFDS4500 not running in SIR mode !\n", __func__);
                }
                break;
 
@@ -707,7 +707,7 @@ static void via_ircc_change_dongle_speed(int iobase, int speed,
 
        default:
                IRDA_ERROR("%s: Error: dongle_id %d unsupported !\n",
-                          __FUNCTION__, dongle_id);
+                          __func__, dongle_id);
        }
 }
 
@@ -726,7 +726,7 @@ static void via_ircc_change_speed(struct via_ircc_cb *self, __u32 speed)
        iobase = self->io.fir_base;
        /* Update accounting for new speed */
        self->io.speed = speed;
-       IRDA_DEBUG(1, "%s: change_speed to %d bps.\n", __FUNCTION__, speed);
+       IRDA_DEBUG(1, "%s: change_speed to %d bps.\n", __func__, speed);
 
        WriteReg(iobase, I_ST_CT_0, 0x0);
 
@@ -957,7 +957,7 @@ static int via_ircc_dma_xmit(struct via_ircc_cb *self, u16 iobase)
                        self->tx_buff.head) + self->tx_buff_dma,
                       self->tx_fifo.queue[self->tx_fifo.ptr].len, DMA_TX_MODE);
        IRDA_DEBUG(1, "%s: tx_fifo.ptr=%x,len=%x,tx_fifo.len=%x..\n",
-                  __FUNCTION__, self->tx_fifo.ptr,
+                  __func__, self->tx_fifo.ptr,
                   self->tx_fifo.queue[self->tx_fifo.ptr].len,
                   self->tx_fifo.len);
 
@@ -981,7 +981,7 @@ static int via_ircc_dma_xmit_complete(struct via_ircc_cb *self)
        int ret = TRUE;
        u8 Tx_status;
 
-       IRDA_DEBUG(3, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(3, "%s()\n", __func__);
 
        iobase = self->io.fir_base;
        /* Disable DMA */
@@ -1014,7 +1014,7 @@ static int via_ircc_dma_xmit_complete(struct via_ircc_cb *self)
        }
        IRDA_DEBUG(1,
                   "%s: tx_fifo.len=%x ,tx_fifo.ptr=%x,tx_fifo.free=%x...\n",
-                  __FUNCTION__,
+                  __func__,
                   self->tx_fifo.len, self->tx_fifo.ptr, self->tx_fifo.free);
 /* F01_S
        // Any frames to be sent back-to-back? 
@@ -1050,7 +1050,7 @@ static int via_ircc_dma_receive(struct via_ircc_cb *self)
 
        iobase = self->io.fir_base;
 
-       IRDA_DEBUG(3, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(3, "%s()\n", __func__);
 
        self->tx_fifo.len = self->tx_fifo.ptr = self->tx_fifo.free = 0;
        self->tx_fifo.tail = self->tx_buff.head;
@@ -1134,13 +1134,13 @@ static int via_ircc_dma_receive_complete(struct via_ircc_cb *self,
                        return TRUE;    //interrupt only, data maybe move by RxT  
                if (((len - 4) < 2) || ((len - 4) > 2048)) {
                        IRDA_DEBUG(1, "%s(): Trouble:len=%x,CurCount=%x,LastCount=%x..\n",
-                                  __FUNCTION__, len, RxCurCount(iobase, self),
+                                  __func__, len, RxCurCount(iobase, self),
                                   self->RxLastCount);
                        hwreset(self);
                        return FALSE;
                }
                IRDA_DEBUG(2, "%s(): fifo.len=%x,len=%x,CurCount=%x..\n",
-                          __FUNCTION__,
+                          __func__,
                           st_fifo->len, len - 4, RxCurCount(iobase, self));
 
                st_fifo->entries[st_fifo->tail].status = status;
@@ -1187,7 +1187,7 @@ F01_E */
                skb_put(skb, len - 4);
 
                skb_copy_to_linear_data(skb, self->rx_buff.data, len - 4);
-               IRDA_DEBUG(2, "%s(): len=%x.rx_buff=%p\n", __FUNCTION__,
+               IRDA_DEBUG(2, "%s(): len=%x.rx_buff=%p\n", __func__,
                           len - 4, self->rx_buff.data);
 
                // Move to next frame 
@@ -1217,7 +1217,7 @@ static int upload_rxdata(struct via_ircc_cb *self, int iobase)
 
        len = GetRecvByte(iobase, self);
 
-       IRDA_DEBUG(2, "%s(): len=%x\n", __FUNCTION__, len);
+       IRDA_DEBUG(2, "%s(): len=%x\n", __func__, len);
 
        if ((len - 4) < 2) {
                self->stats.rx_dropped++;
@@ -1302,7 +1302,7 @@ static int RxTimerHandler(struct via_ircc_cb *self, int iobase)
                        skb_put(skb, len - 4);
                        skb_copy_to_linear_data(skb, self->rx_buff.data, len - 4);
 
-                       IRDA_DEBUG(2, "%s(): len=%x.head=%x\n", __FUNCTION__,
+                       IRDA_DEBUG(2, "%s(): len=%x.head=%x\n", __func__,
                                   len - 4, st_fifo->head);
 
                        // Move to next frame 
@@ -1318,7 +1318,7 @@ static int RxTimerHandler(struct via_ircc_cb *self, int iobase)
 
                IRDA_DEBUG(2,
                           "%s(): End of upload HostStatus=%x,RxStatus=%x\n",
-                          __FUNCTION__,
+                          __func__,
                           GetHostStatus(iobase), GetRXStatus(iobase));
 
                /*
@@ -1358,7 +1358,7 @@ static irqreturn_t via_ircc_interrupt(int dummy, void *dev_id)
        iHostIntType = GetHostStatus(iobase);
 
        IRDA_DEBUG(4, "%s(): iHostIntType %02x:  %s %s %s  %02x\n",
-                  __FUNCTION__, iHostIntType,
+                  __func__, iHostIntType,
                   (iHostIntType & 0x40) ? "Timer" : "",
                   (iHostIntType & 0x20) ? "Tx" : "",
                   (iHostIntType & 0x10) ? "Rx" : "",
@@ -1388,7 +1388,7 @@ static irqreturn_t via_ircc_interrupt(int dummy, void *dev_id)
                iTxIntType = GetTXStatus(iobase);
 
                IRDA_DEBUG(4, "%s(): iTxIntType %02x:  %s %s %s %s\n",
-                          __FUNCTION__, iTxIntType,
+                          __func__, iTxIntType,
                           (iTxIntType & 0x08) ? "FIFO underr." : "",
                           (iTxIntType & 0x04) ? "EOM" : "",
                           (iTxIntType & 0x02) ? "FIFO ready" : "",
@@ -1412,7 +1412,7 @@ static irqreturn_t via_ircc_interrupt(int dummy, void *dev_id)
                iRxIntType = GetRXStatus(iobase);
 
                IRDA_DEBUG(4, "%s(): iRxIntType %02x:  %s %s %s %s %s %s %s\n",
-                          __FUNCTION__, iRxIntType,
+                          __func__, iRxIntType,
                           (iRxIntType & 0x80) ? "PHY err."     : "",
                           (iRxIntType & 0x40) ? "CRC err"      : "",
                           (iRxIntType & 0x20) ? "FIFO overr."  : "",
@@ -1421,7 +1421,7 @@ static irqreturn_t via_ircc_interrupt(int dummy, void *dev_id)
                           (iRxIntType & 0x02) ? "RxMaxLen"     : "",
                           (iRxIntType & 0x01) ? "SIR bad"      : "");
                if (!iRxIntType)
-                       IRDA_DEBUG(3, "%s(): RxIRQ =0\n", __FUNCTION__);
+                       IRDA_DEBUG(3, "%s(): RxIRQ =0\n", __func__);
 
                if (iRxIntType & 0x10) {
                        if (via_ircc_dma_receive_complete(self, iobase)) {
@@ -1431,7 +1431,7 @@ static irqreturn_t via_ircc_interrupt(int dummy, void *dev_id)
                }               // No ERR     
                else {          //ERR
                        IRDA_DEBUG(4, "%s(): RxIRQ ERR:iRxIntType=%x,HostIntType=%x,CurCount=%x,RxLastCount=%x_____\n",
-                                  __FUNCTION__, iRxIntType, iHostIntType,
+                                  __func__, iRxIntType, iHostIntType,
                                   RxCurCount(iobase, self),
                                   self->RxLastCount);
 
@@ -1456,7 +1456,7 @@ static void hwreset(struct via_ircc_cb *self)
        int iobase;
        iobase = self->io.fir_base;
 
-       IRDA_DEBUG(3, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(3, "%s()\n", __func__);
 
        ResetChip(iobase, 5);
        EnableDMA(iobase, OFF);
@@ -1501,7 +1501,7 @@ static int via_ircc_is_receiving(struct via_ircc_cb *self)
        if (CkRxRecv(iobase, self))
                status = TRUE;
 
-       IRDA_DEBUG(2, "%s(): status=%x....\n", __FUNCTION__, status);
+       IRDA_DEBUG(2, "%s(): status=%x....\n", __func__, status);
 
        return status;
 }
@@ -1519,7 +1519,7 @@ static int via_ircc_net_open(struct net_device *dev)
        int iobase;
        char hwname[32];
 
-       IRDA_DEBUG(3, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(3, "%s()\n", __func__);
 
        IRDA_ASSERT(dev != NULL, return -1;);
        self = (struct via_ircc_cb *) dev->priv;
@@ -1586,7 +1586,7 @@ static int via_ircc_net_close(struct net_device *dev)
        struct via_ircc_cb *self;
        int iobase;
 
-       IRDA_DEBUG(3, "%s()\n", __FUNCTION__);
+       IRDA_DEBUG(3, "%s()\n", __func__);
 
        IRDA_ASSERT(dev != NULL, return -1;);
        self = (struct via_ircc_cb *) dev->priv;
@@ -1630,7 +1630,7 @@ static int via_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq,
        IRDA_ASSERT(dev != NULL, return -1;);
        self = dev->priv;
        IRDA_ASSERT(self != NULL, return -1;);
-       IRDA_DEBUG(1, "%s(), %s, (cmd=0x%X)\n", __FUNCTION__, dev->name,
+       IRDA_DEBUG(1, "%s(), %s, (cmd=0x%X)\n", __func__, dev->name,
                   cmd);
        /* Disable interrupts & save flags */
        spin_lock_irqsave(&self->lock, flags);
index d15e00b..18f4b3a 100644 (file)
@@ -140,15 +140,15 @@ static void vlsi_ring_debug(struct vlsi_ring *r)
        unsigned i;
 
        printk(KERN_DEBUG "%s - ring %p / size %u / mask 0x%04x / len %u / dir %d / hw %p\n",
-               __FUNCTION__, r, r->size, r->mask, r->len, r->dir, r->rd[0].hw);
-       printk(KERN_DEBUG "%s - head = %d / tail = %d\n", __FUNCTION__,
+               __func__, r, r->size, r->mask, r->len, r->dir, r->rd[0].hw);
+       printk(KERN_DEBUG "%s - head = %d / tail = %d\n", __func__,
                atomic_read(&r->head) & r->mask, atomic_read(&r->tail) & r->mask);
        for (i = 0; i < r->size; i++) {
                rd = &r->rd[i];
-               printk(KERN_DEBUG "%s - ring descr %u: ", __FUNCTION__, i);
+               printk(KERN_DEBUG "%s - ring descr %u: ", __func__, i);
                printk("skb=%p data=%p hw=%p\n", rd->skb, rd->buf, rd->hw);
                printk(KERN_DEBUG "%s - hw: status=%02x count=%u addr=0x%08x\n",
-                       __FUNCTION__, (unsigned) rd_get_status(rd),
+                       __func__, (unsigned) rd_get_status(rd),
                        (unsigned) rd_get_count(rd), (unsigned) rd_get_addr(rd));
        }
 }
@@ -435,7 +435,7 @@ static struct vlsi_ring *vlsi_alloc_ring(struct pci_dev *pdev, struct ring_descr
                    ||  !(busaddr = pci_map_single(pdev, rd->buf, len, dir))) {
                        if (rd->buf) {
                                IRDA_ERROR("%s: failed to create PCI-MAP for %p",
-                                          __FUNCTION__, rd->buf);
+                                          __func__, rd->buf);
                                kfree(rd->buf);
                                rd->buf = NULL;
                        }
@@ -489,7 +489,7 @@ static int vlsi_create_hwif(vlsi_irda_dev_t *idev)
        ringarea = pci_alloc_consistent(idev->pdev, HW_RING_AREA_SIZE, &idev->busaddr);
        if (!ringarea) {
                IRDA_ERROR("%s: insufficient memory for descriptor rings\n",
-                          __FUNCTION__);
+                          __func__);
                goto out;
        }
        memset(ringarea, 0, HW_RING_AREA_SIZE);
@@ -564,7 +564,7 @@ static int vlsi_process_rx(struct vlsi_ring *r, struct ring_descr *rd)
        crclen = (idev->mode==IFF_FIR) ? sizeof(u32) : sizeof(u16);
        len -= crclen;          /* remove trailing CRC */
        if (len <= 0) {
-               IRDA_DEBUG(0, "%s: strange frame (len=%d)\n", __FUNCTION__, len);
+               IRDA_DEBUG(0, "%s: strange frame (len=%d)\n", __func__, len);
                ret |= VLSI_RX_DROP;
                goto done;
        }
@@ -579,14 +579,14 @@ static int vlsi_process_rx(struct vlsi_ring *r, struct ring_descr *rd)
                 */
                le16_to_cpus(rd->buf+len);
                if (irda_calc_crc16(INIT_FCS,rd->buf,len+crclen) != GOOD_FCS) {
-                       IRDA_DEBUG(0, "%s: crc error\n", __FUNCTION__);
+                       IRDA_DEBUG(0, "%s: crc error\n", __func__);
                        ret |= VLSI_RX_CRC;
                        goto done;
                }
        }
 
        if (!rd->skb) {
-               IRDA_WARNING("%s: rx packet lost\n", __FUNCTION__);
+               IRDA_WARNING("%s: rx packet lost\n", __func__);
                ret |= VLSI_RX_DROP;
                goto done;
        }
@@ -617,7 +617,7 @@ static void vlsi_fill_rx(struct vlsi_ring *r)
        for (rd = ring_last(r); rd != NULL; rd = ring_put(r)) {
                if (rd_is_active(rd)) {
                        IRDA_WARNING("%s: driver bug: rx descr race with hw\n",
-                                    __FUNCTION__);
+                                    __func__);
                        vlsi_ring_debug(r);
                        break;
                }
@@ -676,7 +676,7 @@ static void vlsi_rx_interrupt(struct net_device *ndev)
 
        if (ring_first(r) == NULL) {
                /* we are in big trouble, if this should ever happen */
-               IRDA_ERROR("%s: rx ring exhausted!\n", __FUNCTION__);
+               IRDA_ERROR("%s: rx ring exhausted!\n", __func__);
                vlsi_ring_debug(r);
        }
        else
@@ -697,7 +697,7 @@ static void vlsi_unarm_rx(vlsi_irda_dev_t *idev)
                if (rd_is_active(rd)) {
                        rd_set_status(rd, 0);
                        if (rd_get_count(rd)) {
-                               IRDA_DEBUG(0, "%s - dropping rx packet\n", __FUNCTION__);
+                               IRDA_DEBUG(0, "%s - dropping rx packet\n", __func__);
                                ret = -VLSI_RX_DROP;
                        }
                        rd_set_count(rd, 0);
@@ -772,7 +772,7 @@ static int vlsi_set_baud(vlsi_irda_dev_t *idev, unsigned iobase)
        int     fifocnt;
 
        baudrate = idev->new_baud;
-       IRDA_DEBUG(2, "%s: %d -> %d\n", __FUNCTION__, idev->baud, idev->new_baud);
+       IRDA_DEBUG(2, "%s: %d -> %d\n", __func__, idev->baud, idev->new_baud);
        if (baudrate == 4000000) {
                mode = IFF_FIR;
                config = IRCFG_FIR;
@@ -789,7 +789,7 @@ static int vlsi_set_baud(vlsi_irda_dev_t *idev, unsigned iobase)
                switch(baudrate) {
                        default:
                                IRDA_WARNING("%s: undefined baudrate %d - fallback to 9600!\n",
-                                            __FUNCTION__, baudrate);
+                                            __func__, baudrate);
                                baudrate = 9600;
                                /* fallthru */
                        case 2400:
@@ -806,7 +806,7 @@ static int vlsi_set_baud(vlsi_irda_dev_t *idev, unsigned iobase)
 
        fifocnt = inw(iobase+VLSI_PIO_RCVBCNT) & RCVBCNT_MASK;
        if (fifocnt != 0) {
-               IRDA_DEBUG(0, "%s: rx fifo not empty(%d)\n", __FUNCTION__, fifocnt);
+               IRDA_DEBUG(0, "%s: rx fifo not empty(%d)\n", __func__, fifocnt);
        }
 
        outw(0, iobase+VLSI_PIO_IRENABLE);
@@ -830,14 +830,14 @@ static int vlsi_set_baud(vlsi_irda_dev_t *idev, unsigned iobase)
                config ^= IRENABLE_SIR_ON;
 
        if (config != (IRENABLE_PHYANDCLOCK|IRENABLE_ENRXST)) {
-               IRDA_WARNING("%s: failed to set %s mode!\n", __FUNCTION__,
+               IRDA_WARNING("%s: failed to set %s mode!\n", __func__,
                        (mode==IFF_SIR)?"SIR":((mode==IFF_MIR)?"MIR":"FIR"));
                ret = -1;
        }
        else {
                if (inw(iobase+VLSI_PIO_PHYCTL) != nphyctl) {
                        IRDA_WARNING("%s: failed to apply baudrate %d\n",
-                                    __FUNCTION__, baudrate);
+                                    __func__, baudrate);
                        ret = -1;
                }
                else {
@@ -849,7 +849,7 @@ static int vlsi_set_baud(vlsi_irda_dev_t *idev, unsigned iobase)
        }
 
        if (ret)
-               vlsi_reg_debug(iobase,__FUNCTION__);
+               vlsi_reg_debug(iobase,__func__);
 
        return ret;
 }
@@ -982,7 +982,7 @@ static int vlsi_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 
                if (len >= r->len-5)
                         IRDA_WARNING("%s: possible buffer overflow with SIR wrapping!\n",
-                                     __FUNCTION__);
+                                     __func__);
        }
        else {
                /* hw deals with MIR/FIR mode wrapping */
@@ -1027,7 +1027,7 @@ static int vlsi_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 
                fifocnt = inw(ndev->base_addr+VLSI_PIO_RCVBCNT) & RCVBCNT_MASK;
                if (fifocnt != 0) {
-                       IRDA_DEBUG(0, "%s: rx fifo not empty(%d)\n", __FUNCTION__, fifocnt);
+                       IRDA_DEBUG(0, "%s: rx fifo not empty(%d)\n", __func__, fifocnt);
                }
 
                config = inw(iobase+VLSI_PIO_IRCFG);
@@ -1040,7 +1040,7 @@ static int vlsi_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 
        if (ring_put(r) == NULL) {
                netif_stop_queue(ndev);
-               IRDA_DEBUG(3, "%s: tx ring full - queue stopped\n", __FUNCTION__);
+               IRDA_DEBUG(3, "%s: tx ring full - queue stopped\n", __func__);
        }
        spin_unlock_irqrestore(&idev->lock, flags);
 
@@ -1049,7 +1049,7 @@ static int vlsi_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 drop_unlock:
        spin_unlock_irqrestore(&idev->lock, flags);
 drop:
-       IRDA_WARNING("%s: dropping packet - %s\n", __FUNCTION__, msg);
+       IRDA_WARNING("%s: dropping packet - %s\n", __func__, msg);
        dev_kfree_skb_any(skb);
        idev->stats.tx_errors++;
        idev->stats.tx_dropped++;
@@ -1106,7 +1106,7 @@ static void vlsi_tx_interrupt(struct net_device *ndev)
                fifocnt = inw(iobase+VLSI_PIO_RCVBCNT) & RCVBCNT_MASK;
                if (fifocnt != 0) {
                        IRDA_DEBUG(0, "%s: rx fifo not empty(%d)\n",
-                               __FUNCTION__, fifocnt);
+                               __func__, fifocnt);
                }
                outw(config | IRCFG_ENTX, iobase+VLSI_PIO_IRCFG);
        }
@@ -1115,7 +1115,7 @@ static void vlsi_tx_interrupt(struct net_device *ndev)
 
        if (netif_queue_stopped(ndev)  &&  !idev->new_baud) {
                netif_wake_queue(ndev);
-               IRDA_DEBUG(3, "%s: queue awoken\n", __FUNCTION__);
+               IRDA_DEBUG(3, "%s: queue awoken\n", __func__);
        }
 }
 
@@ -1138,7 +1138,7 @@ static void vlsi_unarm_tx(vlsi_irda_dev_t *idev)
                                dev_kfree_skb_any(rd->skb);
                                rd->skb = NULL;
                        }
-                       IRDA_DEBUG(0, "%s - dropping tx packet\n", __FUNCTION__);
+                       IRDA_DEBUG(0, "%s - dropping tx packet\n", __func__);
                        ret = -VLSI_TX_DROP;
                }
                else
@@ -1188,7 +1188,7 @@ static int vlsi_start_clock(struct pci_dev *pdev)
                if (count < 3) {
                        if (clksrc == 1) { /* explicitly asked for PLL hence bail out */
                                IRDA_ERROR("%s: no PLL or failed to lock!\n",
-                                          __FUNCTION__);
+                                          __func__);
                                clkctl = CLKCTL_CLKSTP;
                                pci_write_config_byte(pdev, VLSI_PCI_CLKCTL, clkctl);
                                return -1;
@@ -1197,7 +1197,7 @@ static int vlsi_start_clock(struct pci_dev *pdev)
                                clksrc = 3;     /* fallback to 40MHz XCLK (OB800) */
 
                        IRDA_DEBUG(0, "%s: PLL not locked, fallback to clksrc=%d\n",
-                               __FUNCTION__, clksrc);
+                               __func__, clksrc);
                }
                else
                        clksrc = 1;     /* got successful PLL lock */
@@ -1269,7 +1269,7 @@ static int vlsi_init_chip(struct pci_dev *pdev)
        /* start the clock and clean the registers */
 
        if (vlsi_start_clock(pdev)) {
-               IRDA_ERROR("%s: no valid clock source\n", __FUNCTION__);
+               IRDA_ERROR("%s: no valid clock source\n", __func__);
                return -1;
        }
        iobase = ndev->base_addr;
@@ -1386,7 +1386,7 @@ static void vlsi_tx_timeout(struct net_device *ndev)
        vlsi_irda_dev_t *idev = ndev->priv;
 
 
-       vlsi_reg_debug(ndev->base_addr, __FUNCTION__);
+       vlsi_reg_debug(ndev->base_addr, __func__);
        vlsi_ring_debug(idev->tx_ring);
 
        if (netif_running(ndev))
@@ -1401,7 +1401,7 @@ static void vlsi_tx_timeout(struct net_device *ndev)
 
        if (vlsi_start_hw(idev))
                IRDA_ERROR("%s: failed to restart hw - %s(%s) unusable!\n",
-                          __FUNCTION__, pci_name(idev->pdev), ndev->name);
+                          __func__, pci_name(idev->pdev), ndev->name);
        else
                netif_start_queue(ndev);
 }
@@ -1446,7 +1446,7 @@ static int vlsi_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)
                        break;
                default:
                        IRDA_WARNING("%s: notsupp - cmd=%04x\n",
-                                    __FUNCTION__, cmd);
+                                    __func__, cmd);
                        ret = -EOPNOTSUPP;
        }       
        
@@ -1491,7 +1491,7 @@ static irqreturn_t vlsi_interrupt(int irq, void *dev_instance)
 
        if (boguscount <= 0)
                IRDA_MESSAGE("%s: too much work in interrupt!\n",
-                            __FUNCTION__);
+                            __func__);
        return IRQ_RETVAL(handled);
 }
 
@@ -1504,7 +1504,7 @@ static int vlsi_open(struct net_device *ndev)
        char    hwname[32];
 
        if (pci_request_regions(idev->pdev, drivername)) {
-               IRDA_WARNING("%s: io resource busy\n", __FUNCTION__);
+               IRDA_WARNING("%s: io resource busy\n", __func__);
                goto errout;
        }
        ndev->base_addr = pci_resource_start(idev->pdev,0);
@@ -1519,7 +1519,7 @@ static int vlsi_open(struct net_device *ndev)
        if (request_irq(ndev->irq, vlsi_interrupt, IRQF_SHARED,
                        drivername, ndev)) {
                IRDA_WARNING("%s: couldn't get IRQ: %d\n",
-                            __FUNCTION__, ndev->irq);
+                            __func__, ndev->irq);
                goto errout_io;
        }
 
@@ -1540,7 +1540,7 @@ static int vlsi_open(struct net_device *ndev)
 
        netif_start_queue(ndev);
 
-       IRDA_MESSAGE("%s: device %s operational\n", __FUNCTION__, ndev->name);
+       IRDA_MESSAGE("%s: device %s operational\n", __func__, ndev->name);
 
        return 0;
 
@@ -1574,7 +1574,7 @@ static int vlsi_close(struct net_device *ndev)
 
        pci_release_regions(idev->pdev);
 
-       IRDA_MESSAGE("%s: device %s stopped\n", __FUNCTION__, ndev->name);
+       IRDA_MESSAGE("%s: device %s stopped\n", __func__, ndev->name);
 
        return 0;
 }
@@ -1593,7 +1593,7 @@ static int vlsi_irda_init(struct net_device *ndev)
 
        if (pci_set_dma_mask(pdev,DMA_MASK_USED_BY_HW)
            || pci_set_dma_mask(pdev,DMA_MASK_MSTRPAGE)) {
-               IRDA_ERROR("%s: aborting due to PCI BM-DMA address limitations\n", __FUNCTION__);
+               IRDA_ERROR("%s: aborting due to PCI BM-DMA address limitations\n", __func__);
                return -1;
        }
 
@@ -1645,14 +1645,14 @@ vlsi_irda_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
        if ( !pci_resource_start(pdev,0)
             || !(pci_resource_flags(pdev,0) & IORESOURCE_IO) ) {
-               IRDA_ERROR("%s: bar 0 invalid", __FUNCTION__);
+               IRDA_ERROR("%s: bar 0 invalid", __func__);
                goto out_disable;
        }
 
        ndev = alloc_irdadev(sizeof(*idev));
        if (ndev==NULL) {
                IRDA_ERROR("%s: Unable to allocate device memory.\n",
-                          __FUNCTION__);
+                          __func__);
                goto out_disable;
        }
 
@@ -1667,7 +1667,7 @@ vlsi_irda_probe(struct pci_dev *pdev, const struct pci_device_id *id)
                goto out_freedev;
 
        if (register_netdev(ndev) < 0) {
-               IRDA_ERROR("%s: register_netdev failed\n", __FUNCTION__);
+               IRDA_ERROR("%s: register_netdev failed\n", __func__);
                goto out_freedev;
        }
 
@@ -1678,7 +1678,7 @@ vlsi_irda_probe(struct pci_dev *pdev, const struct pci_device_id *id)
                                       vlsi_proc_root, VLSI_PROC_FOPS, ndev);
                if (!ent) {
                        IRDA_WARNING("%s: failed to create proc entry\n",
-                                    __FUNCTION__);
+                                    __func__);
                } else {
                        ent->size = 0;
                }
@@ -1745,7 +1745,7 @@ static int vlsi_irda_suspend(struct pci_dev *pdev, pm_message_t state)
 
        if (!ndev) {
                IRDA_ERROR("%s - %s: no netdevice \n",
-                          __FUNCTION__, pci_name(pdev));
+                          __func__, pci_name(pdev));
                return 0;
        }
        idev = ndev->priv;      
@@ -1756,7 +1756,7 @@ static int vlsi_irda_suspend(struct pci_dev *pdev, pm_message_t state)
                        pdev->current_state = state.event;
                }
                else
-                       IRDA_ERROR("%s - %s: invalid suspend request %u -> %u\n", __FUNCTION__, pci_name(pdev), pdev->current_state, state.event);
+                       IRDA_ERROR("%s - %s: invalid suspend request %u -> %u\n", __func__, pci_name(pdev), pdev->current_state, state.event);
                mutex_unlock(&idev->mtx);
                return 0;
        }
@@ -1784,7 +1784,7 @@ static int vlsi_irda_resume(struct pci_dev *pdev)
 
        if (!ndev) {
                IRDA_ERROR("%s - %s: no netdevice \n",
-                          __FUNCTION__, pci_name(pdev));
+                          __func__, pci_name(pdev));
                return 0;
        }
        idev = ndev->priv;      
@@ -1792,7 +1792,7 @@ static int vlsi_irda_resume(struct pci_dev *pdev)
        if (pdev->current_state == 0) {
                mutex_unlock(&idev->mtx);
                IRDA_WARNING("%s - %s: already resumed\n",
-                            __FUNCTION__, pci_name(pdev));
+                            __func__, pci_name(pdev));
                return 0;
        }
        
@@ -1811,7 +1811,7 @@ static int vlsi_irda_resume(struct pci_dev *pdev)
                 * now we explicitly set pdev->current_state = 0 after enabling the
                 * device and independently resume_ok should catch any garbage config.
                 */
-               IRDA_WARNING("%s - hm, nothing to resume?\n", __FUNCTION__);
+               IRDA_WARNING("%s - hm, nothing to resume?\n", __func__);
                mutex_unlock(&idev->mtx);
                return 0;
        }
index c8b9c74..9b18843 100644 (file)
@@ -617,7 +617,7 @@ static inline void rd_set_addr_status(struct ring_descr *rd, dma_addr_t a, u8 s)
         */
 
        if ((a & ~DMA_MASK_MSTRPAGE)>>24 != MSTRPAGE_VALUE) {
-               IRDA_ERROR("%s: pci busaddr inconsistency!\n", __FUNCTION__);
+               IRDA_ERROR("%s: pci busaddr inconsistency!\n", __func__);
                dump_stack();
                return;
        }
index 9fd2451..002a6d7 100644 (file)
@@ -114,7 +114,7 @@ static int __init w83977af_init(void)
 {
         int i;
 
-       IRDA_DEBUG(0, "%s()\n", __FUNCTION__ );
+       IRDA_DEBUG(0, "%s()\n", __func__ );
 
        for (i=0; (io[i] < 2000) && (i < ARRAY_SIZE(dev_self)); i++) {
                if (w83977af_open(i, io[i], irq[i], dma[i]) == 0)
@@ -133,7 +133,7 @@ static void __exit w83977af_cleanup(void)
 {
        int i;
 
-        IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
+        IRDA_DEBUG(4, "%s()\n", __func__ );
 
        for (i=0; i < ARRAY_SIZE(dev_self); i++) {
                if (dev_self[i])
@@ -154,12 +154,12 @@ int w83977af_open(int i, unsigned int iobase, unsigned int irq,
         struct w83977af_ir *self;
        int err;
 
-       IRDA_DEBUG(0, "%s()\n", __FUNCTION__ );
+       IRDA_DEBUG(0, "%s()\n", __func__ );
 
        /* Lock the port that we need */
        if (!request_region(iobase, CHIP_IO_EXTENT, driver_name)) {
                IRDA_DEBUG(0, "%s(), can't get iobase of 0x%03x\n",
-                     __FUNCTION__ , iobase);
+                     __func__ , iobase);
                return -ENODEV;
        }
 
@@ -241,7 +241,7 @@ int w83977af_open(int i, unsigned int iobase, unsigned int irq,
 
        err = register_netdev(dev);
        if (err) {
-               IRDA_ERROR("%s(), register_netdevice() failed!\n", __FUNCTION__);
+               IRDA_ERROR("%s(), register_netdevice() failed!\n", __func__);
                goto err_out3;
        }
        IRDA_MESSAGE("IrDA: Registered device %s\n", dev->name);
@@ -273,7 +273,7 @@ static int w83977af_close(struct w83977af_ir *self)
 {
        int iobase;
 
-       IRDA_DEBUG(0, "%s()\n", __FUNCTION__ );
+       IRDA_DEBUG(0, "%s()\n", __func__ );
 
         iobase = self->io.fir_base;
 
@@ -294,7 +294,7 @@ static int w83977af_close(struct w83977af_ir *self)
 
        /* Release the PORT that this driver is using */
        IRDA_DEBUG(0 , "%s(), Releasing Region %03x\n", 
-             __FUNCTION__ , self->io.fir_base);
+             __func__ , self->io.fir_base);
        release_region(self->io.fir_base, self->io.fir_ext);
 
        if (self->tx_buff.head)
@@ -316,7 +316,7 @@ int w83977af_probe( int iobase, int irq, int dma)
        int i;
        
        for (i=0; i < 2; i++) {
-               IRDA_DEBUG( 0, "%s()\n", __FUNCTION__ );
+               IRDA_DEBUG( 0, "%s()\n", __func__ );
 #ifdef CONFIG_USE_W977_PNP
                /* Enter PnP configuration mode */
                w977_efm_enter(efbase[i]);
@@ -403,7 +403,7 @@ int w83977af_probe( int iobase, int irq, int dma)
                        return 0;
                } else {
                        /* Try next extented function register address */
-                       IRDA_DEBUG( 0, "%s(), Wrong chip version", __FUNCTION__ );
+                       IRDA_DEBUG( 0, "%s(), Wrong chip version", __func__ );
                }
        }       
        return -1;
@@ -439,19 +439,19 @@ void w83977af_change_speed(struct w83977af_ir *self, __u32 speed)
        case 115200: outb(0x01, iobase+ABLL); break;
        case 576000:
                ir_mode = HCR_MIR_576;
-               IRDA_DEBUG(0, "%s(), handling baud of 576000\n", __FUNCTION__ );
+               IRDA_DEBUG(0, "%s(), handling baud of 576000\n", __func__ );
                break;
        case 1152000:
                ir_mode = HCR_MIR_1152;
-               IRDA_DEBUG(0, "%s(), handling baud of 1152000\n", __FUNCTION__ );
+               IRDA_DEBUG(0, "%s(), handling baud of 1152000\n", __func__ );
                break;
        case 4000000:
                ir_mode = HCR_FIR;
-               IRDA_DEBUG(0, "%s(), handling baud of 4000000\n", __FUNCTION__ );
+               IRDA_DEBUG(0, "%s(), handling baud of 4000000\n", __func__ );
                break;
        default:
                ir_mode = HCR_FIR;
-               IRDA_DEBUG(0, "%s(), unknown baud rate of %d\n", __FUNCTION__ , speed);
+               IRDA_DEBUG(0, "%s(), unknown baud rate of %d\n", __func__ , speed);
                break;
        }
 
@@ -501,7 +501,7 @@ int w83977af_hard_xmit(struct sk_buff *skb, struct net_device *dev)
 
        iobase = self->io.fir_base;
 
-       IRDA_DEBUG(4, "%s(%ld), skb->len=%d\n", __FUNCTION__ , jiffies, 
+       IRDA_DEBUG(4, "%s(%ld), skb->len=%d\n", __func__ , jiffies,
                   (int) skb->len);
        
        /* Lock transmit buffer */
@@ -549,7 +549,7 @@ int w83977af_hard_xmit(struct sk_buff *skb, struct net_device *dev)
                        outb(ICR_ETMRI, iobase+ICR);
                } else {
 #endif
-                       IRDA_DEBUG(4, "%s(%ld), mtt=%d\n", __FUNCTION__ , jiffies, mtt);
+                       IRDA_DEBUG(4, "%s(%ld), mtt=%d\n", __func__ , jiffies, mtt);
                        if (mtt)
                                udelay(mtt);
 
@@ -591,7 +591,7 @@ static void w83977af_dma_write(struct w83977af_ir *self, int iobase)
        unsigned long flags;
        __u8 hcr;
 #endif
-        IRDA_DEBUG(4, "%s(), len=%d\n", __FUNCTION__ , self->tx_buff.len);
+        IRDA_DEBUG(4, "%s(), len=%d\n", __func__ , self->tx_buff.len);
 
        /* Save current set */
        set = inb(iobase+SSR);
@@ -643,7 +643,7 @@ static int w83977af_pio_write(int iobase, __u8 *buf, int len, int fifo_size)
        int actual = 0;
        __u8 set;
        
-       IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
+       IRDA_DEBUG(4, "%s()\n", __func__ );
 
        /* Save current bank */
        set = inb(iobase+SSR);
@@ -651,11 +651,11 @@ static int w83977af_pio_write(int iobase, __u8 *buf, int len, int fifo_size)
        switch_bank(iobase, SET0);
        if (!(inb_p(iobase+USR) & USR_TSRE)) {
                IRDA_DEBUG(4,
-                          "%s(), warning, FIFO not empty yet!\n", __FUNCTION__  );
+                          "%s(), warning, FIFO not empty yet!\n", __func__  );
 
                fifo_size -= 17;
                IRDA_DEBUG(4, "%s(), %d bytes left in tx fifo\n", 
-                          __FUNCTION__ , fifo_size);
+                          __func__ , fifo_size);
        }
 
        /* Fill FIFO with current frame */
@@ -665,7 +665,7 @@ static int w83977af_pio_write(int iobase, __u8 *buf, int len, int fifo_size)
        }
         
        IRDA_DEBUG(4, "%s(), fifo_size %d ; %d sent of %d\n", 
-                  __FUNCTION__ , fifo_size, actual, len);
+                  __func__ , fifo_size, actual, len);
 
        /* Restore bank */
        outb(set, iobase+SSR);
@@ -685,7 +685,7 @@ static void w83977af_dma_xmit_complete(struct w83977af_ir *self)
        int iobase;
        __u8 set;
 
-       IRDA_DEBUG(4, "%s(%ld)\n", __FUNCTION__ , jiffies);
+       IRDA_DEBUG(4, "%s(%ld)\n", __func__ , jiffies);
 
        IRDA_ASSERT(self != NULL, return;);
 
@@ -700,7 +700,7 @@ static void w83977af_dma_xmit_complete(struct w83977af_ir *self)
        
        /* Check for underrrun! */
        if (inb(iobase+AUDR) & AUDR_UNDR) {
-               IRDA_DEBUG(0, "%s(), Transmit underrun!\n", __FUNCTION__ );
+               IRDA_DEBUG(0, "%s(), Transmit underrun!\n", __func__ );
                
                self->stats.tx_errors++;
                self->stats.tx_fifo_errors++;
@@ -741,7 +741,7 @@ int w83977af_dma_receive(struct w83977af_ir *self)
 #endif
        IRDA_ASSERT(self != NULL, return -1;);
 
-       IRDA_DEBUG(4, "%s\n", __FUNCTION__ );
+       IRDA_DEBUG(4, "%s\n", __func__ );
 
        iobase= self->io.fir_base;
 
@@ -812,7 +812,7 @@ int w83977af_dma_receive_complete(struct w83977af_ir *self)
        __u8 set;
        __u8 status;
 
-       IRDA_DEBUG(4, "%s\n", __FUNCTION__ );
+       IRDA_DEBUG(4, "%s\n", __func__ );
 
        st_fifo = &self->st_fifo;
 
@@ -892,7 +892,7 @@ int w83977af_dma_receive_complete(struct w83977af_ir *self)
                        skb = dev_alloc_skb(len+1);
                        if (skb == NULL)  {
                                printk(KERN_INFO
-                                      "%s(), memory squeeze, dropping frame.\n", __FUNCTION__);
+                                      "%s(), memory squeeze, dropping frame.\n", __func__);
                                /* Restore set register */
                                outb(set, iobase+SSR);
 
@@ -943,7 +943,7 @@ static void w83977af_pio_receive(struct w83977af_ir *self)
        __u8 byte = 0x00;
        int iobase;
 
-       IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
+       IRDA_DEBUG(4, "%s()\n", __func__ );
 
        IRDA_ASSERT(self != NULL, return;);
        
@@ -970,7 +970,7 @@ static __u8 w83977af_sir_interrupt(struct w83977af_ir *self, int isr)
        __u8 set;
        int iobase;
 
-       IRDA_DEBUG(4, "%s(), isr=%#x\n", __FUNCTION__ , isr);
+       IRDA_DEBUG(4, "%s(), isr=%#x\n", __func__ , isr);
        
        iobase = self->io.fir_base;
        /* Transmit FIFO low on data */
@@ -1007,7 +1007,7 @@ static __u8 w83977af_sir_interrupt(struct w83977af_ir *self, int isr)
                /* Check if we need to change the speed? */
                if (self->new_speed) {
                        IRDA_DEBUG(2,
-                                  "%s(), Changing speed!\n", __FUNCTION__ );
+                                  "%s(), Changing speed!\n", __func__ );
                        w83977af_change_speed(self, self->new_speed);
                        self->new_speed = 0;
                }
@@ -1189,7 +1189,7 @@ static int w83977af_net_open(struct net_device *dev)
        char hwname[32];
        __u8 set;
        
-       IRDA_DEBUG(0, "%s()\n", __FUNCTION__ );
+       IRDA_DEBUG(0, "%s()\n", __func__ );
        
        IRDA_ASSERT(dev != NULL, return -1;);
        self = (struct w83977af_ir *) dev->priv;
@@ -1252,7 +1252,7 @@ static int w83977af_net_close(struct net_device *dev)
        int iobase;
        __u8 set;
 
-       IRDA_DEBUG(0, "%s()\n", __FUNCTION__ );
+       IRDA_DEBUG(0, "%s()\n", __func__ );
 
        IRDA_ASSERT(dev != NULL, return -1;);
        
@@ -1307,7 +1307,7 @@ static int w83977af_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 
        IRDA_ASSERT(self != NULL, return -1;);
 
-       IRDA_DEBUG(2, "%s(), %s, (cmd=0x%X)\n", __FUNCTION__ , dev->name, cmd);
+       IRDA_DEBUG(2, "%s(), %s, (cmd=0x%X)\n", __func__ , dev->name, cmd);
        
        spin_lock_irqsave(&self->lock, flags);
 
index 8a97a00..46819af 100644 (file)
@@ -55,7 +55,7 @@
 #include <asm/system.h>
 
 static char mv643xx_eth_driver_name[] = "mv643xx_eth";
-static char mv643xx_eth_driver_version[] = "1.1";
+static char mv643xx_eth_driver_version[] = "1.2";
 
 #define MV643XX_ETH_CHECKSUM_OFFLOAD_TX
 #define MV643XX_ETH_NAPI
@@ -90,12 +90,21 @@ static char mv643xx_eth_driver_version[] = "1.1";
 #define PORT_SERIAL_CONTROL(p)         (0x043c + ((p) << 10))
 #define PORT_STATUS(p)                 (0x0444 + ((p) << 10))
 #define  TX_FIFO_EMPTY                 0x00000400
+#define  TX_IN_PROGRESS                        0x00000080
+#define  PORT_SPEED_MASK               0x00000030
+#define  PORT_SPEED_1000               0x00000010
+#define  PORT_SPEED_100                        0x00000020
+#define  PORT_SPEED_10                 0x00000000
+#define  FLOW_CONTROL_ENABLED          0x00000008
+#define  FULL_DUPLEX                   0x00000004
+#define  LINK_UP                       0x00000002
 #define TXQ_COMMAND(p)                 (0x0448 + ((p) << 10))
 #define TXQ_FIX_PRIO_CONF(p)           (0x044c + ((p) << 10))
 #define TX_BW_RATE(p)                  (0x0450 + ((p) << 10))
 #define TX_BW_MTU(p)                   (0x0458 + ((p) << 10))
 #define TX_BW_BURST(p)                 (0x045c + ((p) << 10))
 #define INT_CAUSE(p)                   (0x0460 + ((p) << 10))
+#define  INT_TX_END_0                  0x00080000
 #define  INT_TX_END                    0x07f80000
 #define  INT_RX                                0x0007fbfc
 #define  INT_EXT                       0x00000002
@@ -127,21 +136,21 @@ static char mv643xx_eth_driver_version[] = "1.1";
 /*
  * SDMA configuration register.
  */
-#define RX_BURST_SIZE_4_64BIT          (2 << 1)
+#define RX_BURST_SIZE_16_64BIT         (4 << 1)
 #define BLM_RX_NO_SWAP                 (1 << 4)
 #define BLM_TX_NO_SWAP                 (1 << 5)
-#define TX_BURST_SIZE_4_64BIT          (2 << 22)
+#define TX_BURST_SIZE_16_64BIT         (4 << 22)
 
 #if defined(__BIG_ENDIAN)
 #define PORT_SDMA_CONFIG_DEFAULT_VALUE         \
-               RX_BURST_SIZE_4_64BIT   |       \
-               TX_BURST_SIZE_4_64BIT
+               RX_BURST_SIZE_16_64BIT  |       \
+               TX_BURST_SIZE_16_64BIT
 #elif defined(__LITTLE_ENDIAN)
 #define PORT_SDMA_CONFIG_DEFAULT_VALUE         \
-               RX_BURST_SIZE_4_64BIT   |       \
+               RX_BURST_SIZE_16_64BIT  |       \
                BLM_RX_NO_SWAP          |       \
                BLM_TX_NO_SWAP          |       \
-               TX_BURST_SIZE_4_64BIT
+               TX_BURST_SIZE_16_64BIT
 #else
 #error One of __BIG_ENDIAN or __LITTLE_ENDIAN must be defined
 #endif
@@ -153,9 +162,7 @@ static char mv643xx_eth_driver_version[] = "1.1";
 #define SET_MII_SPEED_TO_100                   (1 << 24)
 #define SET_GMII_SPEED_TO_1000                 (1 << 23)
 #define SET_FULL_DUPLEX_MODE                   (1 << 21)
-#define MAX_RX_PACKET_1522BYTE                 (1 << 17)
 #define MAX_RX_PACKET_9700BYTE                 (5 << 17)
-#define MAX_RX_PACKET_MASK                     (7 << 17)
 #define DISABLE_AUTO_NEG_SPEED_GMII            (1 << 13)
 #define DO_NOT_FORCE_LINK_FAIL                 (1 << 10)
 #define SERIAL_PORT_CONTROL_RESERVED           (1 << 9)
@@ -228,6 +235,8 @@ struct tx_desc {
 #define GEN_IP_V4_CHECKSUM             0x00040000
 #define GEN_TCP_UDP_CHECKSUM           0x00020000
 #define UDP_FRAME                      0x00010000
+#define MAC_HDR_EXTRA_4_BYTES          0x00008000
+#define MAC_HDR_EXTRA_8_BYTES          0x00000200
 
 #define TX_IHL_SHIFT                   11
 
@@ -404,6 +413,17 @@ static void rxq_disable(struct rx_queue *rxq)
                udelay(10);
 }
 
+static void txq_reset_hw_ptr(struct tx_queue *txq)
+{
+       struct mv643xx_eth_private *mp = txq_to_mp(txq);
+       int off = TXQ_CURRENT_DESC_PTR(mp->port_num, txq->index);
+       u32 addr;
+
+       addr = (u32)txq->tx_desc_dma;
+       addr += txq->tx_curr_desc * sizeof(struct tx_desc);
+       wrl(mp, off, addr);
+}
+
 static void txq_enable(struct tx_queue *txq)
 {
        struct mv643xx_eth_private *mp = txq_to_mp(txq);
@@ -614,6 +634,12 @@ static int mv643xx_eth_poll(struct napi_struct *napi, int budget)
                for (i = 0; i < 8; i++)
                        if (mp->txq_mask & (1 << i))
                                txq_reclaim(mp->txq + i, 0);
+
+               if (netif_carrier_ok(mp->dev)) {
+                       spin_lock(&mp->lock);
+                       __txq_maybe_wake(mp->txq + mp->txq_primary);
+                       spin_unlock(&mp->lock);
+               }
        }
 #endif
 
@@ -706,6 +732,7 @@ static inline __be16 sum16_as_be(__sum16 sum)
 
 static void txq_submit_skb(struct tx_queue *txq, struct sk_buff *skb)
 {
+       struct mv643xx_eth_private *mp = txq_to_mp(txq);
        int nr_frags = skb_shinfo(skb)->nr_frags;
        int tx_index;
        struct tx_desc *desc;
@@ -732,12 +759,36 @@ static void txq_submit_skb(struct tx_queue *txq, struct sk_buff *skb)
        desc->buf_ptr = dma_map_single(NULL, skb->data, length, DMA_TO_DEVICE);
 
        if (skb->ip_summed == CHECKSUM_PARTIAL) {
-               BUG_ON(skb->protocol != htons(ETH_P_IP));
+               int mac_hdr_len;
+
+               BUG_ON(skb->protocol != htons(ETH_P_IP) &&
+                      skb->protocol != htons(ETH_P_8021Q));
 
                cmd_sts |= GEN_TCP_UDP_CHECKSUM |
                           GEN_IP_V4_CHECKSUM   |
                           ip_hdr(skb)->ihl << TX_IHL_SHIFT;
 
+               mac_hdr_len = (void *)ip_hdr(skb) - (void *)skb->data;
+               switch (mac_hdr_len - ETH_HLEN) {
+               case 0:
+                       break;
+               case 4:
+                       cmd_sts |= MAC_HDR_EXTRA_4_BYTES;
+                       break;
+               case 8:
+                       cmd_sts |= MAC_HDR_EXTRA_8_BYTES;
+                       break;
+               case 12:
+                       cmd_sts |= MAC_HDR_EXTRA_4_BYTES;
+                       cmd_sts |= MAC_HDR_EXTRA_8_BYTES;
+                       break;
+               default:
+                       if (net_ratelimit())
+                               dev_printk(KERN_ERR, &txq_to_mp(txq)->dev->dev,
+                                  "mac header length is %d?!\n", mac_hdr_len);
+                       break;
+               }
+
                switch (ip_hdr(skb)->protocol) {
                case IPPROTO_UDP:
                        cmd_sts |= UDP_FRAME;
@@ -759,6 +810,10 @@ static void txq_submit_skb(struct tx_queue *txq, struct sk_buff *skb)
        wmb();
        desc->cmd_sts = cmd_sts;
 
+       /* clear TX_END interrupt status */
+       wrl(mp, INT_CAUSE(mp->port_num), ~(INT_TX_END_0 << txq->index));
+       rdl(mp, INT_CAUSE(mp->port_num));
+
        /* ensure all descriptors are written before poking hardware */
        wmb();
        txq_enable(txq);
@@ -1112,10 +1167,28 @@ static int mv643xx_eth_get_settings(struct net_device *dev, struct ethtool_cmd *
 
 static int mv643xx_eth_get_settings_phyless(struct net_device *dev, struct ethtool_cmd *cmd)
 {
+       struct mv643xx_eth_private *mp = netdev_priv(dev);
+       u32 port_status;
+
+       port_status = rdl(mp, PORT_STATUS(mp->port_num));
+
        cmd->supported = SUPPORTED_MII;
        cmd->advertising = ADVERTISED_MII;
-       cmd->speed = SPEED_1000;
-       cmd->duplex = DUPLEX_FULL;
+       switch (port_status & PORT_SPEED_MASK) {
+       case PORT_SPEED_10:
+               cmd->speed = SPEED_10;
+               break;
+       case PORT_SPEED_100:
+               cmd->speed = SPEED_100;
+               break;
+       case PORT_SPEED_1000:
+               cmd->speed = SPEED_1000;
+               break;
+       default:
+               cmd->speed = -1;
+               break;
+       }
+       cmd->duplex = (port_status & FULL_DUPLEX) ? DUPLEX_FULL : DUPLEX_HALF;
        cmd->port = PORT_MII;
        cmd->phy_address = 0;
        cmd->transceiver = XCVR_INTERNAL;
@@ -1539,8 +1612,11 @@ static int txq_init(struct mv643xx_eth_private *mp, int index)
 
        tx_desc = (struct tx_desc *)txq->tx_desc_area;
        for (i = 0; i < txq->tx_ring_size; i++) {
+               struct tx_desc *txd = tx_desc + i;
                int nexti = (i + 1) % txq->tx_ring_size;
-               tx_desc[i].next_desc_ptr = txq->tx_desc_dma +
+
+               txd->cmd_sts = 0;
+               txd->next_desc_ptr = txq->tx_desc_dma +
                                        nexti * sizeof(struct tx_desc);
        }
 
@@ -1577,8 +1653,11 @@ static void txq_reclaim(struct tx_queue *txq, int force)
                desc = &txq->tx_desc_area[tx_index];
                cmd_sts = desc->cmd_sts;
 
-               if (!force && (cmd_sts & BUFFER_OWNED_BY_DMA))
-                       break;
+               if (cmd_sts & BUFFER_OWNED_BY_DMA) {
+                       if (!force)
+                               break;
+                       desc->cmd_sts = cmd_sts & ~BUFFER_OWNED_BY_DMA;
+               }
 
                txq->tx_used_desc = (tx_index + 1) % txq->tx_ring_size;
                txq->tx_desc_count--;
@@ -1632,49 +1711,61 @@ static void txq_deinit(struct tx_queue *txq)
 
 
 /* netdev ops and related ***************************************************/
-static void update_pscr(struct mv643xx_eth_private *mp, int speed, int duplex)
+static void handle_link_event(struct mv643xx_eth_private *mp)
 {
-       u32 pscr_o;
-       u32 pscr_n;
-
-       pscr_o = rdl(mp, PORT_SERIAL_CONTROL(mp->port_num));
+       struct net_device *dev = mp->dev;
+       u32 port_status;
+       int speed;
+       int duplex;
+       int fc;
+
+       port_status = rdl(mp, PORT_STATUS(mp->port_num));
+       if (!(port_status & LINK_UP)) {
+               if (netif_carrier_ok(dev)) {
+                       int i;
 
-       /* clear speed, duplex and rx buffer size fields */
-       pscr_n = pscr_o & ~(SET_MII_SPEED_TO_100   |
-                           SET_GMII_SPEED_TO_1000 |
-                           SET_FULL_DUPLEX_MODE   |
-                           MAX_RX_PACKET_MASK);
+                       printk(KERN_INFO "%s: link down\n", dev->name);
 
-       if (speed == SPEED_1000) {
-               pscr_n |= SET_GMII_SPEED_TO_1000 | MAX_RX_PACKET_9700BYTE;
-       } else {
-               if (speed == SPEED_100)
-                       pscr_n |= SET_MII_SPEED_TO_100;
-               pscr_n |= MAX_RX_PACKET_1522BYTE;
-       }
+                       netif_carrier_off(dev);
+                       netif_stop_queue(dev);
 
-       if (duplex == DUPLEX_FULL)
-               pscr_n |= SET_FULL_DUPLEX_MODE;
+                       for (i = 0; i < 8; i++) {
+                               struct tx_queue *txq = mp->txq + i;
 
-       if (pscr_n != pscr_o) {
-               if ((pscr_o & SERIAL_PORT_ENABLE) == 0)
-                       wrl(mp, PORT_SERIAL_CONTROL(mp->port_num), pscr_n);
-               else {
-                       int i;
+                               if (mp->txq_mask & (1 << i)) {
+                                       txq_reclaim(txq, 1);
+                                       txq_reset_hw_ptr(txq);
+                               }
+                       }
+               }
+               return;
+       }
 
-                       for (i = 0; i < 8; i++)
-                               if (mp->txq_mask & (1 << i))
-                                       txq_disable(mp->txq + i);
+       switch (port_status & PORT_SPEED_MASK) {
+       case PORT_SPEED_10:
+               speed = 10;
+               break;
+       case PORT_SPEED_100:
+               speed = 100;
+               break;
+       case PORT_SPEED_1000:
+               speed = 1000;
+               break;
+       default:
+               speed = -1;
+               break;
+       }
+       duplex = (port_status & FULL_DUPLEX) ? 1 : 0;
+       fc = (port_status & FLOW_CONTROL_ENABLED) ? 1 : 0;
 
-                       pscr_o &= ~SERIAL_PORT_ENABLE;
-                       wrl(mp, PORT_SERIAL_CONTROL(mp->port_num), pscr_o);
-                       wrl(mp, PORT_SERIAL_CONTROL(mp->port_num), pscr_n);
-                       wrl(mp, PORT_SERIAL_CONTROL(mp->port_num), pscr_n);
+       printk(KERN_INFO "%s: link up, %d Mb/s, %s duplex, "
+                        "flow control %sabled\n", dev->name,
+                        speed, duplex ? "full" : "half",
+                        fc ? "en" : "dis");
 
-                       for (i = 0; i < 8; i++)
-                               if (mp->txq_mask & (1 << i))
-                                       txq_enable(mp->txq + i);
-               }
+       if (!netif_carrier_ok(dev)) {
+               netif_carrier_on(dev);
+               netif_wake_queue(dev);
        }
 }
 
@@ -1684,7 +1775,6 @@ static irqreturn_t mv643xx_eth_irq(int irq, void *dev_id)
        struct mv643xx_eth_private *mp = netdev_priv(dev);
        u32 int_cause;
        u32 int_cause_ext;
-       u32 txq_active;
 
        int_cause = rdl(mp, INT_CAUSE(mp->port_num)) &
                        (INT_TX_END | INT_RX | INT_EXT);
@@ -1698,30 +1788,8 @@ static irqreturn_t mv643xx_eth_irq(int irq, void *dev_id)
                wrl(mp, INT_CAUSE_EXT(mp->port_num), ~int_cause_ext);
        }
 
-       if (int_cause_ext & (INT_EXT_PHY | INT_EXT_LINK)) {
-               if (mp->phy_addr == -1 || mii_link_ok(&mp->mii)) {
-                       int i;
-
-                       if (mp->phy_addr != -1) {
-                               struct ethtool_cmd cmd;
-
-                               mii_ethtool_gset(&mp->mii, &cmd);
-                               update_pscr(mp, cmd.speed, cmd.duplex);
-                       }
-
-                       for (i = 0; i < 8; i++)
-                               if (mp->txq_mask & (1 << i))
-                                       txq_enable(mp->txq + i);
-
-                       if (!netif_carrier_ok(dev)) {
-                               netif_carrier_on(dev);
-                               __txq_maybe_wake(mp->txq + mp->txq_primary);
-                       }
-               } else if (netif_carrier_ok(dev)) {
-                       netif_stop_queue(dev);
-                       netif_carrier_off(dev);
-               }
-       }
+       if (int_cause_ext & (INT_EXT_PHY | INT_EXT_LINK))
+               handle_link_event(mp);
 
        /*
         * RxBuffer or RxError set for any of the 8 queues?
@@ -1743,8 +1811,6 @@ static irqreturn_t mv643xx_eth_irq(int irq, void *dev_id)
        }
 #endif
 
-       txq_active = rdl(mp, TXQ_COMMAND(mp->port_num));
-
        /*
         * TxBuffer or TxError set for any of the 8 queues?
         */
@@ -1754,6 +1820,16 @@ static irqreturn_t mv643xx_eth_irq(int irq, void *dev_id)
                for (i = 0; i < 8; i++)
                        if (mp->txq_mask & (1 << i))
                                txq_reclaim(mp->txq + i, 0);
+
+               /*
+                * Enough space again in the primary TX queue for a
+                * full packet?
+                */
+               if (netif_carrier_ok(dev)) {
+                       spin_lock(&mp->lock);
+                       __txq_maybe_wake(mp->txq + mp->txq_primary);
+                       spin_unlock(&mp->lock);
+               }
        }
 
        /*
@@ -1763,19 +1839,25 @@ static irqreturn_t mv643xx_eth_irq(int irq, void *dev_id)
                int i;
 
                wrl(mp, INT_CAUSE(mp->port_num), ~(int_cause & INT_TX_END));
+
+               spin_lock(&mp->lock);
                for (i = 0; i < 8; i++) {
                        struct tx_queue *txq = mp->txq + i;
-                       if (txq->tx_desc_count && !((txq_active >> i) & 1))
+                       u32 hw_desc_ptr;
+                       u32 expected_ptr;
+
+                       if ((int_cause & (INT_TX_END_0 << i)) == 0)
+                               continue;
+
+                       hw_desc_ptr =
+                               rdl(mp, TXQ_CURRENT_DESC_PTR(mp->port_num, i));
+                       expected_ptr = (u32)txq->tx_desc_dma +
+                               txq->tx_curr_desc * sizeof(struct tx_desc);
+
+                       if (hw_desc_ptr != expected_ptr)
                                txq_enable(txq);
                }
-       }
-
-       /*
-        * Enough space again in the primary TX queue for a full packet?
-        */
-       if (int_cause_ext & INT_EXT_TX) {
-               struct tx_queue *txq = mp->txq + mp->txq_primary;
-               __txq_maybe_wake(txq);
+               spin_unlock(&mp->lock);
        }
 
        return IRQ_HANDLED;
@@ -1785,14 +1867,14 @@ static void phy_reset(struct mv643xx_eth_private *mp)
 {
        unsigned int data;
 
-       smi_reg_read(mp, mp->phy_addr, 0, &data);
-       data |= 0x8000;
-       smi_reg_write(mp, mp->phy_addr, 0, data);
+       smi_reg_read(mp, mp->phy_addr, MII_BMCR, &data);
+       data |= BMCR_RESET;
+       smi_reg_write(mp, mp->phy_addr, MII_BMCR, data);
 
        do {
                udelay(1);
-               smi_reg_read(mp, mp->phy_addr, 0, &data);
-       } while (data & 0x8000);
+               smi_reg_read(mp, mp->phy_addr, MII_BMCR, &data);
+       } while (data & BMCR_RESET);
 }
 
 static void port_start(struct mv643xx_eth_private *mp)
@@ -1800,23 +1882,6 @@ static void port_start(struct mv643xx_eth_private *mp)
        u32 pscr;
        int i;
 
-       /*
-        * Configure basic link parameters.
-        */
-       pscr = rdl(mp, PORT_SERIAL_CONTROL(mp->port_num));
-       pscr &= ~(SERIAL_PORT_ENABLE | FORCE_LINK_PASS);
-       wrl(mp, PORT_SERIAL_CONTROL(mp->port_num), pscr);
-       pscr |= DISABLE_AUTO_NEG_FOR_FLOW_CTRL |
-               DISABLE_AUTO_NEG_SPEED_GMII    |
-               DISABLE_AUTO_NEG_FOR_DUPLEX    |
-               DO_NOT_FORCE_LINK_FAIL         |
-               SERIAL_PORT_CONTROL_RESERVED;
-       wrl(mp, PORT_SERIAL_CONTROL(mp->port_num), pscr);
-       pscr |= SERIAL_PORT_ENABLE;
-       wrl(mp, PORT_SERIAL_CONTROL(mp->port_num), pscr);
-
-       wrl(mp, SDMA_CONFIG(mp->port_num), PORT_SDMA_CONFIG_DEFAULT_VALUE);
-
        /*
         * Perform PHY reset, if there is a PHY.
         */
@@ -1828,22 +1893,32 @@ static void port_start(struct mv643xx_eth_private *mp)
                mv643xx_eth_set_settings(mp->dev, &cmd);
        }
 
+       /*
+        * Configure basic link parameters.
+        */
+       pscr = rdl(mp, PORT_SERIAL_CONTROL(mp->port_num));
+
+       pscr |= SERIAL_PORT_ENABLE;
+       wrl(mp, PORT_SERIAL_CONTROL(mp->port_num), pscr);
+
+       pscr |= DO_NOT_FORCE_LINK_FAIL;
+       if (mp->phy_addr == -1)
+               pscr |= FORCE_LINK_PASS;
+       wrl(mp, PORT_SERIAL_CONTROL(mp->port_num), pscr);
+
+       wrl(mp, SDMA_CONFIG(mp->port_num), PORT_SDMA_CONFIG_DEFAULT_VALUE);
+
        /*
         * Configure TX path and queues.
         */
        tx_set_rate(mp, 1000000000, 16777216);
        for (i = 0; i < 8; i++) {
                struct tx_queue *txq = mp->txq + i;
-               int off = TXQ_CURRENT_DESC_PTR(mp->port_num, i);
-               u32 addr;
 
                if ((mp->txq_mask & (1 << i)) == 0)
                        continue;
 
-               addr = (u32)txq->tx_desc_dma;
-               addr += txq->tx_curr_desc * sizeof(struct tx_desc);
-               wrl(mp, off, addr);
-
+               txq_reset_hw_ptr(txq);
                txq_set_rate(txq, 1000000000, 16777216);
                txq_set_fixed_prio_mode(txq);
        }
@@ -1965,6 +2040,9 @@ static int mv643xx_eth_open(struct net_device *dev)
        napi_enable(&mp->napi);
 #endif
 
+       netif_carrier_off(dev);
+       netif_stop_queue(dev);
+
        port_start(mp);
 
        set_rx_coal(mp, 0);
@@ -1999,8 +2077,14 @@ static void port_reset(struct mv643xx_eth_private *mp)
                if (mp->txq_mask & (1 << i))
                        txq_disable(mp->txq + i);
        }
-       while (!(rdl(mp, PORT_STATUS(mp->port_num)) & TX_FIFO_EMPTY))
+
+       while (1) {
+               u32 ps = rdl(mp, PORT_STATUS(mp->port_num));
+
+               if ((ps & (TX_IN_PROGRESS | TX_FIFO_EMPTY)) == TX_FIFO_EMPTY)
+                       break;
                udelay(10);
+       }
 
        /* Reset the Enable bit in the Configuration Register */
        data = rdl(mp, PORT_SERIAL_CONTROL(mp->port_num));
@@ -2202,7 +2286,8 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
        int ret;
 
        if (!mv643xx_eth_version_printed++)
-               printk(KERN_NOTICE "MV-643xx 10/100/1000 Ethernet Driver\n");
+               printk(KERN_NOTICE "MV-643xx 10/100/1000 ethernet "
+                       "driver version %s\n", mv643xx_eth_driver_version);
 
        ret = -EINVAL;
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -2338,14 +2423,14 @@ static int phy_detect(struct mv643xx_eth_private *mp)
        unsigned int data;
        unsigned int data2;
 
-       smi_reg_read(mp, mp->phy_addr, 0, &data);
-       smi_reg_write(mp, mp->phy_addr, 0, data ^ 0x1000);
+       smi_reg_read(mp, mp->phy_addr, MII_BMCR, &data);
+       smi_reg_write(mp, mp->phy_addr, MII_BMCR, data ^ BMCR_ANENABLE);
 
-       smi_reg_read(mp, mp->phy_addr, 0, &data2);
-       if (((data ^ data2) & 0x1000) == 0)
+       smi_reg_read(mp, mp->phy_addr, MII_BMCR, &data2);
+       if (((data ^ data2) & BMCR_ANENABLE) == 0)
                return -ENODEV;
 
-       smi_reg_write(mp, mp->phy_addr, 0, data);
+       smi_reg_write(mp, mp->phy_addr, MII_BMCR, data);
 
        return 0;
 }
@@ -2393,12 +2478,39 @@ static int phy_init(struct mv643xx_eth_private *mp,
                cmd.duplex = pd->duplex;
        }
 
-       update_pscr(mp, cmd.speed, cmd.duplex);
        mv643xx_eth_set_settings(mp->dev, &cmd);
 
        return 0;
 }
 
+static void init_pscr(struct mv643xx_eth_private *mp, int speed, int duplex)
+{
+       u32 pscr;
+
+       pscr = rdl(mp, PORT_SERIAL_CONTROL(mp->port_num));
+       if (pscr & SERIAL_PORT_ENABLE) {
+               pscr &= ~SERIAL_PORT_ENABLE;
+               wrl(mp, PORT_SERIAL_CONTROL(mp->port_num), pscr);
+       }
+
+       pscr = MAX_RX_PACKET_9700BYTE | SERIAL_PORT_CONTROL_RESERVED;
+       if (mp->phy_addr == -1) {
+               pscr |= DISABLE_AUTO_NEG_SPEED_GMII;
+               if (speed == SPEED_1000)
+                       pscr |= SET_GMII_SPEED_TO_1000;
+               else if (speed == SPEED_100)
+                       pscr |= SET_MII_SPEED_TO_100;
+
+               pscr |= DISABLE_AUTO_NEG_FOR_FLOW_CTRL;
+
+               pscr |= DISABLE_AUTO_NEG_FOR_DUPLEX;
+               if (duplex == DUPLEX_FULL)
+                       pscr |= SET_FULL_DUPLEX_MODE;
+       }
+
+       wrl(mp, PORT_SERIAL_CONTROL(mp->port_num), pscr);
+}
+
 static int mv643xx_eth_probe(struct platform_device *pdev)
 {
        struct mv643xx_eth_platform_data *pd;
@@ -2452,6 +2564,7 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
        } else {
                SET_ETHTOOL_OPS(dev, &mv643xx_eth_ethtool_ops_phyless);
        }
+       init_pscr(mp, pd->speed, pd->duplex);
 
 
        res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
@@ -2478,6 +2591,7 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
         * have to map the buffers to ISA memory which is only 16 MB
         */
        dev->features = NETIF_F_SG | NETIF_F_IP_CSUM;
+       dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM;
 #endif
 
        SET_NETDEV_DEV(dev, &pdev->dev);
index 2fec612..42443d6 100644 (file)
@@ -536,7 +536,7 @@ static int __init ne_probe1(struct net_device *dev, unsigned long ioaddr)
 #ifdef CONFIG_NET_POLL_CONTROLLER
        dev->poll_controller = eip_poll;
 #endif
-       NS8390_init(dev, 0);
+       NS8390p_init(dev, 0);
 
        ret = register_netdev(dev);
        if (ret)
@@ -794,7 +794,7 @@ retry:
                if (time_after(jiffies, dma_start + 2*HZ/100)) {                /* 20ms */
                        printk(KERN_WARNING "%s: timeout waiting for Tx RDC.\n", dev->name);
                        ne_reset_8390(dev);
-                       NS8390_init(dev,1);
+                       NS8390p_init(dev, 1);
                        break;
                }
 
@@ -855,7 +855,7 @@ static int ne_drv_resume(struct platform_device *pdev)
 
        if (netif_running(dev)) {
                ne_reset_8390(dev);
-               NS8390_init(dev, 1);
+               NS8390p_init(dev, 1);
                netif_device_attach(dev);
        }
        return 0;
index e13966b..9681618 100644 (file)
@@ -53,7 +53,7 @@ MODULE_LICENSE("GPL");
 
 static char config[MAX_PARAM_LENGTH];
 module_param_string(netconsole, config, MAX_PARAM_LENGTH, 0);
-MODULE_PARM_DESC(netconsole, " netconsole=[src-port]@[src-ip]/[dev],[tgt-port]@<tgt-ip>/[tgt-macaddr]\n");
+MODULE_PARM_DESC(netconsole, " netconsole=[src-port]@[src-ip]/[dev],[tgt-port]@<tgt-ip>/[tgt-macaddr]");
 
 #ifndef        MODULE
 static int __init option_setup(char *opt)
index 8ee7d7b..e4765b7 100644 (file)
@@ -6417,7 +6417,7 @@ static int niu_ethflow_to_class(int flow_type, u64 *class)
                *class = CLASS_CODE_SCTP_IPV6;
                break;
        default:
-               return -1;
+               return 0;
        }
 
        return 1;
index 6b2dee0..a834b52 100644 (file)
@@ -1024,7 +1024,7 @@ static int gelic_wl_set_encode(struct net_device *netdev,
        struct gelic_wl_info *wl = port_wl(netdev_priv(netdev));
        struct iw_point *enc = &data->encoding;
        __u16 flags;
-       unsigned int irqflag;
+       unsigned long irqflag;
        int key_index, index_specified;
        int ret = 0;
 
@@ -1097,7 +1097,7 @@ static int gelic_wl_get_encode(struct net_device *netdev,
 {
        struct gelic_wl_info *wl = port_wl(netdev_priv(netdev));
        struct iw_point *enc = &data->encoding;
-       unsigned int irqflag;
+       unsigned long irqflag;
        unsigned int key_index, index_specified;
        int ret = 0;
 
@@ -1215,7 +1215,7 @@ static int gelic_wl_set_encodeext(struct net_device *netdev,
        struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
        __u16 alg;
        __u16 flags;
-       unsigned int irqflag;
+       unsigned long irqflag;
        int key_index;
        int ret = 0;
 
@@ -1303,7 +1303,7 @@ static int gelic_wl_get_encodeext(struct net_device *netdev,
        struct gelic_wl_info *wl = port_wl(netdev_priv(netdev));
        struct iw_point *enc = &data->encoding;
        struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
-       unsigned int irqflag;
+       unsigned long irqflag;
        int key_index;
        int ret = 0;
        int max_key_len;
@@ -1426,7 +1426,7 @@ static int gelic_wl_priv_set_psk(struct net_device *net_dev,
 {
        struct gelic_wl_info *wl = port_wl(netdev_priv(net_dev));
        unsigned int len;
-       unsigned int irqflag;
+       unsigned long irqflag;
        int ret = 0;
 
        pr_debug("%s:<- len=%d\n", __func__, data->data.length);
@@ -1467,7 +1467,7 @@ static int gelic_wl_priv_get_psk(struct net_device *net_dev,
 {
        struct gelic_wl_info *wl = port_wl(netdev_priv(net_dev));
        char *p;
-       unsigned int irqflag;
+       unsigned long irqflag;
        unsigned int i;
 
        pr_debug("%s:<-\n", __func__);
index 86d77d0..a2b0730 100644 (file)
@@ -3143,7 +3143,7 @@ static void tx_intr_handler(struct fifo_info *fifo_data)
                pkt_cnt++;
 
                /* Updating the statistics block */
-               nic->stats.tx_bytes += skb->len;
+               nic->dev->stats.tx_bytes += skb->len;
                nic->mac_control.stats_info->sw_stat.mem_freed += skb->truesize;
                dev_kfree_skb_irq(skb);
 
@@ -4896,25 +4896,42 @@ static struct net_device_stats *s2io_get_stats(struct net_device *dev)
        /* Configure Stats for immediate updt */
        s2io_updt_stats(sp);
 
+       /* Using sp->stats as a staging area, because reset (due to mtu
+          change, for example) will clear some hardware counters */
+       dev->stats.tx_packets +=
+               le32_to_cpu(mac_control->stats_info->tmac_frms) - 
+               sp->stats.tx_packets;
        sp->stats.tx_packets =
                le32_to_cpu(mac_control->stats_info->tmac_frms);
+       dev->stats.tx_errors +=
+               le32_to_cpu(mac_control->stats_info->tmac_any_err_frms) -
+               sp->stats.tx_errors;
        sp->stats.tx_errors =
                le32_to_cpu(mac_control->stats_info->tmac_any_err_frms);
+       dev->stats.rx_errors +=
+               le64_to_cpu(mac_control->stats_info->rmac_drop_frms) -
+               sp->stats.rx_errors;
        sp->stats.rx_errors =
                le64_to_cpu(mac_control->stats_info->rmac_drop_frms);
+       dev->stats.multicast =
+               le32_to_cpu(mac_control->stats_info->rmac_vld_mcst_frms) - 
+               sp->stats.multicast;
        sp->stats.multicast =
                le32_to_cpu(mac_control->stats_info->rmac_vld_mcst_frms);
+       dev->stats.rx_length_errors =
+               le64_to_cpu(mac_control->stats_info->rmac_long_frms) - 
+               sp->stats.rx_length_errors;
        sp->stats.rx_length_errors =
                le64_to_cpu(mac_control->stats_info->rmac_long_frms);
 
        /* collect per-ring rx_packets and rx_bytes */
-       sp->stats.rx_packets = sp->stats.rx_bytes = 0;
+       dev->stats.rx_packets = dev->stats.rx_bytes = 0;
        for (i = 0; i < config->rx_ring_num; i++) {
-               sp->stats.rx_packets += mac_control->rings[i].rx_packets;
-               sp->stats.rx_bytes += mac_control->rings[i].rx_bytes;
+               dev->stats.rx_packets += mac_control->rings[i].rx_packets;
+               dev->stats.rx_bytes += mac_control->rings[i].rx_bytes;
        }
 
-       return (&sp->stats);
+       return (&dev->stats);
 }
 
 /**
@@ -7419,7 +7436,7 @@ static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp)
                if (err_mask != 0x5) {
                        DBG_PRINT(ERR_DBG, "%s: Rx error Value: 0x%x\n",
                                dev->name, err_mask);
-                       sp->stats.rx_crc_errors++;
+                       dev->stats.rx_crc_errors++;
                        sp->mac_control.stats_info->sw_stat.mem_freed
                                += skb->truesize;
                        dev_kfree_skb(skb);
index c69ba13..6a06b95 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  SuperH Ethernet device driver
  *
- *  Copyright (C) 2006,2007 Nobuhiro Iwamatsu
+ *  Copyright (C) 2006-2008 Nobuhiro Iwamatsu
  *  Copyright (C) 2008 Renesas Solutions Corp.
  *
  *  This program is free software; you can redistribute it and/or modify it
@@ -143,13 +143,39 @@ static struct mdiobb_ops bb_ops = {
        .get_mdio_data = sh_get_mdio,
 };
 
+/* Chip Reset */
 static void sh_eth_reset(struct net_device *ndev)
 {
        u32 ioaddr = ndev->base_addr;
 
+#if defined(CONFIG_CPU_SUBTYPE_SH7763)
+       int cnt = 100;
+
+       ctrl_outl(EDSR_ENALL, ioaddr + EDSR);
+       ctrl_outl(ctrl_inl(ioaddr + EDMR) | EDMR_SRST, ioaddr + EDMR);
+       while (cnt > 0) {
+               if (!(ctrl_inl(ioaddr + EDMR) & 0x3))
+                       break;
+               mdelay(1);
+               cnt--;
+       }
+       if (cnt < 0)
+               printk(KERN_ERR "Device reset fail\n");
+
+       /* Table Init */
+       ctrl_outl(0x0, ioaddr + TDLAR);
+       ctrl_outl(0x0, ioaddr + TDFAR);
+       ctrl_outl(0x0, ioaddr + TDFXR);
+       ctrl_outl(0x0, ioaddr + TDFFR);
+       ctrl_outl(0x0, ioaddr + RDLAR);
+       ctrl_outl(0x0, ioaddr + RDFAR);
+       ctrl_outl(0x0, ioaddr + RDFXR);
+       ctrl_outl(0x0, ioaddr + RDFFR);
+#else
        ctrl_outl(ctrl_inl(ioaddr + EDMR) | EDMR_SRST, ioaddr + EDMR);
        mdelay(3);
        ctrl_outl(ctrl_inl(ioaddr + EDMR) & ~EDMR_SRST, ioaddr + EDMR);
+#endif
 }
 
 /* free skb and descriptor buffer */
@@ -180,6 +206,7 @@ static void sh_eth_ring_free(struct net_device *ndev)
 /* format skb and descriptor buffer */
 static void sh_eth_ring_format(struct net_device *ndev)
 {
+       u32 ioaddr = ndev->base_addr, reserve = 0;
        struct sh_eth_private *mdp = netdev_priv(ndev);
        int i;
        struct sk_buff *skb;
@@ -201,9 +228,15 @@ static void sh_eth_ring_format(struct net_device *ndev)
                mdp->rx_skbuff[i] = skb;
                if (skb == NULL)
                        break;
-               skb->dev = ndev;        /* Mark as being used by this device. */
+               skb->dev = ndev; /* Mark as being used by this device. */
+#if defined(CONFIG_CPU_SUBTYPE_SH7763)
+               reserve = SH7763_SKB_ALIGN
+                       - ((uint32_t)skb->data & (SH7763_SKB_ALIGN-1));
+               if (reserve)
+                       skb_reserve(skb, reserve);
+#else
                skb_reserve(skb, RX_OFFSET);
-
+#endif
                /* RX descriptor */
                rxdesc = &mdp->rx_ring[i];
                rxdesc->addr = (u32)skb->data & ~0x3UL;
@@ -211,12 +244,25 @@ static void sh_eth_ring_format(struct net_device *ndev)
 
                /* The size of the buffer is 16 byte boundary. */
                rxdesc->buffer_length = (mdp->rx_buf_sz + 16) & ~0x0F;
+               /* Rx descriptor address set */
+               if (i == 0) {
+                       ctrl_outl((u32)rxdesc, ioaddr + RDLAR);
+#if defined(CONFIG_CPU_SUBTYPE_SH7763)
+                       ctrl_outl((u32)rxdesc, ioaddr + RDFAR);
+#endif
+               }
        }
 
+       /* Rx descriptor address set */
+#if defined(CONFIG_CPU_SUBTYPE_SH7763)
+       ctrl_outl((u32)rxdesc, ioaddr + RDFXR);
+       ctrl_outl(0x1, ioaddr + RDFFR);
+#endif
+
        mdp->dirty_rx = (u32) (i - RX_RING_SIZE);
 
        /* Mark the last entry as wrapping the ring. */
-       rxdesc->status |= cpu_to_le32(RC_RDEL);
+       rxdesc->status |= cpu_to_le32(RD_RDEL);
 
        memset(mdp->tx_ring, 0, tx_ringsize);
 
@@ -226,8 +272,21 @@ static void sh_eth_ring_format(struct net_device *ndev)
                txdesc = &mdp->tx_ring[i];
                txdesc->status = cpu_to_le32(TD_TFP);
                txdesc->buffer_length = 0;
+               if (i == 0) {
+                       /* Rx descriptor address set */
+                       ctrl_outl((u32)txdesc, ioaddr + TDLAR);
+#if defined(CONFIG_CPU_SUBTYPE_SH7763)
+                       ctrl_outl((u32)txdesc, ioaddr + TDFAR);
+#endif
+               }
        }
 
+       /* Rx descriptor address set */
+#if defined(CONFIG_CPU_SUBTYPE_SH7763)
+       ctrl_outl((u32)txdesc, ioaddr + TDFXR);
+       ctrl_outl(0x1, ioaddr + TDFFR);
+#endif
+
        txdesc->status |= cpu_to_le32(TD_TDLE);
 }
 
@@ -311,31 +370,43 @@ static int sh_eth_dev_init(struct net_device *ndev)
        /* Soft Reset */
        sh_eth_reset(ndev);
 
-       ctrl_outl(RPADIR_PADS1, ioaddr + RPADIR);       /* SH7712-DMA-RX-PAD2 */
+       /* Descriptor format */
+       sh_eth_ring_format(ndev);
+       ctrl_outl(RPADIR_INIT, ioaddr + RPADIR);
 
        /* all sh_eth int mask */
        ctrl_outl(0, ioaddr + EESIPR);
 
-       /* FIFO size set */
+#if defined(CONFIG_CPU_SUBTYPE_SH7763)
+       ctrl_outl(EDMR_EL, ioaddr + EDMR);
+#else
        ctrl_outl(0, ioaddr + EDMR);    /* Endian change */
+#endif
 
+       /* FIFO size set */
        ctrl_outl((FIFO_SIZE_T | FIFO_SIZE_R), ioaddr + FDR);
        ctrl_outl(0, ioaddr + TFTR);
 
+       /* Frame recv control */
        ctrl_outl(0, ioaddr + RMCR);
 
        rx_int_var = mdp->rx_int_var = DESC_I_RINT8 | DESC_I_RINT5;
        tx_int_var = mdp->tx_int_var = DESC_I_TINT2;
        ctrl_outl(rx_int_var | tx_int_var, ioaddr + TRSCER);
 
+#if defined(CONFIG_CPU_SUBTYPE_SH7763)
+       /* Burst sycle set */
+       ctrl_outl(0x800, ioaddr + BCULR);
+#endif
+
        ctrl_outl((FIFO_F_D_RFF | FIFO_F_D_RFD), ioaddr + FCFTR);
-       ctrl_outl(0, ioaddr + TRIMD);
 
-       /* Descriptor format */
-       sh_eth_ring_format(ndev);
+#if !defined(CONFIG_CPU_SUBTYPE_SH7763)
+       ctrl_outl(0, ioaddr + TRIMD);
+#endif
 
-       ctrl_outl((u32)mdp->rx_ring, ioaddr + RDLAR);
-       ctrl_outl((u32)mdp->tx_ring, ioaddr + TDLAR);
+       /* Recv frame limit set register */
+       ctrl_outl(RFLR_VALUE, ioaddr + RFLR);
 
        ctrl_outl(ctrl_inl(ioaddr + EESR), ioaddr + EESR);
        ctrl_outl((DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff), ioaddr + EESIPR);
@@ -345,21 +416,26 @@ static int sh_eth_dev_init(struct net_device *ndev)
                ECMR_ZPF | (mdp->duplex ? ECMR_DM : 0) | ECMR_TE | ECMR_RE;
 
        ctrl_outl(val, ioaddr + ECMR);
-       ctrl_outl(ECSR_BRCRX | ECSR_PSRTO | ECSR_LCHNG | ECSR_ICD |
-                 ECSIPR_MPDIP, ioaddr + ECSR);
-       ctrl_outl(ECSIPR_BRCRXIP | ECSIPR_PSRTOIP | ECSIPR_LCHNGIP |
-                 ECSIPR_ICDIP | ECSIPR_MPDIP, ioaddr + ECSIPR);
+
+       /* E-MAC Status Register clear */
+       ctrl_outl(ECSR_INIT, ioaddr + ECSR);
+
+       /* E-MAC Interrupt Enable register */
+       ctrl_outl(ECSIPR_INIT, ioaddr + ECSIPR);
 
        /* Set MAC address */
        update_mac_address(ndev);
 
        /* mask reset */
-#if defined(CONFIG_CPU_SUBTYPE_SH7710)
+#if defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7763)
        ctrl_outl(APR_AP, ioaddr + APR);
        ctrl_outl(MPR_MP, ioaddr + MPR);
        ctrl_outl(TPAUSER_UNLIMITED, ioaddr + TPAUSER);
+#endif
+#if defined(CONFIG_CPU_SUBTYPE_SH7710)
        ctrl_outl(BCFR_UNLIMITED, ioaddr + BCFR);
 #endif
+
        /* Setting the Rx mode will start the Rx process. */
        ctrl_outl(EDRRR_R, ioaddr + EDRRR);
 
@@ -407,7 +483,7 @@ static int sh_eth_rx(struct net_device *ndev)
        int boguscnt = (mdp->dirty_rx + RX_RING_SIZE) - mdp->cur_rx;
        struct sk_buff *skb;
        u16 pkt_len = 0;
-       u32 desc_status;
+       u32 desc_status, reserve = 0;
 
        rxdesc = &mdp->rx_ring[entry];
        while (!(rxdesc->status & cpu_to_le32(RD_RACT))) {
@@ -454,28 +530,38 @@ static int sh_eth_rx(struct net_device *ndev)
        for (; mdp->cur_rx - mdp->dirty_rx > 0; mdp->dirty_rx++) {
                entry = mdp->dirty_rx % RX_RING_SIZE;
                rxdesc = &mdp->rx_ring[entry];
+               /* The size of the buffer is 16 byte boundary. */
+               rxdesc->buffer_length = (mdp->rx_buf_sz + 16) & ~0x0F;
+
                if (mdp->rx_skbuff[entry] == NULL) {
                        skb = dev_alloc_skb(mdp->rx_buf_sz);
                        mdp->rx_skbuff[entry] = skb;
                        if (skb == NULL)
                                break;  /* Better luck next round. */
                        skb->dev = ndev;
+#if defined(CONFIG_CPU_SUBTYPE_SH7763)
+                       reserve = SH7763_SKB_ALIGN
+                               - ((uint32_t)skb->data & (SH7763_SKB_ALIGN-1));
+                       if (reserve)
+                               skb_reserve(skb, reserve);
+#else
                        skb_reserve(skb, RX_OFFSET);
+#endif
+                       skb->ip_summed = CHECKSUM_NONE;
                        rxdesc->addr = (u32)skb->data & ~0x3UL;
                }
-               /* The size of the buffer is 16 byte boundary. */
-               rxdesc->buffer_length = (mdp->rx_buf_sz + 16) & ~0x0F;
                if (entry >= RX_RING_SIZE - 1)
                        rxdesc->status |=
-                       cpu_to_le32(RD_RACT | RD_RFP | RC_RDEL);
+                               cpu_to_le32(RD_RACT | RD_RFP | RD_RDEL);
                else
                        rxdesc->status |=
-                       cpu_to_le32(RD_RACT | RD_RFP);
+                               cpu_to_le32(RD_RACT | RD_RFP);
        }
 
        /* Restart Rx engine if stopped. */
        /* If we don't need to check status, don't. -KDU */
-       ctrl_outl(EDRRR_R, ndev->base_addr + EDRRR);
+       if (!(ctrl_inl(ndev->base_addr + EDRRR) & EDRRR_R))
+               ctrl_outl(EDRRR_R, ndev->base_addr + EDRRR);
 
        return 0;
 }
@@ -529,13 +615,14 @@ static void sh_eth_error(struct net_device *ndev, int intr_status)
                        printk(KERN_ERR "Receive Frame Overflow\n");
                }
        }
-
+#if !defined(CONFIG_CPU_SUBTYPE_SH7763)
        if (intr_status & EESR_ADE) {
                if (intr_status & EESR_TDE) {
                        if (intr_status & EESR_TFE)
                                mdp->stats.tx_fifo_errors++;
                }
        }
+#endif
 
        if (intr_status & EESR_RDE) {
                /* Receive Descriptor Empty int */
@@ -550,8 +637,11 @@ static void sh_eth_error(struct net_device *ndev, int intr_status)
                mdp->stats.rx_fifo_errors++;
                printk(KERN_ERR "Receive FIFO Overflow\n");
        }
-       if (intr_status &
-           (EESR_TWB | EESR_TABT | EESR_ADE | EESR_TDE | EESR_TFE)) {
+       if (intr_status & (EESR_TWB | EESR_TABT |
+#if !defined(CONFIG_CPU_SUBTYPE_SH7763)
+                       EESR_ADE |
+#endif
+                       EESR_TDE | EESR_TFE)) {
                /* Tx error */
                u32 edtrr = ctrl_inl(ndev->base_addr + EDTRR);
                /* dmesg */
@@ -582,17 +672,23 @@ static irqreturn_t sh_eth_interrupt(int irq, void *netdev)
        ioaddr = ndev->base_addr;
        spin_lock(&mdp->lock);
 
+       /* Get interrpt stat */
        intr_status = ctrl_inl(ioaddr + EESR);
        /* Clear interrupt */
        ctrl_outl(intr_status, ioaddr + EESR);
 
-       if (intr_status & (EESR_FRC | EESR_RINT8 |
-                          EESR_RINT5 | EESR_RINT4 | EESR_RINT3 | EESR_RINT2 |
-                          EESR_RINT1))
+       if (intr_status & (EESR_FRC | /* Frame recv*/
+                       EESR_RMAF | /* Multi cast address recv*/
+                       EESR_RRF  | /* Bit frame recv */
+                       EESR_RTLF | /* Long frame recv*/
+                       EESR_RTSF | /* short frame recv */
+                       EESR_PRE  | /* PHY-LSI recv error */
+                       EESR_CERF)){ /* recv frame CRC error */
                sh_eth_rx(ndev);
-       if (intr_status & (EESR_FTC |
-                          EESR_TINT4 | EESR_TINT3 | EESR_TINT2 | EESR_TINT1)) {
+       }
 
+       /* Tx Check */
+       if (intr_status & TX_CHECK) {
                sh_eth_txfree(ndev);
                netif_wake_queue(ndev);
        }
@@ -631,11 +727,32 @@ static void sh_eth_adjust_link(struct net_device *ndev)
                if (phydev->duplex != mdp->duplex) {
                        new_state = 1;
                        mdp->duplex = phydev->duplex;
+#if defined(CONFIG_CPU_SUBTYPE_SH7763)
+                       if (mdp->duplex) { /*  FULL */
+                               ctrl_outl(ctrl_inl(ioaddr + ECMR) | ECMR_DM,
+                                               ioaddr + ECMR);
+                       } else {        /* Half */
+                               ctrl_outl(ctrl_inl(ioaddr + ECMR) & ~ECMR_DM,
+                                               ioaddr + ECMR);
+                       }
+#endif
                }
 
                if (phydev->speed != mdp->speed) {
                        new_state = 1;
                        mdp->speed = phydev->speed;
+#if defined(CONFIG_CPU_SUBTYPE_SH7763)
+                       switch (mdp->speed) {
+                       case 10: /* 10BASE */
+                               ctrl_outl(GECMR_10, ioaddr + GECMR); break;
+                       case 100:/* 100BASE */
+                               ctrl_outl(GECMR_100, ioaddr + GECMR); break;
+                       case 1000: /* 1000BASE */
+                               ctrl_outl(GECMR_1000, ioaddr + GECMR); break;
+                       default:
+                               break;
+                       }
+#endif
                }
                if (mdp->link == PHY_DOWN) {
                        ctrl_outl((ctrl_inl(ioaddr + ECMR) & ~ECMR_TXF)
@@ -730,7 +847,7 @@ static int sh_eth_open(struct net_device *ndev)
        /* Set the timer to check for link beat. */
        init_timer(&mdp->timer);
        mdp->timer.expires = (jiffies + (24 * HZ)) / 10;/* 2.4 sec. */
-       setup_timer(&mdp->timer, sh_eth_timer, ndev);
+       setup_timer(&mdp->timer, sh_eth_timer, (unsigned long)ndev);
 
        return ret;
 
@@ -820,7 +937,9 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 
        mdp->cur_tx++;
 
-       ctrl_outl(EDTRR_TRNS, ndev->base_addr + EDTRR);
+       if (!(ctrl_inl(ndev->base_addr + EDTRR) & EDTRR_TRNS))
+               ctrl_outl(EDTRR_TRNS, ndev->base_addr + EDTRR);
+
        ndev->trans_start = jiffies;
 
        return 0;
@@ -877,9 +996,15 @@ static struct net_device_stats *sh_eth_get_stats(struct net_device *ndev)
        ctrl_outl(0, ioaddr + CDCR);    /* (write clear) */
        mdp->stats.tx_carrier_errors += ctrl_inl(ioaddr + LCCR);
        ctrl_outl(0, ioaddr + LCCR);    /* (write clear) */
+#if defined(CONFIG_CPU_SUBTYPE_SH7763)
+       mdp->stats.tx_carrier_errors += ctrl_inl(ioaddr + CERCR);/* CERCR */
+       ctrl_outl(0, ioaddr + CERCR);   /* (write clear) */
+       mdp->stats.tx_carrier_errors += ctrl_inl(ioaddr + CEECR);/* CEECR */
+       ctrl_outl(0, ioaddr + CEECR);   /* (write clear) */
+#else
        mdp->stats.tx_carrier_errors += ctrl_inl(ioaddr + CNDCR);
        ctrl_outl(0, ioaddr + CNDCR);   /* (write clear) */
-
+#endif
        return &mdp->stats;
 }
 
@@ -929,8 +1054,13 @@ static void sh_eth_tsu_init(u32 ioaddr)
        ctrl_outl(0, ioaddr + TSU_FWSL0);
        ctrl_outl(0, ioaddr + TSU_FWSL1);
        ctrl_outl(TSU_FWSLC_POSTENU | TSU_FWSLC_POSTENL, ioaddr + TSU_FWSLC);
+#if defined(CONFIG_CPU_SUBTYPE_SH7763)
+       ctrl_outl(0, ioaddr + TSU_QTAG0);       /* Disable QTAG(0->1) */
+       ctrl_outl(0, ioaddr + TSU_QTAG1);       /* Disable QTAG(1->0) */
+#else
        ctrl_outl(0, ioaddr + TSU_QTAGM0);      /* Disable QTAG(0->1) */
        ctrl_outl(0, ioaddr + TSU_QTAGM1);      /* Disable QTAG(1->0) */
+#endif
        ctrl_outl(0, ioaddr + TSU_FWSR);        /* all interrupt status clear */
        ctrl_outl(0, ioaddr + TSU_FWINMK);      /* Disable all interrupt */
        ctrl_outl(0, ioaddr + TSU_TEN); /* Disable all CAM entry */
@@ -1088,7 +1218,7 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
        /* First device only init */
        if (!devno) {
                /* reset device */
-               ctrl_outl(ARSTR_ARSTR, ndev->base_addr + ARSTR);
+               ctrl_outl(ARSTR_ARSTR, ARSTR);
                mdelay(1);
 
                /* TSU init (Init only)*/
@@ -1110,8 +1240,8 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
               ndev->name, CARDNAME, (u32) ndev->base_addr);
 
        for (i = 0; i < 5; i++)
-               printk(KERN_INFO "%2.2x:", ndev->dev_addr[i]);
-       printk(KERN_INFO "%2.2x, IRQ %d.\n", ndev->dev_addr[i], ndev->irq);
+               printk(KERN_INFO "%02X:", ndev->dev_addr[i]);
+       printk(KERN_INFO "%02X, IRQ %d.\n", ndev->dev_addr[i], ndev->irq);
 
        platform_set_drvdata(pdev, ndev);
 
index e01e1c3..45ad1b0 100644 (file)
 
 #define CARDNAME       "sh-eth"
 #define TX_TIMEOUT     (5*HZ)
-
-#define TX_RING_SIZE   128     /* Tx ring size */
-#define RX_RING_SIZE   128     /* Rx ring size */
-#define RX_OFFSET              2       /* skb offset */
+#define TX_RING_SIZE   64      /* Tx ring size */
+#define RX_RING_SIZE   64      /* Rx ring size */
 #define ETHERSMALL             60
 #define PKT_BUF_SZ             1538
 
+#ifdef CONFIG_CPU_SUBTYPE_SH7763
+
+#define SH7763_SKB_ALIGN 32
 /* Chip Base Address */
-#define SH_TSU_ADDR 0xA7000804
+# define SH_TSU_ADDR  0xFFE01800
+# define ARSTR                   0xFFE01800
+
+/* Chip Registers */
+/* E-DMAC */
+# define EDSR    0x000
+# define EDMR    0x400
+# define EDTRR   0x408
+# define EDRRR   0x410
+# define EESR    0x428
+# define EESIPR  0x430
+# define TDLAR   0x010
+# define TDFAR   0x014
+# define TDFXR   0x018
+# define TDFFR   0x01C
+# define RDLAR   0x030
+# define RDFAR   0x034
+# define RDFXR   0x038
+# define RDFFR   0x03C
+# define TRSCER  0x438
+# define RMFCR   0x440
+# define TFTR    0x448
+# define FDR     0x450
+# define RMCR    0x458
+# define RPADIR  0x460
+# define FCFTR   0x468
+
+/* Ether Register */
+# define ECMR    0x500
+# define ECSR    0x510
+# define ECSIPR  0x518
+# define PIR     0x520
+# define PSR     0x528
+# define PIPR    0x52C
+# define RFLR    0x508
+# define APR     0x554
+# define MPR     0x558
+# define PFTCR  0x55C
+# define PFRCR  0x560
+# define TPAUSER 0x564
+# define GECMR   0x5B0
+# define BCULR   0x5B4
+# define MAHR    0x5C0
+# define MALR    0x5C8
+# define TROCR   0x700
+# define CDCR    0x708
+# define LCCR    0x710
+# define CEFCR   0x740
+# define FRECR   0x748
+# define TSFRCR  0x750
+# define TLFRCR  0x758
+# define RFCR    0x760
+# define CERCR   0x768
+# define CEECR   0x770
+# define MAFCR   0x778
+
+/* TSU Absolute Address */
+# define TSU_CTRST       0x004
+# define TSU_FWEN0       0x010
+# define TSU_FWEN1       0x014
+# define TSU_FCM         0x18
+# define TSU_BSYSL0      0x20
+# define TSU_BSYSL1      0x24
+# define TSU_PRISL0      0x28
+# define TSU_PRISL1      0x2C
+# define TSU_FWSL0       0x30
+# define TSU_FWSL1       0x34
+# define TSU_FWSLC       0x38
+# define TSU_QTAG0       0x40
+# define TSU_QTAG1       0x44
+# define TSU_FWSR        0x50
+# define TSU_FWINMK      0x54
+# define TSU_ADQT0       0x48
+# define TSU_ADQT1       0x4C
+# define TSU_VTAG0       0x58
+# define TSU_VTAG1       0x5C
+# define TSU_ADSBSY      0x60
+# define TSU_TEN         0x64
+# define TSU_POST1       0x70
+# define TSU_POST2       0x74
+# define TSU_POST3       0x78
+# define TSU_POST4       0x7C
+# define TSU_ADRH0       0x100
+# define TSU_ADRL0       0x104
+# define TSU_ADRH31      0x1F8
+# define TSU_ADRL31      0x1FC
+
+# define TXNLCR0         0x80
+# define TXALCR0         0x84
+# define RXNLCR0         0x88
+# define RXALCR0         0x8C
+# define FWNLCR0         0x90
+# define FWALCR0         0x94
+# define TXNLCR1         0xA0
+# define TXALCR1         0xA4
+# define RXNLCR1         0xA8
+# define RXALCR1         0xAC
+# define FWNLCR1         0xB0
+# define FWALCR1         0x40
+
+#else /* CONFIG_CPU_SUBTYPE_SH7763 */
+# define RX_OFFSET 2   /* skb offset */
+/* Chip base address */
+# define SH_TSU_ADDR  0xA7000804
+# define ARSTR           0xA7000800
 
 /* Chip Registers */
 /* E-DMAC */
-#define EDMR   0x0000
-#define EDTRR  0x0004
-#define EDRRR  0x0008
-#define TDLAR  0x000C
-#define RDLAR  0x0010
-#define EESR   0x0014
-#define EESIPR 0x0018
-#define TRSCER 0x001C
-#define RMFCR  0x0020
-#define TFTR   0x0024
-#define FDR            0x0028
-#define RMCR   0x002C
-#define EDOCR  0x0030
-#define FCFTR  0x0034
-#define RPADIR 0x0038
-#define TRIMD  0x003C
-#define RBWAR  0x0040
-#define RDFAR  0x0044
-#define TBRAR  0x004C
-#define TDFAR  0x0050
+# define EDMR  0x0000
+# define EDTRR 0x0004
+# define EDRRR 0x0008
+# define TDLAR 0x000C
+# define RDLAR 0x0010
+# define EESR  0x0014
+# define EESIPR        0x0018
+# define TRSCER        0x001C
+# define RMFCR 0x0020
+# define TFTR  0x0024
+# define FDR   0x0028
+# define RMCR  0x002C
+# define EDOCR 0x0030
+# define FCFTR 0x0034
+# define RPADIR        0x0038
+# define TRIMD 0x003C
+# define RBWAR 0x0040
+# define RDFAR 0x0044
+# define TBRAR 0x004C
+# define TDFAR 0x0050
+
 /* Ether Register */
-#define ECMR   0x0160
-#define ECSR   0x0164
-#define ECSIPR 0x0168
-#define PIR            0x016C
-#define MAHR   0x0170
-#define MALR   0x0174
-#define RFLR   0x0178
-#define PSR            0x017C
-#define TROCR  0x0180
-#define CDCR   0x0184
-#define LCCR   0x0188
-#define CNDCR  0x018C
-#define CEFCR  0x0194
-#define FRECR  0x0198
-#define TSFRCR 0x019C
-#define TLFRCR 0x01A0
-#define RFCR   0x01A4
-#define MAFCR  0x01A8
-#define IPGR   0x01B4
-#if defined(CONFIG_CPU_SUBTYPE_SH7710)
-#define APR            0x01B8
-#define MPR    0x01BC
-#define TPAUSER 0x1C4
-#define BCFR   0x1CC
-#endif /* CONFIG_CPU_SH7710 */
-
-#define ARSTR  0x0800
+# define ECMR  0x0160
+# define ECSR  0x0164
+# define ECSIPR        0x0168
+# define PIR   0x016C
+# define MAHR  0x0170
+# define MALR  0x0174
+# define RFLR  0x0178
+# define PSR   0x017C
+# define TROCR 0x0180
+# define CDCR  0x0184
+# define LCCR  0x0188
+# define CNDCR 0x018C
+# define CEFCR 0x0194
+# define FRECR 0x0198
+# define TSFRCR        0x019C
+# define TLFRCR        0x01A0
+# define RFCR  0x01A4
+# define MAFCR 0x01A8
+# define IPGR  0x01B4
+# if defined(CONFIG_CPU_SUBTYPE_SH7710)
+# define APR   0x01B8
+# define MPR   0x01BC
+# define TPAUSER 0x1C4
+# define BCFR  0x1CC
+# endif /* CONFIG_CPU_SH7710 */
 
 /* TSU */
-#define TSU_CTRST      0x004
-#define TSU_FWEN0      0x010
-#define TSU_FWEN1      0x014
-#define TSU_FCM                0x018
-#define TSU_BSYSL0     0x020
-#define TSU_BSYSL1     0x024
-#define TSU_PRISL0     0x028
-#define TSU_PRISL1     0x02C
-#define TSU_FWSL0      0x030
-#define TSU_FWSL1      0x034
-#define TSU_FWSLC      0x038
-#define TSU_QTAGM0     0x040
-#define TSU_QTAGM1     0x044
-#define TSU_ADQT0      0x048
-#define TSU_ADQT1      0x04C
-#define TSU_FWSR       0x050
-#define TSU_FWINMK     0x054
-#define TSU_ADSBSY     0x060
-#define TSU_TEN                0x064
-#define TSU_POST1      0x070
-#define TSU_POST2      0x074
-#define TSU_POST3      0x078
-#define TSU_POST4      0x07C
-#define TXNLCR0                0x080
-#define TXALCR0                0x084
-#define RXNLCR0                0x088
-#define RXALCR0                0x08C
-#define FWNLCR0                0x090
-#define FWALCR0                0x094
-#define TXNLCR1                0x0A0
-#define TXALCR1                0x0A4
-#define RXNLCR1                0x0A8
-#define RXALCR1                0x0AC
-#define FWNLCR1                0x0B0
-#define FWALCR1                0x0B4
+# define TSU_CTRST     0x004
+# define TSU_FWEN0     0x010
+# define TSU_FWEN1     0x014
+# define TSU_FCM       0x018
+# define TSU_BSYSL0    0x020
+# define TSU_BSYSL1    0x024
+# define TSU_PRISL0    0x028
+# define TSU_PRISL1    0x02C
+# define TSU_FWSL0     0x030
+# define TSU_FWSL1     0x034
+# define TSU_FWSLC     0x038
+# define TSU_QTAGM0    0x040
+# define TSU_QTAGM1    0x044
+# define TSU_ADQT0     0x048
+# define TSU_ADQT1     0x04C
+# define TSU_FWSR      0x050
+# define TSU_FWINMK    0x054
+# define TSU_ADSBSY    0x060
+# define TSU_TEN       0x064
+# define TSU_POST1     0x070
+# define TSU_POST2     0x074
+# define TSU_POST3     0x078
+# define TSU_POST4     0x07C
+# define TXNLCR0       0x080
+# define TXALCR0       0x084
+# define RXNLCR0       0x088
+# define RXALCR0       0x08C
+# define FWNLCR0       0x090
+# define FWALCR0       0x094
+# define TXNLCR1       0x0A0
+# define TXALCR1       0x0A4
+# define RXNLCR1       0x0A8
+# define RXALCR1       0x0AC
+# define FWNLCR1       0x0B0
+# define FWALCR1       0x0B4
 
 #define TSU_ADRH0      0x0100
 #define TSU_ADRL0      0x0104
 #define TSU_ADRL31     0x01FC
 
-/* Register's bits */
+#endif /* CONFIG_CPU_SUBTYPE_SH7763 */
+
+/*
+ * Register's bits
+ */
+#ifdef CONFIG_CPU_SUBTYPE_SH7763
+/* EDSR */
+enum EDSR_BIT {
+       EDSR_ENT = 0x01, EDSR_ENR = 0x02,
+};
+#define EDSR_ENALL (EDSR_ENT|EDSR_ENR)
+
+/* GECMR */
+enum GECMR_BIT {
+       GECMR_10 = 0x0, GECMR_100 = 0x04, GECMR_1000 = 0x01,
+};
+#endif
 
 /* EDMR */
 enum DMAC_M_BIT {
-       EDMR_DL1 = 0x20, EDMR_DL0 = 0x10, EDMR_SRST = 0x01,
+       EDMR_DL1 = 0x20, EDMR_DL0 = 0x10,
+#ifdef CONFIG_CPU_SUBTYPE_SH7763
+       EDMR_SRST       = 0x03,
+       EMDR_DESC_R     = 0x30, /* Descriptor reserve size */
+       EDMR_EL         = 0x40, /* Litte endian */
+#else /* CONFIG_CPU_SUBTYPE_SH7763 */
+       EDMR_SRST = 0x01,
+#endif
 };
 
 /* EDTRR */
 enum DMAC_T_BIT {
+#ifdef CONFIG_CPU_SUBTYPE_SH7763
+       EDTRR_TRNS = 0x03,
+#else
        EDTRR_TRNS = 0x01,
+#endif
 };
 
 /* EDRRR*/
@@ -173,21 +304,47 @@ enum PHY_STATUS_BIT { PHY_ST_LINK = 0x01, };
 
 /* EESR */
 enum EESR_BIT {
-       EESR_TWB = 0x40000000, EESR_TABT = 0x04000000,
+#ifndef CONFIG_CPU_SUBTYPE_SH7763
+       EESR_TWB  = 0x40000000,
+#else
+       EESR_TWB  = 0xC0000000,
+       EESR_TC1  = 0x20000000,
+       EESR_TUC  = 0x10000000,
+       EESR_ROC  = 0x80000000,
+#endif
+       EESR_TABT = 0x04000000,
        EESR_RABT = 0x02000000, EESR_RFRMER = 0x01000000,
-       EESR_ADE = 0x00800000, EESR_ECI = 0x00400000,
-       EESR_FTC = 0x00200000, EESR_TDE = 0x00100000,
-       EESR_TFE = 0x00080000, EESR_FRC = 0x00040000,
-       EESR_RDE = 0x00020000, EESR_RFE = 0x00010000,
-       EESR_TINT4 = 0x00000800, EESR_TINT3 = 0x00000400,
-       EESR_TINT2 = 0x00000200, EESR_TINT1 = 0x00000100,
-       EESR_RINT8 = 0x00000080, EESR_RINT5 = 0x00000010,
-       EESR_RINT4 = 0x00000008, EESR_RINT3 = 0x00000004,
-       EESR_RINT2 = 0x00000002, EESR_RINT1 = 0x00000001,
-};
-
-#define EESR_ERR_CHECK (EESR_TWB | EESR_TABT | EESR_RABT | EESR_RDE \
+#ifndef CONFIG_CPU_SUBTYPE_SH7763
+       EESR_ADE  = 0x00800000,
+#endif
+       EESR_ECI  = 0x00400000,
+       EESR_FTC  = 0x00200000, EESR_TDE  = 0x00100000,
+       EESR_TFE  = 0x00080000, EESR_FRC  = 0x00040000,
+       EESR_RDE  = 0x00020000, EESR_RFE  = 0x00010000,
+#ifndef CONFIG_CPU_SUBTYPE_SH7763
+       EESR_CND  = 0x00000800,
+#endif
+       EESR_DLC  = 0x00000400,
+       EESR_CD   = 0x00000200, EESR_RTO  = 0x00000100,
+       EESR_RMAF = 0x00000080, EESR_CEEF = 0x00000040,
+       EESR_CELF = 0x00000020, EESR_RRF  = 0x00000010,
+       EESR_RTLF = 0x00000008, EESR_RTSF = 0x00000004,
+       EESR_PRE  = 0x00000002, EESR_CERF = 0x00000001,
+};
+
+
+#ifdef CONFIG_CPU_SUBTYPE_SH7763
+# define TX_CHECK (EESR_TC1 | EESR_FTC)
+# define EESR_ERR_CHECK        (EESR_TWB | EESR_TABT | EESR_RABT | EESR_RDE \
+               | EESR_RFRMER | EESR_TFE | EESR_TDE | EESR_ECI)
+# define TX_ERROR_CEHCK (EESR_TWB | EESR_TABT | EESR_TDE | EESR_TFE)
+
+#else
+# define TX_CHECK (EESR_FTC | EESR_CND | EESR_DLC | EESR_CD | EESR_RTO)
+# define EESR_ERR_CHECK        (EESR_TWB | EESR_TABT | EESR_RABT | EESR_RDE \
                | EESR_RFRMER | EESR_ADE | EESR_TFE | EESR_TDE | EESR_ECI)
+# define TX_ERROR_CEHCK (EESR_TWB | EESR_TABT | EESR_ADE | EESR_TDE | EESR_TFE)
+#endif
 
 /* EESIPR */
 enum DMAC_IM_BIT {
@@ -207,8 +364,8 @@ enum DMAC_IM_BIT {
 
 /* Receive descriptor bit */
 enum RD_STS_BIT {
-       RD_RACT = 0x80000000, RC_RDEL = 0x40000000,
-       RC_RFP1 = 0x20000000, RC_RFP0 = 0x10000000,
+       RD_RACT = 0x80000000, RD_RDEL = 0x40000000,
+       RD_RFP1 = 0x20000000, RD_RFP0 = 0x10000000,
        RD_RFE = 0x08000000, RD_RFS10 = 0x00000200,
        RD_RFS9 = 0x00000100, RD_RFS8 = 0x00000080,
        RD_RFS7 = 0x00000040, RD_RFS6 = 0x00000020,
@@ -216,9 +373,9 @@ enum RD_STS_BIT {
        RD_RFS3 = 0x00000004, RD_RFS2 = 0x00000002,
        RD_RFS1 = 0x00000001,
 };
-#define RDF1ST RC_RFP1
-#define RDFEND RC_RFP0
-#define RD_RFP (RC_RFP1|RC_RFP0)
+#define RDF1ST RD_RFP1
+#define RDFEND RD_RFP0
+#define RD_RFP (RD_RFP1|RD_RFP0)
 
 /* FCFTR */
 enum FCFTR_BIT {
@@ -231,7 +388,8 @@ enum FCFTR_BIT {
 
 /* Transfer descriptor bit */
 enum TD_STS_BIT {
-       TD_TACT = 0x80000000, TD_TDLE = 0x40000000, TD_TFP1 = 0x20000000,
+       TD_TACT = 0x80000000,
+       TD_TDLE = 0x40000000, TD_TFP1 = 0x20000000,
        TD_TFP0 = 0x10000000,
 };
 #define TDF1ST TD_TFP1
@@ -242,6 +400,10 @@ enum TD_STS_BIT {
 enum RECV_RST_BIT { RMCR_RST = 0x01, };
 /* ECMR */
 enum FELIC_MODE_BIT {
+#ifdef CONFIG_CPU_SUBTYPE_SH7763
+       ECMR_TRCCM = 0x04000000, ECMR_RCSC = 0x00800000,
+       ECMR_DPAD = 0x00200000, ECMR_RZPF = 0x00100000,
+#endif
        ECMR_ZPF = 0x00080000, ECMR_PFR = 0x00040000, ECMR_RXF = 0x00020000,
        ECMR_TXF = 0x00010000, ECMR_MCT = 0x00002000, ECMR_PRCEF = 0x00001000,
        ECMR_PMDE = 0x00000200, ECMR_RE = 0x00000040, ECMR_TE = 0x00000020,
@@ -249,18 +411,45 @@ enum FELIC_MODE_BIT {
        ECMR_PRM = 0x00000001,
 };
 
+#ifdef CONFIG_CPU_SUBTYPE_SH7763
+#define ECMR_CHG_DM    (ECMR_TRCCM | ECMR_RZPF | ECMR_ZPF |\
+                       ECMR_PFR | ECMR_RXF | ECMR_TXF | ECMR_MCT)
+#else
+#define ECMR_CHG_DM    (ECMR_ZPF | ECMR_PFR ECMR_RXF | ECMR_TXF | ECMR_MCT)
+#endif
+
 /* ECSR */
 enum ECSR_STATUS_BIT {
-       ECSR_BRCRX = 0x20, ECSR_PSRTO = 0x10, ECSR_LCHNG = 0x04,
+#ifndef CONFIG_CPU_SUBTYPE_SH7763
+       ECSR_BRCRX = 0x20, ECSR_PSRTO = 0x10,
+#endif
+       ECSR_LCHNG = 0x04,
        ECSR_MPD = 0x02, ECSR_ICD = 0x01,
 };
 
+#ifdef CONFIG_CPU_SUBTYPE_SH7763
+# define ECSR_INIT (ECSR_ICD | ECSIPR_MPDIP)
+#else
+# define ECSR_INIT (ECSR_BRCRX | ECSR_PSRTO | \
+                       ECSR_LCHNG | ECSR_ICD | ECSIPR_MPDIP)
+#endif
+
 /* ECSIPR */
 enum ECSIPR_STATUS_MASK_BIT {
-       ECSIPR_BRCRXIP = 0x20, ECSIPR_PSRTOIP = 0x10, ECSIPR_LCHNGIP = 0x04,
+#ifndef CONFIG_CPU_SUBTYPE_SH7763
+       ECSIPR_BRCRXIP = 0x20, ECSIPR_PSRTOIP = 0x10,
+#endif
+       ECSIPR_LCHNGIP = 0x04,
        ECSIPR_MPDIP = 0x02, ECSIPR_ICDIP = 0x01,
 };
 
+#ifdef CONFIG_CPU_SUBTYPE_SH7763
+# define ECSIPR_INIT (ECSIPR_LCHNGIP | ECSIPR_ICDIP | ECSIPR_MPDIP)
+#else
+# define ECSIPR_INIT (ECSIPR_BRCRXIP | ECSIPR_PSRTOIP | ECSIPR_LCHNGIP | \
+                               ECSIPR_ICDIP | ECSIPR_MPDIP)
+#endif
+
 /* APR */
 enum APR_BIT {
        APR_AP = 0x00000001,
@@ -285,6 +474,15 @@ enum RPADIR_BIT {
        RPADIR_PADR = 0x0003f,
 };
 
+#if defined(CONFIG_CPU_SUBTYPE_SH7763)
+# define RPADIR_INIT (0x00)
+#else
+# define RPADIR_INIT (RPADIR_PADS1)
+#endif
+
+/* RFLR */
+#define RFLR_VALUE 0x1000
+
 /* FDR */
 enum FIFO_SIZE_BIT {
        FIFO_SIZE_T = 0x00000700, FIFO_SIZE_R = 0x00000007,
@@ -316,7 +514,7 @@ enum PHY_ANA_BIT {
        PHY_A_NP = 0x8000, PHY_A_ACK = 0x4000, PHY_A_RF = 0x2000,
        PHY_A_FCS = 0x0400, PHY_A_T4 = 0x0200, PHY_A_FDX = 0x0100,
        PHY_A_HDX = 0x0080, PHY_A_10FDX = 0x0040, PHY_A_10HDX = 0x0020,
-       PHY_A_SEL = 0x001f,
+       PHY_A_SEL = 0x001e,
 };
 /* PHY_ANL */
 enum PHY_ANL_BIT {
@@ -449,6 +647,10 @@ struct sh_eth_private {
        struct net_device_stats tsu_stats;      /* TSU forward status */
 };
 
+#ifdef CONFIG_CPU_SUBTYPE_SH7763
+/* SH7763 has endian control register */
+#define swaps(x, y)
+#else
 static void swaps(char *src, int len)
 {
 #ifdef __LITTLE_ENDIAN__
@@ -460,5 +662,5 @@ static void swaps(char *src, int len)
                *p = swab32(*p);
 #endif
 }
-
+#endif /* CONFIG_CPU_SUBTYPE_SH7763 */
 #endif
index ffbfb1b..805383b 100644 (file)
@@ -19,6 +19,7 @@
 #include "h/smc.h"
 #include "h/smt_p.h"
 #include <linux/bitrev.h>
+#include <linux/kernel.h>
 
 #define KERNEL
 #include "h/smtstate.h"
@@ -1730,20 +1731,18 @@ void fddi_send_antc(struct s_smc *smc, struct fddi_addr *dest)
 #endif
 
 #ifdef DEBUG
-#define hextoasc(x)    "0123456789abcdef"[x]
-
 char *addr_to_string(struct fddi_addr *addr)
 {
        int     i ;
        static char     string[6*3] = "****" ;
 
        for (i = 0 ; i < 6 ; i++) {
-               string[i*3] = hextoasc((addr->a[i]>>4)&0xf) ;
-               string[i*3+1] = hextoasc((addr->a[i])&0xf) ;
-               string[i*3+2] = ':' ;
+               string[i * 3] = hex_asc_hi(addr->a[i]);
+               string[i * 3 + 1] = hex_asc_lo(addr->a[i]);
+               string[i * 3 + 2] = ':';
        }
-       string[5*3+2] = 0 ;
-       return(string) ;
+       string[5 * 3 + 2] = 0;
+       return(string);
 }
 #endif
 
index b65be5d..2ed0bd5 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <asm/system.h>
 #include <asm/io.h>
-#include <asm/se.h>
+#include <mach-se/mach/se.h>
 #include <asm/machvec.h>
 #ifdef CONFIG_SH_STANDARD_BIOS
 #include <asm/sh_bios.h>
index 633c128..d2439b8 100644 (file)
@@ -1982,8 +1982,6 @@ static void tg3_power_down_phy(struct tg3 *tp)
 static int tg3_set_power_state(struct tg3 *tp, pci_power_t state)
 {
        u32 misc_host_ctrl;
-       u16 power_control, power_caps;
-       int pm = tp->pm_cap;
 
        /* Make sure register accesses (indirect or otherwise)
         * will function correctly.
@@ -1992,18 +1990,10 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state)
                               TG3PCI_MISC_HOST_CTRL,
                               tp->misc_host_ctrl);
 
-       pci_read_config_word(tp->pdev,
-                            pm + PCI_PM_CTRL,
-                            &power_control);
-       power_control |= PCI_PM_CTRL_PME_STATUS;
-       power_control &= ~(PCI_PM_CTRL_STATE_MASK);
        switch (state) {
        case PCI_D0:
-               power_control |= 0;
-               pci_write_config_word(tp->pdev,
-                                     pm + PCI_PM_CTRL,
-                                     power_control);
-               udelay(100);    /* Delay after power state change */
+               pci_enable_wake(tp->pdev, state, false);
+               pci_set_power_state(tp->pdev, PCI_D0);
 
                /* Switch out of Vaux if it is a NIC */
                if (tp->tg3_flags2 & TG3_FLG2_IS_NIC)
@@ -2012,26 +2002,15 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state)
                return 0;
 
        case PCI_D1:
-               power_control |= 1;
-               break;
-
        case PCI_D2:
-               power_control |= 2;
-               break;
-
        case PCI_D3hot:
-               power_control |= 3;
                break;
 
        default:
-               printk(KERN_WARNING PFX "%s: Invalid power state (%d) "
-                      "requested.\n",
-                      tp->dev->name, state);
+               printk(KERN_ERR PFX "%s: Invalid power state (D%d) requested\n",
+                       tp->dev->name, state);
                return -EINVAL;
        }
-
-       power_control |= PCI_PM_CTRL_PME_ENABLE;
-
        misc_host_ctrl = tr32(TG3PCI_MISC_HOST_CTRL);
        tw32(TG3PCI_MISC_HOST_CTRL,
             misc_host_ctrl | MISC_HOST_CTRL_MASK_PCI_INT);
@@ -2109,8 +2088,6 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state)
                                                     WOL_DRV_WOL |
                                                     WOL_SET_MAGIC_PKT);
 
-       pci_read_config_word(tp->pdev, pm + PCI_PM_PMC, &power_caps);
-
        if (tp->tg3_flags & TG3_FLAG_WOL_ENABLE) {
                u32 mac_mode;
 
@@ -2143,8 +2120,8 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state)
                if (!(tp->tg3_flags2 & TG3_FLG2_5750_PLUS))
                        tw32(MAC_LED_CTRL, tp->led_ctrl);
 
-               if (((power_caps & PCI_PM_CAP_PME_D3cold) &&
-                    (tp->tg3_flags & TG3_FLAG_WOL_ENABLE)))
+               if (pci_pme_capable(tp->pdev, state) &&
+                    (tp->tg3_flags & TG3_FLAG_WOL_ENABLE))
                        mac_mode |= MAC_MODE_MAGIC_PKT_ENABLE;
 
                tw32_f(MAC_MODE, mac_mode);
@@ -2236,9 +2213,11 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state)
 
        tg3_write_sig_post_reset(tp, RESET_KIND_SHUTDOWN);
 
+       if (tp->tg3_flags & TG3_FLAG_WOL_ENABLE)
+               pci_enable_wake(tp->pdev, state, true);
+
        /* Finally, set the new power state. */
-       pci_write_config_word(tp->pdev, pm + PCI_PM_CTRL, power_control);
-       udelay(100);    /* Delay after power state change */
+       pci_set_power_state(tp->pdev, state);
 
        return 0;
 }
@@ -7708,21 +7687,11 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
  */
 static int tg3_init_hw(struct tg3 *tp, int reset_phy)
 {
-       int err;
-
-       /* Force the chip into D0. */
-       err = tg3_set_power_state(tp, PCI_D0);
-       if (err)
-               goto out;
-
        tg3_switch_clocks(tp);
 
        tw32(TG3PCI_MEM_WIN_BASE_ADDR, 0);
 
-       err = tg3_reset_hw(tp, reset_phy);
-
-out:
-       return err;
+       return tg3_reset_hw(tp, reset_phy);
 }
 
 #define TG3_STAT_ADD32(PSTAT, REG) \
@@ -8037,13 +8006,11 @@ static int tg3_open(struct net_device *dev)
 
        netif_carrier_off(tp->dev);
 
-       tg3_full_lock(tp, 0);
-
        err = tg3_set_power_state(tp, PCI_D0);
-       if (err) {
-               tg3_full_unlock(tp);
+       if (err)
                return err;
-       }
+
+       tg3_full_lock(tp, 0);
 
        tg3_disable_ints(tp);
        tp->tg3_flags &= ~TG3_FLAG_INIT_COMPLETE;
@@ -9065,7 +9032,8 @@ static void tg3_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
 {
        struct tg3 *tp = netdev_priv(dev);
 
-       if (tp->tg3_flags & TG3_FLAG_WOL_CAP)
+       if ((tp->tg3_flags & TG3_FLAG_WOL_CAP) &&
+           device_can_wakeup(&tp->pdev->dev))
                wol->supported = WAKE_MAGIC;
        else
                wol->supported = 0;
@@ -9078,18 +9046,22 @@ static void tg3_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
 static int tg3_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
 {
        struct tg3 *tp = netdev_priv(dev);
+       struct device *dp = &tp->pdev->dev;
 
        if (wol->wolopts & ~WAKE_MAGIC)
                return -EINVAL;
        if ((wol->wolopts & WAKE_MAGIC) &&
-           !(tp->tg3_flags & TG3_FLAG_WOL_CAP))
+           !((tp->tg3_flags & TG3_FLAG_WOL_CAP) && device_can_wakeup(dp)))
                return -EINVAL;
 
        spin_lock_bh(&tp->lock);
-       if (wol->wolopts & WAKE_MAGIC)
+       if (wol->wolopts & WAKE_MAGIC) {
                tp->tg3_flags |= TG3_FLAG_WOL_ENABLE;
-       else
+               device_set_wakeup_enable(dp, true);
+       } else {
                tp->tg3_flags &= ~TG3_FLAG_WOL_ENABLE;
+               device_set_wakeup_enable(dp, false);
+       }
        spin_unlock_bh(&tp->lock);
 
        return 0;
@@ -11296,7 +11268,8 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
                if (val & VCPU_CFGSHDW_ASPM_DBNC)
                        tp->tg3_flags |= TG3_FLAG_ASPM_WORKAROUND;
                if ((val & VCPU_CFGSHDW_WOL_ENABLE) &&
-                   (val & VCPU_CFGSHDW_WOL_MAGPKT))
+                   (val & VCPU_CFGSHDW_WOL_MAGPKT) &&
+                   device_may_wakeup(&tp->pdev->dev))
                        tp->tg3_flags |= TG3_FLAG_WOL_ENABLE;
                return;
        }
@@ -11426,8 +11399,9 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
                    !(nic_cfg & NIC_SRAM_DATA_CFG_FIBER_WOL))
                        tp->tg3_flags &= ~TG3_FLAG_WOL_CAP;
 
-               if (tp->tg3_flags & TG3_FLAG_WOL_CAP &&
-                   nic_cfg & NIC_SRAM_DATA_CFG_WOL_ENABLE)
+               if ((tp->tg3_flags & TG3_FLAG_WOL_CAP) &&
+                   (nic_cfg & NIC_SRAM_DATA_CFG_WOL_ENABLE) &&
+                   device_may_wakeup(&tp->pdev->dev))
                        tp->tg3_flags |= TG3_FLAG_WOL_ENABLE;
 
                if (cfg2 & (1 << 17))
@@ -13613,6 +13587,7 @@ static int tg3_suspend(struct pci_dev *pdev, pm_message_t state)
 {
        struct net_device *dev = pci_get_drvdata(pdev);
        struct tg3 *tp = netdev_priv(dev);
+       pci_power_t target_state;
        int err;
 
        /* PCI register 4 needs to be saved whether netif_running() or not.
@@ -13641,7 +13616,9 @@ static int tg3_suspend(struct pci_dev *pdev, pm_message_t state)
        tp->tg3_flags &= ~TG3_FLAG_INIT_COMPLETE;
        tg3_full_unlock(tp);
 
-       err = tg3_set_power_state(tp, pci_choose_state(pdev, state));
+       target_state = pdev->pm_cap ? pci_target_state(pdev) : PCI_D3hot;
+
+       err = tg3_set_power_state(tp, target_state);
        if (err) {
                int err2;
 
index 7766cde..bf62132 100644 (file)
@@ -95,20 +95,20 @@ MODULE_DESCRIPTION("3Com 3C359 Velocity XL Token Ring Adapter Driver \n") ;
 static int ringspeed[XL_MAX_ADAPTERS] = {0,} ;
 
 module_param_array(ringspeed, int, NULL, 0);
-MODULE_PARM_DESC(ringspeed,"3c359: Ringspeed selection - 4,16 or 0") ; 
+MODULE_PARM_DESC(ringspeed,"3c359: Ringspeed selection - 4,16 or 0") ;
 
 /* Packet buffer size */
 
 static int pkt_buf_sz[XL_MAX_ADAPTERS] = {0,} ;
  
 module_param_array(pkt_buf_sz, int, NULL, 0) ;
-MODULE_PARM_DESC(pkt_buf_sz,"3c359: Initial buffer size") ; 
+MODULE_PARM_DESC(pkt_buf_sz,"3c359: Initial buffer size") ;
 /* Message Level */
 
-static int message_level[XL_MAX_ADAPTERS] = {0,} ; 
+static int message_level[XL_MAX_ADAPTERS] = {0,} ;
 
 module_param_array(message_level, int, NULL, 0) ;
-MODULE_PARM_DESC(message_level, "3c359: Level of reported messages \n") ; 
+MODULE_PARM_DESC(message_level, "3c359: Level of reported messages") ;
 /* 
  *     This is a real nasty way of doing this, but otherwise you
  *     will be stuck with 1555 lines of hex #'s in the code.
index f7319d3..78df2be 100644 (file)
 
 static int dm_read(struct usbnet *dev, u8 reg, u16 length, void *data)
 {
+       void *buf;
+       int err = -ENOMEM;
+
        devdbg(dev, "dm_read() reg=0x%02x length=%d", reg, length);
-       return usb_control_msg(dev->udev,
-                              usb_rcvctrlpipe(dev->udev, 0),
-                              DM_READ_REGS,
-                              USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
-                              0, reg, data, length, USB_CTRL_SET_TIMEOUT);
+
+       buf = kmalloc(length, GFP_KERNEL);
+       if (!buf)
+               goto out;
+
+       err = usb_control_msg(dev->udev,
+                             usb_rcvctrlpipe(dev->udev, 0),
+                             DM_READ_REGS,
+                             USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+                             0, reg, buf, length, USB_CTRL_SET_TIMEOUT);
+       if (err == length)
+               memcpy(data, buf, length);
+       else if (err >= 0)
+               err = -EINVAL;
+       kfree(buf);
+
+ out:
+       return err;
 }
 
 static int dm_read_reg(struct usbnet *dev, u8 reg, u8 *value)
@@ -70,12 +86,28 @@ static int dm_read_reg(struct usbnet *dev, u8 reg, u8 *value)
 
 static int dm_write(struct usbnet *dev, u8 reg, u16 length, void *data)
 {
+       void *buf = NULL;
+       int err = -ENOMEM;
+
        devdbg(dev, "dm_write() reg=0x%02x, length=%d", reg, length);
-       return usb_control_msg(dev->udev,
-                              usb_sndctrlpipe(dev->udev, 0),
-                              DM_WRITE_REGS,
-                              USB_DIR_OUT | USB_TYPE_VENDOR |USB_RECIP_DEVICE,
-                              0, reg, data, length, USB_CTRL_SET_TIMEOUT);
+
+       if (data) {
+               buf = kmalloc(length, GFP_KERNEL);
+               if (!buf)
+                       goto out;
+               memcpy(buf, data, length);
+       }
+
+       err = usb_control_msg(dev->udev,
+                             usb_sndctrlpipe(dev->udev, 0),
+                             DM_WRITE_REGS,
+                             USB_DIR_OUT | USB_TYPE_VENDOR |USB_RECIP_DEVICE,
+                             0, reg, buf, length, USB_CTRL_SET_TIMEOUT);
+       kfree(buf);
+       if (err >= 0 && err < length)
+               err = -EINVAL;
+ out:
+       return err;
 }
 
 static int dm_write_reg(struct usbnet *dev, u8 reg, u8 value)
index fa14255..6f9aa16 100644 (file)
@@ -337,7 +337,7 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr)
 #ifdef CONFIG_NET_POLL_CONTROLLER
        dev->poll_controller = ei_poll;
 #endif
-       NS8390_init(dev, 0);
+       NS8390p_init(dev, 0);
 
 #if 1
        /* Enable interrupt generation on softconfig cards -- M.U */
index 91fc2c7..4c7ff61 100644 (file)
@@ -649,6 +649,7 @@ config RTL8187
          Trendnet TEW-424UB
          ASUS P5B Deluxe
          Toshiba Satellite Pro series of laptops
+         Asus Wireless Link
 
          Thanks to Realtek for their support!
 
index ba35c30..9102eea 100644 (file)
@@ -186,11 +186,13 @@ struct ath5k_srev_name {
 #define AR5K_SREV_RAD_2111     0x20
 #define AR5K_SREV_RAD_5112     0x30
 #define AR5K_SREV_RAD_5112A    0x35
+#define        AR5K_SREV_RAD_5112B     0x36
 #define AR5K_SREV_RAD_2112     0x40
 #define AR5K_SREV_RAD_2112A    0x45
-#define AR5K_SREV_RAD_SC0      0x56    /* Found on 2413/2414 */
-#define AR5K_SREV_RAD_SC1      0x63    /* Found on 5413/5414 */
-#define AR5K_SREV_RAD_SC2      0xa2    /* Found on 2424-5/5424 */
+#define        AR5K_SREV_RAD_2112B     0x46
+#define AR5K_SREV_RAD_SC0      0x50    /* Found on 2413/2414 */
+#define AR5K_SREV_RAD_SC1      0x60    /* Found on 5413/5414 */
+#define AR5K_SREV_RAD_SC2      0xa0    /* Found on 2424-5/5424 */
 #define AR5K_SREV_RAD_5133     0xc0    /* MIMO found on 5418 */
 
 /* IEEE defs */
index d9769c5..ebf19bc 100644 (file)
@@ -43,7 +43,9 @@
 #include <linux/version.h>
 #include <linux/module.h>
 #include <linux/delay.h>
+#include <linux/hardirq.h>
 #include <linux/if.h>
+#include <linux/io.h>
 #include <linux/netdevice.h>
 #include <linux/cache.h>
 #include <linux/pci.h>
@@ -471,9 +473,6 @@ ath5k_pci_probe(struct pci_dev *pdev,
        /* Set private data */
        pci_set_drvdata(pdev, hw);
 
-       /* Enable msi for devices that support it */
-       pci_enable_msi(pdev);
-
        /* Setup interrupt handler */
        ret = request_irq(pdev->irq, ath5k_intr, IRQF_SHARED, "ath", sc);
        if (ret) {
@@ -551,7 +550,6 @@ err_ah:
 err_irq:
        free_irq(pdev->irq, sc);
 err_free:
-       pci_disable_msi(pdev);
        ieee80211_free_hw(hw);
 err_map:
        pci_iounmap(pdev, mem);
@@ -573,7 +571,6 @@ ath5k_pci_remove(struct pci_dev *pdev)
        ath5k_detach(pdev, hw);
        ath5k_hw_detach(sc->ah);
        free_irq(pdev->irq, sc);
-       pci_disable_msi(pdev);
        pci_iounmap(pdev, sc->iobase);
        pci_release_region(pdev, 0);
        pci_disable_device(pdev);
@@ -590,6 +587,9 @@ ath5k_pci_suspend(struct pci_dev *pdev, pm_message_t state)
        ath5k_led_off(sc);
 
        ath5k_stop_hw(sc);
+
+       free_irq(pdev->irq, sc);
+       pci_disable_msi(pdev);
        pci_save_state(pdev);
        pci_disable_device(pdev);
        pci_set_power_state(pdev, PCI_D3hot);
@@ -605,15 +605,12 @@ ath5k_pci_resume(struct pci_dev *pdev)
        struct ath5k_hw *ah = sc->ah;
        int i, err;
 
-       err = pci_set_power_state(pdev, PCI_D0);
-       if (err)
-               return err;
+       pci_restore_state(pdev);
 
        err = pci_enable_device(pdev);
        if (err)
                return err;
 
-       pci_restore_state(pdev);
        /*
         * Suspend/Resume resets the PCI configuration space, so we have to
         * re-disable the RETRY_TIMEOUT register (0x41) to keep
@@ -621,7 +618,17 @@ ath5k_pci_resume(struct pci_dev *pdev)
         */
        pci_write_config_byte(pdev, 0x41, 0);
 
-       ath5k_init(sc);
+       pci_enable_msi(pdev);
+
+       err = request_irq(pdev->irq, ath5k_intr, IRQF_SHARED, "ath", sc);
+       if (err) {
+               ATH5K_ERR(sc, "request_irq failed\n");
+               goto err_msi;
+       }
+
+       err = ath5k_init(sc);
+       if (err)
+               goto err_irq;
        ath5k_led_enable(sc);
 
        /*
@@ -635,6 +642,12 @@ ath5k_pci_resume(struct pci_dev *pdev)
                ath5k_hw_reset_key(ah, i);
 
        return 0;
+err_irq:
+       free_irq(pdev->irq, sc);
+err_msi:
+       pci_disable_msi(pdev);
+       pci_disable_device(pdev);
+       return err;
 }
 #endif /* CONFIG_PM */
 
@@ -1224,7 +1237,7 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
 
        pktlen = skb->len;
 
-       if (!(info->flags & IEEE80211_TX_CTL_DO_NOT_ENCRYPT)) {
+       if (info->control.hw_key) {
                keyidx = info->control.hw_key->hw_key_idx;
                pktlen += info->control.icv_len;
        }
@@ -1249,6 +1262,7 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
 
        txq->link = &ds->ds_link;
        ath5k_hw_tx_start(ah, txq->qnum);
+       mmiowb();
        spin_unlock_bh(&txq->lock);
 
        return 0;
@@ -1583,7 +1597,6 @@ ath5k_rx_stop(struct ath5k_softc *sc)
        ath5k_hw_stop_pcu_recv(ah);     /* disable PCU */
        ath5k_hw_set_rx_filter(ah, 0);  /* clear recv filter */
        ath5k_hw_stop_rx_dma(ah);       /* disable DMA engine */
-       mdelay(3);                      /* 3ms is long enough for 1 frame */
 
        ath5k_debug_printrxbuffs(sc, ah);
 
@@ -1682,31 +1695,44 @@ ath5k_tasklet_rx(unsigned long data)
        struct ath5k_rx_status rs = {};
        struct sk_buff *skb;
        struct ath5k_softc *sc = (void *)data;
-       struct ath5k_buf *bf;
+       struct ath5k_buf *bf, *bf_last;
        struct ath5k_desc *ds;
        int ret;
        int hdrlen;
        int pad;
 
        spin_lock(&sc->rxbuflock);
+       if (list_empty(&sc->rxbuf)) {
+               ATH5K_WARN(sc, "empty rx buf pool\n");
+               goto unlock;
+       }
+       bf_last = list_entry(sc->rxbuf.prev, struct ath5k_buf, list);
        do {
                rxs.flag = 0;
 
-               if (unlikely(list_empty(&sc->rxbuf))) {
-                       ATH5K_WARN(sc, "empty rx buf pool\n");
-                       break;
-               }
                bf = list_first_entry(&sc->rxbuf, struct ath5k_buf, list);
                BUG_ON(bf->skb == NULL);
                skb = bf->skb;
                ds = bf->desc;
 
-               /* TODO only one segment */
-               pci_dma_sync_single_for_cpu(sc->pdev, sc->desc_daddr,
-                               sc->desc_len, PCI_DMA_FROMDEVICE);
-
-               if (unlikely(ds->ds_link == bf->daddr)) /* this is the end */
-                       break;
+               /*
+                * last buffer must not be freed to ensure proper hardware
+                * function. When the hardware finishes also a packet next to
+                * it, we are sure, it doesn't use it anymore and we can go on.
+                */
+               if (bf_last == bf)
+                       bf->flags |= 1;
+               if (bf->flags) {
+                       struct ath5k_buf *bf_next = list_entry(bf->list.next,
+                                       struct ath5k_buf, list);
+                       ret = sc->ah->ah_proc_rx_desc(sc->ah, bf_next->desc,
+                                       &rs);
+                       if (ret)
+                               break;
+                       bf->flags &= ~1;
+                       /* skip the overwritten one (even status is martian) */
+                       goto next;
+               }
 
                ret = sc->ah->ah_proc_rx_desc(sc->ah, ds, &rs);
                if (unlikely(ret == -EINPROGRESS))
@@ -1752,8 +1778,6 @@ ath5k_tasklet_rx(unsigned long data)
                                goto next;
                }
 accept:
-               pci_dma_sync_single_for_cpu(sc->pdev, bf->skbaddr,
-                               rs.rs_datalen, PCI_DMA_FROMDEVICE);
                pci_unmap_single(sc->pdev, bf->skbaddr, sc->rxbufsize,
                                PCI_DMA_FROMDEVICE);
                bf->skb = NULL;
@@ -1816,6 +1840,7 @@ accept:
 next:
                list_move_tail(&bf->list, &sc->rxbuf);
        } while (ath5k_rxbuf_setup(sc, bf) == 0);
+unlock:
        spin_unlock(&sc->rxbuflock);
 }
 
@@ -1840,9 +1865,6 @@ ath5k_tx_processq(struct ath5k_softc *sc, struct ath5k_txq *txq)
        list_for_each_entry_safe(bf, bf0, &txq->q, list) {
                ds = bf->desc;
 
-               /* TODO only one segment */
-               pci_dma_sync_single_for_cpu(sc->pdev, sc->desc_daddr,
-                               sc->desc_len, PCI_DMA_FROMDEVICE);
                ret = sc->ah->ah_proc_tx_desc(sc->ah, ds, &ts);
                if (unlikely(ret == -EINPROGRESS))
                        break;
@@ -2015,8 +2037,6 @@ ath5k_beacon_send(struct ath5k_softc *sc)
                ATH5K_WARN(sc, "beacon queue %u didn't stop?\n", sc->bhalq);
                /* NB: hw still stops DMA, so proceed */
        }
-       pci_dma_sync_single_for_cpu(sc->pdev, bf->skbaddr, bf->skb->len,
-                       PCI_DMA_TODEVICE);
 
        ath5k_hw_put_tx_buf(ah, sc->bhalq, bf->daddr);
        ath5k_hw_tx_start(ah, sc->bhalq);
@@ -2150,6 +2170,7 @@ ath5k_beacon_config(struct ath5k_softc *sc)
 
        ath5k_hw_set_intr(ah, 0);
        sc->bmisscount = 0;
+       sc->imask &= ~(AR5K_INT_BMISS | AR5K_INT_SWBA);
 
        if (sc->opmode == IEEE80211_IF_TYPE_STA) {
                sc->imask |= AR5K_INT_BMISS;
@@ -2240,6 +2261,7 @@ ath5k_init(struct ath5k_softc *sc)
 
        ret = 0;
 done:
+       mmiowb();
        mutex_unlock(&sc->lock);
        return ret;
 }
@@ -2272,6 +2294,7 @@ ath5k_stop_locked(struct ath5k_softc *sc)
        if (!test_bit(ATH_STAT_INVALID, sc->status)) {
                ath5k_led_off(sc);
                ath5k_hw_set_intr(ah, 0);
+               synchronize_irq(sc->pdev->irq);
        }
        ath5k_txq_cleanup(sc);
        if (!test_bit(ATH_STAT_INVALID, sc->status)) {
@@ -2321,9 +2344,13 @@ ath5k_stop_hw(struct ath5k_softc *sc)
                }
        }
        ath5k_txbuf_free(sc, sc->bbuf);
+       mmiowb();
        mutex_unlock(&sc->lock);
 
        del_timer_sync(&sc->calib_tim);
+       tasklet_kill(&sc->rxtq);
+       tasklet_kill(&sc->txtq);
+       tasklet_kill(&sc->restq);
 
        return ret;
 }
@@ -2550,8 +2577,6 @@ ath5k_init_leds(struct ath5k_softc *sc)
        struct pci_dev *pdev = sc->pdev;
        char name[ATH5K_LED_MAX_NAME_LEN + 1];
 
-       sc->led_on = 0;  /* active low */
-
        /*
         * Auto-enable soft led processing for IBM cards and for
         * 5211 minipci cards.
@@ -2560,11 +2585,13 @@ ath5k_init_leds(struct ath5k_softc *sc)
            pdev->device == PCI_DEVICE_ID_ATHEROS_AR5211) {
                __set_bit(ATH_STAT_LEDSOFT, sc->status);
                sc->led_pin = 0;
+               sc->led_on = 0;  /* active low */
        }
        /* Enable softled on PIN1 on HP Compaq nc6xx, nc4000 & nx5000 laptops */
        if (pdev->subsystem_vendor == PCI_VENDOR_ID_COMPAQ) {
                __set_bit(ATH_STAT_LEDSOFT, sc->status);
                sc->led_pin = 1;
+               sc->led_on = 1;  /* active high */
        }
        if (!test_bit(ATH_STAT_LEDSOFT, sc->status))
                goto out;
@@ -2783,6 +2810,7 @@ ath5k_config_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
                /* XXX: assoc id is set to 0 for now, mac80211 doesn't have
                 * a clean way of letting us retrieve this yet. */
                ath5k_hw_set_associd(ah, ah->ah_bssid, 0);
+               mmiowb();
        }
 
        if (conf->changed & IEEE80211_IFCC_BEACON &&
@@ -2971,6 +2999,7 @@ ath5k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
        }
 
 unlock:
+       mmiowb();
        mutex_unlock(&sc->lock);
        return ret;
 }
@@ -3032,8 +3061,6 @@ ath5k_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)
 
        ath5k_debug_dump_skb(sc, skb, "BC  ", 1);
 
-       mutex_lock(&sc->lock);
-
        if (sc->opmode != IEEE80211_IF_TYPE_IBSS) {
                ret = -EIO;
                goto end;
@@ -3044,11 +3071,12 @@ ath5k_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)
        ret = ath5k_beacon_setup(sc, sc->bbuf);
        if (ret)
                sc->bbuf->skb = NULL;
-       else
+       else {
                ath5k_beacon_config(sc);
+               mmiowb();
+       }
 
 end:
-       mutex_unlock(&sc->lock);
        return ret;
 }
 
index 47f414b..d7e03e6 100644 (file)
@@ -56,7 +56,7 @@
 
 struct ath5k_buf {
        struct list_head        list;
-       unsigned int            flags;  /* tx descriptor flags */
+       unsigned int            flags;  /* rx descriptor flags */
        struct ath5k_desc       *desc;  /* virtual addr of desc */
        dma_addr_t              daddr;  /* physical addr of desc */
        struct sk_buff          *skb;   /* skbuff for buf */
index 41d5fa3..6fa6c8e 100644 (file)
@@ -129,7 +129,7 @@ static struct reg regs[] = {
        REG_STRUCT_INIT(AR5K_CPC1),
        REG_STRUCT_INIT(AR5K_CPC2),
        REG_STRUCT_INIT(AR5K_CPC3),
-       REG_STRUCT_INIT(AR5K_CPCORN),
+       REG_STRUCT_INIT(AR5K_CPCOVF),
        REG_STRUCT_INIT(AR5K_RESET_CTL),
        REG_STRUCT_INIT(AR5K_SLEEP_CTL),
        REG_STRUCT_INIT(AR5K_INTPEND),
index 2cf8d18..ffc5293 100644 (file)
@@ -63,7 +63,6 @@
 
 struct ath5k_softc;
 struct ath5k_hw;
-struct ieee80211_hw_mode;
 struct sk_buff;
 struct ath5k_buf;
 
index c6d12c5..ad1a5b4 100644 (file)
@@ -139,6 +139,8 @@ static int ath5k_hw_post(struct ath5k_hw *ah)
        for (c = 0; c < 2; c++) {
 
                cur_reg = regs[c];
+
+               /* Save previous value */
                init_val = ath5k_hw_reg_read(ah, cur_reg);
 
                for (i = 0; i < 256; i++) {
@@ -170,6 +172,10 @@ static int ath5k_hw_post(struct ath5k_hw *ah)
                        var_pattern = 0x003b080f;
                        ath5k_hw_reg_write(ah, var_pattern, cur_reg);
                }
+
+               /* Restore previous value */
+               ath5k_hw_reg_write(ah, init_val, cur_reg);
+
        }
 
        return 0;
@@ -287,67 +293,42 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version)
        /* Identify the radio chip*/
        if (ah->ah_version == AR5K_AR5210) {
                ah->ah_radio = AR5K_RF5110;
+       /*
+        * Register returns 0x0/0x04 for radio revision
+        * so ath5k_hw_radio_revision doesn't parse the value
+        * correctly. For now we are based on mac's srev to
+        * identify RF2425 radio.
+        */
+       } else if (srev == AR5K_SREV_VER_AR2425) {
+               ah->ah_radio = AR5K_RF2425;
+               ah->ah_phy_spending = AR5K_PHY_SPENDING_RF2425;
        } else if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_5112) {
                ah->ah_radio = AR5K_RF5111;
                ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5111;
        } else if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_SC0) {
-
                ah->ah_radio = AR5K_RF5112;
-
-               if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_5112A) {
-                       ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5112;
-               } else {
-                       ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5112A;
-               }
-
+               ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5112;
        } else if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_SC1) {
                ah->ah_radio = AR5K_RF2413;
-               ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5112A;
+               ah->ah_phy_spending = AR5K_PHY_SPENDING_RF2413;
        } else if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_SC2) {
                ah->ah_radio = AR5K_RF5413;
-               ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5112A;
+               ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5413;
        } else if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_5133) {
-
                /* AR5424 */
                if (srev >= AR5K_SREV_VER_AR5424) {
                        ah->ah_radio = AR5K_RF5413;
-                       ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5424;
+                       ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5413;
                /* AR2424 */
                } else {
                        ah->ah_radio = AR5K_RF2413; /* For testing */
-                       ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5112A;
+                       ah->ah_phy_spending = AR5K_PHY_SPENDING_RF2413;
                }
-
-       /*
-        * Register returns 0x4 for radio revision
-        * so ath5k_hw_radio_revision doesn't parse the value
-        * correctly. For now we are based on mac's srev to
-        * identify RF2425 radio.
-        */
-       } else if (srev == AR5K_SREV_VER_AR2425) {
-               ah->ah_radio = AR5K_RF2425;
-               ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5112;
        }
-
        ah->ah_phy = AR5K_PHY(0);
 
        /*
-        * Identify AR5212-based PCI-E cards
-        * And write some initial settings.
-        *
-        * (doing a "strings" on ndis driver
-        * -ar5211.sys- reveals the following
-        * pci-e related functions:
-        *
-        * pcieClockReq
-        * pcieRxErrNotify
-        * pcieL1SKPEnable
-        * pcieAspm
-        * pcieDisableAspmOnRfWake
-        * pciePowerSaveEnable
-        *
-        * I guess these point to ClockReq but
-        * i'm not sure.)
+        * Write PCI-E power save settings
         */
        if ((ah->ah_version == AR5K_AR5212) && (pdev->is_pcie)) {
                ath5k_hw_reg_write(ah, 0x9248fc00, 0x4080);
@@ -369,10 +350,15 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version)
        if (ret)
                goto err_free;
 
+       /* Write AR5K_PCICFG_UNK on 2112B and later chips */
+       if (ah->ah_radio_5ghz_revision > AR5K_SREV_RAD_2112B ||
+       srev > AR5K_SREV_VER_AR2413) {
+               ath5k_hw_reg_write(ah, AR5K_PCICFG_UNK, AR5K_PCICFG);
+       }
+
        /*
         * Get card capabilities, values, ...
         */
-
        ret = ath5k_eeprom_init(ah);
        if (ret) {
                ATH5K_ERR(sc, "unable to init EEPROM\n");
@@ -843,27 +829,41 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum ieee80211_if_types op_mode,
                 * Write some more initial register settings
                 */
                if (ah->ah_version == AR5K_AR5212) {
-                       ath5k_hw_reg_write(ah, 0x0002a002, AR5K_PHY(11));
+                       ath5k_hw_reg_write(ah, 0x0002a002, 0x982c);
 
                        if (channel->hw_value == CHANNEL_G)
                                if (ah->ah_mac_srev < AR5K_SREV_VER_AR2413)
                                        ath5k_hw_reg_write(ah, 0x00f80d80,
-                                               AR5K_PHY(83));
+                                                               0x994c);
                                else if (ah->ah_mac_srev < AR5K_SREV_VER_AR2424)
                                        ath5k_hw_reg_write(ah, 0x00380140,
-                                               AR5K_PHY(83));
+                                                               0x994c);
                                else if (ah->ah_mac_srev < AR5K_SREV_VER_AR2425)
                                        ath5k_hw_reg_write(ah, 0x00fc0ec0,
-                                               AR5K_PHY(83));
+                                                               0x994c);
                                else /* 2425 */
                                        ath5k_hw_reg_write(ah, 0x00fc0fc0,
-                                               AR5K_PHY(83));
+                                                               0x994c);
                        else
-                               ath5k_hw_reg_write(ah, 0x00000000,
-                                       AR5K_PHY(83));
-
-                       ath5k_hw_reg_write(ah, 0x000009b5, 0xa228);
-                       ath5k_hw_reg_write(ah, 0x0000000f, 0x8060);
+                               ath5k_hw_reg_write(ah, 0x00000000, 0x994c);
+
+                       /* Some bits are disabled here, we know nothing about
+                        * register 0xa228 yet, most of the times this ends up
+                        * with a value 0x9b5 -haven't seen any dump with
+                        * a different value- */
+                       /* Got this from decompiling binary HAL */
+                       data = ath5k_hw_reg_read(ah, 0xa228);
+                       data &= 0xfffffdff;
+                       ath5k_hw_reg_write(ah, data, 0xa228);
+
+                       data = ath5k_hw_reg_read(ah, 0xa228);
+                       data &= 0xfffe03ff;
+                       ath5k_hw_reg_write(ah, data, 0xa228);
+                       data = 0;
+
+                       /* Just write 0x9b5 ? */
+                       /* ath5k_hw_reg_write(ah, 0x000009b5, 0xa228); */
+                       ath5k_hw_reg_write(ah, 0x0000000f, AR5K_SEQ_MASK);
                        ath5k_hw_reg_write(ah, 0x00000000, 0xa254);
                        ath5k_hw_reg_write(ah, 0x0000000e, AR5K_PHY_SCAL);
                }
@@ -879,6 +879,7 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum ieee80211_if_types op_mode,
                        else
                                data = 0xffb80d20;
                        ath5k_hw_reg_write(ah, data, AR5K_PHY_FRAME_CTL);
+                       data = 0;
                }
 
                /*
@@ -898,7 +899,6 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum ieee80211_if_types op_mode,
 
                /*
                 * Write RF registers
-                * TODO:Does this work on 5211 (5111) ?
                 */
                ret = ath5k_hw_rfregs(ah, channel, mode);
                if (ret)
@@ -935,7 +935,7 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum ieee80211_if_types op_mode,
                        return ret;
 
                /* Set antenna mode */
-               AR5K_REG_MASKED_BITS(ah, AR5K_PHY(0x44),
+               AR5K_REG_MASKED_BITS(ah, AR5K_PHY_ANT_CTL,
                        ah->ah_antenna[ee_mode][0], 0xfffffc06);
 
                /*
@@ -965,15 +965,15 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum ieee80211_if_types op_mode,
 
                ath5k_hw_reg_write(ah,
                        AR5K_PHY_NF_SVAL(ee->ee_noise_floor_thr[ee_mode]),
-                       AR5K_PHY(0x5a));
+                       AR5K_PHY_NFTHRES);
 
-               AR5K_REG_MASKED_BITS(ah, AR5K_PHY(0x11),
+               AR5K_REG_MASKED_BITS(ah, AR5K_PHY_SETTLING,
                        (ee->ee_switch_settling[ee_mode] << 7) & 0x3f80,
                        0xffffc07f);
-               AR5K_REG_MASKED_BITS(ah, AR5K_PHY(0x12),
+               AR5K_REG_MASKED_BITS(ah, AR5K_PHY_GAIN,
                        (ee->ee_ant_tx_rx[ee_mode] << 12) & 0x3f000,
                        0xfffc0fff);
-               AR5K_REG_MASKED_BITS(ah, AR5K_PHY(0x14),
+               AR5K_REG_MASKED_BITS(ah, AR5K_PHY_DESIRED_SIZE,
                        (ee->ee_adc_desired_size[ee_mode] & 0x00ff) |
                        ((ee->ee_pga_desired_size[ee_mode] << 8) & 0xff00),
                        0xffff0000);
@@ -982,13 +982,13 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum ieee80211_if_types op_mode,
                        (ee->ee_tx_end2xpa_disable[ee_mode] << 24) |
                        (ee->ee_tx_end2xpa_disable[ee_mode] << 16) |
                        (ee->ee_tx_frm2xpa_enable[ee_mode] << 8) |
-                       (ee->ee_tx_frm2xpa_enable[ee_mode]), AR5K_PHY(0x0d));
+                       (ee->ee_tx_frm2xpa_enable[ee_mode]), AR5K_PHY_RF_CTL4);
 
-               AR5K_REG_MASKED_BITS(ah, AR5K_PHY(0x0a),
+               AR5K_REG_MASKED_BITS(ah, AR5K_PHY_RF_CTL3,
                        ee->ee_tx_end2xlna_enable[ee_mode] << 8, 0xffff00ff);
-               AR5K_REG_MASKED_BITS(ah, AR5K_PHY(0x19),
+               AR5K_REG_MASKED_BITS(ah, AR5K_PHY_NF,
                        (ee->ee_thr_62[ee_mode] << 12) & 0x7f000, 0xfff80fff);
-               AR5K_REG_MASKED_BITS(ah, AR5K_PHY(0x49), 4, 0xffffff01);
+               AR5K_REG_MASKED_BITS(ah, AR5K_PHY_OFDM_SELFCORR, 4, 0xffffff01);
 
                AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_IQ,
                    AR5K_PHY_IQ_CORR_ENABLE |
@@ -1063,7 +1063,8 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum ieee80211_if_types op_mode,
        ath5k_hw_reg_write(ah, AR5K_PHY_ACT_ENABLE, AR5K_PHY_ACT);
 
        /*
-        * 5111/5112 Specific
+        * On 5211+ read activation -> rx delay
+        * and use it.
         */
        if (ah->ah_version != AR5K_AR5210) {
                data = ath5k_hw_reg_read(ah, AR5K_PHY_RX_DELAY) &
@@ -1071,40 +1072,77 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum ieee80211_if_types op_mode,
                data = (channel->hw_value & CHANNEL_CCK) ?
                        ((data << 2) / 22) : (data / 10);
 
-               udelay(100 + data);
+               udelay(100 + (2 * data));
+               data = 0;
        } else {
                mdelay(1);
        }
 
        /*
-        * Enable calibration and wait until completion
+        * Perform ADC test (?)
+        */
+       data = ath5k_hw_reg_read(ah, AR5K_PHY_TST1);
+       ath5k_hw_reg_write(ah, AR5K_PHY_TST1_TXHOLD, AR5K_PHY_TST1);
+       for (i = 0; i <= 20; i++) {
+               if (!(ath5k_hw_reg_read(ah, AR5K_PHY_ADC_TEST) & 0x10))
+                       break;
+               udelay(200);
+       }
+       ath5k_hw_reg_write(ah, data, AR5K_PHY_TST1);
+       data = 0;
+
+       /*
+        * Start automatic gain calibration
+        *
+        * During AGC calibration RX path is re-routed to
+        * a signal detector so we don't receive anything.
+        *
+        * This method is used to calibrate some static offsets
+        * used together with on-the fly I/Q calibration (the
+        * one performed via ath5k_hw_phy_calibrate), that doesn't
+        * interrupt rx path.
+        *
+        * If we are in a noisy environment AGC calibration may time
+        * out.
         */
        AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_AGCCTL,
                                AR5K_PHY_AGCCTL_CAL);
 
+       /* At the same time start I/Q calibration for QAM constellation
+        * -no need for CCK- */
+       ah->ah_calibration = false;
+       if (!(mode == AR5K_MODE_11B)) {
+               ah->ah_calibration = true;
+               AR5K_REG_WRITE_BITS(ah, AR5K_PHY_IQ,
+                               AR5K_PHY_IQ_CAL_NUM_LOG_MAX, 15);
+               AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_IQ,
+                               AR5K_PHY_IQ_RUN);
+       }
+
+       /* Wait for gain calibration to finish (we check for I/Q calibration
+        * during ath5k_phy_calibrate) */
        if (ath5k_hw_register_timeout(ah, AR5K_PHY_AGCCTL,
                        AR5K_PHY_AGCCTL_CAL, 0, false)) {
-               ATH5K_ERR(ah->ah_sc, "calibration timeout (%uMHz)\n",
+               ATH5K_ERR(ah->ah_sc, "gain calibration timeout (%uMHz)\n",
                        channel->center_freq);
                return -EAGAIN;
        }
 
+       /*
+        * Start noise floor calibration
+        *
+        * If we run NF calibration before AGC, it always times out.
+        * Binary HAL starts NF and AGC calibration at the same time
+        * and only waits for AGC to finish. I believe that's wrong because
+        * during NF calibration, rx path is also routed to a detector, so if
+        * it doesn't finish we won't have RX.
+        *
+        * XXX: Find an interval that's OK for all cards...
+        */
        ret = ath5k_hw_noise_floor_calibration(ah, channel->center_freq);
        if (ret)
                return ret;
 
-       ah->ah_calibration = false;
-
-       /* A and G modes can use QAM modulation which requires enabling
-        * I and Q calibration. Don't bother in B mode. */
-       if (!(mode == AR5K_MODE_11B)) {
-               ah->ah_calibration = true;
-               AR5K_REG_WRITE_BITS(ah, AR5K_PHY_IQ,
-                               AR5K_PHY_IQ_CAL_NUM_LOG_MAX, 15);
-               AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_IQ,
-                               AR5K_PHY_IQ_RUN);
-       }
-
        /*
         * Reset queues and start beacon timers at the end of the reset routine
         */
@@ -1154,6 +1192,12 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum ieee80211_if_types op_mode,
                ath5k_hw_reg_write(ah, AR5K_PHY_SCLOCK_32MHZ, AR5K_PHY_SCLOCK);
                ath5k_hw_reg_write(ah, AR5K_PHY_SDELAY_32MHZ, AR5K_PHY_SDELAY);
                ath5k_hw_reg_write(ah, ah->ah_phy_spending, AR5K_PHY_SPENDING);
+
+               data = ath5k_hw_reg_read(ah, AR5K_USEC_5211) & 0xffffc07f ;
+               data |= (ah->ah_phy_spending == AR5K_PHY_SPENDING_18) ?
+                                               0x00000f80 : 0x00001380 ;
+               ath5k_hw_reg_write(ah, data, AR5K_USEC_5211);
+               data = 0;
        }
 
        if (ah->ah_version == AR5K_AR5212) {
@@ -1226,7 +1270,7 @@ int ath5k_hw_set_power(struct ath5k_hw *ah, enum ath5k_power_mode mode,
                bool set_chip, u16 sleep_duration)
 {
        unsigned int i;
-       u32 staid;
+       u32 staid, data;
 
        ATH5K_TRACE(ah->ah_sc);
        staid = ath5k_hw_reg_read(ah, AR5K_STA_ID1);
@@ -1238,7 +1282,8 @@ int ath5k_hw_set_power(struct ath5k_hw *ah, enum ath5k_power_mode mode,
        case AR5K_PM_NETWORK_SLEEP:
                if (set_chip)
                        ath5k_hw_reg_write(ah,
-                               AR5K_SLEEP_CTL_SLE | sleep_duration,
+                               AR5K_SLEEP_CTL_SLE_ALLOW |
+                               sleep_duration,
                                AR5K_SLEEP_CTL);
 
                staid |= AR5K_STA_ID1_PWR_SV;
@@ -1253,13 +1298,24 @@ int ath5k_hw_set_power(struct ath5k_hw *ah, enum ath5k_power_mode mode,
                break;
 
        case AR5K_PM_AWAKE:
+
+               staid &= ~AR5K_STA_ID1_PWR_SV;
+
                if (!set_chip)
                        goto commit;
 
-               ath5k_hw_reg_write(ah, AR5K_SLEEP_CTL_SLE_WAKE,
-                               AR5K_SLEEP_CTL);
+               /* Preserve sleep duration */
+               data = ath5k_hw_reg_read(ah, AR5K_SLEEP_CTL);
+               if( data & 0xffc00000 ){
+                       data = 0;
+               } else {
+                       data = data & 0xfffcffff;
+               }
 
-               for (i = 5000; i > 0; i--) {
+               ath5k_hw_reg_write(ah, data, AR5K_SLEEP_CTL);
+               udelay(15);
+
+               for (i = 50; i > 0; i--) {
                        /* Check if the chip did wake up */
                        if ((ath5k_hw_reg_read(ah, AR5K_PCICFG) &
                                        AR5K_PCICFG_SPWR_DN) == 0)
@@ -1267,15 +1323,13 @@ int ath5k_hw_set_power(struct ath5k_hw *ah, enum ath5k_power_mode mode,
 
                        /* Wait a bit and retry */
                        udelay(200);
-                       ath5k_hw_reg_write(ah, AR5K_SLEEP_CTL_SLE_WAKE,
-                               AR5K_SLEEP_CTL);
+                       ath5k_hw_reg_write(ah, data, AR5K_SLEEP_CTL);
                }
 
                /* Fail if the chip didn't wake up */
                if (i <= 0)
                        return -EIO;
 
-               staid &= ~AR5K_STA_ID1_PWR_SV;
                break;
 
        default:
@@ -1304,6 +1358,7 @@ void ath5k_hw_start_rx(struct ath5k_hw *ah)
 {
        ATH5K_TRACE(ah->ah_sc);
        ath5k_hw_reg_write(ah, AR5K_CR_RXE, AR5K_CR);
+       ath5k_hw_reg_read(ah, AR5K_CR);
 }
 
 /*
@@ -1390,6 +1445,7 @@ int ath5k_hw_tx_start(struct ath5k_hw *ah, unsigned int queue)
                }
                /* Start queue */
                ath5k_hw_reg_write(ah, tx_queue, AR5K_CR);
+               ath5k_hw_reg_read(ah, AR5K_CR);
        } else {
                /* Return if queue is disabled */
                if (AR5K_REG_READ_Q(ah, AR5K_QCU_TXD, queue))
@@ -1440,6 +1496,7 @@ int ath5k_hw_stop_tx_dma(struct ath5k_hw *ah, unsigned int queue)
 
                /* Stop queue */
                ath5k_hw_reg_write(ah, tx_queue, AR5K_CR);
+               ath5k_hw_reg_read(ah, AR5K_CR);
        } else {
                /*
                 * Schedule TX disable and wait until queue is empty
@@ -1456,6 +1513,8 @@ int ath5k_hw_stop_tx_dma(struct ath5k_hw *ah, unsigned int queue)
 
                /* Clear register */
                ath5k_hw_reg_write(ah, 0, AR5K_QCU_TXD);
+               if (pending)
+                       return -EBUSY;
        }
 
        /* TODO: Check for success else return error */
@@ -1684,6 +1743,7 @@ enum ath5k_int ath5k_hw_set_intr(struct ath5k_hw *ah, enum ath5k_int new_mask)
         * (they will be re-enabled afterwards).
         */
        ath5k_hw_reg_write(ah, AR5K_IER_DISABLE, AR5K_IER);
+       ath5k_hw_reg_read(ah, AR5K_IER);
 
        old_mask = ah->ah_imr;
 
@@ -1716,6 +1776,7 @@ enum ath5k_int ath5k_hw_set_intr(struct ath5k_hw *ah, enum ath5k_int new_mask)
 
        /* ..re-enable interrupts */
        ath5k_hw_reg_write(ah, AR5K_IER_ENABLE, AR5K_IER);
+       ath5k_hw_reg_read(ah, AR5K_IER);
 
        return old_mask;
 }
@@ -3359,11 +3420,13 @@ int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah, unsigned int queue)
                ath5k_hw_reg_write(ah, ah->ah_turbo ?
                        AR5K_INIT_PROTO_TIME_CNTRL_TURBO :
                        AR5K_INIT_PROTO_TIME_CNTRL, AR5K_IFS1);
-               /* Set PHY register 0x9844 (??) */
+               /* Set AR5K_PHY_SETTLING */
                ath5k_hw_reg_write(ah, ah->ah_turbo ?
-                       (ath5k_hw_reg_read(ah, AR5K_PHY(17)) & ~0x7F) | 0x38 :
-                       (ath5k_hw_reg_read(ah, AR5K_PHY(17)) & ~0x7F) | 0x1C,
-                       AR5K_PHY(17));
+                       (ath5k_hw_reg_read(ah, AR5K_PHY_SETTLING) & ~0x7F)
+                       | 0x38 :
+                       (ath5k_hw_reg_read(ah, AR5K_PHY_SETTLING) & ~0x7F)
+                       | 0x1C,
+                       AR5K_PHY_SETTLING);
                /* Set Frame Control Register */
                ath5k_hw_reg_write(ah, ah->ah_turbo ?
                        (AR5K_PHY_FRAME_CTL_INI | AR5K_PHY_TURBO_MODE |
@@ -3484,7 +3547,7 @@ int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah, unsigned int queue)
                        if (tq->tqi_flags & AR5K_TXQ_FLAG_RDYTIME_EXP_POLICY_ENABLE)
                                AR5K_REG_ENABLE_BITS(ah,
                                        AR5K_QUEUE_MISC(queue),
-                                       AR5K_QCU_MISC_TXE);
+                                       AR5K_QCU_MISC_RDY_VEOL_POLICY);
                }
 
                if (tq->tqi_flags & AR5K_TXQ_FLAG_BACKOFF_DISABLE)
index 04c84e9..2806b21 100644 (file)
@@ -489,7 +489,7 @@ static const struct ath5k_ini ar5212_ini[] = {
        { AR5K_QUEUE_TXDP(9),   0x00000000 },
        { AR5K_DCU_FP,          0x00000000 },
        { AR5K_DCU_TXP,         0x00000000 },
-       { AR5K_DCU_TX_FILTER,   0x00000000 },
+       { AR5K_DCU_TX_FILTER_0_BASE,    0x00000000 },
        /* Unknown table */
        { 0x1078, 0x00000000 },
        { 0x10b8, 0x00000000 },
@@ -679,7 +679,7 @@ static const struct ath5k_ini ar5212_ini[] = {
        { AR5K_PHY(645), 0x00106c10 },
        { AR5K_PHY(646), 0x009c4060 },
        { AR5K_PHY(647), 0x1483800a },
-       /* { AR5K_PHY(648), 0x018830c6 },*/ /* 2413 */
+       /* { AR5K_PHY(648), 0x018830c6 },*/ /* 2413/2425 */
        { AR5K_PHY(648), 0x01831061 },
        { AR5K_PHY(649), 0x00000400 },
        /*{ AR5K_PHY(650), 0x000001b5 },*/
index afd8689..fa0d47f 100644 (file)
@@ -1020,6 +1020,74 @@ static const struct ath5k_ini_rfgain rfgain_2413[] = {
        { AR5K_RF_GAIN(63), { 0x000000f9 } },
 };
 
+/* Initial RF Gain settings for RF2425 */
+static const struct ath5k_ini_rfgain rfgain_2425[] = {
+       { AR5K_RF_GAIN(0), { 0x00000000 } },
+       { AR5K_RF_GAIN(1), { 0x00000040 } },
+       { AR5K_RF_GAIN(2), { 0x00000080 } },
+       { AR5K_RF_GAIN(3), { 0x00000181 } },
+       { AR5K_RF_GAIN(4), { 0x000001c1 } },
+       { AR5K_RF_GAIN(5), { 0x00000001 } },
+       { AR5K_RF_GAIN(6), { 0x00000041 } },
+       { AR5K_RF_GAIN(7), { 0x00000081 } },
+       { AR5K_RF_GAIN(8), { 0x00000188 } },
+       { AR5K_RF_GAIN(9), { 0x000001c8 } },
+       { AR5K_RF_GAIN(10), { 0x00000008 } },
+       { AR5K_RF_GAIN(11), { 0x00000048 } },
+       { AR5K_RF_GAIN(12), { 0x00000088 } },
+       { AR5K_RF_GAIN(13), { 0x00000189 } },
+       { AR5K_RF_GAIN(14), { 0x000001c9 } },
+       { AR5K_RF_GAIN(15), { 0x00000009 } },
+       { AR5K_RF_GAIN(16), { 0x00000049 } },
+       { AR5K_RF_GAIN(17), { 0x00000089 } },
+       { AR5K_RF_GAIN(18), { 0x000001b0 } },
+       { AR5K_RF_GAIN(19), { 0x000001f0 } },
+       { AR5K_RF_GAIN(20), { 0x00000030 } },
+       { AR5K_RF_GAIN(21), { 0x00000070 } },
+       { AR5K_RF_GAIN(22), { 0x00000171 } },
+       { AR5K_RF_GAIN(23), { 0x000001b1 } },
+       { AR5K_RF_GAIN(24), { 0x000001f1 } },
+       { AR5K_RF_GAIN(25), { 0x00000031 } },
+       { AR5K_RF_GAIN(26), { 0x00000071 } },
+       { AR5K_RF_GAIN(27), { 0x000001b8 } },
+       { AR5K_RF_GAIN(28), { 0x000001f8 } },
+       { AR5K_RF_GAIN(29), { 0x00000038 } },
+       { AR5K_RF_GAIN(30), { 0x00000078 } },
+       { AR5K_RF_GAIN(31), { 0x000000b8 } },
+       { AR5K_RF_GAIN(32), { 0x000001b9 } },
+       { AR5K_RF_GAIN(33), { 0x000001f9 } },
+       { AR5K_RF_GAIN(34), { 0x00000039 } },
+       { AR5K_RF_GAIN(35), { 0x00000079 } },
+       { AR5K_RF_GAIN(36), { 0x000000b9 } },
+       { AR5K_RF_GAIN(37), { 0x000000f9 } },
+       { AR5K_RF_GAIN(38), { 0x000000f9 } },
+       { AR5K_RF_GAIN(39), { 0x000000f9 } },
+       { AR5K_RF_GAIN(40), { 0x000000f9 } },
+       { AR5K_RF_GAIN(41), { 0x000000f9 } },
+       { AR5K_RF_GAIN(42), { 0x000000f9 } },
+       { AR5K_RF_GAIN(43), { 0x000000f9 } },
+       { AR5K_RF_GAIN(44), { 0x000000f9 } },
+       { AR5K_RF_GAIN(45), { 0x000000f9 } },
+       { AR5K_RF_GAIN(46), { 0x000000f9 } },
+       { AR5K_RF_GAIN(47), { 0x000000f9 } },
+       { AR5K_RF_GAIN(48), { 0x000000f9 } },
+       { AR5K_RF_GAIN(49), { 0x000000f9 } },
+       { AR5K_RF_GAIN(50), { 0x000000f9 } },
+       { AR5K_RF_GAIN(51), { 0x000000f9 } },
+       { AR5K_RF_GAIN(52), { 0x000000f9 } },
+       { AR5K_RF_GAIN(53), { 0x000000f9 } },
+       { AR5K_RF_GAIN(54), { 0x000000f9 } },
+       { AR5K_RF_GAIN(55), { 0x000000f9 } },
+       { AR5K_RF_GAIN(56), { 0x000000f9 } },
+       { AR5K_RF_GAIN(57), { 0x000000f9 } },
+       { AR5K_RF_GAIN(58), { 0x000000f9 } },
+       { AR5K_RF_GAIN(59), { 0x000000f9 } },
+       { AR5K_RF_GAIN(60), { 0x000000f9 } },
+       { AR5K_RF_GAIN(61), { 0x000000f9 } },
+       { AR5K_RF_GAIN(62), { 0x000000f9 } },
+       { AR5K_RF_GAIN(63), { 0x000000f9 } },
+};
+
 static const struct ath5k_gain_opt rfgain_opt_5112 = {
        1,
        8,
@@ -1588,8 +1656,8 @@ int ath5k_hw_rfgain(struct ath5k_hw *ah, unsigned int freq)
                freq = 0; /* only 2Ghz */
                break;
        case AR5K_RF2425:
-               ath5k_rfg = rfgain_2413;
-               size = ARRAY_SIZE(rfgain_2413);
+               ath5k_rfg = rfgain_2425;
+               size = ARRAY_SIZE(rfgain_2425);
                freq = 0; /* only 2Ghz */
                break;
        default:
@@ -1830,9 +1898,6 @@ static int ath5k_hw_rf5112_channel(struct ath5k_hw *ah,
        data = data0 = data1 = data2 = 0;
        c = channel->center_freq;
 
-       /*
-        * Set the channel on the RF5112 or newer
-        */
        if (c < 4800) {
                if (!((c - 2224) % 5)) {
                        data0 = ((2 * (c - 704)) - 3040) / 10;
@@ -1844,7 +1909,7 @@ static int ath5k_hw_rf5112_channel(struct ath5k_hw *ah,
                        return -EINVAL;
 
                data0 = ath5k_hw_bitswap((data0 << 2) & 0xff, 8);
-       } else {
+       } else if ((c - (c % 5)) != 2 || c > 5435) {
                if (!(c % 20) && c >= 5120) {
                        data0 = ath5k_hw_bitswap(((c - 4800) / 20 << 2), 8);
                        data2 = ath5k_hw_bitswap(3, 2);
@@ -1856,6 +1921,9 @@ static int ath5k_hw_rf5112_channel(struct ath5k_hw *ah,
                        data2 = ath5k_hw_bitswap(1, 2);
                } else
                        return -EINVAL;
+       } else {
+               data0 = ath5k_hw_bitswap((10 * (c - 2) - 4800) / 25 + 1, 8);
+               data2 = ath5k_hw_bitswap(0, 2);
        }
 
        data = (data0 << 4) | (data1 << 1) | (data2 << 2) | 0x1001;
@@ -1866,6 +1934,45 @@ static int ath5k_hw_rf5112_channel(struct ath5k_hw *ah,
        return 0;
 }
 
+/*
+ * Set the channel on the RF2425
+ */
+static int ath5k_hw_rf2425_channel(struct ath5k_hw *ah,
+               struct ieee80211_channel *channel)
+{
+       u32 data, data0, data2;
+       u16 c;
+
+       data = data0 = data2 = 0;
+       c = channel->center_freq;
+
+       if (c < 4800) {
+               data0 = ath5k_hw_bitswap((c - 2272), 8);
+               data2 = 0;
+       /* ? 5GHz ? */
+       } else if ((c - (c % 5)) != 2 || c > 5435) {
+               if (!(c % 20) && c < 5120)
+                       data0 = ath5k_hw_bitswap(((c - 4800) / 20 << 2), 8);
+               else if (!(c % 10))
+                       data0 = ath5k_hw_bitswap(((c - 4800) / 10 << 1), 8);
+               else if (!(c % 5))
+                       data0 = ath5k_hw_bitswap((c - 4800) / 5, 8);
+               else
+                       return -EINVAL;
+               data2 = ath5k_hw_bitswap(1, 2);
+       } else {
+               data0 = ath5k_hw_bitswap((10 * (c - 2) - 4800) / 25 + 1, 8);
+               data2 = ath5k_hw_bitswap(0, 2);
+       }
+
+       data = (data0 << 4) | data2 << 2 | 0x1001;
+
+       ath5k_hw_reg_write(ah, data & 0xff, AR5K_RF_BUFFER);
+       ath5k_hw_reg_write(ah, (data >> 8) & 0x7f, AR5K_RF_BUFFER_CONTROL_5);
+
+       return 0;
+}
+
 /*
  * Set a channel on the radio chip
  */
@@ -1895,6 +2002,9 @@ int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *channel)
        case AR5K_RF5111:
                ret = ath5k_hw_rf5111_channel(ah, channel);
                break;
+       case AR5K_RF2425:
+               ret = ath5k_hw_rf2425_channel(ah, channel);
+               break;
        default:
                ret = ath5k_hw_rf5112_channel(ah, channel);
                break;
@@ -1903,6 +2013,15 @@ int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *channel)
        if (ret)
                return ret;
 
+       /* Set JAPAN setting for channel 14 */
+       if (channel->center_freq == 2484) {
+               AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_CCKTXCTL,
+                               AR5K_PHY_CCKTXCTL_JAPAN);
+       } else {
+               AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_CCKTXCTL,
+                               AR5K_PHY_CCKTXCTL_WORLD);
+       }
+
        ah->ah_current_channel.center_freq = channel->center_freq;
        ah->ah_current_channel.hw_value = channel->hw_value;
        ah->ah_turbo = channel->hw_value == CHANNEL_T ? true : false;
@@ -1933,6 +2052,8 @@ int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *channel)
  * http://patft.uspto.gov/netacgi/nph-Parser?Sect1=PTO1&Sect2=HITOFF&d=PALL \
  * &p=1&u=%2Fnetahtml%2FPTO%2Fsrchnum.htm&r=1&f=G&l=50&s1=7245893.PN.&OS=PN/7
  *
+ * XXX: Since during noise floor calibration antennas are detached according to
+ * the patent, we should stop tx queues here.
  */
 int
 ath5k_hw_noise_floor_calibration(struct ath5k_hw *ah, short freq)
@@ -1942,7 +2063,7 @@ ath5k_hw_noise_floor_calibration(struct ath5k_hw *ah, short freq)
        s32 noise_floor;
 
        /*
-        * Enable noise floor calibration and wait until completion
+        * Enable noise floor calibration
         */
        AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_AGCCTL,
                                AR5K_PHY_AGCCTL_NF);
@@ -1952,7 +2073,7 @@ ath5k_hw_noise_floor_calibration(struct ath5k_hw *ah, short freq)
        if (ret) {
                ATH5K_ERR(ah->ah_sc,
                        "noise floor calibration timeout (%uMHz)\n", freq);
-               return ret;
+               return -EAGAIN;
        }
 
        /* Wait until the noise floor is calibrated and read the value */
@@ -1974,7 +2095,7 @@ ath5k_hw_noise_floor_calibration(struct ath5k_hw *ah, short freq)
        if (noise_floor > AR5K_TUNE_NOISE_FLOOR) {
                ATH5K_ERR(ah->ah_sc,
                        "noise floor calibration failed (%uMHz)\n", freq);
-               return -EIO;
+               return -EAGAIN;
        }
 
        ah->ah_noise_floor = noise_floor;
@@ -2087,38 +2208,66 @@ static int ath5k_hw_rf5110_calibrate(struct ath5k_hw *ah,
 }
 
 /*
- * Perform a PHY calibration on RF5111/5112
+ * Perform a PHY calibration on RF5111/5112 and newer chips
  */
 static int ath5k_hw_rf511x_calibrate(struct ath5k_hw *ah,
                struct ieee80211_channel *channel)
 {
        u32 i_pwr, q_pwr;
        s32 iq_corr, i_coff, i_coffd, q_coff, q_coffd;
+       int i;
        ATH5K_TRACE(ah->ah_sc);
 
        if (!ah->ah_calibration ||
-                       ath5k_hw_reg_read(ah, AR5K_PHY_IQ) & AR5K_PHY_IQ_RUN)
+               ath5k_hw_reg_read(ah, AR5K_PHY_IQ) & AR5K_PHY_IQ_RUN)
                goto done;
 
-       ah->ah_calibration = false;
+       /* Calibration has finished, get the results and re-run */
+       for (i = 0; i <= 10; i++) {
+               iq_corr = ath5k_hw_reg_read(ah, AR5K_PHY_IQRES_CAL_CORR);
+               i_pwr = ath5k_hw_reg_read(ah, AR5K_PHY_IQRES_CAL_PWR_I);
+               q_pwr = ath5k_hw_reg_read(ah, AR5K_PHY_IQRES_CAL_PWR_Q);
+       }
 
-       iq_corr = ath5k_hw_reg_read(ah, AR5K_PHY_IQRES_CAL_CORR);
-       i_pwr = ath5k_hw_reg_read(ah, AR5K_PHY_IQRES_CAL_PWR_I);
-       q_pwr = ath5k_hw_reg_read(ah, AR5K_PHY_IQRES_CAL_PWR_Q);
        i_coffd = ((i_pwr >> 1) + (q_pwr >> 1)) >> 7;
-       q_coffd = q_pwr >> 6;
+       q_coffd = q_pwr >> 7;
 
+       /* No correction */
        if (i_coffd == 0 || q_coffd == 0)
                goto done;
 
        i_coff = ((-iq_corr) / i_coffd) & 0x3f;
-       q_coff = (((s32)i_pwr / q_coffd) - 64) & 0x1f;
 
-       /* Commit new IQ value */
+       /* Boundary check */
+       if (i_coff > 31)
+               i_coff = 31;
+       if (i_coff < -32)
+               i_coff = -32;
+
+       q_coff = (((s32)i_pwr / q_coffd) - 128) & 0x1f;
+
+       /* Boundary check */
+       if (q_coff > 15)
+               q_coff = 15;
+       if (q_coff < -16)
+               q_coff = -16;
+
+       /* Commit new I/Q value */
        AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_IQ, AR5K_PHY_IQ_CORR_ENABLE |
                ((u32)q_coff) | ((u32)i_coff << AR5K_PHY_IQ_CORR_Q_I_COFF_S));
 
+       /* Re-enable calibration -if we don't we'll commit
+        * the same values again and again */
+       AR5K_REG_WRITE_BITS(ah, AR5K_PHY_IQ,
+                       AR5K_PHY_IQ_CAL_NUM_LOG_MAX, 15);
+       AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_IQ, AR5K_PHY_IQ_RUN);
+
 done:
+
+       /* TODO: Separate noise floor calibration from I/Q calibration
+        * since noise floor calibration interrupts rx path while I/Q
+        * calibration doesn't. We don't need to run noise floor calibration
+        * as often as I/Q calibration.*/
        ath5k_hw_noise_floor_calibration(ah, channel->center_freq);
 
        /* Request RF gain */
index 30629b3..7562bf1 100644 (file)
@@ -53,7 +53,7 @@
 #define AR5K_CR_TXD0   0x00000008      /* TX Disable for queue 0 on 5210 */
 #define AR5K_CR_TXD1   0x00000010      /* TX Disable for queue 1 on 5210 */
 #define        AR5K_CR_RXD     0x00000020      /* RX Disable */
-#define        AR5K_CR_SWI     0x00000040
+#define        AR5K_CR_SWI     0x00000040      /* Software Interrupt */
 
 /*
  * RX Descriptor Pointer register
  */
 #define        AR5K_CFG                0x0014                  /* Register Address */
 #define        AR5K_CFG_SWTD           0x00000001      /* Byte-swap TX descriptor (for big endian archs) */
-#define        AR5K_CFG_SWTB           0x00000002      /* Byte-swap TX buffer (?) */
+#define        AR5K_CFG_SWTB           0x00000002      /* Byte-swap TX buffer */
 #define        AR5K_CFG_SWRD           0x00000004      /* Byte-swap RX descriptor */
-#define        AR5K_CFG_SWRB           0x00000008      /* Byte-swap RX buffer (?) */
-#define        AR5K_CFG_SWRG           0x00000010      /* Byte-swap Register values (?) */
-#define AR5K_CFG_ADHOC         0x00000020      /* [5211+] */
+#define        AR5K_CFG_SWRB           0x00000008      /* Byte-swap RX buffer */
+#define        AR5K_CFG_SWRG           0x00000010      /* Byte-swap Register access */
+#define AR5K_CFG_ADHOC         0x00000020      /* AP/Adhoc indication [5211+] */
 #define AR5K_CFG_PHY_OK                0x00000100      /* [5211+] */
 #define AR5K_CFG_EEBS          0x00000200      /* EEPROM is busy */
-#define        AR5K_CFG_CLKGD          0x00000400      /* Clock gated (?) */
+#define        AR5K_CFG_CLKGD          0x00000400      /* Clock gated (Disable dynamic clock) */
 #define AR5K_CFG_TXCNT         0x00007800      /* Tx frame count (?) [5210] */
 #define AR5K_CFG_TXCNT_S       11
 #define AR5K_CFG_TXFSTAT       0x00008000      /* Tx frame status (?) [5210] */
 #define AR5K_CFG_TXFSTRT       0x00010000      /* [5210] */
-#define        AR5K_CFG_PCI_THRES      0x00060000      /* [5211+] */
+#define        AR5K_CFG_PCI_THRES      0x00060000      /* PCI Master req q threshold [5211+] */
 #define        AR5K_CFG_PCI_THRES_S    17
 
 /*
 /*
  * Transmit configuration register
  */
-#define AR5K_TXCFG             0x0030                  /* Register Address */
-#define AR5K_TXCFG_SDMAMR      0x00000007      /* DMA size */
-#define AR5K_TXCFG_SDMAMR_S    0
-#define AR5K_TXCFG_B_MODE      0x00000008      /* Set b mode for 5111 (enable 2111) */
-#define AR5K_TXCFG_TXFSTP      0x00000008      /* TX DMA full Stop [5210] */
-#define AR5K_TXCFG_TXFULL      0x000003f0      /* TX Triger level mask */
-#define AR5K_TXCFG_TXFULL_S    4
-#define AR5K_TXCFG_TXFULL_0B   0x00000000
-#define AR5K_TXCFG_TXFULL_64B  0x00000010
-#define AR5K_TXCFG_TXFULL_128B 0x00000020
-#define AR5K_TXCFG_TXFULL_192B 0x00000030
-#define AR5K_TXCFG_TXFULL_256B 0x00000040
-#define AR5K_TXCFG_TXCONT_EN   0x00000080
-#define AR5K_TXCFG_DMASIZE     0x00000100      /* Flag for passing DMA size [5210] */
-#define AR5K_TXCFG_JUMBO_TXE   0x00000400      /* Enable jumbo frames transmition (?) [5211+] */
-#define AR5K_TXCFG_RTSRND      0x00001000      /* [5211+] */
-#define AR5K_TXCFG_FRMPAD_DIS  0x00002000      /* [5211+] */
-#define AR5K_TXCFG_RDY_DIS     0x00004000      /* [5211+] */
+#define AR5K_TXCFG                     0x0030                  /* Register Address */
+#define AR5K_TXCFG_SDMAMR              0x00000007      /* DMA size (read) */
+#define AR5K_TXCFG_SDMAMR_S            0
+#define AR5K_TXCFG_B_MODE              0x00000008      /* Set b mode for 5111 (enable 2111) */
+#define AR5K_TXCFG_TXFSTP              0x00000008      /* TX DMA full Stop [5210] */
+#define AR5K_TXCFG_TXFULL              0x000003f0      /* TX Triger level mask */
+#define AR5K_TXCFG_TXFULL_S            4
+#define AR5K_TXCFG_TXFULL_0B           0x00000000
+#define AR5K_TXCFG_TXFULL_64B          0x00000010
+#define AR5K_TXCFG_TXFULL_128B         0x00000020
+#define AR5K_TXCFG_TXFULL_192B         0x00000030
+#define AR5K_TXCFG_TXFULL_256B         0x00000040
+#define AR5K_TXCFG_TXCONT_EN           0x00000080
+#define AR5K_TXCFG_DMASIZE             0x00000100      /* Flag for passing DMA size [5210] */
+#define AR5K_TXCFG_JUMBO_DESC_EN       0x00000400      /* Enable jumbo tx descriptors [5211+] */
+#define AR5K_TXCFG_ADHOC_BCN_ATIM      0x00000800      /* Adhoc Beacon ATIM Policy */
+#define AR5K_TXCFG_ATIM_WINDOW_DEF_DIS 0x00001000      /* Disable ATIM window defer [5211+] */
+#define AR5K_TXCFG_RTSRND              0x00001000      /* [5211+] */
+#define AR5K_TXCFG_FRMPAD_DIS          0x00002000      /* [5211+] */
+#define AR5K_TXCFG_RDY_CBR_DIS         0x00004000      /* Ready time CBR disable [5211+] */
+#define AR5K_TXCFG_JUMBO_FRM_MODE      0x00008000      /* Jumbo frame mode [5211+] */
+#define AR5K_TXCFG_DCU_CACHING_DIS     0x00010000      /* Disable DCU caching */
 
 /*
  * Receive configuration register
  */
 #define AR5K_RXCFG             0x0034                  /* Register Address */
-#define AR5K_RXCFG_SDMAMW      0x00000007      /* DMA size */
+#define AR5K_RXCFG_SDMAMW      0x00000007      /* DMA size (write) */
 #define AR5K_RXCFG_SDMAMW_S    0
-#define        AR5K_RXCFG_DEF_ANTENNA  0x00000008      /* Default antenna */
-#define AR5K_RXCFG_ZLFDMA      0x00000010      /* Zero-length DMA */
-#define AR5K_RXCFG_JUMBO_RXE   0x00000020      /* Enable jumbo frames reception (?) [5211+] */
-#define AR5K_RXCFG_JUMBO_WRAP  0x00000040      /* Wrap jumbo frames (?) [5211+] */
+#define AR5K_RXCFG_ZLFDMA      0x00000008      /* Enable Zero-length frame DMA */
+#define        AR5K_RXCFG_DEF_ANTENNA  0x00000010      /* Default antenna (?) */
+#define AR5K_RXCFG_JUMBO_RXE   0x00000020      /* Enable jumbo rx descriptors [5211+] */
+#define AR5K_RXCFG_JUMBO_WRAP  0x00000040      /* Wrap jumbo frames [5211+] */
+#define AR5K_RXCFG_SLE_ENTRY   0x00000080      /* Sleep entry policy */
 
 /*
  * Receive jumbo descriptor last address register
  * MIB control register
  */
 #define AR5K_MIBC              0x0040                  /* Register Address */
-#define AR5K_MIBC_COW          0x00000001
-#define AR5K_MIBC_FMC          0x00000002      /* Freeze Mib Counters (?) */
-#define AR5K_MIBC_CMC          0x00000004      /* Clean Mib Counters (?) */
-#define AR5K_MIBC_MCS          0x00000008
+#define AR5K_MIBC_COW          0x00000001      /* Warn test indicator */
+#define AR5K_MIBC_FMC          0x00000002      /* Freeze MIB Counters  */
+#define AR5K_MIBC_CMC          0x00000004      /* Clean MIB Counters  */
+#define AR5K_MIBC_MCS          0x00000008      /* MIB counter strobe */
 
 /*
  * Timeout prescale register
  */
 #define AR5K_TOPS              0x0044
-#define        AR5K_TOPS_M             0x0000ffff      /* [5211+] (?) */
+#define        AR5K_TOPS_M             0x0000ffff
 
 /*
  * Receive timeout register (no frame received)
  */
 #define AR5K_RXNOFRM           0x0048
-#define        AR5K_RXNOFRM_M          0x000003ff      /* [5211+] (?) */
+#define        AR5K_RXNOFRM_M          0x000003ff
 
 /*
  * Transmit timeout register (no frame sent)
  */
 #define AR5K_TXNOFRM           0x004c
-#define        AR5K_TXNOFRM_M          0x000003ff      /* [5211+] (?) */
-#define        AR5K_TXNOFRM_QCU        0x000ffc00      /* [5211+] (?) */
+#define        AR5K_TXNOFRM_M          0x000003ff
+#define        AR5K_TXNOFRM_QCU        0x000ffc00
 
 /*
  * Receive frame gap timeout register
  */
 #define AR5K_RPGTO             0x0050
-#define AR5K_RPGTO_M           0x000003ff      /* [5211+] (?) */
+#define AR5K_RPGTO_M           0x000003ff
 
 /*
  * Receive frame count limit register
 
 /*
  * Misc settings register
+ * (reserved0-3)
  */
 #define AR5K_MISC              0x0058                  /* Register Address */
 #define        AR5K_MISC_DMA_OBS_M     0x000001e0
 
 /*
  * QCU/DCU clock gating register (5311)
+ * (reserved4-5)
  */
 #define        AR5K_QCUDCU_CLKGT       0x005c                  /* Register Address (?) */
 #define        AR5K_QCUDCU_CLKGT_QCU   0x0000ffff      /* Mask for QCU clock */
 #define AR5K_ISR_TXEOL         0x00000400      /* Empty TX descriptor */
 #define AR5K_ISR_TXURN         0x00000800      /* Transmit FIFO underrun */
 #define AR5K_ISR_MIB           0x00001000      /* Update MIB counters */
-#define AR5K_ISR_SWI           0x00002000      /* Software interrupt (?) */
+#define AR5K_ISR_SWI           0x00002000      /* Software interrupt */
 #define AR5K_ISR_RXPHY         0x00004000      /* PHY error */
-#define AR5K_ISR_RXKCM         0x00008000
+#define AR5K_ISR_RXKCM         0x00008000      /* RX Key cache miss */
 #define AR5K_ISR_SWBA          0x00010000      /* Software beacon alert */
 #define AR5K_ISR_BRSSI         0x00020000
 #define AR5K_ISR_BMISS         0x00040000      /* Beacon missed */
 #define AR5K_ISR_HIUERR                0x00080000      /* Host Interface Unit error [5211+] */
 #define AR5K_ISR_BNR           0x00100000      /* Beacon not ready [5211+] */
-#define AR5K_ISR_MCABT         0x00100000      /* [5210] */
-#define AR5K_ISR_RXCHIRP       0x00200000      /* [5212+] */
-#define AR5K_ISR_SSERR         0x00200000      /* [5210] */
-#define AR5K_ISR_DPERR         0x00400000      /* [5210] */
+#define AR5K_ISR_MCABT         0x00100000      /* Master Cycle Abort [5210] */
+#define AR5K_ISR_RXCHIRP       0x00200000      /* CHIRP Received [5212+] */
+#define AR5K_ISR_SSERR         0x00200000      /* Signaled System Error [5210] */
+#define AR5K_ISR_DPERR         0x00400000      /* Det par Error (?) [5210] */
 #define AR5K_ISR_TIM           0x00800000      /* [5210] */
 #define AR5K_ISR_BCNMISC       0x00800000      /* [5212+] */
 #define AR5K_ISR_GPIO          0x01000000      /* GPIO (rf kill)*/
 
 #define AR5K_SISR2             0x008c                  /* Register Address [5211+] */
 #define AR5K_SISR2_QCU_TXURN   0x000003ff      /* Mask for QCU_TXURN */
-#define        AR5K_SISR2_MCABT        0x00100000
-#define        AR5K_SISR2_SSERR        0x00200000
-#define        AR5K_SISR2_DPERR        0x00400000
+#define        AR5K_SISR2_MCABT        0x00100000      /* Master Cycle Abort */
+#define        AR5K_SISR2_SSERR        0x00200000      /* Signaled System Error */
+#define        AR5K_SISR2_DPERR        0x00400000      /* Det par Error (?) */
 #define        AR5K_SISR2_TIM          0x01000000      /* [5212+] */
 #define        AR5K_SISR2_CAB_END      0x02000000      /* [5212+] */
-#define        AR5K_SISR2_DTIM_SYNC    0x04000000      /* [5212+] */
-#define        AR5K_SISR2_BCN_TIMEOUT  0x08000000      /* [5212+] */
-#define        AR5K_SISR2_CAB_TIMEOUT  0x10000000      /* [5212+] */
+#define        AR5K_SISR2_DTIM_SYNC    0x04000000      /* DTIM sync lost [5212+] */
+#define        AR5K_SISR2_BCN_TIMEOUT  0x08000000      /* Beacon Timeout [5212+] */
+#define        AR5K_SISR2_CAB_TIMEOUT  0x10000000      /* CAB Timeout [5212+] */
 #define        AR5K_SISR2_DTIM         0x20000000      /* [5212+] */
 
 #define AR5K_SISR3             0x0090                  /* Register Address [5211+] */
 #define AR5K_IMR_TXEOL         0x00000400      /* Empty TX descriptor*/
 #define AR5K_IMR_TXURN         0x00000800      /* Transmit FIFO underrun*/
 #define AR5K_IMR_MIB           0x00001000      /* Update MIB counters*/
-#define AR5K_IMR_SWI           0x00002000
+#define AR5K_IMR_SWI           0x00002000      /* Software interrupt */
 #define AR5K_IMR_RXPHY         0x00004000      /* PHY error*/
-#define AR5K_IMR_RXKCM         0x00008000
+#define AR5K_IMR_RXKCM         0x00008000      /* RX Key cache miss */
 #define AR5K_IMR_SWBA          0x00010000      /* Software beacon alert*/
 #define AR5K_IMR_BRSSI         0x00020000
 #define AR5K_IMR_BMISS         0x00040000      /* Beacon missed*/
 #define AR5K_IMR_HIUERR                0x00080000      /* Host Interface Unit error [5211+] */
 #define AR5K_IMR_BNR           0x00100000      /* Beacon not ready [5211+] */
-#define AR5K_IMR_MCABT         0x00100000      /* [5210] */
-#define AR5K_IMR_RXCHIRP       0x00200000      /* [5212+]*/
-#define AR5K_IMR_SSERR         0x00200000      /* [5210] */
-#define AR5K_IMR_DPERR         0x00400000      /* [5210] */
+#define AR5K_IMR_MCABT         0x00100000      /* Master Cycle Abort [5210] */
+#define AR5K_IMR_RXCHIRP       0x00200000      /* CHIRP Received [5212+]*/
+#define AR5K_IMR_SSERR         0x00200000      /* Signaled System Error [5210] */
+#define AR5K_IMR_DPERR         0x00400000      /* Det par Error (?) [5210] */
 #define AR5K_IMR_TIM           0x00800000      /* [5211+] */
 #define AR5K_IMR_BCNMISC       0x00800000      /* [5212+] */
 #define AR5K_IMR_GPIO          0x01000000      /* GPIO (rf kill)*/
 #define AR5K_SIMR2             0x00ac                  /* Register Address [5211+] */
 #define AR5K_SIMR2_QCU_TXURN   0x000003ff      /* Mask for QCU_TXURN */
 #define AR5K_SIMR2_QCU_TXURN_S 0
-#define        AR5K_SIMR2_MCABT        0x00100000
-#define        AR5K_SIMR2_SSERR        0x00200000
-#define        AR5K_SIMR2_DPERR        0x00400000
+#define        AR5K_SIMR2_MCABT        0x00100000      /* Master Cycle Abort */
+#define        AR5K_SIMR2_SSERR        0x00200000      /* Signaled System Error */
+#define        AR5K_SIMR2_DPERR        0x00400000      /* Det par Error (?) */
 #define        AR5K_SIMR2_TIM          0x01000000      /* [5212+] */
 #define        AR5K_SIMR2_CAB_END      0x02000000      /* [5212+] */
-#define        AR5K_SIMR2_DTIM_SYNC    0x04000000      /* [5212+] */
-#define        AR5K_SIMR2_BCN_TIMEOUT  0x08000000      /* [5212+] */
-#define        AR5K_SIMR2_CAB_TIMEOUT  0x10000000      /* [5212+] */
+#define        AR5K_SIMR2_DTIM_SYNC    0x04000000      /* DTIM Sync lost [5212+] */
+#define        AR5K_SIMR2_BCN_TIMEOUT  0x08000000      /* Beacon Timeout [5212+] */
+#define        AR5K_SIMR2_CAB_TIMEOUT  0x10000000      /* CAB Timeout [5212+] */
 #define        AR5K_SIMR2_DTIM         0x20000000      /* [5212+] */
 
 #define AR5K_SIMR3             0x00b0                  /* Register Address [5211+] */
 #define AR5K_SIMR4_QTRIG       0x000003ff      /* Mask for QTRIG */
 #define AR5K_SIMR4_QTRIG_S     0
 
+/*
+ * DMA Debug registers 0-7
+ * 0xe0 - 0xfc
+ */
 
 /*
  * Decompression mask registers [5212+]
  */
-#define AR5K_DCM_ADDR          0x0400          /*Decompression mask address (?)*/
-#define AR5K_DCM_DATA          0x0404          /*Decompression mask data (?)*/
+#define AR5K_DCM_ADDR          0x0400          /*Decompression mask address (index) */
+#define AR5K_DCM_DATA          0x0404          /*Decompression mask data */
+
+/*
+ * Wake On Wireless pattern control register [5212+]
+ */
+#define        AR5K_WOW_PCFG                   0x0410                  /* Register Address */
+#define        AR5K_WOW_PCFG_PAT_MATCH_EN      0x00000001      /* Pattern match enable */
+#define        AR5K_WOW_PCFG_LONG_FRAME_POL    0x00000002      /* Long frame policy */
+#define        AR5K_WOW_PCFG_WOBMISS           0x00000004      /* Wake on bea(con) miss (?) */
+#define        AR5K_WOW_PCFG_PAT_0_EN          0x00000100      /* Enable pattern 0 */
+#define        AR5K_WOW_PCFG_PAT_1_EN          0x00000200      /* Enable pattern 1 */
+#define        AR5K_WOW_PCFG_PAT_2_EN          0x00000400      /* Enable pattern 2 */
+#define        AR5K_WOW_PCFG_PAT_3_EN          0x00000800      /* Enable pattern 3 */
+#define        AR5K_WOW_PCFG_PAT_4_EN          0x00001000      /* Enable pattern 4 */
+#define        AR5K_WOW_PCFG_PAT_5_EN          0x00002000      /* Enable pattern 5 */
+
+/*
+ * Wake On Wireless pattern index register (?) [5212+]
+ */
+#define        AR5K_WOW_PAT_IDX        0x0414
+
+/*
+ * Wake On Wireless pattern data register [5212+]
+ */
+#define        AR5K_WOW_PAT_DATA       0x0418                  /* Register Address */
+#define        AR5K_WOW_PAT_DATA_0_3_V 0x00000001      /* Pattern 0, 3 value */
+#define        AR5K_WOW_PAT_DATA_1_4_V 0x00000100      /* Pattern 1, 4 value */
+#define        AR5K_WOW_PAT_DATA_2_5_V 0x00010000      /* Pattern 2, 5 value */
+#define        AR5K_WOW_PAT_DATA_0_3_M 0x01000000      /* Pattern 0, 3 mask */
+#define        AR5K_WOW_PAT_DATA_1_4_M 0x04000000      /* Pattern 1, 4 mask */
+#define        AR5K_WOW_PAT_DATA_2_5_M 0x10000000      /* Pattern 2, 5 mask */
 
 /*
  * Decompression configuration registers [5212+]
  */
-#define AR5K_DCCFG             0x0420
+#define AR5K_DCCFG             0x0420                  /* Register Address */
+#define AR5K_DCCFG_GLOBAL_EN   0x00000001      /* Enable decompression on all queues */
+#define AR5K_DCCFG_BYPASS_EN   0x00000002      /* Bypass decompression */
+#define AR5K_DCCFG_BCAST_EN    0x00000004      /* Enable decompression for bcast frames */
+#define AR5K_DCCFG_MCAST_EN    0x00000008      /* Enable decompression for mcast frames */
 
 /*
  * Compression configuration registers [5212+]
  */
-#define AR5K_CCFG              0x0600
-#define AR5K_CCFG_CUP          0x0604
+#define AR5K_CCFG              0x0600                  /* Register Address */
+#define        AR5K_CCFG_WINDOW_SIZE   0x00000007      /* Compression window size */
+#define        AR5K_CCFG_CPC_EN        0x00000008      /* Enable performance counters */
+
+#define AR5K_CCFG_CCU          0x0604                  /* Register Address */
+#define AR5K_CCFG_CCU_CUP_EN   0x00000001      /* CCU Catchup enable */
+#define AR5K_CCFG_CCU_CREDIT   0x00000002      /* CCU Credit (field) */
+#define AR5K_CCFG_CCU_CD_THRES 0x00000080      /* CCU Cyc(lic?) debt threshold (field) */
+#define AR5K_CCFG_CCU_CUP_LCNT 0x00010000      /* CCU Catchup lit(?) count */
+#define        AR5K_CCFG_CCU_INIT      0x00100200      /* Initial value during reset */
 
 /*
  * Compression performance counter registers [5212+]
 #define AR5K_CPC1              0x0614          /* Compression performance counter 1*/
 #define AR5K_CPC2              0x0618          /* Compression performance counter 2 */
 #define AR5K_CPC3              0x061c          /* Compression performance counter 3 */
-#define AR5K_CPCORN            0x0620          /* Compression performance overrun (?) */
+#define AR5K_CPCOVF            0x0620          /* Compression performance overflow */
 
 
 /*
  * set/clear, which contain status for all queues (we shift by 1 for each
  * queue). To access these registers easily we define some macros here
  * that are used inside HAL. For more infos check out *_tx_queue functs.
- *
- * TODO: Boundary checking on macros (here?)
  */
 
 /*
 #define        AR5K_QCU_RDYTIMECFG_BASE        0x0900  /* Register Address - Queue0 RDYTIMECFG */
 #define        AR5K_QCU_RDYTIMECFG_INTVAL      0x00ffffff      /* Ready time interval mask */
 #define AR5K_QCU_RDYTIMECFG_INTVAL_S   0
-#define        AR5K_QCU_RDYTIMECFG_DURATION    0x00ffffff      /* Ready time duration mask */
 #define        AR5K_QCU_RDYTIMECFG_ENABLE      0x01000000      /* Ready time enable mask */
 #define AR5K_QUEUE_RDYTIMECFG(_q)      AR5K_QUEUE_REG(AR5K_QCU_RDYTIMECFG_BASE, _q)
 
  */
 #define AR5K_QCU_MISC_BASE             0x09c0                  /* Register Address -Queue0 MISC */
 #define        AR5K_QCU_MISC_FRSHED_M          0x0000000f      /* Frame sheduling mask */
-#define        AR5K_QCU_MISC_FRSHED_ASAP       0               /* ASAP */
-#define        AR5K_QCU_MISC_FRSHED_CBR        1               /* Constant Bit Rate */
-#define        AR5K_QCU_MISC_FRSHED_DBA_GT     2               /* DMA Beacon alert gated (?) */
-#define        AR5K_QCU_MISC_FRSHED_TIM_GT     3               /* Time gated (?) */
+#define        AR5K_QCU_MISC_FRSHED_ASAP               0       /* ASAP */
+#define        AR5K_QCU_MISC_FRSHED_CBR                1       /* Constant Bit Rate */
+#define        AR5K_QCU_MISC_FRSHED_DBA_GT             2       /* DMA Beacon alert gated (?) */
+#define        AR5K_QCU_MISC_FRSHED_TIM_GT             3       /* Time gated (?) */
 #define        AR5K_QCU_MISC_FRSHED_BCN_SENT_GT        4       /* Beacon sent gated (?) */
 #define        AR5K_QCU_MISC_ONESHOT_ENABLE    0x00000010      /* Oneshot enable */
 #define        AR5K_QCU_MISC_CBREXP            0x00000020      /* CBR expired (normal queue) */
 #define        AR5K_QCU_MISC_CBREXP_BCN        0x00000040      /* CBR expired (beacon queue) */
-#define        AR5K_QCU_MISC_BCN_ENABLE        0x00000080      /* Beacons enabled */
-#define        AR5K_QCU_MISC_CBR_THRES_ENABLE  0x00000100      /* CBR threshold enabled (?) */
-#define        AR5K_QCU_MISC_TXE               0x00000200      /* TXE reset when RDYTIME enalbed (?) */
-#define        AR5K_QCU_MISC_CBR               0x00000400      /* CBR threshold reset (?) */
-#define        AR5K_QCU_MISC_DCU_EARLY         0x00000800      /* DCU reset (?) */
+#define        AR5K_QCU_MISC_BCN_ENABLE        0x00000080      /* Enable Beacon use */
+#define        AR5K_QCU_MISC_CBR_THRES_ENABLE  0x00000100      /* CBR threshold enabled */
+#define        AR5K_QCU_MISC_RDY_VEOL_POLICY   0x00000200      /* TXE reset when RDYTIME enalbed */
+#define        AR5K_QCU_MISC_CBR_RESET_CNT     0x00000400      /* CBR threshold (counter) reset */
+#define        AR5K_QCU_MISC_DCU_EARLY         0x00000800      /* DCU early termination */
+#define AR5K_QCU_MISC_DCU_CMP_EN       0x00001000      /* Enable frame compression */
 #define AR5K_QUEUE_MISC(_q)            AR5K_QUEUE_REG(AR5K_QCU_MISC_BASE, _q)
 
 
  */
 #define AR5K_QCU_STS_BASE      0x0a00                  /* Register Address - Queue0 STS */
 #define        AR5K_QCU_STS_FRMPENDCNT 0x00000003      /* Frames pending counter */
-#define        AR5K_QCU_STS_CBREXPCNT  0x0000ff00      /* CBR expired counter (?) */
+#define        AR5K_QCU_STS_CBREXPCNT  0x0000ff00      /* CBR expired counter */
 #define        AR5K_QUEUE_STATUS(_q)   AR5K_QUEUE_REG(AR5K_QCU_STS_BASE, _q)
 
 /*
  */
 #define AR5K_QCU_CBB_SELECT    0x0b00
 #define AR5K_QCU_CBB_ADDR      0x0b04
+#define AR5K_QCU_CBB_ADDR_S    9
 
 /*
  * QCU compression buffer configuration register [5212+]
+ * (buffer size)
  */
 #define AR5K_QCU_CBCFG         0x0b08
 
  * No lockout means there is no special handling.
  */
 #define AR5K_DCU_MISC_BASE             0x1100                  /* Register Address -Queue0 DCU_MISC */
-#define        AR5K_DCU_MISC_BACKOFF           0x000007ff      /* Mask for backoff setting (?) */
+#define        AR5K_DCU_MISC_BACKOFF           0x000007ff      /* Mask for backoff threshold */
 #define AR5K_DCU_MISC_BACKOFF_FRAG     0x00000200      /* Enable backoff while bursting */
-#define        AR5K_DCU_MISC_HCFPOLL_ENABLE    0x00000800      /* CF - Poll (?) */
-#define        AR5K_DCU_MISC_BACKOFF_PERSIST   0x00001000      /* Persistent backoff (?) */
-#define        AR5K_DCU_MISC_FRMPRFTCH_ENABLE  0x00002000      /* Enable frame pre-fetch (?) */
+#define        AR5K_DCU_MISC_HCFPOLL_ENABLE    0x00000800      /* CF - Poll enable */
+#define        AR5K_DCU_MISC_BACKOFF_PERSIST   0x00001000      /* Persistent backoff */
+#define        AR5K_DCU_MISC_FRMPRFTCH_ENABLE  0x00002000      /* Enable frame pre-fetch */
 #define        AR5K_DCU_MISC_VIRTCOL           0x0000c000      /* Mask for Virtual Collision (?) */
-#define        AR5K_DCU_MISC_VIRTCOL_NORMAL    0
-#define        AR5K_DCU_MISC_VIRTCOL_MODIFIED  1
-#define        AR5K_DCU_MISC_VIRTCOL_IGNORE    2
-#define        AR5K_DCU_MISC_BCN_ENABLE        0x00010000      /* Beacon enable (?) */
+#define        AR5K_DCU_MISC_VIRTCOL_NORMAL            0
+#define        AR5K_DCU_MISC_VIRTCOL_MODIFIED          1
+#define        AR5K_DCU_MISC_VIRTCOL_IGNORE            2
+#define        AR5K_DCU_MISC_BCN_ENABLE        0x00010000      /* Enable Beacon use */
 #define        AR5K_DCU_MISC_ARBLOCK_CTL       0x00060000      /* Arbiter lockout control mask */
 #define        AR5K_DCU_MISC_ARBLOCK_CTL_S     17
-#define        AR5K_DCU_MISC_ARBLOCK_CTL_NONE  0               /* No arbiter lockout */
+#define        AR5K_DCU_MISC_ARBLOCK_CTL_NONE          0       /* No arbiter lockout */
 #define        AR5K_DCU_MISC_ARBLOCK_CTL_INTFRM        1       /* Intra-frame lockout */
 #define        AR5K_DCU_MISC_ARBLOCK_CTL_GLOBAL        2       /* Global lockout */
-#define        AR5K_DCU_MISC_ARBLOCK_IGNORE    0x00080000
-#define        AR5K_DCU_MISC_SEQ_NUM_INCR_DIS  0x00100000      /* Disable sequence number increment (?) */
-#define        AR5K_DCU_MISC_POST_FR_BKOFF_DIS 0x00200000      /* Disable post-frame backoff (?) */
-#define        AR5K_DCU_MISC_VIRT_COLL_POLICY  0x00400000      /* Virtual Collision policy (?) */
-#define        AR5K_DCU_MISC_BLOWN_IFS_POLICY  0x00800000
+#define        AR5K_DCU_MISC_ARBLOCK_IGNORE    0x00080000      /* Ignore Arbiter lockout */
+#define        AR5K_DCU_MISC_SEQ_NUM_INCR_DIS  0x00100000      /* Disable sequence number increment */
+#define        AR5K_DCU_MISC_POST_FR_BKOFF_DIS 0x00200000      /* Disable post-frame backoff */
+#define        AR5K_DCU_MISC_VIRT_COLL_POLICY  0x00400000      /* Virtual Collision cw policy */
+#define        AR5K_DCU_MISC_BLOWN_IFS_POLICY  0x00800000      /* Blown IFS policy (?) */
 #define        AR5K_DCU_MISC_SEQNUM_CTL        0x01000000      /* Sequence number control (?) */
 #define AR5K_QUEUE_DFS_MISC(_q)                AR5K_QUEUE_REG(AR5K_DCU_MISC_BASE, _q)
 
 /*
  * DCU frame sequence number registers
  */
-#define AR5K_DCU_SEQNUM_BASE   0x1140
-#define        AR5K_DCU_SEQNUM_M       0x00000fff
+#define AR5K_DCU_SEQNUM_BASE           0x1140
+#define        AR5K_DCU_SEQNUM_M               0x00000fff
 #define        AR5K_QUEUE_DFS_SEQNUM(_q)       AR5K_QUEUE_REG(AR5K_DCU_SEQNUM_BASE, _q)
 
 /*
- * DCU global IFS SIFS registers
+ * DCU global IFS SIFS register
  */
 #define AR5K_DCU_GBL_IFS_SIFS  0x1030
 #define AR5K_DCU_GBL_IFS_SIFS_M        0x0000ffff
 
 /*
- * DCU global IFS slot interval registers
+ * DCU global IFS slot interval register
  */
 #define AR5K_DCU_GBL_IFS_SLOT  0x1070
 #define AR5K_DCU_GBL_IFS_SLOT_M        0x0000ffff
 
 /*
- * DCU global IFS EIFS registers
+ * DCU global IFS EIFS register
  */
 #define AR5K_DCU_GBL_IFS_EIFS  0x10b0
 #define AR5K_DCU_GBL_IFS_EIFS_M        0x0000ffff
 
 /*
- * DCU global IFS misc registers
+ * DCU global IFS misc register
+ *
+ * LFSR stands for Linear Feedback Shift Register
+ * and it's used for generating pseudo-random
+ * number sequences.
+ *
+ * (If i understand corectly, random numbers are
+ * used for idle sensing -multiplied with cwmin/max etc-)
  */
 #define AR5K_DCU_GBL_IFS_MISC                  0x10f0                  /* Register Address */
-#define        AR5K_DCU_GBL_IFS_MISC_LFSR_SLICE        0x00000007
-#define        AR5K_DCU_GBL_IFS_MISC_TURBO_MODE        0x00000008      /* Turbo mode (?) */
-#define        AR5K_DCU_GBL_IFS_MISC_SIFS_DUR_USEC     0x000003f0      /* SIFS Duration mask (?) */
-#define        AR5K_DCU_GBL_IFS_MISC_USEC_DUR          0x000ffc00
-#define        AR5K_DCU_GBL_IFS_MISC_DCU_ARB_DELAY     0x00300000
+#define        AR5K_DCU_GBL_IFS_MISC_LFSR_SLICE        0x00000007      /* LFSR Slice Select */
+#define        AR5K_DCU_GBL_IFS_MISC_TURBO_MODE        0x00000008      /* Turbo mode */
+#define        AR5K_DCU_GBL_IFS_MISC_SIFS_DUR_USEC     0x000003f0      /* SIFS Duration mask */
+#define        AR5K_DCU_GBL_IFS_MISC_USEC_DUR          0x000ffc00      /* USEC Duration mask */
+#define        AR5K_DCU_GBL_IFS_MISC_DCU_ARB_DELAY     0x00300000      /* DCU Arbiter delay mask */
+#define AR5K_DCU_GBL_IFS_MISC_SIFS_CNT_RST     0x00400000      /* SIFC cnt reset policy (?) */
+#define AR5K_DCU_GBL_IFS_MISC_AIFS_CNT_RST     0x00800000      /* AIFS cnt reset policy (?) */
+#define AR5K_DCU_GBL_IFS_MISC_RND_LFSR_SL_DIS  0x01000000      /* Disable random LFSR slice */
 
 /*
  * DCU frame prefetch control register
  */
-#define AR5K_DCU_FP            0x1230
+#define AR5K_DCU_FP                    0x1230                  /* Register Address */
+#define AR5K_DCU_FP_NOBURST_DCU_EN     0x00000001      /* Enable non-burst prefetch on DCU (?) */
+#define AR5K_DCU_FP_NOBURST_EN         0x00000010      /* Enable non-burst prefetch (?) */
+#define AR5K_DCU_FP_BURST_DCU_EN       0x00000020      /* Enable burst prefetch on DCU (?) */
 
 /*
  * DCU transmit pause control/status register
  */
 #define AR5K_DCU_TXP           0x1270                  /* Register Address */
-#define        AR5K_DCU_TXP_M          0x000003ff      /* Tx pause mask (?) */
-#define        AR5K_DCU_TXP_STATUS     0x00010000      /* Tx pause status (?) */
+#define        AR5K_DCU_TXP_M          0x000003ff      /* Tx pause mask */
+#define        AR5K_DCU_TXP_STATUS     0x00010000      /* Tx pause status */
+
+/*
+ * DCU transmit filter table 0 (32 entries)
+ */
+#define AR5K_DCU_TX_FILTER_0_BASE      0x1038
+#define        AR5K_DCU_TX_FILTER_0(_n)        (AR5K_DCU_TX_FILTER_0_BASE + (_n * 64))
 
 /*
- * DCU transmit filter register
+ * DCU transmit filter table 1 (16 entries)
  */
-#define AR5K_DCU_TX_FILTER     0x1038
+#define AR5K_DCU_TX_FILTER_1_BASE      0x103c
+#define        AR5K_DCU_TX_FILTER_1(_n)        (AR5K_DCU_TX_FILTER_1_BASE + ((_n - 32) * 64))
 
 /*
  * DCU clear transmit filter register
 
 /*
  * Reset control register
- *
- * 4 and 8 are not used in 5211/5212 and
- * 2 means "baseband reset" on 5211/5212.
  */
 #define AR5K_RESET_CTL         0x4000                  /* Register Address */
 #define AR5K_RESET_CTL_PCU     0x00000001      /* Protocol Control Unit reset */
 #define AR5K_SLEEP_CTL_SLE_SLP         0x00010000      /* Force chip sleep */
 #define AR5K_SLEEP_CTL_SLE_ALLOW       0x00020000
 #define AR5K_SLEEP_CTL_SLE_UNITS       0x00000008      /* [5211+] */
+/* more bits */
 
 /*
  * Interrupt pending register
  * Sleep force register
  */
 #define AR5K_SFR       0x400c
-#define AR5K_SFR_    0x00000001
+#define AR5K_SFR_EN    0x00000001
 
 /*
  * PCI configuration register
  */
 #define AR5K_PCICFG                    0x4010                  /* Register Address */
 #define AR5K_PCICFG_EEAE               0x00000001      /* Eeprom access enable [5210] */
+#define        AR5K_PCICFG_SLEEP_CLOCK_EN      0x00000002      /* Enable sleep clock (?) */
 #define AR5K_PCICFG_CLKRUNEN           0x00000004      /* CLKRUN enable [5211+] */
 #define AR5K_PCICFG_EESIZE             0x00000018      /* Mask for EEPROM size [5211+] */
 #define AR5K_PCICFG_EESIZE_S           3
 #define        AR5K_PCICFG_CBEFIX_DIS          0x00000400      /* Disable CBE fix (?) */
 #define AR5K_PCICFG_SL_INTEN           0x00000800      /* Enable interrupts when asleep (?) */
 #define AR5K_PCICFG_LED_BCTL           0x00001000      /* Led blink (?) [5210] */
-#define AR5K_PCICFG_SL_INPEN           0x00002800      /* Sleep even whith pending interrupts (?) */
+#define        AR5K_PCICFG_UNK                 0x00001000      /* Passed on some parts durring attach (?) */
+#define AR5K_PCICFG_SL_INPEN           0x00002000      /* Sleep even whith pending interrupts (?) */
 #define AR5K_PCICFG_SPWR_DN            0x00010000      /* Mask for power status */
 #define AR5K_PCICFG_LEDMODE            0x000e0000      /* Ledmode [5211+] */
 #define AR5K_PCICFG_LEDMODE_PROP       0x00000000      /* Blink on standard traffic [5211+] */
 #define AR5K_PCICFG_LEDMODE_PROM       0x00020000      /* Default mode (blink on any traffic) [5211+] */
 #define AR5K_PCICFG_LEDMODE_PWR                0x00040000      /* Some other blinking mode  (?) [5211+] */
 #define AR5K_PCICFG_LEDMODE_RAND       0x00060000      /* Random blinking (?) [5211+] */
-#define AR5K_PCICFG_LEDBLINK           0x00700000
+#define AR5K_PCICFG_LEDBLINK           0x00700000      /* Led blink rate */
 #define AR5K_PCICFG_LEDBLINK_S         20
-#define AR5K_PCICFG_LEDSLOW            0x00800000      /* Slow led blink rate (?) [5211+] */
+#define AR5K_PCICFG_LEDSLOW            0x00800000      /* Slowest led blink rate [5211+] */
 #define AR5K_PCICFG_LEDSTATE                           \
        (AR5K_PCICFG_LED | AR5K_PCICFG_LEDMODE |        \
        AR5K_PCICFG_LEDBLINK | AR5K_PCICFG_LEDSLOW)
+#define        AR5K_PCICFG_SLEEP_CLOCK_RATE    0x03000000      /* Sleep clock rate (field) */
 
 /*
  * "General Purpose Input/Output" (GPIO) control register
 #define AR5K_EEPROM_VERSION_4_4                0x4004
 #define AR5K_EEPROM_VERSION_4_5                0x4005
 #define AR5K_EEPROM_VERSION_4_6                0x4006  /* has ee_scaled_cck_delta */
-#define AR5K_EEPROM_VERSION_4_7                0x3007
+#define AR5K_EEPROM_VERSION_4_7                0x4007
 
 #define AR5K_EEPROM_MODE_11A           0
 #define AR5K_EEPROM_MODE_11B           1
 #define AR5K_EEPROM_STAT_WRDONE        0x00000008      /* EEPROM write successful */
 
 /*
- * EEPROM config register (?)
+ * EEPROM config register
  */
-#define AR5K_EEPROM_CFG        0x6010
-
+#define AR5K_EEPROM_CFG                        0x6010                  /* Register Addres */
+#define AR5K_EEPROM_CFG_SIZE_OVR       0x00000001
+#define AR5K_EEPROM_CFG_WR_WAIT_DIS    0x00000004      /* Disable write wait */
+#define AR5K_EEPROM_CFG_CLK_RATE       0x00000018      /* Clock rate */
+#define AR5K_EEPROM_CFG_PROT_KEY       0x00ffff00      /* Protectio key */
+#define AR5K_EEPROM_CFG_LIND_EN                0x01000000      /* Enable length indicator (?) */
 
 
 /*
 #define AR5K_STA_ID1                   0x8004                  /* Register Address */
 #define AR5K_STA_ID1_AP                        0x00010000      /* Set AP mode */
 #define AR5K_STA_ID1_ADHOC             0x00020000      /* Set Ad-Hoc mode */
-#define AR5K_STA_ID1_PWR_SV            0x00040000      /* Power save reporting (?) */
+#define AR5K_STA_ID1_PWR_SV            0x00040000      /* Power save reporting */
 #define AR5K_STA_ID1_NO_KEYSRCH                0x00080000      /* No key search */
 #define AR5K_STA_ID1_NO_PSPOLL         0x00100000      /* No power save polling [5210] */
 #define AR5K_STA_ID1_PCF_5211          0x00100000      /* Enable PCF on [5211+] */
                                        AR5K_STA_ID1_PCF_5210 : AR5K_STA_ID1_PCF_5211)
 #define AR5K_STA_ID1_DEFAULT_ANTENNA   0x00200000      /* Use default antenna */
 #define AR5K_STA_ID1_DESC_ANTENNA      0x00400000      /* Update antenna from descriptor */
-#define AR5K_STA_ID1_RTS_DEF_ANTENNA   0x00800000      /* Use default antenna for RTS (?) */
-#define AR5K_STA_ID1_ACKCTS_6MB                0x01000000      /* Use 6Mbit/s for ACK/CTS (?) */
+#define AR5K_STA_ID1_RTS_DEF_ANTENNA   0x00800000      /* Use default antenna for RTS */
+#define AR5K_STA_ID1_ACKCTS_6MB                0x01000000      /* Use 6Mbit/s for ACK/CTS */
 #define AR5K_STA_ID1_BASE_RATE_11B     0x02000000      /* Use 11b base rate (for ACK/CTS ?) [5211+] */
+#define AR5K_STA_ID1_SELF_GEN_SECTORE  0x04000000      /* Self generate sectore (?) */
+#define AR5K_STA_ID1_CRYPT_MIC_EN      0x08000000      /* Enable MIC */
+#define AR5K_STA_ID1_KEYSRCH_MODE      0x10000000      /* Keysearch mode (?) */
+#define AR5K_STA_ID1_PRESERVE_SEQ_NUM  0x20000000      /* Preserve sequence number */
 
 /*
  * First BSSID register (MAC address, lower 32bits)
  *
  * Retry limit register for 5210 (no QCU/DCU so it's done in PCU)
  */
-#define AR5K_NODCU_RETRY_LMT           0x801c                  /*Register Address */
+#define AR5K_NODCU_RETRY_LMT           0x801c                  /* Register Address */
 #define AR5K_NODCU_RETRY_LMT_SH_RETRY  0x0000000f      /* Short retry limit mask */
 #define AR5K_NODCU_RETRY_LMT_SH_RETRY_S        0
 #define AR5K_NODCU_RETRY_LMT_LG_RETRY  0x000000f0      /* Long retry mask */
 #define AR5K_USEC_5211                 0x801c                  /* Register Address [5211+] */
 #define AR5K_USEC                      (ah->ah_version == AR5K_AR5210 ? \
                                        AR5K_USEC_5210 : AR5K_USEC_5211)
-#define AR5K_USEC_1                    0x0000007f
+#define AR5K_USEC_1                    0x0000007f      /* clock cycles for 1us */
 #define AR5K_USEC_1_S                  0
-#define AR5K_USEC_32                   0x00003f80
+#define AR5K_USEC_32                   0x00003f80      /* clock cycles for 1us while on 32Mhz clock */
 #define AR5K_USEC_32_S                 7
 #define AR5K_USEC_TX_LATENCY_5211      0x007fc000
 #define AR5K_USEC_TX_LATENCY_5211_S    14
 /*
  * PCU beacon control register
  */
-#define AR5K_BEACON_5210       0x8024
-#define AR5K_BEACON_5211       0x8020
+#define AR5K_BEACON_5210       0x8024                  /*Register Address [5210] */
+#define AR5K_BEACON_5211       0x8020                  /*Register Address [5211+] */
 #define AR5K_BEACON            (ah->ah_version == AR5K_AR5210 ? \
                                AR5K_BEACON_5210 : AR5K_BEACON_5211)
-#define AR5K_BEACON_PERIOD     0x0000ffff
+#define AR5K_BEACON_PERIOD     0x0000ffff      /* Mask for beacon period */
 #define AR5K_BEACON_PERIOD_S   0
-#define AR5K_BEACON_TIM                0x007f0000
+#define AR5K_BEACON_TIM                0x007f0000      /* Mask for TIM offset */
 #define AR5K_BEACON_TIM_S      16
-#define AR5K_BEACON_ENABLE     0x00800000
-#define AR5K_BEACON_RESET_TSF  0x01000000
+#define AR5K_BEACON_ENABLE     0x00800000      /* Enable beacons */
+#define AR5K_BEACON_RESET_TSF  0x01000000      /* Force TSF reset */
 
 /*
  * CFP period register
 
 /*
  * Receive filter register
- * TODO: Get these out of ar5xxx.h on ath5k
  */
 #define AR5K_RX_FILTER_5210    0x804c                  /* Register Address [5210] */
 #define AR5K_RX_FILTER_5211    0x803c                  /* Register Address [5211+] */
 #define AR5K_DIAG_SW_5211              0x8048                  /* Register Address [5211+] */
 #define AR5K_DIAG_SW                   (ah->ah_version == AR5K_AR5210 ? \
                                        AR5K_DIAG_SW_5210 : AR5K_DIAG_SW_5211)
-#define AR5K_DIAG_SW_DIS_WEP_ACK       0x00000001
-#define AR5K_DIAG_SW_DIS_ACK           0x00000002      /* Disable ACKs (?) */
-#define AR5K_DIAG_SW_DIS_CTS           0x00000004      /* Disable CTSs (?) */
-#define AR5K_DIAG_SW_DIS_ENC           0x00000008      /* Disable encryption (?) */
-#define AR5K_DIAG_SW_DIS_DEC           0x00000010      /* Disable decryption (?) */
+#define AR5K_DIAG_SW_DIS_WEP_ACK       0x00000001      /* Disable ACKs if WEP key is invalid */
+#define AR5K_DIAG_SW_DIS_ACK           0x00000002      /* Disable ACKs */
+#define AR5K_DIAG_SW_DIS_CTS           0x00000004      /* Disable CTSs */
+#define AR5K_DIAG_SW_DIS_ENC           0x00000008      /* Disable encryption */
+#define AR5K_DIAG_SW_DIS_DEC           0x00000010      /* Disable decryption */
 #define AR5K_DIAG_SW_DIS_TX            0x00000020      /* Disable transmit [5210] */
 #define AR5K_DIAG_SW_DIS_RX_5210       0x00000040      /* Disable recieve */
 #define AR5K_DIAG_SW_DIS_RX_5211       0x00000020
 #define AR5K_DIAG_SW_CHAN_INFO_5211    0x00000100
 #define AR5K_DIAG_SW_CHAN_INFO         (ah->ah_version == AR5K_AR5210 ? \
                                        AR5K_DIAG_SW_CHAN_INFO_5210 : AR5K_DIAG_SW_CHAN_INFO_5211)
-#define AR5K_DIAG_SW_EN_SCRAM_SEED_5211        0x00000200      /* Scrambler seed (?) */
+#define AR5K_DIAG_SW_EN_SCRAM_SEED_5211        0x00000200      /* Enable scrambler seed */
 #define AR5K_DIAG_SW_EN_SCRAM_SEED_5210        0x00000400
 #define AR5K_DIAG_SW_EN_SCRAM_SEED     (ah->ah_version == AR5K_AR5210 ? \
                                        AR5K_DIAG_SW_EN_SCRAM_SEED_5210 : AR5K_DIAG_SW_EN_SCRAM_SEED_5211)
 #define AR5K_DIAG_SW_ECO_ENABLE                0x00000400      /* [5211+] */
 #define AR5K_DIAG_SW_SCVRAM_SEED       0x0003f800      /* [5210] */
-#define AR5K_DIAG_SW_SCRAM_SEED_M      0x0001fc00      /* Scrambler seed mask (?) */
+#define AR5K_DIAG_SW_SCRAM_SEED_M      0x0001fc00      /* Scrambler seed mask */
 #define AR5K_DIAG_SW_SCRAM_SEED_S      10
 #define AR5K_DIAG_SW_DIS_SEQ_INC       0x00040000      /* Disable seqnum increment (?)[5210] */
 #define AR5K_DIAG_SW_FRAME_NV0_5210    0x00080000
                                        AR5K_DIAG_SW_FRAME_NV0_5210 : AR5K_DIAG_SW_FRAME_NV0_5211)
 #define AR5K_DIAG_SW_OBSPT_M           0x000c0000
 #define AR5K_DIAG_SW_OBSPT_S           18
+/* more bits */
 
 /*
  * TSF (clock) register (lower 32 bits)
 /*
  * ADDAC test register [5211+]
  */
-#define AR5K_ADDAC_TEST        0x8054
-#define AR5K_ADDAC_TEST_TXCONT 0x00000001
+#define AR5K_ADDAC_TEST                        0x8054                  /* Register Address */
+#define AR5K_ADDAC_TEST_TXCONT                 0x00000001      /* Test continuous tx */
+#define AR5K_ADDAC_TEST_TST_MODE       0x00000002      /* Test mode */
+#define AR5K_ADDAC_TEST_LOOP_EN                0x00000004      /* Enable loop */
+#define AR5K_ADDAC_TEST_LOOP_LEN       0x00000008      /* Loop length (field) */
+#define AR5K_ADDAC_TEST_USE_U8         0x00004000      /* Use upper 8 bits */
+#define AR5K_ADDAC_TEST_MSB            0x00008000      /* State of MSB */
+#define AR5K_ADDAC_TEST_TRIG_SEL       0x00010000      /* Trigger select */
+#define AR5K_ADDAC_TEST_TRIG_PTY       0x00020000      /* Trigger polarity */
+#define AR5K_ADDAC_TEST_RXCONT         0x00040000      /* Continuous capture */
+#define AR5K_ADDAC_TEST_CAPTURE                0x00080000      /* Begin capture */
+#define AR5K_ADDAC_TEST_TST_ARM                0x00100000      /* Test ARM (Adaptive Radio Mode ?) */
 
 /*
  * Default antenna register [5211+]
  */
 #define AR5K_DEFAULT_ANTENNA   0x8058
 
+/*
+ * Frame control QoS mask register (?) [5211+]
+ * (FC_QOS_MASK)
+ */
+#define AR5K_FRAME_CTL_QOSM    0x805c
 
+/*
+ * Seq mask register (?) [5211+]
+ */
+#define AR5K_SEQ_MASK  0x8060
 
 /*
  * Retry count register [5210]
 /*
  * XR (eXtended Range) mode register
  */
-#define AR5K_XRMODE                    0x80c0
-#define        AR5K_XRMODE_POLL_TYPE_M         0x0000003f
+#define AR5K_XRMODE                    0x80c0                  /* Register Address */
+#define        AR5K_XRMODE_POLL_TYPE_M         0x0000003f      /* Mask for Poll type (?) */
 #define        AR5K_XRMODE_POLL_TYPE_S         0
-#define        AR5K_XRMODE_POLL_SUBTYPE_M      0x0000003c
+#define        AR5K_XRMODE_POLL_SUBTYPE_M      0x0000003c      /* Mask for Poll subtype (?) */
 #define        AR5K_XRMODE_POLL_SUBTYPE_S      2
-#define        AR5K_XRMODE_POLL_WAIT_ALL       0x00000080
-#define        AR5K_XRMODE_SIFS_DELAY          0x000fff00
-#define        AR5K_XRMODE_FRAME_HOLD_M        0xfff00000
+#define        AR5K_XRMODE_POLL_WAIT_ALL       0x00000080      /* Wait for poll */
+#define        AR5K_XRMODE_SIFS_DELAY          0x000fff00      /* Mask for SIFS delay */
+#define        AR5K_XRMODE_FRAME_HOLD_M        0xfff00000      /* Mask for frame hold (?) */
 #define        AR5K_XRMODE_FRAME_HOLD_S        20
 
 /*
  * XR delay register
  */
-#define AR5K_XRDELAY                   0x80c4
-#define AR5K_XRDELAY_SLOT_DELAY_M      0x0000ffff
+#define AR5K_XRDELAY                   0x80c4                  /* Register Address */
+#define AR5K_XRDELAY_SLOT_DELAY_M      0x0000ffff      /* Mask for slot delay */
 #define AR5K_XRDELAY_SLOT_DELAY_S      0
-#define AR5K_XRDELAY_CHIRP_DELAY_M     0xffff0000
+#define AR5K_XRDELAY_CHIRP_DELAY_M     0xffff0000      /* Mask for CHIRP data delay */
 #define AR5K_XRDELAY_CHIRP_DELAY_S     16
 
 /*
  * XR timeout register
  */
-#define AR5K_XRTIMEOUT                 0x80c8
-#define AR5K_XRTIMEOUT_CHIRP_M         0x0000ffff
+#define AR5K_XRTIMEOUT                 0x80c8                  /* Register Address */
+#define AR5K_XRTIMEOUT_CHIRP_M         0x0000ffff      /* Mask for CHIRP timeout */
 #define AR5K_XRTIMEOUT_CHIRP_S         0
-#define AR5K_XRTIMEOUT_POLL_M          0xffff0000
+#define AR5K_XRTIMEOUT_POLL_M          0xffff0000      /* Mask for Poll timeout */
 #define AR5K_XRTIMEOUT_POLL_S          16
 
 /*
  * XR chirp register
  */
-#define AR5K_XRCHIRP                   0x80cc
-#define AR5K_XRCHIRP_SEND              0x00000001
-#define AR5K_XRCHIRP_GAP               0xffff0000
+#define AR5K_XRCHIRP                   0x80cc                  /* Register Address */
+#define AR5K_XRCHIRP_SEND              0x00000001      /* Send CHIRP */
+#define AR5K_XRCHIRP_GAP               0xffff0000      /* Mask for CHIRP gap (?) */
 
 /*
  * XR stomp register
  */
-#define AR5K_XRSTOMP                   0x80d0
-#define AR5K_XRSTOMP_TX                        0x00000001
-#define AR5K_XRSTOMP_RX_ABORT          0x00000002
-#define AR5K_XRSTOMP_RSSI_THRES                0x0000ff00
+#define AR5K_XRSTOMP                   0x80d0                  /* Register Address */
+#define AR5K_XRSTOMP_TX                        0x00000001      /* Stomp Tx (?) */
+#define AR5K_XRSTOMP_RX                        0x00000002      /* Stomp Rx (?) */
+#define AR5K_XRSTOMP_TX_RSSI           0x00000004      /* Stomp Tx RSSI (?) */
+#define AR5K_XRSTOMP_TX_BSSID          0x00000008      /* Stomp Tx BSSID (?) */
+#define AR5K_XRSTOMP_DATA              0x00000010      /* Stomp data (?)*/
+#define AR5K_XRSTOMP_RSSI_THRES                0x0000ff00      /* Mask for XR RSSI threshold */
 
 /*
  * First enhanced sleep register
  */
-#define AR5K_SLEEP0                    0x80d4
-#define AR5K_SLEEP0_NEXT_DTIM          0x0007ffff
+#define AR5K_SLEEP0                    0x80d4                  /* Register Address */
+#define AR5K_SLEEP0_NEXT_DTIM          0x0007ffff      /* Mask for next DTIM (?) */
 #define AR5K_SLEEP0_NEXT_DTIM_S                0
-#define AR5K_SLEEP0_ASSUME_DTIM                0x00080000
-#define AR5K_SLEEP0_ENH_SLEEP_EN       0x00100000
-#define AR5K_SLEEP0_CABTO              0xff000000
+#define AR5K_SLEEP0_ASSUME_DTIM                0x00080000      /* Assume DTIM */
+#define AR5K_SLEEP0_ENH_SLEEP_EN       0x00100000      /* Enable enchanced sleep control */
+#define AR5K_SLEEP0_CABTO              0xff000000      /* Mask for CAB Time Out */
 #define AR5K_SLEEP0_CABTO_S            24
 
 /*
  * Second enhanced sleep register
  */
-#define AR5K_SLEEP1                    0x80d8
-#define AR5K_SLEEP1_NEXT_TIM           0x0007ffff
+#define AR5K_SLEEP1                    0x80d8                  /* Register Address */
+#define AR5K_SLEEP1_NEXT_TIM           0x0007ffff      /* Mask for next TIM (?) */
 #define AR5K_SLEEP1_NEXT_TIM_S         0
-#define AR5K_SLEEP1_BEACON_TO          0xff000000
+#define AR5K_SLEEP1_BEACON_TO          0xff000000      /* Mask for Beacon Time Out */
 #define AR5K_SLEEP1_BEACON_TO_S                24
 
 /*
  * Third enhanced sleep register
  */
-#define AR5K_SLEEP2                    0x80dc
-#define AR5K_SLEEP2_TIM_PER            0x0000ffff
+#define AR5K_SLEEP2                    0x80dc                  /* Register Address */
+#define AR5K_SLEEP2_TIM_PER            0x0000ffff      /* Mask for TIM period (?) */
 #define AR5K_SLEEP2_TIM_PER_S          0
-#define AR5K_SLEEP2_DTIM_PER           0xffff0000
+#define AR5K_SLEEP2_DTIM_PER           0xffff0000      /* Mask for DTIM period (?) */
 #define AR5K_SLEEP2_DTIM_PER_S         16
 
 /*
  * BSSID mask registers
  */
-#define AR5K_BSS_IDM0                  0x80e0
-#define AR5K_BSS_IDM1                  0x80e4
+#define AR5K_BSS_IDM0                  0x80e0  /* Upper bits */
+#define AR5K_BSS_IDM1                  0x80e4  /* Lower bits */
 
 /*
  * TX power control (TPC) register
+ *
+ * XXX: PCDAC steps (0.5dbm) or DBM ?
+ *
+ * XXX: Mask changes for newer chips to 7f
+ *      like tx power table ?
  */
-#define AR5K_TXPC                      0x80e8
-#define AR5K_TXPC_ACK_M                        0x0000003f
+#define AR5K_TXPC                      0x80e8                  /* Register Address */
+#define AR5K_TXPC_ACK_M                        0x0000003f      /* Mask for ACK tx power */
 #define AR5K_TXPC_ACK_S                        0
-#define AR5K_TXPC_CTS_M                        0x00003f00
+#define AR5K_TXPC_CTS_M                        0x00003f00      /* Mask for CTS tx power */
 #define AR5K_TXPC_CTS_S                        8
-#define AR5K_TXPC_CHIRP_M              0x003f0000
+#define AR5K_TXPC_CHIRP_M              0x003f0000      /* Mask for CHIRP tx power */
 #define AR5K_TXPC_CHIRP_S              22
 
 /*
  * Profile count registers
  */
-#define AR5K_PROFCNT_TX                        0x80ec
-#define AR5K_PROFCNT_RX                        0x80f0
-#define AR5K_PROFCNT_RXCLR             0x80f4
-#define AR5K_PROFCNT_CYCLE             0x80f8
+#define AR5K_PROFCNT_TX                        0x80ec  /* Tx count */
+#define AR5K_PROFCNT_RX                        0x80f0  /* Rx count */
+#define AR5K_PROFCNT_RXCLR             0x80f4  /* Clear Rx count */
+#define AR5K_PROFCNT_CYCLE             0x80f8  /* Cycle count (?) */
+
+/*
+ * Quiet (period) control registers (?)
+ */
+#define AR5K_QUIET_CTL1                        0x80fc                  /* Register Address */
+#define AR5K_QUIET_CTL1_NEXT_QT                0x0000ffff      /* Mask for next quiet (period?) (?) */
+#define AR5K_QUIET_CTL1_QT_EN          0x00010000      /* Enable quiet (period?) */
+#define AR5K_QUIET_CTL2                        0x8100                  /* Register Address */
+#define AR5K_QUIET_CTL2_QT_PER         0x0000ffff      /* Mask for quiet period (?) */
+#define AR5K_QUIET_CTL2_QT_DUR         0xffff0000      /* Mask for quiet duration (?) */
 
 /*
  * TSF parameter register
  */
-#define AR5K_TSF_PARM                  0x8104
-#define AR5K_TSF_PARM_INC_M            0x000000ff
+#define AR5K_TSF_PARM                  0x8104                  /* Register Address */
+#define AR5K_TSF_PARM_INC_M            0x000000ff      /* Mask for TSF increment */
 #define AR5K_TSF_PARM_INC_S            0
 
+/*
+ * QoS register (?)
+ */
+#define AR5K_QOS                       0x8108                  /* Register Address */
+#define AR5K_QOS_NOACK_2BIT_VALUES     0x00000000      /* (field) */
+#define AR5K_QOS_NOACK_BIT_OFFSET      0x00000020      /* (field) */
+#define AR5K_QOS_NOACK_BYTE_OFFSET     0x00000080      /* (field) */
+
 /*
  * PHY error filter register
  */
 #define AR5K_PHY_ERR_FIL               0x810c
-#define AR5K_PHY_ERR_FIL_RADAR         0x00000020
-#define AR5K_PHY_ERR_FIL_OFDM          0x00020000
-#define AR5K_PHY_ERR_FIL_CCK           0x02000000
+#define AR5K_PHY_ERR_FIL_RADAR         0x00000020      /* Radar signal */
+#define AR5K_PHY_ERR_FIL_OFDM          0x00020000      /* OFDM false detect (ANI) */
+#define AR5K_PHY_ERR_FIL_CCK           0x02000000      /* CCK false detect (ANI) */
+
+/*
+ * XR latency register
+ */
+#define AR5K_XRLAT_TX          0x8110
 
 /*
- * Rate duration register
+ * ACK SIFS register
+ */
+#define AR5K_ACKSIFS           0x8114                  /* Register Address */
+#define AR5K_ACKSIFS_INC       0x00000000      /* ACK SIFS Increment (field) */
+
+/*
+ * MIC QoS control register (?)
+ */
+#define        AR5K_MIC_QOS_CTL        0x8118                  /* Register Address */
+#define        AR5K_MIC_QOS_CTL_0      0x00000001      /* MIC QoS control 0 (?) */
+#define        AR5K_MIC_QOS_CTL_1      0x00000004      /* MIC QoS control 1 (?) */
+#define        AR5K_MIC_QOS_CTL_2      0x00000010      /* MIC QoS control 2 (?) */
+#define        AR5K_MIC_QOS_CTL_3      0x00000040      /* MIC QoS control 3 (?) */
+#define        AR5K_MIC_QOS_CTL_4      0x00000100      /* MIC QoS control 4 (?) */
+#define        AR5K_MIC_QOS_CTL_5      0x00000400      /* MIC QoS control 5 (?) */
+#define        AR5K_MIC_QOS_CTL_6      0x00001000      /* MIC QoS control 6 (?) */
+#define        AR5K_MIC_QOS_CTL_7      0x00004000      /* MIC QoS control 7 (?) */
+#define        AR5K_MIC_QOS_CTL_MQ_EN  0x00010000      /* Enable MIC QoS */
+
+/*
+ * MIC QoS select register (?)
+ */
+#define        AR5K_MIC_QOS_SEL        0x811c
+#define        AR5K_MIC_QOS_SEL_0      0x00000001
+#define        AR5K_MIC_QOS_SEL_1      0x00000010
+#define        AR5K_MIC_QOS_SEL_2      0x00000100
+#define        AR5K_MIC_QOS_SEL_3      0x00001000
+#define        AR5K_MIC_QOS_SEL_4      0x00010000
+#define        AR5K_MIC_QOS_SEL_5      0x00100000
+#define        AR5K_MIC_QOS_SEL_6      0x01000000
+#define        AR5K_MIC_QOS_SEL_7      0x10000000
+
+/*
+ * Misc mode control register (?)
+ */
+#define        AR5K_MISC_MODE                  0x8120                  /* Register Address */
+#define        AR5K_MISC_MODE_FBSSID_MATCH     0x00000001      /* Force BSSID match */
+#define        AR5K_MISC_MODE_ACKSIFS_MEM      0x00000002      /* ACK SIFS memory (?) */
+/* more bits */
+
+/*
+ * OFDM Filter counter
+ */
+#define        AR5K_OFDM_FIL_CNT               0x8124
+
+/*
+ * CCK Filter counter
+ */
+#define        AR5K_CCK_FIL_CNT                0x8128
+
+/*
+ * PHY Error Counters (?)
+ */
+#define        AR5K_PHYERR_CNT1                0x812c
+#define        AR5K_PHYERR_CNT1_MASK           0x8130
+
+#define        AR5K_PHYERR_CNT2                0x8134
+#define        AR5K_PHYERR_CNT2_MASK           0x8138
+
+/*
+ * TSF Threshold register (?)
+ */
+#define        AR5K_TSF_THRES                  0x813c
+
+/*
+ * Rate -> ACK SIFS mapping table (32 entries)
+ */
+#define        AR5K_RATE_ACKSIFS_BASE          0x8680                  /* Register Address */
+#define        AR5K_RATE_ACKSIFS(_n)           (AR5K_RATE_ACKSIFS_BSE + ((_n) << 2))
+#define        AR5K_RATE_ACKSIFS_NORMAL        0x00000001      /* Normal SIFS (field) */
+#define        AR5K_RATE_ACKSIFS_TURBO         0x00000400      /* Turbo SIFS (field) */
+
+/*
+ * Rate -> duration mapping table (32 entries)
  */
 #define AR5K_RATE_DUR_BASE             0x8700
 #define AR5K_RATE_DUR(_n)              (AR5K_RATE_DUR_BASE + ((_n) << 2))
 
+/*
+ * Rate -> db mapping table
+ * (8 entries, each one has 4 8bit fields)
+ */
+#define AR5K_RATE2DB_BASE              0x87c0
+#define AR5K_RATE2DB(_n)               (AR5K_RATE2DB_BASE + ((_n) << 2))
+
+/*
+ * db -> Rate mapping table
+ * (8 entries, each one has 4 8bit fields)
+ */
+#define AR5K_DB2RATE_BASE              0x87e0
+#define AR5K_DB2RATE(_n)               (AR5K_DB2RATE_BASE + ((_n) << 2))
+
 /*===5212 end===*/
 
 /*
 /*===PHY REGISTERS===*/
 
 /*
- * PHY register
+ * PHY registers start
  */
 #define        AR5K_PHY_BASE                   0x9800
 #define        AR5K_PHY(_n)                    (AR5K_PHY_BASE + ((_n) << 2))
-#define AR5K_PHY_SHIFT_2GHZ            0x00004007
-#define AR5K_PHY_SHIFT_5GHZ            0x00000007
+
+/*
+ * TST_2 (Misc config parameters)
+ */
+#define        AR5K_PHY_TST2                   0x9800                  /* Register Address */
+#define AR5K_PHY_TST2_TRIG_SEL         0x00000001      /* Trigger select (?) (field ?) */
+#define AR5K_PHY_TST2_TRIG             0x00000010      /* Trigger (?) (field ?) */
+#define AR5K_PHY_TST2_CBUS_MODE                0x00000100      /* Cardbus mode (?) */
+/* bit reserved */
+#define AR5K_PHY_TST2_CLK32            0x00000400      /* CLK_OUT is CLK32 (32Khz external) */
+#define AR5K_PHY_TST2_CHANCOR_DUMP_EN  0x00000800      /* Enable Chancor dump (?) */
+#define AR5K_PHY_TST2_EVEN_CHANCOR_DUMP        0x00001000      /* Even Chancor dump (?) */
+#define AR5K_PHY_TST2_RFSILENT_EN      0x00002000      /* Enable RFSILENT */
+#define AR5K_PHY_TST2_ALT_RFDATA       0x00004000      /* Alternate RFDATA (5-2GHz switch) */
+#define AR5K_PHY_TST2_MINI_OBS_EN      0x00008000      /* Enable mini OBS (?) */
+#define AR5K_PHY_TST2_RX2_IS_RX5_INV   0x00010000      /* 2GHz rx path is the 5GHz path inverted (?) */
+#define AR5K_PHY_TST2_SLOW_CLK160      0x00020000      /* Slow CLK160 (?) */
+#define AR5K_PHY_TST2_AGC_OBS_SEL_3    0x00040000      /* AGC OBS Select 3 (?) */
+#define AR5K_PHY_TST2_BBB_OBS_SEL      0x00080000      /* BB OBS Select (field ?) */
+#define AR5K_PHY_TST2_ADC_OBS_SEL      0x00800000      /* ADC OBS Select (field ?) */
+#define AR5K_PHY_TST2_RX_CLR_SEL       0x08000000      /* RX Clear Select (?) */
+#define AR5K_PHY_TST2_FORCE_AGC_CLR    0x10000000      /* Force AGC clear (?) */
+#define AR5K_PHY_SHIFT_2GHZ            0x00004007      /* Used to access 2GHz radios */
+#define AR5K_PHY_SHIFT_5GHZ            0x00000007      /* Used to access 5GHz radios (default) */
 
 /*
  * PHY frame control register [5110] /turbo mode register [5111+]
  * a "turbo mode register" for 5110. We treat this one as
  * a frame control register for 5110 below.
  */
-#define        AR5K_PHY_TURBO                  0x9804
-#define        AR5K_PHY_TURBO_MODE             0x00000001
-#define        AR5K_PHY_TURBO_SHORT            0x00000002
+#define        AR5K_PHY_TURBO                  0x9804                  /* Register Address */
+#define        AR5K_PHY_TURBO_MODE             0x00000001      /* Enable turbo mode */
+#define        AR5K_PHY_TURBO_SHORT            0x00000002      /* Short mode (20Mhz channels) (?) */
 
 /*
  * PHY agility command register
+ * (aka TST_1)
  */
-#define        AR5K_PHY_AGC                    0x9808
-#define        AR5K_PHY_AGC_DISABLE            0x08000000
+#define        AR5K_PHY_AGC                    0x9808                  /* Register Address */
+#define        AR5K_PHY_TST1                   0x9808
+#define        AR5K_PHY_AGC_DISABLE            0x08000000      /* Disable AGC to A2 (?)*/
+#define        AR5K_PHY_TST1_TXHOLD            0x00003800      /* Set tx hold (?) */
 
 /*
- * PHY timing register [5112+]
+ * PHY timing register [5112+]
  */
 #define        AR5K_PHY_TIMING_3               0x9814
 #define        AR5K_PHY_TIMING_3_DSC_MAN       0xfffe0000
 /*
  * PHY activation register
  */
-#define        AR5K_PHY_ACT                    0x981c
-#define        AR5K_PHY_ACT_ENABLE             0x00000001
-#define        AR5K_PHY_ACT_DISABLE            0x00000002
+#define        AR5K_PHY_ACT                    0x981c                  /* Register Address */
+#define        AR5K_PHY_ACT_ENABLE             0x00000001      /* Activate PHY */
+#define        AR5K_PHY_ACT_DISABLE            0x00000002      /* Deactivate PHY */
+
+/*
+ * PHY RF control registers
+ * (i think these are delay times,
+ * these calibration values exist
+ * in EEPROM)
+ */
+#define AR5K_PHY_RF_CTL2               0x9824                  /* Register Address */
+#define        AR5K_PHY_RF_CTL2_TXF2TXD_START  0x0000000f      /* Mask for TX frame to TX d(esc?) start */
+
+#define AR5K_PHY_RF_CTL3               0x9828                  /* Register Address */
+#define AR5K_PHY_RF_CTL3_TXE2XLNA_ON   0x0000000f      /* Mask for TX end to XLNA on */
+
+#define AR5K_PHY_RF_CTL4               0x9834                  /* Register Address */
+#define AR5K_PHY_RF_CTL4_TXF2XPA_A_ON  0x00000001      /* TX frame to XPA A on (field) */
+#define AR5K_PHY_RF_CTL4_TXF2XPA_B_ON  0x00000100      /* TX frame to XPA B on (field) */
+#define        AR5K_PHY_RF_CTL4_TXE2XPA_A_OFF  0x00010000      /* TX end to XPA A off (field) */
+#define AR5K_PHY_RF_CTL4_TXE2XPA_B_OFF 0x01000000      /* TX end to XPA B off (field) */
+
+/*
+ * Pre-Amplifier control register
+ * (XPA -> external pre-amplifier)
+ */
+#define        AR5K_PHY_PA_CTL                 0x9838                  /* Register Address */
+#define        AR5K_PHY_PA_CTL_XPA_A_HI        0x00000001      /* XPA A high (?) */
+#define        AR5K_PHY_PA_CTL_XPA_B_HI        0x00000002      /* XPA B high (?) */
+#define        AR5K_PHY_PA_CTL_XPA_A_EN        0x00000004      /* Enable XPA A */
+#define        AR5K_PHY_PA_CTL_XPA_B_EN        0x00000008      /* Enable XPA B */
+
+/*
+ * PHY settling register
+ */
+#define AR5K_PHY_SETTLING              0x9844                  /* Register Address */
+#define        AR5K_PHY_SETTLING_AGC           0x0000007f      /* Mask for AGC settling time */
+#define        AR5K_PHY_SETTLING_SWITCH        0x00003f80      /* Mask for Switch settlig time */
+
+/*
+ * PHY Gain registers
+ */
+#define AR5K_PHY_GAIN                  0x9848                  /* Register Address */
+#define        AR5K_PHY_GAIN_TXRX_ATTEN        0x0003f000      /* Mask for TX-RX Attenuation */
+
+#define        AR5K_PHY_GAIN_OFFSET            0x984c                  /* Register Address */
+#define        AR5K_PHY_GAIN_OFFSET_RXTX_FLAG  0x00020000      /* RX-TX flag (?) */
+
+/*
+ * Desired size register
+ * (for more infos read ANI patent)
+ */
+#define AR5K_PHY_DESIRED_SIZE          0x9850                  /* Register Address */
+#define        AR5K_PHY_DESIRED_SIZE_ADC       0x000000ff      /* Mask for ADC desired size */
+#define        AR5K_PHY_DESIRED_SIZE_PGA       0x0000ff00      /* Mask for PGA desired size */
+#define        AR5K_PHY_DESIRED_SIZE_TOT       0x0ff00000      /* Mask for Total desired size (?) */
 
 /*
  * PHY signal register
+ * (for more infos read ANI patent)
  */
-#define        AR5K_PHY_SIG                    0x9858
-#define        AR5K_PHY_SIG_FIRSTEP            0x0003f000
+#define        AR5K_PHY_SIG                    0x9858                  /* Register Address */
+#define        AR5K_PHY_SIG_FIRSTEP            0x0003f000      /* Mask for FIRSTEP */
 #define        AR5K_PHY_SIG_FIRSTEP_S          12
-#define        AR5K_PHY_SIG_FIRPWR             0x03fc0000
+#define        AR5K_PHY_SIG_FIRPWR             0x03fc0000      /* Mask for FIPWR */
 #define        AR5K_PHY_SIG_FIRPWR_S           18
 
 /*
  * PHY coarse agility control register
+ * (for more infos read ANI patent)
  */
-#define        AR5K_PHY_AGCCOARSE              0x985c
-#define        AR5K_PHY_AGCCOARSE_LO           0x00007f80
+#define        AR5K_PHY_AGCCOARSE              0x985c                  /* Register Address */
+#define        AR5K_PHY_AGCCOARSE_LO           0x00007f80      /* Mask for AGC Coarse low */
 #define        AR5K_PHY_AGCCOARSE_LO_S         7
-#define        AR5K_PHY_AGCCOARSE_HI           0x003f8000
+#define        AR5K_PHY_AGCCOARSE_HI           0x003f8000      /* Mask for AGC Coarse high */
 #define        AR5K_PHY_AGCCOARSE_HI_S         15
 
 /*
 /*
  * PHY noise floor status register
  */
-#define AR5K_PHY_NF                    0x9864
-#define AR5K_PHY_NF_M                  0x000001ff
-#define AR5K_PHY_NF_ACTIVE             0x00000100
+#define AR5K_PHY_NF                    0x9864                  /* Register address */
+#define AR5K_PHY_NF_M                  0x000001ff      /* Noise floor mask */
+#define AR5K_PHY_NF_ACTIVE             0x00000100      /* Noise floor calibration still active */
 #define AR5K_PHY_NF_RVAL(_n)           (((_n) >> 19) & AR5K_PHY_NF_M)
 #define AR5K_PHY_NF_AVAL(_n)           (-((_n) ^ AR5K_PHY_NF_M) + 1)
 #define AR5K_PHY_NF_SVAL(_n)           (((_n) & AR5K_PHY_NF_M) | (1 << 9))
+#define        AR5K_PHY_NF_THRESH62            0x00001000      /* Thresh62 -check ANI patent- (field) */
 
 /*
  * PHY ADC saturation register [5110]
 #define        AR5K_PHY_ADCSAT_THR             0x000007e0
 #define        AR5K_PHY_ADCSAT_THR_S           5
 
+/*
+ * PHY Weak ofdm signal detection threshold registers (ANI) [5212+]
+ */
+
+/* High thresholds */
+#define AR5K_PHY_WEAK_OFDM_HIGH_THR            0x9868
+#define AR5K_PHY_WEAK_OFDM_HIGH_THR_M2_COUNT   0x0000001f
+#define AR5K_PHY_WEAK_OFDM_HIGH_THR_M2_COUNT_S 0
+#define AR5K_PHY_WEAK_OFDM_HIGH_THR_M1         0x00fe0000
+#define AR5K_PHY_WEAK_OFDM_HIGH_THR_M1_S       17
+#define AR5K_PHY_WEAK_OFDM_HIGH_THR_M2         0x7f000000
+#define AR5K_PHY_WEAK_OFDM_HIGH_THR_M2_S       24
+
+/* Low thresholds */
+#define AR5K_PHY_WEAK_OFDM_LOW_THR             0x986c
+#define AR5K_PHY_WEAK_OFDM_LOW_THR_SELFCOR_EN  0x00000001
+#define AR5K_PHY_WEAK_OFDM_LOW_THR_M2_COUNT    0x00003f00
+#define AR5K_PHY_WEAK_OFDM_LOW_THR_M2_COUNT_S  8
+#define AR5K_PHY_WEAK_OFDM_LOW_THR_M1          0x001fc000
+#define AR5K_PHY_WEAK_OFDM_LOW_THR_M1_S                14
+#define AR5K_PHY_WEAK_OFDM_LOW_THR_M2          0x0fe00000
+#define AR5K_PHY_WEAK_OFDM_LOW_THR_M2_S                21
+
+
 /*
  * PHY sleep registers [5112+]
  */
                                        AR5K_PHY_PLL_44MHZ_5211 : AR5K_PHY_PLL_44MHZ_5212)
 #define AR5K_PHY_PLL_RF5111            0x00000000
 #define AR5K_PHY_PLL_RF5112            0x00000040
+#define        AR5K_PHY_PLL_HALF_RATE          0x00000100
+#define        AR5K_PHY_PLL_QUARTER_RATE       0x00000200
 
 /*
  * RF Buffer register
 #define AR5K_PHY_RFSTG                 0x98d4
 #define AR5K_PHY_RFSTG_DISABLE         0x00000021
 
+/*
+ * PHY Antenna control register
+ */
+#define AR5K_PHY_ANT_CTL               0x9910                  /* Register Address */
+#define        AR5K_PHY_ANT_CTL_TXRX_EN        0x00000001      /* Enable TX/RX (?) */
+#define        AR5K_PHY_ANT_CTL_SECTORED_ANT   0x00000004      /* Sectored Antenna */
+#define        AR5K_PHY_ANT_CTL_HITUNE5        0x00000008      /* Hitune5 (?) */
+#define        AR5K_PHY_ANT_CTL_SWTABLE_IDLE   0x00000010      /* Switch table idle (?) */
+
 /*
  * PHY receiver delay register [5111+]
  */
-#define        AR5K_PHY_RX_DELAY               0x9914
-#define        AR5K_PHY_RX_DELAY_M             0x00003fff
+#define        AR5K_PHY_RX_DELAY               0x9914                  /* Register Address */
+#define        AR5K_PHY_RX_DELAY_M             0x00003fff      /* Mask for RX activate to receive delay (/100ns) */
+
+/*
+ * PHY max rx length register (?) [5111]
+ */
+#define        AR5K_PHY_MAX_RX_LEN             0x991c
 
 /*
- * PHY timing I(nphase) Q(adrature) control register [5111+]
+ * PHY timing register 4
+ * I(nphase)/Q(adrature) calibration register [5111+]
  */
-#define        AR5K_PHY_IQ                     0x9920          /* Register address */
+#define        AR5K_PHY_IQ                     0x9920                  /* Register Address */
 #define        AR5K_PHY_IQ_CORR_Q_Q_COFF       0x0000001f      /* Mask for q correction info */
 #define        AR5K_PHY_IQ_CORR_Q_I_COFF       0x000007e0      /* Mask for i correction info */
 #define        AR5K_PHY_IQ_CORR_Q_I_COFF_S     5
 #define        AR5K_PHY_IQ_CORR_ENABLE         0x00000800      /* Enable i/q correction */
-#define        AR5K_PHY_IQ_CAL_NUM_LOG_MAX     0x0000f000
+#define        AR5K_PHY_IQ_CAL_NUM_LOG_MAX     0x0000f000      /* Mask for max number of samples in log scale */
 #define        AR5K_PHY_IQ_CAL_NUM_LOG_MAX_S   12
 #define        AR5K_PHY_IQ_RUN                 0x00010000      /* Run i/q calibration */
+#define        AR5K_PHY_IQ_USE_PT_DF           0x00020000      /* Use pilot track df (?) */
+#define        AR5K_PHY_IQ_EARLY_TRIG_THR      0x00200000      /* Early trigger threshold (?) (field) */
+#define        AR5K_PHY_IQ_PILOT_MASK_EN       0x10000000      /* Enable pilot mask (?) */
+#define        AR5K_PHY_IQ_CHAN_MASK_EN        0x20000000      /* Enable channel mask (?) */
+#define        AR5K_PHY_IQ_SPUR_FILT_EN        0x40000000      /* Enable spur filter */
+#define        AR5K_PHY_IQ_SPUR_RSSI_EN        0x80000000      /* Enable spur rssi */
 
+/*
+ * PHY timing register 5
+ * OFDM Self-correlator Cyclic RSSI threshold params
+ * (Check out bb_cycpwr_thr1 on ANI patent)
+ */
+#define        AR5K_PHY_OFDM_SELFCORR                  0x9924                  /* Register Address */
+#define        AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1_EN    0x00000001      /* Enable cyclic RSSI thr 1 */
+#define        AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1       0x000000fe      /* Mask for Cyclic RSSI threshold 1 */
+#define        AR5K_PHY_OFDM_SELFCORR_CYPWR_THR3       0x00000100      /* Cyclic RSSI threshold 3 (field) (?) */
+#define        AR5K_PHY_OFDM_SELFCORR_RSSI_1ATHR_EN    0x00008000      /* Enable 1A RSSI threshold (?) */
+#define        AR5K_PHY_OFDM_SELFCORR_RSSI_1ATHR       0x00010000      /* 1A RSSI threshold (field) (?) */
+#define        AR5K_PHY_OFDM_SELFCORR_LSCTHR_HIRSSI    0x00800000      /* Long sc threshold hi rssi (?) */
+
+/*
+ * PHY-only warm reset register
+ */
+#define        AR5K_PHY_WARM_RESET             0x9928
+
+/*
+ * PHY-only control register
+ */
+#define AR5K_PHY_CTL                   0x992c                  /* Register Address */
+#define        AR5K_PHY_CTL_RX_DRAIN_RATE      0x00000001      /* RX drain rate (?) */
+#define        AR5K_PHY_CTL_LATE_TX_SIG_SYM    0x00000002      /* Late tx signal symbol (?) */
+#define        AR5K_PHY_CTL_GEN_SCRAMBLER      0x00000004      /* Generate scrambler */
+#define        AR5K_PHY_CTL_TX_ANT_SEL         0x00000008      /* TX antenna select */
+#define        AR5K_PHY_CTL_TX_ANT_STATIC      0x00000010      /* Static TX antenna */
+#define        AR5K_PHY_CTL_RX_ANT_SEL         0x00000020      /* RX antenna select */
+#define        AR5K_PHY_CTL_RX_ANT_STATIC      0x00000040      /* Static RX antenna */
+#define        AR5K_PHY_CTL_LOW_FREQ_SLE_EN    0x00000080      /* Enable low freq sleep */
 
 /*
  * PHY PAPD probe register [5111+ (?)]
  * Because it's always 0 in 5211 initialization code
  */
 #define        AR5K_PHY_PAPD_PROBE             0x9930
+#define        AR5K_PHY_PAPD_PROBE_SH_HI_PAR   0x00000001
+#define        AR5K_PHY_PAPD_PROBE_PCDAC_BIAS  0x00000002
+#define        AR5K_PHY_PAPD_PROBE_COMP_GAIN   0x00000040
 #define        AR5K_PHY_PAPD_PROBE_TXPOWER     0x00007e00
 #define        AR5K_PHY_PAPD_PROBE_TXPOWER_S   9
 #define        AR5K_PHY_PAPD_PROBE_TX_NEXT     0x00008000
+#define        AR5K_PHY_PAPD_PROBE_PREDIST_EN  0x00010000
 #define        AR5K_PHY_PAPD_PROBE_TYPE        0x01800000      /* [5112+] */
 #define        AR5K_PHY_PAPD_PROBE_TYPE_S      23
 #define        AR5K_PHY_PAPD_PROBE_TYPE_OFDM   0
 #define        AR5K_PHY_FRAME_CTL              (ah->ah_version == AR5K_AR5210 ? \
                                        AR5K_PHY_FRAME_CTL_5210 : AR5K_PHY_FRAME_CTL_5211)
 /*---[5111+]---*/
-#define        AR5K_PHY_FRAME_CTL_TX_CLIP      0x00000038
+#define        AR5K_PHY_FRAME_CTL_TX_CLIP      0x00000038      /* Mask for tx clip (?) */
 #define        AR5K_PHY_FRAME_CTL_TX_CLIP_S    3
+#define        AR5K_PHY_FRAME_CTL_PREP_CHINFO  0x00010000      /* Prepend chan info */
 /*---[5110/5111]---*/
-#define        AR5K_PHY_FRAME_CTL_TIMING_ERR   0x01000000
-#define        AR5K_PHY_FRAME_CTL_PARITY_ERR   0x02000000
-#define        AR5K_PHY_FRAME_CTL_ILLRATE_ERR  0x04000000      /* illegal rate */
-#define        AR5K_PHY_FRAME_CTL_ILLLEN_ERR   0x08000000      /* illegal length */
+#define        AR5K_PHY_FRAME_CTL_TIMING_ERR   0x01000000      /* PHY timing error */
+#define        AR5K_PHY_FRAME_CTL_PARITY_ERR   0x02000000      /* Parity error */
+#define        AR5K_PHY_FRAME_CTL_ILLRATE_ERR  0x04000000      /* Illegal rate */
+#define        AR5K_PHY_FRAME_CTL_ILLLEN_ERR   0x08000000      /* Illegal length */
 #define        AR5K_PHY_FRAME_CTL_SERVICE_ERR  0x20000000
-#define        AR5K_PHY_FRAME_CTL_TXURN_ERR    0x40000000      /* tx underrun */
+#define        AR5K_PHY_FRAME_CTL_TXURN_ERR    0x40000000      /* TX underrun */
 #define AR5K_PHY_FRAME_CTL_INI         AR5K_PHY_FRAME_CTL_SERVICE_ERR | \
                        AR5K_PHY_FRAME_CTL_TXURN_ERR | \
                        AR5K_PHY_FRAME_CTL_ILLLEN_ERR | \
@@ -1914,6 +2296,11 @@ after DFS is enabled */
 #define AR5K_PHY_ANT_SWITCH_TABLE_0    0x9960
 #define AR5K_PHY_ANT_SWITCH_TABLE_1    0x9964
 
+/*
+ * PHY Noise floor threshold
+ */
+#define AR5K_PHY_NFTHRES               0x9968
+
 /*
  * PHY clock sleep registers [5112+]
  */
@@ -1922,56 +2309,116 @@ after DFS is enabled */
 #define AR5K_PHY_SDELAY                        0x99f4
 #define AR5K_PHY_SDELAY_32MHZ          0x000000ff
 #define AR5K_PHY_SPENDING              0x99f8
+#define        AR5K_PHY_SPENDING_14            0x00000014
+#define        AR5K_PHY_SPENDING_18            0x00000018
 #define AR5K_PHY_SPENDING_RF5111       0x00000018
-#define AR5K_PHY_SPENDING_RF5112       0x00000014 /* <- i 've only seen this on 2425 dumps ! */
-#define AR5K_PHY_SPENDING_RF5112A      0x0000000e /* but since i only have 5112A-based chips */
-#define AR5K_PHY_SPENDING_RF5424       0x00000012 /* to test it might be also for old 5112.  */
+#define AR5K_PHY_SPENDING_RF5112       0x00000014
+/* #define AR5K_PHY_SPENDING_RF5112A   0x0000000e */
+/* #define AR5K_PHY_SPENDING_RF5424    0x00000012 */
+#define        AR5K_PHY_SPENDING_RF5413        0x00000014
+#define        AR5K_PHY_SPENDING_RF2413        0x00000014
+#define AR5K_PHY_SPENDING_RF2425       0x00000018
 
 /*
  * Misc PHY/radio registers [5110 - 5111]
  */
-#define        AR5K_BB_GAIN_BASE               0x9b00 /* BaseBand Amplifier Gain table base address */
+#define        AR5K_BB_GAIN_BASE               0x9b00  /* BaseBand Amplifier Gain table base address */
 #define AR5K_BB_GAIN(_n)               (AR5K_BB_GAIN_BASE + ((_n) << 2))
-#define        AR5K_RF_GAIN_BASE               0x9a00 /* RF Amplrifier Gain table base address */
+#define        AR5K_RF_GAIN_BASE               0x9a00  /* RF Amplrifier Gain table base address */
 #define AR5K_RF_GAIN(_n)               (AR5K_RF_GAIN_BASE + ((_n) << 2))
 
 /*
  * PHY timing IQ calibration result register [5111+]
  */
-#define        AR5K_PHY_IQRES_CAL_PWR_I        0x9c10 /* I (Inphase) power value */
-#define        AR5K_PHY_IQRES_CAL_PWR_Q        0x9c14 /* Q (Quadrature) power value */
+#define        AR5K_PHY_IQRES_CAL_PWR_I        0x9c10  /* I (Inphase) power value */
+#define        AR5K_PHY_IQRES_CAL_PWR_Q        0x9c14  /* Q (Quadrature) power value */
 #define        AR5K_PHY_IQRES_CAL_CORR         0x9c18  /* I/Q Correlation */
 
 /*
  * PHY current RSSI register [5111+]
  */
-#define        AR5K_PHY_CURRENT_RSSI           0x9c1c
+#define        AR5K_PHY_CURRENT_RSSI   0x9c1c
+
+/*
+ * PHY RF Bus grant register (?)
+ */
+#define        AR5K_PHY_RFBUS_GRANT    0x9c20
+
+/*
+ * PHY ADC test register
+ */
+#define        AR5K_PHY_ADC_TEST       0x9c24
+#define        AR5K_PHY_ADC_TEST_I     0x00000001
+#define        AR5K_PHY_ADC_TEST_Q     0x00000200
+
+/*
+ * PHY DAC test register
+ */
+#define        AR5K_PHY_DAC_TEST       0x9c28
+#define        AR5K_PHY_DAC_TEST_I     0x00000001
+#define        AR5K_PHY_DAC_TEST_Q     0x00000200
+
+/*
+ * PHY PTAT register (?)
+ */
+#define        AR5K_PHY_PTAT           0x9c2c
+
+/*
+ * PHY Illegal TX rate register [5112+]
+ */
+#define        AR5K_PHY_BAD_TX_RATE    0x9c30
+
+/*
+ * PHY SPUR Power register [5112+]
+ */
+#define        AR5K_PHY_SPUR_PWR       0x9c34                  /* Register Address */
+#define        AR5K_PHY_SPUR_PWR_I     0x00000001      /* SPUR Power estimate for I (field) */
+#define        AR5K_PHY_SPUR_PWR_Q     0x00000100      /* SPUR Power estimate for Q (field) */
+#define        AR5K_PHY_SPUR_PWR_FILT  0x00010000      /* Power with SPUR removed (field) */
+
+/*
+ * PHY Channel status register [5112+] (?)
+ */
+#define        AR5K_PHY_CHAN_STATUS            0x9c38
+#define        AR5K_PHY_CHAN_STATUS_BT_ACT     0x00000001
+#define        AR5K_PHY_CHAN_STATUS_RX_CLR_RAW 0x00000002
+#define        AR5K_PHY_CHAN_STATUS_RX_CLR_MAC 0x00000004
+#define        AR5K_PHY_CHAN_STATUS_RX_CLR_PAP 0x00000008
+
+/*
+ * PHY PAPD I (power?) table (?)
+ * (92! entries)
+ */
+#define        AR5K_PHY_PAPD_I_BASE    0xa000
+#define        AR5K_PHY_PAPD_I(_n)     (AR5K_PHY_PAPD_I_BASE + ((_n) << 2))
 
 /*
  * PHY PCDAC TX power table
  */
 #define        AR5K_PHY_PCDAC_TXPOWER_BASE_5211        0xa180
-#define AR5K_PHY_PCDAC_TXPOWER_BASE_5413       0xa280
-#define AR5K_PHY_PCDAC_TXPOWER_BASE    (ah->ah_radio >= AR5K_RF5413 ? \
-                                       AR5K_PHY_PCDAC_TXPOWER_BASE_5413 :\
+#define AR5K_PHY_PCDAC_TXPOWER_BASE_2413       0xa280
+#define AR5K_PHY_PCDAC_TXPOWER_BASE    (ah->ah_radio >= AR5K_RF2413 ? \
+                                       AR5K_PHY_PCDAC_TXPOWER_BASE_2413 :\
                                        AR5K_PHY_PCDAC_TXPOWER_BASE_5211)
 #define        AR5K_PHY_PCDAC_TXPOWER(_n)      (AR5K_PHY_PCDAC_TXPOWER_BASE + ((_n) << 2))
 
 /*
  * PHY mode register [5111+]
  */
-#define        AR5K_PHY_MODE                   0x0a200         /* Register address */
-#define        AR5K_PHY_MODE_MOD               0x00000001      /* PHY Modulation mask*/
+#define        AR5K_PHY_MODE                   0x0a200                 /* Register Address */
+#define        AR5K_PHY_MODE_MOD               0x00000001      /* PHY Modulation bit */
 #define AR5K_PHY_MODE_MOD_OFDM         0
 #define AR5K_PHY_MODE_MOD_CCK          1
-#define AR5K_PHY_MODE_FREQ             0x00000002      /* Freq mode mask */
+#define AR5K_PHY_MODE_FREQ             0x00000002      /* Freq mode bit */
 #define        AR5K_PHY_MODE_FREQ_5GHZ         0
 #define        AR5K_PHY_MODE_FREQ_2GHZ         2
-#define AR5K_PHY_MODE_MOD_DYN          0x00000004      /* Dynamic OFDM/CCK mode mask [5112+] */
+#define AR5K_PHY_MODE_MOD_DYN          0x00000004      /* Enable Dynamic OFDM/CCK mode [5112+] */
 #define AR5K_PHY_MODE_RAD              0x00000008      /* [5212+] */
 #define AR5K_PHY_MODE_RAD_RF5111       0
 #define AR5K_PHY_MODE_RAD_RF5112       8
-#define AR5K_PHY_MODE_XR               0x00000010      /* [5112+] */
+#define AR5K_PHY_MODE_XR               0x00000010      /* Enable XR mode [5112+] */
+#define        AR5K_PHY_MODE_HALF_RATE         0x00000020      /* Enable Half rate (test) */
+#define        AR5K_PHY_MODE_QUARTER_RATE      0x00000040      /* Enable Quarter rat (test) */
 
 /*
  * PHY CCK transmit control register [5111+ (?)]
@@ -1979,6 +2426,15 @@ after DFS is enabled */
 #define AR5K_PHY_CCKTXCTL              0xa204
 #define AR5K_PHY_CCKTXCTL_WORLD                0x00000000
 #define AR5K_PHY_CCKTXCTL_JAPAN                0x00000010
+#define        AR5K_PHY_CCKTXCTL_SCRAMBLER_DIS 0x00000001
+#define        AR5K_PHY_CCKTXCTK_DAC_SCALE     0x00000004
+
+/*
+ * PHY CCK Cross-correlator Barker RSSI threshold register [5212+]
+ */
+#define AR5K_PHY_CCK_CROSSCORR                 0xa208
+#define AR5K_PHY_CCK_CROSSCORR_WEAK_SIG_THR    0x0000000f
+#define AR5K_PHY_CCK_CROSSCORR_WEAK_SIG_THR_S  0
 
 /*
  * PHY 2GHz gain register [5111+]
index e78319a..3bf3a86 100644 (file)
@@ -4645,8 +4645,7 @@ static int b43_wireless_init(struct ssb_device *dev)
        }
 
        /* fill hw info */
-       hw->flags = IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE |
-                   IEEE80211_HW_RX_INCLUDES_FCS |
+       hw->flags = IEEE80211_HW_RX_INCLUDES_FCS |
                    IEEE80211_HW_SIGNAL_DBM |
                    IEEE80211_HW_NOISE_DBM;
 
index 8d54502..9dda816 100644 (file)
@@ -192,7 +192,7 @@ int b43_generate_txhdr(struct b43_wldev *dev,
        const struct b43_phy *phy = &dev->phy;
        const struct ieee80211_hdr *wlhdr =
            (const struct ieee80211_hdr *)fragment_data;
-       int use_encryption = (!(info->flags & IEEE80211_TX_CTL_DO_NOT_ENCRYPT));
+       int use_encryption = !!info->control.hw_key;
        __le16 fctl = wlhdr->frame_control;
        struct ieee80211_rate *fbrate;
        u8 rate, rate_fb;
index a1b8bf3..2541c81 100644 (file)
@@ -3702,8 +3702,7 @@ static int b43legacy_wireless_init(struct ssb_device *dev)
        }
 
        /* fill hw info */
-       hw->flags = IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE |
-                   IEEE80211_HW_RX_INCLUDES_FCS |
+       hw->flags = IEEE80211_HW_RX_INCLUDES_FCS |
                    IEEE80211_HW_SIGNAL_DBM |
                    IEEE80211_HW_NOISE_DBM;
        hw->queues = 1; /* FIXME: hardware has more queues */
@@ -3846,10 +3845,10 @@ static int b43legacy_resume(struct ssb_device *dev)
                        goto out;
                }
        }
-       mutex_unlock(&wl->mutex);
 
        b43legacydbg(wl, "Device resumed.\n");
 out:
+       mutex_unlock(&wl->mutex);
        return err;
 }
 
index e969ed8..68e1f8c 100644 (file)
@@ -192,7 +192,7 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev,
                               u16 cookie)
 {
        const struct ieee80211_hdr *wlhdr;
-       int use_encryption = (!(info->flags & IEEE80211_TX_CTL_DO_NOT_ENCRYPT));
+       int use_encryption = !!info->control.hw_key;
        u16 fctl;
        u8 rate;
        struct ieee80211_rate *rate_fb;
index 5bf9e00..c6f886e 100644 (file)
@@ -6442,6 +6442,7 @@ static int ipw2100_resume(struct pci_dev *pci_dev)
        if (err) {
                printk(KERN_ERR "%s: pci_enable_device failed on resume\n",
                       dev->name);
+               mutex_unlock(&priv->action_mutex);
                return err;
        }
        pci_restore_state(pci_dev);
@@ -7146,7 +7147,7 @@ static int ipw2100_wx_get_rate(struct net_device *dev,
        err = ipw2100_get_ordinal(priv, IPW_ORD_CURRENT_TX_RATE, &val, &len);
        if (err) {
                IPW_DEBUG_WX("failed querying ordinals.\n");
-               return err;
+               goto done;
        }
 
        switch (val & TX_RATE_MASK) {
index 1acfbcd..36e8d2f 100644 (file)
@@ -305,9 +305,10 @@ static inline void ipw_write_reg32(struct ipw_priv *a, u32 b, u32 c)
 #define _ipw_write8(ipw, ofs, val) writeb((val), (ipw)->hw_base + (ofs))
 
 /* 8-bit direct write (for low 4K of SRAM/regs), with debug wrapper */
-#define ipw_write8(ipw, ofs, val) \
+#define ipw_write8(ipw, ofs, val) do { \
  IPW_DEBUG_IO("%s %d: write_direct8(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(ofs), (u32)(val)); \
- _ipw_write8(ipw, ofs, val)
+ _ipw_write8(ipw, ofs, val); \
+ } while (0)
 
 /* 16-bit direct write (low 4K) */
 #define _ipw_write16(ipw, ofs, val) writew((val), (ipw)->hw_base + (ofs))
@@ -11946,7 +11947,7 @@ module_param(auto_create, int, 0444);
 MODULE_PARM_DESC(auto_create, "auto create adhoc network (default on)");
 
 module_param(led, int, 0444);
-MODULE_PARM_DESC(led, "enable led control on some systems (default 0 off)\n");
+MODULE_PARM_DESC(led, "enable led control on some systems (default 0 off)");
 
 module_param(debug, int, 0444);
 MODULE_PARM_DESC(debug, "debug output mask");
index 82b66a3..b0ac0ce 100644 (file)
@@ -14,18 +14,49 @@ config IWLWIFI_LEDS
        default n
 
 config IWLWIFI_RFKILL
-       boolean "IWLWIFI RF kill support"
+       boolean "Iwlwifi RF kill support"
        depends on IWLCORE
 
-config IWL4965
-       tristate "Intel Wireless WiFi 4965AGN"
+config IWLWIFI_DEBUG
+       bool "Enable full debugging output in iwlagn driver"
+       depends on IWLCORE
+       ---help---
+         This option will enable debug tracing output for the iwlwifi drivers
+
+         This will result in the kernel module being ~100k larger.  You can
+         control which debug output is sent to the kernel log by setting the
+         value in
+
+               /sys/class/net/wlan0/device/debug_level
+
+         This entry will only exist if this option is enabled.
+
+         To set a value, simply echo an 8-byte hex value to the same file:
+
+                 % echo 0x43fff > /sys/class/net/wlan0/device/debug_level
+
+         You can find the list of debug mask values in:
+                 drivers/net/wireless/iwlwifi/iwl-debug.h
+
+         If this is your first time using this driver, you should say Y here
+         as the debug information can assist others in helping you resolve
+         any problems you may encounter.
+
+config IWLWIFI_DEBUGFS
+        bool "Iwlwifi debugfs support"
+        depends on IWLCORE && IWLWIFI_DEBUG && MAC80211_DEBUGFS
+        ---help---
+         Enable creation of debugfs files for the iwlwifi drivers.
+
+config IWLAGN
+       tristate "Intel Wireless WiFi Next Gen AGN"
        depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL
        select FW_LOADER
        select IWLCORE
        ---help---
          Select to build the driver supporting the:
 
-         Intel Wireless WiFi Link 4965AGN
+         Intel Wireless WiFi Link Next-Gen AGN
 
          This driver uses the kernel's mac80211 subsystem.
 
@@ -42,60 +73,33 @@ config IWL4965
          If you want to compile the driver as a module ( = code which can be
          inserted in and removed from the running kernel whenever you want),
          say M here and read <file:Documentation/kbuild/modules.txt>.  The
-         module will be called iwl4965.ko.
-
-config IWL4965_LEDS
-       bool "Enable LEDS features in iwl4965 driver"
-       depends on IWL4965
-       select IWLWIFI_LEDS
-       ---help---
-         This option enables LEDS for the iwlwifi drivers
+         module will be called iwlagn.ko.
 
-
-config IWL4965_SPECTRUM_MEASUREMENT
-       bool "Enable Spectrum Measurement in iwl4965 driver"
-       depends on IWL4965
+config IWLAGN_SPECTRUM_MEASUREMENT
+       bool "Enable Spectrum Measurement in iwlagn driver"
+       depends on IWLAGN
        ---help---
-         This option will enable spectrum measurement for the iwl4965 driver.
+         This option will enable spectrum measurement for the iwlagn driver.
 
-config IWLWIFI_DEBUG
-       bool "Enable full debugging output in iwl4965 driver"
-       depends on IWL4965
+config IWLAGN_LEDS
+       bool "Enable LEDS features in iwlagn driver"
+       depends on IWLAGN
+       select IWLWIFI_LEDS
        ---help---
-         This option will enable debug tracing output for the iwl4965
-         driver.
-
-         This will result in the kernel module being ~100k larger.  You can
-         control which debug output is sent to the kernel log by setting the
-         value in
-
-               /sys/class/net/wlan0/device/debug_level
-
-         This entry will only exist if this option is enabled.
-
-         To set a value, simply echo an 8-byte hex value to the same file:
-
-                 % echo 0x43fff > /sys/class/net/wlan0/device/debug_level
+         This option enables LEDS for the iwlagn drivers
 
-         You can find the list of debug mask values in:
-                 drivers/net/wireless/iwlwifi/iwl-4965-debug.h
 
-         If this is your first time using this driver, you should say Y here
-         as the debug information can assist others in helping you resolve
-         any problems you may encounter.
+config IWL4965
+       bool "Intel Wireless WiFi 4965AGN"
+       depends on IWLAGN
+       ---help---
+         This option enables support for Intel Wireless WiFi Link 4965AGN
 
 config IWL5000
        bool "Intel Wireless WiFi 5000AGN"
-       depends on IWL4965
+       depends on IWLAGN
        ---help---
          This option enables support for Intel Wireless WiFi Link 5000AGN Family
-         Dependency on 4965 is temporary
-
-config IWLWIFI_DEBUGFS
-        bool "Iwlwifi debugfs support"
-        depends on IWLCORE && IWLWIFI_DEBUG && MAC80211_DEBUGFS
-        ---help---
-         Enable creation of debugfs files for the iwlwifi drivers.
 
 config IWL3945
        tristate "Intel PRO/Wireless 3945ABG/BG Network Connection"
index 1f52b92..47aa28f 100644 (file)
@@ -6,15 +6,14 @@ iwlcore-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-debugfs.o
 iwlcore-$(CONFIG_IWLWIFI_LEDS) += iwl-led.o
 iwlcore-$(CONFIG_IWLWIFI_RFKILL) += iwl-rfkill.o
 
+obj-$(CONFIG_IWLAGN)   += iwlagn.o
+iwlagn-objs            := iwl-agn.o iwl-agn-rs.o
+
+iwlagn-$(CONFIG_IWL4965) += iwl-4965.o
+iwlagn-$(CONFIG_IWL5000) += iwl-5000.o
+
 obj-$(CONFIG_IWL3945)  += iwl3945.o
 iwl3945-objs           := iwl3945-base.o iwl-3945.o iwl-3945-rs.o
 iwl3945-$(CONFIG_IWL3945_LEDS) += iwl-3945-led.o
 
-obj-$(CONFIG_IWL4965)  += iwl4965.o
-iwl4965-objs           := iwl4965-base.o iwl-4965.o iwl-4965-rs.o
-
-ifeq ($(CONFIG_IWL5000),y)
-       iwl4965-objs += iwl-5000.o
-endif
-
 
index 6be1fe1..d333696 100644 (file)
@@ -206,12 +206,12 @@ static void iwl3945_led_brightness_set(struct led_classdev *led_cdev,
 static int iwl3945_led_register_led(struct iwl3945_priv *priv,
                                   struct iwl3945_led *led,
                                   enum led_type type, u8 set_led,
-                                  const char *name, char *trigger)
+                                  char *trigger)
 {
        struct device *device = wiphy_dev(priv->hw->wiphy);
        int ret;
 
-       led->led_dev.name = name;
+       led->led_dev.name = led->name;
        led->led_dev.brightness_set = iwl3945_led_brightness_set;
        led->led_dev.default_trigger = trigger;
 
@@ -308,7 +308,6 @@ void iwl3945_led_background(struct iwl3945_priv *priv)
 int iwl3945_led_register(struct iwl3945_priv *priv)
 {
        char *trigger;
-       char name[32];
        int ret;
 
        priv->last_blink_rate = 0;
@@ -318,7 +317,8 @@ int iwl3945_led_register(struct iwl3945_priv *priv)
        priv->allow_blinking = 0;
 
        trigger = ieee80211_get_radio_led_name(priv->hw);
-       snprintf(name, sizeof(name), "iwl-%s:radio",
+       snprintf(priv->led[IWL_LED_TRG_RADIO].name,
+                sizeof(priv->led[IWL_LED_TRG_RADIO].name), "iwl-%s:radio",
                 wiphy_name(priv->hw->wiphy));
 
        priv->led[IWL_LED_TRG_RADIO].led_on = iwl3945_led_on;
@@ -327,19 +327,20 @@ int iwl3945_led_register(struct iwl3945_priv *priv)
 
        ret = iwl3945_led_register_led(priv,
                                   &priv->led[IWL_LED_TRG_RADIO],
-                                  IWL_LED_TRG_RADIO, 1,
-                                  name, trigger);
+                                  IWL_LED_TRG_RADIO, 1, trigger);
+
        if (ret)
                goto exit_fail;
 
        trigger = ieee80211_get_assoc_led_name(priv->hw);
-       snprintf(name, sizeof(name), "iwl-%s:assoc",
+       snprintf(priv->led[IWL_LED_TRG_ASSOC].name,
+                sizeof(priv->led[IWL_LED_TRG_ASSOC].name), "iwl-%s:assoc",
                 wiphy_name(priv->hw->wiphy));
 
        ret = iwl3945_led_register_led(priv,
                                   &priv->led[IWL_LED_TRG_ASSOC],
-                                  IWL_LED_TRG_ASSOC, 0,
-                                  name, trigger);
+                                  IWL_LED_TRG_ASSOC, 0, trigger);
+
        /* for assoc always turn led on */
        priv->led[IWL_LED_TRG_ASSOC].led_on = iwl3945_led_on;
        priv->led[IWL_LED_TRG_ASSOC].led_off = iwl3945_led_on;
@@ -349,14 +350,13 @@ int iwl3945_led_register(struct iwl3945_priv *priv)
                goto exit_fail;
 
        trigger = ieee80211_get_rx_led_name(priv->hw);
-       snprintf(name, sizeof(name), "iwl-%s:RX",
+       snprintf(priv->led[IWL_LED_TRG_RX].name,
+                sizeof(priv->led[IWL_LED_TRG_RX].name), "iwl-%s:RX",
                 wiphy_name(priv->hw->wiphy));
 
-
        ret = iwl3945_led_register_led(priv,
                                   &priv->led[IWL_LED_TRG_RX],
-                                  IWL_LED_TRG_RX, 0,
-                                  name, trigger);
+                                  IWL_LED_TRG_RX, 0, trigger);
 
        priv->led[IWL_LED_TRG_RX].led_on = iwl3945_led_associated;
        priv->led[IWL_LED_TRG_RX].led_off = iwl3945_led_associated;
@@ -366,13 +366,14 @@ int iwl3945_led_register(struct iwl3945_priv *priv)
                goto exit_fail;
 
        trigger = ieee80211_get_tx_led_name(priv->hw);
-       snprintf(name, sizeof(name), "iwl-%s:TX",
+       snprintf(priv->led[IWL_LED_TRG_TX].name,
+                sizeof(priv->led[IWL_LED_TRG_TX].name), "iwl-%s:TX",
                 wiphy_name(priv->hw->wiphy));
 
        ret = iwl3945_led_register_led(priv,
                                   &priv->led[IWL_LED_TRG_TX],
-                                  IWL_LED_TRG_TX, 0,
-                                  name, trigger);
+                                  IWL_LED_TRG_TX, 0, trigger);
+
        priv->led[IWL_LED_TRG_TX].led_on = iwl3945_led_associated;
        priv->led[IWL_LED_TRG_TX].led_off = iwl3945_led_associated;
        priv->led[IWL_LED_TRG_TX].led_pattern = iwl3945_led_pattern;
index 47b7e0b..2fbd126 100644 (file)
@@ -50,6 +50,7 @@ enum led_type {
 struct iwl3945_led {
        struct iwl3945_priv *priv;
        struct led_classdev led_dev;
+       char name[32];
 
        int (*led_on) (struct iwl3945_priv *priv, int led_id);
        int (*led_off) (struct iwl3945_priv *priv, int led_id);
index c2a7678..b3931f6 100644 (file)
@@ -630,7 +630,9 @@ static void iwl3945_pass_packet_to_mac80211(struct iwl3945_priv *priv,
                                   struct ieee80211_rx_status *stats)
 {
        struct iwl3945_rx_packet *pkt = (struct iwl3945_rx_packet *)rxb->skb->data;
+#ifdef CONFIG_IWL3945_LEDS
        struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)IWL_RX_DATA(pkt);
+#endif
        struct iwl3945_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt);
        struct iwl3945_rx_frame_end *rx_end = IWL_RX_END(pkt);
        short len = le16_to_cpu(rx_hdr->len);
@@ -708,10 +710,7 @@ static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv,
                return;
        }
 
-       if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) {
-               iwl3945_pass_packet_to_mac80211(priv, rxb, &rx_status);
-               return;
-       }
+
 
        /* Convert 3945's rssi indicator to dBm */
        rx_status.signal = rx_stats->rssi - IWL_RSSI_OFFSET;
@@ -773,6 +772,11 @@ static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv,
                priv->last_rx_noise = rx_status.noise;
        }
 
+       if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) {
+               iwl3945_pass_packet_to_mac80211(priv, rxb, &rx_status);
+               return;
+       }
+
        switch (le16_to_cpu(header->frame_control) & IEEE80211_FCTL_FTYPE) {
        case IEEE80211_FTYPE_MGMT:
                switch (le16_to_cpu(header->frame_control) &
@@ -791,8 +795,7 @@ static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv,
                                        struct ieee80211_mgmt *mgmt =
                                            (struct ieee80211_mgmt *)header;
                                        __le32 *pos;
-                                       pos =
-                                           (__le32 *) & mgmt->u.beacon.
+                                       pos = (__le32 *)&mgmt->u.beacon.
                                            timestamp;
                                        priv->timestamp0 = le32_to_cpu(pos[0]);
                                        priv->timestamp1 = le32_to_cpu(pos[1]);
@@ -1505,7 +1508,7 @@ static int iwl3945_hw_reg_adjust_power_by_temp(int new_reading, int old_reading)
  */
 static inline int iwl3945_hw_reg_temp_out_of_range(int temperature)
 {
-       return (((temperature < -260) || (temperature > 25)) ? 1 : 0);
+       return ((temperature < -260) || (temperature > 25)) ? 1 : 0;
 }
 
 int iwl3945_hw_get_temperature(struct iwl3945_priv *priv)
@@ -2626,7 +2629,7 @@ unsigned int iwl3945_hw_get_beacon_cmd(struct iwl3945_priv *priv,
        tx_beacon_cmd->tx.supp_rates[1] =
                (IWL_CCK_BASIC_RATES_MASK & 0xF);
 
-       return (sizeof(struct iwl3945_tx_beacon_cmd) + frame_size);
+       return sizeof(struct iwl3945_tx_beacon_cmd) + frame_size;
 }
 
 void iwl3945_hw_rx_handler_setup(struct iwl3945_priv *priv)
index 9afecb8..22bb269 100644 (file)
@@ -341,39 +341,6 @@ err:
        return -EINVAL;
 
 }
-int iwl4965_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src)
-{
-       int ret;
-       unsigned long flags;
-
-       spin_lock_irqsave(&priv->lock, flags);
-       ret = iwl_grab_nic_access(priv);
-       if (ret) {
-               spin_unlock_irqrestore(&priv->lock, flags);
-               return ret;
-       }
-
-       if (src == IWL_PWR_SRC_VAUX) {
-               u32 val;
-               ret = pci_read_config_dword(priv->pci_dev, PCI_POWER_SOURCE,
-                                           &val);
-
-               if (val & PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT) {
-                       iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
-                                              APMG_PS_CTRL_VAL_PWR_SRC_VAUX,
-                                              ~APMG_PS_CTRL_MSK_PWR_SRC);
-               }
-       } else {
-               iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
-                                      APMG_PS_CTRL_VAL_PWR_SRC_VMAIN,
-                                      ~APMG_PS_CTRL_MSK_PWR_SRC);
-       }
-
-       iwl_release_nic_access(priv);
-       spin_unlock_irqrestore(&priv->lock, flags);
-
-       return ret;
-}
 
 /*
  * Activate/Deactivat Tx DMA/FIFO channels according tx fifos mask
@@ -875,18 +842,6 @@ static int iwl4965_hw_set_hw_params(struct iwl_priv *priv)
        return 0;
 }
 
-/* set card power command */
-static int iwl4965_set_power(struct iwl_priv *priv,
-                     void *cmd)
-{
-       int ret = 0;
-
-       ret = iwl_send_cmd_pdu_async(priv, POWER_TABLE_CMD,
-                                   sizeof(struct iwl4965_powertable_cmd),
-                                   cmd, NULL);
-       return ret;
-}
-
 static s32 iwl4965_math_div_round(s32 num, s32 denom, s32 *res)
 {
        s32 sign = 1;
@@ -1560,11 +1515,11 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel,
                                          c, atten_value, power_index,
                                        tx_power.s.radio_tx_gain[c],
                                        tx_power.s.dsp_predis_atten[c]);
-               }/* for each chain */
+               } /* for each chain */
 
                tx_power_tbl->power_tbl[i].dw = cpu_to_le32(tx_power.dw);
 
-       }/* for each rate */
+       } /* for each rate */
 
        return 0;
 }
@@ -1701,38 +1656,6 @@ static int iwl4965_shared_mem_rx_idx(struct iwl_priv *priv)
        return le32_to_cpu(s->rb_closed) & 0xFFF;
 }
 
-unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv,
-                         struct iwl_frame *frame, u8 rate)
-{
-       struct iwl4965_tx_beacon_cmd *tx_beacon_cmd;
-       unsigned int frame_size;
-
-       tx_beacon_cmd = &frame->u.beacon;
-       memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd));
-
-       tx_beacon_cmd->tx.sta_id = priv->hw_params.bcast_sta_id;
-       tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
-
-       frame_size = iwl4965_fill_beacon_frame(priv,
-                               tx_beacon_cmd->frame,
-                               iwl_bcast_addr,
-                               sizeof(frame->u) - sizeof(*tx_beacon_cmd));
-
-       BUG_ON(frame_size > MAX_MPDU_SIZE);
-       tx_beacon_cmd->tx.len = cpu_to_le16((u16)frame_size);
-
-       if ((rate == IWL_RATE_1M_PLCP) || (rate >= IWL_RATE_2M_PLCP))
-               tx_beacon_cmd->tx.rate_n_flags =
-                       iwl_hw_set_rate_n_flags(rate, RATE_MCS_CCK_MSK);
-       else
-               tx_beacon_cmd->tx.rate_n_flags =
-                       iwl_hw_set_rate_n_flags(rate, 0);
-
-       tx_beacon_cmd->tx.tx_flags = (TX_CMD_FLG_SEQ_CTL_MSK |
-                               TX_CMD_FLG_TSF_MSK | TX_CMD_FLG_STA_RATE_MSK);
-       return (sizeof(*tx_beacon_cmd) + frame_size);
-}
-
 static int iwl4965_alloc_shared_mem(struct iwl_priv *priv)
 {
        priv->shared_virt = pci_alloc_consistent(priv->pci_dev,
@@ -2079,39 +2002,6 @@ static int iwl4965_txq_agg_enable(struct iwl_priv *priv, int txq_id,
        return 0;
 }
 
-int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw,
-                            enum ieee80211_ampdu_mlme_action action,
-                            const u8 *addr, u16 tid, u16 *ssn)
-{
-       struct iwl_priv *priv = hw->priv;
-       DECLARE_MAC_BUF(mac);
-
-       IWL_DEBUG_HT("A-MPDU action on addr %s tid %d\n",
-                    print_mac(mac, addr), tid);
-
-       if (!(priv->cfg->sku & IWL_SKU_N))
-               return -EACCES;
-
-       switch (action) {
-       case IEEE80211_AMPDU_RX_START:
-               IWL_DEBUG_HT("start Rx\n");
-               return iwl_rx_agg_start(priv, addr, tid, *ssn);
-       case IEEE80211_AMPDU_RX_STOP:
-               IWL_DEBUG_HT("stop Rx\n");
-               return iwl_rx_agg_stop(priv, addr, tid);
-       case IEEE80211_AMPDU_TX_START:
-               IWL_DEBUG_HT("start Tx\n");
-               return iwl_tx_agg_start(priv, addr, tid, ssn);
-       case IEEE80211_AMPDU_TX_STOP:
-               IWL_DEBUG_HT("stop Tx\n");
-               return iwl_tx_agg_stop(priv, addr, tid);
-       default:
-               IWL_DEBUG_HT("unknown\n");
-               return -EINVAL;
-               break;
-       }
-       return 0;
-}
 
 static u16 iwl4965_get_hcmd_size(u8 cmd_id, u16 len)
 {
@@ -2240,9 +2130,9 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv,
                                bitmap = bitmap << sh;
                                sh = 0;
                        }
-                       bitmap |= (1 << sh);
-                       IWL_DEBUG_TX_REPLY("start=%d bitmap=0x%x\n",
-                                          start, (u32)(bitmap & 0xFFFFFFFF));
+                       bitmap |= 1ULL << sh;
+                       IWL_DEBUG_TX_REPLY("start=%d bitmap=0x%llx\n",
+                                          start, (unsigned long long)bitmap);
                }
 
                agg->bitmap = bitmap;
@@ -2368,6 +2258,40 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
                IWL_ERROR("TODO:  Implement Tx ABORT REQUIRED!!!\n");
 }
 
+static int iwl4965_calc_rssi(struct iwl_priv *priv,
+                            struct iwl_rx_phy_res *rx_resp)
+{
+       /* data from PHY/DSP regarding signal strength, etc.,
+        *   contents are always there, not configurable by host.  */
+       struct iwl4965_rx_non_cfg_phy *ncphy =
+           (struct iwl4965_rx_non_cfg_phy *)rx_resp->non_cfg_phy_buf;
+       u32 agc = (le16_to_cpu(ncphy->agc_info) & IWL49_AGC_DB_MASK)
+                       >> IWL49_AGC_DB_POS;
+
+       u32 valid_antennae =
+           (le16_to_cpu(rx_resp->phy_flags) & IWL49_RX_PHY_FLAGS_ANTENNAE_MASK)
+                       >> IWL49_RX_PHY_FLAGS_ANTENNAE_OFFSET;
+       u8 max_rssi = 0;
+       u32 i;
+
+       /* Find max rssi among 3 possible receivers.
+        * These values are measured by the digital signal processor (DSP).
+        * They should stay fairly constant even as the signal strength varies,
+        *   if the radio's automatic gain control (AGC) is working right.
+        * AGC value (see below) will provide the "interesting" info. */
+       for (i = 0; i < 3; i++)
+               if (valid_antennae & (1 << i))
+                       max_rssi = max(ncphy->rssi_info[i << 1], max_rssi);
+
+       IWL_DEBUG_STATS("Rssi In A %d B %d C %d Max %d AGC dB %d\n",
+               ncphy->rssi_info[0], ncphy->rssi_info[2], ncphy->rssi_info[4],
+               max_rssi, agc);
+
+       /* dBm = max_rssi dB - agc dB - constant.
+        * Higher AGC (higher radio gain) means lower signal. */
+       return max_rssi - agc - IWL_RSSI_OFFSET;
+}
+
 
 /* Set up 4965-specific Rx frame reply handlers */
 static void iwl4965_rx_handler_setup(struct iwl_priv *priv)
@@ -2399,6 +2323,7 @@ static struct iwl_hcmd_utils_ops iwl4965_hcmd_utils = {
        .chain_noise_reset = iwl4965_chain_noise_reset,
        .gain_computation = iwl4965_gain_computation,
        .rts_tx_cmd_flag = iwl4965_rts_tx_cmd_flag,
+       .calc_rssi = iwl4965_calc_rssi,
 };
 
 static struct iwl_lib_ops iwl4965_lib = {
@@ -2440,7 +2365,6 @@ static struct iwl_lib_ops iwl4965_lib = {
                .check_version = iwl4965_eeprom_check_version,
                .query_addr = iwlcore_eeprom_query_addr,
        },
-       .set_power = iwl4965_set_power,
        .send_tx_power  = iwl4965_send_tx_power,
        .update_chain_flags = iwl4965_update_chain_flags,
        .temperature = iwl4965_temperature_calib,
@@ -2469,7 +2393,7 @@ MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])");
 module_param_named(disable, iwl4965_mod_params.disable, int, 0444);
 MODULE_PARM_DESC(disable, "manually disable the radio (default 0 [radio on])");
 module_param_named(swcrypto, iwl4965_mod_params.sw_crypto, int, 0444);
-MODULE_PARM_DESC(swcrypto, "using crypto in software (default 0 [hardware])\n");
+MODULE_PARM_DESC(swcrypto, "using crypto in software (default 0 [hardware])");
 module_param_named(debug, iwl4965_mod_params.debug, int, 0444);
 MODULE_PARM_DESC(debug, "debug output mask");
 module_param_named(
index 878d619..f3d139b 100644 (file)
@@ -93,6 +93,13 @@ static int iwl5000_apm_init(struct iwl_priv *priv)
        iwl_set_bit(priv, CSR_GIO_CHICKEN_BITS,
                    CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX);
 
+       /* Set FH wait treshold to maximum (HW error during stress W/A) */
+       iwl_set_bit(priv, CSR_DBG_HPET_MEM_REG, CSR_DBG_HPET_MEM_REG_VAL);
+
+       /* enable HAP INTA to move device L1a -> L0s */
+       iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
+                   CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A);
+
        iwl_set_bit(priv, CSR_ANA_PLL_CFG, CSR50_ANA_PLL_CFG_VAL);
 
        /* set "initialization complete" bit to move adapter
@@ -230,6 +237,16 @@ static void iwl5000_nic_config(struct iwl_priv *priv)
                    CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI |
                    CSR_HW_IF_CONFIG_REG_BIT_MAC_SI);
 
+       /* W/A : NIC is stuck in a reset state after Early PCIe power off
+        * (PCIe power is lost before PERST# is asserted),
+        * causing ME FW to lose ownership and not being able to obtain it back.
+        */
+       iwl_grab_nic_access(priv);
+       iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
+                               APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS,
+                               ~APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS);
+       iwl_release_nic_access(priv);
+
        spin_unlock_irqrestore(&priv->lock, flags);
 }
 
@@ -924,8 +941,8 @@ static void iwl5000_txq_update_byte_cnt_tbl(struct iwl_priv *priv,
        len = byte_cnt + IWL_TX_CRC_SIZE + IWL_TX_DELIMITER_SIZE;
 
        if (txq_id != IWL_CMD_QUEUE_NUM) {
-               sta = txq->cmd[txq->q.write_ptr].cmd.tx.sta_id;
-               sec_ctl = txq->cmd[txq->q.write_ptr].cmd.tx.sec_ctl;
+               sta = txq->cmd[txq->q.write_ptr]->cmd.tx.sta_id;
+               sec_ctl = txq->cmd[txq->q.write_ptr]->cmd.tx.sec_ctl;
 
                switch (sec_ctl & TX_CMD_SEC_MSK) {
                case TX_CMD_SEC_CCM:
@@ -964,7 +981,7 @@ static void iwl5000_txq_inval_byte_cnt_tbl(struct iwl_priv *priv,
        u8 sta = 0;
 
        if (txq_id != IWL_CMD_QUEUE_NUM)
-               sta = txq->cmd[txq->q.read_ptr].cmd.tx.sta_id;
+               sta = txq->cmd[txq->q.read_ptr]->cmd.tx.sta_id;
 
        shared_data->queues_byte_cnt_tbls[txq_id].tfd_offset[txq->q.read_ptr].
                                        val = cpu_to_le16(1 | (sta << 12));
@@ -1131,7 +1148,7 @@ static void iwl5000_txq_set_sched(struct iwl_priv *priv, u32 mask)
 
 static inline u32 iwl5000_get_scd_ssn(struct iwl5000_tx_resp *tx_resp)
 {
-       return le32_to_cpup((__le32*)&tx_resp->status +
+       return le32_to_cpup((__le32 *)&tx_resp->status +
                            tx_resp->frame_count) & MAX_SN;
 }
 
@@ -1228,9 +1245,9 @@ static int iwl5000_tx_status_reply_tx(struct iwl_priv *priv,
                                bitmap = bitmap << sh;
                                sh = 0;
                        }
-                       bitmap |= (1 << sh);
-                       IWL_DEBUG_TX_REPLY("start=%d bitmap=0x%x\n",
-                                          start, (u32)(bitmap & 0xFFFFFFFF));
+                       bitmap |= 1ULL << sh;
+                       IWL_DEBUG_TX_REPLY("start=%d bitmap=0x%llx\n",
+                                          start, (unsigned long long)bitmap);
                }
 
                agg->bitmap = bitmap;
@@ -1444,6 +1461,44 @@ static void iwl5000_temperature(struct iwl_priv *priv)
        priv->temperature = le32_to_cpu(priv->statistics.general.temperature);
 }
 
+/* Calc max signal level (dBm) among 3 possible receivers */
+static int iwl5000_calc_rssi(struct iwl_priv *priv,
+                            struct iwl_rx_phy_res *rx_resp)
+{
+       /* data from PHY/DSP regarding signal strength, etc.,
+        *   contents are always there, not configurable by host
+        */
+       struct iwl5000_non_cfg_phy *ncphy =
+               (struct iwl5000_non_cfg_phy *)rx_resp->non_cfg_phy_buf;
+       u32 val, rssi_a, rssi_b, rssi_c, max_rssi;
+       u8 agc;
+
+       val  = le32_to_cpu(ncphy->non_cfg_phy[IWL50_RX_RES_AGC_IDX]);
+       agc = (val & IWL50_OFDM_AGC_MSK) >> IWL50_OFDM_AGC_BIT_POS;
+
+       /* Find max rssi among 3 possible receivers.
+        * These values are measured by the digital signal processor (DSP).
+        * They should stay fairly constant even as the signal strength varies,
+        *   if the radio's automatic gain control (AGC) is working right.
+        * AGC value (see below) will provide the "interesting" info.
+        */
+       val = le32_to_cpu(ncphy->non_cfg_phy[IWL50_RX_RES_RSSI_AB_IDX]);
+       rssi_a = (val & IWL50_OFDM_RSSI_A_MSK) >> IWL50_OFDM_RSSI_A_BIT_POS;
+       rssi_b = (val & IWL50_OFDM_RSSI_B_MSK) >> IWL50_OFDM_RSSI_B_BIT_POS;
+       val = le32_to_cpu(ncphy->non_cfg_phy[IWL50_RX_RES_RSSI_C_IDX]);
+       rssi_c = (val & IWL50_OFDM_RSSI_C_MSK) >> IWL50_OFDM_RSSI_C_BIT_POS;
+
+       max_rssi = max_t(u32, rssi_a, rssi_b);
+       max_rssi = max_t(u32, max_rssi, rssi_c);
+
+       IWL_DEBUG_STATS("Rssi In A %d B %d C %d Max %d AGC dB %d\n",
+               rssi_a, rssi_b, rssi_c, max_rssi, agc);
+
+       /* dBm = max_rssi dB - agc dB - constant.
+        * Higher AGC (higher radio gain) means lower signal. */
+       return max_rssi - agc - IWL_RSSI_OFFSET;
+}
+
 static struct iwl_hcmd_ops iwl5000_hcmd = {
        .rxon_assoc = iwl5000_send_rxon_assoc,
 };
@@ -1454,6 +1509,7 @@ static struct iwl_hcmd_utils_ops iwl5000_hcmd_utils = {
        .gain_computation = iwl5000_gain_computation,
        .chain_noise_reset = iwl5000_chain_noise_reset,
        .rts_tx_cmd_flag = iwl5000_rts_tx_cmd_flag,
+       .calc_rssi = iwl5000_calc_rssi,
 };
 
 static struct iwl_lib_ops iwl5000_lib = {
@@ -1474,6 +1530,7 @@ static struct iwl_lib_ops iwl5000_lib = {
        .alive_notify = iwl5000_alive_notify,
        .send_tx_power = iwl5000_send_tx_power,
        .temperature = iwl5000_temperature,
+       .update_chain_flags = iwl4965_update_chain_flags,
        .apm_ops = {
                .init = iwl5000_apm_init,
                .reset = iwl5000_apm_reset,
similarity index 89%
rename from drivers/net/wireless/iwlwifi/iwl-4965-rs.c
rename to drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index 3ccb84a..754fef5 100644 (file)
@@ -42,7 +42,7 @@
 #include "iwl-core.h"
 #include "iwl-helpers.h"
 
-#define RS_NAME "iwl-4965-rs"
+#define RS_NAME "iwl-agn-rs"
 
 #define NUM_TRY_BEFORE_ANT_TOGGLE 1
 #define IWL_NUMBER_TRY      1
@@ -77,9 +77,9 @@ static const u8 ant_toggle_lookup[] = {
 };
 
 /**
- * struct iwl4965_rate_scale_data -- tx success history for one rate
+ * struct iwl_rate_scale_data -- tx success history for one rate
  */
-struct iwl4965_rate_scale_data {
+struct iwl_rate_scale_data {
        u64 data;               /* bitmap of successful frames */
        s32 success_counter;    /* number of frames successful */
        s32 success_ratio;      /* per-cent * 128  */
@@ -89,12 +89,12 @@ struct iwl4965_rate_scale_data {
 };
 
 /**
- * struct iwl4965_scale_tbl_info -- tx params and success history for all rates
+ * struct iwl_scale_tbl_info -- tx params and success history for all rates
  *
- * There are two of these in struct iwl4965_lq_sta,
+ * There are two of these in struct iwl_lq_sta,
  * one for "active", and one for "search".
  */
-struct iwl4965_scale_tbl_info {
+struct iwl_scale_tbl_info {
        enum iwl_table_type lq_type;
        u8 ant_type;
        u8 is_SGI;      /* 1 = short guard interval */
@@ -103,10 +103,10 @@ struct iwl4965_scale_tbl_info {
        u8 action;      /* change modulation; IWL_[LEGACY/SISO/MIMO]_SWITCH_* */
        s32 *expected_tpt;      /* throughput metrics; expected_tpt_G, etc. */
        u32 current_rate;  /* rate_n_flags, uCode API format */
-       struct iwl4965_rate_scale_data win[IWL_RATE_COUNT]; /* rate histories */
+       struct iwl_rate_scale_data win[IWL_RATE_COUNT]; /* rate histories */
 };
 
-struct iwl4965_traffic_load {
+struct iwl_traffic_load {
        unsigned long time_stamp;       /* age of the oldest statistics */
        u32 packet_count[TID_QUEUE_MAX_SIZE];   /* packet count in this time
                                                 * slice */
@@ -118,11 +118,11 @@ struct iwl4965_traffic_load {
 };
 
 /**
- * struct iwl4965_lq_sta -- driver's rate scaling private structure
+ * struct iwl_lq_sta -- driver's rate scaling private structure
  *
  * Pointer to this gets passed back and forth between driver and mac80211.
  */
-struct iwl4965_lq_sta {
+struct iwl_lq_sta {
        u8 active_tbl;          /* index of active table, range 0-1 */
        u8 enable_counter;      /* indicates HT mode */
        u8 stay_in_tbl;         /* 1: disallow, 0: allow search for new mode */
@@ -153,8 +153,8 @@ struct iwl4965_lq_sta {
        u16 active_rate_basic;
 
        struct iwl_link_quality_cmd lq;
-       struct iwl4965_scale_tbl_info lq_info[LQ_SIZE]; /* "active", "search" */
-       struct iwl4965_traffic_load load[TID_MAX_LOAD_COUNT];
+       struct iwl_scale_tbl_info lq_info[LQ_SIZE]; /* "active", "search" */
+       struct iwl_traffic_load load[TID_MAX_LOAD_COUNT];
        u8 tx_agg_tid_en;
 #ifdef CONFIG_MAC80211_DEBUGFS
        struct dentry *rs_sta_dbgfs_scale_table_file;
@@ -170,16 +170,15 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
                                   struct ieee80211_hdr *hdr,
                                   struct sta_info *sta);
 static void rs_fill_link_cmd(const struct iwl_priv *priv,
-                            struct iwl4965_lq_sta *lq_sta,
-                            u32 rate_n_flags);
+                            struct iwl_lq_sta *lq_sta, u32 rate_n_flags);
 
 
 #ifdef CONFIG_MAC80211_DEBUGFS
-static void rs_dbgfs_set_mcs(struct iwl4965_lq_sta *lq_sta,
-                                       u32 *rate_n_flags, int index);
+static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta,
+                            u32 *rate_n_flags, int index);
 #else
-static void rs_dbgfs_set_mcs(struct iwl4965_lq_sta *lq_sta,
-                                       u32 *rate_n_flags, int index)
+static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta,
+                            u32 *rate_n_flags, int index)
 {}
 #endif
 
@@ -234,7 +233,7 @@ static inline u8 rs_extract_rate(u32 rate_n_flags)
        return (u8)(rate_n_flags & 0xFF);
 }
 
-static void rs_rate_scale_clear_window(struct iwl4965_rate_scale_data *window)
+static void rs_rate_scale_clear_window(struct iwl_rate_scale_data *window)
 {
        window->data = 0;
        window->success_counter = 0;
@@ -246,14 +245,14 @@ static void rs_rate_scale_clear_window(struct iwl4965_rate_scale_data *window)
 
 static inline u8 rs_is_valid_ant(u8 valid_antenna, u8 ant_type)
 {
-       return ((ant_type & valid_antenna) == ant_type);
+       return (ant_type & valid_antenna) == ant_type;
 }
 
 /*
  *     removes the old data from the statistics. All data that is older than
  *     TID_MAX_TIME_DIFF, will be deleted.
  */
-static void rs_tl_rm_old_stats(struct iwl4965_traffic_load *tl, u32 curr_time)
+static void rs_tl_rm_old_stats(struct iwl_traffic_load *tl, u32 curr_time)
 {
        /* The oldest age we want to keep */
        u32 oldest_time = curr_time - TID_MAX_TIME_DIFF;
@@ -274,13 +273,13 @@ static void rs_tl_rm_old_stats(struct iwl4965_traffic_load *tl, u32 curr_time)
  *     increment traffic load value for tid and also remove
  *     any old values if passed the certain time period
  */
-static u8 rs_tl_add_packet(struct iwl4965_lq_sta *lq_data,
+static u8 rs_tl_add_packet(struct iwl_lq_sta *lq_data,
                           struct ieee80211_hdr *hdr)
 {
        u32 curr_time = jiffies_to_msecs(jiffies);
        u32 time_diff;
        s32 index;
-       struct iwl4965_traffic_load *tl = NULL;
+       struct iwl_traffic_load *tl = NULL;
        __le16 fc = hdr->frame_control;
        u8 tid;
 
@@ -325,12 +324,12 @@ static u8 rs_tl_add_packet(struct iwl4965_lq_sta *lq_data,
 /*
        get the traffic load value for tid
 */
-static u32 rs_tl_get_load(struct iwl4965_lq_sta *lq_data, u8 tid)
+static u32 rs_tl_get_load(struct iwl_lq_sta *lq_data, u8 tid)
 {
        u32 curr_time = jiffies_to_msecs(jiffies);
        u32 time_diff;
        s32 index;
-       struct iwl4965_traffic_load *tl = NULL;
+       struct iwl_traffic_load *tl = NULL;
 
        if (tid >= TID_MAX_LOAD_COUNT)
                return 0;
@@ -354,8 +353,8 @@ static u32 rs_tl_get_load(struct iwl4965_lq_sta *lq_data, u8 tid)
 }
 
 static void rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv,
-                               struct iwl4965_lq_sta *lq_data, u8 tid,
-                               struct sta_info *sta)
+                                     struct iwl_lq_sta *lq_data, u8 tid,
+                                     struct sta_info *sta)
 {
        unsigned long state;
        DECLARE_MAC_BUF(mac);
@@ -373,8 +372,8 @@ static void rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv,
 }
 
 static void rs_tl_turn_on_agg(struct iwl_priv *priv, u8 tid,
-                               struct iwl4965_lq_sta *lq_data,
-                               struct sta_info *sta)
+                             struct iwl_lq_sta *lq_data,
+                             struct sta_info *sta)
 {
        if ((tid < TID_MAX_LOAD_COUNT))
                rs_tl_turn_on_agg_for_tid(priv, lq_data, tid, sta);
@@ -385,9 +384,9 @@ static void rs_tl_turn_on_agg(struct iwl_priv *priv, u8 tid,
 
 static inline int get_num_of_ant_from_rate(u32 rate_n_flags)
 {
-       return (!!(rate_n_flags & RATE_MCS_ANT_A_MSK) +
-               !!(rate_n_flags & RATE_MCS_ANT_B_MSK) +
-               !!(rate_n_flags & RATE_MCS_ANT_C_MSK));
+       return !!(rate_n_flags & RATE_MCS_ANT_A_MSK) +
+              !!(rate_n_flags & RATE_MCS_ANT_B_MSK) +
+              !!(rate_n_flags & RATE_MCS_ANT_C_MSK);
 }
 
 /**
@@ -397,11 +396,11 @@ static inline int get_num_of_ant_from_rate(u32 rate_n_flags)
  * at this rate.  window->data contains the bitmask of successful
  * packets.
  */
-static int rs_collect_tx_data(struct iwl4965_rate_scale_data *windows,
+static int rs_collect_tx_data(struct iwl_rate_scale_data *windows,
                              int scale_index, s32 tpt, int retries,
                              int successes)
 {
-       struct iwl4965_rate_scale_data *window = NULL;
+       struct iwl_rate_scale_data *window = NULL;
        static const u64 mask = (((u64)1) << (IWL_RATE_MAX_WINDOW - 1));
        s32 fail_count;
 
@@ -473,7 +472,7 @@ static int rs_collect_tx_data(struct iwl4965_rate_scale_data *windows,
  * Fill uCode API rate_n_flags field, based on "search" or "active" table.
  */
 /* FIXME:RS:remove this function and put the flags statically in the table */
-static u32 rate_n_flags_from_tbl(struct iwl4965_scale_tbl_info *tbl,
+static u32 rate_n_flags_from_tbl(struct iwl_scale_tbl_info *tbl,
                                       int index, u8 use_green)
 {
        u32 rate_n_flags = 0;
@@ -530,7 +529,7 @@ static u32 rate_n_flags_from_tbl(struct iwl4965_scale_tbl_info *tbl,
  */
 static int rs_get_tbl_info_from_mcs(const u32 rate_n_flags,
                                    enum ieee80211_band band,
-                                   struct iwl4965_scale_tbl_info *tbl,
+                                   struct iwl_scale_tbl_info *tbl,
                                    int *rate_idx)
 {
        u32 ant_msk = (rate_n_flags & RATE_MCS_ANT_ABC_MSK);
@@ -591,7 +590,7 @@ static int rs_get_tbl_info_from_mcs(const u32 rate_n_flags,
 /* switch to another antenna/antennas and return 1 */
 /* if no other valid antenna found, return 0 */
 static int rs_toggle_antenna(u32 valid_ant, u32 *rate_n_flags,
-                             struct iwl4965_scale_tbl_info *tbl)
+                            struct iwl_scale_tbl_info *tbl)
 {
        u8 new_ant_type;
 
@@ -621,9 +620,9 @@ static int rs_toggle_antenna(u32 valid_ant, u32 *rate_n_flags,
 #if 0
 static inline u8 rs_use_green(struct iwl_priv *priv, struct ieee80211_conf *conf)
 {
-       return ((conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) &&
+       return (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) &&
                priv->current_ht_config.is_green_field &&
-               !priv->current_ht_config.non_GF_STA_present);
+               !priv->current_ht_config.non_GF_STA_present;
 }
 #endif
 static inline u8 rs_use_green(struct iwl_priv *priv, struct ieee80211_conf *conf)
@@ -638,9 +637,9 @@ static inline u8 rs_use_green(struct iwl_priv *priv, struct ieee80211_conf *conf
  * basic available rates.
  *
  */
-static u16 rs_get_supported_rates(struct iwl4965_lq_sta *lq_sta,
-                                  struct ieee80211_hdr *hdr,
-                                  enum iwl_table_type rate_type)
+static u16 rs_get_supported_rates(struct iwl_lq_sta *lq_sta,
+                                 struct ieee80211_hdr *hdr,
+                                 enum iwl_table_type rate_type)
 {
        if (hdr && is_multicast_ether_addr(hdr->addr1) &&
            lq_sta->active_rate_basic)
@@ -714,9 +713,9 @@ static u16 rs_get_adjacent_rate(struct iwl_priv *priv, u8 index, u16 rate_mask,
        return (high << 8) | low;
 }
 
-static u32 rs_get_lower_rate(struct iwl4965_lq_sta *lq_sta,
-                            struct iwl4965_scale_tbl_info *tbl, u8 scale_index,
-                            u8 ht_possible)
+static u32 rs_get_lower_rate(struct iwl_lq_sta *lq_sta,
+                            struct iwl_scale_tbl_info *tbl,
+                            u8 scale_index, u8 ht_possible)
 {
        s32 low;
        u16 rate_mask;
@@ -780,7 +779,7 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev,
        int status;
        u8 retries;
        int rs_index, index = 0;
-       struct iwl4965_lq_sta *lq_sta;
+       struct iwl_lq_sta *lq_sta;
        struct iwl_link_quality_cmd *table;
        struct sta_info *sta;
        struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
@@ -788,11 +787,11 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev,
        struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
        struct ieee80211_hw *hw = local_to_hw(local);
        struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
-       struct iwl4965_rate_scale_data *window = NULL;
-       struct iwl4965_rate_scale_data *search_win = NULL;
+       struct iwl_rate_scale_data *window = NULL;
+       struct iwl_rate_scale_data *search_win = NULL;
        u32 tx_rate;
-       struct iwl4965_scale_tbl_info tbl_type;
-       struct iwl4965_scale_tbl_info *curr_tbl, *search_tbl;
+       struct iwl_scale_tbl_info tbl_type;
+       struct iwl_scale_tbl_info *curr_tbl, *search_tbl;
        u8 active_index = 0;
        __le16 fc = hdr->frame_control;
        s32 tpt = 0;
@@ -820,7 +819,7 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev,
                goto out;
 
 
-       lq_sta = (struct iwl4965_lq_sta *)sta->rate_ctrl_priv;
+       lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv;
 
        if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) &&
            !lq_sta->ibss_sta_added)
@@ -831,10 +830,8 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev,
 
        curr_tbl = &(lq_sta->lq_info[active_index]);
        search_tbl = &(lq_sta->lq_info[(1 - active_index)]);
-       window = (struct iwl4965_rate_scale_data *)
-           &(curr_tbl->win[0]);
-       search_win = (struct iwl4965_rate_scale_data *)
-           &(search_tbl->win[0]);
+       window = (struct iwl_rate_scale_data *)&(curr_tbl->win[0]);
+       search_win = (struct iwl_rate_scale_data *)&(search_tbl->win[0]);
 
        /*
         * Ignore this Tx frame response if its initial rate doesn't match
@@ -983,7 +980,7 @@ out:
  * searching for a new mode.
  */
 static void rs_set_stay_in_table(struct iwl_priv *priv, u8 is_legacy,
-                                struct iwl4965_lq_sta *lq_sta)
+                                struct iwl_lq_sta *lq_sta)
 {
        IWL_DEBUG_RATE("we are staying in the same table\n");
        lq_sta->stay_in_tbl = 1;        /* only place this gets set */
@@ -1004,8 +1001,8 @@ static void rs_set_stay_in_table(struct iwl_priv *priv, u8 is_legacy,
 /*
  * Find correct throughput table for given mode of modulation
  */
-static void rs_set_expected_tpt_table(struct iwl4965_lq_sta *lq_sta,
-                                     struct iwl4965_scale_tbl_info *tbl)
+static void rs_set_expected_tpt_table(struct iwl_lq_sta *lq_sta,
+                                     struct iwl_scale_tbl_info *tbl)
 {
        if (is_legacy(tbl->lq_type)) {
                if (!is_a_band(tbl->lq_type))
@@ -1050,12 +1047,12 @@ static void rs_set_expected_tpt_table(struct iwl4965_lq_sta *lq_sta,
  * bit rate will typically need to increase, but not if performance was bad.
  */
 static s32 rs_get_best_rate(struct iwl_priv *priv,
-                           struct iwl4965_lq_sta *lq_sta,
-                           struct iwl4965_scale_tbl_info *tbl, /* "search" */
+                           struct iwl_lq_sta *lq_sta,
+                           struct iwl_scale_tbl_info *tbl,     /* "search" */
                            u16 rate_mask, s8 index)
 {
        /* "active" values */
-       struct iwl4965_scale_tbl_info *active_tbl =
+       struct iwl_scale_tbl_info *active_tbl =
            &(lq_sta->lq_info[lq_sta->active_tbl]);
        s32 active_sr = active_tbl->win[index].success_ratio;
        s32 active_tpt = active_tbl->expected_tpt[index];
@@ -1143,10 +1140,10 @@ static s32 rs_get_best_rate(struct iwl_priv *priv,
  * Set up search table for MIMO
  */
 static int rs_switch_to_mimo2(struct iwl_priv *priv,
-                            struct iwl4965_lq_sta *lq_sta,
+                            struct iwl_lq_sta *lq_sta,
                             struct ieee80211_conf *conf,
                             struct sta_info *sta,
-                            struct iwl4965_scale_tbl_info *tbl, int index)
+                            struct iwl_scale_tbl_info *tbl, int index)
 {
        u16 rate_mask;
        s32 rate;
@@ -1210,10 +1207,10 @@ static int rs_switch_to_mimo2(struct iwl_priv *priv,
  * Set up search table for SISO
  */
 static int rs_switch_to_siso(struct iwl_priv *priv,
-                            struct iwl4965_lq_sta *lq_sta,
+                            struct iwl_lq_sta *lq_sta,
                             struct ieee80211_conf *conf,
                             struct sta_info *sta,
-                            struct iwl4965_scale_tbl_info *tbl, int index)
+                            struct iwl_scale_tbl_info *tbl, int index)
 {
        u16 rate_mask;
        u8 is_green = lq_sta->is_green;
@@ -1270,18 +1267,17 @@ static int rs_switch_to_siso(struct iwl_priv *priv,
  * Try to switch to new modulation mode from legacy
  */
 static int rs_move_legacy_other(struct iwl_priv *priv,
-                               struct iwl4965_lq_sta *lq_sta,
+                               struct iwl_lq_sta *lq_sta,
                                struct ieee80211_conf *conf,
                                struct sta_info *sta,
                                int index)
 {
-       struct iwl4965_scale_tbl_info *tbl =
-           &(lq_sta->lq_info[lq_sta->active_tbl]);
-       struct iwl4965_scale_tbl_info *search_tbl =
-           &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]);
-       struct iwl4965_rate_scale_data *window = &(tbl->win[index]);
-       u32 sz = (sizeof(struct iwl4965_scale_tbl_info) -
-                 (sizeof(struct iwl4965_rate_scale_data) * IWL_RATE_COUNT));
+       struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]);
+       struct iwl_scale_tbl_info *search_tbl =
+                               &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]);
+       struct iwl_rate_scale_data *window = &(tbl->win[index]);
+       u32 sz = (sizeof(struct iwl_scale_tbl_info) -
+                 (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT));
        u8 start_action = tbl->action;
        u8 valid_tx_ant = priv->hw_params.valid_tx_ant;
        int ret = 0;
@@ -1360,19 +1356,17 @@ static int rs_move_legacy_other(struct iwl_priv *priv,
  * Try to switch to new modulation mode from SISO
  */
 static int rs_move_siso_to_other(struct iwl_priv *priv,
-                                struct iwl4965_lq_sta *lq_sta,
+                                struct iwl_lq_sta *lq_sta,
                                 struct ieee80211_conf *conf,
-                                struct sta_info *sta,
-                                int index)
+                                struct sta_info *sta, int index)
 {
        u8 is_green = lq_sta->is_green;
-       struct iwl4965_scale_tbl_info *tbl =
-           &(lq_sta->lq_info[lq_sta->active_tbl]);
-       struct iwl4965_scale_tbl_info *search_tbl =
-           &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]);
-       struct iwl4965_rate_scale_data *window = &(tbl->win[index]);
-       u32 sz = (sizeof(struct iwl4965_scale_tbl_info) -
-                 (sizeof(struct iwl4965_rate_scale_data) * IWL_RATE_COUNT));
+       struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]);
+       struct iwl_scale_tbl_info *search_tbl =
+                               &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]);
+       struct iwl_rate_scale_data *window = &(tbl->win[index]);
+       u32 sz = (sizeof(struct iwl_scale_tbl_info) -
+                 (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT));
        u8 start_action = tbl->action;
        u8 valid_tx_ant = priv->hw_params.valid_tx_ant;
        int ret;
@@ -1455,18 +1449,16 @@ static int rs_move_siso_to_other(struct iwl_priv *priv,
  * Try to switch to new modulation mode from MIMO
  */
 static int rs_move_mimo_to_other(struct iwl_priv *priv,
-                                struct iwl4965_lq_sta *lq_sta,
+                                struct iwl_lq_sta *lq_sta,
                                 struct ieee80211_conf *conf,
-                                struct sta_info *sta,
-                                int index)
+                                struct sta_info *sta, int index)
 {
        s8 is_green = lq_sta->is_green;
-       struct iwl4965_scale_tbl_info *tbl =
-           &(lq_sta->lq_info[lq_sta->active_tbl]);
-       struct iwl4965_scale_tbl_info *search_tbl =
-           &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]);
-       u32 sz = (sizeof(struct iwl4965_scale_tbl_info) -
-                 (sizeof(struct iwl4965_rate_scale_data) * IWL_RATE_COUNT));
+       struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]);
+       struct iwl_scale_tbl_info *search_tbl =
+                               &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]);
+       u32 sz = (sizeof(struct iwl_scale_tbl_info) -
+                 (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT));
        u8 start_action = tbl->action;
        /*u8 valid_tx_ant = priv->hw_params.valid_tx_ant;*/
        int ret;
@@ -1552,9 +1544,9 @@ static int rs_move_mimo_to_other(struct iwl_priv *priv,
  * 2) # times calling this function
  * 3) elapsed time in this mode (not used, for now)
  */
-static void rs_stay_in_table(struct iwl4965_lq_sta *lq_sta)
+static void rs_stay_in_table(struct iwl_lq_sta *lq_sta)
 {
-       struct iwl4965_scale_tbl_info *tbl;
+       struct iwl_scale_tbl_info *tbl;
        int i;
        int active_tbl;
        int flush_interval_passed = 0;
@@ -1642,7 +1634,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
        int high = IWL_RATE_INVALID;
        int index;
        int i;
-       struct iwl4965_rate_scale_data *window = NULL;
+       struct iwl_rate_scale_data *window = NULL;
        int current_tpt = IWL_INVALID_VALUE;
        int low_tpt = IWL_INVALID_VALUE;
        int high_tpt = IWL_INVALID_VALUE;
@@ -1651,8 +1643,8 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
        __le16 fc;
        u16 rate_mask;
        u8 update_lq = 0;
-       struct iwl4965_lq_sta *lq_sta;
-       struct iwl4965_scale_tbl_info *tbl, *tbl1;
+       struct iwl_lq_sta *lq_sta;
+       struct iwl_scale_tbl_info *tbl, *tbl1;
        u16 rate_scale_index_msk = 0;
        u32 rate;
        u8 is_green = 0;
@@ -1675,7 +1667,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
        if (!sta || !sta->rate_ctrl_priv)
                return;
 
-       lq_sta = (struct iwl4965_lq_sta *)sta->rate_ctrl_priv;
+       lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv;
 
        tid = rs_tl_add_packet(lq_sta, hdr);
 
@@ -2030,8 +2022,8 @@ static void rs_initialize_lq(struct iwl_priv *priv,
                             struct ieee80211_conf *conf,
                             struct sta_info *sta)
 {
-       struct iwl4965_lq_sta *lq_sta;
-       struct iwl4965_scale_tbl_info *tbl;
+       struct iwl_lq_sta *lq_sta;
+       struct iwl_scale_tbl_info *tbl;
        int rate_idx;
        int i;
        u32 rate;
@@ -2042,7 +2034,7 @@ static void rs_initialize_lq(struct iwl_priv *priv,
        if (!sta || !sta->rate_ctrl_priv)
                goto out;
 
-       lq_sta = (struct iwl4965_lq_sta *)sta->rate_ctrl_priv;
+       lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv;
        i = sta->last_txrate_idx;
 
        if ((lq_sta->lq.sta_id == 0xff) &&
@@ -2096,7 +2088,7 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
        struct sta_info *sta;
        __le16 fc;
        struct iwl_priv *priv = (struct iwl_priv *)priv_rate;
-       struct iwl4965_lq_sta *lq_sta;
+       struct iwl_lq_sta *lq_sta;
 
        IWL_DEBUG_RATE_LIMIT("rate scale calculate new rate for skb\n");
 
@@ -2113,7 +2105,7 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
                goto out;
        }
 
-       lq_sta = (struct iwl4965_lq_sta *)sta->rate_ctrl_priv;
+       lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv;
        i = sta->last_txrate_idx;
 
        if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) &&
@@ -2149,14 +2141,14 @@ out:
 
 static void *rs_alloc_sta(void *priv_rate, gfp_t gfp)
 {
-       struct iwl4965_lq_sta *lq_sta;
+       struct iwl_lq_sta *lq_sta;
        struct iwl_priv *priv;
        int i, j;
 
        priv = (struct iwl_priv *)priv_rate;
        IWL_DEBUG_RATE("create station rate scale window\n");
 
-       lq_sta = kzalloc(sizeof(struct iwl4965_lq_sta), gfp);
+       lq_sta = kzalloc(sizeof(struct iwl_lq_sta), gfp);
 
        if (lq_sta == NULL)
                return NULL;
@@ -2165,7 +2157,7 @@ static void *rs_alloc_sta(void *priv_rate, gfp_t gfp)
 
        for (j = 0; j < LQ_SIZE; j++)
                for (i = 0; i < IWL_RATE_COUNT; i++)
-                       rs_rate_scale_clear_window(&(lq_sta->lq_info[j].win[i]));
+                       rs_rate_scale_clear_window(&lq_sta->lq_info[j].win[i]);
 
        return lq_sta;
 }
@@ -2178,7 +2170,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
        struct ieee80211_conf *conf = &local->hw.conf;
        struct ieee80211_supported_band *sband;
        struct iwl_priv *priv = (struct iwl_priv *)priv_rate;
-       struct iwl4965_lq_sta *lq_sta = priv_sta;
+       struct iwl_lq_sta *lq_sta = priv_sta;
 
        sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
 
@@ -2187,7 +2179,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
        sta->txrate_idx = 3;
        for (j = 0; j < LQ_SIZE; j++)
                for (i = 0; i < IWL_RATE_COUNT; i++)
-                       rs_rate_scale_clear_window(&(lq_sta->lq_info[j].win[i]));
+                       rs_rate_scale_clear_window(&lq_sta->lq_info[j].win[i]);
 
        IWL_DEBUG_RATE("LQ: *** rate scale global init ***\n");
        /* TODO: what is a good starting rate for STA? About middle? Maybe not
@@ -2271,10 +2263,9 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
 }
 
 static void rs_fill_link_cmd(const struct iwl_priv *priv,
-                            struct iwl4965_lq_sta *lq_sta,
-                            u32 new_rate)
+                            struct iwl_lq_sta *lq_sta, u32 new_rate)
 {
-       struct iwl4965_scale_tbl_info tbl_type;
+       struct iwl_scale_tbl_info tbl_type;
        int index = 0;
        int rate_idx;
        int repeat_rate = 0;
@@ -2402,6 +2393,7 @@ static void rs_free(void *priv_rate)
 
 static void rs_clear(void *priv_rate)
 {
+#ifdef CONFIG_IWLWIFI_DEBUG
        struct iwl_priv *priv = (struct iwl_priv *) priv_rate;
 
        IWL_DEBUG_RATE("enter\n");
@@ -2409,11 +2401,12 @@ static void rs_clear(void *priv_rate)
        /* TODO - add rate scale state reset */
 
        IWL_DEBUG_RATE("leave\n");
+#endif /* CONFIG_IWLWIFI_DEBUG */
 }
 
 static void rs_free_sta(void *priv_rate, void *priv_sta)
 {
-       struct iwl4965_lq_sta *lq_sta = priv_sta;
+       struct iwl_lq_sta *lq_sta = priv_sta;
        struct iwl_priv *priv;
 
        priv = (struct iwl_priv *)priv_rate;
@@ -2429,8 +2422,8 @@ static int open_file_generic(struct inode *inode, struct file *file)
        file->private_data = inode->i_private;
        return 0;
 }
-static void rs_dbgfs_set_mcs(struct iwl4965_lq_sta *lq_sta,
-                               u32 *rate_n_flags, int index)
+static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta,
+                            u32 *rate_n_flags, int index)
 {
        struct iwl_priv *priv;
 
@@ -2453,7 +2446,7 @@ static void rs_dbgfs_set_mcs(struct iwl4965_lq_sta *lq_sta,
 static ssize_t rs_sta_dbgfs_scale_table_write(struct file *file,
                        const char __user *user_buf, size_t count, loff_t *ppos)
 {
-       struct iwl4965_lq_sta *lq_sta = file->private_data;
+       struct iwl_lq_sta *lq_sta = file->private_data;
        struct iwl_priv *priv;
        char buf[64];
        int buf_size;
@@ -2493,7 +2486,7 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file,
        int desc = 0;
        int i = 0;
 
-       struct iwl4965_lq_sta *lq_sta = file->private_data;
+       struct iwl_lq_sta *lq_sta = file->private_data;
 
        desc += sprintf(buff+desc, "sta_id %d\n", lq_sta->lq.sta_id);
        desc += sprintf(buff+desc, "failed=%d success=%d rate=0%X\n",
@@ -2541,7 +2534,7 @@ static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file,
        int desc = 0;
        int i, j;
 
-       struct iwl4965_lq_sta *lq_sta = file->private_data;
+       struct iwl_lq_sta *lq_sta = file->private_data;
        for (i = 0; i < LQ_SIZE; i++) {
                desc += sprintf(buff+desc, "%s type=%d SGI=%d FAT=%d DUP=%d\n"
                                "rate=0x%X\n",
@@ -2570,7 +2563,7 @@ static const struct file_operations rs_sta_dbgfs_stats_table_ops = {
 static void rs_add_debugfs(void *priv, void *priv_sta,
                                        struct dentry *dir)
 {
-       struct iwl4965_lq_sta *lq_sta = priv_sta;
+       struct iwl_lq_sta *lq_sta = priv_sta;
        lq_sta->rs_sta_dbgfs_scale_table_file =
                debugfs_create_file("rate_scale_table", 0600, dir,
                                lq_sta, &rs_sta_dbgfs_scale_table_ops);
@@ -2585,7 +2578,7 @@ static void rs_add_debugfs(void *priv, void *priv_sta,
 
 static void rs_remove_debugfs(void *priv, void *priv_sta)
 {
-       struct iwl4965_lq_sta *lq_sta = priv_sta;
+       struct iwl_lq_sta *lq_sta = priv_sta;
        debugfs_remove(lq_sta->rs_sta_dbgfs_scale_table_file);
        debugfs_remove(lq_sta->rs_sta_dbgfs_stats_table_file);
        debugfs_remove(lq_sta->rs_sta_dbgfs_tx_agg_tid_en_file);
@@ -2609,104 +2602,12 @@ static struct rate_control_ops rs_ops = {
 #endif
 };
 
-int iwl4965_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
-{
-       struct ieee80211_local *local = hw_to_local(hw);
-       struct iwl_priv *priv = hw->priv;
-       struct iwl4965_lq_sta *lq_sta;
-       struct sta_info *sta;
-       int cnt = 0, i;
-       u32 samples = 0, success = 0, good = 0;
-       unsigned long now = jiffies;
-       u32 max_time = 0;
-       u8 lq_type, antenna;
-
-       rcu_read_lock();
-
-       sta = sta_info_get(local, priv->stations[sta_id].sta.sta.addr);
-       if (!sta || !sta->rate_ctrl_priv) {
-               if (sta)
-                       IWL_DEBUG_RATE("leave - no private rate data!\n");
-               else
-                       IWL_DEBUG_RATE("leave - no station!\n");
-               rcu_read_unlock();
-               return sprintf(buf, "station %d not found\n", sta_id);
-       }
-
-       lq_sta = (void *)sta->rate_ctrl_priv;
-
-       lq_type = lq_sta->lq_info[lq_sta->active_tbl].lq_type;
-       antenna = lq_sta->lq_info[lq_sta->active_tbl].ant_type;
-
-       if (is_legacy(lq_type))
-               i = IWL_RATE_54M_INDEX;
-       else
-               i = IWL_RATE_60M_INDEX;
-       while (1) {
-               u64 mask;
-               int j;
-               int active = lq_sta->active_tbl;
-
-               cnt +=
-                   sprintf(&buf[cnt], " %2dMbs: ", iwl_rates[i].ieee / 2);
-
-               mask = (1ULL << (IWL_RATE_MAX_WINDOW - 1));
-               for (j = 0; j < IWL_RATE_MAX_WINDOW; j++, mask >>= 1)
-                       buf[cnt++] =
-                               (lq_sta->lq_info[active].win[i].data & mask)
-                               ? '1' : '0';
-
-               samples += lq_sta->lq_info[active].win[i].counter;
-               good += lq_sta->lq_info[active].win[i].success_counter;
-               success += lq_sta->lq_info[active].win[i].success_counter *
-                          iwl_rates[i].ieee;
-
-               if (lq_sta->lq_info[active].win[i].stamp) {
-                       int delta =
-                                  jiffies_to_msecs(now -
-                                  lq_sta->lq_info[active].win[i].stamp);
-
-                       if (delta > max_time)
-                               max_time = delta;
-
-                       cnt += sprintf(&buf[cnt], "%5dms\n", delta);
-               } else
-                       buf[cnt++] = '\n';
-
-               j = iwl4965_get_prev_ieee_rate(i);
-               if (j == i)
-                       break;
-               i = j;
-       }
-
-       /*
-        * Display the average rate of all samples taken.
-        * NOTE: We multiply # of samples by 2 since the IEEE measurement
-        * added from iwl_rates is actually 2X the rate.
-        */
-       if (samples)
-               cnt += sprintf(&buf[cnt],
-                        "\nAverage rate is %3d.%02dMbs over last %4dms\n"
-                        "%3d%% success (%d good packets over %d tries)\n",
-                        success / (2 * samples), (success * 5 / samples) % 10,
-                        max_time, good * 100 / samples, good, samples);
-       else
-               cnt += sprintf(&buf[cnt], "\nAverage rate: 0Mbs\n");
-
-       cnt += sprintf(&buf[cnt], "\nrate scale type %d antenna %d "
-                        "active_search %d rate index %d\n", lq_type, antenna,
-                        lq_sta->search_better_tbl, sta->last_txrate_idx);
-
-       rcu_read_unlock();
-       return cnt;
-}
-
-int iwl4965_rate_control_register(void)
+int iwlagn_rate_control_register(void)
 {
        return ieee80211_rate_control_register(&rs_ops);
 }
 
-void iwl4965_rate_control_unregister(void)
+void iwlagn_rate_control_unregister(void)
 {
        ieee80211_rate_control_unregister(&rs_ops);
 }
similarity index 93%
rename from drivers/net/wireless/iwlwifi/iwl-4965-rs.h
rename to drivers/net/wireless/iwlwifi/iwl-agn-rs.h
index 9b99728..84d4d1e 100644 (file)
@@ -24,8 +24,8 @@
  *
  *****************************************************************************/
 
-#ifndef __iwl_4965_rs_h__
-#define __iwl_4965_rs_h__
+#ifndef __iwl_agn_rs_h__
+#define __iwl_agn_rs_h__
 
 #include "iwl-dev.h"
 
@@ -88,7 +88,7 @@ enum {
 #define        IWL_RATE_5M_MASK   (1 << IWL_RATE_5M_INDEX)
 #define        IWL_RATE_11M_MASK  (1 << IWL_RATE_11M_INDEX)
 
-/* 4965 uCode API values for legacy bit rates, both OFDM and CCK */
+/* uCode API values for legacy bit rates, both OFDM and CCK */
 enum {
        IWL_RATE_6M_PLCP  = 13,
        IWL_RATE_9M_PLCP  = 15,
@@ -107,7 +107,7 @@ enum {
        /*FIXME:RS:add IWL_RATE_LEGACY_INVM_PLCP = 0,*/
 };
 
-/* 4965 uCode API values for OFDM high-throughput (HT) bit rates */
+/* uCode API values for OFDM high-throughput (HT) bit rates */
 enum {
        IWL_RATE_SISO_6M_PLCP = 0,
        IWL_RATE_SISO_12M_PLCP = 1,
@@ -286,15 +286,6 @@ static inline u8 iwl4965_get_prev_ieee_rate(u8 rate_index)
        return rate;
 }
 
-/**
- * iwl4965_fill_rs_info - Fill an output text buffer with the rate representation
- *
- * NOTE:  This is provided as a quick mechanism for a user to visualize
- * the performance of the rate control algorithm and is not meant to be
- * parsed software.
- */
-extern int iwl4965_fill_rs_info(struct ieee80211_hw *, char *buf, u8 sta_id);
-
 /**
  * iwl4965_rate_control_register - Register the rate control algorithm callbacks
  *
@@ -305,7 +296,7 @@ extern int iwl4965_fill_rs_info(struct ieee80211_hw *, char *buf, u8 sta_id);
  * ieee80211_register_hw
  *
  */
-extern int iwl4965_rate_control_register(void);
+extern int iwlagn_rate_control_register(void);
 
 /**
  * iwl4965_rate_control_unregister - Unregister the rate control callbacks
@@ -313,6 +304,6 @@ extern int iwl4965_rate_control_register(void);
  * This should be called after calling ieee80211_unregister_hw, but before
  * the driver is unloaded.
  */
-extern void iwl4965_rate_control_unregister(void);
+extern void iwlagn_rate_control_unregister(void);
 
-#endif
+#endif /* __iwl_agn__rs__ */
similarity index 96%
rename from drivers/net/wireless/iwlwifi/iwl4965-base.c
rename to drivers/net/wireless/iwlwifi/iwl-agn.c
index 71f5da3..b8407d5 100644 (file)
@@ -65,7 +65,7 @@
  * NOTE: DRV_NAME is defined in iwlwifi.h for use by iwl-debug.h and printk
  */
 
-#define DRV_DESCRIPTION        "Intel(R) Wireless WiFi Link 4965AGN driver for Linux"
+#define DRV_DESCRIPTION        "Intel(R) Wireless WiFi Link AGN driver for Linux"
 
 #ifdef CONFIG_IWLWIFI_DEBUG
 #define VD "d"
@@ -73,7 +73,7 @@
 #define VD
 #endif
 
-#ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT
+#ifdef CONFIG_IWLAGN_SPECTRUM_MEASUREMENT
 #define VS "s"
 #else
 #define VS
@@ -86,6 +86,7 @@ MODULE_DESCRIPTION(DRV_DESCRIPTION);
 MODULE_VERSION(DRV_VERSION);
 MODULE_AUTHOR(DRV_COPYRIGHT);
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("iwl4965");
 
 /*************** STATION TABLE MANAGEMENT ****
  * mac80211 should be examined to determine if sta_info is duplicating
@@ -444,11 +445,10 @@ static void iwl_free_frame(struct iwl_priv *priv, struct iwl_frame *frame)
        list_add(&frame->list, &priv->free_frames);
 }
 
-unsigned int iwl4965_fill_beacon_frame(struct iwl_priv *priv,
-                               struct ieee80211_hdr *hdr,
-                               const u8 *dest, int left)
+static unsigned int iwl_fill_beacon_frame(struct iwl_priv *priv,
+                                         struct ieee80211_hdr *hdr,
+                                         const u8 *dest, int left)
 {
-
        if (!iwl_is_associated(priv) || !priv->ibss_beacon ||
            ((priv->iw_mode != IEEE80211_IF_TYPE_IBSS) &&
             (priv->iw_mode != IEEE80211_IF_TYPE_AP)))
@@ -487,6 +487,38 @@ static u8 iwl4965_rate_get_lowest_plcp(struct iwl_priv *priv)
                return IWL_RATE_6M_PLCP;
 }
 
+unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv,
+                                      struct iwl_frame *frame, u8 rate)
+{
+       struct iwl_tx_beacon_cmd *tx_beacon_cmd;
+       unsigned int frame_size;
+
+       tx_beacon_cmd = &frame->u.beacon;
+       memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd));
+
+       tx_beacon_cmd->tx.sta_id = priv->hw_params.bcast_sta_id;
+       tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
+
+       frame_size = iwl_fill_beacon_frame(priv, tx_beacon_cmd->frame,
+                               iwl_bcast_addr,
+                               sizeof(frame->u) - sizeof(*tx_beacon_cmd));
+
+       BUG_ON(frame_size > MAX_MPDU_SIZE);
+       tx_beacon_cmd->tx.len = cpu_to_le16((u16)frame_size);
+
+       if ((rate == IWL_RATE_1M_PLCP) || (rate >= IWL_RATE_2M_PLCP))
+               tx_beacon_cmd->tx.rate_n_flags =
+                       iwl_hw_set_rate_n_flags(rate, RATE_MCS_CCK_MSK);
+       else
+               tx_beacon_cmd->tx.rate_n_flags =
+                       iwl_hw_set_rate_n_flags(rate, 0);
+
+       tx_beacon_cmd->tx.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK |
+                                    TX_CMD_FLG_TSF_MSK |
+                                    TX_CMD_FLG_STA_RATE_MSK;
+
+       return sizeof(*tx_beacon_cmd) + frame_size;
+}
 static int iwl4965_send_beacon_cmd(struct iwl_priv *priv)
 {
        struct iwl_frame *frame;
@@ -608,7 +640,6 @@ static void iwl_activate_qos(struct iwl_priv *priv, u8 force)
 }
 
 #define MAX_UCODE_BEACON_INTERVAL      4096
-#define INTEL_CONN_LISTEN_INTERVAL     __constant_cpu_to_le16(0xA)
 
 static __le16 iwl4965_adjust_beacon_interval(u16 beacon_val)
 {
@@ -638,7 +669,7 @@ static void iwl4965_setup_rxon_timing(struct iwl_priv *priv)
        priv->rxon_timing.timestamp.dw[0] =
                                cpu_to_le32(priv->timestamp & 0xFFFFFFFF);
 
-       priv->rxon_timing.listen_interval = INTEL_CONN_LISTEN_INTERVAL;
+       priv->rxon_timing.listen_interval = cpu_to_le16(conf->listen_interval);
 
        tsf = priv->timestamp;
 
@@ -853,7 +884,7 @@ static void iwl4965_set_rate(struct iwl_priv *priv)
                   (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF;
 }
 
-#ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT
+#ifdef CONFIG_IWLAGN_SPECTRUM_MEASUREMENT
 
 #include "iwl-spectrum.h"
 
@@ -1057,7 +1088,7 @@ static void iwl4965_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
 static void iwl4965_rx_spectrum_measure_notif(struct iwl_priv *priv,
                                          struct iwl_rx_mem_buffer *rxb)
 {
-#ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT
+#ifdef CONFIG_IWLAGN_SPECTRUM_MEASUREMENT
        struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
        struct iwl4965_spectrum_notification *report = &(pkt->u.spectrum_notif);
 
@@ -1231,6 +1262,37 @@ static void iwl4965_rx_card_state_notif(struct iwl_priv *priv,
                wake_up_interruptible(&priv->wait_command_queue);
 }
 
+int iwl4965_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src)
+{
+       int ret;
+       unsigned long flags;
+
+       spin_lock_irqsave(&priv->lock, flags);
+       ret = iwl_grab_nic_access(priv);
+       if (ret)
+               goto err;
+
+       if (src == IWL_PWR_SRC_VAUX) {
+               u32 val;
+               ret = pci_read_config_dword(priv->pci_dev, PCI_POWER_SOURCE,
+                                           &val);
+
+               if (val & PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT)
+                       iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
+                                              APMG_PS_CTRL_VAL_PWR_SRC_VAUX,
+                                              ~APMG_PS_CTRL_MSK_PWR_SRC);
+       } else {
+               iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
+                                      APMG_PS_CTRL_VAL_PWR_SRC_VMAIN,
+                                      ~APMG_PS_CTRL_MSK_PWR_SRC);
+       }
+
+       iwl_release_nic_access(priv);
+err:
+       spin_unlock_irqrestore(&priv->lock, flags);
+       return ret;
+}
+
 /**
  * iwl4965_setup_rx_handlers - Initialize Rx handler callbacks
  *
@@ -2170,17 +2232,16 @@ static int __iwl4965_up(struct iwl_priv *priv)
        }
 
        /* If platform's RF_KILL switch is NOT set to KILL */
-       if (iwl_read32(priv, CSR_GP_CNTRL) &
-                               CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)
+       if (iwl_read32(priv, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)
                clear_bit(STATUS_RF_KILL_HW, &priv->status);
        else
                set_bit(STATUS_RF_KILL_HW, &priv->status);
 
-       if (!test_bit(STATUS_IN_SUSPEND, &priv->status) &&
-           iwl_is_rfkill(priv)) {
+       if (iwl_is_rfkill(priv)) {
+               iwl4965_enable_interrupts(priv);
                IWL_WARNING("Radio disabled by %s RF Kill switch\n",
                    test_bit(STATUS_RF_KILL_HW, &priv->status) ? "HW" : "SW");
-               return -ENODEV;
+               return 0;
        }
 
        iwl_write32(priv, CSR_INT, 0xFFFFFFFF);
@@ -2216,11 +2277,6 @@ static int __iwl4965_up(struct iwl_priv *priv)
        memcpy(priv->ucode_data_backup.v_addr, priv->ucode_data.v_addr,
               priv->ucode_data.len);
 
-       /* We return success when we resume from suspend and rf_kill is on. */
-       if (test_bit(STATUS_RF_KILL_HW, &priv->status) ||
-           test_bit(STATUS_RF_KILL_SW, &priv->status))
-               return 0;
-
        for (i = 0; i < MAX_HW_RESTARTS; i++) {
 
                iwl_clear_stations_table(priv);
@@ -2415,7 +2471,7 @@ static void iwl4965_post_associate(struct iwl_priv *priv)
        unsigned long flags;
 
        if (priv->iw_mode == IEEE80211_IF_TYPE_AP) {
-               IWL_ERROR("%s Should not be called in AP mode\n", __FUNCTION__);
+               IWL_ERROR("%s Should not be called in AP mode\n", __func__);
                return;
        }
 
@@ -2491,7 +2547,7 @@ static void iwl4965_post_associate(struct iwl_priv *priv)
 
        default:
                IWL_ERROR("%s Should not be called in %d mode\n",
-                               __FUNCTION__, priv->iw_mode);
+                         __func__, priv->iw_mode);
                break;
        }
 
@@ -2589,6 +2645,9 @@ static int iwl4965_mac_start(struct ieee80211_hw *hw)
        if (ret)
                goto out_release_irq;
 
+       if (iwl_is_rfkill(priv))
+               goto out;
+
        IWL_DEBUG_INFO("Start UP work done.\n");
 
        if (test_bit(STATUS_IN_SUSPEND, &priv->status))
@@ -2608,6 +2667,7 @@ static int iwl4965_mac_start(struct ieee80211_hw *hw)
                }
        }
 
+out:
        priv->is_open = 1;
        IWL_DEBUG_MAC80211("leave\n");
        return 0;
@@ -2773,6 +2833,7 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co
 
        spin_lock_irqsave(&priv->lock, flags);
 
+
        /* if we are switching from ht to 2.4 clear flags
         * from any ht related info since 2.4 does not
         * support ht */
@@ -3102,6 +3163,7 @@ static void iwl4965_bss_info_changed(struct ieee80211_hw *hw,
                if (bss_conf->assoc) {
                        priv->assoc_id = bss_conf->aid;
                        priv->beacon_int = bss_conf->beacon_int;
+                       priv->power_data.dtim_period = bss_conf->dtim_period;
                        priv->timestamp = bss_conf->timestamp;
                        priv->assoc_capability = bss_conf->assoc_capability;
                        priv->next_scan_jiffies = jiffies +
@@ -3345,6 +3407,39 @@ static int iwl4965_mac_conf_tx(struct ieee80211_hw *hw, u16 queue,
        return 0;
 }
 
+static int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw,
+                            enum ieee80211_ampdu_mlme_action action,
+                            const u8 *addr, u16 tid, u16 *ssn)
+{
+       struct iwl_priv *priv = hw->priv;
+       DECLARE_MAC_BUF(mac);
+
+       IWL_DEBUG_HT("A-MPDU action on addr %s tid %d\n",
+                    print_mac(mac, addr), tid);
+
+       if (!(priv->cfg->sku & IWL_SKU_N))
+               return -EACCES;
+
+       switch (action) {
+       case IEEE80211_AMPDU_RX_START:
+               IWL_DEBUG_HT("start Rx\n");
+               return iwl_rx_agg_start(priv, addr, tid, *ssn);
+       case IEEE80211_AMPDU_RX_STOP:
+               IWL_DEBUG_HT("stop Rx\n");
+               return iwl_rx_agg_stop(priv, addr, tid);
+       case IEEE80211_AMPDU_TX_START:
+               IWL_DEBUG_HT("start Tx\n");
+               return iwl_tx_agg_start(priv, addr, tid, ssn);
+       case IEEE80211_AMPDU_TX_STOP:
+               IWL_DEBUG_HT("stop Tx\n");
+               return iwl_tx_agg_stop(priv, addr, tid);
+       default:
+               IWL_DEBUG_HT("unknown\n");
+               return -EINVAL;
+               break;
+       }
+       return 0;
+}
 static int iwl4965_mac_get_tx_stats(struct ieee80211_hw *hw,
                                struct ieee80211_tx_queue_stats *stats)
 {
@@ -3592,15 +3687,6 @@ static ssize_t show_temperature(struct device *d,
 
 static DEVICE_ATTR(temperature, S_IRUGO, show_temperature, NULL);
 
-static ssize_t show_rs_window(struct device *d,
-                             struct device_attribute *attr,
-                             char *buf)
-{
-       struct iwl_priv *priv = d->driver_data;
-       return iwl4965_fill_rs_info(priv->hw, buf, IWL_AP_ID);
-}
-static DEVICE_ATTR(rs_window, S_IRUGO, show_rs_window, NULL);
-
 static ssize_t show_tx_power(struct device *d,
                             struct device_attribute *attr, char *buf)
 {
@@ -3699,7 +3785,7 @@ static ssize_t store_filter_flags(struct device *d,
 static DEVICE_ATTR(filter_flags, S_IWUSR | S_IRUGO, show_filter_flags,
                   store_filter_flags);
 
-#ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT
+#ifdef CONFIG_IWLAGN_SPECTRUM_MEASUREMENT
 
 static ssize_t show_measurement(struct device *d,
                                struct device_attribute *attr, char *buf)
@@ -3707,7 +3793,7 @@ static ssize_t show_measurement(struct device *d,
        struct iwl_priv *priv = dev_get_drvdata(d);
        struct iwl4965_spectrum_notification measure_report;
        u32 size = sizeof(measure_report), len = 0, ofs = 0;
-       u8 *data = (u8 *) & measure_report;
+       u8 *data = (u8 *)&measure_report;
        unsigned long flags;
 
        spin_lock_irqsave(&priv->lock, flags);
@@ -3770,7 +3856,7 @@ static ssize_t store_measurement(struct device *d,
 
 static DEVICE_ATTR(measurement, S_IRUSR | S_IWUSR,
                   show_measurement, store_measurement);
-#endif /* CONFIG_IWL4965_SPECTRUM_MEASUREMENT */
+#endif /* CONFIG_IWLAGN_SPECTRUM_MEASUREMENT */
 
 static ssize_t store_retry_rate(struct device *d,
                                struct device_attribute *attr,
@@ -3800,77 +3886,54 @@ static ssize_t store_power_level(struct device *d,
                                 const char *buf, size_t count)
 {
        struct iwl_priv *priv = dev_get_drvdata(d);
-       int rc;
+       int ret;
        int mode;
 
        mode = simple_strtoul(buf, NULL, 0);
        mutex_lock(&priv->mutex);
 
        if (!iwl_is_ready(priv)) {
-               rc = -EAGAIN;
+               ret = -EAGAIN;
                goto out;
        }
 
-       rc = iwl_power_set_user_mode(priv, mode);
-       if (rc) {
+       ret = iwl_power_set_user_mode(priv, mode);
+       if (ret) {
                IWL_DEBUG_MAC80211("failed setting power mode.\n");
                goto out;
        }
-       rc = count;
+       ret = count;
 
  out:
        mutex_unlock(&priv->mutex);
-       return rc;
+       return ret;
 }
 
-#define MAX_WX_STRING 80
-
-/* Values are in microsecond */
-static const s32 timeout_duration[] = {
-       350000,
-       250000,
-       75000,
-       37000,
-       25000,
-};
-static const s32 period_duration[] = {
-       400000,
-       700000,
-       1000000,
-       1000000,
-       1000000
-};
-
 static ssize_t show_power_level(struct device *d,
                                struct device_attribute *attr, char *buf)
 {
        struct iwl_priv *priv = dev_get_drvdata(d);
+       int mode = priv->power_data.user_power_setting;
+       int system = priv->power_data.system_power_setting;
        int level = priv->power_data.power_mode;
        char *p = buf;
 
-       p += sprintf(p, "%d ", level);
-       switch (level) {
-       case IWL_POWER_MODE_CAM:
-       case IWL_POWER_AC:
-               p += sprintf(p, "(AC)");
+       switch (system) {
+       case IWL_POWER_SYS_AUTO:
+               p += sprintf(p, "SYSTEM:auto");
                break;
-       case IWL_POWER_BATTERY:
-               p += sprintf(p, "(BATTERY)");
+       case IWL_POWER_SYS_AC:
+               p += sprintf(p, "SYSTEM:ac");
+               break;
+       case IWL_POWER_SYS_BATTERY:
+               p += sprintf(p, "SYSTEM:battery");
                break;
-       default:
-               p += sprintf(p,
-                            "(Timeout %dms, Period %dms)",
-                            timeout_duration[level - 1] / 1000,
-                            period_duration[level - 1] / 1000);
        }
-/*
-       if (!(priv->power_mode & IWL_POWER_ENABLED))
-               p += sprintf(p, " OFF\n");
-       else
-               p += sprintf(p, " \n");
-*/
-       p += sprintf(p, " \n");
-       return (p - buf + 1);
+
+       p += sprintf(p, "\tMODE:%s", (mode < IWL_POWER_AUTO)?"fixed":"auto");
+       p += sprintf(p, "\tINDEX:%d", level);
+       p += sprintf(p, "\n");
+       return p - buf + 1;
 }
 
 static DEVICE_ATTR(power_level, S_IWUSR | S_IRUSR, show_power_level,
@@ -3945,7 +4008,7 @@ static ssize_t show_statistics(struct device *d,
        struct iwl_priv *priv = dev_get_drvdata(d);
        u32 size = sizeof(struct iwl_notif_statistics);
        u32 len = 0, ofs = 0;
-       u8 *data = (u8 *) & priv->statistics;
+       u8 *data = (u8 *)&priv->statistics;
        int rc = 0;
 
        if (!iwl_is_alive(priv))
@@ -4041,12 +4104,11 @@ static struct attribute *iwl4965_sysfs_entries[] = {
        &dev_attr_channels.attr,
        &dev_attr_flags.attr,
        &dev_attr_filter_flags.attr,
-#ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT
+#ifdef CONFIG_IWLAGN_SPECTRUM_MEASUREMENT
        &dev_attr_measurement.attr,
 #endif
        &dev_attr_power_level.attr,
        &dev_attr_retry_rate.attr,
-       &dev_attr_rs_window.attr,
        &dev_attr_statistics.attr,
        &dev_attr_status.attr,
        &dev_attr_temperature.attr,
@@ -4394,8 +4456,10 @@ static int iwl4965_pci_resume(struct pci_dev *pdev)
 
 /* Hardware specific file defines the PCI IDs table for that hardware module */
 static struct pci_device_id iwl_hw_card_ids[] = {
+#ifdef CONFIG_IWL4965
        {IWL_PCI_DEVICE(0x4229, PCI_ANY_ID, iwl4965_agn_cfg)},
        {IWL_PCI_DEVICE(0x4230, PCI_ANY_ID, iwl4965_agn_cfg)},
+#endif /* CONFIG_IWL4965 */
 #ifdef CONFIG_IWL5000
        {IWL_PCI_DEVICE(0x4232, 0x1205, iwl5100_bg_cfg)},
        {IWL_PCI_DEVICE(0x4232, 0x1305, iwl5100_bg_cfg)},
@@ -4431,7 +4495,7 @@ static int __init iwl4965_init(void)
        printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION ", " DRV_VERSION "\n");
        printk(KERN_INFO DRV_NAME ": " DRV_COPYRIGHT "\n");
 
-       ret = iwl4965_rate_control_register();
+       ret = iwlagn_rate_control_register();
        if (ret) {
                IWL_ERROR("Unable to register rate control algorithm: %d\n", ret);
                return ret;
@@ -4446,14 +4510,14 @@ static int __init iwl4965_init(void)
        return ret;
 
 error_register:
-       iwl4965_rate_control_unregister();
+       iwlagn_rate_control_unregister();
        return ret;
 }
 
 static void __exit iwl4965_exit(void)
 {
        pci_unregister_driver(&iwl_driver);
-       iwl4965_rate_control_unregister();
+       iwlagn_rate_control_unregister();
 }
 
 module_exit(iwl4965_exit);
index e9bb1de..28b5b09 100644 (file)
@@ -666,8 +666,7 @@ struct iwl4965_rxon_assoc_cmd {
        __le16 reserved;
 } __attribute__ ((packed));
 
-
-
+#define IWL_CONN_MAX_LISTEN_INTERVAL   10
 
 /*
  * REPLY_RXON_TIMING = 0x14 (command, has simple generic response)
@@ -1076,10 +1075,12 @@ struct iwl4965_rx_frame {
 } __attribute__ ((packed));
 
 /* Fixed (non-configurable) rx data from phy */
-#define RX_PHY_FLAGS_ANTENNAE_OFFSET           (4)
-#define RX_PHY_FLAGS_ANTENNAE_MASK             (0x70)
-#define IWL_AGC_DB_MASK        (0x3f80)        /* MASK(7,13) */
-#define IWL_AGC_DB_POS         (7)
+
+#define IWL49_RX_RES_PHY_CNT 14
+#define IWL49_RX_PHY_FLAGS_ANTENNAE_OFFSET     (4)
+#define IWL49_RX_PHY_FLAGS_ANTENNAE_MASK       (0x70)
+#define IWL49_AGC_DB_MASK                      (0x3f80)        /* MASK(7,13) */
+#define IWL49_AGC_DB_POS                       (7)
 struct iwl4965_rx_non_cfg_phy {
        __le16 ant_selection;   /* ant A bit 4, ant B bit 5, ant C bit 6 */
        __le16 agc_info;        /* agc code 0:6, agc dB 7:13, reserved 14:15 */
@@ -1087,12 +1088,30 @@ struct iwl4965_rx_non_cfg_phy {
        u8 pad[0];
 } __attribute__ ((packed));
 
+
+#define IWL50_RX_RES_PHY_CNT 8
+#define IWL50_RX_RES_AGC_IDX     1
+#define IWL50_RX_RES_RSSI_AB_IDX 2
+#define IWL50_RX_RES_RSSI_C_IDX  3
+#define IWL50_OFDM_AGC_MSK 0xfe00
+#define IWL50_OFDM_AGC_BIT_POS 9
+#define IWL50_OFDM_RSSI_A_MSK 0x00ff
+#define IWL50_OFDM_RSSI_A_BIT_POS 0
+#define IWL50_OFDM_RSSI_B_MSK 0xff0000
+#define IWL50_OFDM_RSSI_B_BIT_POS 16
+#define IWL50_OFDM_RSSI_C_MSK 0x00ff
+#define IWL50_OFDM_RSSI_C_BIT_POS 0
+
+struct iwl5000_non_cfg_phy {
+       __le32 non_cfg_phy[IWL50_RX_RES_PHY_CNT];  /* upto 8 phy entries */
+} __attribute__ ((packed));
+
+
 /*
  * REPLY_RX = 0xc3 (response only, not a command)
  * Used only for legacy (non 11n) frames.
  */
-#define RX_RES_PHY_CNT 14
-struct iwl4965_rx_phy_res {
+struct iwl_rx_phy_res {
        u8 non_cfg_phy_cnt;     /* non configurable DSP phy data byte count */
        u8 cfg_phy_cnt;         /* configurable DSP phy data byte count */
        u8 stat_id;             /* configurable DSP phy data set ID */
@@ -1101,8 +1120,7 @@ struct iwl4965_rx_phy_res {
        __le32 beacon_time_stamp; /* beacon at on-air rise */
        __le16 phy_flags;       /* general phy flags: band, modulation, ... */
        __le16 channel;         /* channel number */
-       __le16 non_cfg_phy[RX_RES_PHY_CNT];     /* upto 14 phy entries */
-       __le32 reserved2;
+       u8 non_cfg_phy_buf[32]; /* for various implementations of non_cfg_phy */
        __le32 rate_n_flags;    /* RATE_MCS_* */
        __le16 byte_count;      /* frame's byte-count */
        __le16 reserved3;
@@ -1993,7 +2011,7 @@ struct iwl4965_spectrum_notification {
  *****************************************************************************/
 
 /**
- * struct iwl4965_powertable_cmd - Power Table Command
+ * struct iwl_powertable_cmd - Power Table Command
  * @flags: See below:
  *
  * POWER_TABLE_CMD = 0x77 (command, has simple generic response)
@@ -2027,7 +2045,7 @@ struct iwl4965_spectrum_notification {
 #define IWL_POWER_PCI_PM_MSK                   __constant_cpu_to_le16(1 << 3)
 #define IWL_POWER_FAST_PD                      __constant_cpu_to_le16(1 << 4)
 
-struct iwl4965_powertable_cmd {
+struct iwl_powertable_cmd {
        __le16 flags;
        u8 keep_alive_seconds;
        u8 debug_flags;
@@ -2324,7 +2342,7 @@ struct iwl4965_beacon_notif {
 /*
  * REPLY_TX_BEACON = 0x91 (command, has simple generic response)
  */
-struct iwl4965_tx_beacon_cmd {
+struct iwl_tx_beacon_cmd {
        struct iwl_tx_cmd tx;
        __le16 tim_idx;
        u8 tim_size;
index a44188b..9bd6180 100644 (file)
@@ -383,8 +383,8 @@ void iwl_reset_qos(struct iwl_priv *priv)
 }
 EXPORT_SYMBOL(iwl_reset_qos);
 
-#define MAX_BIT_RATE_40_MHZ 0x96; /* 150 Mbps */
-#define MAX_BIT_RATE_20_MHZ 0x48; /* 72 Mbps */
+#define MAX_BIT_RATE_40_MHZ 0x96 /* 150 Mbps */
+#define MAX_BIT_RATE_20_MHZ 0x48 /* 72 Mbps */
 static void iwlcore_init_ht_hw_capab(const struct iwl_priv *priv,
                              struct ieee80211_ht_info *ht_info,
                              enum ieee80211_band band)
@@ -815,11 +815,10 @@ int iwl_setup_mac(struct iwl_priv *priv)
 {
        int ret;
        struct ieee80211_hw *hw = priv->hw;
-       hw->rate_control_algorithm = "iwl-4965-rs";
+       hw->rate_control_algorithm = "iwl-agn-rs";
 
        /* Tell mac80211 our characteristics */
-       hw->flags = IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE |
-                   IEEE80211_HW_SIGNAL_DBM |
+       hw->flags = IEEE80211_HW_SIGNAL_DBM |
                    IEEE80211_HW_NOISE_DBM;
        /* Default value; 4 EDCA QOS priorities */
        hw->queues = 4;
@@ -828,6 +827,7 @@ int iwl_setup_mac(struct iwl_priv *priv)
                hw->ampdu_queues = priv->cfg->mod_params->num_of_ampdu_queues;
 
        hw->conf.beacon_int = 100;
+       hw->max_listen_interval = IWL_CONN_MAX_LISTEN_INTERVAL;
 
        if (priv->bands[IEEE80211_BAND_2GHZ].n_channels)
                priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
index db66114..64f139e 100644 (file)
@@ -95,6 +95,8 @@ struct iwl_hcmd_utils_ops {
        void (*chain_noise_reset)(struct iwl_priv *priv);
        void (*rts_tx_cmd_flag)(struct ieee80211_tx_info *info,
                        __le32 *tx_flags);
+       int  (*calc_rssi)(struct iwl_priv *priv,
+                         struct iwl_rx_phy_res *rx_resp);
 };
 
 struct iwl_lib_ops {
@@ -139,7 +141,6 @@ struct iwl_lib_ops {
                int (*set_pwr_src)(struct iwl_priv *priv, enum iwl_pwr_src src);
        } apm_ops;
        /* power */
-       int (*set_power)(struct iwl_priv *priv, void *cmd);
        int (*send_tx_power) (struct iwl_priv *priv);
        void (*update_chain_flags)(struct iwl_priv *priv);
        void (*temperature) (struct iwl_priv *priv);
index 545ed69..52629fb 100644 (file)
  *  3-2:  0 = A, 1 = B, 2 = C, 3 = D step
  */
 #define CSR_HW_REV_WA_REG      (CSR_BASE+0x22C)
+#define CSR_DBG_HPET_MEM_REG   (CSR_BASE+0x240)
 
 /* Bits for CSR_HW_IF_CONFIG_REG */
 #define CSR49_HW_IF_CONFIG_REG_BIT_4965_R      (0x00000010)
 #define CSR39_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_A    (0x00000000)
 #define CSR39_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_B    (0x00001000)
 
-#define CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM     (0x00200000)
+#define CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A          (0x00080000)
+#define CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM                (0x00200000)
+#define CSR_HW_IF_CONFIG_REG_BIT_PCI_OWN_SEM           (0x00400000)
+#define CSR_HW_IF_CONFIG_REG_BIT_ME_OWN                        (0x02000000)
+#define CSR_HW_IF_CONFIG_REG_BIT_WAKE_ME               (0x08000000)
+
 
 /* interrupt flags in INTA, set by uCode or hardware (e.g. dma),
  * acknowledged (reset) by host writing "1" to flagged bits. */
 #define CSR39_ANA_PLL_CFG_VAL        (0x01000000)
 #define CSR50_ANA_PLL_CFG_VAL        (0x00880300)
 
+/* HPET MEM debug */
+#define CSR_DBG_HPET_MEM_REG_VAL       (0xFFFF0000)
 /*=== HBUS (Host-side Bus) ===*/
 #define HBUS_BASE      (0x400)
 /*
index 5838480..b4ffd33 100644 (file)
 #define IWL_DEBUG(level, fmt, args...) \
 do { if (priv->debug_level & (level)) \
   dev_printk(KERN_ERR, &(priv->hw->wiphy->dev), "%c %s " fmt, \
-        in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0)
+        in_interrupt() ? 'I' : 'U', __func__ , ## args); } while (0)
 
 #define IWL_DEBUG_LIMIT(level, fmt, args...) \
 do { if ((priv->debug_level & (level)) && net_ratelimit()) \
   dev_printk(KERN_ERR, &(priv->hw->wiphy->dev), "%c %s " fmt, \
-        in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0)
+        in_interrupt() ? 'I' : 'U', __func__ , ## args); } while (0)
 
 #ifdef CONFIG_IWLWIFI_DEBUGFS
 struct iwl_debugfs {
@@ -68,12 +68,8 @@ void iwl_dbgfs_unregister(struct iwl_priv *priv);
 #endif
 
 #else
-static inline void IWL_DEBUG(int level, const char *fmt, ...)
-{
-}
-static inline void IWL_DEBUG_LIMIT(int level, const char *fmt, ...)
-{
-}
+#define IWL_DEBUG(level, fmt, args...)
+#define IWL_DEBUG_LIMIT(level, fmt, args...)
 #endif                         /* CONFIG_IWLWIFI_DEBUG */
 
 
index ed948dc..20db0eb 100644 (file)
@@ -231,7 +231,7 @@ static ssize_t iwl_dbgfs_stations_read(struct file *file, char __user *user_buf,
        DECLARE_MAC_BUF(mac);
 
        buf = kmalloc(bufsz, GFP_KERNEL);
-       if(!buf)
+       if (!buf)
                return -ENOMEM;
 
        pos += scnprintf(buf + pos, bufsz - pos, "num of stations: %d\n\n",
@@ -364,16 +364,19 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
 {
        struct iwl_debugfs *dbgfs;
        struct dentry *phyd = priv->hw->wiphy->debugfsdir;
+       int ret = 0;
 
        dbgfs = kzalloc(sizeof(struct iwl_debugfs), GFP_KERNEL);
        if (!dbgfs) {
+               ret = -ENOMEM;
                goto err;
        }
 
        priv->dbgfs = dbgfs;
        dbgfs->name = name;
        dbgfs->dir_drv = debugfs_create_dir(name, phyd);
-       if (!dbgfs->dir_drv || IS_ERR(dbgfs->dir_drv)){
+       if (!dbgfs->dir_drv || IS_ERR(dbgfs->dir_drv)) {
+               ret = -ENOENT;
                goto err;
        }
 
@@ -394,7 +397,7 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
 err:
        IWL_ERROR("Can't open the debugfs directory\n");
        iwl_dbgfs_unregister(priv);
-       return -ENOENT;
+       return ret;
 }
 EXPORT_SYMBOL(iwl_dbgfs_register);
 
@@ -404,7 +407,7 @@ EXPORT_SYMBOL(iwl_dbgfs_register);
  */
 void iwl_dbgfs_unregister(struct iwl_priv *priv)
 {
-       if (!(priv->dbgfs))
+       if (!priv->dbgfs)
                return;
 
        DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_eeprom);
index 4d789e3..c19db43 100644 (file)
@@ -36,7 +36,7 @@
 #include <linux/kernel.h>
 #include <net/ieee80211_radiotap.h>
 
-#define DRV_NAME        "iwl4965"
+#define DRV_NAME        "iwlagn"
 #include "iwl-rfkill.h"
 #include "iwl-eeprom.h"
 #include "iwl-4965-hw.h"
@@ -45,6 +45,7 @@
 #include "iwl-debug.h"
 #include "iwl-led.h"
 #include "iwl-power.h"
+#include "iwl-agn-rs.h"
 
 /* configuration for the iwl4965 */
 extern struct iwl_cfg iwl4965_agn_cfg;
@@ -134,8 +135,7 @@ struct iwl_tx_info {
 struct iwl_tx_queue {
        struct iwl_queue q;
        struct iwl_tfd_frame *bd;
-       struct iwl_cmd *cmd;
-       dma_addr_t dma_addr_cmd;
+       struct iwl_cmd *cmd[TFD_TX_CMD_SLOTS];
        struct iwl_tx_info *txb;
        int need_update;
        int sched_retry;
@@ -191,7 +191,6 @@ struct iwl4965_clip_group {
        const s8 clip_powers[IWL_MAX_RATES];
 };
 
-#include "iwl-4965-rs.h"
 
 #define IWL_TX_FIFO_AC0        0
 #define IWL_TX_FIFO_AC1        1
@@ -219,7 +218,7 @@ enum iwl_pwr_src {
 struct iwl_frame {
        union {
                struct ieee80211_hdr frame;
-               struct iwl4965_tx_beacon_cmd beacon;
+               struct iwl_tx_beacon_cmd beacon;
                u8 raw[IEEE80211_FRAME_LEN];
                u8 cmd[360];
        } u;
@@ -283,10 +282,9 @@ struct iwl_cmd {
                u32 val32;
                struct iwl4965_bt_cmd bt;
                struct iwl4965_rxon_time_cmd rxon_time;
-               struct iwl4965_powertable_cmd powertable;
+               struct iwl_powertable_cmd powertable;
                struct iwl_qosparam_cmd qosparam;
                struct iwl_tx_cmd tx;
-               struct iwl4965_tx_beacon_cmd tx_beacon;
                struct iwl4965_rxon_assoc_cmd rxon_assoc;
                struct iwl_rem_sta_cmd rm_sta;
                u8 *indirect;
@@ -590,6 +588,7 @@ extern unsigned int iwl4965_fill_beacon_frame(struct iwl_priv *priv,
                                        const u8 *dest, int left);
 extern void iwl4965_update_chain_flags(struct iwl_priv *priv);
 int iwl4965_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src);
+extern int iwl4965_set_power(struct iwl_priv *priv, void *cmd);
 
 extern const u8 iwl_bcast_addr[ETH_ALEN];
 
@@ -642,10 +641,6 @@ struct iwl_priv;
  * Forward declare iwl-4965.c functions for iwl-base.c
  */
 extern void iwl4965_rf_kill_ct_config(struct iwl_priv *priv);
-
-int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw,
-                                   enum ieee80211_ampdu_mlme_action action,
-                                   const u8 *addr, u16 tid, u16 *ssn);
 int iwl4965_check_empty_hw_queue(struct iwl_priv *priv, int sta_id,
                                        u8 tid, int txq_id);
 
@@ -812,14 +807,11 @@ struct iwl_chain_noise_data {
 #define EEPROM_SEM_RETRY_LIMIT 1000    /* number of attempts (not time) */
 
 
-#ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT
-
 enum {
        MEASUREMENT_READY = (1 << 0),
        MEASUREMENT_ACTIVE = (1 << 1),
 };
 
-#endif
 
 #define IWL_MAX_NUM_QUEUES     20 /* FIXME: do dynamic allocation */
 
@@ -844,7 +836,7 @@ struct iwl_priv {
 
        struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];
 
-#ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT
+#ifdef CONFIG_IWLAGN_SPECTRUM_MEASUREMENT
        /* spectrum measurement report caching */
        struct iwl4965_spectrum_notification measure_report;
        u8 measurement_status;
index 4a08a1b..bce5383 100644 (file)
@@ -273,8 +273,7 @@ EXPORT_SYMBOL(iwl_eeprom_init);
 
 void iwl_eeprom_free(struct iwl_priv *priv)
 {
-       if(priv->eeprom)
-               kfree(priv->eeprom);
+       kfree(priv->eeprom);
        priv->eeprom = NULL;
 }
 EXPORT_SYMBOL(iwl_eeprom_free);
index 8fa991b..6512834 100644 (file)
@@ -228,7 +228,7 @@ cancel:
                 * TX cmd queue. Otherwise in case the cmd comes
                 * in later, it will possibly set an invalid
                 * address (cmd->meta.source). */
-               qcmd = &priv->txq[IWL_CMD_QUEUE_NUM].cmd[cmd_idx];
+               qcmd = priv->txq[IWL_CMD_QUEUE_NUM].cmd[cmd_idx];
                qcmd->meta.flags &= ~CMD_WANT_SKB;
        }
 fail:
index 899d7a2..cb11c4a 100644 (file)
@@ -161,11 +161,31 @@ int iwl4965_led_off(struct iwl_priv *priv, int led_id)
 /* Set led register off */
 static int iwl4965_led_off_reg(struct iwl_priv *priv, int led_id)
 {
-       IWL_DEBUG_LED("radio off\n");
+       IWL_DEBUG_LED("LED Reg off\n");
        iwl_write32(priv, CSR_LED_REG, CSR_LED_REG_TRUN_OFF);
        return 0;
 }
 
+/*
+ * Set led register in case of disassociation according to rfkill state
+ */
+static int iwl_led_associate(struct iwl_priv *priv, int led_id)
+{
+       IWL_DEBUG_LED("Associated\n");
+       priv->allow_blinking = 1;
+       return iwl4965_led_on_reg(priv, led_id);
+}
+static int iwl_led_disassociate(struct iwl_priv *priv, int led_id)
+{
+       priv->allow_blinking = 0;
+       if (iwl_is_rfkill(priv))
+               iwl4965_led_off_reg(priv, led_id);
+       else
+               iwl4965_led_on_reg(priv, led_id);
+
+       return 0;
+}
+
 /*
  * brightness call back function for Tx/Rx LED
  */
@@ -199,16 +219,10 @@ static void iwl_led_brightness_set(struct led_classdev *led_cdev,
                        led_type_str[led->type], brightness);
        switch (brightness) {
        case LED_FULL:
-               if (led->type == IWL_LED_TRG_ASSOC)
-                       priv->allow_blinking = 1;
-
                if (led->led_on)
                        led->led_on(priv, IWL_LED_LINK);
                break;
        case LED_OFF:
-               if (led->type == IWL_LED_TRG_ASSOC)
-                       priv->allow_blinking = 0;
-
                if (led->led_off)
                        led->led_off(priv, IWL_LED_LINK);
                break;
@@ -228,12 +242,12 @@ static void iwl_led_brightness_set(struct led_classdev *led_cdev,
  */
 static int iwl_leds_register_led(struct iwl_priv *priv, struct iwl_led *led,
                                   enum led_type type, u8 set_led,
-                                  const char *name, char *trigger)
+                                  char *trigger)
 {
        struct device *device = wiphy_dev(priv->hw->wiphy);
        int ret;
 
-       led->led_dev.name = name;
+       led->led_dev.name = led->name;
        led->led_dev.brightness_set = iwl_led_brightness_set;
        led->led_dev.default_trigger = trigger;
 
@@ -268,7 +282,9 @@ static int iwl_get_blink_rate(struct iwl_priv *priv)
        if (tpt < 0) /* wrapparound */
                tpt = -tpt;
 
-       IWL_DEBUG_LED("tpt %lld current_tpt %lld\n", tpt, current_tpt);
+       IWL_DEBUG_LED("tpt %lld current_tpt %llu\n",
+               (long long)tpt,
+               (unsigned long long)current_tpt);
        priv->led_tpt = current_tpt;
 
        if (!priv->allow_blinking)
@@ -282,12 +298,6 @@ static int iwl_get_blink_rate(struct iwl_priv *priv)
        return i;
 }
 
-static inline int is_rf_kill(struct iwl_priv *priv)
-{
-       return test_bit(STATUS_RF_KILL_HW, &priv->status) ||
-               test_bit(STATUS_RF_KILL_SW, &priv->status);
-}
-
 /*
  * this function called from handler. Since setting Led command can
  * happen very frequent we postpone led command to be called from
@@ -301,7 +311,7 @@ void iwl_leds_background(struct iwl_priv *priv)
                priv->last_blink_time = 0;
                return;
        }
-       if (is_rf_kill(priv)) {
+       if (iwl_is_rfkill(priv)) {
                priv->last_blink_time = 0;
                return;
        }
@@ -335,7 +345,6 @@ EXPORT_SYMBOL(iwl_leds_background);
 int iwl_leds_register(struct iwl_priv *priv)
 {
        char *trigger;
-       char name[32];
        int ret;
 
        priv->last_blink_rate = 0;
@@ -344,7 +353,8 @@ int iwl_leds_register(struct iwl_priv *priv)
        priv->allow_blinking = 0;
 
        trigger = ieee80211_get_radio_led_name(priv->hw);
-       snprintf(name, sizeof(name), "iwl-%s:radio",
+       snprintf(priv->led[IWL_LED_TRG_RADIO].name,
+                sizeof(priv->led[IWL_LED_TRG_RADIO].name), "iwl-%s:radio",
                 wiphy_name(priv->hw->wiphy));
 
        priv->led[IWL_LED_TRG_RADIO].led_on = iwl4965_led_on_reg;
@@ -352,31 +362,33 @@ int iwl_leds_register(struct iwl_priv *priv)
        priv->led[IWL_LED_TRG_RADIO].led_pattern = NULL;
 
        ret = iwl_leds_register_led(priv, &priv->led[IWL_LED_TRG_RADIO],
-                                  IWL_LED_TRG_RADIO, 1, name, trigger);
+                                  IWL_LED_TRG_RADIO, 1, trigger);
        if (ret)
                goto exit_fail;
 
        trigger = ieee80211_get_assoc_led_name(priv->hw);
-       snprintf(name, sizeof(name), "iwl-%s:assoc",
+       snprintf(priv->led[IWL_LED_TRG_ASSOC].name,
+                sizeof(priv->led[IWL_LED_TRG_ASSOC].name), "iwl-%s:assoc",
                 wiphy_name(priv->hw->wiphy));
 
        ret = iwl_leds_register_led(priv, &priv->led[IWL_LED_TRG_ASSOC],
-                                  IWL_LED_TRG_ASSOC, 0, name, trigger);
+                                  IWL_LED_TRG_ASSOC, 0, trigger);
 
        /* for assoc always turn led on */
-       priv->led[IWL_LED_TRG_ASSOC].led_on = iwl4965_led_on_reg;
-       priv->led[IWL_LED_TRG_ASSOC].led_off = iwl4965_led_on_reg;
+       priv->led[IWL_LED_TRG_ASSOC].led_on = iwl_led_associate;
+       priv->led[IWL_LED_TRG_ASSOC].led_off = iwl_led_disassociate;
        priv->led[IWL_LED_TRG_ASSOC].led_pattern = NULL;
 
        if (ret)
                goto exit_fail;
 
        trigger = ieee80211_get_rx_led_name(priv->hw);
-       snprintf(name, sizeof(name), "iwl-%s:RX", wiphy_name(priv->hw->wiphy));
-
+       snprintf(priv->led[IWL_LED_TRG_RX].name,
+                sizeof(priv->led[IWL_LED_TRG_RX].name), "iwl-%s:RX",
+                wiphy_name(priv->hw->wiphy));
 
        ret = iwl_leds_register_led(priv, &priv->led[IWL_LED_TRG_RX],
-                                  IWL_LED_TRG_RX, 0, name, trigger);
+                                  IWL_LED_TRG_RX, 0, trigger);
 
        priv->led[IWL_LED_TRG_RX].led_on = iwl_led_associated;
        priv->led[IWL_LED_TRG_RX].led_off = iwl_led_associated;
@@ -386,9 +398,12 @@ int iwl_leds_register(struct iwl_priv *priv)
                goto exit_fail;
 
        trigger = ieee80211_get_tx_led_name(priv->hw);
-       snprintf(name, sizeof(name), "iwl-%s:TX", wiphy_name(priv->hw->wiphy));
+       snprintf(priv->led[IWL_LED_TRG_TX].name,
+                sizeof(priv->led[IWL_LED_TRG_TX].name), "iwl-%s:TX",
+                wiphy_name(priv->hw->wiphy));
+
        ret = iwl_leds_register_led(priv, &priv->led[IWL_LED_TRG_TX],
-                                  IWL_LED_TRG_TX, 0, name, trigger);
+                                  IWL_LED_TRG_TX, 0, trigger);
 
        priv->led[IWL_LED_TRG_TX].led_on = iwl_led_associated;
        priv->led[IWL_LED_TRG_TX].led_off = iwl_led_associated;
index 1980ae5..588c9ad 100644 (file)
@@ -52,6 +52,7 @@ enum led_type {
 struct iwl_led {
        struct iwl_priv *priv;
        struct led_classdev led_dev;
+       char name[32];
 
        int (*led_on) (struct iwl_priv *priv, int led_id);
        int (*led_off) (struct iwl_priv *priv, int led_id);
index 2e71803..028e305 100644 (file)
@@ -82,7 +82,7 @@
 
 /* default power management (not Tx power) table values */
 /* for tim  0-10 */
-static struct iwl_power_vec_entry range_0[IWL_POWER_AC] = {
+static struct iwl_power_vec_entry range_0[IWL_POWER_MAX] = {
        {{NOSLP, SLP_TOUT(0), SLP_TOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0},
        {{SLP, SLP_TOUT(200), SLP_TOUT(500), SLP_VEC(1, 2, 2, 2, 0xFF)}, 0},
        {{SLP, SLP_TOUT(200), SLP_TOUT(300), SLP_VEC(1, 2, 2, 2, 0xFF)}, 0},
@@ -93,7 +93,7 @@ static struct iwl_power_vec_entry range_0[IWL_POWER_AC] = {
 
 
 /* for tim = 3-10 */
-static struct iwl_power_vec_entry range_1[IWL_POWER_AC] = {
+static struct iwl_power_vec_entry range_1[IWL_POWER_MAX] = {
        {{NOSLP, SLP_TOUT(0), SLP_TOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0},
        {{SLP, SLP_TOUT(200), SLP_TOUT(500), SLP_VEC(1, 2, 3, 4, 4)}, 0},
        {{SLP, SLP_TOUT(200), SLP_TOUT(300), SLP_VEC(1, 2, 3, 4, 7)}, 0},
@@ -103,7 +103,7 @@ static struct iwl_power_vec_entry range_1[IWL_POWER_AC] = {
 };
 
 /* for tim > 11 */
-static struct iwl_power_vec_entry range_2[IWL_POWER_AC] = {
+static struct iwl_power_vec_entry range_2[IWL_POWER_MAX] = {
        {{NOSLP, SLP_TOUT(0), SLP_TOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0},
        {{SLP, SLP_TOUT(200), SLP_TOUT(500), SLP_VEC(1, 2, 3, 4, 0xFF)}, 0},
        {{SLP, SLP_TOUT(200), SLP_TOUT(300), SLP_VEC(2, 4, 6, 7, 0xFF)}, 0},
@@ -112,12 +112,19 @@ static struct iwl_power_vec_entry range_2[IWL_POWER_AC] = {
        {{SLP, SLP_TOUT(25), SLP_TOUT(25), SLP_VEC(4, 7, 10, 10, 0xFF)}, 0}
 };
 
+/* set card power command */
+static int iwl_set_power(struct iwl_priv *priv, void *cmd)
+{
+       return iwl_send_cmd_pdu_async(priv, POWER_TABLE_CMD,
+                                     sizeof(struct iwl_powertable_cmd),
+                                     cmd, NULL);
+}
 /* decide the right power level according to association status
  * and battery status
  */
 static u16 iwl_get_auto_power_mode(struct iwl_priv *priv)
 {
-       u16 mode = priv->power_data.user_power_setting;
+       u16 mode;
 
        switch (priv->power_data.user_power_setting) {
        case IWL_POWER_AUTO:
@@ -129,12 +136,16 @@ static u16 iwl_get_auto_power_mode(struct iwl_priv *priv)
                else
                        mode = IWL_POWER_ON_AC_DISASSOC;
                break;
+       /* FIXME: remove battery and ac from here */
        case IWL_POWER_BATTERY:
                mode = IWL_POWER_INDEX_3;
                break;
        case IWL_POWER_AC:
                mode = IWL_POWER_MODE_CAM;
                break;
+       default:
+               mode = priv->power_data.user_power_setting;
+               break;
        }
        return mode;
 }
@@ -144,7 +155,7 @@ static int iwl_power_init_handle(struct iwl_priv *priv)
 {
        int ret = 0, i;
        struct iwl_power_mgr *pow_data;
-       int size = sizeof(struct iwl_power_vec_entry) * IWL_POWER_AC;
+       int size = sizeof(struct iwl_power_vec_entry) * IWL_POWER_MAX;
        u16 pci_pm;
 
        IWL_DEBUG_POWER("Initialize power \n");
@@ -162,11 +173,11 @@ static int iwl_power_init_handle(struct iwl_priv *priv)
        if (ret != 0)
                return 0;
        else {
-               struct iwl4965_powertable_cmd *cmd;
+               struct iwl_powertable_cmd *cmd;
 
                IWL_DEBUG_POWER("adjust power command flags\n");
 
-               for (i = 0; i < IWL_POWER_AC; i++) {
+               for (i = 0; i < IWL_POWER_MAX; i++) {
                        cmd = &pow_data->pwr_range_0[i].cmd;
 
                        if (pci_pm & 0x1)
@@ -180,7 +191,7 @@ static int iwl_power_init_handle(struct iwl_priv *priv)
 
 /* adjust power command according to dtim period and power level*/
 static int iwl_update_power_command(struct iwl_priv *priv,
-                                   struct iwl4965_powertable_cmd *cmd,
+                                   struct iwl_powertable_cmd *cmd,
                                    u16 mode)
 {
        int ret = 0, i;
@@ -204,7 +215,7 @@ static int iwl_update_power_command(struct iwl_priv *priv,
                range = &pow_data->pwr_range_2[0];
 
        period = pow_data->dtim_period;
-       memcpy(cmd, &range[mode].cmd, sizeof(struct iwl4965_powertable_cmd));
+       memcpy(cmd, &range[mode].cmd, sizeof(struct iwl_powertable_cmd));
 
        if (period == 0) {
                period = 1;
@@ -258,17 +269,18 @@ int iwl_power_update_mode(struct iwl_priv *priv, u8 refresh)
        * else user level */
 
        switch (setting->system_power_setting) {
-       case IWL_POWER_AUTO:
+       case IWL_POWER_SYS_AUTO:
                final_mode = iwl_get_auto_power_mode(priv);
                break;
-       case IWL_POWER_BATTERY:
+       case IWL_POWER_SYS_BATTERY:
                final_mode = IWL_POWER_INDEX_3;
                break;
-       case IWL_POWER_AC:
+       case IWL_POWER_SYS_AC:
                final_mode = IWL_POWER_MODE_CAM;
                break;
        default:
-               final_mode = setting->system_power_setting;
+               final_mode = IWL_POWER_INDEX_3;
+               WARN_ON(1);
        }
 
        if (setting->critical_power_setting > final_mode)
@@ -280,7 +292,7 @@ int iwl_power_update_mode(struct iwl_priv *priv, u8 refresh)
 
        if (!iwl_is_rfkill(priv) && !setting->power_disabled &&
            ((setting->power_mode != final_mode) || refresh)) {
-               struct iwl4965_powertable_cmd cmd;
+               struct iwl_powertable_cmd cmd;
 
                if (final_mode != IWL_POWER_MODE_CAM)
                        set_bit(STATUS_POWER_PMI, &priv->status);
@@ -291,8 +303,7 @@ int iwl_power_update_mode(struct iwl_priv *priv, u8 refresh)
                if (final_mode == IWL_POWER_INDEX_5)
                        cmd.flags |= IWL_POWER_FAST_PD;
 
-               if (priv->cfg->ops->lib->set_power)
-                       ret = priv->cfg->ops->lib->set_power(priv, &cmd);
+               ret = iwl_set_power(priv, &cmd);
 
                if (final_mode == IWL_POWER_MODE_CAM)
                        clear_bit(STATUS_POWER_PMI, &priv->status);
@@ -388,7 +399,7 @@ void iwl_power_initialize(struct iwl_priv *priv)
        iwl_power_init_handle(priv);
        priv->power_data.user_power_setting = IWL_POWER_AUTO;
        priv->power_data.power_disabled = 0;
-       priv->power_data.system_power_setting = IWL_POWER_AUTO;
+       priv->power_data.system_power_setting = IWL_POWER_SYS_AUTO;
        priv->power_data.is_battery_active = 0;
        priv->power_data.power_disabled = 0;
        priv->power_data.critical_power_setting = 0;
index b066724..abcbbf9 100644 (file)
 
 struct iwl_priv;
 
-#define IWL_POWER_MODE_CAM     0x00    /* Continuously Aware Mode, always on */
-#define IWL_POWER_INDEX_3      0x03
-#define IWL_POWER_INDEX_5      0x05
-#define IWL_POWER_AC           0x06
-#define IWL_POWER_BATTERY      0x07
-#define IWL_POWER_AUTO         0x08
+enum {
+       IWL_POWER_MODE_CAM, /* Continuously Aware Mode, always on */
+       IWL_POWER_INDEX_1,
+       IWL_POWER_INDEX_2,
+       IWL_POWER_INDEX_3,
+       IWL_POWER_INDEX_4,
+       IWL_POWER_INDEX_5,
+       IWL_POWER_AUTO,
+       IWL_POWER_MAX = IWL_POWER_AUTO,
+       IWL_POWER_AC,
+       IWL_POWER_BATTERY,
+};
+
+enum {
+       IWL_POWER_SYS_AUTO,
+       IWL_POWER_SYS_AC,
+       IWL_POWER_SYS_BATTERY,
+};
+
 #define IWL_POWER_LIMIT                0x08
 #define IWL_POWER_MASK         0x0F
 #define IWL_POWER_ENABLED      0x10
@@ -46,15 +59,15 @@ struct iwl_priv;
 /* Power management (not Tx power) structures */
 
 struct iwl_power_vec_entry {
-       struct iwl4965_powertable_cmd cmd;
+       struct iwl_powertable_cmd cmd;
        u8 no_dtim;
 };
 
 struct iwl_power_mgr {
        spinlock_t lock;
-       struct iwl_power_vec_entry pwr_range_0[IWL_POWER_AC];
-       struct iwl_power_vec_entry pwr_range_1[IWL_POWER_AC];
-       struct iwl_power_vec_entry pwr_range_2[IWL_POWER_AC];
+       struct iwl_power_vec_entry pwr_range_0[IWL_POWER_MAX];
+       struct iwl_power_vec_entry pwr_range_1[IWL_POWER_MAX];
+       struct iwl_power_vec_entry pwr_range_2[IWL_POWER_MAX];
        u32 dtim_period;
        /* final power level that used to calculate final power command */
        u8 power_mode;
index 70d9c75..ee5afd4 100644 (file)
 #define APMG_CLK_VAL_DMA_CLK_RQT       (0x00000200)
 #define APMG_CLK_VAL_BSM_CLK_RQT       (0x00000800)
 
-#define APMG_PS_CTRL_VAL_RESET_REQ     (0x04000000)
 
-#define APMG_PCIDEV_STT_VAL_L1_ACT_DIS (0x00000800)
+#define APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS   (0x00400000)
+#define APMG_PS_CTRL_VAL_RESET_REQ             (0x04000000)
+#define APMG_PS_CTRL_MSK_PWR_SRC               (0x03000000)
+#define APMG_PS_CTRL_VAL_PWR_SRC_VMAIN         (0x00000000)
+#define APMG_PS_CTRL_VAL_PWR_SRC_MAX           (0x01000000) /* 3945 only */
+#define APMG_PS_CTRL_VAL_PWR_SRC_VAUX          (0x02000000)
 
-#define APMG_PS_CTRL_MSK_PWR_SRC              (0x03000000)
-#define APMG_PS_CTRL_VAL_PWR_SRC_VMAIN        (0x00000000)
-#define APMG_PS_CTRL_VAL_PWR_SRC_VAUX         (0x01000000)
 
+#define APMG_PCIDEV_STT_VAL_L1_ACT_DIS         (0x00000800)
 
 /**
  * BSM (Bootstrap State Machine)
index e2d9afb..f3f6ea4 100644 (file)
@@ -791,7 +791,7 @@ static inline void iwl_dbg_report_frame(struct iwl_priv *priv,
 
 static void iwl_add_radiotap(struct iwl_priv *priv,
                                 struct sk_buff *skb,
-                                struct iwl4965_rx_phy_res *rx_start,
+                                struct iwl_rx_phy_res *rx_start,
                                 struct ieee80211_rx_status *stats,
                                 u32 ampdu_status)
 {
@@ -1010,8 +1010,8 @@ static void iwl_pass_packet_to_mac80211(struct iwl_priv *priv,
                                       struct ieee80211_rx_status *stats)
 {
        struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
-       struct iwl4965_rx_phy_res *rx_start = (include_phy) ?
-           (struct iwl4965_rx_phy_res *)&(pkt->u.raw[0]) : NULL;
+       struct iwl_rx_phy_res *rx_start = (include_phy) ?
+           (struct iwl_rx_phy_res *)&(pkt->u.raw[0]) : NULL;
        struct ieee80211_hdr *hdr;
        u16 len;
        __le32 *rx_end;
@@ -1020,7 +1020,7 @@ static void iwl_pass_packet_to_mac80211(struct iwl_priv *priv,
        u32 ampdu_status_legacy;
 
        if (!include_phy && priv->last_phy_res[0])
-               rx_start = (struct iwl4965_rx_phy_res *)&priv->last_phy_res[1];
+               rx_start = (struct iwl_rx_phy_res *)&priv->last_phy_res[1];
 
        if (!rx_start) {
                IWL_ERROR("MPDU frame without a PHY data\n");
@@ -1032,8 +1032,8 @@ static void iwl_pass_packet_to_mac80211(struct iwl_priv *priv,
 
                len = le16_to_cpu(rx_start->byte_count);
 
-               rx_end = (__le32 *) ((u8 *) &pkt->u.raw[0] +
-                                 sizeof(struct iwl4965_rx_phy_res) +
+               rx_end = (__le32 *)((u8 *) &pkt->u.raw[0] +
+                                 sizeof(struct iwl_rx_phy_res) +
                                  rx_start->cfg_phy_cnt + len);
 
        } else {
@@ -1084,40 +1084,13 @@ static void iwl_pass_packet_to_mac80211(struct iwl_priv *priv,
 }
 
 /* Calc max signal level (dBm) among 3 possible receivers */
-static int iwl_calc_rssi(struct iwl_priv *priv,
-                            struct iwl4965_rx_phy_res *rx_resp)
+static inline int iwl_calc_rssi(struct iwl_priv *priv,
+                               struct iwl_rx_phy_res *rx_resp)
 {
-       /* data from PHY/DSP regarding signal strength, etc.,
-        *   contents are always there, not configurable by host.  */
-       struct iwl4965_rx_non_cfg_phy *ncphy =
-           (struct iwl4965_rx_non_cfg_phy *)rx_resp->non_cfg_phy;
-       u32 agc = (le16_to_cpu(ncphy->agc_info) & IWL_AGC_DB_MASK)
-                       >> IWL_AGC_DB_POS;
-
-       u32 valid_antennae =
-           (le16_to_cpu(rx_resp->phy_flags) & RX_PHY_FLAGS_ANTENNAE_MASK)
-                       >> RX_PHY_FLAGS_ANTENNAE_OFFSET;
-       u8 max_rssi = 0;
-       u32 i;
-
-       /* Find max rssi among 3 possible receivers.
-        * These values are measured by the digital signal processor (DSP).
-        * They should stay fairly constant even as the signal strength varies,
-        *   if the radio's automatic gain control (AGC) is working right.
-        * AGC value (see below) will provide the "interesting" info. */
-       for (i = 0; i < 3; i++)
-               if (valid_antennae & (1 << i))
-                       max_rssi = max(ncphy->rssi_info[i << 1], max_rssi);
-
-       IWL_DEBUG_STATS("Rssi In A %d B %d C %d Max %d AGC dB %d\n",
-               ncphy->rssi_info[0], ncphy->rssi_info[2], ncphy->rssi_info[4],
-               max_rssi, agc);
-
-       /* dBm = max_rssi dB - agc dB - constant.
-        * Higher AGC (higher radio gain) means lower signal. */
-       return max_rssi - agc - IWL_RSSI_OFFSET;
+       return priv->cfg->ops->utils->calc_rssi(priv, rx_resp);
 }
 
+
 static void iwl_sta_modify_ps_wake(struct iwl_priv *priv, int sta_id)
 {
        unsigned long flags;
@@ -1180,9 +1153,9 @@ void iwl_rx_reply_rx(struct iwl_priv *priv,
         *   this rx packet for legacy frames,
         *   or phy data cached from REPLY_RX_PHY_CMD for HT frames. */
        int include_phy = (pkt->hdr.cmd == REPLY_RX);
-       struct iwl4965_rx_phy_res *rx_start = (include_phy) ?
-               (struct iwl4965_rx_phy_res *)&(pkt->u.raw[0]) :
-               (struct iwl4965_rx_phy_res *)&priv->last_phy_res[1];
+       struct iwl_rx_phy_res *rx_start = (include_phy) ?
+               (struct iwl_rx_phy_res *)&(pkt->u.raw[0]) :
+               (struct iwl_rx_phy_res *)&priv->last_phy_res[1];
        __le32 *rx_end;
        unsigned int len = 0;
        u16 fc;
@@ -1210,7 +1183,7 @@ void iwl_rx_reply_rx(struct iwl_priv *priv,
 
        if (!include_phy) {
                if (priv->last_phy_res[0])
-                       rx_start = (struct iwl4965_rx_phy_res *)
+                       rx_start = (struct iwl_rx_phy_res *)
                                &priv->last_phy_res[1];
                else
                        rx_start = NULL;
@@ -1227,7 +1200,7 @@ void iwl_rx_reply_rx(struct iwl_priv *priv,
 
                len = le16_to_cpu(rx_start->byte_count);
                rx_end = (__le32 *)(pkt->u.raw + rx_start->cfg_phy_cnt +
-                                 sizeof(struct iwl4965_rx_phy_res) + len);
+                                 sizeof(struct iwl_rx_phy_res) + len);
        } else {
                struct iwl4965_rx_mpdu_res_start *amsdu =
                        (struct iwl4965_rx_mpdu_res_start *)pkt->u.raw;
@@ -1316,6 +1289,6 @@ void iwl_rx_reply_rx_phy(struct iwl_priv *priv,
        struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
        priv->last_phy_res[0] = 1;
        memcpy(&priv->last_phy_res[1], &(pkt->u.raw[0]),
-              sizeof(struct iwl4965_rx_phy_res));
+              sizeof(struct iwl_rx_phy_res));
 }
 EXPORT_SYMBOL(iwl_rx_reply_rx_phy);
index efc750d..9bb6adb 100644 (file)
@@ -202,6 +202,7 @@ static int iwl_send_scan_abort(struct iwl_priv *priv)
                clear_bit(STATUS_SCAN_HW, &priv->status);
        }
 
+       priv->alloc_rxb_skb--;
        dev_kfree_skb_any(cmd.meta.u.skb);
 
        return ret;
@@ -270,6 +271,7 @@ static void iwl_rx_scan_results_notif(struct iwl_priv *priv,
 static void iwl_rx_scan_complete_notif(struct iwl_priv *priv,
                                       struct iwl_rx_mem_buffer *rxb)
 {
+#ifdef CONFIG_IWLWIFI_DEBUG
        struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
        struct iwl_scancomplete_notification *scan_notif = (void *)pkt->u.raw;
 
@@ -277,6 +279,7 @@ static void iwl_rx_scan_complete_notif(struct iwl_priv *priv,
                       scan_notif->scanned_channels,
                       scan_notif->tsf_low,
                       scan_notif->tsf_high, scan_notif->status);
+#endif
 
        /* The HW is no longer scanning */
        clear_bit(STATUS_SCAN_HW, &priv->status);
index 6d1467d..60a6e01 100644 (file)
@@ -823,7 +823,7 @@ int iwl_send_lq_cmd(struct iwl_priv *priv,
        if (lq->sta_id == 0xFF)
                lq->sta_id = IWL_AP_ID;
 
-       iwl_dump_lq_cmd(priv,lq);
+       iwl_dump_lq_cmd(priv, lq);
 
        if (iwl_is_associated(priv) && priv->assoc_station_added)
                return  iwl_send_cmd(priv, &cmd);
@@ -839,7 +839,7 @@ EXPORT_SYMBOL(iwl_send_lq_cmd);
  * for automatic fallback during transmission.
  *
  * NOTE: This sets up a default set of values.  These will be replaced later
- *       if the driver's iwl-4965-rs rate scaling algorithm is used, instead of
+ *       if the driver's iwl-agn-rs rate scaling algorithm is used, instead of
  *       rc80211_simple.
  *
  * NOTE: Run REPLY_ADD_STA command to set up station table entry, before
index 9b50b10..aa98c76 100644 (file)
@@ -208,11 +208,12 @@ EXPORT_SYMBOL(iwl_txq_update_write_ptr);
  * Free all buffers.
  * 0-fill, but do not free "txq" descriptor structure.
  */
-static void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq)
+static void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id)
 {
+       struct iwl_tx_queue *txq = &priv->txq[txq_id];
        struct iwl_queue *q = &txq->q;
        struct pci_dev *dev = priv->pci_dev;
-       int len;
+       int i, slots_num, len;
 
        if (q->n_bd == 0)
                return;
@@ -227,7 +228,12 @@ static void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq)
                len += IWL_MAX_SCAN_SIZE;
 
        /* De-alloc array of command/tx buffers */
-       pci_free_consistent(dev, len, txq->cmd, txq->dma_addr_cmd);
+       slots_num = (txq_id == IWL_CMD_QUEUE_NUM) ?
+                       TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS;
+       for (i = 0; i < slots_num; i++)
+               kfree(txq->cmd[i]);
+       if (txq_id == IWL_CMD_QUEUE_NUM)
+               kfree(txq->cmd[slots_num]);
 
        /* De-alloc circular buffer of TFDs */
        if (txq->q.n_bd)
@@ -400,8 +406,7 @@ static int iwl_tx_queue_init(struct iwl_priv *priv,
                             struct iwl_tx_queue *txq,
                             int slots_num, u32 txq_id)
 {
-       struct pci_dev *dev = priv->pci_dev;
-       int len;
+       int i, len;
        int rc = 0;
 
        /*
@@ -412,17 +417,25 @@ static int iwl_tx_queue_init(struct iwl_priv *priv,
         * For normal Tx queues (all other queues), no super-size command
         * space is needed.
         */
-       len = sizeof(struct iwl_cmd) * slots_num;
-       if (txq_id == IWL_CMD_QUEUE_NUM)
-               len +=  IWL_MAX_SCAN_SIZE;
-       txq->cmd = pci_alloc_consistent(dev, len, &txq->dma_addr_cmd);
-       if (!txq->cmd)
-               return -ENOMEM;
+       len = sizeof(struct iwl_cmd);
+       for (i = 0; i <= slots_num; i++) {
+               if (i == slots_num) {
+                       if (txq_id == IWL_CMD_QUEUE_NUM)
+                               len += IWL_MAX_SCAN_SIZE;
+                       else
+                               continue;
+               }
+
+               txq->cmd[i] = kmalloc(len, GFP_KERNEL | GFP_DMA);
+               if (!txq->cmd[i])
+                       return -ENOMEM;
+       }
 
        /* Alloc driver data array and TFD circular buffer */
        rc = iwl_tx_queue_alloc(priv, txq, txq_id);
        if (rc) {
-               pci_free_consistent(dev, len, txq->cmd, txq->dma_addr_cmd);
+               for (i = 0; i < slots_num; i++)
+                       kfree(txq->cmd[i]);
 
                return -ENOMEM;
        }
@@ -451,7 +464,7 @@ void iwl_hw_txq_ctx_free(struct iwl_priv *priv)
 
        /* Tx queues */
        for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++)
-               iwl_tx_queue_free(priv, &priv->txq[txq_id]);
+               iwl_tx_queue_free(priv, txq_id);
 
        /* Keep-warm buffer */
        iwl_kw_free(priv);
@@ -859,7 +872,7 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
        txq->txb[q->write_ptr].skb[0] = skb;
 
        /* Set up first empty entry in queue's array of Tx/cmd buffers */
-       out_cmd = &txq->cmd[idx];
+       out_cmd = txq->cmd[idx];
        tx_cmd = &out_cmd->cmd.tx;
        memset(&out_cmd->hdr, 0, sizeof(out_cmd->hdr));
        memset(tx_cmd, 0, sizeof(struct iwl_tx_cmd));
@@ -899,14 +912,15 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
 
        /* Physical address of this Tx command's header (not MAC header!),
         * within command buffer array. */
-       txcmd_phys = txq->dma_addr_cmd + sizeof(struct iwl_cmd) * idx +
-                    offsetof(struct iwl_cmd, hdr);
+       txcmd_phys = pci_map_single(priv->pci_dev, out_cmd,
+                               sizeof(struct iwl_cmd), PCI_DMA_TODEVICE);
+       txcmd_phys += offsetof(struct iwl_cmd, hdr);
 
        /* Add buffer containing Tx command and MAC(!) header to TFD's
         * first entry */
        iwl_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, len);
 
-       if (!(info->flags & IEEE80211_TX_CTL_DO_NOT_ENCRYPT))
+       if (info->control.hw_key)
                iwl_tx_cmd_build_hwcrypto(priv, info, tx_cmd, skb, sta_id);
 
        /* Set up TFD's 2nd entry to point directly to remainder of skb,
@@ -962,16 +976,16 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
        if (ret)
                return ret;
 
-       if ((iwl_queue_space(q) < q->high_mark)
-           && priv->mac80211_registered) {
+       if ((iwl_queue_space(q) < q->high_mark) && priv->mac80211_registered) {
                if (wait_write_ptr) {
                        spin_lock_irqsave(&priv->lock, flags);
                        txq->need_update = 1;
                        iwl_txq_update_write_ptr(priv, txq);
                        spin_unlock_irqrestore(&priv->lock, flags);
+               } else {
+                       ieee80211_stop_queue(priv->hw,
+                                            skb_get_queue_mapping(skb));
                }
-
-               ieee80211_stop_queue(priv->hw, skb_get_queue_mapping(skb));
        }
 
        return 0;
@@ -1004,7 +1018,7 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
        u32 idx;
        u16 fix_size;
        dma_addr_t phys_addr;
-       int ret;
+       int len, ret;
        unsigned long flags;
 
        cmd->len = priv->cfg->ops->utils->get_hcmd_size(cmd->id, cmd->len);
@@ -1034,7 +1048,7 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
        control_flags = (u32 *) tfd;
 
        idx = get_cmd_index(q, q->write_ptr, cmd->meta.flags & CMD_SIZE_HUGE);
-       out_cmd = &txq->cmd[idx];
+       out_cmd = txq->cmd[idx];
 
        out_cmd->hdr.cmd = cmd->id;
        memcpy(&out_cmd->meta, &cmd->meta, sizeof(cmd->meta));
@@ -1048,9 +1062,11 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
                        INDEX_TO_SEQ(q->write_ptr));
        if (out_cmd->meta.flags & CMD_SIZE_HUGE)
                out_cmd->hdr.sequence |= cpu_to_le16(SEQ_HUGE_FRAME);
-
-       phys_addr = txq->dma_addr_cmd + sizeof(txq->cmd[0]) * idx +
-                       offsetof(struct iwl_cmd, hdr);
+       len = (idx == TFD_CMD_SLOTS) ?
+                       IWL_MAX_SCAN_SIZE : sizeof(struct iwl_cmd);
+       phys_addr = pci_map_single(priv->pci_dev, out_cmd, len,
+                                               PCI_DMA_TODEVICE);
+       phys_addr += offsetof(struct iwl_cmd, hdr);
        iwl_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, fix_size);
 
        IWL_DEBUG_HC("Sending command %s (#%x), seq: 0x%04X, "
@@ -1115,6 +1131,9 @@ static void iwl_hcmd_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
 {
        struct iwl_tx_queue *txq = &priv->txq[txq_id];
        struct iwl_queue *q = &txq->q;
+       struct iwl_tfd_frame *bd = &txq->bd[index];
+       dma_addr_t dma_addr;
+       int is_odd, buf_len;
        int nfreed = 0;
 
        if ((index >= q->n_bd) || (iwl_queue_used(q, index) == 0)) {
@@ -1132,6 +1151,19 @@ static void iwl_hcmd_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
                                        q->write_ptr, q->read_ptr);
                        queue_work(priv->workqueue, &priv->restart);
                }
+               is_odd = (index/2) & 0x1;
+               if (is_odd) {
+                       dma_addr = IWL_GET_BITS(bd->pa[index], tb2_addr_lo16) |
+                                       (IWL_GET_BITS(bd->pa[index],
+                                                       tb2_addr_hi20) << 16);
+                       buf_len = IWL_GET_BITS(bd->pa[index], tb2_len);
+               } else {
+                       dma_addr = le32_to_cpu(bd->pa[index].tb1_addr);
+                       buf_len = IWL_GET_BITS(bd->pa[index], tb1_len);
+               }
+
+               pci_unmap_single(priv->pci_dev, dma_addr, buf_len,
+                                PCI_DMA_TODEVICE);
                nfreed++;
        }
 }
@@ -1163,7 +1195,7 @@ void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
        BUG_ON(txq_id != IWL_CMD_QUEUE_NUM);
 
        cmd_index = get_cmd_index(&priv->txq[IWL_CMD_QUEUE_NUM].q, index, huge);
-       cmd = &priv->txq[IWL_CMD_QUEUE_NUM].cmd[cmd_index];
+       cmd = priv->txq[IWL_CMD_QUEUE_NUM].cmd[cmd_index];
 
        /* Input error checking is done when commands are added to queue. */
        if (cmd->meta.flags & CMD_WANT_SKB) {
@@ -1391,7 +1423,7 @@ static int iwl_tx_status_reply_compressed_ba(struct iwl_priv *priv,
        /* For each frame attempted in aggregation,
         * update driver's record of tx frame's status. */
        for (i = 0; i < agg->frame_count ; i++) {
-               ack = bitmap & (1 << i);
+               ack = bitmap & (1ULL << i);
                successes += !!ack;
                IWL_DEBUG_TX_REPLY("%s ON i=%d idx=%d raw=%d\n",
                        ack? "ACK":"NACK", i, (agg->start_idx + i) & 0xff,
index 4a22d3f..444847a 100644 (file)
@@ -275,10 +275,8 @@ static int iwl3945_tx_queue_alloc(struct iwl3945_priv *priv,
        return 0;
 
  error:
-       if (txq->txb) {
-               kfree(txq->txb);
-               txq->txb = NULL;
-       }
+       kfree(txq->txb);
+       txq->txb = NULL;
 
        return -ENOMEM;
 }
@@ -365,10 +363,8 @@ void iwl3945_tx_queue_free(struct iwl3945_priv *priv, struct iwl3945_tx_queue *t
                                    txq->q.n_bd, txq->bd, txq->q.dma_addr);
 
        /* De-alloc array of per-TFD driver data */
-       if (txq->txb) {
-               kfree(txq->txb);
-               txq->txb = NULL;
-       }
+       kfree(txq->txb);
+       txq->txb = NULL;
 
        /* 0-fill queue descriptor structure */
        memset(txq, 0, sizeof(*txq));
@@ -2667,7 +2663,7 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, struct sk_buff *skb)
         * first entry */
        iwl3945_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, len);
 
-       if (!(info->flags & IEEE80211_TX_CTL_DO_NOT_ENCRYPT))
+       if (info->control.hw_key)
                iwl3945_build_tx_cmd_hwcrypto(priv, info, out_cmd, skb, 0);
 
        /* Set up TFD's 2nd entry to point directly to remainder of skb,
@@ -2703,9 +2699,8 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, struct sk_buff *skb)
 
        if (!ieee80211_has_morefrags(hdr->frame_control)) {
                txq->need_update = 1;
-               if (qc) {
+               if (qc)
                        priv->stations[sta_id].tid[tid].seq_number = seq_number;
-               }
        } else {
                wait_write_ptr = 1;
                txq->need_update = 0;
@@ -3813,7 +3808,7 @@ int iwl3945_calc_db_from_ratio(int sig_ratio)
        /* 100:1 or higher, divide by 10 and use table,
         *   add 20 dB to make up for divide by 10 */
        if (sig_ratio >= 100)
-               return (20 + (int)ratio2dB[sig_ratio/10]);
+               return 20 + (int)ratio2dB[sig_ratio/10];
 
        /* We shouldn't see this */
        if (sig_ratio < 1)
@@ -5088,7 +5083,7 @@ static void iwl3945_dealloc_ucode_pci(struct iwl3945_priv *priv)
  * iwl3945_verify_inst_full - verify runtime uCode image in card vs. host,
  *     looking at all data.
  */
-static int iwl3945_verify_inst_full(struct iwl3945_priv *priv, __le32 * image, u32 len)
+static int iwl3945_verify_inst_full(struct iwl3945_priv *priv, __le32 *image, u32 len)
 {
        u32 val;
        u32 save_len = len;
@@ -5237,7 +5232,7 @@ static int iwl3945_verify_bsm(struct iwl3945_priv *priv)
        val = iwl3945_read_prph(priv, BSM_WR_DWCOUNT_REG);
        for (reg = BSM_SRAM_LOWER_BOUND;
             reg < BSM_SRAM_LOWER_BOUND + len;
-            reg += sizeof(u32), image ++) {
+            reg += sizeof(u32), image++) {
                val = iwl3945_read_prph(priv, reg);
                if (val != le32_to_cpu(*image)) {
                        IWL_ERROR("BSM uCode verification failed at "
@@ -6336,7 +6331,7 @@ static void iwl3945_bg_post_associate(struct work_struct *data)
        DECLARE_MAC_BUF(mac);
 
        if (priv->iw_mode == IEEE80211_IF_TYPE_AP) {
-               IWL_ERROR("%s Should not be called in AP mode\n", __FUNCTION__);
+               IWL_ERROR("%s Should not be called in AP mode\n", __func__);
                return;
        }
 
@@ -6417,7 +6412,7 @@ static void iwl3945_bg_post_associate(struct work_struct *data)
 
        default:
                 IWL_ERROR("%s Should not be called in %d mode\n",
-                          __FUNCTION__, priv->iw_mode);
+                          __func__, priv->iw_mode);
                break;
        }
 
@@ -6594,12 +6589,6 @@ static int iwl3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
 
        IWL_DEBUG_MAC80211("enter\n");
 
-       if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) {
-               IWL_DEBUG_MAC80211("leave - monitor\n");
-               dev_kfree_skb_any(skb);
-               return 0;
-       }
-
        IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len,
                     ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate);
 
@@ -7456,7 +7445,7 @@ static ssize_t show_measurement(struct device *d,
        struct iwl3945_priv *priv = dev_get_drvdata(d);
        struct iwl3945_spectrum_notification measure_report;
        u32 size = sizeof(measure_report), len = 0, ofs = 0;
-       u8 *data = (u8 *) & measure_report;
+       u8 *data = (u8 *)&measure_report;
        unsigned long flags;
 
        spin_lock_irqsave(&priv->lock, flags);
@@ -7627,7 +7616,7 @@ static ssize_t show_power_level(struct device *d,
        else
                p += sprintf(p, " \n");
 
-       return (p - buf + 1);
+       return p - buf + 1;
 
 }
 
@@ -7649,7 +7638,7 @@ static ssize_t show_statistics(struct device *d,
        struct iwl3945_priv *priv = dev_get_drvdata(d);
        u32 size = sizeof(struct iwl3945_notif_statistics);
        u32 len = 0, ofs = 0;
-       u8 *data = (u8 *) & priv->statistics;
+       u8 *data = (u8 *)&priv->statistics;
        int rc = 0;
 
        if (!iwl3945_is_alive(priv))
@@ -7899,8 +7888,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
        priv->ibss_beacon = NULL;
 
        /* Tell mac80211 our characteristics */
-       hw->flags = IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE |
-                   IEEE80211_HW_SIGNAL_DBM |
+       hw->flags = IEEE80211_HW_SIGNAL_DBM |
                    IEEE80211_HW_NOISE_DBM;
 
        /* 4 EDCA QOS priorities */
@@ -8004,16 +7992,16 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
 
        /* nic init */
        iwl3945_set_bit(priv, CSR_GIO_CHICKEN_BITS,
-                    CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER);
-
-        iwl3945_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
-        err = iwl3945_poll_bit(priv, CSR_GP_CNTRL,
-                          CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY,
-                          CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000);
-        if (err < 0) {
-                IWL_DEBUG_INFO("Failed to init the card\n");
+                       CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER);
+
+       iwl3945_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
+       err = iwl3945_poll_bit(priv, CSR_GP_CNTRL,
+                              CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY,
+                              CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000);
+       if (err < 0) {
+               IWL_DEBUG_INFO("Failed to init the card\n");
                goto out_remove_sysfs;
-        }
+       }
        /* Read the EEPROM */
        err = iwl3945_eeprom_init(priv);
        if (err) {
@@ -8115,9 +8103,8 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev)
        iwl3945_unset_hw_setting(priv);
        iwl3945_clear_stations_table(priv);
 
-       if (priv->mac80211_registered) {
+       if (priv->mac80211_registered)
                ieee80211_unregister_hw(priv->hw);
-       }
 
        /*netif_stop_queue(dev); */
        flush_workqueue(priv->workqueue);
index 14d5d61..bd32ac0 100644 (file)
@@ -297,9 +297,7 @@ static ssize_t lbs_rtap_set(struct device *dev,
                        lbs_add_rtap(priv);
                }
                priv->monitormode = monitor_mode;
-       }
-
-       else {
+       } else {
                if (!priv->monitormode)
                        return strlen(buf);
                priv->monitormode = 0;
@@ -1242,8 +1240,6 @@ int lbs_start_card(struct lbs_private *priv)
                lbs_pr_err("cannot register ethX device\n");
                goto done;
        }
-       if (device_create_file(&dev->dev, &dev_attr_lbs_rtap))
-               lbs_pr_err("cannot register lbs_rtap attribute\n");
 
        lbs_update_channel(priv);
 
@@ -1275,6 +1271,13 @@ int lbs_start_card(struct lbs_private *priv)
 
                        if (device_create_file(&dev->dev, &dev_attr_lbs_mesh))
                                lbs_pr_err("cannot register lbs_mesh attribute\n");
+
+                       /* While rtap isn't related to mesh, only mesh-enabled
+                        * firmware implements the rtap functionality via
+                        * CMD_802_11_MONITOR_MODE.
+                        */
+                       if (device_create_file(&dev->dev, &dev_attr_lbs_rtap))
+                               lbs_pr_err("cannot register lbs_rtap attribute\n");
                }
        }
 
@@ -1306,9 +1309,9 @@ void lbs_stop_card(struct lbs_private *priv)
        netif_carrier_off(priv->dev);
 
        lbs_debugfs_remove_one(priv);
-       device_remove_file(&dev->dev, &dev_attr_lbs_rtap);
        if (priv->mesh_tlv) {
                device_remove_file(&dev->dev, &dev_attr_lbs_mesh);
+               device_remove_file(&dev->dev, &dev_attr_lbs_rtap);
        }
 
        /* Flush pending command nodes */
index 6d0ff8d..3309a9c 100644 (file)
@@ -48,7 +48,7 @@ static ssize_t bootflag_get(struct device *dev,
        if (ret)
                return ret;
 
-       return snprintf(buf, 12, "0x%x\n", le32_to_cpu(defs.bootflag));
+       return snprintf(buf, 12, "%d\n", le32_to_cpu(defs.bootflag));
 }
 
 /**
@@ -63,8 +63,8 @@ static ssize_t bootflag_set(struct device *dev, struct device_attribute *attr,
        int ret;
 
        memset(&cmd, 0, sizeof(cmd));
-       ret = sscanf(buf, "%x", &datum);
-       if (ret != 1)
+       ret = sscanf(buf, "%d", &datum);
+       if ((ret != 1) || (datum > 1))
                return -EINVAL;
 
        *((__le32 *)&cmd.data[0]) = cpu_to_le32(!!datum);
@@ -91,7 +91,7 @@ static ssize_t boottime_get(struct device *dev,
        if (ret)
                return ret;
 
-       return snprintf(buf, 12, "0x%x\n", defs.boottime);
+       return snprintf(buf, 12, "%d\n", defs.boottime);
 }
 
 /**
@@ -106,8 +106,8 @@ static ssize_t boottime_set(struct device *dev,
        int ret;
 
        memset(&cmd, 0, sizeof(cmd));
-       ret = sscanf(buf, "%x", &datum);
-       if (ret != 1)
+       ret = sscanf(buf, "%d", &datum);
+       if ((ret != 1) || (datum > 255))
                return -EINVAL;
 
        /* A too small boot time will result in the device booting into
@@ -143,7 +143,7 @@ static ssize_t channel_get(struct device *dev,
        if (ret)
                return ret;
 
-       return snprintf(buf, 12, "0x%x\n", le16_to_cpu(defs.channel));
+       return snprintf(buf, 12, "%d\n", le16_to_cpu(defs.channel));
 }
 
 /**
@@ -154,11 +154,11 @@ static ssize_t channel_set(struct device *dev, struct device_attribute *attr,
 {
        struct lbs_private *priv = to_net_dev(dev)->priv;
        struct cmd_ds_mesh_config cmd;
-       uint16_t datum;
+       uint32_t datum;
        int ret;
 
        memset(&cmd, 0, sizeof(cmd));
-       ret = sscanf(buf, "%hx", &datum);
+       ret = sscanf(buf, "%d", &datum);
        if (ret != 1 || datum < 1 || datum > 11)
                return -EINVAL;
 
@@ -274,8 +274,8 @@ static ssize_t protocol_id_set(struct device *dev,
        int ret;
 
        memset(&cmd, 0, sizeof(cmd));
-       ret = sscanf(buf, "%x", &datum);
-       if (ret != 1)
+       ret = sscanf(buf, "%d", &datum);
+       if ((ret != 1) || (datum > 255))
                return -EINVAL;
 
        /* fetch all other Information Element parameters */
@@ -328,8 +328,8 @@ static ssize_t metric_id_set(struct device *dev, struct device_attribute *attr,
        int ret;
 
        memset(&cmd, 0, sizeof(cmd));
-       ret = sscanf(buf, "%x", &datum);
-       if (ret != 1)
+       ret = sscanf(buf, "%d", &datum);
+       if ((ret != 1) || (datum > 255))
                return -EINVAL;
 
        /* fetch all other Information Element parameters */
@@ -382,8 +382,8 @@ static ssize_t capability_set(struct device *dev, struct device_attribute *attr,
        int ret;
 
        memset(&cmd, 0, sizeof(cmd));
-       ret = sscanf(buf, "%x", &datum);
-       if (ret != 1)
+       ret = sscanf(buf, "%d", &datum);
+       if ((ret != 1) || (datum > 255))
                return -EINVAL;
 
        /* fetch all other Information Element parameters */
index 5816230..248d31a 100644 (file)
@@ -500,7 +500,7 @@ failed_hw:
        device_unregister(data->dev);
 failed_drvdata:
        ieee80211_free_hw(hw);
-       hwsim_radios[i] = 0;
+       hwsim_radios[i] = NULL;
 failed:
        mac80211_hwsim_free();
        return err;
index c6f27b9..cac9a51 100644 (file)
@@ -52,6 +52,7 @@ struct p54_common {
        int (*open)(struct ieee80211_hw *dev);
        void (*stop)(struct ieee80211_hw *dev);
        int mode;
+       struct mutex conf_mutex;
        u8 mac_addr[ETH_ALEN];
        u8 bssid[ETH_ALEN];
        struct pda_iq_autocal_entry *iq_autocal;
index ffaf7a6..4da89ea 100644 (file)
@@ -886,9 +886,12 @@ static void p54_remove_interface(struct ieee80211_hw *dev,
 static int p54_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf)
 {
        int ret;
+       struct p54_common *priv = dev->priv;
 
+       mutex_lock(&priv->conf_mutex);
        ret = p54_set_freq(dev, cpu_to_le16(conf->channel->center_freq));
        p54_set_vdcf(dev);
+       mutex_unlock(&priv->conf_mutex);
        return ret;
 }
 
@@ -898,10 +901,12 @@ static int p54_config_interface(struct ieee80211_hw *dev,
 {
        struct p54_common *priv = dev->priv;
 
+       mutex_lock(&priv->conf_mutex);
        p54_set_filter(dev, 0, priv->mac_addr, conf->bssid, 0, 1, 0, 0xF642);
        p54_set_filter(dev, 0, priv->mac_addr, conf->bssid, 2, 0, 0, 0);
        p54_set_leds(dev, 1, !is_multicast_ether_addr(conf->bssid), 0);
        memcpy(priv->bssid, conf->bssid, ETH_ALEN);
+       mutex_unlock(&priv->conf_mutex);
        return 0;
 }
 
@@ -1009,6 +1014,7 @@ struct ieee80211_hw *p54_init_common(size_t priv_data_len)
        }
 
        p54_init_vdcf(dev);
+       mutex_init(&priv->conf_mutex);
 
        return dev;
 }
index 97fa14e..3d75a71 100644 (file)
@@ -2518,7 +2518,7 @@ enum {
 
 #define PRISM2_HOSTAPD_MAX_BUF_SIZE 1024
 #define PRISM2_HOSTAPD_GENERIC_ELEMENT_HDR_LEN \
-((int) (&((struct prism2_hostapd_param *) 0)->u.generic_elem.data))
+       offsetof(struct prism2_hostapd_param, u.generic_elem.data)
 
 /* Maximum length for algorithm names (-1 for nul termination)
  * used in ioctl() */
index aa6dfb8..181a146 100644 (file)
@@ -1220,6 +1220,7 @@ static void rt2500pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,
        rt2x00_set_field32(&word, TXD_W0_IFS, txdesc->ifs);
        rt2x00_set_field32(&word, TXD_W0_RETRY_MODE,
                           test_bit(ENTRY_TXD_RETRY_MODE, &txdesc->flags));
+       rt2x00_set_field32(&word, TXD_W0_DATABYTE_COUNT, skb->len);
        rt2x00_set_field32(&word, TXD_W0_CIPHER_ALG, CIPHER_NONE);
        rt2x00_desc_write(txd, 0, word);
 }
index 3558cb2..cd5af65 100644 (file)
@@ -633,6 +633,16 @@ static void rt2500usb_reset_tuner(struct rt2x00_dev *rt2x00dev)
        rt2x00dev->link.vgc_level = value;
 }
 
+/*
+ * NOTE: This function is directly ported from legacy driver, but
+ * despite it being declared it was never called. Although link tuning
+ * sounds like a good idea, and usually works well for the other drivers,
+ * it does _not_ work with rt2500usb. Enabling this function will result
+ * in TX capabilities only until association kicks in. Immediately
+ * after the successful association all TX frames will be kept in the
+ * hardware queue and never transmitted.
+ */
+#if 0
 static void rt2500usb_link_tuner(struct rt2x00_dev *rt2x00dev)
 {
        int rssi = rt2x00_get_link_rssi(&rt2x00dev->link);
@@ -752,6 +762,9 @@ dynamic_cca_tune:
                rt2x00dev->link.vgc_level = r17;
        }
 }
+#else
+#define rt2500usb_link_tuner   NULL
+#endif
 
 /*
  * Initialization functions.
@@ -1121,6 +1134,7 @@ static void rt2500usb_write_beacon(struct queue_entry *entry)
        int pipe = usb_sndbulkpipe(usb_dev, 1);
        int length;
        u16 reg;
+       u32 word, len;
 
        /*
         * Add the descriptor in front of the skb.
@@ -1129,6 +1143,17 @@ static void rt2500usb_write_beacon(struct queue_entry *entry)
        memcpy(entry->skb->data, skbdesc->desc, skbdesc->desc_len);
        skbdesc->desc = entry->skb->data;
 
+       /*
+        * Adjust the beacon databyte count. The current number is
+        * calculated before this function gets called, but falsely
+        * assumes that the descriptor was already present in the SKB.
+        */
+       rt2x00_desc_read(skbdesc->desc, 0, &word);
+       len  = rt2x00_get_field32(word, TXD_W0_DATABYTE_COUNT);
+       len += skbdesc->desc_len;
+       rt2x00_set_field32(&word, TXD_W0_DATABYTE_COUNT, len);
+       rt2x00_desc_write(skbdesc->desc, 0, word);
+
        /*
         * Disable beaconing while we are reloading the beacon data,
         * otherwise we might be sending out invalid data.
@@ -1364,6 +1389,9 @@ static int rt2500usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)
                rt2x00_set_field16(&word, EEPROM_BBPTUNE_VGCLOWER, bbp);
                rt2x00_eeprom_write(rt2x00dev, EEPROM_BBPTUNE_VGC, word);
                EEPROM(rt2x00dev, "BBPtune vgc: 0x%04x\n", word);
+       } else {
+               rt2x00_set_field16(&word, EEPROM_BBPTUNE_VGCLOWER, bbp);
+               rt2x00_eeprom_write(rt2x00dev, EEPROM_BBPTUNE_VGC, word);
        }
 
        rt2x00_eeprom_read(rt2x00dev, EEPROM_BBPTUNE_R17, &word);
@@ -1372,9 +1400,6 @@ static int rt2500usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)
                rt2x00_set_field16(&word, EEPROM_BBPTUNE_R17_HIGH, 0x41);
                rt2x00_eeprom_write(rt2x00dev, EEPROM_BBPTUNE_R17, word);
                EEPROM(rt2x00dev, "BBPtune r17: 0x%04x\n", word);
-       } else {
-               rt2x00_set_field16(&word, EEPROM_BBPTUNE_VGCLOWER, bbp);
-               rt2x00_eeprom_write(rt2x00dev, EEPROM_BBPTUNE_VGC, word);
        }
 
        rt2x00_eeprom_read(rt2x00dev, EEPROM_BBPTUNE_R24, &word);
@@ -1650,7 +1675,6 @@ static void rt2500usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
         * Initialize all hw fields.
         */
        rt2x00dev->hw->flags =
-           IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE |
            IEEE80211_HW_RX_INCLUDES_FCS |
            IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
            IEEE80211_HW_SIGNAL_DBM;
@@ -1726,6 +1750,7 @@ static int rt2500usb_probe_hw(struct rt2x00_dev *rt2x00dev)
        __set_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags);
        __set_bit(DRIVER_REQUIRE_BEACON_GUARD, &rt2x00dev->flags);
        __set_bit(DRIVER_REQUIRE_SCHEDULED, &rt2x00dev->flags);
+       __set_bit(CONFIG_DISABLE_LINK_TUNING, &rt2x00dev->flags);
 
        /*
         * Set the rssi offset.
index 07b03b3..8b10ea4 100644 (file)
 #define SHORT_PIFS             ( SIFS + SHORT_SLOT_TIME )
 #define DIFS                   ( PIFS + SLOT_TIME )
 #define SHORT_DIFS             ( SHORT_PIFS + SHORT_SLOT_TIME )
-#define EIFS                   ( SIFS + (8 * (IEEE80211_HEADER + ACK_SIZE)) )
+#define EIFS                   ( SIFS + DIFS + \
+                                 (8 * (IEEE80211_HEADER + ACK_SIZE)) )
+#define SHORT_EIFS             ( SIFS + SHORT_DIFS + \
+                                 (8 * (IEEE80211_HEADER + ACK_SIZE)) )
 
 /*
  * Chipset identification
@@ -365,6 +368,12 @@ struct rt2x00_intf {
 #define DELAYED_CONFIG_ERP             0x00000002
 #define DELAYED_LED_ASSOC              0x00000004
 
+       /*
+        * Software sequence counter, this is only required
+        * for hardware which doesn't support hardware
+        * sequence counting.
+        */
+       spinlock_t seqlock;
        u16 seqno;
 };
 
@@ -597,6 +606,7 @@ enum rt2x00_flags {
        DEVICE_STARTED_SUSPEND,
        DEVICE_ENABLED_RADIO,
        DEVICE_DISABLED_RADIO_HW,
+       DEVICE_DIRTY_CONFIG,
 
        /*
         * Driver features
index f20ca71..d134c3b 100644 (file)
@@ -254,6 +254,8 @@ config:
                        libconf.ant.rx = default_ant->rx;
                else if (active_ant->rx == ANTENNA_SW_DIVERSITY)
                        libconf.ant.rx = ANTENNA_B;
+               else
+                       libconf.ant.rx = active_ant->rx;
 
                if (conf->antenna_sel_tx)
                        libconf.ant.tx = conf->antenna_sel_tx;
@@ -261,6 +263,8 @@ config:
                        libconf.ant.tx = default_ant->tx;
                else if (active_ant->tx == ANTENNA_SW_DIVERSITY)
                        libconf.ant.tx = ANTENNA_B;
+               else
+                       libconf.ant.tx = active_ant->tx;
        }
 
        if (flags & CONFIG_UPDATE_SLOT_TIME) {
@@ -271,7 +275,7 @@ config:
                libconf.sifs = SIFS;
                libconf.pifs = short_slot_time ? SHORT_PIFS : PIFS;
                libconf.difs = short_slot_time ? SHORT_DIFS : DIFS;
-               libconf.eifs = EIFS;
+               libconf.eifs = short_slot_time ? SHORT_EIFS : EIFS;
        }
 
        libconf.conf = conf;
index 300cf06..6bee1d6 100644 (file)
@@ -372,9 +372,6 @@ static ssize_t rt2x00debug_write_##__name(struct file *file,        \
        if (*offset)                                            \
                return 0;                                       \
                                                                \
-       if (!capable(CAP_NET_ADMIN))                            \
-               return -EPERM;                                  \
-                                                               \
        if (intf->offset_##__name >= debug->__name.word_count)  \
                return -EINVAL;                                 \
                                                                \
@@ -454,7 +451,7 @@ static struct dentry *rt2x00debug_create_file_driver(const char *name,
        data += sprintf(data, "compiled: %s %s\n", __DATE__, __TIME__);
        blob->size = strlen(blob->data);
 
-       return debugfs_create_blob(name, S_IRUGO, intf->driver_folder, blob);
+       return debugfs_create_blob(name, S_IRUSR, intf->driver_folder, blob);
 }
 
 static struct dentry *rt2x00debug_create_file_chipset(const char *name,
@@ -482,7 +479,7 @@ static struct dentry *rt2x00debug_create_file_chipset(const char *name,
        data += sprintf(data, "rf length: %d\n", debug->rf.word_count);
        blob->size = strlen(blob->data);
 
-       return debugfs_create_blob(name, S_IRUGO, intf->driver_folder, blob);
+       return debugfs_create_blob(name, S_IRUSR, intf->driver_folder, blob);
 }
 
 void rt2x00debug_register(struct rt2x00_dev *rt2x00dev)
@@ -517,7 +514,7 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev)
        if (IS_ERR(intf->chipset_entry))
                goto exit;
 
-       intf->dev_flags = debugfs_create_file("dev_flags", S_IRUGO,
+       intf->dev_flags = debugfs_create_file("dev_flags", S_IRUSR,
                                              intf->driver_folder, intf,
                                              &rt2x00debug_fop_dev_flags);
        if (IS_ERR(intf->dev_flags))
@@ -532,7 +529,7 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev)
 ({                                                             \
        (__intf)->__name##_off_entry =                          \
            debugfs_create_u32(__stringify(__name) "_offset",   \
-                              S_IRUGO | S_IWUSR,               \
+                              S_IRUSR | S_IWUSR,               \
                               (__intf)->register_folder,       \
                               &(__intf)->offset_##__name);     \
        if (IS_ERR((__intf)->__name##_off_entry))               \
@@ -540,7 +537,7 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev)
                                                                \
        (__intf)->__name##_val_entry =                          \
            debugfs_create_file(__stringify(__name) "_value",   \
-                               S_IRUGO | S_IWUSR,              \
+                               S_IRUSR | S_IWUSR,              \
                                (__intf)->register_folder,      \
                                (__intf), &rt2x00debug_fop_##__name);\
        if (IS_ERR((__intf)->__name##_val_entry))               \
@@ -560,7 +557,7 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev)
                goto exit;
 
        intf->queue_frame_dump_entry =
-           debugfs_create_file("dump", S_IRUGO, intf->queue_folder,
+           debugfs_create_file("dump", S_IRUSR, intf->queue_folder,
                                intf, &rt2x00debug_fop_queue_dump);
        if (IS_ERR(intf->queue_frame_dump_entry))
                goto exit;
@@ -569,7 +566,7 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev)
        init_waitqueue_head(&intf->frame_dump_waitqueue);
 
        intf->queue_stats_entry =
-           debugfs_create_file("queue", S_IRUGO, intf->queue_folder,
+           debugfs_create_file("queue", S_IRUSR, intf->queue_folder,
                                intf, &rt2x00debug_fop_queue_stats);
 
        return;
index 8c93eb8..f42283a 100644 (file)
@@ -1013,6 +1013,7 @@ int rt2x00lib_start(struct rt2x00_dev *rt2x00dev)
        rt2x00dev->intf_associated = 0;
 
        __set_bit(DEVICE_STARTED, &rt2x00dev->flags);
+       __set_bit(DEVICE_DIRTY_CONFIG, &rt2x00dev->flags);
 
        return 0;
 }
@@ -1237,9 +1238,9 @@ int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev)
        /*
         * Reconfigure device.
         */
-       rt2x00lib_config(rt2x00dev, &rt2x00dev->hw->conf, 1);
-       if (!rt2x00dev->hw->conf.radio_enabled)
-               rt2x00lib_disable_radio(rt2x00dev);
+       retval = rt2x00mac_config(rt2x00dev->hw, &rt2x00dev->hw->conf);
+       if (retval)
+               goto exit;
 
        /*
         * Iterator over each active interface to
index f2c9b0e..c5fb3a7 100644 (file)
@@ -124,13 +124,6 @@ void rt2x00queue_unmap_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb);
  */
 void rt2x00queue_free_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb);
 
-/**
- * rt2x00queue_free_skb - free a skb
- * @rt2x00dev: Pointer to &struct rt2x00_dev.
- * @skb: The skb to free.
- */
-void rt2x00queue_free_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb);
-
 /**
  * rt2x00queue_write_tx_frame - Write TX frame to hardware
  * @queue: Queue over which the frame should be send
index f1dcbaa..bd422fd 100644 (file)
@@ -63,7 +63,7 @@ static int rt2x00mac_tx_rts_cts(struct rt2x00_dev *rt2x00dev,
         */
        memcpy(skb->cb, frag_skb->cb, sizeof(skb->cb));
        rts_info = IEEE80211_SKB_CB(skb);
-       rts_info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT;
+       rts_info->control.hw_key = NULL;
        rts_info->flags &= ~IEEE80211_TX_CTL_USE_RTS_CTS;
        rts_info->flags &= ~IEEE80211_TX_CTL_USE_CTS_PROTECT;
        rts_info->flags &= ~IEEE80211_TX_CTL_REQ_TX_STATUS;
@@ -83,6 +83,7 @@ static int rt2x00mac_tx_rts_cts(struct rt2x00_dev *rt2x00dev,
                                  (struct ieee80211_rts *)(skb->data));
 
        if (rt2x00queue_write_tx_frame(queue, skb)) {
+               dev_kfree_skb_any(skb);
                WARNING(rt2x00dev, "Failed to send RTS/CTS frame.\n");
                return NETDEV_TX_BUSY;
        }
@@ -96,7 +97,6 @@ int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
        struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
        struct ieee80211_hdr *ieee80211hdr = (struct ieee80211_hdr *)skb->data;
        enum data_queue_qid qid = skb_get_queue_mapping(skb);
-       struct rt2x00_intf *intf = vif_to_intf(tx_info->control.vif);
        struct data_queue *queue;
        u16 frame_control;
 
@@ -152,18 +152,6 @@ int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
                }
        }
 
-       /*
-        * XXX: This is as wrong as the old mac80211 code was,
-        *      due to beacons not getting sequence numbers assigned
-        *      properly.
-        */
-       if (tx_info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
-               if (tx_info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)
-                       intf->seqno += 0x10;
-               ieee80211hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
-               ieee80211hdr->seq_ctrl |= cpu_to_le16(intf->seqno);
-       }
-
        if (rt2x00queue_write_tx_frame(queue, skb)) {
                ieee80211_stop_queue(rt2x00dev->hw, qid);
                return NETDEV_TX_BUSY;
@@ -259,6 +247,7 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw,
                rt2x00dev->intf_sta_count++;
 
        spin_lock_init(&intf->lock);
+       spin_lock_init(&intf->seqlock);
        intf->beacon = entry;
 
        if (conf->type == IEEE80211_IF_TYPE_AP)
@@ -322,6 +311,7 @@ EXPORT_SYMBOL_GPL(rt2x00mac_remove_interface);
 int rt2x00mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
 {
        struct rt2x00_dev *rt2x00dev = hw->priv;
+       int force_reconfig;
 
        /*
         * Mac80211 might be calling this function while we are trying
@@ -341,7 +331,17 @@ int rt2x00mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
                        rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_OFF);
        }
 
-       rt2x00lib_config(rt2x00dev, conf, 0);
+       /*
+        * When the DEVICE_DIRTY_CONFIG flag is set, the device has recently
+        * been started and the configuration must be forced upon the hardware.
+        * Otherwise registers will not be intialized correctly and could
+        * result in non-working hardware because essential registers aren't
+        * initialized.
+        */
+       force_reconfig =
+           __test_and_clear_bit(DEVICE_DIRTY_CONFIG, &rt2x00dev->flags);
+
+       rt2x00lib_config(rt2x00dev, conf, force_reconfig);
 
        /*
         * Reenable RX only if the radio should be on.
index 7f44203..898cdd7 100644 (file)
@@ -120,6 +120,7 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
 {
        struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
        struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb);
+       struct rt2x00_intf *intf = vif_to_intf(tx_info->control.vif);
        struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)entry->skb->data;
        struct ieee80211_rate *rate =
            ieee80211_get_tx_rate(rt2x00dev->hw, tx_info);
@@ -127,6 +128,7 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
        unsigned int data_length;
        unsigned int duration;
        unsigned int residual;
+       unsigned long irqflags;
 
        memset(txdesc, 0, sizeof(*txdesc));
 
@@ -199,6 +201,31 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
                txdesc->ifs = IFS_SIFS;
        }
 
+       /*
+        * Hardware should insert sequence counter.
+        * FIXME: We insert a software sequence counter first for
+        * hardware that doesn't support hardware sequence counting.
+        *
+        * This is wrong because beacons are not getting sequence
+        * numbers assigned properly.
+        *
+        * A secondary problem exists for drivers that cannot toggle
+        * sequence counting per-frame, since those will override the
+        * sequence counter given by mac80211.
+        */
+       if (tx_info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
+               spin_lock_irqsave(&intf->seqlock, irqflags);
+
+               if (test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags))
+                       intf->seqno += 0x10;
+               hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
+               hdr->seq_ctrl |= cpu_to_le16(intf->seqno);
+
+               spin_unlock_irqrestore(&intf->seqlock, irqflags);
+
+               __set_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags);
+       }
+
        /*
         * PLCP setup
         * Length calculation depends on OFDM/CCK rate.
@@ -466,9 +493,12 @@ void rt2x00queue_init_rx(struct rt2x00_dev *rt2x00dev)
        if (!rt2x00dev->ops->lib->init_rxentry)
                return;
 
-       for (i = 0; i < queue->limit; i++)
+       for (i = 0; i < queue->limit; i++) {
+               queue->entries[i].flags = 0;
+
                rt2x00dev->ops->lib->init_rxentry(rt2x00dev,
                                                  &queue->entries[i]);
+       }
 }
 
 void rt2x00queue_init_tx(struct rt2x00_dev *rt2x00dev)
@@ -482,9 +512,12 @@ void rt2x00queue_init_tx(struct rt2x00_dev *rt2x00dev)
                if (!rt2x00dev->ops->lib->init_txentry)
                        continue;
 
-               for (i = 0; i < queue->limit; i++)
+               for (i = 0; i < queue->limit; i++) {
+                       queue->entries[i].flags = 0;
+
                        rt2x00dev->ops->lib->init_txentry(rt2x00dev,
                                                          &queue->entries[i]);
+               }
        }
 }
 
index 8945945..a4a8c57 100644 (file)
@@ -199,6 +199,7 @@ struct txdone_entry_desc {
  * @ENTRY_TXD_RTS_FRAME: This frame is a RTS frame.
  * @ENTRY_TXD_CTS_FRAME: This frame is a CTS-to-self frame.
  * @ENTRY_TXD_OFDM_RATE: This frame is send out with an OFDM rate.
+ * @ENTRY_TXD_GENERATE_SEQ: This frame requires sequence counter.
  * @ENTRY_TXD_FIRST_FRAGMENT: This is the first frame.
  * @ENTRY_TXD_MORE_FRAG: This frame is followed by another fragment.
  * @ENTRY_TXD_REQ_TIMESTAMP: Require timestamp to be inserted.
@@ -210,6 +211,7 @@ enum txentry_desc_flags {
        ENTRY_TXD_RTS_FRAME,
        ENTRY_TXD_CTS_FRAME,
        ENTRY_TXD_OFDM_RATE,
+       ENTRY_TXD_GENERATE_SEQ,
        ENTRY_TXD_FIRST_FRAGMENT,
        ENTRY_TXD_MORE_FRAG,
        ENTRY_TXD_REQ_TIMESTAMP,
index 83862e7..8d76bb2 100644 (file)
@@ -122,6 +122,38 @@ int rt2x00usb_vendor_request_buff(struct rt2x00_dev *rt2x00dev,
 }
 EXPORT_SYMBOL_GPL(rt2x00usb_vendor_request_buff);
 
+int rt2x00usb_vendor_request_large_buff(struct rt2x00_dev *rt2x00dev,
+                                       const u8 request, const u8 requesttype,
+                                       const u16 offset, const void *buffer,
+                                       const u16 buffer_length,
+                                       const int timeout)
+{
+       int status = 0;
+       unsigned char *tb;
+       u16 off, len, bsize;
+
+       mutex_lock(&rt2x00dev->usb_cache_mutex);
+
+       tb  = (char *)buffer;
+       off = offset;
+       len = buffer_length;
+       while (len && !status) {
+               bsize = min_t(u16, CSR_CACHE_SIZE, len);
+               status = rt2x00usb_vendor_req_buff_lock(rt2x00dev, request,
+                                                       requesttype, off, tb,
+                                                       bsize, timeout);
+
+               tb  += bsize;
+               len -= bsize;
+               off += bsize;
+       }
+
+       mutex_unlock(&rt2x00dev->usb_cache_mutex);
+
+       return status;
+}
+EXPORT_SYMBOL_GPL(rt2x00usb_vendor_request_large_buff);
+
 /*
  * TX data handlers.
  */
index aad794a..3b4a674 100644 (file)
@@ -70,8 +70,7 @@
 /*
  * Cache size
  */
-#define CSR_CACHE_SIZE                 8
-#define CSR_CACHE_SIZE_FIRMWARE                64
+#define CSR_CACHE_SIZE                 64
 
 /*
  * USB request types.
@@ -171,6 +170,25 @@ int rt2x00usb_vendor_req_buff_lock(struct rt2x00_dev *rt2x00dev,
                                   const u16 offset, void *buffer,
                                   const u16 buffer_length, const int timeout);
 
+/**
+ * rt2x00usb_vendor_request_large_buff - Send register command to device (buffered)
+ * @rt2x00dev: Pointer to &struct rt2x00_dev
+ * @request: USB vendor command (See &enum rt2x00usb_vendor_request)
+ * @requesttype: Request type &USB_VENDOR_REQUEST_*
+ * @offset: Register start offset to perform action on
+ * @buffer: Buffer where information will be read/written to by device
+ * @buffer_length: Size of &buffer
+ * @timeout: Operation timeout
+ *
+ * This function is used to transfer register data in blocks larger
+ * then CSR_CACHE_SIZE. Use for firmware upload, keys and beacons.
+ */
+int rt2x00usb_vendor_request_large_buff(struct rt2x00_dev *rt2x00dev,
+                                       const u8 request, const u8 requesttype,
+                                       const u16 offset, const void *buffer,
+                                       const u16 buffer_length,
+                                       const int timeout);
+
 /**
  * rt2x00usb_vendor_request_sw - Send single register command to device
  * @rt2x00dev: Pointer to &struct rt2x00_dev
index f7c1f92..087e90b 100644 (file)
@@ -1003,6 +1003,11 @@ static int rt61pci_load_firmware(struct rt2x00_dev *rt2x00dev, const void *data,
                return -EBUSY;
        }
 
+       /*
+        * Hardware needs another millisecond before it is ready.
+        */
+       msleep(1);
+
        /*
         * Reset MAC and BBP registers.
         */
@@ -1544,7 +1549,8 @@ static void rt61pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,
        rt2x00_set_field32(&word, TXD_W1_CWMIN, txdesc->cw_min);
        rt2x00_set_field32(&word, TXD_W1_CWMAX, txdesc->cw_max);
        rt2x00_set_field32(&word, TXD_W1_IV_OFFSET, IEEE80211_HEADER);
-       rt2x00_set_field32(&word, TXD_W1_HW_SEQUENCE, 1);
+       rt2x00_set_field32(&word, TXD_W1_HW_SEQUENCE,
+                          test_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags));
        rt2x00_set_field32(&word, TXD_W1_BUFFER_COUNT, 1);
        rt2x00_desc_write(txd, 1, word);
 
@@ -2278,7 +2284,6 @@ static void rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
         * Initialize all hw fields.
         */
        rt2x00dev->hw->flags =
-           IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE |
            IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
            IEEE80211_HW_SIGNAL_DBM;
        rt2x00dev->hw->extra_tx_headroom = 0;
index d383735..9761eaa 100644 (file)
@@ -890,9 +890,6 @@ static int rt73usb_load_firmware(struct rt2x00_dev *rt2x00dev, const void *data,
        unsigned int i;
        int status;
        u32 reg;
-       const char *ptr = data;
-       char *cache;
-       int buflen;
 
        /*
         * Wait for stable hardware.
@@ -911,31 +908,12 @@ static int rt73usb_load_firmware(struct rt2x00_dev *rt2x00dev, const void *data,
 
        /*
         * Write firmware to device.
-        * We setup a seperate cache for this action,
-        * since we are going to write larger chunks of data
-        * then normally used cache size.
         */
-       cache = kmalloc(CSR_CACHE_SIZE_FIRMWARE, GFP_KERNEL);
-       if (!cache) {
-               ERROR(rt2x00dev, "Failed to allocate firmware cache.\n");
-               return -ENOMEM;
-       }
-
-       for (i = 0; i < len; i += CSR_CACHE_SIZE_FIRMWARE) {
-               buflen = min_t(int, len - i, CSR_CACHE_SIZE_FIRMWARE);
-
-               memcpy(cache, ptr, buflen);
-
-               rt2x00usb_vendor_request(rt2x00dev, USB_MULTI_WRITE,
-                                        USB_VENDOR_REQUEST_OUT,
-                                        FIRMWARE_IMAGE_BASE + i, 0,
-                                        cache, buflen,
-                                        REGISTER_TIMEOUT32(buflen));
-
-               ptr += buflen;
-       }
-
-       kfree(cache);
+       rt2x00usb_vendor_request_large_buff(rt2x00dev, USB_MULTI_WRITE,
+                                           USB_VENDOR_REQUEST_OUT,
+                                           FIRMWARE_IMAGE_BASE,
+                                           data, len,
+                                           REGISTER_TIMEOUT32(len));
 
        /*
         * Send firmware request to device to load firmware,
@@ -1303,7 +1281,8 @@ static void rt73usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,
        rt2x00_set_field32(&word, TXD_W1_CWMIN, txdesc->cw_min);
        rt2x00_set_field32(&word, TXD_W1_CWMAX, txdesc->cw_max);
        rt2x00_set_field32(&word, TXD_W1_IV_OFFSET, IEEE80211_HEADER);
-       rt2x00_set_field32(&word, TXD_W1_HW_SEQUENCE, 1);
+       rt2x00_set_field32(&word, TXD_W1_HW_SEQUENCE,
+                          test_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags));
        rt2x00_desc_write(txd, 1, word);
 
        rt2x00_desc_read(txd, 2, &word);
@@ -1352,6 +1331,7 @@ static void rt73usb_write_beacon(struct queue_entry *entry)
        struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
        unsigned int beacon_base;
        u32 reg;
+       u32 word, len;
 
        /*
         * Add the descriptor in front of the skb.
@@ -1360,6 +1340,17 @@ static void rt73usb_write_beacon(struct queue_entry *entry)
        memcpy(entry->skb->data, skbdesc->desc, skbdesc->desc_len);
        skbdesc->desc = entry->skb->data;
 
+       /*
+        * Adjust the beacon databyte count. The current number is
+        * calculated before this function gets called, but falsely
+        * assumes that the descriptor was already present in the SKB.
+        */
+       rt2x00_desc_read(skbdesc->desc, 0, &word);
+       len  = rt2x00_get_field32(word, TXD_W0_DATABYTE_COUNT);
+       len += skbdesc->desc_len;
+       rt2x00_set_field32(&word, TXD_W0_DATABYTE_COUNT, len);
+       rt2x00_desc_write(skbdesc->desc, 0, word);
+
        /*
         * Disable beaconing while we are reloading the beacon data,
         * otherwise we might be sending out invalid data.
@@ -1374,10 +1365,10 @@ static void rt73usb_write_beacon(struct queue_entry *entry)
         * Write entire beacon with descriptor to register.
         */
        beacon_base = HW_BEACON_OFFSET(entry->entry_idx);
-       rt2x00usb_vendor_request(rt2x00dev, USB_MULTI_WRITE,
-                                USB_VENDOR_REQUEST_OUT, beacon_base, 0,
-                                entry->skb->data, entry->skb->len,
-                                REGISTER_TIMEOUT32(entry->skb->len));
+       rt2x00usb_vendor_request_large_buff(rt2x00dev, USB_MULTI_WRITE,
+                                           USB_VENDOR_REQUEST_OUT, beacon_base,
+                                           entry->skb->data, entry->skb->len,
+                                           REGISTER_TIMEOUT32(entry->skb->len));
 
        /*
         * Clean up the beacon skb.
@@ -1871,7 +1862,6 @@ static void rt73usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
         * Initialize all hw fields.
         */
        rt2x00dev->hw->flags =
-           IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE |
            IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
            IEEE80211_HW_SIGNAL_DBM;
        rt2x00dev->hw->extra_tx_headroom = TXD_DESC_SIZE;
index 3afb49f..5a9515c 100644 (file)
@@ -47,11 +47,13 @@ struct rtl8187_rx_hdr {
 struct rtl8187b_rx_hdr {
        __le32 flags;
        __le64 mac_time;
-       u8 noise;
-       u8 signal;
+       u8 sq;
+       u8 rssi;
        u8 agc;
-       u8 reserved;
-       __le32 unused;
+       u8 flags2;
+       __le16 snr_long2end;
+       s8 pwdb_g12;
+       u8 fot;
 } __attribute__((packed));
 
 /* {rtl8187,rtl8187b}_tx_info is in skb */
@@ -92,6 +94,10 @@ struct rtl8187_priv {
        const struct rtl818x_rf_ops *rf;
        struct ieee80211_vif *vif;
        int mode;
+       /* The mutex protects the TX loopback state.
+        * Any attempt to set channels concurrently locks the device.
+        */
+       struct mutex conf_mutex;
 
        /* rtl8187 specific */
        struct ieee80211_channel channels[14];
@@ -100,6 +106,7 @@ struct rtl8187_priv {
        struct usb_device *udev;
        u32 rx_conf;
        u16 txpwr_base;
+       u16 seqno;
        u8 asic_rev;
        u8 is_rtl8187b;
        enum {
index d3067b1..57376fb 100644 (file)
@@ -31,6 +31,8 @@ MODULE_DESCRIPTION("RTL8187/RTL8187B USB wireless driver");
 MODULE_LICENSE("GPL");
 
 static struct usb_device_id rtl8187_table[] __devinitdata = {
+       /* Asus */
+       {USB_DEVICE(0x0b05, 0x171d), .driver_info = DEVICE_RTL8187},
        /* Realtek */
        {USB_DEVICE(0x0bda, 0x8187), .driver_info = DEVICE_RTL8187},
        {USB_DEVICE(0x0bda, 0x8189), .driver_info = DEVICE_RTL8187B},
@@ -169,6 +171,7 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
 {
        struct rtl8187_priv *priv = dev->priv;
        struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+       struct ieee80211_hdr *ieee80211hdr = (struct ieee80211_hdr *)skb->data;
        unsigned int ep;
        void *buf;
        struct urb *urb;
@@ -234,6 +237,20 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
                        ep = epmap[skb_get_queue_mapping(skb)];
        }
 
+       /* FIXME: The sequence that follows is needed for this driver to
+        * work with mac80211 since "mac80211: fix TX sequence numbers".
+        * As with the temporary code in rt2x00, changes will be needed
+        * to get proper sequence numbers on beacons. In addition, this
+        * patch places the sequence number in the hardware state, which
+        * limits us to a single virtual state.
+        */
+       if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
+               if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)
+                       priv->seqno += 0x10;
+               ieee80211hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
+               ieee80211hdr->seq_ctrl |= cpu_to_le16(priv->seqno);
+       }
+
        info->driver_data[0] = dev;
        info->driver_data[1] = urb;
 
@@ -257,6 +274,7 @@ static void rtl8187_rx_cb(struct urb *urb)
        struct ieee80211_rx_status rx_status = { 0 };
        int rate, signal;
        u32 flags;
+       u32 quality;
 
        spin_lock(&priv->rx_queue.lock);
        if (skb->next)
@@ -280,44 +298,57 @@ static void rtl8187_rx_cb(struct urb *urb)
                flags = le32_to_cpu(hdr->flags);
                signal = hdr->signal & 0x7f;
                rx_status.antenna = (hdr->signal >> 7) & 1;
-               rx_status.signal = signal;
                rx_status.noise = hdr->noise;
                rx_status.mactime = le64_to_cpu(hdr->mac_time);
-               priv->signal = signal;
                priv->quality = signal;
+               rx_status.qual = priv->quality;
                priv->noise = hdr->noise;
+               rate = (flags >> 20) & 0xF;
+               if (rate > 3) { /* OFDM rate */
+                       if (signal > 90)
+                               signal = 90;
+                       else if (signal < 25)
+                               signal = 25;
+                       signal = 90 - signal;
+               } else {        /* CCK rate */
+                       if (signal > 95)
+                               signal = 95;
+                       else if (signal < 30)
+                               signal = 30;
+                       signal = 95 - signal;
+               }
+               rx_status.signal = signal;
+               priv->signal = signal;
        } else {
                struct rtl8187b_rx_hdr *hdr =
                        (typeof(hdr))(skb_tail_pointer(skb) - sizeof(*hdr));
+               /* The Realtek datasheet for the RTL8187B shows that the RX
+                * header contains the following quantities: signal quality,
+                * RSSI, AGC, the received power in dB, and the measured SNR.
+                * In testing, none of these quantities show qualitative
+                * agreement with AP signal strength, except for the AGC,
+                * which is inversely proportional to the strength of the
+                * signal. In the following, the quality and signal strength
+                * are derived from the AGC. The arbitrary scaling constants
+                * are chosen to make the results close to the values obtained
+                * for a BCM4312 using b43 as the driver. The noise is ignored
+                * for now.
+                */
                flags = le32_to_cpu(hdr->flags);
-               signal = hdr->agc >> 1;
-               rx_status.antenna = (hdr->signal >> 7) & 1;
-               rx_status.signal = 64 - min(hdr->noise, (u8)64);
-               rx_status.noise = hdr->noise;
+               quality = 170 - hdr->agc;
+               if (quality > 100)
+                       quality = 100;
+               signal = 14 - hdr->agc / 2;
+               rx_status.qual = quality;
+               priv->quality = quality;
+               rx_status.signal = signal;
+               priv->signal = signal;
+               rx_status.antenna = (hdr->rssi >> 7) & 1;
                rx_status.mactime = le64_to_cpu(hdr->mac_time);
-               priv->signal = hdr->signal;
-               priv->quality = hdr->agc >> 1;
-               priv->noise = hdr->noise;
+               rate = (flags >> 20) & 0xF;
        }
 
        skb_trim(skb, flags & 0x0FFF);
-       rate = (flags >> 20) & 0xF;
-       if (rate > 3) { /* OFDM rate */
-               if (signal > 90)
-                       signal = 90;
-               else if (signal < 25)
-                       signal = 25;
-               signal = 90 - signal;
-       } else {        /* CCK rate */
-               if (signal > 95)
-                       signal = 95;
-               else if (signal < 30)
-                       signal = 30;
-               signal = 95 - signal;
-       }
-
-       rx_status.qual = priv->quality;
-       rx_status.signal = signal;
        rx_status.rate_idx = rate;
        rx_status.freq = dev->conf.channel->center_freq;
        rx_status.band = dev->conf.channel->band;
@@ -697,6 +728,7 @@ static int rtl8187_start(struct ieee80211_hw *dev)
        if (ret)
                return ret;
 
+       mutex_lock(&priv->conf_mutex);
        if (priv->is_rtl8187b) {
                reg = RTL818X_RX_CONF_MGMT |
                      RTL818X_RX_CONF_DATA |
@@ -718,6 +750,7 @@ static int rtl8187_start(struct ieee80211_hw *dev)
                                  (7 << 0  /* long retry limit */) |
                                  (7 << 21 /* MAX TX DMA */));
                rtl8187_init_urbs(dev);
+               mutex_unlock(&priv->conf_mutex);
                return 0;
        }
 
@@ -761,6 +794,7 @@ static int rtl8187_start(struct ieee80211_hw *dev)
        reg |= RTL818X_CMD_TX_ENABLE;
        reg |= RTL818X_CMD_RX_ENABLE;
        rtl818x_iowrite8(priv, &priv->map->CMD, reg);
+       mutex_unlock(&priv->conf_mutex);
 
        return 0;
 }
@@ -772,6 +806,7 @@ static void rtl8187_stop(struct ieee80211_hw *dev)
        struct sk_buff *skb;
        u32 reg;
 
+       mutex_lock(&priv->conf_mutex);
        rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0);
 
        reg = rtl818x_ioread8(priv, &priv->map->CMD);
@@ -791,7 +826,7 @@ static void rtl8187_stop(struct ieee80211_hw *dev)
                usb_kill_urb(info->urb);
                kfree_skb(skb);
        }
-       return;
+       mutex_unlock(&priv->conf_mutex);
 }
 
 static int rtl8187_add_interface(struct ieee80211_hw *dev,
@@ -811,6 +846,7 @@ static int rtl8187_add_interface(struct ieee80211_hw *dev,
                return -EOPNOTSUPP;
        }
 
+       mutex_lock(&priv->conf_mutex);
        priv->vif = conf->vif;
 
        rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
@@ -819,6 +855,7 @@ static int rtl8187_add_interface(struct ieee80211_hw *dev,
                                 ((u8 *)conf->mac_addr)[i]);
        rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
 
+       mutex_unlock(&priv->conf_mutex);
        return 0;
 }
 
@@ -826,8 +863,10 @@ static void rtl8187_remove_interface(struct ieee80211_hw *dev,
                                     struct ieee80211_if_init_conf *conf)
 {
        struct rtl8187_priv *priv = dev->priv;
+       mutex_lock(&priv->conf_mutex);
        priv->mode = IEEE80211_IF_TYPE_MNTR;
        priv->vif = NULL;
+       mutex_unlock(&priv->conf_mutex);
 }
 
 static int rtl8187_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf)
@@ -835,6 +874,7 @@ static int rtl8187_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf)
        struct rtl8187_priv *priv = dev->priv;
        u32 reg;
 
+       mutex_lock(&priv->conf_mutex);
        reg = rtl818x_ioread32(priv, &priv->map->TX_CONF);
        /* Enable TX loopback on MAC level to avoid TX during channel
         * changes, as this has be seen to causes problems and the
@@ -867,6 +907,7 @@ static int rtl8187_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf)
        rtl818x_iowrite16(priv, &priv->map->ATIMTR_INTERVAL, 100);
        rtl818x_iowrite16(priv, &priv->map->BEACON_INTERVAL, 100);
        rtl818x_iowrite16(priv, &priv->map->BEACON_INTERVAL_TIME, 100);
+       mutex_unlock(&priv->conf_mutex);
        return 0;
 }
 
@@ -878,6 +919,7 @@ static int rtl8187_config_interface(struct ieee80211_hw *dev,
        int i;
        u8 reg;
 
+       mutex_lock(&priv->conf_mutex);
        for (i = 0; i < ETH_ALEN; i++)
                rtl818x_iowrite8(priv, &priv->map->BSSID[i], conf->bssid[i]);
 
@@ -891,6 +933,7 @@ static int rtl8187_config_interface(struct ieee80211_hw *dev,
                rtl818x_iowrite8(priv, &priv->map->MSR, reg);
        }
 
+       mutex_unlock(&priv->conf_mutex);
        return 0;
 }
 
@@ -1015,9 +1058,7 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
 
        priv->mode = IEEE80211_IF_TYPE_MNTR;
        dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
-                    IEEE80211_HW_RX_INCLUDES_FCS |
-                    IEEE80211_HW_SIGNAL_UNSPEC;
-       dev->max_signal = 65;
+                    IEEE80211_HW_RX_INCLUDES_FCS;
 
        eeprom.data = dev;
        eeprom.register_read = rtl8187_eeprom_register_read;
@@ -1132,10 +1173,16 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
                (*channel++).hw_value = txpwr >> 8;
        }
 
-       if (priv->is_rtl8187b)
+       if (priv->is_rtl8187b) {
                printk(KERN_WARNING "rtl8187: 8187B chip detected. Support "
                        "is EXPERIMENTAL, and could damage your\n"
                        "         hardware, use at your own risk\n");
+               dev->flags |= IEEE80211_HW_SIGNAL_DBM;
+       } else {
+               dev->flags |= IEEE80211_HW_SIGNAL_UNSPEC;
+               dev->max_signal = 65;
+       }
+
        if ((id->driver_info == DEVICE_RTL8187) && priv->is_rtl8187b)
                printk(KERN_INFO "rtl8187: inconsistency between id with OEM"
                       " info!\n");
@@ -1154,6 +1201,7 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
                printk(KERN_ERR "rtl8187: Cannot register device\n");
                goto err_free_dev;
        }
+       mutex_init(&priv->conf_mutex);
 
        printk(KERN_INFO "%s: hwaddr %s, %s V%d + %s\n",
               wiphy_name(dev->wiphy), print_mac(mac, dev->wiphy->perm_addr),
index fcc532b..4d7b98b 100644 (file)
@@ -935,7 +935,6 @@ struct ieee80211_hw *zd_mac_alloc_hw(struct usb_interface *intf)
        hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &mac->band;
 
        hw->flags = IEEE80211_HW_RX_INCLUDES_FCS |
-                   IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE |
                    IEEE80211_HW_SIGNAL_DB;
 
        hw->max_signal = 100;
index d0c1d63..203e579 100644 (file)
@@ -275,7 +275,7 @@ static int readable(struct pcmcia_socket *s, struct resource *res,
                destroy_cis_cache(s);
        }
        s->cis_mem.res = NULL;
-       if ((ret != 0) || (count == 0))
+       if ((ret != 0) || (*count == 0))
                return 0;
        return 1;
 }
index bbf78ef..b42df16 100644 (file)
@@ -77,7 +77,7 @@ void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc)
 {
 #ifdef DEBUG
        char buf[128];
-       int len = 0;
+       int len;
        struct pnp_resource *pnp_res;
        struct resource *res;
 
@@ -89,9 +89,10 @@ void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc)
        dev_dbg(&dev->dev, "%s: current resources:\n", desc);
        list_for_each_entry(pnp_res, &dev->resources, list) {
                res = &pnp_res->res;
+               len = 0;
 
-               len += snprintf(buf + len, sizeof(buf) - len, "  %-3s ",
-                               pnp_resource_type_name(res));
+               len += scnprintf(buf + len, sizeof(buf) - len, "  %-3s ",
+                                pnp_resource_type_name(res));
 
                if (res->flags & IORESOURCE_DISABLED) {
                        dev_dbg(&dev->dev, "%sdisabled\n", buf);
@@ -101,18 +102,18 @@ void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc)
                switch (pnp_resource_type(res)) {
                case IORESOURCE_IO:
                case IORESOURCE_MEM:
-                       len += snprintf(buf + len, sizeof(buf) - len,
-                                       "%#llx-%#llx flags %#lx",
-                                       (unsigned long long) res->start,
-                                       (unsigned long long) res->end,
-                                       res->flags);
+                       len += scnprintf(buf + len, sizeof(buf) - len,
+                                        "%#llx-%#llx flags %#lx",
+                                        (unsigned long long) res->start,
+                                        (unsigned long long) res->end,
+                                        res->flags);
                        break;
                case IORESOURCE_IRQ:
                case IORESOURCE_DMA:
-                       len += snprintf(buf + len, sizeof(buf) - len,
-                                       "%lld flags %#lx",
-                                       (unsigned long long) res->start,
-                                       res->flags);
+                       len += scnprintf(buf + len, sizeof(buf) - len,
+                                        "%lld flags %#lx",
+                                        (unsigned long long) res->start,
+                                        res->flags);
                        break;
                }
                dev_dbg(&dev->dev, "%s\n", buf);
@@ -144,66 +145,67 @@ void dbg_pnp_show_option(struct pnp_dev *dev, struct pnp_option *option)
        struct pnp_dma *dma;
 
        if (pnp_option_is_dependent(option))
-               len += snprintf(buf + len, sizeof(buf) - len,
-                               "  dependent set %d (%s) ",
-                               pnp_option_set(option),
-                               pnp_option_priority_name(option));
+               len += scnprintf(buf + len, sizeof(buf) - len,
+                                "  dependent set %d (%s) ",
+                                pnp_option_set(option),
+                                pnp_option_priority_name(option));
        else
-               len += snprintf(buf + len, sizeof(buf) - len, "  independent ");
+               len += scnprintf(buf + len, sizeof(buf) - len,
+                                "  independent ");
 
        switch (option->type) {
        case IORESOURCE_IO:
                port = &option->u.port;
-               len += snprintf(buf + len, sizeof(buf) - len, "io  min %#llx "
-                               "max %#llx align %lld size %lld flags %#x",
-                               (unsigned long long) port->min,
-                               (unsigned long long) port->max,
-                               (unsigned long long) port->align,
-                               (unsigned long long) port->size, port->flags);
+               len += scnprintf(buf + len, sizeof(buf) - len, "io  min %#llx "
+                                "max %#llx align %lld size %lld flags %#x",
+                                (unsigned long long) port->min,
+                                (unsigned long long) port->max,
+                                (unsigned long long) port->align,
+                                (unsigned long long) port->size, port->flags);
                break;
        case IORESOURCE_MEM:
                mem = &option->u.mem;
-               len += snprintf(buf + len, sizeof(buf) - len, "mem min %#llx "
-                               "max %#llx align %lld size %lld flags %#x",
-                               (unsigned long long) mem->min,
-                               (unsigned long long) mem->max,
-                               (unsigned long long) mem->align,
-                               (unsigned long long) mem->size, mem->flags);
+               len += scnprintf(buf + len, sizeof(buf) - len, "mem min %#llx "
+                                "max %#llx align %lld size %lld flags %#x",
+                                (unsigned long long) mem->min,
+                                (unsigned long long) mem->max,
+                                (unsigned long long) mem->align,
+                                (unsigned long long) mem->size, mem->flags);
                break;
        case IORESOURCE_IRQ:
                irq = &option->u.irq;
-               len += snprintf(buf + len, sizeof(buf) - len, "irq");
+               len += scnprintf(buf + len, sizeof(buf) - len, "irq");
                if (bitmap_empty(irq->map.bits, PNP_IRQ_NR))
-                       len += snprintf(buf + len, sizeof(buf) - len,
-                                       " <none>");
+                       len += scnprintf(buf + len, sizeof(buf) - len,
+                                        " <none>");
                else {
                        for (i = 0; i < PNP_IRQ_NR; i++)
                                if (test_bit(i, irq->map.bits))
-                                       len += snprintf(buf + len,
-                                                       sizeof(buf) - len,
-                                                       " %d", i);
+                                       len += scnprintf(buf + len,
+                                                        sizeof(buf) - len,
+                                                        " %d", i);
                }
-               len += snprintf(buf + len, sizeof(buf) - len, " flags %#x",
-                               irq->flags);
+               len += scnprintf(buf + len, sizeof(buf) - len, " flags %#x",
+                                irq->flags);
                if (irq->flags & IORESOURCE_IRQ_OPTIONAL)
-                       len += snprintf(buf + len, sizeof(buf) - len,
-                                       " (optional)");
+                       len += scnprintf(buf + len, sizeof(buf) - len,
+                                        " (optional)");
                break;
        case IORESOURCE_DMA:
                dma = &option->u.dma;
-               len += snprintf(buf + len, sizeof(buf) - len, "dma");
+               len += scnprintf(buf + len, sizeof(buf) - len, "dma");
                if (!dma->map)
-                       len += snprintf(buf + len, sizeof(buf) - len,
-                                       " <none>");
+                       len += scnprintf(buf + len, sizeof(buf) - len,
+                                        " <none>");
                else {
                        for (i = 0; i < 8; i++)
                                if (dma->map & (1 << i))
-                                       len += snprintf(buf + len,
-                                                       sizeof(buf) - len,
-                                                       " %d", i);
+                                       len += scnprintf(buf + len,
+                                                        sizeof(buf) - len,
+                                                        " %d", i);
                }
-               len += snprintf(buf + len, sizeof(buf) - len, " (bitmask %#x) "
-                               "flags %#x", dma->map, dma->flags);
+               len += scnprintf(buf + len, sizeof(buf) - len, " (bitmask %#x) "
+                                "flags %#x", dma->map, dma->flags);
                break;
        }
        dev_dbg(&dev->dev, "%s\n", buf);
index 4d17d38..9ce5585 100644 (file)
@@ -49,6 +49,13 @@ config BATTERY_OLPC
        help
          Say Y to enable support for the battery on the OLPC laptop.
 
+config BATTERY_TOSA
+       tristate "Sharp SL-6000 (tosa) battery"
+       depends on MACH_TOSA && MFD_TC6393XB
+       help
+         Say Y to enable support for the battery on the Sharp Zaurus
+         SL-6000 (tosa) models.
+
 config BATTERY_PALMTX
        tristate "Palm T|X battery"
        depends on MACH_PALMTX
index 6f43a54..4706bf8 100644 (file)
@@ -20,4 +20,5 @@ obj-$(CONFIG_APM_POWER)               += apm_power.o
 obj-$(CONFIG_BATTERY_DS2760)   += ds2760_battery.o
 obj-$(CONFIG_BATTERY_PMU)      += pmu_battery.o
 obj-$(CONFIG_BATTERY_OLPC)     += olpc_battery.o
+obj-$(CONFIG_BATTERY_TOSA)     += tosa_battery.o
 obj-$(CONFIG_BATTERY_PALMTX)   += palmtx_battery.o
index ab1e828..32570af 100644 (file)
@@ -19,7 +19,7 @@
 
 #define EC_BAT_VOLTAGE 0x10    /* uint16_t,    *9.76/32,    mV   */
 #define EC_BAT_CURRENT 0x11    /* int16_t,     *15.625/120, mA   */
-#define EC_BAT_ACR     0x12
+#define EC_BAT_ACR     0x12    /* int16_t,     *6250/15,    ÂµAh  */
 #define EC_BAT_TEMP    0x13    /* uint16_t,    *100/256,   Â°C  */
 #define EC_AMB_TEMP    0x14    /* uint16_t,    *100/256,   Â°C  */
 #define EC_BAT_STATUS  0x15    /* uint8_t,     bitmask */
@@ -84,6 +84,119 @@ static struct power_supply olpc_ac = {
        .get_property = olpc_ac_get_prop,
 };
 
+static char bat_serial[17]; /* Ick */
+
+static int olpc_bat_get_status(union power_supply_propval *val, uint8_t ec_byte)
+{
+       if (olpc_platform_info.ecver > 0x44) {
+               if (ec_byte & BAT_STAT_CHARGING)
+                       val->intval = POWER_SUPPLY_STATUS_CHARGING;
+               else if (ec_byte & BAT_STAT_DISCHARGING)
+                       val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
+               else if (ec_byte & BAT_STAT_FULL)
+                       val->intval = POWER_SUPPLY_STATUS_FULL;
+               else /* er,... */
+                       val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
+       } else {
+               /* Older EC didn't report charge/discharge bits */
+               if (!(ec_byte & BAT_STAT_AC)) /* No AC means discharging */
+                       val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
+               else if (ec_byte & BAT_STAT_FULL)
+                       val->intval = POWER_SUPPLY_STATUS_FULL;
+               else /* Not _necessarily_ true but EC doesn't tell all yet */
+                       val->intval = POWER_SUPPLY_STATUS_CHARGING;
+       }
+
+       return 0;
+}
+
+static int olpc_bat_get_health(union power_supply_propval *val)
+{
+       uint8_t ec_byte;
+       int ret;
+
+       ret = olpc_ec_cmd(EC_BAT_ERRCODE, NULL, 0, &ec_byte, 1);
+       if (ret)
+               return ret;
+
+       switch (ec_byte) {
+       case 0:
+               val->intval = POWER_SUPPLY_HEALTH_GOOD;
+               break;
+
+       case BAT_ERR_OVERTEMP:
+               val->intval = POWER_SUPPLY_HEALTH_OVERHEAT;
+               break;
+
+       case BAT_ERR_OVERVOLTAGE:
+               val->intval = POWER_SUPPLY_HEALTH_OVERVOLTAGE;
+               break;
+
+       case BAT_ERR_INFOFAIL:
+       case BAT_ERR_OUT_OF_CONTROL:
+       case BAT_ERR_ID_FAIL:
+       case BAT_ERR_ACR_FAIL:
+               val->intval = POWER_SUPPLY_HEALTH_UNSPEC_FAILURE;
+               break;
+
+       default:
+               /* Eep. We don't know this failure code */
+               ret = -EIO;
+       }
+
+       return ret;
+}
+
+static int olpc_bat_get_mfr(union power_supply_propval *val)
+{
+       uint8_t ec_byte;
+       int ret;
+
+       ec_byte = BAT_ADDR_MFR_TYPE;
+       ret = olpc_ec_cmd(EC_BAT_EEPROM, &ec_byte, 1, &ec_byte, 1);
+       if (ret)
+               return ret;
+
+       switch (ec_byte >> 4) {
+       case 1:
+               val->strval = "Gold Peak";
+               break;
+       case 2:
+               val->strval = "BYD";
+               break;
+       default:
+               val->strval = "Unknown";
+               break;
+       }
+
+       return ret;
+}
+
+static int olpc_bat_get_tech(union power_supply_propval *val)
+{
+       uint8_t ec_byte;
+       int ret;
+
+       ec_byte = BAT_ADDR_MFR_TYPE;
+       ret = olpc_ec_cmd(EC_BAT_EEPROM, &ec_byte, 1, &ec_byte, 1);
+       if (ret)
+               return ret;
+
+       switch (ec_byte & 0xf) {
+       case 1:
+               val->intval = POWER_SUPPLY_TECHNOLOGY_NiMH;
+               break;
+       case 2:
+               val->intval = POWER_SUPPLY_TECHNOLOGY_LiFe;
+               break;
+       default:
+               val->intval = POWER_SUPPLY_TECHNOLOGY_UNKNOWN;
+               break;
+       }
+
+       return ret;
+}
+
 /*********************************************************************
  *             Battery properties
  *********************************************************************/
@@ -94,6 +207,7 @@ static int olpc_bat_get_property(struct power_supply *psy,
        int ret = 0;
        int16_t ec_word;
        uint8_t ec_byte;
+       uint64_t ser_buf;
 
        ret = olpc_ec_cmd(EC_BAT_STATUS, NULL, 0, &ec_byte, 1);
        if (ret)
@@ -110,25 +224,10 @@ static int olpc_bat_get_property(struct power_supply *psy,
 
        switch (psp) {
        case POWER_SUPPLY_PROP_STATUS:
-               if (olpc_platform_info.ecver > 0x44) {
-                       if (ec_byte & BAT_STAT_CHARGING)
-                               val->intval = POWER_SUPPLY_STATUS_CHARGING;
-                       else if (ec_byte & BAT_STAT_DISCHARGING)
-                               val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
-                       else if (ec_byte & BAT_STAT_FULL)
-                               val->intval = POWER_SUPPLY_STATUS_FULL;
-                       else /* er,... */
-                               val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
-               } else {
-                       /* Older EC didn't report charge/discharge bits */
-                       if (!(ec_byte & BAT_STAT_AC)) /* No AC means discharging */
-                               val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
-                       else if (ec_byte & BAT_STAT_FULL)
-                               val->intval = POWER_SUPPLY_STATUS_FULL;
-                       else /* Not _necessarily_ true but EC doesn't tell all yet */
-                               val->intval = POWER_SUPPLY_STATUS_CHARGING;
-                       break;
-               }
+               ret = olpc_bat_get_status(val, ec_byte);
+               if (ret)
+                       return ret;
+               break;
        case POWER_SUPPLY_PROP_PRESENT:
                val->intval = !!(ec_byte & BAT_STAT_PRESENT);
                break;
@@ -137,72 +236,21 @@ static int olpc_bat_get_property(struct power_supply *psy,
                if (ec_byte & BAT_STAT_DESTROY)
                        val->intval = POWER_SUPPLY_HEALTH_DEAD;
                else {
-                       ret = olpc_ec_cmd(EC_BAT_ERRCODE, NULL, 0, &ec_byte, 1);
+                       ret = olpc_bat_get_health(val);
                        if (ret)
                                return ret;
-
-                       switch (ec_byte) {
-                       case 0:
-                               val->intval = POWER_SUPPLY_HEALTH_GOOD;
-                               break;
-
-                       case BAT_ERR_OVERTEMP:
-                               val->intval = POWER_SUPPLY_HEALTH_OVERHEAT;
-                               break;
-
-                       case BAT_ERR_OVERVOLTAGE:
-                               val->intval = POWER_SUPPLY_HEALTH_OVERVOLTAGE;
-                               break;
-
-                       case BAT_ERR_INFOFAIL:
-                       case BAT_ERR_OUT_OF_CONTROL:
-                       case BAT_ERR_ID_FAIL:
-                       case BAT_ERR_ACR_FAIL:
-                               val->intval = POWER_SUPPLY_HEALTH_UNSPEC_FAILURE;
-                               break;
-
-                       default:
-                               /* Eep. We don't know this failure code */
-                               return -EIO;
-                       }
                }
                break;
 
        case POWER_SUPPLY_PROP_MANUFACTURER:
-               ec_byte = BAT_ADDR_MFR_TYPE;
-               ret = olpc_ec_cmd(EC_BAT_EEPROM, &ec_byte, 1, &ec_byte, 1);
+               ret = olpc_bat_get_mfr(val);
                if (ret)
                        return ret;
-
-               switch (ec_byte >> 4) {
-               case 1:
-                       val->strval = "Gold Peak";
-                       break;
-               case 2:
-                       val->strval = "BYD";
-                       break;
-               default:
-                       val->strval = "Unknown";
-                       break;
-               }
                break;
        case POWER_SUPPLY_PROP_TECHNOLOGY:
-               ec_byte = BAT_ADDR_MFR_TYPE;
-               ret = olpc_ec_cmd(EC_BAT_EEPROM, &ec_byte, 1, &ec_byte, 1);
+               ret = olpc_bat_get_tech(val);
                if (ret)
                        return ret;
-
-               switch (ec_byte & 0xf) {
-               case 1:
-                       val->intval = POWER_SUPPLY_TECHNOLOGY_NiMH;
-                       break;
-               case 2:
-                       val->intval = POWER_SUPPLY_TECHNOLOGY_LiFe;
-                       break;
-               default:
-                       val->intval = POWER_SUPPLY_TECHNOLOGY_UNKNOWN;
-                       break;
-               }
                break;
        case POWER_SUPPLY_PROP_VOLTAGE_AVG:
                ret = olpc_ec_cmd(EC_BAT_VOLTAGE, NULL, 0, (void *)&ec_word, 2);
@@ -241,6 +289,22 @@ static int olpc_bat_get_property(struct power_supply *psy,
                ec_word = be16_to_cpu(ec_word);
                val->intval = ec_word * 100 / 256;
                break;
+       case POWER_SUPPLY_PROP_CHARGE_COUNTER:
+               ret = olpc_ec_cmd(EC_BAT_ACR, NULL, 0, (void *)&ec_word, 2);
+               if (ret)
+                       return ret;
+
+               ec_word = be16_to_cpu(ec_word);
+               val->intval = ec_word * 6250 / 15;
+               break;
+       case POWER_SUPPLY_PROP_SERIAL_NUMBER:
+               ret = olpc_ec_cmd(EC_BAT_SERIAL, NULL, 0, (void *)&ser_buf, 8);
+               if (ret)
+                       return ret;
+
+               sprintf(bat_serial, "%016llx", (long long)be64_to_cpu(ser_buf));
+               val->strval = bat_serial;
+               break;
        default:
                ret = -EINVAL;
                break;
@@ -260,6 +324,50 @@ static enum power_supply_property olpc_bat_props[] = {
        POWER_SUPPLY_PROP_TEMP,
        POWER_SUPPLY_PROP_TEMP_AMBIENT,
        POWER_SUPPLY_PROP_MANUFACTURER,
+       POWER_SUPPLY_PROP_SERIAL_NUMBER,
+       POWER_SUPPLY_PROP_CHARGE_COUNTER,
+};
+
+/* EEPROM reading goes completely around the power_supply API, sadly */
+
+#define EEPROM_START   0x20
+#define EEPROM_END     0x80
+#define EEPROM_SIZE    (EEPROM_END - EEPROM_START)
+
+static ssize_t olpc_bat_eeprom_read(struct kobject *kobj,
+               struct bin_attribute *attr, char *buf, loff_t off, size_t count)
+{
+       uint8_t ec_byte;
+       int ret, end;
+
+       if (off >= EEPROM_SIZE)
+               return 0;
+       if (off + count > EEPROM_SIZE)
+               count = EEPROM_SIZE - off;
+
+       end = EEPROM_START + off + count;
+       for (ec_byte = EEPROM_START + off; ec_byte < end; ec_byte++) {
+               ret = olpc_ec_cmd(EC_BAT_EEPROM, &ec_byte, 1,
+                               &buf[ec_byte - EEPROM_START], 1);
+               if (ret) {
+                       printk(KERN_ERR "olpc-battery:  EC command "
+                                       "EC_BAT_EEPROM @ 0x%x failed -"
+                                       " %d!\n", ec_byte, ret);
+                       return -EIO;
+               }
+       }
+
+       return count;
+}
+
+static struct bin_attribute olpc_bat_eeprom = {
+       .attr = {
+               .name = "eeprom",
+               .mode = S_IRUGO,
+               .owner = THIS_MODULE,
+       },
+       .size = 0,
+       .read = olpc_bat_eeprom_read,
 };
 
 /*********************************************************************
@@ -290,8 +398,14 @@ static int __init olpc_bat_init(void)
 
        if (!olpc_platform_info.ecver)
                return -ENXIO;
-       if (olpc_platform_info.ecver < 0x43) {
-               printk(KERN_NOTICE "OLPC EC version 0x%02x too old for battery driver.\n", olpc_platform_info.ecver);
+
+       /*
+        * We've seen a number of EC protocol changes; this driver requires
+        * the latest EC protocol, supported by 0x44 and above.
+        */
+       if (olpc_platform_info.ecver < 0x44) {
+               printk(KERN_NOTICE "OLPC EC version 0x%02x too old for "
+                       "battery driver.\n", olpc_platform_info.ecver);
                return -ENXIO;
        }
 
@@ -315,8 +429,14 @@ static int __init olpc_bat_init(void)
        if (ret)
                goto battery_failed;
 
+       ret = device_create_bin_file(olpc_bat.dev, &olpc_bat_eeprom);
+       if (ret)
+               goto eeprom_failed;
+
        goto success;
 
+eeprom_failed:
+       power_supply_unregister(&olpc_bat);
 battery_failed:
        power_supply_unregister(&olpc_ac);
 ac_failed:
@@ -327,6 +447,7 @@ success:
 
 static void __exit olpc_bat_exit(void)
 {
+       device_remove_bin_file(olpc_bat.dev, &olpc_bat_eeprom);
        power_supply_unregister(&olpc_bat);
        power_supply_unregister(&olpc_ac);
        platform_device_unregister(bat_pdev);
index 49215da..fe2aeb1 100644 (file)
@@ -99,6 +99,7 @@ static struct device_attribute power_supply_attrs[] = {
        POWER_SUPPLY_ATTR(charge_empty),
        POWER_SUPPLY_ATTR(charge_now),
        POWER_SUPPLY_ATTR(charge_avg),
+       POWER_SUPPLY_ATTR(charge_counter),
        POWER_SUPPLY_ATTR(energy_full_design),
        POWER_SUPPLY_ATTR(energy_empty_design),
        POWER_SUPPLY_ATTR(energy_full),
diff --git a/drivers/power/tosa_battery.c b/drivers/power/tosa_battery.c
new file mode 100644 (file)
index 0000000..bf664fb
--- /dev/null
@@ -0,0 +1,486 @@
+/*
+ * Battery and Power Management code for the Sharp SL-6000x
+ *
+ * Copyright (c) 2005 Dirk Opfer
+ * Copyright (c) 2008 Dmitry Baryshkov
+ *
+ * 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/module.h>
+#include <linux/power_supply.h>
+#include <linux/wm97xx.h>
+#include <linux/delay.h>
+#include <linux/spinlock.h>
+#include <linux/interrupt.h>
+#include <linux/gpio.h>
+
+#include <asm/mach-types.h>
+#include <asm/arch/tosa.h>
+
+static DEFINE_MUTEX(bat_lock); /* protects gpio pins */
+static struct work_struct bat_work;
+
+struct tosa_bat {
+       int status;
+       struct power_supply psy;
+       int full_chrg;
+
+       struct mutex work_lock; /* protects data */
+
+       bool (*is_present)(struct tosa_bat *bat);
+       int gpio_full;
+       int gpio_charge_off;
+
+       int technology;
+
+       int gpio_bat;
+       int adc_bat;
+       int adc_bat_divider;
+       int bat_max;
+       int bat_min;
+
+       int gpio_temp;
+       int adc_temp;
+       int adc_temp_divider;
+};
+
+static struct tosa_bat tosa_bat_main;
+static struct tosa_bat tosa_bat_jacket;
+
+static unsigned long tosa_read_bat(struct tosa_bat *bat)
+{
+       unsigned long value = 0;
+
+       if (bat->gpio_bat < 0 || bat->adc_bat < 0)
+               return 0;
+
+       mutex_lock(&bat_lock);
+       gpio_set_value(bat->gpio_bat, 1);
+       msleep(5);
+       value = wm97xx_read_aux_adc(bat->psy.dev->parent->driver_data,
+                       bat->adc_bat);
+       gpio_set_value(bat->gpio_bat, 0);
+       mutex_unlock(&bat_lock);
+
+       value = value * 1000000 / bat->adc_bat_divider;
+
+       return value;
+}
+
+static unsigned long tosa_read_temp(struct tosa_bat *bat)
+{
+       unsigned long value = 0;
+
+       if (bat->gpio_temp < 0 || bat->adc_temp < 0)
+               return 0;
+
+       mutex_lock(&bat_lock);
+       gpio_set_value(bat->gpio_temp, 1);
+       msleep(5);
+       value = wm97xx_read_aux_adc(bat->psy.dev->parent->driver_data,
+                       bat->adc_temp);
+       gpio_set_value(bat->gpio_temp, 0);
+       mutex_unlock(&bat_lock);
+
+       value = value * 10000 / bat->adc_temp_divider;
+
+       return value;
+}
+
+static int tosa_bat_get_property(struct power_supply *psy,
+                           enum power_supply_property psp,
+                           union power_supply_propval *val)
+{
+       int ret = 0;
+       struct tosa_bat *bat = container_of(psy, struct tosa_bat, psy);
+
+       if (bat->is_present && !bat->is_present(bat)
+                       && psp != POWER_SUPPLY_PROP_PRESENT) {
+               return -ENODEV;
+       }
+
+       switch (psp) {
+       case POWER_SUPPLY_PROP_STATUS:
+               val->intval = bat->status;
+               break;
+       case POWER_SUPPLY_PROP_TECHNOLOGY:
+               val->intval = bat->technology;
+               break;
+       case POWER_SUPPLY_PROP_VOLTAGE_NOW:
+               val->intval = tosa_read_bat(bat);
+               break;
+       case POWER_SUPPLY_PROP_VOLTAGE_MAX:
+               if (bat->full_chrg == -1)
+                       val->intval = bat->bat_max;
+               else
+                       val->intval = bat->full_chrg;
+               break;
+       case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN:
+               val->intval = bat->bat_max;
+               break;
+       case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN:
+               val->intval = bat->bat_min;
+               break;
+       case POWER_SUPPLY_PROP_TEMP:
+               val->intval = tosa_read_temp(bat);
+               break;
+       case POWER_SUPPLY_PROP_PRESENT:
+               val->intval = bat->is_present ? bat->is_present(bat) : 1;
+               break;
+       default:
+               ret = -EINVAL;
+               break;
+       }
+       return ret;
+}
+
+static bool tosa_jacket_bat_is_present(struct tosa_bat *bat)
+{
+       return gpio_get_value(TOSA_GPIO_JACKET_DETECT) == 0;
+}
+
+static void tosa_bat_external_power_changed(struct power_supply *psy)
+{
+       schedule_work(&bat_work);
+}
+
+static irqreturn_t tosa_bat_gpio_isr(int irq, void *data)
+{
+       pr_info("tosa_bat_gpio irq: %d\n", gpio_get_value(irq_to_gpio(irq)));
+       schedule_work(&bat_work);
+       return IRQ_HANDLED;
+}
+
+static void tosa_bat_update(struct tosa_bat *bat)
+{
+       int old;
+       struct power_supply *psy = &bat->psy;
+
+       mutex_lock(&bat->work_lock);
+
+       old = bat->status;
+
+       if (bat->is_present && !bat->is_present(bat)) {
+               printk(KERN_NOTICE "%s not present\n", psy->name);
+               bat->status = POWER_SUPPLY_STATUS_UNKNOWN;
+               bat->full_chrg = -1;
+       } else if (power_supply_am_i_supplied(psy)) {
+               if (bat->status == POWER_SUPPLY_STATUS_DISCHARGING) {
+                       gpio_set_value(bat->gpio_charge_off, 0);
+                       mdelay(15);
+               }
+
+               if (gpio_get_value(bat->gpio_full)) {
+                       if (old == POWER_SUPPLY_STATUS_CHARGING ||
+                                       bat->full_chrg == -1)
+                               bat->full_chrg = tosa_read_bat(bat);
+
+                       gpio_set_value(bat->gpio_charge_off, 1);
+                       bat->status = POWER_SUPPLY_STATUS_FULL;
+               } else {
+                       gpio_set_value(bat->gpio_charge_off, 0);
+                       bat->status = POWER_SUPPLY_STATUS_CHARGING;
+               }
+       } else {
+               gpio_set_value(bat->gpio_charge_off, 1);
+               bat->status = POWER_SUPPLY_STATUS_DISCHARGING;
+       }
+
+       if (old != bat->status)
+               power_supply_changed(psy);
+
+       mutex_unlock(&bat->work_lock);
+}
+
+static void tosa_bat_work(struct work_struct *work)
+{
+       tosa_bat_update(&tosa_bat_main);
+       tosa_bat_update(&tosa_bat_jacket);
+}
+
+
+static enum power_supply_property tosa_bat_main_props[] = {
+       POWER_SUPPLY_PROP_STATUS,
+       POWER_SUPPLY_PROP_TECHNOLOGY,
+       POWER_SUPPLY_PROP_VOLTAGE_NOW,
+       POWER_SUPPLY_PROP_VOLTAGE_MAX,
+       POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
+       POWER_SUPPLY_PROP_TEMP,
+       POWER_SUPPLY_PROP_PRESENT,
+};
+
+static enum power_supply_property tosa_bat_bu_props[] = {
+       POWER_SUPPLY_PROP_STATUS,
+       POWER_SUPPLY_PROP_TECHNOLOGY,
+       POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
+       POWER_SUPPLY_PROP_VOLTAGE_NOW,
+       POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN,
+       POWER_SUPPLY_PROP_PRESENT,
+};
+
+static struct tosa_bat tosa_bat_main = {
+       .status = POWER_SUPPLY_STATUS_DISCHARGING,
+       .full_chrg = -1,
+       .psy = {
+               .name           = "main-battery",
+               .type           = POWER_SUPPLY_TYPE_BATTERY,
+               .properties     = tosa_bat_main_props,
+               .num_properties = ARRAY_SIZE(tosa_bat_main_props),
+               .get_property   = tosa_bat_get_property,
+               .external_power_changed = tosa_bat_external_power_changed,
+               .use_for_apm    = 1,
+       },
+
+       .gpio_full = TOSA_GPIO_BAT0_CRG,
+       .gpio_charge_off = TOSA_GPIO_CHARGE_OFF,
+
+       .technology = POWER_SUPPLY_TECHNOLOGY_LIPO,
+
+       .gpio_bat = TOSA_GPIO_BAT0_V_ON,
+       .adc_bat = WM97XX_AUX_ID3,
+       .adc_bat_divider = 414,
+       .bat_max = 4310000,
+       .bat_min = 1551 * 1000000 / 414,
+
+       .gpio_temp = TOSA_GPIO_BAT1_TH_ON,
+       .adc_temp = WM97XX_AUX_ID2,
+       .adc_temp_divider = 10000,
+};
+
+static struct tosa_bat tosa_bat_jacket = {
+       .status = POWER_SUPPLY_STATUS_DISCHARGING,
+       .full_chrg = -1,
+       .psy = {
+               .name           = "jacket-battery",
+               .type           = POWER_SUPPLY_TYPE_BATTERY,
+               .properties     = tosa_bat_main_props,
+               .num_properties = ARRAY_SIZE(tosa_bat_main_props),
+               .get_property   = tosa_bat_get_property,
+               .external_power_changed = tosa_bat_external_power_changed,
+       },
+
+       .is_present = tosa_jacket_bat_is_present,
+       .gpio_full = TOSA_GPIO_BAT1_CRG,
+       .gpio_charge_off = TOSA_GPIO_CHARGE_OFF_JC,
+
+       .technology = POWER_SUPPLY_TECHNOLOGY_LIPO,
+
+       .gpio_bat = TOSA_GPIO_BAT1_V_ON,
+       .adc_bat = WM97XX_AUX_ID3,
+       .adc_bat_divider = 414,
+       .bat_max = 4310000,
+       .bat_min = 1551 * 1000000 / 414,
+
+       .gpio_temp = TOSA_GPIO_BAT0_TH_ON,
+       .adc_temp = WM97XX_AUX_ID2,
+       .adc_temp_divider = 10000,
+};
+
+static struct tosa_bat tosa_bat_bu = {
+       .status = POWER_SUPPLY_STATUS_UNKNOWN,
+       .full_chrg = -1,
+
+       .psy = {
+               .name           = "backup-battery",
+               .type           = POWER_SUPPLY_TYPE_BATTERY,
+               .properties     = tosa_bat_bu_props,
+               .num_properties = ARRAY_SIZE(tosa_bat_bu_props),
+               .get_property   = tosa_bat_get_property,
+               .external_power_changed = tosa_bat_external_power_changed,
+       },
+
+       .gpio_full = -1,
+       .gpio_charge_off = -1,
+
+       .technology = POWER_SUPPLY_TECHNOLOGY_LiMn,
+
+       .gpio_bat = TOSA_GPIO_BU_CHRG_ON,
+       .adc_bat = WM97XX_AUX_ID4,
+       .adc_bat_divider = 1266,
+
+       .gpio_temp = -1,
+       .adc_temp = -1,
+       .adc_temp_divider = -1,
+};
+
+static struct {
+       int gpio;
+       char *name;
+       bool output;
+       int value;
+} gpios[] = {
+       { TOSA_GPIO_CHARGE_OFF,         "main charge off",      1, 1 },
+       { TOSA_GPIO_CHARGE_OFF_JC,      "jacket charge off",    1, 1 },
+       { TOSA_GPIO_BAT_SW_ON,          "battery switch",       1, 0 },
+       { TOSA_GPIO_BAT0_V_ON,          "main battery",         1, 0 },
+       { TOSA_GPIO_BAT1_V_ON,          "jacket battery",       1, 0 },
+       { TOSA_GPIO_BAT1_TH_ON,         "main battery temp",    1, 0 },
+       { TOSA_GPIO_BAT0_TH_ON,         "jacket battery temp",  1, 0 },
+       { TOSA_GPIO_BU_CHRG_ON,         "backup battery",       1, 0 },
+       { TOSA_GPIO_BAT0_CRG,           "main battery full",    0, 0 },
+       { TOSA_GPIO_BAT1_CRG,           "jacket battery full",  0, 0 },
+       { TOSA_GPIO_BAT0_LOW,           "main battery low",     0, 0 },
+       { TOSA_GPIO_BAT1_LOW,           "jacket battery low",   0, 0 },
+       { TOSA_GPIO_JACKET_DETECT,      "jacket detect",        0, 0 },
+};
+
+#ifdef CONFIG_PM
+static int tosa_bat_suspend(struct platform_device *dev, pm_message_t state)
+{
+       /* flush all pending status updates */
+       flush_scheduled_work();
+       return 0;
+}
+
+static int tosa_bat_resume(struct platform_device *dev)
+{
+       /* things may have changed while we were away */
+       schedule_work(&bat_work);
+       return 0;
+}
+#else
+#define tosa_bat_suspend NULL
+#define tosa_bat_resume NULL
+#endif
+
+static int __devinit tosa_bat_probe(struct platform_device *dev)
+{
+       int ret;
+       int i;
+
+       if (!machine_is_tosa())
+               return -ENODEV;
+
+       for (i = 0; i < ARRAY_SIZE(gpios); i++) {
+               ret = gpio_request(gpios[i].gpio, gpios[i].name);
+               if (ret) {
+                       i--;
+                       goto err_gpio;
+               }
+
+               if (gpios[i].output)
+                       ret = gpio_direction_output(gpios[i].gpio,
+                                       gpios[i].value);
+               else
+                       ret = gpio_direction_input(gpios[i].gpio);
+
+               if (ret)
+                       goto err_gpio;
+       }
+
+       mutex_init(&tosa_bat_main.work_lock);
+       mutex_init(&tosa_bat_jacket.work_lock);
+
+       INIT_WORK(&bat_work, tosa_bat_work);
+
+       ret = power_supply_register(&dev->dev, &tosa_bat_main.psy);
+       if (ret)
+               goto err_psy_reg_main;
+       ret = power_supply_register(&dev->dev, &tosa_bat_jacket.psy);
+       if (ret)
+               goto err_psy_reg_jacket;
+       ret = power_supply_register(&dev->dev, &tosa_bat_bu.psy);
+       if (ret)
+               goto err_psy_reg_bu;
+
+       ret = request_irq(gpio_to_irq(TOSA_GPIO_BAT0_CRG),
+                               tosa_bat_gpio_isr,
+                               IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
+                               "main full", &tosa_bat_main);
+       if (ret)
+               goto err_req_main;
+
+       ret = request_irq(gpio_to_irq(TOSA_GPIO_BAT1_CRG),
+                               tosa_bat_gpio_isr,
+                               IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
+                               "jacket full", &tosa_bat_jacket);
+       if (ret)
+               goto err_req_jacket;
+
+       ret = request_irq(gpio_to_irq(TOSA_GPIO_JACKET_DETECT),
+                               tosa_bat_gpio_isr,
+                               IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
+                               "jacket detect", &tosa_bat_jacket);
+       if (!ret) {
+               schedule_work(&bat_work);
+               return 0;
+       }
+
+       free_irq(gpio_to_irq(TOSA_GPIO_BAT1_CRG), &tosa_bat_jacket);
+err_req_jacket:
+       free_irq(gpio_to_irq(TOSA_GPIO_BAT0_CRG), &tosa_bat_main);
+err_req_main:
+       power_supply_unregister(&tosa_bat_bu.psy);
+err_psy_reg_bu:
+       power_supply_unregister(&tosa_bat_jacket.psy);
+err_psy_reg_jacket:
+       power_supply_unregister(&tosa_bat_main.psy);
+err_psy_reg_main:
+
+       /* see comment in tosa_bat_remove */
+       flush_scheduled_work();
+
+       i--;
+err_gpio:
+       for (; i >= 0; i--)
+               gpio_free(gpios[i].gpio);
+
+       return ret;
+}
+
+static int __devexit tosa_bat_remove(struct platform_device *dev)
+{
+       int i;
+
+       free_irq(gpio_to_irq(TOSA_GPIO_JACKET_DETECT), &tosa_bat_jacket);
+       free_irq(gpio_to_irq(TOSA_GPIO_BAT1_CRG), &tosa_bat_jacket);
+       free_irq(gpio_to_irq(TOSA_GPIO_BAT0_CRG), &tosa_bat_main);
+
+       power_supply_unregister(&tosa_bat_bu.psy);
+       power_supply_unregister(&tosa_bat_jacket.psy);
+       power_supply_unregister(&tosa_bat_main.psy);
+
+       /*
+        * now flush all pending work.
+        * we won't get any more schedules, since all
+        * sources (isr and external_power_changed)
+        * are unregistered now.
+        */
+       flush_scheduled_work();
+
+       for (i = ARRAY_SIZE(gpios) - 1; i >= 0; i--)
+               gpio_free(gpios[i].gpio);
+
+       return 0;
+}
+
+static struct platform_driver tosa_bat_driver = {
+       .driver.name    = "wm97xx-battery",
+       .driver.owner   = THIS_MODULE,
+       .probe          = tosa_bat_probe,
+       .remove         = __devexit_p(tosa_bat_remove),
+       .suspend        = tosa_bat_suspend,
+       .resume         = tosa_bat_resume,
+};
+
+static int __init tosa_bat_init(void)
+{
+       return platform_driver_register(&tosa_bat_driver);
+}
+
+static void __exit tosa_bat_exit(void)
+{
+       platform_driver_unregister(&tosa_bat_driver);
+}
+
+module_init(tosa_bat_init);
+module_exit(tosa_bat_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Dmitry Baryshkov");
+MODULE_DESCRIPTION("Tosa battery driver");
+MODULE_ALIAS("platform:wm97xx-battery");
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
new file mode 100644 (file)
index 0000000..a656128
--- /dev/null
@@ -0,0 +1,59 @@
+menu "Voltage and Current regulators"
+
+config REGULATOR
+       bool "Voltage and Current Regulator Support"
+       default n
+       help
+         Generic Voltage and Current Regulator support.
+
+         This framework is designed to provide a generic interface to voltage
+         and current regulators within the Linux kernel. It's intended to
+         provide voltage and current control to client or consumer drivers and
+         also provide status information to user space applications through a
+         sysfs interface.
+
+         The intention is to allow systems to dynamically control regulator
+         output in order to save power and prolong battery life. This applies
+         to both voltage regulators (where voltage output is controllable) and
+         current sinks (where current output is controllable).
+
+         This framework safely compiles out if not selected so that client
+         drivers can still be used in systems with no software controllable
+         regulators.
+
+         If unsure, say no.
+
+config REGULATOR_DEBUG
+       bool "Regulator debug support"
+       depends on REGULATOR
+       help
+         Say yes here to enable debugging support.
+
+config REGULATOR_FIXED_VOLTAGE
+       tristate
+       default n
+       select REGULATOR
+
+config REGULATOR_VIRTUAL_CONSUMER
+       tristate "Virtual regulator consumer support"
+       default n
+       select REGULATOR
+       help
+         This driver provides a virtual consumer for the voltage and
+          current regulator API which provides sysfs controls for
+          configuring the supplies requested.  This is mainly useful
+          for test purposes.
+
+          If unsure, say no.
+
+config REGULATOR_BQ24022
+       tristate "TI bq24022 Dual Input 1-Cell Li-Ion Charger IC"
+       default n
+       select REGULATOR
+       help
+         This driver controls a TI bq24022 Charger attached via
+         GPIOs. The provided current regulator can enable/disable
+         charging select between 100 mA and 500 mA charging current
+         limit.
+
+endmenu
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
new file mode 100644 (file)
index 0000000..ac2c64e
--- /dev/null
@@ -0,0 +1,12 @@
+#
+# Makefile for regulator drivers.
+#
+
+
+obj-$(CONFIG_REGULATOR) += core.o
+obj-$(CONFIG_REGULATOR_FIXED_VOLTAGE) += fixed.o
+obj-$(CONFIG_REGULATOR_VIRTUAL_CONSUMER) += virtual.o
+
+obj-$(CONFIG_REGULATOR_BQ24022) += bq24022.o
+
+ccflags-$(CONFIG_REGULATOR_DEBUG) += -DDEBUG
diff --git a/drivers/regulator/bq24022.c b/drivers/regulator/bq24022.c
new file mode 100644 (file)
index 0000000..263699d
--- /dev/null
@@ -0,0 +1,167 @@
+/*
+ * Support for TI bq24022 (bqTINY-II) Dual Input (USB/AC Adpater)
+ * 1-Cell Li-Ion Charger connected via GPIOs.
+ *
+ * Copyright (c) 2008 Philipp Zabel
+ *
+ * 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/init.h>
+#include <linux/platform_device.h>
+#include <linux/err.h>
+#include <linux/gpio.h>
+#include <linux/regulator/bq24022.h>
+#include <linux/regulator/driver.h>
+
+static int bq24022_set_current_limit(struct regulator_dev *rdev,
+                                       int min_uA, int max_uA)
+{
+       struct platform_device *pdev = rdev_get_drvdata(rdev);
+       struct bq24022_mach_info *pdata = pdev->dev.platform_data;
+
+       dev_dbg(&pdev->dev, "setting current limit to %s mA\n",
+               max_uA >= 500000 ? "500" : "100");
+
+       /* REVISIT: maybe return error if min_uA != 0 ? */
+       gpio_set_value(pdata->gpio_iset2, max_uA >= 500000);
+       return 0;
+}
+
+static int bq24022_get_current_limit(struct regulator_dev *rdev)
+{
+       struct platform_device *pdev = rdev_get_drvdata(rdev);
+       struct bq24022_mach_info *pdata = pdev->dev.platform_data;
+
+       return gpio_get_value(pdata->gpio_iset2) ? 500000 : 100000;
+}
+
+static int bq24022_enable(struct regulator_dev *rdev)
+{
+       struct platform_device *pdev = rdev_get_drvdata(rdev);
+       struct bq24022_mach_info *pdata = pdev->dev.platform_data;
+
+       dev_dbg(&pdev->dev, "enabling charger\n");
+
+       gpio_set_value(pdata->gpio_nce, 0);
+       return 0;
+}
+
+static int bq24022_disable(struct regulator_dev *rdev)
+{
+       struct platform_device *pdev = rdev_get_drvdata(rdev);
+       struct bq24022_mach_info *pdata = pdev->dev.platform_data;
+
+       dev_dbg(&pdev->dev, "disabling charger\n");
+
+       gpio_set_value(pdata->gpio_nce, 1);
+       return 0;
+}
+
+static int bq24022_is_enabled(struct regulator_dev *rdev)
+{
+       struct platform_device *pdev = rdev_get_drvdata(rdev);
+       struct bq24022_mach_info *pdata = pdev->dev.platform_data;
+
+       return !gpio_get_value(pdata->gpio_nce);
+}
+
+static struct regulator_ops bq24022_ops = {
+       .set_current_limit = bq24022_set_current_limit,
+       .get_current_limit = bq24022_get_current_limit,
+       .enable            = bq24022_enable,
+       .disable           = bq24022_disable,
+       .is_enabled        = bq24022_is_enabled,
+};
+
+static struct regulator_desc bq24022_desc = {
+       .name  = "bq24022",
+       .ops   = &bq24022_ops,
+       .type  = REGULATOR_CURRENT,
+};
+
+static int __init bq24022_probe(struct platform_device *pdev)
+{
+       struct bq24022_mach_info *pdata = pdev->dev.platform_data;
+       struct regulator_dev *bq24022;
+       int ret;
+
+       if (!pdata || !pdata->gpio_nce || !pdata->gpio_iset2)
+               return -EINVAL;
+
+       ret = gpio_request(pdata->gpio_nce, "ncharge_en");
+       if (ret) {
+               dev_dbg(&pdev->dev, "couldn't request nCE GPIO: %d\n",
+                       pdata->gpio_nce);
+               goto err_ce;
+       }
+       ret = gpio_request(pdata->gpio_iset2, "charge_mode");
+       if (ret) {
+               dev_dbg(&pdev->dev, "couldn't request ISET2 GPIO: %d\n",
+                       pdata->gpio_iset2);
+               goto err_iset2;
+       }
+       ret = gpio_direction_output(pdata->gpio_iset2, 0);
+       ret = gpio_direction_output(pdata->gpio_nce, 1);
+
+       bq24022 = regulator_register(&bq24022_desc, pdev);
+       if (IS_ERR(bq24022)) {
+               dev_dbg(&pdev->dev, "couldn't register regulator\n");
+               ret = PTR_ERR(bq24022);
+               goto err_reg;
+       }
+       platform_set_drvdata(pdev, bq24022);
+       dev_dbg(&pdev->dev, "registered regulator\n");
+
+       return 0;
+err_reg:
+       gpio_free(pdata->gpio_iset2);
+err_iset2:
+       gpio_free(pdata->gpio_nce);
+err_ce:
+       return ret;
+}
+
+static int __devexit bq24022_remove(struct platform_device *pdev)
+{
+       struct bq24022_mach_info *pdata = pdev->dev.platform_data;
+       struct regulator_dev *bq24022 = platform_get_drvdata(pdev);
+
+       regulator_unregister(bq24022);
+       gpio_free(pdata->gpio_iset2);
+       gpio_free(pdata->gpio_nce);
+
+       return 0;
+}
+
+static struct platform_driver bq24022_driver = {
+       .driver = {
+               .name = "bq24022",
+       },
+       .remove = __devexit_p(bq24022_remove),
+};
+
+static int __init bq24022_init(void)
+{
+       return platform_driver_probe(&bq24022_driver, bq24022_probe);
+}
+
+static void __exit bq24022_exit(void)
+{
+       platform_driver_unregister(&bq24022_driver);
+}
+
+/*
+ * make sure this is probed before gpio_vbus and pda_power,
+ * but after asic3 or other GPIO expander drivers.
+ */
+subsys_initcall(bq24022_init);
+module_exit(bq24022_exit);
+
+MODULE_AUTHOR("Philipp Zabel");
+MODULE_DESCRIPTION("TI bq24022 Li-Ion Charger driver");
+MODULE_LICENSE("GPL");
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
new file mode 100644 (file)
index 0000000..9c79862
--- /dev/null
@@ -0,0 +1,1903 @@
+/*
+ * core.c  --  Voltage/Current Regulator framework.
+ *
+ * Copyright 2007, 2008 Wolfson Microelectronics PLC.
+ *
+ * Author: Liam Girdwood <liam.girdwood@wolfsonmicro.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/kernel.h>
+#include <linux/init.h>
+#include <linux/device.h>
+#include <linux/err.h>
+#include <linux/mutex.h>
+#include <linux/suspend.h>
+#include <linux/regulator/consumer.h>
+#include <linux/regulator/driver.h>
+#include <linux/regulator/machine.h>
+
+#define REGULATOR_VERSION "0.5"
+
+static DEFINE_MUTEX(regulator_list_mutex);
+static LIST_HEAD(regulator_list);
+static LIST_HEAD(regulator_map_list);
+
+/**
+ * struct regulator_dev
+ *
+ * Voltage / Current regulator class device. One for each regulator.
+ */
+struct regulator_dev {
+       struct regulator_desc *desc;
+       int use_count;
+
+       /* lists we belong to */
+       struct list_head list; /* list of all regulators */
+       struct list_head slist; /* list of supplied regulators */
+
+       /* lists we own */
+       struct list_head consumer_list; /* consumers we supply */
+       struct list_head supply_list; /* regulators we supply */
+
+       struct blocking_notifier_head notifier;
+       struct mutex mutex; /* consumer lock */
+       struct module *owner;
+       struct device dev;
+       struct regulation_constraints *constraints;
+       struct regulator_dev *supply;   /* for tree */
+
+       void *reg_data;         /* regulator_dev data */
+};
+
+/**
+ * struct regulator_map
+ *
+ * Used to provide symbolic supply names to devices.
+ */
+struct regulator_map {
+       struct list_head list;
+       struct device *dev;
+       const char *supply;
+       const char *regulator;
+};
+
+static inline struct regulator_dev *to_rdev(struct device *d)
+{
+       return container_of(d, struct regulator_dev, dev);
+}
+
+/*
+ * struct regulator
+ *
+ * One for each consumer device.
+ */
+struct regulator {
+       struct device *dev;
+       struct list_head list;
+       int uA_load;
+       int min_uV;
+       int max_uV;
+       int enabled; /* client has called enabled */
+       char *supply_name;
+       struct device_attribute dev_attr;
+       struct regulator_dev *rdev;
+};
+
+static int _regulator_is_enabled(struct regulator_dev *rdev);
+static int _regulator_disable(struct regulator_dev *rdev);
+static int _regulator_get_voltage(struct regulator_dev *rdev);
+static int _regulator_get_current_limit(struct regulator_dev *rdev);
+static unsigned int _regulator_get_mode(struct regulator_dev *rdev);
+static void _notifier_call_chain(struct regulator_dev *rdev,
+                                 unsigned long event, void *data);
+
+/* gets the regulator for a given consumer device */
+static struct regulator *get_device_regulator(struct device *dev)
+{
+       struct regulator *regulator = NULL;
+       struct regulator_dev *rdev;
+
+       mutex_lock(&regulator_list_mutex);
+       list_for_each_entry(rdev, &regulator_list, list) {
+               mutex_lock(&rdev->mutex);
+               list_for_each_entry(regulator, &rdev->consumer_list, list) {
+                       if (regulator->dev == dev) {
+                               mutex_unlock(&rdev->mutex);
+                               mutex_unlock(&regulator_list_mutex);
+                               return regulator;
+                       }
+               }
+               mutex_unlock(&rdev->mutex);
+       }
+       mutex_unlock(&regulator_list_mutex);
+       return NULL;
+}
+
+/* Platform voltage constraint check */
+static int regulator_check_voltage(struct regulator_dev *rdev,
+                                  int *min_uV, int *max_uV)
+{
+       BUG_ON(*min_uV > *max_uV);
+
+       if (!rdev->constraints) {
+               printk(KERN_ERR "%s: no constraints for %s\n", __func__,
+                      rdev->desc->name);
+               return -ENODEV;
+       }
+       if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) {
+               printk(KERN_ERR "%s: operation not allowed for %s\n",
+                      __func__, rdev->desc->name);
+               return -EPERM;
+       }
+
+       if (*max_uV > rdev->constraints->max_uV)
+               *max_uV = rdev->constraints->max_uV;
+       if (*min_uV < rdev->constraints->min_uV)
+               *min_uV = rdev->constraints->min_uV;
+
+       if (*min_uV > *max_uV)
+               return -EINVAL;
+
+       return 0;
+}
+
+/* current constraint check */
+static int regulator_check_current_limit(struct regulator_dev *rdev,
+                                       int *min_uA, int *max_uA)
+{
+       BUG_ON(*min_uA > *max_uA);
+
+       if (!rdev->constraints) {
+               printk(KERN_ERR "%s: no constraints for %s\n", __func__,
+                      rdev->desc->name);
+               return -ENODEV;
+       }
+       if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_CURRENT)) {
+               printk(KERN_ERR "%s: operation not allowed for %s\n",
+                      __func__, rdev->desc->name);
+               return -EPERM;
+       }
+
+       if (*max_uA > rdev->constraints->max_uA)
+               *max_uA = rdev->constraints->max_uA;
+       if (*min_uA < rdev->constraints->min_uA)
+               *min_uA = rdev->constraints->min_uA;
+
+       if (*min_uA > *max_uA)
+               return -EINVAL;
+
+       return 0;
+}
+
+/* operating mode constraint check */
+static int regulator_check_mode(struct regulator_dev *rdev, int mode)
+{
+       if (!rdev->constraints) {
+               printk(KERN_ERR "%s: no constraints for %s\n", __func__,
+                      rdev->desc->name);
+               return -ENODEV;
+       }
+       if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_MODE)) {
+               printk(KERN_ERR "%s: operation not allowed for %s\n",
+                      __func__, rdev->desc->name);
+               return -EPERM;
+       }
+       if (!(rdev->constraints->valid_modes_mask & mode)) {
+               printk(KERN_ERR "%s: invalid mode %x for %s\n",
+                      __func__, mode, rdev->desc->name);
+               return -EINVAL;
+       }
+       return 0;
+}
+
+/* dynamic regulator mode switching constraint check */
+static int regulator_check_drms(struct regulator_dev *rdev)
+{
+       if (!rdev->constraints) {
+               printk(KERN_ERR "%s: no constraints for %s\n", __func__,
+                      rdev->desc->name);
+               return -ENODEV;
+       }
+       if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_DRMS)) {
+               printk(KERN_ERR "%s: operation not allowed for %s\n",
+                      __func__, rdev->desc->name);
+               return -EPERM;
+       }
+       return 0;
+}
+
+static ssize_t device_requested_uA_show(struct device *dev,
+                            struct device_attribute *attr, char *buf)
+{
+       struct regulator *regulator;
+
+       regulator = get_device_regulator(dev);
+       if (regulator == NULL)
+               return 0;
+
+       return sprintf(buf, "%d\n", regulator->uA_load);
+}
+
+static ssize_t regulator_uV_show(struct device *dev,
+                               struct device_attribute *attr, char *buf)
+{
+       struct regulator_dev *rdev = to_rdev(dev);
+       ssize_t ret;
+
+       mutex_lock(&rdev->mutex);
+       ret = sprintf(buf, "%d\n", _regulator_get_voltage(rdev));
+       mutex_unlock(&rdev->mutex);
+
+       return ret;
+}
+
+static ssize_t regulator_uA_show(struct device *dev,
+                               struct device_attribute *attr, char *buf)
+{
+       struct regulator_dev *rdev = to_rdev(dev);
+
+       return sprintf(buf, "%d\n", _regulator_get_current_limit(rdev));
+}
+
+static ssize_t regulator_opmode_show(struct device *dev,
+                                   struct device_attribute *attr, char *buf)
+{
+       struct regulator_dev *rdev = to_rdev(dev);
+       int mode = _regulator_get_mode(rdev);
+
+       switch (mode) {
+       case REGULATOR_MODE_FAST:
+               return sprintf(buf, "fast\n");
+       case REGULATOR_MODE_NORMAL:
+               return sprintf(buf, "normal\n");
+       case REGULATOR_MODE_IDLE:
+               return sprintf(buf, "idle\n");
+       case REGULATOR_MODE_STANDBY:
+               return sprintf(buf, "standby\n");
+       }
+       return sprintf(buf, "unknown\n");
+}
+
+static ssize_t regulator_state_show(struct device *dev,
+                                  struct device_attribute *attr, char *buf)
+{
+       struct regulator_dev *rdev = to_rdev(dev);
+       int state = _regulator_is_enabled(rdev);
+
+       if (state > 0)
+               return sprintf(buf, "enabled\n");
+       else if (state == 0)
+               return sprintf(buf, "disabled\n");
+       else
+               return sprintf(buf, "unknown\n");
+}
+
+static ssize_t regulator_min_uA_show(struct device *dev,
+                                   struct device_attribute *attr, char *buf)
+{
+       struct regulator_dev *rdev = to_rdev(dev);
+
+       if (!rdev->constraints)
+               return sprintf(buf, "constraint not defined\n");
+
+       return sprintf(buf, "%d\n", rdev->constraints->min_uA);
+}
+
+static ssize_t regulator_max_uA_show(struct device *dev,
+                                   struct device_attribute *attr, char *buf)
+{
+       struct regulator_dev *rdev = to_rdev(dev);
+
+       if (!rdev->constraints)
+               return sprintf(buf, "constraint not defined\n");
+
+       return sprintf(buf, "%d\n", rdev->constraints->max_uA);
+}
+
+static ssize_t regulator_min_uV_show(struct device *dev,
+                                   struct device_attribute *attr, char *buf)
+{
+       struct regulator_dev *rdev = to_rdev(dev);
+
+       if (!rdev->constraints)
+               return sprintf(buf, "constraint not defined\n");
+
+       return sprintf(buf, "%d\n", rdev->constraints->min_uV);
+}
+
+static ssize_t regulator_max_uV_show(struct device *dev,
+                                   struct device_attribute *attr, char *buf)
+{
+       struct regulator_dev *rdev = to_rdev(dev);
+
+       if (!rdev->constraints)
+               return sprintf(buf, "constraint not defined\n");
+
+       return sprintf(buf, "%d\n", rdev->constraints->max_uV);
+}
+
+static ssize_t regulator_total_uA_show(struct device *dev,
+                                     struct device_attribute *attr, char *buf)
+{
+       struct regulator_dev *rdev = to_rdev(dev);
+       struct regulator *regulator;
+       int uA = 0;
+
+       mutex_lock(&rdev->mutex);
+       list_for_each_entry(regulator, &rdev->consumer_list, list)
+           uA += regulator->uA_load;
+       mutex_unlock(&rdev->mutex);
+       return sprintf(buf, "%d\n", uA);
+}
+
+static ssize_t regulator_num_users_show(struct device *dev,
+                                     struct device_attribute *attr, char *buf)
+{
+       struct regulator_dev *rdev = to_rdev(dev);
+       return sprintf(buf, "%d\n", rdev->use_count);
+}
+
+static ssize_t regulator_type_show(struct device *dev,
+                                 struct device_attribute *attr, char *buf)
+{
+       struct regulator_dev *rdev = to_rdev(dev);
+
+       switch (rdev->desc->type) {
+       case REGULATOR_VOLTAGE:
+               return sprintf(buf, "voltage\n");
+       case REGULATOR_CURRENT:
+               return sprintf(buf, "current\n");
+       }
+       return sprintf(buf, "unknown\n");
+}
+
+static ssize_t regulator_suspend_mem_uV_show(struct device *dev,
+                               struct device_attribute *attr, char *buf)
+{
+       struct regulator_dev *rdev = to_rdev(dev);
+
+       if (!rdev->constraints)
+               return sprintf(buf, "not defined\n");
+       return sprintf(buf, "%d\n", rdev->constraints->state_mem.uV);
+}
+
+static ssize_t regulator_suspend_disk_uV_show(struct device *dev,
+                               struct device_attribute *attr, char *buf)
+{
+       struct regulator_dev *rdev = to_rdev(dev);
+
+       if (!rdev->constraints)
+               return sprintf(buf, "not defined\n");
+       return sprintf(buf, "%d\n", rdev->constraints->state_disk.uV);
+}
+
+static ssize_t regulator_suspend_standby_uV_show(struct device *dev,
+                               struct device_attribute *attr, char *buf)
+{
+       struct regulator_dev *rdev = to_rdev(dev);
+
+       if (!rdev->constraints)
+               return sprintf(buf, "not defined\n");
+       return sprintf(buf, "%d\n", rdev->constraints->state_standby.uV);
+}
+
+static ssize_t suspend_opmode_show(struct regulator_dev *rdev,
+       unsigned int mode, char *buf)
+{
+       switch (mode) {
+       case REGULATOR_MODE_FAST:
+               return sprintf(buf, "fast\n");
+       case REGULATOR_MODE_NORMAL:
+               return sprintf(buf, "normal\n");
+       case REGULATOR_MODE_IDLE:
+               return sprintf(buf, "idle\n");
+       case REGULATOR_MODE_STANDBY:
+               return sprintf(buf, "standby\n");
+       }
+       return sprintf(buf, "unknown\n");
+}
+
+static ssize_t regulator_suspend_mem_mode_show(struct device *dev,
+                               struct device_attribute *attr, char *buf)
+{
+       struct regulator_dev *rdev = to_rdev(dev);
+
+       if (!rdev->constraints)
+               return sprintf(buf, "not defined\n");
+       return suspend_opmode_show(rdev,
+               rdev->constraints->state_mem.mode, buf);
+}
+
+static ssize_t regulator_suspend_disk_mode_show(struct device *dev,
+                               struct device_attribute *attr, char *buf)
+{
+       struct regulator_dev *rdev = to_rdev(dev);
+
+       if (!rdev->constraints)
+               return sprintf(buf, "not defined\n");
+       return suspend_opmode_show(rdev,
+               rdev->constraints->state_disk.mode, buf);
+}
+
+static ssize_t regulator_suspend_standby_mode_show(struct device *dev,
+                               struct device_attribute *attr, char *buf)
+{
+       struct regulator_dev *rdev = to_rdev(dev);
+
+       if (!rdev->constraints)
+               return sprintf(buf, "not defined\n");
+       return suspend_opmode_show(rdev,
+               rdev->constraints->state_standby.mode, buf);
+}
+
+static ssize_t regulator_suspend_mem_state_show(struct device *dev,
+                                  struct device_attribute *attr, char *buf)
+{
+       struct regulator_dev *rdev = to_rdev(dev);
+
+       if (!rdev->constraints)
+               return sprintf(buf, "not defined\n");
+
+       if (rdev->constraints->state_mem.enabled)
+               return sprintf(buf, "enabled\n");
+       else
+               return sprintf(buf, "disabled\n");
+}
+
+static ssize_t regulator_suspend_disk_state_show(struct device *dev,
+                                  struct device_attribute *attr, char *buf)
+{
+       struct regulator_dev *rdev = to_rdev(dev);
+
+       if (!rdev->constraints)
+               return sprintf(buf, "not defined\n");
+
+       if (rdev->constraints->state_disk.enabled)
+               return sprintf(buf, "enabled\n");
+       else
+               return sprintf(buf, "disabled\n");
+}
+
+static ssize_t regulator_suspend_standby_state_show(struct device *dev,
+                                  struct device_attribute *attr, char *buf)
+{
+       struct regulator_dev *rdev = to_rdev(dev);
+
+       if (!rdev->constraints)
+               return sprintf(buf, "not defined\n");
+
+       if (rdev->constraints->state_standby.enabled)
+               return sprintf(buf, "enabled\n");
+       else
+               return sprintf(buf, "disabled\n");
+}
+static struct device_attribute regulator_dev_attrs[] = {
+       __ATTR(microvolts, 0444, regulator_uV_show, NULL),
+       __ATTR(microamps, 0444, regulator_uA_show, NULL),
+       __ATTR(opmode, 0444, regulator_opmode_show, NULL),
+       __ATTR(state, 0444, regulator_state_show, NULL),
+       __ATTR(min_microvolts, 0444, regulator_min_uV_show, NULL),
+       __ATTR(min_microamps, 0444, regulator_min_uA_show, NULL),
+       __ATTR(max_microvolts, 0444, regulator_max_uV_show, NULL),
+       __ATTR(max_microamps, 0444, regulator_max_uA_show, NULL),
+       __ATTR(requested_microamps, 0444, regulator_total_uA_show, NULL),
+       __ATTR(num_users, 0444, regulator_num_users_show, NULL),
+       __ATTR(type, 0444, regulator_type_show, NULL),
+       __ATTR(suspend_mem_microvolts, 0444,
+               regulator_suspend_mem_uV_show, NULL),
+       __ATTR(suspend_disk_microvolts, 0444,
+               regulator_suspend_disk_uV_show, NULL),
+       __ATTR(suspend_standby_microvolts, 0444,
+               regulator_suspend_standby_uV_show, NULL),
+       __ATTR(suspend_mem_mode, 0444,
+               regulator_suspend_mem_mode_show, NULL),
+       __ATTR(suspend_disk_mode, 0444,
+               regulator_suspend_disk_mode_show, NULL),
+       __ATTR(suspend_standby_mode, 0444,
+               regulator_suspend_standby_mode_show, NULL),
+       __ATTR(suspend_mem_state, 0444,
+               regulator_suspend_mem_state_show, NULL),
+       __ATTR(suspend_disk_state, 0444,
+               regulator_suspend_disk_state_show, NULL),
+       __ATTR(suspend_standby_state, 0444,
+               regulator_suspend_standby_state_show, NULL),
+       __ATTR_NULL,
+};
+
+static void regulator_dev_release(struct device *dev)
+{
+       struct regulator_dev *rdev = to_rdev(dev);
+       kfree(rdev);
+}
+
+static struct class regulator_class = {
+       .name = "regulator",
+       .dev_release = regulator_dev_release,
+       .dev_attrs = regulator_dev_attrs,
+};
+
+/* Calculate the new optimum regulator operating mode based on the new total
+ * consumer load. All locks held by caller */
+static void drms_uA_update(struct regulator_dev *rdev)
+{
+       struct regulator *sibling;
+       int current_uA = 0, output_uV, input_uV, err;
+       unsigned int mode;
+
+       err = regulator_check_drms(rdev);
+       if (err < 0 || !rdev->desc->ops->get_optimum_mode ||
+           !rdev->desc->ops->get_voltage || !rdev->desc->ops->set_mode);
+       return;
+
+       /* get output voltage */
+       output_uV = rdev->desc->ops->get_voltage(rdev);
+       if (output_uV <= 0)
+               return;
+
+       /* get input voltage */
+       if (rdev->supply && rdev->supply->desc->ops->get_voltage)
+               input_uV = rdev->supply->desc->ops->get_voltage(rdev->supply);
+       else
+               input_uV = rdev->constraints->input_uV;
+       if (input_uV <= 0)
+               return;
+
+       /* calc total requested load */
+       list_for_each_entry(sibling, &rdev->consumer_list, list)
+           current_uA += sibling->uA_load;
+
+       /* now get the optimum mode for our new total regulator load */
+       mode = rdev->desc->ops->get_optimum_mode(rdev, input_uV,
+                                                 output_uV, current_uA);
+
+       /* check the new mode is allowed */
+       err = regulator_check_mode(rdev, mode);
+       if (err == 0)
+               rdev->desc->ops->set_mode(rdev, mode);
+}
+
+static int suspend_set_state(struct regulator_dev *rdev,
+       struct regulator_state *rstate)
+{
+       int ret = 0;
+
+       /* enable & disable are mandatory for suspend control */
+       if (!rdev->desc->ops->set_suspend_enable ||
+               !rdev->desc->ops->set_suspend_disable)
+               return -EINVAL;
+
+       if (rstate->enabled)
+               ret = rdev->desc->ops->set_suspend_enable(rdev);
+       else
+               ret = rdev->desc->ops->set_suspend_disable(rdev);
+       if (ret < 0) {
+               printk(KERN_ERR "%s: failed to enabled/disable\n", __func__);
+               return ret;
+       }
+
+       if (rdev->desc->ops->set_suspend_voltage && rstate->uV > 0) {
+               ret = rdev->desc->ops->set_suspend_voltage(rdev, rstate->uV);
+               if (ret < 0) {
+                       printk(KERN_ERR "%s: failed to set voltage\n",
+                               __func__);
+                       return ret;
+               }
+       }
+
+       if (rdev->desc->ops->set_suspend_mode && rstate->mode > 0) {
+               ret = rdev->desc->ops->set_suspend_mode(rdev, rstate->mode);
+               if (ret < 0) {
+                       printk(KERN_ERR "%s: failed to set mode\n", __func__);
+                       return ret;
+               }
+       }
+       return ret;
+}
+
+/* locks held by caller */
+static int suspend_prepare(struct regulator_dev *rdev, suspend_state_t state)
+{
+       if (!rdev->constraints)
+               return -EINVAL;
+
+       switch (state) {
+       case PM_SUSPEND_STANDBY:
+               return suspend_set_state(rdev,
+                       &rdev->constraints->state_standby);
+       case PM_SUSPEND_MEM:
+               return suspend_set_state(rdev,
+                       &rdev->constraints->state_mem);
+       case PM_SUSPEND_MAX:
+               return suspend_set_state(rdev,
+                       &rdev->constraints->state_disk);
+       default:
+               return -EINVAL;
+       }
+}
+
+static void print_constraints(struct regulator_dev *rdev)
+{
+       struct regulation_constraints *constraints = rdev->constraints;
+       char buf[80];
+       int count;
+
+       if (rdev->desc->type == REGULATOR_VOLTAGE) {
+               if (constraints->min_uV == constraints->max_uV)
+                       count = sprintf(buf, "%d mV ",
+                                       constraints->min_uV / 1000);
+               else
+                       count = sprintf(buf, "%d <--> %d mV ",
+                                       constraints->min_uV / 1000,
+                                       constraints->max_uV / 1000);
+       } else {
+               if (constraints->min_uA == constraints->max_uA)
+                       count = sprintf(buf, "%d mA ",
+                                       constraints->min_uA / 1000);
+               else
+                       count = sprintf(buf, "%d <--> %d mA ",
+                                       constraints->min_uA / 1000,
+                                       constraints->max_uA / 1000);
+       }
+       if (constraints->valid_modes_mask & REGULATOR_MODE_FAST)
+               count += sprintf(buf + count, "fast ");
+       if (constraints->valid_modes_mask & REGULATOR_MODE_NORMAL)
+               count += sprintf(buf + count, "normal ");
+       if (constraints->valid_modes_mask & REGULATOR_MODE_IDLE)
+               count += sprintf(buf + count, "idle ");
+       if (constraints->valid_modes_mask & REGULATOR_MODE_STANDBY)
+               count += sprintf(buf + count, "standby");
+
+       printk(KERN_INFO "regulator: %s: %s\n", rdev->desc->name, buf);
+}
+
+#define REG_STR_SIZE   32
+
+static struct regulator *create_regulator(struct regulator_dev *rdev,
+                                         struct device *dev,
+                                         const char *supply_name)
+{
+       struct regulator *regulator;
+       char buf[REG_STR_SIZE];
+       int err, size;
+
+       regulator = kzalloc(sizeof(*regulator), GFP_KERNEL);
+       if (regulator == NULL)
+               return NULL;
+
+       mutex_lock(&rdev->mutex);
+       regulator->rdev = rdev;
+       list_add(&regulator->list, &rdev->consumer_list);
+
+       if (dev) {
+               /* create a 'requested_microamps_name' sysfs entry */
+               size = scnprintf(buf, REG_STR_SIZE, "microamps_requested_%s",
+                       supply_name);
+               if (size >= REG_STR_SIZE)
+                       goto overflow_err;
+
+               regulator->dev = dev;
+               regulator->dev_attr.attr.name = kstrdup(buf, GFP_KERNEL);
+               if (regulator->dev_attr.attr.name == NULL)
+                       goto attr_name_err;
+
+               regulator->dev_attr.attr.owner = THIS_MODULE;
+               regulator->dev_attr.attr.mode = 0444;
+               regulator->dev_attr.show = device_requested_uA_show;
+               err = device_create_file(dev, &regulator->dev_attr);
+               if (err < 0) {
+                       printk(KERN_WARNING "%s: could not add regulator_dev"
+                               " load sysfs\n", __func__);
+                       goto attr_name_err;
+               }
+
+               /* also add a link to the device sysfs entry */
+               size = scnprintf(buf, REG_STR_SIZE, "%s-%s",
+                                dev->kobj.name, supply_name);
+               if (size >= REG_STR_SIZE)
+                       goto attr_err;
+
+               regulator->supply_name = kstrdup(buf, GFP_KERNEL);
+               if (regulator->supply_name == NULL)
+                       goto attr_err;
+
+               err = sysfs_create_link(&rdev->dev.kobj, &dev->kobj,
+                                       buf);
+               if (err) {
+                       printk(KERN_WARNING
+                              "%s: could not add device link %s err %d\n",
+                              __func__, dev->kobj.name, err);
+                       device_remove_file(dev, &regulator->dev_attr);
+                       goto link_name_err;
+               }
+       }
+       mutex_unlock(&rdev->mutex);
+       return regulator;
+link_name_err:
+       kfree(regulator->supply_name);
+attr_err:
+       device_remove_file(regulator->dev, &regulator->dev_attr);
+attr_name_err:
+       kfree(regulator->dev_attr.attr.name);
+overflow_err:
+       list_del(&regulator->list);
+       kfree(regulator);
+       mutex_unlock(&rdev->mutex);
+       return NULL;
+}
+
+/**
+ * regulator_get - lookup and obtain a reference to a regulator.
+ * @dev: device for regulator "consumer"
+ * @id: Supply name or regulator ID.
+ *
+ * Returns a struct regulator corresponding to the regulator producer,
+ * or IS_ERR() condition containing errno.  Use of supply names
+ * configured via regulator_set_device_supply() is strongly
+ * encouraged.
+ */
+struct regulator *regulator_get(struct device *dev, const char *id)
+{
+       struct regulator_dev *rdev;
+       struct regulator_map *map;
+       struct regulator *regulator = ERR_PTR(-ENODEV);
+       const char *supply = id;
+
+       if (id == NULL) {
+               printk(KERN_ERR "regulator: get() with no identifier\n");
+               return regulator;
+       }
+
+       mutex_lock(&regulator_list_mutex);
+
+       list_for_each_entry(map, &regulator_map_list, list) {
+               if (dev == map->dev &&
+                   strcmp(map->supply, id) == 0) {
+                       supply = map->regulator;
+                       break;
+               }
+       }
+
+       list_for_each_entry(rdev, &regulator_list, list) {
+               if (strcmp(supply, rdev->desc->name) == 0 &&
+                   try_module_get(rdev->owner))
+                       goto found;
+       }
+       printk(KERN_ERR "regulator: Unable to get requested regulator: %s\n",
+              id);
+       mutex_unlock(&regulator_list_mutex);
+       return regulator;
+
+found:
+       regulator = create_regulator(rdev, dev, id);
+       if (regulator == NULL) {
+               regulator = ERR_PTR(-ENOMEM);
+               module_put(rdev->owner);
+       }
+
+       mutex_unlock(&regulator_list_mutex);
+       return regulator;
+}
+EXPORT_SYMBOL_GPL(regulator_get);
+
+/**
+ * regulator_put - "free" the regulator source
+ * @regulator: regulator source
+ *
+ * Note: drivers must ensure that all regulator_enable calls made on this
+ * regulator source are balanced by regulator_disable calls prior to calling
+ * this function.
+ */
+void regulator_put(struct regulator *regulator)
+{
+       struct regulator_dev *rdev;
+
+       if (regulator == NULL || IS_ERR(regulator))
+               return;
+
+       if (regulator->enabled) {
+               printk(KERN_WARNING "Releasing supply %s while enabled\n",
+                      regulator->supply_name);
+               WARN_ON(regulator->enabled);
+               regulator_disable(regulator);
+       }
+
+       mutex_lock(&regulator_list_mutex);
+       rdev = regulator->rdev;
+
+       /* remove any sysfs entries */
+       if (regulator->dev) {
+               sysfs_remove_link(&rdev->dev.kobj, regulator->supply_name);
+               kfree(regulator->supply_name);
+               device_remove_file(regulator->dev, &regulator->dev_attr);
+               kfree(regulator->dev_attr.attr.name);
+       }
+       list_del(&regulator->list);
+       kfree(regulator);
+
+       module_put(rdev->owner);
+       mutex_unlock(&regulator_list_mutex);
+}
+EXPORT_SYMBOL_GPL(regulator_put);
+
+/* locks held by regulator_enable() */
+static int _regulator_enable(struct regulator_dev *rdev)
+{
+       int ret = -EINVAL;
+
+       if (!rdev->constraints) {
+               printk(KERN_ERR "%s: %s has no constraints\n",
+                      __func__, rdev->desc->name);
+               return ret;
+       }
+
+       /* do we need to enable the supply regulator first */
+       if (rdev->supply) {
+               ret = _regulator_enable(rdev->supply);
+               if (ret < 0) {
+                       printk(KERN_ERR "%s: failed to enable %s: %d\n",
+                              __func__, rdev->desc->name, ret);
+                       return ret;
+               }
+       }
+
+       /* check voltage and requested load before enabling */
+       if (rdev->desc->ops->enable) {
+
+               if (rdev->constraints &&
+                       (rdev->constraints->valid_ops_mask &
+                       REGULATOR_CHANGE_DRMS))
+                       drms_uA_update(rdev);
+
+               ret = rdev->desc->ops->enable(rdev);
+               if (ret < 0) {
+                       printk(KERN_ERR "%s: failed to enable %s: %d\n",
+                              __func__, rdev->desc->name, ret);
+                       return ret;
+               }
+               rdev->use_count++;
+               return ret;
+       }
+
+       return ret;
+}
+
+/**
+ * regulator_enable - enable regulator output
+ * @regulator: regulator source
+ *
+ * Enable the regulator output at the predefined voltage or current value.
+ * NOTE: the output value can be set by other drivers, boot loader or may be
+ * hardwired in the regulator.
+ * NOTE: calls to regulator_enable() must be balanced with calls to
+ * regulator_disable().
+ */
+int regulator_enable(struct regulator *regulator)
+{
+       int ret;
+
+       if (regulator->enabled) {
+               printk(KERN_CRIT "Regulator %s already enabled\n",
+                      regulator->supply_name);
+               WARN_ON(regulator->enabled);
+               return 0;
+       }
+
+       mutex_lock(&regulator->rdev->mutex);
+       regulator->enabled = 1;
+       ret = _regulator_enable(regulator->rdev);
+       if (ret != 0)
+               regulator->enabled = 0;
+       mutex_unlock(&regulator->rdev->mutex);
+       return ret;
+}
+EXPORT_SYMBOL_GPL(regulator_enable);
+
+/* locks held by regulator_disable() */
+static int _regulator_disable(struct regulator_dev *rdev)
+{
+       int ret = 0;
+
+       /* are we the last user and permitted to disable ? */
+       if (rdev->use_count == 1 && !rdev->constraints->always_on) {
+
+               /* we are last user */
+               if (rdev->desc->ops->disable) {
+                       ret = rdev->desc->ops->disable(rdev);
+                       if (ret < 0) {
+                               printk(KERN_ERR "%s: failed to disable %s\n",
+                                      __func__, rdev->desc->name);
+                               return ret;
+                       }
+               }
+
+               /* decrease our supplies ref count and disable if required */
+               if (rdev->supply)
+                       _regulator_disable(rdev->supply);
+
+               rdev->use_count = 0;
+       } else if (rdev->use_count > 1) {
+
+               if (rdev->constraints &&
+                       (rdev->constraints->valid_ops_mask &
+                       REGULATOR_CHANGE_DRMS))
+                       drms_uA_update(rdev);
+
+               rdev->use_count--;
+       }
+       return ret;
+}
+
+/**
+ * regulator_disable - disable regulator output
+ * @regulator: regulator source
+ *
+ * Disable the regulator output voltage or current.
+ * NOTE: this will only disable the regulator output if no other consumer
+ * devices have it enabled.
+ * NOTE: calls to regulator_enable() must be balanced with calls to
+ * regulator_disable().
+ */
+int regulator_disable(struct regulator *regulator)
+{
+       int ret;
+
+       if (!regulator->enabled) {
+               printk(KERN_ERR "%s: not in use by this consumer\n",
+                       __func__);
+               return 0;
+       }
+
+       mutex_lock(&regulator->rdev->mutex);
+       regulator->enabled = 0;
+       regulator->uA_load = 0;
+       ret = _regulator_disable(regulator->rdev);
+       mutex_unlock(&regulator->rdev->mutex);
+       return ret;
+}
+EXPORT_SYMBOL_GPL(regulator_disable);
+
+/* locks held by regulator_force_disable() */
+static int _regulator_force_disable(struct regulator_dev *rdev)
+{
+       int ret = 0;
+
+       /* force disable */
+       if (rdev->desc->ops->disable) {
+               /* ah well, who wants to live forever... */
+               ret = rdev->desc->ops->disable(rdev);
+               if (ret < 0) {
+                       printk(KERN_ERR "%s: failed to force disable %s\n",
+                              __func__, rdev->desc->name);
+                       return ret;
+               }
+               /* notify other consumers that power has been forced off */
+               _notifier_call_chain(rdev, REGULATOR_EVENT_FORCE_DISABLE,
+                       NULL);
+       }
+
+       /* decrease our supplies ref count and disable if required */
+       if (rdev->supply)
+               _regulator_disable(rdev->supply);
+
+       rdev->use_count = 0;
+       return ret;
+}
+
+/**
+ * regulator_force_disable - force disable regulator output
+ * @regulator: regulator source
+ *
+ * Forcibly disable the regulator output voltage or current.
+ * NOTE: this *will* disable the regulator output even if other consumer
+ * devices have it enabled. This should be used for situations when device
+ * damage will likely occur if the regulator is not disabled (e.g. over temp).
+ */
+int regulator_force_disable(struct regulator *regulator)
+{
+       int ret;
+
+       mutex_lock(&regulator->rdev->mutex);
+       regulator->enabled = 0;
+       regulator->uA_load = 0;
+       ret = _regulator_force_disable(regulator->rdev);
+       mutex_unlock(&regulator->rdev->mutex);
+       return ret;
+}
+EXPORT_SYMBOL_GPL(regulator_force_disable);
+
+static int _regulator_is_enabled(struct regulator_dev *rdev)
+{
+       int ret;
+
+       mutex_lock(&rdev->mutex);
+
+       /* sanity check */
+       if (!rdev->desc->ops->is_enabled) {
+               ret = -EINVAL;
+               goto out;
+       }
+
+       ret = rdev->desc->ops->is_enabled(rdev);
+out:
+       mutex_unlock(&rdev->mutex);
+       return ret;
+}
+
+/**
+ * regulator_is_enabled - is the regulator output enabled
+ * @regulator: regulator source
+ *
+ * Returns zero for disabled otherwise return number of enable requests.
+ */
+int regulator_is_enabled(struct regulator *regulator)
+{
+       return _regulator_is_enabled(regulator->rdev);
+}
+EXPORT_SYMBOL_GPL(regulator_is_enabled);
+
+/**
+ * regulator_set_voltage - set regulator output voltage
+ * @regulator: regulator source
+ * @min_uV: Minimum required voltage in uV
+ * @max_uV: Maximum acceptable voltage in uV
+ *
+ * Sets a voltage regulator to the desired output voltage. This can be set
+ * during any regulator state. IOW, regulator can be disabled or enabled.
+ *
+ * If the regulator is enabled then the voltage will change to the new value
+ * immediately otherwise if the regulator is disabled the regulator will
+ * output at the new voltage when enabled.
+ *
+ * NOTE: If the regulator is shared between several devices then the lowest
+ * request voltage that meets the system constraints will be used.
+ * NOTE: Regulator system constraints must be set for this regulator before
+ * calling this function otherwise this call will fail.
+ */
+int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV)
+{
+       struct regulator_dev *rdev = regulator->rdev;
+       int ret;
+
+       mutex_lock(&rdev->mutex);
+
+       /* sanity check */
+       if (!rdev->desc->ops->set_voltage) {
+               ret = -EINVAL;
+               goto out;
+       }
+
+       /* constraints check */
+       ret = regulator_check_voltage(rdev, &min_uV, &max_uV);
+       if (ret < 0)
+               goto out;
+       regulator->min_uV = min_uV;
+       regulator->max_uV = max_uV;
+       ret = rdev->desc->ops->set_voltage(rdev, min_uV, max_uV);
+
+out:
+       mutex_unlock(&rdev->mutex);
+       return ret;
+}
+EXPORT_SYMBOL_GPL(regulator_set_voltage);
+
+static int _regulator_get_voltage(struct regulator_dev *rdev)
+{
+       /* sanity check */
+       if (rdev->desc->ops->get_voltage)
+               return rdev->desc->ops->get_voltage(rdev);
+       else
+               return -EINVAL;
+}
+
+/**
+ * regulator_get_voltage - get regulator output voltage
+ * @regulator: regulator source
+ *
+ * This returns the current regulator voltage in uV.
+ *
+ * NOTE: If the regulator is disabled it will return the voltage value. This
+ * function should not be used to determine regulator state.
+ */
+int regulator_get_voltage(struct regulator *regulator)
+{
+       int ret;
+
+       mutex_lock(&regulator->rdev->mutex);
+
+       ret = _regulator_get_voltage(regulator->rdev);
+
+       mutex_unlock(&regulator->rdev->mutex);
+
+       return ret;
+}
+EXPORT_SYMBOL_GPL(regulator_get_voltage);
+
+/**
+ * regulator_set_current_limit - set regulator output current limit
+ * @regulator: regulator source
+ * @min_uA: Minimuum supported current in uA
+ * @max_uA: Maximum supported current in uA
+ *
+ * Sets current sink to the desired output current. This can be set during
+ * any regulator state. IOW, regulator can be disabled or enabled.
+ *
+ * If the regulator is enabled then the current will change to the new value
+ * immediately otherwise if the regulator is disabled the regulator will
+ * output at the new current when enabled.
+ *
+ * NOTE: Regulator system constraints must be set for this regulator before
+ * calling this function otherwise this call will fail.
+ */
+int regulator_set_current_limit(struct regulator *regulator,
+                              int min_uA, int max_uA)
+{
+       struct regulator_dev *rdev = regulator->rdev;
+       int ret;
+
+       mutex_lock(&rdev->mutex);
+
+       /* sanity check */
+       if (!rdev->desc->ops->set_current_limit) {
+               ret = -EINVAL;
+               goto out;
+       }
+
+       /* constraints check */
+       ret = regulator_check_current_limit(rdev, &min_uA, &max_uA);
+       if (ret < 0)
+               goto out;
+
+       ret = rdev->desc->ops->set_current_limit(rdev, min_uA, max_uA);
+out:
+       mutex_unlock(&rdev->mutex);
+       return ret;
+}
+EXPORT_SYMBOL_GPL(regulator_set_current_limit);
+
+static int _regulator_get_current_limit(struct regulator_dev *rdev)
+{
+       int ret;
+
+       mutex_lock(&rdev->mutex);
+
+       /* sanity check */
+       if (!rdev->desc->ops->get_current_limit) {
+               ret = -EINVAL;
+               goto out;
+       }
+
+       ret = rdev->desc->ops->get_current_limit(rdev);
+out:
+       mutex_unlock(&rdev->mutex);
+       return ret;
+}
+
+/**
+ * regulator_get_current_limit - get regulator output current
+ * @regulator: regulator source
+ *
+ * This returns the current supplied by the specified current sink in uA.
+ *
+ * NOTE: If the regulator is disabled it will return the current value. This
+ * function should not be used to determine regulator state.
+ */
+int regulator_get_current_limit(struct regulator *regulator)
+{
+       return _regulator_get_current_limit(regulator->rdev);
+}
+EXPORT_SYMBOL_GPL(regulator_get_current_limit);
+
+/**
+ * regulator_set_mode - set regulator operating mode
+ * @regulator: regulator source
+ * @mode: operating mode - one of the REGULATOR_MODE constants
+ *
+ * Set regulator operating mode to increase regulator efficiency or improve
+ * regulation performance.
+ *
+ * NOTE: Regulator system constraints must be set for this regulator before
+ * calling this function otherwise this call will fail.
+ */
+int regulator_set_mode(struct regulator *regulator, unsigned int mode)
+{
+       struct regulator_dev *rdev = regulator->rdev;
+       int ret;
+
+       mutex_lock(&rdev->mutex);
+
+       /* sanity check */
+       if (!rdev->desc->ops->set_mode) {
+               ret = -EINVAL;
+               goto out;
+       }
+
+       /* constraints check */
+       ret = regulator_check_mode(rdev, mode);
+       if (ret < 0)
+               goto out;
+
+       ret = rdev->desc->ops->set_mode(rdev, mode);
+out:
+       mutex_unlock(&rdev->mutex);
+       return ret;
+}
+EXPORT_SYMBOL_GPL(regulator_set_mode);
+
+static unsigned int _regulator_get_mode(struct regulator_dev *rdev)
+{
+       int ret;
+
+       mutex_lock(&rdev->mutex);
+
+       /* sanity check */
+       if (!rdev->desc->ops->get_mode) {
+               ret = -EINVAL;
+               goto out;
+       }
+
+       ret = rdev->desc->ops->get_mode(rdev);
+out:
+       mutex_unlock(&rdev->mutex);
+       return ret;
+}
+
+/**
+ * regulator_get_mode - get regulator operating mode
+ * @regulator: regulator source
+ *
+ * Get the current regulator operating mode.
+ */
+unsigned int regulator_get_mode(struct regulator *regulator)
+{
+       return _regulator_get_mode(regulator->rdev);
+}
+EXPORT_SYMBOL_GPL(regulator_get_mode);
+
+/**
+ * regulator_set_optimum_mode - set regulator optimum operating mode
+ * @regulator: regulator source
+ * @uA_load: load current
+ *
+ * Notifies the regulator core of a new device load. This is then used by
+ * DRMS (if enabled by constraints) to set the most efficient regulator
+ * operating mode for the new regulator loading.
+ *
+ * Consumer devices notify their supply regulator of the maximum power
+ * they will require (can be taken from device datasheet in the power
+ * consumption tables) when they change operational status and hence power
+ * state. Examples of operational state changes that can affect power
+ * consumption are :-
+ *
+ *    o Device is opened / closed.
+ *    o Device I/O is about to begin or has just finished.
+ *    o Device is idling in between work.
+ *
+ * This information is also exported via sysfs to userspace.
+ *
+ * DRMS will sum the total requested load on the regulator and change
+ * to the most efficient operating mode if platform constraints allow.
+ *
+ * Returns the new regulator mode or error.
+ */
+int regulator_set_optimum_mode(struct regulator *regulator, int uA_load)
+{
+       struct regulator_dev *rdev = regulator->rdev;
+       struct regulator *consumer;
+       int ret, output_uV, input_uV, total_uA_load = 0;
+       unsigned int mode;
+
+       mutex_lock(&rdev->mutex);
+
+       regulator->uA_load = uA_load;
+       ret = regulator_check_drms(rdev);
+       if (ret < 0)
+               goto out;
+       ret = -EINVAL;
+
+       /* sanity check */
+       if (!rdev->desc->ops->get_optimum_mode)
+               goto out;
+
+       /* get output voltage */
+       output_uV = rdev->desc->ops->get_voltage(rdev);
+       if (output_uV <= 0) {
+               printk(KERN_ERR "%s: invalid output voltage found for %s\n",
+                       __func__, rdev->desc->name);
+               goto out;
+       }
+
+       /* get input voltage */
+       if (rdev->supply && rdev->supply->desc->ops->get_voltage)
+               input_uV = rdev->supply->desc->ops->get_voltage(rdev->supply);
+       else
+               input_uV = rdev->constraints->input_uV;
+       if (input_uV <= 0) {
+               printk(KERN_ERR "%s: invalid input voltage found for %s\n",
+                       __func__, rdev->desc->name);
+               goto out;
+       }
+
+       /* calc total requested load for this regulator */
+       list_for_each_entry(consumer, &rdev->consumer_list, list)
+           total_uA_load += consumer->uA_load;
+
+       mode = rdev->desc->ops->get_optimum_mode(rdev,
+                                                input_uV, output_uV,
+                                                total_uA_load);
+       if (ret <= 0) {
+               printk(KERN_ERR "%s: failed to get optimum mode for %s @"
+                       " %d uA %d -> %d uV\n", __func__, rdev->desc->name,
+                       total_uA_load, input_uV, output_uV);
+               goto out;
+       }
+
+       ret = rdev->desc->ops->set_mode(rdev, mode);
+       if (ret <= 0) {
+               printk(KERN_ERR "%s: failed to set optimum mode %x for %s\n",
+                       __func__, mode, rdev->desc->name);
+               goto out;
+       }
+       ret = mode;
+out:
+       mutex_unlock(&rdev->mutex);
+       return ret;
+}
+EXPORT_SYMBOL_GPL(regulator_set_optimum_mode);
+
+/**
+ * regulator_register_notifier - register regulator event notifier
+ * @regulator: regulator source
+ * @notifier_block: notifier block
+ *
+ * Register notifier block to receive regulator events.
+ */
+int regulator_register_notifier(struct regulator *regulator,
+                             struct notifier_block *nb)
+{
+       return blocking_notifier_chain_register(&regulator->rdev->notifier,
+                                               nb);
+}
+EXPORT_SYMBOL_GPL(regulator_register_notifier);
+
+/**
+ * regulator_unregister_notifier - unregister regulator event notifier
+ * @regulator: regulator source
+ * @notifier_block: notifier block
+ *
+ * Unregister regulator event notifier block.
+ */
+int regulator_unregister_notifier(struct regulator *regulator,
+                               struct notifier_block *nb)
+{
+       return blocking_notifier_chain_unregister(&regulator->rdev->notifier,
+                                                 nb);
+}
+EXPORT_SYMBOL_GPL(regulator_unregister_notifier);
+
+/* notify regulator consumers and downstream regulator consumers */
+static void _notifier_call_chain(struct regulator_dev *rdev,
+                                 unsigned long event, void *data)
+{
+       struct regulator_dev *_rdev;
+
+       /* call rdev chain first */
+       mutex_lock(&rdev->mutex);
+       blocking_notifier_call_chain(&rdev->notifier, event, NULL);
+       mutex_unlock(&rdev->mutex);
+
+       /* now notify regulator we supply */
+       list_for_each_entry(_rdev, &rdev->supply_list, slist)
+               _notifier_call_chain(_rdev, event, data);
+}
+
+/**
+ * regulator_bulk_get - get multiple regulator consumers
+ *
+ * @dev:           Device to supply
+ * @num_consumers: Number of consumers to register
+ * @consumers:     Configuration of consumers; clients are stored here.
+ *
+ * @return 0 on success, an errno on failure.
+ *
+ * This helper function allows drivers to get several regulator
+ * consumers in one operation.  If any of the regulators cannot be
+ * acquired then any regulators that were allocated will be freed
+ * before returning to the caller.
+ */
+int regulator_bulk_get(struct device *dev, int num_consumers,
+                      struct regulator_bulk_data *consumers)
+{
+       int i;
+       int ret;
+
+       for (i = 0; i < num_consumers; i++)
+               consumers[i].consumer = NULL;
+
+       for (i = 0; i < num_consumers; i++) {
+               consumers[i].consumer = regulator_get(dev,
+                                                     consumers[i].supply);
+               if (IS_ERR(consumers[i].consumer)) {
+                       dev_err(dev, "Failed to get supply '%s'\n",
+                               consumers[i].supply);
+                       ret = PTR_ERR(consumers[i].consumer);
+                       consumers[i].consumer = NULL;
+                       goto err;
+               }
+       }
+
+       return 0;
+
+err:
+       for (i = 0; i < num_consumers && consumers[i].consumer; i++)
+               regulator_put(consumers[i].consumer);
+
+       return ret;
+}
+EXPORT_SYMBOL_GPL(regulator_bulk_get);
+
+/**
+ * regulator_bulk_enable - enable multiple regulator consumers
+ *
+ * @num_consumers: Number of consumers
+ * @consumers:     Consumer data; clients are stored here.
+ * @return         0 on success, an errno on failure
+ *
+ * This convenience API allows consumers to enable multiple regulator
+ * clients in a single API call.  If any consumers cannot be enabled
+ * then any others that were enabled will be disabled again prior to
+ * return.
+ */
+int regulator_bulk_enable(int num_consumers,
+                         struct regulator_bulk_data *consumers)
+{
+       int i;
+       int ret;
+
+       for (i = 0; i < num_consumers; i++) {
+               ret = regulator_enable(consumers[i].consumer);
+               if (ret != 0)
+                       goto err;
+       }
+
+       return 0;
+
+err:
+       printk(KERN_ERR "Failed to enable %s\n", consumers[i].supply);
+       for (i = 0; i < num_consumers; i++)
+               regulator_disable(consumers[i].consumer);
+
+       return ret;
+}
+EXPORT_SYMBOL_GPL(regulator_bulk_enable);
+
+/**
+ * regulator_bulk_disable - disable multiple regulator consumers
+ *
+ * @num_consumers: Number of consumers
+ * @consumers:     Consumer data; clients are stored here.
+ * @return         0 on success, an errno on failure
+ *
+ * This convenience API allows consumers to disable multiple regulator
+ * clients in a single API call.  If any consumers cannot be enabled
+ * then any others that were disabled will be disabled again prior to
+ * return.
+ */
+int regulator_bulk_disable(int num_consumers,
+                          struct regulator_bulk_data *consumers)
+{
+       int i;
+       int ret;
+
+       for (i = 0; i < num_consumers; i++) {
+               ret = regulator_disable(consumers[i].consumer);
+               if (ret != 0)
+                       goto err;
+       }
+
+       return 0;
+
+err:
+       printk(KERN_ERR "Failed to disable %s\n", consumers[i].supply);
+       for (i = 0; i < num_consumers; i++)
+               regulator_enable(consumers[i].consumer);
+
+       return ret;
+}
+EXPORT_SYMBOL_GPL(regulator_bulk_disable);
+
+/**
+ * regulator_bulk_free - free multiple regulator consumers
+ *
+ * @num_consumers: Number of consumers
+ * @consumers:     Consumer data; clients are stored here.
+ *
+ * This convenience API allows consumers to free multiple regulator
+ * clients in a single API call.
+ */
+void regulator_bulk_free(int num_consumers,
+                        struct regulator_bulk_data *consumers)
+{
+       int i;
+
+       for (i = 0; i < num_consumers; i++) {
+               regulator_put(consumers[i].consumer);
+               consumers[i].consumer = NULL;
+       }
+}
+EXPORT_SYMBOL_GPL(regulator_bulk_free);
+
+/**
+ * regulator_notifier_call_chain - call regulator event notifier
+ * @regulator: regulator source
+ * @event: notifier block
+ * @data:
+ *
+ * Called by regulator drivers to notify clients a regulator event has
+ * occurred. We also notify regulator clients downstream.
+ */
+int regulator_notifier_call_chain(struct regulator_dev *rdev,
+                                 unsigned long event, void *data)
+{
+       _notifier_call_chain(rdev, event, data);
+       return NOTIFY_DONE;
+
+}
+EXPORT_SYMBOL_GPL(regulator_notifier_call_chain);
+
+/**
+ * regulator_register - register regulator
+ * @regulator: regulator source
+ * @reg_data: private regulator data
+ *
+ * Called by regulator drivers to register a regulator.
+ * Returns 0 on success.
+ */
+struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
+                                         void *reg_data)
+{
+       static atomic_t regulator_no = ATOMIC_INIT(0);
+       struct regulator_dev *rdev;
+       int ret;
+
+       if (regulator_desc == NULL)
+               return ERR_PTR(-EINVAL);
+
+       if (regulator_desc->name == NULL || regulator_desc->ops == NULL)
+               return ERR_PTR(-EINVAL);
+
+       if (!regulator_desc->type == REGULATOR_VOLTAGE &&
+           !regulator_desc->type == REGULATOR_CURRENT)
+               return ERR_PTR(-EINVAL);
+
+       rdev = kzalloc(sizeof(struct regulator_dev), GFP_KERNEL);
+       if (rdev == NULL)
+               return ERR_PTR(-ENOMEM);
+
+       mutex_lock(&regulator_list_mutex);
+
+       mutex_init(&rdev->mutex);
+       rdev->reg_data = reg_data;
+       rdev->owner = regulator_desc->owner;
+       rdev->desc = regulator_desc;
+       INIT_LIST_HEAD(&rdev->consumer_list);
+       INIT_LIST_HEAD(&rdev->supply_list);
+       INIT_LIST_HEAD(&rdev->list);
+       INIT_LIST_HEAD(&rdev->slist);
+       BLOCKING_INIT_NOTIFIER_HEAD(&rdev->notifier);
+
+       rdev->dev.class = &regulator_class;
+       device_initialize(&rdev->dev);
+       snprintf(rdev->dev.bus_id, sizeof(rdev->dev.bus_id),
+                "regulator_%ld_%s",
+                (unsigned long)atomic_inc_return(&regulator_no) - 1,
+                regulator_desc->name);
+
+       ret = device_add(&rdev->dev);
+       if (ret == 0)
+               list_add(&rdev->list, &regulator_list);
+       else {
+               kfree(rdev);
+               rdev = ERR_PTR(ret);
+       }
+       mutex_unlock(&regulator_list_mutex);
+       return rdev;
+}
+EXPORT_SYMBOL_GPL(regulator_register);
+
+/**
+ * regulator_unregister - unregister regulator
+ * @regulator: regulator source
+ *
+ * Called by regulator drivers to unregister a regulator.
+ */
+void regulator_unregister(struct regulator_dev *rdev)
+{
+       if (rdev == NULL)
+               return;
+
+       mutex_lock(&regulator_list_mutex);
+       list_del(&rdev->list);
+       if (rdev->supply)
+               sysfs_remove_link(&rdev->dev.kobj, "supply");
+       device_unregister(&rdev->dev);
+       mutex_unlock(&regulator_list_mutex);
+}
+EXPORT_SYMBOL_GPL(regulator_unregister);
+
+/**
+ * regulator_set_supply - set regulator supply regulator
+ * @regulator: regulator name
+ * @supply: supply regulator name
+ *
+ * Called by platform initialisation code to set the supply regulator for this
+ * regulator. This ensures that a regulators supply will also be enabled by the
+ * core if it's child is enabled.
+ */
+int regulator_set_supply(const char *regulator, const char *supply)
+{
+       struct regulator_dev *rdev, *supply_rdev;
+       int err;
+
+       if (regulator == NULL || supply == NULL)
+               return -EINVAL;
+
+       mutex_lock(&regulator_list_mutex);
+
+       list_for_each_entry(rdev, &regulator_list, list) {
+               if (!strcmp(rdev->desc->name, regulator))
+                       goto found_regulator;
+       }
+       mutex_unlock(&regulator_list_mutex);
+       return -ENODEV;
+
+found_regulator:
+       list_for_each_entry(supply_rdev, &regulator_list, list) {
+               if (!strcmp(supply_rdev->desc->name, supply))
+                       goto found_supply;
+       }
+       mutex_unlock(&regulator_list_mutex);
+       return -ENODEV;
+
+found_supply:
+       err = sysfs_create_link(&rdev->dev.kobj, &supply_rdev->dev.kobj,
+                               "supply");
+       if (err) {
+               printk(KERN_ERR
+                      "%s: could not add device link %s err %d\n",
+                      __func__, supply_rdev->dev.kobj.name, err);
+                      goto out;
+       }
+       rdev->supply = supply_rdev;
+       list_add(&rdev->slist, &supply_rdev->supply_list);
+out:
+       mutex_unlock(&regulator_list_mutex);
+       return err;
+}
+EXPORT_SYMBOL_GPL(regulator_set_supply);
+
+/**
+ * regulator_get_supply - get regulator supply regulator
+ * @regulator: regulator name
+ *
+ * Returns the supply supply regulator name or NULL if no supply regulator
+ * exists (i.e the regulator is supplied directly from USB, Line, Battery, etc)
+ */
+const char *regulator_get_supply(const char *regulator)
+{
+       struct regulator_dev *rdev;
+
+       if (regulator == NULL)
+               return NULL;
+
+       mutex_lock(&regulator_list_mutex);
+       list_for_each_entry(rdev, &regulator_list, list) {
+               if (!strcmp(rdev->desc->name, regulator))
+                       goto found;
+       }
+       mutex_unlock(&regulator_list_mutex);
+       return NULL;
+
+found:
+       mutex_unlock(&regulator_list_mutex);
+       if (rdev->supply)
+               return rdev->supply->desc->name;
+       else
+               return NULL;
+}
+EXPORT_SYMBOL_GPL(regulator_get_supply);
+
+/**
+ * regulator_set_machine_constraints - sets regulator constraints
+ * @regulator: regulator source
+ *
+ * Allows platform initialisation code to define and constrain
+ * regulator circuits e.g. valid voltage/current ranges, etc.  NOTE:
+ * Constraints *must* be set by platform code in order for some
+ * regulator operations to proceed i.e. set_voltage, set_current_limit,
+ * set_mode.
+ */
+int regulator_set_machine_constraints(const char *regulator_name,
+       struct regulation_constraints *constraints)
+{
+       struct regulator_dev *rdev;
+       int ret = 0;
+
+       if (regulator_name == NULL)
+               return -EINVAL;
+
+       mutex_lock(&regulator_list_mutex);
+
+       list_for_each_entry(rdev, &regulator_list, list) {
+               if (!strcmp(regulator_name, rdev->desc->name))
+                       goto found;
+       }
+       ret = -ENODEV;
+       goto out;
+
+found:
+       mutex_lock(&rdev->mutex);
+       rdev->constraints = constraints;
+
+       /* do we need to apply the constraint voltage */
+       if (rdev->constraints->apply_uV &&
+               rdev->constraints->min_uV == rdev->constraints->max_uV &&
+               rdev->desc->ops->set_voltage) {
+               ret = rdev->desc->ops->set_voltage(rdev,
+                       rdev->constraints->min_uV, rdev->constraints->max_uV);
+                       if (ret < 0) {
+                               printk(KERN_ERR "%s: failed to apply %duV"
+                                       " constraint\n", __func__,
+                                       rdev->constraints->min_uV);
+                               rdev->constraints = NULL;
+                               goto out;
+                       }
+       }
+
+       /* are we enabled at boot time by firmware / bootloader */
+       if (rdev->constraints->boot_on)
+               rdev->use_count = 1;
+
+       /* do we need to setup our suspend state */
+       if (constraints->initial_state)
+               ret = suspend_prepare(rdev, constraints->initial_state);
+
+       print_constraints(rdev);
+       mutex_unlock(&rdev->mutex);
+
+out:
+       mutex_unlock(&regulator_list_mutex);
+       return ret;
+}
+EXPORT_SYMBOL_GPL(regulator_set_machine_constraints);
+
+
+/**
+ * regulator_set_device_supply: Bind a regulator to a symbolic supply
+ * @regulator: regulator source
+ * @dev:       device the supply applies to
+ * @supply:    symbolic name for supply
+ *
+ * Allows platform initialisation code to map physical regulator
+ * sources to symbolic names for supplies for use by devices.  Devices
+ * should use these symbolic names to request regulators, avoiding the
+ * need to provide board-specific regulator names as platform data.
+ */
+int regulator_set_device_supply(const char *regulator, struct device *dev,
+                               const char *supply)
+{
+       struct regulator_map *node;
+
+       if (regulator == NULL || supply == NULL)
+               return -EINVAL;
+
+       node = kmalloc(sizeof(struct regulator_map), GFP_KERNEL);
+       if (node == NULL)
+               return -ENOMEM;
+
+       node->regulator = regulator;
+       node->dev = dev;
+       node->supply = supply;
+
+       mutex_lock(&regulator_list_mutex);
+       list_add(&node->list, &regulator_map_list);
+       mutex_unlock(&regulator_list_mutex);
+       return 0;
+}
+EXPORT_SYMBOL_GPL(regulator_set_device_supply);
+
+/**
+ * regulator_suspend_prepare: prepare regulators for system wide suspend
+ * @state: system suspend state
+ *
+ * Configure each regulator with it's suspend operating parameters for state.
+ * This will usually be called by machine suspend code prior to supending.
+ */
+int regulator_suspend_prepare(suspend_state_t state)
+{
+       struct regulator_dev *rdev;
+       int ret = 0;
+
+       /* ON is handled by regulator active state */
+       if (state == PM_SUSPEND_ON)
+               return -EINVAL;
+
+       mutex_lock(&regulator_list_mutex);
+       list_for_each_entry(rdev, &regulator_list, list) {
+
+               mutex_lock(&rdev->mutex);
+               ret = suspend_prepare(rdev, state);
+               mutex_unlock(&rdev->mutex);
+
+               if (ret < 0) {
+                       printk(KERN_ERR "%s: failed to prepare %s\n",
+                               __func__, rdev->desc->name);
+                       goto out;
+               }
+       }
+out:
+       mutex_unlock(&regulator_list_mutex);
+       return ret;
+}
+EXPORT_SYMBOL_GPL(regulator_suspend_prepare);
+
+/**
+ * rdev_get_drvdata - get rdev regulator driver data
+ * @regulator: regulator
+ *
+ * Get rdev regulator driver private data. This call can be used in the
+ * regulator driver context.
+ */
+void *rdev_get_drvdata(struct regulator_dev *rdev)
+{
+       return rdev->reg_data;
+}
+EXPORT_SYMBOL_GPL(rdev_get_drvdata);
+
+/**
+ * regulator_get_drvdata - get regulator driver data
+ * @regulator: regulator
+ *
+ * Get regulator driver private data. This call can be used in the consumer
+ * driver context when non API regulator specific functions need to be called.
+ */
+void *regulator_get_drvdata(struct regulator *regulator)
+{
+       return regulator->rdev->reg_data;
+}
+EXPORT_SYMBOL_GPL(regulator_get_drvdata);
+
+/**
+ * regulator_set_drvdata - set regulator driver data
+ * @regulator: regulator
+ * @data: data
+ */
+void regulator_set_drvdata(struct regulator *regulator, void *data)
+{
+       regulator->rdev->reg_data = data;
+}
+EXPORT_SYMBOL_GPL(regulator_set_drvdata);
+
+/**
+ * regulator_get_id - get regulator ID
+ * @regulator: regulator
+ */
+int rdev_get_id(struct regulator_dev *rdev)
+{
+       return rdev->desc->id;
+}
+EXPORT_SYMBOL_GPL(rdev_get_id);
+
+static int __init regulator_init(void)
+{
+       printk(KERN_INFO "regulator: core version %s\n", REGULATOR_VERSION);
+       return class_register(&regulator_class);
+}
+
+/* init early to allow our consumers to complete system booting */
+core_initcall(regulator_init);
diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
new file mode 100644 (file)
index 0000000..d31db3e
--- /dev/null
@@ -0,0 +1,129 @@
+/*
+ * fixed.c
+ *
+ * Copyright 2008 Wolfson Microelectronics PLC.
+ *
+ * Author: Mark Brown <broonie@opensource.wolfsonmicro.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 is useful for systems with mixed controllable and
+ * non-controllable regulators, as well as for allowing testing on
+ * systems with no controllable regulators.
+ */
+
+#include <linux/err.h>
+#include <linux/mutex.h>
+#include <linux/platform_device.h>
+#include <linux/regulator/driver.h>
+#include <linux/regulator/fixed.h>
+
+struct fixed_voltage_data {
+       struct regulator_desc desc;
+       struct regulator_dev *dev;
+       int microvolts;
+};
+
+static int fixed_voltage_is_enabled(struct regulator_dev *dev)
+{
+       return 1;
+}
+
+static int fixed_voltage_enable(struct regulator_dev *dev)
+{
+       return 0;
+}
+
+static int fixed_voltage_get_voltage(struct regulator_dev *dev)
+{
+       struct fixed_voltage_data *data = rdev_get_drvdata(dev);
+
+       return data->microvolts;
+}
+
+static struct regulator_ops fixed_voltage_ops = {
+       .is_enabled = fixed_voltage_is_enabled,
+       .enable = fixed_voltage_enable,
+       .get_voltage = fixed_voltage_get_voltage,
+};
+
+static int regulator_fixed_voltage_probe(struct platform_device *pdev)
+{
+       struct fixed_voltage_config *config = pdev->dev.platform_data;
+       struct fixed_voltage_data *drvdata;
+       int ret;
+
+       drvdata = kzalloc(sizeof(struct fixed_voltage_data), GFP_KERNEL);
+       if (drvdata == NULL) {
+               ret = -ENOMEM;
+               goto err;
+       }
+
+       drvdata->desc.name = kstrdup(config->supply_name, GFP_KERNEL);
+       if (drvdata->desc.name == NULL) {
+               ret = -ENOMEM;
+               goto err;
+       }
+       drvdata->desc.type = REGULATOR_VOLTAGE;
+       drvdata->desc.owner = THIS_MODULE;
+       drvdata->desc.ops = &fixed_voltage_ops,
+
+       drvdata->microvolts = config->microvolts;
+
+       drvdata->dev = regulator_register(&drvdata->desc, drvdata);
+       if (IS_ERR(drvdata->dev)) {
+               ret = PTR_ERR(drvdata->dev);
+               goto err_name;
+       }
+
+       platform_set_drvdata(pdev, drvdata);
+
+       dev_dbg(&pdev->dev, "%s supplying %duV\n", drvdata->desc.name,
+               drvdata->microvolts);
+
+       return 0;
+
+err_name:
+       kfree(drvdata->desc.name);
+err:
+       kfree(drvdata);
+       return ret;
+}
+
+static int regulator_fixed_voltage_remove(struct platform_device *pdev)
+{
+       struct fixed_voltage_data *drvdata = platform_get_drvdata(pdev);
+
+       regulator_unregister(drvdata->dev);
+       kfree(drvdata->desc.name);
+       kfree(drvdata);
+
+       return 0;
+}
+
+static struct platform_driver regulator_fixed_voltage_driver = {
+       .probe          = regulator_fixed_voltage_probe,
+       .remove         = regulator_fixed_voltage_remove,
+       .driver         = {
+               .name           = "reg-fixed-voltage",
+       },
+};
+
+static int __init regulator_fixed_voltage_init(void)
+{
+       return platform_driver_register(&regulator_fixed_voltage_driver);
+}
+module_init(regulator_fixed_voltage_init);
+
+static void __exit regulator_fixed_voltage_exit(void)
+{
+       platform_driver_unregister(&regulator_fixed_voltage_driver);
+}
+module_exit(regulator_fixed_voltage_exit);
+
+MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
+MODULE_DESCRIPTION("Fixed voltage regulator");
+MODULE_LICENSE("GPL");
diff --git a/drivers/regulator/virtual.c b/drivers/regulator/virtual.c
new file mode 100644 (file)
index 0000000..5ddb464
--- /dev/null
@@ -0,0 +1,345 @@
+/*
+ * reg-virtual-consumer.c
+ *
+ * Copyright 2008 Wolfson Microelectronics PLC.
+ *
+ * Author: Mark Brown <broonie@opensource.wolfsonmicro.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/err.h>
+#include <linux/mutex.h>
+#include <linux/platform_device.h>
+#include <linux/regulator/consumer.h>
+
+struct virtual_consumer_data {
+       struct mutex lock;
+       struct regulator *regulator;
+       int enabled;
+       int min_uV;
+       int max_uV;
+       int min_uA;
+       int max_uA;
+       unsigned int mode;
+};
+
+static void update_voltage_constraints(struct virtual_consumer_data *data)
+{
+       int ret;
+
+       if (data->min_uV && data->max_uV
+           && data->min_uV <= data->max_uV) {
+               ret = regulator_set_voltage(data->regulator,
+                                           data->min_uV, data->max_uV);
+               if (ret != 0) {
+                       printk(KERN_ERR "regulator_set_voltage() failed: %d\n",
+                              ret);
+                       return;
+               }
+       }
+
+       if (data->min_uV && data->max_uV && !data->enabled) {
+               ret = regulator_enable(data->regulator);
+               if (ret == 0)
+                       data->enabled = 1;
+               else
+                       printk(KERN_ERR "regulator_enable() failed: %d\n",
+                               ret);
+       }
+
+       if (!(data->min_uV && data->max_uV) && data->enabled) {
+               ret = regulator_disable(data->regulator);
+               if (ret == 0)
+                       data->enabled = 0;
+               else
+                       printk(KERN_ERR "regulator_disable() failed: %d\n",
+                               ret);
+       }
+}
+
+static void update_current_limit_constraints(struct virtual_consumer_data
+                                               *data)
+{
+       int ret;
+
+       if (data->max_uA
+           && data->min_uA <= data->max_uA) {
+               ret = regulator_set_current_limit(data->regulator,
+                                       data->min_uA, data->max_uA);
+               if (ret != 0) {
+                       pr_err("regulator_set_current_limit() failed: %d\n",
+                              ret);
+                       return;
+               }
+       }
+
+       if (data->max_uA && !data->enabled) {
+               ret = regulator_enable(data->regulator);
+               if (ret == 0)
+                       data->enabled = 1;
+               else
+                       printk(KERN_ERR "regulator_enable() failed: %d\n",
+                               ret);
+       }
+
+       if (!(data->min_uA && data->max_uA) && data->enabled) {
+               ret = regulator_disable(data->regulator);
+               if (ret == 0)
+                       data->enabled = 0;
+               else
+                       printk(KERN_ERR "regulator_disable() failed: %d\n",
+                               ret);
+       }
+}
+
+static ssize_t show_min_uV(struct device *dev,
+                          struct device_attribute *attr, char *buf)
+{
+       struct virtual_consumer_data *data = dev_get_drvdata(dev);
+       return sprintf(buf, "%d\n", data->min_uV);
+}
+
+static ssize_t set_min_uV(struct device *dev, struct device_attribute *attr,
+                         const char *buf, size_t count)
+{
+       struct virtual_consumer_data *data = dev_get_drvdata(dev);
+       long val;
+
+       if (strict_strtol(buf, 10, &val) != 0)
+               return count;
+
+       mutex_lock(&data->lock);
+
+       data->min_uV = val;
+       update_voltage_constraints(data);
+
+       mutex_unlock(&data->lock);
+
+       return count;
+}
+
+static ssize_t show_max_uV(struct device *dev,
+                          struct device_attribute *attr, char *buf)
+{
+       struct virtual_consumer_data *data = dev_get_drvdata(dev);
+       return sprintf(buf, "%d\n", data->max_uV);
+}
+
+static ssize_t set_max_uV(struct device *dev, struct device_attribute *attr,
+                         const char *buf, size_t count)
+{
+       struct virtual_consumer_data *data = dev_get_drvdata(dev);
+       long val;
+
+       if (strict_strtol(buf, 10, &val) != 0)
+               return count;
+
+       mutex_lock(&data->lock);
+
+       data->max_uV = val;
+       update_voltage_constraints(data);
+
+       mutex_unlock(&data->lock);
+
+       return count;
+}
+
+static ssize_t show_min_uA(struct device *dev,
+                          struct device_attribute *attr, char *buf)
+{
+       struct virtual_consumer_data *data = dev_get_drvdata(dev);
+       return sprintf(buf, "%d\n", data->min_uA);
+}
+
+static ssize_t set_min_uA(struct device *dev, struct device_attribute *attr,
+                         const char *buf, size_t count)
+{
+       struct virtual_consumer_data *data = dev_get_drvdata(dev);
+       long val;
+
+       if (strict_strtol(buf, 10, &val) != 0)
+               return count;
+
+       mutex_lock(&data->lock);
+
+       data->min_uA = val;
+       update_current_limit_constraints(data);
+
+       mutex_unlock(&data->lock);
+
+       return count;
+}
+
+static ssize_t show_max_uA(struct device *dev,
+                          struct device_attribute *attr, char *buf)
+{
+       struct virtual_consumer_data *data = dev_get_drvdata(dev);
+       return sprintf(buf, "%d\n", data->max_uA);
+}
+
+static ssize_t set_max_uA(struct device *dev, struct device_attribute *attr,
+                         const char *buf, size_t count)
+{
+       struct virtual_consumer_data *data = dev_get_drvdata(dev);
+       long val;
+
+       if (strict_strtol(buf, 10, &val) != 0)
+               return count;
+
+       mutex_lock(&data->lock);
+
+       data->max_uA = val;
+       update_current_limit_constraints(data);
+
+       mutex_unlock(&data->lock);
+
+       return count;
+}
+
+static ssize_t show_mode(struct device *dev,
+                        struct device_attribute *attr, char *buf)
+{
+       struct virtual_consumer_data *data = dev_get_drvdata(dev);
+
+       switch (data->mode) {
+       case REGULATOR_MODE_FAST:
+               return sprintf(buf, "fast\n");
+       case REGULATOR_MODE_NORMAL:
+               return sprintf(buf, "normal\n");
+       case REGULATOR_MODE_IDLE:
+               return sprintf(buf, "idle\n");
+       case REGULATOR_MODE_STANDBY:
+               return sprintf(buf, "standby\n");
+       default:
+               return sprintf(buf, "unknown\n");
+       }
+}
+
+static ssize_t set_mode(struct device *dev, struct device_attribute *attr,
+                       const char *buf, size_t count)
+{
+       struct virtual_consumer_data *data = dev_get_drvdata(dev);
+       unsigned int mode;
+       int ret;
+
+       if (strncmp(buf, "fast", strlen("fast")) == 0)
+               mode = REGULATOR_MODE_FAST;
+       else if (strncmp(buf, "normal", strlen("normal")) == 0)
+               mode = REGULATOR_MODE_NORMAL;
+       else if (strncmp(buf, "idle", strlen("idle")) == 0)
+               mode = REGULATOR_MODE_IDLE;
+       else if (strncmp(buf, "standby", strlen("standby")) == 0)
+               mode = REGULATOR_MODE_STANDBY;
+       else {
+               dev_err(dev, "Configuring invalid mode\n");
+               return count;
+       }
+
+       mutex_lock(&data->lock);
+       ret = regulator_set_mode(data->regulator, mode);
+       if (ret == 0)
+               data->mode = mode;
+       else
+               dev_err(dev, "Failed to configure mode: %d\n", ret);
+       mutex_unlock(&data->lock);
+
+       return count;
+}
+
+static DEVICE_ATTR(min_microvolts, 0666, show_min_uV, set_min_uV);
+static DEVICE_ATTR(max_microvolts, 0666, show_max_uV, set_max_uV);
+static DEVICE_ATTR(min_microamps, 0666, show_min_uA, set_min_uA);
+static DEVICE_ATTR(max_microamps, 0666, show_max_uA, set_max_uA);
+static DEVICE_ATTR(mode, 0666, show_mode, set_mode);
+
+struct device_attribute *attributes[] = {
+       &dev_attr_min_microvolts,
+       &dev_attr_max_microvolts,
+       &dev_attr_min_microamps,
+       &dev_attr_max_microamps,
+       &dev_attr_mode,
+};
+
+static int regulator_virtual_consumer_probe(struct platform_device *pdev)
+{
+       char *reg_id = pdev->dev.platform_data;
+       struct virtual_consumer_data *drvdata;
+       int ret, i;
+
+       drvdata = kzalloc(sizeof(struct virtual_consumer_data), GFP_KERNEL);
+       if (drvdata == NULL) {
+               ret = -ENOMEM;
+               goto err;
+       }
+
+       mutex_init(&drvdata->lock);
+
+       drvdata->regulator = regulator_get(&pdev->dev, reg_id);
+       if (IS_ERR(drvdata->regulator)) {
+               ret = PTR_ERR(drvdata->regulator);
+               goto err;
+       }
+
+       for (i = 0; i < ARRAY_SIZE(attributes); i++) {
+               ret = device_create_file(&pdev->dev, attributes[i]);
+               if (ret != 0)
+                       goto err;
+       }
+
+       drvdata->mode = regulator_get_mode(drvdata->regulator);
+
+       platform_set_drvdata(pdev, drvdata);
+
+       return 0;
+
+err:
+       for (i = 0; i < ARRAY_SIZE(attributes); i++)
+               device_remove_file(&pdev->dev, attributes[i]);
+       kfree(drvdata);
+       return ret;
+}
+
+static int regulator_virtual_consumer_remove(struct platform_device *pdev)
+{
+       struct virtual_consumer_data *drvdata = platform_get_drvdata(pdev);
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(attributes); i++)
+               device_remove_file(&pdev->dev, attributes[i]);
+       if (drvdata->enabled)
+               regulator_disable(drvdata->regulator);
+       regulator_put(drvdata->regulator);
+
+       kfree(drvdata);
+
+       return 0;
+}
+
+static struct platform_driver regulator_virtual_consumer_driver = {
+       .probe          = regulator_virtual_consumer_probe,
+       .remove         = regulator_virtual_consumer_remove,
+       .driver         = {
+               .name           = "reg-virt-consumer",
+       },
+};
+
+
+static int __init regulator_virtual_consumer_init(void)
+{
+       return platform_driver_register(&regulator_virtual_consumer_driver);
+}
+module_init(regulator_virtual_consumer_init);
+
+static void __exit regulator_virtual_consumer_exit(void)
+{
+       platform_driver_unregister(&regulator_virtual_consumer_driver);
+}
+module_exit(regulator_virtual_consumer_exit);
+
+MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
+MODULE_DESCRIPTION("Virtual regulator consumer");
+MODULE_LICENSE("GPL");
index d397fa5..7af60b9 100644 (file)
@@ -20,7 +20,7 @@ int rtc_read_time(struct rtc_device *rtc, struct rtc_time *tm)
 
        err = mutex_lock_interruptible(&rtc->ops_lock);
        if (err)
-               return -EBUSY;
+               return err;
 
        if (!rtc->ops)
                err = -ENODEV;
@@ -46,7 +46,7 @@ int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm)
 
        err = mutex_lock_interruptible(&rtc->ops_lock);
        if (err)
-               return -EBUSY;
+               return err;
 
        if (!rtc->ops)
                err = -ENODEV;
@@ -66,7 +66,7 @@ int rtc_set_mmss(struct rtc_device *rtc, unsigned long secs)
 
        err = mutex_lock_interruptible(&rtc->ops_lock);
        if (err)
-               return -EBUSY;
+               return err;
 
        if (!rtc->ops)
                err = -ENODEV;
@@ -106,7 +106,7 @@ static int rtc_read_alarm_internal(struct rtc_device *rtc, struct rtc_wkalrm *al
 
        err = mutex_lock_interruptible(&rtc->ops_lock);
        if (err)
-               return -EBUSY;
+               return err;
 
        if (rtc->ops == NULL)
                err = -ENODEV;
@@ -293,7 +293,7 @@ int rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
 
        err = mutex_lock_interruptible(&rtc->ops_lock);
        if (err)
-               return -EBUSY;
+               return err;
 
        if (!rtc->ops)
                err = -ENODEV;
index 8624f55..a1af4c2 100644 (file)
@@ -2,7 +2,7 @@
  * Blackfin On-Chip Real Time Clock Driver
  *  Supports BF52[257]/BF53[123]/BF53[467]/BF54[24789]
  *
- * Copyright 2004-2007 Analog Devices Inc.
+ * Copyright 2004-2008 Analog Devices Inc.
  *
  * Enter bugs at http://blackfin.uclinux.org/
  *
  * writes to clear status registers complete immediately.
  */
 
+/* It may seem odd that there is no SWCNT code in here (which would be exposed
+ * via the periodic interrupt event, or PIE).  Since the Blackfin RTC peripheral
+ * runs in units of seconds (N/HZ) but the Linux framework runs in units of HZ
+ * (2^N HZ), there is no point in keeping code that only provides 1 HZ PIEs.
+ * The same exact behavior can be accomplished by using the update interrupt
+ * event (UIE).  Maybe down the line the RTC peripheral will suck less in which
+ * case we can re-introduce PIE support.
+ */
+
 #include <linux/bcd.h>
 #include <linux/completion.h>
 #include <linux/delay.h>
@@ -144,14 +153,13 @@ static void bfin_rtc_sync_pending(struct device *dev)
  * Initialize the RTC.  Enable pre-scaler to scale RTC clock
  * to 1Hz and clear interrupt/status registers.
  */
-static void bfin_rtc_reset(struct device *dev)
+static void bfin_rtc_reset(struct device *dev, u16 rtc_ictl)
 {
        struct bfin_rtc *rtc = dev_get_drvdata(dev);
        dev_dbg_stamp(dev);
        bfin_rtc_sync_pending(dev);
        bfin_write_RTC_PREN(0x1);
-       bfin_write_RTC_ICTL(RTC_ISTAT_WRITE_COMPLETE);
-       bfin_write_RTC_SWCNT(0);
+       bfin_write_RTC_ICTL(rtc_ictl);
        bfin_write_RTC_ALARM(0);
        bfin_write_RTC_ISTAT(0xFFFF);
        rtc->rtc_wrote_regs = 0;
@@ -194,14 +202,6 @@ static irqreturn_t bfin_rtc_interrupt(int irq, void *dev_id)
                }
        }
 
-       if (rtc_ictl & RTC_ISTAT_STOPWATCH) {
-               if (rtc_istat & RTC_ISTAT_STOPWATCH) {
-                       bfin_write_RTC_ISTAT(RTC_ISTAT_STOPWATCH);
-                       events |= RTC_PF | RTC_IRQF;
-                       bfin_write_RTC_SWCNT(rtc->rtc_dev->irq_freq);
-               }
-       }
-
        if (rtc_ictl & RTC_ISTAT_SEC) {
                if (rtc_istat & RTC_ISTAT_SEC) {
                        bfin_write_RTC_ISTAT(RTC_ISTAT_SEC);
@@ -226,7 +226,7 @@ static int bfin_rtc_open(struct device *dev)
 
        ret = request_irq(IRQ_RTC, bfin_rtc_interrupt, IRQF_SHARED, to_platform_device(dev)->name, dev);
        if (!ret)
-               bfin_rtc_reset(dev);
+               bfin_rtc_reset(dev, RTC_ISTAT_WRITE_COMPLETE);
 
        return ret;
 }
@@ -234,16 +234,16 @@ static int bfin_rtc_open(struct device *dev)
 static void bfin_rtc_release(struct device *dev)
 {
        dev_dbg_stamp(dev);
-       bfin_rtc_reset(dev);
+       bfin_rtc_reset(dev, 0);
        free_irq(IRQ_RTC, dev);
 }
 
-static void bfin_rtc_int_set(struct bfin_rtc *rtc, u16 rtc_int)
+static void bfin_rtc_int_set(u16 rtc_int)
 {
        bfin_write_RTC_ISTAT(rtc_int);
        bfin_write_RTC_ICTL(bfin_read_RTC_ICTL() | rtc_int);
 }
-static void bfin_rtc_int_clear(struct bfin_rtc *rtc, u16 rtc_int)
+static void bfin_rtc_int_clear(u16 rtc_int)
 {
        bfin_write_RTC_ICTL(bfin_read_RTC_ICTL() & rtc_int);
 }
@@ -252,7 +252,7 @@ static void bfin_rtc_int_set_alarm(struct bfin_rtc *rtc)
        /* Blackfin has different bits for whether the alarm is
         * more than 24 hours away.
         */
-       bfin_rtc_int_set(rtc, (rtc->rtc_alarm.tm_yday == -1 ? RTC_ISTAT_ALARM : RTC_ISTAT_ALARM_DAY));
+       bfin_rtc_int_set(rtc->rtc_alarm.tm_yday == -1 ? RTC_ISTAT_ALARM : RTC_ISTAT_ALARM_DAY);
 }
 static int bfin_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
 {
@@ -264,23 +264,13 @@ static int bfin_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long ar
        bfin_rtc_sync_pending(dev);
 
        switch (cmd) {
-       case RTC_PIE_ON:
-               dev_dbg_stamp(dev);
-               bfin_rtc_int_set(rtc, RTC_ISTAT_STOPWATCH);
-               bfin_write_RTC_SWCNT(rtc->rtc_dev->irq_freq);
-               break;
-       case RTC_PIE_OFF:
-               dev_dbg_stamp(dev);
-               bfin_rtc_int_clear(rtc, ~RTC_ISTAT_STOPWATCH);
-               break;
-
        case RTC_UIE_ON:
                dev_dbg_stamp(dev);
-               bfin_rtc_int_set(rtc, RTC_ISTAT_SEC);
+               bfin_rtc_int_set(RTC_ISTAT_SEC);
                break;
        case RTC_UIE_OFF:
                dev_dbg_stamp(dev);
-               bfin_rtc_int_clear(rtc, ~RTC_ISTAT_SEC);
+               bfin_rtc_int_clear(~RTC_ISTAT_SEC);
                break;
 
        case RTC_AIE_ON:
@@ -289,7 +279,7 @@ static int bfin_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long ar
                break;
        case RTC_AIE_OFF:
                dev_dbg_stamp(dev);
-               bfin_rtc_int_clear(rtc, ~(RTC_ISTAT_ALARM | RTC_ISTAT_ALARM_DAY));
+               bfin_rtc_int_clear(~(RTC_ISTAT_ALARM | RTC_ISTAT_ALARM_DAY));
                break;
 
        default:
@@ -371,30 +361,14 @@ static int bfin_rtc_proc(struct device *dev, struct seq_file *seq)
        seq_printf(seq,
                "alarm_IRQ\t: %s\n"
                "wkalarm_IRQ\t: %s\n"
-               "seconds_IRQ\t: %s\n"
-               "periodic_IRQ\t: %s\n",
+               "seconds_IRQ\t: %s\n",
                yesno(ictl & RTC_ISTAT_ALARM),
                yesno(ictl & RTC_ISTAT_ALARM_DAY),
-               yesno(ictl & RTC_ISTAT_SEC),
-               yesno(ictl & RTC_ISTAT_STOPWATCH));
+               yesno(ictl & RTC_ISTAT_SEC));
        return 0;
 #undef yesno
 }
 
-/**
- *     bfin_irq_set_freq - make sure hardware supports requested freq
- *     @dev: pointer to RTC device structure
- *     @freq: requested frequency rate
- *
- *     The Blackfin RTC can only generate periodic events at 1 per
- *     second (1 Hz), so reject any attempt at changing it.
- */
-static int bfin_irq_set_freq(struct device *dev, int freq)
-{
-       dev_dbg_stamp(dev);
-       return -ENOTTY;
-}
-
 static struct rtc_class_ops bfin_rtc_ops = {
        .open          = bfin_rtc_open,
        .release       = bfin_rtc_release,
@@ -404,7 +378,6 @@ static struct rtc_class_ops bfin_rtc_ops = {
        .read_alarm    = bfin_rtc_read_alarm,
        .set_alarm     = bfin_rtc_set_alarm,
        .proc          = bfin_rtc_proc,
-       .irq_set_freq  = bfin_irq_set_freq,
 };
 
 static int __devinit bfin_rtc_probe(struct platform_device *pdev)
@@ -423,10 +396,14 @@ static int __devinit bfin_rtc_probe(struct platform_device *pdev)
                ret = PTR_ERR(rtc->rtc_dev);
                goto err;
        }
-       rtc->rtc_dev->irq_freq = 1;
+
+       /* see comment at top of file about stopwatch/PIE */
+       bfin_write_RTC_SWCNT(0);
 
        platform_set_drvdata(pdev, rtc);
 
+       device_init_wakeup(&pdev->dev, 1);
+
        return 0;
 
  err:
@@ -445,6 +422,32 @@ static int __devexit bfin_rtc_remove(struct platform_device *pdev)
        return 0;
 }
 
+#ifdef CONFIG_PM
+static int bfin_rtc_suspend(struct platform_device *pdev, pm_message_t state)
+{
+       if (device_may_wakeup(&pdev->dev)) {
+               enable_irq_wake(IRQ_RTC);
+               bfin_rtc_sync_pending(&pdev->dev);
+       } else
+               bfin_rtc_int_clear(-1);
+
+       return 0;
+}
+
+static int bfin_rtc_resume(struct platform_device *pdev)
+{
+       if (device_may_wakeup(&pdev->dev))
+               disable_irq_wake(IRQ_RTC);
+       else
+               bfin_write_RTC_ISTAT(-1);
+
+       return 0;
+}
+#else
+# define bfin_rtc_suspend NULL
+# define bfin_rtc_resume  NULL
+#endif
+
 static struct platform_driver bfin_rtc_driver = {
        .driver         = {
                .name   = "rtc-bfin",
@@ -452,6 +455,8 @@ static struct platform_driver bfin_rtc_driver = {
        },
        .probe          = bfin_rtc_probe,
        .remove         = __devexit_p(bfin_rtc_remove),
+       .suspend        = bfin_rtc_suspend,
+       .resume         = bfin_rtc_resume,
 };
 
 static int __init bfin_rtc_init(void)
index 0a870b7..856cc1a 100644 (file)
@@ -221,7 +221,7 @@ static long rtc_dev_ioctl(struct file *file,
 
        err = mutex_lock_interruptible(&rtc->ops_lock);
        if (err)
-               return -EBUSY;
+               return err;
 
        /* check that the calling task has appropriate permissions
         * for certain ioctls. doing this check here is useful
@@ -432,6 +432,8 @@ static int rtc_dev_release(struct inode *inode, struct file *file)
 #ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL
        clear_uie(rtc);
 #endif
+       rtc_irq_set_state(rtc, NULL, 0);
+
        if (rtc->ops->release)
                rtc->ops->release(rtc->dev.parent);
 
index 2d8df0b..20676cd 100644 (file)
@@ -91,7 +91,8 @@ static struct alias_pav_group *_find_group(struct alias_lcu *lcu,
        else
                search_unit_addr = uid->base_unit_addr;
        list_for_each_entry(pos, &lcu->grouplist, group) {
-               if (pos->uid.base_unit_addr == search_unit_addr)
+               if (pos->uid.base_unit_addr == search_unit_addr &&
+                   !strncmp(pos->uid.vduit, uid->vduit, sizeof(uid->vduit)))
                        return pos;
        };
        return NULL;
@@ -332,6 +333,7 @@ static int _add_device_to_lcu(struct alias_lcu *lcu,
                        group->uid.base_unit_addr = uid->real_unit_addr;
                else
                        group->uid.base_unit_addr = uid->base_unit_addr;
+               memcpy(group->uid.vduit, uid->vduit, sizeof(uid->vduit));
                INIT_LIST_HEAD(&group->group);
                INIT_LIST_HEAD(&group->baselist);
                INIT_LIST_HEAD(&group->aliaslist);
index d774e79..cd3335c 100644 (file)
@@ -913,7 +913,8 @@ dasd_vendor_show(struct device *dev, struct device_attribute *attr, char *buf)
 static DEVICE_ATTR(vendor, 0444, dasd_vendor_show, NULL);
 
 #define UID_STRLEN ( /* vendor */ 3 + 1 + /* serial    */ 14 + 1 +\
-                    /* SSID   */ 4 + 1 + /* unit addr */ 2 + 1)
+                    /* SSID   */ 4 + 1 + /* unit addr */ 2 + 1 +\
+                    /* vduit */ 32 + 1)
 
 static ssize_t
 dasd_uid_show(struct device *dev, struct device_attribute *attr, char *buf)
@@ -945,8 +946,17 @@ dasd_uid_show(struct device *dev, struct device_attribute *attr, char *buf)
                sprintf(ua_string, "%02x", uid->real_unit_addr);
                break;
        }
-       snprintf(uid_string, sizeof(uid_string), "%s.%s.%04x.%s",
-                uid->vendor, uid->serial, uid->ssid, ua_string);
+       if (strlen(uid->vduit) > 0)
+               snprintf(uid_string, sizeof(uid_string),
+                        "%s.%s.%04x.%s.%s",
+                        uid->vendor, uid->serial,
+                        uid->ssid, ua_string,
+                        uid->vduit);
+       else
+               snprintf(uid_string, sizeof(uid_string),
+                        "%s.%s.%04x.%s",
+                        uid->vendor, uid->serial,
+                        uid->ssid, ua_string);
        spin_unlock(&dasd_devmap_lock);
        return snprintf(buf, PAGE_SIZE, "%s\n", uid_string);
 }
index 3590fdb..773b3fe 100644 (file)
@@ -313,8 +313,8 @@ static int prefix(struct ccw1 *ccw, struct PFX_eckd_data *pfxdata, int trk,
        memset(pfxdata, 0, sizeof(*pfxdata));
        /* prefix data */
        pfxdata->format = 0;
-       pfxdata->base_address = basepriv->conf_data.ned1.unit_addr;
-       pfxdata->base_lss = basepriv->conf_data.ned1.ID;
+       pfxdata->base_address = basepriv->ned->unit_addr;
+       pfxdata->base_lss = basepriv->ned->ID;
        pfxdata->validity.define_extend = 1;
 
        /* private uid is kept up to date, conf_data may be outdated */
@@ -536,36 +536,40 @@ dasd_eckd_cdl_reclen(int recid)
 /*
  * Generate device unique id that specifies the physical device.
  */
-static int
-dasd_eckd_generate_uid(struct dasd_device *device, struct dasd_uid *uid)
+static int dasd_eckd_generate_uid(struct dasd_device *device,
+                                 struct dasd_uid *uid)
 {
        struct dasd_eckd_private *private;
-       struct dasd_eckd_confdata *confdata;
+       int count;
 
        private = (struct dasd_eckd_private *) device->private;
        if (!private)
                return -ENODEV;
-       confdata = &private->conf_data;
-       if (!confdata)
+       if (!private->ned || !private->gneq)
                return -ENODEV;
 
        memset(uid, 0, sizeof(struct dasd_uid));
-       memcpy(uid->vendor, confdata->ned1.HDA_manufacturer,
+       memcpy(uid->vendor, private->ned->HDA_manufacturer,
               sizeof(uid->vendor) - 1);
        EBCASC(uid->vendor, sizeof(uid->vendor) - 1);
-       memcpy(uid->serial, confdata->ned1.HDA_location,
+       memcpy(uid->serial, private->ned->HDA_location,
               sizeof(uid->serial) - 1);
        EBCASC(uid->serial, sizeof(uid->serial) - 1);
-       uid->ssid = confdata->neq.subsystemID;
-       uid->real_unit_addr = confdata->ned1.unit_addr;
-       if (confdata->ned2.sneq.flags == 0x40 &&
-           confdata->ned2.sneq.format == 0x0001) {
-               uid->type = confdata->ned2.sneq.sua_flags;
+       uid->ssid = private->gneq->subsystemID;
+       uid->real_unit_addr = private->ned->unit_addr;;
+       if (private->sneq) {
+               uid->type = private->sneq->sua_flags;
                if (uid->type == UA_BASE_PAV_ALIAS)
-                       uid->base_unit_addr = confdata->ned2.sneq.base_unit_addr;
+                       uid->base_unit_addr = private->sneq->base_unit_addr;
        } else {
                uid->type = UA_BASE_DEVICE;
        }
+       if (private->vdsneq) {
+               for (count = 0; count < 16; count++) {
+                       sprintf(uid->vduit+2*count, "%02x",
+                               private->vdsneq->uit[count]);
+               }
+       }
        return 0;
 }
 
@@ -623,6 +627,15 @@ static int dasd_eckd_read_conf_lpm(struct dasd_device *device,
                ret = -ENOMEM;
                goto out_error;
        }
+
+       /*
+        * buffer has to start with EBCDIC "V1.0" to show
+        * support for virtual device SNEQ
+        */
+       rcd_buf[0] = 0xE5;
+       rcd_buf[1] = 0xF1;
+       rcd_buf[2] = 0x4B;
+       rcd_buf[3] = 0xF0;
        cqr = dasd_eckd_build_rcd_lpm(device, rcd_buf, ciw, lpm);
        if (IS_ERR(cqr)) {
                ret =  PTR_ERR(cqr);
@@ -646,8 +659,62 @@ out_error:
        return ret;
 }
 
-static int
-dasd_eckd_read_conf(struct dasd_device *device)
+static int dasd_eckd_identify_conf_parts(struct dasd_eckd_private *private)
+{
+
+       struct dasd_sneq *sneq;
+       int i, count;
+
+       private->ned = NULL;
+       private->sneq = NULL;
+       private->vdsneq = NULL;
+       private->gneq = NULL;
+       count = private->conf_len / sizeof(struct dasd_sneq);
+       sneq = (struct dasd_sneq *)private->conf_data;
+       for (i = 0; i < count; ++i) {
+               if (sneq->flags.identifier == 1 && sneq->format == 1)
+                       private->sneq = sneq;
+               else if (sneq->flags.identifier == 1 && sneq->format == 4)
+                       private->vdsneq = (struct vd_sneq *)sneq;
+               else if (sneq->flags.identifier == 2)
+                       private->gneq = (struct dasd_gneq *)sneq;
+               else if (sneq->flags.identifier == 3 && sneq->res1 == 1)
+                       private->ned = (struct dasd_ned *)sneq;
+               sneq++;
+       }
+       if (!private->ned || !private->gneq) {
+               private->ned = NULL;
+               private->sneq = NULL;
+               private->vdsneq = NULL;
+               private->gneq = NULL;
+               return -EINVAL;
+       }
+       return 0;
+
+};
+
+static unsigned char dasd_eckd_path_access(void *conf_data, int conf_len)
+{
+       struct dasd_gneq *gneq;
+       int i, count, found;
+
+       count = conf_len / sizeof(*gneq);
+       gneq = (struct dasd_gneq *)conf_data;
+       found = 0;
+       for (i = 0; i < count; ++i) {
+               if (gneq->flags.identifier == 2) {
+                       found = 1;
+                       break;
+               }
+               gneq++;
+       }
+       if (found)
+               return ((char *)gneq)[18] & 0x07;
+       else
+               return 0;
+}
+
+static int dasd_eckd_read_conf(struct dasd_device *device)
 {
        void *conf_data;
        int conf_len, conf_data_saved;
@@ -661,7 +728,6 @@ dasd_eckd_read_conf(struct dasd_device *device)
        path_data->opm = ccw_device_get_path_mask(device->cdev);
        lpm = 0x80;
        conf_data_saved = 0;
-
        /* get configuration data per operational path */
        for (lpm = 0x80; lpm; lpm>>= 1) {
                if (lpm & path_data->opm){
@@ -678,22 +744,20 @@ dasd_eckd_read_conf(struct dasd_device *device)
                                        "data retrieved");
                                continue;       /* no error */
                        }
-                       if (conf_len != sizeof(struct dasd_eckd_confdata)) {
-                               MESSAGE(KERN_WARNING,
-                                       "sizes of configuration data mismatch"
-                                       "%d (read) vs %ld (expected)",
-                                       conf_len,
-                                       sizeof(struct dasd_eckd_confdata));
-                               kfree(conf_data);
-                               continue;       /* no error */
-                       }
                        /* save first valid configuration data */
-                       if (!conf_data_saved){
-                               memcpy(&private->conf_data, conf_data,
-                                      sizeof(struct dasd_eckd_confdata));
+                       if (!conf_data_saved) {
+                               kfree(private->conf_data);
+                               private->conf_data = conf_data;
+                               private->conf_len = conf_len;
+                               if (dasd_eckd_identify_conf_parts(private)) {
+                                       private->conf_data = NULL;
+                                       private->conf_len = 0;
+                                       kfree(conf_data);
+                                       continue;
+                               }
                                conf_data_saved++;
                        }
-                       switch (((char *)conf_data)[242] & 0x07){
+                       switch (dasd_eckd_path_access(conf_data, conf_len)) {
                        case 0x02:
                                path_data->npm |= lpm;
                                break;
@@ -701,7 +765,8 @@ dasd_eckd_read_conf(struct dasd_device *device)
                                path_data->ppm |= lpm;
                                break;
                        }
-                       kfree(conf_data);
+                       if (conf_data != private->conf_data)
+                               kfree(conf_data);
                }
        }
        return 0;
@@ -952,6 +1017,7 @@ out_err2:
        dasd_free_block(device->block);
        device->block = NULL;
 out_err1:
+       kfree(private->conf_data);
        kfree(device->private);
        device->private = NULL;
        return rc;
@@ -959,7 +1025,17 @@ out_err1:
 
 static void dasd_eckd_uncheck_device(struct dasd_device *device)
 {
+       struct dasd_eckd_private *private;
+
+       private = (struct dasd_eckd_private *) device->private;
        dasd_alias_disconnect_device_from_lcu(device);
+       private->ned = NULL;
+       private->sneq = NULL;
+       private->vdsneq = NULL;
+       private->gneq = NULL;
+       private->conf_len = 0;
+       kfree(private->conf_data);
+       private->conf_data = NULL;
 }
 
 static struct dasd_ccw_req *
@@ -1746,9 +1822,10 @@ dasd_eckd_fill_info(struct dasd_device * device,
        info->characteristics_size = sizeof(struct dasd_eckd_characteristics);
        memcpy(info->characteristics, &private->rdc_data,
               sizeof(struct dasd_eckd_characteristics));
-       info->confdata_size = sizeof(struct dasd_eckd_confdata);
-       memcpy(info->configuration_data, &private->conf_data,
-              sizeof(struct dasd_eckd_confdata));
+       info->confdata_size = min((unsigned long)private->conf_len,
+                                 sizeof(info->configuration_data));
+       memcpy(info->configuration_data, private->conf_data,
+              info->confdata_size);
        return 0;
 }
 
index fc2509c..4bf0aa5 100644 (file)
@@ -231,133 +231,62 @@ struct dasd_eckd_characteristics {
        __u8 reserved3[10];
 } __attribute__ ((packed));
 
-struct dasd_eckd_confdata {
+/* elements of the configuration data */
+struct dasd_ned {
        struct {
-               struct {
-                       unsigned char identifier:2;
-                       unsigned char token_id:1;
-                       unsigned char sno_valid:1;
-                       unsigned char subst_sno:1;
-                       unsigned char recNED:1;
-                       unsigned char emuNED:1;
-                       unsigned char reserved:1;
-               } __attribute__ ((packed)) flags;
-               __u8 descriptor;
-               __u8 dev_class;
-               __u8 reserved;
-               unsigned char dev_type[6];
-               unsigned char dev_model[3];
-               unsigned char HDA_manufacturer[3];
-               unsigned char HDA_location[2];
-               unsigned char HDA_seqno[12];
-               __u8 ID;
-               __u8 unit_addr;
-       } __attribute__ ((packed)) ned1;
-       union {
-               struct {
-                       struct {
-                               unsigned char identifier:2;
-                               unsigned char token_id:1;
-                               unsigned char sno_valid:1;
-                               unsigned char subst_sno:1;
-                               unsigned char recNED:1;
-                               unsigned char emuNED:1;
-                               unsigned char reserved:1;
-                       } __attribute__ ((packed)) flags;
-                       __u8 descriptor;
-                       __u8 reserved[2];
-                       unsigned char dev_type[6];
-                       unsigned char dev_model[3];
-                       unsigned char DASD_manufacturer[3];
-                       unsigned char DASD_location[2];
-                       unsigned char DASD_seqno[12];
-                       __u16 ID;
-               } __attribute__ ((packed)) ned;
-               struct {
-                       unsigned char flags;            /* byte  0    */
-                       unsigned char res1;             /* byte  1    */
-                       __u16 format;                   /* byte  2-3  */
-                       unsigned char res2[4];          /* byte  4-7  */
-                       unsigned char sua_flags;        /* byte  8    */
-                       __u8 base_unit_addr;            /* byte  9    */
-                       unsigned char res3[22];         /* byte 10-31 */
-               } __attribute__ ((packed)) sneq;
-       } __attribute__ ((packed)) ned2;
+               __u8 identifier:2;
+               __u8 token_id:1;
+               __u8 sno_valid:1;
+               __u8 subst_sno:1;
+               __u8 recNED:1;
+               __u8 emuNED:1;
+               __u8 reserved:1;
+       } __attribute__ ((packed)) flags;
+       __u8 descriptor;
+       __u8 dev_class;
+       __u8 reserved;
+       __u8 dev_type[6];
+       __u8 dev_model[3];
+       __u8 HDA_manufacturer[3];
+       __u8 HDA_location[2];
+       __u8 HDA_seqno[12];
+       __u8 ID;
+       __u8 unit_addr;
+} __attribute__ ((packed));
+
+struct dasd_sneq {
        struct {
-               struct {
-                       unsigned char identifier:2;
-                       unsigned char token_id:1;
-                       unsigned char sno_valid:1;
-                       unsigned char subst_sno:1;
-                       unsigned char recNED:1;
-                       unsigned char emuNED:1;
-                       unsigned char reserved:1;
-               } __attribute__ ((packed)) flags;
-               __u8 descriptor;
-               __u8 reserved[2];
-               unsigned char cont_type[6];
-               unsigned char cont_model[3];
-               unsigned char cont_manufacturer[3];
-               unsigned char cont_location[2];
-               unsigned char cont_seqno[12];
-               __u16 ID;
-       } __attribute__ ((packed)) ned3;
+               __u8 identifier:2;
+               __u8 reserved:6;
+       } __attribute__ ((packed)) flags;
+       __u8 res1;
+       __u16 format;
+       __u8 res2[4];           /* byte  4- 7 */
+       __u8 sua_flags;         /* byte  8    */
+       __u8 base_unit_addr;    /* byte  9    */
+       __u8 res3[22];          /* byte 10-31 */
+} __attribute__ ((packed));
+
+struct vd_sneq {
        struct {
-               struct {
-                       unsigned char identifier:2;
-                       unsigned char token_id:1;
-                       unsigned char sno_valid:1;
-                       unsigned char subst_sno:1;
-                       unsigned char recNED:1;
-                       unsigned char emuNED:1;
-                       unsigned char reserved:1;
-               } __attribute__ ((packed)) flags;
-               __u8 descriptor;
-               __u8 reserved[2];
-               unsigned char cont_type[6];
-               unsigned char empty[3];
-               unsigned char cont_manufacturer[3];
-               unsigned char cont_location[2];
-               unsigned char cont_seqno[12];
-               __u16 ID;
-       } __attribute__ ((packed)) ned4;
-       unsigned char ned5[32];
-       unsigned char ned6[32];
-       unsigned char ned7[32];
+               __u8 identifier:2;
+               __u8 reserved:6;
+       } __attribute__ ((packed)) flags;
+       __u8 res1;
+       __u16 format;
+       __u8 res2[4];   /* byte  4- 7 */
+       __u8 uit[16];   /* byte  8-23 */
+       __u8 res3[8];   /* byte 24-31 */
+} __attribute__ ((packed));
+
+struct dasd_gneq {
        struct {
-               struct {
-                       unsigned char identifier:2;
-                       unsigned char reserved:6;
-               } __attribute__ ((packed)) flags;
-               __u8 selector;
-               __u16 interfaceID;
-               __u32 reserved;
-               __u16 subsystemID;
-               struct {
-                       unsigned char sp0:1;
-                       unsigned char sp1:1;
-                       unsigned char reserved:5;
-                       unsigned char scluster:1;
-               } __attribute__ ((packed)) spathID;
-               __u8 unit_address;
-               __u8 dev_ID;
-               __u8 dev_address;
-               __u8 adapterID;
-               __u16 link_address;
-               struct {
-                       unsigned char parallel:1;
-                       unsigned char escon:1;
-                       unsigned char reserved:1;
-                       unsigned char ficon:1;
-                       unsigned char reserved2:4;
-               } __attribute__ ((packed)) protocol_type;
-               struct {
-                       unsigned char PID_in_236:1;
-                       unsigned char reserved:7;
-               } __attribute__ ((packed)) format_flags;
-               __u8 log_dev_address;
-               unsigned char reserved2[12];
-       } __attribute__ ((packed)) neq;
+               __u8 identifier:2;
+               __u8 reserved:6;
+       } __attribute__ ((packed)) flags;
+       __u8 reserved[7];
+       __u16 subsystemID;
+       __u8 reserved2[22];
 } __attribute__ ((packed));
 
 struct dasd_eckd_path {
@@ -463,7 +392,14 @@ struct alias_pav_group {
 
 struct dasd_eckd_private {
        struct dasd_eckd_characteristics rdc_data;
-       struct dasd_eckd_confdata conf_data;
+       u8 *conf_data;
+       int conf_len;
+       /* pointers to specific parts in the conf_data */
+       struct dasd_ned *ned;
+       struct dasd_sneq *sneq;
+       struct vd_sneq *vdsneq;
+       struct dasd_gneq *gneq;
+
        struct dasd_eckd_path path_data;
        struct eckd_count count_area[5];
        int init_cqr_status;
index fb2f931..31ecaa4 100644 (file)
@@ -307,6 +307,7 @@ struct dasd_uid {
        __u16 ssid;
        __u8 real_unit_addr;
        __u8 base_unit_addr;
+       char vduit[33];
 };
 
 /*
index 3c8b25e..1fd8f21 100644 (file)
@@ -399,6 +399,7 @@ sclp_tod_from_jiffies(unsigned long jiffies)
 void
 sclp_sync_wait(void)
 {
+       unsigned long long old_tick;
        unsigned long flags;
        unsigned long cr0, cr0_sync;
        u64 timeout;
@@ -419,11 +420,12 @@ sclp_sync_wait(void)
        if (!irq_context)
                local_bh_disable();
        /* Enable service-signal interruption, disable timer interrupts */
+       old_tick = local_tick_disable();
        trace_hardirqs_on();
        __ctl_store(cr0, 0, 0);
        cr0_sync = cr0;
+       cr0_sync &= 0xffff00a0;
        cr0_sync |= 0x00000200;
-       cr0_sync &= 0xFFFFF3AC;
        __ctl_load(cr0_sync, 0, 0);
        __raw_local_irq_stosm(0x01);
        /* Loop until driver state indicates finished request */
@@ -439,9 +441,9 @@ sclp_sync_wait(void)
        __ctl_load(cr0, 0, 0);
        if (!irq_context)
                _local_bh_enable();
+       local_tick_enable(old_tick);
        local_irq_restore(flags);
 }
-
 EXPORT_SYMBOL(sclp_sync_wait);
 
 /* Dispatch changes in send and receive mask to registered listeners. */
index 0c2b774..eb5f1b8 100644 (file)
@@ -427,6 +427,8 @@ static int sclp_mem_notifier(struct notifier_block *nb,
                        sclp_attach_storage(id);
        switch (action) {
        case MEM_ONLINE:
+       case MEM_GOING_OFFLINE:
+       case MEM_CANCEL_OFFLINE:
                break;
        case MEM_GOING_ONLINE:
                rc = sclp_mem_change_state(start, size, 1);
@@ -434,6 +436,9 @@ static int sclp_mem_notifier(struct notifier_block *nb,
        case MEM_CANCEL_ONLINE:
                sclp_mem_change_state(start, size, 0);
                break;
+       case MEM_OFFLINE:
+               sclp_mem_change_state(start, size, 0);
+               break;
        default:
                rc = -EINVAL;
                break;
index fff4ff4..4cebd6e 100644 (file)
@@ -8,7 +8,6 @@
 #include <linux/init.h>
 #include <linux/errno.h>
 #include <linux/cpu.h>
-#include <linux/kthread.h>
 #include <linux/sysdev.h>
 #include <linux/workqueue.h>
 #include <asm/smp.h>
@@ -41,19 +40,9 @@ static void sclp_cpu_capability_notify(struct work_struct *work)
        put_online_cpus();
 }
 
-static int sclp_cpu_kthread(void *data)
-{
-       smp_rescan_cpus();
-       return 0;
-}
-
 static void __ref sclp_cpu_change_notify(struct work_struct *work)
 {
-       /* Can't call smp_rescan_cpus() from  workqueue context since it may
-        * deadlock in case of cpu hotplug. So we have to create a kernel
-        * thread in order to call it.
-        */
-       kthread_run(sclp_cpu_kthread, NULL, "cpu_rescan");
+       smp_rescan_cpus();
 }
 
 static void sclp_conf_receiver_fn(struct evbuf_header *evbuf)
index ef7bc0a..cf8f24a 100644 (file)
@@ -5,7 +5,7 @@
  *    Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
  */
 
-#include <linux/slab.h>
+#include <linux/vmalloc.h>
 #include <linux/bitops.h>
 #include "idset.h"
 #include "css.h"
@@ -25,18 +25,18 @@ static struct idset *idset_new(int num_ssid, int num_id)
 {
        struct idset *set;
 
-       set = kzalloc(sizeof(struct idset) + bitmap_size(num_ssid, num_id),
-                     GFP_KERNEL);
+       set = vmalloc(sizeof(struct idset) + bitmap_size(num_ssid, num_id));
        if (set) {
                set->num_ssid = num_ssid;
                set->num_id = num_id;
+               memset(set->bitmap, 0, bitmap_size(num_ssid, num_id));
        }
        return set;
 }
 
 void idset_free(struct idset *set)
 {
-       kfree(set);
+       vfree(set);
 }
 
 void idset_clear(struct idset *set)
index d10c73c..d156485 100644 (file)
@@ -1355,7 +1355,7 @@ int qdio_allocate(struct qdio_initialize *init_data)
                goto out_rel;
 
        /* qdr is used in ccw1.cda which is u32 */
-       irq_ptr->qdr = kzalloc(sizeof(struct qdr), GFP_KERNEL | GFP_DMA);
+       irq_ptr->qdr = (struct qdr *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
        if (!irq_ptr->qdr)
                goto out_rel;
        WARN_ON((unsigned long)irq_ptr->qdr & 0xfff);
index ea01b85..ec5c4a4 100644 (file)
@@ -142,7 +142,7 @@ int __init qdio_setup_perf_stats(void)
        return 0;
 }
 
-void __exit qdio_remove_perf_stats(void)
+void qdio_remove_perf_stats(void)
 {
 #ifdef CONFIG_PROC_FS
        remove_proc_entry("qdio_perf", NULL);
index f0923a8..1bd2a20 100644 (file)
@@ -325,7 +325,7 @@ void qdio_release_memory(struct qdio_irq *irq_ptr)
                        kmem_cache_free(qdio_q_cache, q);
                }
        }
-       kfree(irq_ptr->qdr);
+       free_page((unsigned long) irq_ptr->qdr);
        free_page(irq_ptr->chsc_page);
        free_page((unsigned long) irq_ptr);
 }
@@ -515,7 +515,7 @@ int __init qdio_setup_init(void)
        return 0;
 }
 
-void __exit qdio_setup_exit(void)
+void qdio_setup_exit(void)
 {
        kmem_cache_destroy(qdio_q_cache);
 }
index 79954bd..292b60d 100644 (file)
@@ -352,7 +352,7 @@ static __init int early_put_chars(u32 vtermno, const char *buf, int count)
        return len;
 }
 
-void s390_virtio_console_init(void)
+void __init s390_virtio_console_init(void)
 {
        virtio_cons_early_init(early_put_chars);
 }
index 1895dbb..80971c2 100644 (file)
@@ -419,6 +419,7 @@ struct qeth_qdio_out_buffer {
        int next_element_to_fill;
        struct sk_buff_head skb_list;
        struct list_head ctx_list;
+       int is_header[16];
 };
 
 struct qeth_card;
@@ -785,7 +786,7 @@ void qeth_core_remove_osn_attributes(struct device *);
 
 /* exports for qeth discipline device drivers */
 extern struct qeth_card_list_struct qeth_core_card_list;
-
+extern struct kmem_cache *qeth_core_header_cache;
 extern struct qeth_dbf_info qeth_dbf[QETH_DBF_INFOS];
 
 void qeth_set_allowed_threads(struct qeth_card *, unsigned long , int);
@@ -843,7 +844,7 @@ int qeth_get_priority_queue(struct qeth_card *, struct sk_buff *, int, int);
 int qeth_get_elements_no(struct qeth_card *, void *, struct sk_buff *, int);
 int qeth_do_send_packet_fast(struct qeth_card *, struct qeth_qdio_out_q *,
                        struct sk_buff *, struct qeth_hdr *, int,
-                       struct qeth_eddp_context *);
+                       struct qeth_eddp_context *, int, int);
 int qeth_do_send_packet(struct qeth_card *, struct qeth_qdio_out_q *,
                    struct sk_buff *, struct qeth_hdr *,
                    int, struct qeth_eddp_context *);
index cebb25e..bd420d1 100644 (file)
@@ -19,8 +19,8 @@
 #include <linux/mii.h>
 #include <linux/kthread.h>
 
-#include <asm-s390/ebcdic.h>
-#include <asm-s390/io.h>
+#include <asm/ebcdic.h>
+#include <asm/io.h>
 #include <asm/s390_rdev.h>
 
 #include "qeth_core.h"
@@ -48,6 +48,8 @@ EXPORT_SYMBOL_GPL(qeth_dbf);
 
 struct qeth_card_list_struct qeth_core_card_list;
 EXPORT_SYMBOL_GPL(qeth_core_card_list);
+struct kmem_cache *qeth_core_header_cache;
+EXPORT_SYMBOL_GPL(qeth_core_header_cache);
 
 static struct device *qeth_core_root_dev;
 static unsigned int known_devices[][10] = QETH_MODELLIST_ARRAY;
@@ -933,6 +935,10 @@ static void qeth_clear_output_buffer(struct qeth_qdio_out_q *queue,
        }
        qeth_eddp_buf_release_contexts(buf);
        for (i = 0; i < QETH_MAX_BUFFER_ELEMENTS(queue->card); ++i) {
+               if (buf->buffer->element[i].addr && buf->is_header[i])
+                       kmem_cache_free(qeth_core_header_cache,
+                               buf->buffer->element[i].addr);
+               buf->is_header[i] = 0;
                buf->buffer->element[i].length = 0;
                buf->buffer->element[i].addr = NULL;
                buf->buffer->element[i].flags = 0;
@@ -3002,8 +3008,8 @@ int qeth_get_elements_no(struct qeth_card *card, void *hdr,
        if (skb_shinfo(skb)->nr_frags > 0)
                elements_needed = (skb_shinfo(skb)->nr_frags + 1);
        if (elements_needed == 0)
-               elements_needed = 1 + (((((unsigned long) hdr) % PAGE_SIZE)
-                       + skb->len) >> PAGE_SHIFT);
+               elements_needed = 1 + (((((unsigned long) skb->data) %
+                               PAGE_SIZE) + skb->len) >> PAGE_SHIFT);
        if ((elements_needed + elems) > QETH_MAX_BUFFER_ELEMENTS(card)) {
                QETH_DBF_MESSAGE(2, "Invalid size of IP packet "
                        "(Number=%d / Length=%d). Discarded.\n",
@@ -3015,7 +3021,8 @@ int qeth_get_elements_no(struct qeth_card *card, void *hdr,
 EXPORT_SYMBOL_GPL(qeth_get_elements_no);
 
 static inline void __qeth_fill_buffer(struct sk_buff *skb,
-       struct qdio_buffer *buffer, int is_tso, int *next_element_to_fill)
+       struct qdio_buffer *buffer, int is_tso, int *next_element_to_fill,
+       int offset)
 {
        int length = skb->len;
        int length_here;
@@ -3027,6 +3034,11 @@ static inline void __qeth_fill_buffer(struct sk_buff *skb,
        data = skb->data;
        first_lap = (is_tso == 0 ? 1 : 0);
 
+       if (offset >= 0) {
+               data = skb->data + offset;
+               first_lap = 0;
+       }
+
        while (length > 0) {
                /* length_here is the remaining amount of data in this page */
                length_here = PAGE_SIZE - ((unsigned long) data % PAGE_SIZE);
@@ -3058,22 +3070,22 @@ static inline void __qeth_fill_buffer(struct sk_buff *skb,
 }
 
 static inline int qeth_fill_buffer(struct qeth_qdio_out_q *queue,
-               struct qeth_qdio_out_buffer *buf, struct sk_buff *skb)
+               struct qeth_qdio_out_buffer *buf, struct sk_buff *skb,
+               struct qeth_hdr *hdr, int offset, int hd_len)
 {
        struct qdio_buffer *buffer;
-       struct qeth_hdr_tso *hdr;
        int flush_cnt = 0, hdr_len, large_send = 0;
 
        buffer = buf->buffer;
        atomic_inc(&skb->users);
        skb_queue_tail(&buf->skb_list, skb);
 
-       hdr  = (struct qeth_hdr_tso *) skb->data;
        /*check first on TSO ....*/
-       if (hdr->hdr.hdr.l3.id == QETH_HEADER_TYPE_TSO) {
+       if (hdr->hdr.l3.id == QETH_HEADER_TYPE_TSO) {
                int element = buf->next_element_to_fill;
 
-               hdr_len = sizeof(struct qeth_hdr_tso) + hdr->ext.dg_hdr_len;
+               hdr_len = sizeof(struct qeth_hdr_tso) +
+                       ((struct qeth_hdr_tso *)hdr)->ext.dg_hdr_len;
                /*fill first buffer entry only with header information */
                buffer->element[element].addr = skb->data;
                buffer->element[element].length = hdr_len;
@@ -3083,9 +3095,20 @@ static inline int qeth_fill_buffer(struct qeth_qdio_out_q *queue,
                skb->len  -= hdr_len;
                large_send = 1;
        }
+
+       if (offset >= 0) {
+               int element = buf->next_element_to_fill;
+               buffer->element[element].addr = hdr;
+               buffer->element[element].length = sizeof(struct qeth_hdr) +
+                                                       hd_len;
+               buffer->element[element].flags = SBAL_FLAGS_FIRST_FRAG;
+               buf->is_header[element] = 1;
+               buf->next_element_to_fill++;
+       }
+
        if (skb_shinfo(skb)->nr_frags == 0)
                __qeth_fill_buffer(skb, buffer, large_send,
-                                  (int *)&buf->next_element_to_fill);
+                               (int *)&buf->next_element_to_fill, offset);
        else
                __qeth_fill_buffer_frag(skb, buffer, large_send,
                                        (int *)&buf->next_element_to_fill);
@@ -3115,7 +3138,7 @@ static inline int qeth_fill_buffer(struct qeth_qdio_out_q *queue,
 int qeth_do_send_packet_fast(struct qeth_card *card,
                struct qeth_qdio_out_q *queue, struct sk_buff *skb,
                struct qeth_hdr *hdr, int elements_needed,
-               struct qeth_eddp_context *ctx)
+               struct qeth_eddp_context *ctx, int offset, int hd_len)
 {
        struct qeth_qdio_out_buffer *buffer;
        int buffers_needed = 0;
@@ -3148,7 +3171,7 @@ int qeth_do_send_packet_fast(struct qeth_card *card,
        }
        atomic_set(&queue->state, QETH_OUT_Q_UNLOCKED);
        if (ctx == NULL) {
-               qeth_fill_buffer(queue, buffer, skb);
+               qeth_fill_buffer(queue, buffer, skb, hdr, offset, hd_len);
                qeth_flush_buffers(queue, index, 1);
        } else {
                flush_cnt = qeth_eddp_fill_buffer(queue, ctx, index);
@@ -3224,7 +3247,7 @@ int qeth_do_send_packet(struct qeth_card *card, struct qeth_qdio_out_q *queue,
                }
        }
        if (ctx == NULL)
-               tmp = qeth_fill_buffer(queue, buffer, skb);
+               tmp = qeth_fill_buffer(queue, buffer, skb, hdr, -1, 0);
        else {
                tmp = qeth_eddp_fill_buffer(queue, ctx,
                                                queue->next_buf_to_fill);
@@ -4443,8 +4466,17 @@ static int __init qeth_core_init(void)
        rc = IS_ERR(qeth_core_root_dev) ? PTR_ERR(qeth_core_root_dev) : 0;
        if (rc)
                goto register_err;
-       return 0;
 
+       qeth_core_header_cache = kmem_cache_create("qeth_hdr",
+                       sizeof(struct qeth_hdr) + ETH_HLEN, 64, 0, NULL);
+       if (!qeth_core_header_cache) {
+               rc = -ENOMEM;
+               goto slab_err;
+       }
+
+       return 0;
+slab_err:
+       s390_root_dev_unregister(qeth_core_root_dev);
 register_err:
        driver_remove_file(&qeth_core_ccwgroup_driver.driver,
                           &driver_attr_group);
@@ -4466,6 +4498,7 @@ static void __exit qeth_core_exit(void)
                           &driver_attr_group);
        ccwgroup_driver_unregister(&qeth_core_ccwgroup_driver);
        ccw_driver_unregister(&qeth_ccw_driver);
+       kmem_cache_destroy(qeth_core_header_cache);
        qeth_unregister_dbf_views();
        PRINT_INFO("core functions removed\n");
 }
index a8b069c..b3cee03 100644 (file)
@@ -243,8 +243,7 @@ static void qeth_l2_get_packet_type(struct qeth_card *card,
 static void qeth_l2_fill_header(struct qeth_card *card, struct qeth_hdr *hdr,
                        struct sk_buff *skb, int ipv, int cast_type)
 {
-       struct vlan_ethhdr *veth = (struct vlan_ethhdr *)((skb->data) +
-                                       QETH_HEADER_SIZE);
+       struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb_mac_header(skb);
 
        memset(hdr, 0, sizeof(struct qeth_hdr));
        hdr->hdr.l2.id = QETH_HEADER_TYPE_LAYER2;
@@ -621,6 +620,9 @@ static int qeth_l2_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
        int tx_bytes = skb->len;
        enum qeth_large_send_types large_send = QETH_LARGE_SEND_NO;
        struct qeth_eddp_context *ctx = NULL;
+       int data_offset = -1;
+       int elements_needed = 0;
+       int hd_len = 0;
 
        if ((card->state != CARD_STATE_UP) || !card->lan_online) {
                card->stats.tx_carrier_errors++;
@@ -643,13 +645,32 @@ static int qeth_l2_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
        if (card->info.type == QETH_CARD_TYPE_OSN)
                hdr = (struct qeth_hdr *)skb->data;
        else {
-               /* create a clone with writeable headroom */
-               new_skb = skb_realloc_headroom(skb, sizeof(struct qeth_hdr));
-               if (!new_skb)
-                       goto tx_drop;
-               hdr = (struct qeth_hdr *)skb_push(new_skb,
+               if ((card->info.type == QETH_CARD_TYPE_IQD) && (!large_send) &&
+                   (skb_shinfo(skb)->nr_frags == 0)) {
+                       new_skb = skb;
+                       data_offset = ETH_HLEN;
+                       hd_len = ETH_HLEN;
+                       hdr = kmem_cache_alloc(qeth_core_header_cache,
+                                               GFP_ATOMIC);
+                       if (!hdr)
+                               goto tx_drop;
+                       elements_needed++;
+                       skb_reset_mac_header(new_skb);
+                       qeth_l2_fill_header(card, hdr, new_skb, ipv, cast_type);
+                       hdr->hdr.l2.pkt_length = new_skb->len;
+                       memcpy(((char *)hdr) + sizeof(struct qeth_hdr),
+                               skb_mac_header(new_skb), ETH_HLEN);
+               } else {
+                       /* create a clone with writeable headroom */
+                       new_skb = skb_realloc_headroom(skb,
+                                               sizeof(struct qeth_hdr));
+                       if (!new_skb)
+                               goto tx_drop;
+                       hdr = (struct qeth_hdr *)skb_push(new_skb,
                                                sizeof(struct qeth_hdr));
-               qeth_l2_fill_header(card, hdr, new_skb, ipv, cast_type);
+                       skb_set_mac_header(new_skb, sizeof(struct qeth_hdr));
+                       qeth_l2_fill_header(card, hdr, new_skb, ipv, cast_type);
+               }
        }
 
        if (large_send == QETH_LARGE_SEND_EDDP) {
@@ -660,9 +681,13 @@ static int qeth_l2_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
                        goto tx_drop;
                }
        } else {
-               elements = qeth_get_elements_no(card, (void *)hdr, new_skb, 0);
-               if (!elements)
+               elements = qeth_get_elements_no(card, (void *)hdr, new_skb,
+                                               elements_needed);
+               if (!elements) {
+                       if (data_offset >= 0)
+                               kmem_cache_free(qeth_core_header_cache, hdr);
                        goto tx_drop;
+               }
        }
 
        if ((large_send == QETH_LARGE_SEND_NO) &&
@@ -674,7 +699,7 @@ static int qeth_l2_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
                                         elements, ctx);
        else
                rc = qeth_do_send_packet_fast(card, queue, new_skb, hdr,
-                                             elements, ctx);
+                                       elements, ctx, data_offset, hd_len);
        if (!rc) {
                card->stats.tx_packets++;
                card->stats.tx_bytes += tx_bytes;
@@ -701,6 +726,9 @@ static int qeth_l2_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
                if (ctx != NULL)
                        qeth_eddp_put_context(ctx);
 
+               if (data_offset >= 0)
+                       kmem_cache_free(qeth_core_header_cache, hdr);
+
                if (rc == -EBUSY) {
                        if (new_skb != skb)
                                dev_kfree_skb_any(new_skb);
index 3e1d138..dd72c3c 100644 (file)
@@ -2604,6 +2604,7 @@ static int qeth_l3_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
        int tx_bytes = skb->len;
        enum qeth_large_send_types large_send = QETH_LARGE_SEND_NO;
        struct qeth_eddp_context *ctx = NULL;
+       int data_offset = -1;
 
        if ((card->info.type == QETH_CARD_TYPE_IQD) &&
            (skb->protocol != htons(ETH_P_IPV6)) &&
@@ -2624,14 +2625,28 @@ static int qeth_l3_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
                card->perf_stats.outbound_start_time = qeth_get_micros();
        }
 
-       /* create a clone with writeable headroom */
-       new_skb = skb_realloc_headroom(skb, sizeof(struct qeth_hdr_tso) +
-                                       VLAN_HLEN);
-       if (!new_skb)
-               goto tx_drop;
+       if (skb_is_gso(skb))
+               large_send = card->options.large_send;
+
+       if ((card->info.type == QETH_CARD_TYPE_IQD) && (!large_send) &&
+           (skb_shinfo(skb)->nr_frags == 0)) {
+               new_skb = skb;
+               data_offset = ETH_HLEN;
+               hdr = kmem_cache_alloc(qeth_core_header_cache, GFP_ATOMIC);
+               if (!hdr)
+                       goto tx_drop;
+               elements_needed++;
+       } else {
+               /* create a clone with writeable headroom */
+               new_skb = skb_realloc_headroom(skb, sizeof(struct qeth_hdr_tso)
+                                       + VLAN_HLEN);
+               if (!new_skb)
+                       goto tx_drop;
+       }
 
        if (card->info.type == QETH_CARD_TYPE_IQD) {
-               skb_pull(new_skb, ETH_HLEN);
+               if (data_offset < 0)
+                       skb_pull(new_skb, ETH_HLEN);
        } else {
                if (new_skb->protocol == htons(ETH_P_IP)) {
                        if (card->dev->type == ARPHRD_IEEE802_TR)
@@ -2657,9 +2672,6 @@ static int qeth_l3_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
        netif_stop_queue(dev);
 
-       if (skb_is_gso(new_skb))
-               large_send = card->options.large_send;
-
        /* fix hardware limitation: as long as we do not have sbal
         * chaining we can not send long frag lists so we temporary
         * switch to EDDP
@@ -2677,9 +2689,16 @@ static int qeth_l3_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
                qeth_tso_fill_header(card, hdr, new_skb);
                elements_needed++;
        } else {
-               hdr = (struct qeth_hdr *)skb_push(new_skb,
+               if (data_offset < 0) {
+                       hdr = (struct qeth_hdr *)skb_push(new_skb,
                                                sizeof(struct qeth_hdr));
-               qeth_l3_fill_header(card, hdr, new_skb, ipv, cast_type);
+                       qeth_l3_fill_header(card, hdr, new_skb, ipv,
+                                               cast_type);
+               } else {
+                       qeth_l3_fill_header(card, hdr, new_skb, ipv,
+                                               cast_type);
+                       hdr->hdr.l3.length = new_skb->len - data_offset;
+               }
        }
 
        if (large_send == QETH_LARGE_SEND_EDDP) {
@@ -2695,8 +2714,11 @@ static int qeth_l3_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
        } else {
                int elems = qeth_get_elements_no(card, (void *)hdr, new_skb,
                                                 elements_needed);
-               if (!elems)
+               if (!elems) {
+                       if (data_offset >= 0)
+                               kmem_cache_free(qeth_core_header_cache, hdr);
                        goto tx_drop;
+               }
                elements_needed += elems;
        }
 
@@ -2709,7 +2731,7 @@ static int qeth_l3_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
                                         elements_needed, ctx);
        else
                rc = qeth_do_send_packet_fast(card, queue, new_skb, hdr,
-                                             elements_needed, ctx);
+                                       elements_needed, ctx, data_offset, 0);
 
        if (!rc) {
                card->stats.tx_packets++;
@@ -2737,6 +2759,9 @@ static int qeth_l3_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
                if (ctx != NULL)
                        qeth_eddp_put_context(ctx);
 
+               if (data_offset >= 0)
+                       kmem_cache_free(qeth_core_header_cache, hdr);
+
                if (rc == -EBUSY) {
                        if (new_skb != skb)
                                dev_kfree_skb_any(new_skb);
index da876d3..a48e499 100644 (file)
@@ -25,7 +25,6 @@
 #include <linux/delay.h>
 #include <linux/timer.h>
 #include <linux/spinlock.h>
-#include <linux/hdreg.h>
 #include <asm/uaccess.h>
 #include <asm/io.h>
 #include <asm/div64.h>
@@ -1249,6 +1248,13 @@ static struct pci_device_id hptiop_id_table[] = {
        { PCI_VDEVICE(TTI, 0x3522), (kernel_ulong_t)&hptiop_itl_ops },
        { PCI_VDEVICE(TTI, 0x3410), (kernel_ulong_t)&hptiop_itl_ops },
        { PCI_VDEVICE(TTI, 0x3540), (kernel_ulong_t)&hptiop_itl_ops },
+       { PCI_VDEVICE(TTI, 0x3530), (kernel_ulong_t)&hptiop_itl_ops },
+       { PCI_VDEVICE(TTI, 0x3560), (kernel_ulong_t)&hptiop_itl_ops },
+       { PCI_VDEVICE(TTI, 0x4322), (kernel_ulong_t)&hptiop_itl_ops },
+       { PCI_VDEVICE(TTI, 0x4210), (kernel_ulong_t)&hptiop_itl_ops },
+       { PCI_VDEVICE(TTI, 0x4211), (kernel_ulong_t)&hptiop_itl_ops },
+       { PCI_VDEVICE(TTI, 0x4310), (kernel_ulong_t)&hptiop_itl_ops },
+       { PCI_VDEVICE(TTI, 0x4311), (kernel_ulong_t)&hptiop_itl_ops },
        { PCI_VDEVICE(TTI, 0x3120), (kernel_ulong_t)&hptiop_mv_ops },
        { PCI_VDEVICE(TTI, 0x3122), (kernel_ulong_t)&hptiop_mv_ops },
        { PCI_VDEVICE(TTI, 0x3020), (kernel_ulong_t)&hptiop_mv_ops },
index b40a673..461331d 100644 (file)
@@ -102,11 +102,10 @@ static struct ide_scsi_obj *ide_scsi_get(struct gendisk *disk)
        mutex_lock(&idescsi_ref_mutex);
        scsi = ide_scsi_g(disk);
        if (scsi) {
-               scsi_host_get(scsi->host);
-               if (ide_device_get(scsi->drive)) {
-                       scsi_host_put(scsi->host);
+               if (ide_device_get(scsi->drive))
                        scsi = NULL;
-               }
+               else
+                       scsi_host_get(scsi->host);
        }
        mutex_unlock(&idescsi_ref_mutex);
        return scsi;
@@ -114,9 +113,11 @@ static struct ide_scsi_obj *ide_scsi_get(struct gendisk *disk)
 
 static void ide_scsi_put(struct ide_scsi_obj *scsi)
 {
+       ide_drive_t *drive = scsi->drive;
+
        mutex_lock(&idescsi_ref_mutex);
-       ide_device_put(scsi->drive);
        scsi_host_put(scsi->host);
+       ide_device_put(drive);
        mutex_unlock(&idescsi_ref_mutex);
 }
 
index 75a64a6..b29360e 100644 (file)
@@ -366,12 +366,14 @@ spi_transport_rd_attr(rti, "%d\n");
 spi_transport_rd_attr(pcomp_en, "%d\n");
 spi_transport_rd_attr(hold_mcs, "%d\n");
 
-/* we only care about the first child device so we return 1 */
+/* we only care about the first child device that's a real SCSI device
+ * so we return 1 to terminate the iteration when we find it */
 static int child_iter(struct device *dev, void *data)
 {
-       struct scsi_device *sdev = to_scsi_device(dev);
+       if (!scsi_is_sdev_device(dev))
+               return 0;
 
-       spi_dv_device(sdev);
+       spi_dv_device(to_scsi_device(dev));
        return 1;
 }
 
index 0fe031f..1bcf3c3 100644 (file)
@@ -345,14 +345,14 @@ static int ses_enclosure_find_by_addr(struct enclosure_device *edev,
        return 0;
 }
 
-#define VPD_INQUIRY_SIZE 512
+#define VPD_INQUIRY_SIZE 36
 
 static void ses_match_to_enclosure(struct enclosure_device *edev,
                                   struct scsi_device *sdev)
 {
        unsigned char *buf = kmalloc(VPD_INQUIRY_SIZE, GFP_KERNEL);
        unsigned char *desc;
-       int len;
+       u16 vpd_len;
        struct efd efd = {
                .addr = 0,
        };
@@ -372,9 +372,19 @@ static void ses_match_to_enclosure(struct enclosure_device *edev,
                             VPD_INQUIRY_SIZE, NULL, SES_TIMEOUT, SES_RETRIES))
                goto free;
 
-       len = (buf[2] << 8) + buf[3];
+       vpd_len = (buf[2] << 8) + buf[3];
+       kfree(buf);
+       buf = kmalloc(vpd_len, GFP_KERNEL);
+       if (!buf)
+               return;
+       cmd[3] = vpd_len >> 8;
+       cmd[4] = vpd_len & 0xff;
+       if (scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf,
+                            vpd_len, NULL, SES_TIMEOUT, SES_RETRIES))
+               goto free;
+
        desc = buf + 4;
-       while (desc < buf + len) {
+       while (desc < buf + vpd_len) {
                enum scsi_protocol proto = desc[0] >> 4;
                u8 code_set = desc[0] & 0x0f;
                u8 piv = desc[1] & 0x80;
index d3b8ebb..3d36270 100644 (file)
@@ -1747,7 +1747,7 @@ st_map_user_pages(struct scatterlist *sgl, const unsigned int max_pages,
                  */
                flush_dcache_page(pages[i]);
                /* ?? Is locking needed? I don't think so */
-               /* if (TestSetPageLocked(pages[i]))
+               /* if (!trylock_page(pages[i]))
                   goto out_unlock; */
         }
 
index a97f1ae..342e12f 100644 (file)
@@ -1885,7 +1885,7 @@ static int serial8250_startup(struct uart_port *port)
                 * the interrupt is enabled.  Delays are necessary to
                 * allow register changes to become visible.
                 */
-               spin_lock(&up->port.lock);
+               spin_lock_irqsave(&up->port.lock, flags);
                if (up->port.flags & UPF_SHARE_IRQ)
                        disable_irq_nosync(up->port.irq);
 
@@ -1901,7 +1901,7 @@ static int serial8250_startup(struct uart_port *port)
 
                if (up->port.flags & UPF_SHARE_IRQ)
                        enable_irq(up->port.irq);
-               spin_unlock(&up->port.lock);
+               spin_unlock_irqrestore(&up->port.lock, flags);
 
                /*
                 * If the interrupt is not reasserted, setup a timer to
index 3a0bbbe..7e7383e 100644 (file)
@@ -42,7 +42,6 @@ obj-$(CONFIG_SERIAL_68328) += 68328serial.o
 obj-$(CONFIG_SERIAL_68360) += 68360serial.o
 obj-$(CONFIG_SERIAL_COLDFIRE) += mcfserial.o
 obj-$(CONFIG_SERIAL_MCF) += mcf.o
-obj-$(CONFIG_V850E_UART) += v850e_uart.o
 obj-$(CONFIG_SERIAL_PMACZILOG) += pmac_zilog.o
 obj-$(CONFIG_SERIAL_LH7A40X) += serial_lh7a40x.o
 obj-$(CONFIG_SERIAL_DZ) += dz.o
index 9d85437..efcd443 100644 (file)
@@ -817,7 +817,7 @@ static void bfin_serial_set_ldisc(struct uart_port *port)
        if (line >= port->info->port.tty->driver->num)
                return;
 
-       switch (port->info->port.tty->ldisc.num) {
+       switch (port->info->port.tty->termios->c_line) {
        case N_IRDA:
                val = UART_GET_GCTL(&bfin_serial_ports[line]);
                val |= (IREN | RPOLC);
index 5c76e0a..7274b52 100644 (file)
 
 #define SCC_WAIT_CLOSING 100
 
+#define GPIO_CTS       0
+#define GPIO_RTS       1
+#define GPIO_DCD       2
+#define GPIO_DSR       3
+#define GPIO_DTR       4
+#define GPIO_RI                5
+
+#define NUM_GPIOS      (GPIO_RI+1)
+
 struct uart_cpm_port {
        struct uart_port        port;
        u16                     rx_nrfifos;
@@ -68,6 +77,7 @@ struct uart_cpm_port {
        unsigned char           *rx_buf;
        u32                     flags;
        void                    (*set_lineif)(struct uart_cpm_port *);
+       struct clk              *clk;
        u8                      brg;
        uint                     dp_addr;
        void                    *mem_addr;
@@ -82,6 +92,7 @@ struct uart_cpm_port {
        int                     wait_closing;
        /* value to combine with opcode to form cpm command */
        u32                     command;
+       int                     gpios[NUM_GPIOS];
 };
 
 extern int cpm_uart_nr;
index a4f8692..25efca5 100644 (file)
@@ -43,6 +43,9 @@
 #include <linux/dma-mapping.h>
 #include <linux/fs_uart_pd.h>
 #include <linux/of_platform.h>
+#include <linux/gpio.h>
+#include <linux/of_gpio.h>
+#include <linux/clk.h>
 
 #include <asm/io.h>
 #include <asm/irq.h>
@@ -96,13 +99,41 @@ static unsigned int cpm_uart_tx_empty(struct uart_port *port)
 
 static void cpm_uart_set_mctrl(struct uart_port *port, unsigned int mctrl)
 {
-       /* Whee. Do nothing. */
+       struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port;
+
+       if (pinfo->gpios[GPIO_RTS] >= 0)
+               gpio_set_value(pinfo->gpios[GPIO_RTS], !(mctrl & TIOCM_RTS));
+
+       if (pinfo->gpios[GPIO_DTR] >= 0)
+               gpio_set_value(pinfo->gpios[GPIO_DTR], !(mctrl & TIOCM_DTR));
 }
 
 static unsigned int cpm_uart_get_mctrl(struct uart_port *port)
 {
-       /* Whee. Do nothing. */
-       return TIOCM_CAR | TIOCM_DSR | TIOCM_CTS;
+       struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port;
+       unsigned int mctrl = TIOCM_CTS | TIOCM_DSR | TIOCM_CAR;
+
+       if (pinfo->gpios[GPIO_CTS] >= 0) {
+               if (gpio_get_value(pinfo->gpios[GPIO_CTS]))
+                       mctrl &= ~TIOCM_CTS;
+       }
+
+       if (pinfo->gpios[GPIO_DSR] >= 0) {
+               if (gpio_get_value(pinfo->gpios[GPIO_DSR]))
+                       mctrl &= ~TIOCM_DSR;
+       }
+
+       if (pinfo->gpios[GPIO_DCD] >= 0) {
+               if (gpio_get_value(pinfo->gpios[GPIO_DCD]))
+                       mctrl &= ~TIOCM_CAR;
+       }
+
+       if (pinfo->gpios[GPIO_RI] >= 0) {
+               if (!gpio_get_value(pinfo->gpios[GPIO_RI]))
+                       mctrl |= TIOCM_RNG;
+       }
+
+       return mctrl;
 }
 
 /*
@@ -566,7 +597,10 @@ static void cpm_uart_set_termios(struct uart_port *port,
                out_be16(&sccp->scc_psmr, (sbits << 12) | scval);
        }
 
-       cpm_set_brg(pinfo->brg - 1, baud);
+       if (pinfo->clk)
+               clk_set_rate(pinfo->clk, baud);
+       else
+               cpm_set_brg(pinfo->brg - 1, baud);
        spin_unlock_irqrestore(&port->lock, flags);
 }
 
@@ -991,14 +1025,23 @@ static int cpm_uart_init_port(struct device_node *np,
        void __iomem *mem, *pram;
        int len;
        int ret;
+       int i;
 
-       data = of_get_property(np, "fsl,cpm-brg", &len);
-       if (!data || len != 4) {
-               printk(KERN_ERR "CPM UART %s has no/invalid "
-                               "fsl,cpm-brg property.\n", np->name);
-               return -EINVAL;
+       data = of_get_property(np, "clock", NULL);
+       if (data) {
+               struct clk *clk = clk_get(NULL, (const char*)data);
+               if (!IS_ERR(clk))
+                       pinfo->clk = clk;
+       }
+       if (!pinfo->clk) {
+               data = of_get_property(np, "fsl,cpm-brg", &len);
+               if (!data || len != 4) {
+                       printk(KERN_ERR "CPM UART %s has no/invalid "
+                                       "fsl,cpm-brg property.\n", np->name);
+                       return -EINVAL;
+               }
+               pinfo->brg = *data;
        }
-       pinfo->brg = *data;
 
        data = of_get_property(np, "fsl,cpm-command", &len);
        if (!data || len != 4) {
@@ -1050,6 +1093,9 @@ static int cpm_uart_init_port(struct device_node *np,
                goto out_pram;
        }
 
+       for (i = 0; i < NUM_GPIOS; i++)
+               pinfo->gpios[i] = of_get_gpio(np, i);
+
        return cpm_uart_request_port(&pinfo->port);
 
 out_pram:
index 8249ac4..bf94a77 100644 (file)
@@ -234,7 +234,7 @@ unsigned long r_alt_ser_baudrate_shadow = 0;
 
 static struct e100_serial rs_table[] = {
        { .baud        = DEF_BAUD,
-         .port        = (unsigned char *)R_SERIAL0_CTRL,
+         .ioport        = (unsigned char *)R_SERIAL0_CTRL,
          .irq         = 1U << 12, /* uses DMA 6 and 7 */
          .oclrintradr = R_DMA_CH6_CLR_INTR,
          .ofirstadr   = R_DMA_CH6_FIRST,
@@ -288,7 +288,7 @@ static struct e100_serial rs_table[] = {
 },  /* ttyS0 */
 #ifndef CONFIG_SVINTO_SIM
        { .baud        = DEF_BAUD,
-         .port        = (unsigned char *)R_SERIAL1_CTRL,
+         .ioport        = (unsigned char *)R_SERIAL1_CTRL,
          .irq         = 1U << 16, /* uses DMA 8 and 9 */
          .oclrintradr = R_DMA_CH8_CLR_INTR,
          .ofirstadr   = R_DMA_CH8_FIRST,
@@ -344,7 +344,7 @@ static struct e100_serial rs_table[] = {
 },  /* ttyS1 */
 
        { .baud        = DEF_BAUD,
-         .port        = (unsigned char *)R_SERIAL2_CTRL,
+         .ioport        = (unsigned char *)R_SERIAL2_CTRL,
          .irq         = 1U << 4,  /* uses DMA 2 and 3 */
          .oclrintradr = R_DMA_CH2_CLR_INTR,
          .ofirstadr   = R_DMA_CH2_FIRST,
@@ -398,7 +398,7 @@ static struct e100_serial rs_table[] = {
  },  /* ttyS2 */
 
        { .baud        = DEF_BAUD,
-         .port        = (unsigned char *)R_SERIAL3_CTRL,
+         .ioport        = (unsigned char *)R_SERIAL3_CTRL,
          .irq         = 1U << 8,  /* uses DMA 4 and 5 */
          .oclrintradr = R_DMA_CH4_CLR_INTR,
          .ofirstadr   = R_DMA_CH4_FIRST,
@@ -939,7 +939,7 @@ static const struct control_pins e100_modem_pins[NR_PORTS] =
 /* Output */
 #define E100_RTS_GET(info) ((info)->rx_ctrl & E100_RTS_MASK)
 /* Input */
-#define E100_CTS_GET(info) ((info)->port[REG_STATUS] & E100_CTS_MASK)
+#define E100_CTS_GET(info) ((info)->ioport[REG_STATUS] & E100_CTS_MASK)
 
 /* These are typically PA or PB and 0 means 0V, 1 means 3.3V */
 /* Is an output */
@@ -1092,7 +1092,7 @@ e100_rts(struct e100_serial *info, int set)
        local_irq_save(flags);
        info->rx_ctrl &= ~E100_RTS_MASK;
        info->rx_ctrl |= (set ? 0 : E100_RTS_MASK);  /* RTS is active low */
-       info->port[REG_REC_CTRL] = info->rx_ctrl;
+       info->ioport[REG_REC_CTRL] = info->rx_ctrl;
        local_irq_restore(flags);
 #ifdef SERIAL_DEBUG_IO
        printk("ser%i rts %i\n", info->line, set);
@@ -1142,7 +1142,7 @@ e100_disable_rx(struct e100_serial *info)
 {
 #ifndef CONFIG_SVINTO_SIM
        /* disable the receiver */
-       info->port[REG_REC_CTRL] =
+       info->ioport[REG_REC_CTRL] =
                (info->rx_ctrl &= ~IO_MASK(R_SERIAL0_REC_CTRL, rec_enable));
 #endif
 }
@@ -1152,7 +1152,7 @@ e100_enable_rx(struct e100_serial *info)
 {
 #ifndef CONFIG_SVINTO_SIM
        /* enable the receiver */
-       info->port[REG_REC_CTRL] =
+       info->ioport[REG_REC_CTRL] =
                (info->rx_ctrl |= IO_MASK(R_SERIAL0_REC_CTRL, rec_enable));
 #endif
 }
@@ -1490,7 +1490,7 @@ rs_stop(struct tty_struct *tty)
                        xoff |= IO_STATE(R_SERIAL0_XOFF, auto_xoff, enable);
                }
 
-               *((unsigned long *)&info->port[REG_XOFF]) = xoff;
+               *((unsigned long *)&info->ioport[REG_XOFF]) = xoff;
                local_irq_restore(flags);
        }
 }
@@ -1513,7 +1513,7 @@ rs_start(struct tty_struct *tty)
                        xoff |= IO_STATE(R_SERIAL0_XOFF, auto_xoff, enable);
                }
 
-               *((unsigned long *)&info->port[REG_XOFF]) = xoff;
+               *((unsigned long *)&info->ioport[REG_XOFF]) = xoff;
                if (!info->uses_dma_out &&
                    info->xmit.head != info->xmit.tail && info->xmit.buf)
                        e100_enable_serial_tx_ready_irq(info);
@@ -1888,7 +1888,7 @@ static void receive_chars_dma(struct e100_serial *info)
        handle_all_descr_data(info);
 
        /* Read the status register to detect errors */
-       rstat = info->port[REG_STATUS];
+       rstat = info->ioport[REG_STATUS];
        if (rstat & IO_MASK(R_SERIAL0_STATUS, xoff_detect) ) {
                DFLOW(DEBUG_LOG(info->line, "XOFF detect stat %x\n", rstat));
        }
@@ -1897,7 +1897,7 @@ static void receive_chars_dma(struct e100_serial *info)
                /* If we got an error, we must reset it by reading the
                 * data_in field
                 */
-               unsigned char data = info->port[REG_DATA];
+               unsigned char data = info->ioport[REG_DATA];
 
                PROCSTAT(ser_stat[info->line].errors_cnt++);
                DEBUG_LOG(info->line, "#dERR: s d 0x%04X\n",
@@ -2077,7 +2077,7 @@ static int force_eop_if_needed(struct e100_serial *info)
        /* We check data_avail bit to determine if data has
         * arrived since last time
         */
-       unsigned char rstat = info->port[REG_STATUS];
+       unsigned char rstat = info->ioport[REG_STATUS];
 
        /* error or datavail? */
        if (rstat & SER_ERROR_MASK) {
@@ -2096,7 +2096,7 @@ static int force_eop_if_needed(struct e100_serial *info)
                TIMERD(DEBUG_LOG(info->line, "timeout: rstat 0x%03X\n",
                          rstat | (info->line << 8)));
                /* Read data to clear status flags */
-               (void)info->port[REG_DATA];
+               (void)info->ioport[REG_DATA];
 
                info->forced_eop = 0;
                START_FLUSH_FAST_TIMER(info, "magic");
@@ -2296,7 +2296,7 @@ struct e100_serial * handle_ser_rx_interrupt_no_dma(struct e100_serial *info)
        }
 
        /* Read data and status at the same time */
-       data_read = *((unsigned long *)&info->port[REG_DATA_STATUS32]);
+       data_read = *((unsigned long *)&info->ioport[REG_DATA_STATUS32]);
 more_data:
        if (data_read & IO_MASK(R_SERIAL0_READ, xoff_detect) ) {
                DFLOW(DEBUG_LOG(info->line, "XOFF detect\n", 0));
@@ -2391,7 +2391,7 @@ more_data:
 
 
        info->icount.rx++;
-       data_read = *((unsigned long *)&info->port[REG_DATA_STATUS32]);
+       data_read = *((unsigned long *)&info->ioport[REG_DATA_STATUS32]);
        if (data_read & IO_MASK(R_SERIAL0_READ, data_avail)) {
                DEBUG_LOG(info->line, "ser_rx   %c in loop\n", IO_EXTRACT(R_SERIAL0_READ, data_in, data_read));
                goto more_data;
@@ -2413,7 +2413,7 @@ static struct e100_serial* handle_ser_rx_interrupt(struct e100_serial *info)
                return handle_ser_rx_interrupt_no_dma(info);
        }
        /* DMA is used */
-       rstat = info->port[REG_STATUS];
+       rstat = info->ioport[REG_STATUS];
        if (rstat & IO_MASK(R_SERIAL0_STATUS, xoff_detect) ) {
                DFLOW(DEBUG_LOG(info->line, "XOFF detect\n", 0));
        }
@@ -2426,7 +2426,7 @@ static struct e100_serial* handle_ser_rx_interrupt(struct e100_serial *info)
                /* If we got an error, we must reset it by reading the
                 * data_in field
                 */
-               data = info->port[REG_DATA];
+               data = info->ioport[REG_DATA];
                DINTR1(DEBUG_LOG(info->line, "ser_rx!  %c\n", data));
                DINTR1(DEBUG_LOG(info->line, "ser_rx err stat %02X\n", rstat));
                if (!data && (rstat & SER_FRAMING_ERR_MASK)) {
@@ -2528,10 +2528,10 @@ static void handle_ser_tx_interrupt(struct e100_serial *info)
                unsigned char rstat;
                DFLOW(DEBUG_LOG(info->line, "tx_int: xchar 0x%02X\n", info->x_char));
                local_irq_save(flags);
-               rstat = info->port[REG_STATUS];
+               rstat = info->ioport[REG_STATUS];
                DFLOW(DEBUG_LOG(info->line, "stat %x\n", rstat));
 
-               info->port[REG_TR_DATA] = info->x_char;
+               info->ioport[REG_TR_DATA] = info->x_char;
                info->icount.tx++;
                info->x_char = 0;
                /* We must enable since it is disabled in ser_interrupt */
@@ -2545,7 +2545,7 @@ static void handle_ser_tx_interrupt(struct e100_serial *info)
                /* We only use normal tx interrupt when sending x_char */
                DFLOW(DEBUG_LOG(info->line, "tx_int: xchar sent\n", 0));
                local_irq_save(flags);
-               rstat = info->port[REG_STATUS];
+               rstat = info->ioport[REG_STATUS];
                DFLOW(DEBUG_LOG(info->line, "stat %x\n", rstat));
                e100_disable_serial_tx_ready_irq(info);
                if (info->port.tty->stopped)
@@ -2573,7 +2573,7 @@ static void handle_ser_tx_interrupt(struct e100_serial *info)
        DINTR2(DEBUG_LOG(info->line, "tx_int %c\n", info->xmit.buf[info->xmit.tail]));
        /* Send a byte, rs485 timing is critical so turn of ints */
        local_irq_save(flags);
-       info->port[REG_TR_DATA] = info->xmit.buf[info->xmit.tail];
+       info->ioport[REG_TR_DATA] = info->xmit.buf[info->xmit.tail];
        info->xmit.tail = (info->xmit.tail + 1) & (SERIAL_XMIT_SIZE-1);
        info->icount.tx++;
        if (info->xmit.head == info->xmit.tail) {
@@ -2848,7 +2848,7 @@ startup(struct e100_serial * info)
 
        /* dummy read to reset any serial errors */
 
-       (void)info->port[REG_DATA];
+       (void)info->ioport[REG_DATA];
 
        /* enable the interrupts */
        if (info->uses_dma_out)
@@ -2897,7 +2897,7 @@ shutdown(struct e100_serial * info)
        /* shut down the transmitter and receiver */
        DFLOW(DEBUG_LOG(info->line, "shutdown %i\n", info->line));
        e100_disable_rx(info);
-       info->port[REG_TR_CTRL] = (info->tx_ctrl &= ~0x40);
+       info->ioport[REG_TR_CTRL] = (info->tx_ctrl &= ~0x40);
 
        /* disable interrupts, reset dma channels */
        if (info->uses_dma_in) {
@@ -2968,7 +2968,7 @@ change_speed(struct e100_serial *info)
 
        if (!info->port.tty || !info->port.tty->termios)
                return;
-       if (!info->port)
+       if (!info->ioport)
                return;
 
        cflag = info->port.tty->termios->c_cflag;
@@ -3037,7 +3037,7 @@ change_speed(struct e100_serial *info)
 
                info->baud = cflag_to_baud(cflag);
 #ifndef CONFIG_SVINTO_SIM
-               info->port[REG_BAUD] = cflag_to_etrax_baud(cflag);
+               info->ioport[REG_BAUD] = cflag_to_etrax_baud(cflag);
 #endif /* CONFIG_SVINTO_SIM */
        }
 
@@ -3097,8 +3097,8 @@ change_speed(struct e100_serial *info)
 
        /* actually write the control regs to the hardware */
 
-       info->port[REG_TR_CTRL] = info->tx_ctrl;
-       info->port[REG_REC_CTRL] = info->rx_ctrl;
+       info->ioport[REG_TR_CTRL] = info->tx_ctrl;
+       info->ioport[REG_REC_CTRL] = info->rx_ctrl;
        xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char, STOP_CHAR(info->port.tty));
        xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, enable);
        if (info->port.tty->termios->c_iflag & IXON ) {
@@ -3107,7 +3107,7 @@ change_speed(struct e100_serial *info)
                xoff |= IO_STATE(R_SERIAL0_XOFF, auto_xoff, enable);
        }
 
-       *((unsigned long *)&info->port[REG_XOFF]) = xoff;
+       *((unsigned long *)&info->ioport[REG_XOFF]) = xoff;
        local_irq_restore(flags);
 #endif /* !CONFIG_SVINTO_SIM */
 
@@ -3156,7 +3156,7 @@ static int rs_raw_write(struct tty_struct *tty,
 #ifdef SERIAL_DEBUG_DATA
        if (info->line == SERIAL_DEBUG_LINE)
                printk("rs_raw_write (%d), status %d\n",
-                      count, info->port[REG_STATUS]);
+                      count, info->ioport[REG_STATUS]);
 #endif
 
 #ifdef CONFIG_SVINTO_SIM
@@ -3427,7 +3427,7 @@ get_serial_info(struct e100_serial * info,
        memset(&tmp, 0, sizeof(tmp));
        tmp.type = info->type;
        tmp.line = info->line;
-       tmp.port = (int)info->port;
+       tmp.port = (int)info->ioport;
        tmp.irq = info->irq;
        tmp.flags = info->flags;
        tmp.baud_base = info->baud_base;
@@ -3557,14 +3557,14 @@ char *get_control_state_str(int MLines, char *s)
 }
 #endif
 
-static void
+static int
 rs_break(struct tty_struct *tty, int break_state)
 {
        struct e100_serial *info = (struct e100_serial *)tty->driver_data;
        unsigned long flags;
 
-       if (!info->port)
-               return;
+       if (!info->ioport)
+               return -EIO;
 
        local_irq_save(flags);
        if (break_state == -1) {
@@ -3575,8 +3575,9 @@ rs_break(struct tty_struct *tty, int break_state)
                /* Set bit 7 (txd) and 6 (tr_enable) */
                info->tx_ctrl |= (0x80 | 0x40);
        }
-       info->port[REG_TR_CTRL] = info->tx_ctrl;
+       info->ioport[REG_TR_CTRL] = info->tx_ctrl;
        local_irq_restore(flags);
+       return 0;
 }
 
 static int
@@ -4231,9 +4232,9 @@ static int line_info(char *buf, struct e100_serial *info)
        unsigned long tmp;
 
        ret = sprintf(buf, "%d: uart:E100 port:%lX irq:%d",
-                     info->line, (unsigned long)info->port, info->irq);
+                     info->line, (unsigned long)info->ioport, info->irq);
 
-       if (!info->port || (info->type == PORT_UNKNOWN)) {
+       if (!info->ioport || (info->type == PORT_UNKNOWN)) {
                ret += sprintf(buf+ret, "\n");
                return ret;
        }
@@ -4281,7 +4282,7 @@ static int line_info(char *buf, struct e100_serial *info)
        }
 
        {
-               unsigned char rstat = info->port[REG_STATUS];
+               unsigned char rstat = info->ioport[REG_STATUS];
                if (rstat & IO_MASK(R_SERIAL0_STATUS, xoff_detect) )
                        ret += sprintf(buf+ret, " xoff_detect:1");
        }
@@ -4502,7 +4503,7 @@ rs_init(void)
 
                if (info->enabled) {
                        printk(KERN_INFO "%s%d at 0x%x is a builtin UART with DMA\n",
-                              serial_driver->name, info->line, (unsigned int)info->port);
+                              serial_driver->name, info->line, (unsigned int)info->ioport);
                }
        }
 #ifdef CONFIG_ETRAX_FAST_TIMER
index ccd0f32..e3c5c8c 100644 (file)
@@ -36,8 +36,9 @@ struct etrax_recv_buffer {
 };
 
 struct e100_serial {
+       struct tty_port port;
        int baud;
-       volatile u8     *port;  /* R_SERIALx_CTRL */
+       volatile u8     *ioport;        /* R_SERIALx_CTRL */
        u32             irq;    /* bitnr in R_IRQ_MASK2 for dmaX_descr */
 
        /* Output registers */
index cd728df..8a0749e 100644 (file)
@@ -451,19 +451,21 @@ SCIx_FNS(SCxSR,  0x08,  8, 0x10,  8, 0x08, 16, 0x10, 16, 0x04,  8)
 SCIx_FNS(SCxRDR, 0x0a,  8, 0x14,  8, 0x0A,  8, 0x14,  8, 0x05,  8)
 SCIF_FNS(SCFCR,                      0x0c,  8, 0x18, 16)
 #if defined(CONFIG_CPU_SUBTYPE_SH7760) || \
-    defined(CONFIG_CPU_SUBTYPE_SH7763) || \
     defined(CONFIG_CPU_SUBTYPE_SH7780) || \
     defined(CONFIG_CPU_SUBTYPE_SH7785)
+SCIF_FNS(SCFDR,                             0x0e, 16, 0x1C, 16)
 SCIF_FNS(SCTFDR,                    0x0e, 16, 0x1C, 16)
 SCIF_FNS(SCRFDR,                    0x0e, 16, 0x20, 16)
 SCIF_FNS(SCSPTR,                       0,  0, 0x24, 16)
 SCIF_FNS(SCLSR,                                0,  0, 0x28, 16)
-#if defined(CONFIG_CPU_SUBTYPE_SH7763)
-/* SH7763 SCIF2 */
+#elif defined(CONFIG_CPU_SUBTYPE_SH7763)
 SCIF_FNS(SCFDR,                                0,  0, 0x1C, 16)
 SCIF_FNS(SCSPTR2,                      0,  0, 0x20, 16)
-SCIF_FNS(SCLSR2,                       0,  0, 0x24, 16)
-#endif /* CONFIG_CPU_SUBTYPE_SH7763 */
+SCIF_FNS(SCLSR2,                       0,  0, 0x24, 16)
+SCIF_FNS(SCTFDR,                    0x0e, 16, 0x1C, 16)
+SCIF_FNS(SCRFDR,                    0x0e, 16, 0x20, 16)
+SCIF_FNS(SCSPTR,                       0,  0, 0x24, 16)
+SCIF_FNS(SCLSR,                                0,  0, 0x28, 16)
 #else
 SCIF_FNS(SCFDR,                      0x0e, 16, 0x1C, 16)
 #if defined(CONFIG_CPU_SUBTYPE_SH7722)
diff --git a/drivers/serial/v850e_uart.c b/drivers/serial/v850e_uart.c
deleted file mode 100644 (file)
index 5acf061..0000000
+++ /dev/null
@@ -1,548 +0,0 @@
-/*
- * drivers/serial/v850e_uart.c -- Serial I/O using V850E on-chip UART or UARTB
- *
- *  Copyright (C) 2001,02,03  NEC Electronics Corporation
- *  Copyright (C) 2001,02,03  Miles Bader <miles@gnu.org>
- *
- * 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.
- *
- * Written by Miles Bader <miles@gnu.org>
- */
-
-/* This driver supports both the original V850E UART interface (called
-   merely `UART' in the docs) and the newer `UARTB' interface, which is
-   roughly a superset of the first one.  The selection is made at
-   configure time -- if CONFIG_V850E_UARTB is defined, then UARTB is
-   presumed, otherwise the old UART -- as these are on-CPU UARTS, a system
-   can never have both.
-
-   The UARTB interface also has a 16-entry FIFO mode, which is not
-   yet supported by this driver.  */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/console.h>
-#include <linux/tty.h>
-#include <linux/tty_flip.h>
-#include <linux/serial.h>
-#include <linux/serial_core.h>
-
-#include <asm/v850e_uart.h>
-
-/* Initial UART state.  This may be overridden by machine-dependent headers. */
-#ifndef V850E_UART_INIT_BAUD
-#define V850E_UART_INIT_BAUD   115200
-#endif
-#ifndef V850E_UART_INIT_CFLAGS
-#define V850E_UART_INIT_CFLAGS (B115200 | CS8 | CREAD)
-#endif
-
-/* A string used for prefixing printed descriptions; since the same UART
-   macro is actually used on other chips than the V850E.  This must be a
-   constant string.  */
-#ifndef V850E_UART_CHIP_NAME
-#define V850E_UART_CHIP_NAME   "V850E"
-#endif
-
-#define V850E_UART_MINOR_BASE  64         /* First tty minor number */
-
-\f
-/* Low-level UART functions.  */
-
-/* Configure and turn on uart channel CHAN, using the termios `control
-   modes' bits in CFLAGS, and a baud-rate of BAUD.  */
-void v850e_uart_configure (unsigned chan, unsigned cflags, unsigned baud)
-{
-       int flags;
-       v850e_uart_speed_t old_speed;
-       v850e_uart_config_t old_config;
-       v850e_uart_speed_t new_speed = v850e_uart_calc_speed (baud);
-       v850e_uart_config_t new_config = v850e_uart_calc_config (cflags);
-
-       /* Disable interrupts while we're twiddling the hardware.  */
-       local_irq_save (flags);
-
-#ifdef V850E_UART_PRE_CONFIGURE
-       V850E_UART_PRE_CONFIGURE (chan, cflags, baud);
-#endif
-
-       old_config = V850E_UART_CONFIG (chan);
-       old_speed = v850e_uart_speed (chan);
-
-       if (! v850e_uart_speed_eq (old_speed, new_speed)) {
-               /* The baud rate has changed.  First, disable the UART.  */
-               V850E_UART_CONFIG (chan) = V850E_UART_CONFIG_FINI;
-               old_config = 0; /* Force the uart to be re-initialized. */
-
-               /* Reprogram the baud-rate generator.  */
-               v850e_uart_set_speed (chan, new_speed);
-       }
-
-       if (! (old_config & V850E_UART_CONFIG_ENABLED)) {
-               /* If we are using the uart for the first time, start by
-                  enabling it, which must be done before turning on any
-                  other bits.  */
-               V850E_UART_CONFIG (chan) = V850E_UART_CONFIG_INIT;
-               /* See the initial state.  */
-               old_config = V850E_UART_CONFIG (chan);
-       }
-
-       if (new_config != old_config) {
-               /* Which of the TXE/RXE bits we'll temporarily turn off
-                  before changing other control bits.  */
-               unsigned temp_disable = 0;
-               /* Which of the TXE/RXE bits will be enabled.  */
-               unsigned enable = 0;
-               unsigned changed_bits = new_config ^ old_config;
-
-               /* Which of RX/TX will be enabled in the new configuration.  */
-               if (new_config & V850E_UART_CONFIG_RX_BITS)
-                       enable |= (new_config & V850E_UART_CONFIG_RX_ENABLE);
-               if (new_config & V850E_UART_CONFIG_TX_BITS)
-                       enable |= (new_config & V850E_UART_CONFIG_TX_ENABLE);
-
-               /* Figure out which of RX/TX needs to be disabled; note
-                  that this will only happen if they're not already
-                  disabled.  */
-               if (changed_bits & V850E_UART_CONFIG_RX_BITS)
-                       temp_disable
-                               |= (old_config & V850E_UART_CONFIG_RX_ENABLE);
-               if (changed_bits & V850E_UART_CONFIG_TX_BITS)
-                       temp_disable
-                               |= (old_config & V850E_UART_CONFIG_TX_ENABLE);
-
-               /* We have to turn off RX and/or TX mode before changing
-                  any associated control bits.  */
-               if (temp_disable)
-                       V850E_UART_CONFIG (chan) = old_config & ~temp_disable;
-
-               /* Write the new control bits, while RX/TX are disabled. */ 
-               if (changed_bits & ~enable)
-                       V850E_UART_CONFIG (chan) = new_config & ~enable;
-
-               v850e_uart_config_delay (new_config, new_speed);
-
-               /* Write the final version, with enable bits turned on.  */
-               V850E_UART_CONFIG (chan) = new_config;
-       }
-
-       local_irq_restore (flags);
-}
-
-\f
-/*  Low-level console. */
-
-#ifdef CONFIG_V850E_UART_CONSOLE
-
-static void v850e_uart_cons_write (struct console *co,
-                                  const char *s, unsigned count)
-{
-       if (count > 0) {
-               unsigned chan = co->index;
-               unsigned irq = V850E_UART_TX_IRQ (chan);
-               int irq_was_enabled, irq_was_pending, flags;
-
-               /* We don't want to get `transmission completed'
-                  interrupts, since we're busy-waiting, so we disable them
-                  while sending (we don't disable interrupts entirely
-                  because sending over a serial line is really slow).  We
-                  save the status of the tx interrupt and restore it when
-                  we're done so that using printk doesn't interfere with
-                  normal serial transmission (other than interleaving the
-                  output, of course!).  This should work correctly even if
-                  this function is interrupted and the interrupt printks
-                  something.  */
-
-               /* Disable interrupts while fiddling with tx interrupt.  */
-               local_irq_save (flags);
-               /* Get current tx interrupt status.  */
-               irq_was_enabled = v850e_intc_irq_enabled (irq);
-               irq_was_pending = v850e_intc_irq_pending (irq);
-               /* Disable tx interrupt if necessary.  */
-               if (irq_was_enabled)
-                       v850e_intc_disable_irq (irq);
-               /* Turn interrupts back on.  */
-               local_irq_restore (flags);
-
-               /* Send characters.  */
-               while (count > 0) {
-                       int ch = *s++;
-
-                       if (ch == '\n') {
-                               /* We don't have the benefit of a tty
-                                  driver, so translate NL into CR LF.  */
-                               v850e_uart_wait_for_xmit_ok (chan);
-                               v850e_uart_putc (chan, '\r');
-                       }
-
-                       v850e_uart_wait_for_xmit_ok (chan);
-                       v850e_uart_putc (chan, ch);
-
-                       count--;
-               }
-
-               /* Restore saved tx interrupt status.  */
-               if (irq_was_enabled) {
-                       /* Wait for the last character we sent to be
-                          completely transmitted (as we'll get an
-                          interrupt interrupt at that point).  */
-                       v850e_uart_wait_for_xmit_done (chan);
-                       /* Clear pending interrupts received due
-                          to our transmission, unless there was already
-                          one pending, in which case we want the
-                          handler to be called.  */
-                       if (! irq_was_pending)
-                               v850e_intc_clear_pending_irq (irq);
-                       /* ... and then turn back on handling.  */
-                       v850e_intc_enable_irq (irq);
-               }
-       }
-}
-
-extern struct uart_driver v850e_uart_driver;
-static struct console v850e_uart_cons =
-{
-    .name      = "ttyS",
-    .write     = v850e_uart_cons_write,
-    .device    = uart_console_device,
-    .flags     = CON_PRINTBUFFER,
-    .cflag     = V850E_UART_INIT_CFLAGS,
-    .index     = -1,
-    .data      = &v850e_uart_driver,
-};
-
-void v850e_uart_cons_init (unsigned chan)
-{
-       v850e_uart_configure (chan, V850E_UART_INIT_CFLAGS,
-                             V850E_UART_INIT_BAUD);
-       v850e_uart_cons.index = chan;
-       register_console (&v850e_uart_cons);
-       printk ("Console: %s on-chip UART channel %d\n",
-               V850E_UART_CHIP_NAME, chan);
-}
-
-/* This is what the init code actually calls.  */
-static int v850e_uart_console_init (void)
-{
-       v850e_uart_cons_init (V850E_UART_CONSOLE_CHANNEL);
-       return 0;
-}
-console_initcall(v850e_uart_console_init);
-
-#define V850E_UART_CONSOLE &v850e_uart_cons
-
-#else /* !CONFIG_V850E_UART_CONSOLE */
-#define V850E_UART_CONSOLE 0
-#endif /* CONFIG_V850E_UART_CONSOLE */
-\f
-/* TX/RX interrupt handlers.  */
-
-static void v850e_uart_stop_tx (struct uart_port *port);
-
-void v850e_uart_tx (struct uart_port *port)
-{
-       struct circ_buf *xmit = &port->info->xmit;
-       int stopped = uart_tx_stopped (port);
-
-       if (v850e_uart_xmit_ok (port->line)) {
-               int tx_ch;
-
-               if (port->x_char) {
-                       tx_ch = port->x_char;
-                       port->x_char = 0;
-               } else if (!uart_circ_empty (xmit) && !stopped) {
-                       tx_ch = xmit->buf[xmit->tail];
-                       xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-               } else
-                       goto no_xmit;
-
-               v850e_uart_putc (port->line, tx_ch);
-               port->icount.tx++;
-
-               if (uart_circ_chars_pending (xmit) < WAKEUP_CHARS)
-                       uart_write_wakeup (port);
-       }
-
- no_xmit:
-       if (uart_circ_empty (xmit) || stopped)
-               v850e_uart_stop_tx (port, stopped);
-}
-
-static irqreturn_t v850e_uart_tx_irq(int irq, void *data)
-{
-       struct uart_port *port = data;
-       v850e_uart_tx (port);
-       return IRQ_HANDLED;
-}
-
-static irqreturn_t v850e_uart_rx_irq(int irq, void *data)
-{
-       struct uart_port *port = data;
-       unsigned ch_stat = TTY_NORMAL;
-       unsigned ch = v850e_uart_getc (port->line);
-       unsigned err = v850e_uart_err (port->line);
-
-       if (err) {
-               if (err & V850E_UART_ERR_OVERRUN) {
-                       ch_stat = TTY_OVERRUN;
-                       port->icount.overrun++;
-               } else if (err & V850E_UART_ERR_FRAME) {
-                       ch_stat = TTY_FRAME;
-                       port->icount.frame++;
-               } else if (err & V850E_UART_ERR_PARITY) {
-                       ch_stat = TTY_PARITY;
-                       port->icount.parity++;
-               }
-       }
-
-       port->icount.rx++;
-
-       tty_insert_flip_char (port->info->port.tty, ch, ch_stat);
-       tty_schedule_flip (port->info->port.tty);
-
-       return IRQ_HANDLED;
-}
-
-\f
-/* Control functions for the serial framework.  */
-
-static void v850e_uart_nop (struct uart_port *port) { }
-static int v850e_uart_success (struct uart_port *port) { return 0; }
-
-static unsigned v850e_uart_tx_empty (struct uart_port *port)
-{
-       return TIOCSER_TEMT;    /* Can't detect.  */
-}
-
-static void v850e_uart_set_mctrl (struct uart_port *port, unsigned mctrl)
-{
-#ifdef V850E_UART_SET_RTS
-       V850E_UART_SET_RTS (port->line, (mctrl & TIOCM_RTS));
-#endif
-}
-
-static unsigned v850e_uart_get_mctrl (struct uart_port *port)
-{
-       /* We don't support DCD or DSR, so consider them permanently active. */
-       int mctrl = TIOCM_CAR | TIOCM_DSR;
-
-       /* We may support CTS.  */
-#ifdef V850E_UART_CTS
-       mctrl |= V850E_UART_CTS(port->line) ? TIOCM_CTS : 0;
-#else
-       mctrl |= TIOCM_CTS;
-#endif
-
-       return mctrl;
-}
-
-static void v850e_uart_start_tx (struct uart_port *port)
-{
-       v850e_intc_disable_irq (V850E_UART_TX_IRQ (port->line));
-       v850e_uart_tx (port);
-       v850e_intc_enable_irq (V850E_UART_TX_IRQ (port->line));
-}
-
-static void v850e_uart_stop_tx (struct uart_port *port)
-{
-       v850e_intc_disable_irq (V850E_UART_TX_IRQ (port->line));
-}
-
-static void v850e_uart_start_rx (struct uart_port *port)
-{
-       v850e_intc_enable_irq (V850E_UART_RX_IRQ (port->line));
-}
-
-static void v850e_uart_stop_rx (struct uart_port *port)
-{
-       v850e_intc_disable_irq (V850E_UART_RX_IRQ (port->line));
-}
-
-static void v850e_uart_break_ctl (struct uart_port *port, int break_ctl)
-{
-       /* Umm, do this later.  */
-}
-
-static int v850e_uart_startup (struct uart_port *port)
-{
-       int err;
-
-       /* Alloc RX irq.  */
-       err = request_irq (V850E_UART_RX_IRQ (port->line), v850e_uart_rx_irq,
-                          IRQF_DISABLED, "v850e_uart", port);
-       if (err)
-               return err;
-
-       /* Alloc TX irq.  */
-       err = request_irq (V850E_UART_TX_IRQ (port->line), v850e_uart_tx_irq,
-                          IRQF_DISABLED, "v850e_uart", port);
-       if (err) {
-               free_irq (V850E_UART_RX_IRQ (port->line), port);
-               return err;
-       }
-
-       v850e_uart_start_rx (port);
-
-       return 0;
-}
-
-static void v850e_uart_shutdown (struct uart_port *port)
-{
-       /* Disable port interrupts.  */
-       free_irq (V850E_UART_TX_IRQ (port->line), port);
-       free_irq (V850E_UART_RX_IRQ (port->line), port);
-
-       /* Turn off xmit/recv enable bits.  */
-       V850E_UART_CONFIG (port->line)
-               &= ~(V850E_UART_CONFIG_TX_ENABLE
-                    | V850E_UART_CONFIG_RX_ENABLE);
-       /* Then reset the channel.  */
-       V850E_UART_CONFIG (port->line) = 0;
-}
-
-static void
-v850e_uart_set_termios (struct uart_port *port, struct ktermios *termios,
-                       struct ktermios *old)
-{
-       unsigned cflags = termios->c_cflag;
-
-       /* Restrict flags to legal values.  */
-       if ((cflags & CSIZE) != CS7 && (cflags & CSIZE) != CS8)
-               /* The new value of CSIZE is invalid, use the old value.  */
-               cflags = (cflags & ~CSIZE)
-                       | (old ? (old->c_cflag & CSIZE) : CS8);
-
-       termios->c_cflag = cflags;
-
-       v850e_uart_configure (port->line, cflags,
-                             uart_get_baud_rate (port, termios, old,
-                                                 v850e_uart_min_baud(),
-                                                 v850e_uart_max_baud()));
-}
-
-static const char *v850e_uart_type (struct uart_port *port)
-{
-       return port->type == PORT_V850E_UART ? "v850e_uart" : 0;
-}
-
-static void v850e_uart_config_port (struct uart_port *port, int flags)
-{
-       if (flags & UART_CONFIG_TYPE)
-               port->type = PORT_V850E_UART;
-}
-
-static int
-v850e_uart_verify_port (struct uart_port *port, struct serial_struct *ser)
-{
-       if (ser->type != PORT_UNKNOWN && ser->type != PORT_V850E_UART)
-               return -EINVAL;
-       if (ser->irq != V850E_UART_TX_IRQ (port->line))
-               return -EINVAL;
-       return 0;
-}
-
-static struct uart_ops v850e_uart_ops = {
-       .tx_empty       = v850e_uart_tx_empty,
-       .get_mctrl      = v850e_uart_get_mctrl,
-       .set_mctrl      = v850e_uart_set_mctrl,
-       .start_tx       = v850e_uart_start_tx,
-       .stop_tx        = v850e_uart_stop_tx,
-       .stop_rx        = v850e_uart_stop_rx,
-       .enable_ms      = v850e_uart_nop,
-       .break_ctl      = v850e_uart_break_ctl,
-       .startup        = v850e_uart_startup,
-       .shutdown       = v850e_uart_shutdown,
-       .set_termios    = v850e_uart_set_termios,
-       .type           = v850e_uart_type,
-       .release_port   = v850e_uart_nop,
-       .request_port   = v850e_uart_success,
-       .config_port    = v850e_uart_config_port,
-       .verify_port    = v850e_uart_verify_port,
-};
-\f
-/* Initialization and cleanup.  */
-
-static struct uart_driver v850e_uart_driver = {
-       .owner                  = THIS_MODULE,
-       .driver_name            = "v850e_uart",
-       .dev_name               = "ttyS",
-       .major                  = TTY_MAJOR,
-       .minor                  = V850E_UART_MINOR_BASE,
-       .nr                     = V850E_UART_NUM_CHANNELS,
-       .cons                   = V850E_UART_CONSOLE,
-};
-
-
-static struct uart_port v850e_uart_ports[V850E_UART_NUM_CHANNELS];
-
-static int __init v850e_uart_init (void)
-{
-       int rval;
-
-       printk (KERN_INFO "%s on-chip UART\n", V850E_UART_CHIP_NAME);
-
-       rval = uart_register_driver (&v850e_uart_driver);
-       if (rval == 0) {
-               unsigned chan;
-
-               for (chan = 0; chan < V850E_UART_NUM_CHANNELS; chan++) {
-                       struct uart_port *port = &v850e_uart_ports[chan];
-                       
-                       memset (port, 0, sizeof *port);
-
-                       port->ops = &v850e_uart_ops;
-                       port->line = chan;
-                       port->iotype = UPIO_MEM;
-                       port->flags = UPF_BOOT_AUTOCONF;
-
-                       /* We actually use multiple IRQs, but the serial
-                          framework seems to mainly use this for
-                          informational purposes anyway.  Here we use the TX
-                          irq.  */
-                       port->irq = V850E_UART_TX_IRQ (chan);
-
-                       /* The serial framework doesn't really use these
-                          membase/mapbase fields for anything useful, but
-                          it requires that they be something non-zero to
-                          consider the port `valid', and also uses them
-                          for informational purposes.  */
-                       port->membase = (void *)V850E_UART_BASE_ADDR (chan);
-                       port->mapbase = V850E_UART_BASE_ADDR (chan);
-
-                       /* The framework insists on knowing the uart's master
-                          clock freq, though it doesn't seem to do anything
-                          useful for us with it.  We must make it at least
-                          higher than (the maximum baud rate * 16), otherwise
-                          the framework will puke during its internal
-                          calculations, and force the baud rate to be 9600.
-                          To be accurate though, just repeat the calculation
-                          we use when actually setting the speed.  */
-                       port->uartclk = v850e_uart_max_clock() * 16;
-
-                       uart_add_one_port (&v850e_uart_driver, port);
-               }
-       }
-
-       return rval;
-}
-
-static void __exit v850e_uart_exit (void)
-{
-       unsigned chan;
-
-       for (chan = 0; chan < V850E_UART_NUM_CHANNELS; chan++)
-               uart_remove_one_port (&v850e_uart_driver,
-                                     &v850e_uart_ports[chan]);
-
-       uart_unregister_driver (&v850e_uart_driver);
-}
-
-module_init (v850e_uart_init);
-module_exit (v850e_uart_exit);
-
-MODULE_AUTHOR ("Miles Bader");
-MODULE_DESCRIPTION ("NEC " V850E_UART_CHIP_NAME " on-chip UART");
-MODULE_LICENSE ("GPL");
index 617efb1..d1812d3 100644 (file)
@@ -2,6 +2,7 @@
  * Core maple bus functionality
  *
  *  Copyright (C) 2007, 2008 Adrian McMenamin
+ *  Copyright (C) 2001 - 2008 Paul Mundt
  *
  * Based on 2.4 code by:
  *
 #include <linux/slab.h>
 #include <linux/maple.h>
 #include <linux/dma-mapping.h>
+#include <linux/delay.h>
 #include <asm/cacheflush.h>
 #include <asm/dma.h>
 #include <asm/io.h>
-#include <asm/mach/dma.h>
-#include <asm/mach/sysasic.h>
-#include <asm/mach/maple.h>
-#include <linux/delay.h>
+#include <mach/dma.h>
+#include <mach/sysasic.h>
 
-MODULE_AUTHOR("Yaegshi Takeshi, Paul Mundt, M.R. Brown, Adrian McMenamin");
+MODULE_AUTHOR("Yaegashi Takeshi, Paul Mundt, M. R. Brown, Adrian McMenamin");
 MODULE_DESCRIPTION("Maple bus driver for Dreamcast");
 MODULE_LICENSE("GPL v2");
 MODULE_SUPPORTED_DEVICE("{{SEGA, Dreamcast/Maple}}");
@@ -46,14 +46,15 @@ static DECLARE_WORK(maple_vblank_process, maple_vblank_handler);
 static LIST_HEAD(maple_waitq);
 static LIST_HEAD(maple_sentq);
 
-static DEFINE_MUTEX(maple_list_lock);
+/* mutex to protect queue of waiting packets */
+static DEFINE_MUTEX(maple_wlist_lock);
 
 static struct maple_driver maple_dummy_driver;
 static struct device maple_bus;
 static int subdevice_map[MAPLE_PORTS];
 static unsigned long *maple_sendbuf, *maple_sendptr, *maple_lastptr;
 static unsigned long maple_pnp_time;
-static int started, scanning, liststatus, fullscan;
+static int started, scanning, fullscan;
 static struct kmem_cache *maple_queue_cache;
 
 struct maple_device_specify {
@@ -65,19 +66,36 @@ static bool checked[4];
 static struct maple_device *baseunits[4];
 
 /**
- *  maple_driver_register - register a device driver
- *  automatically makes the driver bus a maple bus
- *  @drv: the driver to be registered
+ * maple_driver_register - register a maple driver
+ * @drv: maple driver to be registered.
+ *
+ * Registers the passed in @drv, while updating the bus type.
+ * Devices with matching function IDs will be automatically probed.
  */
-int maple_driver_register(struct device_driver *drv)
+int maple_driver_register(struct maple_driver *drv)
 {
        if (!drv)
                return -EINVAL;
-       drv->bus = &maple_bus_type;
-       return driver_register(drv);
+
+       drv->drv.bus = &maple_bus_type;
+
+       return driver_register(&drv->drv);
 }
 EXPORT_SYMBOL_GPL(maple_driver_register);
 
+/**
+ * maple_driver_unregister - unregister a maple driver.
+ * @drv: maple driver to unregister.
+ *
+ * Cleans up after maple_driver_register(). To be invoked in the exit
+ * path of any module drivers.
+ */
+void maple_driver_unregister(struct maple_driver *drv)
+{
+       driver_unregister(&drv->drv);
+}
+EXPORT_SYMBOL_GPL(maple_driver_unregister);
+
 /* set hardware registers to enable next round of dma */
 static void maplebus_dma_reset(void)
 {
@@ -131,33 +149,123 @@ static void maple_release_device(struct device *dev)
 
 /**
  * maple_add_packet - add a single instruction to the queue
- * @mq: instruction to add to waiting queue
+ * @mdev: maple device
+ * @function: function on device being queried
+ * @command: maple command to add
+ * @length: length of command string (in 32 bit words)
+ * @data: remainder of command string
  */
-void maple_add_packet(struct mapleq *mq)
+int maple_add_packet(struct maple_device *mdev, u32 function, u32 command,
+       size_t length, void *data)
 {
-       mutex_lock(&maple_list_lock);
-       list_add(&mq->list, &maple_waitq);
-       mutex_unlock(&maple_list_lock);
+       int locking, ret = 0;
+       void *sendbuf = NULL;
+
+       mutex_lock(&maple_wlist_lock);
+       /* bounce if device already locked */
+       locking = mutex_is_locked(&mdev->mq->mutex);
+       if (locking) {
+               ret = -EBUSY;
+               goto out;
+       }
+
+       mutex_lock(&mdev->mq->mutex);
+
+       if (length) {
+               sendbuf = kmalloc(length * 4, GFP_KERNEL);
+               if (!sendbuf) {
+                       mutex_unlock(&mdev->mq->mutex);
+                       ret = -ENOMEM;
+                       goto out;
+               }
+               ((__be32 *)sendbuf)[0] = cpu_to_be32(function);
+       }
+
+       mdev->mq->command = command;
+       mdev->mq->length = length;
+       if (length > 1)
+               memcpy(sendbuf + 4, data, (length - 1) * 4);
+       mdev->mq->sendbuf = sendbuf;
+
+       list_add(&mdev->mq->list, &maple_waitq);
+out:
+       mutex_unlock(&maple_wlist_lock);
+       return ret;
 }
 EXPORT_SYMBOL_GPL(maple_add_packet);
 
+/**
+ * maple_add_packet_sleeps - add a single instruction to the queue
+ * @mdev: maple device
+ * @function: function on device being queried
+ * @command: maple command to add
+ * @length: length of command string (in 32 bit words)
+ * @data: remainder of command string
+ *
+ * Same as maple_add_packet(), but waits for the lock to become free.
+ */
+int maple_add_packet_sleeps(struct maple_device *mdev, u32 function,
+       u32 command, size_t length, void *data)
+{
+       int locking, ret = 0;
+       void *sendbuf = NULL;
+
+       locking = mutex_lock_interruptible(&mdev->mq->mutex);
+       if (locking) {
+               ret = -EIO;
+               goto out;
+       }
+
+       if (length) {
+               sendbuf = kmalloc(length * 4, GFP_KERNEL);
+               if (!sendbuf) {
+                       mutex_unlock(&mdev->mq->mutex);
+                       ret = -ENOMEM;
+                       goto out;
+               }
+               ((__be32 *)sendbuf)[0] = cpu_to_be32(function);
+       }
+
+       mdev->mq->command = command;
+       mdev->mq->length = length;
+       if (length > 1)
+               memcpy(sendbuf + 4, data, (length - 1) * 4);
+       mdev->mq->sendbuf = sendbuf;
+
+       mutex_lock(&maple_wlist_lock);
+       list_add(&mdev->mq->list, &maple_waitq);
+       mutex_unlock(&maple_wlist_lock);
+out:
+       return ret;
+}
+EXPORT_SYMBOL_GPL(maple_add_packet_sleeps);
+
 static struct mapleq *maple_allocq(struct maple_device *mdev)
 {
        struct mapleq *mq;
 
        mq = kmalloc(sizeof(*mq), GFP_KERNEL);
        if (!mq)
-               return NULL;
+               goto failed_nomem;
 
        mq->dev = mdev;
        mq->recvbufdcsp = kmem_cache_zalloc(maple_queue_cache, GFP_KERNEL);
        mq->recvbuf = (void *) P2SEGADDR(mq->recvbufdcsp);
-       if (!mq->recvbuf) {
-               kfree(mq);
-               return NULL;
-       }
+       if (!mq->recvbuf)
+               goto failed_p2;
+       /*
+        * most devices do not need the mutex - but
+        * anything that injects block reads or writes
+        * will rely on it
+        */
+       mutex_init(&mq->mutex);
 
        return mq;
+
+failed_p2:
+       kfree(mq);
+failed_nomem:
+       return NULL;
 }
 
 static struct maple_device *maple_alloc_dev(int port, int unit)
@@ -178,7 +286,6 @@ static struct maple_device *maple_alloc_dev(int port, int unit)
        }
        mdev->dev.bus = &maple_bus_type;
        mdev->dev.parent = &maple_bus;
-       mdev->function = 0;
        return mdev;
 }
 
@@ -216,7 +323,6 @@ static void maple_build_block(struct mapleq *mq)
        *maple_sendptr++ = PHYSADDR(mq->recvbuf);
        *maple_sendptr++ =
            mq->command | (to << 8) | (from << 16) | (len << 24);
-
        while (len-- > 0)
                *maple_sendptr++ = *lsendbuf++;
 }
@@ -224,22 +330,27 @@ static void maple_build_block(struct mapleq *mq)
 /* build up command queue */
 static void maple_send(void)
 {
-       int i;
-       int maple_packets;
+       int i, maple_packets = 0;
        struct mapleq *mq, *nmq;
 
        if (!list_empty(&maple_sentq))
                return;
-       if (list_empty(&maple_waitq) || !maple_dma_done())
+       mutex_lock(&maple_wlist_lock);
+       if (list_empty(&maple_waitq) || !maple_dma_done()) {
+               mutex_unlock(&maple_wlist_lock);
                return;
-       maple_packets = 0;
-       maple_sendptr = maple_lastptr = maple_sendbuf;
+       }
+       mutex_unlock(&maple_wlist_lock);
+       maple_lastptr = maple_sendbuf;
+       maple_sendptr = maple_sendbuf;
+       mutex_lock(&maple_wlist_lock);
        list_for_each_entry_safe(mq, nmq, &maple_waitq, list) {
                maple_build_block(mq);
                list_move(&mq->list, &maple_sentq);
                if (maple_packets++ > MAPLE_MAXPACKETS)
                        break;
        }
+       mutex_unlock(&maple_wlist_lock);
        if (maple_packets > 0) {
                for (i = 0; i < (1 << MAPLE_DMA_PAGES); i++)
                        dma_cache_sync(0, maple_sendbuf + i * PAGE_SIZE,
@@ -247,7 +358,8 @@ static void maple_send(void)
        }
 }
 
-static int attach_matching_maple_driver(struct device_driver *driver,
+/* check if there is a driver registered likely to match this device */
+static int check_matching_maple_driver(struct device_driver *driver,
                                        void *devptr)
 {
        struct maple_driver *maple_drv;
@@ -255,12 +367,8 @@ static int attach_matching_maple_driver(struct device_driver *driver,
 
        mdev = devptr;
        maple_drv = to_maple_driver(driver);
-       if (mdev->devinfo.function & be32_to_cpu(maple_drv->function)) {
-               if (maple_drv->connect(mdev) == 0) {
-                       mdev->driver = maple_drv;
-                       return 1;
-               }
-       }
+       if (mdev->devinfo.function & cpu_to_be32(maple_drv->function))
+               return 1;
        return 0;
 }
 
@@ -268,11 +376,6 @@ static void maple_detach_driver(struct maple_device *mdev)
 {
        if (!mdev)
                return;
-       if (mdev->driver) {
-               if (mdev->driver->disconnect)
-                       mdev->driver->disconnect(mdev);
-       }
-       mdev->driver = NULL;
        device_unregister(&mdev->dev);
        mdev = NULL;
 }
@@ -328,8 +431,8 @@ static void maple_attach_driver(struct maple_device *mdev)
                        mdev->port, mdev->unit, function);
 
                matched =
-                   bus_for_each_drv(&maple_bus_type, NULL, mdev,
-                                    attach_matching_maple_driver);
+                       bus_for_each_drv(&maple_bus_type, NULL, mdev,
+                               check_matching_maple_driver);
 
                if (matched == 0) {
                        /* Driver does not exist yet */
@@ -373,45 +476,48 @@ static int detach_maple_device(struct device *device, void *portptr)
 
 static int setup_maple_commands(struct device *device, void *ignored)
 {
+       int add;
        struct maple_device *maple_dev = to_maple_dev(device);
 
        if ((maple_dev->interval > 0)
            && time_after(jiffies, maple_dev->when)) {
-               maple_dev->when = jiffies + maple_dev->interval;
-               maple_dev->mq->command = MAPLE_COMMAND_GETCOND;
-               maple_dev->mq->sendbuf = &maple_dev->function;
-               maple_dev->mq->length = 1;
-               maple_add_packet(maple_dev->mq);
-               liststatus++;
+               /* bounce if we cannot lock */
+               add = maple_add_packet(maple_dev,
+                       be32_to_cpu(maple_dev->devinfo.function),
+                       MAPLE_COMMAND_GETCOND, 1, NULL);
+               if (!add)
+                       maple_dev->when = jiffies + maple_dev->interval;
        } else {
-               if (time_after(jiffies, maple_pnp_time)) {
-                       maple_dev->mq->command = MAPLE_COMMAND_DEVINFO;
-                       maple_dev->mq->length = 0;
-                       maple_add_packet(maple_dev->mq);
-                       liststatus++;
-               }
+               if (time_after(jiffies, maple_pnp_time))
+                       /* This will also bounce */
+                       maple_add_packet(maple_dev, 0,
+                               MAPLE_COMMAND_DEVINFO, 0, NULL);
        }
-
        return 0;
 }
 
 /* VBLANK bottom half - implemented via workqueue */
 static void maple_vblank_handler(struct work_struct *work)
 {
-       if (!maple_dma_done())
-               return;
-       if (!list_empty(&maple_sentq))
+       if (!list_empty(&maple_sentq) || !maple_dma_done())
                return;
+
        ctrl_outl(0, MAPLE_ENABLE);
-       liststatus = 0;
+
        bus_for_each_dev(&maple_bus_type, NULL, NULL,
                         setup_maple_commands);
+
        if (time_after(jiffies, maple_pnp_time))
                maple_pnp_time = jiffies + MAPLE_PNP_INTERVAL;
-       if (liststatus && list_empty(&maple_sentq)) {
-               INIT_LIST_HEAD(&maple_sentq);
+
+       mutex_lock(&maple_wlist_lock);
+       if (!list_empty(&maple_waitq) && list_empty(&maple_sentq)) {
+               mutex_unlock(&maple_wlist_lock);
                maple_send();
+       } else {
+               mutex_unlock(&maple_wlist_lock);
        }
+
        maplebus_dma_reset();
 }
 
@@ -422,8 +528,8 @@ static void maple_map_subunits(struct maple_device *mdev, int submask)
        struct maple_device *mdev_add;
        struct maple_device_specify ds;
 
+       ds.port = mdev->port;
        for (k = 0; k < 5; k++) {
-               ds.port = mdev->port;
                ds.unit = k + 1;
                retval =
                    bus_for_each_dev(&maple_bus_type, NULL, &ds,
@@ -437,9 +543,9 @@ static void maple_map_subunits(struct maple_device *mdev, int submask)
                        mdev_add = maple_alloc_dev(mdev->port, k + 1);
                        if (!mdev_add)
                                return;
-                       mdev_add->mq->command = MAPLE_COMMAND_DEVINFO;
-                       mdev_add->mq->length = 0;
-                       maple_add_packet(mdev_add->mq);
+                       maple_add_packet(mdev_add, 0, MAPLE_COMMAND_DEVINFO,
+                               0, NULL);
+                       /* mark that we are checking sub devices */
                        scanning = 1;
                }
                submask = submask >> 1;
@@ -505,6 +611,28 @@ static void maple_response_devinfo(struct maple_device *mdev,
        }
 }
 
+static void maple_port_rescan(void)
+{
+       int i;
+       struct maple_device *mdev;
+
+       fullscan = 1;
+       for (i = 0; i < MAPLE_PORTS; i++) {
+               if (checked[i] == false) {
+                       fullscan = 0;
+                       mdev = baseunits[i];
+                       /*
+                        *  test lock in case scan has failed
+                        *  but device is still locked
+                        */
+                       if (mutex_is_locked(&mdev->mq->mutex))
+                               mutex_unlock(&mdev->mq->mutex);
+                       maple_add_packet(mdev, 0, MAPLE_COMMAND_DEVINFO,
+                               0, NULL);
+               }
+       }
+}
+
 /* maple dma end bottom half - implemented via workqueue */
 static void maple_dma_handler(struct work_struct *work)
 {
@@ -512,7 +640,6 @@ static void maple_dma_handler(struct work_struct *work)
        struct maple_device *dev;
        char *recvbuf;
        enum maple_code code;
-       int i;
 
        if (!maple_dma_done())
                return;
@@ -522,6 +649,10 @@ static void maple_dma_handler(struct work_struct *work)
                        recvbuf = mq->recvbuf;
                        code = recvbuf[0];
                        dev = mq->dev;
+                       kfree(mq->sendbuf);
+                       mutex_unlock(&mq->mutex);
+                       list_del_init(&mq->list);
+
                        switch (code) {
                        case MAPLE_RESPONSE_NONE:
                                maple_response_none(dev, mq);
@@ -558,26 +689,16 @@ static void maple_dma_handler(struct work_struct *work)
                                break;
                        }
                }
-               INIT_LIST_HEAD(&maple_sentq);
+               /* if scanning is 1 then we have subdevices to check */
                if (scanning == 1) {
                        maple_send();
                        scanning = 2;
                } else
                        scanning = 0;
-
-               if (!fullscan) {
-                       fullscan = 1;
-                       for (i = 0; i < MAPLE_PORTS; i++) {
-                               if (checked[i] == false) {
-                                       fullscan = 0;
-                                       dev = baseunits[i];
-                                       dev->mq->command =
-                                               MAPLE_COMMAND_DEVINFO;
-                                       dev->mq->length = 0;
-                                       maple_add_packet(dev->mq);
-                               }
-                       }
-               }
+               /*check if we have actually tested all ports yet */
+               if (!fullscan)
+                       maple_port_rescan();
+               /* mark that we have been through the first scan */
                if (started == 0)
                        started = 1;
        }
@@ -622,16 +743,14 @@ static int maple_get_dma_buffer(void)
 static int match_maple_bus_driver(struct device *devptr,
                                  struct device_driver *drvptr)
 {
-       struct maple_driver *maple_drv;
-       struct maple_device *maple_dev;
+       struct maple_driver *maple_drv = to_maple_driver(drvptr);
+       struct maple_device *maple_dev = to_maple_dev(devptr);
 
-       maple_drv = container_of(drvptr, struct maple_driver, drv);
-       maple_dev = container_of(devptr, struct maple_device, dev);
        /* Trap empty port case */
        if (maple_dev->devinfo.function == 0xFFFFFFFF)
                return 0;
        else if (maple_dev->devinfo.function &
-                be32_to_cpu(maple_drv->function))
+                cpu_to_be32(maple_drv->function))
                return 1;
        return 0;
 }
@@ -713,6 +832,9 @@ static int __init maple_bus_init(void)
        if (!maple_queue_cache)
                goto cleanup_bothirqs;
 
+       INIT_LIST_HEAD(&maple_waitq);
+       INIT_LIST_HEAD(&maple_sentq);
+
        /* setup maple ports */
        for (i = 0; i < MAPLE_PORTS; i++) {
                checked[i] = false;
@@ -723,9 +845,7 @@ static int __init maple_bus_init(void)
                                maple_free_dev(mdev[i]);
                        goto cleanup_cache;
                }
-               mdev[i]->mq->command = MAPLE_COMMAND_DEVINFO;
-               mdev[i]->mq->length = 0;
-               maple_add_packet(mdev[i]->mq);
+               maple_add_packet(mdev[i], 0, MAPLE_COMMAND_DEVINFO, 0, NULL);
                subdevice_map[i] = 0;
        }
 
index 2303521..b9d0efb 100644 (file)
@@ -149,6 +149,12 @@ config SPI_OMAP24XX
          SPI master controller for OMAP24xx/OMAP34xx Multichannel SPI
          (McSPI) modules.
 
+config SPI_ORION
+       tristate "Orion SPI master (EXPERIMENTAL)"
+       depends on PLAT_ORION && EXPERIMENTAL
+       help
+         This enables using the SPI master controller on the Orion chips.
+
 config SPI_PXA2XX
        tristate "PXA2xx SSP SPI master"
        depends on ARCH_PXA && EXPERIMENTAL
index 7fca043..ccf18de 100644 (file)
@@ -21,6 +21,7 @@ obj-$(CONFIG_SPI_LM70_LLP)            += spi_lm70llp.o
 obj-$(CONFIG_SPI_PXA2XX)               += pxa2xx_spi.o
 obj-$(CONFIG_SPI_OMAP_UWIRE)           += omap_uwire.o
 obj-$(CONFIG_SPI_OMAP24XX)             += omap2_mcspi.o
+obj-$(CONFIG_SPI_ORION)                        += orion_spi.o
 obj-$(CONFIG_SPI_MPC52xx_PSC)          += mpc52xx_psc_spi.o
 obj-$(CONFIG_SPI_MPC83xx)              += spi_mpc83xx.o
 obj-$(CONFIG_SPI_S3C24XX_GPIO)         += spi_s3c24xx_gpio.o
index 0c71656..95190c6 100644 (file)
@@ -184,7 +184,8 @@ static void atmel_spi_next_xfer(struct spi_master *master,
 {
        struct atmel_spi        *as = spi_master_get_devdata(master);
        struct spi_transfer     *xfer;
-       u32                     len, remaining, total;
+       u32                     len, remaining;
+       u32                     ieval;
        dma_addr_t              tx_dma, rx_dma;
 
        if (!as->current_transfer)
@@ -197,6 +198,8 @@ static void atmel_spi_next_xfer(struct spi_master *master,
                xfer = NULL;
 
        if (xfer) {
+               spi_writel(as, PTCR, SPI_BIT(RXTDIS) | SPI_BIT(TXTDIS));
+
                len = xfer->len;
                atmel_spi_next_xfer_data(master, xfer, &tx_dma, &rx_dma, &len);
                remaining = xfer->len - len;
@@ -234,6 +237,8 @@ static void atmel_spi_next_xfer(struct spi_master *master,
        as->next_transfer = xfer;
 
        if (xfer) {
+               u32     total;
+
                total = len;
                atmel_spi_next_xfer_data(master, xfer, &tx_dma, &rx_dma, &len);
                as->next_remaining_bytes = total - len;
@@ -250,9 +255,11 @@ static void atmel_spi_next_xfer(struct spi_master *master,
                        "  next xfer %p: len %u tx %p/%08x rx %p/%08x\n",
                        xfer, xfer->len, xfer->tx_buf, xfer->tx_dma,
                        xfer->rx_buf, xfer->rx_dma);
+               ieval = SPI_BIT(ENDRX) | SPI_BIT(OVRES);
        } else {
                spi_writel(as, RNCR, 0);
                spi_writel(as, TNCR, 0);
+               ieval = SPI_BIT(RXBUFF) | SPI_BIT(ENDRX) | SPI_BIT(OVRES);
        }
 
        /* REVISIT: We're waiting for ENDRX before we start the next
@@ -265,7 +272,7 @@ static void atmel_spi_next_xfer(struct spi_master *master,
         *
         * It should be doable, though. Just not now...
         */
-       spi_writel(as, IER, SPI_BIT(ENDRX) | SPI_BIT(OVRES));
+       spi_writel(as, IER, ieval);
        spi_writel(as, PTCR, SPI_BIT(TXTEN) | SPI_BIT(RXTEN));
 }
 
@@ -396,7 +403,7 @@ atmel_spi_interrupt(int irq, void *dev_id)
 
                ret = IRQ_HANDLED;
 
-               spi_writel(as, IDR, (SPI_BIT(ENDTX) | SPI_BIT(ENDRX)
+               spi_writel(as, IDR, (SPI_BIT(RXBUFF) | SPI_BIT(ENDRX)
                                     | SPI_BIT(OVRES)));
 
                /*
@@ -418,7 +425,7 @@ atmel_spi_interrupt(int irq, void *dev_id)
                if (xfer->delay_usecs)
                        udelay(xfer->delay_usecs);
 
-               dev_warn(master->dev.parent, "fifo overrun (%u/%u remaining)\n",
+               dev_warn(master->dev.parent, "overrun (%u/%u remaining)\n",
                         spi_readl(as, TCR), spi_readl(as, RCR));
 
                /*
@@ -442,7 +449,7 @@ atmel_spi_interrupt(int irq, void *dev_id)
                spi_readl(as, SR);
 
                atmel_spi_msg_done(master, as, msg, -EIO, 0);
-       } else if (pending & SPI_BIT(ENDRX)) {
+       } else if (pending & (SPI_BIT(RXBUFF) | SPI_BIT(ENDRX))) {
                ret = IRQ_HANDLED;
 
                spi_writel(as, IDR, pending);
diff --git a/drivers/spi/orion_spi.c b/drivers/spi/orion_spi.c
new file mode 100644 (file)
index 0000000..c4eaacd
--- /dev/null
@@ -0,0 +1,574 @@
+/*
+ * orion_spi.c -- Marvell Orion SPI controller driver
+ *
+ * Author: Shadi Ammouri <shadi@marvell.com>
+ * Copyright (C) 2007-2008 Marvell Ltd.
+ *
+ * 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/interrupt.h>
+#include <linux/delay.h>
+#include <linux/platform_device.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/orion_spi.h>
+#include <asm/unaligned.h>
+
+#define DRIVER_NAME                    "orion_spi"
+
+#define ORION_NUM_CHIPSELECTS          1 /* only one slave is supported*/
+#define ORION_SPI_WAIT_RDY_MAX_LOOP    2000 /* in usec */
+
+#define ORION_SPI_IF_CTRL_REG          0x00
+#define ORION_SPI_IF_CONFIG_REG                0x04
+#define ORION_SPI_DATA_OUT_REG         0x08
+#define ORION_SPI_DATA_IN_REG          0x0c
+#define ORION_SPI_INT_CAUSE_REG                0x10
+
+#define ORION_SPI_IF_8_16_BIT_MODE     (1 << 5)
+#define ORION_SPI_CLK_PRESCALE_MASK    0x1F
+
+struct orion_spi {
+       struct work_struct      work;
+
+       /* Lock access to transfer list.        */
+       spinlock_t              lock;
+
+       struct list_head        msg_queue;
+       struct spi_master       *master;
+       void __iomem            *base;
+       unsigned int            max_speed;
+       unsigned int            min_speed;
+       struct orion_spi_info   *spi_info;
+};
+
+static struct workqueue_struct *orion_spi_wq;
+
+static inline void __iomem *spi_reg(struct orion_spi *orion_spi, u32 reg)
+{
+       return orion_spi->base + reg;
+}
+
+static inline void
+orion_spi_setbits(struct orion_spi *orion_spi, u32 reg, u32 mask)
+{
+       void __iomem *reg_addr = spi_reg(orion_spi, reg);
+       u32 val;
+
+       val = readl(reg_addr);
+       val |= mask;
+       writel(val, reg_addr);
+}
+
+static inline void
+orion_spi_clrbits(struct orion_spi *orion_spi, u32 reg, u32 mask)
+{
+       void __iomem *reg_addr = spi_reg(orion_spi, reg);
+       u32 val;
+
+       val = readl(reg_addr);
+       val &= ~mask;
+       writel(val, reg_addr);
+}
+
+static int orion_spi_set_transfer_size(struct orion_spi *orion_spi, int size)
+{
+       if (size == 16) {
+               orion_spi_setbits(orion_spi, ORION_SPI_IF_CONFIG_REG,
+                                 ORION_SPI_IF_8_16_BIT_MODE);
+       } else if (size == 8) {
+               orion_spi_clrbits(orion_spi, ORION_SPI_IF_CONFIG_REG,
+                                 ORION_SPI_IF_8_16_BIT_MODE);
+       } else {
+               pr_debug("Bad bits per word value %d (only 8 or 16 are "
+                        "allowed).\n", size);
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
+static int orion_spi_baudrate_set(struct spi_device *spi, unsigned int speed)
+{
+       u32 tclk_hz;
+       u32 rate;
+       u32 prescale;
+       u32 reg;
+       struct orion_spi *orion_spi;
+
+       orion_spi = spi_master_get_devdata(spi->master);
+
+       tclk_hz = orion_spi->spi_info->tclk;
+
+       /*
+        * the supported rates are: 4,6,8...30
+        * round up as we look for equal or less speed
+        */
+       rate = DIV_ROUND_UP(tclk_hz, speed);
+       rate = roundup(rate, 2);
+
+       /* check if requested speed is too small */
+       if (rate > 30)
+               return -EINVAL;
+
+       if (rate < 4)
+               rate = 4;
+
+       /* Convert the rate to SPI clock divisor value. */
+       prescale = 0x10 + rate/2;
+
+       reg = readl(spi_reg(orion_spi, ORION_SPI_IF_CONFIG_REG));
+       reg = ((reg & ~ORION_SPI_CLK_PRESCALE_MASK) | prescale);
+       writel(reg, spi_reg(orion_spi, ORION_SPI_IF_CONFIG_REG));
+
+       return 0;
+}
+
+/*
+ * called only when no transfer is active on the bus
+ */
+static int
+orion_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
+{
+       struct orion_spi *orion_spi;
+       unsigned int speed = spi->max_speed_hz;
+       unsigned int bits_per_word = spi->bits_per_word;
+       int     rc;
+
+       orion_spi = spi_master_get_devdata(spi->master);
+
+       if ((t != NULL) && t->speed_hz)
+               speed = t->speed_hz;
+
+       if ((t != NULL) && t->bits_per_word)
+               bits_per_word = t->bits_per_word;
+
+       rc = orion_spi_baudrate_set(spi, speed);
+       if (rc)
+               return rc;
+
+       return orion_spi_set_transfer_size(orion_spi, bits_per_word);
+}
+
+static void orion_spi_set_cs(struct orion_spi *orion_spi, int enable)
+{
+       if (enable)
+               orion_spi_setbits(orion_spi, ORION_SPI_IF_CTRL_REG, 0x1);
+       else
+               orion_spi_clrbits(orion_spi, ORION_SPI_IF_CTRL_REG, 0x1);
+}
+
+static inline int orion_spi_wait_till_ready(struct orion_spi *orion_spi)
+{
+       int i;
+
+       for (i = 0; i < ORION_SPI_WAIT_RDY_MAX_LOOP; i++) {
+               if (readl(spi_reg(orion_spi, ORION_SPI_INT_CAUSE_REG)))
+                       return 1;
+               else
+                       udelay(1);
+       }
+
+       return -1;
+}
+
+static inline int
+orion_spi_write_read_8bit(struct spi_device *spi,
+                         const u8 **tx_buf, u8 **rx_buf)
+{
+       void __iomem *tx_reg, *rx_reg, *int_reg;
+       struct orion_spi *orion_spi;
+
+       orion_spi = spi_master_get_devdata(spi->master);
+       tx_reg = spi_reg(orion_spi, ORION_SPI_DATA_OUT_REG);
+       rx_reg = spi_reg(orion_spi, ORION_SPI_DATA_IN_REG);
+       int_reg = spi_reg(orion_spi, ORION_SPI_INT_CAUSE_REG);
+
+       /* clear the interrupt cause register */
+       writel(0x0, int_reg);
+
+       if (tx_buf && *tx_buf)
+               writel(*(*tx_buf)++, tx_reg);
+       else
+               writel(0, tx_reg);
+
+       if (orion_spi_wait_till_ready(orion_spi) < 0) {
+               dev_err(&spi->dev, "TXS timed out\n");
+               return -1;
+       }
+
+       if (rx_buf && *rx_buf)
+               *(*rx_buf)++ = readl(rx_reg);
+
+       return 1;
+}
+
+static inline int
+orion_spi_write_read_16bit(struct spi_device *spi,
+                          const u16 **tx_buf, u16 **rx_buf)
+{
+       void __iomem *tx_reg, *rx_reg, *int_reg;
+       struct orion_spi *orion_spi;
+
+       orion_spi = spi_master_get_devdata(spi->master);
+       tx_reg = spi_reg(orion_spi, ORION_SPI_DATA_OUT_REG);
+       rx_reg = spi_reg(orion_spi, ORION_SPI_DATA_IN_REG);
+       int_reg = spi_reg(orion_spi, ORION_SPI_INT_CAUSE_REG);
+
+       /* clear the interrupt cause register */
+       writel(0x0, int_reg);
+
+       if (tx_buf && *tx_buf)
+               writel(__cpu_to_le16(get_unaligned((*tx_buf)++)), tx_reg);
+       else
+               writel(0, tx_reg);
+
+       if (orion_spi_wait_till_ready(orion_spi) < 0) {
+               dev_err(&spi->dev, "TXS timed out\n");
+               return -1;
+       }
+
+       if (rx_buf && *rx_buf)
+               put_unaligned(__le16_to_cpu(readl(rx_reg)), (*rx_buf)++);
+
+       return 1;
+}
+
+static unsigned int
+orion_spi_write_read(struct spi_device *spi, struct spi_transfer *xfer)
+{
+       struct orion_spi *orion_spi;
+       unsigned int count;
+       int word_len;
+
+       orion_spi = spi_master_get_devdata(spi->master);
+       word_len = spi->bits_per_word;
+       count = xfer->len;
+
+       if (word_len == 8) {
+               const u8 *tx = xfer->tx_buf;
+               u8 *rx = xfer->rx_buf;
+
+               do {
+                       if (orion_spi_write_read_8bit(spi, &tx, &rx) < 0)
+                               goto out;
+                       count--;
+               } while (count);
+       } else if (word_len == 16) {
+               const u16 *tx = xfer->tx_buf;
+               u16 *rx = xfer->rx_buf;
+
+               do {
+                       if (orion_spi_write_read_16bit(spi, &tx, &rx) < 0)
+                               goto out;
+                       count -= 2;
+               } while (count);
+       }
+
+out:
+       return xfer->len - count;
+}
+
+
+static void orion_spi_work(struct work_struct *work)
+{
+       struct orion_spi *orion_spi =
+               container_of(work, struct orion_spi, work);
+
+       spin_lock_irq(&orion_spi->lock);
+       while (!list_empty(&orion_spi->msg_queue)) {
+               struct spi_message *m;
+               struct spi_device *spi;
+               struct spi_transfer *t = NULL;
+               int par_override = 0;
+               int status = 0;
+               int cs_active = 0;
+
+               m = container_of(orion_spi->msg_queue.next, struct spi_message,
+                                queue);
+
+               list_del_init(&m->queue);
+               spin_unlock_irq(&orion_spi->lock);
+
+               spi = m->spi;
+
+               /* Load defaults */
+               status = orion_spi_setup_transfer(spi, NULL);
+
+               if (status < 0)
+                       goto msg_done;
+
+               list_for_each_entry(t, &m->transfers, transfer_list) {
+                       if (par_override || t->speed_hz || t->bits_per_word) {
+                               par_override = 1;
+                               status = orion_spi_setup_transfer(spi, t);
+                               if (status < 0)
+                                       break;
+                               if (!t->speed_hz && !t->bits_per_word)
+                                       par_override = 0;
+                       }
+
+                       if (!cs_active) {
+                               orion_spi_set_cs(orion_spi, 1);
+                               cs_active = 1;
+                       }
+
+                       if (t->len)
+                               m->actual_length +=
+                                       orion_spi_write_read(spi, t);
+
+                       if (t->delay_usecs)
+                               udelay(t->delay_usecs);
+
+                       if (t->cs_change) {
+                               orion_spi_set_cs(orion_spi, 0);
+                               cs_active = 0;
+                       }
+               }
+
+msg_done:
+               if (cs_active)
+                       orion_spi_set_cs(orion_spi, 0);
+
+               m->status = status;
+               m->complete(m->context);
+
+               spin_lock_irq(&orion_spi->lock);
+       }
+
+       spin_unlock_irq(&orion_spi->lock);
+}
+
+static int __init orion_spi_reset(struct orion_spi *orion_spi)
+{
+       /* Verify that the CS is deasserted */
+       orion_spi_set_cs(orion_spi, 0);
+
+       return 0;
+}
+
+static int orion_spi_setup(struct spi_device *spi)
+{
+       struct orion_spi *orion_spi;
+
+       orion_spi = spi_master_get_devdata(spi->master);
+
+       if (spi->mode) {
+               dev_err(&spi->dev, "setup: unsupported mode bits %x\n",
+                       spi->mode);
+               return -EINVAL;
+       }
+
+       if (spi->bits_per_word == 0)
+               spi->bits_per_word = 8;
+
+       if ((spi->max_speed_hz == 0)
+                       || (spi->max_speed_hz > orion_spi->max_speed))
+               spi->max_speed_hz = orion_spi->max_speed;
+
+       if (spi->max_speed_hz < orion_spi->min_speed) {
+               dev_err(&spi->dev, "setup: requested speed too low %d Hz\n",
+                       spi->max_speed_hz);
+               return -EINVAL;
+       }
+
+       /*
+        * baudrate & width will be set orion_spi_setup_transfer
+        */
+       return 0;
+}
+
+static int orion_spi_transfer(struct spi_device *spi, struct spi_message *m)
+{
+       struct orion_spi *orion_spi;
+       struct spi_transfer *t = NULL;
+       unsigned long flags;
+
+       m->actual_length = 0;
+       m->status = 0;
+
+       /* reject invalid messages and transfers */
+       if (list_empty(&m->transfers) || !m->complete)
+               return -EINVAL;
+
+       orion_spi = spi_master_get_devdata(spi->master);
+
+       list_for_each_entry(t, &m->transfers, transfer_list) {
+               unsigned int bits_per_word = spi->bits_per_word;
+
+               if (t->tx_buf == NULL && t->rx_buf == NULL && t->len) {
+                       dev_err(&spi->dev,
+                               "message rejected : "
+                               "invalid transfer data buffers\n");
+                       goto msg_rejected;
+               }
+
+               if ((t != NULL) && t->bits_per_word)
+                       bits_per_word = t->bits_per_word;
+
+               if ((bits_per_word != 8) && (bits_per_word != 16)) {
+                       dev_err(&spi->dev,
+                               "message rejected : "
+                               "invalid transfer bits_per_word (%d bits)\n",
+                               bits_per_word);
+                       goto msg_rejected;
+               }
+               /*make sure buffer length is even when working in 16 bit mode*/
+               if ((t != NULL) && (t->bits_per_word == 16) && (t->len & 1)) {
+                       dev_err(&spi->dev,
+                               "message rejected : "
+                               "odd data length (%d) while in 16 bit mode\n",
+                               t->len);
+                       goto msg_rejected;
+               }
+
+               if (t->speed_hz < orion_spi->min_speed) {
+                       dev_err(&spi->dev,
+                               "message rejected : "
+                               "device min speed (%d Hz) exceeds "
+                               "required transfer speed (%d Hz)\n",
+                               orion_spi->min_speed, t->speed_hz);
+                       goto msg_rejected;
+               }
+       }
+
+
+       spin_lock_irqsave(&orion_spi->lock, flags);
+       list_add_tail(&m->queue, &orion_spi->msg_queue);
+       queue_work(orion_spi_wq, &orion_spi->work);
+       spin_unlock_irqrestore(&orion_spi->lock, flags);
+
+       return 0;
+msg_rejected:
+       /* Message rejected and not queued */
+       m->status = -EINVAL;
+       if (m->complete)
+               m->complete(m->context);
+       return -EINVAL;
+}
+
+static int __init orion_spi_probe(struct platform_device *pdev)
+{
+       struct spi_master *master;
+       struct orion_spi *spi;
+       struct resource *r;
+       struct orion_spi_info *spi_info;
+       int status = 0;
+
+       spi_info = pdev->dev.platform_data;
+
+       master = spi_alloc_master(&pdev->dev, sizeof *spi);
+       if (master == NULL) {
+               dev_dbg(&pdev->dev, "master allocation failed\n");
+               return -ENOMEM;
+       }
+
+       if (pdev->id != -1)
+               master->bus_num = pdev->id;
+
+       master->setup = orion_spi_setup;
+       master->transfer = orion_spi_transfer;
+       master->num_chipselect = ORION_NUM_CHIPSELECTS;
+
+       dev_set_drvdata(&pdev->dev, master);
+
+       spi = spi_master_get_devdata(master);
+       spi->master = master;
+       spi->spi_info = spi_info;
+
+       spi->max_speed = DIV_ROUND_UP(spi_info->tclk, 4);
+       spi->min_speed = DIV_ROUND_UP(spi_info->tclk, 30);
+
+       r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (r == NULL) {
+               status = -ENODEV;
+               goto out;
+       }
+
+       if (!request_mem_region(r->start, (r->end - r->start) + 1,
+                               pdev->dev.bus_id)) {
+               status = -EBUSY;
+               goto out;
+       }
+       spi->base = ioremap(r->start, SZ_1K);
+
+       INIT_WORK(&spi->work, orion_spi_work);
+
+       spin_lock_init(&spi->lock);
+       INIT_LIST_HEAD(&spi->msg_queue);
+
+       if (orion_spi_reset(spi) < 0)
+               goto out_rel_mem;
+
+       status = spi_register_master(master);
+       if (status < 0)
+               goto out_rel_mem;
+
+       return status;
+
+out_rel_mem:
+       release_mem_region(r->start, (r->end - r->start) + 1);
+
+out:
+       spi_master_put(master);
+       return status;
+}
+
+
+static int __exit orion_spi_remove(struct platform_device *pdev)
+{
+       struct spi_master *master;
+       struct orion_spi *spi;
+       struct resource *r;
+
+       master = dev_get_drvdata(&pdev->dev);
+       spi = spi_master_get_devdata(master);
+
+       cancel_work_sync(&spi->work);
+
+       r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       release_mem_region(r->start, (r->end - r->start) + 1);
+
+       spi_unregister_master(master);
+
+       return 0;
+}
+
+MODULE_ALIAS("platform:" DRIVER_NAME);
+
+static struct platform_driver orion_spi_driver = {
+       .driver = {
+               .name   = DRIVER_NAME,
+               .owner  = THIS_MODULE,
+       },
+       .remove         = __exit_p(orion_spi_remove),
+};
+
+static int __init orion_spi_init(void)
+{
+       orion_spi_wq = create_singlethread_workqueue(
+                               orion_spi_driver.driver.name);
+       if (orion_spi_wq == NULL)
+               return -ENOMEM;
+
+       return platform_driver_probe(&orion_spi_driver, orion_spi_probe);
+}
+module_init(orion_spi_init);
+
+static void __exit orion_spi_exit(void)
+{
+       flush_workqueue(orion_spi_wq);
+       platform_driver_unregister(&orion_spi_driver);
+
+       destroy_workqueue(orion_spi_wq);
+}
+module_exit(orion_spi_exit);
+
+MODULE_DESCRIPTION("Orion SPI driver");
+MODULE_AUTHOR("Shadi Ammouri <shadi@marvell.com>");
+MODULE_LICENSE("GPL");
index 1c643c9..21661c7 100644 (file)
@@ -236,6 +236,19 @@ static irqreturn_t s3c24xx_spi_irq(int irq, void *dev)
        return IRQ_HANDLED;
 }
 
+static void s3c24xx_spi_initialsetup(struct s3c24xx_spi *hw)
+{
+       /* for the moment, permanently enable the clock */
+
+       clk_enable(hw->clk);
+
+       /* program defaults into the registers */
+
+       writeb(0xff, hw->regs + S3C2410_SPPRE);
+       writeb(SPPIN_DEFAULT, hw->regs + S3C2410_SPPIN);
+       writeb(SPCON_DEFAULT, hw->regs + S3C2410_SPCON);
+}
+
 static int __init s3c24xx_spi_probe(struct platform_device *pdev)
 {
        struct s3c2410_spi_info *pdata;
@@ -327,15 +340,7 @@ static int __init s3c24xx_spi_probe(struct platform_device *pdev)
                goto err_no_clk;
        }
 
-       /* for the moment, permanently enable the clock */
-
-       clk_enable(hw->clk);
-
-       /* program defaults into the registers */
-
-       writeb(0xff, hw->regs + S3C2410_SPPRE);
-       writeb(SPPIN_DEFAULT, hw->regs + S3C2410_SPPIN);
-       writeb(SPCON_DEFAULT, hw->regs + S3C2410_SPCON);
+       s3c24xx_spi_initialsetup(hw);
 
        /* setup any gpio we can */
 
@@ -415,7 +420,7 @@ static int s3c24xx_spi_resume(struct platform_device *pdev)
 {
        struct s3c24xx_spi *hw = platform_get_drvdata(pdev);
 
-       clk_enable(hw->clk);
+       s3c24xx_spi_initialsetup(hw);
        return 0;
 }
 
index 2fcc06e..586d6f1 100644 (file)
@@ -389,7 +389,6 @@ int usb_sg_init(struct usb_sg_request *io, struct usb_device *dev,
        if (io->entries <= 0)
                return io->entries;
 
-       io->count = io->entries;
        io->urbs = kmalloc(io->entries * sizeof *io->urbs, mem_flags);
        if (!io->urbs)
                goto nomem;
@@ -458,6 +457,7 @@ int usb_sg_init(struct usb_sg_request *io, struct usb_device *dev,
        io->urbs[--i]->transfer_flags &= ~URB_NO_INTERRUPT;
 
        /* transaction state */
+       io->count = io->entries;
        io->status = 0;
        io->bytes = 0;
        init_completion(&io->complete);
index 8da7535..77b44fb 100644 (file)
@@ -1593,7 +1593,7 @@ static int __init m66592_probe(struct platform_device *pdev)
 
        m66592->gadget.ops = &m66592_gadget_ops;
        device_initialize(&m66592->gadget.dev);
-       dev_set_name(&m66592->gadget, "gadget");
+       dev_set_name(&m66592->gadget.dev, "gadget");
        m66592->gadget.is_dualspeed = 1;
        m66592->gadget.dev.parent = &pdev->dev;
        m66592->gadget.dev.dma_mask = pdev->dev.dma_mask;
index 7a4d456..73ac726 100644 (file)
@@ -26,8 +26,6 @@
  * (http://www.freecom.de/)
  */
 
-#include <linux/hdreg.h>
-
 #include <scsi/scsi.h>
 #include <scsi/scsi_cmnd.h>
 
index 0ebc1bf..a6b5529 100644 (file)
@@ -118,7 +118,6 @@ obj-$(CONFIG_FB_PS3)                  += ps3fb.o
 obj-$(CONFIG_FB_SM501)            += sm501fb.o
 obj-$(CONFIG_FB_XILINX)           += xilinxfb.o
 obj-$(CONFIG_FB_SH_MOBILE_LCDC)          += sh_mobile_lcdcfb.o
-obj-$(CONFIG_FB_SH7343VOU)       += sh7343_voufb.o
 obj-$(CONFIG_FB_OMAP)             += omap/
 obj-$(CONFIG_XEN_FBDEV_FRONTEND)  += xen-fbfront.o
 obj-$(CONFIG_FB_CARMINE)          += carminefb.o
index 5001bd4..4bd569e 100644 (file)
@@ -958,20 +958,20 @@ static int __devinit ark_pci_probe(struct pci_dev *dev, const struct pci_device_
        /* Prepare PCI device */
        rc = pci_enable_device(dev);
        if (rc < 0) {
-               dev_err(info->dev, "cannot enable PCI device\n");
+               dev_err(info->device, "cannot enable PCI device\n");
                goto err_enable_device;
        }
 
        rc = pci_request_regions(dev, "arkfb");
        if (rc < 0) {
-               dev_err(info->dev, "cannot reserve framebuffer region\n");
+               dev_err(info->device, "cannot reserve framebuffer region\n");
                goto err_request_regions;
        }
 
        par->dac = ics5342_init(ark_dac_read_regs, ark_dac_write_regs, info);
        if (! par->dac) {
                rc = -ENOMEM;
-               dev_err(info->dev, "RAMDAC initialization failed\n");
+               dev_err(info->device, "RAMDAC initialization failed\n");
                goto err_dac;
        }
 
@@ -982,7 +982,7 @@ static int __devinit ark_pci_probe(struct pci_dev *dev, const struct pci_device_
        info->screen_base = pci_iomap(dev, 0, 0);
        if (! info->screen_base) {
                rc = -ENOMEM;
-               dev_err(info->dev, "iomap for framebuffer failed\n");
+               dev_err(info->device, "iomap for framebuffer failed\n");
                goto err_iomap;
        }
 
@@ -1004,19 +1004,19 @@ static int __devinit ark_pci_probe(struct pci_dev *dev, const struct pci_device_
        rc = fb_find_mode(&(info->var), info, mode_option, NULL, 0, NULL, 8);
        if (! ((rc == 1) || (rc == 2))) {
                rc = -EINVAL;
-               dev_err(info->dev, "mode %s not found\n", mode_option);
+               dev_err(info->device, "mode %s not found\n", mode_option);
                goto err_find_mode;
        }
 
        rc = fb_alloc_cmap(&info->cmap, 256, 0);
        if (rc < 0) {
-               dev_err(info->dev, "cannot allocate colormap\n");
+               dev_err(info->device, "cannot allocate colormap\n");
                goto err_alloc_cmap;
        }
 
        rc = register_framebuffer(info);
        if (rc < 0) {
-               dev_err(info->dev, "cannot register framebugger\n");
+               dev_err(info->device, "cannot register framebugger\n");
                goto err_reg_fb;
        }
 
@@ -1090,7 +1090,7 @@ static int ark_pci_suspend (struct pci_dev* dev, pm_message_t state)
        struct fb_info *info = pci_get_drvdata(dev);
        struct arkfb_info *par = info->par;
 
-       dev_info(info->dev, "suspend\n");
+       dev_info(info->device, "suspend\n");
 
        acquire_console_sem();
        mutex_lock(&(par->open_lock));
@@ -1121,16 +1121,13 @@ static int ark_pci_resume (struct pci_dev* dev)
        struct fb_info *info = pci_get_drvdata(dev);
        struct arkfb_info *par = info->par;
 
-       dev_info(info->dev, "resume\n");
+       dev_info(info->device, "resume\n");
 
        acquire_console_sem();
        mutex_lock(&(par->open_lock));
 
-       if (par->ref_count == 0) {
-               mutex_unlock(&(par->open_lock));
-               release_console_sem();
-               return 0;
-       }
+       if (par->ref_count == 0)
+               goto fail;
 
        pci_set_power_state(dev, PCI_D0);
        pci_restore_state(dev);
@@ -1143,8 +1140,8 @@ static int ark_pci_resume (struct pci_dev* dev)
        arkfb_set_par(info);
        fb_set_suspend(info, 0);
 
-       mutex_unlock(&(par->open_lock));
 fail:
+       mutex_unlock(&(par->open_lock));
        release_console_sem();
        return 0;
 }
index 620ba81..cc6b470 100644 (file)
@@ -244,7 +244,7 @@ static int atyfb_sync(struct fb_info *info);
      */
 
 static int aty_init(struct fb_info *info);
-static void aty_resume_chip(struct fb_info *info);
+
 #ifdef CONFIG_ATARI
 static int store_video_par(char *videopar, unsigned char m64_num);
 #endif
@@ -2023,6 +2023,20 @@ static int atyfb_pci_suspend(struct pci_dev *pdev, pm_message_t state)
        return 0;
 }
 
+static void aty_resume_chip(struct fb_info *info)
+{
+       struct atyfb_par *par = info->par;
+
+       aty_st_le32(MEM_CNTL, par->mem_cntl, par);
+
+       if (par->pll_ops->resume_pll)
+               par->pll_ops->resume_pll(info, &par->pll);
+
+       if (par->aux_start)
+               aty_st_le32(BUS_CNTL,
+                       aty_ld_le32(BUS_CNTL, par) | BUS_APER_REG_DIS, par);
+}
+
 static int atyfb_pci_resume(struct pci_dev *pdev)
 {
        struct fb_info *info = pci_get_drvdata(pdev);
@@ -2659,19 +2673,6 @@ aty_init_exit:
        return ret;
 }
 
-static void aty_resume_chip(struct fb_info *info)
-{
-       struct atyfb_par *par = info->par;
-
-       aty_st_le32(MEM_CNTL, par->mem_cntl, par);
-
-       if (par->pll_ops->resume_pll)
-               par->pll_ops->resume_pll(info, &par->pll);
-
-       if (par->aux_start)
-               aty_st_le32(BUS_CNTL, aty_ld_le32(BUS_CNTL, par) | BUS_APER_REG_DIS, par);
-}
-
 #ifdef CONFIG_ATARI
 static int __devinit store_video_par(char *video_str, unsigned char m64_num)
 {
index 3ca27cb..4d13f68 100644 (file)
@@ -241,8 +241,8 @@ void radeonfb_engine_reset(struct radeonfb_info *rinfo)
        INREG(HOST_PATH_CNTL);
        OUTREG(HOST_PATH_CNTL, host_path_cntl);
 
-       if (rinfo->family != CHIP_FAMILY_R300 ||
-           rinfo->family != CHIP_FAMILY_R350 ||
+       if (rinfo->family != CHIP_FAMILY_R300 &&
+           rinfo->family != CHIP_FAMILY_R350 &&
            rinfo->family != CHIP_FAMILY_RV350)
                OUTREG(RBBM_SOFT_RESET, rbbm_soft_reset);
 
index f9e7c29..8c8fa35 100644 (file)
@@ -69,7 +69,8 @@ static int radeon_setup_i2c_bus(struct radeon_i2c_chan *chan, const char *name)
 {
        int rc;
 
-       strcpy(chan->adapter.name, name);
+       snprintf(chan->adapter.name, sizeof(chan->adapter.name),
+                "radeonfb %s", name);
        chan->adapter.owner             = THIS_MODULE;
        chan->adapter.id                = I2C_HW_B_RADEON;
        chan->adapter.algo_data         = &chan->algo;
index fbea2bd..6fa0b9d 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/fb.h>
 #include <linux/backlight.h>
 
-#include <asm/cpu/dac.h>
+#include <cpu/dac.h>
 #include <asm/hp6xx.h>
 #include <asm/hd64461.h>
 
index 72d44db..738694d 100644 (file)
@@ -92,7 +92,7 @@ static int __devinit platform_lcd_probe(struct platform_device *pdev)
 
        plcd->us = dev;
        plcd->pdata = pdata;
-       plcd->lcd = lcd_device_register("platform-lcd", dev,
+       plcd->lcd = lcd_device_register(dev_name(dev), dev,
                                        plcd, &platform_lcd_ops);
        if (IS_ERR(plcd->lcd)) {
                dev_err(dev, "cannot register lcd device\n");
@@ -101,6 +101,8 @@ static int __devinit platform_lcd_probe(struct platform_device *pdev)
        }
 
        platform_set_drvdata(pdev, plcd);
+       platform_lcd_set_power(plcd->lcd, FB_BLANK_NORMAL);
+
        return 0;
 
  err_mem:
index 6338d0e..ea07258 100644 (file)
@@ -68,8 +68,10 @@ static int pwm_backlight_probe(struct platform_device *pdev)
        struct pwm_bl_data *pb;
        int ret;
 
-       if (!data)
+       if (!data) {
+               dev_err(&pdev->dev, "failed to find platform data\n");
                return -EINVAL;
+       }
 
        if (data->init) {
                ret = data->init(&pdev->dev);
@@ -79,6 +81,7 @@ static int pwm_backlight_probe(struct platform_device *pdev)
 
        pb = kzalloc(sizeof(*pb), GFP_KERNEL);
        if (!pb) {
+               dev_err(&pdev->dev, "no memory for state\n");
                ret = -ENOMEM;
                goto err_alloc;
        }
@@ -91,7 +94,8 @@ static int pwm_backlight_probe(struct platform_device *pdev)
                dev_err(&pdev->dev, "unable to request PWM for backlight\n");
                ret = PTR_ERR(pb->pwm);
                goto err_pwm;
-       }
+       } else
+               dev_dbg(&pdev->dev, "got pwm for backlight\n");
 
        bl = backlight_device_register(pdev->name, &pdev->dev,
                        pb, &pwm_backlight_ops);
@@ -183,3 +187,5 @@ module_exit(pwm_backlight_exit);
 
 MODULE_DESCRIPTION("PWM based Backlight Driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:pwm-backlight");
+
diff --git a/drivers/video/console/.gitignore b/drivers/video/console/.gitignore
new file mode 100644 (file)
index 0000000..0c258b4
--- /dev/null
@@ -0,0 +1,2 @@
+# conmakehash generated file
+promcon_tbl.c
index 3ccfa76..3385993 100644 (file)
@@ -1311,6 +1311,9 @@ static void fbcon_clear(struct vc_data *vc, int sy, int sx, int height,
        if (!height || !width)
                return;
 
+       if (sy < vc->vc_top && vc->vc_top == logo_lines)
+               vc->vc_top = 0;
+
        /* Split blits that cross physical y_wrap boundary */
 
        y_break = p->vrows - p->yscroll;
index d7822af..ef7870f 100644 (file)
@@ -24,6 +24,7 @@
 #include <asm/hardware.h>
 #include <asm/parisc-device.h>
 #include <asm/cacheflush.h>
+#include <asm/grfioctl.h>
 
 #include "../sticore.h"
 
@@ -725,6 +726,7 @@ static int __devinit sti_read_rom(int wordmode, struct sti_struct *sti,
 {
        struct sti_cooked_rom *cooked;
        struct sti_rom *raw = NULL;
+       unsigned long revno;
 
        cooked = kmalloc(sizeof *cooked, GFP_KERNEL);
        if (!cooked)
@@ -767,9 +769,35 @@ static int __devinit sti_read_rom(int wordmode, struct sti_struct *sti,
        sti->graphics_id[1] = raw->graphics_id[1];
        
        sti_dump_rom(raw);
-       
+
+       /* check if the ROM routines in this card are compatible */
+       if (wordmode || sti->graphics_id[1] != 0x09A02587)
+               goto ok;
+
+       revno = (raw->revno[0] << 8) | raw->revno[1];
+
+       switch (sti->graphics_id[0]) {
+       case S9000_ID_HCRX:
+               /* HyperA or HyperB ? */
+               if (revno == 0x8408 || revno == 0x840b)
+                       goto msg_not_supported;
+               break;
+       case CRT_ID_THUNDER:
+               if (revno == 0x8509)
+                       goto msg_not_supported;
+               break;
+       case CRT_ID_THUNDER2:
+               if (revno == 0x850c)
+                       goto msg_not_supported;
+       }
+ok:
        return 1;
 
+msg_not_supported:
+       printk(KERN_ERR "Sorry, this GSC/STI card is not yet supported.\n");
+       printk(KERN_ERR "Please see http://parisc-linux.org/faq/"
+                       "graphics-howto.html for more info.\n");
+       /* fall through */
 out_err:
        kfree(raw);
        kfree(cooked);
index 9cd36c2..bd320a2 100644 (file)
@@ -1649,8 +1649,10 @@ static int __init fsl_diu_init(void)
        }
 
        prop = of_get_property(np, "d-cache-size", NULL);
-       if (prop == NULL)
+       if (prop == NULL) {
+               of_node_put(np);
                return -ENODEV;
+       }
 
        /* Freescale PLRU requires 13/8 times the cache size to do a proper
           displacement flush
@@ -1659,8 +1661,10 @@ static int __init fsl_diu_init(void)
        coherence_data_size /= 8;
 
        prop = of_get_property(np, "d-cache-line-size", NULL);
-       if (prop == NULL)
+       if (prop == NULL) {
+               of_node_put(np);
                return -ENODEV;
+       }
        d_cache_line_size = *prop;
 
        of_node_put(np);
index 2e552d5..f89c3cc 100644 (file)
@@ -87,6 +87,8 @@ static int gbe_revision;
 static int ypan, ywrap;
 
 static uint32_t pseudo_palette[16];
+static uint32_t gbe_cmap[256];
+static int gbe_turned_on; /* 0 turned off, 1 turned on */
 
 static char *mode_option __initdata = NULL;
 
@@ -208,6 +210,8 @@ void gbe_turn_off(void)
        int i;
        unsigned int val, x, y, vpixen_off;
 
+       gbe_turned_on = 0;
+
        /* check if pixel counter is on */
        val = gbe->vt_xy;
        if (GET_GBE_FIELD(VT_XY, FREEZE, val) == 1)
@@ -371,6 +375,22 @@ static void gbe_turn_on(void)
        }
        if (i == 10000)
                printk(KERN_ERR "gbefb: turn on DMA timed out\n");
+
+       gbe_turned_on = 1;
+}
+
+static void gbe_loadcmap(void)
+{
+       int i, j;
+
+       for (i = 0; i < 256; i++) {
+               for (j = 0; j < 1000 && gbe->cm_fifo >= 63; j++)
+                       udelay(10);
+               if (j == 1000)
+                       printk(KERN_ERR "gbefb: cmap FIFO timeout\n");
+
+               gbe->cmap[i] = gbe_cmap[i];
+       }
 }
 
 /*
@@ -382,6 +402,7 @@ static int gbefb_blank(int blank, struct fb_info *info)
        switch (blank) {
        case FB_BLANK_UNBLANK:          /* unblank */
                gbe_turn_on();
+               gbe_loadcmap();
                break;
 
        case FB_BLANK_NORMAL:           /* blank */
@@ -796,16 +817,10 @@ static int gbefb_set_par(struct fb_info *info)
                gbe->gmap[i] = (i << 24) | (i << 16) | (i << 8);
 
        /* Initialize the color map */
-       for (i = 0; i < 256; i++) {
-               int j;
-
-               for (j = 0; j < 1000 && gbe->cm_fifo >= 63; j++)
-                       udelay(10);
-               if (j == 1000)
-                       printk(KERN_ERR "gbefb: cmap FIFO timeout\n");
+       for (i = 0; i < 256; i++)
+               gbe_cmap[i] = (i << 8) | (i << 16) | (i << 24);
 
-               gbe->cmap[i] = (i << 8) | (i << 16) | (i << 24);
-       }
+       gbe_loadcmap();
 
        return 0;
 }
@@ -855,14 +870,17 @@ static int gbefb_setcolreg(unsigned regno, unsigned red, unsigned green,
        blue >>= 8;
 
        if (info->var.bits_per_pixel <= 8) {
-               /* wait for the color map FIFO to have a free entry */
-               for (i = 0; i < 1000 && gbe->cm_fifo >= 63; i++)
-                       udelay(10);
-               if (i == 1000) {
-                       printk(KERN_ERR "gbefb: cmap FIFO timeout\n");
-                       return 1;
+               gbe_cmap[regno] = (red << 24) | (green << 16) | (blue << 8);
+               if (gbe_turned_on) {
+                       /* wait for the color map FIFO to have a free entry */
+                       for (i = 0; i < 1000 && gbe->cm_fifo >= 63; i++)
+                               udelay(10);
+                       if (i == 1000) {
+                               printk(KERN_ERR "gbefb: cmap FIFO timeout\n");
+                               return 1;
+                       }
+                       gbe->cmap[regno] = gbe_cmap[regno];
                }
-               gbe->cmap[regno] = (red << 24) | (green << 16) | (blue << 8);
        } else if (regno < 16) {
                switch (info->var.bits_per_pixel) {
                case 15:
index 392a8be..e6467cf 100644 (file)
@@ -27,7 +27,7 @@
 #include <asm/pgtable.h>
 #include <asm/io.h>
 #include <asm/hd64461.h>
-#include <asm/cpu/dac.h>
+#include <cpu/dac.h>
 
 #define        WIDTH 640
 
index 54e82f3..c021362 100644 (file)
@@ -2536,7 +2536,7 @@ module_param(fh, int, 0);
 MODULE_PARM_DESC(fh, "Startup horizontal frequency, 0-999kHz, 1000-INF Hz");
 module_param(fv, int, 0);
 MODULE_PARM_DESC(fv, "Startup vertical frequency, 0-INF Hz\n"
-"You should specify \"fv:max_monitor_vsync,fh:max_monitor_hsync,maxclk:max_monitor_dotclock\"\n");
+"You should specify \"fv:max_monitor_vsync,fh:max_monitor_hsync,maxclk:max_monitor_dotclock\"");
 module_param(grayscale, int, 0);
 MODULE_PARM_DESC(grayscale, "Sets display into grayscale. Works perfectly with paletized videomode (4, 8bpp), some limitations apply to 16, 24 and 32bpp videomodes (default=nograyscale)");
 module_param(cross4MB, int, 0);
index 8c863a7..0a0fd48 100644 (file)
 
 #ifdef CONFIG_SH_DREAMCAST
 #include <asm/machvec.h>
-#include <asm/mach/sysasic.h>
+#include <mach-dreamcast/mach/sysasic.h>
 #endif
 
 #ifdef CONFIG_SH_DMA
 #include <linux/pagemap.h>
-#include <asm/mach/dma.h>
+#include <mach/dma.h>
 #include <asm/dma.h>
 #endif
 
 #ifdef CONFIG_SH_STORE_QUEUES
 #include <linux/uaccess.h>
-#include <asm/cpu/sq.h>
+#include <cpu/sq.h>
 #endif
 
 #ifndef PCI_DEVICE_ID_NEC_NEON250
index 2972f11..8361bd0 100644 (file)
@@ -903,13 +903,13 @@ static int __devinit s3_pci_probe(struct pci_dev *dev, const struct pci_device_i
        /* Prepare PCI device */
        rc = pci_enable_device(dev);
        if (rc < 0) {
-               dev_err(info->dev, "cannot enable PCI device\n");
+               dev_err(info->device, "cannot enable PCI device\n");
                goto err_enable_device;
        }
 
        rc = pci_request_regions(dev, "s3fb");
        if (rc < 0) {
-               dev_err(info->dev, "cannot reserve framebuffer region\n");
+               dev_err(info->device, "cannot reserve framebuffer region\n");
                goto err_request_regions;
        }
 
@@ -921,7 +921,7 @@ static int __devinit s3_pci_probe(struct pci_dev *dev, const struct pci_device_i
        info->screen_base = pci_iomap(dev, 0, 0);
        if (! info->screen_base) {
                rc = -ENOMEM;
-               dev_err(info->dev, "iomap for framebuffer failed\n");
+               dev_err(info->device, "iomap for framebuffer failed\n");
                goto err_iomap;
        }
 
@@ -965,19 +965,19 @@ static int __devinit s3_pci_probe(struct pci_dev *dev, const struct pci_device_i
        rc = fb_find_mode(&(info->var), info, mode_option, NULL, 0, NULL, 8);
        if (! ((rc == 1) || (rc == 2))) {
                rc = -EINVAL;
-               dev_err(info->dev, "mode %s not found\n", mode_option);
+               dev_err(info->device, "mode %s not found\n", mode_option);
                goto err_find_mode;
        }
 
        rc = fb_alloc_cmap(&info->cmap, 256, 0);
        if (rc < 0) {
-               dev_err(info->dev, "cannot allocate colormap\n");
+               dev_err(info->device, "cannot allocate colormap\n");
                goto err_alloc_cmap;
        }
 
        rc = register_framebuffer(info);
        if (rc < 0) {
-               dev_err(info->dev, "cannot register framebuffer\n");
+               dev_err(info->device, "cannot register framebuffer\n");
                goto err_reg_fb;
        }
 
@@ -1053,7 +1053,7 @@ static int s3_pci_suspend(struct pci_dev* dev, pm_message_t state)
        struct fb_info *info = pci_get_drvdata(dev);
        struct s3fb_info *par = info->par;
 
-       dev_info(info->dev, "suspend\n");
+       dev_info(info->device, "suspend\n");
 
        acquire_console_sem();
        mutex_lock(&(par->open_lock));
@@ -1085,7 +1085,7 @@ static int s3_pci_resume(struct pci_dev* dev)
        struct s3fb_info *par = info->par;
        int err;
 
-       dev_info(info->dev, "resume\n");
+       dev_info(info->device, "resume\n");
 
        acquire_console_sem();
        mutex_lock(&(par->open_lock));
@@ -1102,7 +1102,7 @@ static int s3_pci_resume(struct pci_dev* dev)
        if (err) {
                mutex_unlock(&(par->open_lock));
                release_console_sem();
-               dev_err(info->dev, "error %d enabling device for resume\n", err);
+               dev_err(info->device, "error %d enabling device for resume\n", err);
                return err;
        }
        pci_set_master(dev);
index 536ab11..34aae7a 100644 (file)
@@ -677,13 +677,13 @@ static int __devinit vt8623_pci_probe(struct pci_dev *dev, const struct pci_devi
 
        rc = pci_enable_device(dev);
        if (rc < 0) {
-               dev_err(info->dev, "cannot enable PCI device\n");
+               dev_err(info->device, "cannot enable PCI device\n");
                goto err_enable_device;
        }
 
        rc = pci_request_regions(dev, "vt8623fb");
        if (rc < 0) {
-               dev_err(info->dev, "cannot reserve framebuffer region\n");
+               dev_err(info->device, "cannot reserve framebuffer region\n");
                goto err_request_regions;
        }
 
@@ -696,14 +696,14 @@ static int __devinit vt8623_pci_probe(struct pci_dev *dev, const struct pci_devi
        info->screen_base = pci_iomap(dev, 0, 0);
        if (! info->screen_base) {
                rc = -ENOMEM;
-               dev_err(info->dev, "iomap for framebuffer failed\n");
+               dev_err(info->device, "iomap for framebuffer failed\n");
                goto err_iomap_1;
        }
 
        par->mmio_base = pci_iomap(dev, 1, 0);
        if (! par->mmio_base) {
                rc = -ENOMEM;
-               dev_err(info->dev, "iomap for MMIO failed\n");
+               dev_err(info->device, "iomap for MMIO failed\n");
                goto err_iomap_2;
        }
 
@@ -714,7 +714,7 @@ static int __devinit vt8623_pci_probe(struct pci_dev *dev, const struct pci_devi
        if ((16 <= memsize1) && (memsize1 <= 64) && (memsize1 == memsize2))
                info->screen_size = memsize1 << 20;
        else {
-               dev_err(info->dev, "memory size detection failed (%x %x), suppose 16 MB\n", memsize1, memsize2);
+               dev_err(info->device, "memory size detection failed (%x %x), suppose 16 MB\n", memsize1, memsize2);
                info->screen_size = 16 << 20;
        }
 
@@ -731,19 +731,19 @@ static int __devinit vt8623_pci_probe(struct pci_dev *dev, const struct pci_devi
        rc = fb_find_mode(&(info->var), info, mode_option, NULL, 0, NULL, 8);
        if (! ((rc == 1) || (rc == 2))) {
                rc = -EINVAL;
-               dev_err(info->dev, "mode %s not found\n", mode_option);
+               dev_err(info->device, "mode %s not found\n", mode_option);
                goto err_find_mode;
        }
 
        rc = fb_alloc_cmap(&info->cmap, 256, 0);
        if (rc < 0) {
-               dev_err(info->dev, "cannot allocate colormap\n");
+               dev_err(info->device, "cannot allocate colormap\n");
                goto err_alloc_cmap;
        }
 
        rc = register_framebuffer(info);
        if (rc < 0) {
-               dev_err(info->dev, "cannot register framebugger\n");
+               dev_err(info->device, "cannot register framebugger\n");
                goto err_reg_fb;
        }
 
@@ -817,7 +817,7 @@ static int vt8623_pci_suspend(struct pci_dev* dev, pm_message_t state)
        struct fb_info *info = pci_get_drvdata(dev);
        struct vt8623fb_info *par = info->par;
 
-       dev_info(info->dev, "suspend\n");
+       dev_info(info->device, "suspend\n");
 
        acquire_console_sem();
        mutex_lock(&(par->open_lock));
@@ -848,16 +848,13 @@ static int vt8623_pci_resume(struct pci_dev* dev)
        struct fb_info *info = pci_get_drvdata(dev);
        struct vt8623fb_info *par = info->par;
 
-       dev_info(info->dev, "resume\n");
+       dev_info(info->device, "resume\n");
 
        acquire_console_sem();
        mutex_lock(&(par->open_lock));
 
-       if (par->ref_count == 0) {
-               mutex_unlock(&(par->open_lock));
-               release_console_sem();
-               return 0;
-       }
+       if (par->ref_count == 0)
+               goto fail;
 
        pci_set_power_state(dev, PCI_D0);
        pci_restore_state(dev);
@@ -870,8 +867,8 @@ static int vt8623_pci_resume(struct pci_dev* dev)
        vt8623fb_set_par(info);
        fb_set_suspend(info, 0);
 
-       mutex_unlock(&(par->open_lock));
 fail:
+       mutex_unlock(&(par->open_lock));
        release_console_sem();
 
        return 0;
index 48399e1..32b9fe1 100644 (file)
@@ -463,7 +463,7 @@ config PC87413_WDT
          module will be called pc87413_wdt.
 
          Most people will say N.
+
 config 60XX_WDT
        tristate "SBC-60XX Watchdog Timer"
        depends on X86
@@ -695,9 +695,17 @@ config 8xx_WDT
        tristate "MPC8xx Watchdog Timer"
        depends on 8xx
 
-config 83xx_WDT
-       tristate "MPC83xx Watchdog Timer"
-       depends on PPC_83xx
+config 8xxx_WDT
+       tristate "MPC8xxx Platform Watchdog Timer"
+       depends on PPC_8xx || PPC_83xx || PPC_86xx
+       help
+         This driver is for a SoC level watchdog that exists on some
+         Freescale PowerPC processors. So far this driver supports:
+         - MPC8xx watchdogs
+         - MPC83xx watchdogs
+         - MPC86xx watchdogs
+
+         For BookE processors (MPC85xx) use the BOOKE_WDT driver instead.
 
 config MV64X60_WDT
        tristate "MV64X60 (Marvell Discovery) Watchdog Timer"
index edd305a..049c918 100644 (file)
@@ -92,7 +92,7 @@ obj-$(CONFIG_SBC_EPX_C3_WATCHDOG) += sbc_epx_c3.o
 
 # MIPS Architecture
 obj-$(CONFIG_INDYDOG) += indydog.o
-obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o
+obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o
 obj-$(CONFIG_WDT_RM9K_GPI) += rm9k_wdt.o
 obj-$(CONFIG_SIBYTE_WDOG) += sb_wdog.o
 obj-$(CONFIG_AR7_WDT) += ar7_wdt.o
@@ -103,7 +103,7 @@ obj-$(CONFIG_TXX9_WDT) += txx9wdt.o
 # POWERPC Architecture
 obj-$(CONFIG_8xx_WDT) += mpc8xx_wdt.o
 obj-$(CONFIG_MPC5200_WDT) += mpc5200_wdt.o
-obj-$(CONFIG_83xx_WDT) += mpc83xx_wdt.o
+obj-$(CONFIG_8xxx_WDT) += mpc8xxx_wdt.o
 obj-$(CONFIG_MV64X60_WDT) += mv64x60_wdt.o
 obj-$(CONFIG_BOOKE_WDT) += booke_wdt.o
 
index 85269c3..6e46a55 100644 (file)
 #include <linux/types.h>               /* For standard types (like size_t) */
 #include <linux/errno.h>               /* For the -ENODEV/... values */
 #include <linux/kernel.h>              /* For printk/panic/... */
-#include <linux/miscdevice.h>          /* For MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR) */
+#include <linux/miscdevice.h>          /* For MODULE_ALIAS_MISCDEV
+                                                       (WATCHDOG_MINOR) */
 #include <linux/watchdog.h>            /* For the watchdog specific items */
 #include <linux/fs.h>                  /* For file operations */
 #include <linux/ioport.h>              /* For io-port access */
 #include <linux/platform_device.h>     /* For platform_driver framework */
 #include <linux/init.h>                        /* For __init/__exit/... */
-
-#include <asm/uaccess.h>               /* For copy_to_user/put_user/... */
-#include <asm/io.h>                    /* For inb/outb/... */
+#include <linux/uaccess.h>             /* For copy_to_user/put_user/... */
+#include <linux/io.h>                  /* For inb/outb/... */
 
 /* Module information */
 #define DRV_NAME "acquirewdt"
 #define PFX DRV_NAME ": "
 #define WATCHDOG_NAME "Acquire WDT"
-#define WATCHDOG_HEARTBEAT 0   /* There is no way to see what the correct time-out period is */
+/* There is no way to see what the correct time-out period is */
+#define WATCHDOG_HEARTBEAT 0
 
 /* internal variables */
-static struct platform_device *acq_platform_device;    /* the watchdog platform device */
+/* the watchdog platform device */
+static struct platform_device *acq_platform_device;
 static unsigned long acq_is_open;
 static char expect_close;
 
 /* module parameters */
-static int wdt_stop = 0x43;    /* You must set this - there is no sane way to probe for this board. */
+/* You must set this - there is no sane way to probe for this board. */
+static int wdt_stop = 0x43;
 module_param(wdt_stop, int, 0);
 MODULE_PARM_DESC(wdt_stop, "Acquire WDT 'stop' io port (default 0x43)");
 
-static int wdt_start = 0x443;  /* You must set this - there is no sane way to probe for this board. */
+/* You must set this - there is no sane way to probe for this board. */
+static int wdt_start = 0x443;
 module_param(wdt_start, int, 0);
 MODULE_PARM_DESC(wdt_start, "Acquire WDT 'start' io port (default 0x443)");
 
 static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout,
+       "Watchdog cannot be stopped once started (default="
+       __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 /*
  *     Watchdog Operations
@@ -112,18 +118,18 @@ static void acq_stop(void)
  *     /dev/watchdog handling
  */
 
-static ssize_t acq_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
+static ssize_t acq_write(struct file *file, const char __user *buf,
+                                               size_t count, loff_t *ppos)
 {
        /* See if we got the magic character 'V' and reload the timer */
-       if(count) {
+       if (count) {
                if (!nowayout) {
                        size_t i;
-
                        /* note: just in case someone wrote the magic character
-                        * five months ago... */
+                          five months ago... */
                        expect_close = 0;
-
-                       /* scan to see whether or not we got the magic character */
+                       /* scan to see whether or not we got the
+                          magic character */
                        for (i = 0; i != count; i++) {
                                char c;
                                if (get_user(c, buf + i))
@@ -132,64 +138,55 @@ static ssize_t acq_write(struct file *file, const char __user *buf, size_t count
                                        expect_close = 42;
                        }
                }
-
-               /* Well, anyhow someone wrote to us, we should return that favour */
+               /* Well, anyhow someone wrote to us, we should
+                               return that favour */
                acq_keepalive();
        }
        return count;
 }
 
-static int acq_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-       unsigned long arg)
+static long acq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
        int options, retval = -EINVAL;
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
-       static struct watchdog_info ident =
-       {
+       static struct watchdog_info ident = {
                .options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
                .firmware_version = 1,
                .identity = WATCHDOG_NAME,
        };
 
-       switch(cmd)
-       {
+       switch (cmd) {
        case WDIOC_GETSUPPORT:
-         return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
+               return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
 
        case WDIOC_GETSTATUS:
        case WDIOC_GETBOOTSTATUS:
-         return put_user(0, p);
-
-       case WDIOC_KEEPALIVE:
-         acq_keepalive();
-         return 0;
-
-       case WDIOC_GETTIMEOUT:
-         return put_user(WATCHDOG_HEARTBEAT, p);
+               return put_user(0, p);
 
        case WDIOC_SETOPTIONS:
        {
-           if (get_user(options, p))
-             return -EFAULT;
-
-           if (options & WDIOS_DISABLECARD)
-           {
-             acq_stop();
-             retval = 0;
-           }
-
-           if (options & WDIOS_ENABLECARD)
-           {
-             acq_keepalive();
-             retval = 0;
-           }
-
-           return retval;
+               if (get_user(options, p))
+                       return -EFAULT;
+               if (options & WDIOS_DISABLECARD) {
+                       acq_stop();
+                       retval = 0;
+               }
+               if (options & WDIOS_ENABLECARD) {
+                       acq_keepalive();
+                       retval = 0;
+               }
+               return retval;
        }
+       case WDIOC_KEEPALIVE:
+               acq_keepalive();
+               return 0;
+
+       case WDIOC_GETTIMEOUT:
+               return put_user(WATCHDOG_HEARTBEAT, p);
 
        default:
-         return -ENOTTY;
+               return -ENOTTY;
        }
 }
 
@@ -211,7 +208,8 @@ static int acq_close(struct inode *inode, struct file *file)
        if (expect_close == 42) {
                acq_stop();
        } else {
-               printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
+               printk(KERN_CRIT PFX
+                       "Unexpected close, not stopping watchdog!\n");
                acq_keepalive();
        }
        clear_bit(0, &acq_is_open);
@@ -227,7 +225,7 @@ static const struct file_operations acq_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = acq_write,
-       .ioctl          = acq_ioctl,
+       .unlocked_ioctl = acq_ioctl,
        .open           = acq_open,
        .release        = acq_close,
 };
@@ -248,32 +246,29 @@ static int __devinit acq_probe(struct platform_device *dev)
 
        if (wdt_stop != wdt_start) {
                if (!request_region(wdt_stop, 1, WATCHDOG_NAME)) {
-                       printk (KERN_ERR PFX "I/O address 0x%04x already in use\n",
-                               wdt_stop);
+                       printk(KERN_ERR PFX
+                           "I/O address 0x%04x already in use\n", wdt_stop);
                        ret = -EIO;
                        goto out;
                }
        }
 
        if (!request_region(wdt_start, 1, WATCHDOG_NAME)) {
-               printk (KERN_ERR PFX "I/O address 0x%04x already in use\n",
+               printk(KERN_ERR PFX "I/O address 0x%04x already in use\n",
                        wdt_start);
                ret = -EIO;
                goto unreg_stop;
        }
-
        ret = misc_register(&acq_miscdev);
        if (ret != 0) {
-               printk (KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
-                       WATCHDOG_MINOR, ret);
+               printk(KERN_ERR PFX
+                       "cannot register miscdev on minor=%d (err=%d)\n",
+                                                       WATCHDOG_MINOR, ret);
                goto unreg_regions;
        }
-
-       printk (KERN_INFO PFX "initialized. (nowayout=%d)\n",
-               nowayout);
+       printk(KERN_INFO PFX "initialized. (nowayout=%d)\n", nowayout);
 
        return 0;
-
 unreg_regions:
        release_region(wdt_start, 1);
 unreg_stop:
@@ -286,9 +281,9 @@ out:
 static int __devexit acq_remove(struct platform_device *dev)
 {
        misc_deregister(&acq_miscdev);
-       release_region(wdt_start,1);
-       if(wdt_stop != wdt_start)
-               release_region(wdt_stop,1);
+       release_region(wdt_start, 1);
+       if (wdt_stop != wdt_start)
+               release_region(wdt_stop, 1);
 
        return 0;
 }
@@ -313,18 +308,19 @@ static int __init acq_init(void)
 {
        int err;
 
-       printk(KERN_INFO "WDT driver for Acquire single board computer initialising.\n");
+       printk(KERN_INFO
+             "WDT driver for Acquire single board computer initialising.\n");
 
        err = platform_driver_register(&acquirewdt_driver);
        if (err)
                return err;
 
-       acq_platform_device = platform_device_register_simple(DRV_NAME, -1, NULL, 0);
+       acq_platform_device = platform_device_register_simple(DRV_NAME,
+                                                               -1, NULL, 0);
        if (IS_ERR(acq_platform_device)) {
                err = PTR_ERR(acq_platform_device);
                goto unreg_platform_driver;
        }
-
        return 0;
 
 unreg_platform_driver:
index 8121cc2..a5110f9 100644 (file)
@@ -37,9 +37,9 @@
 #include <linux/ioport.h>
 #include <linux/platform_device.h>
 #include <linux/init.h>
+#include <linux/io.h>
+#include <linux/uaccess.h>
 
-#include <asm/io.h>
-#include <asm/uaccess.h>
 #include <asm/system.h>
 
 #define DRV_NAME "advantechwdt"
@@ -47,7 +47,8 @@
 #define WATCHDOG_NAME "Advantech WDT"
 #define WATCHDOG_TIMEOUT 60            /* 60 sec default timeout */
 
-static struct platform_device *advwdt_platform_device; /* the watchdog platform device */
+/* the watchdog platform device */
+static struct platform_device *advwdt_platform_device;
 static unsigned long advwdt_is_open;
 static char adv_expect_close;
 
@@ -72,35 +73,35 @@ MODULE_PARM_DESC(wdt_start, "Advantech WDT 'start' io port (default 0x443)");
 
 static int timeout = WATCHDOG_TIMEOUT; /* in seconds */
 module_param(timeout, int, 0);
-MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=63, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ".");
+MODULE_PARM_DESC(timeout,
+       "Watchdog timeout in seconds. 1<= timeout <=63, default="
+               __MODULE_STRING(WATCHDOG_TIMEOUT) ".");
 
 static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout,
+       "Watchdog cannot be stopped once started (default="
+               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 /*
  *     Watchdog Operations
  */
 
-static void
-advwdt_ping(void)
+static void advwdt_ping(void)
 {
        /* Write a watchdog value */
        outb_p(timeout, wdt_start);
 }
 
-static void
-advwdt_disable(void)
+static void advwdt_disable(void)
 {
        inb_p(wdt_stop);
 }
 
-static int
-advwdt_set_heartbeat(int t)
+static int advwdt_set_heartbeat(int t)
 {
-       if ((t < 1) || (t > 63))
+       if (t < 1 || t > 63)
                return -EINVAL;
-
        timeout = t;
        return 0;
 }
@@ -109,8 +110,8 @@ advwdt_set_heartbeat(int t)
  *     /dev/watchdog handling
  */
 
-static ssize_t
-advwdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
+static ssize_t advwdt_write(struct file *file, const char __user *buf,
+                                               size_t count, loff_t *ppos)
 {
        if (count) {
                if (!nowayout) {
@@ -120,7 +121,7 @@ advwdt_write(struct file *file, const char __user *buf, size_t count, loff_t *pp
 
                        for (i = 0; i != count; i++) {
                                char c;
-                               if (get_user(c, buf+i))
+                               if (get_user(c, buf + i))
                                        return -EFAULT;
                                if (c == 'V')
                                        adv_expect_close = 42;
@@ -131,9 +132,7 @@ advwdt_write(struct file *file, const char __user *buf, size_t count, loff_t *pp
        return count;
 }
 
-static int
-advwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-         unsigned long arg)
+static long advwdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
        int new_timeout;
        void __user *argp = (void __user *)arg;
@@ -146,57 +145,50 @@ advwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
 
        switch (cmd) {
        case WDIOC_GETSUPPORT:
-         if (copy_to_user(argp, &ident, sizeof(ident)))
-           return -EFAULT;
-         break;
+               if (copy_to_user(argp, &ident, sizeof(ident)))
+                       return -EFAULT;
+               break;
 
        case WDIOC_GETSTATUS:
        case WDIOC_GETBOOTSTATUS:
-         return put_user(0, p);
-
-       case WDIOC_KEEPALIVE:
-         advwdt_ping();
-         break;
-
-       case WDIOC_SETTIMEOUT:
-         if (get_user(new_timeout, p))
-                 return -EFAULT;
-         if (advwdt_set_heartbeat(new_timeout))
-                 return -EINVAL;
-         advwdt_ping();
-         /* Fall */
-
-       case WDIOC_GETTIMEOUT:
-         return put_user(timeout, p);
+               return put_user(0, p);
 
        case WDIOC_SETOPTIONS:
        {
-         int options, retval = -EINVAL;
-
-         if (get_user(options, p))
-           return -EFAULT;
-
-         if (options & WDIOS_DISABLECARD) {
-           advwdt_disable();
-           retval = 0;
-         }
+               int options, retval = -EINVAL;
 
-         if (options & WDIOS_ENABLECARD) {
-           advwdt_ping();
-           retval = 0;
-         }
-
-         return retval;
+               if (get_user(options, p))
+                       return -EFAULT;
+               if (options & WDIOS_DISABLECARD) {
+                       advwdt_disable();
+                       retval = 0;
+               }
+               if (options & WDIOS_ENABLECARD) {
+                       advwdt_ping();
+                       retval = 0;
+               }
+               return retval;
        }
+       case WDIOC_KEEPALIVE:
+               advwdt_ping();
+               break;
 
+       case WDIOC_SETTIMEOUT:
+               if (get_user(new_timeout, p))
+                       return -EFAULT;
+               if (advwdt_set_heartbeat(new_timeout))
+                       return -EINVAL;
+               advwdt_ping();
+               /* Fall */
+       case WDIOC_GETTIMEOUT:
+               return put_user(timeout, p);
        default:
-         return -ENOTTY;
+               return -ENOTTY;
        }
        return 0;
 }
 
-static int
-advwdt_open(struct inode *inode, struct file *file)
+static int advwdt_open(struct inode *inode, struct file *file)
 {
        if (test_and_set_bit(0, &advwdt_is_open))
                return -EBUSY;
@@ -208,13 +200,13 @@ advwdt_open(struct inode *inode, struct file *file)
        return nonseekable_open(inode, file);
 }
 
-static int
-advwdt_close(struct inode *inode, struct file *file)
+static int advwdt_close(struct inode *inode, struct file *file)
 {
        if (adv_expect_close == 42) {
                advwdt_disable();
        } else {
-               printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
+               printk(KERN_CRIT PFX
+                               "Unexpected close, not stopping watchdog!\n");
                advwdt_ping();
        }
        clear_bit(0, &advwdt_is_open);
@@ -230,7 +222,7 @@ static const struct file_operations advwdt_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = advwdt_write,
-       .ioctl          = advwdt_ioctl,
+       .unlocked_ioctl = advwdt_ioctl,
        .open           = advwdt_open,
        .release        = advwdt_close,
 };
@@ -245,23 +237,24 @@ static struct miscdevice advwdt_miscdev = {
  *     Init & exit routines
  */
 
-static int __devinit
-advwdt_probe(struct platform_device *dev)
+static int __devinit advwdt_probe(struct platform_device *dev)
 {
        int ret;
 
        if (wdt_stop != wdt_start) {
                if (!request_region(wdt_stop, 1, WATCHDOG_NAME)) {
-                       printk (KERN_ERR PFX "I/O address 0x%04x already in use\n",
-                               wdt_stop);
+                       printk(KERN_ERR PFX
+                               "I/O address 0x%04x already in use\n",
+                                                               wdt_stop);
                        ret = -EIO;
                        goto out;
                }
        }
 
        if (!request_region(wdt_start, 1, WATCHDOG_NAME)) {
-               printk (KERN_ERR PFX "I/O address 0x%04x already in use\n",
-                       wdt_start);
+               printk(KERN_ERR PFX
+                               "I/O address 0x%04x already in use\n",
+                                                               wdt_start);
                ret = -EIO;
                goto unreg_stop;
        }
@@ -269,20 +262,19 @@ advwdt_probe(struct platform_device *dev)
        /* Check that the heartbeat value is within it's range ; if not reset to the default */
        if (advwdt_set_heartbeat(timeout)) {
                advwdt_set_heartbeat(WATCHDOG_TIMEOUT);
-               printk (KERN_INFO PFX "timeout value must be 1<=x<=63, using %d\n",
-                       timeout);
+               printk(KERN_INFO PFX
+                       "timeout value must be 1<=x<=63, using %d\n", timeout);
        }
 
        ret = misc_register(&advwdt_miscdev);
        if (ret != 0) {
-               printk (KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
-                       WATCHDOG_MINOR, ret);
+               printk(KERN_ERR PFX
+                       "cannot register miscdev on minor=%d (err=%d)\n",
+                                                       WATCHDOG_MINOR, ret);
                goto unreg_regions;
        }
-
-       printk (KERN_INFO PFX "initialized. timeout=%d sec (nowayout=%d)\n",
+       printk(KERN_INFO PFX "initialized. timeout=%d sec (nowayout=%d)\n",
                timeout, nowayout);
-
 out:
        return ret;
 unreg_regions:
@@ -293,19 +285,17 @@ unreg_stop:
        goto out;
 }
 
-static int __devexit
-advwdt_remove(struct platform_device *dev)
+static int __devexit advwdt_remove(struct platform_device *dev)
 {
        misc_deregister(&advwdt_miscdev);
-       release_region(wdt_start,1);
-       if(wdt_stop != wdt_start)
-               release_region(wdt_stop,1);
+       release_region(wdt_start, 1);
+       if (wdt_stop != wdt_start)
+               release_region(wdt_stop, 1);
 
        return 0;
 }
 
-static void
-advwdt_shutdown(struct platform_device *dev)
+static void advwdt_shutdown(struct platform_device *dev)
 {
        /* Turn the WDT off if we have a soft shutdown */
        advwdt_disable();
@@ -321,18 +311,19 @@ static struct platform_driver advwdt_driver = {
        },
 };
 
-static int __init
-advwdt_init(void)
+static int __init advwdt_init(void)
 {
        int err;
 
-       printk(KERN_INFO "WDT driver for Advantech single board computer initialising.\n");
+       printk(KERN_INFO
+            "WDT driver for Advantech single board computer initialising.\n");
 
        err = platform_driver_register(&advwdt_driver);
        if (err)
                return err;
 
-       advwdt_platform_device = platform_device_register_simple(DRV_NAME, -1, NULL, 0);
+       advwdt_platform_device = platform_device_register_simple(DRV_NAME,
+                                                               -1, NULL, 0);
        if (IS_ERR(advwdt_platform_device)) {
                err = PTR_ERR(advwdt_platform_device);
                goto unreg_platform_driver;
@@ -345,8 +336,7 @@ unreg_platform_driver:
        return err;
 }
 
-static void __exit
-advwdt_exit(void)
+static void __exit advwdt_exit(void)
 {
        platform_device_unregister(advwdt_platform_device);
        platform_driver_unregister(&advwdt_driver);
index 2b1fbdb..2a7690e 100644 (file)
@@ -18,9 +18,8 @@
 #include <linux/init.h>
 #include <linux/fs.h>
 #include <linux/pci.h>
-
-#include <asm/uaccess.h>
-#include <asm/io.h>
+#include <linux/uaccess.h>
+#include <linux/io.h>
 
 #define WATCHDOG_NAME "ALi_M1535"
 #define PFX WATCHDOG_NAME ": "
 static unsigned long ali_is_open;
 static char ali_expect_release;
 static struct pci_dev *ali_pci;
-static u32 ali_timeout_bits;   /* stores the computed timeout */
+static u32 ali_timeout_bits;           /* stores the computed timeout */
 static DEFINE_SPINLOCK(ali_lock);      /* Guards the hardware */
 
 /* module parameters */
 static int timeout = WATCHDOG_TIMEOUT;
 module_param(timeout, int, 0);
-MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (0<timeout<18000, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
+MODULE_PARM_DESC(timeout,
+               "Watchdog timeout in seconds. (0 < timeout < 18000, default="
+                               __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
 
 static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout,
+               "Watchdog cannot be stopped once started (default="
+                               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 /*
  *     ali_start       -       start watchdog countdown
@@ -103,15 +106,16 @@ static void ali_keepalive(void)
 
 static int ali_settimer(int t)
 {
-       if(t < 0)
+       if (t < 0)
                return -EINVAL;
-       else if(t < 60)
+       else if (t < 60)
                ali_timeout_bits = t|(1<<6);
-       else if(t < 3600)
+       else if (t < 3600)
                ali_timeout_bits = (t/60)|(1<<7);
-       else if(t < 18000)
+       else if (t < 18000)
                ali_timeout_bits = (t/300)|(1<<6)|(1<<7);
-       else return -EINVAL;
+       else
+               return -EINVAL;
 
        timeout = t;
        return 0;
@@ -134,21 +138,22 @@ static int ali_settimer(int t)
  */
 
 static ssize_t ali_write(struct file *file, const char __user *data,
-                             size_t len, loff_t * ppos)
+                             size_t len, loff_t *ppos)
 {
        /* See if we got the magic character 'V' and reload the timer */
        if (len) {
                if (!nowayout) {
                        size_t i;
 
-                       /* note: just in case someone wrote the magic character
-                        * five months ago... */
+                       /* note: just in case someone wrote the
+                          magic character five months ago... */
                        ali_expect_release = 0;
 
-                       /* scan to see whether or not we got the magic character */
+                       /* scan to see whether or not we got
+                          the magic character */
                        for (i = 0; i != len; i++) {
                                char c;
-                               if(get_user(c, data+i))
+                               if (get_user(c, data + i))
                                        return -EFAULT;
                                if (c == 'V')
                                        ali_expect_release = 42;
@@ -163,7 +168,6 @@ static ssize_t ali_write(struct file *file, const char __user *data,
 
 /*
  *     ali_ioctl       -       handle watchdog ioctls
- *     @inode: VFS inode
  *     @file: VFS file pointer
  *     @cmd: ioctl number
  *     @arg: arguments to the ioctl
@@ -172,8 +176,7 @@ static ssize_t ali_write(struct file *file, const char __user *data,
  *     we want an extension to enable irq ack monitoring and the like
  */
 
-static int ali_ioctl(struct inode *inode, struct file *file,
-                         unsigned int cmd, unsigned long arg)
+static long ali_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
@@ -186,57 +189,45 @@ static int ali_ioctl(struct inode *inode, struct file *file,
        };
 
        switch (cmd) {
-               case WDIOC_GETSUPPORT:
-                       return copy_to_user(argp, &ident,
-                               sizeof (ident)) ? -EFAULT : 0;
-
-               case WDIOC_GETSTATUS:
-               case WDIOC_GETBOOTSTATUS:
-                       return put_user(0, p);
-
-               case WDIOC_KEEPALIVE:
-                       ali_keepalive();
-                       return 0;
-
-               case WDIOC_SETOPTIONS:
-               {
-                       int new_options, retval = -EINVAL;
-
-                       if (get_user (new_options, p))
-                               return -EFAULT;
-
-                       if (new_options & WDIOS_DISABLECARD) {
-                               ali_stop();
-                               retval = 0;
-                       }
-
-                       if (new_options & WDIOS_ENABLECARD) {
-                               ali_start();
-                               retval = 0;
-                       }
-
-                       return retval;
+       case WDIOC_GETSUPPORT:
+               return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
+
+       case WDIOC_GETSTATUS:
+       case WDIOC_GETBOOTSTATUS:
+               return put_user(0, p);
+       case WDIOC_SETOPTIONS:
+       {
+               int new_options, retval = -EINVAL;
+
+               if (get_user(new_options, p))
+                       return -EFAULT;
+               if (new_options & WDIOS_DISABLECARD) {
+                       ali_stop();
+                       retval = 0;
                }
-
-               case WDIOC_SETTIMEOUT:
-               {
-                       int new_timeout;
-
-                       if (get_user(new_timeout, p))
-                               return -EFAULT;
-
-                       if (ali_settimer(new_timeout))
-                           return -EINVAL;
-
-                       ali_keepalive();
-                       /* Fall */
+               if (new_options & WDIOS_ENABLECARD) {
+                       ali_start();
+                       retval = 0;
                }
-
-               case WDIOC_GETTIMEOUT:
-                       return put_user(timeout, p);
-
-               default:
-                       return -ENOTTY;
+               return retval;
+       }
+       case WDIOC_KEEPALIVE:
+               ali_keepalive();
+               return 0;
+       case WDIOC_SETTIMEOUT:
+       {
+               int new_timeout;
+               if (get_user(new_timeout, p))
+                       return -EFAULT;
+               if (ali_settimer(new_timeout))
+                       return -EINVAL;
+               ali_keepalive();
+               /* Fall */
+       }
+       case WDIOC_GETTIMEOUT:
+               return put_user(timeout, p);
+       default:
+               return -ENOTTY;
        }
 }
 
@@ -274,10 +265,11 @@ static int ali_release(struct inode *inode, struct file *file)
        /*
         *      Shut off the timer.
         */
-       if (ali_expect_release == 42) {
+       if (ali_expect_release == 42)
                ali_stop();
-       } else {
-               printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
+       else {
+               printk(KERN_CRIT PFX
+                               "Unexpected close, not stopping watchdog!\n");
                ali_keepalive();
        }
        clear_bit(0, &ali_is_open);
@@ -292,13 +284,11 @@ static int ali_release(struct inode *inode, struct file *file)
  */
 
 
-static int ali_notify_sys(struct notifier_block *this, unsigned long code, void *unused)
+static int ali_notify_sys(struct notifier_block *this,
+                                       unsigned long code, void *unused)
 {
-       if (code==SYS_DOWN || code==SYS_HALT) {
-               /* Turn the WDT off */
-               ali_stop();
-       }
-
+       if (code == SYS_DOWN || code == SYS_HALT)
+               ali_stop();             /* Turn the WDT off */
        return NOTIFY_DONE;
 }
 
@@ -340,10 +330,10 @@ static int __init ali_find_watchdog(void)
 
        /* Check for the a 7101 PMU */
        pdev = pci_get_device(PCI_VENDOR_ID_AL, 0x7101, NULL);
-       if(pdev == NULL)
+       if (pdev == NULL)
                return -ENODEV;
 
-       if(pci_enable_device(pdev)) {
+       if (pci_enable_device(pdev)) {
                pci_dev_put(pdev);
                return -EIO;
        }
@@ -355,9 +345,12 @@ static int __init ali_find_watchdog(void)
         */
        pci_read_config_dword(pdev, 0xCC, &wdog);
 
-       wdog &= ~0x3F;          /* Timer bits */
-       wdog &= ~((1<<27)|(1<<26)|(1<<25)|(1<<24));     /* Issued events */
-       wdog &= ~((1<<16)|(1<<13)|(1<<12)|(1<<11)|(1<<10)|(1<<9));      /* No monitor bits */
+       /* Timer bits */
+       wdog &= ~0x3F;
+       /* Issued events */
+       wdog &= ~((1<<27)|(1<<26)|(1<<25)|(1<<24));
+       /* No monitor bits */
+       wdog &= ~((1<<16)|(1<<13)|(1<<12)|(1<<11)|(1<<10)|(1<<9));
 
        pci_write_config_dword(pdev, 0xCC, wdog);
 
@@ -369,12 +362,12 @@ static int __init ali_find_watchdog(void)
  */
 
 static const struct file_operations ali_fops = {
-       .owner        THIS_MODULE,
-       .llseek =       no_llseek,
-       .write        ali_write,
-       .ioctl =        ali_ioctl,
-       .open =         ali_open,
-       .release =      ali_release,
+       .owner          =       THIS_MODULE,
+       .llseek         =       no_llseek,
+       .write          =       ali_write,
+       .unlocked_ioctl =       ali_ioctl,
+       .open           =       ali_open,
+       .release        =       ali_release,
 };
 
 static struct miscdevice ali_miscdev = {
@@ -399,15 +392,16 @@ static int __init watchdog_init(void)
        int ret;
 
        /* Check whether or not the hardware watchdog is there */
-       if (ali_find_watchdog() != 0) {
+       if (ali_find_watchdog() != 0)
                return -ENODEV;
-       }
 
-       /* Check that the timeout value is within it's range ; if not reset to the default */
+       /* Check that the timeout value is within it's range;
+          if not reset to the default */
        if (timeout < 1 || timeout >= 18000) {
                timeout = WATCHDOG_TIMEOUT;
-               printk(KERN_INFO PFX "timeout value must be 0<timeout<18000, using %d\n",
-                       timeout);
+               printk(KERN_INFO PFX
+                    "timeout value must be 0 < timeout < 18000, using %d\n",
+                                                       timeout);
        }
 
        /* Calculate the watchdog's timeout */
@@ -415,15 +409,16 @@ static int __init watchdog_init(void)
 
        ret = register_reboot_notifier(&ali_notifier);
        if (ret != 0) {
-               printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
-                       ret);
+               printk(KERN_ERR PFX
+                       "cannot register reboot notifier (err=%d)\n", ret);
                goto out;
        }
 
        ret = misc_register(&ali_miscdev);
        if (ret != 0) {
-               printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
-                       WATCHDOG_MINOR, ret);
+               printk(KERN_ERR PFX
+                       "cannot register miscdev on minor=%d (err=%d)\n",
+                                               WATCHDOG_MINOR, ret);
                goto unreg_reboot;
        }
 
index 238273c..a045ef8 100644 (file)
@@ -31,9 +31,9 @@
 #include <linux/init.h>
 #include <linux/fs.h>
 #include <linux/pci.h>
+#include <linux/io.h>
+#include <linux/uaccess.h>
 
-#include <asm/io.h>
-#include <asm/uaccess.h>
 #include <asm/system.h>
 
 #define OUR_NAME "alim7101_wdt"
  */
 
 #define WATCHDOG_TIMEOUT 30            /* 30 sec default timeout */
-static int timeout = WATCHDOG_TIMEOUT; /* in seconds, will be multiplied by HZ to get seconds to wait for a ping */
+/* in seconds, will be multiplied by HZ to get seconds to wait for a ping */
+static int timeout = WATCHDOG_TIMEOUT;
 module_param(timeout, int, 0);
-MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (1<=timeout<=3600, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
+MODULE_PARM_DESC(timeout,
+               "Watchdog timeout in seconds. (1<=timeout<=3600, default="
+                               __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
 
-static int use_gpio = 0; /* Use the pic (for a1d revision alim7101) */
+static int use_gpio; /* Use the pic (for a1d revision alim7101) */
 module_param(use_gpio, int, 0);
-MODULE_PARM_DESC(use_gpio, "Use the gpio watchdog.  (required by old cobalt boards)");
+MODULE_PARM_DESC(use_gpio,
+               "Use the gpio watchdog (required by old cobalt boards).");
 
 static void wdt_timer_ping(unsigned long);
 static DEFINE_TIMER(timer, wdt_timer_ping, 0, 1);
@@ -77,8 +81,9 @@ static struct pci_dev *alim7101_pmu;
 
 static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
-                __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout,
+               "Watchdog cannot be stopped once started (default="
+                               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 /*
  *     Whack the dog
@@ -89,23 +94,26 @@ static void wdt_timer_ping(unsigned long data)
        /* If we got a heartbeat pulse within the WDT_US_INTERVAL
         * we agree to ping the WDT
         */
-       char    tmp;
+       char tmp;
 
-       if(time_before(jiffies, next_heartbeat))
-       {
+       if (time_before(jiffies, next_heartbeat)) {
                /* Ping the WDT (this is actually a disarm/arm sequence) */
                pci_read_config_byte(alim7101_pmu, 0x92, &tmp);
-               pci_write_config_byte(alim7101_pmu, ALI_7101_WDT, (tmp & ~ALI_WDT_ARM));
-               pci_write_config_byte(alim7101_pmu, ALI_7101_WDT, (tmp | ALI_WDT_ARM));
+               pci_write_config_byte(alim7101_pmu,
+                                       ALI_7101_WDT, (tmp & ~ALI_WDT_ARM));
+               pci_write_config_byte(alim7101_pmu,
+                                       ALI_7101_WDT, (tmp | ALI_WDT_ARM));
                if (use_gpio) {
-                       pci_read_config_byte(alim7101_pmu, ALI_7101_GPIO_O, &tmp);
-                       pci_write_config_byte(alim7101_pmu, ALI_7101_GPIO_O, tmp
-                                       | 0x20);
-                       pci_write_config_byte(alim7101_pmu, ALI_7101_GPIO_O, tmp
-                                       & ~0x20);
+                       pci_read_config_byte(alim7101_pmu,
+                                       ALI_7101_GPIO_O, &tmp);
+                       pci_write_config_byte(alim7101_pmu,
+                                       ALI_7101_GPIO_O, tmp | 0x20);
+                       pci_write_config_byte(alim7101_pmu,
+                                       ALI_7101_GPIO_O, tmp & ~0x20);
                }
        } else {
-               printk(KERN_WARNING PFX "Heartbeat lost! Will not ping the watchdog\n");
+               printk(KERN_WARNING PFX
+                       "Heartbeat lost! Will not ping the watchdog\n");
        }
        /* Re-set the timer interval */
        mod_timer(&timer, jiffies + WDT_INTERVAL);
@@ -117,21 +125,27 @@ static void wdt_timer_ping(unsigned long data)
 
 static void wdt_change(int writeval)
 {
-       char    tmp;
+       char tmp;
 
        pci_read_config_byte(alim7101_pmu, ALI_7101_WDT, &tmp);
        if (writeval == WDT_ENABLE) {
-               pci_write_config_byte(alim7101_pmu, ALI_7101_WDT, (tmp | ALI_WDT_ARM));
+               pci_write_config_byte(alim7101_pmu,
+                                       ALI_7101_WDT, (tmp | ALI_WDT_ARM));
                if (use_gpio) {
-                       pci_read_config_byte(alim7101_pmu, ALI_7101_GPIO_O, &tmp);
-                       pci_write_config_byte(alim7101_pmu, ALI_7101_GPIO_O, tmp & ~0x20);
+                       pci_read_config_byte(alim7101_pmu,
+                                       ALI_7101_GPIO_O, &tmp);
+                       pci_write_config_byte(alim7101_pmu,
+                                       ALI_7101_GPIO_O, tmp & ~0x20);
                }
 
        } else {
-               pci_write_config_byte(alim7101_pmu, ALI_7101_WDT, (tmp & ~ALI_WDT_ARM));
+               pci_write_config_byte(alim7101_pmu,
+                                       ALI_7101_WDT, (tmp & ~ALI_WDT_ARM));
                if (use_gpio) {
-                       pci_read_config_byte(alim7101_pmu, ALI_7101_GPIO_O, &tmp);
-                       pci_write_config_byte(alim7101_pmu, ALI_7101_GPIO_O, tmp | 0x20);
+                       pci_read_config_byte(alim7101_pmu,
+                                       ALI_7101_GPIO_O, &tmp);
+                       pci_write_config_byte(alim7101_pmu,
+                                       ALI_7101_GPIO_O, tmp | 0x20);
                }
        }
 }
@@ -169,10 +183,11 @@ static void wdt_keepalive(void)
  * /dev/watchdog handling
  */
 
-static ssize_t fop_write(struct file * file, const char __user * buf, size_t count, loff_t * ppos)
+static ssize_t fop_write(struct file *file, const char __user *buf,
+                                               size_t count, loff_t *ppos)
 {
        /* See if we got the magic character 'V' and reload the timer */
-       if(count) {
+       if (count) {
                if (!nowayout) {
                        size_t ofs;
 
@@ -183,7 +198,7 @@ static ssize_t fop_write(struct file * file, const char __user * buf, size_t cou
                        /* now scan */
                        for (ofs = 0; ofs != count; ofs++) {
                                char c;
-                               if (get_user(c, buf+ofs))
+                               if (get_user(c, buf + ofs))
                                        return -EFAULT;
                                if (c == 'V')
                                        wdt_expect_close = 42;
@@ -195,119 +210,116 @@ static ssize_t fop_write(struct file * file, const char __user * buf, size_t cou
        return count;
 }
 
-static int fop_open(struct inode * inode, struct file * file)
+static int fop_open(struct inode *inode, struct file *file)
 {
        /* Just in case we're already talking to someone... */
-       if(test_and_set_bit(0, &wdt_is_open))
+       if (test_and_set_bit(0, &wdt_is_open))
                return -EBUSY;
        /* Good, fire up the show */
        wdt_startup();
        return nonseekable_open(inode, file);
 }
 
-static int fop_close(struct inode * inode, struct file * file)
+static int fop_close(struct inode *inode, struct file *file)
 {
-       if(wdt_expect_close == 42)
+       if (wdt_expect_close == 42)
                wdt_turnoff();
        else {
                /* wim: shouldn't there be a: del_timer(&timer); */
-               printk(KERN_CRIT PFX "device file closed unexpectedly. Will not stop the WDT!\n");
+               printk(KERN_CRIT PFX
+                 "device file closed unexpectedly. Will not stop the WDT!\n");
        }
        clear_bit(0, &wdt_is_open);
        wdt_expect_close = 0;
        return 0;
 }
 
-static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
+static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
-       static struct watchdog_info ident =
-       {
-               .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
+       static struct watchdog_info ident = {
+               .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT
+                                                       | WDIOF_MAGICCLOSE,
                .firmware_version = 1,
                .identity = "ALiM7101",
        };
 
-       switch(cmd)
+       switch (cmd) {
+       case WDIOC_GETSUPPORT:
+               return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
+       case WDIOC_GETSTATUS:
+       case WDIOC_GETBOOTSTATUS:
+               return put_user(0, p);
+       case WDIOC_SETOPTIONS:
        {
-               case WDIOC_GETSUPPORT:
-                       return copy_to_user(argp, &ident, sizeof(ident))?-EFAULT:0;
-               case WDIOC_GETSTATUS:
-               case WDIOC_GETBOOTSTATUS:
-                       return put_user(0, p);
-               case WDIOC_KEEPALIVE:
-                       wdt_keepalive();
-                       return 0;
-               case WDIOC_SETOPTIONS:
-               {
-                       int new_options, retval = -EINVAL;
-
-                       if(get_user(new_options, p))
-                               return -EFAULT;
-
-                       if(new_options & WDIOS_DISABLECARD) {
-                               wdt_turnoff();
-                               retval = 0;
-                       }
+               int new_options, retval = -EINVAL;
 
-                       if(new_options & WDIOS_ENABLECARD) {
-                               wdt_startup();
-                               retval = 0;
-                       }
-
-                       return retval;
+               if (get_user(new_options, p))
+                       return -EFAULT;
+               if (new_options & WDIOS_DISABLECARD) {
+                       wdt_turnoff();
+                       retval = 0;
                }
-               case WDIOC_SETTIMEOUT:
-               {
-                       int new_timeout;
-
-                       if(get_user(new_timeout, p))
-                               return -EFAULT;
-
-                       if(new_timeout < 1 || new_timeout > 3600) /* arbitrary upper limit */
-                               return -EINVAL;
-
-                       timeout = new_timeout;
-                       wdt_keepalive();
-                       /* Fall through */
+               if (new_options & WDIOS_ENABLECARD) {
+                       wdt_startup();
+                       retval = 0;
                }
-               case WDIOC_GETTIMEOUT:
-                       return put_user(timeout, p);
-               default:
-                       return -ENOTTY;
+               return retval;
+       }
+       case WDIOC_KEEPALIVE:
+               wdt_keepalive();
+               return 0;
+       case WDIOC_SETTIMEOUT:
+       {
+               int new_timeout;
+
+               if (get_user(new_timeout, p))
+                       return -EFAULT;
+               /* arbitrary upper limit */
+               if (new_timeout < 1 || new_timeout > 3600)
+                       return -EINVAL;
+               timeout = new_timeout;
+               wdt_keepalive();
+               /* Fall through */
+       }
+       case WDIOC_GETTIMEOUT:
+               return put_user(timeout, p);
+       default:
+               return -ENOTTY;
        }
 }
 
 static const struct file_operations wdt_fops = {
-       .owner=         THIS_MODULE,
-       .llseek       no_llseek,
-       .write=         fop_write,
-       .open=          fop_open,
-       .release=       fop_close,
-       .ioctl=         fop_ioctl,
+       .owner          =       THIS_MODULE,
+       .llseek         =       no_llseek,
+       .write          =       fop_write,
+       .open           =       fop_open,
+       .release        =       fop_close,
+       .unlocked_ioctl =       fop_ioctl,
 };
 
 static struct miscdevice wdt_miscdev = {
-       .minor=WATCHDOG_MINOR,
-       .name="watchdog",
-       .fops=&wdt_fops,
+       .minor  =       WATCHDOG_MINOR,
+       .name   =       "watchdog",
+       .fops   =       &wdt_fops,
 };
 
 /*
  *     Notifier for system down
  */
 
-static int wdt_notify_sys(struct notifier_block *this, unsigned long code, void *unused)
+static int wdt_notify_sys(struct notifier_block *this,
+                                       unsigned long code, void *unused)
 {
-       if (code==SYS_DOWN || code==SYS_HALT)
+       if (code == SYS_DOWN || code == SYS_HALT)
                wdt_turnoff();
 
-       if (code==SYS_RESTART) {
+       if (code == SYS_RESTART) {
                /*
-                * Cobalt devices have no way of rebooting themselves other than
-                * getting the watchdog to pull reset, so we restart the watchdog on
-                * reboot with no heartbeat
+                * Cobalt devices have no way of rebooting themselves other
+                * than getting the watchdog to pull reset, so we restart the
+                * watchdog on reboot with no heartbeat
                 */
                wdt_change(WDT_ENABLE);
                printk(KERN_INFO PFX "Watchdog timer is now enabled with no heartbeat - should reboot in ~1 second.\n");
@@ -320,8 +332,7 @@ static int wdt_notify_sys(struct notifier_block *this, unsigned long code, void
  *     turn the timebomb registers off.
  */
 
-static struct notifier_block wdt_notifier=
-{
+static struct notifier_block wdt_notifier = {
        .notifier_call = wdt_notify_sys,
 };
 
@@ -354,7 +365,8 @@ static int __init alim7101_wdt_init(void)
        ali1543_south = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533,
                NULL);
        if (!ali1543_south) {
-               printk(KERN_INFO PFX "ALi 1543 South-Bridge not present - WDT not set\n");
+               printk(KERN_INFO PFX
+                       "ALi 1543 South-Bridge not present - WDT not set\n");
                goto err_out;
        }
        pci_read_config_byte(ali1543_south, 0x5e, &tmp);
@@ -363,24 +375,25 @@ static int __init alim7101_wdt_init(void)
                if (!use_gpio) {
                        printk(KERN_INFO PFX "Detected old alim7101 revision 'a1d'.  If this is a cobalt board, set the 'use_gpio' module parameter.\n");
                        goto err_out;
-               } 
+               }
                nowayout = 1;
        } else if ((tmp & 0x1e) != 0x12 && (tmp & 0x1e) != 0x00) {
                printk(KERN_INFO PFX "ALi 1543 South-Bridge does not have the correct revision number (???1001?) - WDT not set\n");
                goto err_out;
        }
 
-       if(timeout < 1 || timeout > 3600) /* arbitrary upper limit */
-       {
+       if (timeout < 1 || timeout > 3600) {
+               /* arbitrary upper limit */
                timeout = WATCHDOG_TIMEOUT;
-               printk(KERN_INFO PFX "timeout value must be 1<=x<=3600, using %d\n",
-                       timeout);
+               printk(KERN_INFO PFX
+                       "timeout value must be 1 <= x <= 3600, using %d\n",
+                                                               timeout);
        }
 
        rc = register_reboot_notifier(&wdt_notifier);
        if (rc) {
-               printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
-                       rc);
+               printk(KERN_ERR PFX
+                       "cannot register reboot notifier (err=%d)\n", rc);
                goto err_out;
        }
 
@@ -391,9 +404,8 @@ static int __init alim7101_wdt_init(void)
                goto err_out_reboot;
        }
 
-       if (nowayout) {
+       if (nowayout)
                __module_get(THIS_MODULE);
-       }
 
        printk(KERN_INFO PFX "WDT driver for ALi M7101 initialised. timeout=%d sec (nowayout=%d)\n",
                timeout, nowayout);
index 2eb48c0..55dcbfe 100644 (file)
@@ -69,7 +69,8 @@ struct ar7_wdt {
        u32 prescale;
 };
 
-static struct semaphore open_semaphore;
+static unsigned long wdt_is_open;
+static spinlock_t wdt_lock;
 static unsigned expect_close;
 
 /* XXX currently fixed, allows max margin ~68.72 secs */
@@ -154,8 +155,10 @@ static void ar7_wdt_update_margin(int new_margin)
        u32 change;
 
        change = new_margin * (ar7_vbus_freq() / prescale_value);
-       if (change < 1) change = 1;
-       if (change > 0xffff) change = 0xffff;
+       if (change < 1)
+               change = 1;
+       if (change > 0xffff)
+               change = 0xffff;
        ar7_wdt_change(change);
        margin = change * prescale_value / ar7_vbus_freq();
        printk(KERN_INFO DRVNAME
@@ -179,7 +182,7 @@ static void ar7_wdt_disable_wdt(void)
 static int ar7_wdt_open(struct inode *inode, struct file *file)
 {
        /* only allow one at a time */
-       if (down_trylock(&open_semaphore))
+       if (test_and_set_bit(0, &wdt_is_open))
                return -EBUSY;
        ar7_wdt_enable_wdt();
        expect_close = 0;
@@ -195,9 +198,7 @@ static int ar7_wdt_release(struct inode *inode, struct file *file)
                "will not disable the watchdog timer\n");
        else if (!nowayout)
                ar7_wdt_disable_wdt();
-
-       up(&open_semaphore);
-
+       clear_bit(0, &wdt_is_open);
        return 0;
 }
 
@@ -212,7 +213,7 @@ static int ar7_wdt_notify_sys(struct notifier_block *this,
 }
 
 static struct notifier_block ar7_wdt_notifier = {
-       .notifier_call = ar7_wdt_notify_sys
+       .notifier_call = ar7_wdt_notify_sys,
 };
 
 static ssize_t ar7_wdt_write(struct file *file, const char *data,
@@ -222,12 +223,14 @@ static ssize_t ar7_wdt_write(struct file *file, const char *data,
        if (len) {
                size_t i;
 
+               spin_lock(&wdt_lock);
                ar7_wdt_kick(1);
+               spin_unlock(&wdt_lock);
 
                expect_close = 0;
                for (i = 0; i < len; ++i) {
                        char c;
-                       if (get_user(c, data+i))
+                       if (get_user(c, data + i))
                                return -EFAULT;
                        if (c == 'V')
                                expect_close = 1;
@@ -237,8 +240,8 @@ static ssize_t ar7_wdt_write(struct file *file, const char *data,
        return len;
 }
 
-static int ar7_wdt_ioctl(struct inode *inode, struct file *file,
-                        unsigned int cmd, unsigned long arg)
+static long ar7_wdt_ioctl(struct file *file,
+                                       unsigned int cmd, unsigned long arg)
 {
        static struct watchdog_info ident = {
                .identity = LONGNAME,
@@ -248,8 +251,6 @@ static int ar7_wdt_ioctl(struct inode *inode, struct file *file,
        int new_margin;
 
        switch (cmd) {
-       default:
-               return -ENOTTY;
        case WDIOC_GETSUPPORT:
                if (copy_to_user((struct watchdog_info *)arg, &ident,
                                sizeof(ident)))
@@ -269,20 +270,24 @@ static int ar7_wdt_ioctl(struct inode *inode, struct file *file,
                if (new_margin < 1)
                        return -EINVAL;
 
+               spin_lock(&wdt_lock);
                ar7_wdt_update_margin(new_margin);
                ar7_wdt_kick(1);
+               spin_unlock(&wdt_lock);
 
        case WDIOC_GETTIMEOUT:
                if (put_user(margin, (int *)arg))
                        return -EFAULT;
                return 0;
+       default:
+               return -ENOTTY;
        }
 }
 
 static const struct file_operations ar7_wdt_fops = {
        .owner          = THIS_MODULE,
        .write          = ar7_wdt_write,
-       .ioctl          = ar7_wdt_ioctl,
+       .unlocked_ioctl = ar7_wdt_ioctl,
        .open           = ar7_wdt_open,
        .release        = ar7_wdt_release,
 };
@@ -297,6 +302,8 @@ static int __init ar7_wdt_init(void)
 {
        int rc;
 
+       spin_lock_init(&wdt_lock);
+
        ar7_wdt_get_regs();
 
        if (!request_mem_region(ar7_regs_wdt, sizeof(struct ar7_wdt),
@@ -312,8 +319,6 @@ static int __init ar7_wdt_init(void)
        ar7_wdt_prescale(prescale_value);
        ar7_wdt_update_margin(margin);
 
-       sema_init(&open_semaphore, 1);
-
        rc = register_reboot_notifier(&ar7_wdt_notifier);
        if (rc) {
                printk(KERN_ERR DRVNAME
index ae0fca5..e8ae638 100644 (file)
@@ -212,8 +212,8 @@ static struct watchdog_info at32_wdt_info = {
 /*
  * Handle commands from user-space.
  */
-static int at32_wdt_ioctl(struct inode *inode, struct file *file,
-               unsigned int cmd, unsigned long arg)
+static long at32_wdt_ioctl(struct file *file,
+                               unsigned int cmd, unsigned long arg)
 {
        int ret = -ENOTTY;
        int time;
@@ -221,27 +221,10 @@ static int at32_wdt_ioctl(struct inode *inode, struct file *file,
        int __user *p = argp;
 
        switch (cmd) {
-       case WDIOC_KEEPALIVE:
-               at32_wdt_pat();
-               ret = 0;
-               break;
        case WDIOC_GETSUPPORT:
                ret = copy_to_user(argp, &at32_wdt_info,
                                sizeof(at32_wdt_info)) ? -EFAULT : 0;
                break;
-       case WDIOC_SETTIMEOUT:
-               ret = get_user(time, p);
-               if (ret)
-                       break;
-               ret = at32_wdt_settimeout(time);
-               if (ret)
-                       break;
-               /* Enable new time value */
-               at32_wdt_start();
-               /* fall through */
-       case WDIOC_GETTIMEOUT:
-               ret = put_user(wdt->timeout, p);
-               break;
        case WDIOC_GETSTATUS:
                ret = put_user(0, p);
                break;
@@ -258,6 +241,23 @@ static int at32_wdt_ioctl(struct inode *inode, struct file *file,
                        at32_wdt_start();
                ret = 0;
                break;
+       case WDIOC_KEEPALIVE:
+               at32_wdt_pat();
+               ret = 0;
+               break;
+       case WDIOC_SETTIMEOUT:
+               ret = get_user(time, p);
+               if (ret)
+                       break;
+               ret = at32_wdt_settimeout(time);
+               if (ret)
+                       break;
+               /* Enable new time value */
+               at32_wdt_start();
+               /* fall through */
+       case WDIOC_GETTIMEOUT:
+               ret = put_user(wdt->timeout, p);
+               break;
        }
 
        return ret;
@@ -283,7 +283,7 @@ static ssize_t at32_wdt_write(struct file *file, const char __user *data,
                         */
                        for (i = 0; i != len; i++) {
                                char c;
-                               if (get_user(c, data+i))
+                               if (get_user(c, data + i))
                                        return -EFAULT;
                                if (c == 'V')
                                        expect_release = 42;
@@ -298,7 +298,7 @@ static ssize_t at32_wdt_write(struct file *file, const char __user *data,
 static const struct file_operations at32_wdt_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
-       .ioctl          = at32_wdt_ioctl,
+       .unlocked_ioctl = at32_wdt_ioctl,
        .open           = at32_wdt_open,
        .release        = at32_wdt_close,
        .write          = at32_wdt_write,
@@ -391,7 +391,6 @@ static int __exit at32_wdt_remove(struct platform_device *pdev)
                wdt = NULL;
                platform_set_drvdata(pdev, NULL);
        }
-
        return 0;
 }
 
index 9ff9a95..2313f44 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/platform_device.h>
 #include <linux/types.h>
 #include <linux/watchdog.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/arch/at91_st.h>
 
 
@@ -31,11 +31,14 @@ static int wdt_time = WDT_DEFAULT_TIME;
 static int nowayout = WATCHDOG_NOWAYOUT;
 
 module_param(wdt_time, int, 0);
-MODULE_PARM_DESC(wdt_time, "Watchdog time in seconds. (default="__MODULE_STRING(WDT_DEFAULT_TIME) ")");
+MODULE_PARM_DESC(wdt_time, "Watchdog time in seconds. (default="
+                               __MODULE_STRING(WDT_DEFAULT_TIME) ")");
 
 #ifdef CONFIG_WATCHDOG_NOWAYOUT
 module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout,
+               "Watchdog cannot be stopped once started (default="
+                               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 #endif
 
 
@@ -46,7 +49,7 @@ static unsigned long at91wdt_busy;
 /*
  * Disable the watchdog.
  */
-static void inline at91_wdt_stop(void)
+static inline void at91_wdt_stop(void)
 {
        at91_sys_write(AT91_ST_WDMR, AT91_ST_EXTEN);
 }
@@ -54,16 +57,17 @@ static void inline at91_wdt_stop(void)
 /*
  * Enable and reset the watchdog.
  */
-static void inline at91_wdt_start(void)
+static inline void at91_wdt_start(void)
 {
-       at91_sys_write(AT91_ST_WDMR, AT91_ST_EXTEN | AT91_ST_RSTEN | (((65536 * wdt_time) >> 8) & AT91_ST_WDV));
+       at91_sys_write(AT91_ST_WDMR, AT91_ST_EXTEN | AT91_ST_RSTEN |
+                               (((65536 * wdt_time) >> 8) & AT91_ST_WDV));
        at91_sys_write(AT91_ST_CR, AT91_ST_WDRST);
 }
 
 /*
  * Reload the watchdog timer.  (ie, pat the watchdog)
  */
-static void inline at91_wdt_reload(void)
+static inline void at91_wdt_reload(void)
 {
        at91_sys_write(AT91_ST_CR, AT91_ST_WDRST);
 }
@@ -89,8 +93,9 @@ static int at91_wdt_open(struct inode *inode, struct file *file)
  */
 static int at91_wdt_close(struct inode *inode, struct file *file)
 {
+       /* Disable the watchdog when file is closed */
        if (!nowayout)
-               at91_wdt_stop();        /* Disable the watchdog when file is closed */
+               at91_wdt_stop();
 
        clear_bit(0, &at91wdt_busy);
        return 0;
@@ -110,7 +115,8 @@ static int at91_wdt_settimeout(int new_time)
        if ((new_time <= 0) || (new_time > WDT_MAX_TIME))
                return -EINVAL;
 
-       /* Set new watchdog time. It will be used when at91_wdt_start() is called. */
+       /* Set new watchdog time. It will be used when
+          at91_wdt_start() is called. */
        wdt_time = new_time;
        return 0;
 }
@@ -123,60 +129,52 @@ static struct watchdog_info at91_wdt_info = {
 /*
  * Handle commands from user-space.
  */
-static int at91_wdt_ioctl(struct inode *inode, struct file *file,
-               unsigned int cmd, unsigned long arg)
+static long at91_wdt_ioct(struct file *file,
+                                       unsigned int cmd, unsigned long arg)
 {
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
        int new_value;
 
-       switch(cmd) {
-               case WDIOC_KEEPALIVE:
-                       at91_wdt_reload();      /* pat the watchdog */
-                       return 0;
-
-               case WDIOC_GETSUPPORT:
-                       return copy_to_user(argp, &at91_wdt_info, sizeof(at91_wdt_info)) ? -EFAULT : 0;
-
-               case WDIOC_SETTIMEOUT:
-                       if (get_user(new_value, p))
-                               return -EFAULT;
-
-                       if (at91_wdt_settimeout(new_value))
-                               return -EINVAL;
-
-                       /* Enable new time value */
+       switch (cmd) {
+       case WDIOC_GETSUPPORT:
+               return copy_to_user(argp, &at91_wdt_info,
+                               sizeof(at91_wdt_info)) ? -EFAULT : 0;
+       case WDIOC_GETSTATUS:
+       case WDIOC_GETBOOTSTATUS:
+               return put_user(0, p);
+       case WDIOC_SETOPTIONS:
+               if (get_user(new_value, p))
+                       return -EFAULT;
+               if (new_value & WDIOS_DISABLECARD)
+                       at91_wdt_stop();
+               if (new_value & WDIOS_ENABLECARD)
                        at91_wdt_start();
-
-                       /* Return current value */
-                       return put_user(wdt_time, p);
-
-               case WDIOC_GETTIMEOUT:
-                       return put_user(wdt_time, p);
-
-               case WDIOC_GETSTATUS:
-               case WDIOC_GETBOOTSTATUS:
-                       return put_user(0, p);
-
-               case WDIOC_SETOPTIONS:
-                       if (get_user(new_value, p))
-                               return -EFAULT;
-
-                       if (new_value & WDIOS_DISABLECARD)
-                               at91_wdt_stop();
-                       if (new_value & WDIOS_ENABLECARD)
-                               at91_wdt_start();
-                       return 0;
-
-               default:
-                       return -ENOTTY;
+               return 0;
+       case WDIOC_KEEPALIVE:
+               at91_wdt_reload();      /* pat the watchdog */
+               return 0;
+       case WDIOC_SETTIMEOUT:
+               if (get_user(new_value, p))
+                       return -EFAULT;
+               if (at91_wdt_settimeout(new_value))
+                       return -EINVAL;
+               /* Enable new time value */
+               at91_wdt_start();
+               /* Return current value */
+               return put_user(wdt_time, p);
+       case WDIOC_GETTIMEOUT:
+               return put_user(wdt_time, p);
+       default:
+               return -ENOTTY;
        }
 }
 
 /*
  * Pat the watchdog whenever device is written to.
  */
-static ssize_t at91_wdt_write(struct file *file, const char *data, size_t len, loff_t *ppos)
+static ssize_t at91_wdt_write(struct file *file, const char *data,
+                                               size_t len, loff_t *ppos)
 {
        at91_wdt_reload();              /* pat the watchdog */
        return len;
@@ -187,7 +185,7 @@ static ssize_t at91_wdt_write(struct file *file, const char *data, size_t len, l
 static const struct file_operations at91wdt_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
-       .ioctl          = at91_wdt_ioctl,
+       .unlocked_ioctl = at91_wdt_ioctl,
        .open           = at91_wdt_open,
        .release        = at91_wdt_close,
        .write          = at91_wdt_write,
@@ -211,7 +209,8 @@ static int __init at91wdt_probe(struct platform_device *pdev)
        if (res)
                return res;
 
-       printk("AT91 Watchdog Timer enabled (%d seconds%s)\n", wdt_time, nowayout ? ", nowayout" : "");
+       printk(KERN_INFO "AT91 Watchdog Timer enabled (%d seconds%s)\n",
+                               wdt_time, nowayout ? ", nowayout" : "");
        return 0;
 }
 
@@ -265,7 +264,8 @@ static struct platform_driver at91wdt_driver = {
 
 static int __init at91_wdt_init(void)
 {
-       /* Check that the heartbeat value is within range; if not reset to the default */
+       /* Check that the heartbeat value is within range;
+          if not reset to the default */
        if (at91_wdt_settimeout(wdt_time)) {
                at91_wdt_settimeout(WDT_DEFAULT_TIME);
                pr_info("at91_wdt: wdt_time value must be 1 <= wdt_time <= 256, using %d\n", wdt_time);
index 03b3e3d..31b4225 100644 (file)
@@ -24,8 +24,8 @@
 #include <linux/reboot.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
+#include <linux/uaccess.h>
 #include <asm/blackfin.h>
-#include <asm/uaccess.h>
 
 #define stamp(fmt, args...) pr_debug("%s:%i: " fmt "\n", __func__, __LINE__, ## args)
 #define stampit() stamp("here i am")
@@ -148,7 +148,8 @@ static int bfin_wdt_set_timeout(unsigned long t)
                int run = bfin_wdt_running();
                bfin_wdt_stop();
                bfin_write_WDOG_CNT(cnt);
-               if (run) bfin_wdt_start();
+               if (run)
+                       bfin_wdt_start();
        }
        spin_unlock_irqrestore(&bfin_wdt_spinlock, flags);
 
@@ -191,16 +192,15 @@ static int bfin_wdt_release(struct inode *inode, struct file *file)
 {
        stampit();
 
-       if (expect_close == 42) {
+       if (expect_close == 42)
                bfin_wdt_stop();
-       } else {
-               printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
+       else {
+               printk(KERN_CRIT PFX
+                       "Unexpected close, not stopping watchdog!\n");
                bfin_wdt_keepalive();
        }
-
        expect_close = 0;
        clear_bit(0, &open_check);
-
        return 0;
 }
 
@@ -214,7 +214,7 @@ static int bfin_wdt_release(struct inode *inode, struct file *file)
  *     Pings the watchdog on write.
  */
 static ssize_t bfin_wdt_write(struct file *file, const char __user *data,
-                              size_t len, loff_t *ppos)
+                                               size_t len, loff_t *ppos)
 {
        stampit();
 
@@ -241,7 +241,6 @@ static ssize_t bfin_wdt_write(struct file *file, const char __user *data,
 
 /**
  *     bfin_wdt_ioctl - Query Device
- *     @inode: inode of device
  *     @file: file handle of device
  *     @cmd: watchdog command
  *     @arg: argument
@@ -249,8 +248,8 @@ static ssize_t bfin_wdt_write(struct file *file, const char __user *data,
  *     Query basic information from the device or ping it, as outlined by the
  *     watchdog API.
  */
-static int bfin_wdt_ioctl(struct inode *inode, struct file *file,
-                          unsigned int cmd, unsigned long arg)
+static long bfin_wdt_ioctl(struct file *file,
+                               unsigned int cmd, unsigned long arg)
 {
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
@@ -258,59 +257,49 @@ static int bfin_wdt_ioctl(struct inode *inode, struct file *file,
        stampit();
 
        switch (cmd) {
-               default:
-                       return -ENOTTY;
-
-               case WDIOC_GETSUPPORT:
-                       if (copy_to_user(argp, &bfin_wdt_info, sizeof(bfin_wdt_info)))
-                               return -EFAULT;
-                       else
-                               return 0;
-
-               case WDIOC_GETSTATUS:
-               case WDIOC_GETBOOTSTATUS:
-                       return put_user(!!(_bfin_swrst & SWRST_RESET_WDOG), p);
-
-               case WDIOC_KEEPALIVE:
-                       bfin_wdt_keepalive();
+       case WDIOC_GETSUPPORT:
+               if (copy_to_user(argp, &bfin_wdt_info, sizeof(bfin_wdt_info)))
+                       return -EFAULT;
+               else
                        return 0;
-
-               case WDIOC_SETTIMEOUT: {
-                       int new_timeout;
-
-                       if (get_user(new_timeout, p))
-                               return -EFAULT;
-
-                       if (bfin_wdt_set_timeout(new_timeout))
-                               return -EINVAL;
+       case WDIOC_GETSTATUS:
+       case WDIOC_GETBOOTSTATUS:
+               return put_user(!!(_bfin_swrst & SWRST_RESET_WDOG), p);
+       case WDIOC_SETOPTIONS: {
+               unsigned long flags;
+               int options, ret = -EINVAL;
+
+               if (get_user(options, p))
+                       return -EFAULT;
+
+               spin_lock_irqsave(&bfin_wdt_spinlock, flags);
+               if (options & WDIOS_DISABLECARD) {
+                       bfin_wdt_stop();
+                       ret = 0;
                }
-                       /* Fall */
-               case WDIOC_GETTIMEOUT:
-                       return put_user(timeout, p);
-
-               case WDIOC_SETOPTIONS: {
-                       unsigned long flags;
-                       int options, ret = -EINVAL;
-
-                       if (get_user(options, p))
-                               return -EFAULT;
-
-                       spin_lock_irqsave(&bfin_wdt_spinlock, flags);
-
-                       if (options & WDIOS_DISABLECARD) {
-                               bfin_wdt_stop();
-                               ret = 0;
-                       }
-
-                       if (options & WDIOS_ENABLECARD) {
-                               bfin_wdt_start();
-                               ret = 0;
-                       }
-
-                       spin_unlock_irqrestore(&bfin_wdt_spinlock, flags);
-
-                       return ret;
+               if (options & WDIOS_ENABLECARD) {
+                       bfin_wdt_start();
+                       ret = 0;
                }
+               spin_unlock_irqrestore(&bfin_wdt_spinlock, flags);
+               return ret;
+       }
+       case WDIOC_KEEPALIVE:
+               bfin_wdt_keepalive();
+               return 0;
+       case WDIOC_SETTIMEOUT: {
+               int new_timeout;
+
+               if (get_user(new_timeout, p))
+                       return -EFAULT;
+               if (bfin_wdt_set_timeout(new_timeout))
+                       return -EINVAL;
+       }
+       /* Fall */
+       case WDIOC_GETTIMEOUT:
+               return put_user(timeout, p);
+       default:
+               return -ENOTTY;
        }
 }
 
@@ -323,8 +312,8 @@ static int bfin_wdt_ioctl(struct inode *inode, struct file *file,
  *     Handles specific events, such as turning off the watchdog during a
  *     shutdown event.
  */
-static int bfin_wdt_notify_sys(struct notifier_block *this, unsigned long code,
-                               void *unused)
+static int bfin_wdt_notify_sys(struct notifier_block *this,
+                                       unsigned long code, void *unused)
 {
        stampit();
 
@@ -379,12 +368,12 @@ static int bfin_wdt_resume(struct platform_device *pdev)
 #endif
 
 static const struct file_operations bfin_wdt_fops = {
-       .owner    = THIS_MODULE,
-       .llseek   = no_llseek,
-       .write    = bfin_wdt_write,
-       .ioctl    = bfin_wdt_ioctl,
-       .open     = bfin_wdt_open,
-       .release  = bfin_wdt_release,
+       .owner          = THIS_MODULE,
+       .llseek         = no_llseek,
+       .write          = bfin_wdt_write,
+       .unlocked_ioctl = bfin_wdt_ioctl,
+       .open           = bfin_wdt_open,
+       .release        = bfin_wdt_release,
 };
 
 static struct miscdevice bfin_wdt_miscdev = {
@@ -396,8 +385,8 @@ static struct miscdevice bfin_wdt_miscdev = {
 static struct watchdog_info bfin_wdt_info = {
        .identity = "Blackfin Watchdog",
        .options  = WDIOF_SETTIMEOUT |
-                   WDIOF_KEEPALIVEPING |
-                   WDIOF_MAGICCLOSE,
+                   WDIOF_KEEPALIVEPING |
+                   WDIOF_MAGICCLOSE,
 };
 
 static struct notifier_block bfin_wdt_notifier = {
@@ -416,14 +405,16 @@ static int __devinit bfin_wdt_probe(struct platform_device *pdev)
 
        ret = register_reboot_notifier(&bfin_wdt_notifier);
        if (ret) {
-               pr_devinit(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", ret);
+               pr_devinit(KERN_ERR PFX
+                       "cannot register reboot notifier (err=%d)\n", ret);
                return ret;
        }
 
        ret = misc_register(&bfin_wdt_miscdev);
        if (ret) {
-               pr_devinit(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
-                      WATCHDOG_MINOR, ret);
+               pr_devinit(KERN_ERR PFX
+                       "cannot register miscdev on minor=%d (err=%d)\n",
+                               WATCHDOG_MINOR, ret);
                unregister_reboot_notifier(&bfin_wdt_notifier);
                return ret;
        }
@@ -516,7 +507,11 @@ MODULE_LICENSE("GPL");
 MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
 
 module_param(timeout, uint, 0);
-MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (1<=timeout<=((2^32)/SCLK), default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
+MODULE_PARM_DESC(timeout,
+       "Watchdog timeout in seconds. (1<=timeout<=((2^32)/SCLK), default="
+               __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
 
 module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout,
+       "Watchdog cannot be stopped once started (default="
+               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
index 7708244..c3b78a7 100644 (file)
@@ -18,9 +18,9 @@
 #include <linux/miscdevice.h>
 #include <linux/notifier.h>
 #include <linux/watchdog.h>
+#include <linux/uaccess.h>
 
 #include <asm/reg_booke.h>
-#include <asm/uaccess.h>
 #include <asm/system.h>
 
 /* If the kernel parameter wdt=1, the watchdog will be enabled at boot.
@@ -32,7 +32,7 @@
  */
 
 #ifdef CONFIG_FSL_BOOKE
-#define WDT_PERIOD_DEFAULT 63  /* Ex. wdt_period=28 bus=333Mhz , reset=~40sec */
+#define WDT_PERIOD_DEFAULT 63  /* Ex. wdt_period=28 bus=333Mhz,reset=~40sec */
 #else
 #define WDT_PERIOD_DEFAULT 3   /* Refer to the PPC40x and PPC4xx manuals */
 #endif                         /* for timing information */
@@ -82,16 +82,15 @@ static struct watchdog_info ident = {
        .identity = "PowerPC Book-E Watchdog",
 };
 
-static int booke_wdt_ioctl(struct inode *inode, struct file *file,
-                           unsigned int cmd, unsigned long arg)
+static long booke_wdt_ioctl(struct file *file,
+                               unsigned int cmd, unsigned long arg)
 {
        u32 tmp = 0;
        u32 __user *p = (u32 __user *)arg;
 
        switch (cmd) {
        case WDIOC_GETSUPPORT:
-               if (copy_to_user((struct watchdog_info __user *)arg, &ident,
-                               sizeof(struct watchdog_info)))
+               if (copy_to_user(arg, &ident, sizeof(struct watchdog_info)))
                        return -EFAULT;
        case WDIOC_GETSTATUS:
                return put_user(ident.options, p);
@@ -100,16 +99,6 @@ static int booke_wdt_ioctl(struct inode *inode, struct file *file,
                tmp = mfspr(SPRN_TSR) & TSR_WRS(3);
                /* returns 1 if last reset was caused by the WDT */
                return (tmp ? 1 : 0);
-       case WDIOC_KEEPALIVE:
-               booke_wdt_ping();
-               return 0;
-       case WDIOC_SETTIMEOUT:
-               if (get_user(booke_wdt_period, p))
-                       return -EFAULT;
-               mtspr(SPRN_TCR, (mfspr(SPRN_TCR)&~WDTP(0))|WDTP(booke_wdt_period));
-               return 0;
-       case WDIOC_GETTIMEOUT:
-               return put_user(booke_wdt_period, p);
        case WDIOC_SETOPTIONS:
                if (get_user(tmp, p))
                        return -EINVAL;
@@ -119,6 +108,17 @@ static int booke_wdt_ioctl(struct inode *inode, struct file *file,
                } else
                        return -EINVAL;
                return 0;
+       case WDIOC_KEEPALIVE:
+               booke_wdt_ping();
+               return 0;
+       case WDIOC_SETTIMEOUT:
+               if (get_user(booke_wdt_period, p))
+                       return -EFAULT;
+               mtspr(SPRN_TCR, (mfspr(SPRN_TCR) & ~WDTP(0)) |
+                                               WDTP(booke_wdt_period));
+               return 0;
+       case WDIOC_GETTIMEOUT:
+               return put_user(booke_wdt_period, p);
        default:
                return -ENOTTY;
        }
@@ -132,8 +132,9 @@ static int booke_wdt_open(struct inode *inode, struct file *file)
        if (booke_wdt_enabled == 0) {
                booke_wdt_enabled = 1;
                on_each_cpu(__booke_wdt_enable, NULL, 0);
-               printk(KERN_INFO "PowerPC Book-E Watchdog Timer Enabled "
-                               "(wdt_period=%d)\n", booke_wdt_period);
+               printk(KERN_INFO
+                     "PowerPC Book-E Watchdog Timer Enabled (wdt_period=%d)\n",
+                               booke_wdt_period);
        }
        spin_unlock(&booke_wdt_lock);
 
@@ -144,7 +145,7 @@ static const struct file_operations booke_wdt_fops = {
        .owner = THIS_MODULE,
        .llseek = no_llseek,
        .write = booke_wdt_write,
-       .ioctl = booke_wdt_ioctl,
+       .unlocked_ioctl = booke_wdt_ioctl,
        .open = booke_wdt_open,
 };
 
@@ -175,8 +176,9 @@ static int __init booke_wdt_init(void)
 
        spin_lock(&booke_wdt_lock);
        if (booke_wdt_enabled == 1) {
-               printk(KERN_INFO "PowerPC Book-E Watchdog Timer Enabled "
-                               "(wdt_period=%d)\n", booke_wdt_period);
+               printk(KERN_INFO
+                     "PowerPC Book-E Watchdog Timer Enabled (wdt_period=%d)\n",
+                               booke_wdt_period);
                on_each_cpu(__booke_wdt_enable, NULL, 0);
        }
        spin_unlock(&booke_wdt_lock);
index df72f90..71f6d7e 100644 (file)
 #include <linux/timer.h>
 #include <linux/completion.h>
 #include <linux/jiffies.h>
-#include <asm/io.h>
-#include <asm/uaccess.h>
-
+#include <linux/io.h>
+#include <linux/uaccess.h>
 #include <linux/watchdog.h>
 
 /* adjustable parameters */
 
-static int verbose = 0;
+static int verbose;
 static int port = 0x91;
 static int ticks = 10000;
+static spinlock_t cpu5wdt_lock;
 
 #define PFX                    "cpu5wdt: "
 
@@ -70,12 +70,13 @@ static struct {
 
 static void cpu5wdt_trigger(unsigned long unused)
 {
-       if ( verbose > 2 )
+       if (verbose > 2)
                printk(KERN_DEBUG PFX "trigger at %i ticks\n", ticks);
 
-       if( cpu5wdt_device.running )
+       if (cpu5wdt_device.running)
                ticks--;
 
+       spin_lock(&cpu5wdt_lock);
        /* keep watchdog alive */
        outb(1, port + CPU5WDT_TRIGGER_REG);
 
@@ -86,6 +87,7 @@ static void cpu5wdt_trigger(unsigned long unused)
                /* ticks doesn't matter anyway */
                complete(&cpu5wdt_device.stop);
        }
+       spin_unlock(&cpu5wdt_lock);
 
 }
 
@@ -93,14 +95,17 @@ static void cpu5wdt_reset(void)
 {
        ticks = cpu5wdt_device.default_ticks;
 
-       if ( verbose )
+       if (verbose)
                printk(KERN_DEBUG PFX "reset (%i ticks)\n", (int) ticks);
 
 }
 
 static void cpu5wdt_start(void)
 {
-       if ( !cpu5wdt_device.queue ) {
+       unsigned long flags;
+
+       spin_lock_irqsave(&cpu5wdt_lock, flags);
+       if (!cpu5wdt_device.queue) {
                cpu5wdt_device.queue = 1;
                outb(0, port + CPU5WDT_TIME_A_REG);
                outb(0, port + CPU5WDT_TIME_B_REG);
@@ -111,18 +116,20 @@ static void cpu5wdt_start(void)
        }
        /* if process dies, counter is not decremented */
        cpu5wdt_device.running++;
+       spin_unlock_irqrestore(&cpu5wdt_lock, flags);
 }
 
 static int cpu5wdt_stop(void)
 {
-       if ( cpu5wdt_device.running )
-               cpu5wdt_device.running = 0;
+       unsigned long flags;
 
+       spin_lock_irqsave(&cpu5wdt_lock, flags);
+       if (cpu5wdt_device.running)
+               cpu5wdt_device.running = 0;
        ticks = cpu5wdt_device.default_ticks;
-
-       if ( verbose )
+       spin_unlock_irqrestore(&cpu5wdt_lock, flags);
+       if (verbose)
                printk(KERN_CRIT PFX "stop not possible\n");
-
        return -EIO;
 }
 
@@ -130,9 +137,8 @@ static int cpu5wdt_stop(void)
 
 static int cpu5wdt_open(struct inode *inode, struct file *file)
 {
-       if ( test_and_set_bit(0, &cpu5wdt_device.inuse) )
+       if (test_and_set_bit(0, &cpu5wdt_device.inuse))
                return -EBUSY;
-
        return nonseekable_open(inode, file);
 }
 
@@ -142,67 +148,58 @@ static int cpu5wdt_release(struct inode *inode, struct file *file)
        return 0;
 }
 
-static int cpu5wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
+static long cpu5wdt_ioctl(struct file *file, unsigned int cmd,
+                                               unsigned long arg)
 {
        void __user *argp = (void __user *)arg;
+       int __user *p = argp;
        unsigned int value;
-       static struct watchdog_info ident =
-       {
+       static struct watchdog_info ident = {
                .options = WDIOF_CARDRESET,
                .identity = "CPU5 WDT",
        };
 
-       switch(cmd) {
-               case WDIOC_KEEPALIVE:
-                       cpu5wdt_reset();
-                       break;
-               case WDIOC_GETSTATUS:
-                       value = inb(port + CPU5WDT_STATUS_REG);
-                       value = (value >> 2) & 1;
-                       if ( copy_to_user(argp, &value, sizeof(int)) )
-                               return -EFAULT;
-                       break;
-               case WDIOC_GETBOOTSTATUS:
-                       if ( copy_to_user(argp, &value, sizeof(int)) )
-                               return -EFAULT;
-                       break;
-               case WDIOC_GETSUPPORT:
-                       if ( copy_to_user(argp, &ident, sizeof(ident)) )
-                               return -EFAULT;
-                       break;
-               case WDIOC_SETOPTIONS:
-                       if ( copy_from_user(&value, argp, sizeof(int)) )
-                               return -EFAULT;
-                       switch(value) {
-                               case WDIOS_ENABLECARD:
-                                       cpu5wdt_start();
-                                       break;
-                               case WDIOS_DISABLECARD:
-                                       return cpu5wdt_stop();
-                               default:
-                                       return -EINVAL;
-                       }
-                       break;
-               default:
-                       return -ENOTTY;
+       switch (cmd) {
+       case WDIOC_GETSUPPORT:
+               if (copy_to_user(argp, &ident, sizeof(ident)))
+                       return -EFAULT;
+               break;
+       case WDIOC_GETSTATUS:
+               value = inb(port + CPU5WDT_STATUS_REG);
+               value = (value >> 2) & 1;
+               return put_user(value, p);
+       case WDIOC_GETBOOTSTATUS:
+               return put_user(0, p);
+       case WDIOC_SETOPTIONS:
+               if (get_user(value, p))
+                       return -EFAULT;
+               if (value & WDIOS_ENABLECARD)
+                       cpu5wdt_start();
+               if (value & WDIOS_DISABLECARD)
+                       cpu5wdt_stop();
+               break;
+       case WDIOC_KEEPALIVE:
+               cpu5wdt_reset();
+               break;
+       default:
+               return -ENOTTY;
        }
        return 0;
 }
 
-static ssize_t cpu5wdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
+static ssize_t cpu5wdt_write(struct file *file, const char __user *buf,
+                                               size_t count, loff_t *ppos)
 {
-       if ( !count )
+       if (!count)
                return -EIO;
-
        cpu5wdt_reset();
-
        return count;
 }
 
 static const struct file_operations cpu5wdt_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
-       .ioctl          = cpu5wdt_ioctl,
+       .unlocked_ioctl = cpu5wdt_ioctl,
        .open           = cpu5wdt_open,
        .write          = cpu5wdt_write,
        .release        = cpu5wdt_release,
@@ -221,37 +218,36 @@ static int __devinit cpu5wdt_init(void)
        unsigned int val;
        int err;
 
-       if ( verbose )
-               printk(KERN_DEBUG PFX "port=0x%x, verbose=%i\n", port, verbose);
+       if (verbose)
+               printk(KERN_DEBUG PFX
+                               "port=0x%x, verbose=%i\n", port, verbose);
 
-       if ( !request_region(port, CPU5WDT_EXTENT, PFX) ) {
+       init_completion(&cpu5wdt_device.stop);
+       spin_lock_init(&cpu5wdt_lock);
+       cpu5wdt_device.queue = 0;
+       setup_timer(&cpu5wdt_device.timer, cpu5wdt_trigger, 0);
+       cpu5wdt_device.default_ticks = ticks;
+
+       if (!request_region(port, CPU5WDT_EXTENT, PFX)) {
                printk(KERN_ERR PFX "request_region failed\n");
                err = -EBUSY;
                goto no_port;
        }
 
-       if ( (err = misc_register(&cpu5wdt_misc)) < 0 ) {
-               printk(KERN_ERR PFX "misc_register failed\n");
-               goto no_misc;
-       }
-
        /* watchdog reboot? */
        val = inb(port + CPU5WDT_STATUS_REG);
        val = (val >> 2) & 1;
-       if ( !val )
+       if (!val)
                printk(KERN_INFO PFX "sorry, was my fault\n");
 
-       init_completion(&cpu5wdt_device.stop);
-       cpu5wdt_device.queue = 0;
-
-       clear_bit(0, &cpu5wdt_device.inuse);
-
-       setup_timer(&cpu5wdt_device.timer, cpu5wdt_trigger, 0);
+       err = misc_register(&cpu5wdt_misc);
+       if (err < 0) {
+               printk(KERN_ERR PFX "misc_register failed\n");
+               goto no_misc;
+       }
 
-       cpu5wdt_device.default_ticks = ticks;
 
        printk(KERN_INFO PFX "init success\n");
-
        return 0;
 
 no_misc:
@@ -267,7 +263,7 @@ static int __devinit cpu5wdt_init_module(void)
 
 static void __devexit cpu5wdt_exit(void)
 {
-       if ( cpu5wdt_device.queue ) {
+       if (cpu5wdt_device.queue) {
                cpu5wdt_device.queue = 0;
                wait_for_completion(&cpu5wdt_device.stop);
        }
index 1782c79..802aeba 100644 (file)
 #include <linux/bitops.h>
 #include <linux/platform_device.h>
 #include <linux/spinlock.h>
+#include <linux/uaccess.h>
+#include <linux/io.h>
 
 #include <asm/hardware.h>
-#include <asm/uaccess.h>
-#include <asm/io.h>
 
 #define MODULE_NAME "DAVINCI-WDT: "
 
@@ -143,9 +143,8 @@ static struct watchdog_info ident = {
        .identity = "DaVinci Watchdog",
 };
 
-static int
-davinci_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-                 unsigned long arg)
+static long davinci_wdt_ioctl(struct file *file,
+                                       unsigned int cmd, unsigned long arg)
 {
        int ret = -ENOTTY;
 
@@ -160,14 +159,14 @@ davinci_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
                ret = put_user(0, (int *)arg);
                break;
 
-       case WDIOC_GETTIMEOUT:
-               ret = put_user(heartbeat, (int *)arg);
-               break;
-
        case WDIOC_KEEPALIVE:
                wdt_service();
                ret = 0;
                break;
+
+       case WDIOC_GETTIMEOUT:
+               ret = put_user(heartbeat, (int *)arg);
+               break;
        }
        return ret;
 }
@@ -184,7 +183,7 @@ static const struct file_operations davinci_wdt_fops = {
        .owner = THIS_MODULE,
        .llseek = no_llseek,
        .write = davinci_wdt_write,
-       .ioctl = davinci_wdt_ioctl,
+       .unlocked_ioctl = davinci_wdt_ioctl,
        .open = davinci_wdt_open,
        .release = davinci_wdt_release,
 };
index 0e4787a..07b74a7 100644 (file)
@@ -28,9 +28,9 @@
 #include <linux/miscdevice.h>
 #include <linux/watchdog.h>
 #include <linux/timer.h>
+#include <linux/uaccess.h>
 
 #include <asm/hardware.h>
-#include <asm/uaccess.h>
 
 #define WDT_VERSION    "0.3"
 #define PFX            "ep93xx_wdt: "
@@ -136,9 +136,8 @@ static struct watchdog_info ident = {
        .identity = "EP93xx Watchdog",
 };
 
-static int
-ep93xx_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-                unsigned long arg)
+static long ep93xx_wdt_ioctl(struct file *file,
+                                       unsigned int cmd, unsigned long arg)
 {
        int ret = -ENOTTY;
 
@@ -156,15 +155,15 @@ ep93xx_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
                ret = put_user(boot_status, (int __user *)arg);
                break;
 
-       case WDIOC_GETTIMEOUT:
-               /* actually, it is 0.250 seconds.... */
-               ret = put_user(1, (int __user *)arg);
-               break;
-
        case WDIOC_KEEPALIVE:
                wdt_keepalive();
                ret = 0;
                break;
+
+       case WDIOC_GETTIMEOUT:
+               /* actually, it is 0.250 seconds.... */
+               ret = put_user(1, (int __user *)arg);
+               break;
        }
        return ret;
 }
@@ -174,8 +173,8 @@ static int ep93xx_wdt_release(struct inode *inode, struct file *file)
        if (test_bit(WDT_OK_TO_CLOSE, &wdt_status))
                wdt_shutdown();
        else
-               printk(KERN_CRIT PFX "Device closed unexpectedly - "
-                       "timer will not stop\n");
+               printk(KERN_CRIT PFX
+                       "Device closed unexpectedly - timer will not stop\n");
 
        clear_bit(WDT_IN_USE, &wdt_status);
        clear_bit(WDT_OK_TO_CLOSE, &wdt_status);
@@ -186,7 +185,7 @@ static int ep93xx_wdt_release(struct inode *inode, struct file *file)
 static const struct file_operations ep93xx_wdt_fops = {
        .owner          = THIS_MODULE,
        .write          = ep93xx_wdt_write,
-       .ioctl          = ep93xx_wdt_ioctl,
+       .unlocked_ioctl = ep93xx_wdt_ioctl,
        .open           = ep93xx_wdt_open,
        .release        = ep93xx_wdt_release,
 };
@@ -243,7 +242,9 @@ module_param(nowayout, int, 0);
 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started");
 
 module_param(timeout, int, 0);
-MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (1<=timeout<=3600, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
+MODULE_PARM_DESC(timeout,
+       "Watchdog timeout in seconds. (1<=timeout<=3600, default="
+                               __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
 
 MODULE_AUTHOR("Ray Lehtiniemi <rayl@mail.com>,"
                "Alessandro Zummo <a.zummo@towertech.it>");
index b14e9d1..bbd14e3 100644 (file)
 #include <linux/notifier.h>
 #include <linux/reboot.h>
 #include <linux/init.h>
+#include <linux/io.h>
+#include <linux/uaccess.h>
 
-#include <asm/io.h>
-#include <asm/uaccess.h>
 #include <asm/system.h>
 
 static unsigned long eurwdt_is_open;
 static int eurwdt_timeout;
 static char eur_expect_close;
+static spinlock_t eurwdt_lock;
 
 /*
  * You must set these - there is no sane way to probe for this board.
@@ -78,7 +79,9 @@ static char *ev = "int";
 
 static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout,
+               "Watchdog cannot be stopped once started (default="
+                               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 /*
  * Some symbolic names
@@ -137,7 +140,8 @@ static void eurwdt_activate_timer(void)
 {
        eurwdt_disable_timer();
        eurwdt_write_reg(WDT_CTRL_REG, 0x01);   /* activate the WDT */
-       eurwdt_write_reg(WDT_OUTPIN_CFG, !strcmp("int", ev) ? WDT_EVENT_INT : WDT_EVENT_REBOOT);
+       eurwdt_write_reg(WDT_OUTPIN_CFG,
+               !strcmp("int", ev) ? WDT_EVENT_INT : WDT_EVENT_REBOOT);
 
        /* Setting interrupt line */
        if (irq == 2 || irq > 15 || irq < 0) {
@@ -206,21 +210,21 @@ size_t count, loff_t *ppos)
 
                        for (i = 0; i != count; i++) {
                                char c;
-                               if(get_user(c, buf+i))
+                               if (get_user(c, buf + i))
                                        return -EFAULT;
                                if (c == 'V')
                                        eur_expect_close = 42;
                        }
                }
+               spin_lock(&eurwdt_lock);
                eurwdt_ping();  /* the default timeout */
+               spin_unlock(&eurwdt_lock);
        }
-
        return count;
 }
 
 /**
  * eurwdt_ioctl:
- * @inode: inode of the device
  * @file: file handle to the device
  * @cmd: watchdog command
  * @arg: argument pointer
@@ -229,13 +233,14 @@ size_t count, loff_t *ppos)
  * according to their available features.
  */
 
-static int eurwdt_ioctl(struct inode *inode, struct file *file,
-       unsigned int cmd, unsigned long arg)
+static long eurwdt_ioctl(struct file *file,
+                                       unsigned int cmd, unsigned long arg)
 {
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
        static struct watchdog_info ident = {
-               .options          = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
+               .options          = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT
+                                                       | WDIOF_MAGICCLOSE,
                .firmware_version = 1,
                .identity         = "WDT Eurotech CPU-1220/1410",
        };
@@ -243,10 +248,7 @@ static int eurwdt_ioctl(struct inode *inode, struct file *file,
        int time;
        int options, retval = -EINVAL;
 
-       switch(cmd) {
-       default:
-               return -ENOTTY;
-
+       switch (cmd) {
        case WDIOC_GETSUPPORT:
                return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
 
@@ -254,8 +256,26 @@ static int eurwdt_ioctl(struct inode *inode, struct file *file,
        case WDIOC_GETBOOTSTATUS:
                return put_user(0, p);
 
+       case WDIOC_SETOPTIONS:
+               if (get_user(options, p))
+                       return -EFAULT;
+               spin_lock(&eurwdt_lock);
+               if (options & WDIOS_DISABLECARD) {
+                       eurwdt_disable_timer();
+                       retval = 0;
+               }
+               if (options & WDIOS_ENABLECARD) {
+                       eurwdt_activate_timer();
+                       eurwdt_ping();
+                       retval = 0;
+               }
+               spin_unlock(&eurwdt_lock);
+               return retval;
+
        case WDIOC_KEEPALIVE:
+               spin_lock(&eurwdt_lock);
                eurwdt_ping();
+               spin_unlock(&eurwdt_lock);
                return 0;
 
        case WDIOC_SETTIMEOUT:
@@ -266,26 +286,17 @@ static int eurwdt_ioctl(struct inode *inode, struct file *file,
                if (time < 0 || time > 255)
                        return -EINVAL;
 
+               spin_lock(&eurwdt_lock);
                eurwdt_timeout = time;
                eurwdt_set_timeout(time);
+               spin_unlock(&eurwdt_lock);
                /* Fall */
 
        case WDIOC_GETTIMEOUT:
                return put_user(eurwdt_timeout, p);
 
-       case WDIOC_SETOPTIONS:
-               if (get_user(options, p))
-                       return -EFAULT;
-               if (options & WDIOS_DISABLECARD) {
-                       eurwdt_disable_timer();
-                       retval = 0;
-               }
-               if (options & WDIOS_ENABLECARD) {
-                       eurwdt_activate_timer();
-                       eurwdt_ping();
-                       retval = 0;
-               }
-               return retval;
+       default:
+               return -ENOTTY;
        }
 }
 
@@ -322,10 +333,11 @@ static int eurwdt_open(struct inode *inode, struct file *file)
 
 static int eurwdt_release(struct inode *inode, struct file *file)
 {
-       if (eur_expect_close == 42) {
+       if (eur_expect_close == 42)
                eurwdt_disable_timer();
-       } else {
-               printk(KERN_CRIT "eurwdt: Unexpected close, not stopping watchdog!\n");
+       else {
+               printk(KERN_CRIT
+                       "eurwdt: Unexpected close, not stopping watchdog!\n");
                eurwdt_ping();
        }
        clear_bit(0, &eurwdt_is_open);
@@ -348,10 +360,8 @@ static int eurwdt_release(struct inode *inode, struct file *file)
 static int eurwdt_notify_sys(struct notifier_block *this, unsigned long code,
        void *unused)
 {
-       if (code == SYS_DOWN || code == SYS_HALT) {
-               /* Turn the card off */
-               eurwdt_disable_timer();
-       }
+       if (code == SYS_DOWN || code == SYS_HALT)
+               eurwdt_disable_timer(); /* Turn the card off */
 
        return NOTIFY_DONE;
 }
@@ -362,11 +372,11 @@ static int eurwdt_notify_sys(struct notifier_block *this, unsigned long code,
 
 
 static const struct file_operations eurwdt_fops = {
-       .owner  = THIS_MODULE,
-       .llseek = no_llseek,
-       .write  = eurwdt_write,
-       .ioctl  = eurwdt_ioctl,
-       .open   = eurwdt_open,
+       .owner          = THIS_MODULE,
+       .llseek         = no_llseek,
+       .write          = eurwdt_write,
+       .unlocked_ioctl = eurwdt_ioctl,
+       .open           = eurwdt_open,
        .release        = eurwdt_release,
 };
 
@@ -419,7 +429,7 @@ static int __init eurwdt_init(void)
        int ret;
 
        ret = request_irq(irq, eurwdt_interrupt, IRQF_DISABLED, "eurwdt", NULL);
-       if(ret) {
+       if (ret) {
                printk(KERN_ERR "eurwdt: IRQ %d is not free.\n", irq);
                goto out;
        }
@@ -432,10 +442,13 @@ static int __init eurwdt_init(void)
 
        ret = register_reboot_notifier(&eurwdt_notifier);
        if (ret) {
-               printk(KERN_ERR "eurwdt: can't register reboot notifier (err=%d)\n", ret);
+               printk(KERN_ERR
+                   "eurwdt: can't register reboot notifier (err=%d)\n", ret);
                goto outreg;
        }
 
+       spin_lock_init(&eurwdt_lock);
+
        ret = misc_register(&eurwdt_miscdev);
        if (ret) {
                printk(KERN_ERR "eurwdt: can't misc_register on minor=%d\n",
index 30d09cb..614a5c7 100644 (file)
@@ -17,8 +17,8 @@
 #include <linux/fs.h>
 #include <linux/platform_device.h>
 #include <linux/reboot.h>
+#include <linux/uaccess.h>
 
-#include <asm/uaccess.h>
 #include <asm/geode.h>
 
 #define GEODEWDT_HZ 500
@@ -77,27 +77,24 @@ static int geodewdt_set_heartbeat(int val)
        return 0;
 }
 
-static int
-geodewdt_open(struct inode *inode, struct file *file)
+static int geodewdt_open(struct inode *inode, struct file *file)
 {
-        if (test_and_set_bit(WDT_FLAGS_OPEN, &wdt_flags))
-                return -EBUSY;
+       if (test_and_set_bit(WDT_FLAGS_OPEN, &wdt_flags))
+               return -EBUSY;
 
-        if (!test_and_clear_bit(WDT_FLAGS_ORPHAN, &wdt_flags))
-                __module_get(THIS_MODULE);
+       if (!test_and_clear_bit(WDT_FLAGS_ORPHAN, &wdt_flags))
+               __module_get(THIS_MODULE);
 
        geodewdt_ping();
-        return nonseekable_open(inode, file);
+       return nonseekable_open(inode, file);
 }
 
-static int
-geodewdt_release(struct inode *inode, struct file *file)
+static int geodewdt_release(struct inode *inode, struct file *file)
 {
        if (safe_close) {
                geodewdt_disable();
                module_put(THIS_MODULE);
-       }
-       else {
+       } else {
                printk(KERN_CRIT "Unexpected close - watchdog is not stopping.\n");
                geodewdt_ping();
 
@@ -109,11 +106,10 @@ geodewdt_release(struct inode *inode, struct file *file)
        return 0;
 }
 
-static ssize_t
-geodewdt_write(struct file *file, const char __user *data, size_t len,
-              loff_t *ppos)
+static ssize_t geodewdt_write(struct file *file, const char __user *data,
+                               size_t len, loff_t *ppos)
 {
-        if(len) {
+       if (len) {
                if (!nowayout) {
                        size_t i;
                        safe_close = 0;
@@ -134,9 +130,8 @@ geodewdt_write(struct file *file, const char __user *data, size_t len,
        return len;
 }
 
-static int
-geodewdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-              unsigned long arg)
+static int geodewdt_ioctl(struct inode *inode, struct file *file,
+                               unsigned int cmd, unsigned long arg)
 {
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
@@ -147,9 +142,9 @@ geodewdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
                | WDIOF_MAGICCLOSE,
                .firmware_version =     1,
                .identity =             WATCHDOG_NAME,
-        };
+       };
 
-       switch(cmd) {
+       switch (cmd) {
        case WDIOC_GETSUPPORT:
                return copy_to_user(argp, &ident,
                                    sizeof(ident)) ? -EFAULT : 0;
@@ -159,22 +154,6 @@ geodewdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
        case WDIOC_GETBOOTSTATUS:
                return put_user(0, p);
 
-       case WDIOC_KEEPALIVE:
-               geodewdt_ping();
-               return 0;
-
-       case WDIOC_SETTIMEOUT:
-               if (get_user(interval, p))
-                       return -EFAULT;
-
-               if (geodewdt_set_heartbeat(interval))
-                       return -EINVAL;
-
-/* Fall through */
-
-       case WDIOC_GETTIMEOUT:
-               return put_user(timeout, p);
-
        case WDIOC_SETOPTIONS:
        {
                int options, ret = -EINVAL;
@@ -194,6 +173,20 @@ geodewdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
 
                return ret;
        }
+       case WDIOC_KEEPALIVE:
+               geodewdt_ping();
+               return 0;
+
+       case WDIOC_SETTIMEOUT:
+               if (get_user(interval, p))
+                       return -EFAULT;
+
+               if (geodewdt_set_heartbeat(interval))
+                       return -EINVAL;
+       /* Fall through */
+       case WDIOC_GETTIMEOUT:
+               return put_user(timeout, p);
+
        default:
                return -ENOTTY;
        }
@@ -202,22 +195,21 @@ geodewdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
 }
 
 static const struct file_operations geodewdt_fops = {
-        .owner          = THIS_MODULE,
-        .llseek         = no_llseek,
-        .write          = geodewdt_write,
-        .ioctl          = geodewdt_ioctl,
-        .open           = geodewdt_open,
-        .release        = geodewdt_release,
+       .owner          = THIS_MODULE,
+       .llseek         = no_llseek,
+       .write          = geodewdt_write,
+       .ioctl          = geodewdt_ioctl,
+       .open           = geodewdt_open,
+       .release        = geodewdt_release,
 };
 
 static struct miscdevice geodewdt_miscdev = {
        .minor = WATCHDOG_MINOR,
        .name = "watchdog",
-       .fops = &geodewdt_fops
+       .fops = &geodewdt_fops,
 };
 
-static int __devinit
-geodewdt_probe(struct platform_device *dev)
+static int __devinit geodewdt_probe(struct platform_device *dev)
 {
        int ret, timer;
 
@@ -248,15 +240,13 @@ geodewdt_probe(struct platform_device *dev)
        return ret;
 }
 
-static int __devexit
-geodewdt_remove(struct platform_device *dev)
+static int __devexit geodewdt_remove(struct platform_device *dev)
 {
        misc_deregister(&geodewdt_miscdev);
        return 0;
 }
 
-static void
-geodewdt_shutdown(struct platform_device *dev)
+static void geodewdt_shutdown(struct platform_device *dev)
 {
        geodewdt_disable();
 }
@@ -271,8 +261,7 @@ static struct platform_driver geodewdt_driver = {
        },
 };
 
-static int __init
-geodewdt_init(void)
+static int __init geodewdt_init(void)
 {
        int ret;
 
@@ -292,8 +281,7 @@ err:
        return ret;
 }
 
-static void __exit
-geodewdt_exit(void)
+static void __exit geodewdt_exit(void)
 {
        platform_device_unregister(geodewdt_platform_device);
        platform_driver_unregister(&geodewdt_driver);
index eaa3f2a..d039d5f 100644 (file)
@@ -39,9 +39,7 @@
 #include <linux/string.h>
 #include <linux/bootmem.h>
 #include <linux/slab.h>
-#include <asm/dmi.h>
 #include <asm/desc.h>
-#include <asm/kdebug.h>
 
 #define PCI_BIOS32_SD_VALUE            0x5F32335F      /* "_32_" */
 #define CRU_BIOS_SIGNATURE_VALUE       0x55524324
@@ -407,7 +405,7 @@ static int __devinit detect_cru_service(void)
        dmi_walk(dmi_find_cru);
 
        /* if cru_rom_addr has been set then we found a CRU service */
-       return ((cru_rom_addr != NULL)? 0: -ENODEV);
+       return ((cru_rom_addr != NULL) ? 0: -ENODEV);
 }
 
 /* ------------------------------------------------------------------------- */
@@ -420,7 +418,7 @@ static int __devinit detect_cru_service(void)
 static int hpwdt_pretimeout(struct notifier_block *nb, unsigned long ulReason,
                            void *data)
 {
-       static unsigned long rom_pl;
+       unsigned long rom_pl;
        static int die_nmi_called;
 
        if (ulReason != DIE_NMI && ulReason != DIE_NMI_IPI)
@@ -535,7 +533,7 @@ static ssize_t hpwdt_write(struct file *file, const char __user *data,
                        /* scan to see whether or not we got the magic char. */
                        for (i = 0; i != len; i++) {
                                char c;
-                               if (get_user(c, data+i))
+                               if (get_user(c, data + i))
                                        return -EFAULT;
                                if (c == 'V')
                                        expect_release = 42;
index ca44fd9..c13383f 100644 (file)
@@ -9,18 +9,18 @@
  *     as published by the Free Software Foundation; either version
  *     2 of the License, or (at your option) any later version.
  *
- *      based on i810-tco.c which is in turn based on softdog.c
+ *     based on i810-tco.c which is in turn based on softdog.c
  *
- *     The timer is implemented in the following I/O controller hubs:
- *     (See the intel documentation on http://developer.intel.com.)
- *     6300ESB chip : document number 300641-003
+ *     The timer is implemented in the following I/O controller hubs:
+ *     (See the intel documentation on http://developer.intel.com.)
+ *     6300ESB chip : document number 300641-003
  *
  *  2004YYZZ Ross Biro
  *     Initial version 0.01
  *  2004YYZZ Ross Biro
- *     Version 0.02
+ *     Version 0.02
  *  20050210 David Härdeman <david@2gen.com>
- *      Ported driver to kernel 2.6
+ *     Ported driver to kernel 2.6
  */
 
 /*
@@ -38,9 +38,8 @@
 #include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/ioport.h>
-
-#include <asm/uaccess.h>
-#include <asm/io.h>
+#include <linux/uaccess.h>
+#include <linux/io.h>
 
 /* Module and version information */
 #define ESB_VERSION "0.03"
 #define ESB_RELOAD_REG  BASEADDR + 0x0c /* Reload register                   */
 
 /* Lock register bits */
-#define ESB_WDT_FUNC    ( 0x01 << 2 )   /* Watchdog functionality            */
-#define ESB_WDT_ENABLE  ( 0x01 << 1 )   /* Enable WDT                        */
-#define ESB_WDT_LOCK    ( 0x01 << 0 )   /* Lock (nowayout)                   */
+#define ESB_WDT_FUNC    (0x01 << 2)   /* Watchdog functionality            */
+#define ESB_WDT_ENABLE  (0x01 << 1)   /* Enable WDT                        */
+#define ESB_WDT_LOCK    (0x01 << 0)   /* Lock (nowayout)                   */
 
 /* Config register bits */
-#define ESB_WDT_REBOOT  ( 0x01 << 5 )   /* Enable reboot on timeout          */
-#define ESB_WDT_FREQ    ( 0x01 << 2 )   /* Decrement frequency               */
-#define ESB_WDT_INTTYPE ( 0x11 << 0 )   /* Interrupt type on timer1 timeout  */
+#define ESB_WDT_REBOOT  (0x01 << 5)   /* Enable reboot on timeout          */
+#define ESB_WDT_FREQ    (0x01 << 2)   /* Decrement frequency               */
+#define ESB_WDT_INTTYPE (0x11 << 0)   /* Interrupt type on timer1 timeout  */
 
 /* Reload register bits */
-#define ESB_WDT_RELOAD ( 0x01 << 8 )    /* prevent timeout                   */
+#define ESB_WDT_RELOAD  (0x01 << 8)    /* prevent timeout                   */
 
 /* Magic constants */
 #define ESB_UNLOCK1     0x80            /* Step 1 to unlock reset registers  */
@@ -84,14 +83,20 @@ static unsigned short triggered; /* The status of the watchdog upon boot */
 static char esb_expect_close;
 
 /* module parameters */
-#define WATCHDOG_HEARTBEAT 30   /* 30 sec default heartbeat (1<heartbeat<2*1023) */
+/* 30 sec default heartbeat (1 < heartbeat < 2*1023) */
+#define WATCHDOG_HEARTBEAT 30
 static int heartbeat = WATCHDOG_HEARTBEAT;  /* in seconds */
+
 module_param(heartbeat, int, 0);
-MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (1<heartbeat<2046, default=" __MODULE_STRING(WATCHDOG_HEARTBEAT) ")");
+MODULE_PARM_DESC(heartbeat,
+               "Watchdog heartbeat in seconds. (1<heartbeat<2046, default="
+                               __MODULE_STRING(WATCHDOG_HEARTBEAT) ")");
 
 static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout,
+               "Watchdog cannot be stopped once started (default="
+                               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 /*
  * Some i6300ESB specific functions
@@ -103,9 +108,10 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" _
  * reload register. After this the appropriate registers can be written
  * to once before they need to be unlocked again.
  */
-static inline void esb_unlock_registers(void) {
-        writeb(ESB_UNLOCK1, ESB_RELOAD_REG);
-        writeb(ESB_UNLOCK2, ESB_RELOAD_REG);
+static inline void esb_unlock_registers(void)
+{
+       writeb(ESB_UNLOCK1, ESB_RELOAD_REG);
+       writeb(ESB_UNLOCK2, ESB_RELOAD_REG);
 }
 
 static void esb_timer_start(void)
@@ -114,8 +120,7 @@ static void esb_timer_start(void)
 
        /* Enable or Enable + Lock? */
        val = 0x02 | (nowayout ? 0x01 : 0x00);
-
-        pci_write_config_byte(esb_pci, ESB_LOCK_REG, val);
+       pci_write_config_byte(esb_pci, ESB_LOCK_REG, val);
 }
 
 static int esb_timer_stop(void)
@@ -140,7 +145,7 @@ static void esb_timer_keepalive(void)
        spin_lock(&esb_lock);
        esb_unlock_registers();
        writew(ESB_WDT_RELOAD, ESB_RELOAD_REG);
-        /* FIXME: Do we need to flush anything here? */
+       /* FIXME: Do we need to flush anything here? */
        spin_unlock(&esb_lock);
 }
 
@@ -165,9 +170,9 @@ static int esb_timer_set_heartbeat(int time)
 
        /* Write timer 2 */
        esb_unlock_registers();
-        writel(val, ESB_TIMER2_REG);
+       writel(val, ESB_TIMER2_REG);
 
-        /* Reload */
+       /* Reload */
        esb_unlock_registers();
        writew(ESB_WDT_RELOAD, ESB_RELOAD_REG);
 
@@ -179,54 +184,55 @@ static int esb_timer_set_heartbeat(int time)
        return 0;
 }
 
-static int esb_timer_read (void)
+static int esb_timer_read(void)
 {
-               u32 count;
+       u32 count;
 
        /* This isn't documented, and doesn't take into
-         * acount which stage is running, but it looks
-         * like a 20 bit count down, so we might as well report it.
-         */
-        pci_read_config_dword(esb_pci, 0x64, &count);
-        return (int)count;
+        * acount which stage is running, but it looks
+        * like a 20 bit count down, so we might as well report it.
+        */
+       pci_read_config_dword(esb_pci, 0x64, &count);
+       return (int)count;
 }
 
 /*
- *     /dev/watchdog handling
+ *     /dev/watchdog handling
  */
 
-static int esb_open (struct inode *inode, struct file *file)
+static int esb_open(struct inode *inode, struct file *file)
 {
-        /* /dev/watchdog can only be opened once */
-        if (test_and_set_bit(0, &timer_alive))
-                return -EBUSY;
+       /* /dev/watchdog can only be opened once */
+       if (test_and_set_bit(0, &timer_alive))
+               return -EBUSY;
 
-        /* Reload and activate timer */
-        esb_timer_keepalive ();
-        esb_timer_start ();
+       /* Reload and activate timer */
+       esb_timer_keepalive();
+       esb_timer_start();
 
        return nonseekable_open(inode, file);
 }
 
-static int esb_release (struct inode *inode, struct file *file)
+static int esb_release(struct inode *inode, struct file *file)
 {
-        /* Shut off the timer. */
-        if (esb_expect_close == 42) {
-                esb_timer_stop ();
-        } else {
-                printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
-                esb_timer_keepalive ();
-        }
-        clear_bit(0, &timer_alive);
-        esb_expect_close = 0;
-        return 0;
+       /* Shut off the timer. */
+       if (esb_expect_close == 42)
+               esb_timer_stop();
+       else {
+               printk(KERN_CRIT PFX
+                               "Unexpected close, not stopping watchdog!\n");
+               esb_timer_keepalive();
+       }
+       clear_bit(0, &timer_alive);
+       esb_expect_close = 0;
+       return 0;
 }
 
-static ssize_t esb_write (struct file *file, const char __user *data,
-                         size_t len, loff_t * ppos)
+static ssize_t esb_write(struct file *file, const char __user *data,
+                         size_t len, loff_t *ppos)
 {
        /* See if we got the magic character 'V' and reload the timer */
-        if (len) {
+       if (len) {
                if (!nowayout) {
                        size_t i;
 
@@ -237,7 +243,7 @@ static ssize_t esb_write (struct file *file, const char __user *data,
                        /* scan to see whether or not we got the magic character */
                        for (i = 0; i != len; i++) {
                                char c;
-                               if(get_user(c, data+i))
+                               if (get_user(c, data + i))
                                        return -EFAULT;
                                if (c == 'V')
                                        esb_expect_close = 42;
@@ -245,92 +251,84 @@ static ssize_t esb_write (struct file *file, const char __user *data,
                }
 
                /* someone wrote to us, we should reload the timer */
-               esb_timer_keepalive ();
+               esb_timer_keepalive();
        }
        return len;
 }
 
-static int esb_ioctl (struct inode *inode, struct file *file,
-                     unsigned int cmd, unsigned long arg)
+static long esb_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
        int new_options, retval = -EINVAL;
        int new_heartbeat;
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
        static struct watchdog_info ident = {
-               .options =              WDIOF_SETTIMEOUT |
+               .options =              WDIOF_SETTIMEOUT |
                                        WDIOF_KEEPALIVEPING |
                                        WDIOF_MAGICCLOSE,
-               .firmware_version =     0,
-               .identity =             ESB_MODULE_NAME,
+               .firmware_version =     0,
+               .identity =             ESB_MODULE_NAME,
        };
 
        switch (cmd) {
-               case WDIOC_GETSUPPORT:
-                       return copy_to_user(argp, &ident,
-                                           sizeof (ident)) ? -EFAULT : 0;
-
-               case WDIOC_GETSTATUS:
-                       return put_user (esb_timer_read(), p);
-
-               case WDIOC_GETBOOTSTATUS:
-                       return put_user (triggered, p);
+       case WDIOC_GETSUPPORT:
+               return copy_to_user(argp, &ident,
+                                       sizeof(ident)) ? -EFAULT : 0;
 
-                case WDIOC_KEEPALIVE:
-                        esb_timer_keepalive ();
-                        return 0;
+       case WDIOC_GETSTATUS:
+               return put_user(esb_timer_read(), p);
 
-                case WDIOC_SETOPTIONS:
-                {
-                        if (get_user (new_options, p))
-                                return -EFAULT;
+       case WDIOC_GETBOOTSTATUS:
+               return put_user(triggered, p);
 
-                        if (new_options & WDIOS_DISABLECARD) {
-                                esb_timer_stop ();
-                                retval = 0;
-                        }
+       case WDIOC_SETOPTIONS:
+       {
+               if (get_user(new_options, p))
+                       return -EFAULT;
 
-                        if (new_options & WDIOS_ENABLECARD) {
-                                esb_timer_keepalive ();
-                                esb_timer_start ();
-                                retval = 0;
-                        }
-
-                        return retval;
-                }
-
-                case WDIOC_SETTIMEOUT:
-                {
-                        if (get_user(new_heartbeat, p))
-                                return -EFAULT;
-
-                        if (esb_timer_set_heartbeat(new_heartbeat))
-                            return -EINVAL;
-
-                        esb_timer_keepalive ();
-                        /* Fall */
-                }
-
-                case WDIOC_GETTIMEOUT:
-                        return put_user(heartbeat, p);
+               if (new_options & WDIOS_DISABLECARD) {
+                       esb_timer_stop();
+                       retval = 0;
+               }
 
-                default:
-                        return -ENOTTY;
-        }
+               if (new_options & WDIOS_ENABLECARD) {
+                       esb_timer_keepalive();
+                       esb_timer_start();
+                       retval = 0;
+               }
+               return retval;
+       }
+       case WDIOC_KEEPALIVE:
+               esb_timer_keepalive();
+               return 0;
+
+       case WDIOC_SETTIMEOUT:
+       {
+               if (get_user(new_heartbeat, p))
+                       return -EFAULT;
+               if (esb_timer_set_heartbeat(new_heartbeat))
+                       return -EINVAL;
+               esb_timer_keepalive();
+               /* Fall */
+       }
+       case WDIOC_GETTIMEOUT:
+               return put_user(heartbeat, p);
+       default:
+               return -ENOTTY;
+       }
 }
 
 /*
  *      Notify system
  */
 
-static int esb_notify_sys (struct notifier_block *this, unsigned long code, void *unused)
+static int esb_notify_sys(struct notifier_block *this,
+                                       unsigned long code, void *unused)
 {
-        if (code==SYS_DOWN || code==SYS_HALT) {
-                /* Turn the WDT off */
-                esb_timer_stop ();
-        }
+       if (code == SYS_DOWN || code == SYS_HALT)
+               esb_timer_stop();       /* Turn the WDT off */
 
-        return NOTIFY_DONE;
+       return NOTIFY_DONE;
 }
 
 /*
@@ -338,22 +336,22 @@ static int esb_notify_sys (struct notifier_block *this, unsigned long code, void
  */
 
 static const struct file_operations esb_fops = {
-        .owner =        THIS_MODULE,
-        .llseek =       no_llseek,
-        .write =        esb_write,
-        .ioctl =        esb_ioctl,
-        .open =         esb_open,
-        .release =      esb_release,
+       .owner = THIS_MODULE,
+       .llseek = no_llseek,
+       .write = esb_write,
+       .unlocked_ioctl = esb_ioctl,
+       .open = esb_open,
+       .release = esb_release,
 };
 
 static struct miscdevice esb_miscdev = {
-        .minor =        WATCHDOG_MINOR,
-        .name =         "watchdog",
-        .fops =         &esb_fops,
+       .minor = WATCHDOG_MINOR,
+       .name = "watchdog",
+       .fops = &esb_fops,
 };
 
 static struct notifier_block esb_notifier = {
-        .notifier_call =        esb_notify_sys,
+       .notifier_call = esb_notify_sys,
 };
 
 /*
@@ -365,50 +363,44 @@ static struct notifier_block esb_notifier = {
  * want to register another driver on the same PCI id.
  */
 static struct pci_device_id esb_pci_tbl[] = {
-        { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_9), },
-        { 0, },                 /* End of list */
+       { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_9), },
+       { 0, },                 /* End of list */
 };
-MODULE_DEVICE_TABLE (pci, esb_pci_tbl);
+MODULE_DEVICE_TABLE(pci, esb_pci_tbl);
 
 /*
  *      Init & exit routines
  */
 
-static unsigned char __init esb_getdevice (void)
+static unsigned char __init esb_getdevice(void)
 {
        u8 val1;
        unsigned short val2;
+       /*
+        *      Find the PCI device
+        */
 
-        struct pci_dev *dev = NULL;
-        /*
-         *      Find the PCI device
-         */
-
-        for_each_pci_dev(dev) {
-                if (pci_match_id(esb_pci_tbl, dev)) {
-                        esb_pci = dev;
-                        break;
-                }
-       }
+       esb_pci = pci_get_device(PCI_VENDOR_ID_INTEL,
+                                       PCI_DEVICE_ID_INTEL_ESB_9, NULL);
 
-        if (esb_pci) {
-               if (pci_enable_device(esb_pci)) {
-                       printk (KERN_ERR PFX "failed to enable device\n");
+       if (esb_pci) {
+               if (pci_enable_device(esb_pci)) {
+                       printk(KERN_ERR PFX "failed to enable device\n");
                        goto err_devput;
                }
 
                if (pci_request_region(esb_pci, 0, ESB_MODULE_NAME)) {
-                       printk (KERN_ERR PFX "failed to request region\n");
+                       printk(KERN_ERR PFX "failed to request region\n");
                        goto err_disable;
                }
 
                BASEADDR = ioremap(pci_resource_start(esb_pci, 0),
                                   pci_resource_len(esb_pci, 0));
                if (BASEADDR == NULL) {
-                       /* Something's wrong here, BASEADDR has to be set */
-                       printk (KERN_ERR PFX "failed to get BASEADDR\n");
-                        goto err_release;
-                }
+                       /* Something's wrong here, BASEADDR has to be set */
+                       printk(KERN_ERR PFX "failed to get BASEADDR\n");
+                       goto err_release;
+               }
 
                /*
                 * The watchdog has two timers, it can be setup so that the
@@ -425,7 +417,7 @@ static unsigned char __init esb_getdevice (void)
                /* Check that the WDT isn't already locked */
                pci_read_config_byte(esb_pci, ESB_LOCK_REG, &val1);
                if (val1 & ESB_WDT_LOCK)
-                       printk (KERN_WARNING PFX "nowayout already set\n");
+                       printk(KERN_WARNING PFX "nowayout already set\n");
 
                /* Set the timer to watchdog mode and disable it for now */
                pci_write_config_byte(esb_pci, ESB_LOCK_REG, 0x00);
@@ -452,44 +444,44 @@ err_devput:
        return 0;
 }
 
-static int __init watchdog_init (void)
+static int __init watchdog_init(void)
 {
-        int ret;
-
-        /* Check whether or not the hardware watchdog is there */
-        if (!esb_getdevice () || esb_pci == NULL)
-                return -ENODEV;
-
-        /* Check that the heartbeat value is within it's range ; if not reset to the default */
-        if (esb_timer_set_heartbeat (heartbeat)) {
-                esb_timer_set_heartbeat (WATCHDOG_HEARTBEAT);
-                printk(KERN_INFO PFX "heartbeat value must be 1<heartbeat<2046, using %d\n",
-                      heartbeat);
-        }
-
-        ret = register_reboot_notifier(&esb_notifier);
-        if (ret != 0) {
-                printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
-                        ret);
-                goto err_unmap;
-        }
-
-        ret = misc_register(&esb_miscdev);
-        if (ret != 0) {
-                printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
-                        WATCHDOG_MINOR, ret);
-                goto err_notifier;
-        }
-
-        esb_timer_stop ();
-
-        printk (KERN_INFO PFX "initialized (0x%p). heartbeat=%d sec (nowayout=%d)\n",
-                BASEADDR, heartbeat, nowayout);
+       int ret;
+
+       /* Check whether or not the hardware watchdog is there */
+       if (!esb_getdevice() || esb_pci == NULL)
+               return -ENODEV;
+
+       /* Check that the heartbeat value is within it's range;
+          if not reset to the default */
+       if (esb_timer_set_heartbeat(heartbeat)) {
+               esb_timer_set_heartbeat(WATCHDOG_HEARTBEAT);
+               printk(KERN_INFO PFX
+                       "heartbeat value must be 1<heartbeat<2046, using %d\n",
+                                                               heartbeat);
+       }
+       ret = register_reboot_notifier(&esb_notifier);
+       if (ret != 0) {
+               printk(KERN_ERR PFX
+                       "cannot register reboot notifier (err=%d)\n", ret);
+               goto err_unmap;
+       }
 
-        return 0;
+       ret = misc_register(&esb_miscdev);
+       if (ret != 0) {
+               printk(KERN_ERR PFX
+                       "cannot register miscdev on minor=%d (err=%d)\n",
+                                                       WATCHDOG_MINOR, ret);
+               goto err_notifier;
+       }
+       esb_timer_stop();
+       printk(KERN_INFO PFX
+               "initialized (0x%p). heartbeat=%d sec (nowayout=%d)\n",
+                                               BASEADDR, heartbeat, nowayout);
+       return 0;
 
 err_notifier:
-        unregister_reboot_notifier(&esb_notifier);
+       unregister_reboot_notifier(&esb_notifier);
 err_unmap:
        iounmap(BASEADDR);
 /* err_release: */
@@ -498,18 +490,18 @@ err_unmap:
        pci_disable_device(esb_pci);
 /* err_devput: */
        pci_dev_put(esb_pci);
-        return ret;
+       return ret;
 }
 
-static void __exit watchdog_cleanup (void)
+static void __exit watchdog_cleanup(void)
 {
        /* Stop the timer before we leave */
        if (!nowayout)
-               esb_timer_stop ();
+               esb_timer_stop();
 
        /* Deregister */
        misc_deregister(&esb_miscdev);
-        unregister_reboot_notifier(&esb_notifier);
+       unregister_reboot_notifier(&esb_notifier);
        iounmap(BASEADDR);
        pci_release_region(esb_pci, 0);
        pci_disable_device(esb_pci);
diff --git a/drivers/watchdog/iTCO_vendor.h b/drivers/watchdog/iTCO_vendor.h
new file mode 100644 (file)
index 0000000..9e27e64
--- /dev/null
@@ -0,0 +1,15 @@
+/* iTCO Vendor Specific Support hooks */
+#ifdef CONFIG_ITCO_VENDOR_SUPPORT
+extern void iTCO_vendor_pre_start(unsigned long, unsigned int);
+extern void iTCO_vendor_pre_stop(unsigned long);
+extern void iTCO_vendor_pre_keepalive(unsigned long, unsigned int);
+extern void iTCO_vendor_pre_set_heartbeat(unsigned int);
+extern int iTCO_vendor_check_noreboot_on(void);
+#else
+#define iTCO_vendor_pre_start(acpibase, heartbeat)     {}
+#define iTCO_vendor_pre_stop(acpibase)                 {}
+#define iTCO_vendor_pre_keepalive(acpibase, heartbeat) {}
+#define iTCO_vendor_pre_set_heartbeat(heartbeat)       {}
+#define iTCO_vendor_check_noreboot_on()                        1
+                               /* 1=check noreboot; 0=don't check */
+#endif
index cafc465..ca344a8 100644 (file)
@@ -18,9 +18,9 @@
  */
 
 /* Module and version information */
-#define DRV_NAME        "iTCO_vendor_support"
-#define DRV_VERSION     "1.01"
-#define DRV_RELDATE     "11-Nov-2006"
+#define DRV_NAME       "iTCO_vendor_support"
+#define DRV_VERSION    "1.01"
+#define DRV_RELDATE    "11-Nov-2006"
 #define PFX            DRV_NAME ": "
 
 /* Includes */
 #include <linux/kernel.h>              /* For printk/panic/... */
 #include <linux/init.h>                        /* For __init/__exit/... */
 #include <linux/ioport.h>              /* For io-port access */
+#include <linux/io.h>                  /* For inb/outb/... */
 
-#include <asm/io.h>                    /* For inb/outb/... */
+#include "iTCO_vendor.h"
 
 /* iTCO defines */
 #define        SMI_EN          acpibase + 0x30 /* SMI Control and Enable Register */
-#define        TCOBASE         acpibase + 0x60 /* TCO base address             */
-#define        TCO1_STS        TCOBASE + 0x04  /* TCO1 Status Register         */
+#define        TCOBASE         acpibase + 0x60 /* TCO base address */
+#define        TCO1_STS        TCOBASE + 0x04  /* TCO1 Status Register */
 
 /* List of vendor support modes */
-#define SUPERMICRO_OLD_BOARD   1       /* SuperMicro Pentium 3 Era 370SSE+-OEM1/P3TSSE */
-#define SUPERMICRO_NEW_BOARD   2       /* SuperMicro Pentium 4 / Xeon 4 / EMT64T Era Systems */
+/* SuperMicro Pentium 3 Era 370SSE+-OEM1/P3TSSE */
+#define SUPERMICRO_OLD_BOARD   1
+/* SuperMicro Pentium 4 / Xeon 4 / EMT64T Era Systems */
+#define SUPERMICRO_NEW_BOARD   2
 
-static int vendorsupport = 0;
+static int vendorsupport;
 module_param(vendorsupport, int, 0);
 MODULE_PARM_DESC(vendorsupport, "iTCO vendor specific support mode, default=0 (none), 1=SuperMicro Pent3, 2=SuperMicro Pent4+");
 
@@ -143,34 +146,35 @@ static void supermicro_old_pre_keepalive(unsigned long acpibase)
  */
 
 /* I/O Port's */
-#define SM_REGINDEX    0x2e            /* SuperMicro ICH4+ Register Index */
-#define SM_DATAIO      0x2f            /* SuperMicro ICH4+ Register Data I/O */
+#define SM_REGINDEX    0x2e    /* SuperMicro ICH4+ Register Index */
+#define SM_DATAIO      0x2f    /* SuperMicro ICH4+ Register Data I/O */
 
 /* Control Register's */
-#define SM_CTLPAGESW   0x07            /* SuperMicro ICH4+ Control Page Switch */
-#define SM_CTLPAGE             0x08    /* SuperMicro ICH4+ Control Page Num */
+#define SM_CTLPAGESW   0x07    /* SuperMicro ICH4+ Control Page Switch */
+#define SM_CTLPAGE     0x08    /* SuperMicro ICH4+ Control Page Num */
 
-#define SM_WATCHENABLE 0x30            /* Watchdog enable: Bit 0: 0=off, 1=on */
+#define SM_WATCHENABLE 0x30    /* Watchdog enable: Bit 0: 0=off, 1=on */
 
-#define SM_WATCHPAGE   0x87            /* Watchdog unlock control page */
+#define SM_WATCHPAGE   0x87    /* Watchdog unlock control page */
 
-#define SM_ENDWATCH    0xAA            /* Watchdog lock control page */
+#define SM_ENDWATCH    0xAA    /* Watchdog lock control page */
 
-#define SM_COUNTMODE   0xf5            /* Watchdog count mode select */
-                                       /* (Bit 3: 0 = seconds, 1 = minutes */
+#define SM_COUNTMODE   0xf5    /* Watchdog count mode select */
+                               /* (Bit 3: 0 = seconds, 1 = minutes */
 
-#define SM_WATCHTIMER  0xf6            /* 8-bits, Watchdog timer counter (RW) */
+#define SM_WATCHTIMER  0xf6    /* 8-bits, Watchdog timer counter (RW) */
 
-#define SM_RESETCONTROL        0xf7            /* Watchdog reset control */
-                                       /* Bit 6: timer is reset by kbd interrupt */
-                                       /* Bit 7: timer is reset by mouse interrupt */
+#define SM_RESETCONTROL        0xf7    /* Watchdog reset control */
+                               /* Bit 6: timer is reset by kbd interrupt */
+                               /* Bit 7: timer is reset by mouse interrupt */
 
 static void supermicro_new_unlock_watchdog(void)
 {
-       outb(SM_WATCHPAGE, SM_REGINDEX);        /* Write 0x87 to port 0x2e twice */
+       /* Write 0x87 to port 0x2e twice */
        outb(SM_WATCHPAGE, SM_REGINDEX);
-
-       outb(SM_CTLPAGESW, SM_REGINDEX);        /* Switch to watchdog control page */
+       outb(SM_WATCHPAGE, SM_REGINDEX);
+       /* Switch to watchdog control page */
+       outb(SM_CTLPAGESW, SM_REGINDEX);
        outb(SM_CTLPAGE, SM_DATAIO);
 }
 
@@ -192,7 +196,7 @@ static void supermicro_new_pre_start(unsigned int heartbeat)
        outb(val, SM_DATAIO);
 
        /* Write heartbeat interval to WDOG */
-       outb (SM_WATCHTIMER, SM_REGINDEX);
+       outb(SM_WATCHTIMER, SM_REGINDEX);
        outb((heartbeat & 255), SM_DATAIO);
 
        /* Make sure keyboard/mouse interrupts don't interfere */
@@ -277,7 +281,7 @@ EXPORT_SYMBOL(iTCO_vendor_pre_set_heartbeat);
 
 int iTCO_vendor_check_noreboot_on(void)
 {
-       switch(vendorsupport) {
+       switch (vendorsupport) {
        case SUPERMICRO_OLD_BOARD:
                return 0;
        default:
@@ -288,13 +292,13 @@ EXPORT_SYMBOL(iTCO_vendor_check_noreboot_on);
 
 static int __init iTCO_vendor_init_module(void)
 {
-       printk (KERN_INFO PFX "vendor-support=%d\n", vendorsupport);
+       printk(KERN_INFO PFX "vendor-support=%d\n", vendorsupport);
        return 0;
 }
 
 static void __exit iTCO_vendor_exit_module(void)
 {
-       printk (KERN_INFO PFX "Module Unloaded\n");
+       printk(KERN_INFO PFX "Module Unloaded\n");
 }
 
 module_init(iTCO_vendor_init_module);
index 95ba985..bfb93bc 100644 (file)
@@ -55,9 +55,9 @@
  */
 
 /* Module and version information */
-#define DRV_NAME        "iTCO_wdt"
-#define DRV_VERSION     "1.03"
-#define DRV_RELDATE     "30-Apr-2008"
+#define DRV_NAME       "iTCO_wdt"
+#define DRV_VERSION    "1.03"
+#define DRV_RELDATE    "30-Apr-2008"
 #define PFX            DRV_NAME ": "
 
 /* Includes */
@@ -66,7 +66,8 @@
 #include <linux/types.h>               /* For standard types (like size_t) */
 #include <linux/errno.h>               /* For the -ENODEV/... values */
 #include <linux/kernel.h>              /* For printk/panic/... */
-#include <linux/miscdevice.h>          /* For MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR) */
+#include <linux/miscdevice.h>          /* For MODULE_ALIAS_MISCDEV
+                                                       (WATCHDOG_MINOR) */
 #include <linux/watchdog.h>            /* For the watchdog specific items */
 #include <linux/init.h>                        /* For __init/__exit/... */
 #include <linux/fs.h>                  /* For file operations */
 #include <linux/pci.h>                 /* For pci functions */
 #include <linux/ioport.h>              /* For io-port access */
 #include <linux/spinlock.h>            /* For spin_lock/spin_unlock/... */
+#include <linux/uaccess.h>             /* For copy_to_user/put_user/... */
+#include <linux/io.h>                  /* For inb/outb/... */
 
-#include <asm/uaccess.h>               /* For copy_to_user/put_user/... */
-#include <asm/io.h>                    /* For inb/outb/... */
+#include "iTCO_vendor.h"
 
 /* TCO related info */
 enum iTCO_chipsets {
@@ -105,7 +107,7 @@ enum iTCO_chipsets {
        TCO_ICH9,       /* ICH9 */
        TCO_ICH9R,      /* ICH9R */
        TCO_ICH9DH,     /* ICH9DH */
-       TCO_ICH9DO,     /* ICH9DO */
+       TCO_ICH9DO,     /* ICH9DO */
        TCO_631XESB,    /* 631xESB/632xESB */
 };
 
@@ -140,7 +142,7 @@ static struct {
        {"ICH9DH", 2},
        {"ICH9DO", 2},
        {"631xESB/632xESB", 2},
-       {NULL,0}
+       {NULL, 0}
 };
 
 #define ITCO_PCI_DEVICE(dev, data)     \
@@ -159,32 +161,32 @@ static struct {
  * functions that probably will be registered by other drivers.
  */
 static struct pci_device_id iTCO_wdt_pci_tbl[] = {
-       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801AA_0,        TCO_ICH    )},
-       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801AB_0,        TCO_ICH0   )},
-       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801BA_0,        TCO_ICH2   )},
-       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801BA_10,       TCO_ICH2M  )},
-       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801CA_0,        TCO_ICH3   )},
-       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801CA_12,       TCO_ICH3M  )},
-       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801DB_0,        TCO_ICH4   )},
-       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801DB_12,       TCO_ICH4M  )},
-       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801E_0,         TCO_CICH   )},
-       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801EB_0,        TCO_ICH5   )},
+       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801AA_0,        TCO_ICH)},
+       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801AB_0,        TCO_ICH0)},
+       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801BA_0,        TCO_ICH2)},
+       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801BA_10,       TCO_ICH2M)},
+       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801CA_0,        TCO_ICH3)},
+       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801CA_12,       TCO_ICH3M)},
+       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801DB_0,        TCO_ICH4)},
+       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801DB_12,       TCO_ICH4M)},
+       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801E_0,         TCO_CICH)},
+       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801EB_0,        TCO_ICH5)},
        { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ESB_1,            TCO_6300ESB)},
-       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH6_0,           TCO_ICH6   )},
-       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH6_1,           TCO_ICH6M  )},
-       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH6_2,           TCO_ICH6W  )},
-       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH7_0,           TCO_ICH7   )},
-       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH7_1,           TCO_ICH7M  )},
+       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH6_0,           TCO_ICH6)},
+       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH6_1,           TCO_ICH6M)},
+       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH6_2,           TCO_ICH6W)},
+       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH7_0,           TCO_ICH7)},
+       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH7_1,           TCO_ICH7M)},
        { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH7_31,          TCO_ICH7MDH)},
-       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_0,           TCO_ICH8   )},
-       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_1,           TCO_ICH8ME )},
-       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_2,           TCO_ICH8DH )},
-       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_3,           TCO_ICH8DO )},
-       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_4,           TCO_ICH8M  )},
-       { ITCO_PCI_DEVICE(0x2918,                               TCO_ICH9   )},
-       { ITCO_PCI_DEVICE(0x2916,                               TCO_ICH9R  )},
-       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH9_2,           TCO_ICH9DH )},
-       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH9_4,           TCO_ICH9DO )},
+       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_0,           TCO_ICH8)},
+       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_1,           TCO_ICH8ME)},
+       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_2,           TCO_ICH8DH)},
+       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_3,           TCO_ICH8DO)},
+       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_4,           TCO_ICH8M)},
+       { ITCO_PCI_DEVICE(0x2918,                               TCO_ICH9)},
+       { ITCO_PCI_DEVICE(0x2916,                               TCO_ICH9R)},
+       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH9_2,           TCO_ICH9DH)},
+       { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH9_4,           TCO_ICH9DO)},
        { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ESB2_0,           TCO_631XESB)},
        { ITCO_PCI_DEVICE(0x2671,                               TCO_631XESB)},
        { ITCO_PCI_DEVICE(0x2672,                               TCO_631XESB)},
@@ -203,13 +205,15 @@ static struct pci_device_id iTCO_wdt_pci_tbl[] = {
        { ITCO_PCI_DEVICE(0x267f,                               TCO_631XESB)},
        { 0, },                 /* End of list */
 };
-MODULE_DEVICE_TABLE (pci, iTCO_wdt_pci_tbl);
+MODULE_DEVICE_TABLE(pci, iTCO_wdt_pci_tbl);
 
 /* Address definitions for the TCO */
-#define        TCOBASE         iTCO_wdt_private.ACPIBASE + 0x60        /* TCO base address                */
-#define        SMI_EN          iTCO_wdt_private.ACPIBASE + 0x30        /* SMI Control and Enable Register */
+/* TCO base address */
+#define        TCOBASE         iTCO_wdt_private.ACPIBASE + 0x60
+/* SMI Control and Enable Register */
+#define        SMI_EN          iTCO_wdt_private.ACPIBASE + 0x30
 
-#define TCO_RLD                TCOBASE + 0x00  /* TCO Timer Reload and Current Value */
+#define TCO_RLD                TCOBASE + 0x00  /* TCO Timer Reload and Curr. Value */
 #define TCOv1_TMR      TCOBASE + 0x01  /* TCOv1 Timer Initial Value    */
 #define        TCO_DAT_IN      TCOBASE + 0x02  /* TCO Data In Register         */
 #define        TCO_DAT_OUT     TCOBASE + 0x03  /* TCO Data Out Register        */
@@ -222,15 +226,21 @@ MODULE_DEVICE_TABLE (pci, iTCO_wdt_pci_tbl);
 /* internal variables */
 static unsigned long is_active;
 static char expect_release;
-static struct {                                /* this is private data for the iTCO_wdt device */
-       unsigned int iTCO_version;      /* TCO version/generation */
-       unsigned long ACPIBASE;         /* The cards ACPIBASE address (TCOBASE = ACPIBASE+0x60) */
-       unsigned long __iomem *gcs;     /* NO_REBOOT flag is Memory-Mapped GCS register bit 5 (TCO version 2) */
-       spinlock_t io_lock;             /* the lock for io operations */
-       struct pci_dev *pdev;           /* the PCI-device */
+static struct {                /* this is private data for the iTCO_wdt device */
+       /* TCO version/generation */
+       unsigned int iTCO_version;
+       /* The cards ACPIBASE address (TCOBASE = ACPIBASE+0x60) */
+       unsigned long ACPIBASE;
+       /* NO_REBOOT flag is Memory-Mapped GCS register bit 5 (TCO version 2)*/
+       unsigned long __iomem *gcs;
+       /* the lock for io operations */
+       spinlock_t io_lock;
+       /* the PCI-device */
+       struct pci_dev *pdev;
 } iTCO_wdt_private;
 
-static struct platform_device *iTCO_wdt_platform_device;       /* the watchdog platform device */
+/* the watchdog platform device */
+static struct platform_device *iTCO_wdt_platform_device;
 
 /* module parameters */
 #define WATCHDOG_HEARTBEAT 30  /* 30 sec default heartbeat */
@@ -240,22 +250,9 @@ MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (2<heartbeat<39 (TCO
 
 static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
-
-/* iTCO Vendor Specific Support hooks */
-#ifdef CONFIG_ITCO_VENDOR_SUPPORT
-extern void iTCO_vendor_pre_start(unsigned long, unsigned int);
-extern void iTCO_vendor_pre_stop(unsigned long);
-extern void iTCO_vendor_pre_keepalive(unsigned long, unsigned int);
-extern void iTCO_vendor_pre_set_heartbeat(unsigned int);
-extern int iTCO_vendor_check_noreboot_on(void);
-#else
-#define iTCO_vendor_pre_start(acpibase, heartbeat)     {}
-#define iTCO_vendor_pre_stop(acpibase)                 {}
-#define iTCO_vendor_pre_keepalive(acpibase,heartbeat)  {}
-#define iTCO_vendor_pre_set_heartbeat(heartbeat)       {}
-#define iTCO_vendor_check_noreboot_on()                        1       /* 1=check noreboot; 0=don't check */
-#endif
+MODULE_PARM_DESC(nowayout,
+       "Watchdog cannot be stopped once started (default="
+                               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 /*
  * Some TCO specific functions
@@ -369,11 +366,10 @@ static int iTCO_wdt_keepalive(void)
        iTCO_vendor_pre_keepalive(iTCO_wdt_private.ACPIBASE, heartbeat);
 
        /* Reload the timer by writing to the TCO Timer Counter register */
-       if (iTCO_wdt_private.iTCO_version == 2) {
+       if (iTCO_wdt_private.iTCO_version == 2)
                outw(0x01, TCO_RLD);
-       } else if (iTCO_wdt_private.iTCO_version == 1) {
+       else if (iTCO_wdt_private.iTCO_version == 1)
                outb(0x01, TCO_RLD);
-       }
 
        spin_unlock(&iTCO_wdt_private.io_lock);
        return 0;
@@ -425,7 +421,7 @@ static int iTCO_wdt_set_heartbeat(int t)
        return 0;
 }
 
-static int iTCO_wdt_get_timeleft (int *time_left)
+static int iTCO_wdt_get_timeleft(int *time_left)
 {
        unsigned int val16;
        unsigned char val8;
@@ -454,7 +450,7 @@ static int iTCO_wdt_get_timeleft (int *time_left)
  *     /dev/watchdog handling
  */
 
-static int iTCO_wdt_open (struct inode *inode, struct file *file)
+static int iTCO_wdt_open(struct inode *inode, struct file *file)
 {
        /* /dev/watchdog can only be opened once */
        if (test_and_set_bit(0, &is_active))
@@ -468,7 +464,7 @@ static int iTCO_wdt_open (struct inode *inode, struct file *file)
        return nonseekable_open(inode, file);
 }
 
-static int iTCO_wdt_release (struct inode *inode, struct file *file)
+static int iTCO_wdt_release(struct inode *inode, struct file *file)
 {
        /*
         *      Shut off the timer.
@@ -476,7 +472,8 @@ static int iTCO_wdt_release (struct inode *inode, struct file *file)
        if (expect_release == 42) {
                iTCO_wdt_stop();
        } else {
-               printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
+               printk(KERN_CRIT PFX
+                       "Unexpected close, not stopping watchdog!\n");
                iTCO_wdt_keepalive();
        }
        clear_bit(0, &is_active);
@@ -484,22 +481,23 @@ static int iTCO_wdt_release (struct inode *inode, struct file *file)
        return 0;
 }
 
-static ssize_t iTCO_wdt_write (struct file *file, const char __user *data,
-                             size_t len, loff_t * ppos)
+static ssize_t iTCO_wdt_write(struct file *file, const char __user *data,
+                             size_t len, loff_t *ppos)
 {
        /* See if we got the magic character 'V' and reload the timer */
        if (len) {
                if (!nowayout) {
                        size_t i;
 
-                       /* note: just in case someone wrote the magic character
-                        * five months ago... */
+                       /* note: just in case someone wrote the magic
+                          character five months ago... */
                        expect_release = 0;
 
-                       /* scan to see whether or not we got the magic character */
+                       /* scan to see whether or not we got the
+                          magic character */
                        for (i = 0; i != len; i++) {
                                char c;
-                               if (get_user(c, data+i))
+                               if (get_user(c, data + i))
                                        return -EFAULT;
                                if (c == 'V')
                                        expect_release = 42;
@@ -512,8 +510,8 @@ static ssize_t iTCO_wdt_write (struct file *file, const char __user *data,
        return len;
 }
 
-static int iTCO_wdt_ioctl (struct inode *inode, struct file *file,
-                         unsigned int cmd, unsigned long arg)
+static long iTCO_wdt_ioctl(struct file *file, unsigned int cmd,
+                                                       unsigned long arg)
 {
        int new_options, retval = -EINVAL;
        int new_heartbeat;
@@ -528,64 +526,52 @@ static int iTCO_wdt_ioctl (struct inode *inode, struct file *file,
        };
 
        switch (cmd) {
-               case WDIOC_GETSUPPORT:
-                       return copy_to_user(argp, &ident,
-                               sizeof (ident)) ? -EFAULT : 0;
-
-               case WDIOC_GETSTATUS:
-               case WDIOC_GETBOOTSTATUS:
-                       return put_user(0, p);
-
-               case WDIOC_KEEPALIVE:
-                       iTCO_wdt_keepalive();
-                       return 0;
-
-               case WDIOC_SETOPTIONS:
-               {
-                       if (get_user(new_options, p))
-                               return -EFAULT;
-
-                       if (new_options & WDIOS_DISABLECARD) {
-                               iTCO_wdt_stop();
-                               retval = 0;
-                       }
-
-                       if (new_options & WDIOS_ENABLECARD) {
-                               iTCO_wdt_keepalive();
-                               iTCO_wdt_start();
-                               retval = 0;
-                       }
-
-                       return retval;
+       case WDIOC_GETSUPPORT:
+               return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
+       case WDIOC_GETSTATUS:
+       case WDIOC_GETBOOTSTATUS:
+               return put_user(0, p);
+
+       case WDIOC_SETOPTIONS:
+       {
+               if (get_user(new_options, p))
+                       return -EFAULT;
+
+               if (new_options & WDIOS_DISABLECARD) {
+                       iTCO_wdt_stop();
+                       retval = 0;
                }
-
-               case WDIOC_SETTIMEOUT:
-               {
-                       if (get_user(new_heartbeat, p))
-                               return -EFAULT;
-
-                       if (iTCO_wdt_set_heartbeat(new_heartbeat))
-                               return -EINVAL;
-
+               if (new_options & WDIOS_ENABLECARD) {
                        iTCO_wdt_keepalive();
-                       /* Fall */
-               }
-
-               case WDIOC_GETTIMEOUT:
-                       return put_user(heartbeat, p);
-
-               case WDIOC_GETTIMELEFT:
-               {
-                       int time_left;
-
-                       if (iTCO_wdt_get_timeleft(&time_left))
-                               return -EINVAL;
-
-                       return put_user(time_left, p);
+                       iTCO_wdt_start();
+                       retval = 0;
                }
+               return retval;
+       }
+       case WDIOC_KEEPALIVE:
+               iTCO_wdt_keepalive();
+               return 0;
 
-               default:
-                       return -ENOTTY;
+       case WDIOC_SETTIMEOUT:
+       {
+               if (get_user(new_heartbeat, p))
+                       return -EFAULT;
+               if (iTCO_wdt_set_heartbeat(new_heartbeat))
+                       return -EINVAL;
+               iTCO_wdt_keepalive();
+               /* Fall */
+       }
+       case WDIOC_GETTIMEOUT:
+               return put_user(heartbeat, p);
+       case WDIOC_GETTIMELEFT:
+       {
+               int time_left;
+               if (iTCO_wdt_get_timeleft(&time_left))
+                       return -EINVAL;
+               return put_user(time_left, p);
+       }
+       default:
+               return -ENOTTY;
        }
 }
 
@@ -594,12 +580,12 @@ static int iTCO_wdt_ioctl (struct inode *inode, struct file *file,
  */
 
 static const struct file_operations iTCO_wdt_fops = {
-       .owner =        THIS_MODULE,
-       .llseek =       no_llseek,
-       .write =        iTCO_wdt_write,
-       .ioctl =        iTCO_wdt_ioctl,
-       .open =         iTCO_wdt_open,
-       .release =      iTCO_wdt_release,
+       .owner =                THIS_MODULE,
+       .llseek =               no_llseek,
+       .write =                iTCO_wdt_write,
+       .unlocked_ioctl =       iTCO_wdt_ioctl,
+       .open =                 iTCO_wdt_open,
+       .release =              iTCO_wdt_release,
 };
 
 static struct miscdevice iTCO_wdt_miscdev = {
@@ -612,7 +598,8 @@ static struct miscdevice iTCO_wdt_miscdev = {
  *     Init & exit routines
  */
 
-static int __devinit iTCO_wdt_init(struct pci_dev *pdev, const struct pci_device_id *ent, struct platform_device *dev)
+static int __devinit iTCO_wdt_init(struct pci_dev *pdev,
+               const struct pci_device_id *ent, struct platform_device *dev)
 {
        int ret;
        u32 base_address;
@@ -632,17 +619,19 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev, const struct pci_device
                pci_dev_put(pdev);
                return -ENODEV;
        }
-       iTCO_wdt_private.iTCO_version = iTCO_chipset_info[ent->driver_data].iTCO_version;
+       iTCO_wdt_private.iTCO_version =
+                       iTCO_chipset_info[ent->driver_data].iTCO_version;
        iTCO_wdt_private.ACPIBASE = base_address;
        iTCO_wdt_private.pdev = pdev;
 
-       /* Get the Memory-Mapped GCS register, we need it for the NO_REBOOT flag (TCO v2) */
-       /* To get access to it you have to read RCBA from PCI Config space 0xf0
-          and use it as base. GCS = RCBA + ICH6_GCS(0x3410). */
+       /* Get the Memory-Mapped GCS register, we need it for the
+          NO_REBOOT flag (TCO v2). To get access to it you have to
+          read RCBA from PCI Config space 0xf0 and use it as base.
+          GCS = RCBA + ICH6_GCS(0x3410). */
        if (iTCO_wdt_private.iTCO_version == 2) {
                pci_read_config_dword(pdev, 0xf0, &base_address);
                RCBA = base_address & 0xffffc000;
-               iTCO_wdt_private.gcs = ioremap((RCBA + 0x3410),4);
+               iTCO_wdt_private.gcs = ioremap((RCBA + 0x3410), 4);
        }
 
        /* Check chipset's NO_REBOOT bit */
@@ -657,8 +646,8 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev, const struct pci_device
 
        /* Set the TCO_EN bit in SMI_EN register */
        if (!request_region(SMI_EN, 4, "iTCO_wdt")) {
-               printk(KERN_ERR PFX "I/O address 0x%04lx already in use\n",
-                       SMI_EN );
+               printk(KERN_ERR PFX
+                       "I/O address 0x%04lx already in use\n", SMI_EN);
                ret = -EIO;
                goto out;
        }
@@ -667,18 +656,20 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev, const struct pci_device
        outl(val32, SMI_EN);
        release_region(SMI_EN, 4);
 
-       /* The TCO I/O registers reside in a 32-byte range pointed to by the TCOBASE value */
-       if (!request_region (TCOBASE, 0x20, "iTCO_wdt")) {
-               printk (KERN_ERR PFX "I/O address 0x%04lx already in use\n",
+       /* The TCO I/O registers reside in a 32-byte range pointed to
+          by the TCOBASE value */
+       if (!request_region(TCOBASE, 0x20, "iTCO_wdt")) {
+               printk(KERN_ERR PFX "I/O address 0x%04lx already in use\n",
                        TCOBASE);
                ret = -EIO;
                goto out;
        }
 
-       printk(KERN_INFO PFX "Found a %s TCO device (Version=%d, TCOBASE=0x%04lx)\n",
-               iTCO_chipset_info[ent->driver_data].name,
-               iTCO_chipset_info[ent->driver_data].iTCO_version,
-               TCOBASE);
+       printk(KERN_INFO PFX
+               "Found a %s TCO device (Version=%d, TCOBASE=0x%04lx)\n",
+                       iTCO_chipset_info[ent->driver_data].name,
+                       iTCO_chipset_info[ent->driver_data].iTCO_version,
+                       TCOBASE);
 
        /* Clear out the (probably old) status */
        outb(0, TCO1_STS);
@@ -687,27 +678,29 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev, const struct pci_device
        /* Make sure the watchdog is not running */
        iTCO_wdt_stop();
 
-       /* Check that the heartbeat value is within it's range ; if not reset to the default */
+       /* Check that the heartbeat value is within it's range;
+          if not reset to the default */
        if (iTCO_wdt_set_heartbeat(heartbeat)) {
                iTCO_wdt_set_heartbeat(WATCHDOG_HEARTBEAT);
-               printk(KERN_INFO PFX "heartbeat value must be 2<heartbeat<39 (TCO v1) or 613 (TCO v2), using %d\n",
-                       heartbeat);
+               printk(KERN_INFO PFX "heartbeat value must be 2 < heartbeat < 39 (TCO v1) or 613 (TCO v2), using %d\n",
+                                                       heartbeat);
        }
 
        ret = misc_register(&iTCO_wdt_miscdev);
        if (ret != 0) {
-               printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
-                       WATCHDOG_MINOR, ret);
+               printk(KERN_ERR PFX
+                       "cannot register miscdev on minor=%d (err=%d)\n",
+                                                       WATCHDOG_MINOR, ret);
                goto unreg_region;
        }
 
-       printk (KERN_INFO PFX "initialized. heartbeat=%d sec (nowayout=%d)\n",
-               heartbeat, nowayout);
+       printk(KERN_INFO PFX "initialized. heartbeat=%d sec (nowayout=%d)\n",
+                                                       heartbeat, nowayout);
 
        return 0;
 
 unreg_region:
-       release_region (TCOBASE, 0x20);
+       release_region(TCOBASE, 0x20);
 out:
        if (iTCO_wdt_private.iTCO_version == 2)
                iounmap(iTCO_wdt_private.gcs);
@@ -796,7 +789,8 @@ static int __init iTCO_wdt_init_module(void)
        if (err)
                return err;
 
-       iTCO_wdt_platform_device = platform_device_register_simple(DRV_NAME, -1, NULL, 0);
+       iTCO_wdt_platform_device = platform_device_register_simple(DRV_NAME,
+                                                               -1, NULL, 0);
        if (IS_ERR(iTCO_wdt_platform_device)) {
                err = PTR_ERR(iTCO_wdt_platform_device);
                goto unreg_platform_driver;
index 4b89f40..05a2810 100644 (file)
@@ -41,9 +41,9 @@
 #include <linux/spinlock.h>
 #include <linux/moduleparam.h>
 #include <linux/platform_device.h>
+#include <linux/io.h>
+#include <linux/uaccess.h>
 
-#include <asm/io.h>
-#include <asm/uaccess.h>
 #include <asm/system.h>
 
 static struct platform_device *ibwdt_platform_device;
@@ -120,15 +120,16 @@ static int wd_margin = WD_TIMO;
 
 static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout,
+               "Watchdog cannot be stopped once started (default="
+                               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 
 /*
  *     Watchdog Operations
  */
 
-static void
-ibwdt_ping(void)
+static void ibwdt_ping(void)
 {
        spin_lock(&ibwdt_lock);
 
@@ -138,16 +139,14 @@ ibwdt_ping(void)
        spin_unlock(&ibwdt_lock);
 }
 
-static void
-ibwdt_disable(void)
+static void ibwdt_disable(void)
 {
        spin_lock(&ibwdt_lock);
        outb_p(0, WDT_STOP);
        spin_unlock(&ibwdt_lock);
 }
 
-static int
-ibwdt_set_heartbeat(int t)
+static int ibwdt_set_heartbeat(int t)
 {
        int i;
 
@@ -165,8 +164,8 @@ ibwdt_set_heartbeat(int t)
  *     /dev/watchdog handling
  */
 
-static ssize_t
-ibwdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
+static ssize_t ibwdt_write(struct file *file, const char __user *buf,
+                                               size_t count, loff_t *ppos)
 {
        if (count) {
                if (!nowayout) {
@@ -188,77 +187,71 @@ ibwdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppo
        return count;
 }
 
-static int
-ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-         unsigned long arg)
+static long ibwdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
        int new_margin;
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
 
        static struct watchdog_info ident = {
-               .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
+               .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT
+                                                       | WDIOF_MAGICCLOSE,
                .firmware_version = 1,
                .identity = "IB700 WDT",
        };
 
        switch (cmd) {
        case WDIOC_GETSUPPORT:
-         if (copy_to_user(argp, &ident, sizeof(ident)))
-           return -EFAULT;
-         break;
+               if (copy_to_user(argp, &ident, sizeof(ident)))
+                       return -EFAULT;
+               break;
 
        case WDIOC_GETSTATUS:
        case WDIOC_GETBOOTSTATUS:
-         return put_user(0, p);
-
-       case WDIOC_KEEPALIVE:
-         ibwdt_ping();
-         break;
-
-       case WDIOC_SETTIMEOUT:
-         if (get_user(new_margin, p))
-                 return -EFAULT;
-         if (ibwdt_set_heartbeat(new_margin))
-                 return -EINVAL;
-         ibwdt_ping();
-         /* Fall */
-
-       case WDIOC_GETTIMEOUT:
-         return put_user(wd_times[wd_margin], p);
+               return put_user(0, p);
 
        case WDIOC_SETOPTIONS:
        {
-         int options, retval = -EINVAL;
+               int options, retval = -EINVAL;
 
-         if (get_user(options, p))
-           return -EFAULT;
+               if (get_user(options, p))
+                       return -EFAULT;
 
-         if (options & WDIOS_DISABLECARD) {
-           ibwdt_disable();
-           retval = 0;
-         }
+               if (options & WDIOS_DISABLECARD) {
+                       ibwdt_disable();
+                       retval = 0;
+               }
+               if (options & WDIOS_ENABLECARD) {
+                       ibwdt_ping();
+                       retval = 0;
+               }
+               return retval;
+       }
+       case WDIOC_KEEPALIVE:
+               ibwdt_ping();
+               break;
 
-         if (options & WDIOS_ENABLECARD) {
-           ibwdt_ping();
-           retval = 0;
-         }
+       case WDIOC_SETTIMEOUT:
+               if (get_user(new_margin, p))
+                       return -EFAULT;
+               if (ibwdt_set_heartbeat(new_margin))
+                       return -EINVAL;
+               ibwdt_ping();
+               /* Fall */
 
-         return retval;
-       }
+       case WDIOC_GETTIMEOUT:
+               return put_user(wd_times[wd_margin], p);
 
        default:
-         return -ENOTTY;
+               return -ENOTTY;
        }
        return 0;
 }
 
-static int
-ibwdt_open(struct inode *inode, struct file *file)
+static int ibwdt_open(struct inode *inode, struct file *file)
 {
-       if (test_and_set_bit(0, &ibwdt_is_open)) {
+       if (test_and_set_bit(0, &ibwdt_is_open))
                return -EBUSY;
-       }
        if (nowayout)
                __module_get(THIS_MODULE);
 
@@ -267,13 +260,13 @@ ibwdt_open(struct inode *inode, struct file *file)
        return nonseekable_open(inode, file);
 }
 
-static int
-ibwdt_close(struct inode *inode, struct file *file)
+static int ibwdt_close(struct inode *inode, struct file *file)
 {
        if (expect_close == 42) {
                ibwdt_disable();
        } else {
-               printk(KERN_CRIT PFX "WDT device closed unexpectedly.  WDT will not stop!\n");
+               printk(KERN_CRIT PFX
+                    "WDT device closed unexpectedly.  WDT will not stop!\n");
                ibwdt_ping();
        }
        clear_bit(0, &ibwdt_is_open);
@@ -289,7 +282,7 @@ static const struct file_operations ibwdt_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = ibwdt_write,
-       .ioctl          = ibwdt_ioctl,
+       .unlocked_ioctl = ibwdt_ioctl,
        .open           = ibwdt_open,
        .release        = ibwdt_close,
 };
@@ -310,21 +303,23 @@ static int __devinit ibwdt_probe(struct platform_device *dev)
 
 #if WDT_START != WDT_STOP
        if (!request_region(WDT_STOP, 1, "IB700 WDT")) {
-               printk (KERN_ERR PFX "STOP method I/O %X is not available.\n", WDT_STOP);
+               printk(KERN_ERR PFX "STOP method I/O %X is not available.\n",
+                                                               WDT_STOP);
                res = -EIO;
                goto out_nostopreg;
        }
 #endif
 
        if (!request_region(WDT_START, 1, "IB700 WDT")) {
-               printk (KERN_ERR PFX "START method I/O %X is not available.\n", WDT_START);
+               printk(KERN_ERR PFX "START method I/O %X is not available.\n",
+                                                               WDT_START);
                res = -EIO;
                goto out_nostartreg;
        }
 
        res = misc_register(&ibwdt_miscdev);
        if (res) {
-               printk (KERN_ERR PFX "failed to register misc device\n");
+               printk(KERN_ERR PFX "failed to register misc device\n");
                goto out_nomisc;
        }
        return 0;
@@ -342,9 +337,9 @@ out_nostopreg:
 static int __devexit ibwdt_remove(struct platform_device *dev)
 {
        misc_deregister(&ibwdt_miscdev);
-       release_region(WDT_START,1);
+       release_region(WDT_START, 1);
 #if WDT_START != WDT_STOP
-       release_region(WDT_STOP,1);
+       release_region(WDT_STOP, 1);
 #endif
        return 0;
 }
@@ -369,13 +364,15 @@ static int __init ibwdt_init(void)
 {
        int err;
 
-       printk(KERN_INFO PFX "WDT driver for IB700 single board computer initialising.\n");
+       printk(KERN_INFO PFX
+               "WDT driver for IB700 single board computer initialising.\n");
 
        err = platform_driver_register(&ibwdt_driver);
        if (err)
                return err;
 
-       ibwdt_platform_device = platform_device_register_simple(DRV_NAME, -1, NULL, 0);
+       ibwdt_platform_device = platform_device_register_simple(DRV_NAME,
+                                                               -1, NULL, 0);
        if (IS_ERR(ibwdt_platform_device)) {
                err = PTR_ERR(ibwdt_platform_device);
                goto unreg_platform_driver;
index 94155f6..b82405c 100644 (file)
@@ -19,9 +19,8 @@
 #include <linux/miscdevice.h>
 #include <linux/watchdog.h>
 #include <linux/dmi.h>
-
-#include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/io.h>
+#include <linux/uaccess.h>
 
 
 enum {
@@ -70,10 +69,13 @@ static char asr_expect_close;
 static unsigned int asr_type, asr_base, asr_length;
 static unsigned int asr_read_addr, asr_write_addr;
 static unsigned char asr_toggle_mask, asr_disable_mask;
+static spinlock_t asr_lock;
 
-static void asr_toggle(void)
+static void __asr_toggle(void)
 {
-       unsigned char reg = inb(asr_read_addr);
+       unsigned char reg;
+
+       reg = inb(asr_read_addr);
 
        outb(reg & ~asr_toggle_mask, asr_write_addr);
        reg = inb(asr_read_addr);
@@ -83,12 +85,21 @@ static void asr_toggle(void)
 
        outb(reg & ~asr_toggle_mask, asr_write_addr);
        reg = inb(asr_read_addr);
+       spin_unlock(&asr_lock);
+}
+
+static void asr_toggle(void)
+{
+       spin_lock(&asr_lock);
+       __asr_toggle();
+       spin_unlock(&asr_lock);
 }
 
 static void asr_enable(void)
 {
        unsigned char reg;
 
+       spin_lock(&asr_lock);
        if (asr_type == ASMTYPE_TOPAZ) {
                /* asr_write_addr == asr_read_addr */
                reg = inb(asr_read_addr);
@@ -99,17 +110,21 @@ static void asr_enable(void)
                 * First make sure the hardware timer is reset by toggling
                 * ASR hardware timer line.
                 */
-               asr_toggle();
+               __asr_toggle();
 
                reg = inb(asr_read_addr);
                outb(reg & ~asr_disable_mask, asr_write_addr);
        }
        reg = inb(asr_read_addr);
+       spin_unlock(&asr_lock);
 }
 
 static void asr_disable(void)
 {
-       unsigned char reg = inb(asr_read_addr);
+       unsigned char reg;
+
+       spin_lock(&asr_lock);
+       reg = inb(asr_read_addr);
 
        if (asr_type == ASMTYPE_TOPAZ)
                /* asr_write_addr == asr_read_addr */
@@ -122,6 +137,7 @@ static void asr_disable(void)
                outb(reg | asr_disable_mask, asr_write_addr);
        }
        reg = inb(asr_read_addr);
+       spin_unlock(&asr_lock);
 }
 
 static int __init asr_get_base_address(void)
@@ -133,7 +149,8 @@ static int __init asr_get_base_address(void)
 
        switch (asr_type) {
        case ASMTYPE_TOPAZ:
-               /* SELECT SuperIO CHIP FOR QUERYING (WRITE 0x07 TO BOTH 0x2E and 0x2F) */
+               /* SELECT SuperIO CHIP FOR QUERYING
+                  (WRITE 0x07 TO BOTH 0x2E and 0x2F) */
                outb(0x07, 0x2e);
                outb(0x07, 0x2f);
 
@@ -154,14 +171,26 @@ static int __init asr_get_base_address(void)
 
        case ASMTYPE_JASPER:
                type = "Jaspers ";
-
-               /* FIXME: need to use pci_config_lock here, but it's not exported */
+#if 0
+               u32 r;
+               /* Suggested fix */
+               pdev = pci_get_bus_and_slot(0, DEVFN(0x1f, 0));
+               if (pdev == NULL)
+                       return -ENODEV;
+               pci_read_config_dword(pdev, 0x58, &r);
+               asr_base = r & 0xFFFE;
+               pci_dev_put(pdev);
+#else
+               /* FIXME: need to use pci_config_lock here,
+                  but it's not exported */
 
 /*             spin_lock_irqsave(&pci_config_lock, flags);*/
 
                /* Select the SuperIO chip in the PCI I/O port register */
                outl(0x8000f858, 0xcf8);
 
+               /* BUS 0, Slot 1F, fnc 0, offset 58 */
+
                /*
                 * Read the base address for the SuperIO chip.
                 * Only the lower 16 bits are valid, but the address is word
@@ -170,7 +199,7 @@ static int __init asr_get_base_address(void)
                asr_base = inl(0xcfc) & 0xfffe;
 
 /*             spin_unlock_irqrestore(&pci_config_lock, flags);*/
-
+#endif
                asr_read_addr = asr_write_addr =
                        asr_base + JASPER_ASR_REG_OFFSET;
                asr_toggle_mask = JASPER_ASR_TOGGLE_MASK;
@@ -241,66 +270,57 @@ static ssize_t asr_write(struct file *file, const char __user *buf,
        return count;
 }
 
-static int asr_ioctl(struct inode *inode, struct file *file,
-                    unsigned int cmd, unsigned long arg)
+static long asr_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
        static const struct watchdog_info ident = {
-               .options =      WDIOF_KEEPALIVEPING | 
+               .options =      WDIOF_KEEPALIVEPING |
                                WDIOF_MAGICCLOSE,
-               .identity =     "IBM ASR"
+               .identity =     "IBM ASR",
        };
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
        int heartbeat;
 
        switch (cmd) {
-               case WDIOC_GETSUPPORT:
-                       return copy_to_user(argp, &ident, sizeof(ident)) ?
-                               -EFAULT : 0;
-
-               case WDIOC_GETSTATUS:
-               case WDIOC_GETBOOTSTATUS:
-                       return put_user(0, p);
-
-               case WDIOC_KEEPALIVE:
+       case WDIOC_GETSUPPORT:
+               return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
+       case WDIOC_GETSTATUS:
+       case WDIOC_GETBOOTSTATUS:
+               return put_user(0, p);
+       case WDIOC_SETOPTIONS:
+       {
+               int new_options, retval = -EINVAL;
+               if (get_user(new_options, p))
+                       return -EFAULT;
+               if (new_options & WDIOS_DISABLECARD) {
+                       asr_disable();
+                       retval = 0;
+               }
+               if (new_options & WDIOS_ENABLECARD) {
+                       asr_enable();
                        asr_toggle();
-                       return 0;
-
-               /*
-                * The hardware has a fixed timeout value, so no WDIOC_SETTIMEOUT
-                * and WDIOC_GETTIMEOUT always returns 256.
-                */
-               case WDIOC_GETTIMEOUT:
-                       heartbeat = 256;
-                       return put_user(heartbeat, p);
-
-               case WDIOC_SETOPTIONS: {
-                       int new_options, retval = -EINVAL;
-
-                       if (get_user(new_options, p))
-                               return -EFAULT;
-
-                       if (new_options & WDIOS_DISABLECARD) {
-                               asr_disable();
-                               retval = 0;
-                       }
-
-                       if (new_options & WDIOS_ENABLECARD) {
-                               asr_enable();
-                               asr_toggle();
-                               retval = 0;
-                       }
-
-                       return retval;
+                       retval = 0;
                }
+               return retval;
+       }
+       case WDIOC_KEEPALIVE:
+               asr_toggle();
+               return 0;
+       /*
+        * The hardware has a fixed timeout value, so no WDIOC_SETTIMEOUT
+        * and WDIOC_GETTIMEOUT always returns 256.
+        */
+       case WDIOC_GETTIMEOUT:
+               heartbeat = 256;
+               return put_user(heartbeat, p);
+       default:
+               return -ENOTTY;
        }
-
-       return -ENOTTY;
 }
 
 static int asr_open(struct inode *inode, struct file *file)
 {
-       if(test_and_set_bit(0, &asr_is_open))
+       if (test_and_set_bit(0, &asr_is_open))
                return -EBUSY;
 
        asr_toggle();
@@ -314,7 +334,8 @@ static int asr_release(struct inode *inode, struct file *file)
        if (asr_expect_close == 42)
                asr_disable();
        else {
-               printk(KERN_CRIT PFX "unexpected close, not stopping watchdog!\n");
+               printk(KERN_CRIT PFX
+                               "unexpected close, not stopping watchdog!\n");
                asr_toggle();
        }
        clear_bit(0, &asr_is_open);
@@ -323,12 +344,12 @@ static int asr_release(struct inode *inode, struct file *file)
 }
 
 static const struct file_operations asr_fops = {
-       .owner =        THIS_MODULE,
-       .llseek =       no_llseek,
-       .write =        asr_write,
-       .ioctl =        asr_ioctl,
-       .open =         asr_open,
-       .release =      asr_release,
+       .owner =                THIS_MODULE,
+       .llseek =               no_llseek,
+       .write =                asr_write,
+       .unlocked_ioctl =       asr_ioctl,
+       .open =                 asr_open,
+       .release =              asr_release,
 };
 
 static struct miscdevice asr_miscdev = {
@@ -367,6 +388,8 @@ static int __init ibmasr_init(void)
        if (!asr_type)
                return -ENODEV;
 
+       spin_lock_init(&asr_lock);
+
        rc = asr_get_base_address();
        if (rc)
                return rc;
@@ -395,7 +418,9 @@ module_init(ibmasr_init);
 module_exit(ibmasr_exit);
 
 module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout,
+       "Watchdog cannot be stopped once started (default="
+                               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 MODULE_DESCRIPTION("IBM Automatic Server Restart driver");
 MODULE_AUTHOR("Andrey Panin");
index 788245b..73c9e79 100644 (file)
@@ -1,7 +1,8 @@
 /*
  *     IndyDog 0.3     A Hardware Watchdog Device for SGI IP22
  *
- *     (c) Copyright 2002 Guido Guenther <agx@sigxcpu.org>, All Rights Reserved.
+ *     (c) Copyright 2002 Guido Guenther <agx@sigxcpu.org>,
+ *                                             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
 #include <linux/notifier.h>
 #include <linux/reboot.h>
 #include <linux/init.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/sgi/mc.h>
 
 #define PFX "indydog: "
-static int indydog_alive;
+static unsigned long indydog_alive;
+static spinlock_t indydog_lock;
 
 #define WATCHDOG_TIMEOUT 30            /* 30 sec default timeout */
 
 static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout,
+               "Watchdog cannot be stopped once started (default="
+                               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 static void indydog_start(void)
 {
-       u32 mc_ctrl0 = sgimc->cpuctrl0;
+       u32 mc_ctrl0;
 
+       spin_lock(&indydog_lock);
+       mc_ctrl0 = sgimc->cpuctrl0;
        mc_ctrl0 = sgimc->cpuctrl0 | SGIMC_CCTRL0_WDOG;
        sgimc->cpuctrl0 = mc_ctrl0;
+       spin_unlock(&indydog_lock);
 }
 
 static void indydog_stop(void)
 {
-       u32 mc_ctrl0 = sgimc->cpuctrl0;
+       u32 mc_ctrl0;
 
+       spin_lock(&indydog_lock);
+
+       mc_ctrl0 = sgimc->cpuctrl0;
        mc_ctrl0 &= ~SGIMC_CCTRL0_WDOG;
        sgimc->cpuctrl0 = mc_ctrl0;
+       spin_unlock(&indydog_lock);
 
        printk(KERN_INFO PFX "Stopped watchdog timer.\n");
 }
@@ -62,7 +73,7 @@ static void indydog_ping(void)
  */
 static int indydog_open(struct inode *inode, struct file *file)
 {
-       if (indydog_alive)
+       if (test_and_set_bit(0, &indydog_alive))
                return -EBUSY;
 
        if (nowayout)
@@ -84,23 +95,21 @@ static int indydog_release(struct inode *inode, struct file *file)
         * Lock it in if it's a module and we defined ...NOWAYOUT */
        if (!nowayout)
                indydog_stop();         /* Turn the WDT off */
-
-       indydog_alive = 0;
-
+       clear_bit(0, &indydog_alive);
        return 0;
 }
 
-static ssize_t indydog_write(struct file *file, const char *data, size_t len, loff_t *ppos)
+static ssize_t indydog_write(struct file *file, const char *data,
+                                               size_t len, loff_t *ppos)
 {
        /* Refresh the timer. */
-       if (len) {
+       if (len)
                indydog_ping();
-       }
        return len;
 }
 
-static int indydog_ioctl(struct inode *inode, struct file *file,
-       unsigned int cmd, unsigned long arg)
+static long indydog_ioctl(struct file *file, unsigned int cmd,
+                                                       unsigned long arg)
 {
        int options, retval = -EINVAL;
        static struct watchdog_info ident = {
@@ -111,42 +120,40 @@ static int indydog_ioctl(struct inode *inode, struct file *file,
        };
 
        switch (cmd) {
-               default:
-                       return -ENOTTY;
-               case WDIOC_GETSUPPORT:
-                       if (copy_to_user((struct watchdog_info *)arg,
-                                        &ident, sizeof(ident)))
-                               return -EFAULT;
-                       return 0;
-               case WDIOC_GETSTATUS:
-               case WDIOC_GETBOOTSTATUS:
-                       return put_user(0,(int *)arg);
-               case WDIOC_KEEPALIVE:
-                       indydog_ping();
-                       return 0;
-               case WDIOC_GETTIMEOUT:
-                       return put_user(WATCHDOG_TIMEOUT,(int *)arg);
-               case WDIOC_SETOPTIONS:
-               {
-                       if (get_user(options, (int *)arg))
-                               return -EFAULT;
-
-                       if (options & WDIOS_DISABLECARD) {
-                               indydog_stop();
-                               retval = 0;
-                       }
-
-                       if (options & WDIOS_ENABLECARD) {
-                               indydog_start();
-                               retval = 0;
-                       }
-
-                       return retval;
+       case WDIOC_GETSUPPORT:
+               if (copy_to_user((struct watchdog_info *)arg,
+                                &ident, sizeof(ident)))
+                       return -EFAULT;
+               return 0;
+       case WDIOC_GETSTATUS:
+       case WDIOC_GETBOOTSTATUS:
+               return put_user(0, (int *)arg);
+       case WDIOC_SETOPTIONS:
+       {
+               if (get_user(options, (int *)arg))
+                       return -EFAULT;
+               if (options & WDIOS_DISABLECARD) {
+                       indydog_stop();
+                       retval = 0;
                }
+               if (options & WDIOS_ENABLECARD) {
+                       indydog_start();
+                       retval = 0;
+               }
+               return retval;
+       }
+       case WDIOC_KEEPALIVE:
+               indydog_ping();
+               return 0;
+       case WDIOC_GETTIMEOUT:
+               return put_user(WATCHDOG_TIMEOUT, (int *)arg);
+       default:
+               return -ENOTTY;
        }
 }
 
-static int indydog_notify_sys(struct notifier_block *this, unsigned long code, void *unused)
+static int indydog_notify_sys(struct notifier_block *this,
+                                       unsigned long code, void *unused)
 {
        if (code == SYS_DOWN || code == SYS_HALT)
                indydog_stop();         /* Turn the WDT off */
@@ -158,7 +165,7 @@ static const struct file_operations indydog_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = indydog_write,
-       .ioctl          = indydog_ioctl,
+       .unlocked_ioctl = indydog_ioctl,
        .open           = indydog_open,
        .release        = indydog_release,
 };
@@ -180,17 +187,20 @@ static int __init watchdog_init(void)
 {
        int ret;
 
+       spin_lock_init(&indydog_lock);
+
        ret = register_reboot_notifier(&indydog_notifier);
        if (ret) {
-               printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
-                       ret);
+               printk(KERN_ERR PFX
+                       "cannot register reboot notifier (err=%d)\n", ret);
                return ret;
        }
 
        ret = misc_register(&indydog_miscdev);
        if (ret) {
-               printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
-                       WATCHDOG_MINOR, ret);
+               printk(KERN_ERR PFX
+                       "cannot register miscdev on minor=%d (err=%d)\n",
+                                                       WATCHDOG_MINOR, ret);
                unregister_reboot_notifier(&indydog_notifier);
                return ret;
        }
index bbbd91a..8278b13 100644 (file)
@@ -37,6 +37,7 @@
 static int nowayout = WATCHDOG_NOWAYOUT;
 static unsigned long wdt_status;
 static unsigned long boot_status;
+static spinlock_t wdt_lock;
 
 #define WDT_IN_USE             0
 #define WDT_OK_TO_CLOSE                1
@@ -68,8 +69,10 @@ static void wdt_enable(void)
        /* Arm and enable the Timer to starting counting down from 0xFFFF.FFFF
         * Takes approx. 10.7s to timeout
         */
+       spin_lock(&wdt_lock);
        write_wdtcr(IOP_WDTCR_EN_ARM);
        write_wdtcr(IOP_WDTCR_EN);
+       spin_unlock(&wdt_lock);
 }
 
 /* returns 0 if the timer was successfully disabled */
@@ -77,9 +80,11 @@ static int wdt_disable(void)
 {
        /* Stop Counting */
        if (wdt_supports_disable()) {
+               spin_lock(&wdt_lock);
                write_wdtcr(IOP_WDTCR_DIS_ARM);
                write_wdtcr(IOP_WDTCR_DIS);
                clear_bit(WDT_ENABLED, &wdt_status);
+               spin_unlock(&wdt_lock);
                printk(KERN_INFO "WATCHDOG: Disabled\n");
                return 0;
        } else
@@ -92,16 +97,12 @@ static int iop_wdt_open(struct inode *inode, struct file *file)
                return -EBUSY;
 
        clear_bit(WDT_OK_TO_CLOSE, &wdt_status);
-
        wdt_enable();
-
        set_bit(WDT_ENABLED, &wdt_status);
-
        return nonseekable_open(inode, file);
 }
 
-static ssize_t
-iop_wdt_write(struct file *file, const char *data, size_t len,
+static ssize_t iop_wdt_write(struct file *file, const char *data, size_t len,
                  loff_t *ppos)
 {
        if (len) {
@@ -121,46 +122,35 @@ iop_wdt_write(struct file *file, const char *data, size_t len,
                }
                wdt_enable();
        }
-
        return len;
 }
 
-static struct watchdog_info ident = {
+static const struct watchdog_info ident = {
        .options = WDIOF_CARDRESET | WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING,
        .identity = "iop watchdog",
 };
 
-static int
-iop_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-                 unsigned long arg)
+static long iop_wdt_ioctl(struct file *file,
+                               unsigned int cmd, unsigned long arg)
 {
        int options;
        int ret = -ENOTTY;
+       int __user *argp = (int __user *)arg;
 
        switch (cmd) {
        case WDIOC_GETSUPPORT:
-               if (copy_to_user
-                   ((struct watchdog_info *)arg, &ident, sizeof ident))
+               if (copy_to_user(argp, &ident, sizeof ident))
                        ret = -EFAULT;
                else
                        ret = 0;
                break;
 
        case WDIOC_GETSTATUS:
-               ret = put_user(0, (int *)arg);
+               ret = put_user(0, argp);
                break;
 
        case WDIOC_GETBOOTSTATUS:
-               ret = put_user(boot_status, (int *)arg);
-               break;
-
-       case WDIOC_GETTIMEOUT:
-               ret = put_user(iop_watchdog_timeout(), (int *)arg);
-               break;
-
-       case WDIOC_KEEPALIVE:
-               wdt_enable();
-               ret = 0;
+               ret = put_user(boot_status, argp);
                break;
 
        case WDIOC_SETOPTIONS:
@@ -177,14 +167,21 @@ iop_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
                        } else
                                ret = 0;
                }
-
                if (options & WDIOS_ENABLECARD) {
                        wdt_enable();
                        ret = 0;
                }
                break;
-       }
 
+       case WDIOC_KEEPALIVE:
+               wdt_enable();
+               ret = 0;
+               break;
+
+       case WDIOC_GETTIMEOUT:
+               ret = put_user(iop_watchdog_timeout(), argp);
+               break;
+       }
        return ret;
 }
 
@@ -214,7 +211,7 @@ static const struct file_operations iop_wdt_fops = {
        .owner = THIS_MODULE,
        .llseek = no_llseek,
        .write = iop_wdt_write,
-       .ioctl = iop_wdt_ioctl,
+       .unlocked_ioctl = iop_wdt_ioctl,
        .open = iop_wdt_open,
        .release = iop_wdt_release,
 };
@@ -229,10 +226,8 @@ static int __init iop_wdt_init(void)
 {
        int ret;
 
-       ret = misc_register(&iop_wdt_miscdev);
-       if (ret == 0)
-               printk("iop watchdog timer: timeout %lu sec\n",
-                      iop_watchdog_timeout());
+       spin_lock_init(&wdt_lock);
+
 
        /* check if the reset was caused by the watchdog timer */
        boot_status = (read_rcsr() & IOP_RCSR_WDT) ? WDIOF_CARDRESET : 0;
@@ -242,6 +237,13 @@ static int __init iop_wdt_init(void)
         */
        write_wdtsr(IOP13XX_WDTCR_IB_RESET);
 
+       /* Register after we have the device set up so we cannot race
+          with an open */
+       ret = misc_register(&iop_wdt_miscdev);
+       if (ret == 0)
+               printk(KERN_INFO "iop watchdog timer: timeout %lu sec\n",
+                      iop_watchdog_timeout());
+
        return ret;
 }
 
index 445b7e8..2270ee0 100644 (file)
@@ -30,9 +30,8 @@
 #include <linux/fs.h>
 #include <linux/pci.h>
 #include <linux/spinlock.h>
-
-#include <asm/uaccess.h>
-#include <asm/io.h>
+#include <linux/uaccess.h>
+#include <linux/io.h>
 
 #define NAME "it8712f_wdt"
 
@@ -50,7 +49,7 @@ static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
 MODULE_PARM_DESC(nowayout, "Disable watchdog shutdown on close");
 
-static struct semaphore it8712f_wdt_sem;
+static unsigned long wdt_open;
 static unsigned expect_close;
 static spinlock_t io_lock;
 static unsigned char revision;
@@ -86,22 +85,19 @@ static unsigned short address;
 #define WDT_OUT_PWROK  0x10
 #define WDT_OUT_KRST   0x40
 
-static int
-superio_inb(int reg)
+static int superio_inb(int reg)
 {
        outb(reg, REG);
        return inb(VAL);
 }
 
-static void
-superio_outb(int val, int reg)
+static void superio_outb(int val, int reg)
 {
        outb(reg, REG);
        outb(val, VAL);
 }
 
-static int
-superio_inw(int reg)
+static int superio_inw(int reg)
 {
        int val;
        outb(reg++, REG);
@@ -111,15 +107,13 @@ superio_inw(int reg)
        return val;
 }
 
-static inline void
-superio_select(int ldn)
+static inline void superio_select(int ldn)
 {
        outb(LDN, REG);
        outb(ldn, VAL);
 }
 
-static inline void
-superio_enter(void)
+static inline void superio_enter(void)
 {
        spin_lock(&io_lock);
        outb(0x87, REG);
@@ -128,22 +122,19 @@ superio_enter(void)
        outb(0x55, REG);
 }
 
-static inline void
-superio_exit(void)
+static inline void superio_exit(void)
 {
        outb(0x02, REG);
        outb(0x02, VAL);
        spin_unlock(&io_lock);
 }
 
-static inline void
-it8712f_wdt_ping(void)
+static inline void it8712f_wdt_ping(void)
 {
        inb(address);
 }
 
-static void
-it8712f_wdt_update_margin(void)
+static void it8712f_wdt_update_margin(void)
 {
        int config = WDT_OUT_KRST | WDT_OUT_PWROK;
        int units = margin;
@@ -165,8 +156,7 @@ it8712f_wdt_update_margin(void)
        superio_outb(units, WDT_TIMEOUT);
 }
 
-static int
-it8712f_wdt_get_status(void)
+static int it8712f_wdt_get_status(void)
 {
        if (superio_inb(WDT_CONTROL) & 0x01)
                return WDIOF_CARDRESET;
@@ -174,8 +164,7 @@ it8712f_wdt_get_status(void)
                return 0;
 }
 
-static void
-it8712f_wdt_enable(void)
+static void it8712f_wdt_enable(void)
 {
        printk(KERN_DEBUG NAME ": enabling watchdog timer\n");
        superio_enter();
@@ -190,8 +179,7 @@ it8712f_wdt_enable(void)
        it8712f_wdt_ping();
 }
 
-static void
-it8712f_wdt_disable(void)
+static void it8712f_wdt_disable(void)
 {
        printk(KERN_DEBUG NAME ": disabling watchdog timer\n");
 
@@ -207,8 +195,7 @@ it8712f_wdt_disable(void)
        superio_exit();
 }
 
-static int
-it8712f_wdt_notify(struct notifier_block *this,
+static int it8712f_wdt_notify(struct notifier_block *this,
                    unsigned long code, void *unused)
 {
        if (code == SYS_HALT || code == SYS_POWER_OFF)
@@ -222,9 +209,8 @@ static struct notifier_block it8712f_wdt_notifier = {
        .notifier_call = it8712f_wdt_notify,
 };
 
-static ssize_t
-it8712f_wdt_write(struct file *file, const char __user *data,
-       size_t len, loff_t *ppos)
+static ssize_t it8712f_wdt_write(struct file *file, const char __user *data,
+                                       size_t len, loff_t *ppos)
 {
        /* check for a magic close character */
        if (len) {
@@ -235,7 +221,7 @@ it8712f_wdt_write(struct file *file, const char __user *data,
                expect_close = 0;
                for (i = 0; i < len; ++i) {
                        char c;
-                       if (get_user(c, data+i))
+                       if (get_user(c, data + i))
                                return -EFAULT;
                        if (c == 'V')
                                expect_close = 42;
@@ -245,9 +231,8 @@ it8712f_wdt_write(struct file *file, const char __user *data,
        return len;
 }
 
-static int
-it8712f_wdt_ioctl(struct inode *inode, struct file *file,
-       unsigned int cmd, unsigned long arg)
+static long it8712f_wdt_ioctl(struct file *file, unsigned int cmd,
+                                                       unsigned long arg)
 {
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
@@ -259,8 +244,6 @@ it8712f_wdt_ioctl(struct inode *inode, struct file *file,
        int value;
 
        switch (cmd) {
-       default:
-               return -ENOTTY;
        case WDIOC_GETSUPPORT:
                if (copy_to_user(argp, &ident, sizeof(ident)))
                        return -EFAULT;
@@ -299,22 +282,21 @@ it8712f_wdt_ioctl(struct inode *inode, struct file *file,
                if (put_user(margin, p))
                        return -EFAULT;
                return 0;
+       default:
+               return -ENOTTY;
        }
 }
 
-static int
-it8712f_wdt_open(struct inode *inode, struct file *file)
+static int it8712f_wdt_open(struct inode *inode, struct file *file)
 {
        /* only allow one at a time */
-       if (down_trylock(&it8712f_wdt_sem))
+       if (test_and_set_bit(0, &wdt_open))
                return -EBUSY;
        it8712f_wdt_enable();
-
        return nonseekable_open(inode, file);
 }
 
-static int
-it8712f_wdt_release(struct inode *inode, struct file *file)
+static int it8712f_wdt_release(struct inode *inode, struct file *file)
 {
        if (expect_close != 42) {
                printk(KERN_WARNING NAME
@@ -324,7 +306,7 @@ it8712f_wdt_release(struct inode *inode, struct file *file)
                it8712f_wdt_disable();
        }
        expect_close = 0;
-       up(&it8712f_wdt_sem);
+       clear_bit(0, &wdt_open);
 
        return 0;
 }
@@ -333,7 +315,7 @@ static const struct file_operations it8712f_wdt_fops = {
        .owner = THIS_MODULE,
        .llseek = no_llseek,
        .write = it8712f_wdt_write,
-       .ioctl = it8712f_wdt_ioctl,
+       .unlocked_ioctl = it8712f_wdt_ioctl,
        .open = it8712f_wdt_open,
        .release = it8712f_wdt_release,
 };
@@ -344,8 +326,7 @@ static struct miscdevice it8712f_wdt_miscdev = {
        .fops = &it8712f_wdt_fops,
 };
 
-static int __init
-it8712f_wdt_find(unsigned short *address)
+static int __init it8712f_wdt_find(unsigned short *address)
 {
        int err = -ENODEV;
        int chip_type;
@@ -387,8 +368,7 @@ exit:
        return err;
 }
 
-static int __init
-it8712f_wdt_init(void)
+static int __init it8712f_wdt_init(void)
 {
        int err = 0;
 
@@ -404,8 +384,6 @@ it8712f_wdt_init(void)
 
        it8712f_wdt_disable();
 
-       sema_init(&it8712f_wdt_sem, 1);
-
        err = register_reboot_notifier(&it8712f_wdt_notifier);
        if (err) {
                printk(KERN_ERR NAME ": unable to register reboot notifier\n");
@@ -430,8 +408,7 @@ out:
        return err;
 }
 
-static void __exit
-it8712f_wdt_exit(void)
+static void __exit it8712f_wdt_exit(void)
 {
        misc_deregister(&it8712f_wdt_miscdev);
        unregister_reboot_notifier(&it8712f_wdt_notifier);
index dc7548d..a77f69d 100644 (file)
 #include <linux/watchdog.h>
 #include <linux/init.h>
 #include <linux/bitops.h>
+#include <linux/uaccess.h>
 
 #include <asm/hardware.h>
-#include <asm/uaccess.h>
 
 static int nowayout = WATCHDOG_NOWAYOUT;
 static unsigned int heartbeat = 60;    /* (secs) Default is 1 minute */
 static unsigned long wdt_status;
+static spinlock_t wdt_lock;
 
 #define        WDT_IN_USE              0
 #define        WDT_OK_TO_CLOSE         1
 
 static unsigned long wdt_tick_rate;
 
-static void
-wdt_enable(void)
+static void wdt_enable(void)
 {
+       spin_lock(&wdt_lock);
        ixp2000_reg_write(IXP2000_RESET0, *(IXP2000_RESET0) | WDT_RESET_ENABLE);
        ixp2000_reg_write(IXP2000_TWDE, WDT_ENABLE);
        ixp2000_reg_write(IXP2000_T4_CLD, heartbeat * wdt_tick_rate);
        ixp2000_reg_write(IXP2000_T4_CTL, TIMER_DIVIDER_256 | TIMER_ENABLE);
+       spin_unlock(&wdt_lock);
 }
 
-static void
-wdt_disable(void)
+static void wdt_disable(void)
 {
+       spin_lock(&wdt_lock);
        ixp2000_reg_write(IXP2000_T4_CTL, 0);
+       spin_unlock(&wdt_lock);
 }
 
-static void
-wdt_keepalive(void)
+static void wdt_keepalive(void)
 {
+       spin_lock(&wdt_lock);
        ixp2000_reg_write(IXP2000_T4_CLD, heartbeat * wdt_tick_rate);
+       spin_unlock(&wdt_lock);
 }
 
-static int
-ixp2000_wdt_open(struct inode *inode, struct file *file)
+static int ixp2000_wdt_open(struct inode *inode, struct file *file)
 {
        if (test_and_set_bit(WDT_IN_USE, &wdt_status))
                return -EBUSY;
@@ -72,8 +75,8 @@ ixp2000_wdt_open(struct inode *inode, struct file *file)
        return nonseekable_open(inode, file);
 }
 
-static ssize_t
-ixp2000_wdt_write(struct file *file, const char *data, size_t len, loff_t *ppos)
+static ssize_t ixp2000_wdt_write(struct file *file, const char *data,
+                                               size_t len, loff_t *ppos)
 {
        if (len) {
                if (!nowayout) {
@@ -103,9 +106,8 @@ static struct watchdog_info ident = {
        .identity       = "IXP2000 Watchdog",
 };
 
-static int
-ixp2000_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-                       unsigned long arg)
+static long ixp2000_wdt_ioctl(struct file *file, unsigned int cmd,
+                                                       unsigned long arg)
 {
        int ret = -ENOTTY;
        int time;
@@ -124,6 +126,11 @@ ixp2000_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
                ret = put_user(0, (int *)arg);
                break;
 
+       case WDIOC_KEEPALIVE:
+               wdt_enable();
+               ret = 0;
+               break;
+
        case WDIOC_SETTIMEOUT:
                ret = get_user(time, (int *)arg);
                if (ret)
@@ -141,26 +148,18 @@ ixp2000_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
        case WDIOC_GETTIMEOUT:
                ret = put_user(heartbeat, (int *)arg);
                break;
-
-       case WDIOC_KEEPALIVE:
-               wdt_enable();
-               ret = 0;
-               break;
        }
 
        return ret;
 }
 
-static int
-ixp2000_wdt_release(struct inode *inode, struct file *file)
+static int ixp2000_wdt_release(struct inode *inode, struct file *file)
 {
-       if (test_bit(WDT_OK_TO_CLOSE, &wdt_status)) {
+       if (test_bit(WDT_OK_TO_CLOSE, &wdt_status))
                wdt_disable();
-       } else {
+       else
                printk(KERN_CRIT "WATCHDOG: Device closed unexpectedly - "
                                        "timer will not stop\n");
-       }
-
        clear_bit(WDT_IN_USE, &wdt_status);
        clear_bit(WDT_OK_TO_CLOSE, &wdt_status);
 
@@ -168,18 +167,16 @@ ixp2000_wdt_release(struct inode *inode, struct file *file)
 }
 
 
-static const struct file_operations ixp2000_wdt_fops =
-{
+static const struct file_operations ixp2000_wdt_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = ixp2000_wdt_write,
-       .ioctl          = ixp2000_wdt_ioctl,
+       .unlocked_ioctl = ixp2000_wdt_ioctl,
        .open           = ixp2000_wdt_open,
        .release        = ixp2000_wdt_release,
 };
 
-static struct miscdevice ixp2000_wdt_miscdev =
-{
+static struct miscdevice ixp2000_wdt_miscdev = {
        .minor          = WATCHDOG_MINOR,
        .name           = "watchdog",
        .fops           = &ixp2000_wdt_fops,
@@ -191,9 +188,8 @@ static int __init ixp2000_wdt_init(void)
                printk(KERN_INFO "Unable to use IXP2000 watchdog due to IXP2800 erratum #25.\n");
                return -EIO;
        }
-
        wdt_tick_rate = (*IXP2000_T1_CLD * HZ) / 256;
-
+       spin_lock_init(&wdt_lock);
        return misc_register(&ixp2000_wdt_miscdev);
 }
 
index 5864bb8..ef3157d 100644 (file)
 #include <linux/watchdog.h>
 #include <linux/init.h>
 #include <linux/bitops.h>
+#include <linux/uaccess.h>
 
 #include <asm/hardware.h>
-#include <asm/uaccess.h>
 
 static int nowayout = WATCHDOG_NOWAYOUT;
 static int heartbeat = 60;     /* (secs) Default is 1 minute */
 static unsigned long wdt_status;
 static unsigned long boot_status;
+static spin_lock_t wdt_lock;
 
 #define WDT_TICK_RATE (IXP4XX_PERIPHERAL_BUS_CLOCK * 1000000UL)
 
 #define        WDT_IN_USE              0
 #define        WDT_OK_TO_CLOSE         1
 
-static void
-wdt_enable(void)
+static void wdt_enable(void)
 {
+       spin_lock(&wdt_lock);
        *IXP4XX_OSWK = IXP4XX_WDT_KEY;
        *IXP4XX_OSWE = 0;
        *IXP4XX_OSWT = WDT_TICK_RATE * heartbeat;
        *IXP4XX_OSWE = IXP4XX_WDT_COUNT_ENABLE | IXP4XX_WDT_RESET_ENABLE;
        *IXP4XX_OSWK = 0;
+       spin_unlock(&wdt_lock);
 }
 
-static void
-wdt_disable(void)
+static void wdt_disable(void)
 {
+       spin_lock(&wdt_lock);
        *IXP4XX_OSWK = IXP4XX_WDT_KEY;
        *IXP4XX_OSWE = 0;
        *IXP4XX_OSWK = 0;
+       spin_unlock(&wdt_lock);
 }
 
-static int
-ixp4xx_wdt_open(struct inode *inode, struct file *file)
+static int ixp4xx_wdt_open(struct inode *inode, struct file *file)
 {
        if (test_and_set_bit(WDT_IN_USE, &wdt_status))
                return -EBUSY;
 
        clear_bit(WDT_OK_TO_CLOSE, &wdt_status);
-
        wdt_enable();
-
        return nonseekable_open(inode, file);
 }
 
@@ -87,7 +87,6 @@ ixp4xx_wdt_write(struct file *file, const char *data, size_t len, loff_t *ppos)
                }
                wdt_enable();
        }
-
        return len;
 }
 
@@ -98,9 +97,8 @@ static struct watchdog_info ident = {
 };
 
 
-static int
-ixp4xx_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-                       unsigned long arg)
+static long ixp4xx_wdt_ioctl(struct file *file, unsigned int cmd,
+                                                       unsigned long arg)
 {
        int ret = -ENOTTY;
        int time;
@@ -119,6 +117,11 @@ ixp4xx_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
                ret = put_user(boot_status, (int *)arg);
                break;
 
+       case WDIOC_KEEPALIVE:
+               wdt_enable();
+               ret = 0;
+               break;
+
        case WDIOC_SETTIMEOUT:
                ret = get_user(time, (int *)arg);
                if (ret)
@@ -136,25 +139,17 @@ ixp4xx_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
        case WDIOC_GETTIMEOUT:
                ret = put_user(heartbeat, (int *)arg);
                break;
-
-       case WDIOC_KEEPALIVE:
-               wdt_enable();
-               ret = 0;
-               break;
        }
        return ret;
 }
 
-static int
-ixp4xx_wdt_release(struct inode *inode, struct file *file)
+static int ixp4xx_wdt_release(struct inode *inode, struct file *file)
 {
-       if (test_bit(WDT_OK_TO_CLOSE, &wdt_status)) {
+       if (test_bit(WDT_OK_TO_CLOSE, &wdt_status))
                wdt_disable();
-       } else {
+       else
                printk(KERN_CRIT "WATCHDOG: Device closed unexpectedly - "
                                        "timer will not stop\n");
-       }
-
        clear_bit(WDT_IN_USE, &wdt_status);
        clear_bit(WDT_OK_TO_CLOSE, &wdt_status);
 
@@ -162,18 +157,16 @@ ixp4xx_wdt_release(struct inode *inode, struct file *file)
 }
 
 
-static const struct file_operations ixp4xx_wdt_fops =
-{
+static const struct file_operations ixp4xx_wdt_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = ixp4xx_wdt_write,
-       .ioctl          = ixp4xx_wdt_ioctl,
+       .unlocked_ioctl = ixp4xx_wdt_ioctl,
        .open           = ixp4xx_wdt_open,
        .release        = ixp4xx_wdt_release,
 };
 
-static struct miscdevice ixp4xx_wdt_miscdev =
-{
+static struct miscdevice ixp4xx_wdt_miscdev = {
        .minor          = WATCHDOG_MINOR,
        .name           = "watchdog",
        .fops           = &ixp4xx_wdt_fops,
@@ -186,19 +179,18 @@ static int __init ixp4xx_wdt_init(void)
 
        asm("mrc p15, 0, %0, cr0, cr0, 0;" : "=r"(processor_id) :);
        if (!(processor_id & 0xf) && !cpu_is_ixp46x()) {
-               printk("IXP4XXX Watchdog: Rev. A0 IXP42x CPU detected - "
-                       "watchdog disabled\n");
+               printk(KERN_ERR "IXP4XXX Watchdog: Rev. A0 IXP42x CPU detected"
+                       " - watchdog disabled\n");
 
                return -ENODEV;
        }
-
-       ret = misc_register(&ixp4xx_wdt_miscdev);
-       if (ret == 0)
-               printk("IXP4xx Watchdog Timer: heartbeat %d sec\n", heartbeat);
-
+       spin_lock_init(&wdt_lock);
        boot_status = (*IXP4XX_OSST & IXP4XX_OSST_TIMER_WARM_RESET) ?
                        WDIOF_CARDRESET : 0;
-
+       ret = misc_register(&ixp4xx_wdt_miscdev);
+       if (ret == 0)
+               printk(KERN_INFO "IXP4xx Watchdog Timer: heartbeat %d sec\n",
+                       heartbeat);
        return ret;
 }
 
index df5a6b8..f8566d5 100644 (file)
@@ -19,8 +19,8 @@
 #include <linux/platform_device.h>
 #include <linux/types.h>
 #include <linux/watchdog.h>
-#include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/io.h>
+#include <linux/uaccess.h>
 #include <asm/arch/regs-timer.h>
 
 
@@ -31,38 +31,44 @@ static int wdt_time = WDT_DEFAULT_TIME;
 static int nowayout = WATCHDOG_NOWAYOUT;
 
 module_param(wdt_time, int, 0);
-MODULE_PARM_DESC(wdt_time, "Watchdog time in seconds. (default="__MODULE_STRING(WDT_DEFAULT_TIME) ")");
+MODULE_PARM_DESC(wdt_time, "Watchdog time in seconds. (default="
+                                       __MODULE_STRING(WDT_DEFAULT_TIME) ")");
 
 #ifdef CONFIG_WATCHDOG_NOWAYOUT
 module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
+                               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 #endif
 
 
 static unsigned long ks8695wdt_busy;
+static spinlock_t ks8695_lock;
 
 /* ......................................................................... */
 
 /*
  * Disable the watchdog.
  */
-static void inline ks8695_wdt_stop(void)
+static inline void ks8695_wdt_stop(void)
 {
        unsigned long tmcon;
 
+       spin_lock(&ks8695_lock);
        /* disable timer0 */
        tmcon = __raw_readl(KS8695_TMR_VA + KS8695_TMCON);
        __raw_writel(tmcon & ~TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON);
+       spin_unlock(&ks8695_lock);
 }
 
 /*
  * Enable and reset the watchdog.
  */
-static void inline ks8695_wdt_start(void)
+static inline void ks8695_wdt_start(void)
 {
        unsigned long tmcon;
        unsigned long tval = wdt_time * CLOCK_TICK_RATE;
 
+       spin_lock(&ks8695_lock);
        /* disable timer0 */
        tmcon = __raw_readl(KS8695_TMR_VA + KS8695_TMCON);
        __raw_writel(tmcon & ~TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON);
@@ -73,19 +79,22 @@ static void inline ks8695_wdt_start(void)
        /* re-enable timer0 */
        tmcon = __raw_readl(KS8695_TMR_VA + KS8695_TMCON);
        __raw_writel(tmcon | TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON);
+       spin_unlock(&ks8695_lock);
 }
 
 /*
  * Reload the watchdog timer.  (ie, pat the watchdog)
  */
-static void inline ks8695_wdt_reload(void)
+static inline void ks8695_wdt_reload(void)
 {
        unsigned long tmcon;
 
+       spin_lock(&ks8695_lock);
        /* disable, then re-enable timer0 */
        tmcon = __raw_readl(KS8695_TMR_VA + KS8695_TMCON);
        __raw_writel(tmcon & ~TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON);
        __raw_writel(tmcon | TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON);
+       spin_unlock(&ks8695_lock);
 }
 
 /*
@@ -102,7 +111,8 @@ static int ks8695_wdt_settimeout(int new_time)
        if ((new_time <= 0) || (new_time > WDT_MAX_TIME))
                return -EINVAL;
 
-       /* Set new watchdog time. It will be used when ks8695_wdt_start() is called. */
+       /* Set new watchdog time. It will be used when
+          ks8695_wdt_start() is called. */
        wdt_time = new_time;
        return 0;
 }
@@ -128,9 +138,9 @@ static int ks8695_wdt_open(struct inode *inode, struct file *file)
  */
 static int ks8695_wdt_close(struct inode *inode, struct file *file)
 {
+       /* Disable the watchdog when file is closed */
        if (!nowayout)
-               ks8695_wdt_stop();      /* Disable the watchdog when file is closed */
-
+               ks8695_wdt_stop();
        clear_bit(0, &ks8695wdt_busy);
        return 0;
 }
@@ -143,60 +153,52 @@ static struct watchdog_info ks8695_wdt_info = {
 /*
  * Handle commands from user-space.
  */
-static int ks8695_wdt_ioctl(struct inode *inode, struct file *file,
-               unsigned int cmd, unsigned long arg)
+static long ks8695_wdt_ioctl(struct file *file, unsigned int cmd,
+                                                       unsigned long arg)
 {
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
        int new_value;
 
-       switch(cmd) {
-               case WDIOC_KEEPALIVE:
-                       ks8695_wdt_reload();    /* pat the watchdog */
-                       return 0;
-
-               case WDIOC_GETSUPPORT:
-                       return copy_to_user(argp, &ks8695_wdt_info, sizeof(ks8695_wdt_info)) ? -EFAULT : 0;
-
-               case WDIOC_SETTIMEOUT:
-                       if (get_user(new_value, p))
-                               return -EFAULT;
-
-                       if (ks8695_wdt_settimeout(new_value))
-                               return -EINVAL;
-
-                       /* Enable new time value */
+       switch (cmd) {
+       case WDIOC_GETSUPPORT:
+               return copy_to_user(argp, &ks8695_wdt_info,
+                                       sizeof(ks8695_wdt_info)) ? -EFAULT : 0;
+       case WDIOC_GETSTATUS:
+       case WDIOC_GETBOOTSTATUS:
+               return put_user(0, p);
+       case WDIOC_SETOPTIONS:
+               if (get_user(new_value, p))
+                       return -EFAULT;
+               if (new_value & WDIOS_DISABLECARD)
+                       ks8695_wdt_stop();
+               if (new_value & WDIOS_ENABLECARD)
                        ks8695_wdt_start();
-
-                       /* Return current value */
-                       return put_user(wdt_time, p);
-
-               case WDIOC_GETTIMEOUT:
-                       return put_user(wdt_time, p);
-
-               case WDIOC_GETSTATUS:
-               case WDIOC_GETBOOTSTATUS:
-                       return put_user(0, p);
-
-               case WDIOC_SETOPTIONS:
-                       if (get_user(new_value, p))
-                               return -EFAULT;
-
-                       if (new_value & WDIOS_DISABLECARD)
-                               ks8695_wdt_stop();
-                       if (new_value & WDIOS_ENABLECARD)
-                               ks8695_wdt_start();
-                       return 0;
-
-               default:
-                       return -ENOTTY;
+               return 0;
+       case WDIOC_KEEPALIVE:
+               ks8695_wdt_reload();    /* pat the watchdog */
+               return 0;
+       case WDIOC_SETTIMEOUT:
+               if (get_user(new_value, p))
+                       return -EFAULT;
+               if (ks8695_wdt_settimeout(new_value))
+                       return -EINVAL;
+               /* Enable new time value */
+               ks8695_wdt_start();
+               /* Return current value */
+               return put_user(wdt_time, p);
+       case WDIOC_GETTIMEOUT:
+               return put_user(wdt_time, p);
+       default:
+               return -ENOTTY;
        }
 }
 
 /*
  * Pat the watchdog whenever device is written to.
  */
-static ssize_t ks8695_wdt_write(struct file *file, const char *data, size_t len, loff_t *ppos)
+static ssize_t ks8695_wdt_write(struct file *file, const char *data,
+                                               size_t len, loff_t *ppos)
 {
        ks8695_wdt_reload();            /* pat the watchdog */
        return len;
@@ -207,7 +209,7 @@ static ssize_t ks8695_wdt_write(struct file *file, const char *data, size_t len,
 static const struct file_operations ks8695wdt_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
-       .ioctl          = ks8695_wdt_ioctl,
+       .unlocked_ioctl = ks8695_wdt_ioctl,
        .open           = ks8695_wdt_open,
        .release        = ks8695_wdt_close,
        .write          = ks8695_wdt_write,
@@ -231,7 +233,8 @@ static int __init ks8695wdt_probe(struct platform_device *pdev)
        if (res)
                return res;
 
-       printk("KS8695 Watchdog Timer enabled (%d seconds%s)\n", wdt_time, nowayout ? ", nowayout" : "");
+       printk(KERN_INFO "KS8695 Watchdog Timer enabled (%d seconds%s)\n",
+                               wdt_time, nowayout ? ", nowayout" : "");
        return 0;
 }
 
@@ -285,12 +288,14 @@ static struct platform_driver ks8695wdt_driver = {
 
 static int __init ks8695_wdt_init(void)
 {
-       /* Check that the heartbeat value is within range; if not reset to the default */
+       spin_lock_init(&ks8695_lock);
+       /* Check that the heartbeat value is within range;
+          if not reset to the default */
        if (ks8695_wdt_settimeout(wdt_time)) {
                ks8695_wdt_settimeout(WDT_DEFAULT_TIME);
-               pr_info("ks8695_wdt: wdt_time value must be 1 <= wdt_time <= %i, using %d\n", wdt_time, WDT_MAX_TIME);
+               pr_info("ks8695_wdt: wdt_time value must be 1 <= wdt_time <= %i, using %d\n",
+                                                       wdt_time, WDT_MAX_TIME);
        }
-
        return platform_driver_register(&ks8695wdt_driver);
 }
 
index 6905135..2dfc275 100644 (file)
@@ -40,9 +40,9 @@
 #include <linux/notifier.h>
 #include <linux/reboot.h>
 #include <linux/init.h>
+#include <linux/io.h>
+#include <linux/uaccess.h>
 
-#include <asm/io.h>
-#include <asm/uaccess.h>
 #include <asm/system.h>
 
 /* ports */
@@ -95,7 +95,9 @@ MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
 
 static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout,
+               "Watchdog cannot be stopped once started (default="
+                               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 #define PFX "machzwd"
 
@@ -114,7 +116,7 @@ static struct watchdog_info zf_info = {
  * 3 = GEN_SCI
  * defaults to GEN_RESET (0)
  */
-static int action = 0;
+static int action;
 module_param(action, int, 0);
 MODULE_PARM_DESC(action, "after watchdog resets, generate: 0 = RESET(*)  1 = SMI  2 = NMI  3 = SCI");
 
@@ -123,10 +125,9 @@ static void zf_ping(unsigned long data);
 static int zf_action = GEN_RESET;
 static unsigned long zf_is_open;
 static char zf_expect_close;
-static DEFINE_SPINLOCK(zf_lock);
 static DEFINE_SPINLOCK(zf_port_lock);
 static DEFINE_TIMER(zf_timer, zf_ping, 0, 0);
-static unsigned long next_heartbeat = 0;
+static unsigned long next_heartbeat;
 
 
 /* timeout for user land heart beat (10 seconds) */
@@ -171,13 +172,13 @@ static inline void zf_set_control(unsigned short new)
 
 static inline void zf_set_timer(unsigned short new, unsigned char n)
 {
-       switch(n){
-               case WD1:
-                       zf_writew(COUNTER_1, new);
-               case WD2:
-                       zf_writeb(COUNTER_2, new > 0xff ? 0xff : new);
-               default:
-                       return;
+       switch (n) {
+       case WD1:
+               zf_writew(COUNTER_1, new);
+       case WD2:
+               zf_writeb(COUNTER_2, new > 0xff ? 0xff : new);
+       default:
+               return;
        }
 }
 
@@ -241,10 +242,8 @@ static void zf_ping(unsigned long data)
 
        zf_writeb(COUNTER_2, 0xff);
 
-       if(time_before(jiffies, next_heartbeat)){
-
+       if (time_before(jiffies, next_heartbeat)) {
                dprintk("time_before: %ld\n", next_heartbeat - jiffies);
-
                /*
                 * reset event is activated by transition from 0 to 1 on
                 * RESET_WD1 bit and we assume that it is already zero...
@@ -261,24 +260,21 @@ static void zf_ping(unsigned long data)
                spin_unlock_irqrestore(&zf_port_lock, flags);
 
                mod_timer(&zf_timer, jiffies + ZF_HW_TIMEO);
-       }else{
+       } else
                printk(KERN_CRIT PFX ": I will reset your machine\n");
-       }
 }
 
 static ssize_t zf_write(struct file *file, const char __user *buf, size_t count,
                                                                loff_t *ppos)
 {
        /* See if we got the magic character */
-       if(count){
-
+       if (count) {
                /*
                 * no need to check for close confirmation
                 * no way to disable watchdog ;)
                 */
                if (!nowayout) {
                        size_t ofs;
-
                        /*
                         * note: just in case someone wrote the magic character
                         * five months ago...
@@ -286,11 +282,11 @@ static ssize_t zf_write(struct file *file, const char __user *buf, size_t count,
                        zf_expect_close = 0;
 
                        /* now scan */
-                       for (ofs = 0; ofs != count; ofs++){
+                       for (ofs = 0; ofs != count; ofs++) {
                                char c;
                                if (get_user(c, buf + ofs))
                                        return -EFAULT;
-                               if (c == 'V'){
+                               if (c == 'V') {
                                        zf_expect_close = 42;
                                        dprintk("zf_expect_close = 42\n");
                                }
@@ -303,14 +299,11 @@ static ssize_t zf_write(struct file *file, const char __user *buf, size_t count,
                 */
                next_heartbeat = jiffies + ZF_USER_TIMEO;
                dprintk("user ping at %ld\n", jiffies);
-
        }
-
        return count;
 }
 
-static int zf_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-       unsigned long arg)
+static long zf_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
@@ -319,55 +312,38 @@ static int zf_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
                if (copy_to_user(argp, &zf_info, sizeof(zf_info)))
                        return -EFAULT;
                break;
-
        case WDIOC_GETSTATUS:
        case WDIOC_GETBOOTSTATUS:
                return put_user(0, p);
-
        case WDIOC_KEEPALIVE:
                zf_ping(0);
                break;
-
        default:
                return -ENOTTY;
        }
-
        return 0;
 }
 
 static int zf_open(struct inode *inode, struct file *file)
 {
-       spin_lock(&zf_lock);
-       if(test_and_set_bit(0, &zf_is_open)) {
-               spin_unlock(&zf_lock);
+       if (test_and_set_bit(0, &zf_is_open))
                return -EBUSY;
-       }
-
        if (nowayout)
                __module_get(THIS_MODULE);
-
-       spin_unlock(&zf_lock);
-
        zf_timer_on();
-
        return nonseekable_open(inode, file);
 }
 
 static int zf_close(struct inode *inode, struct file *file)
 {
-       if(zf_expect_close == 42){
+       if (zf_expect_close == 42)
                zf_timer_off();
-       else {
+       else {
                del_timer(&zf_timer);
                printk(KERN_ERR PFX ": device file closed unexpectedly. Will not stop the WDT!\n");
        }
-
-       spin_lock(&zf_lock);
        clear_bit(0, &zf_is_open);
-       spin_unlock(&zf_lock);
-
        zf_expect_close = 0;
-
        return 0;
 }
 
@@ -378,23 +354,18 @@ static int zf_close(struct inode *inode, struct file *file)
 static int zf_notify_sys(struct notifier_block *this, unsigned long code,
                                                                void *unused)
 {
-       if(code == SYS_DOWN || code == SYS_HALT){
+       if (code == SYS_DOWN || code == SYS_HALT)
                zf_timer_off();
-       }
-
        return NOTIFY_DONE;
 }
 
-
-
-
 static const struct file_operations zf_fops = {
-       .owner          = THIS_MODULE,
-       .llseek         = no_llseek,
-       .write          = zf_write,
-       .ioctl          = zf_ioctl,
-       .open           = zf_open,
-       .release        = zf_close,
+       .owner          = THIS_MODULE,
+       .llseek         = no_llseek,
+       .write          = zf_write,
+       .unlocked_ioctl = zf_ioctl,
+       .open           = zf_open,
+       .release        = zf_close,
 };
 
 static struct miscdevice zf_miscdev = {
@@ -402,7 +373,7 @@ static struct miscdevice zf_miscdev = {
        .name = "watchdog",
        .fops = &zf_fops,
 };
+
 
 /*
  * The device needs to learn about soft shutdowns in order to
@@ -423,22 +394,23 @@ static int __init zf_init(void)
 {
        int ret;
 
-       printk(KERN_INFO PFX ": MachZ ZF-Logic Watchdog driver initializing.\n");
+       printk(KERN_INFO PFX
+               ": MachZ ZF-Logic Watchdog driver initializing.\n");
 
        ret = zf_get_ZFL_version();
-       if ((!ret) || (ret == 0xffff)) {
+       if (!ret || ret == 0xffff) {
                printk(KERN_WARNING PFX ": no ZF-Logic found\n");
                return -ENODEV;
        }
 
-       if((action <= 3) && (action >= 0)){
-               zf_action = zf_action>>action;
-       else
+       if (action <= 3 && action >= 0)
+               zf_action = zf_action >> action;
+       else
                action = 0;
 
        zf_show_action(action);
 
-       if(!request_region(ZF_IOBASE, 3, "MachZ ZFL WDT")){
+       if (!request_region(ZF_IOBASE, 3, "MachZ ZFL WDT")) {
                printk(KERN_ERR "cannot reserve I/O ports at %d\n",
                                                        ZF_IOBASE);
                ret = -EBUSY;
@@ -446,14 +418,14 @@ static int __init zf_init(void)
        }
 
        ret = register_reboot_notifier(&zf_notifier);
-       if(ret){
+       if (ret) {
                printk(KERN_ERR "can't register reboot notifier (err=%d)\n",
                                                                        ret);
                goto no_reboot;
        }
 
        ret = misc_register(&zf_miscdev);
-       if (ret){
+       if (ret) {
                printk(KERN_ERR "can't misc_register on minor=%d\n",
                                                        WATCHDOG_MINOR);
                goto no_misc;
index 1adf1d5..407b025 100644 (file)
@@ -29,7 +29,8 @@
  *             - support for one more type board
  *
  * Version 0.5 (2001/12/14) Matt Domsch <Matt_Domsch@dell.com>
- *             - added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT
+ *             - added nowayout module option to override
+ *               CONFIG_WATCHDOG_NOWAYOUT
  *
  * Version 0.6 (2002/04/12): Rob Radez <rob@osinvestor.com>
  *             - make mixcomwd_opened unsigned,
@@ -53,8 +54,8 @@
 #include <linux/init.h>
 #include <linux/jiffies.h>
 #include <linux/timer.h>
-#include <asm/uaccess.h>
-#include <asm/io.h>
+#include <linux/uaccess.h>
+#include <linux/io.h>
 
 /*
  * We have two types of cards that can be probed:
@@ -108,18 +109,19 @@ static char expect_close;
 
 static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout,
+               "Watchdog cannot be stopped once started (default="
+                               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 static void mixcomwd_ping(void)
 {
-       outb_p(55,watchdog_port);
+       outb_p(55, watchdog_port);
        return;
 }
 
 static void mixcomwd_timerfun(unsigned long d)
 {
        mixcomwd_ping();
-
        mod_timer(&mixcomwd_timer, jiffies + 5 * HZ);
 }
 
@@ -129,22 +131,22 @@ static void mixcomwd_timerfun(unsigned long d)
 
 static int mixcomwd_open(struct inode *inode, struct file *file)
 {
-       if(test_and_set_bit(0,&mixcomwd_opened)) {
+       if (test_and_set_bit(0, &mixcomwd_opened))
                return -EBUSY;
-       }
+
        mixcomwd_ping();
 
-       if (nowayout) {
+       if (nowayout)
                /*
                 * fops_get() code via open() has already done
                 * a try_module_get() so it is safe to do the
                 * __module_get().
                 */
                __module_get(THIS_MODULE);
-       else {
-               if(mixcomwd_timer_alive) {
+       else {
+               if (mixcomwd_timer_alive) {
                        del_timer(&mixcomwd_timer);
-                       mixcomwd_timer_alive=0;
+                       mixcomwd_timer_alive = 0;
                }
        }
        return nonseekable_open(inode, file);
@@ -153,26 +155,27 @@ static int mixcomwd_open(struct inode *inode, struct file *file)
 static int mixcomwd_release(struct inode *inode, struct file *file)
 {
        if (expect_close == 42) {
-               if(mixcomwd_timer_alive) {
-                       printk(KERN_ERR PFX "release called while internal timer alive");
+               if (mixcomwd_timer_alive) {
+                       printk(KERN_ERR PFX
+                               "release called while internal timer alive");
                        return -EBUSY;
                }
-               mixcomwd_timer_alive=1;
+               mixcomwd_timer_alive = 1;
                mod_timer(&mixcomwd_timer, jiffies + 5 * HZ);
-       } else {
-               printk(KERN_CRIT PFX "WDT device closed unexpectedly.  WDT will not stop!\n");
-       }
+       } else
+               printk(KERN_CRIT PFX
+                   "WDT device closed unexpectedly.  WDT will not stop!\n");
 
-       clear_bit(0,&mixcomwd_opened);
-       expect_close=0;
+       clear_bit(0, &mixcomwd_opened);
+       expect_close = 0;
        return 0;
 }
 
 
-static ssize_t mixcomwd_write(struct file *file, const char __user *data, size_t len, loff_t *ppos)
+static ssize_t mixcomwd_write(struct file *file, const char __user *data,
+                                               size_t len, loff_t *ppos)
 {
-       if(len)
-       {
+       if (len) {
                if (!nowayout) {
                        size_t i;
 
@@ -192,8 +195,8 @@ static ssize_t mixcomwd_write(struct file *file, const char __user *data, size_t
        return len;
 }
 
-static int mixcomwd_ioctl(struct inode *inode, struct file *file,
-       unsigned int cmd, unsigned long arg)
+static long mixcomwd_ioctl(struct file *file,
+                               unsigned int cmd, unsigned long arg)
 {
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
@@ -204,32 +207,23 @@ static int mixcomwd_ioctl(struct inode *inode, struct file *file,
                .identity = "MixCOM watchdog",
        };
 
-       switch(cmd)
-       {
-               case WDIOC_GETSTATUS:
-                       status=mixcomwd_opened;
-                       if (!nowayout) {
-                               status|=mixcomwd_timer_alive;
-                       }
-                       if (copy_to_user(p, &status, sizeof(int))) {
-                               return -EFAULT;
-                       }
-                       break;
-               case WDIOC_GETBOOTSTATUS:
-                       if (copy_to_user(p, &status, sizeof(int))) {
-                               return -EFAULT;
-                       }
-                       break;
-               case WDIOC_GETSUPPORT:
-                       if (copy_to_user(argp, &ident, sizeof(ident))) {
-                               return -EFAULT;
-                       }
-                       break;
-               case WDIOC_KEEPALIVE:
-                       mixcomwd_ping();
-                       break;
-               default:
-                       return -ENOTTY;
+       switch (cmd) {
+       case WDIOC_GETSUPPORT:
+               if (copy_to_user(argp, &ident, sizeof(ident)))
+                       return -EFAULT;
+               break;
+       case WDIOC_GETSTATUS:
+               status = mixcomwd_opened;
+               if (!nowayout)
+                       status |= mixcomwd_timer_alive;
+               return put_user(status, p);
+       case WDIOC_GETBOOTSTATUS:
+               return put_user(0, p);
+       case WDIOC_KEEPALIVE:
+               mixcomwd_ping();
+               break;
+       default:
+               return -ENOTTY;
        }
        return 0;
 }
@@ -238,7 +232,7 @@ static const struct file_operations mixcomwd_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = mixcomwd_write,
-       .ioctl          = mixcomwd_ioctl,
+       .unlocked_ioctl = mixcomwd_ioctl,
        .open           = mixcomwd_open,
        .release        = mixcomwd_release,
 };
@@ -253,15 +247,14 @@ static int __init checkcard(int port, int card_id)
 {
        int id;
 
-       if (!request_region(port, 1, "MixCOM watchdog")) {
+       if (!request_region(port, 1, "MixCOM watchdog"))
                return 0;
-       }
 
-       id=inb_p(port);
-       if (card_id==MIXCOM_ID)
+       id = inb_p(port);
+       if (card_id == MIXCOM_ID)
                id &= 0x3f;
 
-       if (id!=card_id) {
+       if (id != card_id) {
                release_region(port, 1);
                return 0;
        }
@@ -270,9 +263,7 @@ static int __init checkcard(int port, int card_id)
 
 static int __init mixcomwd_init(void)
 {
-       int i;
-       int ret;
-       int found=0;
+       int i, ret, found = 0;
 
        for (i = 0; !found && mixcomwd_io_info[i].ioport != 0; i++) {
                if (checkcard(mixcomwd_io_info[i].ioport,
@@ -283,20 +274,22 @@ static int __init mixcomwd_init(void)
        }
 
        if (!found) {
-               printk(KERN_ERR PFX "No card detected, or port not available.\n");
+               printk(KERN_ERR PFX
+                       "No card detected, or port not available.\n");
                return -ENODEV;
        }
 
        ret = misc_register(&mixcomwd_miscdev);
-       if (ret)
-       {
-               printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
-                       WATCHDOG_MINOR, ret);
+       if (ret) {
+               printk(KERN_ERR PFX
+                       "cannot register miscdev on minor=%d (err=%d)\n",
+                                       WATCHDOG_MINOR, ret);
                goto error_misc_register_watchdog;
        }
 
-       printk(KERN_INFO "MixCOM watchdog driver v%s, watchdog port at 0x%3x\n",
-               VERSION, watchdog_port);
+       printk(KERN_INFO
+               "MixCOM watchdog driver v%s, watchdog port at 0x%3x\n",
+                                       VERSION, watchdog_port);
 
        return 0;
 
@@ -309,15 +302,15 @@ error_misc_register_watchdog:
 static void __exit mixcomwd_exit(void)
 {
        if (!nowayout) {
-               if(mixcomwd_timer_alive) {
+               if (mixcomwd_timer_alive) {
                        printk(KERN_WARNING PFX "I quit now, hardware will"
                               " probably reboot!\n");
                        del_timer_sync(&mixcomwd_timer);
-                       mixcomwd_timer_alive=0;
+                       mixcomwd_timer_alive = 0;
                }
        }
        misc_deregister(&mixcomwd_miscdev);
-       release_region(watchdog_port,1);
+       release_region(watchdog_port, 1);
 }
 
 module_init(mixcomwd_init);
index 77c1c2a..db91892 100644 (file)
@@ -5,7 +5,7 @@
 #include <linux/io.h>
 #include <linux/spinlock.h>
 #include <linux/of_platform.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/mpc52xx.h>
 
 
@@ -57,7 +57,8 @@ static int mpc5200_wdt_start(struct mpc5200_wdt *wdt)
        /* set timeout, with maximum prescaler */
        out_be32(&wdt->regs->count, 0x0 | wdt->count);
        /* enable watchdog */
-       out_be32(&wdt->regs->mode, GPT_MODE_CE | GPT_MODE_WDT | GPT_MODE_MS_TIMER);
+       out_be32(&wdt->regs->mode, GPT_MODE_CE | GPT_MODE_WDT |
+                                               GPT_MODE_MS_TIMER);
        spin_unlock(&wdt->io_lock);
 
        return 0;
@@ -66,7 +67,8 @@ static int mpc5200_wdt_ping(struct mpc5200_wdt *wdt)
 {
        spin_lock(&wdt->io_lock);
        /* writing A5 to OCPW resets the watchdog */
-       out_be32(&wdt->regs->mode, 0xA5000000 | (0xffffff & in_be32(&wdt->regs->mode)));
+       out_be32(&wdt->regs->mode, 0xA5000000 |
+                               (0xffffff & in_be32(&wdt->regs->mode)));
        spin_unlock(&wdt->io_lock);
        return 0;
 }
@@ -92,8 +94,8 @@ static struct watchdog_info mpc5200_wdt_info = {
        .options        = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
        .identity       = "mpc5200 watchdog on GPT0",
 };
-static int mpc5200_wdt_ioctl(struct inode *inode, struct file *file,
-               unsigned int cmd, unsigned long arg)
+static long mpc5200_wdt_ioctl(struct file *file, unsigned int cmd,
+                                                       unsigned long arg)
 {
        struct mpc5200_wdt *wdt = file->private_data;
        int __user *data = (int __user *)arg;
@@ -103,7 +105,7 @@ static int mpc5200_wdt_ioctl(struct inode *inode, struct file *file,
        switch (cmd) {
        case WDIOC_GETSUPPORT:
                ret = copy_to_user(data, &mpc5200_wdt_info,
-                       sizeof(mpc5200_wdt_info));
+                                               sizeof(mpc5200_wdt_info));
                if (ret)
                        ret = -EFAULT;
                break;
@@ -135,6 +137,7 @@ static int mpc5200_wdt_ioctl(struct inode *inode, struct file *file,
        }
        return ret;
 }
+
 static int mpc5200_wdt_open(struct inode *inode, struct file *file)
 {
        /* /dev/watchdog can only be opened once */
@@ -161,13 +164,14 @@ static int mpc5200_wdt_release(struct inode *inode, struct file *file)
 static const struct file_operations mpc5200_wdt_fops = {
        .owner  = THIS_MODULE,
        .write  = mpc5200_wdt_write,
-       .ioctl  = mpc5200_wdt_ioctl,
+       .unlocked_ioctl = mpc5200_wdt_ioctl,
        .open   = mpc5200_wdt_open,
        .release = mpc5200_wdt_release,
 };
 
 /* module operations */
-static int mpc5200_wdt_probe(struct of_device *op, const struct of_device_id *match)
+static int mpc5200_wdt_probe(struct of_device *op,
+                                       const struct of_device_id *match)
 {
        struct mpc5200_wdt *wdt;
        int err;
@@ -215,9 +219,9 @@ static int mpc5200_wdt_probe(struct of_device *op, const struct of_device_id *ma
                return 0;
 
        iounmap(wdt->regs);
- out_release:
+out_release:
        release_mem_region(wdt->mem.start, size);
- out_free:
+out_free:
        kfree(wdt);
        return err;
 }
diff --git a/drivers/watchdog/mpc83xx_wdt.c b/drivers/watchdog/mpc83xx_wdt.c
deleted file mode 100644 (file)
index b16c5cd..0000000
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * mpc83xx_wdt.c - MPC83xx watchdog userspace interface
- *
- * Authors: Dave Updegraff <dave@cray.org>
- *         Kumar Gala <galak@kernel.crashing.org>
- *             Attribution: from 83xx_wst: Florian Schirmer <jolt@tuxbox.org>
- *                             ..and from sc520_wdt
- *
- * Note: it appears that you can only actually ENABLE or DISABLE the thing
- * once after POR. Once enabled, you cannot disable, and vice versa.
- *
- * 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/fs.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/miscdevice.h>
-#include <linux/platform_device.h>
-#include <linux/module.h>
-#include <linux/watchdog.h>
-#include <asm/io.h>
-#include <asm/uaccess.h>
-
-struct mpc83xx_wdt {
-       __be32 res0;
-       __be32 swcrr; /* System watchdog control register */
-#define SWCRR_SWTC 0xFFFF0000 /* Software Watchdog Time Count. */
-#define SWCRR_SWEN 0x00000004 /* Watchdog Enable bit. */
-#define SWCRR_SWRI 0x00000002 /* Software Watchdog Reset/Interrupt Select bit.*/
-#define SWCRR_SWPR 0x00000001 /* Software Watchdog Counter Prescale bit. */
-       __be32 swcnr; /* System watchdog count register */
-       u8 res1[2];
-       __be16 swsrr; /* System watchdog service register */
-       u8 res2[0xF0];
-};
-
-static struct mpc83xx_wdt __iomem *wd_base;
-
-static u16 timeout = 0xffff;
-module_param(timeout, ushort, 0);
-MODULE_PARM_DESC(timeout, "Watchdog timeout in ticks. (0<timeout<65536, default=65535");
-
-static int reset = 1;
-module_param(reset, bool, 0);
-MODULE_PARM_DESC(reset, "Watchdog Interrupt/Reset Mode. 0 = interrupt, 1 = reset");
-
-/*
- * We always prescale, but if someone really doesn't want to they can set this
- * to 0
- */
-static int prescale = 1;
-static unsigned int timeout_sec;
-
-static unsigned long wdt_is_open;
-static DEFINE_SPINLOCK(wdt_spinlock);
-
-static void mpc83xx_wdt_keepalive(void)
-{
-       /* Ping the WDT */
-       spin_lock(&wdt_spinlock);
-       out_be16(&wd_base->swsrr, 0x556c);
-       out_be16(&wd_base->swsrr, 0xaa39);
-       spin_unlock(&wdt_spinlock);
-}
-
-static ssize_t mpc83xx_wdt_write(struct file *file, const char __user *buf,
-                                size_t count, loff_t *ppos)
-{
-       if (count)
-               mpc83xx_wdt_keepalive();
-       return count;
-}
-
-static int mpc83xx_wdt_open(struct inode *inode, struct file *file)
-{
-       u32 tmp = SWCRR_SWEN;
-       if (test_and_set_bit(0, &wdt_is_open))
-               return -EBUSY;
-
-       /* Once we start the watchdog we can't stop it */
-       __module_get(THIS_MODULE);
-
-       /* Good, fire up the show */
-       if (prescale)
-               tmp |= SWCRR_SWPR;
-       if (reset)
-               tmp |= SWCRR_SWRI;
-
-       tmp |= timeout << 16;
-
-       out_be32(&wd_base->swcrr, tmp);
-
-       return nonseekable_open(inode, file);
-}
-
-static int mpc83xx_wdt_release(struct inode *inode, struct file *file)
-{
-       printk(KERN_CRIT "Unexpected close, not stopping watchdog!\n");
-       mpc83xx_wdt_keepalive();
-       clear_bit(0, &wdt_is_open);
-       return 0;
-}
-
-static int mpc83xx_wdt_ioctl(struct inode *inode, struct file *file,
-                               unsigned int cmd, unsigned long arg)
-{
-       void __user *argp = (void __user *)arg;
-       int __user *p = argp;
-       static struct watchdog_info ident = {
-               .options = WDIOF_KEEPALIVEPING,
-               .firmware_version = 1,
-               .identity = "MPC83xx",
-       };
-
-       switch (cmd) {
-       case WDIOC_GETSUPPORT:
-               return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
-       case WDIOC_GETSTATUS:
-       case WDIOC_GETBOOTSTATUS:
-               return put_user(0, p);
-       case WDIOC_KEEPALIVE:
-               mpc83xx_wdt_keepalive();
-               return 0;
-       case WDIOC_GETTIMEOUT:
-               return put_user(timeout_sec, p);
-       default:
-               return -ENOTTY;
-       }
-}
-
-static const struct file_operations mpc83xx_wdt_fops = {
-       .owner          = THIS_MODULE,
-       .llseek         = no_llseek,
-       .write          = mpc83xx_wdt_write,
-       .ioctl          = mpc83xx_wdt_ioctl,
-       .open           = mpc83xx_wdt_open,
-       .release        = mpc83xx_wdt_release,
-};
-
-static struct miscdevice mpc83xx_wdt_miscdev = {
-       .minor  = WATCHDOG_MINOR,
-       .name   = "watchdog",
-       .fops   = &mpc83xx_wdt_fops,
-};
-
-static int __devinit mpc83xx_wdt_probe(struct platform_device *dev)
-{
-       struct resource *r;
-       int ret;
-       unsigned int *freq = dev->dev.platform_data;
-
-       /* get a pointer to the register memory */
-       r = platform_get_resource(dev, IORESOURCE_MEM, 0);
-
-       if (!r) {
-               ret = -ENODEV;
-               goto err_out;
-       }
-
-       wd_base = ioremap(r->start, sizeof (struct mpc83xx_wdt));
-
-       if (wd_base == NULL) {
-               ret = -ENOMEM;
-               goto err_out;
-       }
-
-       ret = misc_register(&mpc83xx_wdt_miscdev);
-       if (ret) {
-               printk(KERN_ERR "cannot register miscdev on minor=%d "
-                               "(err=%d)\n",
-                               WATCHDOG_MINOR, ret);
-               goto err_unmap;
-       }
-
-       /* Calculate the timeout in seconds */
-       if (prescale)
-               timeout_sec = (timeout * 0x10000) / (*freq);
-       else
-               timeout_sec = timeout / (*freq);
-
-       printk(KERN_INFO "WDT driver for MPC83xx initialized. "
-               "mode:%s timeout=%d (%d seconds)\n",
-               reset ? "reset":"interrupt", timeout, timeout_sec);
-       return 0;
-
-err_unmap:
-       iounmap(wd_base);
-err_out:
-       return ret;
-}
-
-static int __devexit mpc83xx_wdt_remove(struct platform_device *dev)
-{
-       misc_deregister(&mpc83xx_wdt_miscdev);
-       iounmap(wd_base);
-
-       return 0;
-}
-
-static struct platform_driver mpc83xx_wdt_driver = {
-       .probe          = mpc83xx_wdt_probe,
-       .remove         = __devexit_p(mpc83xx_wdt_remove),
-       .driver         = {
-               .name   = "mpc83xx_wdt",
-               .owner  = THIS_MODULE,
-       },
-};
-
-static int __init mpc83xx_wdt_init(void)
-{
-       return platform_driver_register(&mpc83xx_wdt_driver);
-}
-
-static void __exit mpc83xx_wdt_exit(void)
-{
-       platform_driver_unregister(&mpc83xx_wdt_driver);
-}
-
-module_init(mpc83xx_wdt_init);
-module_exit(mpc83xx_wdt_exit);
-
-MODULE_AUTHOR("Dave Updegraff, Kumar Gala");
-MODULE_DESCRIPTION("Driver for watchdog timer in MPC83xx uProcessor");
-MODULE_LICENSE("GPL");
-MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
-MODULE_ALIAS("platform:mpc83xx_wdt");
index 85b5734..1336425 100644 (file)
 #include <linux/module.h>
 #include <linux/watchdog.h>
 #include <asm/8xx_immap.h>
-#include <asm/uaccess.h>
-#include <asm/io.h>
+#include <linux/uaccess.h>
+#include <linux/io.h>
 #include <syslib/m8xx_wdt.h>
 
 static unsigned long wdt_opened;
 static int wdt_status;
+static spinlock_t wdt_lock;
 
 static void mpc8xx_wdt_handler_disable(void)
 {
        volatile uint __iomem *piscr;
-       piscr = (uint *)&((immap_t*)IMAP_ADDR)->im_sit.sit_piscr;
+       piscr = (uint *)&((immap_t *)IMAP_ADDR)->im_sit.sit_piscr;
 
        if (!m8xx_has_internal_rtc)
                m8xx_wdt_stop_timer();
        else
                out_be32(piscr, in_be32(piscr) & ~(PISCR_PIE | PISCR_PTE));
-
        printk(KERN_NOTICE "mpc8xx_wdt: keep-alive handler deactivated\n");
 }
 
 static void mpc8xx_wdt_handler_enable(void)
 {
        volatile uint __iomem *piscr;
-       piscr = (uint *)&((immap_t*)IMAP_ADDR)->im_sit.sit_piscr;
+       piscr = (uint *)&((immap_t *)IMAP_ADDR)->im_sit.sit_piscr;
 
        if (!m8xx_has_internal_rtc)
                m8xx_wdt_install_timer();
        else
                out_be32(piscr, in_be32(piscr) | PISCR_PIE | PISCR_PTE);
-
        printk(KERN_NOTICE "mpc8xx_wdt: keep-alive handler activated\n");
 }
 
@@ -53,37 +52,34 @@ static int mpc8xx_wdt_open(struct inode *inode, struct file *file)
 {
        if (test_and_set_bit(0, &wdt_opened))
                return -EBUSY;
-
        m8xx_wdt_reset();
        mpc8xx_wdt_handler_disable();
-
        return nonseekable_open(inode, file);
 }
 
 static int mpc8xx_wdt_release(struct inode *inode, struct file *file)
 {
        m8xx_wdt_reset();
-
 #if !defined(CONFIG_WATCHDOG_NOWAYOUT)
        mpc8xx_wdt_handler_enable();
 #endif
-
        clear_bit(0, &wdt_opened);
-
        return 0;
 }
 
-static ssize_t mpc8xx_wdt_write(struct file *file, const char *data, size_t len,
-                               loff_t * ppos)
+static ssize_t mpc8xx_wdt_write(struct file *file, const char *data,
+                                               size_t len, loff_t *ppos)
 {
-       if (len)
+       if (len) {
+               spin_lock(&wdt_lock);
                m8xx_wdt_reset();
-
+               spin_unlock(&wdt_lock);
+       }
        return len;
 }
 
-static int mpc8xx_wdt_ioctl(struct inode *inode, struct file *file,
-                           unsigned int cmd, unsigned long arg)
+static long mpc8xx_wdt_ioctl(struct file *file,
+                                       unsigned int cmd, unsigned long arg)
 {
        int timeout;
        static struct watchdog_info info = {
@@ -112,15 +108,19 @@ static int mpc8xx_wdt_ioctl(struct inode *inode, struct file *file,
                return -EOPNOTSUPP;
 
        case WDIOC_KEEPALIVE:
+               spin_lock(&wdt_lock);
                m8xx_wdt_reset();
                wdt_status |= WDIOF_KEEPALIVEPING;
+               spin_unlock(&wdt_lock);
                break;
 
        case WDIOC_SETTIMEOUT:
                return -EOPNOTSUPP;
 
        case WDIOC_GETTIMEOUT:
+               spin_lock(&wdt_lock);
                timeout = m8xx_wdt_get_timeout();
+               spin_unlock(&wdt_lock);
                if (put_user(timeout, (int *)arg))
                        return -EFAULT;
                break;
@@ -136,7 +136,7 @@ static const struct file_operations mpc8xx_wdt_fops = {
        .owner = THIS_MODULE,
        .llseek = no_llseek,
        .write = mpc8xx_wdt_write,
-       .ioctl = mpc8xx_wdt_ioctl,
+       .unlocked_ioctl = mpc8xx_wdt_ioctl,
        .open = mpc8xx_wdt_open,
        .release = mpc8xx_wdt_release,
 };
@@ -149,6 +149,7 @@ static struct miscdevice mpc8xx_wdt_miscdev = {
 
 static int __init mpc8xx_wdt_init(void)
 {
+       spin_lock_init(&wdt_lock);
        return misc_register(&mpc8xx_wdt_miscdev);
 }
 
diff --git a/drivers/watchdog/mpc8xxx_wdt.c b/drivers/watchdog/mpc8xxx_wdt.c
new file mode 100644 (file)
index 0000000..f209496
--- /dev/null
@@ -0,0 +1,316 @@
+/*
+ * mpc8xxx_wdt.c - MPC8xx/MPC83xx/MPC86xx watchdog userspace interface
+ *
+ * Authors: Dave Updegraff <dave@cray.org>
+ *         Kumar Gala <galak@kernel.crashing.org>
+ *             Attribution: from 83xx_wst: Florian Schirmer <jolt@tuxbox.org>
+ *                             ..and from sc520_wdt
+ * Copyright (c) 2008  MontaVista Software, Inc.
+ *                     Anton Vorontsov <avorontsov@ru.mvista.com>
+ *
+ * Note: it appears that you can only actually ENABLE or DISABLE the thing
+ * once after POR. Once enabled, you cannot disable, and vice versa.
+ *
+ * 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/fs.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/timer.h>
+#include <linux/miscdevice.h>
+#include <linux/of_platform.h>
+#include <linux/module.h>
+#include <linux/watchdog.h>
+#include <linux/io.h>
+#include <linux/uaccess.h>
+#include <sysdev/fsl_soc.h>
+
+struct mpc8xxx_wdt {
+       __be32 res0;
+       __be32 swcrr; /* System watchdog control register */
+#define SWCRR_SWTC 0xFFFF0000 /* Software Watchdog Time Count. */
+#define SWCRR_SWEN 0x00000004 /* Watchdog Enable bit. */
+#define SWCRR_SWRI 0x00000002 /* Software Watchdog Reset/Interrupt Select bit.*/
+#define SWCRR_SWPR 0x00000001 /* Software Watchdog Counter Prescale bit. */
+       __be32 swcnr; /* System watchdog count register */
+       u8 res1[2];
+       __be16 swsrr; /* System watchdog service register */
+       u8 res2[0xF0];
+};
+
+struct mpc8xxx_wdt_type {
+       int prescaler;
+       bool hw_enabled;
+};
+
+static struct mpc8xxx_wdt __iomem *wd_base;
+
+static u16 timeout = 0xffff;
+module_param(timeout, ushort, 0);
+MODULE_PARM_DESC(timeout,
+       "Watchdog timeout in ticks. (0<timeout<65536, default=65535");
+
+static int reset = 1;
+module_param(reset, bool, 0);
+MODULE_PARM_DESC(reset,
+       "Watchdog Interrupt/Reset Mode. 0 = interrupt, 1 = reset");
+
+static int nowayout = WATCHDOG_NOWAYOUT;
+module_param(nowayout, int, 0);
+MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started "
+                "(default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+
+/*
+ * We always prescale, but if someone really doesn't want to they can set this
+ * to 0
+ */
+static int prescale = 1;
+static unsigned int timeout_sec;
+
+static unsigned long wdt_is_open;
+static DEFINE_SPINLOCK(wdt_spinlock);
+
+static void mpc8xxx_wdt_keepalive(void)
+{
+       /* Ping the WDT */
+       spin_lock(&wdt_spinlock);
+       out_be16(&wd_base->swsrr, 0x556c);
+       out_be16(&wd_base->swsrr, 0xaa39);
+       spin_unlock(&wdt_spinlock);
+}
+
+static void mpc8xxx_wdt_timer_ping(unsigned long arg);
+static DEFINE_TIMER(wdt_timer, mpc8xxx_wdt_timer_ping, 0, 0);
+
+static void mpc8xxx_wdt_timer_ping(unsigned long arg)
+{
+       mpc8xxx_wdt_keepalive();
+       /* We're pinging it twice faster than needed, just to be sure. */
+       mod_timer(&wdt_timer, jiffies + HZ * timeout_sec / 2);
+}
+
+static void mpc8xxx_wdt_pr_warn(const char *msg)
+{
+       pr_crit("mpc8xxx_wdt: %s, expect the %s soon!\n", msg,
+               reset ? "reset" : "machine check exception");
+}
+
+static ssize_t mpc8xxx_wdt_write(struct file *file, const char __user *buf,
+                                size_t count, loff_t *ppos)
+{
+       if (count)
+               mpc8xxx_wdt_keepalive();
+       return count;
+}
+
+static int mpc8xxx_wdt_open(struct inode *inode, struct file *file)
+{
+       u32 tmp = SWCRR_SWEN;
+       if (test_and_set_bit(0, &wdt_is_open))
+               return -EBUSY;
+
+       /* Once we start the watchdog we can't stop it */
+       if (nowayout)
+               __module_get(THIS_MODULE);
+
+       /* Good, fire up the show */
+       if (prescale)
+               tmp |= SWCRR_SWPR;
+       if (reset)
+               tmp |= SWCRR_SWRI;
+
+       tmp |= timeout << 16;
+
+       out_be32(&wd_base->swcrr, tmp);
+
+       del_timer_sync(&wdt_timer);
+
+       return nonseekable_open(inode, file);
+}
+
+static int mpc8xxx_wdt_release(struct inode *inode, struct file *file)
+{
+       if (!nowayout)
+               mpc8xxx_wdt_timer_ping(0);
+       else
+               mpc8xxx_wdt_pr_warn("watchdog closed");
+       clear_bit(0, &wdt_is_open);
+       return 0;
+}
+
+static long mpc8xxx_wdt_ioctl(struct file *file, unsigned int cmd,
+                                                       unsigned long arg)
+{
+       void __user *argp = (void __user *)arg;
+       int __user *p = argp;
+       static struct watchdog_info ident = {
+               .options = WDIOF_KEEPALIVEPING,
+               .firmware_version = 1,
+               .identity = "MPC8xxx",
+       };
+
+       switch (cmd) {
+       case WDIOC_GETSUPPORT:
+               return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
+       case WDIOC_GETSTATUS:
+       case WDIOC_GETBOOTSTATUS:
+               return put_user(0, p);
+       case WDIOC_KEEPALIVE:
+               mpc8xxx_wdt_keepalive();
+               return 0;
+       case WDIOC_GETTIMEOUT:
+               return put_user(timeout_sec, p);
+       default:
+               return -ENOTTY;
+       }
+}
+
+static const struct file_operations mpc8xxx_wdt_fops = {
+       .owner          = THIS_MODULE,
+       .llseek         = no_llseek,
+       .write          = mpc8xxx_wdt_write,
+       .unlocked_ioctl = mpc8xxx_wdt_ioctl,
+       .open           = mpc8xxx_wdt_open,
+       .release        = mpc8xxx_wdt_release,
+};
+
+static struct miscdevice mpc8xxx_wdt_miscdev = {
+       .minor  = WATCHDOG_MINOR,
+       .name   = "watchdog",
+       .fops   = &mpc8xxx_wdt_fops,
+};
+
+static int __devinit mpc8xxx_wdt_probe(struct of_device *ofdev,
+                                      const struct of_device_id *match)
+{
+       int ret;
+       struct device_node *np = ofdev->node;
+       struct mpc8xxx_wdt_type *wdt_type = match->data;
+       u32 freq = fsl_get_sys_freq();
+       bool enabled;
+
+       if (!freq || freq == -1)
+               return -EINVAL;
+
+       wd_base = of_iomap(np, 0);
+       if (!wd_base)
+               return -ENOMEM;
+
+       enabled = in_be32(&wd_base->swcrr) & SWCRR_SWEN;
+       if (!enabled && wdt_type->hw_enabled) {
+               pr_info("mpc8xxx_wdt: could not be enabled in software\n");
+               ret = -ENOSYS;
+               goto err_unmap;
+       }
+
+       /* Calculate the timeout in seconds */
+       if (prescale)
+               timeout_sec = (timeout * wdt_type->prescaler) / freq;
+       else
+               timeout_sec = timeout / freq;
+
+       pr_info("WDT driver for MPC8xxx initialized. mode:%s timeout=%d "
+               "(%d seconds)\n", reset ? "reset" : "interrupt", timeout,
+               timeout_sec);
+
+       /*
+        * If the watchdog was previously enabled or we're running on
+        * MPC8xxx, we should ping the wdt from the kernel until the
+        * userspace handles it.
+        */
+       if (enabled)
+               mpc8xxx_wdt_timer_ping(0);
+       return 0;
+err_unmap:
+       iounmap(wd_base);
+       wd_base = NULL;
+       return ret;
+}
+
+static int __devexit mpc8xxx_wdt_remove(struct of_device *ofdev)
+{
+       mpc8xxx_wdt_pr_warn("watchdog removed");
+       del_timer_sync(&wdt_timer);
+       misc_deregister(&mpc8xxx_wdt_miscdev);
+       iounmap(wd_base);
+
+       return 0;
+}
+
+static const struct of_device_id mpc8xxx_wdt_match[] = {
+       {
+               .compatible = "mpc83xx_wdt",
+               .data = &(struct mpc8xxx_wdt_type) {
+                       .prescaler = 0x10000,
+               },
+       },
+       {
+               .compatible = "fsl,mpc8610-wdt",
+               .data = &(struct mpc8xxx_wdt_type) {
+                       .prescaler = 0x10000,
+                       .hw_enabled = true,
+               },
+       },
+       {
+               .compatible = "fsl,mpc823-wdt",
+               .data = &(struct mpc8xxx_wdt_type) {
+                       .prescaler = 0x800,
+               },
+       },
+       {},
+};
+MODULE_DEVICE_TABLE(of, mpc8xxx_wdt_match);
+
+static struct of_platform_driver mpc8xxx_wdt_driver = {
+       .match_table    = mpc8xxx_wdt_match,
+       .probe          = mpc8xxx_wdt_probe,
+       .remove         = __devexit_p(mpc8xxx_wdt_remove),
+       .driver         = {
+               .name   = "mpc8xxx_wdt",
+               .owner  = THIS_MODULE,
+       },
+};
+
+/*
+ * We do wdt initialization in two steps: arch_initcall probes the wdt
+ * very early to start pinging the watchdog (misc devices are not yet
+ * available), and later module_init() just registers the misc device.
+ */
+static int __init mpc8xxx_wdt_init_late(void)
+{
+       int ret;
+
+       if (!wd_base)
+               return -ENODEV;
+
+       ret = misc_register(&mpc8xxx_wdt_miscdev);
+       if (ret) {
+               pr_err("cannot register miscdev on minor=%d (err=%d)\n",
+                       WATCHDOG_MINOR, ret);
+               return ret;
+       }
+       return 0;
+}
+module_init(mpc8xxx_wdt_init_late);
+
+static int __init mpc8xxx_wdt_init(void)
+{
+       return of_register_platform_driver(&mpc8xxx_wdt_driver);
+}
+arch_initcall(mpc8xxx_wdt_init);
+
+static void __exit mpc8xxx_wdt_exit(void)
+{
+       of_unregister_platform_driver(&mpc8xxx_wdt_driver);
+}
+module_exit(mpc8xxx_wdt_exit);
+
+MODULE_AUTHOR("Dave Updegraff, Kumar Gala");
+MODULE_DESCRIPTION("Driver for watchdog timer in MPC8xx/MPC83xx/MPC86xx "
+                  "uProcessors");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
index 009573b..2a9bfa8 100644 (file)
@@ -29,9 +29,9 @@
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
+#include <linux/uaccess.h>
 
 #include <asm/hardware/arm_twd.h>
-#include <asm/uaccess.h>
 
 struct mpcore_wdt {
        unsigned long   timer_alive;
@@ -43,17 +43,20 @@ struct mpcore_wdt {
 };
 
 static struct platform_device *mpcore_wdt_dev;
-
 extern unsigned int mpcore_timer_rate;
 
 #define TIMER_MARGIN   60
 static int mpcore_margin = TIMER_MARGIN;
 module_param(mpcore_margin, int, 0);
-MODULE_PARM_DESC(mpcore_margin, "MPcore timer margin in seconds. (0<mpcore_margin<65536, default=" __MODULE_STRING(TIMER_MARGIN) ")");
+MODULE_PARM_DESC(mpcore_margin,
+       "MPcore timer margin in seconds. (0 < mpcore_margin < 65536, default="
+                               __MODULE_STRING(TIMER_MARGIN) ")");
 
 static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout,
+       "Watchdog cannot be stopped once started (default="
+                               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 #define ONLY_TESTING   0
 static int mpcore_noboot = ONLY_TESTING;
@@ -70,14 +73,12 @@ static irqreturn_t mpcore_wdt_fire(int irq, void *arg)
 
        /* Check it really was our interrupt */
        if (readl(wdt->base + TWD_WDOG_INTSTAT)) {
-               dev_printk(KERN_CRIT, wdt->dev, "Triggered - Reboot ignored.\n");
-
+               dev_printk(KERN_CRIT, wdt->dev,
+                                       "Triggered - Reboot ignored.\n");
                /* Clear the interrupt on the watchdog */
                writel(1, wdt->base + TWD_WDOG_INTSTAT);
-
                return IRQ_HANDLED;
        }
-
        return IRQ_NONE;
 }
 
@@ -96,22 +97,26 @@ static void mpcore_wdt_keepalive(struct mpcore_wdt *wdt)
        count = (mpcore_timer_rate / 256) * mpcore_margin;
 
        /* Reload the counter */
+       spin_lock(&wdt_lock);
        writel(count + wdt->perturb, wdt->base + TWD_WDOG_LOAD);
-
        wdt->perturb = wdt->perturb ? 0 : 1;
+       spin_unlock(&wdt_lock);
 }
 
 static void mpcore_wdt_stop(struct mpcore_wdt *wdt)
 {
+       spin_lock(&wdt_lock);
        writel(0x12345678, wdt->base + TWD_WDOG_DISABLE);
        writel(0x87654321, wdt->base + TWD_WDOG_DISABLE);
        writel(0x0, wdt->base + TWD_WDOG_CONTROL);
+       spin_unlock(&wdt_lock);
 }
 
 static void mpcore_wdt_start(struct mpcore_wdt *wdt)
 {
        dev_printk(KERN_INFO, wdt->dev, "enabling watchdog.\n");
 
+       spin_lock(&wdt_lock);
        /* This loads the count register but does NOT start the count yet */
        mpcore_wdt_keepalive(wdt);
 
@@ -122,6 +127,7 @@ static void mpcore_wdt_start(struct mpcore_wdt *wdt)
                /* Enable watchdog - prescale=256, watchdog mode=1, enable=1 */
                writel(0x0000FF09, wdt->base + TWD_WDOG_CONTROL);
        }
+       spin_unlock(&wdt_lock);
 }
 
 static int mpcore_wdt_set_heartbeat(int t)
@@ -164,10 +170,11 @@ static int mpcore_wdt_release(struct inode *inode, struct file *file)
         *      Shut off the timer.
         *      Lock it in if it's a module and we set nowayout
         */
-       if (wdt->expect_close == 42) {
+       if (wdt->expect_close == 42)
                mpcore_wdt_stop(wdt);
-       } else {
-               dev_printk(KERN_CRIT, wdt->dev, "unexpected close, not stopping watchdog!\n");
+       else {
+               dev_printk(KERN_CRIT, wdt->dev,
+                               "unexpected close, not stopping watchdog!\n");
                mpcore_wdt_keepalive(wdt);
        }
        clear_bit(0, &wdt->timer_alive);
@@ -175,7 +182,8 @@ static int mpcore_wdt_release(struct inode *inode, struct file *file)
        return 0;
 }
 
-static ssize_t mpcore_wdt_write(struct file *file, const char *data, size_t len, loff_t *ppos)
+static ssize_t mpcore_wdt_write(struct file *file, const char *data,
+                                               size_t len, loff_t *ppos)
 {
        struct mpcore_wdt *wdt = file->private_data;
 
@@ -210,8 +218,8 @@ static struct watchdog_info ident = {
        .identity               = "MPcore Watchdog",
 };
 
-static int mpcore_wdt_ioctl(struct inode *inode, struct file *file,
-                            unsigned int cmd, unsigned long arg)
+static long mpcore_wdt_ioctl(struct file *file, unsigned int cmd,
+                                                       unsigned long arg)
 {
        struct mpcore_wdt *wdt = file->private_data;
        int ret;
@@ -235,6 +243,12 @@ static int mpcore_wdt_ioctl(struct inode *inode, struct file *file,
                ret = 0;
                break;
 
+       case WDIOC_GETSTATUS:
+       case WDIOC_GETBOOTSTATUS:
+               uarg.i = 0;
+               ret = 0;
+               break;
+
        case WDIOC_SETOPTIONS:
                ret = -EINVAL;
                if (uarg.i & WDIOS_DISABLECARD) {
@@ -247,12 +261,6 @@ static int mpcore_wdt_ioctl(struct inode *inode, struct file *file,
                }
                break;
 
-       case WDIOC_GETSTATUS:
-       case WDIOC_GETBOOTSTATUS:
-               uarg.i = 0;
-               ret = 0;
-               break;
-
        case WDIOC_KEEPALIVE:
                mpcore_wdt_keepalive(wdt);
                ret = 0;
@@ -301,7 +309,7 @@ static const struct file_operations mpcore_wdt_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = mpcore_wdt_write,
-       .ioctl          = mpcore_wdt_ioctl,
+       .unlocked_ioctl = mpcore_wdt_ioctl,
        .open           = mpcore_wdt_open,
        .release        = mpcore_wdt_release,
 };
@@ -349,14 +357,17 @@ static int __devinit mpcore_wdt_probe(struct platform_device *dev)
        mpcore_wdt_miscdev.parent = &dev->dev;
        ret = misc_register(&mpcore_wdt_miscdev);
        if (ret) {
-               dev_printk(KERN_ERR, _dev, "cannot register miscdev on minor=%d (err=%d)\n",
-                          WATCHDOG_MINOR, ret);
+               dev_printk(KERN_ERR, _dev,
+                       "cannot register miscdev on minor=%d (err=%d)\n",
+                                                       WATCHDOG_MINOR, ret);
                goto err_misc;
        }
 
-       ret = request_irq(wdt->irq, mpcore_wdt_fire, IRQF_DISABLED, "mpcore_wdt", wdt);
+       ret = request_irq(wdt->irq, mpcore_wdt_fire, IRQF_DISABLED,
+                                                       "mpcore_wdt", wdt);
        if (ret) {
-               dev_printk(KERN_ERR, _dev, "cannot register IRQ%d for watchdog\n", wdt->irq);
+               dev_printk(KERN_ERR, _dev,
+                       "cannot register IRQ%d for watchdog\n", wdt->irq);
                goto err_irq;
        }
 
@@ -366,13 +377,13 @@ static int __devinit mpcore_wdt_probe(struct platform_device *dev)
 
        return 0;
 
- err_irq:
+err_irq:
        misc_deregister(&mpcore_wdt_miscdev);
- err_misc:
+err_misc:
        iounmap(wdt->base);
- err_free:
+err_free:
        kfree(wdt);
- err_out:
+err_out:
        return ret;
 }
 
@@ -415,7 +426,7 @@ static int __init mpcore_wdt_init(void)
         */
        if (mpcore_wdt_set_heartbeat(mpcore_margin)) {
                mpcore_wdt_set_heartbeat(TIMER_MARGIN);
-               printk(KERN_INFO "mpcore_margin value must be 0<mpcore_margin<65536, using %d\n",
+               printk(KERN_INFO "mpcore_margin value must be 0 < mpcore_margin < 65536, using %d\n",
                        TIMER_MARGIN);
        }
 
index a8e6738..b4b7b0a 100644 (file)
@@ -1,7 +1,8 @@
 /*
  *      Driver for the MTX-1 Watchdog.
  *
- *      (C) Copyright 2005 4G Systems <info@4g-systems.biz>, All Rights Reserved.
+ *      (C) Copyright 2005 4G Systems <info@4g-systems.biz>,
+ *                                                     All Rights Reserved.
  *                              http://www.4g-systems.biz
  *
  *     (C) Copyright 2007 OpenWrt.org, Florian Fainelli <florian@openwrt.org>
 #include <linux/jiffies.h>
 #include <linux/watchdog.h>
 #include <linux/platform_device.h>
-
-#include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/io.h>
+#include <linux/uaccess.h>
+#include <linux/gpio.h>
 
 #include <asm/mach-au1x00/au1000.h>
-#include <asm/gpio.h>
 
 #define MTX1_WDT_INTERVAL      (5 * HZ)
 
@@ -59,6 +59,7 @@ static int ticks = 100 * HZ;
 
 static struct {
        struct completion stop;
+       spinlock_t lock;
        int running;
        struct timer_list timer;
        int queue;
@@ -71,6 +72,7 @@ static void mtx1_wdt_trigger(unsigned long unused)
 {
        u32 tmp;
 
+       spin_lock(&mtx1_wdt_device.lock);
        if (mtx1_wdt_device.running)
                ticks--;
        /*
@@ -79,13 +81,13 @@ static void mtx1_wdt_trigger(unsigned long unused)
        tmp = au_readl(GPIO2_DIR);
        tmp = (tmp & ~(1 << mtx1_wdt_device.gpio)) |
              ((~tmp) & (1 << mtx1_wdt_device.gpio));
-       au_writel (tmp, GPIO2_DIR);
+       au_writel(tmp, GPIO2_DIR);
 
        if (mtx1_wdt_device.queue && ticks)
                mod_timer(&mtx1_wdt_device.timer, jiffies + MTX1_WDT_INTERVAL);
-       else {
+       else
                complete(&mtx1_wdt_device.stop);
-       }
+       spin_unlock(&mtx1_wdt_device.lock);
 }
 
 static void mtx1_wdt_reset(void)
@@ -96,23 +98,25 @@ static void mtx1_wdt_reset(void)
 
 static void mtx1_wdt_start(void)
 {
+       spin_lock_irqsave(&mtx1_wdt_device.lock, flags);
        if (!mtx1_wdt_device.queue) {
                mtx1_wdt_device.queue = 1;
                gpio_set_value(mtx1_wdt_device.gpio, 1);
                mod_timer(&mtx1_wdt_device.timer, jiffies + MTX1_WDT_INTERVAL);
        }
        mtx1_wdt_device.running++;
+       spin_unlock_irqrestore(&mtx1_wdt_device.lock, flags);
 }
 
 static int mtx1_wdt_stop(void)
 {
+       spin_lock_irqsave(&mtx1_wdt_device.lock, flags);
        if (mtx1_wdt_device.queue) {
                mtx1_wdt_device.queue = 0;
                gpio_set_value(mtx1_wdt_device.gpio, 0);
        }
-
        ticks = mtx1_wdt_device.default_ticks;
-
+       spin_unlock_irqrestore(&mtx1_wdt_device.lock, flags);
        return 0;
 }
 
@@ -122,7 +126,6 @@ static int mtx1_wdt_open(struct inode *inode, struct file *file)
 {
        if (test_and_set_bit(0, &mtx1_wdt_device.inuse))
                return -EBUSY;
-
        return nonseekable_open(inode, file);
 }
 
@@ -133,54 +136,51 @@ static int mtx1_wdt_release(struct inode *inode, struct file *file)
        return 0;
 }
 
-static int mtx1_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
+static long mtx1_wdt_ioctl(struct file *file, unsigned int cmd,
+                                                       unsigned long arg)
 {
        void __user *argp = (void __user *)arg;
+       int __user *p = (int __user *)argp;
        unsigned int value;
-       static struct watchdog_info ident =
-       {
+       static const struct watchdog_info ident = {
                .options = WDIOF_CARDRESET,
                .identity = "MTX-1 WDT",
        };
 
-       switch(cmd) {
-               case WDIOC_KEEPALIVE:
-                       mtx1_wdt_reset();
-                       break;
-               case WDIOC_GETSTATUS:
-               case WDIOC_GETBOOTSTATUS:
-                       if ( copy_to_user(argp, &value, sizeof(int)) )
-                               return -EFAULT;
-                       break;
-               case WDIOC_GETSUPPORT:
-                       if ( copy_to_user(argp, &ident, sizeof(ident)) )
-                               return -EFAULT;
-                       break;
-               case WDIOC_SETOPTIONS:
-                       if ( copy_from_user(&value, argp, sizeof(int)) )
-                               return -EFAULT;
-                       switch(value) {
-                               case WDIOS_ENABLECARD:
-                                       mtx1_wdt_start();
-                                       break;
-                               case WDIOS_DISABLECARD:
-                                       return mtx1_wdt_stop();
-                               default:
-                                       return -EINVAL;
-                       }
-                       break;
-               default:
-                       return -ENOTTY;
+       switch (cmd) {
+       case WDIOC_GETSUPPORT:
+               if (copy_to_user(argp, &ident, sizeof(ident)))
+                       return -EFAULT;
+               break;
+       case WDIOC_GETSTATUS:
+       case WDIOC_GETBOOTSTATUS:
+               put_user(0, p);
+               break;
+       case WDIOC_SETOPTIONS:
+               if (get_user(value, p))
+                       return -EFAULT;
+               if (value & WDIOS_ENABLECARD)
+                       mtx1_wdt_start();
+               else if (value & WDIOS_DISABLECARD)
+                       mtx1_wdt_stop();
+               else
+                       return -EINVAL;
+               return 0;
+       case WDIOC_KEEPALIVE:
+               mtx1_wdt_reset();
+               break;
+       default:
+               return -ENOTTY;
        }
        return 0;
 }
 
 
-static ssize_t mtx1_wdt_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
+static ssize_t mtx1_wdt_write(struct file *file, const char *buf,
+                                               size_t count, loff_t *ppos)
 {
        if (!count)
                return -EIO;
-
        mtx1_wdt_reset();
        return count;
 }
@@ -188,17 +188,17 @@ static ssize_t mtx1_wdt_write(struct file *file, const char *buf, size_t count,
 static const struct file_operations mtx1_wdt_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
-       .ioctl          = mtx1_wdt_ioctl,
+       .unlocked_ioctl = mtx1_wdt_ioctl,
        .open           = mtx1_wdt_open,
        .write          = mtx1_wdt_write,
-       .release        = mtx1_wdt_release
+       .release        = mtx1_wdt_release,
 };
 
 
 static struct miscdevice mtx1_wdt_misc = {
        .minor  = WATCHDOG_MINOR,
        .name   = "watchdog",
-       .fops   = &mtx1_wdt_fops
+       .fops   = &mtx1_wdt_fops,
 };
 
 
@@ -208,29 +208,26 @@ static int mtx1_wdt_probe(struct platform_device *pdev)
 
        mtx1_wdt_device.gpio = pdev->resource[0].start;
 
-       if ((ret = misc_register(&mtx1_wdt_misc)) < 0) {
-               printk(KERN_ERR " mtx-1_wdt : failed to register\n");
-               return ret;
-       }
-
+       spin_lock_init(&mtx1_wdt_device.lock);
        init_completion(&mtx1_wdt_device.stop);
        mtx1_wdt_device.queue = 0;
-
        clear_bit(0, &mtx1_wdt_device.inuse);
-
        setup_timer(&mtx1_wdt_device.timer, mtx1_wdt_trigger, 0L);
-
        mtx1_wdt_device.default_ticks = ticks;
 
+       ret = misc_register(&mtx1_wdt_misc);
+       if (ret < 0) {
+               printk(KERN_ERR " mtx-1_wdt : failed to register\n");
+               return ret;
+       }
        mtx1_wdt_start();
-
        printk(KERN_INFO "MTX-1 Watchdog driver\n");
-
        return 0;
 }
 
 static int mtx1_wdt_remove(struct platform_device *pdev)
 {
+       /* FIXME: do we need to lock this test ? */
        if (mtx1_wdt_device.queue) {
                mtx1_wdt_device.queue = 0;
                wait_for_completion(&mtx1_wdt_device.stop);
index b59ca32..acf589d 100644 (file)
@@ -8,7 +8,7 @@
  * and services the watchdog.
  *
  * Derived from mpc8xx_wdt.c, with the following copyright.
- * 
+ *
  * 2002 (c) Florian Schirmer <jolt@tuxbox.org> 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
 #include <linux/module.h>
 #include <linux/watchdog.h>
 #include <linux/platform_device.h>
-
 #include <linux/mv643xx.h>
-#include <asm/uaccess.h>
-#include <asm/io.h>
+#include <linux/uaccess.h>
+#include <linux/io.h>
 
 #define MV64x60_WDT_WDC_OFFSET 0
 
@@ -61,7 +60,9 @@ static DEFINE_SPINLOCK(mv64x60_wdt_spinlock);
 
 static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout,
+               "Watchdog cannot be stopped once started (default="
+                               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 static int mv64x60_wdt_toggle_wdc(int enabled_predicate, int field_shift)
 {
@@ -150,7 +151,7 @@ static int mv64x60_wdt_release(struct inode *inode, struct file *file)
 }
 
 static ssize_t mv64x60_wdt_write(struct file *file, const char __user *data,
-                                size_t len, loff_t * ppos)
+                                size_t len, loff_t *ppos)
 {
        if (len) {
                if (!nowayout) {
@@ -160,7 +161,7 @@ static ssize_t mv64x60_wdt_write(struct file *file, const char __user *data,
 
                        for (i = 0; i != len; i++) {
                                char c;
-                               if(get_user(c, data + i))
+                               if (get_user(c, data + i))
                                        return -EFAULT;
                                if (c == 'V')
                                        expect_close = 42;
@@ -172,8 +173,8 @@ static ssize_t mv64x60_wdt_write(struct file *file, const char __user *data,
        return len;
 }
 
-static int mv64x60_wdt_ioctl(struct inode *inode, struct file *file,
-                            unsigned int cmd, unsigned long arg)
+static long mv64x60_wdt_ioctl(struct file *file,
+                                       unsigned int cmd, unsigned long arg)
 {
        int timeout;
        int options;
@@ -240,7 +241,7 @@ static const struct file_operations mv64x60_wdt_fops = {
        .owner = THIS_MODULE,
        .llseek = no_llseek,
        .write = mv64x60_wdt_write,
-       .ioctl = mv64x60_wdt_ioctl,
+       .unlocked_ioctl = mv64x60_wdt_ioctl,
        .open = mv64x60_wdt_open,
        .release = mv64x60_wdt_release,
 };
index 74bc39a..6f5420f 100644 (file)
 #include <linux/moduleparam.h>
 #include <linux/clk.h>
 #include <linux/bitops.h>
-
-#include <asm/io.h>
-#include <asm/uaccess.h>
-#include <asm/hardware.h>
+#include <linux/io.h>
+#include <linux/uaccess.h>
+#include <linux/hardware.h>
 
 #include <asm/arch/prcm.h>
 
@@ -54,11 +53,12 @@ module_param(timer_margin, uint, 0);
 MODULE_PARM_DESC(timer_margin, "initial watchdog timeout (in seconds)");
 
 static int omap_wdt_users;
-static struct clk *armwdt_ck = NULL;
-static struct clk *mpu_wdt_ick = NULL;
-static struct clk *mpu_wdt_fck = NULL;
+static struct clk *armwdt_ck;
+static struct clk *mpu_wdt_ick;
+static struct clk *mpu_wdt_fck;
 
 static unsigned int wdt_trgr_pattern = 0x1234;
+static spinlock_t wdt_lock;
 
 static void omap_wdt_ping(void)
 {
@@ -174,30 +174,29 @@ static int omap_wdt_release(struct inode *inode, struct file *file)
        return 0;
 }
 
-static ssize_t
-omap_wdt_write(struct file *file, const char __user *data,
+static ssize_t omap_wdt_write(struct file *file, const char __user *data,
                size_t len, loff_t *ppos)
 {
        /* Refresh LOAD_TIME. */
-       if (len)
+       if (len) {
+               spin_lock(&wdt_lock);
                omap_wdt_ping();
+               spin_unlock(&wdt_lock);
+       }
        return len;
 }
 
-static int
-omap_wdt_ioctl(struct inode *inode, struct file *file,
-       unsigned int cmd, unsigned long arg)
+static long omap_wdt_ioctl(struct file *file, unsigned int cmd,
+                                               unsigned long arg)
 {
        int new_margin;
-       static struct watchdog_info ident = {
+       static const struct watchdog_info ident = {
                .identity = "OMAP Watchdog",
                .options = WDIOF_SETTIMEOUT,
                .firmware_version = 0,
        };
 
        switch (cmd) {
-       default:
-               return -ENOTTY;
        case WDIOC_GETSUPPORT:
                return copy_to_user((struct watchdog_info __user *)arg, &ident,
                                sizeof(ident));
@@ -211,28 +210,34 @@ omap_wdt_ioctl(struct inode *inode, struct file *file,
                        return put_user(omap_prcm_get_reset_sources(),
                                        (int __user *)arg);
        case WDIOC_KEEPALIVE:
+               spin_lock(&wdt_lock);
                omap_wdt_ping();
+               spin_unlock(&wdt_lock);
                return 0;
        case WDIOC_SETTIMEOUT:
                if (get_user(new_margin, (int __user *)arg))
                        return -EFAULT;
                omap_wdt_adjust_timeout(new_margin);
 
+               spin_lock(&wdt_lock);
                omap_wdt_disable();
                omap_wdt_set_timeout();
                omap_wdt_enable();
 
                omap_wdt_ping();
+               spin_unlock(&wdt_lock);
                /* Fall */
        case WDIOC_GETTIMEOUT:
                return put_user(timer_margin, (int __user *)arg);
+       default:
+               return -ENOTTY;
        }
 }
 
 static const struct file_operations omap_wdt_fops = {
        .owner = THIS_MODULE,
        .write = omap_wdt_write,
-       .ioctl = omap_wdt_ioctl,
+       .unlocked_ioctl = omap_wdt_ioctl,
        .open = omap_wdt_open,
        .release = omap_wdt_release,
 };
@@ -240,7 +245,7 @@ static const struct file_operations omap_wdt_fops = {
 static struct miscdevice omap_wdt_miscdev = {
        .minor = WATCHDOG_MINOR,
        .name = "watchdog",
-       .fops = &omap_wdt_fops
+       .fops = &omap_wdt_fops,
 };
 
 static int __init omap_wdt_probe(struct platform_device *pdev)
@@ -373,6 +378,7 @@ static struct platform_driver omap_wdt_driver = {
 
 static int __init omap_wdt_init(void)
 {
+       spin_lock_init(&wdt_lock);
        return platform_driver_register(&omap_wdt_driver);
 }
 
index 15e4f88..e91ada7 100644 (file)
 #include <linux/spinlock.h>
 #include <linux/moduleparam.h>
 #include <linux/version.h>
+#include <linux/io.h>
+#include <linux/uaccess.h>
 
-#include <asm/io.h>
-#include <asm/uaccess.h>
 #include <asm/system.h>
 
 /* #define DEBUG 1 */
 
-#define DEFAULT_TIMEOUT     1            /* 1 minute */
+#define DEFAULT_TIMEOUT     1          /* 1 minute */
 #define MAX_TIMEOUT         255
 
 #define VERSION             "1.1"
 #define PFX                 MODNAME ": "
 #define DPFX                MODNAME " - DEBUG: "
 
-#define WDT_INDEX_IO_PORT   (io+0)       /* I/O port base (index register) */
+#define WDT_INDEX_IO_PORT   (io+0)     /* I/O port base (index register) */
 #define WDT_DATA_IO_PORT    (WDT_INDEX_IO_PORT+1)
 #define SWC_LDN             0x04
-#define SIOCFG2             0x22         /* Serial IO register */
-#define WDCTL               0x10         /* Watchdog-Timer-Controll-Register */
-#define WDTO                0x11         /* Watchdog timeout register */
-#define WDCFG               0x12         /* Watchdog config register */
+#define SIOCFG2             0x22       /* Serial IO register */
+#define WDCTL               0x10       /* Watchdog-Timer-Controll-Register */
+#define WDTO                0x11       /* Watchdog timeout register */
+#define WDCFG               0x12       /* Watchdog config register */
 
-static int io = 0x2E;                   /* Address used on Portwell Boards */
+static int io = 0x2E;                  /* Address used on Portwell Boards */
 
-static int timeout = DEFAULT_TIMEOUT;    /* timeout value */
-static unsigned long timer_enabled = 0;  /* is the timer enabled? */
+static int timeout = DEFAULT_TIMEOUT;  /* timeout value */
+static unsigned long timer_enabled;    /* is the timer enabled? */
 
-static char expect_close;                /* is the close expected? */
+static char expect_close;              /* is the close expected? */
 
-static DEFINE_SPINLOCK(io_lock);/* to guard the watchdog from io races */
+static DEFINE_SPINLOCK(io_lock);       /* to guard us from io races */
 
 static int nowayout = WATCHDOG_NOWAYOUT;
 
@@ -69,7 +69,7 @@ static int nowayout = WATCHDOG_NOWAYOUT;
 
 /* Select pins for Watchdog output */
 
-static inline void pc87413_select_wdt_out (void)
+static inline void pc87413_select_wdt_out(void)
 {
        unsigned int cr_data = 0;
 
@@ -77,7 +77,7 @@ static inline void pc87413_select_wdt_out (void)
 
        outb_p(SIOCFG2, WDT_INDEX_IO_PORT);
 
-       cr_data = inb (WDT_DATA_IO_PORT);
+       cr_data = inb(WDT_DATA_IO_PORT);
 
        cr_data |= 0x80; /* Set Bit7 to 1*/
        outb_p(SIOCFG2, WDT_INDEX_IO_PORT);
@@ -85,8 +85,9 @@ static inline void pc87413_select_wdt_out (void)
        outb_p(cr_data, WDT_DATA_IO_PORT);
 
 #ifdef DEBUG
-       printk(KERN_INFO DPFX "Select multiple pin,pin55,as WDT output:"
-                             " Bit7 to 1: %d\n", cr_data);
+       printk(KERN_INFO DPFX
+               "Select multiple pin,pin55,as WDT output: Bit7 to 1: %d\n",
+                                                               cr_data);
 #endif
 }
 
@@ -94,18 +95,18 @@ static inline void pc87413_select_wdt_out (void)
 
 static inline void pc87413_enable_swc(void)
 {
-       unsigned int cr_data=0;
+       unsigned int cr_data = 0;
 
        /* Step 2: Enable SWC functions */
 
-       outb_p(0x07, WDT_INDEX_IO_PORT);        /* Point SWC_LDN (LDN=4) */
+       outb_p(0x07, WDT_INDEX_IO_PORT);        /* Point SWC_LDN (LDN=4) */
        outb_p(SWC_LDN, WDT_DATA_IO_PORT);
 
-       outb_p(0x30, WDT_INDEX_IO_PORT);        /* Read Index 0x30 First */
+       outb_p(0x30, WDT_INDEX_IO_PORT);        /* Read Index 0x30 First */
        cr_data = inb(WDT_DATA_IO_PORT);
-       cr_data |= 0x01;                        /* Set Bit0 to 1 */
+       cr_data |= 0x01;                        /* Set Bit0 to 1 */
        outb_p(0x30, WDT_INDEX_IO_PORT);
-       outb_p(cr_data, WDT_DATA_IO_PORT);      /* Index0x30_bit0P1 */
+       outb_p(cr_data, WDT_DATA_IO_PORT);      /* Index0x30_bit0P1 */
 
 #ifdef DEBUG
        printk(KERN_INFO DPFX "pc87413 - Enable SWC functions\n");
@@ -121,20 +122,19 @@ static inline unsigned int pc87413_get_swc_base(void)
 
        /* Step 3: Read SWC I/O Base Address */
 
-       outb_p(0x60, WDT_INDEX_IO_PORT);        /* Read Index 0x60 */
+       outb_p(0x60, WDT_INDEX_IO_PORT);        /* Read Index 0x60 */
        addr_h = inb(WDT_DATA_IO_PORT);
 
-       outb_p(0x61, WDT_INDEX_IO_PORT);        /* Read Index 0x61 */
+       outb_p(0x61, WDT_INDEX_IO_PORT);        /* Read Index 0x61 */
 
        addr_l = inb(WDT_DATA_IO_PORT);
 
        swc_base_addr = (addr_h << 8) + addr_l;
-
 #ifdef DEBUG
-       printk(KERN_INFO DPFX "Read SWC I/O Base Address: low %d, high %d,"
-                             " res %d\n", addr_l, addr_h, swc_base_addr);
+       printk(KERN_INFO DPFX
+               "Read SWC I/O Base Address: low %d, high %d, res %d\n",
+                                               addr_l, addr_h, swc_base_addr);
 #endif
-
        return swc_base_addr;
 }
 
@@ -143,9 +143,7 @@ static inline unsigned int pc87413_get_swc_base(void)
 static inline void pc87413_swc_bank3(unsigned int swc_base_addr)
 {
        /* Step 4: Select Bank3 of SWC */
-
        outb_p(inb(swc_base_addr + 0x0f) | 0x03, swc_base_addr + 0x0f);
-
 #ifdef DEBUG
        printk(KERN_INFO DPFX "Select Bank3 of SWC\n");
 #endif
@@ -157,9 +155,7 @@ static inline void pc87413_programm_wdto(unsigned int swc_base_addr,
                                         char pc87413_time)
 {
        /* Step 5: Programm WDTO, Twd. */
-
        outb_p(pc87413_time, swc_base_addr + WDTO);
-
 #ifdef DEBUG
        printk(KERN_INFO DPFX "Set WDTO to %d minutes\n", pc87413_time);
 #endif
@@ -170,9 +166,7 @@ static inline void pc87413_programm_wdto(unsigned int swc_base_addr,
 static inline void pc87413_enable_wden(unsigned int swc_base_addr)
 {
        /* Step 6: Enable WDEN */
-
-       outb_p(inb (swc_base_addr + WDCTL) | 0x01, swc_base_addr + WDCTL);
-
+       outb_p(inb(swc_base_addr + WDCTL) | 0x01, swc_base_addr + WDCTL);
 #ifdef DEBUG
        printk(KERN_INFO DPFX "Enable WDEN\n");
 #endif
@@ -182,9 +176,7 @@ static inline void pc87413_enable_wden(unsigned int swc_base_addr)
 static inline void pc87413_enable_sw_wd_tren(unsigned int swc_base_addr)
 {
        /* Enable SW_WD_TREN */
-
-       outb_p(inb (swc_base_addr + WDCFG) | 0x80, swc_base_addr + WDCFG);
-
+       outb_p(inb(swc_base_addr + WDCFG) | 0x80, swc_base_addr + WDCFG);
 #ifdef DEBUG
        printk(KERN_INFO DPFX "Enable SW_WD_TREN\n");
 #endif
@@ -195,9 +187,7 @@ static inline void pc87413_enable_sw_wd_tren(unsigned int swc_base_addr)
 static inline void pc87413_disable_sw_wd_tren(unsigned int swc_base_addr)
 {
        /* Disable SW_WD_TREN */
-
-       outb_p(inb (swc_base_addr + WDCFG) & 0x7f, swc_base_addr + WDCFG);
-
+       outb_p(inb(swc_base_addr + WDCFG) & 0x7f, swc_base_addr + WDCFG);
 #ifdef DEBUG
        printk(KERN_INFO DPFX "pc87413 - Disable SW_WD_TREN\n");
 #endif
@@ -208,9 +198,7 @@ static inline void pc87413_disable_sw_wd_tren(unsigned int swc_base_addr)
 static inline void pc87413_enable_sw_wd_trg(unsigned int swc_base_addr)
 {
        /* Enable SW_WD_TRG */
-
-       outb_p(inb (swc_base_addr + WDCTL) | 0x80, swc_base_addr + WDCTL);
-
+       outb_p(inb(swc_base_addr + WDCTL) | 0x80, swc_base_addr + WDCTL);
 #ifdef DEBUG
        printk(KERN_INFO DPFX "pc87413 - Enable SW_WD_TRG\n");
 #endif
@@ -221,9 +209,7 @@ static inline void pc87413_enable_sw_wd_trg(unsigned int swc_base_addr)
 static inline void pc87413_disable_sw_wd_trg(unsigned int swc_base_addr)
 {
        /* Disable SW_WD_TRG */
-
-       outb_p(inb (swc_base_addr + WDCTL) & 0x7f, swc_base_addr + WDCTL);
-
+       outb_p(inb(swc_base_addr + WDCTL) & 0x7f, swc_base_addr + WDCTL);
 #ifdef DEBUG
        printk(KERN_INFO DPFX "Disable SW_WD_TRG\n");
 #endif
@@ -314,8 +300,8 @@ static int pc87413_open(struct inode *inode, struct file *file)
        /* Reload and activate timer */
        pc87413_refresh();
 
-       printk(KERN_INFO MODNAME "Watchdog enabled. Timeout set to"
-                                " %d minute(s).\n", timeout);
+       printk(KERN_INFO MODNAME
+               "Watchdog enabled. Timeout set to %d minute(s).\n", timeout);
 
        return nonseekable_open(inode, file);
 }
@@ -338,17 +324,15 @@ static int pc87413_release(struct inode *inode, struct file *file)
 
        if (expect_close == 42) {
                pc87413_disable();
-               printk(KERN_INFO MODNAME "Watchdog disabled,"
-                                        " sleeping again...\n");
+               printk(KERN_INFO MODNAME
+                               "Watchdog disabled, sleeping again...\n");
        } else {
-               printk(KERN_CRIT MODNAME "Unexpected close, not stopping"
-                                        " watchdog!\n");
+               printk(KERN_CRIT MODNAME
+                               "Unexpected close, not stopping watchdog!\n");
                pc87413_refresh();
        }
-
        clear_bit(0, &timer_enabled);
        expect_close = 0;
-
        return 0;
 }
 
@@ -386,10 +370,11 @@ static ssize_t pc87413_write(struct file *file, const char __user *data,
                        /* reset expect flag */
                        expect_close = 0;
 
-                       /* scan to see whether or not we got the magic character */
+                       /* scan to see whether or not we got the
+                          magic character */
                        for (i = 0; i != len; i++) {
                                char c;
-                               if (get_user(c, data+i))
+                               if (get_user(c, data + i))
                                        return -EFAULT;
                                if (c == 'V')
                                        expect_close = 42;
@@ -404,7 +389,6 @@ static ssize_t pc87413_write(struct file *file, const char __user *data,
 
 /**
  *     pc87413_ioctl:
- *     @inode: inode of the device
  *     @file: file handle to the device
  *     @cmd: watchdog command
  *     @arg: argument pointer
@@ -414,8 +398,8 @@ static ssize_t pc87413_write(struct file *file, const char __user *data,
  *     querying capabilities and current status.
  */
 
-static int pc87413_ioctl(struct inode *inode, struct file *file,
-                        unsigned int cmd, unsigned long arg)
+static long pc87413_ioctl(struct file *file, unsigned int cmd,
+                                               unsigned long arg)
 {
        int new_timeout;
 
@@ -426,75 +410,58 @@ static int pc87413_ioctl(struct inode *inode, struct file *file,
 
        static struct watchdog_info ident = {
                .options          = WDIOF_KEEPALIVEPING |
-                                   WDIOF_SETTIMEOUT |
-                                   WDIOF_MAGICCLOSE,
+                                   WDIOF_SETTIMEOUT |
+                                   WDIOF_MAGICCLOSE,
                .firmware_version = 1,
-               .identity         = "PC87413(HF/F) watchdog"
+               .identity         = "PC87413(HF/F) watchdog",
        };
 
        uarg.i = (int __user *)arg;
 
-       switch(cmd) {
-               default:
-                       return -ENOTTY;
-
-               case WDIOC_GETSUPPORT:
-                       return copy_to_user(uarg.ident, &ident,
-                               sizeof(ident)) ? -EFAULT : 0;
-
-               case WDIOC_GETSTATUS:
-                       return put_user(pc87413_status(), uarg.i);
-
-               case WDIOC_GETBOOTSTATUS:
-                       return put_user(0, uarg.i);
-
-               case WDIOC_KEEPALIVE:
-                       pc87413_refresh();
+       switch (cmd) {
+       case WDIOC_GETSUPPORT:
+               return copy_to_user(uarg.ident, &ident,
+                                       sizeof(ident)) ? -EFAULT : 0;
+       case WDIOC_GETSTATUS:
+               return put_user(pc87413_status(), uarg.i);
+       case WDIOC_GETBOOTSTATUS:
+               return put_user(0, uarg.i);
+       case WDIOC_SETOPTIONS:
+       {
+               int options, retval = -EINVAL;
+               if (get_user(options, uarg.i))
+                       return -EFAULT;
+               if (options & WDIOS_DISABLECARD) {
+                       pc87413_disable();
+                       retval = 0;
+               }
+               if (options & WDIOS_ENABLECARD) {
+                       pc87413_enable();
+                       retval = 0;
+               }
+               return retval;
+       }
+       case WDIOC_KEEPALIVE:
+               pc87413_refresh();
 #ifdef DEBUG
-                       printk(KERN_INFO DPFX "keepalive\n");
+               printk(KERN_INFO DPFX "keepalive\n");
 #endif
-                       return 0;
-
-               case WDIOC_SETTIMEOUT:
-                       if (get_user(new_timeout, uarg.i))
-                               return -EFAULT;
-
-                       // the API states this is given in secs
-                       new_timeout /= 60;
-
-                       if (new_timeout < 0 || new_timeout > MAX_TIMEOUT)
-                               return -EINVAL;
-
-                       timeout = new_timeout;
-                       pc87413_refresh();
-
-                       // fall through and return the new timeout...
-
-               case WDIOC_GETTIMEOUT:
-
-                       new_timeout = timeout * 60;
-
-                       return put_user(new_timeout, uarg.i);
-
-               case WDIOC_SETOPTIONS:
-               {
-                       int options, retval = -EINVAL;
-
-                       if (get_user(options, uarg.i))
-                               return -EFAULT;
-
-                       if (options & WDIOS_DISABLECARD) {
-                               pc87413_disable();
-                               retval = 0;
-                       }
-
-                       if (options & WDIOS_ENABLECARD) {
-                               pc87413_enable();
-                               retval = 0;
-                       }
-
-                       return retval;
-               }
+               return 0;
+       case WDIOC_SETTIMEOUT:
+               if (get_user(new_timeout, uarg.i))
+                       return -EFAULT;
+               /* the API states this is given in secs */
+               new_timeout /= 60;
+               if (new_timeout < 0 || new_timeout > MAX_TIMEOUT)
+                       return -EINVAL;
+               timeout = new_timeout;
+               pc87413_refresh();
+               /* fall through and return the new timeout... */
+       case WDIOC_GETTIMEOUT:
+               new_timeout = timeout * 60;
+               return put_user(new_timeout, uarg.i);
+       default:
+               return -ENOTTY;
        }
 }
 
@@ -517,10 +484,8 @@ static int pc87413_notify_sys(struct notifier_block *this,
                              void *unused)
 {
        if (code == SYS_DOWN || code == SYS_HALT)
-       {
                /* Turn the card off */
                pc87413_disable();
-       }
        return NOTIFY_DONE;
 }
 
@@ -530,21 +495,19 @@ static const struct file_operations pc87413_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = pc87413_write,
-       .ioctl          = pc87413_ioctl,
+       .unlocked_ioctl = pc87413_ioctl,
        .open           = pc87413_open,
        .release        = pc87413_release,
 };
 
-static struct notifier_block pc87413_notifier =
-{
+static struct notifier_block pc87413_notifier = {
        .notifier_call  = pc87413_notify_sys,
 };
 
-static struct miscdevice pc87413_miscdev=
-{
+static struct miscdevice pc87413_miscdev = {
        .minor          = WATCHDOG_MINOR,
        .name           = "watchdog",
-       .fops           = &pc87413_fops
+       .fops           = &pc87413_fops,
 };
 
 /* -- Module init functions -------------------------------------*/
@@ -561,29 +524,26 @@ static int __init pc87413_init(void)
 {
        int ret;
 
-       printk(KERN_INFO PFX "Version " VERSION " at io 0x%X\n", WDT_INDEX_IO_PORT);
+       printk(KERN_INFO PFX "Version " VERSION " at io 0x%X\n",
+                                                       WDT_INDEX_IO_PORT);
 
        /* request_region(io, 2, "pc87413"); */
 
        ret = register_reboot_notifier(&pc87413_notifier);
        if (ret != 0) {
-               printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
-                       ret);
+               printk(KERN_ERR PFX
+                       "cannot register reboot notifier (err=%d)\n", ret);
        }
 
        ret = misc_register(&pc87413_miscdev);
-
        if (ret != 0) {
                printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
                        WATCHDOG_MINOR, ret);
                unregister_reboot_notifier(&pc87413_notifier);
                return ret;
        }
-
        printk(KERN_INFO PFX "initialized. timeout=%d min \n", timeout);
-
        pc87413_enable();
-
        return 0;
 }
 
@@ -600,17 +560,16 @@ static int __init pc87413_init(void)
 static void __exit pc87413_exit(void)
 {
        /* Stop the timer before we leave */
-       if (!nowayout)
-       {
+       if (!nowayout) {
                pc87413_disable();
                printk(KERN_INFO MODNAME "Watchdog disabled.\n");
        }
 
        misc_deregister(&pc87413_miscdev);
        unregister_reboot_notifier(&pc87413_notifier);
-       /* release_region(io,2); */
+       /* release_region(io, 2); */
 
-       printk(MODNAME " watchdog component driver removed.\n");
+       printk(KERN_INFO MODNAME " watchdog component driver removed.\n");
 }
 
 module_init(pc87413_init);
@@ -626,8 +585,12 @@ module_param(io, int, 0);
 MODULE_PARM_DESC(io, MODNAME " I/O port (default: " __MODULE_STRING(io) ").");
 
 module_param(timeout, int, 0);
-MODULE_PARM_DESC(timeout, "Watchdog timeout in minutes (default=" __MODULE_STRING(timeout) ").");
+MODULE_PARM_DESC(timeout,
+               "Watchdog timeout in minutes (default="
+                               __MODULE_STRING(timeout) ").");
 
 module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout,
+               "Watchdog cannot be stopped once started (default="
+                               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
index 7b41434..3b0ddc7 100644 (file)
  *             fairly useless proc entry.
  * 990610      removed said useless proc code for the merge <alan>
  * 000403      Removed last traces of proc code. <davej>
- * 011214      Added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT <Matt_Domsch@dell.com>
+ * 011214      Added nowayout module option to override
+ *             CONFIG_WATCHDOG_NOWAYOUT <Matt_Domsch@dell.com>
  *              Added timeout module option to override default
  */
 
 /*
  *     A bells and whistles driver is available from http://www.pcwd.de/
- *     More info available at http://www.berkprod.com/ or http://www.pcwatchdog.com/
+ *     More info available at http://www.berkprod.com/ or
+ *     http://www.pcwatchdog.com/
  */
 
 #include <linux/module.h>      /* For module specific items */
@@ -65,9 +67,8 @@
 #include <linux/isa.h>         /* For isa devices */
 #include <linux/ioport.h>      /* For io-port access */
 #include <linux/spinlock.h>    /* For spin_lock/spin_unlock/... */
-
-#include <asm/uaccess.h>       /* For copy_to_user/put_user/... */
-#include <asm/io.h>            /* For inb/outb/... */
+#include <linux/uaccess.h>     /* For copy_to_user/put_user/... */
+#include <linux/io.h>          /* For inb/outb/... */
 
 /* Module and version information */
 #define WATCHDOG_VERSION "1.20"
@@ -111,14 +112,16 @@ static int pcwd_ioports[] = { 0x270, 0x350, 0x370, 0x000 };
 #define WD_REVC_WTRP           0x01    /* Watchdog Trip status */
 #define WD_REVC_HRBT           0x02    /* Watchdog Heartbeat */
 #define WD_REVC_TTRP           0x04    /* Temperature Trip status */
-#define WD_REVC_RL2A           0x08    /* Relay 2 activated by on-board processor */
+#define WD_REVC_RL2A           0x08    /* Relay 2 activated by
+                                                       on-board processor */
 #define WD_REVC_RL1A           0x10    /* Relay 1 active */
 #define WD_REVC_R2DS           0x40    /* Relay 2 disable */
 #define WD_REVC_RLY2           0x80    /* Relay 2 activated? */
 /* Port 2 : Control Status #2 */
 #define WD_WDIS                        0x10    /* Watchdog Disabled */
 #define WD_ENTP                        0x20    /* Watchdog Enable Temperature Trip */
-#define WD_SSEL                        0x40    /* Watchdog Switch Select (1:SW1 <-> 0:SW2) */
+#define WD_SSEL                        0x40    /* Watchdog Switch Select
+                                                       (1:SW1 <-> 0:SW2) */
 #define WD_WCMD                        0x80    /* Watchdog Command Mode */
 
 /* max. time we give an ISA watchdog card to process a command */
@@ -142,7 +145,7 @@ static int pcwd_ioports[] = { 0x270, 0x350, 0x370, 0x000 };
 #define CMD_ISA_RESET_RELAYS           0x0D
 
 /* Watchdog's Dip Switch heartbeat values */
-static const int heartbeat_tbl [] = {
+static const int heartbeat_tbl[] = {
        20,     /* OFF-OFF-OFF  = 20 Sec  */
        40,     /* OFF-OFF-ON   = 40 Sec  */
        60,     /* OFF-ON-OFF   =  1 Min  */
@@ -168,11 +171,15 @@ static int cards_found;
 static atomic_t open_allowed = ATOMIC_INIT(1);
 static char expect_close;
 static int temp_panic;
-static struct {                                /* this is private data for each ISA-PC watchdog card */
+
+/* this is private data for each ISA-PC watchdog card */
+static struct {
        char fw_ver_str[6];             /* The cards firmware version */
        int revision;                   /* The card's revision */
-       int supports_temp;              /* Wether or not the card has a temperature device */
-       int command_mode;               /* Wether or not the card is in command mode */
+       int supports_temp;              /* Whether or not the card has
+                                               a temperature device */
+       int command_mode;               /* Whether or not the card is in
+                                               command mode */
        int boot_status;                /* The card's boot status */
        int io_addr;                    /* The cards I/O address */
        spinlock_t io_lock;             /* the lock for io operations */
@@ -186,16 +193,20 @@ static struct {                           /* this is private data for each ISA-PC watchdog card */
 #define DEBUG  2       /* print fancy stuff too */
 static int debug = QUIET;
 module_param(debug, int, 0);
-MODULE_PARM_DESC(debug, "Debug level: 0=Quiet, 1=Verbose, 2=Debug (default=0)");
+MODULE_PARM_DESC(debug,
+               "Debug level: 0=Quiet, 1=Verbose, 2=Debug (default=0)");
 
-#define WATCHDOG_HEARTBEAT 0           /* default heartbeat = delay-time from dip-switches */
+/* default heartbeat = delay-time from dip-switches */
+#define WATCHDOG_HEARTBEAT 0
 static int heartbeat = WATCHDOG_HEARTBEAT;
 module_param(heartbeat, int, 0);
-MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (2<=heartbeat<=7200 or 0=delay-time from dip-switches, default=" __MODULE_STRING(WATCHDOG_HEARTBEAT) ")");
+MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (2 <= heartbeat <= 7200 or 0=delay-time from dip-switches, default=" __MODULE_STRING(WATCHDOG_HEARTBEAT) ")");
 
 static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout,
+               "Watchdog cannot be stopped once started (default="
+                               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 /*
  *     Internal functions
@@ -224,7 +235,7 @@ static int send_isa_command(int cmd)
                if (port0 == last_port0)
                        break;  /* Data is stable */
 
-               udelay (250);
+               udelay(250);
        }
 
        if (debug >= DEBUG)
@@ -236,7 +247,7 @@ static int send_isa_command(int cmd)
 
 static int set_command_mode(void)
 {
-       int i, found=0, count=0;
+       int i, found = 0, count = 0;
 
        /* Set the card into command mode */
        spin_lock(&pcwd_private.io_lock);
@@ -261,7 +272,7 @@ static int set_command_mode(void)
                printk(KERN_DEBUG PFX "command_mode=%d\n",
                                pcwd_private.command_mode);
 
-       return(found);
+       return found;
 }
 
 static void unset_command_mode(void)
@@ -296,7 +307,8 @@ static inline void pcwd_get_firmware(void)
                ten = send_isa_command(CMD_ISA_VERSION_TENTH);
                hund = send_isa_command(CMD_ISA_VERSION_HUNDRETH);
                minor = send_isa_command(CMD_ISA_VERSION_MINOR);
-               sprintf(pcwd_private.fw_ver_str, "%c.%c%c%c", one, ten, hund, minor);
+               sprintf(pcwd_private.fw_ver_str, "%c.%c%c%c",
+                                       one, ten, hund, minor);
        }
        unset_command_mode();
 
@@ -305,7 +317,7 @@ static inline void pcwd_get_firmware(void)
 
 static inline int pcwd_get_option_switches(void)
 {
-       int option_switches=0;
+       int option_switches = 0;
 
        if (set_command_mode()) {
                /* Get switch settings */
@@ -313,7 +325,7 @@ static inline int pcwd_get_option_switches(void)
        }
 
        unset_command_mode();
-       return(option_switches);
+       return option_switches;
 }
 
 static void pcwd_show_card_info(void)
@@ -322,7 +334,9 @@ static void pcwd_show_card_info(void)
 
        /* Get some extra info from the hardware (in command/debug/diag mode) */
        if (pcwd_private.revision == PCWD_REVISION_A)
-               printk(KERN_INFO PFX "ISA-PC Watchdog (REV.A) detected at port 0x%04x\n", pcwd_private.io_addr);
+               printk(KERN_INFO PFX
+                       "ISA-PC Watchdog (REV.A) detected at port 0x%04x\n",
+                                                       pcwd_private.io_addr);
        else if (pcwd_private.revision == PCWD_REVISION_C) {
                pcwd_get_firmware();
                printk(KERN_INFO PFX "ISA-PC Watchdog (REV.C) detected at port 0x%04x (Firmware version: %s)\n",
@@ -347,12 +361,15 @@ static void pcwd_show_card_info(void)
                printk(KERN_INFO PFX "Previous reboot was caused by the card\n");
 
        if (pcwd_private.boot_status & WDIOF_OVERHEAT) {
-               printk(KERN_EMERG PFX "Card senses a CPU Overheat. Panicking!\n");
-               printk(KERN_EMERG PFX "CPU Overheat\n");
+               printk(KERN_EMERG PFX
+                       "Card senses a CPU Overheat. Panicking!\n");
+               printk(KERN_EMERG PFX
+                       "CPU Overheat\n");
        }
 
        if (pcwd_private.boot_status == 0)
-               printk(KERN_INFO PFX "No previous trip detected - Cold boot or reset\n");
+               printk(KERN_INFO PFX
+                       "No previous trip detected - Cold boot or reset\n");
 }
 
 static void pcwd_timer_ping(unsigned long data)
@@ -361,11 +378,12 @@ static void pcwd_timer_ping(unsigned long data)
 
        /* If we got a heartbeat pulse within the WDT_INTERVAL
         * we agree to ping the WDT */
-       if(time_before(jiffies, pcwd_private.next_heartbeat)) {
+       if (time_before(jiffies, pcwd_private.next_heartbeat)) {
                /* Ping the watchdog */
                spin_lock(&pcwd_private.io_lock);
                if (pcwd_private.revision == PCWD_REVISION_A) {
-                       /*  Rev A cards are reset by setting the WD_WDRST bit in register 1 */
+                       /*  Rev A cards are reset by setting the
+                           WD_WDRST bit in register 1 */
                        wdrst_stat = inb_p(pcwd_private.io_addr);
                        wdrst_stat &= 0x0F;
                        wdrst_stat |= WD_WDRST;
@@ -381,7 +399,8 @@ static void pcwd_timer_ping(unsigned long data)
 
                spin_unlock(&pcwd_private.io_lock);
        } else {
-               printk(KERN_WARNING PFX "Heartbeat lost! Will not ping the watchdog\n");
+               printk(KERN_WARNING PFX
+                       "Heartbeat lost! Will not ping the watchdog\n");
        }
 }
 
@@ -454,7 +473,7 @@ static int pcwd_keepalive(void)
 
 static int pcwd_set_heartbeat(int t)
 {
-       if ((t < 2) || (t > 7200)) /* arbitrary upper limit */
+       if (t < 2 || t > 7200) /* arbitrary upper limit */
                return -EINVAL;
 
        heartbeat = t;
@@ -470,7 +489,7 @@ static int pcwd_get_status(int *status)
 {
        int control_status;
 
-       *status=0;
+       *status = 0;
        spin_lock(&pcwd_private.io_lock);
        if (pcwd_private.revision == PCWD_REVISION_A)
                /* Rev A cards return status information from
@@ -494,9 +513,9 @@ static int pcwd_get_status(int *status)
                if (control_status & WD_T110) {
                        *status |= WDIOF_OVERHEAT;
                        if (temp_panic) {
-                               printk(KERN_INFO PFX "Temperature overheat trip!\n");
+                               printk(KERN_INFO PFX
+                                       "Temperature overheat trip!\n");
                                kernel_power_off();
-                               /* or should we just do a: panic(PFX "Temperature overheat trip!\n"); */
                        }
                }
        } else {
@@ -506,9 +525,9 @@ static int pcwd_get_status(int *status)
                if (control_status & WD_REVC_TTRP) {
                        *status |= WDIOF_OVERHEAT;
                        if (temp_panic) {
-                               printk(KERN_INFO PFX "Temperature overheat trip!\n");
+                               printk(KERN_INFO PFX
+                                       "Temperature overheat trip!\n");
                                kernel_power_off();
-                               /* or should we just do a: panic(PFX "Temperature overheat trip!\n"); */
                        }
                }
        }
@@ -524,18 +543,21 @@ static int pcwd_clear_status(void)
                spin_lock(&pcwd_private.io_lock);
 
                if (debug >= VERBOSE)
-                       printk(KERN_INFO PFX "clearing watchdog trip status\n");
+                       printk(KERN_INFO PFX
+                                       "clearing watchdog trip status\n");
 
                control_status = inb_p(pcwd_private.io_addr + 1);
 
                if (debug >= DEBUG) {
-                       printk(KERN_DEBUG PFX "status was: 0x%02x\n", control_status);
+                       printk(KERN_DEBUG PFX "status was: 0x%02x\n",
+                               control_status);
                        printk(KERN_DEBUG PFX "sending: 0x%02x\n",
                                (control_status & WD_REVC_R2DS));
                }
 
                /* clear reset status & Keep Relay 2 disable state as it is */
-               outb_p((control_status & WD_REVC_R2DS), pcwd_private.io_addr + 1);
+               outb_p((control_status & WD_REVC_R2DS),
+                                               pcwd_private.io_addr + 1);
 
                spin_unlock(&pcwd_private.io_lock);
        }
@@ -572,8 +594,7 @@ static int pcwd_get_temperature(int *temperature)
  *     /dev/watchdog handling
  */
 
-static int pcwd_ioctl(struct inode *inode, struct file *file,
-                     unsigned int cmd, unsigned long arg)
+static long pcwd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
        int rv;
        int status;
@@ -590,12 +611,9 @@ static int pcwd_ioctl(struct inode *inode, struct file *file,
                .identity =             "PCWD",
        };
 
-       switch(cmd) {
-       default:
-               return -ENOTTY;
-
+       switch (cmd) {
        case WDIOC_GETSUPPORT:
-               if(copy_to_user(argp, &ident, sizeof(ident)))
+               if (copy_to_user(argp, &ident, sizeof(ident)))
                        return -EFAULT;
                return 0;
 
@@ -613,25 +631,22 @@ static int pcwd_ioctl(struct inode *inode, struct file *file,
                return put_user(temperature, argp);
 
        case WDIOC_SETOPTIONS:
-               if (pcwd_private.revision == PCWD_REVISION_C)
-               {
-                       if(copy_from_user(&rv, argp, sizeof(int)))
+               if (pcwd_private.revision == PCWD_REVISION_C) {
+                       if (get_user(rv, argp))
                                return -EFAULT;
 
-                       if (rv & WDIOS_DISABLECARD)
-                       {
-                               return pcwd_stop();
+                       if (rv & WDIOS_DISABLECARD) {
+                               status = pcwd_stop();
+                               if (status < 0)
+                                       return status;
                        }
-
-                       if (rv & WDIOS_ENABLECARD)
-                       {
-                               return pcwd_start();
+                       if (rv & WDIOS_ENABLECARD) {
+                               status = pcwd_start();
+                               if (status < 0)
+                                       return status;
                        }
-
                        if (rv & WDIOS_TEMPPANIC)
-                       {
                                temp_panic = 1;
-                       }
                }
                return -EINVAL;
 
@@ -651,6 +666,9 @@ static int pcwd_ioctl(struct inode *inode, struct file *file,
 
        case WDIOC_GETTIMEOUT:
                return put_user(heartbeat, argp);
+
+       default:
+               return -ENOTTY;
        }
 
        return 0;
@@ -682,16 +700,10 @@ static ssize_t pcwd_write(struct file *file, const char __user *buf, size_t len,
 
 static int pcwd_open(struct inode *inode, struct file *file)
 {
-       if (!atomic_dec_and_test(&open_allowed) ) {
-               if (debug >= VERBOSE)
-                       printk(KERN_ERR PFX "Attempt to open already opened device.\n");
-               atomic_inc( &open_allowed );
+       if (test_and_set_bit(0, &open_allowed))
                return -EBUSY;
-       }
-
        if (nowayout)
                __module_get(THIS_MODULE);
-
        /* Activate */
        pcwd_start();
        pcwd_keepalive();
@@ -700,14 +712,15 @@ static int pcwd_open(struct inode *inode, struct file *file)
 
 static int pcwd_close(struct inode *inode, struct file *file)
 {
-       if (expect_close == 42) {
+       if (expect_close == 42)
                pcwd_stop();
-       } else {
-               printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
+       else {
+               printk(KERN_CRIT PFX
+                       "Unexpected close, not stopping watchdog!\n");
                pcwd_keepalive();
        }
        expect_close = 0;
-       atomic_inc( &open_allowed );
+       clear_bit(0, &open_allowed);
        return 0;
 }
 
@@ -750,7 +763,7 @@ static const struct file_operations pcwd_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = pcwd_write,
-       .ioctl          = pcwd_ioctl,
+       .unlocked_ioctl = pcwd_ioctl,
        .open           = pcwd_open,
        .release        = pcwd_close,
 };
@@ -788,7 +801,7 @@ static inline int get_revision(void)
         * presumes a floating bus reads as 0xff. */
        if ((inb(pcwd_private.io_addr + 2) == 0xFF) ||
            (inb(pcwd_private.io_addr + 3) == 0xFF))
-               r=PCWD_REVISION_A;
+               r = PCWD_REVISION_A;
        spin_unlock(&pcwd_private.io_lock);
 
        return r;
@@ -803,7 +816,7 @@ static inline int get_revision(void)
  */
 static int __devinit pcwd_isa_match(struct device *dev, unsigned int id)
 {
-       int base_addr=pcwd_ioports[id];
+       int base_addr = pcwd_ioports[id];
        int port0, last_port0;  /* Reg 0, in case it's REV A */
        int port1, last_port1;  /* Register 1 for REV C cards */
        int i;
@@ -813,7 +826,7 @@ static int __devinit pcwd_isa_match(struct device *dev, unsigned int id)
                printk(KERN_DEBUG PFX "pcwd_isa_match id=%d\n",
                        id);
 
-       if (!request_region (base_addr, 4, "PCWD")) {
+       if (!request_region(base_addr, 4, "PCWD")) {
                printk(KERN_INFO PFX "Port 0x%04x unavailable\n", base_addr);
                return 0;
        }
@@ -842,7 +855,7 @@ static int __devinit pcwd_isa_match(struct device *dev, unsigned int id)
                        }
                }
        }
-       release_region (base_addr, 4);
+       release_region(base_addr, 4);
 
        return retval;
 }
@@ -857,7 +870,8 @@ static int __devinit pcwd_isa_probe(struct device *dev, unsigned int id)
 
        cards_found++;
        if (cards_found == 1)
-               printk(KERN_INFO PFX "v%s Ken Hollis (kenji@bitgate.com)\n", WD_VER);
+               printk(KERN_INFO PFX "v%s Ken Hollis (kenji@bitgate.com)\n",
+                                                               WD_VER);
 
        if (cards_found > 1) {
                printk(KERN_ERR PFX "This driver only supports 1 device\n");
@@ -875,10 +889,11 @@ static int __devinit pcwd_isa_probe(struct device *dev, unsigned int id)
        /* Check card's revision */
        pcwd_private.revision = get_revision();
 
-       if (!request_region(pcwd_private.io_addr, (pcwd_private.revision == PCWD_REVISION_A) ? 2 : 4, "PCWD")) {
+       if (!request_region(pcwd_private.io_addr,
+               (pcwd_private.revision == PCWD_REVISION_A) ? 2 : 4, "PCWD")) {
                printk(KERN_ERR PFX "I/O address 0x%04x already in use\n",
                        pcwd_private.io_addr);
-               ret=-EIO;
+               ret = -EIO;
                goto error_request_region;
        }
 
@@ -908,26 +923,30 @@ static int __devinit pcwd_isa_probe(struct device *dev, unsigned int id)
        if (heartbeat == 0)
                heartbeat = heartbeat_tbl[(pcwd_get_option_switches() & 0x07)];
 
-       /* Check that the heartbeat value is within it's range ; if not reset to the default */
+       /* Check that the heartbeat value is within it's range;
+          if not reset to the default */
        if (pcwd_set_heartbeat(heartbeat)) {
                pcwd_set_heartbeat(WATCHDOG_HEARTBEAT);
-               printk(KERN_INFO PFX "heartbeat value must be 2<=heartbeat<=7200, using %d\n",
-                       WATCHDOG_HEARTBEAT);
+               printk(KERN_INFO PFX
+                 "heartbeat value must be 2 <= heartbeat <= 7200, using %d\n",
+                                                       WATCHDOG_HEARTBEAT);
        }
 
        if (pcwd_private.supports_temp) {
                ret = misc_register(&temp_miscdev);
                if (ret) {
-                       printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
-                               TEMP_MINOR, ret);
+                       printk(KERN_ERR PFX
+                           "cannot register miscdev on minor=%d (err=%d)\n",
+                                                       TEMP_MINOR, ret);
                        goto error_misc_register_temp;
                }
        }
 
        ret = misc_register(&pcwd_miscdev);
        if (ret) {
-               printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
-                       WATCHDOG_MINOR, ret);
+               printk(KERN_ERR PFX
+                       "cannot register miscdev on minor=%d (err=%d)\n",
+                                       WATCHDOG_MINOR, ret);
                goto error_misc_register_watchdog;
        }
 
@@ -940,7 +959,8 @@ error_misc_register_watchdog:
        if (pcwd_private.supports_temp)
                misc_deregister(&temp_miscdev);
 error_misc_register_temp:
-       release_region(pcwd_private.io_addr, (pcwd_private.revision == PCWD_REVISION_A) ? 2 : 4);
+       release_region(pcwd_private.io_addr,
+                       (pcwd_private.revision == PCWD_REVISION_A) ? 2 : 4);
 error_request_region:
        pcwd_private.io_addr = 0x0000;
        cards_found--;
@@ -964,7 +984,8 @@ static int __devexit pcwd_isa_remove(struct device *dev, unsigned int id)
        misc_deregister(&pcwd_miscdev);
        if (pcwd_private.supports_temp)
                misc_deregister(&temp_miscdev);
-       release_region(pcwd_private.io_addr, (pcwd_private.revision == PCWD_REVISION_A) ? 2 : 4);
+       release_region(pcwd_private.io_addr,
+                       (pcwd_private.revision == PCWD_REVISION_A) ? 2 : 4);
        pcwd_private.io_addr = 0x0000;
        cards_found--;
 
index 61a89e9..90eb1d4 100644 (file)
@@ -46,9 +46,8 @@
 #include <linux/pci.h>         /* For pci functions */
 #include <linux/ioport.h>      /* For io-port access */
 #include <linux/spinlock.h>    /* For spin_lock/spin_unlock/... */
-
-#include <asm/uaccess.h>       /* For copy_to_user/put_user/... */
-#include <asm/io.h>            /* For inb/outb/... */
+#include <linux/uaccess.h>     /* For copy_to_user/put_user/... */
+#include <linux/io.h>          /* For inb/outb/... */
 
 /* Module and version information */
 #define WATCHDOG_VERSION "1.03"
@@ -97,7 +96,7 @@
 #define CMD_GET_CLEAR_RESET_COUNT              0x84
 
 /* Watchdog's Dip Switch heartbeat values */
-static const int heartbeat_tbl [] = {
+static const int heartbeat_tbl[] = {
        5,      /* OFF-OFF-OFF  =  5 Sec  */
        10,     /* OFF-OFF-ON   = 10 Sec  */
        30,     /* OFF-ON-OFF   = 30 Sec  */
@@ -220,11 +219,10 @@ static void pcipcwd_show_card_info(void)
        int option_switches;
 
        got_fw_rev = send_command(CMD_GET_FIRMWARE_VERSION, &fw_rev_major, &fw_rev_minor);
-       if (got_fw_rev) {
+       if (got_fw_rev)
                sprintf(fw_ver_str, "%u.%02u", fw_rev_major, fw_rev_minor);
-       } else {
+       else
                sprintf(fw_ver_str, "<card no answer>");
-       }
 
        /* Get switch settings */
        option_switches = pcipcwd_get_option_switches();
@@ -331,7 +329,7 @@ static int pcipcwd_get_status(int *status)
 {
        int control_status;
 
-       *status=0;
+       *status = 0;
        control_status = inb_p(pcipcwd_private.io_addr + 1);
        if (control_status & WD_PCI_WTRP)
                *status |= WDIOF_CARDRESET;
@@ -369,8 +367,8 @@ static int pcipcwd_clear_status(void)
        outb_p((control_status & WD_PCI_R2DS) | WD_PCI_WTRP, pcipcwd_private.io_addr + 1);
 
        /* clear reset counter */
-       msb=0;
-       reset_counter=0xff;
+       msb = 0;
+       reset_counter = 0xff;
        send_command(CMD_GET_CLEAR_RESET_COUNT, &msb, &reset_counter);
 
        if (debug >= DEBUG) {
@@ -442,7 +440,7 @@ static ssize_t pcipcwd_write(struct file *file, const char __user *data,
                        /* scan to see whether or not we got the magic character */
                        for (i = 0; i != len; i++) {
                                char c;
-                               if(get_user(c, data+i))
+                               if (get_user(c, data + i))
                                        return -EFAULT;
                                if (c == 'V')
                                        expect_release = 42;
@@ -455,8 +453,8 @@ static ssize_t pcipcwd_write(struct file *file, const char __user *data,
        return len;
 }
 
-static int pcipcwd_ioctl(struct inode *inode, struct file *file,
-                         unsigned int cmd, unsigned long arg)
+static long pcipcwd_ioctl(struct file *file, unsigned int cmd,
+                                               unsigned long arg)
 {
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
@@ -471,92 +469,89 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file,
        };
 
        switch (cmd) {
-               case WDIOC_GETSUPPORT:
-                       return copy_to_user(argp, &ident,
-                               sizeof (ident)) ? -EFAULT : 0;
+       case WDIOC_GETSUPPORT:
+               return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
+
+       case WDIOC_GETSTATUS:
+       {
+               int status;
+               pcipcwd_get_status(&status);
+               return put_user(status, p);
+       }
 
-               case WDIOC_GETSTATUS:
-               {
-                       int status;
+       case WDIOC_GETBOOTSTATUS:
+               return put_user(pcipcwd_private.boot_status, p);
 
-                       pcipcwd_get_status(&status);
+       case WDIOC_GETTEMP:
+       {
+               int temperature;
 
-                       return put_user(status, p);
-               }
+               if (pcipcwd_get_temperature(&temperature))
+                       return -EFAULT;
 
-               case WDIOC_GETBOOTSTATUS:
-                       return put_user(pcipcwd_private.boot_status, p);
+               return put_user(temperature, p);
+       }
 
-               case WDIOC_GETTEMP:
-               {
-                       int temperature;
+       case WDIOC_SETOPTIONS:
+       {
+               int new_options, retval = -EINVAL;
 
-                       if (pcipcwd_get_temperature(&temperature))
-                               return -EFAULT;
+               if (get_user(new_options, p))
+                       return -EFAULT;
 
-                       return put_user(temperature, p);
+               if (new_options & WDIOS_DISABLECARD) {
+                       if (pcipcwd_stop())
+                               return -EIO;
+                       retval = 0;
                }
 
-               case WDIOC_KEEPALIVE:
-                       pcipcwd_keepalive();
-                       return 0;
-
-               case WDIOC_SETOPTIONS:
-               {
-                       int new_options, retval = -EINVAL;
-
-                       if (get_user (new_options, p))
-                               return -EFAULT;
-
-                       if (new_options & WDIOS_DISABLECARD) {
-                               if (pcipcwd_stop())
-                                       return -EIO;
-                               retval = 0;
-                       }
+               if (new_options & WDIOS_ENABLECARD) {
+                       if (pcipcwd_start())
+                               return -EIO;
+                       retval = 0;
+               }
 
-                       if (new_options & WDIOS_ENABLECARD) {
-                               if (pcipcwd_start())
-                                       return -EIO;
-                               retval = 0;
-                       }
+               if (new_options & WDIOS_TEMPPANIC) {
+                       temp_panic = 1;
+                       retval = 0;
+               }
 
-                       if (new_options & WDIOS_TEMPPANIC) {
-                               temp_panic = 1;
-                               retval = 0;
-                       }
+               return retval;
+       }
 
-                       return retval;
-               }
+       case WDIOC_KEEPALIVE:
+               pcipcwd_keepalive();
+               return 0;
 
-               case WDIOC_SETTIMEOUT:
-               {
-                       int new_heartbeat;
+       case WDIOC_SETTIMEOUT:
+       {
+               int new_heartbeat;
 
-                       if (get_user(new_heartbeat, p))
-                               return -EFAULT;
+               if (get_user(new_heartbeat, p))
+                       return -EFAULT;
 
-                       if (pcipcwd_set_heartbeat(new_heartbeat))
-                           return -EINVAL;
+               if (pcipcwd_set_heartbeat(new_heartbeat))
+                   return -EINVAL;
 
-                       pcipcwd_keepalive();
-                       /* Fall */
-               }
+               pcipcwd_keepalive();
+               /* Fall */
+       }
 
-               case WDIOC_GETTIMEOUT:
-                       return put_user(heartbeat, p);
+       case WDIOC_GETTIMEOUT:
+               return put_user(heartbeat, p);
 
-               case WDIOC_GETTIMELEFT:
-               {
-                       int time_left;
+       case WDIOC_GETTIMELEFT:
+       {
+               int time_left;
 
-                       if (pcipcwd_get_timeleft(&time_left))
-                               return -EFAULT;
+               if (pcipcwd_get_timeleft(&time_left))
+                       return -EFAULT;
 
-                       return put_user(time_left, p);
-               }
+               return put_user(time_left, p);
+       }
 
-               default:
-                       return -ENOTTY;
+       default:
+               return -ENOTTY;
        }
 }
 
@@ -603,7 +598,7 @@ static ssize_t pcipcwd_temp_read(struct file *file, char __user *data,
        if (pcipcwd_get_temperature(&temperature))
                return -EFAULT;
 
-       if (copy_to_user (data, &temperature, 1))
+       if (copy_to_user(data, &temperature, 1))
                return -EFAULT;
 
        return 1;
@@ -628,10 +623,8 @@ static int pcipcwd_temp_release(struct inode *inode, struct file *file)
 
 static int pcipcwd_notify_sys(struct notifier_block *this, unsigned long code, void *unused)
 {
-       if (code==SYS_DOWN || code==SYS_HALT) {
-               /* Turn the WDT off */
-               pcipcwd_stop();
-       }
+       if (code == SYS_DOWN || code == SYS_HALT)
+               pcipcwd_stop(); /* Turn the WDT off */
 
        return NOTIFY_DONE;
 }
@@ -644,7 +637,7 @@ static const struct file_operations pcipcwd_fops = {
        .owner =        THIS_MODULE,
        .llseek =       no_llseek,
        .write =        pcipcwd_write,
-       .ioctl =        pcipcwd_ioctl,
+       .unlocked_ioctl = pcipcwd_ioctl,
        .open =         pcipcwd_open,
        .release =      pcipcwd_release,
 };
index bf443d0..c1685c9 100644 (file)
@@ -40,8 +40,7 @@
 #include <linux/slab.h>                /* For kmalloc, ... */
 #include <linux/mutex.h>       /* For mutex locking */
 #include <linux/hid.h>         /* For HID_REQ_SET_REPORT & HID_DT_REPORT */
-
-#include <asm/uaccess.h>       /* For copy_to_user/put_user/... */
+#include <linux/uaccess.h>     /* For copy_to_user/put_user/... */
 
 
 #ifdef CONFIG_USB_DEBUG
@@ -88,7 +87,7 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" _
 #define USB_PCWD_PRODUCT_ID    0x1140
 
 /* table of devices that work with this driver */
-static struct usb_device_id usb_pcwd_table [] = {
+static struct usb_device_id usb_pcwd_table[] = {
        { USB_DEVICE(USB_PCWD_VENDOR_ID, USB_PCWD_PRODUCT_ID) },
        { }                                     /* Terminating entry */
 };
@@ -110,7 +109,7 @@ MODULE_DEVICE_TABLE (usb, usb_pcwd_table);
 #define CMD_DISABLE_WATCHDOG           CMD_ENABLE_WATCHDOG
 
 /* Watchdog's Dip Switch heartbeat values */
-static const int heartbeat_tbl [] = {
+static const int heartbeat_tbl[] = {
        5,      /* OFF-OFF-OFF  =  5 Sec  */
        10,     /* OFF-OFF-ON   = 10 Sec  */
        30,     /* OFF-ON-OFF   = 30 Sec  */
@@ -130,15 +129,15 @@ static char expect_release;
 
 /* Structure to hold all of our device specific stuff */
 struct usb_pcwd_private {
-       struct usb_device *     udev;                   /* save off the usb device pointer */
-       struct usb_interface *  interface;              /* the interface for this device */
+       struct usb_device       *udev;                  /* save off the usb device pointer */
+       struct usb_interface    *interface;             /* the interface for this device */
 
        unsigned int            interface_number;       /* the interface number used for cmd's */
 
-       unsigned char *         intr_buffer;            /* the buffer to intr data */
+       unsigned char           *intr_buffer;           /* the buffer to intr data */
        dma_addr_t              intr_dma;               /* the dma address for the intr buffer */
        size_t                  intr_size;              /* the size of the intr buffer */
-       struct urb *            intr_urb;               /* the urb used for the intr pipe */
+       struct urb              *intr_urb;              /* the urb used for the intr pipe */
 
        unsigned char           cmd_command;            /* The command that is reported back */
        unsigned char           cmd_data_msb;           /* The data MSB that is reported back */
@@ -154,8 +153,8 @@ static struct usb_pcwd_private *usb_pcwd_device;
 static DEFINE_MUTEX(disconnect_mutex);
 
 /* local function prototypes */
-static int usb_pcwd_probe      (struct usb_interface *interface, const struct usb_device_id *id);
-static void usb_pcwd_disconnect        (struct usb_interface *interface);
+static int usb_pcwd_probe(struct usb_interface *interface, const struct usb_device_id *id);
+static void usb_pcwd_disconnect(struct usb_interface *interface);
 
 /* usb specific object needed to register this driver with the usb subsystem */
 static struct usb_driver usb_pcwd_driver = {
@@ -195,10 +194,10 @@ static void usb_pcwd_intr_done(struct urb *urb)
        usb_pcwd->cmd_data_lsb = data[2];
 
        /* notify anyone waiting that the cmd has finished */
-       atomic_set (&usb_pcwd->cmd_received, 1);
+       atomic_set(&usb_pcwd->cmd_received, 1);
 
 resubmit:
-       retval = usb_submit_urb (urb, GFP_ATOMIC);
+       retval = usb_submit_urb(urb, GFP_ATOMIC);
        if (retval)
                printk(KERN_ERR PFX "can't resubmit intr, usb_submit_urb failed with result %d\n",
                        retval);
@@ -224,7 +223,7 @@ static int usb_pcwd_send_command(struct usb_pcwd_private *usb_pcwd, unsigned cha
        dbg("sending following data cmd=0x%02x msb=0x%02x lsb=0x%02x",
                buf[0], buf[1], buf[2]);
 
-       atomic_set (&usb_pcwd->cmd_received, 0);
+       atomic_set(&usb_pcwd->cmd_received, 0);
 
        if (usb_control_msg(usb_pcwd->udev, usb_sndctrlpipe(usb_pcwd->udev, 0),
                        HID_REQ_SET_REPORT, HID_DT_REPORT,
@@ -237,7 +236,7 @@ static int usb_pcwd_send_command(struct usb_pcwd_private *usb_pcwd, unsigned cha
        got_response = 0;
        for (count = 0; (count < USB_COMMAND_TIMEOUT) && (!got_response); count++) {
                mdelay(1);
-               if (atomic_read (&usb_pcwd->cmd_received))
+               if (atomic_read(&usb_pcwd->cmd_received))
                        got_response = 1;
        }
 
@@ -356,7 +355,7 @@ static ssize_t usb_pcwd_write(struct file *file, const char __user *data,
                        /* scan to see whether or not we got the magic character */
                        for (i = 0; i != len; i++) {
                                char c;
-                               if(get_user(c, data+i))
+                               if (get_user(c, data + i))
                                        return -EFAULT;
                                if (c == 'V')
                                        expect_release = 42;
@@ -369,8 +368,8 @@ static ssize_t usb_pcwd_write(struct file *file, const char __user *data,
        return len;
 }
 
-static int usb_pcwd_ioctl(struct inode *inode, struct file *file,
-                         unsigned int cmd, unsigned long arg)
+static long usb_pcwd_ioctl(struct file *file, unsigned int cmd,
+                                               unsigned long arg)
 {
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
@@ -383,77 +382,76 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file,
        };
 
        switch (cmd) {
-               case WDIOC_GETSUPPORT:
-                       return copy_to_user(argp, &ident,
-                               sizeof (ident)) ? -EFAULT : 0;
+       case WDIOC_GETSUPPORT:
+               return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
 
-               case WDIOC_GETSTATUS:
-               case WDIOC_GETBOOTSTATUS:
-                       return put_user(0, p);
+       case WDIOC_GETSTATUS:
+       case WDIOC_GETBOOTSTATUS:
+               return put_user(0, p);
 
-               case WDIOC_GETTEMP:
-               {
-                       int temperature;
+       case WDIOC_GETTEMP:
+       {
+               int temperature;
 
-                       if (usb_pcwd_get_temperature(usb_pcwd_device, &temperature))
-                               return -EFAULT;
+               if (usb_pcwd_get_temperature(usb_pcwd_device, &temperature))
+                       return -EFAULT;
 
-                       return put_user(temperature, p);
-               }
+               return put_user(temperature, p);
+       }
 
-               case WDIOC_KEEPALIVE:
-                       usb_pcwd_keepalive(usb_pcwd_device);
-                       return 0;
+       case WDIOC_SETOPTIONS:
+       {
+               int new_options, retval = -EINVAL;
 
-               case WDIOC_SETOPTIONS:
-               {
-                       int new_options, retval = -EINVAL;
+               if (get_user(new_options, p))
+                       return -EFAULT;
 
-                       if (get_user (new_options, p))
-                               return -EFAULT;
+               if (new_options & WDIOS_DISABLECARD) {
+                       usb_pcwd_stop(usb_pcwd_device);
+                       retval = 0;
+               }
 
-                       if (new_options & WDIOS_DISABLECARD) {
-                               usb_pcwd_stop(usb_pcwd_device);
-                               retval = 0;
-                       }
+               if (new_options & WDIOS_ENABLECARD) {
+                       usb_pcwd_start(usb_pcwd_device);
+                       retval = 0;
+               }
 
-                       if (new_options & WDIOS_ENABLECARD) {
-                               usb_pcwd_start(usb_pcwd_device);
-                               retval = 0;
-                       }
+               return retval;
+       }
 
-                       return retval;
-               }
+       case WDIOC_KEEPALIVE:
+               usb_pcwd_keepalive(usb_pcwd_device);
+               return 0;
 
-               case WDIOC_SETTIMEOUT:
-               {
-                       int new_heartbeat;
+       case WDIOC_SETTIMEOUT:
+       {
+               int new_heartbeat;
 
-                       if (get_user(new_heartbeat, p))
-                               return -EFAULT;
+               if (get_user(new_heartbeat, p))
+                       return -EFAULT;
 
-                       if (usb_pcwd_set_heartbeat(usb_pcwd_device, new_heartbeat))
-                           return -EINVAL;
+               if (usb_pcwd_set_heartbeat(usb_pcwd_device, new_heartbeat))
+                   return -EINVAL;
 
-                       usb_pcwd_keepalive(usb_pcwd_device);
-                       /* Fall */
-               }
+               usb_pcwd_keepalive(usb_pcwd_device);
+               /* Fall */
+       }
 
-               case WDIOC_GETTIMEOUT:
-                       return put_user(heartbeat, p);
+       case WDIOC_GETTIMEOUT:
+               return put_user(heartbeat, p);
 
-               case WDIOC_GETTIMELEFT:
-               {
-                       int time_left;
+       case WDIOC_GETTIMELEFT:
+       {
+               int time_left;
 
-                       if (usb_pcwd_get_timeleft(usb_pcwd_device, &time_left))
-                               return -EFAULT;
+               if (usb_pcwd_get_timeleft(usb_pcwd_device, &time_left))
+                       return -EFAULT;
 
-                       return put_user(time_left, p);
-               }
+               return put_user(time_left, p);
+       }
 
-               default:
-                       return -ENOTTY;
+       default:
+               return -ENOTTY;
        }
 }
 
@@ -519,10 +517,8 @@ static int usb_pcwd_temperature_release(struct inode *inode, struct file *file)
 
 static int usb_pcwd_notify_sys(struct notifier_block *this, unsigned long code, void *unused)
 {
-       if (code==SYS_DOWN || code==SYS_HALT) {
-               /* Turn the WDT off */
-               usb_pcwd_stop(usb_pcwd_device);
-       }
+       if (code == SYS_DOWN || code == SYS_HALT)
+               usb_pcwd_stop(usb_pcwd_device); /* Turn the WDT off */
 
        return NOTIFY_DONE;
 }
@@ -535,7 +531,7 @@ static const struct file_operations usb_pcwd_fops = {
        .owner =        THIS_MODULE,
        .llseek =       no_llseek,
        .write =        usb_pcwd_write,
-       .ioctl =        usb_pcwd_ioctl,
+       .unlocked_ioctl = usb_pcwd_ioctl,
        .open =         usb_pcwd_open,
        .release =      usb_pcwd_release,
 };
@@ -567,13 +563,13 @@ static struct notifier_block usb_pcwd_notifier = {
 /**
  *     usb_pcwd_delete
  */
-static inline void usb_pcwd_delete (struct usb_pcwd_private *usb_pcwd)
+static inline void usb_pcwd_delete(struct usb_pcwd_private *usb_pcwd)
 {
        usb_free_urb(usb_pcwd->intr_urb);
        if (usb_pcwd->intr_buffer != NULL)
                usb_buffer_free(usb_pcwd->udev, usb_pcwd->intr_size,
                                usb_pcwd->intr_buffer, usb_pcwd->intr_dma);
-       kfree (usb_pcwd);
+       kfree(usb_pcwd);
 }
 
 /**
@@ -626,7 +622,7 @@ static int usb_pcwd_probe(struct usb_interface *interface, const struct usb_devi
        maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe));
 
        /* allocate memory for our device and initialize it */
-       usb_pcwd = kzalloc (sizeof(struct usb_pcwd_private), GFP_KERNEL);
+       usb_pcwd = kzalloc(sizeof(struct usb_pcwd_private), GFP_KERNEL);
        if (usb_pcwd == NULL) {
                printk(KERN_ERR PFX "Out of memory\n");
                goto error;
@@ -641,7 +637,8 @@ static int usb_pcwd_probe(struct usb_interface *interface, const struct usb_devi
        usb_pcwd->intr_size = (le16_to_cpu(endpoint->wMaxPacketSize) > 8 ? le16_to_cpu(endpoint->wMaxPacketSize) : 8);
 
        /* set up the memory buffer's */
-       if (!(usb_pcwd->intr_buffer = usb_buffer_alloc(udev, usb_pcwd->intr_size, GFP_ATOMIC, &usb_pcwd->intr_dma))) {
+       usb_pcwd->intr_buffer = usb_buffer_alloc(udev, usb_pcwd->intr_size, GFP_ATOMIC, &usb_pcwd->intr_dma);
+       if (!usb_pcwd->intr_buffer) {
                printk(KERN_ERR PFX "Out of memory\n");
                goto error;
        }
@@ -675,11 +672,10 @@ static int usb_pcwd_probe(struct usb_interface *interface, const struct usb_devi
 
        /* Get the Firmware Version */
        got_fw_rev = usb_pcwd_send_command(usb_pcwd, CMD_GET_FIRMWARE_VERSION, &fw_rev_major, &fw_rev_minor);
-       if (got_fw_rev) {
+       if (got_fw_rev)
                sprintf(fw_ver_str, "%u.%02u", fw_rev_major, fw_rev_minor);
-       } else {
+       else
                sprintf(fw_ver_str, "<card no answer>");
-       }
 
        printk(KERN_INFO PFX "Found card (Firmware: %s) with temp option\n",
                fw_ver_str);
@@ -725,7 +721,7 @@ static int usb_pcwd_probe(struct usb_interface *interface, const struct usb_devi
        }
 
        /* we can register the device now, as it is ready */
-       usb_set_intfdata (interface, usb_pcwd);
+       usb_set_intfdata(interface, usb_pcwd);
 
        printk(KERN_INFO PFX "initialized. heartbeat=%d sec (nowayout=%d)\n",
                heartbeat, nowayout);
@@ -759,8 +755,8 @@ static void usb_pcwd_disconnect(struct usb_interface *interface)
        /* prevent races with open() */
        mutex_lock(&disconnect_mutex);
 
-       usb_pcwd = usb_get_intfdata (interface);
-       usb_set_intfdata (interface, NULL);
+       usb_pcwd = usb_get_intfdata(interface);
+       usb_set_intfdata(interface, NULL);
 
        mutex_lock(&usb_pcwd->mtx);
 
@@ -820,5 +816,5 @@ static void __exit usb_pcwd_exit(void)
 }
 
 
-module_init (usb_pcwd_init);
-module_exit (usb_pcwd_exit);
+module_init(usb_pcwd_init);
+module_exit(usb_pcwd_exit);
index 6b8483d..6eadf5e 100644 (file)
 #include <linux/platform_device.h>
 #include <linux/clk.h>
 #include <linux/spinlock.h>
+#include <linux/uaccess.h>
+#include <linux/io.h>
 
 #include <asm/hardware.h>
-#include <asm/uaccess.h>
-#include <asm/io.h>
 
 #define MODULE_NAME "PNX4008-WDT: "
 
@@ -144,9 +144,8 @@ static int pnx4008_wdt_open(struct inode *inode, struct file *file)
        return nonseekable_open(inode, file);
 }
 
-static ssize_t
-pnx4008_wdt_write(struct file *file, const char *data, size_t len,
-                 loff_t * ppos)
+static ssize_t pnx4008_wdt_write(struct file *file, const char *data,
+                                       size_t len, loff_t *ppos)
 {
        if (len) {
                if (!nowayout) {
@@ -169,15 +168,14 @@ pnx4008_wdt_write(struct file *file, const char *data, size_t len,
        return len;
 }
 
-static struct watchdog_info ident = {
+static const struct watchdog_info ident = {
        .options = WDIOF_CARDRESET | WDIOF_MAGICCLOSE |
            WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
        .identity = "PNX4008 Watchdog",
 };
 
-static int
-pnx4008_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-                 unsigned long arg)
+static long pnx4008_wdt_ioctl(struct inode *inode, struct file *file,
+                                       unsigned int cmd, unsigned long arg)
 {
        int ret = -ENOTTY;
        int time;
@@ -196,6 +194,11 @@ pnx4008_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
                ret = put_user(boot_status, (int *)arg);
                break;
 
+       case WDIOC_KEEPALIVE:
+               wdt_enable();
+               ret = 0;
+               break;
+
        case WDIOC_SETTIMEOUT:
                ret = get_user(time, (int *)arg);
                if (ret)
@@ -213,11 +216,6 @@ pnx4008_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
        case WDIOC_GETTIMEOUT:
                ret = put_user(heartbeat, (int *)arg);
                break;
-
-       case WDIOC_KEEPALIVE:
-               wdt_enable();
-               ret = 0;
-               break;
        }
        return ret;
 }
@@ -238,7 +236,7 @@ static const struct file_operations pnx4008_wdt_fops = {
        .owner = THIS_MODULE,
        .llseek = no_llseek,
        .write = pnx4008_wdt_write,
-       .ioctl = pnx4008_wdt_ioctl,
+       .unlocked_ioctl = pnx4008_wdt_ioctl,
        .open = pnx4008_wdt_open,
        .release = pnx4008_wdt_release,
 };
index 5c921e4..f1ae372 100644 (file)
 #include <linux/notifier.h>
 #include <linux/miscdevice.h>
 #include <linux/watchdog.h>
-#include <asm/io.h>
+#include <linux/io.h>
+#include <linux/uaccess.h>
 #include <asm/atomic.h>
 #include <asm/processor.h>
-#include <asm/uaccess.h>
 #include <asm/system.h>
 #include <asm/rm9k-ocd.h>
 
@@ -53,10 +53,12 @@ static void wdt_gpi_stop(void);
 static void wdt_gpi_set_timeout(unsigned int);
 static int wdt_gpi_open(struct inode *, struct file *);
 static int wdt_gpi_release(struct inode *, struct file *);
-static ssize_t wdt_gpi_write(struct file *, const char __user *, size_t, loff_t *);
+static ssize_t wdt_gpi_write(struct file *, const char __user *, size_t,
+                                                               loff_t *);
 static long wdt_gpi_ioctl(struct file *, unsigned int, unsigned long);
 static int wdt_gpi_notify(struct notifier_block *, unsigned long, void *);
-static const struct resource *wdt_gpi_get_resource(struct platform_device *, const char *, unsigned int);
+static const struct resource *wdt_gpi_get_resource(struct platform_device *,
+                                               const char *, unsigned int);
 static int __init wdt_gpi_probe(struct device *);
 static int __exit wdt_gpi_remove(struct device *);
 
@@ -68,7 +70,7 @@ static int locked;
 
 
 /* These are set from device resources */
-static void __iomem * wd_regs;
+static void __iomem *wd_regs;
 static unsigned int wd_irq, wd_ctr;
 
 
@@ -216,7 +218,8 @@ static int wdt_gpi_release(struct inode *inode, struct file *file)
                if (expect_close) {
                        wdt_gpi_stop();
                        free_irq(wd_irq, &miscdev);
-                       printk(KERN_INFO "%s: watchdog stopped\n", wdt_gpi_name);
+                       printk(KERN_INFO "%s: watchdog stopped\n",
+                                                       wdt_gpi_name);
                } else {
                        printk(KERN_CRIT "%s: unexpected close() -"
                                " watchdog left running\n",
@@ -231,8 +234,8 @@ static int wdt_gpi_release(struct inode *inode, struct file *file)
        return 0;
 }
 
-static ssize_t
-wdt_gpi_write(struct file *f, const char __user *d, size_t s, loff_t *o)
+static ssize_t wdt_gpi_write(struct file *f, const char __user *d, size_t s,
+                                                               loff_t *o)
 {
        char val;
 
@@ -241,8 +244,7 @@ wdt_gpi_write(struct file *f, const char __user *d, size_t s, loff_t *o)
        return s ? 1 : 0;
 }
 
-static long
-wdt_gpi_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
+static long wdt_gpi_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
 {
        long res = -ENOTTY;
        const long size = _IOC_SIZE(cmd);
@@ -271,7 +273,8 @@ wdt_gpi_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
        case WDIOC_GETSUPPORT:
                wdinfo.options = nowayout ?
                        WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING :
-                       WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE;
+                       WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING |
+                       WDIOF_MAGICCLOSE;
                res = __copy_to_user(argp, &wdinfo, size) ?  -EFAULT : size;
                break;
 
@@ -322,8 +325,8 @@ wdt_gpi_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
 
 
 /* Shutdown notifier */
-static int
-wdt_gpi_notify(struct notifier_block *this, unsigned long code, void *unused)
+static int wdt_gpi_notify(struct notifier_block *this, unsigned long code,
+                         void *unused)
 {
        if (code == SYS_DOWN || code == SYS_HALT)
                wdt_gpi_stop();
@@ -333,9 +336,8 @@ wdt_gpi_notify(struct notifier_block *this, unsigned long code, void *unused)
 
 
 /* Init & exit procedures */
-static const struct resource *
-wdt_gpi_get_resource(struct platform_device *pdv, const char *name,
-                     unsigned int type)
+static const struct resource *wdt_gpi_get_resource(struct platform_device *pdv,
+                                       const char *name, unsigned int type)
 {
        char buf[80];
        if (snprintf(buf, sizeof buf, "%s_0", name) >= sizeof buf)
index 98532c0..c417fb5 100644 (file)
@@ -46,9 +46,8 @@
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
 #include <linux/clk.h>
-
-#include <asm/uaccess.h>
-#include <asm/io.h>
+#include <linux/uaccess.h>
+#include <linux/io.h>
 
 #include <asm/arch/map.h>
 
@@ -65,8 +64,8 @@
 static int nowayout    = WATCHDOG_NOWAYOUT;
 static int tmr_margin  = CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME;
 static int tmr_atboot  = CONFIG_S3C2410_WATCHDOG_ATBOOT;
-static int soft_noboot = 0;
-static int debug       = 0;
+static int soft_noboot;
+static int debug;
 
 module_param(tmr_margin,  int, 0);
 module_param(tmr_atboot,  int, 0);
@@ -74,24 +73,23 @@ module_param(nowayout,    int, 0);
 module_param(soft_noboot, int, 0);
 module_param(debug,      int, 0);
 
-MODULE_PARM_DESC(tmr_margin, "Watchdog tmr_margin in seconds. default=" __MODULE_STRING(CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME) ")");
-
-MODULE_PARM_DESC(tmr_atboot, "Watchdog is started at boot time if set to 1, default=" __MODULE_STRING(CONFIG_S3C2410_WATCHDOG_ATBOOT));
-
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
-
+MODULE_PARM_DESC(tmr_margin, "Watchdog tmr_margin in seconds. default="
+               __MODULE_STRING(CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME) ")");
+MODULE_PARM_DESC(tmr_atboot,
+               "Watchdog is started at boot time if set to 1, default="
+                       __MODULE_STRING(CONFIG_S3C2410_WATCHDOG_ATBOOT));
+MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
+                       __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 MODULE_PARM_DESC(soft_noboot, "Watchdog action, set to 1 to ignore reboots, 0 to reboot (default depends on ONLY_TESTING)");
-
 MODULE_PARM_DESC(debug, "Watchdog debug, set to >1 for debug, (default 0)");
 
 
 typedef enum close_state {
        CLOSE_STATE_NOT,
-       CLOSE_STATE_ALLOW=0x4021
+       CLOSE_STATE_ALLOW = 0x4021
 } close_state_t;
 
-static DECLARE_MUTEX(open_lock);
-
+static unsigned long open_lock;
 static struct device    *wdt_dev;      /* platform device attached to */
 static struct resource *wdt_mem;
 static struct resource *wdt_irq;
@@ -99,38 +97,47 @@ static struct clk   *wdt_clock;
 static void __iomem    *wdt_base;
 static unsigned int     wdt_count;
 static close_state_t    allow_close;
+static DEFINE_SPINLOCK(wdt_lock);
 
 /* watchdog control routines */
 
 #define DBG(msg...) do { \
        if (debug) \
                printk(KERN_INFO msg); \
-       } while(0)
+       } while (0)
 
 /* functions */
 
-static int s3c2410wdt_keepalive(void)
+static void s3c2410wdt_keepalive(void)
 {
+       spin_lock(&wdt_lock);
        writel(wdt_count, wdt_base + S3C2410_WTCNT);
-       return 0;
+       spin_unlock(&wdt_lock);
 }
 
-static int s3c2410wdt_stop(void)
+static void __s3c2410wdt_stop(void)
 {
        unsigned long wtcon;
 
        wtcon = readl(wdt_base + S3C2410_WTCON);
        wtcon &= ~(S3C2410_WTCON_ENABLE | S3C2410_WTCON_RSTEN);
        writel(wtcon, wdt_base + S3C2410_WTCON);
+}
 
-       return 0;
+static void s3c2410wdt_stop(void)
+{
+       spin_lock(&wdt_lock);
+       __s3c2410wdt_stop();
+       spin_unlock(&wdt_lock);
 }
 
-static int s3c2410wdt_start(void)
+static void s3c2410wdt_start(void)
 {
        unsigned long wtcon;
 
-       s3c2410wdt_stop();
+       spin_lock(&wdt_lock);
+
+       __s3c2410wdt_stop();
 
        wtcon = readl(wdt_base + S3C2410_WTCON);
        wtcon |= S3C2410_WTCON_ENABLE | S3C2410_WTCON_DIV128;
@@ -149,6 +156,7 @@ static int s3c2410wdt_start(void)
        writel(wdt_count, wdt_base + S3C2410_WTDAT);
        writel(wdt_count, wdt_base + S3C2410_WTCNT);
        writel(wtcon, wdt_base + S3C2410_WTCON);
+       spin_unlock(&wdt_lock);
 
        return 0;
 }
@@ -211,7 +219,7 @@ static int s3c2410wdt_set_heartbeat(int timeout)
 
 static int s3c2410wdt_open(struct inode *inode, struct file *file)
 {
-       if(down_trylock(&open_lock))
+       if (test_and_set_bit(0, &open_lock))
                return -EBUSY;
 
        if (nowayout)
@@ -231,15 +239,14 @@ static int s3c2410wdt_release(struct inode *inode, struct file *file)
         *      Lock it in if it's a module and we set nowayout
         */
 
-       if (allow_close == CLOSE_STATE_ALLOW) {
+       if (allow_close == CLOSE_STATE_ALLOW)
                s3c2410wdt_stop();
-       else {
+       else {
                dev_err(wdt_dev, "Unexpected close, not stopping watchdog\n");
                s3c2410wdt_keepalive();
        }
-
        allow_close = CLOSE_STATE_NOT;
-       up(&open_lock);
+       clear_bit(0, &open_lock);
        return 0;
 }
 
@@ -249,7 +256,7 @@ static ssize_t s3c2410wdt_write(struct file *file, const char __user *data,
        /*
         *      Refresh the timer.
         */
-       if(len) {
+       if (len) {
                if (!nowayout) {
                        size_t i;
 
@@ -265,7 +272,6 @@ static ssize_t s3c2410wdt_write(struct file *file, const char __user *data,
                                        allow_close = CLOSE_STATE_ALLOW;
                        }
                }
-
                s3c2410wdt_keepalive();
        }
        return len;
@@ -273,48 +279,41 @@ static ssize_t s3c2410wdt_write(struct file *file, const char __user *data,
 
 #define OPTIONS WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE
 
-static struct watchdog_info s3c2410_wdt_ident = {
+static const struct watchdog_info s3c2410_wdt_ident = {
        .options          =     OPTIONS,
        .firmware_version =     0,
        .identity         =     "S3C2410 Watchdog",
 };
 
 
-static int s3c2410wdt_ioctl(struct inode *inode, struct file *file,
-       unsigned int cmd, unsigned long arg)
+static long s3c2410wdt_ioctl(struct file *file,        unsigned int cmd,
+                                                       unsigned long arg)
 {
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
        int new_margin;
 
        switch (cmd) {
-               default:
-                       return -ENOTTY;
-
-               case WDIOC_GETSUPPORT:
-                       return copy_to_user(argp, &s3c2410_wdt_ident,
-                               sizeof(s3c2410_wdt_ident)) ? -EFAULT : 0;
-
-               case WDIOC_GETSTATUS:
-               case WDIOC_GETBOOTSTATUS:
-                       return put_user(0, p);
-
-               case WDIOC_KEEPALIVE:
-                       s3c2410wdt_keepalive();
-                       return 0;
-
-               case WDIOC_SETTIMEOUT:
-                       if (get_user(new_margin, p))
-                               return -EFAULT;
-
-                       if (s3c2410wdt_set_heartbeat(new_margin))
-                               return -EINVAL;
-
-                       s3c2410wdt_keepalive();
-                       return put_user(tmr_margin, p);
-
-               case WDIOC_GETTIMEOUT:
-                       return put_user(tmr_margin, p);
+       case WDIOC_GETSUPPORT:
+               return copy_to_user(argp, &s3c2410_wdt_ident,
+                       sizeof(s3c2410_wdt_ident)) ? -EFAULT : 0;
+       case WDIOC_GETSTATUS:
+       case WDIOC_GETBOOTSTATUS:
+               return put_user(0, p);
+       case WDIOC_KEEPALIVE:
+               s3c2410wdt_keepalive();
+               return 0;
+       case WDIOC_SETTIMEOUT:
+               if (get_user(new_margin, p))
+                       return -EFAULT;
+               if (s3c2410wdt_set_heartbeat(new_margin))
+                       return -EINVAL;
+               s3c2410wdt_keepalive();
+               return put_user(tmr_margin, p);
+       case WDIOC_GETTIMEOUT:
+               return put_user(tmr_margin, p);
+       default:
+               return -ENOTTY;
        }
 }
 
@@ -324,7 +323,7 @@ static const struct file_operations s3c2410wdt_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = s3c2410wdt_write,
-       .ioctl          = s3c2410wdt_ioctl,
+       .unlocked_ioctl = s3c2410wdt_ioctl,
        .open           = s3c2410wdt_open,
        .release        = s3c2410wdt_release,
 };
@@ -411,14 +410,15 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
         * not, try the default value */
 
        if (s3c2410wdt_set_heartbeat(tmr_margin)) {
-               started = s3c2410wdt_set_heartbeat(CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME);
+               started = s3c2410wdt_set_heartbeat(
+                                       CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME);
 
-               if (started == 0) {
-                       dev_info(dev,"tmr_margin value out of range, default %d used\n",
+               if (started == 0)
+                       dev_info(dev,
+                          "tmr_margin value out of range, default %d used\n",
                               CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME);
-               } else {
+               else
                        dev_info(dev, "default timer value is out of range, cannot start\n");
-               }
        }
 
        ret = misc_register(&s3c2410wdt_miscdev);
@@ -447,7 +447,7 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
                 (wtcon & S3C2410_WTCON_ENABLE) ?  "" : "in",
                 (wtcon & S3C2410_WTCON_RSTEN) ? "" : "dis",
                 (wtcon & S3C2410_WTCON_INTEN) ? "" : "en");
-       
+
        return 0;
 
  err_clk:
@@ -487,7 +487,7 @@ static int s3c2410wdt_remove(struct platform_device *dev)
 
 static void s3c2410wdt_shutdown(struct platform_device *dev)
 {
-       s3c2410wdt_stop();      
+       s3c2410wdt_stop();
 }
 
 #ifdef CONFIG_PM
@@ -540,7 +540,8 @@ static struct platform_driver s3c2410wdt_driver = {
 };
 
 
-static char banner[] __initdata = KERN_INFO "S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics\n";
+static char banner[] __initdata =
+       KERN_INFO "S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics\n";
 
 static int __init watchdog_init(void)
 {
index 34a2b3b..27d6898 100644 (file)
 #include <linux/watchdog.h>
 #include <linux/init.h>
 #include <linux/bitops.h>
+#include <linux/uaccess.h>
 
 #ifdef CONFIG_ARCH_PXA
 #include <asm/arch/pxa-regs.h>
 #endif
 
 #include <asm/hardware.h>
-#include <asm/uaccess.h>
 
 #define OSCR_FREQ              CLOCK_TICK_RATE
 
@@ -45,7 +45,7 @@ static int boot_status;
  */
 static int sa1100dog_open(struct inode *inode, struct file *file)
 {
-       if (test_and_set_bit(1,&sa1100wdt_users))
+       if (test_and_set_bit(1, &sa1100wdt_users))
                return -EBUSY;
 
        /* Activate SA1100 Watchdog timer */
@@ -66,28 +66,27 @@ static int sa1100dog_open(struct inode *inode, struct file *file)
 static int sa1100dog_release(struct inode *inode, struct file *file)
 {
        printk(KERN_CRIT "WATCHDOG: Device closed - timer will not stop\n");
-
        clear_bit(1, &sa1100wdt_users);
-
        return 0;
 }
 
-static ssize_t sa1100dog_write(struct file *file, const char __user *data, size_t len, loff_t *ppos)
+static ssize_t sa1100dog_write(struct file *file, const char __user *data,
+                                               size_t len, loff_t *ppos)
 {
        if (len)
                /* Refresh OSMR3 timer. */
                OSMR3 = OSCR + pre_margin;
-
        return len;
 }
 
-static struct watchdog_info ident = {
-       .options        = WDIOF_CARDRESET | WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
+static const struct watchdog_info ident = {
+       .options        = WDIOF_CARDRESET | WDIOF_SETTIMEOUT
+                               | WDIOF_KEEPALIVEPING,
        .identity       = "SA1100/PXA255 Watchdog",
 };
 
-static int sa1100dog_ioctl(struct inode *inode, struct file *file,
-       unsigned int cmd, unsigned long arg)
+static long sa1100dog_ioctl(struct file *file, unsigned int cmd,
+                                                       unsigned long arg)
 {
        int ret = -ENOTTY;
        int time;
@@ -108,6 +107,11 @@ static int sa1100dog_ioctl(struct inode *inode, struct file *file,
                ret = put_user(boot_status, p);
                break;
 
+       case WDIOC_KEEPALIVE:
+               OSMR3 = OSCR + pre_margin;
+               ret = 0;
+               break;
+
        case WDIOC_SETTIMEOUT:
                ret = get_user(time, p);
                if (ret)
@@ -125,27 +129,20 @@ static int sa1100dog_ioctl(struct inode *inode, struct file *file,
        case WDIOC_GETTIMEOUT:
                ret = put_user(pre_margin / OSCR_FREQ, p);
                break;
-
-       case WDIOC_KEEPALIVE:
-               OSMR3 = OSCR + pre_margin;
-               ret = 0;
-               break;
        }
        return ret;
 }
 
-static const struct file_operations sa1100dog_fops =
-{
+static const struct file_operations sa1100dog_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = sa1100dog_write,
-       .ioctl          = sa1100dog_ioctl,
+       .unlocked_ioctl = sa1100dog_ioctl,
        .open           = sa1100dog_open,
        .release        = sa1100dog_release,
 };
 
-static struct miscdevice sa1100dog_miscdev =
-{
+static struct miscdevice sa1100dog_miscdev = {
        .minor          = WATCHDOG_MINOR,
        .name           = "watchdog",
        .fops           = &sa1100dog_fops,
@@ -167,8 +164,9 @@ static int __init sa1100dog_init(void)
 
        ret = misc_register(&sa1100dog_miscdev);
        if (ret == 0)
-               printk("SA1100/PXA2xx Watchdog Timer: timer margin %d sec\n",
-                      margin);
+               printk(KERN_INFO
+                       "SA1100/PXA2xx Watchdog Timer: timer margin %d sec\n",
+                                               margin);
        return ret;
 }
 
index b944314..27e526a 100644 (file)
@@ -57,6 +57,7 @@
 #include <asm/sibyte/sb1250_int.h>
 #include <asm/sibyte/sb1250_scd.h>
 
+static DEFINE_SPINLOCK(sbwd_lock);
 
 /*
  * set the initial count value of a timer
  */
 void sbwdog_set(char __iomem *wdog, unsigned long t)
 {
+       spin_lock(&sbwd_lock);
        __raw_writeb(0, wdog - 0x10);
        __raw_writeq(t & 0x7fffffUL, wdog);
+       spin_unlock(&sbwd_lock);
 }
 
 /*
@@ -77,7 +80,9 @@ void sbwdog_set(char __iomem *wdog, unsigned long t)
  */
 void sbwdog_pet(char __iomem *wdog)
 {
+       spin_lock(&sbwd_lock);
        __raw_writeb(__raw_readb(wdog) | 1, wdog);
+       spin_unlock(&sbwd_lock);
 }
 
 static unsigned long sbwdog_gate; /* keeps it to one thread only */
@@ -86,8 +91,9 @@ static char __iomem *user_dog = (char __iomem *)(IO_BASE + (A_SCD_WDOG_CFG_1));
 static unsigned long timeout = 0x7fffffUL;     /* useconds: 8.3ish secs. */
 static int expect_close;
 
-static struct watchdog_info ident = {
-       .options        = WDIOF_CARDRESET | WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
+static const struct watchdog_info ident = {
+       .options        = WDIOF_CARDRESET | WDIOF_SETTIMEOUT |
+                                               WDIOF_KEEPALIVEPING,
        .identity       = "SiByte Watchdog",
 };
 
@@ -97,9 +103,8 @@ static struct watchdog_info ident = {
 static int sbwdog_open(struct inode *inode, struct file *file)
 {
        nonseekable_open(inode, file);
-       if (test_and_set_bit(0, &sbwdog_gate)) {
+       if (test_and_set_bit(0, &sbwdog_gate))
                return -EBUSY;
-       }
        __module_get(THIS_MODULE);
 
        /*
@@ -120,8 +125,9 @@ static int sbwdog_release(struct inode *inode, struct file *file)
                __raw_writeb(0, user_dog);
                module_put(THIS_MODULE);
        } else {
-               printk(KERN_CRIT "%s: Unexpected close, not stopping watchdog!\n",
-                       ident.identity);
+               printk(KERN_CRIT
+                       "%s: Unexpected close, not stopping watchdog!\n",
+                                               ident.identity);
                sbwdog_pet(user_dog);
        }
        clear_bit(0, &sbwdog_gate);
@@ -147,12 +153,10 @@ static ssize_t sbwdog_write(struct file *file, const char __user *data,
                for (i = 0; i != len; i++) {
                        char c;
 
-                       if (get_user(c, data + i)) {
+                       if (get_user(c, data + i))
                                return -EFAULT;
-                       }
-                       if (c == 'V') {
+                       if (c == 'V')
                                expect_close = 42;
-                       }
                }
                sbwdog_pet(user_dog);
        }
@@ -160,8 +164,8 @@ static ssize_t sbwdog_write(struct file *file, const char __user *data,
        return len;
 }
 
-static int sbwdog_ioctl(struct inode *inode, struct file *file,
-                       unsigned int cmd, unsigned long arg)
+static long sbwdog_ioctl(struct file *file, unsigned int cmd,
+                                               unsigned long arg)
 {
        int ret = -ENOTTY;
        unsigned long time;
@@ -178,11 +182,15 @@ static int sbwdog_ioctl(struct inode *inode, struct file *file,
                ret = put_user(0, p);
                break;
 
+       case WDIOC_KEEPALIVE:
+               sbwdog_pet(user_dog);
+               ret = 0;
+               break;
+
        case WDIOC_SETTIMEOUT:
                ret = get_user(time, p);
-               if (ret) {
+               if (ret)
                        break;
-               }
 
                time *= 1000000;
                if (time > 0x7fffffUL) {
@@ -200,11 +208,6 @@ static int sbwdog_ioctl(struct inode *inode, struct file *file,
                 */
                ret = put_user(__raw_readq(user_dog - 8) / 1000000, p);
                break;
-
-       case WDIOC_KEEPALIVE:
-               sbwdog_pet(user_dog);
-               ret = 0;
-               break;
        }
        return ret;
 }
@@ -212,8 +215,8 @@ static int sbwdog_ioctl(struct inode *inode, struct file *file,
 /*
  *     Notifier for system down
  */
-static int
-sbwdog_notify_sys(struct notifier_block *this, unsigned long code, void *erf)
+static int sbwdog_notify_sys(struct notifier_block *this, unsigned long code,
+                                                               void *erf)
 {
        if (code == SYS_DOWN || code == SYS_HALT) {
                /*
@@ -226,18 +229,16 @@ sbwdog_notify_sys(struct notifier_block *this, unsigned long code, void *erf)
        return NOTIFY_DONE;
 }
 
-static const struct file_operations sbwdog_fops =
-{
+static const struct file_operations sbwdog_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = sbwdog_write,
-       .ioctl          = sbwdog_ioctl,
+       .unlocked_ioctl = sbwdog_ioctl,
        .open           = sbwdog_open,
        .release        = sbwdog_release,
 };
 
-static struct miscdevice sbwdog_miscdev =
-{
+static struct miscdevice sbwdog_miscdev = {
        .minor          = WATCHDOG_MINOR,
        .name           = "watchdog",
        .fops           = &sbwdog_fops,
@@ -267,13 +268,12 @@ irqreturn_t sbwdog_interrupt(int irq, void *addr)
        /*
         * if it's the second watchdog timer, it's for those users
         */
-       if (wd_cfg_reg == user_dog) {
+       if (wd_cfg_reg == user_dog)
                printk(KERN_CRIT
                        "%s in danger of initiating system reset in %ld.%01ld seconds\n",
                        ident.identity, wd_init / 1000000, (wd_init / 100000) % 10);
-       } else {
+       else
                cfg |= 1;
-       }
 
        __raw_writeb(cfg, wd_cfg_reg);
 
@@ -289,28 +289,31 @@ static int __init sbwdog_init(void)
         */
        ret = register_reboot_notifier(&sbwdog_notifier);
        if (ret) {
-               printk (KERN_ERR "%s: cannot register reboot notifier (err=%d)\n",
-                       ident.identity, ret);
+               printk(KERN_ERR
+                       "%s: cannot register reboot notifier (err=%d)\n",
+                                               ident.identity, ret);
                return ret;
        }
 
        /*
         * get the resources
         */
-       ret = misc_register(&sbwdog_miscdev);
-       if (ret == 0) {
-               printk(KERN_INFO "%s: timeout is %ld.%ld secs\n", ident.identity,
-                       timeout / 1000000, (timeout / 100000) % 10);
-       }
 
        ret = request_irq(1, sbwdog_interrupt, IRQF_DISABLED | IRQF_SHARED,
                ident.identity, (void *)user_dog);
        if (ret) {
-               printk(KERN_ERR "%s: failed to request irq 1 - %d\n", ident.identity,
-                       ret);
-               misc_deregister(&sbwdog_miscdev);
+               printk(KERN_ERR "%s: failed to request irq 1 - %d\n",
+                                               ident.identity, ret);
+               return ret;
        }
 
+       ret = misc_register(&sbwdog_miscdev);
+       if (ret == 0) {
+               printk(KERN_INFO "%s: timeout is %ld.%ld secs\n",
+                               ident.identity,
+                               timeout / 1000000, (timeout / 100000) % 10);
+       } else
+               free_irq(1, (void *)user_dog);
        return ret;
 }
 
@@ -327,7 +330,7 @@ MODULE_DESCRIPTION("SiByte Watchdog");
 
 module_param(timeout, ulong, 0);
 MODULE_PARM_DESC(timeout,
-       "Watchdog timeout in microseconds (max/default 8388607 or 8.3ish secs)");
+      "Watchdog timeout in microseconds (max/default 8388607 or 8.3ish secs)");
 
 MODULE_LICENSE("GPL");
 MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
@@ -336,16 +339,15 @@ MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
  * example code that can be put in a platform code area to utilize the
  * first watchdog timer for the kernels own purpose.
 
- void
-platform_wd_setup(void)
+void platform_wd_setup(void)
 {
        int ret;
 
-       ret = request_irq(0, sbwdog_interrupt, IRQF_DISABLED | IRQF_SHARED,
+       ret = request_irq(1, sbwdog_interrupt, IRQF_DISABLED | IRQF_SHARED,
                "Kernel Watchdog", IOADDR(A_SCD_WDOG_CFG_0));
        if (ret) {
-               printk(KERN_CRIT "Watchdog IRQ zero(0) failed to be requested - %d\n",
-                       ret);
+               printk(KERN_CRIT
+                 "Watchdog IRQ zero(0) failed to be requested - %d\n", ret);
        }
 }
 
index ef76f01..3266daa 100644 (file)
  *
  *           12/4 - 2000      [Initial revision]
  *           25/4 - 2000      Added /dev/watchdog support
- *           09/5 - 2001      [smj@oro.net] fixed fop_write to "return 1" on success
+ *           09/5 - 2001      [smj@oro.net] fixed fop_write to "return 1"
+ *                                     on success
  *           12/4 - 2002      [rob@osinvestor.com] eliminate fop_read
  *                            fix possible wdt_is_open race
  *                            add CONFIG_WATCHDOG_NOWAYOUT support
  *                            remove lock_kernel/unlock_kernel pairs
  *                            added KERN_* to printk's
  *                            got rid of extraneous comments
- *                            changed watchdog_info to correctly reflect what the driver offers
- *                            added WDIOC_GETSTATUS, WDIOC_GETBOOTSTATUS, WDIOC_SETTIMEOUT,
- *                            WDIOC_GETTIMEOUT, and WDIOC_SETOPTIONS ioctls
+ *                            changed watchdog_info to correctly reflect what
+ *                           the driver offers
+ *                           added WDIOC_GETSTATUS, WDIOC_GETBOOTSTATUS,
+ *                           WDIOC_SETTIMEOUT, WDIOC_GETTIMEOUT, and
+ *                           WDIOC_SETOPTIONS ioctls
  *           09/8 - 2003      [wim@iguana.be] cleanup of trailing spaces
  *                            use module_param
- *                            made timeout (the emulated heartbeat) a module_param
+ *                            made timeout (the emulated heartbeat) a
+ *                           module_param
  *                            made the keepalive ping an internal subroutine
  *                            made wdt_stop and wdt_start module params
  *                            added extra printk's for startup problems
@@ -56,9 +60,9 @@
 #include <linux/notifier.h>
 #include <linux/reboot.h>
 #include <linux/init.h>
+#include <linux/io.h>
+#include <linux/uaccess.h>
 
-#include <asm/io.h>
-#include <asm/uaccess.h>
 #include <asm/system.h>
 
 #define OUR_NAME "sbc60xxwdt"
@@ -94,13 +98,18 @@ MODULE_PARM_DESC(wdt_start, "SBC60xx WDT 'start' io port (default 0x443)");
  */
 
 #define WATCHDOG_TIMEOUT 30            /* 30 sec default timeout */
-static int timeout = WATCHDOG_TIMEOUT; /* in seconds, will be multiplied by HZ to get seconds to wait for a ping */
+static int timeout = WATCHDOG_TIMEOUT; /* in seconds, multiplied by HZ to
+                                          get seconds to wait for a ping */
 module_param(timeout, int, 0);
-MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (1<=timeout<=3600, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
+MODULE_PARM_DESC(timeout,
+       "Watchdog timeout in seconds. (1<=timeout<=3600, default="
+                               __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
 
 static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout,
+       "Watchdog cannot be stopped once started (default="
+                               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 static void wdt_timer_ping(unsigned long);
 static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
@@ -117,15 +126,14 @@ static void wdt_timer_ping(unsigned long data)
        /* If we got a heartbeat pulse within the WDT_US_INTERVAL
         * we agree to ping the WDT
         */
-       if(time_before(jiffies, next_heartbeat))
-       {
+       if (time_before(jiffies, next_heartbeat)) {
                /* Ping the WDT by reading from wdt_start */
                inb_p(wdt_start);
                /* Re-set the timer interval */
                mod_timer(&timer, jiffies + WDT_INTERVAL);
-       } else {
-               printk(KERN_WARNING PFX "Heartbeat lost! Will not ping the watchdog\n");
-       }
+       } else
+               printk(KERN_WARNING PFX
+                       "Heartbeat lost! Will not ping the watchdog\n");
 }
 
 /*
@@ -159,40 +167,40 @@ static void wdt_keepalive(void)
  * /dev/watchdog handling
  */
 
-static ssize_t fop_write(struct file * file, const char __user * buf, size_t count, loff_t * ppos)
+static ssize_t fop_write(struct file *file, const char __user *buf,
+                                               size_t count, loff_t *ppos)
 {
        /* See if we got the magic character 'V' and reload the timer */
-       if(count)
-       {
-               if (!nowayout)
-               {
+       if (count) {
+               if (!nowayout) {
                        size_t ofs;
 
-                       /* note: just in case someone wrote the magic character
-                        * five months ago... */
+                       /* note: just in case someone wrote the
+                          magic character five months ago... */
                        wdt_expect_close = 0;
 
-                       /* scan to see whether or not we got the magic character */
-                       for(ofs = 0; ofs != count; ofs++)
-                       {
+                       /* scan to see whether or not we got the
+                          magic character */
+                       for (ofs = 0; ofs != count; ofs++) {
                                char c;
-                               if(get_user(c, buf+ofs))
+                               if (get_user(c, buf + ofs))
                                        return -EFAULT;
-                               if(c == 'V')
+                               if (c == 'V')
                                        wdt_expect_close = 42;
                        }
                }
 
-               /* Well, anyhow someone wrote to us, we should return that favour */
+               /* Well, anyhow someone wrote to us, we should
+                  return that favour */
                wdt_keepalive();
        }
        return count;
 }
 
-static int fop_open(struct inode * inode, struct file * file)
+static int fop_open(struct inode *inode, struct file *file)
 {
        /* Just in case we're already talking to someone... */
-       if(test_and_set_bit(0, &wdt_is_open))
+       if (test_and_set_bit(0, &wdt_is_open))
                return -EBUSY;
 
        if (nowayout)
@@ -203,78 +211,72 @@ static int fop_open(struct inode * inode, struct file * file)
        return nonseekable_open(inode, file);
 }
 
-static int fop_close(struct inode * inode, struct file * file)
+static int fop_close(struct inode *inode, struct file *file)
 {
-       if(wdt_expect_close == 42)
+       if (wdt_expect_close == 42)
                wdt_turnoff();
        else {
                del_timer(&timer);
-               printk(KERN_CRIT PFX "device file closed unexpectedly. Will not stop the WDT!\n");
+               printk(KERN_CRIT PFX
+                 "device file closed unexpectedly. Will not stop the WDT!\n");
        }
        clear_bit(0, &wdt_is_open);
        wdt_expect_close = 0;
        return 0;
 }
 
-static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-       unsigned long arg)
+static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
-       static struct watchdog_info ident=
-       {
-               .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
+       static const struct watchdog_info ident = {
+               .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT |
+                                                       WDIOF_MAGICCLOSE,
                .firmware_version = 1,
                .identity = "SBC60xx",
        };
 
-       switch(cmd)
+       switch (cmd) {
+       case WDIOC_GETSUPPORT:
+               return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
+       case WDIOC_GETSTATUS:
+       case WDIOC_GETBOOTSTATUS:
+               return put_user(0, p);
+       case WDIOC_SETOPTIONS:
        {
-               default:
-                       return -ENOTTY;
-               case WDIOC_GETSUPPORT:
-                       return copy_to_user(argp, &ident, sizeof(ident))?-EFAULT:0;
-               case WDIOC_GETSTATUS:
-               case WDIOC_GETBOOTSTATUS:
-                       return put_user(0, p);
-               case WDIOC_KEEPALIVE:
-                       wdt_keepalive();
-                       return 0;
-               case WDIOC_SETOPTIONS:
-               {
-                       int new_options, retval = -EINVAL;
-
-                       if(get_user(new_options, p))
-                               return -EFAULT;
-
-                       if(new_options & WDIOS_DISABLECARD) {
-                               wdt_turnoff();
-                               retval = 0;
-                       }
-
-                       if(new_options & WDIOS_ENABLECARD) {
-                               wdt_startup();
-                               retval = 0;
-                       }
-
-                       return retval;
+               int new_options, retval = -EINVAL;
+               if (get_user(new_options, p))
+                       return -EFAULT;
+               if (new_options & WDIOS_DISABLECARD) {
+                       wdt_turnoff();
+                       retval = 0;
                }
-               case WDIOC_SETTIMEOUT:
-               {
-                       int new_timeout;
-
-                       if(get_user(new_timeout, p))
-                               return -EFAULT;
-
-                       if(new_timeout < 1 || new_timeout > 3600) /* arbitrary upper limit */
-                               return -EINVAL;
-
-                       timeout = new_timeout;
-                       wdt_keepalive();
-                       /* Fall through */
+               if (new_options & WDIOS_ENABLECARD) {
+                       wdt_startup();
+                       retval = 0;
                }
-               case WDIOC_GETTIMEOUT:
-                       return put_user(timeout, p);
+               return retval;
+       }
+       case WDIOC_KEEPALIVE:
+               wdt_keepalive();
+               return 0;
+       case WDIOC_SETTIMEOUT:
+       {
+               int new_timeout;
+               if (get_user(new_timeout, p))
+                       return -EFAULT;
+               /* arbitrary upper limit */
+               if (new_timeout < 1 || new_timeout > 3600)
+                       return -EINVAL;
+
+               timeout = new_timeout;
+               wdt_keepalive();
+               /* Fall through */
+       }
+       case WDIOC_GETTIMEOUT:
+               return put_user(timeout, p);
+       default:
+               return -ENOTTY;
        }
 }
 
@@ -284,7 +286,7 @@ static const struct file_operations wdt_fops = {
        .write          = fop_write,
        .open           = fop_open,
        .release        = fop_close,
-       .ioctl          = fop_ioctl,
+       .unlocked_ioctl = fop_ioctl,
 };
 
 static struct miscdevice wdt_miscdev = {
@@ -300,7 +302,7 @@ static struct miscdevice wdt_miscdev = {
 static int wdt_notify_sys(struct notifier_block *this, unsigned long code,
        void *unused)
 {
-       if(code==SYS_DOWN || code==SYS_HALT)
+       if (code == SYS_DOWN || code == SYS_HALT)
                wdt_turnoff();
        return NOTIFY_DONE;
 }
@@ -310,8 +312,7 @@ static int wdt_notify_sys(struct notifier_block *this, unsigned long code,
  *     turn the timebomb registers off.
  */
 
-static struct notifier_block wdt_notifier=
-{
+static struct notifier_block wdt_notifier = {
        .notifier_call = wdt_notify_sys,
 };
 
@@ -324,23 +325,22 @@ static void __exit sbc60xxwdt_unload(void)
 
        unregister_reboot_notifier(&wdt_notifier);
        if ((wdt_stop != 0x45) && (wdt_stop != wdt_start))
-               release_region(wdt_stop,1);
-       release_region(wdt_start,1);
+               release_region(wdt_stop, 1);
+       release_region(wdt_start, 1);
 }
 
 static int __init sbc60xxwdt_init(void)
 {
        int rc = -EBUSY;
 
-       if(timeout < 1 || timeout > 3600) /* arbitrary upper limit */
-       {
+       if (timeout < 1 || timeout > 3600) { /* arbitrary upper limit */
                timeout = WATCHDOG_TIMEOUT;
-               printk(KERN_INFO PFX "timeout value must be 1<=x<=3600, using %d\n",
-                       timeout);
-       }
+               printk(KERN_INFO PFX
+                       "timeout value must be 1 <= x <= 3600, using %d\n",
+                                                               timeout);
+       }
 
-       if (!request_region(wdt_start, 1, "SBC 60XX WDT"))
-       {
+       if (!request_region(wdt_start, 1, "SBC 60XX WDT")) {
                printk(KERN_ERR PFX "I/O address 0x%04x already in use\n",
                        wdt_start);
                rc = -EIO;
@@ -348,33 +348,30 @@ static int __init sbc60xxwdt_init(void)
        }
 
        /* We cannot reserve 0x45 - the kernel already has! */
-       if ((wdt_stop != 0x45) && (wdt_stop != wdt_start))
-       {
-               if (!request_region(wdt_stop, 1, "SBC 60XX WDT"))
-               {
-                       printk(KERN_ERR PFX "I/O address 0x%04x already in use\n",
-                               wdt_stop);
+       if (wdt_stop != 0x45 && wdt_stop != wdt_start) {
+               if (!request_region(wdt_stop, 1, "SBC 60XX WDT")) {
+                       printk(KERN_ERR PFX
+                               "I/O address 0x%04x already in use\n",
+                                                       wdt_stop);
                        rc = -EIO;
                        goto err_out_region1;
                }
        }
 
        rc = register_reboot_notifier(&wdt_notifier);
-       if (rc)
-       {
-               printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
-                       rc);
+       if (rc) {
+               printk(KERN_ERR PFX
+                       "cannot register reboot notifier (err=%d)\n", rc);
                goto err_out_region2;
        }
 
        rc = misc_register(&wdt_miscdev);
-       if (rc)
-       {
-               printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
-                       wdt_miscdev.minor, rc);
+       if (rc) {
+               printk(KERN_ERR PFX
+                       "cannot register miscdev on minor=%d (err=%d)\n",
+                                               wdt_miscdev.minor, rc);
                goto err_out_reboot;
        }
-
        printk(KERN_INFO PFX "WDT driver for 60XX single board computer initialised. timeout=%d sec (nowayout=%d)\n",
                timeout, nowayout);
 
@@ -383,10 +380,10 @@ static int __init sbc60xxwdt_init(void)
 err_out_reboot:
        unregister_reboot_notifier(&wdt_notifier);
 err_out_region2:
-       if ((wdt_stop != 0x45) && (wdt_stop != wdt_start))
-               release_region(wdt_stop,1);
+       if (wdt_stop != 0x45 && wdt_stop != wdt_start)
+               release_region(wdt_stop, 1);
 err_out_region1:
-       release_region(wdt_start,1);
+       release_region(wdt_start, 1);
 err_out:
        return rc;
 }
index 4c8cefb..67ddeb1 100644 (file)
 #include <linux/reboot.h>
 #include <linux/types.h>
 #include <linux/watchdog.h>
+#include <linux/io.h>
+#include <linux/uaccess.h>
 #include <asm/atomic.h>
-#include <asm/io.h>
 #include <asm/system.h>
-#include <asm/uaccess.h>
 
 #define SBC7240_PREFIX "sbc7240_wdt: "
 
@@ -159,7 +159,7 @@ static int fop_close(struct inode *inode, struct file *file)
        return 0;
 }
 
-static struct watchdog_info ident = {
+static const struct watchdog_info ident = {
        .options = WDIOF_KEEPALIVEPING|
                   WDIOF_SETTIMEOUT|
                   WDIOF_MAGICCLOSE,
@@ -168,50 +168,50 @@ static struct watchdog_info ident = {
 };
 
 
-static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-                    unsigned long arg)
+static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
        switch (cmd) {
        case WDIOC_GETSUPPORT:
-               return copy_to_user
-                       ((void __user *)arg, &ident, sizeof(ident))
-                        ? -EFAULT : 0;
+               return copy_to_user((void __user *)arg, &ident, sizeof(ident))
+                                                ? -EFAULT : 0;
        case WDIOC_GETSTATUS:
        case WDIOC_GETBOOTSTATUS:
                return put_user(0, (int __user *)arg);
-       case WDIOC_KEEPALIVE:
-               wdt_keepalive();
-               return 0;
-       case WDIOC_SETOPTIONS:{
-                       int options;
-                       int retval = -EINVAL;
+       case WDIOC_SETOPTIONS:
+       {
+               int options;
+               int retval = -EINVAL;
 
-                       if (get_user(options, (int __user *)arg))
-                               return -EFAULT;
+               if (get_user(options, (int __user *)arg))
+                       return -EFAULT;
 
-                       if (options & WDIOS_DISABLECARD) {
-                               wdt_disable();
-                               retval = 0;
-                       }
-
-                       if (options & WDIOS_ENABLECARD) {
-                               wdt_enable();
-                               retval = 0;
-                       }
+               if (options & WDIOS_DISABLECARD) {
+                       wdt_disable();
+                       retval = 0;
+               }
 
-                       return retval;
+               if (options & WDIOS_ENABLECARD) {
+                       wdt_enable();
+                       retval = 0;
                }
-       case WDIOC_SETTIMEOUT:{
-                       int new_timeout;
 
-                       if (get_user(new_timeout, (int __user *)arg))
-                               return -EFAULT;
+               return retval;
+       }
+       case WDIOC_KEEPALIVE:
+               wdt_keepalive();
+               return 0;
+       case WDIOC_SETTIMEOUT:
+       {
+               int new_timeout;
 
-                       if (wdt_set_timeout(new_timeout))
-                               return -EINVAL;
+               if (get_user(new_timeout, (int __user *)arg))
+                       return -EFAULT;
 
-                       /* Fall through */
-               }
+               if (wdt_set_timeout(new_timeout))
+                       return -EINVAL;
+
+               /* Fall through */
+       }
        case WDIOC_GETTIMEOUT:
                return put_user(timeout, (int __user *)arg);
        default:
@@ -225,7 +225,7 @@ static const struct file_operations wdt_fops = {
        .write = fop_write,
        .open = fop_open,
        .release = fop_close,
-       .ioctl = fop_ioctl,
+       .unlocked_ioctl = fop_ioctl,
 };
 
 static struct miscdevice wdt_miscdev = {
index 2ee2677..fd83dd0 100644 (file)
 #include <linux/init.h>
 #include <linux/spinlock.h>
 #include <linux/moduleparam.h>
+#include <linux/io.h>
+#include <linux/uaccess.h>
 
-#include <asm/io.h>
-#include <asm/uaccess.h>
 #include <asm/system.h>
 
 static unsigned long sbc8360_is_open;
-static DEFINE_SPINLOCK(sbc8360_lock);
 static char expect_close;
 
 #define PFX "sbc8360: "
@@ -204,7 +203,8 @@ module_param(timeout, int, 0);
 MODULE_PARM_DESC(timeout, "Index into timeout table (0-63) (default=27 (60s))");
 module_param(nowayout, int, 0);
 MODULE_PARM_DESC(nowayout,
-                "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+                "Watchdog cannot be stopped once started (default="
+                               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 /*
  *     Kernel methods.
@@ -231,9 +231,16 @@ static void sbc8360_ping(void)
        outb(wd_margin, SBC8360_BASETIME);
 }
 
+/* stop watchdog */
+static void sbc8360_stop(void)
+{
+       /* De-activate the watchdog */
+       outb(0, SBC8360_ENABLE);
+}
+
 /* Userspace pings kernel driver, or requests clean close */
-static ssize_t sbc8360_write(struct file *file, const char __user * buf,
-                            size_t count, loff_t * ppos)
+static ssize_t sbc8360_write(struct file *file, const char __user *buf,
+                            size_t count, loff_t *ppos)
 {
        if (count) {
                if (!nowayout) {
@@ -257,16 +264,12 @@ static ssize_t sbc8360_write(struct file *file, const char __user * buf,
 
 static int sbc8360_open(struct inode *inode, struct file *file)
 {
-       spin_lock(&sbc8360_lock);
-       if (test_and_set_bit(0, &sbc8360_is_open)) {
-               spin_unlock(&sbc8360_lock);
+       if (test_and_set_bit(0, &sbc8360_is_open))
                return -EBUSY;
-       }
        if (nowayout)
                __module_get(THIS_MODULE);
 
        /* Activate and ping once to start the countdown */
-       spin_unlock(&sbc8360_lock);
        sbc8360_activate();
        sbc8360_ping();
        return nonseekable_open(inode, file);
@@ -274,16 +277,14 @@ static int sbc8360_open(struct inode *inode, struct file *file)
 
 static int sbc8360_close(struct inode *inode, struct file *file)
 {
-       spin_lock(&sbc8360_lock);
        if (expect_close == 42)
-               outb(0, SBC8360_ENABLE);
+               sbc8360_stop();
        else
                printk(KERN_CRIT PFX
-                      "SBC8360 device closed unexpectedly.  SBC8360 will not stop!\n");
+                       "SBC8360 device closed unexpectedly.  SBC8360 will not stop!\n");
 
        clear_bit(0, &sbc8360_is_open);
        expect_close = 0;
-       spin_unlock(&sbc8360_lock);
        return 0;
 }
 
@@ -294,10 +295,9 @@ static int sbc8360_close(struct inode *inode, struct file *file)
 static int sbc8360_notify_sys(struct notifier_block *this, unsigned long code,
                              void *unused)
 {
-       if (code == SYS_DOWN || code == SYS_HALT) {
-               /* Disable the SBC8360 Watchdog */
-               outb(0, SBC8360_ENABLE);
-       }
+       if (code == SYS_DOWN || code == SYS_HALT)
+               sbc8360_stop(); /* Disable the SBC8360 Watchdog */
+
        return NOTIFY_DONE;
 }
 
@@ -382,13 +382,13 @@ static int __init sbc8360_init(void)
 
        return 0;
 
-      out_nomisc:
+out_nomisc:
        unregister_reboot_notifier(&sbc8360_notifier);
-      out_noreboot:
+out_noreboot:
        release_region(SBC8360_BASETIME, 1);
-      out_nobasetimereg:
+out_nobasetimereg:
        release_region(SBC8360_ENABLE, 1);
-      out:
+out:
        return res;
 }
 
index 82cbd88..e5e470c 100644 (file)
@@ -25,8 +25,8 @@
 #include <linux/reboot.h>
 #include <linux/init.h>
 #include <linux/ioport.h>
-#include <asm/uaccess.h>
-#include <asm/io.h>
+#include <linux/uaccess.h>
+#include <linux/io.h>
 
 #define PFX "epx_c3: "
 static int epx_c3_alive;
@@ -100,12 +100,12 @@ static ssize_t epx_c3_write(struct file *file, const char __user *data,
        return len;
 }
 
-static int epx_c3_ioctl(struct inode *inode, struct file *file,
-                       unsigned int cmd, unsigned long arg)
+static long epx_c3_ioctl(struct file *file, unsigned int cmd,
+                                               unsigned long arg)
 {
        int options, retval = -EINVAL;
        int __user *argp = (void __user *)arg;
-       static struct watchdog_info ident = {
+       static const struct watchdog_info ident = {
                .options                = WDIOF_KEEPALIVEPING |
                                          WDIOF_MAGICCLOSE,
                .firmware_version       = 0,
@@ -120,11 +120,6 @@ static int epx_c3_ioctl(struct inode *inode, struct file *file,
        case WDIOC_GETSTATUS:
        case WDIOC_GETBOOTSTATUS:
                return put_user(0, argp);
-       case WDIOC_KEEPALIVE:
-               epx_c3_pet();
-               return 0;
-       case WDIOC_GETTIMEOUT:
-               return put_user(WATCHDOG_TIMEOUT, argp);
        case WDIOC_SETOPTIONS:
                if (get_user(options, argp))
                        return -EFAULT;
@@ -140,6 +135,11 @@ static int epx_c3_ioctl(struct inode *inode, struct file *file,
                }
 
                return retval;
+       case WDIOC_KEEPALIVE:
+               epx_c3_pet();
+               return 0;
+       case WDIOC_GETTIMEOUT:
+               return put_user(WATCHDOG_TIMEOUT, argp);
        default:
                return -ENOTTY;
        }
@@ -158,7 +158,7 @@ static const struct file_operations epx_c3_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = epx_c3_write,
-       .ioctl          = epx_c3_ioctl,
+       .unlocked_ioctl = epx_c3_ioctl,
        .open           = epx_c3_open,
        .release        = epx_c3_release,
 };
index 35cddff..23da3cc 100644 (file)
  *
  *     Changelog:
  *     20020220 Zwane Mwaikambo        Code based on datasheet, no hardware.
- *     20020221 Zwane Mwaikambo        Cleanups as suggested by Jeff Garzik and Alan Cox.
+ *     20020221 Zwane Mwaikambo        Cleanups as suggested by Jeff Garzik
+ *                                     and Alan Cox.
  *     20020222 Zwane Mwaikambo        Added probing.
  *     20020225 Zwane Mwaikambo        Added ISAPNP support.
  *     20020412 Rob Radez              Broke out start/stop functions
- *              <rob@osinvestor.com>   Return proper status instead of temperature warning
- *                                     Add WDIOC_GETBOOTSTATUS and WDIOC_SETOPTIONS ioctls
+ *              <rob@osinvestor.com>   Return proper status instead of
+ *                                     temperature warning
+ *                                     Add WDIOC_GETBOOTSTATUS and
+ *                                     WDIOC_SETOPTIONS ioctls
  *                                     Fix CONFIG_WATCHDOG_NOWAYOUT
- *     20020530 Joel Becker            Add Matt Domsch's nowayout module option
+ *     20020530 Joel Becker            Add Matt Domsch's nowayout module
+ *                                     option
  *     20030116 Adam Belay             Updated to the latest pnp code
  *
  */
@@ -39,9 +43,8 @@
 #include <linux/pnp.h>
 #include <linux/fs.h>
 #include <linux/semaphore.h>
-
-#include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/io.h>
+#include <linux/uaccess.h>
 
 #define SC1200_MODULE_VER      "build 20020303"
 #define SC1200_MODULE_NAME     "sc1200wdt"
@@ -72,7 +75,7 @@ static char banner[] __initdata = KERN_INFO PFX SC1200_MODULE_VER;
 static int timeout = 1;
 static int io = -1;
 static int io_len = 2;         /* for non plug and play */
-static struct semaphore open_sem;
+static unsigned long open_flag;
 static char expect_close;
 static DEFINE_SPINLOCK(sc1200wdt_lock);        /* io port access serialisation */
 
@@ -81,7 +84,8 @@ static int isapnp = 1;
 static struct pnp_dev *wdt_dev;
 
 module_param(isapnp, int, 0);
-MODULE_PARM_DESC(isapnp, "When set to 0 driver ISA PnP support will be disabled");
+MODULE_PARM_DESC(isapnp,
+       "When set to 0 driver ISA PnP support will be disabled");
 #endif
 
 module_param(io, int, 0);
@@ -91,26 +95,40 @@ MODULE_PARM_DESC(timeout, "range is 0-255 minutes, default is 1");
 
 static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout,
+       "Watchdog cannot be stopped once started (default="
+                               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 
 
 /* Read from Data Register */
-static inline void sc1200wdt_read_data(unsigned char index, unsigned char *data)
+static inline void __sc1200wdt_read_data(unsigned char index,
+                                               unsigned char *data)
 {
-       spin_lock(&sc1200wdt_lock);
        outb_p(index, PMIR);
        *data = inb(PMDR);
-       spin_unlock(&sc1200wdt_lock);
 }
 
+static void sc1200wdt_read_data(unsigned char index, unsigned char *data)
+{
+       spin_lock(&sc1200wdt_lock);
+       __sc1200wdt_read_data(index, data);
+       spin_unlock(&sc1200wdt_lock);
+}
 
 /* Write to Data Register */
-static inline void sc1200wdt_write_data(unsigned char index, unsigned char data)
+static inline void __sc1200wdt_write_data(unsigned char index,
+                                               unsigned char data)
 {
-       spin_lock(&sc1200wdt_lock);
        outb_p(index, PMIR);
        outb(data, PMDR);
+}
+
+static inline void sc1200wdt_write_data(unsigned char index,
+                                               unsigned char data)
+{
+       spin_lock(&sc1200wdt_lock);
+       __sc1200wdt_write_data(index, data);
        spin_unlock(&sc1200wdt_lock);
 }
 
@@ -118,22 +136,23 @@ static inline void sc1200wdt_write_data(unsigned char index, unsigned char data)
 static void sc1200wdt_start(void)
 {
        unsigned char reg;
+       spin_lock(&sc1200wdt_lock);
 
-       sc1200wdt_read_data(WDCF, &reg);
+       __sc1200wdt_read_data(WDCF, &reg);
        /* assert WDO when any of the following interrupts are triggered too */
        reg |= (KBC_IRQ | MSE_IRQ | UART1_IRQ | UART2_IRQ);
-       sc1200wdt_write_data(WDCF, reg);
+       __sc1200wdt_write_data(WDCF, reg);
        /* set the timeout and get the ball rolling */
-       sc1200wdt_write_data(WDTO, timeout);
-}
+       __sc1200wdt_write_data(WDTO, timeout);
 
+       spin_unlock(&sc1200wdt_lock);
+}
 
 static void sc1200wdt_stop(void)
 {
        sc1200wdt_write_data(WDTO, 0);
 }
 
-
 /* This returns the status of the WDO signal, inactive high. */
 static inline int sc1200wdt_status(void)
 {
@@ -144,14 +163,13 @@ static inline int sc1200wdt_status(void)
         * KEEPALIVEPING which is a bit of a kludge because there's nothing
         * else for enabled/disabled status
         */
-       return (ret & 0x01) ? 0 : WDIOF_KEEPALIVEPING;  /* bits 1 - 7 are undefined */
+       return (ret & 0x01) ? 0 : WDIOF_KEEPALIVEPING;
 }
 
-
 static int sc1200wdt_open(struct inode *inode, struct file *file)
 {
        /* allow one at a time */
-       if (down_trylock(&open_sem))
+       if (test_and_set_bit(0, &open_flag))
                return -EBUSY;
 
        if (timeout > MAX_TIMEOUT)
@@ -164,71 +182,70 @@ static int sc1200wdt_open(struct inode *inode, struct file *file)
 }
 
 
-static int sc1200wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
+static long sc1200wdt_ioctl(struct file *file, unsigned int cmd,
+                                               unsigned long arg)
 {
        int new_timeout;
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
-       static struct watchdog_info ident = {
-               .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
+       static const struct watchdog_info ident = {
+               .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT |
+                                                       WDIOF_MAGICCLOSE,
                .firmware_version = 0,
                .identity = "PC87307/PC97307",
        };
 
        switch (cmd) {
-               default:
-                       return -ENOTTY;
+       case WDIOC_GETSUPPORT:
+               if (copy_to_user(argp, &ident, sizeof ident))
+                       return -EFAULT;
+               return 0;
 
-               case WDIOC_GETSUPPORT:
-                       if (copy_to_user(argp, &ident, sizeof ident))
-                               return -EFAULT;
-                       return 0;
+       case WDIOC_GETSTATUS:
+               return put_user(sc1200wdt_status(), p);
 
-               case WDIOC_GETSTATUS:
-                       return put_user(sc1200wdt_status(), p);
+       case WDIOC_GETBOOTSTATUS:
+               return put_user(0, p);
 
-               case WDIOC_GETBOOTSTATUS:
-                       return put_user(0, p);
+       case WDIOC_SETOPTIONS:
+       {
+               int options, retval = -EINVAL;
 
-               case WDIOC_KEEPALIVE:
-                       sc1200wdt_write_data(WDTO, timeout);
-                       return 0;
+               if (get_user(options, p))
+                       return -EFAULT;
 
-               case WDIOC_SETTIMEOUT:
-                       if (get_user(new_timeout, p))
-                               return -EFAULT;
-
-                       /* the API states this is given in secs */
-                       new_timeout /= 60;
-                       if (new_timeout < 0 || new_timeout > MAX_TIMEOUT)
-                               return -EINVAL;
-
-                       timeout = new_timeout;
-                       sc1200wdt_write_data(WDTO, timeout);
-                       /* fall through and return the new timeout */
-
-               case WDIOC_GETTIMEOUT:
-                       return put_user(timeout * 60, p);
-
-               case WDIOC_SETOPTIONS:
-               {
-                       int options, retval = -EINVAL;
+               if (options & WDIOS_DISABLECARD) {
+                       sc1200wdt_stop();
+                       retval = 0;
+               }
 
-                       if (get_user(options, p))
-                               return -EFAULT;
+               if (options & WDIOS_ENABLECARD) {
+                       sc1200wdt_start();
+                       retval = 0;
+               }
 
-                       if (options & WDIOS_DISABLECARD) {
-                               sc1200wdt_stop();
-                               retval = 0;
-                       }
+               return retval;
+       }
+       case WDIOC_KEEPALIVE:
+               sc1200wdt_write_data(WDTO, timeout);
+               return 0;
+
+       case WDIOC_SETTIMEOUT:
+               if (get_user(new_timeout, p))
+                       return -EFAULT;
+               /* the API states this is given in secs */
+               new_timeout /= 60;
+               if (new_timeout < 0 || new_timeout > MAX_TIMEOUT)
+                       return -EINVAL;
+               timeout = new_timeout;
+               sc1200wdt_write_data(WDTO, timeout);
+               /* fall through and return the new timeout */
 
-                       if (options & WDIOS_ENABLECARD) {
-                               sc1200wdt_start();
-                               retval = 0;
-                       }
+       case WDIOC_GETTIMEOUT:
+               return put_user(timeout * 60, p);
 
-                       return retval;
-               }
+       default:
+               return -ENOTTY;
        }
 }
 
@@ -240,16 +257,18 @@ static int sc1200wdt_release(struct inode *inode, struct file *file)
                printk(KERN_INFO PFX "Watchdog disabled\n");
        } else {
                sc1200wdt_write_data(WDTO, timeout);
-               printk(KERN_CRIT PFX "Unexpected close!, timeout = %d min(s)\n", timeout);
+               printk(KERN_CRIT PFX
+                       "Unexpected close!, timeout = %d min(s)\n", timeout);
        }
-       up(&open_sem);
+       clear_bit(0, &open_flag);
        expect_close = 0;
 
        return 0;
 }
 
 
-static ssize_t sc1200wdt_write(struct file *file, const char __user *data, size_t len, loff_t *ppos)
+static ssize_t sc1200wdt_write(struct file *file, const char __user *data,
+                                               size_t len, loff_t *ppos)
 {
        if (len) {
                if (!nowayout) {
@@ -260,7 +279,7 @@ static ssize_t sc1200wdt_write(struct file *file, const char __user *data, size_
                        for (i = 0; i != len; i++) {
                                char c;
 
-                               if (get_user(c, data+i))
+                               if (get_user(c, data + i))
                                        return -EFAULT;
                                if (c == 'V')
                                        expect_close = 42;
@@ -275,7 +294,8 @@ static ssize_t sc1200wdt_write(struct file *file, const char __user *data, size_
 }
 
 
-static int sc1200wdt_notify_sys(struct notifier_block *this, unsigned long code, void *unused)
+static int sc1200wdt_notify_sys(struct notifier_block *this,
+                                       unsigned long code, void *unused)
 {
        if (code == SYS_DOWN || code == SYS_HALT)
                sc1200wdt_stop();
@@ -284,23 +304,20 @@ static int sc1200wdt_notify_sys(struct notifier_block *this, unsigned long code,
 }
 
 
-static struct notifier_block sc1200wdt_notifier =
-{
+static struct notifier_block sc1200wdt_notifier = {
        .notifier_call =        sc1200wdt_notify_sys,
 };
 
-static const struct file_operations sc1200wdt_fops =
-{
+static const struct file_operations sc1200wdt_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = sc1200wdt_write,
-       .ioctl          = sc1200wdt_ioctl,
+       .unlocked_ioctl = sc1200wdt_ioctl,
        .open           = sc1200wdt_open,
        .release        = sc1200wdt_release,
 };
 
-static struct miscdevice sc1200wdt_miscdev =
-{
+static struct miscdevice sc1200wdt_miscdev = {
        .minor          = WATCHDOG_MINOR,
        .name           = "watchdog",
        .fops           = &sc1200wdt_fops,
@@ -312,14 +329,14 @@ static int __init sc1200wdt_probe(void)
        /* The probe works by reading the PMC3 register's default value of 0x0e
         * there is one caveat, if the device disables the parallel port or any
         * of the UARTs we won't be able to detect it.
-        * Nb. This could be done with accuracy by reading the SID registers, but
-        * we don't have access to those io regions.
+        * NB. This could be done with accuracy by reading the SID registers,
+        * but we don't have access to those io regions.
         */
 
        unsigned char reg;
 
        sc1200wdt_read_data(PMC3, &reg);
-       reg &= 0x0f;                            /* we don't want the UART busy bits */
+       reg &= 0x0f;            /* we don't want the UART busy bits */
        return (reg == 0x0e) ? 0 : -ENODEV;
 }
 
@@ -332,7 +349,8 @@ static struct pnp_device_id scl200wdt_pnp_devices[] = {
        {.id = ""},
 };
 
-static int scl200wdt_pnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id)
+static int scl200wdt_pnp_probe(struct pnp_dev *dev,
+                                       const struct pnp_device_id *dev_id)
 {
        /* this driver only supports one card at a time */
        if (wdt_dev || !isapnp)
@@ -347,13 +365,14 @@ static int scl200wdt_pnp_probe(struct pnp_dev * dev, const struct pnp_device_id
                return -EBUSY;
        }
 
-       printk(KERN_INFO "scl200wdt: PnP device found at io port %#x/%d\n", io, io_len);
+       printk(KERN_INFO "scl200wdt: PnP device found at io port %#x/%d\n",
+                                                               io, io_len);
        return 0;
 }
 
-static void scl200wdt_pnp_remove(struct pnp_dev * dev)
+static void scl200wdt_pnp_remove(struct pnp_dev *dev)
 {
-       if (wdt_dev){
+       if (wdt_dev) {
                release_region(io, io_len);
                wdt_dev = NULL;
        }
@@ -375,8 +394,6 @@ static int __init sc1200wdt_init(void)
 
        printk("%s\n", banner);
 
-       sema_init(&open_sem, 1);
-
 #if defined CONFIG_PNP
        if (isapnp) {
                ret = pnp_register_driver(&scl200wdt_pnp_driver);
@@ -410,13 +427,16 @@ static int __init sc1200wdt_init(void)
 
        ret = register_reboot_notifier(&sc1200wdt_notifier);
        if (ret) {
-               printk(KERN_ERR PFX "Unable to register reboot notifier err = %d\n", ret);
+               printk(KERN_ERR PFX
+                       "Unable to register reboot notifier err = %d\n", ret);
                goto out_io;
        }
 
        ret = misc_register(&sc1200wdt_miscdev);
        if (ret) {
-               printk(KERN_ERR PFX "Unable to register miscdev on minor %d\n", WATCHDOG_MINOR);
+               printk(KERN_ERR PFX
+                       "Unable to register miscdev on minor %d\n",
+                                                       WATCHDOG_MINOR);
                goto out_rbt;
        }
 
@@ -446,7 +466,7 @@ static void __exit sc1200wdt_exit(void)
        unregister_reboot_notifier(&sc1200wdt_notifier);
 
 #if defined CONFIG_PNP
-       if(isapnp)
+       if (isapnp)
                pnp_unregister_driver(&scl200wdt_pnp_driver);
        else
 #endif
index 2847324..a2b6c10 100644 (file)
@@ -64,9 +64,9 @@
 #include <linux/reboot.h>
 #include <linux/init.h>
 #include <linux/jiffies.h>
+#include <linux/io.h>
+#include <linux/uaccess.h>
 
-#include <asm/io.h>
-#include <asm/uaccess.h>
 #include <asm/system.h>
 
 #define OUR_NAME "sc520_wdt"
  */
 
 #define WATCHDOG_TIMEOUT 30            /* 30 sec default timeout */
-static int timeout = WATCHDOG_TIMEOUT; /* in seconds, will be multiplied by HZ to get seconds to wait for a ping */
+/* in seconds, will be multiplied by HZ to get seconds to wait for a ping */
+static int timeout = WATCHDOG_TIMEOUT;
 module_param(timeout, int, 0);
-MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (1<=timeout<=3600, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
+MODULE_PARM_DESC(timeout,
+       "Watchdog timeout in seconds. (1 <= timeout <= 3600, default="
+                               __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
 
 static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout,
+               "Watchdog cannot be stopped once started (default="
+                               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 /*
  * AMD Elan SC520 - Watchdog Timer Registers
@@ -136,8 +141,7 @@ static void wdt_timer_ping(unsigned long data)
        /* If we got a heartbeat pulse within the WDT_US_INTERVAL
         * we agree to ping the WDT
         */
-       if(time_before(jiffies, next_heartbeat))
-       {
+       if (time_before(jiffies, next_heartbeat)) {
                /* Ping the WDT */
                spin_lock(&wdt_spinlock);
                writew(0xAAAA, wdtmrctl);
@@ -146,9 +150,9 @@ static void wdt_timer_ping(unsigned long data)
 
                /* Re-set the timer interval */
                mod_timer(&timer, jiffies + WDT_INTERVAL);
-       } else {
-               printk(KERN_WARNING PFX "Heartbeat lost! Will not ping the watchdog\n");
-       }
+       } else
+               printk(KERN_WARNING PFX
+                       "Heartbeat lost! Will not ping the watchdog\n");
 }
 
 /*
@@ -162,7 +166,7 @@ static void wdt_config(int writeval)
 
        /* buy some time (ping) */
        spin_lock_irqsave(&wdt_spinlock, flags);
-       dummy=readw(wdtmrctl);  /* ensure write synchronization */
+       dummy = readw(wdtmrctl);        /* ensure write synchronization */
        writew(0xAAAA, wdtmrctl);
        writew(0x5555, wdtmrctl);
        /* unlock WDT = make WDT configuration register writable one time */
@@ -219,10 +223,11 @@ static int wdt_set_heartbeat(int t)
  *     /dev/watchdog handling
  */
 
-static ssize_t fop_write(struct file * file, const char __user * buf, size_t count, loff_t * ppos)
+static ssize_t fop_write(struct file *file, const char __user *buf,
+                                               size_t count, loff_t *ppos)
 {
        /* See if we got the magic character 'V' and reload the timer */
-       if(count) {
+       if (count) {
                if (!nowayout) {
                        size_t ofs;
 
@@ -231,25 +236,26 @@ static ssize_t fop_write(struct file * file, const char __user * buf, size_t cou
                        wdt_expect_close = 0;
 
                        /* now scan */
-                       for(ofs = 0; ofs != count; ofs++) {
+                       for (ofs = 0; ofs != count; ofs++) {
                                char c;
                                if (get_user(c, buf + ofs))
                                        return -EFAULT;
-                               if(c == 'V')
+                               if (c == 'V')
                                        wdt_expect_close = 42;
                        }
                }
 
-               /* Well, anyhow someone wrote to us, we should return that favour */
+               /* Well, anyhow someone wrote to us, we should
+                  return that favour */
                wdt_keepalive();
        }
        return count;
 }
 
-static int fop_open(struct inode * inode, struct file * file)
+static int fop_open(struct inode *inode, struct file *file)
 {
        /* Just in case we're already talking to someone... */
-       if(test_and_set_bit(0, &wdt_is_open))
+       if (test_and_set_bit(0, &wdt_is_open))
                return -EBUSY;
        if (nowayout)
                __module_get(THIS_MODULE);
@@ -259,12 +265,13 @@ static int fop_open(struct inode * inode, struct file * file)
        return nonseekable_open(inode, file);
 }
 
-static int fop_close(struct inode * inode, struct file * file)
+static int fop_close(struct inode *inode, struct file *file)
 {
-       if(wdt_expect_close == 42) {
+       if (wdt_expect_close == 42)
                wdt_turnoff();
-       } else {
-               printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
+       else {
+               printk(KERN_CRIT PFX
+                       "Unexpected close, not stopping watchdog!\n");
                wdt_keepalive();
        }
        clear_bit(0, &wdt_is_open);
@@ -272,63 +279,62 @@ static int fop_close(struct inode * inode, struct file * file)
        return 0;
 }
 
-static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-       unsigned long arg)
+static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
-       static struct watchdog_info ident = {
-               .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
+       static const struct watchdog_info ident = {
+               .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT
+                                                       | WDIOF_MAGICCLOSE,
                .firmware_version = 1,
                .identity = "SC520",
        };
 
-       switch(cmd)
+       switch (cmd) {
+       case WDIOC_GETSUPPORT:
+               return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
+       case WDIOC_GETSTATUS:
+       case WDIOC_GETBOOTSTATUS:
+               return put_user(0, p);
+       case WDIOC_SETOPTIONS:
        {
-               default:
-                       return -ENOTTY;
-               case WDIOC_GETSUPPORT:
-                       return copy_to_user(argp, &ident, sizeof(ident))?-EFAULT:0;
-               case WDIOC_GETSTATUS:
-               case WDIOC_GETBOOTSTATUS:
-                       return put_user(0, p);
-               case WDIOC_KEEPALIVE:
-                       wdt_keepalive();
-                       return 0;
-               case WDIOC_SETOPTIONS:
-               {
-                       int new_options, retval = -EINVAL;
-
-                       if(get_user(new_options, p))
-                               return -EFAULT;
-
-                       if(new_options & WDIOS_DISABLECARD) {
-                               wdt_turnoff();
-                               retval = 0;
-                       }
+               int new_options, retval = -EINVAL;
 
-                       if(new_options & WDIOS_ENABLECARD) {
-                               wdt_startup();
-                               retval = 0;
-                       }
+               if (get_user(new_options, p))
+                       return -EFAULT;
 
-                       return retval;
+               if (new_options & WDIOS_DISABLECARD) {
+                       wdt_turnoff();
+                       retval = 0;
                }
-               case WDIOC_SETTIMEOUT:
-               {
-                       int new_timeout;
 
-                       if(get_user(new_timeout, p))
-                               return -EFAULT;
+               if (new_options & WDIOS_ENABLECARD) {
+                       wdt_startup();
+                       retval = 0;
+               }
 
-                       if(wdt_set_heartbeat(new_timeout))
-                               return -EINVAL;
+               return retval;
+       }
+       case WDIOC_KEEPALIVE:
+               wdt_keepalive();
+               return 0;
+       case WDIOC_SETTIMEOUT:
+       {
+               int new_timeout;
 
-                       wdt_keepalive();
-                       /* Fall through */
-               }
-               case WDIOC_GETTIMEOUT:
-                       return put_user(timeout, p);
+               if (get_user(new_timeout, p))
+                       return -EFAULT;
+
+               if (wdt_set_heartbeat(new_timeout))
+                       return -EINVAL;
+
+               wdt_keepalive();
+               /* Fall through */
+       }
+       case WDIOC_GETTIMEOUT:
+               return put_user(timeout, p);
+       default:
+               return -ENOTTY;
        }
 }
 
@@ -338,7 +344,7 @@ static const struct file_operations wdt_fops = {
        .write          = fop_write,
        .open           = fop_open,
        .release        = fop_close,
-       .ioctl          = fop_ioctl,
+       .unlocked_ioctl = fop_ioctl,
 };
 
 static struct miscdevice wdt_miscdev = {
@@ -354,7 +360,7 @@ static struct miscdevice wdt_miscdev = {
 static int wdt_notify_sys(struct notifier_block *this, unsigned long code,
        void *unused)
 {
-       if(code==SYS_DOWN || code==SYS_HALT)
+       if (code == SYS_DOWN || code == SYS_HALT)
                wdt_turnoff();
        return NOTIFY_DONE;
 }
@@ -383,11 +389,13 @@ static int __init sc520_wdt_init(void)
 {
        int rc = -EBUSY;
 
-       /* Check that the timeout value is within it's range ; if not reset to the default */
+       /* Check that the timeout value is within it's range ;
+          if not reset to the default */
        if (wdt_set_heartbeat(timeout)) {
                wdt_set_heartbeat(WATCHDOG_TIMEOUT);
-               printk(KERN_INFO PFX "timeout value must be 1<=timeout<=3600, using %d\n",
-                       WATCHDOG_TIMEOUT);
+               printk(KERN_INFO PFX
+                   "timeout value must be 1 <= timeout <= 3600, using %d\n",
+                                                       WATCHDOG_TIMEOUT);
        }
 
        wdtmrctl = ioremap((unsigned long)(MMCR_BASE + OFFS_WDTMRCTL), 2);
@@ -399,20 +407,22 @@ static int __init sc520_wdt_init(void)
 
        rc = register_reboot_notifier(&wdt_notifier);
        if (rc) {
-               printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
-                       rc);
+               printk(KERN_ERR PFX
+                       "cannot register reboot notifier (err=%d)\n", rc);
                goto err_out_ioremap;
        }
 
        rc = misc_register(&wdt_miscdev);
        if (rc) {
-               printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
-                       WATCHDOG_MINOR, rc);
+               printk(KERN_ERR PFX
+                       "cannot register miscdev on minor=%d (err=%d)\n",
+                                                       WATCHDOG_MINOR, rc);
                goto err_out_notifier;
        }
 
-       printk(KERN_INFO PFX "WDT driver for SC520 initialised. timeout=%d sec (nowayout=%d)\n",
-               timeout,nowayout);
+       printk(KERN_INFO PFX
+          "WDT driver for SC520 initialised. timeout=%d sec (nowayout=%d)\n",
+                                                       timeout, nowayout);
 
        return 0;
 
index d55882b..9e19a10 100644 (file)
@@ -27,9 +27,8 @@
 #include <linux/fs.h>
 #include <linux/ioport.h>
 #include <linux/scx200.h>
-
-#include <asm/uaccess.h>
-#include <asm/io.h>
+#include <linux/uaccess.h>
+#include <linux/io.h>
 
 #define NAME "scx200_wdt"
 
@@ -47,8 +46,9 @@ module_param(nowayout, int, 0);
 MODULE_PARM_DESC(nowayout, "Disable watchdog shutdown on close");
 
 static u16 wdto_restart;
-static struct semaphore open_semaphore;
 static char expect_close;
+static unsigned long open_lock;
+static DEFINE_SPINLOCK(scx_lock);
 
 /* Bits of the WDCNFG register */
 #define W_ENABLE 0x00fa                /* Enable watchdog */
@@ -59,7 +59,9 @@ static char expect_close;
 
 static void scx200_wdt_ping(void)
 {
+       spin_lock(&scx_lock);
        outw(wdto_restart, scx200_cb_base + SCx200_WDT_WDTO);
+       spin_unlock(&scx_lock);
 }
 
 static void scx200_wdt_update_margin(void)
@@ -73,9 +75,11 @@ static void scx200_wdt_enable(void)
        printk(KERN_DEBUG NAME ": enabling watchdog timer, wdto_restart = %d\n",
               wdto_restart);
 
+       spin_lock(&scx_lock);
        outw(0, scx200_cb_base + SCx200_WDT_WDTO);
        outb(SCx200_WDT_WDSTS_WDOVF, scx200_cb_base + SCx200_WDT_WDSTS);
        outw(W_ENABLE, scx200_cb_base + SCx200_WDT_WDCNFG);
+       spin_unlock(&scx_lock);
 
        scx200_wdt_ping();
 }
@@ -84,15 +88,17 @@ static void scx200_wdt_disable(void)
 {
        printk(KERN_DEBUG NAME ": disabling watchdog timer\n");
 
+       spin_lock(&scx_lock);
        outw(0, scx200_cb_base + SCx200_WDT_WDTO);
        outb(SCx200_WDT_WDSTS_WDOVF, scx200_cb_base + SCx200_WDT_WDSTS);
        outw(W_DISABLE, scx200_cb_base + SCx200_WDT_WDCNFG);
+       spin_unlock(&scx_lock);
 }
 
 static int scx200_wdt_open(struct inode *inode, struct file *file)
 {
        /* only allow one at a time */
-       if (down_trylock(&open_semaphore))
+       if (test_and_set_bit(0, &open_lock))
                return -EBUSY;
        scx200_wdt_enable();
 
@@ -101,13 +107,12 @@ static int scx200_wdt_open(struct inode *inode, struct file *file)
 
 static int scx200_wdt_release(struct inode *inode, struct file *file)
 {
-       if (expect_close != 42) {
+       if (expect_close != 42)
                printk(KERN_WARNING NAME ": watchdog device closed unexpectedly, will not disable the watchdog timer\n");
-       } else if (!nowayout) {
+       else if (!nowayout)
                scx200_wdt_disable();
-       }
        expect_close = 0;
-       up(&open_semaphore);
+       clear_bit(0, &open_lock);
 
        return 0;
 }
@@ -122,8 +127,7 @@ static int scx200_wdt_notify_sys(struct notifier_block *this,
        return NOTIFY_DONE;
 }
 
-static struct notifier_block scx200_wdt_notifier =
-{
+static struct notifier_block scx200_wdt_notifier = {
        .notifier_call = scx200_wdt_notify_sys,
 };
 
@@ -131,8 +135,7 @@ static ssize_t scx200_wdt_write(struct file *file, const char __user *data,
                                     size_t len, loff_t *ppos)
 {
        /* check for a magic close character */
-       if (len)
-       {
+       if (len) {
                size_t i;
 
                scx200_wdt_ping();
@@ -140,7 +143,7 @@ static ssize_t scx200_wdt_write(struct file *file, const char __user *data,
                expect_close = 0;
                for (i = 0; i < len; ++i) {
                        char c;
-                       if (get_user(c, data+i))
+                       if (get_user(c, data + i))
                                return -EFAULT;
                        if (c == 'V')
                                expect_close = 42;
@@ -152,23 +155,21 @@ static ssize_t scx200_wdt_write(struct file *file, const char __user *data,
        return 0;
 }
 
-static int scx200_wdt_ioctl(struct inode *inode, struct file *file,
-       unsigned int cmd, unsigned long arg)
+static long scx200_wdt_ioctl(struct file *file, unsigned int cmd,
+                                                       unsigned long arg)
 {
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
-       static struct watchdog_info ident = {
+       static const struct watchdog_info ident = {
                .identity = "NatSemi SCx200 Watchdog",
                .firmware_version = 1,
-               .options = (WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING),
+               .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
        };
        int new_margin;
 
        switch (cmd) {
-       default:
-               return -ENOTTY;
        case WDIOC_GETSUPPORT:
-               if(copy_to_user(argp, &ident, sizeof(ident)))
+               if (copy_to_user(argp, &ident, sizeof(ident)))
                        return -EFAULT;
                return 0;
        case WDIOC_GETSTATUS:
@@ -191,22 +192,24 @@ static int scx200_wdt_ioctl(struct inode *inode, struct file *file,
                if (put_user(margin, p))
                        return -EFAULT;
                return 0;
+       default:
+               return -ENOTTY;
        }
 }
 
 static const struct file_operations scx200_wdt_fops = {
-       .owner   = THIS_MODULE,
-       .llseek  = no_llseek,
-       .write   = scx200_wdt_write,
-       .ioctl   = scx200_wdt_ioctl,
-       .open    = scx200_wdt_open,
+       .owner = THIS_MODULE,
+       .llseek = no_llseek,
+       .write = scx200_wdt_write,
+       .unlocked_ioctl = scx200_wdt_ioctl,
+       .open = scx200_wdt_open,
        .release = scx200_wdt_release,
 };
 
 static struct miscdevice scx200_wdt_miscdev = {
        .minor = WATCHDOG_MINOR,
-       .name  = "watchdog",
-       .fops  = &scx200_wdt_fops,
+       .name = "watchdog",
+       .fops = &scx200_wdt_fops,
 };
 
 static int __init scx200_wdt_init(void)
@@ -229,8 +232,6 @@ static int __init scx200_wdt_init(void)
        scx200_wdt_update_margin();
        scx200_wdt_disable();
 
-       sema_init(&open_semaphore, 1);
-
        r = register_reboot_notifier(&scx200_wdt_notifier);
        if (r) {
                printk(KERN_ERR NAME ": unable to register reboot notifier");
@@ -263,7 +264,7 @@ module_exit(scx200_wdt_cleanup);
 
 /*
     Local variables:
-        compile-command: "make -k -C ../.. SUBDIRS=drivers/char modules"
-        c-basic-offset: 8
+       compile-command: "make -k -C ../.. SUBDIRS=drivers/char modules"
+       c-basic-offset: 8
     End:
 */
index 1277f7e..824125a 100644 (file)
@@ -28,9 +28,9 @@
 #include <linux/ioport.h>
 #include <linux/fs.h>
 #include <linux/mm.h>
-#include <asm/io.h>
-#include <asm/uaccess.h>
-#include <asm/watchdog.h>
+#include <linux/io.h>
+#include <linux/uaccess.h>
+#include <linux/watchdog.h>
 
 #define PFX "shwdt: "
 
@@ -72,6 +72,7 @@ static struct watchdog_info sh_wdt_info;
 static char shwdt_expect_close;
 static DEFINE_TIMER(timer, sh_wdt_ping, 0, 0);
 static unsigned long next_heartbeat;
+static DEFINE_SPINLOCK(shwdt_lock);
 
 #define WATCHDOG_HEARTBEAT 30                  /* 30 sec default heartbeat */
 static int heartbeat = WATCHDOG_HEARTBEAT;     /* in seconds */
@@ -86,6 +87,9 @@ static int nowayout = WATCHDOG_NOWAYOUT;
 static void sh_wdt_start(void)
 {
        __u8 csr;
+       unsigned long flags;
+
+       spin_lock_irqsave(&wdt_lock, flags);
 
        next_heartbeat = jiffies + (heartbeat * HZ);
        mod_timer(&timer, next_ping_period(clock_division_ratio));
@@ -123,6 +127,7 @@ static void sh_wdt_start(void)
        csr &= ~RSTCSR_RSTS;
        sh_wdt_write_rstcsr(csr);
 #endif
+       spin_unlock_irqrestore(&wdt_lock, flags);
 }
 
 /**
@@ -132,12 +137,16 @@ static void sh_wdt_start(void)
 static void sh_wdt_stop(void)
 {
        __u8 csr;
+       unsigned long flags;
+
+       spin_lock_irqsave(&wdt_lock, flags);
 
        del_timer(&timer);
 
        csr = sh_wdt_read_csr();
        csr &= ~WTCSR_TME;
        sh_wdt_write_csr(csr);
+       spin_unlock_irqrestore(&wdt_lock, flags);
 }
 
 /**
@@ -146,7 +155,11 @@ static void sh_wdt_stop(void)
  */
 static inline void sh_wdt_keepalive(void)
 {
+       unsigned long flags;
+
+       spin_lock_irqsave(&wdt_lock, flags);
        next_heartbeat = jiffies + (heartbeat * HZ);
+       spin_unlock_irqrestore(&wdt_lock, flags);
 }
 
 /**
@@ -155,10 +168,14 @@ static inline void sh_wdt_keepalive(void)
  */
 static int sh_wdt_set_heartbeat(int t)
 {
-       if (unlikely((t < 1) || (t > 3600))) /* arbitrary upper limit */
+       unsigned long flags;
+
+       if (unlikely(t < 1 || t > 3600)) /* arbitrary upper limit */
                return -EINVAL;
 
+       spin_lock_irqsave(&wdt_lock, flags);
        heartbeat = t;
+       spin_unlock_irqrestore(&wdt_lock, flags);
        return 0;
 }
 
@@ -170,6 +187,9 @@ static int sh_wdt_set_heartbeat(int t)
  */
 static void sh_wdt_ping(unsigned long data)
 {
+       unsigned long flags;
+
+       spin_lock_irqsave(&wdt_lock, flags);
        if (time_before(jiffies, next_heartbeat)) {
                __u8 csr;
 
@@ -183,6 +203,7 @@ static void sh_wdt_ping(unsigned long data)
        } else
                printk(KERN_WARNING PFX "Heartbeat lost! Will not ping "
                       "the watchdog\n");
+       spin_unlock_irqrestore(&wdt_lock, flags);
 }
 
 /**
@@ -310,7 +331,6 @@ static int sh_wdt_mmap(struct file *file, struct vm_area_struct *vma)
 
 /**
  *     sh_wdt_ioctl - Query Device
- *     @inode: inode of device
  *     @file: file handle of device
  *     @cmd: watchdog command
  *     @arg: argument
@@ -318,53 +338,51 @@ static int sh_wdt_mmap(struct file *file, struct vm_area_struct *vma)
  *     Query basic information from the device or ping it, as outlined by the
  *     watchdog API.
  */
-static int sh_wdt_ioctl(struct inode *inode, struct file *file,
-                       unsigned int cmd, unsigned long arg)
+static long sh_wdt_ioctl(struct file *file, unsigned int cmd,
+                                                       unsigned long arg)
 {
        int new_heartbeat;
        int options, retval = -EINVAL;
 
        switch (cmd) {
-               case WDIOC_GETSUPPORT:
-                       return copy_to_user((struct watchdog_info *)arg,
-                                         &sh_wdt_info,
-                                         sizeof(sh_wdt_info)) ? -EFAULT : 0;
-               case WDIOC_GETSTATUS:
-               case WDIOC_GETBOOTSTATUS:
-                       return put_user(0, (int *)arg);
-               case WDIOC_KEEPALIVE:
-                       sh_wdt_keepalive();
-                       return 0;
-               case WDIOC_SETTIMEOUT:
-                       if (get_user(new_heartbeat, (int *)arg))
-                               return -EFAULT;
-
-                       if (sh_wdt_set_heartbeat(new_heartbeat))
-                               return -EINVAL;
-
-                       sh_wdt_keepalive();
-                       /* Fall */
-               case WDIOC_GETTIMEOUT:
-                       return put_user(heartbeat, (int *)arg);
-               case WDIOC_SETOPTIONS:
-                       if (get_user(options, (int *)arg))
-                               return -EFAULT;
-
-                       if (options & WDIOS_DISABLECARD) {
-                               sh_wdt_stop();
-                               retval = 0;
-                       }
+       case WDIOC_GETSUPPORT:
+               return copy_to_user((struct watchdog_info *)arg,
+                         &sh_wdt_info, sizeof(sh_wdt_info)) ? -EFAULT : 0;
+       case WDIOC_GETSTATUS:
+       case WDIOC_GETBOOTSTATUS:
+               return put_user(0, (int *)arg);
+       case WDIOC_SETOPTIONS:
+               if (get_user(options, (int *)arg))
+                       return -EFAULT;
+
+               if (options & WDIOS_DISABLECARD) {
+                       sh_wdt_stop();
+                       retval = 0;
+               }
 
-                       if (options & WDIOS_ENABLECARD) {
-                               sh_wdt_start();
-                               retval = 0;
-                       }
+               if (options & WDIOS_ENABLECARD) {
+                       sh_wdt_start();
+                       retval = 0;
+               }
 
-                       return retval;
-               default:
-                       return -ENOTTY;
-       }
+               return retval;
+       case WDIOC_KEEPALIVE:
+               sh_wdt_keepalive();
+               return 0;
+       case WDIOC_SETTIMEOUT:
+               if (get_user(new_heartbeat, (int *)arg))
+                       return -EFAULT;
+
+               if (sh_wdt_set_heartbeat(new_heartbeat))
+                       return -EINVAL;
 
+               sh_wdt_keepalive();
+               /* Fall */
+       case WDIOC_GETTIMEOUT:
+               return put_user(heartbeat, (int *)arg);
+       default:
+               return -ENOTTY;
+       }
        return 0;
 }
 
@@ -390,13 +408,13 @@ static const struct file_operations sh_wdt_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = sh_wdt_write,
-       .ioctl          = sh_wdt_ioctl,
+       .unlocked_ioctl = sh_wdt_ioctl,
        .open           = sh_wdt_open,
        .release        = sh_wdt_close,
        .mmap           = sh_wdt_mmap,
 };
 
-static struct watchdog_info sh_wdt_info = {
+static const struct watchdog_info sh_wdt_info = {
        .options                = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT |
                                  WDIOF_MAGICCLOSE,
        .firmware_version       = 1,
@@ -422,30 +440,33 @@ static int __init sh_wdt_init(void)
 {
        int rc;
 
-       if ((clock_division_ratio < 0x5) || (clock_division_ratio > 0x7)) {
+       if (clock_division_ratio < 0x5 || clock_division_ratio > 0x7) {
                clock_division_ratio = WTCSR_CKS_4096;
-               printk(KERN_INFO PFX "clock_division_ratio value must "
-                      "be 0x5<=x<=0x7, using %d\n", clock_division_ratio);
+               printk(KERN_INFO PFX
+                 "clock_division_ratio value must be 0x5<=x<=0x7, using %d\n",
+                               clock_division_ratio);
        }
 
        rc = sh_wdt_set_heartbeat(heartbeat);
        if (unlikely(rc)) {
                heartbeat = WATCHDOG_HEARTBEAT;
-               printk(KERN_INFO PFX "heartbeat value must "
-                      "be 1<=x<=3600, using %d\n", heartbeat);
+               printk(KERN_INFO PFX
+                       "heartbeat value must be 1<=x<=3600, using %d\n",
+                                                               heartbeat);
        }
 
        rc = register_reboot_notifier(&sh_wdt_notifier);
        if (unlikely(rc)) {
-               printk(KERN_ERR PFX "Can't register reboot notifier (err=%d)\n",
-                      rc);
+               printk(KERN_ERR PFX
+                       "Can't register reboot notifier (err=%d)\n", rc);
                return rc;
        }
 
        rc = misc_register(&sh_wdt_miscdev);
        if (unlikely(rc)) {
-               printk(KERN_ERR PFX "Can't register miscdev on "
-                      "minor=%d (err=%d)\n", sh_wdt_miscdev.minor, rc);
+               printk(KERN_ERR PFX
+                       "Can't register miscdev on minor=%d (err=%d)\n",
+                                               sh_wdt_miscdev.minor, rc);
                unregister_reboot_notifier(&sh_wdt_notifier);
                return rc;
        }
@@ -476,10 +497,14 @@ module_param(clock_division_ratio, int, 0);
 MODULE_PARM_DESC(clock_division_ratio, "Clock division ratio. Valid ranges are from 0x5 (1.31ms) to 0x7 (5.25ms). (default=" __MODULE_STRING(clock_division_ratio) ")");
 
 module_param(heartbeat, int, 0);
-MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (1<=heartbeat<=3600, default=" __MODULE_STRING(WATCHDOG_HEARTBEAT) ")");
+MODULE_PARM_DESC(heartbeat,
+       "Watchdog heartbeat in seconds. (1 <= heartbeat <= 3600, default="
+                               __MODULE_STRING(WATCHDOG_HEARTBEAT) ")");
 
 module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout,
+       "Watchdog cannot be stopped once started (default="
+                               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 module_init(sh_wdt_init);
 module_exit(sh_wdt_exit);
index 5d2b5ba..988ff1d 100644 (file)
@@ -18,7 +18,7 @@
  *  History:
  *     2003 - Created version 1.0 for Linux 2.4.x.
  *     2006 - Ported to Linux 2.6, added nowayout and MAGICCLOSE
- *             features. Released version 1.1
+ *            features. Released version 1.1
  *
  *  Theory of operation:
  *
@@ -55,9 +55,9 @@
 #include <linux/reboot.h>
 #include <linux/init.h>
 #include <linux/spinlock.h>
+#include <linux/io.h>
+#include <linux/uaccess.h>
 
-#include <asm/io.h>
-#include <asm/uaccess.h>
 #include <asm/system.h>
 
 /* enable support for minutes as units? */
 #define UNIT_MINUTE     1
 
 #define MODNAME                "smsc37b787_wdt: "
-#define VERSION         "1.1"
+#define VERSION                "1.1"
 
-#define IOPORT          0x3F0
+#define IOPORT         0x3F0
 #define IOPORT_SIZE     2
-#define IODEV_NO        8
+#define IODEV_NO       8
 
-static int unit = UNIT_SECOND;  /* timer's unit */
-static int timeout = 60;        /* timeout value: default is 60 "units" */
-static unsigned long timer_enabled = 0;   /* is the timer enabled? */
+static int unit = UNIT_SECOND; /* timer's unit */
+static int timeout = 60;       /* timeout value: default is 60 "units" */
+static unsigned long timer_enabled;   /* is the timer enabled? */
 
 static char expect_close;       /* is the close expected? */
 
@@ -93,114 +93,121 @@ static int nowayout = WATCHDOG_NOWAYOUT;
 
 static inline void open_io_config(void)
 {
-        outb(0x55, IOPORT);
+       outb(0x55, IOPORT);
        mdelay(1);
-        outb(0x55, IOPORT);
+       outb(0x55, IOPORT);
 }
 
 /* lock the IO chip */
 static inline void close_io_config(void)
 {
-        outb(0xAA, IOPORT);
+       outb(0xAA, IOPORT);
 }
 
 /* select the IO device */
 static inline void select_io_device(unsigned char devno)
 {
-        outb(0x07, IOPORT);
-        outb(devno, IOPORT+1);
+       outb(0x07, IOPORT);
+       outb(devno, IOPORT+1);
 }
 
 /* write to the control register */
 static inline void write_io_cr(unsigned char reg, unsigned char data)
 {
-        outb(reg, IOPORT);
-        outb(data, IOPORT+1);
+       outb(reg, IOPORT);
+       outb(data, IOPORT+1);
 }
 
 /* read from the control register */
 static inline char read_io_cr(unsigned char reg)
 {
-        outb(reg, IOPORT);
-        return inb(IOPORT+1);
+       outb(reg, IOPORT);
+       return inb(IOPORT+1);
 }
 
 /* -- Medium level functions ------------------------------------*/
 
 static inline void gpio_bit12(unsigned char reg)
 {
-       // -- General Purpose I/O Bit 1.2 --
-       // Bit 0,   In/Out: 0 = Output, 1 = Input
-       // Bit 1,   Polarity: 0 = No Invert, 1 = Invert
-       // Bit 2,   Group Enable Intr.: 0 = Disable, 1 = Enable
-       // Bit 3/4, Function select: 00 = GPI/O, 01 = WDT, 10 = P17,
-       //                           11 = Either Edge Triggered Intr. 2
-        // Bit 5/6  (Reserved)
-       // Bit 7,   Output Type: 0 = Push Pull Bit, 1 = Open Drain
-        write_io_cr(0xE2, reg);
+       /* -- General Purpose I/O Bit 1.2 --
+        * Bit 0,   In/Out: 0 = Output, 1 = Input
+        * Bit 1,   Polarity: 0 = No Invert, 1 = Invert
+        * Bit 2,   Group Enable Intr.: 0 = Disable, 1 = Enable
+        * Bit 3/4, Function select: 00 = GPI/O, 01 = WDT, 10 = P17,
+        *                           11 = Either Edge Triggered Intr. 2
+        * Bit 5/6  (Reserved)
+        * Bit 7,   Output Type: 0 = Push Pull Bit, 1 = Open Drain
+        */
+       write_io_cr(0xE2, reg);
 }
 
 static inline void gpio_bit13(unsigned char reg)
 {
-       // -- General Purpose I/O Bit 1.3 --
-       // Bit 0,  In/Out: 0 = Output, 1 = Input
-       // Bit 1,  Polarity: 0 = No Invert, 1 = Invert
-       // Bit 2,  Group Enable Intr.: 0 = Disable, 1 = Enable
-       // Bit 3,  Function select: 0 = GPI/O, 1 = LED
-        // Bit 4-6 (Reserved)
-       // Bit 7,  Output Type: 0 = Push Pull Bit, 1 = Open Drain
-        write_io_cr(0xE3, reg);
+       /* -- General Purpose I/O Bit 1.3 --
+        * Bit 0,  In/Out: 0 = Output, 1 = Input
+        * Bit 1,  Polarity: 0 = No Invert, 1 = Invert
+        * Bit 2,  Group Enable Intr.: 0 = Disable, 1 = Enable
+        * Bit 3,  Function select: 0 = GPI/O, 1 = LED
+        * Bit 4-6 (Reserved)
+        * Bit 7,  Output Type: 0 = Push Pull Bit, 1 = Open Drain
+        */
+       write_io_cr(0xE3, reg);
 }
 
 static inline void wdt_timer_units(unsigned char new_units)
 {
-       // -- Watchdog timer units --
-       // Bit 0-6 (Reserved)
-       // Bit 7,  WDT Time-out Value Units Select
-       //         (0 = Minutes, 1 = Seconds)
-        write_io_cr(0xF1, new_units);
+       /* -- Watchdog timer units --
+        * Bit 0-6 (Reserved)
+        * Bit 7,  WDT Time-out Value Units Select
+        *         (0 = Minutes, 1 = Seconds)
+        */
+       write_io_cr(0xF1, new_units);
 }
 
 static inline void wdt_timeout_value(unsigned char new_timeout)
 {
-       // -- Watchdog Timer Time-out Value --
-       // Bit 0-7 Binary coded units (0=Disabled, 1..255)
-        write_io_cr(0xF2, new_timeout);
+       /* -- Watchdog Timer Time-out Value --
+        * Bit 0-7 Binary coded units (0=Disabled, 1..255)
+        */
+       write_io_cr(0xF2, new_timeout);
 }
 
 static inline void wdt_timer_conf(unsigned char conf)
 {
-       // -- Watchdog timer configuration --
-       // Bit 0   Joystick enable: 0* = No Reset, 1 = Reset WDT upon Gameport I/O
-       // Bit 1   Keyboard enable: 0* = No Reset, 1 = Reset WDT upon KBD Intr.
-       // Bit 2   Mouse enable: 0* = No Reset, 1 = Reset WDT upon Mouse Intr.
-        // Bit 3   Reset the timer
-        //         (Wrong in SMsC documentation? Given as: PowerLED Timout Enabled)
-       // Bit 4-7 WDT Interrupt Mapping: (0000* = Disabled,
-       //            0001=IRQ1, 0010=(Invalid), 0011=IRQ3 to 1111=IRQ15)
-        write_io_cr(0xF3, conf);
+       /* -- Watchdog timer configuration --
+        * Bit 0   Joystick enable: 0* = No Reset, 1 = Reset WDT upon
+        *                                                      Gameport I/O
+        * Bit 1   Keyboard enable: 0* = No Reset, 1 = Reset WDT upon KBD Intr.
+        * Bit 2   Mouse enable: 0* = No Reset, 1 = Reset WDT upon Mouse Intr
+        * Bit 3   Reset the timer
+        *         (Wrong in SMsC documentation? Given as: PowerLED Timout
+        *                                                      Enabled)
+        * Bit 4-7 WDT Interrupt Mapping: (0000* = Disabled,
+        *            0001=IRQ1, 0010=(Invalid), 0011=IRQ3 to 1111=IRQ15)
+        */
+       write_io_cr(0xF3, conf);
 }
 
 static inline void wdt_timer_ctrl(unsigned char reg)
 {
-       // -- Watchdog timer control --
-       // Bit 0   Status Bit: 0 = Timer counting, 1 = Timeout occured
-       // Bit 1   Power LED Toggle: 0 = Disable Toggle, 1 = Toggle at 1 Hz
-       // Bit 2   Force Timeout: 1 = Forces WD timeout event (self-cleaning)
-       // Bit 3   P20 Force Timeout enabled:
-       //          0 = P20 activity does not generate the WD timeout event
-       //          1 = P20 Allows rising edge of P20, from the keyboard
-       //              controller, to force the WD timeout event.
-       // Bit 4   (Reserved)
-       // -- Soft power management --
-       // Bit 5   Stop Counter: 1 = Stop software power down counter
-       //            set via register 0xB8, (self-cleaning)
-       //            (Upon read: 0 = Counter running, 1 = Counter stopped)
-       // Bit 6   Restart Counter: 1 = Restart software power down counter
-       //            set via register 0xB8, (self-cleaning)
-       // Bit 7   SPOFF: 1 = Force software power down (self-cleaning)
-
-        write_io_cr(0xF4, reg);
+       /* -- Watchdog timer control --
+        * Bit 0   Status Bit: 0 = Timer counting, 1 = Timeout occured
+        * Bit 1   Power LED Toggle: 0 = Disable Toggle, 1 = Toggle at 1 Hz
+        * Bit 2   Force Timeout: 1 = Forces WD timeout event (self-cleaning)
+        * Bit 3   P20 Force Timeout enabled:
+        *          0 = P20 activity does not generate the WD timeout event
+        *          1 = P20 Allows rising edge of P20, from the keyboard
+        *              controller, to force the WD timeout event.
+        * Bit 4   (Reserved)
+        * -- Soft power management --
+        * Bit 5   Stop Counter: 1 = Stop software power down counter
+        *            set via register 0xB8, (self-cleaning)
+        *            (Upon read: 0 = Counter running, 1 = Counter stopped)
+        * Bit 6   Restart Counter: 1 = Restart software power down counter
+        *            set via register 0xB8, (self-cleaning)
+        * Bit 7   SPOFF: 1 = Force software power down (self-cleaning)
+        */
+       write_io_cr(0xF4, reg);
 }
 
 /* -- Higher level functions ------------------------------------*/
@@ -209,33 +216,34 @@ static inline void wdt_timer_ctrl(unsigned char reg)
 
 static void wb_smsc_wdt_initialize(void)
 {
-        unsigned char old;
+       unsigned char old;
 
        spin_lock(&io_lock);
-        open_io_config();
-        select_io_device(IODEV_NO);
+       open_io_config();
+       select_io_device(IODEV_NO);
 
-       // enable the watchdog
-       gpio_bit13(0x08);  // Select pin 80 = LED not GPIO
-       gpio_bit12(0x0A);  // Set pin 79 = WDT not GPIO/Output/Polarity=Invert
+       /* enable the watchdog */
+       gpio_bit13(0x08);  /* Select pin 80 = LED not GPIO */
+       gpio_bit12(0x0A);  /* Set pin 79 = WDT not
+                             GPIO/Output/Polarity=Invert */
+       /* disable the timeout */
+       wdt_timeout_value(0);
 
-       // disable the timeout
-        wdt_timeout_value(0);
+       /* reset control register */
+       wdt_timer_ctrl(0x00);
 
-       // reset control register
-        wdt_timer_ctrl(0x00);
-
-       // reset configuration register
+       /* reset configuration register */
        wdt_timer_conf(0x00);
 
-       // read old (timer units) register
-        old = read_io_cr(0xF1) & 0x7F;
-        if (unit == UNIT_SECOND) old |= 0x80; // set to seconds
+       /* read old (timer units) register */
+       old = read_io_cr(0xF1) & 0x7F;
+       if (unit == UNIT_SECOND)
+               old |= 0x80;    /* set to seconds */
 
-       // set the watchdog timer units
-        wdt_timer_units(old);
+       /* set the watchdog timer units */
+       wdt_timer_units(old);
 
-        close_io_config();
+       close_io_config();
        spin_unlock(&io_lock);
 }
 
@@ -244,23 +252,23 @@ static void wb_smsc_wdt_initialize(void)
 static void wb_smsc_wdt_shutdown(void)
 {
        spin_lock(&io_lock);
-        open_io_config();
-        select_io_device(IODEV_NO);
+       open_io_config();
+       select_io_device(IODEV_NO);
 
-       // disable the watchdog
-        gpio_bit13(0x09);
-        gpio_bit12(0x09);
+       /* disable the watchdog */
+       gpio_bit13(0x09);
+       gpio_bit12(0x09);
 
-       // reset watchdog config register
+       /* reset watchdog config register */
        wdt_timer_conf(0x00);
 
-       // reset watchdog control register
-        wdt_timer_ctrl(0x00);
+       /* reset watchdog control register */
+       wdt_timer_ctrl(0x00);
 
-       // disable timeout
-        wdt_timeout_value(0x00);
+       /* disable timeout */
+       wdt_timeout_value(0x00);
 
-        close_io_config();
+       close_io_config();
        spin_unlock(&io_lock);
 }
 
@@ -269,16 +277,16 @@ static void wb_smsc_wdt_shutdown(void)
 static void wb_smsc_wdt_set_timeout(unsigned char new_timeout)
 {
        spin_lock(&io_lock);
-        open_io_config();
-        select_io_device(IODEV_NO);
+       open_io_config();
+       select_io_device(IODEV_NO);
 
-       // set Power LED to blink, if we enable the timeout
-        wdt_timer_ctrl((new_timeout == 0) ? 0x00 : 0x02);
+       /* set Power LED to blink, if we enable the timeout */
+       wdt_timer_ctrl((new_timeout == 0) ? 0x00 : 0x02);
 
-       // set timeout value
-        wdt_timeout_value(new_timeout);
+       /* set timeout value */
+       wdt_timeout_value(new_timeout);
 
-        close_io_config();
+       close_io_config();
        spin_unlock(&io_lock);
 }
 
@@ -286,32 +294,32 @@ static void wb_smsc_wdt_set_timeout(unsigned char new_timeout)
 
 static unsigned char wb_smsc_wdt_get_timeout(void)
 {
-        unsigned char set_timeout;
+       unsigned char set_timeout;
 
        spin_lock(&io_lock);
-        open_io_config();
-        select_io_device(IODEV_NO);
-        set_timeout = read_io_cr(0xF2);
-        close_io_config();
+       open_io_config();
+       select_io_device(IODEV_NO);
+       set_timeout = read_io_cr(0xF2);
+       close_io_config();
        spin_unlock(&io_lock);
 
-        return set_timeout;
+       return set_timeout;
 }
 
 /* disable watchdog */
 
 static void wb_smsc_wdt_disable(void)
 {
-        // set the timeout to 0 to disable the watchdog
-        wb_smsc_wdt_set_timeout(0);
+       /* set the timeout to 0 to disable the watchdog */
+       wb_smsc_wdt_set_timeout(0);
 }
 
 /* enable watchdog by setting the current timeout */
 
 static void wb_smsc_wdt_enable(void)
 {
-        // set the current timeout...
-        wb_smsc_wdt_set_timeout(timeout);
+       /* set the current timeout... */
+       wb_smsc_wdt_set_timeout(timeout);
 }
 
 /* reset the timer */
@@ -319,14 +327,14 @@ static void wb_smsc_wdt_enable(void)
 static void wb_smsc_wdt_reset_timer(void)
 {
        spin_lock(&io_lock);
-        open_io_config();
-        select_io_device(IODEV_NO);
+       open_io_config();
+       select_io_device(IODEV_NO);
 
-       // reset the timer
+       /* reset the timer */
        wdt_timeout_value(timeout);
        wdt_timer_conf(0x08);
 
-        close_io_config();
+       close_io_config();
        spin_unlock(&io_lock);
 }
 
@@ -355,7 +363,9 @@ static int wb_smsc_wdt_open(struct inode *inode, struct file *file)
        /* Reload and activate timer */
        wb_smsc_wdt_enable();
 
-       printk(KERN_INFO MODNAME "Watchdog enabled. Timeout set to %d %s.\n", timeout, (unit == UNIT_SECOND) ? "second(s)" : "minute(s)");
+       printk(KERN_INFO MODNAME
+               "Watchdog enabled. Timeout set to %d %s.\n",
+               timeout, (unit == UNIT_SECOND) ? "second(s)" : "minute(s)");
 
        return nonseekable_open(inode, file);
 }
@@ -367,10 +377,12 @@ static int wb_smsc_wdt_release(struct inode *inode, struct file *file)
        /* Shut off the timer. */
 
        if (expect_close == 42) {
-               wb_smsc_wdt_disable();
-               printk(KERN_INFO MODNAME "Watchdog disabled, sleeping again...\n");
+               wb_smsc_wdt_disable();
+               printk(KERN_INFO MODNAME
+                               "Watchdog disabled, sleeping again...\n");
        } else {
-               printk(KERN_CRIT MODNAME "Unexpected close, not stopping watchdog!\n");
+               printk(KERN_CRIT MODNAME
+                               "Unexpected close, not stopping watchdog!\n");
                wb_smsc_wdt_reset_timer();
        }
 
@@ -392,10 +404,11 @@ static ssize_t wb_smsc_wdt_write(struct file *file, const char __user *data,
                        /* reset expect flag */
                        expect_close = 0;
 
-                       /* scan to see whether or not we got the magic character */
+                       /* scan to see whether or not we got the
+                          magic character */
                        for (i = 0; i != len; i++) {
                                char c;
-                               if (get_user(c, data+i))
+                               if (get_user(c, data + i))
                                        return -EFAULT;
                                if (c == 'V')
                                        expect_close = 42;
@@ -410,8 +423,8 @@ static ssize_t wb_smsc_wdt_write(struct file *file, const char __user *data,
 
 /* ioctl => control interface */
 
-static int wb_smsc_wdt_ioctl(struct inode *inode, struct file *file,
-                            unsigned int cmd, unsigned long arg)
+static long wb_smsc_wdt_ioctl(struct file *file,
+                                       unsigned int cmd, unsigned long arg)
 {
        int new_timeout;
 
@@ -420,89 +433,73 @@ static int wb_smsc_wdt_ioctl(struct inode *inode, struct file *file,
                int __user *i;
        } uarg;
 
-       static struct watchdog_info ident = {
+       static const struct watchdog_info ident = {
                .options =              WDIOF_KEEPALIVEPING |
-                                       WDIOF_SETTIMEOUT |
+                                       WDIOF_SETTIMEOUT |
                                        WDIOF_MAGICCLOSE,
                .firmware_version =     0,
-               .identity =             "SMsC 37B787 Watchdog"
+               .identity =             "SMsC 37B787 Watchdog",
        };
 
        uarg.i = (int __user *)arg;
 
        switch (cmd) {
-               default:
-                       return -ENOTTY;
-
-               case WDIOC_GETSUPPORT:
-                       return copy_to_user(uarg.ident, &ident,
-                               sizeof(ident)) ? -EFAULT : 0;
-
-               case WDIOC_GETSTATUS:
-                       return put_user(wb_smsc_wdt_status(), uarg.i);
-
-               case WDIOC_GETBOOTSTATUS:
-                       return put_user(0, uarg.i);
-
-               case WDIOC_KEEPALIVE:
-                       wb_smsc_wdt_reset_timer();
-                       return 0;
-
-               case WDIOC_SETTIMEOUT:
-                       if (get_user(new_timeout, uarg.i))
-                               return -EFAULT;
-
-                       // the API states this is given in secs
-                       if (unit == UNIT_MINUTE)
-                         new_timeout /= 60;
-
-                       if (new_timeout < 0 || new_timeout > MAX_TIMEOUT)
-                               return -EINVAL;
-
-                       timeout = new_timeout;
-                       wb_smsc_wdt_set_timeout(timeout);
-
-                       // fall through and return the new timeout...
-
-               case WDIOC_GETTIMEOUT:
-
-                       new_timeout = timeout;
-
-                       if (unit == UNIT_MINUTE)
-                         new_timeout *= 60;
-
-                       return put_user(new_timeout, uarg.i);
-
-               case WDIOC_SETOPTIONS:
-               {
-                       int options, retval = -EINVAL;
-
-                       if (get_user(options, uarg.i))
-                               return -EFAULT;
-
-                       if (options & WDIOS_DISABLECARD) {
-                               wb_smsc_wdt_disable();
-                               retval = 0;
-                       }
+       case WDIOC_GETSUPPORT:
+               return copy_to_user(uarg.ident, &ident, sizeof(ident))
+                                                               ? -EFAULT : 0;
+       case WDIOC_GETSTATUS:
+               return put_user(wb_smsc_wdt_status(), uarg.i);
+       case WDIOC_GETBOOTSTATUS:
+               return put_user(0, uarg.i);
+       case WDIOC_SETOPTIONS:
+       {
+               int options, retval = -EINVAL;
 
-                       if (options & WDIOS_ENABLECARD) {
-                               wb_smsc_wdt_enable();
-                               retval = 0;
-                       }
+               if (get_user(options, uarg.i))
+                       return -EFAULT;
 
-                       return retval;
+               if (options & WDIOS_DISABLECARD) {
+                       wb_smsc_wdt_disable();
+                       retval = 0;
+               }
+               if (options & WDIOS_ENABLECARD) {
+                       wb_smsc_wdt_enable();
+                       retval = 0;
                }
+               return retval;
+       }
+       case WDIOC_KEEPALIVE:
+               wb_smsc_wdt_reset_timer();
+               return 0;
+       case WDIOC_SETTIMEOUT:
+               if (get_user(new_timeout, uarg.i))
+                       return -EFAULT;
+               /* the API states this is given in secs */
+               if (unit == UNIT_MINUTE)
+                       new_timeout /= 60;
+               if (new_timeout < 0 || new_timeout > MAX_TIMEOUT)
+                       return -EINVAL;
+               timeout = new_timeout;
+               wb_smsc_wdt_set_timeout(timeout);
+               /* fall through and return the new timeout... */
+       case WDIOC_GETTIMEOUT:
+               new_timeout = timeout;
+               if (unit == UNIT_MINUTE)
+                         new_timeout *= 60;
+               return put_user(new_timeout, uarg.i);
+       default:
+               return -ENOTTY;
        }
 }
 
 /* -- Notifier funtions -----------------------------------------*/
 
-static int wb_smsc_wdt_notify_sys(struct notifier_block *this, unsigned long code, void *unused)
+static int wb_smsc_wdt_notify_sys(struct notifier_block *this,
+                                       unsigned long code, void *unused)
 {
-       if (code == SYS_DOWN || code == SYS_HALT)
-       {
-                // set timeout to 0, to avoid possible race-condition
-               timeout = 0;
+       if (code == SYS_DOWN || code == SYS_HALT) {
+               /* set timeout to 0, to avoid possible race-condition */
+               timeout = 0;
                wb_smsc_wdt_disable();
        }
        return NOTIFY_DONE;
@@ -510,23 +507,20 @@ static int wb_smsc_wdt_notify_sys(struct notifier_block *this, unsigned long cod
 
 /* -- Module's structures ---------------------------------------*/
 
-static const struct file_operations wb_smsc_wdt_fops =
-{
-       .owner          = THIS_MODULE,
+static const struct file_operations wb_smsc_wdt_fops = {
+       .owner    = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = wb_smsc_wdt_write,
-       .ioctl          = wb_smsc_wdt_ioctl,
+       .unlocked_ioctl = wb_smsc_wdt_ioctl,
        .open           = wb_smsc_wdt_open,
        .release        = wb_smsc_wdt_release,
 };
 
-static struct notifier_block wb_smsc_wdt_notifier =
-{
+static struct notifier_block wb_smsc_wdt_notifier = {
        .notifier_call  = wb_smsc_wdt_notify_sys,
 };
 
-static struct miscdevice wb_smsc_wdt_miscdev =
-{
+static struct miscdevice wb_smsc_wdt_miscdev = {
        .minor          = WATCHDOG_MINOR,
        .name           = "watchdog",
        .fops           = &wb_smsc_wdt_fops,
@@ -540,39 +534,44 @@ static int __init wb_smsc_wdt_init(void)
 {
        int ret;
 
-       printk("SMsC 37B787 watchdog component driver " VERSION " initialising...\n");
+       printk(KERN_INFO "SMsC 37B787 watchdog component driver "
+                                       VERSION " initialising...\n");
 
        if (!request_region(IOPORT, IOPORT_SIZE, "SMsC 37B787 watchdog")) {
-               printk(KERN_ERR MODNAME "Unable to register IO port %#x\n", IOPORT);
+               printk(KERN_ERR MODNAME "Unable to register IO port %#x\n",
+                                                               IOPORT);
                ret = -EBUSY;
                goto out_pnp;
        }
 
-        // set new maximum, if it's too big
-        if (timeout > MAX_TIMEOUT)
-               timeout = MAX_TIMEOUT;
+       /* set new maximum, if it's too big */
+       if (timeout > MAX_TIMEOUT)
+               timeout = MAX_TIMEOUT;
 
-        // init the watchdog timer
-        wb_smsc_wdt_initialize();
+       /* init the watchdog timer */
+       wb_smsc_wdt_initialize();
 
        ret = register_reboot_notifier(&wb_smsc_wdt_notifier);
        if (ret) {
-               printk(KERN_ERR MODNAME "Unable to register reboot notifier err = %d\n", ret);
+               printk(KERN_ERR MODNAME
+                       "Unable to register reboot notifier err = %d\n", ret);
                goto out_io;
        }
 
        ret = misc_register(&wb_smsc_wdt_miscdev);
        if (ret) {
-               printk(KERN_ERR MODNAME "Unable to register miscdev on minor %d\n", WATCHDOG_MINOR);
+               printk(KERN_ERR MODNAME
+                       "Unable to register miscdev on minor %d\n",
+                                                       WATCHDOG_MINOR);
                goto out_rbt;
        }
 
-       // output info
-       printk(KERN_INFO MODNAME "Timeout set to %d %s.\n", timeout, (unit == UNIT_SECOND) ? "second(s)" : "minute(s)");
-       printk(KERN_INFO MODNAME "Watchdog initialized and sleeping (nowayout=%d)...\n", nowayout);
-
-       // ret = 0
-
+       /* output info */
+       printk(KERN_INFO MODNAME "Timeout set to %d %s.\n",
+               timeout, (unit == UNIT_SECOND) ? "second(s)" : "minute(s)");
+       printk(KERN_INFO MODNAME
+               "Watchdog initialized and sleeping (nowayout=%d)...\n",
+                                                               nowayout);
 out_clean:
        return ret;
 
@@ -591,8 +590,7 @@ out_pnp:
 static void __exit wb_smsc_wdt_exit(void)
 {
        /* Stop the timer before we leave */
-       if (!nowayout)
-       {
+       if (!nowayout) {
                wb_smsc_wdt_shutdown();
                printk(KERN_INFO MODNAME "Watchdog disabled.\n");
        }
@@ -601,25 +599,29 @@ static void __exit wb_smsc_wdt_exit(void)
        unregister_reboot_notifier(&wb_smsc_wdt_notifier);
        release_region(IOPORT, IOPORT_SIZE);
 
-       printk("SMsC 37B787 watchdog component driver removed.\n");
+       printk(KERN_INFO "SMsC 37B787 watchdog component driver removed.\n");
 }
 
 module_init(wb_smsc_wdt_init);
 module_exit(wb_smsc_wdt_exit);
 
 MODULE_AUTHOR("Sven Anders <anders@anduras.de>");
-MODULE_DESCRIPTION("Driver for SMsC 37B787 watchdog component (Version " VERSION ")");
+MODULE_DESCRIPTION("Driver for SMsC 37B787 watchdog component (Version "
+                                                               VERSION ")");
 MODULE_LICENSE("GPL");
 
 MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
 
 #ifdef SMSC_SUPPORT_MINUTES
 module_param(unit, int, 0);
-MODULE_PARM_DESC(unit, "set unit to use, 0=seconds or 1=minutes, default is 0");
+MODULE_PARM_DESC(unit,
+               "set unit to use, 0=seconds or 1=minutes, default is 0");
 #endif
 
 module_param(timeout, int, 0);
 MODULE_PARM_DESC(timeout, "range is 1-255 units, default is 60");
 
 module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout,
+               "Watchdog cannot be stopped once started (default="
+                               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
index 9c36949..c650464 100644 (file)
 #include <linux/reboot.h>
 #include <linux/init.h>
 #include <linux/jiffies.h>
-
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define PFX "SoftDog: "
 
 #define TIMER_MARGIN   60              /* Default is 60 seconds */
 static int soft_margin = TIMER_MARGIN; /* in seconds */
 module_param(soft_margin, int, 0);
-MODULE_PARM_DESC(soft_margin, "Watchdog soft_margin in seconds. (0<soft_margin<65536, default=" __MODULE_STRING(TIMER_MARGIN) ")");
+MODULE_PARM_DESC(soft_margin,
+       "Watchdog soft_margin in seconds. (0 < soft_margin < 65536, default="
+                                       __MODULE_STRING(TIMER_MARGIN) ")");
 
 static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout,
+               "Watchdog cannot be stopped once started (default="
+                               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 #ifdef ONLY_TESTING
 static int soft_noboot = 1;
@@ -93,8 +96,7 @@ static void watchdog_fire(unsigned long data)
 
        if (soft_noboot)
                printk(KERN_CRIT PFX "Triggered - Reboot ignored.\n");
-       else
-       {
+       else {
                printk(KERN_CRIT PFX "Initiating system reboot.\n");
                emergency_restart();
                printk(KERN_CRIT PFX "Reboot didn't ?????\n");
@@ -153,7 +155,8 @@ static int softdog_release(struct inode *inode, struct file *file)
                softdog_stop();
                module_put(THIS_MODULE);
        } else {
-               printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
+               printk(KERN_CRIT PFX
+                       "Unexpected close, not stopping watchdog!\n");
                set_bit(0, &orphan_timer);
                softdog_keepalive();
        }
@@ -162,12 +165,13 @@ static int softdog_release(struct inode *inode, struct file *file)
        return 0;
 }
 
-static ssize_t softdog_write(struct file *file, const char __user *data, size_t len, loff_t *ppos)
+static ssize_t softdog_write(struct file *file, const char __user *data,
+                                               size_t len, loff_t *ppos)
 {
        /*
         *      Refresh the timer.
         */
-       if(len) {
+       if (len) {
                if (!nowayout) {
                        size_t i;
 
@@ -188,13 +192,13 @@ static ssize_t softdog_write(struct file *file, const char __user *data, size_t
        return len;
 }
 
-static int softdog_ioctl(struct inode *inode, struct file *file,
-       unsigned int cmd, unsigned long arg)
+static long softdog_ioctl(struct file *file, unsigned int cmd,
+                                                       unsigned long arg)
 {
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
        int new_margin;
-       static struct watchdog_info ident = {
+       static const struct watchdog_info ident = {
                .options =              WDIOF_SETTIMEOUT |
                                        WDIOF_KEEPALIVEPING |
                                        WDIOF_MAGICCLOSE,
@@ -202,26 +206,25 @@ static int softdog_ioctl(struct inode *inode, struct file *file,
                .identity =             "Software Watchdog",
        };
        switch (cmd) {
-               default:
-                       return -ENOTTY;
-               case WDIOC_GETSUPPORT:
-                       return copy_to_user(argp, &ident,
-                               sizeof(ident)) ? -EFAULT : 0;
-               case WDIOC_GETSTATUS:
-               case WDIOC_GETBOOTSTATUS:
-                       return put_user(0, p);
-               case WDIOC_KEEPALIVE:
-                       softdog_keepalive();
-                       return 0;
-               case WDIOC_SETTIMEOUT:
-                       if (get_user(new_margin, p))
-                               return -EFAULT;
-                       if (softdog_set_heartbeat(new_margin))
-                               return -EINVAL;
-                       softdog_keepalive();
-                       /* Fall */
-               case WDIOC_GETTIMEOUT:
-                       return put_user(soft_margin, p);
+       case WDIOC_GETSUPPORT:
+               return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
+       case WDIOC_GETSTATUS:
+       case WDIOC_GETBOOTSTATUS:
+               return put_user(0, p);
+       case WDIOC_KEEPALIVE:
+               softdog_keepalive();
+               return 0;
+       case WDIOC_SETTIMEOUT:
+               if (get_user(new_margin, p))
+                       return -EFAULT;
+               if (softdog_set_heartbeat(new_margin))
+                       return -EINVAL;
+               softdog_keepalive();
+               /* Fall */
+       case WDIOC_GETTIMEOUT:
+               return put_user(soft_margin, p);
+       default:
+               return -ENOTTY;
        }
 }
 
@@ -232,10 +235,9 @@ static int softdog_ioctl(struct inode *inode, struct file *file,
 static int softdog_notify_sys(struct notifier_block *this, unsigned long code,
        void *unused)
 {
-       if(code==SYS_DOWN || code==SYS_HALT) {
+       if (code == SYS_DOWN || code == SYS_HALT)
                /* Turn the WDT off */
                softdog_stop();
-       }
        return NOTIFY_DONE;
 }
 
@@ -247,7 +249,7 @@ static const struct file_operations softdog_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = softdog_write,
-       .ioctl          = softdog_ioctl,
+       .unlocked_ioctl = softdog_ioctl,
        .open           = softdog_open,
        .release        = softdog_release,
 };
@@ -268,24 +270,27 @@ static int __init watchdog_init(void)
 {
        int ret;
 
-       /* Check that the soft_margin value is within it's range ; if not reset to the default */
+       /* Check that the soft_margin value is within it's range;
+          if not reset to the default */
        if (softdog_set_heartbeat(soft_margin)) {
                softdog_set_heartbeat(TIMER_MARGIN);
-               printk(KERN_INFO PFX "soft_margin value must be 0<soft_margin<65536, using %d\n",
+               printk(KERN_INFO PFX
+                   "soft_margin must be 0 < soft_margin < 65536, using %d\n",
                        TIMER_MARGIN);
        }
 
        ret = register_reboot_notifier(&softdog_notifier);
        if (ret) {
-               printk (KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
-                       ret);
+               printk(KERN_ERR PFX
+                       "cannot register reboot notifier (err=%d)\n", ret);
                return ret;
        }
 
        ret = misc_register(&softdog_miscdev);
        if (ret) {
-               printk (KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
-                       WATCHDOG_MINOR, ret);
+               printk(KERN_ERR PFX
+                       "cannot register miscdev on minor=%d (err=%d)\n",
+                                               WATCHDOG_MINOR, ret);
                unregister_reboot_notifier(&softdog_notifier);
                return ret;
        }
index 57cefef..dbbc018 100644 (file)
@@ -45,27 +45,34 @@ static unsigned long txx9wdt_alive;
 static int expect_close;
 static struct txx9_tmr_reg __iomem *txx9wdt_reg;
 static struct clk *txx9_imclk;
+static DECLARE_LOCK(txx9_lock);
 
 static void txx9wdt_ping(void)
 {
+       spin_lock(&txx9_lock);
        __raw_writel(TXx9_TMWTMR_TWIE | TXx9_TMWTMR_TWC, &txx9wdt_reg->wtmr);
+       spin_unlock(&txx9_lock);
 }
 
 static void txx9wdt_start(void)
 {
+       spin_lock(&txx9_lock);
        __raw_writel(WD_TIMER_CLK * timeout, &txx9wdt_reg->cpra);
        __raw_writel(WD_TIMER_CCD, &txx9wdt_reg->ccdr);
        __raw_writel(0, &txx9wdt_reg->tisr);    /* clear pending interrupt */
        __raw_writel(TXx9_TMTCR_TCE | TXx9_TMTCR_CCDE | TXx9_TMTCR_TMODE_WDOG,
                     &txx9wdt_reg->tcr);
        __raw_writel(TXx9_TMWTMR_TWIE | TXx9_TMWTMR_TWC, &txx9wdt_reg->wtmr);
+       spin_unlock(&txx9_lock);
 }
 
 static void txx9wdt_stop(void)
 {
+       spin_lock(&txx9_lock);
        __raw_writel(TXx9_TMWTMR_WDIS, &txx9wdt_reg->wtmr);
        __raw_writel(__raw_readl(&txx9wdt_reg->tcr) & ~TXx9_TMTCR_TCE,
                     &txx9wdt_reg->tcr);
+       spin_unlock(&txx9_lock);
 }
 
 static int txx9wdt_open(struct inode *inode, struct file *file)
@@ -120,13 +127,13 @@ static ssize_t txx9wdt_write(struct file *file, const char __user *data,
        return len;
 }
 
-static int txx9wdt_ioctl(struct inode *inode, struct file *file,
-       unsigned int cmd, unsigned long arg)
+static long txx9wdt_ioctl(struct file *file, unsigned int cmd,
+                                                       unsigned long arg)
 {
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
        int new_timeout;
-       static struct watchdog_info ident = {
+       static const struct watchdog_info ident = {
                .options =              WDIOF_SETTIMEOUT |
                                        WDIOF_KEEPALIVEPING |
                                        WDIOF_MAGICCLOSE,
@@ -135,8 +142,6 @@ static int txx9wdt_ioctl(struct inode *inode, struct file *file,
        };
 
        switch (cmd) {
-       default:
-               return -ENOTTY;
        case WDIOC_GETSUPPORT:
                return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
        case WDIOC_GETSTATUS:
@@ -156,6 +161,8 @@ static int txx9wdt_ioctl(struct inode *inode, struct file *file,
                /* Fall */
        case WDIOC_GETTIMEOUT:
                return put_user(timeout, p);
+       default:
+               return -ENOTTY;
        }
 }
 
@@ -168,22 +175,22 @@ static int txx9wdt_notify_sys(struct notifier_block *this, unsigned long code,
 }
 
 static const struct file_operations txx9wdt_fops = {
-       .owner        THIS_MODULE,
-       .llseek =       no_llseek,
-       .write        txx9wdt_write,
-       .ioctl =        txx9wdt_ioctl,
-       .open =         txx9wdt_open,
-       .release =      txx9wdt_release,
+       .owner          =       THIS_MODULE,
+       .llseek         =       no_llseek,
+       .write          =       txx9wdt_write,
+       .unlocked_ioctl =       txx9wdt_ioctl,
+       .open           =       txx9wdt_open,
+       .release        =       txx9wdt_release,
 };
 
 static struct miscdevice txx9wdt_miscdev = {
-       .minor        WATCHDOG_MINOR,
-       .name =         "watchdog",
-       .fops =         &txx9wdt_fops,
+       .minor  =       WATCHDOG_MINOR,
+       .name   =       "watchdog",
+       .fops   =       &txx9wdt_fops,
 };
 
 static struct notifier_block txx9wdt_notifier = {
-       .notifier_call = txx9wdt_notify_sys
+       .notifier_call = txx9wdt_notify_sys,
 };
 
 static int __init txx9wdt_probe(struct platform_device *dev)
index 3864928..69396ad 100644 (file)
@@ -37,9 +37,9 @@
 #include <linux/reboot.h>
 #include <linux/init.h>
 #include <linux/spinlock.h>
+#include <linux/io.h>
+#include <linux/uaccess.h>
 
-#include <asm/io.h>
-#include <asm/uaccess.h>
 #include <asm/system.h>
 
 #define WATCHDOG_NAME "w83627hf/thf/hg WDT"
@@ -57,22 +57,26 @@ MODULE_PARM_DESC(wdt_io, "w83627hf/thf WDT io port (default 0x2E)");
 
 static int timeout = WATCHDOG_TIMEOUT; /* in seconds */
 module_param(timeout, int, 0);
-MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=255, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ".");
+MODULE_PARM_DESC(timeout,
+               "Watchdog timeout in seconds. 1 <= timeout <= 255, default="
+                               __MODULE_STRING(WATCHDOG_TIMEOUT) ".");
 
 static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout,
+               "Watchdog cannot be stopped once started (default="
+                               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 /*
  *     Kernel methods.
  */
 
 #define WDT_EFER (wdt_io+0)   /* Extended Function Enable Registers */
-#define WDT_EFIR (wdt_io+0)   /* Extended Function Index Register (same as EFER) */
+#define WDT_EFIR (wdt_io+0)   /* Extended Function Index Register
+                                                       (same as EFER) */
 #define WDT_EFDR (WDT_EFIR+1) /* Extended Function Data Register */
 
-static void
-w83627hf_select_wd_register(void)
+static void w83627hf_select_wd_register(void)
 {
        unsigned char c;
        outb_p(0x87, WDT_EFER); /* Enter extended function mode */
@@ -93,43 +97,45 @@ w83627hf_select_wd_register(void)
        outb_p(0x01, WDT_EFDR); /* set bit 0 to activate GPIO2 */
 }
 
-static void
-w83627hf_unselect_wd_register(void)
+static void w83627hf_unselect_wd_register(void)
 {
        outb_p(0xAA, WDT_EFER); /* Leave extended function mode */
 }
 
 /* tyan motherboards seem to set F5 to 0x4C ?
  * So explicitly init to appropriate value. */
-static void
-w83627hf_init(void)
+
+static void w83627hf_init(void)
 {
        unsigned char t;
 
        w83627hf_select_wd_register();
 
        outb_p(0xF6, WDT_EFER); /* Select CRF6 */
-       t=inb_p(WDT_EFDR);      /* read CRF6 */
+       t = inb_p(WDT_EFDR);      /* read CRF6 */
        if (t != 0) {
-               printk (KERN_INFO PFX "Watchdog already running. Resetting timeout to %d sec\n", timeout);
+               printk(KERN_INFO PFX
+                    "Watchdog already running. Resetting timeout to %d sec\n",
+                                                               timeout);
                outb_p(timeout, WDT_EFDR);    /* Write back to CRF6 */
        }
 
        outb_p(0xF5, WDT_EFER); /* Select CRF5 */
-       t=inb_p(WDT_EFDR);      /* read CRF5 */
-       t&=~0x0C;               /* set second mode & disable keyboard turning off watchdog */
+       t = inb_p(WDT_EFDR);      /* read CRF5 */
+       t &= ~0x0C;               /* set second mode & disable keyboard
+                                   turning off watchdog */
        outb_p(t, WDT_EFDR);    /* Write back to CRF5 */
 
        outb_p(0xF7, WDT_EFER); /* Select CRF7 */
-       t=inb_p(WDT_EFDR);      /* read CRF7 */
-       t&=~0xC0;               /* disable keyboard & mouse turning off watchdog */
+       t = inb_p(WDT_EFDR);      /* read CRF7 */
+       t &= ~0xC0;               /* disable keyboard & mouse turning off
+                                   watchdog */
        outb_p(t, WDT_EFDR);    /* Write back to CRF7 */
 
        w83627hf_unselect_wd_register();
 }
 
-static void
-wdt_ctrl(int timeout)
+static void wdt_ctrl(int timeout)
 {
        spin_lock(&io_lock);
 
@@ -143,32 +149,28 @@ wdt_ctrl(int timeout)
        spin_unlock(&io_lock);
 }
 
-static int
-wdt_ping(void)
+static int wdt_ping(void)
 {
        wdt_ctrl(timeout);
        return 0;
 }
 
-static int
-wdt_disable(void)
+static int wdt_disable(void)
 {
        wdt_ctrl(0);
        return 0;
 }
 
-static int
-wdt_set_heartbeat(int t)
+static int wdt_set_heartbeat(int t)
 {
-       if ((t < 1) || (t > 255))
+       if (t < 1 || t > 255)
                return -EINVAL;
-
        timeout = t;
        return 0;
 }
 
-static ssize_t
-wdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
+static ssize_t wdt_write(struct file *file, const char __user *buf,
+                                               size_t count, loff_t *ppos)
 {
        if (count) {
                if (!nowayout) {
@@ -178,7 +180,7 @@ wdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
 
                        for (i = 0; i != count; i++) {
                                char c;
-                               if (get_user(c, buf+i))
+                               if (get_user(c, buf + i))
                                        return -EFAULT;
                                if (c == 'V')
                                        expect_close = 42;
@@ -189,72 +191,61 @@ wdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
        return count;
 }
 
-static int
-wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-         unsigned long arg)
+static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
        int new_timeout;
        static struct watchdog_info ident = {
-               .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
+               .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT |
+                                                       WDIOF_MAGICCLOSE,
                .firmware_version = 1,
                .identity = "W83627HF WDT",
        };
 
        switch (cmd) {
        case WDIOC_GETSUPPORT:
-         if (copy_to_user(argp, &ident, sizeof(ident)))
-           return -EFAULT;
-         break;
-
+               if (copy_to_user(argp, &ident, sizeof(ident)))
+                       return -EFAULT;
+               break;
        case WDIOC_GETSTATUS:
        case WDIOC_GETBOOTSTATUS:
-         return put_user(0, p);
-
-       case WDIOC_KEEPALIVE:
-         wdt_ping();
-         break;
-
-       case WDIOC_SETTIMEOUT:
-         if (get_user(new_timeout, p))
-                 return -EFAULT;
-         if (wdt_set_heartbeat(new_timeout))
-                 return -EINVAL;
-         wdt_ping();
-         /* Fall */
-
-       case WDIOC_GETTIMEOUT:
-         return put_user(timeout, p);
-
+               return put_user(0, p);
        case WDIOC_SETOPTIONS:
        {
-         int options, retval = -EINVAL;
-
-         if (get_user(options, p))
-           return -EFAULT;
-
-         if (options & WDIOS_DISABLECARD) {
-           wdt_disable();
-           retval = 0;
-         }
-
-         if (options & WDIOS_ENABLECARD) {
-           wdt_ping();
-           retval = 0;
-         }
+               int options, retval = -EINVAL;
 
-         return retval;
+               if (get_user(options, p))
+                       return -EFAULT;
+               if (options & WDIOS_DISABLECARD) {
+                       wdt_disable();
+                       retval = 0;
+               }
+               if (options & WDIOS_ENABLECARD) {
+                       wdt_ping();
+                       retval = 0;
+               }
+               return retval;
        }
-
+       case WDIOC_KEEPALIVE:
+               wdt_ping();
+               break;
+       case WDIOC_SETTIMEOUT:
+               if (get_user(new_timeout, p))
+                       return -EFAULT;
+               if (wdt_set_heartbeat(new_timeout))
+                       return -EINVAL;
+               wdt_ping();
+               /* Fall */
+       case WDIOC_GETTIMEOUT:
+               return put_user(timeout, p);
        default:
-         return -ENOTTY;
+               return -ENOTTY;
        }
        return 0;
 }
 
-static int
-wdt_open(struct inode *inode, struct file *file)
+static int wdt_open(struct inode *inode, struct file *file)
 {
        if (test_and_set_bit(0, &wdt_is_open))
                return -EBUSY;
@@ -266,13 +257,13 @@ wdt_open(struct inode *inode, struct file *file)
        return nonseekable_open(inode, file);
 }
 
-static int
-wdt_close(struct inode *inode, struct file *file)
+static int wdt_close(struct inode *inode, struct file *file)
 {
-       if (expect_close == 42) {
+       if (expect_close == 42)
                wdt_disable();
-       } else {
-               printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
+       else {
+               printk(KERN_CRIT PFX
+                       "Unexpected close, not stopping watchdog!\n");
                wdt_ping();
        }
        expect_close = 0;
@@ -284,14 +275,12 @@ wdt_close(struct inode *inode, struct file *file)
  *     Notifier for system down
  */
 
-static int
-wdt_notify_sys(struct notifier_block *this, unsigned long code,
+static int wdt_notify_sys(struct notifier_block *this, unsigned long code,
        void *unused)
 {
-       if (code == SYS_DOWN || code == SYS_HALT) {
-               /* Turn the WDT off */
-               wdt_disable();
-       }
+       if (code == SYS_DOWN || code == SYS_HALT)
+               wdt_disable();  /* Turn the WDT off */
+
        return NOTIFY_DONE;
 }
 
@@ -303,7 +292,7 @@ static const struct file_operations wdt_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = wdt_write,
-       .ioctl          = wdt_ioctl,
+       .unlocked_ioctl = wdt_ioctl,
        .open           = wdt_open,
        .release        = wdt_close,
 };
@@ -323,8 +312,7 @@ static struct notifier_block wdt_notifier = {
        .notifier_call = wdt_notify_sys,
 };
 
-static int __init
-wdt_init(void)
+static int __init wdt_init(void)
 {
        int ret;
 
@@ -332,12 +320,13 @@ wdt_init(void)
 
        if (wdt_set_heartbeat(timeout)) {
                wdt_set_heartbeat(WATCHDOG_TIMEOUT);
-               printk (KERN_INFO PFX "timeout value must be 1<=timeout<=255, using %d\n",
-                       WATCHDOG_TIMEOUT);
+               printk(KERN_INFO PFX
+                    "timeout value must be 1 <= timeout <= 255, using %d\n",
+                               WATCHDOG_TIMEOUT);
        }
 
        if (!request_region(wdt_io, 1, WATCHDOG_NAME)) {
-               printk (KERN_ERR PFX "I/O address 0x%04x already in use\n",
+               printk(KERN_ERR PFX "I/O address 0x%04x already in use\n",
                        wdt_io);
                ret = -EIO;
                goto out;
@@ -347,20 +336,22 @@ wdt_init(void)
 
        ret = register_reboot_notifier(&wdt_notifier);
        if (ret != 0) {
-               printk (KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
-                       ret);
+               printk(KERN_ERR PFX
+                       "cannot register reboot notifier (err=%d)\n", ret);
                goto unreg_regions;
        }
 
        ret = misc_register(&wdt_miscdev);
        if (ret != 0) {
-               printk (KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
-                       WATCHDOG_MINOR, ret);
+               printk(KERN_ERR PFX
+                       "cannot register miscdev on minor=%d (err=%d)\n",
+                                                       WATCHDOG_MINOR, ret);
                goto unreg_reboot;
        }
 
-       printk (KERN_INFO PFX "initialized. timeout=%d sec (nowayout=%d)\n",
-               timeout, nowayout);
+       printk(KERN_INFO PFX
+                       "initialized. timeout=%d sec (nowayout=%d)\n",
+                                                       timeout, nowayout);
 
 out:
        return ret;
@@ -371,12 +362,11 @@ unreg_regions:
        goto out;
 }
 
-static void __exit
-wdt_exit(void)
+static void __exit wdt_exit(void)
 {
        misc_deregister(&wdt_miscdev);
        unregister_reboot_notifier(&wdt_notifier);
-       release_region(wdt_io,1);
+       release_region(wdt_io, 1);
 }
 
 module_init(wdt_init);
index 528b882..445d30a 100644 (file)
@@ -36,9 +36,9 @@
 #include <linux/reboot.h>
 #include <linux/init.h>
 #include <linux/spinlock.h>
+#include <linux/io.h>
+#include <linux/uaccess.h>
 
-#include <asm/io.h>
-#include <asm/uaccess.h>
 #include <asm/system.h>
 
 #define WATCHDOG_NAME "w83697hf/hg WDT"
@@ -53,37 +53,43 @@ static DEFINE_SPINLOCK(io_lock);
 /* You must set this - there is no sane way to probe for this board. */
 static int wdt_io = 0x2e;
 module_param(wdt_io, int, 0);
-MODULE_PARM_DESC(wdt_io, "w83697hf/hg WDT io port (default 0x2e, 0 = autodetect)");
+MODULE_PARM_DESC(wdt_io,
+               "w83697hf/hg WDT io port (default 0x2e, 0 = autodetect)");
 
 static int timeout = WATCHDOG_TIMEOUT; /* in seconds */
 module_param(timeout, int, 0);
-MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=255 (default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
+MODULE_PARM_DESC(timeout,
+       "Watchdog timeout in seconds. 1<= timeout <=255 (default="
+                               __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
 
 static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout,
+       "Watchdog cannot be stopped once started (default="
+                               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 static int early_disable = WATCHDOG_EARLY_DISABLE;
 module_param(early_disable, int, 0);
-MODULE_PARM_DESC(early_disable, "Watchdog gets disabled at boot time (default=" __MODULE_STRING(WATCHDOG_EARLY_DISABLE) ")");
+MODULE_PARM_DESC(early_disable,
+       "Watchdog gets disabled at boot time (default="
+                               __MODULE_STRING(WATCHDOG_EARLY_DISABLE) ")");
 
 /*
  *     Kernel methods.
  */
 
-#define W83697HF_EFER (wdt_io+0)       /* Extended Function Enable Register */
-#define W83697HF_EFIR (wdt_io+0)       /* Extended Function Index Register (same as EFER) */
-#define W83697HF_EFDR (wdt_io+1)       /* Extended Function Data Register */
+#define W83697HF_EFER (wdt_io + 0)  /* Extended Function Enable Register */
+#define W83697HF_EFIR (wdt_io + 0)  /* Extended Function Index Register
+                                                       (same as EFER) */
+#define W83697HF_EFDR (wdt_io + 1)  /* Extended Function Data Register */
 
-static inline void
-w83697hf_unlock(void)
+static inline void w83697hf_unlock(void)
 {
        outb_p(0x87, W83697HF_EFER);    /* Enter extended function mode */
        outb_p(0x87, W83697HF_EFER);    /* Again according to manual */
 }
 
-static inline void
-w83697hf_lock(void)
+static inline void w83697hf_lock(void)
 {
        outb_p(0xAA, W83697HF_EFER);    /* Leave extended function mode */
 }
@@ -93,41 +99,36 @@ w83697hf_lock(void)
  *     w83697hf_write_timeout() must be called with the device unlocked.
  */
 
-static unsigned char
-w83697hf_get_reg(unsigned char reg)
+static unsigned char w83697hf_get_reg(unsigned char reg)
 {
        outb_p(reg, W83697HF_EFIR);
        return inb_p(W83697HF_EFDR);
 }
 
-static void
-w83697hf_set_reg(unsigned char reg, unsigned char data)
+static void w83697hf_set_reg(unsigned char reg, unsigned char data)
 {
        outb_p(reg, W83697HF_EFIR);
        outb_p(data, W83697HF_EFDR);
 }
 
-static void
-w83697hf_write_timeout(int timeout)
+static void w83697hf_write_timeout(int timeout)
 {
-       w83697hf_set_reg(0xF4, timeout);        /* Write Timeout counter to CRF4 */
+       /* Write Timeout counter to CRF4 */
+       w83697hf_set_reg(0xF4, timeout);
 }
 
-static void
-w83697hf_select_wdt(void)
+static void w83697hf_select_wdt(void)
 {
        w83697hf_unlock();
        w83697hf_set_reg(0x07, 0x08);   /* Switch to logic device 8 (GPIO2) */
 }
 
-static inline void
-w83697hf_deselect_wdt(void)
+static inline void w83697hf_deselect_wdt(void)
 {
        w83697hf_lock();
 }
 
-static void
-w83697hf_init(void)
+static void w83697hf_init(void)
 {
        unsigned char bbuf;
 
@@ -136,7 +137,9 @@ w83697hf_init(void)
        bbuf = w83697hf_get_reg(0x29);
        bbuf &= ~0x60;
        bbuf |= 0x20;
-       w83697hf_set_reg(0x29, bbuf);   /* Set pin 119 to WDTO# mode (= CR29, WDT0) */
+
+       /* Set pin 119 to WDTO# mode (= CR29, WDT0) */
+       w83697hf_set_reg(0x29, bbuf);
 
        bbuf = w83697hf_get_reg(0xF3);
        bbuf &= ~0x04;
@@ -145,8 +148,7 @@ w83697hf_init(void)
        w83697hf_deselect_wdt();
 }
 
-static void
-wdt_ping(void)
+static void wdt_ping(void)
 {
        spin_lock(&io_lock);
        w83697hf_select_wdt();
@@ -157,8 +159,7 @@ wdt_ping(void)
        spin_unlock(&io_lock);
 }
 
-static void
-wdt_enable(void)
+static void wdt_enable(void)
 {
        spin_lock(&io_lock);
        w83697hf_select_wdt();
@@ -170,8 +171,7 @@ wdt_enable(void)
        spin_unlock(&io_lock);
 }
 
-static void
-wdt_disable(void)
+static void wdt_disable(void)
 {
        spin_lock(&io_lock);
        w83697hf_select_wdt();
@@ -183,8 +183,7 @@ wdt_disable(void)
        spin_unlock(&io_lock);
 }
 
-static unsigned char
-wdt_running(void)
+static unsigned char wdt_running(void)
 {
        unsigned char t;
 
@@ -199,18 +198,17 @@ wdt_running(void)
        return t;
 }
 
-static int
-wdt_set_heartbeat(int t)
+static int wdt_set_heartbeat(int t)
 {
-       if ((t < 1) || (t > 255))
+       if (t < 1 || t > 255)
                return -EINVAL;
 
        timeout = t;
        return 0;
 }
 
-static ssize_t
-wdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
+static ssize_t wdt_write(struct file *file, const char __user *buf,
+                                               size_t count, loff_t *ppos)
 {
        if (count) {
                if (!nowayout) {
@@ -220,7 +218,7 @@ wdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
 
                        for (i = 0; i != count; i++) {
                                char c;
-                               if (get_user(c, buf+i))
+                               if (get_user(c, buf + i))
                                        return -EFAULT;
                                if (c == 'V')
                                        expect_close = 42;
@@ -231,15 +229,14 @@ wdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
        return count;
 }
 
-static int
-wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-         unsigned long arg)
+static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
        int new_timeout;
-       static struct watchdog_info ident = {
-               .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
+       static const struct watchdog_info ident = {
+               .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT
+                                                       | WDIOF_MAGICCLOSE,
                .firmware_version = 1,
                .identity = "W83697HF WDT",
        };
@@ -254,21 +251,6 @@ wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
        case WDIOC_GETBOOTSTATUS:
                return put_user(0, p);
 
-       case WDIOC_KEEPALIVE:
-               wdt_ping();
-               break;
-
-       case WDIOC_SETTIMEOUT:
-               if (get_user(new_timeout, p))
-                       return -EFAULT;
-               if (wdt_set_heartbeat(new_timeout))
-                       return -EINVAL;
-               wdt_ping();
-               /* Fall */
-
-       case WDIOC_GETTIMEOUT:
-               return put_user(timeout, p);
-
        case WDIOC_SETOPTIONS:
        {
                int options, retval = -EINVAL;
@@ -289,14 +271,28 @@ wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
                return retval;
        }
 
+       case WDIOC_KEEPALIVE:
+               wdt_ping();
+               break;
+
+       case WDIOC_SETTIMEOUT:
+               if (get_user(new_timeout, p))
+                       return -EFAULT;
+               if (wdt_set_heartbeat(new_timeout))
+                       return -EINVAL;
+               wdt_ping();
+               /* Fall */
+
+       case WDIOC_GETTIMEOUT:
+               return put_user(timeout, p);
+
        default:
                return -ENOTTY;
        }
        return 0;
 }
 
-static int
-wdt_open(struct inode *inode, struct file *file)
+static int wdt_open(struct inode *inode, struct file *file)
 {
        if (test_and_set_bit(0, &wdt_is_open))
                return -EBUSY;
@@ -308,13 +304,13 @@ wdt_open(struct inode *inode, struct file *file)
        return nonseekable_open(inode, file);
 }
 
-static int
-wdt_close(struct inode *inode, struct file *file)
+static int wdt_close(struct inode *inode, struct file *file)
 {
-       if (expect_close == 42) {
+       if (expect_close == 42)
                wdt_disable();
-       } else {
-               printk (KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
+       else {
+               printk(KERN_CRIT PFX
+                       "Unexpected close, not stopping watchdog!\n");
                wdt_ping();
        }
        expect_close = 0;
@@ -326,14 +322,12 @@ wdt_close(struct inode *inode, struct file *file)
  *     Notifier for system down
  */
 
-static int
-wdt_notify_sys(struct notifier_block *this, unsigned long code,
+static int wdt_notify_sys(struct notifier_block *this, unsigned long code,
        void *unused)
 {
-       if (code == SYS_DOWN || code == SYS_HALT) {
-               /* Turn the WDT off */
-               wdt_disable();
-       }
+       if (code == SYS_DOWN || code == SYS_HALT)
+               wdt_disable();  /* Turn the WDT off */
+
        return NOTIFY_DONE;
 }
 
@@ -345,7 +339,7 @@ static const struct file_operations wdt_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = wdt_write,
-       .ioctl          = wdt_ioctl,
+       .unlocked_ioctl = wdt_ioctl,
        .open           = wdt_open,
        .release        = wdt_close,
 };
@@ -365,36 +359,38 @@ static struct notifier_block wdt_notifier = {
        .notifier_call = wdt_notify_sys,
 };
 
-static int
-w83697hf_check_wdt(void)
+static int w83697hf_check_wdt(void)
 {
        if (!request_region(wdt_io, 2, WATCHDOG_NAME)) {
-               printk (KERN_ERR PFX "I/O address 0x%x already in use\n", wdt_io);
+               printk(KERN_ERR PFX
+                       "I/O address 0x%x already in use\n", wdt_io);
                return -EIO;
        }
 
-       printk (KERN_DEBUG PFX "Looking for watchdog at address 0x%x\n", wdt_io);
+       printk(KERN_DEBUG PFX
+                       "Looking for watchdog at address 0x%x\n", wdt_io);
        w83697hf_unlock();
        if (w83697hf_get_reg(0x20) == 0x60) {
-               printk (KERN_INFO PFX "watchdog found at address 0x%x\n", wdt_io);
+               printk(KERN_INFO PFX
+                       "watchdog found at address 0x%x\n", wdt_io);
                w83697hf_lock();
                return 0;
        }
-       w83697hf_lock();        /* Reprotect in case it was a compatible device */
+       /* Reprotect in case it was a compatible device */
+       w83697hf_lock();
 
-       printk (KERN_INFO PFX "watchdog not found at address 0x%x\n", wdt_io);
+       printk(KERN_INFO PFX "watchdog not found at address 0x%x\n", wdt_io);
        release_region(wdt_io, 2);
        return -EIO;
 }
 
 static int w83697hf_ioports[] = { 0x2e, 0x4e, 0x00 };
 
-static int __init
-wdt_init(void)
+static int __init wdt_init(void)
 {
        int ret, i, found = 0;
 
-       printk (KERN_INFO PFX "WDT driver for W83697HF/HG initializing\n");
+       printk(KERN_INFO PFX "WDT driver for W83697HF/HG initializing\n");
 
        if (wdt_io == 0) {
                /* we will autodetect the W83697HF/HG watchdog */
@@ -409,7 +405,7 @@ wdt_init(void)
        }
 
        if (!found) {
-               printk (KERN_ERR PFX "No W83697HF/HG could be found\n");
+               printk(KERN_ERR PFX "No W83697HF/HG could be found\n");
                ret = -EIO;
                goto out;
        }
@@ -417,31 +413,33 @@ wdt_init(void)
        w83697hf_init();
        if (early_disable) {
                if (wdt_running())
-                       printk (KERN_WARNING PFX "Stopping previously enabled watchdog until userland kicks in\n");
+                       printk(KERN_WARNING PFX "Stopping previously enabled watchdog until userland kicks in\n");
                wdt_disable();
        }
 
        if (wdt_set_heartbeat(timeout)) {
                wdt_set_heartbeat(WATCHDOG_TIMEOUT);
-               printk (KERN_INFO PFX "timeout value must be 1<=timeout<=255, using %d\n",
-                       WATCHDOG_TIMEOUT);
+               printk(KERN_INFO PFX
+                    "timeout value must be 1 <= timeout <= 255, using %d\n",
+                                                       WATCHDOG_TIMEOUT);
        }
 
        ret = register_reboot_notifier(&wdt_notifier);
        if (ret != 0) {
-               printk (KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
-                       ret);
+               printk(KERN_ERR PFX
+                       "cannot register reboot notifier (err=%d)\n", ret);
                goto unreg_regions;
        }
 
        ret = misc_register(&wdt_miscdev);
        if (ret != 0) {
-               printk (KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
-                       WATCHDOG_MINOR, ret);
+               printk(KERN_ERR PFX
+                       "cannot register miscdev on minor=%d (err=%d)\n",
+                                               WATCHDOG_MINOR, ret);
                goto unreg_reboot;
        }
 
-       printk (KERN_INFO PFX "initialized. timeout=%d sec (nowayout=%d)\n",
+       printk(KERN_INFO PFX "initialized. timeout=%d sec (nowayout=%d)\n",
                timeout, nowayout);
 
 out:
@@ -453,8 +451,7 @@ unreg_regions:
        goto out;
 }
 
-static void __exit
-wdt_exit(void)
+static void __exit wdt_exit(void)
 {
        misc_deregister(&wdt_miscdev);
        unregister_reboot_notifier(&wdt_notifier);
index f510a3a..24587d2 100644 (file)
  *                            Added KERN_* tags to printks
  *                            add CONFIG_WATCHDOG_NOWAYOUT support
  *                            fix possible wdt_is_open race
- *                            changed watchdog_info to correctly reflect what the driver offers
- *                            added WDIOC_GETSTATUS, WDIOC_GETBOOTSTATUS, WDIOC_SETTIMEOUT,
+ *                            changed watchdog_info to correctly reflect what
+ *                           the driver offers
+ *                            added WDIOC_GETSTATUS, WDIOC_GETBOOTSTATUS,
+ *                           WDIOC_SETTIMEOUT,
  *                            WDIOC_GETTIMEOUT, and WDIOC_SETOPTIONS ioctls
  *           09/8 - 2003      [wim@iguana.be] cleanup of trailing spaces
  *                            added extra printk's for startup problems
  *                            use module_param
- *                            made timeout (the emulated heartbeat) a module_param
+ *                            made timeout (the emulated heartbeat) a
+ *                           module_param
  *                            made the keepalive ping an internal subroutine
  *
  *  This WDT driver is different from most other Linux WDT
@@ -51,8 +54,8 @@
 #include <linux/notifier.h>
 #include <linux/reboot.h>
 #include <linux/init.h>
-#include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/io.h>
+#include <linux/uaccess.h>
 #include <asm/system.h>
 
 #define OUR_NAME "w83877f_wdt"
  */
 
 #define WATCHDOG_TIMEOUT 30            /* 30 sec default timeout */
-static int timeout = WATCHDOG_TIMEOUT; /* in seconds, will be multiplied by HZ to get seconds to wait for a ping */
+/* in seconds, will be multiplied by HZ to get seconds to wait for a ping */
+static int timeout = WATCHDOG_TIMEOUT;
 module_param(timeout, int, 0);
-MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (1<=timeout<=3600, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
+MODULE_PARM_DESC(timeout,
+       "Watchdog timeout in seconds. (1<=timeout<=3600, default="
+                               __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
 
 
 static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout,
+               "Watchdog cannot be stopped once started (default="
+                               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 static void wdt_timer_ping(unsigned long);
 static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
@@ -105,8 +113,7 @@ static void wdt_timer_ping(unsigned long data)
        /* If we got a heartbeat pulse within the WDT_US_INTERVAL
         * we agree to ping the WDT
         */
-       if(time_before(jiffies, next_heartbeat))
-       {
+       if (time_before(jiffies, next_heartbeat)) {
                /* Ping the WDT */
                spin_lock(&wdt_spinlock);
 
@@ -118,9 +125,9 @@ static void wdt_timer_ping(unsigned long data)
 
                spin_unlock(&wdt_spinlock);
 
-       } else {
-               printk(KERN_WARNING PFX "Heartbeat lost! Will not ping the watchdog\n");
-       }
+       } else
+               printk(KERN_WARNING PFX
+                       "Heartbeat lost! Will not ping the watchdog\n");
 }
 
 /*
@@ -181,22 +188,21 @@ static void wdt_keepalive(void)
  * /dev/watchdog handling
  */
 
-static ssize_t fop_write(struct file * file, const char __user * buf, size_t count, loff_t * ppos)
+static ssize_t fop_write(struct file *file, const char __user *buf,
+                                               size_t count, loff_t *ppos)
 {
        /* See if we got the magic character 'V' and reload the timer */
-       if(count)
-       {
-               if (!nowayout)
-               {
+       if (count) {
+               if (!nowayout) {
                        size_t ofs;
 
-                       /* note: just in case someone wrote the magic character
-                        * five months ago... */
+                       /* note: just in case someone wrote the magic
+                          character five months ago... */
                        wdt_expect_close = 0;
 
-                       /* scan to see whether or not we got the magic character */
-                       for(ofs = 0; ofs != count; ofs++)
-                       {
+                       /* scan to see whether or not we got the
+                          magic character */
+                       for (ofs = 0; ofs != count; ofs++) {
                                char c;
                                if (get_user(c, buf + ofs))
                                        return -EFAULT;
@@ -211,10 +217,10 @@ static ssize_t fop_write(struct file * file, const char __user * buf, size_t cou
        return count;
 }
 
-static int fop_open(struct inode * inode, struct file * file)
+static int fop_open(struct inode *inode, struct file *file)
 {
        /* Just in case we're already talking to someone... */
-       if(test_and_set_bit(0, &wdt_is_open))
+       if (test_and_set_bit(0, &wdt_is_open))
                return -EBUSY;
 
        /* Good, fire up the show */
@@ -222,78 +228,78 @@ static int fop_open(struct inode * inode, struct file * file)
        return nonseekable_open(inode, file);
 }
 
-static int fop_close(struct inode * inode, struct file * file)
+static int fop_close(struct inode *inode, struct file *file)
 {
-       if(wdt_expect_close == 42)
+       if (wdt_expect_close == 42)
                wdt_turnoff();
        else {
                del_timer(&timer);
-               printk(KERN_CRIT PFX "device file closed unexpectedly. Will not stop the WDT!\n");
+               printk(KERN_CRIT PFX
+                 "device file closed unexpectedly. Will not stop the WDT!\n");
        }
        clear_bit(0, &wdt_is_open);
        wdt_expect_close = 0;
        return 0;
 }
 
-static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-       unsigned long arg)
+static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
-       static struct watchdog_info ident=
-       {
-               .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
+       static const struct watchdog_info ident = {
+               .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT
+                                                       | WDIOF_MAGICCLOSE,
                .firmware_version = 1,
                .identity = "W83877F",
        };
 
-       switch(cmd)
+       switch (cmd) {
+       case WDIOC_GETSUPPORT:
+               return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
+       case WDIOC_GETSTATUS:
+       case WDIOC_GETBOOTSTATUS:
+               return put_user(0, p);
+       case WDIOC_SETOPTIONS:
        {
-               default:
-                       return -ENOTTY;
-               case WDIOC_GETSUPPORT:
-                       return copy_to_user(argp, &ident, sizeof(ident))?-EFAULT:0;
-               case WDIOC_GETSTATUS:
-               case WDIOC_GETBOOTSTATUS:
-                       return put_user(0, p);
-               case WDIOC_KEEPALIVE:
-                       wdt_keepalive();
-                       return 0;
-               case WDIOC_SETOPTIONS:
-               {
-                       int new_options, retval = -EINVAL;
-
-                       if(get_user(new_options, p))
-                               return -EFAULT;
-
-                       if(new_options & WDIOS_DISABLECARD) {
-                               wdt_turnoff();
-                               retval = 0;
-                       }
+               int new_options, retval = -EINVAL;
 
-                       if(new_options & WDIOS_ENABLECARD) {
-                               wdt_startup();
-                               retval = 0;
-                       }
+               if (get_user(new_options, p))
+                       return -EFAULT;
 
-                       return retval;
+               if (new_options & WDIOS_DISABLECARD) {
+                       wdt_turnoff();
+                       retval = 0;
                }
-               case WDIOC_SETTIMEOUT:
-               {
-                       int new_timeout;
 
-                       if(get_user(new_timeout, p))
-                               return -EFAULT;
+               if (new_options & WDIOS_ENABLECARD) {
+                       wdt_startup();
+                       retval = 0;
+               }
 
-                       if(new_timeout < 1 || new_timeout > 3600) /* arbitrary upper limit */
-                               return -EINVAL;
+               return retval;
+       }
+       case WDIOC_KEEPALIVE:
+               wdt_keepalive();
+               return 0;
+       case WDIOC_SETTIMEOUT:
+       {
+               int new_timeout;
 
-                       timeout = new_timeout;
-                       wdt_keepalive();
-                       /* Fall through */
-               }
-               case WDIOC_GETTIMEOUT:
-                       return put_user(timeout, p);
+               if (get_user(new_timeout, p))
+                       return -EFAULT;
+
+               /* arbitrary upper limit */
+               if (new_timeout < 1 || new_timeout > 3600)
+                       return -EINVAL;
+
+               timeout = new_timeout;
+               wdt_keepalive();
+               /* Fall through */
+       }
+       case WDIOC_GETTIMEOUT:
+               return put_user(timeout, p);
+       default:
+               return -ENOTTY;
        }
 }
 
@@ -303,7 +309,7 @@ static const struct file_operations wdt_fops = {
        .write          = fop_write,
        .open           = fop_open,
        .release        = fop_close,
-       .ioctl          = fop_ioctl,
+       .unlocked_ioctl = fop_ioctl,
 };
 
 static struct miscdevice wdt_miscdev = {
@@ -319,7 +325,7 @@ static struct miscdevice wdt_miscdev = {
 static int wdt_notify_sys(struct notifier_block *this, unsigned long code,
        void *unused)
 {
-       if(code==SYS_DOWN || code==SYS_HALT)
+       if (code == SYS_DOWN || code == SYS_HALT)
                wdt_turnoff();
        return NOTIFY_DONE;
 }
@@ -329,8 +335,7 @@ static int wdt_notify_sys(struct notifier_block *this, unsigned long code,
  *     turn the timebomb registers off.
  */
 
-static struct notifier_block wdt_notifier=
-{
+static struct notifier_block wdt_notifier = {
        .notifier_call = wdt_notify_sys,
 };
 
@@ -342,31 +347,29 @@ static void __exit w83877f_wdt_unload(void)
        misc_deregister(&wdt_miscdev);
 
        unregister_reboot_notifier(&wdt_notifier);
-       release_region(WDT_PING,1);
-       release_region(ENABLE_W83877F_PORT,2);
+       release_region(WDT_PING, 1);
+       release_region(ENABLE_W83877F_PORT, 2);
 }
 
 static int __init w83877f_wdt_init(void)
 {
        int rc = -EBUSY;
 
-       if(timeout < 1 || timeout > 3600) /* arbitrary upper limit */
-       {
+       if (timeout < 1 || timeout > 3600) { /* arbitrary upper limit */
                timeout = WATCHDOG_TIMEOUT;
-               printk(KERN_INFO PFX "timeout value must be 1<=x<=3600, using %d\n",
-                       timeout);
+               printk(KERN_INFO PFX
+                       "timeout value must be 1 <= x <= 3600, using %d\n",
+                                                       timeout);
        }
 
-       if (!request_region(ENABLE_W83877F_PORT, 2, "W83877F WDT"))
-       {
+       if (!request_region(ENABLE_W83877F_PORT, 2, "W83877F WDT")) {
                printk(KERN_ERR PFX "I/O address 0x%04x already in use\n",
                        ENABLE_W83877F_PORT);
                rc = -EIO;
                goto err_out;
        }
 
-       if (!request_region(WDT_PING, 1, "W8387FF WDT"))
-       {
+       if (!request_region(WDT_PING, 1, "W8387FF WDT")) {
                printk(KERN_ERR PFX "I/O address 0x%04x already in use\n",
                        WDT_PING);
                rc = -EIO;
@@ -374,22 +377,22 @@ static int __init w83877f_wdt_init(void)
        }
 
        rc = register_reboot_notifier(&wdt_notifier);
-       if (rc)
-       {
-               printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
-                       rc);
+       if (rc) {
+               printk(KERN_ERR PFX
+                       "cannot register reboot notifier (err=%d)\n", rc);
                goto err_out_region2;
        }
 
        rc = misc_register(&wdt_miscdev);
-       if (rc)
-       {
-               printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
-                       wdt_miscdev.minor, rc);
+       if (rc) {
+               printk(KERN_ERR PFX
+                       "cannot register miscdev on minor=%d (err=%d)\n",
+                                                       wdt_miscdev.minor, rc);
                goto err_out_reboot;
        }
 
-       printk(KERN_INFO PFX "WDT driver for W83877F initialised. timeout=%d sec (nowayout=%d)\n",
+       printk(KERN_INFO PFX
+         "WDT driver for W83877F initialised. timeout=%d sec (nowayout=%d)\n",
                timeout, nowayout);
 
        return 0;
@@ -397,9 +400,9 @@ static int __init w83877f_wdt_init(void)
 err_out_reboot:
        unregister_reboot_notifier(&wdt_notifier);
 err_out_region2:
-       release_region(WDT_PING,1);
+       release_region(WDT_PING, 1);
 err_out_region1:
-       release_region(ENABLE_W83877F_PORT,2);
+       release_region(ENABLE_W83877F_PORT, 2);
 err_out:
        return rc;
 }
index b209bcd..2525da5 100644 (file)
 #include <linux/watchdog.h>
 #include <linux/notifier.h>
 #include <linux/reboot.h>
+#include <linux/uaccess.h>
+#include <linux/io.h>
 
-#include <asm/io.h>
 #include <asm/system.h>
-#include <asm/uaccess.h>
 
 #define WATCHDOG_VERSION  "1.00"
 #define WATCHDOG_NAME     "W83977F WDT"
@@ -53,13 +53,17 @@ static      char expect_close;
 static DEFINE_SPINLOCK(spinlock);
 
 module_param(timeout, int, 0);
-MODULE_PARM_DESC(timeout,"Watchdog timeout in seconds (15..7635), default=" __MODULE_STRING(DEFAULT_TIMEOUT) ")");
+MODULE_PARM_DESC(timeout,
+               "Watchdog timeout in seconds (15..7635), default="
+                               __MODULE_STRING(DEFAULT_TIMEOUT) ")");
 module_param(testmode, int, 0);
-MODULE_PARM_DESC(testmode,"Watchdog testmode (1 = no reboot), default=0");
+MODULE_PARM_DESC(testmode, "Watchdog testmode (1 = no reboot), default=0");
 
 static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout,
+               "Watchdog cannot be stopped once started (default="
+                               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 /*
  * Start the watchdog
@@ -72,8 +76,8 @@ static int wdt_start(void)
        spin_lock_irqsave(&spinlock, flags);
 
        /* Unlock the SuperIO chip */
-       outb_p(UNLOCK_DATA,IO_INDEX_PORT);
-       outb_p(UNLOCK_DATA,IO_INDEX_PORT);
+       outb_p(UNLOCK_DATA, IO_INDEX_PORT);
+       outb_p(UNLOCK_DATA, IO_INDEX_PORT);
 
        /*
         * Select device Aux2 (device=8) to set watchdog regs F2, F3 and F4.
@@ -81,50 +85,49 @@ static int wdt_start(void)
         * F3 is set to enable watchdog LED blink at timeout.
         * F4 is used to just clear the TIMEOUT'ed state (bit 0).
         */
-       outb_p(DEVICE_REGISTER,IO_INDEX_PORT);
-       outb_p(0x08,IO_DATA_PORT);
-       outb_p(0xF2,IO_INDEX_PORT);
-       outb_p(timeoutW,IO_DATA_PORT);
-       outb_p(0xF3,IO_INDEX_PORT);
-       outb_p(0x08,IO_DATA_PORT);
-       outb_p(0xF4,IO_INDEX_PORT);
-       outb_p(0x00,IO_DATA_PORT);
+       outb_p(DEVICE_REGISTER, IO_INDEX_PORT);
+       outb_p(0x08, IO_DATA_PORT);
+       outb_p(0xF2, IO_INDEX_PORT);
+       outb_p(timeoutW, IO_DATA_PORT);
+       outb_p(0xF3, IO_INDEX_PORT);
+       outb_p(0x08, IO_DATA_PORT);
+       outb_p(0xF4, IO_INDEX_PORT);
+       outb_p(0x00, IO_DATA_PORT);
 
        /* Set device Aux2 active */
-       outb_p(0x30,IO_INDEX_PORT);
-       outb_p(0x01,IO_DATA_PORT);
+       outb_p(0x30, IO_INDEX_PORT);
+       outb_p(0x01, IO_DATA_PORT);
 
-       /* 
+       /*
         * Select device Aux1 (dev=7) to set GP16 as the watchdog output
         * (in reg E6) and GP13 as the watchdog LED output (in reg E3).
         * Map GP16 at pin 119.
         * In test mode watch the bit 0 on F4 to indicate "triggered" or
         * check watchdog LED on SBC.
         */
-       outb_p(DEVICE_REGISTER,IO_INDEX_PORT);
-       outb_p(0x07,IO_DATA_PORT);
-       if (!testmode)
-       {
+       outb_p(DEVICE_REGISTER, IO_INDEX_PORT);
+       outb_p(0x07, IO_DATA_PORT);
+       if (!testmode) {
                unsigned pin_map;
 
-               outb_p(0xE6,IO_INDEX_PORT);
-               outb_p(0x0A,IO_DATA_PORT);
-               outb_p(0x2C,IO_INDEX_PORT);
+               outb_p(0xE6, IO_INDEX_PORT);
+               outb_p(0x0A, IO_DATA_PORT);
+               outb_p(0x2C, IO_INDEX_PORT);
                pin_map = inb_p(IO_DATA_PORT);
                pin_map |= 0x10;
                pin_map &= ~(0x20);
-               outb_p(0x2C,IO_INDEX_PORT);
-               outb_p(pin_map,IO_DATA_PORT);
+               outb_p(0x2C, IO_INDEX_PORT);
+               outb_p(pin_map, IO_DATA_PORT);
        }
-       outb_p(0xE3,IO_INDEX_PORT);
-       outb_p(0x08,IO_DATA_PORT);
+       outb_p(0xE3, IO_INDEX_PORT);
+       outb_p(0x08, IO_DATA_PORT);
 
        /* Set device Aux1 active */
-       outb_p(0x30,IO_INDEX_PORT);
-       outb_p(0x01,IO_DATA_PORT);
+       outb_p(0x30, IO_INDEX_PORT);
+       outb_p(0x01, IO_DATA_PORT);
 
        /* Lock the SuperIO chip */
-       outb_p(LOCK_DATA,IO_INDEX_PORT);
+       outb_p(LOCK_DATA, IO_INDEX_PORT);
 
        spin_unlock_irqrestore(&spinlock, flags);
 
@@ -144,42 +147,41 @@ static int wdt_stop(void)
        spin_lock_irqsave(&spinlock, flags);
 
        /* Unlock the SuperIO chip */
-       outb_p(UNLOCK_DATA,IO_INDEX_PORT);
-       outb_p(UNLOCK_DATA,IO_INDEX_PORT);
+       outb_p(UNLOCK_DATA, IO_INDEX_PORT);
+       outb_p(UNLOCK_DATA, IO_INDEX_PORT);
 
-       /* 
+       /*
         * Select device Aux2 (device=8) to set watchdog regs F2, F3 and F4.
         * F2 is reset to its default value (watchdog timer disabled).
         * F3 is reset to its default state.
         * F4 clears the TIMEOUT'ed state (bit 0) - back to default.
         */
-       outb_p(DEVICE_REGISTER,IO_INDEX_PORT);
-       outb_p(0x08,IO_DATA_PORT);
-       outb_p(0xF2,IO_INDEX_PORT);
-       outb_p(0xFF,IO_DATA_PORT);
-       outb_p(0xF3,IO_INDEX_PORT);
-       outb_p(0x00,IO_DATA_PORT);
-       outb_p(0xF4,IO_INDEX_PORT);
-       outb_p(0x00,IO_DATA_PORT);
-       outb_p(0xF2,IO_INDEX_PORT);
-       outb_p(0x00,IO_DATA_PORT);
+       outb_p(DEVICE_REGISTER, IO_INDEX_PORT);
+       outb_p(0x08, IO_DATA_PORT);
+       outb_p(0xF2, IO_INDEX_PORT);
+       outb_p(0xFF, IO_DATA_PORT);
+       outb_p(0xF3, IO_INDEX_PORT);
+       outb_p(0x00, IO_DATA_PORT);
+       outb_p(0xF4, IO_INDEX_PORT);
+       outb_p(0x00, IO_DATA_PORT);
+       outb_p(0xF2, IO_INDEX_PORT);
+       outb_p(0x00, IO_DATA_PORT);
 
        /*
-        * Select device Aux1 (dev=7) to set GP16 (in reg E6) and 
+        * Select device Aux1 (dev=7) to set GP16 (in reg E6) and
         * Gp13 (in reg E3) as inputs.
         */
-       outb_p(DEVICE_REGISTER,IO_INDEX_PORT);
-       outb_p(0x07,IO_DATA_PORT);
-       if (!testmode)
-       {
-               outb_p(0xE6,IO_INDEX_PORT);
-               outb_p(0x01,IO_DATA_PORT);
+       outb_p(DEVICE_REGISTER, IO_INDEX_PORT);
+       outb_p(0x07, IO_DATA_PORT);
+       if (!testmode) {
+               outb_p(0xE6, IO_INDEX_PORT);
+               outb_p(0x01, IO_DATA_PORT);
        }
-       outb_p(0xE3,IO_INDEX_PORT);
-       outb_p(0x01,IO_DATA_PORT);
+       outb_p(0xE3, IO_INDEX_PORT);
+       outb_p(0x01, IO_DATA_PORT);
 
        /* Lock the SuperIO chip */
-       outb_p(LOCK_DATA,IO_INDEX_PORT);
+       outb_p(LOCK_DATA, IO_INDEX_PORT);
 
        spin_unlock_irqrestore(&spinlock, flags);
 
@@ -200,17 +202,17 @@ static int wdt_keepalive(void)
        spin_lock_irqsave(&spinlock, flags);
 
        /* Unlock the SuperIO chip */
-       outb_p(UNLOCK_DATA,IO_INDEX_PORT);
-       outb_p(UNLOCK_DATA,IO_INDEX_PORT);
+       outb_p(UNLOCK_DATA, IO_INDEX_PORT);
+       outb_p(UNLOCK_DATA, IO_INDEX_PORT);
 
        /* Select device Aux2 (device=8) to kick watchdog reg F2 */
-       outb_p(DEVICE_REGISTER,IO_INDEX_PORT);
-       outb_p(0x08,IO_DATA_PORT);
-       outb_p(0xF2,IO_INDEX_PORT);
-       outb_p(timeoutW,IO_DATA_PORT);
+       outb_p(DEVICE_REGISTER, IO_INDEX_PORT);
+       outb_p(0x08, IO_DATA_PORT);
+       outb_p(0xF2, IO_INDEX_PORT);
+       outb_p(timeoutW, IO_DATA_PORT);
 
        /* Lock the SuperIO chip */
-       outb_p(LOCK_DATA,IO_INDEX_PORT);
+       outb_p(LOCK_DATA, IO_INDEX_PORT);
 
        spin_unlock_irqrestore(&spinlock, flags);
 
@@ -227,7 +229,7 @@ static int wdt_set_timeout(int t)
 
        /*
         * Convert seconds to watchdog counter time units, rounding up.
-        * On PCM-5335 watchdog units are 30 seconds/step with 15 sec startup 
+        * On PCM-5335 watchdog units are 30 seconds/step with 15 sec startup
         * value. This information is supplied in the PCM-5335 manual and was
         * checked by me on a real board. This is a bit strange because W83977f
         * datasheet says counter unit is in minutes!
@@ -241,7 +243,7 @@ static int wdt_set_timeout(int t)
                return -EINVAL;
 
        /*
-        * timeout is the timeout in seconds, 
+        * timeout is the timeout in seconds,
         * timeoutW is the timeout in watchdog counter units.
         */
        timeoutW = tmrval;
@@ -261,17 +263,17 @@ static int wdt_get_status(int *status)
        spin_lock_irqsave(&spinlock, flags);
 
        /* Unlock the SuperIO chip */
-       outb_p(UNLOCK_DATA,IO_INDEX_PORT);
-       outb_p(UNLOCK_DATA,IO_INDEX_PORT);
+       outb_p(UNLOCK_DATA, IO_INDEX_PORT);
+       outb_p(UNLOCK_DATA, IO_INDEX_PORT);
 
        /* Select device Aux2 (device=8) to read watchdog reg F4 */
-       outb_p(DEVICE_REGISTER,IO_INDEX_PORT);
-       outb_p(0x08,IO_DATA_PORT);
-       outb_p(0xF4,IO_INDEX_PORT);
+       outb_p(DEVICE_REGISTER, IO_INDEX_PORT);
+       outb_p(0x08, IO_DATA_PORT);
+       outb_p(0xF4, IO_INDEX_PORT);
        new_status = inb_p(IO_DATA_PORT);
 
        /* Lock the SuperIO chip */
-       outb_p(LOCK_DATA,IO_INDEX_PORT);
+       outb_p(LOCK_DATA, IO_INDEX_PORT);
 
        spin_unlock_irqrestore(&spinlock, flags);
 
@@ -290,7 +292,7 @@ static int wdt_get_status(int *status)
 static int wdt_open(struct inode *inode, struct file *file)
 {
        /* If the watchdog is alive we don't need to start it again */
-       if( test_and_set_bit(0, &timer_alive) )
+       if (test_and_set_bit(0, &timer_alive))
                return -EBUSY;
 
        if (nowayout)
@@ -306,13 +308,13 @@ static int wdt_release(struct inode *inode, struct file *file)
         * Shut off the timer.
         * Lock it in if it's a module and we set nowayout
         */
-       if (expect_close == 42)
-       {
+       if (expect_close == 42) {
                wdt_stop();
                clear_bit(0, &timer_alive);
        } else {
                wdt_keepalive();
-               printk(KERN_CRIT PFX "unexpected close, not stopping watchdog!\n");
+               printk(KERN_CRIT PFX
+                       "unexpected close, not stopping watchdog!\n");
        }
        expect_close = 0;
        return 0;
@@ -333,24 +335,22 @@ static ssize_t wdt_write(struct file *file, const char __user *buf,
                            size_t count, loff_t *ppos)
 {
        /* See if we got the magic character 'V' and reload the timer */
-       if(count)
-       {
-               if (!nowayout)
-               {
+       if (count) {
+               if (!nowayout) {
                        size_t ofs;
 
-                       /* note: just in case someone wrote the magic character long ago */
+                       /* note: just in case someone wrote the
+                          magic character long ago */
                        expect_close = 0;
 
-                       /* scan to see whether or not we got the magic character */
-                       for(ofs = 0; ofs != count; ofs++)
-                       {
+                       /* scan to see whether or not we got the
+                          magic character */
+                       for (ofs = 0; ofs != count; ofs++) {
                                char c;
                                if (get_user(c, buf + ofs))
                                        return -EFAULT;
-                               if (c == 'V') {
+                               if (c == 'V')
                                        expect_close = 42;
-                               }
                        }
                }
 
@@ -377,8 +377,7 @@ static struct watchdog_info ident = {
        .identity = WATCHDOG_NAME,
 };
 
-static int wdt_ioctl(struct inode *inode, struct file *file,
-       unsigned int cmd, unsigned long arg)
+static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
        int status;
        int new_options, retval = -EINVAL;
@@ -390,13 +389,10 @@ static int wdt_ioctl(struct inode *inode, struct file *file,
 
        uarg.i = (int __user *)arg;
 
-       switch(cmd)
-       {
-       default:
-               return -ENOTTY;
-
+       switch (cmd) {
        case WDIOC_GETSUPPORT:
-               return copy_to_user(uarg.ident, &ident, sizeof(ident)) ? -EFAULT : 0;
+               return copy_to_user(uarg.ident, &ident,
+                                               sizeof(ident)) ? -EFAULT : 0;
 
        case WDIOC_GETSTATUS:
                wdt_get_status(&status);
@@ -405,12 +401,8 @@ static int wdt_ioctl(struct inode *inode, struct file *file,
        case WDIOC_GETBOOTSTATUS:
                return put_user(0, uarg.i);
 
-       case WDIOC_KEEPALIVE:
-               wdt_keepalive();
-               return 0;
-
        case WDIOC_SETOPTIONS:
-               if (get_user (new_options, uarg.i))
+               if (get_user(new_options, uarg.i))
                        return -EFAULT;
 
                if (new_options & WDIOS_DISABLECARD) {
@@ -425,6 +417,10 @@ static int wdt_ioctl(struct inode *inode, struct file *file,
 
                return retval;
 
+       case WDIOC_KEEPALIVE:
+               wdt_keepalive();
+               return 0;
+
        case WDIOC_SETTIMEOUT:
                if (get_user(new_timeout, uarg.i))
                        return -EFAULT;
@@ -438,29 +434,30 @@ static int wdt_ioctl(struct inode *inode, struct file *file,
        case WDIOC_GETTIMEOUT:
                return put_user(timeout, uarg.i);
 
+       default:
+               return -ENOTTY;
+
        }
 }
 
 static int wdt_notify_sys(struct notifier_block *this, unsigned long code,
        void *unused)
 {
-       if (code==SYS_DOWN || code==SYS_HALT)
+       if (code == SYS_DOWN || code == SYS_HALT)
                wdt_stop();
        return NOTIFY_DONE;
 }
 
-static const struct file_operations wdt_fops=
-{
+static const struct file_operations wdt_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = wdt_write,
-       .ioctl          = wdt_ioctl,
+       .unlocked_ioctl = wdt_ioctl,
        .open           = wdt_open,
        .release        = wdt_release,
 };
 
-static struct miscdevice wdt_miscdev=
-{
+static struct miscdevice wdt_miscdev = {
        .minor          = WATCHDOG_MINOR,
        .name           = "watchdog",
        .fops           = &wdt_fops,
@@ -474,20 +471,20 @@ static int __init w83977f_wdt_init(void)
 {
        int rc;
 
-        printk(KERN_INFO PFX DRIVER_VERSION);
+       printk(KERN_INFO PFX DRIVER_VERSION);
 
        /*
-        * Check that the timeout value is within it's range ; 
+        * Check that the timeout value is within it's range;
         * if not reset to the default
         */
        if (wdt_set_timeout(timeout)) {
                wdt_set_timeout(DEFAULT_TIMEOUT);
-               printk(KERN_INFO PFX "timeout value must be 15<=timeout<=7635, using %d\n",
-                       DEFAULT_TIMEOUT);
+               printk(KERN_INFO PFX
+                   "timeout value must be 15 <= timeout <= 7635, using %d\n",
+                                                       DEFAULT_TIMEOUT);
        }
 
-       if (!request_region(IO_INDEX_PORT, 2, WATCHDOG_NAME))
-       {
+       if (!request_region(IO_INDEX_PORT, 2, WATCHDOG_NAME)) {
                printk(KERN_ERR PFX "I/O address 0x%04x already in use\n",
                        IO_INDEX_PORT);
                rc = -EIO;
@@ -495,30 +492,30 @@ static int __init w83977f_wdt_init(void)
        }
 
        rc = register_reboot_notifier(&wdt_notifier);
-       if (rc)
-       {
-               printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
-                       rc);
+       if (rc) {
+               printk(KERN_ERR PFX
+                       "cannot register reboot notifier (err=%d)\n", rc);
                goto err_out_region;
        }
 
        rc = misc_register(&wdt_miscdev);
-       if (rc)
-       {
-               printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
-                       wdt_miscdev.minor, rc);
+       if (rc) {
+               printk(KERN_ERR PFX
+                       "cannot register miscdev on minor=%d (err=%d)\n",
+                                               wdt_miscdev.minor, rc);
                goto err_out_reboot;
        }
 
-       printk(KERN_INFO PFX "initialized. timeout=%d sec (nowayout=%d testmode=%d)\n",
-               timeout, nowayout, testmode);
+       printk(KERN_INFO PFX
+               "initialized. timeout=%d sec (nowayout=%d testmode=%d)\n",
+                                       timeout, nowayout, testmode);
 
        return 0;
 
 err_out_reboot:
        unregister_reboot_notifier(&wdt_notifier);
 err_out_region:
-       release_region(IO_INDEX_PORT,2);
+       release_region(IO_INDEX_PORT, 2);
 err_out:
        return rc;
 }
@@ -528,7 +525,7 @@ static void __exit w83977f_wdt_exit(void)
        wdt_stop();
        misc_deregister(&wdt_miscdev);
        unregister_reboot_notifier(&wdt_notifier);
-       release_region(IO_INDEX_PORT,2);
+       release_region(IO_INDEX_PORT, 2);
 }
 
 module_init(w83977f_wdt_init);
index 9e36809..68377ae 100644 (file)
@@ -1,11 +1,11 @@
 /*
  *     ICP Wafer 5823 Single Board Computer WDT driver
- *      http://www.icpamerica.com/wafer_5823.php
- *      May also work on other similar models
+ *     http://www.icpamerica.com/wafer_5823.php
+ *     May also work on other similar models
  *
  *     (c) Copyright 2002 Justin Cormack <justin@street-vision.com>
  *
- *      Release 0.02
+ *     Release 0.02
  *
  *     Based on advantechwdt.c which is based on wdt.c.
  *     Original copyright messages:
@@ -36,8 +36,8 @@
 #include <linux/reboot.h>
 #include <linux/init.h>
 #include <linux/spinlock.h>
-#include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/io.h>
+#include <linux/uaccess.h>
 
 #define WATCHDOG_NAME "Wafer 5823 WDT"
 #define PFX WATCHDOG_NAME ": "
@@ -50,10 +50,10 @@ static DEFINE_SPINLOCK(wafwdt_lock);
 /*
  *     You must set these - there is no sane way to probe for this board.
  *
- *      To enable, write the timeout value in seconds (1 to 255) to I/O
- *      port WDT_START, then read the port to start the watchdog. To pat
- *      the dog, read port WDT_STOP to stop the timer, then read WDT_START
- *      to restart it again.
+ *     To enable, write the timeout value in seconds (1 to 255) to I/O
+ *     port WDT_START, then read the port to start the watchdog. To pat
+ *     the dog, read port WDT_STOP to stop the timer, then read WDT_START
+ *     to restart it again.
  */
 
 static int wdt_stop = 0x843;
@@ -61,11 +61,15 @@ static int wdt_start = 0x443;
 
 static int timeout = WD_TIMO;  /* in seconds */
 module_param(timeout, int, 0);
-MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=255, default=" __MODULE_STRING(WD_TIMO) ".");
+MODULE_PARM_DESC(timeout,
+               "Watchdog timeout in seconds. 1 <= timeout <= 255, default="
+                               __MODULE_STRING(WD_TIMO) ".");
 
 static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout,
+               "Watchdog cannot be stopped once started (default="
+                               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 static void wafwdt_ping(void)
 {
@@ -83,14 +87,14 @@ static void wafwdt_start(void)
        inb_p(wdt_start);
 }
 
-static void
-wafwdt_stop(void)
+static void wafwdt_stop(void)
 {
        /* stop watchdog */
        inb_p(wdt_stop);
 }
 
-static ssize_t wafwdt_write(struct file *file, const char __user *buf, size_t count, loff_t * ppos)
+static ssize_t wafwdt_write(struct file *file, const char __user *buf,
+                                               size_t count, loff_t *ppos)
 {
        /* See if we got the magic character 'V' and reload the timer */
        if (count) {
@@ -100,7 +104,8 @@ static ssize_t wafwdt_write(struct file *file, const char __user *buf, size_t co
                        /* In case it was set long ago */
                        expect_close = 0;
 
-                       /* scan to see whether or not we got the magic character */
+                       /* scan to see whether or not we got the magic
+                          character */
                        for (i = 0; i != count; i++) {
                                char c;
                                if (get_user(c, buf + i))
@@ -109,27 +114,29 @@ static ssize_t wafwdt_write(struct file *file, const char __user *buf, size_t co
                                        expect_close = 42;
                        }
                }
-               /* Well, anyhow someone wrote to us, we should return that favour */
+               /* Well, anyhow someone wrote to us, we should
+                  return that favour */
                wafwdt_ping();
        }
        return count;
 }
 
-static int wafwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-            unsigned long arg)
+static long wafwdt_ioctl(struct file *file, unsigned int cmd,
+                                                       unsigned long arg)
 {
        int new_timeout;
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
-       static struct watchdog_info ident = {
-               .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
+       static const struct watchdog_info ident = {
+               .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT |
+                                                       WDIOF_MAGICCLOSE,
                .firmware_version = 1,
                .identity = "Wafer 5823 WDT",
        };
 
        switch (cmd) {
        case WDIOC_GETSUPPORT:
-               if (copy_to_user(argp, &ident, sizeof (ident)))
+               if (copy_to_user(argp, &ident, sizeof(ident)))
                        return -EFAULT;
                break;
 
@@ -137,22 +144,6 @@ static int wafwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd
        case WDIOC_GETBOOTSTATUS:
                return put_user(0, p);
 
-       case WDIOC_KEEPALIVE:
-               wafwdt_ping();
-               break;
-
-       case WDIOC_SETTIMEOUT:
-               if (get_user(new_timeout, p))
-                       return -EFAULT;
-               if ((new_timeout < 1) || (new_timeout > 255))
-                       return -EINVAL;
-               timeout = new_timeout;
-               wafwdt_stop();
-               wafwdt_start();
-               /* Fall */
-       case WDIOC_GETTIMEOUT:
-               return put_user(timeout, p);
-
        case WDIOC_SETOPTIONS:
        {
                int options, retval = -EINVAL;
@@ -173,6 +164,22 @@ static int wafwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd
                return retval;
        }
 
+       case WDIOC_KEEPALIVE:
+               wafwdt_ping();
+               break;
+
+       case WDIOC_SETTIMEOUT:
+               if (get_user(new_timeout, p))
+                       return -EFAULT;
+               if ((new_timeout < 1) || (new_timeout > 255))
+                       return -EINVAL;
+               timeout = new_timeout;
+               wafwdt_stop();
+               wafwdt_start();
+               /* Fall */
+       case WDIOC_GETTIMEOUT:
+               return put_user(timeout, p);
+
        default:
                return -ENOTTY;
        }
@@ -191,13 +198,13 @@ static int wafwdt_open(struct inode *inode, struct file *file)
        return nonseekable_open(inode, file);
 }
 
-static int
-wafwdt_close(struct inode *inode, struct file *file)
+static int wafwdt_close(struct inode *inode, struct file *file)
 {
-       if (expect_close == 42) {
+       if (expect_close == 42)
                wafwdt_stop();
-       } else {
-               printk(KERN_CRIT PFX "WDT device closed unexpectedly.  WDT will not stop!\n");
+       else {
+               printk(KERN_CRIT PFX
+                   "WDT device closed unexpectedly.  WDT will not stop!\n");
                wafwdt_ping();
        }
        clear_bit(0, &wafwdt_is_open);
@@ -209,12 +216,11 @@ wafwdt_close(struct inode *inode, struct file *file)
  *     Notifier for system down
  */
 
-static int wafwdt_notify_sys(struct notifier_block *this, unsigned long code, void *unused)
+static int wafwdt_notify_sys(struct notifier_block *this, unsigned long code,
+                                                               void *unused)
 {
-       if (code == SYS_DOWN || code == SYS_HALT) {
-               /* Turn the WDT off */
+       if (code == SYS_DOWN || code == SYS_HALT)
                wafwdt_stop();
-       }
        return NOTIFY_DONE;
 }
 
@@ -226,7 +232,7 @@ static const struct file_operations wafwdt_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = wafwdt_write,
-       .ioctl          = wafwdt_ioctl,
+       .unlocked_ioctl = wafwdt_ioctl,
        .open           = wafwdt_open,
        .release        = wafwdt_close,
 };
@@ -250,25 +256,28 @@ static int __init wafwdt_init(void)
 {
        int ret;
 
-       printk(KERN_INFO "WDT driver for Wafer 5823 single board computer initialising.\n");
+       printk(KERN_INFO
+         "WDT driver for Wafer 5823 single board computer initialising.\n");
 
        if (timeout < 1 || timeout > 255) {
                timeout = WD_TIMO;
-               printk (KERN_INFO PFX "timeout value must be 1<=x<=255, using %d\n",
-                       timeout);
+               printk(KERN_INFO PFX
+                       "timeout value must be 1 <= x <= 255, using %d\n",
+                                                               timeout);
        }
 
        if (wdt_stop != wdt_start) {
-               if(!request_region(wdt_stop, 1, "Wafer 5823 WDT")) {
-                       printk (KERN_ERR PFX "I/O address 0x%04x already in use\n",
-                       wdt_stop);
+               if (!request_region(wdt_stop, 1, "Wafer 5823 WDT")) {
+                       printk(KERN_ERR PFX
+                               "I/O address 0x%04x already in use\n",
+                                                               wdt_stop);
                        ret = -EIO;
                        goto error;
                }
        }
 
-       if(!request_region(wdt_start, 1, "Wafer 5823 WDT")) {
-               printk (KERN_ERR PFX "I/O address 0x%04x already in use\n",
+       if (!request_region(wdt_start, 1, "Wafer 5823 WDT")) {
+               printk(KERN_ERR PFX "I/O address 0x%04x already in use\n",
                        wdt_start);
                ret = -EIO;
                goto error2;
@@ -276,19 +285,20 @@ static int __init wafwdt_init(void)
 
        ret = register_reboot_notifier(&wafwdt_notifier);
        if (ret != 0) {
-               printk (KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
-                       ret);
+               printk(KERN_ERR PFX
+                       "cannot register reboot notifier (err=%d)\n", ret);
                goto error3;
        }
 
        ret = misc_register(&wafwdt_miscdev);
        if (ret != 0) {
-               printk (KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
-                       WATCHDOG_MINOR, ret);
+               printk(KERN_ERR PFX
+                       "cannot register miscdev on minor=%d (err=%d)\n",
+                                               WATCHDOG_MINOR, ret);
                goto error4;
        }
 
-       printk (KERN_INFO PFX "initialized. timeout=%d sec (nowayout=%d)\n",
+       printk(KERN_INFO PFX "initialized. timeout=%d sec (nowayout=%d)\n",
                timeout, nowayout);
 
        return ret;
@@ -307,7 +317,7 @@ static void __exit wafwdt_exit(void)
 {
        misc_deregister(&wafwdt_miscdev);
        unregister_reboot_notifier(&wafwdt_notifier);
-       if(wdt_stop != wdt_start)
+       if (wdt_stop != wdt_start)
                release_region(wdt_stop, 1);
        release_region(wdt_start, 1);
 }
index a4504f4..db34853 100644 (file)
@@ -12,7 +12,7 @@
  *     http://www.cymru.net
  *
  *     This driver is provided under the GNU General Public License, incorporated
- *     herein by reference. The driver is provided without warranty or 
+ *     herein by reference. The driver is provided without warranty or
  *     support.
  *
  *     Release 0.04.
index 1d64e27..5d3b1a8 100644 (file)
@@ -35,9 +35,9 @@
 #include <linux/reboot.h>
 #include <linux/types.h>
 #include <linux/watchdog.h>
+#include <linux/uaccess.h>
 
 #include <asm/rtas.h>
-#include <asm/uaccess.h>
 
 #define WDRTAS_MAGIC_CHAR              42
 #define WDRTAS_SUPPORTED_MASK          (WDIOF_SETTIMEOUT | \
@@ -56,7 +56,7 @@ static int wdrtas_nowayout = 0;
 #endif
 
 static atomic_t wdrtas_miscdev_open = ATOMIC_INIT(0);
-static char wdrtas_expect_close = 0;
+static char wdrtas_expect_close;
 
 static int wdrtas_interval;
 
@@ -86,8 +86,8 @@ static char wdrtas_logbuffer[WDRTAS_LOGBUFFER_LEN];
  * RTAS function set-indicator (surveillance). The unit of interval is
  * seconds.
  */
-static int
-wdrtas_set_interval(int interval)
+
+static int wdrtas_set_interval(int interval)
 {
        long result;
        static int print_msg = 10;
@@ -97,7 +97,7 @@ wdrtas_set_interval(int interval)
 
        result = rtas_call(wdrtas_token_set_indicator, 3, 1, NULL,
                           WDRTAS_SURVEILLANCE_IND, 0, interval);
-       if ( (result < 0) && (print_msg) ) {
+       if (result < 0 && print_msg) {
                printk(KERN_ERR "wdrtas: setting the watchdog to %i "
                       "timeout failed: %li\n", interval, result);
                print_msg--;
@@ -116,16 +116,14 @@ wdrtas_set_interval(int interval)
  * as reported by the RTAS function ibm,get-system-parameter. The unit
  * of the return value is seconds.
  */
-static int
-wdrtas_get_interval(int fallback_value)
+static int wdrtas_get_interval(int fallback_value)
 {
        long result;
        char value[4];
 
        result = rtas_call(wdrtas_token_get_sp, 3, 1, NULL,
                           WDRTAS_SP_SPI, (void *)__pa(&value), 4);
-       if ( (value[0] != 0) || (value[1] != 2) || (value[3] != 0) ||
-            (result < 0) ) {
+       if (value[0] != 0 || value[1] != 2 || value[3] != 0 || result < 0) {
                printk(KERN_WARNING "wdrtas: could not get sp_spi watchdog "
                       "timeout (%li). Continuing\n", result);
                return fallback_value;
@@ -141,8 +139,7 @@ wdrtas_get_interval(int fallback_value)
  * wdrtas_timer_start starts the watchdog by calling the RTAS function
  * set-interval (surveillance)
  */
-static void
-wdrtas_timer_start(void)
+static void wdrtas_timer_start(void)
 {
        wdrtas_set_interval(wdrtas_interval);
 }
@@ -153,8 +150,7 @@ wdrtas_timer_start(void)
  * wdrtas_timer_stop stops the watchdog timer by calling the RTAS function
  * set-interval (surveillance)
  */
-static void
-wdrtas_timer_stop(void)
+static void wdrtas_timer_stop(void)
 {
        wdrtas_set_interval(0);
 }
@@ -165,8 +161,7 @@ wdrtas_timer_stop(void)
  * wdrtas_log_scanned_event prints a message to the log buffer dumping
  * the results of the last event-scan call
  */
-static void
-wdrtas_log_scanned_event(void)
+static void wdrtas_log_scanned_event(void)
 {
        int i;
 
@@ -175,13 +170,13 @@ wdrtas_log_scanned_event(void)
                       "%02x %02x %02x %02x  %02x %02x %02x %02x   "
                       "%02x %02x %02x %02x  %02x %02x %02x %02x\n",
                       (i / 16) + 1, (WDRTAS_LOGBUFFER_LEN / 16),
-                      wdrtas_logbuffer[i + 0], wdrtas_logbuffer[i + 1], 
-                      wdrtas_logbuffer[i + 2], wdrtas_logbuffer[i + 3], 
-                      wdrtas_logbuffer[i + 4], wdrtas_logbuffer[i + 5], 
-                      wdrtas_logbuffer[i + 6], wdrtas_logbuffer[i + 7], 
-                      wdrtas_logbuffer[i + 8], wdrtas_logbuffer[i + 9], 
-                      wdrtas_logbuffer[i + 10], wdrtas_logbuffer[i + 11], 
-                      wdrtas_logbuffer[i + 12], wdrtas_logbuffer[i + 13], 
+                      wdrtas_logbuffer[i + 0], wdrtas_logbuffer[i + 1],
+                      wdrtas_logbuffer[i + 2], wdrtas_logbuffer[i + 3],
+                      wdrtas_logbuffer[i + 4], wdrtas_logbuffer[i + 5],
+                      wdrtas_logbuffer[i + 6], wdrtas_logbuffer[i + 7],
+                      wdrtas_logbuffer[i + 8], wdrtas_logbuffer[i + 9],
+                      wdrtas_logbuffer[i + 10], wdrtas_logbuffer[i + 11],
+                      wdrtas_logbuffer[i + 12], wdrtas_logbuffer[i + 13],
                       wdrtas_logbuffer[i + 14], wdrtas_logbuffer[i + 15]);
 }
 
@@ -192,8 +187,7 @@ wdrtas_log_scanned_event(void)
  * RTAS function event-scan and repeats these calls as long as there are
  * events available. All events will be dumped.
  */
-static void
-wdrtas_timer_keepalive(void)
+static void wdrtas_timer_keepalive(void)
 {
        long result;
 
@@ -218,8 +212,7 @@ wdrtas_timer_keepalive(void)
  * wdrtas_get_temperature returns the current temperature in Fahrenheit. It
  * uses the RTAS call get-sensor-state, token 3 to do so
  */
-static int
-wdrtas_get_temperature(void)
+static int wdrtas_get_temperature(void)
 {
        long result;
        int temperature = 0;
@@ -243,8 +236,7 @@ wdrtas_get_temperature(void)
  * returns a bitmask of defines WDIOF_... as defined in
  * include/linux/watchdog.h
  */
-static int
-wdrtas_get_status(void)
+static int wdrtas_get_status(void)
 {
        return 0; /* TODO */
 }
@@ -255,8 +247,7 @@ wdrtas_get_status(void)
  * returns a bitmask of defines WDIOF_... as defined in
  * include/linux/watchdog.h, indicating why the watchdog rebooted the system
  */
-static int
-wdrtas_get_boot_status(void)
+static int wdrtas_get_boot_status(void)
 {
        return 0; /* TODO */
 }
@@ -276,8 +267,7 @@ wdrtas_get_boot_status(void)
  * character 'V'. This character allows the watchdog device to be closed
  * properly.
  */
-static ssize_t
-wdrtas_write(struct file *file, const char __user *buf,
+static ssize_t wdrtas_write(struct file *file, const char __user *buf,
             size_t len, loff_t *ppos)
 {
        int i;
@@ -306,7 +296,6 @@ out:
 
 /**
  * wdrtas_ioctl - ioctl function for the watchdog device
- * @inode: inode structure
  * @file: file structure
  * @cmd: command for ioctl
  * @arg: argument pointer
@@ -315,16 +304,16 @@ out:
  *
  * wdrtas_ioctl implements the watchdog API ioctls
  */
-static int
-wdrtas_ioctl(struct inode *inode, struct file *file,
-            unsigned int cmd, unsigned long arg)
+
+static long wdrtas_ioctl(struct file *file, unsigned int cmd,
+                                                       unsigned long arg)
 {
        int __user *argp = (void __user *)arg;
        int i;
        static struct watchdog_info wdinfo = {
                .options = WDRTAS_SUPPORTED_MASK,
                .firmware_version = 0,
-               .identity = "wdrtas"
+               .identity = "wdrtas",
        };
 
        switch (cmd) {
@@ -357,9 +346,9 @@ wdrtas_ioctl(struct inode *inode, struct file *file,
                        wdrtas_timer_keepalive();
                        wdrtas_timer_start();
                }
+               /* not implemented. Done by H8
                if (i & WDIOS_TEMPPANIC) {
-                       /* not implemented. Done by H8 */
-               }
+               } */
                return 0;
 
        case WDIOC_KEEPALIVE:
@@ -399,8 +388,7 @@ wdrtas_ioctl(struct inode *inode, struct file *file,
  *
  * function called when watchdog device is opened
  */
-static int
-wdrtas_open(struct inode *inode, struct file *file)
+static int wdrtas_open(struct inode *inode, struct file *file)
 {
        /* only open once */
        if (atomic_inc_return(&wdrtas_miscdev_open) > 1) {
@@ -423,8 +411,7 @@ wdrtas_open(struct inode *inode, struct file *file)
  *
  * close function. Always succeeds
  */
-static int
-wdrtas_close(struct inode *inode, struct file *file)
+static int wdrtas_close(struct inode *inode, struct file *file)
 {
        /* only stop watchdog, if this was announced using 'V' before */
        if (wdrtas_expect_close == WDRTAS_MAGIC_CHAR)
@@ -453,8 +440,7 @@ wdrtas_close(struct inode *inode, struct file *file)
  * wdrtas_temp_read gives the temperature to the users by copying this
  * value as one byte into the user space buffer. The unit is Fahrenheit...
  */
-static ssize_t
-wdrtas_temp_read(struct file *file, char __user *buf,
+static ssize_t wdrtas_temp_read(struct file *file, char __user *buf,
                 size_t count, loff_t *ppos)
 {
        int temperature = 0;
@@ -478,8 +464,7 @@ wdrtas_temp_read(struct file *file, char __user *buf,
  *
  * function called when temperature device is opened
  */
-static int
-wdrtas_temp_open(struct inode *inode, struct file *file)
+static int wdrtas_temp_open(struct inode *inode, struct file *file)
 {
        return nonseekable_open(inode, file);
 }
@@ -493,8 +478,7 @@ wdrtas_temp_open(struct inode *inode, struct file *file)
  *
  * close function. Always succeeds
  */
-static int
-wdrtas_temp_close(struct inode *inode, struct file *file)
+static int wdrtas_temp_close(struct inode *inode, struct file *file)
 {
        return 0;
 }
@@ -509,10 +493,10 @@ wdrtas_temp_close(struct inode *inode, struct file *file)
  *
  * wdrtas_reboot stops the watchdog in case of a reboot
  */
-static int
-wdrtas_reboot(struct notifier_block *this, unsigned long code, void *ptr)
+static int wdrtas_reboot(struct notifier_block *this,
+                                       unsigned long code, void *ptr)
 {
-       if ( (code==SYS_DOWN) || (code==SYS_HALT) )
+       if (code == SYS_DOWN || code == SYS_HALT)
                wdrtas_timer_stop();
 
        return NOTIFY_DONE;
@@ -524,7 +508,7 @@ static const struct file_operations wdrtas_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = wdrtas_write,
-       .ioctl          = wdrtas_ioctl,
+       .unlocked_ioctl = wdrtas_ioctl,
        .open           = wdrtas_open,
        .release        = wdrtas_close,
 };
@@ -562,8 +546,7 @@ static struct notifier_block wdrtas_notifier = {
  * this watchdog driver. It tolerates, if "get-sensor-state" and
  * "ibm,get-system-parameter" are not available.
  */
-static int
-wdrtas_get_tokens(void)
+static int wdrtas_get_tokens(void)
 {
        wdrtas_token_get_sensor_state = rtas_token("get-sensor-state");
        if (wdrtas_token_get_sensor_state == RTAS_UNKNOWN_SERVICE) {
@@ -603,8 +586,7 @@ wdrtas_get_tokens(void)
  * wdrtas_register_devs unregisters the watchdog and temperature watchdog
  * misc devs
  */
-static void
-wdrtas_unregister_devs(void)
+static void wdrtas_unregister_devs(void)
 {
        misc_deregister(&wdrtas_miscdev);
        if (wdrtas_token_get_sensor_state != RTAS_UNKNOWN_SERVICE)
@@ -619,8 +601,7 @@ wdrtas_unregister_devs(void)
  * wdrtas_register_devs registers the watchdog and temperature watchdog
  * misc devs
  */
-static int
-wdrtas_register_devs(void)
+static int wdrtas_register_devs(void)
 {
        int result;
 
@@ -651,8 +632,7 @@ wdrtas_register_devs(void)
  *
  * registers the file handlers and the reboot notifier
  */
-static int __init
-wdrtas_init(void)
+static int __init wdrtas_init(void)
 {
        if (wdrtas_get_tokens())
                return -ENODEV;
@@ -680,8 +660,7 @@ wdrtas_init(void)
  *
  * unregisters the file handlers and the reboot notifier
  */
-static void __exit
-wdrtas_exit(void)
+static void __exit wdrtas_exit(void)
 {
        if (!wdrtas_nowayout)
                wdrtas_timer_stop();
index 756fb15..deeebb2 100644 (file)
  *                                     Matt Crocker).
  *             Alan Cox        :       Added wdt= boot option
  *             Alan Cox        :       Cleaned up copy/user stuff
- *             Tim Hockin      :       Added insmod parameters, comment cleanup
- *                                     Parameterized timeout
- *             Tigran Aivazian :       Restructured wdt_init() to handle failures
+ *             Tim Hockin      :       Added insmod parameters, comment
+ *                                     cleanup, parameterized timeout
+ *             Tigran Aivazian :       Restructured wdt_init() to handle
+ *                                     failures
  *             Joel Becker     :       Added WDIOC_GET/SETTIMEOUT
  *             Matt Domsch     :       Added nowayout module option
  */
@@ -42,9 +43,9 @@
 #include <linux/notifier.h>
 #include <linux/reboot.h>
 #include <linux/init.h>
+#include <linux/io.h>
+#include <linux/uaccess.h>
 
-#include <asm/io.h>
-#include <asm/uaccess.h>
 #include <asm/system.h>
 #include "wd501p.h"
 
@@ -60,15 +61,19 @@ static char expect_close;
 static int heartbeat = WD_TIMO;
 static int wd_heartbeat;
 module_param(heartbeat, int, 0);
-MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (0<heartbeat<65536, default=" __MODULE_STRING(WD_TIMO) ")");
+MODULE_PARM_DESC(heartbeat,
+       "Watchdog heartbeat in seconds. (0 < heartbeat < 65536, default="
+                               __MODULE_STRING(WD_TIMO) ")");
 
 static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout,
+       "Watchdog cannot be stopped once started (default="
+                               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 /* You must set these - there is no sane way to probe for this board. */
-static int io=0x240;
-static int irq=11;
+static int io = 0x240;
+static int irq = 11;
 
 static DEFINE_SPINLOCK(wdt_lock);
 
@@ -82,7 +87,8 @@ MODULE_PARM_DESC(irq, "WDT irq (default=11)");
 static int tachometer;
 
 module_param(tachometer, int, 0);
-MODULE_PARM_DESC(tachometer, "WDT501-P Fan Tachometer support (0=disable, default=0)");
+MODULE_PARM_DESC(tachometer,
+               "WDT501-P Fan Tachometer support (0=disable, default=0)");
 #endif /* CONFIG_WDT_501 */
 
 /*
@@ -91,9 +97,9 @@ MODULE_PARM_DESC(tachometer, "WDT501-P Fan Tachometer support (0=disable, defaul
 
 static void wdt_ctr_mode(int ctr, int mode)
 {
-       ctr<<=6;
-       ctr|=0x30;
-       ctr|=(mode<<1);
+       ctr <<= 6;
+       ctr |= 0x30;
+       ctr |= (mode << 1);
        outb_p(ctr, WDT_CR);
 }
 
@@ -114,12 +120,15 @@ static int wdt_start(void)
        unsigned long flags;
        spin_lock_irqsave(&wdt_lock, flags);
        inb_p(WDT_DC);                  /* Disable watchdog */
-       wdt_ctr_mode(0,3);              /* Program CTR0 for Mode 3: Square Wave Generator */
-       wdt_ctr_mode(1,2);              /* Program CTR1 for Mode 2: Rate Generator */
-       wdt_ctr_mode(2,0);              /* Program CTR2 for Mode 0: Pulse on Terminal Count */
+       wdt_ctr_mode(0, 3);             /* Program CTR0 for Mode 3:
+                                               Square Wave Generator */
+       wdt_ctr_mode(1, 2);             /* Program CTR1 for Mode 2:
+                                               Rate Generator */
+       wdt_ctr_mode(2, 0);             /* Program CTR2 for Mode 0:
+                                               Pulse on Terminal Count */
        wdt_ctr_load(0, 8948);          /* Count at 100Hz */
-       wdt_ctr_load(1,wd_heartbeat);   /* Heartbeat */
-       wdt_ctr_load(2,65535);          /* Length of reset pulse */
+       wdt_ctr_load(1, wd_heartbeat);  /* Heartbeat */
+       wdt_ctr_load(2, 65535);         /* Length of reset pulse */
        outb_p(0, WDT_DC);              /* Enable watchdog */
        spin_unlock_irqrestore(&wdt_lock, flags);
        return 0;
@@ -131,13 +140,13 @@ static int wdt_start(void)
  *     Stop the watchdog driver.
  */
 
-static int wdt_stop (void)
+static int wdt_stop(void)
 {
        unsigned long flags;
        spin_lock_irqsave(&wdt_lock, flags);
        /* Turn the card off */
        inb_p(WDT_DC);                  /* Disable watchdog */
-       wdt_ctr_load(2,0);              /* 0 length reset pulses now */
+       wdt_ctr_load(2, 0);             /* 0 length reset pulses now */
        spin_unlock_irqrestore(&wdt_lock, flags);
        return 0;
 }
@@ -145,8 +154,8 @@ static int wdt_stop (void)
 /**
  *     wdt_ping:
  *
- *     Reload counter one with the watchdog heartbeat. We don't bother reloading
- *     the cascade counter.
+ *     Reload counter one with the watchdog heartbeat. We don't bother
+ *     reloading the cascade counter.
  */
 
 static int wdt_ping(void)
@@ -155,8 +164,9 @@ static int wdt_ping(void)
        spin_lock_irqsave(&wdt_lock, flags);
        /* Write a watchdog value */
        inb_p(WDT_DC);                  /* Disable watchdog */
-       wdt_ctr_mode(1,2);              /* Re-Program CTR1 for Mode 2: Rate Generator */
-       wdt_ctr_load(1,wd_heartbeat);   /* Heartbeat */
+       wdt_ctr_mode(1, 2);             /* Re-Program CTR1 for Mode 2:
+                                                       Rate Generator */
+       wdt_ctr_load(1, wd_heartbeat);  /* Heartbeat */
        outb_p(0, WDT_DC);              /* Enable watchdog */
        spin_unlock_irqrestore(&wdt_lock, flags);
        return 0;
@@ -166,13 +176,14 @@ static int wdt_ping(void)
  *     wdt_set_heartbeat:
  *     @t:             the new heartbeat value that needs to be set.
  *
- *     Set a new heartbeat value for the watchdog device. If the heartbeat value is
- *     incorrect we keep the old value and return -EINVAL. If successfull we
- *     return 0.
+ *     Set a new heartbeat value for the watchdog device. If the heartbeat
+ *     value is incorrect we keep the old value and return -EINVAL. If
+ *     successful we return 0.
  */
+
 static int wdt_set_heartbeat(int t)
 {
-       if ((t < 1) || (t > 65535))
+       if (t < 1 || t > 65535)
                return -EINVAL;
 
        heartbeat = t;
@@ -200,7 +211,7 @@ static int wdt_get_status(int *status)
        new_status = inb_p(WDT_SR);
        spin_unlock_irqrestore(&wdt_lock, flags);
 
-       *status=0;
+       *status = 0;
        if (new_status & WDC_SR_ISOI0)
                *status |= WDIOF_EXTERN1;
        if (new_status & WDC_SR_ISII1)
@@ -266,7 +277,7 @@ static irqreturn_t wdt_interrupt(int irq, void *dev_id)
 
 #ifdef CONFIG_WDT_501
        if (!(status & WDC_SR_TGOOD))
-               printk(KERN_CRIT "Overheat alarm.(%d)\n",inb_p(WDT_RT));
+               printk(KERN_CRIT "Overheat alarm.(%d)\n", inb_p(WDT_RT));
        if (!(status & WDC_SR_PSUOVER))
                printk(KERN_CRIT "PSU over voltage.\n");
        if (!(status & WDC_SR_PSUUNDR))
@@ -304,9 +315,10 @@ static irqreturn_t wdt_interrupt(int irq, void *dev_id)
  *     write of data will do, as we we don't define content meaning.
  */
 
-static ssize_t wdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
+static ssize_t wdt_write(struct file *file, const char __user *buf,
+                                               size_t count, loff_t *ppos)
 {
-       if(count) {
+       if (count) {
                if (!nowayout) {
                        size_t i;
 
@@ -328,7 +340,6 @@ static ssize_t wdt_write(struct file *file, const char __user *buf, size_t count
 
 /**
  *     wdt_ioctl:
- *     @inode: inode of the device
  *     @file: file handle to the device
  *     @cmd: watchdog command
  *     @arg: argument pointer
@@ -338,8 +349,7 @@ static ssize_t wdt_write(struct file *file, const char __user *buf, size_t count
  *     querying capabilities and current status.
  */
 
-static int wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-       unsigned long arg)
+static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
@@ -362,32 +372,28 @@ static int wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
                ident.options |= WDIOF_FANFAULT;
 #endif /* CONFIG_WDT_501 */
 
-       switch(cmd)
-       {
-               default:
-                       return -ENOTTY;
-               case WDIOC_GETSUPPORT:
-                       return copy_to_user(argp, &ident, sizeof(ident))?-EFAULT:0;
-
-               case WDIOC_GETSTATUS:
-                       wdt_get_status(&status);
-                       return put_user(status, p);
-               case WDIOC_GETBOOTSTATUS:
-                       return put_user(0, p);
-               case WDIOC_KEEPALIVE:
-                       wdt_ping();
-                       return 0;
-               case WDIOC_SETTIMEOUT:
-                       if (get_user(new_heartbeat, p))
-                               return -EFAULT;
-
-                       if (wdt_set_heartbeat(new_heartbeat))
-                               return -EINVAL;
-
-                       wdt_ping();
-                       /* Fall */
-               case WDIOC_GETTIMEOUT:
-                       return put_user(heartbeat, p);
+       switch (cmd) {
+       case WDIOC_GETSUPPORT:
+               return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
+       case WDIOC_GETSTATUS:
+               wdt_get_status(&status);
+               return put_user(status, p);
+       case WDIOC_GETBOOTSTATUS:
+               return put_user(0, p);
+       case WDIOC_KEEPALIVE:
+               wdt_ping();
+               return 0;
+       case WDIOC_SETTIMEOUT:
+               if (get_user(new_heartbeat, p))
+                       return -EFAULT;
+               if (wdt_set_heartbeat(new_heartbeat))
+                       return -EINVAL;
+               wdt_ping();
+               /* Fall */
+       case WDIOC_GETTIMEOUT:
+               return put_user(heartbeat, p);
+       default:
+               return -ENOTTY;
        }
 }
 
@@ -405,7 +411,7 @@ static int wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
 
 static int wdt_open(struct inode *inode, struct file *file)
 {
-       if(test_and_set_bit(0, &wdt_is_open))
+       if (test_and_set_bit(0, &wdt_is_open))
                return -EBUSY;
        /*
         *      Activate
@@ -432,7 +438,8 @@ static int wdt_release(struct inode *inode, struct file *file)
                wdt_stop();
                clear_bit(0, &wdt_is_open);
        } else {
-               printk(KERN_CRIT "wdt: WDT device closed unexpectedly.  WDT will not stop!\n");
+               printk(KERN_CRIT
+                "wdt: WDT device closed unexpectedly.  WDT will not stop!\n");
                wdt_ping();
        }
        expect_close = 0;
@@ -451,14 +458,15 @@ static int wdt_release(struct inode *inode, struct file *file)
  *     farenheit. It was designed by an imperial measurement luddite.
  */
 
-static ssize_t wdt_temp_read(struct file *file, char __user *buf, size_t count, loff_t *ptr)
+static ssize_t wdt_temp_read(struct file *file, char __user *buf,
+                                               size_t count, loff_t *ptr)
 {
        int temperature;
 
        if (wdt_get_temperature(&temperature))
                return -EFAULT;
 
-       if (copy_to_user (buf, &temperature, 1))
+       if (copy_to_user(buf, &temperature, 1))
                return -EFAULT;
 
        return 1;
@@ -506,10 +514,8 @@ static int wdt_temp_release(struct inode *inode, struct file *file)
 static int wdt_notify_sys(struct notifier_block *this, unsigned long code,
        void *unused)
 {
-       if(code==SYS_DOWN || code==SYS_HALT) {
-               /* Turn the card off */
+       if (code == SYS_DOWN || code == SYS_HALT)
                wdt_stop();
-       }
        return NOTIFY_DONE;
 }
 
@@ -522,7 +528,7 @@ static const struct file_operations wdt_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = wdt_write,
-       .ioctl          = wdt_ioctl,
+       .unlocked_ioctl = wdt_ioctl,
        .open           = wdt_open,
        .release        = wdt_release,
 };
@@ -576,7 +582,7 @@ static void __exit wdt_exit(void)
 #endif /* CONFIG_WDT_501 */
        unregister_reboot_notifier(&wdt_notifier);
        free_irq(irq, NULL);
-       release_region(io,8);
+       release_region(io, 8);
 }
 
 /**
@@ -591,44 +597,49 @@ static int __init wdt_init(void)
 {
        int ret;
 
-       /* Check that the heartbeat value is within it's range ; if not reset to the default */
+       /* Check that the heartbeat value is within it's range;
+          if not reset to the default */
        if (wdt_set_heartbeat(heartbeat)) {
                wdt_set_heartbeat(WD_TIMO);
-               printk(KERN_INFO "wdt: heartbeat value must be 0<heartbeat<65536, using %d\n",
+               printk(KERN_INFO "wdt: heartbeat value must be 0 < heartbeat < 65536, using %d\n",
                        WD_TIMO);
        }
 
        if (!request_region(io, 8, "wdt501p")) {
-               printk(KERN_ERR "wdt: I/O address 0x%04x already in use\n", io);
+               printk(KERN_ERR
+                       "wdt: I/O address 0x%04x already in use\n", io);
                ret = -EBUSY;
                goto out;
        }
 
        ret = request_irq(irq, wdt_interrupt, IRQF_DISABLED, "wdt501p", NULL);
-       if(ret) {
+       if (ret) {
                printk(KERN_ERR "wdt: IRQ %d is not free.\n", irq);
                goto outreg;
        }
 
        ret = register_reboot_notifier(&wdt_notifier);
-       if(ret) {
-               printk(KERN_ERR "wdt: cannot register reboot notifier (err=%d)\n", ret);
+       if (ret) {
+               printk(KERN_ERR
+                     "wdt: cannot register reboot notifier (err=%d)\n", ret);
                goto outirq;
        }
 
 #ifdef CONFIG_WDT_501
        ret = misc_register(&temp_miscdev);
        if (ret) {
-               printk(KERN_ERR "wdt: cannot register miscdev on minor=%d (err=%d)\n",
-                       TEMP_MINOR, ret);
+               printk(KERN_ERR
+                       "wdt: cannot register miscdev on minor=%d (err=%d)\n",
+                                                       TEMP_MINOR, ret);
                goto outrbt;
        }
 #endif /* CONFIG_WDT_501 */
 
        ret = misc_register(&wdt_miscdev);
        if (ret) {
-               printk(KERN_ERR "wdt: cannot register miscdev on minor=%d (err=%d)\n",
-                       WATCHDOG_MINOR, ret);
+               printk(KERN_ERR
+                       "wdt: cannot register miscdev on minor=%d (err=%d)\n",
+                                                       WATCHDOG_MINOR, ret);
                goto outmisc;
        }
 
@@ -636,7 +647,8 @@ static int __init wdt_init(void)
        printk(KERN_INFO "WDT500/501-P driver 0.10 at 0x%04x (Interrupt %d). heartbeat=%d sec (nowayout=%d)\n",
                io, irq, heartbeat, nowayout);
 #ifdef CONFIG_WDT_501
-       printk(KERN_INFO "wdt: Fan Tachometer is %s\n", (tachometer ? "Enabled" : "Disabled"));
+       printk(KERN_INFO "wdt: Fan Tachometer is %s\n",
+                               (tachometer ? "Enabled" : "Disabled"));
 #endif /* CONFIG_WDT_501 */
 
 out:
@@ -651,7 +663,7 @@ outrbt:
 outirq:
        free_irq(irq, NULL);
 outreg:
-       release_region(io,8);
+       release_region(io, 8);
        goto out;
 }
 
index e4cf661..fea398a 100644 (file)
@@ -26,9 +26,9 @@
 #include <linux/reboot.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
+#include <linux/uaccess.h>
+#include <linux/irq.h>
 
-#include <asm/irq.h>
-#include <asm/uaccess.h>
 #include <asm/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/hardware/dec21285.h>
@@ -115,8 +115,8 @@ static int watchdog_release(struct inode *inode, struct file *file)
        return 0;
 }
 
-static ssize_t
-watchdog_write(struct file *file, const char *data, size_t len, loff_t *ppos)
+static ssize_t watchdog_write(struct file *file, const char *data,
+                                               size_t len, loff_t *ppos)
 {
        /*
         *      Refresh the timer.
@@ -127,19 +127,18 @@ watchdog_write(struct file *file, const char *data, size_t len, loff_t *ppos)
        return len;
 }
 
-static struct watchdog_info ident = {
+static const struct watchdog_info ident = {
        .options        = WDIOF_SETTIMEOUT,
        .identity       = "Footbridge Watchdog",
 };
 
-static int
-watchdog_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-              unsigned long arg)
+static long watchdog_ioctl(struct file *file, unsigned int cmd,
+                                                       unsigned long arg)
 {
        unsigned int new_margin;
        int ret = -ENOTTY;
 
-       switch(cmd) {
+       switch (cmd) {
        case WDIOC_GETSUPPORT:
                ret = 0;
                if (copy_to_user((void *)arg, &ident, sizeof(ident)))
@@ -148,7 +147,7 @@ watchdog_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
 
        case WDIOC_GETSTATUS:
        case WDIOC_GETBOOTSTATUS:
-               ret = put_user(0,(int *)arg);
+               ret = put_user(0, (int *)arg);
                break;
 
        case WDIOC_KEEPALIVE:
@@ -182,7 +181,7 @@ static const struct file_operations watchdog_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = watchdog_write,
-       .ioctl          = watchdog_ioctl,
+       .unlocked_ioctl = watchdog_ioctl,
        .open           = watchdog_open,
        .release        = watchdog_release,
 };
@@ -204,11 +203,13 @@ static int __init footbridge_watchdog_init(void)
        if (retval < 0)
                return retval;
 
-       printk("Footbridge Watchdog Timer: 0.01, timer margin: %d sec\n",
-              soft_margin);
+       printk(KERN_INFO
+               "Footbridge Watchdog Timer: 0.01, timer margin: %d sec\n",
+                                                               soft_margin);
 
        if (machine_is_cats())
-               printk("Warning: Watchdog reset may not work on this machine.\n");
+               printk(KERN_WARN
+                 "Warning: Watchdog reset may not work on this machine.\n");
        return 0;
 }
 
@@ -223,7 +224,7 @@ MODULE_LICENSE("GPL");
 MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
 
 module_param(soft_margin, int, 0);
-MODULE_PARM_DESC(soft_margin,"Watchdog timeout in seconds");
+MODULE_PARM_DESC(soft_margin, "Watchdog timeout in seconds");
 
 module_init(footbridge_watchdog_init);
 module_exit(footbridge_watchdog_exit);
index fb4b876..60e28d4 100644 (file)
@@ -19,7 +19,8 @@
  *      07-Jul-2003 Daniele Bellucci: Audit return code of misc_register in
  *                                    nwwatchdog_init.
  *      25-Oct-2005 Woody Suwalski: Convert addresses to #defs, add spinlocks
- *                                 remove limitiation to be used on Netwinders only
+ *                                 remove limitiation to be used on
+ *                                 Netwinders only
  */
 
 #include <linux/module.h>
 #include <linux/watchdog.h>
 #include <linux/notifier.h>
 #include <linux/reboot.h>
+#include <linux/io.h>
+#include <linux/uaccess.h>
 
-#include <asm/io.h>
 #include <asm/system.h>
 #include <asm/mach-types.h>
-#include <asm/uaccess.h>
 
 #define WATCHDOG_VERSION  "0.04"
 #define WATCHDOG_NAME     "Wdt977"
@@ -45,7 +46,7 @@
 #define DRIVER_VERSION    WATCHDOG_NAME " driver, v" WATCHDOG_VERSION "\n"
 
 #define IO_INDEX_PORT  0x370           /* on some systems it can be 0x3F0 */
-#define IO_DATA_PORT   (IO_INDEX_PORT+1)
+#define IO_DATA_PORT   (IO_INDEX_PORT + 1)
 
 #define UNLOCK_DATA    0x87
 #define LOCK_DATA      0xAA
@@ -62,13 +63,16 @@ static      char expect_close;
 static DEFINE_SPINLOCK(spinlock);
 
 module_param(timeout, int, 0);
-MODULE_PARM_DESC(timeout,"Watchdog timeout in seconds (60..15300), default=" __MODULE_STRING(DEFAULT_TIMEOUT) ")");
+MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds (60..15300), default="
+                               __MODULE_STRING(DEFAULT_TIMEOUT) ")");
 module_param(testmode, int, 0);
-MODULE_PARM_DESC(testmode,"Watchdog testmode (1 = no reboot), default=0");
+MODULE_PARM_DESC(testmode, "Watchdog testmode (1 = no reboot), default=0");
 
 static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout,
+               "Watchdog cannot be stopped once started (default="
+                               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 /*
  * Start the watchdog
@@ -95,14 +99,16 @@ static int wdt977_start(void)
        outb_p(0xF2, IO_INDEX_PORT);
        outb_p(timeoutM, IO_DATA_PORT);
        outb_p(0xF3, IO_INDEX_PORT);
-       outb_p(0x00, IO_DATA_PORT);     /* another setting is 0E for kbd/mouse/LED */
+       outb_p(0x00, IO_DATA_PORT);     /* another setting is 0E for
+                                          kbd/mouse/LED */
        outb_p(0xF4, IO_INDEX_PORT);
        outb_p(0x00, IO_DATA_PORT);
 
-       /* at last select device Aux1 (dev=7) and set GP16 as a watchdog output */
-       /* in test mode watch the bit 1 on F4 to indicate "triggered" */
-       if (!testmode)
-       {
+       /* At last select device Aux1 (dev=7) and set GP16 as a
+        * watchdog output. In test mode watch the bit 1 on F4 to
+        * indicate "triggered"
+        */
+       if (!testmode) {
                outb_p(DEVICE_REGISTER, IO_INDEX_PORT);
                outb_p(0x07, IO_DATA_PORT);
                outb_p(0xE6, IO_INDEX_PORT);
@@ -147,7 +153,8 @@ static int wdt977_stop(void)
        outb_p(0xF2, IO_INDEX_PORT);
        outb_p(0x00, IO_DATA_PORT);
 
-       /* at last select device Aux1 (dev=7) and set GP16 as a watchdog output */
+       /* at last select device Aux1 (dev=7) and set
+          GP16 as a watchdog output */
        outb_p(DEVICE_REGISTER, IO_INDEX_PORT);
        outb_p(0x07, IO_DATA_PORT);
        outb_p(0xE6, IO_INDEX_PORT);
@@ -202,16 +209,18 @@ static int wdt977_set_timeout(int t)
        tmrval = (t + 59) / 60;
 
        if (machine_is_netwinder()) {
-               /* we have a hw bug somewhere, so each 977 minute is actually only 30sec
-                *  this limits the max timeout to half of device max of 255 minutes...
+               /* we have a hw bug somewhere, so each 977 minute is actually
+                * only 30sec. This limits the max timeout to half of device
+                * max of 255 minutes...
                 */
                tmrval += tmrval;
        }
 
-       if ((tmrval < 1) || (tmrval > 255))
+       if (tmrval < 1 || tmrval > 255)
                return -EINVAL;
 
-       /* timeout is the timeout in seconds, timeoutM is the timeout in minutes) */
+       /* timeout is the timeout in seconds, timeoutM is
+          the timeout in minutes) */
        timeout = t;
        timeoutM = tmrval;
        return 0;
@@ -243,7 +252,7 @@ static int wdt977_get_status(int *status)
 
        spin_unlock_irqrestore(&spinlock, flags);
 
-       *status=0;
+       *status = 0;
        if (new_status & 1)
                *status |= WDIOF_CARDRESET;
 
@@ -258,7 +267,7 @@ static int wdt977_get_status(int *status)
 static int wdt977_open(struct inode *inode, struct file *file)
 {
        /* If the watchdog is alive we don't need to start it again */
-       if( test_and_set_bit(0,&timer_alive) )
+       if (test_and_set_bit(0, &timer_alive))
                return -EBUSY;
 
        if (nowayout)
@@ -274,13 +283,13 @@ static int wdt977_release(struct inode *inode, struct file *file)
         *      Shut off the timer.
         *      Lock it in if it's a module and we set nowayout
         */
-       if (expect_close == 42)
-       {
+       if (expect_close == 42) {
                wdt977_stop();
-               clear_bit(0,&timer_alive);
+               clear_bit(0, &timer_alive);
        } else {
                wdt977_keepalive();
-               printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
+               printk(KERN_CRIT PFX
+                       "Unexpected close, not stopping watchdog!\n");
        }
        expect_close = 0;
        return 0;
@@ -301,17 +310,14 @@ static int wdt977_release(struct inode *inode, struct file *file)
 static ssize_t wdt977_write(struct file *file, const char __user *buf,
                            size_t count, loff_t *ppos)
 {
-       if (count)
-       {
-               if (!nowayout)
-               {
+       if (count) {
+               if (!nowayout) {
                        size_t i;
 
                        /* In case it was set long ago */
                        expect_close = 0;
 
-                       for (i = 0; i != count; i++)
-                       {
+                       for (i = 0; i != count; i++) {
                                char c;
                                if (get_user(c, buf + i))
                                        return -EFAULT;
@@ -326,6 +332,14 @@ static ssize_t wdt977_write(struct file *file, const char __user *buf,
        return count;
 }
 
+static const struct watchdog_info ident = {
+       .options =              WDIOF_SETTIMEOUT |
+                               WDIOF_MAGICCLOSE |
+                               WDIOF_KEEPALIVEPING,
+       .firmware_version =     1,
+       .identity =             WATCHDOG_NAME,
+};
+
 /*
  *      wdt977_ioctl:
  *      @inode: inode of the device
@@ -337,16 +351,8 @@ static ssize_t wdt977_write(struct file *file, const char __user *buf,
  *      according to their available features.
  */
 
-static struct watchdog_info ident = {
-       .options =              WDIOF_SETTIMEOUT |
-                               WDIOF_MAGICCLOSE |
-                               WDIOF_KEEPALIVEPING,
-       .firmware_version =     1,
-       .identity =             WATCHDOG_NAME,
-};
-
-static int wdt977_ioctl(struct inode *inode, struct file *file,
-       unsigned int cmd, unsigned long arg)
+static long wdt977_ioctl(struct file *file, unsigned int cmd,
+                                                       unsigned long arg)
 {
        int status;
        int new_options, retval = -EINVAL;
@@ -358,11 +364,7 @@ static int wdt977_ioctl(struct inode *inode, struct file *file,
 
        uarg.i = (int __user *)arg;
 
-       switch(cmd)
-       {
-       default:
-               return -ENOTTY;
-
+       switch (cmd) {
        case WDIOC_GETSUPPORT:
                return copy_to_user(uarg.ident, &ident,
                        sizeof(ident)) ? -EFAULT : 0;
@@ -374,12 +376,8 @@ static int wdt977_ioctl(struct inode *inode, struct file *file,
        case WDIOC_GETBOOTSTATUS:
                return put_user(0, uarg.i);
 
-       case WDIOC_KEEPALIVE:
-               wdt977_keepalive();
-               return 0;
-
        case WDIOC_SETOPTIONS:
-               if (get_user (new_options, uarg.i))
+               if (get_user(new_options, uarg.i))
                        return -EFAULT;
 
                if (new_options & WDIOS_DISABLECARD) {
@@ -394,6 +392,10 @@ static int wdt977_ioctl(struct inode *inode, struct file *file,
 
                return retval;
 
+       case WDIOC_KEEPALIVE:
+               wdt977_keepalive();
+               return 0;
+
        case WDIOC_SETTIMEOUT:
                if (get_user(new_timeout, uarg.i))
                        return -EFAULT;
@@ -407,29 +409,30 @@ static int wdt977_ioctl(struct inode *inode, struct file *file,
        case WDIOC_GETTIMEOUT:
                return put_user(timeout, uarg.i);
 
+       default:
+               return -ENOTTY;
+
        }
 }
 
 static int wdt977_notify_sys(struct notifier_block *this, unsigned long code,
        void *unused)
 {
-       if(code==SYS_DOWN || code==SYS_HALT)
+       if (code == SYS_DOWN || code == SYS_HALT)
                wdt977_stop();
        return NOTIFY_DONE;
 }
 
-static const struct file_operations wdt977_fops=
-{
+static const struct file_operations wdt977_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = wdt977_write,
-       .ioctl          = wdt977_ioctl,
+       .unlocked_ioctl = wdt977_ioctl,
        .open           = wdt977_open,
        .release        = wdt977_release,
 };
 
-static struct miscdevice wdt977_miscdev=
-{
+static struct miscdevice wdt977_miscdev = {
        .minor          = WATCHDOG_MINOR,
        .name           = "watchdog",
        .fops           = &wdt977_fops,
@@ -443,51 +446,48 @@ static int __init wd977_init(void)
 {
        int rc;
 
-       //if (!machine_is_netwinder())
-       //      return -ENODEV;
-
        printk(KERN_INFO PFX DRIVER_VERSION);
 
-       /* Check that the timeout value is within it's range ; if not reset to the default */
-       if (wdt977_set_timeout(timeout))
-       {
+       /* Check that the timeout value is within its range;
+          if not reset to the default */
+       if (wdt977_set_timeout(timeout)) {
                wdt977_set_timeout(DEFAULT_TIMEOUT);
-               printk(KERN_INFO PFX "timeout value must be 60<timeout<15300, using %d\n",
-                       DEFAULT_TIMEOUT);
+               printk(KERN_INFO PFX
+                     "timeout value must be 60 < timeout < 15300, using %d\n",
+                                                       DEFAULT_TIMEOUT);
        }
 
        /* on Netwinder the IOports are already reserved by
         * arch/arm/mach-footbridge/netwinder-hw.c
         */
-       if (!machine_is_netwinder())
-       {
-               if (!request_region(IO_INDEX_PORT, 2, WATCHDOG_NAME))
-               {
-                       printk(KERN_ERR PFX "I/O address 0x%04x already in use\n",
-                               IO_INDEX_PORT);
+       if (!machine_is_netwinder()) {
+               if (!request_region(IO_INDEX_PORT, 2, WATCHDOG_NAME)) {
+                       printk(KERN_ERR PFX
+                               "I/O address 0x%04x already in use\n",
+                                                               IO_INDEX_PORT);
                        rc = -EIO;
                        goto err_out;
                }
        }
 
        rc = register_reboot_notifier(&wdt977_notifier);
-       if (rc)
-       {
-               printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
-                       rc);
+       if (rc) {
+               printk(KERN_ERR PFX
+                       "cannot register reboot notifier (err=%d)\n", rc);
                goto err_out_region;
        }
 
        rc = misc_register(&wdt977_miscdev);
-       if (rc)
-       {
-               printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
-                       wdt977_miscdev.minor, rc);
+       if (rc) {
+               printk(KERN_ERR PFX
+                       "cannot register miscdev on minor=%d (err=%d)\n",
+                                               wdt977_miscdev.minor, rc);
                goto err_out_reboot;
        }
 
-       printk(KERN_INFO PFX "initialized. timeout=%d sec (nowayout=%d, testmode=%i)\n",
-               timeout, nowayout, testmode);
+       printk(KERN_INFO PFX
+               "initialized. timeout=%d sec (nowayout=%d, testmode=%i)\n",
+                                               timeout, nowayout, testmode);
 
        return 0;
 
@@ -495,7 +495,7 @@ err_out_reboot:
        unregister_reboot_notifier(&wdt977_notifier);
 err_out_region:
        if (!machine_is_netwinder())
-               release_region(IO_INDEX_PORT,2);
+               release_region(IO_INDEX_PORT, 2);
 err_out:
        return rc;
 }
@@ -505,7 +505,7 @@ static void __exit wd977_exit(void)
        wdt977_stop();
        misc_deregister(&wdt977_miscdev);
        unregister_reboot_notifier(&wdt977_notifier);
-       release_region(IO_INDEX_PORT,2);
+       release_region(IO_INDEX_PORT, 2);
 }
 
 module_init(wd977_init);
index 1355608..ed02bdb 100644 (file)
  *             JP Nollmann     :       Added support for PCI wdt501p
  *             Alan Cox        :       Split ISA and PCI cards into two drivers
  *             Jeff Garzik     :       PCI cleanups
- *             Tigran Aivazian :       Restructured wdtpci_init_one() to handle failures
+ *             Tigran Aivazian :       Restructured wdtpci_init_one() to handle
+ *                                     failures
  *             Joel Becker     :       Added WDIOC_GET/SETTIMEOUT
- *             Zwane Mwaikambo :       Magic char closing, locking changes, cleanups
+ *             Zwane Mwaikambo :       Magic char closing, locking changes,
+ *                                     cleanups
  *             Matt Domsch     :       nowayout module option
  */
 
 #include <linux/miscdevice.h>
 #include <linux/watchdog.h>
 #include <linux/ioport.h>
+#include <linux/delay.h>
 #include <linux/notifier.h>
 #include <linux/reboot.h>
 #include <linux/init.h>
 #include <linux/fs.h>
 #include <linux/pci.h>
+#include <linux/io.h>
+#include <linux/uaccess.h>
 
-#include <asm/io.h>
-#include <asm/uaccess.h>
 #include <asm/system.h>
 
 #define WDT_IS_PCI
@@ -73,7 +76,7 @@
 /* We can only use 1 card due to the /dev/watchdog restriction */
 static int dev_count;
 
-static struct semaphore open_sem;
+static unsigned long open_lock;
 static DEFINE_SPINLOCK(wdtpci_lock);
 static char expect_close;
 
@@ -86,18 +89,23 @@ static int irq;
 static int heartbeat = WD_TIMO;
 static int wd_heartbeat;
 module_param(heartbeat, int, 0);
-MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (0<heartbeat<65536, default=" __MODULE_STRING(WD_TIMO) ")");
+MODULE_PARM_DESC(heartbeat,
+               "Watchdog heartbeat in seconds. (0<heartbeat<65536, default="
+                               __MODULE_STRING(WD_TIMO) ")");
 
 static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout,
+               "Watchdog cannot be stopped once started (default="
+                               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 #ifdef CONFIG_WDT_501_PCI
 /* Support for the Fan Tachometer on the PCI-WDT501 */
 static int tachometer;
 
 module_param(tachometer, int, 0);
-MODULE_PARM_DESC(tachometer, "PCI-WDT501 Fan Tachometer support (0=disable, default=0)");
+MODULE_PARM_DESC(tachometer,
+       "PCI-WDT501 Fan Tachometer support (0=disable, default=0)");
 #endif /* CONFIG_WDT_501_PCI */
 
 /*
@@ -106,16 +114,19 @@ MODULE_PARM_DESC(tachometer, "PCI-WDT501 Fan Tachometer support (0=disable, defa
 
 static void wdtpci_ctr_mode(int ctr, int mode)
 {
-       ctr<<=6;
-       ctr|=0x30;
-       ctr|=(mode<<1);
-       outb_p(ctr, WDT_CR);
+       ctr <<= 6;
+       ctr |= 0x30;
+       ctr |= (mode << 1);
+       outb(ctr, WDT_CR);
+       udelay(8);
 }
 
 static void wdtpci_ctr_load(int ctr, int val)
 {
-       outb_p(val&0xFF, WDT_COUNT0+ctr);
-       outb_p(val>>8, WDT_COUNT0+ctr);
+       outb(val & 0xFF, WDT_COUNT0 + ctr);
+       udelay(8);
+       outb(val >> 8, WDT_COUNT0 + ctr);
+       udelay(8);
 }
 
 /**
@@ -134,23 +145,35 @@ static int wdtpci_start(void)
         * "pet" the watchdog, as Access says.
         * This resets the clock outputs.
         */
-       inb_p(WDT_DC);                  /* Disable watchdog */
-       wdtpci_ctr_mode(2,0);           /* Program CTR2 for Mode 0: Pulse on Terminal Count */
-       outb_p(0, WDT_DC);              /* Enable watchdog */
-
-       inb_p(WDT_DC);                  /* Disable watchdog */
-       outb_p(0, WDT_CLOCK);           /* 2.0833MHz clock */
-       inb_p(WDT_BUZZER);              /* disable */
-       inb_p(WDT_OPTONOTRST);          /* disable */
-       inb_p(WDT_OPTORST);             /* disable */
-       inb_p(WDT_PROGOUT);             /* disable */
-       wdtpci_ctr_mode(0,3);           /* Program CTR0 for Mode 3: Square Wave Generator */
-       wdtpci_ctr_mode(1,2);           /* Program CTR1 for Mode 2: Rate Generator */
-       wdtpci_ctr_mode(2,1);           /* Program CTR2 for Mode 1: Retriggerable One-Shot */
-       wdtpci_ctr_load(0,20833);       /* count at 100Hz */
-       wdtpci_ctr_load(1,wd_heartbeat);/* Heartbeat */
+       inb(WDT_DC);                    /* Disable watchdog */
+       udelay(8);
+       wdtpci_ctr_mode(2, 0);          /* Program CTR2 for Mode 0:
+                                               Pulse on Terminal Count */
+       outb(0, WDT_DC);                /* Enable watchdog */
+       udelay(8);
+       inb(WDT_DC);                    /* Disable watchdog */
+       udelay(8);
+       outb(0, WDT_CLOCK);             /* 2.0833MHz clock */
+       udelay(8);
+       inb(WDT_BUZZER);                /* disable */
+       udelay(8);
+       inb(WDT_OPTONOTRST);            /* disable */
+       udelay(8);
+       inb(WDT_OPTORST);               /* disable */
+       udelay(8);
+       inb(WDT_PROGOUT);               /* disable */
+       udelay(8);
+       wdtpci_ctr_mode(0, 3);          /* Program CTR0 for Mode 3:
+                                               Square Wave Generator */
+       wdtpci_ctr_mode(1, 2);          /* Program CTR1 for Mode 2:
+                                               Rate Generator */
+       wdtpci_ctr_mode(2, 1);          /* Program CTR2 for Mode 1:
+                                               Retriggerable One-Shot */
+       wdtpci_ctr_load(0, 20833);      /* count at 100Hz */
+       wdtpci_ctr_load(1, wd_heartbeat);/* Heartbeat */
        /* DO NOT LOAD CTR2 on PCI card! -- JPN */
-       outb_p(0, WDT_DC);              /* Enable watchdog */
+       outb(0, WDT_DC);                /* Enable watchdog */
+       udelay(8);
 
        spin_unlock_irqrestore(&wdtpci_lock, flags);
        return 0;
@@ -162,14 +185,15 @@ static int wdtpci_start(void)
  *     Stop the watchdog driver.
  */
 
-static int wdtpci_stop (void)
+static int wdtpci_stop(void)
 {
        unsigned long flags;
 
        /* Turn the card off */
        spin_lock_irqsave(&wdtpci_lock, flags);
-       inb_p(WDT_DC);                  /* Disable watchdog */
-       wdtpci_ctr_load(2,0);           /* 0 length reset pulses now */
+       inb(WDT_DC);                    /* Disable watchdog */
+       udelay(8);
+       wdtpci_ctr_load(2, 0);          /* 0 length reset pulses now */
        spin_unlock_irqrestore(&wdtpci_lock, flags);
        return 0;
 }
@@ -177,20 +201,23 @@ static int wdtpci_stop (void)
 /**
  *     wdtpci_ping:
  *
- *     Reload counter one with the watchdog heartbeat. We don't bother reloading
- *     the cascade counter.
+ *     Reload counter one with the watchdog heartbeat. We don't bother
+ *     reloading the cascade counter.
  */
 
 static int wdtpci_ping(void)
 {
        unsigned long flags;
 
-       /* Write a watchdog value */
        spin_lock_irqsave(&wdtpci_lock, flags);
-       inb_p(WDT_DC);                  /* Disable watchdog */
-       wdtpci_ctr_mode(1,2);           /* Re-Program CTR1 for Mode 2: Rate Generator */
-       wdtpci_ctr_load(1,wd_heartbeat);/* Heartbeat */
-       outb_p(0, WDT_DC);              /* Enable watchdog */
+       /* Write a watchdog value */
+       inb(WDT_DC);                    /* Disable watchdog */
+       udelay(8);
+       wdtpci_ctr_mode(1, 2);          /* Re-Program CTR1 for Mode 2:
+                                                       Rate Generator */
+       wdtpci_ctr_load(1, wd_heartbeat);/* Heartbeat */
+       outb(0, WDT_DC);                /* Enable watchdog */
+       udelay(8);
        spin_unlock_irqrestore(&wdtpci_lock, flags);
        return 0;
 }
@@ -199,14 +226,14 @@ static int wdtpci_ping(void)
  *     wdtpci_set_heartbeat:
  *     @t:             the new heartbeat value that needs to be set.
  *
- *     Set a new heartbeat value for the watchdog device. If the heartbeat value is
- *     incorrect we keep the old value and return -EINVAL. If successfull we
- *     return 0.
+ *     Set a new heartbeat value for the watchdog device. If the heartbeat
+ *     value is incorrect we keep the old value and return -EINVAL.
+ *     If successful we return 0.
  */
 static int wdtpci_set_heartbeat(int t)
 {
        /* Arbitrary, can't find the card's limits */
-       if ((t < 1) || (t > 65535))
+       if (t < 1 || t > 65535)
                return -EINVAL;
 
        heartbeat = t;
@@ -227,9 +254,14 @@ static int wdtpci_set_heartbeat(int t)
 
 static int wdtpci_get_status(int *status)
 {
-       unsigned char new_status=inb_p(WDT_SR);
+       unsigned char new_status;
+       unsigned long flags;
+
+       spin_lock_irqsave(&wdtpci_lock, flags);
+       new_status = inb(WDT_SR);
+       spin_unlock_irqrestore(&wdtpci_lock, flags);
 
-       *status=0;
+       *status = 0;
        if (new_status & WDC_SR_ISOI0)
                *status |= WDIOF_EXTERN1;
        if (new_status & WDC_SR_ISII1)
@@ -259,8 +291,12 @@ static int wdtpci_get_status(int *status)
 
 static int wdtpci_get_temperature(int *temperature)
 {
-       unsigned short c=inb_p(WDT_RT);
-
+       unsigned short c;
+       unsigned long flags;
+       spin_lock_irqsave(&wdtpci_lock, flags);
+       c = inb(WDT_RT);
+       udelay(8);
+       spin_unlock_irqrestore(&wdtpci_lock, flags);
        *temperature = (c * 11 / 15) + 7;
        return 0;
 }
@@ -282,17 +318,25 @@ static irqreturn_t wdtpci_interrupt(int irq, void *dev_id)
         *      Read the status register see what is up and
         *      then printk it.
         */
-       unsigned char status=inb_p(WDT_SR);
+       unsigned char status;
+
+       spin_lock(&wdtpci_lock);
+
+       status = inb(WDT_SR);
+       udelay(8);
 
        printk(KERN_CRIT PFX "status %d\n", status);
 
 #ifdef CONFIG_WDT_501_PCI
-       if (!(status & WDC_SR_TGOOD))
-               printk(KERN_CRIT PFX "Overheat alarm.(%d)\n",inb_p(WDT_RT));
+       if (!(status & WDC_SR_TGOOD)) {
+               u8 alarm = inb(WDT_RT);
+               printk(KERN_CRIT PFX "Overheat alarm.(%d)\n", alarm);
+               udelay(8);
+       }
        if (!(status & WDC_SR_PSUOVER))
-               printk(KERN_CRIT PFX "PSU over voltage.\n");
+               printk(KERN_CRIT PFX "PSU over voltage.\n");
        if (!(status & WDC_SR_PSUUNDR))
-               printk(KERN_CRIT PFX "PSU under voltage.\n");
+               printk(KERN_CRIT PFX "PSU under voltage.\n");
        if (tachometer) {
                if (!(status & WDC_SR_FANGOOD))
                        printk(KERN_CRIT PFX "Possible fan fault.\n");
@@ -310,6 +354,7 @@ static irqreturn_t wdtpci_interrupt(int irq, void *dev_id)
                printk(KERN_CRIT PFX "Reset in 5ms.\n");
 #endif
        }
+       spin_unlock(&wdtpci_lock);
        return IRQ_HANDLED;
 }
 
@@ -325,7 +370,8 @@ static irqreturn_t wdtpci_interrupt(int irq, void *dev_id)
  *     write of data will do, as we we don't define content meaning.
  */
 
-static ssize_t wdtpci_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
+static ssize_t wdtpci_write(struct file *file, const char __user *buf,
+                                       size_t count, loff_t *ppos)
 {
        if (count) {
                if (!nowayout) {
@@ -335,7 +381,7 @@ static ssize_t wdtpci_write(struct file *file, const char __user *buf, size_t co
 
                        for (i = 0; i != count; i++) {
                                char c;
-                               if(get_user(c, buf+i))
+                               if (get_user(c, buf + i))
                                        return -EFAULT;
                                if (c == 'V')
                                        expect_close = 42;
@@ -343,13 +389,11 @@ static ssize_t wdtpci_write(struct file *file, const char __user *buf, size_t co
                }
                wdtpci_ping();
        }
-
        return count;
 }
 
 /**
  *     wdtpci_ioctl:
- *     @inode: inode of the device
  *     @file: file handle to the device
  *     @cmd: watchdog command
  *     @arg: argument pointer
@@ -359,8 +403,8 @@ static ssize_t wdtpci_write(struct file *file, const char __user *buf, size_t co
  *     querying capabilities and current status.
  */
 
-static int wdtpci_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-       unsigned long arg)
+static long wdtpci_ioctl(struct file *file, unsigned int cmd,
+                                                       unsigned long arg)
 {
        int new_heartbeat;
        int status;
@@ -383,32 +427,28 @@ static int wdtpci_ioctl(struct inode *inode, struct file *file, unsigned int cmd
                ident.options |= WDIOF_FANFAULT;
 #endif /* CONFIG_WDT_501_PCI */
 
-       switch(cmd)
-       {
-               default:
-                       return -ENOTTY;
-               case WDIOC_GETSUPPORT:
-                       return copy_to_user(argp, &ident, sizeof(ident))?-EFAULT:0;
-
-               case WDIOC_GETSTATUS:
-                       wdtpci_get_status(&status);
-                       return put_user(status, p);
-               case WDIOC_GETBOOTSTATUS:
-                       return put_user(0, p);
-               case WDIOC_KEEPALIVE:
-                       wdtpci_ping();
-                       return 0;
-               case WDIOC_SETTIMEOUT:
-                       if (get_user(new_heartbeat, p))
-                               return -EFAULT;
-
-                       if (wdtpci_set_heartbeat(new_heartbeat))
-                               return -EINVAL;
-
-                       wdtpci_ping();
-                       /* Fall */
-               case WDIOC_GETTIMEOUT:
-                       return put_user(heartbeat, p);
+       switch (cmd) {
+       case WDIOC_GETSUPPORT:
+               return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
+       case WDIOC_GETSTATUS:
+               wdtpci_get_status(&status);
+               return put_user(status, p);
+       case WDIOC_GETBOOTSTATUS:
+               return put_user(0, p);
+       case WDIOC_KEEPALIVE:
+               wdtpci_ping();
+               return 0;
+       case WDIOC_SETTIMEOUT:
+               if (get_user(new_heartbeat, p))
+                       return -EFAULT;
+               if (wdtpci_set_heartbeat(new_heartbeat))
+                       return -EINVAL;
+               wdtpci_ping();
+               /* Fall */
+       case WDIOC_GETTIMEOUT:
+               return put_user(heartbeat, p);
+       default:
+               return -ENOTTY;
        }
 }
 
@@ -426,12 +466,11 @@ static int wdtpci_ioctl(struct inode *inode, struct file *file, unsigned int cmd
 
 static int wdtpci_open(struct inode *inode, struct file *file)
 {
-       if (down_trylock(&open_sem))
+       if (test_and_set_bit(0, &open_lock))
                return -EBUSY;
 
-       if (nowayout) {
+       if (nowayout)
                __module_get(THIS_MODULE);
-       }
        /*
         *      Activate
         */
@@ -460,7 +499,7 @@ static int wdtpci_release(struct inode *inode, struct file *file)
                wdtpci_ping();
        }
        expect_close = 0;
-       up(&open_sem);
+       clear_bit(0, &open_lock);
        return 0;
 }
 
@@ -476,14 +515,15 @@ static int wdtpci_release(struct inode *inode, struct file *file)
  *     fahrenheit. It was designed by an imperial measurement luddite.
  */
 
-static ssize_t wdtpci_temp_read(struct file *file, char __user *buf, size_t count, loff_t *ptr)
+static ssize_t wdtpci_temp_read(struct file *file, char __user *buf,
+                                               size_t count, loff_t *ptr)
 {
        int temperature;
 
        if (wdtpci_get_temperature(&temperature))
                return -EFAULT;
 
-       if (copy_to_user (buf, &temperature, 1))
+       if (copy_to_user(buf, &temperature, 1))
                return -EFAULT;
 
        return 1;
@@ -529,12 +569,10 @@ static int wdtpci_temp_release(struct inode *inode, struct file *file)
  */
 
 static int wdtpci_notify_sys(struct notifier_block *this, unsigned long code,
-       void *unused)
+                                                       void *unused)
 {
-       if (code==SYS_DOWN || code==SYS_HALT) {
-               /* Turn the card off */
+       if (code == SYS_DOWN || code == SYS_HALT)
                wdtpci_stop();
-       }
        return NOTIFY_DONE;
 }
 
@@ -547,7 +585,7 @@ static const struct file_operations wdtpci_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = wdtpci_write,
-       .ioctl          = wdtpci_ioctl,
+       .unlocked_ioctl = wdtpci_ioctl,
        .open           = wdtpci_open,
        .release        = wdtpci_release,
 };
@@ -584,80 +622,85 @@ static struct notifier_block wdtpci_notifier = {
 };
 
 
-static int __devinit wdtpci_init_one (struct pci_dev *dev,
-                                  const struct pci_device_id *ent)
+static int __devinit wdtpci_init_one(struct pci_dev *dev,
+                                       const struct pci_device_id *ent)
 {
        int ret = -EIO;
 
        dev_count++;
        if (dev_count > 1) {
-               printk (KERN_ERR PFX "this driver only supports 1 device\n");
+               printk(KERN_ERR PFX "This driver only supports one device\n");
                return -ENODEV;
        }
 
-       if (pci_enable_device (dev)) {
-               printk (KERN_ERR PFX "Not possible to enable PCI Device\n");
+       if (pci_enable_device(dev)) {
+               printk(KERN_ERR PFX "Not possible to enable PCI Device\n");
                return -ENODEV;
        }
 
-       if (pci_resource_start (dev, 2) == 0x0000) {
-               printk (KERN_ERR PFX "No I/O-Address for card detected\n");
+       if (pci_resource_start(dev, 2) == 0x0000) {
+               printk(KERN_ERR PFX "No I/O-Address for card detected\n");
                ret = -ENODEV;
                goto out_pci;
        }
 
-       sema_init(&open_sem, 1);
-
        irq = dev->irq;
-       io = pci_resource_start (dev, 2);
+       io = pci_resource_start(dev, 2);
 
-       if (request_region (io, 16, "wdt_pci") == NULL) {
-               printk (KERN_ERR PFX "I/O address 0x%04x already in use\n", io);
+       if (request_region(io, 16, "wdt_pci") == NULL) {
+               printk(KERN_ERR PFX "I/O address 0x%04x already in use\n", io);
                goto out_pci;
        }
 
-       if (request_irq (irq, wdtpci_interrupt, IRQF_DISABLED | IRQF_SHARED,
+       if (request_irq(irq, wdtpci_interrupt, IRQF_DISABLED | IRQF_SHARED,
                         "wdt_pci", &wdtpci_miscdev)) {
-               printk (KERN_ERR PFX "IRQ %d is not free\n", irq);
+               printk(KERN_ERR PFX "IRQ %d is not free\n", irq);
                goto out_reg;
        }
 
-       printk ("PCI-WDT500/501 (PCI-WDG-CSM) driver 0.10 at 0x%04x (Interrupt %d)\n",
-               io, irq);
+       printk(KERN_INFO
+        "PCI-WDT500/501 (PCI-WDG-CSM) driver 0.10 at 0x%04x (Interrupt %d)\n",
+                                                               io, irq);
 
-       /* Check that the heartbeat value is within it's range ; if not reset to the default */
+       /* Check that the heartbeat value is within its range;
+          if not reset to the default */
        if (wdtpci_set_heartbeat(heartbeat)) {
                wdtpci_set_heartbeat(WD_TIMO);
-               printk(KERN_INFO PFX "heartbeat value must be 0<heartbeat<65536, using %d\n",
-                       WD_TIMO);
+               printk(KERN_INFO PFX
+                 "heartbeat value must be 0 < heartbeat < 65536, using %d\n",
+                                                               WD_TIMO);
        }
 
-       ret = register_reboot_notifier (&wdtpci_notifier);
+       ret = register_reboot_notifier(&wdtpci_notifier);
        if (ret) {
-               printk (KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", ret);
+               printk(KERN_ERR PFX
+                       "cannot register reboot notifier (err=%d)\n", ret);
                goto out_irq;
        }
 
 #ifdef CONFIG_WDT_501_PCI
-       ret = misc_register (&temp_miscdev);
+       ret = misc_register(&temp_miscdev);
        if (ret) {
-               printk (KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
-                       TEMP_MINOR, ret);
+               printk(KERN_ERR PFX
+                       "cannot register miscdev on minor=%d (err=%d)\n",
+                                       TEMP_MINOR, ret);
                goto out_rbt;
        }
 #endif /* CONFIG_WDT_501_PCI */
 
-       ret = misc_register (&wdtpci_miscdev);
+       ret = misc_register(&wdtpci_miscdev);
        if (ret) {
-               printk (KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
-                       WATCHDOG_MINOR, ret);
+               printk(KERN_ERR PFX
+                       "cannot register miscdev on minor=%d (err=%d)\n",
+                                               WATCHDOG_MINOR, ret);
                goto out_misc;
        }
 
        printk(KERN_INFO PFX "initialized. heartbeat=%d sec (nowayout=%d)\n",
                heartbeat, nowayout);
 #ifdef CONFIG_WDT_501_PCI
-       printk(KERN_INFO "wdt: Fan Tachometer is %s\n", (tachometer ? "Enabled" : "Disabled"));
+       printk(KERN_INFO "wdt: Fan Tachometer is %s\n",
+                               (tachometer ? "Enabled" : "Disabled"));
 #endif /* CONFIG_WDT_501_PCI */
 
        ret = 0;
@@ -673,14 +716,14 @@ out_rbt:
 out_irq:
        free_irq(irq, &wdtpci_miscdev);
 out_reg:
-       release_region (io, 16);
+       release_region(io, 16);
 out_pci:
        pci_disable_device(dev);
        goto out;
 }
 
 
-static void __devexit wdtpci_remove_one (struct pci_dev *pdev)
+static void __devexit wdtpci_remove_one(struct pci_dev *pdev)
 {
        /* here we assume only one device will ever have
         * been picked up and registered by probe function */
@@ -728,7 +771,7 @@ static struct pci_driver wdtpci_driver = {
 
 static void __exit wdtpci_cleanup(void)
 {
-       pci_unregister_driver (&wdtpci_driver);
+       pci_unregister_driver(&wdtpci_driver);
 }
 
 
@@ -742,7 +785,7 @@ static void __exit wdtpci_cleanup(void)
 
 static int __init wdtpci_init(void)
 {
-       return pci_register_driver (&wdtpci_driver);
+       return pci_register_driver(&wdtpci_driver);
 }
 
 
index 660b191..8f7fdaa 100644 (file)
@@ -250,19 +250,19 @@ static void file_record(struct ihex_binrec *record)
 
 static int output_records(int outfd)
 {
-       unsigned char zeroes[5] = {0, 0, 0, 0, 0};
+       unsigned char zeroes[6] = {0, 0, 0, 0, 0, 0};
        struct ihex_binrec *p = records;
 
        while (p) {
                uint16_t writelen = (p->len + 9) & ~3;
 
                p->addr = htonl(p->addr);
-               p->len = htonl(p->len);
+               p->len = htons(p->len);
                write(outfd, &p->addr, writelen);
                p = p->next;
        }
        /* EOF record is zero length, since we don't bother to represent
           the type field in the binary version */
-       write(outfd, zeroes, 5);
+       write(outfd, zeroes, 6);
        return 0;
 }
index 2f55039..78db495 100644 (file)
@@ -232,7 +232,7 @@ static void *afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd)
        }
 
        mntget(newmnt);
-       err = do_add_mount(newmnt, nd, MNT_SHRINKABLE, &afs_vfsmounts);
+       err = do_add_mount(newmnt, &nd->path, MNT_SHRINKABLE, &afs_vfsmounts);
        switch (err) {
        case 0:
                path_put(&nd->path);
index 9a849ad..065b4e1 100644 (file)
@@ -404,7 +404,7 @@ static int afs_write_back_from_locked_page(struct afs_writeback *wb,
                        page = pages[loop];
                        if (page->index > wb->last)
                                break;
-                       if (TestSetPageLocked(page))
+                       if (!trylock_page(page))
                                break;
                        if (!PageDirty(page) ||
                            page_private(page) != (unsigned long) wb) {
index 25f1af0..8000e2f 100644 (file)
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -77,11 +77,8 @@ struct bio_vec *bvec_alloc_bs(gfp_t gfp_mask, int nr, unsigned long *idx, struct
         */
 
        bvl = mempool_alloc(bs->bvec_pools[*idx], gfp_mask);
-       if (bvl) {
-               struct biovec_slab *bp = bvec_slabs + *idx;
-
-               memset(bvl, 0, bp->nr_vecs * sizeof(struct bio_vec));
-       }
+       if (bvl)
+               memset(bvl, 0, bvec_nr_vecs(*idx) * sizeof(struct bio_vec));
 
        return bvl;
 }
@@ -149,7 +146,7 @@ struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs)
                                goto out;
                        }
                        bio->bi_flags |= idx << BIO_POOL_OFFSET;
-                       bio->bi_max_vecs = bvec_slabs[idx].nr_vecs;
+                       bio->bi_max_vecs = bvec_nr_vecs(idx);
                }
                bio->bi_io_vec = bvl;
        }
index dcf37ca..aff5421 100644 (file)
@@ -941,8 +941,10 @@ static int do_open(struct block_device *bdev, struct file *file, int for_part)
         * hooks: /n/, see "layering violations".
         */
        ret = devcgroup_inode_permission(bdev->bd_inode, perm);
-       if (ret != 0)
+       if (ret != 0) {
+               bdput(bdev);
                return ret;
+       }
 
        ret = -ENXIO;
        file->f_mapping = bdev->bd_inode->i_mapping;
@@ -1234,6 +1236,7 @@ fail:
        bdev = ERR_PTR(error);
        goto out;
 }
+EXPORT_SYMBOL(lookup_bdev);
 
 /**
  * open_bdev_excl  -  open a block device by name and set it up for use
index ca12a6b..38653e3 100644 (file)
@@ -580,7 +580,7 @@ EXPORT_SYMBOL(mark_buffer_async_write);
 /*
  * The buffer's backing address_space's private_lock must be held
  */
-static inline void __remove_assoc_queue(struct buffer_head *bh)
+static void __remove_assoc_queue(struct buffer_head *bh)
 {
        list_del_init(&bh->b_assoc_buffers);
        WARN_ON(!bh->b_assoc_map);
@@ -1720,7 +1720,7 @@ static int __block_write_full_page(struct inode *inode, struct page *page,
                 */
                if (wbc->sync_mode != WB_SYNC_NONE || !wbc->nonblocking) {
                        lock_buffer(bh);
-               } else if (test_set_buffer_locked(bh)) {
+               } else if (!trylock_buffer(bh)) {
                        redirty_page_for_writepage(wbc, page);
                        continue;
                }
@@ -3000,7 +3000,7 @@ void ll_rw_block(int rw, int nr, struct buffer_head *bhs[])
 
                if (rw == SWRITE || rw == SWRITE_SYNC)
                        lock_buffer(bh);
-               else if (test_set_buffer_locked(bh))
+               else if (!trylock_buffer(bh))
                        continue;
 
                if (rw == WRITE || rw == SWRITE || rw == SWRITE_SYNC) {
index d82374c..d2c8eef 100644 (file)
@@ -226,7 +226,7 @@ static int add_mount_helper(struct vfsmount *newmnt, struct nameidata *nd,
        int err;
 
        mntget(newmnt);
-       err = do_add_mount(newmnt, nd, nd->path.mnt->mnt_flags, mntlist);
+       err = do_add_mount(newmnt, &nd->path, nd->path.mnt->mnt_flags, mntlist);
        switch (err) {
        case 0:
                path_put(&nd->path);
index 0aac824..e692c42 100644 (file)
@@ -1280,7 +1280,7 @@ retry:
 
                        if (first < 0)
                                lock_page(page);
-                       else if (TestSetPageLocked(page))
+                       else if (!trylock_page(page))
                                break;
 
                        if (unlikely(page->mapping != mapping)) {
index da015c1..762d287 100644 (file)
@@ -49,8 +49,10 @@ struct configfs_dirent {
 #define CONFIGFS_USET_DEFAULT  0x0080
 #define CONFIGFS_USET_DROPPING 0x0100
 #define CONFIGFS_USET_IN_MKDIR 0x0200
+#define CONFIGFS_USET_CREATING 0x0400
 #define CONFIGFS_NOT_PINNED    (CONFIGFS_ITEM_ATTR)
 
+extern struct mutex configfs_symlink_mutex;
 extern spinlock_t configfs_dirent_lock;
 
 extern struct vfsmount * configfs_mount;
@@ -66,6 +68,7 @@ extern void configfs_inode_exit(void);
 extern int configfs_create_file(struct config_item *, const struct configfs_attribute *);
 extern int configfs_make_dirent(struct configfs_dirent *,
                                struct dentry *, void *, umode_t, int);
+extern int configfs_dirent_is_ready(struct configfs_dirent *);
 
 extern int configfs_add_file(struct dentry *, const struct configfs_attribute *, int);
 extern void configfs_hash_and_remove(struct dentry * dir, const char * name);
index 179589b..7a8db78 100644 (file)
@@ -185,7 +185,7 @@ static int create_dir(struct config_item * k, struct dentry * p,
        error = configfs_dirent_exists(p->d_fsdata, d->d_name.name);
        if (!error)
                error = configfs_make_dirent(p->d_fsdata, d, k, mode,
-                                            CONFIGFS_DIR);
+                                            CONFIGFS_DIR | CONFIGFS_USET_CREATING);
        if (!error) {
                error = configfs_create(d, mode, init_dir);
                if (!error) {
@@ -209,6 +209,9 @@ static int create_dir(struct config_item * k, struct dentry * p,
  *     configfs_create_dir - create a directory for an config_item.
  *     @item:          config_itemwe're creating directory for.
  *     @dentry:        config_item's dentry.
+ *
+ *     Note: user-created entries won't be allowed under this new directory
+ *     until it is validated by configfs_dir_set_ready()
  */
 
 static int configfs_create_dir(struct config_item * item, struct dentry *dentry)
@@ -231,6 +234,44 @@ static int configfs_create_dir(struct config_item * item, struct dentry *dentry)
        return error;
 }
 
+/*
+ * Allow userspace to create new entries under a new directory created with
+ * configfs_create_dir(), and under all of its chidlren directories recursively.
+ * @sd         configfs_dirent of the new directory to validate
+ *
+ * Caller must hold configfs_dirent_lock.
+ */
+static void configfs_dir_set_ready(struct configfs_dirent *sd)
+{
+       struct configfs_dirent *child_sd;
+
+       sd->s_type &= ~CONFIGFS_USET_CREATING;
+       list_for_each_entry(child_sd, &sd->s_children, s_sibling)
+               if (child_sd->s_type & CONFIGFS_USET_CREATING)
+                       configfs_dir_set_ready(child_sd);
+}
+
+/*
+ * Check that a directory does not belong to a directory hierarchy being
+ * attached and not validated yet.
+ * @sd         configfs_dirent of the directory to check
+ *
+ * @return     non-zero iff the directory was validated
+ *
+ * Note: takes configfs_dirent_lock, so the result may change from false to true
+ * in two consecutive calls, but never from true to false.
+ */
+int configfs_dirent_is_ready(struct configfs_dirent *sd)
+{
+       int ret;
+
+       spin_lock(&configfs_dirent_lock);
+       ret = !(sd->s_type & CONFIGFS_USET_CREATING);
+       spin_unlock(&configfs_dirent_lock);
+
+       return ret;
+}
+
 int configfs_create_link(struct configfs_symlink *sl,
                         struct dentry *parent,
                         struct dentry *dentry)
@@ -283,6 +324,8 @@ static void remove_dir(struct dentry * d)
  * The only thing special about this is that we remove any files in
  * the directory before we remove the directory, and we've inlined
  * what used to be configfs_rmdir() below, instead of calling separately.
+ *
+ * Caller holds the mutex of the item's inode
  */
 
 static void configfs_remove_dir(struct config_item * item)
@@ -330,7 +373,19 @@ static struct dentry * configfs_lookup(struct inode *dir,
        struct configfs_dirent * parent_sd = dentry->d_parent->d_fsdata;
        struct configfs_dirent * sd;
        int found = 0;
-       int err = 0;
+       int err;
+
+       /*
+        * Fake invisibility if dir belongs to a group/default groups hierarchy
+        * being attached
+        *
+        * This forbids userspace to read/write attributes of items which may
+        * not complete their initialization, since the dentries of the
+        * attributes won't be instantiated.
+        */
+       err = -ENOENT;
+       if (!configfs_dirent_is_ready(parent_sd))
+               goto out;
 
        list_for_each_entry(sd, &parent_sd->s_children, s_sibling) {
                if (sd->s_type & CONFIGFS_NOT_PINNED) {
@@ -353,6 +408,7 @@ static struct dentry * configfs_lookup(struct inode *dir,
                return simple_lookup(dir, dentry, nd);
        }
 
+out:
        return ERR_PTR(err);
 }
 
@@ -370,13 +426,17 @@ static int configfs_detach_prep(struct dentry *dentry, struct mutex **wait_mutex
        struct configfs_dirent *sd;
        int ret;
 
+       /* Mark that we're trying to drop the group */
+       parent_sd->s_type |= CONFIGFS_USET_DROPPING;
+
        ret = -EBUSY;
        if (!list_empty(&parent_sd->s_links))
                goto out;
 
        ret = 0;
        list_for_each_entry(sd, &parent_sd->s_children, s_sibling) {
-               if (sd->s_type & CONFIGFS_NOT_PINNED)
+               if (!sd->s_element ||
+                   (sd->s_type & CONFIGFS_NOT_PINNED))
                        continue;
                if (sd->s_type & CONFIGFS_USET_DEFAULT) {
                        /* Abort if racing with mkdir() */
@@ -385,8 +445,6 @@ static int configfs_detach_prep(struct dentry *dentry, struct mutex **wait_mutex
                                        *wait_mutex = &sd->s_dentry->d_inode->i_mutex;
                                return -EAGAIN;
                        }
-                       /* Mark that we're trying to drop the group */
-                       sd->s_type |= CONFIGFS_USET_DROPPING;
 
                        /*
                         * Yup, recursive.  If there's a problem, blame
@@ -414,12 +472,11 @@ static void configfs_detach_rollback(struct dentry *dentry)
        struct configfs_dirent *parent_sd = dentry->d_fsdata;
        struct configfs_dirent *sd;
 
-       list_for_each_entry(sd, &parent_sd->s_children, s_sibling) {
-               if (sd->s_type & CONFIGFS_USET_DEFAULT) {
+       parent_sd->s_type &= ~CONFIGFS_USET_DROPPING;
+
+       list_for_each_entry(sd, &parent_sd->s_children, s_sibling)
+               if (sd->s_type & CONFIGFS_USET_DEFAULT)
                        configfs_detach_rollback(sd->s_dentry);
-                       sd->s_type &= ~CONFIGFS_USET_DROPPING;
-               }
-       }
 }
 
 static void detach_attrs(struct config_item * item)
@@ -558,36 +615,21 @@ static int create_default_group(struct config_group *parent_group,
 static int populate_groups(struct config_group *group)
 {
        struct config_group *new_group;
-       struct dentry *dentry = group->cg_item.ci_dentry;
        int ret = 0;
        int i;
 
        if (group->default_groups) {
-               /*
-                * FYI, we're faking mkdir here
-                * I'm not sure we need this semaphore, as we're called
-                * from our parent's mkdir.  That holds our parent's
-                * i_mutex, so afaik lookup cannot continue through our
-                * parent to find us, let alone mess with our tree.
-                * That said, taking our i_mutex is closer to mkdir
-                * emulation, and shouldn't hurt.
-                */
-               mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_CHILD);
-
                for (i = 0; group->default_groups[i]; i++) {
                        new_group = group->default_groups[i];
 
                        ret = create_default_group(group, new_group);
-                       if (ret)
+                       if (ret) {
+                               detach_groups(group);
                                break;
+                       }
                }
-
-               mutex_unlock(&dentry->d_inode->i_mutex);
        }
 
-       if (ret)
-               detach_groups(group);
-
        return ret;
 }
 
@@ -702,7 +744,15 @@ static int configfs_attach_item(struct config_item *parent_item,
        if (!ret) {
                ret = populate_attrs(item);
                if (ret) {
+                       /*
+                        * We are going to remove an inode and its dentry but
+                        * the VFS may already have hit and used them. Thus,
+                        * we must lock them as rmdir() would.
+                        */
+                       mutex_lock(&dentry->d_inode->i_mutex);
                        configfs_remove_dir(item);
+                       dentry->d_inode->i_flags |= S_DEAD;
+                       mutex_unlock(&dentry->d_inode->i_mutex);
                        d_delete(dentry);
                }
        }
@@ -710,6 +760,7 @@ static int configfs_attach_item(struct config_item *parent_item,
        return ret;
 }
 
+/* Caller holds the mutex of the item's inode */
 static void configfs_detach_item(struct config_item *item)
 {
        detach_attrs(item);
@@ -728,16 +779,30 @@ static int configfs_attach_group(struct config_item *parent_item,
                sd = dentry->d_fsdata;
                sd->s_type |= CONFIGFS_USET_DIR;
 
+               /*
+                * FYI, we're faking mkdir in populate_groups()
+                * We must lock the group's inode to avoid races with the VFS
+                * which can already hit the inode and try to add/remove entries
+                * under it.
+                *
+                * We must also lock the inode to remove it safely in case of
+                * error, as rmdir() would.
+                */
+               mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_CHILD);
                ret = populate_groups(to_config_group(item));
                if (ret) {
                        configfs_detach_item(item);
-                       d_delete(dentry);
+                       dentry->d_inode->i_flags |= S_DEAD;
                }
+               mutex_unlock(&dentry->d_inode->i_mutex);
+               if (ret)
+                       d_delete(dentry);
        }
 
        return ret;
 }
 
+/* Caller holds the mutex of the group's inode */
 static void configfs_detach_group(struct config_item *item)
 {
        detach_groups(to_config_group(item));
@@ -1035,7 +1100,7 @@ static int configfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
        struct configfs_subsystem *subsys;
        struct configfs_dirent *sd;
        struct config_item_type *type;
-       struct module *owner = NULL;
+       struct module *subsys_owner = NULL, *new_item_owner = NULL;
        char *name;
 
        if (dentry->d_parent == configfs_sb->s_root) {
@@ -1044,6 +1109,16 @@ static int configfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
        }
 
        sd = dentry->d_parent->d_fsdata;
+
+       /*
+        * Fake invisibility if dir belongs to a group/default groups hierarchy
+        * being attached
+        */
+       if (!configfs_dirent_is_ready(sd)) {
+               ret = -ENOENT;
+               goto out;
+       }
+
        if (!(sd->s_type & CONFIGFS_USET_DIR)) {
                ret = -EPERM;
                goto out;
@@ -1062,10 +1137,25 @@ static int configfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
                goto out_put;
        }
 
+       /*
+        * The subsystem may belong to a different module than the item
+        * being created.  We don't want to safely pin the new item but
+        * fail to pin the subsystem it sits under.
+        */
+       if (!subsys->su_group.cg_item.ci_type) {
+               ret = -EINVAL;
+               goto out_put;
+       }
+       subsys_owner = subsys->su_group.cg_item.ci_type->ct_owner;
+       if (!try_module_get(subsys_owner)) {
+               ret = -EINVAL;
+               goto out_put;
+       }
+
        name = kmalloc(dentry->d_name.len + 1, GFP_KERNEL);
        if (!name) {
                ret = -ENOMEM;
-               goto out_put;
+               goto out_subsys_put;
        }
 
        snprintf(name, dentry->d_name.len + 1, "%s", dentry->d_name.name);
@@ -1094,10 +1184,10 @@ static int configfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
        kfree(name);
        if (ret) {
                /*
-                * If item == NULL, then link_obj() was never called.
+                * If ret != 0, then link_obj() was never called.
                 * There are no extra references to clean up.
                 */
-               goto out_put;
+               goto out_subsys_put;
        }
 
        /*
@@ -1111,8 +1201,8 @@ static int configfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
                goto out_unlink;
        }
 
-       owner = type->ct_owner;
-       if (!try_module_get(owner)) {
+       new_item_owner = type->ct_owner;
+       if (!try_module_get(new_item_owner)) {
                ret = -EINVAL;
                goto out_unlink;
        }
@@ -1142,6 +1232,8 @@ static int configfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
 
        spin_lock(&configfs_dirent_lock);
        sd->s_type &= ~CONFIGFS_USET_IN_MKDIR;
+       if (!ret)
+               configfs_dir_set_ready(dentry->d_fsdata);
        spin_unlock(&configfs_dirent_lock);
 
 out_unlink:
@@ -1159,9 +1251,13 @@ out_unlink:
                mutex_unlock(&subsys->su_mutex);
 
                if (module_got)
-                       module_put(owner);
+                       module_put(new_item_owner);
        }
 
+out_subsys_put:
+       if (ret)
+               module_put(subsys_owner);
+
 out_put:
        /*
         * link_obj()/link_group() took a reference from child->parent,
@@ -1180,7 +1276,7 @@ static int configfs_rmdir(struct inode *dir, struct dentry *dentry)
        struct config_item *item;
        struct configfs_subsystem *subsys;
        struct configfs_dirent *sd;
-       struct module *owner = NULL;
+       struct module *subsys_owner = NULL, *dead_item_owner = NULL;
        int ret;
 
        if (dentry->d_parent == configfs_sb->s_root)
@@ -1207,6 +1303,15 @@ static int configfs_rmdir(struct inode *dir, struct dentry *dentry)
                return -EINVAL;
        }
 
+       /* configfs_mkdir() shouldn't have allowed this */
+       BUG_ON(!subsys->su_group.cg_item.ci_type);
+       subsys_owner = subsys->su_group.cg_item.ci_type->ct_owner;
+
+       /*
+        * Ensure that no racing symlink() will make detach_prep() fail while
+        * the new link is temporarily attached
+        */
+       mutex_lock(&configfs_symlink_mutex);
        spin_lock(&configfs_dirent_lock);
        do {
                struct mutex *wait_mutex;
@@ -1215,6 +1320,7 @@ static int configfs_rmdir(struct inode *dir, struct dentry *dentry)
                if (ret) {
                        configfs_detach_rollback(dentry);
                        spin_unlock(&configfs_dirent_lock);
+                       mutex_unlock(&configfs_symlink_mutex);
                        if (ret != -EAGAIN) {
                                config_item_put(parent_item);
                                return ret;
@@ -1224,10 +1330,12 @@ static int configfs_rmdir(struct inode *dir, struct dentry *dentry)
                        mutex_lock(wait_mutex);
                        mutex_unlock(wait_mutex);
 
+                       mutex_lock(&configfs_symlink_mutex);
                        spin_lock(&configfs_dirent_lock);
                }
        } while (ret == -EAGAIN);
        spin_unlock(&configfs_dirent_lock);
+       mutex_unlock(&configfs_symlink_mutex);
 
        /* Get a working ref for the duration of this function */
        item = configfs_get_config_item(dentry);
@@ -1236,7 +1344,7 @@ static int configfs_rmdir(struct inode *dir, struct dentry *dentry)
        config_item_put(parent_item);
 
        if (item->ci_type)
-               owner = item->ci_type->ct_owner;
+               dead_item_owner = item->ci_type->ct_owner;
 
        if (sd->s_type & CONFIGFS_USET_DIR) {
                configfs_detach_group(item);
@@ -1258,7 +1366,8 @@ static int configfs_rmdir(struct inode *dir, struct dentry *dentry)
        /* Drop our reference from above */
        config_item_put(item);
 
-       module_put(owner);
+       module_put(dead_item_owner);
+       module_put(subsys_owner);
 
        return 0;
 }
@@ -1314,13 +1423,24 @@ static int configfs_dir_open(struct inode *inode, struct file *file)
 {
        struct dentry * dentry = file->f_path.dentry;
        struct configfs_dirent * parent_sd = dentry->d_fsdata;
+       int err;
 
        mutex_lock(&dentry->d_inode->i_mutex);
-       file->private_data = configfs_new_dirent(parent_sd, NULL);
+       /*
+        * Fake invisibility if dir belongs to a group/default groups hierarchy
+        * being attached
+        */
+       err = -ENOENT;
+       if (configfs_dirent_is_ready(parent_sd)) {
+               file->private_data = configfs_new_dirent(parent_sd, NULL);
+               if (IS_ERR(file->private_data))
+                       err = PTR_ERR(file->private_data);
+               else
+                       err = 0;
+       }
        mutex_unlock(&dentry->d_inode->i_mutex);
 
-       return IS_ERR(file->private_data) ? PTR_ERR(file->private_data) : 0;
-
+       return err;
 }
 
 static int configfs_dir_close(struct inode *inode, struct file *file)
@@ -1491,6 +1611,10 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys)
                if (err) {
                        d_delete(dentry);
                        dput(dentry);
+               } else {
+                       spin_lock(&configfs_dirent_lock);
+                       configfs_dir_set_ready(dentry->d_fsdata);
+                       spin_unlock(&configfs_dirent_lock);
                }
        }
 
@@ -1517,11 +1641,13 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys)
        mutex_lock_nested(&configfs_sb->s_root->d_inode->i_mutex,
                          I_MUTEX_PARENT);
        mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_CHILD);
+       mutex_lock(&configfs_symlink_mutex);
        spin_lock(&configfs_dirent_lock);
        if (configfs_detach_prep(dentry, NULL)) {
                printk(KERN_ERR "configfs: Tried to unregister non-empty subsystem!\n");
        }
        spin_unlock(&configfs_dirent_lock);
+       mutex_unlock(&configfs_symlink_mutex);
        configfs_detach_group(&group->cg_item);
        dentry->d_inode->i_flags |= S_DEAD;
        mutex_unlock(&dentry->d_inode->i_mutex);
index 0004d18..bf74973 100644 (file)
@@ -31,6 +31,9 @@
 #include <linux/configfs.h>
 #include "configfs_internal.h"
 
+/* Protects attachments of new symlinks */
+DEFINE_MUTEX(configfs_symlink_mutex);
+
 static int item_depth(struct config_item * item)
 {
        struct config_item * p = item;
@@ -73,11 +76,20 @@ static int create_link(struct config_item *parent_item,
        struct configfs_symlink *sl;
        int ret;
 
+       ret = -ENOENT;
+       if (!configfs_dirent_is_ready(target_sd))
+               goto out;
        ret = -ENOMEM;
        sl = kmalloc(sizeof(struct configfs_symlink), GFP_KERNEL);
        if (sl) {
                sl->sl_target = config_item_get(item);
                spin_lock(&configfs_dirent_lock);
+               if (target_sd->s_type & CONFIGFS_USET_DROPPING) {
+                       spin_unlock(&configfs_dirent_lock);
+                       config_item_put(item);
+                       kfree(sl);
+                       return -ENOENT;
+               }
                list_add(&sl->sl_list, &target_sd->s_links);
                spin_unlock(&configfs_dirent_lock);
                ret = configfs_create_link(sl, parent_item->ci_dentry,
@@ -91,6 +103,7 @@ static int create_link(struct config_item *parent_item,
                }
        }
 
+out:
        return ret;
 }
 
@@ -120,6 +133,7 @@ int configfs_symlink(struct inode *dir, struct dentry *dentry, const char *symna
 {
        int ret;
        struct nameidata nd;
+       struct configfs_dirent *sd;
        struct config_item *parent_item;
        struct config_item *target_item;
        struct config_item_type *type;
@@ -128,9 +142,19 @@ int configfs_symlink(struct inode *dir, struct dentry *dentry, const char *symna
        if (dentry->d_parent == configfs_sb->s_root)
                goto out;
 
+       sd = dentry->d_parent->d_fsdata;
+       /*
+        * Fake invisibility if dir belongs to a group/default groups hierarchy
+        * being attached
+        */
+       ret = -ENOENT;
+       if (!configfs_dirent_is_ready(sd))
+               goto out;
+
        parent_item = configfs_get_config_item(dentry->d_parent);
        type = parent_item->ci_type;
 
+       ret = -EPERM;
        if (!type || !type->ct_item_ops ||
            !type->ct_item_ops->allow_link)
                goto out_put;
@@ -141,7 +165,9 @@ int configfs_symlink(struct inode *dir, struct dentry *dentry, const char *symna
 
        ret = type->ct_item_ops->allow_link(parent_item, target_item);
        if (!ret) {
+               mutex_lock(&configfs_symlink_mutex);
                ret = create_link(parent_item, target_item, dentry);
+               mutex_unlock(&configfs_symlink_mutex);
                if (ret && type->ct_item_ops->drop_link)
                        type->ct_item_ops->drop_link(parent_item,
                                                     target_item);
index f2584d2..101663d 100644 (file)
@@ -1220,6 +1220,107 @@ struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry)
        return new;
 }
 
+/**
+ * d_add_ci - lookup or allocate new dentry with case-exact name
+ * @inode:  the inode case-insensitive lookup has found
+ * @dentry: the negative dentry that was passed to the parent's lookup func
+ * @name:   the case-exact name to be associated with the returned dentry
+ *
+ * This is to avoid filling the dcache with case-insensitive names to the
+ * same inode, only the actual correct case is stored in the dcache for
+ * case-insensitive filesystems.
+ *
+ * For a case-insensitive lookup match and if the the case-exact dentry
+ * already exists in in the dcache, use it and return it.
+ *
+ * If no entry exists with the exact case name, allocate new dentry with
+ * the exact case, and return the spliced entry.
+ */
+struct dentry *d_add_ci(struct inode *inode, struct dentry *dentry,
+                       struct qstr *name)
+{
+       int error;
+       struct dentry *found;
+       struct dentry *new;
+
+       /* Does a dentry matching the name exist already? */
+       found = d_hash_and_lookup(dentry->d_parent, name);
+       /* If not, create it now and return */
+       if (!found) {
+               new = d_alloc(dentry->d_parent, name);
+               if (!new) {
+                       error = -ENOMEM;
+                       goto err_out;
+               }
+               found = d_splice_alias(inode, new);
+               if (found) {
+                       dput(new);
+                       return found;
+               }
+               return new;
+       }
+       /* Matching dentry exists, check if it is negative. */
+       if (found->d_inode) {
+               if (unlikely(found->d_inode != inode)) {
+                       /* This can't happen because bad inodes are unhashed. */
+                       BUG_ON(!is_bad_inode(inode));
+                       BUG_ON(!is_bad_inode(found->d_inode));
+               }
+               /*
+                * Already have the inode and the dentry attached, decrement
+                * the reference count to balance the iget() done
+                * earlier on.  We found the dentry using d_lookup() so it
+                * cannot be disconnected and thus we do not need to worry
+                * about any NFS/disconnectedness issues here.
+                */
+               iput(inode);
+               return found;
+       }
+       /*
+        * Negative dentry: instantiate it unless the inode is a directory and
+        * has a 'disconnected' dentry (i.e. IS_ROOT and DCACHE_DISCONNECTED),
+        * in which case d_move() that in place of the found dentry.
+        */
+       if (!S_ISDIR(inode->i_mode)) {
+               /* Not a directory; everything is easy. */
+               d_instantiate(found, inode);
+               return found;
+       }
+       spin_lock(&dcache_lock);
+       if (list_empty(&inode->i_dentry)) {
+               /*
+                * Directory without a 'disconnected' dentry; we need to do
+                * d_instantiate() by hand because it takes dcache_lock which
+                * we already hold.
+                */
+               list_add(&found->d_alias, &inode->i_dentry);
+               found->d_inode = inode;
+               spin_unlock(&dcache_lock);
+               security_d_instantiate(found, inode);
+               return found;
+       }
+       /*
+        * Directory with a 'disconnected' dentry; get a reference to the
+        * 'disconnected' dentry.
+        */
+       new = list_entry(inode->i_dentry.next, struct dentry, d_alias);
+       dget_locked(new);
+       spin_unlock(&dcache_lock);
+       /* Do security vodoo. */
+       security_d_instantiate(found, inode);
+       /* Move new in place of found. */
+       d_move(new, found);
+       /* Balance the iget() we did above. */
+       iput(inode);
+       /* Throw away found. */
+       dput(found);
+       /* Use new as the actual dentry. */
+       return new;
+
+err_out:
+       iput(inode);
+       return ERR_PTR(error);
+}
 
 /**
  * d_lookup - search for a dentry
@@ -2254,6 +2355,7 @@ EXPORT_SYMBOL(d_path);
 EXPORT_SYMBOL(d_prune_aliases);
 EXPORT_SYMBOL(d_rehash);
 EXPORT_SYMBOL(d_splice_alias);
+EXPORT_SYMBOL(d_add_ci);
 EXPORT_SYMBOL(d_validate);
 EXPORT_SYMBOL(dget_locked);
 EXPORT_SYMBOL(dput);
index 285b64a..488eb42 100644 (file)
@@ -29,7 +29,7 @@
 #define DEVPTS_DEFAULT_MODE 0600
 
 extern int pty_limit;                  /* Config limit on Unix98 ptys */
-static DEFINE_IDR(allocated_ptys);
+static DEFINE_IDA(allocated_ptys);
 static DEFINE_MUTEX(allocated_ptys_lock);
 
 static struct vfsmount *devpts_mnt;
@@ -180,24 +180,24 @@ static struct dentry *get_node(int num)
 int devpts_new_index(void)
 {
        int index;
-       int idr_ret;
+       int ida_ret;
 
 retry:
-       if (!idr_pre_get(&allocated_ptys, GFP_KERNEL)) {
+       if (!ida_pre_get(&allocated_ptys, GFP_KERNEL)) {
                return -ENOMEM;
        }
 
        mutex_lock(&allocated_ptys_lock);
-       idr_ret = idr_get_new(&allocated_ptys, NULL, &index);
-       if (idr_ret < 0) {
+       ida_ret = ida_get_new(&allocated_ptys, &index);
+       if (ida_ret < 0) {
                mutex_unlock(&allocated_ptys_lock);
-               if (idr_ret == -EAGAIN)
+               if (ida_ret == -EAGAIN)
                        goto retry;
                return -EIO;
        }
 
        if (index >= pty_limit) {
-               idr_remove(&allocated_ptys, index);
+               ida_remove(&allocated_ptys, index);
                mutex_unlock(&allocated_ptys_lock);
                return -EIO;
        }
@@ -208,7 +208,7 @@ retry:
 void devpts_kill_index(int idx)
 {
        mutex_lock(&allocated_ptys_lock);
-       idr_remove(&allocated_ptys, idx);
+       ida_remove(&allocated_ptys, idx);
        mutex_unlock(&allocated_ptys_lock);
 }
 
index 1346eeb..8ec4d6c 100644 (file)
@@ -1793,6 +1793,21 @@ static int vfs_quota_on_remount(struct super_block *sb, int type)
        return ret;
 }
 
+int vfs_quota_on_path(struct super_block *sb, int type, int format_id,
+                     struct path *path)
+{
+       int error = security_quota_on(path->dentry);
+       if (error)
+               return error;
+       /* Quota file not on the same filesystem? */
+       if (path->mnt->mnt_sb != sb)
+               error = -EXDEV;
+       else
+               error = vfs_quota_on_inode(path->dentry->d_inode, type,
+                                          format_id);
+       return error;
+}
+
 /* Actual function called from quotactl() */
 int vfs_quota_on(struct super_block *sb, int type, int format_id, char *path,
                 int remount)
@@ -1804,19 +1819,10 @@ int vfs_quota_on(struct super_block *sb, int type, int format_id, char *path,
                return vfs_quota_on_remount(sb, type);
 
        error = path_lookup(path, LOOKUP_FOLLOW, &nd);
-       if (error < 0)
-               return error;
-       error = security_quota_on(nd.path.dentry);
-       if (error)
-               goto out_path;
-       /* Quota file not on the same filesystem? */
-       if (nd.path.mnt->mnt_sb != sb)
-               error = -EXDEV;
-       else
-               error = vfs_quota_on_inode(nd.path.dentry->d_inode, type,
-                                          format_id);
-out_path:
-       path_put(&nd.path);
+       if (!error) {
+               error = vfs_quota_on_path(sb, type, format_id, &nd.path);
+               path_put(&nd.path);
+       }
        return error;
 }
 
@@ -2185,6 +2191,7 @@ EXPORT_SYMBOL(unregister_quota_format);
 EXPORT_SYMBOL(dqstats);
 EXPORT_SYMBOL(dq_data_lock);
 EXPORT_SYMBOL(vfs_quota_on);
+EXPORT_SYMBOL(vfs_quota_on_path);
 EXPORT_SYMBOL(vfs_quota_on_mount);
 EXPORT_SYMBOL(vfs_quota_off);
 EXPORT_SYMBOL(vfs_quota_sync);
index 8ddced3..f38a5af 100644 (file)
@@ -2810,8 +2810,9 @@ static int ext3_quota_on(struct super_block *sb, int type, int format_id,
                journal_unlock_updates(EXT3_SB(sb)->s_journal);
        }
 
+       err = vfs_quota_on_path(sb, type, format_id, &nd.path);
        path_put(&nd.path);
-       return vfs_quota_on(sb, type, format_id, path, remount);
+       return err;
 }
 
 /* Read data from quotafile - avoid pagecache and such because we cannot afford
index c7d04e1..694ed6f 100644 (file)
@@ -40,34 +40,35 @@ ext4_acl_from_disk(const void *value, size_t size)
        acl = posix_acl_alloc(count, GFP_NOFS);
        if (!acl)
                return ERR_PTR(-ENOMEM);
-       for (n=0; n < count; n++) {
+       for (n = 0; n < count; n++) {
                ext4_acl_entry *entry =
                        (ext4_acl_entry *)value;
                if ((char *)value + sizeof(ext4_acl_entry_short) > end)
                        goto fail;
                acl->a_entries[n].e_tag  = le16_to_cpu(entry->e_tag);
                acl->a_entries[n].e_perm = le16_to_cpu(entry->e_perm);
-               switch(acl->a_entries[n].e_tag) {
-                       case ACL_USER_OBJ:
-                       case ACL_GROUP_OBJ:
-                       case ACL_MASK:
-                       case ACL_OTHER:
-                               value = (char *)value +
-                                       sizeof(ext4_acl_entry_short);
-                               acl->a_entries[n].e_id = ACL_UNDEFINED_ID;
-                               break;
-
-                       case ACL_USER:
-                       case ACL_GROUP:
-                               value = (char *)value + sizeof(ext4_acl_entry);
-                               if ((char *)value > end)
-                                       goto fail;
-                               acl->a_entries[n].e_id =
-                                       le32_to_cpu(entry->e_id);
-                               break;
-
-                       default:
+
+               switch (acl->a_entries[n].e_tag) {
+               case ACL_USER_OBJ:
+               case ACL_GROUP_OBJ:
+               case ACL_MASK:
+               case ACL_OTHER:
+                       value = (char *)value +
+                               sizeof(ext4_acl_entry_short);
+                       acl->a_entries[n].e_id = ACL_UNDEFINED_ID;
+                       break;
+
+               case ACL_USER:
+               case ACL_GROUP:
+                       value = (char *)value + sizeof(ext4_acl_entry);
+                       if ((char *)value > end)
                                goto fail;
+                       acl->a_entries[n].e_id =
+                               le32_to_cpu(entry->e_id);
+                       break;
+
+               default:
+                       goto fail;
                }
        }
        if (value != end)
@@ -96,27 +97,26 @@ ext4_acl_to_disk(const struct posix_acl *acl, size_t *size)
                return ERR_PTR(-ENOMEM);
        ext_acl->a_version = cpu_to_le32(EXT4_ACL_VERSION);
        e = (char *)ext_acl + sizeof(ext4_acl_header);
-       for (n=0; n < acl->a_count; n++) {
+       for (n = 0; n < acl->a_count; n++) {
                ext4_acl_entry *entry = (ext4_acl_entry *)e;
                entry->e_tag  = cpu_to_le16(acl->a_entries[n].e_tag);
                entry->e_perm = cpu_to_le16(acl->a_entries[n].e_perm);
-               switch(acl->a_entries[n].e_tag) {
-                       case ACL_USER:
-                       case ACL_GROUP:
-                               entry->e_id =
-                                       cpu_to_le32(acl->a_entries[n].e_id);
-                               e += sizeof(ext4_acl_entry);
-                               break;
-
-                       case ACL_USER_OBJ:
-                       case ACL_GROUP_OBJ:
-                       case ACL_MASK:
-                       case ACL_OTHER:
-                               e += sizeof(ext4_acl_entry_short);
-                               break;
-
-                       default:
-                               goto fail;
+               switch (acl->a_entries[n].e_tag) {
+               case ACL_USER:
+               case ACL_GROUP:
+                       entry->e_id = cpu_to_le32(acl->a_entries[n].e_id);
+                       e += sizeof(ext4_acl_entry);
+                       break;
+
+               case ACL_USER_OBJ:
+               case ACL_GROUP_OBJ:
+               case ACL_MASK:
+               case ACL_OTHER:
+                       e += sizeof(ext4_acl_entry_short);
+                       break;
+
+               default:
+                       goto fail;
                }
        }
        return (char *)ext_acl;
@@ -167,23 +167,23 @@ ext4_get_acl(struct inode *inode, int type)
        if (!test_opt(inode->i_sb, POSIX_ACL))
                return NULL;
 
-       switch(type) {
-               case ACL_TYPE_ACCESS:
-                       acl = ext4_iget_acl(inode, &ei->i_acl);
-                       if (acl != EXT4_ACL_NOT_CACHED)
-                               return acl;
-                       name_index = EXT4_XATTR_INDEX_POSIX_ACL_ACCESS;
-                       break;
-
-               case ACL_TYPE_DEFAULT:
-                       acl = ext4_iget_acl(inode, &ei->i_default_acl);
-                       if (acl != EXT4_ACL_NOT_CACHED)
-                               return acl;
-                       name_index = EXT4_XATTR_INDEX_POSIX_ACL_DEFAULT;
-                       break;
-
-               default:
-                       return ERR_PTR(-EINVAL);
+       switch (type) {
+       case ACL_TYPE_ACCESS:
+               acl = ext4_iget_acl(inode, &ei->i_acl);
+               if (acl != EXT4_ACL_NOT_CACHED)
+                       return acl;
+               name_index = EXT4_XATTR_INDEX_POSIX_ACL_ACCESS;
+               break;
+
+       case ACL_TYPE_DEFAULT:
+               acl = ext4_iget_acl(inode, &ei->i_default_acl);
+               if (acl != EXT4_ACL_NOT_CACHED)
+                       return acl;
+               name_index = EXT4_XATTR_INDEX_POSIX_ACL_DEFAULT;
+               break;
+
+       default:
+               return ERR_PTR(-EINVAL);
        }
        retval = ext4_xattr_get(inode, name_index, "", NULL, 0);
        if (retval > 0) {
@@ -201,14 +201,14 @@ ext4_get_acl(struct inode *inode, int type)
        kfree(value);
 
        if (!IS_ERR(acl)) {
-               switch(type) {
-                       case ACL_TYPE_ACCESS:
-                               ext4_iset_acl(inode, &ei->i_acl, acl);
-                               break;
-
-                       case ACL_TYPE_DEFAULT:
-                               ext4_iset_acl(inode, &ei->i_default_acl, acl);
-                               break;
+               switch (type) {
+               case ACL_TYPE_ACCESS:
+                       ext4_iset_acl(inode, &ei->i_acl, acl);
+                       break;
+
+               case ACL_TYPE_DEFAULT:
+                       ext4_iset_acl(inode, &ei->i_default_acl, acl);
+                       break;
                }
        }
        return acl;
@@ -232,31 +232,31 @@ ext4_set_acl(handle_t *handle, struct inode *inode, int type,
        if (S_ISLNK(inode->i_mode))
                return -EOPNOTSUPP;
 
-       switch(type) {
-               case ACL_TYPE_ACCESS:
-                       name_index = EXT4_XATTR_INDEX_POSIX_ACL_ACCESS;
-                       if (acl) {
-                               mode_t mode = inode->i_mode;
-                               error = posix_acl_equiv_mode(acl, &mode);
-                               if (error < 0)
-                                       return error;
-                               else {
-                                       inode->i_mode = mode;
-                                       ext4_mark_inode_dirty(handle, inode);
-                                       if (error == 0)
-                                               acl = NULL;
-                               }
+       switch (type) {
+       case ACL_TYPE_ACCESS:
+               name_index = EXT4_XATTR_INDEX_POSIX_ACL_ACCESS;
+               if (acl) {
+                       mode_t mode = inode->i_mode;
+                       error = posix_acl_equiv_mode(acl, &mode);
+                       if (error < 0)
+                               return error;
+                       else {
+                               inode->i_mode = mode;
+                               ext4_mark_inode_dirty(handle, inode);
+                               if (error == 0)
+                                       acl = NULL;
                        }
-                       break;
+               }
+               break;
 
-               case ACL_TYPE_DEFAULT:
-                       name_index = EXT4_XATTR_INDEX_POSIX_ACL_DEFAULT;
-                       if (!S_ISDIR(inode->i_mode))
-                               return acl ? -EACCES : 0;
-                       break;
+       case ACL_TYPE_DEFAULT:
+               name_index = EXT4_XATTR_INDEX_POSIX_ACL_DEFAULT;
+               if (!S_ISDIR(inode->i_mode))
+                       return acl ? -EACCES : 0;
+               break;
 
-               default:
-                       return -EINVAL;
+       default:
+               return -EINVAL;
        }
        if (acl) {
                value = ext4_acl_to_disk(acl, &size);
@@ -269,14 +269,14 @@ ext4_set_acl(handle_t *handle, struct inode *inode, int type,
 
        kfree(value);
        if (!error) {
-               switch(type) {
-                       case ACL_TYPE_ACCESS:
-                               ext4_iset_acl(inode, &ei->i_acl, acl);
-                               break;
-
-                       case ACL_TYPE_DEFAULT:
-                               ext4_iset_acl(inode, &ei->i_default_acl, acl);
-                               break;
+               switch (type) {
+               case ACL_TYPE_ACCESS:
+                       ext4_iset_acl(inode, &ei->i_acl, acl);
+                       break;
+
+               case ACL_TYPE_DEFAULT:
+                       ext4_iset_acl(inode, &ei->i_default_acl, acl);
+                       break;
                }
        }
        return error;
index 495ab21..1ae5004 100644 (file)
@@ -314,25 +314,28 @@ ext4_read_block_bitmap(struct super_block *sb, ext4_group_t block_group)
        if (unlikely(!bh)) {
                ext4_error(sb, __func__,
                            "Cannot read block bitmap - "
-                           "block_group = %d, block_bitmap = %llu",
-                           (int)block_group, (unsigned long long)bitmap_blk);
+                           "block_group = %lu, block_bitmap = %llu",
+                           block_group, bitmap_blk);
                return NULL;
        }
        if (bh_uptodate_or_lock(bh))
                return bh;
 
+       spin_lock(sb_bgl_lock(EXT4_SB(sb), block_group));
        if (desc->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) {
                ext4_init_block_bitmap(sb, bh, block_group, desc);
                set_buffer_uptodate(bh);
                unlock_buffer(bh);
+               spin_unlock(sb_bgl_lock(EXT4_SB(sb), block_group));
                return bh;
        }
+       spin_unlock(sb_bgl_lock(EXT4_SB(sb), block_group));
        if (bh_submit_read(bh) < 0) {
                put_bh(bh);
                ext4_error(sb, __func__,
                            "Cannot read block bitmap - "
-                           "block_group = %d, block_bitmap = %llu",
-                           (int)block_group, (unsigned long long)bitmap_blk);
+                           "block_group = %lu, block_bitmap = %llu",
+                           block_group, bitmap_blk);
                return NULL;
        }
        ext4_valid_block_bitmap(sb, desc, block_group, bh);
index 303e41c..6c7924d 100644 (file)
@@ -1044,7 +1044,6 @@ extern void ext4_mb_update_group_info(struct ext4_group_info *grp,
 
 
 /* inode.c */
-void ext4_da_release_space(struct inode *inode, int used, int to_free);
 int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode,
                struct buffer_head *bh, ext4_fsblk_t blocknr);
 struct buffer_head *ext4_getblk(handle_t *, struct inode *,
index 42c4c0c..612c3d2 100644 (file)
@@ -99,7 +99,7 @@ static int ext4_ext_journal_restart(handle_t *handle, int needed)
        if (handle->h_buffer_credits > needed)
                return 0;
        err = ext4_journal_extend(handle, needed);
-       if (err)
+       if (err <= 0)
                return err;
        return ext4_journal_restart(handle, needed);
 }
@@ -1441,7 +1441,7 @@ unsigned int ext4_ext_check_overlap(struct inode *inode,
 
        /*
         * get the next allocated block if the extent in the path
-        * is before the requested block(s) 
+        * is before the requested block(s)
         */
        if (b2 < b1) {
                b2 = ext4_ext_next_allocated_block(path);
@@ -1910,9 +1910,13 @@ ext4_ext_rm_leaf(handle_t *handle, struct inode *inode,
                        BUG_ON(b != ex_ee_block + ex_ee_len - 1);
                }
 
-               /* at present, extent can't cross block group: */
-               /* leaf + bitmap + group desc + sb + inode */
-               credits = 5;
+               /*
+                * 3 for leaf, sb, and inode plus 2 (bmap and group
+                * descriptor) for each block group; assume two block
+                * groups plus ex_ee_len/blocks_per_block_group for
+                * the worst case
+                */
+               credits = 7 + 2*(ex_ee_len/EXT4_BLOCKS_PER_GROUP(inode->i_sb));
                if (ex == EXT_FIRST_EXTENT(eh)) {
                        correct_index = 1;
                        credits += (ext_depth(inode)) + 1;
@@ -2323,7 +2327,10 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
                unsigned int newdepth;
                /* If extent has less than EXT4_EXT_ZERO_LEN zerout directly */
                if (allocated <= EXT4_EXT_ZERO_LEN) {
-                       /* Mark first half uninitialized.
+                       /*
+                        * iblock == ee_block is handled by the zerouout
+                        * at the beginning.
+                        * Mark first half uninitialized.
                         * Mark second half initialized and zero out the
                         * initialized extent
                         */
@@ -2346,7 +2353,7 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
                                ex->ee_len   = orig_ex.ee_len;
                                ext4_ext_store_pblock(ex, ext_pblock(&orig_ex));
                                ext4_ext_dirty(handle, inode, path + depth);
-                               /* zeroed the full extent */
+                               /* blocks available from iblock */
                                return allocated;
 
                        } else if (err)
@@ -2374,6 +2381,7 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
                                        err = PTR_ERR(path);
                                        return err;
                                }
+                               /* get the second half extent details */
                                ex = path[depth].p_ext;
                                err = ext4_ext_get_access(handle, inode,
                                                                path + depth);
@@ -2403,6 +2411,7 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
                        ext4_ext_store_pblock(ex, ext_pblock(&orig_ex));
                        ext4_ext_dirty(handle, inode, path + depth);
                        /* zeroed the full extent */
+                       /* blocks available from iblock */
                        return allocated;
 
                } else if (err)
@@ -2418,23 +2427,22 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
                 */
                orig_ex.ee_len = cpu_to_le16(ee_len -
                                                ext4_ext_get_actual_len(ex3));
-               if (newdepth != depth) {
-                       depth = newdepth;
-                       ext4_ext_drop_refs(path);
-                       path = ext4_ext_find_extent(inode, iblock, path);
-                       if (IS_ERR(path)) {
-                               err = PTR_ERR(path);
-                               goto out;
-                       }
-                       eh = path[depth].p_hdr;
-                       ex = path[depth].p_ext;
-                       if (ex2 != &newex)
-                               ex2 = ex;
-
-                       err = ext4_ext_get_access(handle, inode, path + depth);
-                       if (err)
-                               goto out;
+               depth = newdepth;
+               ext4_ext_drop_refs(path);
+               path = ext4_ext_find_extent(inode, iblock, path);
+               if (IS_ERR(path)) {
+                       err = PTR_ERR(path);
+                       goto out;
                }
+               eh = path[depth].p_hdr;
+               ex = path[depth].p_ext;
+               if (ex2 != &newex)
+                       ex2 = ex;
+
+               err = ext4_ext_get_access(handle, inode, path + depth);
+               if (err)
+                       goto out;
+
                allocated = max_blocks;
 
                /* If extent has less than EXT4_EXT_ZERO_LEN and we are trying
@@ -2452,6 +2460,7 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
                        ext4_ext_store_pblock(ex, ext_pblock(&orig_ex));
                        ext4_ext_dirty(handle, inode, path + depth);
                        /* zero out the first half */
+                       /* blocks available from iblock */
                        return allocated;
                }
        }
index a92eb30..655e760 100644 (file)
@@ -97,34 +97,44 @@ unsigned ext4_init_inode_bitmap(struct super_block *sb, struct buffer_head *bh,
  * Return buffer_head of bitmap on success or NULL.
  */
 static struct buffer_head *
-read_inode_bitmap(struct super_block *sb, ext4_group_t block_group)
+ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group)
 {
        struct ext4_group_desc *desc;
        struct buffer_head *bh = NULL;
+       ext4_fsblk_t bitmap_blk;
 
        desc = ext4_get_group_desc(sb, block_group, NULL);
        if (!desc)
-               goto error_out;
-       if (desc->bg_flags & cpu_to_le16(EXT4_BG_INODE_UNINIT)) {
-               bh = sb_getblk(sb, ext4_inode_bitmap(sb, desc));
-               if (!buffer_uptodate(bh)) {
-                       lock_buffer(bh);
-                       if (!buffer_uptodate(bh)) {
-                               ext4_init_inode_bitmap(sb, bh, block_group,
-                                                      desc);
-                               set_buffer_uptodate(bh);
-                       }
-                       unlock_buffer(bh);
-               }
-       } else {
-               bh = sb_bread(sb, ext4_inode_bitmap(sb, desc));
+               return NULL;
+       bitmap_blk = ext4_inode_bitmap(sb, desc);
+       bh = sb_getblk(sb, bitmap_blk);
+       if (unlikely(!bh)) {
+               ext4_error(sb, __func__,
+                           "Cannot read inode bitmap - "
+                           "block_group = %lu, inode_bitmap = %llu",
+                           block_group, bitmap_blk);
+               return NULL;
        }
-       if (!bh)
-               ext4_error(sb, "read_inode_bitmap",
+       if (bh_uptodate_or_lock(bh))
+               return bh;
+
+       spin_lock(sb_bgl_lock(EXT4_SB(sb), block_group));
+       if (desc->bg_flags & cpu_to_le16(EXT4_BG_INODE_UNINIT)) {
+               ext4_init_inode_bitmap(sb, bh, block_group, desc);
+               set_buffer_uptodate(bh);
+               unlock_buffer(bh);
+               spin_unlock(sb_bgl_lock(EXT4_SB(sb), block_group));
+               return bh;
+       }
+       spin_unlock(sb_bgl_lock(EXT4_SB(sb), block_group));
+       if (bh_submit_read(bh) < 0) {
+               put_bh(bh);
+               ext4_error(sb, __func__,
                            "Cannot read inode bitmap - "
                            "block_group = %lu, inode_bitmap = %llu",
-                           block_group, ext4_inode_bitmap(sb, desc));
-error_out:
+                           block_group, bitmap_blk);
+               return NULL;
+       }
        return bh;
 }
 
@@ -200,7 +210,7 @@ void ext4_free_inode (handle_t *handle, struct inode * inode)
        }
        block_group = (ino - 1) / EXT4_INODES_PER_GROUP(sb);
        bit = (ino - 1) % EXT4_INODES_PER_GROUP(sb);
-       bitmap_bh = read_inode_bitmap(sb, block_group);
+       bitmap_bh = ext4_read_inode_bitmap(sb, block_group);
        if (!bitmap_bh)
                goto error_return;
 
@@ -623,7 +633,7 @@ got_group:
                        goto fail;
 
                brelse(bitmap_bh);
-               bitmap_bh = read_inode_bitmap(sb, group);
+               bitmap_bh = ext4_read_inode_bitmap(sb, group);
                if (!bitmap_bh)
                        goto fail;
 
@@ -728,7 +738,7 @@ got:
 
                        /* When marking the block group with
                         * ~EXT4_BG_INODE_UNINIT we don't want to depend
-                        * on the value of bg_itable_unsed even though
+                        * on the value of bg_itable_unused even though
                         * mke2fs could have initialized the same for us.
                         * Instead we calculated the value below
                         */
@@ -891,7 +901,7 @@ struct inode *ext4_orphan_get(struct super_block *sb, unsigned long ino)
 
        block_group = (ino - 1) / EXT4_INODES_PER_GROUP(sb);
        bit = (ino - 1) % EXT4_INODES_PER_GROUP(sb);
-       bitmap_bh = read_inode_bitmap(sb, block_group);
+       bitmap_bh = ext4_read_inode_bitmap(sb, block_group);
        if (!bitmap_bh) {
                ext4_warning(sb, __func__,
                             "inode bitmap error for orphan %lu", ino);
@@ -969,7 +979,7 @@ unsigned long ext4_count_free_inodes (struct super_block * sb)
                        continue;
                desc_count += le16_to_cpu(gdp->bg_free_inodes_count);
                brelse(bitmap_bh);
-               bitmap_bh = read_inode_bitmap(sb, i);
+               bitmap_bh = ext4_read_inode_bitmap(sb, i);
                if (!bitmap_bh)
                        continue;
 
index 9843b04..59fbbe8 100644 (file)
@@ -191,6 +191,7 @@ static int ext4_journal_test_restart(handle_t *handle, struct inode *inode)
 void ext4_delete_inode (struct inode * inode)
 {
        handle_t *handle;
+       int err;
 
        if (ext4_should_order_data(inode))
                ext4_begin_ordered_truncate(inode, 0);
@@ -199,8 +200,9 @@ void ext4_delete_inode (struct inode * inode)
        if (is_bad_inode(inode))
                goto no_delete;
 
-       handle = start_transaction(inode);
+       handle = ext4_journal_start(inode, blocks_for_truncate(inode)+3);
        if (IS_ERR(handle)) {
+               ext4_std_error(inode->i_sb, PTR_ERR(handle));
                /*
                 * If we're going to skip the normal cleanup, we still need to
                 * make sure that the in-core orphan linked list is properly
@@ -213,8 +215,34 @@ void ext4_delete_inode (struct inode * inode)
        if (IS_SYNC(inode))
                handle->h_sync = 1;
        inode->i_size = 0;
+       err = ext4_mark_inode_dirty(handle, inode);
+       if (err) {
+               ext4_warning(inode->i_sb, __func__,
+                            "couldn't mark inode dirty (err %d)", err);
+               goto stop_handle;
+       }
        if (inode->i_blocks)
                ext4_truncate(inode);
+
+       /*
+        * ext4_ext_truncate() doesn't reserve any slop when it
+        * restarts journal transactions; therefore there may not be
+        * enough credits left in the handle to remove the inode from
+        * the orphan list and set the dtime field.
+        */
+       if (handle->h_buffer_credits < 3) {
+               err = ext4_journal_extend(handle, 3);
+               if (err > 0)
+                       err = ext4_journal_restart(handle, 3);
+               if (err != 0) {
+                       ext4_warning(inode->i_sb, __func__,
+                                    "couldn't extend journal (err %d)", err);
+               stop_handle:
+                       ext4_journal_stop(handle);
+                       goto no_delete;
+               }
+       }
+
        /*
         * Kill off the orphan record which ext4_truncate created.
         * AKPM: I think this can be inside the above `if'.
@@ -952,6 +980,67 @@ out:
        return err;
 }
 
+/*
+ * Calculate the number of metadata blocks need to reserve
+ * to allocate @blocks for non extent file based file
+ */
+static int ext4_indirect_calc_metadata_amount(struct inode *inode, int blocks)
+{
+       int icap = EXT4_ADDR_PER_BLOCK(inode->i_sb);
+       int ind_blks, dind_blks, tind_blks;
+
+       /* number of new indirect blocks needed */
+       ind_blks = (blocks + icap - 1) / icap;
+
+       dind_blks = (ind_blks + icap - 1) / icap;
+
+       tind_blks = 1;
+
+       return ind_blks + dind_blks + tind_blks;
+}
+
+/*
+ * Calculate the number of metadata blocks need to reserve
+ * to allocate given number of blocks
+ */
+static int ext4_calc_metadata_amount(struct inode *inode, int blocks)
+{
+       if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL)
+               return ext4_ext_calc_metadata_amount(inode, blocks);
+
+       return ext4_indirect_calc_metadata_amount(inode, blocks);
+}
+
+static void ext4_da_update_reserve_space(struct inode *inode, int used)
+{
+       struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+       int total, mdb, mdb_free;
+
+       spin_lock(&EXT4_I(inode)->i_block_reservation_lock);
+       /* recalculate the number of metablocks still need to be reserved */
+       total = EXT4_I(inode)->i_reserved_data_blocks - used;
+       mdb = ext4_calc_metadata_amount(inode, total);
+
+       /* figure out how many metablocks to release */
+       BUG_ON(mdb > EXT4_I(inode)->i_reserved_meta_blocks);
+       mdb_free = EXT4_I(inode)->i_reserved_meta_blocks - mdb;
+
+       /* Account for allocated meta_blocks */
+       mdb_free -= EXT4_I(inode)->i_allocated_meta_blocks;
+
+       /* update fs free blocks counter for truncate case */
+       percpu_counter_add(&sbi->s_freeblocks_counter, mdb_free);
+
+       /* update per-inode reservations */
+       BUG_ON(used  > EXT4_I(inode)->i_reserved_data_blocks);
+       EXT4_I(inode)->i_reserved_data_blocks -= used;
+
+       BUG_ON(mdb > EXT4_I(inode)->i_reserved_meta_blocks);
+       EXT4_I(inode)->i_reserved_meta_blocks = mdb;
+       EXT4_I(inode)->i_allocated_meta_blocks = 0;
+       spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
+}
+
 /* Maximum number of blocks we map for direct IO at once. */
 #define DIO_MAX_BLOCKS 4096
 /*
@@ -965,10 +1054,9 @@ out:
 
 
 /*
+ * The ext4_get_blocks_wrap() function try to look up the requested blocks,
+ * and returns if the blocks are already mapped.
  *
- *
- * ext4_ext4 get_block() wrapper function
- * It will do a look up first, and returns if the blocks already mapped.
  * Otherwise it takes the write lock of the i_data_sem and allocate blocks
  * and store the allocated blocks in the result buffer head and mark it
  * mapped.
@@ -1069,7 +1157,7 @@ int ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, sector_t block,
                 * which were deferred till now
                 */
                if ((retval > 0) && buffer_delay(bh))
-                       ext4_da_release_space(inode, retval, 0);
+                       ext4_da_update_reserve_space(inode, retval);
        }
 
        up_write((&EXT4_I(inode)->i_data_sem));
@@ -1336,12 +1424,8 @@ static int ext4_ordered_write_end(struct file *file,
 {
        handle_t *handle = ext4_journal_current_handle();
        struct inode *inode = mapping->host;
-       unsigned from, to;
        int ret = 0, ret2;
 
-       from = pos & (PAGE_CACHE_SIZE - 1);
-       to = from + len;
-
        ret = ext4_jbd2_file_inode(handle, inode);
 
        if (ret == 0) {
@@ -1437,36 +1521,6 @@ static int ext4_journalled_write_end(struct file *file,
 
        return ret ? ret : copied;
 }
-/*
- * Calculate the number of metadata blocks need to reserve
- * to allocate @blocks for non extent file based file
- */
-static int ext4_indirect_calc_metadata_amount(struct inode *inode, int blocks)
-{
-       int icap = EXT4_ADDR_PER_BLOCK(inode->i_sb);
-       int ind_blks, dind_blks, tind_blks;
-
-       /* number of new indirect blocks needed */
-       ind_blks = (blocks + icap - 1) / icap;
-
-       dind_blks = (ind_blks + icap - 1) / icap;
-
-       tind_blks = 1;
-
-       return ind_blks + dind_blks + tind_blks;
-}
-
-/*
- * Calculate the number of metadata blocks need to reserve
- * to allocate given number of blocks
- */
-static int ext4_calc_metadata_amount(struct inode *inode, int blocks)
-{
-       if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL)
-               return ext4_ext_calc_metadata_amount(inode, blocks);
-
-       return ext4_indirect_calc_metadata_amount(inode, blocks);
-}
 
 static int ext4_da_reserve_space(struct inode *inode, int nrblocks)
 {
@@ -1490,7 +1544,6 @@ static int ext4_da_reserve_space(struct inode *inode, int nrblocks)
                spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
                return -ENOSPC;
        }
-
        /* reduce fs free blocks counter */
        percpu_counter_sub(&sbi->s_freeblocks_counter, total);
 
@@ -1501,35 +1554,31 @@ static int ext4_da_reserve_space(struct inode *inode, int nrblocks)
        return 0;       /* success */
 }
 
-void ext4_da_release_space(struct inode *inode, int used, int to_free)
+static void ext4_da_release_space(struct inode *inode, int to_free)
 {
        struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
        int total, mdb, mdb_free, release;
 
        spin_lock(&EXT4_I(inode)->i_block_reservation_lock);
        /* recalculate the number of metablocks still need to be reserved */
-       total = EXT4_I(inode)->i_reserved_data_blocks - used - to_free;
+       total = EXT4_I(inode)->i_reserved_data_blocks - to_free;
        mdb = ext4_calc_metadata_amount(inode, total);
 
        /* figure out how many metablocks to release */
        BUG_ON(mdb > EXT4_I(inode)->i_reserved_meta_blocks);
        mdb_free = EXT4_I(inode)->i_reserved_meta_blocks - mdb;
 
-       /* Account for allocated meta_blocks */
-       mdb_free -= EXT4_I(inode)->i_allocated_meta_blocks;
-
        release = to_free + mdb_free;
 
        /* update fs free blocks counter for truncate case */
        percpu_counter_add(&sbi->s_freeblocks_counter, release);
 
        /* update per-inode reservations */
-       BUG_ON(used + to_free > EXT4_I(inode)->i_reserved_data_blocks);
-       EXT4_I(inode)->i_reserved_data_blocks -= (used + to_free);
+       BUG_ON(to_free > EXT4_I(inode)->i_reserved_data_blocks);
+       EXT4_I(inode)->i_reserved_data_blocks -= to_free;
 
        BUG_ON(mdb > EXT4_I(inode)->i_reserved_meta_blocks);
        EXT4_I(inode)->i_reserved_meta_blocks = mdb;
-       EXT4_I(inode)->i_allocated_meta_blocks = 0;
        spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
 }
 
@@ -1551,7 +1600,7 @@ static void ext4_da_page_release_reservation(struct page *page,
                }
                curr_off = next_off;
        } while ((bh = bh->b_this_page) != head);
-       ext4_da_release_space(page->mapping->host, 0, to_release);
+       ext4_da_release_space(page->mapping->host, to_release);
 }
 
 /*
@@ -2280,8 +2329,11 @@ retry:
        }
 
        page = __grab_cache_page(mapping, index);
-       if (!page)
-               return -ENOMEM;
+       if (!page) {
+               ext4_journal_stop(handle);
+               ret = -ENOMEM;
+               goto out;
+       }
        *pagep = page;
 
        ret = block_write_begin(file, mapping, pos, len, flags, pagep, fsdata,
@@ -3590,6 +3642,16 @@ static int __ext4_get_inode_loc(struct inode *inode,
        }
        if (!buffer_uptodate(bh)) {
                lock_buffer(bh);
+
+               /*
+                * If the buffer has the write error flag, we have failed
+                * to write out another inode in the same block.  In this
+                * case, we don't have to read the block because we may
+                * read the old inode data successfully.
+                */
+               if (buffer_write_io_error(bh) && !buffer_uptodate(bh))
+                       set_buffer_uptodate(bh);
+
                if (buffer_uptodate(bh)) {
                        /* someone brought it uptodate while we waited */
                        unlock_buffer(bh);
index 8d141a2..865e9dd 100644 (file)
@@ -787,13 +787,16 @@ static int ext4_mb_init_cache(struct page *page, char *incore)
                if (bh_uptodate_or_lock(bh[i]))
                        continue;
 
+               spin_lock(sb_bgl_lock(EXT4_SB(sb), first_group + i));
                if (desc->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) {
                        ext4_init_block_bitmap(sb, bh[i],
                                                first_group + i, desc);
                        set_buffer_uptodate(bh[i]);
                        unlock_buffer(bh[i]);
+                       spin_unlock(sb_bgl_lock(EXT4_SB(sb), first_group + i));
                        continue;
                }
+               spin_unlock(sb_bgl_lock(EXT4_SB(sb), first_group + i));
                get_bh(bh[i]);
                bh[i]->b_end_io = end_buffer_read_sync;
                submit_bh(READ, bh[i]);
@@ -2477,7 +2480,7 @@ err_freesgi:
 int ext4_mb_init(struct super_block *sb, int needs_recovery)
 {
        struct ext4_sb_info *sbi = EXT4_SB(sb);
-       unsigned i;
+       unsigned i, j;
        unsigned offset;
        unsigned max;
        int ret;
@@ -2537,7 +2540,7 @@ int ext4_mb_init(struct super_block *sb, int needs_recovery)
        sbi->s_mb_history_filter = EXT4_MB_HISTORY_DEFAULT;
        sbi->s_mb_group_prealloc = MB_DEFAULT_GROUP_PREALLOC;
 
-       i = sizeof(struct ext4_locality_group) * NR_CPUS;
+       i = sizeof(struct ext4_locality_group) * nr_cpu_ids;
        sbi->s_locality_groups = kmalloc(i, GFP_KERNEL);
        if (sbi->s_locality_groups == NULL) {
                clear_opt(sbi->s_mount_opt, MBALLOC);
@@ -2545,11 +2548,12 @@ int ext4_mb_init(struct super_block *sb, int needs_recovery)
                kfree(sbi->s_mb_maxs);
                return -ENOMEM;
        }
-       for (i = 0; i < NR_CPUS; i++) {
+       for (i = 0; i < nr_cpu_ids; i++) {
                struct ext4_locality_group *lg;
                lg = &sbi->s_locality_groups[i];
                mutex_init(&lg->lg_mutex);
-               INIT_LIST_HEAD(&lg->lg_prealloc_list);
+               for (j = 0; j < PREALLOC_TB_SIZE; j++)
+                       INIT_LIST_HEAD(&lg->lg_prealloc_list[j]);
                spin_lock_init(&lg->lg_prealloc_lock);
        }
 
@@ -3260,6 +3264,7 @@ static void ext4_mb_use_group_pa(struct ext4_allocation_context *ac,
                                struct ext4_prealloc_space *pa)
 {
        unsigned int len = ac->ac_o_ex.fe_len;
+
        ext4_get_group_no_and_offset(ac->ac_sb, pa->pa_pstart,
                                        &ac->ac_b_ex.fe_group,
                                        &ac->ac_b_ex.fe_start);
@@ -3282,6 +3287,7 @@ static void ext4_mb_use_group_pa(struct ext4_allocation_context *ac,
 static noinline_for_stack int
 ext4_mb_use_preallocated(struct ext4_allocation_context *ac)
 {
+       int order, i;
        struct ext4_inode_info *ei = EXT4_I(ac->ac_inode);
        struct ext4_locality_group *lg;
        struct ext4_prealloc_space *pa;
@@ -3322,22 +3328,29 @@ ext4_mb_use_preallocated(struct ext4_allocation_context *ac)
        lg = ac->ac_lg;
        if (lg == NULL)
                return 0;
-
-       rcu_read_lock();
-       list_for_each_entry_rcu(pa, &lg->lg_prealloc_list, pa_inode_list) {
-               spin_lock(&pa->pa_lock);
-               if (pa->pa_deleted == 0 && pa->pa_free >= ac->ac_o_ex.fe_len) {
-                       atomic_inc(&pa->pa_count);
-                       ext4_mb_use_group_pa(ac, pa);
+       order  = fls(ac->ac_o_ex.fe_len) - 1;
+       if (order > PREALLOC_TB_SIZE - 1)
+               /* The max size of hash table is PREALLOC_TB_SIZE */
+               order = PREALLOC_TB_SIZE - 1;
+
+       for (i = order; i < PREALLOC_TB_SIZE; i++) {
+               rcu_read_lock();
+               list_for_each_entry_rcu(pa, &lg->lg_prealloc_list[i],
+                                       pa_inode_list) {
+                       spin_lock(&pa->pa_lock);
+                       if (pa->pa_deleted == 0 &&
+                                       pa->pa_free >= ac->ac_o_ex.fe_len) {
+                               atomic_inc(&pa->pa_count);
+                               ext4_mb_use_group_pa(ac, pa);
+                               spin_unlock(&pa->pa_lock);
+                               ac->ac_criteria = 20;
+                               rcu_read_unlock();
+                               return 1;
+                       }
                        spin_unlock(&pa->pa_lock);
-                       ac->ac_criteria = 20;
-                       rcu_read_unlock();
-                       return 1;
                }
-               spin_unlock(&pa->pa_lock);
+               rcu_read_unlock();
        }
-       rcu_read_unlock();
-
        return 0;
 }
 
@@ -3560,6 +3573,7 @@ ext4_mb_new_group_pa(struct ext4_allocation_context *ac)
        pa->pa_free = pa->pa_len;
        atomic_set(&pa->pa_count, 1);
        spin_lock_init(&pa->pa_lock);
+       INIT_LIST_HEAD(&pa->pa_inode_list);
        pa->pa_deleted = 0;
        pa->pa_linear = 1;
 
@@ -3580,10 +3594,10 @@ ext4_mb_new_group_pa(struct ext4_allocation_context *ac)
        list_add(&pa->pa_group_list, &grp->bb_prealloc_list);
        ext4_unlock_group(sb, ac->ac_b_ex.fe_group);
 
-       spin_lock(pa->pa_obj_lock);
-       list_add_tail_rcu(&pa->pa_inode_list, &lg->lg_prealloc_list);
-       spin_unlock(pa->pa_obj_lock);
-
+       /*
+        * We will later add the new pa to the right bucket
+        * after updating the pa_free in ext4_mb_release_context
+        */
        return 0;
 }
 
@@ -3733,20 +3747,23 @@ ext4_mb_discard_group_preallocations(struct super_block *sb,
 
        bitmap_bh = ext4_read_block_bitmap(sb, group);
        if (bitmap_bh == NULL) {
-               /* error handling here */
-               ext4_mb_release_desc(&e4b);
-               BUG_ON(bitmap_bh == NULL);
+               ext4_error(sb, __func__, "Error in reading block "
+                               "bitmap for %lu\n", group);
+               return 0;
        }
 
        err = ext4_mb_load_buddy(sb, group, &e4b);
-       BUG_ON(err != 0); /* error handling here */
+       if (err) {
+               ext4_error(sb, __func__, "Error in loading buddy "
+                               "information for %lu\n", group);
+               put_bh(bitmap_bh);
+               return 0;
+       }
 
        if (needed == 0)
                needed = EXT4_BLOCKS_PER_GROUP(sb) + 1;
 
-       grp = ext4_get_group_info(sb, group);
        INIT_LIST_HEAD(&list);
-
        ac = kmem_cache_alloc(ext4_ac_cachep, GFP_NOFS);
 repeat:
        ext4_lock_group(sb, group);
@@ -3903,13 +3920,18 @@ repeat:
                ext4_get_group_no_and_offset(sb, pa->pa_pstart, &group, NULL);
 
                err = ext4_mb_load_buddy(sb, group, &e4b);
-               BUG_ON(err != 0); /* error handling here */
+               if (err) {
+                       ext4_error(sb, __func__, "Error in loading buddy "
+                                       "information for %lu\n", group);
+                       continue;
+               }
 
                bitmap_bh = ext4_read_block_bitmap(sb, group);
                if (bitmap_bh == NULL) {
-                       /* error handling here */
+                       ext4_error(sb, __func__, "Error in reading block "
+                                       "bitmap for %lu\n", group);
                        ext4_mb_release_desc(&e4b);
-                       BUG_ON(bitmap_bh == NULL);
+                       continue;
                }
 
                ext4_lock_group(sb, group);
@@ -4112,22 +4134,168 @@ ext4_mb_initialize_context(struct ext4_allocation_context *ac,
 
 }
 
+static noinline_for_stack void
+ext4_mb_discard_lg_preallocations(struct super_block *sb,
+                                       struct ext4_locality_group *lg,
+                                       int order, int total_entries)
+{
+       ext4_group_t group = 0;
+       struct ext4_buddy e4b;
+       struct list_head discard_list;
+       struct ext4_prealloc_space *pa, *tmp;
+       struct ext4_allocation_context *ac;
+
+       mb_debug("discard locality group preallocation\n");
+
+       INIT_LIST_HEAD(&discard_list);
+       ac = kmem_cache_alloc(ext4_ac_cachep, GFP_NOFS);
+
+       spin_lock(&lg->lg_prealloc_lock);
+       list_for_each_entry_rcu(pa, &lg->lg_prealloc_list[order],
+                                               pa_inode_list) {
+               spin_lock(&pa->pa_lock);
+               if (atomic_read(&pa->pa_count)) {
+                       /*
+                        * This is the pa that we just used
+                        * for block allocation. So don't
+                        * free that
+                        */
+                       spin_unlock(&pa->pa_lock);
+                       continue;
+               }
+               if (pa->pa_deleted) {
+                       spin_unlock(&pa->pa_lock);
+                       continue;
+               }
+               /* only lg prealloc space */
+               BUG_ON(!pa->pa_linear);
+
+               /* seems this one can be freed ... */
+               pa->pa_deleted = 1;
+               spin_unlock(&pa->pa_lock);
+
+               list_del_rcu(&pa->pa_inode_list);
+               list_add(&pa->u.pa_tmp_list, &discard_list);
+
+               total_entries--;
+               if (total_entries <= 5) {
+                       /*
+                        * we want to keep only 5 entries
+                        * allowing it to grow to 8. This
+                        * mak sure we don't call discard
+                        * soon for this list.
+                        */
+                       break;
+               }
+       }
+       spin_unlock(&lg->lg_prealloc_lock);
+
+       list_for_each_entry_safe(pa, tmp, &discard_list, u.pa_tmp_list) {
+
+               ext4_get_group_no_and_offset(sb, pa->pa_pstart, &group, NULL);
+               if (ext4_mb_load_buddy(sb, group, &e4b)) {
+                       ext4_error(sb, __func__, "Error in loading buddy "
+                                       "information for %lu\n", group);
+                       continue;
+               }
+               ext4_lock_group(sb, group);
+               list_del(&pa->pa_group_list);
+               ext4_mb_release_group_pa(&e4b, pa, ac);
+               ext4_unlock_group(sb, group);
+
+               ext4_mb_release_desc(&e4b);
+               list_del(&pa->u.pa_tmp_list);
+               call_rcu(&(pa)->u.pa_rcu, ext4_mb_pa_callback);
+       }
+       if (ac)
+               kmem_cache_free(ext4_ac_cachep, ac);
+}
+
+/*
+ * We have incremented pa_count. So it cannot be freed at this
+ * point. Also we hold lg_mutex. So no parallel allocation is
+ * possible from this lg. That means pa_free cannot be updated.
+ *
+ * A parallel ext4_mb_discard_group_preallocations is possible.
+ * which can cause the lg_prealloc_list to be updated.
+ */
+
+static void ext4_mb_add_n_trim(struct ext4_allocation_context *ac)
+{
+       int order, added = 0, lg_prealloc_count = 1;
+       struct super_block *sb = ac->ac_sb;
+       struct ext4_locality_group *lg = ac->ac_lg;
+       struct ext4_prealloc_space *tmp_pa, *pa = ac->ac_pa;
+
+       order = fls(pa->pa_free) - 1;
+       if (order > PREALLOC_TB_SIZE - 1)
+               /* The max size of hash table is PREALLOC_TB_SIZE */
+               order = PREALLOC_TB_SIZE - 1;
+       /* Add the prealloc space to lg */
+       rcu_read_lock();
+       list_for_each_entry_rcu(tmp_pa, &lg->lg_prealloc_list[order],
+                                               pa_inode_list) {
+               spin_lock(&tmp_pa->pa_lock);
+               if (tmp_pa->pa_deleted) {
+                       spin_unlock(&pa->pa_lock);
+                       continue;
+               }
+               if (!added && pa->pa_free < tmp_pa->pa_free) {
+                       /* Add to the tail of the previous entry */
+                       list_add_tail_rcu(&pa->pa_inode_list,
+                                               &tmp_pa->pa_inode_list);
+                       added = 1;
+                       /*
+                        * we want to count the total
+                        * number of entries in the list
+                        */
+               }
+               spin_unlock(&tmp_pa->pa_lock);
+               lg_prealloc_count++;
+       }
+       if (!added)
+               list_add_tail_rcu(&pa->pa_inode_list,
+                                       &lg->lg_prealloc_list[order]);
+       rcu_read_unlock();
+
+       /* Now trim the list to be not more than 8 elements */
+       if (lg_prealloc_count > 8) {
+               ext4_mb_discard_lg_preallocations(sb, lg,
+                                               order, lg_prealloc_count);
+               return;
+       }
+       return ;
+}
+
 /*
  * release all resource we used in allocation
  */
 static int ext4_mb_release_context(struct ext4_allocation_context *ac)
 {
-       if (ac->ac_pa) {
-               if (ac->ac_pa->pa_linear) {
+       struct ext4_prealloc_space *pa = ac->ac_pa;
+       if (pa) {
+               if (pa->pa_linear) {
                        /* see comment in ext4_mb_use_group_pa() */
-                       spin_lock(&ac->ac_pa->pa_lock);
-                       ac->ac_pa->pa_pstart += ac->ac_b_ex.fe_len;
-                       ac->ac_pa->pa_lstart += ac->ac_b_ex.fe_len;
-                       ac->ac_pa->pa_free -= ac->ac_b_ex.fe_len;
-                       ac->ac_pa->pa_len -= ac->ac_b_ex.fe_len;
-                       spin_unlock(&ac->ac_pa->pa_lock);
+                       spin_lock(&pa->pa_lock);
+                       pa->pa_pstart += ac->ac_b_ex.fe_len;
+                       pa->pa_lstart += ac->ac_b_ex.fe_len;
+                       pa->pa_free -= ac->ac_b_ex.fe_len;
+                       pa->pa_len -= ac->ac_b_ex.fe_len;
+                       spin_unlock(&pa->pa_lock);
+                       /*
+                        * We want to add the pa to the right bucket.
+                        * Remove it from the list and while adding
+                        * make sure the list to which we are adding
+                        * doesn't grow big.
+                        */
+                       if (likely(pa->pa_free)) {
+                               spin_lock(pa->pa_obj_lock);
+                               list_del_rcu(&pa->pa_inode_list);
+                               spin_unlock(pa->pa_obj_lock);
+                               ext4_mb_add_n_trim(ac);
+                       }
                }
-               ext4_mb_put_pa(ac, ac->ac_sb, ac->ac_pa);
+               ext4_mb_put_pa(ac, ac->ac_sb, pa);
        }
        if (ac->ac_bitmap_page)
                page_cache_release(ac->ac_bitmap_page);
@@ -4420,11 +4588,15 @@ do_more:
                count -= overflow;
        }
        bitmap_bh = ext4_read_block_bitmap(sb, block_group);
-       if (!bitmap_bh)
+       if (!bitmap_bh) {
+               err = -EIO;
                goto error_return;
+       }
        gdp = ext4_get_group_desc(sb, block_group, &gd_bh);
-       if (!gdp)
+       if (!gdp) {
+               err = -EIO;
                goto error_return;
+       }
 
        if (in_range(ext4_block_bitmap(sb, gdp), block, count) ||
            in_range(ext4_inode_bitmap(sb, gdp), block, count) ||
index bfe6add..c7c9906 100644 (file)
@@ -164,11 +164,17 @@ struct ext4_free_extent {
  * Locality group:
  *   we try to group all related changes together
  *   so that writeback can flush/allocate them together as well
+ *   Size of lg_prealloc_list hash is determined by MB_DEFAULT_GROUP_PREALLOC
+ *   (512). We store prealloc space into the hash based on the pa_free blocks
+ *   order value.ie, fls(pa_free)-1;
  */
+#define PREALLOC_TB_SIZE 10
 struct ext4_locality_group {
        /* for allocator */
-       struct mutex            lg_mutex;       /* to serialize allocates */
-       struct list_head        lg_prealloc_list;/* list of preallocations */
+       /* to serialize allocates */
+       struct mutex            lg_mutex;
+       /* list of preallocations */
+       struct list_head        lg_prealloc_list[PREALLOC_TB_SIZE];
        spinlock_t              lg_prealloc_lock;
 };
 
index f000fbe..0a92651 100644 (file)
@@ -73,7 +73,7 @@ static int verify_group_input(struct super_block *sb,
                             "Inode bitmap not in group (block %llu)",
                             (unsigned long long)input->inode_bitmap);
        else if (outside(input->inode_table, start, end) ||
-                outside(itend - 1, start, end))
+                outside(itend - 1, start, end))
                ext4_warning(sb, __func__,
                             "Inode table not in group (blocks %llu-%llu)",
                             (unsigned long long)input->inode_table, itend - 1);
@@ -104,7 +104,7 @@ static int verify_group_input(struct super_block *sb,
                             (unsigned long long)input->inode_bitmap,
                             start, metaend - 1);
        else if (inside(input->inode_table, start, metaend) ||
-                inside(itend - 1, start, metaend))
+                inside(itend - 1, start, metaend))
                ext4_warning(sb, __func__,
                             "Inode table (%llu-%llu) overlaps"
                             "GDT table (%llu-%llu)",
@@ -158,9 +158,9 @@ static int extend_or_restart_transaction(handle_t *handle, int thresh,
        if (err) {
                if ((err = ext4_journal_restart(handle, EXT4_MAX_TRANS_DATA)))
                        return err;
-               if ((err = ext4_journal_get_write_access(handle, bh)))
+               if ((err = ext4_journal_get_write_access(handle, bh)))
                        return err;
-        }
+       }
 
        return 0;
 }
@@ -416,11 +416,11 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
                       "EXT4-fs: ext4_add_new_gdb: adding group block %lu\n",
                       gdb_num);
 
-       /*
-        * If we are not using the primary superblock/GDT copy don't resize,
-        * because the user tools have no way of handling this.  Probably a
-        * bad time to do it anyways.
-        */
+        /*
+         * If we are not using the primary superblock/GDT copy don't resize,
+         * because the user tools have no way of handling this.  Probably a
+         * bad time to do it anyways.
+         */
        if (EXT4_SB(sb)->s_sbh->b_blocknr !=
            le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block)) {
                ext4_warning(sb, __func__,
@@ -507,14 +507,14 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
        return 0;
 
 exit_inode:
-       //ext4_journal_release_buffer(handle, iloc.bh);
+       /* ext4_journal_release_buffer(handle, iloc.bh); */
        brelse(iloc.bh);
 exit_dindj:
-       //ext4_journal_release_buffer(handle, dind);
+       /* ext4_journal_release_buffer(handle, dind); */
 exit_primary:
-       //ext4_journal_release_buffer(handle, *primary);
+       /* ext4_journal_release_buffer(handle, *primary); */
 exit_sbh:
-       //ext4_journal_release_buffer(handle, *primary);
+       /* ext4_journal_release_buffer(handle, *primary); */
 exit_dind:
        brelse(dind);
 exit_bh:
@@ -818,12 +818,12 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input)
        if ((err = ext4_journal_get_write_access(handle, sbi->s_sbh)))
                goto exit_journal;
 
-       /*
-        * We will only either add reserved group blocks to a backup group
-        * or remove reserved blocks for the first group in a new group block.
-        * Doing both would be mean more complex code, and sane people don't
-        * use non-sparse filesystems anymore.  This is already checked above.
-        */
+        /*
+         * We will only either add reserved group blocks to a backup group
+         * or remove reserved blocks for the first group in a new group block.
+         * Doing both would be mean more complex code, and sane people don't
+         * use non-sparse filesystems anymore.  This is already checked above.
+         */
        if (gdb_off) {
                primary = sbi->s_group_desc[gdb_num];
                if ((err = ext4_journal_get_write_access(handle, primary)))
@@ -835,24 +835,24 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input)
        } else if ((err = add_new_gdb(handle, inode, input, &primary)))
                goto exit_journal;
 
-       /*
-        * OK, now we've set up the new group.  Time to make it active.
-        *
-        * Current kernels don't lock all allocations via lock_super(),
-        * so we have to be safe wrt. concurrent accesses the group
-        * data.  So we need to be careful to set all of the relevant
-        * group descriptor data etc. *before* we enable the group.
-        *
-        * The key field here is sbi->s_groups_count: as long as
-        * that retains its old value, nobody is going to access the new
-        * group.
-        *
-        * So first we update all the descriptor metadata for the new
-        * group; then we update the total disk blocks count; then we
-        * update the groups count to enable the group; then finally we
-        * update the free space counts so that the system can start
-        * using the new disk blocks.
-        */
+        /*
+         * OK, now we've set up the new group.  Time to make it active.
+         *
+         * Current kernels don't lock all allocations via lock_super(),
+         * so we have to be safe wrt. concurrent accesses the group
+         * data.  So we need to be careful to set all of the relevant
+         * group descriptor data etc. *before* we enable the group.
+         *
+         * The key field here is sbi->s_groups_count: as long as
+         * that retains its old value, nobody is going to access the new
+         * group.
+         *
+         * So first we update all the descriptor metadata for the new
+         * group; then we update the total disk blocks count; then we
+         * update the groups count to enable the group; then finally we
+         * update the free space counts so that the system can start
+         * using the new disk blocks.
+         */
 
        /* Update group descriptor block for new group */
        gdp = (struct ext4_group_desc *)((char *)primary->b_data +
@@ -946,7 +946,8 @@ exit_put:
        return err;
 } /* ext4_group_add */
 
-/* Extend the filesystem to the new number of blocks specified.  This entry
+/*
+ * Extend the filesystem to the new number of blocks specified.  This entry
  * point is only used to extend the current filesystem to the end of the last
  * existing group.  It can be accessed via ioctl, or by "remount,resize=<size>"
  * for emergencies (because it has no dependencies on reserved blocks).
@@ -1024,7 +1025,7 @@ int ext4_group_extend(struct super_block *sb, struct ext4_super_block *es,
                             o_blocks_count + add, add);
 
        /* See if the device is actually as big as what was requested */
-       bh = sb_bread(sb, o_blocks_count + add -1);
+       bh = sb_bread(sb, o_blocks_count + add - 1);
        if (!bh) {
                ext4_warning(sb, __func__,
                             "can't read last block, resize aborted");
index b5479b1..d5d7795 100644 (file)
@@ -49,20 +49,19 @@ static int ext4_load_journal(struct super_block *, struct ext4_super_block *,
                             unsigned long journal_devnum);
 static int ext4_create_journal(struct super_block *, struct ext4_super_block *,
                               unsigned int);
-static void ext4_commit_super (struct super_block * sb,
-                              struct ext4_super_block * es,
-                              int sync);
-static void ext4_mark_recovery_complete(struct super_block * sb,
-                                       struct ext4_super_block * es);
-static void ext4_clear_journal_err(struct super_block * sb,
-                                  struct ext4_super_block * es);
+static void ext4_commit_super(struct super_block *sb,
+                             struct ext4_super_block *es, int sync);
+static void ext4_mark_recovery_complete(struct super_block *sb,
+                                       struct ext4_super_block *es);
+static void ext4_clear_journal_err(struct super_block *sb,
+                                  struct ext4_super_block *es);
 static int ext4_sync_fs(struct super_block *sb, int wait);
-static const char *ext4_decode_error(struct super_block * sb, int errno,
+static const char *ext4_decode_error(struct super_block *sb, int errno,
                                     char nbuf[16]);
-static int ext4_remount (struct super_block * sb, int * flags, char * data);
-static int ext4_statfs (struct dentry * dentry, struct kstatfs * buf);
+static int ext4_remount(struct super_block *sb, int *flags, char *data);
+static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf);
 static void ext4_unlockfs(struct super_block *sb);
-static void ext4_write_super (struct super_block * sb);
+static void ext4_write_super(struct super_block *sb);
 static void ext4_write_super_lockfs(struct super_block *sb);
 
 
@@ -211,15 +210,15 @@ static void ext4_handle_error(struct super_block *sb)
        if (sb->s_flags & MS_RDONLY)
                return;
 
-       if (!test_opt (sb, ERRORS_CONT)) {
+       if (!test_opt(sb, ERRORS_CONT)) {
                journal_t *journal = EXT4_SB(sb)->s_journal;
 
                EXT4_SB(sb)->s_mount_opt |= EXT4_MOUNT_ABORT;
                if (journal)
                        jbd2_journal_abort(journal, -EIO);
        }
-       if (test_opt (sb, ERRORS_RO)) {
-               printk (KERN_CRIT "Remounting filesystem read-only\n");
+       if (test_opt(sb, ERRORS_RO)) {
+               printk(KERN_CRIT "Remounting filesystem read-only\n");
                sb->s_flags |= MS_RDONLY;
        }
        ext4_commit_super(sb, es, 1);
@@ -228,13 +227,13 @@ static void ext4_handle_error(struct super_block *sb)
                        sb->s_id);
 }
 
-void ext4_error (struct super_block * sb, const char * function,
-                const char * fmt, ...)
+void ext4_error(struct super_block *sb, const char *function,
+               const char *fmt, ...)
 {
        va_list args;
 
        va_start(args, fmt);
-       printk(KERN_CRIT "EXT4-fs error (device %s): %s: ",sb->s_id, function);
+       printk(KERN_CRIT "EXT4-fs error (device %s): %s: ", sb->s_id, function);
        vprintk(fmt, args);
        printk("\n");
        va_end(args);
@@ -242,7 +241,7 @@ void ext4_error (struct super_block * sb, const char * function,
        ext4_handle_error(sb);
 }
 
-static const char *ext4_decode_error(struct super_block * sb, int errno,
+static const char *ext4_decode_error(struct super_block *sb, int errno,
                                     char nbuf[16])
 {
        char *errstr = NULL;
@@ -278,8 +277,7 @@ static const char *ext4_decode_error(struct super_block * sb, int errno,
 /* __ext4_std_error decodes expected errors from journaling functions
  * automatically and invokes the appropriate error response.  */
 
-void __ext4_std_error (struct super_block * sb, const char * function,
-                      int errno)
+void __ext4_std_error(struct super_block *sb, const char *function, int errno)
 {
        char nbuf[16];
        const char *errstr;
@@ -292,8 +290,8 @@ void __ext4_std_error (struct super_block * sb, const char * function,
                return;
 
        errstr = ext4_decode_error(sb, errno, nbuf);
-       printk (KERN_CRIT "EXT4-fs error (device %s) in %s: %s\n",
-               sb->s_id, function, errstr);
+       printk(KERN_CRIT "EXT4-fs error (device %s) in %s: %s\n",
+              sb->s_id, function, errstr);
 
        ext4_handle_error(sb);
 }
@@ -308,15 +306,15 @@ void __ext4_std_error (struct super_block * sb, const char * function,
  * case we take the easy way out and panic immediately.
  */
 
-void ext4_abort (struct super_block * sb, const char * function,
-                const char * fmt, ...)
+void ext4_abort(struct super_block *sb, const char *function,
+               const char *fmt, ...)
 {
        va_list args;
 
-       printk (KERN_CRIT "ext4_abort called.\n");
+       printk(KERN_CRIT "ext4_abort called.\n");
 
        va_start(args, fmt);
-       printk(KERN_CRIT "EXT4-fs error (device %s): %s: ",sb->s_id, function);
+       printk(KERN_CRIT "EXT4-fs error (device %s): %s: ", sb->s_id, function);
        vprintk(fmt, args);
        printk("\n");
        va_end(args);
@@ -334,8 +332,8 @@ void ext4_abort (struct super_block * sb, const char * function,
        jbd2_journal_abort(EXT4_SB(sb)->s_journal, -EIO);
 }
 
-void ext4_warning (struct super_block * sb, const char * function,
-                  const char * fmt, ...)
+void ext4_warning(struct super_block *sb, const char *function,
+                 const char *fmt, ...)
 {
        va_list args;
 
@@ -496,7 +494,7 @@ static void dump_orphan_list(struct super_block *sb, struct ext4_sb_info *sbi)
        }
 }
 
-static void ext4_put_super (struct super_block * sb)
+static void ext4_put_super(struct super_block *sb)
 {
        struct ext4_sb_info *sbi = EXT4_SB(sb);
        struct ext4_super_block *es = sbi->s_es;
@@ -647,7 +645,8 @@ static void ext4_clear_inode(struct inode *inode)
                                       &EXT4_I(inode)->jinode);
 }
 
-static inline void ext4_show_quota_options(struct seq_file *seq, struct super_block *sb)
+static inline void ext4_show_quota_options(struct seq_file *seq,
+                                          struct super_block *sb)
 {
 #if defined(CONFIG_QUOTA)
        struct ext4_sb_info *sbi = EXT4_SB(sb);
@@ -822,8 +821,8 @@ static struct dentry *ext4_fh_to_parent(struct super_block *sb, struct fid *fid,
 }
 
 #ifdef CONFIG_QUOTA
-#define QTYPE2NAME(t) ((t)==USRQUOTA?"user":"group")
-#define QTYPE2MOPT(on, t) ((t)==USRQUOTA?((on)##USRJQUOTA):((on)##GRPJQUOTA))
+#define QTYPE2NAME(t) ((t) == USRQUOTA?"user":"group")
+#define QTYPE2MOPT(on, t) ((t) == USRQUOTA?((on)##USRJQUOTA):((on)##GRPJQUOTA))
 
 static int ext4_dquot_initialize(struct inode *inode, int type);
 static int ext4_dquot_drop(struct inode *inode);
@@ -991,12 +990,12 @@ static ext4_fsblk_t get_sb_block(void **data)
        return sb_block;
 }
 
-static int parse_options (char *options, struct super_block *sb,
-                         unsigned int *inum, unsigned long *journal_devnum,
-                         ext4_fsblk_t *n_blocks_count, int is_remount)
+static int parse_options(char *options, struct super_block *sb,
+                        unsigned int *inum, unsigned long *journal_devnum,
+                        ext4_fsblk_t *n_blocks_count, int is_remount)
 {
        struct ext4_sb_info *sbi = EXT4_SB(sb);
-       char * p;
+       char *p;
        substring_t args[MAX_OPT_ARGS];
        int data_opt = 0;
        int option;
@@ -1009,7 +1008,7 @@ static int parse_options (char *options, struct super_block *sb,
        if (!options)
                return 1;
 
-       while ((p = strsep (&options, ",")) != NULL) {
+       while ((p = strsep(&options, ",")) != NULL) {
                int token;
                if (!*p)
                        continue;
@@ -1017,16 +1016,16 @@ static int parse_options (char *options, struct super_block *sb,
                token = match_token(p, tokens, args);
                switch (token) {
                case Opt_bsd_df:
-                       clear_opt (sbi->s_mount_opt, MINIX_DF);
+                       clear_opt(sbi->s_mount_opt, MINIX_DF);
                        break;
                case Opt_minix_df:
-                       set_opt (sbi->s_mount_opt, MINIX_DF);
+                       set_opt(sbi->s_mount_opt, MINIX_DF);
                        break;
                case Opt_grpid:
-                       set_opt (sbi->s_mount_opt, GRPID);
+                       set_opt(sbi->s_mount_opt, GRPID);
                        break;
                case Opt_nogrpid:
-                       clear_opt (sbi->s_mount_opt, GRPID);
+                       clear_opt(sbi->s_mount_opt, GRPID);
                        break;
                case Opt_resuid:
                        if (match_int(&args[0], &option))
@@ -1043,41 +1042,41 @@ static int parse_options (char *options, struct super_block *sb,
                        /* *sb_block = match_int(&args[0]); */
                        break;
                case Opt_err_panic:
-                       clear_opt (sbi->s_mount_opt, ERRORS_CONT);
-                       clear_opt (sbi->s_mount_opt, ERRORS_RO);
-                       set_opt (sbi->s_mount_opt, ERRORS_PANIC);
+                       clear_opt(sbi->s_mount_opt, ERRORS_CONT);
+                       clear_opt(sbi->s_mount_opt, ERRORS_RO);
+                       set_opt(sbi->s_mount_opt, ERRORS_PANIC);
                        break;
                case Opt_err_ro:
-                       clear_opt (sbi->s_mount_opt, ERRORS_CONT);
-                       clear_opt (sbi->s_mount_opt, ERRORS_PANIC);
-                       set_opt (sbi->s_mount_opt, ERRORS_RO);
+                       clear_opt(sbi->s_mount_opt, ERRORS_CONT);
+                       clear_opt(sbi->s_mount_opt, ERRORS_PANIC);
+                       set_opt(sbi->s_mount_opt, ERRORS_RO);
                        break;
                case Opt_err_cont:
-                       clear_opt (sbi->s_mount_opt, ERRORS_RO);
-                       clear_opt (sbi->s_mount_opt, ERRORS_PANIC);
-                       set_opt (sbi->s_mount_opt, ERRORS_CONT);
+                       clear_opt(sbi->s_mount_opt, ERRORS_RO);
+                       clear_opt(sbi->s_mount_opt, ERRORS_PANIC);
+                       set_opt(sbi->s_mount_opt, ERRORS_CONT);
                        break;
                case Opt_nouid32:
-                       set_opt (sbi->s_mount_opt, NO_UID32);
+                       set_opt(sbi->s_mount_opt, NO_UID32);
                        break;
                case Opt_nocheck:
-                       clear_opt (sbi->s_mount_opt, CHECK);
+                       clear_opt(sbi->s_mount_opt, CHECK);
                        break;
                case Opt_debug:
-                       set_opt (sbi->s_mount_opt, DEBUG);
+                       set_opt(sbi->s_mount_opt, DEBUG);
                        break;
                case Opt_oldalloc:
-                       set_opt (sbi->s_mount_opt, OLDALLOC);
+                       set_opt(sbi->s_mount_opt, OLDALLOC);
                        break;
                case Opt_orlov:
-                       clear_opt (sbi->s_mount_opt, OLDALLOC);
+                       clear_opt(sbi->s_mount_opt, OLDALLOC);
                        break;
 #ifdef CONFIG_EXT4DEV_FS_XATTR
                case Opt_user_xattr:
-                       set_opt (sbi->s_mount_opt, XATTR_USER);
+                       set_opt(sbi->s_mount_opt, XATTR_USER);
                        break;
                case Opt_nouser_xattr:
-                       clear_opt (sbi->s_mount_opt, XATTR_USER);
+                       clear_opt(sbi->s_mount_opt, XATTR_USER);
                        break;
 #else
                case Opt_user_xattr:
@@ -1115,7 +1114,7 @@ static int parse_options (char *options, struct super_block *sb,
                                       "journal on remount\n");
                                return 0;
                        }
-                       set_opt (sbi->s_mount_opt, UPDATE_JOURNAL);
+                       set_opt(sbi->s_mount_opt, UPDATE_JOURNAL);
                        break;
                case Opt_journal_inum:
                        if (is_remount) {
@@ -1145,7 +1144,7 @@ static int parse_options (char *options, struct super_block *sb,
                        set_opt(sbi->s_mount_opt, JOURNAL_CHECKSUM);
                        break;
                case Opt_noload:
-                       set_opt (sbi->s_mount_opt, NOLOAD);
+                       set_opt(sbi->s_mount_opt, NOLOAD);
                        break;
                case Opt_commit:
                        if (match_int(&args[0], &option))
@@ -1331,7 +1330,7 @@ set_qf_format:
                                        "on this filesystem, use tune2fs\n");
                                return 0;
                        }
-                       set_opt (sbi->s_mount_opt, EXTENTS);
+                       set_opt(sbi->s_mount_opt, EXTENTS);
                        break;
                case Opt_noextents:
                        /*
@@ -1348,7 +1347,7 @@ set_qf_format:
                                                "-o noextents options\n");
                                return 0;
                        }
-                       clear_opt (sbi->s_mount_opt, EXTENTS);
+                       clear_opt(sbi->s_mount_opt, EXTENTS);
                        break;
                case Opt_i_version:
                        set_opt(sbi->s_mount_opt, I_VERSION);
@@ -1374,9 +1373,9 @@ set_qf_format:
                        set_opt(sbi->s_mount_opt, DELALLOC);
                        break;
                default:
-                       printk (KERN_ERR
-                               "EXT4-fs: Unrecognized mount option \"%s\" "
-                               "or missing value\n", p);
+                       printk(KERN_ERR
+                              "EXT4-fs: Unrecognized mount option \"%s\" "
+                              "or missing value\n", p);
                        return 0;
                }
        }
@@ -1423,31 +1422,31 @@ static int ext4_setup_super(struct super_block *sb, struct ext4_super_block *es,
        int res = 0;
 
        if (le32_to_cpu(es->s_rev_level) > EXT4_MAX_SUPP_REV) {
-               printk (KERN_ERR "EXT4-fs warning: revision level too high, "
-                       "forcing read-only mode\n");
+               printk(KERN_ERR "EXT4-fs warning: revision level too high, "
+                      "forcing read-only mode\n");
                res = MS_RDONLY;
        }
        if (read_only)
                return res;
        if (!(sbi->s_mount_state & EXT4_VALID_FS))
-               printk (KERN_WARNING "EXT4-fs warning: mounting unchecked fs, "
-                       "running e2fsck is recommended\n");
+               printk(KERN_WARNING "EXT4-fs warning: mounting unchecked fs, "
+                      "running e2fsck is recommended\n");
        else if ((sbi->s_mount_state & EXT4_ERROR_FS))
-               printk (KERN_WARNING
-                       "EXT4-fs warning: mounting fs with errors, "
-                       "running e2fsck is recommended\n");
+               printk(KERN_WARNING
+                      "EXT4-fs warning: mounting fs with errors, "
+                      "running e2fsck is recommended\n");
        else if ((__s16) le16_to_cpu(es->s_max_mnt_count) >= 0 &&
                 le16_to_cpu(es->s_mnt_count) >=
                 (unsigned short) (__s16) le16_to_cpu(es->s_max_mnt_count))
-               printk (KERN_WARNING
-                       "EXT4-fs warning: maximal mount count reached, "
-                       "running e2fsck is recommended\n");
+               printk(KERN_WARNING
+                      "EXT4-fs warning: maximal mount count reached, "
+                      "running e2fsck is recommended\n");
        else if (le32_to_cpu(es->s_checkinterval) &&
                (le32_to_cpu(es->s_lastcheck) +
                        le32_to_cpu(es->s_checkinterval) <= get_seconds()))
-               printk (KERN_WARNING
-                       "EXT4-fs warning: checktime reached, "
-                       "running e2fsck is recommended\n");
+               printk(KERN_WARNING
+                      "EXT4-fs warning: checktime reached, "
+                      "running e2fsck is recommended\n");
 #if 0
                /* @@@ We _will_ want to clear the valid bit if we find
                 * inconsistencies, to force a fsck at reboot.  But for
@@ -1506,14 +1505,13 @@ static int ext4_fill_flex_info(struct super_block *sb)
 
        flex_group_count = (sbi->s_groups_count + groups_per_flex - 1) /
                groups_per_flex;
-       sbi->s_flex_groups = kmalloc(flex_group_count *
+       sbi->s_flex_groups = kzalloc(flex_group_count *
                                     sizeof(struct flex_groups), GFP_KERNEL);
        if (sbi->s_flex_groups == NULL) {
-               printk(KERN_ERR "EXT4-fs: not enough memory\n");
+               printk(KERN_ERR "EXT4-fs: not enough memory for "
+                               "%lu flex groups\n", flex_group_count);
                goto failed;
        }
-       memset(sbi->s_flex_groups, 0, flex_group_count *
-              sizeof(struct flex_groups));
 
        gdp = ext4_get_group_desc(sb, 1, &bh);
        block_bitmap = ext4_block_bitmap(sb, gdp) - 1;
@@ -1597,16 +1595,14 @@ static int ext4_check_descriptors(struct super_block *sb)
                                (EXT4_BLOCKS_PER_GROUP(sb) - 1);
 
                block_bitmap = ext4_block_bitmap(sb, gdp);
-               if (block_bitmap < first_block || block_bitmap > last_block)
-               {
+               if (block_bitmap < first_block || block_bitmap > last_block) {
                        printk(KERN_ERR "EXT4-fs: ext4_check_descriptors: "
                               "Block bitmap for group %lu not in group "
                               "(block %llu)!", i, block_bitmap);
                        return 0;
                }
                inode_bitmap = ext4_inode_bitmap(sb, gdp);
-               if (inode_bitmap < first_block || inode_bitmap > last_block)
-               {
+               if (inode_bitmap < first_block || inode_bitmap > last_block) {
                        printk(KERN_ERR "EXT4-fs: ext4_check_descriptors: "
                               "Inode bitmap for group %lu not in group "
                               "(block %llu)!", i, inode_bitmap);
@@ -1614,26 +1610,28 @@ static int ext4_check_descriptors(struct super_block *sb)
                }
                inode_table = ext4_inode_table(sb, gdp);
                if (inode_table < first_block ||
-                   inode_table + sbi->s_itb_per_group - 1 > last_block)
-               {
+                   inode_table + sbi->s_itb_per_group - 1 > last_block) {
                        printk(KERN_ERR "EXT4-fs: ext4_check_descriptors: "
                               "Inode table for group %lu not in group "
                               "(block %llu)!", i, inode_table);
                        return 0;
                }
+               spin_lock(sb_bgl_lock(sbi, i));
                if (!ext4_group_desc_csum_verify(sbi, i, gdp)) {
                        printk(KERN_ERR "EXT4-fs: ext4_check_descriptors: "
                               "Checksum for group %lu failed (%u!=%u)\n",
                               i, le16_to_cpu(ext4_group_desc_csum(sbi, i,
                               gdp)), le16_to_cpu(gdp->bg_checksum));
-                       return 0;
+                       if (!(sb->s_flags & MS_RDONLY))
+                               return 0;
                }
+               spin_unlock(sb_bgl_lock(sbi, i));
                if (!flexbg_flag)
                        first_block += EXT4_BLOCKS_PER_GROUP(sb);
        }
 
        ext4_free_blocks_count_set(sbi->s_es, ext4_count_free_blocks(sb));
-       sbi->s_es->s_free_inodes_count=cpu_to_le32(ext4_count_free_inodes(sb));
+       sbi->s_es->s_free_inodes_count = cpu_to_le32(ext4_count_free_inodes(sb));
        return 1;
 }
 
@@ -1654,8 +1652,8 @@ static int ext4_check_descriptors(struct super_block *sb)
  * e2fsck was run on this filesystem, and it must have already done the orphan
  * inode cleanup for us, so we can safely abort without any further action.
  */
-static void ext4_orphan_cleanup (struct super_block * sb,
-                                struct ext4_super_block * es)
+static void ext4_orphan_cleanup(struct super_block *sb,
+                               struct ext4_super_block *es)
 {
        unsigned int s_flags = sb->s_flags;
        int nr_orphans = 0, nr_truncates = 0;
@@ -1732,7 +1730,7 @@ static void ext4_orphan_cleanup (struct super_block * sb,
                iput(inode);  /* The delete magic happens here! */
        }
 
-#define PLURAL(x) (x), ((x)==1) ? "" : "s"
+#define PLURAL(x) (x), ((x) == 1) ? "" : "s"
 
        if (nr_orphans)
                printk(KERN_INFO "EXT4-fs: %s: %d orphan inode%s deleted\n",
@@ -1899,12 +1897,12 @@ static unsigned long ext4_get_stripe_size(struct ext4_sb_info *sbi)
        return 0;
 }
 
-static int ext4_fill_super (struct super_block *sb, void *data, int silent)
+static int ext4_fill_super(struct super_block *sb, void *data, int silent)
                                __releases(kernel_lock)
                                __acquires(kernel_lock)
 
 {
-       struct buffer_head * bh;
+       struct buffer_head *bh;
        struct ext4_super_block *es = NULL;
        struct ext4_sb_info *sbi;
        ext4_fsblk_t block;
@@ -1953,7 +1951,7 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
        }
 
        if (!(bh = sb_bread(sb, logical_sb_block))) {
-               printk (KERN_ERR "EXT4-fs: unable to read superblock\n");
+               printk(KERN_ERR "EXT4-fs: unable to read superblock\n");
                goto out_fail;
        }
        /*
@@ -2026,8 +2024,8 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
        set_opt(sbi->s_mount_opt, DELALLOC);
 
 
-       if (!parse_options ((char *) data, sb, &journal_inum, &journal_devnum,
-                           NULL, 0))
+       if (!parse_options((char *) data, sb, &journal_inum, &journal_devnum,
+                          NULL, 0))
                goto failed_mount;
 
        sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
@@ -2102,7 +2100,7 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
                        goto failed_mount;
                }
 
-               brelse (bh);
+               brelse(bh);
                logical_sb_block = sb_block * EXT4_MIN_BLOCK_SIZE;
                offset = do_div(logical_sb_block, blocksize);
                bh = sb_bread(sb, logical_sb_block);
@@ -2114,8 +2112,8 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
                es = (struct ext4_super_block *)(((char *)bh->b_data) + offset);
                sbi->s_es = es;
                if (es->s_magic != cpu_to_le16(EXT4_SUPER_MAGIC)) {
-                       printk (KERN_ERR
-                               "EXT4-fs: Magic mismatch, very weird !\n");
+                       printk(KERN_ERR
+                              "EXT4-fs: Magic mismatch, very weird !\n");
                        goto failed_mount;
                }
        }
@@ -2132,9 +2130,9 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
                if ((sbi->s_inode_size < EXT4_GOOD_OLD_INODE_SIZE) ||
                    (!is_power_of_2(sbi->s_inode_size)) ||
                    (sbi->s_inode_size > blocksize)) {
-                       printk (KERN_ERR
-                               "EXT4-fs: unsupported inode size: %d\n",
-                               sbi->s_inode_size);
+                       printk(KERN_ERR
+                              "EXT4-fs: unsupported inode size: %d\n",
+                              sbi->s_inode_size);
                        goto failed_mount;
                }
                if (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE)
@@ -2166,20 +2164,20 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
        sbi->s_mount_state = le16_to_cpu(es->s_state);
        sbi->s_addr_per_block_bits = ilog2(EXT4_ADDR_PER_BLOCK(sb));
        sbi->s_desc_per_block_bits = ilog2(EXT4_DESC_PER_BLOCK(sb));
-       for (i=0; i < 4; i++)
+       for (i = 0; i < 4; i++)
                sbi->s_hash_seed[i] = le32_to_cpu(es->s_hash_seed[i]);
        sbi->s_def_hash_version = es->s_def_hash_version;
 
        if (sbi->s_blocks_per_group > blocksize * 8) {
-               printk (KERN_ERR
-                       "EXT4-fs: #blocks per group too big: %lu\n",
-                       sbi->s_blocks_per_group);
+               printk(KERN_ERR
+                      "EXT4-fs: #blocks per group too big: %lu\n",
+                      sbi->s_blocks_per_group);
                goto failed_mount;
        }
        if (sbi->s_inodes_per_group > blocksize * 8) {
-               printk (KERN_ERR
-                       "EXT4-fs: #inodes per group too big: %lu\n",
-                       sbi->s_inodes_per_group);
+               printk(KERN_ERR
+                      "EXT4-fs: #inodes per group too big: %lu\n",
+                      sbi->s_inodes_per_group);
                goto failed_mount;
        }
 
@@ -2213,10 +2211,10 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
        sbi->s_groups_count = blocks_count;
        db_count = (sbi->s_groups_count + EXT4_DESC_PER_BLOCK(sb) - 1) /
                   EXT4_DESC_PER_BLOCK(sb);
-       sbi->s_group_desc = kmalloc(db_count * sizeof (struct buffer_head *),
+       sbi->s_group_desc = kmalloc(db_count * sizeof(struct buffer_head *),
                                    GFP_KERNEL);
        if (sbi->s_group_desc == NULL) {
-               printk (KERN_ERR "EXT4-fs: not enough memory\n");
+               printk(KERN_ERR "EXT4-fs: not enough memory\n");
                goto failed_mount;
        }
 
@@ -2226,13 +2224,13 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
                block = descriptor_loc(sb, logical_sb_block, i);
                sbi->s_group_desc[i] = sb_bread(sb, block);
                if (!sbi->s_group_desc[i]) {
-                       printk (KERN_ERR "EXT4-fs: "
-                               "can't read group descriptor %d\n", i);
+                       printk(KERN_ERR "EXT4-fs: "
+                              "can't read group descriptor %d\n", i);
                        db_count = i;
                        goto failed_mount2;
                }
        }
-       if (!ext4_check_descriptors (sb)) {
+       if (!ext4_check_descriptors(sb)) {
                printk(KERN_ERR "EXT4-fs: group descriptors corrupted!\n");
                goto failed_mount2;
        }
@@ -2308,11 +2306,11 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
                    EXT4_SB(sb)->s_journal->j_failed_commit) {
                        printk(KERN_CRIT "EXT4-fs error (device %s): "
                               "ext4_fill_super: Journal transaction "
-                              "%u is corrupt\n", sb->s_id, 
+                              "%u is corrupt\n", sb->s_id,
                               EXT4_SB(sb)->s_journal->j_failed_commit);
-                       if (test_opt (sb, ERRORS_RO)) {
-                               printk (KERN_CRIT
-                                       "Mounting filesystem read-only\n");
+                       if (test_opt(sb, ERRORS_RO)) {
+                               printk(KERN_CRIT
+                                      "Mounting filesystem read-only\n");
                                sb->s_flags |= MS_RDONLY;
                                EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS;
                                es->s_state |= cpu_to_le16(EXT4_ERROR_FS);
@@ -2332,9 +2330,9 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
                        goto failed_mount3;
        } else {
                if (!silent)
-                       printk (KERN_ERR
-                               "ext4: No journal on filesystem on %s\n",
-                               sb->s_id);
+                       printk(KERN_ERR
+                              "ext4: No journal on filesystem on %s\n",
+                              sb->s_id);
                goto failed_mount3;
        }
 
@@ -2418,7 +2416,7 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
                goto failed_mount4;
        }
 
-       ext4_setup_super (sb, es, sb->s_flags & MS_RDONLY);
+       ext4_setup_super(sb, es, sb->s_flags & MS_RDONLY);
 
        /* determine the minimum size of new large inodes, if present */
        if (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE) {
@@ -2457,12 +2455,12 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
        ext4_orphan_cleanup(sb, es);
        EXT4_SB(sb)->s_mount_state &= ~EXT4_ORPHAN_FS;
        if (needs_recovery)
-               printk (KERN_INFO "EXT4-fs: recovery complete.\n");
+               printk(KERN_INFO "EXT4-fs: recovery complete.\n");
        ext4_mark_recovery_complete(sb, es);
-       printk (KERN_INFO "EXT4-fs: mounted filesystem with %s data mode.\n",
-               test_opt(sb,DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA ? "journal":
-               test_opt(sb,DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA ? "ordered":
-               "writeback");
+       printk(KERN_INFO "EXT4-fs: mounted filesystem with %s data mode.\n",
+              test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA ? "journal":
+              test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA ? "ordered":
+              "writeback");
 
        if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) {
                printk(KERN_WARNING "EXT4-fs: Ignoring delalloc option - "
@@ -2575,14 +2573,14 @@ static journal_t *ext4_get_journal(struct super_block *sb,
 static journal_t *ext4_get_dev_journal(struct super_block *sb,
                                       dev_t j_dev)
 {
-       struct buffer_head * bh;
+       struct buffer_head *bh;
        journal_t *journal;
        ext4_fsblk_t start;
        ext4_fsblk_t len;
        int hblock, blocksize;
        ext4_fsblk_t sb_block;
        unsigned long offset;
-       struct ext4_super_block * es;
+       struct ext4_super_block *es;
        struct block_device *bdev;
 
        bdev = ext4_blkdev_get(j_dev);
@@ -2697,8 +2695,8 @@ static int ext4_load_journal(struct super_block *sb,
                                        "unavailable, cannot proceed.\n");
                                return -EROFS;
                        }
-                       printk (KERN_INFO "EXT4-fs: write access will "
-                                       "be enabled during recovery.\n");
+                       printk(KERN_INFO "EXT4-fs: write access will "
+                              "be enabled during recovery.\n");
                }
        }
 
@@ -2751,8 +2749,8 @@ static int ext4_load_journal(struct super_block *sb,
        return 0;
 }
 
-static int ext4_create_journal(struct super_block * sb,
-                              struct ext4_super_block * es,
+static int ext4_create_journal(struct super_block *sb,
+                              struct ext4_super_block *es,
                               unsigned int journal_inum)
 {
        journal_t *journal;
@@ -2793,9 +2791,8 @@ static int ext4_create_journal(struct super_block * sb,
        return 0;
 }
 
-static void ext4_commit_super (struct super_block * sb,
-                              struct ext4_super_block * es,
-                              int sync)
+static void ext4_commit_super(struct super_block *sb,
+                             struct ext4_super_block *es, int sync)
 {
        struct buffer_head *sbh = EXT4_SB(sb)->s_sbh;
 
@@ -2816,8 +2813,8 @@ static void ext4_commit_super (struct super_block * sb,
  * remounting) the filesystem readonly, then we will end up with a
  * consistent fs on disk.  Record that fact.
  */
-static void ext4_mark_recovery_complete(struct super_block * sb,
-                                       struct ext4_super_block * es)
+static void ext4_mark_recovery_complete(struct super_block *sb,
+                                       struct ext4_super_block *es)
 {
        journal_t *journal = EXT4_SB(sb)->s_journal;
 
@@ -2839,8 +2836,8 @@ static void ext4_mark_recovery_complete(struct super_block * sb,
  * has recorded an error from a previous lifetime, move that error to the
  * main filesystem now.
  */
-static void ext4_clear_journal_err(struct super_block * sb,
-                                  struct ext4_super_block * es)
+static void ext4_clear_journal_err(struct super_block *sb,
+                                  struct ext4_super_block *es)
 {
        journal_t *journal;
        int j_errno;
@@ -2865,7 +2862,7 @@ static void ext4_clear_journal_err(struct super_block * sb,
 
                EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS;
                es->s_state |= cpu_to_le16(EXT4_ERROR_FS);
-               ext4_commit_super (sb, es, 1);
+               ext4_commit_super(sb, es, 1);
 
                jbd2_journal_clear_err(journal);
        }
@@ -2898,7 +2895,7 @@ int ext4_force_commit(struct super_block *sb)
  * This implicitly triggers the writebehind on sync().
  */
 
-static void ext4_write_super (struct super_block * sb)
+static void ext4_write_super(struct super_block *sb)
 {
        if (mutex_trylock(&sb->s_lock) != 0)
                BUG();
@@ -2954,13 +2951,14 @@ static void ext4_unlockfs(struct super_block *sb)
        }
 }
 
-static int ext4_remount (struct super_block * sb, int * flags, char * data)
+static int ext4_remount(struct super_block *sb, int *flags, char *data)
 {
-       struct ext4_super_block * es;
+       struct ext4_super_block *es;
        struct ext4_sb_info *sbi = EXT4_SB(sb);
        ext4_fsblk_t n_blocks_count = 0;
        unsigned long old_sb_flags;
        struct ext4_mount_options old_opts;
+       ext4_group_t g;
        int err;
 #ifdef CONFIG_QUOTA
        int i;
@@ -3038,6 +3036,26 @@ static int ext4_remount (struct super_block * sb, int * flags, char * data)
                                goto restore_opts;
                        }
 
+                       /*
+                        * Make sure the group descriptor checksums
+                        * are sane.  If they aren't, refuse to
+                        * remount r/w.
+                        */
+                       for (g = 0; g < sbi->s_groups_count; g++) {
+                               struct ext4_group_desc *gdp =
+                                       ext4_get_group_desc(sb, g, NULL);
+
+                               if (!ext4_group_desc_csum_verify(sbi, g, gdp)) {
+                                       printk(KERN_ERR
+              "EXT4-fs: ext4_remount: "
+               "Checksum for group %lu failed (%u!=%u)\n",
+               g, le16_to_cpu(ext4_group_desc_csum(sbi, g, gdp)),
+                                              le16_to_cpu(gdp->bg_checksum));
+                                       err = -EINVAL;
+                                       goto restore_opts;
+                               }
+                       }
+
                        /*
                         * If we have an unprocessed orphan list hanging
                         * around from a previously readonly bdev mount,
@@ -3063,7 +3081,7 @@ static int ext4_remount (struct super_block * sb, int * flags, char * data)
                        sbi->s_mount_state = le16_to_cpu(es->s_state);
                        if ((err = ext4_group_extend(sb, es, n_blocks_count)))
                                goto restore_opts;
-                       if (!ext4_setup_super (sb, es, 0))
+                       if (!ext4_setup_super(sb, es, 0))
                                sb->s_flags &= ~MS_RDONLY;
                }
        }
@@ -3093,7 +3111,7 @@ restore_opts:
        return err;
 }
 
-static int ext4_statfs (struct dentry * dentry, struct kstatfs * buf)
+static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf)
 {
        struct super_block *sb = dentry->d_sb;
        struct ext4_sb_info *sbi = EXT4_SB(sb);
@@ -3331,12 +3349,12 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
        }
        /* Journaling quota? */
        if (EXT4_SB(sb)->s_qf_names[type]) {
-               /* Quotafile not of fs root? */
+               /* Quotafile not in fs root? */
                if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode)
                        printk(KERN_WARNING
                                "EXT4-fs: Quota file not on filesystem root. "
                                "Journaled quota will not work.\n");
-       }
+       }
 
        /*
         * When we journal data on quota file, we have to flush journal to see
@@ -3352,8 +3370,9 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
                jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal);
        }
 
+       err = vfs_quota_on_path(sb, type, format_id, &nd.path);
        path_put(&nd.path);
-       return vfs_quota_on(sb, type, format_id, path, remount);
+       return err;
 }
 
 /* Read data from quotafile - avoid pagecache and such because we cannot afford
index 93c5fdc..8954208 100644 (file)
@@ -1512,7 +1512,7 @@ static inline void ext4_xattr_hash_entry(struct ext4_xattr_header *header,
        char *name = entry->e_name;
        int n;
 
-       for (n=0; n < entry->e_name_len; n++) {
+       for (n = 0; n < entry->e_name_len; n++) {
                hash = (hash << NAME_HASH_SHIFT) ^
                       (hash >> (8*sizeof(hash) - NAME_HASH_SHIFT)) ^
                       *name++;
index 8707a8c..ddde370 100644 (file)
@@ -313,6 +313,8 @@ static int fat_allow_set_time(struct msdos_sb_info *sbi, struct inode *inode)
        return 0;
 }
 
+#define TIMES_SET_FLAGS        (ATTR_MTIME_SET | ATTR_ATIME_SET | ATTR_TIMES_SET)
+
 int fat_setattr(struct dentry *dentry, struct iattr *attr)
 {
        struct msdos_sb_info *sbi = MSDOS_SB(dentry->d_sb);
@@ -336,9 +338,9 @@ int fat_setattr(struct dentry *dentry, struct iattr *attr)
 
        /* Check for setting the inode time. */
        ia_valid = attr->ia_valid;
-       if (ia_valid & (ATTR_MTIME_SET | ATTR_ATIME_SET)) {
+       if (ia_valid & TIMES_SET_FLAGS) {
                if (fat_allow_set_time(sbi, inode))
-                       attr->ia_valid &= ~(ATTR_MTIME_SET | ATTR_ATIME_SET);
+                       attr->ia_valid &= ~TIMES_SET_FLAGS;
        }
 
        error = inode_change_ok(inode, attr);
index 61d6251..ac4f7db 100644 (file)
@@ -49,73 +49,6 @@ static int get_close_on_exec(unsigned int fd)
        return res;
 }
 
-/*
- * locate_fd finds a free file descriptor in the open_fds fdset,
- * expanding the fd arrays if necessary.  Must be called with the
- * file_lock held for write.
- */
-
-static int locate_fd(unsigned int orig_start, int cloexec)
-{
-       struct files_struct *files = current->files;
-       unsigned int newfd;
-       unsigned int start;
-       int error;
-       struct fdtable *fdt;
-
-       spin_lock(&files->file_lock);
-repeat:
-       fdt = files_fdtable(files);
-       /*
-        * Someone might have closed fd's in the range
-        * orig_start..fdt->next_fd
-        */
-       start = orig_start;
-       if (start < files->next_fd)
-               start = files->next_fd;
-
-       newfd = start;
-       if (start < fdt->max_fds)
-               newfd = find_next_zero_bit(fdt->open_fds->fds_bits,
-                                          fdt->max_fds, start);
-
-       error = expand_files(files, newfd);
-       if (error < 0)
-               goto out;
-
-       /*
-        * If we needed to expand the fs array we
-        * might have blocked - try again.
-        */
-       if (error)
-               goto repeat;
-
-       if (start <= files->next_fd)
-               files->next_fd = newfd + 1;
-
-       FD_SET(newfd, fdt->open_fds);
-       if (cloexec)
-               FD_SET(newfd, fdt->close_on_exec);
-       else
-               FD_CLR(newfd, fdt->close_on_exec);
-       error = newfd;
-
-out:
-       spin_unlock(&files->file_lock);
-       return error;
-}
-
-static int dupfd(struct file *file, unsigned int start, int cloexec)
-{
-       int fd = locate_fd(start, cloexec);
-       if (fd >= 0)
-               fd_install(fd, file);
-       else
-               fput(file);
-
-       return fd;
-}
-
 asmlinkage long sys_dup3(unsigned int oldfd, unsigned int newfd, int flags)
 {
        int err = -EBADF;
@@ -130,31 +63,35 @@ asmlinkage long sys_dup3(unsigned int oldfd, unsigned int newfd, int flags)
                return -EINVAL;
 
        spin_lock(&files->file_lock);
-       if (!(file = fcheck(oldfd)))
-               goto out_unlock;
-       get_file(file);                 /* We are now finished with oldfd */
-
        err = expand_files(files, newfd);
+       file = fcheck(oldfd);
+       if (unlikely(!file))
+               goto Ebadf;
        if (unlikely(err < 0)) {
                if (err == -EMFILE)
-                       err = -EBADF;
-               goto out_fput;
+                       goto Ebadf;
+               goto out_unlock;
        }
-
-       /* To avoid races with open() and dup(), we will mark the fd as
-        * in-use in the open-file bitmap throughout the entire dup2()
-        * process.  This is quite safe: do_close() uses the fd array
-        * entry, not the bitmap, to decide what work needs to be
-        * done.  --sct */
-       /* Doesn't work. open() might be there first. --AV */
-
-       /* Yes. It's a race. In user space. Nothing sane to do */
+       /*
+        * We need to detect attempts to do dup2() over allocated but still
+        * not finished descriptor.  NB: OpenBSD avoids that at the price of
+        * extra work in their equivalent of fget() - they insert struct
+        * file immediately after grabbing descriptor, mark it larval if
+        * more work (e.g. actual opening) is needed and make sure that
+        * fget() treats larval files as absent.  Potentially interesting,
+        * but while extra work in fget() is trivial, locking implications
+        * and amount of surgery on open()-related paths in VFS are not.
+        * FreeBSD fails with -EBADF in the same situation, NetBSD "solution"
+        * deadlocks in rather amusing ways, AFAICS.  All of that is out of
+        * scope of POSIX or SUS, since neither considers shared descriptor
+        * tables and this condition does not arise without those.
+        */
        err = -EBUSY;
        fdt = files_fdtable(files);
        tofree = fdt->fd[newfd];
        if (!tofree && FD_ISSET(newfd, fdt->open_fds))
-               goto out_fput;
-
+               goto out_unlock;
+       get_file(file);
        rcu_assign_pointer(fdt->fd[newfd], file);
        FD_SET(newfd, fdt->open_fds);
        if (flags & O_CLOEXEC)
@@ -165,17 +102,14 @@ asmlinkage long sys_dup3(unsigned int oldfd, unsigned int newfd, int flags)
 
        if (tofree)
                filp_close(tofree, files);
-       err = newfd;
-out:
-       return err;
-out_unlock:
-       spin_unlock(&files->file_lock);
-       goto out;
 
-out_fput:
+       return newfd;
+
+Ebadf:
+       err = -EBADF;
+out_unlock:
        spin_unlock(&files->file_lock);
-       fput(file);
-       goto out;
+       return err;
 }
 
 asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd)
@@ -194,10 +128,15 @@ asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd)
 asmlinkage long sys_dup(unsigned int fildes)
 {
        int ret = -EBADF;
-       struct file * file = fget(fildes);
-
-       if (file)
-               ret = dupfd(file, 0, 0);
+       struct file *file = fget(fildes);
+
+       if (file) {
+               ret = get_unused_fd();
+               if (ret >= 0)
+                       fd_install(ret, file);
+               else
+                       fput(file);
+       }
        return ret;
 }
 
@@ -322,8 +261,11 @@ static long do_fcntl(int fd, unsigned int cmd, unsigned long arg,
        case F_DUPFD_CLOEXEC:
                if (arg >= current->signal->rlim[RLIMIT_NOFILE].rlim_cur)
                        break;
-               get_file(filp);
-               err = dupfd(filp, arg, cmd == F_DUPFD_CLOEXEC);
+               err = alloc_fd(arg, cmd == F_DUPFD_CLOEXEC ? O_CLOEXEC : 0);
+               if (err >= 0) {
+                       get_file(filp);
+                       fd_install(err, filp);
+               }
                break;
        case F_GETFD:
                err = get_close_on_exec(fd) ? FD_CLOEXEC : 0;
index d8773b1..f313314 100644 (file)
--- a/fs/file.c
+++ b/fs/file.c
@@ -6,6 +6,7 @@
  *  Manage the dynamic fd arrays in the process files_struct.
  */
 
+#include <linux/module.h>
 #include <linux/fs.h>
 #include <linux/mm.h>
 #include <linux/time.h>
@@ -432,3 +433,63 @@ struct files_struct init_files = {
        },
        .file_lock      = __SPIN_LOCK_UNLOCKED(init_task.file_lock),
 };
+
+/*
+ * allocate a file descriptor, mark it busy.
+ */
+int alloc_fd(unsigned start, unsigned flags)
+{
+       struct files_struct *files = current->files;
+       unsigned int fd;
+       int error;
+       struct fdtable *fdt;
+
+       spin_lock(&files->file_lock);
+repeat:
+       fdt = files_fdtable(files);
+       fd = start;
+       if (fd < files->next_fd)
+               fd = files->next_fd;
+
+       if (fd < fdt->max_fds)
+               fd = find_next_zero_bit(fdt->open_fds->fds_bits,
+                                          fdt->max_fds, fd);
+
+       error = expand_files(files, fd);
+       if (error < 0)
+               goto out;
+
+       /*
+        * If we needed to expand the fs array we
+        * might have blocked - try again.
+        */
+       if (error)
+               goto repeat;
+
+       if (start <= files->next_fd)
+               files->next_fd = fd + 1;
+
+       FD_SET(fd, fdt->open_fds);
+       if (flags & O_CLOEXEC)
+               FD_SET(fd, fdt->close_on_exec);
+       else
+               FD_CLR(fd, fdt->close_on_exec);
+       error = fd;
+#if 1
+       /* Sanity check */
+       if (rcu_dereference(fdt->fd[fd]) != NULL) {
+               printk(KERN_WARNING "alloc_fd: slot %d not NULL!\n", fd);
+               rcu_assign_pointer(fdt->fd[fd], NULL);
+       }
+#endif
+
+out:
+       spin_unlock(&files->file_lock);
+       return error;
+}
+
+int get_unused_fd(void)
+{
+       return alloc_fd(0, 0);
+}
+EXPORT_SYMBOL(get_unused_fd);
index 2eccbfa..ae08c05 100644 (file)
@@ -63,7 +63,7 @@ static void release_buffer_page(struct buffer_head *bh)
                goto nope;
 
        /* OK, it's a truncated page */
-       if (TestSetPageLocked(page))
+       if (!trylock_page(page))
                goto nope;
 
        page_cache_get(page);
@@ -221,7 +221,7 @@ write_out_data:
                 * blocking lock_buffer().
                 */
                if (buffer_dirty(bh)) {
-                       if (test_set_buffer_locked(bh)) {
+                       if (!trylock_buffer(bh)) {
                                BUFFER_TRACE(bh, "needs blocking lock");
                                spin_unlock(&journal->j_list_lock);
                                /* Write out all data to prevent deadlocks */
@@ -446,7 +446,7 @@ void journal_commit_transaction(journal_t *journal)
                        spin_lock(&journal->j_list_lock);
                }
                if (unlikely(!buffer_uptodate(bh))) {
-                       if (TestSetPageLocked(bh->b_page)) {
+                       if (!trylock_page(bh->b_page)) {
                                spin_unlock(&journal->j_list_lock);
                                lock_page(bh->b_page);
                                spin_lock(&journal->j_list_lock);
index f8b3be8..f2ad061 100644 (file)
@@ -67,7 +67,7 @@ static void release_buffer_page(struct buffer_head *bh)
                goto nope;
 
        /* OK, it's a truncated page */
-       if (TestSetPageLocked(page))
+       if (!trylock_page(page))
                goto nope;
 
        page_cache_get(page);
@@ -262,8 +262,18 @@ static int journal_finish_inode_data_buffers(journal_t *journal,
                jinode->i_flags |= JI_COMMIT_RUNNING;
                spin_unlock(&journal->j_list_lock);
                err = filemap_fdatawait(jinode->i_vfs_inode->i_mapping);
-               if (!ret)
-                       ret = err;
+               if (err) {
+                       /*
+                        * Because AS_EIO is cleared by
+                        * wait_on_page_writeback_range(), set it again so
+                        * that user process can get -EIO from fsync().
+                        */
+                       set_bit(AS_EIO,
+                               &jinode->i_vfs_inode->i_mapping->flags);
+
+                       if (!ret)
+                               ret = err;
+               }
                spin_lock(&journal->j_list_lock);
                jinode->i_flags &= ~JI_COMMIT_RUNNING;
                wake_up_bit(&jinode->i_flags, __JI_COMMIT_RUNNING);
@@ -670,8 +680,14 @@ start_journal_io:
         * commit block, which happens below in such setting.
         */
        err = journal_finish_inode_data_buffers(journal, commit_transaction);
-       if (err)
-               jbd2_journal_abort(journal, err);
+       if (err) {
+               char b[BDEVNAME_SIZE];
+
+               printk(KERN_WARNING
+                       "JBD2: Detected IO errors while flushing file data "
+                       "on %s\n", bdevname(journal->j_fs_dev, b));
+               err = 0;
+       }
 
        /* Lo and behold: we have just managed to send a transaction to
            the log.  Before we can commit it, wait for the IO so far to
index b26c6d9..8207a01 100644 (file)
@@ -68,7 +68,6 @@ EXPORT_SYMBOL(jbd2_journal_set_features);
 EXPORT_SYMBOL(jbd2_journal_create);
 EXPORT_SYMBOL(jbd2_journal_load);
 EXPORT_SYMBOL(jbd2_journal_destroy);
-EXPORT_SYMBOL(jbd2_journal_update_superblock);
 EXPORT_SYMBOL(jbd2_journal_abort);
 EXPORT_SYMBOL(jbd2_journal_errno);
 EXPORT_SYMBOL(jbd2_journal_ack_err);
index 629af01..6caf1e1 100644 (file)
@@ -23,6 +23,8 @@
 
 int jffs2_sum_init(struct jffs2_sb_info *c)
 {
+       uint32_t sum_size = max_t(uint32_t, c->sector_size, MAX_SUMMARY_SIZE);
+
        c->summary = kzalloc(sizeof(struct jffs2_summary), GFP_KERNEL);
 
        if (!c->summary) {
@@ -30,7 +32,7 @@ int jffs2_sum_init(struct jffs2_sb_info *c)
                return -ENOMEM;
        }
 
-       c->summary->sum_buf = vmalloc(c->sector_size);
+       c->summary->sum_buf = kmalloc(sum_size, GFP_KERNEL);
 
        if (!c->summary->sum_buf) {
                JFFS2_WARNING("Can't allocate buffer for writing out summary information!\n");
@@ -49,7 +51,7 @@ void jffs2_sum_exit(struct jffs2_sb_info *c)
 
        jffs2_sum_disable_collecting(c->summary);
 
-       vfree(c->summary->sum_buf);
+       kfree(c->summary->sum_buf);
        c->summary->sum_buf = NULL;
 
        kfree(c->summary);
@@ -665,7 +667,7 @@ crc_err:
 /* Write summary data to flash - helper function for jffs2_sum_write_sumnode() */
 
 static int jffs2_sum_write_data(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb,
-                                       uint32_t infosize, uint32_t datasize, int padsize)
+                               uint32_t infosize, uint32_t datasize, int padsize)
 {
        struct jffs2_raw_summary isum;
        union jffs2_sum_mem *temp;
@@ -676,6 +678,26 @@ static int jffs2_sum_write_data(struct jffs2_sb_info *c, struct jffs2_eraseblock
        int ret;
        size_t retlen;
 
+       if (padsize + datasize > MAX_SUMMARY_SIZE) {
+               /* It won't fit in the buffer. Abort summary for this jeb */
+               jffs2_sum_disable_collecting(c->summary);
+
+               JFFS2_WARNING("Summary too big (%d data, %d pad) in eraseblock at %08x\n",
+                             datasize, padsize, jeb->offset);
+               /* Non-fatal */
+               return 0;
+       }
+       /* Is there enough space for summary? */
+       if (padsize < 0) {
+               /* don't try to write out summary for this jeb */
+               jffs2_sum_disable_collecting(c->summary);
+
+               JFFS2_WARNING("Not enough space for summary, padsize = %d\n",
+                             padsize);
+               /* Non-fatal */
+               return 0;
+       }
+
        memset(c->summary->sum_buf, 0xff, datasize);
        memset(&isum, 0, sizeof(isum));
 
@@ -821,7 +843,7 @@ int jffs2_sum_write_sumnode(struct jffs2_sb_info *c)
 {
        int datasize, infosize, padsize;
        struct jffs2_eraseblock *jeb;
-       int ret;
+       int ret = 0;
 
        dbg_summary("called\n");
 
@@ -841,16 +863,6 @@ int jffs2_sum_write_sumnode(struct jffs2_sb_info *c)
        infosize += padsize;
        datasize += padsize;
 
-       /* Is there enough space for summary? */
-       if (padsize < 0) {
-               /* don't try to write out summary for this jeb */
-               jffs2_sum_disable_collecting(c->summary);
-
-               JFFS2_WARNING("Not enough space for summary, padsize = %d\n", padsize);
-               spin_lock(&c->erase_completion_lock);
-               return 0;
-       }
-
        ret = jffs2_sum_write_data(c, jeb, infosize, datasize, padsize);
        spin_lock(&c->erase_completion_lock);
        return ret;
index 8bf34f2..60207a2 100644 (file)
 #ifndef JFFS2_SUMMARY_H
 #define JFFS2_SUMMARY_H
 
+/* Limit summary size to 64KiB so that we can kmalloc it. If the summary
+   is larger than that, we have to just ditch it and avoid using summary
+   for the eraseblock in question... and it probably doesn't hurt us much
+   anyway. */
+#define MAX_SUMMARY_SIZE 65536
+
 #include <linux/uio.h>
 #include <linux/jffs2.h>
 
index baeb71e..1add676 100644 (file)
@@ -216,8 +216,8 @@ int get_sb_pseudo(struct file_system_type *fs_type, char *name,
 
        s->s_flags = MS_NOUSER;
        s->s_maxbytes = ~0ULL;
-       s->s_blocksize = 1024;
-       s->s_blocksize_bits = 10;
+       s->s_blocksize = PAGE_SIZE;
+       s->s_blocksize_bits = PAGE_SHIFT;
        s->s_magic = magic;
        s->s_op = ops ? ops : &simple_super_operations;
        s->s_time_gran = 1;
index a7b0a0b..4ea63ed 100644 (file)
@@ -274,7 +274,7 @@ int inode_permission(struct inode *inode, int mask)
                return retval;
 
        return security_inode_permission(inode,
-                       mask & (MAY_READ|MAY_WRITE|MAY_EXEC));
+                       mask & (MAY_READ|MAY_WRITE|MAY_EXEC|MAY_APPEND));
 }
 
 /**
@@ -1431,8 +1431,7 @@ static int may_delete(struct inode *dir,struct dentry *victim,int isdir)
  *  3. We should have write and exec permissions on dir
  *  4. We can't do it if dir is immutable (done in permission())
  */
-static inline int may_create(struct inode *dir, struct dentry *child,
-                            struct nameidata *nd)
+static inline int may_create(struct inode *dir, struct dentry *child)
 {
        if (child->d_inode)
                return -EEXIST;
@@ -1504,7 +1503,7 @@ void unlock_rename(struct dentry *p1, struct dentry *p2)
 int vfs_create(struct inode *dir, struct dentry *dentry, int mode,
                struct nameidata *nd)
 {
-       int error = may_create(dir, dentry, nd);
+       int error = may_create(dir, dentry);
 
        if (error)
                return error;
@@ -1948,7 +1947,7 @@ EXPORT_SYMBOL_GPL(lookup_create);
 
 int vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
 {
-       int error = may_create(dir, dentry, NULL);
+       int error = may_create(dir, dentry);
 
        if (error)
                return error;
@@ -2049,7 +2048,7 @@ asmlinkage long sys_mknod(const char __user *filename, int mode, unsigned dev)
 
 int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
 {
-       int error = may_create(dir, dentry, NULL);
+       int error = may_create(dir, dentry);
 
        if (error)
                return error;
@@ -2316,7 +2315,7 @@ asmlinkage long sys_unlink(const char __user *pathname)
 
 int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname)
 {
-       int error = may_create(dir, dentry, NULL);
+       int error = may_create(dir, dentry);
 
        if (error)
                return error;
@@ -2386,7 +2385,7 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de
        if (!inode)
                return -ENOENT;
 
-       error = may_create(dir, new_dentry, NULL);
+       error = may_create(dir, new_dentry);
        if (error)
                return error;
 
@@ -2595,7 +2594,7 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
                return error;
 
        if (!new_dentry->d_inode)
-               error = may_create(new_dir, new_dentry, NULL);
+               error = may_create(new_dir, new_dentry);
        else
                error = may_delete(new_dir, new_dentry, is_dir);
        if (error)
index 411728c..6e283c9 100644 (file)
@@ -1667,31 +1667,31 @@ static noinline int do_new_mount(struct nameidata *nd, char *type, int flags,
        if (IS_ERR(mnt))
                return PTR_ERR(mnt);
 
-       return do_add_mount(mnt, nd, mnt_flags, NULL);
+       return do_add_mount(mnt, &nd->path, mnt_flags, NULL);
 }
 
 /*
  * add a mount into a namespace's mount tree
  * - provide the option of adding the new mount to an expiration list
  */
-int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd,
+int do_add_mount(struct vfsmount *newmnt, struct path *path,
                 int mnt_flags, struct list_head *fslist)
 {
        int err;
 
        down_write(&namespace_sem);
        /* Something was mounted here while we slept */
-       while (d_mountpoint(nd->path.dentry) &&
-              follow_down(&nd->path.mnt, &nd->path.dentry))
+       while (d_mountpoint(path->dentry) &&
+              follow_down(&path->mnt, &path->dentry))
                ;
        err = -EINVAL;
-       if (!check_mnt(nd->path.mnt))
+       if (!check_mnt(path->mnt))
                goto unlock;
 
        /* Refuse the same filesystem on the same mount point */
        err = -EBUSY;
-       if (nd->path.mnt->mnt_sb == newmnt->mnt_sb &&
-           nd->path.mnt->mnt_root == nd->path.dentry)
+       if (path->mnt->mnt_sb == newmnt->mnt_sb &&
+           path->mnt->mnt_root == path->dentry)
                goto unlock;
 
        err = -EINVAL;
@@ -1699,7 +1699,7 @@ int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd,
                goto unlock;
 
        newmnt->mnt_flags = mnt_flags;
-       if ((err = graft_tree(newmnt, &nd->path)))
+       if ((err = graft_tree(newmnt, path)))
                goto unlock;
 
        if (fslist) /* add to the specified expiration list */
index 2f285ef..66df08d 100644 (file)
@@ -129,7 +129,7 @@ static void * nfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd)
                goto out_err;
 
        mntget(mnt);
-       err = do_add_mount(mnt, nd, nd->path.mnt->mnt_flags|MNT_SHRINKABLE,
+       err = do_add_mount(mnt, &nd->path, nd->path.mnt->mnt_flags|MNT_SHRINKABLE,
                           &nfs_automount_list);
        if (err < 0) {
                mntput(mnt);
index 8478fc2..46763d1 100644 (file)
@@ -127,7 +127,7 @@ enum {
        Opt_err
 };
 
-static match_table_t __initconst tokens = {
+static match_table_t __initdata tokens = {
        {Opt_port, "port=%u"},
        {Opt_rsize, "rsize=%u"},
        {Opt_wsize, "wsize=%u"},
index 00e9ccd..b38f944 100644 (file)
@@ -1194,7 +1194,7 @@ lock_retry_remap:
                tbh = bhs[i];
                if (!tbh)
                        continue;
-               if (unlikely(test_set_buffer_locked(tbh)))
+               if (!trylock_buffer(tbh))
                        BUG();
                /* The buffer dirty state is now irrelevant, just clean it. */
                clear_buffer_dirty(tbh);
index 33ff314..9669541 100644 (file)
@@ -665,7 +665,7 @@ lock_retry_remap:
        for (i = 0; i < nr_bhs; i++) {
                struct buffer_head *tbh = bhs[i];
 
-               if (unlikely(test_set_buffer_locked(tbh)))
+               if (!trylock_buffer(tbh))
                        continue;
                if (unlikely(buffer_uptodate(tbh))) {
                        unlock_buffer(tbh);
index 790defb..17d32ca 100644 (file)
@@ -586,7 +586,7 @@ int ntfs_sync_mft_mirror(ntfs_volume *vol, const unsigned long mft_no,
                for (i_bhs = 0; i_bhs < nr_bhs; i_bhs++) {
                        struct buffer_head *tbh = bhs[i_bhs];
 
-                       if (unlikely(test_set_buffer_locked(tbh)))
+                       if (!trylock_buffer(tbh))
                                BUG();
                        BUG_ON(!buffer_uptodate(tbh));
                        clear_buffer_dirty(tbh);
@@ -779,7 +779,7 @@ int write_mft_record_nolock(ntfs_inode *ni, MFT_RECORD *m, int sync)
        for (i_bhs = 0; i_bhs < nr_bhs; i_bhs++) {
                struct buffer_head *tbh = bhs[i_bhs];
 
-               if (unlikely(test_set_buffer_locked(tbh)))
+               if (!trylock_buffer(tbh))
                        BUG();
                BUG_ON(!buffer_uptodate(tbh));
                clear_buffer_dirty(tbh);
index 1db0801..506c24f 100644 (file)
@@ -1073,12 +1073,15 @@ static void ocfs2_write_failure(struct inode *inode,
        for(i = 0; i < wc->w_num_pages; i++) {
                tmppage = wc->w_pages[i];
 
-               if (ocfs2_should_order_data(inode))
-                       walk_page_buffers(wc->w_handle, page_buffers(tmppage),
-                                         from, to, NULL,
-                                         ocfs2_journal_dirty_data);
-
-               block_commit_write(tmppage, from, to);
+               if (page_has_buffers(tmppage)) {
+                       if (ocfs2_should_order_data(inode))
+                               walk_page_buffers(wc->w_handle,
+                                                 page_buffers(tmppage),
+                                                 from, to, NULL,
+                                                 ocfs2_journal_dirty_data);
+
+                       block_commit_write(tmppage, from, to);
+               }
        }
 }
 
@@ -1901,12 +1904,14 @@ int ocfs2_write_end_nolock(struct address_space *mapping,
                        to = PAGE_CACHE_SIZE;
                }
 
-               if (ocfs2_should_order_data(inode))
-                       walk_page_buffers(wc->w_handle, page_buffers(tmppage),
-                                         from, to, NULL,
-                                         ocfs2_journal_dirty_data);
-
-               block_commit_write(tmppage, from, to);
+               if (page_has_buffers(tmppage)) {
+                       if (ocfs2_should_order_data(inode))
+                               walk_page_buffers(wc->w_handle,
+                                                 page_buffers(tmppage),
+                                                 from, to, NULL,
+                                                 ocfs2_journal_dirty_data);
+                       block_commit_write(tmppage, from, to);
+               }
        }
 
 out_write_size:
index be2dd95..ec2ed15 100644 (file)
@@ -1766,8 +1766,8 @@ out_inode_unlock:
 out_rw_unlock:
        ocfs2_rw_unlock(inode, 1);
 
-       mutex_unlock(&inode->i_mutex);
 out:
+       mutex_unlock(&inode->i_mutex);
        return ret;
 }
 
index a8c19cb..7a37240 100644 (file)
@@ -57,7 +57,7 @@ static int __ocfs2_recovery_thread(void *arg);
 static int ocfs2_commit_cache(struct ocfs2_super *osb);
 static int ocfs2_wait_on_mount(struct ocfs2_super *osb);
 static int ocfs2_journal_toggle_dirty(struct ocfs2_super *osb,
-                                     int dirty);
+                                     int dirty, int replayed);
 static int ocfs2_trylock_journal(struct ocfs2_super *osb,
                                 int slot_num);
 static int ocfs2_recover_orphans(struct ocfs2_super *osb,
@@ -562,8 +562,18 @@ done:
        return status;
 }
 
+static void ocfs2_bump_recovery_generation(struct ocfs2_dinode *di)
+{
+       le32_add_cpu(&(di->id1.journal1.ij_recovery_generation), 1);
+}
+
+static u32 ocfs2_get_recovery_generation(struct ocfs2_dinode *di)
+{
+       return le32_to_cpu(di->id1.journal1.ij_recovery_generation);
+}
+
 static int ocfs2_journal_toggle_dirty(struct ocfs2_super *osb,
-                                     int dirty)
+                                     int dirty, int replayed)
 {
        int status;
        unsigned int flags;
@@ -593,6 +603,9 @@ static int ocfs2_journal_toggle_dirty(struct ocfs2_super *osb,
                flags &= ~OCFS2_JOURNAL_DIRTY_FL;
        fe->id1.journal1.ij_flags = cpu_to_le32(flags);
 
+       if (replayed)
+               ocfs2_bump_recovery_generation(fe);
+
        status = ocfs2_write_block(osb, bh, journal->j_inode);
        if (status < 0)
                mlog_errno(status);
@@ -667,7 +680,7 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb)
                 * Do not toggle if flush was unsuccessful otherwise
                 * will leave dirty metadata in a "clean" journal
                 */
-               status = ocfs2_journal_toggle_dirty(osb, 0);
+               status = ocfs2_journal_toggle_dirty(osb, 0, 0);
                if (status < 0)
                        mlog_errno(status);
        }
@@ -710,7 +723,7 @@ static void ocfs2_clear_journal_error(struct super_block *sb,
        }
 }
 
-int ocfs2_journal_load(struct ocfs2_journal *journal, int local)
+int ocfs2_journal_load(struct ocfs2_journal *journal, int local, int replayed)
 {
        int status = 0;
        struct ocfs2_super *osb;
@@ -729,7 +742,7 @@ int ocfs2_journal_load(struct ocfs2_journal *journal, int local)
 
        ocfs2_clear_journal_error(osb->sb, journal->j_journal, osb->slot_num);
 
-       status = ocfs2_journal_toggle_dirty(osb, 1);
+       status = ocfs2_journal_toggle_dirty(osb, 1, replayed);
        if (status < 0) {
                mlog_errno(status);
                goto done;
@@ -771,7 +784,7 @@ int ocfs2_journal_wipe(struct ocfs2_journal *journal, int full)
                goto bail;
        }
 
-       status = ocfs2_journal_toggle_dirty(journal->j_osb, 0);
+       status = ocfs2_journal_toggle_dirty(journal->j_osb, 0, 0);
        if (status < 0)
                mlog_errno(status);
 
@@ -1034,6 +1047,12 @@ restart:
        spin_unlock(&osb->osb_lock);
        mlog(0, "All nodes recovered\n");
 
+       /* Refresh all journal recovery generations from disk */
+       status = ocfs2_check_journals_nolocks(osb);
+       status = (status == -EROFS) ? 0 : status;
+       if (status < 0)
+               mlog_errno(status);
+
        ocfs2_super_unlock(osb, 1);
 
        /* We always run recovery on our own orphan dir - the dead
@@ -1096,6 +1115,42 @@ out:
        mlog_exit_void();
 }
 
+static int ocfs2_read_journal_inode(struct ocfs2_super *osb,
+                                   int slot_num,
+                                   struct buffer_head **bh,
+                                   struct inode **ret_inode)
+{
+       int status = -EACCES;
+       struct inode *inode = NULL;
+
+       BUG_ON(slot_num >= osb->max_slots);
+
+       inode = ocfs2_get_system_file_inode(osb, JOURNAL_SYSTEM_INODE,
+                                           slot_num);
+       if (!inode || is_bad_inode(inode)) {
+               mlog_errno(status);
+               goto bail;
+       }
+       SET_INODE_JOURNAL(inode);
+
+       status = ocfs2_read_block(osb, OCFS2_I(inode)->ip_blkno, bh, 0, inode);
+       if (status < 0) {
+               mlog_errno(status);
+               goto bail;
+       }
+
+       status = 0;
+
+bail:
+       if (inode) {
+               if (status || !ret_inode)
+                       iput(inode);
+               else
+                       *ret_inode = inode;
+       }
+       return status;
+}
+
 /* Does the actual journal replay and marks the journal inode as
  * clean. Will only replay if the journal inode is marked dirty. */
 static int ocfs2_replay_journal(struct ocfs2_super *osb,
@@ -1109,22 +1164,36 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb,
        struct ocfs2_dinode *fe;
        journal_t *journal = NULL;
        struct buffer_head *bh = NULL;
+       u32 slot_reco_gen;
 
-       inode = ocfs2_get_system_file_inode(osb, JOURNAL_SYSTEM_INODE,
-                                           slot_num);
-       if (inode == NULL) {
-               status = -EACCES;
+       status = ocfs2_read_journal_inode(osb, slot_num, &bh, &inode);
+       if (status) {
                mlog_errno(status);
                goto done;
        }
-       if (is_bad_inode(inode)) {
-               status = -EACCES;
-               iput(inode);
-               inode = NULL;
-               mlog_errno(status);
+
+       fe = (struct ocfs2_dinode *)bh->b_data;
+       slot_reco_gen = ocfs2_get_recovery_generation(fe);
+       brelse(bh);
+       bh = NULL;
+
+       /*
+        * As the fs recovery is asynchronous, there is a small chance that
+        * another node mounted (and recovered) the slot before the recovery
+        * thread could get the lock. To handle that, we dirty read the journal
+        * inode for that slot to get the recovery generation. If it is
+        * different than what we expected, the slot has been recovered.
+        * If not, it needs recovery.
+        */
+       if (osb->slot_recovery_generations[slot_num] != slot_reco_gen) {
+               mlog(0, "Slot %u already recovered (old/new=%u/%u)\n", slot_num,
+                    osb->slot_recovery_generations[slot_num], slot_reco_gen);
+               osb->slot_recovery_generations[slot_num] = slot_reco_gen;
+               status = -EBUSY;
                goto done;
        }
-       SET_INODE_JOURNAL(inode);
+
+       /* Continue with recovery as the journal has not yet been recovered */
 
        status = ocfs2_inode_lock_full(inode, &bh, 1, OCFS2_META_LOCK_RECOVERY);
        if (status < 0) {
@@ -1138,9 +1207,12 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb,
        fe = (struct ocfs2_dinode *) bh->b_data;
 
        flags = le32_to_cpu(fe->id1.journal1.ij_flags);
+       slot_reco_gen = ocfs2_get_recovery_generation(fe);
 
        if (!(flags & OCFS2_JOURNAL_DIRTY_FL)) {
                mlog(0, "No recovery required for node %d\n", node_num);
+               /* Refresh recovery generation for the slot */
+               osb->slot_recovery_generations[slot_num] = slot_reco_gen;
                goto done;
        }
 
@@ -1188,6 +1260,11 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb,
        flags &= ~OCFS2_JOURNAL_DIRTY_FL;
        fe->id1.journal1.ij_flags = cpu_to_le32(flags);
 
+       /* Increment recovery generation to indicate successful recovery */
+       ocfs2_bump_recovery_generation(fe);
+       osb->slot_recovery_generations[slot_num] =
+                                       ocfs2_get_recovery_generation(fe);
+
        status = ocfs2_write_block(osb, bh, inode);
        if (status < 0)
                mlog_errno(status);
@@ -1252,6 +1329,13 @@ static int ocfs2_recover_node(struct ocfs2_super *osb,
 
        status = ocfs2_replay_journal(osb, node_num, slot_num);
        if (status < 0) {
+               if (status == -EBUSY) {
+                       mlog(0, "Skipping recovery for slot %u (node %u) "
+                            "as another node has recovered it\n", slot_num,
+                            node_num);
+                       status = 0;
+                       goto done;
+               }
                mlog_errno(status);
                goto done;
        }
@@ -1334,12 +1418,29 @@ int ocfs2_mark_dead_nodes(struct ocfs2_super *osb)
 {
        unsigned int node_num;
        int status, i;
+       struct buffer_head *bh = NULL;
+       struct ocfs2_dinode *di;
 
        /* This is called with the super block cluster lock, so we
         * know that the slot map can't change underneath us. */
 
        spin_lock(&osb->osb_lock);
        for (i = 0; i < osb->max_slots; i++) {
+               /* Read journal inode to get the recovery generation */
+               status = ocfs2_read_journal_inode(osb, i, &bh, NULL);
+               if (status) {
+                       mlog_errno(status);
+                       goto bail;
+               }
+               di = (struct ocfs2_dinode *)bh->b_data;
+               osb->slot_recovery_generations[i] =
+                                       ocfs2_get_recovery_generation(di);
+               brelse(bh);
+               bh = NULL;
+
+               mlog(0, "Slot %u recovery generation is %u\n", i,
+                    osb->slot_recovery_generations[i]);
+
                if (i == osb->slot_num)
                        continue;
 
@@ -1603,49 +1704,41 @@ static int ocfs2_commit_thread(void *arg)
        return 0;
 }
 
-/* Look for a dirty journal without taking any cluster locks. Used for
- * hard readonly access to determine whether the file system journals
- * require recovery. */
+/* Reads all the journal inodes without taking any cluster locks. Used
+ * for hard readonly access to determine whether any journal requires
+ * recovery. Also used to refresh the recovery generation numbers after
+ * a journal has been recovered by another node.
+ */
 int ocfs2_check_journals_nolocks(struct ocfs2_super *osb)
 {
        int ret = 0;
        unsigned int slot;
-       struct buffer_head *di_bh;
+       struct buffer_head *di_bh = NULL;
        struct ocfs2_dinode *di;
-       struct inode *journal = NULL;
+       int journal_dirty = 0;
 
        for(slot = 0; slot < osb->max_slots; slot++) {
-               journal = ocfs2_get_system_file_inode(osb,
-                                                     JOURNAL_SYSTEM_INODE,
-                                                     slot);
-               if (!journal || is_bad_inode(journal)) {
-                       ret = -EACCES;
-                       mlog_errno(ret);
-                       goto out;
-               }
-
-               di_bh = NULL;
-               ret = ocfs2_read_block(osb, OCFS2_I(journal)->ip_blkno, &di_bh,
-                                      0, journal);
-               if (ret < 0) {
+               ret = ocfs2_read_journal_inode(osb, slot, &di_bh, NULL);
+               if (ret) {
                        mlog_errno(ret);
                        goto out;
                }
 
                di = (struct ocfs2_dinode *) di_bh->b_data;
 
+               osb->slot_recovery_generations[slot] =
+                                       ocfs2_get_recovery_generation(di);
+
                if (le32_to_cpu(di->id1.journal1.ij_flags) &
                    OCFS2_JOURNAL_DIRTY_FL)
-                       ret = -EROFS;
+                       journal_dirty = 1;
 
                brelse(di_bh);
-               if (ret)
-                       break;
+               di_bh = NULL;
        }
 
 out:
-       if (journal)
-               iput(journal);
-
+       if (journal_dirty)
+               ret = -EROFS;
        return ret;
 }
index db82be2..2178ebf 100644 (file)
@@ -161,7 +161,8 @@ int    ocfs2_journal_init(struct ocfs2_journal *journal,
 void   ocfs2_journal_shutdown(struct ocfs2_super *osb);
 int    ocfs2_journal_wipe(struct ocfs2_journal *journal,
                          int full);
-int    ocfs2_journal_load(struct ocfs2_journal *journal, int local);
+int    ocfs2_journal_load(struct ocfs2_journal *journal, int local,
+                         int replayed);
 int    ocfs2_check_journals_nolocks(struct ocfs2_super *osb);
 void   ocfs2_recovery_thread(struct ocfs2_super *osb,
                             int node_num);
index 1cb814b..7f625f2 100644 (file)
@@ -204,6 +204,8 @@ struct ocfs2_super
 
        struct ocfs2_slot_info *slot_info;
 
+       u32 *slot_recovery_generations;
+
        spinlock_t node_map_lock;
 
        u64 root_blkno;
index 3f19451..4f61985 100644 (file)
@@ -660,7 +660,10 @@ struct ocfs2_dinode {
                struct {                /* Info for journal system
                                           inodes */
                        __le32 ij_flags;        /* Mounted, version, etc. */
-                       __le32 ij_pad;
+                       __le32 ij_recovery_generation; /* Incremented when the
+                                                         journal is recovered
+                                                         after an unclean
+                                                         shutdown */
                } journal1;
        } id1;                          /* Inode type dependant 1 */
 /*C0*/ union {
index 2560b33..88255d3 100644 (file)
@@ -1442,6 +1442,15 @@ static int ocfs2_initialize_super(struct super_block *sb,
        }
        mlog(0, "max_slots for this device: %u\n", osb->max_slots);
 
+       osb->slot_recovery_generations =
+               kcalloc(osb->max_slots, sizeof(*osb->slot_recovery_generations),
+                       GFP_KERNEL);
+       if (!osb->slot_recovery_generations) {
+               status = -ENOMEM;
+               mlog_errno(status);
+               goto bail;
+       }
+
        init_waitqueue_head(&osb->osb_wipe_event);
        osb->osb_orphan_wipes = kcalloc(osb->max_slots,
                                        sizeof(*osb->osb_orphan_wipes),
@@ -1703,7 +1712,7 @@ static int ocfs2_check_volume(struct ocfs2_super *osb)
        local = ocfs2_mount_local(osb);
 
        /* will play back anything left in the journal. */
-       status = ocfs2_journal_load(osb->journal, local);
+       status = ocfs2_journal_load(osb->journal, local, dirty);
        if (status < 0) {
                mlog(ML_ERROR, "ocfs2 journal load failed! %d\n", status);
                goto finally;
@@ -1768,6 +1777,7 @@ static void ocfs2_delete_osb(struct ocfs2_super *osb)
        ocfs2_free_slot_info(osb);
 
        kfree(osb->osb_orphan_wipes);
+       kfree(osb->slot_recovery_generations);
        /* FIXME
         * This belongs in journal shutdown, but because we have to
         * allocate osb->journal at the start of ocfs2_initalize_osb(),
index dc75f22..697663b 100644 (file)
@@ -71,10 +71,10 @@ static int set_run(struct super_block *sb, int map,
                }
                if (set) {
                        set_bit(bit, sbi->s_imap[map]);
-                       set_bit(bit, (long *) bh->b_data);
+                       set_bit(bit, (unsigned long *)bh->b_data);
                } else {
                        clear_bit(bit, sbi->s_imap[map]);
-                       clear_bit(bit, (long *) bh->b_data);
+                       clear_bit(bit, (unsigned long *)bh->b_data);
                }
        }
        mark_buffer_dirty(bh);
@@ -109,7 +109,7 @@ int omfs_allocate_block(struct super_block *sb, u64 block)
                if (!bh)
                        goto out;
 
-               set_bit(bit, (long *) bh->b_data);
+               set_bit(bit, (unsigned long *)bh->b_data);
                mark_buffer_dirty(bh);
                brelse(bh);
        }
index 05a5bc3..c0757e9 100644 (file)
@@ -104,7 +104,7 @@ int omfs_make_empty(struct inode *inode, struct super_block *sb)
 
        oi = (struct omfs_inode *) bh->b_data;
        oi->i_head.h_self = cpu_to_be64(inode->i_ino);
-       oi->i_sibling = ~0ULL;
+       oi->i_sibling = ~cpu_to_be64(0ULL);
 
        mark_buffer_dirty(bh);
        brelse(bh);
index 66e01fa..7e24990 100644 (file)
@@ -30,11 +30,11 @@ void omfs_make_empty_table(struct buffer_head *bh, int offset)
 {
        struct omfs_extent *oe = (struct omfs_extent *) &bh->b_data[offset];
 
-       oe->e_next = ~0ULL;
+       oe->e_next = ~cpu_to_be64(0ULL);
        oe->e_extent_count = cpu_to_be32(1),
        oe->e_fill = cpu_to_be32(0x22),
-       oe->e_entry.e_cluster = ~0ULL;
-       oe->e_entry.e_blocks = ~0ULL;
+       oe->e_entry.e_cluster = ~cpu_to_be64(0ULL);
+       oe->e_entry.e_blocks = ~cpu_to_be64(0ULL);
 }
 
 int omfs_shrink_inode(struct inode *inode)
index d865f55..a95fe59 100644 (file)
@@ -492,7 +492,8 @@ static int omfs_fill_super(struct super_block *sb, void *data, int silent)
        if (sbi->s_num_blocks != be64_to_cpu(omfs_rb->r_num_blocks)) {
                printk(KERN_ERR "omfs: block count discrepancy between "
                        "super and root blocks (%llx, %llx)\n",
-                       sbi->s_num_blocks, be64_to_cpu(omfs_rb->r_num_blocks));
+                       (unsigned long long)sbi->s_num_blocks,
+                       (unsigned long long)be64_to_cpu(omfs_rb->r_num_blocks));
                goto out_brelse_bh2;
        }
 
index 52647be..07da935 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -963,62 +963,6 @@ struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
 }
 EXPORT_SYMBOL(dentry_open);
 
-/*
- * Find an empty file descriptor entry, and mark it busy.
- */
-int get_unused_fd_flags(int flags)
-{
-       struct files_struct * files = current->files;
-       int fd, error;
-       struct fdtable *fdt;
-
-       spin_lock(&files->file_lock);
-
-repeat:
-       fdt = files_fdtable(files);
-       fd = find_next_zero_bit(fdt->open_fds->fds_bits, fdt->max_fds,
-                               files->next_fd);
-
-       /* Do we need to expand the fd array or fd set?  */
-       error = expand_files(files, fd);
-       if (error < 0)
-               goto out;
-
-       if (error) {
-               /*
-                * If we needed to expand the fs array we
-                * might have blocked - try again.
-                */
-               goto repeat;
-       }
-
-       FD_SET(fd, fdt->open_fds);
-       if (flags & O_CLOEXEC)
-               FD_SET(fd, fdt->close_on_exec);
-       else
-               FD_CLR(fd, fdt->close_on_exec);
-       files->next_fd = fd + 1;
-#if 1
-       /* Sanity check */
-       if (fdt->fd[fd] != NULL) {
-               printk(KERN_WARNING "get_unused_fd: slot %d not NULL!\n", fd);
-               fdt->fd[fd] = NULL;
-       }
-#endif
-       error = fd;
-
-out:
-       spin_unlock(&files->file_lock);
-       return error;
-}
-
-int get_unused_fd(void)
-{
-       return get_unused_fd_flags(0);
-}
-
-EXPORT_SYMBOL(get_unused_fd);
-
 static void __put_unused_fd(struct files_struct *files, unsigned int fd)
 {
        struct fdtable *fdt = files_fdtable(files);
index 01ed610..a28840b 100644 (file)
@@ -2423,10 +2423,13 @@ static int do_io_accounting(struct task_struct *task, char *buffer, int whole)
                        "read_bytes: %llu\n"
                        "write_bytes: %llu\n"
                        "cancelled_write_bytes: %llu\n",
-                       acct.rchar, acct.wchar,
-                       acct.syscr, acct.syscw,
-                       acct.read_bytes, acct.write_bytes,
-                       acct.cancelled_write_bytes);
+                       (unsigned long long)acct.rchar,
+                       (unsigned long long)acct.wchar,
+                       (unsigned long long)acct.syscr,
+                       (unsigned long long)acct.syscw,
+                       (unsigned long long)acct.read_bytes,
+                       (unsigned long long)acct.write_bytes,
+                       (unsigned long long)acct.cancelled_write_bytes);
 }
 
 static int proc_tid_io_accounting(struct task_struct *task, char *buffer)
index cb4096c..4fb81e9 100644 (file)
@@ -300,10 +300,10 @@ out:
        return rtn;
 }
 
-static DEFINE_IDR(proc_inum_idr);
+static DEFINE_IDA(proc_inum_ida);
 static DEFINE_SPINLOCK(proc_inum_lock); /* protects the above */
 
-#define PROC_DYNAMIC_FIRST 0xF0000000UL
+#define PROC_DYNAMIC_FIRST 0xF0000000U
 
 /*
  * Return an inode number between PROC_DYNAMIC_FIRST and
@@ -311,36 +311,33 @@ static DEFINE_SPINLOCK(proc_inum_lock); /* protects the above */
  */
 static unsigned int get_inode_number(void)
 {
-       int i, inum = 0;
+       unsigned int i;
        int error;
 
 retry:
-       if (idr_pre_get(&proc_inum_idr, GFP_KERNEL) == 0)
+       if (ida_pre_get(&proc_inum_ida, GFP_KERNEL) == 0)
                return 0;
 
        spin_lock(&proc_inum_lock);
-       error = idr_get_new(&proc_inum_idr, NULL, &i);
+       error = ida_get_new(&proc_inum_ida, &i);
        spin_unlock(&proc_inum_lock);
        if (error == -EAGAIN)
                goto retry;
        else if (error)
                return 0;
 
-       inum = (i & MAX_ID_MASK) + PROC_DYNAMIC_FIRST;
-
-       /* inum will never be more than 0xf0ffffff, so no check
-        * for overflow.
-        */
-
-       return inum;
+       if (i > UINT_MAX - PROC_DYNAMIC_FIRST) {
+               spin_lock(&proc_inum_lock);
+               ida_remove(&proc_inum_ida, i);
+               spin_unlock(&proc_inum_lock);
+       }
+       return PROC_DYNAMIC_FIRST + i;
 }
 
 static void release_inode_number(unsigned int inum)
 {
-       int id = (inum - PROC_DYNAMIC_FIRST) | ~MAX_ID_MASK;
-
        spin_lock(&proc_inum_lock);
-       idr_remove(&proc_inum_idr, id);
+       ida_remove(&proc_inum_ida, inum - PROC_DYNAMIC_FIRST);
        spin_unlock(&proc_inum_lock);
 }
 
index 1922696..5699171 100644 (file)
@@ -2435,7 +2435,7 @@ static int reiserfs_write_full_page(struct page *page,
                if (wbc->sync_mode != WB_SYNC_NONE || !wbc->nonblocking) {
                        lock_buffer(bh);
                } else {
-                       if (test_set_buffer_locked(bh)) {
+                       if (!trylock_buffer(bh)) {
                                redirty_page_for_writepage(wbc, page);
                                continue;
                        }
index c8f60ee..c21df71 100644 (file)
@@ -627,7 +627,7 @@ static int journal_list_still_alive(struct super_block *s,
 static void release_buffer_page(struct buffer_head *bh)
 {
        struct page *page = bh->b_page;
-       if (!page->mapping && !TestSetPageLocked(page)) {
+       if (!page->mapping && trylock_page(page)) {
                page_cache_get(page);
                put_bh(bh);
                if (!page->mapping)
@@ -855,7 +855,7 @@ static int write_ordered_buffers(spinlock_t * lock,
                jh = JH_ENTRY(list->next);
                bh = jh->bh;
                get_bh(bh);
-               if (test_set_buffer_locked(bh)) {
+               if (!trylock_buffer(bh)) {
                        if (!buffer_dirty(bh)) {
                                list_move(&jh->list, &tmp);
                                goto loop_next;
@@ -3871,7 +3871,7 @@ int reiserfs_prepare_for_journal(struct super_block *p_s_sb,
 {
        PROC_INFO_INC(p_s_sb, journal.prepare);
 
-       if (test_set_buffer_locked(bh)) {
+       if (!trylock_buffer(bh)) {
                if (!wait)
                        return 0;
                lock_buffer(bh);
index 879e54d..282a135 100644 (file)
@@ -2076,8 +2076,8 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
                return err;
        /* Quotafile not on the same filesystem? */
        if (nd.path.mnt->mnt_sb != sb) {
-               path_put(&nd.path);
-               return -EXDEV;
+               err = -EXDEV;
+               goto out;
        }
        inode = nd.path.dentry->d_inode;
        /* We must not pack tails for quota files on reiserfs for quota IO to work */
@@ -2087,8 +2087,8 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
                        reiserfs_warning(sb,
                                "reiserfs: Unpacking tail of quota file failed"
                                " (%d). Cannot turn on quotas.", err);
-                       path_put(&nd.path);
-                       return -EINVAL;
+                       err = -EINVAL;
+                       goto out;
                }
                mark_inode_dirty(inode);
        }
@@ -2109,13 +2109,15 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
                /* Just start temporary transaction and finish it */
                err = journal_begin(&th, sb, 1);
                if (err)
-                       return err;
+                       goto out;
                err = journal_end_sync(&th, sb, 1);
                if (err)
-                       return err;
+                       goto out;
        }
+       err = vfs_quota_on_path(sb, type, format_id, &nd.path);
+out:
        path_put(&nd.path);
-       return vfs_quota_on(sb, type, format_id, path, 0);
+       return err;
 }
 
 /* Read data from quotafile - avoid pagecache and such because we cannot afford
index 8e51a2a..60d2f82 100644 (file)
@@ -418,7 +418,8 @@ static int
 romfs_readpage(struct file *file, struct page * page)
 {
        struct inode *inode = page->mapping->host;
-       loff_t offset, avail, readlen;
+       loff_t offset, size;
+       unsigned long filled;
        void *buf;
        int result = -EIO;
 
@@ -430,21 +431,29 @@ romfs_readpage(struct file *file, struct page * page)
 
        /* 32 bit warning -- but not for us :) */
        offset = page_offset(page);
-       if (offset < i_size_read(inode)) {
-               avail = inode->i_size-offset;
-               readlen = min_t(unsigned long, avail, PAGE_SIZE);
-               if (romfs_copyfrom(inode, buf, ROMFS_I(inode)->i_dataoffset+offset, readlen) == readlen) {
-                       if (readlen < PAGE_SIZE) {
-                               memset(buf + readlen,0,PAGE_SIZE-readlen);
-                       }
-                       SetPageUptodate(page);
-                       result = 0;
+       size = i_size_read(inode);
+       filled = 0;
+       result = 0;
+       if (offset < size) {
+               unsigned long readlen;
+
+               size -= offset;
+               readlen = size > PAGE_SIZE ? PAGE_SIZE : size;
+
+               filled = romfs_copyfrom(inode, buf, ROMFS_I(inode)->i_dataoffset+offset, readlen);
+
+               if (filled != readlen) {
+                       SetPageError(page);
+                       filled = 0;
+                       result = -EIO;
                }
        }
-       if (result) {
-               memset(buf, 0, PAGE_SIZE);
-               SetPageError(page);
-       }
+
+       if (filled < PAGE_SIZE)
+               memset(buf + filled, 0, PAGE_SIZE-filled);
+
+       if (!result)
+               SetPageUptodate(page);
        flush_dcache_page(page);
 
        unlock_page(page);
index b30311b..1bbc6f4 100644 (file)
@@ -371,7 +371,7 @@ __generic_file_splice_read(struct file *in, loff_t *ppos,
                         * for an in-flight io page
                         */
                        if (flags & SPLICE_F_NONBLOCK) {
-                               if (TestSetPageLocked(page)) {
+                               if (!trylock_page(page)) {
                                        error = -EAGAIN;
                                        break;
                                }
index 3e30e40..3141969 100644 (file)
@@ -1233,7 +1233,7 @@ static int ufs_show_options(struct seq_file *seq, struct vfsmount *vfs)
 {
        struct ufs_sb_info *sbi = UFS_SB(vfs->mnt_sb);
        unsigned mval = sbi->s_mount_opt & UFS_MOUNT_UFSTYPE;
-       const struct match_token *tp = tokens;
+       struct match_token *tp = tokens;
 
        while (tp->token != Opt_onerror_panic && tp->token != mval)
                ++tp;
index 36ec614..737c9a4 100644 (file)
@@ -106,7 +106,8 @@ xfs-y                               += $(addprefix $(XFS_LINUX)/, \
                                   xfs_iops.o \
                                   xfs_lrw.o \
                                   xfs_super.o \
-                                  xfs_vnode.o)
+                                  xfs_vnode.o \
+                                  xfs_xattr.o)
 
 # Objects in support/
 xfs-y                          += $(addprefix support/, \
index 9b1bb17..1cd3b55 100644 (file)
@@ -90,7 +90,7 @@ kmem_zalloc_greedy(size_t *size, size_t minsize, size_t maxsize,
 }
 
 void
-kmem_free(void *ptr, size_t size)
+kmem_free(const void *ptr)
 {
        if (!is_vmalloc_addr(ptr)) {
                kfree(ptr);
@@ -100,7 +100,7 @@ kmem_free(void *ptr, size_t size)
 }
 
 void *
-kmem_realloc(void *ptr, size_t newsize, size_t oldsize,
+kmem_realloc(const void *ptr, size_t newsize, size_t oldsize,
             unsigned int __nocast flags)
 {
        void    *new;
@@ -110,7 +110,7 @@ kmem_realloc(void *ptr, size_t newsize, size_t oldsize,
                if (new)
                        memcpy(new, ptr,
                                ((oldsize < newsize) ? oldsize : newsize));
-               kmem_free(ptr, oldsize);
+               kmem_free(ptr);
        }
        return new;
 }
index a20683c..af6843c 100644 (file)
@@ -57,8 +57,8 @@ 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(void *, size_t, size_t, unsigned int __nocast);
-extern void  kmem_free(void *, size_t);
+extern void *kmem_realloc(const void *, size_t, size_t, unsigned int __nocast);
+extern void  kmem_free(const void *);
 
 /*
  * Zone interfaces
index a55c3b2..fa47e43 100644 (file)
@@ -409,7 +409,6 @@ xfs_start_buffer_writeback(
 STATIC void
 xfs_start_page_writeback(
        struct page             *page,
-       struct writeback_control *wbc,
        int                     clear_dirty,
        int                     buffers)
 {
@@ -676,7 +675,7 @@ xfs_probe_cluster(
                        } else
                                pg_offset = PAGE_CACHE_SIZE;
 
-                       if (page->index == tindex && !TestSetPageLocked(page)) {
+                       if (page->index == tindex && trylock_page(page)) {
                                pg_len = xfs_probe_page(page, pg_offset, mapped);
                                unlock_page(page);
                        }
@@ -760,7 +759,7 @@ xfs_convert_page(
 
        if (page->index != tindex)
                goto fail;
-       if (TestSetPageLocked(page))
+       if (!trylock_page(page))
                goto fail;
        if (PageWriteback(page))
                goto fail_unlock_page;
@@ -858,7 +857,7 @@ xfs_convert_page(
                                done = 1;
                        }
                }
-               xfs_start_page_writeback(page, wbc, !page_dirty, count);
+               xfs_start_page_writeback(page, !page_dirty, count);
        }
 
        return done;
@@ -1105,7 +1104,7 @@ xfs_page_state_convert(
                         * that we are writing into for the first time.
                         */
                        type = IOMAP_NEW;
-                       if (!test_and_set_bit(BH_Lock, &bh->b_state)) {
+                       if (trylock_buffer(bh)) {
                                ASSERT(buffer_mapped(bh));
                                if (iomap_valid)
                                        all_bh = 1;
@@ -1130,7 +1129,7 @@ xfs_page_state_convert(
                SetPageUptodate(page);
 
        if (startio)
-               xfs_start_page_writeback(page, wbc, 1, count);
+               xfs_start_page_writeback(page, 1, count);
 
        if (ioend && iomap_valid) {
                offset = (iomap.iomap_offset + iomap.iomap_bsize - 1) >>
index 98e0e86..9cc8f02 100644 (file)
@@ -310,8 +310,7 @@ _xfs_buf_free_pages(
        xfs_buf_t       *bp)
 {
        if (bp->b_pages != bp->b_page_array) {
-               kmem_free(bp->b_pages,
-                         bp->b_page_count * sizeof(struct page *));
+               kmem_free(bp->b_pages);
        }
 }
 
@@ -1398,7 +1397,7 @@ STATIC void
 xfs_free_bufhash(
        xfs_buftarg_t           *btp)
 {
-       kmem_free(btp->bt_hash, (1<<btp->bt_hashshift) * sizeof(xfs_bufhash_t));
+       kmem_free(btp->bt_hash);
        btp->bt_hash = NULL;
 }
 
@@ -1428,13 +1427,10 @@ xfs_unregister_buftarg(
 
 void
 xfs_free_buftarg(
-       xfs_buftarg_t           *btp,
-       int                     external)
+       xfs_buftarg_t           *btp)
 {
        xfs_flush_buftarg(btp, 1);
        xfs_blkdev_issue_flush(btp);
-       if (external)
-               xfs_blkdev_put(btp->bt_bdev);
        xfs_free_bufhash(btp);
        iput(btp->bt_mapping->host);
 
@@ -1444,7 +1440,7 @@ xfs_free_buftarg(
        xfs_unregister_buftarg(btp);
        kthread_stop(btp->bt_task);
 
-       kmem_free(btp, sizeof(*btp));
+       kmem_free(btp);
 }
 
 STATIC int
@@ -1575,7 +1571,7 @@ xfs_alloc_buftarg(
        return btp;
 
 error:
-       kmem_free(btp, sizeof(*btp));
+       kmem_free(btp);
        return NULL;
 }
 
index f948ec7..29d1d4a 100644 (file)
@@ -429,7 +429,7 @@ static inline void xfs_bdwrite(void *mp, xfs_buf_t *bp)
  *     Handling of buftargs.
  */
 extern xfs_buftarg_t *xfs_alloc_buftarg(struct block_device *, int);
-extern void xfs_free_buftarg(xfs_buftarg_t *, int);
+extern void xfs_free_buftarg(xfs_buftarg_t *);
 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);
index c672b32..987fe84 100644 (file)
@@ -215,7 +215,7 @@ xfs_fs_get_parent(
        struct xfs_inode        *cip;
        struct dentry           *parent;
 
-       error = xfs_lookup(XFS_I(child->d_inode), &xfs_name_dotdot, &cip);
+       error = xfs_lookup(XFS_I(child->d_inode), &xfs_name_dotdot, &cip, NULL);
        if (unlikely(error))
                return ERR_PTR(-error);
 
index 01939ba..acb978d 100644 (file)
@@ -48,6 +48,8 @@
 #include "xfs_dfrag.h"
 #include "xfs_fsops.h"
 #include "xfs_vnodeops.h"
+#include "xfs_quota.h"
+#include "xfs_inode_item.h"
 
 #include <linux/capability.h>
 #include <linux/dcache.h>
@@ -468,6 +470,12 @@ xfs_attrlist_by_handle(
        if (al_hreq.buflen > XATTR_LIST_MAX)
                return -XFS_ERROR(EINVAL);
 
+       /*
+        * Reject flags, only allow namespaces.
+        */
+       if (al_hreq.flags & ~(ATTR_ROOT | ATTR_SECURE))
+               return -XFS_ERROR(EINVAL);
+
        error = xfs_vget_fsop_handlereq(mp, parinode, &al_hreq.hreq, &inode);
        if (error)
                goto out;
@@ -587,7 +595,7 @@ xfs_attrmulti_by_handle(
                goto out;
 
        error = E2BIG;
-       size = am_hreq.opcount * sizeof(attr_multiop_t);
+       size = am_hreq.opcount * sizeof(xfs_attr_multiop_t);
        if (!size || size > 16 * PAGE_SIZE)
                goto out_vn_rele;
 
@@ -680,9 +688,9 @@ xfs_ioc_space(
                return -XFS_ERROR(EFAULT);
 
        if (filp->f_flags & (O_NDELAY|O_NONBLOCK))
-               attr_flags |= ATTR_NONBLOCK;
+               attr_flags |= XFS_ATTR_NONBLOCK;
        if (ioflags & IO_INVIS)
-               attr_flags |= ATTR_DMI;
+               attr_flags |= XFS_ATTR_DMI;
 
        error = xfs_change_file_space(ip, cmd, &bf, filp->f_pos,
                                              NULL, attr_flags);
@@ -873,6 +881,322 @@ xfs_ioc_fsgetxattr(
        return 0;
 }
 
+STATIC void
+xfs_set_diflags(
+       struct xfs_inode        *ip,
+       unsigned int            xflags)
+{
+       unsigned int            di_flags;
+
+       /* can't set PREALLOC this way, just preserve it */
+       di_flags = (ip->i_d.di_flags & XFS_DIFLAG_PREALLOC);
+       if (xflags & XFS_XFLAG_IMMUTABLE)
+               di_flags |= XFS_DIFLAG_IMMUTABLE;
+       if (xflags & XFS_XFLAG_APPEND)
+               di_flags |= XFS_DIFLAG_APPEND;
+       if (xflags & XFS_XFLAG_SYNC)
+               di_flags |= XFS_DIFLAG_SYNC;
+       if (xflags & XFS_XFLAG_NOATIME)
+               di_flags |= XFS_DIFLAG_NOATIME;
+       if (xflags & XFS_XFLAG_NODUMP)
+               di_flags |= XFS_DIFLAG_NODUMP;
+       if (xflags & XFS_XFLAG_PROJINHERIT)
+               di_flags |= XFS_DIFLAG_PROJINHERIT;
+       if (xflags & XFS_XFLAG_NODEFRAG)
+               di_flags |= XFS_DIFLAG_NODEFRAG;
+       if (xflags & XFS_XFLAG_FILESTREAM)
+               di_flags |= XFS_DIFLAG_FILESTREAM;
+       if ((ip->i_d.di_mode & S_IFMT) == S_IFDIR) {
+               if (xflags & XFS_XFLAG_RTINHERIT)
+                       di_flags |= XFS_DIFLAG_RTINHERIT;
+               if (xflags & XFS_XFLAG_NOSYMLINKS)
+                       di_flags |= XFS_DIFLAG_NOSYMLINKS;
+               if (xflags & XFS_XFLAG_EXTSZINHERIT)
+                       di_flags |= XFS_DIFLAG_EXTSZINHERIT;
+       } else if ((ip->i_d.di_mode & S_IFMT) == S_IFREG) {
+               if (xflags & XFS_XFLAG_REALTIME)
+                       di_flags |= XFS_DIFLAG_REALTIME;
+               if (xflags & XFS_XFLAG_EXTSIZE)
+                       di_flags |= XFS_DIFLAG_EXTSIZE;
+       }
+
+       ip->i_d.di_flags = di_flags;
+}
+
+STATIC void
+xfs_diflags_to_linux(
+       struct xfs_inode        *ip)
+{
+       struct inode            *inode = XFS_ITOV(ip);
+       unsigned int            xflags = xfs_ip2xflags(ip);
+
+       if (xflags & XFS_XFLAG_IMMUTABLE)
+               inode->i_flags |= S_IMMUTABLE;
+       else
+               inode->i_flags &= ~S_IMMUTABLE;
+       if (xflags & XFS_XFLAG_APPEND)
+               inode->i_flags |= S_APPEND;
+       else
+               inode->i_flags &= ~S_APPEND;
+       if (xflags & XFS_XFLAG_SYNC)
+               inode->i_flags |= S_SYNC;
+       else
+               inode->i_flags &= ~S_SYNC;
+       if (xflags & XFS_XFLAG_NOATIME)
+               inode->i_flags |= S_NOATIME;
+       else
+               inode->i_flags &= ~S_NOATIME;
+}
+
+#define FSX_PROJID     1
+#define FSX_EXTSIZE    2
+#define FSX_XFLAGS     4
+#define FSX_NONBLOCK   8
+
+STATIC int
+xfs_ioctl_setattr(
+       xfs_inode_t             *ip,
+       struct fsxattr          *fa,
+       int                     mask)
+{
+       struct xfs_mount        *mp = ip->i_mount;
+       struct xfs_trans        *tp;
+       unsigned int            lock_flags = 0;
+       struct xfs_dquot        *udqp = NULL, *gdqp = NULL;
+       struct xfs_dquot        *olddquot = NULL;
+       int                     code;
+
+       xfs_itrace_entry(ip);
+
+       if (mp->m_flags & XFS_MOUNT_RDONLY)
+               return XFS_ERROR(EROFS);
+       if (XFS_FORCED_SHUTDOWN(mp))
+               return XFS_ERROR(EIO);
+
+       /*
+        * If disk quotas is on, we make sure that the dquots do exist on disk,
+        * before we start any other transactions. Trying to do this later
+        * is messy. We don't care to take a readlock to look at the ids
+        * in inode here, because we can't hold it across the trans_reserve.
+        * If the IDs do change before we take the ilock, we're covered
+        * because the i_*dquot fields will get updated anyway.
+        */
+       if (XFS_IS_QUOTA_ON(mp) && (mask & FSX_PROJID)) {
+               code = XFS_QM_DQVOPALLOC(mp, ip, ip->i_d.di_uid,
+                                        ip->i_d.di_gid, fa->fsx_projid,
+                                        XFS_QMOPT_PQUOTA, &udqp, &gdqp);
+               if (code)
+                       return code;
+       }
+
+       /*
+        * For the other attributes, we acquire the inode lock and
+        * first do an error checking pass.
+        */
+       tp = xfs_trans_alloc(mp, XFS_TRANS_SETATTR_NOT_SIZE);
+       code = xfs_trans_reserve(tp, 0, XFS_ICHANGE_LOG_RES(mp), 0, 0, 0);
+       if (code)
+               goto error_return;
+
+       lock_flags = XFS_ILOCK_EXCL;
+       xfs_ilock(ip, lock_flags);
+
+       /*
+        * CAP_FOWNER overrides the following restrictions:
+        *
+        * The user ID of the calling process must be equal
+        * to the file owner ID, except in cases where the
+        * CAP_FSETID capability is applicable.
+        */
+       if (current->fsuid != ip->i_d.di_uid && !capable(CAP_FOWNER)) {
+               code = XFS_ERROR(EPERM);
+               goto error_return;
+       }
+
+       /*
+        * Do a quota reservation only if projid is actually going to change.
+        */
+       if (mask & FSX_PROJID) {
+               if (XFS_IS_PQUOTA_ON(mp) &&
+                   ip->i_d.di_projid != fa->fsx_projid) {
+                       ASSERT(tp);
+                       code = XFS_QM_DQVOPCHOWNRESV(mp, tp, ip, udqp, gdqp,
+                                               capable(CAP_FOWNER) ?
+                                               XFS_QMOPT_FORCE_RES : 0);
+                       if (code)       /* out of quota */
+                               goto error_return;
+               }
+       }
+
+       if (mask & FSX_EXTSIZE) {
+               /*
+                * Can't change extent size if any extents are allocated.
+                */
+               if (ip->i_d.di_nextents &&
+                   ((ip->i_d.di_extsize << mp->m_sb.sb_blocklog) !=
+                    fa->fsx_extsize)) {
+                       code = XFS_ERROR(EINVAL);       /* EFBIG? */
+                       goto error_return;
+               }
+
+               /*
+                * Extent size must be a multiple of the appropriate block
+                * size, if set at all.
+                */
+               if (fa->fsx_extsize != 0) {
+                       xfs_extlen_t    size;
+
+                       if (XFS_IS_REALTIME_INODE(ip) ||
+                           ((mask & FSX_XFLAGS) &&
+                           (fa->fsx_xflags & XFS_XFLAG_REALTIME))) {
+                               size = mp->m_sb.sb_rextsize <<
+                                      mp->m_sb.sb_blocklog;
+                       } else {
+                               size = mp->m_sb.sb_blocksize;
+                       }
+
+                       if (fa->fsx_extsize % size) {
+                               code = XFS_ERROR(EINVAL);
+                               goto error_return;
+                       }
+               }
+       }
+
+
+       if (mask & FSX_XFLAGS) {
+               /*
+                * Can't change realtime flag if any extents are allocated.
+                */
+               if ((ip->i_d.di_nextents || ip->i_delayed_blks) &&
+                   (XFS_IS_REALTIME_INODE(ip)) !=
+                   (fa->fsx_xflags & XFS_XFLAG_REALTIME)) {
+                       code = XFS_ERROR(EINVAL);       /* EFBIG? */
+                       goto error_return;
+               }
+
+               /*
+                * If realtime flag is set then must have realtime data.
+                */
+               if ((fa->fsx_xflags & XFS_XFLAG_REALTIME)) {
+                       if ((mp->m_sb.sb_rblocks == 0) ||
+                           (mp->m_sb.sb_rextsize == 0) ||
+                           (ip->i_d.di_extsize % mp->m_sb.sb_rextsize)) {
+                               code = XFS_ERROR(EINVAL);
+                               goto error_return;
+                       }
+               }
+
+               /*
+                * Can't modify an immutable/append-only file unless
+                * we have appropriate permission.
+                */
+               if ((ip->i_d.di_flags &
+                               (XFS_DIFLAG_IMMUTABLE|XFS_DIFLAG_APPEND) ||
+                    (fa->fsx_xflags &
+                               (XFS_XFLAG_IMMUTABLE | XFS_XFLAG_APPEND))) &&
+                   !capable(CAP_LINUX_IMMUTABLE)) {
+                       code = XFS_ERROR(EPERM);
+                       goto error_return;
+               }
+       }
+
+       xfs_trans_ijoin(tp, ip, lock_flags);
+       xfs_trans_ihold(tp, ip);
+
+       /*
+        * Change file ownership.  Must be the owner or privileged.
+        * If the system was configured with the "restricted_chown"
+        * option, the owner is not permitted to give away the file,
+        * and can change the group id only to a group of which he
+        * or she is a member.
+        */
+       if (mask & FSX_PROJID) {
+               /*
+                * CAP_FSETID overrides the following restrictions:
+                *
+                * The set-user-ID and set-group-ID bits of a file will be
+                * cleared upon successful return from chown()
+                */
+               if ((ip->i_d.di_mode & (S_ISUID|S_ISGID)) &&
+                   !capable(CAP_FSETID))
+                       ip->i_d.di_mode &= ~(S_ISUID|S_ISGID);
+
+               /*
+                * Change the ownerships and register quota modifications
+                * in the transaction.
+                */
+               if (ip->i_d.di_projid != fa->fsx_projid) {
+                       if (XFS_IS_PQUOTA_ON(mp)) {
+                               olddquot = XFS_QM_DQVOPCHOWN(mp, tp, ip,
+                                                       &ip->i_gdquot, gdqp);
+                       }
+                       ip->i_d.di_projid = fa->fsx_projid;
+
+                       /*
+                        * We may have to rev the inode as well as
+                        * the superblock version number since projids didn't
+                        * exist before DINODE_VERSION_2 and SB_VERSION_NLINK.
+                        */
+                       if (ip->i_d.di_version == XFS_DINODE_VERSION_1)
+                               xfs_bump_ino_vers2(tp, ip);
+               }
+
+       }
+
+       if (mask & FSX_EXTSIZE)
+               ip->i_d.di_extsize = fa->fsx_extsize >> mp->m_sb.sb_blocklog;
+       if (mask & FSX_XFLAGS) {
+               xfs_set_diflags(ip, fa->fsx_xflags);
+               xfs_diflags_to_linux(ip);
+       }
+
+       xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
+       xfs_ichgtime(ip, XFS_ICHGTIME_CHG);
+
+       XFS_STATS_INC(xs_ig_attrchg);
+
+       /*
+        * If this is a synchronous mount, make sure that the
+        * transaction goes to disk before returning to the user.
+        * This is slightly sub-optimal in that truncates require
+        * two sync transactions instead of one for wsync filesystems.
+        * One for the truncate and one for the timestamps since we
+        * don't want to change the timestamps unless we're sure the
+        * truncate worked.  Truncates are less than 1% of the laddis
+        * mix so this probably isn't worth the trouble to optimize.
+        */
+       if (mp->m_flags & XFS_MOUNT_WSYNC)
+               xfs_trans_set_sync(tp);
+       code = xfs_trans_commit(tp, 0);
+       xfs_iunlock(ip, lock_flags);
+
+       /*
+        * Release any dquot(s) the inode had kept before chown.
+        */
+       XFS_QM_DQRELE(mp, olddquot);
+       XFS_QM_DQRELE(mp, udqp);
+       XFS_QM_DQRELE(mp, gdqp);
+
+       if (code)
+               return code;
+
+       if (DM_EVENT_ENABLED(ip, DM_EVENT_ATTRIBUTE)) {
+               XFS_SEND_NAMESP(mp, DM_EVENT_ATTRIBUTE, ip, DM_RIGHT_NULL,
+                               NULL, DM_RIGHT_NULL, NULL, NULL, 0, 0,
+                               (mask & FSX_NONBLOCK) ? DM_FLAGS_NDELAY : 0);
+       }
+
+       return 0;
+
+ error_return:
+       XFS_QM_DQRELE(mp, udqp);
+       XFS_QM_DQRELE(mp, gdqp);
+       xfs_trans_cancel(tp, 0);
+       if (lock_flags)
+               xfs_iunlock(ip, lock_flags);
+       return code;
+}
+
 STATIC int
 xfs_ioc_fssetxattr(
        xfs_inode_t             *ip,
@@ -880,31 +1204,16 @@ xfs_ioc_fssetxattr(
        void                    __user *arg)
 {
        struct fsxattr          fa;
-       struct bhv_vattr        *vattr;
-       int                     error;
-       int                     attr_flags;
+       unsigned int            mask;
 
        if (copy_from_user(&fa, arg, sizeof(fa)))
                return -EFAULT;
 
-       vattr = kmalloc(sizeof(*vattr), GFP_KERNEL);
-       if (unlikely(!vattr))
-               return -ENOMEM;
-
-       attr_flags = 0;
+       mask = FSX_XFLAGS | FSX_EXTSIZE | FSX_PROJID;
        if (filp->f_flags & (O_NDELAY|O_NONBLOCK))
-               attr_flags |= ATTR_NONBLOCK;
-
-       vattr->va_mask = XFS_AT_XFLAGS | XFS_AT_EXTSIZE | XFS_AT_PROJID;
-       vattr->va_xflags  = fa.fsx_xflags;
-       vattr->va_extsize = fa.fsx_extsize;
-       vattr->va_projid  = fa.fsx_projid;
+               mask |= FSX_NONBLOCK;
 
-       error = -xfs_setattr(ip, vattr, attr_flags, NULL);
-       if (!error)
-               vn_revalidate(XFS_ITOV(ip));    /* update flags */
-       kfree(vattr);
-       return 0;
+       return -xfs_ioctl_setattr(ip, &fa, mask);
 }
 
 STATIC int
@@ -926,10 +1235,9 @@ xfs_ioc_setxflags(
        struct file             *filp,
        void                    __user *arg)
 {
-       struct bhv_vattr        *vattr;
+       struct fsxattr          fa;
        unsigned int            flags;
-       int                     attr_flags;
-       int                     error;
+       unsigned int            mask;
 
        if (copy_from_user(&flags, arg, sizeof(flags)))
                return -EFAULT;
@@ -939,22 +1247,12 @@ xfs_ioc_setxflags(
                      FS_SYNC_FL))
                return -EOPNOTSUPP;
 
-       vattr = kmalloc(sizeof(*vattr), GFP_KERNEL);
-       if (unlikely(!vattr))
-               return -ENOMEM;
-
-       attr_flags = 0;
+       mask = FSX_XFLAGS;
        if (filp->f_flags & (O_NDELAY|O_NONBLOCK))
-               attr_flags |= ATTR_NONBLOCK;
-
-       vattr->va_mask = XFS_AT_XFLAGS;
-       vattr->va_xflags = xfs_merge_ioc_xflags(flags, xfs_ip2xflags(ip));
+               mask |= FSX_NONBLOCK;
+       fa.fsx_xflags = xfs_merge_ioc_xflags(flags, xfs_ip2xflags(ip));
 
-       error = -xfs_setattr(ip, vattr, attr_flags, NULL);
-       if (likely(!error))
-               vn_revalidate(XFS_ITOV(ip));    /* update flags */
-       kfree(vattr);
-       return error;
+       return -xfs_ioctl_setattr(ip, &fa, mask);
 }
 
 STATIC int
index 5fc61c8..e88f510 100644 (file)
@@ -181,23 +181,6 @@ xfs_ichgtime_fast(
                mark_inode_dirty_sync(inode);
 }
 
-
-/*
- * Pull the link count and size up from the xfs inode to the linux inode
- */
-STATIC void
-xfs_validate_fields(
-       struct inode            *inode)
-{
-       struct xfs_inode        *ip = XFS_I(inode);
-       loff_t size;
-
-       /* we're under i_sem so i_size can't change under us */
-       size = XFS_ISIZE(ip);
-       if (i_size_read(inode) != size)
-               i_size_write(inode, size);
-}
-
 /*
  * Hook in SELinux.  This is not quite correct yet, what we really need
  * here (as we do for default ACLs) is a mechanism by which creation of
@@ -245,8 +228,7 @@ STATIC void
 xfs_cleanup_inode(
        struct inode    *dir,
        struct inode    *inode,
-       struct dentry   *dentry,
-       int             mode)
+       struct dentry   *dentry)
 {
        struct xfs_name teardown;
 
@@ -257,10 +239,7 @@ xfs_cleanup_inode(
         */
        xfs_dentry_to_name(&teardown, dentry);
 
-       if (S_ISDIR(mode))
-               xfs_rmdir(XFS_I(dir), &teardown, XFS_I(inode));
-       else
-               xfs_remove(XFS_I(dir), &teardown, XFS_I(inode));
+       xfs_remove(XFS_I(dir), &teardown, XFS_I(inode));
        iput(inode);
 }
 
@@ -275,7 +254,7 @@ xfs_vn_mknod(
        struct xfs_inode *ip = NULL;
        xfs_acl_t       *default_acl = NULL;
        struct xfs_name name;
-       attrexists_t    test_default_acl = _ACL_DEFAULT_EXISTS;
+       int (*test_default_acl)(struct inode *) = _ACL_DEFAULT_EXISTS;
        int             error;
 
        /*
@@ -335,14 +314,11 @@ xfs_vn_mknod(
        }
 
 
-       if (S_ISDIR(mode))
-               xfs_validate_fields(inode);
        d_instantiate(dentry, inode);
-       xfs_validate_fields(dir);
        return -error;
 
  out_cleanup_inode:
-       xfs_cleanup_inode(dir, inode, dentry, mode);
+       xfs_cleanup_inode(dir, inode, dentry);
  out_free_acl:
        if (default_acl)
                _ACL_FREE(default_acl);
@@ -382,7 +358,7 @@ xfs_vn_lookup(
                return ERR_PTR(-ENAMETOOLONG);
 
        xfs_dentry_to_name(&name, dentry);
-       error = xfs_lookup(XFS_I(dir), &name, &cip);
+       error = xfs_lookup(XFS_I(dir), &name, &cip, NULL);
        if (unlikely(error)) {
                if (unlikely(error != ENOENT))
                        return ERR_PTR(-error);
@@ -393,6 +369,46 @@ xfs_vn_lookup(
        return d_splice_alias(cip->i_vnode, dentry);
 }
 
+STATIC struct dentry *
+xfs_vn_ci_lookup(
+       struct inode    *dir,
+       struct dentry   *dentry,
+       struct nameidata *nd)
+{
+       struct xfs_inode *ip;
+       struct xfs_name xname;
+       struct xfs_name ci_name;
+       struct qstr     dname;
+       int             error;
+
+       if (dentry->d_name.len >= MAXNAMELEN)
+               return ERR_PTR(-ENAMETOOLONG);
+
+       xfs_dentry_to_name(&xname, dentry);
+       error = xfs_lookup(XFS_I(dir), &xname, &ip, &ci_name);
+       if (unlikely(error)) {
+               if (unlikely(error != ENOENT))
+                       return ERR_PTR(-error);
+               /*
+                * call d_add(dentry, NULL) here when d_drop_negative_children
+                * is called in xfs_vn_mknod (ie. allow negative dentries
+                * with CI filesystems).
+                */
+               return NULL;
+       }
+
+       /* if exact match, just splice and exit */
+       if (!ci_name.name)
+               return d_splice_alias(ip->i_vnode, dentry);
+
+       /* else case-insensitive match... */
+       dname.name = ci_name.name;
+       dname.len = ci_name.len;
+       dentry = d_add_ci(ip->i_vnode, dentry, &dname);
+       kmem_free(ci_name.name);
+       return dentry;
+}
+
 STATIC int
 xfs_vn_link(
        struct dentry   *old_dentry,
@@ -414,7 +430,6 @@ xfs_vn_link(
        }
 
        xfs_iflags_set(XFS_I(dir), XFS_IMODIFIED);
-       xfs_validate_fields(inode);
        d_instantiate(dentry, inode);
        return 0;
 }
@@ -424,19 +439,23 @@ xfs_vn_unlink(
        struct inode    *dir,
        struct dentry   *dentry)
 {
-       struct inode    *inode;
        struct xfs_name name;
        int             error;
 
-       inode = dentry->d_inode;
        xfs_dentry_to_name(&name, dentry);
 
-       error = xfs_remove(XFS_I(dir), &name, XFS_I(inode));
-       if (likely(!error)) {
-               xfs_validate_fields(dir);       /* size needs update */
-               xfs_validate_fields(inode);
-       }
-       return -error;
+       error = -xfs_remove(XFS_I(dir), &name, XFS_I(dentry->d_inode));
+       if (error)
+               return error;
+
+       /*
+        * With unlink, the VFS makes the dentry "negative": no inode,
+        * but still hashed. This is incompatible with case-insensitive
+        * mode, so invalidate (unhash) the dentry in CI-mode.
+        */
+       if (xfs_sb_version_hasasciici(&XFS_M(dir->i_sb)->m_sb))
+               d_invalidate(dentry);
+       return 0;
 }
 
 STATIC int
@@ -466,35 +485,14 @@ xfs_vn_symlink(
                goto out_cleanup_inode;
 
        d_instantiate(dentry, inode);
-       xfs_validate_fields(dir);
-       xfs_validate_fields(inode);
        return 0;
 
  out_cleanup_inode:
-       xfs_cleanup_inode(dir, inode, dentry, 0);
+       xfs_cleanup_inode(dir, inode, dentry);
  out:
        return -error;
 }
 
-STATIC int
-xfs_vn_rmdir(
-       struct inode    *dir,
-       struct dentry   *dentry)
-{
-       struct inode    *inode = dentry->d_inode;
-       struct xfs_name name;
-       int             error;
-
-       xfs_dentry_to_name(&name, dentry);
-
-       error = xfs_rmdir(XFS_I(dir), &name, XFS_I(inode));
-       if (likely(!error)) {
-               xfs_validate_fields(inode);
-               xfs_validate_fields(dir);
-       }
-       return -error;
-}
-
 STATIC int
 xfs_vn_rename(
        struct inode    *odir,
@@ -505,22 +503,13 @@ xfs_vn_rename(
        struct inode    *new_inode = ndentry->d_inode;
        struct xfs_name oname;
        struct xfs_name nname;
-       int             error;
 
        xfs_dentry_to_name(&oname, odentry);
        xfs_dentry_to_name(&nname, ndentry);
 
-       error = xfs_rename(XFS_I(odir), &oname, XFS_I(odentry->d_inode),
+       return -xfs_rename(XFS_I(odir), &oname, XFS_I(odentry->d_inode),
                           XFS_I(ndir), &nname, new_inode ?
                                                XFS_I(new_inode) : NULL);
-       if (likely(!error)) {
-               if (new_inode)
-                       xfs_validate_fields(new_inode);
-               xfs_validate_fields(odir);
-               if (ndir != odir)
-                       xfs_validate_fields(ndir);
-       }
-       return -error;
 }
 
 /*
@@ -659,57 +648,9 @@ xfs_vn_getattr(
 STATIC int
 xfs_vn_setattr(
        struct dentry   *dentry,
-       struct iattr    *attr)
+       struct iattr    *iattr)
 {
-       struct inode    *inode = dentry->d_inode;
-       unsigned int    ia_valid = attr->ia_valid;
-       bhv_vattr_t     vattr = { 0 };
-       int             flags = 0;
-       int             error;
-
-       if (ia_valid & ATTR_UID) {
-               vattr.va_mask |= XFS_AT_UID;
-               vattr.va_uid = attr->ia_uid;
-       }
-       if (ia_valid & ATTR_GID) {
-               vattr.va_mask |= XFS_AT_GID;
-               vattr.va_gid = attr->ia_gid;
-       }
-       if (ia_valid & ATTR_SIZE) {
-               vattr.va_mask |= XFS_AT_SIZE;
-               vattr.va_size = attr->ia_size;
-       }
-       if (ia_valid & ATTR_ATIME) {
-               vattr.va_mask |= XFS_AT_ATIME;
-               vattr.va_atime = attr->ia_atime;
-               inode->i_atime = attr->ia_atime;
-       }
-       if (ia_valid & ATTR_MTIME) {
-               vattr.va_mask |= XFS_AT_MTIME;
-               vattr.va_mtime = attr->ia_mtime;
-       }
-       if (ia_valid & ATTR_CTIME) {
-               vattr.va_mask |= XFS_AT_CTIME;
-               vattr.va_ctime = attr->ia_ctime;
-       }
-       if (ia_valid & ATTR_MODE) {
-               vattr.va_mask |= XFS_AT_MODE;
-               vattr.va_mode = attr->ia_mode;
-               if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID))
-                       inode->i_mode &= ~S_ISGID;
-       }
-
-       if (ia_valid & (ATTR_MTIME_SET | ATTR_ATIME_SET))
-               flags |= ATTR_UTIME;
-#ifdef ATTR_NO_BLOCK
-       if ((ia_valid & ATTR_NO_BLOCK))
-               flags |= ATTR_NONBLOCK;
-#endif
-
-       error = xfs_setattr(XFS_I(inode), &vattr, flags, NULL);
-       if (likely(!error))
-               vn_revalidate(vn_from_inode(inode));
-       return -error;
+       return -xfs_setattr(XFS_I(dentry->d_inode), iattr, 0, NULL);
 }
 
 /*
@@ -727,109 +668,6 @@ xfs_vn_truncate(
        WARN_ON(error);
 }
 
-STATIC int
-xfs_vn_setxattr(
-       struct dentry   *dentry,
-       const char      *name,
-       const void      *data,
-       size_t          size,
-       int             flags)
-{
-       bhv_vnode_t     *vp = vn_from_inode(dentry->d_inode);
-       char            *attr = (char *)name;
-       attrnames_t     *namesp;
-       int             xflags = 0;
-       int             error;
-
-       namesp = attr_lookup_namespace(attr, attr_namespaces, ATTR_NAMECOUNT);
-       if (!namesp)
-               return -EOPNOTSUPP;
-       attr += namesp->attr_namelen;
-       error = namesp->attr_capable(vp, NULL);
-       if (error)
-               return error;
-
-       /* Convert Linux syscall to XFS internal ATTR flags */
-       if (flags & XATTR_CREATE)
-               xflags |= ATTR_CREATE;
-       if (flags & XATTR_REPLACE)
-               xflags |= ATTR_REPLACE;
-       xflags |= namesp->attr_flag;
-       return namesp->attr_set(vp, attr, (void *)data, size, xflags);
-}
-
-STATIC ssize_t
-xfs_vn_getxattr(
-       struct dentry   *dentry,
-       const char      *name,
-       void            *data,
-       size_t          size)
-{
-       bhv_vnode_t     *vp = vn_from_inode(dentry->d_inode);
-       char            *attr = (char *)name;
-       attrnames_t     *namesp;
-       int             xflags = 0;
-       ssize_t         error;
-
-       namesp = attr_lookup_namespace(attr, attr_namespaces, ATTR_NAMECOUNT);
-       if (!namesp)
-               return -EOPNOTSUPP;
-       attr += namesp->attr_namelen;
-       error = namesp->attr_capable(vp, NULL);
-       if (error)
-               return error;
-
-       /* Convert Linux syscall to XFS internal ATTR flags */
-       if (!size) {
-               xflags |= ATTR_KERNOVAL;
-               data = NULL;
-       }
-       xflags |= namesp->attr_flag;
-       return namesp->attr_get(vp, attr, (void *)data, size, xflags);
-}
-
-STATIC ssize_t
-xfs_vn_listxattr(
-       struct dentry           *dentry,
-       char                    *data,
-       size_t                  size)
-{
-       bhv_vnode_t             *vp = vn_from_inode(dentry->d_inode);
-       int                     error, xflags = ATTR_KERNAMELS;
-       ssize_t                 result;
-
-       if (!size)
-               xflags |= ATTR_KERNOVAL;
-       xflags |= capable(CAP_SYS_ADMIN) ? ATTR_KERNFULLS : ATTR_KERNORMALS;
-
-       error = attr_generic_list(vp, data, size, xflags, &result);
-       if (error < 0)
-               return error;
-       return result;
-}
-
-STATIC int
-xfs_vn_removexattr(
-       struct dentry   *dentry,
-       const char      *name)
-{
-       bhv_vnode_t     *vp = vn_from_inode(dentry->d_inode);
-       char            *attr = (char *)name;
-       attrnames_t     *namesp;
-       int             xflags = 0;
-       int             error;
-
-       namesp = attr_lookup_namespace(attr, attr_namespaces, ATTR_NAMECOUNT);
-       if (!namesp)
-               return -EOPNOTSUPP;
-       attr += namesp->attr_namelen;
-       error = namesp->attr_capable(vp, NULL);
-       if (error)
-               return error;
-       xflags |= namesp->attr_flag;
-       return namesp->attr_remove(vp, attr, xflags);
-}
-
 STATIC long
 xfs_vn_fallocate(
        struct inode    *inode,
@@ -853,18 +691,18 @@ xfs_vn_fallocate(
 
        xfs_ilock(ip, XFS_IOLOCK_EXCL);
        error = xfs_change_file_space(ip, XFS_IOC_RESVSP, &bf,
-                                               0, NULL, ATTR_NOLOCK);
+                                     0, NULL, XFS_ATTR_NOLOCK);
        if (!error && !(mode & FALLOC_FL_KEEP_SIZE) &&
            offset + len > i_size_read(inode))
                new_size = offset + len;
 
        /* Change file size if needed */
        if (new_size) {
-               bhv_vattr_t     va;
+               struct iattr iattr;
 
-               va.va_mask = XFS_AT_SIZE;
-               va.va_size = new_size;
-               error = xfs_setattr(ip, &va, ATTR_NOLOCK, NULL);
+               iattr.ia_valid = ATTR_SIZE;
+               iattr.ia_size = new_size;
+               error = xfs_setattr(ip, &iattr, XFS_ATTR_NOLOCK, NULL);
        }
 
        xfs_iunlock(ip, XFS_IOLOCK_EXCL);
@@ -877,10 +715,10 @@ const struct inode_operations xfs_inode_operations = {
        .truncate               = xfs_vn_truncate,
        .getattr                = xfs_vn_getattr,
        .setattr                = xfs_vn_setattr,
-       .setxattr               = xfs_vn_setxattr,
-       .getxattr               = xfs_vn_getxattr,
+       .setxattr               = generic_setxattr,
+       .getxattr               = generic_getxattr,
+       .removexattr            = generic_removexattr,
        .listxattr              = xfs_vn_listxattr,
-       .removexattr            = xfs_vn_removexattr,
        .fallocate              = xfs_vn_fallocate,
 };
 
@@ -891,16 +729,47 @@ const struct inode_operations xfs_dir_inode_operations = {
        .unlink                 = xfs_vn_unlink,
        .symlink                = xfs_vn_symlink,
        .mkdir                  = xfs_vn_mkdir,
-       .rmdir                  = xfs_vn_rmdir,
+       /*
+        * Yes, XFS uses the same method for rmdir and unlink.
+        *
+        * There are some subtile differences deeper in the code,
+        * but we use S_ISDIR to check for those.
+        */
+       .rmdir                  = xfs_vn_unlink,
+       .mknod                  = xfs_vn_mknod,
+       .rename                 = xfs_vn_rename,
+       .permission             = xfs_vn_permission,
+       .getattr                = xfs_vn_getattr,
+       .setattr                = xfs_vn_setattr,
+       .setxattr               = generic_setxattr,
+       .getxattr               = generic_getxattr,
+       .removexattr            = generic_removexattr,
+       .listxattr              = xfs_vn_listxattr,
+};
+
+const struct inode_operations xfs_dir_ci_inode_operations = {
+       .create                 = xfs_vn_create,
+       .lookup                 = xfs_vn_ci_lookup,
+       .link                   = xfs_vn_link,
+       .unlink                 = xfs_vn_unlink,
+       .symlink                = xfs_vn_symlink,
+       .mkdir                  = xfs_vn_mkdir,
+       /*
+        * Yes, XFS uses the same method for rmdir and unlink.
+        *
+        * There are some subtile differences deeper in the code,
+        * but we use S_ISDIR to check for those.
+        */
+       .rmdir                  = xfs_vn_unlink,
        .mknod                  = xfs_vn_mknod,
        .rename                 = xfs_vn_rename,
        .permission             = xfs_vn_permission,
        .getattr                = xfs_vn_getattr,
        .setattr                = xfs_vn_setattr,
-       .setxattr               = xfs_vn_setxattr,
-       .getxattr               = xfs_vn_getxattr,
+       .setxattr               = generic_setxattr,
+       .getxattr               = generic_getxattr,
+       .removexattr            = generic_removexattr,
        .listxattr              = xfs_vn_listxattr,
-       .removexattr            = xfs_vn_removexattr,
 };
 
 const struct inode_operations xfs_symlink_inode_operations = {
@@ -910,8 +779,8 @@ const struct inode_operations xfs_symlink_inode_operations = {
        .permission             = xfs_vn_permission,
        .getattr                = xfs_vn_getattr,
        .setattr                = xfs_vn_setattr,
-       .setxattr               = xfs_vn_setxattr,
-       .getxattr               = xfs_vn_getxattr,
+       .setxattr               = generic_setxattr,
+       .getxattr               = generic_getxattr,
+       .removexattr            = generic_removexattr,
        .listxattr              = xfs_vn_listxattr,
-       .removexattr            = xfs_vn_removexattr,
 };
index 14d0deb..d97ba93 100644 (file)
 
 extern const struct inode_operations xfs_inode_operations;
 extern const struct inode_operations xfs_dir_inode_operations;
+extern const struct inode_operations xfs_dir_ci_inode_operations;
 extern const struct inode_operations xfs_symlink_inode_operations;
 
 extern const struct file_operations xfs_file_operations;
 extern const struct file_operations xfs_dir_file_operations;
 extern const struct file_operations xfs_invis_file_operations;
 
+extern ssize_t xfs_vn_listxattr(struct dentry *, char *data, size_t size);
 
 struct xfs_inode;
 extern void xfs_ichgtime(struct xfs_inode *, int);
index 4edc469..4d45d93 100644 (file)
@@ -76,6 +76,7 @@
 #include <linux/log2.h>
 #include <linux/spinlock.h>
 #include <linux/random.h>
+#include <linux/ctype.h>
 
 #include <asm/page.h>
 #include <asm/div64.h>
@@ -299,4 +300,11 @@ static inline __uint64_t howmany_64(__uint64_t x, __uint32_t y)
        return x;
 }
 
+/* ARM old ABI has some weird alignment/padding */
+#if defined(__arm__) && !defined(__ARM_EABI__)
+#define __arch_pack __attribute__((packed))
+#else
+#define __arch_pack
+#endif
+
 #endif /* __XFS_LINUX__ */
index e480b61..3d5b67c 100644 (file)
@@ -98,12 +98,21 @@ xfs_read_xfsstats(
        return len;
 }
 
-void
+int
 xfs_init_procfs(void)
 {
        if (!proc_mkdir("fs/xfs", NULL))
-               return;
-       create_proc_read_entry("fs/xfs/stat", 0, NULL, xfs_read_xfsstats, NULL);
+               goto out;
+
+       if (!create_proc_read_entry("fs/xfs/stat", 0, NULL,
+                       xfs_read_xfsstats, NULL))
+               goto out_remove_entry;
+       return 0;
+
+ out_remove_entry:
+       remove_proc_entry("fs/xfs", NULL);
+ out:
+       return -ENOMEM;
 }
 
 void
index afd0b0d..e83820f 100644 (file)
@@ -134,7 +134,7 @@ DECLARE_PER_CPU(struct xfsstats, xfsstats);
 #define XFS_STATS_DEC(v)       (per_cpu(xfsstats, current_cpu()).v--)
 #define XFS_STATS_ADD(v, inc)  (per_cpu(xfsstats, current_cpu()).v += (inc))
 
-extern void xfs_init_procfs(void);
+extern int xfs_init_procfs(void);
 extern void xfs_cleanup_procfs(void);
 
 
@@ -144,8 +144,14 @@ extern void xfs_cleanup_procfs(void);
 # define XFS_STATS_DEC(count)
 # define XFS_STATS_ADD(count, inc)
 
-static inline void xfs_init_procfs(void) { };
-static inline void xfs_cleanup_procfs(void) { };
+static inline int xfs_init_procfs(void)
+{
+       return 0;
+}
+
+static inline void xfs_cleanup_procfs(void)
+{
+}
 
 #endif /* !CONFIG_PROC_FS */
 
index 9433812..30ae963 100644 (file)
 #include "xfs_version.h"
 #include "xfs_log_priv.h"
 #include "xfs_trans_priv.h"
+#include "xfs_filestream.h"
+#include "xfs_da_btree.h"
+#include "xfs_dir2_trace.h"
+#include "xfs_extfree_item.h"
+#include "xfs_mru_cache.h"
+#include "xfs_inode_item.h"
 
 #include <linux/namei.h>
 #include <linux/init.h>
@@ -60,6 +66,7 @@
 #include <linux/writeback.h>
 #include <linux/kthread.h>
 #include <linux/freezer.h>
+#include <linux/parser.h>
 
 static struct quotactl_ops xfs_quotactl_operations;
 static struct super_operations xfs_super_operations;
@@ -74,7 +81,10 @@ xfs_args_allocate(
 {
        struct xfs_mount_args   *args;
 
-       args = kmem_zalloc(sizeof(struct xfs_mount_args), KM_SLEEP);
+       args = kzalloc(sizeof(struct xfs_mount_args), GFP_KERNEL);
+       if (!args)
+               return NULL;
+
        args->logbufs = args->logbufsize = -1;
        strncpy(args->fsname, sb->s_id, MAXNAMELEN);
 
@@ -138,6 +148,23 @@ xfs_args_allocate(
 #define MNTOPT_XDSM    "xdsm"          /* DMI enabled (DMAPI / XDSM) */
 #define MNTOPT_DMI     "dmi"           /* DMI enabled (DMAPI / XDSM) */
 
+/*
+ * Table driven mount option parser.
+ *
+ * Currently only used for remount, but it will be used for mount
+ * in the future, too.
+ */
+enum {
+       Opt_barrier, Opt_nobarrier, Opt_err
+};
+
+static match_table_t tokens = {
+       {Opt_barrier, "barrier"},
+       {Opt_nobarrier, "nobarrier"},
+       {Opt_err, NULL}
+};
+
+
 STATIC unsigned long
 suffix_strtoul(char *s, char **endp, unsigned int base)
 {
@@ -314,6 +341,7 @@ xfs_parseargs(
                        args->flags |= XFSMNT_ATTR2;
                } else if (!strcmp(this_char, MNTOPT_NOATTR2)) {
                        args->flags &= ~XFSMNT_ATTR2;
+                       args->flags |= XFSMNT_NOATTR2;
                } else if (!strcmp(this_char, MNTOPT_FILESTREAM)) {
                        args->flags2 |= XFSMNT2_FILESTREAMS;
                } else if (!strcmp(this_char, MNTOPT_NOQUOTA)) {
@@ -564,7 +592,10 @@ xfs_set_inodeops(
                inode->i_mapping->a_ops = &xfs_address_space_operations;
                break;
        case S_IFDIR:
-               inode->i_op = &xfs_dir_inode_operations;
+               if (xfs_sb_version_hasasciici(&XFS_M(inode->i_sb)->m_sb))
+                       inode->i_op = &xfs_dir_ci_inode_operations;
+               else
+                       inode->i_op = &xfs_dir_inode_operations;
                inode->i_fop = &xfs_dir_file_operations;
                break;
        case S_IFLNK:
@@ -733,14 +764,6 @@ xfs_mountfs_check_barriers(xfs_mount_t *mp)
                return;
        }
 
-       if (mp->m_ddev_targp->bt_bdev->bd_disk->queue->ordered ==
-                                       QUEUE_ORDERED_NONE) {
-               xfs_fs_cmn_err(CE_NOTE, mp,
-                 "Disabling barriers, not supported by the underlying device");
-               mp->m_flags &= ~XFS_MOUNT_BARRIER;
-               return;
-       }
-
        if (xfs_readonly_buftarg(mp->m_ddev_targp)) {
                xfs_fs_cmn_err(CE_NOTE, mp,
                  "Disabling barriers, underlying device is readonly");
@@ -764,6 +787,139 @@ xfs_blkdev_issue_flush(
        blkdev_issue_flush(buftarg->bt_bdev, NULL);
 }
 
+STATIC void
+xfs_close_devices(
+       struct xfs_mount        *mp)
+{
+       if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) {
+               struct block_device *logdev = mp->m_logdev_targp->bt_bdev;
+               xfs_free_buftarg(mp->m_logdev_targp);
+               xfs_blkdev_put(logdev);
+       }
+       if (mp->m_rtdev_targp) {
+               struct block_device *rtdev = mp->m_rtdev_targp->bt_bdev;
+               xfs_free_buftarg(mp->m_rtdev_targp);
+               xfs_blkdev_put(rtdev);
+       }
+       xfs_free_buftarg(mp->m_ddev_targp);
+}
+
+/*
+ * The file system configurations are:
+ *     (1) device (partition) with data and internal log
+ *     (2) logical volume with data and log subvolumes.
+ *     (3) logical volume with data, log, and realtime subvolumes.
+ *
+ * We only have to handle opening the log and realtime volumes here if
+ * they are present.  The data subvolume has already been opened by
+ * get_sb_bdev() and is stored in sb->s_bdev.
+ */
+STATIC int
+xfs_open_devices(
+       struct xfs_mount        *mp,
+       struct xfs_mount_args   *args)
+{
+       struct block_device     *ddev = mp->m_super->s_bdev;
+       struct block_device     *logdev = NULL, *rtdev = NULL;
+       int                     error;
+
+       /*
+        * Open real time and log devices - order is important.
+        */
+       if (args->logname[0]) {
+               error = xfs_blkdev_get(mp, args->logname, &logdev);
+               if (error)
+                       goto out;
+       }
+
+       if (args->rtname[0]) {
+               error = xfs_blkdev_get(mp, args->rtname, &rtdev);
+               if (error)
+                       goto out_close_logdev;
+
+               if (rtdev == ddev || rtdev == logdev) {
+                       cmn_err(CE_WARN,
+       "XFS: Cannot mount filesystem with identical rtdev and ddev/logdev.");
+                       error = EINVAL;
+                       goto out_close_rtdev;
+               }
+       }
+
+       /*
+        * Setup xfs_mount buffer target pointers
+        */
+       error = ENOMEM;
+       mp->m_ddev_targp = xfs_alloc_buftarg(ddev, 0);
+       if (!mp->m_ddev_targp)
+               goto out_close_rtdev;
+
+       if (rtdev) {
+               mp->m_rtdev_targp = xfs_alloc_buftarg(rtdev, 1);
+               if (!mp->m_rtdev_targp)
+                       goto out_free_ddev_targ;
+       }
+
+       if (logdev && logdev != ddev) {
+               mp->m_logdev_targp = xfs_alloc_buftarg(logdev, 1);
+               if (!mp->m_logdev_targp)
+                       goto out_free_rtdev_targ;
+       } else {
+               mp->m_logdev_targp = mp->m_ddev_targp;
+       }
+
+       return 0;
+
+ out_free_rtdev_targ:
+       if (mp->m_rtdev_targp)
+               xfs_free_buftarg(mp->m_rtdev_targp);
+ out_free_ddev_targ:
+       xfs_free_buftarg(mp->m_ddev_targp);
+ out_close_rtdev:
+       if (rtdev)
+               xfs_blkdev_put(rtdev);
+ out_close_logdev:
+       if (logdev && logdev != ddev)
+               xfs_blkdev_put(logdev);
+ out:
+       return error;
+}
+
+/*
+ * Setup xfs_mount buffer target pointers based on superblock
+ */
+STATIC int
+xfs_setup_devices(
+       struct xfs_mount        *mp)
+{
+       int                     error;
+
+       error = xfs_setsize_buftarg(mp->m_ddev_targp, mp->m_sb.sb_blocksize,
+                                   mp->m_sb.sb_sectsize);
+       if (error)
+               return error;
+
+       if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) {
+               unsigned int    log_sector_size = BBSIZE;
+
+               if (xfs_sb_version_hassector(&mp->m_sb))
+                       log_sector_size = mp->m_sb.sb_logsectsize;
+               error = xfs_setsize_buftarg(mp->m_logdev_targp,
+                                           mp->m_sb.sb_blocksize,
+                                           log_sector_size);
+               if (error)
+                       return error;
+       }
+       if (mp->m_rtdev_targp) {
+               error = xfs_setsize_buftarg(mp->m_rtdev_targp,
+                                           mp->m_sb.sb_blocksize,
+                                           mp->m_sb.sb_sectsize);
+               if (error)
+                       return error;
+       }
+
+       return 0;
+}
+
 /*
  * XFS AIL push thread support
  */
@@ -848,42 +1004,6 @@ xfs_fs_inode_init_once(
        inode_init_once(vn_to_inode((bhv_vnode_t *)vnode));
 }
 
-STATIC int __init
-xfs_init_zones(void)
-{
-       xfs_vnode_zone = kmem_zone_init_flags(sizeof(bhv_vnode_t), "xfs_vnode",
-                                       KM_ZONE_HWALIGN | KM_ZONE_RECLAIM |
-                                       KM_ZONE_SPREAD,
-                                       xfs_fs_inode_init_once);
-       if (!xfs_vnode_zone)
-               goto out;
-
-       xfs_ioend_zone = kmem_zone_init(sizeof(xfs_ioend_t), "xfs_ioend");
-       if (!xfs_ioend_zone)
-               goto out_destroy_vnode_zone;
-
-       xfs_ioend_pool = mempool_create_slab_pool(4 * MAX_BUF_PER_PAGE,
-                                                 xfs_ioend_zone);
-       if (!xfs_ioend_pool)
-               goto out_free_ioend_zone;
-       return 0;
-
- out_free_ioend_zone:
-       kmem_zone_destroy(xfs_ioend_zone);
- out_destroy_vnode_zone:
-       kmem_zone_destroy(xfs_vnode_zone);
- out:
-       return -ENOMEM;
-}
-
-STATIC void
-xfs_destroy_zones(void)
-{
-       mempool_destroy(xfs_ioend_pool);
-       kmem_zone_destroy(xfs_vnode_zone);
-       kmem_zone_destroy(xfs_ioend_zone);
-}
-
 /*
  * Attempt to flush the inode, this will actually fail
  * if the inode is pinned, but we dirty the inode again
@@ -1073,7 +1193,7 @@ xfssyncd(
                        list_del(&work->w_list);
                        if (work == &mp->m_sync_work)
                                continue;
-                       kmem_free(work, sizeof(struct bhv_vfs_sync_work));
+                       kmem_free(work);
                }
        }
 
@@ -1085,14 +1205,63 @@ xfs_fs_put_super(
        struct super_block      *sb)
 {
        struct xfs_mount        *mp = XFS_M(sb);
+       struct xfs_inode        *rip = mp->m_rootip;
+       int                     unmount_event_flags = 0;
        int                     error;
 
        kthread_stop(mp->m_sync_task);
 
        xfs_sync(mp, SYNC_ATTR | SYNC_DELWRI);
-       error = xfs_unmount(mp, 0, NULL);
-       if (error)
-               printk("XFS: unmount got error=%d\n", error);
+
+#ifdef HAVE_DMAPI
+       if (mp->m_flags & XFS_MOUNT_DMAPI) {
+               unmount_event_flags =
+                       (mp->m_dmevmask & (1 << DM_EVENT_UNMOUNT)) ?
+                               0 : DM_FLAGS_UNWANTED;
+               /*
+                * Ignore error from dmapi here, first unmount is not allowed
+                * to fail anyway, and second we wouldn't want to fail a
+                * unmount because of dmapi.
+                */
+               XFS_SEND_PREUNMOUNT(mp, rip, DM_RIGHT_NULL, rip, DM_RIGHT_NULL,
+                               NULL, NULL, 0, 0, unmount_event_flags);
+       }
+#endif
+
+       /*
+        * Blow away any referenced inode in the filestreams cache.
+        * This can and will cause log traffic as inodes go inactive
+        * here.
+        */
+       xfs_filestream_unmount(mp);
+
+       XFS_bflush(mp->m_ddev_targp);
+       error = xfs_unmount_flush(mp, 0);
+       WARN_ON(error);
+
+       IRELE(rip);
+
+       /*
+        * If we're forcing a shutdown, typically because of a media error,
+        * we want to make sure we invalidate dirty pages that belong to
+        * referenced vnodes as well.
+        */
+       if (XFS_FORCED_SHUTDOWN(mp)) {
+               error = xfs_sync(mp, SYNC_WAIT | SYNC_CLOSE);
+               ASSERT(error != EFSCORRUPTED);
+       }
+
+       if (mp->m_flags & XFS_MOUNT_DMAPI) {
+               XFS_SEND_UNMOUNT(mp, rip, DM_RIGHT_NULL, 0, 0,
+                               unmount_event_flags);
+       }
+
+       xfs_unmountfs(mp);
+       xfs_icsb_destroy_counters(mp);
+       xfs_close_devices(mp);
+       xfs_qmops_put(mp);
+       xfs_dmops_put(mp);
+       kfree(mp);
 }
 
 STATIC void
@@ -1215,14 +1384,54 @@ xfs_fs_remount(
        char                    *options)
 {
        struct xfs_mount        *mp = XFS_M(sb);
-       struct xfs_mount_args   *args = xfs_args_allocate(sb, 0);
-       int                     error;
+       substring_t             args[MAX_OPT_ARGS];
+       char                    *p;
 
-       error = xfs_parseargs(mp, options, args, 1);
-       if (!error)
-               error = xfs_mntupdate(mp, flags, args);
-       kmem_free(args, sizeof(*args));
-       return -error;
+       while ((p = strsep(&options, ",")) != NULL) {
+               int token;
+
+               if (!*p)
+                       continue;
+
+               token = match_token(p, tokens, args);
+               switch (token) {
+               case Opt_barrier:
+                       mp->m_flags |= XFS_MOUNT_BARRIER;
+
+                       /*
+                        * Test if barriers are actually working if we can,
+                        * else delay this check until the filesystem is
+                        * marked writeable.
+                        */
+                       if (!(mp->m_flags & XFS_MOUNT_RDONLY))
+                               xfs_mountfs_check_barriers(mp);
+                       break;
+               case Opt_nobarrier:
+                       mp->m_flags &= ~XFS_MOUNT_BARRIER;
+                       break;
+               default:
+                       printk(KERN_INFO
+       "XFS: mount option \"%s\" not supported for remount\n", p);
+                       return -EINVAL;
+               }
+       }
+
+       /* rw/ro -> rw */
+       if ((mp->m_flags & XFS_MOUNT_RDONLY) && !(*flags & MS_RDONLY)) {
+               mp->m_flags &= ~XFS_MOUNT_RDONLY;
+               if (mp->m_flags & XFS_MOUNT_BARRIER)
+                       xfs_mountfs_check_barriers(mp);
+       }
+
+       /* rw -> ro */
+       if (!(mp->m_flags & XFS_MOUNT_RDONLY) && (*flags & MS_RDONLY)) {
+               xfs_filestream_flush(mp);
+               xfs_sync(mp, SYNC_DATA_QUIESCE);
+               xfs_attr_quiesce(mp);
+               mp->m_flags |= XFS_MOUNT_RDONLY;
+       }
+
+       return 0;
 }
 
 /*
@@ -1299,6 +1508,225 @@ xfs_fs_setxquota(
                                   Q_XSETPQLIM), id, (caddr_t)fdq);
 }
 
+/*
+ * This function fills in xfs_mount_t fields based on mount args.
+ * Note: the superblock has _not_ yet been read in.
+ */
+STATIC int
+xfs_start_flags(
+       struct xfs_mount_args   *ap,
+       struct xfs_mount        *mp)
+{
+       /* Values are in BBs */
+       if ((ap->flags & XFSMNT_NOALIGN) != XFSMNT_NOALIGN) {
+               /*
+                * At this point the superblock has not been read
+                * in, therefore we do not know the block size.
+                * Before the mount call ends we will convert
+                * these to FSBs.
+                */
+               mp->m_dalign = ap->sunit;
+               mp->m_swidth = ap->swidth;
+       }
+
+       if (ap->logbufs != -1 &&
+           ap->logbufs != 0 &&
+           (ap->logbufs < XLOG_MIN_ICLOGS ||
+            ap->logbufs > XLOG_MAX_ICLOGS)) {
+               cmn_err(CE_WARN,
+                       "XFS: invalid logbufs value: %d [not %d-%d]",
+                       ap->logbufs, XLOG_MIN_ICLOGS, XLOG_MAX_ICLOGS);
+               return XFS_ERROR(EINVAL);
+       }
+       mp->m_logbufs = ap->logbufs;
+       if (ap->logbufsize != -1 &&
+           ap->logbufsize !=  0 &&
+           (ap->logbufsize < XLOG_MIN_RECORD_BSIZE ||
+            ap->logbufsize > XLOG_MAX_RECORD_BSIZE ||
+            !is_power_of_2(ap->logbufsize))) {
+               cmn_err(CE_WARN,
+       "XFS: invalid logbufsize: %d [not 16k,32k,64k,128k or 256k]",
+                       ap->logbufsize);
+               return XFS_ERROR(EINVAL);
+       }
+       mp->m_logbsize = ap->logbufsize;
+       mp->m_fsname_len = strlen(ap->fsname) + 1;
+       mp->m_fsname = kmem_alloc(mp->m_fsname_len, KM_SLEEP);
+       strcpy(mp->m_fsname, ap->fsname);
+       if (ap->rtname[0]) {
+               mp->m_rtname = kmem_alloc(strlen(ap->rtname) + 1, KM_SLEEP);
+               strcpy(mp->m_rtname, ap->rtname);
+       }
+       if (ap->logname[0]) {
+               mp->m_logname = kmem_alloc(strlen(ap->logname) + 1, KM_SLEEP);
+               strcpy(mp->m_logname, ap->logname);
+       }
+
+       if (ap->flags & XFSMNT_WSYNC)
+               mp->m_flags |= XFS_MOUNT_WSYNC;
+#if XFS_BIG_INUMS
+       if (ap->flags & XFSMNT_INO64) {
+               mp->m_flags |= XFS_MOUNT_INO64;
+               mp->m_inoadd = XFS_INO64_OFFSET;
+       }
+#endif
+       if (ap->flags & XFSMNT_RETERR)
+               mp->m_flags |= XFS_MOUNT_RETERR;
+       if (ap->flags & XFSMNT_NOALIGN)
+               mp->m_flags |= XFS_MOUNT_NOALIGN;
+       if (ap->flags & XFSMNT_SWALLOC)
+               mp->m_flags |= XFS_MOUNT_SWALLOC;
+       if (ap->flags & XFSMNT_OSYNCISOSYNC)
+               mp->m_flags |= XFS_MOUNT_OSYNCISOSYNC;
+       if (ap->flags & XFSMNT_32BITINODES)
+               mp->m_flags |= XFS_MOUNT_32BITINODES;
+
+       if (ap->flags & XFSMNT_IOSIZE) {
+               if (ap->iosizelog > XFS_MAX_IO_LOG ||
+                   ap->iosizelog < XFS_MIN_IO_LOG) {
+                       cmn_err(CE_WARN,
+               "XFS: invalid log iosize: %d [not %d-%d]",
+                               ap->iosizelog, XFS_MIN_IO_LOG,
+                               XFS_MAX_IO_LOG);
+                       return XFS_ERROR(EINVAL);
+               }
+
+               mp->m_flags |= XFS_MOUNT_DFLT_IOSIZE;
+               mp->m_readio_log = mp->m_writeio_log = ap->iosizelog;
+       }
+
+       if (ap->flags & XFSMNT_IKEEP)
+               mp->m_flags |= XFS_MOUNT_IKEEP;
+       if (ap->flags & XFSMNT_DIRSYNC)
+               mp->m_flags |= XFS_MOUNT_DIRSYNC;
+       if (ap->flags & XFSMNT_ATTR2)
+               mp->m_flags |= XFS_MOUNT_ATTR2;
+       if (ap->flags & XFSMNT_NOATTR2)
+               mp->m_flags |= XFS_MOUNT_NOATTR2;
+
+       if (ap->flags2 & XFSMNT2_COMPAT_IOSIZE)
+               mp->m_flags |= XFS_MOUNT_COMPAT_IOSIZE;
+
+       /*
+        * no recovery flag requires a read-only mount
+        */
+       if (ap->flags & XFSMNT_NORECOVERY) {
+               if (!(mp->m_flags & XFS_MOUNT_RDONLY)) {
+                       cmn_err(CE_WARN,
+       "XFS: tried to mount a FS read-write without recovery!");
+                       return XFS_ERROR(EINVAL);
+               }
+               mp->m_flags |= XFS_MOUNT_NORECOVERY;
+       }
+
+       if (ap->flags & XFSMNT_NOUUID)
+               mp->m_flags |= XFS_MOUNT_NOUUID;
+       if (ap->flags & XFSMNT_BARRIER)
+               mp->m_flags |= XFS_MOUNT_BARRIER;
+       else
+               mp->m_flags &= ~XFS_MOUNT_BARRIER;
+
+       if (ap->flags2 & XFSMNT2_FILESTREAMS)
+               mp->m_flags |= XFS_MOUNT_FILESTREAMS;
+
+       if (ap->flags & XFSMNT_DMAPI)
+               mp->m_flags |= XFS_MOUNT_DMAPI;
+       return 0;
+}
+
+/*
+ * This function fills in xfs_mount_t fields based on mount args.
+ * Note: the superblock _has_ now been read in.
+ */
+STATIC int
+xfs_finish_flags(
+       struct xfs_mount_args   *ap,
+       struct xfs_mount        *mp)
+{
+       int                     ronly = (mp->m_flags & XFS_MOUNT_RDONLY);
+
+       /* Fail a mount where the logbuf is smaller then the log stripe */
+       if (xfs_sb_version_haslogv2(&mp->m_sb)) {
+               if ((ap->logbufsize <= 0) &&
+                   (mp->m_sb.sb_logsunit > XLOG_BIG_RECORD_BSIZE)) {
+                       mp->m_logbsize = mp->m_sb.sb_logsunit;
+               } else if (ap->logbufsize > 0 &&
+                          ap->logbufsize < mp->m_sb.sb_logsunit) {
+                       cmn_err(CE_WARN,
+       "XFS: logbuf size must be greater than or equal to log stripe size");
+                       return XFS_ERROR(EINVAL);
+               }
+       } else {
+               /* Fail a mount if the logbuf is larger than 32K */
+               if (ap->logbufsize > XLOG_BIG_RECORD_BSIZE) {
+                       cmn_err(CE_WARN,
+       "XFS: logbuf size for version 1 logs must be 16K or 32K");
+                       return XFS_ERROR(EINVAL);
+               }
+       }
+
+       /*
+        * mkfs'ed attr2 will turn on attr2 mount unless explicitly
+        * told by noattr2 to turn it off
+        */
+       if (xfs_sb_version_hasattr2(&mp->m_sb) &&
+           !(ap->flags & XFSMNT_NOATTR2))
+               mp->m_flags |= XFS_MOUNT_ATTR2;
+
+       /*
+        * prohibit r/w mounts of read-only filesystems
+        */
+       if ((mp->m_sb.sb_flags & XFS_SBF_READONLY) && !ronly) {
+               cmn_err(CE_WARN,
+       "XFS: cannot mount a read-only filesystem as read-write");
+               return XFS_ERROR(EROFS);
+       }
+
+       /*
+        * check for shared mount.
+        */
+       if (ap->flags & XFSMNT_SHARED) {
+               if (!xfs_sb_version_hasshared(&mp->m_sb))
+                       return XFS_ERROR(EINVAL);
+
+               /*
+                * For IRIX 6.5, shared mounts must have the shared
+                * version bit set, have the persistent readonly
+                * field set, must be version 0 and can only be mounted
+                * read-only.
+                */
+               if (!ronly || !(mp->m_sb.sb_flags & XFS_SBF_READONLY) ||
+                    (mp->m_sb.sb_shared_vn != 0))
+                       return XFS_ERROR(EINVAL);
+
+               mp->m_flags |= XFS_MOUNT_SHARED;
+
+               /*
+                * Shared XFS V0 can't deal with DMI.  Return EINVAL.
+                */
+               if (mp->m_sb.sb_shared_vn == 0 && (ap->flags & XFSMNT_DMAPI))
+                       return XFS_ERROR(EINVAL);
+       }
+
+       if (ap->flags & XFSMNT_UQUOTA) {
+               mp->m_qflags |= (XFS_UQUOTA_ACCT | XFS_UQUOTA_ACTIVE);
+               if (ap->flags & XFSMNT_UQUOTAENF)
+                       mp->m_qflags |= XFS_UQUOTA_ENFD;
+       }
+
+       if (ap->flags & XFSMNT_GQUOTA) {
+               mp->m_qflags |= (XFS_GQUOTA_ACCT | XFS_GQUOTA_ACTIVE);
+               if (ap->flags & XFSMNT_GQUOTAENF)
+                       mp->m_qflags |= XFS_OQUOTA_ENFD;
+       } else if (ap->flags & XFSMNT_PQUOTA) {
+               mp->m_qflags |= (XFS_PQUOTA_ACCT | XFS_PQUOTA_ACTIVE);
+               if (ap->flags & XFSMNT_PQUOTAENF)
+                       mp->m_qflags |= XFS_OQUOTA_ENFD;
+       }
+
+       return 0;
+}
+
 STATIC int
 xfs_fs_fill_super(
        struct super_block      *sb,
@@ -1307,11 +1735,21 @@ xfs_fs_fill_super(
 {
        struct inode            *root;
        struct xfs_mount        *mp = NULL;
-       struct xfs_mount_args   *args = xfs_args_allocate(sb, silent);
-       int                     error;
+       struct xfs_mount_args   *args;
+       int                     flags = 0, error = ENOMEM;
+
+       args = xfs_args_allocate(sb, silent);
+       if (!args)
+               return -ENOMEM;
 
-       mp = xfs_mount_init();
+       mp = kzalloc(sizeof(struct xfs_mount), GFP_KERNEL);
+       if (!mp)
+               goto out_free_args;
 
+       spin_lock_init(&mp->m_sb_lock);
+       mutex_init(&mp->m_ilock);
+       mutex_init(&mp->m_growlock);
+       atomic_set(&mp->m_active_trans, 0);
        INIT_LIST_HEAD(&mp->m_sync_list);
        spin_lock_init(&mp->m_sync_lock);
        init_waitqueue_head(&mp->m_wait_single_sync_task);
@@ -1324,16 +1762,60 @@ xfs_fs_fill_super(
 
        error = xfs_parseargs(mp, (char *)data, args, 0);
        if (error)
-               goto fail_vfsop;
+               goto out_free_mp;
 
        sb_min_blocksize(sb, BBSIZE);
+       sb->s_xattr = xfs_xattr_handlers;
        sb->s_export_op = &xfs_export_operations;
        sb->s_qcop = &xfs_quotactl_operations;
        sb->s_op = &xfs_super_operations;
 
-       error = xfs_mount(mp, args, NULL);
+       error = xfs_dmops_get(mp, args);
        if (error)
-               goto fail_vfsop;
+               goto out_free_mp;
+       error = xfs_qmops_get(mp, args);
+       if (error)
+               goto out_put_dmops;
+
+       if (args->flags & XFSMNT_QUIET)
+               flags |= XFS_MFSI_QUIET;
+
+       error = xfs_open_devices(mp, args);
+       if (error)
+               goto out_put_qmops;
+
+       if (xfs_icsb_init_counters(mp))
+               mp->m_flags |= XFS_MOUNT_NO_PERCPU_SB;
+
+       /*
+        * Setup flags based on mount(2) options and then the superblock
+        */
+       error = xfs_start_flags(args, mp);
+       if (error)
+               goto out_destroy_counters;
+       error = xfs_readsb(mp, flags);
+       if (error)
+               goto out_destroy_counters;
+       error = xfs_finish_flags(args, mp);
+       if (error)
+               goto out_free_sb;
+
+       error = xfs_setup_devices(mp);
+       if (error)
+               goto out_free_sb;
+
+       if (mp->m_flags & XFS_MOUNT_BARRIER)
+               xfs_mountfs_check_barriers(mp);
+
+       error = xfs_filestream_mount(mp);
+       if (error)
+               goto out_free_sb;
+
+       error = xfs_mountfs(mp, flags);
+       if (error)
+               goto out_filestream_unmount;
+
+       XFS_SEND_MOUNT(mp, DM_RIGHT_NULL, args->mtpt, args->fsname);
 
        sb->s_dirt = 1;
        sb->s_magic = XFS_SB_MAGIC;
@@ -1368,10 +1850,27 @@ xfs_fs_fill_super(
 
        xfs_itrace_exit(XFS_I(sb->s_root->d_inode));
 
-       kmem_free(args, sizeof(*args));
+       kfree(args);
        return 0;
 
-fail_vnrele:
+ out_filestream_unmount:
+       xfs_filestream_unmount(mp);
+ out_free_sb:
+       xfs_freesb(mp);
+ out_destroy_counters:
+       xfs_icsb_destroy_counters(mp);
+       xfs_close_devices(mp);
+ out_put_qmops:
+       xfs_qmops_put(mp);
+ out_put_dmops:
+       xfs_dmops_put(mp);
+ out_free_mp:
+       kfree(mp);
+ out_free_args:
+       kfree(args);
+       return -error;
+
+ fail_vnrele:
        if (sb->s_root) {
                dput(sb->s_root);
                sb->s_root = NULL;
@@ -1379,12 +1878,22 @@ fail_vnrele:
                iput(root);
        }
 
-fail_unmount:
-       xfs_unmount(mp, 0, NULL);
+ fail_unmount:
+       /*
+        * Blow away any referenced inode in the filestreams cache.
+        * This can and will cause log traffic as inodes go inactive
+        * here.
+        */
+       xfs_filestream_unmount(mp);
 
-fail_vfsop:
-       kmem_free(args, sizeof(*args));
-       return -error;
+       XFS_bflush(mp->m_ddev_targp);
+       error = xfs_unmount_flush(mp, 0);
+       WARN_ON(error);
+
+       IRELE(mp->m_rootip);
+
+       xfs_unmountfs(mp);
+       goto out_destroy_counters;
 }
 
 STATIC int
@@ -1429,9 +1938,235 @@ static struct file_system_type xfs_fs_type = {
        .fs_flags               = FS_REQUIRES_DEV,
 };
 
+STATIC int __init
+xfs_alloc_trace_bufs(void)
+{
+#ifdef XFS_ALLOC_TRACE
+       xfs_alloc_trace_buf = ktrace_alloc(XFS_ALLOC_TRACE_SIZE, KM_MAYFAIL);
+       if (!xfs_alloc_trace_buf)
+               goto out;
+#endif
+#ifdef XFS_BMAP_TRACE
+       xfs_bmap_trace_buf = ktrace_alloc(XFS_BMAP_TRACE_SIZE, KM_MAYFAIL);
+       if (!xfs_bmap_trace_buf)
+               goto out_free_alloc_trace;
+#endif
+#ifdef XFS_BMBT_TRACE
+       xfs_bmbt_trace_buf = ktrace_alloc(XFS_BMBT_TRACE_SIZE, KM_MAYFAIL);
+       if (!xfs_bmbt_trace_buf)
+               goto out_free_bmap_trace;
+#endif
+#ifdef XFS_ATTR_TRACE
+       xfs_attr_trace_buf = ktrace_alloc(XFS_ATTR_TRACE_SIZE, KM_MAYFAIL);
+       if (!xfs_attr_trace_buf)
+               goto out_free_bmbt_trace;
+#endif
+#ifdef XFS_DIR2_TRACE
+       xfs_dir2_trace_buf = ktrace_alloc(XFS_DIR2_GTRACE_SIZE, KM_MAYFAIL);
+       if (!xfs_dir2_trace_buf)
+               goto out_free_attr_trace;
+#endif
+
+       return 0;
+
+#ifdef XFS_DIR2_TRACE
+ out_free_attr_trace:
+#endif
+#ifdef XFS_ATTR_TRACE
+       ktrace_free(xfs_attr_trace_buf);
+ out_free_bmbt_trace:
+#endif
+#ifdef XFS_BMBT_TRACE
+       ktrace_free(xfs_bmbt_trace_buf);
+ out_free_bmap_trace:
+#endif
+#ifdef XFS_BMAP_TRACE
+       ktrace_free(xfs_bmap_trace_buf);
+ out_free_alloc_trace:
+#endif
+#ifdef XFS_ALLOC_TRACE
+       ktrace_free(xfs_alloc_trace_buf);
+ out:
+#endif
+       return -ENOMEM;
+}
+
+STATIC void
+xfs_free_trace_bufs(void)
+{
+#ifdef XFS_DIR2_TRACE
+       ktrace_free(xfs_dir2_trace_buf);
+#endif
+#ifdef XFS_ATTR_TRACE
+       ktrace_free(xfs_attr_trace_buf);
+#endif
+#ifdef XFS_BMBT_TRACE
+       ktrace_free(xfs_bmbt_trace_buf);
+#endif
+#ifdef XFS_BMAP_TRACE
+       ktrace_free(xfs_bmap_trace_buf);
+#endif
+#ifdef XFS_ALLOC_TRACE
+       ktrace_free(xfs_alloc_trace_buf);
+#endif
+}
 
 STATIC int __init
-init_xfs_fs( void )
+xfs_init_zones(void)
+{
+       xfs_vnode_zone = kmem_zone_init_flags(sizeof(bhv_vnode_t), "xfs_vnode",
+                                       KM_ZONE_HWALIGN | KM_ZONE_RECLAIM |
+                                       KM_ZONE_SPREAD,
+                                       xfs_fs_inode_init_once);
+       if (!xfs_vnode_zone)
+               goto out;
+
+       xfs_ioend_zone = kmem_zone_init(sizeof(xfs_ioend_t), "xfs_ioend");
+       if (!xfs_ioend_zone)
+               goto out_destroy_vnode_zone;
+
+       xfs_ioend_pool = mempool_create_slab_pool(4 * MAX_BUF_PER_PAGE,
+                                                 xfs_ioend_zone);
+       if (!xfs_ioend_pool)
+               goto out_destroy_ioend_zone;
+
+       xfs_log_ticket_zone = kmem_zone_init(sizeof(xlog_ticket_t),
+                                               "xfs_log_ticket");
+       if (!xfs_log_ticket_zone)
+               goto out_destroy_ioend_pool;
+
+       xfs_bmap_free_item_zone = kmem_zone_init(sizeof(xfs_bmap_free_item_t),
+                                               "xfs_bmap_free_item");
+       if (!xfs_bmap_free_item_zone)
+               goto out_destroy_log_ticket_zone;
+       xfs_btree_cur_zone = kmem_zone_init(sizeof(xfs_btree_cur_t),
+                                               "xfs_btree_cur");
+       if (!xfs_btree_cur_zone)
+               goto out_destroy_bmap_free_item_zone;
+
+       xfs_da_state_zone = kmem_zone_init(sizeof(xfs_da_state_t),
+                                               "xfs_da_state");
+       if (!xfs_da_state_zone)
+               goto out_destroy_btree_cur_zone;
+
+       xfs_dabuf_zone = kmem_zone_init(sizeof(xfs_dabuf_t), "xfs_dabuf");
+       if (!xfs_dabuf_zone)
+               goto out_destroy_da_state_zone;
+
+       xfs_ifork_zone = kmem_zone_init(sizeof(xfs_ifork_t), "xfs_ifork");
+       if (!xfs_ifork_zone)
+               goto out_destroy_dabuf_zone;
+
+       xfs_trans_zone = kmem_zone_init(sizeof(xfs_trans_t), "xfs_trans");
+       if (!xfs_trans_zone)
+               goto out_destroy_ifork_zone;
+
+       /*
+        * The size of the zone allocated buf log item is the maximum
+        * size possible under XFS.  This wastes a little bit of memory,
+        * but it is much faster.
+        */
+       xfs_buf_item_zone = kmem_zone_init((sizeof(xfs_buf_log_item_t) +
+                               (((XFS_MAX_BLOCKSIZE / XFS_BLI_CHUNK) /
+                                 NBWORD) * sizeof(int))), "xfs_buf_item");
+       if (!xfs_buf_item_zone)
+               goto out_destroy_trans_zone;
+
+       xfs_efd_zone = kmem_zone_init((sizeof(xfs_efd_log_item_t) +
+                       ((XFS_EFD_MAX_FAST_EXTENTS - 1) *
+                                sizeof(xfs_extent_t))), "xfs_efd_item");
+       if (!xfs_efd_zone)
+               goto out_destroy_buf_item_zone;
+
+       xfs_efi_zone = kmem_zone_init((sizeof(xfs_efi_log_item_t) +
+                       ((XFS_EFI_MAX_FAST_EXTENTS - 1) *
+                               sizeof(xfs_extent_t))), "xfs_efi_item");
+       if (!xfs_efi_zone)
+               goto out_destroy_efd_zone;
+
+       xfs_inode_zone =
+               kmem_zone_init_flags(sizeof(xfs_inode_t), "xfs_inode",
+                                       KM_ZONE_HWALIGN | KM_ZONE_RECLAIM |
+                                       KM_ZONE_SPREAD, NULL);
+       if (!xfs_inode_zone)
+               goto out_destroy_efi_zone;
+
+       xfs_ili_zone =
+               kmem_zone_init_flags(sizeof(xfs_inode_log_item_t), "xfs_ili",
+                                       KM_ZONE_SPREAD, NULL);
+       if (!xfs_ili_zone)
+               goto out_destroy_inode_zone;
+
+#ifdef CONFIG_XFS_POSIX_ACL
+       xfs_acl_zone = kmem_zone_init(sizeof(xfs_acl_t), "xfs_acl");
+       if (!xfs_acl_zone)
+               goto out_destroy_ili_zone;
+#endif
+
+       return 0;
+
+#ifdef CONFIG_XFS_POSIX_ACL
+ out_destroy_ili_zone:
+#endif
+       kmem_zone_destroy(xfs_ili_zone);
+ out_destroy_inode_zone:
+       kmem_zone_destroy(xfs_inode_zone);
+ out_destroy_efi_zone:
+       kmem_zone_destroy(xfs_efi_zone);
+ out_destroy_efd_zone:
+       kmem_zone_destroy(xfs_efd_zone);
+ out_destroy_buf_item_zone:
+       kmem_zone_destroy(xfs_buf_item_zone);
+ out_destroy_trans_zone:
+       kmem_zone_destroy(xfs_trans_zone);
+ out_destroy_ifork_zone:
+       kmem_zone_destroy(xfs_ifork_zone);
+ out_destroy_dabuf_zone:
+       kmem_zone_destroy(xfs_dabuf_zone);
+ out_destroy_da_state_zone:
+       kmem_zone_destroy(xfs_da_state_zone);
+ out_destroy_btree_cur_zone:
+       kmem_zone_destroy(xfs_btree_cur_zone);
+ out_destroy_bmap_free_item_zone:
+       kmem_zone_destroy(xfs_bmap_free_item_zone);
+ out_destroy_log_ticket_zone:
+       kmem_zone_destroy(xfs_log_ticket_zone);
+ out_destroy_ioend_pool:
+       mempool_destroy(xfs_ioend_pool);
+ out_destroy_ioend_zone:
+       kmem_zone_destroy(xfs_ioend_zone);
+ out_destroy_vnode_zone:
+       kmem_zone_destroy(xfs_vnode_zone);
+ out:
+       return -ENOMEM;
+}
+
+STATIC void
+xfs_destroy_zones(void)
+{
+#ifdef CONFIG_XFS_POSIX_ACL
+       kmem_zone_destroy(xfs_acl_zone);
+#endif
+       kmem_zone_destroy(xfs_ili_zone);
+       kmem_zone_destroy(xfs_inode_zone);
+       kmem_zone_destroy(xfs_efi_zone);
+       kmem_zone_destroy(xfs_efd_zone);
+       kmem_zone_destroy(xfs_buf_item_zone);
+       kmem_zone_destroy(xfs_trans_zone);
+       kmem_zone_destroy(xfs_ifork_zone);
+       kmem_zone_destroy(xfs_dabuf_zone);
+       kmem_zone_destroy(xfs_da_state_zone);
+       kmem_zone_destroy(xfs_btree_cur_zone);
+       kmem_zone_destroy(xfs_bmap_free_item_zone);
+       kmem_zone_destroy(xfs_log_ticket_zone);
+       mempool_destroy(xfs_ioend_pool);
+       kmem_zone_destroy(xfs_ioend_zone);
+       kmem_zone_destroy(xfs_vnode_zone);
+
+}
+
+STATIC int __init
+init_xfs_fs(void)
 {
        int                     error;
        static char             message[] __initdata = KERN_INFO \
@@ -1440,42 +2175,73 @@ init_xfs_fs( void )
        printk(message);
 
        ktrace_init(64);
+       vn_init();
+       xfs_dir_startup();
 
        error = xfs_init_zones();
-       if (error < 0)
-               goto undo_zones;
+       if (error)
+               goto out;
+
+       error = xfs_alloc_trace_bufs();
+       if (error)
+               goto out_destroy_zones;
+
+       error = xfs_mru_cache_init();
+       if (error)
+               goto out_free_trace_buffers;
+
+       error = xfs_filestream_init();
+       if (error)
+               goto out_mru_cache_uninit;
 
        error = xfs_buf_init();
-       if (error < 0)
-               goto undo_buffers;
+       if (error)
+               goto out_filestream_uninit;
+
+       error = xfs_init_procfs();
+       if (error)
+               goto out_buf_terminate;
+
+       error = xfs_sysctl_register();
+       if (error)
+               goto out_cleanup_procfs;
 
-       vn_init();
-       xfs_init();
-       uuid_init();
        vfs_initquota();
 
        error = register_filesystem(&xfs_fs_type);
        if (error)
-               goto undo_register;
+               goto out_sysctl_unregister;
        return 0;
 
-undo_register:
+ out_sysctl_unregister:
+       xfs_sysctl_unregister();
+ out_cleanup_procfs:
+       xfs_cleanup_procfs();
+ out_buf_terminate:
        xfs_buf_terminate();
-
-undo_buffers:
+ out_filestream_uninit:
+       xfs_filestream_uninit();
+ out_mru_cache_uninit:
+       xfs_mru_cache_uninit();
+ out_free_trace_buffers:
+       xfs_free_trace_bufs();
+ out_destroy_zones:
        xfs_destroy_zones();
-
-undo_zones:
+ out:
        return error;
 }
 
 STATIC void __exit
-exit_xfs_fs( void )
+exit_xfs_fs(void)
 {
        vfs_exitquota();
        unregister_filesystem(&xfs_fs_type);
-       xfs_cleanup();
+       xfs_sysctl_unregister();
+       xfs_cleanup_procfs();
        xfs_buf_terminate();
+       xfs_filestream_uninit();
+       xfs_mru_cache_uninit();
+       xfs_free_trace_bufs();
        xfs_destroy_zones();
        ktrace_uninit();
 }
index 3efb7c6..b7d13da 100644 (file)
@@ -107,12 +107,10 @@ extern void xfs_initialize_vnode(struct xfs_mount *mp, bhv_vnode_t *vp,
 extern void xfs_flush_inode(struct xfs_inode *);
 extern void xfs_flush_device(struct xfs_inode *);
 
-extern int  xfs_blkdev_get(struct xfs_mount *, const char *,
-                               struct block_device **);
-extern void xfs_blkdev_put(struct block_device *);
 extern void xfs_blkdev_issue_flush(struct xfs_buftarg *);
 
 extern const struct export_operations xfs_export_operations;
+extern struct xattr_handler *xfs_xattr_handlers[];
 
 #define XFS_M(sb)              ((struct xfs_mount *)((sb)->s_fs_info))
 
index bb997d7..7dacb5b 100644 (file)
@@ -259,15 +259,17 @@ static ctl_table xfs_root_table[] = {
        {}
 };
 
-void
+int
 xfs_sysctl_register(void)
 {
        xfs_table_header = register_sysctl_table(xfs_root_table);
+       if (!xfs_table_header)
+               return -ENOMEM;
+       return 0;
 }
 
 void
 xfs_sysctl_unregister(void)
 {
-       if (xfs_table_header)
-               unregister_sysctl_table(xfs_table_header);
+       unregister_sysctl_table(xfs_table_header);
 }
index 98b97e3..4aadb80 100644 (file)
@@ -93,10 +93,10 @@ enum {
 extern xfs_param_t     xfs_params;
 
 #ifdef CONFIG_SYSCTL
-extern void xfs_sysctl_register(void);
+extern int xfs_sysctl_register(void);
 extern void xfs_sysctl_unregister(void);
 #else
-# define xfs_sysctl_register()         do { } while (0)
+# define xfs_sysctl_register()         (0)
 # define xfs_sysctl_unregister()       do { } while (0)
 #endif /* CONFIG_SYSCTL */
 
index bc7afe0..25488b6 100644 (file)
@@ -82,56 +82,6 @@ vn_ioerror(
                xfs_do_force_shutdown(ip->i_mount, SHUTDOWN_DEVICE_REQ, f, l);
 }
 
-/*
- * Revalidate the Linux inode from the XFS inode.
- * Note: i_size _not_ updated; we must hold the inode
- * semaphore when doing that - callers responsibility.
- */
-int
-vn_revalidate(
-       bhv_vnode_t             *vp)
-{
-       struct inode            *inode = vn_to_inode(vp);
-       struct xfs_inode        *ip = XFS_I(inode);
-       struct xfs_mount        *mp = ip->i_mount;
-       unsigned long           xflags;
-
-       xfs_itrace_entry(ip);
-
-       if (XFS_FORCED_SHUTDOWN(mp))
-               return -EIO;
-
-       xfs_ilock(ip, XFS_ILOCK_SHARED);
-       inode->i_mode       = ip->i_d.di_mode;
-       inode->i_uid        = ip->i_d.di_uid;
-       inode->i_gid        = ip->i_d.di_gid;
-       inode->i_mtime.tv_sec = ip->i_d.di_mtime.t_sec;
-       inode->i_mtime.tv_nsec = ip->i_d.di_mtime.t_nsec;
-       inode->i_ctime.tv_sec = ip->i_d.di_ctime.t_sec;
-       inode->i_ctime.tv_nsec = ip->i_d.di_ctime.t_nsec;
-
-       xflags = xfs_ip2xflags(ip);
-       if (xflags & XFS_XFLAG_IMMUTABLE)
-               inode->i_flags |= S_IMMUTABLE;
-       else
-               inode->i_flags &= ~S_IMMUTABLE;
-       if (xflags & XFS_XFLAG_APPEND)
-               inode->i_flags |= S_APPEND;
-       else
-               inode->i_flags &= ~S_APPEND;
-       if (xflags & XFS_XFLAG_SYNC)
-               inode->i_flags |= S_SYNC;
-       else
-               inode->i_flags &= ~S_SYNC;
-       if (xflags & XFS_XFLAG_NOATIME)
-               inode->i_flags |= S_NOATIME;
-       else
-               inode->i_flags &= ~S_NOATIME;
-       xfs_iunlock(ip, XFS_ILOCK_SHARED);
-
-       xfs_iflags_clear(ip, XFS_IMODIFIED);
-       return 0;
-}
 
 /*
  * Add a reference to a referenced vnode.
index 25eb2a9..41ca2ce 100644 (file)
@@ -19,7 +19,6 @@
 #define __XFS_VNODE_H__
 
 struct file;
-struct bhv_vattr;
 struct xfs_iomap;
 struct attrlist_cursor_kern;
 
@@ -66,87 +65,8 @@ static inline struct inode *vn_to_inode(bhv_vnode_t *vnode)
                                           Prevent VM access to the pages until
                                           the operation completes. */
 
-/*
- * Vnode attributes.  va_mask indicates those attributes the caller
- * wants to set or extract.
- */
-typedef struct bhv_vattr {
-       int             va_mask;        /* bit-mask of attributes present */
-       mode_t          va_mode;        /* file access mode and type */
-       xfs_nlink_t     va_nlink;       /* number of references to file */
-       uid_t           va_uid;         /* owner user id */
-       gid_t           va_gid;         /* owner group id */
-       xfs_ino_t       va_nodeid;      /* file id */
-       xfs_off_t       va_size;        /* file size in bytes */
-       u_long          va_blocksize;   /* blocksize preferred for i/o */
-       struct timespec va_atime;       /* time of last access */
-       struct timespec va_mtime;       /* time of last modification */
-       struct timespec va_ctime;       /* time file changed */
-       u_int           va_gen;         /* generation number of file */
-       xfs_dev_t       va_rdev;        /* device the special file represents */
-       __int64_t       va_nblocks;     /* number of blocks allocated */
-       u_long          va_xflags;      /* random extended file flags */
-       u_long          va_extsize;     /* file extent size */
-       u_long          va_nextents;    /* number of extents in file */
-       u_long          va_anextents;   /* number of attr extents in file */
-       prid_t          va_projid;      /* project id */
-} bhv_vattr_t;
-
-/*
- * setattr or getattr attributes
- */
-#define XFS_AT_TYPE            0x00000001
-#define XFS_AT_MODE            0x00000002
-#define XFS_AT_UID             0x00000004
-#define XFS_AT_GID             0x00000008
-#define XFS_AT_FSID            0x00000010
-#define XFS_AT_NODEID          0x00000020
-#define XFS_AT_NLINK           0x00000040
-#define XFS_AT_SIZE            0x00000080
-#define XFS_AT_ATIME           0x00000100
-#define XFS_AT_MTIME           0x00000200
-#define XFS_AT_CTIME           0x00000400
-#define XFS_AT_RDEV            0x00000800
-#define XFS_AT_BLKSIZE         0x00001000
-#define XFS_AT_NBLOCKS         0x00002000
-#define XFS_AT_VCODE           0x00004000
-#define XFS_AT_MAC             0x00008000
-#define XFS_AT_UPDATIME                0x00010000
-#define XFS_AT_UPDMTIME                0x00020000
-#define XFS_AT_UPDCTIME                0x00040000
-#define XFS_AT_ACL             0x00080000
-#define XFS_AT_CAP             0x00100000
-#define XFS_AT_INF             0x00200000
-#define XFS_AT_XFLAGS          0x00400000
-#define XFS_AT_EXTSIZE         0x00800000
-#define XFS_AT_NEXTENTS                0x01000000
-#define XFS_AT_ANEXTENTS       0x02000000
-#define XFS_AT_PROJID          0x04000000
-#define XFS_AT_SIZE_NOPERM     0x08000000
-#define XFS_AT_GENCOUNT                0x10000000
-
-#define XFS_AT_ALL     (XFS_AT_TYPE|XFS_AT_MODE|XFS_AT_UID|XFS_AT_GID|\
-               XFS_AT_FSID|XFS_AT_NODEID|XFS_AT_NLINK|XFS_AT_SIZE|\
-               XFS_AT_ATIME|XFS_AT_MTIME|XFS_AT_CTIME|XFS_AT_RDEV|\
-               XFS_AT_BLKSIZE|XFS_AT_NBLOCKS|XFS_AT_VCODE|XFS_AT_MAC|\
-               XFS_AT_ACL|XFS_AT_CAP|XFS_AT_INF|XFS_AT_XFLAGS|XFS_AT_EXTSIZE|\
-               XFS_AT_NEXTENTS|XFS_AT_ANEXTENTS|XFS_AT_PROJID|XFS_AT_GENCOUNT)
-
-#define XFS_AT_STAT    (XFS_AT_TYPE|XFS_AT_MODE|XFS_AT_UID|XFS_AT_GID|\
-               XFS_AT_FSID|XFS_AT_NODEID|XFS_AT_NLINK|XFS_AT_SIZE|\
-               XFS_AT_ATIME|XFS_AT_MTIME|XFS_AT_CTIME|XFS_AT_RDEV|\
-               XFS_AT_BLKSIZE|XFS_AT_NBLOCKS|XFS_AT_PROJID)
-
-#define XFS_AT_TIMES   (XFS_AT_ATIME|XFS_AT_MTIME|XFS_AT_CTIME)
-
-#define XFS_AT_UPDTIMES        (XFS_AT_UPDATIME|XFS_AT_UPDMTIME|XFS_AT_UPDCTIME)
-
-#define XFS_AT_NOSET   (XFS_AT_NLINK|XFS_AT_RDEV|XFS_AT_FSID|XFS_AT_NODEID|\
-               XFS_AT_TYPE|XFS_AT_BLKSIZE|XFS_AT_NBLOCKS|XFS_AT_VCODE|\
-               XFS_AT_NEXTENTS|XFS_AT_ANEXTENTS|XFS_AT_GENCOUNT)
 
 extern void    vn_init(void);
-extern int     vn_revalidate(bhv_vnode_t *);
 
 /*
  * Yeah, these don't take vnode anymore at all, all this should be
@@ -219,15 +139,6 @@ static inline void vn_atime_to_time_t(bhv_vnode_t *vp, time_t *tt)
 #define VN_DIRTY(vp)   mapping_tagged(vn_to_inode(vp)->i_mapping, \
                                        PAGECACHE_TAG_DIRTY)
 
-/*
- * Flags to vop_setattr/getattr.
- */
-#define        ATTR_UTIME      0x01    /* non-default utime(2) request */
-#define        ATTR_DMI        0x08    /* invocation from a DMI function */
-#define        ATTR_LAZY       0x80    /* set/get attributes lazily */
-#define        ATTR_NONBLOCK   0x100   /* return EAGAIN if operation would block */
-#define ATTR_NOLOCK    0x200   /* Don't grab any conflicting locks */
-#define ATTR_NOSIZETOK 0x400   /* Don't get the SIZE token */
 
 /*
  * Tracking vnode activity.
diff --git a/fs/xfs/linux-2.6/xfs_xattr.c b/fs/xfs/linux-2.6/xfs_xattr.c
new file mode 100644 (file)
index 0000000..964621f
--- /dev/null
@@ -0,0 +1,330 @@
+/*
+ * Copyright (C) 2008 Christoph Hellwig.
+ * Portions Copyright (C) 2000-2008 Silicon Graphics, 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.
+ *
+ * This program is distributed in the hope that it would 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 the Free Software Foundation,
+ * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "xfs.h"
+#include "xfs_da_btree.h"
+#include "xfs_bmap_btree.h"
+#include "xfs_inode.h"
+#include "xfs_attr.h"
+#include "xfs_attr_leaf.h"
+#include "xfs_acl.h"
+#include "xfs_vnodeops.h"
+
+#include <linux/posix_acl_xattr.h>
+#include <linux/xattr.h>
+
+
+/*
+ * ACL handling.  Should eventually be moved into xfs_acl.c
+ */
+
+static int
+xfs_decode_acl(const char *name)
+{
+       if (strcmp(name, "posix_acl_access") == 0)
+               return _ACL_TYPE_ACCESS;
+       else if (strcmp(name, "posix_acl_default") == 0)
+               return _ACL_TYPE_DEFAULT;
+       return -EINVAL;
+}
+
+/*
+ * Get system extended attributes which at the moment only
+ * includes Posix ACLs.
+ */
+static int
+xfs_xattr_system_get(struct inode *inode, const char *name,
+               void *buffer, size_t size)
+{
+       int acl;
+
+       acl = xfs_decode_acl(name);
+       if (acl < 0)
+               return acl;
+
+       return xfs_acl_vget(inode, buffer, size, acl);
+}
+
+static int
+xfs_xattr_system_set(struct inode *inode, const char *name,
+               const void *value, size_t size, int flags)
+{
+       int acl;
+
+       acl = xfs_decode_acl(name);
+       if (acl < 0)
+               return acl;
+       if (flags & XATTR_CREATE)
+               return -EINVAL;
+
+       if (!value)
+               return xfs_acl_vremove(inode, acl);
+
+       return xfs_acl_vset(inode, (void *)value, size, acl);
+}
+
+static struct xattr_handler xfs_xattr_system_handler = {
+       .prefix = XATTR_SYSTEM_PREFIX,
+       .get    = xfs_xattr_system_get,
+       .set    = xfs_xattr_system_set,
+};
+
+
+/*
+ * Real xattr handling.  The only difference between the namespaces is
+ * a flag passed to the low-level attr code.
+ */
+
+static int
+__xfs_xattr_get(struct inode *inode, const char *name,
+               void *value, size_t size, int xflags)
+{
+       struct xfs_inode *ip = XFS_I(inode);
+       int error, asize = size;
+
+       if (strcmp(name, "") == 0)
+               return -EINVAL;
+
+       /* Convert Linux syscall to XFS internal ATTR flags */
+       if (!size) {
+               xflags |= ATTR_KERNOVAL;
+               value = NULL;
+       }
+
+       error = -xfs_attr_get(ip, name, value, &asize, xflags);
+       if (error)
+               return error;
+       return asize;
+}
+
+static int
+__xfs_xattr_set(struct inode *inode, const char *name, const void *value,
+               size_t size, int flags, int xflags)
+{
+       struct xfs_inode *ip = XFS_I(inode);
+
+       if (strcmp(name, "") == 0)
+               return -EINVAL;
+
+       /* Convert Linux syscall to XFS internal ATTR flags */
+       if (flags & XATTR_CREATE)
+               xflags |= ATTR_CREATE;
+       if (flags & XATTR_REPLACE)
+               xflags |= ATTR_REPLACE;
+
+       if (!value)
+               return -xfs_attr_remove(ip, name, xflags);
+       return -xfs_attr_set(ip, name, (void *)value, size, xflags);
+}
+
+static int
+xfs_xattr_user_get(struct inode *inode, const char *name,
+               void *value, size_t size)
+{
+       return __xfs_xattr_get(inode, name, value, size, 0);
+}
+
+static int
+xfs_xattr_user_set(struct inode *inode, const char *name,
+               const void *value, size_t size, int flags)
+{
+       return __xfs_xattr_set(inode, name, value, size, flags, 0);
+}
+
+static struct xattr_handler xfs_xattr_user_handler = {
+       .prefix = XATTR_USER_PREFIX,
+       .get    = xfs_xattr_user_get,
+       .set    = xfs_xattr_user_set,
+};
+
+
+static int
+xfs_xattr_trusted_get(struct inode *inode, const char *name,
+               void *value, size_t size)
+{
+       return __xfs_xattr_get(inode, name, value, size, ATTR_ROOT);
+}
+
+static int
+xfs_xattr_trusted_set(struct inode *inode, const char *name,
+               const void *value, size_t size, int flags)
+{
+       return __xfs_xattr_set(inode, name, value, size, flags, ATTR_ROOT);
+}
+
+static struct xattr_handler xfs_xattr_trusted_handler = {
+       .prefix = XATTR_TRUSTED_PREFIX,
+       .get    = xfs_xattr_trusted_get,
+       .set    = xfs_xattr_trusted_set,
+};
+
+
+static int
+xfs_xattr_secure_get(struct inode *inode, const char *name,
+               void *value, size_t size)
+{
+       return __xfs_xattr_get(inode, name, value, size, ATTR_SECURE);
+}
+
+static int
+xfs_xattr_secure_set(struct inode *inode, const char *name,
+               const void *value, size_t size, int flags)
+{
+       return __xfs_xattr_set(inode, name, value, size, flags, ATTR_SECURE);
+}
+
+static struct xattr_handler xfs_xattr_security_handler = {
+       .prefix = XATTR_SECURITY_PREFIX,
+       .get    = xfs_xattr_secure_get,
+       .set    = xfs_xattr_secure_set,
+};
+
+
+struct xattr_handler *xfs_xattr_handlers[] = {
+       &xfs_xattr_user_handler,
+       &xfs_xattr_trusted_handler,
+       &xfs_xattr_security_handler,
+       &xfs_xattr_system_handler,
+       NULL
+};
+
+static unsigned int xfs_xattr_prefix_len(int flags)
+{
+       if (flags & XFS_ATTR_SECURE)
+               return sizeof("security");
+       else if (flags & XFS_ATTR_ROOT)
+               return sizeof("trusted");
+       else
+               return sizeof("user");
+}
+
+static const char *xfs_xattr_prefix(int flags)
+{
+       if (flags & XFS_ATTR_SECURE)
+               return xfs_xattr_security_handler.prefix;
+       else if (flags & XFS_ATTR_ROOT)
+               return xfs_xattr_trusted_handler.prefix;
+       else
+               return xfs_xattr_user_handler.prefix;
+}
+
+static int
+xfs_xattr_put_listent(struct xfs_attr_list_context *context, int flags,
+               char *name, int namelen, int valuelen, char *value)
+{
+       unsigned int prefix_len = xfs_xattr_prefix_len(flags);
+       char *offset;
+       int arraytop;
+
+       ASSERT(context->count >= 0);
+
+       /*
+        * Only show root namespace entries if we are actually allowed to
+        * see them.
+        */
+       if ((flags & XFS_ATTR_ROOT) && !capable(CAP_SYS_ADMIN))
+               return 0;
+
+       arraytop = context->count + prefix_len + namelen + 1;
+       if (arraytop > context->firstu) {
+               context->count = -1;    /* insufficient space */
+               return 1;
+       }
+       offset = (char *)context->alist + context->count;
+       strncpy(offset, xfs_xattr_prefix(flags), prefix_len);
+       offset += prefix_len;
+       strncpy(offset, name, namelen);                 /* real name */
+       offset += namelen;
+       *offset = '\0';
+       context->count += prefix_len + namelen + 1;
+       return 0;
+}
+
+static int
+xfs_xattr_put_listent_sizes(struct xfs_attr_list_context *context, int flags,
+               char *name, int namelen, int valuelen, char *value)
+{
+       context->count += xfs_xattr_prefix_len(flags) + namelen + 1;
+       return 0;
+}
+
+static int
+list_one_attr(const char *name, const size_t len, void *data,
+               size_t size, ssize_t *result)
+{
+       char *p = data + *result;
+
+       *result += len;
+       if (!size)
+               return 0;
+       if (*result > size)
+               return -ERANGE;
+
+       strcpy(p, name);
+       return 0;
+}
+
+ssize_t
+xfs_vn_listxattr(struct dentry *dentry, char *data, size_t size)
+{
+       struct xfs_attr_list_context context;
+       struct attrlist_cursor_kern cursor = { 0 };
+       struct inode            *inode = dentry->d_inode;
+       int                     error;
+
+       /*
+        * First read the regular on-disk attributes.
+        */
+       memset(&context, 0, sizeof(context));
+       context.dp = XFS_I(inode);
+       context.cursor = &cursor;
+       context.resynch = 1;
+       context.alist = data;
+       context.bufsize = size;
+       context.firstu = context.bufsize;
+
+       if (size)
+               context.put_listent = xfs_xattr_put_listent;
+       else
+               context.put_listent = xfs_xattr_put_listent_sizes;
+
+       xfs_attr_list_int(&context);
+       if (context.count < 0)
+               return -ERANGE;
+
+       /*
+        * Then add the two synthetic ACL attributes.
+        */
+       if (xfs_acl_vhasacl_access(inode)) {
+               error = list_one_attr(POSIX_ACL_XATTR_ACCESS,
+                               strlen(POSIX_ACL_XATTR_ACCESS) + 1,
+                               data, size, &context.count);
+               if (error)
+                       return error;
+       }
+
+       if (xfs_acl_vhasacl_default(inode)) {
+               error = list_one_attr(POSIX_ACL_XATTR_DEFAULT,
+                               strlen(POSIX_ACL_XATTR_DEFAULT) + 1,
+                               data, size, &context.count);
+               if (error)
+                       return error;
+       }
+
+       return context.count;
+}
index 85df328..fc9f3fb 100644 (file)
@@ -1435,8 +1435,7 @@ xfs_dqlock2(
 /* ARGSUSED */
 int
 xfs_qm_dqpurge(
-       xfs_dquot_t     *dqp,
-       uint            flags)
+       xfs_dquot_t     *dqp)
 {
        xfs_dqhash_t    *thishash;
        xfs_mount_t     *mp = dqp->q_mount;
index 5c371a9..f7393bb 100644 (file)
@@ -164,7 +164,7 @@ extern void         xfs_qm_dqprint(xfs_dquot_t *);
 
 extern void            xfs_qm_dqdestroy(xfs_dquot_t *);
 extern int             xfs_qm_dqflush(xfs_dquot_t *, uint);
-extern int             xfs_qm_dqpurge(xfs_dquot_t *, uint);
+extern int             xfs_qm_dqpurge(xfs_dquot_t *);
 extern void            xfs_qm_dqunpin_wait(xfs_dquot_t *);
 extern int             xfs_qm_dqlock_nowait(xfs_dquot_t *);
 extern int             xfs_qm_dqflock_nowait(xfs_dquot_t *);
index 36e05ca..08d2fc8 100644 (file)
@@ -576,8 +576,8 @@ xfs_qm_qoffend_logitem_committed(
         * xfs_trans_delete_ail() drops the AIL lock.
         */
        xfs_trans_delete_ail(qfs->qql_item.li_mountp, (xfs_log_item_t *)qfs);
-       kmem_free(qfs, sizeof(xfs_qoff_logitem_t));
-       kmem_free(qfe, sizeof(xfs_qoff_logitem_t));
+       kmem_free(qfs);
+       kmem_free(qfe);
        return (xfs_lsn_t)-1;
 }
 
index d31cce1..021934a 100644 (file)
@@ -192,8 +192,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, hsize * sizeof(xfs_dqhash_t));
-       kmem_free(xqm->qm_grp_dqhtable, hsize * sizeof(xfs_dqhash_t));
+       kmem_free(xqm->qm_usr_dqhtable);
+       kmem_free(xqm->qm_grp_dqhtable);
        xqm->qm_usr_dqhtable = NULL;
        xqm->qm_grp_dqhtable = NULL;
        xqm->qm_dqhashmask = 0;
@@ -201,7 +201,7 @@ xfs_qm_destroy(
 #ifdef DEBUG
        mutex_destroy(&qcheck_lock);
 #endif
-       kmem_free(xqm, sizeof(xfs_qm_t));
+       kmem_free(xqm);
 }
 
 /*
@@ -445,11 +445,11 @@ xfs_qm_unmount_quotas(
                }
        }
        if (uqp) {
-                XFS_PURGE_INODE(uqp);
+                IRELE(uqp);
                 mp->m_quotainfo->qi_uquotaip = NULL;
        }
        if (gqp) {
-               XFS_PURGE_INODE(gqp);
+               IRELE(gqp);
                mp->m_quotainfo->qi_gquotaip = NULL;
        }
 out:
@@ -631,7 +631,7 @@ xfs_qm_dqpurge_int(
                 * freelist in INACTIVE state.
                 */
                nextdqp = dqp->MPL_NEXT;
-               nmisses += xfs_qm_dqpurge(dqp, flags);
+               nmisses += xfs_qm_dqpurge(dqp);
                dqp = nextdqp;
        }
        xfs_qm_mplist_unlock(mp);
@@ -1134,7 +1134,7 @@ xfs_qm_init_quotainfo(
         * and change the superblock accordingly.
         */
        if ((error = xfs_qm_init_quotainos(mp))) {
-               kmem_free(qinf, sizeof(xfs_quotainfo_t));
+               kmem_free(qinf);
                mp->m_quotainfo = NULL;
                return error;
        }
@@ -1240,15 +1240,15 @@ xfs_qm_destroy_quotainfo(
        xfs_qm_list_destroy(&qi->qi_dqlist);
 
        if (qi->qi_uquotaip) {
-               XFS_PURGE_INODE(qi->qi_uquotaip);
+               IRELE(qi->qi_uquotaip);
                qi->qi_uquotaip = NULL; /* paranoia */
        }
        if (qi->qi_gquotaip) {
-               XFS_PURGE_INODE(qi->qi_gquotaip);
+               IRELE(qi->qi_gquotaip);
                qi->qi_gquotaip = NULL;
        }
        mutex_destroy(&qi->qi_quotaofflock);
-       kmem_free(qi, sizeof(xfs_quotainfo_t));
+       kmem_free(qi);
        mp->m_quotainfo = NULL;
 }
 
@@ -1394,7 +1394,7 @@ xfs_qm_qino_alloc(
         * locked exclusively and joined to the transaction already.
         */
        ASSERT(xfs_isilocked(*ip, XFS_ILOCK_EXCL));
-       VN_HOLD(XFS_ITOV((*ip)));
+       IHOLD(*ip);
 
        /*
         * Make the changes in the superblock, and log those too.
@@ -1623,7 +1623,7 @@ xfs_qm_dqiterate(
                        break;
        } while (nmaps > 0);
 
-       kmem_free(map, XFS_DQITER_MAP_SIZE * sizeof(*map));
+       kmem_free(map);
 
        return error;
 }
index 768a3b2..adfb872 100644 (file)
@@ -362,11 +362,11 @@ xfs_qm_scall_quotaoff(
         * if we don't need them anymore.
         */
        if ((dqtype & XFS_QMOPT_UQUOTA) && XFS_QI_UQIP(mp)) {
-               XFS_PURGE_INODE(XFS_QI_UQIP(mp));
+               IRELE(XFS_QI_UQIP(mp));
                XFS_QI_UQIP(mp) = NULL;
        }
        if ((dqtype & (XFS_QMOPT_GQUOTA|XFS_QMOPT_PQUOTA)) && XFS_QI_GQIP(mp)) {
-               XFS_PURGE_INODE(XFS_QI_GQIP(mp));
+               IRELE(XFS_QI_GQIP(mp));
                XFS_QI_GQIP(mp) = NULL;
        }
 out_error:
@@ -1449,14 +1449,14 @@ xfs_qm_internalqcheck(
                for (d = (xfs_dqtest_t *) h1->qh_next; d != NULL; ) {
                        xfs_dqtest_cmp(d);
                        e = (xfs_dqtest_t *) d->HL_NEXT;
-                       kmem_free(d, sizeof(xfs_dqtest_t));
+                       kmem_free(d);
                        d = e;
                }
                h1 = &qmtest_gdqtab[i];
                for (d = (xfs_dqtest_t *) h1->qh_next; d != NULL; ) {
                        xfs_dqtest_cmp(d);
                        e = (xfs_dqtest_t *) d->HL_NEXT;
-                       kmem_free(d, sizeof(xfs_dqtest_t));
+                       kmem_free(d);
                        d = e;
                }
        }
@@ -1467,8 +1467,8 @@ xfs_qm_internalqcheck(
        } else {
                cmn_err(CE_DEBUG, "******** quotacheck successful! ********");
        }
-       kmem_free(qmtest_udqtab, qmtest_hashmask * sizeof(xfs_dqhash_t));
-       kmem_free(qmtest_gdqtab, qmtest_hashmask * sizeof(xfs_dqhash_t));
+       kmem_free(qmtest_udqtab);
+       kmem_free(qmtest_gdqtab);
        mutex_unlock(&qcheck_lock);
        return (qmtest_nfails);
 }
index 5e4a40b..c4fcea6 100644 (file)
@@ -158,9 +158,6 @@ for ((dqp) = (qlist)->qh_next; (dqp) != (xfs_dquot_t *)(qlist); \
 #define XFS_IS_SUSER_DQUOT(dqp)                \
        (!((dqp)->q_core.d_id))
 
-#define XFS_PURGE_INODE(ip)            \
-       IRELE(ip);
-
 #define DQFLAGTO_TYPESTR(d)    (((d)->dq_flags & XFS_DQ_USER) ? "USR" : \
                                 (((d)->dq_flags & XFS_DQ_GROUP) ? "GRP" : \
                                 (((d)->dq_flags & XFS_DQ_PROJ) ? "PRJ":"???")))
index 0b75d30..a34ef05 100644 (file)
@@ -89,7 +89,7 @@ ktrace_alloc(int nentries, unsigned int __nocast sleep)
                if (sleep & KM_SLEEP)
                        panic("ktrace_alloc: NULL memory on KM_SLEEP request!");
 
-               kmem_free(ktp, sizeof(*ktp));
+               kmem_free(ktp);
 
                return NULL;
        }
@@ -126,7 +126,7 @@ ktrace_free(ktrace_t *ktp)
        } else {
                entries_size = (int)(ktp->kt_nentries * sizeof(ktrace_entry_t));
 
-               kmem_free(ktp->kt_entries, entries_size);
+               kmem_free(ktp->kt_entries);
        }
 
        kmem_zone_free(ktrace_hdr_zone, ktp);
index 493a6ec..5830c04 100644 (file)
@@ -17,7 +17,7 @@
  */
 #include <xfs.h>
 
-static mutex_t uuid_monitor;
+static DEFINE_MUTEX(uuid_monitor);
 static int     uuid_table_size;
 static uuid_t  *uuid_table;
 
@@ -132,9 +132,3 @@ uuid_table_remove(uuid_t *uuid)
        ASSERT(i < uuid_table_size);
        mutex_unlock(&uuid_monitor);
 }
-
-void __init
-uuid_init(void)
-{
-       mutex_init(&uuid_monitor);
-}
index b6f5922..cff5b60 100644 (file)
@@ -22,7 +22,6 @@ typedef struct {
        unsigned char   __u_bits[16];
 } uuid_t;
 
-extern void uuid_init(void);
 extern void uuid_create_nil(uuid_t *uuid);
 extern int uuid_is_nil(uuid_t *uuid);
 extern int uuid_equal(uuid_t *uuid1, uuid_t *uuid2);
index ebee3a4..3e4648a 100644 (file)
@@ -341,8 +341,7 @@ xfs_acl_iaccess(
 
        /* If the file has no ACL return -1. */
        rval = sizeof(xfs_acl_t);
-       if (xfs_attr_fetch(ip, &acl_name, (char *)acl, &rval,
-                                       ATTR_ROOT | ATTR_KERNACCESS)) {
+       if (xfs_attr_fetch(ip, &acl_name, (char *)acl, &rval, ATTR_ROOT)) {
                _ACL_FREE(acl);
                return -1;
        }
@@ -720,7 +719,7 @@ xfs_acl_setmode(
        xfs_acl_t       *acl,
        int             *basicperms)
 {
-       bhv_vattr_t     va;
+       struct iattr    iattr;
        xfs_acl_entry_t *ap;
        xfs_acl_entry_t *gap = NULL;
        int             i, nomask = 1;
@@ -734,25 +733,25 @@ xfs_acl_setmode(
         * Copy the u::, g::, o::, and m:: bits from the ACL into the
         * mode.  The m:: bits take precedence over the g:: bits.
         */
-       va.va_mask = XFS_AT_MODE;
-       va.va_mode = xfs_vtoi(vp)->i_d.di_mode;
-       va.va_mode &= ~(S_IRWXU|S_IRWXG|S_IRWXO);
+       iattr.ia_valid = ATTR_MODE;
+       iattr.ia_mode = xfs_vtoi(vp)->i_d.di_mode;
+       iattr.ia_mode &= ~(S_IRWXU|S_IRWXG|S_IRWXO);
        ap = acl->acl_entry;
        for (i = 0; i < acl->acl_cnt; ++i) {
                switch (ap->ae_tag) {
                case ACL_USER_OBJ:
-                       va.va_mode |= ap->ae_perm << 6;
+                       iattr.ia_mode |= ap->ae_perm << 6;
                        break;
                case ACL_GROUP_OBJ:
                        gap = ap;
                        break;
                case ACL_MASK:  /* more than just standard modes */
                        nomask = 0;
-                       va.va_mode |= ap->ae_perm << 3;
+                       iattr.ia_mode |= ap->ae_perm << 3;
                        *basicperms = 0;
                        break;
                case ACL_OTHER:
-                       va.va_mode |= ap->ae_perm;
+                       iattr.ia_mode |= ap->ae_perm;
                        break;
                default:        /* more than just standard modes */
                        *basicperms = 0;
@@ -763,9 +762,9 @@ xfs_acl_setmode(
 
        /* Set the group bits from ACL_GROUP_OBJ if there's no ACL_MASK */
        if (gap && nomask)
-               va.va_mode |= gap->ae_perm << 3;
+               iattr.ia_mode |= gap->ae_perm << 3;
 
-       return xfs_setattr(xfs_vtoi(vp), &va, 0, sys_cred);
+       return xfs_setattr(xfs_vtoi(vp), &iattr, 0, sys_cred);
 }
 
 /*
index 332a772..323ee94 100644 (file)
@@ -46,6 +46,8 @@ typedef struct xfs_acl {
 #define SGI_ACL_FILE_SIZE      (sizeof(SGI_ACL_FILE)-1)
 #define SGI_ACL_DEFAULT_SIZE   (sizeof(SGI_ACL_DEFAULT)-1)
 
+#define _ACL_TYPE_ACCESS       1
+#define _ACL_TYPE_DEFAULT      2
 
 #ifdef CONFIG_XFS_POSIX_ACL
 
@@ -66,8 +68,6 @@ extern int xfs_acl_vset(bhv_vnode_t *, void *, size_t, int);
 extern int xfs_acl_vget(bhv_vnode_t *, void *, size_t, int);
 extern int xfs_acl_vremove(bhv_vnode_t *, int);
 
-#define _ACL_TYPE_ACCESS       1
-#define _ACL_TYPE_DEFAULT      2
 #define _ACL_PERM_INVALID(perm)        ((perm) & ~(ACL_READ|ACL_WRITE|ACL_EXECUTE))
 
 #define _ACL_INHERIT(c,m,d)    (xfs_acl_inherit(c,m,d))
index df151a8..78de80e 100644 (file)
@@ -16,8 +16,6 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <linux/capability.h>
-
 #include "xfs.h"
 #include "xfs_fs.h"
 #include "xfs_types.h"
  * Provide the external interfaces to manage attribute lists.
  */
 
-#define ATTR_SYSCOUNT  2
-static struct attrnames posix_acl_access;
-static struct attrnames posix_acl_default;
-static struct attrnames *attr_system_names[ATTR_SYSCOUNT];
-
 /*========================================================================
  * Function prototypes for the kernel.
  *========================================================================*/
@@ -116,6 +109,17 @@ xfs_attr_name_to_xname(
        return 0;
 }
 
+STATIC int
+xfs_inode_hasattr(
+       struct xfs_inode        *ip)
+{
+       if (!XFS_IFORK_Q(ip) ||
+           (ip->i_d.di_aformat == XFS_DINODE_FMT_EXTENTS &&
+            ip->i_d.di_anextents == 0))
+               return 0;
+       return 1;
+}
+
 /*========================================================================
  * Overall external interface routines.
  *========================================================================*/
@@ -127,10 +131,8 @@ xfs_attr_fetch(xfs_inode_t *ip, struct xfs_name *name,
        xfs_da_args_t   args;
        int             error;
 
-       if ((XFS_IFORK_Q(ip) == 0) ||
-           (ip->i_d.di_aformat == XFS_DINODE_FMT_EXTENTS &&
-            ip->i_d.di_anextents == 0))
-               return(ENOATTR);
+       if (!xfs_inode_hasattr(ip))
+               return ENOATTR;
 
        /*
         * Fill in the arg structure for this request.
@@ -148,11 +150,7 @@ xfs_attr_fetch(xfs_inode_t *ip, struct xfs_name *name,
        /*
         * Decide on what work routines to call based on the inode size.
         */
-       if (XFS_IFORK_Q(ip) == 0 ||
-           (ip->i_d.di_aformat == XFS_DINODE_FMT_EXTENTS &&
-            ip->i_d.di_anextents == 0)) {
-               error = XFS_ERROR(ENOATTR);
-       } else if (ip->i_d.di_aformat == XFS_DINODE_FMT_LOCAL) {
+       if (ip->i_d.di_aformat == XFS_DINODE_FMT_LOCAL) {
                error = xfs_attr_shortform_getvalue(&args);
        } else if (xfs_bmap_one_block(ip, XFS_ATTR_FORK)) {
                error = xfs_attr_leaf_get(&args);
@@ -241,8 +239,7 @@ xfs_attr_set_int(xfs_inode_t *dp, struct xfs_name *name,
        args.firstblock = &firstblock;
        args.flist = &flist;
        args.whichfork = XFS_ATTR_FORK;
-       args.addname = 1;
-       args.oknoent = 1;
+       args.op_flags = XFS_DA_OP_ADDNAME | XFS_DA_OP_OKNOENT;
 
        /*
         * Determine space new attribute will use, and if it would be
@@ -529,9 +526,7 @@ xfs_attr_remove_int(xfs_inode_t *dp, struct xfs_name *name, int flags)
        /*
         * Decide on what work routines to call based on the inode size.
         */
-       if (XFS_IFORK_Q(dp) == 0 ||
-           (dp->i_d.di_aformat == XFS_DINODE_FMT_EXTENTS &&
-            dp->i_d.di_anextents == 0)) {
+       if (!xfs_inode_hasattr(dp)) {
                error = XFS_ERROR(ENOATTR);
                goto out;
        }
@@ -601,29 +596,33 @@ xfs_attr_remove(
                return error;
 
        xfs_ilock(dp, XFS_ILOCK_SHARED);
-       if (XFS_IFORK_Q(dp) == 0 ||
-                  (dp->i_d.di_aformat == XFS_DINODE_FMT_EXTENTS &&
-                   dp->i_d.di_anextents == 0)) {
+       if (!xfs_inode_hasattr(dp)) {
                xfs_iunlock(dp, XFS_ILOCK_SHARED);
-               return(XFS_ERROR(ENOATTR));
+               return XFS_ERROR(ENOATTR);
        }
        xfs_iunlock(dp, XFS_ILOCK_SHARED);
 
        return xfs_attr_remove_int(dp, &xname, flags);
 }
 
-STATIC int
+int
 xfs_attr_list_int(xfs_attr_list_context_t *context)
 {
        int error;
        xfs_inode_t *dp = context->dp;
 
+       XFS_STATS_INC(xs_attr_list);
+
+       if (XFS_FORCED_SHUTDOWN(dp->i_mount))
+               return EIO;
+
+       xfs_ilock(dp, XFS_ILOCK_SHARED);
+       xfs_attr_trace_l_c("syscall start", context);
+
        /*
         * Decide on what work routines to call based on the inode size.
         */
-       if (XFS_IFORK_Q(dp) == 0 ||
-           (dp->i_d.di_aformat == XFS_DINODE_FMT_EXTENTS &&
-            dp->i_d.di_anextents == 0)) {
+       if (!xfs_inode_hasattr(dp)) {
                error = 0;
        } else if (dp->i_d.di_aformat == XFS_DINODE_FMT_LOCAL) {
                error = xfs_attr_shortform_list(context);
@@ -632,6 +631,10 @@ xfs_attr_list_int(xfs_attr_list_context_t *context)
        } else {
                error = xfs_attr_node_list(context);
        }
+
+       xfs_iunlock(dp, XFS_ILOCK_SHARED);
+       xfs_attr_trace_l_c("syscall end", context);
+
        return error;
 }
 
@@ -648,74 +651,50 @@ xfs_attr_list_int(xfs_attr_list_context_t *context)
  */
 /*ARGSUSED*/
 STATIC int
-xfs_attr_put_listent(xfs_attr_list_context_t *context, attrnames_t *namesp,
+xfs_attr_put_listent(xfs_attr_list_context_t *context, int flags,
                     char *name, int namelen,
                     int valuelen, char *value)
 {
+       struct attrlist *alist = (struct attrlist *)context->alist;
        attrlist_ent_t *aep;
        int arraytop;
 
        ASSERT(!(context->flags & ATTR_KERNOVAL));
        ASSERT(context->count >= 0);
        ASSERT(context->count < (ATTR_MAX_VALUELEN/8));
-       ASSERT(context->firstu >= sizeof(*context->alist));
+       ASSERT(context->firstu >= sizeof(*alist));
        ASSERT(context->firstu <= context->bufsize);
 
-       arraytop = sizeof(*context->alist) +
-                       context->count * sizeof(context->alist->al_offset[0]);
+       /*
+        * Only list entries in the right namespace.
+        */
+       if (((context->flags & ATTR_SECURE) == 0) !=
+           ((flags & XFS_ATTR_SECURE) == 0))
+               return 0;
+       if (((context->flags & ATTR_ROOT) == 0) !=
+           ((flags & XFS_ATTR_ROOT) == 0))
+               return 0;
+
+       arraytop = sizeof(*alist) +
+                       context->count * sizeof(alist->al_offset[0]);
        context->firstu -= ATTR_ENTSIZE(namelen);
        if (context->firstu < arraytop) {
                xfs_attr_trace_l_c("buffer full", context);
-               context->alist->al_more = 1;
+               alist->al_more = 1;
                context->seen_enough = 1;
                return 1;
        }
 
-       aep = (attrlist_ent_t *)&(((char *)context->alist)[ context->firstu ]);
+       aep = (attrlist_ent_t *)&context->alist[context->firstu];
        aep->a_valuelen = valuelen;
        memcpy(aep->a_name, name, namelen);
-       aep->a_name[ namelen ] = 0;
-       context->alist->al_offset[ context->count++ ] = context->firstu;
-       context->alist->al_count = context->count;
+       aep->a_name[namelen] = 0;
+       alist->al_offset[context->count++] = context->firstu;
+       alist->al_count = context->count;
        xfs_attr_trace_l_c("add", context);
        return 0;
 }
 
-STATIC int
-xfs_attr_kern_list(xfs_attr_list_context_t *context, attrnames_t *namesp,
-                    char *name, int namelen,
-                    int valuelen, char *value)
-{
-       char *offset;
-       int arraytop;
-
-       ASSERT(context->count >= 0);
-
-       arraytop = context->count + namesp->attr_namelen + namelen + 1;
-       if (arraytop > context->firstu) {
-               context->count = -1;    /* insufficient space */
-               return 1;
-       }
-       offset = (char *)context->alist + context->count;
-       strncpy(offset, namesp->attr_name, namesp->attr_namelen);
-       offset += namesp->attr_namelen;
-       strncpy(offset, name, namelen);                 /* real name */
-       offset += namelen;
-       *offset = '\0';
-       context->count += namesp->attr_namelen + namelen + 1;
-       return 0;
-}
-
-/*ARGSUSED*/
-STATIC int
-xfs_attr_kern_list_sizes(xfs_attr_list_context_t *context, attrnames_t *namesp,
-                    char *name, int namelen,
-                    int valuelen, char *value)
-{
-       context->count += namesp->attr_namelen + namelen + 1;
-       return 0;
-}
-
 /*
  * Generate a list of extended attribute names and optionally
  * also value lengths.  Positive return value follows the XFS
@@ -732,10 +711,9 @@ xfs_attr_list(
        attrlist_cursor_kern_t *cursor)
 {
        xfs_attr_list_context_t context;
+       struct attrlist *alist;
        int error;
 
-       XFS_STATS_INC(xs_attr_list);
-
        /*
         * Validate the cursor.
         */
@@ -756,52 +734,23 @@ xfs_attr_list(
        /*
         * Initialize the output buffer.
         */
+       memset(&context, 0, sizeof(context));
        context.dp = dp;
        context.cursor = cursor;
-       context.count = 0;
-       context.dupcnt = 0;
        context.resynch = 1;
        context.flags = flags;
-       context.seen_enough = 0;
-       context.alist = (attrlist_t *)buffer;
-       context.put_value = 0;
-
-       if (flags & ATTR_KERNAMELS) {
-               context.bufsize = bufsize;
-               context.firstu = context.bufsize;
-               if (flags & ATTR_KERNOVAL)
-                       context.put_listent = xfs_attr_kern_list_sizes;
-               else
-                       context.put_listent = xfs_attr_kern_list;
-       } else {
-               context.bufsize = (bufsize & ~(sizeof(int)-1));  /* align */
-               context.firstu = context.bufsize;
-               context.alist->al_count = 0;
-               context.alist->al_more = 0;
-               context.alist->al_offset[0] = context.bufsize;
-               context.put_listent = xfs_attr_put_listent;
-       }
+       context.alist = buffer;
+       context.bufsize = (bufsize & ~(sizeof(int)-1));  /* align */
+       context.firstu = context.bufsize;
+       context.put_listent = xfs_attr_put_listent;
 
-       if (XFS_FORCED_SHUTDOWN(dp->i_mount))
-               return EIO;
-
-       xfs_ilock(dp, XFS_ILOCK_SHARED);
-       xfs_attr_trace_l_c("syscall start", &context);
+       alist = (struct attrlist *)context.alist;
+       alist->al_count = 0;
+       alist->al_more = 0;
+       alist->al_offset[0] = context.bufsize;
 
        error = xfs_attr_list_int(&context);
-
-       xfs_iunlock(dp, XFS_ILOCK_SHARED);
-       xfs_attr_trace_l_c("syscall end", &context);
-
-       if (context.flags & (ATTR_KERNOVAL|ATTR_KERNAMELS)) {
-               /* must return negated buffer size or the error */
-               if (context.count < 0)
-                       error = XFS_ERROR(ERANGE);
-               else
-                       error = -context.count;
-       } else
-               ASSERT(error >= 0);
-
+       ASSERT(error >= 0);
        return error;
 }
 
@@ -816,12 +765,10 @@ xfs_attr_inactive(xfs_inode_t *dp)
        ASSERT(! XFS_NOT_DQATTACHED(mp, dp));
 
        xfs_ilock(dp, XFS_ILOCK_SHARED);
-       if ((XFS_IFORK_Q(dp) == 0) ||
-           (dp->i_d.di_aformat == XFS_DINODE_FMT_LOCAL) ||
-           (dp->i_d.di_aformat == XFS_DINODE_FMT_EXTENTS &&
-            dp->i_d.di_anextents == 0)) {
+       if (!xfs_inode_hasattr(dp) ||
+           dp->i_d.di_aformat == XFS_DINODE_FMT_LOCAL) {
                xfs_iunlock(dp, XFS_ILOCK_SHARED);
-               return(0);
+               return 0;
        }
        xfs_iunlock(dp, XFS_ILOCK_SHARED);
 
@@ -854,10 +801,8 @@ xfs_attr_inactive(xfs_inode_t *dp)
        /*
         * Decide on what work routines to call based on the inode size.
         */
-       if ((XFS_IFORK_Q(dp) == 0) ||
-           (dp->i_d.di_aformat == XFS_DINODE_FMT_LOCAL) ||
-           (dp->i_d.di_aformat == XFS_DINODE_FMT_EXTENTS &&
-            dp->i_d.di_anextents == 0)) {
+       if (!xfs_inode_hasattr(dp) ||
+           dp->i_d.di_aformat == XFS_DINODE_FMT_LOCAL) {
                error = 0;
                goto out;
        }
@@ -974,7 +919,7 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
                        xfs_da_brelse(args->trans, bp);
                        return(retval);
                }
-               args->rename = 1;                       /* an atomic rename */
+               args->op_flags |= XFS_DA_OP_RENAME;     /* an atomic rename */
                args->blkno2 = args->blkno;             /* set 2nd entry info*/
                args->index2 = args->index;
                args->rmtblkno2 = args->rmtblkno;
@@ -1054,7 +999,7 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
         * so that one disappears and one appears atomically.  Then we
         * must remove the "old" attribute/value pair.
         */
-       if (args->rename) {
+       if (args->op_flags & XFS_DA_OP_RENAME) {
                /*
                 * In a separate transaction, set the incomplete flag on the
                 * "old" attr and clear the incomplete flag on the "new" attr.
@@ -1307,7 +1252,7 @@ restart:
        } else if (retval == EEXIST) {
                if (args->flags & ATTR_CREATE)
                        goto out;
-               args->rename = 1;                       /* atomic rename op */
+               args->op_flags |= XFS_DA_OP_RENAME;     /* atomic rename op */
                args->blkno2 = args->blkno;             /* set 2nd entry info*/
                args->index2 = args->index;
                args->rmtblkno2 = args->rmtblkno;
@@ -1425,7 +1370,7 @@ restart:
         * so that one disappears and one appears atomically.  Then we
         * must remove the "old" attribute/value pair.
         */
-       if (args->rename) {
+       if (args->op_flags & XFS_DA_OP_RENAME) {
                /*
                 * In a separate transaction, set the incomplete flag on the
                 * "old" attr and clear the incomplete flag on the "new" attr.
@@ -2300,23 +2245,7 @@ xfs_attr_rmtval_remove(xfs_da_args_t *args)
 void
 xfs_attr_trace_l_c(char *where, struct xfs_attr_list_context *context)
 {
-       xfs_attr_trace_enter(XFS_ATTR_KTRACE_L_C, where,
-               (__psunsigned_t)context->dp,
-               (__psunsigned_t)context->cursor->hashval,
-               (__psunsigned_t)context->cursor->blkno,
-               (__psunsigned_t)context->cursor->offset,
-               (__psunsigned_t)context->alist,
-               (__psunsigned_t)context->bufsize,
-               (__psunsigned_t)context->count,
-               (__psunsigned_t)context->firstu,
-               (__psunsigned_t)
-                       ((context->count > 0) &&
-                       !(context->flags & (ATTR_KERNAMELS|ATTR_KERNOVAL)))
-                               ? (ATTR_ENTRY(context->alist,
-                                             context->count-1)->a_valuelen)
-                               : 0,
-               (__psunsigned_t)context->dupcnt,
-               (__psunsigned_t)context->flags,
+       xfs_attr_trace_enter(XFS_ATTR_KTRACE_L_C, where, context,
                (__psunsigned_t)NULL,
                (__psunsigned_t)NULL,
                (__psunsigned_t)NULL);
@@ -2329,23 +2258,7 @@ void
 xfs_attr_trace_l_cn(char *where, struct xfs_attr_list_context *context,
                         struct xfs_da_intnode *node)
 {
-       xfs_attr_trace_enter(XFS_ATTR_KTRACE_L_CN, where,
-               (__psunsigned_t)context->dp,
-               (__psunsigned_t)context->cursor->hashval,
-               (__psunsigned_t)context->cursor->blkno,
-               (__psunsigned_t)context->cursor->offset,
-               (__psunsigned_t)context->alist,
-               (__psunsigned_t)context->bufsize,
-               (__psunsigned_t)context->count,
-               (__psunsigned_t)context->firstu,
-               (__psunsigned_t)
-                       ((context->count > 0) &&
-                       !(context->flags & (ATTR_KERNAMELS|ATTR_KERNOVAL)))
-                               ? (ATTR_ENTRY(context->alist,
-                                             context->count-1)->a_valuelen)
-                               : 0,
-               (__psunsigned_t)context->dupcnt,
-               (__psunsigned_t)context->flags,
+       xfs_attr_trace_enter(XFS_ATTR_KTRACE_L_CN, where, context,
                (__psunsigned_t)be16_to_cpu(node->hdr.count),
                (__psunsigned_t)be32_to_cpu(node->btree[0].hashval),
                (__psunsigned_t)be32_to_cpu(node->btree[
@@ -2359,23 +2272,7 @@ void
 xfs_attr_trace_l_cb(char *where, struct xfs_attr_list_context *context,
                          struct xfs_da_node_entry *btree)
 {
-       xfs_attr_trace_enter(XFS_ATTR_KTRACE_L_CB, where,
-               (__psunsigned_t)context->dp,
-               (__psunsigned_t)context->cursor->hashval,
-               (__psunsigned_t)context->cursor->blkno,
-               (__psunsigned_t)context->cursor->offset,
-               (__psunsigned_t)context->alist,
-               (__psunsigned_t)context->bufsize,
-               (__psunsigned_t)context->count,
-               (__psunsigned_t)context->firstu,
-               (__psunsigned_t)
-                       ((context->count > 0) &&
-                       !(context->flags & (ATTR_KERNAMELS|ATTR_KERNOVAL)))
-                               ? (ATTR_ENTRY(context->alist,
-                                             context->count-1)->a_valuelen)
-                               : 0,
-               (__psunsigned_t)context->dupcnt,
-               (__psunsigned_t)context->flags,
+       xfs_attr_trace_enter(XFS_ATTR_KTRACE_L_CB, where, context,
                (__psunsigned_t)be32_to_cpu(btree->hashval),
                (__psunsigned_t)be32_to_cpu(btree->before),
                (__psunsigned_t)NULL);
@@ -2388,23 +2285,7 @@ void
 xfs_attr_trace_l_cl(char *where, struct xfs_attr_list_context *context,
                              struct xfs_attr_leafblock *leaf)
 {
-       xfs_attr_trace_enter(XFS_ATTR_KTRACE_L_CL, where,
-               (__psunsigned_t)context->dp,
-               (__psunsigned_t)context->cursor->hashval,
-               (__psunsigned_t)context->cursor->blkno,
-               (__psunsigned_t)context->cursor->offset,
-               (__psunsigned_t)context->alist,
-               (__psunsigned_t)context->bufsize,
-               (__psunsigned_t)context->count,
-               (__psunsigned_t)context->firstu,
-               (__psunsigned_t)
-                       ((context->count > 0) &&
-                       !(context->flags & (ATTR_KERNAMELS|ATTR_KERNOVAL)))
-                               ? (ATTR_ENTRY(context->alist,
-                                             context->count-1)->a_valuelen)
-                               : 0,
-               (__psunsigned_t)context->dupcnt,
-               (__psunsigned_t)context->flags,
+       xfs_attr_trace_enter(XFS_ATTR_KTRACE_L_CL, where, context,
                (__psunsigned_t)be16_to_cpu(leaf->hdr.count),
                (__psunsigned_t)be32_to_cpu(leaf->entries[0].hashval),
                (__psunsigned_t)be32_to_cpu(leaf->entries[
@@ -2417,329 +2298,24 @@ xfs_attr_trace_l_cl(char *where, struct xfs_attr_list_context *context,
  */
 void
 xfs_attr_trace_enter(int type, char *where,
-                        __psunsigned_t a2, __psunsigned_t a3,
-                        __psunsigned_t a4, __psunsigned_t a5,
-                        __psunsigned_t a6, __psunsigned_t a7,
-                        __psunsigned_t a8, __psunsigned_t a9,
-                        __psunsigned_t a10, __psunsigned_t a11,
-                        __psunsigned_t a12, __psunsigned_t a13,
-                        __psunsigned_t a14, __psunsigned_t a15)
+                        struct xfs_attr_list_context *context,
+                        __psunsigned_t a13, __psunsigned_t a14,
+                        __psunsigned_t a15)
 {
        ASSERT(xfs_attr_trace_buf);
        ktrace_enter(xfs_attr_trace_buf, (void *)((__psunsigned_t)type),
-                                        (void *)where,
-                                        (void *)a2,  (void *)a3,  (void *)a4,
-                                        (void *)a5,  (void *)a6,  (void *)a7,
-                                        (void *)a8,  (void *)a9,  (void *)a10,
-                                        (void *)a11, (void *)a12, (void *)a13,
-                                        (void *)a14, (void *)a15);
+               (void *)((__psunsigned_t)where),
+               (void *)((__psunsigned_t)context->dp),
+               (void *)((__psunsigned_t)context->cursor->hashval),
+               (void *)((__psunsigned_t)context->cursor->blkno),
+               (void *)((__psunsigned_t)context->cursor->offset),
+               (void *)((__psunsigned_t)context->alist),
+               (void *)((__psunsigned_t)context->bufsize),
+               (void *)((__psunsigned_t)context->count),
+               (void *)((__psunsigned_t)context->firstu),
+               NULL,
+               (void *)((__psunsigned_t)context->dupcnt),
+               (void *)((__psunsigned_t)context->flags),
+               (void *)a13, (void *)a14, (void *)a15);
 }
 #endif /* XFS_ATTR_TRACE */
-
-
-/*========================================================================
- * System (pseudo) namespace attribute interface routines.
- *========================================================================*/
-
-STATIC int
-posix_acl_access_set(
-       bhv_vnode_t *vp, char *name, void *data, size_t size, int xflags)
-{
-       return xfs_acl_vset(vp, data, size, _ACL_TYPE_ACCESS);
-}
-
-STATIC int
-posix_acl_access_remove(
-       bhv_vnode_t *vp, char *name, int xflags)
-{
-       return xfs_acl_vremove(vp, _ACL_TYPE_ACCESS);
-}
-
-STATIC int
-posix_acl_access_get(
-       bhv_vnode_t *vp, char *name, void *data, size_t size, int xflags)
-{
-       return xfs_acl_vget(vp, data, size, _ACL_TYPE_ACCESS);
-}
-
-STATIC int
-posix_acl_access_exists(
-       bhv_vnode_t *vp)
-{
-       return xfs_acl_vhasacl_access(vp);
-}
-
-STATIC int
-posix_acl_default_set(
-       bhv_vnode_t *vp, char *name, void *data, size_t size, int xflags)
-{
-       return xfs_acl_vset(vp, data, size, _ACL_TYPE_DEFAULT);
-}
-
-STATIC int
-posix_acl_default_get(
-       bhv_vnode_t *vp, char *name, void *data, size_t size, int xflags)
-{
-       return xfs_acl_vget(vp, data, size, _ACL_TYPE_DEFAULT);
-}
-
-STATIC int
-posix_acl_default_remove(
-       bhv_vnode_t *vp, char *name, int xflags)
-{
-       return xfs_acl_vremove(vp, _ACL_TYPE_DEFAULT);
-}
-
-STATIC int
-posix_acl_default_exists(
-       bhv_vnode_t *vp)
-{
-       return xfs_acl_vhasacl_default(vp);
-}
-
-static struct attrnames posix_acl_access = {
-       .attr_name      = "posix_acl_access",
-       .attr_namelen   = sizeof("posix_acl_access") - 1,
-       .attr_get       = posix_acl_access_get,
-       .attr_set       = posix_acl_access_set,
-       .attr_remove    = posix_acl_access_remove,
-       .attr_exists    = posix_acl_access_exists,
-};
-
-static struct attrnames posix_acl_default = {
-       .attr_name      = "posix_acl_default",
-       .attr_namelen   = sizeof("posix_acl_default") - 1,
-       .attr_get       = posix_acl_default_get,
-       .attr_set       = posix_acl_default_set,
-       .attr_remove    = posix_acl_default_remove,
-       .attr_exists    = posix_acl_default_exists,
-};
-
-static struct attrnames *attr_system_names[] =
-       { &posix_acl_access, &posix_acl_default };
-
-
-/*========================================================================
- * Namespace-prefix-style attribute name interface routines.
- *========================================================================*/
-
-STATIC int
-attr_generic_set(
-       bhv_vnode_t *vp, char *name, void *data, size_t size, int xflags)
-{
-       return -xfs_attr_set(xfs_vtoi(vp), name, data, size, xflags);
-}
-
-STATIC int
-attr_generic_get(
-       bhv_vnode_t *vp, char *name, void *data, size_t size, int xflags)
-{
-       int     error, asize = size;
-
-       error = xfs_attr_get(xfs_vtoi(vp), name, data, &asize, xflags);
-       if (!error)
-               return asize;
-       return -error;
-}
-
-STATIC int
-attr_generic_remove(
-       bhv_vnode_t *vp, char *name, int xflags)
-{
-       return -xfs_attr_remove(xfs_vtoi(vp), name, xflags);
-}
-
-STATIC int
-attr_generic_listadd(
-       attrnames_t             *prefix,
-       attrnames_t             *namesp,
-       void                    *data,
-       size_t                  size,
-       ssize_t                 *result)
-{
-       char                    *p = data + *result;
-
-       *result += prefix->attr_namelen;
-       *result += namesp->attr_namelen + 1;
-       if (!size)
-               return 0;
-       if (*result > size)
-               return -ERANGE;
-       strcpy(p, prefix->attr_name);
-       p += prefix->attr_namelen;
-       strcpy(p, namesp->attr_name);
-       p += namesp->attr_namelen + 1;
-       return 0;
-}
-
-STATIC int
-attr_system_list(
-       bhv_vnode_t             *vp,
-       void                    *data,
-       size_t                  size,
-       ssize_t                 *result)
-{
-       attrnames_t             *namesp;
-       int                     i, error = 0;
-
-       for (i = 0; i < ATTR_SYSCOUNT; i++) {
-               namesp = attr_system_names[i];
-               if (!namesp->attr_exists || !namesp->attr_exists(vp))
-                       continue;
-               error = attr_generic_listadd(&attr_system, namesp,
-                                               data, size, result);
-               if (error)
-                       break;
-       }
-       return error;
-}
-
-int
-attr_generic_list(
-       bhv_vnode_t *vp, void *data, size_t size, int xflags, ssize_t *result)
-{
-       attrlist_cursor_kern_t  cursor = { 0 };
-       int                     error;
-
-       error = xfs_attr_list(xfs_vtoi(vp), data, size, xflags, &cursor);
-       if (error > 0)
-               return -error;
-       *result = -error;
-       return attr_system_list(vp, data, size, result);
-}
-
-attrnames_t *
-attr_lookup_namespace(
-       char                    *name,
-       struct attrnames        **names,
-       int                     nnames)
-{
-       int                     i;
-
-       for (i = 0; i < nnames; i++)
-               if (!strncmp(name, names[i]->attr_name, names[i]->attr_namelen))
-                       return names[i];
-       return NULL;
-}
-
-/*
- * Some checks to prevent people abusing EAs to get over quota:
- * - Don't allow modifying user EAs on devices/symlinks;
- * - Don't allow modifying user EAs if sticky bit set;
- */
-STATIC int
-attr_user_capable(
-       bhv_vnode_t     *vp,
-       cred_t          *cred)
-{
-       struct inode    *inode = vn_to_inode(vp);
-
-       if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
-               return -EPERM;
-       if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode) &&
-           !capable(CAP_SYS_ADMIN))
-               return -EPERM;
-       if (S_ISDIR(inode->i_mode) && (inode->i_mode & S_ISVTX) &&
-           (current_fsuid(cred) != inode->i_uid) && !capable(CAP_FOWNER))
-               return -EPERM;
-       return 0;
-}
-
-STATIC int
-attr_trusted_capable(
-       bhv_vnode_t     *vp,
-       cred_t          *cred)
-{
-       struct inode    *inode = vn_to_inode(vp);
-
-       if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
-               return -EPERM;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
-       return 0;
-}
-
-STATIC int
-attr_system_set(
-       bhv_vnode_t *vp, char *name, void *data, size_t size, int xflags)
-{
-       attrnames_t     *namesp;
-       int             error;
-
-       if (xflags & ATTR_CREATE)
-               return -EINVAL;
-
-       namesp = attr_lookup_namespace(name, attr_system_names, ATTR_SYSCOUNT);
-       if (!namesp)
-               return -EOPNOTSUPP;
-       error = namesp->attr_set(vp, name, data, size, xflags);
-       if (!error)
-               error = vn_revalidate(vp);
-       return error;
-}
-
-STATIC int
-attr_system_get(
-       bhv_vnode_t *vp, char *name, void *data, size_t size, int xflags)
-{
-       attrnames_t     *namesp;
-
-       namesp = attr_lookup_namespace(name, attr_system_names, ATTR_SYSCOUNT);
-       if (!namesp)
-               return -EOPNOTSUPP;
-       return namesp->attr_get(vp, name, data, size, xflags);
-}
-
-STATIC int
-attr_system_remove(
-       bhv_vnode_t *vp, char *name, int xflags)
-{
-       attrnames_t     *namesp;
-
-       namesp = attr_lookup_namespace(name, attr_system_names, ATTR_SYSCOUNT);
-       if (!namesp)
-               return -EOPNOTSUPP;
-       return namesp->attr_remove(vp, name, xflags);
-}
-
-struct attrnames attr_system = {
-       .attr_name      = "system.",
-       .attr_namelen   = sizeof("system.") - 1,
-       .attr_flag      = ATTR_SYSTEM,
-       .attr_get       = attr_system_get,
-       .attr_set       = attr_system_set,
-       .attr_remove    = attr_system_remove,
-       .attr_capable   = (attrcapable_t)fs_noerr,
-};
-
-struct attrnames attr_trusted = {
-       .attr_name      = "trusted.",
-       .attr_namelen   = sizeof("trusted.") - 1,
-       .attr_flag      = ATTR_ROOT,
-       .attr_get       = attr_generic_get,
-       .attr_set       = attr_generic_set,
-       .attr_remove    = attr_generic_remove,
-       .attr_capable   = attr_trusted_capable,
-};
-
-struct attrnames attr_secure = {
-       .attr_name      = "security.",
-       .attr_namelen   = sizeof("security.") - 1,
-       .attr_flag      = ATTR_SECURE,
-       .attr_get       = attr_generic_get,
-       .attr_set       = attr_generic_set,
-       .attr_remove    = attr_generic_remove,
-       .attr_capable   = (attrcapable_t)fs_noerr,
-};
-
-struct attrnames attr_user = {
-       .attr_name      = "user.",
-       .attr_namelen   = sizeof("user.") - 1,
-       .attr_get       = attr_generic_get,
-       .attr_set       = attr_generic_set,
-       .attr_remove    = attr_generic_remove,
-       .attr_capable   = attr_user_capable,
-};
-
-struct attrnames *attr_namespaces[] =
-       { &attr_system, &attr_trusted, &attr_secure, &attr_user };
index 6cfc938..8b2d31c 100644 (file)
 #ifndef __XFS_ATTR_H__
 #define        __XFS_ATTR_H__
 
+struct xfs_inode;
+struct xfs_da_args;
+struct xfs_attr_list_context;
+
 /*
- * xfs_attr.h
- *
  * Large attribute lists are structured around Btrees where all the data
  * elements are in the leaf nodes.  Attribute names are hashed into an int,
  * then that int is used as the index into the Btree.  Since the hashval
  * External interfaces
  *========================================================================*/
 
-struct cred;
-struct xfs_attr_list_context;
-
-typedef int (*attrset_t)(bhv_vnode_t *, char *, void *, size_t, int);
-typedef int (*attrget_t)(bhv_vnode_t *, char *, void *, size_t, int);
-typedef int (*attrremove_t)(bhv_vnode_t *, char *, int);
-typedef int (*attrexists_t)(bhv_vnode_t *);
-typedef int (*attrcapable_t)(bhv_vnode_t *, struct cred *);
-
-typedef struct attrnames {
-       char *          attr_name;
-       unsigned int    attr_namelen;
-       unsigned int    attr_flag;
-       attrget_t       attr_get;
-       attrset_t       attr_set;
-       attrremove_t    attr_remove;
-       attrexists_t    attr_exists;
-       attrcapable_t   attr_capable;
-} attrnames_t;
-
-#define ATTR_NAMECOUNT 4
-extern struct attrnames attr_user;
-extern struct attrnames attr_secure;
-extern struct attrnames attr_system;
-extern struct attrnames attr_trusted;
-extern struct attrnames *attr_namespaces[ATTR_NAMECOUNT];
-
-extern attrnames_t *attr_lookup_namespace(char *, attrnames_t **, int);
-extern int attr_generic_list(bhv_vnode_t *, void *, size_t, int, ssize_t *);
 
 #define ATTR_DONTFOLLOW        0x0001  /* -- unused, from IRIX -- */
 #define ATTR_ROOT      0x0002  /* use attrs in root (trusted) namespace */
@@ -71,16 +44,9 @@ extern int attr_generic_list(bhv_vnode_t *, void *, size_t, int, ssize_t *);
 #define ATTR_SECURE    0x0008  /* use attrs in security namespace */
 #define ATTR_CREATE    0x0010  /* pure create: fail if attr already exists */
 #define ATTR_REPLACE   0x0020  /* pure set: fail if attr does not exist */
-#define ATTR_SYSTEM    0x0100  /* use attrs in system (pseudo) namespace */
 
-#define ATTR_KERNACCESS        0x0400  /* [kernel] iaccess, inode held io-locked */
 #define ATTR_KERNOTIME 0x1000  /* [kernel] don't update inode timestamps */
 #define ATTR_KERNOVAL  0x2000  /* [kernel] get attr size only, not value */
-#define ATTR_KERNAMELS 0x4000  /* [kernel] list attr names (simple list) */
-
-#define ATTR_KERNORMALS        0x0800  /* [kernel] normal attr list: user+secure */
-#define ATTR_KERNROOTLS        0x8000  /* [kernel] include root in the attr list */
-#define ATTR_KERNFULLS (ATTR_KERNORMALS|ATTR_KERNROOTLS)
 
 /*
  * The maximum size (into the kernel or returned from the kernel) of an
@@ -118,22 +84,6 @@ typedef struct attrlist_ent {       /* data from attr_list() */
        ((attrlist_ent_t *)                     \
         &((char *)buffer)[ ((attrlist_t *)(buffer))->al_offset[index] ])
 
-/*
- * Multi-attribute operation vector.
- */
-typedef struct attr_multiop {
-       int     am_opcode;      /* operation to perform (ATTR_OP_GET, etc.) */
-       int     am_error;       /* [out arg] result of this sub-op (an errno) */
-       char    *am_attrname;   /* attribute name to work with */
-       char    *am_attrvalue;  /* [in/out arg] attribute value (raw bytes) */
-       int     am_length;      /* [in/out arg] length of value */
-       int     am_flags;       /* bitwise OR of attr API flags defined above */
-} attr_multiop_t;
-
-#define ATTR_OP_GET    1       /* return the indicated attr's value */
-#define ATTR_OP_SET    2       /* set/create the indicated attr/value pair */
-#define ATTR_OP_REMOVE 3       /* remove the indicated attr */
-
 /*
  * Kernel-internal version of the attrlist cursor.
  */
@@ -148,20 +98,40 @@ typedef struct attrlist_cursor_kern {
 
 
 /*========================================================================
- * Function prototypes for the kernel.
+ * Structure used to pass context around among the routines.
  *========================================================================*/
 
-struct xfs_inode;
-struct attrlist_cursor_kern;
-struct xfs_da_args;
+
+typedef int (*put_listent_func_t)(struct xfs_attr_list_context *, int,
+                                     char *, int, int, char *);
+
+typedef struct xfs_attr_list_context {
+       struct xfs_inode                *dp;            /* inode */
+       struct attrlist_cursor_kern     *cursor;        /* position in list */
+       char                            *alist;         /* output buffer */
+       int                             seen_enough;    /* T/F: seen enough of list? */
+       ssize_t                         count;          /* num used entries */
+       int                             dupcnt;         /* count dup hashvals seen */
+       int                             bufsize;        /* total buffer size */
+       int                             firstu;         /* first used byte in buffer */
+       int                             flags;          /* from VOP call */
+       int                             resynch;        /* T/F: resynch with cursor */
+       int                             put_value;      /* T/F: need value for listent */
+       put_listent_func_t              put_listent;    /* list output fmt function */
+       int                             index;          /* index into output buffer */
+} xfs_attr_list_context_t;
+
+
+/*========================================================================
+ * Function prototypes for the kernel.
+ *========================================================================*/
 
 /*
  * Overall external interface routines.
  */
 int xfs_attr_inactive(struct xfs_inode *dp);
-
-int xfs_attr_shortform_getvalue(struct xfs_da_args *);
 int xfs_attr_fetch(struct xfs_inode *, struct xfs_name *, char *, int *, int);
 int xfs_attr_rmtval_get(struct xfs_da_args *args);
+int xfs_attr_list_int(struct xfs_attr_list_context *);
 
 #endif /* __XFS_ATTR_H__ */
index 303d41e..23ef5d7 100644 (file)
@@ -94,13 +94,6 @@ STATIC int xfs_attr_leaf_entsize(xfs_attr_leafblock_t *leaf, int index);
  * Namespace helper routines
  *========================================================================*/
 
-STATIC_INLINE attrnames_t *
-xfs_attr_flags_namesp(int flags)
-{
-       return ((flags & XFS_ATTR_SECURE) ? &attr_secure:
-                 ((flags & XFS_ATTR_ROOT) ? &attr_trusted : &attr_user));
-}
-
 /*
  * If namespace bits don't match return 0.
  * If all match then return 1.
@@ -111,25 +104,6 @@ xfs_attr_namesp_match(int arg_flags, int ondisk_flags)
        return XFS_ATTR_NSP_ONDISK(ondisk_flags) == XFS_ATTR_NSP_ARGS_TO_ONDISK(arg_flags);
 }
 
-/*
- * If namespace bits don't match and we don't have an override for it
- * then return 0.
- * If all match or are overridable then return 1.
- */
-STATIC_INLINE int
-xfs_attr_namesp_match_overrides(int arg_flags, int ondisk_flags)
-{
-       if (((arg_flags & ATTR_SECURE) == 0) !=
-           ((ondisk_flags & XFS_ATTR_SECURE) == 0) &&
-           !(arg_flags & ATTR_KERNORMALS))
-               return 0;
-       if (((arg_flags & ATTR_ROOT) == 0) !=
-           ((ondisk_flags & XFS_ATTR_ROOT) == 0) &&
-           !(arg_flags & ATTR_KERNROOTLS))
-               return 0;
-       return 1;
-}
-
 
 /*========================================================================
  * External routines when attribute fork size < XFS_LITINO(mp).
@@ -369,9 +343,10 @@ xfs_attr_shortform_remove(xfs_da_args_t *args)
         * Fix up the start offset of the attribute fork
         */
        totsize -= size;
-       if (totsize == sizeof(xfs_attr_sf_hdr_t) && !args->addname &&
-           (mp->m_flags & XFS_MOUNT_ATTR2) && 
-           (dp->i_d.di_format != XFS_DINODE_FMT_BTREE)) {
+       if (totsize == sizeof(xfs_attr_sf_hdr_t) &&
+                               !(args->op_flags & XFS_DA_OP_ADDNAME) &&
+                               (mp->m_flags & XFS_MOUNT_ATTR2) &&
+                               (dp->i_d.di_format != XFS_DINODE_FMT_BTREE)) {
                /*
                 * Last attribute now removed, revert to original
                 * inode format making all literal area available
@@ -389,9 +364,10 @@ xfs_attr_shortform_remove(xfs_da_args_t *args)
                xfs_idata_realloc(dp, -size, XFS_ATTR_FORK);
                dp->i_d.di_forkoff = xfs_attr_shortform_bytesfit(dp, totsize);
                ASSERT(dp->i_d.di_forkoff);
-               ASSERT(totsize > sizeof(xfs_attr_sf_hdr_t) || args->addname ||
-                       !(mp->m_flags & XFS_MOUNT_ATTR2) ||
-                       dp->i_d.di_format == XFS_DINODE_FMT_BTREE);
+               ASSERT(totsize > sizeof(xfs_attr_sf_hdr_t) ||
+                               (args->op_flags & XFS_DA_OP_ADDNAME) ||
+                               !(mp->m_flags & XFS_MOUNT_ATTR2) ||
+                               dp->i_d.di_format == XFS_DINODE_FMT_BTREE);
                dp->i_afp->if_ext_max =
                        XFS_IFORK_ASIZE(dp) / (uint)sizeof(xfs_bmbt_rec_t);
                dp->i_df.if_ext_max =
@@ -531,7 +507,7 @@ xfs_attr_shortform_to_leaf(xfs_da_args_t *args)
        nargs.total = args->total;
        nargs.whichfork = XFS_ATTR_FORK;
        nargs.trans = args->trans;
-       nargs.oknoent = 1;
+       nargs.op_flags = XFS_DA_OP_OKNOENT;
 
        sfe = &sf->list[0];
        for (i = 0; i < sf->hdr.count; i++) {
@@ -555,7 +531,7 @@ xfs_attr_shortform_to_leaf(xfs_da_args_t *args)
 out:
        if(bp)
                xfs_da_buf_done(bp);
-       kmem_free(tmpbuffer, size);
+       kmem_free(tmpbuffer);
        return(error);
 }
 
@@ -624,15 +600,8 @@ xfs_attr_shortform_list(xfs_attr_list_context_t *context)
            (XFS_ISRESET_CURSOR(cursor) &&
              (dp->i_afp->if_bytes + sf->hdr.count * 16) < context->bufsize)) {
                for (i = 0, sfe = &sf->list[0]; i < sf->hdr.count; i++) {
-                       attrnames_t     *namesp;
-
-                       if (!xfs_attr_namesp_match_overrides(context->flags, sfe->flags)) {
-                               sfe = XFS_ATTR_SF_NEXTENTRY(sfe);
-                               continue;
-                       }
-                       namesp = xfs_attr_flags_namesp(sfe->flags);
                        error = context->put_listent(context,
-                                          namesp,
+                                          sfe->flags,
                                           (char *)sfe->nameval,
                                           (int)sfe->namelen,
                                           (int)sfe->valuelen,
@@ -676,13 +645,10 @@ xfs_attr_shortform_list(xfs_attr_list_context_t *context)
                                             XFS_ERRLEVEL_LOW,
                                             context->dp->i_mount, sfe);
                        xfs_attr_trace_l_c("sf corrupted", context);
-                       kmem_free(sbuf, sbsize);
+                       kmem_free(sbuf);
                        return XFS_ERROR(EFSCORRUPTED);
                }
-               if (!xfs_attr_namesp_match_overrides(context->flags, sfe->flags)) {
-                       sfe = XFS_ATTR_SF_NEXTENTRY(sfe);
-                       continue;
-               }
+
                sbp->entno = i;
                sbp->hash = xfs_da_hashname((char *)sfe->nameval, sfe->namelen);
                sbp->name = (char *)sfe->nameval;
@@ -717,7 +683,7 @@ xfs_attr_shortform_list(xfs_attr_list_context_t *context)
                }
        }
        if (i == nsbuf) {
-               kmem_free(sbuf, sbsize);
+               kmem_free(sbuf);
                xfs_attr_trace_l_c("blk end", context);
                return(0);
        }
@@ -726,16 +692,12 @@ xfs_attr_shortform_list(xfs_attr_list_context_t *context)
         * Loop putting entries into the user buffer.
         */
        for ( ; i < nsbuf; i++, sbp++) {
-               attrnames_t     *namesp;
-
-               namesp = xfs_attr_flags_namesp(sbp->flags);
-
                if (cursor->hashval != sbp->hash) {
                        cursor->hashval = sbp->hash;
                        cursor->offset = 0;
                }
                error = context->put_listent(context,
-                                       namesp,
+                                       sbp->flags,
                                        sbp->name,
                                        sbp->namelen,
                                        sbp->valuelen,
@@ -747,7 +709,7 @@ xfs_attr_shortform_list(xfs_attr_list_context_t *context)
                cursor->offset++;
        }
 
-       kmem_free(sbuf, sbsize);
+       kmem_free(sbuf);
        xfs_attr_trace_l_c("sf E-O-F", context);
        return(0);
 }
@@ -853,7 +815,7 @@ xfs_attr_leaf_to_shortform(xfs_dabuf_t *bp, xfs_da_args_t *args, int forkoff)
        nargs.total = args->total;
        nargs.whichfork = XFS_ATTR_FORK;
        nargs.trans = args->trans;
-       nargs.oknoent = 1;
+       nargs.op_flags = XFS_DA_OP_OKNOENT;
        entry = &leaf->entries[0];
        for (i = 0; i < be16_to_cpu(leaf->hdr.count); entry++, i++) {
                if (entry->flags & XFS_ATTR_INCOMPLETE)
@@ -873,7 +835,7 @@ xfs_attr_leaf_to_shortform(xfs_dabuf_t *bp, xfs_da_args_t *args, int forkoff)
        error = 0;
 
 out:
-       kmem_free(tmpbuffer, XFS_LBSIZE(dp->i_mount));
+       kmem_free(tmpbuffer);
        return(error);
 }
 
@@ -1155,7 +1117,7 @@ xfs_attr_leaf_add_work(xfs_dabuf_t *bp, xfs_da_args_t *args, int mapindex)
        entry->hashval = cpu_to_be32(args->hashval);
        entry->flags = tmp ? XFS_ATTR_LOCAL : 0;
        entry->flags |= XFS_ATTR_NSP_ARGS_TO_ONDISK(args->flags);
-       if (args->rename) {
+       if (args->op_flags & XFS_DA_OP_RENAME) {
                entry->flags |= XFS_ATTR_INCOMPLETE;
                if ((args->blkno2 == args->blkno) &&
                    (args->index2 <= args->index)) {
@@ -1271,7 +1233,7 @@ xfs_attr_leaf_compact(xfs_trans_t *trans, xfs_dabuf_t *bp)
                                be16_to_cpu(hdr_s->count), mp);
        xfs_da_log_buf(trans, bp, 0, XFS_LBSIZE(mp) - 1);
 
-       kmem_free(tmpbuffer, XFS_LBSIZE(mp));
+       kmem_free(tmpbuffer);
 }
 
 /*
@@ -1921,7 +1883,7 @@ xfs_attr_leaf_unbalance(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk,
                                be16_to_cpu(drop_hdr->count), mp);
                }
                memcpy((char *)save_leaf, (char *)tmp_leaf, state->blocksize);
-               kmem_free(tmpbuffer, state->blocksize);
+               kmem_free(tmpbuffer);
        }
 
        xfs_da_log_buf(state->args->trans, save_blk->bp, 0,
@@ -2400,8 +2362,6 @@ xfs_attr_leaf_list_int(xfs_dabuf_t *bp, xfs_attr_list_context_t *context)
         */
        retval = 0;
        for (  ; (i < be16_to_cpu(leaf->hdr.count)); entry++, i++) {
-               attrnames_t *namesp;
-
                if (be32_to_cpu(entry->hashval) != cursor->hashval) {
                        cursor->hashval = be32_to_cpu(entry->hashval);
                        cursor->offset = 0;
@@ -2409,17 +2369,13 @@ xfs_attr_leaf_list_int(xfs_dabuf_t *bp, xfs_attr_list_context_t *context)
 
                if (entry->flags & XFS_ATTR_INCOMPLETE)
                        continue;               /* skip incomplete entries */
-               if (!xfs_attr_namesp_match_overrides(context->flags, entry->flags))
-                       continue;
-
-               namesp = xfs_attr_flags_namesp(entry->flags);
 
                if (entry->flags & XFS_ATTR_LOCAL) {
                        xfs_attr_leaf_name_local_t *name_loc =
                                XFS_ATTR_LEAF_NAME_LOCAL(leaf, i);
 
                        retval = context->put_listent(context,
-                                               namesp,
+                                               entry->flags,
                                                (char *)name_loc->nameval,
                                                (int)name_loc->namelen,
                                                be16_to_cpu(name_loc->valuelen),
@@ -2446,16 +2402,15 @@ xfs_attr_leaf_list_int(xfs_dabuf_t *bp, xfs_attr_list_context_t *context)
                                if (retval)
                                        return retval;
                                retval = context->put_listent(context,
-                                               namesp,
+                                               entry->flags,
                                                (char *)name_rmt->name,
                                                (int)name_rmt->namelen,
                                                valuelen,
                                                (char*)args.value);
-                               kmem_free(args.value, valuelen);
-                       }
-                       else {
+                               kmem_free(args.value);
+                       } else {
                                retval = context->put_listent(context,
-                                               namesp,
+                                               entry->flags,
                                                (char *)name_rmt->name,
                                                (int)name_rmt->namelen,
                                                valuelen,
@@ -2954,7 +2909,7 @@ xfs_attr_leaf_inactive(xfs_trans_t **trans, xfs_inode_t *dp, xfs_dabuf_t *bp)
                        error = tmp;    /* save only the 1st errno */
        }
 
-       kmem_free((xfs_caddr_t)list, size);
+       kmem_free((xfs_caddr_t)list);
        return(error);
 }
 
index 040f732..5ecf437 100644 (file)
@@ -30,7 +30,7 @@
 
 struct attrlist;
 struct attrlist_cursor_kern;
-struct attrnames;
+struct xfs_attr_list_context;
 struct xfs_dabuf;
 struct xfs_da_args;
 struct xfs_da_state;
@@ -204,33 +204,6 @@ static inline int xfs_attr_leaf_entsize_local_max(int bsize)
        return (((bsize) >> 1) + ((bsize) >> 2));
 }
 
-
-/*========================================================================
- * Structure used to pass context around among the routines.
- *========================================================================*/
-
-
-struct xfs_attr_list_context;
-
-typedef int (*put_listent_func_t)(struct xfs_attr_list_context *, struct attrnames *,
-                                     char *, int, int, char *);
-
-typedef struct xfs_attr_list_context {
-       struct xfs_inode                *dp;            /* inode */
-       struct attrlist_cursor_kern     *cursor;        /* position in list */
-       struct attrlist                 *alist;         /* output buffer */
-       int                             seen_enough;    /* T/F: seen enough of list? */
-       int                             count;          /* num used entries */
-       int                             dupcnt;         /* count dup hashvals seen */
-       int                             bufsize;        /* total buffer size */
-       int                             firstu;         /* first used byte in buffer */
-       int                             flags;          /* from VOP call */
-       int                             resynch;        /* T/F: resynch with cursor */
-       int                             put_value;      /* T/F: need value for listent */
-       put_listent_func_t              put_listent;    /* list output fmt function */
-       int                             index;          /* index into output buffer */
-} xfs_attr_list_context_t;
-
 /*
  * Used to keep a list of "remote value" extents when unlinking an inode.
  */
index f67f917..ea22839 100644 (file)
@@ -97,13 +97,9 @@ void xfs_attr_trace_l_cb(char *where, struct xfs_attr_list_context *context,
 void xfs_attr_trace_l_cl(char *where, struct xfs_attr_list_context *context,
                              struct xfs_attr_leafblock *leaf);
 void xfs_attr_trace_enter(int type, char *where,
-                            __psunsigned_t a2, __psunsigned_t a3,
-                            __psunsigned_t a4, __psunsigned_t a5,
-                            __psunsigned_t a6, __psunsigned_t a7,
-                            __psunsigned_t a8, __psunsigned_t a9,
-                            __psunsigned_t a10, __psunsigned_t a11,
-                            __psunsigned_t a12, __psunsigned_t a13,
-                            __psunsigned_t a14, __psunsigned_t a15);
+                            struct xfs_attr_list_context *context,
+                            __psunsigned_t a13, __psunsigned_t a14,
+                            __psunsigned_t a15);
 #else
 #define        xfs_attr_trace_l_c(w,c)
 #define        xfs_attr_trace_l_cn(w,c,n)
index 53c259f..3c4beb3 100644 (file)
@@ -428,7 +428,8 @@ xfs_bmap_add_attrfork_btree(
                cur->bc_private.b.firstblock = *firstblock;
                if ((error = xfs_bmbt_lookup_ge(cur, 0, 0, 0, &stat)))
                        goto error0;
-               ASSERT(stat == 1);      /* must be at least one entry */
+               /* must be at least one entry */
+               XFS_WANT_CORRUPTED_GOTO(stat == 1, error0);
                if ((error = xfs_bmbt_newroot(cur, flags, &stat)))
                        goto error0;
                if (stat == 0) {
@@ -816,13 +817,13 @@ xfs_bmap_add_extent_delay_real(
                                        RIGHT.br_startblock,
                                        RIGHT.br_blockcount, &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                        if ((error = xfs_bmbt_delete(cur, &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                        if ((error = xfs_bmbt_decrement(cur, 0, &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                        if ((error = xfs_bmbt_update(cur, LEFT.br_startoff,
                                        LEFT.br_startblock,
                                        LEFT.br_blockcount +
@@ -860,7 +861,7 @@ xfs_bmap_add_extent_delay_real(
                                        LEFT.br_startblock, LEFT.br_blockcount,
                                        &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                        if ((error = xfs_bmbt_update(cur, LEFT.br_startoff,
                                        LEFT.br_startblock,
                                        LEFT.br_blockcount +
@@ -895,7 +896,7 @@ xfs_bmap_add_extent_delay_real(
                                        RIGHT.br_startblock,
                                        RIGHT.br_blockcount, &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                        if ((error = xfs_bmbt_update(cur, PREV.br_startoff,
                                        new->br_startblock,
                                        PREV.br_blockcount +
@@ -928,11 +929,11 @@ xfs_bmap_add_extent_delay_real(
                                        new->br_startblock, new->br_blockcount,
                                        &i)))
                                goto done;
-                       ASSERT(i == 0);
+                       XFS_WANT_CORRUPTED_GOTO(i == 0, done);
                        cur->bc_rec.b.br_state = XFS_EXT_NORM;
                        if ((error = xfs_bmbt_insert(cur, &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                }
                *dnew = 0;
                /* DELTA: The in-core extent described by new changed type. */
@@ -963,7 +964,7 @@ xfs_bmap_add_extent_delay_real(
                                        LEFT.br_startblock, LEFT.br_blockcount,
                                        &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                        if ((error = xfs_bmbt_update(cur, LEFT.br_startoff,
                                        LEFT.br_startblock,
                                        LEFT.br_blockcount +
@@ -1004,11 +1005,11 @@ xfs_bmap_add_extent_delay_real(
                                        new->br_startblock, new->br_blockcount,
                                        &i)))
                                goto done;
-                       ASSERT(i == 0);
+                       XFS_WANT_CORRUPTED_GOTO(i == 0, done);
                        cur->bc_rec.b.br_state = XFS_EXT_NORM;
                        if ((error = xfs_bmbt_insert(cur, &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                }
                if (ip->i_d.di_format == XFS_DINODE_FMT_EXTENTS &&
                    ip->i_d.di_nextents > ip->i_df.if_ext_max) {
@@ -1054,7 +1055,7 @@ xfs_bmap_add_extent_delay_real(
                                        RIGHT.br_startblock,
                                        RIGHT.br_blockcount, &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                        if ((error = xfs_bmbt_update(cur, new->br_startoff,
                                        new->br_startblock,
                                        new->br_blockcount +
@@ -1094,11 +1095,11 @@ xfs_bmap_add_extent_delay_real(
                                        new->br_startblock, new->br_blockcount,
                                        &i)))
                                goto done;
-                       ASSERT(i == 0);
+                       XFS_WANT_CORRUPTED_GOTO(i == 0, done);
                        cur->bc_rec.b.br_state = XFS_EXT_NORM;
                        if ((error = xfs_bmbt_insert(cur, &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                }
                if (ip->i_d.di_format == XFS_DINODE_FMT_EXTENTS &&
                    ip->i_d.di_nextents > ip->i_df.if_ext_max) {
@@ -1149,11 +1150,11 @@ xfs_bmap_add_extent_delay_real(
                                        new->br_startblock, new->br_blockcount,
                                        &i)))
                                goto done;
-                       ASSERT(i == 0);
+                       XFS_WANT_CORRUPTED_GOTO(i == 0, done);
                        cur->bc_rec.b.br_state = XFS_EXT_NORM;
                        if ((error = xfs_bmbt_insert(cur, &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                }
                if (ip->i_d.di_format == XFS_DINODE_FMT_EXTENTS &&
                    ip->i_d.di_nextents > ip->i_df.if_ext_max) {
@@ -1377,19 +1378,19 @@ xfs_bmap_add_extent_unwritten_real(
                                        RIGHT.br_startblock,
                                        RIGHT.br_blockcount, &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                        if ((error = xfs_bmbt_delete(cur, &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                        if ((error = xfs_bmbt_decrement(cur, 0, &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                        if ((error = xfs_bmbt_delete(cur, &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                        if ((error = xfs_bmbt_decrement(cur, 0, &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                        if ((error = xfs_bmbt_update(cur, LEFT.br_startoff,
                                LEFT.br_startblock,
                                LEFT.br_blockcount + PREV.br_blockcount +
@@ -1426,13 +1427,13 @@ xfs_bmap_add_extent_unwritten_real(
                                        PREV.br_startblock, PREV.br_blockcount,
                                        &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                        if ((error = xfs_bmbt_delete(cur, &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                        if ((error = xfs_bmbt_decrement(cur, 0, &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                        if ((error = xfs_bmbt_update(cur, LEFT.br_startoff,
                                LEFT.br_startblock,
                                LEFT.br_blockcount + PREV.br_blockcount,
@@ -1469,13 +1470,13 @@ xfs_bmap_add_extent_unwritten_real(
                                        RIGHT.br_startblock,
                                        RIGHT.br_blockcount, &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                        if ((error = xfs_bmbt_delete(cur, &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                        if ((error = xfs_bmbt_decrement(cur, 0, &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                        if ((error = xfs_bmbt_update(cur, new->br_startoff,
                                new->br_startblock,
                                new->br_blockcount + RIGHT.br_blockcount,
@@ -1508,7 +1509,7 @@ xfs_bmap_add_extent_unwritten_real(
                                        new->br_startblock, new->br_blockcount,
                                        &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                        if ((error = xfs_bmbt_update(cur, new->br_startoff,
                                new->br_startblock, new->br_blockcount,
                                newext)))
@@ -1549,7 +1550,7 @@ xfs_bmap_add_extent_unwritten_real(
                                        PREV.br_startblock, PREV.br_blockcount,
                                        &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                        if ((error = xfs_bmbt_update(cur,
                                PREV.br_startoff + new->br_blockcount,
                                PREV.br_startblock + new->br_blockcount,
@@ -1596,7 +1597,7 @@ xfs_bmap_add_extent_unwritten_real(
                                        PREV.br_startblock, PREV.br_blockcount,
                                        &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                        if ((error = xfs_bmbt_update(cur,
                                PREV.br_startoff + new->br_blockcount,
                                PREV.br_startblock + new->br_blockcount,
@@ -1606,7 +1607,7 @@ xfs_bmap_add_extent_unwritten_real(
                        cur->bc_rec.b = *new;
                        if ((error = xfs_bmbt_insert(cur, &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                }
                /* DELTA: One in-core extent is split in two. */
                temp = PREV.br_startoff;
@@ -1640,7 +1641,7 @@ xfs_bmap_add_extent_unwritten_real(
                                        PREV.br_startblock,
                                        PREV.br_blockcount, &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                        if ((error = xfs_bmbt_update(cur, PREV.br_startoff,
                                PREV.br_startblock,
                                PREV.br_blockcount - new->br_blockcount,
@@ -1682,7 +1683,7 @@ xfs_bmap_add_extent_unwritten_real(
                                        PREV.br_startblock, PREV.br_blockcount,
                                        &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                        if ((error = xfs_bmbt_update(cur, PREV.br_startoff,
                                PREV.br_startblock,
                                PREV.br_blockcount - new->br_blockcount,
@@ -1692,11 +1693,11 @@ xfs_bmap_add_extent_unwritten_real(
                                        new->br_startblock, new->br_blockcount,
                                        &i)))
                                goto done;
-                       ASSERT(i == 0);
+                       XFS_WANT_CORRUPTED_GOTO(i == 0, done);
                        cur->bc_rec.b.br_state = XFS_EXT_NORM;
                        if ((error = xfs_bmbt_insert(cur, &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                }
                /* DELTA: One in-core extent is split in two. */
                temp = PREV.br_startoff;
@@ -1732,27 +1733,34 @@ xfs_bmap_add_extent_unwritten_real(
                                        PREV.br_startblock, PREV.br_blockcount,
                                        &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                        /* new right extent - oldext */
                        if ((error = xfs_bmbt_update(cur, r[1].br_startoff,
                                r[1].br_startblock, r[1].br_blockcount,
                                r[1].br_state)))
                                goto done;
                        /* new left extent - oldext */
-                       PREV.br_blockcount =
-                               new->br_startoff - PREV.br_startoff;
                        cur->bc_rec.b = PREV;
+                       cur->bc_rec.b.br_blockcount =
+                               new->br_startoff - PREV.br_startoff;
                        if ((error = xfs_bmbt_insert(cur, &i)))
                                goto done;
-                       ASSERT(i == 1);
-                       if ((error = xfs_bmbt_increment(cur, 0, &i)))
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
+                       /*
+                        * Reset the cursor to the position of the new extent
+                        * we are about to insert as we can't trust it after
+                        * the previous insert.
+                        */
+                       if ((error = xfs_bmbt_lookup_eq(cur, new->br_startoff,
+                                       new->br_startblock, new->br_blockcount,
+                                       &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 0, done);
                        /* new middle extent - newext */
-                       cur->bc_rec.b = *new;
+                       cur->bc_rec.b.br_state = new->br_state;
                        if ((error = xfs_bmbt_insert(cur, &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                }
                /* DELTA: One in-core extent is split in three. */
                temp = PREV.br_startoff;
@@ -2097,13 +2105,13 @@ xfs_bmap_add_extent_hole_real(
                                        right.br_startblock,
                                        right.br_blockcount, &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                        if ((error = xfs_bmbt_delete(cur, &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                        if ((error = xfs_bmbt_decrement(cur, 0, &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                        if ((error = xfs_bmbt_update(cur, left.br_startoff,
                                        left.br_startblock,
                                        left.br_blockcount +
@@ -2139,7 +2147,7 @@ xfs_bmap_add_extent_hole_real(
                                        left.br_startblock,
                                        left.br_blockcount, &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                        if ((error = xfs_bmbt_update(cur, left.br_startoff,
                                        left.br_startblock,
                                        left.br_blockcount +
@@ -2174,7 +2182,7 @@ xfs_bmap_add_extent_hole_real(
                                        right.br_startblock,
                                        right.br_blockcount, &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                        if ((error = xfs_bmbt_update(cur, new->br_startoff,
                                        new->br_startblock,
                                        new->br_blockcount +
@@ -2208,11 +2216,11 @@ xfs_bmap_add_extent_hole_real(
                                        new->br_startblock,
                                        new->br_blockcount, &i)))
                                goto done;
-                       ASSERT(i == 0);
+                       XFS_WANT_CORRUPTED_GOTO(i == 0, done);
                        cur->bc_rec.b.br_state = new->br_state;
                        if ((error = xfs_bmbt_insert(cur, &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                }
                /* DELTA: A new extent was added in a hole. */
                temp = new->br_startoff;
@@ -3131,7 +3139,7 @@ xfs_bmap_del_extent(
                                        got.br_startblock, got.br_blockcount,
                                        &i)))
                                goto done;
-                       ASSERT(i == 1);
+                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                }
                da_old = da_new = 0;
        } else {
@@ -3164,7 +3172,7 @@ xfs_bmap_del_extent(
                }
                if ((error = xfs_bmbt_delete(cur, &i)))
                        goto done;
-               ASSERT(i == 1);
+               XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                break;
 
        case 2:
@@ -3268,7 +3276,7 @@ xfs_bmap_del_extent(
                                                        got.br_startblock,
                                                        temp, &i)))
                                                goto done;
-                                       ASSERT(i == 1);
+                                       XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                                        /*
                                         * Update the btree record back
                                         * to the original value.
@@ -3289,7 +3297,7 @@ xfs_bmap_del_extent(
                                        error = XFS_ERROR(ENOSPC);
                                        goto done;
                                }
-                               ASSERT(i == 1);
+                               XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                        } else
                                flags |= XFS_ILOG_FEXT(whichfork);
                        XFS_IFORK_NEXT_SET(ip, whichfork,
@@ -5970,7 +5978,7 @@ unlock_and_return:
        xfs_iunlock_map_shared(ip, lock);
        xfs_iunlock(ip, XFS_IOLOCK_SHARED);
 
-       kmem_free(map, subnex * sizeof(*map));
+       kmem_free(map);
 
        return error;
 }
index 6ff70cd..9f3e3a8 100644 (file)
@@ -54,12 +54,23 @@ typedef struct xfs_bmap_free_item
 
 /*
  * Header for free extent list.
+ *
+ * xbf_low is used by the allocator to activate the lowspace algorithm -
+ * when free space is running low the extent allocator may choose to
+ * allocate an extent from an AG without leaving sufficient space for
+ * a btree split when inserting the new extent.  In this case the allocator
+ * will enable the lowspace algorithm which is supposed to allow further
+ * allocations (such as btree splits and newroots) to allocate from
+ * sequential AGs.  In order to avoid locking AGs out of order the lowspace
+ * algorithm will start searching for free space from AG 0.  If the correct
+ * transaction reservations have been made then this algorithm will eventually
+ * find all the space it needs.
  */
 typedef        struct xfs_bmap_free
 {
        xfs_bmap_free_item_t    *xbf_first;     /* list of to-be-free extents */
        int                     xbf_count;      /* count of items on list */
-       int                     xbf_low;        /* kludge: alloc in low mode */
+       int                     xbf_low;        /* alloc in low mode */
 } xfs_bmap_free_t;
 
 #define        XFS_BMAP_MAX_NMAP       4
index 4f0e849..23efad2 100644 (file)
@@ -1493,12 +1493,27 @@ xfs_bmbt_split(
        left = XFS_BUF_TO_BMBT_BLOCK(lbp);
        args.fsbno = cur->bc_private.b.firstblock;
        args.firstblock = args.fsbno;
+       args.minleft = 0;
        if (args.fsbno == NULLFSBLOCK) {
                args.fsbno = lbno;
                args.type = XFS_ALLOCTYPE_START_BNO;
-       } else
+               /*
+                * Make sure there is sufficient room left in the AG to
+                * complete a full tree split for an extent insert.  If
+                * we are converting the middle part of an extent then
+                * we may need space for two tree splits.
+                *
+                * We are relying on the caller to make the correct block
+                * reservation for this operation to succeed.  If the
+                * reservation amount is insufficient then we may fail a
+                * block allocation here and corrupt the filesystem.
+                */
+               args.minleft = xfs_trans_get_block_res(args.tp);
+       } else if (cur->bc_private.b.flist->xbf_low)
+               args.type = XFS_ALLOCTYPE_START_BNO;
+       else
                args.type = XFS_ALLOCTYPE_NEAR_BNO;
-       args.mod = args.minleft = args.alignment = args.total = args.isfl =
+       args.mod = args.alignment = args.total = args.isfl =
                args.userdata = args.minalignslop = 0;
        args.minlen = args.maxlen = args.prod = 1;
        args.wasdel = cur->bc_private.b.flags & XFS_BTCUR_BPRV_WASDEL;
@@ -1510,6 +1525,21 @@ xfs_bmbt_split(
                XFS_BMBT_TRACE_CURSOR(cur, ERROR);
                return error;
        }
+       if (args.fsbno == NULLFSBLOCK && args.minleft) {
+               /*
+                * Could not find an AG with enough free space to satisfy
+                * a full btree split.  Try again without minleft and if
+                * successful activate the lowspace algorithm.
+                */
+               args.fsbno = 0;
+               args.type = XFS_ALLOCTYPE_FIRST_AG;
+               args.minleft = 0;
+               if ((error = xfs_alloc_vextent(&args))) {
+                       XFS_BMBT_TRACE_CURSOR(cur, ERROR);
+                       return error;
+               }
+               cur->bc_private.b.flist->xbf_low = 1;
+       }
        if (args.fsbno == NULLFSBLOCK) {
                XFS_BMBT_TRACE_CURSOR(cur, EXIT);
                *stat = 0;
@@ -2029,22 +2059,8 @@ xfs_bmbt_increment(
  * Insert the current record at the point referenced by cur.
  *
  * A multi-level split of the tree on insert will invalidate the original
- * cursor. It appears, however, that some callers assume that the cursor is
- * always valid. Hence if we do a multi-level split we need to revalidate the
- * cursor.
- *
- * When a split occurs, we will see a new cursor returned. Use that as a
- * trigger to determine if we need to revalidate the original cursor. If we get
- * a split, then use the original irec to lookup up the path of the record we
- * just inserted.
- *
- * Note that the fact that the btree root is in the inode means that we can
- * have the level of the tree change without a "split" occurring at the root
- * level. What happens is that the root is migrated to an allocated block and
- * the inode root is pointed to it. This means a single split can change the
- * level of the tree (level 2 -> level 3) and invalidate the old cursor. Hence
- * the level change should be accounted as a split so as to correctly trigger a
- * revalidation of the old cursor.
+ * cursor.  All callers of this function should assume that the cursor is
+ * no longer valid and revalidate it.
  */
 int                                    /* error */
 xfs_bmbt_insert(
@@ -2057,14 +2073,11 @@ xfs_bmbt_insert(
        xfs_fsblock_t   nbno;
        xfs_btree_cur_t *ncur;
        xfs_bmbt_rec_t  nrec;
-       xfs_bmbt_irec_t oirec;          /* original irec */
        xfs_btree_cur_t *pcur;
-       int             splits = 0;
 
        XFS_BMBT_TRACE_CURSOR(cur, ENTRY);
        level = 0;
        nbno = NULLFSBLOCK;
-       oirec = cur->bc_rec.b;
        xfs_bmbt_disk_set_all(&nrec, &cur->bc_rec.b);
        ncur = NULL;
        pcur = cur;
@@ -2073,13 +2086,11 @@ xfs_bmbt_insert(
                                &i))) {
                        if (pcur != cur)
                                xfs_btree_del_cursor(pcur, XFS_BTREE_ERROR);
-                       goto error0;
+                       XFS_BMBT_TRACE_CURSOR(cur, ERROR);
+                       return error;
                }
                XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
                if (pcur != cur && (ncur || nbno == NULLFSBLOCK)) {
-                       /* allocating a new root is effectively a split */
-                       if (cur->bc_nlevels != pcur->bc_nlevels)
-                               splits++;
                        cur->bc_nlevels = pcur->bc_nlevels;
                        cur->bc_private.b.allocated +=
                                pcur->bc_private.b.allocated;
@@ -2093,21 +2104,10 @@ xfs_bmbt_insert(
                        xfs_btree_del_cursor(pcur, XFS_BTREE_NOERROR);
                }
                if (ncur) {
-                       splits++;
                        pcur = ncur;
                        ncur = NULL;
                }
        } while (nbno != NULLFSBLOCK);
-
-       if (splits > 1) {
-               /* revalidate the old cursor as we had a multi-level split */
-               error = xfs_bmbt_lookup_eq(cur, oirec.br_startoff,
-                               oirec.br_startblock, oirec.br_blockcount, &i);
-               if (error)
-                       goto error0;
-               ASSERT(i == 1);
-       }
-
        XFS_BMBT_TRACE_CURSOR(cur, EXIT);
        *stat = i;
        return 0;
@@ -2254,7 +2254,9 @@ xfs_bmbt_newroot(
 #endif
                args.fsbno = be64_to_cpu(*pp);
                args.type = XFS_ALLOCTYPE_START_BNO;
-       } else
+       } else if (cur->bc_private.b.flist->xbf_low)
+               args.type = XFS_ALLOCTYPE_START_BNO;
+       else
                args.type = XFS_ALLOCTYPE_NEAR_BNO;
        if ((error = xfs_alloc_vextent(&args))) {
                XFS_BMBT_TRACE_CURSOR(cur, ERROR);
index 53a71c6..d86ca2c 100644 (file)
@@ -889,9 +889,9 @@ xfs_buf_item_relse(
        }
 
 #ifdef XFS_TRANS_DEBUG
-       kmem_free(bip->bli_orig, XFS_BUF_COUNT(bp));
+       kmem_free(bip->bli_orig);
        bip->bli_orig = NULL;
-       kmem_free(bip->bli_logged, XFS_BUF_COUNT(bp) / NBBY);
+       kmem_free(bip->bli_logged);
        bip->bli_logged = NULL;
 #endif /* XFS_TRANS_DEBUG */
 
@@ -1138,9 +1138,9 @@ xfs_buf_iodone(
        xfs_trans_delete_ail(mp, (xfs_log_item_t *)bip);
 
 #ifdef XFS_TRANS_DEBUG
-       kmem_free(bip->bli_orig, XFS_BUF_COUNT(bp));
+       kmem_free(bip->bli_orig);
        bip->bli_orig = NULL;
-       kmem_free(bip->bli_logged, XFS_BUF_COUNT(bp) / NBBY);
+       kmem_free(bip->bli_logged);
        bip->bli_logged = NULL;
 #endif /* XFS_TRANS_DEBUG */
 
index d5d1e60..d2ce5dd 100644 (file)
@@ -78,6 +78,7 @@ struct xfs_mount_args {
 #define XFSMNT_IOSIZE          0x00002000      /* optimize for I/O size */
 #define XFSMNT_OSYNCISOSYNC    0x00004000      /* o_sync is REALLY o_sync */
                                                /* (osyncisdsync is default) */
+#define XFSMNT_NOATTR2         0x00008000      /* turn off ATTR2 EA format */
 #define XFSMNT_32BITINODES     0x00200000      /* restrict inodes to 32
                                                 * bits of address space */
 #define XFSMNT_GQUOTA          0x00400000      /* group quota accounting */
index 021a8f7..9e561a9 100644 (file)
@@ -1431,7 +1431,7 @@ xfs_da_path_shift(xfs_da_state_t *state, xfs_da_state_path_t *path,
        }
        if (level < 0) {
                *result = XFS_ERROR(ENOENT);    /* we're out of our tree */
-               ASSERT(args->oknoent);
+               ASSERT(args->op_flags & XFS_DA_OP_OKNOENT);
                return(0);
        }
 
@@ -1530,6 +1530,28 @@ xfs_da_hashname(const uchar_t *name, int namelen)
        }
 }
 
+enum xfs_dacmp
+xfs_da_compname(
+       struct xfs_da_args *args,
+       const char      *name,
+       int             len)
+{
+       return (args->namelen == len && memcmp(args->name, name, len) == 0) ?
+                                       XFS_CMP_EXACT : XFS_CMP_DIFFERENT;
+}
+
+static xfs_dahash_t
+xfs_default_hashname(
+       struct xfs_name *name)
+{
+       return xfs_da_hashname(name->name, name->len);
+}
+
+const struct xfs_nameops xfs_default_nameops = {
+       .hashname       = xfs_default_hashname,
+       .compname       = xfs_da_compname
+};
+
 /*
  * Add a block to the btree ahead of the file.
  * Return the new block number to the caller.
@@ -1598,7 +1620,7 @@ xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno)
                                        args->firstblock, args->total,
                                        &mapp[mapi], &nmap, args->flist,
                                        NULL))) {
-                               kmem_free(mapp, sizeof(*mapp) * count);
+                               kmem_free(mapp);
                                return error;
                        }
                        if (nmap < 1)
@@ -1620,11 +1642,11 @@ xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno)
            mapp[mapi - 1].br_startoff + mapp[mapi - 1].br_blockcount !=
            bno + count) {
                if (mapp != &map)
-                       kmem_free(mapp, sizeof(*mapp) * count);
+                       kmem_free(mapp);
                return XFS_ERROR(ENOSPC);
        }
        if (mapp != &map)
-               kmem_free(mapp, sizeof(*mapp) * count);
+               kmem_free(mapp);
        *new_blkno = (xfs_dablk_t)bno;
        return 0;
 }
@@ -2090,10 +2112,10 @@ xfs_da_do_buf(
                }
        }
        if (bplist) {
-               kmem_free(bplist, sizeof(*bplist) * nmap);
+               kmem_free(bplist);
        }
        if (mapp != &map) {
-               kmem_free(mapp, sizeof(*mapp) * nfsb);
+               kmem_free(mapp);
        }
        if (bpp)
                *bpp = rbp;
@@ -2102,11 +2124,11 @@ exit1:
        if (bplist) {
                for (i = 0; i < nbplist; i++)
                        xfs_trans_brelse(trans, bplist[i]);
-               kmem_free(bplist, sizeof(*bplist) * nmap);
+               kmem_free(bplist);
        }
 exit0:
        if (mapp != &map)
-               kmem_free(mapp, sizeof(*mapp) * nfsb);
+               kmem_free(mapp);
        if (bpp)
                *bpp = NULL;
        return error;
@@ -2218,7 +2240,7 @@ xfs_da_state_free(xfs_da_state_t *state)
 
 #ifdef XFS_DABUF_DEBUG
 xfs_dabuf_t    *xfs_dabuf_global_list;
-spinlock_t     xfs_dabuf_global_lock;
+static DEFINE_SPINLOCK(xfs_dabuf_global_lock);
 #endif
 
 /*
@@ -2315,7 +2337,7 @@ xfs_da_buf_done(xfs_dabuf_t *dabuf)
        if (dabuf->dirty)
                xfs_da_buf_clean(dabuf);
        if (dabuf->nbuf > 1)
-               kmem_free(dabuf->data, BBTOB(dabuf->bbcount));
+               kmem_free(dabuf->data);
 #ifdef XFS_DABUF_DEBUG
        {
                spin_lock(&xfs_dabuf_global_lock);
@@ -2332,7 +2354,7 @@ xfs_da_buf_done(xfs_dabuf_t *dabuf)
        if (dabuf->nbuf == 1)
                kmem_zone_free(xfs_dabuf_zone, dabuf);
        else
-               kmem_free(dabuf, XFS_DA_BUF_SIZE(dabuf->nbuf));
+               kmem_free(dabuf);
 }
 
 /*
@@ -2403,7 +2425,7 @@ xfs_da_brelse(xfs_trans_t *tp, xfs_dabuf_t *dabuf)
        for (i = 0; i < nbuf; i++)
                xfs_trans_brelse(tp, bplist[i]);
        if (bplist != &bp)
-               kmem_free(bplist, nbuf * sizeof(*bplist));
+               kmem_free(bplist);
 }
 
 /*
@@ -2429,7 +2451,7 @@ xfs_da_binval(xfs_trans_t *tp, xfs_dabuf_t *dabuf)
        for (i = 0; i < nbuf; i++)
                xfs_trans_binval(tp, bplist[i]);
        if (bplist != &bp)
-               kmem_free(bplist, nbuf * sizeof(*bplist));
+               kmem_free(bplist);
 }
 
 /*
index 7facf86..8be0b00 100644 (file)
@@ -98,6 +98,15 @@ typedef struct xfs_da_node_entry xfs_da_node_entry_t;
  * Btree searching and modification structure definitions.
  *========================================================================*/
 
+/*
+ * Search comparison results
+ */
+enum xfs_dacmp {
+       XFS_CMP_DIFFERENT,      /* names are completely different */
+       XFS_CMP_EXACT,          /* names are exactly the same */
+       XFS_CMP_CASE            /* names are same but differ in case */
+};
+
 /*
  * Structure to ease passing around component names.
  */
@@ -123,12 +132,19 @@ typedef struct xfs_da_args {
        int             index2;         /* index of 2nd attr in blk */
        xfs_dablk_t     rmtblkno2;      /* remote attr value starting blkno */
        int             rmtblkcnt2;     /* remote attr value block count */
-       unsigned char   justcheck;      /* T/F: check for ok with no space */
-       unsigned char   rename;         /* T/F: this is an atomic rename op */
-       unsigned char   addname;        /* T/F: this is an add operation */
-       unsigned char   oknoent;        /* T/F: ok to return ENOENT, else die */
+       int             op_flags;       /* operation flags */
+       enum xfs_dacmp  cmpresult;      /* name compare result for lookups */
 } xfs_da_args_t;
 
+/*
+ * Operation flags:
+ */
+#define XFS_DA_OP_JUSTCHECK    0x0001  /* check for ok with no space */
+#define XFS_DA_OP_RENAME       0x0002  /* this is an atomic rename op */
+#define XFS_DA_OP_ADDNAME      0x0004  /* this is an add operation */
+#define XFS_DA_OP_OKNOENT      0x0008  /* lookup/add op, ENOENT ok, else die */
+#define XFS_DA_OP_CILOOKUP     0x0010  /* lookup to return CI name if found */
+
 /*
  * Structure to describe buffer(s) for a block.
  * This is needed in the directory version 2 format case, when
@@ -201,6 +217,14 @@ typedef struct xfs_da_state {
                (uint)(XFS_DA_LOGOFF(BASE, ADDR)), \
                (uint)(XFS_DA_LOGOFF(BASE, ADDR)+(SIZE)-1)
 
+/*
+ * Name ops for directory and/or attr name operations
+ */
+struct xfs_nameops {
+       xfs_dahash_t    (*hashname)(struct xfs_name *);
+       enum xfs_dacmp  (*compname)(struct xfs_da_args *, const char *, int);
+};
+
 
 #ifdef __KERNEL__
 /*========================================================================
@@ -249,6 +273,10 @@ int        xfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno,
                                          xfs_dabuf_t *dead_buf);
 
 uint xfs_da_hashname(const uchar_t *name_string, int name_length);
+enum xfs_dacmp xfs_da_compname(struct xfs_da_args *args,
+                               const char *name, int len);
+
+
 xfs_da_state_t *xfs_da_state_alloc(void);
 void xfs_da_state_free(xfs_da_state_t *state);
 
index 5f3647c..2211e88 100644 (file)
@@ -116,7 +116,7 @@ xfs_swapext(
  out_put_file:
        fput(file);
  out_free_sxp:
-       kmem_free(sxp, sizeof(xfs_swapext_t));
+       kmem_free(sxp);
  out:
        return error;
 }
@@ -381,6 +381,6 @@ xfs_swap_extents(
                xfs_iunlock(tip, lock_flags);
        }
        if (tempifp != NULL)
-               kmem_free(tempifp, sizeof(xfs_ifork_t));
+               kmem_free(tempifp);
        return error;
 }
index 7cb2652..80e0dc5 100644 (file)
 
 struct xfs_name xfs_name_dotdot = {"..", 2};
 
+extern const struct xfs_nameops xfs_default_nameops;
+
+/*
+ * ASCII case-insensitive (ie. A-Z) support for directories that was
+ * used in IRIX.
+ */
+STATIC xfs_dahash_t
+xfs_ascii_ci_hashname(
+       struct xfs_name *name)
+{
+       xfs_dahash_t    hash;
+       int             i;
+
+       for (i = 0, hash = 0; i < name->len; i++)
+               hash = tolower(name->name[i]) ^ rol32(hash, 7);
+
+       return hash;
+}
+
+STATIC enum xfs_dacmp
+xfs_ascii_ci_compname(
+       struct xfs_da_args *args,
+       const char      *name,
+       int             len)
+{
+       enum xfs_dacmp  result;
+       int             i;
+
+       if (args->namelen != len)
+               return XFS_CMP_DIFFERENT;
+
+       result = XFS_CMP_EXACT;
+       for (i = 0; i < len; i++) {
+               if (args->name[i] == name[i])
+                       continue;
+               if (tolower(args->name[i]) != tolower(name[i]))
+                       return XFS_CMP_DIFFERENT;
+               result = XFS_CMP_CASE;
+       }
+
+       return result;
+}
+
+static struct xfs_nameops xfs_ascii_ci_nameops = {
+       .hashname       = xfs_ascii_ci_hashname,
+       .compname       = xfs_ascii_ci_compname,
+};
+
 void
 xfs_dir_mount(
        xfs_mount_t     *mp)
@@ -65,6 +113,10 @@ xfs_dir_mount(
                (mp->m_dirblksize - (uint)sizeof(xfs_da_node_hdr_t)) /
                (uint)sizeof(xfs_da_node_entry_t);
        mp->m_dir_magicpct = (mp->m_dirblksize * 37) / 100;
+       if (xfs_sb_version_hasasciici(&mp->m_sb))
+               mp->m_dirnameops = &xfs_ascii_ci_nameops;
+       else
+               mp->m_dirnameops = &xfs_default_nameops;
 }
 
 /*
@@ -162,9 +214,10 @@ xfs_dir_createname(
                return rval;
        XFS_STATS_INC(xs_dir_create);
 
+       memset(&args, 0, sizeof(xfs_da_args_t));
        args.name = name->name;
        args.namelen = name->len;
-       args.hashval = xfs_da_hashname(name->name, name->len);
+       args.hashval = dp->i_mount->m_dirnameops->hashname(name);
        args.inumber = inum;
        args.dp = dp;
        args.firstblock = first;
@@ -172,8 +225,7 @@ xfs_dir_createname(
        args.total = total;
        args.whichfork = XFS_DATA_FORK;
        args.trans = tp;
-       args.justcheck = 0;
-       args.addname = args.oknoent = 1;
+       args.op_flags = XFS_DA_OP_ADDNAME | XFS_DA_OP_OKNOENT;
 
        if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
                rval = xfs_dir2_sf_addname(&args);
@@ -190,15 +242,44 @@ xfs_dir_createname(
        return rval;
 }
 
+/*
+ * If doing a CI lookup and case-insensitive match, dup actual name into
+ * args.value. Return EEXIST for success (ie. name found) or an error.
+ */
+int
+xfs_dir_cilookup_result(
+       struct xfs_da_args *args,
+       const char      *name,
+       int             len)
+{
+       if (args->cmpresult == XFS_CMP_DIFFERENT)
+               return ENOENT;
+       if (args->cmpresult != XFS_CMP_CASE ||
+                                       !(args->op_flags & XFS_DA_OP_CILOOKUP))
+               return EEXIST;
+
+       args->value = kmem_alloc(len, KM_MAYFAIL);
+       if (!args->value)
+               return ENOMEM;
+
+       memcpy(args->value, name, len);
+       args->valuelen = len;
+       return EEXIST;
+}
+
 /*
  * Lookup a name in a directory, give back the inode number.
+ * If ci_name is not NULL, returns the actual name in ci_name if it differs
+ * to name, or ci_name->name is set to NULL for an exact match.
  */
+
 int
 xfs_dir_lookup(
        xfs_trans_t     *tp,
        xfs_inode_t     *dp,
        struct xfs_name *name,
-       xfs_ino_t       *inum)          /* out: inode number */
+       xfs_ino_t       *inum,          /* out: inode number */
+       struct xfs_name *ci_name)       /* out: actual name if CI match */
 {
        xfs_da_args_t   args;
        int             rval;
@@ -206,15 +287,17 @@ xfs_dir_lookup(
 
        ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR);
        XFS_STATS_INC(xs_dir_lookup);
-       memset(&args, 0, sizeof(xfs_da_args_t));
 
+       memset(&args, 0, sizeof(xfs_da_args_t));
        args.name = name->name;
        args.namelen = name->len;
-       args.hashval = xfs_da_hashname(name->name, name->len);
+       args.hashval = dp->i_mount->m_dirnameops->hashname(name);
        args.dp = dp;
        args.whichfork = XFS_DATA_FORK;
        args.trans = tp;
-       args.oknoent = 1;
+       args.op_flags = XFS_DA_OP_OKNOENT;
+       if (ci_name)
+               args.op_flags |= XFS_DA_OP_CILOOKUP;
 
        if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
                rval = xfs_dir2_sf_lookup(&args);
@@ -230,8 +313,13 @@ xfs_dir_lookup(
                rval = xfs_dir2_node_lookup(&args);
        if (rval == EEXIST)
                rval = 0;
-       if (rval == 0)
+       if (!rval) {
                *inum = args.inumber;
+               if (ci_name) {
+                       ci_name->name = args.value;
+                       ci_name->len = args.valuelen;
+               }
+       }
        return rval;
 }
 
@@ -255,9 +343,10 @@ xfs_dir_removename(
        ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR);
        XFS_STATS_INC(xs_dir_remove);
 
+       memset(&args, 0, sizeof(xfs_da_args_t));
        args.name = name->name;
        args.namelen = name->len;
-       args.hashval = xfs_da_hashname(name->name, name->len);
+       args.hashval = dp->i_mount->m_dirnameops->hashname(name);
        args.inumber = ino;
        args.dp = dp;
        args.firstblock = first;
@@ -265,7 +354,6 @@ xfs_dir_removename(
        args.total = total;
        args.whichfork = XFS_DATA_FORK;
        args.trans = tp;
-       args.justcheck = args.addname = args.oknoent = 0;
 
        if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
                rval = xfs_dir2_sf_removename(&args);
@@ -338,9 +426,10 @@ xfs_dir_replace(
        if ((rval = xfs_dir_ino_validate(tp->t_mountp, inum)))
                return rval;
 
+       memset(&args, 0, sizeof(xfs_da_args_t));
        args.name = name->name;
        args.namelen = name->len;
-       args.hashval = xfs_da_hashname(name->name, name->len);
+       args.hashval = dp->i_mount->m_dirnameops->hashname(name);
        args.inumber = inum;
        args.dp = dp;
        args.firstblock = first;
@@ -348,7 +437,6 @@ xfs_dir_replace(
        args.total = total;
        args.whichfork = XFS_DATA_FORK;
        args.trans = tp;
-       args.justcheck = args.addname = args.oknoent = 0;
 
        if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
                rval = xfs_dir2_sf_replace(&args);
@@ -384,15 +472,16 @@ xfs_dir_canenter(
                return 0;
 
        ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR);
-       memset(&args, 0, sizeof(xfs_da_args_t));
 
+       memset(&args, 0, sizeof(xfs_da_args_t));
        args.name = name->name;
        args.namelen = name->len;
-       args.hashval = xfs_da_hashname(name->name, name->len);
+       args.hashval = dp->i_mount->m_dirnameops->hashname(name);
        args.dp = dp;
        args.whichfork = XFS_DATA_FORK;
        args.trans = tp;
-       args.justcheck = args.addname = args.oknoent = 1;
+       args.op_flags = XFS_DA_OP_JUSTCHECK | XFS_DA_OP_ADDNAME |
+                                                       XFS_DA_OP_OKNOENT;
 
        if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
                rval = xfs_dir2_sf_addname(&args);
@@ -493,7 +582,7 @@ xfs_dir2_grow_inode(
                                        args->firstblock, args->total,
                                        &mapp[mapi], &nmap, args->flist,
                                        NULL))) {
-                               kmem_free(mapp, sizeof(*mapp) * count);
+                               kmem_free(mapp);
                                return error;
                        }
                        if (nmap < 1)
@@ -525,14 +614,14 @@ xfs_dir2_grow_inode(
            mapp[mapi - 1].br_startoff + mapp[mapi - 1].br_blockcount !=
            bno + count) {
                if (mapp != &map)
-                       kmem_free(mapp, sizeof(*mapp) * count);
+                       kmem_free(mapp);
                return XFS_ERROR(ENOSPC);
        }
        /*
         * Done with the temporary mapping table.
         */
        if (mapp != &map)
-               kmem_free(mapp, sizeof(*mapp) * count);
+               kmem_free(mapp);
        *dbp = xfs_dir2_da_to_db(mp, (xfs_dablk_t)bno);
        /*
         * Update file's size if this is the data space and it grew.
index 6392f93..1d9ef96 100644 (file)
@@ -74,7 +74,8 @@ extern int xfs_dir_createname(struct xfs_trans *tp, struct xfs_inode *dp,
                                xfs_fsblock_t *first,
                                struct xfs_bmap_free *flist, xfs_extlen_t tot);
 extern int xfs_dir_lookup(struct xfs_trans *tp, struct xfs_inode *dp,
-                               struct xfs_name *name, xfs_ino_t *inum);
+                               struct xfs_name *name, xfs_ino_t *inum,
+                               struct xfs_name *ci_name);
 extern int xfs_dir_removename(struct xfs_trans *tp, struct xfs_inode *dp,
                                struct xfs_name *name, xfs_ino_t ino,
                                xfs_fsblock_t *first,
@@ -99,4 +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);
+
 #endif /* __XFS_DIR2_H__ */
index fb5a556..e2fa0a1 100644 (file)
@@ -215,7 +215,7 @@ xfs_dir2_block_addname(
        /*
         * If this isn't a real add, we're done with the buffer.
         */
-       if (args->justcheck)
+       if (args->op_flags & XFS_DA_OP_JUSTCHECK)
                xfs_da_brelse(tp, bp);
        /*
         * If we don't have space for the new entry & leaf ...
@@ -225,7 +225,7 @@ xfs_dir2_block_addname(
                 * Not trying to actually do anything, or don't have
                 * a space reservation: return no-space.
                 */
-               if (args->justcheck || args->total == 0)
+               if ((args->op_flags & XFS_DA_OP_JUSTCHECK) || args->total == 0)
                        return XFS_ERROR(ENOSPC);
                /*
                 * Convert to the next larger format.
@@ -240,7 +240,7 @@ xfs_dir2_block_addname(
        /*
         * Just checking, and it would work, so say so.
         */
-       if (args->justcheck)
+       if (args->op_flags & XFS_DA_OP_JUSTCHECK)
                return 0;
        needlog = needscan = 0;
        /*
@@ -610,14 +610,15 @@ xfs_dir2_block_lookup(
        /*
         * Get the offset from the leaf entry, to point to the data.
         */
-       dep = (xfs_dir2_data_entry_t *)
-             ((char *)block + xfs_dir2_dataptr_to_off(mp, be32_to_cpu(blp[ent].address)));
+       dep = (xfs_dir2_data_entry_t *)((char *)block +
+               xfs_dir2_dataptr_to_off(mp, be32_to_cpu(blp[ent].address)));
        /*
-        * Fill in inode number, release the block.
+        * Fill in inode number, CI name if appropriate, release the block.
         */
        args->inumber = be64_to_cpu(dep->inumber);
+       error = xfs_dir_cilookup_result(args, dep->name, dep->namelen);
        xfs_da_brelse(args->trans, bp);
-       return XFS_ERROR(EEXIST);
+       return XFS_ERROR(error);
 }
 
 /*
@@ -643,6 +644,7 @@ xfs_dir2_block_lookup_int(
        int                     mid;            /* binary search current idx */
        xfs_mount_t             *mp;            /* filesystem mount point */
        xfs_trans_t             *tp;            /* transaction pointer */
+       enum xfs_dacmp          cmp;            /* comparison result */
 
        dp = args->dp;
        tp = args->trans;
@@ -673,7 +675,7 @@ xfs_dir2_block_lookup_int(
                else
                        high = mid - 1;
                if (low > high) {
-                       ASSERT(args->oknoent);
+                       ASSERT(args->op_flags & XFS_DA_OP_OKNOENT);
                        xfs_da_brelse(tp, bp);
                        return XFS_ERROR(ENOENT);
                }
@@ -697,20 +699,31 @@ xfs_dir2_block_lookup_int(
                dep = (xfs_dir2_data_entry_t *)
                        ((char *)block + xfs_dir2_dataptr_to_off(mp, addr));
                /*
-                * Compare, if it's right give back buffer & entry number.
+                * Compare name and if it's an exact match, return the index
+                * and buffer. If it's the first case-insensitive match, store
+                * the index and buffer and continue looking for an exact match.
                 */
-               if (dep->namelen == args->namelen &&
-                   dep->name[0] == args->name[0] &&
-                   memcmp(dep->name, args->name, args->namelen) == 0) {
+               cmp = mp->m_dirnameops->compname(args, dep->name, dep->namelen);
+               if (cmp != XFS_CMP_DIFFERENT && cmp != args->cmpresult) {
+                       args->cmpresult = cmp;
                        *bpp = bp;
                        *entno = mid;
-                       return 0;
+                       if (cmp == XFS_CMP_EXACT)
+                               return 0;
                }
-       } while (++mid < be32_to_cpu(btp->count) && be32_to_cpu(blp[mid].hashval) == hash);
+       } while (++mid < be32_to_cpu(btp->count) &&
+                       be32_to_cpu(blp[mid].hashval) == hash);
+
+       ASSERT(args->op_flags & XFS_DA_OP_OKNOENT);
+       /*
+        * Here, we can only be doing a lookup (not a rename or replace).
+        * If a case-insensitive match was found earlier, return success.
+        */
+       if (args->cmpresult == XFS_CMP_CASE)
+               return 0;
        /*
         * No match, release the buffer and return ENOENT.
         */
-       ASSERT(args->oknoent);
        xfs_da_brelse(tp, bp);
        return XFS_ERROR(ENOENT);
 }
@@ -1033,6 +1046,7 @@ xfs_dir2_sf_to_block(
        xfs_dir2_sf_t           *sfp;           /* shortform structure */
        __be16                  *tagp;          /* end of data entry */
        xfs_trans_t             *tp;            /* transaction pointer */
+       struct xfs_name         name;
 
        xfs_dir2_trace_args("sf_to_block", args);
        dp = args->dp;
@@ -1071,7 +1085,7 @@ xfs_dir2_sf_to_block(
         */
        error = xfs_dir2_grow_inode(args, XFS_DIR2_DATA_SPACE, &blkno);
        if (error) {
-               kmem_free(buf, buf_len);
+               kmem_free(buf);
                return error;
        }
        /*
@@ -1079,7 +1093,7 @@ xfs_dir2_sf_to_block(
         */
        error = xfs_dir2_data_init(args, blkno, &bp);
        if (error) {
-               kmem_free(buf, buf_len);
+               kmem_free(buf);
                return error;
        }
        block = bp->data;
@@ -1187,8 +1201,10 @@ xfs_dir2_sf_to_block(
                tagp = xfs_dir2_data_entry_tag_p(dep);
                *tagp = cpu_to_be16((char *)dep - (char *)block);
                xfs_dir2_data_log_entry(tp, bp, dep);
-               blp[2 + i].hashval = cpu_to_be32(xfs_da_hashname(
-                                       (char *)sfep->name, sfep->namelen));
+               name.name = sfep->name;
+               name.len = sfep->namelen;
+               blp[2 + i].hashval = cpu_to_be32(mp->m_dirnameops->
+                                                       hashname(&name));
                blp[2 + i].address = cpu_to_be32(xfs_dir2_byte_to_dataptr(mp,
                                                 (char *)dep - (char *)block));
                offset = (int)((char *)(tagp + 1) - (char *)block);
@@ -1198,7 +1214,7 @@ xfs_dir2_sf_to_block(
                        sfep = xfs_dir2_sf_nextentry(sfp, sfep);
        }
        /* Done with the temporary buffer */
-       kmem_free(buf, buf_len);
+       kmem_free(buf);
        /*
         * Sort the leaf entries by hash value.
         */
index fb8c9e0..498f8d6 100644 (file)
@@ -65,6 +65,7 @@ xfs_dir2_data_check(
        xfs_mount_t             *mp;            /* filesystem mount point */
        char                    *p;             /* current data position */
        int                     stale;          /* count of stale leaves */
+       struct xfs_name         name;
 
        mp = dp->i_mount;
        d = bp->data;
@@ -140,7 +141,9 @@ xfs_dir2_data_check(
                        addr = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk,
                                (xfs_dir2_data_aoff_t)
                                ((char *)dep - (char *)d));
-                       hash = xfs_da_hashname((char *)dep->name, dep->namelen);
+                       name.name = dep->name;
+                       name.len = dep->namelen;
+                       hash = mp->m_dirnameops->hashname(&name);
                        for (i = 0; i < be32_to_cpu(btp->count); i++) {
                                if (be32_to_cpu(lep[i].address) == addr &&
                                    be32_to_cpu(lep[i].hashval) == hash)
index bc52b80..9353599 100644 (file)
@@ -263,20 +263,21 @@ xfs_dir2_leaf_addname(
         * If we don't have enough free bytes but we can make enough
         * by compacting out stale entries, we'll do that.
         */
-       if ((char *)bestsp - (char *)&leaf->ents[be16_to_cpu(leaf->hdr.count)] < needbytes &&
-           be16_to_cpu(leaf->hdr.stale) > 1) {
+       if ((char *)bestsp - (char *)&leaf->ents[be16_to_cpu(leaf->hdr.count)] <
+                               needbytes && be16_to_cpu(leaf->hdr.stale) > 1) {
                compact = 1;
        }
        /*
         * Otherwise if we don't have enough free bytes we need to
         * convert to node form.
         */
-       else if ((char *)bestsp - (char *)&leaf->ents[be16_to_cpu(leaf->hdr.count)] <
-                needbytes) {
+       else if ((char *)bestsp - (char *)&leaf->ents[be16_to_cpu(
+                                               leaf->hdr.count)] < needbytes) {
                /*
                 * Just checking or no space reservation, give up.
                 */
-               if (args->justcheck || args->total == 0) {
+               if ((args->op_flags & XFS_DA_OP_JUSTCHECK) ||
+                                                       args->total == 0) {
                        xfs_da_brelse(tp, lbp);
                        return XFS_ERROR(ENOSPC);
                }
@@ -301,7 +302,7 @@ xfs_dir2_leaf_addname(
         * If just checking, then it will fit unless we needed to allocate
         * a new data block.
         */
-       if (args->justcheck) {
+       if (args->op_flags & XFS_DA_OP_JUSTCHECK) {
                xfs_da_brelse(tp, lbp);
                return use_block == -1 ? XFS_ERROR(ENOSPC) : 0;
        }
@@ -1110,7 +1111,7 @@ xfs_dir2_leaf_getdents(
                *offset = XFS_DIR2_MAX_DATAPTR;
        else
                *offset = xfs_dir2_byte_to_dataptr(mp, curoff);
-       kmem_free(map, map_size * sizeof(*map));
+       kmem_free(map);
        if (bp)
                xfs_da_brelse(NULL, bp);
        return error;
@@ -1298,12 +1299,13 @@ xfs_dir2_leaf_lookup(
              ((char *)dbp->data +
               xfs_dir2_dataptr_to_off(dp->i_mount, be32_to_cpu(lep->address)));
        /*
-        * Return the found inode number.
+        * Return the found inode number & CI name if appropriate
         */
        args->inumber = be64_to_cpu(dep->inumber);
+       error = xfs_dir_cilookup_result(args, dep->name, dep->namelen);
        xfs_da_brelse(tp, dbp);
        xfs_da_brelse(tp, lbp);
-       return XFS_ERROR(EEXIST);
+       return XFS_ERROR(error);
 }
 
 /*
@@ -1319,8 +1321,8 @@ xfs_dir2_leaf_lookup_int(
        int                     *indexp,        /* out: index in leaf block */
        xfs_dabuf_t             **dbpp)         /* out: data buffer */
 {
-       xfs_dir2_db_t           curdb;          /* current data block number */
-       xfs_dabuf_t             *dbp;           /* data buffer */
+       xfs_dir2_db_t           curdb = -1;     /* current data block number */
+       xfs_dabuf_t             *dbp = NULL;    /* data buffer */
        xfs_dir2_data_entry_t   *dep;           /* data entry */
        xfs_inode_t             *dp;            /* incore directory inode */
        int                     error;          /* error return code */
@@ -1331,6 +1333,8 @@ xfs_dir2_leaf_lookup_int(
        xfs_mount_t             *mp;            /* filesystem mount point */
        xfs_dir2_db_t           newdb;          /* new data block number */
        xfs_trans_t             *tp;            /* transaction pointer */
+       xfs_dir2_db_t           cidb = -1;      /* case match data block no. */
+       enum xfs_dacmp          cmp;            /* name compare result */
 
        dp = args->dp;
        tp = args->trans;
@@ -1338,11 +1342,10 @@ xfs_dir2_leaf_lookup_int(
        /*
         * Read the leaf block into the buffer.
         */
-       if ((error =
-           xfs_da_read_buf(tp, dp, mp->m_dirleafblk, -1, &lbp,
-                   XFS_DATA_FORK))) {
+       error = xfs_da_read_buf(tp, dp, mp->m_dirleafblk, -1, &lbp,
+                                                       XFS_DATA_FORK);
+       if (error)
                return error;
-       }
        *lbpp = lbp;
        leaf = lbp->data;
        xfs_dir2_leaf_check(dp, lbp);
@@ -1354,9 +1357,9 @@ xfs_dir2_leaf_lookup_int(
         * Loop over all the entries with the right hash value
         * looking to match the name.
         */
-       for (lep = &leaf->ents[index], dbp = NULL, curdb = -1;
-            index < be16_to_cpu(leaf->hdr.count) && be32_to_cpu(lep->hashval) == args->hashval;
-            lep++, index++) {
+       for (lep = &leaf->ents[index]; index < be16_to_cpu(leaf->hdr.count) &&
+                               be32_to_cpu(lep->hashval) == args->hashval;
+                               lep++, index++) {
                /*
                 * Skip over stale leaf entries.
                 */
@@ -1373,10 +1376,10 @@ xfs_dir2_leaf_lookup_int(
                if (newdb != curdb) {
                        if (dbp)
                                xfs_da_brelse(tp, dbp);
-                       if ((error =
-                           xfs_da_read_buf(tp, dp,
-                                   xfs_dir2_db_to_da(mp, newdb), -1, &dbp,
-                                   XFS_DATA_FORK))) {
+                       error = xfs_da_read_buf(tp, dp,
+                                               xfs_dir2_db_to_da(mp, newdb),
+                                               -1, &dbp, XFS_DATA_FORK);
+                       if (error) {
                                xfs_da_brelse(tp, lbp);
                                return error;
                        }
@@ -1386,24 +1389,50 @@ xfs_dir2_leaf_lookup_int(
                /*
                 * Point to the data entry.
                 */
-               dep = (xfs_dir2_data_entry_t *)
-                     ((char *)dbp->data +
-                      xfs_dir2_dataptr_to_off(mp, be32_to_cpu(lep->address)));
+               dep = (xfs_dir2_data_entry_t *)((char *)dbp->data +
+                       xfs_dir2_dataptr_to_off(mp, be32_to_cpu(lep->address)));
                /*
-                * If it matches then return it.
+                * Compare name and if it's an exact match, return the index
+                * and buffer. If it's the first case-insensitive match, store
+                * the index and buffer and continue looking for an exact match.
                 */
-               if (dep->namelen == args->namelen &&
-                   dep->name[0] == args->name[0] &&
-                   memcmp(dep->name, args->name, args->namelen) == 0) {
-                       *dbpp = dbp;
+               cmp = mp->m_dirnameops->compname(args, dep->name, dep->namelen);
+               if (cmp != XFS_CMP_DIFFERENT && cmp != args->cmpresult) {
+                       args->cmpresult = cmp;
                        *indexp = index;
-                       return 0;
+                       /* case exact match: return the current buffer. */
+                       if (cmp == XFS_CMP_EXACT) {
+                               *dbpp = dbp;
+                               return 0;
+                       }
+                       cidb = curdb;
                }
        }
+       ASSERT(args->op_flags & XFS_DA_OP_OKNOENT);
+       /*
+        * Here, we can only be doing a lookup (not a rename or remove).
+        * If a case-insensitive match was found earlier, re-read the
+        * appropriate data block if required and return it.
+        */
+       if (args->cmpresult == XFS_CMP_CASE) {
+               ASSERT(cidb != -1);
+               if (cidb != curdb) {
+                       xfs_da_brelse(tp, dbp);
+                       error = xfs_da_read_buf(tp, dp,
+                                               xfs_dir2_db_to_da(mp, cidb),
+                                               -1, &dbp, XFS_DATA_FORK);
+                       if (error) {
+                               xfs_da_brelse(tp, lbp);
+                               return error;
+                       }
+               }
+               *dbpp = dbp;
+               return 0;
+       }
        /*
         * No match found, return ENOENT.
         */
-       ASSERT(args->oknoent);
+       ASSERT(cidb == -1);
        if (dbp)
                xfs_da_brelse(tp, dbp);
        xfs_da_brelse(tp, lbp);
index 8dade71..fa6c3a5 100644 (file)
@@ -226,7 +226,7 @@ xfs_dir2_leafn_add(
        ASSERT(index == be16_to_cpu(leaf->hdr.count) ||
               be32_to_cpu(leaf->ents[index].hashval) >= args->hashval);
 
-       if (args->justcheck)
+       if (args->op_flags & XFS_DA_OP_JUSTCHECK)
                return 0;
 
        /*
@@ -387,28 +387,26 @@ xfs_dir2_leafn_lasthash(
 }
 
 /*
- * Look up a leaf entry in a node-format leaf block.
- * If this is an addname then the extrablk in state is a freespace block,
- * otherwise it's a data block.
+ * Look up a leaf entry for space to add a name in a node-format leaf block.
+ * The extrablk in state is a freespace block.
  */
-int
-xfs_dir2_leafn_lookup_int(
+STATIC int
+xfs_dir2_leafn_lookup_for_addname(
        xfs_dabuf_t             *bp,            /* leaf buffer */
        xfs_da_args_t           *args,          /* operation arguments */
        int                     *indexp,        /* out: leaf entry index */
        xfs_da_state_t          *state)         /* state to fill in */
 {
-       xfs_dabuf_t             *curbp;         /* current data/free buffer */
-       xfs_dir2_db_t           curdb;          /* current data block number */
-       xfs_dir2_db_t           curfdb;         /* current free block number */
-       xfs_dir2_data_entry_t   *dep;           /* data block entry */
+       xfs_dabuf_t             *curbp = NULL;  /* current data/free buffer */
+       xfs_dir2_db_t           curdb = -1;     /* current data block number */
+       xfs_dir2_db_t           curfdb = -1;    /* current free block number */
        xfs_inode_t             *dp;            /* incore directory inode */
        int                     error;          /* error return value */
        int                     fi;             /* free entry index */
-       xfs_dir2_free_t         *free=NULL;     /* free block structure */
+       xfs_dir2_free_t         *free = NULL;   /* free block structure */
        int                     index;          /* leaf entry index */
        xfs_dir2_leaf_t         *leaf;          /* leaf structure */
-       int                     length=0;       /* length of new data entry */
+       int                     length;         /* length of new data entry */
        xfs_dir2_leaf_entry_t   *lep;           /* leaf entry */
        xfs_mount_t             *mp;            /* filesystem mount point */
        xfs_dir2_db_t           newdb;          /* new data block number */
@@ -431,33 +429,20 @@ xfs_dir2_leafn_lookup_int(
        /*
         * Do we have a buffer coming in?
         */
-       if (state->extravalid)
+       if (state->extravalid) {
+               /* If so, it's a free block buffer, get the block number. */
                curbp = state->extrablk.bp;
-       else
-               curbp = NULL;
-       /*
-        * For addname, it's a free block buffer, get the block number.
-        */
-       if (args->addname) {
-               curfdb = curbp ? state->extrablk.blkno : -1;
-               curdb = -1;
-               length = xfs_dir2_data_entsize(args->namelen);
-               if ((free = (curbp ? curbp->data : NULL)))
-                       ASSERT(be32_to_cpu(free->hdr.magic) == XFS_DIR2_FREE_MAGIC);
-       }
-       /*
-        * For others, it's a data block buffer, get the block number.
-        */
-       else {
-               curfdb = -1;
-               curdb = curbp ? state->extrablk.blkno : -1;
+               curfdb = state->extrablk.blkno;
+               free = curbp->data;
+               ASSERT(be32_to_cpu(free->hdr.magic) == XFS_DIR2_FREE_MAGIC);
        }
+       length = xfs_dir2_data_entsize(args->namelen);
        /*
         * Loop over leaf entries with the right hash value.
         */
-       for (lep = &leaf->ents[index];
-            index < be16_to_cpu(leaf->hdr.count) && be32_to_cpu(lep->hashval) == args->hashval;
-            lep++, index++) {
+       for (lep = &leaf->ents[index]; index < be16_to_cpu(leaf->hdr.count) &&
+                               be32_to_cpu(lep->hashval) == args->hashval;
+                               lep++, index++) {
                /*
                 * Skip stale leaf entries.
                 */
@@ -471,160 +456,243 @@ xfs_dir2_leafn_lookup_int(
                 * For addname, we're looking for a place to put the new entry.
                 * We want to use a data block with an entry of equal
                 * hash value to ours if there is one with room.
+                *
+                * If this block isn't the data block we already have
+                * in hand, take a look at it.
                 */
-               if (args->addname) {
+               if (newdb != curdb) {
+                       curdb = newdb;
                        /*
-                        * If this block isn't the data block we already have
-                        * in hand, take a look at it.
+                        * Convert the data block to the free block
+                        * holding its freespace information.
                         */
-                       if (newdb != curdb) {
-                               curdb = newdb;
-                               /*
-                                * Convert the data block to the free block
-                                * holding its freespace information.
-                                */
-                               newfdb = xfs_dir2_db_to_fdb(mp, newdb);
-                               /*
-                                * If it's not the one we have in hand,
-                                * read it in.
-                                */
-                               if (newfdb != curfdb) {
-                                       /*
-                                        * If we had one before, drop it.
-                                        */
-                                       if (curbp)
-                                               xfs_da_brelse(tp, curbp);
-                                       /*
-                                        * Read the free block.
-                                        */
-                                       if ((error = xfs_da_read_buf(tp, dp,
-                                                       xfs_dir2_db_to_da(mp,
-                                                               newfdb),
-                                                       -1, &curbp,
-                                                       XFS_DATA_FORK))) {
-                                               return error;
-                                       }
-                                       free = curbp->data;
-                                       ASSERT(be32_to_cpu(free->hdr.magic) ==
-                                              XFS_DIR2_FREE_MAGIC);
-                                       ASSERT((be32_to_cpu(free->hdr.firstdb) %
-                                               XFS_DIR2_MAX_FREE_BESTS(mp)) ==
-                                              0);
-                                       ASSERT(be32_to_cpu(free->hdr.firstdb) <= curdb);
-                                       ASSERT(curdb <
-                                              be32_to_cpu(free->hdr.firstdb) +
-                                              be32_to_cpu(free->hdr.nvalid));
-                               }
-                               /*
-                                * Get the index for our entry.
-                                */
-                               fi = xfs_dir2_db_to_fdindex(mp, curdb);
-                               /*
-                                * If it has room, return it.
-                                */
-                               if (unlikely(be16_to_cpu(free->bests[fi]) == NULLDATAOFF)) {
-                                       XFS_ERROR_REPORT("xfs_dir2_leafn_lookup_int",
-                                                        XFS_ERRLEVEL_LOW, mp);
-                                       if (curfdb != newfdb)
-                                               xfs_da_brelse(tp, curbp);
-                                       return XFS_ERROR(EFSCORRUPTED);
-                               }
-                               curfdb = newfdb;
-                               if (be16_to_cpu(free->bests[fi]) >= length) {
-                                       *indexp = index;
-                                       state->extravalid = 1;
-                                       state->extrablk.bp = curbp;
-                                       state->extrablk.blkno = curfdb;
-                                       state->extrablk.index = fi;
-                                       state->extrablk.magic =
-                                               XFS_DIR2_FREE_MAGIC;
-                                       ASSERT(args->oknoent);
-                                       return XFS_ERROR(ENOENT);
-                               }
-                       }
-               }
-               /*
-                * Not adding a new entry, so we really want to find
-                * the name given to us.
-                */
-               else {
+                       newfdb = xfs_dir2_db_to_fdb(mp, newdb);
                        /*
-                        * If it's a different data block, go get it.
+                        * If it's not the one we have in hand, read it in.
                         */
-                       if (newdb != curdb) {
+                       if (newfdb != curfdb) {
                                /*
-                                * If we had a block before, drop it.
+                                * If we had one before, drop it.
                                 */
                                if (curbp)
                                        xfs_da_brelse(tp, curbp);
                                /*
-                                * Read the data block.
+                                * Read the free block.
                                 */
-                               if ((error =
-                                   xfs_da_read_buf(tp, dp,
-                                           xfs_dir2_db_to_da(mp, newdb), -1,
-                                           &curbp, XFS_DATA_FORK))) {
+                               error = xfs_da_read_buf(tp, dp,
+                                               xfs_dir2_db_to_da(mp, newfdb),
+                                               -1, &curbp, XFS_DATA_FORK);
+                               if (error)
                                        return error;
-                               }
-                               xfs_dir2_data_check(dp, curbp);
-                               curdb = newdb;
+                               free = curbp->data;
+                               ASSERT(be32_to_cpu(free->hdr.magic) ==
+                                       XFS_DIR2_FREE_MAGIC);
+                               ASSERT((be32_to_cpu(free->hdr.firstdb) %
+                                       XFS_DIR2_MAX_FREE_BESTS(mp)) == 0);
+                               ASSERT(be32_to_cpu(free->hdr.firstdb) <= curdb);
+                               ASSERT(curdb < be32_to_cpu(free->hdr.firstdb) +
+                                       be32_to_cpu(free->hdr.nvalid));
                        }
                        /*
-                        * Point to the data entry.
+                        * Get the index for our entry.
                         */
-                       dep = (xfs_dir2_data_entry_t *)
-                             ((char *)curbp->data +
-                              xfs_dir2_dataptr_to_off(mp, be32_to_cpu(lep->address)));
+                       fi = xfs_dir2_db_to_fdindex(mp, curdb);
                        /*
-                        * Compare the entry, return it if it matches.
+                        * If it has room, return it.
                         */
-                       if (dep->namelen == args->namelen &&
-                           dep->name[0] == args->name[0] &&
-                           memcmp(dep->name, args->name, args->namelen) == 0) {
-                               args->inumber = be64_to_cpu(dep->inumber);
-                               *indexp = index;
-                               state->extravalid = 1;
-                               state->extrablk.bp = curbp;
-                               state->extrablk.blkno = curdb;
-                               state->extrablk.index =
-                                       (int)((char *)dep -
-                                             (char *)curbp->data);
-                               state->extrablk.magic = XFS_DIR2_DATA_MAGIC;
-                               return XFS_ERROR(EEXIST);
+                       if (unlikely(be16_to_cpu(free->bests[fi]) == NULLDATAOFF)) {
+                               XFS_ERROR_REPORT("xfs_dir2_leafn_lookup_int",
+                                                       XFS_ERRLEVEL_LOW, mp);
+                               if (curfdb != newfdb)
+                                       xfs_da_brelse(tp, curbp);
+                               return XFS_ERROR(EFSCORRUPTED);
                        }
+                       curfdb = newfdb;
+                       if (be16_to_cpu(free->bests[fi]) >= length)
+                               goto out;
                }
        }
+       /* Didn't find any space */
+       fi = -1;
+out:
+       ASSERT(args->op_flags & XFS_DA_OP_OKNOENT);
+       if (curbp) {
+               /* Giving back a free block. */
+               state->extravalid = 1;
+               state->extrablk.bp = curbp;
+               state->extrablk.index = fi;
+               state->extrablk.blkno = curfdb;
+               state->extrablk.magic = XFS_DIR2_FREE_MAGIC;
+       } else {
+               state->extravalid = 0;
+       }
        /*
-        * Didn't find a match.
-        * If we are holding a buffer, give it back in case our caller
-        * finds it useful.
+        * Return the index, that will be the insertion point.
         */
-       if ((state->extravalid = (curbp != NULL))) {
-               state->extrablk.bp = curbp;
-               state->extrablk.index = -1;
+       *indexp = index;
+       return XFS_ERROR(ENOENT);
+}
+
+/*
+ * Look up a leaf entry in a node-format leaf block.
+ * The extrablk in state a data block.
+ */
+STATIC int
+xfs_dir2_leafn_lookup_for_entry(
+       xfs_dabuf_t             *bp,            /* leaf buffer */
+       xfs_da_args_t           *args,          /* operation arguments */
+       int                     *indexp,        /* out: leaf entry index */
+       xfs_da_state_t          *state)         /* state to fill in */
+{
+       xfs_dabuf_t             *curbp = NULL;  /* current data/free buffer */
+       xfs_dir2_db_t           curdb = -1;     /* current data block number */
+       xfs_dir2_data_entry_t   *dep;           /* data block entry */
+       xfs_inode_t             *dp;            /* incore directory inode */
+       int                     error;          /* error return value */
+       int                     index;          /* leaf entry index */
+       xfs_dir2_leaf_t         *leaf;          /* leaf structure */
+       xfs_dir2_leaf_entry_t   *lep;           /* leaf entry */
+       xfs_mount_t             *mp;            /* filesystem mount point */
+       xfs_dir2_db_t           newdb;          /* new data block number */
+       xfs_trans_t             *tp;            /* transaction pointer */
+       enum xfs_dacmp          cmp;            /* comparison result */
+
+       dp = args->dp;
+       tp = args->trans;
+       mp = dp->i_mount;
+       leaf = bp->data;
+       ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAFN_MAGIC);
+#ifdef __KERNEL__
+       ASSERT(be16_to_cpu(leaf->hdr.count) > 0);
+#endif
+       xfs_dir2_leafn_check(dp, bp);
+       /*
+        * Look up the hash value in the leaf entries.
+        */
+       index = xfs_dir2_leaf_search_hash(args, bp);
+       /*
+        * Do we have a buffer coming in?
+        */
+       if (state->extravalid) {
+               curbp = state->extrablk.bp;
+               curdb = state->extrablk.blkno;
+       }
+       /*
+        * Loop over leaf entries with the right hash value.
+        */
+       for (lep = &leaf->ents[index]; index < be16_to_cpu(leaf->hdr.count) &&
+                               be32_to_cpu(lep->hashval) == args->hashval;
+                               lep++, index++) {
                /*
-                * For addname, giving back a free block.
+                * Skip stale leaf entries.
                 */
-               if (args->addname) {
-                       state->extrablk.blkno = curfdb;
-                       state->extrablk.magic = XFS_DIR2_FREE_MAGIC;
+               if (be32_to_cpu(lep->address) == XFS_DIR2_NULL_DATAPTR)
+                       continue;
+               /*
+                * Pull the data block number from the entry.
+                */
+               newdb = xfs_dir2_dataptr_to_db(mp, be32_to_cpu(lep->address));
+               /*
+                * Not adding a new entry, so we really want to find
+                * the name given to us.
+                *
+                * If it's a different data block, go get it.
+                */
+               if (newdb != curdb) {
+                       /*
+                        * If we had a block before that we aren't saving
+                        * for a CI name, drop it
+                        */
+                       if (curbp && (args->cmpresult == XFS_CMP_DIFFERENT ||
+                                               curdb != state->extrablk.blkno))
+                               xfs_da_brelse(tp, curbp);
+                       /*
+                        * If needing the block that is saved with a CI match,
+                        * use it otherwise read in the new data block.
+                        */
+                       if (args->cmpresult != XFS_CMP_DIFFERENT &&
+                                       newdb == state->extrablk.blkno) {
+                               ASSERT(state->extravalid);
+                               curbp = state->extrablk.bp;
+                       } else {
+                               error = xfs_da_read_buf(tp, dp,
+                                               xfs_dir2_db_to_da(mp, newdb),
+                                               -1, &curbp, XFS_DATA_FORK);
+                               if (error)
+                                       return error;
+                       }
+                       xfs_dir2_data_check(dp, curbp);
+                       curdb = newdb;
                }
                /*
-                * For other callers, giving back a data block.
+                * Point to the data entry.
                 */
-               else {
+               dep = (xfs_dir2_data_entry_t *)((char *)curbp->data +
+                       xfs_dir2_dataptr_to_off(mp, be32_to_cpu(lep->address)));
+               /*
+                * Compare the entry and if it's an exact match, return
+                * EEXIST immediately. If it's the first case-insensitive
+                * match, store the block & inode number and continue looking.
+                */
+               cmp = mp->m_dirnameops->compname(args, dep->name, dep->namelen);
+               if (cmp != XFS_CMP_DIFFERENT && cmp != args->cmpresult) {
+                       /* If there is a CI match block, drop it */
+                       if (args->cmpresult != XFS_CMP_DIFFERENT &&
+                                               curdb != state->extrablk.blkno)
+                               xfs_da_brelse(tp, state->extrablk.bp);
+                       args->cmpresult = cmp;
+                       args->inumber = be64_to_cpu(dep->inumber);
+                       *indexp = index;
+                       state->extravalid = 1;
+                       state->extrablk.bp = curbp;
                        state->extrablk.blkno = curdb;
+                       state->extrablk.index = (int)((char *)dep -
+                                                       (char *)curbp->data);
                        state->extrablk.magic = XFS_DIR2_DATA_MAGIC;
+                       if (cmp == XFS_CMP_EXACT)
+                               return XFS_ERROR(EEXIST);
                }
        }
-       /*
-        * Return the final index, that will be the insertion point.
-        */
+       ASSERT(index == be16_to_cpu(leaf->hdr.count) ||
+                                       (args->op_flags & XFS_DA_OP_OKNOENT));
+       if (curbp) {
+               if (args->cmpresult == XFS_CMP_DIFFERENT) {
+                       /* Giving back last used data block. */
+                       state->extravalid = 1;
+                       state->extrablk.bp = curbp;
+                       state->extrablk.index = -1;
+                       state->extrablk.blkno = curdb;
+                       state->extrablk.magic = XFS_DIR2_DATA_MAGIC;
+               } else {
+                       /* If the curbp is not the CI match block, drop it */
+                       if (state->extrablk.bp != curbp)
+                               xfs_da_brelse(tp, curbp);
+               }
+       } else {
+               state->extravalid = 0;
+       }
        *indexp = index;
-       ASSERT(index == be16_to_cpu(leaf->hdr.count) || args->oknoent);
        return XFS_ERROR(ENOENT);
 }
 
+/*
+ * Look up a leaf entry in a node-format leaf block.
+ * If this is an addname then the extrablk in state is a freespace block,
+ * otherwise it's a data block.
+ */
+int
+xfs_dir2_leafn_lookup_int(
+       xfs_dabuf_t             *bp,            /* leaf buffer */
+       xfs_da_args_t           *args,          /* operation arguments */
+       int                     *indexp,        /* out: leaf entry index */
+       xfs_da_state_t          *state)         /* state to fill in */
+{
+       if (args->op_flags & XFS_DA_OP_ADDNAME)
+               return xfs_dir2_leafn_lookup_for_addname(bp, args, indexp,
+                                                       state);
+       return xfs_dir2_leafn_lookup_for_entry(bp, args, indexp, state);
+}
+
 /*
  * Move count leaf entries from source to destination leaf.
  * Log entries and headers.  Stale entries are preserved.
@@ -823,9 +891,10 @@ xfs_dir2_leafn_rebalance(
         */
        if (!state->inleaf)
                blk2->index = blk1->index - be16_to_cpu(leaf1->hdr.count);
-       
-       /* 
-        * Finally sanity check just to make sure we are not returning a negative index 
+
+       /*
+        * Finally sanity check just to make sure we are not returning a
+        * negative index
         */
        if(blk2->index < 0) {
                state->inleaf = 1;
@@ -1332,7 +1401,7 @@ xfs_dir2_node_addname(
                /*
                 * It worked, fix the hash values up the btree.
                 */
-               if (!args->justcheck)
+               if (!(args->op_flags & XFS_DA_OP_JUSTCHECK))
                        xfs_da_fixhashpath(state, &state->path);
        } else {
                /*
@@ -1515,7 +1584,8 @@ xfs_dir2_node_addname_int(
                /*
                 * Not allowed to allocate, return failure.
                 */
-               if (args->justcheck || args->total == 0) {
+               if ((args->op_flags & XFS_DA_OP_JUSTCHECK) ||
+                                                       args->total == 0) {
                        /*
                         * Drop the freespace buffer unless it came from our
                         * caller.
@@ -1661,7 +1731,7 @@ xfs_dir2_node_addname_int(
                /*
                 * If just checking, we succeeded.
                 */
-               if (args->justcheck) {
+               if (args->op_flags & XFS_DA_OP_JUSTCHECK) {
                        if ((fblk == NULL || fblk->bp == NULL) && fbp != NULL)
                                xfs_da_buf_done(fbp);
                        return 0;
@@ -1767,6 +1837,14 @@ xfs_dir2_node_lookup(
        error = xfs_da_node_lookup_int(state, &rval);
        if (error)
                rval = error;
+       else if (rval == ENOENT && args->cmpresult == XFS_CMP_CASE) {
+               /* If a CI match, dup the actual name and return EEXIST */
+               xfs_dir2_data_entry_t   *dep;
+
+               dep = (xfs_dir2_data_entry_t *)((char *)state->extrablk.bp->
+                                               data + state->extrablk.index);
+               rval = xfs_dir_cilookup_result(args, dep->name, dep->namelen);
+       }
        /*
         * Release the btree blocks and leaf block.
         */
@@ -1810,9 +1888,8 @@ xfs_dir2_node_removename(
         * Look up the entry we're deleting, set up the cursor.
         */
        error = xfs_da_node_lookup_int(state, &rval);
-       if (error) {
+       if (error)
                rval = error;
-       }
        /*
         * Didn't find it, upper layer screwed up.
         */
@@ -1829,9 +1906,8 @@ xfs_dir2_node_removename(
         */
        error = xfs_dir2_leafn_remove(args, blk->bp, blk->index,
                &state->extrablk, &rval);
-       if (error) {
+       if (error)
                return error;
-       }
        /*
         * Fix the hash values up the btree.
         */
index 919d275..b46af00 100644 (file)
@@ -255,7 +255,7 @@ xfs_dir2_block_to_sf(
        xfs_dir2_sf_check(args);
 out:
        xfs_trans_log_inode(args->trans, dp, logflags);
-       kmem_free(block, mp->m_dirblksize);
+       kmem_free(block);
        return error;
 }
 
@@ -332,7 +332,7 @@ xfs_dir2_sf_addname(
                /*
                 * Just checking or no space reservation, it doesn't fit.
                 */
-               if (args->justcheck || args->total == 0)
+               if ((args->op_flags & XFS_DA_OP_JUSTCHECK) || args->total == 0)
                        return XFS_ERROR(ENOSPC);
                /*
                 * Convert to block form then add the name.
@@ -345,7 +345,7 @@ xfs_dir2_sf_addname(
        /*
         * Just checking, it fits.
         */
-       if (args->justcheck)
+       if (args->op_flags & XFS_DA_OP_JUSTCHECK)
                return 0;
        /*
         * Do it the easy way - just add it at the end.
@@ -512,7 +512,7 @@ xfs_dir2_sf_addname_hard(
                sfep = xfs_dir2_sf_nextentry(sfp, sfep);
                memcpy(sfep, oldsfep, old_isize - nbytes);
        }
-       kmem_free(buf, old_isize);
+       kmem_free(buf);
        dp->i_d.di_size = new_isize;
        xfs_dir2_sf_check(args);
 }
@@ -812,8 +812,11 @@ xfs_dir2_sf_lookup(
 {
        xfs_inode_t             *dp;            /* incore directory inode */
        int                     i;              /* entry index */
+       int                     error;
        xfs_dir2_sf_entry_t     *sfep;          /* shortform directory entry */
        xfs_dir2_sf_t           *sfp;           /* shortform structure */
+       enum xfs_dacmp          cmp;            /* comparison result */
+       xfs_dir2_sf_entry_t     *ci_sfep;       /* case-insens. entry */
 
        xfs_dir2_trace_args("sf_lookup", args);
        xfs_dir2_sf_check(args);
@@ -836,6 +839,7 @@ xfs_dir2_sf_lookup(
         */
        if (args->namelen == 1 && args->name[0] == '.') {
                args->inumber = dp->i_ino;
+               args->cmpresult = XFS_CMP_EXACT;
                return XFS_ERROR(EEXIST);
        }
        /*
@@ -844,28 +848,41 @@ xfs_dir2_sf_lookup(
        if (args->namelen == 2 &&
            args->name[0] == '.' && args->name[1] == '.') {
                args->inumber = xfs_dir2_sf_get_inumber(sfp, &sfp->hdr.parent);
+               args->cmpresult = XFS_CMP_EXACT;
                return XFS_ERROR(EEXIST);
        }
        /*
         * Loop over all the entries trying to match ours.
         */
-       for (i = 0, sfep = xfs_dir2_sf_firstentry(sfp);
-            i < sfp->hdr.count;
-            i++, sfep = xfs_dir2_sf_nextentry(sfp, sfep)) {
-               if (sfep->namelen == args->namelen &&
-                   sfep->name[0] == args->name[0] &&
-                   memcmp(args->name, sfep->name, args->namelen) == 0) {
-                       args->inumber =
-                               xfs_dir2_sf_get_inumber(sfp,
-                                       xfs_dir2_sf_inumberp(sfep));
-                       return XFS_ERROR(EEXIST);
+       ci_sfep = NULL;
+       for (i = 0, sfep = xfs_dir2_sf_firstentry(sfp); i < sfp->hdr.count;
+                               i++, sfep = xfs_dir2_sf_nextentry(sfp, sfep)) {
+               /*
+                * Compare name and if it's an exact match, return the inode
+                * number. If it's the first case-insensitive match, store the
+                * inode number and continue looking for an exact match.
+                */
+               cmp = dp->i_mount->m_dirnameops->compname(args, sfep->name,
+                                                               sfep->namelen);
+               if (cmp != XFS_CMP_DIFFERENT && cmp != args->cmpresult) {
+                       args->cmpresult = cmp;
+                       args->inumber = xfs_dir2_sf_get_inumber(sfp,
+                                               xfs_dir2_sf_inumberp(sfep));
+                       if (cmp == XFS_CMP_EXACT)
+                               return XFS_ERROR(EEXIST);
+                       ci_sfep = sfep;
                }
        }
+       ASSERT(args->op_flags & XFS_DA_OP_OKNOENT);
        /*
-        * Didn't find it.
+        * Here, we can only be doing a lookup (not a rename or replace).
+        * If a case-insensitive match was not found, return ENOENT.
         */
-       ASSERT(args->oknoent);
-       return XFS_ERROR(ENOENT);
+       if (!ci_sfep)
+               return XFS_ERROR(ENOENT);
+       /* otherwise process the CI match as required by the caller */
+       error = xfs_dir_cilookup_result(args, ci_sfep->name, ci_sfep->namelen);
+       return XFS_ERROR(error);
 }
 
 /*
@@ -904,24 +921,21 @@ xfs_dir2_sf_removename(
         * Loop over the old directory entries.
         * Find the one we're deleting.
         */
-       for (i = 0, sfep = xfs_dir2_sf_firstentry(sfp);
-            i < sfp->hdr.count;
-            i++, sfep = xfs_dir2_sf_nextentry(sfp, sfep)) {
-               if (sfep->namelen == args->namelen &&
-                   sfep->name[0] == args->name[0] &&
-                   memcmp(sfep->name, args->name, args->namelen) == 0) {
+       for (i = 0, sfep = xfs_dir2_sf_firstentry(sfp); i < sfp->hdr.count;
+                               i++, sfep = xfs_dir2_sf_nextentry(sfp, sfep)) {
+               if (xfs_da_compname(args, sfep->name, sfep->namelen) ==
+                                                               XFS_CMP_EXACT) {
                        ASSERT(xfs_dir2_sf_get_inumber(sfp,
-                                       xfs_dir2_sf_inumberp(sfep)) ==
-                               args->inumber);
+                                               xfs_dir2_sf_inumberp(sfep)) ==
+                                                               args->inumber);
                        break;
                }
        }
        /*
         * Didn't find it.
         */
-       if (i == sfp->hdr.count) {
+       if (i == sfp->hdr.count)
                return XFS_ERROR(ENOENT);
-       }
        /*
         * Calculate sizes.
         */
@@ -1042,11 +1056,10 @@ xfs_dir2_sf_replace(
         */
        else {
                for (i = 0, sfep = xfs_dir2_sf_firstentry(sfp);
-                    i < sfp->hdr.count;
-                    i++, sfep = xfs_dir2_sf_nextentry(sfp, sfep)) {
-                       if (sfep->namelen == args->namelen &&
-                           sfep->name[0] == args->name[0] &&
-                           memcmp(args->name, sfep->name, args->namelen) == 0) {
+                               i < sfp->hdr.count;
+                               i++, sfep = xfs_dir2_sf_nextentry(sfp, sfep)) {
+                       if (xfs_da_compname(args, sfep->name, sfep->namelen) ==
+                                                               XFS_CMP_EXACT) {
 #if XFS_BIG_INUMS || defined(DEBUG)
                                ino = xfs_dir2_sf_get_inumber(sfp,
                                        xfs_dir2_sf_inumberp(sfep));
@@ -1061,7 +1074,7 @@ xfs_dir2_sf_replace(
                 * Didn't find it.
                 */
                if (i == sfp->hdr.count) {
-                       ASSERT(args->oknoent);
+                       ASSERT(args->op_flags & XFS_DA_OP_OKNOENT);
 #if XFS_BIG_INUMS
                        if (i8elevated)
                                xfs_dir2_sf_toino4(args);
@@ -1174,7 +1187,7 @@ xfs_dir2_sf_toino4(
        /*
         * Clean up the inode.
         */
-       kmem_free(buf, oldsize);
+       kmem_free(buf);
        dp->i_d.di_size = newsize;
        xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_DDATA);
 }
@@ -1251,7 +1264,7 @@ xfs_dir2_sf_toino8(
        /*
         * Clean up the inode.
         */
-       kmem_free(buf, oldsize);
+       kmem_free(buf);
        dp->i_d.di_size = newsize;
        xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_DDATA);
 }
index 005629d..deecc9d 100644 (file)
@@ -62,7 +62,7 @@ typedef union {
  * Normalized offset (in a data block) of the entry, really xfs_dir2_data_off_t.
  * Only need 16 bits, this is the byte offset into the single block form.
  */
-typedef struct { __uint8_t i[2]; } xfs_dir2_sf_off_t;
+typedef struct { __uint8_t i[2]; } __arch_pack xfs_dir2_sf_off_t;
 
 /*
  * The parent directory has a dedicated field, and the self-pointer must
@@ -76,14 +76,14 @@ typedef struct xfs_dir2_sf_hdr {
        __uint8_t               count;          /* count of entries */
        __uint8_t               i8count;        /* count of 8-byte inode #s */
        xfs_dir2_inou_t         parent;         /* parent dir inode number */
-} xfs_dir2_sf_hdr_t;
+} __arch_pack xfs_dir2_sf_hdr_t;
 
 typedef struct xfs_dir2_sf_entry {
        __uint8_t               namelen;        /* actual name length */
        xfs_dir2_sf_off_t       offset;         /* saved offset */
        __uint8_t               name[1];        /* name, variable size */
        xfs_dir2_inou_t         inumber;        /* inode number, var. offset */
-} xfs_dir2_sf_entry_t;
+} __arch_pack xfs_dir2_sf_entry_t; 
 
 typedef struct xfs_dir2_sf {
        xfs_dir2_sf_hdr_t       hdr;            /* shortform header */
index f3fb2ff..6cc7c0c 100644 (file)
@@ -85,7 +85,8 @@ xfs_dir2_trace_args(
                (void *)((unsigned long)(args->inumber >> 32)),
                (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
                (void *)args->dp, (void *)args->trans,
-               (void *)(unsigned long)args->justcheck, NULL, NULL);
+               (void *)(unsigned long)(args->op_flags & XFS_DA_OP_JUSTCHECK),
+               NULL, NULL);
 }
 
 void
@@ -100,7 +101,7 @@ xfs_dir2_trace_args_b(
                (void *)((unsigned long)(args->inumber >> 32)),
                (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
                (void *)args->dp, (void *)args->trans,
-               (void *)(unsigned long)args->justcheck,
+               (void *)(unsigned long)(args->op_flags & XFS_DA_OP_JUSTCHECK),
                (void *)(bp ? bp->bps[0] : NULL), NULL);
 }
 
@@ -117,7 +118,7 @@ xfs_dir2_trace_args_bb(
                (void *)((unsigned long)(args->inumber >> 32)),
                (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
                (void *)args->dp, (void *)args->trans,
-               (void *)(unsigned long)args->justcheck,
+               (void *)(unsigned long)(args->op_flags & XFS_DA_OP_JUSTCHECK),
                (void *)(lbp ? lbp->bps[0] : NULL),
                (void *)(dbp ? dbp->bps[0] : NULL));
 }
@@ -157,8 +158,8 @@ xfs_dir2_trace_args_db(
                (void *)((unsigned long)(args->inumber >> 32)),
                (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
                (void *)args->dp, (void *)args->trans,
-               (void *)(unsigned long)args->justcheck, (void *)(long)db,
-               (void *)dbp);
+               (void *)(unsigned long)(args->op_flags & XFS_DA_OP_JUSTCHECK),
+               (void *)(long)db, (void *)dbp);
 }
 
 void
@@ -173,7 +174,7 @@ xfs_dir2_trace_args_i(
                (void *)((unsigned long)(args->inumber >> 32)),
                (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
                (void *)args->dp, (void *)args->trans,
-               (void *)(unsigned long)args->justcheck,
+               (void *)(unsigned long)(args->op_flags & XFS_DA_OP_JUSTCHECK),
                (void *)((unsigned long)(i >> 32)),
                (void *)((unsigned long)(i & 0xFFFFFFFF)));
 }
@@ -190,7 +191,8 @@ xfs_dir2_trace_args_s(
                (void *)((unsigned long)(args->inumber >> 32)),
                (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
                (void *)args->dp, (void *)args->trans,
-               (void *)(unsigned long)args->justcheck, (void *)(long)s, NULL);
+               (void *)(unsigned long)(args->op_flags & XFS_DA_OP_JUSTCHECK),
+               (void *)(long)s, NULL);
 }
 
 void
@@ -208,7 +210,7 @@ xfs_dir2_trace_args_sb(
                (void *)((unsigned long)(args->inumber >> 32)),
                (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
                (void *)args->dp, (void *)args->trans,
-               (void *)(unsigned long)args->justcheck, (void *)(long)s,
-               (void *)dbp);
+               (void *)(unsigned long)(args->op_flags & XFS_DA_OP_JUSTCHECK),
+               (void *)(long)s, (void *)dbp);
 }
 #endif /* XFS_DIR2_TRACE */
index f71784a..cdc2d34 100644 (file)
@@ -166,6 +166,6 @@ typedef enum {
 
 #define FILP_DELAY_FLAG(filp) ((filp->f_flags&(O_NDELAY|O_NONBLOCK)) ? \
                        DM_FLAGS_NDELAY : 0)
-#define AT_DELAY_FLAG(f) ((f&ATTR_NONBLOCK) ? DM_FLAGS_NDELAY : 0)
+#define AT_DELAY_FLAG(f) ((f & XFS_ATTR_NONBLOCK) ? DM_FLAGS_NDELAY : 0)
 
 #endif  /* __XFS_DMAPI_H__ */
index 05e5365..f66756c 100644 (file)
@@ -66,14 +66,6 @@ int  xfs_etest[XFS_NUM_INJECT_ERROR];
 int64_t        xfs_etest_fsid[XFS_NUM_INJECT_ERROR];
 char * xfs_etest_fsname[XFS_NUM_INJECT_ERROR];
 
-void
-xfs_error_test_init(void)
-{
-       memset(xfs_etest, 0, sizeof(xfs_etest));
-       memset(xfs_etest_fsid, 0, sizeof(xfs_etest_fsid));
-       memset(xfs_etest_fsname, 0, sizeof(xfs_etest_fsname));
-}
-
 int
 xfs_error_test(int error_tag, int *fsidp, char *expression,
               int line, char *file, unsigned long randfactor)
@@ -150,8 +142,7 @@ xfs_errortag_clearall(xfs_mount_t *mp, int loud)
                                xfs_etest[i]);
                        xfs_etest[i] = 0;
                        xfs_etest_fsid[i] = 0LL;
-                       kmem_free(xfs_etest_fsname[i],
-                                 strlen(xfs_etest_fsname[i]) + 1);
+                       kmem_free(xfs_etest_fsname[i]);
                        xfs_etest_fsname[i] = NULL;
                }
        }
@@ -175,7 +166,7 @@ xfs_fs_vcmn_err(int level, xfs_mount_t *mp, char *fmt, va_list ap)
                newfmt = kmem_alloc(len, KM_SLEEP);
                sprintf(newfmt, "Filesystem \"%s\": %s", mp->m_fsname, fmt);
                icmn_err(level, newfmt, ap);
-               kmem_free(newfmt, len);
+               kmem_free(newfmt);
        } else {
                icmn_err(level, fmt, ap);
        }
index 6490d2a..d8559d1 100644 (file)
@@ -127,7 +127,6 @@ extern void xfs_corruption_error(char *tag, int level, struct xfs_mount *mp,
 
 #if (defined(DEBUG) || defined(INDUCE_IO_ERROR))
 extern int xfs_error_test(int, int *, char *, int, char *, unsigned long);
-extern void xfs_error_test_init(void);
 
 #define        XFS_NUM_INJECT_ERROR                            10
 
index 132bd07..8aa28f7 100644 (file)
@@ -41,8 +41,7 @@ xfs_efi_item_free(xfs_efi_log_item_t *efip)
        int nexts = efip->efi_format.efi_nextents;
 
        if (nexts > XFS_EFI_MAX_FAST_EXTENTS) {
-               kmem_free(efip, sizeof(xfs_efi_log_item_t) +
-                               (nexts - 1) * sizeof(xfs_extent_t));
+               kmem_free(efip);
        } else {
                kmem_zone_free(xfs_efi_zone, efip);
        }
@@ -374,8 +373,7 @@ xfs_efd_item_free(xfs_efd_log_item_t *efdp)
        int nexts = efdp->efd_format.efd_nextents;
 
        if (nexts > XFS_EFD_MAX_FAST_EXTENTS) {
-               kmem_free(efdp, sizeof(xfs_efd_log_item_t) +
-                               (nexts - 1) * sizeof(xfs_extent_t));
+               kmem_free(efdp);
        } else {
                kmem_zone_free(xfs_efd_zone, efdp);
        }
index 3f3785b..c38fd14 100644 (file)
@@ -397,10 +397,12 @@ int
 xfs_filestream_init(void)
 {
        item_zone = kmem_zone_init(sizeof(fstrm_item_t), "fstrm_item");
+       if (!item_zone)
+               return -ENOMEM;
 #ifdef XFS_FILESTREAMS_TRACE
        xfs_filestreams_trace_buf = ktrace_alloc(XFS_FSTRM_KTRACE_SIZE, KM_SLEEP);
 #endif
-       return item_zone ? 0 : -ENOMEM;
+       return 0;
 }
 
 /*
index 3bed643..01c0cc8 100644 (file)
@@ -239,6 +239,7 @@ typedef struct xfs_fsop_resblks {
 #define XFS_FSOP_GEOM_FLAGS_LOGV2      0x0100  /* log format version 2 */
 #define XFS_FSOP_GEOM_FLAGS_SECTOR     0x0200  /* sector sizes >1BB    */
 #define XFS_FSOP_GEOM_FLAGS_ATTR2      0x0400  /* inline attributes rework */
+#define XFS_FSOP_GEOM_FLAGS_DIRV2CI    0x1000  /* ASCII only CI names */
 #define XFS_FSOP_GEOM_FLAGS_LAZYSB     0x4000  /* lazy superblock counters */
 
 
@@ -371,6 +372,9 @@ typedef struct xfs_fsop_attrlist_handlereq {
 
 typedef struct xfs_attr_multiop {
        __u32           am_opcode;
+#define ATTR_OP_GET    1       /* return the indicated attr's value */
+#define ATTR_OP_SET    2       /* set/create the indicated attr/value pair */
+#define ATTR_OP_REMOVE 3       /* remove the indicated attr */
        __s32           am_error;
        void            __user *am_attrname;
        void            __user *am_attrvalue;
index 381ebda..84583cf 100644 (file)
@@ -95,6 +95,8 @@ xfs_fs_geometry(
                                XFS_FSOP_GEOM_FLAGS_DIRV2 : 0) |
                        (xfs_sb_version_hassector(&mp->m_sb) ?
                                XFS_FSOP_GEOM_FLAGS_SECTOR : 0) |
+                       (xfs_sb_version_hasasciici(&mp->m_sb) ?
+                               XFS_FSOP_GEOM_FLAGS_DIRV2CI : 0) |
                        (xfs_sb_version_haslazysbcount(&mp->m_sb) ?
                                XFS_FSOP_GEOM_FLAGS_LAZYSB : 0) |
                        (xfs_sb_version_hasattr2(&mp->m_sb) ?
@@ -625,7 +627,7 @@ xfs_fs_goingdown(
                        xfs_force_shutdown(mp, SHUTDOWN_FORCE_UMOUNT);
                        thaw_bdev(sb->s_bdev, sb);
                }
-       
+
                break;
        }
        case XFS_FSOP_GOING_FLAGS_LOGFLUSH:
index e569bf5..bedc661 100644 (file)
@@ -1763,67 +1763,6 @@ xfs_itruncate_finish(
        return 0;
 }
 
-
-/*
- * xfs_igrow_start
- *
- * Do the first part of growing a file: zero any data in the last
- * block that is beyond the old EOF.  We need to do this before
- * the inode is joined to the transaction to modify the i_size.
- * That way we can drop the inode lock and call into the buffer
- * cache to get the buffer mapping the EOF.
- */
-int
-xfs_igrow_start(
-       xfs_inode_t     *ip,
-       xfs_fsize_t     new_size,
-       cred_t          *credp)
-{
-       ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_IOLOCK_EXCL));
-       ASSERT(new_size > ip->i_size);
-
-       /*
-        * Zero any pages that may have been created by
-        * xfs_write_file() beyond the end of the file
-        * and any blocks between the old and new file sizes.
-        */
-       return xfs_zero_eof(ip, new_size, ip->i_size);
-}
-
-/*
- * xfs_igrow_finish
- *
- * This routine is called to extend the size of a file.
- * The inode must have both the iolock and the ilock locked
- * for update and it must be a part of the current transaction.
- * The xfs_igrow_start() function must have been called previously.
- * If the change_flag is not zero, the inode change timestamp will
- * be updated.
- */
-void
-xfs_igrow_finish(
-       xfs_trans_t     *tp,
-       xfs_inode_t     *ip,
-       xfs_fsize_t     new_size,
-       int             change_flag)
-{
-       ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_IOLOCK_EXCL));
-       ASSERT(ip->i_transp == tp);
-       ASSERT(new_size > ip->i_size);
-
-       /*
-        * Update the file size.  Update the inode change timestamp
-        * if change_flag set.
-        */
-       ip->i_d.di_size = new_size;
-       ip->i_size = new_size;
-       if (change_flag)
-               xfs_ichgtime(ip, XFS_ICHGTIME_CHG);
-       xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
-
-}
-
-
 /*
  * This is called when the inode's link count goes to 0.
  * We place the on-disk inode on a list in the AGI.  It
@@ -2258,7 +2197,7 @@ xfs_ifree_cluster(
                xfs_trans_binval(tp, bp);
        }
 
-       kmem_free(ip_found, ninodes * sizeof(xfs_inode_t *));
+       kmem_free(ip_found);
        xfs_put_perag(mp, pag);
 }
 
@@ -2470,7 +2409,7 @@ xfs_iroot_realloc(
                                                     (int)new_size);
                memcpy(np, op, new_max * (uint)sizeof(xfs_dfsbno_t));
        }
-       kmem_free(ifp->if_broot, ifp->if_broot_bytes);
+       kmem_free(ifp->if_broot);
        ifp->if_broot = new_broot;
        ifp->if_broot_bytes = (int)new_size;
        ASSERT(ifp->if_broot_bytes <=
@@ -2514,7 +2453,7 @@ xfs_idata_realloc(
 
        if (new_size == 0) {
                if (ifp->if_u1.if_data != ifp->if_u2.if_inline_data) {
-                       kmem_free(ifp->if_u1.if_data, ifp->if_real_bytes);
+                       kmem_free(ifp->if_u1.if_data);
                }
                ifp->if_u1.if_data = NULL;
                real_size = 0;
@@ -2529,7 +2468,7 @@ xfs_idata_realloc(
                        ASSERT(ifp->if_real_bytes != 0);
                        memcpy(ifp->if_u2.if_inline_data, ifp->if_u1.if_data,
                              new_size);
-                       kmem_free(ifp->if_u1.if_data, ifp->if_real_bytes);
+                       kmem_free(ifp->if_u1.if_data);
                        ifp->if_u1.if_data = ifp->if_u2.if_inline_data;
                }
                real_size = 0;
@@ -2636,7 +2575,7 @@ xfs_idestroy_fork(
 
        ifp = XFS_IFORK_PTR(ip, whichfork);
        if (ifp->if_broot != NULL) {
-               kmem_free(ifp->if_broot, ifp->if_broot_bytes);
+               kmem_free(ifp->if_broot);
                ifp->if_broot = NULL;
        }
 
@@ -2650,7 +2589,7 @@ xfs_idestroy_fork(
                if ((ifp->if_u1.if_data != ifp->if_u2.if_inline_data) &&
                    (ifp->if_u1.if_data != NULL)) {
                        ASSERT(ifp->if_real_bytes != 0);
-                       kmem_free(ifp->if_u1.if_data, ifp->if_real_bytes);
+                       kmem_free(ifp->if_u1.if_data);
                        ifp->if_u1.if_data = NULL;
                        ifp->if_real_bytes = 0;
                }
@@ -3058,7 +2997,7 @@ xfs_iflush_cluster(
 
 out_free:
        read_unlock(&pag->pag_ici_lock);
-       kmem_free(ilist, ilist_size);
+       kmem_free(ilist);
        return 0;
 
 
@@ -3102,7 +3041,7 @@ cluster_corrupt_out:
         * Unlocks the flush lock
         */
        xfs_iflush_abort(iq);
-       kmem_free(ilist, ilist_size);
+       kmem_free(ilist);
        return XFS_ERROR(EFSCORRUPTED);
 }
 
@@ -3143,8 +3082,6 @@ xfs_iflush(
         * flush lock and do nothing.
         */
        if (xfs_inode_clean(ip)) {
-               ASSERT((iip != NULL) ?
-                        !(iip->ili_item.li_flags & XFS_LI_IN_AIL) : 1);
                xfs_ifunlock(ip);
                return 0;
        }
@@ -3836,7 +3773,7 @@ xfs_iext_add_indirect_multi(
                        erp = xfs_iext_irec_new(ifp, erp_idx);
                }
                memmove(&erp->er_extbuf[i], nex2_ep, byte_diff);
-               kmem_free(nex2_ep, byte_diff);
+               kmem_free(nex2_ep);
                erp->er_extcount += nex2;
                xfs_iext_irec_update_extoffs(ifp, erp_idx + 1, nex2);
        }
@@ -4112,7 +4049,7 @@ xfs_iext_direct_to_inline(
         */
        memcpy(ifp->if_u2.if_inline_ext, ifp->if_u1.if_extents,
                nextents * sizeof(xfs_bmbt_rec_t));
-       kmem_free(ifp->if_u1.if_extents, ifp->if_real_bytes);
+       kmem_free(ifp->if_u1.if_extents);
        ifp->if_u1.if_extents = ifp->if_u2.if_inline_ext;
        ifp->if_real_bytes = 0;
 }
@@ -4186,7 +4123,7 @@ xfs_iext_indirect_to_direct(
        ASSERT(ifp->if_real_bytes == XFS_IEXT_BUFSZ);
 
        ep = ifp->if_u1.if_ext_irec->er_extbuf;
-       kmem_free(ifp->if_u1.if_ext_irec, sizeof(xfs_ext_irec_t));
+       kmem_free(ifp->if_u1.if_ext_irec);
        ifp->if_flags &= ~XFS_IFEXTIREC;
        ifp->if_u1.if_extents = ep;
        ifp->if_bytes = size;
@@ -4212,7 +4149,7 @@ xfs_iext_destroy(
                }
                ifp->if_flags &= ~XFS_IFEXTIREC;
        } else if (ifp->if_real_bytes) {
-               kmem_free(ifp->if_u1.if_extents, ifp->if_real_bytes);
+               kmem_free(ifp->if_u1.if_extents);
        } else if (ifp->if_bytes) {
                memset(ifp->if_u2.if_inline_ext, 0, XFS_INLINE_EXTS *
                        sizeof(xfs_bmbt_rec_t));
@@ -4483,7 +4420,7 @@ xfs_iext_irec_remove(
        if (erp->er_extbuf) {
                xfs_iext_irec_update_extoffs(ifp, erp_idx + 1,
                        -erp->er_extcount);
-               kmem_free(erp->er_extbuf, XFS_IEXT_BUFSZ);
+               kmem_free(erp->er_extbuf);
        }
        /* Compact extent records */
        erp = ifp->if_u1.if_ext_irec;
@@ -4501,8 +4438,7 @@ xfs_iext_irec_remove(
                xfs_iext_realloc_indirect(ifp,
                        nlists * sizeof(xfs_ext_irec_t));
        } else {
-               kmem_free(ifp->if_u1.if_ext_irec,
-                       sizeof(xfs_ext_irec_t));
+               kmem_free(ifp->if_u1.if_ext_irec);
        }
        ifp->if_real_bytes = nlists * XFS_IEXT_BUFSZ;
 }
@@ -4571,7 +4507,7 @@ xfs_iext_irec_compact_pages(
                         * so er_extoffs don't get modified in
                         * xfs_iext_irec_remove.
                         */
-                       kmem_free(erp_next->er_extbuf, XFS_IEXT_BUFSZ);
+                       kmem_free(erp_next->er_extbuf);
                        erp_next->er_extbuf = NULL;
                        xfs_iext_irec_remove(ifp, erp_idx + 1);
                        nlists = ifp->if_real_bytes / XFS_IEXT_BUFSZ;
@@ -4596,40 +4532,63 @@ xfs_iext_irec_compact_full(
        int             nlists;                 /* number of irec's (ex lists) */
 
        ASSERT(ifp->if_flags & XFS_IFEXTIREC);
+
        nlists = ifp->if_real_bytes / XFS_IEXT_BUFSZ;
        erp = ifp->if_u1.if_ext_irec;
        ep = &erp->er_extbuf[erp->er_extcount];
        erp_next = erp + 1;
        ep_next = erp_next->er_extbuf;
+
        while (erp_idx < nlists - 1) {
+               /*
+                * Check how many extent records are available in this irec.
+                * If there is none skip the whole exercise.
+                */
                ext_avail = XFS_LINEAR_EXTS - erp->er_extcount;
-               ext_diff = MIN(ext_avail, erp_next->er_extcount);
-               memcpy(ep, ep_next, ext_diff * sizeof(xfs_bmbt_rec_t));
-               erp->er_extcount += ext_diff;
-               erp_next->er_extcount -= ext_diff;
-               /* Remove next page */
-               if (erp_next->er_extcount == 0) {
+               if (ext_avail) {
+
                        /*
-                        * Free page before removing extent record
-                        * so er_extoffs don't get modified in
-                        * xfs_iext_irec_remove.
+                        * Copy over as many as possible extent records into
+                        * the previous page.
                         */
-                       kmem_free(erp_next->er_extbuf,
-                               erp_next->er_extcount * sizeof(xfs_bmbt_rec_t));
-                       erp_next->er_extbuf = NULL;
-                       xfs_iext_irec_remove(ifp, erp_idx + 1);
-                       erp = &ifp->if_u1.if_ext_irec[erp_idx];
-                       nlists = ifp->if_real_bytes / XFS_IEXT_BUFSZ;
-               /* Update next page */
-               } else {
-                       /* Move rest of page up to become next new page */
-                       memmove(erp_next->er_extbuf, ep_next,
-                               erp_next->er_extcount * sizeof(xfs_bmbt_rec_t));
-                       ep_next = erp_next->er_extbuf;
-                       memset(&ep_next[erp_next->er_extcount], 0,
-                               (XFS_LINEAR_EXTS - erp_next->er_extcount) *
-                               sizeof(xfs_bmbt_rec_t));
+                       ext_diff = MIN(ext_avail, erp_next->er_extcount);
+                       memcpy(ep, ep_next, ext_diff * sizeof(xfs_bmbt_rec_t));
+                       erp->er_extcount += ext_diff;
+                       erp_next->er_extcount -= ext_diff;
+
+                       /*
+                        * If the next irec is empty now we can simply
+                        * remove it.
+                        */
+                       if (erp_next->er_extcount == 0) {
+                               /*
+                                * Free page before removing extent record
+                                * so er_extoffs don't get modified in
+                                * xfs_iext_irec_remove.
+                                */
+                               kmem_free(erp_next->er_extbuf);
+                               erp_next->er_extbuf = NULL;
+                               xfs_iext_irec_remove(ifp, erp_idx + 1);
+                               erp = &ifp->if_u1.if_ext_irec[erp_idx];
+                               nlists = ifp->if_real_bytes / XFS_IEXT_BUFSZ;
+
+                       /*
+                        * If the next irec is not empty move up the content
+                        * that has not been copied to the previous page to
+                        * the beggining of this one.
+                        */
+                       } else {
+                               memmove(erp_next->er_extbuf, &ep_next[ext_diff],
+                                       erp_next->er_extcount *
+                                       sizeof(xfs_bmbt_rec_t));
+                               ep_next = erp_next->er_extbuf;
+                               memset(&ep_next[erp_next->er_extcount], 0,
+                                       (XFS_LINEAR_EXTS -
+                                               erp_next->er_extcount) *
+                                       sizeof(xfs_bmbt_rec_t));
+                       }
                }
+
                if (erp->er_extcount == XFS_LINEAR_EXTS) {
                        erp_idx++;
                        if (erp_idx < nlists)
index 0a999fe..17a04b6 100644 (file)
@@ -507,9 +507,6 @@ int         xfs_itruncate_start(xfs_inode_t *, uint, xfs_fsize_t);
 int            xfs_itruncate_finish(struct xfs_trans **, xfs_inode_t *,
                                     xfs_fsize_t, int, int);
 int            xfs_iunlink(struct xfs_trans *, xfs_inode_t *);
-int            xfs_igrow_start(xfs_inode_t *, xfs_fsize_t, struct cred *);
-void           xfs_igrow_finish(struct xfs_trans *, xfs_inode_t *,
-                                xfs_fsize_t, int);
 
 void           xfs_idestroy_fork(xfs_inode_t *, int);
 void           xfs_idestroy(xfs_inode_t *);
index 167b33f..0eee08a 100644 (file)
@@ -686,7 +686,7 @@ xfs_inode_item_unlock(
                ASSERT(ip->i_d.di_nextents > 0);
                ASSERT(iip->ili_format.ilf_fields & XFS_ILOG_DEXT);
                ASSERT(ip->i_df.if_bytes > 0);
-               kmem_free(iip->ili_extents_buf, ip->i_df.if_bytes);
+               kmem_free(iip->ili_extents_buf);
                iip->ili_extents_buf = NULL;
        }
        if (iip->ili_aextents_buf != NULL) {
@@ -694,7 +694,7 @@ xfs_inode_item_unlock(
                ASSERT(ip->i_d.di_anextents > 0);
                ASSERT(iip->ili_format.ilf_fields & XFS_ILOG_AEXT);
                ASSERT(ip->i_afp->if_bytes > 0);
-               kmem_free(iip->ili_aextents_buf, ip->i_afp->if_bytes);
+               kmem_free(iip->ili_aextents_buf);
                iip->ili_aextents_buf = NULL;
        }
 
@@ -957,8 +957,7 @@ xfs_inode_item_destroy(
 {
 #ifdef XFS_TRANS_DEBUG
        if (ip->i_itemp->ili_root_size != 0) {
-               kmem_free(ip->i_itemp->ili_orig_root,
-                         ip->i_itemp->ili_root_size);
+               kmem_free(ip->i_itemp->ili_orig_root);
        }
 #endif
        kmem_zone_free(xfs_ili_zone, ip->i_itemp);
index 7edcde6..67f22b2 100644 (file)
@@ -889,6 +889,16 @@ xfs_iomap_write_unwritten(
        count_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)offset + count);
        count_fsb = (xfs_filblks_t)(count_fsb - offset_fsb);
 
+       /*
+        * Reserve enough blocks in this transaction for two complete extent
+        * btree splits.  We may be converting the middle part of an unwritten
+        * extent and in this case we will insert two new extents in the btree
+        * each of which could cause a full split.
+        *
+        * This reservation amount will be used in the first call to
+        * xfs_bmbt_split() to select an AG with enough space to satisfy the
+        * rest of the operation.
+        */
        resblks = XFS_DIOSTRAT_SPACE_RES(mp, 0) << 1;
 
        do {
index 419de15..9a3ef9d 100644 (file)
@@ -257,7 +257,7 @@ xfs_bulkstat_one(
                *ubused = error;
 
  out_free:
-       kmem_free(buf, sizeof(*buf));
+       kmem_free(buf);
        return error;
 }
 
@@ -708,7 +708,7 @@ xfs_bulkstat(
        /*
         * Done, we're either out of filesystem or space to put the data.
         */
-       kmem_free(irbuf, irbsize);
+       kmem_free(irbuf);
        *ubcountp = ubelem;
        /*
         * Found some inodes, return them now and return the error next time.
@@ -914,7 +914,7 @@ xfs_inumbers(
                }
                *lastino = XFS_AGINO_TO_INO(mp, agno, agino);
        }
-       kmem_free(buffer, bcount * sizeof(*buffer));
+       kmem_free(buffer);
        if (cur)
                xfs_btree_del_cursor(cur, (error ? XFS_BTREE_ERROR :
                                           XFS_BTREE_NOERROR));
index ad3d26d..91b00a5 100644 (file)
@@ -226,20 +226,24 @@ xlog_grant_sub_space(struct log *log, int bytes)
 static void
 xlog_grant_add_space_write(struct log *log, int bytes)
 {
-       log->l_grant_write_bytes += bytes;
-       if (log->l_grant_write_bytes > log->l_logsize) {
-               log->l_grant_write_bytes -= log->l_logsize;
+       int tmp = log->l_logsize - log->l_grant_write_bytes;
+       if (tmp > bytes)
+               log->l_grant_write_bytes += bytes;
+       else {
                log->l_grant_write_cycle++;
+               log->l_grant_write_bytes = bytes - tmp;
        }
 }
 
 static void
 xlog_grant_add_space_reserve(struct log *log, int bytes)
 {
-       log->l_grant_reserve_bytes += bytes;
-       if (log->l_grant_reserve_bytes > log->l_logsize) {
-               log->l_grant_reserve_bytes -= log->l_logsize;
+       int tmp = log->l_logsize - log->l_grant_reserve_bytes;
+       if (tmp > bytes)
+               log->l_grant_reserve_bytes += bytes;
+       else {
                log->l_grant_reserve_cycle++;
+               log->l_grant_reserve_bytes = bytes - tmp;
        }
 }
 
@@ -1228,7 +1232,7 @@ xlog_alloc_log(xfs_mount_t        *mp,
 
        spin_lock_init(&log->l_icloglock);
        spin_lock_init(&log->l_grant_lock);
-       initnsema(&log->l_flushsema, 0, "ic-flush");
+       sv_init(&log->l_flush_wait, 0, "flush_wait");
 
        /* log record size must be multiple of BBSIZE; see xlog_rec_header_t */
        ASSERT((XFS_BUF_SIZE(bp) & BBMASK) == 0);
@@ -1570,10 +1574,9 @@ xlog_dealloc_log(xlog_t *log)
                }
 #endif
                next_iclog = iclog->ic_next;
-               kmem_free(iclog, sizeof(xlog_in_core_t));
+               kmem_free(iclog);
                iclog = next_iclog;
        }
-       freesema(&log->l_flushsema);
        spinlock_destroy(&log->l_icloglock);
        spinlock_destroy(&log->l_grant_lock);
 
@@ -1587,7 +1590,7 @@ xlog_dealloc_log(xlog_t *log)
        }
 #endif
        log->l_mp->m_log = NULL;
-       kmem_free(log, sizeof(xlog_t));
+       kmem_free(log);
 }      /* xlog_dealloc_log */
 
 /*
@@ -2097,6 +2100,7 @@ xlog_state_do_callback(
        int                funcdidcallbacks; /* flag: function did callbacks */
        int                repeats;     /* for issuing console warnings if
                                         * looping too many times */
+       int                wake = 0;
 
        spin_lock(&log->l_icloglock);
        first_iclog = iclog = log->l_iclog;
@@ -2278,15 +2282,13 @@ xlog_state_do_callback(
        }
 #endif
 
-       flushcnt = 0;
-       if (log->l_iclog->ic_state & (XLOG_STATE_ACTIVE|XLOG_STATE_IOERROR)) {
-               flushcnt = log->l_flushcnt;
-               log->l_flushcnt = 0;
-       }
+       if (log->l_iclog->ic_state & (XLOG_STATE_ACTIVE|XLOG_STATE_IOERROR))
+               wake = 1;
        spin_unlock(&log->l_icloglock);
-       while (flushcnt--)
-               vsema(&log->l_flushsema);
-}      /* xlog_state_do_callback */
+
+       if (wake)
+               sv_broadcast(&log->l_flush_wait);
+}
 
 
 /*
@@ -2384,16 +2386,15 @@ restart:
        }
 
        iclog = log->l_iclog;
-       if (! (iclog->ic_state == XLOG_STATE_ACTIVE)) {
-               log->l_flushcnt++;
-               spin_unlock(&log->l_icloglock);
+       if (iclog->ic_state != XLOG_STATE_ACTIVE) {
                xlog_trace_iclog(iclog, XLOG_TRACE_SLEEP_FLUSH);
                XFS_STATS_INC(xs_log_noiclogs);
-               /* Ensure that log writes happen */
-               psema(&log->l_flushsema, PINOD);
+
+               /* Wait for log writes to have flushed */
+               sv_wait(&log->l_flush_wait, 0, &log->l_icloglock, 0);
                goto restart;
        }
-       ASSERT(iclog->ic_state == XLOG_STATE_ACTIVE);
+
        head = &iclog->ic_header;
 
        atomic_inc(&iclog->ic_refcnt);  /* prevents sync */
index 8952a39..6245913 100644 (file)
@@ -423,10 +423,8 @@ typedef struct log {
        int                     l_logBBsize;    /* size of log in BB chunks */
 
        /* The following block of fields are changed while holding icloglock */
-       sema_t                  l_flushsema ____cacheline_aligned_in_smp;
-                                               /* iclog flushing semaphore */
-       int                     l_flushcnt;     /* # of procs waiting on this
-                                                * sema */
+       sv_t                    l_flush_wait ____cacheline_aligned_in_smp;
+                                               /* waiting for iclog flush */
        int                     l_covered_state;/* state of "covering disk
                                                 * log entries" */
        xlog_in_core_t          *l_iclog;       /* head log queue       */
index e65ab4a..9eb722e 100644 (file)
@@ -1715,8 +1715,7 @@ xlog_check_buffer_cancelled(
                                        } else {
                                                prevp->bc_next = bcp->bc_next;
                                        }
-                                       kmem_free(bcp,
-                                                 sizeof(xfs_buf_cancel_t));
+                                       kmem_free(bcp);
                                }
                        }
                        return 1;
@@ -2519,7 +2518,7 @@ write_inode_buffer:
 
 error:
        if (need_free)
-               kmem_free(in_f, sizeof(*in_f));
+               kmem_free(in_f);
        return XFS_ERROR(error);
 }
 
@@ -2830,16 +2829,14 @@ xlog_recover_free_trans(
                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,
-                                 free_item->ri_buf[i].i_len);
+                       kmem_free(free_item->ri_buf[i].i_addr);
                }
                /* Free the item itself */
-               kmem_free(free_item->ri_buf,
-                         (free_item->ri_total * sizeof(xfs_log_iovec_t)));
-               kmem_free(free_item, sizeof(xlog_recover_item_t));
+               kmem_free(free_item->ri_buf);
+               kmem_free(free_item);
        } while (first_item != item);
        /* Free the transaction recover structure */
-       kmem_free(trans, sizeof(xlog_recover_t));
+       kmem_free(trans);
 }
 
 STATIC int
@@ -3786,8 +3783,7 @@ xlog_do_log_recovery(
        error = xlog_do_recovery_pass(log, head_blk, tail_blk,
                                      XLOG_RECOVER_PASS1);
        if (error != 0) {
-               kmem_free(log->l_buf_cancel_table,
-                         XLOG_BC_TABLE_SIZE * sizeof(xfs_buf_cancel_t*));
+               kmem_free(log->l_buf_cancel_table);
                log->l_buf_cancel_table = NULL;
                return error;
        }
@@ -3806,8 +3802,7 @@ xlog_do_log_recovery(
        }
 #endif /* DEBUG */
 
-       kmem_free(log->l_buf_cancel_table,
-                 XLOG_BC_TABLE_SIZE * sizeof(xfs_buf_cancel_t*));
+       kmem_free(log->l_buf_cancel_table);
        log->l_buf_cancel_table = NULL;
 
        return error;
index da39884..6c5d132 100644 (file)
 
 STATIC int     xfs_mount_log_sb(xfs_mount_t *, __int64_t);
 STATIC int     xfs_uuid_mount(xfs_mount_t *);
-STATIC void    xfs_uuid_unmount(xfs_mount_t *mp);
 STATIC void    xfs_unmountfs_wait(xfs_mount_t *);
 
 
 #ifdef HAVE_PERCPU_SB
-STATIC void    xfs_icsb_destroy_counters(xfs_mount_t *);
 STATIC void    xfs_icsb_balance_counter(xfs_mount_t *, xfs_sb_field_t,
                                                int);
 STATIC void    xfs_icsb_balance_counter_locked(xfs_mount_t *, xfs_sb_field_t,
@@ -63,7 +61,6 @@ STATIC void   xfs_icsb_disable_counter(xfs_mount_t *, xfs_sb_field_t);
 
 #else
 
-#define xfs_icsb_destroy_counters(mp)                  do { } while (0)
 #define xfs_icsb_balance_counter(mp, a, b)             do { } while (0)
 #define xfs_icsb_balance_counter_locked(mp, a, b)      do { } while (0)
 #define xfs_icsb_modify_counters(mp, a, b, c)          do { } while (0)
@@ -125,34 +122,12 @@ static const struct {
     { sizeof(xfs_sb_t),                         0 }
 };
 
-/*
- * Return a pointer to an initialized xfs_mount structure.
- */
-xfs_mount_t *
-xfs_mount_init(void)
-{
-       xfs_mount_t *mp;
-
-       mp = kmem_zalloc(sizeof(xfs_mount_t), KM_SLEEP);
-
-       if (xfs_icsb_init_counters(mp)) {
-               mp->m_flags |= XFS_MOUNT_NO_PERCPU_SB;
-       }
-
-       spin_lock_init(&mp->m_sb_lock);
-       mutex_init(&mp->m_ilock);
-       mutex_init(&mp->m_growlock);
-       atomic_set(&mp->m_active_trans, 0);
-
-       return mp;
-}
-
 /*
  * Free up the resources associated with a mount structure.  Assume that
  * the structure was initially zeroed, so we can tell which fields got
  * initialized.
  */
-void
+STATIC void
 xfs_mount_free(
        xfs_mount_t     *mp)
 {
@@ -161,11 +136,8 @@ xfs_mount_free(
 
                for (agno = 0; agno < mp->m_maxagi; agno++)
                        if (mp->m_perag[agno].pagb_list)
-                               kmem_free(mp->m_perag[agno].pagb_list,
-                                               sizeof(xfs_perag_busy_t) *
-                                                       XFS_PAGB_NUM_SLOTS);
-               kmem_free(mp->m_perag,
-                         sizeof(xfs_perag_t) * mp->m_sb.sb_agcount);
+                               kmem_free(mp->m_perag[agno].pagb_list);
+               kmem_free(mp->m_perag);
        }
 
        spinlock_destroy(&mp->m_ail_lock);
@@ -176,13 +148,11 @@ xfs_mount_free(
                XFS_QM_DONE(mp);
 
        if (mp->m_fsname != NULL)
-               kmem_free(mp->m_fsname, mp->m_fsname_len);
+               kmem_free(mp->m_fsname);
        if (mp->m_rtname != NULL)
-               kmem_free(mp->m_rtname, strlen(mp->m_rtname) + 1);
+               kmem_free(mp->m_rtname);
        if (mp->m_logname != NULL)
-               kmem_free(mp->m_logname, strlen(mp->m_logname) + 1);
-
-       xfs_icsb_destroy_counters(mp);
+               kmem_free(mp->m_logname);
 }
 
 /*
@@ -288,6 +258,19 @@ xfs_mount_validate_sb(
                return XFS_ERROR(EFSCORRUPTED);
        }
 
+       /*
+        * Until this is fixed only page-sized or smaller data blocks work.
+        */
+       if (unlikely(sbp->sb_blocksize > PAGE_SIZE)) {
+               xfs_fs_mount_cmn_err(flags,
+                       "file system with blocksize %d bytes",
+                       sbp->sb_blocksize);
+               xfs_fs_mount_cmn_err(flags,
+                       "only pagesize (%ld) or less will currently work.",
+                       PAGE_SIZE);
+               return XFS_ERROR(ENOSYS);
+       }
+
        if (xfs_sb_validate_fsb_count(sbp, sbp->sb_dblocks) ||
            xfs_sb_validate_fsb_count(sbp, sbp->sb_rblocks)) {
                xfs_fs_mount_cmn_err(flags,
@@ -309,19 +292,6 @@ xfs_mount_validate_sb(
                return XFS_ERROR(ENOSYS);
        }
 
-       /*
-        * Until this is fixed only page-sized or smaller data blocks work.
-        */
-       if (unlikely(sbp->sb_blocksize > PAGE_SIZE)) {
-               xfs_fs_mount_cmn_err(flags,
-                       "file system with blocksize %d bytes",
-                       sbp->sb_blocksize);
-               xfs_fs_mount_cmn_err(flags,
-                       "only pagesize (%ld) or less will currently work.",
-                       PAGE_SIZE);
-               return XFS_ERROR(ENOSYS);
-       }
-
        return 0;
 }
 
@@ -994,9 +964,19 @@ xfs_mountfs(
                 * Re-check for ATTR2 in case it was found in bad_features2
                 * slot.
                 */
-               if (xfs_sb_version_hasattr2(&mp->m_sb))
+               if (xfs_sb_version_hasattr2(&mp->m_sb) &&
+                  !(mp->m_flags & XFS_MOUNT_NOATTR2))
                        mp->m_flags |= XFS_MOUNT_ATTR2;
+       }
+
+       if (xfs_sb_version_hasattr2(&mp->m_sb) &&
+          (mp->m_flags & XFS_MOUNT_NOATTR2)) {
+               xfs_sb_version_removeattr2(&mp->m_sb);
+               update_flags |= XFS_SB_FEATURES2;
 
+               /* update sb_versionnum for the clearing of the morebits */
+               if (!sbp->sb_features2)
+                       update_flags |= XFS_SB_VERSIONNUM;
        }
 
        /*
@@ -1255,15 +1235,13 @@ xfs_mountfs(
  error2:
        for (agno = 0; agno < sbp->sb_agcount; agno++)
                if (mp->m_perag[agno].pagb_list)
-                       kmem_free(mp->m_perag[agno].pagb_list,
-                         sizeof(xfs_perag_busy_t) * XFS_PAGB_NUM_SLOTS);
-       kmem_free(mp->m_perag, sbp->sb_agcount * sizeof(xfs_perag_t));
+                       kmem_free(mp->m_perag[agno].pagb_list);
+       kmem_free(mp->m_perag);
        mp->m_perag = NULL;
        /* FALLTHROUGH */
  error1:
        if (uuid_mounted)
-               xfs_uuid_unmount(mp);
-       xfs_freesb(mp);
+               uuid_table_remove(&mp->m_sb.sb_uuid);
        return error;
 }
 
@@ -1274,7 +1252,7 @@ xfs_mountfs(
  * log and makes sure that incore structures are freed.
  */
 int
-xfs_unmountfs(xfs_mount_t *mp, struct cred *cr)
+xfs_unmountfs(xfs_mount_t *mp)
 {
        __uint64_t      resblks;
        int             error = 0;
@@ -1341,9 +1319,8 @@ xfs_unmountfs(xfs_mount_t *mp, struct cred *cr)
         */
        ASSERT(mp->m_inodes == NULL);
 
-       xfs_unmountfs_close(mp, cr);
        if ((mp->m_flags & XFS_MOUNT_NOUUID) == 0)
-               xfs_uuid_unmount(mp);
+               uuid_table_remove(&mp->m_sb.sb_uuid);
 
 #if defined(DEBUG) || defined(INDUCE_IO_ERROR)
        xfs_errortag_clearall(mp, 0);
@@ -1352,16 +1329,6 @@ xfs_unmountfs(xfs_mount_t *mp, struct cred *cr)
        return 0;
 }
 
-void
-xfs_unmountfs_close(xfs_mount_t *mp, struct cred *cr)
-{
-       if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp)
-               xfs_free_buftarg(mp->m_logdev_targp, 1);
-       if (mp->m_rtdev_targp)
-               xfs_free_buftarg(mp->m_rtdev_targp, 1);
-       xfs_free_buftarg(mp->m_ddev_targp, 0);
-}
-
 STATIC void
 xfs_unmountfs_wait(xfs_mount_t *mp)
 {
@@ -1904,16 +1871,6 @@ xfs_uuid_mount(
        return 0;
 }
 
-/*
- * Remove filesystem from the UUID table.
- */
-STATIC void
-xfs_uuid_unmount(
-       xfs_mount_t     *mp)
-{
-       uuid_table_remove(&mp->m_sb.sb_uuid);
-}
-
 /*
  * Used to log changes to the superblock unit and width fields which could
  * be altered by the mount options, as well as any potential sb_features2
@@ -1928,7 +1885,8 @@ xfs_mount_log_sb(
        int             error;
 
        ASSERT(fields & (XFS_SB_UNIT | XFS_SB_WIDTH | XFS_SB_UUID |
-                        XFS_SB_FEATURES2 | XFS_SB_BAD_FEATURES2));
+                        XFS_SB_FEATURES2 | XFS_SB_BAD_FEATURES2 |
+                        XFS_SB_VERSIONNUM));
 
        tp = xfs_trans_alloc(mp, XFS_TRANS_SB_UNIT);
        error = xfs_trans_reserve(tp, 0, mp->m_sb.sb_sectsize + 128, 0, 0,
@@ -2109,7 +2067,7 @@ xfs_icsb_reinit_counters(
        xfs_icsb_unlock(mp);
 }
 
-STATIC void
+void
 xfs_icsb_destroy_counters(
        xfs_mount_t     *mp)
 {
index 63e0693..5269bd6 100644 (file)
@@ -61,6 +61,7 @@ struct xfs_bmap_free;
 struct xfs_extdelta;
 struct xfs_swapext;
 struct xfs_mru_cache;
+struct xfs_nameops;
 
 /*
  * Prototypes and functions for the Data Migration subsystem.
@@ -210,12 +211,14 @@ typedef struct xfs_icsb_cnts {
 
 extern int     xfs_icsb_init_counters(struct xfs_mount *);
 extern void    xfs_icsb_reinit_counters(struct xfs_mount *);
+extern void    xfs_icsb_destroy_counters(struct xfs_mount *);
 extern void    xfs_icsb_sync_counters(struct xfs_mount *, int);
 extern void    xfs_icsb_sync_counters_locked(struct xfs_mount *, int);
 
 #else
-#define xfs_icsb_init_counters(mp)     (0)
-#define xfs_icsb_reinit_counters(mp)   do { } while (0)
+#define xfs_icsb_init_counters(mp)             (0)
+#define xfs_icsb_destroy_counters(mp)          do { } while (0)
+#define xfs_icsb_reinit_counters(mp)           do { } while (0)
 #define xfs_icsb_sync_counters(mp, flags)      do { } while (0)
 #define xfs_icsb_sync_counters_locked(mp, flags) do { } while (0)
 #endif
@@ -313,6 +316,7 @@ typedef struct xfs_mount {
        __uint8_t               m_inode_quiesce;/* call quiesce on new inodes.
                                                   field governed by m_ilock */
        __uint8_t               m_sectbb_log;   /* sectlog - BBSHIFT */
+       const struct xfs_nameops *m_dirnameops; /* vector of dir name ops */
        int                     m_dirblksize;   /* directory block sz--bytes */
        int                     m_dirblkfsbs;   /* directory block sz--fsbs */
        xfs_dablk_t             m_dirdatablk;   /* blockno of dir data v2 */
@@ -378,6 +382,7 @@ typedef struct xfs_mount {
                                                   counters */
 #define XFS_MOUNT_FILESTREAMS  (1ULL << 24)    /* enable the filestreams
                                                   allocator */
+#define XFS_MOUNT_NOATTR2      (1ULL << 25)    /* disable use of attr2 format */
 
 
 /*
@@ -510,15 +515,12 @@ typedef struct xfs_mod_sb {
 #define        XFS_MOUNT_ILOCK(mp)     mutex_lock(&((mp)->m_ilock))
 #define        XFS_MOUNT_IUNLOCK(mp)   mutex_unlock(&((mp)->m_ilock))
 
-extern xfs_mount_t *xfs_mount_init(void);
 extern void    xfs_mod_sb(xfs_trans_t *, __int64_t);
 extern int     xfs_log_sbcount(xfs_mount_t *, uint);
-extern void    xfs_mount_free(xfs_mount_t *mp);
 extern int     xfs_mountfs(xfs_mount_t *mp, int);
 extern void    xfs_mountfs_check_barriers(xfs_mount_t *mp);
 
-extern int     xfs_unmountfs(xfs_mount_t *, struct cred *);
-extern void    xfs_unmountfs_close(xfs_mount_t *, struct cred *);
+extern int     xfs_unmountfs(xfs_mount_t *);
 extern int     xfs_unmountfs_writesb(xfs_mount_t *);
 extern int     xfs_unmount_flush(xfs_mount_t *, int);
 extern int     xfs_mod_incore_sb(xfs_mount_t *, xfs_sb_field_t, int64_t, int);
@@ -544,9 +546,6 @@ extern void xfs_qmops_put(struct xfs_mount *);
 
 extern struct xfs_dmops xfs_dmcore_xfs;
 
-extern int     xfs_init(void);
-extern void    xfs_cleanup(void);
-
 #endif /* __KERNEL__ */
 
 #endif /* __XFS_MOUNT_H__ */
index a0b2c0a..afee7eb 100644 (file)
@@ -307,15 +307,18 @@ xfs_mru_cache_init(void)
        xfs_mru_elem_zone = kmem_zone_init(sizeof(xfs_mru_cache_elem_t),
                                         "xfs_mru_cache_elem");
        if (!xfs_mru_elem_zone)
-               return ENOMEM;
+               goto out;
 
        xfs_mru_reap_wq = create_singlethread_workqueue("xfs_mru_cache");
-       if (!xfs_mru_reap_wq) {
-               kmem_zone_destroy(xfs_mru_elem_zone);
-               return ENOMEM;
-       }
+       if (!xfs_mru_reap_wq)
+               goto out_destroy_mru_elem_zone;
 
        return 0;
+
+ out_destroy_mru_elem_zone:
+       kmem_zone_destroy(xfs_mru_elem_zone);
+ out:
+       return -ENOMEM;
 }
 
 void
@@ -382,9 +385,9 @@ xfs_mru_cache_create(
 
 exit:
        if (err && mru && mru->lists)
-               kmem_free(mru->lists, mru->grp_count * sizeof(*mru->lists));
+               kmem_free(mru->lists);
        if (err && mru)
-               kmem_free(mru, sizeof(*mru));
+               kmem_free(mru);
 
        return err;
 }
@@ -424,8 +427,8 @@ xfs_mru_cache_destroy(
 
        xfs_mru_cache_flush(mru);
 
-       kmem_free(mru->lists, mru->grp_count * sizeof(*mru->lists));
-       kmem_free(mru, sizeof(*mru));
+       kmem_free(mru->lists);
+       kmem_free(mru);
 }
 
 /*
index d8063e1..d700dac 100644 (file)
@@ -336,21 +336,17 @@ xfs_rename(
                ASSERT(error != EEXIST);
                if (error)
                        goto abort_return;
-               xfs_ichgtime(src_ip, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
-
-       } else {
-               /*
-                * We always want to hit the ctime on the source inode.
-                * We do it in the if clause above for the 'new_parent &&
-                * src_is_directory' case, and here we get all the other
-                * cases.  This isn't strictly required by the standards
-                * since the source inode isn't really being changed,
-                * but old unix file systems did it and some incremental
-                * backup programs won't work without it.
-                */
-               xfs_ichgtime(src_ip, XFS_ICHGTIME_CHG);
        }
 
+       /*
+        * We always want to hit the ctime on the source inode.
+        *
+        * This isn't strictly required by the standards since the source
+        * inode isn't really being changed, but old unix file systems did
+        * it and some incremental backup programs won't work without it.
+        */
+       xfs_ichgtime(src_ip, XFS_ICHGTIME_CHG);
+
        /*
         * Adjust the link count on src_dp.  This is necessary when
         * renaming a directory, either within one parent when
index a0dc6e5..bf87a59 100644 (file)
@@ -2062,7 +2062,7 @@ xfs_growfs_rt(
        /*
         * Free the fake mp structure.
         */
-       kmem_free(nmp, sizeof(*nmp));
+       kmem_free(nmp);
 
        return error;
 }
index d904efe..3f8cf15 100644 (file)
@@ -46,10 +46,12 @@ struct xfs_mount;
 #define XFS_SB_VERSION_SECTORBIT       0x0800
 #define        XFS_SB_VERSION_EXTFLGBIT        0x1000
 #define        XFS_SB_VERSION_DIRV2BIT         0x2000
+#define        XFS_SB_VERSION_BORGBIT          0x4000  /* ASCII only case-insens. */
 #define        XFS_SB_VERSION_MOREBITSBIT      0x8000
 #define        XFS_SB_VERSION_OKSASHFBITS      \
        (XFS_SB_VERSION_EXTFLGBIT | \
-        XFS_SB_VERSION_DIRV2BIT)
+        XFS_SB_VERSION_DIRV2BIT | \
+        XFS_SB_VERSION_BORGBIT)
 #define        XFS_SB_VERSION_OKREALFBITS      \
        (XFS_SB_VERSION_ATTRBIT | \
         XFS_SB_VERSION_NLINKBIT | \
@@ -437,6 +439,12 @@ static inline int xfs_sb_version_hassector(xfs_sb_t *sbp)
                ((sbp)->sb_versionnum & XFS_SB_VERSION_SECTORBIT);
 }
 
+static inline int xfs_sb_version_hasasciici(xfs_sb_t *sbp)
+{
+       return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
+               (sbp->sb_versionnum & XFS_SB_VERSION_BORGBIT);
+}
+
 static inline int xfs_sb_version_hasmorebits(xfs_sb_t *sbp)
 {
        return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
@@ -473,6 +481,13 @@ static inline void xfs_sb_version_addattr2(xfs_sb_t *sbp)
                ((sbp)->sb_features2 | XFS_SB_VERSION2_ATTR2BIT)));
 }
 
+static inline void xfs_sb_version_removeattr2(xfs_sb_t *sbp)
+{
+       sbp->sb_features2 &= ~XFS_SB_VERSION2_ATTR2BIT;
+       if (!sbp->sb_features2)
+               sbp->sb_versionnum &= ~XFS_SB_VERSION_MOREBITSBIT;
+}
+
 /*
  * end of superblock version macros
  */
index 1403864..e4ebddd 100644 (file)
@@ -889,7 +889,7 @@ shut_us_down:
 
        tp->t_commit_lsn = commit_lsn;
        if (nvec > XFS_TRANS_LOGVEC_COUNT) {
-               kmem_free(log_vector, nvec * sizeof(xfs_log_iovec_t));
+               kmem_free(log_vector);
        }
 
        /*
@@ -1265,7 +1265,7 @@ xfs_trans_committed(
                ASSERT(!XFS_LIC_ARE_ALL_FREE(licp));
                xfs_trans_chunk_committed(licp, tp->t_lsn, abortflag);
                next_licp = licp->lic_next;
-               kmem_free(licp, sizeof(xfs_log_item_chunk_t));
+               kmem_free(licp);
                licp = next_licp;
        }
 
index 4c70bf5..2a1c0f0 100644 (file)
@@ -291,7 +291,7 @@ xfs_trans_inode_broot_debug(
        iip = ip->i_itemp;
        if (iip->ili_root_size != 0) {
                ASSERT(iip->ili_orig_root != NULL);
-               kmem_free(iip->ili_orig_root, iip->ili_root_size);
+               kmem_free(iip->ili_orig_root);
                iip->ili_root_size = 0;
                iip->ili_orig_root = NULL;
        }
index 66a09f0..db5c835 100644 (file)
@@ -161,7 +161,7 @@ xfs_trans_free_item(xfs_trans_t     *tp, xfs_log_item_desc_t *lidp)
                        licpp = &((*licpp)->lic_next);
                }
                *licpp = licp->lic_next;
-               kmem_free(licp, sizeof(xfs_log_item_chunk_t));
+               kmem_free(licp);
                tp->t_items_free -= XFS_LIC_NUM_SLOTS;
        }
 }
@@ -314,7 +314,7 @@ xfs_trans_free_items(
                ASSERT(!XFS_LIC_ARE_ALL_FREE(licp));
                (void) xfs_trans_unlock_chunk(licp, 1, abort, NULLCOMMITLSN);
                next_licp = licp->lic_next;
-               kmem_free(licp, sizeof(xfs_log_item_chunk_t));
+               kmem_free(licp);
                licp = next_licp;
        }
 
@@ -363,7 +363,7 @@ xfs_trans_unlock_items(xfs_trans_t *tp, xfs_lsn_t commit_lsn)
                next_licp = licp->lic_next;
                if (XFS_LIC_ARE_ALL_FREE(licp)) {
                        *licpp = next_licp;
-                       kmem_free(licp, sizeof(xfs_log_item_chunk_t));
+                       kmem_free(licp);
                        freed -= XFS_LIC_NUM_SLOTS;
                } else {
                        licpp = &(licp->lic_next);
@@ -530,7 +530,7 @@ xfs_trans_free_busy(xfs_trans_t *tp)
        lbcp = tp->t_busy.lbc_next;
        while (lbcp != NULL) {
                lbcq = lbcp->lbc_next;
-               kmem_free(lbcp, sizeof(xfs_log_busy_chunk_t));
+               kmem_free(lbcp);
                lbcp = lbcq;
        }
 
index 30bacd8..4a9a433 100644 (file)
 #include "xfs_utils.h"
 
 
-int __init
-xfs_init(void)
-{
-#ifdef XFS_DABUF_DEBUG
-       extern spinlock_t        xfs_dabuf_global_lock;
-       spin_lock_init(&xfs_dabuf_global_lock);
-#endif
-
-       /*
-        * Initialize all of the zone allocators we use.
-        */
-       xfs_log_ticket_zone = kmem_zone_init(sizeof(xlog_ticket_t),
-                                               "xfs_log_ticket");
-       xfs_bmap_free_item_zone = kmem_zone_init(sizeof(xfs_bmap_free_item_t),
-                                               "xfs_bmap_free_item");
-       xfs_btree_cur_zone = kmem_zone_init(sizeof(xfs_btree_cur_t),
-                                               "xfs_btree_cur");
-       xfs_da_state_zone = kmem_zone_init(sizeof(xfs_da_state_t),
-                                               "xfs_da_state");
-       xfs_dabuf_zone = kmem_zone_init(sizeof(xfs_dabuf_t), "xfs_dabuf");
-       xfs_ifork_zone = kmem_zone_init(sizeof(xfs_ifork_t), "xfs_ifork");
-       xfs_trans_zone = kmem_zone_init(sizeof(xfs_trans_t), "xfs_trans");
-       xfs_acl_zone_init(xfs_acl_zone, "xfs_acl");
-       xfs_mru_cache_init();
-       xfs_filestream_init();
-
-       /*
-        * The size of the zone allocated buf log item is the maximum
-        * size possible under XFS.  This wastes a little bit of memory,
-        * but it is much faster.
-        */
-       xfs_buf_item_zone =
-               kmem_zone_init((sizeof(xfs_buf_log_item_t) +
-                               (((XFS_MAX_BLOCKSIZE / XFS_BLI_CHUNK) /
-                                 NBWORD) * sizeof(int))),
-                              "xfs_buf_item");
-       xfs_efd_zone =
-               kmem_zone_init((sizeof(xfs_efd_log_item_t) +
-                              ((XFS_EFD_MAX_FAST_EXTENTS - 1) *
-                                sizeof(xfs_extent_t))),
-                                     "xfs_efd_item");
-       xfs_efi_zone =
-               kmem_zone_init((sizeof(xfs_efi_log_item_t) +
-                              ((XFS_EFI_MAX_FAST_EXTENTS - 1) *
-                                sizeof(xfs_extent_t))),
-                                     "xfs_efi_item");
-
-       /*
-        * These zones warrant special memory allocator hints
-        */
-       xfs_inode_zone =
-               kmem_zone_init_flags(sizeof(xfs_inode_t), "xfs_inode",
-                                       KM_ZONE_HWALIGN | KM_ZONE_RECLAIM |
-                                       KM_ZONE_SPREAD, NULL);
-       xfs_ili_zone =
-               kmem_zone_init_flags(sizeof(xfs_inode_log_item_t), "xfs_ili",
-                                       KM_ZONE_SPREAD, NULL);
-
-       /*
-        * Allocate global trace buffers.
-        */
-#ifdef XFS_ALLOC_TRACE
-       xfs_alloc_trace_buf = ktrace_alloc(XFS_ALLOC_TRACE_SIZE, KM_SLEEP);
-#endif
-#ifdef XFS_BMAP_TRACE
-       xfs_bmap_trace_buf = ktrace_alloc(XFS_BMAP_TRACE_SIZE, KM_SLEEP);
-#endif
-#ifdef XFS_BMBT_TRACE
-       xfs_bmbt_trace_buf = ktrace_alloc(XFS_BMBT_TRACE_SIZE, KM_SLEEP);
-#endif
-#ifdef XFS_ATTR_TRACE
-       xfs_attr_trace_buf = ktrace_alloc(XFS_ATTR_TRACE_SIZE, KM_SLEEP);
-#endif
-#ifdef XFS_DIR2_TRACE
-       xfs_dir2_trace_buf = ktrace_alloc(XFS_DIR2_GTRACE_SIZE, KM_SLEEP);
-#endif
-
-       xfs_dir_startup();
-
-#if (defined(DEBUG) || defined(INDUCE_IO_ERROR))
-       xfs_error_test_init();
-#endif /* DEBUG || INDUCE_IO_ERROR */
-
-       xfs_init_procfs();
-       xfs_sysctl_register();
-       return 0;
-}
-
-void __exit
-xfs_cleanup(void)
-{
-       extern kmem_zone_t      *xfs_inode_zone;
-       extern kmem_zone_t      *xfs_efd_zone;
-       extern kmem_zone_t      *xfs_efi_zone;
-
-       xfs_cleanup_procfs();
-       xfs_sysctl_unregister();
-       xfs_filestream_uninit();
-       xfs_mru_cache_uninit();
-       xfs_acl_zone_destroy(xfs_acl_zone);
-
-#ifdef XFS_DIR2_TRACE
-       ktrace_free(xfs_dir2_trace_buf);
-#endif
-#ifdef XFS_ATTR_TRACE
-       ktrace_free(xfs_attr_trace_buf);
-#endif
-#ifdef XFS_BMBT_TRACE
-       ktrace_free(xfs_bmbt_trace_buf);
-#endif
-#ifdef XFS_BMAP_TRACE
-       ktrace_free(xfs_bmap_trace_buf);
-#endif
-#ifdef XFS_ALLOC_TRACE
-       ktrace_free(xfs_alloc_trace_buf);
-#endif
-
-       kmem_zone_destroy(xfs_bmap_free_item_zone);
-       kmem_zone_destroy(xfs_btree_cur_zone);
-       kmem_zone_destroy(xfs_inode_zone);
-       kmem_zone_destroy(xfs_trans_zone);
-       kmem_zone_destroy(xfs_da_state_zone);
-       kmem_zone_destroy(xfs_dabuf_zone);
-       kmem_zone_destroy(xfs_buf_item_zone);
-       kmem_zone_destroy(xfs_efd_zone);
-       kmem_zone_destroy(xfs_efi_zone);
-       kmem_zone_destroy(xfs_ifork_zone);
-       kmem_zone_destroy(xfs_ili_zone);
-       kmem_zone_destroy(xfs_log_ticket_zone);
-}
-
-/*
- * xfs_start_flags
- *
- * This function fills in xfs_mount_t fields based on mount args.
- * Note: the superblock has _not_ yet been read in.
- */
-STATIC int
-xfs_start_flags(
-       struct xfs_mount_args   *ap,
-       struct xfs_mount        *mp)
-{
-       /* Values are in BBs */
-       if ((ap->flags & XFSMNT_NOALIGN) != XFSMNT_NOALIGN) {
-               /*
-                * At this point the superblock has not been read
-                * in, therefore we do not know the block size.
-                * Before the mount call ends we will convert
-                * these to FSBs.
-                */
-               mp->m_dalign = ap->sunit;
-               mp->m_swidth = ap->swidth;
-       }
-
-       if (ap->logbufs != -1 &&
-           ap->logbufs != 0 &&
-           (ap->logbufs < XLOG_MIN_ICLOGS ||
-            ap->logbufs > XLOG_MAX_ICLOGS)) {
-               cmn_err(CE_WARN,
-                       "XFS: invalid logbufs value: %d [not %d-%d]",
-                       ap->logbufs, XLOG_MIN_ICLOGS, XLOG_MAX_ICLOGS);
-               return XFS_ERROR(EINVAL);
-       }
-       mp->m_logbufs = ap->logbufs;
-       if (ap->logbufsize != -1 &&
-           ap->logbufsize !=  0 &&
-           (ap->logbufsize < XLOG_MIN_RECORD_BSIZE ||
-            ap->logbufsize > XLOG_MAX_RECORD_BSIZE ||
-            !is_power_of_2(ap->logbufsize))) {
-               cmn_err(CE_WARN,
-       "XFS: invalid logbufsize: %d [not 16k,32k,64k,128k or 256k]",
-                       ap->logbufsize);
-               return XFS_ERROR(EINVAL);
-       }
-       mp->m_logbsize = ap->logbufsize;
-       mp->m_fsname_len = strlen(ap->fsname) + 1;
-       mp->m_fsname = kmem_alloc(mp->m_fsname_len, KM_SLEEP);
-       strcpy(mp->m_fsname, ap->fsname);
-       if (ap->rtname[0]) {
-               mp->m_rtname = kmem_alloc(strlen(ap->rtname) + 1, KM_SLEEP);
-               strcpy(mp->m_rtname, ap->rtname);
-       }
-       if (ap->logname[0]) {
-               mp->m_logname = kmem_alloc(strlen(ap->logname) + 1, KM_SLEEP);
-               strcpy(mp->m_logname, ap->logname);
-       }
-
-       if (ap->flags & XFSMNT_WSYNC)
-               mp->m_flags |= XFS_MOUNT_WSYNC;
-#if XFS_BIG_INUMS
-       if (ap->flags & XFSMNT_INO64) {
-               mp->m_flags |= XFS_MOUNT_INO64;
-               mp->m_inoadd = XFS_INO64_OFFSET;
-       }
-#endif
-       if (ap->flags & XFSMNT_RETERR)
-               mp->m_flags |= XFS_MOUNT_RETERR;
-       if (ap->flags & XFSMNT_NOALIGN)
-               mp->m_flags |= XFS_MOUNT_NOALIGN;
-       if (ap->flags & XFSMNT_SWALLOC)
-               mp->m_flags |= XFS_MOUNT_SWALLOC;
-       if (ap->flags & XFSMNT_OSYNCISOSYNC)
-               mp->m_flags |= XFS_MOUNT_OSYNCISOSYNC;
-       if (ap->flags & XFSMNT_32BITINODES)
-               mp->m_flags |= XFS_MOUNT_32BITINODES;
-
-       if (ap->flags & XFSMNT_IOSIZE) {
-               if (ap->iosizelog > XFS_MAX_IO_LOG ||
-                   ap->iosizelog < XFS_MIN_IO_LOG) {
-                       cmn_err(CE_WARN,
-               "XFS: invalid log iosize: %d [not %d-%d]",
-                               ap->iosizelog, XFS_MIN_IO_LOG,
-                               XFS_MAX_IO_LOG);
-                       return XFS_ERROR(EINVAL);
-               }
-
-               mp->m_flags |= XFS_MOUNT_DFLT_IOSIZE;
-               mp->m_readio_log = mp->m_writeio_log = ap->iosizelog;
-       }
-
-       if (ap->flags & XFSMNT_IKEEP)
-               mp->m_flags |= XFS_MOUNT_IKEEP;
-       if (ap->flags & XFSMNT_DIRSYNC)
-               mp->m_flags |= XFS_MOUNT_DIRSYNC;
-       if (ap->flags & XFSMNT_ATTR2)
-               mp->m_flags |= XFS_MOUNT_ATTR2;
-
-       if (ap->flags2 & XFSMNT2_COMPAT_IOSIZE)
-               mp->m_flags |= XFS_MOUNT_COMPAT_IOSIZE;
-
-       /*
-        * no recovery flag requires a read-only mount
-        */
-       if (ap->flags & XFSMNT_NORECOVERY) {
-               if (!(mp->m_flags & XFS_MOUNT_RDONLY)) {
-                       cmn_err(CE_WARN,
-       "XFS: tried to mount a FS read-write without recovery!");
-                       return XFS_ERROR(EINVAL);
-               }
-               mp->m_flags |= XFS_MOUNT_NORECOVERY;
-       }
-
-       if (ap->flags & XFSMNT_NOUUID)
-               mp->m_flags |= XFS_MOUNT_NOUUID;
-       if (ap->flags & XFSMNT_BARRIER)
-               mp->m_flags |= XFS_MOUNT_BARRIER;
-       else
-               mp->m_flags &= ~XFS_MOUNT_BARRIER;
-
-       if (ap->flags2 & XFSMNT2_FILESTREAMS)
-               mp->m_flags |= XFS_MOUNT_FILESTREAMS;
-
-       if (ap->flags & XFSMNT_DMAPI)
-               mp->m_flags |= XFS_MOUNT_DMAPI;
-       return 0;
-}
-
-/*
- * This function fills in xfs_mount_t fields based on mount args.
- * Note: the superblock _has_ now been read in.
- */
-STATIC int
-xfs_finish_flags(
-       struct xfs_mount_args   *ap,
-       struct xfs_mount        *mp)
-{
-       int                     ronly = (mp->m_flags & XFS_MOUNT_RDONLY);
-
-       /* Fail a mount where the logbuf is smaller then the log stripe */
-       if (xfs_sb_version_haslogv2(&mp->m_sb)) {
-               if ((ap->logbufsize <= 0) &&
-                   (mp->m_sb.sb_logsunit > XLOG_BIG_RECORD_BSIZE)) {
-                       mp->m_logbsize = mp->m_sb.sb_logsunit;
-               } else if (ap->logbufsize > 0 &&
-                          ap->logbufsize < mp->m_sb.sb_logsunit) {
-                       cmn_err(CE_WARN,
-       "XFS: logbuf size must be greater than or equal to log stripe size");
-                       return XFS_ERROR(EINVAL);
-               }
-       } else {
-               /* Fail a mount if the logbuf is larger than 32K */
-               if (ap->logbufsize > XLOG_BIG_RECORD_BSIZE) {
-                       cmn_err(CE_WARN,
-       "XFS: logbuf size for version 1 logs must be 16K or 32K");
-                       return XFS_ERROR(EINVAL);
-               }
-       }
-
-       if (xfs_sb_version_hasattr2(&mp->m_sb))
-               mp->m_flags |= XFS_MOUNT_ATTR2;
-
-       /*
-        * prohibit r/w mounts of read-only filesystems
-        */
-       if ((mp->m_sb.sb_flags & XFS_SBF_READONLY) && !ronly) {
-               cmn_err(CE_WARN,
-       "XFS: cannot mount a read-only filesystem as read-write");
-               return XFS_ERROR(EROFS);
-       }
-
-       /*
-        * check for shared mount.
-        */
-       if (ap->flags & XFSMNT_SHARED) {
-               if (!xfs_sb_version_hasshared(&mp->m_sb))
-                       return XFS_ERROR(EINVAL);
-
-               /*
-                * For IRIX 6.5, shared mounts must have the shared
-                * version bit set, have the persistent readonly
-                * field set, must be version 0 and can only be mounted
-                * read-only.
-                */
-               if (!ronly || !(mp->m_sb.sb_flags & XFS_SBF_READONLY) ||
-                    (mp->m_sb.sb_shared_vn != 0))
-                       return XFS_ERROR(EINVAL);
-
-               mp->m_flags |= XFS_MOUNT_SHARED;
-
-               /*
-                * Shared XFS V0 can't deal with DMI.  Return EINVAL.
-                */
-               if (mp->m_sb.sb_shared_vn == 0 && (ap->flags & XFSMNT_DMAPI))
-                       return XFS_ERROR(EINVAL);
-       }
-
-       if (ap->flags & XFSMNT_UQUOTA) {
-               mp->m_qflags |= (XFS_UQUOTA_ACCT | XFS_UQUOTA_ACTIVE);
-               if (ap->flags & XFSMNT_UQUOTAENF)
-                       mp->m_qflags |= XFS_UQUOTA_ENFD;
-       }
-
-       if (ap->flags & XFSMNT_GQUOTA) {
-               mp->m_qflags |= (XFS_GQUOTA_ACCT | XFS_GQUOTA_ACTIVE);
-               if (ap->flags & XFSMNT_GQUOTAENF)
-                       mp->m_qflags |= XFS_OQUOTA_ENFD;
-       } else if (ap->flags & XFSMNT_PQUOTA) {
-               mp->m_qflags |= (XFS_PQUOTA_ACCT | XFS_PQUOTA_ACTIVE);
-               if (ap->flags & XFSMNT_PQUOTAENF)
-                       mp->m_qflags |= XFS_OQUOTA_ENFD;
-       }
-
-       return 0;
-}
-
-/*
- * xfs_mount
- *
- * The file system configurations are:
- *     (1) device (partition) with data and internal log
- *     (2) logical volume with data and log subvolumes.
- *     (3) logical volume with data, log, and realtime subvolumes.
- *
- * We only have to handle opening the log and realtime volumes here if
- * they are present.  The data subvolume has already been opened by
- * get_sb_bdev() and is stored in vfsp->vfs_super->s_bdev.
- */
-int
-xfs_mount(
-       struct xfs_mount        *mp,
-       struct xfs_mount_args   *args,
-       cred_t                  *credp)
-{
-       struct block_device     *ddev, *logdev, *rtdev;
-       int                     flags = 0, error;
-
-       ddev = mp->m_super->s_bdev;
-       logdev = rtdev = NULL;
-
-       error = xfs_dmops_get(mp, args);
-       if (error)
-               return error;
-       error = xfs_qmops_get(mp, args);
-       if (error)
-               return error;
-
-       if (args->flags & XFSMNT_QUIET)
-               flags |= XFS_MFSI_QUIET;
-
-       /*
-        * Open real time and log devices - order is important.
-        */
-       if (args->logname[0]) {
-               error = xfs_blkdev_get(mp, args->logname, &logdev);
-               if (error)
-                       return error;
-       }
-       if (args->rtname[0]) {
-               error = xfs_blkdev_get(mp, args->rtname, &rtdev);
-               if (error) {
-                       xfs_blkdev_put(logdev);
-                       return error;
-               }
-
-               if (rtdev == ddev || rtdev == logdev) {
-                       cmn_err(CE_WARN,
-       "XFS: Cannot mount filesystem with identical rtdev and ddev/logdev.");
-                       xfs_blkdev_put(logdev);
-                       xfs_blkdev_put(rtdev);
-                       return EINVAL;
-               }
-       }
-
-       /*
-        * Setup xfs_mount buffer target pointers
-        */
-       error = ENOMEM;
-       mp->m_ddev_targp = xfs_alloc_buftarg(ddev, 0);
-       if (!mp->m_ddev_targp) {
-               xfs_blkdev_put(logdev);
-               xfs_blkdev_put(rtdev);
-               return error;
-       }
-       if (rtdev) {
-               mp->m_rtdev_targp = xfs_alloc_buftarg(rtdev, 1);
-               if (!mp->m_rtdev_targp) {
-                       xfs_blkdev_put(logdev);
-                       xfs_blkdev_put(rtdev);
-                       goto error0;
-               }
-       }
-       mp->m_logdev_targp = (logdev && logdev != ddev) ?
-                               xfs_alloc_buftarg(logdev, 1) : mp->m_ddev_targp;
-       if (!mp->m_logdev_targp) {
-               xfs_blkdev_put(logdev);
-               xfs_blkdev_put(rtdev);
-               goto error0;
-       }
-
-       /*
-        * Setup flags based on mount(2) options and then the superblock
-        */
-       error = xfs_start_flags(args, mp);
-       if (error)
-               goto error1;
-       error = xfs_readsb(mp, flags);
-       if (error)
-               goto error1;
-       error = xfs_finish_flags(args, mp);
-       if (error)
-               goto error2;
-
-       /*
-        * Setup xfs_mount buffer target pointers based on superblock
-        */
-       error = xfs_setsize_buftarg(mp->m_ddev_targp, mp->m_sb.sb_blocksize,
-                                   mp->m_sb.sb_sectsize);
-       if (!error && logdev && logdev != ddev) {
-               unsigned int    log_sector_size = BBSIZE;
-
-               if (xfs_sb_version_hassector(&mp->m_sb))
-                       log_sector_size = mp->m_sb.sb_logsectsize;
-               error = xfs_setsize_buftarg(mp->m_logdev_targp,
-                                           mp->m_sb.sb_blocksize,
-                                           log_sector_size);
-       }
-       if (!error && rtdev)
-               error = xfs_setsize_buftarg(mp->m_rtdev_targp,
-                                           mp->m_sb.sb_blocksize,
-                                           mp->m_sb.sb_sectsize);
-       if (error)
-               goto error2;
-
-       if (mp->m_flags & XFS_MOUNT_BARRIER)
-               xfs_mountfs_check_barriers(mp);
-
-       if ((error = xfs_filestream_mount(mp)))
-               goto error2;
-
-       error = xfs_mountfs(mp, flags);
-       if (error)
-               goto error2;
-
-       XFS_SEND_MOUNT(mp, DM_RIGHT_NULL, args->mtpt, args->fsname);
-
-       return 0;
-
-error2:
-       if (mp->m_sb_bp)
-               xfs_freesb(mp);
-error1:
-       xfs_binval(mp->m_ddev_targp);
-       if (logdev && logdev != ddev)
-               xfs_binval(mp->m_logdev_targp);
-       if (rtdev)
-               xfs_binval(mp->m_rtdev_targp);
-error0:
-       xfs_unmountfs_close(mp, credp);
-       xfs_qmops_put(mp);
-       xfs_dmops_put(mp);
-       return error;
-}
-
-int
-xfs_unmount(
-       xfs_mount_t     *mp,
-       int             flags,
-       cred_t          *credp)
-{
-       xfs_inode_t     *rip;
-       bhv_vnode_t     *rvp;
-       int             unmount_event_wanted = 0;
-       int             unmount_event_flags = 0;
-       int             xfs_unmountfs_needed = 0;
-       int             error;
-
-       rip = mp->m_rootip;
-       rvp = XFS_ITOV(rip);
-
-#ifdef HAVE_DMAPI
-       if (mp->m_flags & XFS_MOUNT_DMAPI) {
-               error = XFS_SEND_PREUNMOUNT(mp,
-                               rip, DM_RIGHT_NULL, rip, DM_RIGHT_NULL,
-                               NULL, NULL, 0, 0,
-                               (mp->m_dmevmask & (1<<DM_EVENT_PREUNMOUNT))?
-                                       0:DM_FLAGS_UNWANTED);
-                       if (error)
-                               return XFS_ERROR(error);
-               unmount_event_wanted = 1;
-               unmount_event_flags = (mp->m_dmevmask & (1<<DM_EVENT_UNMOUNT))?
-                                       0 : DM_FLAGS_UNWANTED;
-       }
-#endif
-
-       /*
-        * Blow away any referenced inode in the filestreams cache.
-        * This can and will cause log traffic as inodes go inactive
-        * here.
-        */
-       xfs_filestream_unmount(mp);
-
-       XFS_bflush(mp->m_ddev_targp);
-       error = xfs_unmount_flush(mp, 0);
-       if (error)
-               goto out;
-
-       ASSERT(vn_count(rvp) == 1);
-
-       /*
-        * Drop the reference count
-        */
-       IRELE(rip);
-
-       /*
-        * If we're forcing a shutdown, typically because of a media error,
-        * we want to make sure we invalidate dirty pages that belong to
-        * referenced vnodes as well.
-        */
-       if (XFS_FORCED_SHUTDOWN(mp)) {
-               error = xfs_sync(mp, SYNC_WAIT | SYNC_CLOSE);
-               ASSERT(error != EFSCORRUPTED);
-       }
-       xfs_unmountfs_needed = 1;
-
-out:
-       /*      Send DMAPI event, if required.
-        *      Then do xfs_unmountfs() if needed.
-        *      Then return error (or zero).
-        */
-       if (unmount_event_wanted) {
-               /* Note: mp structure must still exist for
-                * XFS_SEND_UNMOUNT() call.
-                */
-               XFS_SEND_UNMOUNT(mp, error == 0 ? rip : NULL,
-                       DM_RIGHT_NULL, 0, error, unmount_event_flags);
-       }
-       if (xfs_unmountfs_needed) {
-               /*
-                * Call common unmount function to flush to disk
-                * and free the super block buffer & mount structures.
-                */
-               xfs_unmountfs(mp, credp);
-               xfs_qmops_put(mp);
-               xfs_dmops_put(mp);
-               kmem_free(mp, sizeof(xfs_mount_t));
-       }
-
-       return XFS_ERROR(error);
-}
-
 STATIC void
 xfs_quiesce_fs(
        xfs_mount_t             *mp)
@@ -694,30 +114,6 @@ xfs_attr_quiesce(
        xfs_unmountfs_writesb(mp);
 }
 
-int
-xfs_mntupdate(
-       struct xfs_mount                *mp,
-       int                             *flags,
-       struct xfs_mount_args           *args)
-{
-       if (!(*flags & MS_RDONLY)) {                    /* rw/ro -> rw */
-               if (mp->m_flags & XFS_MOUNT_RDONLY)
-                       mp->m_flags &= ~XFS_MOUNT_RDONLY;
-               if (args->flags & XFSMNT_BARRIER) {
-                       mp->m_flags |= XFS_MOUNT_BARRIER;
-                       xfs_mountfs_check_barriers(mp);
-               } else {
-                       mp->m_flags &= ~XFS_MOUNT_BARRIER;
-               }
-       } else if (!(mp->m_flags & XFS_MOUNT_RDONLY)) { /* rw -> ro */
-               xfs_filestream_flush(mp);
-               xfs_sync(mp, SYNC_DATA_QUIESCE);
-               xfs_attr_quiesce(mp);
-               mp->m_flags |= XFS_MOUNT_RDONLY;
-       }
-       return 0;
-}
-
 /*
  * xfs_unmount_flush implements a set of flush operation on special
  * inodes, which are needed as a separate set of operations so that
@@ -1048,7 +444,7 @@ xfs_sync_inodes(
 
                if (XFS_FORCED_SHUTDOWN(mp) && !(flags & SYNC_CLOSE)) {
                        XFS_MOUNT_IUNLOCK(mp);
-                       kmem_free(ipointer, sizeof(xfs_iptr_t));
+                       kmem_free(ipointer);
                        return 0;
                }
 
@@ -1194,7 +590,7 @@ xfs_sync_inodes(
                        }
                        XFS_MOUNT_IUNLOCK(mp);
                        ASSERT(ipointer_in == B_FALSE);
-                       kmem_free(ipointer, sizeof(xfs_iptr_t));
+                       kmem_free(ipointer);
                        return XFS_ERROR(error);
                }
 
@@ -1224,7 +620,7 @@ xfs_sync_inodes(
 
        ASSERT(ipointer_in == B_FALSE);
 
-       kmem_free(ipointer, sizeof(xfs_iptr_t));
+       kmem_free(ipointer);
        return XFS_ERROR(last_error);
 }
 
index 1688817..a74b050 100644 (file)
@@ -8,11 +8,6 @@ struct kstatfs;
 struct xfs_mount;
 struct xfs_mount_args;
 
-int xfs_mount(struct xfs_mount *mp, struct xfs_mount_args *args,
-               struct cred *credp);
-int xfs_unmount(struct xfs_mount *mp, int flags, struct cred *credp);
-int xfs_mntupdate(struct xfs_mount *mp, int *flags,
-               struct xfs_mount_args *args);
 int xfs_sync(struct xfs_mount *mp, int flags);
 void xfs_do_force_shutdown(struct xfs_mount *mp, int flags, char *fname,
                int lnnum);
index e475e37..76a1166 100644 (file)
@@ -75,26 +75,23 @@ xfs_open(
        return 0;
 }
 
-/*
- * xfs_setattr
- */
 int
 xfs_setattr(
-       xfs_inode_t             *ip,
-       bhv_vattr_t             *vap,
+       struct xfs_inode        *ip,
+       struct iattr            *iattr,
        int                     flags,
        cred_t                  *credp)
 {
        xfs_mount_t             *mp = ip->i_mount;
+       struct inode            *inode = XFS_ITOV(ip);
+       int                     mask = iattr->ia_valid;
        xfs_trans_t             *tp;
-       int                     mask;
        int                     code;
        uint                    lock_flags;
        uint                    commit_flags=0;
        uid_t                   uid=0, iuid=0;
        gid_t                   gid=0, igid=0;
        int                     timeflags = 0;
-       xfs_prid_t              projid=0, iprojid=0;
        struct xfs_dquot        *udqp, *gdqp, *olddquot1, *olddquot2;
        int                     file_owner;
        int                     need_iolock = 1;
@@ -104,30 +101,9 @@ xfs_setattr(
        if (mp->m_flags & XFS_MOUNT_RDONLY)
                return XFS_ERROR(EROFS);
 
-       /*
-        * Cannot set certain attributes.
-        */
-       mask = vap->va_mask;
-       if (mask & XFS_AT_NOSET) {
-               return XFS_ERROR(EINVAL);
-       }
-
        if (XFS_FORCED_SHUTDOWN(mp))
                return XFS_ERROR(EIO);
 
-       /*
-        * Timestamps do not need to be logged and hence do not
-        * need to be done within a transaction.
-        */
-       if (mask & XFS_AT_UPDTIMES) {
-               ASSERT((mask & ~XFS_AT_UPDTIMES) == 0);
-               timeflags = ((mask & XFS_AT_UPDATIME) ? XFS_ICHGTIME_ACC : 0) |
-                           ((mask & XFS_AT_UPDCTIME) ? XFS_ICHGTIME_CHG : 0) |
-                           ((mask & XFS_AT_UPDMTIME) ? XFS_ICHGTIME_MOD : 0);
-               xfs_ichgtime(ip, timeflags);
-               return 0;
-       }
-
        olddquot1 = olddquot2 = NULL;
        udqp = gdqp = NULL;
 
@@ -139,28 +115,22 @@ xfs_setattr(
         * If the IDs do change before we take the ilock, we're covered
         * because the i_*dquot fields will get updated anyway.
         */
-       if (XFS_IS_QUOTA_ON(mp) &&
-           (mask & (XFS_AT_UID|XFS_AT_GID|XFS_AT_PROJID))) {
+       if (XFS_IS_QUOTA_ON(mp) && (mask & (ATTR_UID|ATTR_GID))) {
                uint    qflags = 0;
 
-               if ((mask & XFS_AT_UID) && XFS_IS_UQUOTA_ON(mp)) {
-                       uid = vap->va_uid;
+               if ((mask & ATTR_UID) && XFS_IS_UQUOTA_ON(mp)) {
+                       uid = iattr->ia_uid;
                        qflags |= XFS_QMOPT_UQUOTA;
                } else {
                        uid = ip->i_d.di_uid;
                }
-               if ((mask & XFS_AT_GID) && XFS_IS_GQUOTA_ON(mp)) {
-                       gid = vap->va_gid;
+               if ((mask & ATTR_GID) && XFS_IS_GQUOTA_ON(mp)) {
+                       gid = iattr->ia_gid;
                        qflags |= XFS_QMOPT_GQUOTA;
                }  else {
                        gid = ip->i_d.di_gid;
                }
-               if ((mask & XFS_AT_PROJID) && XFS_IS_PQUOTA_ON(mp)) {
-                       projid = vap->va_projid;
-                       qflags |= XFS_QMOPT_PQUOTA;
-               }  else {
-                       projid = ip->i_d.di_projid;
-               }
+
                /*
                 * We take a reference when we initialize udqp and gdqp,
                 * so it is important that we never blindly double trip on
@@ -168,8 +138,8 @@ xfs_setattr(
                 */
                ASSERT(udqp == NULL);
                ASSERT(gdqp == NULL);
-               code = XFS_QM_DQVOPALLOC(mp, ip, uid, gid, projid, qflags,
-                                        &udqp, &gdqp);
+               code = XFS_QM_DQVOPALLOC(mp, ip, uid, gid, ip->i_d.di_projid,
+                                        qflags, &udqp, &gdqp);
                if (code)
                        return code;
        }
@@ -180,10 +150,10 @@ xfs_setattr(
         */
        tp = NULL;
        lock_flags = XFS_ILOCK_EXCL;
-       if (flags & ATTR_NOLOCK)
+       if (flags & XFS_ATTR_NOLOCK)
                need_iolock = 0;
-       if (!(mask & XFS_AT_SIZE)) {
-               if ((mask != (XFS_AT_CTIME|XFS_AT_ATIME|XFS_AT_MTIME)) ||
+       if (!(mask & ATTR_SIZE)) {
+               if ((mask != (ATTR_CTIME|ATTR_ATIME|ATTR_MTIME)) ||
                    (mp->m_flags & XFS_MOUNT_WSYNC)) {
                        tp = xfs_trans_alloc(mp, XFS_TRANS_SETATTR_NOT_SIZE);
                        commit_flags = 0;
@@ -196,10 +166,10 @@ xfs_setattr(
                }
        } else {
                if (DM_EVENT_ENABLED(ip, DM_EVENT_TRUNCATE) &&
-                   !(flags & ATTR_DMI)) {
+                   !(flags & XFS_ATTR_DMI)) {
                        int dmflags = AT_DELAY_FLAG(flags) | DM_SEM_FLAG_WR;
                        code = XFS_SEND_DATA(mp, DM_EVENT_TRUNCATE, ip,
-                               vap->va_size, 0, dmflags, NULL);
+                               iattr->ia_size, 0, dmflags, NULL);
                        if (code) {
                                lock_flags = 0;
                                goto error_return;
@@ -219,9 +189,7 @@ xfs_setattr(
         * Only the owner or users with CAP_FOWNER
         * capability may do these things.
         */
-       if (mask &
-           (XFS_AT_MODE|XFS_AT_XFLAGS|XFS_AT_EXTSIZE|XFS_AT_UID|
-            XFS_AT_GID|XFS_AT_PROJID)) {
+       if (mask & (ATTR_MODE|ATTR_UID|ATTR_GID)) {
                /*
                 * CAP_FOWNER overrides the following restrictions:
                 *
@@ -245,21 +213,21 @@ xfs_setattr(
                 * IDs of the calling process shall match the group owner of
                 * the file when setting the set-group-ID bit on that file
                 */
-               if (mask & XFS_AT_MODE) {
+               if (mask & ATTR_MODE) {
                        mode_t m = 0;
 
-                       if ((vap->va_mode & S_ISUID) && !file_owner)
+                       if ((iattr->ia_mode & S_ISUID) && !file_owner)
                                m |= S_ISUID;
-                       if ((vap->va_mode & S_ISGID) &&
+                       if ((iattr->ia_mode & S_ISGID) &&
                            !in_group_p((gid_t)ip->i_d.di_gid))
                                m |= S_ISGID;
 #if 0
                        /* Linux allows this, Irix doesn't. */
-                       if ((vap->va_mode & S_ISVTX) && !S_ISDIR(ip->i_d.di_mode))
+                       if ((iattr->ia_mode & S_ISVTX) && !S_ISDIR(ip->i_d.di_mode))
                                m |= S_ISVTX;
 #endif
                        if (m && !capable(CAP_FSETID))
-                               vap->va_mode &= ~m;
+                               iattr->ia_mode &= ~m;
                }
        }
 
@@ -270,7 +238,7 @@ xfs_setattr(
         * and can change the group id only to a group of which he
         * or she is a member.
         */
-       if (mask & (XFS_AT_UID|XFS_AT_GID|XFS_AT_PROJID)) {
+       if (mask & (ATTR_UID|ATTR_GID)) {
                /*
                 * These IDs could have changed since we last looked at them.
                 * But, we're assured that if the ownership did change
@@ -278,12 +246,9 @@ xfs_setattr(
                 * would have changed also.
                 */
                iuid = ip->i_d.di_uid;
-               iprojid = ip->i_d.di_projid;
                igid = ip->i_d.di_gid;
-               gid = (mask & XFS_AT_GID) ? vap->va_gid : igid;
-               uid = (mask & XFS_AT_UID) ? vap->va_uid : iuid;
-               projid = (mask & XFS_AT_PROJID) ? (xfs_prid_t)vap->va_projid :
-                        iprojid;
+               gid = (mask & ATTR_GID) ? iattr->ia_gid : igid;
+               uid = (mask & ATTR_UID) ? iattr->ia_uid : iuid;
 
                /*
                 * CAP_CHOWN overrides the following restrictions:
@@ -303,11 +268,10 @@ xfs_setattr(
                        goto error_return;
                }
                /*
-                * Do a quota reservation only if uid/projid/gid is actually
+                * Do a quota reservation only if uid/gid is actually
                 * going to change.
                 */
                if ((XFS_IS_UQUOTA_ON(mp) && iuid != uid) ||
-                   (XFS_IS_PQUOTA_ON(mp) && iprojid != projid) ||
                    (XFS_IS_GQUOTA_ON(mp) && igid != gid)) {
                        ASSERT(tp);
                        code = XFS_QM_DQVOPCHOWNRESV(mp, tp, ip, udqp, gdqp,
@@ -321,13 +285,13 @@ xfs_setattr(
        /*
         * Truncate file.  Must have write permission and not be a directory.
         */
-       if (mask & XFS_AT_SIZE) {
+       if (mask & ATTR_SIZE) {
                /* Short circuit the truncate case for zero length files */
-               if ((vap->va_size == 0) &&
-                  (ip->i_size == 0) && (ip->i_d.di_nextents == 0)) {
+               if (iattr->ia_size == 0 &&
+                   ip->i_size == 0 && ip->i_d.di_nextents == 0) {
                        xfs_iunlock(ip, XFS_ILOCK_EXCL);
                        lock_flags &= ~XFS_ILOCK_EXCL;
-                       if (mask & XFS_AT_CTIME)
+                       if (mask & ATTR_CTIME)
                                xfs_ichgtime(ip, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
                        code = 0;
                        goto error_return;
@@ -350,9 +314,9 @@ xfs_setattr(
        /*
         * Change file access or modified times.
         */
-       if (mask & (XFS_AT_ATIME|XFS_AT_MTIME)) {
+       if (mask & (ATTR_ATIME|ATTR_MTIME)) {
                if (!file_owner) {
-                       if ((flags & ATTR_UTIME) &&
+                       if ((mask & (ATTR_MTIME_SET|ATTR_ATIME_SET)) &&
                            !capable(CAP_FOWNER)) {
                                code = XFS_ERROR(EPERM);
                                goto error_return;
@@ -360,91 +324,24 @@ xfs_setattr(
                }
        }
 
-       /*
-        * Change extent size or realtime flag.
-        */
-       if (mask & (XFS_AT_EXTSIZE|XFS_AT_XFLAGS)) {
-               /*
-                * Can't change extent size if any extents are allocated.
-                */
-               if (ip->i_d.di_nextents && (mask & XFS_AT_EXTSIZE) &&
-                   ((ip->i_d.di_extsize << mp->m_sb.sb_blocklog) !=
-                    vap->va_extsize) ) {
-                       code = XFS_ERROR(EINVAL);       /* EFBIG? */
-                       goto error_return;
-               }
-
-               /*
-                * Can't change realtime flag if any extents are allocated.
-                */
-               if ((ip->i_d.di_nextents || ip->i_delayed_blks) &&
-                   (mask & XFS_AT_XFLAGS) &&
-                   (XFS_IS_REALTIME_INODE(ip)) !=
-                   (vap->va_xflags & XFS_XFLAG_REALTIME)) {
-                       code = XFS_ERROR(EINVAL);       /* EFBIG? */
-                       goto error_return;
-               }
-               /*
-                * Extent size must be a multiple of the appropriate block
-                * size, if set at all.
-                */
-               if ((mask & XFS_AT_EXTSIZE) && vap->va_extsize != 0) {
-                       xfs_extlen_t    size;
-
-                       if (XFS_IS_REALTIME_INODE(ip) ||
-                           ((mask & XFS_AT_XFLAGS) &&
-                           (vap->va_xflags & XFS_XFLAG_REALTIME))) {
-                               size = mp->m_sb.sb_rextsize <<
-                                      mp->m_sb.sb_blocklog;
-                       } else {
-                               size = mp->m_sb.sb_blocksize;
-                       }
-                       if (vap->va_extsize % size) {
-                               code = XFS_ERROR(EINVAL);
-                               goto error_return;
-                       }
-               }
-               /*
-                * If realtime flag is set then must have realtime data.
-                */
-               if ((mask & XFS_AT_XFLAGS) &&
-                   (vap->va_xflags & XFS_XFLAG_REALTIME)) {
-                       if ((mp->m_sb.sb_rblocks == 0) ||
-                           (mp->m_sb.sb_rextsize == 0) ||
-                           (ip->i_d.di_extsize % mp->m_sb.sb_rextsize)) {
-                               code = XFS_ERROR(EINVAL);
-                               goto error_return;
-                       }
-               }
-
-               /*
-                * Can't modify an immutable/append-only file unless
-                * we have appropriate permission.
-                */
-               if ((mask & XFS_AT_XFLAGS) &&
-                   (ip->i_d.di_flags &
-                               (XFS_DIFLAG_IMMUTABLE|XFS_DIFLAG_APPEND) ||
-                    (vap->va_xflags &
-                               (XFS_XFLAG_IMMUTABLE | XFS_XFLAG_APPEND))) &&
-                   !capable(CAP_LINUX_IMMUTABLE)) {
-                       code = XFS_ERROR(EPERM);
-                       goto error_return;
-               }
-       }
-
        /*
         * Now we can make the changes.  Before we join the inode
-        * to the transaction, if XFS_AT_SIZE is set then take care of
+        * to the transaction, if ATTR_SIZE is set then take care of
         * the part of the truncation that must be done without the
         * inode lock.  This needs to be done before joining the inode
         * to the transaction, because the inode cannot be unlocked
         * once it is a part of the transaction.
         */
-       if (mask & XFS_AT_SIZE) {
+       if (mask & ATTR_SIZE) {
                code = 0;
-               if ((vap->va_size > ip->i_size) &&
-                   (flags & ATTR_NOSIZETOK) == 0) {
-                       code = xfs_igrow_start(ip, vap->va_size, credp);
+               if (iattr->ia_size > ip->i_size) {
+                       /*
+                        * Do the first part of growing a file: zero any data
+                        * in the last block that is beyond the old EOF.  We
+                        * need to do this before the inode is joined to the
+                        * transaction to modify the i_size.
+                        */
+                       code = xfs_zero_eof(ip, iattr->ia_size, ip->i_size);
                }
                xfs_iunlock(ip, XFS_ILOCK_EXCL);
 
@@ -461,10 +358,10 @@ xfs_setattr(
                 * not within the range we care about here.
                 */
                if (!code &&
-                   (ip->i_size != ip->i_d.di_size) &&
-                   (vap->va_size > ip->i_d.di_size)) {
+                   ip->i_size != ip->i_d.di_size &&
+                   iattr->ia_size > ip->i_d.di_size) {
                        code = xfs_flush_pages(ip,
-                                       ip->i_d.di_size, vap->va_size,
+                                       ip->i_d.di_size, iattr->ia_size,
                                        XFS_B_ASYNC, FI_NONE);
                }
 
@@ -472,7 +369,7 @@ xfs_setattr(
                vn_iowait(ip);
 
                if (!code)
-                       code = xfs_itruncate_data(ip, vap->va_size);
+                       code = xfs_itruncate_data(ip, iattr->ia_size);
                if (code) {
                        ASSERT(tp == NULL);
                        lock_flags &= ~XFS_ILOCK_EXCL;
@@ -501,28 +398,30 @@ xfs_setattr(
        /*
         * Truncate file.  Must have write permission and not be a directory.
         */
-       if (mask & XFS_AT_SIZE) {
+       if (mask & ATTR_SIZE) {
                /*
                 * Only change the c/mtime if we are changing the size
                 * or we are explicitly asked to change it. This handles
                 * the semantic difference between truncate() and ftruncate()
                 * as implemented in the VFS.
                 */
-               if (vap->va_size != ip->i_size || (mask & XFS_AT_CTIME))
+               if (iattr->ia_size != ip->i_size || (mask & ATTR_CTIME))
                        timeflags |= XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG;
 
-               if (vap->va_size > ip->i_size) {
-                       xfs_igrow_finish(tp, ip, vap->va_size,
-                           !(flags & ATTR_DMI));
-               } else if ((vap->va_size <= ip->i_size) ||
-                          ((vap->va_size == 0) && ip->i_d.di_nextents)) {
+               if (iattr->ia_size > ip->i_size) {
+                       ip->i_d.di_size = iattr->ia_size;
+                       ip->i_size = iattr->ia_size;
+                       if (!(flags & XFS_ATTR_DMI))
+                               xfs_ichgtime(ip, XFS_ICHGTIME_CHG);
+                       xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
+               } else if (iattr->ia_size <= ip->i_size ||
+                          (iattr->ia_size == 0 && ip->i_d.di_nextents)) {
                        /*
                         * signal a sync transaction unless
                         * we're truncating an already unlinked
                         * file on a wsync filesystem
                         */
-                       code = xfs_itruncate_finish(&tp, ip,
-                                           (xfs_fsize_t)vap->va_size,
+                       code = xfs_itruncate_finish(&tp, ip, iattr->ia_size,
                                            XFS_DATA_FORK,
                                            ((ip->i_d.di_nlink != 0 ||
                                              !(mp->m_flags & XFS_MOUNT_WSYNC))
@@ -544,9 +443,12 @@ xfs_setattr(
        /*
         * Change file access modes.
         */
-       if (mask & XFS_AT_MODE) {
+       if (mask & ATTR_MODE) {
                ip->i_d.di_mode &= S_IFMT;
-               ip->i_d.di_mode |= vap->va_mode & ~S_IFMT;
+               ip->i_d.di_mode |= iattr->ia_mode & ~S_IFMT;
+
+               inode->i_mode &= S_IFMT;
+               inode->i_mode |= iattr->ia_mode & ~S_IFMT;
 
                xfs_trans_log_inode (tp, ip, XFS_ILOG_CORE);
                timeflags |= XFS_ICHGTIME_CHG;
@@ -559,7 +461,7 @@ xfs_setattr(
         * and can change the group id only to a group of which he
         * or she is a member.
         */
-       if (mask & (XFS_AT_UID|XFS_AT_GID|XFS_AT_PROJID)) {
+       if (mask & (ATTR_UID|ATTR_GID)) {
                /*
                 * CAP_FSETID overrides the following restrictions:
                 *
@@ -577,39 +479,24 @@ xfs_setattr(
                 */
                if (iuid != uid) {
                        if (XFS_IS_UQUOTA_ON(mp)) {
-                               ASSERT(mask & XFS_AT_UID);
+                               ASSERT(mask & ATTR_UID);
                                ASSERT(udqp);
                                olddquot1 = XFS_QM_DQVOPCHOWN(mp, tp, ip,
                                                        &ip->i_udquot, udqp);
                        }
                        ip->i_d.di_uid = uid;
+                       inode->i_uid = uid;
                }
                if (igid != gid) {
                        if (XFS_IS_GQUOTA_ON(mp)) {
                                ASSERT(!XFS_IS_PQUOTA_ON(mp));
-                               ASSERT(mask & XFS_AT_GID);
+                               ASSERT(mask & ATTR_GID);
                                ASSERT(gdqp);
                                olddquot2 = XFS_QM_DQVOPCHOWN(mp, tp, ip,
                                                        &ip->i_gdquot, gdqp);
                        }
                        ip->i_d.di_gid = gid;
-               }
-               if (iprojid != projid) {
-                       if (XFS_IS_PQUOTA_ON(mp)) {
-                               ASSERT(!XFS_IS_GQUOTA_ON(mp));
-                               ASSERT(mask & XFS_AT_PROJID);
-                               ASSERT(gdqp);
-                               olddquot2 = XFS_QM_DQVOPCHOWN(mp, tp, ip,
-                                                       &ip->i_gdquot, gdqp);
-                       }
-                       ip->i_d.di_projid = projid;
-                       /*
-                        * We may have to rev the inode as well as
-                        * the superblock version number since projids didn't
-                        * exist before DINODE_VERSION_2 and SB_VERSION_NLINK.
-                        */
-                       if (ip->i_d.di_version == XFS_DINODE_VERSION_1)
-                               xfs_bump_ino_vers2(tp, ip);
+                       inode->i_gid = gid;
                }
 
                xfs_trans_log_inode (tp, ip, XFS_ILOG_CORE);
@@ -620,82 +507,34 @@ xfs_setattr(
        /*
         * Change file access or modified times.
         */
-       if (mask & (XFS_AT_ATIME|XFS_AT_MTIME)) {
-               if (mask & XFS_AT_ATIME) {
-                       ip->i_d.di_atime.t_sec = vap->va_atime.tv_sec;
-                       ip->i_d.di_atime.t_nsec = vap->va_atime.tv_nsec;
+       if (mask & (ATTR_ATIME|ATTR_MTIME)) {
+               if (mask & ATTR_ATIME) {
+                       inode->i_atime = iattr->ia_atime;
+                       ip->i_d.di_atime.t_sec = iattr->ia_atime.tv_sec;
+                       ip->i_d.di_atime.t_nsec = iattr->ia_atime.tv_nsec;
                        ip->i_update_core = 1;
                        timeflags &= ~XFS_ICHGTIME_ACC;
                }
-               if (mask & XFS_AT_MTIME) {
-                       ip->i_d.di_mtime.t_sec = vap->va_mtime.tv_sec;
-                       ip->i_d.di_mtime.t_nsec = vap->va_mtime.tv_nsec;
+               if (mask & ATTR_MTIME) {
+                       inode->i_mtime = iattr->ia_mtime;
+                       ip->i_d.di_mtime.t_sec = iattr->ia_mtime.tv_sec;
+                       ip->i_d.di_mtime.t_nsec = iattr->ia_mtime.tv_nsec;
                        timeflags &= ~XFS_ICHGTIME_MOD;
                        timeflags |= XFS_ICHGTIME_CHG;
                }
-               if (tp && (flags & ATTR_UTIME))
+               if (tp && (mask & (ATTR_MTIME_SET|ATTR_ATIME_SET)))
                        xfs_trans_log_inode (tp, ip, XFS_ILOG_CORE);
        }
 
        /*
-        * Change XFS-added attributes.
-        */
-       if (mask & (XFS_AT_EXTSIZE|XFS_AT_XFLAGS)) {
-               if (mask & XFS_AT_EXTSIZE) {
-                       /*
-                        * Converting bytes to fs blocks.
-                        */
-                       ip->i_d.di_extsize = vap->va_extsize >>
-                               mp->m_sb.sb_blocklog;
-               }
-               if (mask & XFS_AT_XFLAGS) {
-                       uint    di_flags;
-
-                       /* can't set PREALLOC this way, just preserve it */
-                       di_flags = (ip->i_d.di_flags & XFS_DIFLAG_PREALLOC);
-                       if (vap->va_xflags & XFS_XFLAG_IMMUTABLE)
-                               di_flags |= XFS_DIFLAG_IMMUTABLE;
-                       if (vap->va_xflags & XFS_XFLAG_APPEND)
-                               di_flags |= XFS_DIFLAG_APPEND;
-                       if (vap->va_xflags & XFS_XFLAG_SYNC)
-                               di_flags |= XFS_DIFLAG_SYNC;
-                       if (vap->va_xflags & XFS_XFLAG_NOATIME)
-                               di_flags |= XFS_DIFLAG_NOATIME;
-                       if (vap->va_xflags & XFS_XFLAG_NODUMP)
-                               di_flags |= XFS_DIFLAG_NODUMP;
-                       if (vap->va_xflags & XFS_XFLAG_PROJINHERIT)
-                               di_flags |= XFS_DIFLAG_PROJINHERIT;
-                       if (vap->va_xflags & XFS_XFLAG_NODEFRAG)
-                               di_flags |= XFS_DIFLAG_NODEFRAG;
-                       if (vap->va_xflags & XFS_XFLAG_FILESTREAM)
-                               di_flags |= XFS_DIFLAG_FILESTREAM;
-                       if ((ip->i_d.di_mode & S_IFMT) == S_IFDIR) {
-                               if (vap->va_xflags & XFS_XFLAG_RTINHERIT)
-                                       di_flags |= XFS_DIFLAG_RTINHERIT;
-                               if (vap->va_xflags & XFS_XFLAG_NOSYMLINKS)
-                                       di_flags |= XFS_DIFLAG_NOSYMLINKS;
-                               if (vap->va_xflags & XFS_XFLAG_EXTSZINHERIT)
-                                       di_flags |= XFS_DIFLAG_EXTSZINHERIT;
-                       } else if ((ip->i_d.di_mode & S_IFMT) == S_IFREG) {
-                               if (vap->va_xflags & XFS_XFLAG_REALTIME)
-                                       di_flags |= XFS_DIFLAG_REALTIME;
-                               if (vap->va_xflags & XFS_XFLAG_EXTSIZE)
-                                       di_flags |= XFS_DIFLAG_EXTSIZE;
-                       }
-                       ip->i_d.di_flags = di_flags;
-               }
-               xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
-               timeflags |= XFS_ICHGTIME_CHG;
-       }
-
-       /*
-        * Change file inode change time only if XFS_AT_CTIME set
+        * Change file inode change time only if ATTR_CTIME set
         * AND we have been called by a DMI function.
         */
 
-       if ( (flags & ATTR_DMI) && (mask & XFS_AT_CTIME) ) {
-               ip->i_d.di_ctime.t_sec = vap->va_ctime.tv_sec;
-               ip->i_d.di_ctime.t_nsec = vap->va_ctime.tv_nsec;
+       if ((flags & XFS_ATTR_DMI) && (mask & ATTR_CTIME)) {
+               inode->i_ctime = iattr->ia_ctime;
+               ip->i_d.di_ctime.t_sec = iattr->ia_ctime.tv_sec;
+               ip->i_d.di_ctime.t_nsec = iattr->ia_ctime.tv_nsec;
                ip->i_update_core = 1;
                timeflags &= ~XFS_ICHGTIME_CHG;
        }
@@ -704,7 +543,7 @@ xfs_setattr(
         * Send out timestamp changes that need to be set to the
         * current time.  Not done when called by a DMI function.
         */
-       if (timeflags && !(flags & ATTR_DMI))
+       if (timeflags && !(flags & XFS_ATTR_DMI))
                xfs_ichgtime(ip, timeflags);
 
        XFS_STATS_INC(xs_ig_attrchg);
@@ -742,7 +581,7 @@ xfs_setattr(
        }
 
        if (DM_EVENT_ENABLED(ip, DM_EVENT_ATTRIBUTE) &&
-           !(flags & ATTR_DMI)) {
+           !(flags & XFS_ATTR_DMI)) {
                (void) XFS_SEND_NAMESP(mp, DM_EVENT_ATTRIBUTE, ip, DM_RIGHT_NULL,
                                        NULL, DM_RIGHT_NULL, NULL, NULL,
                                        0, 0, AT_DELAY_FLAG(flags));
@@ -1601,12 +1440,18 @@ xfs_inactive(
        return VN_INACTIVE_CACHE;
 }
 
-
+/*
+ * Lookups up an inode from "name". If ci_name is not NULL, then a CI match
+ * is allowed, otherwise it has to be an exact match. If a CI match is found,
+ * ci_name->name will point to a the actual name (caller must free) or
+ * will be set to NULL if an exact match is found.
+ */
 int
 xfs_lookup(
        xfs_inode_t             *dp,
        struct xfs_name         *name,
-       xfs_inode_t             **ipp)
+       xfs_inode_t             **ipp,
+       struct xfs_name         *ci_name)
 {
        xfs_ino_t               inum;
        int                     error;
@@ -1618,7 +1463,7 @@ xfs_lookup(
                return XFS_ERROR(EIO);
 
        lock_mode = xfs_ilock_map_shared(dp);
-       error = xfs_dir_lookup(NULL, dp, name, &inum);
+       error = xfs_dir_lookup(NULL, dp, name, &inum, ci_name);
        xfs_iunlock_map_shared(dp, lock_mode);
 
        if (error)
@@ -1626,12 +1471,15 @@ xfs_lookup(
 
        error = xfs_iget(dp->i_mount, NULL, inum, 0, 0, ipp, 0);
        if (error)
-               goto out;
+               goto out_free_name;
 
        xfs_itrace_ref(*ipp);
        return 0;
 
- out:
+out_free_name:
+       if (ci_name)
+               kmem_free(ci_name->name);
+out:
        *ipp = NULL;
        return error;
 }
@@ -2098,13 +1946,6 @@ again:
 #endif
 }
 
-#ifdef DEBUG
-#define        REMOVE_DEBUG_TRACE(x)   {remove_which_error_return = (x);}
-int remove_which_error_return = 0;
-#else /* ! DEBUG */
-#define        REMOVE_DEBUG_TRACE(x)
-#endif /* ! DEBUG */
-
 int
 xfs_remove(
        xfs_inode_t             *dp,
@@ -2113,6 +1954,7 @@ xfs_remove(
 {
        xfs_mount_t             *mp = dp->i_mount;
        xfs_trans_t             *tp = NULL;
+       int                     is_dir = S_ISDIR(ip->i_d.di_mode);
        int                     error = 0;
        xfs_bmap_free_t         free_list;
        xfs_fsblock_t           first_block;
@@ -2120,8 +1962,10 @@ xfs_remove(
        int                     committed;
        int                     link_zero;
        uint                    resblks;
+       uint                    log_count;
 
        xfs_itrace_entry(dp);
+       xfs_itrace_entry(ip);
 
        if (XFS_FORCED_SHUTDOWN(mp))
                return XFS_ERROR(EIO);
@@ -2134,19 +1978,23 @@ xfs_remove(
                        return error;
        }
 
-       xfs_itrace_entry(ip);
-       xfs_itrace_ref(ip);
-
        error = XFS_QM_DQATTACH(mp, dp, 0);
-       if (!error)
-               error = XFS_QM_DQATTACH(mp, ip, 0);
-       if (error) {
-               REMOVE_DEBUG_TRACE(__LINE__);
+       if (error)
+               goto std_return;
+
+       error = XFS_QM_DQATTACH(mp, ip, 0);
+       if (error)
                goto std_return;
-       }
 
-       tp = xfs_trans_alloc(mp, XFS_TRANS_REMOVE);
+       if (is_dir) {
+               tp = xfs_trans_alloc(mp, XFS_TRANS_RMDIR);
+               log_count = XFS_DEFAULT_LOG_COUNT;
+       } else {
+               tp = xfs_trans_alloc(mp, XFS_TRANS_REMOVE);
+               log_count = XFS_REMOVE_LOG_COUNT;
+       }
        cancel_flags = XFS_TRANS_RELEASE_LOG_RES;
+
        /*
         * We try to get the real space reservation first,
         * allowing for directory btree deletion(s) implying
@@ -2158,25 +2006,21 @@ xfs_remove(
         */
        resblks = XFS_REMOVE_SPACE_RES(mp);
        error = xfs_trans_reserve(tp, resblks, XFS_REMOVE_LOG_RES(mp), 0,
-                       XFS_TRANS_PERM_LOG_RES, XFS_REMOVE_LOG_COUNT);
+                                 XFS_TRANS_PERM_LOG_RES, log_count);
        if (error == ENOSPC) {
                resblks = 0;
                error = xfs_trans_reserve(tp, 0, XFS_REMOVE_LOG_RES(mp), 0,
-                               XFS_TRANS_PERM_LOG_RES, XFS_REMOVE_LOG_COUNT);
+                                         XFS_TRANS_PERM_LOG_RES, log_count);
        }
        if (error) {
                ASSERT(error != ENOSPC);
-               REMOVE_DEBUG_TRACE(__LINE__);
-               xfs_trans_cancel(tp, 0);
-               return error;
+               cancel_flags = 0;
+               goto out_trans_cancel;
        }
 
        error = xfs_lock_dir_and_entry(dp, ip);
-       if (error) {
-               REMOVE_DEBUG_TRACE(__LINE__);
-               xfs_trans_cancel(tp, cancel_flags);
-               goto std_return;
-       }
+       if (error)
+               goto out_trans_cancel;
 
        /*
         * At this point, we've gotten both the directory and the entry
@@ -2188,6 +2032,21 @@ xfs_remove(
        IHOLD(dp);
        xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
 
+       /*
+        * If we're removing a directory perform some additional validation.
+        */
+       if (is_dir) {
+               ASSERT(ip->i_d.di_nlink >= 2);
+               if (ip->i_d.di_nlink != 2) {
+                       error = XFS_ERROR(ENOTEMPTY);
+                       goto out_trans_cancel;
+               }
+               if (!xfs_dir_isempty(ip)) {
+                       error = XFS_ERROR(ENOTEMPTY);
+                       goto out_trans_cancel;
+               }
+       }
+
        /*
         * Entry must exist since we did a lookup in xfs_lock_dir_and_entry.
         */
@@ -2196,39 +2055,64 @@ xfs_remove(
                                        &first_block, &free_list, resblks);
        if (error) {
                ASSERT(error != ENOENT);
-               REMOVE_DEBUG_TRACE(__LINE__);
-               goto error1;
+               goto out_bmap_cancel;
        }
        xfs_ichgtime(dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
 
+       /*
+        * Bump the in memory generation count on the parent
+        * directory so that other can know that it has changed.
+        */
        dp->i_gen++;
        xfs_trans_log_inode(tp, dp, XFS_ILOG_CORE);
 
-       error = xfs_droplink(tp, ip);
-       if (error) {
-               REMOVE_DEBUG_TRACE(__LINE__);
-               goto error1;
+       if (is_dir) {
+               /*
+                * Drop the link from ip's "..".
+                */
+               error = xfs_droplink(tp, dp);
+               if (error)
+                       goto out_bmap_cancel;
+
+               /*
+                * Drop the link from dp to ip.
+                */
+               error = xfs_droplink(tp, ip);
+               if (error)
+                       goto out_bmap_cancel;
+       } else {
+               /*
+                * When removing a non-directory we need to log the parent
+                * inode here for the i_gen update.  For a directory this is
+                * done implicitly by the xfs_droplink call for the ".." entry.
+                */
+               xfs_trans_log_inode(tp, dp, XFS_ILOG_CORE);
        }
 
-       /* Determine if this is the last link while
+       /*
+        * Drop the "." link from ip to self.
+        */
+       error = xfs_droplink(tp, ip);
+       if (error)
+               goto out_bmap_cancel;
+
+       /*
+        * Determine if this is the last link while
         * we are in the transaction.
         */
-       link_zero = (ip)->i_d.di_nlink==0;
+       link_zero = (ip->i_d.di_nlink == 0);
 
        /*
         * If this is a synchronous mount, make sure that the
         * remove transaction goes to disk before returning to
         * the user.
         */
-       if (mp->m_flags & (XFS_MOUNT_WSYNC|XFS_MOUNT_DIRSYNC)) {
+       if (mp->m_flags & (XFS_MOUNT_WSYNC|XFS_MOUNT_DIRSYNC))
                xfs_trans_set_sync(tp);
-       }
 
        error = xfs_bmap_finish(&tp, &free_list, &committed);
-       if (error) {
-               REMOVE_DEBUG_TRACE(__LINE__);
-               goto error_rele;
-       }
+       if (error)
+               goto out_bmap_cancel;
 
        error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES);
        if (error)
@@ -2240,38 +2124,26 @@ xfs_remove(
         * will get killed on last close in xfs_close() so we don't
         * have to worry about that.
         */
-       if (link_zero && xfs_inode_is_filestream(ip))
+       if (!is_dir && link_zero && xfs_inode_is_filestream(ip))
                xfs_filestream_deassociate(ip);
 
        xfs_itrace_exit(ip);
+       xfs_itrace_exit(dp);
 
-/*     Fall through to std_return with error = 0 */
  std_return:
        if (DM_EVENT_ENABLED(dp, DM_EVENT_POSTREMOVE)) {
-               (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTREMOVE,
-                               dp, DM_RIGHT_NULL,
-                               NULL, DM_RIGHT_NULL,
-                               name->name, NULL, ip->i_d.di_mode, error, 0);
+               XFS_SEND_NAMESP(mp, DM_EVENT_POSTREMOVE, dp, DM_RIGHT_NULL,
+                               NULL, DM_RIGHT_NULL, name->name, NULL,
+                               ip->i_d.di_mode, error, 0);
        }
-       return error;
 
- error1:
-       xfs_bmap_cancel(&free_list);
-       cancel_flags |= XFS_TRANS_ABORT;
-       xfs_trans_cancel(tp, cancel_flags);
-       goto std_return;
+       return error;
 
- error_rele:
-       /*
-        * In this case make sure to not release the inode until after
-        * the current transaction is aborted.  Releasing it beforehand
-        * can cause us to go to xfs_inactive and start a recursive
-        * transaction which can easily deadlock with the current one.
-        */
+ out_bmap_cancel:
        xfs_bmap_cancel(&free_list);
        cancel_flags |= XFS_TRANS_ABORT;
+ out_trans_cancel:
        xfs_trans_cancel(tp, cancel_flags);
-
        goto std_return;
 }
 
@@ -2637,186 +2509,6 @@ std_return:
        goto std_return;
 }
 
-int
-xfs_rmdir(
-       xfs_inode_t             *dp,
-       struct xfs_name         *name,
-       xfs_inode_t             *cdp)
-{
-       xfs_mount_t             *mp = dp->i_mount;
-       xfs_trans_t             *tp;
-       int                     error;
-       xfs_bmap_free_t         free_list;
-       xfs_fsblock_t           first_block;
-       int                     cancel_flags;
-       int                     committed;
-       int                     last_cdp_link;
-       uint                    resblks;
-
-       xfs_itrace_entry(dp);
-
-       if (XFS_FORCED_SHUTDOWN(mp))
-               return XFS_ERROR(EIO);
-
-       if (DM_EVENT_ENABLED(dp, DM_EVENT_REMOVE)) {
-               error = XFS_SEND_NAMESP(mp, DM_EVENT_REMOVE,
-                                       dp, DM_RIGHT_NULL,
-                                       NULL, DM_RIGHT_NULL, name->name,
-                                       NULL, cdp->i_d.di_mode, 0, 0);
-               if (error)
-                       return XFS_ERROR(error);
-       }
-
-       /*
-        * Get the dquots for the inodes.
-        */
-       error = XFS_QM_DQATTACH(mp, dp, 0);
-       if (!error)
-               error = XFS_QM_DQATTACH(mp, cdp, 0);
-       if (error) {
-               REMOVE_DEBUG_TRACE(__LINE__);
-               goto std_return;
-       }
-
-       tp = xfs_trans_alloc(mp, XFS_TRANS_RMDIR);
-       cancel_flags = XFS_TRANS_RELEASE_LOG_RES;
-       /*
-        * We try to get the real space reservation first,
-        * allowing for directory btree deletion(s) implying
-        * possible bmap insert(s).  If we can't get the space
-        * reservation then we use 0 instead, and avoid the bmap
-        * btree insert(s) in the directory code by, if the bmap
-        * insert tries to happen, instead trimming the LAST
-        * block from the directory.
-        */
-       resblks = XFS_REMOVE_SPACE_RES(mp);
-       error = xfs_trans_reserve(tp, resblks, XFS_REMOVE_LOG_RES(mp), 0,
-                       XFS_TRANS_PERM_LOG_RES, XFS_DEFAULT_LOG_COUNT);
-       if (error == ENOSPC) {
-               resblks = 0;
-               error = xfs_trans_reserve(tp, 0, XFS_REMOVE_LOG_RES(mp), 0,
-                               XFS_TRANS_PERM_LOG_RES, XFS_DEFAULT_LOG_COUNT);
-       }
-       if (error) {
-               ASSERT(error != ENOSPC);
-               cancel_flags = 0;
-               goto error_return;
-       }
-       XFS_BMAP_INIT(&free_list, &first_block);
-
-       /*
-        * Now lock the child directory inode and the parent directory
-        * inode in the proper order.  This will take care of validating
-        * that the directory entry for the child directory inode has
-        * not changed while we were obtaining a log reservation.
-        */
-       error = xfs_lock_dir_and_entry(dp, cdp);
-       if (error) {
-               xfs_trans_cancel(tp, cancel_flags);
-               goto std_return;
-       }
-
-       IHOLD(dp);
-       xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL);
-
-       IHOLD(cdp);
-       xfs_trans_ijoin(tp, cdp, XFS_ILOCK_EXCL);
-
-       ASSERT(cdp->i_d.di_nlink >= 2);
-       if (cdp->i_d.di_nlink != 2) {
-               error = XFS_ERROR(ENOTEMPTY);
-               goto error_return;
-       }
-       if (!xfs_dir_isempty(cdp)) {
-               error = XFS_ERROR(ENOTEMPTY);
-               goto error_return;
-       }
-
-       error = xfs_dir_removename(tp, dp, name, cdp->i_ino,
-                                       &first_block, &free_list, resblks);
-       if (error)
-               goto error1;
-
-       xfs_ichgtime(dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
-
-       /*
-        * Bump the in memory generation count on the parent
-        * directory so that other can know that it has changed.
-        */
-       dp->i_gen++;
-
-       /*
-        * Drop the link from cdp's "..".
-        */
-       error = xfs_droplink(tp, dp);
-       if (error) {
-               goto error1;
-       }
-
-       /*
-        * Drop the link from dp to cdp.
-        */
-       error = xfs_droplink(tp, cdp);
-       if (error) {
-               goto error1;
-       }
-
-       /*
-        * Drop the "." link from cdp to self.
-        */
-       error = xfs_droplink(tp, cdp);
-       if (error) {
-               goto error1;
-       }
-
-       /* Determine these before committing transaction */
-       last_cdp_link = (cdp)->i_d.di_nlink==0;
-
-       /*
-        * If this is a synchronous mount, make sure that the
-        * rmdir transaction goes to disk before returning to
-        * the user.
-        */
-       if (mp->m_flags & (XFS_MOUNT_WSYNC|XFS_MOUNT_DIRSYNC)) {
-               xfs_trans_set_sync(tp);
-       }
-
-       error = xfs_bmap_finish (&tp, &free_list, &committed);
-       if (error) {
-               xfs_bmap_cancel(&free_list);
-               xfs_trans_cancel(tp, (XFS_TRANS_RELEASE_LOG_RES |
-                                XFS_TRANS_ABORT));
-               goto std_return;
-       }
-
-       error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES);
-       if (error) {
-               goto std_return;
-       }
-
-
-       /* Fall through to std_return with error = 0 or the errno
-        * from xfs_trans_commit. */
- std_return:
-       if (DM_EVENT_ENABLED(dp, DM_EVENT_POSTREMOVE)) {
-               (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTREMOVE,
-                                       dp, DM_RIGHT_NULL,
-                                       NULL, DM_RIGHT_NULL,
-                                       name->name, NULL, cdp->i_d.di_mode,
-                                       error, 0);
-       }
-       return error;
-
- error1:
-       xfs_bmap_cancel(&free_list);
-       cancel_flags |= XFS_TRANS_ABORT;
-       /* FALLTHROUGH */
-
- error_return:
-       xfs_trans_cancel(tp, cancel_flags);
-       goto std_return;
-}
-
 int
 xfs_symlink(
        xfs_inode_t             *dp,
@@ -3242,7 +2934,6 @@ xfs_finish_reclaim(
 {
        xfs_perag_t     *pag = xfs_get_perag(ip->i_mount, ip->i_ino);
        bhv_vnode_t     *vp = XFS_ITOV_NULL(ip);
-       int             error;
 
        if (vp && VN_BAD(vp))
                goto reclaim;
@@ -3285,29 +2976,16 @@ xfs_finish_reclaim(
                xfs_iflock(ip);
        }
 
-       if (!XFS_FORCED_SHUTDOWN(ip->i_mount)) {
-               if (ip->i_update_core ||
-                   ((ip->i_itemp != NULL) &&
-                    (ip->i_itemp->ili_format.ilf_fields != 0))) {
-                       error = xfs_iflush(ip, sync_mode);
-                       /*
-                        * If we hit an error, typically because of filesystem
-                        * shutdown, we don't need to let vn_reclaim to know
-                        * because we're gonna reclaim the inode anyway.
-                        */
-                       if (error) {
-                               xfs_iunlock(ip, XFS_ILOCK_EXCL);
-                               goto reclaim;
-                       }
-                       xfs_iflock(ip); /* synchronize with xfs_iflush_done */
-               }
-
-               ASSERT(ip->i_update_core == 0);
-               ASSERT(ip->i_itemp == NULL ||
-                      ip->i_itemp->ili_format.ilf_fields == 0);
+       /*
+        * 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 (xfs_iflush(ip, sync_mode) == 0) {
+               /* synchronize with xfs_iflush_done */
+               xfs_iflock(ip);
+               xfs_ifunlock(ip);
        }
 
-       xfs_ifunlock(ip);
        xfs_iunlock(ip, XFS_ILOCK_EXCL);
 
  reclaim:
@@ -3418,7 +3096,7 @@ xfs_alloc_file_space(
 
        /*      Generate a DMAPI event if needed.       */
        if (alloc_type != 0 && offset < ip->i_size &&
-                       (attr_flags&ATTR_DMI) == 0  &&
+                       (attr_flags & XFS_ATTR_DMI) == 0  &&
                        DM_EVENT_ENABLED(ip, DM_EVENT_WRITE)) {
                xfs_off_t           end_dmi_offset;
 
@@ -3532,7 +3210,7 @@ retry:
                allocatesize_fsb -= allocated_fsb;
        }
 dmapi_enospc_check:
-       if (error == ENOSPC && (attr_flags & ATTR_DMI) == 0 &&
+       if (error == ENOSPC && (attr_flags & XFS_ATTR_DMI) == 0 &&
            DM_EVENT_ENABLED(ip, DM_EVENT_NOSPACE)) {
                error = XFS_SEND_NAMESP(mp, DM_EVENT_NOSPACE,
                                ip, DM_RIGHT_NULL,
@@ -3679,7 +3357,7 @@ xfs_free_file_space(
        end_dmi_offset = offset + len;
        endoffset_fsb = XFS_B_TO_FSBT(mp, end_dmi_offset);
 
-       if (offset < ip->i_size && (attr_flags & ATTR_DMI) == 0 &&
+       if (offset < ip->i_size && (attr_flags & XFS_ATTR_DMI) == 0 &&
            DM_EVENT_ENABLED(ip, DM_EVENT_WRITE)) {
                if (end_dmi_offset > ip->i_size)
                        end_dmi_offset = ip->i_size;
@@ -3690,7 +3368,7 @@ xfs_free_file_space(
                        return error;
        }
 
-       if (attr_flags & ATTR_NOLOCK)
+       if (attr_flags & XFS_ATTR_NOLOCK)
                need_iolock = 0;
        if (need_iolock) {
                xfs_ilock(ip, XFS_IOLOCK_EXCL);
@@ -3867,7 +3545,7 @@ xfs_change_file_space(
        xfs_off_t       startoffset;
        xfs_off_t       llen;
        xfs_trans_t     *tp;
-       bhv_vattr_t     va;
+       struct iattr    iattr;
 
        xfs_itrace_entry(ip);
 
@@ -3941,10 +3619,10 @@ xfs_change_file_space(
                                break;
                }
 
-               va.va_mask = XFS_AT_SIZE;
-               va.va_size = startoffset;
+               iattr.ia_valid = ATTR_SIZE;
+               iattr.ia_size = startoffset;
 
-               error = xfs_setattr(ip, &va, attr_flags, credp);
+               error = xfs_setattr(ip, &iattr, attr_flags, credp);
 
                if (error)
                        return error;
@@ -3974,7 +3652,7 @@ xfs_change_file_space(
        xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
        xfs_trans_ihold(tp, ip);
 
-       if ((attr_flags & ATTR_DMI) == 0) {
+       if ((attr_flags & XFS_ATTR_DMI) == 0) {
                ip->i_d.di_mode &= ~S_ISUID;
 
                /*
index 57335ba..e932a96 100644 (file)
@@ -2,9 +2,9 @@
 #define _XFS_VNODEOPS_H 1
 
 struct attrlist_cursor_kern;
-struct bhv_vattr;
 struct cred;
 struct file;
+struct iattr;
 struct inode;
 struct iovec;
 struct kiocb;
@@ -15,14 +15,18 @@ struct xfs_iomap;
 
 
 int xfs_open(struct xfs_inode *ip);
-int xfs_setattr(struct xfs_inode *ip, struct bhv_vattr *vap, int flags,
+int xfs_setattr(struct xfs_inode *ip, struct iattr *vap, int flags,
                struct cred *credp);
+#define        XFS_ATTR_DMI            0x01    /* invocation from a DMI function */
+#define        XFS_ATTR_NONBLOCK       0x02    /* return EAGAIN if operation would block */
+#define XFS_ATTR_NOLOCK                0x04    /* Don't grab any conflicting locks */
+
 int xfs_readlink(struct xfs_inode *ip, char *link);
 int xfs_fsync(struct xfs_inode *ip);
 int xfs_release(struct xfs_inode *ip);
 int xfs_inactive(struct xfs_inode *ip);
 int xfs_lookup(struct xfs_inode *dp, struct xfs_name *name,
-               struct xfs_inode **ipp);
+               struct xfs_inode **ipp, struct xfs_name *ci_name);
 int xfs_create(struct xfs_inode *dp, struct xfs_name *name, mode_t mode,
                xfs_dev_t rdev, struct xfs_inode **ipp, struct cred *credp);
 int xfs_remove(struct xfs_inode *dp, struct xfs_name *name,
@@ -31,8 +35,6 @@ int xfs_link(struct xfs_inode *tdp, struct xfs_inode *sip,
                struct xfs_name *target_name);
 int xfs_mkdir(struct xfs_inode *dp, struct xfs_name *dir_name,
                mode_t mode, struct xfs_inode **ipp, struct cred *credp);
-int xfs_rmdir(struct xfs_inode *dp, struct xfs_name *name,
-               struct xfs_inode *cdp);
 int xfs_readdir(struct xfs_inode       *dp, void *dirent, size_t bufsize,
                       xfs_off_t *offset, filldir_t filldir);
 int xfs_symlink(struct xfs_inode *dp, struct xfs_name *link_name,
index b21b93e..9468095 100644 (file)
@@ -9,7 +9,7 @@
  */
 #include <asm/hardware.h>
 
-#include <asm/arch-ns9xxx/regs-board-a9m9750dev.h>
+#include <asm/arch/regs-board-a9m9750dev.h>
 
                .macro  addruart,rx
                mrc     p15, 0, \rx, c1, c0
index 89a21c5..2f6c89d 100644 (file)
@@ -9,7 +9,7 @@
  * the Free Software Foundation.
  */
 #include <asm/hardware.h>
-#include <asm/arch-ns9xxx/regs-sys-common.h>
+#include <asm/arch/regs-sys-common.h>
 
                .macro  get_irqnr_preamble, base, tmp
                ldr     \base, =SYS_ISRADDR
index f7b53b6..3137e5b 100644 (file)
@@ -11,7 +11,7 @@
 #ifndef __ASM_ARCH_PROCESSOR_H
 #define __ASM_ARCH_PROCESSOR_H
 
-#include <asm/arch-ns9xxx/module.h>
+#include <asm/arch/module.h>
 
 #define processor_is_ns9210()  (0                      \
                || module_is_cc7ucamry()                \
index 1348073..c294168 100644 (file)
@@ -12,8 +12,8 @@
 #define __ASM_ARCH_SYSTEM_H
 
 #include <asm/proc-fns.h>
-#include <asm/arch-ns9xxx/processor.h>
-#include <asm/arch-ns9xxx/processor-ns9360.h>
+#include <asm/arch/processor.h>
+#include <asm/arch/processor-ns9360.h>
 
 static inline void arch_idle(void)
 {
index db44c5d..99564c7 100644 (file)
@@ -154,7 +154,7 @@ struct omap_version_config {
 };
 
 
-#include <asm-arm/arch-omap/board-nokia.h>
+#include <asm/arch/board-nokia.h>
 
 struct omap_board_config_entry {
        u16 tag;
index f184eb8..edcfaf5 100644 (file)
 #define __NR_fallocate         324
 #define __NR_timerfd_settime   325
 #define __NR_timerfd_gettime   326
+#define __NR_signalfd4         327
+#define __NR_eventfd2          328
+#define __NR_epoll_create1     329
+#define __NR_dup3              330
+#define __NR_pipe2             331
+#define __NR_inotify_init1     332
 
 #ifdef __KERNEL__
 
-#define NR_syscalls 325
+#define NR_syscalls 333
 
 #define __ARCH_WANT_IPC_PARSE_VERSION
 /* #define __ARCH_WANT_OLD_READDIR */
index 6d88a92..cb752ba 100644 (file)
 #define BUG_TABLE                                                      \
        . = ALIGN(8);                                                   \
        __bug_table : AT(ADDR(__bug_table) - LOAD_OFFSET) {             \
-               __start___bug_table = .;                                \
+               VMLINUX_SYMBOL(__start___bug_table) = .;                \
                *(__bug_table)                                          \
-               __stop___bug_table = .;                                 \
+               VMLINUX_SYMBOL(__stop___bug_table) = .;                 \
        }
 #else
 #define BUG_TABLE
 #define TRACEDATA                                                      \
        . = ALIGN(4);                                                   \
        .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) {               \
-               __tracedata_start = .;                                  \
+               VMLINUX_SYMBOL(__tracedata_start) = .;                  \
                *(.tracedata)                                           \
-               __tracedata_end = .;                                    \
+               VMLINUX_SYMBOL(__tracedata_end) = .;                    \
        }
 #else
 #define TRACEDATA
 
 #define INITCALLS                                                      \
        *(.initcallearly.init)                                          \
-       __early_initcall_end = .;                                       \
+       VMLINUX_SYMBOL(__early_initcall_end) = .;                       \
        *(.initcall0.init)                                              \
        *(.initcall0s.init)                                             \
        *(.initcall1.init)                                              \
 
 #define PERCPU(align)                                                  \
        . = ALIGN(align);                                               \
-       __per_cpu_start = .;                                            \
+       VMLINUX_SYMBOL(__per_cpu_start) = .;                            \
        .data.percpu  : AT(ADDR(.data.percpu) - LOAD_OFFSET) {          \
                *(.data.percpu)                                         \
                *(.data.percpu.shared_aligned)                          \
        }                                                               \
-       __per_cpu_end = .;
+       VMLINUX_SYMBOL(__per_cpu_end) = .;
index 1e233e7..d1ea750 100644 (file)
@@ -1,4 +1,53 @@
 #ifndef _M68K_CONTREGS_H
 #define _M68K_CONTREGS_H
-#include <asm-sparc/contregs.h>
+
+/* contregs.h:  Addresses of registers in the ASI_CONTROL alternate address
+ *              space. These are for the mmu's context register, etc.
+ *
+ * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
+ */
+
+/* 3=sun3
+   4=sun4 (as in sun4 sysmaint student book)
+   c=sun4c (according to davem) */
+
+#define AC_IDPROM     0x00000000    /* 34  ID PROM, R/O, byte, 32 bytes      */
+#define AC_PAGEMAP    0x10000000    /* 3   Pagemap R/W, long                 */
+#define AC_SEGMAP     0x20000000    /* 3   Segment map, byte                 */
+#define AC_CONTEXT    0x30000000    /* 34c current mmu-context               */
+#define AC_SENABLE    0x40000000    /* 34c system dvma/cache/reset enable reg*/
+#define AC_UDVMA_ENB  0x50000000    /* 34  Not used on Sun boards, byte      */
+#define AC_BUS_ERROR  0x60000000    /* 34  Not cleared on read, byte.        */
+#define AC_SYNC_ERR   0x60000000    /*  c fault type                         */
+#define AC_SYNC_VA    0x60000004    /*  c fault virtual address              */
+#define AC_ASYNC_ERR  0x60000008    /*  c asynchronous fault type            */
+#define AC_ASYNC_VA   0x6000000c    /*  c async fault virtual address        */
+#define AC_LEDS       0x70000000    /* 34  Zero turns on LEDs, byte          */
+#define AC_CACHETAGS  0x80000000    /* 34c direct access to the VAC tags     */
+#define AC_CACHEDDATA 0x90000000    /* 3 c direct access to the VAC data     */
+#define AC_UDVMA_MAP  0xD0000000    /* 4  Not used on Sun boards, byte       */
+#define AC_VME_VECTOR 0xE0000000    /* 4  For non-Autovector VME, byte       */
+#define AC_BOOT_SCC   0xF0000000    /* 34  bypass to access Zilog 8530. byte.*/
+
+/* s=Swift, h=Ross_HyperSPARC, v=TI_Viking, t=Tsunami, r=Ross_Cypress        */
+#define AC_M_PCR      0x0000        /* shv Processor Control Reg             */
+#define AC_M_CTPR     0x0100        /* shv Context Table Pointer Reg         */
+#define AC_M_CXR      0x0200        /* shv Context Register                  */
+#define AC_M_SFSR     0x0300        /* shv Synchronous Fault Status Reg      */
+#define AC_M_SFAR     0x0400        /* shv Synchronous Fault Address Reg     */
+#define AC_M_AFSR     0x0500        /*  hv Asynchronous Fault Status Reg     */
+#define AC_M_AFAR     0x0600        /*  hv Asynchronous Fault Address Reg    */
+#define AC_M_RESET    0x0700        /*  hv Reset Reg                         */
+#define AC_M_RPR      0x1000        /*  hv Root Pointer Reg                  */
+#define AC_M_TSUTRCR  0x1000        /* s   TLB Replacement Ctrl Reg          */
+#define AC_M_IAPTP    0x1100        /*  hv Instruction Access PTP            */
+#define AC_M_DAPTP    0x1200        /*  hv Data Access PTP                   */
+#define AC_M_ITR      0x1300        /*  hv Index Tag Register                */
+#define AC_M_TRCR     0x1400        /*  hv TLB Replacement Control Reg       */
+#define AC_M_SFSRX    0x1300        /* s   Synch Fault Status Reg prim       */
+#define AC_M_SFARX    0x1400        /* s   Synch Fault Address Reg prim      */
+#define AC_M_RPR1     0x1500        /*  h  Root Pointer Reg (entry 2)        */
+#define AC_M_IAPTP1   0x1600        /*  h  Instruction Access PTP (entry 2)  */
+#define AC_M_DAPTP1   0x1700        /*  h  Data Access PTP (entry 2)         */
+
 #endif /* _M68K_CONTREGS_H */
index c17edf8..b9215a0 100644 (file)
@@ -1 +1,330 @@
-#include <asm-sparc/fbio.h>
+#ifndef __LINUX_FBIO_H
+#define __LINUX_FBIO_H
+
+#include <linux/compiler.h>
+#include <linux/types.h>
+
+/* Constants used for fbio SunOS compatibility */
+/* (C) 1996 Miguel de Icaza */
+
+/* Frame buffer types */
+#define FBTYPE_NOTYPE           -1
+#define FBTYPE_SUN1BW           0   /* mono */
+#define FBTYPE_SUN1COLOR        1 
+#define FBTYPE_SUN2BW           2 
+#define FBTYPE_SUN2COLOR        3 
+#define FBTYPE_SUN2GP           4 
+#define FBTYPE_SUN5COLOR        5 
+#define FBTYPE_SUN3COLOR        6 
+#define FBTYPE_MEMCOLOR         7 
+#define FBTYPE_SUN4COLOR        8 
+#define FBTYPE_NOTSUN1          9 
+#define FBTYPE_NOTSUN2          10
+#define FBTYPE_NOTSUN3          11
+#define FBTYPE_SUNFAST_COLOR    12  /* cg6 */
+#define FBTYPE_SUNROP_COLOR     13
+#define FBTYPE_SUNFB_VIDEO      14
+#define FBTYPE_SUNGIFB          15
+#define FBTYPE_SUNGPLAS         16
+#define FBTYPE_SUNGP3           17
+#define FBTYPE_SUNGT            18
+#define FBTYPE_SUNLEO           19      /* zx Leo card */
+#define FBTYPE_MDICOLOR         20      /* cg14 */
+#define FBTYPE_TCXCOLOR                21      /* SUNW,tcx card */
+
+#define FBTYPE_LASTPLUSONE      21     /* This is not last + 1 in fact... */
+
+/* Does not seem to be listed in the Sun file either */
+#define FBTYPE_CREATOR          22
+#define FBTYPE_PCI_IGA1682     23
+#define FBTYPE_P9100COLOR      24
+
+#define FBTYPE_PCI_GENERIC     1000
+#define FBTYPE_PCI_MACH64      1001
+
+/* fbio ioctls */
+/* Returned by FBIOGTYPE */
+struct  fbtype {
+        int     fb_type;        /* fb type, see above */
+        int     fb_height;      /* pixels */
+        int     fb_width;       /* pixels */
+        int     fb_depth;
+        int     fb_cmsize;      /* color map entries */
+        int     fb_size;        /* fb size in bytes */
+};
+#define FBIOGTYPE _IOR('F', 0, struct fbtype)
+
+struct  fbcmap {
+        int             index;          /* first element (0 origin) */
+        int             count;
+        unsigned char   __user *red;
+        unsigned char   __user *green;
+        unsigned char   __user *blue;
+};
+
+#ifdef __KERNEL__
+#define FBIOPUTCMAP_SPARC _IOW('F', 3, struct fbcmap)
+#define FBIOGETCMAP_SPARC _IOW('F', 4, struct fbcmap)
+#else
+#define FBIOPUTCMAP _IOW('F', 3, struct fbcmap)
+#define FBIOGETCMAP _IOW('F', 4, struct fbcmap)
+#endif
+
+/* # of device specific values */
+#define FB_ATTR_NDEVSPECIFIC    8
+/* # of possible emulations */
+#define FB_ATTR_NEMUTYPES       4
+struct fbsattr {
+        int     flags;
+        int     emu_type;      /* -1 if none */
+        int     dev_specific[FB_ATTR_NDEVSPECIFIC];
+};
+struct fbgattr {
+        int     real_type;     /* real frame buffer type */
+        int     owner;         /* unknown */
+        struct fbtype fbtype;  /* real frame buffer fbtype */
+        struct fbsattr sattr;   
+        int     emu_types[FB_ATTR_NEMUTYPES]; /* supported emulations */
+};
+#define FBIOSATTR  _IOW('F', 5, struct fbgattr) /* Unsupported: */
+#define FBIOGATTR  _IOR('F', 6, struct fbgattr)        /* supported */
+
+#define FBIOSVIDEO _IOW('F', 7, int)
+#define FBIOGVIDEO _IOR('F', 8, int)
+
+struct fbcursor {
+        short set;              /* what to set, choose from the list above */
+        short enable;           /* cursor on/off */
+        struct fbcurpos pos;    /* cursor position */
+        struct fbcurpos hot;    /* cursor hot spot */
+        struct fbcmap cmap;     /* color map info */
+        struct fbcurpos size;   /* cursor bit map size */
+        char __user *image;     /* cursor image bits */
+        char __user *mask;      /* cursor mask bits */
+};
+
+/* set/get cursor attributes/shape */
+#define FBIOSCURSOR     _IOW('F', 24, struct fbcursor)
+#define FBIOGCURSOR     _IOWR('F', 25, struct fbcursor)
+/* set/get cursor position */
+#define FBIOSCURPOS     _IOW('F', 26, struct fbcurpos)
+#define FBIOGCURPOS     _IOW('F', 27, struct fbcurpos)
+/* get max cursor size */
+#define FBIOGCURMAX     _IOR('F', 28, struct fbcurpos)
+
+/* wid manipulation */
+struct fb_wid_alloc {
+#define FB_WID_SHARED_8                0
+#define FB_WID_SHARED_24       1
+#define FB_WID_DBL_8           2
+#define FB_WID_DBL_24          3
+       __u32   wa_type;
+       __s32   wa_index;       /* Set on return */
+       __u32   wa_count;       
+};
+struct fb_wid_item {
+       __u32   wi_type;
+       __s32   wi_index;
+       __u32   wi_attrs;
+       __u32   wi_values[32];
+};
+struct fb_wid_list {
+       __u32   wl_flags;
+       __u32   wl_count;
+       struct fb_wid_item      *wl_list;
+};
+
+#define FBIO_WID_ALLOC _IOWR('F', 30, struct fb_wid_alloc)
+#define FBIO_WID_FREE  _IOW('F', 31, struct fb_wid_alloc)
+#define FBIO_WID_PUT   _IOW('F', 32, struct fb_wid_list)
+#define FBIO_WID_GET   _IOWR('F', 33, struct fb_wid_list)
+
+/* Creator ioctls */
+#define FFB_IOCTL      ('F'<<8)
+#define FFB_SYS_INFO           (FFB_IOCTL|80)
+#define FFB_CLUTREAD           (FFB_IOCTL|81)
+#define FFB_CLUTPOST           (FFB_IOCTL|82)
+#define FFB_SETDIAGMODE                (FFB_IOCTL|83)
+#define FFB_GETMONITORID       (FFB_IOCTL|84)
+#define FFB_GETVIDEOMODE       (FFB_IOCTL|85)
+#define FFB_SETVIDEOMODE       (FFB_IOCTL|86)
+#define FFB_SETSERVER          (FFB_IOCTL|87)
+#define FFB_SETOVCTL           (FFB_IOCTL|88)
+#define FFB_GETOVCTL           (FFB_IOCTL|89)
+#define FFB_GETSAXNUM          (FFB_IOCTL|90)
+#define FFB_FBDEBUG            (FFB_IOCTL|91)
+
+/* Cg14 ioctls */
+#define MDI_IOCTL          ('M'<<8)
+#define MDI_RESET          (MDI_IOCTL|1)
+#define MDI_GET_CFGINFO    (MDI_IOCTL|2)
+#define MDI_SET_PIXELMODE  (MDI_IOCTL|3)
+#    define MDI_32_PIX     32
+#    define MDI_16_PIX     16
+#    define MDI_8_PIX      8
+
+struct mdi_cfginfo {
+       int     mdi_ncluts;     /* Number of implemented CLUTs in this MDI */
+        int     mdi_type;       /* FBTYPE name */
+        int     mdi_height;     /* height */
+        int     mdi_width;      /* widht */
+        int     mdi_size;       /* available ram */
+        int     mdi_mode;       /* 8bpp, 16bpp or 32bpp */
+        int     mdi_pixfreq;    /* pixel clock (from PROM) */
+};
+
+/* SparcLinux specific ioctl for the MDI, should be replaced for
+ * the SET_XLUT/SET_CLUTn ioctls instead
+ */
+#define MDI_CLEAR_XLUT       (MDI_IOCTL|9)
+
+/* leo & ffb ioctls */
+struct fb_clut_alloc {
+       __u32   clutid; /* Set on return */
+       __u32   flag;
+       __u32   index;
+};
+
+struct fb_clut {
+#define FB_CLUT_WAIT   0x00000001      /* Not yet implemented */
+       __u32   flag;
+       __u32   clutid;
+       __u32   offset;
+       __u32   count;
+       char *  red;
+       char *  green;
+       char *  blue;
+};
+
+struct fb_clut32 {
+       __u32   flag;
+       __u32   clutid;
+       __u32   offset;
+       __u32   count;
+       __u32   red;
+       __u32   green;
+       __u32   blue;
+};
+
+#define LEO_CLUTALLOC  _IOWR('L', 53, struct fb_clut_alloc)
+#define LEO_CLUTFREE   _IOW('L', 54, struct fb_clut_alloc)
+#define LEO_CLUTREAD   _IOW('L', 55, struct fb_clut)
+#define LEO_CLUTPOST   _IOW('L', 56, struct fb_clut)
+#define LEO_SETGAMMA   _IOW('L', 68, int) /* Not yet implemented */
+#define LEO_GETGAMMA   _IOR('L', 69, int) /* Not yet implemented */
+
+#ifdef __KERNEL__
+/* Addresses on the fd of a cgsix that are mappable */
+#define CG6_FBC    0x70000000
+#define CG6_TEC    0x70001000
+#define CG6_BTREGS 0x70002000
+#define CG6_FHC    0x70004000
+#define CG6_THC    0x70005000
+#define CG6_ROM    0x70006000
+#define CG6_RAM    0x70016000
+#define CG6_DHC    0x80000000
+
+#define CG3_MMAP_OFFSET 0x4000000
+
+/* Addresses on the fd of a tcx that are mappable */
+#define TCX_RAM8BIT            0x00000000
+#define TCX_RAM24BIT                   0x01000000
+#define TCX_UNK3               0x10000000
+#define TCX_UNK4               0x20000000
+#define TCX_CONTROLPLANE       0x28000000
+#define TCX_UNK6               0x30000000
+#define TCX_UNK7               0x38000000
+#define TCX_TEC                0x70000000
+#define TCX_BTREGS             0x70002000
+#define TCX_THC                0x70004000
+#define TCX_DHC                0x70008000
+#define TCX_ALT                        0x7000a000
+#define TCX_SYNC               0x7000e000
+#define TCX_UNK2               0x70010000
+
+/* CG14 definitions */
+
+/* Offsets into the OBIO space: */
+#define CG14_REGS        0       /* registers */
+#define CG14_CURSORREGS  0x1000  /* cursor registers */
+#define CG14_DACREGS     0x2000  /* DAC registers */
+#define CG14_XLUT        0x3000  /* X Look Up Table -- ??? */
+#define CG14_CLUT1       0x4000  /* Color Look Up Table */
+#define CG14_CLUT2       0x5000  /* Color Look Up Table */
+#define CG14_CLUT3       0x6000  /* Color Look Up Table */
+#define CG14_AUTO       0xf000
+
+#endif /* KERNEL */
+
+/* These are exported to userland for applications to use */
+/* Mappable offsets for the cg14: control registers */
+#define MDI_DIRECT_MAP 0x10000000
+#define MDI_CTLREG_MAP 0x20000000
+#define MDI_CURSOR_MAP 0x30000000
+#define MDI_SHDW_VRT_MAP 0x40000000
+
+/* Mappable offsets for the cg14: frame buffer resolutions */
+/* 32 bits */
+#define MDI_CHUNKY_XBGR_MAP 0x50000000
+#define MDI_CHUNKY_BGR_MAP 0x60000000
+
+/* 16 bits */
+#define MDI_PLANAR_X16_MAP 0x70000000
+#define MDI_PLANAR_C16_MAP 0x80000000
+
+/* 8 bit is done as CG3 MMAP offset */
+/* 32 bits, planar */
+#define MDI_PLANAR_X32_MAP 0x90000000
+#define MDI_PLANAR_B32_MAP 0xa0000000
+#define MDI_PLANAR_G32_MAP 0xb0000000
+#define MDI_PLANAR_R32_MAP 0xc0000000
+
+/* Mappable offsets on leo */
+#define LEO_SS0_MAP            0x00000000
+#define LEO_LC_SS0_USR_MAP     0x00800000
+#define LEO_LD_SS0_MAP         0x00801000
+#define LEO_LX_CURSOR_MAP      0x00802000
+#define LEO_SS1_MAP            0x00803000
+#define LEO_LC_SS1_USR_MAP     0x01003000
+#define LEO_LD_SS1_MAP         0x01004000
+#define LEO_UNK_MAP            0x01005000
+#define LEO_LX_KRN_MAP         0x01006000
+#define LEO_LC_SS0_KRN_MAP     0x01007000
+#define LEO_LC_SS1_KRN_MAP     0x01008000
+#define LEO_LD_GBL_MAP         0x01009000
+#define LEO_UNK2_MAP           0x0100a000
+
+#ifdef __KERNEL__
+struct  fbcmap32 {
+       int             index;          /* first element (0 origin) */
+       int             count;
+       u32             red;
+       u32             green;
+       u32             blue;
+};
+
+#define FBIOPUTCMAP32  _IOW('F', 3, struct fbcmap32)
+#define FBIOGETCMAP32  _IOW('F', 4, struct fbcmap32)
+
+struct fbcursor32 {
+       short set;              /* what to set, choose from the list above */
+       short enable;           /* cursor on/off */
+       struct fbcurpos pos;    /* cursor position */
+       struct fbcurpos hot;    /* cursor hot spot */
+       struct fbcmap32 cmap;   /* color map info */
+       struct fbcurpos size;   /* cursor bit map size */
+       u32     image;          /* cursor image bits */
+       u32     mask;           /* cursor mask bits */
+};
+
+#define FBIOSCURSOR32  _IOW('F', 24, struct fbcursor32)
+#define FBIOGCURSOR32  _IOW('F', 25, struct fbcursor32)
+#endif
+
+#endif /* __LINUX_FBIO_H */
index 4349eaf..160616a 100644 (file)
@@ -1,6 +1,25 @@
 #ifndef _M68K_IDPROM_H
 #define _M68K_IDPROM_H
-#include <asm-sparc/idprom.h>
+/*
+ * idprom.h: Macros and defines for idprom routines
+ *
+ * Copyright (C) 1995,1996 David S. Miller (davem@caip.rutgers.edu)
+ */
+
+#include <linux/types.h>
+
+struct idprom {
+       u8              id_format;      /* Format identifier (always 0x01) */
+       u8              id_machtype;    /* Machine type */
+       u8              id_ethaddr[6];  /* Hardware ethernet address */
+       s32             id_date;        /* Date of manufacture */
+       u32             id_sernum:24;   /* Unique serial number */
+       u8              id_cksum;       /* Checksum - xor of the data bytes */
+       u8              reserved[16];
+};
+
+extern struct idprom *idprom;
+extern void idprom_init(void);
 
 /* Sun3: in control space */
 #define SUN3_IDPROM_BASE       0x00000000
diff --git a/include/asm-mips/gdb-stub.h b/include/asm-mips/gdb-stub.h
deleted file mode 100644 (file)
index 22f67d4..0000000
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * 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) 1995 Andreas Busse
- * Copyright (C) 2003 Ralf Baechle
- */
-#ifndef _ASM_GDB_STUB_H
-#define _ASM_GDB_STUB_H
-
-
-/*
- * important register numbers
- */
-
-#define REG_EPC                        37
-#define REG_FP                 72
-#define REG_SP                 29
-
-/*
- * Stack layout for the GDB exception handler
- * Derived from the stack layout described in asm-mips/stackframe.h
- *
- * The first PTRSIZE*6 bytes are argument save space for C subroutines.
- */
-#define NUMREGS                        90
-
-#define GDB_FR_REG0            (PTRSIZE*6)                     /* 0 */
-#define GDB_FR_REG1            ((GDB_FR_REG0) + LONGSIZE)      /* 1 */
-#define GDB_FR_REG2            ((GDB_FR_REG1) + LONGSIZE)      /* 2 */
-#define GDB_FR_REG3            ((GDB_FR_REG2) + LONGSIZE)      /* 3 */
-#define GDB_FR_REG4            ((GDB_FR_REG3) + LONGSIZE)      /* 4 */
-#define GDB_FR_REG5            ((GDB_FR_REG4) + LONGSIZE)      /* 5 */
-#define GDB_FR_REG6            ((GDB_FR_REG5) + LONGSIZE)      /* 6 */
-#define GDB_FR_REG7            ((GDB_FR_REG6) + LONGSIZE)      /* 7 */
-#define GDB_FR_REG8            ((GDB_FR_REG7) + LONGSIZE)      /* 8 */
-#define GDB_FR_REG9            ((GDB_FR_REG8) + LONGSIZE)      /* 9 */
-#define GDB_FR_REG10           ((GDB_FR_REG9) + LONGSIZE)      /* 10 */
-#define GDB_FR_REG11           ((GDB_FR_REG10) + LONGSIZE)     /* 11 */
-#define GDB_FR_REG12           ((GDB_FR_REG11) + LONGSIZE)     /* 12 */
-#define GDB_FR_REG13           ((GDB_FR_REG12) + LONGSIZE)     /* 13 */
-#define GDB_FR_REG14           ((GDB_FR_REG13) + LONGSIZE)     /* 14 */
-#define GDB_FR_REG15           ((GDB_FR_REG14) + LONGSIZE)     /* 15 */
-#define GDB_FR_REG16           ((GDB_FR_REG15) + LONGSIZE)     /* 16 */
-#define GDB_FR_REG17           ((GDB_FR_REG16) + LONGSIZE)     /* 17 */
-#define GDB_FR_REG18           ((GDB_FR_REG17) + LONGSIZE)     /* 18 */
-#define GDB_FR_REG19           ((GDB_FR_REG18) + LONGSIZE)     /* 19 */
-#define GDB_FR_REG20           ((GDB_FR_REG19) + LONGSIZE)     /* 20 */
-#define GDB_FR_REG21           ((GDB_FR_REG20) + LONGSIZE)     /* 21 */
-#define GDB_FR_REG22           ((GDB_FR_REG21) + LONGSIZE)     /* 22 */
-#define GDB_FR_REG23           ((GDB_FR_REG22) + LONGSIZE)     /* 23 */
-#define GDB_FR_REG24           ((GDB_FR_REG23) + LONGSIZE)     /* 24 */
-#define GDB_FR_REG25           ((GDB_FR_REG24) + LONGSIZE)     /* 25 */
-#define GDB_FR_REG26           ((GDB_FR_REG25) + LONGSIZE)     /* 26 */
-#define GDB_FR_REG27           ((GDB_FR_REG26) + LONGSIZE)     /* 27 */
-#define GDB_FR_REG28           ((GDB_FR_REG27) + LONGSIZE)     /* 28 */
-#define GDB_FR_REG29           ((GDB_FR_REG28) + LONGSIZE)     /* 29 */
-#define GDB_FR_REG30           ((GDB_FR_REG29) + LONGSIZE)     /* 30 */
-#define GDB_FR_REG31           ((GDB_FR_REG30) + LONGSIZE)     /* 31 */
-
-/*
- * Saved special registers
- */
-#define GDB_FR_STATUS          ((GDB_FR_REG31) + LONGSIZE)     /* 32 */
-#define GDB_FR_LO              ((GDB_FR_STATUS) + LONGSIZE)    /* 33 */
-#define GDB_FR_HI              ((GDB_FR_LO) + LONGSIZE)        /* 34 */
-#define GDB_FR_BADVADDR                ((GDB_FR_HI) + LONGSIZE)        /* 35 */
-#define GDB_FR_CAUSE           ((GDB_FR_BADVADDR) + LONGSIZE)  /* 36 */
-#define GDB_FR_EPC             ((GDB_FR_CAUSE) + LONGSIZE)     /* 37 */
-
-/*
- * Saved floating point registers
- */
-#define GDB_FR_FPR0            ((GDB_FR_EPC) + LONGSIZE)       /* 38 */
-#define GDB_FR_FPR1            ((GDB_FR_FPR0) + LONGSIZE)      /* 39 */
-#define GDB_FR_FPR2            ((GDB_FR_FPR1) + LONGSIZE)      /* 40 */
-#define GDB_FR_FPR3            ((GDB_FR_FPR2) + LONGSIZE)      /* 41 */
-#define GDB_FR_FPR4            ((GDB_FR_FPR3) + LONGSIZE)      /* 42 */
-#define GDB_FR_FPR5            ((GDB_FR_FPR4) + LONGSIZE)      /* 43 */
-#define GDB_FR_FPR6            ((GDB_FR_FPR5) + LONGSIZE)      /* 44 */
-#define GDB_FR_FPR7            ((GDB_FR_FPR6) + LONGSIZE)      /* 45 */
-#define GDB_FR_FPR8            ((GDB_FR_FPR7) + LONGSIZE)      /* 46 */
-#define GDB_FR_FPR9            ((GDB_FR_FPR8) + LONGSIZE)      /* 47 */
-#define GDB_FR_FPR10           ((GDB_FR_FPR9) + LONGSIZE)      /* 48 */
-#define GDB_FR_FPR11           ((GDB_FR_FPR10) + LONGSIZE)     /* 49 */
-#define GDB_FR_FPR12           ((GDB_FR_FPR11) + LONGSIZE)     /* 50 */
-#define GDB_FR_FPR13           ((GDB_FR_FPR12) + LONGSIZE)     /* 51 */
-#define GDB_FR_FPR14           ((GDB_FR_FPR13) + LONGSIZE)     /* 52 */
-#define GDB_FR_FPR15           ((GDB_FR_FPR14) + LONGSIZE)     /* 53 */
-#define GDB_FR_FPR16           ((GDB_FR_FPR15) + LONGSIZE)     /* 54 */
-#define GDB_FR_FPR17           ((GDB_FR_FPR16) + LONGSIZE)     /* 55 */
-#define GDB_FR_FPR18           ((GDB_FR_FPR17) + LONGSIZE)     /* 56 */
-#define GDB_FR_FPR19           ((GDB_FR_FPR18) + LONGSIZE)     /* 57 */
-#define GDB_FR_FPR20           ((GDB_FR_FPR19) + LONGSIZE)     /* 58 */
-#define GDB_FR_FPR21           ((GDB_FR_FPR20) + LONGSIZE)     /* 59 */
-#define GDB_FR_FPR22           ((GDB_FR_FPR21) + LONGSIZE)     /* 60 */
-#define GDB_FR_FPR23           ((GDB_FR_FPR22) + LONGSIZE)     /* 61 */
-#define GDB_FR_FPR24           ((GDB_FR_FPR23) + LONGSIZE)     /* 62 */
-#define GDB_FR_FPR25           ((GDB_FR_FPR24) + LONGSIZE)     /* 63 */
-#define GDB_FR_FPR26           ((GDB_FR_FPR25) + LONGSIZE)     /* 64 */
-#define GDB_FR_FPR27           ((GDB_FR_FPR26) + LONGSIZE)     /* 65 */
-#define GDB_FR_FPR28           ((GDB_FR_FPR27) + LONGSIZE)     /* 66 */
-#define GDB_FR_FPR29           ((GDB_FR_FPR28) + LONGSIZE)     /* 67 */
-#define GDB_FR_FPR30           ((GDB_FR_FPR29) + LONGSIZE)     /* 68 */
-#define GDB_FR_FPR31           ((GDB_FR_FPR30) + LONGSIZE)     /* 69 */
-
-#define GDB_FR_FSR             ((GDB_FR_FPR31) + LONGSIZE)     /* 70 */
-#define GDB_FR_FIR             ((GDB_FR_FSR) + LONGSIZE)       /* 71 */
-#define GDB_FR_FRP             ((GDB_FR_FIR) + LONGSIZE)       /* 72 */
-
-#define GDB_FR_DUMMY           ((GDB_FR_FRP) + LONGSIZE)       /* 73, unused ??? */
-
-/*
- * Again, CP0 registers
- */
-#define GDB_FR_CP0_INDEX       ((GDB_FR_DUMMY) + LONGSIZE)     /* 74 */
-#define GDB_FR_CP0_RANDOM      ((GDB_FR_CP0_INDEX) + LONGSIZE) /* 75 */
-#define GDB_FR_CP0_ENTRYLO0    ((GDB_FR_CP0_RANDOM) + LONGSIZE)/* 76 */
-#define GDB_FR_CP0_ENTRYLO1    ((GDB_FR_CP0_ENTRYLO0) + LONGSIZE)/* 77 */
-#define GDB_FR_CP0_CONTEXT     ((GDB_FR_CP0_ENTRYLO1) + LONGSIZE)/* 78 */
-#define GDB_FR_CP0_PAGEMASK    ((GDB_FR_CP0_CONTEXT) + LONGSIZE)/* 79 */
-#define GDB_FR_CP0_WIRED       ((GDB_FR_CP0_PAGEMASK) + LONGSIZE)/* 80 */
-#define GDB_FR_CP0_REG7                ((GDB_FR_CP0_WIRED) + LONGSIZE) /* 81 */
-#define GDB_FR_CP0_REG8                ((GDB_FR_CP0_REG7) + LONGSIZE)  /* 82 */
-#define GDB_FR_CP0_REG9                ((GDB_FR_CP0_REG8) + LONGSIZE)  /* 83 */
-#define GDB_FR_CP0_ENTRYHI     ((GDB_FR_CP0_REG9) + LONGSIZE)  /* 84 */
-#define GDB_FR_CP0_REG11       ((GDB_FR_CP0_ENTRYHI) + LONGSIZE)/* 85 */
-#define GDB_FR_CP0_REG12       ((GDB_FR_CP0_REG11) + LONGSIZE) /* 86 */
-#define GDB_FR_CP0_REG13       ((GDB_FR_CP0_REG12) + LONGSIZE) /* 87 */
-#define GDB_FR_CP0_REG14       ((GDB_FR_CP0_REG13) + LONGSIZE) /* 88 */
-#define GDB_FR_CP0_PRID                ((GDB_FR_CP0_REG14) + LONGSIZE) /* 89 */
-
-#define GDB_FR_SIZE            ((((GDB_FR_CP0_PRID) + LONGSIZE) + (PTRSIZE-1)) & ~(PTRSIZE-1))
-
-#ifndef __ASSEMBLY__
-
-/*
- * This is the same as above, but for the high-level
- * part of the GDB stub.
- */
-
-struct gdb_regs {
-       /*
-        * Pad bytes for argument save space on the stack
-        * 24/48 Bytes for 32/64 bit code
-        */
-       unsigned long pad0[6];
-
-       /*
-        * saved main processor registers
-        */
-       long     reg0,  reg1,  reg2,  reg3,  reg4,  reg5,  reg6,  reg7;
-       long     reg8,  reg9, reg10, reg11, reg12, reg13, reg14, reg15;
-       long    reg16, reg17, reg18, reg19, reg20, reg21, reg22, reg23;
-       long    reg24, reg25, reg26, reg27, reg28, reg29, reg30, reg31;
-
-       /*
-        * Saved special registers
-        */
-       long    cp0_status;
-       long    lo;
-       long    hi;
-       long    cp0_badvaddr;
-       long    cp0_cause;
-       long    cp0_epc;
-
-       /*
-        * Saved floating point registers
-        */
-       long    fpr0,  fpr1,  fpr2,  fpr3,  fpr4,  fpr5,  fpr6,  fpr7;
-       long    fpr8,  fpr9,  fpr10, fpr11, fpr12, fpr13, fpr14, fpr15;
-       long    fpr16, fpr17, fpr18, fpr19, fpr20, fpr21, fpr22, fpr23;
-       long    fpr24, fpr25, fpr26, fpr27, fpr28, fpr29, fpr30, fpr31;
-
-       long    cp1_fsr;
-       long    cp1_fir;
-
-       /*
-        * Frame pointer
-        */
-       long    frame_ptr;
-       long    dummy;          /* unused */
-
-       /*
-        * saved cp0 registers
-        */
-       long    cp0_index;
-       long    cp0_random;
-       long    cp0_entrylo0;
-       long    cp0_entrylo1;
-       long    cp0_context;
-       long    cp0_pagemask;
-       long    cp0_wired;
-       long    cp0_reg7;
-       long    cp0_reg8;
-       long    cp0_reg9;
-       long    cp0_entryhi;
-       long    cp0_reg11;
-       long    cp0_reg12;
-       long    cp0_reg13;
-       long    cp0_reg14;
-       long    cp0_prid;
-};
-
-/*
- * Prototypes
- */
-
-extern int kgdb_enabled;
-void set_debug_traps(void);
-void set_async_breakpoint(unsigned long *epc);
-
-#endif /* !__ASSEMBLY__ */
-#endif /* _ASM_GDB_STUB_H */
index 6ece1b0..5bf62aa 100644 (file)
@@ -1 +1,13 @@
-#include <asm-generic/kdebug.h>
+#ifndef _ASM_MIPS_KDEBUG_H
+#define _ASM_MIPS_KDEBUG_H
+
+#include <linux/notifier.h>
+
+enum die_val {
+       DIE_OOPS = 1,
+       DIE_FP,
+       DIE_TRAP,
+       DIE_RI,
+};
+
+#endif /* _ASM_MIPS_KDEBUG_H */
diff --git a/include/asm-mips/kgdb.h b/include/asm-mips/kgdb.h
new file mode 100644 (file)
index 0000000..48223b0
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef __ASM_KGDB_H_
+#define __ASM_KGDB_H_
+
+#ifdef __KERNEL__
+
+#include <asm/sgidefs.h>
+
+#if (_MIPS_ISA == _MIPS_ISA_MIPS1) || (_MIPS_ISA == _MIPS_ISA_MIPS2) || \
+       (_MIPS_ISA == _MIPS_ISA_MIPS32)
+
+#define KGDB_GDB_REG_SIZE 32
+
+#elif (_MIPS_ISA == _MIPS_ISA_MIPS3) || (_MIPS_ISA == _MIPS_ISA_MIPS4) || \
+       (_MIPS_ISA == _MIPS_ISA_MIPS64)
+
+#ifdef CONFIG_32BIT
+#define KGDB_GDB_REG_SIZE 32
+#else /* CONFIG_CPU_32BIT */
+#define KGDB_GDB_REG_SIZE 64
+#endif
+#else
+#error "Need to set KGDB_GDB_REG_SIZE for MIPS ISA"
+#endif /* _MIPS_ISA */
+
+#define BUFMAX                 2048
+#if (KGDB_GDB_REG_SIZE == 32)
+#define NUMREGBYTES            (90*sizeof(u32))
+#define NUMCRITREGBYTES                (12*sizeof(u32))
+#else
+#define NUMREGBYTES            (90*sizeof(u64))
+#define NUMCRITREGBYTES                (12*sizeof(u64))
+#endif
+#define BREAK_INSTR_SIZE       4
+#define CACHE_FLUSH_IS_SAFE    0
+
+extern void arch_kgdb_breakpoint(void);
+extern int kgdb_early_setup;
+extern void *saved_vectors[32];
+extern void handle_exception(struct pt_regs *regs);
+extern void breakinst(void);
+
+#endif                         /* __KERNEL__ */
+
+#endif /* __ASM_KGDB_H_ */
index c205875..5510c53 100644 (file)
@@ -174,4 +174,6 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
 
 extern int pci_probe_only;
 
+extern char * (*pcibios_plat_setup)(char *str);
+
 #endif /* _ASM_PCI_H */
index cbae37e..5b1ccf9 100644 (file)
@@ -44,5 +44,19 @@ extern struct txx9_board_vec *txx9_board_vec;
 extern int (*txx9_irq_dispatch)(int pending);
 void prom_init_cmdline(void);
 char *prom_getcmdline(void);
+void txx9_wdt_init(unsigned long base);
+void txx9_spi_init(int busid, unsigned long base, int irq);
+void txx9_ethaddr_init(unsigned int id, unsigned char *ethaddr);
+void txx9_sio_init(unsigned long baseaddr, int irq,
+                  unsigned int line, unsigned int sclk, int nocts);
+void prom_putchar(char c);
+#ifdef CONFIG_EARLY_PRINTK
+extern void (*txx9_prom_putchar)(char c);
+void txx9_sio_putchar_init(unsigned long baseaddr);
+#else
+static inline void txx9_sio_putchar_init(unsigned long baseaddr)
+{
+}
+#endif
 
 #endif /* __ASM_TXX9_GENERIC_H */
index d6eb1b6..a409c44 100644 (file)
 
 /* Clocks */
 #define JMR3927_CORECLK        132710400       /* 132.7MHz */
-#define JMR3927_GBUSCLK        (JMR3927_CORECLK / 2)   /* 66.35MHz */
-#define JMR3927_IMCLK  (JMR3927_CORECLK / 4)   /* 33.17MHz */
 
 /*
  * TX3927 Pin Configuration:
index d89a450..3d32529 100644 (file)
@@ -33,4 +33,7 @@ enum txx9_pci_err_action {
 };
 extern enum txx9_pci_err_action txx9_pci_err_action;
 
+extern char * (*txx9_board_pcibios_setup)(char *str);
+char *txx9_pcibios_setup(char *str);
+
 #endif /* __ASM_TXX9_PCI_H */
index 9375e4f..02e161d 100644 (file)
@@ -56,7 +56,7 @@
 #define SMSC_FDC37M81X_CONFIG_EXIT   0xaa
 #define SMSC_FDC37M81X_CHIP_ID       0x4d
 
-unsigned long __init smsc_fdc37m81x_init(unsigned long port);
+unsigned long smsc_fdc37m81x_init(unsigned long port);
 
 void smsc_fdc37m81x_config_beg(void);
 
index ea79e1b..587deb9 100644 (file)
@@ -8,9 +8,8 @@
 #ifndef __ASM_TXX9_TX3927_H
 #define __ASM_TXX9_TX3927_H
 
-#include <asm/txx9/txx927.h>
-
 #define TX3927_REG_BASE        0xfffe0000UL
+#define TX3927_REG_SIZE        0x00010000
 #define TX3927_SDRAMC_REG      (TX3927_REG_BASE + 0x8000)
 #define TX3927_ROMC_REG                (TX3927_REG_BASE + 0x9000)
 #define TX3927_DMA_REG         (TX3927_REG_BASE + 0xb000)
@@ -236,11 +235,17 @@ struct tx3927_ccfg_reg {
 /* see PCI_STATUS_XXX in linux/pci.h */
 #define PCI_STATUS_NEW_CAP     0x0010
 
+/* bits for ISTAT/IIM */
+#define TX3927_PCIC_IIM_ALL    0x00001600
+
 /* bits for TC */
 #define TX3927_PCIC_TC_OF16E   0x00000020
 #define TX3927_PCIC_TC_IF8E    0x00000010
 #define TX3927_PCIC_TC_OF8E    0x00000008
 
+/* bits for TSTAT/TIM */
+#define TX3927_PCIC_TIM_ALL    0x0003ffff
+
 /* bits for IOBA/MBA */
 /* see PCI_BASE_ADDRESS_XXX in linux/pci.h */
 
@@ -313,12 +318,22 @@ struct tx3927_ccfg_reg {
 #define tx3927_dmaptr          ((struct tx3927_dma_reg *)TX3927_DMA_REG)
 #define tx3927_pcicptr         ((struct tx3927_pcic_reg *)TX3927_PCIC_REG)
 #define tx3927_ccfgptr         ((struct tx3927_ccfg_reg *)TX3927_CCFG_REG)
-#define tx3927_tmrptr(ch)      ((struct txx927_tmr_reg *)TX3927_TMR_REG(ch))
 #define tx3927_sioptr(ch)      ((struct txx927_sio_reg *)TX3927_SIO_REG(ch))
 #define tx3927_pioptr          ((struct txx9_pio_reg __iomem *)TX3927_PIO_REG)
 
+#define TX3927_REV_PCODE()     (tx3927_ccfgptr->crir >> 16)
+#define TX3927_ROMC_BA(ch)     (tx3927_romcptr->cr[(ch)] & 0xfff00000)
+#define TX3927_ROMC_SIZE(ch)   \
+       (0x00100000 << ((tx3927_romcptr->cr[(ch)] >> 8) & 0xf))
+
+void tx3927_wdt_init(void);
+void tx3927_setup(void);
+void tx3927_time_init(unsigned int evt_tmrnr, unsigned int src_tmrnr);
+void tx3927_sio_init(unsigned int sclk, unsigned int cts_mask);
 struct pci_controller;
-void __init tx3927_pcic_setup(struct pci_controller *channel,
-                             unsigned long sdram_size, int extarb);
+void tx3927_pcic_setup(struct pci_controller *channel,
+                      unsigned long sdram_size, int extarb);
+void tx3927_setup_pcierr_irq(void);
+void tx3927_irq_init(void);
 
 #endif /* __ASM_TXX9_TX3927_H */
index ceb4b79..195f651 100644 (file)
@@ -243,12 +243,13 @@ static inline void tx4927_ccfg_change(__u64 change, __u64 new)
 }
 
 unsigned int tx4927_get_mem_size(void);
-void tx4927_wdr_init(void);
+void tx4927_wdt_init(void);
 void tx4927_setup(void);
 void tx4927_time_init(unsigned int tmrnr);
-void tx4927_setup_serial(void);
+void tx4927_sio_init(unsigned int sclk, unsigned int cts_mask);
 int tx4927_report_pciclk(void);
 int tx4927_pciclk66_setup(void);
+void tx4927_setup_pcierr_irq(void);
 void tx4927_irq_init(void);
 
 #endif /* __ASM_TXX9_TX4927_H */
index d61c3d0..c470b8a 100644 (file)
@@ -10,6 +10,7 @@
 #define __ASM_TXX9_TX4927PCIC_H
 
 #include <linux/pci.h>
+#include <linux/irqreturn.h>
 
 struct tx4927_pcic_reg {
        u32 pciid;
@@ -192,8 +193,11 @@ struct tx4927_pcic_reg {
 
 struct tx4927_pcic_reg __iomem *get_tx4927_pcicptr(
        struct pci_controller *channel);
-void __init tx4927_pcic_setup(struct tx4927_pcic_reg __iomem *pcicptr,
-                             struct pci_controller *channel, int extarb);
+void tx4927_pcic_setup(struct tx4927_pcic_reg __iomem *pcicptr,
+                      struct pci_controller *channel, int extarb);
 void tx4927_report_pcic_status(void);
+char *tx4927_pcibios_setup(char *str);
+void tx4927_dump_pcic_settings(void);
+irqreturn_t tx4927_pcierr_interrupt(int irq, void *dev_id);
 
 #endif /* __ASM_TXX9_TX4927PCIC_H */
index 1ed969d..8175d4c 100644 (file)
@@ -276,15 +276,18 @@ struct tx4938_ccfg_reg {
 #define TX4938_EBUSC_SIZE(ch)  TX4927_EBUSC_SIZE(ch)
 
 #define tx4938_get_mem_size() tx4927_get_mem_size()
-void tx4938_wdr_init(void);
+void tx4938_wdt_init(void);
 void tx4938_setup(void);
 void tx4938_time_init(unsigned int tmrnr);
-void tx4938_setup_serial(void);
+void tx4938_sio_init(unsigned int sclk, unsigned int cts_mask);
+void tx4938_spi_init(int busid);
+void tx4938_ethaddr_init(unsigned char *addr0, unsigned char *addr1);
 int tx4938_report_pciclk(void);
 void tx4938_report_pci1clk(void);
 int tx4938_pciclk66_setup(void);
 struct pci_dev;
 int tx4938_pcic1_map_irq(const struct pci_dev *dev, u8 slot);
+void tx4938_setup_pcierr_irq(void);
 void tx4938_irq_init(void);
 
 #endif
diff --git a/include/asm-mips/txx9/txx927.h b/include/asm-mips/txx9/txx927.h
deleted file mode 100644 (file)
index 97dd7ad..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Common definitions for TX3927/TX4927
- *
- * 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) 2000 Toshiba Corporation
- */
-#ifndef __ASM_TXX9_TXX927_H
-#define __ASM_TXX9_TXX927_H
-
-struct txx927_sio_reg {
-       volatile unsigned long lcr;
-       volatile unsigned long dicr;
-       volatile unsigned long disr;
-       volatile unsigned long cisr;
-       volatile unsigned long fcr;
-       volatile unsigned long flcr;
-       volatile unsigned long bgr;
-       volatile unsigned long tfifo;
-       volatile unsigned long rfifo;
-};
-
-/*
- * SIO
- */
-/* SILCR : Line Control */
-#define TXx927_SILCR_SCS_MASK  0x00000060
-#define TXx927_SILCR_SCS_IMCLK 0x00000000
-#define TXx927_SILCR_SCS_IMCLK_BG      0x00000020
-#define TXx927_SILCR_SCS_SCLK  0x00000040
-#define TXx927_SILCR_SCS_SCLK_BG       0x00000060
-#define TXx927_SILCR_UEPS      0x00000010
-#define TXx927_SILCR_UPEN      0x00000008
-#define TXx927_SILCR_USBL_MASK 0x00000004
-#define TXx927_SILCR_USBL_1BIT 0x00000004
-#define TXx927_SILCR_USBL_2BIT 0x00000000
-#define TXx927_SILCR_UMODE_MASK        0x00000003
-#define TXx927_SILCR_UMODE_8BIT        0x00000000
-#define TXx927_SILCR_UMODE_7BIT        0x00000001
-
-/* SIDICR : DMA/Int. Control */
-#define TXx927_SIDICR_TDE      0x00008000
-#define TXx927_SIDICR_RDE      0x00004000
-#define TXx927_SIDICR_TIE      0x00002000
-#define TXx927_SIDICR_RIE      0x00001000
-#define TXx927_SIDICR_SPIE     0x00000800
-#define TXx927_SIDICR_CTSAC    0x00000600
-#define TXx927_SIDICR_STIE_MASK        0x0000003f
-#define TXx927_SIDICR_STIE_OERS                0x00000020
-#define TXx927_SIDICR_STIE_CTSS                0x00000010
-#define TXx927_SIDICR_STIE_RBRKD       0x00000008
-#define TXx927_SIDICR_STIE_TRDY                0x00000004
-#define TXx927_SIDICR_STIE_TXALS       0x00000002
-#define TXx927_SIDICR_STIE_UBRKD       0x00000001
-
-/* SIDISR : DMA/Int. Status */
-#define TXx927_SIDISR_UBRK     0x00008000
-#define TXx927_SIDISR_UVALID   0x00004000
-#define TXx927_SIDISR_UFER     0x00002000
-#define TXx927_SIDISR_UPER     0x00001000
-#define TXx927_SIDISR_UOER     0x00000800
-#define TXx927_SIDISR_ERI      0x00000400
-#define TXx927_SIDISR_TOUT     0x00000200
-#define TXx927_SIDISR_TDIS     0x00000100
-#define TXx927_SIDISR_RDIS     0x00000080
-#define TXx927_SIDISR_STIS     0x00000040
-#define TXx927_SIDISR_RFDN_MASK        0x0000001f
-
-/* SICISR : Change Int. Status */
-#define TXx927_SICISR_OERS     0x00000020
-#define TXx927_SICISR_CTSS     0x00000010
-#define TXx927_SICISR_RBRKD    0x00000008
-#define TXx927_SICISR_TRDY     0x00000004
-#define TXx927_SICISR_TXALS    0x00000002
-#define TXx927_SICISR_UBRKD    0x00000001
-
-/* SIFCR : FIFO Control */
-#define TXx927_SIFCR_SWRST     0x00008000
-#define TXx927_SIFCR_RDIL_MASK 0x00000180
-#define TXx927_SIFCR_RDIL_1    0x00000000
-#define TXx927_SIFCR_RDIL_4    0x00000080
-#define TXx927_SIFCR_RDIL_8    0x00000100
-#define TXx927_SIFCR_RDIL_12   0x00000180
-#define TXx927_SIFCR_RDIL_MAX  0x00000180
-#define TXx927_SIFCR_TDIL_MASK 0x00000018
-#define TXx927_SIFCR_TDIL_MASK 0x00000018
-#define TXx927_SIFCR_TDIL_1    0x00000000
-#define TXx927_SIFCR_TDIL_4    0x00000001
-#define TXx927_SIFCR_TDIL_8    0x00000010
-#define TXx927_SIFCR_TDIL_MAX  0x00000010
-#define TXx927_SIFCR_TFRST     0x00000004
-#define TXx927_SIFCR_RFRST     0x00000002
-#define TXx927_SIFCR_FRSTE     0x00000001
-#define TXx927_SIO_TX_FIFO     8
-#define TXx927_SIO_RX_FIFO     16
-
-/* SIFLCR : Flow Control */
-#define TXx927_SIFLCR_RCS      0x00001000
-#define TXx927_SIFLCR_TES      0x00000800
-#define TXx927_SIFLCR_RTSSC    0x00000200
-#define TXx927_SIFLCR_RSDE     0x00000100
-#define TXx927_SIFLCR_TSDE     0x00000080
-#define TXx927_SIFLCR_RTSTL_MASK       0x0000001e
-#define TXx927_SIFLCR_RTSTL_MAX        0x0000001e
-#define TXx927_SIFLCR_TBRK     0x00000001
-
-/* SIBGR : Baudrate Control */
-#define TXx927_SIBGR_BCLK_MASK 0x00000300
-#define TXx927_SIBGR_BCLK_T0   0x00000000
-#define TXx927_SIBGR_BCLK_T2   0x00000100
-#define TXx927_SIBGR_BCLK_T4   0x00000200
-#define TXx927_SIBGR_BCLK_T6   0x00000300
-#define TXx927_SIBGR_BRD_MASK  0x000000ff
-
-/*
- * PIO
- */
-
-#endif /* __ASM_TXX9_TXX927_H */
index 1c439e5..5620879 100644 (file)
 #ifdef CONFIG_IRQ_CPU
 #define TXX9_IRQ_BASE  (MIPS_CPU_IRQ_BASE + 8)
 #else
+#ifdef CONFIG_I8259
+#define TXX9_IRQ_BASE  (I8259A_IRQ_BASE + 16)
+#else
 #define TXX9_IRQ_BASE  0
 #endif
+#endif
 
 #ifdef CONFIG_CPU_TX39XX
 #define TXx9_MAX_IR 16
index 3721aa9..543a4f9 100644 (file)
 #define __NR_fallocate         325
 #define __NR_timerfd_settime   326
 #define __NR_timerfd_gettime   327
+#define __NR_signalfd4         328
+#define __NR_eventfd2          329
+#define __NR_epoll_create1     330
+#define __NR_dup3              331
+#define __NR_pipe2             332
+#define __NR_inotify_init1     333
 
 #ifdef __KERNEL__
 
diff --git a/include/asm-sh/a.out.h b/include/asm-sh/a.out.h
deleted file mode 100644 (file)
index 1f93130..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef __ASM_SH_A_OUT_H
-#define __ASM_SH_A_OUT_H
-
-struct exec
-{
-  unsigned long a_info;                /* Use macros N_MAGIC, etc for access */
-  unsigned a_text;             /* length of text, in bytes */
-  unsigned a_data;             /* length of data, in bytes */
-  unsigned a_bss;              /* length of uninitialized data area for file, in bytes */
-  unsigned a_syms;             /* length of symbol table data in file, in bytes */
-  unsigned a_entry;            /* start address */
-  unsigned a_trsize;           /* length of relocation info for text, in bytes */
-  unsigned a_drsize;           /* length of relocation info for data, in bytes */
-};
-
-#define N_TRSIZE(a)    ((a).a_trsize)
-#define N_DRSIZE(a)    ((a).a_drsize)
-#define N_SYMSIZE(a)   ((a).a_syms)
-
-#endif /* __ASM_SH_A_OUT_H */
diff --git a/include/asm-sh/cpu-sh2a/cacheflush.h b/include/asm-sh/cpu-sh2a/cacheflush.h
deleted file mode 100644 (file)
index fa3186c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm/cpu-sh2/cacheflush.h>
diff --git a/include/asm-sh/cpu-sh2a/dma.h b/include/asm-sh/cpu-sh2a/dma.h
deleted file mode 100644 (file)
index 0d5ad85..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm/cpu-sh2/dma.h>
diff --git a/include/asm-sh/cpu-sh2a/mmu_context.h b/include/asm-sh/cpu-sh2a/mmu_context.h
deleted file mode 100644 (file)
index cd2387f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm/cpu-sh2/mmu_context.h>
diff --git a/include/asm-sh/cpu-sh2a/timer.h b/include/asm-sh/cpu-sh2a/timer.h
deleted file mode 100644 (file)
index fee504a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm/cpu-sh2/timer.h>
diff --git a/include/asm-sh/cpu-sh2a/ubc.h b/include/asm-sh/cpu-sh2a/ubc.h
deleted file mode 100644 (file)
index cf28062..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm/cpu-sh2/ubc.h>
diff --git a/include/asm-sh/cpu-sh2a/watchdog.h b/include/asm-sh/cpu-sh2a/watchdog.h
deleted file mode 100644 (file)
index c1b3e24..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm/cpu-sh2/watchdog.h>
diff --git a/include/asm-sh/cpu-sh3/addrspace.h b/include/asm-sh/cpu-sh3/addrspace.h
deleted file mode 100644 (file)
index 0f94726..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * 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 Kaz Kojima
- *
- * Defitions for the address spaces of the SH-3 CPUs.
- */
-#ifndef __ASM_CPU_SH3_ADDRSPACE_H
-#define __ASM_CPU_SH3_ADDRSPACE_H
-
-#define P0SEG          0x00000000
-#define P1SEG          0x80000000
-#define P2SEG          0xa0000000
-#define P3SEG          0xc0000000
-#define P4SEG          0xe0000000
-
-#endif /* __ASM_CPU_SH3_ADDRSPACE_H */
diff --git a/include/asm-sh/cpu-sh3/cacheflush.h b/include/asm-sh/cpu-sh3/cacheflush.h
deleted file mode 100644 (file)
index f70d8ef..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * include/asm-sh/cpu-sh3/cacheflush.h
- *
- * Copyright (C) 1999 Niibe Yutaka
- *
- * 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_CACHEFLUSH_H
-#define __ASM_CPU_SH3_CACHEFLUSH_H
-
-/*
- * Cache flushing:
- *
- *  - flush_cache_all() flushes entire cache
- *  - flush_cache_mm(mm) flushes the specified mm context's cache lines
- *  - flush_cache_dup mm(mm) handles cache flushing when forking
- *  - flush_cache_page(mm, vmaddr, pfn) flushes a single page
- *  - flush_cache_range(vma, start, end) flushes a range of pages
- *
- *  - flush_dcache_page(pg) flushes(wback&invalidates) a page for dcache
- *  - flush_icache_range(start, end) flushes(invalidates) a range for icache
- *  - flush_icache_page(vma, pg) flushes(invalidates) a page for icache
- *
- *  Caches are indexed (effectively) by physical address on SH-3, so
- *  we don't need them.
- */
-
-#if defined(CONFIG_SH7705_CACHE_32KB)
-
-/* SH7705 is an SH3 processor with 32KB cache. This has alias issues like the
- * SH4. Unlike the SH4 this is a unified cache so we need to do some work
- * in mmap when 'exec'ing a new binary
- */
- /* 32KB cache, 4kb PAGE sizes need to check bit 12 */
-#define CACHE_ALIAS 0x00001000
-
-#define PG_mapped      PG_arch_1
-
-void flush_cache_all(void);
-void flush_cache_mm(struct mm_struct *mm);
-#define flush_cache_dup_mm(mm) flush_cache_mm(mm)
-void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
-                              unsigned long end);
-void flush_cache_page(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn);
-void flush_dcache_page(struct page *pg);
-void flush_icache_range(unsigned long start, unsigned long end);
-void flush_icache_page(struct vm_area_struct *vma, struct page *page);
-#else
-#define flush_cache_all()                      do { } while (0)
-#define flush_cache_mm(mm)                     do { } while (0)
-#define flush_cache_dup_mm(mm)                 do { } while (0)
-#define flush_cache_range(vma, start, end)     do { } while (0)
-#define flush_cache_page(vma, vmaddr, pfn)     do { } while (0)
-#define flush_dcache_page(page)                        do { } while (0)
-#define flush_icache_range(start, end)         do { } while (0)
-#define flush_icache_page(vma,pg)              do { } while (0)
-#endif
-
-#define flush_dcache_mmap_lock(mapping)                do { } while (0)
-#define flush_dcache_mmap_unlock(mapping)      do { } while (0)
-
-/* SH3 has unified cache so no special action needed here */
-#define flush_cache_sigtramp(vaddr)            do { } while (0)
-#define flush_icache_user_range(vma,pg,adr,len)        do { } while (0)
-
-#define p3_cache_init()                                do { } while (0)
-
-#endif /* __ASM_CPU_SH3_CACHEFLUSH_H */
diff --git a/include/asm-sh/cpu-sh3/rtc.h b/include/asm-sh/cpu-sh3/rtc.h
deleted file mode 100644 (file)
index 319404a..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef __ASM_SH_CPU_SH3_RTC_H
-#define __ASM_SH_CPU_SH3_RTC_H
-
-#define rtc_reg_size           sizeof(u16)
-#define RTC_BIT_INVERTED       0       /* No bug on SH7708, SH7709A */
-#define RTC_DEF_CAPABILITIES   0UL
-
-#endif /* __ASM_SH_CPU_SH3_RTC_H */
diff --git a/include/asm-sh/cpu-sh3/sigcontext.h b/include/asm-sh/cpu-sh3/sigcontext.h
deleted file mode 100644 (file)
index 17310dc..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef __ASM_CPU_SH3_SIGCONTEXT_H
-#define __ASM_CPU_SH3_SIGCONTEXT_H
-
-struct sigcontext {
-       unsigned long   oldmask;
-
-       /* CPU registers */
-       unsigned long sc_regs[16];
-       unsigned long sc_pc;
-       unsigned long sc_pr;
-       unsigned long sc_sr;
-       unsigned long sc_gbr;
-       unsigned long sc_mach;
-       unsigned long sc_macl;
-};
-
-#endif /* __ASM_CPU_SH3_SIGCONTEXT_H */
diff --git a/include/asm-sh/cpu-sh5/timer.h b/include/asm-sh/cpu-sh5/timer.h
deleted file mode 100644 (file)
index 88da9b3..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef __ASM_SH_CPU_SH5_TIMER_H
-#define __ASM_SH_CPU_SH5_TIMER_H
-
-#endif /* __ASM_SH_CPU_SH5_TIMER_H */
index ecc8061..5f888cc 100644 (file)
@@ -7,6 +7,8 @@ extern struct dma_mapping_ops nommu_dma_ops;
 extern int force_iommu, no_iommu;
 extern int iommu_detected;
 
+extern unsigned long iommu_num_pages(unsigned long addr, unsigned long len);
+
 #ifdef CONFIG_GART_IOMMU
 extern int gart_iommu_aperture;
 extern int gart_iommu_aperture_allowed;
index bc34dc2..0f3c531 100644 (file)
@@ -13,6 +13,7 @@
 
 #include <linux/types.h>
 #include <linux/mm.h>
+#include <linux/mmu_notifier.h>
 
 #include <linux/kvm.h>
 #include <linux/kvm_para.h>
@@ -251,6 +252,7 @@ struct kvm_vcpu_arch {
                gfn_t gfn;      /* presumed gfn during guest pte update */
                pfn_t pfn;      /* pfn corresponding to that gfn */
                int largepage;
+               unsigned long mmu_seq;
        } update_pte;
 
        struct i387_fxsave_struct host_fx_image;
@@ -729,4 +731,8 @@ asmlinkage void kvm_handle_fault_on_reboot(void);
        KVM_EX_ENTRY " 666b, 667b \n\t" \
        ".popsection"
 
+#define KVM_ARCH_WANT_MMU_NOTIFIER
+int kvm_unmap_hva(struct kvm *kvm, unsigned long hva);
+int kvm_age_hva(struct kvm *kvm, unsigned long hva);
+
 #endif
index 4c4142c..a26f565 100644 (file)
@@ -97,6 +97,7 @@ header-y += ioctl.h
 header-y += ip6_tunnel.h
 header-y += ipmi_msgdefs.h
 header-y += ipsec.h
+header-y += ip_vs.h
 header-y += ipx.h
 header-y += irda.h
 header-y += iso_fs.h
index 88d6808..e61f22b 100644 (file)
@@ -655,6 +655,7 @@ extern struct request *blk_get_request(struct request_queue *, int, gfp_t);
 extern void blk_insert_request(struct request_queue *, struct request *, int, void *);
 extern void blk_requeue_request(struct request_queue *, struct request *);
 extern void blk_plug_device(struct request_queue *);
+extern void blk_plug_device_unlocked(struct request_queue *);
 extern int blk_remove_plug(struct request_queue *);
 extern void blk_recount_segments(struct request_queue *, struct bio *);
 extern int scsi_cmd_ioctl(struct file *, struct request_queue *,
index 50cfe8c..eadaab4 100644 (file)
@@ -115,7 +115,6 @@ BUFFER_FNS(Uptodate, uptodate)
 BUFFER_FNS(Dirty, dirty)
 TAS_BUFFER_FNS(Dirty, dirty)
 BUFFER_FNS(Lock, locked)
-TAS_BUFFER_FNS(Lock, locked)
 BUFFER_FNS(Req, req)
 TAS_BUFFER_FNS(Req, req)
 BUFFER_FNS(Mapped, mapped)
@@ -321,10 +320,15 @@ static inline void wait_on_buffer(struct buffer_head *bh)
                __wait_on_buffer(bh);
 }
 
+static inline int trylock_buffer(struct buffer_head *bh)
+{
+       return likely(!test_and_set_bit(BH_Lock, &bh->b_state));
+}
+
 static inline void lock_buffer(struct buffer_head *bh)
 {
        might_sleep();
-       if (test_set_buffer_locked(bh))
+       if (!trylock_buffer(bh))
                __lock_buffer(bh);
 }
 
index d62c19f..7f62777 100644 (file)
@@ -40,6 +40,7 @@
 #include <linux/list.h>
 #include <linux/kref.h>
 #include <linux/mutex.h>
+#include <linux/err.h>
 
 #include <asm/atomic.h>
 
@@ -129,8 +130,25 @@ struct configfs_attribute {
 /*
  * Users often need to create attribute structures for their configurable
  * attributes, containing a configfs_attribute member and function pointers
- * for the show() and store() operations on that attribute. They can use
- * this macro (similar to sysfs' __ATTR) to make defining attributes easier.
+ * for the show() and store() operations on that attribute. If they don't
+ * need anything else on the extended attribute structure, they can use
+ * this macro to define it  The argument _item is the name of the
+ * config_item structure.
+ */
+#define CONFIGFS_ATTR_STRUCT(_item)                                    \
+struct _item##_attribute {                                             \
+       struct configfs_attribute attr;                                 \
+       ssize_t (*show)(struct _item *, char *);                        \
+       ssize_t (*store)(struct _item *, const char *, size_t);         \
+}
+
+/*
+ * With the extended attribute structure, users can use this macro
+ * (similar to sysfs' __ATTR) to make defining attributes easier.
+ * An example:
+ * #define MYITEM_ATTR(_name, _mode, _show, _store)    \
+ * struct myitem_attribute childless_attr_##_name =    \
+ *         __CONFIGFS_ATTR(_name, _mode, _show, _store)
  */
 #define __CONFIGFS_ATTR(_name, _mode, _show, _store)                   \
 {                                                                      \
@@ -142,6 +160,52 @@ struct configfs_attribute {
        .show   = _show,                                                \
        .store  = _store,                                               \
 }
+/* Here is a readonly version, only requiring a show() operation */
+#define __CONFIGFS_ATTR_RO(_name, _show)                               \
+{                                                                      \
+       .attr   = {                                                     \
+                       .ca_name = __stringify(_name),                  \
+                       .ca_mode = 0444,                                \
+                       .ca_owner = THIS_MODULE,                        \
+       },                                                              \
+       .show   = _show,                                                \
+}
+
+/*
+ * With these extended attributes, the simple show_attribute() and
+ * store_attribute() operations need to call the show() and store() of the
+ * attributes.  This is a common pattern, so we provide a macro to define
+ * them.  The argument _item is the name of the config_item structure.
+ * This macro expects the attributes to be named "struct <name>_attribute"
+ * and the function to_<name>() to exist;
+ */
+#define CONFIGFS_ATTR_OPS(_item)                                       \
+static ssize_t _item##_attr_show(struct config_item *item,             \
+                                struct configfs_attribute *attr,       \
+                                char *page)                            \
+{                                                                      \
+       struct _item *_item = to_##_item(item);                         \
+       struct _item##_attribute *_item##_attr =                        \
+               container_of(attr, struct _item##_attribute, attr);     \
+       ssize_t ret = 0;                                                \
+                                                                       \
+       if (_item##_attr->show)                                         \
+               ret = _item##_attr->show(_item, page);                  \
+       return ret;                                                     \
+}                                                                      \
+static ssize_t _item##_attr_store(struct config_item *item,            \
+                                 struct configfs_attribute *attr,      \
+                                 const char *page, size_t count)       \
+{                                                                      \
+       struct _item *_item = to_##_item(item);                         \
+       struct _item##_attribute *_item##_attr =                        \
+               container_of(attr, struct _item##_attribute, attr);     \
+       ssize_t ret = -EINVAL;                                          \
+                                                                       \
+       if (_item##_attr->store)                                        \
+               ret = _item##_attr->store(_item, page, count);          \
+       return ret;                                                     \
+}
 
 /*
  * If allow_link() exists, the item can symlink(2) out to other
index 96a89d3..5c7f946 100644 (file)
@@ -38,8 +38,9 @@
 #define CN_W1_VAL                      0x1
 #define CN_IDX_V86D                    0x4
 #define CN_VAL_V86D_UVESAFB            0x1
+#define CN_IDX_BB                      0x5     /* BlackBoard, from the TSP GPL sampling framework */
 
-#define CN_NETLINK_USERS               5
+#define CN_NETLINK_USERS               6
 
 /*
  * Maximum connector's message size.
index 2270ca5..6fd5668 100644 (file)
@@ -106,6 +106,7 @@ struct cpufreq_policy {
 #define CPUFREQ_ADJUST         (0)
 #define CPUFREQ_INCOMPATIBLE   (1)
 #define CPUFREQ_NOTIFY         (2)
+#define CPUFREQ_START          (3)
 
 #define CPUFREQ_SHARED_TYPE_NONE (0) /* None */
 #define CPUFREQ_SHARED_TYPE_HW  (1) /* HW does needed coordination */
index 96d0509..d3219d7 100644 (file)
@@ -287,7 +287,7 @@ static inline const cpumask_t *get_cpu_mask(unsigned int cpu)
  * gcc optimizes it out (it's a constant) and there's no huge stack
  * variable created:
  */
-#define cpumask_of_cpu(cpu) ({ *get_cpu_mask(cpu); })
+#define cpumask_of_cpu(cpu) (*get_cpu_mask(cpu))
 
 
 #define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS)
index 98202c6..07aa198 100644 (file)
@@ -230,6 +230,7 @@ extern void d_delete(struct dentry *);
 extern struct dentry * d_alloc(struct dentry *, const struct qstr *);
 extern struct dentry * d_alloc_anon(struct inode *);
 extern struct dentry * d_splice_alias(struct inode *, struct dentry *);
+extern struct dentry * d_add_ci(struct inode *, struct dentry *, struct qstr *);
 extern void shrink_dcache_sb(struct super_block *);
 extern void shrink_dcache_parent(struct dentry *);
 extern void shrink_dcache_for_umount(struct super_block *);
index 27c64bd..a20259e 100644 (file)
@@ -34,8 +34,9 @@ extern struct file *fget(unsigned int fd);
 extern struct file *fget_light(unsigned int fd, int *fput_needed);
 extern void set_close_on_exec(unsigned int fd, int flag);
 extern void put_filp(struct file *);
+extern int alloc_fd(unsigned start, unsigned flags);
 extern int get_unused_fd(void);
-extern int get_unused_fd_flags(int flags);
+#define get_unused_fd_flags(flags) alloc_fd(0, (flags))
 extern void put_unused_fd(unsigned int fd);
 
 extern void fd_install(unsigned int fd, struct file *file);
index b846bc4..87c12ed 100644 (file)
@@ -219,18 +219,7 @@ static inline int __ide_default_irq(unsigned long base)
 #include <asm-generic/ide_iops.h>
 #endif
 
-#ifndef MAX_HWIFS
-#if defined(CONFIG_BLACKFIN) || defined(CONFIG_H8300) || defined(CONFIG_XTENSA)
-# define MAX_HWIFS     1
-#else
-# define MAX_HWIFS     10
-#endif
-#endif
-
-#if !defined(MAX_HWIFS) || defined(CONFIG_EMBEDDED)
-#undef MAX_HWIFS
-#define MAX_HWIFS      CONFIG_IDE_MAX_HWIFS
-#endif
+#define MAX_HWIFS      10
 
 /* Currently only m68k, apus and m8xx need it */
 #ifndef IDE_ARCH_ACK_INTR
@@ -509,24 +498,33 @@ struct ide_tp_ops {
 
 extern const struct ide_tp_ops default_tp_ops;
 
+/**
+ * struct ide_port_ops - IDE port operations
+ *
+ * @init_dev:          host specific initialization of a device
+ * @set_pio_mode:      routine to program host for PIO mode
+ * @set_dma_mode:      routine to program host for DMA mode
+ * @selectproc:                tweaks hardware to select drive
+ * @reset_poll:                chipset polling based on hba specifics
+ * @pre_reset:         chipset specific changes to default for device-hba resets
+ * @resetproc:         routine to reset controller after a disk reset
+ * @maskproc:          special host masking for drive selection
+ * @quirkproc:         check host's drive quirk list
+ *
+ * @mdma_filter:       filter MDMA modes
+ * @udma_filter:       filter UDMA modes
+ *
+ * @cable_detect:      detect cable type
+ */
 struct ide_port_ops {
-       /* host specific initialization of a device */
        void    (*init_dev)(ide_drive_t *);
-       /* routine to program host for PIO mode */
        void    (*set_pio_mode)(ide_drive_t *, const u8);
-       /* routine to program host for DMA mode */
        void    (*set_dma_mode)(ide_drive_t *, const u8);
-       /* tweaks hardware to select drive */
        void    (*selectproc)(ide_drive_t *);
-       /* chipset polling based on hba specifics */
        int     (*reset_poll)(ide_drive_t *);
-       /* chipset specific changes to default for device-hba resets */
        void    (*pre_reset)(ide_drive_t *);
-       /* routine to reset controller after a disk reset */
        void    (*resetproc)(ide_drive_t *);
-       /* special host masking for drive selection */
        void    (*maskproc)(ide_drive_t *, int);
-       /* check host's drive quirk list */
        void    (*quirkproc)(ide_drive_t *);
 
        u8      (*mdma_filter)(ide_drive_t *);
index a1630ba..7f4df7c 100644 (file)
@@ -506,6 +506,19 @@ struct ieee80211_channel_sw_ie {
        u8 count;
 } __attribute__ ((packed));
 
+/**
+ * struct ieee80211_tim
+ *
+ * This structure refers to "Traffic Indication Map information element"
+ */
+struct ieee80211_tim_ie {
+       u8 dtim_count;
+       u8 dtim_period;
+       u8 bitmap_ctrl;
+       /* variable size: 1 - 251 bytes */
+       u8 virtual_map[0];
+} __attribute__ ((packed));
+
 struct ieee80211_mgmt {
        __le16 frame_control;
        __le16 duration;
index 2baace2..31d8629 100644 (file)
@@ -18,7 +18,7 @@ struct ihex_binrec {
        __be32 addr;
        __be16 len;
        uint8_t data[0];
-} __attribute__((aligned(4)));
+} __attribute__((packed));
 
 /* Find the next record, taking into account the 4-byte alignment */
 static inline const struct ihex_binrec *
index 62aa4f8..58ff4e7 100644 (file)
@@ -223,35 +223,6 @@ static inline int disable_irq_wake(unsigned int irq)
 #define or_softirq_pending(x)  (local_softirq_pending() |= (x))
 #endif
 
-/*
- * Temporary defines for UP kernels, until all code gets fixed.
- */
-#ifndef CONFIG_SMP
-static inline void __deprecated cli(void)
-{
-       local_irq_disable();
-}
-static inline void __deprecated sti(void)
-{
-       local_irq_enable();
-}
-static inline void __deprecated save_flags(unsigned long *x)
-{
-       local_save_flags(*x);
-}
-#define save_flags(x) save_flags(&x)
-static inline void __deprecated restore_flags(unsigned long x)
-{
-       local_irq_restore(x);
-}
-
-static inline void __deprecated save_and_cli(unsigned long *x)
-{
-       local_irq_save(*x);
-}
-#define save_and_cli(x)        save_and_cli(&x)
-#endif /* CONFIG_SMP */
-
 /* Some architectures might implement lazy enabling/disabling of
  * interrupts. In some cases, such as stop_machine, we might want
  * to ensure that after a local_irq_disable(), interrupts have
index f8598f5..c975caf 100644 (file)
@@ -8,4 +8,3 @@ extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size,
                                      unsigned long align_mask);
 extern void iommu_area_free(unsigned long *map, unsigned long start,
                            unsigned int nr);
-extern unsigned long iommu_num_pages(unsigned long addr, unsigned long len);
index 2cd07cc..22d2115 100644 (file)
@@ -118,6 +118,10 @@ extern int allocate_resource(struct resource *root, struct resource *new,
 int adjust_resource(struct resource *res, resource_size_t start,
                    resource_size_t size);
 resource_size_t resource_alignment(struct resource *res);
+static inline resource_size_t resource_size(struct resource *res)
+{
+       return res->end - res->start + 1;
+}
 
 /* Convenience shorthand with allocation */
 #define request_region(start,n,name)   __request_region(&ioport_resource, (start), (n), (name))
diff --git a/include/linux/ip_vs.h b/include/linux/ip_vs.h
new file mode 100644 (file)
index 0000000..ec6eb49
--- /dev/null
@@ -0,0 +1,245 @@
+/*
+ *      IP Virtual Server
+ *      data structure and functionality definitions
+ */
+
+#ifndef _IP_VS_H
+#define _IP_VS_H
+
+#include <linux/types.h>       /* For __beXX types in userland */
+
+#define IP_VS_VERSION_CODE     0x010201
+#define NVERSION(version)                      \
+       (version >> 16) & 0xFF,                 \
+       (version >> 8) & 0xFF,                  \
+       version & 0xFF
+
+/*
+ *      Virtual Service Flags
+ */
+#define IP_VS_SVC_F_PERSISTENT 0x0001          /* persistent port */
+#define IP_VS_SVC_F_HASHED     0x0002          /* hashed entry */
+
+/*
+ *      Destination Server Flags
+ */
+#define IP_VS_DEST_F_AVAILABLE 0x0001          /* server is available */
+#define IP_VS_DEST_F_OVERLOAD  0x0002          /* server is overloaded */
+
+/*
+ *      IPVS sync daemon states
+ */
+#define IP_VS_STATE_NONE       0x0000          /* daemon is stopped */
+#define IP_VS_STATE_MASTER     0x0001          /* started as master */
+#define IP_VS_STATE_BACKUP     0x0002          /* started as backup */
+
+/*
+ *      IPVS socket options
+ */
+#define IP_VS_BASE_CTL         (64+1024+64)            /* base */
+
+#define IP_VS_SO_SET_NONE      IP_VS_BASE_CTL          /* just peek */
+#define IP_VS_SO_SET_INSERT    (IP_VS_BASE_CTL+1)
+#define IP_VS_SO_SET_ADD       (IP_VS_BASE_CTL+2)
+#define IP_VS_SO_SET_EDIT      (IP_VS_BASE_CTL+3)
+#define IP_VS_SO_SET_DEL       (IP_VS_BASE_CTL+4)
+#define IP_VS_SO_SET_FLUSH     (IP_VS_BASE_CTL+5)
+#define IP_VS_SO_SET_LIST      (IP_VS_BASE_CTL+6)
+#define IP_VS_SO_SET_ADDDEST   (IP_VS_BASE_CTL+7)
+#define IP_VS_SO_SET_DELDEST   (IP_VS_BASE_CTL+8)
+#define IP_VS_SO_SET_EDITDEST  (IP_VS_BASE_CTL+9)
+#define IP_VS_SO_SET_TIMEOUT   (IP_VS_BASE_CTL+10)
+#define IP_VS_SO_SET_STARTDAEMON (IP_VS_BASE_CTL+11)
+#define IP_VS_SO_SET_STOPDAEMON (IP_VS_BASE_CTL+12)
+#define IP_VS_SO_SET_RESTORE    (IP_VS_BASE_CTL+13)
+#define IP_VS_SO_SET_SAVE       (IP_VS_BASE_CTL+14)
+#define IP_VS_SO_SET_ZERO      (IP_VS_BASE_CTL+15)
+#define IP_VS_SO_SET_MAX       IP_VS_SO_SET_ZERO
+
+#define IP_VS_SO_GET_VERSION   IP_VS_BASE_CTL
+#define IP_VS_SO_GET_INFO      (IP_VS_BASE_CTL+1)
+#define IP_VS_SO_GET_SERVICES  (IP_VS_BASE_CTL+2)
+#define IP_VS_SO_GET_SERVICE   (IP_VS_BASE_CTL+3)
+#define IP_VS_SO_GET_DESTS     (IP_VS_BASE_CTL+4)
+#define IP_VS_SO_GET_DEST      (IP_VS_BASE_CTL+5)      /* not used now */
+#define IP_VS_SO_GET_TIMEOUT   (IP_VS_BASE_CTL+6)
+#define IP_VS_SO_GET_DAEMON    (IP_VS_BASE_CTL+7)
+#define IP_VS_SO_GET_MAX       IP_VS_SO_GET_DAEMON
+
+
+/*
+ *      IPVS Connection Flags
+ */
+#define IP_VS_CONN_F_FWD_MASK  0x0007          /* mask for the fwd methods */
+#define IP_VS_CONN_F_MASQ      0x0000          /* masquerading/NAT */
+#define IP_VS_CONN_F_LOCALNODE 0x0001          /* local node */
+#define IP_VS_CONN_F_TUNNEL    0x0002          /* tunneling */
+#define IP_VS_CONN_F_DROUTE    0x0003          /* direct routing */
+#define IP_VS_CONN_F_BYPASS    0x0004          /* cache bypass */
+#define IP_VS_CONN_F_SYNC      0x0020          /* entry created by sync */
+#define IP_VS_CONN_F_HASHED    0x0040          /* hashed entry */
+#define IP_VS_CONN_F_NOOUTPUT  0x0080          /* no output packets */
+#define IP_VS_CONN_F_INACTIVE  0x0100          /* not established */
+#define IP_VS_CONN_F_OUT_SEQ   0x0200          /* must do output seq adjust */
+#define IP_VS_CONN_F_IN_SEQ    0x0400          /* must do input seq adjust */
+#define IP_VS_CONN_F_SEQ_MASK  0x0600          /* in/out sequence mask */
+#define IP_VS_CONN_F_NO_CPORT  0x0800          /* no client port set yet */
+#define IP_VS_CONN_F_TEMPLATE  0x1000          /* template, not connection */
+
+#define IP_VS_SCHEDNAME_MAXLEN 16
+#define IP_VS_IFNAME_MAXLEN    16
+
+
+/*
+ *     The struct ip_vs_service_user and struct ip_vs_dest_user are
+ *     used to set IPVS rules through setsockopt.
+ */
+struct ip_vs_service_user {
+       /* virtual service addresses */
+       u_int16_t               protocol;
+       __be32                  addr;           /* virtual ip address */
+       __be16                  port;
+       u_int32_t               fwmark;         /* firwall mark of service */
+
+       /* virtual service options */
+       char                    sched_name[IP_VS_SCHEDNAME_MAXLEN];
+       unsigned                flags;          /* virtual service flags */
+       unsigned                timeout;        /* persistent timeout in sec */
+       __be32                  netmask;        /* persistent netmask */
+};
+
+
+struct ip_vs_dest_user {
+       /* destination server address */
+       __be32                  addr;
+       __be16                  port;
+
+       /* real server options */
+       unsigned                conn_flags;     /* connection flags */
+       int                     weight;         /* destination weight */
+
+       /* thresholds for active connections */
+       u_int32_t               u_threshold;    /* upper threshold */
+       u_int32_t               l_threshold;    /* lower threshold */
+};
+
+
+/*
+ *     IPVS statistics object (for user space)
+ */
+struct ip_vs_stats_user
+{
+       __u32                   conns;          /* connections scheduled */
+       __u32                   inpkts;         /* incoming packets */
+       __u32                   outpkts;        /* outgoing packets */
+       __u64                   inbytes;        /* incoming bytes */
+       __u64                   outbytes;       /* outgoing bytes */
+
+       __u32                   cps;            /* current connection rate */
+       __u32                   inpps;          /* current in packet rate */
+       __u32                   outpps;         /* current out packet rate */
+       __u32                   inbps;          /* current in byte rate */
+       __u32                   outbps;         /* current out byte rate */
+};
+
+
+/* The argument to IP_VS_SO_GET_INFO */
+struct ip_vs_getinfo {
+       /* version number */
+       unsigned int            version;
+
+       /* size of connection hash table */
+       unsigned int            size;
+
+       /* number of virtual services */
+       unsigned int            num_services;
+};
+
+
+/* The argument to IP_VS_SO_GET_SERVICE */
+struct ip_vs_service_entry {
+       /* which service: user fills in these */
+       u_int16_t               protocol;
+       __be32                  addr;           /* virtual address */
+       __be16                  port;
+       u_int32_t               fwmark;         /* firwall mark of service */
+
+       /* service options */
+       char                    sched_name[IP_VS_SCHEDNAME_MAXLEN];
+       unsigned                flags;          /* virtual service flags */
+       unsigned                timeout;        /* persistent timeout */
+       __be32                  netmask;        /* persistent netmask */
+
+       /* number of real servers */
+       unsigned int            num_dests;
+
+       /* statistics */
+       struct ip_vs_stats_user stats;
+};
+
+
+struct ip_vs_dest_entry {
+       __be32                  addr;           /* destination address */
+       __be16                  port;
+       unsigned                conn_flags;     /* connection flags */
+       int                     weight;         /* destination weight */
+
+       u_int32_t               u_threshold;    /* upper threshold */
+       u_int32_t               l_threshold;    /* lower threshold */
+
+       u_int32_t               activeconns;    /* active connections */
+       u_int32_t               inactconns;     /* inactive connections */
+       u_int32_t               persistconns;   /* persistent connections */
+
+       /* statistics */
+       struct ip_vs_stats_user stats;
+};
+
+
+/* The argument to IP_VS_SO_GET_DESTS */
+struct ip_vs_get_dests {
+       /* which service: user fills in these */
+       u_int16_t               protocol;
+       __be32                  addr;           /* virtual address */
+       __be16                  port;
+       u_int32_t               fwmark;         /* firwall mark of service */
+
+       /* number of real servers */
+       unsigned int            num_dests;
+
+       /* the real servers */
+       struct ip_vs_dest_entry entrytable[0];
+};
+
+
+/* The argument to IP_VS_SO_GET_SERVICES */
+struct ip_vs_get_services {
+       /* number of virtual services */
+       unsigned int            num_services;
+
+       /* service table */
+       struct ip_vs_service_entry entrytable[0];
+};
+
+
+/* The argument to IP_VS_SO_GET_TIMEOUT */
+struct ip_vs_timeout_user {
+       int                     tcp_timeout;
+       int                     tcp_fin_timeout;
+       int                     udp_timeout;
+};
+
+
+/* The argument to IP_VS_SO_GET_DAEMON */
+struct ip_vs_daemon_user {
+       /* sync daemon state (master/backup) */
+       int                     state;
+
+       /* multicast interface name */
+       char                    mcast_ifn[IP_VS_IFNAME_MAXLEN];
+
+       /* SyncID we belong to */
+       int                     syncid;
+};
+
+#endif /* _IP_VS_H */
index 57aefa1..b961448 100644 (file)
@@ -108,8 +108,7 @@ static inline void print_fn_descriptor_symbol(const char *fmt, void *addr)
 
 static inline void print_ip_sym(unsigned long ip)
 {
-       printk("[<%p>]", (void *) ip);
-       print_symbol(" %s\n", ip);
+       printk("[<%p>] %pS\n", (void *) ip, (void *) ip);
 }
 
 #endif /*_LINUX_KALLSYMS_H*/
index fdbbf72..aaa998f 100644 (file)
@@ -75,6 +75,12 @@ extern const char linux_proc_banner[];
  */
 #define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))
 
+/**
+ * lower_32_bits - return bits 0-31 of a number
+ * @n: the number we're accessing
+ */
+#define lower_32_bits(n) ((u32)(n))
+
 #define        KERN_EMERG      "<0>"   /* system is unusable                   */
 #define        KERN_ALERT      "<1>"   /* action must be taken immediately     */
 #define        KERN_CRIT       "<2>"   /* critical conditions                  */
index 82f88a8..32110ce 100644 (file)
@@ -130,8 +130,8 @@ void vmcoreinfo_append_str(const char *fmt, ...)
        __attribute__ ((format (printf, 1, 2)));
 unsigned long paddr_vmcoreinfo_note(void);
 
-#define VMCOREINFO_OSRELEASE(name) \
-       vmcoreinfo_append_str("OSRELEASE=%s\n", #name)
+#define VMCOREINFO_OSRELEASE(value) \
+       vmcoreinfo_append_str("OSRELEASE=%s\n", value)
 #define VMCOREINFO_PAGESIZE(value) \
        vmcoreinfo_append_str("PAGESIZE=%ld\n", value)
 #define VMCOREINFO_SYMBOL(name) \
index 0ea064c..69511f7 100644 (file)
@@ -371,6 +371,7 @@ struct kvm_trace_rec {
 #define KVM_CAP_PV_MMU 13
 #define KVM_CAP_MP_STATE 14
 #define KVM_CAP_COALESCED_MMIO 15
+#define KVM_CAP_SYNC_MMU 16  /* Changes to host mmap are reflected in guest */
 
 /*
  * ioctls for VM fds
index 07d68a8..8525afc 100644 (file)
@@ -121,6 +121,12 @@ struct kvm {
        struct kvm_coalesced_mmio_dev *coalesced_mmio_dev;
        struct kvm_coalesced_mmio_ring *coalesced_mmio_ring;
 #endif
+
+#ifdef KVM_ARCH_WANT_MMU_NOTIFIER
+       struct mmu_notifier mmu_notifier;
+       unsigned long mmu_notifier_seq;
+       long mmu_notifier_count;
+#endif
 };
 
 /* The guest did something we don't support. */
@@ -332,4 +338,22 @@ int kvm_trace_ioctl(unsigned int ioctl, unsigned long arg)
 #define kvm_trace_cleanup() ((void)0)
 #endif
 
+#ifdef KVM_ARCH_WANT_MMU_NOTIFIER
+static inline int mmu_notifier_retry(struct kvm_vcpu *vcpu, unsigned long mmu_seq)
+{
+       if (unlikely(vcpu->kvm->mmu_notifier_count))
+               return 1;
+       /*
+        * Both reads happen under the mmu_lock and both values are
+        * modified under mmu_lock, so there's no need of smb_rmb()
+        * here in between, otherwise mmu_notifier_count should be
+        * read before mmu_notifier_seq, see
+        * mmu_notifier_invalidate_range_end write side.
+        */
+       if (vcpu->kvm->mmu_notifier_seq != mmu_seq)
+               return 1;
+       return 0;
+}
+#endif
+
 #endif
index 5b247b8..06b8033 100644 (file)
@@ -60,9 +60,9 @@
 
 /* note: prints function name for you */
 #ifdef ATA_DEBUG
-#define DPRINTK(fmt, args...) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ## args)
+#define DPRINTK(fmt, args...) printk(KERN_ERR "%s: " fmt, __func__, ## args)
 #ifdef ATA_VERBOSE_DEBUG
-#define VPRINTK(fmt, args...) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ## args)
+#define VPRINTK(fmt, args...) printk(KERN_ERR "%s: " fmt, __func__, ## args)
 #else
 #define VPRINTK(fmt, args...)
 #endif /* ATA_VERBOSE_DEBUG */
@@ -71,7 +71,7 @@
 #define VPRINTK(fmt, args...)
 #endif /* ATA_DEBUG */
 
-#define BPRINTK(fmt, args...) if (ap->flags & ATA_FLAG_DEBUGMSG) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ## args)
+#define BPRINTK(fmt, args...) if (ap->flags & ATA_FLAG_DEBUGMSG) printk(KERN_ERR "%s: " fmt, __func__, ## args)
 
 /* NEW: debug levels */
 #define HAVE_LIBATA_MSG 1
@@ -750,6 +750,7 @@ struct ata_port_operations {
        void (*set_piomode)(struct ata_port *ap, struct ata_device *dev);
        void (*set_dmamode)(struct ata_port *ap, struct ata_device *dev);
        int  (*set_mode)(struct ata_link *link, struct ata_device **r_failed_dev);
+       unsigned int (*read_id)(struct ata_device *dev, struct ata_taskfile *tf, u16 *id);
 
        void (*dev_config)(struct ata_device *dev);
 
@@ -951,6 +952,8 @@ extern void ata_id_string(const u16 *id, unsigned char *s,
                          unsigned int ofs, unsigned int len);
 extern void ata_id_c_string(const u16 *id, unsigned char *s,
                            unsigned int ofs, unsigned int len);
+extern unsigned int ata_do_dev_read_id(struct ata_device *dev,
+                                       struct ata_taskfile *tf, u16 *id);
 extern void ata_qc_complete(struct ata_queued_cmd *qc);
 extern int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active);
 extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd,
index 5c948f3..8f2d60d 100644 (file)
@@ -37,7 +37,7 @@
  */
 #define        MISDN_MAJOR_VERSION     1
 #define        MISDN_MINOR_VERSION     0
-#define MISDN_RELEASE          18
+#define MISDN_RELEASE          19
 
 /* primitives for information exchange
  * generell format
@@ -242,7 +242,8 @@ struct mISDNhead {
 #define TEI_SAPI               63
 #define CTRL_SAPI              0
 
-#define MISDN_CHMAP_SIZE       4
+#define MISDN_MAX_CHANNEL      127
+#define MISDN_CHMAP_SIZE       ((MISDN_MAX_CHANNEL + 1) >> 3)
 
 #define SOL_MISDN      0
 
@@ -275,11 +276,32 @@ struct mISDN_devinfo {
        u_int                   Dprotocols;
        u_int                   Bprotocols;
        u_int                   protocol;
-       u_long                  channelmap[MISDN_CHMAP_SIZE];
+       u_char                  channelmap[MISDN_CHMAP_SIZE];
        u_int                   nrbchan;
        char                    name[MISDN_MAX_IDLEN];
 };
 
+static inline int
+test_channelmap(u_int nr, u_char *map)
+{
+       if (nr <= MISDN_MAX_CHANNEL)
+               return map[nr >> 3] & (1 << (nr & 7));
+       else
+               return 0;
+}
+
+static inline void
+set_channelmap(u_int nr, u_char *map)
+{
+       map[nr >> 3] |= (1 << (nr & 7));
+}
+
+static inline void
+clear_channelmap(u_int nr, u_char *map)
+{
+       map[nr >> 3] &= ~(1 << (nr & 7));
+}
+
 /* CONTROL_CHANNEL parameters */
 #define MISDN_CTRL_GETOP               0x0000
 #define MISDN_CTRL_LOOP                        0x0001
@@ -405,7 +427,7 @@ struct mISDNdevice {
        u_int                   Dprotocols;
        u_int                   Bprotocols;
        u_int                   nrbchan;
-       u_long                  channelmap[MISDN_CHMAP_SIZE];
+       u_char                  channelmap[MISDN_CHMAP_SIZE];
        struct list_head        bchannels;
        struct mISDNchannel     *teimgr;
        struct device           dev;
@@ -430,7 +452,7 @@ struct mISDNstack {
 #endif
 };
 
-/* global alloc/queue dunctions */
+/* global alloc/queue functions */
 
 static inline struct sk_buff *
 mI_alloc_skb(unsigned int len, gfp_t gfp_mask)
index 523a286..c23d3f5 100644 (file)
@@ -2,6 +2,7 @@
 #define __LINUX_MAPLE_H
 
 #include <linux/device.h>
+#include <mach/maple.h>
 
 extern struct bus_type maple_bus_type;
 
@@ -33,6 +34,7 @@ struct mapleq {
        void *sendbuf, *recvbuf, *recvbufdcsp;
        unsigned char length;
        enum maple_code command;
+       struct mutex mutex;
 };
 
 struct maple_devinfo {
@@ -49,7 +51,6 @@ struct maple_devinfo {
 struct maple_device {
        struct maple_driver *driver;
        struct mapleq *mq;
-       void *private_data;
        void (*callback) (struct mapleq * mq);
        unsigned long when, interval, function;
        struct maple_devinfo devinfo;
@@ -68,10 +69,17 @@ void maple_getcond_callback(struct maple_device *dev,
                            void (*callback) (struct mapleq * mq),
                            unsigned long interval,
                            unsigned long function);
-int maple_driver_register(struct device_driver *drv);
-void maple_add_packet(struct mapleq *mq);
+int maple_driver_register(struct maple_driver *);
+void maple_driver_unregister(struct maple_driver *);
+
+int maple_add_packet_sleeps(struct maple_device *mdev, u32 function,
+       u32 command, u32 length, void *data);
+void maple_clear_dev(struct maple_device *mdev);
 
 #define to_maple_dev(n) container_of(n, struct maple_device, dev)
 #define to_maple_driver(n) container_of(n, struct maple_driver, drv)
 
+#define maple_get_drvdata(d)           dev_get_drvdata(&(d)->dev)
+#define maple_set_drvdata(d,p)         dev_set_drvdata(&(d)->dev, (p))
+
 #endif                         /* __LINUX_MAPLE_H */
index 866a3db..335288b 100644 (file)
@@ -744,6 +744,8 @@ struct zap_details {
 struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
                pte_t pte);
 
+int zap_vma_ptes(struct vm_area_struct *vma, unsigned long address,
+               unsigned long size);
 unsigned long zap_page_range(struct vm_area_struct *vma, unsigned long address,
                unsigned long size, struct zap_details *);
 unsigned long unmap_vmas(struct mmu_gather **tlb,
@@ -1041,7 +1043,6 @@ extern unsigned long absent_pages_in_range(unsigned long start_pfn,
 extern void get_pfn_range_for_nid(unsigned int nid,
                        unsigned long *start_pfn, unsigned long *end_pfn);
 extern unsigned long find_min_pfn_with_active_regions(void);
-extern unsigned long find_max_pfn_with_active_regions(void);
 extern void free_bootmem_with_active_regions(int nid,
                                                unsigned long max_low_pfn);
 typedef int (*work_fn_t)(unsigned long, unsigned long, void *);
index b5efaa2..30a1d63 100644 (file)
@@ -105,7 +105,8 @@ extern struct vfsmount *vfs_kern_mount(struct file_system_type *type,
 
 struct nameidata;
 
-extern int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd,
+struct path;
+extern int do_add_mount(struct vfsmount *newmnt, struct path *path,
                        int mnt_flags, struct list_head *fslist);
 
 extern void mark_mounts_for_expiry(struct list_head *mounts);
index 4ed40ca..9226365 100644 (file)
@@ -272,7 +272,11 @@ static inline void mtd_erase_callback(struct erase_info *instr)
                        printk(KERN_INFO args);         \
        } while(0)
 #else /* CONFIG_MTD_DEBUG */
-#define DEBUG(n, args...) do { } while(0)
+#define DEBUG(n, args...)                              \
+       do {                                            \
+               if (0)                                  \
+                       printk(KERN_INFO args);         \
+       } while(0)
 
 #endif /* CONFIG_MTD_DEBUG */
 
index 83f6787..81774e5 100644 (file)
@@ -177,7 +177,9 @@ typedef enum {
 #define NAND_MUST_PAD(chip) (!(chip->options & NAND_NO_PADDING))
 #define NAND_HAS_CACHEPROG(chip) ((chip->options & NAND_CACHEPRG))
 #define NAND_HAS_COPYBACK(chip) ((chip->options & NAND_COPYBACK))
-#define NAND_SUBPAGE_READ(chip) ((chip->ecc.mode == NAND_ECC_SOFT))
+/* Large page NAND with SOFT_ECC should support subpage reads */
+#define NAND_SUBPAGE_READ(chip) ((chip->ecc.mode == NAND_ECC_SOFT) \
+                                       && (chip->page_shift > 9))
 
 /* Mask to zero out the chip options, which come from the id table */
 #define NAND_CHIPOPTIONS_MSK   (0x0000ffff & ~NAND_NO_AUTOINCR)
index b4d056c..488c56e 100644 (file)
@@ -61,9 +61,7 @@ struct wireless_dev;
 #define NET_XMIT_DROP          1       /* skb dropped                  */
 #define NET_XMIT_CN            2       /* congestion notification      */
 #define NET_XMIT_POLICED       3       /* skb is shot by police        */
-#define NET_XMIT_BYPASS                4       /* packet does not leave via dequeue;
-                                          (TC use only - dev_queue_xmit
-                                          returns this as NET_XMIT_SUCCESS) */
+#define NET_XMIT_MASK          0xFFFF  /* qdisc flags in net/sch_generic.h */
 
 /* Backlog congestion levels */
 #define NET_RX_SUCCESS         0   /* keep 'em coming, baby */
@@ -440,6 +438,7 @@ static inline void napi_synchronize(const struct napi_struct *n)
 enum netdev_queue_state_t
 {
        __QUEUE_STATE_XOFF,
+       __QUEUE_STATE_FROZEN,
 };
 
 struct netdev_queue {
@@ -636,7 +635,7 @@ struct net_device
        unsigned int            real_num_tx_queues;
 
        unsigned long           tx_queue_len;   /* Max frames per queue allowed */
-
+       spinlock_t              tx_global_lock;
 /*
  * One part is mostly used on xmit path (device)
  */
@@ -1099,6 +1098,11 @@ static inline int netif_queue_stopped(const struct net_device *dev)
        return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0));
 }
 
+static inline int netif_tx_queue_frozen(const struct netdev_queue *dev_queue)
+{
+       return test_bit(__QUEUE_STATE_FROZEN, &dev_queue->state);
+}
+
 /**
  *     netif_running - test if up
  *     @dev: network device
@@ -1475,6 +1479,26 @@ static inline void __netif_tx_lock_bh(struct netdev_queue *txq)
        txq->xmit_lock_owner = smp_processor_id();
 }
 
+static inline int __netif_tx_trylock(struct netdev_queue *txq)
+{
+       int ok = spin_trylock(&txq->_xmit_lock);
+       if (likely(ok))
+               txq->xmit_lock_owner = smp_processor_id();
+       return ok;
+}
+
+static inline void __netif_tx_unlock(struct netdev_queue *txq)
+{
+       txq->xmit_lock_owner = -1;
+       spin_unlock(&txq->_xmit_lock);
+}
+
+static inline void __netif_tx_unlock_bh(struct netdev_queue *txq)
+{
+       txq->xmit_lock_owner = -1;
+       spin_unlock_bh(&txq->_xmit_lock);
+}
+
 /**
  *     netif_tx_lock - grab network device transmit lock
  *     @dev: network device
@@ -1484,12 +1508,23 @@ static inline void __netif_tx_lock_bh(struct netdev_queue *txq)
  */
 static inline void netif_tx_lock(struct net_device *dev)
 {
-       int cpu = smp_processor_id();
        unsigned int i;
+       int cpu;
 
+       spin_lock(&dev->tx_global_lock);
+       cpu = smp_processor_id();
        for (i = 0; i < dev->num_tx_queues; i++) {
                struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
+
+               /* We are the only thread of execution doing a
+                * freeze, but we have to grab the _xmit_lock in
+                * order to synchronize with threads which are in
+                * the ->hard_start_xmit() handler and already
+                * checked the frozen bit.
+                */
                __netif_tx_lock(txq, cpu);
+               set_bit(__QUEUE_STATE_FROZEN, &txq->state);
+               __netif_tx_unlock(txq);
        }
 }
 
@@ -1499,40 +1534,22 @@ static inline void netif_tx_lock_bh(struct net_device *dev)
        netif_tx_lock(dev);
 }
 
-static inline int __netif_tx_trylock(struct netdev_queue *txq)
-{
-       int ok = spin_trylock(&txq->_xmit_lock);
-       if (likely(ok))
-               txq->xmit_lock_owner = smp_processor_id();
-       return ok;
-}
-
-static inline int netif_tx_trylock(struct net_device *dev)
-{
-       return __netif_tx_trylock(netdev_get_tx_queue(dev, 0));
-}
-
-static inline void __netif_tx_unlock(struct netdev_queue *txq)
-{
-       txq->xmit_lock_owner = -1;
-       spin_unlock(&txq->_xmit_lock);
-}
-
-static inline void __netif_tx_unlock_bh(struct netdev_queue *txq)
-{
-       txq->xmit_lock_owner = -1;
-       spin_unlock_bh(&txq->_xmit_lock);
-}
-
 static inline void netif_tx_unlock(struct net_device *dev)
 {
        unsigned int i;
 
        for (i = 0; i < dev->num_tx_queues; i++) {
                struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
-               __netif_tx_unlock(txq);
-       }
 
+               /* No need to grab the _xmit_lock here.  If the
+                * queue is not stopped for another reason, we
+                * force a schedule.
+                */
+               clear_bit(__QUEUE_STATE_FROZEN, &txq->state);
+               if (!test_bit(__QUEUE_STATE_XOFF, &txq->state))
+                       __netif_schedule(txq->qdisc);
+       }
+       spin_unlock(&dev->tx_global_lock);
 }
 
 static inline void netif_tx_unlock_bh(struct net_device *dev)
@@ -1556,13 +1573,18 @@ static inline void netif_tx_unlock_bh(struct net_device *dev)
 static inline void netif_tx_disable(struct net_device *dev)
 {
        unsigned int i;
+       int cpu;
 
-       netif_tx_lock_bh(dev);
+       local_bh_disable();
+       cpu = smp_processor_id();
        for (i = 0; i < dev->num_tx_queues; i++) {
                struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
+
+               __netif_tx_lock(txq, cpu);
                netif_tx_stop_queue(txq);
+               __netif_tx_unlock(txq);
        }
-       netif_tx_unlock_bh(dev);
+       local_bh_enable();
 }
 
 static inline void netif_addr_lock(struct net_device *dev)
index 22ce299..a049df4 100644 (file)
@@ -30,6 +30,9 @@ enum tcp_conntrack {
 /* Be liberal in window checking */
 #define IP_CT_TCP_FLAG_BE_LIBERAL              0x08
 
+/* Has unacknowledged data */
+#define IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED     0x10
+
 struct nf_ct_tcp_flags {
        u_int8_t flags;
        u_int8_t mask;
index 54590a9..c74d3e8 100644 (file)
@@ -163,7 +163,7 @@ static inline int Page##uname(struct page *page)                    \
 
 struct page;   /* forward declaration */
 
-PAGEFLAG(Locked, locked) TESTSCFLAG(Locked, locked)
+TESTPAGEFLAG(Locked, locked)
 PAGEFLAG(Error, error)
 PAGEFLAG(Referenced, referenced) TESTCLEARFLAG(Referenced, referenced)
 PAGEFLAG(Dirty, dirty) TESTSCFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty)
@@ -239,9 +239,6 @@ static inline void __SetPageUptodate(struct page *page)
 {
        smp_wmb();
        __set_bit(PG_uptodate, &(page)->flags);
-#ifdef CONFIG_S390
-       page_clear_dirty(page);
-#endif
 }
 
 static inline void SetPageUptodate(struct page *page)
index a39b38c..5da31c1 100644 (file)
@@ -143,6 +143,29 @@ static inline int page_cache_get_speculative(struct page *page)
        return 1;
 }
 
+/*
+ * Same as above, but add instead of inc (could just be merged)
+ */
+static inline int page_cache_add_speculative(struct page *page, int count)
+{
+       VM_BUG_ON(in_interrupt());
+
+#if !defined(CONFIG_SMP) && defined(CONFIG_CLASSIC_RCU)
+# ifdef CONFIG_PREEMPT
+       VM_BUG_ON(!in_atomic());
+# endif
+       VM_BUG_ON(page_count(page) == 0);
+       atomic_add(count, &page->_count);
+
+#else
+       if (unlikely(!atomic_add_unless(&page->_count, count, 0)))
+               return 0;
+#endif
+       VM_BUG_ON(PageCompound(page) && page != compound_head(page));
+
+       return 1;
+}
+
 static inline int page_freeze_refs(struct page *page, int count)
 {
        return likely(atomic_cmpxchg(&page->_count, count, 0) == count);
@@ -227,29 +250,6 @@ static inline struct page *read_mapping_page(struct address_space *mapping,
        return read_cache_page(mapping, index, filler, data);
 }
 
-int add_to_page_cache_locked(struct page *page, struct address_space *mapping,
-                               pgoff_t index, gfp_t gfp_mask);
-int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
-                               pgoff_t index, gfp_t gfp_mask);
-extern void remove_from_page_cache(struct page *page);
-extern void __remove_from_page_cache(struct page *page);
-
-/*
- * Like add_to_page_cache_locked, but used to add newly allocated pages:
- * the page is new, so we can just run SetPageLocked() against it.
- */
-static inline int add_to_page_cache(struct page *page,
-               struct address_space *mapping, pgoff_t offset, gfp_t gfp_mask)
-{
-       int error;
-
-       SetPageLocked(page);
-       error = add_to_page_cache_locked(page, mapping, offset, gfp_mask);
-       if (unlikely(error))
-               ClearPageLocked(page);
-       return error;
-}
-
 /*
  * Return byte-offset into filesystem object for page.
  */
@@ -271,13 +271,28 @@ extern int __lock_page_killable(struct page *page);
 extern void __lock_page_nosync(struct page *page);
 extern void unlock_page(struct page *page);
 
+static inline void set_page_locked(struct page *page)
+{
+       set_bit(PG_locked, &page->flags);
+}
+
+static inline void clear_page_locked(struct page *page)
+{
+       clear_bit(PG_locked, &page->flags);
+}
+
+static inline int trylock_page(struct page *page)
+{
+       return !test_and_set_bit(PG_locked, &page->flags);
+}
+
 /*
  * lock_page may only be called if we have the page's inode pinned.
  */
 static inline void lock_page(struct page *page)
 {
        might_sleep();
-       if (TestSetPageLocked(page))
+       if (!trylock_page(page))
                __lock_page(page);
 }
 
@@ -289,7 +304,7 @@ static inline void lock_page(struct page *page)
 static inline int lock_page_killable(struct page *page)
 {
        might_sleep();
-       if (TestSetPageLocked(page))
+       if (!trylock_page(page))
                return __lock_page_killable(page);
        return 0;
 }
@@ -301,7 +316,7 @@ static inline int lock_page_killable(struct page *page)
 static inline void lock_page_nosync(struct page *page)
 {
        might_sleep();
-       if (TestSetPageLocked(page))
+       if (!trylock_page(page))
                __lock_page_nosync(page);
 }
        
@@ -386,4 +401,27 @@ static inline int fault_in_pages_readable(const char __user *uaddr, int size)
        return ret;
 }
 
+int add_to_page_cache_locked(struct page *page, struct address_space *mapping,
+                               pgoff_t index, gfp_t gfp_mask);
+int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
+                               pgoff_t index, gfp_t gfp_mask);
+extern void remove_from_page_cache(struct page *page);
+extern void __remove_from_page_cache(struct page *page);
+
+/*
+ * Like add_to_page_cache_locked, but used to add newly allocated pages:
+ * the page is new, so we can just run set_page_locked() against it.
+ */
+static inline int add_to_page_cache(struct page *page,
+               struct address_space *mapping, pgoff_t offset, gfp_t gfp_mask)
+{
+       int error;
+
+       set_page_locked(page);
+       error = add_to_page_cache_locked(page, mapping, offset, gfp_mask);
+       if (unlikely(error))
+               clear_page_locked(page);
+       return error;
+}
+
 #endif /* _LINUX_PAGEMAP_H */
index cc554ca..7dcd050 100644 (file)
@@ -14,7 +14,7 @@ struct match_token {
        const char *pattern;
 };
 
-typedef const struct match_token match_table_t[];
+typedef struct match_token match_table_t[];
 
 /* Maximum number of arguments that match_token will find in a pattern */
 enum {MAX_OPT_ARGS = 3};
index 2e4e97b..d74f75e 100644 (file)
@@ -1,6 +1,6 @@
 /* interface for the pm_qos_power infrastructure of the linux kernel.
  *
- * Mark Gross
+ * Mark Gross <mgross@linux.intel.com>
  */
 #include <linux/list.h>
 #include <linux/notifier.h>
index 68ed19c..ea96ead 100644 (file)
@@ -78,6 +78,7 @@ enum power_supply_property {
        POWER_SUPPLY_PROP_CHARGE_EMPTY,
        POWER_SUPPLY_PROP_CHARGE_NOW,
        POWER_SUPPLY_PROP_CHARGE_AVG,
+       POWER_SUPPLY_PROP_CHARGE_COUNTER,
        POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN,
        POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN,
        POWER_SUPPLY_PROP_ENERGY_FULL,
index 742187f..ca6b9b5 100644 (file)
@@ -43,6 +43,8 @@ int dquot_mark_dquot_dirty(struct dquot *dquot);
 
 int vfs_quota_on(struct super_block *sb, int type, int format_id,
        char *path, int remount);
+int vfs_quota_on_path(struct super_block *sb, int type, int format_id,
+       struct path *path);
 int vfs_quota_on_mount(struct super_block *sb, char *qf_name,
        int format_id, int type);
 int vfs_quota_off(struct super_block *sb, int type, int remount);
index 9f2549a..c200b9a 100644 (file)
@@ -128,6 +128,7 @@ struct mddev_s
 #define MD_CHANGE_DEVS 0       /* Some device status has changed */
 #define MD_CHANGE_CLEAN 1      /* transition to or from 'clean' */
 #define MD_CHANGE_PENDING 2    /* superblock update in progress */
+#define MD_NOTIFY_ARRAY_STATE 3        /* atomic context wants to notify userspace */
 
        int                             ro;
 
diff --git a/include/linux/regulator/bq24022.h b/include/linux/regulator/bq24022.h
new file mode 100644 (file)
index 0000000..e84b0a9
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * Support for TI bq24022 (bqTINY-II) Dual Input (USB/AC Adpater)
+ * 1-Cell Li-Ion Charger connected via GPIOs.
+ *
+ * Copyright (c) 2008 Philipp Zabel
+ *
+ * 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.
+ *
+ */
+
+/**
+ * bq24022_mach_info - platform data for bq24022
+ * @gpio_nce: GPIO line connected to the nCE pin, used to enable / disable charging
+ * @gpio_iset2: GPIO line connected to the ISET2 pin, used to limit charging current to 100 mA / 500 mA
+ */
+struct bq24022_mach_info {
+       int gpio_nce;
+       int gpio_iset2;
+};
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
new file mode 100644 (file)
index 0000000..afdc455
--- /dev/null
@@ -0,0 +1,284 @@
+/*
+ * consumer.h -- SoC Regulator consumer support.
+ *
+ * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC.
+ *
+ * Author: Liam Girdwood <lg@opensource.wolfsonmicro.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.
+ *
+ * Regulator Consumer Interface.
+ *
+ * A Power Management Regulator framework for SoC based devices.
+ * Features:-
+ *   o Voltage and current level control.
+ *   o Operating mode control.
+ *   o Regulator status.
+ *   o sysfs entries for showing client devices and status
+ *
+ * EXPERIMENTAL FEATURES:
+ *   Dynamic Regulator operating Mode Switching (DRMS) - allows regulators
+ *   to use most efficient operating mode depending upon voltage and load and
+ *   is transparent to client drivers.
+ *
+ *   e.g. Devices x,y,z share regulator r. Device x and y draw 20mA each during
+ *   IO and 1mA at idle. Device z draws 100mA when under load and 5mA when
+ *   idling. Regulator r has > 90% efficiency in NORMAL mode at loads > 100mA
+ *   but this drops rapidly to 60% when below 100mA. Regulator r has > 90%
+ *   efficiency in IDLE mode at loads < 10mA. Thus regulator r will operate
+ *   in normal mode for loads > 10mA and in IDLE mode for load <= 10mA.
+ *
+ */
+
+#ifndef __LINUX_REGULATOR_CONSUMER_H_
+#define __LINUX_REGULATOR_CONSUMER_H_
+
+/*
+ * Regulator operating modes.
+ *
+ * Regulators can run in a variety of different operating modes depending on
+ * output load. This allows further system power savings by selecting the
+ * best (and most efficient) regulator mode for a desired load.
+ *
+ * Most drivers will only care about NORMAL. The modes below are generic and
+ * will probably not match the naming convention of your regulator data sheet
+ * but should match the use cases in the datasheet.
+ *
+ * In order of power efficiency (least efficient at top).
+ *
+ *  Mode       Description
+ *  FAST       Regulator can handle fast changes in it's load.
+ *             e.g. useful in CPU voltage & frequency scaling where
+ *             load can quickly increase with CPU frequency increases.
+ *
+ *  NORMAL     Normal regulator power supply mode. Most drivers will
+ *             use this mode.
+ *
+ *  IDLE       Regulator runs in a more efficient mode for light
+ *             loads. Can be used for devices that have a low power
+ *             requirement during periods of inactivity. This mode
+ *             may be more noisy than NORMAL and may not be able
+ *             to handle fast load switching.
+ *
+ *  STANDBY    Regulator runs in the most efficient mode for very
+ *             light loads. Can be used by devices when they are
+ *             in a sleep/standby state. This mode is likely to be
+ *             the most noisy and may not be able to handle fast load
+ *             switching.
+ *
+ * NOTE: Most regulators will only support a subset of these modes. Some
+ * will only just support NORMAL.
+ *
+ * These modes can be OR'ed together to make up a mask of valid register modes.
+ */
+
+#define REGULATOR_MODE_FAST                    0x1
+#define REGULATOR_MODE_NORMAL                  0x2
+#define REGULATOR_MODE_IDLE                    0x4
+#define REGULATOR_MODE_STANDBY                 0x8
+
+/*
+ * Regulator notifier events.
+ *
+ * UNDER_VOLTAGE  Regulator output is under voltage.
+ * OVER_CURRENT   Regulator output current is too high.
+ * REGULATION_OUT Regulator output is out of regulation.
+ * FAIL           Regulator output has failed.
+ * OVER_TEMP      Regulator over temp.
+ * FORCE_DISABLE  Regulator shut down by software.
+ *
+ * NOTE: These events can be OR'ed together when passed into handler.
+ */
+
+#define REGULATOR_EVENT_UNDER_VOLTAGE          0x01
+#define REGULATOR_EVENT_OVER_CURRENT           0x02
+#define REGULATOR_EVENT_REGULATION_OUT         0x04
+#define REGULATOR_EVENT_FAIL                   0x08
+#define REGULATOR_EVENT_OVER_TEMP              0x10
+#define REGULATOR_EVENT_FORCE_DISABLE          0x20
+
+struct regulator;
+
+/**
+ * struct regulator_bulk_data - Data used for bulk regulator operations.
+ *
+ * @supply   The name of the supply.  Initialised by the user before
+ *           using the bulk regulator APIs.
+ * @consumer The regulator consumer for the supply.  This will be managed
+ *           by the bulk API.
+ *
+ * The regulator APIs provide a series of regulator_bulk_() API calls as
+ * a convenience to consumers which require multiple supplies.  This
+ * structure is used to manage data for these calls.
+ */
+struct regulator_bulk_data {
+       const char *supply;
+       struct regulator *consumer;
+};
+
+#if defined(CONFIG_REGULATOR)
+
+/* regulator get and put */
+struct regulator *__must_check regulator_get(struct device *dev,
+                                            const char *id);
+void regulator_put(struct regulator *regulator);
+
+/* regulator output control and status */
+int regulator_enable(struct regulator *regulator);
+int regulator_disable(struct regulator *regulator);
+int regulator_force_disable(struct regulator *regulator);
+int regulator_is_enabled(struct regulator *regulator);
+
+int regulator_bulk_get(struct device *dev, int num_consumers,
+                      struct regulator_bulk_data *consumers);
+int regulator_bulk_enable(int num_consumers,
+                         struct regulator_bulk_data *consumers);
+int regulator_bulk_disable(int num_consumers,
+                          struct regulator_bulk_data *consumers);
+void regulator_bulk_free(int num_consumers,
+                        struct regulator_bulk_data *consumers);
+
+int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV);
+int regulator_get_voltage(struct regulator *regulator);
+int regulator_set_current_limit(struct regulator *regulator,
+                              int min_uA, int max_uA);
+int regulator_get_current_limit(struct regulator *regulator);
+
+int regulator_set_mode(struct regulator *regulator, unsigned int mode);
+unsigned int regulator_get_mode(struct regulator *regulator);
+int regulator_set_optimum_mode(struct regulator *regulator, int load_uA);
+
+/* regulator notifier block */
+int regulator_register_notifier(struct regulator *regulator,
+                             struct notifier_block *nb);
+int regulator_unregister_notifier(struct regulator *regulator,
+                               struct notifier_block *nb);
+
+/* driver data - core doesn't touch */
+void *regulator_get_drvdata(struct regulator *regulator);
+void regulator_set_drvdata(struct regulator *regulator, void *data);
+
+#else
+
+/*
+ * Make sure client drivers will still build on systems with no software
+ * controllable voltage or current regulators.
+ */
+static inline struct regulator *__must_check regulator_get(struct device *dev,
+       const char *id)
+{
+       /* Nothing except the stubbed out regulator API should be
+        * looking at the value except to check if it is an error
+        * value so the actual return value doesn't matter.
+        */
+       return (struct regulator *)id;
+}
+static inline void regulator_put(struct regulator *regulator)
+{
+}
+
+static inline int regulator_enable(struct regulator *regulator)
+{
+       return 0;
+}
+
+static inline int regulator_disable(struct regulator *regulator)
+{
+       return 0;
+}
+
+static inline int regulator_is_enabled(struct regulator *regulator)
+{
+       return 1;
+}
+
+static inline int regulator_bulk_get(struct device *dev,
+                                    int num_consumers,
+                                    struct regulator_bulk_data *consumers)
+{
+       return 0;
+}
+
+static inline int regulator_bulk_enable(int num_consumers,
+                                       struct regulator_bulk_data *consumers)
+{
+       return 0;
+}
+
+static inline int regulator_bulk_disable(int num_consumers,
+                                        struct regulator_bulk_data *consumers)
+{
+       return 0;
+}
+
+static inline void regulator_bulk_free(int num_consumers,
+                                      struct regulator_bulk_data *consumers)
+{
+}
+
+static inline int regulator_set_voltage(struct regulator *regulator,
+                                       int min_uV, int max_uV)
+{
+       return 0;
+}
+
+static inline int regulator_get_voltage(struct regulator *regulator)
+{
+       return 0;
+}
+
+static inline int regulator_set_current_limit(struct regulator *regulator,
+                                            int min_uA, int max_uA)
+{
+       return 0;
+}
+
+static inline int regulator_get_current_limit(struct regulator *regulator)
+{
+       return 0;
+}
+
+static inline int regulator_set_mode(struct regulator *regulator,
+       unsigned int mode)
+{
+       return 0;
+}
+
+static inline unsigned int regulator_get_mode(struct regulator *regulator)
+{
+       return REGULATOR_MODE_NORMAL;
+}
+
+static inline int regulator_set_optimum_mode(struct regulator *regulator,
+                                       int load_uA)
+{
+       return REGULATOR_MODE_NORMAL;
+}
+
+static inline int regulator_register_notifier(struct regulator *regulator,
+                             struct notifier_block *nb)
+{
+       return 0;
+}
+
+static inline int regulator_unregister_notifier(struct regulator *regulator,
+                               struct notifier_block *nb)
+{
+       return 0;
+}
+
+static inline void *regulator_get_drvdata(struct regulator *regulator)
+{
+       return NULL;
+}
+
+static inline void regulator_set_drvdata(struct regulator *regulator,
+       void *data)
+{
+}
+
+#endif
+
+#endif
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
new file mode 100644 (file)
index 0000000..1d712c7
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * driver.h -- SoC Regulator driver support.
+ *
+ * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC.
+ *
+ * Author: Liam Girdwood <lg@opensource.wolfsonmicro.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.
+ *
+ * Regulator Driver Interface.
+ */
+
+#ifndef __LINUX_REGULATOR_DRIVER_H_
+#define __LINUX_REGULATOR_DRIVER_H_
+
+#include <linux/device.h>
+#include <linux/regulator/consumer.h>
+
+struct regulator_constraints;
+struct regulator_dev;
+
+/**
+ * struct regulator_ops - regulator operations.
+ *
+ * This struct describes regulator operations.
+ */
+struct regulator_ops {
+
+       /* get/set regulator voltage */
+       int (*set_voltage) (struct regulator_dev *, int min_uV, int max_uV);
+       int (*get_voltage) (struct regulator_dev *);
+
+       /* get/set regulator current  */
+       int (*set_current_limit) (struct regulator_dev *,
+                                int min_uA, int max_uA);
+       int (*get_current_limit) (struct regulator_dev *);
+
+       /* enable/disable regulator */
+       int (*enable) (struct regulator_dev *);
+       int (*disable) (struct regulator_dev *);
+       int (*is_enabled) (struct regulator_dev *);
+
+       /* get/set regulator operating mode (defined in regulator.h) */
+       int (*set_mode) (struct regulator_dev *, unsigned int mode);
+       unsigned int (*get_mode) (struct regulator_dev *);
+
+       /* get most efficient regulator operating mode for load */
+       unsigned int (*get_optimum_mode) (struct regulator_dev *, int input_uV,
+                                         int output_uV, int load_uA);
+
+       /* the operations below are for configuration of regulator state when
+        * it's parent PMIC enters a global STANBY/HIBERNATE state */
+
+       /* set regulator suspend voltage */
+       int (*set_suspend_voltage) (struct regulator_dev *, int uV);
+
+       /* enable/disable regulator in suspend state */
+       int (*set_suspend_enable) (struct regulator_dev *);
+       int (*set_suspend_disable) (struct regulator_dev *);
+
+       /* set regulator suspend operating mode (defined in regulator.h) */
+       int (*set_suspend_mode) (struct regulator_dev *, unsigned int mode);
+};
+
+/*
+ * Regulators can either control voltage or current.
+ */
+enum regulator_type {
+       REGULATOR_VOLTAGE,
+       REGULATOR_CURRENT,
+};
+
+/**
+ * struct regulator_desc - Regulator descriptor
+ *
+ */
+struct regulator_desc {
+       const char *name;
+       int id;
+       struct regulator_ops *ops;
+       int irq;
+       enum regulator_type type;
+       struct module *owner;
+};
+
+
+struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
+                                         void *reg_data);
+void regulator_unregister(struct regulator_dev *rdev);
+
+int regulator_notifier_call_chain(struct regulator_dev *rdev,
+                                 unsigned long event, void *data);
+
+void *rdev_get_drvdata(struct regulator_dev *rdev);
+int rdev_get_id(struct regulator_dev *rdev);
+
+#endif
diff --git a/include/linux/regulator/fixed.h b/include/linux/regulator/fixed.h
new file mode 100644 (file)
index 0000000..1387a5d
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * fixed.h
+ *
+ * Copyright 2008 Wolfson Microelectronics PLC.
+ *
+ * Author: Mark Brown <broonie@opensource.wolfsonmicro.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 __REGULATOR_FIXED_H
+#define __REGULATOR_FIXED_H
+
+struct fixed_voltage_config {
+       const char *supply_name;
+       int microvolts;
+};
+
+#endif
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
new file mode 100644 (file)
index 0000000..11e737d
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+ * machine.h -- SoC Regulator support, machine/board driver API.
+ *
+ * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC.
+ *
+ * Author: Liam Girdwood <lg@opensource.wolfsonmicro.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.
+ *
+ * Regulator Machine/Board Interface.
+ */
+
+#ifndef __LINUX_REGULATOR_MACHINE_H_
+#define __LINUX_REGULATOR_MACHINE_H_
+
+#include <linux/regulator/consumer.h>
+#include <linux/suspend.h>
+
+struct regulator;
+
+/*
+ * Regulator operation constraint flags. These flags are used to enable
+ * certain regulator operations and can be OR'ed together.
+ *
+ * VOLTAGE:  Regulator output voltage can be changed by software on this
+ *           board/machine.
+ * CURRENT:  Regulator output current can be changed by software on this
+ *           board/machine.
+ * MODE:     Regulator operating mode can be changed by software on this
+ *           board/machine.
+ * STATUS:   Regulator can be enabled and disabled.
+ * DRMS:     Dynamic Regulator Mode Switching is enabled for this regulator.
+ */
+
+#define REGULATOR_CHANGE_VOLTAGE       0x1
+#define REGULATOR_CHANGE_CURRENT       0x2
+#define REGULATOR_CHANGE_MODE          0x4
+#define REGULATOR_CHANGE_STATUS                0x8
+#define REGULATOR_CHANGE_DRMS          0x10
+
+/**
+ * struct regulator_state - regulator state during low power syatem states
+ *
+ * This describes a regulators state during a system wide low power state.
+ */
+struct regulator_state {
+       int uV; /* suspend voltage */
+       unsigned int mode; /* suspend regulator operating mode */
+       int enabled; /* is regulator enabled in this suspend state */
+};
+
+/**
+ * struct regulation_constraints - regulator operating constraints.
+ *
+ * This struct describes regulator and board/machine specific constraints.
+ */
+struct regulation_constraints {
+
+       char *name;
+
+       /* voltage output range (inclusive) - for voltage control */
+       int min_uV;
+       int max_uV;
+
+       /* current output range (inclusive) - for current control */
+       int min_uA;
+       int max_uA;
+
+       /* valid regulator operating modes for this machine */
+       unsigned int valid_modes_mask;
+
+       /* valid operations for regulator on this machine */
+       unsigned int valid_ops_mask;
+
+       /* regulator input voltage - only if supply is another regulator */
+       int input_uV;
+
+       /* regulator suspend states for global PMIC STANDBY/HIBERNATE */
+       struct regulator_state state_disk;
+       struct regulator_state state_mem;
+       struct regulator_state state_standby;
+       suspend_state_t initial_state; /* suspend state to set at init */
+
+       /* constriant flags */
+       unsigned always_on:1;   /* regulator never off when system is on */
+       unsigned boot_on:1;     /* bootloader/firmware enabled regulator */
+       unsigned apply_uV:1;    /* apply uV constraint iff min == max */
+};
+
+int regulator_set_supply(const char *regulator, const char *regulator_supply);
+
+const char *regulator_get_supply(const char *regulator);
+
+int regulator_set_machine_constraints(const char *regulator,
+       struct regulation_constraints *constraints);
+
+int regulator_set_device_supply(const char *regulator, struct device *dev,
+                               const char *supply);
+
+int regulator_suspend_prepare(suspend_state_t state);
+
+#endif
index c5f6e54..741d1a6 100644 (file)
@@ -68,7 +68,8 @@ enum rfkill_state {
  * @user_claim_unsupported: Whether the hardware supports exclusive
  *     RF-kill control by userspace. Set this before registering.
  * @user_claim: Set when the switch is controlled exlusively by userspace.
- * @mutex: Guards switch state transitions
+ * @mutex: Guards switch state transitions.  It serializes callbacks
+ *     and also protects the state.
  * @data: Pointer to the RF button drivers private data which will be
  *     passed along when toggling radio state.
  * @toggle_radio(): Mandatory handler to control state of the radio.
@@ -89,12 +90,13 @@ struct rfkill {
        const char *name;
        enum rfkill_type type;
 
-       enum rfkill_state state;
        bool user_claim_unsupported;
        bool user_claim;
 
+       /* the mutex serializes callbacks and also protects
+        * the state */
        struct mutex mutex;
-
+       enum rfkill_state state;
        void *data;
        int (*toggle_radio)(void *data, enum rfkill_state state);
        int (*get_state)(void *data, enum rfkill_state *state);
index 7ea44f6..cfcc45b 100644 (file)
@@ -243,6 +243,7 @@ typedef unsigned char *sk_buff_data_t;
  *     @tc_index: Traffic control index
  *     @tc_verd: traffic control verdict
  *     @ndisc_nodetype: router type (from link layer)
+ *     @do_not_encrypt: set to prevent encryption of this frame
  *     @dma_cookie: a cookie to one of several possible DMA operations
  *             done by skb DMA functions
  *     @secmark: security marking
@@ -316,7 +317,10 @@ struct sk_buff {
 #ifdef CONFIG_IPV6_NDISC_NODETYPE
        __u8                    ndisc_nodetype:2;
 #endif
-       /* 14 bit hole */
+#if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE)
+       __u8                    do_not_encrypt:1;
+#endif
+       /* 0/13/14 bit hole */
 
 #ifdef CONFIG_NET_DMA
        dma_cookie_t            dma_cookie;
index 5df62ef..7a6e6bb 100644 (file)
@@ -214,6 +214,8 @@ enum
        LINUX_MIB_TCPDSACKIGNOREDOLD,           /* TCPSACKIgnoredOld */
        LINUX_MIB_TCPDSACKIGNOREDNOUNDO,        /* TCPSACKIgnoredNoUndo */
        LINUX_MIB_TCPSPURIOUSRTOS,              /* TCPSpuriousRTOs */
+       LINUX_MIB_TCPMD5NOTFOUND,               /* TCPMD5NotFound */
+       LINUX_MIB_TCPMD5UNEXPECTED,             /* TCPMD5Unexpected */
        __LINUX_MIB_MAX
 };
 
diff --git a/include/linux/spi/orion_spi.h b/include/linux/spi/orion_spi.h
new file mode 100644 (file)
index 0000000..b4d9fa6
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * orion_spi.h
+ *
+ * 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.
+ */
+
+#ifndef __LINUX_SPI_ORION_SPI_H
+#define __LINUX_SPI_ORION_SPI_H
+
+struct orion_spi_info {
+       u32     tclk;           /* no <linux/clk.h> support yet */
+};
+
+
+#endif
index b187558..ab3ef7a 100644 (file)
@@ -487,14 +487,20 @@ static inline int tracehook_notify_jctl(int notify, int why)
        return notify || (current->ptrace & PT_PTRACED);
 }
 
+#define DEATH_REAP                     -1
+#define DEATH_DELAYED_GROUP_LEADER     -2
+
 /**
  * tracehook_notify_death - task is dead, ready to notify parent
  * @task:              @current task now exiting
  * @death_cookie:      value to pass to tracehook_report_death()
  * @group_dead:                nonzero if this was the last thread in the group to die
  *
- * Return the signal number to send our parent with do_notify_parent(), or
- * zero to send no signal and leave a zombie, or -1 to self-reap right now.
+ * A return value >= 0 means call do_notify_parent() with that signal
+ * number.  Negative return value can be %DEATH_REAP to self-reap right
+ * now, or %DEATH_DELAYED_GROUP_LEADER to a zombie without notifying our
+ * parent.  Note that a return value of 0 means a do_notify_parent() call
+ * that sends no signal, but still wakes up a parent blocked in wait*().
  *
  * Called with write_lock_irq(&tasklist_lock) held.
  */
@@ -502,7 +508,7 @@ static inline int tracehook_notify_death(struct task_struct *task,
                                         void **death_cookie, int group_dead)
 {
        if (task->exit_signal == -1)
-               return task->ptrace ? SIGCHLD : -1;
+               return task->ptrace ? SIGCHLD : DEATH_REAP;
 
        /*
         * If something other than our normal parent is ptracing us, then
@@ -512,21 +518,21 @@ static inline int tracehook_notify_death(struct task_struct *task,
        if (thread_group_empty(task) && !ptrace_reparented(task))
                return task->exit_signal;
 
-       return task->ptrace ? SIGCHLD : 0;
+       return task->ptrace ? SIGCHLD : DEATH_DELAYED_GROUP_LEADER;
 }
 
 /**
  * tracehook_report_death - task is dead and ready to be reaped
  * @task:              @current task now exiting
- * @signal:            signal number sent to parent, or 0 or -1
+ * @signal:            return value from tracheook_notify_death()
  * @death_cookie:      value passed back from tracehook_notify_death()
  * @group_dead:                nonzero if this was the last thread in the group to die
  *
  * Thread has just become a zombie or is about to self-reap.  If positive,
  * @signal is the signal number just sent to the parent (usually %SIGCHLD).
- * If @signal is -1, this thread will self-reap.  If @signal is 0, this is
- * a delayed_group_leader() zombie.  The @death_cookie was passed back by
- * tracehook_notify_death().
+ * If @signal is %DEATH_REAP, this thread will self-reap.  If @signal is
+ * %DEATH_DELAYED_GROUP_LEADER, this is a delayed_group_leader() zombie.
+ * The @death_cookie was passed back by tracehook_notify_death().
  *
  * If normal reaping is not inhibited, @task->exit_state might be changing
  * in parallel.
index 14c0e91..1c78d56 100644 (file)
@@ -74,7 +74,7 @@ void con_protect_unimap(struct vc_data *vc, int rdonly);
 int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc);
 
 #define vc_translate(vc, c) ((vc)->vc_translate[(c) |                  \
-                                       (vc)->vc_toggle_meta ? 0x80 : 0])
+                                       ((vc)->vc_toggle_meta ? 0x80 : 0)])
 #else
 #define con_set_trans_old(arg) (0)
 #define con_get_trans_old(arg) (-EINVAL)
@@ -86,6 +86,7 @@ int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc);
 #define con_copy_unimap(d, s) (0)
 #define con_get_unimap(vc, ct, uct, list) (-EINVAL)
 #define con_free_unimap(vc) do { ; } while (0)
+#define con_protect_unimap(vc, rdonly) do { ; } while (0)
 
 #define vc_translate(vc, c) (c)
 #endif
diff --git a/include/media/audiochip.h b/include/media/audiochip.h
deleted file mode 100644 (file)
index e69de29..0000000
index 1de98f1..d548de3 100644 (file)
@@ -14,6 +14,7 @@
 
 #include <linux/videodev2.h>
 #include <media/videobuf-core.h>
+#include <linux/pm.h>
 
 struct soc_camera_device {
        struct list_head list;
@@ -63,6 +64,8 @@ struct soc_camera_host_ops {
        struct module *owner;
        int (*add)(struct soc_camera_device *);
        void (*remove)(struct soc_camera_device *);
+       int (*suspend)(struct soc_camera_device *, pm_message_t state);
+       int (*resume)(struct soc_camera_device *);
        int (*set_fmt_cap)(struct soc_camera_device *, __u32,
                           struct v4l2_rect *);
        int (*try_fmt_cap)(struct soc_camera_device *, struct v4l2_format *);
@@ -111,6 +114,8 @@ struct soc_camera_ops {
        struct module *owner;
        int (*probe)(struct soc_camera_device *);
        void (*remove)(struct soc_camera_device *);
+       int (*suspend)(struct soc_camera_device *, pm_message_t state);
+       int (*resume)(struct soc_camera_device *);
        int (*init)(struct soc_camera_device *);
        int (*release)(struct soc_camera_device *);
        int (*start_capture)(struct soc_camera_device *);
index c5c318a..8a8b71e 100644 (file)
@@ -252,17 +252,7 @@ static inline int dst_output(struct sk_buff *skb)
 /* Input packet from network to transport.  */
 static inline int dst_input(struct sk_buff *skb)
 {
-       int err;
-
-       for (;;) {
-               err = skb->dst->input(skb);
-
-               if (likely(err == 0))
-                       return err;
-               /* Oh, Jamal... Seems, I will not forgive you this mess. :-) */
-               if (unlikely(err != NET_XMIT_BYPASS))
-                       return err;
-       }
+       return skb->dst->input(skb);
 }
 
 static inline struct dst_entry *dst_check(struct dst_entry *dst, u32 cookie)
index ad16e00..228b247 100644 (file)
@@ -47,7 +47,6 @@ struct flowi {
 #define fl4_scope      nl_u.ip4_u.scope
 
        __u8    proto;
-       __u8    flags;
        union {
                struct {
                        __be16  sport;
index 9a51eba..cbb59eb 100644 (file)
  *      data structure and functionality definitions
  */
 
-#ifndef _IP_VS_H
-#define _IP_VS_H
-
-#include <asm/types.h>         /* For __uXX types */
-#include <linux/types.h>       /* For __beXX types in userland */
-
-#include <linux/sysctl.h>      /* For ctl_path */
-
-#define IP_VS_VERSION_CODE     0x010201
-#define NVERSION(version)                      \
-       (version >> 16) & 0xFF,                 \
-       (version >> 8) & 0xFF,                  \
-       version & 0xFF
-
-/*
- *      Virtual Service Flags
- */
-#define IP_VS_SVC_F_PERSISTENT 0x0001          /* persistent port */
-#define IP_VS_SVC_F_HASHED     0x0002          /* hashed entry */
-
-/*
- *      Destination Server Flags
- */
-#define IP_VS_DEST_F_AVAILABLE 0x0001          /* server is available */
-#define IP_VS_DEST_F_OVERLOAD  0x0002          /* server is overloaded */
-
-/*
- *      IPVS sync daemon states
- */
-#define IP_VS_STATE_NONE       0x0000          /* daemon is stopped */
-#define IP_VS_STATE_MASTER     0x0001          /* started as master */
-#define IP_VS_STATE_BACKUP     0x0002          /* started as backup */
-
-/*
- *      IPVS socket options
- */
-#define IP_VS_BASE_CTL         (64+1024+64)            /* base */
-
-#define IP_VS_SO_SET_NONE      IP_VS_BASE_CTL          /* just peek */
-#define IP_VS_SO_SET_INSERT    (IP_VS_BASE_CTL+1)
-#define IP_VS_SO_SET_ADD       (IP_VS_BASE_CTL+2)
-#define IP_VS_SO_SET_EDIT      (IP_VS_BASE_CTL+3)
-#define IP_VS_SO_SET_DEL       (IP_VS_BASE_CTL+4)
-#define IP_VS_SO_SET_FLUSH     (IP_VS_BASE_CTL+5)
-#define IP_VS_SO_SET_LIST      (IP_VS_BASE_CTL+6)
-#define IP_VS_SO_SET_ADDDEST   (IP_VS_BASE_CTL+7)
-#define IP_VS_SO_SET_DELDEST   (IP_VS_BASE_CTL+8)
-#define IP_VS_SO_SET_EDITDEST  (IP_VS_BASE_CTL+9)
-#define IP_VS_SO_SET_TIMEOUT   (IP_VS_BASE_CTL+10)
-#define IP_VS_SO_SET_STARTDAEMON (IP_VS_BASE_CTL+11)
-#define IP_VS_SO_SET_STOPDAEMON (IP_VS_BASE_CTL+12)
-#define IP_VS_SO_SET_RESTORE    (IP_VS_BASE_CTL+13)
-#define IP_VS_SO_SET_SAVE       (IP_VS_BASE_CTL+14)
-#define IP_VS_SO_SET_ZERO      (IP_VS_BASE_CTL+15)
-#define IP_VS_SO_SET_MAX       IP_VS_SO_SET_ZERO
-
-#define IP_VS_SO_GET_VERSION   IP_VS_BASE_CTL
-#define IP_VS_SO_GET_INFO      (IP_VS_BASE_CTL+1)
-#define IP_VS_SO_GET_SERVICES  (IP_VS_BASE_CTL+2)
-#define IP_VS_SO_GET_SERVICE   (IP_VS_BASE_CTL+3)
-#define IP_VS_SO_GET_DESTS     (IP_VS_BASE_CTL+4)
-#define IP_VS_SO_GET_DEST      (IP_VS_BASE_CTL+5)      /* not used now */
-#define IP_VS_SO_GET_TIMEOUT   (IP_VS_BASE_CTL+6)
-#define IP_VS_SO_GET_DAEMON    (IP_VS_BASE_CTL+7)
-#define IP_VS_SO_GET_MAX       IP_VS_SO_GET_DAEMON
-
-
-/*
- *      IPVS Connection Flags
- */
-#define IP_VS_CONN_F_FWD_MASK  0x0007          /* mask for the fwd methods */
-#define IP_VS_CONN_F_MASQ      0x0000          /* masquerading/NAT */
-#define IP_VS_CONN_F_LOCALNODE 0x0001          /* local node */
-#define IP_VS_CONN_F_TUNNEL    0x0002          /* tunneling */
-#define IP_VS_CONN_F_DROUTE    0x0003          /* direct routing */
-#define IP_VS_CONN_F_BYPASS    0x0004          /* cache bypass */
-#define IP_VS_CONN_F_SYNC      0x0020          /* entry created by sync */
-#define IP_VS_CONN_F_HASHED    0x0040          /* hashed entry */
-#define IP_VS_CONN_F_NOOUTPUT  0x0080          /* no output packets */
-#define IP_VS_CONN_F_INACTIVE  0x0100          /* not established */
-#define IP_VS_CONN_F_OUT_SEQ   0x0200          /* must do output seq adjust */
-#define IP_VS_CONN_F_IN_SEQ    0x0400          /* must do input seq adjust */
-#define IP_VS_CONN_F_SEQ_MASK  0x0600          /* in/out sequence mask */
-#define IP_VS_CONN_F_NO_CPORT  0x0800          /* no client port set yet */
-#define IP_VS_CONN_F_TEMPLATE  0x1000          /* template, not connection */
-
-/* Move it to better place one day, for now keep it unique */
-#define NFC_IPVS_PROPERTY      0x10000
-
-#define IP_VS_SCHEDNAME_MAXLEN 16
-#define IP_VS_IFNAME_MAXLEN    16
-
-
-/*
- *     The struct ip_vs_service_user and struct ip_vs_dest_user are
- *     used to set IPVS rules through setsockopt.
- */
-struct ip_vs_service_user {
-       /* virtual service addresses */
-       u_int16_t               protocol;
-       __be32                  addr;           /* virtual ip address */
-       __be16                  port;
-       u_int32_t               fwmark;         /* firwall mark of service */
-
-       /* virtual service options */
-       char                    sched_name[IP_VS_SCHEDNAME_MAXLEN];
-       unsigned                flags;          /* virtual service flags */
-       unsigned                timeout;        /* persistent timeout in sec */
-       __be32                  netmask;        /* persistent netmask */
-};
-
-
-struct ip_vs_dest_user {
-       /* destination server address */
-       __be32                  addr;
-       __be16                  port;
-
-       /* real server options */
-       unsigned                conn_flags;     /* connection flags */
-       int                     weight;         /* destination weight */
-
-       /* thresholds for active connections */
-       u_int32_t               u_threshold;    /* upper threshold */
-       u_int32_t               l_threshold;    /* lower threshold */
-};
-
-
-/*
- *     IPVS statistics object (for user space)
- */
-struct ip_vs_stats_user
-{
-       __u32                   conns;          /* connections scheduled */
-       __u32                   inpkts;         /* incoming packets */
-       __u32                   outpkts;        /* outgoing packets */
-       __u64                   inbytes;        /* incoming bytes */
-       __u64                   outbytes;       /* outgoing bytes */
-
-       __u32                   cps;            /* current connection rate */
-       __u32                   inpps;          /* current in packet rate */
-       __u32                   outpps;         /* current out packet rate */
-       __u32                   inbps;          /* current in byte rate */
-       __u32                   outbps;         /* current out byte rate */
-};
-
-
-/* The argument to IP_VS_SO_GET_INFO */
-struct ip_vs_getinfo {
-       /* version number */
-       unsigned int            version;
-
-       /* size of connection hash table */
-       unsigned int            size;
-
-       /* number of virtual services */
-       unsigned int            num_services;
-};
-
-
-/* The argument to IP_VS_SO_GET_SERVICE */
-struct ip_vs_service_entry {
-       /* which service: user fills in these */
-       u_int16_t               protocol;
-       __be32                  addr;           /* virtual address */
-       __be16                  port;
-       u_int32_t               fwmark;         /* firwall mark of service */
-
-       /* service options */
-       char                    sched_name[IP_VS_SCHEDNAME_MAXLEN];
-       unsigned                flags;          /* virtual service flags */
-       unsigned                timeout;        /* persistent timeout */
-       __be32                  netmask;        /* persistent netmask */
-
-       /* number of real servers */
-       unsigned int            num_dests;
-
-       /* statistics */
-       struct ip_vs_stats_user stats;
-};
-
-
-struct ip_vs_dest_entry {
-       __be32                  addr;           /* destination address */
-       __be16                  port;
-       unsigned                conn_flags;     /* connection flags */
-       int                     weight;         /* destination weight */
-
-       u_int32_t               u_threshold;    /* upper threshold */
-       u_int32_t               l_threshold;    /* lower threshold */
-
-       u_int32_t               activeconns;    /* active connections */
-       u_int32_t               inactconns;     /* inactive connections */
-       u_int32_t               persistconns;   /* persistent connections */
-
-       /* statistics */
-       struct ip_vs_stats_user stats;
-};
-
-
-/* The argument to IP_VS_SO_GET_DESTS */
-struct ip_vs_get_dests {
-       /* which service: user fills in these */
-       u_int16_t               protocol;
-       __be32                  addr;           /* virtual address */
-       __be16                  port;
-       u_int32_t               fwmark;         /* firwall mark of service */
-
-       /* number of real servers */
-       unsigned int            num_dests;
-
-       /* the real servers */
-       struct ip_vs_dest_entry entrytable[0];
-};
-
-
-/* The argument to IP_VS_SO_GET_SERVICES */
-struct ip_vs_get_services {
-       /* number of virtual services */
-       unsigned int            num_services;
-
-       /* service table */
-       struct ip_vs_service_entry entrytable[0];
-};
-
-
-/* The argument to IP_VS_SO_GET_TIMEOUT */
-struct ip_vs_timeout_user {
-       int                     tcp_timeout;
-       int                     tcp_fin_timeout;
-       int                     udp_timeout;
-};
-
-
-/* The argument to IP_VS_SO_GET_DAEMON */
-struct ip_vs_daemon_user {
-       /* sync daemon state (master/backup) */
-       int                     state;
-
-       /* multicast interface name */
-       char                    mcast_ifn[IP_VS_IFNAME_MAXLEN];
-
-       /* SyncID we belong to */
-       int                     syncid;
-};
+#ifndef _NET_IP_VS_H
+#define _NET_IP_VS_H
 
+#include <linux/ip_vs.h>                /* definitions shared with userland */
 
+/* old ipvsadm versions still include this file directly */
 #ifdef __KERNEL__
 
+#include <asm/types.h>                  /* for __uXX types */
+
+#include <linux/sysctl.h>               /* for ctl_path */
 #include <linux/list.h>                 /* for struct list_head */
 #include <linux/spinlock.h>             /* for struct rwlock_t */
 #include <asm/atomic.h>                 /* for struct atomic_t */
@@ -981,4 +744,4 @@ static inline __wsum ip_vs_check_diff2(__be16 old, __be16 new, __wsum oldsum)
 
 #endif /* __KERNEL__ */
 
-#endif /* _IP_VS_H */
+#endif /* _NET_IP_VS_H */
index 4dd3d93..b397e4d 100644 (file)
@@ -177,9 +177,10 @@ enum ieee80211_bss_change {
  * @aid: association ID number, valid only when @assoc is true
  * @use_cts_prot: use CTS protection
  * @use_short_preamble: use 802.11b short preamble
+ * @dtim_period: num of beacons before the next DTIM, for PSM
  * @timestamp: beacon timestamp
  * @beacon_int: beacon interval
- * @assoc_capability: capabbilities taken from assoc resp
+ * @assoc_capability: capabilities taken from assoc resp
  * @assoc_ht: association in HT mode
  * @ht_conf: ht capabilities
  * @ht_bss_conf: ht extended capabilities
@@ -191,6 +192,7 @@ struct ieee80211_bss_conf {
        /* erp related data */
        bool use_cts_prot;
        bool use_short_preamble;
+       u8 dtim_period;
        u16 beacon_int;
        u16 assoc_capability;
        u64 timestamp;
@@ -206,8 +208,6 @@ struct ieee80211_bss_conf {
  * These flags are used with the @flags member of &ieee80211_tx_info.
  *
  * @IEEE80211_TX_CTL_REQ_TX_STATUS: request TX status callback for this frame.
- * @IEEE80211_TX_CTL_DO_NOT_ENCRYPT: send this frame without encryption;
- *     e.g., for EAPOL frame
  * @IEEE80211_TX_CTL_USE_RTS_CTS: use RTS-CTS before sending frame
  * @IEEE80211_TX_CTL_USE_CTS_PROTECT: use CTS protection for the frame (e.g.,
  *     for combined 802.11g / 802.11b networks)
@@ -220,7 +220,6 @@ struct ieee80211_bss_conf {
  * @IEEE80211_TX_CTL_SHORT_PREAMBLE: TBD
  * @IEEE80211_TX_CTL_LONG_RETRY_LIMIT: this frame should be send using the
  *     through set_retry_limit configured long retry value
- * @IEEE80211_TX_CTL_EAPOL_FRAME: internal to mac80211
  * @IEEE80211_TX_CTL_SEND_AFTER_DTIM: send this frame after DTIM beacon
  * @IEEE80211_TX_CTL_AMPDU: this frame should be sent as part of an A-MPDU
  * @IEEE80211_TX_CTL_OFDM_HT: this frame can be sent in HT OFDM rates. number
@@ -253,7 +252,6 @@ struct ieee80211_bss_conf {
  */
 enum mac80211_tx_control_flags {
        IEEE80211_TX_CTL_REQ_TX_STATUS          = BIT(0),
-       IEEE80211_TX_CTL_DO_NOT_ENCRYPT         = BIT(1),
        IEEE80211_TX_CTL_USE_RTS_CTS            = BIT(2),
        IEEE80211_TX_CTL_USE_CTS_PROTECT        = BIT(3),
        IEEE80211_TX_CTL_NO_ACK                 = BIT(4),
@@ -263,7 +261,6 @@ enum mac80211_tx_control_flags {
        IEEE80211_TX_CTL_FIRST_FRAGMENT         = BIT(8),
        IEEE80211_TX_CTL_SHORT_PREAMBLE         = BIT(9),
        IEEE80211_TX_CTL_LONG_RETRY_LIMIT       = BIT(10),
-       IEEE80211_TX_CTL_EAPOL_FRAME            = BIT(11),
        IEEE80211_TX_CTL_SEND_AFTER_DTIM        = BIT(12),
        IEEE80211_TX_CTL_AMPDU                  = BIT(13),
        IEEE80211_TX_CTL_OFDM_HT                = BIT(14),
@@ -323,7 +320,6 @@ struct ieee80211_tx_info {
                        struct ieee80211_vif *vif;
                        struct ieee80211_key_conf *hw_key;
                        unsigned long jiffies;
-                       int ifindex;
                        u16 aid;
                        s8 rts_cts_rate_idx, alt_retry_rate_idx;
                        u8 retry_limit;
@@ -436,6 +432,7 @@ enum ieee80211_conf_flags {
  * @radio_enabled: when zero, driver is required to switch off the radio.
  *     TODO make a flag
  * @beacon_int: beacon interval (TODO make interface config)
+ * @listen_interval: listen interval in units of beacon interval
  * @flags: configuration flags defined above
  * @power_level: requested transmit power (in dBm)
  * @max_antenna_gain: maximum antenna gain (in dBi)
@@ -450,6 +447,7 @@ struct ieee80211_conf {
        int radio_enabled;
 
        int beacon_int;
+       u16 listen_interval;
        u32 flags;
        int power_level;
        int max_antenna_gain;
@@ -746,7 +744,6 @@ enum ieee80211_tkip_key_type {
  *     Measurement, Channel Switch, Quieting, TPC
  */
 enum ieee80211_hw_flags {
-       IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE           = 1<<0,
        IEEE80211_HW_RX_INCLUDES_FCS                    = 1<<1,
        IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING        = 1<<2,
        IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE          = 1<<3,
@@ -792,6 +789,9 @@ enum ieee80211_hw_flags {
  * @max_signal: Maximum value for signal (rssi) in RX information, used
  *     only when @IEEE80211_HW_SIGNAL_UNSPEC or @IEEE80211_HW_SIGNAL_DB
  *
+ * @max_listen_interval: max listen interval in units of beacon interval
+ *     that HW supports
+ *
  * @queues: number of available hardware transmit queues for
  *     data packets. WMM/QoS requires at least four, these
  *     queues need to have configurable access parameters.
@@ -819,7 +819,9 @@ struct ieee80211_hw {
        unsigned int extra_tx_headroom;
        int channel_change_time;
        int vif_data_size;
-       u16 queues, ampdu_queues;
+       u16 queues;
+       u16 ampdu_queues;
+       u16 max_listen_interval;
        s8 max_signal;
 };
 
index b5f40d7..a7abfda 100644 (file)
@@ -193,10 +193,22 @@ static inline struct Qdisc *qdisc_root(struct Qdisc *qdisc)
        return qdisc->dev_queue->qdisc;
 }
 
+/* The qdisc root lock is a mechanism by which to top level
+ * of a qdisc tree can be locked from any qdisc node in the
+ * forest.  This allows changing the configuration of some
+ * aspect of the qdisc tree while blocking out asynchronous
+ * qdisc access in the packet processing paths.
+ *
+ * It is only legal to do this when the root will not change
+ * on us.  Otherwise we'll potentially lock the wrong qdisc
+ * root.  This is enforced by holding the RTNL semaphore, which
+ * all users of this lock accessor must do.
+ */
 static inline spinlock_t *qdisc_root_lock(struct Qdisc *qdisc)
 {
        struct Qdisc *root = qdisc_root(qdisc);
 
+       ASSERT_RTNL();
        return qdisc_lock(root);
 }
 
@@ -331,6 +343,18 @@ static inline unsigned int qdisc_pkt_len(struct sk_buff *skb)
        return qdisc_skb_cb(skb)->pkt_len;
 }
 
+/* additional qdisc xmit flags (NET_XMIT_MASK in linux/netdevice.h) */
+enum net_xmit_qdisc_t {
+       __NET_XMIT_STOLEN = 0x00010000,
+       __NET_XMIT_BYPASS = 0x00020000,
+};
+
+#ifdef CONFIG_NET_CLS_ACT
+#define net_xmit_drop_count(e) ((e) & __NET_XMIT_STOLEN ? 0 : 1)
+#else
+#define net_xmit_drop_count(e) (1)
+#endif
+
 static inline int qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
 {
 #ifdef CONFIG_NET_SCHED
@@ -343,7 +367,7 @@ static inline int qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
 static inline int qdisc_enqueue_root(struct sk_buff *skb, struct Qdisc *sch)
 {
        qdisc_skb_cb(skb)->pkt_len = skb->len;
-       return qdisc_enqueue(skb, sch);
+       return qdisc_enqueue(skb, sch) & NET_XMIT_MASK;
 }
 
 static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch,
index 535a18f..ab1c472 100644 (file)
@@ -524,8 +524,7 @@ static inline void sctp_ssn_skip(struct sctp_stream *stream, __u16 id,
  */
 struct sctp_af {
        int             (*sctp_xmit)    (struct sk_buff *skb,
-                                        struct sctp_transport *,
-                                        int ipfragok);
+                                        struct sctp_transport *);
        int             (*setsockopt)   (struct sock *sk,
                                         int level,
                                         int optname,
index 3030fdc..c1b26fc 100644 (file)
@@ -202,6 +202,9 @@ struct snd_soc_dapm_path;
 struct snd_soc_dapm_pin;
 struct snd_soc_dapm_route;
 
+int dapm_reg_event(struct snd_soc_dapm_widget *w,
+                  struct snd_kcontrol *kcontrol, int event);
+
 /* dapm controls */
 int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_value *ucontrol);
index 83467e1..95a1f20 100644 (file)
 
 
 /* DSTCACHE_CTLSTAT bit constants */
-#define RB2D_DC_FLUSH                             (3 << 0)
-#define RB2D_DC_FLUSH_ALL                         0xf
+#define RB2D_DC_FLUSH_2D                          (1 << 0)
+#define RB2D_DC_FREE_2D                                   (1 << 2)
+#define RB2D_DC_FLUSH_ALL                         (RB2D_DC_FLUSH_2D | RB2D_DC_FREE_2D)
 #define RB2D_DC_BUSY                              (1 << 31)
 
 
index 250e02c..b678803 100644 (file)
@@ -522,7 +522,7 @@ config CC_OPTIMIZE_FOR_SIZE
          Enabling this option will pass "-Os" instead of "-O2" to gcc
          resulting in a smaller kernel.
 
-         If unsure, say N.
+         If unsure, say Y.
 
 config SYSCTL
        bool
@@ -845,9 +845,10 @@ menuconfig MODULES
 
          If unsure, say Y.
 
+if MODULES
+
 config MODULE_FORCE_LOAD
        bool "Forced module loading"
-       depends on MODULES
        default n
        help
          Allow loading of modules without version information (ie. modprobe
@@ -856,7 +857,6 @@ config MODULE_FORCE_LOAD
 
 config MODULE_UNLOAD
        bool "Module unloading"
-       depends on MODULES
        help
          Without this option you will not be able to unload any
          modules (note that some modules may not be unloadable
@@ -875,7 +875,6 @@ config MODULE_FORCE_UNLOAD
 
 config MODVERSIONS
        bool "Module versioning support"
-       depends on MODULES
        help
          Usually, you have to use modules compiled with your kernel.
          Saying Y here makes it sometimes possible to use modules
@@ -886,7 +885,6 @@ config MODVERSIONS
 
 config MODULE_SRCVERSION_ALL
        bool "Source checksum for all modules"
-       depends on MODULES
        help
          Modules which contain a MODULE_VERSION get an extra "srcversion"
          field inserted into their modinfo section, which contains a
@@ -898,11 +896,12 @@ config MODULE_SRCVERSION_ALL
 
 config KMOD
        def_bool y
-       depends on MODULES
        help
          This is being removed soon.  These days, CONFIG_MODULES
          implies CONFIG_KMOD, so use that instead.
 
+endif # MODULES
+
 config STOP_MACHINE
        bool
        default y
index 7963e3f..a379c90 100644 (file)
@@ -170,7 +170,7 @@ void __cpuinit calibrate_delay(void)
                                loops_per_jiffy &= ~loopbit;
                }
        }
-       printk(KERN_INFO "%lu.%02lu BogoMIPS (lpj=%lu)\n",
+       printk(KERN_CONT "%lu.%02lu BogoMIPS (lpj=%lu)\n",
                        loops_per_jiffy/(500000/HZ),
                        (loops_per_jiffy/(5000/HZ)) % 100, loops_per_jiffy);
 }
index 20fdc98..0bc7e16 100644 (file)
@@ -22,7 +22,6 @@
 #include <linux/init.h>
 #include <linux/smp_lock.h>
 #include <linux/initrd.h>
-#include <linux/hdreg.h>
 #include <linux/bootmem.h>
 #include <linux/tty.h>
 #include <linux/gfp.h>
@@ -635,10 +634,11 @@ asmlinkage void __init start_kernel(void)
 
 #ifdef CONFIG_BLK_DEV_INITRD
        if (initrd_start && !initrd_below_start_ok &&
-           page_to_pfn(virt_to_page(initrd_start)) < min_low_pfn) {
+           page_to_pfn(virt_to_page((void *)initrd_start)) < min_low_pfn) {
                printk(KERN_CRIT "initrd overwritten (0x%08lx < 0x%08lx) - "
                    "disabling it.\n",
-                   page_to_pfn(virt_to_page(initrd_start)), min_low_pfn);
+                   page_to_pfn(virt_to_page((void *)initrd_start)),
+                   min_low_pfn);
                initrd_start = 0;
        }
 #endif
index e092f1c..4414e93 100644 (file)
@@ -707,12 +707,14 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
                if (status_get->mask & AUDIT_STATUS_ENABLED) {
                        err = audit_set_enabled(status_get->enabled,
                                                loginuid, sessionid, sid);
-                       if (err < 0) return err;
+                       if (err < 0)
+                               return err;
                }
                if (status_get->mask & AUDIT_STATUS_FAILURE) {
                        err = audit_set_failure(status_get->failure,
                                                loginuid, sessionid, sid);
-                       if (err < 0) return err;
+                       if (err < 0)
+                               return err;
                }
                if (status_get->mask & AUDIT_STATUS_PID) {
                        int new_pid = status_get->pid;
@@ -725,9 +727,12 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
                        audit_pid = new_pid;
                        audit_nlk_pid = NETLINK_CB(skb).pid;
                }
-               if (status_get->mask & AUDIT_STATUS_RATE_LIMIT)
+               if (status_get->mask & AUDIT_STATUS_RATE_LIMIT) {
                        err = audit_set_rate_limit(status_get->rate_limit,
                                                   loginuid, sessionid, sid);
+                       if (err < 0)
+                               return err;
+               }
                if (status_get->mask & AUDIT_STATUS_BACKLOG_LIMIT)
                        err = audit_set_backlog_limit(status_get->backlog_limit,
                                                      loginuid, sessionid, sid);
@@ -1366,7 +1371,7 @@ int audit_string_contains_control(const char *string, size_t len)
 {
        const unsigned char *p;
        for (p = string; p < (const unsigned char *)string + len && *p; p++) {
-               if (*p == '"' || *p < 0x21 || *p > 0x7f)
+               if (*p == '"' || *p < 0x21 || *p > 0x7e)
                        return 1;
        }
        return 0;
index 98c50cc..b7d354e 100644 (file)
@@ -1022,8 +1022,11 @@ static void audit_update_watch(struct audit_parent *parent,
                        struct audit_buffer *ab;
                        ab = audit_log_start(NULL, GFP_KERNEL,
                                AUDIT_CONFIG_CHANGE);
+                       audit_log_format(ab, "auid=%u ses=%u",
+                               audit_get_loginuid(current),
+                               audit_get_sessionid(current));
                        audit_log_format(ab,
-                               "op=updated rules specifying path=");
+                               " op=updated rules specifying path=");
                        audit_log_untrustedstring(ab, owatch->path);
                        audit_log_format(ab, " with dev=%u ino=%lu\n",
                                 dev, ino);
@@ -1058,7 +1061,10 @@ static void audit_remove_parent_watches(struct audit_parent *parent)
                                struct audit_buffer *ab;
                                ab = audit_log_start(NULL, GFP_KERNEL,
                                        AUDIT_CONFIG_CHANGE);
-                               audit_log_format(ab, "op=remove rule path=");
+                               audit_log_format(ab, "auid=%u ses=%u",
+                                       audit_get_loginuid(current),
+                                       audit_get_sessionid(current));
+                               audit_log_format(ab, " op=remove rule path=");
                                audit_log_untrustedstring(ab, w->path);
                                if (r->filterkey) {
                                        audit_log_format(ab, " key=");
index 4699950..972f8e6 100644 (file)
@@ -243,6 +243,9 @@ static inline int open_arg(int flags, int mask)
 
 static int audit_match_perm(struct audit_context *ctx, int mask)
 {
+       if (unlikely(!ctx))
+               return 0;
+
        unsigned n = ctx->major;
        switch (audit_classify_syscall(ctx->arch, n)) {
        case 0: /* native */
@@ -284,6 +287,10 @@ static int audit_match_filetype(struct audit_context *ctx, int which)
 {
        unsigned index = which & ~S_IFMT;
        mode_t mode = which & S_IFMT;
+
+       if (unlikely(!ctx))
+               return 0;
+
        if (index >= ctx->name_count)
                return 0;
        if (ctx->names[index].ino == -1)
@@ -610,7 +617,7 @@ static int audit_filter_rules(struct task_struct *tsk,
                if (!result)
                        return 0;
        }
-       if (rule->filterkey)
+       if (rule->filterkey && ctx)
                ctx->filterkey = kstrdup(rule->filterkey, GFP_ATOMIC);
        switch (rule->action) {
        case AUDIT_NEVER:    *state = AUDIT_DISABLED;       break;
@@ -2375,7 +2382,7 @@ int __audit_signal_info(int sig, struct task_struct *t)
        struct audit_context *ctx = tsk->audit_context;
 
        if (audit_pid && t->tgid == audit_pid) {
-               if (sig == SIGTERM || sig == SIGHUP || sig == SIGUSR1) {
+               if (sig == SIGTERM || sig == SIGHUP || sig == SIGUSR1 || sig == SIGUSR2) {
                        audit_sig_pid = tsk->pid;
                        if (tsk->loginuid != -1)
                                audit_sig_uid = tsk->loginuid;
index 657f8f8..13932ab 100644 (file)
@@ -355,6 +355,17 @@ static struct css_set *find_existing_css_set(
        return NULL;
 }
 
+static void free_cg_links(struct list_head *tmp)
+{
+       struct cg_cgroup_link *link;
+       struct cg_cgroup_link *saved_link;
+
+       list_for_each_entry_safe(link, saved_link, tmp, cgrp_link_list) {
+               list_del(&link->cgrp_link_list);
+               kfree(link);
+       }
+}
+
 /*
  * allocate_cg_links() allocates "count" cg_cgroup_link structures
  * and chains them on tmp through their cgrp_link_list fields. Returns 0 on
@@ -363,17 +374,12 @@ static struct css_set *find_existing_css_set(
 static int allocate_cg_links(int count, struct list_head *tmp)
 {
        struct cg_cgroup_link *link;
-       struct cg_cgroup_link *saved_link;
        int i;
        INIT_LIST_HEAD(tmp);
        for (i = 0; i < count; i++) {
                link = kmalloc(sizeof(*link), GFP_KERNEL);
                if (!link) {
-                       list_for_each_entry_safe(link, saved_link, tmp,
-                                                cgrp_link_list) {
-                               list_del(&link->cgrp_link_list);
-                               kfree(link);
-                       }
+                       free_cg_links(tmp);
                        return -ENOMEM;
                }
                list_add(&link->cgrp_link_list, tmp);
@@ -381,17 +387,6 @@ static int allocate_cg_links(int count, struct list_head *tmp)
        return 0;
 }
 
-static void free_cg_links(struct list_head *tmp)
-{
-       struct cg_cgroup_link *link;
-       struct cg_cgroup_link *saved_link;
-
-       list_for_each_entry_safe(link, saved_link, tmp, cgrp_link_list) {
-               list_del(&link->cgrp_link_list);
-               kfree(link);
-       }
-}
-
 /*
  * find_css_set() takes an existing cgroup group and a
  * cgroup object, and returns a css_set object that's
@@ -956,7 +951,6 @@ static int cgroup_get_sb(struct file_system_type *fs_type,
        struct super_block *sb;
        struct cgroupfs_root *root;
        struct list_head tmp_cg_links;
-       INIT_LIST_HEAD(&tmp_cg_links);
 
        /* First find the desired set of subsystems */
        ret = parse_cgroupfs_options(data, &opts);
@@ -1424,14 +1418,17 @@ static ssize_t cgroup_write_string(struct cgroup *cgrp, struct cftype *cft,
                if (buffer == NULL)
                        return -ENOMEM;
        }
-       if (nbytes && copy_from_user(buffer, userbuf, nbytes))
-               return -EFAULT;
+       if (nbytes && copy_from_user(buffer, userbuf, nbytes)) {
+               retval = -EFAULT;
+               goto out;
+       }
 
        buffer[nbytes] = 0;     /* nul-terminate */
        strstrip(buffer);
        retval = cft->write_string(cgrp, cft, buffer);
        if (!retval)
                retval = nbytes;
+out:
        if (buffer != local_buffer)
                kfree(buffer);
        return retval;
@@ -2371,7 +2368,7 @@ static int cgroup_mkdir(struct inode *dir, struct dentry *dentry, int mode)
        return cgroup_create(c_parent, dentry, mode | S_IFDIR);
 }
 
-static inline int cgroup_has_css_refs(struct cgroup *cgrp)
+static int cgroup_has_css_refs(struct cgroup *cgrp)
 {
        /* Check the reference count on each subsystem. Since we
         * already established that there are no tasks in the
index 91cf85b..d5ab79c 100644 (file)
@@ -54,7 +54,6 @@
 #include <asm/uaccess.h>
 #include <asm/atomic.h>
 #include <linux/mutex.h>
-#include <linux/kfifo.h>
 #include <linux/workqueue.h>
 #include <linux/cgroup.h>
 
@@ -486,13 +485,38 @@ static int cpusets_overlap(struct cpuset *a, struct cpuset *b)
 static void
 update_domain_attr(struct sched_domain_attr *dattr, struct cpuset *c)
 {
-       if (!dattr)
-               return;
        if (dattr->relax_domain_level < c->relax_domain_level)
                dattr->relax_domain_level = c->relax_domain_level;
        return;
 }
 
+static void
+update_domain_attr_tree(struct sched_domain_attr *dattr, struct cpuset *c)
+{
+       LIST_HEAD(q);
+
+       list_add(&c->stack_list, &q);
+       while (!list_empty(&q)) {
+               struct cpuset *cp;
+               struct cgroup *cont;
+               struct cpuset *child;
+
+               cp = list_first_entry(&q, struct cpuset, stack_list);
+               list_del(q.next);
+
+               if (cpus_empty(cp->cpus_allowed))
+                       continue;
+
+               if (is_sched_load_balance(cp))
+                       update_domain_attr(dattr, cp);
+
+               list_for_each_entry(cont, &cp->css.cgroup->children, sibling) {
+                       child = cgroup_cs(cont);
+                       list_add_tail(&child->stack_list, &q);
+               }
+       }
+}
+
 /*
  * rebuild_sched_domains()
  *
@@ -532,7 +556,7 @@ update_domain_attr(struct sched_domain_attr *dattr, struct cpuset *c)
  * So the reverse nesting would risk an ABBA deadlock.
  *
  * The three key local variables below are:
- *    q  - a kfifo queue of cpuset pointers, used to implement a
+ *    q  - a linked-list queue of cpuset pointers, used to implement a
  *        top-down scan of all cpusets.  This scan loads a pointer
  *        to each cpuset marked is_sched_load_balance into the
  *        array 'csa'.  For our purposes, rebuilding the schedulers
@@ -567,7 +591,7 @@ update_domain_attr(struct sched_domain_attr *dattr, struct cpuset *c)
 
 void rebuild_sched_domains(void)
 {
-       struct kfifo *q;        /* queue of cpusets to be scanned */
+       LIST_HEAD(q);           /* queue of cpusets to be scanned*/
        struct cpuset *cp;      /* scans q */
        struct cpuset **csa;    /* array of all cpuset ptrs */
        int csn;                /* how many cpuset ptrs in csa so far */
@@ -577,7 +601,6 @@ void rebuild_sched_domains(void)
        int ndoms;              /* number of sched domains in result */
        int nslot;              /* next empty doms[] cpumask_t slot */
 
-       q = NULL;
        csa = NULL;
        doms = NULL;
        dattr = NULL;
@@ -591,35 +614,42 @@ void rebuild_sched_domains(void)
                dattr = kmalloc(sizeof(struct sched_domain_attr), GFP_KERNEL);
                if (dattr) {
                        *dattr = SD_ATTR_INIT;
-                       update_domain_attr(dattr, &top_cpuset);
+                       update_domain_attr_tree(dattr, &top_cpuset);
                }
                *doms = top_cpuset.cpus_allowed;
                goto rebuild;
        }
 
-       q = kfifo_alloc(number_of_cpusets * sizeof(cp), GFP_KERNEL, NULL);
-       if (IS_ERR(q))
-               goto done;
        csa = kmalloc(number_of_cpusets * sizeof(cp), GFP_KERNEL);
        if (!csa)
                goto done;
        csn = 0;
 
-       cp = &top_cpuset;
-       __kfifo_put(q, (void *)&cp, sizeof(cp));
-       while (__kfifo_get(q, (void *)&cp, sizeof(cp))) {
+       list_add(&top_cpuset.stack_list, &q);
+       while (!list_empty(&q)) {
                struct cgroup *cont;
                struct cpuset *child;   /* scans child cpusets of cp */
 
+               cp = list_first_entry(&q, struct cpuset, stack_list);
+               list_del(q.next);
+
                if (cpus_empty(cp->cpus_allowed))
                        continue;
 
-               if (is_sched_load_balance(cp))
+               /*
+                * All child cpusets contain a subset of the parent's cpus, so
+                * just skip them, and then we call update_domain_attr_tree()
+                * to calc relax_domain_level of the corresponding sched
+                * domain.
+                */
+               if (is_sched_load_balance(cp)) {
                        csa[csn++] = cp;
+                       continue;
+               }
 
                list_for_each_entry(cont, &cp->css.cgroup->children, sibling) {
                        child = cgroup_cs(cont);
-                       __kfifo_put(q, (void *)&child, sizeof(cp));
+                       list_add_tail(&child->stack_list, &q);
                }
        }
 
@@ -686,7 +716,7 @@ restart:
                                        cpus_or(*dp, *dp, b->cpus_allowed);
                                        b->pn = -1;
                                        if (dattr)
-                                               update_domain_attr(dattr
+                                               update_domain_attr_tree(dattr
                                                                   + nslot, b);
                                }
                        }
@@ -702,8 +732,6 @@ rebuild:
        put_online_cpus();
 
 done:
-       if (q && !IS_ERR(q))
-               kfifo_free(q);
        kfree(csa);
        /* Don't kfree(doms) -- partition_sched_domains() does that. */
        /* Don't kfree(dattr) -- partition_sched_domains() does that. */
@@ -1833,24 +1861,21 @@ static void remove_tasks_in_empty_cpuset(struct cpuset *cs)
  */
 static void scan_for_empty_cpusets(const struct cpuset *root)
 {
+       LIST_HEAD(queue);
        struct cpuset *cp;      /* scans cpusets being updated */
        struct cpuset *child;   /* scans child cpusets of cp */
-       struct list_head queue;
        struct cgroup *cont;
        nodemask_t oldmems;
 
-       INIT_LIST_HEAD(&queue);
-
        list_add_tail((struct list_head *)&root->stack_list, &queue);
 
        while (!list_empty(&queue)) {
-               cp = container_of(queue.next, struct cpuset, stack_list);
+               cp = list_first_entry(&queue, struct cpuset, stack_list);
                list_del(queue.next);
                list_for_each_entry(cont, &cp->css.cgroup->children, sibling) {
                        child = cgroup_cs(cont);
                        list_add_tail(&child->stack_list, &queue);
                }
-               cont = cp->css.cgroup;
 
                /* Continue past cpusets with all cpus, mems online */
                if (cpus_subset(cp->cpus_allowed, cpu_online_map) &&
index 7517115..91e9695 100644 (file)
@@ -77,15 +77,14 @@ void *dma_mark_declared_memory_occupied(struct device *dev,
 {
        struct dma_coherent_mem *mem = dev->dma_mem;
        int pos, err;
-       int pages = (size + (device_addr & ~PAGE_MASK) + PAGE_SIZE - 1);
 
-       pages >>= PAGE_SHIFT;
+       size += device_addr & ~PAGE_MASK;
 
        if (!mem)
                return ERR_PTR(-EINVAL);
 
        pos = (device_addr - mem->device_base) >> PAGE_SHIFT;
-       err = bitmap_allocate_region(mem->bitmap, pos, get_order(pages));
+       err = bitmap_allocate_region(mem->bitmap, pos, get_order(size));
        if (err != 0)
                return ERR_PTR(err);
        return mem->virt_base + (pos << PAGE_SHIFT);
index eb4d647..38ec406 100644 (file)
@@ -911,10 +911,10 @@ static void exit_notify(struct task_struct *tsk, int group_dead)
                tsk->exit_signal = SIGCHLD;
 
        signal = tracehook_notify_death(tsk, &cookie, group_dead);
-       if (signal > 0)
+       if (signal >= 0)
                signal = do_notify_parent(tsk, signal);
 
-       tsk->exit_state = signal < 0 ? EXIT_DEAD : EXIT_ZOMBIE;
+       tsk->exit_state = signal == DEATH_REAP ? EXIT_DEAD : EXIT_ZOMBIE;
 
        /* mt-exec, de_thread() is waiting for us */
        if (thread_group_leader(tsk) &&
@@ -927,7 +927,7 @@ static void exit_notify(struct task_struct *tsk, int group_dead)
        tracehook_report_death(tsk, signal, cookie, group_dead);
 
        /* If the process is dead, release it - nobody will wait for it */
-       if (signal < 0)
+       if (signal == DEATH_REAP)
                release_task(tsk);
 }
 
index 152abfd..0314074 100644 (file)
@@ -323,7 +323,8 @@ static int __irq_set_trigger(struct irq_chip *chip, unsigned int irq,
        ret = chip->set_type(irq, flags & IRQF_TRIGGER_MASK);
 
        if (ret)
-               pr_err("setting flow type for irq %u failed (%pF)\n",
+               pr_err("setting trigger mode %d for irq %u failed (%pF)\n",
+                               (int)(flags & IRQF_TRIGGER_MASK),
                                irq, chip->set_type);
 
        return ret;
index 3ec23c3..eaa21fc 100644 (file)
 
 static int kgdb_break_asap;
 
+#define KGDB_MAX_THREAD_QUERY 17
 struct kgdb_state {
        int                     ex_vector;
        int                     signo;
        int                     err_code;
        int                     cpu;
        int                     pass_exception;
+       unsigned long           thr_query;
        unsigned long           threadid;
        long                    kgdb_usethreadid;
        struct pt_regs          *linux_regs;
@@ -166,13 +168,6 @@ early_param("nokgdbroundup", opt_nokgdbroundup);
  * Weak aliases for breakpoint management,
  * can be overriden by architectures when needed:
  */
-int __weak kgdb_validate_break_address(unsigned long addr)
-{
-       char tmp_variable[BREAK_INSTR_SIZE];
-
-       return probe_kernel_read(tmp_variable, (char *)addr, BREAK_INSTR_SIZE);
-}
-
 int __weak kgdb_arch_set_breakpoint(unsigned long addr, char *saved_instr)
 {
        int err;
@@ -191,6 +186,25 @@ int __weak kgdb_arch_remove_breakpoint(unsigned long addr, char *bundle)
                                  (char *)bundle, BREAK_INSTR_SIZE);
 }
 
+int __weak kgdb_validate_break_address(unsigned long addr)
+{
+       char tmp_variable[BREAK_INSTR_SIZE];
+       int err;
+       /* Validate setting the breakpoint and then removing it.  In the
+        * remove fails, the kernel needs to emit a bad message because we
+        * are deep trouble not being able to put things back the way we
+        * found them.
+        */
+       err = kgdb_arch_set_breakpoint(addr, tmp_variable);
+       if (err)
+               return err;
+       err = kgdb_arch_remove_breakpoint(addr, tmp_variable);
+       if (err)
+               printk(KERN_ERR "KGDB: Critical breakpoint error, kernel "
+                  "memory destroyed at: %lx", addr);
+       return err;
+}
+
 unsigned long __weak kgdb_arch_pc(int exception, struct pt_regs *regs)
 {
        return instruction_pointer(regs);
@@ -433,9 +447,14 @@ int kgdb_hex2long(char **ptr, unsigned long *long_val)
 {
        int hex_val;
        int num = 0;
+       int negate = 0;
 
        *long_val = 0;
 
+       if (**ptr == '-') {
+               negate = 1;
+               (*ptr)++;
+       }
        while (**ptr) {
                hex_val = hex(**ptr);
                if (hex_val < 0)
@@ -446,6 +465,9 @@ int kgdb_hex2long(char **ptr, unsigned long *long_val)
                (*ptr)++;
        }
 
+       if (negate)
+               *long_val = -*long_val;
+
        return num;
 }
 
@@ -515,10 +537,16 @@ static void int_to_threadref(unsigned char *id, int value)
 static struct task_struct *getthread(struct pt_regs *regs, int tid)
 {
        /*
-        * Non-positive TIDs are remapped idle tasks:
+        * Non-positive TIDs are remapped to the cpu shadow information
         */
-       if (tid <= 0)
-               return idle_task(-tid);
+       if (tid == 0 || tid == -1)
+               tid = -atomic_read(&kgdb_active) - 2;
+       if (tid < 0) {
+               if (kgdb_info[-tid - 2].task)
+                       return kgdb_info[-tid - 2].task;
+               else
+                       return idle_task(-tid - 2);
+       }
 
        /*
         * find_task_by_pid_ns() does not take the tasklist lock anymore
@@ -725,14 +753,15 @@ setundefined:
 }
 
 /*
- * Remap normal tasks to their real PID, idle tasks to -1 ... -NR_CPUs:
+ * Remap normal tasks to their real PID,
+ * CPU shadow threads are mapped to -CPU - 2
  */
 static inline int shadow_pid(int realpid)
 {
        if (realpid)
                return realpid;
 
-       return -1-raw_smp_processor_id();
+       return -raw_smp_processor_id() - 2;
 }
 
 static char gdbmsgbuf[BUFMAX + 1];
@@ -826,7 +855,7 @@ static void gdb_cmd_getregs(struct kgdb_state *ks)
                local_debuggerinfo = kgdb_info[ks->cpu].debuggerinfo;
        } else {
                local_debuggerinfo = NULL;
-               for (i = 0; i < NR_CPUS; i++) {
+               for_each_online_cpu(i) {
                        /*
                         * Try to find the task on some other
                         * or possibly this node if we do not
@@ -960,10 +989,13 @@ static int gdb_cmd_reboot(struct kgdb_state *ks)
 /* Handle the 'q' query packets */
 static void gdb_cmd_query(struct kgdb_state *ks)
 {
-       struct task_struct *thread;
+       struct task_struct *g;
+       struct task_struct *p;
        unsigned char thref[8];
        char *ptr;
        int i;
+       int cpu;
+       int finished = 0;
 
        switch (remcom_in_buffer[1]) {
        case 's':
@@ -973,22 +1005,34 @@ static void gdb_cmd_query(struct kgdb_state *ks)
                        break;
                }
 
-               if (remcom_in_buffer[1] == 'f')
-                       ks->threadid = 1;
-
+               i = 0;
                remcom_out_buffer[0] = 'm';
                ptr = remcom_out_buffer + 1;
-
-               for (i = 0; i < 17; ks->threadid++) {
-                       thread = getthread(ks->linux_regs, ks->threadid);
-                       if (thread) {
-                               int_to_threadref(thref, ks->threadid);
+               if (remcom_in_buffer[1] == 'f') {
+                       /* Each cpu is a shadow thread */
+                       for_each_online_cpu(cpu) {
+                               ks->thr_query = 0;
+                               int_to_threadref(thref, -cpu - 2);
                                pack_threadid(ptr, thref);
                                ptr += BUF_THREAD_ID_SIZE;
                                *(ptr++) = ',';
                                i++;
                        }
                }
+
+               do_each_thread(g, p) {
+                       if (i >= ks->thr_query && !finished) {
+                               int_to_threadref(thref, p->pid);
+                               pack_threadid(ptr, thref);
+                               ptr += BUF_THREAD_ID_SIZE;
+                               *(ptr++) = ',';
+                               ks->thr_query++;
+                               if (ks->thr_query % KGDB_MAX_THREAD_QUERY == 0)
+                                       finished = 1;
+                       }
+                       i++;
+               } while_each_thread(g, p);
+
                *(--ptr) = '\0';
                break;
 
@@ -1011,15 +1055,15 @@ static void gdb_cmd_query(struct kgdb_state *ks)
                        error_packet(remcom_out_buffer, -EINVAL);
                        break;
                }
-               if (ks->threadid > 0) {
+               if ((int)ks->threadid > 0) {
                        kgdb_mem2hex(getthread(ks->linux_regs,
                                        ks->threadid)->comm,
                                        remcom_out_buffer, 16);
                } else {
                        static char tmpstr[23 + BUF_THREAD_ID_SIZE];
 
-                       sprintf(tmpstr, "Shadow task %d for pid 0",
-                                       (int)(-ks->threadid-1));
+                       sprintf(tmpstr, "shadowCPU%d",
+                                       (int)(-ks->threadid - 2));
                        kgdb_mem2hex(tmpstr, remcom_out_buffer, strlen(tmpstr));
                }
                break;
index 971da53..7d1faec 100644 (file)
@@ -125,6 +125,11 @@ void marker_probe_cb(const struct marker *mdata, void *call_private, ...)
        } else {
                struct marker_probe_closure *multi;
                int i;
+               /*
+                * Read mdata->ptype before mdata->multi.
+                */
+               smp_rmb();
+               multi = mdata->multi;
                /*
                 * multi points to an array, therefore accessing the array
                 * depends on reading multi. However, even in this case,
@@ -133,7 +138,6 @@ void marker_probe_cb(const struct marker *mdata, void *call_private, ...)
                 * in the fast path, so put the explicit barrier here.
                 */
                smp_read_barrier_depends();
-               multi = mdata->multi;
                for (i = 0; multi[i].func; i++) {
                        va_start(args, call_private);
                        multi[i].func(multi[i].probe_private, call_private,
@@ -174,6 +178,11 @@ void marker_probe_cb_noarg(const struct marker *mdata, void *call_private, ...)
        } else {
                struct marker_probe_closure *multi;
                int i;
+               /*
+                * Read mdata->ptype before mdata->multi.
+                */
+               smp_rmb();
+               multi = mdata->multi;
                /*
                 * multi points to an array, therefore accessing the array
                 * depends on reading multi. However, even in this case,
@@ -182,7 +191,6 @@ void marker_probe_cb_noarg(const struct marker *mdata, void *call_private, ...)
                 * in the fast path, so put the explicit barrier here.
                 */
                smp_read_barrier_depends();
-               multi = mdata->multi;
                for (i = 0; multi[i].func; i++)
                        multi[i].func(multi[i].probe_private, call_private,
                                mdata->format, &args);
index bcdc9ac..12c779d 100644 (file)
@@ -34,6 +34,7 @@
 /***
  * mutex_init - initialize the mutex
  * @lock: the mutex to be initialized
+ * @key: the lock_class_key for the class; used by mutex lock debugging
  *
  * Initialize the mutex to unlocked state.
  *
index 8cb7570..da9c2dd 100644 (file)
@@ -24,7 +24,7 @@
  * requirement that the application has is cleaned up when closes the file
  * pointer or exits the pm_qos_object will get an opportunity to clean up.
  *
- * mark gross mgross@linux.intel.com
+ * Mark Gross <mgross@linux.intel.com>
  */
 
 #include <linux/pm_qos_params.h>
@@ -211,8 +211,8 @@ EXPORT_SYMBOL_GPL(pm_qos_requirement);
  * @value: defines the qos request
  *
  * This function inserts a new entry in the pm_qos_class list of requested qos
- * performance charactoistics.  It recomputes the agregate QoS expectations for
- * the pm_qos_class of parrameters.
+ * performance characteristics.  It recomputes the aggregate QoS expectations
+ * for the pm_qos_class of parameters.
  */
 int pm_qos_add_requirement(int pm_qos_class, char *name, s32 value)
 {
@@ -250,10 +250,10 @@ EXPORT_SYMBOL_GPL(pm_qos_add_requirement);
  * @name: identifies the request
  * @value: defines the qos request
  *
- * Updates an existing qos requierement for the pm_qos_class of parameters along
+ * Updates an existing qos requirement for the pm_qos_class of parameters along
  * with updating the target pm_qos_class value.
  *
- * If the named request isn't in the lest then no change is made.
+ * If the named request isn't in the list then no change is made.
  */
 int pm_qos_update_requirement(int pm_qos_class, char *name, s32 new_value)
 {
@@ -287,7 +287,7 @@ EXPORT_SYMBOL_GPL(pm_qos_update_requirement);
  * @pm_qos_class: identifies which list of qos request to us
  * @name: identifies the request
  *
- * Will remove named qos request from pm_qos_class list of parrameters and
+ * Will remove named qos request from pm_qos_class list of parameters and
  * recompute the current target value for the pm_qos_class.
  */
 void pm_qos_remove_requirement(int pm_qos_class, char *name)
@@ -319,7 +319,7 @@ EXPORT_SYMBOL_GPL(pm_qos_remove_requirement);
  * @notifier: notifier block managed by caller.
  *
  * will register the notifier into a notification chain that gets called
- * uppon changes to the pm_qos_class target value.
+ * upon changes to the pm_qos_class target value.
  */
  int pm_qos_add_notifier(int pm_qos_class, struct notifier_block *notifier)
 {
@@ -338,7 +338,7 @@ EXPORT_SYMBOL_GPL(pm_qos_add_notifier);
  * @notifier: notifier block to be removed.
  *
  * will remove the notifier from the notification chain that gets called
- * uppon changes to the pm_qos_class target value.
+ * upon changes to the pm_qos_class target value.
  */
 int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier)
 {
index a7f7559..b51b156 100644 (file)
@@ -1309,14 +1309,14 @@ void tty_write_message(struct tty_struct *tty, char *msg)
 
 #if defined CONFIG_PRINTK
 
-DEFINE_RATELIMIT_STATE(printk_ratelimit_state, 5 * HZ, 10);
 /*
  * printk rate limiting, lifted from the networking subsystem.
  *
- * This enforces a rate limit: not more than one kernel message
- * every printk_ratelimit_jiffies to make a denial-of-service
- * attack impossible.
+ * This enforces a rate limit: not more than 10 kernel messages
+ * every 5s to make a denial-of-service attack impossible.
  */
+DEFINE_RATELIMIT_STATE(printk_ratelimit_state, 5 * HZ, 10);
+
 int printk_ratelimit(void)
 {
        return __ratelimit(&printk_ratelimit_state);
index 04006ef..8d13a78 100644 (file)
@@ -944,6 +944,10 @@ static void relay_file_read_consume(struct rchan_buf *buf,
        size_t n_subbufs = buf->chan->n_subbufs;
        size_t read_subbuf;
 
+       if (buf->subbufs_produced == buf->subbufs_consumed &&
+           buf->offset == buf->bytes_consumed)
+               return;
+
        if (buf->bytes_consumed + bytes_consumed > subbuf_size) {
                relay_subbufs_consumed(buf->chan, buf->cpu, 1);
                buf->bytes_consumed = 0;
@@ -975,6 +979,8 @@ static int relay_file_read_avail(struct rchan_buf *buf, size_t read_pos)
 
        relay_file_read_consume(buf, read_pos, 0);
 
+       consumed = buf->subbufs_consumed;
+
        if (unlikely(buf->offset > subbuf_size)) {
                if (produced == consumed)
                        return 0;
@@ -993,8 +999,12 @@ static int relay_file_read_avail(struct rchan_buf *buf, size_t read_pos)
        if (consumed > produced)
                produced += n_subbufs * subbuf_size;
 
-       if (consumed == produced)
+       if (consumed == produced) {
+               if (buf->offset == subbuf_size &&
+                   buf->subbufs_produced > buf->subbufs_consumed)
+                       return 1;
                return 0;
+       }
 
        return 1;
 }
index 74af2d7..f5b518e 100644 (file)
@@ -490,7 +490,7 @@ resource_size_t resource_alignment(struct resource *res)
 {
        switch (res->flags & (IORESOURCE_SIZEALIGN | IORESOURCE_STARTALIGN)) {
        case IORESOURCE_SIZEALIGN:
-               return res->end - res->start + 1;
+               return resource_size(res);
        case IORESOURCE_STARTALIGN:
                return res->start;
        default:
index 0236958..04160d2 100644 (file)
@@ -5004,19 +5004,21 @@ recheck:
                        return -EPERM;
        }
 
+       if (user) {
 #ifdef CONFIG_RT_GROUP_SCHED
-       /*
-        * Do not allow realtime tasks into groups that have no runtime
-        * assigned.
-        */
-       if (user
-           && rt_policy(policy) && task_group(p)->rt_bandwidth.rt_runtime == 0)
-               return -EPERM;
+               /*
+                * Do not allow realtime tasks into groups that have no runtime
+                * assigned.
+                */
+               if (rt_policy(policy) && task_group(p)->rt_bandwidth.rt_runtime == 0)
+                       return -EPERM;
 #endif
 
-       retval = security_task_setscheduler(p, policy, param);
-       if (retval)
-               return retval;
+               retval = security_task_setscheduler(p, policy, param);
+               if (retval)
+                       return retval;
+       }
+
        /*
         * make sure no PI-waiters arrive (or leave) while we are
         * changing the priority of the task:
@@ -7671,34 +7673,34 @@ static ssize_t sched_power_savings_store(const char *buf, size_t count, int smt)
 }
 
 #ifdef CONFIG_SCHED_MC
-static ssize_t sched_mc_power_savings_show(struct sys_device *dev,
-                               struct sysdev_attribute *attr, char *page)
+static ssize_t sched_mc_power_savings_show(struct sysdev_class *class,
+                                          char *page)
 {
        return sprintf(page, "%u\n", sched_mc_power_savings);
 }
-static ssize_t sched_mc_power_savings_store(struct sys_device *dev,
-                                           struct sysdev_attribute *attr,
+static ssize_t sched_mc_power_savings_store(struct sysdev_class *class,
                                            const char *buf, size_t count)
 {
        return sched_power_savings_store(buf, count, 0);
 }
-static SYSDEV_ATTR(sched_mc_power_savings, 0644, sched_mc_power_savings_show,
-                  sched_mc_power_savings_store);
+static SYSDEV_CLASS_ATTR(sched_mc_power_savings, 0644,
+                        sched_mc_power_savings_show,
+                        sched_mc_power_savings_store);
 #endif
 
 #ifdef CONFIG_SCHED_SMT
-static ssize_t sched_smt_power_savings_show(struct sys_device *dev,
-                               struct sysdev_attribute *attr, char *page)
+static ssize_t sched_smt_power_savings_show(struct sysdev_class *dev,
+                                           char *page)
 {
        return sprintf(page, "%u\n", sched_smt_power_savings);
 }
-static ssize_t sched_smt_power_savings_store(struct sys_device *dev,
-                                            struct sysdev_attribute *attr,
+static ssize_t sched_smt_power_savings_store(struct sysdev_class *dev,
                                             const char *buf, size_t count)
 {
        return sched_power_savings_store(buf, count, 1);
 }
-static SYSDEV_ATTR(sched_smt_power_savings, 0644, sched_smt_power_savings_show,
+static SYSDEV_CLASS_ATTR(sched_smt_power_savings, 0644,
+                  sched_smt_power_savings_show,
                   sched_smt_power_savings_store);
 #endif
 
index aaaeae8..94a62c0 100644 (file)
@@ -212,9 +212,7 @@ static inline int __sched __down_common(struct semaphore *sem, long state,
        waiter.up = 0;
 
        for (;;) {
-               if (state == TASK_INTERRUPTIBLE && signal_pending(task))
-                       goto interrupted;
-               if (state == TASK_KILLABLE && fatal_signal_pending(task))
+               if (signal_pending_state(state, task))
                        goto interrupted;
                if (timeout <= 0)
                        goto timed_out;
index ec7e4f6..4a26a13 100644 (file)
@@ -830,10 +830,21 @@ struct workqueue_struct *__create_workqueue_key(const char *name,
                start_workqueue_thread(cwq, -1);
        } else {
                cpu_maps_update_begin();
+               /*
+                * We must place this wq on list even if the code below fails.
+                * cpu_down(cpu) can remove cpu from cpu_populated_map before
+                * destroy_workqueue() takes the lock, in that case we leak
+                * cwq[cpu]->thread.
+                */
                spin_lock(&workqueue_lock);
                list_add(&wq->list, &workqueues);
                spin_unlock(&workqueue_lock);
-
+               /*
+                * We must initialize cwqs for each possible cpu even if we
+                * are going to call destroy_workqueue() finally. Otherwise
+                * cpu_up() can hit the uninitialized cwq once we drop the
+                * lock.
+                */
                for_each_possible_cpu(cpu) {
                        cwq = init_cpu_workqueue(wq, cpu);
                        if (err || !cpu_online(cpu))
index 2cfd272..9b5d1d7 100644 (file)
@@ -4,14 +4,17 @@ config HAVE_ARCH_KGDB
 
 menuconfig KGDB
        bool "KGDB: kernel debugging with remote gdb"
-       select FRAME_POINTER
        depends on HAVE_ARCH_KGDB
        depends on DEBUG_KERNEL && EXPERIMENTAL
        help
          If you say Y here, it will be possible to remotely debug the
-         kernel using gdb.  Documentation of kernel debugger is available
-         at http://kgdb.sourceforge.net as well as in DocBook form
-         in Documentation/DocBook/.  If unsure, say N.
+         kernel using gdb.  It is recommended but not required, that
+         you also turn on the kernel config option
+         CONFIG_FRAME_POINTER to aid in producing more reliable stack
+         backtraces in the external debugger.  Documentation of
+         kernel debugger is available at http://kgdb.sourceforge.net
+         as well as in DocBook form in Documentation/DocBook/.  If
+         unsure, say N.
 
 if KGDB
 
index 889ddce..a3b8d4c 100644 (file)
@@ -80,11 +80,3 @@ void iommu_area_free(unsigned long *map, unsigned long start, unsigned int nr)
        }
 }
 EXPORT_SYMBOL(iommu_area_free);
-
-unsigned long iommu_num_pages(unsigned long addr, unsigned long len)
-{
-       unsigned long size = roundup((addr & ~PAGE_MASK) + len, PAGE_SIZE);
-
-       return size >> PAGE_SHIFT;
-}
-EXPORT_SYMBOL(iommu_num_pages);
index ca87d86..217d5c4 100644 (file)
@@ -56,23 +56,12 @@ static u32 __random32(struct rnd_state *state)
        return (state->s1 ^ state->s2 ^ state->s3);
 }
 
-static void __set_random32(struct rnd_state *state, unsigned long s)
+/*
+ * Handle minimum values for seeds
+ */
+static inline u32 __seed(u32 x, u32 m)
 {
-       if (s == 0)
-               s = 1;      /* default seed is 1 */
-
-#define LCG(n) (69069 * n)
-       state->s1 = LCG(s);
-       state->s2 = LCG(state->s1);
-       state->s3 = LCG(state->s2);
-
-       /* "warm it up" */
-       __random32(state);
-       __random32(state);
-       __random32(state);
-       __random32(state);
-       __random32(state);
-       __random32(state);
+       return (x < m) ? x + m : x;
 }
 
 /**
@@ -107,7 +96,7 @@ void srandom32(u32 entropy)
         */
        for_each_possible_cpu (i) {
                struct rnd_state *state = &per_cpu(net_rand_state, i);
-               __set_random32(state, state->s1 ^ entropy);
+               state->s1 = __seed(state->s1 ^ entropy, 1);
        }
 }
 EXPORT_SYMBOL(srandom32);
@@ -122,7 +111,19 @@ static int __init random32_init(void)
 
        for_each_possible_cpu(i) {
                struct rnd_state *state = &per_cpu(net_rand_state,i);
-               __set_random32(state, i + jiffies);
+
+#define LCG(x) ((x) * 69069)   /* super-duper LCG */
+               state->s1 = __seed(LCG(i + jiffies), 1);
+               state->s2 = __seed(LCG(state->s1), 7);
+               state->s3 = __seed(LCG(state->s2), 15);
+
+               /* "warm it up" */
+               __random32(state);
+               __random32(state);
+               __random32(state);
+               __random32(state);
+               __random32(state);
+               __random32(state);
        }
        return 0;
 }
@@ -135,13 +136,18 @@ core_initcall(random32_init);
 static int __init random32_reseed(void)
 {
        int i;
-       unsigned long seed;
 
        for_each_possible_cpu(i) {
                struct rnd_state *state = &per_cpu(net_rand_state,i);
+               u32 seeds[3];
+
+               get_random_bytes(&seeds, sizeof(seeds));
+               state->s1 = __seed(seeds[0], 1);
+               state->s2 = __seed(seeds[1], 7);
+               state->s3 = __seed(seeds[2], 15);
 
-               get_random_bytes(&seed, sizeof(seed));
-               __set_random32(state, seed);
+               /* mix it in */
+               __random32(state);
        }
        return 0;
 }
index 42bbc69..54e9686 100644 (file)
@@ -558,14 +558,14 @@ EXPORT_SYMBOL(wait_on_page_bit);
  * But that's OK - sleepers in wait_on_page_writeback() just go back to sleep.
  *
  * The first mb is necessary to safely close the critical section opened by the
- * TestSetPageLocked(), the second mb is necessary to enforce ordering between
- * the clear_bit and the read of the waitqueue (to avoid SMP races with a
- * parallel wait_on_page_locked()).
+ * test_and_set_bit() to lock the page; the second mb is necessary to enforce
+ * ordering between the clear_bit and the read of the waitqueue (to avoid SMP
+ * races with a parallel wait_on_page_locked()).
  */
 void unlock_page(struct page *page)
 {
        smp_mb__before_clear_bit();
-       if (!TestClearPageLocked(page))
+       if (!test_and_clear_bit(PG_locked, &page->flags))
                BUG();
        smp_mb__after_clear_bit(); 
        wake_up_page(page, PG_locked);
@@ -931,7 +931,7 @@ grab_cache_page_nowait(struct address_space *mapping, pgoff_t index)
        struct page *page = find_get_page(mapping, index);
 
        if (page) {
-               if (!TestSetPageLocked(page))
+               if (trylock_page(page))
                        return page;
                page_cache_release(page);
                return NULL;
@@ -1027,7 +1027,7 @@ find_page:
                        if (inode->i_blkbits == PAGE_CACHE_SHIFT ||
                                        !mapping->a_ops->is_partially_uptodate)
                                goto page_not_up_to_date;
-                       if (TestSetPageLocked(page))
+                       if (!trylock_page(page))
                                goto page_not_up_to_date;
                        if (!mapping->a_ops->is_partially_uptodate(page,
                                                                desc, offset))
@@ -1879,7 +1879,7 @@ void iov_iter_advance(struct iov_iter *i, size_t bytes)
                 * The !iov->iov_len check ensures we skip over unlikely
                 * zero-length segments (without overruning the iovec).
                 */
-               while (bytes || unlikely(!iov->iov_len && i->count)) {
+               while (bytes || unlikely(i->count && !iov->iov_len)) {
                        int copy;
 
                        copy = min(bytes, iov->iov_len - base);
index 254ce2b..757ca98 100644 (file)
@@ -1283,7 +1283,12 @@ module_exit(hugetlb_exit);
 
 static int __init hugetlb_init(void)
 {
-       BUILD_BUG_ON(HPAGE_SHIFT == 0);
+       /* Some platform decide whether they support huge pages at boot
+        * time. On these, such as powerpc, HPAGE_SHIFT is set to 0 when
+        * there is no such support
+        */
+       if (HPAGE_SHIFT == 0)
+               return 0;
 
        if (!size_to_hstate(default_hstate_size)) {
                default_hstate_size = HPAGE_SIZE;
index 23a0ec3..f9349c1 100644 (file)
@@ -132,10 +132,10 @@ static long madvise_willneed(struct vm_area_struct * vma,
  * Application no longer needs these pages.  If the pages are dirty,
  * it's OK to just throw them away.  The app will be more careful about
  * data it wants to keep.  Be sure to free swap resources too.  The
- * zap_page_range call sets things up for refill_inactive to actually free
+ * zap_page_range call sets things up for shrink_active_list to actually free
  * these pages later if no one else has touched them in the meantime,
  * although we could add these pages to a global reuse list for
- * refill_inactive to pick up before reclaiming other pages.
+ * shrink_active_list to pick up before reclaiming other pages.
  *
  * NB: This interface discards data rather than pushes it out to swap,
  * as some implementations do.  This has performance implications for
index fba566c..7056c3b 100644 (file)
@@ -1168,9 +1168,6 @@ static void mem_cgroup_move_task(struct cgroup_subsys *ss,
        mem = mem_cgroup_from_cont(cont);
        old_mem = mem_cgroup_from_cont(old_cont);
 
-       if (mem == old_mem)
-               goto out;
-
        /*
         * Only thread group leaders are allowed to migrate, the mm_struct is
         * in effect owned by the leader
index 67f0ab9..1002f47 100644 (file)
@@ -994,6 +994,29 @@ unsigned long zap_page_range(struct vm_area_struct *vma, unsigned long address,
        return end;
 }
 
+/**
+ * zap_vma_ptes - remove ptes mapping the vma
+ * @vma: vm_area_struct holding ptes to be zapped
+ * @address: starting address of pages to zap
+ * @size: number of bytes to zap
+ *
+ * This function only unmaps ptes assigned to VM_PFNMAP vmas.
+ *
+ * The entire address range must be fully contained within the vma.
+ *
+ * Returns 0 if successful.
+ */
+int zap_vma_ptes(struct vm_area_struct *vma, unsigned long address,
+               unsigned long size)
+{
+       if (address < vma->vm_start || address + size > vma->vm_end ||
+                       !(vma->vm_flags & VM_PFNMAP))
+               return -1;
+       zap_page_range(vma, address, size, NULL);
+       return 0;
+}
+EXPORT_SYMBOL_GPL(zap_vma_ptes);
+
 /*
  * Do a quick page-table lookup for a single page.
  */
@@ -1766,7 +1789,7 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
         * not dirty accountable.
         */
        if (PageAnon(old_page)) {
-               if (!TestSetPageLocked(old_page)) {
+               if (trylock_page(old_page)) {
                        reuse = can_share_swap_page(old_page);
                        unlock_page(old_page);
                }
@@ -2742,16 +2765,26 @@ int make_pages_present(unsigned long addr, unsigned long end)
 
        vma = find_vma(current->mm, addr);
        if (!vma)
-               return -1;
+               return -ENOMEM;
        write = (vma->vm_flags & VM_WRITE) != 0;
        BUG_ON(addr >= end);
        BUG_ON(end > vma->vm_end);
        len = DIV_ROUND_UP(end, PAGE_SIZE) - addr/PAGE_SIZE;
        ret = get_user_pages(current, current->mm, addr,
                        len, write, 0, NULL, NULL);
-       if (ret < 0)
+       if (ret < 0) {
+               /*
+                  SUS require strange return value to mlock
+                   - invalid addr generate to ENOMEM.
+                   - out of memory should generate EAGAIN.
+               */
+               if (ret == -EFAULT)
+                       ret = -ENOMEM;
+               else if (ret == -ENOMEM)
+                       ret = -EAGAIN;
                return ret;
-       return ret == len ? 0 : -1;
+       }
+       return ret == len ? 0 : -ENOMEM;
 }
 
 #if !defined(__HAVE_ARCH_GATE_AREA)
index 153572f..2a80136 100644 (file)
@@ -605,7 +605,7 @@ static int move_to_new_page(struct page *newpage, struct page *page)
         * establishing additional references. We are the only one
         * holding a reference to the new page at this point.
         */
-       if (TestSetPageLocked(newpage))
+       if (!trylock_page(newpage))
                BUG();
 
        /* Prepare mapping for the new page.*/
@@ -667,7 +667,7 @@ static int unmap_and_move(new_page_t get_new_page, unsigned long private,
        BUG_ON(charge);
 
        rc = -EAGAIN;
-       if (TestSetPageLocked(page)) {
+       if (!trylock_page(page)) {
                if (!force)
                        goto move_newpage;
                lock_page(page);
index 7b26560..01fbe93 100644 (file)
@@ -78,8 +78,6 @@ success:
 
        mm->locked_vm -= pages;
 out:
-       if (ret == -ENOMEM)
-               ret = -EAGAIN;
        return ret;
 }
 
index c6af41e..936ef2e 100644 (file)
 #ifdef CONFIG_DEBUG_MEMORY_INIT
 int __meminitdata mminit_loglevel;
 
+#ifndef SECTIONS_SHIFT
+#define SECTIONS_SHIFT 0
+#endif
+
 /* The zonelists are simply reported, validation is manual. */
 void mminit_verify_zonelist(void)
 {
@@ -74,11 +78,7 @@ void __init mminit_verify_pageflags_layout(void)
                NR_PAGEFLAGS);
        mminit_dprintk(MMINIT_TRACE, "pageflags_layout_shifts",
                "Section %d Node %d Zone %d\n",
-#ifdef SECTIONS_SHIFT
                SECTIONS_SHIFT,
-#else
-               0,
-#endif
                NODES_SHIFT,
                ZONES_SHIFT);
        mminit_dprintk(MMINIT_TRACE, "pageflags_layout_offsets",
index 245c3d6..971d0ed 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -370,7 +370,7 @@ find_vma_prepare(struct mm_struct *mm, unsigned long addr,
                if (vma_tmp->vm_end > addr) {
                        vma = vma_tmp;
                        if (vma_tmp->vm_start <= addr)
-                               return vma;
+                               break;
                        __rb_link = &__rb_parent->rb_left;
                } else {
                        rb_prev = __rb_parent;
index 5edccd9..ed75bc9 100644 (file)
@@ -266,6 +266,27 @@ void *vmalloc_node(unsigned long size, int node)
 }
 EXPORT_SYMBOL(vmalloc_node);
 
+#ifndef PAGE_KERNEL_EXEC
+# define PAGE_KERNEL_EXEC PAGE_KERNEL
+#endif
+
+/**
+ *     vmalloc_exec  -  allocate virtually contiguous, executable memory
+ *     @size:          allocation size
+ *
+ *     Kernel-internal function to allocate enough pages to cover @size
+ *     the page level allocator and map them into contiguous and
+ *     executable kernel virtual space.
+ *
+ *     For tight control over page level allocator and protection flags
+ *     use __vmalloc() instead.
+ */
+
+void *vmalloc_exec(unsigned long size)
+{
+       return __vmalloc(size, GFP_KERNEL | __GFP_HIGHMEM, PAGE_KERNEL_EXEC);
+}
+
 /**
  * vmalloc_32  -  allocate virtually contiguous memory (32bit addressable)
  *     @size:          allocation size
index 3cf3d05..401d104 100644 (file)
@@ -3753,23 +3753,6 @@ unsigned long __init find_min_pfn_with_active_regions(void)
        return find_min_pfn_for_node(MAX_NUMNODES);
 }
 
-/**
- * find_max_pfn_with_active_regions - Find the maximum PFN registered
- *
- * It returns the maximum PFN based on information provided via
- * add_active_range().
- */
-unsigned long __init find_max_pfn_with_active_regions(void)
-{
-       int i;
-       unsigned long max_pfn = 0;
-
-       for (i = 0; i < nr_nodemap_entries; i++)
-               max_pfn = max(max_pfn, early_node_map[i].end_pfn);
-
-       return max_pfn;
-}
-
 /*
  * early_calculate_totalpages()
  * Sum pages in active regions for movable zone.
index 99bc3f9..1ea4e6f 100644 (file)
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -422,7 +422,7 @@ int page_referenced(struct page *page, int is_locked,
                        referenced += page_referenced_anon(page, mem_cont);
                else if (is_locked)
                        referenced += page_referenced_file(page, mem_cont);
-               else if (TestSetPageLocked(page))
+               else if (!trylock_page(page))
                        referenced++;
                else {
                        if (page->mapping)
@@ -667,7 +667,8 @@ void page_remove_rmap(struct page *page, struct vm_area_struct *vma)
                 * Leaving it set also helps swapoff to reinstate ptes
                 * faster for those pages still in swapcache.
                 */
-               if (page_test_dirty(page)) {
+               if ((!PageAnon(page) || PageSwapCache(page)) &&
+                   page_test_dirty(page)) {
                        page_clear_dirty(page);
                        set_page_dirty(page);
                }
index c1e5a3b..04fb4f1 100644 (file)
@@ -1265,7 +1265,7 @@ repeat:
                }
 
                /* We have to do this with page locked to prevent races */
-               if (TestSetPageLocked(swappage)) {
+               if (!trylock_page(swappage)) {
                        shmem_swp_unmap(entry);
                        spin_unlock(&info->lock);
                        wait_on_page_locked(swappage);
@@ -1329,7 +1329,7 @@ repeat:
                shmem_swp_unmap(entry);
                filepage = find_get_page(mapping, idx);
                if (filepage &&
-                   (!PageUptodate(filepage) || TestSetPageLocked(filepage))) {
+                   (!PageUptodate(filepage) || !trylock_page(filepage))) {
                        spin_unlock(&info->lock);
                        wait_on_page_locked(filepage);
                        page_cache_release(filepage);
index dd89234..9e0cb31 100644 (file)
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -278,9 +278,10 @@ int lru_add_drain_all(void)
  * Avoid taking zone->lru_lock if possible, but if it is taken, retain it
  * for the remainder of the operation.
  *
- * The locking in this function is against shrink_cache(): we recheck the
- * page count inside the lock to see whether shrink_cache grabbed the page
- * via the LRU.  If it did, give up: shrink_cache will free it.
+ * The locking in this function is against shrink_inactive_list(): we recheck
+ * the page count inside the lock to see whether shrink_inactive_list()
+ * grabbed the page via the LRU.  If it did, give up: shrink_inactive_list()
+ * will free it.
  */
 void release_pages(struct page **pages, int nr, int cold)
 {
@@ -443,7 +444,7 @@ void pagevec_strip(struct pagevec *pvec)
        for (i = 0; i < pagevec_count(pvec); i++) {
                struct page *page = pvec->pages[i];
 
-               if (PagePrivate(page) && !TestSetPageLocked(page)) {
+               if (PagePrivate(page) && trylock_page(page)) {
                        if (PagePrivate(page))
                                try_to_release_page(page, 0);
                        unlock_page(page);
index b8035b0..167cf2d 100644 (file)
@@ -201,7 +201,7 @@ void delete_from_swap_cache(struct page *page)
  */
 static inline void free_swap_cache(struct page *page)
 {
-       if (PageSwapCache(page) && !TestSetPageLocked(page)) {
+       if (PageSwapCache(page) && trylock_page(page)) {
                remove_exclusive_swap_page(page);
                unlock_page(page);
        }
@@ -302,9 +302,9 @@ struct page *read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask,
                 * re-using the just freed swap entry for an existing page.
                 * May fail (-ENOMEM) if radix-tree node allocation failed.
                 */
-               SetPageLocked(new_page);
+               set_page_locked(new_page);
                err = add_to_swap_cache(new_page, entry, gfp_mask & GFP_KERNEL);
-               if (!err) {
+               if (likely(!err)) {
                        /*
                         * Initiate read into locked page and return.
                         */
@@ -312,7 +312,7 @@ struct page *read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask,
                        swap_readpage(NULL, new_page);
                        return new_page;
                }
-               ClearPageLocked(new_page);
+               clear_page_locked(new_page);
                swap_free(entry);
        } while (err != -ENOMEM);
 
index 6beb625..1e330f2 100644 (file)
@@ -403,7 +403,7 @@ void free_swap_and_cache(swp_entry_t entry)
        if (p) {
                if (swap_entry_free(p, swp_offset(entry)) == 1) {
                        page = find_get_page(&swapper_space, entry.val);
-                       if (page && unlikely(TestSetPageLocked(page))) {
+                       if (page && unlikely(!trylock_page(page))) {
                                page_cache_release(page);
                                page = NULL;
                        }
@@ -656,8 +656,8 @@ static int unuse_mm(struct mm_struct *mm,
 
        if (!down_read_trylock(&mm->mmap_sem)) {
                /*
-                * Activate page so shrink_cache is unlikely to unmap its
-                * ptes while lock is dropped, so swapoff can make progress.
+                * Activate page so shrink_inactive_list is unlikely to unmap
+                * its ptes while lock is dropped, so swapoff can make progress.
                 */
                activate_page(page);
                unlock_page(page);
index e68443d..2505050 100644 (file)
@@ -104,7 +104,6 @@ truncate_complete_page(struct address_space *mapping, struct page *page)
        cancel_dirty_page(page, PAGE_CACHE_SIZE);
 
        remove_from_page_cache(page);
-       ClearPageUptodate(page);
        ClearPageMappedToDisk(page);
        page_cache_release(page);       /* pagecache ref */
 }
@@ -188,7 +187,7 @@ void truncate_inode_pages_range(struct address_space *mapping,
                        if (page_index > next)
                                next = page_index;
                        next++;
-                       if (TestSetPageLocked(page))
+                       if (!trylock_page(page))
                                continue;
                        if (PageWriteback(page)) {
                                unlock_page(page);
@@ -281,7 +280,7 @@ unsigned long __invalidate_mapping_pages(struct address_space *mapping,
                        pgoff_t index;
                        int lock_failed;
 
-                       lock_failed = TestSetPageLocked(page);
+                       lock_failed = !trylock_page(page);
 
                        /*
                         * We really shouldn't be looking at the ->index of an
@@ -356,7 +355,6 @@ invalidate_complete_page2(struct address_space *mapping, struct page *page)
        BUG_ON(PagePrivate(page));
        __remove_from_page_cache(page);
        spin_unlock_irq(&mapping->tree_lock);
-       ClearPageUptodate(page);
        page_cache_release(page);       /* pagecache ref */
        return 1;
 failed:
index 8f71761..1ff1a58 100644 (file)
@@ -496,7 +496,7 @@ static unsigned long shrink_page_list(struct list_head *page_list,
                page = lru_to_page(page_list);
                list_del(&page->lru);
 
-               if (TestSetPageLocked(page))
+               if (!trylock_page(page))
                        goto keep;
 
                VM_BUG_ON(PageActive(page));
@@ -582,7 +582,7 @@ static unsigned long shrink_page_list(struct list_head *page_list,
                                 * A synchronous write - probably a ramdisk.  Go
                                 * ahead and try to reclaim the page.
                                 */
-                               if (TestSetPageLocked(page))
+                               if (!trylock_page(page))
                                        goto keep;
                                if (PageDirty(page) || PageWriteback(page))
                                        goto keep_locked;
@@ -1408,7 +1408,7 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
                if (sc->nr_scanned && priority < DEF_PRIORITY - 2)
                        congestion_wait(WRITE, HZ/10);
        }
-       /* top priority shrink_caches still had more to do? don't OOM, then */
+       /* top priority shrink_zones still had more to do? don't OOM, then */
        if (!sc->all_unreclaimable && scan_global_lru(sc))
                ret = nr_reclaimed;
 out:
@@ -1979,7 +1979,7 @@ module_init(kswapd_init)
 int zone_reclaim_mode __read_mostly;
 
 #define RECLAIM_OFF 0
-#define RECLAIM_ZONE (1<<0)    /* Run shrink_cache on the zone */
+#define RECLAIM_ZONE (1<<0)    /* Run shrink_inactive_list on the zone */
 #define RECLAIM_WRITE (1<<1)   /* Writeout pages during reclaim */
 #define RECLAIM_SWAP (1<<2)    /* Swap pages out during reclaim */
 
index b986687..7612cc8 100644 (file)
@@ -2,9 +2,7 @@
 # Network configuration
 #
 
-menu "Networking"
-
-config NET
+menuconfig NET
        bool "Networking support"
        ---help---
          Unless you really know what you are doing, you should say Y here.
@@ -22,7 +20,6 @@ config NET
          recommended to read the NET-HOWTO, available from
          <http://www.tldp.org/docs.html#howto>.
 
-# Make sure that all config symbols are dependent on NET
 if NET
 
 menu "Networking options"
@@ -252,5 +249,3 @@ source "net/rfkill/Kconfig"
 source "net/9p/Kconfig"
 
 endif   # if NET
-endmenu # Networking
-
index 4fccaa1..11b16d1 100644 (file)
@@ -62,11 +62,13 @@ static void MPOA_cache_impos_rcvd(struct k_message *msg, struct mpoa_client *mpc
 static void set_mpc_ctrl_addr_rcvd(struct k_message *mesg, struct mpoa_client *mpc);
 static void set_mps_mac_addr_rcvd(struct k_message *mesg, struct mpoa_client *mpc);
 
-static uint8_t *copy_macs(struct mpoa_client *mpc, uint8_t *router_mac,
-                         uint8_t *tlvs, uint8_t mps_macs, uint8_t device_type);
+static const uint8_t *copy_macs(struct mpoa_client *mpc,
+                               const uint8_t *router_mac,
+                               const uint8_t *tlvs, uint8_t mps_macs,
+                               uint8_t device_type);
 static void purge_egress_shortcut(struct atm_vcc *vcc, eg_cache_entry *entry);
 
-static void send_set_mps_ctrl_addr(char *addr, struct mpoa_client *mpc);
+static void send_set_mps_ctrl_addr(const char *addr, struct mpoa_client *mpc);
 static void mpoad_close(struct atm_vcc *vcc);
 static int msg_from_mpoad(struct atm_vcc *vcc, struct sk_buff *skb);
 
@@ -351,12 +353,12 @@ static const char *mpoa_device_type_string(char type)
  * lec sees a TLV it uses the pointer to call this function.
  *
  */
-static void lane2_assoc_ind(struct net_device *dev, uint8_t *mac_addr,
-                           uint8_t *tlvs, uint32_t sizeoftlvs)
+static void lane2_assoc_ind(struct net_device *dev, const u8 *mac_addr,
+                           const u8 *tlvs, u32 sizeoftlvs)
 {
        uint32_t type;
        uint8_t length, mpoa_device_type, number_of_mps_macs;
-       uint8_t *end_of_tlvs;
+       const uint8_t *end_of_tlvs;
        struct mpoa_client *mpc;
 
        mpoa_device_type = number_of_mps_macs = 0; /* silence gcc */
@@ -430,8 +432,10 @@ static void lane2_assoc_ind(struct net_device *dev, uint8_t *mac_addr,
  * plus the possible MAC address(es) to mpc->mps_macs.
  * For a freshly allocated MPOA client mpc->mps_macs == 0.
  */
-static uint8_t *copy_macs(struct mpoa_client *mpc, uint8_t *router_mac,
-                         uint8_t *tlvs, uint8_t mps_macs, uint8_t device_type)
+static const uint8_t *copy_macs(struct mpoa_client *mpc,
+                               const uint8_t *router_mac,
+                               const uint8_t *tlvs, uint8_t mps_macs,
+                               uint8_t device_type)
 {
        int num_macs;
        num_macs = (mps_macs > 1) ? mps_macs : 1;
@@ -811,7 +815,7 @@ static int atm_mpoa_mpoad_attach (struct atm_vcc *vcc, int arg)
        return arg;
 }
 
-static void send_set_mps_ctrl_addr(char *addr, struct mpoa_client *mpc)
+static void send_set_mps_ctrl_addr(const char *addr, struct mpoa_client *mpc)
 {
        struct k_message mesg;
 
index f597987..f288fc4 100644 (file)
@@ -36,6 +36,7 @@ static struct ctl_path ax25_path[] = {
        { .procname = "ax25", .ctl_name = NET_AX25, },
        { }
 };
+
 static const ctl_table ax25_param_table[] = {
        {
                .ctl_name       = NET_AX25_IP_DEFAULT_MODE,
@@ -167,6 +168,7 @@ static const ctl_table ax25_param_table[] = {
                .extra1         = &min_proto,
                .extra2         = &max_proto
        },
+#ifdef CONFIG_AX25_DAMA_SLAVE
        {
                .ctl_name       = NET_AX25_DAMA_SLAVE_TIMEOUT,
                .procname       = "dama_slave_timeout",
@@ -177,6 +179,8 @@ static const ctl_table ax25_param_table[] = {
                .extra1         = &min_ds_timeout,
                .extra2         = &max_ds_timeout
        },
+#endif
+
        { .ctl_name = 0 }       /* that's all, folks! */
 };
 
@@ -210,16 +214,6 @@ void ax25_register_sysctl(void)
                ax25_table[n].procname     = ax25_dev->dev->name;
                ax25_table[n].mode         = 0555;
 
-#ifndef CONFIG_AX25_DAMA_SLAVE
-               /*
-                * We do not wish to have a representation of this parameter
-                * in /proc/sys/ when configured *not* to include the
-                * AX.25 DAMA slave code, do we?
-                */
-
-               child[AX25_VALUES_DS_TIMEOUT].procname = NULL;
-#endif
-
                child[AX25_MAX_VALUES].ctl_name = 0;    /* just in case... */
 
                for (k = 0; k < AX25_MAX_VALUES; k++)
index d9449df..9b58d70 100644 (file)
@@ -68,10 +68,17 @@ static int br_dev_stop(struct net_device *dev)
 
 static int br_change_mtu(struct net_device *dev, int new_mtu)
 {
-       if (new_mtu < 68 || new_mtu > br_min_mtu(netdev_priv(dev)))
+       struct net_bridge *br = netdev_priv(dev);
+       if (new_mtu < 68 || new_mtu > br_min_mtu(br))
                return -EINVAL;
 
        dev->mtu = new_mtu;
+
+#ifdef CONFIG_BRIDGE_NETFILTER
+       /* remember the MTU in the rtable for PMTU */
+       br->fake_rtable.u.dst.metrics[RTAX_MTU - 1] = new_mtu;
+#endif
+
        return 0;
 }
 
index a072ea5..63c18aa 100644 (file)
@@ -202,6 +202,9 @@ static struct net_device *new_bridge_dev(const char *name)
        br->topology_change = 0;
        br->topology_change_detected = 0;
        br->ageing_time = 300 * HZ;
+
+       br_netfilter_rtable_init(br);
+
        INIT_LIST_HEAD(&br->age_list);
 
        br_stp_timer_init(br);
index bb90cd7..6a9a6cd 100644 (file)
@@ -101,33 +101,30 @@ static inline __be16 pppoe_proto(const struct sk_buff *skb)
         pppoe_proto(skb) == htons(PPP_IPV6) && \
         brnf_filter_pppoe_tagged)
 
-/* We need these fake structures to make netfilter happy --
- * lots of places assume that skb->dst != NULL, which isn't
- * all that unreasonable.
- *
+/*
+ * Initialize bogus route table used to keep netfilter happy.
  * Currently, we fill in the PMTU entry because netfilter
  * refragmentation needs it, and the rt_flags entry because
  * ipt_REJECT needs it.  Future netfilter modules might
- * require us to fill additional fields. */
-static struct net_device __fake_net_device = {
-       .hard_header_len        = ETH_HLEN,
-#ifdef CONFIG_NET_NS
-       .nd_net                 = &init_net,
-#endif
-};
+ * require us to fill additional fields.
+ */
+void br_netfilter_rtable_init(struct net_bridge *br)
+{
+       struct rtable *rt = &br->fake_rtable;
 
-static struct rtable __fake_rtable = {
-       .u = {
-               .dst = {
-                       .__refcnt               = ATOMIC_INIT(1),
-                       .dev                    = &__fake_net_device,
-                       .path                   = &__fake_rtable.u.dst,
-                       .metrics                = {[RTAX_MTU - 1] = 1500},
-                       .flags                  = DST_NOXFRM,
-               }
-       },
-       .rt_flags       = 0,
-};
+       atomic_set(&rt->u.dst.__refcnt, 1);
+       rt->u.dst.dev = br->dev;
+       rt->u.dst.path = &rt->u.dst;
+       rt->u.dst.metrics[RTAX_MTU - 1] = 1500;
+       rt->u.dst.flags = DST_NOXFRM;
+}
+
+static inline struct rtable *bridge_parent_rtable(const struct net_device *dev)
+{
+       struct net_bridge_port *port = rcu_dereference(dev->br_port);
+
+       return port ? &port->br->fake_rtable : NULL;
+}
 
 static inline struct net_device *bridge_parent(const struct net_device *dev)
 {
@@ -226,8 +223,12 @@ static int br_nf_pre_routing_finish_ipv6(struct sk_buff *skb)
        }
        nf_bridge->mask ^= BRNF_NF_BRIDGE_PREROUTING;
 
-       skb->rtable = &__fake_rtable;
-       dst_hold(&__fake_rtable.u.dst);
+       skb->rtable = bridge_parent_rtable(nf_bridge->physindev);
+       if (!skb->rtable) {
+               kfree_skb(skb);
+               return 0;
+       }
+       dst_hold(&skb->rtable->u.dst);
 
        skb->dev = nf_bridge->physindev;
        nf_bridge_push_encap_header(skb);
@@ -391,8 +392,12 @@ bridged_dnat:
                        skb->pkt_type = PACKET_HOST;
                }
        } else {
-               skb->rtable = &__fake_rtable;
-               dst_hold(&__fake_rtable.u.dst);
+               skb->rtable = bridge_parent_rtable(nf_bridge->physindev);
+               if (!skb->rtable) {
+                       kfree_skb(skb);
+                       return 0;
+               }
+               dst_hold(&skb->rtable->u.dst);
        }
 
        skb->dev = nf_bridge->physindev;
@@ -611,8 +616,8 @@ static unsigned int br_nf_local_in(unsigned int hook, struct sk_buff *skb,
                                   const struct net_device *out,
                                   int (*okfn)(struct sk_buff *))
 {
-       if (skb->rtable == &__fake_rtable) {
-               dst_release(&__fake_rtable.u.dst);
+       if (skb->rtable && skb->rtable == bridge_parent_rtable(in)) {
+               dst_release(&skb->rtable->u.dst);
                skb->rtable = NULL;
        }
 
index 815ed38..c3dc18d 100644 (file)
@@ -15,6 +15,7 @@
 
 #include <linux/netdevice.h>
 #include <linux/if_bridge.h>
+#include <net/route.h>
 
 #define BR_HASH_BITS 8
 #define BR_HASH_SIZE (1 << BR_HASH_BITS)
@@ -92,6 +93,9 @@ struct net_bridge
        struct hlist_head               hash[BR_HASH_SIZE];
        struct list_head                age_list;
        unsigned long                   feature_mask;
+#ifdef CONFIG_BRIDGE_NETFILTER
+       struct rtable                   fake_rtable;
+#endif
        unsigned long                   flags;
 #define BR_SET_MAC_ADDR                0x00000001
 
@@ -197,9 +201,11 @@ extern int br_ioctl_deviceless_stub(struct net *net, unsigned int cmd, void __us
 #ifdef CONFIG_BRIDGE_NETFILTER
 extern int br_netfilter_init(void);
 extern void br_netfilter_fini(void);
+extern void br_netfilter_rtable_init(struct net_bridge *);
 #else
 #define br_netfilter_init()    (0)
 #define br_netfilter_fini()    do { } while(0)
+#define br_netfilter_rtable_init(x)
 #endif
 
 /* br_stp.c */
index 921bbe5..6e63ec3 100644 (file)
@@ -368,14 +368,25 @@ static void br_make_blocking(struct net_bridge_port *p)
 /* called under bridge lock */
 static void br_make_forwarding(struct net_bridge_port *p)
 {
-       if (p->state == BR_STATE_BLOCKING) {
-               if (p->br->stp_enabled == BR_KERNEL_STP)
-                       p->state = BR_STATE_LISTENING;
-               else
-                       p->state = BR_STATE_LEARNING;
+       struct net_bridge *br = p->br;
 
-               br_log_state(p);
-               mod_timer(&p->forward_delay_timer, jiffies + p->br->forward_delay);     }
+       if (p->state != BR_STATE_BLOCKING)
+               return;
+
+       if (br->forward_delay == 0) {
+               p->state = BR_STATE_FORWARDING;
+               br_topology_change_detection(br);
+               del_timer(&p->forward_delay_timer);
+       }
+       else if (p->br->stp_enabled == BR_KERNEL_STP)
+               p->state = BR_STATE_LISTENING;
+       else
+               p->state = BR_STATE_LEARNING;
+
+       br_log_state(p);
+
+       if (br->forward_delay != 0)
+               mod_timer(&p->forward_delay_timer, jiffies + br->forward_delay);
 }
 
 /* called under bridge lock */
index 8d13a9b..01993ad 100644 (file)
@@ -1796,7 +1796,7 @@ gso:
        skb->tc_verd = SET_TC_AT(skb->tc_verd,AT_EGRESS);
 #endif
        if (q->enqueue) {
-               spinlock_t *root_lock = qdisc_root_lock(q);
+               spinlock_t *root_lock = qdisc_lock(q);
 
                spin_lock(root_lock);
 
@@ -1805,7 +1805,6 @@ gso:
 
                spin_unlock(root_lock);
 
-               rc = rc == NET_XMIT_BYPASS ? NET_XMIT_SUCCESS : rc;
                goto out;
        }
 
@@ -1909,7 +1908,6 @@ int netif_rx(struct sk_buff *skb)
        if (queue->input_pkt_queue.qlen <= netdev_max_backlog) {
                if (queue->input_pkt_queue.qlen) {
 enqueue:
-                       dev_hold(skb->dev);
                        __skb_queue_tail(&queue->input_pkt_queue, skb);
                        local_irq_restore(flags);
                        return NET_RX_SUCCESS;
@@ -1995,7 +1993,7 @@ static void net_tx_action(struct softirq_action *h)
                        smp_mb__before_clear_bit();
                        clear_bit(__QDISC_STATE_SCHED, &q->state);
 
-                       root_lock = qdisc_root_lock(q);
+                       root_lock = qdisc_lock(q);
                        if (spin_trylock(root_lock)) {
                                qdisc_run(q);
                                spin_unlock(root_lock);
@@ -2100,7 +2098,7 @@ static int ing_filter(struct sk_buff *skb)
        rxq = &dev->rx_queue;
 
        q = rxq->qdisc;
-       if (q) {
+       if (q != &noop_qdisc) {
                spin_lock(qdisc_lock(q));
                result = qdisc_enqueue_root(skb, q);
                spin_unlock(qdisc_lock(q));
@@ -2113,7 +2111,7 @@ static inline struct sk_buff *handle_ing(struct sk_buff *skb,
                                         struct packet_type **pt_prev,
                                         int *ret, struct net_device *orig_dev)
 {
-       if (!skb->dev->rx_queue.qdisc)
+       if (skb->dev->rx_queue.qdisc == &noop_qdisc)
                goto out;
 
        if (*pt_prev) {
@@ -2270,6 +2268,20 @@ out:
        return ret;
 }
 
+/* Network device is going away, flush any packets still pending  */
+static void flush_backlog(void *arg)
+{
+       struct net_device *dev = arg;
+       struct softnet_data *queue = &__get_cpu_var(softnet_data);
+       struct sk_buff *skb, *tmp;
+
+       skb_queue_walk_safe(&queue->input_pkt_queue, skb, tmp)
+               if (skb->dev == dev) {
+                       __skb_unlink(skb, &queue->input_pkt_queue);
+                       kfree_skb(skb);
+               }
+}
+
 static int process_backlog(struct napi_struct *napi, int quota)
 {
        int work = 0;
@@ -2279,7 +2291,6 @@ static int process_backlog(struct napi_struct *napi, int quota)
        napi->weight = weight_p;
        do {
                struct sk_buff *skb;
-               struct net_device *dev;
 
                local_irq_disable();
                skb = __skb_dequeue(&queue->input_pkt_queue);
@@ -2288,14 +2299,9 @@ static int process_backlog(struct napi_struct *napi, int quota)
                        local_irq_enable();
                        break;
                }
-
                local_irq_enable();
 
-               dev = skb->dev;
-
                netif_receive_skb(skb);
-
-               dev_put(dev);
        } while (++work < quota && jiffies == start_time);
 
        return work;
@@ -3988,6 +3994,10 @@ int register_netdevice(struct net_device *dev)
                }
        }
 
+       /* Enable software GSO if SG is supported. */
+       if (dev->features & NETIF_F_SG)
+               dev->features |= NETIF_F_GSO;
+
        netdev_initialize_kobject(dev);
        ret = netdev_register_kobject(dev);
        if (ret)
@@ -4165,6 +4175,8 @@ void netdev_run_todo(void)
 
                dev->reg_state = NETREG_UNREGISTERED;
 
+               on_each_cpu(flush_backlog, dev, 1);
+
                netdev_wait_allrefs(dev);
 
                /* paranoia */
@@ -4200,6 +4212,7 @@ static void netdev_init_queues(struct net_device *dev)
 {
        netdev_init_one_queue(dev, &dev->rx_queue, NULL);
        netdev_for_each_tx_queue(dev, netdev_init_one_queue, NULL);
+       spin_lock_init(&dev->tx_global_lock);
 }
 
 /**
index f62c8af..9d92e41 100644 (file)
@@ -2281,6 +2281,7 @@ static struct neighbour *neigh_get_idx(struct seq_file *seq, loff_t *pos)
        struct neighbour *n = neigh_get_first(seq);
 
        if (n) {
+               --(*pos);
                while (*pos) {
                        n = neigh_get_next(seq, n, pos);
                        if (!n)
@@ -2341,6 +2342,7 @@ static struct pneigh_entry *pneigh_get_idx(struct seq_file *seq, loff_t *pos)
        struct pneigh_entry *pn = pneigh_get_first(seq);
 
        if (pn) {
+               --(*pos);
                while (*pos) {
                        pn = pneigh_get_next(seq, pn, pos);
                        if (!pn)
@@ -2354,10 +2356,11 @@ static void *neigh_get_idx_any(struct seq_file *seq, loff_t *pos)
 {
        struct neigh_seq_state *state = seq->private;
        void *rc;
+       loff_t idxpos = *pos;
 
-       rc = neigh_get_idx(seq, pos);
+       rc = neigh_get_idx(seq, &idxpos);
        if (!rc && !(state->flags & NEIGH_SEQ_NEIGH_ONLY))
-               rc = pneigh_get_idx(seq, pos);
+               rc = pneigh_get_idx(seq, &idxpos);
 
        return rc;
 }
@@ -2366,7 +2369,6 @@ void *neigh_seq_start(struct seq_file *seq, loff_t *pos, struct neigh_table *tbl
        __acquires(tbl->lock)
 {
        struct neigh_seq_state *state = seq->private;
-       loff_t pos_minus_one;
 
        state->tbl = tbl;
        state->bucket = 0;
@@ -2374,8 +2376,7 @@ void *neigh_seq_start(struct seq_file *seq, loff_t *pos, struct neigh_table *tbl
 
        read_lock_bh(&tbl->lock);
 
-       pos_minus_one = *pos - 1;
-       return *pos ? neigh_get_idx_any(seq, &pos_minus_one) : SEQ_START_TOKEN;
+       return *pos ? neigh_get_idx_any(seq, pos) : SEQ_START_TOKEN;
 }
 EXPORT_SYMBOL(neigh_seq_start);
 
@@ -2385,7 +2386,7 @@ void *neigh_seq_next(struct seq_file *seq, void *v, loff_t *pos)
        void *rc;
 
        if (v == SEQ_START_TOKEN) {
-               rc = neigh_get_idx(seq, pos);
+               rc = neigh_get_first(seq);
                goto out;
        }
 
index c127208..6c7af39 100644 (file)
@@ -70,6 +70,7 @@ static void queue_process(struct work_struct *work)
                local_irq_save(flags);
                __netif_tx_lock(txq, smp_processor_id());
                if (netif_tx_queue_stopped(txq) ||
+                   netif_tx_queue_frozen(txq) ||
                    dev->hard_start_xmit(skb, dev) != NETDEV_TX_OK) {
                        skb_queue_head(&npinfo->txq, skb);
                        __netif_tx_unlock(txq);
index c7d484f..2498cda 100644 (file)
@@ -2085,15 +2085,19 @@ static inline int f_pick(struct pktgen_dev *pkt_dev)
                if (pkt_dev->flows[flow].count >= pkt_dev->lflow) {
                        /* reset time */
                        pkt_dev->flows[flow].count = 0;
+                       pkt_dev->flows[flow].flags = 0;
                        pkt_dev->curfl += 1;
                        if (pkt_dev->curfl >= pkt_dev->cflows)
                                pkt_dev->curfl = 0; /*reset */
                }
        } else {
                flow = random32() % pkt_dev->cflows;
+               pkt_dev->curfl = flow;
 
-               if (pkt_dev->flows[flow].count > pkt_dev->lflow)
+               if (pkt_dev->flows[flow].count > pkt_dev->lflow) {
                        pkt_dev->flows[flow].count = 0;
+                       pkt_dev->flows[flow].flags = 0;
+               }
        }
 
        return pkt_dev->curfl;
@@ -2162,7 +2166,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
                        mc = random32() % pkt_dev->src_mac_count;
                else {
                        mc = pkt_dev->cur_src_mac_offset++;
-                       if (pkt_dev->cur_src_mac_offset >
+                       if (pkt_dev->cur_src_mac_offset >=
                            pkt_dev->src_mac_count)
                                pkt_dev->cur_src_mac_offset = 0;
                }
@@ -2189,7 +2193,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
 
                else {
                        mc = pkt_dev->cur_dst_mac_offset++;
-                       if (pkt_dev->cur_dst_mac_offset >
+                       if (pkt_dev->cur_dst_mac_offset >=
                            pkt_dev->dst_mac_count) {
                                pkt_dev->cur_dst_mac_offset = 0;
                        }
@@ -3305,6 +3309,7 @@ static __inline__ void pktgen_xmit(struct pktgen_dev *pkt_dev)
 
        txq = netdev_get_tx_queue(odev, queue_map);
        if (netif_tx_queue_stopped(txq) ||
+           netif_tx_queue_frozen(txq) ||
            need_resched()) {
                idle_start = getCurUs();
 
@@ -3320,7 +3325,8 @@ static __inline__ void pktgen_xmit(struct pktgen_dev *pkt_dev)
 
                pkt_dev->idle_acc += getCurUs() - idle_start;
 
-               if (netif_tx_queue_stopped(txq)) {
+               if (netif_tx_queue_stopped(txq) ||
+                   netif_tx_queue_frozen(txq)) {
                        pkt_dev->next_tx_us = getCurUs();       /* TODO */
                        pkt_dev->next_tx_ns = 0;
                        goto out;       /* Try the next interface */
@@ -3352,7 +3358,8 @@ static __inline__ void pktgen_xmit(struct pktgen_dev *pkt_dev)
        txq = netdev_get_tx_queue(odev, queue_map);
 
        __netif_tx_lock_bh(txq);
-       if (!netif_tx_queue_stopped(txq)) {
+       if (!netif_tx_queue_stopped(txq) &&
+           !netif_tx_queue_frozen(txq)) {
 
                atomic_inc(&(pkt_dev->skb->users));
              retry_now:
index 4e0c922..8464017 100644 (file)
@@ -485,6 +485,9 @@ static struct sk_buff *__skb_clone(struct sk_buff *n, struct sk_buff *skb)
        C(head);
        C(data);
        C(truesize);
+#if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE)
+       C(do_not_encrypt);
+#endif
        atomic_set(&n->users, 1);
 
        atomic_inc(&(skb_shinfo(skb)->dataref));
index 1819ad7..fafe8eb 100644 (file)
@@ -475,11 +475,10 @@ static void arp_print(struct arp_payload *payload)
 #define HBUFFERLEN 30
        char hbuffer[HBUFFERLEN];
        int j,k;
-       const char hexbuf[]= "0123456789abcdef";
 
        for (k=0, j=0; k < HBUFFERLEN-3 && j < ETH_ALEN; j++) {
-               hbuffer[k++]=hexbuf[(payload->src_hw[j]>>4)&15];
-               hbuffer[k++]=hexbuf[payload->src_hw[j]&15];
+               hbuffer[k++] = hex_asc_hi(payload->src_hw[j]);
+               hbuffer[k++] = hex_asc_lo(payload->src_hw[j]);
                hbuffer[k++]=':';
        }
        hbuffer[--k]='\0';
index 21cb053..3974d7c 100644 (file)
@@ -305,10 +305,10 @@ static void recent_mt_destroy(const struct xt_match *match, void *matchinfo)
                spin_lock_bh(&recent_lock);
                list_del(&t->list);
                spin_unlock_bh(&recent_lock);
-               recent_table_flush(t);
 #ifdef CONFIG_PROC_FS
                remove_proc_entry(t->name, proc_dir);
 #endif
+               recent_table_flush(t);
                kfree(t);
        }
        mutex_unlock(&recent_mutex);
index 834356e..8f5a403 100644 (file)
@@ -232,6 +232,8 @@ static const struct snmp_mib snmp4_net_list[] = {
        SNMP_MIB_ITEM("TCPDSACKIgnoredOld", LINUX_MIB_TCPDSACKIGNOREDOLD),
        SNMP_MIB_ITEM("TCPDSACKIgnoredNoUndo", LINUX_MIB_TCPDSACKIGNOREDNOUNDO),
        SNMP_MIB_ITEM("TCPSpuriousRTOs", LINUX_MIB_TCPSPURIOUSRTOS),
+       SNMP_MIB_ITEM("TCPMD5NotFound", LINUX_MIB_TCPMD5NOTFOUND),
+       SNMP_MIB_ITEM("TCPMD5Unexpected", LINUX_MIB_TCPMD5UNEXPECTED),
        SNMP_MIB_SENTINEL
 };
 
index 380d647..1bfa078 100644 (file)
@@ -3216,14 +3216,18 @@ int __init ip_rt_init(void)
        return rc;
 }
 
+#ifdef CONFIG_SYSCTL
 /*
  * We really need to sanitize the damn ipv4 init order, then all
  * this nonsense will go away.
  */
 void __init ip_static_sysctl_init(void)
 {
+#ifdef CONFIG_SYSCTL
        register_sysctl_paths(ipv4_route_path, ipv4_route_table);
+#endif
 }
+#endif
 
 EXPORT_SYMBOL(__ip_select_ident);
 EXPORT_SYMBOL(ip_route_input);
index 770d827..e0689fd 100644 (file)
@@ -232,6 +232,7 @@ static struct ctl_table ipv4_table[] = {
                .mode           = 0644,
                .proc_handler   = &ipv4_doint_and_flush,
                .strategy       = &ipv4_doint_and_flush_strategy,
+               .extra2         = &init_net,
        },
        {
                .ctl_name       = NET_IPV4_NO_PMTU_DISC,
index a2b06d0..91a8cfd 100644 (file)
@@ -655,8 +655,8 @@ static void tcp_v4_send_ack(struct sk_buff *skb, u32 seq, u32 ack,
                rep.th.doff = arg.iov[0].iov_len/4;
 
                tcp_v4_md5_hash_hdr((__u8 *) &rep.opt[offset],
-                                   key, ip_hdr(skb)->daddr,
-                                   ip_hdr(skb)->saddr, &rep.th);
+                                   key, ip_hdr(skb)->saddr,
+                                   ip_hdr(skb)->daddr, &rep.th);
        }
 #endif
        arg.csum = csum_tcpudp_nofold(ip_hdr(skb)->daddr,
@@ -1116,18 +1116,12 @@ static int tcp_v4_inbound_md5_hash(struct sock *sk, struct sk_buff *skb)
                return 0;
 
        if (hash_expected && !hash_location) {
-               LIMIT_NETDEBUG(KERN_INFO "MD5 Hash expected but NOT found "
-                              "(" NIPQUAD_FMT ", %d)->(" NIPQUAD_FMT ", %d)\n",
-                              NIPQUAD(iph->saddr), ntohs(th->source),
-                              NIPQUAD(iph->daddr), ntohs(th->dest));
+               NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPMD5NOTFOUND);
                return 1;
        }
 
        if (!hash_expected && hash_location) {
-               LIMIT_NETDEBUG(KERN_INFO "MD5 Hash NOT expected but found "
-                              "(" NIPQUAD_FMT ", %d)->(" NIPQUAD_FMT ", %d)\n",
-                              NIPQUAD(iph->saddr), ntohs(th->source),
-                              NIPQUAD(iph->daddr), ntohs(th->dest));
+               NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPMD5UNEXPECTED);
                return 1;
        }
 
index f7b535d..410046a 100644 (file)
@@ -732,7 +732,7 @@ int datagram_send_ctl(struct net *net,
                        LIMIT_NETDEBUG(KERN_DEBUG "invalid cmsg type: %d\n",
                                       cmsg->cmsg_type);
                        err = -EINVAL;
-                       break;
+                       goto exit_f;
                }
        }
 
index 6811901..a4402de 100644 (file)
@@ -236,6 +236,10 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
        skb_reset_network_header(skb);
        hdr = ipv6_hdr(skb);
 
+       /* Allow local fragmentation. */
+       if (ipfragok)
+               skb->local_df = 1;
+
        /*
         *      Fill in the IPv6 header
         */
@@ -265,7 +269,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
        skb->mark = sk->sk_mark;
 
        mtu = dst_mtu(dst);
-       if ((skb->len <= mtu) || ipfragok || skb_is_gso(skb)) {
+       if ((skb->len <= mtu) || skb->local_df || skb_is_gso(skb)) {
                IP6_INC_STATS(ip6_dst_idev(skb->dst),
                              IPSTATS_MIB_OUTREQUESTS);
                return NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, dst->dev,
index ea33b26..741cfcd 100644 (file)
@@ -346,6 +346,8 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
                 */
                if (optlen == 0)
                        optval = NULL;
+               else if (optval == NULL)
+                       goto e_inval;
                else if (optlen < sizeof(struct ipv6_opt_hdr) ||
                         optlen & 0x7 || optlen > 8 * 255)
                        goto e_inval;
index f82f607..0179b66 100644 (file)
@@ -286,7 +286,6 @@ proc_net_fail:
 
 void ipv6_misc_proc_exit(void)
 {
-       proc_net_remove(&init_net, "sockstat6");
        proc_net_remove(&init_net, "dev_snmp6");
        proc_net_remove(&init_net, "snmp6");
        unregister_pernet_subsys(&ipv6_proc_ops);
index a46badd..ec394cf 100644 (file)
@@ -199,10 +199,8 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
        ireq6 = inet6_rsk(req);
        treq = tcp_rsk(req);
 
-       if (security_inet_conn_request(sk, skb, req)) {
-               reqsk_free(req);
-               goto out;
-       }
+       if (security_inet_conn_request(sk, skb, req))
+               goto out_free;
 
        req->mss = mss;
        ireq->rmt_port = th->source;
@@ -255,14 +253,13 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
                fl.fl_ip_dport = inet_rsk(req)->rmt_port;
                fl.fl_ip_sport = inet_sk(sk)->sport;
                security_req_classify_flow(req, &fl);
-               if (ip6_dst_lookup(sk, &dst, &fl)) {
-                       reqsk_free(req);
-                       goto out;
-               }
+               if (ip6_dst_lookup(sk, &dst, &fl))
+                       goto out_free;
+
                if (final_p)
                        ipv6_addr_copy(&fl.fl6_dst, final_p);
                if ((xfrm_lookup(&dst, &fl, sk, 0)) < 0)
-                       goto out;
+                       goto out_free;
        }
 
        req->window_clamp = tp->window_clamp ? :dst_metric(dst, RTAX_WINDOW);
@@ -273,7 +270,10 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
        ireq->rcv_wscale = rcv_wscale;
 
        ret = get_cookie_sock(sk, skb, req, dst);
-
-out:   return ret;
+out:
+       return ret;
+out_free:
+       reqsk_free(req);
+       return NULL;
 }
 
index cff778b..78185a4 100644 (file)
@@ -748,7 +748,7 @@ static int tcp_v6_md5_hash_pseudoheader(struct tcp_md5sig_pool *hp,
        ipv6_addr_copy(&bp->saddr, saddr);
        ipv6_addr_copy(&bp->daddr, daddr);
        bp->protocol = cpu_to_be32(IPPROTO_TCP);
-       bp->len = cpu_to_be16(nbytes);
+       bp->len = cpu_to_be32(nbytes);
 
        sg_init_one(&sg, bp, sizeof(*bp));
        return crypto_hash_update(&hp->md5_desc, &sg, sizeof(*bp));
@@ -849,28 +849,17 @@ static int tcp_v6_inbound_md5_hash (struct sock *sk, struct sk_buff *skb)
        hash_expected = tcp_v6_md5_do_lookup(sk, &ip6h->saddr);
        hash_location = tcp_parse_md5sig_option(th);
 
-       /* do we have a hash as expected? */
-       if (!hash_expected) {
-               if (!hash_location)
-                       return 0;
-               if (net_ratelimit()) {
-                       printk(KERN_INFO "MD5 Hash NOT expected but found "
-                              "(" NIP6_FMT ", %u)->"
-                              "(" NIP6_FMT ", %u)\n",
-                              NIP6(ip6h->saddr), ntohs(th->source),
-                              NIP6(ip6h->daddr), ntohs(th->dest));
-               }
+       /* We've parsed the options - do we have a hash? */
+       if (!hash_expected && !hash_location)
+               return 0;
+
+       if (hash_expected && !hash_location) {
+               NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPMD5NOTFOUND);
                return 1;
        }
 
-       if (!hash_location) {
-               if (net_ratelimit()) {
-                       printk(KERN_INFO "MD5 Hash expected but NOT found "
-                              "(" NIP6_FMT ", %u)->"
-                              "(" NIP6_FMT ", %u)\n",
-                              NIP6(ip6h->saddr), ntohs(th->source),
-                              NIP6(ip6h->daddr), ntohs(th->dest));
-               }
+       if (!hash_expected && hash_location) {
+               NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPMD5UNEXPECTED);
                return 1;
        }
 
@@ -1105,8 +1094,8 @@ static void tcp_v6_send_ack(struct sk_buff *skb, u32 seq, u32 ack, u32 win, u32
                *topt++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
                                (TCPOPT_MD5SIG << 8) | TCPOLEN_MD5SIG);
                tcp_v6_md5_hash_hdr((__u8 *)topt, key,
-                                   &ipv6_hdr(skb)->daddr,
-                                   &ipv6_hdr(skb)->saddr, t1);
+                                   &ipv6_hdr(skb)->saddr,
+                                   &ipv6_hdr(skb)->daddr, t1);
        }
 #endif
 
index 8e7ba0e..297c257 100644 (file)
@@ -81,6 +81,7 @@ static int ieee80211_change_iface(struct wiphy *wiphy, int ifindex,
                                  enum nl80211_iftype type, u32 *flags,
                                  struct vif_params *params)
 {
+       struct ieee80211_local *local = wiphy_priv(wiphy);
        struct net_device *dev;
        enum ieee80211_if_types itype;
        struct ieee80211_sub_if_data *sdata;
@@ -95,6 +96,9 @@ static int ieee80211_change_iface(struct wiphy *wiphy, int ifindex,
        if (itype == IEEE80211_IF_TYPE_INVALID)
                return -EINVAL;
 
+       if (dev == local->mdev)
+               return -EOPNOTSUPP;
+
        sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
        ret = ieee80211_if_change_type(sdata, itype);
@@ -117,12 +121,16 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev,
                             u8 key_idx, u8 *mac_addr,
                             struct key_params *params)
 {
+       struct ieee80211_local *local = wiphy_priv(wiphy);
        struct ieee80211_sub_if_data *sdata;
        struct sta_info *sta = NULL;
        enum ieee80211_key_alg alg;
        struct ieee80211_key *key;
        int err;
 
+       if (dev == local->mdev)
+               return -EOPNOTSUPP;
+
        sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
        switch (params->cipher) {
@@ -167,10 +175,14 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev,
 static int ieee80211_del_key(struct wiphy *wiphy, struct net_device *dev,
                             u8 key_idx, u8 *mac_addr)
 {
+       struct ieee80211_local *local = wiphy_priv(wiphy);
        struct ieee80211_sub_if_data *sdata;
        struct sta_info *sta;
        int ret;
 
+       if (dev == local->mdev)
+               return -EOPNOTSUPP;
+
        sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
        rcu_read_lock();
@@ -211,7 +223,8 @@ static int ieee80211_get_key(struct wiphy *wiphy, struct net_device *dev,
                             void (*callback)(void *cookie,
                                              struct key_params *params))
 {
-       struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+       struct ieee80211_local *local = wiphy_priv(wiphy);
+       struct ieee80211_sub_if_data *sdata;
        struct sta_info *sta = NULL;
        u8 seq[6] = {0};
        struct key_params params;
@@ -220,6 +233,11 @@ static int ieee80211_get_key(struct wiphy *wiphy, struct net_device *dev,
        u16 iv16;
        int err = -ENOENT;
 
+       if (dev == local->mdev)
+               return -EOPNOTSUPP;
+
+       sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+
        rcu_read_lock();
 
        if (mac_addr) {
@@ -293,8 +311,12 @@ static int ieee80211_config_default_key(struct wiphy *wiphy,
                                        struct net_device *dev,
                                        u8 key_idx)
 {
+       struct ieee80211_local *local = wiphy_priv(wiphy);
        struct ieee80211_sub_if_data *sdata;
 
+       if (dev == local->mdev)
+               return -EOPNOTSUPP;
+
        rcu_read_lock();
 
        sdata = IEEE80211_DEV_TO_SUB_IF(dev);
@@ -475,9 +497,15 @@ static int ieee80211_config_beacon(struct ieee80211_sub_if_data *sdata,
 static int ieee80211_add_beacon(struct wiphy *wiphy, struct net_device *dev,
                                struct beacon_parameters *params)
 {
-       struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+       struct ieee80211_local *local = wiphy_priv(wiphy);
+       struct ieee80211_sub_if_data *sdata;
        struct beacon_data *old;
 
+       if (dev == local->mdev)
+               return -EOPNOTSUPP;
+
+       sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+
        if (sdata->vif.type != IEEE80211_IF_TYPE_AP)
                return -EINVAL;
 
@@ -492,9 +520,15 @@ static int ieee80211_add_beacon(struct wiphy *wiphy, struct net_device *dev,
 static int ieee80211_set_beacon(struct wiphy *wiphy, struct net_device *dev,
                                struct beacon_parameters *params)
 {
-       struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+       struct ieee80211_local *local = wiphy_priv(wiphy);
+       struct ieee80211_sub_if_data *sdata;
        struct beacon_data *old;
 
+       if (dev == local->mdev)
+               return -EOPNOTSUPP;
+
+       sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+
        if (sdata->vif.type != IEEE80211_IF_TYPE_AP)
                return -EINVAL;
 
@@ -508,9 +542,15 @@ static int ieee80211_set_beacon(struct wiphy *wiphy, struct net_device *dev,
 
 static int ieee80211_del_beacon(struct wiphy *wiphy, struct net_device *dev)
 {
-       struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+       struct ieee80211_local *local = wiphy_priv(wiphy);
+       struct ieee80211_sub_if_data *sdata;
        struct beacon_data *old;
 
+       if (dev == local->mdev)
+               return -EOPNOTSUPP;
+
+       sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+
        if (sdata->vif.type != IEEE80211_IF_TYPE_AP)
                return -EINVAL;
 
@@ -646,11 +686,14 @@ static void sta_apply_parameters(struct ieee80211_local *local,
 static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
                                 u8 *mac, struct station_parameters *params)
 {
-       struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
+       struct ieee80211_local *local = wiphy_priv(wiphy);
        struct sta_info *sta;
        struct ieee80211_sub_if_data *sdata;
        int err;
 
+       if (dev == local->mdev || params->vlan == local->mdev)
+               return -EOPNOTSUPP;
+
        /* Prevent a race with changing the rate control algorithm */
        if (!netif_running(dev))
                return -ENETDOWN;
@@ -701,10 +744,15 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
 static int ieee80211_del_station(struct wiphy *wiphy, struct net_device *dev,
                                 u8 *mac)
 {
-       struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
-       struct ieee80211_local *local = sdata->local;
+       struct ieee80211_local *local = wiphy_priv(wiphy);
+       struct ieee80211_sub_if_data *sdata;
        struct sta_info *sta;
 
+       if (dev == local->mdev)
+               return -EOPNOTSUPP;
+
+       sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+
        if (mac) {
                rcu_read_lock();
 
@@ -730,10 +778,13 @@ static int ieee80211_change_station(struct wiphy *wiphy,
                                    u8 *mac,
                                    struct station_parameters *params)
 {
-       struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
+       struct ieee80211_local *local = wiphy_priv(wiphy);
        struct sta_info *sta;
        struct ieee80211_sub_if_data *vlansdata;
 
+       if (dev == local->mdev || params->vlan == local->mdev)
+               return -EOPNOTSUPP;
+
        rcu_read_lock();
 
        /* XXX: get sta belonging to dev */
@@ -752,7 +803,7 @@ static int ieee80211_change_station(struct wiphy *wiphy,
                        return -EINVAL;
                }
 
-               sta->sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan);
+               sta->sdata = vlansdata;
                ieee80211_send_layer2_update(sta);
        }
 
@@ -767,15 +818,20 @@ static int ieee80211_change_station(struct wiphy *wiphy,
 static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev,
                                 u8 *dst, u8 *next_hop)
 {
-       struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
-       struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+       struct ieee80211_local *local = wiphy_priv(wiphy);
+       struct ieee80211_sub_if_data *sdata;
        struct mesh_path *mpath;
        struct sta_info *sta;
        int err;
 
+       if (dev == local->mdev)
+               return -EOPNOTSUPP;
+
        if (!netif_running(dev))
                return -ENETDOWN;
 
+       sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+
        if (sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT)
                return -ENOTSUPP;
 
@@ -817,14 +873,19 @@ static int ieee80211_change_mpath(struct wiphy *wiphy,
                                    struct net_device *dev,
                                    u8 *dst, u8 *next_hop)
 {
-       struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
-       struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+       struct ieee80211_local *local = wiphy_priv(wiphy);
+       struct ieee80211_sub_if_data *sdata;
        struct mesh_path *mpath;
        struct sta_info *sta;
 
+       if (dev == local->mdev)
+               return -EOPNOTSUPP;
+
        if (!netif_running(dev))
                return -ENETDOWN;
 
+       sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+
        if (sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT)
                return -ENOTSUPP;
 
@@ -891,9 +952,15 @@ static int ieee80211_get_mpath(struct wiphy *wiphy, struct net_device *dev,
                               u8 *dst, u8 *next_hop, struct mpath_info *pinfo)
 
 {
-       struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+       struct ieee80211_local *local = wiphy_priv(wiphy);
+       struct ieee80211_sub_if_data *sdata;
        struct mesh_path *mpath;
 
+       if (dev == local->mdev)
+               return -EOPNOTSUPP;
+
+       sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+
        if (sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT)
                return -ENOTSUPP;
 
@@ -913,9 +980,15 @@ static int ieee80211_dump_mpath(struct wiphy *wiphy, struct net_device *dev,
                                 int idx, u8 *dst, u8 *next_hop,
                                 struct mpath_info *pinfo)
 {
-       struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+       struct ieee80211_local *local = wiphy_priv(wiphy);
+       struct ieee80211_sub_if_data *sdata;
        struct mesh_path *mpath;
 
+       if (dev == local->mdev)
+               return -EOPNOTSUPP;
+
+       sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+
        if (sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT)
                return -ENOTSUPP;
 
index a4f9a83..ec59345 100644 (file)
@@ -82,6 +82,7 @@ struct ieee80211_sta_bss {
 
        u8 bssid[ETH_ALEN];
        u8 ssid[IEEE80211_MAX_SSID_LEN];
+       u8 dtim_period;
        u16 capability; /* host byte order */
        enum ieee80211_band band;
        int freq;
@@ -586,6 +587,7 @@ struct ieee80211_local {
        struct timer_list sta_cleanup;
 
        unsigned long queues_pending[BITS_TO_LONGS(IEEE80211_MAX_QUEUES)];
+       unsigned long queues_pending_run[BITS_TO_LONGS(IEEE80211_MAX_QUEUES)];
        struct ieee80211_tx_stored_packet pending_packet[IEEE80211_MAX_QUEUES];
        struct tasklet_struct tx_pending_tasklet;
 
index f1a83d4..0c02c47 100644 (file)
@@ -1233,18 +1233,12 @@ static void ieee80211_tasklet_handler(unsigned long data)
 /* Remove added headers (e.g., QoS control), encryption header/MIC, etc. to
  * make a prepared TX frame (one that has been given to hw) to look like brand
  * new IEEE 802.11 frame that is ready to go through TX processing again.
- * Also, tx_packet_data in cb is restored from tx_control. */
+ */
 static void ieee80211_remove_tx_extra(struct ieee80211_local *local,
                                      struct ieee80211_key *key,
                                      struct sk_buff *skb)
 {
        int hdrlen, iv_len, mic_len;
-       struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
-
-       info->flags &=  IEEE80211_TX_CTL_REQ_TX_STATUS |
-                       IEEE80211_TX_CTL_DO_NOT_ENCRYPT |
-                       IEEE80211_TX_CTL_REQUEUE |
-                       IEEE80211_TX_CTL_EAPOL_FRAME;
 
        hdrlen = ieee80211_get_hdrlen_from_skb(skb);
 
@@ -1695,6 +1689,11 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
        if (local->hw.conf.beacon_int < 10)
                local->hw.conf.beacon_int = 100;
 
+       if (local->hw.max_listen_interval == 0)
+               local->hw.max_listen_interval = 1;
+
+       local->hw.conf.listen_interval = local->hw.max_listen_interval;
+
        local->wstats_flags |= local->hw.flags & (IEEE80211_HW_SIGNAL_UNSPEC |
                                                  IEEE80211_HW_SIGNAL_DB |
                                                  IEEE80211_HW_SIGNAL_DBM) ?
@@ -1731,8 +1730,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
        result = ieee80211_wep_init(local);
 
        if (result < 0) {
-               printk(KERN_DEBUG "%s: Failed to initialize wep\n",
-                      wiphy_name(local->hw.wiphy));
+               printk(KERN_DEBUG "%s: Failed to initialize wep: %d\n",
+                      wiphy_name(local->hw.wiphy), result);
                goto fail_wep;
        }
 
index d7c371e..e1d11c9 100644 (file)
@@ -551,6 +551,7 @@ static void ieee80211_set_associated(struct net_device *dev,
                        /* set timing information */
                        sdata->bss_conf.beacon_int = bss->beacon_int;
                        sdata->bss_conf.timestamp = bss->timestamp;
+                       sdata->bss_conf.dtim_period = bss->dtim_period;
 
                        changed |= ieee80211_handle_bss_capability(sdata, bss);
 
@@ -606,7 +607,6 @@ void ieee80211_sta_tx(struct net_device *dev, struct sk_buff *skb,
                      int encrypt)
 {
        struct ieee80211_sub_if_data *sdata;
-       struct ieee80211_tx_info *info;
 
        sdata = IEEE80211_DEV_TO_SUB_IF(dev);
        skb->dev = sdata->local->mdev;
@@ -614,11 +614,8 @@ void ieee80211_sta_tx(struct net_device *dev, struct sk_buff *skb,
        skb_set_network_header(skb, 0);
        skb_set_transport_header(skb, 0);
 
-       info = IEEE80211_SKB_CB(skb);
-       memset(info, 0, sizeof(struct ieee80211_tx_info));
-       info->control.ifindex = sdata->dev->ifindex;
-       if (!encrypt)
-               info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT;
+       skb->iif = sdata->dev->ifindex;
+       skb->do_not_encrypt = !encrypt;
 
        dev_queue_xmit(skb);
 }
@@ -777,7 +774,8 @@ static void ieee80211_send_assoc(struct net_device *dev,
                mgmt->frame_control = IEEE80211_FC(IEEE80211_FTYPE_MGMT,
                                                   IEEE80211_STYPE_REASSOC_REQ);
                mgmt->u.reassoc_req.capab_info = cpu_to_le16(capab);
-               mgmt->u.reassoc_req.listen_interval = cpu_to_le16(1);
+               mgmt->u.reassoc_req.listen_interval =
+                               cpu_to_le16(local->hw.conf.listen_interval);
                memcpy(mgmt->u.reassoc_req.current_ap, ifsta->prev_bssid,
                       ETH_ALEN);
        } else {
@@ -785,7 +783,8 @@ static void ieee80211_send_assoc(struct net_device *dev,
                mgmt->frame_control = IEEE80211_FC(IEEE80211_FTYPE_MGMT,
                                                   IEEE80211_STYPE_ASSOC_REQ);
                mgmt->u.assoc_req.capab_info = cpu_to_le16(capab);
-               mgmt->u.assoc_req.listen_interval = cpu_to_le16(1);
+               mgmt->u.reassoc_req.listen_interval =
+                               cpu_to_le16(local->hw.conf.listen_interval);
        }
 
        /* SSID */
@@ -2692,6 +2691,16 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
        bss->beacon_int = le16_to_cpu(mgmt->u.beacon.beacon_int);
        bss->capability = le16_to_cpu(mgmt->u.beacon.capab_info);
 
+       if (elems->tim) {
+               struct ieee80211_tim_ie *tim_ie =
+                       (struct ieee80211_tim_ie *)elems->tim;
+               bss->dtim_period = tim_ie->dtim_period;
+       }
+
+       /* set default value for buggy APs */
+       if (!elems->tim || bss->dtim_period == 0)
+               bss->dtim_period = 1;
+
        bss->supp_rates_len = 0;
        if (elems->supp_rates) {
                clen = IEEE80211_MAX_SUPP_RATES - bss->supp_rates_len;
@@ -3303,6 +3312,7 @@ void ieee80211_start_mesh(struct net_device *dev)
        ifsta = &sdata->u.sta;
        ifsta->state = IEEE80211_MESH_UP;
        ieee80211_sta_timer((unsigned long)sdata);
+       ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON);
 }
 #endif
 
@@ -3653,11 +3663,21 @@ static int ieee80211_sta_find_ibss(struct net_device *dev,
                       "%s\n", print_mac(mac, bssid),
                       print_mac(mac2, ifsta->bssid));
 #endif /* CONFIG_MAC80211_IBSS_DEBUG */
-       if (found && memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0 &&
-           (bss = ieee80211_rx_bss_get(dev, bssid,
-                                       local->hw.conf.channel->center_freq,
-                                       ifsta->ssid, ifsta->ssid_len))) {
+
+       if (found && memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0) {
                int ret;
+               int search_freq;
+
+               if (ifsta->flags & IEEE80211_STA_AUTO_CHANNEL_SEL)
+                       search_freq = bss->freq;
+               else
+                       search_freq = local->hw.conf.channel->center_freq;
+
+               bss = ieee80211_rx_bss_get(dev, bssid, search_freq,
+                                          ifsta->ssid, ifsta->ssid_len);
+               if (!bss)
+                       goto dont_join;
+
                printk(KERN_DEBUG "%s: Selected IBSS BSSID %s"
                       " based on configured SSID\n",
                       dev->name, print_mac(mac, bssid));
@@ -3665,6 +3685,8 @@ static int ieee80211_sta_find_ibss(struct net_device *dev,
                ieee80211_rx_bss_put(local, bss);
                return ret;
        }
+
+dont_join:
 #ifdef CONFIG_MAC80211_IBSS_DEBUG
        printk(KERN_DEBUG "   did not try to join ibss\n");
 #endif /* CONFIG_MAC80211_IBSS_DEBUG */
@@ -3898,7 +3920,7 @@ done:
        if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
                struct ieee80211_if_sta *ifsta = &sdata->u.sta;
                if (!(ifsta->flags & IEEE80211_STA_BSSID_SET) ||
-                   (!ifsta->state == IEEE80211_IBSS_JOINED &&
+                   (!(ifsta->state == IEEE80211_IBSS_JOINED) &&
                    !ieee80211_sta_active_ibss(dev)))
                        ieee80211_sta_find_ibss(dev, ifsta);
        }
index 0fbadd8..771ec68 100644 (file)
@@ -305,7 +305,7 @@ static void purge_old_ps_buffers(struct ieee80211_local *local)
        rcu_read_unlock();
 
        local->total_ps_buffered = total;
-#ifdef MAC80211_VERBOSE_PS_DEBUG
+#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
        printk(KERN_DEBUG "%s: PS buffers full - purged %d frames\n",
               wiphy_name(local->hw.wiphy), purged);
 #endif
@@ -342,7 +342,7 @@ ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx)
                        purge_old_ps_buffers(tx->local);
                if (skb_queue_len(&tx->sdata->bss->ps_bc_buf) >=
                    AP_MAX_BC_BUFFER) {
-#ifdef MAC80211_VERBOSE_PS_DEBUG
+#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
                        if (net_ratelimit()) {
                                printk(KERN_DEBUG "%s: BC TX buffer full - "
                                       "dropping the oldest frame\n",
@@ -389,7 +389,7 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
                        purge_old_ps_buffers(tx->local);
                if (skb_queue_len(&sta->ps_tx_buf) >= STA_MAX_TX_BUFFER) {
                        struct sk_buff *old = skb_dequeue(&sta->ps_tx_buf);
-#ifdef MAC80211_VERBOSE_PS_DEBUG
+#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
                        if (net_ratelimit()) {
                                printk(KERN_DEBUG "%s: STA %s TX "
                                       "buffer full - dropping oldest frame\n",
@@ -439,14 +439,14 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
        struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
        u16 fc = tx->fc;
 
-       if (unlikely(info->flags & IEEE80211_TX_CTL_DO_NOT_ENCRYPT))
+       if (unlikely(tx->skb->do_not_encrypt))
                tx->key = NULL;
        else if (tx->sta && (key = rcu_dereference(tx->sta->key)))
                tx->key = key;
        else if ((key = rcu_dereference(tx->sdata->default_key)))
                tx->key = key;
        else if (tx->sdata->drop_unencrypted &&
-                !(info->flags & IEEE80211_TX_CTL_EAPOL_FRAME) &&
+                (tx->skb->protocol != cpu_to_be16(ETH_P_PAE)) &&
                 !(info->flags & IEEE80211_TX_CTL_INJECTED)) {
                I802_DEBUG_INC(tx->local->tx_handlers_drop_unencrypted);
                return TX_DROP;
@@ -476,7 +476,7 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
        }
 
        if (!tx->key || !(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE))
-               info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT;
+               tx->skb->do_not_encrypt = 1;
 
        return TX_CONTINUE;
 }
@@ -732,6 +732,7 @@ ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx)
                memcpy(skb_put(frag, copylen), pos, copylen);
                memcpy(frag->cb, first->cb, sizeof(frag->cb));
                skb_copy_queue_mapping(frag, first);
+               frag->do_not_encrypt = first->do_not_encrypt;
 
                pos += copylen;
                left -= copylen;
@@ -852,7 +853,7 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx,
 
        sband = tx->local->hw.wiphy->bands[tx->channel->band];
 
-       info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT;
+       skb->do_not_encrypt = 1;
        info->flags |= IEEE80211_TX_CTL_INJECTED;
        tx->flags &= ~IEEE80211_TX_FRAGMENTED;
 
@@ -925,8 +926,7 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx,
                                skb_trim(skb, skb->len - FCS_LEN);
                        }
                        if (*iterator.this_arg & IEEE80211_RADIOTAP_F_WEP)
-                               info->flags &=
-                                       ~IEEE80211_TX_CTL_DO_NOT_ENCRYPT;
+                               tx->skb->do_not_encrypt = 0;
                        if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FRAG)
                                tx->flags |= IEEE80211_TX_FRAGMENTED;
                        break;
@@ -1042,10 +1042,9 @@ static int ieee80211_tx_prepare(struct ieee80211_tx_data *tx,
                                struct sk_buff *skb,
                                struct net_device *mdev)
 {
-       struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
        struct net_device *dev;
 
-       dev = dev_get_by_index(&init_net, info->control.ifindex);
+       dev = dev_get_by_index(&init_net, skb->iif);
        if (unlikely(dev && !is_ieee80211_device(dev, mdev))) {
                dev_put(dev);
                dev = NULL;
@@ -1061,13 +1060,14 @@ static int ieee80211_tx_prepare(struct ieee80211_tx_data *tx,
 static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb,
                          struct ieee80211_tx_data *tx)
 {
-       struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+       struct ieee80211_tx_info *info;
        int ret, i;
 
-       if (netif_subqueue_stopped(local->mdev, skb))
-               return IEEE80211_TX_AGAIN;
-
        if (skb) {
+               if (netif_subqueue_stopped(local->mdev, skb))
+                       return IEEE80211_TX_AGAIN;
+               info =  IEEE80211_SKB_CB(skb);
+
                ieee80211_dump_frame(wiphy_name(local->hw.wiphy),
                                     "TX to low-level driver", skb);
                ret = local->ops->tx(local_to_hw(local), skb);
@@ -1216,6 +1216,7 @@ retry:
 
                if (ret == IEEE80211_TX_FRAG_AGAIN)
                        skb = NULL;
+
                set_bit(queue, local->queues_pending);
                smp_mb();
                /*
@@ -1306,8 +1307,8 @@ int ieee80211_master_start_xmit(struct sk_buff *skb,
        bool may_encrypt;
        int ret;
 
-       if (info->control.ifindex)
-               odev = dev_get_by_index(&init_net, info->control.ifindex);
+       if (skb->iif)
+               odev = dev_get_by_index(&init_net, skb->iif);
        if (unlikely(odev && !is_ieee80211_device(odev, dev))) {
                dev_put(odev);
                odev = NULL;
@@ -1321,9 +1322,13 @@ int ieee80211_master_start_xmit(struct sk_buff *skb,
                return 0;
        }
 
+       memset(info, 0, sizeof(*info));
+
+       info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
+
        osdata = IEEE80211_DEV_TO_SUB_IF(odev);
 
-       may_encrypt = !(info->flags & IEEE80211_TX_CTL_DO_NOT_ENCRYPT);
+       may_encrypt = !skb->do_not_encrypt;
 
        headroom = osdata->local->tx_headroom;
        if (may_encrypt)
@@ -1348,7 +1353,6 @@ int ieee80211_monitor_start_xmit(struct sk_buff *skb,
                                 struct net_device *dev)
 {
        struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
-       struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
        struct ieee80211_radiotap_header *prthdr =
                (struct ieee80211_radiotap_header *)skb->data;
        u16 len_rthdr;
@@ -1371,11 +1375,11 @@ int ieee80211_monitor_start_xmit(struct sk_buff *skb,
        skb->dev = local->mdev;
 
        /* needed because we set skb device to master */
-       info->control.ifindex = dev->ifindex;
+       skb->iif = dev->ifindex;
 
-       info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT;
-       /* Interfaces should always request a status report */
-       info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
+       /* sometimes we do encrypt injected frames, will be fixed
+        * up in radiotap parser if not wanted */
+       skb->do_not_encrypt = 0;
 
        /*
         * fix up the pointers accounting for the radiotap
@@ -1419,7 +1423,6 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb,
                               struct net_device *dev)
 {
        struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
-       struct ieee80211_tx_info *info;
        struct ieee80211_sub_if_data *sdata;
        int ret = 1, head_need;
        u16 ethertype, hdrlen,  meshhdrlen = 0;
@@ -1645,14 +1648,7 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb,
        nh_pos += hdrlen;
        h_pos += hdrlen;
 
-       info = IEEE80211_SKB_CB(skb);
-       memset(info, 0, sizeof(*info));
-       info->control.ifindex = dev->ifindex;
-       if (ethertype == ETH_P_PAE)
-               info->flags |= IEEE80211_TX_CTL_EAPOL_FRAME;
-
-       /* Interfaces should always request a status report */
-       info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
+       skb->iif = dev->ifindex;
 
        skb->dev = local->mdev;
        dev->stats.tx_packets++;
@@ -1714,14 +1710,19 @@ void ieee80211_tx_pending(unsigned long data)
        netif_tx_lock_bh(dev);
        for (i = 0; i < ieee80211_num_regular_queues(&local->hw); i++) {
                /* Check that this queue is ok */
-               if (__netif_subqueue_stopped(local->mdev, i))
+               if (__netif_subqueue_stopped(local->mdev, i) &&
+                   !test_bit(i, local->queues_pending_run))
                        continue;
 
                if (!test_bit(i, local->queues_pending)) {
+                       clear_bit(i, local->queues_pending_run);
                        ieee80211_wake_queue(&local->hw, i);
                        continue;
                }
 
+               clear_bit(i, local->queues_pending_run);
+               netif_start_subqueue(local->mdev, i);
+
                store = &local->pending_packet[i];
                tx.extra_frag = store->extra_frag;
                tx.num_extra_frag = store->num_extra_frag;
@@ -1922,6 +1923,8 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
 
        info = IEEE80211_SKB_CB(skb);
 
+       skb->do_not_encrypt = 1;
+
        info->band = band;
        rate_control_get_rate(local->mdev, sband, skb, &rsel);
 
@@ -1931,7 +1934,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
                               "no rate found\n",
                               wiphy_name(local->hw.wiphy));
                }
-               dev_kfree_skb(skb);
+               dev_kfree_skb_any(skb);
                skb = NULL;
                goto out;
        }
@@ -1940,7 +1943,6 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
        info->tx_rate_idx = rsel.rate_idx;
 
        info->flags |= IEEE80211_TX_CTL_NO_ACK;
-       info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT;
        info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
        info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ;
        if (sdata->bss_conf.use_short_preamble &&
index 19f85e1..0d463c8 100644 (file)
@@ -361,6 +361,7 @@ void ieee80211_wake_queue(struct ieee80211_hw *hw, int queue)
        struct ieee80211_local *local = hw_to_local(hw);
 
        if (test_bit(queue, local->queues_pending)) {
+               set_bit(queue, local->queues_pending_run);
                tasklet_schedule(&local->tx_pending_tasklet);
        } else {
                netif_wake_subqueue(local->mdev, queue);
index 872d2fc..5c2bf0a 100644 (file)
@@ -31,13 +31,13 @@ int ieee80211_wep_init(struct ieee80211_local *local)
        local->wep_tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0,
                                                CRYPTO_ALG_ASYNC);
        if (IS_ERR(local->wep_tx_tfm))
-               return -ENOMEM;
+               return PTR_ERR(local->wep_tx_tfm);
 
        local->wep_rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0,
                                                CRYPTO_ALG_ASYNC);
        if (IS_ERR(local->wep_rx_tfm)) {
                crypto_free_blkcipher(local->wep_tx_tfm);
-               return -ENOMEM;
+               return PTR_ERR(local->wep_rx_tfm);
        }
 
        return 0;
index 07edda0..4310e2f 100644 (file)
@@ -188,6 +188,9 @@ int ieee80211_ht_agg_queue_add(struct ieee80211_local *local,
 {
        int i;
 
+       /* XXX: currently broken due to cb/requeue use */
+       return -EPERM;
+
        /* prepare the filter and save it for the SW queue
         * matching the received HW queue */
 
@@ -238,12 +241,14 @@ void ieee80211_ht_agg_queue_remove(struct ieee80211_local *local,
        } else {
                struct netdev_queue *txq;
                spinlock_t *root_lock;
+               struct Qdisc *q;
 
                txq = netdev_get_tx_queue(local->mdev, agg_queue);
-               root_lock = qdisc_root_lock(txq->qdisc);
+               q = rcu_dereference(txq->qdisc);
+               root_lock = qdisc_lock(q);
 
                spin_lock_bh(root_lock);
-               qdisc_reset(txq->qdisc);
+               qdisc_reset(q);
                spin_unlock_bh(root_lock);
        }
 }
index 420a10d..6f61261 100644 (file)
@@ -67,7 +67,8 @@ static const char *const tcp_conntrack_names[] = {
 /* RFC1122 says the R2 limit should be at least 100 seconds.
    Linux uses 15 packets as limit, which corresponds
    to ~13-30min depending on RTO. */
-static unsigned int nf_ct_tcp_timeout_max_retrans __read_mostly =   5 MINS;
+static unsigned int nf_ct_tcp_timeout_max_retrans __read_mostly    =   5 MINS;
+static unsigned int nf_ct_tcp_timeout_unacknowledged __read_mostly =   5 MINS;
 
 static unsigned int tcp_timeouts[TCP_CONNTRACK_MAX] __read_mostly = {
        [TCP_CONNTRACK_SYN_SENT]        = 2 MINS,
@@ -625,8 +626,10 @@ static bool tcp_in_window(const struct nf_conn *ct,
                swin = win + (sack - ack);
                if (sender->td_maxwin < swin)
                        sender->td_maxwin = swin;
-               if (after(end, sender->td_end))
+               if (after(end, sender->td_end)) {
                        sender->td_end = end;
+                       sender->flags |= IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED;
+               }
                /*
                 * Update receiver data.
                 */
@@ -637,6 +640,8 @@ static bool tcp_in_window(const struct nf_conn *ct,
                        if (win == 0)
                                receiver->td_maxend++;
                }
+               if (ack == receiver->td_end)
+                       receiver->flags &= ~IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED;
 
                /*
                 * Check retransmissions.
@@ -951,9 +956,16 @@ static int tcp_packet(struct nf_conn *ct,
        if (old_state != new_state
            && new_state == TCP_CONNTRACK_FIN_WAIT)
                ct->proto.tcp.seen[dir].flags |= IP_CT_TCP_FLAG_CLOSE_INIT;
-       timeout = ct->proto.tcp.retrans >= nf_ct_tcp_max_retrans
-                 && tcp_timeouts[new_state] > nf_ct_tcp_timeout_max_retrans
-                 ? nf_ct_tcp_timeout_max_retrans : tcp_timeouts[new_state];
+
+       if (ct->proto.tcp.retrans >= nf_ct_tcp_max_retrans &&
+           tcp_timeouts[new_state] > nf_ct_tcp_timeout_max_retrans)
+               timeout = nf_ct_tcp_timeout_max_retrans;
+       else if ((ct->proto.tcp.seen[0].flags | ct->proto.tcp.seen[1].flags) &
+                IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED &&
+                tcp_timeouts[new_state] > nf_ct_tcp_timeout_unacknowledged)
+               timeout = nf_ct_tcp_timeout_unacknowledged;
+       else
+               timeout = tcp_timeouts[new_state];
        write_unlock_bh(&tcp_lock);
 
        nf_conntrack_event_cache(IPCT_PROTOINFO_VOLATILE, skb);
@@ -1235,6 +1247,13 @@ static struct ctl_table tcp_sysctl_table[] = {
                .mode           = 0644,
                .proc_handler   = &proc_dointvec_jiffies,
        },
+       {
+               .procname       = "nf_conntrack_tcp_timeout_unacknowledged",
+               .data           = &nf_ct_tcp_timeout_unacknowledged,
+               .maxlen         = sizeof(unsigned int),
+               .mode           = 0644,
+               .proc_handler   = &proc_dointvec_jiffies,
+       },
        {
                .ctl_name       = NET_NF_CONNTRACK_TCP_LOOSE,
                .procname       = "nf_conntrack_tcp_loose",
index 6809af5..d9418a2 100644 (file)
@@ -367,9 +367,7 @@ static void htable_gc(unsigned long htlong)
 
 static void htable_destroy(struct xt_hashlimit_htable *hinfo)
 {
-       /* remove timer, if it is pending */
-       if (timer_pending(&hinfo->timer))
-               del_timer(&hinfo->timer);
+       del_timer_sync(&hinfo->timer);
 
        /* remove proc entry */
        remove_proc_entry(hinfo->pde->name,
index 8aa8227..e5b6955 100644 (file)
@@ -109,6 +109,25 @@ static DEFINE_RFKILL_TASK(rfkill_uwb, RFKILL_TYPE_UWB);
 static DEFINE_RFKILL_TASK(rfkill_wimax, RFKILL_TYPE_WIMAX);
 static DEFINE_RFKILL_TASK(rfkill_wwan, RFKILL_TYPE_WWAN);
 
+static void rfkill_schedule_evsw_rfkillall(int state)
+{
+       /* EVERY radio type. state != 0 means radios ON */
+       /* handle EPO (emergency power off) through shortcut */
+       if (state) {
+               rfkill_schedule_set(&rfkill_wwan,
+                                   RFKILL_STATE_UNBLOCKED);
+               rfkill_schedule_set(&rfkill_wimax,
+                                   RFKILL_STATE_UNBLOCKED);
+               rfkill_schedule_set(&rfkill_uwb,
+                                   RFKILL_STATE_UNBLOCKED);
+               rfkill_schedule_set(&rfkill_bt,
+                                   RFKILL_STATE_UNBLOCKED);
+               rfkill_schedule_set(&rfkill_wlan,
+                                   RFKILL_STATE_UNBLOCKED);
+       } else
+               rfkill_schedule_epo();
+}
+
 static void rfkill_event(struct input_handle *handle, unsigned int type,
                        unsigned int code, int data)
 {
@@ -132,21 +151,7 @@ static void rfkill_event(struct input_handle *handle, unsigned int type,
        } else if (type == EV_SW) {
                switch (code) {
                case SW_RFKILL_ALL:
-                       /* EVERY radio type. data != 0 means radios ON */
-                       /* handle EPO (emergency power off) through shortcut */
-                       if (data) {
-                               rfkill_schedule_set(&rfkill_wwan,
-                                                   RFKILL_STATE_UNBLOCKED);
-                               rfkill_schedule_set(&rfkill_wimax,
-                                                   RFKILL_STATE_UNBLOCKED);
-                               rfkill_schedule_set(&rfkill_uwb,
-                                                   RFKILL_STATE_UNBLOCKED);
-                               rfkill_schedule_set(&rfkill_bt,
-                                                   RFKILL_STATE_UNBLOCKED);
-                               rfkill_schedule_set(&rfkill_wlan,
-                                                   RFKILL_STATE_UNBLOCKED);
-                       } else
-                               rfkill_schedule_epo();
+                       rfkill_schedule_evsw_rfkillall(data);
                        break;
                default:
                        break;
@@ -168,6 +173,7 @@ static int rfkill_connect(struct input_handler *handler, struct input_dev *dev,
        handle->handler = handler;
        handle->name = "rfkill";
 
+       /* causes rfkill_start() to be called */
        error = input_register_handle(handle);
        if (error)
                goto err_free_handle;
@@ -185,6 +191,23 @@ static int rfkill_connect(struct input_handler *handler, struct input_dev *dev,
        return error;
 }
 
+static void rfkill_start(struct input_handle *handle)
+{
+       /* Take event_lock to guard against configuration changes, we
+        * should be able to deal with concurrency with rfkill_event()
+        * just fine (which event_lock will also avoid). */
+       spin_lock_irq(&handle->dev->event_lock);
+
+       if (test_bit(EV_SW, handle->dev->evbit)) {
+               if (test_bit(SW_RFKILL_ALL, handle->dev->swbit))
+                       rfkill_schedule_evsw_rfkillall(test_bit(SW_RFKILL_ALL,
+                                                       handle->dev->sw));
+               /* add resync for further EV_SW events here */
+       }
+
+       spin_unlock_irq(&handle->dev->event_lock);
+}
+
 static void rfkill_disconnect(struct input_handle *handle)
 {
        input_close_device(handle);
@@ -225,6 +248,7 @@ static struct input_handler rfkill_handler = {
        .event =        rfkill_event,
        .connect =      rfkill_connect,
        .disconnect =   rfkill_disconnect,
+       .start =        rfkill_start,
        .name =         "rfkill",
        .id_table =     rfkill_ids,
 };
index 7a560b7..d2d4565 100644 (file)
@@ -105,6 +105,16 @@ static void rfkill_led_trigger(struct rfkill *rfkill,
 #endif /* CONFIG_RFKILL_LEDS */
 }
 
+#ifdef CONFIG_RFKILL_LEDS
+static void rfkill_led_trigger_activate(struct led_classdev *led)
+{
+       struct rfkill *rfkill = container_of(led->trigger,
+                       struct rfkill, led_trigger);
+
+       rfkill_led_trigger(rfkill, rfkill->state);
+}
+#endif /* CONFIG_RFKILL_LEDS */
+
 static void notify_rfkill_state_change(struct rfkill *rfkill)
 {
        blocking_notifier_call_chain(&rfkill_notifier_list,
@@ -130,7 +140,6 @@ static void update_rfkill_state(struct rfkill *rfkill)
 
 /**
  * rfkill_toggle_radio - wrapper for toggle_radio hook
- *
  * @rfkill: the rfkill struct to use
  * @force: calls toggle_radio even if cache says it is not needed,
  *     and also makes sure notifications of the state will be
@@ -141,8 +150,8 @@ static void update_rfkill_state(struct rfkill *rfkill)
  * calls and handling all the red tape such as issuing notifications
  * if the call is successful.
  *
- * Note that @force cannot override a (possibly cached) state of
- * RFKILL_STATE_HARD_BLOCKED.  Any device making use of
+ * Note that the @force parameter cannot override a (possibly cached)
+ * state of RFKILL_STATE_HARD_BLOCKED.  Any device making use of
  * RFKILL_STATE_HARD_BLOCKED implements either get_state() or
  * rfkill_force_state(), so the cache either is bypassed or valid.
  *
@@ -150,7 +159,7 @@ static void update_rfkill_state(struct rfkill *rfkill)
  * even if the radio is in RFKILL_STATE_HARD_BLOCKED state, so as to
  * give the driver a hint that it should double-BLOCK the transmitter.
  *
- * Caller must have aquired rfkill_mutex.
+ * Caller must have acquired rfkill->mutex.
  */
 static int rfkill_toggle_radio(struct rfkill *rfkill,
                                enum rfkill_state state,
@@ -200,12 +209,12 @@ static int rfkill_toggle_radio(struct rfkill *rfkill,
 
 /**
  * rfkill_switch_all - Toggle state of all switches of given type
- * @type: type of interfaces to be affeceted
+ * @type: type of interfaces to be affected
  * @state: the new state
  *
- * This function toggles state of all switches of given type unless
- * a specific switch is claimed by userspace in which case it is
- * left alone.
+ * This function toggles the state of all switches of given type,
+ * unless a specific switch is claimed by userspace (in which case,
+ * that switch is left alone).
  */
 void rfkill_switch_all(enum rfkill_type type, enum rfkill_state state)
 {
@@ -216,8 +225,11 @@ void rfkill_switch_all(enum rfkill_type type, enum rfkill_state state)
        rfkill_states[type] = state;
 
        list_for_each_entry(rfkill, &rfkill_list, node) {
-               if ((!rfkill->user_claim) && (rfkill->type == type))
+               if ((!rfkill->user_claim) && (rfkill->type == type)) {
+                       mutex_lock(&rfkill->mutex);
                        rfkill_toggle_radio(rfkill, state, 0);
+                       mutex_unlock(&rfkill->mutex);
+               }
        }
 
        mutex_unlock(&rfkill_mutex);
@@ -228,7 +240,7 @@ EXPORT_SYMBOL(rfkill_switch_all);
  * rfkill_epo - emergency power off all transmitters
  *
  * This kicks all rfkill devices to RFKILL_STATE_SOFT_BLOCKED, ignoring
- * everything in its path but rfkill_mutex.
+ * everything in its path but rfkill_mutex and rfkill->mutex.
  */
 void rfkill_epo(void)
 {
@@ -236,7 +248,9 @@ void rfkill_epo(void)
 
        mutex_lock(&rfkill_mutex);
        list_for_each_entry(rfkill, &rfkill_list, node) {
+               mutex_lock(&rfkill->mutex);
                rfkill_toggle_radio(rfkill, RFKILL_STATE_SOFT_BLOCKED, 1);
+               mutex_unlock(&rfkill->mutex);
        }
        mutex_unlock(&rfkill_mutex);
 }
@@ -252,7 +266,12 @@ EXPORT_SYMBOL_GPL(rfkill_epo);
  * a notification by the firmware/hardware of the current *real*
  * state of the radio rfkill switch.
  *
- * It may not be called from an atomic context.
+ * Devices which are subject to external changes on their rfkill
+ * state (such as those caused by a hardware rfkill line) MUST
+ * have their driver arrange to call rfkill_force_state() as soon
+ * as possible after such a change.
+ *
+ * This function may not be called from an atomic context.
  */
 int rfkill_force_state(struct rfkill *rfkill, enum rfkill_state state)
 {
@@ -367,6 +386,9 @@ static ssize_t rfkill_claim_store(struct device *dev,
        if (!capable(CAP_NET_ADMIN))
                return -EPERM;
 
+       if (rfkill->user_claim_unsupported)
+               return -EOPNOTSUPP;
+
        /*
         * Take the global lock to make sure the kernel is not in
         * the middle of rfkill_switch_all
@@ -375,19 +397,17 @@ static ssize_t rfkill_claim_store(struct device *dev,
        if (error)
                return error;
 
-       if (rfkill->user_claim_unsupported) {
-               error = -EOPNOTSUPP;
-               goto out_unlock;
-       }
        if (rfkill->user_claim != claim) {
-               if (!claim)
+               if (!claim) {
+                       mutex_lock(&rfkill->mutex);
                        rfkill_toggle_radio(rfkill,
                                            rfkill_states[rfkill->type],
                                            0);
+                       mutex_unlock(&rfkill->mutex);
+               }
                rfkill->user_claim = claim;
        }
 
-out_unlock:
        mutex_unlock(&rfkill_mutex);
 
        return error ? error : count;
@@ -516,8 +536,11 @@ static void rfkill_remove_switch(struct rfkill *rfkill)
 {
        mutex_lock(&rfkill_mutex);
        list_del_init(&rfkill->node);
-       rfkill_toggle_radio(rfkill, RFKILL_STATE_SOFT_BLOCKED, 1);
        mutex_unlock(&rfkill_mutex);
+
+       mutex_lock(&rfkill->mutex);
+       rfkill_toggle_radio(rfkill, RFKILL_STATE_SOFT_BLOCKED, 1);
+       mutex_unlock(&rfkill->mutex);
 }
 
 /**
@@ -526,9 +549,10 @@ static void rfkill_remove_switch(struct rfkill *rfkill)
  * @type: type of the switch (RFKILL_TYPE_*)
  *
  * This function should be called by the network driver when it needs
- * rfkill structure. Once the structure is allocated the driver shoud
- * finish its initialization by setting name, private data, enable_radio
+ * rfkill structure.  Once the structure is allocated the driver should
+ * finish its initialization by setting the name, private data, enable_radio
  * and disable_radio methods and then register it with rfkill_register().
+ *
  * NOTE: If registration fails the structure shoudl be freed by calling
  * rfkill_free() otherwise rfkill_unregister() should be used.
  */
@@ -560,7 +584,7 @@ EXPORT_SYMBOL(rfkill_allocate);
  * rfkill_free - Mark rfkill structure for deletion
  * @rfkill: rfkill structure to be destroyed
  *
- * Decrements reference count of rfkill structure so it is destroyed.
+ * Decrements reference count of the rfkill structure so it is destroyed.
  * Note that rfkill_free() should _not_ be called after rfkill_unregister().
  */
 void rfkill_free(struct rfkill *rfkill)
@@ -575,7 +599,10 @@ static void rfkill_led_trigger_register(struct rfkill *rfkill)
 #ifdef CONFIG_RFKILL_LEDS
        int error;
 
-       rfkill->led_trigger.name = rfkill->dev.bus_id;
+       if (!rfkill->led_trigger.name)
+               rfkill->led_trigger.name = rfkill->dev.bus_id;
+       if (!rfkill->led_trigger.activate)
+               rfkill->led_trigger.activate = rfkill_led_trigger_activate;
        error = led_trigger_register(&rfkill->led_trigger);
        if (error)
                rfkill->led_trigger.name = NULL;
@@ -585,8 +612,10 @@ static void rfkill_led_trigger_register(struct rfkill *rfkill)
 static void rfkill_led_trigger_unregister(struct rfkill *rfkill)
 {
 #ifdef CONFIG_RFKILL_LEDS
-       if (rfkill->led_trigger.name)
+       if (rfkill->led_trigger.name) {
                led_trigger_unregister(&rfkill->led_trigger);
+               rfkill->led_trigger.name = NULL;
+       }
 #endif
 }
 
@@ -622,8 +651,8 @@ int rfkill_register(struct rfkill *rfkill)
 
        error = device_add(dev);
        if (error) {
-               rfkill_led_trigger_unregister(rfkill);
                rfkill_remove_switch(rfkill);
+               rfkill_led_trigger_unregister(rfkill);
                return error;
        }
 
index b060164..4840aff 100644 (file)
@@ -572,44 +572,21 @@ static u32 qdisc_alloc_handle(struct net_device *dev)
 static struct Qdisc *dev_graft_qdisc(struct netdev_queue *dev_queue,
                                     struct Qdisc *qdisc)
 {
+       struct Qdisc *oqdisc = dev_queue->qdisc_sleeping;
        spinlock_t *root_lock;
-       struct Qdisc *oqdisc;
-       int ingress;
-
-       ingress = 0;
-       if (qdisc && qdisc->flags&TCQ_F_INGRESS)
-               ingress = 1;
-
-       if (ingress) {
-               oqdisc = dev_queue->qdisc;
-       } else {
-               oqdisc = dev_queue->qdisc_sleeping;
-       }
 
        root_lock = qdisc_root_lock(oqdisc);
        spin_lock_bh(root_lock);
 
-       if (ingress) {
-               /* Prune old scheduler */
-               if (oqdisc && atomic_read(&oqdisc->refcnt) <= 1) {
-                       /* delete */
-                       qdisc_reset(oqdisc);
-                       dev_queue->qdisc = NULL;
-               } else {  /* new */
-                       dev_queue->qdisc = qdisc;
-               }
+       /* Prune old scheduler */
+       if (oqdisc && atomic_read(&oqdisc->refcnt) <= 1)
+               qdisc_reset(oqdisc);
 
-       } else {
-               /* Prune old scheduler */
-               if (oqdisc && atomic_read(&oqdisc->refcnt) <= 1)
-                       qdisc_reset(oqdisc);
-
-               /* ... and graft new one */
-               if (qdisc == NULL)
-                       qdisc = &noop_qdisc;
-               dev_queue->qdisc_sleeping = qdisc;
-               dev_queue->qdisc = &noop_qdisc;
-       }
+       /* ... and graft new one */
+       if (qdisc == NULL)
+               qdisc = &noop_qdisc;
+       dev_queue->qdisc_sleeping = qdisc;
+       dev_queue->qdisc = &noop_qdisc;
 
        spin_unlock_bh(root_lock);
 
@@ -678,7 +655,8 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,
 
                ingress = 0;
                num_q = dev->num_tx_queues;
-               if (q && q->flags & TCQ_F_INGRESS) {
+               if ((q && q->flags & TCQ_F_INGRESS) ||
+                   (new && new->flags & TCQ_F_INGRESS)) {
                        num_q = 1;
                        ingress = 1;
                }
@@ -692,13 +670,10 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,
                        if (!ingress)
                                dev_queue = netdev_get_tx_queue(dev, i);
 
-                       if (ingress) {
-                               old = dev_graft_qdisc(dev_queue, q);
-                       } else {
-                               old = dev_graft_qdisc(dev_queue, new);
-                               if (new && i > 0)
-                                       atomic_inc(&new->refcnt);
-                       }
+                       old = dev_graft_qdisc(dev_queue, new);
+                       if (new && i > 0)
+                               atomic_inc(&new->refcnt);
+
                        notify_and_destroy(skb, n, classid, old, new);
                }
 
@@ -817,7 +792,7 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue,
                                goto err_out3;
                        }
                }
-               if (parent)
+               if (parent && !(sch->flags & TCQ_F_INGRESS))
                        list_add_tail(&sch->list, &dev_queue->qdisc->list);
 
                return sch;
index 6b517b9..43d3725 100644 (file)
@@ -415,7 +415,7 @@ static int atm_tc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
                case TC_ACT_QUEUED:
                case TC_ACT_STOLEN:
                        kfree_skb(skb);
-                       return NET_XMIT_SUCCESS;
+                       return NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
                case TC_ACT_SHOT:
                        kfree_skb(skb);
                        goto drop;
@@ -432,9 +432,11 @@ static int atm_tc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
        ret = qdisc_enqueue(skb, flow->q);
        if (ret != 0) {
 drop: __maybe_unused
-               sch->qstats.drops++;
-               if (flow)
-                       flow->qstats.drops++;
+               if (net_xmit_drop_count(ret)) {
+                       sch->qstats.drops++;
+                       if (flow)
+                               flow->qstats.drops++;
+               }
                return ret;
        }
        sch->bstats.bytes += qdisc_pkt_len(skb);
@@ -455,7 +457,7 @@ drop: __maybe_unused
                return 0;
        }
        tasklet_schedule(&p->task);
-       return NET_XMIT_BYPASS;
+       return NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
 }
 
 /*
@@ -530,7 +532,7 @@ static int atm_tc_requeue(struct sk_buff *skb, struct Qdisc *sch)
        if (!ret) {
                sch->q.qlen++;
                sch->qstats.requeues++;
-       } else {
+       } else if (net_xmit_drop_count(ret)) {
                sch->qstats.drops++;
                p->link.qstats.drops++;
        }
index 14954bf..4e261ce 100644 (file)
@@ -230,7 +230,7 @@ cbq_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
            (cl = cbq_class_lookup(q, prio)) != NULL)
                return cl;
 
-       *qerr = NET_XMIT_BYPASS;
+       *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
        for (;;) {
                int result = 0;
                defmap = head->defaults;
@@ -256,7 +256,7 @@ cbq_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
                switch (result) {
                case TC_ACT_QUEUED:
                case TC_ACT_STOLEN:
-                       *qerr = NET_XMIT_SUCCESS;
+                       *qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
                case TC_ACT_SHOT:
                        return NULL;
                case TC_ACT_RECLASSIFY:
@@ -377,7 +377,7 @@ cbq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
        q->rx_class = cl;
 #endif
        if (cl == NULL) {
-               if (ret == NET_XMIT_BYPASS)
+               if (ret & __NET_XMIT_BYPASS)
                        sch->qstats.drops++;
                kfree_skb(skb);
                return ret;
@@ -397,9 +397,11 @@ cbq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
                return ret;
        }
 
-       sch->qstats.drops++;
-       cbq_mark_toplevel(q, cl);
-       cl->qstats.drops++;
+       if (net_xmit_drop_count(ret)) {
+               sch->qstats.drops++;
+               cbq_mark_toplevel(q, cl);
+               cl->qstats.drops++;
+       }
        return ret;
 }
 
@@ -430,8 +432,10 @@ cbq_requeue(struct sk_buff *skb, struct Qdisc *sch)
                        cbq_activate_class(cl);
                return 0;
        }
-       sch->qstats.drops++;
-       cl->qstats.drops++;
+       if (net_xmit_drop_count(ret)) {
+               sch->qstats.drops++;
+               cl->qstats.drops++;
+       }
        return ret;
 }
 
@@ -664,13 +668,15 @@ static int cbq_reshape_fail(struct sk_buff *skb, struct Qdisc *child)
        q->rx_class = NULL;
 
        if (cl && (cl = cbq_reclassify(skb, cl)) != NULL) {
+               int ret;
 
                cbq_mark_toplevel(q, cl);
 
                q->rx_class = cl;
                cl->q->__parent = sch;
 
-               if (qdisc_enqueue(skb, cl->q) == 0) {
+               ret = qdisc_enqueue(skb, cl->q);
+               if (ret == NET_XMIT_SUCCESS) {
                        sch->q.qlen++;
                        sch->bstats.packets++;
                        sch->bstats.bytes += qdisc_pkt_len(skb);
@@ -678,7 +684,8 @@ static int cbq_reshape_fail(struct sk_buff *skb, struct Qdisc *child)
                                cbq_activate_class(cl);
                        return 0;
                }
-               sch->qstats.drops++;
+               if (net_xmit_drop_count(ret))
+                       sch->qstats.drops++;
                return 0;
        }
 
index a935676..edd1298 100644 (file)
@@ -236,7 +236,7 @@ static int dsmark_enqueue(struct sk_buff *skb, struct Qdisc *sch)
                case TC_ACT_QUEUED:
                case TC_ACT_STOLEN:
                        kfree_skb(skb);
-                       return NET_XMIT_SUCCESS;
+                       return NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
 
                case TC_ACT_SHOT:
                        goto drop;
@@ -254,7 +254,8 @@ static int dsmark_enqueue(struct sk_buff *skb, struct Qdisc *sch)
 
        err = qdisc_enqueue(skb, p->q);
        if (err != NET_XMIT_SUCCESS) {
-               sch->qstats.drops++;
+               if (net_xmit_drop_count(err))
+                       sch->qstats.drops++;
                return err;
        }
 
@@ -267,7 +268,7 @@ static int dsmark_enqueue(struct sk_buff *skb, struct Qdisc *sch)
 drop:
        kfree_skb(skb);
        sch->qstats.drops++;
-       return NET_XMIT_BYPASS;
+       return NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
 }
 
 static struct sk_buff *dsmark_dequeue(struct Qdisc *sch)
@@ -321,7 +322,8 @@ static int dsmark_requeue(struct sk_buff *skb, struct Qdisc *sch)
 
        err = p->q->ops->requeue(skb, p->q);
        if (err != NET_XMIT_SUCCESS) {
-               sch->qstats.drops++;
+               if (net_xmit_drop_count(err))
+                       sch->qstats.drops++;
                return err;
        }
 
index fd2a6ca..7cf83b3 100644 (file)
@@ -29,7 +29,7 @@
 /* Main transmission queue. */
 
 /* Modifications to data participating in scheduling must be protected with
- * qdisc_root_lock(qdisc) spinlock.
+ * qdisc_lock(qdisc) spinlock.
  *
  * The idea is the following:
  * - enqueue, dequeue are serialized via qdisc root lock
@@ -126,7 +126,7 @@ static inline int qdisc_restart(struct Qdisc *q)
        if (unlikely((skb = dequeue_skb(q)) == NULL))
                return 0;
 
-       root_lock = qdisc_root_lock(q);
+       root_lock = qdisc_lock(q);
 
        /* And release qdisc */
        spin_unlock(root_lock);
@@ -135,7 +135,8 @@ static inline int qdisc_restart(struct Qdisc *q)
        txq = netdev_get_tx_queue(dev, skb_get_queue_mapping(skb));
 
        HARD_TX_LOCK(dev, txq, smp_processor_id());
-       if (!netif_subqueue_stopped(dev, skb))
+       if (!netif_tx_queue_stopped(txq) &&
+           !netif_tx_queue_frozen(txq))
                ret = dev_hard_start_xmit(skb, dev, txq);
        HARD_TX_UNLOCK(dev, txq);
 
@@ -162,7 +163,8 @@ static inline int qdisc_restart(struct Qdisc *q)
                break;
        }
 
-       if (ret && netif_tx_queue_stopped(txq))
+       if (ret && (netif_tx_queue_stopped(txq) ||
+                   netif_tx_queue_frozen(txq)))
                ret = 0;
 
        return ret;
@@ -505,7 +507,7 @@ errout:
 }
 EXPORT_SYMBOL(qdisc_create_dflt);
 
-/* Under qdisc_root_lock(qdisc) and BH! */
+/* Under qdisc_lock(qdisc) and BH! */
 
 void qdisc_reset(struct Qdisc *qdisc)
 {
@@ -541,7 +543,7 @@ static void __qdisc_destroy(struct rcu_head *head)
        kfree((char *) qdisc - qdisc->padded);
 }
 
-/* Under qdisc_root_lock(qdisc) and BH! */
+/* Under qdisc_lock(qdisc) and BH! */
 
 void qdisc_destroy(struct Qdisc *qdisc)
 {
@@ -596,7 +598,7 @@ static void transition_one_qdisc(struct net_device *dev,
        int *need_watchdog_p = _need_watchdog;
 
        rcu_assign_pointer(dev_queue->qdisc, new_qdisc);
-       if (new_qdisc != &noqueue_qdisc)
+       if (need_watchdog_p && new_qdisc != &noqueue_qdisc)
                *need_watchdog_p = 1;
 }
 
@@ -619,6 +621,7 @@ void dev_activate(struct net_device *dev)
 
        need_watchdog = 0;
        netdev_for_each_tx_queue(dev, transition_one_qdisc, &need_watchdog);
+       transition_one_qdisc(dev, &dev->rx_queue, NULL);
 
        if (need_watchdog) {
                dev->trans_start = jiffies;
@@ -656,7 +659,7 @@ static bool some_qdisc_is_running(struct net_device *dev, int lock)
 
                dev_queue = netdev_get_tx_queue(dev, i);
                q = dev_queue->qdisc;
-               root_lock = qdisc_root_lock(q);
+               root_lock = qdisc_lock(q);
 
                if (lock)
                        spin_lock_bh(root_lock);
@@ -677,6 +680,7 @@ void dev_deactivate(struct net_device *dev)
        bool running;
 
        netdev_for_each_tx_queue(dev, dev_deactivate_queue, &noop_qdisc);
+       dev_deactivate_queue(dev, &dev->rx_queue, &noop_qdisc);
 
        dev_watchdog_down(dev);
 
@@ -718,7 +722,7 @@ static void dev_init_scheduler_queue(struct net_device *dev,
 void dev_init_scheduler(struct net_device *dev)
 {
        netdev_for_each_tx_queue(dev, dev_init_scheduler_queue, &noop_qdisc);
-       dev_init_scheduler_queue(dev, &dev->rx_queue, NULL);
+       dev_init_scheduler_queue(dev, &dev->rx_queue, &noop_qdisc);
 
        setup_timer(&dev->watchdog_timer, dev_watchdog, (unsigned long)dev);
 }
@@ -731,7 +735,7 @@ static void shutdown_scheduler_queue(struct net_device *dev,
        struct Qdisc *qdisc_default = _qdisc_default;
 
        if (qdisc) {
-               spinlock_t *root_lock = qdisc_root_lock(qdisc);
+               spinlock_t *root_lock = qdisc_lock(qdisc);
 
                dev_queue->qdisc = qdisc_default;
                dev_queue->qdisc_sleeping = qdisc_default;
@@ -745,6 +749,6 @@ static void shutdown_scheduler_queue(struct net_device *dev,
 void dev_shutdown(struct net_device *dev)
 {
        netdev_for_each_tx_queue(dev, shutdown_scheduler_queue, &noop_qdisc);
-       shutdown_scheduler_queue(dev, &dev->rx_queue, NULL);
+       shutdown_scheduler_queue(dev, &dev->rx_queue, &noop_qdisc);
        WARN_ON(timer_pending(&dev->watchdog_timer));
 }
index 0ae7d19..c2b8d9c 100644 (file)
@@ -1159,14 +1159,14 @@ hfsc_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
                if (cl->level == 0)
                        return cl;
 
-       *qerr = NET_XMIT_BYPASS;
+       *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
        tcf = q->root.filter_list;
        while (tcf && (result = tc_classify(skb, tcf, &res)) >= 0) {
 #ifdef CONFIG_NET_CLS_ACT
                switch (result) {
                case TC_ACT_QUEUED:
                case TC_ACT_STOLEN:
-                       *qerr = NET_XMIT_SUCCESS;
+                       *qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
                case TC_ACT_SHOT:
                        return NULL;
                }
@@ -1578,7 +1578,7 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
 
        cl = hfsc_classify(skb, sch, &err);
        if (cl == NULL) {
-               if (err == NET_XMIT_BYPASS)
+               if (err & __NET_XMIT_BYPASS)
                        sch->qstats.drops++;
                kfree_skb(skb);
                return err;
@@ -1586,8 +1586,10 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
 
        err = qdisc_enqueue(skb, cl->qdisc);
        if (unlikely(err != NET_XMIT_SUCCESS)) {
-               cl->qstats.drops++;
-               sch->qstats.drops++;
+               if (net_xmit_drop_count(err)) {
+                       cl->qstats.drops++;
+                       sch->qstats.drops++;
+               }
                return err;
        }
 
index 75a4095..be35422 100644 (file)
@@ -214,14 +214,14 @@ static struct htb_class *htb_classify(struct sk_buff *skb, struct Qdisc *sch,
        if ((cl = htb_find(skb->priority, sch)) != NULL && cl->level == 0)
                return cl;
 
-       *qerr = NET_XMIT_BYPASS;
+       *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
        tcf = q->filter_list;
        while (tcf && (result = tc_classify(skb, tcf, &res)) >= 0) {
 #ifdef CONFIG_NET_CLS_ACT
                switch (result) {
                case TC_ACT_QUEUED:
                case TC_ACT_STOLEN:
-                       *qerr = NET_XMIT_SUCCESS;
+                       *qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
                case TC_ACT_SHOT:
                        return NULL;
                }
@@ -567,14 +567,16 @@ static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch)
                }
 #ifdef CONFIG_NET_CLS_ACT
        } else if (!cl) {
-               if (ret == NET_XMIT_BYPASS)
+               if (ret & __NET_XMIT_BYPASS)
                        sch->qstats.drops++;
                kfree_skb(skb);
                return ret;
 #endif
-       } else if (qdisc_enqueue(skb, cl->un.leaf.q) != NET_XMIT_SUCCESS) {
-               sch->qstats.drops++;
-               cl->qstats.drops++;
+       } else if ((ret = qdisc_enqueue(skb, cl->un.leaf.q)) != NET_XMIT_SUCCESS) {
+               if (net_xmit_drop_count(ret)) {
+                       sch->qstats.drops++;
+                       cl->qstats.drops++;
+               }
                return NET_XMIT_DROP;
        } else {
                cl->bstats.packets +=
@@ -610,15 +612,17 @@ static int htb_requeue(struct sk_buff *skb, struct Qdisc *sch)
                }
 #ifdef CONFIG_NET_CLS_ACT
        } else if (!cl) {
-               if (ret == NET_XMIT_BYPASS)
+               if (ret & __NET_XMIT_BYPASS)
                        sch->qstats.drops++;
                kfree_skb(skb);
                return ret;
 #endif
-       } else if (cl->un.leaf.q->ops->requeue(skb, cl->un.leaf.q) !=
+       } else if ((ret = cl->un.leaf.q->ops->requeue(skb, cl->un.leaf.q)) !=
                   NET_XMIT_SUCCESS) {
-               sch->qstats.drops++;
-               cl->qstats.drops++;
+               if (net_xmit_drop_count(ret)) {
+                       sch->qstats.drops++;
+                       cl->qstats.drops++;
+               }
                return NET_XMIT_DROP;
        } else
                htb_activate(q, cl);
index a590857..fb0294d 100644 (file)
@@ -176,7 +176,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
        if (count == 0) {
                sch->qstats.drops++;
                kfree_skb(skb);
-               return NET_XMIT_BYPASS;
+               return NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
        }
 
        skb_orphan(skb);
@@ -240,8 +240,9 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
                sch->q.qlen++;
                sch->bstats.bytes += qdisc_pkt_len(skb);
                sch->bstats.packets++;
-       } else
+       } else if (net_xmit_drop_count(ret)) {
                sch->qstats.drops++;
+       }
 
        pr_debug("netem: enqueue ret %d\n", ret);
        return ret;
index f849243..eac1976 100644 (file)
@@ -38,14 +38,14 @@ prio_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
        struct tcf_result res;
        int err;
 
-       *qerr = NET_XMIT_BYPASS;
+       *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
        if (TC_H_MAJ(skb->priority) != sch->handle) {
                err = tc_classify(skb, q->filter_list, &res);
 #ifdef CONFIG_NET_CLS_ACT
                switch (err) {
                case TC_ACT_STOLEN:
                case TC_ACT_QUEUED:
-                       *qerr = NET_XMIT_SUCCESS;
+                       *qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
                case TC_ACT_SHOT:
                        return NULL;
                }
@@ -74,7 +74,7 @@ prio_enqueue(struct sk_buff *skb, struct Qdisc *sch)
 #ifdef CONFIG_NET_CLS_ACT
        if (qdisc == NULL) {
 
-               if (ret == NET_XMIT_BYPASS)
+               if (ret & __NET_XMIT_BYPASS)
                        sch->qstats.drops++;
                kfree_skb(skb);
                return ret;
@@ -88,7 +88,8 @@ prio_enqueue(struct sk_buff *skb, struct Qdisc *sch)
                sch->q.qlen++;
                return NET_XMIT_SUCCESS;
        }
-       sch->qstats.drops++;
+       if (net_xmit_drop_count(ret))
+               sch->qstats.drops++;
        return ret;
 }
 
@@ -102,7 +103,7 @@ prio_requeue(struct sk_buff *skb, struct Qdisc* sch)
        qdisc = prio_classify(skb, sch, &ret);
 #ifdef CONFIG_NET_CLS_ACT
        if (qdisc == NULL) {
-               if (ret == NET_XMIT_BYPASS)
+               if (ret & __NET_XMIT_BYPASS)
                        sch->qstats.drops++;
                kfree_skb(skb);
                return ret;
@@ -114,7 +115,8 @@ prio_requeue(struct sk_buff *skb, struct Qdisc* sch)
                sch->qstats.requeues++;
                return 0;
        }
-       sch->qstats.drops++;
+       if (net_xmit_drop_count(ret))
+               sch->qstats.drops++;
        return NET_XMIT_DROP;
 }
 
index 3f2d1d7..5da0583 100644 (file)
@@ -97,7 +97,7 @@ static int red_enqueue(struct sk_buff *skb, struct Qdisc* sch)
                sch->bstats.bytes += qdisc_pkt_len(skb);
                sch->bstats.packets++;
                sch->q.qlen++;
-       } else {
+       } else if (net_xmit_drop_count(ret)) {
                q->stats.pdrop++;
                sch->qstats.drops++;
        }
index 8589da6..6e041d1 100644 (file)
@@ -171,14 +171,14 @@ static unsigned int sfq_classify(struct sk_buff *skb, struct Qdisc *sch,
        if (!q->filter_list)
                return sfq_hash(q, skb) + 1;
 
-       *qerr = NET_XMIT_BYPASS;
+       *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
        result = tc_classify(skb, q->filter_list, &res);
        if (result >= 0) {
 #ifdef CONFIG_NET_CLS_ACT
                switch (result) {
                case TC_ACT_STOLEN:
                case TC_ACT_QUEUED:
-                       *qerr = NET_XMIT_SUCCESS;
+                       *qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
                case TC_ACT_SHOT:
                        return 0;
                }
@@ -285,7 +285,7 @@ sfq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
 
        hash = sfq_classify(skb, sch, &ret);
        if (hash == 0) {
-               if (ret == NET_XMIT_BYPASS)
+               if (ret & __NET_XMIT_BYPASS)
                        sch->qstats.drops++;
                kfree_skb(skb);
                return ret;
@@ -339,7 +339,7 @@ sfq_requeue(struct sk_buff *skb, struct Qdisc *sch)
 
        hash = sfq_classify(skb, sch, &ret);
        if (hash == 0) {
-               if (ret == NET_XMIT_BYPASS)
+               if (ret & __NET_XMIT_BYPASS)
                        sch->qstats.drops++;
                kfree_skb(skb);
                return ret;
index b296672..7d3b7ff 100644 (file)
@@ -135,7 +135,8 @@ static int tbf_enqueue(struct sk_buff *skb, struct Qdisc* sch)
 
        ret = qdisc_enqueue(skb, q->qdisc);
        if (ret != 0) {
-               sch->qstats.drops++;
+               if (net_xmit_drop_count(ret))
+                       sch->qstats.drops++;
                return ret;
        }
 
index 5372236..2c35c67 100644 (file)
@@ -305,10 +305,11 @@ restart:
 
                switch (teql_resolve(skb, skb_res, slave)) {
                case 0:
-                       if (netif_tx_trylock(slave)) {
-                               if (!__netif_subqueue_stopped(slave, subq) &&
+                       if (__netif_tx_trylock(slave_txq)) {
+                               if (!netif_tx_queue_stopped(slave_txq) &&
+                                   !netif_tx_queue_frozen(slave_txq) &&
                                    slave->hard_start_xmit(skb, slave) == 0) {
-                                       netif_tx_unlock(slave);
+                                       __netif_tx_unlock(slave_txq);
                                        master->slaves = NEXT_SLAVE(q);
                                        netif_wake_queue(dev);
                                        master->stats.tx_packets++;
@@ -316,7 +317,7 @@ restart:
                                                qdisc_pkt_len(skb);
                                        return 0;
                                }
-                               netif_tx_unlock(slave);
+                               __netif_tx_unlock(slave_txq);
                        }
                        if (netif_queue_stopped(dev))
                                busy = 1;
index a238d68..483a01d 100644 (file)
@@ -195,8 +195,7 @@ out:
 }
 
 /* Based on tcp_v6_xmit() in tcp_ipv6.c. */
-static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *transport,
-                       int ipfragok)
+static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *transport)
 {
        struct sock *sk = skb->sk;
        struct ipv6_pinfo *np = inet6_sk(sk);
@@ -231,7 +230,10 @@ static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *transport,
 
        SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS);
 
-       return ip6_xmit(sk, skb, &fl, np->opt, ipfragok);
+       if (!(transport->param_flags & SPP_PMTUD_ENABLE))
+               skb->local_df = 1;
+
+       return ip6_xmit(sk, skb, &fl, np->opt, 0);
 }
 
 /* Returns the dst cache entry for the given source and destination ip
index 4568464..0dc4a7d 100644 (file)
@@ -586,10 +586,8 @@ int sctp_packet_transmit(struct sctp_packet *packet)
        SCTP_DEBUG_PRINTK("***sctp_transmit_packet*** skb len %d\n",
                          nskb->len);
 
-       if (tp->param_flags & SPP_PMTUD_ENABLE)
-               (*tp->af_specific->sctp_xmit)(nskb, tp, packet->ipfragok);
-       else
-               (*tp->af_specific->sctp_xmit)(nskb, tp, 1);
+       nskb->local_df = packet->ipfragok;
+       (*tp->af_specific->sctp_xmit)(nskb, tp);
 
 out:
        packet->size = packet->overhead;
index a6e0818..0b65354 100644 (file)
@@ -862,16 +862,21 @@ static int sctp_inet_supported_addrs(const struct sctp_sock *opt,
 
 /* Wrapper routine that calls the ip transmit routine. */
 static inline int sctp_v4_xmit(struct sk_buff *skb,
-                              struct sctp_transport *transport, int ipfragok)
+                              struct sctp_transport *transport)
 {
+       struct inet_sock *inet = inet_sk(skb->sk);
+
        SCTP_DEBUG_PRINTK("%s: skb:%p, len:%d, "
                          "src:%u.%u.%u.%u, dst:%u.%u.%u.%u\n",
                          __func__, skb, skb->len,
                          NIPQUAD(skb->rtable->rt_src),
                          NIPQUAD(skb->rtable->rt_dst));
 
+       inet->pmtudisc = transport->param_flags & SPP_PMTUD_ENABLE ?
+                        IP_PMTUDISC_DO : IP_PMTUDISC_DONT;
+
        SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS);
-       return ip_queue_xmit(skb, ipfragok);
+       return ip_queue_xmit(skb, 0);
 }
 
 static struct sctp_af sctp_af_inet;
index b7fefff..59eb2cf 100644 (file)
@@ -29,16 +29,16 @@ static struct genl_family nl80211_fam = {
 };
 
 /* internal helper: get drv and dev */
-static int get_drv_dev_by_info_ifindex(struct genl_info *info,
+static int get_drv_dev_by_info_ifindex(struct nlattr **attrs,
                                       struct cfg80211_registered_device **drv,
                                       struct net_device **dev)
 {
        int ifindex;
 
-       if (!info->attrs[NL80211_ATTR_IFINDEX])
+       if (!attrs[NL80211_ATTR_IFINDEX])
                return -EINVAL;
 
-       ifindex = nla_get_u32(info->attrs[NL80211_ATTR_IFINDEX]);
+       ifindex = nla_get_u32(attrs[NL80211_ATTR_IFINDEX]);
        *dev = dev_get_by_index(&init_net, ifindex);
        if (!*dev)
                return -ENODEV;
@@ -291,21 +291,31 @@ static int nl80211_dump_interface(struct sk_buff *skb, struct netlink_callback *
 
        mutex_lock(&cfg80211_drv_mutex);
        list_for_each_entry(dev, &cfg80211_drv_list, list) {
-               if (++wp_idx < wp_start)
+               if (wp_idx < wp_start) {
+                       wp_idx++;
                        continue;
+               }
                if_idx = 0;
 
                mutex_lock(&dev->devlist_mtx);
                list_for_each_entry(wdev, &dev->netdev_list, list) {
-                       if (++if_idx < if_start)
+                       if (if_idx < if_start) {
+                               if_idx++;
                                continue;
+                       }
                        if (nl80211_send_iface(skb, NETLINK_CB(cb->skb).pid,
                                               cb->nlh->nlmsg_seq, NLM_F_MULTI,
-                                              wdev->netdev) < 0)
-                               break;
+                                              wdev->netdev) < 0) {
+                               mutex_unlock(&dev->devlist_mtx);
+                               goto out;
+                       }
+                       if_idx++;
                }
                mutex_unlock(&dev->devlist_mtx);
+
+               wp_idx++;
        }
+ out:
        mutex_unlock(&cfg80211_drv_mutex);
 
        cb->args[0] = wp_idx;
@@ -321,7 +331,7 @@ static int nl80211_get_interface(struct sk_buff *skb, struct genl_info *info)
        struct net_device *netdev;
        int err;
 
-       err = get_drv_dev_by_info_ifindex(info, &dev, &netdev);
+       err = get_drv_dev_by_info_ifindex(info->attrs, &dev, &netdev);
        if (err)
                return err;
 
@@ -392,7 +402,7 @@ static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info)
        } else
                return -EINVAL;
 
-       err = get_drv_dev_by_info_ifindex(info, &drv, &dev);
+       err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
        if (err)
                return err;
        ifindex = dev->ifindex;
@@ -477,7 +487,7 @@ static int nl80211_del_interface(struct sk_buff *skb, struct genl_info *info)
        int ifindex, err;
        struct net_device *dev;
 
-       err = get_drv_dev_by_info_ifindex(info, &drv, &dev);
+       err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
        if (err)
                return err;
        ifindex = dev->ifindex;
@@ -545,7 +555,7 @@ static int nl80211_get_key(struct sk_buff *skb, struct genl_info *info)
        if (info->attrs[NL80211_ATTR_MAC])
                mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]);
 
-       err = get_drv_dev_by_info_ifindex(info, &drv, &dev);
+       err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
        if (err)
                return err;
 
@@ -618,7 +628,7 @@ static int nl80211_set_key(struct sk_buff *skb, struct genl_info *info)
        if (!info->attrs[NL80211_ATTR_KEY_DEFAULT])
                return -EINVAL;
 
-       err = get_drv_dev_by_info_ifindex(info, &drv, &dev);
+       err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
        if (err)
                return err;
 
@@ -699,7 +709,7 @@ static int nl80211_new_key(struct sk_buff *skb, struct genl_info *info)
                return -EINVAL;
        }
 
-       err = get_drv_dev_by_info_ifindex(info, &drv, &dev);
+       err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
        if (err)
                return err;
 
@@ -735,7 +745,7 @@ static int nl80211_del_key(struct sk_buff *skb, struct genl_info *info)
        if (info->attrs[NL80211_ATTR_MAC])
                mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]);
 
-       err = get_drv_dev_by_info_ifindex(info, &drv, &dev);
+       err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
        if (err)
                return err;
 
@@ -764,7 +774,7 @@ static int nl80211_addset_beacon(struct sk_buff *skb, struct genl_info *info)
        struct beacon_parameters params;
        int haveinfo = 0;
 
-       err = get_drv_dev_by_info_ifindex(info, &drv, &dev);
+       err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
        if (err)
                return err;
 
@@ -843,7 +853,7 @@ static int nl80211_del_beacon(struct sk_buff *skb, struct genl_info *info)
        int err;
        struct net_device *dev;
 
-       err = get_drv_dev_by_info_ifindex(info, &drv, &dev);
+       err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
        if (err)
                return err;
 
@@ -937,67 +947,78 @@ static int nl80211_send_station(struct sk_buff *msg, u32 pid, u32 seq,
 }
 
 static int nl80211_dump_station(struct sk_buff *skb,
-               struct netlink_callback *cb)
+                               struct netlink_callback *cb)
 {
-       int wp_idx = 0;
-       int if_idx = 0;
-       int sta_idx = cb->args[2];
-       int wp_start = cb->args[0];
-       int if_start = cb->args[1];
        struct station_info sinfo;
        struct cfg80211_registered_device *dev;
-       struct wireless_dev *wdev;
+       struct net_device *netdev;
        u8 mac_addr[ETH_ALEN];
+       int ifidx = cb->args[0];
+       int sta_idx = cb->args[1];
        int err;
-       int exit = 0;
 
-       /* TODO: filter by device */
-       mutex_lock(&cfg80211_drv_mutex);
-       list_for_each_entry(dev, &cfg80211_drv_list, list) {
-               if (exit)
+       if (!ifidx) {
+               err = nlmsg_parse(cb->nlh, GENL_HDRLEN + nl80211_fam.hdrsize,
+                                 nl80211_fam.attrbuf, nl80211_fam.maxattr,
+                                 nl80211_policy);
+               if (err)
+                       return err;
+
+               if (!nl80211_fam.attrbuf[NL80211_ATTR_IFINDEX])
+                       return -EINVAL;
+
+               ifidx = nla_get_u32(nl80211_fam.attrbuf[NL80211_ATTR_IFINDEX]);
+               if (!ifidx)
+                       return -EINVAL;
+       }
+
+       netdev = dev_get_by_index(&init_net, ifidx);
+       if (!netdev)
+               return -ENODEV;
+
+       dev = cfg80211_get_dev_from_ifindex(ifidx);
+       if (IS_ERR(dev)) {
+               err = PTR_ERR(dev);
+               goto out_put_netdev;
+       }
+
+       if (!dev->ops->dump_station) {
+               err = -ENOSYS;
+               goto out_err;
+       }
+
+       rtnl_lock();
+
+       while (1) {
+               err = dev->ops->dump_station(&dev->wiphy, netdev, sta_idx,
+                                            mac_addr, &sinfo);
+               if (err == -ENOENT)
                        break;
-               if (++wp_idx < wp_start)
-                       continue;
-               if_idx = 0;
+               if (err)
+                       goto out_err_rtnl;
 
-               mutex_lock(&dev->devlist_mtx);
-               list_for_each_entry(wdev, &dev->netdev_list, list) {
-                       if (exit)
-                               break;
-                       if (++if_idx < if_start)
-                               continue;
-                       if (!dev->ops->dump_station)
-                               continue;
+               if (nl80211_send_station(skb,
+                               NETLINK_CB(cb->skb).pid,
+                               cb->nlh->nlmsg_seq, NLM_F_MULTI,
+                               netdev, mac_addr,
+                               &sinfo) < 0)
+                       goto out;
 
-                       for (;; ++sta_idx) {
-                               rtnl_lock();
-                               err = dev->ops->dump_station(&dev->wiphy,
-                                               wdev->netdev, sta_idx, mac_addr,
-                                               &sinfo);
-                               rtnl_unlock();
-                               if (err) {
-                                       sta_idx = 0;
-                                       break;
-                               }
-                               if (nl80211_send_station(skb,
-                                               NETLINK_CB(cb->skb).pid,
-                                               cb->nlh->nlmsg_seq, NLM_F_MULTI,
-                                               wdev->netdev, mac_addr,
-                                               &sinfo) < 0) {
-                                       exit = 1;
-                                       break;
-                               }
-                       }
-               }
-               mutex_unlock(&dev->devlist_mtx);
+               sta_idx++;
        }
-       mutex_unlock(&cfg80211_drv_mutex);
 
-       cb->args[0] = wp_idx;
-       cb->args[1] = if_idx;
-       cb->args[2] = sta_idx;
 
-       return skb->len;
+ out:
+       cb->args[1] = sta_idx;
+       err = skb->len;
+ out_err_rtnl:
+       rtnl_unlock();
+ out_err:
+       cfg80211_put_dev(dev);
+ out_put_netdev:
+       dev_put(netdev);
+
+       return err;
 }
 
 static int nl80211_get_station(struct sk_buff *skb, struct genl_info *info)
@@ -1016,7 +1037,7 @@ static int nl80211_get_station(struct sk_buff *skb, struct genl_info *info)
 
        mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]);
 
-       err = get_drv_dev_by_info_ifindex(info, &drv, &dev);
+       err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
        if (err)
                return err;
 
@@ -1112,7 +1133,7 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info)
                params.plink_action =
                    nla_get_u8(info->attrs[NL80211_ATTR_STA_PLINK_ACTION]);
 
-       err = get_drv_dev_by_info_ifindex(info, &drv, &dev);
+       err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
        if (err)
                return err;
 
@@ -1172,7 +1193,7 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
                                &params.station_flags))
                return -EINVAL;
 
-       err = get_drv_dev_by_info_ifindex(info, &drv, &dev);
+       err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
        if (err)
                return err;
 
@@ -1207,7 +1228,7 @@ static int nl80211_del_station(struct sk_buff *skb, struct genl_info *info)
        if (info->attrs[NL80211_ATTR_MAC])
                mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]);
 
-       err = get_drv_dev_by_info_ifindex(info, &drv, &dev);
+       err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
        if (err)
                return err;
 
@@ -1277,68 +1298,78 @@ static int nl80211_send_mpath(struct sk_buff *msg, u32 pid, u32 seq,
 }
 
 static int nl80211_dump_mpath(struct sk_buff *skb,
-               struct netlink_callback *cb)
+                             struct netlink_callback *cb)
 {
-       int wp_idx = 0;
-       int if_idx = 0;
-       int sta_idx = cb->args[2];
-       int wp_start = cb->args[0];
-       int if_start = cb->args[1];
        struct mpath_info pinfo;
        struct cfg80211_registered_device *dev;
-       struct wireless_dev *wdev;
+       struct net_device *netdev;
        u8 dst[ETH_ALEN];
        u8 next_hop[ETH_ALEN];
+       int ifidx = cb->args[0];
+       int path_idx = cb->args[1];
        int err;
-       int exit = 0;
 
-       /* TODO: filter by device */
-       mutex_lock(&cfg80211_drv_mutex);
-       list_for_each_entry(dev, &cfg80211_drv_list, list) {
-               if (exit)
+       if (!ifidx) {
+               err = nlmsg_parse(cb->nlh, GENL_HDRLEN + nl80211_fam.hdrsize,
+                                 nl80211_fam.attrbuf, nl80211_fam.maxattr,
+                                 nl80211_policy);
+               if (err)
+                       return err;
+
+               if (!nl80211_fam.attrbuf[NL80211_ATTR_IFINDEX])
+                       return -EINVAL;
+
+               ifidx = nla_get_u32(nl80211_fam.attrbuf[NL80211_ATTR_IFINDEX]);
+               if (!ifidx)
+                       return -EINVAL;
+       }
+
+       netdev = dev_get_by_index(&init_net, ifidx);
+       if (!netdev)
+               return -ENODEV;
+
+       dev = cfg80211_get_dev_from_ifindex(ifidx);
+       if (IS_ERR(dev)) {
+               err = PTR_ERR(dev);
+               goto out_put_netdev;
+       }
+
+       if (!dev->ops->dump_mpath) {
+               err = -ENOSYS;
+               goto out_err;
+       }
+
+       rtnl_lock();
+
+       while (1) {
+               err = dev->ops->dump_mpath(&dev->wiphy, netdev, path_idx,
+                                          dst, next_hop, &pinfo);
+               if (err == -ENOENT)
                        break;
-               if (++wp_idx < wp_start)
-                       continue;
-               if_idx = 0;
+               if (err)
+                       goto out_err_rtnl;
 
-               mutex_lock(&dev->devlist_mtx);
-               list_for_each_entry(wdev, &dev->netdev_list, list) {
-                       if (exit)
-                               break;
-                       if (++if_idx < if_start)
-                               continue;
-                       if (!dev->ops->dump_mpath)
-                               continue;
+               if (nl80211_send_mpath(skb, NETLINK_CB(cb->skb).pid,
+                                      cb->nlh->nlmsg_seq, NLM_F_MULTI,
+                                      netdev, dst, next_hop,
+                                      &pinfo) < 0)
+                       goto out;
 
-                       for (;; ++sta_idx) {
-                               rtnl_lock();
-                               err = dev->ops->dump_mpath(&dev->wiphy,
-                                               wdev->netdev, sta_idx, dst,
-                                               next_hop, &pinfo);
-                               rtnl_unlock();
-                               if (err) {
-                                       sta_idx = 0;
-                                       break;
-                               }
-                               if (nl80211_send_mpath(skb,
-                                               NETLINK_CB(cb->skb).pid,
-                                               cb->nlh->nlmsg_seq, NLM_F_MULTI,
-                                               wdev->netdev, dst, next_hop,
-                                               &pinfo) < 0) {
-                                       exit = 1;
-                                       break;
-                               }
-                       }
-               }
-               mutex_unlock(&dev->devlist_mtx);
+               path_idx++;
        }
-       mutex_unlock(&cfg80211_drv_mutex);
 
-       cb->args[0] = wp_idx;
-       cb->args[1] = if_idx;
-       cb->args[2] = sta_idx;
 
-       return skb->len;
+ out:
+       cb->args[1] = path_idx;
+       err = skb->len;
+ out_err_rtnl:
+       rtnl_unlock();
+ out_err:
+       cfg80211_put_dev(dev);
+ out_put_netdev:
+       dev_put(netdev);
+
+       return err;
 }
 
 static int nl80211_get_mpath(struct sk_buff *skb, struct genl_info *info)
@@ -1358,7 +1389,7 @@ static int nl80211_get_mpath(struct sk_buff *skb, struct genl_info *info)
 
        dst = nla_data(info->attrs[NL80211_ATTR_MAC]);
 
-       err = get_drv_dev_by_info_ifindex(info, &drv, &dev);
+       err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
        if (err)
                return err;
 
@@ -1411,7 +1442,7 @@ static int nl80211_set_mpath(struct sk_buff *skb, struct genl_info *info)
        dst = nla_data(info->attrs[NL80211_ATTR_MAC]);
        next_hop = nla_data(info->attrs[NL80211_ATTR_MPATH_NEXT_HOP]);
 
-       err = get_drv_dev_by_info_ifindex(info, &drv, &dev);
+       err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
        if (err)
                return err;
 
@@ -1446,7 +1477,7 @@ static int nl80211_new_mpath(struct sk_buff *skb, struct genl_info *info)
        dst = nla_data(info->attrs[NL80211_ATTR_MAC]);
        next_hop = nla_data(info->attrs[NL80211_ATTR_MPATH_NEXT_HOP]);
 
-       err = get_drv_dev_by_info_ifindex(info, &drv, &dev);
+       err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
        if (err)
                return err;
 
@@ -1475,7 +1506,7 @@ static int nl80211_del_mpath(struct sk_buff *skb, struct genl_info *info)
        if (info->attrs[NL80211_ATTR_MAC])
                dst = nla_data(info->attrs[NL80211_ATTR_MAC]);
 
-       err = get_drv_dev_by_info_ifindex(info, &drv, &dev);
+       err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
        if (err)
                return err;
 
index f63a663..6bf8e87 100644 (file)
@@ -50,8 +50,12 @@ PHONY +=  __fw_install __fw_modinst FORCE
 .PHONY: $(PHONY)
 
 __fw_install: $(installed-fw)
+
 __fw_modinst: $(installed-mod-fw)
+       @:
+
 __fw_modbuild: $(addprefix $(obj)/,$(mod-fw))
+       @:
 
 FORCE:
 
index 4f8a300..c249274 100644 (file)
@@ -545,6 +545,8 @@ int main(int argc, char **argv)
                        }
                        fputs(sym->name, dumpfile);
                        putc(' ', dumpfile);
+                       if (sym->is_extern)
+                               fputs("extern ", dumpfile);
                        print_list(dumpfile, sym->defn);
                        putc('\n', dumpfile);
 
index 2a17698..2ac23bc 100644 (file)
@@ -6,10 +6,19 @@
 
 /* A lexical scanner generated by flex */
 
+/* %not-for-header */
+
+/* %if-c-only */
+/* %if-not-reentrant */
+
+/* %endif */
+/* %endif */
+/* %ok-for-header */
+
 #define FLEX_SCANNER
 #define YY_FLEX_MAJOR_VERSION 2
 #define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 33
+#define YY_FLEX_SUBMINOR_VERSION 35
 #if YY_FLEX_SUBMINOR_VERSION > 0
 #define FLEX_BETA
 #endif
@@ -47,7 +56,7 @@
 
 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
 
-#if __STDC_VERSION__ >= 199901L
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
 
 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
  * if you want the limit (max/min) macros for int types. 
@@ -70,7 +79,6 @@ typedef int flex_int32_t;
 typedef unsigned char flex_uint8_t; 
 typedef unsigned short int flex_uint16_t;
 typedef unsigned int flex_uint32_t;
-#endif /* ! C99 */
 
 /* Limits of integral types. */
 #ifndef INT8_MIN
@@ -101,6 +109,8 @@ typedef unsigned int flex_uint32_t;
 #define UINT32_MAX             (4294967295U)
 #endif
 
+#endif /* ! C99 */
+
 #endif /* ! FLEXINT_H */
 
 /* %endif */
@@ -115,11 +125,12 @@ typedef unsigned int flex_uint32_t;
 
 #else  /* ! __cplusplus */
 
-#if __STDC__
+/* C99 requires __STDC__ to be defined as 1. */
+#if defined (__STDC__)
 
 #define YY_USE_CONST
 
-#endif /* __STDC__ */
+#endif /* defined (__STDC__) */
 #endif /* ! __cplusplus */
 
 #ifdef YY_USE_CONST
@@ -218,14 +229,9 @@ extern FILE *yyin, *yyout;
 
 #define unput(c) yyunput( c, (yytext_ptr)  )
 
-/* The following is because we cannot portably get our hands on size_t
- * (without autoconf's help, which isn't available because we want
- * flex-generated scanners to compile on their own).
- */
-
 #ifndef YY_TYPEDEF_YY_SIZE_T
 #define YY_TYPEDEF_YY_SIZE_T
-typedef unsigned int yy_size_t;
+typedef size_t yy_size_t;
 #endif
 
 #ifndef YY_STRUCT_YY_BUFFER_STATE
@@ -401,7 +407,7 @@ void yyfree (void *  );
 /* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */
 /* Begin user sect3 */
 
-#define yywrap() 1
+#define yywrap(n) 1
 #define YY_SKIP_YYWRAP
 
 #define FLEX_DEBUG
@@ -613,8 +619,8 @@ int yy_flex_debug = 1;
 
 static yyconst flex_int16_t yy_rule_linenum[13] =
     {   0,
-       69,   70,   71,   74,   77,   78,   79,   85,   86,   87,
-       89,   92
+       71,   72,   73,   76,   79,   80,   81,   87,   88,   89,
+       91,   94
     } ;
 
 /* The intent behind this definition is that it'll catch
@@ -665,7 +671,8 @@ char *yytext;
    quite so pedantic.  */
 
 /* We don't do multiple input files.  */
-#line 669 "scripts/genksyms/lex.c"
+#define YY_NO_INPUT 1
+#line 676 "scripts/genksyms/lex.c"
 
 #define INITIAL 0
 #define V2_TOKENS 1
@@ -695,9 +702,39 @@ static int yy_init_globals (void );
 /* %endif */
 /* %if-reentrant */
 /* %endif */
+/* %endif End reentrant structures and macros. */
+
+/* Accessor methods to globals.
+   These are made visible to non-reentrant scanners for convenience. */
+
+int yylex_destroy (void );
+
+int yyget_debug (void );
+
+void yyset_debug (int debug_flag  );
+
+YY_EXTRA_TYPE yyget_extra (void );
+
+void yyset_extra (YY_EXTRA_TYPE user_defined  );
+
+FILE *yyget_in (void );
+
+void yyset_in  (FILE * in_str  );
+
+FILE *yyget_out (void );
+
+void yyset_out  (FILE * out_str  );
+
+int yyget_leng (void );
+
+char *yyget_text (void );
+
+int yyget_lineno (void );
+
+void yyset_lineno (int line_number  );
+
 /* %if-bison-bridge */
 /* %endif */
-/* %endif End reentrant structures and macros. */
 
 /* Macros after this point can all be overridden by user definitions in
  * section 1.
@@ -756,7 +793,7 @@ static int input (void );
 /* This used to be an fputs(), but since the string might contain NUL's,
  * we now use fwrite().
  */
-#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
+#define ECHO fwrite( yytext, yyleng, 1, yyout )
 /* %endif */
 /* %if-c++-only C++ definition */
 /* %endif */
@@ -881,12 +918,12 @@ YY_DECL
        register int yy_act;
     
 /* %% [7.0] user's declarations go here */
-#line 65 "scripts/genksyms/lex.l"
+#line 67 "scripts/genksyms/lex.l"
 
 
 
  /* Keep track of our location in the original source files.  */
-#line 890 "scripts/genksyms/lex.c"
+#line 927 "scripts/genksyms/lex.c"
 
        if ( !(yy_init) )
                {
@@ -1004,42 +1041,42 @@ do_action:      /* This label is used only to access EOF actions. */
 case 1:
 /* rule 1 can match eol */
 YY_RULE_SETUP
-#line 69 "scripts/genksyms/lex.l"
+#line 71 "scripts/genksyms/lex.l"
 return FILENAME;
        YY_BREAK
 case 2:
 /* rule 2 can match eol */
 YY_RULE_SETUP
-#line 70 "scripts/genksyms/lex.l"
+#line 72 "scripts/genksyms/lex.l"
 cur_line++;
        YY_BREAK
 case 3:
 /* rule 3 can match eol */
 YY_RULE_SETUP
-#line 71 "scripts/genksyms/lex.l"
+#line 73 "scripts/genksyms/lex.l"
 cur_line++;
        YY_BREAK
 /* Ignore all other whitespace.  */
 case 4:
 YY_RULE_SETUP
-#line 74 "scripts/genksyms/lex.l"
+#line 76 "scripts/genksyms/lex.l"
 ;
        YY_BREAK
 case 5:
 /* rule 5 can match eol */
 YY_RULE_SETUP
-#line 77 "scripts/genksyms/lex.l"
+#line 79 "scripts/genksyms/lex.l"
 return STRING;
        YY_BREAK
 case 6:
 /* rule 6 can match eol */
 YY_RULE_SETUP
-#line 78 "scripts/genksyms/lex.l"
+#line 80 "scripts/genksyms/lex.l"
 return CHAR;
        YY_BREAK
 case 7:
 YY_RULE_SETUP
-#line 79 "scripts/genksyms/lex.l"
+#line 81 "scripts/genksyms/lex.l"
 return IDENT;
        YY_BREAK
 /* The Pedant requires that the other C multi-character tokens be
@@ -1048,36 +1085,36 @@ return IDENT;
     around them properly.  */
 case 8:
 YY_RULE_SETUP
-#line 85 "scripts/genksyms/lex.l"
+#line 87 "scripts/genksyms/lex.l"
 return OTHER;
        YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 86 "scripts/genksyms/lex.l"
+#line 88 "scripts/genksyms/lex.l"
 return INT;
        YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 87 "scripts/genksyms/lex.l"
+#line 89 "scripts/genksyms/lex.l"
 return REAL;
        YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 89 "scripts/genksyms/lex.l"
+#line 91 "scripts/genksyms/lex.l"
 return DOTS;
        YY_BREAK
 /* All other tokens are single characters.  */
 case 12:
 YY_RULE_SETUP
-#line 92 "scripts/genksyms/lex.l"
+#line 94 "scripts/genksyms/lex.l"
 return yytext[0];
        YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 95 "scripts/genksyms/lex.l"
+#line 97 "scripts/genksyms/lex.l"
 ECHO;
        YY_BREAK
-#line 1081 "scripts/genksyms/lex.c"
+#line 1118 "scripts/genksyms/lex.c"
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(V2_TOKENS):
        yyterminate();
@@ -1346,6 +1383,14 @@ static int yy_get_next_buffer (void)
        else
                ret_val = EOB_ACT_CONTINUE_SCAN;
 
+       if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+               /* Extend the array by 50%, plus the number we really need. */
+               yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
+               YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
+               if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+                       YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+       }
+
        (yy_n_chars) += number_to_move;
        YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
        YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
@@ -1851,7 +1896,9 @@ static void yyensure_buffer_stack (void)
                (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
                                                                (num_to_alloc * sizeof(struct yy_buffer_state*)
                                                                );
-               
+               if ( ! (yy_buffer_stack) )
+                       YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+                                                                 
                memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
                                
                (yy_buffer_stack_max) = num_to_alloc;
@@ -1869,6 +1916,8 @@ static void yyensure_buffer_stack (void)
                                                                ((yy_buffer_stack),
                                                                num_to_alloc * sizeof(struct yy_buffer_state*)
                                                                );
+               if ( ! (yy_buffer_stack) )
+                       YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
 
                /* zero only the new slots.*/
                memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
@@ -2092,7 +2141,7 @@ void yyset_debug (int  bdebug )
 /* %if-reentrant */
 /* %if-bison-bridge */
 /* %endif */
-/* %endif */
+/* %endif if-c-only */
 
 /* %if-c-only */
 static int yy_init_globals (void)
@@ -2124,13 +2173,9 @@ static int yy_init_globals (void)
 }
 /* %endif */
 
-/* %if-c-or-c++ */
-/* %if-c-only */
+/* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */
 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
 int yylex_destroy  (void)
-/* %endif */
-/* %if-c++-only */
-/* %endif */
 {
     
     /* Pop the buffer stack, destroying each element. */
@@ -2144,11 +2189,6 @@ int yylex_destroy  (void)
        yyfree((yy_buffer_stack) );
        (yy_buffer_stack) = NULL;
 
-/* %if-c++-only */
-/* %endif */
-
-/* %if-c-only */
-
     /* Reset the globals. This is important in a non-reentrant scanner so the next time
      * yylex() is called, initialization will occur. */
     yy_init_globals( );
@@ -2156,7 +2196,6 @@ int yylex_destroy  (void)
 /* %if-reentrant */
 /* %endif */
     return 0;
-/* %endif */
 }
 /* %endif */
 
@@ -2213,7 +2252,7 @@ void yyfree (void * ptr )
 
 /* %ok-for-header */
 
-#line 95 "scripts/genksyms/lex.l"
+#line 97 "scripts/genksyms/lex.l"
 
 
 
index 5e544a0..fe50ff9 100644 (file)
@@ -62,6 +62,8 @@ MC_TOKEN              ([~%^&*+=|<>/-]=)|(&&)|("||")|(->)|(<<)|(>>)
 /* We don't do multiple input files.  */
 %option noyywrap
 
+%option noinput
+
 %%
 
 
index 3e6079f..eaee44e 100644 (file)
@@ -504,7 +504,7 @@ static const yytype_uint16 yyprhs[] =
      239,   242,   245,   247,   248,   250,   252,   257,   262,   265,
      269,   273,   277,   278,   280,   283,   287,   291,   292,   294,
      296,   299,   303,   306,   307,   309,   311,   315,   318,   321,
-     323,   326,   327,   329,   332,   333,   335
+     323,   326,   327,   330,   333,   334,   336
 };
 
 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
@@ -542,9 +542,9 @@ static const yytype_int8 yyrhs[] =
       -1,    -1,    89,    -1,    90,    -1,    89,    90,    -1,    64,
       91,    44,    -1,     1,    44,    -1,    -1,    92,    -1,    93,
       -1,    92,    46,    93,    -1,    76,    95,    -1,    37,    94,
-      -1,    94,    -1,    52,    34,    -1,    -1,    31,    -1,    30,
-      44,    -1,    -1,    30,    -1,    29,    47,    37,    49,    44,
-      -1
+      -1,    94,    -1,    52,    34,    -1,    -1,    95,    31,    -1,
+      30,    44,    -1,    -1,    30,    -1,    29,    47,    37,    49,
+      44,    -1
 };
 
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
@@ -647,7 +647,7 @@ static const yytype_uint8 yyr2[] =
        2,     2,     1,     0,     1,     1,     4,     4,     2,     3,
        3,     3,     0,     1,     2,     3,     3,     0,     1,     1,
        2,     3,     2,     0,     1,     1,     3,     2,     2,     1,
-       2,     0,     1,     2,     0,     1,     5
+       2,     0,     2,     2,     0,     1,     5
 };
 
 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -667,9 +667,9 @@ static const yytype_uint8 yydefact[] =
        0,    66,   125,   101,   121,    71,     0,     7,   112,   106,
       76,    77,     0,     0,     0,   121,    75,     0,   114,   115,
      119,   105,     0,   110,   124,     0,    36,     0,    73,    72,
-      61,    20,   122,   102,     0,    93,     0,    84,    87,    88,
-     118,     0,    76,     0,   120,    74,   117,    80,     0,   111,
-       0,    35,   126,     0,    21,   103,    70,    94,    56,     0,
+      61,    20,   102,     0,    93,     0,    84,    87,    88,   118,
+       0,    76,     0,   120,    74,   117,    80,     0,   111,     0,
+      35,   126,   122,     0,    21,   103,    70,    94,    56,     0,
       93,    90,    92,    69,    83,     0,    82,    81,     0,     0,
      116,   104,     0,    95,     0,    91,    98,     0,    85,    89,
       79,    78,   100,    99,     0,     0,    97,    96
@@ -680,44 +680,44 @@ static const yytype_int16 yydefgoto[] =
 {
       -1,     1,     2,     3,    35,    72,    55,    36,    64,    65,
       66,    75,    38,    39,    40,    41,    42,    67,    86,    87,
-      43,   114,    69,   105,   106,   126,   127,   128,   129,   151,
+      43,   114,    69,   105,   106,   125,   126,   127,   128,   151,
      152,    44,   144,   145,    54,    76,    77,    78,   107,   108,
-     109,   110,   123,    45,    94,    46
+     109,   110,   122,    45,    94,    46
 };
 
 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
    STATE-NUM.  */
-#define YYPACT_NINF -135
+#define YYPACT_NINF -134
 static const yytype_int16 yypact[] =
 {
-    -135,    11,  -135,   312,  -135,  -135,    24,  -135,  -135,  -135,
-    -135,  -135,   -23,  -135,    -2,  -135,  -135,  -135,  -135,  -135,
-    -135,  -135,  -135,  -135,   -17,  -135,   -11,  -135,  -135,  -135,
-      -3,    16,    26,  -135,  -135,  -135,  -135,    34,   482,  -135,
-    -135,  -135,  -135,  -135,  -135,  -135,  -135,  -135,  -135,  -135,
-      -8,  -135,    22,    97,  -135,   482,    22,  -135,   482,    56,
-    -135,  -135,    12,    10,    50,    49,  -135,    34,   -13,    15,
-    -135,  -135,   482,  -135,    47,   -25,    51,   145,  -135,  -135,
-      34,  -135,   356,    52,    71,    77,  -135,    10,  -135,  -135,
-      34,  -135,  -135,  -135,    68,  -135,   193,  -135,  -135,  -135,
-      48,  -135,     6,    93,    37,    68,    18,    85,    84,  -135,
-    -135,  -135,    87,  -135,   102,    86,  -135,    89,  -135,  -135,
-    -135,  -135,  -135,    90,    88,   401,    94,   100,   101,  -135,
-    -135,    99,  -135,   108,  -135,  -135,  -135,  -135,   230,  -135,
-     -25,  -135,  -135,   105,  -135,  -135,  -135,  -135,  -135,     9,
-      42,  -135,    28,  -135,  -135,   445,  -135,  -135,   119,   125,
-    -135,  -135,   126,  -135,   128,  -135,  -135,   267,  -135,  -135,
-    -135,  -135,  -135,  -135,   129,   130,  -135,  -135
+    -134,    16,  -134,   312,  -134,  -134,    20,  -134,  -134,  -134,
+    -134,  -134,   -18,  -134,    -3,  -134,  -134,  -134,  -134,  -134,
+    -134,  -134,  -134,  -134,   -26,  -134,   -25,  -134,  -134,  -134,
+      -7,     5,    27,  -134,  -134,  -134,  -134,    46,   482,  -134,
+    -134,  -134,  -134,  -134,  -134,  -134,  -134,  -134,  -134,  -134,
+      -8,  -134,    30,    97,  -134,   482,    30,  -134,   482,     7,
+    -134,  -134,    12,    10,    42,    55,  -134,    46,   -15,    15,
+    -134,  -134,   482,  -134,    25,    26,    47,   145,  -134,  -134,
+      46,  -134,   356,    39,    71,    77,  -134,    10,  -134,  -134,
+      46,  -134,  -134,  -134,  -134,  -134,   193,  -134,  -134,  -134,
+      75,  -134,     6,    95,    43,  -134,    28,    86,    85,  -134,
+    -134,  -134,    88,  -134,   103,    87,  -134,    91,  -134,  -134,
+    -134,  -134,   -23,    90,   401,    94,   101,   102,  -134,  -134,
+      98,  -134,   108,  -134,  -134,   109,  -134,   230,  -134,    26,
+    -134,  -134,  -134,   134,  -134,  -134,  -134,  -134,  -134,     9,
+      48,  -134,    35,  -134,  -134,   445,  -134,  -134,   125,   126,
+    -134,  -134,   128,  -134,   129,  -134,  -134,   267,  -134,  -134,
+    -134,  -134,  -134,  -134,   130,   131,  -134,  -134
 };
 
 /* YYPGOTO[NTERM-NUM].  */
 static const yytype_int16 yypgoto[] =
 {
-    -135,  -135,   179,  -135,  -135,  -135,  -135,   -47,  -135,  -135,
-      91,     0,   -58,   -37,  -135,  -135,  -135,   -73,  -135,  -135,
-     -48,   -32,  -135,   -38,  -135,  -134,  -135,  -135,    29,   -63,
-    -135,  -135,  -135,  -135,   -20,  -135,  -135,   106,  -135,  -135,
-      45,    95,    82,  -135,  -135,  -135
+    -134,  -134,   180,  -134,  -134,  -134,  -134,   -33,  -134,  -134,
+      93,     0,   -58,   -37,  -134,  -134,  -134,   -73,  -134,  -134,
+     -54,   -32,  -134,   -81,  -134,  -133,  -134,  -134,    29,   -50,
+    -134,  -134,  -134,  -134,   -20,  -134,  -134,   110,  -134,  -134,
+      49,    96,    80,  -134,  -134,  -134
 };
 
 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
@@ -727,26 +727,26 @@ static const yytype_int16 yypgoto[] =
 #define YYTABLE_NINF -109
 static const yytype_int16 yytable[] =
 {
-      82,    70,   104,    37,   159,    68,    57,   131,    79,    49,
-     162,     4,   100,    84,    50,    88,   101,    92,    10,    93,
-      52,    51,   102,    63,    71,    97,    56,   103,    20,   104,
-      85,   104,    73,   175,    53,    91,    81,    29,   125,   120,
-      53,    33,   -93,   132,    58,    70,   147,   101,    95,    61,
-     163,   137,   150,   102,    63,    80,   149,    63,   -93,    62,
-      63,   166,    96,    59,   133,   138,   135,   104,    47,    48,
-      60,    61,    80,    53,   132,   167,   150,   150,   101,   147,
-     125,    62,    63,   163,   102,    63,   164,   165,    70,   149,
-      63,    98,    99,    83,    89,    90,   111,   125,    74,   122,
-     103,   117,     7,     8,     9,    10,    11,    12,    13,   125,
+      82,    70,   104,    37,   159,    68,    57,   130,   142,    88,
+     162,    52,    56,    84,    49,    92,     4,    93,    10,    50,
+      51,   132,    79,   134,    71,    53,    53,   143,    20,   104,
+      85,   104,    73,   120,   175,    91,    81,    29,   124,    97,
+      58,    33,   -93,   131,    83,    70,   147,   101,    95,    61,
+     163,   150,    59,   102,    63,    80,   149,    63,   -93,    62,
+      63,   136,    96,   100,    47,    48,   104,   101,   166,    98,
+      99,    60,    80,   102,    63,   137,   150,   150,   103,   124,
+     131,    53,   167,    61,   101,   147,    89,    70,   117,   163,
+     102,    63,   111,    62,    63,   149,    63,   124,    74,   164,
+     165,    90,     7,     8,     9,    10,    11,    12,    13,   124,
       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
-     118,    26,    27,    28,    29,    30,   119,   134,    33,   139,
-     140,    98,    92,   142,   -22,   141,   154,   146,    34,   161,
-     143,   -22,  -107,   153,   -22,   -22,   112,   155,   156,   -22,
+     118,    26,    27,    28,    29,    30,   119,   103,    33,   133,
+     138,   139,    98,    92,   -22,   141,   140,   154,    34,   146,
+     142,   -22,  -107,   153,   -22,   -22,   112,   156,   155,   -22,
        7,     8,     9,    10,    11,    12,    13,   157,    15,    16,
-      17,    18,    19,    20,    21,    22,    23,    24,   170,    26,
-      27,    28,    29,    30,   171,   172,    33,   173,   176,   177,
-       5,   121,   -22,   113,   169,   160,    34,   136,     0,   -22,
-    -108,     0,   -22,   -22,   124,   130,     0,   -22,     7,     8,
+      17,    18,    19,    20,    21,    22,    23,    24,   161,    26,
+      27,    28,    29,    30,   170,   171,    33,   172,   173,   176,
+     177,     5,   -22,   121,   169,   135,    34,   113,   160,   -22,
+    -108,     0,   -22,   -22,   123,     0,   129,   -22,     7,     8,
        9,    10,    11,    12,    13,     0,    15,    16,    17,    18,
       19,    20,    21,    22,    23,    24,     0,    26,    27,    28,
       29,    30,     0,     0,    33,     0,     0,     0,     0,   -86,
@@ -784,26 +784,26 @@ static const yytype_int16 yytable[] =
 
 static const yytype_int16 yycheck[] =
 {
-      58,    38,    75,     3,   138,    37,    26,     1,    55,    32,
-       1,     0,    37,     1,    37,    63,    41,    30,     8,    32,
-      37,    23,    47,    48,    32,    72,    37,    52,    18,   102,
-      62,   104,    52,   167,    51,    67,    56,    27,    96,    87,
-      51,    31,    33,    37,    47,    82,    37,    41,    33,    37,
-      41,    33,   125,    47,    48,    55,    47,    48,    49,    47,
-      48,    33,    47,    47,   102,    47,   104,   140,    44,    45,
-      44,    37,    72,    51,    37,    47,   149,   150,    41,    37,
-     138,    47,    48,    41,    47,    48,   149,   150,   125,    47,
-      48,    44,    45,    37,    44,    46,    45,   155,     1,    31,
-      52,    49,     5,     6,     7,     8,     9,    10,    11,   167,
+      58,    38,    75,     3,   137,    37,    26,     1,    31,    63,
+       1,    37,    37,     1,    32,    30,     0,    32,     8,    37,
+      23,   102,    55,   104,    32,    51,    51,    50,    18,   102,
+      62,   104,    52,    87,   167,    67,    56,    27,    96,    72,
+      47,    31,    33,    37,    37,    82,    37,    41,    33,    37,
+      41,   124,    47,    47,    48,    55,    47,    48,    49,    47,
+      48,    33,    47,    37,    44,    45,   139,    41,    33,    44,
+      45,    44,    72,    47,    48,    47,   149,   150,    52,   137,
+      37,    51,    47,    37,    41,    37,    44,   124,    49,    41,
+      47,    48,    45,    47,    48,    47,    48,   155,     1,   149,
+     150,    46,     5,     6,     7,     8,     9,    10,    11,   167,
       13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
-      49,    24,    25,    26,    27,    28,    49,    34,    31,    44,
-      46,    44,    30,    44,    37,    49,    36,    49,    41,    34,
-      50,    44,    45,    49,    47,    48,     1,    46,    49,    52,
+      49,    24,    25,    26,    27,    28,    49,    52,    31,    34,
+      44,    46,    44,    30,    37,    44,    49,    36,    41,    49,
+      31,    44,    45,    49,    47,    48,     1,    49,    46,    52,
        5,     6,     7,     8,     9,    10,    11,    49,    13,    14,
-      15,    16,    17,    18,    19,    20,    21,    22,    49,    24,
+      15,    16,    17,    18,    19,    20,    21,    22,    34,    24,
       25,    26,    27,    28,    49,    49,    31,    49,    49,    49,
-       1,    90,    37,    77,   155,   140,    41,   105,    -1,    44,
-      45,    -1,    47,    48,     1,   100,    -1,    52,     5,     6,
+      49,     1,    37,    90,   155,   105,    41,    77,   139,    44,
+      45,    -1,    47,    48,     1,    -1,   100,    52,     5,     6,
        7,     8,     9,    10,    11,    -1,    13,    14,    15,    16,
       17,    18,    19,    20,    21,    22,    -1,    24,    25,    26,
       27,    28,    -1,    -1,    31,    -1,    -1,    -1,    -1,    36,
@@ -855,9 +855,9 @@ static const yytype_uint8 yystos[] =
       46,    74,    30,    32,    97,    33,    47,    60,    44,    45,
       37,    41,    47,    52,    70,    76,    77,    91,    92,    93,
       94,    45,     1,    90,    74,    48,    49,    49,    49,    49,
-      73,    63,    31,    95,     1,    65,    78,    79,    80,    81,
-      94,     1,    37,    76,    34,    76,    95,    33,    47,    44,
-      46,    49,    44,    50,    85,    86,    49,    37,    41,    47,
+      73,    63,    95,     1,    65,    78,    79,    80,    81,    94,
+       1,    37,    76,    34,    76,    95,    33,    47,    44,    46,
+      49,    44,    31,    50,    85,    86,    49,    37,    41,    47,
       70,    82,    83,    49,    36,    46,    49,    49,     1,    78,
       93,    34,     1,    41,    82,    82,    33,    47,    36,    81,
       49,    49,    49,    49,     1,    78,    49,    49
index 408cdf8..10d7dc7 100644 (file)
@@ -446,7 +446,7 @@ member_bitfield_declarator:
 
 attribute_opt:
        /* empty */                                     { $$ = NULL; }
-       | ATTRIBUTE_PHRASE
+       | attribute_opt ATTRIBUTE_PHRASE
        ;
 
 asm_definition:
index 9fba838..36b5eed 100644 (file)
@@ -596,7 +596,7 @@ int main(int ac, char **av)
                break;
        }
 
-       if (conf_get_changed() && conf_write(NULL)) {
+       if (conf_write(NULL)) {
                fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
                exit(1);
        }
index 0759761..df6a188 100644 (file)
@@ -222,10 +222,8 @@ load:
                                continue;
                        if (def == S_DEF_USER) {
                                sym = sym_find(line + 9);
-                               if (!sym) {
-                                       conf_warning("trying to assign nonexistent symbol %s", line + 9);
+                               if (!sym)
                                        break;
-                               }
                        } else {
                                sym = sym_lookup(line + 9, 0);
                                if (sym->type == S_UNKNOWN)
@@ -261,10 +259,8 @@ load:
                        }
                        if (def == S_DEF_USER) {
                                sym = sym_find(line + 7);
-                               if (!sym) {
-                                       conf_warning("trying to assign nonexistent symbol %s", line + 7);
+                               if (!sym)
                                        break;
-                               }
                        } else {
                                sym = sym_lookup(line + 7, 0);
                                if (sym->type == S_UNKNOWN)
index 6a61cee..7342ce0 100644 (file)
@@ -5,10 +5,29 @@
 
 /* A lexical scanner generated by flex */
 
+#define yy_create_buffer zconf_create_buffer
+#define yy_delete_buffer zconf_delete_buffer
+#define yy_flex_debug zconf_flex_debug
+#define yy_init_buffer zconf_init_buffer
+#define yy_flush_buffer zconf_flush_buffer
+#define yy_load_buffer_state zconf_load_buffer_state
+#define yy_switch_to_buffer zconf_switch_to_buffer
+#define yyin zconfin
+#define yyleng zconfleng
+#define yylex zconflex
+#define yylineno zconflineno
+#define yyout zconfout
+#define yyrestart zconfrestart
+#define yytext zconftext
+#define yywrap zconfwrap
+#define yyalloc zconfalloc
+#define yyrealloc zconfrealloc
+#define yyfree zconffree
+
 #define FLEX_SCANNER
 #define YY_FLEX_MAJOR_VERSION 2
 #define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 33
+#define YY_FLEX_SUBMINOR_VERSION 35
 #if YY_FLEX_SUBMINOR_VERSION > 0
 #define FLEX_BETA
 #endif
@@ -30,7 +49,7 @@
 
 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
 
-#if __STDC_VERSION__ >= 199901L
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
 
 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
  * if you want the limit (max/min) macros for int types. 
@@ -53,7 +72,6 @@ typedef int flex_int32_t;
 typedef unsigned char flex_uint8_t; 
 typedef unsigned short int flex_uint16_t;
 typedef unsigned int flex_uint32_t;
-#endif /* ! C99 */
 
 /* Limits of integral types. */
 #ifndef INT8_MIN
@@ -84,6 +102,8 @@ typedef unsigned int flex_uint32_t;
 #define UINT32_MAX             (4294967295U)
 #endif
 
+#endif /* ! C99 */
+
 #endif /* ! FLEXINT_H */
 
 #ifdef __cplusplus
@@ -93,11 +113,12 @@ typedef unsigned int flex_uint32_t;
 
 #else  /* ! __cplusplus */
 
-#if __STDC__
+/* C99 requires __STDC__ to be defined as 1. */
+#if defined (__STDC__)
 
 #define YY_USE_CONST
 
-#endif /* __STDC__ */
+#endif /* defined (__STDC__) */
 #endif /* ! __cplusplus */
 
 #ifdef YY_USE_CONST
@@ -177,14 +198,9 @@ extern FILE *zconfin, *zconfout;
 
 #define unput(c) yyunput( c, (yytext_ptr)  )
 
-/* The following is because we cannot portably get our hands on size_t
- * (without autoconf's help, which isn't available because we want
- * flex-generated scanners to compile on their own).
- */
-
 #ifndef YY_TYPEDEF_YY_SIZE_T
 #define YY_TYPEDEF_YY_SIZE_T
-typedef unsigned int yy_size_t;
+typedef size_t yy_size_t;
 #endif
 
 #ifndef YY_STRUCT_YY_BUFFER_STATE
@@ -335,7 +351,7 @@ void zconffree (void *  );
 
 /* Begin user sect3 */
 
-#define zconfwrap() 1
+#define zconfwrap(n) 1
 #define YY_SKIP_YYWRAP
 
 typedef unsigned char YY_CHAR;
@@ -748,6 +764,7 @@ int zconf_flex_debug = 0;
 #define YY_MORE_ADJ 0
 #define YY_RESTORE_YY_MORE_OFFSET
 char *zconftext;
+#define YY_NO_INPUT 1
 
 /*
  * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
@@ -834,6 +851,35 @@ void alloc_string(const char *str, int size)
 
 static int yy_init_globals (void );
 
+/* Accessor methods to globals.
+   These are made visible to non-reentrant scanners for convenience. */
+
+int zconflex_destroy (void );
+
+int zconfget_debug (void );
+
+void zconfset_debug (int debug_flag  );
+
+YY_EXTRA_TYPE zconfget_extra (void );
+
+void zconfset_extra (YY_EXTRA_TYPE user_defined  );
+
+FILE *zconfget_in (void );
+
+void zconfset_in  (FILE * in_str  );
+
+FILE *zconfget_out (void );
+
+void zconfset_out  (FILE * out_str  );
+
+int zconfget_leng (void );
+
+char *zconfget_text (void );
+
+int zconfget_lineno (void );
+
+void zconfset_lineno (int line_number  );
+
 /* Macros after this point can all be overridden by user definitions in
  * section 1.
  */
@@ -876,7 +922,7 @@ static int input (void );
 /* This used to be an fputs(), but since the string might contain NUL's,
  * we now use fwrite().
  */
-#define ECHO (void) fwrite( zconftext, zconfleng, 1, zconfout )
+#define ECHO fwrite( zconftext, zconfleng, 1, zconfout )
 #endif
 
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
@@ -1540,6 +1586,14 @@ static int yy_get_next_buffer (void)
        else
                ret_val = EOB_ACT_CONTINUE_SCAN;
 
+       if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+               /* Extend the array by 50%, plus the number we really need. */
+               yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
+               YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) zconfrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
+               if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+                       YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+       }
+
        (yy_n_chars) += number_to_move;
        YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
        YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
@@ -1926,7 +1980,9 @@ static void zconfensure_buffer_stack (void)
                (yy_buffer_stack) = (struct yy_buffer_state**)zconfalloc
                                                                (num_to_alloc * sizeof(struct yy_buffer_state*)
                                                                );
-               
+               if ( ! (yy_buffer_stack) )
+                       YY_FATAL_ERROR( "out of dynamic memory in zconfensure_buffer_stack()" );
+                                                                 
                memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
                                
                (yy_buffer_stack_max) = num_to_alloc;
@@ -1944,6 +2000,8 @@ static void zconfensure_buffer_stack (void)
                                                                ((yy_buffer_stack),
                                                                num_to_alloc * sizeof(struct yy_buffer_state*)
                                                                );
+               if ( ! (yy_buffer_stack) )
+                       YY_FATAL_ERROR( "out of dynamic memory in zconfensure_buffer_stack()" );
 
                /* zero only the new slots.*/
                memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
index 4cea5c8..5164ef7 100644 (file)
@@ -1,5 +1,6 @@
 %option backup nostdinit noyywrap never-interactive full ecs
 %option 8bit backup nodefault perf-report perf-report
+%option noinput
 %x COMMAND HELP STRING PARAM
 %{
 /*
index d8f77e2..ff787e6 100755 (executable)
@@ -1403,7 +1403,7 @@ sub dump_struct($$) {
        my $members = $3;
 
        # ignore embedded structs or unions
-       $members =~ s/{.*?}//g;
+       $members =~ s/{.*}//g;
 
        # ignore members marked private:
        $members =~ s/\/\*.*?private:.*?public:.*?\*\///gos;
index 8f038e6..418cd7d 100644 (file)
@@ -1468,7 +1468,7 @@ static void section_rel(const char *modname, struct elf_info *elf,
  * marked __initdata will be discarded when the module has been intialized.
  * Likewise for modules used built-in the sections marked __exit
  * are discarded because __exit marked function are supposed to be called
- * only when a moduel is unloaded which never happes for built-in modules.
+ * only when a module is unloaded which never happens for built-in modules.
  * The check_sec_ref() function traverses all relocation records
  * to find all references to a section that reference a section that will
  * be discarded and warns about it.
index ece46ef..46a59ca 100755 (executable)
@@ -213,6 +213,7 @@ fi
 if [ $stopvers != "default" ]; then
        STOPSUBLEVEL=`echo $stopvers | cut -d. -f3`
        STOPEXTRA=`echo $stopvers | cut -d. -f4`
+       STOPFULLVERSION=${stopvers%%.$STOPEXTRA}
        #echo "#___STOPSUBLEVEL=/$STOPSUBLEVEL/, STOPEXTRA=/$STOPEXTRA/"
 else
        STOPSUBLEVEL=9999
@@ -249,7 +250,7 @@ while :                             # incrementing SUBLEVEL (s in v.p.s)
 do
     CURRENTFULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL"
     EXTRAVER=
-    if [ $stopvers = $CURRENTFULLVERSION ]; then
+    if [ $STOPFULLVERSION = $CURRENTFULLVERSION ]; then
         echo "Stopping at $CURRENTFULLVERSION base as requested."
         break
     fi
index 7ac0e30..dbb3037 100755 (executable)
@@ -4,7 +4,6 @@
 # /bin /sbin /usr/bin /usr/sbin /usr/local/bin, but it may
 # differ on your system.
 #
-PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:$PATH
 echo 'If some fields are empty or look unusual you may have an old version.'
 echo 'Compare to the current minimal requirements in Documentation/Changes.'
 echo ' '
index 40d06c5..3ae9bec 100644 (file)
@@ -998,8 +998,12 @@ static int selinux_sb_show_options(struct seq_file *m, struct super_block *sb)
        int rc;
 
        rc = selinux_get_mnt_opts(sb, &opts);
-       if (rc)
+       if (rc) {
+               /* before policy load we may get EINVAL, don't show anything */
+               if (rc == -EINVAL)
+                       rc = 0;
                return rc;
+       }
 
        selinux_write_opts(m, &opts);
 
index 558dadb..e024e45 100644 (file)
@@ -604,6 +604,9 @@ snd_seq_oss_synth_make_info(struct seq_oss_devinfo *dp, int dev, struct synth_in
 {
        struct seq_oss_synth *rec;
 
+       if (dev < 0 || dev >= dp->max_synthdev)
+               return -ENXIO;
+
        if (dp->synths[dev].is_midi) {
                struct midi_info minf;
                snd_seq_oss_midi_make_info(dp, dp->synths[dev].midi_mapped, &minf);
index 9ca1133..54df8ba 100644 (file)
@@ -42,7 +42,7 @@
 #include <sound/info.h>
 #include <asm/io.h>
 #include <asm/dma.h>
-#include <asm/dreamcast/sysasic.h>
+#include <mach/sysasic.h>
 #include "aica.h"
 
 MODULE_AUTHOR("Adrian McMenamin <adrian@mcmen.demon.co.uk>");
index da2bc59..d2d3da9 100644 (file)
@@ -132,12 +132,17 @@ struct fsl_dma_private {
  * Since each link descriptor has a 32-bit byte count field, we set
  * period_bytes_max to the largest 32-bit number.  We also have no maximum
  * number of periods.
+ *
+ * Note that we specify SNDRV_PCM_INFO_JOINT_DUPLEX here, but only because a
+ * limitation in the SSI driver requires the sample rates for playback and
+ * capture to be the same.
  */
 static const struct snd_pcm_hardware fsl_dma_hardware = {
 
        .info                   = SNDRV_PCM_INFO_INTERLEAVED |
                                  SNDRV_PCM_INFO_MMAP |
-                                 SNDRV_PCM_INFO_MMAP_VALID,
+                                 SNDRV_PCM_INFO_MMAP_VALID |
+                                 SNDRV_PCM_INFO_JOINT_DUPLEX,
        .formats                = FSLDMA_PCM_FORMATS,
        .rates                  = FSLDMA_PCM_RATES,
        .rate_min               = 5512,
@@ -322,14 +327,75 @@ static int fsl_dma_new(struct snd_card *card, struct snd_soc_dai *dai,
  * fsl_dma_open: open a new substream.
  *
  * Each substream has its own DMA buffer.
+ *
+ * ALSA divides the DMA buffer into N periods.  We create NUM_DMA_LINKS link
+ * descriptors that ping-pong from one period to the next.  For example, if
+ * there are six periods and two link descriptors, this is how they look
+ * before playback starts:
+ *
+ *                The last link descriptor
+ *   ____________  points back to the first
+ *  |           |
+ *  V           |
+ *  ___    ___   |
+ * |   |->|   |->|
+ * |___|  |___|
+ *   |      |
+ *   |      |
+ *   V      V
+ *  _________________________________________
+ * |      |      |      |      |      |      |  The DMA buffer is
+ * |      |      |      |      |      |      |    divided into 6 parts
+ * |______|______|______|______|______|______|
+ *
+ * and here's how they look after the first period is finished playing:
+ *
+ *   ____________
+ *  |           |
+ *  V           |
+ *  ___    ___   |
+ * |   |->|   |->|
+ * |___|  |___|
+ *   |      |
+ *   |______________
+ *          |       |
+ *          V       V
+ *  _________________________________________
+ * |      |      |      |      |      |      |
+ * |      |      |      |      |      |      |
+ * |______|______|______|______|______|______|
+ *
+ * The first link descriptor now points to the third period.  The DMA
+ * controller is currently playing the second period.  When it finishes, it
+ * will jump back to the first descriptor and play the third period.
+ *
+ * There are four reasons we do this:
+ *
+ * 1. The only way to get the DMA controller to automatically restart the
+ *    transfer when it gets to the end of the buffer is to use chaining
+ *    mode.  Basic direct mode doesn't offer that feature.
+ * 2. We need to receive an interrupt at the end of every period.  The DMA
+ *    controller can generate an interrupt at the end of every link transfer
+ *    (aka segment).  Making each period into a DMA segment will give us the
+ *    interrupts we need.
+ * 3. By creating only two link descriptors, regardless of the number of
+ *    periods, we do not need to reallocate the link descriptors if the
+ *    number of periods changes.
+ * 4. All of the audio data is still stored in a single, contiguous DMA
+ *    buffer, which is what ALSA expects.  We're just dividing it into
+ *    contiguous parts, and creating a link descriptor for each one.
  */
 static int fsl_dma_open(struct snd_pcm_substream *substream)
 {
        struct snd_pcm_runtime *runtime = substream->runtime;
        struct fsl_dma_private *dma_private;
+       struct ccsr_dma_channel __iomem *dma_channel;
        dma_addr_t ld_buf_phys;
+       u64 temp_link;          /* Pointer to next link descriptor */
+       u32 mr;
        unsigned int channel;
        int ret = 0;
+       unsigned int i;
 
        /*
         * Reject any DMA buffer whose size is not a multiple of the period
@@ -390,68 +456,74 @@ static int fsl_dma_open(struct snd_pcm_substream *substream)
        snd_soc_set_runtime_hwparams(substream, &fsl_dma_hardware);
        runtime->private_data = dma_private;
 
+       /* Program the fixed DMA controller parameters */
+
+       dma_channel = dma_private->dma_channel;
+
+       temp_link = dma_private->ld_buf_phys +
+               sizeof(struct fsl_dma_link_descriptor);
+
+       for (i = 0; i < NUM_DMA_LINKS; i++) {
+               struct fsl_dma_link_descriptor *link = &dma_private->link[i];
+
+               link->source_attr = cpu_to_be32(CCSR_DMA_ATR_SNOOP);
+               link->dest_attr = cpu_to_be32(CCSR_DMA_ATR_SNOOP);
+               link->next = cpu_to_be64(temp_link);
+
+               temp_link += sizeof(struct fsl_dma_link_descriptor);
+       }
+       /* The last link descriptor points to the first */
+       dma_private->link[i - 1].next = cpu_to_be64(dma_private->ld_buf_phys);
+
+       /* Tell the DMA controller where the first link descriptor is */
+       out_be32(&dma_channel->clndar,
+               CCSR_DMA_CLNDAR_ADDR(dma_private->ld_buf_phys));
+       out_be32(&dma_channel->eclndar,
+               CCSR_DMA_ECLNDAR_ADDR(dma_private->ld_buf_phys));
+
+       /* The manual says the BCR must be clear before enabling EMP */
+       out_be32(&dma_channel->bcr, 0);
+
+       /*
+        * Program the mode register for interrupts, external master control,
+        * and source/destination hold.  Also clear the Channel Abort bit.
+        */
+       mr = in_be32(&dma_channel->mr) &
+               ~(CCSR_DMA_MR_CA | CCSR_DMA_MR_DAHE | CCSR_DMA_MR_SAHE);
+
+       /*
+        * We want External Master Start and External Master Pause enabled,
+        * because the SSI is controlling the DMA controller.  We want the DMA
+        * controller to be set up in advance, and then we signal only the SSI
+        * to start transferring.
+        *
+        * We want End-Of-Segment Interrupts enabled, because this will generate
+        * an interrupt at the end of each segment (each link descriptor
+        * represents one segment).  Each DMA segment is the same thing as an
+        * ALSA period, so this is how we get an interrupt at the end of every
+        * period.
+        *
+        * We want Error Interrupt enabled, so that we can get an error if
+        * the DMA controller is mis-programmed somehow.
+        */
+       mr |= CCSR_DMA_MR_EOSIE | CCSR_DMA_MR_EIE | CCSR_DMA_MR_EMP_EN |
+               CCSR_DMA_MR_EMS_EN;
+
+       /* For playback, we want the destination address to be held.  For
+          capture, set the source address to be held. */
+       mr |= (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
+               CCSR_DMA_MR_DAHE : CCSR_DMA_MR_SAHE;
+
+       out_be32(&dma_channel->mr, mr);
+
        return 0;
 }
 
 /**
- * fsl_dma_hw_params: allocate the DMA buffer and the DMA link descriptors.
+ * fsl_dma_hw_params: continue initializing the DMA links
  *
- * ALSA divides the DMA buffer into N periods.  We create NUM_DMA_LINKS link
- * descriptors that ping-pong from one period to the next.  For example, if
- * there are six periods and two link descriptors, this is how they look
- * before playback starts:
- *
- *                The last link descriptor
- *   ____________  points back to the first
- *  |           |
- *  V           |
- *  ___    ___   |
- * |   |->|   |->|
- * |___|  |___|
- *   |      |
- *   |      |
- *   V      V
- *  _________________________________________
- * |      |      |      |      |      |      |  The DMA buffer is
- * |      |      |      |      |      |      |    divided into 6 parts
- * |______|______|______|______|______|______|
- *
- * and here's how they look after the first period is finished playing:
- *
- *   ____________
- *  |           |
- *  V           |
- *  ___    ___   |
- * |   |->|   |->|
- * |___|  |___|
- *   |      |
- *   |______________
- *          |       |
- *          V       V
- *  _________________________________________
- * |      |      |      |      |      |      |
- * |      |      |      |      |      |      |
- * |______|______|______|______|______|______|
- *
- * The first link descriptor now points to the third period.  The DMA
- * controller is currently playing the second period.  When it finishes, it
- * will jump back to the first descriptor and play the third period.
- *
- * There are four reasons we do this:
- *
- * 1. The only way to get the DMA controller to automatically restart the
- *    transfer when it gets to the end of the buffer is to use chaining
- *    mode.  Basic direct mode doesn't offer that feature.
- * 2. We need to receive an interrupt at the end of every period.  The DMA
- *    controller can generate an interrupt at the end of every link transfer
- *    (aka segment).  Making each period into a DMA segment will give us the
- *    interrupts we need.
- * 3. By creating only two link descriptors, regardless of the number of
- *    periods, we do not need to reallocate the link descriptors if the
- *    number of periods changes.
- * 4. All of the audio data is still stored in a single, contiguous DMA
- *    buffer, which is what ALSA expects.  We're just dividing it into
- *    contiguous parts, and creating a link descriptor for each one.
+ * This function obtains hardware parameters about the opened stream and
+ * programs the DMA controller accordingly.
  *
  * Note that due to a quirk of the SSI's STX register, the target address
  * for the DMA operations depends on the sample size.  So we don't program
@@ -463,11 +535,8 @@ static int fsl_dma_hw_params(struct snd_pcm_substream *substream,
 {
        struct snd_pcm_runtime *runtime = substream->runtime;
        struct fsl_dma_private *dma_private = runtime->private_data;
-       struct ccsr_dma_channel __iomem *dma_channel = dma_private->dma_channel;
 
        dma_addr_t temp_addr;   /* Pointer to next period */
-       u64 temp_link;          /* Pointer to next link descriptor */
-       u32 mr;                 /* Temporary variable for MR register */
 
        unsigned int i;
 
@@ -485,8 +554,6 @@ static int fsl_dma_hw_params(struct snd_pcm_substream *substream,
                dma_private->dma_buf_next = dma_private->dma_buf_phys;
 
        /*
-        * Initialize each link descriptor.
-        *
         * The actual address in STX0 (destination for playback, source for
         * capture) is based on the sample size, but we don't know the sample
         * size in this function, so we'll have to adjust that later.  See
@@ -502,16 +569,11 @@ static int fsl_dma_hw_params(struct snd_pcm_substream *substream,
         * buffer itself.
         */
        temp_addr = substream->dma_buffer.addr;
-       temp_link = dma_private->ld_buf_phys +
-               sizeof(struct fsl_dma_link_descriptor);
 
        for (i = 0; i < NUM_DMA_LINKS; i++) {
                struct fsl_dma_link_descriptor *link = &dma_private->link[i];
 
                link->count = cpu_to_be32(period_size);
-               link->source_attr = cpu_to_be32(CCSR_DMA_ATR_SNOOP);
-               link->dest_attr = cpu_to_be32(CCSR_DMA_ATR_SNOOP);
-               link->next = cpu_to_be64(temp_link);
 
                if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
                        link->source_addr = cpu_to_be32(temp_addr);
@@ -519,51 +581,7 @@ static int fsl_dma_hw_params(struct snd_pcm_substream *substream,
                        link->dest_addr = cpu_to_be32(temp_addr);
 
                temp_addr += period_size;
-               temp_link += sizeof(struct fsl_dma_link_descriptor);
        }
-       /* The last link descriptor points to the first */
-       dma_private->link[i - 1].next = cpu_to_be64(dma_private->ld_buf_phys);
-
-       /* Tell the DMA controller where the first link descriptor is */
-       out_be32(&dma_channel->clndar,
-               CCSR_DMA_CLNDAR_ADDR(dma_private->ld_buf_phys));
-       out_be32(&dma_channel->eclndar,
-               CCSR_DMA_ECLNDAR_ADDR(dma_private->ld_buf_phys));
-
-       /* The manual says the BCR must be clear before enabling EMP */
-       out_be32(&dma_channel->bcr, 0);
-
-       /*
-        * Program the mode register for interrupts, external master control,
-        * and source/destination hold.  Also clear the Channel Abort bit.
-        */
-       mr = in_be32(&dma_channel->mr) &
-               ~(CCSR_DMA_MR_CA | CCSR_DMA_MR_DAHE | CCSR_DMA_MR_SAHE);
-
-       /*
-        * We want External Master Start and External Master Pause enabled,
-        * because the SSI is controlling the DMA controller.  We want the DMA
-        * controller to be set up in advance, and then we signal only the SSI
-        * to start transfering.
-        *
-        * We want End-Of-Segment Interrupts enabled, because this will generate
-        * an interrupt at the end of each segment (each link descriptor
-        * represents one segment).  Each DMA segment is the same thing as an
-        * ALSA period, so this is how we get an interrupt at the end of every
-        * period.
-        *
-        * We want Error Interrupt enabled, so that we can get an error if
-        * the DMA controller is mis-programmed somehow.
-        */
-       mr |= CCSR_DMA_MR_EOSIE | CCSR_DMA_MR_EIE | CCSR_DMA_MR_EMP_EN |
-               CCSR_DMA_MR_EMS_EN;
-
-       /* For playback, we want the destination address to be held.  For
-          capture, set the source address to be held. */
-       mr |= (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
-               CCSR_DMA_MR_DAHE : CCSR_DMA_MR_SAHE;
-
-       out_be32(&dma_channel->mr, mr);
 
        return 0;
 }
index 71bff33..157a789 100644 (file)
@@ -67,6 +67,8 @@
  * @ssi: pointer to the SSI's registers
  * @ssi_phys: physical address of the SSI registers
  * @irq: IRQ of this SSI
+ * @first_stream: pointer to the stream that was opened first
+ * @second_stream: pointer to second stream
  * @dev: struct device pointer
  * @playback: the number of playback streams opened
  * @capture: the number of capture streams opened
@@ -79,6 +81,8 @@ struct fsl_ssi_private {
        struct ccsr_ssi __iomem *ssi;
        dma_addr_t ssi_phys;
        unsigned int irq;
+       struct snd_pcm_substream *first_stream;
+       struct snd_pcm_substream *second_stream;
        struct device *dev;
        unsigned int playback;
        unsigned int capture;
@@ -342,6 +346,49 @@ static int fsl_ssi_startup(struct snd_pcm_substream *substream)
                 */
        }
 
+       if (!ssi_private->first_stream)
+               ssi_private->first_stream = substream;
+       else {
+               /* This is the second stream open, so we need to impose sample
+                * rate and maybe sample size constraints.  Note that this can
+                * cause a race condition if the second stream is opened before
+                * the first stream is fully initialized.
+                *
+                * We provide some protection by checking to make sure the first
+                * stream is initialized, but it's not perfect.  ALSA sometimes
+                * re-initializes the driver with a different sample rate or
+                * size.  If the second stream is opened before the first stream
+                * has received its final parameters, then the second stream may
+                * be constrained to the wrong sample rate or size.
+                *
+                * FIXME: This code does not handle opening and closing streams
+                * repeatedly.  If you open two streams and then close the first
+                * one, you may not be able to open another stream until you
+                * close the second one as well.
+                */
+               struct snd_pcm_runtime *first_runtime =
+                       ssi_private->first_stream->runtime;
+
+               if (!first_runtime->rate || !first_runtime->sample_bits) {
+                       dev_err(substream->pcm->card->dev,
+                               "set sample rate and size in %s stream first\n",
+                               substream->stream == SNDRV_PCM_STREAM_PLAYBACK
+                               ? "capture" : "playback");
+                       return -EAGAIN;
+               }
+
+               snd_pcm_hw_constraint_minmax(substream->runtime,
+                       SNDRV_PCM_HW_PARAM_RATE,
+                       first_runtime->rate, first_runtime->rate);
+
+               snd_pcm_hw_constraint_minmax(substream->runtime,
+                       SNDRV_PCM_HW_PARAM_SAMPLE_BITS,
+                       first_runtime->sample_bits,
+                       first_runtime->sample_bits);
+
+               ssi_private->second_stream = substream;
+       }
+
        if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
                ssi_private->playback++;
 
@@ -371,18 +418,16 @@ static int fsl_ssi_prepare(struct snd_pcm_substream *substream)
        struct fsl_ssi_private *ssi_private = rtd->dai->cpu_dai->private_data;
 
        struct ccsr_ssi __iomem *ssi = ssi_private->ssi;
-       u32 wl;
 
-       wl = CCSR_SSI_SxCCR_WL(snd_pcm_format_width(runtime->format));
+       if (substream == ssi_private->first_stream) {
+               u32 wl;
 
-       clrbits32(&ssi->scr, CCSR_SSI_SCR_SSIEN);
+               /* The SSI should always be disabled at this points (SSIEN=0) */
+               wl = CCSR_SSI_SxCCR_WL(snd_pcm_format_width(runtime->format));
 
-       if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+               /* In synchronous mode, the SSI uses STCCR for capture */
                clrsetbits_be32(&ssi->stccr, CCSR_SSI_SxCCR_WL_MASK, wl);
-       else
-               clrsetbits_be32(&ssi->srccr, CCSR_SSI_SxCCR_WL_MASK, wl);
-
-       setbits32(&ssi->scr, CCSR_SSI_SCR_SSIEN);
+       }
 
        return 0;
 }
@@ -407,9 +452,13 @@ static int fsl_ssi_trigger(struct snd_pcm_substream *substream, int cmd)
        case SNDRV_PCM_TRIGGER_RESUME:
        case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
                if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
-                       setbits32(&ssi->scr, CCSR_SSI_SCR_TE);
+                       clrbits32(&ssi->scr, CCSR_SSI_SCR_SSIEN);
+                       setbits32(&ssi->scr,
+                               CCSR_SSI_SCR_SSIEN | CCSR_SSI_SCR_TE);
                } else {
-                       setbits32(&ssi->scr, CCSR_SSI_SCR_RE);
+                       clrbits32(&ssi->scr, CCSR_SSI_SCR_SSIEN);
+                       setbits32(&ssi->scr,
+                               CCSR_SSI_SCR_SSIEN | CCSR_SSI_SCR_RE);
 
                        /*
                         * I think we need this delay to allow time for the SSI
@@ -452,6 +501,11 @@ static void fsl_ssi_shutdown(struct snd_pcm_substream *substream)
        if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
                ssi_private->capture--;
 
+       if (ssi_private->first_stream == substream)
+               ssi_private->first_stream = ssi_private->second_stream;
+
+       ssi_private->second_stream = NULL;
+
        /*
         * If this is the last active substream, disable the SSI and release
         * the IRQ.
index 65a4e9a..d968cf7 100644 (file)
@@ -85,17 +85,13 @@ static int poodle_startup(struct snd_pcm_substream *substream)
 }
 
 /* we need to unmute the HP at shutdown as the mute burns power on poodle */
-static int poodle_shutdown(struct snd_pcm_substream *substream)
+static void poodle_shutdown(struct snd_pcm_substream *substream)
 {
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
-       struct snd_soc_codec *codec = rtd->socdev->codec;
-
        /* set = unmute headphone */
        locomo_gpio_write(&poodle_locomo_device.dev,
                POODLE_LOCOMO_GPIO_MUTE_L, 1);
        locomo_gpio_write(&poodle_locomo_device.dev,
                POODLE_LOCOMO_GPIO_MUTE_R, 1);
-       return 0;
 }
 
 static int poodle_hw_params(struct snd_pcm_substream *substream,
@@ -232,7 +228,7 @@ static const struct soc_enum poodle_enum[] = {
        SOC_ENUM_SINGLE_EXT(2, spk_function),
 };
 
-static const snd_kcontrol_new_t wm8731_poodle_controls[] = {
+static const struct snd_kcontrol_new wm8731_poodle_controls[] = {
        SOC_ENUM_EXT("Jack Function", poodle_enum[0], poodle_get_jack,
                poodle_set_jack),
        SOC_ENUM_EXT("Speaker Function", poodle_enum[1], poodle_get_spk,
index fe6cca9..22971a0 100644 (file)
@@ -33,7 +33,6 @@
 #include <asm/arch/pxa-regs.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/audio.h>
-#include <asm/arch/tosa.h>
 
 #include "../codecs/wm9712.h"
 #include "pxa2xx-pcm.h"
index 820347c..f9d100b 100644 (file)
@@ -470,6 +470,7 @@ int dapm_reg_event(struct snd_soc_dapm_widget *w,
 
        return 0;
 }
+EXPORT_SYMBOL_GPL(dapm_reg_event);
 
 /*
  * Scan each dapm widget for complete audio path.
index a845890..7dd9b0b 100644 (file)
@@ -192,6 +192,123 @@ void kvm_vcpu_uninit(struct kvm_vcpu *vcpu)
 }
 EXPORT_SYMBOL_GPL(kvm_vcpu_uninit);
 
+#if defined(CONFIG_MMU_NOTIFIER) && defined(KVM_ARCH_WANT_MMU_NOTIFIER)
+static inline struct kvm *mmu_notifier_to_kvm(struct mmu_notifier *mn)
+{
+       return container_of(mn, struct kvm, mmu_notifier);
+}
+
+static void kvm_mmu_notifier_invalidate_page(struct mmu_notifier *mn,
+                                            struct mm_struct *mm,
+                                            unsigned long address)
+{
+       struct kvm *kvm = mmu_notifier_to_kvm(mn);
+       int need_tlb_flush;
+
+       /*
+        * When ->invalidate_page runs, the linux pte has been zapped
+        * already but the page is still allocated until
+        * ->invalidate_page returns. So if we increase the sequence
+        * here the kvm page fault will notice if the spte can't be
+        * established because the page is going to be freed. If
+        * instead the kvm page fault establishes the spte before
+        * ->invalidate_page runs, kvm_unmap_hva will release it
+        * before returning.
+        *
+        * The sequence increase only need to be seen at spin_unlock
+        * time, and not at spin_lock time.
+        *
+        * Increasing the sequence after the spin_unlock would be
+        * unsafe because the kvm page fault could then establish the
+        * pte after kvm_unmap_hva returned, without noticing the page
+        * is going to be freed.
+        */
+       spin_lock(&kvm->mmu_lock);
+       kvm->mmu_notifier_seq++;
+       need_tlb_flush = kvm_unmap_hva(kvm, address);
+       spin_unlock(&kvm->mmu_lock);
+
+       /* we've to flush the tlb before the pages can be freed */
+       if (need_tlb_flush)
+               kvm_flush_remote_tlbs(kvm);
+
+}
+
+static void kvm_mmu_notifier_invalidate_range_start(struct mmu_notifier *mn,
+                                                   struct mm_struct *mm,
+                                                   unsigned long start,
+                                                   unsigned long end)
+{
+       struct kvm *kvm = mmu_notifier_to_kvm(mn);
+       int need_tlb_flush = 0;
+
+       spin_lock(&kvm->mmu_lock);
+       /*
+        * The count increase must become visible at unlock time as no
+        * spte can be established without taking the mmu_lock and
+        * count is also read inside the mmu_lock critical section.
+        */
+       kvm->mmu_notifier_count++;
+       for (; start < end; start += PAGE_SIZE)
+               need_tlb_flush |= kvm_unmap_hva(kvm, start);
+       spin_unlock(&kvm->mmu_lock);
+
+       /* we've to flush the tlb before the pages can be freed */
+       if (need_tlb_flush)
+               kvm_flush_remote_tlbs(kvm);
+}
+
+static void kvm_mmu_notifier_invalidate_range_end(struct mmu_notifier *mn,
+                                                 struct mm_struct *mm,
+                                                 unsigned long start,
+                                                 unsigned long end)
+{
+       struct kvm *kvm = mmu_notifier_to_kvm(mn);
+
+       spin_lock(&kvm->mmu_lock);
+       /*
+        * This sequence increase will notify the kvm page fault that
+        * the page that is going to be mapped in the spte could have
+        * been freed.
+        */
+       kvm->mmu_notifier_seq++;
+       /*
+        * The above sequence increase must be visible before the
+        * below count decrease but both values are read by the kvm
+        * page fault under mmu_lock spinlock so we don't need to add
+        * a smb_wmb() here in between the two.
+        */
+       kvm->mmu_notifier_count--;
+       spin_unlock(&kvm->mmu_lock);
+
+       BUG_ON(kvm->mmu_notifier_count < 0);
+}
+
+static int kvm_mmu_notifier_clear_flush_young(struct mmu_notifier *mn,
+                                             struct mm_struct *mm,
+                                             unsigned long address)
+{
+       struct kvm *kvm = mmu_notifier_to_kvm(mn);
+       int young;
+
+       spin_lock(&kvm->mmu_lock);
+       young = kvm_age_hva(kvm, address);
+       spin_unlock(&kvm->mmu_lock);
+
+       if (young)
+               kvm_flush_remote_tlbs(kvm);
+
+       return young;
+}
+
+static const struct mmu_notifier_ops kvm_mmu_notifier_ops = {
+       .invalidate_page        = kvm_mmu_notifier_invalidate_page,
+       .invalidate_range_start = kvm_mmu_notifier_invalidate_range_start,
+       .invalidate_range_end   = kvm_mmu_notifier_invalidate_range_end,
+       .clear_flush_young      = kvm_mmu_notifier_clear_flush_young,
+};
+#endif /* CONFIG_MMU_NOTIFIER && KVM_ARCH_WANT_MMU_NOTIFIER */
+
 static struct kvm *kvm_create_vm(void)
 {
        struct kvm *kvm = kvm_arch_create_vm();
@@ -212,6 +329,21 @@ static struct kvm *kvm_create_vm(void)
                        (struct kvm_coalesced_mmio_ring *)page_address(page);
 #endif
 
+#if defined(CONFIG_MMU_NOTIFIER) && defined(KVM_ARCH_WANT_MMU_NOTIFIER)
+       {
+               int err;
+               kvm->mmu_notifier.ops = &kvm_mmu_notifier_ops;
+               err = mmu_notifier_register(&kvm->mmu_notifier, current->mm);
+               if (err) {
+#ifdef KVM_COALESCED_MMIO_PAGE_OFFSET
+                       put_page(page);
+#endif
+                       kfree(kvm);
+                       return ERR_PTR(err);
+               }
+       }
+#endif
+
        kvm->mm = current->mm;
        atomic_inc(&kvm->mm->mm_count);
        spin_lock_init(&kvm->mmu_lock);
@@ -271,6 +403,9 @@ static void kvm_destroy_vm(struct kvm *kvm)
 #ifdef KVM_COALESCED_MMIO_PAGE_OFFSET
        if (kvm->coalesced_mmio_ring != NULL)
                free_page((unsigned long)kvm->coalesced_mmio_ring);
+#endif
+#if defined(CONFIG_MMU_NOTIFIER) && defined(KVM_ARCH_WANT_MMU_NOTIFIER)
+       mmu_notifier_unregister(&kvm->mmu_notifier, kvm->mm);
 #endif
        kvm_arch_destroy_vm(kvm);
        mmdrop(mm);
@@ -375,7 +510,15 @@ int __kvm_set_memory_region(struct kvm *kvm,
                memset(new.rmap, 0, npages * sizeof(*new.rmap));
 
                new.user_alloc = user_alloc;
-               new.userspace_addr = mem->userspace_addr;
+               /*
+                * hva_to_rmmap() serialzies with the mmu_lock and to be
+                * safe it has to ignore memslots with !user_alloc &&
+                * !userspace_addr.
+                */
+               if (user_alloc)
+                       new.userspace_addr = mem->userspace_addr;
+               else
+                       new.userspace_addr = 0;
        }
        if (npages && !new.lpage_info) {
                int largepages = npages / KVM_PAGES_PER_HPAGE;
@@ -408,17 +551,21 @@ int __kvm_set_memory_region(struct kvm *kvm,
        }
 #endif /* not defined CONFIG_S390 */
 
-       if (mem->slot >= kvm->nmemslots)
-               kvm->nmemslots = mem->slot + 1;
-
        if (!npages)
                kvm_arch_flush_shadow(kvm);
 
+       spin_lock(&kvm->mmu_lock);
+       if (mem->slot >= kvm->nmemslots)
+               kvm->nmemslots = mem->slot + 1;
+
        *memslot = new;
+       spin_unlock(&kvm->mmu_lock);
 
        r = kvm_arch_set_memory_region(kvm, mem, old, user_alloc);
        if (r) {
+               spin_lock(&kvm->mmu_lock);
                *memslot = old;
+               spin_unlock(&kvm->mmu_lock);
                goto out_free;
        }