]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge omap-drivers
authorTony Lindgren <tony@atomide.com>
Thu, 21 Jun 2007 07:36:21 +0000 (00:36 -0700)
committerTony Lindgren <tony@atomide.com>
Thu, 21 Jun 2007 07:36:21 +0000 (00:36 -0700)
Merge branches 'master' and 'omap-drivers'

Conflicts:

arch/arm/configs/omap_h2_1610_defconfig
arch/arm/configs/omap_osk_5912_defconfig
arch/arm/mach-omap1/board-h2.c
arch/arm/mach-omap1/board-palmte.c
arch/arm/mach-omap1/board-palmtt.c
arch/arm/mach-omap1/board-palmz71.c
arch/arm/mach-omap1/board-sx1.c
arch/arm/mach-omap2/Kconfig
arch/arm/mach-omap2/Makefile
arch/arm/mach-omap2/board-2430sdp.c
arch/arm/mach-omap2/board-apollon-keys.c
arch/arm/mach-omap2/board-apollon.c
arch/arm/mach-omap2/board-h4.c
arch/arm/mach-omap2/board-n800-audio.c
arch/arm/mach-omap2/board-n800-dsp.c
arch/arm/mach-omap2/board-n800-usb.c
arch/arm/mach-omap2/board-n800.c
arch/arm/mach-omap2/devices.c
arch/arm/mach-omap2/io.c
arch/arm/mach-omap2/memory.c
arch/arm/mach-omap2/pm.c
arch/arm/mach-omap2/sleep.S
arch/arm/plat-omap/Makefile
arch/arm/plat-omap/common.c
arch/arm/plat-omap/dsp/dsp_common.c
arch/arm/plat-omap/dsp/dsp_common.h
arch/arm/plat-omap/dsp/omap2_dsp.h
arch/arm/plat-omap/timer32k.c
drivers/Makefile
drivers/i2c/busses/i2c-omap.c
drivers/i2c/chips/Kconfig
drivers/i2c/chips/Makefile
drivers/i2c/chips/menelaus.c
drivers/i2c/chips/tlv320aic23.c
drivers/i2c/chips/twl4030_core.c
drivers/mtd/onenand/omap2.c
drivers/spi/Kconfig
drivers/spi/omap2_mcspi.c
drivers/spi/tsc2101.c
drivers/spi/tsc2102.c
drivers/spi/tsc2301-core.c
drivers/video/omap/Kconfig
drivers/video/omap/Makefile
include/asm-arm/arch-omap/board-2430sdp.h
include/asm-arm/arch-omap/eac.h
include/asm-arm/arch-omap/gpio.h
include/asm-arm/arch-omap/io.h
include/asm-arm/arch-omap/menelaus.h
include/asm-arm/arch-omap/mmc.h
include/asm-arm/arch-omap/omap24xx.h
include/asm-arm/arch-omap/onenand.h
include/asm-arm/arch-omap/pm.h
include/asm-arm/arch-omap/twl4030.h
include/asm-arm/hardware/tsc2101.h
include/linux/i2c-id.h
include/linux/spi/tsc2102.h
net/ipv4/netfilter/Kconfig

559 files changed:
Documentation/SubmittingPatches
Documentation/atomic_ops.txt
Documentation/driver-model/platform.txt
Documentation/feature-removal-schedule.txt
Documentation/filesystems/tmpfs.txt
Documentation/firmware_class/README
Documentation/firmware_class/firmware_sample_driver.c
Documentation/firmware_class/firmware_sample_firmware_class.c
Documentation/networking/00-INDEX
Documentation/networking/cxacru.txt [new file with mode: 0644]
Documentation/powerpc/booting-without-of.txt
MAINTAINERS
Makefile
arch/arm/boot/compressed/head.S
arch/arm/mach-at91/clock.c
arch/arm/mach-at91/pm.c
arch/arm/mach-omap2/board-n800-pm.c [new file with mode: 0644]
arch/arm/mach-s3c2440/mach-anubis.c
arch/arm/mach-s3c2440/mach-osiris.c
arch/arm/oprofile/op_model_mpcore.c
arch/arm/vfp/entry.S
arch/arm/vfp/vfpmodule.c
arch/avr32/boards/atstk1000/atstk1002.c
arch/avr32/mm/fault.c
arch/blackfin/Kconfig
arch/blackfin/configs/BF533-EZKIT_defconfig
arch/blackfin/configs/BF533-STAMP_defconfig
arch/blackfin/configs/BF537-STAMP_defconfig
arch/blackfin/configs/BF561-EZKIT_defconfig
arch/blackfin/configs/PNAV-10_defconfig
arch/blackfin/defconfig [deleted file]
arch/blackfin/kernel/bfin_dma_5xx.c
arch/blackfin/kernel/bfin_gpio.c
arch/blackfin/kernel/entry.S
arch/blackfin/kernel/irqchip.c
arch/blackfin/kernel/setup.c
arch/blackfin/kernel/traps.c
arch/blackfin/kernel/vmlinux.lds.S
arch/blackfin/lib/divsi3.S
arch/blackfin/lib/ins.S
arch/blackfin/lib/memchr.S
arch/blackfin/lib/memcmp.S
arch/blackfin/lib/memcpy.S
arch/blackfin/lib/memmove.S
arch/blackfin/lib/memset.S
arch/blackfin/lib/modsi3.S
arch/blackfin/lib/outs.S
arch/blackfin/lib/smulsi3_highpart.S
arch/blackfin/lib/udivsi3.S
arch/blackfin/lib/umodsi3.S
arch/blackfin/lib/umulsi3_highpart.S
arch/blackfin/mach-bf533/boards/cm_bf533.c
arch/blackfin/mach-bf533/boards/ezkit.c
arch/blackfin/mach-bf533/head.S
arch/blackfin/mach-bf533/ints-priority.c
arch/blackfin/mach-bf537/boards/generic_board.c
arch/blackfin/mach-bf537/boards/pnav10.c
arch/blackfin/mach-bf537/boards/stamp.c
arch/blackfin/mach-bf537/head.S
arch/blackfin/mach-bf537/ints-priority.c
arch/blackfin/mach-bf561/boards/cm_bf561.c
arch/blackfin/mach-bf561/head.S
arch/blackfin/mach-bf561/ints-priority.c
arch/blackfin/mach-common/cache.S
arch/blackfin/mach-common/cacheinit.S
arch/blackfin/mach-common/cplbhdlr.S
arch/blackfin/mach-common/cplbinfo.c
arch/blackfin/mach-common/cplbmgr.S
arch/blackfin/mach-common/entry.S
arch/blackfin/mach-common/interrupt.S
arch/blackfin/mach-common/ints-priority-dc.c
arch/blackfin/mach-common/ints-priority-sc.c
arch/blackfin/mach-common/lock.S
arch/blackfin/mach-common/pm.c
arch/blackfin/mm/blackfin_sram.c
arch/blackfin/mm/init.c
arch/i386/kernel/cpu/perfctr-watchdog.c
arch/i386/math-emu/fpu_entry.c
arch/i386/mm/fault.c
arch/m68knommu/platform/5307/timers.c
arch/mips/Kconfig
arch/mips/emma2rh/markeins/setup.c
arch/mips/kernel/linux32.c
arch/mips/kernel/r4k_switch.S
arch/mips/kernel/scall32-o32.S
arch/mips/kernel/scall64-64.S
arch/mips/kernel/scall64-n32.S
arch/mips/kernel/scall64-o32.S
arch/mips/kernel/smp-mt.c
arch/mips/kernel/smp.c
arch/mips/kernel/smtc-asm.S
arch/mips/kernel/smtc.c
arch/mips/kernel/time.c
arch/mips/kernel/traps.c
arch/mips/mips-boards/atlas/atlas_int.c
arch/mips/mips-boards/atlas/atlas_setup.c
arch/mips/mips-boards/generic/display.c
arch/mips/mips-boards/generic/init.c
arch/mips/mips-boards/generic/pci.c
arch/mips/mips-boards/generic/time.c
arch/mips/mips-boards/malta/malta_int.c
arch/mips/mips-boards/malta/malta_setup.c
arch/mips/mips-boards/sead/sead_setup.c
arch/mips/mm/dma-default.c
arch/mips/oprofile/op_model_mipsxx.c
arch/mips/qemu/q-irq.c
arch/mips/sgi-ip27/ip27-memory.c
arch/mips/sni/pcimt.c
arch/mips/sni/setup.c
arch/parisc/hpux/fs.c
arch/parisc/kernel/entry.S
arch/parisc/kernel/firmware.c
arch/parisc/kernel/hardware.c
arch/parisc/kernel/hpmc.S
arch/parisc/kernel/irq.c
arch/parisc/kernel/pci-dma.c
arch/parisc/kernel/perf.c
arch/parisc/kernel/process.c
arch/parisc/kernel/processor.c
arch/parisc/kernel/setup.c
arch/parisc/kernel/signal32.h
arch/parisc/kernel/smp.c
arch/parisc/kernel/sys_parisc32.c
arch/parisc/kernel/syscall.S
arch/parisc/kernel/syscall_table.S
arch/parisc/kernel/time.c
arch/parisc/kernel/traps.c
arch/parisc/kernel/unwind.c
arch/parisc/math-emu/dbl_float.h
arch/parisc/math-emu/dfsqrt.c
arch/parisc/math-emu/sfsqrt.c
arch/parisc/math-emu/sgl_float.h
arch/parisc/mm/init.c
arch/powerpc/boot/crt0.S
arch/powerpc/kernel/of_platform.c
arch/powerpc/kernel/udbg.c
arch/powerpc/platforms/cell/cbe_cpufreq.c
arch/powerpc/platforms/cell/spufs/context.c
arch/powerpc/platforms/cell/spufs/file.c
arch/powerpc/platforms/cell/spufs/inode.c
arch/powerpc/platforms/cell/spufs/sched.c
arch/powerpc/platforms/cell/spufs/spufs.h
arch/powerpc/platforms/celleb/Makefile
arch/powerpc/platforms/pasemi/iommu.c
arch/powerpc/platforms/powermac/setup.c
arch/powerpc/platforms/powermac/smp.c
arch/ppc/syslib/qspan_pci.c
arch/sh/boards/se/73180/setup.c
arch/sh/boards/superh/microdev/irq.c
arch/sh/cchips/voyagergx/irq.c
arch/sh/kernel/cpu/sh3/entry.S
arch/sh/kernel/cpu/sh4/clock-sh4-202.c
arch/sh/mm/ioremap.c
arch/sh64/kernel/pci_sh5.c
arch/sparc64/Kconfig
arch/sparc64/kernel/Makefile
arch/sparc64/kernel/entry.S
arch/sparc64/kernel/irq.c
arch/sparc64/kernel/mdesc.c
arch/sparc64/kernel/of_device.c
arch/sparc64/kernel/pci.c
arch/sparc64/kernel/pci_common.c
arch/sparc64/kernel/pci_sabre.c
arch/sparc64/kernel/prom.c
arch/sparc64/kernel/sbus.c
arch/sparc64/kernel/setup.c
arch/sparc64/kernel/smp.c
arch/sparc64/kernel/sparc64_ksyms.c
arch/sparc64/kernel/sysfs.c [new file with mode: 0644]
arch/um/Kconfig
arch/um/drivers/line.c
arch/um/drivers/stderr_console.c
arch/um/drivers/ubd_kern.c
arch/um/include/common-offsets.h
arch/um/kernel/exitcode.c
arch/um/os-Linux/main.c
arch/um/os-Linux/skas/mem.c
arch/um/os-Linux/skas/process.c
arch/um/os-Linux/start_up.c
arch/x86_64/kernel/traps.c
arch/x86_64/mm/fault.c
arch/x86_64/mm/init.c
arch/xtensa/kernel/asm-offsets.c
arch/xtensa/kernel/entry.S
arch/xtensa/kernel/head.S
arch/xtensa/kernel/pci.c
arch/xtensa/kernel/setup.c
arch/xtensa/kernel/signal.c
arch/xtensa/kernel/vmlinux.lds.S
arch/xtensa/kernel/xtensa_ksyms.c
arch/xtensa/lib/strncpy_user.S
arch/xtensa/lib/strnlen_user.S
arch/xtensa/mm/init.c
arch/xtensa/platform-iss/network.c
block/ll_rw_blk.c
drivers/acpi/toshiba_acpi.c
drivers/ata/Kconfig
drivers/ata/ahci.c
drivers/ata/libata-core.c
drivers/ata/libata-scsi.c
drivers/ata/libata-sff.c
drivers/ata/pata_isapnp.c
drivers/ata/sata_promise.c
drivers/base/class.c
drivers/base/core.c
drivers/base/dd.c
drivers/base/firmware_class.c
drivers/block/loop.c
drivers/cdrom/mcdx.c
drivers/char/agp/agp.h
drivers/char/agp/intel-agp.c
drivers/char/drm/drm_pciids.h
drivers/char/drm/i915_dma.c
drivers/char/drm/i915_drm.h
drivers/char/drm/i915_drv.h
drivers/char/drm/radeon_ioc32.c
drivers/char/random.c
drivers/char/stallion.c
drivers/char/tty_io.c
drivers/ide/ide-disk.c
drivers/ide/ide-probe.c
drivers/ide/ide.c
drivers/ide/pci/amd74xx.c
drivers/ide/pci/generic.c
drivers/ide/pci/hpt366.c
drivers/ide/pci/it821x.c
drivers/ide/pci/serverworks.c
drivers/infiniband/core/cma.c
drivers/infiniband/hw/amso1100/c2.c
drivers/infiniband/hw/mlx4/qp.c
drivers/infiniband/hw/mthca/mthca_cmd.c
drivers/input/Kconfig
drivers/input/Makefile
drivers/input/input-polldev.c [moved from drivers/input/misc/input-polldev.c with 100% similarity]
drivers/input/keyboard/pxa27x_keyboard.c
drivers/input/misc/Kconfig
drivers/input/misc/Makefile
drivers/input/serio/i8042-x86ia64io.h
drivers/input/touchscreen/usbtouchscreen.c
drivers/isdn/hardware/eicon/divasfunc.c
drivers/kvm/kvm.h
drivers/kvm/kvm_main.c
drivers/kvm/vmx.c
drivers/md/raid1.c
drivers/md/raid10.c
drivers/media/common/Kconfig
drivers/media/dvb/b2c2/Makefile
drivers/media/dvb/cinergyT2/cinergyT2.c
drivers/media/dvb/frontends/tda10086.c
drivers/media/dvb/frontends/tda826x.c
drivers/media/video/Kconfig
drivers/media/video/ivtv/ivtv-cards.h
drivers/media/video/ivtv/ivtv-driver.c
drivers/media/video/ivtv/ivtv-driver.h
drivers/media/video/ivtv/ivtv-fileops.c
drivers/media/video/ivtv/ivtv-ioctl.c
drivers/media/video/ivtv/ivtv-irq.c
drivers/media/video/ivtv/ivtv-queue.c
drivers/media/video/ivtv/ivtv-queue.h
drivers/media/video/ivtv/ivtv-streams.c
drivers/media/video/ivtv/ivtv-vbi.c
drivers/media/video/ivtv/ivtv-vbi.h
drivers/media/video/saa7111.c
drivers/media/video/usbvision/usbvision-core.c
drivers/media/video/usbvision/usbvision.h
drivers/mmc/core/sd.c
drivers/mmc/host/at91_mci.c
drivers/mmc/host/au1xmmc.c
drivers/mmc/host/omap.c
drivers/net/bnx2.c
drivers/net/bnx2.h
drivers/net/e100.c
drivers/net/ehea/ehea.h
drivers/net/ehea/ehea_main.c
drivers/net/ibmveth.c
drivers/net/lasi_82596.c
drivers/net/mlx4/cq.c
drivers/net/mlx4/eq.c
drivers/net/mlx4/fw.c
drivers/net/mlx4/intf.c
drivers/net/mlx4/main.c
drivers/net/mlx4/mr.c
drivers/net/myri10ge/myri10ge.c
drivers/net/netxen/netxen_nic.h
drivers/net/netxen/netxen_nic_ethtool.c
drivers/net/netxen/netxen_nic_hw.c
drivers/net/netxen/netxen_nic_init.c
drivers/net/netxen/netxen_nic_isr.c
drivers/net/netxen/netxen_nic_main.c
drivers/net/netxen/netxen_nic_niu.c
drivers/net/phy/marvell.c
drivers/net/ppp_mppe.c
drivers/net/smc91x.h
drivers/net/usb/Kconfig
drivers/net/via-velocity.c
drivers/net/wireless/Kconfig
drivers/net/wireless/libertas/11d.c
drivers/net/wireless/libertas/11d.h
drivers/net/wireless/libertas/Makefile
drivers/net/wireless/libertas/README
drivers/net/wireless/libertas/assoc.c
drivers/net/wireless/libertas/assoc.h
drivers/net/wireless/libertas/cmd.c
drivers/net/wireless/libertas/cmdresp.c
drivers/net/wireless/libertas/debugfs.c
drivers/net/wireless/libertas/decl.h
drivers/net/wireless/libertas/defs.h
drivers/net/wireless/libertas/dev.h
drivers/net/wireless/libertas/ethtool.c
drivers/net/wireless/libertas/fw.c
drivers/net/wireless/libertas/fw.h [deleted file]
drivers/net/wireless/libertas/host.h
drivers/net/wireless/libertas/hostcmd.h
drivers/net/wireless/libertas/if_bootcmd.c
drivers/net/wireless/libertas/if_usb.c
drivers/net/wireless/libertas/if_usb.h
drivers/net/wireless/libertas/ioctl.c
drivers/net/wireless/libertas/join.c
drivers/net/wireless/libertas/join.h
drivers/net/wireless/libertas/main.c
drivers/net/wireless/libertas/rx.c
drivers/net/wireless/libertas/sbi.h [deleted file]
drivers/net/wireless/libertas/scan.c
drivers/net/wireless/libertas/scan.h
drivers/net/wireless/libertas/thread.h
drivers/net/wireless/libertas/tx.c
drivers/net/wireless/libertas/types.h
drivers/net/wireless/libertas/wext.c
drivers/net/wireless/libertas/wext.h
drivers/parisc/ccio-dma.c
drivers/parisc/eisa.c
drivers/parisc/iommu-helpers.h
drivers/parisc/pdc_stable.c
drivers/parisc/power.c
drivers/parisc/sba_iommu.c
drivers/parisc/superio.c
drivers/parport/parport_gsc.c
drivers/scsi/ide-scsi.c
drivers/serial/amba-pl010.c
drivers/serial/bfin_5xx.c
drivers/spi/spi_bfin5xx.c
drivers/tc/zs.c
drivers/usb/atm/cxacru.c
drivers/usb/class/usblp.c
drivers/usb/core/Kconfig
drivers/usb/core/config.c
drivers/usb/gadget/epautoconf.c
drivers/usb/gadget/inode.c
drivers/usb/gadget/net2280.c
drivers/usb/gadget/omap_udc.c
drivers/usb/gadget/rndis.c
drivers/usb/host/ohci-hub.c
drivers/usb/storage/unusual_devs.h
drivers/video/console/Makefile
drivers/video/console/sticore.c
drivers/video/ffb.c
drivers/video/sunxvr2500.c
drivers/video/sunxvr500.c
fs/binfmt_flat.c
fs/cifs/cifs_debug.c
fs/cifs/cifs_unicode.c
fs/cifs/cifsfs.c
fs/cifs/cifssmb.c
fs/cifs/connect.c
fs/cifs/dir.c
fs/cifs/fcntl.c
fs/cifs/inode.c
fs/cifs/ioctl.c
fs/cifs/rfc1002pdu.h
fs/fuse/inode.c
fs/hugetlbfs/inode.c
fs/ocfs2/aops.c
fs/ocfs2/cluster/masklog.c
fs/ramfs/file-nommu.c
fs/splice.c
fs/sysfs/dir.c
fs/sysfs/inode.c
fs/sysfs/mount.c
fs/sysfs/sysfs.h
fs/udf/inode.c
fs/udf/truncate.c
fs/udf/udfdecl.h
include/asm-arm/arch-at91/at91_shdwc.h
include/asm-arm/arch-at91/at91_wdt.h
include/asm-arm/arch-pxa/gpio.h
include/asm-arm/arch-s3c2410/anubis-cpld.h
include/asm-arm/arch-s3c2410/anubis-map.h
include/asm-arm/arch-s3c2410/osiris-cpld.h
include/asm-arm/arch-s3c2410/osiris-map.h
include/asm-arm/linkage.h
include/asm-avr32/arch-at32ap/gpio.h
include/asm-avr32/cache.h
include/asm-blackfin/blackfin.h
include/asm-blackfin/gpio.h
include/asm-blackfin/mach-common/def_LPBlackfin.h
include/asm-blackfin/macros.h
include/asm-frv/system.h
include/asm-generic/pgtable.h
include/asm-i386/pgtable.h
include/asm-ia64/pgtable.h
include/asm-mips/asmmacro.h
include/asm-mips/bitops.h
include/asm-mips/mips-boards/generic.h
include/asm-mips/mips-boards/msc01_pci.h
include/asm-mips/mips-boards/prom.h
include/asm-mips/stackframe.h
include/asm-mips/unistd.h
include/asm-parisc/hardware.h
include/asm-parisc/linkage.h
include/asm-parisc/processor.h
include/asm-parisc/unistd.h
include/asm-powerpc/pgtable-ppc32.h
include/asm-powerpc/pgtable-ppc64.h
include/asm-ppc/pgtable.h
include/asm-s390/pgtable.h
include/asm-sh/se73180.h
include/asm-sparc/pgtable.h
include/asm-sparc64/cpudata.h
include/asm-sparc64/dma-mapping.h
include/asm-sparc64/hypervisor.h
include/asm-sparc64/irq.h
include/asm-sparc64/parport.h
include/asm-sparc64/smp.h
include/asm-sparc64/topology.h
include/asm-um/a.out.h
include/asm-x86_64/pgtable.h
include/asm-xtensa/bitops.h
include/asm-xtensa/byteorder.h
include/asm-xtensa/coprocessor.h
include/asm-xtensa/div64.h
include/asm-xtensa/elf.h
include/asm-xtensa/fcntl.h
include/asm-xtensa/mmu_context.h
include/asm-xtensa/page.h
include/asm-xtensa/param.h
include/asm-xtensa/ptrace.h
include/asm-xtensa/shmparam.h
include/asm-xtensa/sigcontext.h
include/asm-xtensa/thread_info.h
include/asm-xtensa/unistd.h
include/linux/ata.h
include/linux/console_struct.h
include/linux/hugetlb.h
include/linux/i2c-id.h
include/linux/ide.h
include/linux/inetdevice.h
include/linux/kernel.h
include/linux/ktime.h
include/linux/libata.h
include/linux/netfilter_ipv4/ip_tables.h
include/linux/pci_ids.h
include/linux/pipe_fs_i.h
include/linux/rfkill.h
include/linux/sched.h
include/linux/skbuff.h
include/linux/slub_def.h
include/linux/spi/spi.h
include/linux/videodev2.h
include/net/cipso_ipv4.h
include/net/fib_rules.h
include/net/genetlink.h
include/net/ip.h
include/net/ip_fib.h
include/net/irda/irlap.h
include/net/netlabel.h
include/net/netlink.h
include/net/sctp/sctp.h
include/net/sctp/structs.h
include/net/udp.h
include/net/udplite.h
include/net/xfrm.h
ipc/shm.c
kernel/cpuset.c
kernel/exit.c
kernel/futex.c
kernel/power/user.c
kernel/rtmutex.c
kernel/signal.c
lib/hexdump.c
lib/kobject.c
mm/hugetlb.c
mm/memory.c
mm/page_alloc.c
mm/shmem.c
mm/slab.c
mm/slub.c
mm/sparse.c
net/core/dev.c
net/core/dst.c
net/core/neighbour.c
net/core/rtnetlink.c
net/decnet/dn_dev.c
net/decnet/dn_rules.c
net/ipv4/arp.c
net/ipv4/cipso_ipv4.c
net/ipv4/devinet.c
net/ipv4/fib_frontend.c
net/ipv4/fib_rules.c
net/ipv4/igmp.c
net/ipv4/ip_output.c
net/ipv4/ipmr.c
net/ipv4/netfilter/ip_tables.c
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
net/ipv4/proc.c
net/ipv4/route.c
net/ipv4/sysctl_net_ipv4.c
net/ipv4/tcp_bic.c
net/ipv4/tcp_cubic.c
net/ipv4/tcp_illinois.c
net/ipv4/tcp_input.c
net/ipv4/tcp_ipv4.c
net/ipv4/tcp_lp.c
net/ipv4/tcp_probe.c
net/ipv4/tcp_timer.c
net/ipv4/tcp_vegas.c
net/ipv4/tcp_veno.c
net/ipv4/udp.c
net/ipv4/udp_impl.h
net/ipv4/udplite.c
net/ipv6/addrconf.c
net/ipv6/fib6_rules.c
net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
net/ipv6/route.c
net/ipv6/tcp_ipv6.c
net/ipv6/udp.c
net/ipv6/udp_impl.h
net/ipv6/udplite.c
net/irda/irlap_event.c
net/irda/irlap_frame.c
net/key/af_key.c
net/mac80211/debugfs.c
net/mac80211/ieee80211_sta.c
net/netfilter/nf_conntrack_amanda.c
net/netfilter/nf_conntrack_core.c
net/netfilter/nf_conntrack_expect.c
net/netfilter/nf_conntrack_helper.c
net/netfilter/nf_conntrack_netlink.c
net/netfilter/nf_conntrack_proto_gre.c
net/netlabel/netlabel_cipso_v4.c
net/netlabel/netlabel_kapi.c
net/netlabel/netlabel_mgmt.c
net/netlabel/netlabel_unlabeled.c
net/netlink/attr.c
net/netlink/genetlink.c
net/rxrpc/ar-connection.c
net/sched/sch_atm.c
net/sched/sch_cbq.c
net/sctp/associola.c
net/sctp/input.c
net/sctp/socket.c
net/sctp/transport.c
net/unix/af_unix.c
net/wireless/sysfs.c
net/xfrm/xfrm_policy.c
net/xfrm/xfrm_state.c
net/xfrm/xfrm_user.c
scripts/checkpatch.pl [changed mode: 0644->0755]
scripts/mod/modpost.c
security/selinux/netlabel.c

index d91125ab6f49253fece7bc6e056cd248ec7812ec..0958e97d4bf4326ad0f6bc6418263f403d168eda 100644 (file)
@@ -340,8 +340,32 @@ now, but you can do this to mark internal company procedures or just
 point out some special detail about the sign-off. 
 
 
+13) When to use Acked-by:
 
-13) The canonical patch format
+The Signed-off-by: tag indicates that the signer was involved in the
+development of the patch, or that he/she was in the patch's delivery path.
+
+If a person was not directly involved in the preparation or handling of a
+patch but wishes to signify and record their approval of it then they can
+arrange to have an Acked-by: line added to the patch's changelog.
+
+Acked-by: is often used by the maintainer of the affected code when that
+maintainer neither contributed to nor forwarded the patch.
+
+Acked-by: is not as formal as Signed-off-by:.  It is a record that the acker
+has at least reviewed the patch and has indicated acceptance.  Hence patch
+mergers will sometimes manually convert an acker's "yep, looks good to me"
+into an Acked-by:.
+
+Acked-by: does not necessarily indicate acknowledgement of the entire patch.
+For example, if a patch affects multiple subsystems and has an Acked-by: from
+one subsystem maintainer then this usually indicates acknowledgement of just
+the part which affects that maintainer's code.  Judgement should be used here.
+ When in doubt people should refer to the original discussion in the mailing
+list archives.
+
+
+14) The canonical patch format
 
 The canonical patch subject line is:
 
index 2a63d5662a93a1fd2e0889bc6aab93c1ae987102..05851e9982edfefbab5ead5b774ab976926a12e4 100644 (file)
@@ -149,7 +149,7 @@ defined which accomplish this:
        void smp_mb__before_atomic_dec(void);
        void smp_mb__after_atomic_dec(void);
        void smp_mb__before_atomic_inc(void);
-       void smp_mb__after_atomic_dec(void);
+       void smp_mb__after_atomic_inc(void);
 
 For example, smp_mb__before_atomic_dec() can be used like so:
 
index 19c4a6e136760750365483d49751edb4853daad6..2a97320ee17f1d1b1c5a9b1efc138bbea4631f0e 100644 (file)
@@ -96,6 +96,46 @@ System setup also associates those clocks with the device, so that that
 calls to clk_get(&pdev->dev, clock_name) return them as needed.
 
 
+Legacy Drivers:  Device Probing
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Some drivers are not fully converted to the driver model, because they take
+on a non-driver role:  the driver registers its platform device, rather than
+leaving that for system infrastructure.  Such drivers can't be hotplugged
+or coldplugged, since those mechanisms require device creation to be in a
+different system component than the driver.
+
+The only "good" reason for this is to handle older system designs which, like
+original IBM PCs, rely on error-prone "probe-the-hardware" models for hardware
+configuration.  Newer systems have largely abandoned that model, in favor of
+bus-level support for dynamic configuration (PCI, USB), or device tables
+provided by the boot firmware (e.g. PNPACPI on x86).  There are too many
+conflicting options about what might be where, and even educated guesses by
+an operating system will be wrong often enough to make trouble.
+
+This style of driver is discouraged.  If you're updating such a driver,
+please try to move the device enumeration to a more appropriate location,
+outside the driver.  This will usually be cleanup, since such drivers
+tend to already have "normal" modes, such as ones using device nodes that
+were created by PNP or by platform device setup.
+
+None the less, there are some APIs to support such legacy drivers.  Avoid
+using these calls except with such hotplug-deficient drivers.
+
+       struct platform_device *platform_device_alloc(
+                       char *name, unsigned id);
+
+You can use platform_device_alloc() to dynamically allocate a device, which
+you will then initialize with resources and platform_device_register().
+A better solution is usually:
+
+       struct platform_device *platform_device_register_simple(
+                       char *name, unsigned id,
+                       struct resource *res, unsigned nres);
+
+You can use platform_device_register_simple() as a one-step call to allocate
+and register a device.
+
+
 Device Naming and Driver Binding
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 The platform_device.dev.bus_id is the canonical name for the devices.
index 49ae1ea9e868d9d0803e8d2711748be45cc1a546..7d3f205b0ba50fddc8da631ba9fad29063239256 100644 (file)
@@ -104,6 +104,7 @@ Who:        Dominik Brodowski <linux@brodo.de>
 What:  remove EXPORT_SYMBOL(kernel_thread)
 When:  August 2006
 Files: arch/*/kernel/*_ksyms.c
+Funcs: kernel_thread
 Why:   kernel_thread is a low-level implementation detail.  Drivers should
         use the <linux/kthread.h> API instead which shields them from
        implementation details and provides a higherlevel interface that
index 6dd050878a2087269b9891f704177dc7f1dc1462..145e44086358653e4b8b6b17302f3b7652246194 100644 (file)
@@ -94,10 +94,10 @@ largest node numbers in the range.  For example, mpol=bind:0-3,5,7,9-15
 
 Note that trying to mount a tmpfs with an mpol option will fail if the
 running kernel does not support NUMA; and will fail if its nodelist
-specifies a node >= MAX_NUMNODES.  If your system relies on that tmpfs
-being mounted, but from time to time runs a kernel built without NUMA
-capability (perhaps a safe recovery kernel), or configured to support
-fewer nodes, then it is advisable to omit the mpol option from automatic
+specifies a node which is not online.  If your system relies on that
+tmpfs being mounted, but from time to time runs a kernel built without
+NUMA capability (perhaps a safe recovery kernel), or with fewer nodes
+online, then it is advisable to omit the mpol option from automatic
 mount options.  It can be added later, when the tmpfs is already mounted
 on MountPoint, by 'mount -o remount,mpol=Policy:NodeList MountPoint'.
 
@@ -121,4 +121,4 @@ RAM/SWAP in 10240 inodes and it is only accessible by root.
 Author:
    Christoph Rohland <cr@sap.com>, 1.12.01
 Updated:
-   Hugh Dickins <hugh@veritas.com>, 19 February 2006
+   Hugh Dickins <hugh@veritas.com>, 4 June 2007
index e9cc8bb26f7d0952b0226c66e6a43abe8e00a211..c3480aa66ba8048bf46483544ed6fb3ebb7151eb 100644 (file)
@@ -1,7 +1,7 @@
 
  request_firmware() hotplug interface:
  ------------------------------------
-       Copyright (C) 2003 Manuel Estrada Sainz <ranty@debian.org>
+       Copyright (C) 2003 Manuel Estrada Sainz
 
  Why:
  ---
index 87feccdb5c9f8f67b2739358edca07c76a9a24a1..6865cbe075ec3549cf033fa3c11c07bb0ee4eef6 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * firmware_sample_driver.c -
  *
- * Copyright (c) 2003 Manuel Estrada Sainz <ranty@debian.org>
+ * Copyright (c) 2003 Manuel Estrada Sainz
  *
  * Sample code on how to use request_firmware() from drivers.
  *
index 9e1b0e4051cd0546985b9985fd308d301d537c41..4994f1f28f8ce23bf56ec61976cbefe19c008d41 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * firmware_sample_firmware_class.c -
  *
- * Copyright (c) 2003 Manuel Estrada Sainz <ranty@debian.org>
+ * Copyright (c) 2003 Manuel Estrada Sainz
  *
  * NOTE: This is just a probe of concept, if you think that your driver would
  * be well served by this mechanism please contact me first.
@@ -19,7 +19,7 @@
 #include <linux/firmware.h>
 
 
-MODULE_AUTHOR("Manuel Estrada Sainz <ranty@debian.org>");
+MODULE_AUTHOR("Manuel Estrada Sainz");
 MODULE_DESCRIPTION("Hackish sample for using firmware class directly");
 MODULE_LICENSE("GPL");
 
index e06b6e3c1db577d5fe513cc2ea045e3d57507564..153d84d281e6aa6fa8c1bb6e001d39f8660c0444 100644 (file)
@@ -32,6 +32,8 @@ cops.txt
        - info on the COPS LocalTalk Linux driver
 cs89x0.txt
        - the Crystal LAN (CS8900/20-based) Ethernet ISA adapter driver
+cxacru.txt
+       - Conexant AccessRunner USB ADSL Modem
 de4x5.txt
        - the Digital EtherWORKS DE4?? and DE5?? PCI Ethernet driver
 decnet.txt
diff --git a/Documentation/networking/cxacru.txt b/Documentation/networking/cxacru.txt
new file mode 100644 (file)
index 0000000..b074681
--- /dev/null
@@ -0,0 +1,84 @@
+Firmware is required for this device: http://accessrunner.sourceforge.net/
+
+While it is capable of managing/maintaining the ADSL connection without the
+module loaded, the device will sometimes stop responding after unloading the
+driver and it is necessary to unplug/remove power to the device to fix this.
+
+Detected devices will appear as ATM devices named "cxacru". In /sys/class/atm/
+these are directories named cxacruN where N is the device number. A symlink
+named device points to the USB interface device's directory which contains
+several sysfs attribute files for retrieving device statistics:
+
+* adsl_controller_version
+
+* adsl_headend
+* adsl_headend_environment
+       Information about the remote headend.
+
+* downstream_attenuation (dB)
+* downstream_bits_per_frame
+* downstream_rate (kbps)
+* downstream_snr_margin (dB)
+       Downstream stats.
+
+* upstream_attenuation (dB)
+* upstream_bits_per_frame
+* upstream_rate (kbps)
+* upstream_snr_margin (dB)
+* transmitter_power (dBm/Hz)
+       Upstream stats.
+
+* downstream_crc_errors
+* downstream_fec_errors
+* downstream_hec_errors
+* upstream_crc_errors
+* upstream_fec_errors
+* upstream_hec_errors
+       Error counts.
+
+* line_startable
+       Indicates that ADSL support on the device
+       is/can be enabled, see adsl_start.
+
+* line_status
+       "initialising"
+       "down"
+       "attempting to activate"
+       "training"
+       "channel analysis"
+       "exchange"
+       "waiting"
+       "up"
+
+       Changes between "down" and "attempting to activate"
+       if there is no signal.
+
+* link_status
+       "not connected"
+       "connected"
+       "lost"
+
+* mac_address
+
+* modulation
+       "ANSI T1.413"
+       "ITU-T G.992.1 (G.DMT)"
+       "ITU-T G.992.2 (G.LITE)"
+
+* startup_attempts
+       Count of total attempts to initialise ADSL.
+
+To enable/disable ADSL, the following can be written to the adsl_state file:
+       "start"
+       "stop
+       "restart" (stops, waits 1.5s, then starts)
+       "poll" (used to resume status polling if it was disabled due to failure)
+
+Changes in adsl/line state are reported via kernel log messages:
+       [4942145.150704] ATM dev 0: ADSL state: running
+       [4942243.663766] ATM dev 0: ADSL line: down
+       [4942249.665075] ATM dev 0: ADSL line: attempting to activate
+       [4942253.654954] ATM dev 0: ADSL line: training
+       [4942255.666387] ATM dev 0: ADSL line: channel analysis
+       [4942259.656262] ATM dev 0: ADSL line: exchange
+       [2635357.696901] ATM dev 0: ADSL line: up (8128 kb/s down | 832 kb/s up)
index b49ce169a63aa27d75271a45948b0c1ed8d15ecd..d42d98107d494d906ded560a3e61bfad829e8911 100644 (file)
@@ -1,7 +1,6 @@
            Booting the Linux/ppc kernel without Open Firmware
            --------------------------------------------------
 
-
 (c) 2005 Benjamin Herrenschmidt <benh at kernel.crashing.org>,
     IBM Corp.
 (c) 2005 Becky Bruce <becky.bruce at freescale.com>,
@@ -9,6 +8,62 @@
 (c) 2006 MontaVista Software, Inc.
     Flash chip node definition
 
+Table of Contents
+=================
+
+  I - Introduction
+    1) Entry point for arch/powerpc
+    2) Board support
+
+  II - The DT block format
+    1) Header
+    2) Device tree generalities
+    3) Device tree "structure" block
+    4) Device tree "strings" block
+
+  III - Required content of the device tree
+    1) Note about cells and address representation
+    2) Note about "compatible" properties
+    3) Note about "name" properties
+    4) Note about node and property names and character set
+    5) Required nodes and properties
+      a) The root node
+      b) The /cpus node
+      c) The /cpus/* nodes
+      d) the /memory node(s)
+      e) The /chosen node
+      f) the /soc<SOCname> node
+
+  IV - "dtc", the device tree compiler
+
+  V - Recommendations for a bootloader
+
+  VI - System-on-a-chip devices and nodes
+    1) Defining child nodes of an SOC
+    2) Representing devices without a current OF specification
+      a) MDIO IO device
+      c) PHY nodes
+      b) Gianfar-compatible ethernet nodes
+      d) Interrupt controllers
+      e) I2C
+      f) Freescale SOC USB controllers
+      g) Freescale SOC SEC Security Engines
+      h) Board Control and Status (BCSR)
+      i) Freescale QUICC Engine module (QE)
+      g) Flash chip nodes
+
+  VII - Specifying interrupt information for devices
+    1) interrupts property
+    2) interrupt-parent property
+    3) OpenPIC Interrupt Controllers
+    4) ISA Interrupt Controllers
+
+  Appendix A - Sample SOC node for MPC8540
+
+
+Revision Information
+====================
+
    May 18, 2005: Rev 0.1 - Initial draft, no chapter III yet.
 
    May 19, 2005: Rev 0.2 - Add chapter III and bits & pieces here or
@@ -1687,7 +1742,7 @@ platforms are moved over to use the flattened-device-tree model.
                };
        };
 
-    g) Flash chip nodes
+    j) Flash chip nodes
 
     Flash chips (Memory Technology Devices) are often used for solid state
     file systems on embedded devices.
index f3b5a391e074822b9303d8bd06e5743efbddacaa..bef79776b388c2582513178e5618dedaf59833ea 100644 (file)
@@ -723,42 +723,52 @@ M:        rpurdie@rpsys.net
 S:     Maintained
 
 BLACKFIN ARCHITECTURE
-P:     Aubrey Li
-M:     aubrey.li@analog.com
-P:     Bernd Schmidt
-M:     bernd.schmidt@analog.com
-P:     Bryan Wu
-M:     bryan.wu@analog.com
-P:     Grace Pan
-M:     grace.pan@analog.com
-P:     Michael Hennerich
-M:     michael.hennerich@analog.com
-P:     Mike Frysinger
-M:     michael.frysinger@analog.com
-P:     Jane Lv
-M:     jane.lv@analog.com
-P:     Jerry Zeng
-M:     jerry.zeng@analog.com
-P:     Jie Zhang
-M:     jie.zhang@analog.com
-P:     Robin Getz
-M:     robin.getz@analog.com
-P:     Roy Huang
-M:     roy.huang@analog.com
-P:     Sonic Zhang
-M:     sonic.zhang@analog.com
-P:     Yi Li
-M:     yi.li@analog.com
-L:     uclinux-dist-devel@blackfin.uclinux.org
-W:     http://blackfin.uclinux.org
-S:     Supported
+P:     Aubrey Li
+M:     aubrey.li@analog.com
+P:     Bernd Schmidt
+M:     bernd.schmidt@analog.com
+P:     Bryan Wu
+M:     bryan.wu@analog.com
+P:     Grace Pan
+M:     grace.pan@analog.com
+P:     Marc Hoffman
+M:     marc.hoffman@analog.com
+P:     Michael Hennerich
+M:     michael.hennerich@analog.com
+P:     Mike Frysinger
+M:     michael.frysinger@analog.com
+P:     Jerry Zeng
+M:     jerry.zeng@analog.com
+P:     Jie Zhang
+M:     jie.zhang@analog.com
+P:     Robin Getz
+M:     robin.getz@analog.com
+P:     Roy Huang
+M:     roy.huang@analog.com
+P:     Sonic Zhang
+M:     sonic.zhang@analog.com
+P:     Vivi Li
+M:     vivi.li@analog.com
+P:     Yi Li
+M:     yi.li@analog.com
+L:     uclinux-dist-devel@blackfin.uclinux.org (subscribers-only)
+W:     http://blackfin.uclinux.org
+S:     Supported
+
+BLACKFIN RTC DRIVER
+P:     Mike Frysinger
+M:     michael.frysinger@analog.com
+M:     vapier.adi@gmail.com
+L:     uclinux-dist-devel@blackfin.uclinux.org (subscribers-only)
+W:     http://blackfin.uclinux.org
+S:     Supported
 
 BLACKFIN SERIAL DRIVER
-P:     Aubrey Li
-M:     aubrey.li@analog.com
-L:     uclinux-dist-devel@blackfin.uclinux.org
-W:     http://blackfin.uclinux.org
-S:     Supported
+P:     Aubrey Li
+M:     aubrey.li@analog.com
+L:     uclinux-dist-devel@blackfin.uclinux.org (subscribers-only)
+W:     http://blackfin.uclinux.org
+S:     Supported
 
 BAYCOM/HDLCDRV DRIVERS FOR AX.25
 P:     Thomas Sailer
@@ -782,11 +792,6 @@ M: rathamahata@php4.ru
 L:     linux-kernel@vger.kernel.org
 S:     Maintained
 
-BERKSHIRE PRODUCTS PC WATCHDOG DRIVER
-P:     Kenji Hollis
-W:     http://ftp.bitgate.com/pcwd/
-S:     Maintained
-
 BFS FILE SYSTEM
 P:     Tigran A. Aivazian
 M:     tigran@aivazian.fsnet.co.uk
@@ -3025,7 +3030,7 @@ S:        Maintained
 REISERFS FILE SYSTEM
 P:     Hans Reiser
 M:     reiserfs-dev@namesys.com
-L:     reiserfs-list@namesys.com
+L:     reiserfs-devel@vger.kernel.org
 W:     http://www.namesys.com
 S:     Supported
 
@@ -3904,10 +3909,6 @@ S:       Maintained
 
 UCLINUX FOR NEC V850
 P:     Miles Bader
-M:     uclinux-v850@lsi.nec.co.jp
-W:     http://www.ic.nec.co.jp/micro/uclinux/eng/
-W:     http://www.ee.nec.de/uclinux/
-S:     Supported
 
 UCLINUX FOR RENESAS H8/300
 P:     Yoshinori Sato
@@ -3916,10 +3917,10 @@ W:      http://uclinux-h8.sourceforge.jp/
 S:     Supported
 
 UFS FILESYSTEM
-P: Evgeniy Dushistov
-M: dushistov@mail.ru
-L: linux-kernel@vger.kernel.org
-S: Maintained
+P:     Evgeniy Dushistov
+M:     dushistov@mail.ru
+L:     linux-kernel@vger.kernel.org
+S:     Maintained
 
 USB DIAMOND RIO500 DRIVER
 P:     Cesar Miquel
index c96212206f624a882fcf5cbd5a51b96495e70a7f..a9d1b550ddc4c45f8257f103f3190269fbb3a909 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,8 @@
 VERSION = 2
 PATCHLEVEL = 6
 SUBLEVEL = 22
-EXTRAVERSION = -rc4
-NAME = Jeff Thinks I Should Change This, But To What?
+EXTRAVERSION = -rc5
+NAME = Holy Dancing Manatees, Batman!
 
 # *DOCUMENTATION*
 # To see a list of typical targets execute "make help"
index 5dedcb840e93429ca23dbc8bfc1aec7527786191..a8bdecf1af24b256741bb4d29c11803aba913a20 100644 (file)
@@ -247,7 +247,7 @@ not_relocated:      mov     r0, #0
                mov     r3, r7
                bl      decompress_kernel
 
-               add     r0, r0, #127
+               add     r0, r0, #127 + 128      @ alignment + stack
                bic     r0, r0, #127            @ align the kernel length
 /*
  * r0     = decompressed kernel length
@@ -269,6 +269,7 @@ not_relocated:      mov     r0, #0
                stmia   r1!, {r9 - r14}
                cmp     r2, r3
                blo     1b
+               add     sp, r1, #128            @ relocate the stack
 
                bl      cache_clean_flush
                add     pc, r5, r0              @ call relocation code
@@ -498,6 +499,7 @@ __common_mmu_cache_on:
  */
                .align  5
 reloc_start:   add     r9, r5, r0
+               sub     r9, r9, #128            @ do not copy the stack
                debug_reloc_start
                mov     r1, r4
 1:
@@ -508,6 +510,7 @@ reloc_start:        add     r9, r5, r0
 
                cmp     r5, r9
                blo     1b
+               add     sp, r1, #128            @ relocate the stack
                debug_reloc_end
 
 call_kernel:   bl      cache_clean_flush
index 06c9a0507d0d8316137507979a62d631f2861769..848efb2a4ebfbc14cc7bf9426dadc04ca5c194e1 100644 (file)
@@ -364,19 +364,14 @@ static int at91_clk_show(struct seq_file *s, void *unused)
 {
        u32             scsr, pcsr, sr;
        struct clk      *clk;
-       unsigned        i;
 
        seq_printf(s, "SCSR = %8x\n", scsr = at91_sys_read(AT91_PMC_SCSR));
        seq_printf(s, "PCSR = %8x\n", pcsr = at91_sys_read(AT91_PMC_PCSR));
-
        seq_printf(s, "MOR  = %8x\n", at91_sys_read(AT91_CKGR_MOR));
        seq_printf(s, "MCFR = %8x\n", at91_sys_read(AT91_CKGR_MCFR));
        seq_printf(s, "PLLA = %8x\n", at91_sys_read(AT91_CKGR_PLLAR));
        seq_printf(s, "PLLB = %8x\n", at91_sys_read(AT91_CKGR_PLLBR));
-
        seq_printf(s, "MCKR = %8x\n", at91_sys_read(AT91_PMC_MCKR));
-       for (i = 0; i < 4; i++)
-               seq_printf(s, "PCK%d = %8x\n", i, at91_sys_read(AT91_PMC_PCKR(i)));
        seq_printf(s, "SR   = %8x\n", sr = at91_sys_read(AT91_PMC_SR));
 
        seq_printf(s, "\n");
index ff8db29e989e2f39c420a9de219f63b435ace081..47ff676aca5f07e8155a4380a5f9da99f05546a5 100644 (file)
@@ -76,12 +76,11 @@ static int at91_pm_verify_clocks(void)
                        pr_debug("AT91: PM - Suspend-to-RAM with USB still active\n");
                        return 0;
                }
-       } else if (cpu_is_at91sam9260()) {
-#warning "Check SAM9260 USB clocks"
-       } else if (cpu_is_at91sam9261()) {
-#warning "Check SAM9261 USB clocks"
-       } else if (cpu_is_at91sam9263()) {
-#warning "Check SAM9263 USB clocks"
+       } else if (cpu_is_at91sam9260() || cpu_is_at91sam9261() || cpu_is_at91sam9263()) {
+               if ((scsr & (AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP)) != 0) {
+                       pr_debug("AT91: PM - Suspend-to-RAM with USB still active\n");
+                       return 0;
+               }
        }
 
 #ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS
diff --git a/arch/arm/mach-omap2/board-n800-pm.c b/arch/arm/mach-omap2/board-n800-pm.c
new file mode 100644 (file)
index 0000000..33f3e4d
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Nokia N800 PM code
+ *
+ * Copyright (C) 2006 Nokia Corporation
+ * Author: Amit Kucheria <amit.kucheria@nokia.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <asm/arch/menelaus.h>
+
+#ifdef CONFIG_MENELAUS
+
+static int n800_auto_sleep_regulators(void)
+{
+       u32 val;
+       int ret;
+
+       val = EN_VPLL_SLEEP | EN_VMMC_SLEEP    \
+               | EN_VAUX_SLEEP | EN_VIO_SLEEP \
+               | EN_VMEM_SLEEP | EN_DC3_SLEEP \
+               | EN_VC_SLEEP | EN_DC2_SLEEP;
+
+       ret = menelaus_set_regulator_sleep(1, val);
+       if (ret < 0) {
+               printk(KERN_ERR "Could not set regulators to sleep on "
+                       "menelaus: %u\n", ret);
+               return ret;
+       }
+       return 0;
+}
+
+static int n800_auto_voltage_scale(void)
+{
+       int ret;
+
+       ret = menelaus_set_vcore_hw(1400, 1050);
+       if (ret < 0) {
+               printk(KERN_ERR "Could not set VCORE voltage on "
+                       "menelaus: %u\n", ret);
+               return ret;
+       }
+       return 0;
+}
+
+static int n800_menelaus_init(struct device *dev)
+{
+       int ret;
+
+       ret = n800_auto_voltage_scale();
+       if (ret < 0)
+               return ret;
+       ret = n800_auto_sleep_regulators();
+       if (ret < 0)
+               return ret;
+       return 0;
+}
+
+static struct menelaus_platform_data n800_menelaus_platform_data = {
+       .late_init = n800_menelaus_init,
+};
+
+void __init n800_pm_init(void)
+{
+       menelaus_set_platform_data(&n800_menelaus_platform_data);
+}
+
+#else
+
+void __init n800_pm_init(void)
+{
+}
+
+#endif
+
index b5d387ef37e14046968fed05c34dd8264ba9d2c8..bff7ddd06a5288e7ed764c5fcef27444142c03dc 100644 (file)
@@ -76,8 +76,8 @@ static struct map_desc anubis_iodesc[] __initdata = {
        .length         = SZ_4K,
        .type           = MT_DEVICE,
   }, {
-       .virtual        = (u32)ANUBIS_VA_CTRL2,
-       .pfn            = __phys_to_pfn(ANUBIS_PA_CTRL2),
+       .virtual        = (u32)ANUBIS_VA_IDREG,
+       .pfn            = __phys_to_pfn(ANUBIS_PA_IDREG),
        .length         = SZ_4K,
        .type           = MT_DEVICE,
   },
index 4d6c7a574c1a22af02baf8c4c708addd8aeead81..15811601f03db435a5cb7f54db6ee88a340876c4 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/timer.h>
 #include <linux/init.h>
 #include <linux/device.h>
+#include <linux/sysdev.h>
 #include <linux/serial_core.h>
 
 #include <asm/mach/arch.h>
@@ -65,6 +66,11 @@ static struct map_desc osiris_iodesc[] __initdata = {
   /* CPLD control registers */
 
   {
+         .virtual      = (u32)OSIRIS_VA_CTRL0,
+         .pfn          = __phys_to_pfn(OSIRIS_PA_CTRL0),
+         .length       = SZ_16K,
+         .type         = MT_DEVICE,
+  }, {
          .virtual      = (u32)OSIRIS_VA_CTRL1,
          .pfn          = __phys_to_pfn(OSIRIS_PA_CTRL1),
          .length       = SZ_16K,
@@ -74,6 +80,11 @@ static struct map_desc osiris_iodesc[] __initdata = {
          .pfn          = __phys_to_pfn(OSIRIS_PA_CTRL2),
          .length       = SZ_16K,
          .type         = MT_DEVICE,
+  }, {
+         .virtual      = (u32)OSIRIS_VA_IDREG,
+         .pfn          = __phys_to_pfn(OSIRIS_PA_IDREG),
+         .length       = SZ_16K,
+         .type         = MT_DEVICE,
   },
 };
 
@@ -195,13 +206,13 @@ static void osiris_nand_select(struct s3c2410_nand_set *set, int slot)
        pr_debug("osiris_nand: selecting slot %d (set %p,%p)\n",
                 slot, set, set->nr_map);
 
-       tmp = __raw_readb(OSIRIS_VA_CTRL1);
-       tmp &= ~OSIRIS_CTRL1_NANDSEL;
+       tmp = __raw_readb(OSIRIS_VA_CTRL0);
+       tmp &= ~OSIRIS_CTRL0_NANDSEL;
        tmp |= slot;
 
-       pr_debug("osiris_nand: ctrl1 now %02x\n", tmp);
+       pr_debug("osiris_nand: ctrl0 now %02x\n", tmp);
 
-       __raw_writeb(tmp, OSIRIS_VA_CTRL1);
+       __raw_writeb(tmp, OSIRIS_VA_CTRL0);
 }
 
 static struct s3c2410_platform_nand osiris_nand_info = {
@@ -235,10 +246,45 @@ static struct platform_device osiris_pcmcia = {
        .resource       = osiris_pcmcia_resource,
 };
 
+/* Osiris power management device */
+
+#ifdef CONFIG_PM
+static unsigned char pm_osiris_ctrl0;
+
+static int osiris_pm_suspend(struct sys_device *sd, pm_message_t state)
+{
+       pm_osiris_ctrl0 = __raw_readb(OSIRIS_VA_CTRL0);
+       return 0;
+}
+
+static int osiris_pm_resume(struct sys_device *sd)
+{
+       if (pm_osiris_ctrl0 & OSIRIS_CTRL0_FIX8)
+               __raw_writeb(OSIRIS_CTRL1_FIX8, OSIRIS_VA_CTRL1);
+
+       return 0;
+}
+
+#else
+#define osiris_pm_suspend NULL
+#define osiris_pm_resume NULL
+#endif
+
+static struct sysdev_class osiris_pm_sysclass = {
+       set_kset_name("mach-osiris"),
+       .suspend        = osiris_pm_suspend,
+       .resume         = osiris_pm_resume,
+};
+
+static struct sys_device osiris_pm_sysdev = {
+       .cls            = &osiris_pm_sysclass,
+};
+
 /* Standard Osiris devices */
 
 static struct platform_device *osiris_devices[] __initdata = {
        &s3c_device_i2c,
+       &s3c_device_wdt,
        &s3c_device_nand,
        &osiris_pcmcia,
 };
@@ -288,6 +334,9 @@ static void __init osiris_map_io(void)
 
 static void __init osiris_init(void)
 {
+       sysdev_class_register(&osiris_pm_sysclass);
+       sysdev_register(&osiris_pm_sysdev);
+
        platform_add_devices(osiris_devices, ARRAY_SIZE(osiris_devices));
 };
 
@@ -299,5 +348,6 @@ MACHINE_START(OSIRIS, "Simtec-OSIRIS")
        .map_io         = osiris_map_io,
        .init_machine   = osiris_init,
        .init_irq       = s3c24xx_init_irq,
+       .init_machine   = osiris_init,
        .timer          = &s3c24xx_timer,
 MACHINE_END
index 7791da791f5f936cb54c7d1f7cf38832652007e5..75bae067922d1c55fdef728f67e8f952062009be 100644 (file)
@@ -200,8 +200,10 @@ static int em_call_function(int (*fn)(void))
        data.fn = fn;
        data.ret = 0;
 
+       preempt_disable();
        smp_call_function(em_func, &data, 1, 1);
        em_func(&data);
+       preempt_enable();
 
        return data.ret;
 }
index ca2a5ad19ea6a65ce9ee1c871a5b06fdcc9fab86..806ce26d524324dedd9c45d7ec1f5fcc8b35cc92 100644 (file)
@@ -29,6 +29,10 @@ do_vfp:
        add     r10, r10, #TI_VFPSTATE  @ r10 = workspace
        ldr     pc, [r4]                @ call VFP entry point
 
+ENTRY(vfp_null_entry)
+       mov     pc, lr
+ENDPROC(vfp_null_entry)
+
 .LCvfp:
        .word   vfp_vector
 
index 3fb644746a00b68126f4203c444a50935f36ab96..ef08da6f8898ee091ff3f6964626374c048dcf5b 100644 (file)
@@ -26,8 +26,9 @@
  */
 void vfp_testing_entry(void);
 void vfp_support_entry(void);
+void vfp_null_entry(void);
 
-void (*vfp_vector)(void) = vfp_testing_entry;
+void (*vfp_vector)(void) = vfp_null_entry;
 union vfp_state *last_VFP_context[NR_CPUS];
 
 /*
@@ -329,8 +330,10 @@ static int __init vfp_init(void)
         * The handler is already setup to just log calls, so
         * we just need to read the VFPSID register.
         */
+       vfp_vector = vfp_testing_entry;
        vfpsid = fmrx(FPSID);
        barrier();
+       vfp_vector = vfp_null_entry;
 
        printk(KERN_INFO "VFP support v0.3: ");
        if (VFP_arch) {
index fe1dbe2e28f49a82508dd966e07af6de243cf0ea..e253e86a1a39205b478a047b33d87fbad974c70d 100644 (file)
@@ -42,6 +42,7 @@ static struct spi_board_info spi0_board_info[] __initdata = {
                .modalias       = "ltv350qv",
                .max_speed_hz   = 16000000,
                .chip_select    = 1,
+               .mode           = SPI_MODE_3,
        },
 };
 
index e011f1ce1875f500507638e6317f8a66d9061c7a..4b2495285d948246372c91aa06f37ed893ad992d 100644 (file)
@@ -158,7 +158,7 @@ bad_area:
        up_read(&mm->mmap_sem);
 
        if (user_mode(regs)) {
-               if (exception_trace)
+               if (exception_trace && printk_ratelimit())
                        printk("%s%s[%d]: segfault at %08lx pc %08lx "
                               "sp %08lx ecr %lu\n",
                               is_init(tsk) ? KERN_EMERG : KERN_INFO,
index b1b111bb2f3aff22bb5d8b36959b0338faf443ea..1fad8560c7afd5175b51516bcf30b927f54dd334 100644 (file)
@@ -394,41 +394,6 @@ config BFIN_IDLE_LED_PIN
        default 0x08 if (BFIN533_STAMP && BFIN_IDLE_LED_NUM = 2)
        default 0x10 if (BFIN533_STAMP && BFIN_IDLE_LED_NUM = 3)
 
-comment "Console UART Setup"
-
-choice
-       prompt "Baud Rate"
-       default BAUD_57600
-config BAUD_9600
-       bool "9600"
-config BAUD_19200
-       bool "19200"
-config BAUD_38400
-       bool "38400"
-config BAUD_57600
-       bool "57600"
-config BAUD_115200
-       bool "115200"
-endchoice
-
-choice
-       prompt "Parity"
-       default BAUD_NO_PARITY
-config  BAUD_NO_PARITY
-       bool "No Parity"
-config  BAUD_PARITY
-       bool "Parity"
-endchoice
-
-choice
-       prompt "Stop Bits"
-       default BAUD_1_STOPBIT
-config  BAUD_1_STOPBIT
-       bool "1"
-config  BAUD_2_STOPBIT
-       bool "2"
-endchoice
-
 endmenu
 
 
index 377c8e05e4ab4ced19a96efdbf621a60fbc0b35c..90d58aabe693a4371d58cf915276f303c51f02db 100644 (file)
@@ -1,20 +1,21 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.19.3
+# Linux kernel version: 2.6.21.3
 #
 # CONFIG_MMU is not set
 # CONFIG_FPU is not set
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
 # CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
 CONFIG_BLACKFIN=y
+CONFIG_ZONE_DMA=y
 CONFIG_BFIN=y
 CONFIG_SEMAPHORE_SLEEPERS=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
 CONFIG_GENERIC_HWEIGHT=y
 CONFIG_GENERIC_HARDIRQS=y
 CONFIG_GENERIC_IRQ_PROBE=y
+# CONFIG_GENERIC_TIME is not set
 CONFIG_GENERIC_CALIBRATE_DELAY=y
-CONFIG_UCLINUX=y
 CONFIG_FORCE_MAX_ZONEORDER=14
 CONFIG_IRQCHIP_DEMUX_GPIO=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
@@ -33,13 +34,16 @@ CONFIG_LOCALVERSION=""
 CONFIG_LOCALVERSION_AUTO=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_SYSFS_DEPRECATED=y
 # CONFIG_RELAY is not set
+CONFIG_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE=""
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 CONFIG_SYSCTL=y
@@ -54,9 +58,7 @@ CONFIG_BUG=y
 CONFIG_ELF_CORE=y
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
-CONFIG_EPOLL=y
 CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3
-# CONFIG_LIMIT_PAGECACHE is not set
 CONFIG_BUDDY=y
 # CONFIG_NP2 is not set
 CONFIG_SLAB=y
@@ -80,7 +82,9 @@ 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
 
 #
 # IO Schedulers
@@ -109,7 +113,6 @@ CONFIG_PREEMPT_VOLUNTARY=y
 # CONFIG_BF532 is not set
 CONFIG_BF533=y
 # CONFIG_BF534 is not set
-# CONFIG_BF535 is not set
 # CONFIG_BF536 is not set
 # CONFIG_BF537 is not set
 # CONFIG_BF561 is not set
@@ -125,6 +128,7 @@ CONFIG_BFIN533_EZKIT=y
 # CONFIG_BFIN537_BLUETECHNIX_CM is not set
 # CONFIG_BFIN561_BLUETECHNIX_CM is not set
 # CONFIG_BFIN561_EZKIT is not set
+# CONFIG_BFIN561_TEPLA is not set
 # CONFIG_PNAV10 is not set
 # CONFIG_GENERIC_BOARD is not set
 CONFIG_MEM_MT48LC16M16A2TG_75=y
@@ -168,6 +172,7 @@ CONFIG_WDTIMER=13
 #
 # Board customizations
 #
+# CONFIG_CMDLINE_BOOL is not set
 
 #
 # Board Setup
@@ -177,19 +182,6 @@ CONFIG_MEM_SIZE=32
 CONFIG_MEM_ADD_WIDTH=9
 CONFIG_BOOT_LOAD=0x1000
 
-#
-# Console UART Setup
-#
-# CONFIG_BAUD_9600 is not set
-# CONFIG_BAUD_19200 is not set
-# CONFIG_BAUD_38400 is not set
-CONFIG_BAUD_57600=y
-# CONFIG_BAUD_115200 is not set
-CONFIG_BAUD_NO_PARITY=y
-# CONFIG_BAUD_PARITY is not set
-CONFIG_BAUD_1_STOPBIT=y
-# CONFIG_BAUD_2_STOPBIT is not set
-
 #
 # Blackfin Kernel Optimizations
 #
@@ -199,6 +191,7 @@ CONFIG_BAUD_1_STOPBIT=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
 
@@ -217,6 +210,7 @@ CONFIG_MEMSET_L1=y
 CONFIG_MEMCPY_L1=y
 CONFIG_SYS_BFIN_SPINLOCK_L1=y
 # CONFIG_IP_CHECKSUM_L1 is not set
+CONFIG_CACHELINE_ALIGNED_L1=y
 # CONFIG_SYSCALL_TAB_L1 is not set
 # CONFIG_CPLB_SWITCH_TAB_L1 is not set
 CONFIG_RAMKERNEL=y
@@ -230,6 +224,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y
 # CONFIG_SPARSEMEM_STATIC is not set
 CONFIG_SPLIT_PTLOCK_CPUS=4
 # CONFIG_RESOURCES_64BIT is not set
+CONFIG_ZONE_DMA_FLAG=1
 CONFIG_LARGE_ALLOCS=y
 CONFIG_BFIN_DMA_5XX=y
 # CONFIG_DMA_UNCACHED_2M is not set
@@ -302,7 +297,7 @@ CONFIG_BINFMT_ZFLAT=y
 # Power management options
 #
 CONFIG_PM=y
-CONFIG_PM_LEGACY=y
+# CONFIG_PM_LEGACY is not set
 # CONFIG_PM_DEBUG is not set
 # CONFIG_PM_SYSFS_DEPRECATED is not set
 CONFIG_PM_WAKEUP_GPIO_BY_SIC_IWR=y
@@ -330,6 +325,7 @@ 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_NET_KEY is not set
 CONFIG_INET=y
 # CONFIG_IP_MULTICAST is not set
@@ -356,6 +352,7 @@ 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
@@ -399,7 +396,48 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 #
 # CONFIG_NET_PKTGEN is not set
 # CONFIG_HAMRADIO is not set
-# CONFIG_IRDA is not set
+CONFIG_IRDA=m
+
+#
+# IrDA protocols
+#
+CONFIG_IRLAN=m
+CONFIG_IRCOMM=m
+# CONFIG_IRDA_ULTRA is not set
+
+#
+# IrDA options
+#
+CONFIG_IRDA_CACHE_LAST_LSAP=y
+# CONFIG_IRDA_FAST_RR is not set
+# CONFIG_IRDA_DEBUG is not set
+
+#
+# Infrared-port device drivers
+#
+
+#
+# SIR device drivers
+#
+CONFIG_IRTTY_SIR=m
+
+#
+# Dongle support
+#
+# CONFIG_DONGLE is not set
+
+#
+# Old SIR device drivers
+#
+# CONFIG_IRPORT_SIR is not set
+
+#
+# Old Serial dongle support
+#
+
+#
+# FIR device drivers
+#
 # CONFIG_BT is not set
 # CONFIG_IEEE80211 is not set
 
@@ -434,6 +472,7 @@ CONFIG_MTD_PARTITIONS=y
 # User Modules And Translation Layers
 #
 CONFIG_MTD_CHAR=m
+CONFIG_MTD_BLKDEVS=y
 CONFIG_MTD_BLOCK=y
 # CONFIG_FTL is not set
 # CONFIG_NFTL is not set
@@ -489,6 +528,8 @@ CONFIG_BFIN_FLASH_BANK_3=0x7BB0
 #
 # Self-contained MTD device drivers
 #
+# CONFIG_MTD_DATAFLASH is not set
+# CONFIG_MTD_M25P80 is not set
 # CONFIG_MTD_SLRAM is not set
 # CONFIG_MTD_PHRAM is not set
 # CONFIG_MTD_MTDRAM is not set
@@ -519,6 +560,7 @@ CONFIG_BFIN_FLASH_BANK_3=0x7BB0
 #
 # Plug and Play support
 #
+# CONFIG_PNPACPI is not set
 
 #
 # Block devices
@@ -530,14 +572,12 @@ CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=16
 CONFIG_BLK_DEV_RAM_SIZE=4096
 CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
-# CONFIG_BLK_DEV_INITRD is not set
 # CONFIG_CDROM_PKTCDVD is not set
 # CONFIG_ATA_OVER_ETH is not set
 
 #
 # Misc devices
 #
-# CONFIG_TIFM_CORE is not set
 
 #
 # ATA/ATAPI/MFM/RLL support
@@ -636,7 +676,26 @@ CONFIG_SMC91X=y
 #
 # Input device support
 #
-# CONFIG_INPUT is not set
+CONFIG_INPUT=m
+# CONFIG_INPUT_FF_MEMLESS 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=m
+# CONFIG_INPUT_EVBUG is not set
+
+#
+# Input Device Drivers
+#
+# CONFIG_INPUT_KEYBOARD is not set
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TOUCHSCREEN is not set
+# CONFIG_INPUT_MISC is not set
 
 #
 # Hardware I/O ports
@@ -649,12 +708,14 @@ CONFIG_SMC91X=y
 #
 # CONFIG_AD9960 is not set
 # CONFIG_SPI_ADC_BF533 is not set
-# CONFIG_BF533_PFLAGS is not set
+# CONFIG_BF5xx_PFLAGS is not set
 # CONFIG_BF5xx_PPIFCD is not set
 # CONFIG_BF5xx_TIMERS is not set
 # CONFIG_BF5xx_PPI is not set
-# CONFIG_BFIN_SPORT is not set
+CONFIG_BFIN_SPORT=y
 # CONFIG_BFIN_TIMER_LATENCY is not set
+# CONFIG_AD5304 is not set
+# CONFIG_BF5xx_FBDMA is not set
 # CONFIG_VT is not set
 # CONFIG_SERIAL_NONSTANDARD is not set
 
@@ -691,16 +752,19 @@ CONFIG_UNIX98_PTYS=y
 #
 # Watchdog Cards
 #
-# CONFIG_WATCHDOG is not set
+CONFIG_WATCHDOG=y
+# CONFIG_WATCHDOG_NOWAYOUT is not set
+
+#
+# Watchdog Device Drivers
+#
+# CONFIG_SOFT_WATCHDOG is not set
+CONFIG_BFIN_WDT=y
 CONFIG_HW_RANDOM=y
 # CONFIG_GEN_RTC is not set
 CONFIG_BLACKFIN_DPMC=y
 # CONFIG_DTLK is not set
 # CONFIG_R3964 is not set
-
-#
-# Ftape, the floppy tape device driver
-#
 # CONFIG_RAW_DRIVER is not set
 
 #
@@ -716,8 +780,19 @@ CONFIG_BLACKFIN_DPMC=y
 #
 # SPI support
 #
-# CONFIG_SPI is not set
-# CONFIG_SPI_MASTER is not set
+CONFIG_SPI=y
+CONFIG_SPI_MASTER=y
+
+#
+# SPI Master Controller Drivers
+#
+CONFIG_SPI_BFIN=y
+# CONFIG_SPI_BITBANG is not set
+
+#
+# SPI Protocol Masters
+#
+# CONFIG_SPI_AT25 is not set
 
 #
 # Dallas's 1-wire bus
@@ -731,9 +806,16 @@ CONFIG_HWMON=y
 # CONFIG_HWMON_VID is not set
 # CONFIG_SENSORS_ABITUGURU is not set
 # CONFIG_SENSORS_F71805F is not set
+# CONFIG_SENSORS_LM70 is not set
+# CONFIG_SENSORS_PC87427 is not set
 # CONFIG_SENSORS_VT1211 is not set
 # CONFIG_HWMON_DEBUG_CHIP is not set
 
+#
+# Multifunction device drivers
+#
+# CONFIG_MFD_SM501 is not set
+
 #
 # Multimedia devices
 #
@@ -747,15 +829,20 @@ CONFIG_HWMON=y
 #
 # Graphics support
 #
-CONFIG_FIRMWARE_EDID=y
-# CONFIG_FB is not set
 # CONFIG_BACKLIGHT_LCD_SUPPORT is not set
+# CONFIG_FB is not set
 
 #
 # Sound
 #
 # CONFIG_SOUND is not set
 
+#
+# HID Devices
+#
+CONFIG_HID=m
+# CONFIG_HID_DEBUG is not set
+
 #
 # USB support
 #
@@ -776,6 +863,7 @@ CONFIG_USB_ARCH_HAS_HCD=y
 #
 # MMC/SD Card support
 #
+# CONFIG_SPI_MMC is not set
 # CONFIG_MMC is not set
 
 #
@@ -821,8 +909,10 @@ CONFIG_RTC_INTF_DEV=y
 #
 # CONFIG_RTC_DRV_DS1553 is not set
 # CONFIG_RTC_DRV_DS1742 is not set
+# CONFIG_RTC_DRV_RS5C348 is not set
 # CONFIG_RTC_DRV_M48T86 is not set
 # CONFIG_RTC_DRV_TEST is not set
+# CONFIG_RTC_DRV_MAX6902 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 CONFIG_RTC_DRV_BFIN=y
 
@@ -839,6 +929,14 @@ CONFIG_RTC_DRV_BFIN=y
 # DMA Devices
 #
 
+#
+# Auxiliary Display support
+#
+
+#
+# Virtualization
+#
+
 #
 # PBX support
 #
@@ -847,13 +945,9 @@ CONFIG_RTC_DRV_BFIN=y
 #
 # File systems
 #
-CONFIG_EXT2_FS=y
-CONFIG_EXT2_FS_XATTR=y
-# CONFIG_EXT2_FS_POSIX_ACL is not set
-# CONFIG_EXT2_FS_SECURITY is not set
+# CONFIG_EXT2_FS is not set
 # CONFIG_EXT3_FS is not set
 # CONFIG_EXT4DEV_FS 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
@@ -862,7 +956,8 @@ CONFIG_FS_MBCACHE=y
 # CONFIG_OCFS2_FS is not set
 # CONFIG_MINIX_FS is not set
 # CONFIG_ROMFS_FS is not set
-# CONFIG_INOTIFY 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
@@ -913,7 +1008,6 @@ CONFIG_YAFFS_CHECKPOINT_RESERVED_BLOCKS=10
 # CONFIG_YAFFS_DISABLE_WIDE_TNODES is not set
 # CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set
 CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y
-# CONFIG_JFFS_FS is not set
 CONFIG_JFFS2_FS=m
 CONFIG_JFFS2_FS_DEBUG=0
 CONFIG_JFFS2_FS_WRITEBUFFER=y
@@ -945,7 +1039,8 @@ CONFIG_NFS_COMMON=y
 CONFIG_SUNRPC=m
 # CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_RPCSEC_GSS_SPKM3 is not set
-# CONFIG_SMB_FS is not set
+CONFIG_SMB_FS=m
+# CONFIG_SMB_NLS_DEFAULT is not set
 # CONFIG_CIFS is not set
 # CONFIG_NCP_FS is not set
 # CONFIG_CODA_FS is not set
@@ -961,7 +1056,51 @@ CONFIG_MSDOS_PARTITION=y
 #
 # Native Language Support
 #
-# CONFIG_NLS is not set
+CONFIG_NLS=m
+CONFIG_NLS_DEFAULT="iso8859-1"
+# CONFIG_NLS_CODEPAGE_437 is not set
+# CONFIG_NLS_CODEPAGE_737 is not set
+# CONFIG_NLS_CODEPAGE_775 is not set
+# CONFIG_NLS_CODEPAGE_850 is not set
+# CONFIG_NLS_CODEPAGE_852 is not set
+# CONFIG_NLS_CODEPAGE_855 is not set
+# CONFIG_NLS_CODEPAGE_857 is not set
+# CONFIG_NLS_CODEPAGE_860 is not set
+# CONFIG_NLS_CODEPAGE_861 is not set
+# CONFIG_NLS_CODEPAGE_862 is not set
+# CONFIG_NLS_CODEPAGE_863 is not set
+# CONFIG_NLS_CODEPAGE_864 is not set
+# CONFIG_NLS_CODEPAGE_865 is not set
+# CONFIG_NLS_CODEPAGE_866 is not set
+# CONFIG_NLS_CODEPAGE_869 is not set
+# CONFIG_NLS_CODEPAGE_936 is not set
+# CONFIG_NLS_CODEPAGE_950 is not set
+# CONFIG_NLS_CODEPAGE_932 is not set
+# CONFIG_NLS_CODEPAGE_949 is not set
+# CONFIG_NLS_CODEPAGE_874 is not set
+# CONFIG_NLS_ISO8859_8 is not set
+# CONFIG_NLS_CODEPAGE_1250 is not set
+# CONFIG_NLS_CODEPAGE_1251 is not set
+# CONFIG_NLS_ASCII is not set
+# CONFIG_NLS_ISO8859_1 is not set
+# CONFIG_NLS_ISO8859_2 is not set
+# CONFIG_NLS_ISO8859_3 is not set
+# CONFIG_NLS_ISO8859_4 is not set
+# CONFIG_NLS_ISO8859_5 is not set
+# CONFIG_NLS_ISO8859_6 is not set
+# CONFIG_NLS_ISO8859_7 is not set
+# CONFIG_NLS_ISO8859_9 is not set
+# CONFIG_NLS_ISO8859_13 is not set
+# CONFIG_NLS_ISO8859_14 is not set
+# CONFIG_NLS_ISO8859_15 is not set
+# CONFIG_NLS_KOI8_R is not set
+# CONFIG_NLS_KOI8_U is not set
+# CONFIG_NLS_UTF8 is not set
+
+#
+# Distributed Lock Manager
+#
+# CONFIG_DLM is not set
 
 #
 # Profiling support
@@ -975,19 +1114,16 @@ CONFIG_MSDOS_PARTITION=y
 CONFIG_ENABLE_MUST_CHECK=y
 # 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_HEADERS_CHECK is not set
 # CONFIG_DEBUG_SERIAL_EARLY_INIT is not set
 CONFIG_DEBUG_HUNT_FOR_ZERO=y
 # CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE is not set
-# CONFIG_BOOTPARAM is not set
-# CONFIG_NO_KERNEL_MSG is not set
 CONFIG_CPLB_INFO=y
-# CONFIG_NO_ACCESS_CHECK is not set
+CONFIG_ACCESS_CHECK=y
 
 #
 # Security options
@@ -995,7 +1131,7 @@ CONFIG_CPLB_INFO=y
 # CONFIG_KEYS is not set
 CONFIG_SECURITY=y
 # CONFIG_SECURITY_NETWORK is not set
-CONFIG_SECURITY_CAPABILITIES=y
+CONFIG_SECURITY_CAPABILITIES=m
 
 #
 # Cryptographic options
@@ -1005,10 +1141,13 @@ CONFIG_SECURITY_CAPABILITIES=y
 #
 # Library routines
 #
-# CONFIG_CRC_CCITT is not set
+CONFIG_BITREVERSE=y
+CONFIG_CRC_CCITT=m
 # CONFIG_CRC16 is not set
 CONFIG_CRC32=y
 # CONFIG_LIBCRC32C is not set
 CONFIG_ZLIB_INFLATE=y
 CONFIG_ZLIB_DEFLATE=m
 CONFIG_PLIST=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
index 14a948c288a565c6bac9e6a92386a3ca693db18e..fee918957392620125c04b273a2898d7226d991a 100644 (file)
@@ -1,12 +1,13 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.20.4
+# Linux kernel version: 2.6.21.3
 #
 # CONFIG_MMU is not set
 # CONFIG_FPU is not set
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
 # CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
 CONFIG_BLACKFIN=y
+CONFIG_ZONE_DMA=y
 CONFIG_BFIN=y
 CONFIG_SEMAPHORE_SLEEPERS=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -33,6 +34,7 @@ CONFIG_LOCALVERSION=""
 CONFIG_LOCALVERSION_AUTO=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
@@ -41,6 +43,7 @@ CONFIG_SYSVIPC=y
 # CONFIG_IKCONFIG is not set
 CONFIG_SYSFS_DEPRECATED=y
 # CONFIG_RELAY is not set
+CONFIG_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE=""
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 CONFIG_SYSCTL=y
@@ -55,9 +58,7 @@ CONFIG_BUG=y
 CONFIG_ELF_CORE=y
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
-CONFIG_EPOLL=y
 CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3
-# CONFIG_LIMIT_PAGECACHE is not set
 CONFIG_BUDDY=y
 # CONFIG_NP2 is not set
 CONFIG_SLAB=y
@@ -127,6 +128,7 @@ CONFIG_BFIN533_STAMP=y
 # CONFIG_BFIN537_BLUETECHNIX_CM is not set
 # CONFIG_BFIN561_BLUETECHNIX_CM is not set
 # CONFIG_BFIN561_EZKIT is not set
+# CONFIG_BFIN561_TEPLA is not set
 # CONFIG_PNAV10 is not set
 # CONFIG_GENERIC_BOARD is not set
 CONFIG_MEM_MT48LC64M4A2FB_7E=y
@@ -192,19 +194,6 @@ CONFIG_BFIN_ALIVE_LED_DPORT=0xFFC00730
 CONFIG_BFIN_IDLE_LED_PORT=0xFFC00700
 CONFIG_BFIN_IDLE_LED_DPORT=0xFFC00730
 
-#
-# Console UART Setup
-#
-# CONFIG_BAUD_9600 is not set
-# CONFIG_BAUD_19200 is not set
-# CONFIG_BAUD_38400 is not set
-CONFIG_BAUD_57600=y
-# CONFIG_BAUD_115200 is not set
-CONFIG_BAUD_NO_PARITY=y
-# CONFIG_BAUD_PARITY is not set
-CONFIG_BAUD_1_STOPBIT=y
-# CONFIG_BAUD_2_STOPBIT is not set
-
 #
 # Blackfin Kernel Optimizations
 #
@@ -233,6 +222,7 @@ CONFIG_MEMSET_L1=y
 CONFIG_MEMCPY_L1=y
 CONFIG_SYS_BFIN_SPINLOCK_L1=y
 # CONFIG_IP_CHECKSUM_L1 is not set
+CONFIG_CACHELINE_ALIGNED_L1=y
 # CONFIG_SYSCALL_TAB_L1 is not set
 # CONFIG_CPLB_SWITCH_TAB_L1 is not set
 CONFIG_RAMKERNEL=y
@@ -246,6 +236,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y
 # CONFIG_SPARSEMEM_STATIC is not set
 CONFIG_SPLIT_PTLOCK_CPUS=4
 # CONFIG_RESOURCES_64BIT is not set
+CONFIG_ZONE_DMA_FLAG=1
 CONFIG_LARGE_ALLOCS=y
 CONFIG_BFIN_DMA_5XX=y
 # CONFIG_DMA_UNCACHED_2M is not set
@@ -318,7 +309,7 @@ CONFIG_BINFMT_ZFLAT=y
 # Power management options
 #
 CONFIG_PM=y
-CONFIG_PM_LEGACY=y
+# CONFIG_PM_LEGACY is not set
 # CONFIG_PM_DEBUG is not set
 # CONFIG_PM_SYSFS_DEPRECATED is not set
 CONFIG_PM_WAKEUP_GPIO_BY_SIC_IWR=y
@@ -346,6 +337,7 @@ 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_NET_KEY is not set
 CONFIG_INET=y
 # CONFIG_IP_MULTICAST is not set
@@ -580,6 +572,7 @@ CONFIG_BFIN_FLASH_BANK_3=0x7BB0
 #
 # Plug and Play support
 #
+# CONFIG_PNPACPI is not set
 
 #
 # Block devices
@@ -591,14 +584,12 @@ CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=16
 CONFIG_BLK_DEV_RAM_SIZE=4096
 CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
-# CONFIG_BLK_DEV_INITRD is not set
 # CONFIG_CDROM_PKTCDVD is not set
 # CONFIG_ATA_OVER_ETH is not set
 
 #
 # Misc devices
 #
-# CONFIG_TIFM_CORE is not set
 
 #
 # ATA/ATAPI/MFM/RLL support
@@ -733,7 +724,7 @@ CONFIG_BFIN_TWIKEYPAD_IRQ_PFX=39
 #
 # CONFIG_AD9960 is not set
 # CONFIG_SPI_ADC_BF533 is not set
-# CONFIG_BF533_PFLAGS is not set
+# CONFIG_BF5xx_PFLAGS is not set
 # CONFIG_BF5xx_PPIFCD is not set
 # CONFIG_BF5xx_TIMERS is not set
 # CONFIG_BF5xx_PPI is not set
@@ -742,6 +733,8 @@ CONFIG_BFIN_SPORT=y
 CONFIG_TWI_LCD=m
 CONFIG_TWI_LCD_SLAVE_ADDR=34
 # CONFIG_AD5304 is not set
+# CONFIG_BF5xx_TEA5764 is not set
+# CONFIG_BF5xx_FBDMA is not set
 # CONFIG_VT is not set
 # CONFIG_SERIAL_NONSTANDARD is not set
 
@@ -778,7 +771,14 @@ CONFIG_UNIX98_PTYS=y
 #
 # Watchdog Cards
 #
-# CONFIG_WATCHDOG is not set
+CONFIG_WATCHDOG=y
+# CONFIG_WATCHDOG_NOWAYOUT is not set
+
+#
+# Watchdog Device Drivers
+#
+# CONFIG_SOFT_WATCHDOG is not set
+CONFIG_BFIN_WDT=y
 CONFIG_HW_RANDOM=y
 # CONFIG_GEN_RTC is not set
 CONFIG_BLACKFIN_DPMC=y
@@ -840,12 +840,13 @@ CONFIG_SPI_MASTER=y
 #
 # SPI Master Controller Drivers
 #
+CONFIG_SPI_BFIN=y
 # CONFIG_SPI_BITBANG is not set
 
 #
 # SPI Protocol Masters
 #
-CONFIG_SPI_BFIN=y
+# CONFIG_SPI_AT25 is not set
 
 #
 # Dallas's 1-wire bus
@@ -861,6 +862,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_ADM1021 is not set
 # CONFIG_SENSORS_ADM1025 is not set
 # CONFIG_SENSORS_ADM1026 is not set
+# CONFIG_SENSORS_ADM1029 is not set
 # CONFIG_SENSORS_ADM1031 is not set
 # CONFIG_SENSORS_ADM9240 is not set
 # CONFIG_SENSORS_ASB100 is not set
@@ -899,6 +901,11 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_W83627EHF is not set
 # CONFIG_HWMON_DEBUG_CHIP is not set
 
+#
+# Multifunction device drivers
+#
+# CONFIG_MFD_SM501 is not set
+
 #
 # Multimedia devices
 #
@@ -912,15 +919,22 @@ CONFIG_HWMON=y
 #
 # Graphics support
 #
-CONFIG_FIRMWARE_EDID=y
+# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
 CONFIG_FB=m
+CONFIG_FIRMWARE_EDID=y
+# CONFIG_FB_DDC is not set
 CONFIG_FB_CFB_FILLRECT=m
 CONFIG_FB_CFB_COPYAREA=m
 CONFIG_FB_CFB_IMAGEBLIT=m
+# 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_BFIN_7171=m
 CONFIG_FB_BFIN_7393=m
 CONFIG_NTSC=y
@@ -938,7 +952,6 @@ CONFIG_ADV7393_1XMEM=y
 # Logo configuration
 #
 # CONFIG_LOGO is not set
-# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
 
 #
 # Sound
@@ -970,6 +983,18 @@ CONFIG_SND_VERBOSE_PROCFS=y
 # CONFIG_SND_SERIAL_U16550 is not set
 # CONFIG_SND_MPU401 is not set
 
+#
+# ALSA Blackfin devices
+#
+# CONFIG_SND_BLACKFIN_AD1836 is not set
+# CONFIG_SND_BLACKFIN_AD1981B is not set
+# CONFIG_SND_BFIN_AD73311 is not set
+
+#
+# SoC audio support
+#
+# CONFIG_SND_SOC is not set
+
 #
 # Open Sound System
 #
@@ -979,6 +1004,7 @@ CONFIG_SND_VERBOSE_PROCFS=y
 # HID Devices
 #
 CONFIG_HID=y
+# CONFIG_HID_DEBUG is not set
 
 #
 # USB support
@@ -1051,7 +1077,6 @@ CONFIG_RTC_INTF_DEV=y
 # CONFIG_RTC_DRV_DS1672 is not set
 # CONFIG_RTC_DRV_DS1742 is not set
 # CONFIG_RTC_DRV_PCF8563 is not set
-# CONFIG_RTC_DRV_PCF8583 is not set
 # CONFIG_RTC_DRV_RS5C348 is not set
 # CONFIG_RTC_DRV_RS5C372 is not set
 # CONFIG_RTC_DRV_M48T86 is not set
@@ -1073,6 +1098,10 @@ CONFIG_RTC_DRV_BFIN=y
 # DMA Devices
 #
 
+#
+# Auxiliary Display support
+#
+
 #
 # Virtualization
 #
@@ -1085,13 +1114,9 @@ CONFIG_RTC_DRV_BFIN=y
 #
 # File systems
 #
-CONFIG_EXT2_FS=y
-CONFIG_EXT2_FS_XATTR=y
-# CONFIG_EXT2_FS_POSIX_ACL is not set
-# CONFIG_EXT2_FS_SECURITY is not set
+# CONFIG_EXT2_FS is not set
 # CONFIG_EXT3_FS is not set
 # CONFIG_EXT4DEV_FS 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
@@ -1103,7 +1128,7 @@ CONFIG_FS_MBCACHE=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
 # CONFIG_QUOTA is not set
-CONFIG_DNOTIFY=y
+# CONFIG_DNOTIFY is not set
 # CONFIG_AUTOFS_FS is not set
 # CONFIG_AUTOFS4_FS is not set
 # CONFIG_FUSE_FS is not set
@@ -1275,7 +1300,7 @@ CONFIG_ACCESS_CHECK=y
 # CONFIG_KEYS is not set
 CONFIG_SECURITY=y
 # CONFIG_SECURITY_NETWORK is not set
-CONFIG_SECURITY_CAPABILITIES=y
+CONFIG_SECURITY_CAPABILITIES=m
 
 #
 # Cryptographic options
@@ -1293,4 +1318,5 @@ CONFIG_CRC32=y
 CONFIG_ZLIB_INFLATE=y
 CONFIG_ZLIB_DEFLATE=m
 CONFIG_PLIST=y
-CONFIG_IOMAP_COPY=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
index 8ed67dc450fdc4a77fbe77cb5af210019324b079..37688bb55b9a37faf478802c1bf0a7e7ff4efac6 100644 (file)
@@ -1,12 +1,13 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.20.4
+# Linux kernel version: 2.6.21.3
 #
 # CONFIG_MMU is not set
 # CONFIG_FPU is not set
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
 # CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
 CONFIG_BLACKFIN=y
+CONFIG_ZONE_DMA=y
 CONFIG_BFIN=y
 CONFIG_SEMAPHORE_SLEEPERS=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -33,6 +34,7 @@ CONFIG_LOCALVERSION=""
 CONFIG_LOCALVERSION_AUTO=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
@@ -41,6 +43,7 @@ CONFIG_SYSVIPC=y
 # CONFIG_IKCONFIG is not set
 CONFIG_SYSFS_DEPRECATED=y
 # CONFIG_RELAY is not set
+CONFIG_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE=""
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 CONFIG_SYSCTL=y
@@ -55,9 +58,7 @@ CONFIG_BUG=y
 CONFIG_ELF_CORE=y
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
-CONFIG_EPOLL=y
 CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3
-# CONFIG_LIMIT_PAGECACHE is not set
 CONFIG_BUDDY=y
 # CONFIG_NP2 is not set
 CONFIG_SLAB=y
@@ -127,6 +128,7 @@ CONFIG_BFIN537_STAMP=y
 # CONFIG_BFIN537_BLUETECHNIX_CM is not set
 # CONFIG_BFIN561_BLUETECHNIX_CM is not set
 # CONFIG_BFIN561_EZKIT is not set
+# CONFIG_BFIN561_TEPLA is not set
 # CONFIG_PNAV10 is not set
 # CONFIG_GENERIC_BOARD is not set
 CONFIG_MEM_MT48LC32M8A2_75=y
@@ -195,19 +197,6 @@ CONFIG_MEM_SIZE=64
 CONFIG_MEM_ADD_WIDTH=10
 CONFIG_BOOT_LOAD=0x1000
 
-#
-# Console UART Setup
-#
-# CONFIG_BAUD_9600 is not set
-# CONFIG_BAUD_19200 is not set
-# CONFIG_BAUD_38400 is not set
-CONFIG_BAUD_57600=y
-# CONFIG_BAUD_115200 is not set
-CONFIG_BAUD_NO_PARITY=y
-# CONFIG_BAUD_PARITY is not set
-CONFIG_BAUD_1_STOPBIT=y
-# CONFIG_BAUD_2_STOPBIT is not set
-
 #
 # Blackfin Kernel Optimizations
 #
@@ -236,6 +225,7 @@ CONFIG_MEMSET_L1=y
 CONFIG_MEMCPY_L1=y
 CONFIG_SYS_BFIN_SPINLOCK_L1=y
 # CONFIG_IP_CHECKSUM_L1 is not set
+CONFIG_CACHELINE_ALIGNED_L1=y
 # CONFIG_SYSCALL_TAB_L1 is not set
 # CONFIG_CPLB_SWITCH_TAB_L1 is not set
 CONFIG_RAMKERNEL=y
@@ -249,6 +239,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y
 # CONFIG_SPARSEMEM_STATIC is not set
 CONFIG_SPLIT_PTLOCK_CPUS=4
 # CONFIG_RESOURCES_64BIT is not set
+CONFIG_ZONE_DMA_FLAG=1
 CONFIG_LARGE_ALLOCS=y
 CONFIG_BFIN_DMA_5XX=y
 # CONFIG_DMA_UNCACHED_2M is not set
@@ -321,7 +312,7 @@ CONFIG_BINFMT_ZFLAT=y
 # Power management options
 #
 CONFIG_PM=y
-CONFIG_PM_LEGACY=y
+# CONFIG_PM_LEGACY is not set
 # CONFIG_PM_DEBUG is not set
 # CONFIG_PM_SYSFS_DEPRECATED is not set
 CONFIG_PM_WAKEUP_GPIO_BY_SIC_IWR=y
@@ -349,6 +340,7 @@ 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_NET_KEY is not set
 CONFIG_INET=y
 # CONFIG_IP_MULTICAST is not set
@@ -593,6 +585,7 @@ CONFIG_MTD_NAND_IDS=m
 #
 # Plug and Play support
 #
+# CONFIG_PNPACPI is not set
 
 #
 # Block devices
@@ -604,14 +597,12 @@ CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=16
 CONFIG_BLK_DEV_RAM_SIZE=4096
 CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
-# CONFIG_BLK_DEV_INITRD is not set
 # CONFIG_CDROM_PKTCDVD is not set
 # CONFIG_ATA_OVER_ETH is not set
 
 #
 # Misc devices
 #
-# CONFIG_TIFM_CORE is not set
 
 #
 # ATA/ATAPI/MFM/RLL support
@@ -751,7 +742,7 @@ CONFIG_BFIN_TWIKEYPAD_IRQ_PFX=72
 #
 # CONFIG_AD9960 is not set
 # CONFIG_SPI_ADC_BF533 is not set
-# CONFIG_BF533_PFLAGS is not set
+# CONFIG_BF5xx_PFLAGS is not set
 # CONFIG_BF5xx_PPIFCD is not set
 # CONFIG_BF5xx_TIMERS is not set
 # CONFIG_BF5xx_PPI is not set
@@ -760,6 +751,8 @@ CONFIG_BFIN_SPORT=y
 CONFIG_TWI_LCD=m
 CONFIG_TWI_LCD_SLAVE_ADDR=34
 # CONFIG_AD5304 is not set
+# CONFIG_BF5xx_TEA5764 is not set
+# CONFIG_BF5xx_FBDMA is not set
 # CONFIG_VT is not set
 # CONFIG_SERIAL_NONSTANDARD is not set
 
@@ -804,7 +797,14 @@ CONFIG_CAN_BLACKFIN=m
 #
 # Watchdog Cards
 #
-# CONFIG_WATCHDOG is not set
+CONFIG_WATCHDOG=y
+# CONFIG_WATCHDOG_NOWAYOUT is not set
+
+#
+# Watchdog Device Drivers
+#
+# CONFIG_SOFT_WATCHDOG is not set
+CONFIG_BFIN_WDT=y
 CONFIG_HW_RANDOM=y
 # CONFIG_GEN_RTC is not set
 CONFIG_BLACKFIN_DPMC=y
@@ -868,12 +868,13 @@ CONFIG_SPI_MASTER=y
 #
 # SPI Master Controller Drivers
 #
+CONFIG_SPI_BFIN=y
 # CONFIG_SPI_BITBANG is not set
 
 #
 # SPI Protocol Masters
 #
-CONFIG_SPI_BFIN=y
+# CONFIG_SPI_AT25 is not set
 
 #
 # Dallas's 1-wire bus
@@ -889,6 +890,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_ADM1021 is not set
 # CONFIG_SENSORS_ADM1025 is not set
 # CONFIG_SENSORS_ADM1026 is not set
+# CONFIG_SENSORS_ADM1029 is not set
 # CONFIG_SENSORS_ADM1031 is not set
 # CONFIG_SENSORS_ADM9240 is not set
 # CONFIG_SENSORS_ASB100 is not set
@@ -927,6 +929,11 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_W83627EHF is not set
 # CONFIG_HWMON_DEBUG_CHIP is not set
 
+#
+# Multifunction device drivers
+#
+# CONFIG_MFD_SM501 is not set
+
 #
 # Multimedia devices
 #
@@ -940,15 +947,24 @@ CONFIG_HWMON=y
 #
 # Graphics support
 #
-CONFIG_FIRMWARE_EDID=y
+CONFIG_BACKLIGHT_LCD_SUPPORT=y
+CONFIG_BACKLIGHT_CLASS_DEVICE=m
+CONFIG_LCD_CLASS_DEVICE=m
 CONFIG_FB=m
+CONFIG_FIRMWARE_EDID=y
+# CONFIG_FB_DDC is not set
 CONFIG_FB_CFB_FILLRECT=m
 CONFIG_FB_CFB_COPYAREA=m
 CONFIG_FB_CFB_IMAGEBLIT=m
+# 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_BFIN_7171=m
 CONFIG_FB_BFIN_7393=m
 CONFIG_NTSC=y
@@ -970,11 +986,6 @@ CONFIG_LQ035_SLAVE_ADDR=0x58
 # Logo configuration
 #
 # CONFIG_LOGO is not set
-CONFIG_BACKLIGHT_LCD_SUPPORT=y
-CONFIG_BACKLIGHT_CLASS_DEVICE=m
-CONFIG_BACKLIGHT_DEVICE=y
-CONFIG_LCD_CLASS_DEVICE=m
-CONFIG_LCD_DEVICE=y
 
 #
 # Sound
@@ -1006,6 +1017,18 @@ CONFIG_SND_VERBOSE_PROCFS=y
 # CONFIG_SND_SERIAL_U16550 is not set
 # CONFIG_SND_MPU401 is not set
 
+#
+# ALSA Blackfin devices
+#
+# CONFIG_SND_BLACKFIN_AD1836 is not set
+# CONFIG_SND_BLACKFIN_AD1981B is not set
+# CONFIG_SND_BFIN_AD73311 is not set
+
+#
+# SoC audio support
+#
+# CONFIG_SND_SOC is not set
+
 #
 # Open Sound System
 #
@@ -1015,6 +1038,7 @@ CONFIG_SND_VERBOSE_PROCFS=y
 # HID Devices
 #
 CONFIG_HID=y
+# CONFIG_HID_DEBUG is not set
 
 #
 # USB support
@@ -1087,7 +1111,6 @@ CONFIG_RTC_INTF_DEV=y
 # CONFIG_RTC_DRV_DS1672 is not set
 # CONFIG_RTC_DRV_DS1742 is not set
 # CONFIG_RTC_DRV_PCF8563 is not set
-# CONFIG_RTC_DRV_PCF8583 is not set
 # CONFIG_RTC_DRV_RS5C348 is not set
 # CONFIG_RTC_DRV_RS5C372 is not set
 # CONFIG_RTC_DRV_M48T86 is not set
@@ -1109,6 +1132,10 @@ CONFIG_RTC_DRV_BFIN=y
 # DMA Devices
 #
 
+#
+# Auxiliary Display support
+#
+
 #
 # Virtualization
 #
@@ -1121,13 +1148,9 @@ CONFIG_RTC_DRV_BFIN=y
 #
 # File systems
 #
-CONFIG_EXT2_FS=y
-CONFIG_EXT2_FS_XATTR=y
-# CONFIG_EXT2_FS_POSIX_ACL is not set
-# CONFIG_EXT2_FS_SECURITY is not set
+# CONFIG_EXT2_FS is not set
 # CONFIG_EXT3_FS is not set
 # CONFIG_EXT4DEV_FS 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
@@ -1139,7 +1162,7 @@ CONFIG_FS_MBCACHE=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
 # CONFIG_QUOTA is not set
-CONFIG_DNOTIFY=y
+# CONFIG_DNOTIFY is not set
 # CONFIG_AUTOFS_FS is not set
 # CONFIG_AUTOFS4_FS is not set
 # CONFIG_FUSE_FS is not set
@@ -1311,7 +1334,7 @@ CONFIG_ACCESS_CHECK=y
 # CONFIG_KEYS is not set
 CONFIG_SECURITY=y
 # CONFIG_SECURITY_NETWORK is not set
-CONFIG_SECURITY_CAPABILITIES=y
+CONFIG_SECURITY_CAPABILITIES=m
 
 #
 # Cryptographic options
@@ -1329,4 +1352,5 @@ CONFIG_CRC32=y
 CONFIG_ZLIB_INFLATE=y
 CONFIG_ZLIB_DEFLATE=m
 CONFIG_PLIST=y
-CONFIG_IOMAP_COPY=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
index e32ca2072cbf7938dc8585a4cc6dda162c68a003..fe4e67debaca461ef3fb8b1771492e56e35e62d9 100644 (file)
@@ -1,20 +1,21 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.19.3
+# Linux kernel version: 2.6.21.3
 #
 # CONFIG_MMU is not set
 # CONFIG_FPU is not set
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
 # CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
 CONFIG_BLACKFIN=y
+CONFIG_ZONE_DMA=y
 CONFIG_BFIN=y
 CONFIG_SEMAPHORE_SLEEPERS=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
 CONFIG_GENERIC_HWEIGHT=y
 CONFIG_GENERIC_HARDIRQS=y
 CONFIG_GENERIC_IRQ_PROBE=y
+# CONFIG_GENERIC_TIME is not set
 CONFIG_GENERIC_CALIBRATE_DELAY=y
-CONFIG_UCLINUX=y
 CONFIG_FORCE_MAX_ZONEORDER=14
 CONFIG_IRQCHIP_DEMUX_GPIO=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
@@ -33,18 +34,21 @@ CONFIG_LOCALVERSION=""
 CONFIG_LOCALVERSION_AUTO=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_SYSFS_DEPRECATED=y
 # CONFIG_RELAY is not set
+CONFIG_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE=""
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 CONFIG_SYSCTL=y
 CONFIG_EMBEDDED=y
-# CONFIG_UID16 is not set
+CONFIG_UID16=y
 CONFIG_SYSCTL_SYSCALL=y
 CONFIG_KALLSYMS=y
 # CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -54,9 +58,7 @@ CONFIG_BUG=y
 CONFIG_ELF_CORE=y
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
-CONFIG_EPOLL=y
 CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3
-# CONFIG_LIMIT_PAGECACHE is not set
 CONFIG_BUDDY=y
 # CONFIG_NP2 is not set
 CONFIG_SLAB=y
@@ -80,7 +82,9 @@ 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
 
 #
 # IO Schedulers
@@ -109,7 +113,6 @@ CONFIG_PREEMPT_VOLUNTARY=y
 # CONFIG_BF532 is not set
 # CONFIG_BF533 is not set
 # CONFIG_BF534 is not set
-# CONFIG_BF535 is not set
 # CONFIG_BF536 is not set
 # CONFIG_BF537 is not set
 CONFIG_BF561=y
@@ -125,6 +128,7 @@ CONFIG_BFIN_DUAL_CORE=y
 # CONFIG_BFIN537_BLUETECHNIX_CM is not set
 # CONFIG_BFIN561_BLUETECHNIX_CM is not set
 CONFIG_BFIN561_EZKIT=y
+# CONFIG_BFIN561_TEPLA is not set
 # CONFIG_PNAV10 is not set
 # CONFIG_GENERIC_BOARD is not set
 CONFIG_MEM_MT48LC16M16A2TG_75=y
@@ -214,6 +218,7 @@ CONFIG_IRQ_WDTIMER=13
 #
 # Board customizations
 #
+# CONFIG_CMDLINE_BOOL is not set
 
 #
 # Board Setup
@@ -223,19 +228,6 @@ CONFIG_MEM_SIZE=64
 CONFIG_MEM_ADD_WIDTH=9
 CONFIG_BOOT_LOAD=0x1000
 
-#
-# Console UART Setup
-#
-# CONFIG_BAUD_9600 is not set
-# CONFIG_BAUD_19200 is not set
-# CONFIG_BAUD_38400 is not set
-CONFIG_BAUD_57600=y
-# CONFIG_BAUD_115200 is not set
-CONFIG_BAUD_NO_PARITY=y
-# CONFIG_BAUD_PARITY is not set
-CONFIG_BAUD_1_STOPBIT=y
-# CONFIG_BAUD_2_STOPBIT is not set
-
 #
 # Blackfin Kernel Optimizations
 #
@@ -245,6 +237,7 @@ CONFIG_BAUD_1_STOPBIT=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
 
@@ -263,6 +256,7 @@ CONFIG_MEMSET_L1=y
 CONFIG_MEMCPY_L1=y
 CONFIG_SYS_BFIN_SPINLOCK_L1=y
 # CONFIG_IP_CHECKSUM_L1 is not set
+CONFIG_CACHELINE_ALIGNED_L1=y
 # CONFIG_SYSCALL_TAB_L1 is not set
 # CONFIG_CPLB_SWITCH_TAB_L1 is not set
 CONFIG_RAMKERNEL=y
@@ -276,6 +270,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y
 # CONFIG_SPARSEMEM_STATIC is not set
 CONFIG_SPLIT_PTLOCK_CPUS=4
 # CONFIG_RESOURCES_64BIT is not set
+CONFIG_ZONE_DMA_FLAG=1
 CONFIG_LARGE_ALLOCS=y
 CONFIG_BFIN_DMA_5XX=y
 # CONFIG_DMA_UNCACHED_2M is not set
@@ -368,6 +363,7 @@ 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_NET_KEY is not set
 CONFIG_INET=y
 # CONFIG_IP_MULTICAST is not set
@@ -394,6 +390,7 @@ 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
@@ -437,7 +434,48 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 #
 # CONFIG_NET_PKTGEN is not set
 # CONFIG_HAMRADIO is not set
-# CONFIG_IRDA is not set
+CONFIG_IRDA=m
+
+#
+# IrDA protocols
+#
+CONFIG_IRLAN=m
+CONFIG_IRCOMM=m
+# CONFIG_IRDA_ULTRA is not set
+
+#
+# IrDA options
+#
+CONFIG_IRDA_CACHE_LAST_LSAP=y
+# CONFIG_IRDA_FAST_RR is not set
+# CONFIG_IRDA_DEBUG is not set
+
+#
+# Infrared-port device drivers
+#
+
+#
+# SIR device drivers
+#
+CONFIG_IRTTY_SIR=m
+
+#
+# Dongle support
+#
+# CONFIG_DONGLE is not set
+
+#
+# Old SIR device drivers
+#
+# CONFIG_IRPORT_SIR is not set
+
+#
+# Old Serial dongle support
+#
+
+#
+# FIR device drivers
+#
 # CONFIG_BT is not set
 # CONFIG_IEEE80211 is not set
 
@@ -472,6 +510,7 @@ CONFIG_MTD_PARTITIONS=y
 # User Modules And Translation Layers
 #
 CONFIG_MTD_CHAR=m
+CONFIG_MTD_BLKDEVS=y
 CONFIG_MTD_BLOCK=y
 # CONFIG_FTL is not set
 # CONFIG_NFTL is not set
@@ -528,6 +567,8 @@ CONFIG_BFIN_FLASH_BANK_3=0x7BB0
 #
 # Self-contained MTD device drivers
 #
+# CONFIG_MTD_DATAFLASH is not set
+# CONFIG_MTD_M25P80 is not set
 # CONFIG_MTD_SLRAM is not set
 # CONFIG_MTD_PHRAM is not set
 # CONFIG_MTD_MTDRAM is not set
@@ -558,6 +599,7 @@ CONFIG_BFIN_FLASH_BANK_3=0x7BB0
 #
 # Plug and Play support
 #
+# CONFIG_PNPACPI is not set
 
 #
 # Block devices
@@ -569,14 +611,12 @@ CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=16
 CONFIG_BLK_DEV_RAM_SIZE=4096
 CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
-# CONFIG_BLK_DEV_INITRD is not set
 # CONFIG_CDROM_PKTCDVD is not set
 # CONFIG_ATA_OVER_ETH is not set
 
 #
 # Misc devices
 #
-# CONFIG_TIFM_CORE is not set
 
 #
 # ATA/ATAPI/MFM/RLL support
@@ -675,7 +715,26 @@ CONFIG_SMC91X=y
 #
 # Input device support
 #
-# CONFIG_INPUT is not set
+CONFIG_INPUT=m
+# CONFIG_INPUT_FF_MEMLESS 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=m
+# CONFIG_INPUT_EVBUG is not set
+
+#
+# Input Device Drivers
+#
+# CONFIG_INPUT_KEYBOARD is not set
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TOUCHSCREEN is not set
+# CONFIG_INPUT_MISC is not set
 
 #
 # Hardware I/O ports
@@ -688,12 +747,14 @@ CONFIG_SMC91X=y
 #
 # CONFIG_AD9960 is not set
 # CONFIG_SPI_ADC_BF533 is not set
-# CONFIG_BF533_PFLAGS is not set
+# CONFIG_BF5xx_PFLAGS is not set
 # CONFIG_BF5xx_PPIFCD is not set
 # CONFIG_BF5xx_TIMERS is not set
 # CONFIG_BF5xx_PPI is not set
 # CONFIG_BFIN_SPORT is not set
 # CONFIG_BFIN_TIMER_LATENCY is not set
+# CONFIG_AD5304 is not set
+# CONFIG_BF5xx_FBDMA is not set
 # CONFIG_VT is not set
 # CONFIG_SERIAL_NONSTANDARD is not set
 
@@ -730,16 +791,19 @@ CONFIG_UNIX98_PTYS=y
 #
 # Watchdog Cards
 #
-# CONFIG_WATCHDOG is not set
+CONFIG_WATCHDOG=y
+# CONFIG_WATCHDOG_NOWAYOUT is not set
+
+#
+# Watchdog Device Drivers
+#
+# CONFIG_SOFT_WATCHDOG is not set
+CONFIG_BFIN_WDT=y
 CONFIG_HW_RANDOM=y
 # CONFIG_GEN_RTC is not set
 # CONFIG_BLACKFIN_DPMC 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
 
 #
@@ -755,8 +819,19 @@ CONFIG_HW_RANDOM=y
 #
 # SPI support
 #
-# CONFIG_SPI is not set
-# CONFIG_SPI_MASTER is not set
+CONFIG_SPI=y
+CONFIG_SPI_MASTER=y
+
+#
+# SPI Master Controller Drivers
+#
+CONFIG_SPI_BFIN=y
+# CONFIG_SPI_BITBANG is not set
+
+#
+# SPI Protocol Masters
+#
+# CONFIG_SPI_AT25 is not set
 
 #
 # Dallas's 1-wire bus
@@ -770,9 +845,16 @@ CONFIG_HWMON=y
 # CONFIG_HWMON_VID is not set
 # CONFIG_SENSORS_ABITUGURU is not set
 # CONFIG_SENSORS_F71805F is not set
+# CONFIG_SENSORS_LM70 is not set
+# CONFIG_SENSORS_PC87427 is not set
 # CONFIG_SENSORS_VT1211 is not set
 # CONFIG_HWMON_DEBUG_CHIP is not set
 
+#
+# Multifunction device drivers
+#
+# CONFIG_MFD_SM501 is not set
+
 #
 # Multimedia devices
 #
@@ -786,15 +868,20 @@ CONFIG_HWMON=y
 #
 # Graphics support
 #
-CONFIG_FIRMWARE_EDID=y
-# CONFIG_FB is not set
 # CONFIG_BACKLIGHT_LCD_SUPPORT is not set
+# CONFIG_FB is not set
 
 #
 # Sound
 #
 # CONFIG_SOUND is not set
 
+#
+# HID Devices
+#
+CONFIG_HID=m
+# CONFIG_HID_DEBUG is not set
+
 #
 # USB support
 #
@@ -815,6 +902,7 @@ CONFIG_USB_ARCH_HAS_HCD=y
 #
 # MMC/SD Card support
 #
+# CONFIG_SPI_MMC is not set
 # CONFIG_MMC is not set
 
 #
@@ -856,6 +944,14 @@ CONFIG_USB_ARCH_HAS_HCD=y
 # DMA Devices
 #
 
+#
+# Auxiliary Display support
+#
+
+#
+# Virtualization
+#
+
 #
 # PBX support
 #
@@ -864,13 +960,9 @@ CONFIG_USB_ARCH_HAS_HCD=y
 #
 # File systems
 #
-CONFIG_EXT2_FS=y
-CONFIG_EXT2_FS_XATTR=y
-# CONFIG_EXT2_FS_POSIX_ACL is not set
-# CONFIG_EXT2_FS_SECURITY is not set
+# CONFIG_EXT2_FS is not set
 # CONFIG_EXT3_FS is not set
 # CONFIG_EXT4DEV_FS 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
@@ -882,7 +974,7 @@ CONFIG_FS_MBCACHE=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
 # CONFIG_QUOTA is not set
-CONFIG_DNOTIFY=y
+# CONFIG_DNOTIFY is not set
 # CONFIG_AUTOFS_FS is not set
 # CONFIG_AUTOFS4_FS is not set
 # CONFIG_FUSE_FS is not set
@@ -931,7 +1023,6 @@ CONFIG_YAFFS_CHECKPOINT_RESERVED_BLOCKS=10
 # CONFIG_YAFFS_DISABLE_WIDE_TNODES is not set
 # CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set
 CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y
-# CONFIG_JFFS_FS is not set
 CONFIG_JFFS2_FS=m
 CONFIG_JFFS2_FS_DEBUG=0
 CONFIG_JFFS2_FS_WRITEBUFFER=y
@@ -1021,6 +1112,11 @@ CONFIG_NLS_DEFAULT="iso8859-1"
 # CONFIG_NLS_KOI8_U is not set
 # CONFIG_NLS_UTF8 is not set
 
+#
+# Distributed Lock Manager
+#
+# CONFIG_DLM is not set
+
 #
 # Profiling support
 #
@@ -1033,20 +1129,17 @@ CONFIG_NLS_DEFAULT="iso8859-1"
 CONFIG_ENABLE_MUST_CHECK=y
 # 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_HEADERS_CHECK is not set
 # CONFIG_DEBUG_SERIAL_EARLY_INIT is not set
 CONFIG_DEBUG_HUNT_FOR_ZERO=y
 # CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE is not set
 # CONFIG_DUAL_CORE_TEST_MODULE is not set
-# CONFIG_BOOTPARAM is not set
-# CONFIG_NO_KERNEL_MSG is not set
 CONFIG_CPLB_INFO=y
-# CONFIG_NO_ACCESS_CHECK is not set
+CONFIG_ACCESS_CHECK=y
 
 #
 # Security options
@@ -1054,7 +1147,7 @@ CONFIG_CPLB_INFO=y
 # CONFIG_KEYS is not set
 CONFIG_SECURITY=y
 # CONFIG_SECURITY_NETWORK is not set
-CONFIG_SECURITY_CAPABILITIES=y
+CONFIG_SECURITY_CAPABILITIES=m
 
 #
 # Cryptographic options
@@ -1064,10 +1157,13 @@ CONFIG_SECURITY_CAPABILITIES=y
 #
 # Library routines
 #
-# CONFIG_CRC_CCITT is not set
+CONFIG_BITREVERSE=y
+CONFIG_CRC_CCITT=m
 # CONFIG_CRC16 is not set
 CONFIG_CRC32=y
 # CONFIG_LIBCRC32C is not set
 CONFIG_ZLIB_INFLATE=y
 CONFIG_ZLIB_DEFLATE=m
 CONFIG_PLIST=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
index 97b4ffa2b4ac882af1fedac81ee45e21f962a5e7..a783ff69ace1999f4d893e225c1be3f45dbe23d9 100644 (file)
@@ -1,20 +1,21 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.19.3
+# Linux kernel version: 2.6.21.3
 #
 # CONFIG_MMU is not set
 # CONFIG_FPU is not set
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
 # CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
 CONFIG_BLACKFIN=y
+CONFIG_ZONE_DMA=y
 CONFIG_BFIN=y
 CONFIG_SEMAPHORE_SLEEPERS=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
 CONFIG_GENERIC_HWEIGHT=y
 CONFIG_GENERIC_HARDIRQS=y
 CONFIG_GENERIC_IRQ_PROBE=y
+# CONFIG_GENERIC_TIME is not set
 CONFIG_GENERIC_CALIBRATE_DELAY=y
-CONFIG_UCLINUX=y
 CONFIG_FORCE_MAX_ZONEORDER=14
 CONFIG_IRQCHIP_DEMUX_GPIO=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
@@ -33,14 +34,16 @@ CONFIG_LOCALVERSION=""
 CONFIG_LOCALVERSION_AUTO=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_SYSFS_DEPRECATED=y
 # CONFIG_RELAY is not set
-CONFIG_INITRAMFS_SOURCE=""
+# CONFIG_BLK_DEV_INITRD is not set
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 CONFIG_SYSCTL=y
 CONFIG_EMBEDDED=y
@@ -54,9 +57,7 @@ CONFIG_BUG=y
 CONFIG_ELF_CORE=y
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
-CONFIG_EPOLL=y
 CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=9
-# CONFIG_LIMIT_PAGECACHE is not set
 CONFIG_BUDDY=y
 # CONFIG_NP2 is not set
 CONFIG_SLAB=y
@@ -80,7 +81,9 @@ 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
 
 #
 # IO Schedulers
@@ -109,7 +112,6 @@ CONFIG_PREEMPT_VOLUNTARY=y
 # CONFIG_BF532 is not set
 # CONFIG_BF533 is not set
 # CONFIG_BF534 is not set
-# CONFIG_BF535 is not set
 # CONFIG_BF536 is not set
 CONFIG_BF537=y
 # CONFIG_BF561 is not set
@@ -125,6 +127,7 @@ CONFIG_BFIN_SINGLE_CORE=y
 # CONFIG_BFIN537_BLUETECHNIX_CM is not set
 # CONFIG_BFIN561_BLUETECHNIX_CM is not set
 # CONFIG_BFIN561_EZKIT is not set
+# CONFIG_BFIN561_TEPLA is not set
 CONFIG_PNAV10=y
 # CONFIG_GENERIC_BOARD is not set
 CONFIG_MEM_MT48LC32M8A2_75=y
@@ -183,6 +186,7 @@ CONFIG_IRQ_WATCH=13
 #
 # Board customizations
 #
+# CONFIG_CMDLINE_BOOL is not set
 
 #
 # Board Setup
@@ -192,19 +196,6 @@ CONFIG_MEM_SIZE=64
 CONFIG_MEM_ADD_WIDTH=10
 CONFIG_BOOT_LOAD=0x1000
 
-#
-# Console UART Setup
-#
-# CONFIG_BAUD_9600 is not set
-# CONFIG_BAUD_19200 is not set
-# CONFIG_BAUD_38400 is not set
-# CONFIG_BAUD_57600 is not set
-CONFIG_BAUD_115200=y
-CONFIG_BAUD_NO_PARITY=y
-# CONFIG_BAUD_PARITY is not set
-CONFIG_BAUD_1_STOPBIT=y
-# CONFIG_BAUD_2_STOPBIT is not set
-
 #
 # Blackfin Kernel Optimizations
 #
@@ -214,6 +205,7 @@ CONFIG_BAUD_1_STOPBIT=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
 
@@ -232,6 +224,7 @@ CONFIG_MEMSET_L1=y
 CONFIG_MEMCPY_L1=y
 CONFIG_SYS_BFIN_SPINLOCK_L1=y
 CONFIG_IP_CHECKSUM_L1=y
+CONFIG_CACHELINE_ALIGNED_L1=y
 CONFIG_SYSCALL_TAB_L1=y
 CONFIG_CPLB_SWITCH_TAB_L1=y
 CONFIG_RAMKERNEL=y
@@ -245,6 +238,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y
 # CONFIG_SPARSEMEM_STATIC is not set
 CONFIG_SPLIT_PTLOCK_CPUS=4
 # CONFIG_RESOURCES_64BIT is not set
+CONFIG_ZONE_DMA_FLAG=1
 CONFIG_LARGE_ALLOCS=y
 CONFIG_BFIN_DMA_5XX=y
 # CONFIG_DMA_UNCACHED_2M is not set
@@ -338,6 +332,7 @@ 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_NET_KEY is not set
 CONFIG_INET=y
 # CONFIG_IP_MULTICAST is not set
@@ -364,6 +359,7 @@ 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
@@ -442,6 +438,7 @@ CONFIG_MTD_PARTITIONS=y
 # User Modules And Translation Layers
 #
 CONFIG_MTD_CHAR=m
+CONFIG_MTD_BLKDEVS=y
 CONFIG_MTD_BLOCK=y
 # CONFIG_FTL is not set
 # CONFIG_NFTL is not set
@@ -522,6 +519,7 @@ CONFIG_MTD_NAND_IDS=y
 #
 # Plug and Play support
 #
+# CONFIG_PNPACPI is not set
 
 #
 # Block devices
@@ -533,14 +531,12 @@ CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=16
 CONFIG_BLK_DEV_RAM_SIZE=4096
 CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
-# CONFIG_BLK_DEV_INITRD is not set
 # CONFIG_CDROM_PKTCDVD is not set
 # CONFIG_ATA_OVER_ETH is not set
 
 #
 # Misc devices
 #
-# CONFIG_TIFM_CORE is not set
 
 #
 # ATA/ATAPI/MFM/RLL support
@@ -674,6 +670,7 @@ CONFIG_TOUCHSCREEN_AD7877=y
 # 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_INPUT_MISC=y
 CONFIG_INPUT_UINPUT=y
 # CONFIG_BF53X_PFBUTTONS is not set
@@ -690,7 +687,7 @@ CONFIG_INPUT_UINPUT=y
 #
 # CONFIG_AD9960 is not set
 # CONFIG_SPI_ADC_BF533 is not set
-# CONFIG_BF533_PFLAGS is not set
+# CONFIG_BF5xx_PFLAGS is not set
 # CONFIG_BF5xx_PPIFCD is not set
 # CONFIG_BF5xx_TIMERS is not set
 # CONFIG_BF5xx_PPI is not set
@@ -699,6 +696,8 @@ CONFIG_BFIN_SPORT=y
 CONFIG_TWI_LCD=m
 CONFIG_TWI_LCD_SLAVE_ADDR=34
 # CONFIG_AD5304 is not set
+# CONFIG_BF5xx_TEA5764 is not set
+# CONFIG_BF5xx_FBDMA is not set
 # CONFIG_VT is not set
 # CONFIG_SERIAL_NONSTANDARD is not set
 
@@ -750,10 +749,6 @@ CONFIG_HW_RANDOM=y
 CONFIG_BLACKFIN_DPMC=y
 # CONFIG_DTLK is not set
 # CONFIG_R3964 is not set
-
-#
-# Ftape, the floppy tape device driver
-#
 # CONFIG_RAW_DRIVER is not set
 
 #
@@ -777,9 +772,9 @@ CONFIG_I2C_CHARDEV=y
 #
 # I2C Hardware Bus support
 #
-# CONFIG_I2C_BFIN_GPIO is not set
-CONFIG_I2C_BFIN_TWI=y
-CONFIG_TWICLK_KHZ=50
+# CONFIG_I2C_BLACKFIN_GPIO is not set
+CONFIG_I2C_BLACKFIN_TWI=y
+CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=50
 # CONFIG_I2C_OCORES is not set
 # CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_STUB is not set
@@ -812,12 +807,13 @@ CONFIG_SPI_MASTER=y
 #
 # SPI Master Controller Drivers
 #
-# CONFIG_SPI_BITBANG is not set
 CONFIG_SPI_BFIN=y
+# CONFIG_SPI_BITBANG is not set
 
 #
 # SPI Protocol Masters
 #
+# CONFIG_SPI_AT25 is not set
 
 #
 # Dallas's 1-wire bus
@@ -833,6 +829,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_ADM1021 is not set
 # CONFIG_SENSORS_ADM1025 is not set
 # CONFIG_SENSORS_ADM1026 is not set
+# CONFIG_SENSORS_ADM1029 is not set
 # CONFIG_SENSORS_ADM1031 is not set
 # CONFIG_SENSORS_ADM9240 is not set
 # CONFIG_SENSORS_ASB100 is not set
@@ -857,6 +854,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_LM92 is not set
 # CONFIG_SENSORS_MAX1619 is not set
 # CONFIG_SENSORS_PC87360 is not set
+# CONFIG_SENSORS_PC87427 is not set
 # CONFIG_SENSORS_SMSC47M1 is not set
 # CONFIG_SENSORS_SMSC47M192 is not set
 # CONFIG_SENSORS_SMSC47B397 is not set
@@ -864,11 +862,17 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_W83781D is not set
 # CONFIG_SENSORS_W83791D is not set
 # CONFIG_SENSORS_W83792D is not set
+# CONFIG_SENSORS_W83793 is not set
 # CONFIG_SENSORS_W83L785TS is not set
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
 # CONFIG_HWMON_DEBUG_CHIP is not set
 
+#
+# Multifunction device drivers
+#
+# CONFIG_MFD_SM501 is not set
+
 #
 # Multimedia devices
 #
@@ -882,15 +886,24 @@ CONFIG_HWMON=y
 #
 # Graphics support
 #
-CONFIG_FIRMWARE_EDID=y
+CONFIG_BACKLIGHT_LCD_SUPPORT=y
+CONFIG_BACKLIGHT_CLASS_DEVICE=y
+CONFIG_LCD_CLASS_DEVICE=y
 CONFIG_FB=y
+CONFIG_FIRMWARE_EDID=y
+# CONFIG_FB_DDC is not set
 CONFIG_FB_CFB_FILLRECT=y
 CONFIG_FB_CFB_COPYAREA=y
 CONFIG_FB_CFB_IMAGEBLIT=y
+# 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_BFIN_7171 is not set
 # CONFIG_FB_BFIN_7393 is not set
 CONFIG_FB_BF537_LQ035=y
@@ -904,11 +917,6 @@ CONFIG_FB_BFIN_LANDSCAPE=y
 # Logo configuration
 #
 # CONFIG_LOGO is not set
-CONFIG_BACKLIGHT_LCD_SUPPORT=y
-CONFIG_BACKLIGHT_CLASS_DEVICE=y
-CONFIG_BACKLIGHT_DEVICE=y
-CONFIG_LCD_CLASS_DEVICE=y
-CONFIG_LCD_DEVICE=y
 
 #
 # Sound
@@ -945,14 +953,24 @@ CONFIG_SND_PCM=m
 CONFIG_SND_BLACKFIN_AD1981B=m
 # CONFIG_SND_BFIN_AD73311 is not set
 
+#
+# SoC audio support
+#
+# CONFIG_SND_SOC is not set
+
 #
 # Open Sound System
 #
 CONFIG_SOUND_PRIME=y
-CONFIG_OSS_OBSOLETE_DRIVER=y
+# CONFIG_OBSOLETE_OSS is not set
 # CONFIG_SOUND_MSNDCLAS is not set
 # CONFIG_SOUND_MSNDPIN is not set
 
+#
+# HID Devices
+#
+# CONFIG_HID is not set
+
 #
 # USB support
 #
@@ -1024,7 +1042,6 @@ CONFIG_RTC_INTF_DEV=y
 # CONFIG_RTC_DRV_DS1672 is not set
 # CONFIG_RTC_DRV_DS1742 is not set
 # CONFIG_RTC_DRV_PCF8563 is not set
-# CONFIG_RTC_DRV_PCF8583 is not set
 # CONFIG_RTC_DRV_RS5C348 is not set
 # CONFIG_RTC_DRV_RS5C372 is not set
 # CONFIG_RTC_DRV_M48T86 is not set
@@ -1046,6 +1063,14 @@ CONFIG_RTC_DRV_BFIN=y
 # DMA Devices
 #
 
+#
+# Auxiliary Display support
+#
+
+#
+# Virtualization
+#
+
 #
 # PBX support
 #
@@ -1121,7 +1146,6 @@ CONFIG_YAFFS_CHECKPOINT_RESERVED_BLOCKS=10
 # CONFIG_YAFFS_DISABLE_WIDE_TNODES is not set
 # CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set
 CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y
-# CONFIG_JFFS_FS is not set
 # CONFIG_JFFS2_FS is not set
 # CONFIG_CRAMFS is not set
 # CONFIG_VXFS_FS is not set
@@ -1203,6 +1227,11 @@ CONFIG_NLS_DEFAULT="iso8859-1"
 # CONFIG_NLS_KOI8_U is not set
 # CONFIG_NLS_UTF8 is not set
 
+#
+# Distributed Lock Manager
+#
+# CONFIG_DLM is not set
+
 #
 # Profiling support
 #
@@ -1215,19 +1244,16 @@ CONFIG_NLS_DEFAULT="iso8859-1"
 CONFIG_ENABLE_MUST_CHECK=y
 # 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_HEADERS_CHECK is not set
 # CONFIG_DEBUG_SERIAL_EARLY_INIT is not set
 # CONFIG_DEBUG_HUNT_FOR_ZERO is not set
 # CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE is not set
-# CONFIG_BOOTPARAM is not set
-# CONFIG_NO_KERNEL_MSG is not set
 # CONFIG_CPLB_INFO is not set
-# CONFIG_NO_ACCESS_CHECK is not set
+# CONFIG_ACCESS_CHECK is not set
 
 #
 # Security options
@@ -1245,9 +1271,12 @@ CONFIG_SECURITY_CAPABILITIES=y
 #
 # Library routines
 #
+CONFIG_BITREVERSE=y
 CONFIG_CRC_CCITT=m
 # CONFIG_CRC16 is not set
 CONFIG_CRC32=y
 # CONFIG_LIBCRC32C is not set
 CONFIG_ZLIB_INFLATE=y
 CONFIG_PLIST=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
diff --git a/arch/blackfin/defconfig b/arch/blackfin/defconfig
deleted file mode 100644 (file)
index a513fbe..0000000
+++ /dev/null
@@ -1,1327 +0,0 @@
-#
-# Automatically generated make config: don't edit
-# Linux kernel version: 2.6.20.4
-#
-# CONFIG_MMU is not set
-# CONFIG_FPU is not set
-CONFIG_RWSEM_GENERIC_SPINLOCK=y
-# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
-CONFIG_BLACKFIN=y
-CONFIG_BFIN=y
-CONFIG_SEMAPHORE_SLEEPERS=y
-CONFIG_GENERIC_FIND_NEXT_BIT=y
-CONFIG_GENERIC_HWEIGHT=y
-CONFIG_GENERIC_HARDIRQS=y
-CONFIG_GENERIC_IRQ_PROBE=y
-# CONFIG_GENERIC_TIME is not set
-CONFIG_GENERIC_CALIBRATE_DELAY=y
-CONFIG_FORCE_MAX_ZONEORDER=14
-CONFIG_IRQCHIP_DEMUX_GPIO=y
-CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
-
-#
-# Code maturity level options
-#
-CONFIG_EXPERIMENTAL=y
-CONFIG_BROKEN_ON_SMP=y
-CONFIG_INIT_ENV_ARG_LIMIT=32
-
-#
-# General setup
-#
-CONFIG_LOCALVERSION=""
-CONFIG_LOCALVERSION_AUTO=y
-CONFIG_SYSVIPC=y
-# CONFIG_IPC_NS is not set
-# 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_SYSFS_DEPRECATED=y
-# CONFIG_RELAY is not set
-CONFIG_INITRAMFS_SOURCE=""
-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
-CONFIG_SYSCTL=y
-CONFIG_EMBEDDED=y
-CONFIG_UID16=y
-CONFIG_SYSCTL_SYSCALL=y
-CONFIG_KALLSYMS=y
-# CONFIG_KALLSYMS_EXTRA_PASS is not set
-CONFIG_HOTPLUG=y
-CONFIG_PRINTK=y
-CONFIG_BUG=y
-CONFIG_ELF_CORE=y
-CONFIG_BASE_FULL=y
-CONFIG_FUTEX=y
-CONFIG_EPOLL=y
-CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3
-# CONFIG_LIMIT_PAGECACHE is not set
-CONFIG_BUDDY=y
-# CONFIG_NP2 is not set
-CONFIG_SLAB=y
-CONFIG_VM_EVENT_COUNTERS=y
-CONFIG_RT_MUTEXES=y
-CONFIG_TINY_SHMEM=y
-CONFIG_BASE_SMALL=0
-# CONFIG_SLOB is not set
-
-#
-# Loadable module support
-#
-CONFIG_MODULES=y
-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=y
-
-#
-# Block layer
-#
-CONFIG_BLOCK=y
-# CONFIG_LBD is not set
-# CONFIG_BLK_DEV_IO_TRACE is not set
-# CONFIG_LSF is not set
-
-#
-# IO Schedulers
-#
-CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-# CONFIG_IOSCHED_DEADLINE is not set
-CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
-# CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
-# CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
-# CONFIG_PREEMPT_NONE is not set
-CONFIG_PREEMPT_VOLUNTARY=y
-# CONFIG_PREEMPT is not set
-
-#
-# Blackfin Processor Options
-#
-
-#
-# Processor and Board Settings
-#
-# CONFIG_BF531 is not set
-# CONFIG_BF532 is not set
-# CONFIG_BF533 is not set
-# CONFIG_BF534 is not set
-# CONFIG_BF536 is not set
-CONFIG_BF537=y
-# CONFIG_BF561 is not set
-CONFIG_BF_REV_0_2=y
-# CONFIG_BF_REV_0_3 is not set
-# CONFIG_BF_REV_0_4 is not set
-# CONFIG_BF_REV_0_5 is not set
-CONFIG_BFIN_SINGLE_CORE=y
-# CONFIG_BFIN533_EZKIT is not set
-# CONFIG_BFIN533_STAMP is not set
-CONFIG_BFIN537_STAMP=y
-# CONFIG_BFIN533_BLUETECHNIX_CM is not set
-# CONFIG_BFIN537_BLUETECHNIX_CM is not set
-# CONFIG_BFIN561_BLUETECHNIX_CM is not set
-# CONFIG_BFIN561_EZKIT is not set
-# CONFIG_PNAV10 is not set
-# CONFIG_GENERIC_BOARD is not set
-CONFIG_MEM_MT48LC32M8A2_75=y
-CONFIG_IRQ_PLL_WAKEUP=7
-
-#
-# BF537 Specific Configuration
-#
-
-#
-# PORT F/G Selection
-#
-CONFIG_BF537_PORT_F=y
-# CONFIG_BF537_PORT_G is not set
-# CONFIG_BF537_PORT_H is not set
-
-#
-# Interrupt Priority Assignment
-#
-
-#
-# Priority
-#
-CONFIG_IRQ_DMA_ERROR=7
-CONFIG_IRQ_ERROR=7
-CONFIG_IRQ_RTC=8
-CONFIG_IRQ_PPI=8
-CONFIG_IRQ_SPORT0_RX=9
-CONFIG_IRQ_SPORT0_TX=9
-CONFIG_IRQ_SPORT1_RX=9
-CONFIG_IRQ_SPORT1_TX=9
-CONFIG_IRQ_TWI=10
-CONFIG_IRQ_SPI=10
-CONFIG_IRQ_UART0_RX=10
-CONFIG_IRQ_UART0_TX=10
-CONFIG_IRQ_UART1_RX=10
-CONFIG_IRQ_UART1_TX=10
-CONFIG_IRQ_CAN_RX=11
-CONFIG_IRQ_CAN_TX=11
-CONFIG_IRQ_MAC_RX=11
-CONFIG_IRQ_MAC_TX=11
-CONFIG_IRQ_TMR0=12
-CONFIG_IRQ_TMR1=12
-CONFIG_IRQ_TMR2=12
-CONFIG_IRQ_TMR3=12
-CONFIG_IRQ_TMR4=12
-CONFIG_IRQ_TMR5=12
-CONFIG_IRQ_TMR6=12
-CONFIG_IRQ_TMR7=12
-CONFIG_IRQ_PROG_INTA=12
-CONFIG_IRQ_PORTG_INTB=12
-CONFIG_IRQ_MEM_DMA0=13
-CONFIG_IRQ_MEM_DMA1=13
-CONFIG_IRQ_WATCH=13
-
-#
-# Board customizations
-#
-# CONFIG_CMDLINE_BOOL is not set
-
-#
-# Board Setup
-#
-CONFIG_CLKIN_HZ=25000000
-CONFIG_MEM_SIZE=64
-CONFIG_MEM_ADD_WIDTH=10
-CONFIG_BOOT_LOAD=0x1000
-
-#
-# Console UART Setup
-#
-# CONFIG_BAUD_9600 is not set
-# CONFIG_BAUD_19200 is not set
-# CONFIG_BAUD_38400 is not set
-CONFIG_BAUD_57600=y
-# CONFIG_BAUD_115200 is not set
-CONFIG_BAUD_NO_PARITY=y
-# CONFIG_BAUD_PARITY is not set
-CONFIG_BAUD_1_STOPBIT=y
-# CONFIG_BAUD_2_STOPBIT is not set
-
-#
-# Blackfin Kernel Optimizations
-#
-
-#
-# Timer Tick
-#
-# 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
-
-#
-# Memory Optimizations
-#
-CONFIG_I_ENTRY_L1=y
-CONFIG_EXCPT_IRQ_SYSC_L1=y
-CONFIG_DO_IRQ_L1=y
-CONFIG_CORE_TIMER_IRQ_L1=y
-CONFIG_IDLE_L1=y
-CONFIG_SCHEDULE_L1=y
-CONFIG_ARITHMETIC_OPS_L1=y
-CONFIG_ACCESS_OK_L1=y
-CONFIG_MEMSET_L1=y
-CONFIG_MEMCPY_L1=y
-CONFIG_SYS_BFIN_SPINLOCK_L1=y
-# CONFIG_IP_CHECKSUM_L1 is not set
-# CONFIG_SYSCALL_TAB_L1 is not set
-# CONFIG_CPLB_SWITCH_TAB_L1 is not set
-CONFIG_RAMKERNEL=y
-# CONFIG_ROMKERNEL 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_SPLIT_PTLOCK_CPUS=4
-# CONFIG_RESOURCES_64BIT is not set
-CONFIG_LARGE_ALLOCS=y
-CONFIG_BFIN_DMA_5XX=y
-# CONFIG_DMA_UNCACHED_2M is not set
-CONFIG_DMA_UNCACHED_1M=y
-# CONFIG_DMA_UNCACHED_NONE is not set
-
-#
-# Cache Support
-#
-CONFIG_BLKFIN_CACHE=y
-CONFIG_BLKFIN_DCACHE=y
-# CONFIG_BLKFIN_DCACHE_BANKA is not set
-# CONFIG_BLKFIN_CACHE_LOCK is not set
-# CONFIG_BLKFIN_WB is not set
-CONFIG_BLKFIN_WT=y
-CONFIG_L1_MAX_PIECE=16
-
-#
-# Clock Settings
-#
-# CONFIG_BFIN_KERNEL_CLOCK is not set
-
-#
-# Asynchonous Memory Configuration
-#
-
-#
-# EBIU_AMBCTL Global Control
-#
-CONFIG_C_AMCKEN=y
-CONFIG_C_CDPRIO=y
-# CONFIG_C_AMBEN is not set
-# CONFIG_C_AMBEN_B0 is not set
-# CONFIG_C_AMBEN_B0_B1 is not set
-# CONFIG_C_AMBEN_B0_B1_B2 is not set
-CONFIG_C_AMBEN_ALL=y
-
-#
-# EBIU_AMBCTL Control
-#
-CONFIG_BANK_0=0x7BB0
-CONFIG_BANK_1=0x7BB0
-CONFIG_BANK_2=0x7BB0
-CONFIG_BANK_3=0x99B3
-
-#
-# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
-#
-# CONFIG_PCI is not set
-
-#
-# PCCARD (PCMCIA/CardBus) support
-#
-# CONFIG_PCCARD is not set
-
-#
-# PCI Hotplug Support
-#
-
-#
-# Executable file formats
-#
-CONFIG_BINFMT_ELF_FDPIC=y
-CONFIG_BINFMT_FLAT=y
-CONFIG_BINFMT_ZFLAT=y
-# CONFIG_BINFMT_SHARED_FLAT is not set
-# CONFIG_BINFMT_MISC is not set
-
-#
-# Power management options
-#
-CONFIG_PM=y
-CONFIG_PM_LEGACY=y
-# CONFIG_PM_DEBUG is not set
-# CONFIG_PM_SYSFS_DEPRECATED is not set
-CONFIG_PM_WAKEUP_GPIO_BY_SIC_IWR=y
-# CONFIG_PM_WAKEUP_BY_GPIO is not set
-# CONFIG_PM_WAKEUP_GPIO_API is not set
-CONFIG_PM_WAKEUP_SIC_IWR=0x80000000
-
-#
-# CPU Frequency scaling
-#
-# CONFIG_CPU_FREQ is not set
-
-#
-# Networking
-#
-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_NET_KEY is not set
-CONFIG_INET=y
-# CONFIG_IP_MULTICAST is not set
-# CONFIG_IP_ADVANCED_ROUTER is not set
-CONFIG_IP_FIB_HASH=y
-CONFIG_IP_PNP=y
-# CONFIG_IP_PNP_DHCP is not set
-# CONFIG_IP_PNP_BOOTP is not set
-# CONFIG_IP_PNP_RARP is not set
-# CONFIG_NET_IPIP is not set
-# CONFIG_NET_IPGRE is not set
-# CONFIG_ARPD is not set
-CONFIG_SYN_COOKIES=y
-# CONFIG_INET_AH is not set
-# CONFIG_INET_ESP is not set
-# CONFIG_INET_IPCOMP is not set
-# CONFIG_INET_XFRM_TUNNEL is not set
-# CONFIG_INET_TUNNEL is not set
-CONFIG_INET_XFRM_MODE_TRANSPORT=y
-CONFIG_INET_XFRM_MODE_TUNNEL=y
-CONFIG_INET_XFRM_MODE_BEET=y
-CONFIG_INET_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_NETLABEL 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
-# CONFIG_VLAN_8021Q is not set
-# CONFIG_DECNET is not set
-# CONFIG_LLC2 is not set
-# CONFIG_IPX is not set
-# CONFIG_ATALK is not set
-# CONFIG_X25 is not set
-# CONFIG_LAPB is not set
-# CONFIG_ECONET is not set
-# CONFIG_WAN_ROUTER is not set
-
-#
-# QoS and/or fair queueing
-#
-# CONFIG_NET_SCHED is not set
-
-#
-# Network testing
-#
-# CONFIG_NET_PKTGEN is not set
-# CONFIG_HAMRADIO is not set
-CONFIG_IRDA=m
-
-#
-# IrDA protocols
-#
-CONFIG_IRLAN=m
-CONFIG_IRCOMM=m
-# CONFIG_IRDA_ULTRA is not set
-
-#
-# IrDA options
-#
-CONFIG_IRDA_CACHE_LAST_LSAP=y
-# CONFIG_IRDA_FAST_RR is not set
-# CONFIG_IRDA_DEBUG is not set
-
-#
-# Infrared-port device drivers
-#
-
-#
-# SIR device drivers
-#
-CONFIG_IRTTY_SIR=m
-
-#
-# Dongle support
-#
-# CONFIG_DONGLE is not set
-
-#
-# Old SIR device drivers
-#
-# CONFIG_IRPORT_SIR is not set
-
-#
-# Old Serial dongle support
-#
-
-#
-# FIR device drivers
-#
-# CONFIG_BT is not set
-# CONFIG_IEEE80211 is not set
-
-#
-# Device Drivers
-#
-
-#
-# Generic Driver Options
-#
-CONFIG_STANDALONE=y
-CONFIG_PREVENT_FIRMWARE_BUILD=y
-# CONFIG_FW_LOADER is not set
-# CONFIG_SYS_HYPERVISOR is not set
-
-#
-# Connector - unified userspace <-> kernelspace linker
-#
-# CONFIG_CONNECTOR is not set
-
-#
-# Memory Technology Devices (MTD)
-#
-CONFIG_MTD=y
-# CONFIG_MTD_DEBUG is not set
-# CONFIG_MTD_CONCAT is not set
-CONFIG_MTD_PARTITIONS=y
-# CONFIG_MTD_REDBOOT_PARTS is not set
-# CONFIG_MTD_CMDLINE_PARTS is not set
-
-#
-# User Modules And Translation Layers
-#
-CONFIG_MTD_CHAR=m
-CONFIG_MTD_BLKDEVS=y
-CONFIG_MTD_BLOCK=y
-# CONFIG_FTL is not set
-# CONFIG_NFTL is not set
-# CONFIG_INFTL is not set
-# CONFIG_RFD_FTL is not set
-# CONFIG_SSFDC is not set
-
-#
-# RAM/ROM/Flash chip drivers
-#
-# CONFIG_MTD_CFI is not set
-CONFIG_MTD_JEDECPROBE=m
-CONFIG_MTD_GEN_PROBE=m
-# CONFIG_MTD_CFI_ADV_OPTIONS is not set
-CONFIG_MTD_MAP_BANK_WIDTH_1=y
-CONFIG_MTD_MAP_BANK_WIDTH_2=y
-CONFIG_MTD_MAP_BANK_WIDTH_4=y
-# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
-# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
-# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
-CONFIG_MTD_CFI_I1=y
-CONFIG_MTD_CFI_I2=y
-# CONFIG_MTD_CFI_I4 is not set
-# CONFIG_MTD_CFI_I8 is not set
-# CONFIG_MTD_CFI_INTELEXT is not set
-# CONFIG_MTD_CFI_AMDSTD is not set
-# CONFIG_MTD_CFI_STAA is not set
-CONFIG_MTD_MW320D=m
-CONFIG_MTD_RAM=y
-CONFIG_MTD_ROM=m
-# CONFIG_MTD_ABSENT is not set
-# CONFIG_MTD_OBSOLETE_CHIPS is not set
-
-#
-# Mapping drivers for chip access
-#
-CONFIG_MTD_COMPLEX_MAPPINGS=y
-# CONFIG_MTD_PHYSMAP is not set
-CONFIG_MTD_BF5xx=m
-CONFIG_BFIN_FLASH_SIZE=0x400000
-CONFIG_EBIU_FLASH_BASE=0x20000000
-
-#
-# FLASH_EBIU_AMBCTL Control
-#
-CONFIG_BFIN_FLASH_BANK_0=0x7BB0
-CONFIG_BFIN_FLASH_BANK_1=0x7BB0
-CONFIG_BFIN_FLASH_BANK_2=0x7BB0
-CONFIG_BFIN_FLASH_BANK_3=0x7BB0
-CONFIG_MTD_UCLINUX=y
-# CONFIG_MTD_PLATRAM is not set
-
-#
-# Self-contained MTD device drivers
-#
-# CONFIG_MTD_DATAFLASH is not set
-# CONFIG_MTD_M25P80 is not set
-# CONFIG_MTD_SLRAM is not set
-# CONFIG_MTD_PHRAM is not set
-# CONFIG_MTD_MTDRAM is not set
-# CONFIG_MTD_BLOCK2MTD is not set
-
-#
-# Disk-On-Chip Device Drivers
-#
-# CONFIG_MTD_DOC2000 is not set
-# CONFIG_MTD_DOC2001 is not set
-# CONFIG_MTD_DOC2001PLUS is not set
-
-#
-# NAND Flash Device Drivers
-#
-CONFIG_MTD_NAND=m
-# CONFIG_MTD_NAND_VERIFY_WRITE is not set
-# CONFIG_MTD_NAND_ECC_SMC is not set
-CONFIG_MTD_NAND_BFIN=m
-CONFIG_BFIN_NAND_BASE=0x20212000
-CONFIG_BFIN_NAND_CLE=2
-CONFIG_BFIN_NAND_ALE=1
-CONFIG_BFIN_NAND_READY=3
-CONFIG_MTD_NAND_IDS=m
-# CONFIG_MTD_NAND_DISKONCHIP is not set
-# CONFIG_MTD_NAND_NANDSIM is not set
-
-#
-# OneNAND Flash Device Drivers
-#
-# CONFIG_MTD_ONENAND is not set
-
-#
-# Parallel port support
-#
-# CONFIG_PARPORT is not set
-
-#
-# Plug and Play support
-#
-
-#
-# Block devices
-#
-# 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 is not set
-# CONFIG_CDROM_PKTCDVD is not set
-# CONFIG_ATA_OVER_ETH is not set
-
-#
-# Misc devices
-#
-# CONFIG_TIFM_CORE is not set
-
-#
-# ATA/ATAPI/MFM/RLL support
-#
-# CONFIG_IDE is not set
-
-#
-# SCSI device support
-#
-# CONFIG_RAID_ATTRS is not set
-# CONFIG_SCSI 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_EQUALIZER is not set
-# CONFIG_TUN is not set
-
-#
-# PHY device support
-#
-# CONFIG_PHYLIB is not set
-
-#
-# Ethernet (10 or 100Mbit)
-#
-CONFIG_NET_ETHERNET=y
-CONFIG_MII=y
-# CONFIG_SMC91X is not set
-CONFIG_BFIN_MAC=y
-CONFIG_BFIN_MAC_USE_L1=y
-CONFIG_BFIN_TX_DESC_NUM=10
-CONFIG_BFIN_RX_DESC_NUM=20
-# CONFIG_BFIN_MAC_RMII is not set
-
-#
-# Ethernet (1000 Mbit)
-#
-
-#
-# Ethernet (10000 Mbit)
-#
-
-#
-# Token Ring devices
-#
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
-
-#
-# Wan interfaces
-#
-# CONFIG_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
-
-#
-# Input device support
-#
-CONFIG_INPUT=y
-# CONFIG_INPUT_FF_MEMLESS 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=m
-# CONFIG_INPUT_EVBUG is not set
-
-#
-# Input Device Drivers
-#
-# CONFIG_INPUT_KEYBOARD is not set
-# CONFIG_INPUT_MOUSE is not set
-# CONFIG_INPUT_JOYSTICK is not set
-# CONFIG_INPUT_TOUCHSCREEN is not set
-CONFIG_INPUT_MISC=y
-# CONFIG_INPUT_UINPUT is not set
-# CONFIG_BF53X_PFBUTTONS is not set
-CONFIG_TWI_KEYPAD=m
-CONFIG_BFIN_TWIKEYPAD_IRQ_PFX=72
-
-#
-# Hardware I/O ports
-#
-# CONFIG_SERIO is not set
-# CONFIG_GAMEPORT is not set
-
-#
-# Character devices
-#
-# CONFIG_AD9960 is not set
-# CONFIG_SPI_ADC_BF533 is not set
-# CONFIG_BF533_PFLAGS is not set
-# CONFIG_BF5xx_PPIFCD is not set
-# CONFIG_BF5xx_TIMERS is not set
-# CONFIG_BF5xx_PPI is not set
-CONFIG_BFIN_SPORT=y
-# CONFIG_BFIN_TIMER_LATENCY is not set
-CONFIG_TWI_LCD=m
-CONFIG_TWI_LCD_SLAVE_ADDR=34
-# CONFIG_AD5304 is not set
-# CONFIG_VT is not set
-# CONFIG_SERIAL_NONSTANDARD is not set
-
-#
-# Serial drivers
-#
-# CONFIG_SERIAL_8250 is not set
-
-#
-# Non-8250 serial port support
-#
-CONFIG_SERIAL_BFIN=y
-CONFIG_SERIAL_BFIN_CONSOLE=y
-CONFIG_SERIAL_BFIN_DMA=y
-# CONFIG_SERIAL_BFIN_PIO is not set
-CONFIG_SERIAL_BFIN_UART0=y
-# CONFIG_BFIN_UART0_CTSRTS is not set
-# CONFIG_SERIAL_BFIN_UART1 is not set
-CONFIG_SERIAL_CORE=y
-CONFIG_SERIAL_CORE_CONSOLE=y
-# CONFIG_SERIAL_BFIN_SPORT is not set
-CONFIG_UNIX98_PTYS=y
-# CONFIG_LEGACY_PTYS is not set
-
-#
-# CAN, the car bus and industrial fieldbus
-#
-CONFIG_CAN4LINUX=y
-
-#
-# linux embedded drivers
-#
-# CONFIG_CAN_MCF5282 is not set
-# CONFIG_CAN_UNCTWINCAN is not set
-CONFIG_CAN_BLACKFIN=m
-
-#
-# 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_BLACKFIN_DPMC=y
-# CONFIG_DTLK is not set
-# CONFIG_R3964 is not set
-# CONFIG_RAW_DRIVER is not set
-
-#
-# TPM devices
-#
-# CONFIG_TCG_TPM is not set
-
-#
-# I2C support
-#
-CONFIG_I2C=m
-CONFIG_I2C_CHARDEV=m
-
-#
-# I2C Algorithms
-#
-# CONFIG_I2C_ALGOBIT is not set
-# CONFIG_I2C_ALGOPCF is not set
-# CONFIG_I2C_ALGOPCA is not set
-
-#
-# I2C Hardware Bus support
-#
-# CONFIG_I2C_BLACKFIN_GPIO is not set
-# CONFIG_I2C_BLACKFIN_TWI is not set
-# CONFIG_I2C_OCORES is not set
-# CONFIG_I2C_PARPORT_LIGHT is not set
-# CONFIG_I2C_STUB is not set
-# CONFIG_I2C_PCA_ISA is not set
-
-#
-# Miscellaneous I2C Chip support
-#
-# CONFIG_SENSORS_DS1337 is not set
-# CONFIG_SENSORS_DS1374 is not set
-CONFIG_SENSORS_AD5252=m
-# CONFIG_SENSORS_EEPROM is not set
-# CONFIG_SENSORS_PCF8574 is not set
-# CONFIG_SENSORS_PCF8575 is not set
-# CONFIG_SENSORS_PCA9543 is not set
-# CONFIG_SENSORS_PCA9539 is not set
-# CONFIG_SENSORS_PCF8591 is not set
-# CONFIG_SENSORS_MAX6875 is not set
-# CONFIG_I2C_DEBUG_CORE is not set
-# CONFIG_I2C_DEBUG_ALGO is not set
-# CONFIG_I2C_DEBUG_BUS is not set
-# CONFIG_I2C_DEBUG_CHIP is not set
-
-#
-# SPI support
-#
-CONFIG_SPI=y
-CONFIG_SPI_MASTER=y
-
-#
-# SPI Master Controller Drivers
-#
-# CONFIG_SPI_BITBANG is not set
-
-#
-# SPI Protocol Masters
-#
-CONFIG_SPI_BFIN=y
-
-#
-# Dallas's 1-wire bus
-#
-# CONFIG_W1 is not set
-
-#
-# Hardware Monitoring support
-#
-CONFIG_HWMON=y
-# CONFIG_HWMON_VID is not set
-# CONFIG_SENSORS_ABITUGURU is not set
-# CONFIG_SENSORS_ADM1021 is not set
-# CONFIG_SENSORS_ADM1025 is not set
-# CONFIG_SENSORS_ADM1026 is not set
-# CONFIG_SENSORS_ADM1031 is not set
-# CONFIG_SENSORS_ADM9240 is not set
-# CONFIG_SENSORS_ASB100 is not set
-# CONFIG_SENSORS_ATXP1 is not set
-# CONFIG_SENSORS_DS1621 is not set
-# CONFIG_SENSORS_F71805F is not set
-# CONFIG_SENSORS_FSCHER is not set
-# CONFIG_SENSORS_FSCPOS is not set
-# CONFIG_SENSORS_GL518SM is not set
-# CONFIG_SENSORS_GL520SM is not set
-# CONFIG_SENSORS_IT87 is not set
-# CONFIG_SENSORS_LM63 is not set
-# CONFIG_SENSORS_LM70 is not set
-# CONFIG_SENSORS_LM75 is not set
-# CONFIG_SENSORS_LM77 is not set
-# CONFIG_SENSORS_LM78 is not set
-# CONFIG_SENSORS_LM80 is not set
-# CONFIG_SENSORS_LM83 is not set
-# CONFIG_SENSORS_LM85 is not set
-# CONFIG_SENSORS_LM87 is not set
-# CONFIG_SENSORS_LM90 is not set
-# CONFIG_SENSORS_LM92 is not set
-# CONFIG_SENSORS_MAX1619 is not set
-# CONFIG_SENSORS_PC87360 is not set
-# CONFIG_SENSORS_PC87427 is not set
-# CONFIG_SENSORS_SMSC47M1 is not set
-# CONFIG_SENSORS_SMSC47M192 is not set
-# CONFIG_SENSORS_SMSC47B397 is not set
-# CONFIG_SENSORS_VT1211 is not set
-# CONFIG_SENSORS_W83781D is not set
-# CONFIG_SENSORS_W83791D is not set
-# CONFIG_SENSORS_W83792D is not set
-# CONFIG_SENSORS_W83793 is not set
-# CONFIG_SENSORS_W83L785TS is not set
-# CONFIG_SENSORS_W83627HF is not set
-# CONFIG_SENSORS_W83627EHF is not set
-# CONFIG_HWMON_DEBUG_CHIP is not set
-
-#
-# Multimedia devices
-#
-# CONFIG_VIDEO_DEV is not set
-
-#
-# Digital Video Broadcasting Devices
-#
-# CONFIG_DVB is not set
-
-#
-# Graphics support
-#
-CONFIG_FIRMWARE_EDID=y
-CONFIG_FB=m
-CONFIG_FB_CFB_FILLRECT=m
-CONFIG_FB_CFB_COPYAREA=m
-CONFIG_FB_CFB_IMAGEBLIT=m
-# 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
-CONFIG_FB_BFIN_7171=m
-CONFIG_FB_BFIN_7393=m
-CONFIG_NTSC=y
-# CONFIG_PAL is not set
-# CONFIG_NTSC_640x480 is not set
-# CONFIG_PAL_640x480 is not set
-# CONFIG_NTSC_YCBCR is not set
-# CONFIG_PAL_YCBCR is not set
-CONFIG_ADV7393_1XMEM=y
-# CONFIG_ADV7393_2XMEM is not set
-# CONFIG_FB_S1D13XXX is not set
-# CONFIG_FB_VIRTUAL is not set
-
-#
-# Logo configuration
-#
-# CONFIG_LOGO is not set
-CONFIG_BACKLIGHT_LCD_SUPPORT=y
-CONFIG_BACKLIGHT_CLASS_DEVICE=m
-CONFIG_BACKLIGHT_DEVICE=y
-CONFIG_LCD_CLASS_DEVICE=m
-CONFIG_LCD_DEVICE=y
-
-#
-# Sound
-#
-CONFIG_SOUND=m
-
-#
-# Advanced Linux Sound Architecture
-#
-CONFIG_SND=m
-CONFIG_SND_TIMER=m
-CONFIG_SND_PCM=m
-# CONFIG_SND_SEQUENCER is not set
-CONFIG_SND_OSSEMUL=y
-CONFIG_SND_MIXER_OSS=m
-CONFIG_SND_PCM_OSS=m
-CONFIG_SND_PCM_OSS_PLUGINS=y
-# CONFIG_SND_DYNAMIC_MINORS is not set
-CONFIG_SND_SUPPORT_OLD_API=y
-CONFIG_SND_VERBOSE_PROCFS=y
-# CONFIG_SND_VERBOSE_PRINTK is not set
-# CONFIG_SND_DEBUG is not set
-
-#
-# Generic devices
-#
-# CONFIG_SND_DUMMY is not set
-# CONFIG_SND_MTPAV is not set
-# CONFIG_SND_SERIAL_U16550 is not set
-# CONFIG_SND_MPU401 is not set
-
-#
-# Open Sound System
-#
-# CONFIG_SOUND_PRIME is not set
-
-#
-# HID Devices
-#
-CONFIG_HID=y
-
-#
-# USB support
-#
-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
-
-#
-# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
-#
-
-#
-# USB Gadget Support
-#
-# CONFIG_USB_GADGET is not set
-
-#
-# MMC/SD Card support
-#
-# CONFIG_SPI_MMC is not set
-# CONFIG_MMC is not set
-
-#
-# LED devices
-#
-# CONFIG_NEW_LEDS is not set
-
-#
-# LED drivers
-#
-
-#
-# LED Triggers
-#
-
-#
-# InfiniBand support
-#
-
-#
-# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
-#
-
-#
-# Real Time Clock
-#
-CONFIG_RTC_LIB=y
-CONFIG_RTC_CLASS=y
-CONFIG_RTC_HCTOSYS=y
-CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
-# CONFIG_RTC_DEBUG is not set
-
-#
-# RTC interfaces
-#
-CONFIG_RTC_INTF_SYSFS=y
-CONFIG_RTC_INTF_PROC=y
-CONFIG_RTC_INTF_DEV=y
-# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
-
-#
-# RTC drivers
-#
-# CONFIG_RTC_DRV_X1205 is not set
-# CONFIG_RTC_DRV_DS1307 is not set
-# CONFIG_RTC_DRV_DS1553 is not set
-# CONFIG_RTC_DRV_ISL1208 is not set
-# CONFIG_RTC_DRV_DS1672 is not set
-# CONFIG_RTC_DRV_DS1742 is not set
-# CONFIG_RTC_DRV_PCF8563 is not set
-# CONFIG_RTC_DRV_PCF8583 is not set
-# CONFIG_RTC_DRV_RS5C348 is not set
-# CONFIG_RTC_DRV_RS5C372 is not set
-# CONFIG_RTC_DRV_M48T86 is not set
-# CONFIG_RTC_DRV_TEST is not set
-# CONFIG_RTC_DRV_MAX6902 is not set
-# CONFIG_RTC_DRV_V3020 is not set
-CONFIG_RTC_DRV_BFIN=y
-
-#
-# DMA Engine support
-#
-# CONFIG_DMA_ENGINE is not set
-
-#
-# DMA Clients
-#
-
-#
-# DMA Devices
-#
-
-#
-# Virtualization
-#
-
-#
-# PBX support
-#
-# CONFIG_PBX is not set
-
-#
-# File systems
-#
-CONFIG_EXT2_FS=y
-CONFIG_EXT2_FS_XATTR=y
-# CONFIG_EXT2_FS_POSIX_ACL is not set
-# CONFIG_EXT2_FS_SECURITY is not set
-# CONFIG_EXT3_FS is not set
-# CONFIG_EXT4DEV_FS 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 is not set
-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
-
-#
-# CD-ROM/DVD Filesystems
-#
-# CONFIG_ISO9660_FS is not set
-# CONFIG_UDF_FS is not set
-
-#
-# DOS/FAT/NT Filesystems
-#
-# CONFIG_MSDOS_FS is not set
-# CONFIG_VFAT_FS is not set
-# CONFIG_NTFS_FS is not set
-
-#
-# Pseudo filesystems
-#
-CONFIG_PROC_FS=y
-CONFIG_PROC_SYSCTL=y
-CONFIG_SYSFS=y
-# CONFIG_TMPFS is not set
-# CONFIG_HUGETLB_PAGE is not set
-CONFIG_RAMFS=y
-# CONFIG_CONFIGFS_FS is not set
-
-#
-# Miscellaneous filesystems
-#
-# CONFIG_ADFS_FS is not set
-# CONFIG_AFFS_FS is not set
-# CONFIG_HFS_FS is not set
-# CONFIG_HFSPLUS_FS is not set
-# CONFIG_BEFS_FS is not set
-# CONFIG_BFS_FS is not set
-# CONFIG_EFS_FS is not set
-CONFIG_YAFFS_FS=m
-CONFIG_YAFFS_YAFFS1=y
-# CONFIG_YAFFS_DOES_ECC is not set
-CONFIG_YAFFS_YAFFS2=y
-CONFIG_YAFFS_AUTO_YAFFS2=y
-# CONFIG_YAFFS_DISABLE_LAZY_LOAD is not set
-CONFIG_YAFFS_CHECKPOINT_RESERVED_BLOCKS=10
-# CONFIG_YAFFS_DISABLE_WIDE_TNODES is not set
-# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set
-CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y
-CONFIG_JFFS2_FS=m
-CONFIG_JFFS2_FS_DEBUG=0
-CONFIG_JFFS2_FS_WRITEBUFFER=y
-# CONFIG_JFFS2_SUMMARY is not set
-# CONFIG_JFFS2_FS_XATTR is not set
-# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
-CONFIG_JFFS2_ZLIB=y
-CONFIG_JFFS2_RTIME=y
-# CONFIG_JFFS2_RUBIN is not set
-# CONFIG_CRAMFS is not set
-# CONFIG_VXFS_FS is not set
-# CONFIG_HPFS_FS is not set
-# CONFIG_QNX4FS_FS is not set
-# CONFIG_SYSV_FS is not set
-# CONFIG_UFS_FS is not set
-
-#
-# Network File Systems
-#
-CONFIG_NFS_FS=m
-CONFIG_NFS_V3=y
-# CONFIG_NFS_V3_ACL is not set
-# CONFIG_NFS_V4 is not set
-# CONFIG_NFS_DIRECTIO is not set
-# CONFIG_NFSD is not set
-CONFIG_LOCKD=m
-CONFIG_LOCKD_V4=y
-CONFIG_NFS_COMMON=y
-CONFIG_SUNRPC=m
-# CONFIG_RPCSEC_GSS_KRB5 is not set
-# CONFIG_RPCSEC_GSS_SPKM3 is not set
-CONFIG_SMB_FS=m
-# CONFIG_SMB_NLS_DEFAULT is not set
-# CONFIG_CIFS is not set
-# CONFIG_NCP_FS is not set
-# CONFIG_CODA_FS is not set
-# CONFIG_AFS_FS is not set
-# CONFIG_9P_FS is not set
-
-#
-# Partition Types
-#
-# CONFIG_PARTITION_ADVANCED is not set
-CONFIG_MSDOS_PARTITION=y
-
-#
-# Native Language Support
-#
-CONFIG_NLS=m
-CONFIG_NLS_DEFAULT="iso8859-1"
-# CONFIG_NLS_CODEPAGE_437 is not set
-# CONFIG_NLS_CODEPAGE_737 is not set
-# CONFIG_NLS_CODEPAGE_775 is not set
-# CONFIG_NLS_CODEPAGE_850 is not set
-# CONFIG_NLS_CODEPAGE_852 is not set
-# CONFIG_NLS_CODEPAGE_855 is not set
-# CONFIG_NLS_CODEPAGE_857 is not set
-# CONFIG_NLS_CODEPAGE_860 is not set
-# CONFIG_NLS_CODEPAGE_861 is not set
-# CONFIG_NLS_CODEPAGE_862 is not set
-# CONFIG_NLS_CODEPAGE_863 is not set
-# CONFIG_NLS_CODEPAGE_864 is not set
-# CONFIG_NLS_CODEPAGE_865 is not set
-# CONFIG_NLS_CODEPAGE_866 is not set
-# CONFIG_NLS_CODEPAGE_869 is not set
-# CONFIG_NLS_CODEPAGE_936 is not set
-# CONFIG_NLS_CODEPAGE_950 is not set
-# CONFIG_NLS_CODEPAGE_932 is not set
-# CONFIG_NLS_CODEPAGE_949 is not set
-# CONFIG_NLS_CODEPAGE_874 is not set
-# CONFIG_NLS_ISO8859_8 is not set
-# CONFIG_NLS_CODEPAGE_1250 is not set
-# CONFIG_NLS_CODEPAGE_1251 is not set
-# CONFIG_NLS_ASCII is not set
-# CONFIG_NLS_ISO8859_1 is not set
-# CONFIG_NLS_ISO8859_2 is not set
-# CONFIG_NLS_ISO8859_3 is not set
-# CONFIG_NLS_ISO8859_4 is not set
-# CONFIG_NLS_ISO8859_5 is not set
-# CONFIG_NLS_ISO8859_6 is not set
-# CONFIG_NLS_ISO8859_7 is not set
-# CONFIG_NLS_ISO8859_9 is not set
-# CONFIG_NLS_ISO8859_13 is not set
-# CONFIG_NLS_ISO8859_14 is not set
-# CONFIG_NLS_ISO8859_15 is not set
-# CONFIG_NLS_KOI8_R is not set
-# CONFIG_NLS_KOI8_U is not set
-# CONFIG_NLS_UTF8 is not set
-
-#
-# Distributed Lock Manager
-#
-# CONFIG_DLM is not set
-
-#
-# Profiling support
-#
-# CONFIG_PROFILING is not set
-
-#
-# Kernel hacking
-#
-# CONFIG_PRINTK_TIME is not set
-CONFIG_ENABLE_MUST_CHECK=y
-# 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_SERIAL_EARLY_INIT is not set
-CONFIG_DEBUG_HUNT_FOR_ZERO=y
-# CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE is not set
-CONFIG_CPLB_INFO=y
-CONFIG_ACCESS_CHECK=y
-
-#
-# Security options
-#
-# CONFIG_KEYS is not set
-CONFIG_SECURITY=y
-# CONFIG_SECURITY_NETWORK is not set
-CONFIG_SECURITY_CAPABILITIES=y
-
-#
-# Cryptographic options
-#
-# CONFIG_CRYPTO is not set
-
-#
-# Library routines
-#
-CONFIG_BITREVERSE=y
-CONFIG_CRC_CCITT=m
-# CONFIG_CRC16 is not set
-CONFIG_CRC32=y
-# CONFIG_LIBCRC32C is not set
-CONFIG_ZLIB_INFLATE=y
-CONFIG_ZLIB_DEFLATE=m
-CONFIG_PLIST=y
-CONFIG_IOMAP_COPY=y
index 0ccb0dc3f833392e602767c1708883cf752c7589..069a896a8f260e67c7354066b6c05020811383cc 100644 (file)
@@ -595,7 +595,7 @@ unsigned short get_dma_curr_ycount(unsigned int channel)
 }
 EXPORT_SYMBOL(get_dma_curr_ycount);
 
-void *_dma_memcpy(void *dest, const void *src, size_t size)
+static void *__dma_memcpy(void *dest, const void *src, size_t size)
 {
        int direction;  /* 1 - address decrease, 0 - address increase */
        int flag_align; /* 1 - address aligned,  0 - address unaligned */
@@ -744,8 +744,8 @@ void *dma_memcpy(void *dest, const void *src, size_t size)
        bulk = (size >> 16) << 16;
        rest = size - bulk;
        if (bulk)
-               _dma_memcpy(dest, src, bulk);
-       addr = _dma_memcpy(dest+bulk, src+bulk, rest);
+               __dma_memcpy(dest, src, bulk);
+       addr = __dma_memcpy(dest+bulk, src+bulk, rest);
        return addr;
 }
 
index 3f49fae1cb1f686802a02055e1da2be85b03a4ff..bb1f4fb2467c119251d2b14417998500f6de4827 100644 (file)
@@ -138,7 +138,7 @@ static unsigned int sic_iwr_irqs[gpio_bank(MAX_BLACKFIN_GPIOS)] = {IRQ_PROG0_INT
 
 inline int check_gpio(unsigned short gpio)
 {
-       if (gpio > MAX_BLACKFIN_GPIOS)
+       if (gpio >= MAX_BLACKFIN_GPIOS)
                return -EINVAL;
        return 0;
 }
@@ -494,19 +494,24 @@ u32 gpio_pm_setup(void)
                        gpio_bank_saved[bank].dir   = gpio_bankb[bank]->dir;
                        gpio_bank_saved[bank].edge  = gpio_bankb[bank]->edge;
                        gpio_bank_saved[bank].both  = gpio_bankb[bank]->both;
+                       gpio_bank_saved[bank].reserved = reserved_map[bank];
 
                        gpio = i;
 
                        while (mask) {
                                if (mask & 1) {
-                                       bfin_gpio_wakeup_type(gpio, wakeup_flags_map[gpio]);
+                                       reserved_map[gpio_bank(gpio)] |=
+                                                       gpio_bit(gpio);
+                                       bfin_gpio_wakeup_type(gpio,
+                                               wakeup_flags_map[gpio]);
                                        set_gpio_data(gpio, 0); /*Clear*/
                                }
                                gpio++;
                                mask >>= 1;
                        }
 
-                       sic_iwr |= 1 << (sic_iwr_irqs[bank] - (IRQ_CORETMR + 1));
+                       sic_iwr |= 1 <<
+                               (sic_iwr_irqs[bank] - (IRQ_CORETMR + 1));
                        gpio_bankb[bank]->maskb_set = wakeup_map[gpio_bank(i)];
                }
        }
@@ -535,6 +540,9 @@ void gpio_pm_restore(void)
                        gpio_bankb[bank]->polar = gpio_bank_saved[bank].polar;
                        gpio_bankb[bank]->edge  = gpio_bank_saved[bank].edge;
                        gpio_bankb[bank]->both  = gpio_bank_saved[bank].both;
+
+                       reserved_map[bank] = gpio_bank_saved[bank].reserved;
+
                }
 
                gpio_bankb[bank]->maskb = gpio_bank_saved[bank].maskb;
index 5880b270bd5006b7a2a4fe824543cd01a16a5600..65c5ba4260b0042d078aac225960eedf48acef3f 100644 (file)
@@ -58,10 +58,12 @@ ENTRY(_ret_from_fork)
        RESTORE_ALL_SYS
        p0 = reti;
        jump (p0);
+ENDPROC(_ret_from_fork)
 
 ENTRY(_sys_fork)
        r0 = -EINVAL;
        rts;
+ENDPROC(_sys_fork)
 
 ENTRY(_sys_vfork)
        r0 = sp;
@@ -72,6 +74,7 @@ ENTRY(_sys_vfork)
        SP += 12;
        rets = [sp++];
        rts;
+ENDPROC(_sys_vfork)
 
 ENTRY(_sys_clone)
        r0 = sp;
@@ -82,6 +85,7 @@ ENTRY(_sys_clone)
        SP += 12;
        rets = [sp++];
        rts;
+ENDPROC(_sys_clone)
 
 ENTRY(_sys_rt_sigreturn)
        r0 = sp;
@@ -92,3 +96,4 @@ ENTRY(_sys_rt_sigreturn)
        SP += 12;
        rets = [sp++];
        rts;
+ENDPROC(_sys_rt_sigreturn)
index df5bf022cf7941112b8a9af3dabe57c61dc5e727..80996a1a94ca9996edb9dccde1925c398490cd8b 100644 (file)
@@ -91,7 +91,7 @@ int show_interrupts(struct seq_file *p, void *v)
 }
 
 /*
- * do_IRQ handles all hardware IRQ's.  Decoded IRQs should not
+ * do_IRQ handles all hardware IRQs.  Decoded IRQs should not
  * come via this function.  Instead, they should provide their
  * own 'handler'
  */
index 02dc74301920ea36f34daa7198e55d8cfa586723..a24fa1ab802b3713588ba2dff82315cc479a435b 100644 (file)
@@ -61,7 +61,7 @@ EXPORT_SYMBOL(memory_mtd_start);
 EXPORT_SYMBOL(mtd_size);
 #endif
 
-char command_line[COMMAND_LINE_SIZE];
+char __initdata command_line[COMMAND_LINE_SIZE];
 
 #if defined(CONFIG_BLKFIN_DCACHE) || defined(CONFIG_BLKFIN_CACHE)
 static void generate_cpl_tables(void);
@@ -90,7 +90,7 @@ void __init bf53x_cache_init(void)
 #endif
 }
 
-void bf53x_relocate_l1_mem(void)
+void __init bf53x_relocate_l1_mem(void)
 {
        unsigned long l1_code_length;
        unsigned long l1_data_a_length;
@@ -205,7 +205,6 @@ void __init setup_arch(char **cmdline_p)
 #endif
 
 #if defined(CONFIG_CMDLINE_BOOL)
-       memset(command_line, 0, sizeof(command_line));
        strncpy(&command_line[0], CONFIG_CMDLINE, sizeof(command_line));
        command_line[sizeof(command_line) - 1] = 0;
 #endif
@@ -213,7 +212,7 @@ void __init setup_arch(char **cmdline_p)
        /* Keep a copy of command line */
        *cmdline_p = &command_line[0];
        memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
-       boot_command_line[COMMAND_LINE_SIZE - 1] = 0;
+       boot_command_line[COMMAND_LINE_SIZE - 1] = '\0';
 
        /* setup memory defaults from the user config */
        physical_mem_end = 0;
@@ -411,7 +410,7 @@ static int __init topology_init(void)
 subsys_initcall(topology_init);
 
 #if defined(CONFIG_BLKFIN_DCACHE) || defined(CONFIG_BLKFIN_CACHE)
-u16 lock_kernel_check(u32 start, u32 end)
+static u16 __init lock_kernel_check(u32 start, u32 end)
 {
        if ((start <= (u32) _stext && end >= (u32) _end)
            || (start >= (u32) _stext && end <= (u32) _end))
@@ -471,6 +470,67 @@ close_cplbtab(struct cplb_tab *table)
        return 0;
 }
 
+/* helper function */
+static void __fill_code_cplbtab(struct cplb_tab *t, int i,
+                               u32 a_start, u32 a_end)
+{
+       if (cplb_data[i].psize) {
+               fill_cplbtab(t,
+                               cplb_data[i].start,
+                               cplb_data[i].end,
+                               cplb_data[i].psize,
+                               cplb_data[i].i_conf);
+       } else {
+#if (defined(CONFIG_BLKFIN_CACHE) && defined(ANOMALY_05000263))
+               if (i == SDRAM_KERN) {
+                       fill_cplbtab(t,
+                                       cplb_data[i].start,
+                                       cplb_data[i].end,
+                                       SIZE_4M,
+                                       cplb_data[i].i_conf);
+               } else {
+#endif
+                       fill_cplbtab(t,
+                                       cplb_data[i].start,
+                                       a_start,
+                                       SIZE_1M,
+                                       cplb_data[i].i_conf);
+                       fill_cplbtab(t,
+                                       a_start,
+                                       a_end,
+                                       SIZE_4M,
+                                       cplb_data[i].i_conf);
+                       fill_cplbtab(t, a_end,
+                                       cplb_data[i].end,
+                                       SIZE_1M,
+                                       cplb_data[i].i_conf);
+               }
+       }
+}
+
+static void __fill_data_cplbtab(struct cplb_tab *t, int i,
+                               u32 a_start, u32 a_end)
+{
+       if (cplb_data[i].psize) {
+               fill_cplbtab(t,
+                               cplb_data[i].start,
+                               cplb_data[i].end,
+                               cplb_data[i].psize,
+                               cplb_data[i].d_conf);
+       } else {
+               fill_cplbtab(t,
+                               cplb_data[i].start,
+                               a_start, SIZE_1M,
+                               cplb_data[i].d_conf);
+               fill_cplbtab(t, a_start,
+                               a_end, SIZE_4M,
+                               cplb_data[i].d_conf);
+               fill_cplbtab(t, a_end,
+                               cplb_data[i].end,
+                               SIZE_1M,
+                               cplb_data[i].d_conf);
+       }
+}
 static void __init generate_cpl_tables(void)
 {
 
@@ -540,130 +600,78 @@ static void __init generate_cpl_tables(void)
                cplb_data[RES_MEM].i_conf = SDRAM_INON_CHBL;
 
        for (i = ZERO_P; i <= L2_MEM; i++) {
+               if (!cplb_data[i].valid)
+                       continue;
 
-               if (cplb_data[i].valid) {
+               as_1m = cplb_data[i].start % SIZE_1M;
 
-                       as_1m = cplb_data[i].start % SIZE_1M;
+               /*
+                * We need to make sure all sections are properly 1M aligned
+                * However between Kernel Memory and the Kernel mtd section,
+                * depending on the rootfs size, there can be overlapping
+                * memory areas.
+                */
 
-                       /* We need to make sure all sections are properly 1M aligned
-                        * However between Kernel Memory and the Kernel mtd section, depending on the
-                        * rootfs size, there can be overlapping memory areas.
-                        */
-
-                       if (as_1m &&  i!=L1I_MEM && i!=L1D_MEM) {
+               if (as_1m && i != L1I_MEM && i != L1D_MEM) {
 #ifdef CONFIG_MTD_UCLINUX
-                               if (i == SDRAM_RAM_MTD) {
-                                       if ((cplb_data[SDRAM_KERN].end + 1) > cplb_data[SDRAM_RAM_MTD].start)
-                                               cplb_data[SDRAM_RAM_MTD].start = (cplb_data[i].start & (-2*SIZE_1M)) + SIZE_1M;
-                                       else
-                                               cplb_data[SDRAM_RAM_MTD].start = (cplb_data[i].start & (-2*SIZE_1M));
-                               } else
+                       if (i == SDRAM_RAM_MTD) {
+                               if ((cplb_data[SDRAM_KERN].end + 1) >
+                                               cplb_data[SDRAM_RAM_MTD].start)
+                                       cplb_data[SDRAM_RAM_MTD].start =
+                                               (cplb_data[i].start &
+                                                (-2*SIZE_1M)) + SIZE_1M;
+                               else
+                                       cplb_data[SDRAM_RAM_MTD].start =
+                                               (cplb_data[i].start &
+                                                (-2*SIZE_1M));
+                       } else
 #endif
-                                       printk(KERN_WARNING "Unaligned Start of %s at 0x%X\n",
-                                              cplb_data[i].name, cplb_data[i].start);
-                       }
+                               printk(KERN_WARNING
+                                       "Unaligned Start of %s at 0x%X\n",
+                                       cplb_data[i].name, cplb_data[i].start);
+               }
 
-                       as = cplb_data[i].start % SIZE_4M;
-                       ae = cplb_data[i].end % SIZE_4M;
-
-                       if (as)
-                               a_start = cplb_data[i].start + (SIZE_4M - (as));
-                       else
-                               a_start = cplb_data[i].start;
-
-                       a_end = cplb_data[i].end - ae;
-
-                       for (j = INITIAL_T; j <= SWITCH_T; j++) {
-
-                               switch (j) {
-                               case INITIAL_T:
-                                       if (cplb_data[i].attr & INITIAL_T) {
-                                               t_i = &cplb.init_i;
-                                               t_d = &cplb.init_d;
-                                               process = 1;
-                                       } else
-                                               process = 0;
-                                       break;
-                               case SWITCH_T:
-                                       if (cplb_data[i].attr & SWITCH_T) {
-                                               t_i = &cplb.switch_i;
-                                               t_d = &cplb.switch_d;
-                                               process = 1;
-                                       } else
-                                               process = 0;
-                                       break;
-                               default:
-                                               process = 0;
-                                       break;
-                               }
+               as = cplb_data[i].start % SIZE_4M;
+               ae = cplb_data[i].end % SIZE_4M;
 
-       if (process) {
-                               if (cplb_data[i].attr & I_CPLB) {
-
-                                       if (cplb_data[i].psize) {
-                                               fill_cplbtab(t_i,
-                                                            cplb_data[i].start,
-                                                            cplb_data[i].end,
-                                                            cplb_data[i].psize,
-                                                            cplb_data[i].i_conf);
-                                       } else {
-                                               /*icplb_table */
-#if (defined(CONFIG_BLKFIN_CACHE) && defined(ANOMALY_05000263))
-                                               if (i == SDRAM_KERN) {
-                                                       fill_cplbtab(t_i,
-                                                                    cplb_data[i].start,
-                                                                    cplb_data[i].end,
-                                                                    SIZE_4M,
-                                                                    cplb_data[i].i_conf);
-                                               } else
-#endif
-                                               {
-                                                       fill_cplbtab(t_i,
-                                                                    cplb_data[i].start,
-                                                                    a_start,
-                                                                    SIZE_1M,
-                                                                    cplb_data[i].i_conf);
-                                                       fill_cplbtab(t_i,
-                                                                    a_start,
-                                                                    a_end,
-                                                                    SIZE_4M,
-                                                                    cplb_data[i].i_conf);
-                                                       fill_cplbtab(t_i, a_end,
-                                                                    cplb_data[i].end,
-                                                                    SIZE_1M,
-                                                                    cplb_data[i].i_conf);
-                                               }
-                                       }
+               if (as)
+                       a_start = cplb_data[i].start + (SIZE_4M - (as));
+               else
+                       a_start = cplb_data[i].start;
 
-                               }
-                               if (cplb_data[i].attr & D_CPLB) {
-
-                                       if (cplb_data[i].psize) {
-                                               fill_cplbtab(t_d,
-                                                            cplb_data[i].start,
-                                                            cplb_data[i].end,
-                                                            cplb_data[i].psize,
-                                                            cplb_data[i].d_conf);
-                                       } else {
-/*dcplb_table*/
-                                               fill_cplbtab(t_d,
-                                                            cplb_data[i].start,
-                                                            a_start, SIZE_1M,
-                                                            cplb_data[i].d_conf);
-                                               fill_cplbtab(t_d, a_start,
-                                                            a_end, SIZE_4M,
-                                                            cplb_data[i].d_conf);
-                                               fill_cplbtab(t_d, a_end,
-                                                            cplb_data[i].end,
-                                                            SIZE_1M,
-                                                            cplb_data[i].d_conf);
+               a_end = cplb_data[i].end - ae;
 
-                                       }
+               for (j = INITIAL_T; j <= SWITCH_T; j++) {
 
-                               }
-                       }
+                       switch (j) {
+                       case INITIAL_T:
+                               if (cplb_data[i].attr & INITIAL_T) {
+                                       t_i = &cplb.init_i;
+                                       t_d = &cplb.init_d;
+                                       process = 1;
+                               } else
+                                       process = 0;
+                               break;
+                       case SWITCH_T:
+                               if (cplb_data[i].attr & SWITCH_T) {
+                                       t_i = &cplb.switch_i;
+                                       t_d = &cplb.switch_d;
+                                       process = 1;
+                               } else
+                                       process = 0;
+                               break;
+                       default:
+                                       process = 0;
+                               break;
                        }
 
+                       if (!process)
+                               continue;
+                       if (cplb_data[i].attr & I_CPLB)
+                               __fill_code_cplbtab(t_i, i, a_start, a_end);
+
+                       if (cplb_data[i].attr & D_CPLB)
+                               __fill_data_cplbtab(t_d, i, a_start, a_end);
                }
        }
 
@@ -681,7 +689,7 @@ static void __init generate_cpl_tables(void)
 
 #endif
 
-static inline u_long get_vco(void)
+static u_long get_vco(void)
 {
        u_long msel;
        u_long vco;
@@ -889,8 +897,8 @@ struct seq_operations cpuinfo_op = {
        .show = show_cpuinfo,
 };
 
-void cmdline_init(unsigned long r0)
+void __init cmdline_init(const char *r0)
 {
        if (r0)
-               strncpy(command_line, (char *)r0, COMMAND_LINE_SIZE);
+               strncpy(command_line, r0, COMMAND_LINE_SIZE);
 }
index 9932edee8cb48c4982c14c12411c37bbf84afad4..5ab87b0b92ddf7e4300c185b54d67373f3b71e84 100644 (file)
@@ -557,7 +557,7 @@ void dump_bfin_regs(struct pt_regs *fp, void *retaddr)
                                break;
 #ifndef CONFIG_DEBUG_HWERR
                        /* If one of the last few instructions was a STI
-                        * it is likily that the error occured awhile ago
+                        * it is likely that the error occured awhile ago
                         * and we just noticed
                         */
                        if (x >= 0x0040 && x <= 0x0047 && i <= 0)
index 86fe67995802e08e3ffe50352d65620c14ac0fc1..1ef1e36b3957d95690efddea5416d52c58755975 100644 (file)
@@ -7,7 +7,7 @@
  * Description:  Master linker script for blackfin architecture
  *
  * Modified:
- *               Copyright 2004-2006 Analog Devices Inc.
+ *               Copyright 2004-2007 Analog Devices Inc.
  *
  * Bugs:         Enter bugs at http://blackfin.uclinux.org/
  *
 #include <asm-generic/vmlinux.lds.h>
 #include <asm/mem_map.h>
 
-
 OUTPUT_FORMAT("elf32-bfin")
 ENTRY(__start)
 _jiffies = _jiffies_64;
 
-MEMORY
-{
-       ram         : ORIGIN = CONFIG_BOOT_LOAD, LENGTH = (CONFIG_MEM_SIZE * 1024 * 1024) - (CONFIG_BOOT_LOAD)
-       l1_data_a   : ORIGIN = L1_DATA_A_START,  LENGTH = L1_DATA_A_LENGTH
-       l1_data_b   : ORIGIN = L1_DATA_B_START,  LENGTH = L1_DATA_B_LENGTH
-       l1_code     : ORIGIN = L1_CODE_START,    LENGTH = L1_CODE_LENGTH
-       l1_scratch  : ORIGIN = L1_SCRATCH_START, LENGTH = L1_SCRATCH_LENGTH
-}
-
 SECTIONS
 {
        . = CONFIG_BOOT_LOAD;
-
        .text :
        {
-                _text = .;
-                __stext = .;
+               __text = .;
+               _text = .;
+               __stext = .;
                TEXT_TEXT
                SCHED_TEXT
+               LOCK_TEXT
                *(.text.lock)
+               *(.fixup)
+
                . = ALIGN(16);
-                 ___start___ex_table = .;
+               ___start___ex_table = .;
                *(__ex_table)
-                ___stop___ex_table = .;
-
-               *($code)
-               *(.rodata)
-               *(.rodata.*)
-               *(__vermagic)           /* Kernel version magic */
-               *(.rodata1)
-               *(.fixup)
-               *(.spinlock.text)
+               ___stop___ex_table = .;
 
-               /* Kernel symbol table: Normal symbols */
                . = ALIGN(4);
-               ___start___ksymtab = .;
-               *(__ksymtab)
-               ___stop___ksymtab = .;
-
-               /* Kernel symbol table: GPL-only symbols */
-               ___start___ksymtab_gpl = .;
-               *(__ksymtab_gpl)
-               ___stop___ksymtab_gpl = .;
-
-               /* Kernel symbol table: Normal unused symbols */                \
-               ___start___ksymtab_unused = .;
-               *(__ksymtab_unused)
-               ___stop___ksymtab_unused = .;
-
-               /* Kernel symbol table: GPL-only unused symbols */
-               ___start___ksymtab_unused_gpl = .;
-               *(__ksymtab_unused_gpl)
-               ___stop___ksymtab_unused_gpl = .;
-
-
-               /* Kernel symbol table: GPL-future symbols */
-               ___start___ksymtab_gpl_future = .;
-               *(__ksymtab_gpl_future)
-               ___stop___ksymtab_gpl_future = .;
-
-               /* Kernel symbol table: Normal symbols */
-               ___start___kcrctab = .;
-               *(__kcrctab)
-               ___stop___kcrctab = .;
-
-               /* Kernel symbol table: GPL-only symbols */
-               ___start___kcrctab_gpl = .;
-               *(__kcrctab_gpl)
-               ___stop___kcrctab_gpl = .;
-
-               /* Kernel symbol table: GPL-future symbols */
-               ___start___kcrctab_gpl_future = .;
-               *(__kcrctab_gpl_future)
-               ___stop___kcrctab_gpl_future = .;
-
-               /* Kernel symbol table: strings */
-               *(__ksymtab_strings)
-
-                . = ALIGN(4);
                __etext = .;
-       } > ram
+       }
+
+       RODATA
+
+       .data :
+       {
+               __sdata = .;
+               . = ALIGN(0x2000);
+               *(.data.init_task)
+               DATA_DATA
+               CONSTRUCTORS
+
+               . = ALIGN(32);
+               *(.data.cacheline_aligned)
+
+               . = ALIGN(0x2000);
+               __edata = .;
+       }
 
+       ___init_begin = .;
        .init :
        {
                . = ALIGN(4096);
-               ___init_begin = .;
                __sinittext = .;
                *(.init.text)
                __einittext = .;
@@ -148,39 +105,39 @@ SECTIONS
                *(.init.ramfs)
                ___initramfs_end = .;
                . = ALIGN(4);
-               ___init_end = .;
-       } > ram
+       }
 
-        __l1_lma_start = .;
+       __l1_lma_start = .;
 
-       .text_l1 :
+       .text_l1 L1_CODE_START : AT(LOADADDR(.init) + SIZEOF(.init))
        {
                . = ALIGN(4);
-                __stext_l1 = .;
+               __stext_l1 = .;
                *(.l1.text)
 
                . = ALIGN(4);
-                __etext_l1 = .;
-       } > l1_code AT > ram
+               __etext_l1 = .;
+       }
 
-       .data_l1 :
+       .data_l1 L1_DATA_A_START : AT(LOADADDR(.text_l1) + SIZEOF(.text_l1))
        {
                . = ALIGN(4);
-                __sdata_l1 = .;
+               __sdata_l1 = .;
                *(.l1.data)
-                __edata_l1 = .;
+               __edata_l1 = .;
 
                . = ALIGN(4);
-                __sbss_l1 = .;
+               __sbss_l1 = .;
                *(.l1.bss)
 
                . = ALIGN(32);
                *(.data_l1.cacheline_aligned)
 
                . = ALIGN(4);
-                __ebss_l1 = .;
-       } > l1_data_a AT > ram
-       .data_b_l1 :
+               __ebss_l1 = .;
+       }
+
+       .data_b_l1 L1_DATA_B_START : AT(LOADADDR(.data_l1) + SIZEOF(.data_l1))
        {
                . = ALIGN(4);
                __sdata_b_l1 = .;
@@ -193,36 +150,25 @@ SECTIONS
 
                . = ALIGN(4);
                __ebss_b_l1 = .;
-       } > l1_data_b AT > ram
+       }
 
-       .data :
-       {
-                __sdata = .;
-               . = ALIGN(0x2000);
-               *(.data.init_task)
-               DATA_DATA
+       ___init_end = LOADADDR(.data_b_l1) + SIZEOF(.data_b_l1);
 
-               . = ALIGN(32);
-               *(.data.cacheline_aligned)
-
-               . = ALIGN(0x2000);
-               __edata = .;
-       } > ram
-
-       /DISCARD/ : {                   /* Exit code and data*/
-               *(.exit.text)
-               *(.exit.data)
-               *(.exitcall.exit)
-       } > ram
-
-       .bss :
+       .bss LOADADDR(.data_b_l1) + SIZEOF(.data_b_l1) :
        {
                . = ALIGN(4);
-                ___bss_start = .;
+               ___bss_start = .;
                *(.bss)
                *(COMMON)
                . = ALIGN(4);
-                ___bss_stop = .;
-                __end = .      ;
-       } > ram
+               ___bss_stop = .;
+               __end = .;
+       }
+
+       /DISCARD/ :
+       {
+               *(.exit.text)
+               *(.exit.data)
+               *(.exitcall.exit)
+       }
 }
index 3e29861852b22ba9e6e172d408a421721277fb7d..2ac59c70dd94276bc7c769146bf763f6f4b3ba4e 100644 (file)
@@ -44,6 +44,7 @@
  */
 
 .global   ___divsi3;
+.type ___divsi3, STT_FUNC;
 
 #ifdef CONFIG_ARITHMETIC_OPS_L1
 .section .l1.text
@@ -214,3 +215,5 @@ ___divsi3 :
 .Lret_zero:
   R0 = 0;
   RTS;
+
+.size ___divsi3, .-___divsi3
index 7d5e9846311d717e46d8e082af7845796c9dcb8b..a17cc77ac36f2faefcf9ffa8d214691aa7682f2d 100644 (file)
@@ -46,7 +46,7 @@ ENTRY(_insl)
 .Llong_loop_e:         NOP;
        sti R3;
        RTS;
-
+ENDPROC(_insl)
 
 ENTRY(_insw)
        P0 = R0;        /* P0 = port */
@@ -61,6 +61,7 @@ ENTRY(_insw)
 .Lword_loop_e:         NOP;
        sti R3;
        RTS;
+ENDPROC(_insw)
 
 ENTRY(_insb)
        P0 = R0;        /* P0 = port */
@@ -75,3 +76,4 @@ ENTRY(_insb)
 .Lbyte_loop_e:  NOP;
        sti R3;
        RTS;
+ENDPROC(_insb)
index 498122250d0768091bbc5c20dd0c93cc050e4999..5da428134d32b9f75cad800f42c8bf332ad9f908 100644 (file)
@@ -67,4 +67,4 @@ ENTRY(_memchr)
        R0 += -1;
        RTS;
 
-.size _memchr,.-_memchr
+ENDPROC(_memchr)
index 5b9502368fc6ab0634428c0d9245a6056e4841be..a6b8ee6a6bf2cb959b68ddf2f8a5c9ddd1d36204 100644 (file)
@@ -107,4 +107,4 @@ ENTRY(_memcmp)
        P3 = I1;
        RTS;
 
-.size _memcmp,.-_memcmp
+ENDPROC(_memcmp)
index c1e00eff541c2d35c69fe88880218fa64cdf90c7..34b5a91c215c28c3bd8315b0a77ec3d180d0ee1d 100644 (file)
@@ -140,3 +140,5 @@ ENTRY(_memcpy)
        B[P0--] = R1;
 
        RTS;
+
+ENDPROC(_memcpy)
index 2e5fb7f8df13204e74a4a72d844543b0e6a98720..c371585e9dbd93eb70699abe45dc2d0d634eab84 100644 (file)
@@ -100,4 +100,4 @@ ENTRY(_memmove)
        P3 = I1;
        RTS;
 
-.size _memmove,.-_memmove
+ENDPROC(_memmove)
index ba6d047568ddd50771018c83f37315fe417ef8fb..8159136a29ea2e355ee183d189607d232d14aac2 100644 (file)
@@ -106,4 +106,4 @@ ENTRY(_memset)
        B[P0++] = R1;
        JUMP .Laligned;
 
-.size _memset,.-_memset
+ENDPROC(_memset)
index 528b8b1ccb34db77eb4b1da3dcc1bb43c6ff1557..ca1dd3973b3958424a6148db94217a1622eed291 100644 (file)
@@ -77,3 +77,5 @@ ___modsi3:
        R0 = 0;
 .LRETURN_R0:
        RTS;
+
+.size ___modsi3, .-___modsi3
index f8c876fe8930b7dccf1be5653090a70c271857fc..4c3da8ae094ece20119b6181a9b5991b968ad144 100644 (file)
@@ -40,6 +40,7 @@ ENTRY(_outsl)
 .Llong_loop_s: R0 = [P1++];
 .Llong_loop_e: [P0] = R0;
        RTS;
+ENDPROC(_outsl)
 
 ENTRY(_outsw)
        P0 = R0;        /* P0 = port */
@@ -50,6 +51,7 @@ ENTRY(_outsw)
 .Lword_loop_s: R0 = W[P1++];
 .Lword_loop_e: W[P0] = R0;
        RTS;
+ENDPROC(_outsw)
 
 ENTRY(_outsb)
        P0 = R0;        /* P0 = port */
@@ -60,3 +62,4 @@ ENTRY(_outsb)
 .Lbyte_loop_s: R0 = B[P1++];
 .Lbyte_loop_e: B[P0] = R0;
        RTS;
+ENDPROC(_outsb)
index 10b8f8da576f6cc6c3c079e37d8c3e861e27d60c..e383cd3eca5d9c428e605b144290b4477b57bba3 100644 (file)
@@ -28,3 +28,5 @@ ___smulsi3_highpart:
 
        R0 = R0 + R1;
        RTS;
+
+.size ___smulsi3_highpart, .-___smulsi3_highpart
index d39a129162591748dfaaa9f0b0bb5b2bc6eedb56..58fd96d747665fd8a2f3c8568de1af547c970213 100644 (file)
@@ -296,3 +296,5 @@ ENTRY(___udivsi3)
   R1 = R0 - R3;
   IF CC R0 = R1;
   RTS;
+
+ENDPROC(___udivsi3)
index b55ce96ab89f370d2cda493f21b1c7af81ab6522..4f2b76ee76265fc040dc2a51f8792f3933190ba9 100644 (file)
@@ -34,7 +34,9 @@
 #endif
 
 .extern ___udivsi3;
+.type ___udivsi3, STT_FUNC;
 .globl ___umodsi3
+.type ___umodsi3, STT_FUNC;
 ___umodsi3:
 
        CC=R0==0;
@@ -64,3 +66,5 @@ ___umodsi3:
        R0 = 0;
 .LRETURN_R0:
        RTS;
+
+.size ___umodsi3, .-___umodsi3
index aac8218fb25800e3c292a4b9c2c4914025565a7f..67b799351e3e845ba9da8ff0100d9f5e3d2010e3 100644 (file)
@@ -21,3 +21,5 @@ ___umulsi3_highpart:
        R1 = PACK(R1.l,R0.h);
        R0 = R1 + R2;
        RTS;
+
+.size ___umulsi3_highpart, .-___umulsi3_highpart
index 23a7f607df3fbda30a9e4b4e5edfd2dbe766eb4e..edd31ce4f8d2d62fccad4aede373b70c4fafc6fa 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * File:         arch/blackfin/mach-bf533/boards/cm_bf533.c
  * Based on:     arch/blackfin/mach-bf533/boards/ezkit.c
- * Author:       Aidan Williams <aidan@nicta.com.au> Copright 2005
+ * Author:       Aidan Williams <aidan@nicta.com.au> Copyright 2005
  *
  * Created:      2005
  * Description:  Board description file
index 747298ea907bc017f4e2486ab1a0eeda44790942..0b522d95160d4d189d19e2146ac1f3933b9b0649 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * File:         arch/blackfin/mach-bf533/ezkit.c
- * Based on:     Orginal Work
+ * Based on:     Original Work
  * Author:       Aidan Williams <aidan@nicta.com.au>
  *
  * Created:      2005
index 4db9e62409064268f7e3f9fa0a96684ff852cd95..7e2aa8d0f44f624c35df56197fb2943812bdb113 100644 (file)
@@ -28,6 +28,7 @@
  */
 
 #include <linux/linkage.h>
+#include <linux/init.h>
 #include <asm/blackfin.h>
 #if CONFIG_BFIN_KERNEL_CLOCK
 #include <asm/mach/mem_init.h>
 
 #define INITIAL_STACK  0xFFB01000
 
-.text
+__INIT
 
 ENTRY(__start)
-ENTRY(__stext)
        /* R0: argument of command line string, passed from uboot, save it */
        R7 = R0;
-       /* Set the SYSCFG register */
+       /* Set the SYSCFG register:
+        * Enable Cycle Counter and Nesting Of Interrupts (3rd Bit)
+        */
        R0 = 0x36;
-       /*Enable Cycle Counter and Nesting Of Interrupts(3rd Bit)*/
        SYSCFG = R0;
        R0 = 0;
 
-       /*Clear Out All the data and pointer  Registers*/
+       /* Clear Out All the data and pointer Registers */
        R1 = R0;
        R2 = R0;
        R3 = R0;
@@ -79,7 +80,7 @@ ENTRY(__stext)
        L2 = r0;
        L3 = r0;
 
-       /* Clear Out All the DAG Registers*/
+       /* Clear Out All the DAG Registers */
        B0 = r0;
        B1 = r0;
        B2 = r0;
@@ -265,6 +266,7 @@ ENTRY(__stext)
 
 .LWAIT_HERE:
        jump .LWAIT_HERE;
+ENDPROC(__start)
 
 ENTRY(_real_start)
        [ -- sp ] = reti;
@@ -303,7 +305,7 @@ ENTRY(_real_start)
 .L_clear_zero:
        W[p1++] = r0;
 
-/* pass the uboot arguments to the global value command line */
+       /* pass the uboot arguments to the global value command line */
        R0 = R7;
        call _cmdline_init;
 
@@ -322,7 +324,7 @@ ENTRY(_real_start)
        [p1] = r1;
 
        /*
-        *  load the current thread pointer and stack
+        * load the current thread pointer and stack
         */
        r1.l = _init_thread_union;
        r1.h = _init_thread_union;
@@ -333,9 +335,10 @@ ENTRY(_real_start)
        sp = r1;
        usp = sp;
        fp = sp;
-       call _start_kernel;
-.L_exit:
-       jump.s  .L_exit;
+       jump.l _start_kernel;
+ENDPROC(_real_start)
+
+__FINIT
 
 .section .l1.text
 #if CONFIG_BFIN_KERNEL_CLOCK
@@ -439,12 +442,13 @@ ENTRY(_start_dma_code)
 
        p0.h = hi(SIC_IWR);
        p0.l = lo(SIC_IWR);
-       r0.l = lo(IWR_ENABLE_ALL)
-       r0.h = hi(IWR_ENABLE_ALL)
+       r0.l = lo(IWR_ENABLE_ALL);
+       r0.h = hi(IWR_ENABLE_ALL);
        [p0] = r0;
        SSYNC;
 
        RTS;
+ENDPROC(_start_dma_code)
 #endif /* CONFIG_BFIN_KERNEL_CLOCK */
 
 ENTRY(_bfin_reset)
index 36a69334520485c991365f050dee242c6ca080b9..a3e1789167beec2c60ad1d17f19b6a2c393480a1 100644 (file)
@@ -4,7 +4,7 @@
  * Author:       Michael Hennerich
  *
  * Created:      ?
- * Description:  Set up the interupt priorities
+ * Description:  Set up the interrupt priorities
  *
  * Modified:
  *               Copyright 2004-2006 Analog Devices Inc.
index 9019c0edbe7ca1893cd3a4ea5bcc014e81310f18..fd57e7439e0fa7347429e12906fc5a96c6cf6ba0 100644 (file)
@@ -55,7 +55,7 @@ static struct resource bfin_pcmcia_cf_resources[] = {
                .end = 0x20312000,
                .flags = IORESOURCE_MEM,
        },{
-               .start = 0x20311000, /* Attribute Memeory */
+               .start = 0x20311000, /* Attribute Memory */
                .end = 0x20311FFF,
                .flags = IORESOURCE_MEM,
        },{
index 40d3a1b70ee747c75d9019c8f3ac40fa9f15e66f..8aaf76dfce80831b0f5d71aa5d8ad1b8c672be9c 100644 (file)
@@ -59,7 +59,7 @@ static struct resource bfin_pcmcia_cf_resources[] = {
                .end = 0x20312000,
                .flags = IORESOURCE_MEM,
        },{
-               .start = 0x20311000, /* Attribute Memeory */
+               .start = 0x20311000, /* Attribute Memory */
                .end = 0x20311FFF,
                .flags = IORESOURCE_MEM,
        },{
index ba2f875a7f7dac2e385043399c5104b59bde8e39..3a29b4d15f252b79b329ee92bcceeaa2bd3abaae 100644 (file)
@@ -108,7 +108,7 @@ static struct resource bfin_pcmcia_cf_resources[] = {
                .end = 0x20312000,
                .flags = IORESOURCE_MEM,
        },{
-               .start = 0x20311000, /* Attribute Memeory */
+               .start = 0x20311000, /* Attribute Memory */
                .end = 0x20311FFF,
                .flags = IORESOURCE_MEM,
        },{
index 2c2652bee7e51a918beb4c3cae38a0c181e1ee13..7d902bbd860fa652ce26722a899d5d277b86ac0c 100644 (file)
@@ -28,6 +28,7 @@
  */
 
 #include <linux/linkage.h>
+#include <linux/init.h>
 #include <asm/blackfin.h>
 #if CONFIG_BFIN_KERNEL_CLOCK
 #include <asm/mach/mem_init.h>
 .extern ___bss_start
 .extern _bf53x_relocate_l1_mem
 
-#define INITIAL_STACK   0xFFB01000
+#define INITIAL_STACK  0xFFB01000
 
-.text
+__INIT
 
 ENTRY(__start)
-ENTRY(__stext)
        /* R0: argument of command line string, passed from uboot, save it */
        R7 = R0;
-       /* Set the SYSCFG register */
+       /* Set the SYSCFG register:
+        * Enable Cycle Counter and Nesting Of Interrupts (3rd Bit)
+        */
        R0 = 0x36;
-       SYSCFG = R0;   /*Enable Cycle Counter and Nesting Of Interrupts(3rd Bit)*/
+       SYSCFG = R0;
        R0 = 0;
 
-       /* Clear Out All the data and pointer  Registers*/
+       /* Clear Out All the data and pointer Registers */
        R1 = R0;
        R2 = R0;
        R3 = R0;
@@ -75,7 +77,7 @@ ENTRY(__stext)
        L2 = r0;
        L3 = r0;
 
-       /* Clear Out All the DAG Registers*/
+       /* Clear Out All the DAG Registers */
        B0 = r0;
        B1 = r0;
        B2 = r0;
@@ -191,7 +193,7 @@ ENTRY(__stext)
 
        p0.h = hi(UART_DLL);
        p0.l = lo(UART_DLL);
-       r0 = 0x00(Z);
+       r0 = 0x0(Z);
        w[p0] = r0.L;
        ssync;
 
@@ -218,6 +220,7 @@ ENTRY(__stext)
 #if CONFIG_BFIN_KERNEL_CLOCK
        call _start_dma_code;
 #endif
+
        /* Code for initializing Async memory banks */
 
        p2.h = hi(EBIU_AMBCTL1);
@@ -272,6 +275,7 @@ ENTRY(__stext)
 
 .LWAIT_HERE:
        jump .LWAIT_HERE;
+ENDPROC(__start)
 
 ENTRY(_real_start)
        [ -- sp ] = reti;
@@ -291,7 +295,7 @@ ENTRY(_real_start)
        p2.h = ___bss_stop;
        r0 = 0;
        p2 -= p1;
-       lsetup (.L_clear_bss, .L_clear_bss ) lc0 = p2;
+       lsetup (.L_clear_bss, .L_clear_bss) lc0 = p2;
 .L_clear_bss:
        B[p1++] = r0;
 
@@ -306,7 +310,7 @@ ENTRY(_real_start)
        r0 = r0 >> 1;
        p2 = r0;
        r0 = 0;
-       lsetup (.L_clear_zero, .L_clear_zero ) lc0 = p2;
+       lsetup (.L_clear_zero, .L_clear_zero) lc0 = p2;
 .L_clear_zero:
        W[p1++] = r0;
 
@@ -328,9 +332,8 @@ ENTRY(_real_start)
        r1 = p3;
        [p1] = r1;
 
-
        /*
-        *  load the current thread pointer and stack
+        * load the current thread pointer and stack
         */
        r1.l = _init_thread_union;
        r1.h = _init_thread_union;
@@ -341,9 +344,10 @@ ENTRY(_real_start)
        sp = r1;
        usp = sp;
        fp = sp;
-       call _start_kernel;
-.L_exit:
-       jump.s  .L_exit;
+       jump.l _start_kernel;
+ENDPROC(_real_start)
+
+__FINIT
 
 .section .l1.text
 #if CONFIG_BFIN_KERNEL_CLOCK
@@ -462,6 +466,7 @@ ENTRY(_start_dma_code)
        SSYNC;
 
        RTS;
+ENDPROC(_start_dma_code)
 #endif /* CONFIG_BFIN_KERNEL_CLOCK */
 
 ENTRY(_bfin_reset)
index fd6308eccbe662cabf82ea28cd07d86f41cd4d71..2dbf3df465d193ba085f09504ac0b96aee9732a5 100644 (file)
@@ -4,7 +4,7 @@
  * Author:       Michael Hennerich
  *
  * Created:
- * Description:  Set up the interupt priorities
+ * Description:  Set up the interrupt priorities
  *
  * Modified:
  *               Copyright 2004-2006 Analog Devices Inc.
index 6824e956d1532843fc72872bc12a9e3be4d680a7..3dc5c042048cec307c4cb44bc81e09238b9a0108 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * File:         arch/blackfin/mach-bf533/boards/cm_bf561.c
  * Based on:     arch/blackfin/mach-bf533/boards/ezkit.c
- * Author:       Aidan Williams <aidan@nicta.com.au> Copright 2005
+ * Author:       Aidan Williams <aidan@nicta.com.au> Copyright 2005
  *
  * Created:      2006
  * Description:  Board description file
@@ -43,7 +43,7 @@
 char *bfin_board_name = "Bluetechnix CM BF561";
 
 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
-/* all SPI perpherals info goes here */
+/* all SPI peripherals info goes here */
 
 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
 static struct mtd_partition bfin_spi_flash_partitions[] = {
index ad9187a866a5acc18c1a8c2da5682802b801589d..31cbc75c85cfdac9507445bc873f0e158e6008a8 100644 (file)
@@ -28,6 +28,7 @@
  */
 
 #include <linux/linkage.h>
+#include <linux/init.h>
 #include <asm/blackfin.h>
 #if CONFIG_BFIN_KERNEL_CLOCK
 #include <asm/mach/mem_init.h>
 
 #define INITIAL_STACK  0xFFB01000
 
-.text
+__INIT
 
 ENTRY(__start)
-ENTRY(__stext)
-       /*  R0: argument of command line string, passed from uboot, save it */
+       /* R0: argument of command line string, passed from uboot, save it */
        R7 = R0;
-       /* Set the SYSCFG register */
+       /* Set the SYSCFG register:
+        * Enable Cycle Counter and Nesting Of Interrupts (3rd Bit)
+        */
        R0 = 0x36;
-       SYSCFG = R0; /*Enable Cycle Counter and Nesting Of Interrupts(3rd Bit)*/
+       SYSCFG = R0;
        R0 = 0;
 
-       /*Clear Out All the data and pointer  Registers*/
+       /* Clear Out All the data and pointer Registers */
        R1 = R0;
        R2 = R0;
        R3 = R0;
@@ -75,7 +77,7 @@ ENTRY(__stext)
        L2 = r0;
        L3 = r0;
 
-       /* Clear Out All the DAG Registers*/
+       /* Clear Out All the DAG Registers */
        B0 = r0;
        B1 = r0;
        B2 = r0;
@@ -219,6 +221,7 @@ ENTRY(__stext)
 
 .LWAIT_HERE:
        jump .LWAIT_HERE;
+ENDPROC(__start)
 
 ENTRY(_real_start)
        [ -- sp ] = reti;
@@ -238,7 +241,7 @@ ENTRY(_real_start)
        p2.h = ___bss_stop;
        r0 = 0;
        p2 -= p1;
-       lsetup (.L_clear_bss, .L_clear_bss ) lc0 = p2;
+       lsetup (.L_clear_bss, .L_clear_bss) lc0 = p2;
 .L_clear_bss:
        B[p1++] = r0;
 
@@ -253,11 +256,11 @@ ENTRY(_real_start)
        r0 = r0 >> 1;
        p2 = r0;
        r0 = 0;
-       lsetup (.L_clear_zero, .L_clear_zero ) lc0 = p2;
+       lsetup (.L_clear_zero, .L_clear_zero) lc0 = p2;
 .L_clear_zero:
        W[p1++] = r0;
 
-/* pass the uboot arguments to the global value command line */
+       /* pass the uboot arguments to the global value command line */
        R0 = R7;
        call _cmdline_init;
 
@@ -287,9 +290,10 @@ ENTRY(_real_start)
        sp = r1;
        usp = sp;
        fp = sp;
-       call _start_kernel;
-.L_exit:
-       jump.s  .L_exit;
+       jump.l _start_kernel;
+ENDPROC(_real_start)
+
+__FINIT
 
 .section .l1.text
 #if CONFIG_BFIN_KERNEL_CLOCK
@@ -350,7 +354,7 @@ ENTRY(_start_dma_code)
        if ! CC jump .Lcheck_again;
 
        /* Configure SCLK & CCLK Dividers */
-               r0 = (CONFIG_CCLK_ACT_DIV | CONFIG_SCLK_DIV);
+       r0 = (CONFIG_CCLK_ACT_DIV | CONFIG_SCLK_DIV);
        p0.h = hi(PLL_DIV);
        p0.l = lo(PLL_DIV);
        w[p0] = r0.l;
@@ -391,6 +395,7 @@ ENTRY(_start_dma_code)
        SSYNC;
 
        RTS;
+ENDPROC(_start_dma_code)
 #endif /* CONFIG_BFIN_KERNEL_CLOCK */
 
 ENTRY(_bfin_reset)
index 89c52ff95b27aaddc98c4b1c4e735ed65f457c4b..86e3b0ee93f426994498c330210e2232939b488a 100644 (file)
@@ -4,7 +4,7 @@
  * Author:       Michael Hennerich
  *
  * Created:
- * Description:  Set up the interupt priorities
+ * Description:  Set up the interrupt priorities
  *
  * Modified:
  *               Copyright 2004-2006 Analog Devices Inc.
index bb9446ef66efa71d60e329106b513ce4d436e58c..8bd2af1935bd022f0e251766df5f57616ef1298f 100644 (file)
@@ -70,6 +70,7 @@ ENTRY(_cache_invalidate)
 .Lno_dcache_b:
        R7 = [SP++];
        RTS;
+ENDPROC(_cache_invalidate)
 
 /* Invalidate the Entire Instruction cache by
  * disabling IMC bit
@@ -106,6 +107,8 @@ ENTRY(_invalidate_entire_icache)
 
        ( R7:5) = [SP++];
        RTS;
+ENDPROC(_invalidate_entire_icache)
+ENDPROC(_icache_invalidate)
 
 /*
  * blackfin_cache_flush_range(start, end)
@@ -129,6 +132,7 @@ ENTRY(_blackfin_icache_flush_range)
        IFLUSH [P0];
        SSYNC;
        RTS;
+ENDPROC(_blackfin_icache_flush_range)
 
 /*
  * blackfin_icache_dcache_flush_range(start, end)
@@ -155,6 +159,7 @@ ENTRY(_blackfin_icache_dcache_flush_range)
        FLUSH [P0];
        SSYNC;
        RTS;
+ENDPROC(_blackfin_icache_dcache_flush_range)
 
 /* Throw away all D-cached data in specified region without any obligation to
  * write them back. However, we must clean the D-cached entries around the
@@ -183,6 +188,7 @@ ENTRY(_blackfin_dcache_invalidate_range)
        FLUSHINV[P0];
        SSYNC;
        RTS;
+ENDPROC(_blackfin_dcache_invalidate_range)
 
 /* Invalidate the Entire Data cache by
  * clearing DMC[1:0] bits
@@ -221,6 +227,8 @@ ENTRY(_dcache_invalidate)
 
        ( R7:6) = [SP++];
        RTS;
+ENDPROC(_dcache_invalidate)
+ENDPROC(_invalidate_entire_dcache)
 
 ENTRY(_blackfin_dcache_flush_range)
        R2 = -L1_CACHE_BYTES;
@@ -241,6 +249,7 @@ ENTRY(_blackfin_dcache_flush_range)
        FLUSH[P0];
        SSYNC;
        RTS;
+ENDPROC(_blackfin_dcache_flush_range)
 
 ENTRY(_blackfin_dflush_page)
        P1 = 1 << (PAGE_SHIFT - L1_CACHE_SHIFT);
@@ -251,3 +260,4 @@ ENTRY(_blackfin_dflush_page)
 .Lfl1: FLUSH [P0++];
        SSYNC;
        RTS;
+ENDPROC(_blackfin_dflush_page)
index 8c17f099e5ebc11cbe080ba208d00a2834429b7a..7924a90d9658ef900d04aa390ec9f13a514b68fb 100644 (file)
@@ -86,6 +86,8 @@ ENTRY(_bfin_icache_init)
        SSYNC;
        STI R2;
        RTS;
+
+ENDPROC(_bfin_icache_init)
 #endif
 
 #if defined(CONFIG_BLKFIN_DCACHE)
@@ -134,4 +136,6 @@ ENTRY(_bfin_dcache_init)
        SSYNC;
        STI R2;
        RTS;
+
+ENDPROC(_bfin_dcache_init)
 #endif
index b979067c49ef90f7e6283cd06dcbdfe276584c9c..2f3c72c239977e77f6b8cc5e60a2c453dfa3cec5 100644 (file)
@@ -42,8 +42,6 @@
 
 .align 2
 
-.global __cplb_hdr;
-.type __cplb_hdr, STT_FUNC;
 ENTRY(__cplb_hdr)
        R2 = SEQSTAT;
 
@@ -128,3 +126,5 @@ ENTRY(__cplb_hdr)
        call _panic_cplb_error;
        SP += 12;
        JUMP _handle_bad_cplb;
+
+ENDPROC(__cplb_hdr)
index d65fac39d1bfcc41169d4cb08c95444c4f769598..caa9623e6bd6d578903e8411f6c607dcd8789779 100644 (file)
@@ -82,7 +82,7 @@ static char *cplb_print_entry(char *buf, int type)
        int entry = 0, used_cplb = 0;
 
        if (type == CPLB_I) {
-               buf += sprintf(buf, "Instrction CPLB entry:\n");
+               buf += sprintf(buf, "Instruction CPLB entry:\n");
                p_addr = ipdt_table;
                p_data = ipdt_table + 1;
                p_icount = ipdt_swapcount_table;
index f5efc4bc65e67cd6c009a10d03bf5b8dca4f6bb9..e4b47e09cf1311b0123450027ba7a08570cabc8b 100644 (file)
@@ -592,6 +592,7 @@ ENTRY(_cplb_mgr)
        ( R7:4,P5:3 ) = [SP++];
        R0 = CPLB_RELOADED;
        RTS;
+ENDPROC(_cplb_mgr)
 
 .data
 .align 4;
index 7d0368772cdaeccef29ac1af645e4d701fe74f2c..40045b1386ad888d608fd80d02de1dbb5341ecd8 100644 (file)
@@ -103,6 +103,7 @@ ENTRY(_ex_dcplb)
        if !cc jump _return_from_exception;
        /* fall through */
 #endif
+ENDPROC(_ex_dcplb)
 
 ENTRY(_ex_icplb)
        (R7:6,P5:4) = [sp++];
@@ -113,6 +114,7 @@ ENTRY(_ex_icplb)
        RESTORE_ALL_SYS
        SP = RETN;
        rtx;
+ENDPROC(_ex_icplb)
 
 ENTRY(_ex_spinlock)
        /* Transform this into a syscall - twiddle the syscall vector.  */
@@ -123,6 +125,7 @@ ENTRY(_ex_spinlock)
        [p5] = r7;
        csync;
        /* Fall through.  */
+ENDPROC(_ex_spinlock)
 
 ENTRY(_ex_syscall)
        DEBUG_START_HWTRACE
@@ -131,6 +134,7 @@ ENTRY(_ex_syscall)
        raise 15;               /* invoked by TRAP #0, for sys call */
        sp = retn;
        rtx
+ENDPROC(_ex_syscall)
 
 ENTRY(_spinlock_bh)
        SAVE_ALL_SYS
@@ -150,12 +154,14 @@ ENTRY(_spinlock_bh)
        [SP + PT_R0] = R0;
        RESTORE_ALL_SYS
        rti;
+ENDPROC(_spinlock_bh)
 
 ENTRY(_ex_soft_bp)
        r7 = retx;
        r7 += -2;
        retx = r7;
        jump.s _ex_trap_c;
+ENDPROC(_ex_soft_bp)
 
 ENTRY(_ex_single_step)
        r7 = retx;
@@ -191,6 +197,7 @@ _return_from_exception:
        ASTAT = [sp++];
        sp = retn;
        rtx;
+ENDPROC(_ex_soft_bp)
 
 ENTRY(_handle_bad_cplb)
        /* To get here, we just tried and failed to change a CPLB
@@ -250,6 +257,7 @@ ENTRY(_ex_trap_c)
        SP = RETN;
        raise 5;
        rtx;
+ENDPROC(_ex_trap_c)
 
 ENTRY(_exception_to_level5)
        SAVE_ALL_SYS
@@ -314,6 +322,7 @@ ENTRY(_exception_to_level5)
        call _ret_from_exception;
        RESTORE_ALL_SYS
        rti;
+ENDPROC(_exception_to_level5)
 
 ENTRY(_trap) /* Exception: 4th entry into system event table(supervisor mode)*/
        /* Since the kernel stack can be anywhere, it's not guaranteed to be
@@ -342,6 +351,7 @@ ENTRY(_trap) /* Exception: 4th entry into system event table(supervisor mode)*/
        r7 = -ENOSYS;           /* signextending enough */
        [sp + PT_R0] = r7;      /* return value from system call */
        jump .Lsyscall_really_exit;
+ENDPROC(_trap)
 
 ENTRY(_kernel_execve)
        link SIZEOF_PTREGS;
@@ -396,6 +406,7 @@ ENTRY(_kernel_execve)
 1:
        unlink;
        rts;
+ENDPROC(_kernel_execve)
 
 ENTRY(_system_call)
        /* Store IPEND */
@@ -503,6 +514,7 @@ ENTRY(_system_call)
        r5 = [sp + PT_RESERVED];
        rets = r5;
        rts;
+ENDPROC(_system_call)
 
 _sys_trace:
        call _syscall_trace;
@@ -531,6 +543,7 @@ _sys_trace:
 
        call _syscall_trace;
        jump .Lresume_userspace;
+ENDPROC(_sys_trace)
 
 ENTRY(_resume)
        /*
@@ -580,6 +593,7 @@ _new_old_task:
         * in "new" task.
         */
        rts;
+ENDPROC(_resume)
 
 ENTRY(_ret_from_exception)
        p2.l = lo(IPEND);
@@ -638,6 +652,7 @@ ENTRY(_ret_from_exception)
        syscfg = r0;
 5:
        rts;
+ENDPROC(_ret_from_exception)
 
 ENTRY(_return_from_int)
        /* If someone else already raised IRQ 15, do nothing.  */
@@ -680,6 +695,7 @@ ENTRY(_return_from_int)
        rti;
 2:
        rts;
+ENDPROC(_return_from_int)
 
 ENTRY(_lower_to_irq14)
 #if defined(ANOMALY_05000281)
@@ -745,6 +761,7 @@ _schedule_and_signal:
 1:
        RESTORE_CONTEXT
        rti;
+ENDPROC(_lower_to_irq14)
 
 /* Make sure when we start, that the circular buffer is initialized properly
  * R0 and P0 are call clobbered, so we can use them here.
@@ -758,6 +775,7 @@ ENTRY(_init_exception_buff)
        p0.l = _out_ptr_excause;
        [p0] = r0;
        rts;
+ENDPROC(_init_exception_buff)
 
 /*
  * Put these in the kernel data section - that should always be covered by
index dd45664f0d029055328adacaf8e8d367d6254bb9..b69f517a650b839f43e1768dc8242ede9d7611f3 100644 (file)
@@ -66,6 +66,7 @@ ENTRY(_evt_emulation)
        SP += 12;
        /* - GDB stub fills this in by itself (if defined) */
        rte;
+ENDPROC(_evt_emulation)
 #endif
 
 /* Common interrupt entry code.         First we do CLI, then push
@@ -251,3 +252,4 @@ ENTRY(_evt_system_call)
 #endif
        call _system_call;
        jump .Lcommon_restore_context;
+ENDPROC(_evt_system_call)
index f3cf07036c2a2af978bb42e2721a42167dc8b76b..80943bbd37c202f8d1a58b8a6d5f3bdc15074ab3 100644 (file)
@@ -4,7 +4,7 @@
  * Author:
  *
  * Created:      ?
- * Description:  Set up the interupt priorities
+ * Description:  Set up the interrupt priorities
  *
  * Modified:
  *               1996 Roman Zippel
index 34b62288ec3cb09e68dea834496cbcd8ff43cdd7..2cfc7d5aec5cafba6846f4a4cc9bb489e726fe7e 100644 (file)
@@ -4,7 +4,7 @@
  * Author:
  *
  * Created:      ?
- * Description:  Set up the interupt priorities
+ * Description:  Set up the interrupt priorities
  *
  * Modified:
  *               1996 Roman Zippel
index 2cbb15b339254dbb46e865fa1da44214fea238a1..386ac8dda076c831d2a1d6a5489dece44db9ff49 100644 (file)
@@ -155,6 +155,7 @@ ENTRY(_cache_grab_lock)
        ( R7:0,P5:0 ) = [SP++];
 
        RTS;
+ENDPROC(_cache_grab_lock)
 
 /* After the execution of critical code, the code is now locked into
  * the cache way. Now we need to set ILOC.
@@ -186,6 +187,7 @@ ENTRY(_cache_lock)
 
        ( R7:0,P5:0 ) = [SP++];
        RTS;
+ENDPROC(_cache_lock)
 
 #endif /* BLKFIN_CACHE_LOCK */
 
@@ -193,7 +195,6 @@ ENTRY(_cache_lock)
  */
 
 ENTRY(_read_iloc)
-
        P1.H = (IMEM_CONTROL >> 16);
        P1.L = (IMEM_CONTROL & 0xFFFF);
        R1 = 0xF;
@@ -202,3 +203,4 @@ ENTRY(_read_iloc)
        R0 = R0 & R1;
 
        RTS;
+ENDPROC(_read_iloc)
index afed5246dd9ea159685f245caa0813dc951777b8..150ef5d088dcfedcdf0bb1d5a5922582c25c3f08 100644 (file)
@@ -39,7 +39,7 @@
 #include <asm/io.h>
 #include <asm/dpmc.h>
 #include <asm/irq.h>
-
+#include <asm/gpio.h>
 
 #ifdef CONFIG_PM_WAKEUP_GPIO_POLAR_H
 #define WAKEUP_TYPE    PM_WAKE_HIGH
index dd0c6501c42448180bff438e0736a47669e22e40..68107924639ecd8bade350354e9a29d2500d939b 100644 (file)
@@ -7,7 +7,7 @@
  * Description:  SRAM driver for Blackfin ADSP-BF5xx
  *
  * Modified:
- *               Copyright 2004-2006 Analog Devices Inc.
+ *               Copyright 2004-2007 Analog Devices Inc.
  *
  * Bugs:         Enter bugs at http://blackfin.uclinux.org/
  *
@@ -63,6 +63,7 @@ struct l1_sram_piece {
        void *paddr;
        int size;
        int flag;
+       pid_t pid;
 };
 
 static struct l1_sram_piece l1_ssram[CONFIG_L1_MAX_PIECE];
@@ -80,7 +81,7 @@ static struct l1_sram_piece l1_inst_sram[CONFIG_L1_MAX_PIECE];
 #endif
 
 /* L1 Scratchpad SRAM initialization function */
-void l1sram_init(void)
+void __init l1sram_init(void)
 {
        printk(KERN_INFO "Blackfin Scratchpad data SRAM: %d KB\n",
               L1_SCRATCH_LENGTH >> 10);
@@ -94,42 +95,43 @@ void l1sram_init(void)
        spin_lock_init(&l1sram_lock);
 }
 
-void l1_data_sram_init(void)
+void __init l1_data_sram_init(void)
 {
 #if L1_DATA_A_LENGTH != 0
-       printk(KERN_INFO "Blackfin DATA_A SRAM: %d KB\n",
-              L1_DATA_A_LENGTH >> 10);
-
        memset(&l1_data_A_sram, 0x00, sizeof(l1_data_A_sram));
-       l1_data_A_sram[0].paddr = (void*)L1_DATA_A_START +
-               (_ebss_l1 - _sdata_l1);
+       l1_data_A_sram[0].paddr = (void *)L1_DATA_A_START +
+                                       (_ebss_l1 - _sdata_l1);
        l1_data_A_sram[0].size = L1_DATA_A_LENGTH - (_ebss_l1 - _sdata_l1);
        l1_data_A_sram[0].flag = SRAM_SLT_FREE;
+
+       printk(KERN_INFO "Blackfin Data A SRAM: %d KB (%d KB free)\n",
+              L1_DATA_A_LENGTH >> 10, l1_data_A_sram[0].size >> 10);
 #endif
 #if L1_DATA_B_LENGTH != 0
-       printk(KERN_INFO "Blackfin DATA_B SRAM: %d KB\n",
-              L1_DATA_B_LENGTH >> 10);
-
        memset(&l1_data_B_sram, 0x00, sizeof(l1_data_B_sram));
-       l1_data_B_sram[0].paddr = (void*)L1_DATA_B_START;
-       l1_data_B_sram[0].size = L1_DATA_B_LENGTH;
+       l1_data_B_sram[0].paddr = (void *)L1_DATA_B_START +
+                               (_ebss_b_l1 - _sdata_b_l1);
+       l1_data_B_sram[0].size = L1_DATA_B_LENGTH - (_ebss_b_l1 - _sdata_b_l1);
        l1_data_B_sram[0].flag = SRAM_SLT_FREE;
+
+       printk(KERN_INFO "Blackfin Data B SRAM: %d KB (%d KB free)\n",
+              L1_DATA_B_LENGTH >> 10, l1_data_B_sram[0].size >> 10);
 #endif
 
        /* mutex initialize */
        spin_lock_init(&l1_data_sram_lock);
 }
 
-void l1_inst_sram_init(void)
+void __init l1_inst_sram_init(void)
 {
 #if L1_CODE_LENGTH != 0
-       printk(KERN_INFO "Blackfin Instruction SRAM: %d KB\n",
-              L1_CODE_LENGTH >> 10);
-
        memset(&l1_inst_sram, 0x00, sizeof(l1_inst_sram));
        l1_inst_sram[0].paddr = (void*)L1_CODE_START + (_etext_l1 - _stext_l1);
        l1_inst_sram[0].size = L1_CODE_LENGTH - (_etext_l1 - _stext_l1);
        l1_inst_sram[0].flag = SRAM_SLT_FREE;
+
+       printk(KERN_INFO "Blackfin Instruction SRAM: %d KB (%d KB free)\n",
+              L1_CODE_LENGTH >> 10, l1_inst_sram[0].size >> 10);
 #endif
 
        /* mutex initialize */
@@ -149,12 +151,13 @@ static void *_l1_sram_alloc(size_t size, struct l1_sram_piece *pfree, int count)
        size = (size + 3) & ~3;
 
        /* not use the good method to match the best slot !!! */
-       /* search an available memeory slot */
+       /* search an available memory slot */
        for (i = 0; i < count; i++) {
                if ((pfree[i].flag == SRAM_SLT_FREE)
                    && (pfree[i].size >= size)) {
                        addr = pfree[i].paddr;
                        pfree[i].flag = SRAM_SLT_ALLOCATED;
+                       pfree[i].pid = current->pid;
                        index = i;
                        break;
                }
@@ -162,10 +165,11 @@ static void *_l1_sram_alloc(size_t size, struct l1_sram_piece *pfree, int count)
        if (i >= count)
                return NULL;
 
-       /* updated the NULL memeory slot !!! */
+       /* updated the NULL memory slot !!! */
        if (pfree[i].size > size) {
                for (i = 0; i < count; i++) {
                        if (pfree[i].flag == SRAM_SLT_NULL) {
+                               pfree[i].pid = 0;
                                pfree[i].flag = SRAM_SLT_FREE;
                                pfree[i].paddr = addr + size;
                                pfree[i].size = pfree[index].size - size;
@@ -186,7 +190,7 @@ static void *_l1_sram_alloc_max(struct l1_sram_piece *pfree, int count,
        int i, index = -1;
        void *addr = NULL;
 
-       /* search an available memeory slot */
+       /* search an available memory slot */
        for (i = 0; i < count; i++) {
                if (pfree[i].flag == SRAM_SLT_FREE && pfree[i].size > best) {
                        addr = pfree[i].paddr;
@@ -198,13 +202,15 @@ static void *_l1_sram_alloc_max(struct l1_sram_piece *pfree, int count,
                return NULL;
        *psize = best;
 
+       pfree[index].pid = current->pid;
        pfree[index].flag = SRAM_SLT_ALLOCATED;
        return addr;
 }
 
 /* L1 memory free function */
 static int _l1_sram_free(const void *addr,
-                        struct l1_sram_piece *pfree, int count)
+                       struct l1_sram_piece *pfree,
+                       int count)
 {
        int i, index = 0;
 
@@ -222,12 +228,14 @@ static int _l1_sram_free(const void *addr,
        if (i >= count)
                return -1;
 
+       pfree[index].pid = 0;
        pfree[index].flag = SRAM_SLT_FREE;
 
        /* link the next address slot */
        for (i = 0; i < count; i++) {
                if (((pfree[index].paddr + pfree[index].size) == pfree[i].paddr)
                    && (pfree[i].flag == SRAM_SLT_FREE)) {
+                       pfree[i].pid = 0;
                        pfree[i].flag = SRAM_SLT_NULL;
                        pfree[index].size += pfree[i].size;
                        pfree[index].flag = SRAM_SLT_FREE;
@@ -538,3 +546,64 @@ void *sram_alloc_with_lsl(size_t size, unsigned long flags)
        return addr;
 }
 EXPORT_SYMBOL(sram_alloc_with_lsl);
+
+#ifdef CONFIG_PROC_FS
+/* Once we get a real allocator, we'll throw all of this away.
+ * Until then, we need some sort of visibility into the L1 alloc.
+ */
+static void _l1sram_proc_read(char *buf, int *len, const char *desc,
+               struct l1_sram_piece *pfree, const int array_size)
+{
+       int i;
+
+       *len += sprintf(&buf[*len], "--- L1 %-14s Size  PID State\n", desc);
+       for (i = 0; i < array_size; ++i) {
+               const char *alloc_type;
+               switch (pfree[i].flag) {
+               case SRAM_SLT_NULL:      alloc_type = "NULL"; break;
+               case SRAM_SLT_FREE:      alloc_type = "FREE"; break;
+               case SRAM_SLT_ALLOCATED: alloc_type = "ALLOCATED"; break;
+               default:                 alloc_type = "????"; break;
+               }
+               *len += sprintf(&buf[*len], "%p-%p %8i %4i %s\n",
+                       pfree[i].paddr, pfree[i].paddr + pfree[i].size,
+                       pfree[i].size, pfree[i].pid, alloc_type);
+       }
+}
+static int l1sram_proc_read(char *buf, char **start, off_t offset, int count,
+               int *eof, void *data)
+{
+       int len = 0;
+
+       _l1sram_proc_read(buf, &len, "Scratchpad",
+                       l1_ssram, ARRAY_SIZE(l1_ssram));
+#if L1_DATA_A_LENGTH != 0
+       _l1sram_proc_read(buf, &len, "Data A",
+                       l1_data_A_sram, ARRAY_SIZE(l1_data_A_sram));
+#endif
+#if L1_DATA_B_LENGTH != 0
+       _l1sram_proc_read(buf, &len, "Data B",
+                       l1_data_B_sram, ARRAY_SIZE(l1_data_B_sram));
+#endif
+#if L1_CODE_LENGTH != 0
+       _l1sram_proc_read(buf, &len, "Instruction",
+                       l1_inst_sram, ARRAY_SIZE(l1_inst_sram));
+#endif
+
+       return len;
+}
+
+static int __init l1sram_proc_init(void)
+{
+       struct proc_dir_entry *ptr;
+       ptr = create_proc_entry("sram", S_IFREG | S_IRUGO, NULL);
+       if (!ptr) {
+               printk(KERN_WARNING "unable to create /proc/sram\n");
+               return -1;
+       }
+       ptr->owner = THIS_MODULE;
+       ptr->read_proc = l1sram_proc_read;
+       return 0;
+}
+late_initcall(l1sram_proc_init);
+#endif
index d6cf1059560dc5caf39e1128b25e3b7a3b6b4564..570356dbe02843a144c486e5d4c94d892c076fd8 100644 (file)
@@ -7,7 +7,7 @@
  * Description:
  *
  * Modified:
- *               Copyright 2004-2006 Analog Devices Inc.
+ *               Copyright 2004-2007 Analog Devices Inc.
  *
  * Bugs:         Enter bugs at http://blackfin.uclinux.org/
  *
@@ -53,7 +53,7 @@ static unsigned long empty_bad_page;
 
 unsigned long empty_zero_page;
 
-void show_mem(void)
+void __init show_mem(void)
 {
        unsigned long i;
        int free = 0, total = 0, reserved = 0, shared = 0;
@@ -86,7 +86,7 @@ void show_mem(void)
  * The parameters are pointers to where to stick the starting and ending
  * addresses  of available kernel virtual memory.
  */
-void paging_init(void)
+void __init paging_init(void)
 {
        /*
         * make sure start_mem is page aligned,  otherwise bootmem and
@@ -125,7 +125,7 @@ void paging_init(void)
        }
 }
 
-void mem_init(void)
+void __init mem_init(void)
 {
        unsigned int codek = 0, datak = 0, initk = 0;
        unsigned long tmp;
@@ -169,7 +169,7 @@ void mem_init(void)
 }
 
 #ifdef CONFIG_BLK_DEV_INITRD
-void free_initrd_mem(unsigned long start, unsigned long end)
+void __init free_initrd_mem(unsigned long start, unsigned long end)
 {
        int pages = 0;
        for (; start < end; start += PAGE_SIZE) {
@@ -183,14 +183,14 @@ void free_initrd_mem(unsigned long start, unsigned long end)
 }
 #endif
 
-void free_initmem(void)
+void __init free_initmem(void)
 {
 #ifdef CONFIG_RAMKERNEL
        unsigned long addr;
-/*
*     the following code should be cool even if these sections
*     are not page aligned.
- */
+       /*
       *      the following code should be cool even if these sections
       *      are not page aligned.
       */
        addr = PAGE_ALIGN((unsigned long)(__init_begin));
        /* next to check that the page we free is not a partial page */
        for (; addr + PAGE_SIZE < (unsigned long)(__init_end);
index 2b04c8f1db62d0a6f022301f13acaa7bff8145bc..f0b67630b90da11f16dc3864cc1f3f1d9108d6e9 100644 (file)
@@ -28,7 +28,7 @@ struct wd_ops {
        void (*unreserve)(void);
        int (*setup)(unsigned nmi_hz);
        void (*rearm)(struct nmi_watchdog_ctlblk *wd, unsigned nmi_hz);
-       void (*stop)(void *);
+       void (*stop)(void);
        unsigned perfctr;
        unsigned evntsel;
        u64 checkbit;
@@ -142,7 +142,7 @@ void disable_lapic_nmi_watchdog(void)
        if (atomic_read(&nmi_active) <= 0)
                return;
 
-       on_each_cpu(wd_ops->stop, NULL, 0, 1);
+       on_each_cpu(stop_apic_nmi_watchdog, NULL, 0, 1);
        wd_ops->unreserve();
 
        BUG_ON(atomic_read(&nmi_active) != 0);
@@ -255,7 +255,7 @@ static int setup_k7_watchdog(unsigned nmi_hz)
        return 1;
 }
 
-static void single_msr_stop_watchdog(void *arg)
+static void single_msr_stop_watchdog(void)
 {
        struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk);
 
@@ -276,8 +276,8 @@ static int single_msr_reserve(void)
 
 static void single_msr_unreserve(void)
 {
-       release_evntsel_nmi(wd_ops->perfctr);
-       release_perfctr_nmi(wd_ops->evntsel);
+       release_evntsel_nmi(wd_ops->evntsel);
+       release_perfctr_nmi(wd_ops->perfctr);
 }
 
 static void single_msr_rearm(struct nmi_watchdog_ctlblk *wd, unsigned nmi_hz)
@@ -442,7 +442,7 @@ static int setup_p4_watchdog(unsigned nmi_hz)
        return 1;
 }
 
-static void stop_p4_watchdog(void *arg)
+static void stop_p4_watchdog(void)
 {
        struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk);
        wrmsr(wd->cccr_msr, 0, 0);
@@ -475,10 +475,10 @@ static void p4_unreserve(void)
 {
 #ifdef CONFIG_SMP
        if (smp_num_siblings > 1)
-               release_evntsel_nmi(MSR_P4_IQ_PERFCTR1);
+               release_perfctr_nmi(MSR_P4_IQ_PERFCTR1);
 #endif
-       release_evntsel_nmi(MSR_P4_IQ_PERFCTR0);
-       release_perfctr_nmi(MSR_P4_CRU_ESCR0);
+       release_evntsel_nmi(MSR_P4_CRU_ESCR0);
+       release_perfctr_nmi(MSR_P4_IQ_PERFCTR0);
 }
 
 static void p4_rearm(struct nmi_watchdog_ctlblk *wd, unsigned nmi_hz)
@@ -614,6 +614,12 @@ int lapic_watchdog_init(unsigned nmi_hz)
                probe_nmi_watchdog();
                if (!wd_ops)
                        return -1;
+
+               if (!wd_ops->reserve()) {
+                       printk(KERN_ERR
+                               "NMI watchdog: cannot reserve perfctrs\n");
+                       return -1;
+               }
        }
 
        if (!(wd_ops->setup(nmi_hz))) {
@@ -628,7 +634,7 @@ int lapic_watchdog_init(unsigned nmi_hz)
 void lapic_watchdog_stop(void)
 {
        if (wd_ops)
-               wd_ops->stop(NULL);
+               wd_ops->stop();
 }
 
 unsigned lapic_adjust_nmi_hz(unsigned hz)
index ddf8fa3bbd01d7c15ef03abf6c7c55c5356ebd57..1853524c8b576f5420de5cbd746aecb30f594d50 100644 (file)
@@ -754,7 +754,7 @@ int save_i387_soft(void *s387, struct _fpstate __user * buf)
     return -1;
   if ( offset )
     if (__copy_to_user(d+other, (u_char *)&S387->st_space, offset))
-      return -1
+      return -1;
   RE_ENTRANT_CHECK_ON;
 
   return 1;
index 29d7d61543a1dec88f2e2a1c348e5a696c1e70d2..1ecb3e43b523387388a99e2ed7cccdf0a7cdd131 100644 (file)
@@ -458,6 +458,11 @@ bad_area:
 bad_area_nosemaphore:
        /* User mode accesses just cause a SIGSEGV */
        if (error_code & 4) {
+               /*
+                * It's possible to have interrupts off here.
+                */
+               local_irq_enable();
+
                /* 
                 * Valid to do another page fault here because this one came 
                 * from user space.
index 92e58070b01664f31d10625b02822ddc2ede3bff..fb66eadd589633cf02ecc9e9f89dffe395a808ef 100644 (file)
@@ -62,10 +62,13 @@ void coldfire_tick(void)
 
 /***************************************************************************/
 
+static int ticks_per_intr;
+
 void coldfire_timer_init(irq_handler_t handler)
 {
        __raw_writew(MCFTIMER_TMR_DISABLE, TA(MCFTIMER_TMR));
-       __raw_writetrr(((MCF_BUSCLK / 16) / HZ), TA(MCFTIMER_TRR));
+       ticks_per_intr = (MCF_BUSCLK / 16) / HZ;
+       __raw_writetrr(ticks_per_intr - 1, TA(MCFTIMER_TRR));
        __raw_writew(MCFTIMER_TMR_ENORI | MCFTIMER_TMR_CLK16 |
                MCFTIMER_TMR_RESTART | MCFTIMER_TMR_ENABLE, TA(MCFTIMER_TMR));
 
@@ -81,11 +84,10 @@ void coldfire_timer_init(irq_handler_t handler)
 
 unsigned long coldfire_timer_offset(void)
 {
-       unsigned long trr, tcn, offset;
+       unsigned long tcn, offset;
 
        tcn = __raw_readw(TA(MCFTIMER_TCN));
-       trr = __raw_readtrr(TA(MCFTIMER_TRR));
-       offset = (tcn * (1000000 / HZ)) / trr;
+       offset = ((tcn + 1) * (1000000 / HZ)) / ticks_per_intr;
 
        /* Check if we just wrapped the counters and maybe missed a tick */
        if ((offset < (1000000 / HZ / 2)) && mcf_timerirqpending(1))
index 0f09412e1b7f249629166b5dce4d4f95cc59fd76..9528ee90640acc9ac99923f454e9db262405fc27 100644 (file)
@@ -747,9 +747,9 @@ config EARLY_PRINTK
          to print messages very early in the bootup process.
 
          This is useful for kernel debugging when your machine crashes very
-         early before the console code is initialized. For normal operation
-         it is not recommended because it looks on some machines ugly and
-         oesn't cooperate with an X server. You should normally N here,
+         early before the console code is initialized. For normal operation,
+         it is not recommended because it looks ugly on some machines and
+         doesn't cooperate with an X server. You should normally say N here,
          unless you want to debug such a crash.
 
 config SYS_HAS_EARLY_PRINTK
index b29a447392306056bdbe2ca877d171c39e876f94..2f060e1ed36c674c0e9da4e0d11f281edc8d07a0 100644 (file)
@@ -115,30 +115,6 @@ extern void markeins_irq_setup(void);
 
 static void inline __init markeins_sio_setup(void)
 {
-#ifdef CONFIG_KGDB_8250
-       struct uart_port emma_port;
-
-       memset(&emma_port, 0, sizeof(emma_port));
-
-       emma_port.flags =
-           UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
-       emma_port.iotype = UPIO_MEM;
-       emma_port.regshift = 4; /* I/O addresses are every 8 bytes */
-       emma_port.uartclk = 18544000;   /* Clock rate of the chip */
-
-       emma_port.line = 0;
-       emma_port.mapbase = KSEG1ADDR(EMMA2RH_PFUR0_BASE + 3);
-       emma_port.membase = (u8*)emma_port.mapbase;
-       early_serial_setup(&emma_port);
-
-       emma_port.line = 1;
-       emma_port.mapbase = KSEG1ADDR(EMMA2RH_PFUR1_BASE + 3);
-       emma_port.membase = (u8*)emma_port.mapbase;
-       early_serial_setup(&emma_port);
-
-       emma_port.irq = EMMA2RH_IRQ_PFUR1;
-       kgdb8250_add_port(1, &emma_port);
-#endif
 }
 
 void __init plat_mem_setup(void)
index 37849edd0645df1d611613a0838c351f3f98f552..06e04da211d57ec9f36a07dae2a34f2d56289d9c 100644 (file)
@@ -556,6 +556,16 @@ asmlinkage long sys32_sync_file_range(int fd, int __pad,
                        flags);
 }
 
+asmlinkage long sys32_fadvise64_64(int fd, int __pad,
+       unsigned long a2, unsigned long a3,
+       unsigned long a4, unsigned long a5,
+       int flags)
+{
+       return sys_fadvise64_64(fd,
+                       merge_64(a2, a3), merge_64(a4, a5),
+                       flags);
+}
+
 save_static_function(sys32_clone);
 __attribute_used__ noinline static int
 _sys32_clone(nabi_no_regargs struct pt_regs regs)
index cc566cf122464f8672685766dd595bc8cc50cceb..06729596812f744581cce609938fee82d36d25cc 100644 (file)
@@ -174,7 +174,7 @@ LEAF(_init_fpu)
        or      t0, t1
        mtc0    t0, CP0_STATUS
 #endif /* CONFIG_MIPS_MT_SMTC */
-       fpu_enable_hazard
+       enable_fpu_hazard
 
        li      t1, FPU_DEFAULT
        ctc1    t1, fcr31
index 0c9a9ff8cd25ec1c200347206f762f8f09b1ac27..ae985d1fcca12cb6722fc371f681ff3bce9000a1 100644 (file)
@@ -657,7 +657,11 @@ einval:    li      v0, -EINVAL
        sys     sys_getcpu              3
        sys     sys_epoll_pwait         6
        sys     sys_ioprio_set          3
-       sys     sys_ioprio_get          2
+       sys     sys_ioprio_get          2       /* 4315 */
+       sys     sys_utimensat           4
+       sys     sys_signalfd            3
+       sys     sys_timerfd             4
+       sys     sys_eventfd             1
        .endm
 
        /* We pre-compute the number of _instruction_ bytes needed to
index 23f3b118f7183221c8807d388a6df771a797388a..7bcd5a1a85f593ad818abe3e763b08ab1f705db3 100644 (file)
@@ -473,4 +473,8 @@ sys_call_table:
        PTR     sys_epoll_pwait
        PTR     sys_ioprio_set
        PTR     sys_ioprio_get
+       PTR     sys_utimensat                   /* 5275 */
+       PTR     sys_signalfd
+       PTR     sys_timerfd
+       PTR     sys_eventfd
        .size   sys_call_table,.-sys_call_table
index 6eac28337423536c3f1bf19988b0606611706f39..532a2f3b42fc53c1498abfae16ca6289649b3eee 100644 (file)
@@ -299,7 +299,7 @@ EXPORT(sysn32_call_table)
        PTR     sys_ni_syscall                  /* res. for afs_syscall */
        PTR     sys_ni_syscall                  /* res. for security */
        PTR     sys_gettid
-       PTR     sys32_readahead
+       PTR     sys_readahead
        PTR     sys_setxattr                    /* 6180 */
        PTR     sys_lsetxattr
        PTR     sys_fsetxattr
@@ -399,4 +399,8 @@ EXPORT(sysn32_call_table)
        PTR     compat_sys_epoll_pwait
        PTR     sys_ioprio_set
        PTR     sys_ioprio_get
+       PTR     compat_sys_utimensat
+       PTR     compat_sys_signalfd             /* 5280 */
+       PTR     compat_sys_timerfd
+       PTR     sys_eventfd
        .size   sysn32_call_table,.-sysn32_call_table
index 7e74b412a782b8133b1557a6d69c58a710872a14..6bbe0f4ed8ba757dc6c3c897c6ab5618a6ec3aac 100644 (file)
@@ -459,7 +459,7 @@ sys_call_table:
        PTR     sys_remap_file_pages
        PTR     sys_set_tid_address
        PTR     sys_restart_syscall
-       PTR     sys_fadvise64_64
+       PTR     sys32_fadvise64_64
        PTR     compat_sys_statfs64             /* 4255 */
        PTR     compat_sys_fstatfs64
        PTR     compat_sys_timer_create
@@ -521,4 +521,8 @@ sys_call_table:
        PTR     compat_sys_epoll_pwait
        PTR     sys_ioprio_set
        PTR     sys_ioprio_get                  /* 4315 */
+       PTR     compat_sys_utimensat
+       PTR     compat_sys_signalfd
+       PTR     compat_sys_timerfd
+       PTR     sys_eventfd
        .size   sys_call_table,.-sys_call_table
index 64b62bdfb4f62d46c3f5aa897bbfeec56e73b88b..b8fa7ddd78f6d76b0aae3aefc7b99966fc08db65 100644 (file)
@@ -129,13 +129,13 @@ static irqreturn_t ipi_call_interrupt(int irq, void *dev_id)
 
 static struct irqaction irq_resched = {
        .handler        = ipi_resched_interrupt,
-       .flags          = IRQF_DISABLED,
+       .flags          = IRQF_DISABLED|IRQF_PERCPU,
        .name           = "IPI_resched"
 };
 
 static struct irqaction irq_call = {
        .handler        = ipi_call_interrupt,
-       .flags          = IRQF_DISABLED,
+       .flags          = IRQF_DISABLED|IRQF_PERCPU,
        .name           = "IPI_call"
 };
 
@@ -275,10 +275,7 @@ void __init plat_prepare_cpus(unsigned int max_cpus)
        setup_irq(cpu_ipi_resched_irq, &irq_resched);
        setup_irq(cpu_ipi_call_irq, &irq_call);
 
-       /* need to mark IPI's as IRQ_PER_CPU */
-       irq_desc[cpu_ipi_resched_irq].status |= IRQ_PER_CPU;
        set_irq_handler(cpu_ipi_resched_irq, handle_percpu_irq);
-       irq_desc[cpu_ipi_call_irq].status |= IRQ_PER_CPU;
        set_irq_handler(cpu_ipi_call_irq, handle_percpu_irq);
 }
 
@@ -326,8 +323,11 @@ void prom_boot_secondary(int cpu, struct task_struct *idle)
 
 void prom_init_secondary(void)
 {
+       /* Enable per-cpu interrupts */
+
+       /* This is Malta specific: IPI,performance and timer inetrrupts */
        write_c0_status((read_c0_status() & ~ST0_IM ) |
-                       (STATUSF_IP0 | STATUSF_IP1 | STATUSF_IP7));
+                       (STATUSF_IP0 | STATUSF_IP1 | STATUSF_IP6 | STATUSF_IP7));
 }
 
 void prom_smp_finish(void)
index c46e479c992b4dae0f620fb3c0399e5674089b39..67edfa7ed93a643d4a59af04d9a6c98a8d1ca12f 100644 (file)
@@ -68,7 +68,7 @@ extern ATTRIB_NORET void cpu_idle(void);
  * First C code run on the secondary CPUs after being started up by
  * the master.
  */
-asmlinkage void start_secondary(void)
+asmlinkage __cpuinit void start_secondary(void)
 {
        unsigned int cpu;
 
index 921207c4a83c115ac77dfeadfe6c25bc31fb9d58..20938a4cb52d64991e7aa1f695a5aba7c80caac3 100644 (file)
@@ -121,10 +121,7 @@ LEAF(self_ipi)
        subu    t1,sp,PT_SIZE
        sw      ra,PT_EPC(t1)
        sw      a0,PT_PADSLOT4(t1)
-       LONG_L  s0, TI_REGS($28)
-       LONG_S  sp, TI_REGS($28)
        la      t2,ipi_decode
-       LONG_S  s0, TI_REGS($28)
        sw      t2,PT_PADSLOT5(t1)
        /* Save pre-disable value of TCStatus */
        sw      t0,PT_TCSTATUS(t1)
index b361edb83dc63e009e9a1a39281e9c132e946bfe..21eb5993a19fe52a99aa9714bda5db917da42fb2 100644 (file)
@@ -611,12 +611,12 @@ void smtc_cpus_done(void)
 int setup_irq_smtc(unsigned int irq, struct irqaction * new,
                        unsigned long hwmask)
 {
+#ifdef CONFIG_SMTC_IDLE_HOOK_DEBUG
        unsigned int vpe = current_cpu_data.vpe_id;
 
-       irq_hwmask[irq] = hwmask;
-#ifdef CONFIG_SMTC_IDLE_HOOK_DEBUG
        vpemask[vpe][irq - MIPSCPU_INT_BASE] = 1;
 #endif
+       irq_hwmask[irq] = hwmask;
 
        return setup_irq(irq, new);
 }
index 751b4a18b1331f6c267a41c9a2215f2023c20ad0..7def1ff3da9492573508870c2f927af670aeaecc 100644 (file)
@@ -199,6 +199,30 @@ int (*perf_irq)(void) = null_perf_irq;
 EXPORT_SYMBOL(null_perf_irq);
 EXPORT_SYMBOL(perf_irq);
 
+/*
+ * Performance counter IRQ or -1 if shared with timer
+ */
+int mipsxx_perfcount_irq;
+EXPORT_SYMBOL(mipsxx_perfcount_irq);
+
+/*
+ * Possibly handle a performance counter interrupt.
+ * Return true if the timer interrupt should not be checked
+ */
+static inline int handle_perf_irq (int r2)
+{
+       /*
+        * The performance counter overflow interrupt may be shared with the
+        * timer interrupt (mipsxx_perfcount_irq < 0). If it is and a
+        * performance counter has overflowed (perf_irq() == IRQ_HANDLED)
+        * and we can't reliably determine if a counter interrupt has also
+        * happened (!r2) then don't check for a timer interrupt.
+        */
+       return (mipsxx_perfcount_irq < 0) &&
+               perf_irq() == IRQ_HANDLED &&
+               !r2;
+}
+
 asmlinkage void ll_timer_interrupt(int irq)
 {
        int r2 = cpu_has_mips_r2;
@@ -206,19 +230,13 @@ asmlinkage void ll_timer_interrupt(int irq)
        irq_enter();
        kstat_this_cpu.irqs[irq]++;
 
-       /*
-        * Suckage alert:
-        * Before R2 of the architecture there was no way to see if a
-        * performance counter interrupt was pending, so we have to run the
-        * performance counter interrupt handler anyway.
-        */
-       if (!r2 || (read_c0_cause() & (1 << 26)))
-               if (perf_irq())
-                       goto out;
+       if (handle_perf_irq(r2))
+               goto out;
 
-       /* we keep interrupt disabled all the time */
-       if (!r2 || (read_c0_cause() & (1 << 30)))
-               timer_interrupt(irq, NULL);
+       if (r2 && ((read_c0_cause() & (1 << 30)) == 0))
+               goto out;
+
+       timer_interrupt(irq, NULL);
 
 out:
        irq_exit();
@@ -258,7 +276,7 @@ unsigned int mips_hpt_frequency;
 
 static struct irqaction timer_irqaction = {
        .handler = timer_interrupt,
-       .flags = IRQF_DISABLED,
+       .flags = IRQF_DISABLED | IRQF_PERCPU,
        .name = "timer",
 };
 
index 200de027f354ec8e0bb0919ab707f0ff4e640af1..a7a17eb9bfcde7ee4c71fd5bc7c2d73dd949091b 100644 (file)
@@ -11,6 +11,7 @@
  * Copyright (C) 2000, 01 MIPS Technologies, Inc.
  * Copyright (C) 2002, 2003, 2004, 2005  Maciej W. Rozycki
  */
+#include <linux/bug.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -927,12 +928,6 @@ asmlinkage void do_reserved(struct pt_regs *regs)
              (regs->cp0_cause & 0x7f) >> 2);
 }
 
-static asmlinkage void do_default_vi(void)
-{
-       show_regs(get_irq_regs());
-       panic("Caught unexpected vectored interrupt.");
-}
-
 /*
  * Some MIPS CPUs can enable/disable for cache parity detection, but do
  * it different ways.
@@ -1128,6 +1123,12 @@ void mips_srs_free(int set)
        clear_bit(set, &sr->sr_allocated);
 }
 
+static asmlinkage void do_default_vi(void)
+{
+       show_regs(get_irq_regs());
+       panic("Caught unexpected vectored interrupt.");
+}
+
 static void *set_vi_srs_handler(int n, vi_handler_t addr, int srs)
 {
        unsigned long handler;
@@ -1190,8 +1191,8 @@ static void *set_vi_srs_handler(int n, vi_handler_t addr, int srs)
 
                memcpy (b, &except_vec_vi, handler_len);
 #ifdef CONFIG_MIPS_MT_SMTC
-               if (n > 7)
-                       printk("Vector index %d exceeds SMTC maximum\n", n);
+               BUG_ON(n > 7);  /* Vector index %d exceeds SMTC maximum. */
+
                w = (u32 *)(b + mori_offset);
                *w = (*w & 0xffff0000) | (0x100 << n);
 #endif /* CONFIG_MIPS_MT_SMTC */
@@ -1383,6 +1384,13 @@ void __init per_cpu_trap_init(void)
                cpu_cache_init();
                tlb_init();
 #ifdef CONFIG_MIPS_MT_SMTC
+       } else if (!secondaryTC) {
+               /*
+                * First TC in non-boot VPE must do subset of tlb_init()
+                * for MMU countrol registers.
+                */
+               write_c0_pagemask(PM_DEFAULT_MASK);
+               write_c0_wired(0);
        }
 #endif /* CONFIG_MIPS_MT_SMTC */
 }
@@ -1531,8 +1539,7 @@ void __init trap_init(void)
        if (cpu_has_mipsmt)
                set_except_vector(25, handle_mt);
 
-       if (cpu_has_dsp)
-               set_except_vector(26, handle_dsp);
+       set_except_vector(26, handle_dsp);
 
        if (cpu_has_vce)
                /* Special exception: R4[04]00 uses also the divec space. */
index dfa0acbd7fc2b79eeee0bbd6dfefb29e9456592a..9f49da95aacf86c7297a60bfd340f13a0b3adc1c 100644 (file)
@@ -248,14 +248,13 @@ void __init arch_init_irq(void)
        case MIPS_REVISION_CORID_CORE_24K:
        case MIPS_REVISION_CORID_CORE_EMUL_MSC:
                if (cpu_has_veic)
-                       init_msc_irqs (MSC01E_INT_BASE,
+                       init_msc_irqs (MSC01E_INT_BASE, MSC01E_INT_BASE,
                                       msc_eicirqmap, msc_nr_eicirqs);
                else
-                       init_msc_irqs (MSC01C_INT_BASE,
+                       init_msc_irqs (MSC01E_INT_BASE, MSC01C_INT_BASE,
                                       msc_irqmap, msc_nr_irqs);
        }
 
-
        if (cpu_has_veic) {
                set_vi_handler (MSC01E_INT_ATLAS, atlas_hw0_irqdispatch);
                setup_irq (MSC01E_INT_BASE + MSC01E_INT_ATLAS, &atlasirq);
index 0c6b0ce15028827c6e1e069bcf2ee497d23dfc3b..1cc6ebbedfdd8cc89d611f71522478dd90f96adf 100644 (file)
@@ -48,6 +48,8 @@ const char *get_system_type(void)
        return "MIPS Atlas";
 }
 
+const char display_string[] = "        LINUX ON ATLAS       ";
+
 void __init plat_mem_setup(void)
 {
        mips_pcibios_init();
index 548dbe5ce7c8c889447ee24df97e2987ceca5d28..5d600054090a5c258a448a77340de12d205fd906 100644 (file)
  */
 
 #include <linux/compiler.h>
+#include <linux/timer.h>
 #include <asm/io.h>
 #include <asm/mips-boards/generic.h>
 
+extern const char display_string[];
+static unsigned int display_count;
+static unsigned int max_display_count;
+
 void mips_display_message(const char *str)
 {
        static unsigned int __iomem *display = NULL;
@@ -37,3 +42,22 @@ void mips_display_message(const char *str)
                         writel(' ', display + i);
        }
 }
+
+static void scroll_display_message(unsigned long data);
+static DEFINE_TIMER(mips_scroll_timer, scroll_display_message, HZ, 0);
+
+static void scroll_display_message(unsigned long data)
+{
+       mips_display_message(&display_string[display_count++]);
+       if (display_count == max_display_count)
+               display_count = 0;
+
+       mod_timer(&mips_scroll_timer, jiffies + HZ);
+}
+
+void mips_scroll_message(void)
+{
+       del_timer_sync(&mips_scroll_timer);
+       max_display_count = strlen(display_string) + 1 - 8;
+       mod_timer(&mips_scroll_timer, jiffies + 1);
+}
index 88e9c2a7a2f9a4b86b3eaa10c62db17c9471cb1d..4eabc1eadd2327d012a32f42e0cd06060339a011 100644 (file)
@@ -57,7 +57,8 @@ int *_prom_argv, *_prom_envp;
 
 int init_debug = 0;
 
-unsigned int mips_revision_corid;
+int mips_revision_corid;
+int mips_revision_sconid;
 
 /* Bonito64 system controller register base. */
 unsigned long _pcictrl_bonito;
@@ -275,13 +276,38 @@ void __init prom_init(void)
                else
                        mips_revision_corid = MIPS_REVISION_CORID_CORE_EMUL_MSC;
        }
-       switch(mips_revision_corid) {
+
+       mips_revision_sconid = MIPS_REVISION_SCONID;
+       if (mips_revision_sconid == MIPS_REVISION_SCON_OTHER) {
+               switch (mips_revision_corid) {
+               case MIPS_REVISION_CORID_QED_RM5261:
+               case MIPS_REVISION_CORID_CORE_LV:
+               case MIPS_REVISION_CORID_CORE_FPGA:
+               case MIPS_REVISION_CORID_CORE_FPGAR2:
+                       mips_revision_sconid = MIPS_REVISION_SCON_GT64120;
+                       break;
+               case MIPS_REVISION_CORID_CORE_EMUL_BON:
+               case MIPS_REVISION_CORID_BONITO64:
+               case MIPS_REVISION_CORID_CORE_20K:
+                       mips_revision_sconid = MIPS_REVISION_SCON_BONITO;
+                       break;
+               case MIPS_REVISION_CORID_CORE_MSC:
+               case MIPS_REVISION_CORID_CORE_FPGA2:
+               case MIPS_REVISION_CORID_CORE_FPGA3:
+               case MIPS_REVISION_CORID_CORE_24K:
+               case MIPS_REVISION_CORID_CORE_EMUL_MSC:
+                       mips_revision_sconid = MIPS_REVISION_SCON_SOCIT;
+                       break;
+               default:
+                       mips_display_message("CC Error");
+                       while (1);   /* We die here... */
+               }
+       }
+
+       switch (mips_revision_sconid) {
                u32 start, map, mask, data;
 
-       case MIPS_REVISION_CORID_QED_RM5261:
-       case MIPS_REVISION_CORID_CORE_LV:
-       case MIPS_REVISION_CORID_CORE_FPGA:
-       case MIPS_REVISION_CORID_CORE_FPGAR2:
+       case MIPS_REVISION_SCON_GT64120:
                /*
                 * Setup the North bridge to do Master byte-lane swapping
                 * when running in bigendian.
@@ -305,9 +331,7 @@ void __init prom_init(void)
                set_io_port_base(MALTA_GT_PORT_BASE);
                break;
 
-       case MIPS_REVISION_CORID_CORE_EMUL_BON:
-       case MIPS_REVISION_CORID_BONITO64:
-       case MIPS_REVISION_CORID_CORE_20K:
+       case MIPS_REVISION_SCON_BONITO:
                _pcictrl_bonito_pcicfg = (unsigned long)ioremap(BONITO_PCICFG_BASE, BONITO_PCICFG_SIZE);
 
                /*
@@ -334,13 +358,10 @@ void __init prom_init(void)
                set_io_port_base(MALTA_BONITO_PORT_BASE);
                break;
 
-       case MIPS_REVISION_CORID_CORE_MSC:
-       case MIPS_REVISION_CORID_CORE_FPGA2:
-       case MIPS_REVISION_CORID_CORE_FPGA3:
-       case MIPS_REVISION_CORID_CORE_24K:
-       case MIPS_REVISION_CORID_CORE_EMUL_MSC:
+       case MIPS_REVISION_SCON_SOCIT:
+       case MIPS_REVISION_SCON_ROCIT:
                _pcictrl_msc = (unsigned long)ioremap(MIPS_MSC01_PCI_REG_BASE, 0x2000);
-
+       mips_pci_controller:
                mb();
                MSC_READ(MSC01_PCI_CFG, data);
                MSC_WRITE(MSC01_PCI_CFG, data & ~MSC01_PCI_CFG_EN_BIT);
@@ -374,10 +395,15 @@ void __init prom_init(void)
                set_io_port_base(MALTA_MSC_PORT_BASE);
                break;
 
+       case MIPS_REVISION_SCON_SOCITSC:
+       case MIPS_REVISION_SCON_SOCITSCP:
+               _pcictrl_msc = (unsigned long)ioremap(MIPS_SOCITSC_PCI_REG_BASE, 0x2000);
+               goto mips_pci_controller;
+
        default:
-               /* Unknown Core card */
-               mips_display_message("CC Error");
-               while(1);   /* We die here... */
+               /* Unknown system controller */
+               mips_display_message("SC Error");
+               while (1);   /* We die here... */
        }
 #endif
        board_nmi_handler_setup = mips_nmi_setup;
index f98d60f78658e5fbac6c14905823d39b477be86f..c9852206890afbc098b46031196679dc2cf246c1 100644 (file)
@@ -92,11 +92,8 @@ void __init mips_pcibios_init(void)
        struct pci_controller *controller;
        resource_size_t start, end, map, start1, end1, map1, map2, map3, mask;
 
-       switch (mips_revision_corid) {
-       case MIPS_REVISION_CORID_QED_RM5261:
-       case MIPS_REVISION_CORID_CORE_LV:
-       case MIPS_REVISION_CORID_CORE_FPGA:
-       case MIPS_REVISION_CORID_CORE_FPGAR2:
+       switch (mips_revision_sconid) {
+       case MIPS_REVISION_SCON_GT64120:
                /*
                 * Due to a bug in the Galileo system controller, we need
                 * to setup the PCI BAR for the Galileo internal registers.
@@ -161,9 +158,7 @@ void __init mips_pcibios_init(void)
                controller = &gt64120_controller;
                break;
 
-       case MIPS_REVISION_CORID_BONITO64:
-       case MIPS_REVISION_CORID_CORE_20K:
-       case MIPS_REVISION_CORID_CORE_EMUL_BON:
+       case MIPS_REVISION_SCON_BONITO:
                /* Set up resource ranges from the controller's registers.  */
                map = BONITO_PCIMAP;
                map1 = (BONITO_PCIMAP & BONITO_PCIMAP_PCIMAP_LO0) >>
@@ -195,11 +190,10 @@ void __init mips_pcibios_init(void)
                controller = &bonito64_controller;
                break;
 
-       case MIPS_REVISION_CORID_CORE_MSC:
-       case MIPS_REVISION_CORID_CORE_FPGA2:
-       case MIPS_REVISION_CORID_CORE_FPGA3:
-       case MIPS_REVISION_CORID_CORE_24K:
-       case MIPS_REVISION_CORID_CORE_EMUL_MSC:
+       case MIPS_REVISION_SCON_SOCIT:
+       case MIPS_REVISION_SCON_ROCIT:
+       case MIPS_REVISION_SCON_SOCITSC:
+       case MIPS_REVISION_SCON_SOCITSCP:
                /* Set up resource ranges from the controller's registers.  */
                MSC_READ(MSC01_PCI_SC2PMBASL, start);
                MSC_READ(MSC01_PCI_SC2PMMSKL, mask);
index df2a2bd3aa5d198188e0fc3f8e1eadb167ee5dfd..8f1000f51b3d2b2512fe0d99b0fa669f11a23391 100644 (file)
 
 unsigned long cpu_khz;
 
-#if defined(CONFIG_MIPS_ATLAS)
-static char display_string[] = "        LINUX ON ATLAS       ";
-#endif
-#if defined(CONFIG_MIPS_MALTA)
-#if defined(CONFIG_MIPS_MT_SMTC)
-static char display_string[] = "       SMTC LINUX ON MALTA       ";
-#else
-static char display_string[] = "        LINUX ON MALTA       ";
-#endif /* CONFIG_MIPS_MT_SMTC */
-#endif
-#if defined(CONFIG_MIPS_SEAD)
-static char display_string[] = "        LINUX ON SEAD       ";
-#endif
-static unsigned int display_count;
-#define MAX_DISPLAY_COUNT (sizeof(display_string) - 8)
-
-#define CPUCTR_IMASKBIT (0x100 << MIPSCPU_INT_CPUCTR)
-
-static unsigned int timer_tick_count;
 static int mips_cpu_timer_irq;
+extern int mipsxx_perfcount_irq;
 extern void smtc_timer_broadcast(int);
 
-static inline void scroll_display_message(void)
+static void mips_timer_dispatch(void)
 {
-       if ((timer_tick_count++ % HZ) == 0) {
-               mips_display_message(&display_string[display_count++]);
-               if (display_count == MAX_DISPLAY_COUNT)
-                       display_count = 0;
-       }
+       do_IRQ(mips_cpu_timer_irq);
 }
 
-static void mips_timer_dispatch(void)
+static void mips_perf_dispatch(void)
 {
-       do_IRQ(mips_cpu_timer_irq);
+       do_IRQ(mipsxx_perfcount_irq);
 }
 
 /*
@@ -96,6 +74,24 @@ extern int null_perf_irq(void);
 
 extern int (*perf_irq)(void);
 
+/*
+ * Possibly handle a performance counter interrupt.
+ * Return true if the timer interrupt should not be checked
+ */
+static inline int handle_perf_irq (int r2)
+{
+       /*
+        * The performance counter overflow interrupt may be shared with the
+        * timer interrupt (mipsxx_perfcount_irq < 0). If it is and a
+        * performance counter has overflowed (perf_irq() == IRQ_HANDLED)
+        * and we can't reliably determine if a counter interrupt has also
+        * happened (!r2) then don't check for a timer interrupt.
+        */
+       return (mipsxx_perfcount_irq < 0) &&
+               perf_irq() == IRQ_HANDLED &&
+               !r2;
+}
+
 irqreturn_t mips_timer_interrupt(int irq, void *dev_id)
 {
        int cpu = smp_processor_id();
@@ -114,25 +110,13 @@ irqreturn_t mips_timer_interrupt(int irq, void *dev_id)
         *  the general MIPS timer_interrupt routine.
         */
 
-       int vpflags;
-
        /*
         * We could be here due to timer interrupt,
         * perf counter overflow, or both.
         */
-       if (read_c0_cause() & (1 << 26))
-               perf_irq();
+       (void) handle_perf_irq(1);
 
        if (read_c0_cause() & (1 << 30)) {
-               /* If timer interrupt, make it de-assert */
-               write_c0_compare (read_c0_count() - 1);
-               /*
-                * DVPE is necessary so long as cross-VPE interrupts
-                * are done via read-modify-write of Cause register.
-                */
-               vpflags = dvpe();
-               clear_c0_cause(CPUCTR_IMASKBIT);
-               evpe(vpflags);
                /*
                 * There are things we only want to do once per tick
                 * in an "MP" system.   One TC of each VPE will take
@@ -141,34 +125,30 @@ irqreturn_t mips_timer_interrupt(int irq, void *dev_id)
                 * the tick on VPE 0 to run the full timer_interrupt().
                 */
                if (cpu_data[cpu].vpe_id == 0) {
-                               timer_interrupt(irq, NULL);
-                               smtc_timer_broadcast(cpu_data[cpu].vpe_id);
-                               scroll_display_message();
+                       timer_interrupt(irq, NULL);
                } else {
                        write_c0_compare(read_c0_count() +
                                         (mips_hpt_frequency/HZ));
                        local_timer_interrupt(irq, dev_id);
-                       smtc_timer_broadcast(cpu_data[cpu].vpe_id);
                }
+               smtc_timer_broadcast(cpu_data[cpu].vpe_id);
        }
 #else /* CONFIG_MIPS_MT_SMTC */
        int r2 = cpu_has_mips_r2;
 
+       if (handle_perf_irq(r2))
+               goto out;
+
+       if (r2 && ((read_c0_cause() & (1 << 30)) == 0))
+               goto out;
+
        if (cpu == 0) {
                /*
                 * CPU 0 handles the global timer interrupt job and process
                 * accounting resets count/compare registers to trigger next
                 * timer int.
                 */
-               if (!r2 || (read_c0_cause() & (1 << 26)))
-                       if (perf_irq())
-                               goto out;
-
-               /* we keep interrupt disabled all the time */
-               if (!r2 || (read_c0_cause() & (1 << 30)))
-                       timer_interrupt(irq, NULL);
-
-               scroll_display_message();
+               timer_interrupt(irq, NULL);
        } else {
                /* Everyone else needs to reset the timer int here as
                   ll_local_timer_interrupt doesn't */
@@ -262,37 +242,89 @@ void __init mips_time_init(void)
               (est_freq%1000000)*100/1000000);
 
         cpu_khz = est_freq / 1000;
+
+       mips_scroll_message();
+}
+
+irqreturn_t mips_perf_interrupt(int irq, void *dev_id)
+{
+       return perf_irq();
+}
+
+static struct irqaction perf_irqaction = {
+       .handler = mips_perf_interrupt,
+       .flags = IRQF_DISABLED | IRQF_PERCPU,
+       .name = "performance",
+};
+
+void __init plat_perf_setup(struct irqaction *irq)
+{
+       int hwint = 0;
+       mipsxx_perfcount_irq = -1;
+
+#ifdef MSC01E_INT_BASE
+       if (cpu_has_veic) {
+               set_vi_handler (MSC01E_INT_PERFCTR, mips_perf_dispatch);
+               mipsxx_perfcount_irq = MSC01E_INT_BASE + MSC01E_INT_PERFCTR;
+       } else
+#endif
+       if (cpu_has_mips_r2) {
+               /*
+                * Read IntCtl.IPPCI to determine the performance
+                * counter interrupt
+                */
+               hwint = (read_c0_intctl () >> 26) & 7;
+               if (hwint != MIPSCPU_INT_CPUCTR) {
+                       if (cpu_has_vint)
+                               set_vi_handler (hwint, mips_perf_dispatch);
+                       mipsxx_perfcount_irq = MIPSCPU_INT_BASE + hwint;
+               }
+       }
+       if (mipsxx_perfcount_irq >= 0) {
+#ifdef CONFIG_MIPS_MT_SMTC
+               setup_irq_smtc(mipsxx_perfcount_irq, irq, 0x100 << hwint);
+#else
+               setup_irq(mipsxx_perfcount_irq, irq);
+#endif /* CONFIG_MIPS_MT_SMTC */
+#ifdef CONFIG_SMP
+               set_irq_handler(mipsxx_perfcount_irq, handle_percpu_irq);
+#endif
+       }
 }
 
 void __init plat_timer_setup(struct irqaction *irq)
 {
+       int hwint = 0;
 #ifdef MSC01E_INT_BASE
        if (cpu_has_veic) {
                set_vi_handler (MSC01E_INT_CPUCTR, mips_timer_dispatch);
                mips_cpu_timer_irq = MSC01E_INT_BASE + MSC01E_INT_CPUCTR;
-       } else
+       }
+       else
 #endif
        {
+               if (cpu_has_mips_r2)
+                       /*
+                        * Read IntCtl.IPTI to determine the timer interrupt
+                        */
+                       hwint = (read_c0_intctl () >> 29) & 7;
+               else
+                       hwint = MIPSCPU_INT_CPUCTR;
                if (cpu_has_vint)
-                       set_vi_handler (MIPSCPU_INT_CPUCTR, mips_timer_dispatch);
-               mips_cpu_timer_irq = MIPSCPU_INT_BASE + MIPSCPU_INT_CPUCTR;
+                       set_vi_handler (hwint, mips_timer_dispatch);
+               mips_cpu_timer_irq = MIPSCPU_INT_BASE + hwint;
        }
 
-
        /* we are using the cpu counter for timer interrupts */
        irq->handler = mips_timer_interrupt;    /* we use our own handler */
 #ifdef CONFIG_MIPS_MT_SMTC
-       setup_irq_smtc(mips_cpu_timer_irq, irq, CPUCTR_IMASKBIT);
+       setup_irq_smtc(mips_cpu_timer_irq, irq, 0x100 << hwint);
 #else
        setup_irq(mips_cpu_timer_irq, irq);
 #endif /* CONFIG_MIPS_MT_SMTC */
-
 #ifdef CONFIG_SMP
-       /* irq_desc(riptor) is a global resource, when the interrupt overlaps
-          on seperate cpu's the first one tries to handle the second interrupt.
-          The effect is that the int remains disabled on the second cpu.
-          Mark the interrupt with IRQ_PER_CPU to avoid any confusion */
-       irq_desc[mips_cpu_timer_irq].status |= IRQ_PER_CPU;
        set_irq_handler(mips_cpu_timer_irq, handle_percpu_irq);
 #endif
+
+       plat_perf_setup(&perf_irqaction);
 }
index 1cd830e3d93307cc37747ea210cfd67c5b118a36..1668cc21d5b5a12197da88d351b4d1b5fa03e14e 100644 (file)
@@ -53,25 +53,19 @@ static inline int mips_pcibios_iack(void)
         * Determine highest priority pending interrupt by performing
         * a PCI Interrupt Acknowledge cycle.
         */
-       switch(mips_revision_corid) {
-       case MIPS_REVISION_CORID_CORE_MSC:
-       case MIPS_REVISION_CORID_CORE_FPGA2:
-       case MIPS_REVISION_CORID_CORE_FPGA3:
-       case MIPS_REVISION_CORID_CORE_24K:
-       case MIPS_REVISION_CORID_CORE_EMUL_MSC:
+       switch (mips_revision_sconid) {
+       case MIPS_REVISION_SCON_SOCIT:
+       case MIPS_REVISION_SCON_ROCIT:
+       case MIPS_REVISION_SCON_SOCITSC:
+       case MIPS_REVISION_SCON_SOCITSCP:
                MSC_READ(MSC01_PCI_IACK, irq);
                irq &= 0xff;
                break;
-       case MIPS_REVISION_CORID_QED_RM5261:
-       case MIPS_REVISION_CORID_CORE_LV:
-       case MIPS_REVISION_CORID_CORE_FPGA:
-       case MIPS_REVISION_CORID_CORE_FPGAR2:
+       case MIPS_REVISION_SCON_GT64120:
                irq = GT_READ(GT_PCI0_IACK_OFS);
                irq &= 0xff;
                break;
-       case MIPS_REVISION_CORID_BONITO64:
-       case MIPS_REVISION_CORID_CORE_20K:
-       case MIPS_REVISION_CORID_CORE_EMUL_BON:
+       case MIPS_REVISION_SCON_BONITO:
                /* The following will generate a PCI IACK cycle on the
                 * Bonito controller. It's a little bit kludgy, but it
                 * was the easiest way to implement it in hardware at
@@ -89,7 +83,7 @@ static inline int mips_pcibios_iack(void)
                BONITO_PCIMAP_CFG = 0;
                break;
        default:
-               printk("Unknown Core card, don't know the system controller.\n");
+               printk("Unknown system controller.\n");
                return -1;
        }
        return irq;
@@ -144,27 +138,21 @@ static void corehi_irqdispatch(void)
           Do it for the others too.
        */
 
-        switch(mips_revision_corid) {
-        case MIPS_REVISION_CORID_CORE_MSC:
-        case MIPS_REVISION_CORID_CORE_FPGA2:
-        case MIPS_REVISION_CORID_CORE_FPGA3:
-        case MIPS_REVISION_CORID_CORE_24K:
-        case MIPS_REVISION_CORID_CORE_EMUL_MSC:
+       switch (mips_revision_sconid) {
+        case MIPS_REVISION_SCON_SOCIT:
+       case MIPS_REVISION_SCON_ROCIT:
+       case MIPS_REVISION_SCON_SOCITSC:
+       case MIPS_REVISION_SCON_SOCITSCP:
                 ll_msc_irq();
                 break;
-        case MIPS_REVISION_CORID_QED_RM5261:
-        case MIPS_REVISION_CORID_CORE_LV:
-        case MIPS_REVISION_CORID_CORE_FPGA:
-        case MIPS_REVISION_CORID_CORE_FPGAR2:
+        case MIPS_REVISION_SCON_GT64120:
                 intrcause = GT_READ(GT_INTRCAUSE_OFS);
                 datalo = GT_READ(GT_CPUERR_ADDRLO_OFS);
                 datahi = GT_READ(GT_CPUERR_ADDRHI_OFS);
                 printk("GT_INTRCAUSE = %08x\n", intrcause);
                 printk("GT_CPUERR_ADDR = %02x%08x\n", datahi, datalo);
                 break;
-        case MIPS_REVISION_CORID_BONITO64:
-        case MIPS_REVISION_CORID_CORE_20K:
-        case MIPS_REVISION_CORID_CORE_EMUL_BON:
+        case MIPS_REVISION_SCON_BONITO:
                 pcibadaddr = BONITO_PCIBADADDR;
                 pcimstat = BONITO_PCIMSTAT;
                 intisr = BONITO_INTISR;
index 7873932532a10b9fc2c8186bf6bfdca2d6ef3923..8f1b78dfd89f1a0235b33294588b301336e54bc8 100644 (file)
@@ -56,6 +56,12 @@ const char *get_system_type(void)
        return "MIPS Malta";
 }
 
+#if defined(CONFIG_MIPS_MT_SMTC)
+const char display_string[] = "       SMTC LINUX ON MALTA       ";
+#else
+const char display_string[] = "        LINUX ON MALTA       ";
+#endif /* CONFIG_MIPS_MT_SMTC */
+
 #ifdef CONFIG_BLK_DEV_FD
 void __init fd_activate(void)
 {
@@ -97,9 +103,7 @@ void __init plat_mem_setup(void)
        kgdb_config ();
 #endif
 
-       if ((mips_revision_corid == MIPS_REVISION_CORID_BONITO64) ||
-           (mips_revision_corid == MIPS_REVISION_CORID_CORE_20K) ||
-           (mips_revision_corid == MIPS_REVISION_CORID_CORE_EMUL_BON)) {
+       if (mips_revision_sconid == MIPS_REVISION_SCON_BONITO) {
                char *argptr;
 
                argptr = prom_getcmdline();
index a189dec7c7bc8603ebecce5eab41570144ca236e..811aba100605aa53711930e400f21f82b17cac15 100644 (file)
@@ -43,6 +43,8 @@ const char *get_system_type(void)
        return "MIPS SEAD";
 }
 
+const char display_string[] = "        LINUX ON SEAD       ";
+
 void __init plat_mem_setup(void)
 {
        ioport_resource.end = 0x7fffffff;
index f0eb29917d9aa3443a44c404f7ca3b5762eb0a99..76903c7276475145fa1661ae8d08df5bde458747 100644 (file)
@@ -168,8 +168,9 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
                addr = (unsigned long) page_address(sg->page);
                if (!plat_device_is_coherent(dev) && addr)
                        __dma_sync(addr + sg->offset, sg->length, direction);
-               sg->dma_address = plat_map_dma_mem_page(dev, sg->page) +
-                                 sg->offset;
+               sg->dma_address = plat_map_dma_mem(dev,
+                                                  (void *)(addr + sg->offset),
+                                                  sg->length);
        }
 
        return nents;
index 4f94fa261aae37a1fbe64e2000dd9b76a5bf2bec..1ea5c9c1010b19610943012838f5b9a00fdb5964 100644 (file)
@@ -177,7 +177,10 @@ static int mipsxx_perfcount_handler(void)
        unsigned int counters = op_model_mipsxx_ops.num_counters;
        unsigned int control;
        unsigned int counter;
-       int handled = 0;
+       int handled = IRQ_NONE;
+
+       if (cpu_has_mips_r2 && !(read_c0_cause() & (1 << 26)))
+               return handled;
 
        switch (counters) {
 #define HANDLE_COUNTER(n)                                              \
@@ -188,7 +191,7 @@ static int mipsxx_perfcount_handler(void)
                    (counter & M_COUNTER_OVERFLOW)) {                   \
                        oprofile_add_sample(get_irq_regs(), n);         \
                        w_c0_perfcntr ## n(reg.counter[n]);             \
-                       handled = 1;                                    \
+                       handled = IRQ_HANDLED;                          \
                }
        HANDLE_COUNTER(3)
        HANDLE_COUNTER(2)
index f5ea2fe10f141d598b70a85f3d6514b73c54331c..89891e984b3bc3c67f0c66ee81a65bb691311941 100644 (file)
@@ -7,8 +7,6 @@
 #include <asm/system.h>
 #include <asm/time.h>
 
-extern asmlinkage void qemu_handle_int(void);
-
 asmlinkage void plat_irq_dispatch(void)
 {
        unsigned int pending = read_c0_status() & read_c0_cause();
index fe8a1066aec136ffe520e1c07130a3f3f274f25a..e5e023f50a07d3f01b74361af21038f31ab05730 100644 (file)
@@ -517,7 +517,7 @@ void __init paging_init(void)
                pfn_t start_pfn = slot_getbasepfn(node, 0);
                pfn_t end_pfn = node_getmaxclick(node) + 1;
 
-               zones_size[ZONE_DMA] = end_pfn - start_pfn;
+               zones_size[ZONE_NORMAL] = end_pfn - start_pfn;
                free_area_init_node(node, NODE_DATA(node),
                                zones_size, start_pfn, NULL);
 
index 9ee208daa8b12f238adb47a4d796f4706b5fff2a..97b234361b4d0afa8d5c0b64434c2bf07a253292 100644 (file)
@@ -6,7 +6,7 @@
  * for more details.
  *
  * Copyright (C) 1996, 97, 98, 2000, 03, 04, 06 Ralf Baechle (ralf@linux-mips.org)
- * Copyright (C) 2006 Thomas Bogendoerfer (tsbogend@alpha.franken.de)
+ * Copyright (C) 2006,2007 Thomas Bogendoerfer (tsbogend@alpha.franken.de)
  */
 
 #include <linux/init.h>
@@ -131,6 +131,19 @@ static struct resource pcimt_io_resources[] = {
        }
 };
 
+static struct resource pcimt_mem_resources[] = {
+       {
+               /*
+                * this region should only be 4 bytes long,
+                * but it's 16MB on all RM300C I've checked
+                */
+               .start  = 0x1a000000,
+               .end    = 0x1affffff,
+               .name   = "PCI INT ACK",
+               .flags  = IORESOURCE_BUSY
+       }
+};
+
 static struct resource sni_mem_resource = {
        .start  = 0x18000000UL,
        .end    = 0x1fbfffffUL,
@@ -145,6 +158,9 @@ static void __init sni_pcimt_resource_init(void)
        /* request I/O space for devices used on all i[345]86 PCs */
        for (i = 0; i < ARRAY_SIZE(pcimt_io_resources); i++)
                request_resource(&sni_io_resource, pcimt_io_resources + i);
+       /* request MEM space for devices used on all i[345]86 PCs */
+       for (i = 0; i < ARRAY_SIZE(pcimt_mem_resources); i++)
+               request_resource(&sni_mem_resource, pcimt_mem_resources + i);
 }
 
 extern struct pci_ops sni_pcimt_ops;
index 68d7cf609b4fcabd36396ec85c4838b203ff1f89..4fedfbda0c791b71a8ccfa94080fa80c6a0eee27 100644 (file)
@@ -6,7 +6,7 @@
  * for more details.
  *
  * Copyright (C) 1996, 97, 98, 2000, 03, 04, 06 Ralf Baechle (ralf@linux-mips.org)
- * Copyright (C) 2006 Thomas Bogendoerfer (tsbogend@alpha.franken.de)
+ * Copyright (C) 2006,2007 Thomas Bogendoerfer (tsbogend@alpha.franken.de)
  */
 #include <linux/eisa.h>
 #include <linux/init.h>
@@ -92,3 +92,34 @@ void __init plat_mem_setup(void)
 
        sni_display_setup();
 }
+
+#if CONFIG_PCI
+
+#include <linux/pci.h>
+#include <video/vga.h>
+#include <video/cirrus.h>
+
+static void __devinit quirk_cirrus_ram_size(struct pci_dev *dev)
+{
+       u16 cmd;
+
+       /*
+        * firmware doesn't set the ram size correct, so we
+        * need to do it here, otherwise we get screen corruption
+        * on older Cirrus chips
+        */
+       pci_read_config_word (dev, PCI_COMMAND, &cmd);
+       if ((cmd & (PCI_COMMAND_IO|PCI_COMMAND_MEMORY))
+               == (PCI_COMMAND_IO|PCI_COMMAND_MEMORY)) {
+               vga_wseq (NULL, CL_SEQR6, 0x12);        /* unlock all extension registers */
+               vga_wseq (NULL, CL_SEQRF, 0x18);
+       }
+}
+
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_5434_8,
+                        quirk_cirrus_ram_size);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_5436,
+                        quirk_cirrus_ram_size);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_5446,
+                        quirk_cirrus_ram_size);
+#endif
index d86e15776779e55b8110215f1fb58a1da7f860ee..f2042e6466a4086e8845759bf70639572d9575c6 100644 (file)
@@ -21,6 +21,7 @@
  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/sched.h>
 #include <linux/file.h>
@@ -69,7 +70,6 @@ struct getdents_callback {
 };
 
 #define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
-#define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1))
 
 static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
                u64 ino, unsigned d_type)
@@ -77,7 +77,7 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
        struct hpux_dirent __user * dirent;
        struct getdents_callback * buf = (struct getdents_callback *) __buf;
        ino_t d_ino;
-       int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
+       int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 1, sizeof(long));
 
        buf->error = -EINVAL;   /* only used if we fail.. */
        if (reclen > buf->count)
@@ -102,7 +102,6 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
 }
 
 #undef NAME_OFFSET
-#undef ROUND_UP
 
 int hpux_getdents(unsigned int fd, struct hpux_dirent __user *dirent, unsigned int count)
 {
index 8474f9e5ca1032cf16eb2d3c8d8df0262dd0b173..42598abf45763ccd4c9d2c4b1f2970eb6be8b50f 100644 (file)
@@ -954,21 +954,6 @@ intr_return:
        /* NOTE: Need to enable interrupts incase we schedule. */
        ssm     PSW_SM_I, %r0
 
-       /* Check for software interrupts */
-
-       .import irq_stat,data
-
-       load32  irq_stat,%r19
-#ifdef CONFIG_SMP
-       mfctl   %cr30,%r1
-       ldw     TI_CPU(%r1),%r1 /* get cpu # - int */
-       /* shift left ____cacheline_aligned (aka L1_CACHE_BYTES) amount
-       ** irq_stat[] is defined using ____cacheline_aligned.
-       */
-       SHLREG  %r1,L1_CACHE_SHIFT,%r20
-       add     %r19,%r20,%r19  /* now have &irq_stat[smp_processor_id()] */
-#endif /* CONFIG_SMP */
-
 intr_check_resched:
 
        /* check for reschedule */
@@ -2034,10 +2019,9 @@ ENTRY(syscall_exit)
        STREG     %r28,TASK_PT_GR28(%r1)
 
 #ifdef CONFIG_HPUX
-
 /* <linux/personality.h> cannot be easily included */
 #define PER_HPUX 0x10
-       LDREG     TASK_PERSONALITY(%r1),%r19
+       ldw     TASK_PERSONALITY(%r1),%r19
 
        /* We can't use "CMPIB<> PER_HPUX" since "im5" field is sign extended */
        ldo       -PER_HPUX(%r19), %r19
@@ -2055,24 +2039,6 @@ ENTRY(syscall_exit)
         */
        loadgp
 
-syscall_check_bh:
-
-       /* Check for software interrupts */
-
-       .import irq_stat,data
-
-       load32  irq_stat,%r19
-
-#ifdef CONFIG_SMP
-       /* sched.h: int processor */
-       /* %r26 is used as scratch register to index into irq_stat[] */
-       ldw     TI_CPU-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r26 /* cpu # */
-
-       /* shift left ____cacheline_aligned (aka L1_CACHE_BYTES) bits */
-       SHLREG  %r26,L1_CACHE_SHIFT,%r20
-       add     %r19,%r20,%r19  /* now have &irq_stat[smp_processor_id()] */
-#endif /* CONFIG_SMP */
-
 syscall_check_resched:
 
        /* check for reschedule */
@@ -2114,7 +2080,7 @@ syscall_restore:
        /* Are we being ptraced? */
        LDREG   TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1
 
-       LDREG   TASK_PTRACE(%r1), %r19
+       ldw     TASK_PTRACE(%r1), %r19
        bb,<    %r19,31,syscall_restore_rfi
        nop
 
@@ -2244,7 +2210,7 @@ syscall_do_resched:
 #else
        nop
 #endif
-       b       syscall_check_bh  /* if resched, we start over again */
+       b       syscall_check_resched   /* if resched, we start over again */
        nop
 ENDPROC(syscall_exit)
 
index 39dc835bf89ed8c5e54ef2e52dd6389a44b60b07..fd6552c4c08c11405adc9b80ce8aab35305c2f8b 100644 (file)
@@ -634,7 +634,7 @@ EXPORT_SYMBOL(pdc_lan_station_id);
  * pdc_stable_read - Read data from Stable Storage.
  * @staddr: Stable Storage address to access.
  * @memaddr: The memory address where Stable Storage data shall be copied.
- * @count: number of bytes to transfert. count is multiple of 4.
+ * @count: number of bytes to transfer. count is multiple of 4.
  *
  * This PDC call reads from the Stable Storage address supplied in staddr
  * and copies count bytes to the memory address memaddr.
@@ -660,7 +660,7 @@ EXPORT_SYMBOL(pdc_stable_read);
  * pdc_stable_write - Write data to Stable Storage.
  * @staddr: Stable Storage address to access.
  * @memaddr: The memory address where Stable Storage data shall be read from.
- * @count: number of bytes to transfert. count is multiple of 4.
+ * @count: number of bytes to transfer. count is multiple of 4.
  *
  * This PDC call reads count bytes from the supplied memaddr address,
  * and copies count bytes to the Stable Storage address staddr.
index 18ba4cb9159b22a2d3ae1f3462e3761336a76a97..04848b2b381c40c8cc10e387281baf66dfc9c3c6 100644 (file)
@@ -38,7 +38,7 @@
  *     so don't reference this table after starting the init process
  */
  
-static struct hp_hardware hp_hardware_list[] __initdata = {
+static struct hp_hardware hp_hardware_list[] __devinitdata = {
        {HPHW_NPROC,0x01,0x4,0x0,"Indigo (840, 930)"},
        {HPHW_NPROC,0x8,0x4,0x01,"Firefox(825,925)"},
        {HPHW_NPROC,0xA,0x4,0x01,"Top Gun (835,834,935,635)"},
@@ -1219,7 +1219,7 @@ static struct hp_cpu_type_mask {
        unsigned short model;
        unsigned short mask;
        enum cpu_type cpu;
-} hp_cpu_type_mask_list[] __initdata = {
+} hp_cpu_type_mask_list[] __devinitdata = {
 
        { 0x0000, 0x0ff0, pcx    },  /* 0x0000 - 0x000f */
        { 0x0048, 0x0ff0, pcxl   },  /* 0x0040 - 0x004f */
@@ -1296,10 +1296,11 @@ static struct hp_cpu_type_mask {
        { 0x05f0, 0x0ff0, pcxw2  },  /* 0x05f0 - 0x05ff */
        { 0x0600, 0x0fe0, pcxl   },  /* 0x0600 - 0x061f */
        { 0x0880, 0x0ff0, mako   },  /* 0x0880 - 0x088f */
+       { 0x0890, 0x0ff0, mako2  },  /* 0x0890 - 0x089f */
        { 0x0000, 0x0000, pcx    }      /* terminate table */
 };
 
-char *cpu_name_version[][2] = {
+const char * const cpu_name_version[][2] = {
        [pcx]   = { "PA7000 (PCX)",     "1.0" },
        [pcxs]  = { "PA7000 (PCX-S)",   "1.1a" },
        [pcxt]  = { "PA7100 (PCX-T)",   "1.1b" },
@@ -1311,10 +1312,11 @@ char *cpu_name_version[][2] = {
        [pcxw]  = { "PA8500 (PCX-W)",   "2.0" },
        [pcxw_] = { "PA8600 (PCX-W+)",  "2.0" },
        [pcxw2] = { "PA8700 (PCX-W2)",  "2.0" },
-       [mako]  = { "PA8800 (Mako)",    "2.0" }
+       [mako]  = { "PA8800 (Mako)",    "2.0" },
+       [mako2] = { "PA8900 (Shortfin)",        "2.0" }
 };
 
-const char * __init
+const char * __devinit
 parisc_hardware_description(struct parisc_device_id *id)
 {
        struct hp_hardware *listptr;
@@ -1353,7 +1355,7 @@ parisc_hardware_description(struct parisc_device_id *id)
 
 
 /* Interpret hversion (ret[0]) from PDC_MODEL(4)/PDC_MODEL_INFO(0) */
-enum cpu_type __init
+enum cpu_type __cpuinit
 parisc_get_cpu_type(unsigned long hversion)
 {
        struct hp_cpu_type_mask *ptr;
index d8baa158d8a0a37e560277ce7c550e36d95b7c1c..43b41df0b54106b0c38862ed52762fa4ddc405fd 100644 (file)
@@ -295,8 +295,5 @@ os_hpmc_6:
        b .
        nop
 ENDPROC(os_hpmc)
-
-       /* this label used to compute os_hpmc checksum */
-ENTRY(os_hpmc_end)
-
+ENTRY(os_hpmc_end)     /* this label used to compute os_hpmc checksum */
        nop
index c5c9125dacecff8d58f7f447bf83342993d7dee4..76ce5e3b00505b264f3188fa2329919b3dcbfd45 100644 (file)
@@ -46,14 +46,10 @@ extern irqreturn_t ipi_interrupt(int, void *);
 static volatile unsigned long cpu_eiem = 0;
 
 /*
-** ack bitmap ... habitually set to 1, but reset to zero
+** local ACK bitmap ... habitually set to 1, but reset to zero
 ** between ->ack() and ->end() of the interrupt to prevent
 ** re-interruption of a processing interrupt.
 */
-static volatile unsigned long global_ack_eiem = ~0UL;
-/*
-** Local bitmap, same as above but for per-cpu interrupts
-*/
 static DEFINE_PER_CPU(unsigned long, local_ack_eiem) = ~0UL;
 
 static void cpu_disable_irq(unsigned int irq)
@@ -94,13 +90,11 @@ void cpu_ack_irq(unsigned int irq)
        int cpu = smp_processor_id();
 
        /* Clear in EIEM so we can no longer process */
-       if (CHECK_IRQ_PER_CPU(irq_desc[irq].status))
-               per_cpu(local_ack_eiem, cpu) &= ~mask;
-       else
-               global_ack_eiem &= ~mask;
+       per_cpu(local_ack_eiem, cpu) &= ~mask;
 
        /* disable the interrupt */
-       set_eiem(cpu_eiem & global_ack_eiem & per_cpu(local_ack_eiem, cpu));
+       set_eiem(cpu_eiem & per_cpu(local_ack_eiem, cpu));
+
        /* and now ack it */
        mtctl(mask, 23);
 }
@@ -111,13 +105,10 @@ void cpu_end_irq(unsigned int irq)
        int cpu = smp_processor_id();
 
        /* set it in the eiems---it's no longer in process */
-       if (CHECK_IRQ_PER_CPU(irq_desc[irq].status))
-               per_cpu(local_ack_eiem, cpu) |= mask;
-       else
-               global_ack_eiem |= mask;
+       per_cpu(local_ack_eiem, cpu) |= mask;
 
        /* enable the interrupt */
-       set_eiem(cpu_eiem & global_ack_eiem & per_cpu(local_ack_eiem, cpu));
+       set_eiem(cpu_eiem & per_cpu(local_ack_eiem, cpu));
 }
 
 #ifdef CONFIG_SMP
@@ -354,8 +345,7 @@ void do_cpu_irq_mask(struct pt_regs *regs)
        local_irq_disable();
        irq_enter();
 
-       eirr_val = mfctl(23) & cpu_eiem & global_ack_eiem &
-               per_cpu(local_ack_eiem, cpu);
+       eirr_val = mfctl(23) & cpu_eiem & per_cpu(local_ack_eiem, cpu);
        if (!eirr_val)
                goto set_out;
        irq = eirr_to_irq(eirr_val);
@@ -381,7 +371,7 @@ void do_cpu_irq_mask(struct pt_regs *regs)
        return;
 
  set_out:
-       set_eiem(cpu_eiem & global_ack_eiem & per_cpu(local_ack_eiem, cpu));
+       set_eiem(cpu_eiem & per_cpu(local_ack_eiem, cpu));
        goto out;
 }
 
index 0c3aecb85a5ccb344ffe8d0f391f6ebaebbf17a6..23c1388df1f55c5e2a34459ace9e08f336dad2df 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/mm.h>
 #include <linux/pci.h>
 #include <linux/proc_fs.h>
+#include <linux/seq_file.h>
 #include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/types.h>
@@ -34,7 +35,6 @@
 #include <asm/tlbflush.h>      /* for purge_tlb_*() macros */
 
 static struct proc_dir_entry * proc_gsc_root __read_mostly = NULL;
-static int pcxl_proc_info(char *buffer, char **start, off_t offset, int length);
 static unsigned long pcxl_used_bytes __read_mostly = 0;
 static unsigned long pcxl_used_pages __read_mostly = 0;
 
@@ -330,6 +330,54 @@ pcxl_free_range(unsigned long vaddr, size_t size)
        dump_resmap();
 }
 
+static int proc_pcxl_dma_show(struct seq_file *m, void *v)
+{
+#if 0
+       u_long i = 0;
+       unsigned long *res_ptr = (u_long *)pcxl_res_map;
+#endif
+       unsigned long total_pages = pcxl_res_size << 3;   /* 8 bits per byte */
+
+       seq_printf(m, "\nDMA Mapping Area size    : %d bytes (%ld pages)\n",
+               PCXL_DMA_MAP_SIZE, total_pages);
+
+       seq_printf(m, "Resource bitmap : %d bytes\n", pcxl_res_size);
+
+       seq_puts(m,  "            total:    free:    used:   % used:\n");
+       seq_printf(m, "blocks  %8d %8ld %8ld %8ld%%\n", pcxl_res_size,
+               pcxl_res_size - pcxl_used_bytes, pcxl_used_bytes,
+               (pcxl_used_bytes * 100) / pcxl_res_size);
+
+       seq_printf(m, "pages   %8ld %8ld %8ld %8ld%%\n", total_pages,
+               total_pages - pcxl_used_pages, pcxl_used_pages,
+               (pcxl_used_pages * 100 / total_pages));
+
+#if 0
+       seq_puts(m, "\nResource bitmap:");
+
+       for(; i < (pcxl_res_size / sizeof(u_long)); ++i, ++res_ptr) {
+               if ((i & 7) == 0)
+                   seq_puts(m,"\n   ");
+               seq_printf(m, "%s %08lx", buf, *res_ptr);
+       }
+#endif
+       seq_putc(m, '\n');
+       return 0;
+}
+
+static int proc_pcxl_dma_open(struct inode *inode, struct file *file)
+{
+       return single_open(file, proc_pcxl_dma_show, NULL);
+}
+
+static const struct file_operations proc_pcxl_dma_ops = {
+       .owner          = THIS_MODULE,
+       .open           = proc_pcxl_dma_open,
+       .read           = seq_read,
+       .llseek         = seq_lseek,
+       .release        = single_release,
+};
+
 static int __init
 pcxl_dma_init(void)
 {
@@ -348,9 +396,10 @@ pcxl_dma_init(void)
                        "pcxl_dma_init: Unable to create gsc /proc dir entry\n");
        else {
                struct proc_dir_entry* ent;
-               ent = create_proc_info_entry("pcxl_dma", 0,
-                               proc_gsc_root, pcxl_proc_info);
-               if (!ent)
+               ent = create_proc_entry("pcxl_dma", 0, proc_gsc_root);
+               if (ent)
+                       ent->proc_fops = &proc_pcxl_dma_ops;
+               else
                        printk(KERN_WARNING
                                "pci-dma.c: Unable to create pcxl_dma /proc entry.\n");
        }
@@ -551,40 +600,3 @@ struct hppa_dma_ops pcx_dma_ops = {
        .dma_sync_sg_for_cpu =          pa11_dma_sync_sg_for_cpu,
        .dma_sync_sg_for_device =       pa11_dma_sync_sg_for_device,
 };
-
-
-static int pcxl_proc_info(char *buf, char **start, off_t offset, int len)
-{
-#if 0
-       u_long i = 0;
-       unsigned long *res_ptr = (u_long *)pcxl_res_map;
-#endif
-       unsigned long total_pages = pcxl_res_size << 3;   /* 8 bits per byte */
-
-       sprintf(buf, "\nDMA Mapping Area size    : %d bytes (%ld pages)\n",
-               PCXL_DMA_MAP_SIZE, total_pages);
-       
-       sprintf(buf, "%sResource bitmap : %d bytes\n", buf, pcxl_res_size);
-
-       strcat(buf,  "            total:    free:    used:   % used:\n");
-       sprintf(buf, "%sblocks  %8d %8ld %8ld %8ld%%\n", buf, pcxl_res_size,
-               pcxl_res_size - pcxl_used_bytes, pcxl_used_bytes,
-               (pcxl_used_bytes * 100) / pcxl_res_size);
-
-       sprintf(buf, "%spages   %8ld %8ld %8ld %8ld%%\n", buf, total_pages,
-               total_pages - pcxl_used_pages, pcxl_used_pages,
-               (pcxl_used_pages * 100 / total_pages));
-
-#if 0
-       strcat(buf, "\nResource bitmap:");
-
-       for(; i < (pcxl_res_size / sizeof(u_long)); ++i, ++res_ptr) {
-               if ((i & 7) == 0)
-                   strcat(buf,"\n   ");
-               sprintf(buf, "%s %08lx", buf, *res_ptr);
-       }
-#endif
-       strcat(buf, "\n");
-       return strlen(buf);
-}
-
index a46bc62b643e46373144142f7c010a3644f41a19..89d6d5ad44b5258f4ff61ae487c8ed1020bf115b 100644 (file)
@@ -171,7 +171,7 @@ static const uint64_t perf_bitmasks[] = {
 
 /*
  * Write control bitmasks for Pa-8700 processor given
- * somethings have changed slightly.
+ * some things have changed slightly.
  */
 static const uint64_t perf_bitmasks_piranha[] = {
        0x0000000000000000ul,     /* first dbl word must be zero */
@@ -511,10 +511,12 @@ static int __init perf_init(void)
        } else if (boot_cpu_data.cpu_type == pcxw ||
                 boot_cpu_data.cpu_type == pcxw_ ||
                 boot_cpu_data.cpu_type == pcxw2 ||
-                boot_cpu_data.cpu_type == mako) {
+                boot_cpu_data.cpu_type == mako ||
+                boot_cpu_data.cpu_type == mako2) {
                perf_processor_interface = CUDA_INTF;
                if (boot_cpu_data.cpu_type == pcxw2 ||
-                   boot_cpu_data.cpu_type == mako) 
+                   boot_cpu_data.cpu_type == mako ||
+                   boot_cpu_data.cpu_type == mako2)
                        bitmask_array = perf_bitmasks_piranha;
        } else {
                perf_processor_interface = UNKNOWN_INTF;
@@ -574,27 +576,27 @@ static int perf_stop_counters(uint32_t *raddr)
                if (!perf_rdr_read_ubuf(16, userbuf))
                        return -13;
 
-               /* Counter0 is bits 1398 thru 1429 */
+               /* Counter0 is bits 1398 to 1429 */
                tmp64 =  (userbuf[21] << 22) & 0x00000000ffc00000;
                tmp64 |= (userbuf[22] >> 42) & 0x00000000003fffff;
                /* OR sticky0 (bit 1430) to counter0 bit 32 */
                tmp64 |= (userbuf[22] >> 10) & 0x0000000080000000;
                raddr[0] = (uint32_t)tmp64;
 
-               /* Counter1 is bits 1431 thru 1462 */
+               /* Counter1 is bits 1431 to 1462 */
                tmp64 =  (userbuf[22] >> 9) & 0x00000000ffffffff;
                /* OR sticky1 (bit 1463) to counter1 bit 32 */
                tmp64 |= (userbuf[22] << 23) & 0x0000000080000000;
                raddr[1] = (uint32_t)tmp64;
 
-               /* Counter2 is bits 1464 thru 1495 */
+               /* Counter2 is bits 1464 to 1495 */
                tmp64 =  (userbuf[22] << 24) & 0x00000000ff000000;
                tmp64 |= (userbuf[23] >> 40) & 0x0000000000ffffff;
                /* OR sticky2 (bit 1496) to counter2 bit 32 */
                tmp64 |= (userbuf[23] >> 8) & 0x0000000080000000;
                raddr[2] = (uint32_t)tmp64;
                
-               /* Counter3 is bits 1497 thru 1528 */
+               /* Counter3 is bits 1497 to 1528 */
                tmp64 =  (userbuf[23] >> 7) & 0x00000000ffffffff;
                /* OR sticky3 (bit 1529) to counter3 bit 32 */
                tmp64 |= (userbuf[23] << 25) & 0x0000000080000000;
@@ -616,7 +618,7 @@ static int perf_stop_counters(uint32_t *raddr)
                userbuf[23] = 0;
 
                /* 
-                * Write back the zero'ed bytes + the image given
+                * Write back the zeroed bytes + the image given
                 * the read was destructive.
                 */
                perf_rdr_write(16, userbuf);
index 0dd3847f494c390f78563ea2c450d7e90cfa918d..355664812b8319e1d0c9b01115fd4dbe162f8dc2 100644 (file)
@@ -381,6 +381,10 @@ get_wchan(struct task_struct *p)
        struct unwind_frame_info info;
        unsigned long ip;
        int count = 0;
+
+       if (!p || p == current || p->state == TASK_RUNNING)
+               return 0;
+
        /*
         * These bracket the sleeping functions..
         */
index 566226d78bc9c522f6ecb3f958fc603297431166..549f5484342c7d6e812edd457bf2c2475ec93fa1 100644 (file)
@@ -63,7 +63,7 @@ extern int update_cr16_clocksource(void);     /* from time.c */
 ** will call register_parisc_driver(&cpu_driver) before calling do_inventory().
 **
 ** The goal of consolidating CPU initialization into one place is
-** to make sure all CPU's get initialized the same way.
+** to make sure all CPUs get initialized the same way.
 ** The code path not shared is how PDC hands control of the CPU to the OS.
 ** The initialization of OS data structures is the same (done below).
 */
@@ -76,7 +76,7 @@ extern int update_cr16_clocksource(void);     /* from time.c */
  * (return 1).  If so, initialize the chip and tell other partners in crime 
  * they have work to do.
  */
-static int __init processor_probe(struct parisc_device *dev)
+static int __cpuinit processor_probe(struct parisc_device *dev)
 {
        unsigned long txn_addr;
        unsigned long cpuid;
@@ -166,7 +166,7 @@ static int __init processor_probe(struct parisc_device *dev)
 #endif
 
        /*
-       ** CONFIG_SMP: init_smp_config() will attempt to get CPU's into
+       ** CONFIG_SMP: init_smp_config() will attempt to get CPUs into
        ** OS control. RENDEZVOUS is the default state - see mem_set above.
        **      p->state = STATE_RENDEZVOUS;
        */
@@ -334,7 +334,7 @@ int __init init_per_cpu(int cpunum)
 }
 
 /*
- * Display cpu info for all cpu's.
+ * Display CPU info for all CPUs.
  */
 int
 show_cpuinfo (struct seq_file *m, void *v)
@@ -381,19 +381,19 @@ show_cpuinfo (struct seq_file *m, void *v)
        return 0;
 }
 
-static struct parisc_device_id processor_tbl[] __read_mostly = {
+static const struct parisc_device_id processor_tbl[] = {
        { HPHW_NPROC, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, SVERSION_ANY_ID },
        { 0, }
 };
 
-static struct parisc_driver cpu_driver __read_mostly = {
+static struct parisc_driver cpu_driver = {
        .name           = "CPU",
        .id_table       = processor_tbl,
        .probe          = processor_probe
 };
 
 /**
- * processor_init - Processor initalization procedure.
+ * processor_init - Processor initialization procedure.
  *
  * Register this driver.
  */
index 9818919571fd2004cd1e01bcd53a7a56eddd1690..c44b8c51f5d1ef82f542f8f35e56d7fb2d9ec7a3 100644 (file)
@@ -45,7 +45,7 @@
 #include <asm/io.h>
 #include <asm/setup.h>
 
-char   __initdata command_line[COMMAND_LINE_SIZE];
+static char __initdata command_line[COMMAND_LINE_SIZE];
 
 /* Intended for ccio/sba/cpu statistics under /proc/bus/{runway|gsc} */
 struct proc_dir_entry * proc_runway_root __read_mostly = NULL;
@@ -162,7 +162,7 @@ void __init setup_arch(char **cmdline_p)
 }
 
 /*
- * Display cpu info for all cpu's.
+ * Display CPU info for all CPUs.
  * for parisc this is in processor.c
  */
 extern int show_cpuinfo (struct seq_file *m, void *v);
@@ -225,6 +225,7 @@ static void __init parisc_proc_mkdir(void)
                 }
                 break;
        case mako:
+       case mako2:
                 if (NULL == proc_mckinley_root)
                 {
                         proc_mckinley_root = proc_mkdir("bus/mckinley", NULL);
index e39b38a67a87273cb2217143deadd37a8b56ce8e..c7800846422c3ba623372504437ced3ca0961c52 100644 (file)
@@ -113,7 +113,7 @@ int copy_siginfo_from_user32 (siginfo_t *to, compat_siginfo_t __user *from);
 /* In a deft move of uber-hackery, we decide to carry the top half of all
  * 64-bit registers in a non-portable, non-ABI, hidden structure.
  * Userspace can read the hidden structure if it *wants* but is never
- * guaranteed to be in the same place. Infact the uc_sigmask from the
+ * guaranteed to be in the same place. In fact the uc_sigmask from the
  * ucontext_t structure may push the hidden register file downards
  */
 struct compat_regfile {
index 6ba9257fdb7f196587f1198398ee215d394a08fc..04c7e1d36cea781713e979f5e2e0755a5c961e65 100644 (file)
@@ -8,7 +8,7 @@
 ** Lots of stuff stolen from arch/alpha/kernel/smp.c
 ** ...and then parisc stole from arch/ia64/kernel/smp.c. Thanks David! :^)
 **
-** Thanks to John Curry and Ullas Ponnadi. I learned alot from their work.
+** Thanks to John Curry and Ullas Ponnadi. I learned a lot from their work.
 ** -grant (1/12/2001)
 **
 **     This program is free software; you can redistribute it and/or modify
@@ -419,7 +419,7 @@ smp_cpu_init(int cpunum)
                BUG();
        enter_lazy_tlb(&init_mm, current);
 
-       init_IRQ();   /* make sure no IRQ's are enabled or pending */
+       init_IRQ();   /* make sure no IRQs are enabled or pending */
        start_cpu_itimer();
 }
 
@@ -461,7 +461,7 @@ void __init smp_callin(void)
 /*
  * Bring one cpu online.
  */
-int __init smp_boot_one_cpu(int cpuid)
+int __cpuinit smp_boot_one_cpu(int cpuid)
 {
        struct task_struct *idle;
        long timeout;
@@ -552,7 +552,7 @@ void __devinit smp_prepare_boot_cpu(void)
 
 /*
 ** inventory.c:do_inventory() hasn't yet been run and thus we
-** don't 'discover' the additional CPU's until later.
+** don't 'discover' the additional CPUs until later.
 */
 void __init smp_prepare_cpus(unsigned int max_cpus)
 {
index ce3245f87fddf832f9385a53b691ae7585a7d2a4..bb23ff71c28e31f7f4fae940e701710dbbbabd06 100644 (file)
@@ -311,14 +311,13 @@ struct readdir32_callback {
        int count;
 };
 
-#define ROUND_UP(x,a)  ((__typeof__(x))(((unsigned long)(x) + ((a) - 1)) & ~((a) - 1)))
 #define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
 static int filldir32 (void *__buf, const char *name, int namlen,
                        loff_t offset, u64 ino, unsigned int d_type)
 {
        struct linux32_dirent __user * dirent;
        struct getdents32_callback * buf = (struct getdents32_callback *) __buf;
-       int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1, 4);
+       int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 1, 4);
        u32 d_ino;
 
        buf->error = -EINVAL;   /* only used if we fail.. */
@@ -350,6 +349,10 @@ sys32_getdents (unsigned int fd, void __user * dirent, unsigned int count)
        struct getdents32_callback buf;
        int error;
 
+       error = -EFAULT;
+       if (!access_ok(VERIFY_WRITE, dirent, count))
+               goto out;
+
        error = -EBADF;
        file = fget(fd);
        if (!file)
@@ -366,8 +369,10 @@ sys32_getdents (unsigned int fd, void __user * dirent, unsigned int count)
        error = buf.error;
        lastdirent = buf.previous;
        if (lastdirent) {
-               put_user(file->f_pos, &lastdirent->d_off);
-               error = count - buf.count;
+               if (put_user(file->f_pos, &lastdirent->d_off))
+                       error = -EFAULT;
+               else
+                       error = count - buf.count;
        }
 
 out_putf:
index 10859f53e94f363799ddd2fe504e511585af6a32..56f6231cb863e97ca9c74781ccaea83e1fc063aa 100644 (file)
@@ -181,7 +181,7 @@ linux_gateway_entry:
        /* Are we being ptraced? */
        mfctl   %cr30, %r1
        LDREG   TI_TASK(%r1),%r1
-       LDREG   TASK_PTRACE(%r1), %r1
+       ldw     TASK_PTRACE(%r1), %r1
        bb,<,n  %r1,31,.Ltracesys
        
        /* Note!  We cannot use the syscall table that is mapped
@@ -198,7 +198,7 @@ linux_gateway_entry:
        ldil    L%sys_call_table, %r1
        ldo     R%sys_call_table(%r1), %r19
 #endif 
-       comiclr,>>=     __NR_Linux_syscalls, %r20, %r0
+       comiclr,>>      __NR_Linux_syscalls, %r20, %r0
        b,n     .Lsyscall_nosys
        
        LDREGX  %r20(%r19), %r19
@@ -501,7 +501,7 @@ lws_compare_and_swap:
        shlw    %r20, 4, %r20
        add     %r20, %r28, %r20
 
-# ifdef ENABLE_LWS_DEBUG
+# if ENABLE_LWS_DEBUG
        /*      
                DEBUG, check for deadlock! 
                If the thread register values are the same
@@ -550,7 +550,7 @@ cas_wouldblock:
                perspective
        */
 cas_action:
-#if defined CONFIG_SMP && defined ENABLE_LWS_DEBUG
+#if defined CONFIG_SMP && ENABLE_LWS_DEBUG
        /* DEBUG */
        mfctl   %cr27, %r1
        stw     %r1, 4(%sr2,%r20)
@@ -562,7 +562,7 @@ cas_action:
 #ifdef CONFIG_SMP
        /* Free lock */
        stw     %r20, 0(%sr2,%r20)
-# ifdef ENABLE_LWS_DEBUG
+# if ENABLE_LWS_DEBUG
        /* Clear thread register indicator */
        stw     %r0, 4(%sr2,%r20)
 # endif
@@ -576,7 +576,7 @@ cas_action:
 #ifdef CONFIG_SMP
        /* Free lock */
        stw     %r20, 0(%sr2,%r20)
-# ifdef ENABLE_LWS_DEBUG
+# if ENABLE_LWS_DEBUG
        stw     %r0, 4(%sr2,%r20)
 # endif
 #endif
index 8bf87e5d9c376ec6c187c8e444d377cad1484748..627f3c28ad8cf6e2964effcc92d55200aeaf08ed 100644 (file)
  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#undef ENTRY_SAME
-#undef ENTRY_DIFF
-#undef ENTRY_UHOH
-#undef ENTRY_COMP
-#undef ENTRY_OURS
 #if defined(CONFIG_64BIT) && !defined(SYSCALL_TABLE_64BIT)
 /* Use ENTRY_SAME for 32-bit syscalls which are the same on wide and
  * narrow palinux.  Use ENTRY_DIFF for those where a 32-bit specific
        ENTRY_SAME(epoll_pwait)
        ENTRY_COMP(statfs64)
        ENTRY_COMP(fstatfs64)
+       ENTRY_COMP(kexec_load)          /* 300 */
+       ENTRY_COMP(utimensat)
+       ENTRY_COMP(signalfd)
+       ENTRY_COMP(timerfd)
+       ENTRY_SAME(eventfd)
+
        /* Nothing yet */
 
+#undef ENTRY_SAME
+#undef ENTRY_DIFF
+#undef ENTRY_UHOH
+#undef ENTRY_COMP
+#undef ENTRY_OURS
index 07a991aa9b0c2ba6f81aa8f937c3d0039f4cf92a..8b3062a5c81235c4f938e6a3347f47fbfa76360d 100644 (file)
@@ -191,7 +191,7 @@ int update_cr16_clocksource(void)
 {
        int change = 0;
 
-       /* since the cr16 cycle counters are not syncronized across CPUs,
+       /* since the cr16 cycle counters are not synchronized across CPUs,
           we'll check if we should switch to a safe clocksource: */
        if (clocksource_cr16.rating != 0 && num_online_cpus() > 1) {
                clocksource_change_rating(&clocksource_cr16, 0);
index 745ff741490ae122ea9be8de1f3fa91bc690457a..c3ec9f1ec0f3462d8d0cd3b81824c8bc9a61d8d2 100644 (file)
@@ -615,7 +615,7 @@ void handle_interruption(int code, struct pt_regs *regs)
                
        case 13:
                /* Conditional Trap
-                  The condition succees in an instruction which traps 
+                  The condition succeeds in an instruction which traps
                   on condition  */
                if(user_mode(regs)){
                        si.si_signo = SIGFPE;
@@ -802,13 +802,14 @@ void handle_interruption(int code, struct pt_regs *regs)
 
 int __init check_ivt(void *iva)
 {
+       extern const u32 os_hpmc[];
+       extern const u32 os_hpmc_end[];
+
        int i;
        u32 check = 0;
        u32 *ivap;
        u32 *hpmcp;
        u32 length;
-       extern void os_hpmc(void);
-       extern void os_hpmc_end(void);
 
        if (strcmp((char *)iva, "cows can fly"))
                return -1;
@@ -820,7 +821,7 @@ int __init check_ivt(void *iva)
 
        /* Compute Checksum for HPMC handler */
 
-       length = (u32)((unsigned long)os_hpmc_end - (unsigned long)os_hpmc);
+       length = os_hpmc_end - os_hpmc;
        ivap[7] = length;
 
        hpmcp = (u32 *)os_hpmc;
index 89c03707eccc82dcf7dcb9d2b332a275b7b74f4b..e70f57e27643a0743254cfbf793c4b575b6a415c 100644 (file)
@@ -216,8 +216,10 @@ static void unwind_frame_regs(struct unwind_frame_info *info)
                /* Handle some frequent special cases.... */
                {
                        char symname[KSYM_NAME_LEN+1];
+                       char *modname;
 
-                       kallsyms_lookup(info->ip, NULL, NULL, NULL, symname);
+                       kallsyms_lookup(info->ip, NULL, NULL, &modname,
+                               symname);
 
                        dbg("info->ip = 0x%lx, name = %s\n", info->ip, symname);
 
index 1570e2e0a3270903e19ed6f2daea86e865511686..0c2fa9a951b394e620f42aa84965c763e2dc111f 100644 (file)
@@ -22,7 +22,7 @@
     PA header file -- do not include this header file for non-PA builds.
 #endif
 
-/* 32-bit word grabing functions */
+/* 32-bit word grabbing functions */
 #define Dbl_firstword(value) Dallp1(value)
 #define Dbl_secondword(value) Dallp2(value)
 #define Dbl_thirdword(value) dummy_location
@@ -37,7 +37,7 @@
 #define Dbl_allp1(object) Dallp1(object)
 #define Dbl_allp2(object) Dallp2(object)
 
-/* dbl_and_signs ands the sign bits of each argument and puts the result
+/* dbl_and_signs ANDs the sign bits of each argument and puts the result
  * into the first argument. dbl_or_signs ors those same sign bits */
 #define Dbl_and_signs( src1dst, src2)          \
     Dallp1(src1dst) = (Dallp1(src2)|~((unsigned int)1<<31)) & Dallp1(src1dst)
index b6ed1066f1e4ed5e9e8b493ac1b69784ddd28b2a..9542c6d281a5a6976ea022d98d17e0958626483e 100644 (file)
@@ -76,7 +76,7 @@ dbl_fsqrt(
                 }
                 /*
                  * Return quiet NaN or positive infinity.
-                *  Fall thru to negative test if negative infinity.
+                *  Fall through to negative test if negative infinity.
                  */
                if (Dbl_iszero_sign(srcp1) || 
                    Dbl_isnotzero_mantissa(srcp1,srcp2)) {
index cd3f6db1f6fb963828805a7d9fc943d8450f53a0..4657a12c9107feae35a9b497bf6710b3f3b8a1e3 100644 (file)
@@ -76,7 +76,7 @@ sgl_fsqrt(
                 }
                 /*
                  * Return quiet NaN or positive infinity.
-                *  Fall thru to negative test if negative infinity.
+                *  Fall through to negative test if negative infinity.
                  */
                if (Sgl_iszero_sign(src) || Sgl_isnotzero_mantissa(src)) {
                        *dstptr = src;
index 82519a5c2ba51a1bdbb3d94749ec7e73d3c9e291..4ee4cc95e4bfc7f0a61192fde19b127173ea59a0 100644 (file)
@@ -23,7 +23,7 @@
     PA header file -- do not include this header file for non-PA builds.
 #endif
 
-/* 32-bit word grabing functions */
+/* 32-bit word grabbing functions */
 #define Sgl_firstword(value) Sall(value)
 #define Sgl_secondword(value) dummy_location
 #define Sgl_thirdword(value) dummy_location
@@ -36,7 +36,7 @@
 #define Sgl_exponentmantissa(object) Sexponentmantissa(object)
 #define Sgl_all(object) Sall(object)
 
-/* sgl_and_signs ands the sign bits of each argument and puts the result
+/* sgl_and_signs ANDs the sign bits of each argument and puts the result
  * into the first argument. sgl_or_signs ors those same sign bits */
 #define Sgl_and_signs( src1dst, src2)          \
     Sall(src1dst) = (Sall(src2)|~((unsigned int)1<<31)) & Sall(src1dst)
index 75ea9f2a8a41653fa8e0d31df87e924d3abc0b18..e724b362c49a526de3adb906cd4d079772f471f2 100644 (file)
@@ -890,7 +890,7 @@ void __init paging_init(void)
 #ifdef CONFIG_PA20
 
 /*
- * Currently, all PA20 chips have 18 bit protection id's, which is the
+ * Currently, all PA20 chips have 18 bit protection IDs, which is the
  * limiting factor (space ids are 32 bits).
  */
 
@@ -899,10 +899,10 @@ void __init paging_init(void)
 #else
 
 /*
- * Currently we have a one-to-one relationship between space id's and
- * protection id's. Older parisc chips (PCXS, PCXT, PCXL, PCXL2) only
- * support 15 bit protection id's, so that is the limiting factor.
- * PCXT' has 18 bit protection id's, but only 16 bit spaceids, so it's
+ * Currently we have a one-to-one relationship between space IDs and
+ * protection IDs. Older parisc chips (PCXS, PCXT, PCXL, PCXL2) only
+ * support 15 bit protection IDs, so that is the limiting factor.
+ * PCXT' has 18 bit protection IDs, but only 16 bit spaceids, so it's
  * probably not worth the effort for a special case here.
  */
 
index 5a4215c4b0146aa063fe87c5bb503a398232f6d3..f1c4dfc635be20380d6a718d420cb83b6e4a6068 100644 (file)
@@ -13,6 +13,7 @@
 
        .text
        /* a procedure descriptor used when booting this as a COFF file */
+       .globl  _zimage_start_opd
 _zimage_start_opd:
        .long   _zimage_start, 0, 0, 0
 
index d501c23e5159559ca493caf512e888ca6671e73a..d454f61c9c7c7b5a84c00ef3f66b730e436171ee 100644 (file)
@@ -433,7 +433,7 @@ static int __devinit of_pci_phb_probe(struct of_device *dev,
         * Note also that we don't do ISA, this will also be fixed with a
         * more massive rework.
         */
-       pci_setup_phb_io(phb, 0);
+       pci_setup_phb_io(phb, pci_io_base == 0);
 
        /* Init pci_dn data structures */
        pci_devs_phb_init_dynamic(phb);
index 87703df87509031c6b163065a7afd08cb56ca593..cbca1df8bc60f996edb343bf86a6944ecfdae108 100644 (file)
@@ -151,12 +151,18 @@ static struct console udbg_console = {
 
 static int early_console_initialized;
 
-/* called by setup_system */
+/*
+ * Called by setup_system after ppc_md->probe and ppc_md->early_init.
+ * Call it again after setting udbg_putc in ppc_md->setup_arch.
+ */
 void register_early_udbg_console(void)
 {
        if (early_console_initialized)
                return;
 
+       if (!udbg_putc)
+               return;
+
        if (strstr(boot_command_line, "udbg-immortal")) {
                printk(KERN_INFO "early console immortal !\n");
                udbg_console.flags &= ~CON_BOOT;
index f9ac3fe3be9767fbf04a73296dfc365d3efbbec7..ac445998d8313d087964e0e6133f272a6b080ab8 100644 (file)
@@ -67,6 +67,7 @@ static u64 MIC_Slow_Next_Timer_table[] = {
        0x00003FC000000000ull,
 };
 
+static unsigned int pmi_frequency_limit = 0;
 /*
  * hardware specific functions
  */
@@ -164,7 +165,6 @@ static int set_pmode(int cpu, unsigned int slow_mode) {
 
 static void cbe_cpufreq_handle_pmi(struct of_device *dev, pmi_message_t pmi_msg)
 {
-       struct cpufreq_policy policy;
        u8 cpu;
        u8 cbe_pmode_new;
 
@@ -173,15 +173,27 @@ static void cbe_cpufreq_handle_pmi(struct of_device *dev, pmi_message_t pmi_msg)
        cpu = cbe_node_to_cpu(pmi_msg.data1);
        cbe_pmode_new = pmi_msg.data2;
 
-       cpufreq_get_policy(&policy, cpu);
+       pmi_frequency_limit = cbe_freqs[cbe_pmode_new].frequency;
 
-       policy.max = min(policy.max, cbe_freqs[cbe_pmode_new].frequency);
-       policy.min = min(policy.min, policy.max);
+       pr_debug("cbe_handle_pmi: max freq=%d\n", pmi_frequency_limit);
+}
+
+static int pmi_notifier(struct notifier_block *nb,
+                                      unsigned long event, void *data)
+{
+       struct cpufreq_policy *policy = data;
 
-       pr_debug("cbe_handle_pmi: new policy.min=%d policy.max=%d\n", policy.min, policy.max);
-       cpufreq_set_policy(&policy);
+       if (event != CPUFREQ_INCOMPATIBLE)
+               return 0;
+
+       cpufreq_verify_within_limits(policy, 0, pmi_frequency_limit);
+       return 0;
 }
 
+static struct notifier_block pmi_notifier_block = {
+       .notifier_call = pmi_notifier,
+};
+
 static struct pmi_handler cbe_pmi_handler = {
        .type                   = PMI_TYPE_FREQ_CHANGE,
        .handle_pmi_message     = cbe_cpufreq_handle_pmi,
@@ -238,12 +250,21 @@ static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy)
 
        cpufreq_frequency_table_get_attr(cbe_freqs, policy->cpu);
 
+       if (pmi_dev) {
+               /* frequency might get limited later, initialize limit with max_freq */
+               pmi_frequency_limit = max_freq;
+               cpufreq_register_notifier(&pmi_notifier_block, CPUFREQ_POLICY_NOTIFIER);
+       }
+
        /* this ensures that policy->cpuinfo_min and policy->cpuinfo_max are set correctly */
        return cpufreq_frequency_table_cpuinfo(policy, cbe_freqs);
 }
 
 static int cbe_cpufreq_cpu_exit(struct cpufreq_policy *policy)
 {
+       if (pmi_dev)
+               cpufreq_unregister_notifier(&pmi_notifier_block, CPUFREQ_POLICY_NOTIFIER);
+
        cpufreq_frequency_table_put_attr(policy->cpu);
        return 0;
 }
index 8654749e317bae0aa67795dda4ba2eebdae50c3f..7c51cb54bca1ca8ba78c5074631247465dc784e7 100644 (file)
@@ -39,7 +39,7 @@ struct spu_context *alloc_spu_context(struct spu_gang *gang)
        if (spu_init_csa(&ctx->csa))
                goto out_free;
        spin_lock_init(&ctx->mmio_lock);
-       spin_lock_init(&ctx->mapping_lock);
+       mutex_init(&ctx->mapping_lock);
        kref_init(&ctx->kref);
        mutex_init(&ctx->state_mutex);
        mutex_init(&ctx->run_mutex);
@@ -103,6 +103,7 @@ void spu_forget(struct spu_context *ctx)
 
 void spu_unmap_mappings(struct spu_context *ctx)
 {
+       mutex_lock(&ctx->mapping_lock);
        if (ctx->local_store)
                unmap_mapping_range(ctx->local_store, 0, LS_SIZE, 1);
        if (ctx->mfc)
@@ -117,6 +118,7 @@ void spu_unmap_mappings(struct spu_context *ctx)
                unmap_mapping_range(ctx->mss, 0, 0x1000, 1);
        if (ctx->psmap)
                unmap_mapping_range(ctx->psmap, 0, 0x20000, 1);
+       mutex_unlock(&ctx->mapping_lock);
 }
 
 /**
index 45614c73c7841824d1a1f47834ebc2838bfbbe0a..b1e7e2f8a2e9256f4263a1ee72a589de6c592408 100644 (file)
@@ -45,11 +45,11 @@ spufs_mem_open(struct inode *inode, struct file *file)
        struct spufs_inode_info *i = SPUFS_I(inode);
        struct spu_context *ctx = i->i_ctx;
 
-       spin_lock(&ctx->mapping_lock);
+       mutex_lock(&ctx->mapping_lock);
        file->private_data = ctx;
        if (!i->i_openers++)
                ctx->local_store = inode->i_mapping;
-       spin_unlock(&ctx->mapping_lock);
+       mutex_unlock(&ctx->mapping_lock);
        return 0;
 }
 
@@ -59,10 +59,10 @@ spufs_mem_release(struct inode *inode, struct file *file)
        struct spufs_inode_info *i = SPUFS_I(inode);
        struct spu_context *ctx = i->i_ctx;
 
-       spin_lock(&ctx->mapping_lock);
+       mutex_lock(&ctx->mapping_lock);
        if (!--i->i_openers)
                ctx->local_store = NULL;
-       spin_unlock(&ctx->mapping_lock);
+       mutex_unlock(&ctx->mapping_lock);
        return 0;
 }
 
@@ -217,6 +217,7 @@ unsigned long spufs_get_unmapped_area(struct file *file, unsigned long addr,
 
 static const struct file_operations spufs_mem_fops = {
        .open                   = spufs_mem_open,
+       .release                = spufs_mem_release,
        .read                   = spufs_mem_read,
        .write                  = spufs_mem_write,
        .llseek                 = generic_file_llseek,
@@ -309,11 +310,11 @@ static int spufs_cntl_open(struct inode *inode, struct file *file)
        struct spufs_inode_info *i = SPUFS_I(inode);
        struct spu_context *ctx = i->i_ctx;
 
-       spin_lock(&ctx->mapping_lock);
+       mutex_lock(&ctx->mapping_lock);
        file->private_data = ctx;
        if (!i->i_openers++)
                ctx->cntl = inode->i_mapping;
-       spin_unlock(&ctx->mapping_lock);
+       mutex_unlock(&ctx->mapping_lock);
        return simple_attr_open(inode, file, spufs_cntl_get,
                                        spufs_cntl_set, "0x%08lx");
 }
@@ -326,10 +327,10 @@ spufs_cntl_release(struct inode *inode, struct file *file)
 
        simple_attr_close(inode, file);
 
-       spin_lock(&ctx->mapping_lock);
+       mutex_lock(&ctx->mapping_lock);
        if (!--i->i_openers)
                ctx->cntl = NULL;
-       spin_unlock(&ctx->mapping_lock);
+       mutex_unlock(&ctx->mapping_lock);
        return 0;
 }
 
@@ -812,11 +813,11 @@ static int spufs_signal1_open(struct inode *inode, struct file *file)
        struct spufs_inode_info *i = SPUFS_I(inode);
        struct spu_context *ctx = i->i_ctx;
 
-       spin_lock(&ctx->mapping_lock);
+       mutex_lock(&ctx->mapping_lock);
        file->private_data = ctx;
        if (!i->i_openers++)
                ctx->signal1 = inode->i_mapping;
-       spin_unlock(&ctx->mapping_lock);
+       mutex_unlock(&ctx->mapping_lock);
        return nonseekable_open(inode, file);
 }
 
@@ -826,10 +827,10 @@ spufs_signal1_release(struct inode *inode, struct file *file)
        struct spufs_inode_info *i = SPUFS_I(inode);
        struct spu_context *ctx = i->i_ctx;
 
-       spin_lock(&ctx->mapping_lock);
+       mutex_lock(&ctx->mapping_lock);
        if (!--i->i_openers)
                ctx->signal1 = NULL;
-       spin_unlock(&ctx->mapping_lock);
+       mutex_unlock(&ctx->mapping_lock);
        return 0;
 }
 
@@ -936,11 +937,11 @@ static int spufs_signal2_open(struct inode *inode, struct file *file)
        struct spufs_inode_info *i = SPUFS_I(inode);
        struct spu_context *ctx = i->i_ctx;
 
-       spin_lock(&ctx->mapping_lock);
+       mutex_lock(&ctx->mapping_lock);
        file->private_data = ctx;
        if (!i->i_openers++)
                ctx->signal2 = inode->i_mapping;
-       spin_unlock(&ctx->mapping_lock);
+       mutex_unlock(&ctx->mapping_lock);
        return nonseekable_open(inode, file);
 }
 
@@ -950,10 +951,10 @@ spufs_signal2_release(struct inode *inode, struct file *file)
        struct spufs_inode_info *i = SPUFS_I(inode);
        struct spu_context *ctx = i->i_ctx;
 
-       spin_lock(&ctx->mapping_lock);
+       mutex_lock(&ctx->mapping_lock);
        if (!--i->i_openers)
                ctx->signal2 = NULL;
-       spin_unlock(&ctx->mapping_lock);
+       mutex_unlock(&ctx->mapping_lock);
        return 0;
 }
 
@@ -1154,10 +1155,10 @@ static int spufs_mss_open(struct inode *inode, struct file *file)
 
        file->private_data = i->i_ctx;
 
-       spin_lock(&ctx->mapping_lock);
+       mutex_lock(&ctx->mapping_lock);
        if (!i->i_openers++)
                ctx->mss = inode->i_mapping;
-       spin_unlock(&ctx->mapping_lock);
+       mutex_unlock(&ctx->mapping_lock);
        return nonseekable_open(inode, file);
 }
 
@@ -1167,10 +1168,10 @@ spufs_mss_release(struct inode *inode, struct file *file)
        struct spufs_inode_info *i = SPUFS_I(inode);
        struct spu_context *ctx = i->i_ctx;
 
-       spin_lock(&ctx->mapping_lock);
+       mutex_lock(&ctx->mapping_lock);
        if (!--i->i_openers)
                ctx->mss = NULL;
-       spin_unlock(&ctx->mapping_lock);
+       mutex_unlock(&ctx->mapping_lock);
        return 0;
 }
 
@@ -1211,11 +1212,11 @@ static int spufs_psmap_open(struct inode *inode, struct file *file)
        struct spufs_inode_info *i = SPUFS_I(inode);
        struct spu_context *ctx = i->i_ctx;
 
-       spin_lock(&ctx->mapping_lock);
+       mutex_lock(&ctx->mapping_lock);
        file->private_data = i->i_ctx;
        if (!i->i_openers++)
                ctx->psmap = inode->i_mapping;
-       spin_unlock(&ctx->mapping_lock);
+       mutex_unlock(&ctx->mapping_lock);
        return nonseekable_open(inode, file);
 }
 
@@ -1225,10 +1226,10 @@ spufs_psmap_release(struct inode *inode, struct file *file)
        struct spufs_inode_info *i = SPUFS_I(inode);
        struct spu_context *ctx = i->i_ctx;
 
-       spin_lock(&ctx->mapping_lock);
+       mutex_lock(&ctx->mapping_lock);
        if (!--i->i_openers)
                ctx->psmap = NULL;
-       spin_unlock(&ctx->mapping_lock);
+       mutex_unlock(&ctx->mapping_lock);
        return 0;
 }
 
@@ -1281,11 +1282,11 @@ static int spufs_mfc_open(struct inode *inode, struct file *file)
        if (atomic_read(&inode->i_count) != 1)
                return -EBUSY;
 
-       spin_lock(&ctx->mapping_lock);
+       mutex_lock(&ctx->mapping_lock);
        file->private_data = ctx;
        if (!i->i_openers++)
                ctx->mfc = inode->i_mapping;
-       spin_unlock(&ctx->mapping_lock);
+       mutex_unlock(&ctx->mapping_lock);
        return nonseekable_open(inode, file);
 }
 
@@ -1295,10 +1296,10 @@ spufs_mfc_release(struct inode *inode, struct file *file)
        struct spufs_inode_info *i = SPUFS_I(inode);
        struct spu_context *ctx = i->i_ctx;
 
-       spin_lock(&ctx->mapping_lock);
+       mutex_lock(&ctx->mapping_lock);
        if (!--i->i_openers)
                ctx->mfc = NULL;
-       spin_unlock(&ctx->mapping_lock);
+       mutex_unlock(&ctx->mapping_lock);
        return 0;
 }
 
index 7150730e2ff11b9896039bd46a05ef83c8d26931..9807206e02196d479b1ea171ecc754fae9c7a746 100644 (file)
@@ -177,7 +177,7 @@ static int spufs_rmdir(struct inode *parent, struct dentry *dir)
 static int spufs_fill_dir(struct dentry *dir, struct tree_descr *files,
                          int mode, struct spu_context *ctx)
 {
-       struct dentry *dentry;
+       struct dentry *dentry, *tmp;
        int ret;
 
        while (files->name && files->name[0]) {
@@ -193,7 +193,20 @@ static int spufs_fill_dir(struct dentry *dir, struct tree_descr *files,
        }
        return 0;
 out:
-       spufs_prune_dir(dir);
+       /*
+        * remove all children from dir. dir->inode is not set so don't
+        * just simply use spufs_prune_dir() and panic afterwards :)
+        * dput() looks like it will do the right thing:
+        * - dec parent's ref counter
+        * - remove child from parent's child list
+        * - free child's inode if possible
+        * - free child
+        */
+       list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_u.d_child) {
+               dput(dentry);
+       }
+
+       shrink_dcache_parent(dir);
        return ret;
 }
 
@@ -274,6 +287,7 @@ spufs_mkdir(struct inode *dir, struct dentry *dentry, unsigned int flags,
        goto out;
 
 out_free_ctx:
+       spu_forget(ctx);
        put_spu_context(ctx);
 out_iput:
        iput(inode);
@@ -349,37 +363,6 @@ out:
        return ret;
 }
 
-static int spufs_rmgang(struct inode *root, struct dentry *dir)
-{
-       /* FIXME: this fails if the dir is not empty,
-                 which causes a leak of gangs. */
-       return simple_rmdir(root, dir);
-}
-
-static int spufs_gang_close(struct inode *inode, struct file *file)
-{
-       struct inode *parent;
-       struct dentry *dir;
-       int ret;
-
-       dir = file->f_path.dentry;
-       parent = dir->d_parent->d_inode;
-
-       ret = spufs_rmgang(parent, dir);
-       WARN_ON(ret);
-
-       return dcache_dir_close(inode, file);
-}
-
-const struct file_operations spufs_gang_fops = {
-       .open           = dcache_dir_open,
-       .release        = spufs_gang_close,
-       .llseek         = dcache_dir_lseek,
-       .read           = generic_read_dir,
-       .readdir        = dcache_readdir,
-       .fsync          = simple_sync_file,
-};
-
 static int
 spufs_mkgang(struct inode *dir, struct dentry *dentry, int mode)
 {
@@ -407,7 +390,6 @@ spufs_mkgang(struct inode *dir, struct dentry *dentry, int mode)
        inode->i_fop = &simple_dir_operations;
 
        d_instantiate(dentry, inode);
-       dget(dentry);
        dir->i_nlink++;
        dentry->d_inode->i_nlink++;
        return ret;
@@ -437,7 +419,7 @@ static int spufs_gang_open(struct dentry *dentry, struct vfsmount *mnt)
                goto out;
        }
 
-       filp->f_op = &spufs_gang_fops;
+       filp->f_op = &simple_dir_operations;
        fd_install(ret, filp);
 out:
        return ret;
@@ -458,8 +440,10 @@ static int spufs_create_gang(struct inode *inode,
         * in error path of *_open().
         */
        ret = spufs_gang_open(dget(dentry), mntget(mnt));
-       if (ret < 0)
-               WARN_ON(spufs_rmgang(inode, dentry));
+       if (ret < 0) {
+               int err = simple_rmdir(inode, dentry);
+               WARN_ON(err);
+       }
 
 out:
        mutex_unlock(&inode->i_mutex);
@@ -600,6 +584,10 @@ spufs_create_root(struct super_block *sb, void *data)
        struct inode *inode;
        int ret;
 
+       ret = -ENODEV;
+       if (!spu_management_ops)
+               goto out;
+
        ret = -ENOMEM;
        inode = spufs_new_inode(sb, S_IFDIR | 0775);
        if (!inode)
index b6ecb30e7d58b71ef8530f13bd02ea4bfe21039e..3b831e07f1ed740eabf0cd95fcafb985f105a8f2 100644 (file)
@@ -93,43 +93,6 @@ void spu_stop_tick(struct spu_context *ctx)
        }
 }
 
-void spu_sched_tick(struct work_struct *work)
-{
-       struct spu_context *ctx =
-               container_of(work, struct spu_context, sched_work.work);
-       struct spu *spu;
-       int preempted = 0;
-
-       /*
-        * If this context is being stopped avoid rescheduling from the
-        * scheduler tick because we would block on the state_mutex.
-        * The caller will yield the spu later on anyway.
-        */
-       if (test_bit(SPU_SCHED_EXITING, &ctx->sched_flags))
-               return;
-
-       mutex_lock(&ctx->state_mutex);
-       spu = ctx->spu;
-       if (spu) {
-               int best = sched_find_first_bit(spu_prio->bitmap);
-               if (best <= ctx->prio) {
-                       spu_deactivate(ctx);
-                       preempted = 1;
-               }
-       }
-       mutex_unlock(&ctx->state_mutex);
-
-       if (preempted) {
-               /*
-                * We need to break out of the wait loop in spu_run manually
-                * to ensure this context gets put on the runqueue again
-                * ASAP.
-                */
-               wake_up(&ctx->stop_wq);
-       } else
-               spu_start_tick(ctx);
-}
-
 /**
  * spu_add_to_active_list - add spu to active list
  * @spu:       spu to add to the active list
@@ -273,34 +236,6 @@ static void spu_prio_wait(struct spu_context *ctx)
        remove_wait_queue(&ctx->stop_wq, &wait);
 }
 
-/**
- * spu_reschedule - try to find a runnable context for a spu
- * @spu:       spu available
- *
- * This function is called whenever a spu becomes idle.  It looks for the
- * most suitable runnable spu context and schedules it for execution.
- */
-static void spu_reschedule(struct spu *spu)
-{
-       int best;
-
-       spu_free(spu);
-
-       spin_lock(&spu_prio->runq_lock);
-       best = sched_find_first_bit(spu_prio->bitmap);
-       if (best < MAX_PRIO) {
-               struct list_head *rq = &spu_prio->runq[best];
-               struct spu_context *ctx;
-
-               BUG_ON(list_empty(rq));
-
-               ctx = list_entry(rq->next, struct spu_context, rq);
-               __spu_del_from_rq(ctx);
-               wake_up(&ctx->stop_wq);
-       }
-       spin_unlock(&spu_prio->runq_lock);
-}
-
 static struct spu *spu_get_idle(struct spu_context *ctx)
 {
        struct spu *spu = NULL;
@@ -428,6 +363,51 @@ int spu_activate(struct spu_context *ctx, unsigned long flags)
        return -ERESTARTSYS;
 }
 
+/**
+ * grab_runnable_context - try to find a runnable context
+ *
+ * Remove the highest priority context on the runqueue and return it
+ * to the caller.  Returns %NULL if no runnable context was found.
+ */
+static struct spu_context *grab_runnable_context(int prio)
+{
+       struct spu_context *ctx = NULL;
+       int best;
+
+       spin_lock(&spu_prio->runq_lock);
+       best = sched_find_first_bit(spu_prio->bitmap);
+       if (best < prio) {
+               struct list_head *rq = &spu_prio->runq[best];
+
+               BUG_ON(list_empty(rq));
+
+               ctx = list_entry(rq->next, struct spu_context, rq);
+               __spu_del_from_rq(ctx);
+       }
+       spin_unlock(&spu_prio->runq_lock);
+
+       return ctx;
+}
+
+static int __spu_deactivate(struct spu_context *ctx, int force, int max_prio)
+{
+       struct spu *spu = ctx->spu;
+       struct spu_context *new = NULL;
+
+       if (spu) {
+               new = grab_runnable_context(max_prio);
+               if (new || force) {
+                       spu_unbind_context(spu, ctx);
+                       spu_free(spu);
+                       if (new)
+                               wake_up(&new->stop_wq);
+               }
+
+       }
+
+       return new != NULL;
+}
+
 /**
  * spu_deactivate - unbind a context from it's physical spu
  * @ctx:       spu context to unbind
@@ -437,12 +417,7 @@ int spu_activate(struct spu_context *ctx, unsigned long flags)
  */
 void spu_deactivate(struct spu_context *ctx)
 {
-       struct spu *spu = ctx->spu;
-
-       if (spu) {
-               spu_unbind_context(spu, ctx);
-               spu_reschedule(spu);
-       }
+       __spu_deactivate(ctx, 1, MAX_PRIO);
 }
 
 /**
@@ -455,21 +430,43 @@ void spu_deactivate(struct spu_context *ctx)
  */
 void spu_yield(struct spu_context *ctx)
 {
-       struct spu *spu;
-
-       if (mutex_trylock(&ctx->state_mutex)) {
-               if ((spu = ctx->spu) != NULL) {
-                       int best = sched_find_first_bit(spu_prio->bitmap);
-                       if (best < MAX_PRIO) {
-                               pr_debug("%s: yielding SPU %d NODE %d\n",
-                                        __FUNCTION__, spu->number, spu->node);
-                               spu_deactivate(ctx);
-                       }
-               }
+       if (!(ctx->flags & SPU_CREATE_NOSCHED)) {
+               mutex_lock(&ctx->state_mutex);
+               __spu_deactivate(ctx, 0, MAX_PRIO);
                mutex_unlock(&ctx->state_mutex);
        }
 }
 
+void spu_sched_tick(struct work_struct *work)
+{
+       struct spu_context *ctx =
+               container_of(work, struct spu_context, sched_work.work);
+       int preempted;
+
+       /*
+        * If this context is being stopped avoid rescheduling from the
+        * scheduler tick because we would block on the state_mutex.
+        * The caller will yield the spu later on anyway.
+        */
+       if (test_bit(SPU_SCHED_EXITING, &ctx->sched_flags))
+               return;
+
+       mutex_lock(&ctx->state_mutex);
+       preempted = __spu_deactivate(ctx, 0, ctx->prio + 1);
+       mutex_unlock(&ctx->state_mutex);
+
+       if (preempted) {
+               /*
+                * We need to break out of the wait loop in spu_run manually
+                * to ensure this context gets put on the runqueue again
+                * ASAP.
+                */
+               wake_up(&ctx->stop_wq);
+       } else {
+               spu_start_tick(ctx);
+       }
+}
+
 int __init spu_sched_init(void)
 {
        int i;
index 0a947fd7de57c3da11e2444b64d5d020637a9323..47617e8014a5acc402f1c0222dfb1d1c6c3bf972 100644 (file)
@@ -55,7 +55,7 @@ struct spu_context {
        struct address_space *signal2;     /* 'signal2' area mappings. */
        struct address_space *mss;         /* 'mss' area mappings. */
        struct address_space *psmap;       /* 'psmap' area mappings. */
-       spinlock_t mapping_lock;
+       struct mutex mapping_lock;
        u64 object_id;             /* user space pointer for oprofile */
 
        enum { SPU_STATE_RUNNABLE, SPU_STATE_SAVED } state;
index f4f82520dc4f59aa1d0f35d387f43637185251d8..5240046d86715275156d7adf6b41434f28b1155a 100644 (file)
@@ -4,5 +4,5 @@ obj-y                           += interrupt.o iommu.o setup.o \
 
 obj-$(CONFIG_SMP)              += smp.o
 obj-$(CONFIG_PPC_UDBG_BEAT)    += udbg_beat.o
-obj-$(CONFIG_HAS_TXX9_SERIAL)  += scc_sio.o
+obj-$(CONFIG_SERIAL_TXX9)      += scc_sio.o
 obj-$(CONFIG_SPU_BASE)         += spu_priv1.o
index 95fa6a7d15ee4d11aab9e8543d8ac59d11f4c1f7..f33b21b9f5d4338d9ad9c01ba610a90250b7e132 100644 (file)
@@ -31,8 +31,6 @@
 #define IOBMAP_PAGE_SIZE       (1 << IOBMAP_PAGE_SHIFT)
 #define IOBMAP_PAGE_MASK       (IOBMAP_PAGE_SIZE - 1)
 
-#define IOBMAP_PAGE_FACTOR     (PAGE_SHIFT - IOBMAP_PAGE_SHIFT)
-
 #define IOB_BASE               0xe0000000
 #define IOB_SIZE               0x3000
 /* Configuration registers */
@@ -97,9 +95,6 @@ static void iobmap_build(struct iommu_table *tbl, long index,
 
        bus_addr = (tbl->it_offset + index) << PAGE_SHIFT;
 
-       npages <<= IOBMAP_PAGE_FACTOR;
-       index <<= IOBMAP_PAGE_FACTOR;
-
        ip = ((u32 *)tbl->it_base) + index;
 
        while (npages--) {
@@ -125,9 +120,6 @@ static void iobmap_free(struct iommu_table *tbl, long index,
 
        bus_addr = (tbl->it_offset + index) << PAGE_SHIFT;
 
-       npages <<= IOBMAP_PAGE_FACTOR;
-       index <<= IOBMAP_PAGE_FACTOR;
-
        ip = ((u32 *)tbl->it_base) + index;
 
        while (npages--) {
index 07b1c4ec428d590daa4882638118dbee161a343c..956571526a57bcc4169dafc3d7c74ff4b0a7dbaa 100644 (file)
@@ -363,8 +363,19 @@ static void __init pmac_setup_arch(void)
                smp_ops = &core99_smp_ops;
        }
 #ifdef CONFIG_PPC32
-       else
+       else {
+               /*
+                * We have to set bits in cpu_possible_map here since the
+                * secondary CPU(s) aren't in the device tree, and
+                * setup_per_cpu_areas only allocates per-cpu data for
+                * CPUs in the cpu_possible_map.
+                */
+               int cpu;
+
+               for (cpu = 1; cpu < 4 && cpu < NR_CPUS; ++cpu)
+                       cpu_set(cpu, cpu_possible_map);
                smp_ops = &psurge_smp_ops;
+       }
 #endif
 #endif /* CONFIG_SMP */
 
index 686ed82bde79a6608abcf5915848a47a6ff8ffc8..cb2d894541c642609d3e9f408fd91484daa99fa4 100644 (file)
@@ -317,7 +317,6 @@ static int __init smp_psurge_probe(void)
                ncpus = NR_CPUS;
        for (i = 1; i < ncpus ; ++i) {
                cpu_set(i, cpu_present_map);
-               cpu_set(i, cpu_possible_map);
                set_hard_smp_processor_id(i, i);
        }
 
index 85053b2816a9dd9a40a394ca5cc7299118f13953..7a97c7440b30267f84e45b2773e85bd8f545bdd0 100644 (file)
@@ -365,13 +365,13 @@ int qspan_pcibios_find_class(unsigned int class_code, unsigned short index,
 }
 
 void __init
-m8xx_pcibios_fixup(void))
+m8xx_pcibios_fixup(void)
 {
    /* Lots to do here, all board and configuration specific. */
 }
 
 void __init
-m8xx_setup_pci_ptrs(void))
+m8xx_setup_pci_ptrs(void)
 {
        set_config_access_method(qspan);
 
index 911ce1cdbd7f86865bb903ac054b359f0f6be82b..e143017c8975a0662ca64c2116106e8f97389533 100644 (file)
@@ -38,8 +38,8 @@ static struct platform_device *se73180_devices[] __initdata = {
 
 static int __init se73180_devices_setup(void)
 {
-       return platform_add_devices(sh7343se_platform_devices,
-                                   ARRAY_SIZE(sh7343se_platform_devices));
+       return platform_add_devices(se73180_devices,
+                                   ARRAY_SIZE(se73180_devices));
 }
 __initcall(se73180_devices_setup);
 
index cc1cb04fa61832975ebfde104dc24e1066b2b6ca..4d335077a3ffc8c590594f6065ece5573be91d31 100644 (file)
@@ -11,6 +11,7 @@
 
 #include <linux/init.h>
 #include <linux/irq.h>
+#include <linux/interrupt.h>
 #include <asm/system.h>
 #include <asm/io.h>
 #include <asm/microdev.h>
index 70f12907647f13a32e73b3476c967dcb3cd0d237..d70e5c8461b56e4b60c72c43ae9204c4b0637a8e 100644 (file)
@@ -28,7 +28,7 @@ static void disable_voyagergx_irq(unsigned int irq)
        unsigned long val;
        unsigned long mask = 1 << (irq - VOYAGER_IRQ_BASE);
 
-       pr_debug("disable_voyagergx_irq(%d): mask=%x\n", irq, mask);
+       pr_debug("disable_voyagergx_irq(%d): mask=%lx\n", irq, mask);
        val = readl((void __iomem *)VOYAGER_INT_MASK);
        val &= ~mask;
        writel(val, (void __iomem *)VOYAGER_INT_MASK);
@@ -39,7 +39,7 @@ static void enable_voyagergx_irq(unsigned int irq)
        unsigned long val;
        unsigned long mask = 1 << (irq - VOYAGER_IRQ_BASE);
 
-       pr_debug("disable_voyagergx_irq(%d): mask=%x\n", irq, mask);
+       pr_debug("disable_voyagergx_irq(%d): mask=%lx\n", irq, mask);
        val = readl((void __iomem *)VOYAGER_INT_MASK);
        val |= mask;
        writel(val, (void __iomem *)VOYAGER_INT_MASK);
@@ -125,11 +125,12 @@ int voyagergx_irq_demux(int irq)
                        i = 17;
                else
                        printk("Unexpected IRQ irq = %d status = 0x%08lx\n", irq, val);
-               pr_debug("voyagergx_irq_demux %d \n", i);
-               if (i < VOYAGER_IRQ_NUM) {
+               pr_debug("voyagergx_irq_demux %ld \n", i);
+               if (i < VOYAGER_IRQ_NUM) {
                        irq = VOYAGER_IRQ_BASE + i;
-                       if (voyagergx_demux[i].func != 0)
-                               irq = voyagergx_demux[i].func(irq, voyagergx_demux[i].dev);
+                       if (voyagergx_demux[i].func != 0)
+                               irq = voyagergx_demux[i].func(irq,
+                                               voyagergx_demux[i].dev);
                }
        }
        return irq;
index 659cc081e5e701f5d155bf72e9cd297f93a42524..b0b59d4a33ca8ada675d624481d76b1708c9a4fc 100644 (file)
@@ -320,7 +320,9 @@ skip_restore:
 
        .align  2
 5:     .long   0x00001000      ! DSP
+#ifdef CONFIG_KGDB_NMI
 6:     .long   in_nmi
+#endif
 7:     .long   0x30000000
 
 ! common exception handler
index fcb2c41bc34e766c9a6650abdde04e6904846230..a33429463e96cd0c758b9f05f631a5d610025d6e 100644 (file)
@@ -111,7 +111,7 @@ static int shoc_clk_verify_rate(struct clk *clk, unsigned long rate)
        return 0;
 }
 
-static int shoc_clk_set_rate(struct clk *clk, unsigned long rate)
+static int shoc_clk_set_rate(struct clk *clk, unsigned long rate, int algo_id)
 {
        unsigned long frqcr3;
        unsigned int tmp;
index be03d74e99cbc4412c713ba96141b66a0443a21d..0c7b7e33abdcfd6e2ddf242623683d3ee89d7b6c 100644 (file)
@@ -22,6 +22,7 @@
 #include <asm/addrspace.h>
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
+#include <asm/mmu.h>
 
 /*
  * Remap an arbitrary physical address space into the kernel virtual
index fb51660847c8380e92b315099c659b432f86f191..3334f99b5835f0a113514fa3e25dcf886690dbd5 100644 (file)
@@ -521,10 +521,10 @@ void __init pcibios_fixup_bus(struct pci_bus *bus)
                bus->resource[0]->start = PCIBIOS_MIN_IO;
                bus->resource[1]->start = PCIBIOS_MIN_MEM;
 #else
-               bus->resource[0]->end = 0
-               bus->resource[1]->end = 0
-               bus->resource[0]->start =0
-                 bus->resource[1]->start = 0;
+               bus->resource[0]->end = 0;
+               bus->resource[1]->end = 0;
+               bus->resource[0]->start =0;
+               bus->resource[1]->start = 0;
 #endif
                /* Turn off downstream PF memory address range by default */
                bus->resource[2]->start = 1024*1024;
index bd00f89eed1ed3c4dcaa7a5cb39cd6ef1a132505..89a1b469b93df149b21c1c65c5d1723d36e97e09 100644 (file)
@@ -396,6 +396,15 @@ config SCHED_SMT
          when dealing with UltraSPARC cpus at a cost of slightly increased
          overhead in some places. If unsure say N here.
 
+config SCHED_MC
+       bool "Multi-core scheduler support"
+       depends on SMP
+       default y
+       help
+         Multi-core scheduler support improves the CPU scheduler's decision
+         making when dealing with multi-core CPU chips at a cost of slightly
+         increased overhead in some places. If unsure say N here.
+
 source "kernel/Kconfig.preempt"
 
 config CMDLINE_BOOL
index d8d19093d12fd0a650f1196f2d44f490895fccc3..f964bf28d21a2568fed3a436af906c3e78d238ea 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.70 2002/02/09 19:49:30 davem Exp $
+#
 # Makefile for the linux kernel.
 #
 
@@ -8,7 +8,7 @@ EXTRA_CFLAGS := -Werror
 extra-y                := head.o init_task.o vmlinux.lds
 
 obj-y          := process.o setup.o cpu.o idprom.o \
-                  traps.o auxio.o una_asm.o \
+                  traps.o auxio.o una_asm.o sysfs.o \
                   irq.o ptrace.o time.o sys_sparc.o signal.o \
                   unaligned.o central.o pci.o starfire.o semaphore.o \
                   power.o sbus.o iommu_common.o sparc64_ksyms.o chmc.o \
index ed712e0b337238199b52aadc646b6123a585aef6..8059531bf0ac0ff55d604ef77a06aeddd40e090f 100644 (file)
@@ -2357,8 +2357,9 @@ sun4v_ldc_unmap:
         nop
        .size   sun4v_ldc_unmap, .-sun4v_ldc_unmap
 
-       /* %o0: cookie
-        * %o1: mte_cookie
+       /* %o0: channel
+        * %o1: cookie
+        * %o2: mte_cookie
         *
         * returns %o0: status
         */
@@ -2514,9 +2515,9 @@ sun4v_ncs_request:
         nop
        .size   sun4v_ncs_request, .-sun4v_ncs_request
 
-       .globl  sun4v_scv_send
-       .type   sun4v_scv_send,#function
-sun4v_scv_send:
+       .globl  sun4v_svc_send
+       .type   sun4v_svc_send,#function
+sun4v_svc_send:
        save    %sp, -192, %sp
        mov     %i0, %o0
        mov     %i1, %o1
@@ -2526,11 +2527,11 @@ sun4v_scv_send:
        stx     %o1, [%i3]
        ret
        restore
-       .size   sun4v_scv_send, .-sun4v_scv_send
+       .size   sun4v_svc_send, .-sun4v_svc_send
 
-       .globl  sun4v_scv_recv
-       .type   sun4v_scv_recv,#function
-sun4v_scv_recv:
+       .globl  sun4v_svc_recv
+       .type   sun4v_svc_recv,#function
+sun4v_svc_recv:
        save    %sp, -192, %sp
        mov     %i0, %o0
        mov     %i1, %o1
@@ -2540,33 +2541,55 @@ sun4v_scv_recv:
        stx     %o1, [%i3]
        ret
        restore
-       .size   sun4v_scv_recv, .-sun4v_scv_recv
+       .size   sun4v_svc_recv, .-sun4v_svc_recv
 
-       .globl  sun4v_scv_getstatus
-       .type   sun4v_scv_getstatus,#function
-sun4v_scv_getstatus:
+       .globl  sun4v_svc_getstatus
+       .type   sun4v_svc_getstatus,#function
+sun4v_svc_getstatus:
        mov     HV_FAST_SVC_GETSTATUS, %o5
        mov     %o1, %o4
        ta      HV_FAST_TRAP
        stx     %o1, [%o4]
        retl
         nop
-       .size   sun4v_scv_getstatus, .-sun4v_scv_getstatus
+       .size   sun4v_svc_getstatus, .-sun4v_svc_getstatus
 
-       .globl  sun4v_scv_setstatus
-       .type   sun4v_scv_setstatus,#function
-sun4v_scv_setstatus:
+       .globl  sun4v_svc_setstatus
+       .type   sun4v_svc_setstatus,#function
+sun4v_svc_setstatus:
        mov     HV_FAST_SVC_SETSTATUS, %o5
        ta      HV_FAST_TRAP
        retl
         nop
-       .size   sun4v_scv_setstatus, .-sun4v_scv_setstatus
+       .size   sun4v_svc_setstatus, .-sun4v_svc_setstatus
 
-       .globl  sun4v_scv_clrstatus
-       .type   sun4v_scv_clrstatus,#function
-sun4v_scv_clrstatus:
+       .globl  sun4v_svc_clrstatus
+       .type   sun4v_svc_clrstatus,#function
+sun4v_svc_clrstatus:
        mov     HV_FAST_SVC_CLRSTATUS, %o5
        ta      HV_FAST_TRAP
        retl
         nop
-       .size   sun4v_scv_clrstatus, .-sun4v_scv_clrstatus
+       .size   sun4v_svc_clrstatus, .-sun4v_svc_clrstatus
+
+       .globl  sun4v_mmustat_conf
+       .type   sun4v_mmustat_conf,#function
+sun4v_mmustat_conf:
+       mov     %o1, %o4
+       mov     HV_FAST_MMUSTAT_CONF, %o5
+       ta      HV_FAST_TRAP
+       stx     %o1, [%o4]
+       retl
+        nop
+       .size   sun4v_mmustat_conf, .-sun4v_mmustat_conf
+
+       .globl  sun4v_mmustat_info
+       .type   sun4v_mmustat_info,#function
+sun4v_mmustat_info:
+       mov     %o0, %o4
+       mov     HV_FAST_MMUSTAT_INFO, %o5
+       ta      HV_FAST_TRAP
+       stx     %o1, [%o4]
+       retl
+        nop
+       .size   sun4v_mmustat_info, .-sun4v_mmustat_info
index a36f8dd0c0216e9244896736af33682a6ac7e889..e60d283f60bc518d87aa8ec08363d40d719b9ab8 100644 (file)
@@ -1,7 +1,6 @@
-/* $Id: irq.c,v 1.114 2002/01/11 08:45:38 davem Exp $
- * irq.c: UltraSparc IRQ handling/init/registry.
+/* irq.c: UltraSparc IRQ handling/init/registry.
  *
- * Copyright (C) 1997  David S. Miller  (davem@caip.rutgers.edu)
+ * Copyright (C) 1997, 2007  David S. Miller  (davem@davemloft.net)
  * Copyright (C) 1998  Eddie C. Dost    (ecd@skynet.be)
  * Copyright (C) 1998  Jakub Jelinek    (jj@ultra.linux.cz)
  */
@@ -43,6 +42,7 @@
 #include <asm/cpudata.h>
 #include <asm/auxio.h>
 #include <asm/head.h>
+#include <asm/hypervisor.h>
 
 /* UPA nodes send interrupt packet to UltraSparc with first data reg
  * value low 5 (7 on Starfire) bits holding the IRQ identifier being
@@ -380,6 +380,76 @@ static void sun4v_irq_end(unsigned int virt_irq)
        }
 }
 
+static void sun4v_virq_enable(unsigned int virt_irq)
+{
+       struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq);
+       unsigned int ino = bucket - &ivector_table[0];
+
+       if (likely(bucket)) {
+               unsigned long cpuid, dev_handle, dev_ino;
+               int err;
+
+               cpuid = irq_choose_cpu(virt_irq);
+
+               dev_handle = ino & IMAP_IGN;
+               dev_ino = ino & IMAP_INO;
+
+               err = sun4v_vintr_set_target(dev_handle, dev_ino, cpuid);
+               if (err != HV_EOK)
+                       printk("sun4v_vintr_set_target(%lx,%lx,%lu): "
+                              "err(%d)\n",
+                              dev_handle, dev_ino, cpuid, err);
+               err = sun4v_vintr_set_state(dev_handle, dev_ino,
+                                           HV_INTR_ENABLED);
+               if (err != HV_EOK)
+                       printk("sun4v_vintr_set_state(%lx,%lx,"
+                              "HV_INTR_ENABLED): err(%d)\n",
+                              dev_handle, dev_ino, err);
+       }
+}
+
+static void sun4v_virq_disable(unsigned int virt_irq)
+{
+       struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq);
+       unsigned int ino = bucket - &ivector_table[0];
+
+       if (likely(bucket)) {
+               unsigned long dev_handle, dev_ino;
+               int err;
+
+               dev_handle = ino & IMAP_IGN;
+               dev_ino = ino & IMAP_INO;
+
+               err = sun4v_vintr_set_state(dev_handle, dev_ino,
+                                           HV_INTR_DISABLED);
+               if (err != HV_EOK)
+                       printk("sun4v_vintr_set_state(%lx,%lx,"
+                              "HV_INTR_DISABLED): err(%d)\n",
+                              dev_handle, dev_ino, err);
+       }
+}
+
+static void sun4v_virq_end(unsigned int virt_irq)
+{
+       struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq);
+       unsigned int ino = bucket - &ivector_table[0];
+
+       if (likely(bucket)) {
+               unsigned long dev_handle, dev_ino;
+               int err;
+
+               dev_handle = ino & IMAP_IGN;
+               dev_ino = ino & IMAP_INO;
+
+               err = sun4v_vintr_set_state(dev_handle, dev_ino,
+                                           HV_INTR_STATE_IDLE);
+               if (err != HV_EOK)
+                       printk("sun4v_vintr_set_state(%lx,%lx,"
+                               "HV_INTR_STATE_IDLE): err(%d)\n",
+                              dev_handle, dev_ino, err);
+       }
+}
+
 static void run_pre_handler(unsigned int virt_irq)
 {
        struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq);
@@ -434,6 +504,21 @@ static struct irq_chip sun4v_msi = {
 };
 #endif
 
+static struct irq_chip sun4v_virq = {
+       .typename       = "vsun4v",
+       .enable         = sun4v_virq_enable,
+       .disable        = sun4v_virq_disable,
+       .end            = sun4v_virq_end,
+};
+
+static struct irq_chip sun4v_virq_ack = {
+       .typename       = "vsun4v+ack",
+       .enable         = sun4v_virq_enable,
+       .disable        = sun4v_virq_disable,
+       .ack            = run_pre_handler,
+       .end            = sun4v_virq_end,
+};
+
 void irq_install_pre_handler(int virt_irq,
                             void (*func)(unsigned int, void *, void *),
                             void *arg1, void *arg2)
@@ -447,7 +532,8 @@ void irq_install_pre_handler(int virt_irq,
 
        chip = get_irq_chip(virt_irq);
        if (chip == &sun4u_irq_ack ||
-           chip == &sun4v_irq_ack
+           chip == &sun4v_irq_ack ||
+           chip == &sun4v_virq_ack
 #ifdef CONFIG_PCI_MSI
            || chip == &sun4v_msi
 #endif
@@ -455,7 +541,9 @@ void irq_install_pre_handler(int virt_irq,
                return;
 
        chip = (chip == &sun4u_irq ?
-               &sun4u_irq_ack : &sun4v_irq_ack);
+               &sun4u_irq_ack :
+               (chip == &sun4v_irq ?
+                &sun4v_irq_ack : &sun4v_virq_ack));
        set_irq_chip(virt_irq, chip);
 }
 
@@ -492,19 +580,18 @@ out:
        return bucket->virt_irq;
 }
 
-unsigned int sun4v_build_irq(u32 devhandle, unsigned int devino)
+static unsigned int sun4v_build_common(unsigned long sysino,
+                                      struct irq_chip *chip)
 {
        struct ino_bucket *bucket;
        struct irq_handler_data *data;
-       unsigned long sysino;
 
        BUG_ON(tlb_type != hypervisor);
 
-       sysino = sun4v_devino_to_sysino(devhandle, devino);
        bucket = &ivector_table[sysino];
        if (!bucket->virt_irq) {
                bucket->virt_irq = virt_irq_alloc(__irq(bucket));
-               set_irq_chip(bucket->virt_irq, &sun4v_irq);
+               set_irq_chip(bucket->virt_irq, chip);
        }
 
        data = get_irq_chip_data(bucket->virt_irq);
@@ -529,6 +616,32 @@ out:
        return bucket->virt_irq;
 }
 
+unsigned int sun4v_build_irq(u32 devhandle, unsigned int devino)
+{
+       unsigned long sysino = sun4v_devino_to_sysino(devhandle, devino);
+
+       return sun4v_build_common(sysino, &sun4v_irq);
+}
+
+unsigned int sun4v_build_virq(u32 devhandle, unsigned int devino)
+{
+       unsigned long sysino, hv_err;
+
+       BUG_ON(devhandle & ~IMAP_IGN);
+       BUG_ON(devino & ~IMAP_INO);
+
+       sysino = devhandle | devino;
+
+       hv_err = sun4v_vintr_set_cookie(devhandle, devino, sysino);
+       if (hv_err) {
+               prom_printf("IRQ: Fatal, cannot set cookie for [%x:%x] "
+                           "err=%lu\n", devhandle, devino, hv_err);
+               prom_halt();
+       }
+
+       return sun4v_build_common(sysino, &sun4v_virq);
+}
+
 #ifdef CONFIG_PCI_MSI
 unsigned int sun4v_build_msi(u32 devhandle, unsigned int *virt_irq_p,
                             unsigned int msi_start, unsigned int msi_end)
index 9246c2cf95747685fba8106d7cb83dcd99d6a60b..f0e16045fb1693f0f8ba9e8e507413833aa05b9f 100644 (file)
@@ -473,6 +473,53 @@ static void __init set_core_ids(void)
        }
 }
 
+static void __init mark_proc_ids(struct mdesc_node *mp, int proc_id)
+{
+       int i;
+
+       for (i = 0; i < mp->num_arcs; i++) {
+               struct mdesc_node *t = mp->arcs[i].arc;
+               const u64 *id;
+
+               if (strcmp(mp->arcs[i].name, "back"))
+                       continue;
+
+               if (strcmp(t->name, "cpu"))
+                       continue;
+
+               id = md_get_property(t, "id", NULL);
+               if (*id < NR_CPUS)
+                       cpu_data(*id).proc_id = proc_id;
+       }
+}
+
+static void __init __set_proc_ids(const char *exec_unit_name)
+{
+       struct mdesc_node *mp;
+       int idx;
+
+       idx = 0;
+       md_for_each_node_by_name(mp, exec_unit_name) {
+               const char *type;
+               int len;
+
+               type = md_get_property(mp, "type", &len);
+               if (!find_in_proplist(type, "int", len) &&
+                   !find_in_proplist(type, "integer", len))
+                       continue;
+
+               mark_proc_ids(mp, idx);
+
+               idx++;
+       }
+}
+
+static void __init set_proc_ids(void)
+{
+       __set_proc_ids("exec_unit");
+       __set_proc_ids("exec-unit");
+}
+
 static void __init get_one_mondo_bits(const u64 *p, unsigned int *mask, unsigned char def)
 {
        u64 val;
@@ -574,9 +621,15 @@ static void __init mdesc_fill_in_cpu_data(void)
 #endif
 
                c->core_id = 0;
+               c->proc_id = -1;
        }
 
+#ifdef CONFIG_SMP
+       sparc64_multi_core = 1;
+#endif
+
        set_core_ids();
+       set_proc_ids();
 
        smp_fill_in_sib_core_maps();
 }
index 16cc46a718724cc5cd93a99beb3b5c43fb08fb23..6676b93219dcd51cee5454cb2577854074c4ec80 100644 (file)
@@ -343,6 +343,15 @@ static int of_bus_simba_match(struct device_node *np)
 
        if (model && !strcmp(model, "SUNW,simba"))
                return 1;
+
+       /* Treat PCI busses lacking ranges property just like
+        * simba.
+        */
+       if (!strcmp(np->type, "pci") || !strcmp(np->type, "pciex")) {
+               if (!of_find_property(np, "ranges", NULL))
+                       return 1;
+       }
+
        return 0;
 }
 
@@ -549,8 +558,6 @@ static int __init build_one_resource(struct device_node *parent,
 
 static int __init use_1to1_mapping(struct device_node *pp)
 {
-       const char *model;
-
        /* If this is on the PMU bus, don't try to translate it even
         * if a ranges property exists.
         */
@@ -567,9 +574,11 @@ static int __init use_1to1_mapping(struct device_node *pp)
        if (!strcmp(pp->name, "dma"))
                return 0;
 
-       /* Similarly for Simba PCI bridges.  */
-       model = of_get_property(pp, "model", NULL);
-       if (model && !strcmp(model, "SUNW,simba"))
+       /* Similarly for all PCI bridges, if we get this far
+        * it lacks a ranges property, and this will include
+        * cases like Simba.
+        */
+       if (!strcmp(pp->type, "pci") || !strcmp(pp->type, "pciex"))
                return 0;
 
        return 1;
index 38a32bc95d22bb0423a6bd28b2ff75f18e69fef1..81f4a5ea05f7ab948e307daa1853f53d1b554fbd 100644 (file)
@@ -522,6 +522,89 @@ static void pci_resource_adjust(struct resource *res,
        res->end += root->start;
 }
 
+/* For PCI bus devices which lack a 'ranges' property we interrogate
+ * the config space values to set the resources, just like the generic
+ * Linux PCI probing code does.
+ */
+static void __devinit pci_cfg_fake_ranges(struct pci_dev *dev,
+                                         struct pci_bus *bus,
+                                         struct pci_pbm_info *pbm)
+{
+       struct resource *res;
+       u8 io_base_lo, io_limit_lo;
+       u16 mem_base_lo, mem_limit_lo;
+       unsigned long base, limit;
+
+       pci_read_config_byte(dev, PCI_IO_BASE, &io_base_lo);
+       pci_read_config_byte(dev, PCI_IO_LIMIT, &io_limit_lo);
+       base = (io_base_lo & PCI_IO_RANGE_MASK) << 8;
+       limit = (io_limit_lo & PCI_IO_RANGE_MASK) << 8;
+
+       if ((io_base_lo & PCI_IO_RANGE_TYPE_MASK) == PCI_IO_RANGE_TYPE_32) {
+               u16 io_base_hi, io_limit_hi;
+
+               pci_read_config_word(dev, PCI_IO_BASE_UPPER16, &io_base_hi);
+               pci_read_config_word(dev, PCI_IO_LIMIT_UPPER16, &io_limit_hi);
+               base |= (io_base_hi << 16);
+               limit |= (io_limit_hi << 16);
+       }
+
+       res = bus->resource[0];
+       if (base <= limit) {
+               res->flags = (io_base_lo & PCI_IO_RANGE_TYPE_MASK) | IORESOURCE_IO;
+               if (!res->start)
+                       res->start = base;
+               if (!res->end)
+                       res->end = limit + 0xfff;
+               pci_resource_adjust(res, &pbm->io_space);
+       }
+
+       pci_read_config_word(dev, PCI_MEMORY_BASE, &mem_base_lo);
+       pci_read_config_word(dev, PCI_MEMORY_LIMIT, &mem_limit_lo);
+       base = (mem_base_lo & PCI_MEMORY_RANGE_MASK) << 16;
+       limit = (mem_limit_lo & PCI_MEMORY_RANGE_MASK) << 16;
+
+       res = bus->resource[1];
+       if (base <= limit) {
+               res->flags = ((mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) |
+                             IORESOURCE_MEM);
+               res->start = base;
+               res->end = limit + 0xfffff;
+               pci_resource_adjust(res, &pbm->mem_space);
+       }
+
+       pci_read_config_word(dev, PCI_PREF_MEMORY_BASE, &mem_base_lo);
+       pci_read_config_word(dev, PCI_PREF_MEMORY_LIMIT, &mem_limit_lo);
+       base = (mem_base_lo & PCI_PREF_RANGE_MASK) << 16;
+       limit = (mem_limit_lo & PCI_PREF_RANGE_MASK) << 16;
+
+       if ((mem_base_lo & PCI_PREF_RANGE_TYPE_MASK) == PCI_PREF_RANGE_TYPE_64) {
+               u32 mem_base_hi, mem_limit_hi;
+
+               pci_read_config_dword(dev, PCI_PREF_BASE_UPPER32, &mem_base_hi);
+               pci_read_config_dword(dev, PCI_PREF_LIMIT_UPPER32, &mem_limit_hi);
+
+               /*
+                * Some bridges set the base > limit by default, and some
+                * (broken) BIOSes do not initialize them.  If we find
+                * this, just assume they are not being used.
+                */
+               if (mem_base_hi <= mem_limit_hi) {
+                       base |= ((long) mem_base_hi) << 32;
+                       limit |= ((long) mem_limit_hi) << 32;
+               }
+       }
+
+       res = bus->resource[2];
+       if (base <= limit) {
+               res->flags = ((mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) |
+                             IORESOURCE_MEM | IORESOURCE_PREFETCH);
+               res->start = base;
+               res->end = limit + 0xfffff;
+               pci_resource_adjust(res, &pbm->mem_space);
+       }
+}
+
 /* Cook up fake bus resources for SUNW,simba PCI bridges which lack
  * a proper 'ranges' property.
  */
@@ -581,13 +664,8 @@ static void __devinit of_scan_pci_bridge(struct pci_pbm_info *pbm,
        simba = 0;
        if (ranges == NULL) {
                const char *model = of_get_property(node, "model", NULL);
-               if (model && !strcmp(model, "SUNW,simba")) {
+               if (model && !strcmp(model, "SUNW,simba"))
                        simba = 1;
-               } else {
-                       printk(KERN_DEBUG "Can't get ranges for PCI-PCI bridge %s\n",
-                              node->full_name);
-                       return;
-               }
        }
 
        bus = pci_add_new_bus(dev->bus, dev, busrange[0]);
@@ -611,7 +689,10 @@ static void __devinit of_scan_pci_bridge(struct pci_pbm_info *pbm,
        }
        if (simba) {
                apb_fake_ranges(dev, bus, pbm);
-               goto simba_cont;
+               goto after_ranges;
+       } else if (ranges == NULL) {
+               pci_cfg_fake_ranges(dev, bus, pbm);
+               goto after_ranges;
        }
        i = 1;
        for (; len >= 32; len -= 32, ranges += 8) {
@@ -650,7 +731,7 @@ static void __devinit of_scan_pci_bridge(struct pci_pbm_info *pbm,
                 */
                pci_resource_adjust(res, root);
        }
-simba_cont:
+after_ranges:
        sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus),
                bus->number);
        if (ofpci_verbose)
index f974fefc3ebc273ceea972b6a936d21888326017..4249214608af63116aea1d2db4fd176b201a1e8a 100644 (file)
@@ -291,8 +291,9 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm)
 
        for (i = 0; i < num_pbm_ranges; i++) {
                const struct linux_prom_pci_ranges *pr = &pbm_ranges[i];
-               unsigned long a;
+               unsigned long a, size;
                u32 parent_phys_hi, parent_phys_lo;
+               u32 size_hi, size_lo;
                int type;
 
                parent_phys_hi = pr->parent_phys_hi;
@@ -300,9 +301,14 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm)
                if (tlb_type == hypervisor)
                        parent_phys_hi &= 0x0fffffff;
 
+               size_hi = pr->size_hi;
+               size_lo = pr->size_lo;
+
                type = (pr->child_phys_hi >> 24) & 0x3;
                a = (((unsigned long)parent_phys_hi << 32UL) |
                     ((unsigned long)parent_phys_lo  <<  0UL));
+               size = (((unsigned long)size_hi << 32UL) |
+                       ((unsigned long)size_lo  <<  0UL));
 
                switch (type) {
                case 0:
@@ -313,7 +319,7 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm)
                case 1:
                        /* 16-bit IO space, 16MB */
                        pbm->io_space.start = a;
-                       pbm->io_space.end = a + ((16UL*1024UL*1024UL) - 1UL);
+                       pbm->io_space.end = a + size - 1UL;
                        pbm->io_space.flags = IORESOURCE_IO;
                        saw_io = 1;
                        break;
@@ -321,7 +327,7 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm)
                case 2:
                        /* 32-bit MEM space, 2GB */
                        pbm->mem_space.start = a;
-                       pbm->mem_space.end = a + (0x80000000UL - 1UL);
+                       pbm->mem_space.end = a + size - 1UL;
                        pbm->mem_space.flags = IORESOURCE_MEM;
                        saw_mem = 1;
                        break;
index 323d6c278518fd36d87ac443b22be131c8047ab0..22e1be5c7489aaf1420da8fb1c4becf437c2eb49 100644 (file)
@@ -636,13 +636,18 @@ static void apb_init(struct pci_bus *sabre_bus)
 static void sabre_scan_bus(struct pci_pbm_info *pbm)
 {
        static int once;
-       struct pci_bus *pbus;
 
        /* The APB bridge speaks to the Sabre host PCI bridge
         * at 66Mhz, but the front side of APB runs at 33Mhz
         * for both segments.
+        *
+        * Hummingbird systems do not use APB, so they run
+        * at 66MHZ.
         */
-       pbm->is_66mhz_capable = 0;
+       if (hummingbird_p)
+               pbm->is_66mhz_capable = 1;
+       else
+               pbm->is_66mhz_capable = 0;
 
        /* This driver has not been verified to handle
         * multiple SABREs yet, so trap this.
@@ -656,13 +661,13 @@ static void sabre_scan_bus(struct pci_pbm_info *pbm)
        }
        once++;
 
-       pbus = pci_scan_one_pbm(pbm);
-       if (!pbus)
+       pbm->pci_bus = pci_scan_one_pbm(pbm);
+       if (!pbm->pci_bus)
                return;
 
-       sabre_root_bus = pbus;
+       sabre_root_bus = pbm->pci_bus;
 
-       apb_init(pbus);
+       apb_init(pbm->pci_bus);
 
        sabre_register_error_handlers(pbm);
 }
index dad4b3ba705f5aaab2e354692db7eb229a490a4c..61036b346664b994cf329e90eef89305f7a28be3 100644 (file)
@@ -933,29 +933,29 @@ static void __init fire_irq_trans_init(struct device_node *dp)
  * This should conform to both Sunfire/Wildfire server and Fusion
  * desktop designs.
  */
-#define SYSIO_IMAP_SLOT0       0x2c04UL
-#define SYSIO_IMAP_SLOT1       0x2c0cUL
-#define SYSIO_IMAP_SLOT2       0x2c14UL
-#define SYSIO_IMAP_SLOT3       0x2c1cUL
-#define SYSIO_IMAP_SCSI                0x3004UL
-#define SYSIO_IMAP_ETH         0x300cUL
-#define SYSIO_IMAP_BPP         0x3014UL
-#define SYSIO_IMAP_AUDIO       0x301cUL
-#define SYSIO_IMAP_PFAIL       0x3024UL
-#define SYSIO_IMAP_KMS         0x302cUL
-#define SYSIO_IMAP_FLPY                0x3034UL
-#define SYSIO_IMAP_SHW         0x303cUL
-#define SYSIO_IMAP_KBD         0x3044UL
-#define SYSIO_IMAP_MS          0x304cUL
-#define SYSIO_IMAP_SER         0x3054UL
-#define SYSIO_IMAP_TIM0                0x3064UL
-#define SYSIO_IMAP_TIM1                0x306cUL
-#define SYSIO_IMAP_UE          0x3074UL
-#define SYSIO_IMAP_CE          0x307cUL
-#define SYSIO_IMAP_SBERR       0x3084UL
-#define SYSIO_IMAP_PMGMT       0x308cUL
-#define SYSIO_IMAP_GFX         0x3094UL
-#define SYSIO_IMAP_EUPA                0x309cUL
+#define SYSIO_IMAP_SLOT0       0x2c00UL
+#define SYSIO_IMAP_SLOT1       0x2c08UL
+#define SYSIO_IMAP_SLOT2       0x2c10UL
+#define SYSIO_IMAP_SLOT3       0x2c18UL
+#define SYSIO_IMAP_SCSI                0x3000UL
+#define SYSIO_IMAP_ETH         0x3008UL
+#define SYSIO_IMAP_BPP         0x3010UL
+#define SYSIO_IMAP_AUDIO       0x3018UL
+#define SYSIO_IMAP_PFAIL       0x3020UL
+#define SYSIO_IMAP_KMS         0x3028UL
+#define SYSIO_IMAP_FLPY                0x3030UL
+#define SYSIO_IMAP_SHW         0x3038UL
+#define SYSIO_IMAP_KBD         0x3040UL
+#define SYSIO_IMAP_MS          0x3048UL
+#define SYSIO_IMAP_SER         0x3050UL
+#define SYSIO_IMAP_TIM0                0x3060UL
+#define SYSIO_IMAP_TIM1                0x3068UL
+#define SYSIO_IMAP_UE          0x3070UL
+#define SYSIO_IMAP_CE          0x3078UL
+#define SYSIO_IMAP_SBERR       0x3080UL
+#define SYSIO_IMAP_PMGMT       0x3088UL
+#define SYSIO_IMAP_GFX         0x3090UL
+#define SYSIO_IMAP_EUPA                0x3098UL
 
 #define bogon     ((unsigned long) -1)
 static unsigned long sysio_irq_offsets[] = {
@@ -1006,10 +1006,10 @@ static unsigned long sysio_irq_offsets[] = {
  * Interrupt Clear register pointer, SYSIO specific version.
  */
 #define SYSIO_ICLR_UNUSED0     0x3400UL
-#define SYSIO_ICLR_SLOT0       0x340cUL
-#define SYSIO_ICLR_SLOT1       0x344cUL
-#define SYSIO_ICLR_SLOT2       0x348cUL
-#define SYSIO_ICLR_SLOT3       0x34ccUL
+#define SYSIO_ICLR_SLOT0       0x3408UL
+#define SYSIO_ICLR_SLOT1       0x3448UL
+#define SYSIO_ICLR_SLOT2       0x3488UL
+#define SYSIO_ICLR_SLOT3       0x34c8UL
 static unsigned long sysio_imap_to_iclr(unsigned long imap)
 {
        unsigned long diff = SYSIO_ICLR_UNUSED0 - SYSIO_IMAP_SLOT0;
@@ -1781,6 +1781,10 @@ static void __init of_fill_in_cpu_data(void)
                        }
 
                        cpu_data(cpuid).core_id = portid + 1;
+                       cpu_data(cpuid).proc_id = portid;
+#ifdef CONFIG_SMP
+                       sparc64_multi_core = 1;
+#endif
                } else {
                        cpu_data(cpuid).dcache_size =
                                of_getintprop_default(dp, "dcache-size", 16 * 1024);
@@ -1799,6 +1803,7 @@ static void __init of_fill_in_cpu_data(void)
                                of_getintprop_default(dp, "ecache-line-size", 64);
 
                        cpu_data(cpuid).core_id = 0;
+                       cpu_data(cpuid).proc_id = -1;
                }
 
 #ifdef CONFIG_SMP
index 91f6e2a74ad5fdc263c94fec5dd41dfb06ea254c..a1fd9bcc0b872a5485bb6514b9a835cad583ee49 100644 (file)
@@ -629,29 +629,29 @@ void sbus_set_sbus64(struct sbus_dev *sdev, int bursts)
  * This should conform to both Sunfire/Wildfire server and Fusion
  * desktop designs.
  */
-#define SYSIO_IMAP_SLOT0       0x2c04UL
-#define SYSIO_IMAP_SLOT1       0x2c0cUL
-#define SYSIO_IMAP_SLOT2       0x2c14UL
-#define SYSIO_IMAP_SLOT3       0x2c1cUL
-#define SYSIO_IMAP_SCSI                0x3004UL
-#define SYSIO_IMAP_ETH         0x300cUL
-#define SYSIO_IMAP_BPP         0x3014UL
-#define SYSIO_IMAP_AUDIO       0x301cUL
-#define SYSIO_IMAP_PFAIL       0x3024UL
-#define SYSIO_IMAP_KMS         0x302cUL
-#define SYSIO_IMAP_FLPY                0x3034UL
-#define SYSIO_IMAP_SHW         0x303cUL
-#define SYSIO_IMAP_KBD         0x3044UL
-#define SYSIO_IMAP_MS          0x304cUL
-#define SYSIO_IMAP_SER         0x3054UL
-#define SYSIO_IMAP_TIM0                0x3064UL
-#define SYSIO_IMAP_TIM1                0x306cUL
-#define SYSIO_IMAP_UE          0x3074UL
-#define SYSIO_IMAP_CE          0x307cUL
-#define SYSIO_IMAP_SBERR       0x3084UL
-#define SYSIO_IMAP_PMGMT       0x308cUL
-#define SYSIO_IMAP_GFX         0x3094UL
-#define SYSIO_IMAP_EUPA                0x309cUL
+#define SYSIO_IMAP_SLOT0       0x2c00UL
+#define SYSIO_IMAP_SLOT1       0x2c08UL
+#define SYSIO_IMAP_SLOT2       0x2c10UL
+#define SYSIO_IMAP_SLOT3       0x2c18UL
+#define SYSIO_IMAP_SCSI                0x3000UL
+#define SYSIO_IMAP_ETH         0x3008UL
+#define SYSIO_IMAP_BPP         0x3010UL
+#define SYSIO_IMAP_AUDIO       0x3018UL
+#define SYSIO_IMAP_PFAIL       0x3020UL
+#define SYSIO_IMAP_KMS         0x3028UL
+#define SYSIO_IMAP_FLPY                0x3030UL
+#define SYSIO_IMAP_SHW         0x3038UL
+#define SYSIO_IMAP_KBD         0x3040UL
+#define SYSIO_IMAP_MS          0x3048UL
+#define SYSIO_IMAP_SER         0x3050UL
+#define SYSIO_IMAP_TIM0                0x3060UL
+#define SYSIO_IMAP_TIM1                0x3068UL
+#define SYSIO_IMAP_UE          0x3070UL
+#define SYSIO_IMAP_CE          0x3078UL
+#define SYSIO_IMAP_SBERR       0x3080UL
+#define SYSIO_IMAP_PMGMT       0x3088UL
+#define SYSIO_IMAP_GFX         0x3090UL
+#define SYSIO_IMAP_EUPA                0x3098UL
 
 #define bogon     ((unsigned long) -1)
 static unsigned long sysio_irq_offsets[] = {
@@ -700,10 +700,10 @@ static unsigned long sysio_irq_offsets[] = {
  * Interrupt Clear register pointer, SYSIO specific version.
  */
 #define SYSIO_ICLR_UNUSED0     0x3400UL
-#define SYSIO_ICLR_SLOT0       0x340cUL
-#define SYSIO_ICLR_SLOT1       0x344cUL
-#define SYSIO_ICLR_SLOT2       0x348cUL
-#define SYSIO_ICLR_SLOT3       0x34ccUL
+#define SYSIO_ICLR_SLOT0       0x3408UL
+#define SYSIO_ICLR_SLOT1       0x3448UL
+#define SYSIO_ICLR_SLOT2       0x3488UL
+#define SYSIO_ICLR_SLOT3       0x34c8UL
 static unsigned long sysio_imap_to_iclr(unsigned long imap)
 {
        unsigned long diff = SYSIO_ICLR_UNUSED0 - SYSIO_IMAP_SLOT0;
index de9b4c13f1c71deee9d62cd69f41eb04d5e76a65..7490cc670a530e495a81e1d5d7d762b8228f7f22 100644 (file)
@@ -513,22 +513,3 @@ void sun_do_break(void)
 
 int serial_console = -1;
 int stop_a_enabled = 1;
-
-static int __init topology_init(void)
-{
-       int i, err;
-
-       err = -ENOMEM;
-
-       for_each_possible_cpu(i) {
-               struct cpu *p = kzalloc(sizeof(*p), GFP_KERNEL);
-               if (p) {
-                       register_cpu(p, i);
-                       err = 0;
-               }
-       }
-
-       return err;
-}
-
-subsys_initcall(topology_init);
index c550bba3490a528fb240f3dc4f5b565a0f59fdc4..4dcd7d0b60f2d8abb8e8ad7630df207cfc39ad21 100644 (file)
@@ -44,6 +44,8 @@
 
 extern void calibrate_delay(void);
 
+int sparc64_multi_core __read_mostly;
+
 /* Please don't make this stuff initdata!!!  --DaveM */
 unsigned char boot_cpu_id;
 
@@ -51,6 +53,8 @@ cpumask_t cpu_online_map __read_mostly = CPU_MASK_NONE;
 cpumask_t phys_cpu_present_map __read_mostly = CPU_MASK_NONE;
 cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly =
        { [0 ... NR_CPUS-1] = CPU_MASK_NONE };
+cpumask_t cpu_core_map[NR_CPUS] __read_mostly =
+       { [0 ... NR_CPUS-1] = CPU_MASK_NONE };
 static cpumask_t smp_commenced_mask;
 static cpumask_t cpu_callout_map;
 
@@ -1217,13 +1221,28 @@ void __devinit smp_fill_in_sib_core_maps(void)
                unsigned int j;
 
                if (cpu_data(i).core_id == 0) {
-                       cpu_set(i, cpu_sibling_map[i]);
+                       cpu_set(i, cpu_core_map[i]);
                        continue;
                }
 
                for_each_possible_cpu(j) {
                        if (cpu_data(i).core_id ==
                            cpu_data(j).core_id)
+                               cpu_set(j, cpu_core_map[i]);
+               }
+       }
+
+       for_each_possible_cpu(i) {
+               unsigned int j;
+
+               if (cpu_data(i).proc_id == -1) {
+                       cpu_set(i, cpu_sibling_map[i]);
+                       continue;
+               }
+
+               for_each_possible_cpu(j) {
+                       if (cpu_data(i).proc_id ==
+                           cpu_data(j).proc_id)
                                cpu_set(j, cpu_sibling_map[i]);
                }
        }
index d00f51a5683fd46234954ffa3648bb8a6822b851..6fa76161289910680c8bb3f350429f18248553a9 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/syscalls.h>
 #include <linux/percpu.h>
 #include <linux/init.h>
+#include <linux/rwsem.h>
 #include <net/compat.h>
 
 #include <asm/oplib.h>
@@ -58,7 +59,6 @@
 #include <asm/ns87303.h>
 #include <asm/timer.h>
 #include <asm/cpudata.h>
-#include <asm/rwsem.h>
 
 struct poll {
        int fd;
diff --git a/arch/sparc64/kernel/sysfs.c b/arch/sparc64/kernel/sysfs.c
new file mode 100644 (file)
index 0000000..cdb1477
--- /dev/null
@@ -0,0 +1,297 @@
+/* sysfs.c: Toplogy sysfs support code for sparc64.
+ *
+ * Copyright (C) 2007 David S. Miller <davem@davemloft.net>
+ */
+#include <linux/sysdev.h>
+#include <linux/cpu.h>
+#include <linux/smp.h>
+#include <linux/percpu.h>
+#include <linux/init.h>
+
+#include <asm/hypervisor.h>
+#include <asm/spitfire.h>
+
+static DEFINE_PER_CPU(struct hv_mmu_statistics, mmu_stats) __attribute__((aligned(64)));
+
+#define SHOW_MMUSTAT_ULONG(NAME) \
+static ssize_t show_##NAME(struct sys_device *dev, char *buf) \
+{ \
+       struct hv_mmu_statistics *p = &per_cpu(mmu_stats, dev->id); \
+       return sprintf(buf, "%lu\n", p->NAME); \
+} \
+static SYSDEV_ATTR(NAME, 0444, show_##NAME, NULL)
+
+SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctx0_8k_tte);
+SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctx0_8k_tte);
+SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctx0_64k_tte);
+SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctx0_64k_tte);
+SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctx0_4mb_tte);
+SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctx0_4mb_tte);
+SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctx0_256mb_tte);
+SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctx0_256mb_tte);
+SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctxnon0_8k_tte);
+SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctxnon0_8k_tte);
+SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctxnon0_64k_tte);
+SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctxnon0_64k_tte);
+SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctxnon0_4mb_tte);
+SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctxnon0_4mb_tte);
+SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctxnon0_256mb_tte);
+SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctxnon0_256mb_tte);
+SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctx0_8k_tte);
+SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctx0_8k_tte);
+SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctx0_64k_tte);
+SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctx0_64k_tte);
+SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctx0_4mb_tte);
+SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctx0_4mb_tte);
+SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctx0_256mb_tte);
+SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctx0_256mb_tte);
+SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctxnon0_8k_tte);
+SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctxnon0_8k_tte);
+SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctxnon0_64k_tte);
+SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctxnon0_64k_tte);
+SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctxnon0_4mb_tte);
+SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctxnon0_4mb_tte);
+SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctxnon0_256mb_tte);
+SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctxnon0_256mb_tte);
+
+static struct attribute *mmu_stat_attrs[] = {
+       &attr_immu_tsb_hits_ctx0_8k_tte.attr,
+       &attr_immu_tsb_ticks_ctx0_8k_tte.attr,
+       &attr_immu_tsb_hits_ctx0_64k_tte.attr,
+       &attr_immu_tsb_ticks_ctx0_64k_tte.attr,
+       &attr_immu_tsb_hits_ctx0_4mb_tte.attr,
+       &attr_immu_tsb_ticks_ctx0_4mb_tte.attr,
+       &attr_immu_tsb_hits_ctx0_256mb_tte.attr,
+       &attr_immu_tsb_ticks_ctx0_256mb_tte.attr,
+       &attr_immu_tsb_hits_ctxnon0_8k_tte.attr,
+       &attr_immu_tsb_ticks_ctxnon0_8k_tte.attr,
+       &attr_immu_tsb_hits_ctxnon0_64k_tte.attr,
+       &attr_immu_tsb_ticks_ctxnon0_64k_tte.attr,
+       &attr_immu_tsb_hits_ctxnon0_4mb_tte.attr,
+       &attr_immu_tsb_ticks_ctxnon0_4mb_tte.attr,
+       &attr_immu_tsb_hits_ctxnon0_256mb_tte.attr,
+       &attr_immu_tsb_ticks_ctxnon0_256mb_tte.attr,
+       &attr_dmmu_tsb_hits_ctx0_8k_tte.attr,
+       &attr_dmmu_tsb_ticks_ctx0_8k_tte.attr,
+       &attr_dmmu_tsb_hits_ctx0_64k_tte.attr,
+       &attr_dmmu_tsb_ticks_ctx0_64k_tte.attr,
+       &attr_dmmu_tsb_hits_ctx0_4mb_tte.attr,
+       &attr_dmmu_tsb_ticks_ctx0_4mb_tte.attr,
+       &attr_dmmu_tsb_hits_ctx0_256mb_tte.attr,
+       &attr_dmmu_tsb_ticks_ctx0_256mb_tte.attr,
+       &attr_dmmu_tsb_hits_ctxnon0_8k_tte.attr,
+       &attr_dmmu_tsb_ticks_ctxnon0_8k_tte.attr,
+       &attr_dmmu_tsb_hits_ctxnon0_64k_tte.attr,
+       &attr_dmmu_tsb_ticks_ctxnon0_64k_tte.attr,
+       &attr_dmmu_tsb_hits_ctxnon0_4mb_tte.attr,
+       &attr_dmmu_tsb_ticks_ctxnon0_4mb_tte.attr,
+       &attr_dmmu_tsb_hits_ctxnon0_256mb_tte.attr,
+       &attr_dmmu_tsb_ticks_ctxnon0_256mb_tte.attr,
+       NULL,
+};
+
+static struct attribute_group mmu_stat_group = {
+       .attrs = mmu_stat_attrs,
+       .name = "mmu_stats",
+};
+
+/* XXX convert to rusty's on_one_cpu */
+static unsigned long run_on_cpu(unsigned long cpu,
+                               unsigned long (*func)(unsigned long),
+                               unsigned long arg)
+{
+       cpumask_t old_affinity = current->cpus_allowed;
+       unsigned long ret;
+
+       /* should return -EINVAL to userspace */
+       if (set_cpus_allowed(current, cpumask_of_cpu(cpu)))
+               return 0;
+
+       ret = func(arg);
+
+       set_cpus_allowed(current, old_affinity);
+
+       return ret;
+}
+
+static unsigned long read_mmustat_enable(unsigned long junk)
+{
+       unsigned long ra = 0;
+
+       sun4v_mmustat_info(&ra);
+
+       return ra != 0;
+}
+
+static unsigned long write_mmustat_enable(unsigned long val)
+{
+       unsigned long ra, orig_ra;
+
+       if (val)
+               ra = __pa(&per_cpu(mmu_stats, smp_processor_id()));
+       else
+               ra = 0UL;
+
+       return sun4v_mmustat_conf(ra, &orig_ra);
+}
+
+static ssize_t show_mmustat_enable(struct sys_device *s, char *buf)
+{
+       unsigned long val = run_on_cpu(s->id, read_mmustat_enable, 0);
+       return sprintf(buf, "%lx\n", val);
+}
+
+static ssize_t store_mmustat_enable(struct sys_device *s, const char *buf, size_t count)
+{
+       unsigned long val, err;
+       int ret = sscanf(buf, "%ld", &val);
+
+       if (ret != 1)
+               return -EINVAL;
+
+       err = run_on_cpu(s->id, write_mmustat_enable, val);
+       if (err)
+               return -EIO;
+
+       return count;
+}
+
+static SYSDEV_ATTR(mmustat_enable, 0644, show_mmustat_enable, store_mmustat_enable);
+
+static int mmu_stats_supported;
+
+static int register_mmu_stats(struct sys_device *s)
+{
+       if (!mmu_stats_supported)
+               return 0;
+       sysdev_create_file(s, &attr_mmustat_enable);
+       return sysfs_create_group(&s->kobj, &mmu_stat_group);
+}
+
+#ifdef CONFIG_HOTPLUG_CPU
+static void unregister_mmu_stats(struct sys_device *s)
+{
+       if (!mmu_stats_supported)
+               return;
+       sysfs_remove_group(&s->kobj, &mmu_stat_group);
+       sysdev_remove_file(s, &attr_mmustat_enable);
+}
+#endif
+
+#define SHOW_CPUDATA_ULONG_NAME(NAME, MEMBER) \
+static ssize_t show_##NAME(struct sys_device *dev, char *buf) \
+{ \
+       cpuinfo_sparc *c = &cpu_data(dev->id); \
+       return sprintf(buf, "%lu\n", c->MEMBER); \
+}
+
+#define SHOW_CPUDATA_UINT_NAME(NAME, MEMBER) \
+static ssize_t show_##NAME(struct sys_device *dev, char *buf) \
+{ \
+       cpuinfo_sparc *c = &cpu_data(dev->id); \
+       return sprintf(buf, "%u\n", c->MEMBER); \
+}
+
+SHOW_CPUDATA_ULONG_NAME(clock_tick, clock_tick);
+SHOW_CPUDATA_ULONG_NAME(udelay_val, udelay_val);
+SHOW_CPUDATA_UINT_NAME(l1_dcache_size, dcache_size);
+SHOW_CPUDATA_UINT_NAME(l1_dcache_line_size, dcache_line_size);
+SHOW_CPUDATA_UINT_NAME(l1_icache_size, icache_size);
+SHOW_CPUDATA_UINT_NAME(l1_icache_line_size, icache_line_size);
+SHOW_CPUDATA_UINT_NAME(l2_cache_size, ecache_size);
+SHOW_CPUDATA_UINT_NAME(l2_cache_line_size, ecache_line_size);
+
+static struct sysdev_attribute cpu_core_attrs[] = {
+       _SYSDEV_ATTR(clock_tick,          0444, show_clock_tick, NULL),
+       _SYSDEV_ATTR(udelay_val,          0444, show_udelay_val, NULL),
+       _SYSDEV_ATTR(l1_dcache_size,      0444, show_l1_dcache_size, NULL),
+       _SYSDEV_ATTR(l1_dcache_line_size, 0444, show_l1_dcache_line_size, NULL),
+       _SYSDEV_ATTR(l1_icache_size,      0444, show_l1_icache_size, NULL),
+       _SYSDEV_ATTR(l1_icache_line_size, 0444, show_l1_icache_line_size, NULL),
+       _SYSDEV_ATTR(l2_cache_size,       0444, show_l2_cache_size, NULL),
+       _SYSDEV_ATTR(l2_cache_line_size,  0444, show_l2_cache_line_size, NULL),
+};
+
+static DEFINE_PER_CPU(struct cpu, cpu_devices);
+
+static void register_cpu_online(unsigned int cpu)
+{
+       struct cpu *c = &per_cpu(cpu_devices, cpu);
+       struct sys_device *s = &c->sysdev;
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(cpu_core_attrs); i++)
+               sysdev_create_file(s, &cpu_core_attrs[i]);
+
+       register_mmu_stats(s);
+}
+
+#ifdef CONFIG_HOTPLUG_CPU
+static void unregister_cpu_online(unsigned int cpu)
+{
+       struct cpu *c = &per_cpu(cpu_devices, cpu);
+       struct sys_device *s = &c->sysdev;
+       int i;
+
+       unregister_mmu_stats(s);
+       for (i = 0; i < ARRAY_SIZE(cpu_core_attrs); i++)
+               sysdev_remove_file(s, &cpu_core_attrs[i]);
+}
+#endif
+
+static int __cpuinit sysfs_cpu_notify(struct notifier_block *self,
+                                     unsigned long action, void *hcpu)
+{
+       unsigned int cpu = (unsigned int)(long)hcpu;
+
+       switch (action) {
+       case CPU_ONLINE:
+       case CPU_ONLINE_FROZEN:
+               register_cpu_online(cpu);
+               break;
+#ifdef CONFIG_HOTPLUG_CPU
+       case CPU_DEAD:
+       case CPU_DEAD_FROZEN:
+               unregister_cpu_online(cpu);
+               break;
+#endif
+       }
+       return NOTIFY_OK;
+}
+
+static struct notifier_block __cpuinitdata sysfs_cpu_nb = {
+       .notifier_call  = sysfs_cpu_notify,
+};
+
+static void __init check_mmu_stats(void)
+{
+       unsigned long dummy1, err;
+
+       if (tlb_type != hypervisor)
+               return;
+
+       err = sun4v_mmustat_info(&dummy1);
+       if (!err)
+               mmu_stats_supported = 1;
+}
+
+static int __init topology_init(void)
+{
+       int cpu;
+
+       check_mmu_stats();
+
+       register_cpu_notifier(&sysfs_cpu_nb);
+
+       for_each_possible_cpu(cpu) {
+               struct cpu *c = &per_cpu(cpu_devices, cpu);
+
+               register_cpu(c, cpu);
+               if (cpu_online(cpu))
+                       register_cpu_online(cpu);
+       }
+
+       return 0;
+}
+
+subsys_initcall(topology_init);
index c504312219b42b8f9797c50fe1569e5f05163a84..e6ff30266542a79b8909a5ef5f4e7991e58e16ca 100644 (file)
@@ -278,6 +278,7 @@ config HIGHMEM
 config KERNEL_STACK_ORDER
        int "Kernel stack size order"
        default 1 if 64BIT
+       range 1 10 if 64BIT
        default 0 if !64BIT
        help
        This option determines the size of UML kernel stacks.  They will
index ced99106f7982b84a13eed11a71890f04ba4ae2e..4bd40bb43ec27f3935306fb784e84bdf160172a4 100644 (file)
@@ -3,6 +3,7 @@
  * Licensed under the GPL
  */
 
+#include "linux/kernel.h"
 #include "linux/sched.h"
 #include "linux/slab.h"
 #include "linux/list.h"
index 911539293871d271ed306c36fd1b113f6acc9203..4739dd527b43ab8ff5cf59ab007cfbbd033b90d8 100644 (file)
@@ -1,3 +1,4 @@
+#include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/console.h>
 
index 70509ddaac035cd60537e286883614323410be6d..2e09f162c42f01b6ac39f3689eae208f5d4b75b1 100644 (file)
@@ -20,6 +20,7 @@
 #define MAJOR_NR UBD_MAJOR
 #define UBD_SHIFT 4
 
+#include "linux/kernel.h"
 #include "linux/module.h"
 #include "linux/blkdev.h"
 #include "linux/hdreg.h"
index 541f4a8ca512ab3519a19005e490b2a9246d7ae3..7376ee44e330a878f55737ef7a5ef3529d74ccd1 100644 (file)
@@ -9,6 +9,7 @@ OFFSET(HOST_TASK_REGS, task_struct, thread.regs);
 OFFSET(HOST_TASK_PID, task_struct, pid);
 
 DEFINE(UM_KERN_PAGE_SIZE, PAGE_SIZE);
+DEFINE(UM_KERN_PAGE_MASK, PAGE_MASK);
 DEFINE(UM_NSEC_PER_SEC, NSEC_PER_SEC);
 
 DEFINE_STR(UM_KERN_EMERG, KERN_EMERG);
index 8b7f2cdedf945148ffd96306ac04024dc9a0a7ee..c716b5a6db13d9552a59e7f7ec5688229ca9bf0e 100644 (file)
@@ -1,8 +1,9 @@
-/* 
+/*
  * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
  * Licensed under the GPL
  */
 
+#include "linux/kernel.h"
 #include "linux/init.h"
 #include "linux/ctype.h"
 #include "linux/proc_fs.h"
@@ -24,11 +25,14 @@ static int read_proc_exitcode(char *page, char **start, off_t off,
        val = uml_exitcode;
        len = sprintf(page, "%d\n", val);
        len -= off;
-       if(len <= off+count) *eof = 1;
+       if(len <= off+count)
+               *eof = 1;
        *start = page + off;
-       if(len > count) len = count;
-       if(len < 0) len = 0;
-       return(len);
+       if(len > count)
+               len = count;
+       if(len < 0)
+               len = 0;
+       return len;
 }
 
 static int write_proc_exitcode(struct file *file, const char __user *buffer,
@@ -38,12 +42,14 @@ static int write_proc_exitcode(struct file *file, const char __user *buffer,
        int tmp;
 
        if(copy_from_user(buf, buffer, count))
-               return(-EFAULT);
+               return -EFAULT;
+
        tmp = simple_strtol(buf, &end, 0);
        if((*end != '\0') && !isspace(*end))
-               return(-EINVAL);
+               return -EINVAL;
+
        uml_exitcode = tmp;
-       return(count);
+       return count;
 }
 
 static int make_proc_exitcode(void)
@@ -54,24 +60,13 @@ static int make_proc_exitcode(void)
        if(ent == NULL){
                printk(KERN_WARNING "make_proc_exitcode : Failed to register "
                       "/proc/exitcode\n");
-               return(0);
+               return 0;
        }
 
        ent->read_proc = read_proc_exitcode;
        ent->write_proc = write_proc_exitcode;
-       
-       return(0);
+
+       return 0;
 }
 
 __initcall(make_proc_exitcode);
-
-/*
- * Overrides for Emacs so that we follow Linus's tabbing style.
- * Emacs will notice this stuff at the end of the file and automatically
- * adjust the settings for this buffer only.  This must remain at the end
- * of the file.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-file-style: "linux"
- * End:
- */
index ea9a23696f365e176d6db5b5e7cfcc3e18f58c25..fb510d40480cc2dbec1dc6fd0651364de3981808 100644 (file)
@@ -24,6 +24,7 @@
 #include "uml-config.h"
 #include "os.h"
 #include "um_malloc.h"
+#include "kern_constants.h"
 
 /* Set in main, unchanged thereafter */
 char *linux_prog;
@@ -232,7 +233,8 @@ void *__wrap_malloc(int size)
 
        if(!CAN_KMALLOC())
                return __real_malloc(size);
-       else if(size <= PAGE_SIZE) /* finding contiguos pages can be hard*/
+       else if(size <= UM_KERN_PAGE_SIZE)
+               /* finding contiguous pages can be hard*/
                ret = um_kmalloc(size);
        else ret = um_vmalloc(size);
 
index 5c89463207996a60e942366f561a7fb2f2273f82..0f7df4eb903fb79cfcacf3c65322f3f34663dc3f 100644 (file)
@@ -25,6 +25,7 @@
 #include "sysdep/ptrace.h"
 #include "sysdep/stub.h"
 #include "init.h"
+#include "kern_constants.h"
 
 extern unsigned long batch_syscall_stub, __syscall_stub_start;
 
@@ -149,8 +150,8 @@ long run_syscall_stub(struct mm_id * mm_idp, int syscall,
        *stack = 0;
        multi_op_count++;
 
-       if(!done && ((((unsigned long) stack) & ~PAGE_MASK) <
-                    PAGE_SIZE - 10 * sizeof(long))){
+       if(!done && ((((unsigned long) stack) & ~UM_KERN_PAGE_MASK) <
+                    UM_KERN_PAGE_SIZE - 10 * sizeof(long))){
                *addr = stack;
                return 0;
        }
@@ -168,8 +169,8 @@ long syscall_stub_data(struct mm_id * mm_idp,
        /* If *addr still is uninitialized, it *must* contain NULL.
         * Thus in this case do_syscall_stub correctly won't be called.
         */
-       if((((unsigned long) *addr) & ~PAGE_MASK) >=
-          PAGE_SIZE - (10 + data_count) * sizeof(long)) {
+       if((((unsigned long) *addr) & ~UM_KERN_PAGE_MASK) >=
+          UM_KERN_PAGE_SIZE - (10 + data_count) * sizeof(long)) {
                ret = do_syscall_stub(mm_idp, addr);
                /* in case of error, don't overwrite data on stack */
                if(ret)
@@ -183,8 +184,8 @@ long syscall_stub_data(struct mm_id * mm_idp,
 
        memcpy(stack + 1, data, data_count * sizeof(long));
 
-       *stub_addr = (void *)(((unsigned long)(stack + 1) & ~PAGE_MASK) +
-                             UML_CONFIG_STUB_DATA);
+       *stub_addr = (void *)(((unsigned long)(stack + 1) &
+                              ~UM_KERN_PAGE_MASK) + UML_CONFIG_STUB_DATA);
 
        return 0;
 }
index f9d2f8545afedd12f06a2e3a216eea2757759999..46c00cc429bc70e49ba12bfb97b3c4eb88ff2b32 100644 (file)
@@ -252,11 +252,12 @@ int start_userspace(unsigned long stub_stack)
        unsigned long sp;
        int pid, status, n, flags;
 
-       stack = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC,
+       stack = mmap(NULL, UM_KERN_PAGE_SIZE,
+                    PROT_READ | PROT_WRITE | PROT_EXEC,
                     MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
        if(stack == MAP_FAILED)
                panic("start_userspace : mmap failed, errno = %d", errno);
-       sp = (unsigned long) stack + PAGE_SIZE - sizeof(void *);
+       sp = (unsigned long) stack + UM_KERN_PAGE_SIZE - sizeof(void *);
 
        flags = CLONE_FILES | SIGCHLD;
        if(proc_mm) flags |= CLONE_VM;
@@ -279,7 +280,7 @@ int start_userspace(unsigned long stub_stack)
                panic("start_userspace : PTRACE_OLDSETOPTIONS failed, errno=%d\n",
                      errno);
 
-       if(munmap(stack, PAGE_SIZE) < 0)
+       if(munmap(stack, UM_KERN_PAGE_SIZE) < 0)
                panic("start_userspace : munmap failed, errno = %d\n", errno);
 
        return(pid);
@@ -365,7 +366,7 @@ static int __init init_thread_regs(void)
        thread_regs[REGS_IP_INDEX] = UML_CONFIG_STUB_CODE +
                                (unsigned long) stub_clone_handler -
                                (unsigned long) &__syscall_stub_start;
-       thread_regs[REGS_SP_INDEX] = UML_CONFIG_STUB_DATA + PAGE_SIZE -
+       thread_regs[REGS_SP_INDEX] = UML_CONFIG_STUB_DATA + UM_KERN_PAGE_SIZE -
                sizeof(void *);
 #ifdef __SIGNAL_FRAMESIZE
        thread_regs[REGS_SP_INDEX] -= __SIGNAL_FRAMESIZE;
@@ -453,7 +454,7 @@ void map_stub_pages(int fd, unsigned long code,
                                      .u         =
                                      { .mmap    =
                                        { .addr    = code,
-                                         .len     = PAGE_SIZE,
+                                         .len     = UM_KERN_PAGE_SIZE,
                                          .prot    = PROT_EXEC,
                                          .flags   = MAP_FIXED | MAP_PRIVATE,
                                          .fd      = code_fd,
@@ -476,7 +477,7 @@ void map_stub_pages(int fd, unsigned long code,
                                  .u         =
                                  { .mmap    =
                                    { .addr    = data,
-                                     .len     = PAGE_SIZE,
+                                     .len     = UM_KERN_PAGE_SIZE,
                                      .prot    = PROT_READ | PROT_WRITE,
                                      .flags   = MAP_FIXED | MAP_SHARED,
                                      .fd      = map_fd,
index 3fc13fa8729d27c5578459eab5b9742d1ee1f842..46f613975c199ebc2a323b14c399074190c9cd3f 100644 (file)
@@ -107,11 +107,12 @@ static int start_ptraced_child(void **stack_out)
        unsigned long sp;
        int pid, n, status;
 
-       stack = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC,
+       stack = mmap(NULL, UM_KERN_PAGE_SIZE,
+                    PROT_READ | PROT_WRITE | PROT_EXEC,
                     MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
        if(stack == MAP_FAILED)
                fatal_perror("check_ptrace : mmap failed");
-       sp = (unsigned long) stack + PAGE_SIZE - sizeof(void *);
+       sp = (unsigned long) stack + UM_KERN_PAGE_SIZE - sizeof(void *);
        pid = clone(ptrace_child, (void *) sp, SIGCHLD, NULL);
        if(pid < 0)
                fatal_perror("start_ptraced_child : clone failed");
@@ -153,7 +154,7 @@ static int stop_ptraced_child(int pid, void *stack, int exitcode,
                ret = -1;
        }
 
-       if(munmap(stack, PAGE_SIZE) < 0)
+       if(munmap(stack, UM_KERN_PAGE_SIZE) < 0)
                fatal_perror("check_ptrace : munmap failed");
        return ret;
 }
index cb29fb96948dd2653886e2fe444fb35ea55dae48..aac1c0be54c6b8f99c032f61f6b29f904d91977d 100644 (file)
@@ -465,13 +465,14 @@ static unsigned int die_nest_count;
 
 unsigned __kprobes long oops_begin(void)
 {
-       int cpu = smp_processor_id();
+       int cpu;
        unsigned long flags;
 
        oops_enter();
 
        /* racy, but better than risking deadlock. */
        local_irq_save(flags);
+       cpu = smp_processor_id();
        if (!spin_trylock(&die_lock)) { 
                if (cpu == die_owner) 
                        /* nested oops. should stop eventually */;
index bfb62a13d7eee005f2b364b159b21096e811ae53..635e58d443d7c555f118cca839656bfad2adb15e 100644 (file)
@@ -476,6 +476,12 @@ bad_area:
 bad_area_nosemaphore:
        /* User mode accesses just cause a SIGSEGV */
        if (error_code & PF_USER) {
+
+               /*
+                * It's possible to have interrupts off here.
+                */
+               local_irq_enable();
+
                if (is_prefetch(regs, address, error_code))
                        return;
 
index 1ad5111aec381d7042648c0a871f2707181f3400..efb6e845114ec727430860981b03b22495f9d299 100644 (file)
@@ -79,6 +79,8 @@ void show_mem(void)
                        if (unlikely(i % MAX_ORDER_NR_PAGES == 0)) {
                                touch_nmi_watchdog();
                        }
+                       if (!pfn_valid(pgdat->node_start_pfn + i))
+                               continue;
                        page = pfn_to_page(pgdat->node_start_pfn + i);
                        total++;
                        if (PageReserved(page))
index 698079b3a3368f86735a584daa26384456d11dc1..d0323cd6a2ead094411a48109e2512d76c17e9e1 100644 (file)
@@ -39,6 +39,7 @@ int main(void)
        DEFINE(PT_LEND, offsetof (struct pt_regs, lend));
        DEFINE(PT_LCOUNT, offsetof (struct pt_regs, lcount));
        DEFINE(PT_SAR, offsetof (struct pt_regs, sar));
+       DEFINE(PT_ICOUNTLEVEL, offsetof (struct pt_regs, icountlevel));
        DEFINE(PT_SYSCALL, offsetof (struct pt_regs, syscall));
        DEFINE(PT_AREG, offsetof (struct pt_regs, areg[0]));
        DEFINE(PT_AREG0, offsetof (struct pt_regs, areg[0]));
index 9e271ba009bfd88645008e0adca5d7b3e87a4e0d..8dc7a2c26ff9f87f9854118d0c1006f544c8202f 100644 (file)
@@ -125,8 +125,9 @@ _user_exception:
 
        movi    a2, 0
        rsr     a3, SAR
-       wsr     a2, ICOUNTLEVEL
+       xsr     a2, ICOUNTLEVEL
        s32i    a3, a1, PT_SAR
+       s32i    a2, a1, PT_ICOUNTLEVEL
 
        /* Rotate ws so that the current windowbase is at bit0. */
        /* Assume ws = xxwww1yyyy. Rotate ws right, so that a2 = yyyyxxwww1 */
@@ -276,8 +277,9 @@ _kernel_exception:
 
        movi    a2, 0
        rsr     a3, SAR
-       wsr     a2, ICOUNTLEVEL
+       xsr     a2, ICOUNTLEVEL
        s32i    a3, a1, PT_SAR
+       s32i    a2, a1, PT_ICOUNTLEVEL
 
        /* Rotate ws so that the current windowbase is at bit0. */
        /* Assume ws = xxwww1yyyy. Rotate ws right, so that a2 = yyyyxxwww1 */
@@ -330,14 +332,16 @@ _kernel_exception:
 
 common_exception:
 
-       /* Save EXCVADDR, DEBUGCAUSE, and PC, and clear LCOUNT */
+       /* Save some registers, disable loops and clear the syscall flag. */
 
        rsr     a2, DEBUGCAUSE
        rsr     a3, EPC_1
        s32i    a2, a1, PT_DEBUGCAUSE
        s32i    a3, a1, PT_PC
 
+       movi    a2, -1
        rsr     a3, EXCVADDR
+       s32i    a2, a1, PT_SYSCALL
        movi    a2, 0
        s32i    a3, a1, PT_EXCVADDR
        xsr     a2, LCOUNT
@@ -450,27 +454,8 @@ common_exception_return:
 
        /* Restore the state of the task and return from the exception. */
 
-
-       /* If we are returning from a user exception, and the process
-        * to run next has PT_SINGLESTEP set, we want to setup
-        * ICOUNT and ICOUNTLEVEL to step one instruction.
-        * PT_SINGLESTEP is set by sys_ptrace (ptrace.c)
-        */
-
 4:     /* a2 holds GET_CURRENT(a2,a1)  */
 
-       l32i    a3, a2, TI_TASK
-       l32i    a3, a3, TASK_PTRACE
-       bbci.l  a3, PT_SINGLESTEP_BIT, 1f # jump if single-step flag is not set
-
-       movi    a3, -2                  # PT_SINGLESTEP flag is set,
-       movi    a4, 1                   # icountlevel of 1 means it won't
-       wsr     a3, ICOUNT              # start counting until after rfe
-       wsr     a4, ICOUNTLEVEL         # so setup icount & icountlevel.
-       isync
-
-1:
-
 #if XCHAL_EXTRA_SA_SIZE
 
        /* For user exceptions, restore the extra state from the user's TCB. */
@@ -665,6 +650,13 @@ common_exception_exit:
        wsr     a3, LEND
        wsr     a2, LCOUNT
 
+       /* We control single stepping through the ICOUNTLEVEL register. */
+
+       l32i    a2, a1, PT_ICOUNTLEVEL
+       movi    a3, -2
+       wsr     a2, ICOUNTLEVEL
+       wsr     a3, ICOUNT
+
        /* Check if it was double exception. */
 
        l32i    a0, a1, PT_DEPC
index ea89910efa44f523e928ffc6a1b33938e5e97d45..67e69139520bd91cb834dbfc68d591039712d3b7 100644 (file)
@@ -19,6 +19,8 @@
 #include <asm/page.h>
 #include <asm/cacheasm.h>
 
+#include <linux/linkage.h>
+
 /*
  * This module contains the entry code for kernel images. It performs the
  * minimal setup needed to call the generic C routines.
@@ -227,13 +229,14 @@ _startup:
 should_never_return:
        j       should_never_return
 
-       /* Define some common data structures here.  We define them
-        * here in this assembly file due to their unusual alignment
-        * requirements.
-        */
 
-       .comm   swapper_pg_dir,PAGE_SIZE,PAGE_SIZE
-       .comm   empty_bad_page_table,PAGE_SIZE,PAGE_SIZE
-       .comm   empty_bad_page,PAGE_SIZE,PAGE_SIZE
-       .comm   empty_zero_page,PAGE_SIZE,PAGE_SIZE
+/*
+ * BSS section
+ */
+       
+.section ".bss.page_aligned", "w"
+ENTRY(swapper_pg_dir)
+       .fill   PAGE_SIZE, 1, 0
+ENTRY(empty_zero_page)
+       .fill   PAGE_SIZE, 1, 0
 
index 45571ccb72d63e16b169b3aa2301676d0917fc52..77deae5290f06e43f64c379ba1bc33646b325afb 100644 (file)
@@ -401,7 +401,7 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
  * Also, think for a moment about likes of floppy.c that
  * include architecture specific parts. They may want to redefine ins/outs.
  *
- * We do not use horroble macroses here because we want to
+ * We do not use horrible macros here because we want to
  * advance pointer by sizeof(size).
  */
 void outsb(unsigned long addr, const void *src, unsigned long count) {
index 1ecf6716c3274a1ce2575236b036e864c57e6127..2e8d398cf19627aef6db11a8e6d723ae7b106fa7 100644 (file)
@@ -41,6 +41,7 @@
 #include <asm/platform.h>
 #include <asm/page.h>
 #include <asm/setup.h>
+#include <asm/param.h>
 
 #if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
 struct screen_info screen_info = { 0, 24, 0, 0, 0, 80, 0, 0, 0, 24, 1, 16};
index 58107672a619eeebf783b8249658bfc6396274ed..033aae0336d260d323f07c3abaad1ea521690d7c 100644 (file)
-// TODO coprocessor stuff
 /*
- *  linux/arch/xtensa/kernel/signal.c
+ * arch/xtensa/kernel/signal.c
  *
- *  Copyright (C) 1991, 1992  Linus Torvalds
- *  1997-11-28  Modified for POSIX.1b signals by Richard Henderson
- *
- *  Joe Taylor <joe@tensilica.com>
- *  Chris Zankel <chris@zankel.net>
+ * Default platform functions.
  *
+ * 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) 2005, 2006 Tensilica Inc.
+ * Copyright (C) 1991, 1992  Linus Torvalds
+ * 1997-11-28  Modified for POSIX.1b signals by Richard Henderson
  *
+ * Chris Zankel <chris@zankel.net>
+ * Joe Taylor <joe@tensilica.com>
  */
 
-#include <asm/variant/core.h>
-#include <asm/coprocessor.h>
-#include <linux/sched.h>
-#include <linux/mm.h>
-#include <linux/smp.h>
-#include <linux/kernel.h>
 #include <linux/signal.h>
 #include <linux/errno.h>
-#include <linux/wait.h>
 #include <linux/ptrace.h>
-#include <linux/unistd.h>
-#include <linux/stddef.h>
 #include <linux/personality.h>
+#include <linux/freezer.h>
+
 #include <asm/ucontext.h>
 #include <asm/uaccess.h>
-#include <asm/pgtable.h>
 #include <asm/cacheflush.h>
+#include <asm/coprocessor.h>
+#include <asm/unistd.h>
 
 #define DEBUG_SIG  0
 
 #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
 
-asmlinkage long sys_wait4(pid_t pid,unsigned int * stat_addr, int options,
-                         struct rusage * ru);
 asmlinkage int do_signal(struct pt_regs *regs, sigset_t *oldset);
 
 extern struct task_struct *coproc_owners[];
 
+extern void release_all_cp (struct task_struct *);
 
-/*
- * Atomically swap in the new signal mask, and wait for a signal.
+struct rt_sigframe
+{
+       struct siginfo info;
+       struct ucontext uc;
+       cp_state_t cpstate;
+       unsigned char retcode[6];
+       unsigned int window[4];
+};
+
+/* 
+ * Flush register windows stored in pt_regs to stack.
+ * Returns 1 for errors.
+ *
+ * Note that windowbase, windowstart, and wmask are not updated!
  */
 
-int xtensa_sigsuspend(struct pt_regs *regs)
+int
+flush_window_regs_user(struct pt_regs *regs)
 {
-       old_sigset_t mask = (old_sigset_t) regs->areg[3];
-       sigset_t saveset;
+       const unsigned long ws = regs->windowstart;
+       const unsigned long wb = regs->windowbase;
+       unsigned long sp = 0;
+       unsigned long wm;
+       int err = 1;
+       int base;
 
-       mask &= _BLOCKABLE;
-       spin_lock_irq(&current->sighand->siglock);
-       saveset = current->blocked;
-       siginitset(&current->blocked, mask);
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
+       /* Return if no other frames. */
 
-       regs->areg[2] = -EINTR;
-       while (1) {
-               current->state = TASK_INTERRUPTIBLE;
-               schedule();
-               if (do_signal(regs, &saveset))
-                       return -EINTR;
-       }
-}
+       if (regs->wmask == 1)
+               return 0;
 
-asmlinkage int
-xtensa_rt_sigsuspend(struct pt_regs *regs)
-{
-       sigset_t *unewset = (sigset_t *) regs->areg[4];
-       size_t sigsetsize = (size_t) regs->areg[3];
-       sigset_t saveset, newset;
-       /* XXX: Don't preclude handling different sized sigset_t's.  */
-       if (sigsetsize != sizeof(sigset_t))
-               return -EINVAL;
+       /* Rotate windowmask and skip empty frames. */
 
-       if (copy_from_user(&newset, unewset, sizeof(newset)))
-               return -EFAULT;
-       sigdelsetmask(&newset, ~_BLOCKABLE);
-       spin_lock_irq(&current->sighand->siglock);
-       saveset = current->blocked;
-       current->blocked = newset;
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
+       wm = (ws >> wb) | (ws << (XCHAL_NUM_AREGS / 4 - wb));
+       base = (XCHAL_NUM_AREGS / 4) - (regs->wmask >> 4);
+               
+       /* For call8 or call12 frames, we need the previous stack pointer. */
 
-       regs->areg[2] = -EINTR;
-       while (1) {
-               current->state = TASK_INTERRUPTIBLE;
-               schedule();
-               if (do_signal(regs, &saveset))
-                       return -EINTR;
-       }
-}
+       if ((regs->wmask & 2) == 0)
+               if (__get_user(sp, (int*)(regs->areg[base * 4 + 1] - 12)))
+                       goto errout;
 
-asmlinkage int
-xtensa_sigaction(int sig, const struct old_sigaction *act,
-             struct old_sigaction *oact)
-{
-       struct k_sigaction new_ka, old_ka;
-       int ret;
+       /* Spill frames to stack. */
 
-       if (act) {
-               old_sigset_t mask;
-               if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
-                   __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
-                   __get_user(new_ka.sa.sa_restorer, &act->sa_restorer))
-                       return -EFAULT;
-               __get_user(new_ka.sa.sa_flags, &act->sa_flags);
-               __get_user(mask, &act->sa_mask);
-               siginitset(&new_ka.sa.sa_mask, mask);
-       }
+       while (base < XCHAL_NUM_AREGS / 4) {
 
-       ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
+               int m = (wm >> base);
+               int inc = 0;
 
-       if (!ret && oact) {
-               if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
-                   __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
-                   __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer))
-                       return -EFAULT;
-               __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
-               __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
-       }
+               /* Save registers a4..a7 (call8) or a4...a11 (call12) */
 
-       return ret;
-}
+               if (m & 2) {                    /* call4 */
+                       inc = 1;
 
-asmlinkage int
-xtensa_sigaltstack(struct pt_regs *regs)
-{
-       const stack_t *uss = (stack_t *) regs->areg[4];
-       stack_t *uoss = (stack_t *) regs->areg[3];
+               } else if (m & 4) {             /* call8 */
+                       if (copy_to_user((void*)(sp - 32),
+                                          &regs->areg[(base + 1) * 4], 16))
+                               goto errout;
+                       inc = 2;
 
-       if (regs->depc > 64)
-               panic ("Double exception sys_sigreturn\n");
+               } else if (m & 8) {     /* call12 */
+                       if (copy_to_user((void*)(sp - 48),
+                                          &regs->areg[(base + 1) * 4], 32))
+                               goto errout;
+                       inc = 3;
+               }
 
+               /* Save current frame a0..a3 under next SP */
 
-       return do_sigaltstack(uss, uoss, regs->areg[1]);
-}
+               sp = regs->areg[((base + inc) * 4 + 1) % XCHAL_NUM_AREGS];
+               if (copy_to_user((void*)(sp - 16), &regs->areg[base * 4], 16))
+                       goto errout;
+
+               /* Get current stack pointer for next loop iteration. */
+
+               sp = regs->areg[base * 4 + 1];
+               base += inc;
+       }
+
+       return 0;
 
+errout:
+       return err;
+}
 
 /*
- * Do a signal return; undo the signal stack.
+ * Note: We don't copy double exception 'regs', we have to finish double exc. 
+ * first before we return to signal handler! This dbl.exc.handler might cause 
+ * another double exception, but I think we are fine as the situation is the 
+ * same as if we had returned to the signal handerl and got an interrupt 
+ * immediately...
  */
 
-struct sigframe
-{
-       struct sigcontext sc;
-       struct _cpstate cpstate;
-       unsigned long extramask[_NSIG_WORDS-1];
-       unsigned char retcode[6];
-       unsigned int reserved[4]; /* Reserved area for chaining */
-       unsigned int window[4]; /* Window of 4 registers for initial context */
-};
-
-struct rt_sigframe
+static int
+setup_sigcontext(struct sigcontext __user *sc, cp_state_t *cpstate,
+                struct pt_regs *regs, unsigned long mask)
 {
-       struct siginfo info;
-       struct ucontext uc;
-       struct _cpstate cpstate;
-       unsigned char retcode[6];
-       unsigned int reserved[4]; /* Reserved area for chaining */
-       unsigned int window[4]; /* Window of 4 registers for initial context */
-};
+       int err = 0;
 
-extern void release_all_cp (struct task_struct *);
+#define COPY(x)        err |= __put_user(regs->x, &sc->sc_##x)
+       COPY(pc);
+       COPY(ps);
+       COPY(lbeg);
+       COPY(lend);
+       COPY(lcount);
+       COPY(sar);
+#undef COPY
 
+       err |= flush_window_regs_user(regs);
+       err |= __copy_to_user (sc->sc_a, regs->areg, 16 * 4);
 
-// FIXME restore_cpextra
-static inline int
-restore_cpextra (struct _cpstate *buf)
-{
-#if 0
-       /* The signal handler may have used coprocessors in which
-        * case they are still enabled.  We disable them to force a
-        * reloading of the original task's CP state by the lazy
-        * context-switching mechanisms of CP exception handling.
-        * Also, we essentially discard any coprocessor state that the
-        * signal handler created. */
+       // err |= __copy_to_user (sc->sc_a, regs->areg, XCHAL_NUM_AREGS * 4)
 
-       struct task_struct *tsk = current;
-       release_all_cp(tsk);
-       return __copy_from_user(tsk->thread.cpextra, buf, XTENSA_CP_EXTRA_SIZE);
+#if XCHAL_HAVE_CP
+# error Coprocessors unsupported
+       err |= save_cpextra(cpstate);
+       err |= __put_user(err ? NULL : cpstate, &sc->sc_cpstate);
 #endif
-       return 0;
-}
-
-/* Note: We don't copy double exception 'tregs', we have to finish double exc. first before we return to signal handler! This dbl.exc.handler might cause another double exception, but I think we are fine as the situation is the same as if we had returned to the signal handerl and got an interrupt immediately...
- */
+       /* non-iBCS2 extensions.. */
+       err |= __put_user(mask, &sc->oldmask);
 
+       return err;
+}
 
 static int
-restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc)
+restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
 {
-       struct thread_struct *thread;
        unsigned int err = 0;
        unsigned long ps;
-       struct _cpstate *buf;
 
 #define COPY(x)        err |= __get_user(regs->x, &sc->sc_##x)
        COPY(pc);
-       COPY(depc);
-       COPY(wmask);
        COPY(lbeg);
        COPY(lend);
        COPY(lcount);
        COPY(sar);
-       COPY(windowbase);
-       COPY(windowstart);
 #undef COPY
 
+       /* All registers were flushed to stack. Start with a prestine frame. */
+
+       regs->wmask = 1;
+       regs->windowbase = 0;
+       regs->windowstart = 1;
+
        /* For PS, restore only PS.CALLINC.
         * Assume that all other bits are either the same as for the signal
         * handler, or the user mode value doesn't matter (e.g. PS.OWB).
         */
        err |= __get_user(ps, &sc->sc_ps);
-       regs->ps = (regs->ps & ~PS_CALLINC_MASK)
-               | (ps & PS_CALLINC_MASK);
+       regs->ps = (regs->ps & ~PS_CALLINC_MASK) | (ps & PS_CALLINC_MASK);
 
        /* Additional corruption checks */
 
-       if ((regs->windowbase >= (XCHAL_NUM_AREGS/4))
-       || ((regs->windowstart & ~((1<<(XCHAL_NUM_AREGS/4)) - 1)) != 0) )
-               err = 1;
        if ((regs->lcount > 0)
-       && ((regs->lbeg > TASK_SIZE) || (regs->lend > TASK_SIZE)) )
+           && ((regs->lbeg > TASK_SIZE) || (regs->lend > TASK_SIZE)) )
                err = 1;
 
-       /* Restore extended register state.
-        * See struct thread_struct in processor.h.
-        */
-       thread = &current->thread;
-
-       err |= __copy_from_user (regs->areg, sc->sc_areg, XCHAL_NUM_AREGS*4);
-       err |= __get_user(buf, &sc->sc_cpstate);
-       if (buf) {
-               if (!access_ok(VERIFY_READ, buf, sizeof(*buf)))
-                       goto badframe;
-               err |= restore_cpextra(buf);
-       }
-
-       regs->syscall = -1;             /* disable syscall checks */
-       return err;
-
-badframe:
-       return 1;
-}
-
-static inline void
-flush_my_cpstate(struct task_struct *tsk)
-{
-       unsigned long flags;
-       local_irq_save(flags);
-
-#if 0  // FIXME
-       for (i = 0; i < XCHAL_CP_NUM; i++) {
-               if (tsk == coproc_owners[i]) {
-                       xthal_validate_cp(i);
-                       xthal_save_cpregs(tsk->thread.cpregs_ptr[i], i);
+       err |= __copy_from_user(regs->areg, sc->sc_a, 16 * 4);
 
-                       /* Invalidate and "disown" the cp to allow
-                        * callers the chance to reset cp state in the
-                        * task_struct. */
+#if XCHAL_HAVE_CP
+# error Coprocessors unsupported
+       /* The signal handler may have used coprocessors in which
+        * case they are still enabled.  We disable them to force a
+        * reloading of the original task's CP state by the lazy
+        * context-switching mechanisms of CP exception handling.
+        * Also, we essentially discard any coprocessor state that the
+        * signal handler created. */
 
-                       xthal_invalidate_cp(i);
-                       coproc_owners[i] = 0;
-               }
+       if (!err) {
+         struct task_struct *tsk = current;
+         release_all_cp(tsk);
+         err |= __copy_from_user(tsk->thread.cpextra, sc->sc_cpstate, 
+                                 XTENSA_CP_EXTRA_SIZE);
        }
 #endif
-       local_irq_restore(flags);
-}
-
-/* Return codes:
-       0:  nothing saved
-       1:  stuff to save, successful
-       -1:  stuff to save, error happened
-*/
-static int
-save_cpextra (struct _cpstate *buf)
-{
-#if XCHAL_CP_NUM == 0
-       return 0;
-#else
-
-       /* FIXME: If a task has never used a coprocessor, there is
-        * no need to save and restore anything.  Tracking this
-        * information would allow us to optimize this section.
-        * Perhaps we can use current->used_math or (current->flags &
-        * PF_USEDFPU) or define a new field in the thread
-        * structure. */
-
-       /* We flush any live, task-owned cp state to the task_struct,
-        * then copy it all to the sigframe.  Then we clear all
-        * cp/extra state in the task_struct, effectively
-        * clearing/resetting all cp/extra state for the signal
-        * handler (cp-exception handling will load these new values
-        * into the cp/extra registers.)  This step is important for
-        * things like a floating-point cp, where the OS must reset
-        * the FCR to the default rounding mode. */
-
-       int err = 0;
-       struct task_struct *tsk = current;
-
-       flush_my_cpstate(tsk);
-       /* Note that we just copy everything: 'extra' and 'cp' state together.*/
-       err |= __copy_to_user(buf, tsk->thread.cp_save, XTENSA_CP_EXTRA_SIZE);
-       memset(tsk->thread.cp_save, 0, XTENSA_CP_EXTRA_SIZE);
-
-#if (XTENSA_CP_EXTRA_SIZE == 0)
-#error Sanity check on memset above, cpextra_size should not be zero.
-#endif
-
-       return err ? -1 : 1;
-#endif
-}
-
-static int
-setup_sigcontext(struct sigcontext *sc, struct _cpstate *cpstate,
-                struct pt_regs *regs, unsigned long mask)
-{
-       struct thread_struct *thread;
-       int err = 0;
-
-//printk("setup_sigcontext\n");
-#define COPY(x)        err |= __put_user(regs->x, &sc->sc_##x)
-       COPY(pc);
-       COPY(ps);
-       COPY(depc);
-       COPY(wmask);
-       COPY(lbeg);
-       COPY(lend);
-       COPY(lcount);
-       COPY(sar);
-       COPY(windowbase);
-       COPY(windowstart);
-#undef COPY
-
-       /* Save extended register state.
-        * See struct thread_struct in processor.h.
-        */
-       thread = &current->thread;
-       err |= __copy_to_user (sc->sc_areg, regs->areg, XCHAL_NUM_AREGS * 4);
-       err |= save_cpextra(cpstate);
-       err |= __put_user(err ? NULL : cpstate, &sc->sc_cpstate);
-       /* non-iBCS2 extensions.. */
-       err |= __put_user(mask, &sc->oldmask);
 
+       regs->syscall = -1;             /* disable syscall checks */
        return err;
 }
 
-asmlinkage int xtensa_sigreturn(struct pt_regs *regs)
-{
-       struct sigframe *frame = (struct sigframe *)regs->areg[1];
-       sigset_t set;
-       if (regs->depc > 64)
-               panic ("Double exception sys_sigreturn\n");
-
-       if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
-               goto badframe;
-
-       if (__get_user(set.sig[0], &frame->sc.oldmask)
-           || (_NSIG_WORDS > 1
-               && __copy_from_user(&set.sig[1], &frame->extramask,
-                                   sizeof(frame->extramask))))
-               goto badframe;
-
-       sigdelsetmask(&set, ~_BLOCKABLE);
-
-       spin_lock_irq(&current->sighand->siglock);
-       current->blocked = set;
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
 
-       if (restore_sigcontext(regs, &frame->sc))
-               goto badframe;
-       return regs->areg[2];
 
-badframe:
-       force_sig(SIGSEGV, current);
-       return 0;
-}
+/*
+ * Do a signal return; undo the signal stack.
+ */
 
-asmlinkage int xtensa_rt_sigreturn(struct pt_regs *regs)
+asmlinkage long xtensa_rt_sigreturn(long a0, long a1, long a2, long a3,
+                                   long a4, long a5, struct pt_regs *regs)
 {
-       struct rt_sigframe *frame = (struct rt_sigframe *)regs->areg[1];
+       struct rt_sigframe __user *frame;
        sigset_t set;
-       stack_t st;
        int ret;
+
        if (regs->depc > 64)
-       {
-               printk("!!!!!!! DEPC !!!!!!!\n");
-               return 0;
-       }
+               panic("rt_sigreturn in double exception!\n");
+
+       frame = (struct rt_sigframe __user *) regs->areg[1];
 
        if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
                goto badframe;
@@ -407,13 +249,11 @@ asmlinkage int xtensa_rt_sigreturn(struct pt_regs *regs)
 
        if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
                goto badframe;
+
        ret = regs->areg[2];
 
-       if (__copy_from_user(&st, &frame->uc.uc_stack, sizeof(st)))
+       if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs->areg[1]) == -EFAULT)
                goto badframe;
-       /* It is more difficult to avoid calling this function than to
-          call it and ignore errors.  */
-       do_sigaltstack(&st, NULL, regs->areg[1]);
 
        return ret;
 
@@ -422,77 +262,50 @@ badframe:
        return 0;
 }
 
-/*
- * Set up a signal frame.
- */
+
 
 /*
- * Determine which stack to use..
+ * Set up a signal frame.
  */
-static inline void *
-get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size)
-{
-       if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! sas_ss_flags(sp))
-               sp = current->sas_ss_sp + current->sas_ss_size;
-
-       return (void *)((sp - frame_size) & -16ul);
-}
-
-#define USE_SIGRETURN          0
-#define USE_RT_SIGRETURN       1
 
 static int
-gen_return_code(unsigned char *codemem, unsigned int use_rt_sigreturn)
+gen_return_code(unsigned char *codemem)
 {
-       unsigned int retcall;
        int err = 0;
 
-#if 0
-       /* Ignoring SA_RESTORER for now; it's supposed to be obsolete,
-        * and the xtensa glibc doesn't use it.
+       /*
+        * The 12-bit immediate is really split up within the 24-bit MOVI
+        * instruction.  As long as the above system call numbers fit within
+        * 8-bits, the following code works fine. See the Xtensa ISA for
+        * details.
         */
-       if (ka->sa.sa_flags & SA_RESTORER) {
-               regs->pr = (unsigned long) ka->sa.sa_restorer;
-       } else
-#endif /* 0 */
-       {
-
-#if (__NR_sigreturn > 255) || (__NR_rt_sigreturn > 255)
-
-/* The 12-bit immediate is really split up within the 24-bit MOVI
- * instruction.  As long as the above system call numbers fit within
- * 8-bits, the following code works fine. See the Xtensa ISA for
- * details.
- */
 
-#error Generating the MOVI instruction below breaks!
+#if __NR_rt_sigreturn > 255
+# error Generating the MOVI instruction below breaks!
 #endif
 
-               retcall = use_rt_sigreturn ? __NR_rt_sigreturn : __NR_sigreturn;
-
 #ifdef __XTENSA_EB__   /* Big Endian version */
-               /* Generate instruction:  MOVI a2, retcall */
-               err |= __put_user(0x22, &codemem[0]);
-               err |= __put_user(0x0a, &codemem[1]);
-               err |= __put_user(retcall, &codemem[2]);
-               /* Generate instruction:  SYSCALL */
-               err |= __put_user(0x00, &codemem[3]);
-               err |= __put_user(0x05, &codemem[4]);
-               err |= __put_user(0x00, &codemem[5]);
+       /* Generate instruction:  MOVI a2, __NR_rt_sigreturn */
+       err |= __put_user(0x22, &codemem[0]);
+       err |= __put_user(0x0a, &codemem[1]);
+       err |= __put_user(__NR_rt_sigreturn, &codemem[2]);
+       /* Generate instruction:  SYSCALL */
+       err |= __put_user(0x00, &codemem[3]);
+       err |= __put_user(0x05, &codemem[4]);
+       err |= __put_user(0x00, &codemem[5]);
 
 #elif defined __XTENSA_EL__   /* Little Endian version */
-               /* Generate instruction:  MOVI a2, retcall */
-               err |= __put_user(0x22, &codemem[0]);
-               err |= __put_user(0xa0, &codemem[1]);
-               err |= __put_user(retcall, &codemem[2]);
-               /* Generate instruction:  SYSCALL */
-               err |= __put_user(0x00, &codemem[3]);
-               err |= __put_user(0x50, &codemem[4]);
-               err |= __put_user(0x00, &codemem[5]);
+       /* Generate instruction:  MOVI a2, __NR_rt_sigreturn */
+       err |= __put_user(0x22, &codemem[0]);
+       err |= __put_user(0xa0, &codemem[1]);
+       err |= __put_user(__NR_rt_sigreturn, &codemem[2]);
+       /* Generate instruction:  SYSCALL */
+       err |= __put_user(0x00, &codemem[3]);
+       err |= __put_user(0x50, &codemem[4]);
+       err |= __put_user(0x00, &codemem[5]);
 #else
-#error Must use compiler for Xtensa processors.
+# error Must use compiler for Xtensa processors.
 #endif
-       }
 
        /* Flush generated code out of the data cache */
 
@@ -504,97 +317,29 @@ gen_return_code(unsigned char *codemem, unsigned int use_rt_sigreturn)
        return err;
 }
 
-static void
-set_thread_state(struct pt_regs *regs, void *stack, unsigned char *retaddr,
-       void *handler, unsigned long arg1, void *arg2, void *arg3)
-{
-       /* Set up registers for signal handler */
-       start_thread(regs, (unsigned long) handler, (unsigned long) stack);
-
-       /* Set up a stack frame for a call4
-        * Note: PS.CALLINC is set to one by start_thread
-        */
-       regs->areg[4] = (((unsigned long) retaddr) & 0x3fffffff) | 0x40000000;
-       regs->areg[6] = arg1;
-       regs->areg[7] = (unsigned long) arg2;
-       regs->areg[8] = (unsigned long) arg3;
-}
 
-static void setup_frame(int sig, struct k_sigaction *ka,
+static void setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
                        sigset_t *set, struct pt_regs *regs)
 {
-       struct sigframe *frame;
+       struct rt_sigframe *frame;
        int err = 0;
        int signal;
+       unsigned long sp, ra;
 
-       frame = get_sigframe(ka, regs->areg[1], sizeof(*frame));
-       if (regs->depc > 64)
-       {
-               printk("!!!!!!! DEPC !!!!!!!\n");
-               return;
-       }
-
-
-       if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
-               goto give_sigsegv;
-
-       signal = current_thread_info()->exec_domain
-               && current_thread_info()->exec_domain->signal_invmap
-               && sig < 32
-               ? current_thread_info()->exec_domain->signal_invmap[sig]
-               : sig;
-
-       err |= setup_sigcontext(&frame->sc, &frame->cpstate, regs, set->sig[0]);
+       sp = regs->areg[1];
 
-       if (_NSIG_WORDS > 1) {
-               err |= __copy_to_user(frame->extramask, &set->sig[1],
-                                     sizeof(frame->extramask));
+       if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! on_sig_stack(sp)) {
+               sp = current->sas_ss_sp + current->sas_ss_size;
        }
 
-       /* Create sys_sigreturn syscall in stack frame */
-       err |= gen_return_code(frame->retcode, USE_SIGRETURN);
-
-       if (err)
-               goto give_sigsegv;
-
-       /* Create signal handler execution context.
-        * Return context not modified until this point.
-        */
-       set_thread_state(regs, frame, frame->retcode,
-               ka->sa.sa_handler, signal, &frame->sc, NULL);
-
-       /* Set access mode to USER_DS.  Nomenclature is outdated, but
-        * functionality is used in uaccess.h
-        */
-       set_fs(USER_DS);
-
-
-#if DEBUG_SIG
-       printk("SIG deliver (%s:%d): signal=%d sp=%p pc=%08x\n",
-               current->comm, current->pid, signal, frame, regs->pc);
-#endif
-
-       return;
-
-give_sigsegv:
-       if (sig == SIGSEGV)
-               ka->sa.sa_handler = SIG_DFL;
-       force_sig(SIGSEGV, current);
-}
-
-static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
-                          sigset_t *set, struct pt_regs *regs)
-{
-       struct rt_sigframe *frame;
-       int err = 0;
-       int signal;
+       frame = (void *)((sp - sizeof(*frame)) & -16ul);
 
-       frame = get_sigframe(ka, regs->areg[1], sizeof(*frame));
        if (regs->depc > 64)
                panic ("Double exception sys_sigreturn\n");
 
-       if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
+       if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) {
                goto give_sigsegv;
+       }
 
        signal = current_thread_info()->exec_domain
                && current_thread_info()->exec_domain->signal_invmap
@@ -602,9 +347,12 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
                ? current_thread_info()->exec_domain->signal_invmap[sig]
                : sig;
 
-       err |= copy_siginfo_to_user(&frame->info, info);
+       if (ka->sa.sa_flags & SA_SIGINFO) {
+               err |= copy_siginfo_to_user(&frame->info, info);
+       }
+
+       /* Create the user context.  */
 
-       /* Create the ucontext.  */
        err |= __put_user(0, &frame->uc.uc_flags);
        err |= __put_user(0, &frame->uc.uc_link);
        err |= __put_user((void *)current->sas_ss_sp,
@@ -617,16 +365,31 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
        err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
 
        /* Create sys_rt_sigreturn syscall in stack frame */
-       err |= gen_return_code(frame->retcode, USE_RT_SIGRETURN);
 
-       if (err)
+       err |= gen_return_code(frame->retcode);
+
+       if (err) {
                goto give_sigsegv;
+       }
+               
 
-       /* Create signal handler execution context.
+       /* 
+        * Create signal handler execution context.
         * Return context not modified until this point.
         */
-       set_thread_state(regs, frame, frame->retcode,
-               ka->sa.sa_handler, signal, &frame->info, &frame->uc);
+
+       /* Set up registers for signal handler */
+       start_thread(regs, (unsigned long) ka->sa.sa_handler, 
+                    (unsigned long) frame);
+
+       /* Set up a stack frame for a call4
+        * Note: PS.CALLINC is set to one by start_thread
+        */
+       ra = (unsigned long) frame->retcode;
+       regs->areg[4] = (((unsigned long) ra) & 0x3fffffff) | 0x40000000;
+       regs->areg[6] = (unsigned long) signal;
+       regs->areg[7] = (unsigned long) &frame->info;
+       regs->areg[8] = (unsigned long) &frame->uc;
 
        /* Set access mode to USER_DS.  Nomenclature is outdated, but
         * functionality is used in uaccess.h
@@ -646,6 +409,48 @@ give_sigsegv:
        force_sig(SIGSEGV, current);
 }
 
+/*
+ * Atomically swap in the new signal mask, and wait for a signal.
+ */
+
+asmlinkage long xtensa_rt_sigsuspend(sigset_t __user *unewset, 
+                                    size_t sigsetsize,
+                                    long a2, long a3, long a4, long a5, 
+                                    struct pt_regs *regs)
+{
+       sigset_t saveset, newset;
+
+       /* XXX: Don't preclude handling different sized sigset_t's.  */
+       if (sigsetsize != sizeof(sigset_t))
+               return -EINVAL;
+
+       if (copy_from_user(&newset, unewset, sizeof(newset)))
+               return -EFAULT;
+
+       sigdelsetmask(&newset, ~_BLOCKABLE);
+       spin_lock_irq(&current->sighand->siglock);
+       saveset = current->blocked;
+       current->blocked = newset;
+       recalc_sigpending();
+       spin_unlock_irq(&current->sighand->siglock);
+
+       regs->areg[2] = -EINTR;
+       while (1) {
+               current->state = TASK_INTERRUPTIBLE;
+               schedule();
+               if (do_signal(regs, &saveset))
+                       return -EINTR;
+       }
+}
+
+asmlinkage long xtensa_sigaltstack(const stack_t __user *uss, 
+                                  stack_t __user *uoss,
+                                  long a2, long a3, long a4, long a5,
+                                  struct pt_regs *regs)
+{
+       return do_sigaltstack(uss, uoss, regs->areg[1]);
+}
+
 
 
 /*
@@ -663,51 +468,89 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset)
        int signr;
        struct k_sigaction ka;
 
+       if (!user_mode(regs))
+               return 0;
+
+       if (try_to_freeze())
+               goto no_signal;
+
        if (!oldset)
                oldset = &current->blocked;
 
+       task_pt_regs(current)->icountlevel = 0;
+
        signr = get_signal_to_deliver(&info, &ka, regs, NULL);
 
-       /* Are we from a system call? */
-       if (regs->syscall >= 0) {
-               /* If so, check system call restarting.. */
-               switch (regs->areg[2]) {
-                       case ERESTARTNOHAND:
-                       case ERESTART_RESTARTBLOCK:
-                               regs->areg[2] = -EINTR;
-                               break;
+       if (signr > 0) {
+
+               /* Are we from a system call? */
+
+               if ((signed)regs->syscall >= 0) {
 
-                       case ERESTARTSYS:
-                               if (!(ka.sa.sa_flags & SA_RESTART)) {
+                       /* If so, check system call restarting.. */
+
+                       switch (regs->areg[2]) {
+                               case -ERESTARTNOHAND:
+                               case -ERESTART_RESTARTBLOCK:
                                        regs->areg[2] = -EINTR;
                                        break;
-                               }
-                       /* fallthrough */
-                       case ERESTARTNOINTR:
-                               regs->areg[2] = regs->syscall;
-                               regs->pc -= 3;
+
+                               case -ERESTARTSYS:
+                                       if (!(ka.sa.sa_flags & SA_RESTART)) {
+                                               regs->areg[2] = -EINTR;
+                                               break;
+                                       }
+                                       /* fallthrough */
+                               case -ERESTARTNOINTR:
+                                       regs->areg[2] = regs->syscall;
+                                       regs->pc -= 3;
+                                       break;
+
+                               default:
+                                       /* nothing to do */
+                                       if (regs->areg[2] != 0)
+                                       break;
+                       }
                }
-       }
 
-       if (signr == 0)
-               return 0;               /* no signals delivered */
+               /* Whee!  Actually deliver the signal.  */
+               /* Set up the stack frame */
+               setup_frame(signr, &ka, &info, oldset, regs);
 
-       /* Whee!  Actually deliver the signal.  */
+               if (ka.sa.sa_flags & SA_ONESHOT)
+                       ka.sa.sa_handler = SIG_DFL;
 
-       /* Set up the stack frame */
-       if (ka.sa.sa_flags & SA_SIGINFO)
-               setup_rt_frame(signr, &ka, &info, oldset, regs);
-       else
-               setup_frame(signr, &ka, oldset, regs);
+               spin_lock_irq(&current->sighand->siglock);
+               sigorsets(&current->blocked, &current->blocked, &ka.sa.sa_mask);
+               if (!(ka.sa.sa_flags & SA_NODEFER))
+                       sigaddset(&current->blocked, signr);
+               recalc_sigpending();
+               spin_unlock_irq(&current->sighand->siglock);
+               if (current->ptrace & PT_SINGLESTEP)
+                       task_pt_regs(current)->icountlevel = 1;
 
-       if (ka.sa.sa_flags & SA_ONESHOT)
-               ka.sa.sa_handler = SIG_DFL;
+               return 1;
+       }
 
-       spin_lock_irq(&current->sighand->siglock);
-       sigorsets(&current->blocked, &current->blocked, &ka.sa.sa_mask);
-       if (!(ka.sa.sa_flags & SA_NODEFER))
-               sigaddset(&current->blocked, signr);
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
-       return 1;
+no_signal:
+       /* Did we come from a system call? */
+       if ((signed) regs->syscall >= 0) {
+               /* Restart the system call - no handlers present */
+               switch (regs->areg[2]) {
+               case -ERESTARTNOHAND:
+               case -ERESTARTSYS:
+               case -ERESTARTNOINTR:
+                       regs->areg[2] = regs->syscall;
+                       regs->pc -= 3;
+                       break;
+               case -ERESTART_RESTARTBLOCK:
+                       regs->areg[2] = __NR_restart_syscall;
+                       regs->pc -= 3;
+                       break;
+               }
+       }
+       if (current->ptrace & PT_SINGLESTEP)
+               task_pt_regs(current)->icountlevel = 1;
+       return 0;
 }
+
index 4b7b4ff7997349abfb994becb0fade83492ad28b..b0582c3c5f8da9dad2f43eb5b9d81ca9a14cbfb0 100644 (file)
@@ -84,9 +84,7 @@ SECTIONS
   {
     /* The .head.text section must be the first section! */
     *(.head.text)
-    *(.literal)
-    TEXT_TEXT
-    *(.srom.text)
+    *(.literal .text)
     VMLINUX_SYMBOL(__sched_text_start) = .;
     *(.sched.literal .sched.text)
     VMLINUX_SYMBOL(__sched_text_end) = .;
@@ -96,6 +94,7 @@ SECTIONS
 
   }
   _etext = .;
+  PROVIDE (etext = .);
 
   . = ALIGN(16);
 
@@ -103,32 +102,6 @@ SECTIONS
 
   /*  Relocation table */
 
-  . = ALIGN(16);
-  __boot_reloc_table_start = ABSOLUTE(.);
-
-  __relocate : {
-
-    RELOCATE_ENTRY(_WindowVectors_text,
-                  .WindowVectors.text);
-#if 0
-    RELOCATE_ENTRY(_KernelExceptionVector_literal,
-                  .KernelExceptionVector.literal);
-#endif
-    RELOCATE_ENTRY(_KernelExceptionVector_text,
-                  .KernelExceptionVector.text);
-#if 0
-    RELOCATE_ENTRY(_UserExceptionVector_literal,
-                  .UserExceptionVector.literal);
-#endif
-    RELOCATE_ENTRY(_UserExceptionVector_text,
-                  .UserExceptionVector.text);
-    RELOCATE_ENTRY(_DoubleExceptionVector_literal,
-                  .DoubleExceptionVector.literal);
-    RELOCATE_ENTRY(_DoubleExceptionVector_text,
-                  .DoubleExceptionVector.text);
-  }
-  __boot_reloc_table_end = ABSOLUTE(.) ;
-
   .fixup   : { *(.fixup) }
 
   . = ALIGN(16);
@@ -145,8 +118,7 @@ SECTIONS
   _fdata = .;
   .data :
   {
-    DATA_DATA
-    CONSTRUCTORS
+    *(.data) CONSTRUCTORS
     . = ALIGN(XCHAL_ICACHE_LINESIZE);
     *(.data.cacheline_aligned)
   }
@@ -174,6 +146,22 @@ SECTIONS
     __tagtable_begin = .;
     *(.taglist)
     __tagtable_end = .;
+
+    . = ALIGN(16);
+    __boot_reloc_table_start = ABSOLUTE(.);
+
+    RELOCATE_ENTRY(_WindowVectors_text,
+                  .WindowVectors.text);
+    RELOCATE_ENTRY(_KernelExceptionVector_text,
+                  .KernelExceptionVector.text);
+    RELOCATE_ENTRY(_UserExceptionVector_text,
+                  .UserExceptionVector.text);
+    RELOCATE_ENTRY(_DoubleExceptionVector_literal,
+                  .DoubleExceptionVector.literal);
+    RELOCATE_ENTRY(_DoubleExceptionVector_text,
+                  .DoubleExceptionVector.text);
+  
+    __boot_reloc_table_end = ABSOLUTE(.) ;
   }
 
   . = ALIGN(XCHAL_ICACHE_LINESIZE);
@@ -194,16 +182,6 @@ SECTIONS
 
   SECURITY_INIT
 
-  . = ALIGN(4);
-
-  __start___ftr_fixup = .;
-  __ftr_fixup : { *(__ftr_fixup) }
-  __stop___ftr_fixup = .;
-
-  . = ALIGN(4096);
-  __per_cpu_start = .;
-  .data.percpu  : { *(.data.percpu) }
-  __per_cpu_end = .;
 
 #ifdef CONFIG_BLK_DEV_INITRD
   . = ALIGN(4096);
@@ -212,6 +190,12 @@ SECTIONS
   __initramfs_end = .;
 #endif
 
+  . = ALIGN(4096);
+  __per_cpu_start = .;
+  .data.percpu  : { *(.data.percpu) }
+  __per_cpu_end = .;
+
+
   /* We need this dummy segment here */
 
   . = ALIGN(4);
@@ -273,9 +257,9 @@ SECTIONS
 
   /* BSS section */
   _bss_start = .;
-  .sbss : { *(.sbss) *(.scommon) }
-  .bss : { *(COMMON) *(.bss) }
+  .bss : { *(.bss.page_aligned) *(.bss) }
   _bss_end = .;
+
   _end = .;
 
   /* only used by the boot loader  */
@@ -293,16 +277,16 @@ SECTIONS
     *(.ResetVector.text)
   }
 
-
   /* Sections to be discarded */
   /DISCARD/ :
   {
-        *(.text.exit)
-       *(.text.exit.literal)
-        *(.data.exit)
+       *(.exit.literal .exit.text)
+       *(.exit.data)
         *(.exitcall.exit)
   }
 
+  .xt.lit : { *(.xt.lit) }
+  .xt.prop : { *(.xt.prop) }
 
   .debug  0 :  { *(.debug) }
   .line  0 :  { *(.line) }
index cd7e6a0206024a835daf7aff2c545ef06f808be6..60dbdb43fb4c92d27e12f15cba95d8195601721f 100644 (file)
 /*
  * String functions
  */
-EXPORT_SYMBOL(memcmp);
 EXPORT_SYMBOL(memset);
 EXPORT_SYMBOL(memcpy);
 EXPORT_SYMBOL(memmove);
-EXPORT_SYMBOL(memchr);
-EXPORT_SYMBOL(strcat);
-EXPORT_SYMBOL(strchr);
-EXPORT_SYMBOL(strlen);
-EXPORT_SYMBOL(strncat);
-EXPORT_SYMBOL(strnlen);
-EXPORT_SYMBOL(strrchr);
-EXPORT_SYMBOL(strstr);
 
-EXPORT_SYMBOL(enable_irq);
-EXPORT_SYMBOL(disable_irq);
 EXPORT_SYMBOL(kernel_thread);
 
 /*
index a834057bda6b45040a6182705e9610fb1448377e..b2655d94558d8db837e248d09856c3246cfa78e5 100644 (file)
 /*
  * char *__strncpy_user(char *dst, const char *src, size_t len)
  */
-.text
-.begin literal
-.align 4
-.Lmask0:
-       .byte   0xff, 0x00, 0x00, 0x00
-.Lmask1:
-       .byte   0x00, 0xff, 0x00, 0x00
-.Lmask2:
-       .byte   0x00, 0x00, 0xff, 0x00
-.Lmask3:
-       .byte   0x00, 0x00, 0x00, 0xff
-.end literal
+
+#ifdef __XTENSA_EB__
+# define MASK0 0xff000000
+# define MASK1 0x00ff0000
+# define MASK2 0x0000ff00
+# define MASK3 0x000000ff
+#else
+# define MASK0 0x000000ff
+# define MASK1 0x0000ff00
+# define MASK2 0x00ff0000
+# define MASK3 0xff000000
+#endif
 
 # Register use
 #   a0/ return address
@@ -53,6 +53,7 @@
 #   a11/ dst
 #   a12/ tmp
 
+.text
 .align 4
 .global        __strncpy_user
 .type  __strncpy_user,@function
@@ -61,10 +62,10 @@ __strncpy_user:
        # a2/ dst, a3/ src, a4/ len
        mov     a11, a2         # leave dst in return value register
        beqz    a4, .Lret       # if len is zero
-       l32r    a5, .Lmask0     # mask for byte 0
-       l32r    a6, .Lmask1     # mask for byte 1
-       l32r    a7, .Lmask2     # mask for byte 2
-       l32r    a8, .Lmask3     # mask for byte 3
+       movi    a5, MASK0       # mask for byte 0
+       movi    a6, MASK1       # mask for byte 1
+       movi    a7, MASK2       # mask for byte 2
+       movi    a8, MASK3       # mask for byte 3
        bbsi.l  a3, 0, .Lsrc1mod2 # if only  8-bit aligned
        bbsi.l  a3, 1, .Lsrc2mod4 # if only 16-bit aligned
 .Lsrcaligned:  # return here when src is word-aligned
index 5e9c1e709b2eaf33d32d883a4681453398027313..ad3f616322caaa31bd54c9a56f87b892d5e0726d 100644 (file)
 /*
  * size_t __strnlen_user(const char *s, size_t len)
  */
-.text
-.begin literal
-.align 4
-.Lmask0:
-       .byte   0xff, 0x00, 0x00, 0x00
-.Lmask1:
-       .byte   0x00, 0xff, 0x00, 0x00
-.Lmask2:
-       .byte   0x00, 0x00, 0xff, 0x00
-.Lmask3:
-       .byte   0x00, 0x00, 0x00, 0xff
-.end literal
+
+#ifdef __XTENSA_EB__
+# define MASK0 0xff000000
+# define MASK1 0x00ff0000
+# define MASK2 0x0000ff00
+# define MASK3 0x000000ff
+#else
+# define MASK0 0x000000ff
+# define MASK1 0x0000ff00
+# define MASK2 0x00ff0000
+# define MASK3 0xff000000
+#endif
 
 # Register use:
 #   a2/ src
@@ -48,6 +48,7 @@
 #   a9/ tmp
 #   a10/ tmp
 
+.text
 .align 4
 .global        __strnlen_user
 .type  __strnlen_user,@function
@@ -56,10 +57,10 @@ __strnlen_user:
        # a2/ s, a3/ len
        addi    a4, a2, -4      # because we overincrement at the end;
                                # we compensate with load offsets of 4
-       l32r    a5, .Lmask0     # mask for byte 0
-       l32r    a6, .Lmask1     # mask for byte 1
-       l32r    a7, .Lmask2     # mask for byte 2
-       l32r    a8, .Lmask3     # mask for byte 3
+       movi    a5, MASK0       # mask for byte 0
+       movi    a6, MASK1       # mask for byte 1
+       movi    a7, MASK2       # mask for byte 2
+       movi    a8, MASK3       # mask for byte 3
        bbsi.l  a2, 0, .L1mod2  # if only  8-bit aligned
        bbsi.l  a2, 1, .L2mod4  # if only 16-bit aligned
 
index e1ec2d1e8189e64c998ba8dba7d9b3a9d30d5cc1..8415c76f11c2a75ea69f080ec334a46a22ba715e 100644 (file)
@@ -205,7 +205,7 @@ void __init init_mmu (void)
        /* Writing zeros to the <t>TLBCFG special registers ensure
         * that valid values exist in the register.  For existing
         * PGSZID<w> fields, zero selects the first element of the
-        * page-size array.  For nonexistant PGSZID<w> fields, zero is
+        * page-size array.  For nonexistent PGSZID<w> fields, zero is
         * the best value to write.  Also, when changing PGSZID<w>
         * fields, the corresponding TLB must be flushed.
         */
index 4bfe333be22943558a8448679b71f4bcd2b273e8..f09962fa98c09a5594358d22c23b0b7d993209f0 100644 (file)
@@ -473,7 +473,7 @@ static int iss_net_open(struct net_device *dev)
        netif_start_queue(dev);
 
        /* clear buffer - it can happen that the host side of the interface
-        * is full when we gethere. In this case, new data is never queued,
+        * is full when we get here. In this case, new data is never queued,
         * SIGIOs never arrive, and the net never works.
         */
        while ((err = iss_net_rx(dev)) > 0)
index 6b5173ac81313d8adb5c1d7b521559f565bb209b..c99b463548592239044f6e71aea571abd99a7307 100644 (file)
@@ -340,6 +340,15 @@ unsigned blk_ordered_req_seq(struct request *rq)
        if (rq == &q->post_flush_rq)
                return QUEUE_ORDSEQ_POSTFLUSH;
 
+       /*
+        * !fs requests don't need to follow barrier ordering.  Always
+        * put them at the front.  This fixes the following deadlock.
+        *
+        * http://thread.gmane.org/gmane.linux.kernel/537473
+        */
+       if (!blk_fs_request(rq))
+               return QUEUE_ORDSEQ_DRAIN;
+
        if ((rq->cmd_flags & REQ_ORDERED_COLOR) ==
            (q->orig_bar_rq->cmd_flags & REQ_ORDERED_COLOR))
                return QUEUE_ORDSEQ_DRAIN;
index 1cfbecb0ac10463fa5dfe0afb8741cfc384d2cae..13369b45563f759928f263187654cdee637c76ad 100644 (file)
@@ -524,7 +524,7 @@ static acpi_status __init add_device(void)
        return AE_OK;
 }
 
-static acpi_status __exit remove_device(void)
+static acpi_status remove_device(void)
 {
        ProcItem *item;
 
index 7d893a60f99420ffc9d8fe7a2b6b999dc99889b2..b4a8d6030e480859b8c594ad68cd2e40686ae4c7 100644 (file)
@@ -8,7 +8,6 @@ menuconfig ATA
        depends on BLOCK
        depends on !(M32R || M68K) || BROKEN
        depends on !SUN4 || BROKEN
-       depends on !(SPARC64 && !PCI)
        select SCSI
        ---help---
          If you want to use a ATA hard disk, ATA tape drive, ATA CD-ROM or
index 7baeaffefe7aeb1b1f501c28d190ae068a98dd68..545f330e59a54bd5c6aebfca56a798d8cdd8a431 100644 (file)
@@ -426,6 +426,30 @@ static const struct pci_device_id ahci_pci_tbl[] = {
        { PCI_VDEVICE(NVIDIA, 0x0559), board_ahci },            /* MCP67 */
        { PCI_VDEVICE(NVIDIA, 0x055a), board_ahci },            /* MCP67 */
        { PCI_VDEVICE(NVIDIA, 0x055b), board_ahci },            /* MCP67 */
+       { PCI_VDEVICE(NVIDIA, 0x07f0), board_ahci },            /* MCP73 */
+       { PCI_VDEVICE(NVIDIA, 0x07f1), board_ahci },            /* MCP73 */
+       { PCI_VDEVICE(NVIDIA, 0x07f2), board_ahci },            /* MCP73 */
+       { PCI_VDEVICE(NVIDIA, 0x07f3), board_ahci },            /* MCP73 */
+       { PCI_VDEVICE(NVIDIA, 0x07f4), board_ahci },            /* MCP73 */
+       { PCI_VDEVICE(NVIDIA, 0x07f5), board_ahci },            /* MCP73 */
+       { PCI_VDEVICE(NVIDIA, 0x07f6), board_ahci },            /* MCP73 */
+       { PCI_VDEVICE(NVIDIA, 0x07f7), board_ahci },            /* MCP73 */
+       { PCI_VDEVICE(NVIDIA, 0x07f8), board_ahci },            /* MCP73 */
+       { PCI_VDEVICE(NVIDIA, 0x07f9), board_ahci },            /* MCP73 */
+       { PCI_VDEVICE(NVIDIA, 0x07fa), board_ahci },            /* MCP73 */
+       { PCI_VDEVICE(NVIDIA, 0x07fb), board_ahci },            /* MCP73 */
+       { PCI_VDEVICE(NVIDIA, 0x0ad0), board_ahci },            /* MCP77 */
+       { PCI_VDEVICE(NVIDIA, 0x0ad1), board_ahci },            /* MCP77 */
+       { PCI_VDEVICE(NVIDIA, 0x0ad2), board_ahci },            /* MCP77 */
+       { PCI_VDEVICE(NVIDIA, 0x0ad3), board_ahci },            /* MCP77 */
+       { PCI_VDEVICE(NVIDIA, 0x0ad4), board_ahci },            /* MCP77 */
+       { PCI_VDEVICE(NVIDIA, 0x0ad5), board_ahci },            /* MCP77 */
+       { PCI_VDEVICE(NVIDIA, 0x0ad6), board_ahci },            /* MCP77 */
+       { PCI_VDEVICE(NVIDIA, 0x0ad7), board_ahci },            /* MCP77 */
+       { PCI_VDEVICE(NVIDIA, 0x0ad8), board_ahci },            /* MCP77 */
+       { PCI_VDEVICE(NVIDIA, 0x0ad9), board_ahci },            /* MCP77 */
+       { PCI_VDEVICE(NVIDIA, 0x0ada), board_ahci },            /* MCP77 */
+       { PCI_VDEVICE(NVIDIA, 0x0adb), board_ahci },            /* MCP77 */
 
        /* SiS */
        { PCI_VDEVICE(SI, 0x1184), board_ahci }, /* SiS 966 */
index 4733f009c7c9cbf476798f151065d236619fb7bc..047eabd75363a110d56e88edd54d899624ab0c6b 100644 (file)
@@ -1727,7 +1727,7 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,
 
        /* sanity check */
        rc = -EINVAL;
-       reason = "device reports illegal type";
+       reason = "device reports invalid type";
 
        if (class == ATA_DEV_ATA) {
                if (!ata_id_is_ata(id) && !ata_id_is_cfa(id))
@@ -1900,6 +1900,13 @@ int ata_dev_configure(struct ata_device *dev)
        if (ata_msg_probe(ap))
                ata_dump_id(id);
 
+       /* SCSI only uses 4-char revisions, dump full 8 chars from ATA */
+       ata_id_c_string(dev->id, fwrevbuf, ATA_ID_FW_REV,
+                       sizeof(fwrevbuf));
+
+       ata_id_c_string(dev->id, modelbuf, ATA_ID_PROD,
+                       sizeof(modelbuf));
+
        /* ATA-specific feature tests */
        if (dev->class == ATA_DEV_ATA) {
                if (ata_id_is_cfa(id)) {
@@ -1914,13 +1921,6 @@ int ata_dev_configure(struct ata_device *dev)
 
                dev->n_sectors = ata_id_n_sectors(id);
 
-               /* SCSI only uses 4-char revisions, dump full 8 chars from ATA */
-               ata_id_c_string(dev->id, fwrevbuf, ATA_ID_FW_REV,
-                               sizeof(fwrevbuf));
-
-               ata_id_c_string(dev->id, modelbuf, ATA_ID_PROD,
-                               sizeof(modelbuf));
-
                if (dev->id[59] & 0x100)
                        dev->multi_count = dev->id[59] & 0xff;
 
@@ -2009,7 +2009,9 @@ int ata_dev_configure(struct ata_device *dev)
 
                /* print device info to dmesg */
                if (ata_msg_drv(ap) && print_info)
-                       ata_dev_printk(dev, KERN_INFO, "ATAPI, max %s%s\n",
+                       ata_dev_printk(dev, KERN_INFO,
+                                      "ATAPI: %s, %s, max %s%s\n",
+                                      modelbuf, fwrevbuf,
                                       ata_mode_string(xfer_mask),
                                       cdb_intr_string);
        }
@@ -3059,22 +3061,28 @@ static int ata_bus_post_reset(struct ata_port *ap, unsigned int devmask,
                }
        }
 
-       /* if device 1 was found in ata_devchk, wait for
-        * register access, then wait for BSY to clear
+       /* if device 1 was found in ata_devchk, wait for register
+        * access briefly, then wait for BSY to clear.
         */
-       while (dev1) {
-               u8 nsect, lbal;
+       if (dev1) {
+               int i;
 
                ap->ops->dev_select(ap, 1);
-               nsect = ioread8(ioaddr->nsect_addr);
-               lbal = ioread8(ioaddr->lbal_addr);
-               if ((nsect == 1) && (lbal == 1))
-                       break;
-               if (time_after(jiffies, deadline))
-                       return -EBUSY;
-               msleep(50);     /* give drive a breather */
-       }
-       if (dev1) {
+
+               /* Wait for register access.  Some ATAPI devices fail
+                * to set nsect/lbal after reset, so don't waste too
+                * much time on it.  We're gonna wait for !BSY anyway.
+                */
+               for (i = 0; i < 2; i++) {
+                       u8 nsect, lbal;
+
+                       nsect = ioread8(ioaddr->nsect_addr);
+                       lbal = ioread8(ioaddr->lbal_addr);
+                       if ((nsect == 1) && (lbal == 1))
+                               break;
+                       msleep(50);     /* give drive a breather */
+               }
+
                rc = ata_wait_ready(ap, deadline);
                if (rc) {
                        if (rc != -ENODEV)
@@ -3769,6 +3777,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
        { "_NEC DV5800A",       NULL,           ATA_HORKAGE_NODMA },
        { "SAMSUNG CD-ROM SN-124","N001",       ATA_HORKAGE_NODMA },
        { "Seagate STT20000A", NULL,            ATA_HORKAGE_NODMA },
+       { "IOMEGA  ZIP 250       ATAPI", NULL,  ATA_HORKAGE_NODMA }, /* temporary fix */
 
        /* Weird ATAPI devices */
        { "TORiSAN DVD-ROM DRD-N216", NULL,     ATA_HORKAGE_MAX_SEC_128 |
@@ -3791,6 +3800,8 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
        { "HTS541060G9SA00",    "MB3OC60D",     ATA_HORKAGE_NONCQ, },
        { "HTS541080G9SA00",    "MB4OC60D",     ATA_HORKAGE_NONCQ, },
        { "HTS541010G9SA00",    "MBZOC60D",     ATA_HORKAGE_NONCQ, },
+       /* Drives which do spurious command completion */
+       { "HTS541680J9SA00",    "SB2IC7EP",     ATA_HORKAGE_NONCQ, },
 
        /* Devices with NCQ limits */
 
@@ -6313,7 +6324,8 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
                /* init sata_spd_limit to the current value */
                if (sata_scr_read(ap, SCR_CONTROL, &scontrol) == 0) {
                        int spd = (scontrol >> 4) & 0xf;
-                       ap->hw_sata_spd_limit &= (1 << spd) - 1;
+                       if (spd)
+                               ap->hw_sata_spd_limit &= (1 << spd) - 1;
                }
                ap->sata_spd_limit = ap->hw_sata_spd_limit;
 
@@ -6433,6 +6445,9 @@ int ata_host_activate(struct ata_host *host, int irq,
        if (rc)
                devm_free_irq(host->dev, irq, host);
 
+       /* Used to print device info at probe */
+       host->irq = irq;
+
        return rc;
 }
 
@@ -6818,6 +6833,7 @@ EXPORT_SYMBOL_GPL(ata_check_status);
 EXPORT_SYMBOL_GPL(ata_altstatus);
 EXPORT_SYMBOL_GPL(ata_exec_command);
 EXPORT_SYMBOL_GPL(ata_port_start);
+EXPORT_SYMBOL_GPL(ata_sff_port_start);
 EXPORT_SYMBOL_GPL(ata_interrupt);
 EXPORT_SYMBOL_GPL(ata_do_set_mode);
 EXPORT_SYMBOL_GPL(ata_data_xfer);
index b3900cfbd880f05039014d08ca28b53c4949bb9e..c228df298bd898ae6e1379d31dc6d6c9dc41eb1a 100644 (file)
@@ -1363,12 +1363,22 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc)
         * schedule EH_REVALIDATE operation to update the IDENTIFY DEVICE
         * cache
         */
-       if (ap->ops->error_handler &&
-           !need_sense && (qc->tf.command == ATA_CMD_SET_FEATURES) &&
-           ((qc->tf.feature == SETFEATURES_WC_ON) ||
-            (qc->tf.feature == SETFEATURES_WC_OFF))) {
-               ap->eh_info.action |= ATA_EH_REVALIDATE;
-               ata_port_schedule_eh(ap);
+       if (ap->ops->error_handler && !need_sense) {
+               switch (qc->tf.command) {
+               case ATA_CMD_SET_FEATURES:
+                       if ((qc->tf.feature == SETFEATURES_WC_ON) ||
+                           (qc->tf.feature == SETFEATURES_WC_OFF)) {
+                               ap->eh_info.action |= ATA_EH_REVALIDATE;
+                               ata_port_schedule_eh(ap);
+                       }
+                       break;
+
+               case ATA_CMD_INIT_DEV_PARAMS: /* CHS translation changed */
+               case ATA_CMD_SET_MULTI: /* multi_count changed */
+                       ap->eh_info.action |= ATA_EH_REVALIDATE;
+                       ata_port_schedule_eh(ap);
+                       break;
+               }
        }
 
        /* For ATA pass thru (SAT) commands, generate a sense block if
@@ -2506,22 +2516,21 @@ ata_scsi_map_proto(u8 byte1)
                        return ATA_PROT_NODATA;
 
                case 6:         /* DMA */
+               case 10:        /* UDMA Data-in */
+               case 11:        /* UDMA Data-Out */
                        return ATA_PROT_DMA;
 
                case 4:         /* PIO Data-in */
                case 5:         /* PIO Data-out */
                        return ATA_PROT_PIO;
 
-               case 10:        /* Device Reset */
                case 0:         /* Hard Reset */
                case 1:         /* SRST */
-               case 2:         /* Bus Idle */
-               case 7:         /* Packet */
-               case 8:         /* DMA Queued */
-               case 9:         /* Device Diagnostic */
-               case 11:        /* UDMA Data-in */
-               case 12:        /* UDMA Data-Out */
-               case 13:        /* FPDMA */
+               case 8:         /* Device Diagnostic */
+               case 9:         /* Device Reset */
+               case 7:         /* DMA Queued */
+               case 12:        /* FPDMA */
+               case 15:        /* Return Response Info */
                default:        /* Reserved */
                        break;
        }
@@ -2552,10 +2561,6 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc)
        if (tf->protocol == ATA_PROT_DMA && dev->dma_mode == 0)
                goto invalid_fld;
 
-       if (cdb[1] & 0xe0)
-               /* PIO multi not supported yet */
-               goto invalid_fld;
-
        /*
         * 12 and 16 byte CDBs use different offsets to
         * provide the various register values.
@@ -2600,12 +2605,26 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc)
                tf->device = cdb[8];
                tf->command = cdb[9];
        }
-       /*
-        * If slave is possible, enforce correct master/slave bit
-       */
-       if (qc->ap->flags & ATA_FLAG_SLAVE_POSS)
-               tf->device = qc->dev->devno ?
-                       tf->device | ATA_DEV1 : tf->device & ~ATA_DEV1;
+
+       /* enforce correct master/slave bit */
+       tf->device = dev->devno ?
+               tf->device | ATA_DEV1 : tf->device & ~ATA_DEV1;
+
+       /* sanity check for pio multi commands */
+       if ((cdb[1] & 0xe0) && !is_multi_taskfile(tf))
+               goto invalid_fld;
+
+       if (is_multi_taskfile(tf)) {
+               unsigned int multi_count = 1 << (cdb[1] >> 5);
+
+               /* compare the passed through multi_count
+                * with the cached multi_count of libata
+                */
+               if (multi_count != dev->multi_count)
+                       ata_dev_printk(dev, KERN_WARNING,
+                                      "invalid multi_count %u ignored\n",
+                                      multi_count);
+       }       
 
        /* READ/WRITE LONG use a non-standard sect_size */
        qc->sect_size = ATA_SECT_SIZE;
index e35d13466c69092c68e822f4cb150b6f492cefab..ce84805ba5f14e80093efa1056ddd3a18de36f20 100644 (file)
@@ -80,25 +80,25 @@ u8 ata_dummy_irq_on (struct ata_port *ap)   { return 0; }
 u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq)
 {
        unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY;
-       u8 host_stat, post_stat, status;
+       u8 host_stat = 0, post_stat = 0, status;
 
        status = ata_busy_wait(ap, bits, 1000);
        if (status & bits)
                if (ata_msg_err(ap))
                        printk(KERN_ERR "abnormal status 0x%X\n", status);
 
-       /* get controller status; clear intr, err bits */
-       host_stat = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
-       iowrite8(host_stat | ATA_DMA_INTR | ATA_DMA_ERR,
-                ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
-
-       post_stat = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
+       if (ap->ioaddr.bmdma_addr) {
+               /* get controller status; clear intr, err bits */
+               host_stat = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
+               iowrite8(host_stat | ATA_DMA_INTR | ATA_DMA_ERR,
+                        ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
 
+               post_stat = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
+       }
        if (ata_msg_intr(ap))
                printk(KERN_INFO "%s: irq ack: host_stat 0x%X, new host_stat 0x%X, drv_stat 0x%X\n",
                        __FUNCTION__,
                        host_stat, post_stat, status);
-
        return status;
 }
 
@@ -516,6 +516,27 @@ void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc)
                ata_bmdma_stop(qc);
 }
 
+/**
+ *     ata_sff_port_start - Set port up for dma.
+ *     @ap: Port to initialize
+ *
+ *     Called just after data structures for each port are
+ *     initialized.  Allocates space for PRD table if the device
+ *     is DMA capable SFF.
+ *
+ *     May be used as the port_start() entry in ata_port_operations.
+ *
+ *     LOCKING:
+ *     Inherited from caller.
+ */
+
+int ata_sff_port_start(struct ata_port *ap)
+{
+       if (ap->ioaddr.bmdma_addr)
+               return ata_port_start(ap);
+       return 0;
+}
+
 #ifdef CONFIG_PCI
 
 static int ata_resources_present(struct pci_dev *pdev, int port)
index 1f647b648204fffa172d761677f43bb0367572c3..5525518204e65dc07850f2283f8a5e1b775a9703 100644 (file)
@@ -77,7 +77,6 @@ static int isapnp_init_one(struct pnp_dev *idev, const struct pnp_device_id *dev
        struct ata_host *host;
        struct ata_port *ap;
        void __iomem *cmd_addr, *ctl_addr;
-       int rc;
 
        if (pnp_port_valid(idev, 0) == 0)
                return -ENODEV;
index 2b924a69b365cfda37d7b6acd705c2b567672e84..6dc0b011a6b7c5a10febc2a0242c5dc431939a23 100644 (file)
@@ -784,9 +784,12 @@ static unsigned int pdc_qc_issue_prot(struct ata_queued_cmd *qc)
                if (qc->dev->flags & ATA_DFLAG_CDB_INTR)
                        break;
                /*FALLTHROUGH*/
+       case ATA_PROT_NODATA:
+               if (qc->tf.flags & ATA_TFLAG_POLLING)
+                       break;
+               /*FALLTHROUGH*/
        case ATA_PROT_ATAPI_DMA:
        case ATA_PROT_DMA:
-       case ATA_PROT_NODATA:
                pdc_packet_start(qc);
                return 0;
 
@@ -800,7 +803,7 @@ static unsigned int pdc_qc_issue_prot(struct ata_queued_cmd *qc)
 static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
 {
        WARN_ON (tf->protocol == ATA_PROT_DMA ||
-                tf->protocol == ATA_PROT_NODATA);
+                tf->protocol == ATA_PROT_ATAPI_DMA);
        ata_tf_load(ap, tf);
 }
 
@@ -808,7 +811,7 @@ static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
 static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
 {
        WARN_ON (tf->protocol == ATA_PROT_DMA ||
-                tf->protocol == ATA_PROT_NODATA);
+                tf->protocol == ATA_PROT_ATAPI_DMA);
        ata_exec_command(ap, tf);
 }
 
index 20c4ea6eb50d0a8836e2f89af145fc88634c02ba..8c506dbe39138bc11b8901944a81461c5a424e79 100644 (file)
@@ -369,36 +369,6 @@ char *make_class_name(const char *name, struct kobject *kobj)
        return class_name;
 }
 
-static int deprecated_class_uevent(char **envp, int num_envp, int *cur_index,
-                                  char *buffer, int buffer_size,
-                                  int *cur_len,
-                                  struct class_device *class_dev)
-{
-       struct device *dev = class_dev->dev;
-       char *path;
-
-       if (!dev)
-               return 0;
-
-       /* add device, backing this class device (deprecated) */
-       path = kobject_get_path(&dev->kobj, GFP_KERNEL);
-
-       add_uevent_var(envp, num_envp, cur_index, buffer, buffer_size,
-                      cur_len, "PHYSDEVPATH=%s", path);
-       kfree(path);
-
-       if (dev->bus)
-               add_uevent_var(envp, num_envp, cur_index,
-                              buffer, buffer_size, cur_len,
-                              "PHYSDEVBUS=%s", dev->bus->name);
-
-       if (dev->driver)
-               add_uevent_var(envp, num_envp, cur_index,
-                              buffer, buffer_size, cur_len,
-                              "PHYSDEVDRIVER=%s", dev->driver->name);
-       return 0;
-}
-
 static int make_deprecated_class_device_links(struct class_device *class_dev)
 {
        char *class_name;
@@ -430,11 +400,6 @@ static void remove_deprecated_class_device_links(struct class_device *class_dev)
        kfree(class_name);
 }
 #else
-static inline int deprecated_class_uevent(char **envp, int num_envp,
-                                         int *cur_index, char *buffer,
-                                         int buffer_size, int *cur_len,
-                                         struct class_device *class_dev)
-{ return 0; }
 static inline int make_deprecated_class_device_links(struct class_device *cd)
 { return 0; }
 static void remove_deprecated_class_device_links(struct class_device *cd)
@@ -445,15 +410,13 @@ static int class_uevent(struct kset *kset, struct kobject *kobj, char **envp,
                         int num_envp, char *buffer, int buffer_size)
 {
        struct class_device *class_dev = to_class_dev(kobj);
+       struct device *dev = class_dev->dev;
        int i = 0;
        int length = 0;
        int retval = 0;
 
        pr_debug("%s - name = %s\n", __FUNCTION__, class_dev->class_id);
 
-       deprecated_class_uevent(envp, num_envp, &i, buffer, buffer_size,
-                               &length, class_dev);
-
        if (MAJOR(class_dev->devt)) {
                add_uevent_var(envp, num_envp, &i,
                               buffer, buffer_size, &length,
@@ -464,6 +427,26 @@ static int class_uevent(struct kset *kset, struct kobject *kobj, char **envp,
                               "MINOR=%u", MINOR(class_dev->devt));
        }
 
+       if (dev) {
+               const char *path = kobject_get_path(&dev->kobj, GFP_KERNEL);
+               if (path) {
+                       add_uevent_var(envp, num_envp, &i,
+                                      buffer, buffer_size, &length,
+                                      "PHYSDEVPATH=%s", path);
+                       kfree(path);
+               }
+
+               if (dev->bus)
+                       add_uevent_var(envp, num_envp, &i,
+                                      buffer, buffer_size, &length,
+                                      "PHYSDEVBUS=%s", dev->bus->name);
+
+               if (dev->driver)
+                       add_uevent_var(envp, num_envp, &i,
+                                      buffer, buffer_size, &length,
+                                      "PHYSDEVDRIVER=%s", dev->driver->name);
+       }
+
        /* terminate, set to next free slot, shrink available space */
        envp[i] = NULL;
        envp = &envp[i];
index b78fc1e68264872a196c6a7b1e454b080a9831bd..dd40d78a023dd1f2fde9712ac7700d5ade4893cf 100644 (file)
@@ -180,10 +180,12 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj, char **envp,
                        const char *path;
 
                        path = kobject_get_path(&parent->kobj, GFP_KERNEL);
-                       add_uevent_var(envp, num_envp, &i,
-                                      buffer, buffer_size, &length,
-                                      "PHYSDEVPATH=%s", path);
-                       kfree(path);
+                       if (path) {
+                               add_uevent_var(envp, num_envp, &i,
+                                              buffer, buffer_size, &length,
+                                              "PHYSDEVPATH=%s", path);
+                               kfree(path);
+                       }
 
                        add_uevent_var(envp, num_envp, &i,
                                       buffer, buffer_size, &length,
index 92428e55b0c210a8c00cf8e656a934fa9e21f2d3..b0088b0efecdd1e5395e4104d23d0fe34dbb9a0d 100644 (file)
@@ -207,19 +207,6 @@ static int __device_attach(struct device_driver * drv, void * data)
        return driver_probe_device(drv, dev);
 }
 
-static int device_probe_drivers(void *data)
-{
-       struct device *dev = data;
-       int ret = 0;
-
-       if (dev->bus) {
-               down(&dev->sem);
-               ret = bus_for_each_drv(dev->bus, NULL, dev, __device_attach);
-               up(&dev->sem);
-       }
-       return ret;
-}
-
 /**
  *     device_attach - try to attach device to a driver.
  *     @dev:   device.
index 97ab5bd1c4d62ebb72ef9babc07f2c35571c484b..89a5f4a5491391e2270069090f43c6e82b6ef601 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * firmware_class.c - Multi purpose firmware loading support
  *
- * Copyright (c) 2003 Manuel Estrada Sainz <ranty@debian.org>
+ * Copyright (c) 2003 Manuel Estrada Sainz
  *
  * Please see Documentation/firmware_class/ for more information.
  *
@@ -23,7 +23,7 @@
 
 #define to_dev(obj) container_of(obj, struct device, kobj)
 
-MODULE_AUTHOR("Manuel Estrada Sainz <ranty@debian.org>");
+MODULE_AUTHOR("Manuel Estrada Sainz");
 MODULE_DESCRIPTION("Multi purpose firmware loading support");
 MODULE_LICENSE("GPL");
 
index 5526eadb65926d4318b790a0ede84d9f272a7059..0ed5470d25339674a5c449feab66f5505db5f3c2 100644 (file)
@@ -1354,7 +1354,7 @@ static struct block_device_operations lo_fops = {
  */
 static int max_loop;
 module_param(max_loop, int, 0);
-MODULE_PARM_DESC(max_loop, "obsolete, loop device is created on-demand");
+MODULE_PARM_DESC(max_loop, "Maximum number of loop devices");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS_BLOCKDEV_MAJOR(LOOP_MAJOR);
 
@@ -1394,16 +1394,11 @@ int loop_unregister_transfer(int number)
 EXPORT_SYMBOL(loop_register_transfer);
 EXPORT_SYMBOL(loop_unregister_transfer);
 
-static struct loop_device *loop_init_one(int i)
+static struct loop_device *loop_alloc(int i)
 {
        struct loop_device *lo;
        struct gendisk *disk;
 
-       list_for_each_entry(lo, &loop_devices, lo_list) {
-               if (lo->lo_number == i)
-                       return lo;
-       }
-
        lo = kzalloc(sizeof(*lo), GFP_KERNEL);
        if (!lo)
                goto out;
@@ -1427,8 +1422,6 @@ static struct loop_device *loop_init_one(int i)
        disk->private_data      = lo;
        disk->queue             = lo->lo_queue;
        sprintf(disk->disk_name, "loop%d", i);
-       add_disk(disk);
-       list_add_tail(&lo->lo_list, &loop_devices);
        return lo;
 
 out_free_queue:
@@ -1439,15 +1432,37 @@ out:
        return NULL;
 }
 
-static void loop_del_one(struct loop_device *lo)
+static void loop_free(struct loop_device *lo)
 {
-       del_gendisk(lo->lo_disk);
        blk_cleanup_queue(lo->lo_queue);
        put_disk(lo->lo_disk);
        list_del(&lo->lo_list);
        kfree(lo);
 }
 
+static struct loop_device *loop_init_one(int i)
+{
+       struct loop_device *lo;
+
+       list_for_each_entry(lo, &loop_devices, lo_list) {
+               if (lo->lo_number == i)
+                       return lo;
+       }
+
+       lo = loop_alloc(i);
+       if (lo) {
+               add_disk(lo->lo_disk);
+               list_add_tail(&lo->lo_list, &loop_devices);
+       }
+       return lo;
+}
+
+static void loop_del_one(struct loop_device *lo)
+{
+       del_gendisk(lo->lo_disk);
+       loop_free(lo);
+}
+
 static struct kobject *loop_probe(dev_t dev, int *part, void *data)
 {
        struct loop_device *lo;
@@ -1464,28 +1479,77 @@ static struct kobject *loop_probe(dev_t dev, int *part, void *data)
 
 static int __init loop_init(void)
 {
-       if (register_blkdev(LOOP_MAJOR, "loop"))
-               return -EIO;
-       blk_register_region(MKDEV(LOOP_MAJOR, 0), 1UL << MINORBITS,
-                                 THIS_MODULE, loop_probe, NULL, NULL);
+       int i, nr;
+       unsigned long range;
+       struct loop_device *lo, *next;
+
+       /*
+        * loop module now has a feature to instantiate underlying device
+        * structure on-demand, provided that there is an access dev node.
+        * However, this will not work well with user space tool that doesn't
+        * know about such "feature".  In order to not break any existing
+        * tool, we do the following:
+        *
+        * (1) if max_loop is specified, create that many upfront, and this
+        *     also becomes a hard limit.
+        * (2) if max_loop is not specified, create 8 loop device on module
+        *     load, user can further extend loop device by create dev node
+        *     themselves and have kernel automatically instantiate actual
+        *     device on-demand.
+        */
+       if (max_loop > 1UL << MINORBITS)
+               return -EINVAL;
 
        if (max_loop) {
-               printk(KERN_INFO "loop: the max_loop option is obsolete "
-                                "and will be removed in March 2008\n");
+               nr = max_loop;
+               range = max_loop;
+       } else {
+               nr = 8;
+               range = 1UL << MINORBITS;
+       }
+
+       if (register_blkdev(LOOP_MAJOR, "loop"))
+               return -EIO;
 
+       for (i = 0; i < nr; i++) {
+               lo = loop_alloc(i);
+               if (!lo)
+                       goto Enomem;
+               list_add_tail(&lo->lo_list, &loop_devices);
        }
+
+       /* point of no return */
+
+       list_for_each_entry(lo, &loop_devices, lo_list)
+               add_disk(lo->lo_disk);
+
+       blk_register_region(MKDEV(LOOP_MAJOR, 0), range,
+                                 THIS_MODULE, loop_probe, NULL, NULL);
+
        printk(KERN_INFO "loop: module loaded\n");
        return 0;
+
+Enomem:
+       printk(KERN_INFO "loop: out of memory\n");
+
+       list_for_each_entry_safe(lo, next, &loop_devices, lo_list)
+               loop_free(lo);
+
+       unregister_blkdev(LOOP_MAJOR, "loop");
+       return -ENOMEM;
 }
 
 static void __exit loop_exit(void)
 {
+       unsigned long range;
        struct loop_device *lo, *next;
 
+       range = max_loop ? max_loop :  1UL << MINORBITS;
+
        list_for_each_entry_safe(lo, next, &loop_devices, lo_list)
                loop_del_one(lo);
 
-       blk_unregister_region(MKDEV(LOOP_MAJOR, 0), 1UL << MINORBITS);
+       blk_unregister_region(MKDEV(LOOP_MAJOR, 0), range);
        if (unregister_blkdev(LOOP_MAJOR, "loop"))
                printk(KERN_WARNING "loop: cannot unregister blkdev\n");
 }
index f574962f4288d36233491eb0d98f8968e2d0da2b..4310cc84dfedb4c3b59dc20751e91ed076ace202 100644 (file)
@@ -1053,11 +1053,11 @@ static void __exit mcdx_exit(void)
        if (unregister_blkdev(MAJOR_NR, "mcdx") != 0) {
                xwarn("cleanup() unregister_blkdev() failed\n");
        }
-       blk_cleanup_queue(mcdx_queue);
 #if !MCDX_QUIET
        else
        xinfo("cleanup() succeeded\n");
 #endif
+       blk_cleanup_queue(mcdx_queue);
 }
 
 #ifdef MODULE
index fdbca25a3948a14437181d2bd4b89567dfcdcf2e..35ab1a9f8e8b42269ea1e7a7e9d13f9c86f16d0b 100644 (file)
@@ -176,7 +176,7 @@ struct agp_bridge_data {
 #define I830_GMCH_MEM_MASK             0x1
 #define I830_GMCH_MEM_64M              0x1
 #define I830_GMCH_MEM_128M             0
-#define I830_GMCH_GMS_MASK             0x70
+#define I830_GMCH_GMS_MASK             0xF0
 #define I830_GMCH_GMS_DISABLED         0x00
 #define I830_GMCH_GMS_LOCAL            0x10
 #define I830_GMCH_GMS_STOLEN_512       0x20
@@ -231,6 +231,10 @@ struct agp_bridge_data {
 #define I965_PGETBL_SIZE_512KB (0 << 1)
 #define I965_PGETBL_SIZE_256KB (1 << 1)
 #define I965_PGETBL_SIZE_128KB (2 << 1)
+#define G33_PGETBL_SIZE_MASK    (3 << 8)
+#define G33_PGETBL_SIZE_1M      (1 << 8)
+#define G33_PGETBL_SIZE_2M      (2 << 8)
+
 #define I810_DRAM_CTL          0x3000
 #define I810_DRAM_ROW_0                0x00000001
 #define I810_DRAM_ROW_0_SDRAM  0x00000001
index 9c69f2e761f568cb56af191690be641d7aefffd2..0439ee951a113ab3fbed364860ddb9b4c6cdcd1d 100644 (file)
 #define PCI_DEVICE_ID_INTEL_82965G_IG       0x29A2
 #define PCI_DEVICE_ID_INTEL_82965GM_HB      0x2A00
 #define PCI_DEVICE_ID_INTEL_82965GM_IG      0x2A02
+#define PCI_DEVICE_ID_INTEL_82965GME_IG     0x2A12
+#define PCI_DEVICE_ID_INTEL_82945GME_IG     0x27AE
+#define PCI_DEVICE_ID_INTEL_G33_HB          0x29C0
+#define PCI_DEVICE_ID_INTEL_G33_IG          0x29C2
+#define PCI_DEVICE_ID_INTEL_Q35_HB          0x29B0
+#define PCI_DEVICE_ID_INTEL_Q35_IG          0x29B2
+#define PCI_DEVICE_ID_INTEL_Q33_HB          0x29D0
+#define PCI_DEVICE_ID_INTEL_Q33_IG          0x29D2
 
 #define IS_I965 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82946GZ_HB || \
                  agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_1_HB || \
@@ -27,6 +35,9 @@
                  agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_HB || \
                  agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GM_HB)
 
+#define IS_G33 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G33_HB || \
+               agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_Q35_HB || \
+               agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_Q33_HB)
 
 extern int agp_memory_reserved;
 
@@ -53,6 +64,8 @@ extern int agp_memory_reserved;
 #define I915_PTEADDR   0x1C
 #define I915_GMCH_GMS_STOLEN_48M       (0x6 << 4)
 #define I915_GMCH_GMS_STOLEN_64M       (0x7 << 4)
+#define G33_GMCH_GMS_STOLEN_128M       (0x8 << 4)
+#define G33_GMCH_GMS_STOLEN_256M       (0x9 << 4)
 
 /* Intel 965G registers */
 #define I965_MSAC 0x62
@@ -86,11 +99,18 @@ static struct gatt_mask intel_i810_masks[] =
         .type = INTEL_AGP_CACHED_MEMORY}
 };
 
-static struct _intel_i810_private {
-       struct pci_dev *i810_dev;       /* device one */
-       volatile u8 __iomem *registers;
+static struct _intel_private {
+       struct pci_dev *pcidev; /* device one */
+       u8 __iomem *registers;
+       u32 __iomem *gtt;               /* I915G */
        int num_dcache_entries;
-} intel_i810_private;
+       /* gtt_entries is the number of gtt entries that are already mapped
+        * to stolen memory.  Stolen memory is larger than the memory mapped
+        * through gtt_entries, as it includes some reserved space for the BIOS
+        * popup and for the GTT.
+        */
+       int gtt_entries;                        /* i830+ */
+} intel_private;
 
 static int intel_i810_fetch_size(void)
 {
@@ -127,32 +147,32 @@ static int intel_i810_configure(void)
 
        current_size = A_SIZE_FIX(agp_bridge->current_size);
 
-       if (!intel_i810_private.registers) {
-               pci_read_config_dword(intel_i810_private.i810_dev, I810_MMADDR, &temp);
+       if (!intel_private.registers) {
+               pci_read_config_dword(intel_private.pcidev, I810_MMADDR, &temp);
                temp &= 0xfff80000;
 
-               intel_i810_private.registers = ioremap(temp, 128 * 4096);
-               if (!intel_i810_private.registers) {
+               intel_private.registers = ioremap(temp, 128 * 4096);
+               if (!intel_private.registers) {
                        printk(KERN_ERR PFX "Unable to remap memory.\n");
                        return -ENOMEM;
                }
        }
 
-       if ((readl(intel_i810_private.registers+I810_DRAM_CTL)
+       if ((readl(intel_private.registers+I810_DRAM_CTL)
                & I810_DRAM_ROW_0) == I810_DRAM_ROW_0_SDRAM) {
                /* This will need to be dynamically assigned */
                printk(KERN_INFO PFX "detected 4MB dedicated video ram.\n");
-               intel_i810_private.num_dcache_entries = 1024;
+               intel_private.num_dcache_entries = 1024;
        }
-       pci_read_config_dword(intel_i810_private.i810_dev, I810_GMADDR, &temp);
+       pci_read_config_dword(intel_private.pcidev, I810_GMADDR, &temp);
        agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
-       writel(agp_bridge->gatt_bus_addr | I810_PGETBL_ENABLED, intel_i810_private.registers+I810_PGETBL_CTL);
-       readl(intel_i810_private.registers+I810_PGETBL_CTL);    /* PCI Posting. */
+       writel(agp_bridge->gatt_bus_addr | I810_PGETBL_ENABLED, intel_private.registers+I810_PGETBL_CTL);
+       readl(intel_private.registers+I810_PGETBL_CTL); /* PCI Posting. */
 
        if (agp_bridge->driver->needs_scratch_page) {
                for (i = 0; i < current_size->num_entries; i++) {
-                       writel(agp_bridge->scratch_page, intel_i810_private.registers+I810_PTE_BASE+(i*4));
-                       readl(intel_i810_private.registers+I810_PTE_BASE+(i*4));        /* PCI posting. */
+                       writel(agp_bridge->scratch_page, intel_private.registers+I810_PTE_BASE+(i*4));
+                       readl(intel_private.registers+I810_PTE_BASE+(i*4));     /* PCI posting. */
                }
        }
        global_cache_flush();
@@ -161,9 +181,9 @@ static int intel_i810_configure(void)
 
 static void intel_i810_cleanup(void)
 {
-       writel(0, intel_i810_private.registers+I810_PGETBL_CTL);
-       readl(intel_i810_private.registers);    /* PCI Posting. */
-       iounmap(intel_i810_private.registers);
+       writel(0, intel_private.registers+I810_PGETBL_CTL);
+       readl(intel_private.registers); /* PCI Posting. */
+       iounmap(intel_private.registers);
 }
 
 static void intel_i810_tlbflush(struct agp_memory *mem)
@@ -261,9 +281,9 @@ static int intel_i810_insert_entries(struct agp_memory *mem, off_t pg_start,
                        global_cache_flush();
                for (i = pg_start; i < (pg_start + mem->page_count); i++) {
                        writel((i*4096)|I810_PTE_LOCAL|I810_PTE_VALID,
-                              intel_i810_private.registers+I810_PTE_BASE+(i*4));
+                              intel_private.registers+I810_PTE_BASE+(i*4));
                }
-               readl(intel_i810_private.registers+I810_PTE_BASE+((i-1)*4));
+               readl(intel_private.registers+I810_PTE_BASE+((i-1)*4));
                break;
        case AGP_PHYS_MEMORY:
        case AGP_NORMAL_MEMORY:
@@ -273,9 +293,9 @@ static int intel_i810_insert_entries(struct agp_memory *mem, off_t pg_start,
                        writel(agp_bridge->driver->mask_memory(agp_bridge,
                                                               mem->memory[i],
                                                               mask_type),
-                              intel_i810_private.registers+I810_PTE_BASE+(j*4));
+                              intel_private.registers+I810_PTE_BASE+(j*4));
                }
-               readl(intel_i810_private.registers+I810_PTE_BASE+((j-1)*4));
+               readl(intel_private.registers+I810_PTE_BASE+((j-1)*4));
                break;
        default:
                goto out_err;
@@ -298,9 +318,9 @@ static int intel_i810_remove_entries(struct agp_memory *mem, off_t pg_start,
                return 0;
 
        for (i = pg_start; i < (mem->page_count + pg_start); i++) {
-               writel(agp_bridge->scratch_page, intel_i810_private.registers+I810_PTE_BASE+(i*4));
+               writel(agp_bridge->scratch_page, intel_private.registers+I810_PTE_BASE+(i*4));
        }
-       readl(intel_i810_private.registers+I810_PTE_BASE+((i-1)*4));
+       readl(intel_private.registers+I810_PTE_BASE+((i-1)*4));
 
        agp_bridge->driver->tlb_flush(mem);
        return 0;
@@ -354,7 +374,7 @@ static struct agp_memory *intel_i810_alloc_by_type(size_t pg_count, int type)
        struct agp_memory *new;
 
        if (type == AGP_DCACHE_MEMORY) {
-               if (pg_count != intel_i810_private.num_dcache_entries)
+               if (pg_count != intel_private.num_dcache_entries)
                        return NULL;
 
                new = agp_create_memory(1);
@@ -404,18 +424,6 @@ static struct aper_size_info_fixed intel_i830_sizes[] =
        {512, 131072, 7},
 };
 
-static struct _intel_i830_private {
-       struct pci_dev *i830_dev;               /* device one */
-       volatile u8 __iomem *registers;
-       volatile u32 __iomem *gtt;              /* I915G */
-       /* gtt_entries is the number of gtt entries that are already mapped
-        * to stolen memory.  Stolen memory is larger than the memory mapped
-        * through gtt_entries, as it includes some reserved space for the BIOS
-        * popup and for the GTT.
-        */
-       int gtt_entries;
-} intel_i830_private;
-
 static void intel_i830_init_gtt_entries(void)
 {
        u16 gmch_ctrl;
@@ -429,7 +437,7 @@ static void intel_i830_init_gtt_entries(void)
 
        if (IS_I965) {
                u32 pgetbl_ctl;
-               pgetbl_ctl = readl(intel_i830_private.registers+I810_PGETBL_CTL);
+               pgetbl_ctl = readl(intel_private.registers+I810_PGETBL_CTL);
 
                /* The 965 has a field telling us the size of the GTT,
                 * which may be larger than what is necessary to map the
@@ -451,6 +459,22 @@ static void intel_i830_init_gtt_entries(void)
                        size = 512;
                }
                size += 4; /* add in BIOS popup space */
+       } else if (IS_G33) {
+       /* G33's GTT size defined in gmch_ctrl */
+               switch (gmch_ctrl & G33_PGETBL_SIZE_MASK) {
+               case G33_PGETBL_SIZE_1M:
+                       size = 1024;
+                       break;
+               case G33_PGETBL_SIZE_2M:
+                       size = 2048;
+                       break;
+               default:
+                       printk(KERN_INFO PFX "Unknown page table size 0x%x, "
+                               "assuming 512KB\n",
+                               (gmch_ctrl & G33_PGETBL_SIZE_MASK));
+                       size = 512;
+               }
+               size += 4;
        } else {
                /* On previous hardware, the GTT size was just what was
                 * required to map the aperture.
@@ -471,7 +495,7 @@ static void intel_i830_init_gtt_entries(void)
                        gtt_entries = MB(8) - KB(size);
                        break;
                case I830_GMCH_GMS_LOCAL:
-                       rdct = readb(intel_i830_private.registers+I830_RDRAM_CHANNEL_TYPE);
+                       rdct = readb(intel_private.registers+I830_RDRAM_CHANNEL_TYPE);
                        gtt_entries = (I830_RDRAM_ND(rdct) + 1) *
                                        MB(ddt[I830_RDRAM_DDT(rdct)]);
                        local = 1;
@@ -502,7 +526,8 @@ static void intel_i830_init_gtt_entries(void)
                        if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB ||
                            agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB ||
                            agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB ||
-                           agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GM_HB || IS_I965 )
+                           agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GM_HB ||
+                           IS_I965 || IS_G33)
                                gtt_entries = MB(48) - KB(size);
                        else
                                gtt_entries = 0;
@@ -512,10 +537,24 @@ static void intel_i830_init_gtt_entries(void)
                        if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB ||
                            agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB ||
                            agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB ||
-                           agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GM_HB || IS_I965)
+                           agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GM_HB ||
+                           IS_I965 || IS_G33)
                                gtt_entries = MB(64) - KB(size);
                        else
                                gtt_entries = 0;
+                       break;
+               case G33_GMCH_GMS_STOLEN_128M:
+                       if (IS_G33)
+                               gtt_entries = MB(128) - KB(size);
+                       else
+                               gtt_entries = 0;
+                       break;
+               case G33_GMCH_GMS_STOLEN_256M:
+                       if (IS_G33)
+                               gtt_entries = MB(256) - KB(size);
+                       else
+                               gtt_entries = 0;
+                       break;
                default:
                        gtt_entries = 0;
                        break;
@@ -529,7 +568,7 @@ static void intel_i830_init_gtt_entries(void)
                       "No pre-allocated video memory detected.\n");
        gtt_entries /= KB(4);
 
-       intel_i830_private.gtt_entries = gtt_entries;
+       intel_private.gtt_entries = gtt_entries;
 }
 
 /* The intel i830 automatically initializes the agp aperture during POST.
@@ -547,14 +586,14 @@ static int intel_i830_create_gatt_table(struct agp_bridge_data *bridge)
        num_entries = size->num_entries;
        agp_bridge->gatt_table_real = NULL;
 
-       pci_read_config_dword(intel_i830_private.i830_dev,I810_MMADDR,&temp);
+       pci_read_config_dword(intel_private.pcidev,I810_MMADDR,&temp);
        temp &= 0xfff80000;
 
-       intel_i830_private.registers = ioremap(temp,128 * 4096);
-       if (!intel_i830_private.registers)
+       intel_private.registers = ioremap(temp,128 * 4096);
+       if (!intel_private.registers)
                return -ENOMEM;
 
-       temp = readl(intel_i830_private.registers+I810_PGETBL_CTL) & 0xfffff000;
+       temp = readl(intel_private.registers+I810_PGETBL_CTL) & 0xfffff000;
        global_cache_flush();   /* FIXME: ?? */
 
        /* we have to call this as early as possible after the MMIO base address is known */
@@ -614,20 +653,20 @@ static int intel_i830_configure(void)
 
        current_size = A_SIZE_FIX(agp_bridge->current_size);
 
-       pci_read_config_dword(intel_i830_private.i830_dev,I810_GMADDR,&temp);
+       pci_read_config_dword(intel_private.pcidev,I810_GMADDR,&temp);
        agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
 
        pci_read_config_word(agp_bridge->dev,I830_GMCH_CTRL,&gmch_ctrl);
        gmch_ctrl |= I830_GMCH_ENABLED;
        pci_write_config_word(agp_bridge->dev,I830_GMCH_CTRL,gmch_ctrl);
 
-       writel(agp_bridge->gatt_bus_addr|I810_PGETBL_ENABLED, intel_i830_private.registers+I810_PGETBL_CTL);
-       readl(intel_i830_private.registers+I810_PGETBL_CTL);    /* PCI Posting. */
+       writel(agp_bridge->gatt_bus_addr|I810_PGETBL_ENABLED, intel_private.registers+I810_PGETBL_CTL);
+       readl(intel_private.registers+I810_PGETBL_CTL); /* PCI Posting. */
 
        if (agp_bridge->driver->needs_scratch_page) {
-               for (i = intel_i830_private.gtt_entries; i < current_size->num_entries; i++) {
-                       writel(agp_bridge->scratch_page, intel_i830_private.registers+I810_PTE_BASE+(i*4));
-                       readl(intel_i830_private.registers+I810_PTE_BASE+(i*4));        /* PCI Posting. */
+               for (i = intel_private.gtt_entries; i < current_size->num_entries; i++) {
+                       writel(agp_bridge->scratch_page, intel_private.registers+I810_PTE_BASE+(i*4));
+                       readl(intel_private.registers+I810_PTE_BASE+(i*4));     /* PCI Posting. */
                }
        }
 
@@ -637,7 +676,7 @@ static int intel_i830_configure(void)
 
 static void intel_i830_cleanup(void)
 {
-       iounmap(intel_i830_private.registers);
+       iounmap(intel_private.registers);
 }
 
 static int intel_i830_insert_entries(struct agp_memory *mem,off_t pg_start, int type)
@@ -653,9 +692,9 @@ static int intel_i830_insert_entries(struct agp_memory *mem,off_t pg_start, int
        temp = agp_bridge->current_size;
        num_entries = A_SIZE_FIX(temp)->num_entries;
 
-       if (pg_start < intel_i830_private.gtt_entries) {
-               printk (KERN_DEBUG PFX "pg_start == 0x%.8lx,intel_i830_private.gtt_entries == 0x%.8x\n",
-                               pg_start,intel_i830_private.gtt_entries);
+       if (pg_start < intel_private.gtt_entries) {
+               printk (KERN_DEBUG PFX "pg_start == 0x%.8lx,intel_private.gtt_entries == 0x%.8x\n",
+                               pg_start,intel_private.gtt_entries);
 
                printk (KERN_INFO PFX "Trying to insert into local/stolen memory\n");
                goto out_err;
@@ -683,9 +722,9 @@ static int intel_i830_insert_entries(struct agp_memory *mem,off_t pg_start, int
        for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
                writel(agp_bridge->driver->mask_memory(agp_bridge,
                                                       mem->memory[i], mask_type),
-                      intel_i830_private.registers+I810_PTE_BASE+(j*4));
+                      intel_private.registers+I810_PTE_BASE+(j*4));
        }
-       readl(intel_i830_private.registers+I810_PTE_BASE+((j-1)*4));
+       readl(intel_private.registers+I810_PTE_BASE+((j-1)*4));
        agp_bridge->driver->tlb_flush(mem);
 
 out:
@@ -703,15 +742,15 @@ static int intel_i830_remove_entries(struct agp_memory *mem,off_t pg_start,
        if (mem->page_count == 0)
                return 0;
 
-       if (pg_start < intel_i830_private.gtt_entries) {
+       if (pg_start < intel_private.gtt_entries) {
                printk (KERN_INFO PFX "Trying to disable local/stolen memory\n");
                return -EINVAL;
        }
 
        for (i = pg_start; i < (mem->page_count + pg_start); i++) {
-               writel(agp_bridge->scratch_page, intel_i830_private.registers+I810_PTE_BASE+(i*4));
+               writel(agp_bridge->scratch_page, intel_private.registers+I810_PTE_BASE+(i*4));
        }
-       readl(intel_i830_private.registers+I810_PTE_BASE+((i-1)*4));
+       readl(intel_private.registers+I810_PTE_BASE+((i-1)*4));
 
        agp_bridge->driver->tlb_flush(mem);
        return 0;
@@ -734,7 +773,7 @@ static int intel_i915_configure(void)
 
        current_size = A_SIZE_FIX(agp_bridge->current_size);
 
-       pci_read_config_dword(intel_i830_private.i830_dev, I915_GMADDR, &temp);
+       pci_read_config_dword(intel_private.pcidev, I915_GMADDR, &temp);
 
        agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
 
@@ -742,13 +781,13 @@ static int intel_i915_configure(void)
        gmch_ctrl |= I830_GMCH_ENABLED;
        pci_write_config_word(agp_bridge->dev,I830_GMCH_CTRL,gmch_ctrl);
 
-       writel(agp_bridge->gatt_bus_addr|I810_PGETBL_ENABLED, intel_i830_private.registers+I810_PGETBL_CTL);
-       readl(intel_i830_private.registers+I810_PGETBL_CTL);    /* PCI Posting. */
+       writel(agp_bridge->gatt_bus_addr|I810_PGETBL_ENABLED, intel_private.registers+I810_PGETBL_CTL);
+       readl(intel_private.registers+I810_PGETBL_CTL); /* PCI Posting. */
 
        if (agp_bridge->driver->needs_scratch_page) {
-               for (i = intel_i830_private.gtt_entries; i < current_size->num_entries; i++) {
-                       writel(agp_bridge->scratch_page, intel_i830_private.gtt+i);
-                       readl(intel_i830_private.gtt+i);        /* PCI Posting. */
+               for (i = intel_private.gtt_entries; i < current_size->num_entries; i++) {
+                       writel(agp_bridge->scratch_page, intel_private.gtt+i);
+                       readl(intel_private.gtt+i);     /* PCI Posting. */
                }
        }
 
@@ -758,8 +797,8 @@ static int intel_i915_configure(void)
 
 static void intel_i915_cleanup(void)
 {
-       iounmap(intel_i830_private.gtt);
-       iounmap(intel_i830_private.registers);
+       iounmap(intel_private.gtt);
+       iounmap(intel_private.registers);
 }
 
 static int intel_i915_insert_entries(struct agp_memory *mem,off_t pg_start,
@@ -776,9 +815,9 @@ static int intel_i915_insert_entries(struct agp_memory *mem,off_t pg_start,
        temp = agp_bridge->current_size;
        num_entries = A_SIZE_FIX(temp)->num_entries;
 
-       if (pg_start < intel_i830_private.gtt_entries) {
-               printk (KERN_DEBUG PFX "pg_start == 0x%.8lx,intel_i830_private.gtt_entries == 0x%.8x\n",
-                               pg_start,intel_i830_private.gtt_entries);
+       if (pg_start < intel_private.gtt_entries) {
+               printk (KERN_DEBUG PFX "pg_start == 0x%.8lx,intel_private.gtt_entries == 0x%.8x\n",
+                               pg_start,intel_private.gtt_entries);
 
                printk (KERN_INFO PFX "Trying to insert into local/stolen memory\n");
                goto out_err;
@@ -805,10 +844,10 @@ static int intel_i915_insert_entries(struct agp_memory *mem,off_t pg_start,
 
        for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
                writel(agp_bridge->driver->mask_memory(agp_bridge,
-                       mem->memory[i], mask_type), intel_i830_private.gtt+j);
+                       mem->memory[i], mask_type), intel_private.gtt+j);
        }
 
-       readl(intel_i830_private.gtt+j-1);
+       readl(intel_private.gtt+j-1);
        agp_bridge->driver->tlb_flush(mem);
 
  out:
@@ -826,15 +865,15 @@ static int intel_i915_remove_entries(struct agp_memory *mem,off_t pg_start,
        if (mem->page_count == 0)
                return 0;
 
-       if (pg_start < intel_i830_private.gtt_entries) {
+       if (pg_start < intel_private.gtt_entries) {
                printk (KERN_INFO PFX "Trying to disable local/stolen memory\n");
                return -EINVAL;
        }
 
        for (i = pg_start; i < (mem->page_count + pg_start); i++) {
-               writel(agp_bridge->scratch_page, intel_i830_private.gtt+i);
+               writel(agp_bridge->scratch_page, intel_private.gtt+i);
        }
-       readl(intel_i830_private.gtt+i-1);
+       readl(intel_private.gtt+i-1);
 
        agp_bridge->driver->tlb_flush(mem);
        return 0;
@@ -850,7 +889,7 @@ static int intel_i9xx_fetch_size(void)
        int aper_size; /* size in megabytes */
        int i;
 
-       aper_size = pci_resource_len(intel_i830_private.i830_dev, 2) / MB(1);
+       aper_size = pci_resource_len(intel_private.pcidev, 2) / MB(1);
 
        for (i = 0; i < num_sizes; i++) {
                if (aper_size == intel_i830_sizes[i].size) {
@@ -878,20 +917,20 @@ static int intel_i915_create_gatt_table(struct agp_bridge_data *bridge)
        num_entries = size->num_entries;
        agp_bridge->gatt_table_real = NULL;
 
-       pci_read_config_dword(intel_i830_private.i830_dev, I915_MMADDR, &temp);
-       pci_read_config_dword(intel_i830_private.i830_dev, I915_PTEADDR,&temp2);
+       pci_read_config_dword(intel_private.pcidev, I915_MMADDR, &temp);
+       pci_read_config_dword(intel_private.pcidev, I915_PTEADDR,&temp2);
 
-       intel_i830_private.gtt = ioremap(temp2, 256 * 1024);
-       if (!intel_i830_private.gtt)
+       intel_private.gtt = ioremap(temp2, 256 * 1024);
+       if (!intel_private.gtt)
                return -ENOMEM;
 
        temp &= 0xfff80000;
 
-       intel_i830_private.registers = ioremap(temp,128 * 4096);
-       if (!intel_i830_private.registers)
+       intel_private.registers = ioremap(temp,128 * 4096);
+       if (!intel_private.registers)
                return -ENOMEM;
 
-       temp = readl(intel_i830_private.registers+I810_PGETBL_CTL) & 0xfffff000;
+       temp = readl(intel_private.registers+I810_PGETBL_CTL) & 0xfffff000;
        global_cache_flush();   /* FIXME: ? */
 
        /* we have to call this as early as possible after the MMIO base address is known */
@@ -938,20 +977,20 @@ static int intel_i965_create_gatt_table(struct agp_bridge_data *bridge)
        num_entries = size->num_entries;
        agp_bridge->gatt_table_real = NULL;
 
-       pci_read_config_dword(intel_i830_private.i830_dev, I915_MMADDR, &temp);
+       pci_read_config_dword(intel_private.pcidev, I915_MMADDR, &temp);
 
        temp &= 0xfff00000;
-       intel_i830_private.gtt = ioremap((temp + (512 * 1024)) , 512 * 1024);
+       intel_private.gtt = ioremap((temp + (512 * 1024)) , 512 * 1024);
 
-       if (!intel_i830_private.gtt)
+       if (!intel_private.gtt)
                return -ENOMEM;
 
 
-       intel_i830_private.registers = ioremap(temp,128 * 4096);
-       if (!intel_i830_private.registers)
+       intel_private.registers = ioremap(temp,128 * 4096);
+       if (!intel_private.registers)
                return -ENOMEM;
 
-       temp = readl(intel_i830_private.registers+I810_PGETBL_CTL) & 0xfffff000;
+       temp = readl(intel_private.registers+I810_PGETBL_CTL) & 0xfffff000;
        global_cache_flush();   /* FIXME: ? */
 
        /* we have to call this as early as possible after the MMIO base address is known */
@@ -1722,41 +1761,127 @@ static const struct agp_bridge_driver intel_7505_driver = {
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
-static int find_i810(u16 device)
-{
-       struct pci_dev *i810_dev;
-
-       i810_dev = pci_get_device(PCI_VENDOR_ID_INTEL, device, NULL);
-       if (!i810_dev)
-               return 0;
-       intel_i810_private.i810_dev = i810_dev;
-       return 1;
-}
+static const struct agp_bridge_driver intel_g33_driver = {
+       .owner                  = THIS_MODULE,
+       .aperture_sizes         = intel_i830_sizes,
+       .size_type              = FIXED_APER_SIZE,
+       .num_aperture_sizes     = 4,
+       .needs_scratch_page     = TRUE,
+       .configure              = intel_i915_configure,
+       .fetch_size             = intel_i9xx_fetch_size,
+       .cleanup                = intel_i915_cleanup,
+       .tlb_flush              = intel_i810_tlbflush,
+       .mask_memory            = intel_i965_mask_memory,
+       .masks                  = intel_i810_masks,
+       .agp_enable             = intel_i810_agp_enable,
+       .cache_flush            = global_cache_flush,
+       .create_gatt_table      = intel_i915_create_gatt_table,
+       .free_gatt_table        = intel_i830_free_gatt_table,
+       .insert_memory          = intel_i915_insert_entries,
+       .remove_memory          = intel_i915_remove_entries,
+       .alloc_by_type          = intel_i830_alloc_by_type,
+       .free_by_type           = intel_i810_free_by_type,
+       .agp_alloc_page         = agp_generic_alloc_page,
+       .agp_destroy_page       = agp_generic_destroy_page,
+       .agp_type_to_mask_type  = intel_i830_type_to_mask_type,
+};
 
-static int find_i830(u16 device)
+static int find_gmch(u16 device)
 {
-       struct pci_dev *i830_dev;
+       struct pci_dev *gmch_device;
 
-       i830_dev = pci_get_device(PCI_VENDOR_ID_INTEL, device, NULL);
-       if (i830_dev && PCI_FUNC(i830_dev->devfn) != 0) {
-               i830_dev = pci_get_device(PCI_VENDOR_ID_INTEL,
-                               device, i830_dev);
+       gmch_device = pci_get_device(PCI_VENDOR_ID_INTEL, device, NULL);
+       if (gmch_device && PCI_FUNC(gmch_device->devfn) != 0) {
+               gmch_device = pci_get_device(PCI_VENDOR_ID_INTEL,
+                                device, gmch_device);
        }
 
-       if (!i830_dev)
+       if (!gmch_device)
                return 0;
 
-       intel_i830_private.i830_dev = i830_dev;
+       intel_private.pcidev = gmch_device;
        return 1;
 }
 
+/* Table to describe Intel GMCH and AGP/PCIE GART drivers.  At least one of
+ * driver and gmch_driver must be non-null, and find_gmch will determine
+ * which one should be used if a gmch_chip_id is present.
+ */
+static const struct intel_driver_description {
+       unsigned int chip_id;
+       unsigned int gmch_chip_id;
+       unsigned int multi_gmch_chip; /* if we have more gfx chip type on this HB. */
+       char *name;
+       const struct agp_bridge_driver *driver;
+       const struct agp_bridge_driver *gmch_driver;
+} intel_agp_chipsets[] = {
+       { PCI_DEVICE_ID_INTEL_82443LX_0, 0, 0, "440LX", &intel_generic_driver, NULL },
+       { PCI_DEVICE_ID_INTEL_82443BX_0, 0, 0, "440BX", &intel_generic_driver, NULL },
+       { PCI_DEVICE_ID_INTEL_82443GX_0, 0, 0, "440GX", &intel_generic_driver, NULL },
+       { PCI_DEVICE_ID_INTEL_82810_MC1, PCI_DEVICE_ID_INTEL_82810_IG1, 0, "i810",
+               NULL, &intel_810_driver },
+       { PCI_DEVICE_ID_INTEL_82810_MC3, PCI_DEVICE_ID_INTEL_82810_IG3, 0, "i810",
+               NULL, &intel_810_driver },
+       { PCI_DEVICE_ID_INTEL_82810E_MC, PCI_DEVICE_ID_INTEL_82810E_IG, 0, "i810",
+               NULL, &intel_810_driver },
+       { PCI_DEVICE_ID_INTEL_82815_MC, PCI_DEVICE_ID_INTEL_82815_CGC, 0, "i815",
+               &intel_815_driver, &intel_810_driver },
+       { PCI_DEVICE_ID_INTEL_82820_HB, 0, 0, "i820", &intel_820_driver, NULL },
+       { PCI_DEVICE_ID_INTEL_82820_UP_HB, 0, 0, "i820", &intel_820_driver, NULL },
+       { PCI_DEVICE_ID_INTEL_82830_HB, PCI_DEVICE_ID_INTEL_82830_CGC, 0, "830M",
+               &intel_830mp_driver, &intel_830_driver },
+       { PCI_DEVICE_ID_INTEL_82840_HB, 0, 0, "i840", &intel_840_driver, NULL },
+       { PCI_DEVICE_ID_INTEL_82845_HB, 0, 0, "845G", &intel_845_driver, NULL },
+       { PCI_DEVICE_ID_INTEL_82845G_HB, PCI_DEVICE_ID_INTEL_82845G_IG, 0, "830M",
+               &intel_845_driver, &intel_830_driver },
+       { PCI_DEVICE_ID_INTEL_82850_HB, 0, 0, "i850", &intel_850_driver, NULL },
+       { PCI_DEVICE_ID_INTEL_82855PM_HB, 0, 0, "855PM", &intel_845_driver, NULL },
+       { PCI_DEVICE_ID_INTEL_82855GM_HB, PCI_DEVICE_ID_INTEL_82855GM_IG, 0, "855GM",
+               &intel_845_driver, &intel_830_driver },
+       { PCI_DEVICE_ID_INTEL_82860_HB, 0, 0, "i860", &intel_860_driver, NULL },
+       { PCI_DEVICE_ID_INTEL_82865_HB, PCI_DEVICE_ID_INTEL_82865_IG, 0, "865",
+               &intel_845_driver, &intel_830_driver },
+       { PCI_DEVICE_ID_INTEL_82875_HB, 0, 0, "i875", &intel_845_driver, NULL },
+       { PCI_DEVICE_ID_INTEL_82915G_HB, PCI_DEVICE_ID_INTEL_82915G_IG, 0, "915G",
+               &intel_845_driver, &intel_915_driver },
+       { PCI_DEVICE_ID_INTEL_82915GM_HB, PCI_DEVICE_ID_INTEL_82915GM_IG, 0, "915GM",
+               &intel_845_driver, &intel_915_driver },
+       { PCI_DEVICE_ID_INTEL_82945G_HB, PCI_DEVICE_ID_INTEL_82945G_IG, 0, "945G",
+               &intel_845_driver, &intel_915_driver },
+       { PCI_DEVICE_ID_INTEL_82945GM_HB, PCI_DEVICE_ID_INTEL_82945GM_IG, 1, "945GM",
+               &intel_845_driver, &intel_915_driver },
+       { PCI_DEVICE_ID_INTEL_82945GM_HB, PCI_DEVICE_ID_INTEL_82945GME_IG, 0, "945GME",
+               &intel_845_driver, &intel_915_driver },
+       { PCI_DEVICE_ID_INTEL_82946GZ_HB, PCI_DEVICE_ID_INTEL_82946GZ_IG, 0, "946GZ",
+               &intel_845_driver, &intel_i965_driver },
+       { PCI_DEVICE_ID_INTEL_82965G_1_HB, PCI_DEVICE_ID_INTEL_82965G_1_IG, 0, "965G",
+               &intel_845_driver, &intel_i965_driver },
+       { PCI_DEVICE_ID_INTEL_82965Q_HB, PCI_DEVICE_ID_INTEL_82965Q_IG, 0, "965Q",
+               &intel_845_driver, &intel_i965_driver },
+       { PCI_DEVICE_ID_INTEL_82965G_HB, PCI_DEVICE_ID_INTEL_82965G_IG, 0, "965G",
+               &intel_845_driver, &intel_i965_driver },
+       { PCI_DEVICE_ID_INTEL_82965GM_HB, PCI_DEVICE_ID_INTEL_82965GM_IG, 1, "965GM",
+               &intel_845_driver, &intel_i965_driver },
+       { PCI_DEVICE_ID_INTEL_82965GM_HB, PCI_DEVICE_ID_INTEL_82965GME_IG, 0, "965GME/GLE",
+               &intel_845_driver, &intel_i965_driver },
+       { PCI_DEVICE_ID_INTEL_7505_0, 0, 0, "E7505", &intel_7505_driver, NULL },
+       { PCI_DEVICE_ID_INTEL_7205_0, 0, 0, "E7205", &intel_7505_driver, NULL },
+       { PCI_DEVICE_ID_INTEL_G33_HB, PCI_DEVICE_ID_INTEL_G33_IG, 0, "G33",
+               &intel_845_driver, &intel_g33_driver },
+       { PCI_DEVICE_ID_INTEL_Q35_HB, PCI_DEVICE_ID_INTEL_Q35_IG, 0, "Q35",
+               &intel_845_driver, &intel_g33_driver },
+       { PCI_DEVICE_ID_INTEL_Q33_HB, PCI_DEVICE_ID_INTEL_Q33_IG, 0, "Q33",
+               &intel_845_driver, &intel_g33_driver },
+       { 0, 0, 0, NULL, NULL, NULL }
+};
+
 static int __devinit agp_intel_probe(struct pci_dev *pdev,
                                     const struct pci_device_id *ent)
 {
        struct agp_bridge_data *bridge;
-       char *name = "(unknown)";
        u8 cap_ptr = 0;
        struct resource *r;
+       int i;
 
        cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP);
 
@@ -1764,195 +1889,46 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
        if (!bridge)
                return -ENOMEM;
 
-       switch (pdev->device) {
-       case PCI_DEVICE_ID_INTEL_82443LX_0:
-               bridge->driver = &intel_generic_driver;
-               name = "440LX";
-               break;
-       case PCI_DEVICE_ID_INTEL_82443BX_0:
-               bridge->driver = &intel_generic_driver;
-               name = "440BX";
-               break;
-       case PCI_DEVICE_ID_INTEL_82443GX_0:
-               bridge->driver = &intel_generic_driver;
-               name = "440GX";
-               break;
-       case PCI_DEVICE_ID_INTEL_82810_MC1:
-               name = "i810";
-               if (!find_i810(PCI_DEVICE_ID_INTEL_82810_IG1))
-                       goto fail;
-               bridge->driver = &intel_810_driver;
-               break;
-       case PCI_DEVICE_ID_INTEL_82810_MC3:
-               name = "i810 DC100";
-               if (!find_i810(PCI_DEVICE_ID_INTEL_82810_IG3))
-                       goto fail;
-               bridge->driver = &intel_810_driver;
-               break;
-       case PCI_DEVICE_ID_INTEL_82810E_MC:
-               name = "i810 E";
-               if (!find_i810(PCI_DEVICE_ID_INTEL_82810E_IG))
-                       goto fail;
-               bridge->driver = &intel_810_driver;
-               break;
-        case PCI_DEVICE_ID_INTEL_82815_MC:
-               /*
-                * The i815 can operate either as an i810 style
-                * integrated device, or as an AGP4X motherboard.
-                */
-               if (find_i810(PCI_DEVICE_ID_INTEL_82815_CGC))
-                       bridge->driver = &intel_810_driver;
-               else
-                       bridge->driver = &intel_815_driver;
-               name = "i815";
-               break;
-       case PCI_DEVICE_ID_INTEL_82820_HB:
-       case PCI_DEVICE_ID_INTEL_82820_UP_HB:
-               bridge->driver = &intel_820_driver;
-               name = "i820";
-               break;
-       case PCI_DEVICE_ID_INTEL_82830_HB:
-               if (find_i830(PCI_DEVICE_ID_INTEL_82830_CGC))
-                       bridge->driver = &intel_830_driver;
-               else
-                       bridge->driver = &intel_830mp_driver;
-               name = "830M";
-               break;
-       case PCI_DEVICE_ID_INTEL_82840_HB:
-               bridge->driver = &intel_840_driver;
-               name = "i840";
-               break;
-       case PCI_DEVICE_ID_INTEL_82845_HB:
-               bridge->driver = &intel_845_driver;
-               name = "i845";
-               break;
-       case PCI_DEVICE_ID_INTEL_82845G_HB:
-               if (find_i830(PCI_DEVICE_ID_INTEL_82845G_IG))
-                       bridge->driver = &intel_830_driver;
-               else
-                       bridge->driver = &intel_845_driver;
-               name = "845G";
-               break;
-       case PCI_DEVICE_ID_INTEL_82850_HB:
-               bridge->driver = &intel_850_driver;
-               name = "i850";
-               break;
-       case PCI_DEVICE_ID_INTEL_82855PM_HB:
-               bridge->driver = &intel_845_driver;
-               name = "855PM";
-               break;
-       case PCI_DEVICE_ID_INTEL_82855GM_HB:
-               if (find_i830(PCI_DEVICE_ID_INTEL_82855GM_IG)) {
-                       bridge->driver = &intel_830_driver;
-                       name = "855";
-               } else {
-                       bridge->driver = &intel_845_driver;
-                       name = "855GM";
+       for (i = 0; intel_agp_chipsets[i].name != NULL; i++) {
+               /* In case that multiple models of gfx chip may
+                  stand on same host bridge type, this can be
+                  sure we detect the right IGD. */
+               if (pdev->device == intel_agp_chipsets[i].chip_id) {
+                       if ((intel_agp_chipsets[i].gmch_chip_id != 0) &&
+                               find_gmch(intel_agp_chipsets[i].gmch_chip_id)) {
+                               bridge->driver =
+                                       intel_agp_chipsets[i].gmch_driver;
+                               break;
+                       } else if (intel_agp_chipsets[i].multi_gmch_chip) {
+                               continue;
+                       } else {
+                               bridge->driver = intel_agp_chipsets[i].driver;
+                               break;
+                       }
                }
-               break;
-       case PCI_DEVICE_ID_INTEL_82860_HB:
-               bridge->driver = &intel_860_driver;
-               name = "i860";
-               break;
-       case PCI_DEVICE_ID_INTEL_82865_HB:
-               if (find_i830(PCI_DEVICE_ID_INTEL_82865_IG))
-                       bridge->driver = &intel_830_driver;
-               else
-                       bridge->driver = &intel_845_driver;
-               name = "865";
-               break;
-       case PCI_DEVICE_ID_INTEL_82875_HB:
-               bridge->driver = &intel_845_driver;
-               name = "i875";
-               break;
-       case PCI_DEVICE_ID_INTEL_82915G_HB:
-               if (find_i830(PCI_DEVICE_ID_INTEL_82915G_IG))
-                       bridge->driver = &intel_915_driver;
-               else
-                       bridge->driver = &intel_845_driver;
-               name = "915G";
-               break;
-       case PCI_DEVICE_ID_INTEL_82915GM_HB:
-               if (find_i830(PCI_DEVICE_ID_INTEL_82915GM_IG))
-                       bridge->driver = &intel_915_driver;
-               else
-                       bridge->driver = &intel_845_driver;
-               name = "915GM";
-               break;
-       case PCI_DEVICE_ID_INTEL_82945G_HB:
-               if (find_i830(PCI_DEVICE_ID_INTEL_82945G_IG))
-                       bridge->driver = &intel_915_driver;
-               else
-                       bridge->driver = &intel_845_driver;
-               name = "945G";
-               break;
-       case PCI_DEVICE_ID_INTEL_82945GM_HB:
-               if (find_i830(PCI_DEVICE_ID_INTEL_82945GM_IG))
-                       bridge->driver = &intel_915_driver;
-               else
-                       bridge->driver = &intel_845_driver;
-               name = "945GM";
-               break;
-       case PCI_DEVICE_ID_INTEL_82946GZ_HB:
-               if (find_i830(PCI_DEVICE_ID_INTEL_82946GZ_IG))
-                       bridge->driver = &intel_i965_driver;
-               else
-                       bridge->driver = &intel_845_driver;
-               name = "946GZ";
-               break;
-       case PCI_DEVICE_ID_INTEL_82965G_1_HB:
-               if (find_i830(PCI_DEVICE_ID_INTEL_82965G_1_IG))
-                       bridge->driver = &intel_i965_driver;
-               else
-                       bridge->driver = &intel_845_driver;
-               name = "965G";
-               break;
-       case PCI_DEVICE_ID_INTEL_82965Q_HB:
-               if (find_i830(PCI_DEVICE_ID_INTEL_82965Q_IG))
-                       bridge->driver = &intel_i965_driver;
-               else
-                       bridge->driver = &intel_845_driver;
-               name = "965Q";
-               break;
-       case PCI_DEVICE_ID_INTEL_82965G_HB:
-               if (find_i830(PCI_DEVICE_ID_INTEL_82965G_IG))
-                       bridge->driver = &intel_i965_driver;
-               else
-                       bridge->driver = &intel_845_driver;
-               name = "965G";
-               break;
-       case PCI_DEVICE_ID_INTEL_82965GM_HB:
-               if (find_i830(PCI_DEVICE_ID_INTEL_82965GM_IG))
-                       bridge->driver = &intel_i965_driver;
-               else
-                       bridge->driver = &intel_845_driver;
-               name = "965GM";
-               break;
-       case PCI_DEVICE_ID_INTEL_7505_0:
-               bridge->driver = &intel_7505_driver;
-               name = "E7505";
-               break;
-       case PCI_DEVICE_ID_INTEL_7205_0:
-               bridge->driver = &intel_7505_driver;
-               name = "E7205";
-               break;
-       default:
+       }
+
+       if (intel_agp_chipsets[i].name == NULL) {
                if (cap_ptr)
-                       printk(KERN_WARNING PFX "Unsupported Intel chipset (device id: %04x)\n",
-                           pdev->device);
+                       printk(KERN_WARNING PFX "Unsupported Intel chipset"
+                               "(device id: %04x)\n", pdev->device);
+               agp_put_bridge(bridge);
+               return -ENODEV;
+       }
+
+       if (bridge->driver == NULL) {
+               printk(KERN_WARNING PFX "Failed to find bridge device "
+                       "(chip_id: %04x)\n", intel_agp_chipsets[i].gmch_chip_id);
                agp_put_bridge(bridge);
                return -ENODEV;
-       };
+        }
 
        bridge->dev = pdev;
        bridge->capndx = cap_ptr;
+       bridge->dev_private_data = &intel_private;
 
-       if (bridge->driver == &intel_810_driver)
-               bridge->dev_private_data = &intel_i810_private;
-       else if (bridge->driver == &intel_830_driver)
-               bridge->dev_private_data = &intel_i830_private;
-
-       printk(KERN_INFO PFX "Detected an Intel %s Chipset.\n", name);
+       printk(KERN_INFO PFX "Detected an Intel %s Chipset.\n",
+               intel_agp_chipsets[i].name);
 
        /*
        * The following fixes the case where the BIOS has "forgotten" to
@@ -1988,12 +1964,6 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
 
        pci_set_drvdata(pdev, bridge);
        return agp_add_bridge(bridge);
-
-fail:
-       printk(KERN_ERR PFX "Detected an Intel %s chipset, "
-               "but could not find the secondary device.\n", name);
-       agp_put_bridge(bridge);
-       return -ENODEV;
 }
 
 static void __devexit agp_intel_remove(struct pci_dev *pdev)
@@ -2002,10 +1972,8 @@ static void __devexit agp_intel_remove(struct pci_dev *pdev)
 
        agp_remove_bridge(bridge);
 
-       if (intel_i810_private.i810_dev)
-               pci_dev_put(intel_i810_private.i810_dev);
-       if (intel_i830_private.i830_dev)
-               pci_dev_put(intel_i830_private.i830_dev);
+       if (intel_private.pcidev)
+               pci_dev_put(intel_private.pcidev);
 
        agp_put_bridge(bridge);
 }
@@ -2021,10 +1989,8 @@ static int agp_intel_resume(struct pci_dev *pdev)
         * as host bridge (00:00) resumes before graphics device (02:00),
         * then our access to its pci space can work right.
         */
-       if (intel_i810_private.i810_dev)
-               pci_restore_state(intel_i810_private.i810_dev);
-       if (intel_i830_private.i830_dev)
-               pci_restore_state(intel_i830_private.i830_dev);
+       if (intel_private.pcidev)
+               pci_restore_state(intel_private.pcidev);
 
        if (bridge->driver == &intel_generic_driver)
                intel_configure();
@@ -2087,6 +2053,9 @@ static struct pci_device_id agp_intel_pci_table[] = {
        ID(PCI_DEVICE_ID_INTEL_82965Q_HB),
        ID(PCI_DEVICE_ID_INTEL_82965G_HB),
        ID(PCI_DEVICE_ID_INTEL_82965GM_HB),
+       ID(PCI_DEVICE_ID_INTEL_G33_HB),
+       ID(PCI_DEVICE_ID_INTEL_Q35_HB),
+       ID(PCI_DEVICE_ID_INTEL_Q33_HB),
        { }
 };
 
index 177ccc07f96821d02a305f29d7a499405e109d7f..aa6335032d1e8c808cf229104bd5c47c99060c58 100644 (file)
        {0x8086, 0x2592, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
        {0x8086, 0x2772, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
        {0x8086, 0x27a2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+       {0x8086, 0x27ae, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
        {0x8086, 0x2972, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
        {0x8086, 0x2982, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
        {0x8086, 0x2992, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
        {0x8086, 0x29a2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+       {0x8086, 0x29b2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+       {0x8086, 0x29c2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+       {0x8086, 0x29d2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
        {0x8086, 0x2a02, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+       {0x8086, 0x2a12, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
        {0, 0, 0}
 
index 1ba15d9a171ab469ac3ec99c368575feeaf7d7d2..ea52740af4f6d277da7df0977c24636c4a853acb 100644 (file)
                       dev->pci_device == 0x2982 || \
                       dev->pci_device == 0x2992 || \
                       dev->pci_device == 0x29A2 || \
-                      dev->pci_device == 0x2A02)
+                      dev->pci_device == 0x2A02 || \
+                      dev->pci_device == 0x2A12)
+
+#define IS_G33(dev) (dev->pci_device == 0x29b2 || \
+                    dev->pci_device == 0x29c2 || \
+                    dev->pci_device == 0x29d2)
 
 /* Really want an OS-independent resettable timer.  Would like to have
  * this loop run for (eg) 3 sec, but have the timer reset every time
@@ -106,6 +111,12 @@ static int i915_dma_cleanup(drm_device_t * dev)
                        I915_WRITE(0x02080, 0x1ffff000);
                }
 
+               if (dev_priv->status_gfx_addr) {
+                       dev_priv->status_gfx_addr = 0;
+                       drm_core_ioremapfree(&dev_priv->hws_map, dev);
+                       I915_WRITE(0x2080, 0x1ffff000);
+               }
+
                drm_free(dev->dev_private, sizeof(drm_i915_private_t),
                         DRM_MEM_DRIVER);
 
@@ -179,26 +190,24 @@ static int i915_initialize(drm_device_t * dev,
        dev_priv->allow_batchbuffer = 1;
 
        /* Program Hardware Status Page */
-       dev_priv->status_page_dmah = drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE,
-                                                  0xffffffff);
+       if (!IS_G33(dev)) {
+               dev_priv->status_page_dmah =
+                       drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE, 0xffffffff);
+
+               if (!dev_priv->status_page_dmah) {
+                       dev->dev_private = (void *)dev_priv;
+                       i915_dma_cleanup(dev);
+                       DRM_ERROR("Can not allocate hardware status page\n");
+                       return DRM_ERR(ENOMEM);
+               }
+               dev_priv->hw_status_page = dev_priv->status_page_dmah->vaddr;
+               dev_priv->dma_status_page = dev_priv->status_page_dmah->busaddr;
 
-       if (!dev_priv->status_page_dmah) {
-               dev->dev_private = (void *)dev_priv;
-               i915_dma_cleanup(dev);
-               DRM_ERROR("Can not allocate hardware status page\n");
-               return DRM_ERR(ENOMEM);
+               memset(dev_priv->hw_status_page, 0, PAGE_SIZE);
+               I915_WRITE(0x02080, dev_priv->dma_status_page);
        }
-       dev_priv->hw_status_page = dev_priv->status_page_dmah->vaddr;
-       dev_priv->dma_status_page = dev_priv->status_page_dmah->busaddr;
-
-       memset(dev_priv->hw_status_page, 0, PAGE_SIZE);
-       DRM_DEBUG("hw status page @ %p\n", dev_priv->hw_status_page);
-
-       I915_WRITE(0x02080, dev_priv->dma_status_page);
        DRM_DEBUG("Enabled hardware status page\n");
-
        dev->dev_private = (void *)dev_priv;
-
        return 0;
 }
 
@@ -231,7 +240,10 @@ static int i915_dma_resume(drm_device_t * dev)
        }
        DRM_DEBUG("hw status page @ %p\n", dev_priv->hw_status_page);
 
-       I915_WRITE(0x02080, dev_priv->dma_status_page);
+       if (dev_priv->status_gfx_addr != 0)
+               I915_WRITE(0x02080, dev_priv->status_gfx_addr);
+       else
+               I915_WRITE(0x02080, dev_priv->dma_status_page);
        DRM_DEBUG("Enabled hardware status page\n");
 
        return 0;
@@ -739,6 +751,47 @@ static int i915_setparam(DRM_IOCTL_ARGS)
        return 0;
 }
 
+static int i915_set_status_page(DRM_IOCTL_ARGS)
+{
+       DRM_DEVICE;
+       drm_i915_private_t *dev_priv = dev->dev_private;
+       drm_i915_hws_addr_t hws;
+
+       if (!dev_priv) {
+               DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
+               return DRM_ERR(EINVAL);
+       }
+       DRM_COPY_FROM_USER_IOCTL(hws, (drm_i915_hws_addr_t __user *) data,
+                       sizeof(hws));
+       printk(KERN_DEBUG "set status page addr 0x%08x\n", (u32)hws.addr);
+
+       dev_priv->status_gfx_addr = hws.addr & (0x1ffff<<12);
+
+       dev_priv->hws_map.offset = dev->agp->agp_info.aper_base + hws.addr;
+       dev_priv->hws_map.size = 4*1024;
+       dev_priv->hws_map.type = 0;
+       dev_priv->hws_map.flags = 0;
+       dev_priv->hws_map.mtrr = 0;
+
+       drm_core_ioremap(&dev_priv->hws_map, dev);
+       if (dev_priv->hws_map.handle == NULL) {
+               dev->dev_private = (void *)dev_priv;
+               i915_dma_cleanup(dev);
+               dev_priv->status_gfx_addr = 0;
+               DRM_ERROR("can not ioremap virtual address for"
+                               " G33 hw status page\n");
+               return DRM_ERR(ENOMEM);
+       }
+       dev_priv->hw_status_page = dev_priv->hws_map.handle;
+
+       memset(dev_priv->hw_status_page, 0, PAGE_SIZE);
+       I915_WRITE(0x02080, dev_priv->status_gfx_addr);
+       DRM_DEBUG("load hws 0x2080 with gfx mem 0x%x\n",
+                       dev_priv->status_gfx_addr);
+       DRM_DEBUG("load hws at %p\n", dev_priv->hw_status_page);
+       return 0;
+}
+
 int i915_driver_load(drm_device_t *dev, unsigned long flags)
 {
        /* i915 has 4 more counters */
@@ -785,6 +838,7 @@ drm_ioctl_desc_t i915_ioctls[] = {
        [DRM_IOCTL_NR(DRM_I915_SET_VBLANK_PIPE)] = { i915_vblank_pipe_set, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY },
        [DRM_IOCTL_NR(DRM_I915_GET_VBLANK_PIPE)] = { i915_vblank_pipe_get, DRM_AUTH },
        [DRM_IOCTL_NR(DRM_I915_VBLANK_SWAP)] = {i915_vblank_swap, DRM_AUTH},
+       [DRM_IOCTL_NR(DRM_I915_HWS_ADDR)] = {i915_set_status_page, DRM_AUTH},
 };
 
 int i915_max_ioctl = DRM_ARRAY_SIZE(i915_ioctls);
index 96a468886a7a6e07b6b95ef8685c8ff02226f3ac..7b7b68b96f31b851969e160fd4b52ecdf4bee050 100644 (file)
@@ -142,6 +142,7 @@ typedef struct _drm_i915_sarea {
 #define DRM_I915_SET_VBLANK_PIPE       0x0d
 #define DRM_I915_GET_VBLANK_PIPE       0x0e
 #define DRM_I915_VBLANK_SWAP   0x0f
+#define DRM_I915_HWS_ADDR      0x11
 
 #define DRM_IOCTL_I915_INIT            DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
 #define DRM_IOCTL_I915_FLUSH           DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
@@ -262,4 +263,8 @@ typedef struct drm_i915_vblank_swap {
        unsigned int sequence;
 } drm_i915_vblank_swap_t;
 
+typedef struct drm_i915_hws_addr {
+       uint64_t addr;
+} drm_i915_hws_addr_t;
+
 #endif                         /* _I915_DRM_H_ */
index 93cdcfe6aa84d6b4f7e121fd7e83ed0caf3ab0ea..85e323acb95d0e3238a4a85e9f863449b59a9dff 100644 (file)
@@ -91,6 +91,8 @@ typedef struct drm_i915_private {
        void *hw_status_page;
        dma_addr_t dma_status_page;
        unsigned long counter;
+       unsigned int status_gfx_addr;
+       drm_local_map_t hws_map;
 
        unsigned int cpp;
        int back_offset;
index 1f1f9cc055a437db9873005acb885eed2b7c9b87..56decda2a71ff20af100dde0dd959353be189c9e 100644 (file)
@@ -349,6 +349,36 @@ static int compat_radeon_irq_emit(struct file *file, unsigned int cmd,
                         DRM_IOCTL_RADEON_IRQ_EMIT, (unsigned long)request);
 }
 
+/* The two 64-bit arches where alignof(u64)==4 in 32-bit code */
+#if defined (CONFIG_X86_64) || defined(CONFIG_IA64)
+typedef struct drm_radeon_setparam32 {
+       int param;
+       u64 value;
+} __attribute__((packed)) drm_radeon_setparam32_t;
+
+static int compat_radeon_cp_setparam(struct file *file, unsigned int cmd,
+                                    unsigned long arg)
+{
+       drm_radeon_setparam32_t req32;
+       drm_radeon_setparam_t __user *request;
+
+       if (copy_from_user(&req32, (void __user *) arg, sizeof(req32)))
+               return -EFAULT;
+
+       request = compat_alloc_user_space(sizeof(*request));
+       if (!access_ok(VERIFY_WRITE, request, sizeof(*request))
+           || __put_user(req32.param, &request->param)
+           || __put_user((void __user *)(unsigned long)req32.value,
+                         &request->value))
+               return -EFAULT;
+
+       return drm_ioctl(file->f_dentry->d_inode, file,
+                        DRM_IOCTL_RADEON_SETPARAM, (unsigned long) request);
+}
+#else
+#define compat_radeon_cp_setparam NULL
+#endif /* X86_64 || IA64 */
+
 drm_ioctl_compat_t *radeon_compat_ioctls[] = {
        [DRM_RADEON_CP_INIT] = compat_radeon_cp_init,
        [DRM_RADEON_CLEAR] = compat_radeon_cp_clear,
@@ -357,6 +387,7 @@ drm_ioctl_compat_t *radeon_compat_ioctls[] = {
        [DRM_RADEON_VERTEX2] = compat_radeon_cp_vertex2,
        [DRM_RADEON_CMDBUF] = compat_radeon_cp_cmdbuf,
        [DRM_RADEON_GETPARAM] = compat_radeon_cp_getparam,
+       [DRM_RADEON_SETPARAM] = compat_radeon_cp_setparam,
        [DRM_RADEON_ALLOC] = compat_radeon_mem_alloc,
        [DRM_RADEON_IRQ_EMIT] = compat_radeon_irq_emit,
 };
index 0474cac4a84ed882e4bb92d825beb1afcb6db69f..7f5271272f91400b17d1ac928047d5d363c35be4 100644 (file)
@@ -794,7 +794,7 @@ static void extract_buf(struct entropy_store *r, __u8 *out)
 
        buf[0] ^= buf[3];
        buf[1] ^= buf[4];
-       buf[0] ^= rol32(buf[3], 16);
+       buf[2] ^= rol32(buf[2], 16);
        memcpy(out, buf, EXTRACT_SIZE);
        memset(buf, 0, sizeof(buf));
 }
index e45113a7a472f7f1035d3fd92b2909b237bd298b..45bf2a262a858c144c74388f271bfb13cb4e9b9a 100644 (file)
@@ -2172,11 +2172,12 @@ static int __devinit stl_initech(struct stlbrd *brdp)
                }
                status = inb(ioaddr + ECH_PNLSTATUS);
                if ((status & ECH_PNLIDMASK) != nxtid)
-                       goto err_fr;
+                       break;
                panelp = kzalloc(sizeof(struct stlpanel), GFP_KERNEL);
                if (!panelp) {
                        printk("STALLION: failed to allocate memory "
                                "(size=%Zd)\n", sizeof(struct stlpanel));
+                       retval = -ENOMEM;
                        goto err_fr;
                }
                panelp->magic = STL_PANELMAGIC;
@@ -2223,8 +2224,10 @@ static int __devinit stl_initech(struct stlbrd *brdp)
                brdp->nrports += panelp->nrports;
                brdp->panels[panelnr++] = panelp;
                if ((brdp->brdtype != BRD_ECHPCI) &&
-                   (ioaddr >= (brdp->ioaddr2 + brdp->iosize2)))
+                   (ioaddr >= (brdp->ioaddr2 + brdp->iosize2))) {
+                       retval = -EINVAL;
                        goto err_fr;
+               }
        }
 
        brdp->nrpanels = panelnr;
@@ -2371,6 +2374,7 @@ static int __devinit stl_pciprobe(struct pci_dev *pdev,
                dev_err(&pdev->dev, "too many boards found, "
                        "maximum supported %d\n", STL_MAXBRDS);
                mutex_unlock(&stl_brdslock);
+               retval = -ENODEV;
                goto err_fr;
        }
        brdp->brdnr = (unsigned int)brdnr;
@@ -4710,6 +4714,29 @@ static int __init stallion_module_init(void)
        spin_lock_init(&stallion_lock);
        spin_lock_init(&brd_lock);
 
+       stl_serial = alloc_tty_driver(STL_MAXBRDS * STL_MAXPORTS);
+       if (!stl_serial) {
+               retval = -ENOMEM;
+               goto err;
+       }
+
+       stl_serial->owner = THIS_MODULE;
+       stl_serial->driver_name = stl_drvname;
+       stl_serial->name = "ttyE";
+       stl_serial->major = STL_SERIALMAJOR;
+       stl_serial->minor_start = 0;
+       stl_serial->type = TTY_DRIVER_TYPE_SERIAL;
+       stl_serial->subtype = SERIAL_TYPE_NORMAL;
+       stl_serial->init_termios = stl_deftermios;
+       stl_serial->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
+       tty_set_operations(stl_serial, &stl_ops);
+
+       retval = tty_register_driver(stl_serial);
+       if (retval) {
+               printk("STALLION: failed to register serial driver\n");
+               goto err_frtty;
+       }
+
 /*
  *     Find any dynamically supported boards. That is via module load
  *     line options.
@@ -4739,13 +4766,9 @@ static int __init stallion_module_init(void)
 
        /* this has to be _after_ isa finding because of locking */
        retval = pci_register_driver(&stl_pcidriver);
-       if (retval && stl_nrbrds == 0)
-               goto err;
-
-       stl_serial = alloc_tty_driver(STL_MAXBRDS * STL_MAXPORTS);
-       if (!stl_serial) {
-               retval = -ENOMEM;
-               goto err_pcidr;
+       if (retval && stl_nrbrds == 0) {
+               printk(KERN_ERR "STALLION: can't register pci driver\n");
+               goto err_unrtty;
        }
 
 /*
@@ -4756,43 +4779,18 @@ static int __init stallion_module_init(void)
                printk("STALLION: failed to register serial board device\n");
 
        stallion_class = class_create(THIS_MODULE, "staliomem");
-       if (IS_ERR(stallion_class)) {
-               retval = PTR_ERR(stallion_class);
-               goto err_reg;
-       }
+       if (IS_ERR(stallion_class))
+               printk("STALLION: failed to create class\n");
        for (i = 0; i < 4; i++)
                class_device_create(stallion_class, NULL,
                                    MKDEV(STL_SIOMEMMAJOR, i), NULL,
                                    "staliomem%d", i);
 
-       stl_serial->owner = THIS_MODULE;
-       stl_serial->driver_name = stl_drvname;
-       stl_serial->name = "ttyE";
-       stl_serial->major = STL_SERIALMAJOR;
-       stl_serial->minor_start = 0;
-       stl_serial->type = TTY_DRIVER_TYPE_SERIAL;
-       stl_serial->subtype = SERIAL_TYPE_NORMAL;
-       stl_serial->init_termios = stl_deftermios;
-       stl_serial->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
-       tty_set_operations(stl_serial, &stl_ops);
-
-       retval = tty_register_driver(stl_serial);
-       if (retval) {
-               printk("STALLION: failed to register serial driver\n");
-               goto err_clsdev;
-       }
-
        return 0;
-err_clsdev:
-       for (i = 0; i < 4; i++)
-               class_device_destroy(stallion_class, MKDEV(STL_SIOMEMMAJOR, i));
-       class_destroy(stallion_class);
-err_reg:
-       unregister_chrdev(STL_SIOMEMMAJOR, "staliomem");
+err_unrtty:
+       tty_unregister_driver(stl_serial);
+err_frtty:
        put_tty_driver(stl_serial);
-err_pcidr:
-       pci_unregister_driver(&stl_pcidriver);
-       stl_free_isabrds();
 err:
        return retval;
 }
@@ -4821,8 +4819,6 @@ static void __exit stallion_module_exit(void)
                        tty_unregister_device(stl_serial,
                                brdp->brdnr * STL_MAXPORTS + j);
        }
-       tty_unregister_driver(stl_serial);
-       put_tty_driver(stl_serial);
 
        for (i = 0; i < 4; i++)
                class_device_destroy(stallion_class, MKDEV(STL_SIOMEMMAJOR, i));
@@ -4834,6 +4830,9 @@ static void __exit stallion_module_exit(void)
        pci_unregister_driver(&stl_pcidriver);
 
        stl_free_isabrds();
+
+       tty_unregister_driver(stl_serial);
+       put_tty_driver(stl_serial);
 }
 
 module_init(stallion_module_init);
index 3752edc30c366c7940812fb25c2569c7f88d3b79..a96f26a63fa2e6e54b98ed898dcda2488ac64d25 100644 (file)
@@ -1173,8 +1173,14 @@ static unsigned int hung_up_tty_poll(struct file * filp, poll_table * wait)
        return POLLIN | POLLOUT | POLLERR | POLLHUP | POLLRDNORM | POLLWRNORM;
 }
 
-static long hung_up_tty_ioctl(struct file * file,
-                             unsigned int cmd, unsigned long arg)
+static int hung_up_tty_ioctl(struct inode * inode, struct file * file,
+                            unsigned int cmd, unsigned long arg)
+{
+       return cmd == TIOCSPGRP ? -ENOTTY : -EIO;
+}
+
+static long hung_up_tty_compat_ioctl(struct file * file,
+                                    unsigned int cmd, unsigned long arg)
 {
        return cmd == TIOCSPGRP ? -ENOTTY : -EIO;
 }
@@ -1222,8 +1228,8 @@ static const struct file_operations hung_up_tty_fops = {
        .read           = hung_up_tty_read,
        .write          = hung_up_tty_write,
        .poll           = hung_up_tty_poll,
-       .unlocked_ioctl = hung_up_tty_ioctl,
-       .compat_ioctl   = hung_up_tty_ioctl,
+       .ioctl          = hung_up_tty_ioctl,
+       .compat_ioctl   = hung_up_tty_compat_ioctl,
        .release        = tty_release,
 };
 
index 7fff773f2df77ece16e19644346c771b6864516b..dc2175c81f5efe5c955729efd5b23b22c612d48e 100644 (file)
@@ -1037,6 +1037,17 @@ static void ide_disk_release(struct kref *kref)
 
 static int ide_disk_probe(ide_drive_t *drive);
 
+/*
+ * On HPA drives the capacity needs to be
+ * reinitilized on resume otherwise the disk
+ * can not be used and a hard reset is required
+ */
+static void ide_disk_resume(ide_drive_t *drive)
+{
+       if (idedisk_supports_hpa(drive->id))
+               init_idedisk_capacity(drive);
+}
+
 static void ide_device_shutdown(ide_drive_t *drive)
 {
 #ifdef CONFIG_ALPHA
@@ -1071,6 +1082,7 @@ static ide_driver_t idedisk_driver = {
        },
        .probe                  = ide_disk_probe,
        .remove                 = ide_disk_remove,
+       .resume                 = ide_disk_resume,
        .shutdown               = ide_device_shutdown,
        .version                = IDEDISK_VERSION,
        .media                  = ide_disk,
index 3cebed77f55d27020b8be9b4331571cd80e00844..41bfa4d21ab65352afdf489782b0441a1fc40bfb 100644 (file)
@@ -717,7 +717,7 @@ EXPORT_SYMBOL_GPL(ide_undecoded_slave);
  * This routine only knows how to look for drive units 0 and 1
  * on an interface, so any setting of MAX_DRIVES > 2 won't work here.
  */
-static void probe_hwif(ide_hwif_t *hwif)
+static void probe_hwif(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif))
 {
        unsigned int unit;
        unsigned long flags;
@@ -820,6 +820,9 @@ static void probe_hwif(ide_hwif_t *hwif)
                return;
        }
 
+       if (fixup)
+               fixup(hwif);
+
        for (unit = 0; unit < MAX_DRIVES; ++unit) {
                ide_drive_t *drive = &hwif->drives[unit];
 
@@ -874,10 +877,7 @@ static int hwif_init(ide_hwif_t *hwif);
 
 int probe_hwif_init_with_fixup(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif))
 {
-       probe_hwif(hwif);
-
-       if (fixup)
-               fixup(hwif);
+       probe_hwif(hwif, fixup);
 
        if (!hwif_init(hwif)) {
                printk(KERN_INFO "%s: failed to initialize IDE interface\n",
@@ -1404,7 +1404,7 @@ int ideprobe_init (void)
 
        for (index = 0; index < MAX_HWIFS; ++index)
                if (probe[index])
-                       probe_hwif(&ide_hwifs[index]);
+                       probe_hwif(&ide_hwifs[index], NULL);
        for (index = 0; index < MAX_HWIFS; ++index)
                if (probe[index])
                        hwif_init(&ide_hwifs[index]);
index 6002713a20a1bdfbcf9f7e2a3f000d491baa6802..0cd76bf66833aa1afedc47715fc9271d5a85145d 100644 (file)
@@ -1013,6 +1013,7 @@ static int generic_ide_resume(struct device *dev)
        struct request rq;
        struct request_pm_state rqpm;
        ide_task_t args;
+       int err;
 
        /* Call ACPI _STM only once */
        if (!(drive->dn % 2))
@@ -1029,7 +1030,16 @@ static int generic_ide_resume(struct device *dev)
        rqpm.pm_step = ide_pm_state_start_resume;
        rqpm.pm_state = PM_EVENT_ON;
 
-       return ide_do_drive_cmd(drive, &rq, ide_head_wait);
+       err = ide_do_drive_cmd(drive, &rq, ide_head_wait);
+
+       if (err == 0 && dev->driver) {
+               ide_driver_t *drv = to_ide_driver(dev->driver);
+
+               if (drv->resume)
+                       drv->resume(drive);
+       }
+
+       return err;
 }
 
 int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device *bdev,
index becb1a5648b0858643a8da7846cec022b82fd522..9db1be826e8018b70467ec59159bae927254e246 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Version 2.13
+ * Version 2.15
  *
  * AMD 755/756/766/8111 and nVidia nForce/2/2s/3/3s/CK804/MCP04
  * IDE driver for Linux.
@@ -76,6 +76,8 @@ static struct amd_ide_chip {
        { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE,        0x50, AMD_UDMA_133 },
        { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_IDE,        0x50, AMD_UDMA_133 },
        { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE,        0x50, AMD_UDMA_133 },
+       { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE,        0x50, AMD_UDMA_133 },
+       { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE,        0x50, AMD_UDMA_133 },
        { PCI_DEVICE_ID_AMD_CS5536_IDE,                 0x40, AMD_UDMA_100 },
        { 0 }
 };
@@ -494,7 +496,9 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = {
        /* 17 */ DECLARE_NV_DEV("NFORCE-MCP61"),
        /* 18 */ DECLARE_NV_DEV("NFORCE-MCP65"),
        /* 19 */ DECLARE_NV_DEV("NFORCE-MCP67"),
-       /* 20 */ DECLARE_AMD_DEV("AMD5536"),
+       /* 20 */ DECLARE_NV_DEV("NFORCE-MCP73"),
+       /* 21 */ DECLARE_NV_DEV("NFORCE-MCP77"),
+       /* 22 */ DECLARE_AMD_DEV("AMD5536"),
 };
 
 static int __devinit amd74xx_probe(struct pci_dev *dev, const struct pci_device_id *id)
@@ -534,7 +538,9 @@ static struct pci_device_id amd74xx_pci_tbl[] = {
        { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE,  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 17 },
        { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_IDE,  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 18 },
        { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE,  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 19 },
-       { PCI_VENDOR_ID_AMD,    PCI_DEVICE_ID_AMD_CS5536_IDE,           PCI_ANY_ID, PCI_ANY_ID, 0, 0, 20 },
+       { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE,  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 20 },
+       { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE,  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 21 },
+       { PCI_VENDOR_ID_AMD,    PCI_DEVICE_ID_AMD_CS5536_IDE,           PCI_ANY_ID, PCI_ANY_ID, 0, 0, 22 },
        { 0, },
 };
 MODULE_DEVICE_TABLE(pci, amd74xx_pci_tbl);
index f2c5a141ca10ca1927a03abea7b8e4e01ce0a1ba..0d51a11e81da6edc8342ef33928a49b5740af8ec 100644 (file)
@@ -198,32 +198,41 @@ static ide_pci_device_t generic_chipsets[] __devinitdata = {
 static int __devinit generic_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 {
        ide_pci_device_t *d = &generic_chipsets[id->driver_data];
-       u16 command;
        int ret = -ENODEV;
 
        /* Don't use the generic entry unless instructed to do so */
        if (id->driver_data == 0 && ide_generic_all == 0)
                        goto out;
 
-       if (dev->vendor == PCI_VENDOR_ID_UMC &&
-           dev->device == PCI_DEVICE_ID_UMC_UM8886A &&
-           (!(PCI_FUNC(dev->devfn) & 1)))
-               goto out; /* UM8886A/BF pair */
-
-       if (dev->vendor == PCI_VENDOR_ID_OPTI &&
-           dev->device == PCI_DEVICE_ID_OPTI_82C558 &&
-           (!(PCI_FUNC(dev->devfn) & 1)))
-               goto out;
-
-       if (dev->vendor == PCI_VENDOR_ID_JMICRON) {
-               if (dev->device != PCI_DEVICE_ID_JMICRON_JMB368 && PCI_FUNC(dev->devfn) != 1)
+       switch (dev->vendor) {
+       case PCI_VENDOR_ID_UMC:
+               if (dev->device == PCI_DEVICE_ID_UMC_UM8886A &&
+                               !(PCI_FUNC(dev->devfn) & 1))
+                       goto out; /* UM8886A/BF pair */
+               break;
+       case PCI_VENDOR_ID_OPTI:
+               if (dev->device == PCI_DEVICE_ID_OPTI_82C558 &&
+                               !(PCI_FUNC(dev->devfn) & 1))
+                       goto out;
+               break;
+       case PCI_VENDOR_ID_JMICRON:
+               if (dev->device != PCI_DEVICE_ID_JMICRON_JMB368 &&
+                               PCI_FUNC(dev->devfn) != 1)
+                       goto out;
+               break;
+       case PCI_VENDOR_ID_NS:
+               if (dev->device == PCI_DEVICE_ID_NS_87410 &&
+                               (dev->class >> 8) != PCI_CLASS_STORAGE_IDE)
                        goto out;
+               break;
        }
 
        if (dev->vendor != PCI_VENDOR_ID_JMICRON) {
+               u16 command;
                pci_read_config_word(dev, PCI_COMMAND, &command);
                if (!(command & PCI_COMMAND_IO)) {
-                       printk(KERN_INFO "Skipping disabled %s IDE controller.\n", d->name);
+                       printk(KERN_INFO "Skipping disabled %s IDE "
+                                       "controller.\n", d->name);
                        goto out;
                }
        }
index fcbc5605b38ef28210d11bdf7f33051bad56312d..ce8a5449a5749d3ae99b6c6e04a263b808e0511e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * linux/drivers/ide/pci/hpt366.c              Version 1.03    May 4, 2007
+ * linux/drivers/ide/pci/hpt366.c              Version 1.04    Jun 4, 2007
  *
  * Copyright (C) 1999-2003             Andre Hedrick <andre@linux-ide.org>
  * Portions Copyright (C) 2001         Sun Microsystems, Inc.
  *   switch  to calculating  PCI clock frequency based on the chip's base DPLL
  *   frequency
  * - switch to using the  DPLL clock and enable UltraATA/133 mode by default on
- *   anything  newer than HPT370/A
+ *   anything  newer than HPT370/A (except HPT374 that is not capable of this
+ *   mode according to the manual)
  * - fold PCI clock detection and DPLL setup code into init_chipset_hpt366(),
  *   also fixing the interchanged 25/40 MHz PCI clock cases for HPT36x chips;
  *   unify HPT36x/37x timing setup code and the speedproc handlers by joining
@@ -365,7 +366,6 @@ static u32 sixty_six_base_hpt37x[] = {
 };
 
 #define HPT366_DEBUG_DRIVE_INFO                0
-#define HPT374_ALLOW_ATA133_6          1
 #define HPT371_ALLOW_ATA133_6          1
 #define HPT302_ALLOW_ATA133_6          1
 #define HPT372_ALLOW_ATA133_6          1
@@ -450,7 +450,7 @@ static struct hpt_info hpt370a __devinitdata = {
 
 static struct hpt_info hpt374 __devinitdata = {
        .chip_type      = HPT374,
-       .max_mode       = HPT374_ALLOW_ATA133_6 ? 4 : 3,
+       .max_mode       = 3,
        .dpll_clk       = 48,
        .settings       = hpt37x_settings
 };
index 5faaff87d58077047bbcfad8b336a58a3d3f4385..4bd4bf02e917a8ca64a6a7b7f3c99d1c5797a9bf 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * linux/drivers/ide/pci/it821x.c              Version 0.10    Mar 10 2007
+ * linux/drivers/ide/pci/it821x.c              Version 0.15    Jun 2 2007
  *
  * Copyright (C) 2004          Red Hat <alan@redhat.com>
  * Copyright (C) 2007          Bartlomiej Zolnierkiewicz
@@ -262,7 +262,7 @@ static int it821x_tunepio(ide_drive_t *drive, u8 set_pio)
        }
 
        if (itdev->smart)
-               goto set_drive_speed;
+               return 0;
 
        /* We prefer 66Mhz clock for PIO 0-3, don't care for PIO4 */
        itdev->want[unit][1] = pio_want[set_pio];
@@ -271,7 +271,6 @@ static int it821x_tunepio(ide_drive_t *drive, u8 set_pio)
        it821x_clock_strategy(drive);
        it821x_program(drive, itdev->pio[unit]);
 
-set_drive_speed:
        return ide_config_drive_speed(drive, XFER_PIO_0 + set_pio);
 }
 
@@ -455,12 +454,12 @@ static int it821x_tune_chipset (ide_drive_t *drive, byte xferspeed)
                        default:
                                return 1;
                }
+
+               return ide_config_drive_speed(drive, speed);
        }
-       /*
-        *      In smart mode the clocking is done by the host controller
-        *      snooping the mode we picked. The rest of it is not our problem
-        */
-       return ide_config_drive_speed(drive, speed);
+
+       /* don't touch anything in the smart mode */
+       return 0;
 }
 
 /**
@@ -559,17 +558,10 @@ static void __devinit it821x_fixups(ide_hwif_t *hwif)
                                if(idbits[129] != 1)
                                        printk("(%dK stripe)", idbits[146]);
                                printk(".\n");
-                       /* Now the core code will have wrongly decided no DMA
-                          so we need to fix this */
-                       hwif->dma_off_quietly(drive);
-#ifdef CONFIG_IDEDMA_ONLYDISK
-                       if (drive->media == ide_disk)
-#endif
-                               ide_set_dma(drive);
                } else {
                        /* Non RAID volume. Fixups to stop the core code
                           doing unsupported things */
-                       id->field_valid &= 1;
+                       id->field_valid &= 3;
                        id->queue_depth = 0;
                        id->command_set_1 = 0;
                        id->command_set_2 &= 0xC400;
@@ -584,6 +576,16 @@ static void __devinit it821x_fixups(ide_hwif_t *hwif)
                        printk(KERN_INFO "%s: Performing identify fixups.\n",
                                drive->name);
                }
+
+               /*
+                * Set MWDMA0 mode as enabled/support - just to tell
+                * IDE core that DMA is supported (it821x hardware
+                * takes care of DMA mode programming).
+                */
+               if (id->capability & 1) {
+                       id->dma_mword |= 0x0101;
+                       drive->current_speed = XFER_MW_DMA_0;
+               }
        }
 
 }
index 47bcd91c9b5f50e5434667ee32db50afaddd76e5..d9c4fd1ae9969784144f10d073c7d078b490bbc6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * linux/drivers/ide/pci/serverworks.c         Version 0.9     Mar 4 2007
+ * linux/drivers/ide/pci/serverworks.c         Version 0.11    Jun 2 2007
  *
  * Copyright (C) 1998-2000 Michel Aubry
  * Copyright (C) 1998-2000 Andrzej Krzysztofowicz
@@ -170,42 +170,55 @@ static int svwks_tune_chipset (ide_drive_t *drive, u8 xferspeed)
                if (!drive->init_speed) {
                        u8 dma_stat = inb(hwif->dma_status);
 
-dma_pio:
                        if (((ultra_enable << (7-drive->dn) & 0x80) == 0x80) &&
                            ((dma_stat & (1<<(5+unit))) == (1<<(5+unit)))) {
                                drive->current_speed = drive->init_speed = XFER_UDMA_0 + udma_modes[(ultra_timing >> (4*unit)) & ~(0xF0)];
                                return 0;
                        } else if ((dma_timing) &&
                                   ((dma_stat&(1<<(5+unit)))==(1<<(5+unit)))) {
-                               u8 dmaspeed = dma_timing;
+                               u8 dmaspeed;
 
-                               dma_timing &= ~0xFFU;
-                               if ((dmaspeed & 0x20) == 0x20)
+                               switch (dma_timing & 0x77) {
+                               case 0x20:
                                        dmaspeed = XFER_MW_DMA_2;
-                               else if ((dmaspeed & 0x21) == 0x21)
+                                       break;
+                               case 0x21:
                                        dmaspeed = XFER_MW_DMA_1;
-                               else if ((dmaspeed & 0x77) == 0x77)
+                                       break;
+                               case 0x77:
                                        dmaspeed = XFER_MW_DMA_0;
-                               else
+                                       break;
+                               default:
                                        goto dma_pio;
+                               }
+
                                drive->current_speed = drive->init_speed = dmaspeed;
                                return 0;
-                       } else if (pio_timing) {
-                               u8 piospeed = pio_timing;
+                       }
+dma_pio:
+                       if (pio_timing) {
+                               u8 piospeed;
 
-                               pio_timing &= ~0xFFU;
-                               if ((piospeed & 0x20) == 0x20)
+                               switch (pio_timing & 0x7f) {
+                               case 0x20:
                                        piospeed = XFER_PIO_4;
-                               else if ((piospeed & 0x22) == 0x22)
+                                       break;
+                               case 0x22:
                                        piospeed = XFER_PIO_3;
-                               else if ((piospeed & 0x34) == 0x34)
+                                       break;
+                               case 0x34:
                                        piospeed = XFER_PIO_2;
-                               else if ((piospeed & 0x47) == 0x47)
+                                       break;
+                               case 0x47:
                                        piospeed = XFER_PIO_1;
-                               else if ((piospeed & 0x5d) == 0x5d)
+                                       break;
+                               case 0x5d:
                                        piospeed = XFER_PIO_0;
-                               else
+                                       break;
+                               default:
                                        goto oem_setup_failed;
+                               }
+
                                drive->current_speed = drive->init_speed = piospeed;
                                return 0;
                        }
@@ -214,8 +227,8 @@ dma_pio:
 
 oem_setup_failed:
 
-       pio_timing      &= ~0xFFU;
-       dma_timing      &= ~0xFFU;
+       pio_timing      = 0;
+       dma_timing      = 0;
        ultra_timing    &= ~(0x0F << (4*unit));
        ultra_enable    &= ~(0x01 << drive->dn);
        csb5_pio        &= ~(0x0F << (4*drive->dn));
index 2eb52b7a71da0b7d3a381c3c389e2d57b67b4cae..32a0e66d2a235215bece711619ae36003660142d 100644 (file)
@@ -2773,8 +2773,8 @@ static int cma_init(void)
        int ret;
 
        get_random_bytes(&next_port, sizeof next_port);
-       next_port = (next_port % (sysctl_local_port_range[1] -
-                                 sysctl_local_port_range[0])) +
+       next_port = ((unsigned int) next_port %
+                   (sysctl_local_port_range[1] - sysctl_local_port_range[0])) +
                    sysctl_local_port_range[0];
        cma_wq = create_singlethread_workqueue("rdma_cm");
        if (!cma_wq)
index 58bc272bd407273d18416c00afb35a9e51c086d2..0aecea67f3e69cb6339dfe5d6f29679eb36285e7 100644 (file)
@@ -672,7 +672,7 @@ static int c2_up(struct net_device *netdev)
         * rdma interface.
         */
        in_dev = in_dev_get(netdev);
-       in_dev->cnf.arp_ignore = 1;
+       IN_DEV_CONF_SET(in_dev, ARP_IGNORE, 1);
        in_dev_put(in_dev);
 
        return 0;
index dc137dec2308028c1341ce3de9c3892d0f06d172..5c6d05427a0f004ca26ea80cace4dd33c30cdad7 100644 (file)
@@ -189,18 +189,28 @@ static int send_wqe_overhead(enum ib_qp_type type)
 }
 
 static int set_rq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap,
-                      struct mlx4_ib_qp *qp)
+                      int is_user, int has_srq, struct mlx4_ib_qp *qp)
 {
        /* Sanity check RQ size before proceeding */
        if (cap->max_recv_wr  > dev->dev->caps.max_wqes  ||
            cap->max_recv_sge > dev->dev->caps.max_rq_sg)
                return -EINVAL;
 
-       qp->rq.max = cap->max_recv_wr ? roundup_pow_of_two(cap->max_recv_wr) : 0;
+       if (has_srq) {
+               /* QPs attached to an SRQ should have no RQ */
+               if (cap->max_recv_wr)
+                       return -EINVAL;
+
+               qp->rq.max = qp->rq.max_gs = 0;
+       } else {
+               /* HW requires >= 1 RQ entry with >= 1 gather entry */
+               if (is_user && (!cap->max_recv_wr || !cap->max_recv_sge))
+                       return -EINVAL;
 
-       qp->rq.wqe_shift = ilog2(roundup_pow_of_two(cap->max_recv_sge *
-                                                   sizeof (struct mlx4_wqe_data_seg)));
-       qp->rq.max_gs    = (1 << qp->rq.wqe_shift) / sizeof (struct mlx4_wqe_data_seg);
+               qp->rq.max       = roundup_pow_of_two(max(1, cap->max_recv_wr));
+               qp->rq.max_gs    = roundup_pow_of_two(max(1, cap->max_recv_sge));
+               qp->rq.wqe_shift = ilog2(qp->rq.max_gs * sizeof (struct mlx4_wqe_data_seg));
+       }
 
        cap->max_recv_wr  = qp->rq.max;
        cap->max_recv_sge = qp->rq.max_gs;
@@ -285,7 +295,7 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd,
        qp->sq.head         = 0;
        qp->sq.tail         = 0;
 
-       err = set_rq_size(dev, &init_attr->cap, qp);
+       err = set_rq_size(dev, &init_attr->cap, !!pd->uobject, !!init_attr->srq, qp);
        if (err)
                goto err;
 
@@ -762,11 +772,6 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp,
                optpar |= MLX4_QP_OPTPAR_PKEY_INDEX;
        }
 
-       if (attr_mask & IB_QP_RNR_RETRY) {
-               context->params1 |= cpu_to_be32(attr->rnr_retry << 13);
-               optpar |= MLX4_QP_OPTPAR_RNR_RETRY;
-       }
-
        if (attr_mask & IB_QP_AV) {
                if (mlx4_set_path(dev, &attr->ah_attr, &context->pri_path,
                                  attr_mask & IB_QP_PORT ? attr->port_num : qp->port)) {
@@ -802,6 +807,12 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp,
 
        context->pd         = cpu_to_be32(to_mpd(ibqp->pd)->pdn);
        context->params1    = cpu_to_be32(MLX4_IB_ACK_REQ_FREQ << 28);
+
+       if (attr_mask & IB_QP_RNR_RETRY) {
+               context->params1 |= cpu_to_be32(attr->rnr_retry << 13);
+               optpar |= MLX4_QP_OPTPAR_RNR_RETRY;
+       }
+
        if (attr_mask & IB_QP_RETRY_CNT) {
                context->params1 |= cpu_to_be32(attr->retry_cnt << 16);
                optpar |= MLX4_QP_OPTPAR_RETRY_COUNT;
index 38102520ffb376f320768d4e816f46f58ccbe6e3..f40558d7647539414e7350c24d1bfcf539f75263 100644 (file)
@@ -772,7 +772,7 @@ int mthca_QUERY_FW(struct mthca_dev *dev, u8 *status)
 
        MTHCA_GET(dev->fw_ver,   outbox, QUERY_FW_VER_OFFSET);
        /*
-        * FW subminor version is at more signifant bits than minor
+        * FW subminor version is at more significant bits than minor
         * version, so swap here.
         */
        dev->fw_ver = (dev->fw_ver & 0xffff00000000ull) |
index f814fb3a469d4d181dddea4107015e7ee2c49177..2d87357e2b2b5fa38217201fa5ea900f11afe6c8 100644 (file)
@@ -39,6 +39,19 @@ config INPUT_FF_MEMLESS
          To compile this driver as a module, choose M here: the
          module will be called ff-memless.
 
+config INPUT_POLLDEV
+       tristate "Polled input device skeleton"
+       help
+         Say Y here if you are using a driver for an input
+         device that periodically polls hardware state. This
+         option is only useful for out-of-tree drivers since
+         in-tree drivers select it automatically.
+
+         If unsure, say N.
+
+         To compile this driver as a module, choose M here: the
+         module will be called input-polldev.
+
 comment "Userland interfaces"
 
 config INPUT_MOUSEDEV
index 8a2dd987546c3c86a4587d9e6de9cb6862a7e3d4..15eb752697b37d691e57adec9d5a805ad00265e2 100644 (file)
@@ -8,6 +8,7 @@ obj-$(CONFIG_INPUT)             += input-core.o
 input-core-objs := input.o ff-core.o
 
 obj-$(CONFIG_INPUT_FF_MEMLESS) += ff-memless.o
+obj-$(CONFIG_INPUT_POLLDEV)    += input-polldev.o
 
 obj-$(CONFIG_INPUT_MOUSEDEV)   += mousedev.o
 obj-$(CONFIG_INPUT_JOYDEV)     += joydev.o
index 06eaf766d9d2fc2ff9026598bb15ccbc847520b7..f9e82c9ca42191142dcab70ed8493072bc049d39 100644 (file)
@@ -104,7 +104,7 @@ static int pxakbd_open(struct input_dev *dev)
        KPREC = 0x7F;
 
        /* Enable unit clock */
-       pxa_set_cken(CKEN19_KEYPAD, 1);
+       pxa_set_cken(CKEN_KEYPAD, 1);
 
        return 0;
 }
@@ -112,7 +112,7 @@ static int pxakbd_open(struct input_dev *dev)
 static void pxakbd_close(struct input_dev *dev)
 {
        /* Disable clock unit */
-       pxa_set_cken(CKEN19_KEYPAD, 0);
+       pxa_set_cken(CKEN_KEYPAD, 0);
 }
 
 #ifdef CONFIG_PM
@@ -185,7 +185,7 @@ static int __devinit pxakbd_probe(struct platform_device *pdev)
                            DRIVER_NAME, pdev);
        if (error) {
                printk(KERN_ERR "Cannot request keypad IRQ\n");
-               pxa_set_cken(CKEN19_KEYPAD, 0);
+               pxa_set_cken(CKEN_KEYPAD, 0);
                goto err_free_dev;
        }
 
index 842a7b4d16f8c733dc19177edf3ea39176baf0d7..88e29074ac901c461aa687c995c3f58ae4fa353c 100644 (file)
@@ -170,17 +170,6 @@ config INPUT_UINPUT
          To compile this driver as a module, choose M here: the
          module will be called uinput.
 
-config INPUT_POLLDEV
-       tristate "Polled input device skeleton"
-       help
-         Say Y here if you are using a driver for an input
-         device that periodically polls hardware state. This
-         option is only useful for out-of-tree drivers since
-         in-tree drivers select it automatically.
-
-         To compile this driver as a module, choose M here: the
-         module will be called input-polldev.
-
 config HP_SDC_RTC
        tristate "HP SDC Real Time Clock"
        depends on GSC || HP300
index 8b2f7799e25c98e2e33668b6cdfb6d0299c796ce..3585b503841868e34349c08f4d5844b9125731ff 100644 (file)
@@ -4,7 +4,6 @@
 
 # Each configuration option enables a list of files.
 
-obj-$(CONFIG_INPUT_POLLDEV)            += input-polldev.o
 obj-$(CONFIG_INPUT_SPARCSPKR)          += sparcspkr.o
 obj-$(CONFIG_INPUT_PCSPKR)             += pcspkr.o
 obj-$(CONFIG_INPUT_M68K_BEEP)          += m68kspkr.o
index 6858bc58f0fdb40e6da447decd63db5f162377b5..f4a2517925e4c3746b0beecd984ef906edc1ac3c 100644 (file)
@@ -68,6 +68,15 @@ static inline void i8042_write_command(int val)
 #include <linux/dmi.h>
 
 static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = {
+       {
+               /* AUX LOOP command does not raise AUX IRQ */
+               .ident = "ASUS P65UP5",
+               .matches = {
+                       DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
+                       DMI_MATCH(DMI_BOARD_NAME, "P/I-P65UP5"),
+                       DMI_MATCH(DMI_BOARD_VERSION, "REV 2.X"),
+               },
+       },
        {
                .ident = "Compaq Proliant 8500",
                .matches = {
@@ -92,6 +101,15 @@ static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = {
                        DMI_MATCH(DMI_PRODUCT_VERSION, "00"),
                },
        },
+       {
+               /* AUX LOOP does not work properly */
+               .ident = "ULI EV4873",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "ULI"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "EV4873"),
+                       DMI_MATCH(DMI_PRODUCT_VERSION, "5a"),
+               },
+       },
        { }
 };
 
index 8e18e6c6477771566a33b52e12ffbc9f28b8d098..e3f22852bd0978c422db77d050a9072a013a9549 100644 (file)
@@ -91,7 +91,7 @@ struct usbtouch_usb {
 };
 
 
-#if defined(CONFIG_USB_TOUCHSCREEN_EGALAX) || defined(CONFIG_USB_TOUCHSCREEN_ETURBO)
+#if defined(CONFIG_TOUCHSCREEN_USB_EGALAX) || defined(CONFIG_TOUCHSCREEN_USB_ETURBO)
 #define MULTI_PACKET
 #endif
 
@@ -113,7 +113,7 @@ enum {
 };
 
 static struct usb_device_id usbtouch_devices[] = {
-#ifdef CONFIG_USB_TOUCHSCREEN_EGALAX
+#ifdef CONFIG_TOUCHSCREEN_USB_EGALAX
        {USB_DEVICE(0x3823, 0x0001), .driver_info = DEVTYPE_EGALAX},
        {USB_DEVICE(0x3823, 0x0002), .driver_info = DEVTYPE_EGALAX},
        {USB_DEVICE(0x0123, 0x0001), .driver_info = DEVTYPE_EGALAX},
@@ -123,30 +123,30 @@ static struct usb_device_id usbtouch_devices[] = {
        {USB_DEVICE(0x1234, 0x0002), .driver_info = DEVTYPE_EGALAX},
 #endif
 
-#ifdef CONFIG_USB_TOUCHSCREEN_PANJIT
+#ifdef CONFIG_TOUCHSCREEN_USB_PANJIT
        {USB_DEVICE(0x134c, 0x0001), .driver_info = DEVTYPE_PANJIT},
        {USB_DEVICE(0x134c, 0x0002), .driver_info = DEVTYPE_PANJIT},
        {USB_DEVICE(0x134c, 0x0003), .driver_info = DEVTYPE_PANJIT},
        {USB_DEVICE(0x134c, 0x0004), .driver_info = DEVTYPE_PANJIT},
 #endif
 
-#ifdef CONFIG_USB_TOUCHSCREEN_3M
+#ifdef CONFIG_TOUCHSCREEN_USB_3M
        {USB_DEVICE(0x0596, 0x0001), .driver_info = DEVTYPE_3M},
 #endif
 
-#ifdef CONFIG_USB_TOUCHSCREEN_ITM
+#ifdef CONFIG_TOUCHSCREEN_USB_ITM
        {USB_DEVICE(0x0403, 0xf9e9), .driver_info = DEVTYPE_ITM},
 #endif
 
-#ifdef CONFIG_USB_TOUCHSCREEN_ETURBO
+#ifdef CONFIG_TOUCHSCREEN_USB_ETURBO
        {USB_DEVICE(0x1234, 0x5678), .driver_info = DEVTYPE_ETURBO},
 #endif
 
-#ifdef CONFIG_USB_TOUCHSCREEN_GUNZE
+#ifdef CONFIG_TOUCHSCREEN_USB_GUNZE
        {USB_DEVICE(0x0637, 0x0001), .driver_info = DEVTYPE_GUNZE},
 #endif
 
-#ifdef CONFIG_USB_TOUCHSCREEN_DMC_TSC10
+#ifdef CONFIG_TOUCHSCREEN_USB_DMC_TSC10
        {USB_DEVICE(0x0afa, 0x03e8), .driver_info = DEVTYPE_DMC_TSC10},
 #endif
 
@@ -158,7 +158,7 @@ static struct usb_device_id usbtouch_devices[] = {
  * eGalax part
  */
 
-#ifdef CONFIG_USB_TOUCHSCREEN_EGALAX
+#ifdef CONFIG_TOUCHSCREEN_USB_EGALAX
 
 #define EGALAX_PKT_TYPE_MASK           0xFE
 #define EGALAX_PKT_TYPE_REPT           0x80
@@ -197,7 +197,7 @@ static int egalax_get_pkt_len(unsigned char *buf, int len)
 /*****************************************************************************
  * PanJit Part
  */
-#ifdef CONFIG_USB_TOUCHSCREEN_PANJIT
+#ifdef CONFIG_TOUCHSCREEN_USB_PANJIT
 static int panjit_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
 {
        dev->x = ((pkt[2] & 0x0F) << 8) | pkt[1];
@@ -212,7 +212,7 @@ static int panjit_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
 /*****************************************************************************
  * 3M/Microtouch Part
  */
-#ifdef CONFIG_USB_TOUCHSCREEN_3M
+#ifdef CONFIG_TOUCHSCREEN_USB_3M
 
 #define MTOUCHUSB_ASYNC_REPORT          1
 #define MTOUCHUSB_RESET                 7
@@ -262,7 +262,7 @@ static int mtouch_init(struct usbtouch_usb *usbtouch)
 /*****************************************************************************
  * ITM Part
  */
-#ifdef CONFIG_USB_TOUCHSCREEN_ITM
+#ifdef CONFIG_TOUCHSCREEN_USB_ITM
 static int itm_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
 {
        int touch;
@@ -296,7 +296,7 @@ static int itm_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
 /*****************************************************************************
  * eTurboTouch part
  */
-#ifdef CONFIG_USB_TOUCHSCREEN_ETURBO
+#ifdef CONFIG_TOUCHSCREEN_USB_ETURBO
 static int eturbo_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
 {
        unsigned int shift;
@@ -327,7 +327,7 @@ static int eturbo_get_pkt_len(unsigned char *buf, int len)
 /*****************************************************************************
  * Gunze part
  */
-#ifdef CONFIG_USB_TOUCHSCREEN_GUNZE
+#ifdef CONFIG_TOUCHSCREEN_USB_GUNZE
 static int gunze_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
 {
        if (!(pkt[0] & 0x80) || ((pkt[1] | pkt[2] | pkt[3]) & 0x80))
@@ -348,7 +348,7 @@ static int gunze_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
  *   http://www.dmccoltd.com/files/controler/tsc10usb_pi_e.pdf
  *   http://www.dmccoltd.com/files/controler/tsc25_usb_e.pdf
  */
-#ifdef CONFIG_USB_TOUCHSCREEN_DMC_TSC10
+#ifdef CONFIG_TOUCHSCREEN_USB_DMC_TSC10
 
 /* supported data rates. currently using 130 */
 #define TSC10_RATE_POINT       0x50
@@ -419,7 +419,7 @@ static int dmc_tsc10_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
  * the different device descriptors
  */
 static struct usbtouch_device_info usbtouch_dev_info[] = {
-#ifdef CONFIG_USB_TOUCHSCREEN_EGALAX
+#ifdef CONFIG_TOUCHSCREEN_USB_EGALAX
        [DEVTYPE_EGALAX] = {
                .min_xc         = 0x0,
                .max_xc         = 0x07ff,
@@ -433,7 +433,7 @@ static struct usbtouch_device_info usbtouch_dev_info[] = {
        },
 #endif
 
-#ifdef CONFIG_USB_TOUCHSCREEN_PANJIT
+#ifdef CONFIG_TOUCHSCREEN_USB_PANJIT
        [DEVTYPE_PANJIT] = {
                .min_xc         = 0x0,
                .max_xc         = 0x0fff,
@@ -444,7 +444,7 @@ static struct usbtouch_device_info usbtouch_dev_info[] = {
        },
 #endif
 
-#ifdef CONFIG_USB_TOUCHSCREEN_3M
+#ifdef CONFIG_TOUCHSCREEN_USB_3M
        [DEVTYPE_3M] = {
                .min_xc         = 0x0,
                .max_xc         = 0x4000,
@@ -456,7 +456,7 @@ static struct usbtouch_device_info usbtouch_dev_info[] = {
        },
 #endif
 
-#ifdef CONFIG_USB_TOUCHSCREEN_ITM
+#ifdef CONFIG_TOUCHSCREEN_USB_ITM
        [DEVTYPE_ITM] = {
                .min_xc         = 0x0,
                .max_xc         = 0x0fff,
@@ -468,7 +468,7 @@ static struct usbtouch_device_info usbtouch_dev_info[] = {
        },
 #endif
 
-#ifdef CONFIG_USB_TOUCHSCREEN_ETURBO
+#ifdef CONFIG_TOUCHSCREEN_USB_ETURBO
        [DEVTYPE_ETURBO] = {
                .min_xc         = 0x0,
                .max_xc         = 0x07ff,
@@ -482,7 +482,7 @@ static struct usbtouch_device_info usbtouch_dev_info[] = {
        },
 #endif
 
-#ifdef CONFIG_USB_TOUCHSCREEN_GUNZE
+#ifdef CONFIG_TOUCHSCREEN_USB_GUNZE
        [DEVTYPE_GUNZE] = {
                .min_xc         = 0x0,
                .max_xc         = 0x0fff,
@@ -493,7 +493,7 @@ static struct usbtouch_device_info usbtouch_dev_info[] = {
        },
 #endif
 
-#ifdef CONFIG_USB_TOUCHSCREEN_DMC_TSC10
+#ifdef CONFIG_TOUCHSCREEN_USB_DMC_TSC10
        [DEVTYPE_DMC_TSC10] = {
                .min_xc         = 0x0,
                .max_xc         = 0x03ff,
index 46fc21a3f8ff232038298c3c8dc8e8720f954f3c..d36a4c09e25db2b5d8ee558ab2bf31664455e508 100644 (file)
@@ -195,7 +195,7 @@ static int DIVA_INIT_FUNCTION connect_didd(void)
 /*
  * disconnect from didd
  */
-static void DIVA_EXIT_FUNCTION disconnect_didd(void)
+static void disconnect_didd(void)
 {
        IDI_SYNC_REQ req;
 
index 1c040d80c6417820480c47cd0354e8e1ed2074b6..152312c1fafa3dcfd26cbf5583d27b688c8b3660 100644 (file)
@@ -304,6 +304,7 @@ struct kvm_vcpu {
        char *host_fx_image;
        char *guest_fx_image;
        int fpu_active;
+       int guest_fpu_loaded;
 
        int mmio_needed;
        int mmio_read_completed;
@@ -508,6 +509,8 @@ void fx_init(struct kvm_vcpu *vcpu);
 void load_msrs(struct vmx_msr_entry *e, int n);
 void save_msrs(struct vmx_msr_entry *e, int n);
 void kvm_resched(struct kvm_vcpu *vcpu);
+void kvm_load_guest_fpu(struct kvm_vcpu *vcpu);
+void kvm_put_guest_fpu(struct kvm_vcpu *vcpu);
 
 int kvm_read_guest(struct kvm_vcpu *vcpu,
               gva_t addr,
index da985b31b17e09b5979e930b3ba9edf37c84f5aa..8f1f07adb04e914ce61ea6c595ce90ed53030e01 100644 (file)
@@ -253,6 +253,28 @@ int kvm_write_guest(struct kvm_vcpu *vcpu, gva_t addr, unsigned long size,
 }
 EXPORT_SYMBOL_GPL(kvm_write_guest);
 
+void kvm_load_guest_fpu(struct kvm_vcpu *vcpu)
+{
+       if (!vcpu->fpu_active || vcpu->guest_fpu_loaded)
+               return;
+
+       vcpu->guest_fpu_loaded = 1;
+       fx_save(vcpu->host_fx_image);
+       fx_restore(vcpu->guest_fx_image);
+}
+EXPORT_SYMBOL_GPL(kvm_load_guest_fpu);
+
+void kvm_put_guest_fpu(struct kvm_vcpu *vcpu)
+{
+       if (!vcpu->guest_fpu_loaded)
+               return;
+
+       vcpu->guest_fpu_loaded = 0;
+       fx_save(vcpu->guest_fx_image);
+       fx_restore(vcpu->host_fx_image);
+}
+EXPORT_SYMBOL_GPL(kvm_put_guest_fpu);
+
 /*
  * Switches to specified vcpu, until a matching vcpu_put()
  */
index 184238e2ece4679ce04f68f455033d93b1710af5..c1ac106ace8c1c99193c9b87667396f4adbfb2c5 100644 (file)
@@ -280,6 +280,7 @@ static void vmx_vcpu_load(struct kvm_vcpu *vcpu)
 
 static void vmx_vcpu_put(struct kvm_vcpu *vcpu)
 {
+       kvm_put_guest_fpu(vcpu);
        put_cpu();
 }
 
@@ -1847,10 +1848,8 @@ again:
        if (vcpu->guest_debug.enabled)
                kvm_guest_debug_pre(vcpu);
 
-       if (vcpu->fpu_active) {
-               fx_save(vcpu->host_fx_image);
-               fx_restore(vcpu->guest_fx_image);
-       }
+       kvm_load_guest_fpu(vcpu);
+
        /*
         * Loading guest fpu may have cleared host cr0.ts
         */
@@ -2012,11 +2011,6 @@ again:
        }
 #endif
 
-       if (vcpu->fpu_active) {
-               fx_save(vcpu->guest_fx_image);
-               fx_restore(vcpu->host_fx_image);
-       }
-
        vcpu->interrupt_window_open = (vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) & 3) == 0;
 
        asm ("mov %0, %%ds; mov %0, %%es" : : "r"(__USER_DS));
index 3a95cc5e029c932eaddf0b85df6d6b0f744c36b8..46677d7d9980521802dc71355bb9c6478a103383 100644 (file)
@@ -1240,17 +1240,24 @@ static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio)
                        }
                r1_bio->read_disk = primary;
                for (i=0; i<mddev->raid_disks; i++)
-                       if (r1_bio->bios[i]->bi_end_io == end_sync_read &&
-                           test_bit(BIO_UPTODATE, &r1_bio->bios[i]->bi_flags)) {
+                       if (r1_bio->bios[i]->bi_end_io == end_sync_read) {
                                int j;
                                int vcnt = r1_bio->sectors >> (PAGE_SHIFT- 9);
                                struct bio *pbio = r1_bio->bios[primary];
                                struct bio *sbio = r1_bio->bios[i];
-                               for (j = vcnt; j-- ; )
-                                       if (memcmp(page_address(pbio->bi_io_vec[j].bv_page),
-                                                  page_address(sbio->bi_io_vec[j].bv_page),
-                                                  PAGE_SIZE))
-                                               break;
+
+                               if (test_bit(BIO_UPTODATE, &sbio->bi_flags)) {
+                                       for (j = vcnt; j-- ; ) {
+                                               struct page *p, *s;
+                                               p = pbio->bi_io_vec[j].bv_page;
+                                               s = sbio->bi_io_vec[j].bv_page;
+                                               if (memcmp(page_address(p),
+                                                          page_address(s),
+                                                          PAGE_SIZE))
+                                                       break;
+                                       }
+                               } else
+                                       j = 0;
                                if (j >= 0)
                                        mddev->resync_mismatches += r1_bio->sectors;
                                if (j < 0 || test_bit(MD_RECOVERY_CHECK, &mddev->recovery)) {
index 82249a69014f0295055d10d750d297ac8e4291c6..9eb66c1b523b6b7dee505e5eaa401ef180340b8e 100644 (file)
@@ -1867,6 +1867,7 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
                        int d = r10_bio->devs[i].devnum;
                        bio = r10_bio->devs[i].bio;
                        bio->bi_end_io = NULL;
+                       clear_bit(BIO_UPTODATE, &bio->bi_flags);
                        if (conf->mirrors[d].rdev == NULL ||
                            test_bit(Faulty, &conf->mirrors[d].rdev->flags))
                                continue;
@@ -2037,6 +2038,11 @@ static int run(mddev_t *mddev)
        /* 'size' is now the number of chunks in the array */
        /* calculate "used chunks per device" in 'stride' */
        stride = size * conf->copies;
+
+       /* We need to round up when dividing by raid_disks to
+        * get the stride size.
+        */
+       stride += conf->raid_disks - 1;
        sector_div(stride, conf->raid_disks);
        mddev->size = stride  << (conf->chunk_shift-1);
 
index c120114c241b327458af773e270d66efa6a17286..5c63c8e24ee74babe23ec1dcdd2434a8e45b30dd 100644 (file)
@@ -4,5 +4,6 @@ config VIDEO_SAA7146
 
 config VIDEO_SAA7146_VV
        tristate
+       depends on VIDEO_DEV
        select VIDEO_BUF
        select VIDEO_SAA7146
index 1a1c3bca55fa33a96bccbb9ab7879b17df71e0df..bff00b58bf65309ecec1b2cc723b6c885f59fcff 100644 (file)
@@ -1,8 +1,11 @@
 b2c2-flexcop-objs = flexcop.o flexcop-fe-tuner.o flexcop-i2c.o \
-       flexcop-sram.o flexcop-eeprom.o flexcop-misc.o flexcop-hw-filter.o \
-       flexcop-dma.o
+       flexcop-sram.o flexcop-eeprom.o flexcop-misc.o flexcop-hw-filter.o
 obj-$(CONFIG_DVB_B2C2_FLEXCOP) += b2c2-flexcop.o
 
+ifneq ($(CONFIG_DVB_B2C2_FLEXCOP_PCI),)
+b2c2-flexcop-objs += flexcop-dma.o
+endif
+
 b2c2-flexcop-pci-objs = flexcop-pci.o
 obj-$(CONFIG_DVB_B2C2_FLEXCOP_PCI) += b2c2-flexcop-pci.o
 
index 34d7abc900d7b6cd92994cc3a81af680fd1cb9d1..6aba5b39ed144c2e1476ad993fec4b0f1fb51157 100644 (file)
@@ -519,8 +519,7 @@ static int cinergyt2_release (struct inode *inode, struct file *file)
        struct dvb_device *dvbdev = file->private_data;
        struct cinergyt2 *cinergyt2 = dvbdev->priv;
 
-       if (mutex_lock_interruptible(&cinergyt2->sem))
-               return -ERESTARTSYS;
+       mutex_lock(&cinergyt2->sem);
 
        if (!cinergyt2->disconnect_pending && (file->f_flags & O_ACCMODE) != O_RDONLY) {
                cancel_delayed_work(&cinergyt2->query_work);
index ccc429cbbad0421be88269d3fc30f0b258941485..0f2d4b415560f75fdc1132de3ae68c6f82e4628b 100644 (file)
@@ -41,6 +41,7 @@ struct tda10086_state {
        /* private demod data */
        u32 frequency;
        u32 symbol_rate;
+       bool has_lock;
 };
 
 static int debug = 0;
@@ -116,7 +117,7 @@ static int tda10086_init(struct dvb_frontend* fe)
        // misc setup
        tda10086_write_byte(state, 0x01, 0x94);
        tda10086_write_byte(state, 0x02, 0x35); // NOTE: TT drivers appear to disable CSWP
-       tda10086_write_byte(state, 0x03, 0x64);
+       tda10086_write_byte(state, 0x03, 0xe4);
        tda10086_write_byte(state, 0x04, 0x43);
        tda10086_write_byte(state, 0x0c, 0x0c);
        tda10086_write_byte(state, 0x1b, 0xb0); // noise threshold
@@ -146,7 +147,7 @@ static int tda10086_init(struct dvb_frontend* fe)
        // setup AGC
        tda10086_write_byte(state, 0x05, 0x0B);
        tda10086_write_byte(state, 0x37, 0x63);
-       tda10086_write_byte(state, 0x3f, 0x03); // NOTE: flydvb uses 0x0a and varies it
+       tda10086_write_byte(state, 0x3f, 0x0a); // NOTE: flydvb varies it
        tda10086_write_byte(state, 0x40, 0x64);
        tda10086_write_byte(state, 0x41, 0x4f);
        tda10086_write_byte(state, 0x42, 0x43);
@@ -398,6 +399,10 @@ static int tda10086_set_frontend(struct dvb_frontend* fe,
 
        dprintk ("%s\n", __FUNCTION__);
 
+       // modify parameters for tuning
+       tda10086_write_byte(state, 0x02, 0x35);
+       state->has_lock = false;
+
        // set params
        if (fe->ops.tuner_ops.set_params) {
                fe->ops.tuner_ops.set_params(fe, fe_params);
@@ -542,8 +547,14 @@ static int tda10086_read_status(struct dvb_frontend* fe, fe_status_t *fe_status)
                *fe_status |= FE_HAS_VITERBI;
        if (val & 0x08)
                *fe_status |= FE_HAS_SYNC;
-       if (val & 0x10)
+       if (val & 0x10) {
                *fe_status |= FE_HAS_LOCK;
+               if (!state->has_lock) {
+                       state->has_lock = true;
+                       // modify parameters for stable reception
+                       tda10086_write_byte(state, 0x02, 0x00);
+               }
+       }
 
        return 0;
 }
@@ -555,7 +566,7 @@ static int tda10086_read_signal_strength(struct dvb_frontend* fe, u16 * signal)
 
        dprintk ("%s\n", __FUNCTION__);
 
-       _str = tda10086_read_byte(state, 0x43);
+       _str = 0xff - tda10086_read_byte(state, 0x43);
        *signal = (_str << 8) | _str;
 
        return 0;
@@ -568,7 +579,7 @@ static int tda10086_read_snr(struct dvb_frontend* fe, u16 * snr)
 
        dprintk ("%s\n", __FUNCTION__);
 
-       _snr = tda10086_read_byte(state, 0x1c);
+       _snr = 0xff - tda10086_read_byte(state, 0x1c);
        *snr = (_snr << 8) | _snr;
 
        return 0;
index 79f971dc52b6d3bbe4a65b67df3f87744a975135..bd3ebc2848352b75301f08d6bcafd771ec629564 100644 (file)
@@ -89,8 +89,8 @@ static int tda826x_set_params(struct dvb_frontend *fe, struct dvb_frontend_param
        buf[2] = (1<<5) | 0x0b; // 1Mhz + 0.45 VCO
        buf[3] = div >> 7;
        buf[4] = div << 1;
-       buf[5] = 0xff; // basedband filter to max
-       buf[6] = 0xfe; // gains at max + no RF attenuation
+       buf[5] = 0x77; // baseband cut-off 19 MHz
+       buf[6] = 0xfe; // baseband gain 9 db + no RF attenuation
        buf[7] = 0x83; // charge pumps at high, tests off
        buf[8] = 0x80; // recommended value 4 for AMPVCO + disable ports.
        buf[9] = 0x1a; // normal caltime + recommended values for SELTH + SELVTL
index bc56f1ab700185194659cac8652a4b54571b6466..2f43d7aeebee49b865156b53a3e568f8c7afa7bd 100644 (file)
@@ -347,7 +347,7 @@ endmenu # encoder / decoder chips
 
 config VIDEO_VIVI
        tristate "Virtual Video Driver"
-       depends on VIDEO_V4L2 && !SPARC32 && !SPARC64 && PCI
+       depends on VIDEO_V4L2 && !SPARC32 && !SPARC64 && PCI && VIDEO_DEV
        select VIDEO_BUF
        default n
        ---help---
index 15012f88b802825b5b8bbf752b27aa7285d60d17..91e9e90c14a5eaebe90677f3aa165ced92d0c956 100644 (file)
@@ -86,7 +86,7 @@
                          V4L2_CAP_AUDIO | V4L2_CAP_READWRITE | V4L2_CAP_VBI_CAPTURE | \
                          V4L2_CAP_SLICED_VBI_CAPTURE)
 #define IVTV_CAP_DECODER (V4L2_CAP_VBI_OUTPUT | V4L2_CAP_VIDEO_OUTPUT | \
-                         V4L2_CAP_SLICED_VBI_OUTPUT | V4L2_CAP_VIDEO_OUTPUT_OVERLAY | V4L2_CAP_VIDEO_OUTPUT_POS)
+                         V4L2_CAP_SLICED_VBI_OUTPUT | V4L2_CAP_VIDEO_OUTPUT_OVERLAY)
 
 struct ivtv_card_video_input {
        u8  video_type;         /* video input type */
index e29f949adf57d255a67b9967dc90d6ce01fa22e9..efc66355339ac7f8aa6d693c753c20afd006b594 100644 (file)
@@ -652,6 +652,7 @@ static int __devinit ivtv_init_struct1(struct ivtv *itv)
        itv->dma_timer.data = (unsigned long)itv;
 
        itv->cur_dma_stream = -1;
+       itv->cur_pio_stream = -1;
        itv->audio_stereo_mode = AUDIO_STEREO;
        itv->audio_bilingual_mode = AUDIO_MONO_LEFT;
 
index 552f04511eadf9ff11373d7640163c1cde0a9d64..e6e56f175f3fe1a1da7b2b96849795256d851ce5 100644 (file)
@@ -237,6 +237,7 @@ extern const u32 yuv_offset[4];
 #define IVTV_IRQ_ENC_VBI_CAP           (0x1 << 29)
 #define IVTV_IRQ_ENC_VIM_RST           (0x1 << 28)
 #define IVTV_IRQ_ENC_DMA_COMPLETE      (0x1 << 27)
+#define IVTV_IRQ_ENC_PIO_COMPLETE      (0x1 << 25)
 #define IVTV_IRQ_DEC_AUD_MODE_CHG      (0x1 << 24)
 #define IVTV_IRQ_DEC_DATA_REQ          (0x1 << 22)
 #define IVTV_IRQ_DEC_DMA_COMPLETE      (0x1 << 20)
@@ -247,7 +248,8 @@ extern const u32 yuv_offset[4];
 #define IVTV_IRQ_DEC_VSYNC             (0x1 << 10)
 
 /* IRQ Masks */
-#define IVTV_IRQ_MASK_INIT (IVTV_IRQ_DMA_ERR|IVTV_IRQ_ENC_DMA_COMPLETE|IVTV_IRQ_DMA_READ)
+#define IVTV_IRQ_MASK_INIT (IVTV_IRQ_DMA_ERR|IVTV_IRQ_ENC_DMA_COMPLETE|\
+               IVTV_IRQ_DMA_READ|IVTV_IRQ_ENC_PIO_COMPLETE)
 
 #define IVTV_IRQ_MASK_CAPTURE (IVTV_IRQ_ENC_START_CAP | IVTV_IRQ_ENC_EOS)
 #define IVTV_IRQ_MASK_DECODE  (IVTV_IRQ_DEC_DATA_REQ|IVTV_IRQ_DEC_AUD_MODE_CHG)
@@ -374,6 +376,9 @@ struct ivtv_mailbox_data {
 #define IVTV_F_S_STREAMOFF     7       /* signal end of stream EOS */
 #define IVTV_F_S_APPL_IO        8      /* this stream is used read/written by an application */
 
+#define IVTV_F_S_PIO_PENDING   9       /* this stream has pending PIO */
+#define IVTV_F_S_PIO_HAS_VBI   1       /* the current PIO request also requests VBI data */
+
 /* per-ivtv, i_flags */
 #define IVTV_F_I_DMA              0    /* DMA in progress */
 #define IVTV_F_I_UDMA             1    /* UDMA in progress */
@@ -390,8 +395,11 @@ struct ivtv_mailbox_data {
 #define IVTV_F_I_DECODING_YUV     12   /* this stream is YUV frame decoding */
 #define IVTV_F_I_ENC_PAUSED       13   /* the encoder is paused */
 #define IVTV_F_I_VALID_DEC_TIMINGS 14  /* last_dec_timing is valid */
-#define IVTV_F_I_WORK_HANDLER_VBI  15  /* there is work to be done for VBI */
-#define IVTV_F_I_WORK_HANDLER_YUV  16  /* there is work to be done for YUV */
+#define IVTV_F_I_HAVE_WORK        15   /* Used in the interrupt handler: there is work to be done */
+#define IVTV_F_I_WORK_HANDLER_VBI  16  /* there is work to be done for VBI */
+#define IVTV_F_I_WORK_HANDLER_YUV  17  /* there is work to be done for YUV */
+#define IVTV_F_I_WORK_HANDLER_PIO  18  /* there is work to be done for PIO */
+#define IVTV_F_I_PIO              19   /* PIO in progress */
 
 /* Event notifications */
 #define IVTV_F_I_EV_DEC_STOPPED           28   /* decoder stopped event */
@@ -484,6 +492,7 @@ struct ivtv_stream {
 
        /* Base Dev SG Array for cx23415/6 */
        struct ivtv_SG_element *SGarray;
+       struct ivtv_SG_element *PIOarray;
        dma_addr_t SG_handle;
        int SG_length;
 
@@ -706,6 +715,7 @@ struct ivtv {
        atomic_t decoding;      /* count number of active decoding streams */
        u32 irq_rr_idx; /* Round-robin stream index */
        int cur_dma_stream;     /* index of stream doing DMA */
+       int cur_pio_stream;     /* index of stream doing PIO */
        u32 dma_data_req_offset;
        u32 dma_data_req_size;
        int output_mode;        /* NONE, MPG, YUV, UDMA YUV, passthrough */
index 8976487a65f3c7994481a7657616b9acfaf75952..555d5e6369c319215ad7849f87dcf8b2ccd8a4d6 100644 (file)
@@ -32,6 +32,8 @@
 #include "ivtv-yuv.h"
 #include "ivtv-controls.h"
 #include "ivtv-ioctl.h"
+#include "ivtv-cards.h"
+#include <media/saa7115.h>
 
 /* This function tries to claim the stream for a specific file descriptor.
    If no one else is using this stream then the stream is claimed and
@@ -786,6 +788,13 @@ int ivtv_v4l2_close(struct inode *inode, struct file *filp)
                ivtv_call_i2c_clients(itv, VIDIOC_S_STD, &itv->std);
                /* Select correct audio input (i.e. TV tuner or Line in) */
                ivtv_audio_set_io(itv);
+               if (itv->hw_flags & IVTV_HW_SAA711X)
+               {
+                       struct v4l2_crystal_freq crystal_freq;
+                       crystal_freq.freq = SAA7115_FREQ_32_11_MHZ;
+                       crystal_freq.flags = 0;
+                       ivtv_saa7115(itv, VIDIOC_INT_S_CRYSTAL_FREQ, &crystal_freq);
+               }
                /* Done! Unmute and continue. */
                ivtv_unmute(itv);
                ivtv_release_stream(s);
@@ -872,6 +881,13 @@ int ivtv_v4l2_open(struct inode *inode, struct file *filp)
                set_bit(IVTV_F_I_RADIO_USER, &itv->i_flags);
                /* Select the correct audio input (i.e. radio tuner) */
                ivtv_audio_set_io(itv);
+               if (itv->hw_flags & IVTV_HW_SAA711X)
+               {
+                       struct v4l2_crystal_freq crystal_freq;
+                       crystal_freq.freq = SAA7115_FREQ_32_11_MHZ;
+                       crystal_freq.flags = SAA7115_FREQ_FL_APLL;
+                       ivtv_saa7115(itv, VIDIOC_INT_S_CRYSTAL_FREQ, &crystal_freq);
+               }
                /* Done! Unmute and continue. */
                ivtv_unmute(itv);
        }
index 1989ec1cb973614e02d3ebc0d052a47feb7787e6..57af1762de1f736ebcfe3f79c16322198796f75a 100644 (file)
@@ -532,11 +532,6 @@ static int ivtv_try_or_set_fmt(struct ivtv *itv, int streamtype,
                                itv->yuv_info.yuv_forced_update = 1;
                                return 0;
                        }
-                       if (!ivtv_vapi(itv, CX2341X_OSD_SET_FRAMEBUFFER_WINDOW, 4,
-                                r.width, r.height, r.left, r.top))
-                               itv->main_rect = r;
-                       else
-                               return -EINVAL;
                }
                return 0;
        }
@@ -799,9 +794,39 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
                return ivtv_get_fmt(itv, id->type, fmt);
        }
 
+       case VIDIOC_CROPCAP: {
+               struct v4l2_cropcap *cropcap = arg;
+
+               if (cropcap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE &&
+                   cropcap->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
+                       return -EINVAL;
+               cropcap->bounds.top = cropcap->bounds.left = 0;
+               cropcap->bounds.width = 720;
+               if (cropcap->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
+                       cropcap->bounds.height = itv->is_50hz ? 576 : 480;
+                       cropcap->pixelaspect.numerator = itv->is_50hz ? 59 : 10;
+                       cropcap->pixelaspect.denominator = itv->is_50hz ? 54 : 11;
+               } else {
+                       cropcap->bounds.height = itv->is_out_50hz ? 576 : 480;
+                       cropcap->pixelaspect.numerator = itv->is_out_50hz ? 59 : 10;
+                       cropcap->pixelaspect.denominator = itv->is_out_50hz ? 54 : 11;
+               }
+               cropcap->defrect = cropcap->bounds;
+               return 0;
+       }
+
        case VIDIOC_S_CROP: {
                struct v4l2_crop *crop = arg;
 
+               if (crop->type == V4L2_BUF_TYPE_VIDEO_OUTPUT &&
+                   (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) {
+                       if (!ivtv_vapi(itv, CX2341X_OSD_SET_FRAMEBUFFER_WINDOW, 4,
+                                crop->c.width, crop->c.height, crop->c.left, crop->c.top)) {
+                               itv->main_rect = crop->c;
+                               return 0;
+                       }
+                       return -EINVAL;
+               }
                if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
                        return -EINVAL;
                return itv->video_dec_func(itv, VIDIOC_S_CROP, arg);
@@ -810,6 +835,11 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
        case VIDIOC_G_CROP: {
                struct v4l2_crop *crop = arg;
 
+               if (crop->type == V4L2_BUF_TYPE_VIDEO_OUTPUT &&
+                   (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) {
+                       crop->c = itv->main_rect;
+                       return 0;
+               }
                if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
                        return -EINVAL;
                return itv->video_dec_func(itv, VIDIOC_G_CROP, arg);
@@ -977,7 +1007,7 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
                if (itv->hw_flags & IVTV_HW_CX25840) {
                        itv->vbi.sliced_decoder_line_size = itv->is_60hz ? 272 : 284;
                }
-               IVTV_DEBUG_INFO("Switching standard to %llx.\n", itv->std);
+               IVTV_DEBUG_INFO("Switching standard to %llx.\n", (unsigned long long)itv->std);
 
                /* Tuner */
                ivtv_call_i2c_clients(itv, VIDIOC_S_STD, &itv->std);
@@ -1207,7 +1237,7 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
                                        (s->buffers - s->q_free.buffers) * 100 / s->buffers,
                                        (s->buffers * s->buf_size) / 1024, s->buffers);
                }
-               IVTV_INFO("Read MPEG/VBI: %lld/%lld bytes\n", itv->mpg_data_received, itv->vbi_data_inserted);
+               IVTV_INFO("Read MPEG/VBI: %lld/%lld bytes\n", (long long)itv->mpg_data_received, (long long)itv->vbi_data_inserted);
                IVTV_INFO("==================  END STATUS CARD #%d  ==================\n", itv->num);
                break;
        }
@@ -1455,6 +1485,7 @@ static int ivtv_v4l2_do_ioctl(struct inode *inode, struct file *filp,
        case VIDIOC_S_FMT:
        case VIDIOC_TRY_FMT:
        case VIDIOC_ENUM_FMT:
+       case VIDIOC_CROPCAP:
        case VIDIOC_G_CROP:
        case VIDIOC_S_CROP:
        case VIDIOC_G_FREQUENCY:
index c3a047b381b3eb188707d241db033ccad43f33d2..ba98bf054f2e8371057d58f684d776bfc67dcea0 100644 (file)
@@ -31,8 +31,6 @@
 
 #define DMA_MAGIC_COOKIE 0x000001fe
 
-#define SLICED_VBI_PIO 1
-
 static void ivtv_dma_dec_start(struct ivtv_stream *s);
 
 static const int ivtv_stream_map[] = {
@@ -42,12 +40,40 @@ static const int ivtv_stream_map[] = {
        IVTV_ENC_STREAM_TYPE_VBI,
 };
 
-static inline int ivtv_use_pio(struct ivtv_stream *s)
+
+static void ivtv_pio_work_handler(struct ivtv *itv)
 {
-       struct ivtv *itv = s->itv;
+       struct ivtv_stream *s = &itv->streams[itv->cur_pio_stream];
+       struct ivtv_buffer *buf;
+       struct list_head *p;
+       int i = 0;
+
+       IVTV_DEBUG_DMA("ivtv_pio_work_handler\n");
+       if (itv->cur_pio_stream < 0 || itv->cur_pio_stream >= IVTV_MAX_STREAMS ||
+                       s->v4l2dev == NULL || !ivtv_use_pio(s)) {
+               itv->cur_pio_stream = -1;
+               /* trigger PIO complete user interrupt */
+               write_reg(IVTV_IRQ_ENC_PIO_COMPLETE, 0x44);
+               return;
+       }
+       IVTV_DEBUG_DMA("Process PIO %s\n", s->name);
+       buf = list_entry(s->q_dma.list.next, struct ivtv_buffer, list);
+       list_for_each(p, &s->q_dma.list) {
+               struct ivtv_buffer *buf = list_entry(p, struct ivtv_buffer, list);
+               u32 size = s->PIOarray[i].size & 0x3ffff;
 
-       return s->dma == PCI_DMA_NONE ||
-           (SLICED_VBI_PIO && s->type == IVTV_ENC_STREAM_TYPE_VBI && itv->vbi.sliced_in->service_set);
+               /* Copy the data from the card to the buffer */
+               if (s->type == IVTV_DEC_STREAM_TYPE_VBI) {
+                       memcpy_fromio(buf->buf, itv->dec_mem + s->PIOarray[i].src - IVTV_DECODER_OFFSET, size);
+               }
+               else {
+                       memcpy_fromio(buf->buf, itv->enc_mem + s->PIOarray[i].src, size);
+               }
+               if (s->PIOarray[i].size & 0x80000000)
+                       break;
+               i++;
+       }
+       write_reg(IVTV_IRQ_ENC_PIO_COMPLETE, 0x44);
 }
 
 void ivtv_irq_work_handler(struct work_struct *work)
@@ -56,8 +82,11 @@ void ivtv_irq_work_handler(struct work_struct *work)
 
        DEFINE_WAIT(wait);
 
+       if (test_and_clear_bit(IVTV_F_I_WORK_HANDLER_PIO, &itv->i_flags))
+               ivtv_pio_work_handler(itv);
+
        if (test_and_clear_bit(IVTV_F_I_WORK_HANDLER_VBI, &itv->i_flags))
-               vbi_work_handler(itv);
+               ivtv_vbi_work_handler(itv);
 
        if (test_and_clear_bit(IVTV_F_I_WORK_HANDLER_YUV, &itv->i_flags))
                ivtv_yuv_work_handler(itv);
@@ -173,8 +202,7 @@ static int stream_enc_dma_append(struct ivtv_stream *s, u32 data[CX2341X_MBOX_MA
        }
        s->buffers_stolen = rc;
 
-       /* got the buffers, now fill in SGarray (DMA) or copy the data from the card
-          to the buffers (PIO). */
+       /* got the buffers, now fill in SGarray (DMA) */
        buf = list_entry(s->q_predma.list.next, struct ivtv_buffer, list);
        memset(buf->buf, 0, 128);
        list_for_each(p, &s->q_predma.list) {
@@ -182,21 +210,11 @@ static int stream_enc_dma_append(struct ivtv_stream *s, u32 data[CX2341X_MBOX_MA
 
                if (skip_bufs-- > 0)
                        continue;
-               if (!ivtv_use_pio(s)) {
-                       s->SGarray[idx].dst = cpu_to_le32(buf->dma_handle);
-                       s->SGarray[idx].src = cpu_to_le32(offset);
-                       s->SGarray[idx].size = cpu_to_le32(s->buf_size);
-               }
+               s->SGarray[idx].dst = cpu_to_le32(buf->dma_handle);
+               s->SGarray[idx].src = cpu_to_le32(offset);
+               s->SGarray[idx].size = cpu_to_le32(s->buf_size);
                buf->bytesused = (size < s->buf_size) ? size : s->buf_size;
 
-               /* If PIO, then copy the data from the card to the buffer */
-               if (s->type == IVTV_DEC_STREAM_TYPE_VBI) {
-                       memcpy_fromio(buf->buf, itv->dec_mem + offset - IVTV_DECODER_OFFSET, buf->bytesused);
-               }
-               else if (ivtv_use_pio(s)) {
-                       memcpy_fromio(buf->buf, itv->enc_mem + offset, buf->bytesused);
-               }
-
                s->q_predma.bytesused += buf->bytesused;
                size -= buf->bytesused;
                offset += s->buf_size;
@@ -224,11 +242,6 @@ static void dma_post(struct ivtv_stream *s)
        u32 *u32buf;
        int x = 0;
 
-       if (ivtv_use_pio(s)) {
-               if (s->q_predma.bytesused)
-                       ivtv_queue_move(s, &s->q_predma, NULL, &s->q_dma, s->q_predma.bytesused);
-               s->SG_length = 0;
-       }
        IVTV_DEBUG_DMA("%s %s completed (%x)\n", ivtv_use_pio(s) ? "PIO" : "DMA",
                        s->name, s->dma_offset);
        list_for_each(p, &s->q_dma.list) {
@@ -278,10 +291,14 @@ static void dma_post(struct ivtv_stream *s)
        if (buf)
                buf->bytesused += s->dma_last_offset;
        if (buf && s->type == IVTV_DEC_STREAM_TYPE_VBI) {
-               /* Parse and Groom VBI Data */
-               s->q_dma.bytesused -= buf->bytesused;
-               ivtv_process_vbi_data(itv, buf, 0, s->type);
-               s->q_dma.bytesused += buf->bytesused;
+               list_for_each(p, &s->q_dma.list) {
+                       buf = list_entry(p, struct ivtv_buffer, list);
+
+                       /* Parse and Groom VBI Data */
+                       s->q_dma.bytesused -= buf->bytesused;
+                       ivtv_process_vbi_data(itv, buf, 0, s->type);
+                       s->q_dma.bytesused += buf->bytesused;
+               }
                if (s->id == -1) {
                        ivtv_queue_move(s, &s->q_dma, NULL, &s->q_free, 0);
                        return;
@@ -351,10 +368,14 @@ static void ivtv_dma_enc_start(struct ivtv_stream *s)
        struct ivtv_stream *s_vbi = &itv->streams[IVTV_ENC_STREAM_TYPE_VBI];
        int i;
 
+       IVTV_DEBUG_DMA("start %s for %s\n", ivtv_use_dma(s) ? "DMA" : "PIO", s->name);
+
        if (s->q_predma.bytesused)
                ivtv_queue_move(s, &s->q_predma, NULL, &s->q_dma, s->q_predma.bytesused);
-       IVTV_DEBUG_DMA("start DMA for %s\n", s->name);
-       s->SGarray[s->SG_length - 1].size = cpu_to_le32(le32_to_cpu(s->SGarray[s->SG_length - 1].size) + 256);
+
+       if (ivtv_use_dma(s))
+               s->SGarray[s->SG_length - 1].size =
+                       cpu_to_le32(le32_to_cpu(s->SGarray[s->SG_length - 1].size) + 256);
 
        /* If this is an MPEG stream, and VBI data is also pending, then append the
           VBI DMA to the MPEG DMA and transfer both sets of data at once.
@@ -368,7 +389,8 @@ static void ivtv_dma_enc_start(struct ivtv_stream *s)
        if (s->type == IVTV_ENC_STREAM_TYPE_MPG && s_vbi->SG_length &&
                        s->SG_length + s_vbi->SG_length <= s->buffers) {
                ivtv_queue_move(s_vbi, &s_vbi->q_predma, NULL, &s_vbi->q_dma, s_vbi->q_predma.bytesused);
-               s_vbi->SGarray[s_vbi->SG_length - 1].size = cpu_to_le32(le32_to_cpu(s_vbi->SGarray[s->SG_length - 1].size) + 256);
+               if (ivtv_use_dma(s_vbi))
+                       s_vbi->SGarray[s_vbi->SG_length - 1].size = cpu_to_le32(le32_to_cpu(s_vbi->SGarray[s->SG_length - 1].size) + 256);
                for (i = 0; i < s_vbi->SG_length; i++) {
                        s->SGarray[s->SG_length++] = s_vbi->SGarray[i];
                }
@@ -381,14 +403,26 @@ static void ivtv_dma_enc_start(struct ivtv_stream *s)
        /* Mark last buffer size for Interrupt flag */
        s->SGarray[s->SG_length - 1].size |= cpu_to_le32(0x80000000);
 
-       /* Sync Hardware SG List of buffers */
-       ivtv_stream_sync_for_device(s);
-       write_reg(s->SG_handle, IVTV_REG_ENCDMAADDR);
-       write_reg_sync(read_reg(IVTV_REG_DMAXFER) | 0x02, IVTV_REG_DMAXFER);
-       set_bit(IVTV_F_I_DMA, &itv->i_flags);
-       itv->cur_dma_stream = s->type;
-       itv->dma_timer.expires = jiffies + HZ / 10;
-       add_timer(&itv->dma_timer);
+       if (ivtv_use_pio(s)) {
+               for (i = 0; i < s->SG_length; i++) {
+                       s->PIOarray[i].src = le32_to_cpu(s->SGarray[i].src);
+                       s->PIOarray[i].size = le32_to_cpu(s->SGarray[i].size);
+               }
+               set_bit(IVTV_F_I_WORK_HANDLER_PIO, &itv->i_flags);
+               set_bit(IVTV_F_I_HAVE_WORK, &itv->i_flags);
+               set_bit(IVTV_F_I_PIO, &itv->i_flags);
+               itv->cur_pio_stream = s->type;
+       }
+       else {
+               /* Sync Hardware SG List of buffers */
+               ivtv_stream_sync_for_device(s);
+               write_reg(s->SG_handle, IVTV_REG_ENCDMAADDR);
+               write_reg_sync(read_reg(IVTV_REG_DMAXFER) | 0x02, IVTV_REG_DMAXFER);
+               set_bit(IVTV_F_I_DMA, &itv->i_flags);
+               itv->cur_dma_stream = s->type;
+               itv->dma_timer.expires = jiffies + HZ / 10;
+               add_timer(&itv->dma_timer);
+       }
 }
 
 static void ivtv_dma_dec_start(struct ivtv_stream *s)
@@ -489,6 +523,40 @@ static void ivtv_irq_enc_dma_complete(struct ivtv *itv)
        wake_up(&itv->dma_waitq);
 }
 
+static void ivtv_irq_enc_pio_complete(struct ivtv *itv)
+{
+       struct ivtv_stream *s;
+
+       if (itv->cur_pio_stream < 0 || itv->cur_pio_stream >= IVTV_MAX_STREAMS) {
+               itv->cur_pio_stream = -1;
+               return;
+       }
+       s = &itv->streams[itv->cur_pio_stream];
+       IVTV_DEBUG_IRQ("ENC PIO COMPLETE %s\n", s->name);
+       s->SG_length = 0;
+       clear_bit(IVTV_F_I_ENC_VBI, &itv->i_flags);
+       clear_bit(IVTV_F_I_PIO, &itv->i_flags);
+       itv->cur_pio_stream = -1;
+       dma_post(s);
+       if (s->type == IVTV_ENC_STREAM_TYPE_MPG)
+               ivtv_vapi(itv, CX2341X_ENC_SCHED_DMA_TO_HOST, 3, 0, 0, 0);
+       else if (s->type == IVTV_ENC_STREAM_TYPE_YUV)
+               ivtv_vapi(itv, CX2341X_ENC_SCHED_DMA_TO_HOST, 3, 0, 0, 1);
+       else if (s->type == IVTV_ENC_STREAM_TYPE_PCM)
+               ivtv_vapi(itv, CX2341X_ENC_SCHED_DMA_TO_HOST, 3, 0, 0, 2);
+       clear_bit(IVTV_F_I_PIO, &itv->i_flags);
+       if (test_and_clear_bit(IVTV_F_S_DMA_HAS_VBI, &s->s_flags)) {
+               u32 tmp;
+
+               s = &itv->streams[IVTV_ENC_STREAM_TYPE_VBI];
+               tmp = s->dma_offset;
+               s->dma_offset = itv->vbi.dma_offset;
+               dma_post(s);
+               s->dma_offset = tmp;
+       }
+       wake_up(&itv->dma_waitq);
+}
+
 static void ivtv_irq_dma_err(struct ivtv *itv)
 {
        u32 data[CX2341X_MBOX_MAX_DATA];
@@ -532,13 +600,7 @@ static void ivtv_irq_enc_start_cap(struct ivtv *itv)
        clear_bit(IVTV_F_I_ENC_VBI, &itv->i_flags);
        s = &itv->streams[ivtv_stream_map[data[0]]];
        if (!stream_enc_dma_append(s, data)) {
-               if (ivtv_use_pio(s)) {
-                       dma_post(s);
-                       ivtv_vapi(itv, CX2341X_ENC_SCHED_DMA_TO_HOST, 3, 0, 0, data[0]);
-               }
-               else {
-                       set_bit(IVTV_F_S_DMA_PENDING, &s->s_flags);
-               }
+               set_bit(ivtv_use_pio(s) ? IVTV_F_S_PIO_PENDING : IVTV_F_S_DMA_PENDING, &s->s_flags);
        }
 }
 
@@ -551,15 +613,6 @@ static void ivtv_irq_enc_vbi_cap(struct ivtv *itv)
        IVTV_DEBUG_IRQ("ENC START VBI CAP\n");
        s = &itv->streams[IVTV_ENC_STREAM_TYPE_VBI];
 
-       if (ivtv_use_pio(s)) {
-               if (stream_enc_dma_append(s, data))
-                       return;
-               if (s->q_predma.bytesused)
-                       ivtv_queue_move(s, &s->q_predma, NULL, &s->q_dma, s->q_predma.bytesused);
-               s->SG_length = 0;
-               dma_post(s);
-               return;
-       }
        /* If more than two VBI buffers are pending, then
           clear the old ones and start with this new one.
           This can happen during transition stages when MPEG capturing is
@@ -582,11 +635,11 @@ static void ivtv_irq_enc_vbi_cap(struct ivtv *itv)
        if (!stream_enc_dma_append(s, data) &&
                        !test_bit(IVTV_F_S_STREAMING, &s_mpg->s_flags)) {
                set_bit(IVTV_F_I_ENC_VBI, &itv->i_flags);
-               set_bit(IVTV_F_S_DMA_PENDING, &s->s_flags);
+               set_bit(ivtv_use_pio(s) ? IVTV_F_S_PIO_PENDING : IVTV_F_S_DMA_PENDING, &s->s_flags);
        }
 }
 
-static void ivtv_irq_dev_vbi_reinsert(struct ivtv *itv)
+static void ivtv_irq_dec_vbi_reinsert(struct ivtv *itv)
 {
        u32 data[CX2341X_MBOX_MAX_DATA];
        struct ivtv_stream *s = &itv->streams[IVTV_DEC_STREAM_TYPE_VBI];
@@ -594,7 +647,7 @@ static void ivtv_irq_dev_vbi_reinsert(struct ivtv *itv)
        IVTV_DEBUG_IRQ("DEC VBI REINSERT\n");
        if (test_bit(IVTV_F_S_CLAIMED, &s->s_flags) &&
                        !stream_enc_dma_append(s, data)) {
-               dma_post(s);
+               set_bit(IVTV_F_S_PIO_PENDING, &s->s_flags);
        }
 }
 
@@ -657,7 +710,6 @@ static void ivtv_irq_vsync(struct ivtv *itv)
        }
        if (frame != (itv->lastVsyncFrame & 1)) {
                struct ivtv_stream *s = ivtv_get_output_stream(itv);
-               int work = 0;
 
                itv->lastVsyncFrame += 1;
                if (frame == 0) {
@@ -678,7 +730,7 @@ static void ivtv_irq_vsync(struct ivtv *itv)
                /* Send VBI to saa7127 */
                if (frame) {
                        set_bit(IVTV_F_I_WORK_HANDLER_VBI, &itv->i_flags);
-                       work = 1;
+                       set_bit(IVTV_F_I_HAVE_WORK, &itv->i_flags);
                }
 
                /* Check if we need to update the yuv registers */
@@ -691,11 +743,9 @@ static void ivtv_irq_vsync(struct ivtv *itv)
                                itv->yuv_info.new_frame_info[last_dma_frame].update = 0;
                                itv->yuv_info.yuv_forced_update = 0;
                                set_bit(IVTV_F_I_WORK_HANDLER_YUV, &itv->i_flags);
-                               work = 1;
+                               set_bit(IVTV_F_I_HAVE_WORK, &itv->i_flags);
                        }
                }
-               if (work)
-                       queue_work(itv->irq_work_queues, &itv->irq_work_queue);
        }
 }
 
@@ -755,6 +805,10 @@ irqreturn_t ivtv_irq_handler(int irq, void *dev_id)
                ivtv_irq_enc_dma_complete(itv);
        }
 
+       if (combo & IVTV_IRQ_ENC_PIO_COMPLETE) {
+               ivtv_irq_enc_pio_complete(itv);
+       }
+
        if (combo & IVTV_IRQ_DMA_ERR) {
                ivtv_irq_dma_err(itv);
        }
@@ -768,7 +822,7 @@ irqreturn_t ivtv_irq_handler(int irq, void *dev_id)
        }
 
        if (combo & IVTV_IRQ_DEC_VBI_RE_INSERT) {
-               ivtv_irq_dev_vbi_reinsert(itv);
+               ivtv_irq_dec_vbi_reinsert(itv);
        }
 
        if (combo & IVTV_IRQ_ENC_EOS) {
@@ -813,6 +867,22 @@ irqreturn_t ivtv_irq_handler(int irq, void *dev_id)
                }
        }
 
+       if ((combo & IVTV_IRQ_DMA) && !test_bit(IVTV_F_I_PIO, &itv->i_flags)) {
+               for (i = 0; i < IVTV_MAX_STREAMS; i++) {
+                       int idx = (i + itv->irq_rr_idx++) % IVTV_MAX_STREAMS;
+                       struct ivtv_stream *s = &itv->streams[idx];
+
+                       if (!test_and_clear_bit(IVTV_F_S_PIO_PENDING, &s->s_flags))
+                               continue;
+                       if (s->type == IVTV_DEC_STREAM_TYPE_VBI || s->type < IVTV_DEC_STREAM_TYPE_MPG)
+                               ivtv_dma_enc_start(s);
+                       break;
+               }
+       }
+
+       if (test_and_clear_bit(IVTV_F_I_HAVE_WORK, &itv->i_flags))
+               queue_work(itv->irq_work_queues, &itv->irq_work_queue);
+
        spin_unlock(&itv->dma_reg_lock);
 
        /* If we've just handled a 'forced' vsync, it's safest to say it
index ccfcef1ad91a5225e73c50e39d41347794e7a8a2..a04f9387f63df4127668d42dfa9143154ce4e0c1 100644 (file)
@@ -195,14 +195,26 @@ int ivtv_stream_alloc(struct ivtv_stream *s)
                s->dma != PCI_DMA_NONE ? "DMA " : "",
                s->name, s->buffers, s->buf_size, s->buffers * s->buf_size / 1024);
 
-       /* Allocate DMA SG Arrays */
-       if (s->dma != PCI_DMA_NONE) {
-               s->SGarray = (struct ivtv_SG_element *)kzalloc(SGsize, GFP_KERNEL);
-               if (s->SGarray == NULL) {
-                       IVTV_ERR("Could not allocate SGarray for %s stream\n", s->name);
+       if (ivtv_might_use_pio(s)) {
+               s->PIOarray = (struct ivtv_SG_element *)kzalloc(SGsize, GFP_KERNEL);
+               if (s->PIOarray == NULL) {
+                       IVTV_ERR("Could not allocate PIOarray for %s stream\n", s->name);
                        return -ENOMEM;
                }
-               s->SG_length = 0;
+       }
+
+       /* Allocate DMA SG Arrays */
+       s->SGarray = (struct ivtv_SG_element *)kzalloc(SGsize, GFP_KERNEL);
+       if (s->SGarray == NULL) {
+               IVTV_ERR("Could not allocate SGarray for %s stream\n", s->name);
+               if (ivtv_might_use_pio(s)) {
+                       kfree(s->PIOarray);
+                       s->PIOarray = NULL;
+               }
+               return -ENOMEM;
+       }
+       s->SG_length = 0;
+       if (ivtv_might_use_dma(s)) {
                s->SG_handle = pci_map_single(itv->dev, s->SGarray, SGsize, s->dma);
                ivtv_stream_sync_for_cpu(s);
        }
@@ -219,7 +231,7 @@ int ivtv_stream_alloc(struct ivtv_stream *s)
                        break;
                }
                INIT_LIST_HEAD(&buf->list);
-               if (s->dma != PCI_DMA_NONE) {
+               if (ivtv_might_use_dma(s)) {
                        buf->dma_handle = pci_map_single(s->itv->dev,
                                buf->buf, s->buf_size + 256, s->dma);
                        ivtv_buf_sync_for_cpu(s, buf);
@@ -242,7 +254,7 @@ void ivtv_stream_free(struct ivtv_stream *s)
 
        /* empty q_free */
        while ((buf = ivtv_dequeue(s, &s->q_free))) {
-               if (s->dma != PCI_DMA_NONE)
+               if (ivtv_might_use_dma(s))
                        pci_unmap_single(s->itv->dev, buf->dma_handle,
                                s->buf_size + 256, s->dma);
                kfree(buf->buf);
@@ -256,6 +268,9 @@ void ivtv_stream_free(struct ivtv_stream *s)
                                 sizeof(struct ivtv_SG_element) * s->buffers, PCI_DMA_TODEVICE);
                        s->SG_handle = IVTV_DMA_UNMAPPED;
                }
+               kfree(s->SGarray);
+               kfree(s->PIOarray);
+               s->PIOarray = NULL;
                s->SGarray = NULL;
                s->SG_length = 0;
        }
index 903edd4b43814bd8848f81bd83039e4824dfb7de..2ed8d548255d95f58b31bdc38e8db9df63e1cc2b 100644 (file)
  */
 
 #define IVTV_DMA_UNMAPPED      ((u32) -1)
+#define SLICED_VBI_PIO 1
 
 /* ivtv_buffer utility functions */
+
+static inline int ivtv_might_use_pio(struct ivtv_stream *s)
+{
+       return s->dma == PCI_DMA_NONE || (SLICED_VBI_PIO && s->type == IVTV_ENC_STREAM_TYPE_VBI);
+}
+
+static inline int ivtv_use_pio(struct ivtv_stream *s)
+{
+       struct ivtv *itv = s->itv;
+
+       return s->dma == PCI_DMA_NONE ||
+           (SLICED_VBI_PIO && s->type == IVTV_ENC_STREAM_TYPE_VBI && itv->vbi.sliced_in->service_set);
+}
+
+static inline int ivtv_might_use_dma(struct ivtv_stream *s)
+{
+       return s->dma != PCI_DMA_NONE;
+}
+
+static inline int ivtv_use_dma(struct ivtv_stream *s)
+{
+       return !ivtv_use_pio(s);
+}
+
 static inline void ivtv_buf_sync_for_cpu(struct ivtv_stream *s, struct ivtv_buffer *buf)
 {
-       if (s->dma != PCI_DMA_NONE)
+       if (ivtv_use_dma(s))
                pci_dma_sync_single_for_cpu(s->itv->dev, buf->dma_handle,
                                s->buf_size + 256, s->dma);
 }
 
 static inline void ivtv_buf_sync_for_device(struct ivtv_stream *s, struct ivtv_buffer *buf)
 {
-       if (s->dma != PCI_DMA_NONE)
+       if (ivtv_use_dma(s))
                pci_dma_sync_single_for_device(s->itv->dev, buf->dma_handle,
                                s->buf_size + 256, s->dma);
 }
@@ -53,12 +78,14 @@ void ivtv_stream_free(struct ivtv_stream *s);
 
 static inline void ivtv_stream_sync_for_cpu(struct ivtv_stream *s)
 {
-       pci_dma_sync_single_for_cpu(s->itv->dev, s->SG_handle,
-               sizeof(struct ivtv_SG_element) * s->buffers, PCI_DMA_TODEVICE);
+       if (ivtv_use_dma(s))
+               pci_dma_sync_single_for_cpu(s->itv->dev, s->SG_handle,
+                       sizeof(struct ivtv_SG_element) * s->buffers, PCI_DMA_TODEVICE);
 }
 
 static inline void ivtv_stream_sync_for_device(struct ivtv_stream *s)
 {
-       pci_dma_sync_single_for_device(s->itv->dev, s->SG_handle,
-               sizeof(struct ivtv_SG_element) * s->buffers, PCI_DMA_TODEVICE);
+       if (ivtv_use_dma(s))
+               pci_dma_sync_single_for_device(s->itv->dev, s->SG_handle,
+                       sizeof(struct ivtv_SG_element) * s->buffers, PCI_DMA_TODEVICE);
 }
index 01a41a844a307c223d3c64e9f23eed84cb3c03a6..6af88ae9295f8f4096ef3b8b230fba06ce9a4d48 100644 (file)
@@ -868,7 +868,7 @@ int ivtv_stop_v4l2_decode_stream(struct ivtv_stream *s, int flags, u64 pts)
        if (!test_bit(IVTV_F_S_STREAMING, &s->s_flags))
                return 0;
 
-       IVTV_DEBUG_INFO("Stop Decode at %llu, flags: %x\n", pts, flags);
+       IVTV_DEBUG_INFO("Stop Decode at %llu, flags: %x\n", (unsigned long long)pts, flags);
 
        /* Stop Decoder */
        if (!(flags & VIDEO_CMD_STOP_IMMEDIATELY) || pts) {
index 5efa5a867818a9879b9497cbd9972764b8fc449d..3ba46e07ea1f1b93e6c497f5ff76e4b6738b3eab 100644 (file)
@@ -450,7 +450,7 @@ void ivtv_disable_vbi(struct ivtv *itv)
 }
 
 
-void vbi_work_handler(struct ivtv *itv)
+void ivtv_vbi_work_handler(struct ivtv *itv)
 {
        struct v4l2_sliced_vbi_data data;
 
index cdaea697b3ec087e94cfe5828fb178026e28eb6f..ec211b49702cc975427fdbee35c7a5bea9d5abdb 100644 (file)
@@ -23,4 +23,4 @@ void ivtv_process_vbi_data(struct ivtv *itv, struct ivtv_buffer *buf,
 int ivtv_used_line(struct ivtv *itv, int line, int field);
 void ivtv_disable_vbi(struct ivtv *itv);
 void ivtv_set_vbi(unsigned long arg);
-void vbi_work_handler(struct ivtv *itv);
+void ivtv_vbi_work_handler(struct ivtv *itv);
index 74839f98b7c45c2e8158f57a47a9cbb421dd9086..c1a392e47170b520d3b17c5c14463857b5b11e00 100644 (file)
@@ -75,10 +75,6 @@ struct saa7111 {
        int norm;
        int input;
        int enable;
-       int bright;
-       int contrast;
-       int hue;
-       int sat;
 };
 
 #define   I2C_SAA7111        0x48
@@ -96,6 +92,17 @@ saa7111_write (struct i2c_client *client,
        return i2c_smbus_write_byte_data(client, reg, value);
 }
 
+static inline void
+saa7111_write_if_changed(struct i2c_client *client, u8 reg, u8 value)
+{
+       struct saa7111 *decoder = i2c_get_clientdata(client);
+
+       if (decoder->reg[reg] != value) {
+               decoder->reg[reg] = value;
+               i2c_smbus_write_byte_data(client, reg, value);
+       }
+}
+
 static int
 saa7111_write_block (struct i2c_client *client,
                     const u8          *data,
@@ -439,28 +446,14 @@ saa7111_command (struct i2c_client *client,
        {
                struct video_picture *pic = arg;
 
-               if (decoder->bright != pic->brightness) {
-                       /* We want 0 to 255 we get 0-65535 */
-                       decoder->bright = pic->brightness;
-                       saa7111_write(client, 0x0a, decoder->bright >> 8);
-               }
-               if (decoder->contrast != pic->contrast) {
-                       /* We want 0 to 127 we get 0-65535 */
-                       decoder->contrast = pic->contrast;
-                       saa7111_write(client, 0x0b,
-                                     decoder->contrast >> 9);
-               }
-               if (decoder->sat != pic->colour) {
-                       /* We want 0 to 127 we get 0-65535 */
-                       decoder->sat = pic->colour;
-                       saa7111_write(client, 0x0c, decoder->sat >> 9);
-               }
-               if (decoder->hue != pic->hue) {
-                       /* We want -128 to 127 we get 0-65535 */
-                       decoder->hue = pic->hue;
-                       saa7111_write(client, 0x0d,
-                                     (decoder->hue - 32768) >> 8);
-               }
+               /* We want 0 to 255 we get 0-65535 */
+               saa7111_write_if_changed(client, 0x0a, pic->brightness >> 8);
+               /* We want 0 to 127 we get 0-65535 */
+               saa7111_write(client, 0x0b, pic->contrast >> 9);
+               /* We want 0 to 127 we get 0-65535 */
+               saa7111_write(client, 0x0c, pic->colour >> 9);
+               /* We want -128 to 127 we get 0-65535 */
+               saa7111_write(client, 0x0d, (pic->hue - 32768) >> 8);
        }
                break;
 
@@ -524,10 +517,6 @@ saa7111_detect_client (struct i2c_adapter *adapter,
        decoder->norm = VIDEO_MODE_NTSC;
        decoder->input = 0;
        decoder->enable = 1;
-       decoder->bright = 32768;
-       decoder->contrast = 32768;
-       decoder->hue = 32768;
-       decoder->sat = 32768;
        i2c_set_clientdata(client, decoder);
 
        i = i2c_attach_client(client);
index 9118a6227ea63034d8d63469be9335c96993aa21..7df071eb0a3b2f2bc1317ca2cabe4b9a7ac443db 100644 (file)
@@ -1414,6 +1414,11 @@ static void usbvision_isocIrq(struct urb *urb)
        if (!USBVISION_IS_OPERATIONAL(usbvision))
                return;
 
+       /* any urb with wrong status is ignored without acknowledgement */
+       if (urb->status == -ENOENT) {
+               return;
+       }
+
        f = &usbvision->curFrame;
 
        /* Manage streaming interruption */
@@ -1436,18 +1441,21 @@ static void usbvision_isocIrq(struct urb *urb)
        if (usbvision->streaming == Stream_On) {
 
                /* If we collected enough data let's parse! */
-               if (scratch_len(usbvision) > USBVISION_HEADER_LENGTH) { /* 12 == header_length */
-                       /*If we don't have a frame we're current working on, complain */
-                       if(!list_empty(&(usbvision->inqueue))) {
-                               if (!(*f)) {
-                                       (*f) = list_entry(usbvision->inqueue.next,struct usbvision_frame, frame);
-                               }
-                               usbvision_parse_data(usbvision);
-                       }
-                       else {
-                               PDEBUG(DBG_IRQ, "received data, but no one needs it");
-                               scratch_reset(usbvision);
+               if ((scratch_len(usbvision) > USBVISION_HEADER_LENGTH) &&
+                   (!list_empty(&(usbvision->inqueue))) ) {
+                       if (!(*f)) {
+                               (*f) = list_entry(usbvision->inqueue.next,
+                                                 struct usbvision_frame,
+                                                 frame);
                        }
+                       usbvision_parse_data(usbvision);
+               }
+               else {
+                       /*If we don't have a frame
+                         we're current working on, complain */
+                       PDEBUG(DBG_IRQ,
+                              "received data, but no one needs it");
+                       scratch_reset(usbvision);
                }
        }
        else {
@@ -1466,10 +1474,10 @@ static void usbvision_isocIrq(struct urb *urb)
        urb->dev = usbvision->dev;
        errCode = usb_submit_urb (urb, GFP_ATOMIC);
 
-       /* Disable this warning.  By design of the driver. */
-       //      if(errCode) {
-       //              err("%s: usb_submit_urb failed: error %d", __FUNCTION__, errCode);
-       //      }
+       if(errCode) {
+               err("%s: usb_submit_urb failed: error %d",
+                   __FUNCTION__, errCode);
+       }
 
        return;
 }
@@ -2394,7 +2402,7 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision)
 {
        struct usb_device *dev = usbvision->dev;
        int bufIdx, errCode, regValue;
-       const int sb_size = USBVISION_URB_FRAMES * USBVISION_MAX_ISOC_PACKET_SIZE;
+       int sb_size;
 
        if (!USBVISION_IS_OPERATIONAL(usbvision))
                return -EFAULT;
@@ -2408,11 +2416,14 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision)
                usbvision->last_error = errCode;
                return -EBUSY;
        }
+       sb_size = USBVISION_URB_FRAMES * usbvision->isocPacketSize;
 
-       regValue = (16 - usbvision_read_reg(usbvision, USBVISION_ALTER_REG)) & 0x0F;
+       regValue = (16 - usbvision_read_reg(usbvision,
+                                           USBVISION_ALTER_REG)) & 0x0F;
 
        usbvision->usb_bandwidth = regValue >> 1;
-       PDEBUG(DBG_ISOC, "USB Bandwidth Usage: %dMbit/Sec", usbvision->usb_bandwidth);
+       PDEBUG(DBG_ISOC, "USB Bandwidth Usage: %dMbit/Sec",
+              usbvision->usb_bandwidth);
 
 
 
@@ -2428,7 +2439,11 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision)
                        return -ENOMEM;
                }
                usbvision->sbuf[bufIdx].urb = urb;
-               usbvision->sbuf[bufIdx].data = usb_buffer_alloc(usbvision->dev, sb_size, GFP_KERNEL,&urb->transfer_dma);
+               usbvision->sbuf[bufIdx].data =
+                       usb_buffer_alloc(usbvision->dev,
+                                        sb_size,
+                                        GFP_KERNEL,
+                                        &urb->transfer_dma);
                urb->dev = dev;
                urb->context = usbvision;
                urb->pipe = usb_rcvisocpipe(dev, usbvision->video_endp);
@@ -2442,21 +2457,26 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision)
                for (j = k = 0; j < USBVISION_URB_FRAMES; j++,
                     k += usbvision->isocPacketSize) {
                        urb->iso_frame_desc[j].offset = k;
-                       urb->iso_frame_desc[j].length = usbvision->isocPacketSize;
+                       urb->iso_frame_desc[j].length =
+                               usbvision->isocPacketSize;
                }
        }
 
 
        /* Submit all URBs */
        for (bufIdx = 0; bufIdx < USBVISION_NUMSBUF; bufIdx++) {
-                       errCode = usb_submit_urb(usbvision->sbuf[bufIdx].urb, GFP_KERNEL);
+                       errCode = usb_submit_urb(usbvision->sbuf[bufIdx].urb,
+                                                GFP_KERNEL);
                if (errCode) {
-                       err("%s: usb_submit_urb(%d) failed: error %d", __FUNCTION__, bufIdx, errCode);
+                       err("%s: usb_submit_urb(%d) failed: error %d",
+                           __FUNCTION__, bufIdx, errCode);
                }
        }
 
        usbvision->streaming = Stream_Idle;
-       PDEBUG(DBG_ISOC, "%s: streaming=1 usbvision->video_endp=$%02x", __FUNCTION__, usbvision->video_endp);
+       PDEBUG(DBG_ISOC, "%s: streaming=1 usbvision->video_endp=$%02x",
+              __FUNCTION__,
+              usbvision->video_endp);
        return 0;
 }
 
@@ -2470,7 +2490,7 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision)
 void usbvision_stop_isoc(struct usb_usbvision *usbvision)
 {
        int bufIdx, errCode, regValue;
-       const int sb_size = USBVISION_URB_FRAMES * USBVISION_MAX_ISOC_PACKET_SIZE;
+       int sb_size = USBVISION_URB_FRAMES * usbvision->isocPacketSize;
 
        if ((usbvision->streaming == Stream_Off) || (usbvision->dev == NULL))
                return;
@@ -2499,15 +2519,19 @@ void usbvision_stop_isoc(struct usb_usbvision *usbvision)
                errCode = usb_set_interface(usbvision->dev, usbvision->iface,
                                            usbvision->ifaceAlt);
                if (errCode < 0) {
-                       err("%s: usb_set_interface() failed: error %d", __FUNCTION__, errCode);
+                       err("%s: usb_set_interface() failed: error %d",
+                           __FUNCTION__, errCode);
                        usbvision->last_error = errCode;
                }
-               regValue = (16 - usbvision_read_reg(usbvision, USBVISION_ALTER_REG)) & 0x0F;
-               usbvision->isocPacketSize = (regValue == 0) ? 0 : (regValue * 64) - 1;
-               PDEBUG(DBG_ISOC, "ISO Packet Length:%d", usbvision->isocPacketSize);
+               regValue = (16-usbvision_read_reg(usbvision, USBVISION_ALTER_REG)) & 0x0F;
+               usbvision->isocPacketSize =
+                       (regValue == 0) ? 0 : (regValue * 64) - 1;
+               PDEBUG(DBG_ISOC, "ISO Packet Length:%d",
+                      usbvision->isocPacketSize);
 
                usbvision->usb_bandwidth = regValue >> 1;
-               PDEBUG(DBG_ISOC, "USB Bandwidth Usage: %dMbit/Sec", usbvision->usb_bandwidth);
+               PDEBUG(DBG_ISOC, "USB Bandwidth Usage: %dMbit/Sec",
+                      usbvision->usb_bandwidth);
        }
 }
 
index bd6f6422ed5417053a61475ccab29e11bec02ea1..c759d00d701461272ee41552bfca254867ce2821 100644 (file)
 #define USBVISION_CLIPMASK_SIZE                (MAX_FRAME_WIDTH * MAX_FRAME_HEIGHT / 8) //bytesize of clipmask
 
 #define USBVISION_URB_FRAMES           32
-#define USBVISION_MAX_ISOC_PACKET_SIZE         959                     // NT1003 Specs Document says 1023
 
 #define USBVISION_NUM_HEADERMARKER     20
 #define USBVISION_NUMFRAMES            3  /* Maximum number of frames an application can get */
index c1dfd03d559ae27f0a246256ce4babbb3cffdc17..918477c490b0207bbc5a81733d0289b7f3b8ff76 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/mmc/host.h>
 #include <linux/mmc/card.h>
 #include <linux/mmc/mmc.h>
+#include <linux/mmc/sd.h>
 
 #include "core.h"
 #include "sysfs.h"
@@ -192,6 +193,16 @@ static int mmc_read_switch(struct mmc_card *card)
        int err;
        u8 *status;
 
+       if (card->scr.sda_vsn < SCR_SPEC_VER_1)
+               return MMC_ERR_NONE;
+
+       if (!(card->csd.cmdclass & CCC_SWITCH)) {
+               printk(KERN_WARNING "%s: card lacks mandatory switch "
+                       "function, performance might suffer.\n",
+                       mmc_hostname(card->host));
+               return MMC_ERR_NONE;
+       }
+
        err = MMC_ERR_FAILED;
 
        status = kmalloc(64, GFP_KERNEL);
@@ -204,10 +215,9 @@ static int mmc_read_switch(struct mmc_card *card)
 
        err = mmc_sd_switch(card, 0, 0, 1, status);
        if (err != MMC_ERR_NONE) {
-               /*
-                * Card not supporting high-speed will ignore the
-                * command.
-                */
+               printk(KERN_WARNING "%s: problem reading switch "
+                       "capabilities, performance might suffer.\n",
+                       mmc_hostname(card->host));
                err = MMC_ERR_NONE;
                goto out;
        }
@@ -229,6 +239,12 @@ static int mmc_switch_hs(struct mmc_card *card)
        int err;
        u8 *status;
 
+       if (card->scr.sda_vsn < SCR_SPEC_VER_1)
+               return MMC_ERR_NONE;
+
+       if (!(card->csd.cmdclass & CCC_SWITCH))
+               return MMC_ERR_NONE;
+
        if (!(card->host->caps & MMC_CAP_SD_HIGHSPEED))
                return MMC_ERR_NONE;
 
@@ -402,7 +418,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
        /*
         * Switch to wider bus (if supported).
         */
-       if ((host->caps && MMC_CAP_4_BIT_DATA) &&
+       if ((host->caps & MMC_CAP_4_BIT_DATA) &&
                (card->scr.bus_widths & SD_SCR_BUS_WIDTH_4)) {
                err = mmc_app_set_bus_width(card, MMC_BUS_WIDTH_4);
                if (err != MMC_ERR_NONE)
@@ -411,6 +427,21 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
                mmc_set_bus_width(host, MMC_BUS_WIDTH_4);
        }
 
+       /*
+        * Check if read-only switch is active.
+        */
+       if (!oldcard) {
+               if (!host->ops->get_ro) {
+                       printk(KERN_WARNING "%s: host does not "
+                               "support reading read-only "
+                               "switch. assuming write-enable.\n",
+                               mmc_hostname(host));
+               } else {
+                       if (host->ops->get_ro(host))
+                               mmc_card_set_readonly(card);
+               }
+       }
+
        if (!oldcard)
                host->card = card;
 
index e37943c314cbd7c954208130921349501db8cb18..5b00c194b6285a0bb76e7101765bf60bedceaf55 100644 (file)
@@ -417,7 +417,7 @@ static unsigned int at91_mci_send_command(struct at91mci_host *host, struct mmc_
                blocks = 0;
        }
 
-       if (cmd->opcode == MMC_STOP_TRANSMISSION)
+       if (host->flags & FL_SENT_STOP)
                cmdr |= AT91_MCI_TRCMD_STOP;
 
        if (host->bus_mode == MMC_BUSMODE_OPENDRAIN)
@@ -563,8 +563,7 @@ static void at91mci_completed_command(struct at91mci_host *host)
        if (status & (AT91_MCI_RINDE | AT91_MCI_RDIRE | AT91_MCI_RCRCE |
                        AT91_MCI_RENDE | AT91_MCI_RTOE | AT91_MCI_DCRCE |
                        AT91_MCI_DTOE | AT91_MCI_OVRE | AT91_MCI_UNRE)) {
-               if ((status & AT91_MCI_RCRCE) &&
-                       ((cmd->opcode == MMC_SEND_OP_COND) || (cmd->opcode == SD_APP_OP_COND))) {
+               if ((status & AT91_MCI_RCRCE) && !(mmc_resp_type(cmd) & MMC_RSP_CRC)) {
                        cmd->error = MMC_ERR_NONE;
                }
                else {
index f967226d7505fcc5ac49961241e8116aca8acbee..52b63f11ddd6498000003049ce95f67306e80ab7 100644 (file)
@@ -76,8 +76,7 @@ const struct {
 #endif
 };
 
-#define AU1XMMC_CONTROLLER_COUNT \
-       (sizeof(au1xmmc_card_table) / sizeof(au1xmmc_card_table[0]))
+#define AU1XMMC_CONTROLLER_COUNT (ARRAY_SIZE(au1xmmc_card_table))
 
 /* This array stores pointers for the hosts (used by the IRQ handler) */
 struct au1xmmc_host *au1xmmc_hosts[AU1XMMC_CONTROLLER_COUNT];
index 383bd54b34b524a77c8c9355affae3f5faa72c9d..b6a55e12a80ba226361dc2f6475e2571a74ca0fe 100644 (file)
@@ -524,28 +524,10 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id)
                }
 
                if (status & OMAP_MMC_STAT_CARD_ERR) {
-                       if (host->cmd && host->cmd->opcode == MMC_STOP_TRANSMISSION) {
-                               u32 response = OMAP_MMC_READ(host, RSP6)
-                                       | (OMAP_MMC_READ(host, RSP7) << 16);
-                               /* STOP sometimes sets must-ignore bits */
-                               if (!(response & (R1_CC_ERROR
-                                                               | R1_ILLEGAL_COMMAND
-                                                               | R1_COM_CRC_ERROR))) {
-                                       end_command = 1;
-                                       continue;
-                               }
-                       }
-
-                       dev_dbg(mmc_dev(host->mmc), "card status error (CMD%d)\n",
+                       dev_dbg(mmc_dev(host->mmc),
+                               "ignoring card status error (CMD%d)\n",
                                host->cmd->opcode);
-                       if (host->cmd) {
-                               host->cmd->error = MMC_ERR_FAILED;
-                               end_command = 1;
-                       }
-                       if (host->data) {
-                               host->data->error = MMC_ERR_FAILED;
-                               transfer_error = 1;
-                       }
+                       end_command = 1;
                }
 
                /*
index da7c3b0c533c5c55d937ee9dc2878d6be434cec7..ce3ed67a878e39af77ab5a95453406091b7c6e15 100644 (file)
@@ -54,8 +54,8 @@
 
 #define DRV_MODULE_NAME                "bnx2"
 #define PFX DRV_MODULE_NAME    ": "
-#define DRV_MODULE_VERSION     "1.5.10"
-#define DRV_MODULE_RELDATE     "May 1, 2007"
+#define DRV_MODULE_VERSION     "1.5.11"
+#define DRV_MODULE_RELDATE     "June 4, 2007"
 
 #define RUN_AT(x) (jiffies + (x))
 
@@ -1778,6 +1778,15 @@ bnx2_init_5709_context(struct bnx2 *bp)
        val = BNX2_CTX_COMMAND_ENABLED | BNX2_CTX_COMMAND_MEM_INIT | (1 << 12);
        val |= (BCM_PAGE_BITS - 8) << 16;
        REG_WR(bp, BNX2_CTX_COMMAND, val);
+       for (i = 0; i < 10; i++) {
+               val = REG_RD(bp, BNX2_CTX_COMMAND);
+               if (!(val & BNX2_CTX_COMMAND_MEM_INIT))
+                       break;
+               udelay(2);
+       }
+       if (val & BNX2_CTX_COMMAND_MEM_INIT)
+               return -EBUSY;
+
        for (i = 0; i < bp->ctx_pages; i++) {
                int j;
 
@@ -1811,6 +1820,7 @@ bnx2_init_context(struct bnx2 *bp)
        vcid = 96;
        while (vcid) {
                u32 vcid_addr, pcid_addr, offset;
+               int i;
 
                vcid--;
 
@@ -1831,16 +1841,20 @@ bnx2_init_context(struct bnx2 *bp)
                        pcid_addr = vcid_addr;
                }
 
-               REG_WR(bp, BNX2_CTX_VIRT_ADDR, 0x00);
-               REG_WR(bp, BNX2_CTX_PAGE_TBL, pcid_addr);
+               for (i = 0; i < (CTX_SIZE / PHY_CTX_SIZE); i++) {
+                       vcid_addr += (i << PHY_CTX_SHIFT);
+                       pcid_addr += (i << PHY_CTX_SHIFT);
 
-               /* Zero out the context. */
-               for (offset = 0; offset < PHY_CTX_SIZE; offset += 4) {
-                       CTX_WR(bp, 0x00, offset, 0);
-               }
+                       REG_WR(bp, BNX2_CTX_VIRT_ADDR, 0x00);
+                       REG_WR(bp, BNX2_CTX_PAGE_TBL, pcid_addr);
+
+                       /* Zero out the context. */
+                       for (offset = 0; offset < PHY_CTX_SIZE; offset += 4)
+                               CTX_WR(bp, 0x00, offset, 0);
 
-               REG_WR(bp, BNX2_CTX_VIRT_ADDR, vcid_addr);
-               REG_WR(bp, BNX2_CTX_PAGE_TBL, pcid_addr);
+                       REG_WR(bp, BNX2_CTX_VIRT_ADDR, vcid_addr);
+                       REG_WR(bp, BNX2_CTX_PAGE_TBL, pcid_addr);
+               }
        }
 }
 
@@ -3691,9 +3705,11 @@ bnx2_init_chip(struct bnx2 *bp)
 
        /* Initialize context mapping and zero out the quick contexts.  The
         * context block must have already been enabled. */
-       if (CHIP_NUM(bp) == CHIP_NUM_5709)
-               bnx2_init_5709_context(bp);
-       else
+       if (CHIP_NUM(bp) == CHIP_NUM_5709) {
+               rc = bnx2_init_5709_context(bp);
+               if (rc)
+                       return rc;
+       } else
                bnx2_init_context(bp);
 
        if ((rc = bnx2_init_cpus(bp)) != 0)
@@ -3772,7 +3788,10 @@ bnx2_init_chip(struct bnx2 *bp)
        REG_WR(bp, BNX2_HC_CMD_TICKS,
               (bp->cmd_ticks_int << 16) | bp->cmd_ticks);
 
-       REG_WR(bp, BNX2_HC_STATS_TICKS, bp->stats_ticks & 0xffff00);
+       if (CHIP_NUM(bp) == CHIP_NUM_5708)
+               REG_WR(bp, BNX2_HC_STATS_TICKS, 0);
+       else
+               REG_WR(bp, BNX2_HC_STATS_TICKS, bp->stats_ticks & 0xffff00);
        REG_WR(bp, BNX2_HC_STAT_COLLECT_TICKS, 0xbb8);  /* 3ms */
 
        if (CHIP_ID(bp) == CHIP_ID_5706_A1)
@@ -3799,6 +3818,11 @@ bnx2_init_chip(struct bnx2 *bp)
        /* Initialize the receive filter. */
        bnx2_set_rx_mode(bp->dev);
 
+       if (CHIP_NUM(bp) == CHIP_NUM_5709) {
+               val = REG_RD(bp, BNX2_MISC_NEW_CORE_CTL);
+               val |= BNX2_MISC_NEW_CORE_CTL_DMA_ENABLE;
+               REG_WR(bp, BNX2_MISC_NEW_CORE_CTL, val);
+       }
        rc = bnx2_fw_sync(bp, BNX2_DRV_MSG_DATA_WAIT2 | BNX2_DRV_MSG_CODE_RESET,
                          0);
 
@@ -4620,6 +4644,11 @@ bnx2_timer(unsigned long data)
 
        bp->stats_blk->stat_FwRxDrop = REG_RD_IND(bp, BNX2_FW_RX_DROP_COUNT);
 
+       /* workaround occasional corrupted counters */
+       if (CHIP_NUM(bp) == CHIP_NUM_5708 && bp->stats_ticks)
+               REG_WR(bp, BNX2_HC_COMMAND, bp->hc_cmd |
+                                           BNX2_HC_COMMAND_STATS_NOW);
+
        if (bp->phy_flags & PHY_SERDES_FLAG) {
                if (CHIP_NUM(bp) == CHIP_NUM_5706)
                        bnx2_5706_serdes_timer(bp);
@@ -5417,6 +5446,10 @@ bnx2_set_coalesce(struct net_device *dev, struct ethtool_coalesce *coal)
                0xff;
 
        bp->stats_ticks = coal->stats_block_coalesce_usecs;
+       if (CHIP_NUM(bp) == CHIP_NUM_5708) {
+               if (bp->stats_ticks != 0 && bp->stats_ticks != USEC_PER_SEC)
+                       bp->stats_ticks = USEC_PER_SEC;
+       }
        if (bp->stats_ticks > 0xffff00) bp->stats_ticks = 0xffff00;
        bp->stats_ticks &= 0xffff00;
 
index bd6288d6350f87d505df811c0a9ee7e372799cec..49a5de253b17ff1af7f18fcfc7c92cacc0e7a2cb 100644 (file)
@@ -1373,6 +1373,7 @@ struct l2_fhdr {
 #define BNX2_MISC_NEW_CORE_CTL                         0x000008c8
 #define BNX2_MISC_NEW_CORE_CTL_LINK_HOLDOFF_SUCCESS     (1L<<0)
 #define BNX2_MISC_NEW_CORE_CTL_LINK_HOLDOFF_REQ                 (1L<<1)
+#define BNX2_MISC_NEW_CORE_CTL_DMA_ENABLE               (1L<<16)
 #define BNX2_MISC_NEW_CORE_CTL_RESERVED_CMN             (0x3fffL<<2)
 #define BNX2_MISC_NEW_CORE_CTL_RESERVED_TC              (0xffffL<<16)
 
index 61696637a21edcc0b646e1c8894c3b89f632dadd..763810c7f33aa1e3bb682e1afdc780ac18ca8ce1 100644 (file)
@@ -285,6 +285,12 @@ enum scb_status {
        rus_mask         = 0x3C,
 };
 
+enum ru_state  {
+       RU_SUSPENDED = 0,
+       RU_RUNNING       = 1,
+       RU_UNINITIALIZED = -1,
+};
+
 enum scb_stat_ack {
        stat_ack_not_ours    = 0x00,
        stat_ack_sw_gen      = 0x04,
@@ -526,6 +532,7 @@ struct nic {
        struct rx *rx_to_use;
        struct rx *rx_to_clean;
        struct rfd blank_rfd;
+       enum ru_state ru_running;
 
        spinlock_t cb_lock                      ____cacheline_aligned;
        spinlock_t cmd_lock;
@@ -947,7 +954,7 @@ static void e100_get_defaults(struct nic *nic)
                ((nic->mac >= mac_82558_D101_A4) ? cb_cid : cb_i));
 
        /* Template for a freshly allocated RFD */
-       nic->blank_rfd.command = cpu_to_le16(cb_el & cb_s);
+       nic->blank_rfd.command = cpu_to_le16(cb_el);
        nic->blank_rfd.rbd = 0xFFFFFFFF;
        nic->blank_rfd.size = cpu_to_le16(VLAN_ETH_FRAME_LEN);
 
@@ -1742,11 +1749,19 @@ static int e100_alloc_cbs(struct nic *nic)
        return 0;
 }
 
-static inline void e100_start_receiver(struct nic *nic)
+static inline void e100_start_receiver(struct nic *nic, struct rx *rx)
 {
-       /* Start if RFA is non-NULL */
-       if(nic->rx_to_clean->skb)
-               e100_exec_cmd(nic, ruc_start, nic->rx_to_clean->dma_addr);
+       if(!nic->rxs) return;
+       if(RU_SUSPENDED != nic->ru_running) return;
+
+       /* handle init time starts */
+       if(!rx) rx = nic->rxs;
+
+       /* (Re)start RU if suspended or idle and RFA is non-NULL */
+       if(rx->skb) {
+               e100_exec_cmd(nic, ruc_start, rx->dma_addr);
+               nic->ru_running = RU_RUNNING;
+       }
 }
 
 #define RFD_BUF_LEN (sizeof(struct rfd) + VLAN_ETH_FRAME_LEN)
@@ -1775,7 +1790,7 @@ static int e100_rx_alloc_skb(struct nic *nic, struct rx *rx)
                put_unaligned(cpu_to_le32(rx->dma_addr),
                        (u32 *)&prev_rfd->link);
                wmb();
-               prev_rfd->command &= ~cpu_to_le16(cb_el & cb_s);
+               prev_rfd->command &= ~cpu_to_le16(cb_el);
                pci_dma_sync_single_for_device(nic->pdev, rx->prev->dma_addr,
                        sizeof(struct rfd), PCI_DMA_TODEVICE);
        }
@@ -1813,6 +1828,10 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
        pci_unmap_single(nic->pdev, rx->dma_addr,
                RFD_BUF_LEN, PCI_DMA_FROMDEVICE);
 
+       /* this allows for a fast restart without re-enabling interrupts */
+       if(le16_to_cpu(rfd->command) & cb_el)
+               nic->ru_running = RU_SUSPENDED;
+
        /* Pull off the RFD and put the actual data (minus eth hdr) */
        skb_reserve(skb, sizeof(struct rfd));
        skb_put(skb, actual_size);
@@ -1843,18 +1862,45 @@ static void e100_rx_clean(struct nic *nic, unsigned int *work_done,
        unsigned int work_to_do)
 {
        struct rx *rx;
+       int restart_required = 0;
+       struct rx *rx_to_start = NULL;
+
+       /* are we already rnr? then pay attention!!! this ensures that
+        * the state machine progression never allows a start with a
+        * partially cleaned list, avoiding a race between hardware
+        * and rx_to_clean when in NAPI mode */
+       if(RU_SUSPENDED == nic->ru_running)
+               restart_required = 1;
 
        /* Indicate newly arrived packets */
        for(rx = nic->rx_to_clean; rx->skb; rx = nic->rx_to_clean = rx->next) {
-               if(e100_rx_indicate(nic, rx, work_done, work_to_do))
+               int err = e100_rx_indicate(nic, rx, work_done, work_to_do);
+               if(-EAGAIN == err) {
+                       /* hit quota so have more work to do, restart once
+                        * cleanup is complete */
+                       restart_required = 0;
+                       break;
+               } else if(-ENODATA == err)
                        break; /* No more to clean */
        }
 
+       /* save our starting point as the place we'll restart the receiver */
+       if(restart_required)
+               rx_to_start = nic->rx_to_clean;
+
        /* Alloc new skbs to refill list */
        for(rx = nic->rx_to_use; !rx->skb; rx = nic->rx_to_use = rx->next) {
                if(unlikely(e100_rx_alloc_skb(nic, rx)))
                        break; /* Better luck next time (see watchdog) */
        }
+
+       if(restart_required) {
+               // ack the rnr?
+               writeb(stat_ack_rnr, &nic->csr->scb.stat_ack);
+               e100_start_receiver(nic, rx_to_start);
+               if(work_done)
+                       (*work_done)++;
+       }
 }
 
 static void e100_rx_clean_list(struct nic *nic)
@@ -1862,6 +1908,8 @@ static void e100_rx_clean_list(struct nic *nic)
        struct rx *rx;
        unsigned int i, count = nic->params.rfds.count;
 
+       nic->ru_running = RU_UNINITIALIZED;
+
        if(nic->rxs) {
                for(rx = nic->rxs, i = 0; i < count; rx++, i++) {
                        if(rx->skb) {
@@ -1883,6 +1931,7 @@ static int e100_rx_alloc_list(struct nic *nic)
        unsigned int i, count = nic->params.rfds.count;
 
        nic->rx_to_use = nic->rx_to_clean = NULL;
+       nic->ru_running = RU_UNINITIALIZED;
 
        if(!(nic->rxs = kcalloc(count, sizeof(struct rx), GFP_ATOMIC)))
                return -ENOMEM;
@@ -1897,6 +1946,7 @@ static int e100_rx_alloc_list(struct nic *nic)
        }
 
        nic->rx_to_use = nic->rx_to_clean = nic->rxs;
+       nic->ru_running = RU_SUSPENDED;
 
        return 0;
 }
@@ -1916,6 +1966,10 @@ static irqreturn_t e100_intr(int irq, void *dev_id)
        /* Ack interrupt(s) */
        iowrite8(stat_ack, &nic->csr->scb.stat_ack);
 
+       /* We hit Receive No Resource (RNR); restart RU after cleaning */
+       if(stat_ack & stat_ack_rnr)
+               nic->ru_running = RU_SUSPENDED;
+
        if(likely(netif_rx_schedule_prep(netdev))) {
                e100_disable_irq(nic);
                __netif_rx_schedule(netdev);
@@ -2007,7 +2061,7 @@ static int e100_up(struct nic *nic)
        if((err = e100_hw_init(nic)))
                goto err_clean_cbs;
        e100_set_multicast_list(nic->netdev);
-       e100_start_receiver(nic);
+       e100_start_receiver(nic, NULL);
        mod_timer(&nic->watchdog, jiffies);
        if((err = request_irq(nic->pdev->irq, e100_intr, IRQF_SHARED,
                nic->netdev->name, nic->netdev)))
@@ -2088,7 +2142,7 @@ static int e100_loopback_test(struct nic *nic, enum loopback loopback_mode)
                mdio_write(nic->netdev, nic->mii.phy_id, MII_BMCR,
                        BMCR_LOOPBACK);
 
-       e100_start_receiver(nic);
+       e100_start_receiver(nic, NULL);
 
        if(!(skb = netdev_alloc_skb(nic->netdev, ETH_DATA_LEN))) {
                err = -ENOMEM;
index e85a933a47625e68bee0704b17d2a5675ac7d492..c0f81b5a30fb4737b0b89839d9d3cb93ae62b591 100644 (file)
@@ -39,7 +39,7 @@
 #include <asm/io.h>
 
 #define DRV_NAME       "ehea"
-#define DRV_VERSION    "EHEA_0061"
+#define DRV_VERSION    "EHEA_0064"
 
 #define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \
        | NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR)
index 152bb2016a2c94998e68c0094ab64d9425582dc7..9e13433a268a7a40c360a17ed7904281a89e245b 100644 (file)
@@ -451,7 +451,8 @@ static struct ehea_cqe *ehea_proc_rwqes(struct net_device *dev,
                                processed_rq3++;
                        }
 
-                       if (cqe->status & EHEA_CQE_VLAN_TAG_XTRACT)
+                       if ((cqe->status & EHEA_CQE_VLAN_TAG_XTRACT)
+                           && port->vgrp)
                                vlan_hwaccel_receive_skb(skb, port->vgrp,
                                                         cqe->vlan_tag);
                        else
@@ -1910,10 +1911,7 @@ static void ehea_vlan_rx_register(struct net_device *dev,
                goto out;
        }
 
-       if (grp)
-               memset(cb1->vlan_filter, 0, sizeof(cb1->vlan_filter));
-       else
-               memset(cb1->vlan_filter, 0xFF, sizeof(cb1->vlan_filter));
+       memset(cb1->vlan_filter, 0, sizeof(cb1->vlan_filter));
 
        hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id,
                                       H_PORT_CB1, H_PORT_CB1_ALL, cb1);
@@ -1947,7 +1945,7 @@ static void ehea_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
        }
 
        index = (vid / 64);
-       cb1->vlan_filter[index] |= ((u64)(1 << (vid & 0x3F)));
+       cb1->vlan_filter[index] |= ((u64)(0x8000000000000000 >> (vid & 0x3F)));
 
        hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id,
                                       H_PORT_CB1, H_PORT_CB1_ALL, cb1);
@@ -1982,7 +1980,7 @@ static void ehea_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
        }
 
        index = (vid / 64);
-       cb1->vlan_filter[index] &= ~((u64)(1 << (vid & 0x3F)));
+       cb1->vlan_filter[index] &= ~((u64)(0x8000000000000000 >> (vid & 0x3F)));
 
        hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id,
                                       H_PORT_CB1, H_PORT_CB1_ALL, cb1);
index 3bec0f733f01e6a882bc60be9ee51cce807e965d..6ec3d500f3341ac491519c60d27d2f2c1b936c45 100644 (file)
@@ -915,17 +915,36 @@ static int ibmveth_change_mtu(struct net_device *dev, int new_mtu)
 {
        struct ibmveth_adapter *adapter = dev->priv;
        int new_mtu_oh = new_mtu + IBMVETH_BUFF_OH;
-       int i;
+       int reinit = 0;
+       int i, rc;
 
        if (new_mtu < IBMVETH_MAX_MTU)
                return -EINVAL;
 
+       for (i = 0; i < IbmVethNumBufferPools; i++)
+               if (new_mtu_oh < adapter->rx_buff_pool[i].buff_size)
+                       break;
+
+       if (i == IbmVethNumBufferPools)
+               return -EINVAL;
+
        /* Look for an active buffer pool that can hold the new MTU */
        for(i = 0; i<IbmVethNumBufferPools; i++) {
-               if (!adapter->rx_buff_pool[i].active)
-                       continue;
+               if (!adapter->rx_buff_pool[i].active) {
+                       adapter->rx_buff_pool[i].active = 1;
+                       reinit = 1;
+               }
+
                if (new_mtu_oh < adapter->rx_buff_pool[i].buff_size) {
-                       dev->mtu = new_mtu;
+                       if (reinit && netif_running(adapter->netdev)) {
+                               adapter->pool_config = 1;
+                               ibmveth_close(adapter->netdev);
+                               adapter->pool_config = 0;
+                               dev->mtu = new_mtu;
+                               if ((rc = ibmveth_open(adapter->netdev)))
+                                       return rc;
+                       } else
+                               dev->mtu = new_mtu;
                        return 0;
                }
        }
@@ -1243,16 +1262,19 @@ const char * buf, size_t count)
 
        if (attr == &veth_active_attr) {
                if (value && !pool->active) {
-                       if(ibmveth_alloc_buffer_pool(pool)) {
-                                ibmveth_error_printk("unable to alloc pool\n");
-                                return -ENOMEM;
-                        }
-                       pool->active = 1;
-                       adapter->pool_config = 1;
-                       ibmveth_close(netdev);
-                       adapter->pool_config = 0;
-                       if ((rc = ibmveth_open(netdev)))
-                               return rc;
+                       if (netif_running(netdev)) {
+                               if(ibmveth_alloc_buffer_pool(pool)) {
+                                       ibmveth_error_printk("unable to alloc pool\n");
+                                       return -ENOMEM;
+                               }
+                               pool->active = 1;
+                               adapter->pool_config = 1;
+                               ibmveth_close(netdev);
+                               adapter->pool_config = 0;
+                               if ((rc = ibmveth_open(netdev)))
+                                       return rc;
+                       } else
+                               pool->active = 1;
                } else if (!value && pool->active) {
                        int mtu = netdev->mtu + IBMVETH_BUFF_OH;
                        int i;
@@ -1281,23 +1303,29 @@ const char * buf, size_t count)
                if (value <= 0 || value > IBMVETH_MAX_POOL_COUNT)
                        return -EINVAL;
                else {
-                       adapter->pool_config = 1;
-                       ibmveth_close(netdev);
-                       adapter->pool_config = 0;
-                       pool->size = value;
-                       if ((rc = ibmveth_open(netdev)))
-                               return rc;
+                       if (netif_running(netdev)) {
+                               adapter->pool_config = 1;
+                               ibmveth_close(netdev);
+                               adapter->pool_config = 0;
+                               pool->size = value;
+                               if ((rc = ibmveth_open(netdev)))
+                                       return rc;
+                       } else
+                               pool->size = value;
                }
        } else if (attr == &veth_size_attr) {
                if (value <= IBMVETH_BUFF_OH || value > IBMVETH_MAX_BUF_SIZE)
                        return -EINVAL;
                else {
-                       adapter->pool_config = 1;
-                       ibmveth_close(netdev);
-                       adapter->pool_config = 0;
-                       pool->buff_size = value;
-                       if ((rc = ibmveth_open(netdev)))
-                               return rc;
+                       if (netif_running(netdev)) {
+                               adapter->pool_config = 1;
+                               ibmveth_close(netdev);
+                               adapter->pool_config = 0;
+                               pool->buff_size = value;
+                               if ((rc = ibmveth_open(netdev)))
+                                       return rc;
+                       } else
+                               pool->buff_size = value;
                }
        }
 
index 6b49fc4bd1a1c9b475c779f512209d174bbefbce..741780e14b2cc64f026a56dfcaf7c6e4085529ba 100644 (file)
@@ -83,6 +83,7 @@
 #include <linux/init.h>
 #include <linux/types.h>
 #include <linux/bitops.h>
+#include <linux/dma-mapping.h>
 
 #include <asm/io.h>
 #include <asm/pgtable.h>
index 437d78ad0912b3fbe9cfcedeeb0150cd6d151c2c..39253d0c1590eca709e54f5bab833990926e0860 100644 (file)
@@ -61,7 +61,7 @@ struct mlx4_cq_context {
        __be32                  solicit_producer_index;
        __be32                  consumer_index;
        __be32                  producer_index;
-       u                     reserved6[2];
+       u32                     reserved6[2];
        __be64                  db_rec_addr;
 };
 
index 0f11adb8eb4a3be6c0ff670d1745ea815a6ff434..27a82cecd6930bc5fe7b7baf41f8388bbf882d73 100644 (file)
@@ -490,9 +490,11 @@ static void mlx4_free_irqs(struct mlx4_dev *dev)
 
        if (eq_table->have_irq)
                free_irq(dev->pdev->irq, dev);
-       for (i = 0; i < MLX4_NUM_EQ; ++i)
+       for (i = 0; i < MLX4_EQ_CATAS; ++i)
                if (eq_table->eq[i].have_irq)
                        free_irq(eq_table->eq[i].irq, eq_table->eq + i);
+       if (eq_table->eq[MLX4_EQ_CATAS].have_irq)
+               free_irq(eq_table->eq[MLX4_EQ_CATAS].irq, dev);
 }
 
 static int __devinit mlx4_map_clr_int(struct mlx4_dev *dev)
index cfa5cc0723397315c2c011e45697bec0d36b48fa..e7ca118c8dfda2aed8ab20c6982b31f31b00fbd9 100644 (file)
 #include "fw.h"
 #include "icm.h"
 
+enum {
+       MLX4_COMMAND_INTERFACE_REV      = 1
+};
+
 extern void __buggy_use_of_MLX4_GET(void);
 extern void __buggy_use_of_MLX4_PUT(void);
 
@@ -452,10 +456,12 @@ int mlx4_QUERY_FW(struct mlx4_dev *dev)
        u32 *outbox;
        int err = 0;
        u64 fw_ver;
+       u16 cmd_if_rev;
        u8 lg;
 
 #define QUERY_FW_OUT_SIZE             0x100
 #define QUERY_FW_VER_OFFSET            0x00
+#define QUERY_FW_CMD_IF_REV_OFFSET     0x0a
 #define QUERY_FW_MAX_CMD_OFFSET        0x0f
 #define QUERY_FW_ERR_START_OFFSET      0x30
 #define QUERY_FW_ERR_SIZE_OFFSET       0x38
@@ -477,21 +483,36 @@ int mlx4_QUERY_FW(struct mlx4_dev *dev)
 
        MLX4_GET(fw_ver, outbox, QUERY_FW_VER_OFFSET);
        /*
-        * FW subminor version is at more signifant bits than minor
+        * FW subminor version is at more significant bits than minor
         * version, so swap here.
         */
        dev->caps.fw_ver = (fw_ver & 0xffff00000000ull) |
                ((fw_ver & 0xffff0000ull) >> 16) |
                ((fw_ver & 0x0000ffffull) << 16);
 
+       MLX4_GET(cmd_if_rev, outbox, QUERY_FW_CMD_IF_REV_OFFSET);
+       if (cmd_if_rev != MLX4_COMMAND_INTERFACE_REV) {
+               mlx4_err(dev, "Installed FW has unsupported "
+                        "command interface revision %d.\n",
+                        cmd_if_rev);
+               mlx4_err(dev, "(Installed FW version is %d.%d.%03d)\n",
+                        (int) (dev->caps.fw_ver >> 32),
+                        (int) (dev->caps.fw_ver >> 16) & 0xffff,
+                        (int) dev->caps.fw_ver & 0xffff);
+               mlx4_err(dev, "This driver version supports only revision %d.\n",
+                        MLX4_COMMAND_INTERFACE_REV);
+               err = -ENODEV;
+               goto out;
+       }
+
        MLX4_GET(lg, outbox, QUERY_FW_MAX_CMD_OFFSET);
        cmd->max_cmds = 1 << lg;
 
-       mlx4_dbg(dev, "FW version %d.%d.%03d, max commands %d\n",
+       mlx4_dbg(dev, "FW version %d.%d.%03d (cmd intf rev %d), max commands %d\n",
                 (int) (dev->caps.fw_ver >> 32),
                 (int) (dev->caps.fw_ver >> 16) & 0xffff,
                 (int) dev->caps.fw_ver & 0xffff,
-                cmd->max_cmds);
+                cmd_if_rev, cmd->max_cmds);
 
        MLX4_GET(fw->catas_offset, outbox, QUERY_FW_ERR_START_OFFSET);
        MLX4_GET(fw->catas_size,   outbox, QUERY_FW_ERR_SIZE_OFFSET);
index 65854f9e9c76c0fe67ba87dc02b90b72a2f4b3c8..9ae951bf6aa681116bc914db52699d62e6857d19 100644 (file)
@@ -135,9 +135,6 @@ int mlx4_register_device(struct mlx4_dev *dev)
        struct mlx4_priv *priv = mlx4_priv(dev);
        struct mlx4_interface *intf;
 
-       INIT_LIST_HEAD(&priv->ctx_list);
-       spin_lock_init(&priv->ctx_lock);
-
        mutex_lock(&intf_mutex);
 
        list_add_tail(&priv->dev_list, &dev_list);
index 20b8c0d3ced42bf4fad98df36508fc8483b429f0..d4172937025b05afbd26765a297e53b338c2a066 100644 (file)
@@ -787,6 +787,8 @@ static int __devinit mlx4_init_one(struct pci_dev *pdev,
 
        dev       = &priv->dev;
        dev->pdev = pdev;
+       INIT_LIST_HEAD(&priv->ctx_list);
+       spin_lock_init(&priv->ctx_lock);
 
        /*
         * Now reset the HCA before we touch the PCI capabilities or
index b33864dab179304dbafb88c1130e69a076d2c6e6..d0808fa3ec822c0d3b231202c535f673f891b597 100644 (file)
@@ -324,15 +324,17 @@ int mlx4_mr_enable(struct mlx4_dev *dev, struct mlx4_mr *mr)
                                       MLX4_MPT_FLAG_MIO         |
                                       MLX4_MPT_FLAG_REGION      |
                                       mr->access);
-       if (mr->mtt.order < 0)
-               mpt_entry->flags |= cpu_to_be32(MLX4_MPT_FLAG_PHYSICAL);
 
        mpt_entry->key         = cpu_to_be32(key_to_hw_index(mr->key));
        mpt_entry->pd          = cpu_to_be32(mr->pd);
        mpt_entry->start       = cpu_to_be64(mr->iova);
        mpt_entry->length      = cpu_to_be64(mr->size);
        mpt_entry->entity_size = cpu_to_be32(mr->mtt.page_shift);
-       mpt_entry->mtt_seg     = cpu_to_be64(mlx4_mtt_addr(dev, &mr->mtt));
+       if (mr->mtt.order < 0) {
+               mpt_entry->flags |= cpu_to_be32(MLX4_MPT_FLAG_PHYSICAL);
+               mpt_entry->mtt_seg = 0;
+       } else
+               mpt_entry->mtt_seg = cpu_to_be64(mlx4_mtt_addr(dev, &mr->mtt));
 
        err = mlx4_SW2HW_MPT(dev, mailbox,
                             key_to_hw_index(mr->key) & (dev->caps.num_mpts - 1));
index b53b7ad999bcb58290b5f790b3afcb15b7eddbb0..0f9904fe3a5a2b4273ffe5901846f627233fa818 100644 (file)
@@ -71,7 +71,7 @@
 #include "myri10ge_mcp.h"
 #include "myri10ge_mcp_gen_header.h"
 
-#define MYRI10GE_VERSION_STR "1.3.0-1.233"
+#define MYRI10GE_VERSION_STR "1.3.1-1.248"
 
 MODULE_DESCRIPTION("Myricom 10G driver (10GbE)");
 MODULE_AUTHOR("Maintainer: help@myri.com");
@@ -279,6 +279,8 @@ static int myri10ge_fill_thresh = 256;
 module_param(myri10ge_fill_thresh, int, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(myri10ge_fill_thresh, "Number of empty rx slots allowed\n");
 
+static int myri10ge_reset_recover = 1;
+
 static int myri10ge_wcfifo = 0;
 module_param(myri10ge_wcfifo, int, S_IRUGO);
 MODULE_PARM_DESC(myri10ge_wcfifo, "Enable WC Fifo when WC is enabled\n");
@@ -1154,9 +1156,11 @@ static inline void myri10ge_check_statblock(struct myri10ge_priv *mgp)
        struct mcp_irq_data *stats = mgp->fw_stats;
 
        if (unlikely(stats->stats_updated)) {
-               if (mgp->link_state != stats->link_up) {
-                       mgp->link_state = stats->link_up;
-                       if (mgp->link_state) {
+               unsigned link_up = ntohl(stats->link_up);
+               if (mgp->link_state != link_up) {
+                       mgp->link_state = link_up;
+
+                       if (mgp->link_state == MXGEFW_LINK_UP) {
                                if (netif_msg_link(mgp))
                                        printk(KERN_INFO
                                               "myri10ge: %s: link up\n",
@@ -1166,8 +1170,11 @@ static inline void myri10ge_check_statblock(struct myri10ge_priv *mgp)
                        } else {
                                if (netif_msg_link(mgp))
                                        printk(KERN_INFO
-                                              "myri10ge: %s: link down\n",
-                                              mgp->dev->name);
+                                              "myri10ge: %s: link %s\n",
+                                              mgp->dev->name,
+                                              (link_up == MXGEFW_LINK_MYRINET ?
+                                               "mismatch (Myrinet detected)" :
+                                               "down"));
                                netif_carrier_off(mgp->dev);
                                mgp->link_changes++;
                        }
@@ -2730,8 +2737,14 @@ static void myri10ge_watchdog(struct work_struct *work)
                 * For now, just report it */
                reboot = myri10ge_read_reboot(mgp);
                printk(KERN_ERR
-                      "myri10ge: %s: NIC rebooted (0x%x), resetting\n",
-                      mgp->dev->name, reboot);
+                      "myri10ge: %s: NIC rebooted (0x%x),%s resetting\n",
+                      mgp->dev->name, reboot,
+                      myri10ge_reset_recover ? " " : " not");
+               if (myri10ge_reset_recover == 0)
+                       return;
+
+               myri10ge_reset_recover--;
+
                /*
                 * A rebooted nic will come back with config space as
                 * it was after power was applied to PCIe bus.
index ad6688eab265f741c5e3b8b385b40c35fdc7fd17..91f25e0a638ea64c21fd42910e4c0a2880abf649 100644 (file)
 #define _NETXEN_NIC_LINUX_SUBVERSION 2
 #define NETXEN_NIC_LINUX_VERSIONID  "3.4.2"
 
-#define NUM_FLASH_SECTORS (64)
-#define FLASH_SECTOR_SIZE (64 * 1024)
-#define FLASH_TOTAL_SIZE  (NUM_FLASH_SECTORS * FLASH_SECTOR_SIZE)
+#define NETXEN_NUM_FLASH_SECTORS (64)
+#define NETXEN_FLASH_SECTOR_SIZE (64 * 1024)
+#define NETXEN_FLASH_TOTAL_SIZE  (NETXEN_NUM_FLASH_SECTORS \
+                                       * NETXEN_FLASH_SECTOR_SIZE)
 
 #define PHAN_VENDOR_ID 0x4040
 
@@ -677,28 +678,28 @@ struct netxen_new_user_info {
 
 /* Flash memory map */
 typedef enum {
-       CRBINIT_START = 0,      /* Crbinit section */
-       BRDCFG_START = 0x4000,  /* board config */
-       INITCODE_START = 0x6000,        /* pegtune code */
-       BOOTLD_START = 0x10000, /* bootld */
-       IMAGE_START = 0x43000,  /* compressed image */
-       SECONDARY_START = 0x200000,     /* backup images */
-       PXE_START = 0x3E0000,   /* user defined region */
-       USER_START = 0x3E8000,  /* User defined region for new boards */
-       FIXED_START = 0x3F0000  /* backup of crbinit */
+       NETXEN_CRBINIT_START = 0,       /* Crbinit section */
+       NETXEN_BRDCFG_START = 0x4000,   /* board config */
+       NETXEN_INITCODE_START = 0x6000, /* pegtune code */
+       NETXEN_BOOTLD_START = 0x10000,  /* bootld */
+       NETXEN_IMAGE_START = 0x43000,   /* compressed image */
+       NETXEN_SECONDARY_START = 0x200000,      /* backup images */
+       NETXEN_PXE_START = 0x3E0000,    /* user defined region */
+       NETXEN_USER_START = 0x3E8000,   /* User defined region for new boards */
+       NETXEN_FIXED_START = 0x3F0000   /* backup of crbinit */
 } netxen_flash_map_t;
 
-#define USER_START_OLD PXE_START       /* for backward compatibility */
-
-#define FLASH_START            (CRBINIT_START)
-#define INIT_SECTOR            (0)
-#define PRIMARY_START          (BOOTLD_START)
-#define FLASH_CRBINIT_SIZE     (0x4000)
-#define FLASH_BRDCFG_SIZE      (sizeof(struct netxen_board_info))
-#define FLASH_USER_SIZE                (sizeof(struct netxen_user_info)/sizeof(u32))
-#define FLASH_SECONDARY_SIZE   (USER_START-SECONDARY_START)
-#define NUM_PRIMARY_SECTORS    (0x20)
-#define NUM_CONFIG_SECTORS     (1)
+#define NETXEN_USER_START_OLD NETXEN_PXE_START /* for backward compatibility */
+
+#define NETXEN_FLASH_START             (NETXEN_CRBINIT_START)
+#define NETXEN_INIT_SECTOR             (0)
+#define NETXEN_PRIMARY_START           (NETXEN_BOOTLD_START)
+#define NETXEN_FLASH_CRBINIT_SIZE      (0x4000)
+#define NETXEN_FLASH_BRDCFG_SIZE       (sizeof(struct netxen_board_info))
+#define NETXEN_FLASH_USER_SIZE         (sizeof(struct netxen_user_info)/sizeof(u32))
+#define NETXEN_FLASH_SECONDARY_SIZE    (NETXEN_USER_START-NETXEN_SECONDARY_START)
+#define NETXEN_NUM_PRIMARY_SECTORS     (0x20)
+#define NETXEN_NUM_CONFIG_SECTORS      (1)
 #define PFX "NetXen: "
 extern char netxen_nic_driver_name[];
 
@@ -1048,6 +1049,7 @@ int netxen_rom_se(struct netxen_adapter *adapter, int addr);
 int netxen_do_rom_se(struct netxen_adapter *adapter, int addr);
 
 /* Functions from netxen_nic_isr.c */
+int netxen_nic_link_ok(struct netxen_adapter *adapter);
 void netxen_nic_isr_other(struct netxen_adapter *adapter);
 void netxen_indicate_link_status(struct netxen_adapter *adapter, u32 link);
 void netxen_handle_port_int(struct netxen_adapter *adapter, u32 enable);
index 16fabb377488977646ff83906424196c44003bd7..0175f6c353f625d732a1ac08e4e5392346578cfc 100644 (file)
@@ -94,7 +94,7 @@ static const char netxen_nic_gstrings_test[][ETH_GSTRING_LEN] = {
 
 static int netxen_nic_get_eeprom_len(struct net_device *dev)
 {
-       return FLASH_TOTAL_SIZE;
+       return NETXEN_FLASH_TOTAL_SIZE;
 }
 
 static void
@@ -470,7 +470,7 @@ netxen_nic_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
                return 0;
        }
 
-       if (offset == BOOTLD_START) {
+       if (offset == NETXEN_BOOTLD_START) {
                ret = netxen_flash_erase_primary(adapter);
                if (ret != FLASH_SUCCESS) {
                        printk(KERN_ERR "%s: Flash erase failed.\n", 
@@ -478,10 +478,10 @@ netxen_nic_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
                        return ret;
                }
 
-               ret = netxen_rom_se(adapter, USER_START);
+               ret = netxen_rom_se(adapter, NETXEN_USER_START);
                if (ret != FLASH_SUCCESS)
                        return ret;
-               ret = netxen_rom_se(adapter, FIXED_START);
+               ret = netxen_rom_se(adapter, NETXEN_FIXED_START);
                if (ret != FLASH_SUCCESS)
                        return ret;
 
index baff17a24d633ba8a5eec76c9ad7dab9b8a73aaa..c012764d114578a2414132370a7752ae9d7e8656 100644 (file)
@@ -257,7 +257,7 @@ u64 ctx_addr_sig_regs[][3] = {
 #define ADDR_IN_RANGE(addr, low, high) \
        (((addr) <= (high)) && ((addr) >= (low)))
 
-#define NETXEN_FLASH_BASE      (BOOTLD_START)
+#define NETXEN_FLASH_BASE      (NETXEN_BOOTLD_START)
 #define NETXEN_PHANTOM_MEM_BASE        (NETXEN_FLASH_BASE)
 #define NETXEN_MAX_MTU         8000 + NETXEN_ENET_HEADER_SIZE + NETXEN_ETH_FCS_SIZE
 #define NETXEN_MIN_MTU         64
@@ -611,7 +611,7 @@ int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, u64 mac[])
        u32 *pmac = (u32 *) & mac[0];
 
        if (netxen_get_flash_block(adapter,
-                                  USER_START +
+                                  NETXEN_USER_START +
                                   offsetof(struct netxen_new_user_info,
                                            mac_addr),
                                   FLASH_NUM_PORTS * sizeof(u64), pmac) == -1) {
@@ -619,7 +619,7 @@ int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, u64 mac[])
        }
        if (*mac == ~0ULL) {
                if (netxen_get_flash_block(adapter,
-                                          USER_START_OLD +
+                                          NETXEN_USER_START_OLD +
                                           offsetof(struct netxen_user_old_info,
                                                    mac_addr),
                                           FLASH_NUM_PORTS * sizeof(u64),
@@ -942,7 +942,7 @@ netxen_nic_pci_set_window(struct netxen_adapter *adapter,
 int
 netxen_nic_erase_pxe(struct netxen_adapter *adapter)
 {
-       if (netxen_rom_fast_write(adapter, PXE_START, 0) == -1) {
+       if (netxen_rom_fast_write(adapter, NETXEN_PXE_START, 0) == -1) {
                printk(KERN_ERR "%s: erase pxe failed\n", 
                        netxen_nic_driver_name);
                return -1;
@@ -953,7 +953,7 @@ netxen_nic_erase_pxe(struct netxen_adapter *adapter)
 int netxen_nic_get_board_info(struct netxen_adapter *adapter)
 {
        int rv = 0;
-       int addr = BRDCFG_START;
+       int addr = NETXEN_BRDCFG_START;
        struct netxen_board_info *boardinfo;
        int index;
        u32 *ptr32;
@@ -1115,7 +1115,7 @@ void netxen_nic_flash_print(struct netxen_adapter *adapter)
        u32 fw_build = 0;
        char brd_name[NETXEN_MAX_SHORT_NAME];
        struct netxen_new_user_info user_info;
-       int i, addr = USER_START;
+       int i, addr = NETXEN_USER_START;
        __le32 *ptr32;
 
        struct netxen_board_info *board_info = &(adapter->ahw.boardcfg);
index a36892457761321adaf634daa031d6d7dfd6afa5..bb23f4c360db39368db8681d8bb74289a5d760a7 100644 (file)
@@ -585,7 +585,7 @@ int netxen_backup_crbinit(struct netxen_adapter *adapter)
 {
        int ret = FLASH_SUCCESS;
        int val;
-       char *buffer = kmalloc(FLASH_SECTOR_SIZE, GFP_KERNEL);
+       char *buffer = kmalloc(NETXEN_FLASH_SECTOR_SIZE, GFP_KERNEL);
 
        if (!buffer)
                return -ENOMEM; 
@@ -601,13 +601,13 @@ int netxen_backup_crbinit(struct netxen_adapter *adapter)
                goto out_kfree;
 
        /* copy  sector 0 to sector 63 */
-       ret = netxen_rom_fast_read_words(adapter, CRBINIT_START, 
-                                               buffer, FLASH_SECTOR_SIZE);
+       ret = netxen_rom_fast_read_words(adapter, NETXEN_CRBINIT_START, 
+                                       buffer, NETXEN_FLASH_SECTOR_SIZE);
        if (ret != FLASH_SUCCESS)
                goto out_kfree;
 
-       ret = netxen_rom_fast_write_words(adapter, FIXED_START, 
-                                               buffer, FLASH_SECTOR_SIZE);
+       ret = netxen_rom_fast_write_words(adapter, NETXEN_FIXED_START, 
+                                       buffer, NETXEN_FLASH_SECTOR_SIZE);
        if (ret != FLASH_SUCCESS)
                goto out_kfree;
 
@@ -654,7 +654,8 @@ void check_erased_flash(struct netxen_adapter *adapter, int addr)
        int count = 0, erased_errors = 0;
        int range;
 
-       range = (addr == USER_START) ? FIXED_START : addr + FLASH_SECTOR_SIZE;
+       range = (addr == NETXEN_USER_START) ? 
+               NETXEN_FIXED_START : addr + NETXEN_FLASH_SECTOR_SIZE;
        
        for (i = addr; i < range; i += 4) {
                netxen_rom_fast_read(adapter, i, &val);
@@ -689,7 +690,7 @@ netxen_flash_erase_sections(struct netxen_adapter *adapter, int start, int end)
        int i;
 
        for (i = start; i < end; i++) {
-               ret = netxen_rom_se(adapter, i * FLASH_SECTOR_SIZE);
+               ret = netxen_rom_se(adapter, i * NETXEN_FLASH_SECTOR_SIZE);
                if (ret)
                        break;
                ret = netxen_rom_wip_poll(adapter);
@@ -706,8 +707,8 @@ netxen_flash_erase_secondary(struct netxen_adapter *adapter)
        int ret = FLASH_SUCCESS;
        int start, end;
 
-       start = SECONDARY_START / FLASH_SECTOR_SIZE;
-       end   = USER_START / FLASH_SECTOR_SIZE;
+       start = NETXEN_SECONDARY_START / NETXEN_FLASH_SECTOR_SIZE;
+       end   = NETXEN_USER_START / NETXEN_FLASH_SECTOR_SIZE;
        ret = netxen_flash_erase_sections(adapter, start, end);
 
        return ret;
@@ -719,8 +720,8 @@ netxen_flash_erase_primary(struct netxen_adapter *adapter)
        int ret = FLASH_SUCCESS;
        int start, end;
 
-       start = PRIMARY_START / FLASH_SECTOR_SIZE;
-       end   = SECONDARY_START / FLASH_SECTOR_SIZE;
+       start = NETXEN_PRIMARY_START / NETXEN_FLASH_SECTOR_SIZE;
+       end   = NETXEN_SECONDARY_START / NETXEN_FLASH_SECTOR_SIZE;
        ret = netxen_flash_erase_sections(adapter, start, end);
 
        return ret;
@@ -1036,18 +1037,23 @@ void netxen_watchdog_task(struct work_struct *work)
        if ((adapter->portnum  == 0) && netxen_nic_check_temp(adapter))
                return;
 
+       if (adapter->handle_phy_intr)
+               adapter->handle_phy_intr(adapter);
+
        netdev = adapter->netdev;
-       if ((netif_running(netdev)) && !netif_carrier_ok(netdev)) {
-               printk(KERN_INFO "%s port %d, %s carrier is now ok\n",
-                      netxen_nic_driver_name, adapter->portnum, netdev->name);
+       if ((netif_running(netdev)) && !netif_carrier_ok(netdev) &&
+                       netxen_nic_link_ok(adapter) ) {
+               printk(KERN_INFO "%s %s (port %d), Link is up\n",
+                              netxen_nic_driver_name, netdev->name, adapter->portnum);
                netif_carrier_on(netdev);
-       }
-
-       if (netif_queue_stopped(netdev))
                netif_wake_queue(netdev);
+       } else if(!(netif_running(netdev)) && netif_carrier_ok(netdev)) {
+               printk(KERN_ERR "%s %s Link is Down\n",
+                               netxen_nic_driver_name, netdev->name);
+               netif_carrier_off(netdev);
+               netif_stop_queue(netdev);
+       }
 
-       if (adapter->handle_phy_intr)
-               adapter->handle_phy_intr(adapter);
        mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ);
 }
 
index b213b062eb567fe777651c1c196ff5d716712a38..b2de6b6c2a7f1f2dc32a0414b823a272c10a1473 100644 (file)
@@ -169,6 +169,24 @@ void netxen_nic_gbe_handle_phy_intr(struct netxen_adapter *adapter)
        netxen_nic_isr_other(adapter);
 }
 
+int netxen_nic_link_ok(struct netxen_adapter *adapter)
+{
+       switch (adapter->ahw.board_type) {
+       case NETXEN_NIC_GBE:
+               return ((adapter->ahw.qg_linksup) & 1);
+
+       case NETXEN_NIC_XGBE:
+               return ((adapter->ahw.xg_linkup) & 1);
+
+       default:
+               printk(KERN_ERR"%s: Function: %s, Unknown board type\n",
+                       netxen_nic_driver_name, __FUNCTION__);
+               break;
+       }
+
+       return 0;
+}
+
 void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter)
 {
        struct net_device *netdev = adapter->netdev;
@@ -183,6 +201,10 @@ void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter)
                printk(KERN_INFO "%s: %s NIC Link is down\n",
                       netxen_nic_driver_name, netdev->name);
                adapter->ahw.xg_linkup = 0;
+               if (netif_running(netdev)) {
+                       netif_carrier_off(netdev);
+                       netif_stop_queue(netdev);
+               }
                /* read twice to clear sticky bits */
                /* WINDOW = 0 */
                netxen_nic_read_w0(adapter, NETXEN_NIU_XG_STATUS, &val1);
@@ -196,5 +218,7 @@ void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter)
                printk(KERN_INFO "%s: %s NIC Link is up\n",
                       netxen_nic_driver_name, netdev->name);
                adapter->ahw.xg_linkup = 1;
+               netif_carrier_on(netdev);
+               netif_wake_queue(netdev);
        }
 }
index c61181f23bd58dce16d347240b39da5f04f3fb40..6167b58d2731fea3d5941a424108e2033f98b51c 100644 (file)
@@ -542,6 +542,13 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                                NETXEN_ROMUSB_GLB_PEGTUNE_DONE));
                /* Handshake with the card before we register the devices. */
                netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE);
+
+              /* leave the hw in the same state as reboot */
+              writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE));
+              netxen_pinit_from_rom(adapter, 0);
+              udelay(500);
+              netxen_load_firmware(adapter);
+              netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE);
        }
 
        /*
index cef90a78351e91d51d5bb5f2c8c758cd979592bf..75102d30730f0cdecf3942485211cfbcfe5eb59f 100644 (file)
@@ -454,16 +454,12 @@ int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port)
 
 int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port)
 {
-       u32 reg;
        u32 portnum = physical_port[adapter->portnum];
 
        netxen_crb_writelit_adapter(adapter,
-               NETXEN_NIU_XGE_CONFIG_0+(0x10000*portnum), 0x5);
-       netxen_nic_hw_read_wx(adapter,
-               NETXEN_NIU_XGE_CONFIG_1+(0x10000*portnum), &reg, 4);
-       reg = (reg & ~0x2000UL);
+               NETXEN_NIU_XGE_CONFIG_1+(0x10000*portnum), 0x1447);
        netxen_crb_writelit_adapter(adapter,
-               NETXEN_NIU_XGE_CONFIG_1+(0x10000*portnum), reg);
+               NETXEN_NIU_XGE_CONFIG_0+(0x10000*portnum), 0x5);
 
        return 0;
 }
index 22aec5cce68310ab6e4128b2ec30435fcff5c375..b87f8d2a888bb409af90e36a99662c2310ad54d3 100644 (file)
 #define MII_M1111_PHY_LED_CONTROL      0x18
 #define MII_M1111_PHY_LED_DIRECT       0x4100
 #define MII_M1111_PHY_LED_COMBINE      0x411c
+#define MII_M1111_PHY_EXT_CR           0x14
+#define MII_M1111_RX_DELAY             0x80
+#define MII_M1111_TX_DELAY             0x2
+#define MII_M1111_PHY_EXT_SR           0x1b
+#define MII_M1111_HWCFG_MODE_MASK      0xf
+#define MII_M1111_HWCFG_MODE_RGMII     0xb
 
 MODULE_DESCRIPTION("Marvell PHY driver");
 MODULE_AUTHOR("Andy Fleming");
@@ -131,6 +137,45 @@ static int marvell_config_aneg(struct phy_device *phydev)
        return err;
 }
 
+static int m88e1111_config_init(struct phy_device *phydev)
+{
+       int err;
+
+       if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) ||
+           (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)) {
+               int temp;
+
+               if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) {
+                       temp = phy_read(phydev, MII_M1111_PHY_EXT_CR);
+                       if (temp < 0)
+                               return temp;
+
+                       temp |= (MII_M1111_RX_DELAY | MII_M1111_TX_DELAY);
+
+                       err = phy_write(phydev, MII_M1111_PHY_EXT_CR, temp);
+                       if (err < 0)
+                               return err;
+               }
+
+               temp = phy_read(phydev, MII_M1111_PHY_EXT_SR);
+               if (temp < 0)
+                       return temp;
+
+               temp &= ~(MII_M1111_HWCFG_MODE_MASK);
+               temp |= MII_M1111_HWCFG_MODE_RGMII;
+
+               err = phy_write(phydev, MII_M1111_PHY_EXT_SR, temp);
+               if (err < 0)
+                       return err;
+       }
+
+       err = phy_write(phydev, MII_BMCR, BMCR_RESET);
+       if (err < 0)
+               return err;
+
+       return 0;
+}
+
 static int m88e1145_config_init(struct phy_device *phydev)
 {
        int err;
@@ -152,7 +197,7 @@ static int m88e1145_config_init(struct phy_device *phydev)
        if (err < 0)
                return err;
 
-       if (phydev->interface == PHY_INTERFACE_MODE_RGMII) {
+       if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) {
                int temp = phy_read(phydev, MII_M1145_PHY_EXT_CR);
                if (temp < 0)
                        return temp;
@@ -206,7 +251,7 @@ static struct phy_driver m88e1101_driver = {
        .driver = {.owner = THIS_MODULE,},
 };
 
-static struct phy_driver m88e1111s_driver = {
+static struct phy_driver m88e1111_driver = {
        .phy_id = 0x01410cc0,
        .phy_id_mask = 0xfffffff0,
        .name = "Marvell 88E1111",
@@ -216,6 +261,7 @@ static struct phy_driver m88e1111s_driver = {
        .read_status = &genphy_read_status,
        .ack_interrupt = &marvell_ack_interrupt,
        .config_intr = &marvell_config_intr,
+       .config_init = &m88e1111_config_init,
        .driver = {.owner = THIS_MODULE,},
 };
 
@@ -241,9 +287,9 @@ static int __init marvell_init(void)
        if (ret)
                return ret;
 
-       ret = phy_driver_register(&m88e1111s_driver);
+       ret = phy_driver_register(&m88e1111_driver);
        if (ret)
-               goto err1111s;
+               goto err1111;
 
        ret = phy_driver_register(&m88e1145_driver);
        if (ret)
@@ -251,9 +297,9 @@ static int __init marvell_init(void)
 
        return 0;
 
-      err1145:
-       phy_driver_unregister(&m88e1111s_driver);
-      err1111s:
+err1145:
+       phy_driver_unregister(&m88e1111_driver);
+err1111:
        phy_driver_unregister(&m88e1101_driver);
        return ret;
 }
@@ -261,7 +307,7 @@ static int __init marvell_init(void)
 static void __exit marvell_exit(void)
 {
        phy_driver_unregister(&m88e1101_driver);
-       phy_driver_unregister(&m88e1111s_driver);
+       phy_driver_unregister(&m88e1111_driver);
        phy_driver_unregister(&m88e1145_driver);
 }
 
index d5bdd25746591a8b0bb47b2dca226b3fbca34fcf..5ae80bbe2edca0dcd698960553ed493e0a6dd4d9 100644 (file)
@@ -493,14 +493,14 @@ mppe_decompress(void *arg, unsigned char *ibuf, int isize, unsigned char *obuf,
 
        /*
         * Make sure we have enough room to decrypt the packet.
-        * Note that for our test we only subtract 1 byte whereas in
-        * mppe_compress() we added 2 bytes (+MPPE_OVHD);
-        * this is to account for possible PFC.
+        * To account for possible PFC we should only subtract 1
+        * byte whereas in mppe_compress() we added 2 bytes (+MPPE_OVHD);
+        * However, we assume no PFC, thus subtracting 2 bytes.
         */
-       if (osize < isize - MPPE_OVHD - 1) {
+       if (osize < isize - MPPE_OVHD - 2) {
                printk(KERN_DEBUG "mppe_decompress[%d]: osize too small! "
                       "(have: %d need: %d)\n", state->unit,
-                      osize, isize - MPPE_OVHD - 1);
+                      osize, isize - MPPE_OVHD - 2);
                return DECOMP_ERROR;
        }
        osize = isize - MPPE_OVHD - 2;  /* assume no PFC */
index 2bf25105cf7576f1c3293cd714b8aef36c1c8ce0..3f097c04e7dc685b7aa9edbdcba5704920fec086 100644 (file)
@@ -58,6 +58,8 @@
 #elif defined(CONFIG_BFIN)
 
 #define SMC_IRQ_FLAGS          IRQF_TRIGGER_HIGH
+#define RPC_LSA_DEFAULT                RPC_LED_100_10
+#define RPC_LSB_DEFAULT                RPC_LED_TX_RX
 
 # if defined (CONFIG_BFIN561_EZKIT)
 #define SMC_CAN_USE_8BIT       0
index 3de564b2314799b98a805d017f19ca2542db53e6..8dc09a3790cb4fe8b15d6595ae8cf0877bf850d7 100644 (file)
@@ -313,8 +313,8 @@ config USB_KC2190
        boolean "KT Technology KC2190 based cables (InstaNet)"
        depends on USB_NET_CDC_SUBSET && EXPERIMENTAL
        help
-        Â Choose this option if you're using a host-to-host cable
-        Â with one of these chips.
+         Choose this option if you're using a host-to-host cable
+         with one of these chips.
 
 config USB_NET_ZAURUS
        tristate "Sharp Zaurus (stock ROMs) and compatible"
index 25b75b615188ff521c238a0da54021cce20e9100..b670b97bcfde488a7de7a2e4bbe47985a0597a22 100644 (file)
@@ -1562,7 +1562,7 @@ static void velocity_print_link_status(struct velocity_info *vptr)
        if (vptr->mii_status & VELOCITY_LINK_FAIL) {
                VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: failed to detect cable link\n", vptr->dev->name);
        } else if (vptr->options.spd_dpx == SPD_DPX_AUTO) {
-               VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link autonegation", vptr->dev->name);
+               VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link auto-negotiation", vptr->dev->name);
 
                if (vptr->mii_status & VELOCITY_SPEED_1000)
                        VELOCITY_PRT(MSG_LEVEL_INFO, " speed 1000M bps");
index e3f5bb0fe603cf66eab0dc6118bbd1d6a4e34e21..fa2399cbd5cab472074b51d64a117bff1feb1d59 100644 (file)
@@ -266,16 +266,23 @@ config IPW2200_DEBUG
 
          If you are not sure, say N here.
 
-config LIBERTAS_USB
-       tristate "Marvell Libertas 8388 802.11a/b/g cards"
-       depends on USB && WLAN_80211
+config LIBERTAS
+       tristate "Marvell 8xxx Libertas WLAN driver support"
+       depends on WLAN_80211
+       select IEEE80211
        select FW_LOADER
+       ---help---
+         A library for Marvell Libertas 8xxx devices.
+
+config LIBERTAS_USB
+       tristate "Marvell Libertas 8388 USB 802.11b/g cards"
+       depends on LIBERTAS && USB
        ---help---
          A driver for Marvell Libertas 8388 USB devices.
 
-config LIBERTAS_USB_DEBUG
-       bool "Enable full debugging output in the Libertas USB module."
-       depends on LIBERTAS_USB
+config LIBERTAS_DEBUG
+       bool "Enable full debugging output in the Libertas module."
+       depends on LIBERTAS
        ---help---
          Debugging support.
 
index e0ecc4d483bb773edc269013ecb7000c8c17d869..4cf0ff7b833d6e77d6c99e5ba36c066f1b61b037 100644 (file)
@@ -95,7 +95,7 @@ static u8 wlan_get_chan_11d(u8 band, u8 firstchan, u8 nrchan, u8 * chan)
 
        for (i = 0; i < cfp_no; i++) {
                if ((cfp + i)->channel == firstchan) {
-                       lbs_pr_debug(1, "firstchan found\n");
+                       lbs_deb_11d("firstchan found\n");
                        break;
                }
        }
@@ -129,12 +129,12 @@ static u8 wlan_channel_known_11d(u8 chan,
 
        for (i = 0; i < nr_chan; i++) {
                if (chan == chanpwr[i].chan) {
-                       lbs_pr_debug(1, "11D: Found Chan:%d\n", chan);
+                       lbs_deb_11d("11D: Found Chan:%d\n", chan);
                        return 1;
                }
        }
 
-       lbs_pr_debug(1, "11D: Not Find Chan:%d\n", chan);
+       lbs_deb_11d("11D: Not Find Chan:%d\n", chan);
        return 0;
 }
 
@@ -174,7 +174,7 @@ static int generate_domain_info_11d(struct parsed_region_chan_11d
        memcpy(domaininfo->countrycode, parsed_region_chan->countrycode,
               COUNTRY_CODE_LEN);
 
-       lbs_pr_debug(1, "11D:nrchan=%d\n", nr_chan);
+       lbs_deb_11d("11D:nrchan=%d\n", nr_chan);
        lbs_dbg_hex("11D:parsed_region_chan:", (char *)parsed_region_chan,
                sizeof(struct parsed_region_chan_11d));
 
@@ -212,7 +212,7 @@ static int generate_domain_info_11d(struct parsed_region_chan_11d
        }
        domaininfo->nr_subband = nr_subband;
 
-       lbs_pr_debug(1, "nr_subband=%x\n", domaininfo->nr_subband);
+       lbs_deb_11d("nr_subband=%x\n", domaininfo->nr_subband);
        lbs_dbg_hex("11D:domaininfo:", (char *)domaininfo,
                COUNTRY_CODE_LEN + 1 +
                sizeof(struct ieeetypes_subbandset) * nr_subband);
@@ -233,13 +233,13 @@ static void wlan_generate_parsed_region_chan_11d(struct region_channel * region_
        struct chan_freq_power *cfp;
 
        if (region_chan == NULL) {
-               lbs_pr_debug(1, "11D: region_chan is NULL\n");
+               lbs_deb_11d("11D: region_chan is NULL\n");
                return;
        }
 
        cfp = region_chan->CFP;
        if (cfp == NULL) {
-               lbs_pr_debug(1, "11D: cfp equal NULL \n");
+               lbs_deb_11d("11D: cfp equal NULL \n");
                return;
        }
 
@@ -248,19 +248,19 @@ static void wlan_generate_parsed_region_chan_11d(struct region_channel * region_
        memcpy(parsed_region_chan->countrycode,
               wlan_code_2_region(region_chan->region), COUNTRY_CODE_LEN);
 
-       lbs_pr_debug(1, "11D: region[0x%x] band[%d]\n", parsed_region_chan->region,
+       lbs_deb_11d("11D: region[0x%x] band[%d]\n", parsed_region_chan->region,
               parsed_region_chan->band);
 
        for (i = 0; i < region_chan->nrcfp; i++, cfp++) {
                parsed_region_chan->chanpwr[i].chan = cfp->channel;
                parsed_region_chan->chanpwr[i].pwr = cfp->maxtxpower;
-               lbs_pr_debug(1, "11D: Chan[%d] Pwr[%d]\n",
+               lbs_deb_11d("11D: Chan[%d] Pwr[%d]\n",
                       parsed_region_chan->chanpwr[i].chan,
                       parsed_region_chan->chanpwr[i].pwr);
        }
        parsed_region_chan->nr_chan = region_chan->nrcfp;
 
-       lbs_pr_debug(1, "11D: nrchan[%d]\n", parsed_region_chan->nr_chan);
+       lbs_deb_11d("11D: nrchan[%d]\n", parsed_region_chan->nr_chan);
 
        return;
 }
@@ -277,8 +277,9 @@ static u8 wlan_region_chan_supported_11d(u8 region, u8 band, u8 chan)
        struct chan_freq_power *cfp;
        int cfp_no;
        u8 idx;
+       int ret = 0;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_11D);
 
        cfp = libertas_get_region_cfp_table(region, band, &cfp_no);
        if (cfp == NULL)
@@ -288,16 +289,19 @@ static u8 wlan_region_chan_supported_11d(u8 region, u8 band, u8 chan)
                if (chan == (cfp + idx)->channel) {
                        /* If Mrvl Chip Supported? */
                        if ((cfp + idx)->unsupported) {
-                               return 0;
+                               ret = 0;
                        } else {
-                               return 1;
+                               ret = 1;
                        }
+                       goto done;
                }
        }
 
        /*chan is not in the region table */
-       LEAVE();
-       return 0;
+
+done:
+       lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret);
+       return ret;
 }
 
 /**
@@ -321,7 +325,7 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
 
        u8 j, i;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_11D);
 
        /*validation Rules:
           1. valid region Code
@@ -337,15 +341,14 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
        if ((*(countryinfo->countrycode)) == 0
            || (countryinfo->len <= COUNTRY_CODE_LEN)) {
                /* No region Info or Wrong region info: treat as No 11D info */
-               LEAVE();
-               return 0;
+               goto done;
        }
 
        /*Step1: check region_code */
        parsed_region_chan->region = region =
            wlan_region_2_code(countryinfo->countrycode);
 
-       lbs_pr_debug(1, "regioncode=%x\n", (u8) parsed_region_chan->region);
+       lbs_deb_11d("regioncode=%x\n", (u8) parsed_region_chan->region);
        lbs_dbg_hex("CountryCode:", (char *)countryinfo->countrycode,
                COUNTRY_CODE_LEN);
 
@@ -361,7 +364,7 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
 
                if (countryinfo->subband[j].firstchan <= lastchan) {
                        /*Step2&3. Check First Chan Num increment and no overlap */
-                       lbs_pr_debug(1, "11D: Chan[%d>%d] Overlap\n",
+                       lbs_deb_11d("11D: Chan[%d>%d] Overlap\n",
                               countryinfo->subband[j].firstchan, lastchan);
                        continue;
                }
@@ -374,7 +377,7 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
 
                        if (!wlan_get_chan_11d(band, firstchan, i, &curchan)) {
                                /* Chan is not found in UN table */
-                               lbs_pr_debug(1, "chan is not supported: %d \n", i);
+                               lbs_deb_11d("chan is not supported: %d \n", i);
                                break;
                        }
 
@@ -389,7 +392,7 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
                                idx++;
                        } else {
                                /*not supported and ignore the chan */
-                               lbs_pr_debug(1,
+                               lbs_deb_11d(
                                       "11D:i[%d] chan[%d] unsupported in region[%x] band[%d]\n",
                                       i, curchan, region, band);
                        }
@@ -401,11 +404,12 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
 
        parsed_region_chan->nr_chan = idx;
 
-       lbs_pr_debug(1, "nrchan=%x\n", parsed_region_chan->nr_chan);
+       lbs_deb_11d("nrchan=%x\n", parsed_region_chan->nr_chan);
        lbs_dbg_hex("11D:parsed_region_chan:", (u8 *) parsed_region_chan,
                2 + COUNTRY_CODE_LEN + sizeof(struct parsed_region_chan_11d) * idx);
 
-       LEAVE();
+done:
+       lbs_deb_enter(LBS_DEB_11D);
        return 0;
 }
 
@@ -420,16 +424,16 @@ u8 libertas_get_scan_type_11d(u8 chan,
 {
        u8 scan_type = cmd_scan_type_passive;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_11D);
 
        if (wlan_channel_known_11d(chan, parsed_region_chan)) {
-               lbs_pr_debug(1, "11D: Found and do Active Scan\n");
+               lbs_deb_11d("11D: Found and do Active Scan\n");
                scan_type = cmd_scan_type_active;
        } else {
-               lbs_pr_debug(1, "11D: Not Find and do Passive Scan\n");
+               lbs_deb_11d("11D: Not Find and do Passive Scan\n");
        }
 
-       LEAVE();
+       lbs_deb_leave_args(LBS_DEB_11D, "ret scan_type %d", scan_type);
        return scan_type;
 
 }
@@ -456,7 +460,7 @@ static int wlan_enable_11d(wlan_private * priv, u8 flag)
                                    OID_802_11D_ENABLE,
                                    &priv->adapter->enable11d);
        if (ret)
-               lbs_pr_debug(1, "11D: Fail to enable 11D \n");
+               lbs_deb_11d("11D: Fail to enable 11D \n");
 
        return 0;
 }
@@ -471,7 +475,7 @@ static int set_domain_info_11d(wlan_private * priv)
        int ret;
 
        if (!priv->adapter->enable11d) {
-               lbs_pr_debug(1, "11D: dnld domain Info with 11d disabled\n");
+               lbs_deb_11d("11D: dnld domain Info with 11d disabled\n");
                return 0;
        }
 
@@ -479,7 +483,7 @@ static int set_domain_info_11d(wlan_private * priv)
                                    cmd_act_set,
                                    cmd_option_waitforrsp, 0, NULL);
        if (ret)
-               lbs_pr_debug(1, "11D: Fail to dnld domain Info\n");
+               lbs_deb_11d("11D: Fail to dnld domain Info\n");
 
        return ret;
 }
@@ -501,7 +505,7 @@ int libertas_set_universaltable(wlan_private * priv, u8 band)
 
        adapter->universal_channel[i].nrcfp =
            sizeof(channel_freq_power_UN_BG) / size;
-       lbs_pr_debug(1, "11D: BG-band nrcfp=%d\n",
+       lbs_deb_11d("11D: BG-band nrcfp=%d\n",
               adapter->universal_channel[i].nrcfp);
 
        adapter->universal_channel[i].CFP = channel_freq_power_UN_BG;
@@ -531,9 +535,9 @@ int libertas_cmd_802_11d_domain_info(wlan_private * priv,
        wlan_adapter *adapter = priv->adapter;
        u8 nr_subband = adapter->domainreg.nr_subband;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_11D);
 
-       lbs_pr_debug(1, "nr_subband=%x\n", nr_subband);
+       lbs_deb_11d("nr_subband=%x\n", nr_subband);
 
        cmd->command = cpu_to_le16(cmdno);
        pdomaininfo->action = cpu_to_le16(cmdoption);
@@ -542,8 +546,7 @@ int libertas_cmd_802_11d_domain_info(wlan_private * priv,
                    cpu_to_le16(sizeof(pdomaininfo->action) + S_DS_GEN);
                lbs_dbg_hex("11D: 802_11D_DOMAIN_INFO:", (u8 *) cmd,
                        (int)(cmd->size));
-               LEAVE();
-               return 0;
+               goto done;
        }
 
        domain->header.type = cpu_to_le16(TLV_TYPE_DOMAIN);
@@ -567,10 +570,10 @@ int libertas_cmd_802_11d_domain_info(wlan_private * priv,
                    cpu_to_le16(sizeof(pdomaininfo->action) + S_DS_GEN);
        }
 
-       lbs_dbg_hex("11D:802_11D_DOMAIN_INFO:", (u8 *) cmd, (int)(cmd->size));
-
-       LEAVE();
+       lbs_dbg_hex("11D:802_11D_DOMAIN_INFO:", (u8 *) cmd, le16_to_cpu(cmd->size));
 
+done:
+       lbs_deb_enter(LBS_DEB_11D);
        return 0;
 }
 
@@ -585,17 +588,17 @@ int libertas_cmd_enable_11d(wlan_private * priv, struct iwreq *wrq)
        int data = 0;
        int *val;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_11D);
        data = SUBCMD_DATA(wrq);
 
-       lbs_pr_debug(1, "enable 11D: %s\n",
+       lbs_deb_11d("enable 11D: %s\n",
               (data == 1) ? "enable" : "Disable");
 
        wlan_enable_11d(priv, data);
        val = (int *)wrq->u.name;
        *val = priv->adapter->enable11d;
 
-       LEAVE();
+       lbs_deb_enter(LBS_DEB_11D);
        return 0;
 }
 
@@ -608,25 +611,24 @@ int libertas_cmd_enable_11d(wlan_private * priv, struct iwreq *wrq)
 int libertas_ret_802_11d_domain_info(wlan_private * priv,
                                 struct cmd_ds_command *resp)
 {
-       struct cmd_ds_802_11d_domain_info
-       *domaininfo = &resp->params.domaininforesp;
+       struct cmd_ds_802_11d_domain_info *domaininfo = &resp->params.domaininforesp;
        struct mrvlietypes_domainparamset *domain = &domaininfo->domain;
        u16 action = le16_to_cpu(domaininfo->action);
        s16 ret = 0;
        u8 nr_subband = 0;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_11D);
 
        lbs_dbg_hex("11D DOMAIN Info Rsp Data:", (u8 *) resp,
                (int)le16_to_cpu(resp->size));
 
-       nr_subband = (domain->header.len - 3) / sizeof(struct ieeetypes_subbandset);
-       /* countrycode 3 bytes */
+       nr_subband = (le16_to_cpu(domain->header.len) - COUNTRY_CODE_LEN) /
+                     sizeof(struct ieeetypes_subbandset);
 
-       lbs_pr_debug(1, "11D Domain Info Resp: nr_subband=%d\n", nr_subband);
+       lbs_deb_11d("11D Domain Info Resp: nr_subband=%d\n", nr_subband);
 
        if (nr_subband > MRVDRV_MAX_SUBBAND_802_11D) {
-               lbs_pr_debug(1, "Invalid Numrer of Subband returned!!\n");
+               lbs_deb_11d("Invalid Numrer of Subband returned!!\n");
                return -1;
        }
 
@@ -637,12 +639,12 @@ int libertas_ret_802_11d_domain_info(wlan_private * priv,
        case cmd_act_get:
                break;
        default:
-               lbs_pr_debug(1, "Invalid action:%d\n", domaininfo->action);
+               lbs_deb_11d("Invalid action:%d\n", domaininfo->action);
                ret = -1;
                break;
        }
 
-       LEAVE();
+       lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret);
        return ret;
 }
 
@@ -651,23 +653,22 @@ int libertas_ret_802_11d_domain_info(wlan_private * priv,
  *  @param priv    pointer to wlan_private
  *  @return       0; -1
  */
-int libertas_parse_dnld_countryinfo_11d(wlan_private * priv)
+int libertas_parse_dnld_countryinfo_11d(wlan_private * priv,
+                                        struct bss_descriptor * bss)
 {
        int ret;
        wlan_adapter *adapter = priv->adapter;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_11D);
        if (priv->adapter->enable11d) {
                memset(&adapter->parsed_region_chan, 0,
                       sizeof(struct parsed_region_chan_11d));
-               ret = parse_domain_info_11d(&adapter->pattemptedbssdesc->
-                                              countryinfo, 0,
+               ret = parse_domain_info_11d(&bss->countryinfo, 0,
                                               &adapter->parsed_region_chan);
 
                if (ret == -1) {
-                       lbs_pr_debug(1, "11D: Err Parse domain_info from AP..\n");
-                       LEAVE();
-                       return ret;
+                       lbs_deb_11d("11D: Err Parse domain_info from AP..\n");
+                       goto done;
                }
 
                memset(&adapter->domainreg, 0,
@@ -678,13 +679,15 @@ int libertas_parse_dnld_countryinfo_11d(wlan_private * priv)
                ret = set_domain_info_11d(priv);
 
                if (ret) {
-                       lbs_pr_debug(1, "11D: Err set domainInfo to FW\n");
-                       LEAVE();
-                       return ret;
+                       lbs_deb_11d("11D: Err set domainInfo to FW\n");
+                       goto done;
                }
        }
-       LEAVE();
-       return 0;
+       ret = 0;
+
+done:
+       lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret);
+       return ret;
 }
 
 /**
@@ -699,8 +702,8 @@ int libertas_create_dnld_countryinfo_11d(wlan_private * priv)
        struct region_channel *region_chan;
        u8 j;
 
-       ENTER();
-       lbs_pr_debug(1, "11D:curbssparams.band[%d]\n", adapter->curbssparams.band);
+       lbs_deb_enter(LBS_DEB_11D);
+       lbs_deb_11d("11D:curbssparams.band[%d]\n", adapter->curbssparams.band);
 
        if (priv->adapter->enable11d) {
                /* update parsed_region_chan_11; dnld domaininf to FW */
@@ -709,7 +712,7 @@ int libertas_create_dnld_countryinfo_11d(wlan_private * priv)
                     sizeof(adapter->region_channel[0]); j++) {
                        region_chan = &adapter->region_channel[j];
 
-                       lbs_pr_debug(1, "11D:[%d] region_chan->band[%d]\n", j,
+                       lbs_deb_11d("11D:[%d] region_chan->band[%d]\n", j,
                               region_chan->band);
 
                        if (!region_chan || !region_chan->valid
@@ -722,10 +725,10 @@ int libertas_create_dnld_countryinfo_11d(wlan_private * priv)
 
                if (j >= sizeof(adapter->region_channel) /
                    sizeof(adapter->region_channel[0])) {
-                       lbs_pr_debug(1, "11D:region_chan not found. band[%d]\n",
+                       lbs_deb_11d("11D:region_chan not found. band[%d]\n",
                               adapter->curbssparams.band);
-                       LEAVE();
-                       return -1;
+                       ret = -1;
+                       goto done;
                }
 
                memset(&adapter->parsed_region_chan, 0,
@@ -742,13 +745,14 @@ int libertas_create_dnld_countryinfo_11d(wlan_private * priv)
                ret = set_domain_info_11d(priv);
 
                if (ret) {
-                       lbs_pr_debug(1, "11D: Err set domainInfo to FW\n");
-                       LEAVE();
-                       return ret;
+                       lbs_deb_11d("11D: Err set domainInfo to FW\n");
+                       goto done;
                }
 
        }
+       ret = 0;
 
-       LEAVE();
-       return 0;
+done:
+       lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret);
+       return ret;
 }
index db2ebea9f23180738788d739cf76c6e75da47550..73e42e7129110a3da2fefc377fbdd8a10676ef0a 100644 (file)
@@ -47,7 +47,7 @@ struct mrvlietypes_domainparamset {
 } __attribute__ ((packed));
 
 struct cmd_ds_802_11d_domain_info {
-       u16 action;
+       __le16 action;
        struct mrvlietypes_domainparamset domain;
 } __attribute__ ((packed));
 
@@ -98,7 +98,9 @@ int libertas_cmd_enable_11d(wlan_private * priv, struct iwreq *wrq);
 int libertas_ret_802_11d_domain_info(wlan_private * priv,
                                 struct cmd_ds_command *resp);
 
-int libertas_parse_dnld_countryinfo_11d(wlan_private * priv);
+struct bss_descriptor;
+int libertas_parse_dnld_countryinfo_11d(wlan_private * priv,
+                                        struct bss_descriptor * bss);
 
 int libertas_create_dnld_countryinfo_11d(wlan_private * priv);
 
index 56a8ea1fbf041a6c24d8baea4efd298c089bb248..a1097f59fd4667241e3a2331de83b9ec06dbb41a 100644 (file)
@@ -1,4 +1,4 @@
-usb8xxx-objs := main.o fw.o wext.o \
+libertas-objs := main.o fw.o wext.o \
                rx.o tx.o cmd.o           \
                cmdresp.o scan.o          \
                join.o 11d.o              \
@@ -8,5 +8,5 @@ usb8xxx-objs := main.o fw.o wext.o \
 usb8xxx-objs += if_bootcmd.o
 usb8xxx-objs += if_usb.o
 
+obj-$(CONFIG_LIBERTAS)     += libertas.o
 obj-$(CONFIG_LIBERTAS_USB) += usb8xxx.o
-
index 378577200b56c5f3e81fe849c1c8d44aecb81723..1f92f50b643c7a9eac13d1eda1d7a601dace886f 100644 (file)
@@ -1,7 +1,7 @@
 ================================================================================
                        README for USB8388
 
- (c) Copyright Â© 2003-2006, Marvell International Ltd.
+ (c) Copyright Ã‚© 2003-2006, Marvell International Ltd.
  All Rights Reserved
 
  This software file (the "File") is distributed by Marvell International
@@ -47,15 +47,19 @@ Version 5 Command:
        iwpriv ethX ledgpio <n>
 
 BT Commands:
-       The blinding table (BT) contains a list of mac addresses that should be
-       ignored by the firmware.  It is primarily used for debugging and
-       testing networks.  It can be edited and inspected with the following
-       commands:
+       The blinding table (BT) contains a list of mac addresses that will be,
+       by default, ignored by the firmware. It is also possible to invert this
+       behavior so that we will ignore all traffic except for the portion
+       coming from mac addresess in the list. It is primarily used for
+       debugging and testing networks.  It can be edited and inspected with
+       the following commands:
 
        iwpriv ethX bt_reset
        iwpriv ethX bt_add <mac_address>
        iwpriv ethX bt_del <mac_address>
        iwpriv ethX bt_list <id>
+       iwpriv ethX bt_get_invert <n>
+       iwpriv ethX bt_set_invert <n>
 
 FWT Commands:
        The forwarding table (FWT) is a feature used to manage mesh network
@@ -135,7 +139,7 @@ fwt_add
        This command is used to insert an entry into the FWT table. The list of
        parameters must follow the following structure:
 
-       iwpriv ethX fwt_add da ra [metric dir ssn dsn hopcount ttl expiration sleepmode snr]
+       iwpriv ethX fwt_add da ra [metric dir rate ssn dsn hopcount ttl expiration sleepmode snr]
 
        The parameters between brackets are optional, but they must appear in
        the order specified.  For example, if you want to specify the metric,
@@ -150,6 +154,9 @@ fwt_add
                                   preferred, default is 0)
                dir             -- direction (1 for direct, 0 for reverse,
                                   default is 1)
+               rate            -- data rate used for transmission to the RA,
+                                  as specified for the rateadapt command,
+                                  default is 3 (11Mbps)
                ssn             -- Source Sequence Number (time at the RA for
                                   reverse routes.  Default is 0)
                dsn             -- Destination Sequence Number (time at the DA
@@ -207,13 +214,17 @@ fwt_list
 
        The output is a string of the following form:
 
-               da ra metric dir ssn dsn hopcount ttl expiration sleepmode snr
+               da ra valid metric dir rate ssn dsn hopcount ttl expiration
+               sleepmode snr precursor
 
        where the different fields are:-
                da              -- DA MAC address (in the form "00:11:22:33:44:55")
                ra              -- RA MAC address (in the form "00:11:22:33:44:55")
+               valid           -- whether the route is valid (0 if not valid)
                metric          -- route metric (cost: smaller-metric routes are preferred)
                dir             -- direction (1 for direct, 0 for reverse)
+               rate            -- data rate used for transmission to the RA,
+                                  as specified for the rateadapt command
                ssn             -- Source Sequence Number (time at the RA for reverse routes)
                dsn             -- Destination Sequence Number (time at the DA for direct routes)
                hopcount        -- hop count (currently unused)
@@ -221,33 +232,10 @@ fwt_list
                expiration      -- entry expiration (in ticks, where a tick is 1024us, or ~ 1ms. Use 0 for an indefinite entry)
                sleepmode       -- RA's sleep mode (currently unused)
                snr             -- SNR in the link to RA (currently unused)
+               precursor       -- predecessor in direct routes
 
 fwt_list_route
-       This command is used to list a route from the FWT table. The only
-       parameter is the route ID. If you want to list all the routes in a
-       table, start with rid=0, and keep incrementing rid until you get a
-       "(null)" string. This function is similar to fwt_list. The only
-       difference is the output format.  Also note that this command is meant
-       for debugging.  It is expected that users will use fwt_lookup and
-       fwt_list.  One important reason for this is that the route id may change
-       as the route table is altered.
-
-               iwpriv ethX fwt_list_route rid
-
-       The output is a string of the following form:
-
-               da metric dir nid ssn dsn hopcount ttl expiration
-
-       where the different fields are:-
-               da              -- DA MAC address (in the form "00:11:22:33:44:55")
-               metric          -- route metric (cost: smaller-metric routes are preferred)
-               dir             -- direction (1 for direct, 0 for reverse)
-               nid             -- Next-hop (neighbor) host ID (nid)
-               ssn             -- Source Sequence Number (time at the RA for reverse routes)
-               dsn             -- Destination Sequence Number (time at the DA for direct routes)
-               hopcount        -- hop count (currently unused)
-               ttl             -- TTL count (only used in reverse entries)
-               expiration      -- entry expiration (in ticks, where a tick is 1024us, or ~ 1ms. Use 0 for an indefinite entry)
+       This command is equivalent to fwt_list.
 
 fwt_list_neigh
        This command is used to list a neighbor from the FWT table. The only
index c260bd1b3d46667df8cd32f2beb3fd2a06a59eb0..f67efa0815fe0f5b7fe5905f708eae0e8c2014da 100644 (file)
@@ -2,6 +2,7 @@
 
 #include <linux/bitops.h>
 #include <net/ieee80211.h>
+#include <linux/etherdevice.h>
 
 #include "assoc.h"
 #include "join.h"
 static const u8 bssid_any[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
 static const u8 bssid_off[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
 
+static void print_assoc_req(const char * extra, struct assoc_request * assoc_req)
+{
+       lbs_deb_assoc(
+              "#### Association Request: %s\n"
+              "       flags:      0x%08lX\n"
+              "       SSID:       '%s'\n"
+              "       channel:    %d\n"
+              "       band:       %d\n"
+              "       mode:       %d\n"
+              "       BSSID:      " MAC_FMT "\n"
+              "       Encryption:%s%s%s\n"
+              "       auth:       %d\n",
+              extra, assoc_req->flags,
+              escape_essid(assoc_req->ssid, assoc_req->ssid_len),
+              assoc_req->channel, assoc_req->band, assoc_req->mode,
+              MAC_ARG(assoc_req->bssid),
+              assoc_req->secinfo.WPAenabled ? " WPA" : "",
+              assoc_req->secinfo.WPA2enabled ? " WPA2" : "",
+              assoc_req->secinfo.wep_enabled ? " WEP" : "",
+              assoc_req->secinfo.auth_mode);
+}
+
+
 static int assoc_helper_essid(wlan_private *priv,
                               struct assoc_request * assoc_req)
 {
        wlan_adapter *adapter = priv->adapter;
        int ret = 0;
-       int i;
+       struct bss_descriptor * bss;
+       int channel = -1;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_ASSOC);
 
-       lbs_pr_debug(1, "New SSID requested: %s\n", assoc_req->ssid.ssid);
+       /* FIXME: take channel into account when picking SSIDs if a channel
+        * is set.
+        */
+
+       if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags))
+               channel = assoc_req->channel;
+
+       lbs_deb_assoc("New SSID requested: '%s'\n",
+                     escape_essid(assoc_req->ssid, assoc_req->ssid_len));
        if (assoc_req->mode == IW_MODE_INFRA) {
                if (adapter->prescan) {
-                       libertas_send_specific_SSID_scan(priv, &assoc_req->ssid, 1);
+                       libertas_send_specific_ssid_scan(priv, assoc_req->ssid,
+                               assoc_req->ssid_len, 0);
                }
 
-               i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid,
-                               NULL, IW_MODE_INFRA);
-               if (i >= 0) {
-                       lbs_pr_debug(1,
-                              "SSID found in scan list ... associating...\n");
-
-                       ret = wlan_associate(priv, &adapter->scantable[i]);
-                       if (ret == 0) {
-                               memcpy(&assoc_req->bssid,
-                                      &adapter->scantable[i].macaddress,
-                                      ETH_ALEN);
-                       }
+               bss = libertas_find_ssid_in_list(adapter, assoc_req->ssid,
+                               assoc_req->ssid_len, NULL, IW_MODE_INFRA, channel);
+               if (bss != NULL) {
+                       lbs_deb_assoc("SSID found in scan list, associating\n");
+                       memcpy(&assoc_req->bss, bss, sizeof(struct bss_descriptor));
+                       ret = wlan_associate(priv, assoc_req);
                } else {
-                       lbs_pr_debug(1, "SSID '%s' not found; cannot associate\n",
-                               assoc_req->ssid.ssid);
+                       lbs_deb_assoc("SSID not found; cannot associate\n");
                }
        } else if (assoc_req->mode == IW_MODE_ADHOC) {
                /* Scan for the network, do not save previous results.  Stale
                 *   scan data will cause us to join a non-existant adhoc network
                 */
-               libertas_send_specific_SSID_scan(priv, &assoc_req->ssid, 0);
+               libertas_send_specific_ssid_scan(priv, assoc_req->ssid,
+                       assoc_req->ssid_len, 1);
 
                /* Search for the requested SSID in the scan table */
-               i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid, NULL,
-                               IW_MODE_ADHOC);
-               if (i >= 0) {
-                       lbs_pr_debug(1, "SSID found at %d in List, so join\n", ret);
-                       libertas_join_adhoc_network(priv, &adapter->scantable[i]);
+               bss = libertas_find_ssid_in_list(adapter, assoc_req->ssid,
+                               assoc_req->ssid_len, NULL, IW_MODE_ADHOC, channel);
+               if (bss != NULL) {
+                       lbs_deb_assoc("SSID found, will join\n");
+                       memcpy(&assoc_req->bss, bss, sizeof(struct bss_descriptor));
+                       libertas_join_adhoc_network(priv, assoc_req);
                } else {
                        /* else send START command */
-                       lbs_pr_debug(1, "SSID not found in list, so creating adhoc"
-                               " with SSID '%s'\n", assoc_req->ssid.ssid);
-                       libertas_start_adhoc_network(priv, &assoc_req->ssid);
+                       lbs_deb_assoc("SSID not found, creating adhoc network\n");
+                       memcpy(&assoc_req->bss.ssid, &assoc_req->ssid,
+                               IW_ESSID_MAX_SIZE);
+                       assoc_req->bss.ssid_len = assoc_req->ssid_len;
+                       libertas_start_adhoc_network(priv, assoc_req);
                }
-               memcpy(&assoc_req->bssid, &adapter->current_addr, ETH_ALEN);
        }
 
-       LEAVE();
+       lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
        return ret;
 }
 
@@ -74,33 +104,31 @@ static int assoc_helper_bssid(wlan_private *priv,
                               struct assoc_request * assoc_req)
 {
        wlan_adapter *adapter = priv->adapter;
-       int i, ret = 0;
-
-       ENTER();
+       int ret = 0;
+       struct bss_descriptor * bss;
 
-       lbs_pr_debug(1, "ASSOC: WAP: BSSID = " MAC_FMT "\n",
+       lbs_deb_enter_args(LBS_DEB_ASSOC, "BSSID " MAC_FMT,
                MAC_ARG(assoc_req->bssid));
 
        /* Search for index position in list for requested MAC */
-       i = libertas_find_BSSID_in_list(adapter, assoc_req->bssid,
+       bss = libertas_find_bssid_in_list(adapter, assoc_req->bssid,
                            assoc_req->mode);
-       if (i < 0) {
-               lbs_pr_debug(1, "ASSOC: WAP: BSSID " MAC_FMT " not found, "
+       if (bss == NULL) {
+               lbs_deb_assoc("ASSOC: WAP: BSSID " MAC_FMT " not found, "
                        "cannot associate.\n", MAC_ARG(assoc_req->bssid));
                goto out;
        }
 
+       memcpy(&assoc_req->bss, bss, sizeof(struct bss_descriptor));
        if (assoc_req->mode == IW_MODE_INFRA) {
-               ret = wlan_associate(priv, &adapter->scantable[i]);
-               lbs_pr_debug(1, "ASSOC: return from wlan_associate(bssd) was %d\n", ret);
+               ret = wlan_associate(priv, assoc_req);
+               lbs_deb_assoc("ASSOC: wlan_associate(bssid) returned %d\n", ret);
        } else if (assoc_req->mode == IW_MODE_ADHOC) {
-               libertas_join_adhoc_network(priv, &adapter->scantable[i]);
+               libertas_join_adhoc_network(priv, assoc_req);
        }
-       memcpy(&assoc_req->ssid, &adapter->scantable[i].ssid,
-               sizeof(struct WLAN_802_11_SSID));
 
 out:
-       LEAVE();
+       lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
        return ret;
 }
 
@@ -113,12 +141,12 @@ static int assoc_helper_associate(wlan_private *priv,
        /* If we're given and 'any' BSSID, try associating based on SSID */
 
        if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) {
-               if (memcmp(bssid_any, assoc_req->bssid, ETH_ALEN)
-                   && memcmp(bssid_off, assoc_req->bssid, ETH_ALEN)) {
+               if (compare_ether_addr(bssid_any, assoc_req->bssid)
+                   && compare_ether_addr(bssid_off, assoc_req->bssid)) {
                        ret = assoc_helper_bssid(priv, assoc_req);
                        done = 1;
                        if (ret) {
-                               lbs_pr_debug(1, "ASSOC: bssid: ret = %d\n", ret);
+                               lbs_deb_assoc("ASSOC: bssid: ret = %d\n", ret);
                        }
                }
        }
@@ -126,7 +154,7 @@ static int assoc_helper_associate(wlan_private *priv,
        if (!done && test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) {
                ret = assoc_helper_essid(priv, assoc_req);
                if (ret) {
-                       lbs_pr_debug(1, "ASSOC: bssid: ret = %d\n", ret);
+                       lbs_deb_assoc("ASSOC: bssid: ret = %d\n", ret);
                }
        }
 
@@ -140,12 +168,10 @@ static int assoc_helper_mode(wlan_private *priv,
        wlan_adapter *adapter = priv->adapter;
        int ret = 0;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_ASSOC);
 
-       if (assoc_req->mode == adapter->mode) {
-               LEAVE();
-               return 0;
-       }
+       if (assoc_req->mode == adapter->mode)
+               goto done;
 
        if (assoc_req->mode == IW_MODE_INFRA) {
                if (adapter->psstate != PS_STATE_FULL_POWER)
@@ -158,9 +184,81 @@ static int assoc_helper_mode(wlan_private *priv,
                                    cmd_802_11_snmp_mib,
                                    0, cmd_option_waitforrsp,
                                    OID_802_11_INFRASTRUCTURE_MODE,
-                                   (void *) (size_t) assoc_req->mode);
+               /* Shoot me now */  (void *) (size_t) assoc_req->mode);
 
-       LEAVE();
+done:
+       lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
+       return ret;
+}
+
+
+static int update_channel(wlan_private * priv)
+{
+       /* the channel in f/w could be out of sync, get the current channel */
+       return libertas_prepare_and_send_command(priv, cmd_802_11_rf_channel,
+                                   cmd_opt_802_11_rf_channel_get,
+                                   cmd_option_waitforrsp, 0, NULL);
+}
+
+void libertas_sync_channel(struct work_struct *work)
+{
+       wlan_private *priv = container_of(work, wlan_private, sync_channel);
+
+       if (update_channel(priv) != 0)
+               lbs_pr_info("Channel synchronization failed.");
+}
+
+static int assoc_helper_channel(wlan_private *priv,
+                                struct assoc_request * assoc_req)
+{
+       wlan_adapter *adapter = priv->adapter;
+       int ret = 0;
+
+       lbs_deb_enter(LBS_DEB_ASSOC);
+
+       ret = update_channel(priv);
+       if (ret < 0) {
+               lbs_deb_assoc("ASSOC: channel: error getting channel.");
+       }
+
+       if (assoc_req->channel == adapter->curbssparams.channel)
+               goto done;
+
+       lbs_deb_assoc("ASSOC: channel: %d -> %d\n",
+              adapter->curbssparams.channel, assoc_req->channel);
+
+       ret = libertas_prepare_and_send_command(priv, cmd_802_11_rf_channel,
+                               cmd_opt_802_11_rf_channel_set,
+                               cmd_option_waitforrsp, 0, &assoc_req->channel);
+       if (ret < 0) {
+               lbs_deb_assoc("ASSOC: channel: error setting channel.");
+       }
+
+       ret = update_channel(priv);
+       if (ret < 0) {
+               lbs_deb_assoc("ASSOC: channel: error getting channel.");
+       }
+
+       if (assoc_req->channel != adapter->curbssparams.channel) {
+               lbs_deb_assoc("ASSOC: channel: failed to update channel to %d",
+                             assoc_req->channel);
+               goto done;
+       }
+
+       if (   assoc_req->secinfo.wep_enabled
+           &&   (assoc_req->wep_keys[0].len
+              || assoc_req->wep_keys[1].len
+              || assoc_req->wep_keys[2].len
+              || assoc_req->wep_keys[3].len)) {
+               /* Make sure WEP keys are re-sent to firmware */
+               set_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags);
+       }
+
+       /* Must restart/rejoin adhoc networks after channel change */
+       set_bit(ASSOC_FLAG_SSID, &assoc_req->flags);
+
+done:
+       lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
        return ret;
 }
 
@@ -172,7 +270,7 @@ static int assoc_helper_wep_keys(wlan_private *priv,
        int i;
        int ret = 0;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_ASSOC);
 
        /* Set or remove WEP keys */
        if (   assoc_req->wep_keys[0].len
@@ -216,7 +314,7 @@ static int assoc_helper_wep_keys(wlan_private *priv,
        mutex_unlock(&adapter->lock);
 
 out:
-       LEAVE();
+       lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
        return ret;
 }
 
@@ -226,14 +324,24 @@ static int assoc_helper_secinfo(wlan_private *priv,
        wlan_adapter *adapter = priv->adapter;
        int ret = 0;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_ASSOC);
 
        memcpy(&adapter->secinfo, &assoc_req->secinfo,
                sizeof(struct wlan_802_11_security));
 
        ret = libertas_set_mac_packet_filter(priv);
+       if (ret)
+               goto out;
 
-       LEAVE();
+       /* enable/disable RSN */
+       ret = libertas_prepare_and_send_command(priv,
+                                   cmd_802_11_enable_rsn,
+                                   cmd_act_set,
+                                   cmd_option_waitforrsp,
+                                   0, assoc_req);
+
+out:
+       lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
        return ret;
 }
 
@@ -243,16 +351,7 @@ static int assoc_helper_wpa_keys(wlan_private *priv,
 {
        int ret = 0;
 
-       ENTER();
-
-       /* enable/Disable RSN */
-       ret = libertas_prepare_and_send_command(priv,
-                                   cmd_802_11_enable_rsn,
-                                   cmd_act_set,
-                                   cmd_option_waitforrsp,
-                                   0, assoc_req);
-       if (ret)
-               goto out;
+       lbs_deb_enter(LBS_DEB_ASSOC);
 
        ret = libertas_prepare_and_send_command(priv,
                                    cmd_802_11_key_material,
@@ -260,8 +359,7 @@ static int assoc_helper_wpa_keys(wlan_private *priv,
                                    cmd_option_waitforrsp,
                                    0, assoc_req);
 
-out:
-       LEAVE();
+       lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
        return ret;
 }
 
@@ -272,7 +370,7 @@ static int assoc_helper_wpa_ie(wlan_private *priv,
        wlan_adapter *adapter = priv->adapter;
        int ret = 0;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_ASSOC);
 
        if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) {
                memcpy(&adapter->wpa_ie, &assoc_req->wpa_ie, assoc_req->wpa_ie_len);
@@ -282,7 +380,7 @@ static int assoc_helper_wpa_ie(wlan_private *priv,
                adapter->wpa_ie_len = 0;
        }
 
-       LEAVE();
+       lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
        return ret;
 }
 
@@ -294,25 +392,30 @@ static int should_deauth_infrastructure(wlan_adapter *adapter,
                return 0;
 
        if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) {
-               lbs_pr_debug(1, "Deauthenticating due to new SSID in "
+               lbs_deb_assoc("Deauthenticating due to new SSID in "
                        " configuration request.\n");
                return 1;
        }
 
        if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) {
                if (adapter->secinfo.auth_mode != assoc_req->secinfo.auth_mode) {
-                       lbs_pr_debug(1, "Deauthenticating due to updated security "
+                       lbs_deb_assoc("Deauthenticating due to updated security "
                                "info in configuration request.\n");
                        return 1;
                }
        }
 
        if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) {
-               lbs_pr_debug(1, "Deauthenticating due to new BSSID in "
+               lbs_deb_assoc("Deauthenticating due to new BSSID in "
                        " configuration request.\n");
                return 1;
        }
 
+       if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) {
+               lbs_deb_assoc("Deauthenticating due to channel switch.\n");
+               return 1;
+       }
+
        /* FIXME: deal with 'auto' mode somehow */
        if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) {
                if (assoc_req->mode != IW_MODE_INFRA)
@@ -329,10 +432,9 @@ static int should_stop_adhoc(wlan_adapter *adapter,
        if (adapter->connect_status != libertas_connected)
                return 0;
 
-       if (adapter->curbssparams.ssid.ssidlength != assoc_req->ssid.ssidlength)
-               return 1;
-       if (memcmp(adapter->curbssparams.ssid.ssid, assoc_req->ssid.ssid,
-                       adapter->curbssparams.ssid.ssidlength))
+       if (libertas_ssid_cmp(adapter->curbssparams.ssid,
+                             adapter->curbssparams.ssid_len,
+                             assoc_req->ssid, assoc_req->ssid_len) != 0)
                return 1;
 
        /* FIXME: deal with 'auto' mode somehow */
@@ -341,11 +443,16 @@ static int should_stop_adhoc(wlan_adapter *adapter,
                        return 1;
        }
 
+       if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) {
+               if (assoc_req->channel != adapter->curbssparams.channel)
+                       return 1;
+       }
+
        return 0;
 }
 
 
-void wlan_association_worker(struct work_struct *work)
+void libertas_association_worker(struct work_struct *work)
 {
        wlan_private *priv = container_of(work, wlan_private, assoc_work.work);
        wlan_adapter *adapter = priv->adapter;
@@ -353,40 +460,38 @@ void wlan_association_worker(struct work_struct *work)
        int ret = 0;
        int find_any_ssid = 0;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_ASSOC);
 
        mutex_lock(&adapter->lock);
-       assoc_req = adapter->assoc_req;
-       adapter->assoc_req = NULL;
+       assoc_req = adapter->pending_assoc_req;
+       adapter->pending_assoc_req = NULL;
+       adapter->in_progress_assoc_req = assoc_req;
        mutex_unlock(&adapter->lock);
 
-       if (!assoc_req) {
-               LEAVE();
-               return;
-       }
+       if (!assoc_req)
+               goto done;
 
-       lbs_pr_debug(1, "ASSOC: starting new association request: flags = 0x%lX\n",
-               assoc_req->flags);
+       print_assoc_req(__func__, assoc_req);
 
        /* If 'any' SSID was specified, find an SSID to associate with */
        if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)
-           && !assoc_req->ssid.ssidlength)
+           && !assoc_req->ssid_len)
                find_any_ssid = 1;
 
        /* But don't use 'any' SSID if there's a valid locked BSSID to use */
        if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) {
-               if (memcmp(&assoc_req->bssid, bssid_any, ETH_ALEN)
-                   && memcmp(&assoc_req->bssid, bssid_off, ETH_ALEN))
+               if (compare_ether_addr(assoc_req->bssid, bssid_any)
+                   && compare_ether_addr(assoc_req->bssid, bssid_off))
                        find_any_ssid = 0;
        }
 
        if (find_any_ssid) {
                u8 new_mode;
 
-               ret = libertas_find_best_network_SSID(priv, &assoc_req->ssid,
-                               assoc_req->mode, &new_mode);
+               ret = libertas_find_best_network_ssid(priv, assoc_req->ssid,
+                               &assoc_req->ssid_len, assoc_req->mode, &new_mode);
                if (ret) {
-                       lbs_pr_debug(1, "Could not find best network\n");
+                       lbs_deb_assoc("Could not find best network\n");
                        ret = -ENETUNREACH;
                        goto out;
                }
@@ -406,7 +511,7 @@ void wlan_association_worker(struct work_struct *work)
                if (should_deauth_infrastructure(adapter, assoc_req)) {
                        ret = libertas_send_deauthentication(priv);
                        if (ret) {
-                               lbs_pr_debug(1, "Deauthentication due to new "
+                               lbs_deb_assoc("Deauthentication due to new "
                                        "configuration request failed: %d\n",
                                        ret);
                        }
@@ -415,7 +520,7 @@ void wlan_association_worker(struct work_struct *work)
                if (should_stop_adhoc(adapter, assoc_req)) {
                        ret = libertas_stop_adhoc_network(priv);
                        if (ret) {
-                               lbs_pr_debug(1, "Teardown of AdHoc network due to "
+                               lbs_deb_assoc("Teardown of AdHoc network due to "
                                        "new configuration request failed: %d\n",
                                        ret);
                        }
@@ -427,7 +532,16 @@ void wlan_association_worker(struct work_struct *work)
        if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) {
                ret = assoc_helper_mode(priv, assoc_req);
                if (ret) {
-lbs_pr_debug(1, "ASSOC(:%d) mode: ret = %d\n", __LINE__, ret);
+lbs_deb_assoc("ASSOC(:%d) mode: ret = %d\n", __LINE__, ret);
+                       goto out;
+               }
+       }
+
+       if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) {
+               ret = assoc_helper_channel(priv, assoc_req);
+               if (ret) {
+                       lbs_deb_assoc("ASSOC(:%d) channel: ret = %d\n",
+                                     __LINE__, ret);
                        goto out;
                }
        }
@@ -436,7 +550,7 @@ lbs_pr_debug(1, "ASSOC(:%d) mode: ret = %d\n", __LINE__, ret);
            || test_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags)) {
                ret = assoc_helper_wep_keys(priv, assoc_req);
                if (ret) {
-lbs_pr_debug(1, "ASSOC(:%d) wep_keys: ret = %d\n", __LINE__, ret);
+lbs_deb_assoc("ASSOC(:%d) wep_keys: ret = %d\n", __LINE__, ret);
                        goto out;
                }
        }
@@ -444,7 +558,7 @@ lbs_pr_debug(1, "ASSOC(:%d) wep_keys: ret = %d\n", __LINE__, ret);
        if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) {
                ret = assoc_helper_secinfo(priv, assoc_req);
                if (ret) {
-lbs_pr_debug(1, "ASSOC(:%d) secinfo: ret = %d\n", __LINE__, ret);
+lbs_deb_assoc("ASSOC(:%d) secinfo: ret = %d\n", __LINE__, ret);
                        goto out;
                }
        }
@@ -452,7 +566,7 @@ lbs_pr_debug(1, "ASSOC(:%d) secinfo: ret = %d\n", __LINE__, ret);
        if (test_bit(ASSOC_FLAG_WPA_IE, &assoc_req->flags)) {
                ret = assoc_helper_wpa_ie(priv, assoc_req);
                if (ret) {
-lbs_pr_debug(1, "ASSOC(:%d) wpa_ie: ret = %d\n", __LINE__, ret);
+lbs_deb_assoc("ASSOC(:%d) wpa_ie: ret = %d\n", __LINE__, ret);
                        goto out;
                }
        }
@@ -461,7 +575,7 @@ lbs_pr_debug(1, "ASSOC(:%d) wpa_ie: ret = %d\n", __LINE__, ret);
            || test_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags)) {
                ret = assoc_helper_wpa_keys(priv, assoc_req);
                if (ret) {
-lbs_pr_debug(1, "ASSOC(:%d) wpa_keys: ret = %d\n", __LINE__, ret);
+lbs_deb_assoc("ASSOC(:%d) wpa_keys: ret = %d\n", __LINE__, ret);
                        goto out;
                }
        }
@@ -475,21 +589,23 @@ lbs_pr_debug(1, "ASSOC(:%d) wpa_keys: ret = %d\n", __LINE__, ret);
 
                ret = assoc_helper_associate(priv, assoc_req);
                if (ret) {
-                       lbs_pr_debug(1, "ASSOC: association attempt unsuccessful: %d\n",
+                       lbs_deb_assoc("ASSOC: association attempt unsuccessful: %d\n",
                                ret);
                        success = 0;
                }
 
                if (adapter->connect_status != libertas_connected) {
-                       lbs_pr_debug(1, "ASSOC: assoication attempt unsuccessful, "
+                       lbs_deb_assoc("ASSOC: assoication attempt unsuccessful, "
                                "not connected.\n");
                        success = 0;
                }
 
                if (success) {
-                       lbs_pr_debug(1, "ASSOC: association attempt successful. "
+                       lbs_deb_assoc("ASSOC: association attempt successful. "
                                "Associated to '%s' (" MAC_FMT ")\n",
-                               assoc_req->ssid.ssid, MAC_ARG(assoc_req->bssid));
+                               escape_essid(adapter->curbssparams.ssid,
+                                            adapter->curbssparams.ssid_len),
+                               MAC_ARG(adapter->curbssparams.bssid));
                        libertas_prepare_and_send_command(priv,
                                cmd_802_11_rssi,
                                0, cmd_option_waitforrsp, 0, NULL);
@@ -498,18 +614,23 @@ lbs_pr_debug(1, "ASSOC(:%d) wpa_keys: ret = %d\n", __LINE__, ret);
                                cmd_802_11_get_log,
                                0, cmd_option_waitforrsp, 0, NULL);
                } else {
-
                        ret = -1;
                }
        }
 
 out:
        if (ret) {
-               lbs_pr_debug(1, "ASSOC: reconfiguration attempt unsuccessful: %d\n",
+               lbs_deb_assoc("ASSOC: reconfiguration attempt unsuccessful: %d\n",
                        ret);
        }
+
+       mutex_lock(&adapter->lock);
+       adapter->in_progress_assoc_req = NULL;
+       mutex_unlock(&adapter->lock);
        kfree(assoc_req);
-       LEAVE();
+
+done:
+       lbs_deb_leave(LBS_DEB_ASSOC);
 }
 
 
@@ -520,9 +641,10 @@ struct assoc_request * wlan_get_association_request(wlan_adapter *adapter)
 {
        struct assoc_request * assoc_req;
 
-       if (!adapter->assoc_req) {
-               adapter->assoc_req = kzalloc(sizeof(struct assoc_request), GFP_KERNEL);
-               if (!adapter->assoc_req) {
+       if (!adapter->pending_assoc_req) {
+               adapter->pending_assoc_req = kzalloc(sizeof(struct assoc_request),
+                                                    GFP_KERNEL);
+               if (!adapter->pending_assoc_req) {
                        lbs_pr_info("Not enough memory to allocate association"
                                " request!\n");
                        return NULL;
@@ -532,15 +654,19 @@ struct assoc_request * wlan_get_association_request(wlan_adapter *adapter)
        /* Copy current configuration attributes to the association request,
         * but don't overwrite any that are already set.
         */
-       assoc_req = adapter->assoc_req;
+       assoc_req = adapter->pending_assoc_req;
        if (!test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) {
-               memcpy(&assoc_req->ssid, adapter->curbssparams.ssid.ssid,
-                       adapter->curbssparams.ssid.ssidlength);
+               memcpy(&assoc_req->ssid, &adapter->curbssparams.ssid,
+                      IW_ESSID_MAX_SIZE);
+               assoc_req->ssid_len = adapter->curbssparams.ssid_len;
        }
 
        if (!test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags))
                assoc_req->channel = adapter->curbssparams.channel;
 
+       if (!test_bit(ASSOC_FLAG_BAND, &assoc_req->flags))
+               assoc_req->band = adapter->curbssparams.band;
+
        if (!test_bit(ASSOC_FLAG_MODE, &assoc_req->flags))
                assoc_req->mode = adapter->mode;
 
@@ -581,7 +707,7 @@ struct assoc_request * wlan_get_association_request(wlan_adapter *adapter)
                assoc_req->wpa_ie_len = adapter->wpa_ie_len;
        }
 
+       print_assoc_req(__func__, assoc_req);
+
        return assoc_req;
 }
-
-
index 2ffd82d99b340a7e9ae2aba95dea150d2a019782..5e9c31f0932b1d64377184c5fa038c16dbbdd19f 100644 (file)
@@ -5,10 +5,12 @@
 
 #include "dev.h"
 
-void wlan_association_worker(struct work_struct *work);
+void libertas_association_worker(struct work_struct *work);
 
 struct assoc_request * wlan_get_association_request(wlan_adapter *adapter);
 
+void libertas_sync_channel(struct work_struct *work);
+
 #define ASSOC_DELAY (HZ / 2)
 static inline void wlan_postpone_association_work(wlan_private *priv)
 {
@@ -21,9 +23,9 @@ static inline void wlan_postpone_association_work(wlan_private *priv)
 static inline void wlan_cancel_association_work(wlan_private *priv)
 {
        cancel_delayed_work(&priv->assoc_work);
-       if (priv->adapter->assoc_req) {
-               kfree(priv->adapter->assoc_req);
-               priv->adapter->assoc_req = NULL;
+       if (priv->adapter->pending_assoc_req) {
+               kfree(priv->adapter->pending_assoc_req);
+               priv->adapter->pending_assoc_req = NULL;
        }
 }
 
index de9cb46a70fffaa726879cc44affb5a3144a6575..124e029f1bf412105d0f02e643be55c9cb1ffc71 100644 (file)
@@ -6,7 +6,6 @@
 #include <net/iw_handler.h>
 #include "host.h"
 #include "hostcmd.h"
-#include "sbi.h"
 #include "decl.h"
 #include "defs.h"
 #include "dev.h"
@@ -26,13 +25,11 @@ static u16 commands_allowed_in_ps[] = {
  *  @param command the command ID
  *  @return       TRUE or FALSE
  */
-static u8 is_command_allowed_in_ps(u16 command)
+static u8 is_command_allowed_in_ps(__le16 command)
 {
-       int count = sizeof(commands_allowed_in_ps)
-           / sizeof(commands_allowed_in_ps[0]);
        int i;
 
-       for (i = 0; i < count; i++) {
+       for (i = 0; i < ARRAY_SIZE(commands_allowed_in_ps); i++) {
                if (command == cpu_to_le16(commands_allowed_in_ps[i]))
                        return 1;
        }
@@ -44,14 +41,13 @@ static int wlan_cmd_hw_spec(wlan_private * priv, struct cmd_ds_command *cmd)
 {
        struct cmd_ds_get_hw_spec *hwspec = &cmd->params.hwspec;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
        cmd->command = cpu_to_le16(cmd_get_hw_spec);
-       cmd->size =
-           cpu_to_le16(sizeof(struct cmd_ds_get_hw_spec) + S_DS_GEN);
+       cmd->size = cpu_to_le16(sizeof(struct cmd_ds_get_hw_spec) + S_DS_GEN);
        memcpy(hwspec->permanentaddr, priv->adapter->current_addr, ETH_ALEN);
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_CMD);
        return 0;
 }
 
@@ -60,21 +56,19 @@ static int wlan_cmd_802_11_ps_mode(wlan_private * priv,
                                   u16 cmd_action)
 {
        struct cmd_ds_802_11_ps_mode *psm = &cmd->params.psmode;
-       u16 action = cmd_action;
        wlan_adapter *adapter = priv->adapter;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
        cmd->command = cpu_to_le16(cmd_802_11_ps_mode);
-       cmd->size =
-           cpu_to_le16(sizeof(struct cmd_ds_802_11_ps_mode) +
-                            S_DS_GEN);
+       cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_ps_mode) +
+                               S_DS_GEN);
        psm->action = cpu_to_le16(cmd_action);
        psm->multipledtim = 0;
-       switch (action) {
+       switch (cmd_action) {
        case cmd_subcmd_enter_ps:
-               lbs_pr_debug(1, "PS command:" "SubCode- Enter PS\n");
-               lbs_pr_debug(1, "locallisteninterval = %d\n",
+               lbs_deb_cmd("PS command:" "SubCode- Enter PS\n");
+               lbs_deb_cmd("locallisteninterval = %d\n",
                       adapter->locallisteninterval);
 
                psm->locallisteninterval =
@@ -86,18 +80,18 @@ static int wlan_cmd_802_11_ps_mode(wlan_private * priv,
                break;
 
        case cmd_subcmd_exit_ps:
-               lbs_pr_debug(1, "PS command:" "SubCode- Exit PS\n");
+               lbs_deb_cmd("PS command:" "SubCode- Exit PS\n");
                break;
 
        case cmd_subcmd_sleep_confirmed:
-               lbs_pr_debug(1, "PS command: SubCode- sleep confirm\n");
+               lbs_deb_cmd("PS command: SubCode- sleep confirm\n");
                break;
 
        default:
                break;
        }
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_CMD);
        return 0;
 }
 
@@ -115,8 +109,7 @@ static int wlan_cmd_802_11_inactivity_timeout(wlan_private * priv,
        cmd->params.inactivity_timeout.action = cpu_to_le16(cmd_action);
 
        if (cmd_action)
-               cmd->params.inactivity_timeout.timeout =
-                   cpu_to_le16(*timeout);
+               cmd->params.inactivity_timeout.timeout = cpu_to_le16(*timeout);
        else
                cmd->params.inactivity_timeout.timeout = 0;
 
@@ -130,11 +123,10 @@ static int wlan_cmd_802_11_sleep_params(wlan_private * priv,
        wlan_adapter *adapter = priv->adapter;
        struct cmd_ds_802_11_sleep_params *sp = &cmd->params.sleep_params;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
-       cmd->size =
-           cpu_to_le16((sizeof(struct cmd_ds_802_11_sleep_params)) +
-                            S_DS_GEN);
+       cmd->size = cpu_to_le16((sizeof(struct cmd_ds_802_11_sleep_params)) +
+                               S_DS_GEN);
        cmd->command = cpu_to_le16(cmd_802_11_sleep_params);
 
        if (cmd_action == cmd_act_get) {
@@ -151,7 +143,7 @@ static int wlan_cmd_802_11_sleep_params(wlan_private * priv,
                sp->reserved = cpu_to_le16(adapter->sp.sp_reserved);
        }
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_CMD);
        return 0;
 }
 
@@ -165,17 +157,16 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv,
        int ret = 0;
        struct assoc_request * assoc_req = pdata_buf;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
        cmd->command = cpu_to_le16(cmd_802_11_set_wep);
-       cmd->size = cpu_to_le16((sizeof(struct cmd_ds_802_11_set_wep))
-                                    + S_DS_GEN);
+       cmd->size = cpu_to_le16(sizeof(*wep) + S_DS_GEN);
 
        if (cmd_act == cmd_act_add) {
                int i;
 
                if (!assoc_req) {
-                       lbs_pr_debug(1, "Invalid association request!");
+                       lbs_deb_cmd("Invalid association request!");
                        ret = -1;
                        goto done;
                }
@@ -183,11 +174,10 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv,
                wep->action = cpu_to_le16(cmd_act_add);
 
                /* default tx key index */
-               wep->keyindex = cpu_to_le16((u16)
-                                                (assoc_req->wep_tx_keyidx &
-                                                (u32)cmd_WEP_KEY_INDEX_MASK));
+               wep->keyindex = cpu_to_le16((u16)(assoc_req->wep_tx_keyidx &
+                                                 (u32)cmd_WEP_KEY_INDEX_MASK));
 
-               lbs_pr_debug(1, "Tx key Index: %u\n", wep->keyindex);
+               lbs_deb_cmd("Tx key Index: %u\n", le16_to_cpu(wep->keyindex));
 
                /* Copy key types and material to host command structure */
                for (i = 0; i < 4; i++) {
@@ -195,19 +185,21 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv,
 
                        switch (pkey->len) {
                        case KEY_LEN_WEP_40:
-                               wep->keytype[i] = cmd_type_wep_40_bit;
+                               wep->keytype[i] =
+                                       cpu_to_le16(cmd_type_wep_40_bit);
                                memmove(&wep->keymaterial[i], pkey->key,
                                        pkey->len);
                                break;
                        case KEY_LEN_WEP_104:
-                               wep->keytype[i] = cmd_type_wep_104_bit;
+                               wep->keytype[i] =
+                                       cpu_to_le16(cmd_type_wep_104_bit);
                                memmove(&wep->keymaterial[i], pkey->key,
                                        pkey->len);
                                break;
                        case 0:
                                break;
                        default:
-                               lbs_pr_debug(1, "Invalid WEP key %d length of %d\n",
+                               lbs_deb_cmd("Invalid WEP key %d length of %d\n",
                                       i, pkey->len);
                                ret = -1;
                                goto done;
@@ -219,36 +211,37 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv,
                wep->action = cpu_to_le16(cmd_act_remove);
 
                /* default tx key index */
-               wep->keyindex = cpu_to_le16((u16)
-                                                (adapter->wep_tx_keyidx &
-                                                (u32)cmd_WEP_KEY_INDEX_MASK));
+               wep->keyindex = cpu_to_le16((u16)(adapter->wep_tx_keyidx &
+                                                 (u32)cmd_WEP_KEY_INDEX_MASK));
        }
 
        ret = 0;
 
 done:
-       LEAVE();
+       lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
        return ret;
 }
 
 static int wlan_cmd_802_11_enable_rsn(wlan_private * priv,
                                      struct cmd_ds_command *cmd,
-                                     u16 cmd_action)
+                                     u16 cmd_action,
+                                     void * pdata_buf)
 {
        struct cmd_ds_802_11_enable_rsn *penableRSN = &cmd->params.enbrsn;
-       wlan_adapter *adapter = priv->adapter;
+       struct assoc_request * assoc_req = pdata_buf;
+
+       lbs_deb_enter(LBS_DEB_CMD);
 
        cmd->command = cpu_to_le16(cmd_802_11_enable_rsn);
-       cmd->size =
-           cpu_to_le16(sizeof(struct cmd_ds_802_11_enable_rsn) +
-                            S_DS_GEN);
+       cmd->size = cpu_to_le16(sizeof(*penableRSN) + S_DS_GEN);
        penableRSN->action = cpu_to_le16(cmd_action);
-       if (adapter->secinfo.WPAenabled || adapter->secinfo.WPA2enabled) {
+       if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) {
                penableRSN->enable = cpu_to_le16(cmd_enable_rsn);
        } else {
                penableRSN->enable = cpu_to_le16(cmd_disable_rsn);
        }
 
+       lbs_deb_leave(LBS_DEB_CMD);
        return 0;
 }
 
@@ -259,14 +252,12 @@ static void set_one_wpa_key(struct MrvlIEtype_keyParamSet * pkeyparamset,
        pkeyparamset->keytypeid = cpu_to_le16(pkey->type);
 
        if (pkey->flags & KEY_INFO_WPA_ENABLED) {
-               pkeyparamset->keyinfo = cpu_to_le16(KEY_INFO_WPA_ENABLED);
-       } else {
-               pkeyparamset->keyinfo = cpu_to_le16(!KEY_INFO_WPA_ENABLED);
+               pkeyparamset->keyinfo |= cpu_to_le16(KEY_INFO_WPA_ENABLED);
        }
-
        if (pkey->flags & KEY_INFO_WPA_UNICAST) {
                pkeyparamset->keyinfo |= cpu_to_le16(KEY_INFO_WPA_UNICAST);
-       } else if (pkey->flags & KEY_INFO_WPA_MCAST) {
+       }
+       if (pkey->flags & KEY_INFO_WPA_MCAST) {
                pkeyparamset->keyinfo |= cpu_to_le16(KEY_INFO_WPA_MCAST);
        }
 
@@ -284,46 +275,45 @@ static int wlan_cmd_802_11_key_material(wlan_private * priv,
                                        u16 cmd_action,
                                        u32 cmd_oid, void *pdata_buf)
 {
-       wlan_adapter *adapter = priv->adapter;
        struct cmd_ds_802_11_key_material *pkeymaterial =
            &cmd->params.keymaterial;
+       struct assoc_request * assoc_req = pdata_buf;
        int ret = 0;
        int index = 0;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
        cmd->command = cpu_to_le16(cmd_802_11_key_material);
        pkeymaterial->action = cpu_to_le16(cmd_action);
 
        if (cmd_action == cmd_act_get) {
-               cmd->size = cpu_to_le16(  S_DS_GEN
-                                            + sizeof (pkeymaterial->action));
+               cmd->size = cpu_to_le16(S_DS_GEN + sizeof (pkeymaterial->action));
                ret = 0;
                goto done;
        }
 
        memset(&pkeymaterial->keyParamSet, 0, sizeof(pkeymaterial->keyParamSet));
 
-       if (adapter->wpa_unicast_key.len) {
+       if (test_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags)) {
                set_one_wpa_key(&pkeymaterial->keyParamSet[index],
-                               &adapter->wpa_unicast_key);
+                               &assoc_req->wpa_unicast_key);
                index++;
        }
 
-       if (adapter->wpa_mcast_key.len) {
+       if (test_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags)) {
                set_one_wpa_key(&pkeymaterial->keyParamSet[index],
-                               &adapter->wpa_mcast_key);
+                               &assoc_req->wpa_mcast_key);
                index++;
        }
 
        cmd->size = cpu_to_le16(  S_DS_GEN
-                                    + sizeof (pkeymaterial->action)
-                                    + index * sizeof(struct MrvlIEtype_keyParamSet));
+                               + sizeof (pkeymaterial->action)
+                               + (index * sizeof(struct MrvlIEtype_keyParamSet)));
 
        ret = 0;
 
 done:
-       LEAVE();
+       lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
        return ret;
 }
 
@@ -354,8 +344,7 @@ static int wlan_cmd_802_11_get_stat(wlan_private * priv,
 {
        cmd->command = cpu_to_le16(cmd_802_11_get_stat);
        cmd->size =
-           cpu_to_le16(sizeof(struct cmd_ds_802_11_get_stat) +
-                            S_DS_GEN);
+           cpu_to_le16(sizeof(struct cmd_ds_802_11_get_stat) + S_DS_GEN);
 
        return 0;
 }
@@ -369,14 +358,12 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv,
        wlan_adapter *adapter = priv->adapter;
        u8 ucTemp;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
-       lbs_pr_debug(1, "SNMP_CMD: cmd_oid = 0x%x\n", cmd_oid);
+       lbs_deb_cmd("SNMP_CMD: cmd_oid = 0x%x\n", cmd_oid);
 
        cmd->command = cpu_to_le16(cmd_802_11_snmp_mib);
-       cmd->size =
-           cpu_to_le16(sizeof(struct cmd_ds_802_11_snmp_mib) +
-                            S_DS_GEN);
+       cmd->size = cpu_to_le16(sizeof(*pSNMPMIB) + S_DS_GEN);
 
        switch (cmd_oid) {
        case OID_802_11_INFRASTRUCTURE_MODE:
@@ -407,7 +394,7 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv,
                                pSNMPMIB->querytype = cmd_act_set;
                                pSNMPMIB->bufsize = sizeof(u16);
                                ulTemp = *(u32 *)pdata_buf;
-                               *((unsigned short *)(pSNMPMIB->value)) =
+                               *((__le16 *)(pSNMPMIB->value)) =
                                    cpu_to_le16((u16) ulTemp);
                        }
                        break;
@@ -420,15 +407,12 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv,
                        pSNMPMIB->oid = cpu_to_le16((u16) fragthresh_i);
 
                        if (cmd_action == cmd_act_get) {
-                               pSNMPMIB->querytype =
-                                   cpu_to_le16(cmd_act_get);
+                               pSNMPMIB->querytype = cpu_to_le16(cmd_act_get);
                        } else if (cmd_action == cmd_act_set) {
-                               pSNMPMIB->querytype =
-                                   cpu_to_le16(cmd_act_set);
-                               pSNMPMIB->bufsize =
-                                   cpu_to_le16(sizeof(u16));
+                               pSNMPMIB->querytype = cpu_to_le16(cmd_act_set);
+                               pSNMPMIB->bufsize = cpu_to_le16(sizeof(u16));
                                ulTemp = *((u32 *) pdata_buf);
-                               *((unsigned short *)(pSNMPMIB->value)) =
+                               *((__le16 *)(pSNMPMIB->value)) =
                                    cpu_to_le16((u16) ulTemp);
 
                        }
@@ -443,16 +427,12 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv,
                        pSNMPMIB->oid = le16_to_cpu((u16) rtsthresh_i);
 
                        if (cmd_action == cmd_act_get) {
-                               pSNMPMIB->querytype =
-                                   cpu_to_le16(cmd_act_get);
+                               pSNMPMIB->querytype = cpu_to_le16(cmd_act_get);
                        } else if (cmd_action == cmd_act_set) {
-                               pSNMPMIB->querytype =
-                                   cpu_to_le16(cmd_act_set);
-                               pSNMPMIB->bufsize =
-                                   cpu_to_le16(sizeof(u16));
-                               ulTemp = *((u32 *)
-                                          pdata_buf);
-                               *(unsigned short *)(pSNMPMIB->value) =
+                               pSNMPMIB->querytype = cpu_to_le16(cmd_act_set);
+                               pSNMPMIB->bufsize = cpu_to_le16(sizeof(u16));
+                               ulTemp = *((u32 *)pdata_buf);
+                               *(__le16 *)(pSNMPMIB->value) =
                                    cpu_to_le16((u16) ulTemp);
 
                        }
@@ -462,13 +442,11 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv,
                pSNMPMIB->oid = cpu_to_le16((u16) short_retrylim_i);
 
                if (cmd_action == cmd_act_get) {
-                       pSNMPMIB->querytype =
-                           cpu_to_le16(cmd_act_get);
+                       pSNMPMIB->querytype = cpu_to_le16(cmd_act_get);
                } else if (cmd_action == cmd_act_set) {
-                       pSNMPMIB->querytype =
-                           cpu_to_le16(cmd_act_set);
+                       pSNMPMIB->querytype = cpu_to_le16(cmd_act_set);
                        pSNMPMIB->bufsize = cpu_to_le16(sizeof(u16));
-                       *((unsigned short *)(pSNMPMIB->value)) =
+                       *((__le16 *)(pSNMPMIB->value)) =
                            cpu_to_le16((u16) adapter->txretrycount);
                }
 
@@ -477,16 +455,18 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv,
                break;
        }
 
-       lbs_pr_debug(1,
+       lbs_deb_cmd(
               "SNMP_CMD: command=0x%x, size=0x%x, seqnum=0x%x, result=0x%x\n",
-              cmd->command, cmd->size, cmd->seqnum, cmd->result);
+              le16_to_cpu(cmd->command), le16_to_cpu(cmd->size),
+              le16_to_cpu(cmd->seqnum), le16_to_cpu(cmd->result));
 
-       lbs_pr_debug(1,
+       lbs_deb_cmd(
               "SNMP_CMD: action=0x%x, oid=0x%x, oidsize=0x%x, value=0x%x\n",
-              pSNMPMIB->querytype, pSNMPMIB->oid, pSNMPMIB->bufsize,
-              *(u16 *) pSNMPMIB->value);
+              le16_to_cpu(pSNMPMIB->querytype), le16_to_cpu(pSNMPMIB->oid),
+              le16_to_cpu(pSNMPMIB->bufsize),
+              le16_to_cpu(*(__le16 *) pSNMPMIB->value));
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_CMD);
        return 0;
 }
 
@@ -495,10 +475,9 @@ static int wlan_cmd_802_11_radio_control(wlan_private * priv,
                                         int cmd_action)
 {
        wlan_adapter *adapter = priv->adapter;
-       struct cmd_ds_802_11_radio_control *pradiocontrol =
-           &cmd->params.radio;
+       struct cmd_ds_802_11_radio_control *pradiocontrol = &cmd->params.radio;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
        cmd->size =
            cpu_to_le16((sizeof(struct cmd_ds_802_11_radio_control)) +
@@ -527,7 +506,7 @@ static int wlan_cmd_802_11_radio_control(wlan_private * priv,
        else
                pradiocontrol->control &= cpu_to_le16(~TURN_ON_RF);
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_CMD);
        return 0;
 }
 
@@ -538,16 +517,16 @@ static int wlan_cmd_802_11_rf_tx_power(wlan_private * priv,
 
        struct cmd_ds_802_11_rf_tx_power *prtp = &cmd->params.txp;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
        cmd->size =
-           cpu_to_le16((sizeof(struct cmd_ds_802_11_rf_tx_power)) +
-                            S_DS_GEN);
+           cpu_to_le16((sizeof(struct cmd_ds_802_11_rf_tx_power)) + S_DS_GEN);
        cmd->command = cpu_to_le16(cmd_802_11_rf_tx_power);
-       prtp->action = cmd_action;
+       prtp->action = cpu_to_le16(cmd_action);
 
-       lbs_pr_debug(1, "RF_TX_POWER_CMD: size:%d cmd:0x%x Act:%d\n", cmd->size,
-              cmd->command, prtp->action);
+       lbs_deb_cmd("RF_TX_POWER_CMD: size:%d cmd:0x%x Act:%d\n",
+                   le16_to_cpu(cmd->size), le16_to_cpu(cmd->command),
+                   le16_to_cpu(prtp->action));
 
        switch (cmd_action) {
        case cmd_act_tx_power_opt_get:
@@ -557,14 +536,12 @@ static int wlan_cmd_802_11_rf_tx_power(wlan_private * priv,
 
        case cmd_act_tx_power_opt_set_high:
                prtp->action = cpu_to_le16(cmd_act_set);
-               prtp->currentlevel =
-                   cpu_to_le16(cmd_act_tx_power_index_high);
+               prtp->currentlevel = cpu_to_le16(cmd_act_tx_power_index_high);
                break;
 
        case cmd_act_tx_power_opt_set_mid:
                prtp->action = cpu_to_le16(cmd_act_set);
-               prtp->currentlevel =
-                   cpu_to_le16(cmd_act_tx_power_index_mid);
+               prtp->currentlevel = cpu_to_le16(cmd_act_tx_power_index_mid);
                break;
 
        case cmd_act_tx_power_opt_set_low:
@@ -572,7 +549,8 @@ static int wlan_cmd_802_11_rf_tx_power(wlan_private * priv,
                prtp->currentlevel = cpu_to_le16(*((u16 *) pdata_buf));
                break;
        }
-       LEAVE();
+
+       lbs_deb_leave(LBS_DEB_CMD);
        return 0;
 }
 
@@ -583,15 +561,12 @@ static int wlan_cmd_802_11_rf_antenna(wlan_private * priv,
        struct cmd_ds_802_11_rf_antenna *rant = &cmd->params.rant;
 
        cmd->command = cpu_to_le16(cmd_802_11_rf_antenna);
-       cmd->size =
-           cpu_to_le16(sizeof(struct cmd_ds_802_11_rf_antenna) +
-                            S_DS_GEN);
+       cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_rf_antenna) +
+                               S_DS_GEN);
 
        rant->action = cpu_to_le16(cmd_action);
-       if ((cmd_action == cmd_act_set_rx) ||
-           (cmd_action == cmd_act_set_tx)) {
-               rant->antennamode =
-                   cpu_to_le16((u16) (*(u32 *) pdata_buf));
+       if ((cmd_action == cmd_act_set_rx) || (cmd_action == cmd_act_set_tx)) {
+               rant->antennamode = cpu_to_le16((u16) (*(u32 *) pdata_buf));
        }
 
        return 0;
@@ -610,13 +585,13 @@ static int wlan_cmd_802_11_rate_adapt_rateset(wlan_private * priv,
                             + S_DS_GEN);
        cmd->command = cpu_to_le16(cmd_802_11_rate_adapt_rateset);
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
-       rateadapt->action = cmd_action;
-       rateadapt->enablehwauto = adapter->enablehwauto;
-       rateadapt->bitmap = adapter->ratebitmap;
+       rateadapt->action = cpu_to_le16(cmd_action);
+       rateadapt->enablehwauto = cpu_to_le16(adapter->enablehwauto);
+       rateadapt->bitmap = cpu_to_le16(adapter->ratebitmap);
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_CMD);
        return 0;
 }
 
@@ -626,12 +601,10 @@ static int wlan_cmd_802_11_data_rate(wlan_private * priv,
 {
        struct cmd_ds_802_11_data_rate *pdatarate = &cmd->params.drate;
        wlan_adapter *adapter = priv->adapter;
-       u16 action = cmd_action;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
-       cmd->size =
-           cpu_to_le16(sizeof(struct cmd_ds_802_11_data_rate) +
+       cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_data_rate) +
                             S_DS_GEN);
 
        cmd->command = cpu_to_le16(cmd_802_11_data_rate);
@@ -640,15 +613,15 @@ static int wlan_cmd_802_11_data_rate(wlan_private * priv,
 
        pdatarate->action = cpu_to_le16(cmd_action);
 
-       if (action == cmd_act_set_tx_fix_rate) {
+       if (cmd_action == cmd_act_set_tx_fix_rate) {
                pdatarate->datarate[0] = libertas_data_rate_to_index(adapter->datarate);
-               lbs_pr_debug(1, "Setting FW for fixed rate 0x%02X\n",
+               lbs_deb_cmd("Setting FW for fixed rate 0x%02X\n",
                       adapter->datarate);
-       } else if (action == cmd_act_set_tx_auto) {
-               lbs_pr_debug(1, "Setting FW for AUTO rate\n");
+       } else if (cmd_action == cmd_act_set_tx_auto) {
+               lbs_deb_cmd("Setting FW for AUTO rate\n");
        }
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_CMD);
        return 0;
 }
 
@@ -659,8 +632,7 @@ static int wlan_cmd_mac_multicast_adr(wlan_private * priv,
        struct cmd_ds_mac_multicast_adr *pMCastAdr = &cmd->params.madr;
        wlan_adapter *adapter = priv->adapter;
 
-       cmd->size =
-           cpu_to_le16(sizeof(struct cmd_ds_mac_multicast_adr) +
+       cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mac_multicast_adr) +
                             S_DS_GEN);
        cmd->command = cpu_to_le16(cmd_mac_multicast_adr);
 
@@ -680,8 +652,8 @@ static int wlan_cmd_802_11_rf_channel(wlan_private * priv,
        struct cmd_ds_802_11_rf_channel *rfchan = &cmd->params.rfchannel;
 
        cmd->command = cpu_to_le16(cmd_802_11_rf_channel);
-       cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_rf_channel)
-                                    + S_DS_GEN);
+       cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_rf_channel) +
+                               S_DS_GEN);
 
        if (option == cmd_opt_802_11_rf_channel_set) {
                rfchan->currentchannel = cpu_to_le16(*((u16 *) pdata_buf));
@@ -698,9 +670,8 @@ static int wlan_cmd_802_11_rssi(wlan_private * priv,
        wlan_adapter *adapter = priv->adapter;
 
        cmd->command = cpu_to_le16(cmd_802_11_rssi);
-       cmd->size =
-           cpu_to_le16(sizeof(struct cmd_ds_802_11_rssi) + S_DS_GEN);
-       cmd->params.rssi.N = priv->adapter->bcn_avg_factor;
+       cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_rssi) + S_DS_GEN);
+       cmd->params.rssi.N = cpu_to_le16(priv->adapter->bcn_avg_factor);
 
        /* reset Beacon SNR/NF/RSSI values */
        adapter->SNR[TYPE_BEACON][TYPE_NOAVG] = 0;
@@ -719,7 +690,7 @@ static int wlan_cmd_reg_access(wlan_private * priv,
 {
        struct wlan_offset_value *offval;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
        offval = (struct wlan_offset_value *)pdata_buf;
 
@@ -729,9 +700,8 @@ static int wlan_cmd_reg_access(wlan_private * priv,
                        struct cmd_ds_mac_reg_access *macreg;
 
                        cmdptr->size =
-                           cpu_to_le16(sizeof
-                                            (struct cmd_ds_mac_reg_access)
-                                            + S_DS_GEN);
+                           cpu_to_le16(sizeof (struct cmd_ds_mac_reg_access)
+                                       + S_DS_GEN);
                        macreg =
                            (struct cmd_ds_mac_reg_access *)&cmdptr->params.
                            macreg;
@@ -785,7 +755,7 @@ static int wlan_cmd_reg_access(wlan_private * priv,
                break;
        }
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_CMD);
        return 0;
 }
 
@@ -796,8 +766,7 @@ static int wlan_cmd_802_11_mac_address(wlan_private * priv,
        wlan_adapter *adapter = priv->adapter;
 
        cmd->command = cpu_to_le16(cmd_802_11_mac_address);
-       cmd->size =
-           cpu_to_le16(sizeof(struct cmd_ds_802_11_mac_address) +
+       cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_mac_address) +
                             S_DS_GEN);
        cmd->result = 0;
 
@@ -818,12 +787,11 @@ static int wlan_cmd_802_11_eeprom_access(wlan_private * priv,
 {
        struct wlan_ioctl_regrdwr *ea = pdata_buf;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
        cmd->command = cpu_to_le16(cmd_802_11_eeprom_access);
-       cmd->size =
-           cpu_to_le16(sizeof(struct cmd_ds_802_11_eeprom_access) +
-                            S_DS_GEN);
+       cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_eeprom_access) +
+                               S_DS_GEN);
        cmd->result = 0;
 
        cmd->params.rdeeprom.action = cpu_to_le16(ea->action);
@@ -839,11 +807,10 @@ static int wlan_cmd_bt_access(wlan_private * priv,
                               u16 cmd_action, void *pdata_buf)
 {
        struct cmd_ds_bt_access *bt_access = &cmd->params.bt;
-       lbs_pr_debug(1, "BT CMD(%d)\n", cmd_action);
+       lbs_deb_cmd("BT CMD(%d)\n", cmd_action);
 
        cmd->command = cpu_to_le16(cmd_bt_access);
-       cmd->size = cpu_to_le16(sizeof(struct cmd_ds_bt_access)
-                                    + S_DS_GEN);
+       cmd->size = cpu_to_le16(sizeof(struct cmd_ds_bt_access) + S_DS_GEN);
        cmd->result = 0;
        bt_access->action = cpu_to_le16(cmd_action);
 
@@ -861,6 +828,11 @@ static int wlan_cmd_bt_access(wlan_private * priv,
                break;
        case cmd_act_bt_access_reset:
                break;
+       case cmd_act_bt_access_set_invert:
+               bt_access->id = cpu_to_le32(*(u32 *) pdata_buf);
+               break;
+       case cmd_act_bt_access_get_invert:
+               break;
        default:
                break;
        }
@@ -872,11 +844,10 @@ static int wlan_cmd_fwt_access(wlan_private * priv,
                               u16 cmd_action, void *pdata_buf)
 {
        struct cmd_ds_fwt_access *fwt_access = &cmd->params.fwt;
-       lbs_pr_debug(1, "FWT CMD(%d)\n", cmd_action);
+       lbs_deb_cmd("FWT CMD(%d)\n", cmd_action);
 
        cmd->command = cpu_to_le16(cmd_fwt_access);
-       cmd->size = cpu_to_le16(sizeof(struct cmd_ds_fwt_access)
-                                    + S_DS_GEN);
+       cmd->size = cpu_to_le16(sizeof(struct cmd_ds_fwt_access) + S_DS_GEN);
        cmd->result = 0;
 
        if (pdata_buf)
@@ -894,11 +865,10 @@ static int wlan_cmd_mesh_access(wlan_private * priv,
                                u16 cmd_action, void *pdata_buf)
 {
        struct cmd_ds_mesh_access *mesh_access = &cmd->params.mesh;
-       lbs_pr_debug(1, "FWT CMD(%d)\n", cmd_action);
+       lbs_deb_cmd("FWT CMD(%d)\n", cmd_action);
 
        cmd->command = cpu_to_le16(cmd_mesh_access);
-       cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mesh_access)
-                                    + S_DS_GEN);
+       cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mesh_access) + S_DS_GEN);
        cmd->result = 0;
 
        if (pdata_buf)
@@ -916,23 +886,23 @@ void libertas_queue_cmd(wlan_adapter * adapter, struct cmd_ctrl_node *cmdnode, u
        unsigned long flags;
        struct cmd_ds_command *cmdptr;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
        if (!cmdnode) {
-               lbs_pr_debug(1, "QUEUE_CMD: cmdnode is NULL\n");
+               lbs_deb_cmd("QUEUE_CMD: cmdnode is NULL\n");
                goto done;
        }
 
        cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr;
        if (!cmdptr) {
-               lbs_pr_debug(1, "QUEUE_CMD: cmdptr is NULL\n");
+               lbs_deb_cmd("QUEUE_CMD: cmdptr is NULL\n");
                goto done;
        }
 
        /* Exit_PS command needs to be queued in the header always. */
        if (cmdptr->command == cmd_802_11_ps_mode) {
                struct cmd_ds_802_11_ps_mode *psm = &cmdptr->params.psmode;
-               if (psm->action == cmd_subcmd_exit_ps) {
+               if (psm->action == cpu_to_le16(cmd_subcmd_exit_ps)) {
                        if (adapter->psstate != PS_STATE_FULL_POWER)
                                addtail = 0;
                }
@@ -948,13 +918,12 @@ void libertas_queue_cmd(wlan_adapter * adapter, struct cmd_ctrl_node *cmdnode, u
 
        spin_unlock_irqrestore(&adapter->driver_lock, flags);
 
-       lbs_pr_debug(1, "QUEUE_CMD: Inserted node=%p, cmd=0x%x in cmdpendingq\n",
+       lbs_deb_cmd("QUEUE_CMD: Inserted node=%p, cmd=0x%x in cmdpendingq\n",
               cmdnode,
-              ((struct cmd_ds_gen*)cmdnode->bufvirtualaddr)->command);
+              le16_to_cpu(((struct cmd_ds_gen*)cmdnode->bufvirtualaddr)->command));
 
 done:
-       LEAVE();
-       return;
+       lbs_deb_leave(LBS_DEB_CMD);
 }
 
 /*
@@ -974,10 +943,10 @@ static int DownloadcommandToStation(wlan_private * priv,
        u16 cmdsize;
        u16 command;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
        if (!adapter || !cmdnode) {
-               lbs_pr_debug(1, "DNLD_CMD: adapter = %p, cmdnode = %p\n",
+               lbs_deb_cmd("DNLD_CMD: adapter = %p, cmdnode = %p\n",
                       adapter, cmdnode);
                if (cmdnode) {
                        spin_lock_irqsave(&adapter->driver_lock, flags);
@@ -993,7 +962,7 @@ static int DownloadcommandToStation(wlan_private * priv,
 
        spin_lock_irqsave(&adapter->driver_lock, flags);
        if (!cmdptr || !cmdptr->size) {
-               lbs_pr_debug(1, "DNLD_CMD: cmdptr is Null or cmd size is Zero, "
+               lbs_deb_cmd("DNLD_CMD: cmdptr is Null or cmd size is Zero, "
                       "Not sending\n");
                __libertas_cleanup_and_insert_cmd(priv, cmdnode);
                spin_unlock_irqrestore(&adapter->driver_lock, flags);
@@ -1004,8 +973,8 @@ static int DownloadcommandToStation(wlan_private * priv,
        adapter->cur_cmd = cmdnode;
        adapter->cur_cmd_retcode = 0;
        spin_unlock_irqrestore(&adapter->driver_lock, flags);
-       lbs_pr_debug(1, "DNLD_CMD:: Before download, size of cmd = %d\n",
-              cmdptr->size);
+       lbs_deb_cmd("DNLD_CMD:: Before download, size of cmd = %d\n",
+                   le16_to_cpu(cmdptr->size));
 
        cmdsize = cmdptr->size;
 
@@ -1014,10 +983,10 @@ static int DownloadcommandToStation(wlan_private * priv,
        cmdnode->cmdwaitqwoken = 0;
        cmdsize = cpu_to_le16(cmdsize);
 
-       ret = libertas_sbi_host_to_card(priv, MVMS_CMD, (u8 *) cmdptr, cmdsize);
+       ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmdptr, cmdsize);
 
        if (ret != 0) {
-               lbs_pr_debug(1, "DNLD_CMD: Host to Card failed\n");
+               lbs_deb_cmd("DNLD_CMD: Host to Card failed\n");
                spin_lock_irqsave(&adapter->driver_lock, flags);
                __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd);
                adapter->cur_cmd = NULL;
@@ -1026,12 +995,11 @@ static int DownloadcommandToStation(wlan_private * priv,
                goto done;
        }
 
-       lbs_pr_debug(1, "DNLD_CMD: Sent command 0x%x @ %lu\n", command, jiffies);
+       lbs_deb_cmd("DNLD_CMD: Sent command 0x%x @ %lu\n", command, jiffies);
        lbs_dbg_hex("DNLD_CMD: command", cmdnode->bufvirtualaddr, cmdsize);
 
        /* Setup the timer after transmit command */
-       if (command == cmd_802_11_scan
-           || command == cmd_802_11_authenticate
+       if (command == cmd_802_11_scan || command == cmd_802_11_authenticate
            || command == cmd_802_11_associate)
                mod_timer(&adapter->command_timer, jiffies + (10*HZ));
        else
@@ -1039,8 +1007,8 @@ static int DownloadcommandToStation(wlan_private * priv,
 
        ret = 0;
 
-      done:
-       LEAVE();
+done:
+       lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
        return ret;
 }
 
@@ -1049,17 +1017,16 @@ static int wlan_cmd_mac_control(wlan_private * priv,
 {
        struct cmd_ds_mac_control *mac = &cmd->params.macctrl;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
        cmd->command = cpu_to_le16(cmd_mac_control);
-       cmd->size =
-           cpu_to_le16(sizeof(struct cmd_ds_mac_control) + S_DS_GEN);
+       cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mac_control) + S_DS_GEN);
        mac->action = cpu_to_le16(priv->adapter->currentpacketfilter);
 
-       lbs_pr_debug(1, "wlan_cmd_mac_control(): action=0x%X size=%d\n",
-              mac->action, cmd->size);
+       lbs_deb_cmd("wlan_cmd_mac_control(): action=0x%X size=%d\n",
+                   le16_to_cpu(mac->action), le16_to_cpu(cmd->size));
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_CMD);
        return 0;
 }
 
@@ -1093,17 +1060,17 @@ int libertas_set_radio_control(wlan_private * priv)
 {
        int ret = 0;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
        ret = libertas_prepare_and_send_command(priv,
                                    cmd_802_11_radio_control,
                                    cmd_act_set,
                                    cmd_option_waitforrsp, 0, NULL);
 
-       lbs_pr_debug(1, "RADIO_SET: on or off: 0x%X, preamble = 0x%X\n",
+       lbs_deb_cmd("RADIO_SET: on or off: 0x%X, preamble = 0x%X\n",
               priv->adapter->radioon, priv->adapter->preamble);
 
-       LEAVE();
+       lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
        return ret;
 }
 
@@ -1111,16 +1078,16 @@ int libertas_set_mac_packet_filter(wlan_private * priv)
 {
        int ret = 0;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
-       lbs_pr_debug(1, "libertas_set_mac_packet_filter value = %x\n",
+       lbs_deb_cmd("libertas_set_mac_packet_filter value = %x\n",
               priv->adapter->currentpacketfilter);
 
        /* Send MAC control command to station */
        ret = libertas_prepare_and_send_command(priv,
                                    cmd_mac_control, 0, 0, 0, NULL);
 
-       LEAVE();
+       lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
        return ret;
 }
 
@@ -1146,16 +1113,16 @@ int libertas_prepare_and_send_command(wlan_private * priv,
        struct cmd_ds_command *cmdptr;
        unsigned long flags;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
        if (!adapter) {
-               lbs_pr_debug(1, "PREP_CMD: adapter is Null\n");
+               lbs_deb_cmd("PREP_CMD: adapter is Null\n");
                ret = -1;
                goto done;
        }
 
        if (adapter->surpriseremoved) {
-               lbs_pr_debug(1, "PREP_CMD: Card is Removed\n");
+               lbs_deb_cmd("PREP_CMD: Card is Removed\n");
                ret = -1;
                goto done;
        }
@@ -1163,7 +1130,7 @@ int libertas_prepare_and_send_command(wlan_private * priv,
        cmdnode = libertas_get_free_cmd_ctrl_node(priv);
 
        if (cmdnode == NULL) {
-               lbs_pr_debug(1, "PREP_CMD: No free cmdnode\n");
+               lbs_deb_cmd("PREP_CMD: No free cmdnode\n");
 
                /* Wake up main thread to execute next command */
                wake_up_interruptible(&priv->mainthread.waitq);
@@ -1175,11 +1142,11 @@ int libertas_prepare_and_send_command(wlan_private * priv,
 
        cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr;
 
-       lbs_pr_debug(1, "PREP_CMD: Val of cmd ptr=%p, command=0x%X\n",
+       lbs_deb_cmd("PREP_CMD: Val of cmd ptr=%p, command=0x%X\n",
               cmdptr, cmd_no);
 
        if (!cmdptr) {
-               lbs_pr_debug(1, "PREP_CMD: bufvirtualaddr of cmdnode is NULL\n");
+               lbs_deb_cmd("PREP_CMD: bufvirtualaddr of cmdnode is NULL\n");
                libertas_cleanup_and_insert_cmd(priv, cmdnode);
                ret = -1;
                goto done;
@@ -1189,7 +1156,7 @@ int libertas_prepare_and_send_command(wlan_private * priv,
        adapter->seqnum++;
        cmdptr->seqnum = cpu_to_le16(adapter->seqnum);
 
-       cmdptr->command = cmd_no;
+       cmdptr->command = cpu_to_le16(cmd_no);
        cmdptr->result = 0;
 
        switch (cmd_no) {
@@ -1298,13 +1265,13 @@ int libertas_prepare_and_send_command(wlan_private * priv,
                break;
 
        case cmd_802_11_enable_rsn:
-               ret = wlan_cmd_802_11_enable_rsn(priv, cmdptr, cmd_action);
+               ret = wlan_cmd_802_11_enable_rsn(priv, cmdptr, cmd_action,
+                               pdata_buf);
                break;
 
        case cmd_802_11_key_material:
-               ret = wlan_cmd_802_11_key_material(priv, cmdptr,
-                                                  cmd_action, cmd_oid,
-                                                  pdata_buf);
+               ret = wlan_cmd_802_11_key_material(priv, cmdptr, cmd_action,
+                               cmd_oid, pdata_buf);
                break;
 
        case cmd_802_11_pairwise_tsc:
@@ -1325,9 +1292,8 @@ int libertas_prepare_and_send_command(wlan_private * priv,
        case cmd_802_11_get_afc:
 
                cmdptr->command = cpu_to_le16(cmd_no);
-               cmdptr->size =
-                   cpu_to_le16(sizeof(struct cmd_ds_802_11_afc) +
-                                    S_DS_GEN);
+               cmdptr->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_afc) +
+                                          S_DS_GEN);
 
                memmove(&cmdptr->params.afc,
                        pdata_buf, sizeof(struct cmd_ds_802_11_afc));
@@ -1406,29 +1372,26 @@ int libertas_prepare_and_send_command(wlan_private * priv,
 
        case cmd_get_tsf:
                cmdptr->command = cpu_to_le16(cmd_get_tsf);
-               cmdptr->size =
-                   cpu_to_le16(sizeof(struct cmd_ds_get_tsf)
-                                    + S_DS_GEN);
+               cmdptr->size = cpu_to_le16(sizeof(struct cmd_ds_get_tsf) +
+                                          S_DS_GEN);
                ret = 0;
                break;
        case cmd_802_11_tx_rate_query:
-               cmdptr->command =
-                   cpu_to_le16(cmd_802_11_tx_rate_query);
-               cmdptr->size =
-                   cpu_to_le16(sizeof(struct cmd_tx_rate_query) +
-                                    S_DS_GEN);
+               cmdptr->command = cpu_to_le16(cmd_802_11_tx_rate_query);
+               cmdptr->size = cpu_to_le16(sizeof(struct cmd_tx_rate_query) +
+                                          S_DS_GEN);
                adapter->txrate = 0;
                ret = 0;
                break;
        default:
-               lbs_pr_debug(1, "PREP_CMD: unknown command- %#x\n", cmd_no);
+               lbs_deb_cmd("PREP_CMD: unknown command- %#x\n", cmd_no);
                ret = -1;
                break;
        }
 
        /* return error, since the command preparation failed */
        if (ret != 0) {
-               lbs_pr_debug(1, "PREP_CMD: command preparation failed\n");
+               lbs_deb_cmd("PREP_CMD: command preparation failed\n");
                libertas_cleanup_and_insert_cmd(priv, cmdnode);
                ret = -1;
                goto done;
@@ -1441,7 +1404,7 @@ int libertas_prepare_and_send_command(wlan_private * priv,
        wake_up_interruptible(&priv->mainthread.waitq);
 
        if (wait_option & cmd_option_waitforrsp) {
-               lbs_pr_debug(1, "PREP_CMD: Wait for CMD response\n");
+               lbs_deb_cmd("PREP_CMD: Wait for CMD response\n");
                might_sleep();
                wait_event_interruptible(cmdnode->cmdwait_q,
                                         cmdnode->cmdwaitqwoken);
@@ -1449,7 +1412,7 @@ int libertas_prepare_and_send_command(wlan_private * priv,
 
        spin_lock_irqsave(&adapter->driver_lock, flags);
        if (adapter->cur_cmd_retcode) {
-               lbs_pr_debug(1, "PREP_CMD: command failed with return code=%d\n",
+               lbs_deb_cmd("PREP_CMD: command failed with return code=%d\n",
                       adapter->cur_cmd_retcode);
                adapter->cur_cmd_retcode = 0;
                ret = -1;
@@ -1457,9 +1420,10 @@ int libertas_prepare_and_send_command(wlan_private * priv,
        spin_unlock_irqrestore(&adapter->driver_lock, flags);
 
 done:
-       LEAVE();
+       lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
        return ret;
 }
+EXPORT_SYMBOL_GPL(libertas_prepare_and_send_command);
 
 /**
  *  @brief This function allocates the command buffer and link
@@ -1477,33 +1441,29 @@ int libertas_allocate_cmd_buffer(wlan_private * priv)
        u8 *ptempvirtualaddr;
        wlan_adapter *adapter = priv->adapter;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
        /* Allocate and initialize cmdCtrlNode */
        ulbufsize = sizeof(struct cmd_ctrl_node) * MRVDRV_NUM_OF_CMD_BUFFER;
 
-       if (!(tempcmd_array = kmalloc(ulbufsize, GFP_KERNEL))) {
-               lbs_pr_debug(1,
+       if (!(tempcmd_array = kzalloc(ulbufsize, GFP_KERNEL))) {
+               lbs_deb_cmd(
                       "ALLOC_CMD_BUF: failed to allocate tempcmd_array\n");
                ret = -1;
                goto done;
        }
-
        adapter->cmd_array = tempcmd_array;
-       memset(adapter->cmd_array, 0, ulbufsize);
 
        /* Allocate and initialize command buffers */
        ulbufsize = MRVDRV_SIZE_OF_CMD_BUFFER;
        for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) {
-               if (!(ptempvirtualaddr = kmalloc(ulbufsize, GFP_KERNEL))) {
-                       lbs_pr_debug(1,
+               if (!(ptempvirtualaddr = kzalloc(ulbufsize, GFP_KERNEL))) {
+                       lbs_deb_cmd(
                               "ALLOC_CMD_BUF: ptempvirtualaddr: out of memory\n");
                        ret = -1;
                        goto done;
                }
 
-               memset(ptempvirtualaddr, 0, ulbufsize);
-
                /* Update command buffer virtual */
                tempcmd_array[i].bufvirtualaddr = ptempvirtualaddr;
        }
@@ -1514,8 +1474,9 @@ int libertas_allocate_cmd_buffer(wlan_private * priv)
        }
 
        ret = 0;
-      done:
-       LEAVE();
+
+done:
+       lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
        return ret;
 }
 
@@ -1527,16 +1488,16 @@ int libertas_allocate_cmd_buffer(wlan_private * priv)
  */
 int libertas_free_cmd_buffer(wlan_private * priv)
 {
-       u32 ulbufsize;
+       u32 ulbufsize; /* Someone needs to die for this. Slowly and painfully */
        unsigned int i;
        struct cmd_ctrl_node *tempcmd_array;
        wlan_adapter *adapter = priv->adapter;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
        /* need to check if cmd array is allocated or not */
        if (adapter->cmd_array == NULL) {
-               lbs_pr_debug(1, "FREE_CMD_BUF: cmd_array is Null\n");
+               lbs_deb_cmd("FREE_CMD_BUF: cmd_array is Null\n");
                goto done;
        }
 
@@ -1546,7 +1507,7 @@ int libertas_free_cmd_buffer(wlan_private * priv)
        ulbufsize = MRVDRV_SIZE_OF_CMD_BUFFER;
        for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) {
                if (tempcmd_array[i].bufvirtualaddr) {
-                       lbs_pr_debug(1, "Free all the array\n");
+                       lbs_deb_cmd("Free all the array\n");
                        kfree(tempcmd_array[i].bufvirtualaddr);
                        tempcmd_array[i].bufvirtualaddr = NULL;
                }
@@ -1554,13 +1515,13 @@ int libertas_free_cmd_buffer(wlan_private * priv)
 
        /* Release cmd_ctrl_node */
        if (adapter->cmd_array) {
-               lbs_pr_debug(1, "Free cmd_array\n");
+               lbs_deb_cmd("Free cmd_array\n");
                kfree(adapter->cmd_array);
                adapter->cmd_array = NULL;
        }
 
 done:
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_CMD);
        return 0;
 }
 
@@ -1586,16 +1547,18 @@ struct cmd_ctrl_node *libertas_get_free_cmd_ctrl_node(wlan_private * priv)
                tempnode = (struct cmd_ctrl_node *)adapter->cmdfreeq.next;
                list_del((struct list_head *)tempnode);
        } else {
-               lbs_pr_debug(1, "GET_CMD_NODE: cmd_ctrl_node is not available\n");
+               lbs_deb_cmd("GET_CMD_NODE: cmd_ctrl_node is not available\n");
                tempnode = NULL;
        }
 
        spin_unlock_irqrestore(&adapter->driver_lock, flags);
 
        if (tempnode) {
+               /*
                lbs_pr_debug(3, "GET_CMD_NODE: cmdCtrlNode available\n");
                lbs_pr_debug(3, "GET_CMD_NODE: cmdCtrlNode Address = %p\n",
                       tempnode);
+               */
                cleanup_cmdnode(tempnode);
        }
 
@@ -1638,7 +1601,7 @@ void libertas_set_cmd_ctrl_node(wlan_private * priv,
                    struct cmd_ctrl_node *ptempnode,
                    u32 cmd_oid, u16 wait_option, void *pdata_buf)
 {
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
        if (!ptempnode)
                return;
@@ -1647,7 +1610,7 @@ void libertas_set_cmd_ctrl_node(wlan_private * priv,
        ptempnode->wait_option = wait_option;
        ptempnode->pdata_buf = pdata_buf;
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_CMD);
 }
 
 /**
@@ -1666,7 +1629,7 @@ int libertas_execute_next_command(wlan_private * priv)
        unsigned long flags;
        int ret = 0;
 
-       lbs_pr_debug(1, "libertas_execute_next_command\n");
+       lbs_deb_enter(LBS_DEB_CMD);
 
        spin_lock_irqsave(&adapter->driver_lock, flags);
 
@@ -1685,23 +1648,24 @@ int libertas_execute_next_command(wlan_private * priv)
        spin_unlock_irqrestore(&adapter->driver_lock, flags);
 
        if (cmdnode) {
-               lbs_pr_debug(1,
+               lbs_deb_cmd(
                       "EXEC_NEXT_CMD: Got next command from cmdpendingq\n");
                cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr;
 
                if (is_command_allowed_in_ps(cmdptr->command)) {
-                       if ((adapter->psstate == PS_STATE_SLEEP)
-                           || (adapter->psstate == PS_STATE_PRE_SLEEP)
-                           ) {
-                               lbs_pr_debug(1,
+                       if ((adapter->psstate == PS_STATE_SLEEP) ||
+                           (adapter->psstate == PS_STATE_PRE_SLEEP)) {
+                               lbs_deb_cmd(
                                       "EXEC_NEXT_CMD: Cannot send cmd 0x%x in psstate %d\n",
-                                      cmdptr->command, adapter->psstate);
+                                      le16_to_cpu(cmdptr->command),
+                                      adapter->psstate);
                                ret = -1;
                                goto done;
                        }
-                       lbs_pr_debug(1, "EXEC_NEXT_CMD: OK to send command "
+                       lbs_deb_cmd("EXEC_NEXT_CMD: OK to send command "
                               "0x%x in psstate %d\n",
-                              cmdptr->command, adapter->psstate);
+                                   le16_to_cpu(cmdptr->command),
+                                   adapter->psstate);
                } else if (adapter->psstate != PS_STATE_FULL_POWER) {
                        /*
                         * 1. Non-PS command:
@@ -1737,12 +1701,12 @@ int libertas_execute_next_command(wlan_private * priv)
                                struct cmd_ds_802_11_ps_mode *psm =
                                    &cmdptr->params.psmode;
 
-                               lbs_pr_debug(1,
+                               lbs_deb_cmd(
                                       "EXEC_NEXT_CMD: PS cmd- action=0x%x\n",
                                       psm->action);
                                if (psm->action !=
                                    cpu_to_le16(cmd_subcmd_exit_ps)) {
-                                       lbs_pr_debug(1,
+                                       lbs_deb_cmd(
                                               "EXEC_NEXT_CMD: Ignore Enter PS cmd\n");
                                        list_del((struct list_head *)cmdnode);
                                        libertas_cleanup_and_insert_cmd(priv, cmdnode);
@@ -1751,10 +1715,9 @@ int libertas_execute_next_command(wlan_private * priv)
                                        goto done;
                                }
 
-                               if ((adapter->psstate == PS_STATE_SLEEP)
-                                   || (adapter->psstate == PS_STATE_PRE_SLEEP)
-                                   ) {
-                                       lbs_pr_debug(1,
+                               if ((adapter->psstate == PS_STATE_SLEEP) ||
+                                   (adapter->psstate == PS_STATE_PRE_SLEEP)) {
+                                       lbs_deb_cmd(
                                               "EXEC_NEXT_CMD: Ignore ExitPS cmd in sleep\n");
                                        list_del((struct list_head *)cmdnode);
                                        libertas_cleanup_and_insert_cmd(priv, cmdnode);
@@ -1764,13 +1727,13 @@ int libertas_execute_next_command(wlan_private * priv)
                                        goto done;
                                }
 
-                               lbs_pr_debug(1,
+                               lbs_deb_cmd(
                                       "EXEC_NEXT_CMD: Sending Exit_PS down...\n");
                        }
                }
                list_del((struct list_head *)cmdnode);
-               lbs_pr_debug(1, "EXEC_NEXT_CMD: Sending 0x%04X command\n",
-                      cmdptr->command);
+               lbs_deb_cmd("EXEC_NEXT_CMD: Sending 0x%04X command\n",
+                           le16_to_cpu(cmdptr->command));
                DownloadcommandToStation(priv, cmdnode);
        } else {
                /*
@@ -1780,18 +1743,18 @@ int libertas_execute_next_command(wlan_private * priv)
                if ((adapter->psmode != wlan802_11powermodecam) &&
                    (adapter->psstate == PS_STATE_FULL_POWER) &&
                    (adapter->connect_status == libertas_connected)) {
-                       if (adapter->secinfo.WPAenabled
-                           || adapter->secinfo.WPA2enabled) {
+                       if (adapter->secinfo.WPAenabled ||
+                           adapter->secinfo.WPA2enabled) {
                                /* check for valid WPA group keys */
-                               if (adapter->wpa_mcast_key.len
-                                   || adapter->wpa_unicast_key.len) {
-                                       lbs_pr_debug(1,
+                               if (adapter->wpa_mcast_key.len ||
+                                   adapter->wpa_unicast_key.len) {
+                                       lbs_deb_cmd(
                                               "EXEC_NEXT_CMD: WPA enabled and GTK_SET"
                                               " go back to PS_SLEEP");
                                        libertas_ps_sleep(priv, 0);
                                }
                        } else {
-                               lbs_pr_debug(1,
+                               lbs_deb_cmd(
                                       "EXEC_NEXT_CMD: command PendQ is empty,"
                                       " go back to PS_SLEEP");
                                libertas_ps_sleep(priv, 0);
@@ -1801,6 +1764,7 @@ int libertas_execute_next_command(wlan_private * priv)
 
        ret = 0;
 done:
+       lbs_deb_leave(LBS_DEB_CMD);
        return ret;
 }
 
@@ -1809,7 +1773,7 @@ void libertas_send_iwevcustom_event(wlan_private * priv, s8 * str)
        union iwreq_data iwrq;
        u8 buf[50];
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
        memset(&iwrq, 0, sizeof(union iwreq_data));
        memset(buf, 0, sizeof(buf));
@@ -1819,15 +1783,13 @@ void libertas_send_iwevcustom_event(wlan_private * priv, s8 * str)
        iwrq.data.length = strlen(buf) + 1 + IW_EV_LCP_LEN;
 
        /* Send Event to upper layer */
-       lbs_pr_debug(1, "Event Indication string = %s\n",
-              (char *)buf);
-       lbs_pr_debug(1, "Event Indication String length = %d\n", iwrq.data.length);
+       lbs_deb_cmd("Event Indication string = %s\n", (char *)buf);
+       lbs_deb_cmd("Event Indication String length = %d\n", iwrq.data.length);
 
-       lbs_pr_debug(1, "Sending wireless event IWEVCUSTOM for %s\n", str);
-       wireless_send_event(priv->wlan_dev.netdev, IWEVCUSTOM, &iwrq, buf);
+       lbs_deb_cmd("Sending wireless event IWEVCUSTOM for %s\n", str);
+       wireless_send_event(priv->dev, IWEVCUSTOM, &iwrq, buf);
 
-       LEAVE();
-       return;
+       lbs_deb_leave(LBS_DEB_CMD);
 }
 
 static int sendconfirmsleep(wlan_private * priv, u8 * cmdptr, u16 size)
@@ -1836,19 +1798,19 @@ static int sendconfirmsleep(wlan_private * priv, u8 * cmdptr, u16 size)
        wlan_adapter *adapter = priv->adapter;
        int ret = 0;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
-       lbs_pr_debug(1, "SEND_SLEEPC_CMD: Before download, size of cmd = %d\n",
+       lbs_deb_cmd("SEND_SLEEPC_CMD: Before download, size of cmd = %d\n",
               size);
 
        lbs_dbg_hex("SEND_SLEEPC_CMD: Sleep confirm command", cmdptr, size);
 
-       ret = libertas_sbi_host_to_card(priv, MVMS_CMD, cmdptr, size);
-       priv->wlan_dev.dnld_sent = DNLD_RES_RECEIVED;
+       ret = priv->hw_host_to_card(priv, MVMS_CMD, cmdptr, size);
+       priv->dnld_sent = DNLD_RES_RECEIVED;
 
        spin_lock_irqsave(&adapter->driver_lock, flags);
        if (adapter->intcounter || adapter->currenttxskb)
-               lbs_pr_debug(1, "SEND_SLEEPC_CMD: intcounter=%d currenttxskb=%p\n",
+               lbs_deb_cmd("SEND_SLEEPC_CMD: intcounter=%d currenttxskb=%p\n",
                       adapter->intcounter, adapter->currenttxskb);
        spin_unlock_irqrestore(&adapter->driver_lock, flags);
 
@@ -1860,23 +1822,22 @@ static int sendconfirmsleep(wlan_private * priv, u8 * cmdptr, u16 size)
                if (!adapter->intcounter) {
                        adapter->psstate = PS_STATE_SLEEP;
                } else {
-                       lbs_pr_debug(1, "SEND_SLEEPC_CMD: After sent,IntC=%d\n",
+                       lbs_deb_cmd("SEND_SLEEPC_CMD: After sent,IntC=%d\n",
                               adapter->intcounter);
                }
                spin_unlock_irqrestore(&adapter->driver_lock, flags);
 
-               lbs_pr_debug(1, "SEND_SLEEPC_CMD: Sent Confirm Sleep command\n");
-               lbs_pr_debug(1, "+");
+               lbs_deb_cmd("SEND_SLEEPC_CMD: Sent Confirm Sleep command\n");
+               lbs_deb_cmd("+");
        }
 
-       LEAVE();
+       lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
        return ret;
 }
 
 void libertas_ps_sleep(wlan_private * priv, int wait_option)
 {
-
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
        /*
         * PS is currently supported only in Infrastructure mode
@@ -1886,8 +1847,7 @@ void libertas_ps_sleep(wlan_private * priv, int wait_option)
        libertas_prepare_and_send_command(priv, cmd_802_11_ps_mode,
                              cmd_subcmd_enter_ps, wait_option, 0, NULL);
 
-       LEAVE();
-       return;
+       lbs_deb_leave(LBS_DEB_CMD);
 }
 
 /**
@@ -1899,20 +1859,19 @@ void libertas_ps_sleep(wlan_private * priv, int wait_option)
  */
 void libertas_ps_wakeup(wlan_private * priv, int wait_option)
 {
-       enum WLAN_802_11_POWER_MODE Localpsmode;
+       __le32 Localpsmode;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
-       Localpsmode = wlan802_11powermodecam;
+       Localpsmode = cpu_to_le32(wlan802_11powermodecam);
 
-       lbs_pr_debug(1, "Exit_PS: Localpsmode = %d\n", Localpsmode);
+       lbs_deb_cmd("Exit_PS: Localpsmode = %d\n", wlan802_11powermodecam);
 
        libertas_prepare_and_send_command(priv, cmd_802_11_ps_mode,
                              cmd_subcmd_exit_ps,
                              wait_option, 0, &Localpsmode);
 
-       LEAVE();
-       return;
+       lbs_deb_leave(LBS_DEB_CMD);
 }
 
 /**
@@ -1929,31 +1888,31 @@ void libertas_ps_confirm_sleep(wlan_private * priv, u16 psmode)
        wlan_adapter *adapter = priv->adapter;
        u8 allowed = 1;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
-       if (priv->wlan_dev.dnld_sent) {
+       if (priv->dnld_sent) {
                allowed = 0;
-               lbs_pr_debug(1, "D");
+               lbs_deb_cmd("D");
        }
 
        spin_lock_irqsave(&adapter->driver_lock, flags);
        if (adapter->cur_cmd) {
                allowed = 0;
-               lbs_pr_debug(1, "C");
+               lbs_deb_cmd("C");
        }
        if (adapter->intcounter > 0) {
                allowed = 0;
-               lbs_pr_debug(1, "I%d", adapter->intcounter);
+               lbs_deb_cmd("I%d", adapter->intcounter);
        }
        spin_unlock_irqrestore(&adapter->driver_lock, flags);
 
        if (allowed) {
-               lbs_pr_debug(1, "Sending libertas_ps_confirm_sleep\n");
+               lbs_deb_cmd("Sending libertas_ps_confirm_sleep\n");
                sendconfirmsleep(priv, (u8 *) & adapter->libertas_ps_confirm_sleep,
                                 sizeof(struct PS_CMD_ConfirmSleep));
        } else {
-               lbs_pr_debug(1, "Sleep Confirm has been delayed\n");
+               lbs_deb_cmd("Sleep Confirm has been delayed\n");
        }
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_CMD);
 }
index c86454034b5839c64dd9a40f92d07c8c928b6aac..0c3b9a583d83cab84b4d44eb5e0d625a59b3f9d5 100644 (file)
@@ -9,7 +9,6 @@
 #include <net/iw_handler.h>
 
 #include "host.h"
-#include "sbi.h"
 #include "decl.h"
 #include "defs.h"
 #include "dev.h"
@@ -32,7 +31,7 @@ void libertas_mac_event_disconnected(wlan_private * priv)
        if (adapter->connect_status != libertas_connected)
                return;
 
-       lbs_pr_debug(1, "Handles disconnect event.\n");
+       lbs_deb_cmd("Handles disconnect event.\n");
 
        memset(wrqu.ap_addr.sa_data, 0x00, ETH_ALEN);
        wrqu.ap_addr.sa_family = ARPHRD_ETHER;
@@ -43,15 +42,15 @@ void libertas_mac_event_disconnected(wlan_private * priv)
         */
 
        msleep_interruptible(1000);
-       wireless_send_event(priv->wlan_dev.netdev, SIOCGIWAP, &wrqu, NULL);
+       wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);
 
        /* Free Tx and Rx packets */
        kfree_skb(priv->adapter->currenttxskb);
        priv->adapter->currenttxskb = NULL;
 
        /* report disconnect to upper layer */
-       netif_stop_queue(priv->wlan_dev.netdev);
-       netif_carrier_off(priv->wlan_dev.netdev);
+       netif_stop_queue(priv->dev);
+       netif_carrier_off(priv->dev);
 
        /* reset SNR/NF/RSSI values */
        memset(adapter->SNR, 0x00, sizeof(adapter->SNR));
@@ -62,35 +61,32 @@ void libertas_mac_event_disconnected(wlan_private * priv)
        adapter->nextSNRNF = 0;
        adapter->numSNRNF = 0;
        adapter->rxpd_rate = 0;
-       lbs_pr_debug(1, "Current SSID=%s, ssid length=%u\n",
-              adapter->curbssparams.ssid.ssid,
-              adapter->curbssparams.ssid.ssidlength);
-       lbs_pr_debug(1, "Previous SSID=%s, ssid length=%u\n",
-              adapter->previousssid.ssid, adapter->previousssid.ssidlength);
-
-       /* reset internal flags */
-       adapter->secinfo.WPAenabled = 0;
-       adapter->secinfo.WPA2enabled = 0;
-       adapter->wpa_ie_len = 0;
+       lbs_deb_cmd("Current SSID='%s', ssid length=%u\n",
+                   escape_essid(adapter->curbssparams.ssid,
+                                adapter->curbssparams.ssid_len),
+                   adapter->curbssparams.ssid_len);
+       lbs_deb_cmd("Previous SSID='%s', ssid length=%u\n",
+                   escape_essid(adapter->prev_ssid, adapter->prev_ssid_len),
+                   adapter->prev_ssid_len);
 
        adapter->connect_status = libertas_disconnected;
 
-       /*
-        * memorize the previous SSID and BSSID
-        * it could be used for re-assoc
-        */
-       memcpy(&adapter->previousssid,
-              &adapter->curbssparams.ssid, sizeof(struct WLAN_802_11_SSID));
-       memcpy(adapter->previousbssid,
-              adapter->curbssparams.bssid, ETH_ALEN);
+       /* Save previous SSID and BSSID for possible reassociation */
+       memcpy(&adapter->prev_ssid, &adapter->curbssparams.ssid,
+              IW_ESSID_MAX_SIZE);
+       adapter->prev_ssid_len = adapter->curbssparams.ssid_len;
+       memcpy(adapter->prev_bssid, adapter->curbssparams.bssid, ETH_ALEN);
 
-       /* need to erase the current SSID and BSSID info */
-       adapter->pattemptedbssdesc = NULL;
-       memset(&adapter->curbssparams, 0, sizeof(adapter->curbssparams));
+       /* Clear out associated SSID and BSSID since connection is
+        * no longer valid.
+        */
+       memset(&adapter->curbssparams.bssid, 0, ETH_ALEN);
+       memset(&adapter->curbssparams.ssid, 0, IW_ESSID_MAX_SIZE);
+       adapter->curbssparams.ssid_len = 0;
 
        if (adapter->psstate != PS_STATE_FULL_POWER) {
                /* make firmware to exit PS mode */
-               lbs_pr_debug(1, "Disconnected, so exit PS mode.\n");
+               lbs_deb_cmd("Disconnected, so exit PS mode.\n");
                libertas_ps_wakeup(priv, 0);
        }
 }
@@ -122,55 +118,45 @@ static void handle_mic_failureevent(wlan_private * priv, u32 event)
 static int wlan_ret_reg_access(wlan_private * priv,
                               u16 type, struct cmd_ds_command *resp)
 {
+       int ret = 0;
        wlan_adapter *adapter = priv->adapter;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
        switch (type) {
        case cmd_ret_mac_reg_access:
                {
-                       struct cmd_ds_mac_reg_access *reg;
-
-                       reg =
-                           (struct cmd_ds_mac_reg_access *)&resp->params.
-                           macreg;
+                       struct cmd_ds_mac_reg_access *reg = &resp->params.macreg;
 
-                       adapter->offsetvalue.offset = reg->offset;
-                       adapter->offsetvalue.value = reg->value;
+                       adapter->offsetvalue.offset = (u32)le16_to_cpu(reg->offset);
+                       adapter->offsetvalue.value = le32_to_cpu(reg->value);
                        break;
                }
 
        case cmd_ret_bbp_reg_access:
                {
-                       struct cmd_ds_bbp_reg_access *reg;
-                       reg =
-                           (struct cmd_ds_bbp_reg_access *)&resp->params.
-                           bbpreg;
+                       struct cmd_ds_bbp_reg_access *reg = &resp->params.bbpreg;
 
-                       adapter->offsetvalue.offset = reg->offset;
+                       adapter->offsetvalue.offset = (u32)le16_to_cpu(reg->offset);
                        adapter->offsetvalue.value = reg->value;
                        break;
                }
 
        case cmd_ret_rf_reg_access:
                {
-                       struct cmd_ds_rf_reg_access *reg;
-                       reg =
-                           (struct cmd_ds_rf_reg_access *)&resp->params.
-                           rfreg;
+                       struct cmd_ds_rf_reg_access *reg = &resp->params.rfreg;
 
-                       adapter->offsetvalue.offset = reg->offset;
+                       adapter->offsetvalue.offset = (u32)le16_to_cpu(reg->offset);
                        adapter->offsetvalue.value = reg->value;
                        break;
                }
 
        default:
-               LEAVE();
-               return -1;
+               ret = -1;
        }
 
-       LEAVE();
-       return 0;
+       lbs_deb_enter_args(LBS_DEB_CMD, "ret %d", ret);
+       return ret;
 }
 
 static int wlan_ret_get_hw_spec(wlan_private * priv,
@@ -181,19 +167,20 @@ static int wlan_ret_get_hw_spec(wlan_private * priv,
        wlan_adapter *adapter = priv->adapter;
        int ret = 0;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
        adapter->fwcapinfo = le32_to_cpu(hwspec->fwcapinfo);
 
-       adapter->fwreleasenumber = hwspec->fwreleasenumber;
+       memcpy(adapter->fwreleasenumber, hwspec->fwreleasenumber, 4);
 
-       lbs_pr_debug(1, "GET_HW_SPEC: FWReleaseVersion- 0x%X\n",
-              adapter->fwreleasenumber);
-       lbs_pr_debug(1, "GET_HW_SPEC: Permanent addr- %2x:%2x:%2x:%2x:%2x:%2x\n",
+       lbs_deb_cmd("GET_HW_SPEC: FWReleaseVersion- %u.%u.%u.p%u\n",
+                   adapter->fwreleasenumber[2], adapter->fwreleasenumber[1],
+                   adapter->fwreleasenumber[0], adapter->fwreleasenumber[3]);
+       lbs_deb_cmd("GET_HW_SPEC: Permanent addr- %2x:%2x:%2x:%2x:%2x:%2x\n",
               hwspec->permanentaddr[0], hwspec->permanentaddr[1],
               hwspec->permanentaddr[2], hwspec->permanentaddr[3],
               hwspec->permanentaddr[4], hwspec->permanentaddr[5]);
-       lbs_pr_debug(1, "GET_HW_SPEC: hwifversion=0x%X  version=0x%X\n",
+       lbs_deb_cmd("GET_HW_SPEC: hwifversion=0x%X  version=0x%X\n",
               hwspec->hwifversion, hwspec->version);
 
        adapter->regioncode = le16_to_cpu(hwspec->regioncode);
@@ -210,17 +197,15 @@ static int wlan_ret_get_hw_spec(wlan_private * priv,
        if (i >= MRVDRV_MAX_REGION_CODE) {
                adapter->regioncode = 0x10;
                adapter->regiontableindex = 0;
-               lbs_pr_info(
-                      "unidentified region code, use the default (USA)\n");
+               lbs_pr_info("unidentified region code; using the default (USA)\n");
        }
 
-       if (adapter->current_addr[0] == 0xff) {
-               memmove(adapter->current_addr, hwspec->permanentaddr,
-                       ETH_ALEN);
-       }
+       if (adapter->current_addr[0] == 0xff)
+               memmove(adapter->current_addr, hwspec->permanentaddr, ETH_ALEN);
 
-       memcpy(priv->wlan_dev.netdev->dev_addr, adapter->current_addr, ETH_ALEN);
-       memcpy(priv->mesh_dev->dev_addr, adapter->current_addr, ETH_ALEN);
+       memcpy(priv->dev->dev_addr, adapter->current_addr, ETH_ALEN);
+       if (priv->mesh_dev)
+               memcpy(priv->mesh_dev->dev_addr, adapter->current_addr, ETH_ALEN);
 
        if (libertas_set_regiontable(priv, adapter->regioncode, 0)) {
                ret = -1;
@@ -232,8 +217,8 @@ static int wlan_ret_get_hw_spec(wlan_private * priv,
                goto done;
        }
 
-      done:
-       LEAVE();
+done:
+       lbs_deb_enter_args(LBS_DEB_CMD, "ret %d", ret);
        return ret;
 }
 
@@ -243,19 +228,21 @@ static int wlan_ret_802_11_sleep_params(wlan_private * priv,
        struct cmd_ds_802_11_sleep_params *sp = &resp->params.sleep_params;
        wlan_adapter *adapter = priv->adapter;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
+
+       lbs_deb_cmd("error=%x offset=%x stabletime=%x calcontrol=%x\n"
+                   " extsleepclk=%x\n", le16_to_cpu(sp->error),
+                   le16_to_cpu(sp->offset), le16_to_cpu(sp->stabletime),
+                   sp->calcontrol, sp->externalsleepclk);
 
-       lbs_pr_debug(1, "error=%x offset=%x stabletime=%x calcontrol=%x\n"
-              " extsleepclk=%x\n", sp->error, sp->offset,
-              sp->stabletime, sp->calcontrol, sp->externalsleepclk);
        adapter->sp.sp_error = le16_to_cpu(sp->error);
        adapter->sp.sp_offset = le16_to_cpu(sp->offset);
        adapter->sp.sp_stabletime = le16_to_cpu(sp->stabletime);
-       adapter->sp.sp_calcontrol = le16_to_cpu(sp->calcontrol);
-       adapter->sp.sp_extsleepclk = le16_to_cpu(sp->externalsleepclk);
+       adapter->sp.sp_calcontrol = sp->calcontrol;
+       adapter->sp.sp_extsleepclk = sp->externalsleepclk;
        adapter->sp.sp_reserved = le16_to_cpu(sp->reserved);
 
-       LEAVE();
+       lbs_deb_enter(LBS_DEB_CMD);
        return 0;
 }
 
@@ -281,42 +268,38 @@ static int wlan_ret_802_11_snmp_mib(wlan_private * priv,
        u16 oid = le16_to_cpu(smib->oid);
        u16 querytype = le16_to_cpu(smib->querytype);
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
-       lbs_pr_debug(1, "SNMP_RESP: value of the oid = %x, querytype=%x\n", oid,
+       lbs_deb_cmd("SNMP_RESP: value of the oid = %x, querytype=%x\n", oid,
               querytype);
-       lbs_pr_debug(1, "SNMP_RESP: Buf size  = %x\n",
-              le16_to_cpu(smib->bufsize));
+       lbs_deb_cmd("SNMP_RESP: Buf size  = %x\n", le16_to_cpu(smib->bufsize));
 
        if (querytype == cmd_act_get) {
                switch (oid) {
                case fragthresh_i:
                        priv->adapter->fragthsd =
-                           le16_to_cpu(*
-                                            ((unsigned short *)(smib->value)));
-                       lbs_pr_debug(1, "SNMP_RESP: fragthsd =%u\n",
-                              priv->adapter->fragthsd);
+                               le16_to_cpu(*((__le16 *)(smib->value)));
+                       lbs_deb_cmd("SNMP_RESP: fragthsd =%u\n",
+                                   priv->adapter->fragthsd);
                        break;
                case rtsthresh_i:
                        priv->adapter->rtsthsd =
-                           le16_to_cpu(*
-                                            ((unsigned short *)(smib->value)));
-                       lbs_pr_debug(1, "SNMP_RESP: rtsthsd =%u\n",
-                              priv->adapter->rtsthsd);
+                               le16_to_cpu(*((__le16 *)(smib->value)));
+                       lbs_deb_cmd("SNMP_RESP: rtsthsd =%u\n",
+                                   priv->adapter->rtsthsd);
                        break;
                case short_retrylim_i:
                        priv->adapter->txretrycount =
-                           le16_to_cpu(*
-                                            ((unsigned short *)(smib->value)));
-                       lbs_pr_debug(1, "SNMP_RESP: txretrycount =%u\n",
-                              priv->adapter->rtsthsd);
+                               le16_to_cpu(*((__le16 *)(smib->value)));
+                       lbs_deb_cmd("SNMP_RESP: txretrycount =%u\n",
+                                   priv->adapter->rtsthsd);
                        break;
                default:
                        break;
                }
        }
 
-       LEAVE();
+       lbs_deb_enter(LBS_DEB_CMD);
        return 0;
 }
 
@@ -328,7 +311,7 @@ static int wlan_ret_802_11_key_material(wlan_private * priv,
        wlan_adapter *adapter = priv->adapter;
        u16 action = le16_to_cpu(pkeymaterial->action);
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
        /* Copy the returned key to driver private data */
        if (action == cmd_act_get) {
@@ -371,7 +354,7 @@ static int wlan_ret_802_11_key_material(wlan_private * priv,
                }
        }
 
-       LEAVE();
+       lbs_deb_enter(LBS_DEB_CMD);
        return 0;
 }
 
@@ -381,11 +364,11 @@ static int wlan_ret_802_11_mac_address(wlan_private * priv,
        struct cmd_ds_802_11_mac_address *macadd = &resp->params.macadd;
        wlan_adapter *adapter = priv->adapter;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
        memcpy(adapter->current_addr, macadd->macadd, ETH_ALEN);
 
-       LEAVE();
+       lbs_deb_enter(LBS_DEB_CMD);
        return 0;
 }
 
@@ -395,13 +378,13 @@ static int wlan_ret_802_11_rf_tx_power(wlan_private * priv,
        struct cmd_ds_802_11_rf_tx_power *rtp = &resp->params.txp;
        wlan_adapter *adapter = priv->adapter;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
        adapter->txpowerlevel = le16_to_cpu(rtp->currentlevel);
 
-       lbs_pr_debug(1, "Current TxPower Level = %d\n", adapter->txpowerlevel);
+       lbs_deb_cmd("Current TxPower Level = %d\n", adapter->txpowerlevel);
 
-       LEAVE();
+       lbs_deb_enter(LBS_DEB_CMD);
        return 0;
 }
 
@@ -413,14 +396,12 @@ static int wlan_ret_802_11_rf_antenna(wlan_private * priv,
        u16 action = le16_to_cpu(pAntenna->action);
 
        if (action == cmd_act_get_rx)
-               adapter->rxantennamode =
-                   le16_to_cpu(pAntenna->antennamode);
+               adapter->rxantennamode = le16_to_cpu(pAntenna->antennamode);
 
        if (action == cmd_act_get_tx)
-               adapter->txantennamode =
-                   le16_to_cpu(pAntenna->antennamode);
+               adapter->txantennamode = le16_to_cpu(pAntenna->antennamode);
 
-       lbs_pr_debug(1, "RF_ANT_RESP: action = 0x%x, mode = 0x%04x\n",
+       lbs_deb_cmd("RF_ANT_RESP: action = 0x%x, mode = 0x%04x\n",
               action, le16_to_cpu(pAntenna->antennamode));
 
        return 0;
@@ -429,19 +410,17 @@ static int wlan_ret_802_11_rf_antenna(wlan_private * priv,
 static int wlan_ret_802_11_rate_adapt_rateset(wlan_private * priv,
                                              struct cmd_ds_command *resp)
 {
-       struct cmd_ds_802_11_rate_adapt_rateset *rates =
-           &resp->params.rateset;
+       struct cmd_ds_802_11_rate_adapt_rateset *rates = &resp->params.rateset;
        wlan_adapter *adapter = priv->adapter;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
        if (rates->action == cmd_act_get) {
-               adapter->enablehwauto = rates->enablehwauto;
-               adapter->ratebitmap = rates->bitmap;
+               adapter->enablehwauto = le16_to_cpu(rates->enablehwauto);
+               adapter->ratebitmap = le16_to_cpu(rates->bitmap);
        }
 
-       LEAVE();
-
+       lbs_deb_enter(LBS_DEB_CMD);
        return 0;
 }
 
@@ -452,43 +431,42 @@ static int wlan_ret_802_11_data_rate(wlan_private * priv,
        wlan_adapter *adapter = priv->adapter;
        u8 dot11datarate;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
        lbs_dbg_hex("DATA_RATE_RESP: data_rate- ",
                (u8 *) pdatarate, sizeof(struct cmd_ds_802_11_data_rate));
 
        dot11datarate = pdatarate->datarate[0];
-       if (pdatarate->action == cmd_act_get_tx_rate) {
+       if (pdatarate->action == cpu_to_le16(cmd_act_get_tx_rate)) {
                memcpy(adapter->libertas_supported_rates, pdatarate->datarate,
                       sizeof(adapter->libertas_supported_rates));
        }
        adapter->datarate = libertas_index_to_data_rate(dot11datarate);
 
-       LEAVE();
+       lbs_deb_enter(LBS_DEB_CMD);
        return 0;
 }
 
 static int wlan_ret_802_11_rf_channel(wlan_private * priv,
                                      struct cmd_ds_command *resp)
 {
-       struct cmd_ds_802_11_rf_channel *rfchannel =
-           &resp->params.rfchannel;
+       struct cmd_ds_802_11_rf_channel *rfchannel = &resp->params.rfchannel;
        wlan_adapter *adapter = priv->adapter;
        u16 action = le16_to_cpu(rfchannel->action);
        u16 newchannel = le16_to_cpu(rfchannel->currentchannel);
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
        if (action == cmd_opt_802_11_rf_channel_get
            && adapter->curbssparams.channel != newchannel) {
-               lbs_pr_debug(1, "channel Switch: %d to %d\n",
+               lbs_deb_cmd("channel Switch: %d to %d\n",
                       adapter->curbssparams.channel, newchannel);
 
                /* Update the channel again */
                adapter->curbssparams.channel = newchannel;
        }
 
-       LEAVE();
+       lbs_deb_enter(LBS_DEB_CMD);
        return 0;
 }
 
@@ -500,12 +478,10 @@ static int wlan_ret_802_11_rssi(wlan_private * priv,
 
        /* store the non average value */
        adapter->SNR[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->SNR);
-       adapter->NF[TYPE_BEACON][TYPE_NOAVG] =
-           le16_to_cpu(rssirsp->noisefloor);
+       adapter->NF[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->noisefloor);
 
        adapter->SNR[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgSNR);
-       adapter->NF[TYPE_BEACON][TYPE_AVG] =
-           le16_to_cpu(rssirsp->avgnoisefloor);
+       adapter->NF[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgnoisefloor);
 
        adapter->RSSI[TYPE_BEACON][TYPE_NOAVG] =
            CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_NOAVG],
@@ -515,7 +491,7 @@ static int wlan_ret_802_11_rssi(wlan_private * priv,
            CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_AVG] / AVG_SCALE,
                     adapter->NF[TYPE_BEACON][TYPE_AVG] / AVG_SCALE);
 
-       lbs_pr_debug(1, "Beacon RSSI value = 0x%x\n",
+       lbs_deb_cmd("Beacon RSSI value = 0x%x\n",
               adapter->RSSI[TYPE_BEACON][TYPE_AVG]);
 
        return 0;
@@ -528,11 +504,11 @@ static int wlan_ret_802_11_eeprom_access(wlan_private * priv,
        struct wlan_ioctl_regrdwr *pbuf;
        pbuf = (struct wlan_ioctl_regrdwr *) adapter->prdeeprom;
 
-       lbs_pr_debug(1, "eeprom read len=%x\n",
+       lbs_deb_cmd("eeprom read len=%x\n",
               le16_to_cpu(resp->params.rdeeprom.bytecount));
        if (pbuf->NOB < le16_to_cpu(resp->params.rdeeprom.bytecount)) {
                pbuf->NOB = 0;
-               lbs_pr_debug(1, "eeprom read return length is too big\n");
+               lbs_deb_cmd("eeprom read return length is too big\n");
                return -1;
        }
        pbuf->NOB = le16_to_cpu(resp->params.rdeeprom.bytecount);
@@ -549,17 +525,15 @@ static int wlan_ret_802_11_eeprom_access(wlan_private * priv,
 static int wlan_ret_get_log(wlan_private * priv,
                            struct cmd_ds_command *resp)
 {
-       struct cmd_ds_802_11_get_log *logmessage =
-           (struct cmd_ds_802_11_get_log *)&resp->params.glog;
+       struct cmd_ds_802_11_get_log *logmessage = &resp->params.glog;
        wlan_adapter *adapter = priv->adapter;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
-       /* TODO Convert it to Big Endian before copy */
-       memcpy(&adapter->logmsg, logmessage,
-              sizeof(struct cmd_ds_802_11_get_log));
+       /* Stored little-endian */
+       memcpy(&adapter->logmsg, logmessage, sizeof(struct cmd_ds_802_11_get_log));
 
-       LEAVE();
+       lbs_deb_enter(LBS_DEB_CMD);
        return 0;
 }
 
@@ -620,8 +594,7 @@ static inline int handle_cmd_response(u16 respcmd,
        case cmd_ret_802_11_set_afc:
        case cmd_ret_802_11_get_afc:
                spin_lock_irqsave(&adapter->driver_lock, flags);
-               memmove(adapter->cur_cmd->pdata_buf,
-                       &resp->params.afc,
+               memmove(adapter->cur_cmd->pdata_buf, &resp->params.afc,
                        sizeof(struct cmd_ds_802_11_afc));
                spin_unlock_irqrestore(&adapter->driver_lock, flags);
 
@@ -663,7 +636,7 @@ static inline int handle_cmd_response(u16 respcmd,
                break;
 
        case cmd_ret_802_11_key_material:
-               lbs_pr_debug(1, "CMD_RESP: KEY_MATERIAL command response\n");
+               lbs_deb_cmd("CMD_RESP: KEY_MATERIAL command response\n");
                ret = wlan_ret_802_11_key_material(priv, resp);
                break;
 
@@ -687,22 +660,19 @@ static inline int handle_cmd_response(u16 respcmd,
 
        case cmd_ret_802_11_tpc_cfg:
                spin_lock_irqsave(&adapter->driver_lock, flags);
-               memmove(adapter->cur_cmd->pdata_buf,
-                       &resp->params.tpccfg,
+               memmove(adapter->cur_cmd->pdata_buf, &resp->params.tpccfg,
                        sizeof(struct cmd_ds_802_11_tpc_cfg));
                spin_unlock_irqrestore(&adapter->driver_lock, flags);
                break;
        case cmd_ret_802_11_led_gpio_ctrl:
                spin_lock_irqsave(&adapter->driver_lock, flags);
-               memmove(adapter->cur_cmd->pdata_buf,
-                       &resp->params.ledgpio,
+               memmove(adapter->cur_cmd->pdata_buf, &resp->params.ledgpio,
                        sizeof(struct cmd_ds_802_11_led_ctrl));
                spin_unlock_irqrestore(&adapter->driver_lock, flags);
                break;
        case cmd_ret_802_11_pwr_cfg:
                spin_lock_irqsave(&adapter->driver_lock, flags);
-               memmove(adapter->cur_cmd->pdata_buf,
-                       &resp->params.pwrcfg,
+               memmove(adapter->cur_cmd->pdata_buf, &resp->params.pwrcfg,
                        sizeof(struct cmd_ds_802_11_pwr_cfg));
                spin_unlock_irqrestore(&adapter->driver_lock, flags);
 
@@ -724,23 +694,21 @@ static inline int handle_cmd_response(u16 respcmd,
        case cmd_ret_fwt_access:
                spin_lock_irqsave(&adapter->driver_lock, flags);
                if (adapter->cur_cmd->pdata_buf)
-                       memcpy(adapter->cur_cmd->pdata_buf,
-                              &resp->params.fwt,
-                               sizeof(resp->params.fwt));
+                       memcpy(adapter->cur_cmd->pdata_buf, &resp->params.fwt,
+                              sizeof(resp->params.fwt));
                spin_unlock_irqrestore(&adapter->driver_lock, flags);
                break;
        case cmd_ret_mesh_access:
                if (adapter->cur_cmd->pdata_buf)
-                       memcpy(adapter->cur_cmd->pdata_buf,
-                              &resp->params.mesh,
+                       memcpy(adapter->cur_cmd->pdata_buf, &resp->params.mesh,
                               sizeof(resp->params.mesh));
                break;
        case cmd_rte_802_11_tx_rate_query:
                priv->adapter->txrate = resp->params.txrate.txrate;
                break;
        default:
-               lbs_pr_debug(1, "CMD_RESP: Unknown command response %#x\n",
-                      resp->command);
+               lbs_deb_cmd("CMD_RESP: Unknown command response %#x\n",
+                           resp->command);
                break;
        }
        return ret;
@@ -755,9 +723,9 @@ int libertas_process_rx_command(wlan_private * priv)
        ulong flags;
        u16 result;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
-       lbs_pr_debug(1, "CMD_RESP: @ %lu\n", jiffies);
+       lbs_deb_cmd("CMD_RESP: @ %lu\n", jiffies);
 
        /* Now we got response from FW, cancel the command timer */
        del_timer(&adapter->command_timer);
@@ -766,7 +734,7 @@ int libertas_process_rx_command(wlan_private * priv)
        spin_lock_irqsave(&adapter->driver_lock, flags);
 
        if (!adapter->cur_cmd) {
-               lbs_pr_debug(1, "CMD_RESP: NULL cur_cmd=%p\n", adapter->cur_cmd);
+               lbs_deb_cmd("CMD_RESP: NULL cur_cmd=%p\n", adapter->cur_cmd);
                ret = -1;
                spin_unlock_irqrestore(&adapter->driver_lock, flags);
                goto done;
@@ -774,17 +742,17 @@ int libertas_process_rx_command(wlan_private * priv)
        resp = (struct cmd_ds_command *)(adapter->cur_cmd->bufvirtualaddr);
 
        lbs_dbg_hex("CMD_RESP:", adapter->cur_cmd->bufvirtualaddr,
-               priv->wlan_dev.upld_len);
+                   priv->upld_len);
 
        respcmd = le16_to_cpu(resp->command);
 
        result = le16_to_cpu(resp->result);
 
-       lbs_pr_debug(1, "CMD_RESP: %x result: %d length: %d\n", respcmd,
-              result, priv->wlan_dev.upld_len);
+       lbs_deb_cmd("CMD_RESP: %x result: %d length: %d\n", respcmd,
+                   result, priv->upld_len);
 
        if (!(respcmd & 0x8000)) {
-               lbs_pr_debug(1, "Invalid response to command!");
+               lbs_deb_cmd("Invalid response to command!");
                adapter->cur_cmd_retcode = -1;
                __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd);
                adapter->nr_cmd_pending--;
@@ -795,56 +763,52 @@ int libertas_process_rx_command(wlan_private * priv)
        }
 
        /* Store the response code to cur_cmd_retcode. */
-       adapter->cur_cmd_retcode = le16_to_cpu(resp->result);
+       adapter->cur_cmd_retcode = result;;
 
        if (respcmd == cmd_ret_802_11_ps_mode) {
-               struct cmd_ds_802_11_ps_mode *psmode;
+               struct cmd_ds_802_11_ps_mode *psmode = &resp->params.psmode;
+               u16 action = le16_to_cpu(psmode->action);
 
-               psmode = &resp->params.psmode;
-               lbs_pr_debug(1,
+               lbs_deb_cmd(
                       "CMD_RESP: PS_MODE cmd reply result=%#x action=0x%X\n",
-                      resp->result, psmode->action);
-               psmode->action = cpu_to_le16(psmode->action);
+                      result, action);
 
                if (result) {
-                       lbs_pr_debug(1, "CMD_RESP: PS command failed- %#x \n",
-                              resp->result);
-                       if (adapter->mode == IW_MODE_ADHOC) {
-                               /*
-                                * We should not re-try enter-ps command in
-                                * ad-hoc mode. It takes place in
-                                * libertas_execute_next_command().
-                                */
-                               if (psmode->action == cmd_subcmd_enter_ps)
-                                       adapter->psmode =
-                                           wlan802_11powermodecam;
-                       }
-               } else if (psmode->action == cmd_subcmd_enter_ps) {
+                       lbs_deb_cmd("CMD_RESP: PS command failed- %#x \n",
+                                   result);
+                       /*
+                        * We should not re-try enter-ps command in
+                        * ad-hoc mode. It takes place in
+                        * libertas_execute_next_command().
+                        */
+                       if (adapter->mode == IW_MODE_ADHOC &&
+                           action == cmd_subcmd_enter_ps)
+                               adapter->psmode = wlan802_11powermodecam;
+               } else if (action == cmd_subcmd_enter_ps) {
                        adapter->needtowakeup = 0;
                        adapter->psstate = PS_STATE_AWAKE;
 
-                       lbs_pr_debug(1, "CMD_RESP: Enter_PS command response\n");
+                       lbs_deb_cmd("CMD_RESP: Enter_PS command response\n");
                        if (adapter->connect_status != libertas_connected) {
                                /*
                                 * When Deauth Event received before Enter_PS command
                                 * response, We need to wake up the firmware.
                                 */
-                               lbs_pr_debug(1,
+                               lbs_deb_cmd(
                                       "Disconnected, Going to invoke libertas_ps_wakeup\n");
 
-                               mutex_unlock(&adapter->lock);
                                spin_unlock_irqrestore(&adapter->driver_lock, flags);
+                               mutex_unlock(&adapter->lock);
                                libertas_ps_wakeup(priv, 0);
                                mutex_lock(&adapter->lock);
                                spin_lock_irqsave(&adapter->driver_lock, flags);
                        }
-               } else if (psmode->action == cmd_subcmd_exit_ps) {
+               } else if (action == cmd_subcmd_exit_ps) {
                        adapter->needtowakeup = 0;
                        adapter->psstate = PS_STATE_FULL_POWER;
-                       lbs_pr_debug(1, "CMD_RESP: Exit_PS command response\n");
+                       lbs_deb_cmd("CMD_RESP: Exit_PS command response\n");
                } else {
-                       lbs_pr_debug(1, "CMD_RESP: PS- action=0x%X\n",
-                              psmode->action);
+                       lbs_deb_cmd("CMD_RESP: PS- action=0x%X\n", action);
                }
 
                __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd);
@@ -865,15 +829,15 @@ int libertas_process_rx_command(wlan_private * priv)
 
        /* If the command is not successful, cleanup and return failure */
        if ((result != 0 || !(respcmd & 0x8000))) {
-               lbs_pr_debug(1, "CMD_RESP: command reply %#x result=%#x\n",
-                      resp->command, resp->result);
+               lbs_deb_cmd("CMD_RESP: command reply %#x result=%#x\n",
+                      respcmd, result);
                /*
                 * Handling errors here
                 */
                switch (respcmd) {
                case cmd_ret_hw_spec_info:
                case cmd_ret_802_11_reset:
-                       lbs_pr_debug(1, "CMD_RESP: Reset command failed\n");
+                       lbs_deb_cmd("CMD_RESP: Reset command failed\n");
                        break;
 
                }
@@ -903,7 +867,7 @@ int libertas_process_rx_command(wlan_private * priv)
 
 done:
        mutex_unlock(&adapter->lock);
-       LEAVE();
+       lbs_deb_enter_args(LBS_DEB_CMD, "ret %d", ret);
        return ret;
 }
 
@@ -917,37 +881,37 @@ int libertas_process_event(wlan_private * priv)
        eventcause = adapter->eventcause;
        spin_unlock_irq(&adapter->driver_lock);
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_CMD);
 
-       lbs_pr_debug(1, "EVENT Cause %x\n", eventcause);
+       lbs_deb_cmd("EVENT Cause %x\n", eventcause);
 
        switch (eventcause >> SBI_EVENT_CAUSE_SHIFT) {
        case MACREG_INT_CODE_LINK_SENSED:
-               lbs_pr_debug(1, "EVENT: MACREG_INT_CODE_LINK_SENSED\n");
+               lbs_deb_cmd("EVENT: MACREG_INT_CODE_LINK_SENSED\n");
                break;
 
        case MACREG_INT_CODE_DEAUTHENTICATED:
-               lbs_pr_debug(1, "EVENT: Deauthenticated\n");
+               lbs_deb_cmd("EVENT: Deauthenticated\n");
                libertas_mac_event_disconnected(priv);
                break;
 
        case MACREG_INT_CODE_DISASSOCIATED:
-               lbs_pr_debug(1, "EVENT: Disassociated\n");
+               lbs_deb_cmd("EVENT: Disassociated\n");
                libertas_mac_event_disconnected(priv);
                break;
 
        case MACREG_INT_CODE_LINK_LOSE_NO_SCAN:
-               lbs_pr_debug(1, "EVENT: Link lost\n");
+               lbs_deb_cmd("EVENT: Link lost\n");
                libertas_mac_event_disconnected(priv);
                break;
 
        case MACREG_INT_CODE_PS_SLEEP:
-               lbs_pr_debug(1, "EVENT: SLEEP\n");
-               lbs_pr_debug(1, "_");
+               lbs_deb_cmd("EVENT: SLEEP\n");
+               lbs_deb_cmd("_");
 
                /* handle unexpected PS SLEEP event */
                if (adapter->psstate == PS_STATE_FULL_POWER) {
-                       lbs_pr_debug(1,
+                       lbs_deb_cmd(
                               "EVENT: In FULL POWER mode - ignore PS SLEEP\n");
                        break;
                }
@@ -958,12 +922,12 @@ int libertas_process_event(wlan_private * priv)
                break;
 
        case MACREG_INT_CODE_PS_AWAKE:
-               lbs_pr_debug(1, "EVENT: AWAKE \n");
-               lbs_pr_debug(1, "|");
+               lbs_deb_cmd("EVENT: AWAKE \n");
+               lbs_deb_cmd("|");
 
                /* handle unexpected PS AWAKE event */
                if (adapter->psstate == PS_STATE_FULL_POWER) {
-                       lbs_pr_debug(1,
+                       lbs_deb_cmd(
                               "EVENT: In FULL POWER mode - ignore PS AWAKE\n");
                        break;
                }
@@ -977,18 +941,18 @@ int libertas_process_event(wlan_private * priv)
                         * adapter->needtowakeup will be set to FALSE
                         * in libertas_ps_wakeup()
                         */
-                       lbs_pr_debug(1, "Waking up...\n");
+                       lbs_deb_cmd("Waking up...\n");
                        libertas_ps_wakeup(priv, 0);
                }
                break;
 
        case MACREG_INT_CODE_MIC_ERR_UNICAST:
-               lbs_pr_debug(1, "EVENT: UNICAST MIC ERROR\n");
+               lbs_deb_cmd("EVENT: UNICAST MIC ERROR\n");
                handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_UNICAST);
                break;
 
        case MACREG_INT_CODE_MIC_ERR_MULTICAST:
-               lbs_pr_debug(1, "EVENT: MULTICAST MIC ERROR\n");
+               lbs_deb_cmd("EVENT: MULTICAST MIC ERROR\n");
                handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_MULTICAST);
                break;
        case MACREG_INT_CODE_MIB_CHANGED:
@@ -996,7 +960,7 @@ int libertas_process_event(wlan_private * priv)
                break;
 
        case MACREG_INT_CODE_ADHOC_BCN_LOST:
-               lbs_pr_debug(1, "EVENT: HWAC - ADHOC BCN LOST\n");
+               lbs_deb_cmd("EVENT: HWAC - ADHOC BCN LOST\n");
                break;
 
        case MACREG_INT_CODE_RSSI_LOW:
@@ -1015,6 +979,17 @@ int libertas_process_event(wlan_private * priv)
                lbs_pr_alert( "EVENT: SNR_HIGH\n");
                break;
 
+       case MACREG_INT_CODE_MESH_AUTO_STARTED:
+               lbs_pr_alert( "EVENT: MESH_AUTO_STARTED\n");
+               adapter->connect_status = libertas_connected ;
+               if (priv->mesh_open == 1) {
+                       netif_wake_queue(priv->mesh_dev) ;
+                       netif_carrier_on(priv->mesh_dev) ;
+               }
+               adapter->mode = IW_MODE_ADHOC ;
+               schedule_work(&priv->sync_channel);
+               break;
+
        default:
                lbs_pr_alert( "EVENT: unknown event id: %#x\n",
                       eventcause >> SBI_EVENT_CAUSE_SHIFT);
@@ -1024,6 +999,7 @@ int libertas_process_event(wlan_private * priv)
        spin_lock_irq(&adapter->driver_lock);
        adapter->eventcause = 0;
        spin_unlock_irq(&adapter->driver_lock);
-       LEAVE();
+
+       lbs_deb_enter_args(LBS_DEB_CMD, "ret %d", ret);
        return ret;
 }
index 7d7bc5e86a5663610e8d31fc08c7f9020d9aac63..715cbdaa1d4bcf17170717b6148d409e4907ef8d 100644 (file)
@@ -4,6 +4,7 @@
 #include <linux/delay.h>
 #include <linux/mm.h>
 #include <net/iw_handler.h>
+
 #include "dev.h"
 #include "decl.h"
 #include "host.h"
@@ -15,7 +16,9 @@ static char *szStates[] = {
        "Disconnected"
 };
 
-void libertas_debug_init(wlan_private * priv, struct net_device *dev);
+#ifdef PROC_DEBUG
+static void libertas_debug_init(wlan_private * priv, struct net_device *dev);
+#endif
 
 static int open_file_generic(struct inode *inode, struct file *file)
 {
@@ -60,43 +63,33 @@ static ssize_t libertas_getscantable(struct file *file, char __user *userbuf,
        int numscansdone = 0, res;
        unsigned long addr = get_zeroed_page(GFP_KERNEL);
        char *buf = (char *)addr;
+       struct bss_descriptor * iter_bss;
 
-       pos += snprintf(buf+pos, len-pos,
-                       "---------------------------------------");
-       pos += snprintf(buf+pos, len-pos,
-                       "---------------------------------------\n");
        pos += snprintf(buf+pos, len-pos,
                "# | ch  | ss  |       bssid       |   cap    |    TSF   | Qual | SSID \n");
-       pos += snprintf(buf+pos, len-pos,
-               "---------------------------------------");
-       pos += snprintf(buf+pos, len-pos,
-               "---------------------------------------\n");
 
-       while (numscansdone < priv->adapter->numinscantable) {
-               struct bss_descriptor *pbssinfo;
+       mutex_lock(&priv->adapter->lock);
+       list_for_each_entry (iter_bss, &priv->adapter->network_list, list) {
                u16 cap;
 
-               pbssinfo = &priv->adapter->scantable[numscansdone];
-               memcpy(&cap, &pbssinfo->cap, sizeof(cap));
+               memcpy(&cap, &iter_bss->cap, sizeof(cap));
                pos += snprintf(buf+pos, len-pos,
-                       "%02u| %03d | %03ld | %02x:%02x:%02x:%02x:%02x:%02x |",
-                       numscansdone, pbssinfo->channel, pbssinfo->rssi,
-                       pbssinfo->macaddress[0], pbssinfo->macaddress[1],
-                       pbssinfo->macaddress[2], pbssinfo->macaddress[3],
-                       pbssinfo->macaddress[4], pbssinfo->macaddress[5]);
+                       "%02u| %03d | %03ld | " MAC_FMT " |",
+                       numscansdone, iter_bss->channel, iter_bss->rssi,
+                       MAC_ARG(iter_bss->bssid));
                pos += snprintf(buf+pos, len-pos, " %04x-", cap);
                pos += snprintf(buf+pos, len-pos, "%c%c%c |",
-                               pbssinfo->cap.ibss ? 'A' : 'I',
-                               pbssinfo->cap.privacy ? 'P' : ' ',
-                               pbssinfo->cap.spectrummgmt ? 'S' : ' ');
-               pos += snprintf(buf+pos, len-pos, " %08llx |", pbssinfo->networktsf);
-               pos += snprintf(buf+pos, len-pos, " %d |",
-                       SCAN_RSSI(priv->adapter->scantable[numscansdone].rssi));
-
-               pos += snprintf(buf+pos, len-pos, " %s\n", pbssinfo->ssid.ssid);
+                               iter_bss->cap.ibss ? 'A' : 'I',
+                               iter_bss->cap.privacy ? 'P' : ' ',
+                               iter_bss->cap.spectrummgmt ? 'S' : ' ');
+               pos += snprintf(buf+pos, len-pos, " %08llx |", iter_bss->networktsf);
+               pos += snprintf(buf+pos, len-pos, " %d |", SCAN_RSSI(iter_bss->rssi));
+               pos += snprintf(buf+pos, len-pos, " %s\n",
+                               escape_essid(iter_bss->ssid, iter_bss->ssid_len));
 
                numscansdone++;
        }
+       mutex_unlock(&priv->adapter->lock);
 
        res = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
 
@@ -111,7 +104,6 @@ static ssize_t libertas_sleepparams_write(struct file *file,
        wlan_private *priv = file->private_data;
        ssize_t buf_size, res;
        int p1, p2, p3, p4, p5, p6;
-       struct sleep_params sp;
        unsigned long addr = get_zeroed_page(GFP_KERNEL);
        char *buf = (char *)addr;
 
@@ -125,14 +117,12 @@ static ssize_t libertas_sleepparams_write(struct file *file,
                res = -EFAULT;
                goto out_unlock;
        }
-       sp.sp_error = p1;
-       sp.sp_offset = p2;
-       sp.sp_stabletime = p3;
-       sp.sp_calcontrol = p4;
-       sp.sp_extsleepclk = p5;
-       sp.sp_reserved = p6;
-
-       memcpy(&priv->adapter->sp, &sp, sizeof(struct sleep_params));
+       priv->adapter->sp.sp_error = p1;
+       priv->adapter->sp.sp_offset = p2;
+       priv->adapter->sp.sp_stabletime = p3;
+       priv->adapter->sp.sp_calcontrol = p4;
+       priv->adapter->sp.sp_extsleepclk = p5;
+       priv->adapter->sp.sp_reserved = p6;
 
         res = libertas_prepare_and_send_command(priv,
                                cmd_802_11_sleep_params,
@@ -185,7 +175,6 @@ static ssize_t libertas_extscan(struct file *file, const char __user *userbuf,
 {
        wlan_private *priv = file->private_data;
        ssize_t res, buf_size;
-       struct WLAN_802_11_SSID extscan_ssid;
        union iwreq_data wrqu;
        unsigned long addr = get_zeroed_page(GFP_KERNEL);
        char *buf = (char *)addr;
@@ -196,13 +185,10 @@ static ssize_t libertas_extscan(struct file *file, const char __user *userbuf,
                goto out_unlock;
        }
 
-       memcpy(&extscan_ssid.ssid, buf, strlen(buf)-1);
-       extscan_ssid.ssidlength = strlen(buf)-1;
-
-       libertas_send_specific_SSID_scan(priv, &extscan_ssid, 1);
+       libertas_send_specific_ssid_scan(priv, buf, strlen(buf)-1, 0);
 
        memset(&wrqu, 0, sizeof(union iwreq_data));
-       wireless_send_event(priv->wlan_dev.netdev, SIOCGIWSCAN, &wrqu, NULL);
+       wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL);
 
 out_unlock:
        free_page(addr);
@@ -251,16 +237,13 @@ static void libertas_parse_bssid(char *buf, size_t count,
 {
        char *hold;
        unsigned int mac[ETH_ALEN];
-       int i;
 
        hold = strstr(buf, "bssid=");
        if (!hold)
                return;
        hold += 6;
-       sscanf(hold, "%2x:%2x:%2x:%2x:%2x:%2x", mac, mac+1, mac+2, mac+3,
-                       mac+4, mac+5);
-       for(i=0;i<ETH_ALEN;i++)
-               scan_cfg->specificBSSID[i] = mac[i];
+       sscanf(hold, MAC_FMT, mac, mac+1, mac+2, mac+3, mac+4, mac+5);
+       memcpy(scan_cfg->bssid, mac, ETH_ALEN);
 }
 
 static void libertas_parse_ssid(char *buf, size_t count,
@@ -278,28 +261,26 @@ static void libertas_parse_ssid(char *buf, size_t count,
                end = buf + count - 1;
 
        size = min((size_t)IW_ESSID_MAX_SIZE, (size_t) (end - hold));
-       strncpy(scan_cfg->specificSSID, hold, size);
+       strncpy(scan_cfg->ssid, hold, size);
 
        return;
 }
 
-static void libertas_parse_keep(char *buf, size_t count,
-                        struct wlan_ioctl_user_scan_cfg *scan_cfg)
+static int libertas_parse_clear(char *buf, size_t count, const char *tag)
 {
        char *hold;
        int val;
 
-       hold = strstr(buf, "keep=");
+       hold = strstr(buf, tag);
        if (!hold)
-               return;
-       hold += 5;
+               return 0;
+       hold += strlen(tag);
        sscanf(hold, "%d", &val);
 
        if (val != 0)
                val = 1;
 
-       scan_cfg->keeppreviousscan = val;
-       return;
+       return val;
 }
 
 static int libertas_parse_dur(char *buf, size_t count,
@@ -382,17 +363,18 @@ static ssize_t libertas_setuserscan(struct file *file,
        dur = libertas_parse_dur(buf, count, scan_cfg);
        libertas_parse_chan(buf, count, scan_cfg, dur);
        libertas_parse_bssid(buf, count, scan_cfg);
+       scan_cfg->clear_bssid = libertas_parse_clear(buf, count, "clear_bssid=");
        libertas_parse_ssid(buf, count, scan_cfg);
-       libertas_parse_keep(buf, count, scan_cfg);
+       scan_cfg->clear_ssid = libertas_parse_clear(buf, count, "clear_ssid=");
        libertas_parse_probes(buf, count, scan_cfg);
        libertas_parse_type(buf, count, scan_cfg);
 
-       wlan_scan_networks(priv, scan_cfg);
+       wlan_scan_networks(priv, scan_cfg, 1);
        wait_event_interruptible(priv->adapter->cmd_pending,
                                 !priv->adapter->nr_cmd_pending);
 
        memset(&wrqu, 0x00, sizeof(union iwreq_data));
-       wireless_send_event(priv->wlan_dev.netdev, SIOCGIWSCAN, &wrqu, NULL);
+       wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL);
 
 out_unlock:
        free_page(addr);
@@ -407,11 +389,11 @@ static int libertas_event_initcmd(wlan_private *priv, void **response_buf,
        u16 wait_option = cmd_option_waitforrsp;
 
        if (!(*cmdnode = libertas_get_free_cmd_ctrl_node(priv))) {
-               lbs_pr_debug(1, "failed libertas_get_free_cmd_ctrl_node\n");
+               lbs_deb_debugfs("failed libertas_get_free_cmd_ctrl_node\n");
                return -ENOMEM;
        }
        if (!(*response_buf = kmalloc(3000, GFP_KERNEL))) {
-               lbs_pr_debug(1, "failed to allocate response buffer!\n");
+               lbs_deb_debugfs("failed to allocate response buffer!\n");
                return -ENOMEM;
        }
        libertas_set_cmd_ctrl_node(priv, *cmdnode, 0, wait_option, NULL);
@@ -420,8 +402,8 @@ static int libertas_event_initcmd(wlan_private *priv, void **response_buf,
        (*cmdnode)->cmdflags |= CMD_F_HOSTCMD;
        (*cmdnode)->cmdwaitqwoken = 0;
        *cmd = (struct cmd_ds_command *)(*cmdnode)->bufvirtualaddr;
-       (*cmd)->command = cmd_802_11_subscribe_event;
-       (*cmd)->seqnum = ++priv->adapter->seqnum;
+       (*cmd)->command = cpu_to_le16(cmd_802_11_subscribe_event);
+       (*cmd)->seqnum = cpu_to_le16(++priv->adapter->seqnum);
        (*cmd)->result = 0;
        return 0;
 }
@@ -447,26 +429,25 @@ static ssize_t libertas_lowrssi_read(struct file *file, char __user *userbuf,
        }
 
        event = &pcmdptr->params.subscribe_event;
-       event->action = cmd_act_get;
-       pcmdptr->size =
-       cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
+       event->action = cpu_to_le16(cmd_act_get);
+       pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
        libertas_queue_cmd(adapter, pcmdnode, 1);
        wake_up_interruptible(&priv->mainthread.waitq);
 
        /* Sleep until response is generated by FW */
        wait_event_interruptible(pcmdnode->cmdwait_q,
-                               pcmdnode->cmdwaitqwoken);
+                                pcmdnode->cmdwaitqwoken);
 
        pcmdptr = response_buf;
        if (pcmdptr->result) {
-               lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__,
-                       pcmdptr->result);
+               lbs_pr_err("%s: fail, result=%d\n", __func__,
+                          le16_to_cpu(pcmdptr->result));
                kfree(response_buf);
                free_page(addr);
                return 0;
        }
 
-       if (pcmdptr->command != cmd_ret_802_11_subscribe_event) {
+       if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
                lbs_pr_err("command response incorrect!\n");
                kfree(response_buf);
                free_page(addr);
@@ -474,17 +455,17 @@ static ssize_t libertas_lowrssi_read(struct file *file, char __user *userbuf,
        }
 
        cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
-       event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN);
-       while (cmd_len < pcmdptr->size) {
-               struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len);
-               switch(header->type) {
+       event = (void *)(response_buf + S_DS_GEN);
+       while (cmd_len < le16_to_cpu(pcmdptr->size)) {
+               struct mrvlietypesheader *header = (void *)(response_buf + cmd_len);
+               switch (header->type) {
                struct mrvlietypes_rssithreshold  *Lowrssi;
-               case TLV_TYPE_RSSI_LOW:
-               Lowrssi = (struct mrvlietypes_rssithreshold *)(response_buf + cmd_len);
-               pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
-                               Lowrssi->rssivalue,
-                               Lowrssi->rssifreq,
-                               (event->events & 0x0001)?1:0);
+               case __constant_cpu_to_le16(TLV_TYPE_RSSI_LOW):
+                       Lowrssi = (void *)(response_buf + cmd_len);
+                       pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
+                                       Lowrssi->rssivalue,
+                                       Lowrssi->rssifreq,
+                                       (event->events & cpu_to_le16(0x0001))?1:0);
                default:
                        cmd_len += sizeof(struct mrvlietypes_snrthreshold);
                        break;
@@ -512,21 +493,20 @@ static u16 libertas_get_events_bitmap(wlan_private *priv)
                return res;
 
        event = &pcmdptr->params.subscribe_event;
-       event->action = cmd_act_get;
-       pcmdptr->size =
-       cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
+       event->action = cpu_to_le16(cmd_act_get);
+       pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
        libertas_queue_cmd(adapter, pcmdnode, 1);
        wake_up_interruptible(&priv->mainthread.waitq);
 
        /* Sleep until response is generated by FW */
        wait_event_interruptible(pcmdnode->cmdwait_q,
-                               pcmdnode->cmdwaitqwoken);
+                                pcmdnode->cmdwaitqwoken);
 
        pcmdptr = response_buf;
 
        if (pcmdptr->result) {
-               lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__,
-                       pcmdptr->result);
+               lbs_pr_err("%s: fail, result=%d\n", __func__,
+                          le16_to_cpu(pcmdptr->result));
                kfree(response_buf);
                return 0;
        }
@@ -538,7 +518,7 @@ static u16 libertas_get_events_bitmap(wlan_private *priv)
        }
 
        event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN);
-       event_bitmap = event->events;
+       event_bitmap = le16_to_cpu(event->events);
        kfree(response_buf);
        return event_bitmap;
 }
@@ -579,7 +559,7 @@ static ssize_t libertas_lowrssi_write(struct file *file,
                goto out_unlock;
 
        event = &pcmdptr->params.subscribe_event;
-       event->action = cmd_act_set;
+       event->action = cpu_to_le16(cmd_act_set);
        pcmdptr->size = cpu_to_le16(S_DS_GEN +
                sizeof(struct cmd_ds_802_11_subscribe_event) +
                sizeof(struct mrvlietypes_rssithreshold));
@@ -588,30 +568,30 @@ static ssize_t libertas_lowrssi_write(struct file *file,
        ptr = (u8*) pcmdptr+cmd_len;
        rssi_threshold = (struct mrvlietypes_rssithreshold *)(ptr);
        rssi_threshold->header.type = cpu_to_le16(0x0104);
-       rssi_threshold->header.len = 2;
-       rssi_threshold->rssivalue = cpu_to_le16(value);
-       rssi_threshold->rssifreq = cpu_to_le16(freq);
+       rssi_threshold->header.len = cpu_to_le16(2);
+       rssi_threshold->rssivalue = value;
+       rssi_threshold->rssifreq = freq;
        event_bitmap |= subscribed ? 0x0001 : 0x0;
-       event->events = event_bitmap;
+       event->events = cpu_to_le16(event_bitmap);
 
        libertas_queue_cmd(adapter, pcmdnode, 1);
        wake_up_interruptible(&priv->mainthread.waitq);
 
        /* Sleep until response is generated by FW */
        wait_event_interruptible(pcmdnode->cmdwait_q,
-                               pcmdnode->cmdwaitqwoken);
+                                pcmdnode->cmdwaitqwoken);
 
        pcmdptr = response_buf;
 
        if (pcmdptr->result) {
-               lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__,
-                       pcmdptr->result);
+               lbs_pr_err("%s: fail, result=%d\n", __func__,
+                          le16_to_cpu(pcmdptr->result));
                kfree(response_buf);
                free_page(addr);
                return 0;
        }
 
-       if (pcmdptr->command != cmd_ret_802_11_subscribe_event) {
+       if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
                lbs_pr_err("command response incorrect!\n");
                kfree(response_buf);
                free_page(addr);
@@ -645,27 +625,26 @@ static ssize_t libertas_lowsnr_read(struct file *file, char __user *userbuf,
        }
 
        event = &pcmdptr->params.subscribe_event;
-       event->action = cmd_act_get;
-       pcmdptr->size =
-       cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
+       event->action = cpu_to_le16(cmd_act_get);
+       pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
        libertas_queue_cmd(adapter, pcmdnode, 1);
        wake_up_interruptible(&priv->mainthread.waitq);
 
        /* Sleep until response is generated by FW */
        wait_event_interruptible(pcmdnode->cmdwait_q,
-                               pcmdnode->cmdwaitqwoken);
+                                pcmdnode->cmdwaitqwoken);
 
        pcmdptr = response_buf;
 
        if (pcmdptr->result) {
-               lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__,
-                       pcmdptr->result);
+               lbs_pr_err("%s: fail, result=%d\n", __func__,
+                          le16_to_cpu(pcmdptr->result));
                kfree(response_buf);
                free_page(addr);
                return 0;
        }
 
-       if (pcmdptr->command != cmd_ret_802_11_subscribe_event) {
+       if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
                lbs_pr_err("command response incorrect!\n");
                kfree(response_buf);
                free_page(addr);
@@ -673,17 +652,17 @@ static ssize_t libertas_lowsnr_read(struct file *file, char __user *userbuf,
        }
 
        cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
-       event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN);
-       while (cmd_len < pcmdptr->size) {
-               struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len);
-               switch(header->type) {
+       event = (void *)(response_buf + S_DS_GEN);
+       while (cmd_len < le16_to_cpu(pcmdptr->size)) {
+               struct mrvlietypesheader *header = (void *)(response_buf + cmd_len);
+               switch (header->type) {
                struct mrvlietypes_snrthreshold *LowSnr;
-               case TLV_TYPE_SNR_LOW:
-               LowSnr = (struct mrvlietypes_snrthreshold *)(response_buf + cmd_len);
-               pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
-                               LowSnr->snrvalue,
-                               LowSnr->snrfreq,
-                               (event->events & 0x0002)?1:0);
+               case __constant_cpu_to_le16(TLV_TYPE_SNR_LOW):
+                       LowSnr = (void *)(response_buf + cmd_len);
+                       pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
+                                       LowSnr->snrvalue,
+                                       LowSnr->snrfreq,
+                                       (event->events & cpu_to_le16(0x0002))?1:0);
                default:
                        cmd_len += sizeof(struct mrvlietypes_snrthreshold);
                        break;
@@ -733,7 +712,7 @@ static ssize_t libertas_lowsnr_write(struct file *file,
                goto out_unlock;
 
        event = &pcmdptr->params.subscribe_event;
-       event->action = cmd_act_set;
+       event->action = cpu_to_le16(cmd_act_set);
        pcmdptr->size = cpu_to_le16(S_DS_GEN +
                sizeof(struct cmd_ds_802_11_subscribe_event) +
                sizeof(struct mrvlietypes_snrthreshold));
@@ -741,30 +720,30 @@ static ssize_t libertas_lowsnr_write(struct file *file,
        ptr = (u8*) pcmdptr+cmd_len;
        snr_threshold = (struct mrvlietypes_snrthreshold *)(ptr);
        snr_threshold->header.type = cpu_to_le16(TLV_TYPE_SNR_LOW);
-       snr_threshold->header.len = 2;
-       snr_threshold->snrvalue = cpu_to_le16(value);
-       snr_threshold->snrfreq = cpu_to_le16(freq);
+       snr_threshold->header.len = cpu_to_le16(2);
+       snr_threshold->snrvalue = value;
+       snr_threshold->snrfreq = freq;
        event_bitmap |= subscribed ? 0x0002 : 0x0;
-       event->events = event_bitmap;
+       event->events = cpu_to_le16(event_bitmap);
 
        libertas_queue_cmd(adapter, pcmdnode, 1);
        wake_up_interruptible(&priv->mainthread.waitq);
 
        /* Sleep until response is generated by FW */
        wait_event_interruptible(pcmdnode->cmdwait_q,
-                               pcmdnode->cmdwaitqwoken);
+                                pcmdnode->cmdwaitqwoken);
 
        pcmdptr = response_buf;
 
        if (pcmdptr->result) {
-               lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__,
-                       pcmdptr->result);
+               lbs_pr_err("%s: fail, result=%d\n", __func__,
+                          le16_to_cpu(pcmdptr->result));
                kfree(response_buf);
                free_page(addr);
                return 0;
        }
 
-       if (pcmdptr->command != cmd_ret_802_11_subscribe_event) {
+       if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
                lbs_pr_err("command response incorrect!\n");
                kfree(response_buf);
                free_page(addr);
@@ -799,27 +778,26 @@ static ssize_t libertas_failcount_read(struct file *file, char __user *userbuf,
        }
 
        event = &pcmdptr->params.subscribe_event;
-       event->action = cmd_act_get;
-       pcmdptr->size =
-       cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
+       event->action = cpu_to_le16(cmd_act_get);
+       pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
        libertas_queue_cmd(adapter, pcmdnode, 1);
        wake_up_interruptible(&priv->mainthread.waitq);
 
        /* Sleep until response is generated by FW */
        wait_event_interruptible(pcmdnode->cmdwait_q,
-                               pcmdnode->cmdwaitqwoken);
+                                pcmdnode->cmdwaitqwoken);
 
        pcmdptr = response_buf;
 
        if (pcmdptr->result) {
-               lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__,
-                       pcmdptr->result);
+               lbs_pr_err("%s: fail, result=%d\n", __func__,
+                          le16_to_cpu(pcmdptr->result));
                kfree(response_buf);
                free_page(addr);
                return 0;
        }
 
-       if (pcmdptr->command != cmd_ret_802_11_subscribe_event) {
+       if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
                lbs_pr_err("command response incorrect!\n");
                kfree(response_buf);
                free_page(addr);
@@ -827,17 +805,17 @@ static ssize_t libertas_failcount_read(struct file *file, char __user *userbuf,
        }
 
        cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
-       event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN);
-       while (cmd_len < pcmdptr->size) {
-               struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len);
-               switch(header->type) {
+       event = (void *)(response_buf + S_DS_GEN);
+       while (cmd_len < le16_to_cpu(pcmdptr->size)) {
+               struct mrvlietypesheader *header = (void *)(response_buf + cmd_len);
+               switch (header->type) {
                struct mrvlietypes_failurecount *failcount;
-               case TLV_TYPE_FAILCOUNT:
-               failcount = (struct mrvlietypes_failurecount *)(response_buf + cmd_len);
-               pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
-                               failcount->failvalue,
-                               failcount->Failfreq,
-                               (event->events & 0x0004)?1:0);
+               case __constant_cpu_to_le16(TLV_TYPE_FAILCOUNT):
+                       failcount = (void *)(response_buf + cmd_len);
+                       pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
+                                       failcount->failvalue,
+                                       failcount->Failfreq,
+                                       (event->events & cpu_to_le16(0x0004))?1:0);
                default:
                        cmd_len += sizeof(struct mrvlietypes_failurecount);
                        break;
@@ -886,7 +864,7 @@ static ssize_t libertas_failcount_write(struct file *file,
                goto out_unlock;
 
        event = &pcmdptr->params.subscribe_event;
-       event->action = cmd_act_set;
+       event->action = cpu_to_le16(cmd_act_set);
        pcmdptr->size = cpu_to_le16(S_DS_GEN +
                sizeof(struct cmd_ds_802_11_subscribe_event) +
                sizeof(struct mrvlietypes_failurecount));
@@ -894,30 +872,30 @@ static ssize_t libertas_failcount_write(struct file *file,
        ptr = (u8*) pcmdptr+cmd_len;
        failcount = (struct mrvlietypes_failurecount *)(ptr);
        failcount->header.type = cpu_to_le16(TLV_TYPE_FAILCOUNT);
-       failcount->header.len = 2;
-       failcount->failvalue = cpu_to_le16(value);
-       failcount->Failfreq = cpu_to_le16(freq);
+       failcount->header.len = cpu_to_le16(2);
+       failcount->failvalue = value;
+       failcount->Failfreq = freq;
        event_bitmap |= subscribed ? 0x0004 : 0x0;
-       event->events = event_bitmap;
+       event->events = cpu_to_le16(event_bitmap);
 
        libertas_queue_cmd(adapter, pcmdnode, 1);
        wake_up_interruptible(&priv->mainthread.waitq);
 
        /* Sleep until response is generated by FW */
        wait_event_interruptible(pcmdnode->cmdwait_q,
-                               pcmdnode->cmdwaitqwoken);
+                                pcmdnode->cmdwaitqwoken);
 
        pcmdptr = (struct cmd_ds_command *)response_buf;
 
        if (pcmdptr->result) {
-               lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__,
-                       pcmdptr->result);
+               lbs_pr_err("%s: fail, result=%d\n", __func__,
+                          le16_to_cpu(pcmdptr->result));
                kfree(response_buf);
                free_page(addr);
                return 0;
        }
 
-       if (pcmdptr->command != cmd_ret_802_11_subscribe_event) {
+       if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
                lbs_pr_err("command response incorrect!\n");
                kfree(response_buf);
                free_page(addr);
@@ -951,27 +929,26 @@ static ssize_t libertas_bcnmiss_read(struct file *file, char __user *userbuf,
        }
 
        event = &pcmdptr->params.subscribe_event;
-       event->action = cmd_act_get;
-       pcmdptr->size =
-       cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
+       event->action = cpu_to_le16(cmd_act_get);
+       pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
        libertas_queue_cmd(adapter, pcmdnode, 1);
        wake_up_interruptible(&priv->mainthread.waitq);
 
        /* Sleep until response is generated by FW */
        wait_event_interruptible(pcmdnode->cmdwait_q,
-                               pcmdnode->cmdwaitqwoken);
+                                pcmdnode->cmdwaitqwoken);
 
        pcmdptr = response_buf;
 
        if (pcmdptr->result) {
-               lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__,
-                       pcmdptr->result);
+               lbs_pr_err("%s: fail, result=%d\n", __func__,
+                          le16_to_cpu(pcmdptr->result));
                free_page(addr);
                kfree(response_buf);
                return 0;
        }
 
-       if (pcmdptr->command != cmd_ret_802_11_subscribe_event) {
+       if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
                lbs_pr_err("command response incorrect!\n");
                free_page(addr);
                kfree(response_buf);
@@ -979,16 +956,16 @@ static ssize_t libertas_bcnmiss_read(struct file *file, char __user *userbuf,
        }
 
        cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
-       event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN);
-       while (cmd_len < pcmdptr->size) {
-               struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len);
-               switch(header->type) {
+       event = (void *)(response_buf + S_DS_GEN);
+       while (cmd_len < le16_to_cpu(pcmdptr->size)) {
+               struct mrvlietypesheader *header = (void *)(response_buf + cmd_len);
+               switch (header->type) {
                struct mrvlietypes_beaconsmissed *bcnmiss;
-               case TLV_TYPE_BCNMISS:
-               bcnmiss = (struct mrvlietypes_beaconsmissed *)(response_buf + cmd_len);
-               pos += snprintf(buf+pos, len-pos, "%d N/A %d\n",
-                               bcnmiss->beaconmissed,
-                               (event->events & 0x0008)?1:0);
+               case __constant_cpu_to_le16(TLV_TYPE_BCNMISS):
+                       bcnmiss = (void *)(response_buf + cmd_len);
+                       pos += snprintf(buf+pos, len-pos, "%d N/A %d\n",
+                                       bcnmiss->beaconmissed,
+                                       (event->events & cpu_to_le16(0x0008))?1:0);
                default:
                        cmd_len += sizeof(struct mrvlietypes_beaconsmissed);
                        break;
@@ -1038,7 +1015,7 @@ static ssize_t libertas_bcnmiss_write(struct file *file,
                goto out_unlock;
 
        event = &pcmdptr->params.subscribe_event;
-       event->action = cmd_act_set;
+       event->action = cpu_to_le16(cmd_act_set);
        pcmdptr->size = cpu_to_le16(S_DS_GEN +
                sizeof(struct cmd_ds_802_11_subscribe_event) +
                sizeof(struct mrvlietypes_beaconsmissed));
@@ -1046,29 +1023,29 @@ static ssize_t libertas_bcnmiss_write(struct file *file,
        ptr = (u8*) pcmdptr+cmd_len;
        bcnmiss = (struct mrvlietypes_beaconsmissed *)(ptr);
        bcnmiss->header.type = cpu_to_le16(TLV_TYPE_BCNMISS);
-       bcnmiss->header.len = 2;
-       bcnmiss->beaconmissed = cpu_to_le16(value);
+       bcnmiss->header.len = cpu_to_le16(2);
+       bcnmiss->beaconmissed = value;
        event_bitmap |= subscribed ? 0x0008 : 0x0;
-       event->events = event_bitmap;
+       event->events = cpu_to_le16(event_bitmap);
 
        libertas_queue_cmd(adapter, pcmdnode, 1);
        wake_up_interruptible(&priv->mainthread.waitq);
 
        /* Sleep until response is generated by FW */
        wait_event_interruptible(pcmdnode->cmdwait_q,
-                               pcmdnode->cmdwaitqwoken);
+                                pcmdnode->cmdwaitqwoken);
 
        pcmdptr = response_buf;
 
        if (pcmdptr->result) {
-               lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__,
-                       pcmdptr->result);
+               lbs_pr_err("%s: fail, result=%d\n", __func__,
+                          le16_to_cpu(pcmdptr->result));
                kfree(response_buf);
                free_page(addr);
                return 0;
        }
 
-       if (pcmdptr->command != cmd_ret_802_11_subscribe_event) {
+       if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
                lbs_pr_err("command response incorrect!\n");
                free_page(addr);
                kfree(response_buf);
@@ -1102,27 +1079,26 @@ static ssize_t libertas_highrssi_read(struct file *file, char __user *userbuf,
        }
 
        event = &pcmdptr->params.subscribe_event;
-       event->action = cmd_act_get;
-       pcmdptr->size =
-       cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
+       event->action = cpu_to_le16(cmd_act_get);
+       pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
        libertas_queue_cmd(adapter, pcmdnode, 1);
        wake_up_interruptible(&priv->mainthread.waitq);
 
        /* Sleep until response is generated by FW */
        wait_event_interruptible(pcmdnode->cmdwait_q,
-                               pcmdnode->cmdwaitqwoken);
+                                pcmdnode->cmdwaitqwoken);
 
        pcmdptr = response_buf;
 
        if (pcmdptr->result) {
-               lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__,
-                       pcmdptr->result);
+               lbs_pr_err("%s: fail, result=%d\n", __func__,
+                          le16_to_cpu(pcmdptr->result));
                kfree(response_buf);
                free_page(addr);
                return 0;
        }
 
-       if (pcmdptr->command != cmd_ret_802_11_subscribe_event) {
+       if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
                lbs_pr_err("command response incorrect!\n");
                kfree(response_buf);
                free_page(addr);
@@ -1130,17 +1106,17 @@ static ssize_t libertas_highrssi_read(struct file *file, char __user *userbuf,
        }
 
        cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
-       event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN);
-       while (cmd_len < pcmdptr->size) {
-               struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len);
-               switch(header->type) {
+       event = (void *)(response_buf + S_DS_GEN);
+       while (cmd_len < le16_to_cpu(pcmdptr->size)) {
+               struct mrvlietypesheader *header = (void *)(response_buf + cmd_len);
+               switch (header->type) {
                struct mrvlietypes_rssithreshold  *Highrssi;
-               case TLV_TYPE_RSSI_HIGH:
-               Highrssi = (struct mrvlietypes_rssithreshold *)(response_buf + cmd_len);
-               pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
-                               Highrssi->rssivalue,
-                               Highrssi->rssifreq,
-                               (event->events & 0x0010)?1:0);
+               case __constant_cpu_to_le16(TLV_TYPE_RSSI_HIGH):
+                       Highrssi = (void *)(response_buf + cmd_len);
+                       pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
+                                       Highrssi->rssivalue,
+                                       Highrssi->rssifreq,
+                                       (event->events & cpu_to_le16(0x0010))?1:0);
                default:
                        cmd_len += sizeof(struct mrvlietypes_snrthreshold);
                        break;
@@ -1190,7 +1166,7 @@ static ssize_t libertas_highrssi_write(struct file *file,
                goto out_unlock;
 
        event = &pcmdptr->params.subscribe_event;
-       event->action = cmd_act_set;
+       event->action = cpu_to_le16(cmd_act_set);
        pcmdptr->size = cpu_to_le16(S_DS_GEN +
                sizeof(struct cmd_ds_802_11_subscribe_event) +
                sizeof(struct mrvlietypes_rssithreshold));
@@ -1198,29 +1174,29 @@ static ssize_t libertas_highrssi_write(struct file *file,
        ptr = (u8*) pcmdptr+cmd_len;
        rssi_threshold = (struct mrvlietypes_rssithreshold *)(ptr);
        rssi_threshold->header.type = cpu_to_le16(TLV_TYPE_RSSI_HIGH);
-       rssi_threshold->header.len = 2;
-       rssi_threshold->rssivalue = cpu_to_le16(value);
-       rssi_threshold->rssifreq = cpu_to_le16(freq);
+       rssi_threshold->header.len = cpu_to_le16(2);
+       rssi_threshold->rssivalue = value;
+       rssi_threshold->rssifreq = freq;
        event_bitmap |= subscribed ? 0x0010 : 0x0;
-       event->events = event_bitmap;
+       event->events = cpu_to_le16(event_bitmap);
 
        libertas_queue_cmd(adapter, pcmdnode, 1);
        wake_up_interruptible(&priv->mainthread.waitq);
 
        /* Sleep until response is generated by FW */
        wait_event_interruptible(pcmdnode->cmdwait_q,
-                               pcmdnode->cmdwaitqwoken);
+                                pcmdnode->cmdwaitqwoken);
 
        pcmdptr = response_buf;
 
        if (pcmdptr->result) {
-               lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__,
-                       pcmdptr->result);
+               lbs_pr_err("%s: fail, result=%d\n", __func__,
+                          le16_to_cpu(pcmdptr->result));
                kfree(response_buf);
                return 0;
        }
 
-       if (pcmdptr->command != cmd_ret_802_11_subscribe_event) {
+       if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
                lbs_pr_err("command response incorrect!\n");
                kfree(response_buf);
                return 0;
@@ -1253,27 +1229,26 @@ static ssize_t libertas_highsnr_read(struct file *file, char __user *userbuf,
        }
 
        event = &pcmdptr->params.subscribe_event;
-       event->action = cmd_act_get;
-       pcmdptr->size =
-       cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
+       event->action = cpu_to_le16(cmd_act_get);
+       pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
        libertas_queue_cmd(adapter, pcmdnode, 1);
        wake_up_interruptible(&priv->mainthread.waitq);
 
        /* Sleep until response is generated by FW */
        wait_event_interruptible(pcmdnode->cmdwait_q,
-                               pcmdnode->cmdwaitqwoken);
+                                pcmdnode->cmdwaitqwoken);
 
        pcmdptr = response_buf;
 
        if (pcmdptr->result) {
-               lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__,
-                       pcmdptr->result);
+               lbs_pr_err("%s: fail, result=%d\n", __func__,
+                          le16_to_cpu(pcmdptr->result));
                kfree(response_buf);
                free_page(addr);
                return 0;
        }
 
-       if (pcmdptr->command != cmd_ret_802_11_subscribe_event) {
+       if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
                lbs_pr_err("command response incorrect!\n");
                kfree(response_buf);
                free_page(addr);
@@ -1281,17 +1256,17 @@ static ssize_t libertas_highsnr_read(struct file *file, char __user *userbuf,
        }
 
        cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
-       event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN);
-       while (cmd_len < pcmdptr->size) {
-               struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len);
-               switch(header->type) {
+       event = (void *)(response_buf + S_DS_GEN);
+       while (cmd_len < le16_to_cpu(pcmdptr->size)) {
+               struct mrvlietypesheader *header = (void *)(response_buf + cmd_len);
+               switch (header->type) {
                struct mrvlietypes_snrthreshold *HighSnr;
-               case TLV_TYPE_SNR_HIGH:
-               HighSnr = (struct mrvlietypes_snrthreshold *)(response_buf + cmd_len);
-               pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
-                               HighSnr->snrvalue,
-                               HighSnr->snrfreq,
-                               (event->events & 0x0020)?1:0);
+               case __constant_cpu_to_le16(TLV_TYPE_SNR_HIGH):
+                       HighSnr = (void *)(response_buf + cmd_len);
+                       pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
+                                       HighSnr->snrvalue,
+                                       HighSnr->snrfreq,
+                                       (event->events & cpu_to_le16(0x0020))?1:0);
                default:
                        cmd_len += sizeof(struct mrvlietypes_snrthreshold);
                        break;
@@ -1341,7 +1316,7 @@ static ssize_t libertas_highsnr_write(struct file *file,
                goto out_unlock;
 
        event = &pcmdptr->params.subscribe_event;
-       event->action = cmd_act_set;
+       event->action = cpu_to_le16(cmd_act_set);
        pcmdptr->size = cpu_to_le16(S_DS_GEN +
                sizeof(struct cmd_ds_802_11_subscribe_event) +
                sizeof(struct mrvlietypes_snrthreshold));
@@ -1349,30 +1324,30 @@ static ssize_t libertas_highsnr_write(struct file *file,
        ptr = (u8*) pcmdptr+cmd_len;
        snr_threshold = (struct mrvlietypes_snrthreshold *)(ptr);
        snr_threshold->header.type = cpu_to_le16(TLV_TYPE_SNR_HIGH);
-       snr_threshold->header.len = 2;
-       snr_threshold->snrvalue = cpu_to_le16(value);
-       snr_threshold->snrfreq = cpu_to_le16(freq);
+       snr_threshold->header.len = cpu_to_le16(2);
+       snr_threshold->snrvalue = value;
+       snr_threshold->snrfreq = freq;
        event_bitmap |= subscribed ? 0x0020 : 0x0;
-       event->events = event_bitmap;
+       event->events = cpu_to_le16(event_bitmap);
 
        libertas_queue_cmd(adapter, pcmdnode, 1);
        wake_up_interruptible(&priv->mainthread.waitq);
 
        /* Sleep until response is generated by FW */
        wait_event_interruptible(pcmdnode->cmdwait_q,
-                               pcmdnode->cmdwaitqwoken);
+                                pcmdnode->cmdwaitqwoken);
 
        pcmdptr = response_buf;
 
        if (pcmdptr->result) {
-               lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__,
-                       pcmdptr->result);
+               lbs_pr_err("%s: fail, result=%d\n", __func__,
+                          le16_to_cpu(pcmdptr->result));
                kfree(response_buf);
                free_page(addr);
                return 0;
        }
 
-       if (pcmdptr->command != cmd_ret_802_11_subscribe_event) {
+       if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
                lbs_pr_err("command response incorrect!\n");
                kfree(response_buf);
                free_page(addr);
@@ -1760,7 +1735,7 @@ void libertas_debugfs_remove_one(wlan_private *priv)
 
        debugfs_remove(priv->regs_dir);
 
-       for(i=0; i<ARRAY_SIZE(debugfs_files); i++)
+       for(i=0; i<ARRAY_SIZE(debugfs_events_files); i++)
                debugfs_remove(priv->debugfs_events_files[i]);
 
        debugfs_remove(priv->events_dir);
@@ -1769,13 +1744,19 @@ void libertas_debugfs_remove_one(wlan_private *priv)
 #endif
        for(i=0; i<ARRAY_SIZE(debugfs_files); i++)
                debugfs_remove(priv->debugfs_files[i]);
+       debugfs_remove(priv->debugfs_dir);
 }
 
+
+
 /* debug entry */
 
+#ifdef PROC_DEBUG
+
 #define item_size(n)   (FIELD_SIZEOF(wlan_adapter, n))
 #define item_addr(n)   (offsetof(wlan_adapter, n))
 
+
 struct debug_data {
        char name[32];
        u32 size;
@@ -1863,7 +1844,7 @@ static ssize_t wlan_debugfs_write(struct file *f, const char __user *buf,
                return 0;
 
        if (copy_from_user(pdata, buf, cnt)) {
-               lbs_pr_debug(1, "Copy from user failed\n");
+               lbs_deb_debugfs("Copy from user failed\n");
                kfree(pdata);
                return 0;
        }
@@ -1913,7 +1894,7 @@ static struct file_operations libertas_debug_fops = {
  *  @param dev     pointer net_device
  *  @return       N/A
  */
-void libertas_debug_init(wlan_private * priv, struct net_device *dev)
+static void libertas_debug_init(wlan_private * priv, struct net_device *dev)
 {
        int i;
 
@@ -1927,4 +1908,5 @@ void libertas_debug_init(wlan_private * priv, struct net_device *dev)
                                                  priv->debugfs_dir, &items[0],
                                                  &libertas_debug_fops);
 }
+#endif
 
index dfe27642322c9d49f264fe277f940cc338ff9987..40f56bb1eac8332aa9b172df9778d8778d2116e4 100644 (file)
@@ -6,6 +6,8 @@
 #ifndef _WLAN_DECL_H_
 #define _WLAN_DECL_H_
 
+#include <linux/device.h>
+
 #include "defs.h"
 
 /** Function Prototype Declaration */
@@ -66,18 +68,24 @@ void libertas_ps_wakeup(wlan_private * priv, int wait_option);
 
 void libertas_tx_runqueue(wlan_private *priv);
 
-extern struct chan_freq_power *libertas_find_cfp_by_band_and_channel(
+struct chan_freq_power *libertas_find_cfp_by_band_and_channel(
                                wlan_adapter * adapter, u8 band, u16 channel);
 
-extern void libertas_mac_event_disconnected(wlan_private * priv);
+void libertas_mac_event_disconnected(wlan_private * priv);
 
 void libertas_send_iwevcustom_event(wlan_private * priv, s8 * str);
 
-int reset_device(wlan_private *priv);
+/* fw.c */
+int libertas_init_fw(wlan_private * priv, char *fw_name);
+
 /* main.c */
-extern struct chan_freq_power *libertas_get_region_cfp_table(u8 region, u8 band,
+struct chan_freq_power *libertas_get_region_cfp_table(u8 region, u8 band,
                                                             int *cfp_no);
-wlan_private *wlan_add_card(void *card);
-int wlan_remove_card(void *card);
+wlan_private *libertas_add_card(void *card, struct device *dmdev);
+int libertas_activate_card(wlan_private *priv, char *fw_name);
+int libertas_remove_card(wlan_private *priv);
+int libertas_add_mesh(wlan_private *priv, struct device *dev);
+void libertas_remove_mesh(wlan_private *priv);
+
 
 #endif                         /* _WLAN_DECL_H_ */
index 80dd9ea19c8e4b7ea2faa8c4cbf5874acc77e0a6..4dd43e59bda004422ddfd6ca5b8540edb54cc702 100644 (file)
@@ -7,14 +7,79 @@
 
 #include <linux/spinlock.h>
 
-extern unsigned int libertas_debug;
-
 #ifdef CONFIG_LIBERTAS_DEBUG
 #define DEBUG
 #define PROC_DEBUG
 #endif
 
-#define DRV_NAME               "usb8xxx"
+#ifndef DRV_NAME
+#define DRV_NAME "libertas"
+#endif
+
+
+#define LBS_DEB_ENTER  0x00000001
+#define LBS_DEB_LEAVE  0x00000002
+#define LBS_DEB_MAIN   0x00000004
+#define LBS_DEB_NET    0x00000008
+#define LBS_DEB_MESH   0x00000010
+#define LBS_DEB_WEXT   0x00000020
+#define LBS_DEB_IOCTL  0x00000040
+#define LBS_DEB_SCAN   0x00000080
+#define LBS_DEB_ASSOC  0x00000100
+#define LBS_DEB_JOIN   0x00000200
+#define LBS_DEB_11D    0x00000400
+#define LBS_DEB_DEBUGFS        0x00000800
+#define LBS_DEB_ETHTOOL        0x00001000
+#define LBS_DEB_HOST   0x00002000
+#define LBS_DEB_CMD    0x00004000
+#define LBS_DEB_RX     0x00008000
+#define LBS_DEB_TX     0x00010000
+#define LBS_DEB_USB    0x00020000
+#define LBS_DEB_CS     0x00040000
+#define LBS_DEB_FW     0x00080000
+#define LBS_DEB_THREAD 0x00100000
+#define LBS_DEB_HEX    0x00200000
+
+extern unsigned int libertas_debug;
+
+#ifdef DEBUG
+#define LBS_DEB_LL(grp, fmt, args...) \
+do { if ((libertas_debug & (grp)) == (grp)) \
+  printk(KERN_DEBUG DRV_NAME "%s: " fmt, \
+         in_interrupt() ? " (INT)" : "", ## args); } while (0)
+#else
+#define LBS_DEB_LL(grp, fmt, args...) do {} while (0)
+#endif
+
+#define lbs_deb_enter(grp) \
+  LBS_DEB_LL(grp | LBS_DEB_ENTER, "%s():%d enter\n", __FUNCTION__, __LINE__);
+#define lbs_deb_enter_args(grp, fmt, args...) \
+  LBS_DEB_LL(grp | LBS_DEB_ENTER, "%s(" fmt "):%d\n", __FUNCTION__, ## args, __LINE__);
+#define lbs_deb_leave(grp) \
+  LBS_DEB_LL(grp | LBS_DEB_LEAVE, "%s():%d leave\n", __FUNCTION__, __LINE__);
+#define lbs_deb_leave_args(grp, fmt, args...) \
+  LBS_DEB_LL(grp | LBS_DEB_LEAVE, "%s():%d leave, " fmt "\n", \
+  __FUNCTION__, __LINE__, ##args);
+#define lbs_deb_main(fmt, args...)      LBS_DEB_LL(LBS_DEB_MAIN, fmt, ##args)
+#define lbs_deb_net(fmt, args...)       LBS_DEB_LL(LBS_DEB_NET, fmt, ##args)
+#define lbs_deb_mesh(fmt, args...)      LBS_DEB_LL(LBS_DEB_MESH, fmt, ##args)
+#define lbs_deb_wext(fmt, args...)      LBS_DEB_LL(LBS_DEB_WEXT, fmt, ##args)
+#define lbs_deb_ioctl(fmt, args...)     LBS_DEB_LL(LBS_DEB_IOCTL, fmt, ##args)
+#define lbs_deb_scan(fmt, args...)      LBS_DEB_LL(LBS_DEB_SCAN, fmt, ##args)
+#define lbs_deb_assoc(fmt, args...)     LBS_DEB_LL(LBS_DEB_ASSOC, fmt, ##args)
+#define lbs_deb_join(fmt, args...)      LBS_DEB_LL(LBS_DEB_JOIN, fmt, ##args)
+#define lbs_deb_11d(fmt, args...)       LBS_DEB_LL(LBS_DEB_11D, fmt, ##args)
+#define lbs_deb_debugfs(fmt, args...)   LBS_DEB_LL(LBS_DEB_DEBUGFS, fmt, ##args)
+#define lbs_deb_ethtool(fmt, args...)   LBS_DEB_LL(LBS_DEB_ETHTOOL, fmt, ##args)
+#define lbs_deb_host(fmt, args...)      LBS_DEB_LL(LBS_DEB_HOST, fmt, ##args)
+#define lbs_deb_cmd(fmt, args...)       LBS_DEB_LL(LBS_DEB_CMD, fmt, ##args)
+#define lbs_deb_rx(fmt, args...)        LBS_DEB_LL(LBS_DEB_RX, fmt, ##args)
+#define lbs_deb_tx(fmt, args...)        LBS_DEB_LL(LBS_DEB_TX, fmt, ##args)
+#define lbs_deb_fw(fmt, args...)        LBS_DEB_LL(LBS_DEB_FW, fmt, ##args)
+#define lbs_deb_usb(fmt, args...)       LBS_DEB_LL(LBS_DEB_USB, fmt, ##args)
+#define lbs_deb_usbd(dev, fmt, args...) LBS_DEB_LL(LBS_DEB_USB, "%s:" fmt, (dev)->bus_id, ##args)
+#define lbs_deb_cs(fmt, args...)        LBS_DEB_LL(LBS_DEB_CS, fmt, ##args)
+#define lbs_deb_thread(fmt, args...)    LBS_DEB_LL(LBS_DEB_THREAD, fmt, ##args)
 
 #define lbs_pr_info(format, args...) \
        printk(KERN_INFO DRV_NAME": " format, ## args)
@@ -24,37 +89,25 @@ extern unsigned int libertas_debug;
        printk(KERN_ALERT DRV_NAME": " format, ## args)
 
 #ifdef DEBUG
-#define lbs_pr_debug(level, format, args...) \
-       do { if (libertas_debug >= level) \
-       printk(KERN_INFO DRV_NAME": " format, ##args); } while (0)
-#define lbs_dev_dbg(level, device, format, args...) \
-        lbs_pr_debug(level, "%s: " format, \
-        (device)->bus_id , ## args)
-
 static inline void lbs_dbg_hex(char *prompt, u8 * buf, int len)
 {
        int i = 0;
 
-       if (!libertas_debug)
+       if (!(libertas_debug & LBS_DEB_HEX))
                return;
 
        printk(KERN_DEBUG "%s: ", prompt);
        for (i = 1; i <= len; i++) {
-               printk(KERN_DEBUG "%02x ", (u8) * buf);
+               printk("%02x ", (u8) * buf);
                buf++;
        }
        printk("\n");
 }
 #else
-#define lbs_pr_debug(level, format, args...)           do {} while (0)
-#define lbs_dev_dbg(level, device, format, args...)    do {} while (0)
 #define lbs_dbg_hex(x,y,z)                             do {} while (0)
 #endif
 
-#define        ENTER()                 lbs_pr_debug(1, "Enter: %s, %s:%i\n", \
-                                       __FUNCTION__, __FILE__, __LINE__)
-#define        LEAVE()                 lbs_pr_debug(1, "Leave: %s, %s:%i\n", \
-                                       __FUNCTION__, __FILE__, __LINE__)
+
 
 /** Buffer Constants */
 
@@ -74,7 +127,6 @@ static inline void lbs_dbg_hex(char *prompt, u8 * buf, int len)
 #define MRVDRV_NUM_OF_CMD_BUFFER        10
 #define MRVDRV_SIZE_OF_CMD_BUFFER       (2 * 1024)
 #define MRVDRV_MAX_CHANNEL_SIZE                14
-#define MRVDRV_MAX_BSSID_LIST          64
 #define MRVDRV_ASSOCIATION_TIME_OUT    255
 #define MRVDRV_SNAP_HEADER_LEN          8
 
@@ -104,6 +156,13 @@ static inline void lbs_dbg_hex(char *prompt, u8 * buf, int len)
 #define MRVDRV_MAX_BEACON_INTERVAL             1000
 #define MRVDRV_BEACON_INTERVAL                 100
 
+/** INT status Bit Definition*/
+#define his_cmddnldrdy                 0x01
+#define his_cardevent                  0x02
+#define his_cmdupldrdy                 0x04
+
+#define SBI_EVENT_CAUSE_SHIFT          3
+
 /** TxPD status */
 
 /*     Station firmware use TxPD status field to report final Tx transmit
@@ -205,8 +264,6 @@ typedef struct _wlan_adapter wlan_adapter;
 extern const char libertas_driver_version[];
 extern u16 libertas_region_code_to_index[MRVDRV_MAX_REGION_CODE];
 
-extern u8 libertas_wlan_data_rates[WLAN_SUPPORTED_RATES];
-
 extern u8 libertas_supported_rates[G_SUPPORTED_RATES];
 
 extern u8 libertas_adhoc_rates_g[G_SUPPORTED_RATES];
@@ -316,6 +373,8 @@ enum SNMP_MIB_VALUE_e {
 /* Default values for fwt commands. */
 #define FWT_DEFAULT_METRIC 0
 #define FWT_DEFAULT_DIR 1
+/* Default Rate, 11Mbps */
+#define FWT_DEFAULT_RATE 3
 #define FWT_DEFAULT_SSN 0xffffffff
 #define FWT_DEFAULT_DSN 0
 #define FWT_DEFAULT_HOPCOUNT 0
index e8b9020f9bd69676654177a54944cbd4e1fb5751..785192b884bc27c1419d7aff773c8d477b1fb21a 100644 (file)
@@ -63,11 +63,11 @@ struct wlan_802_11_security {
 
 /** Current Basic Service Set State Structure */
 struct current_bss_params {
-       struct bss_descriptor bssdescriptor;
        /** bssid */
        u8 bssid[ETH_ALEN];
        /** ssid */
-       struct WLAN_802_11_SSID ssid;
+       u8 ssid[IW_ESSID_MAX_SIZE + 1];
+       u8 ssid_len;
 
        /** band */
        u8 band;
@@ -89,31 +89,6 @@ struct sleep_params {
        u16 sp_reserved;
 };
 
-/** Data structure for the Marvell WLAN device */
-typedef struct _wlan_dev {
-       /** device name */
-       char name[DEV_NAME_LEN];
-       /** card pointer */
-       void *card;
-       /** IO port */
-       u32 ioport;
-       /** Upload received */
-       u32 upld_rcv;
-       /** Upload type */
-       u32 upld_typ;
-       /** Upload length */
-       u32 upld_len;
-       /** netdev pointer */
-       struct net_device *netdev;
-       /* Upload buffer */
-       u8 upld_buf[WLAN_UPLD_SIZE];
-       /* Download sent:
-          bit0 1/0=data_sent/data_tx_done,
-          bit1 1/0=cmd_sent/cmd_tx_done,
-          all other bits reserved 0 */
-       u8 dnld_sent;
-} wlan_dev_t, *pwlan_dev_t;
-
 /* Mesh statistics */
 struct wlan_mesh_stats {
        u32     fwd_bcast_cnt;          /* Fwd: Broadcast counter */
@@ -123,6 +98,7 @@ struct wlan_mesh_stats {
        u32     fwd_drop_noroute;       /* Fwd: No route to Destination */
        u32     fwd_drop_nobuf;         /* Fwd: Run out of internal buffers */
        u32     drop_blind;             /* Rx:  Dropped by blinding table */
+       u32     tx_failed_cnt;          /* Tx:  Failed transmissions */
 };
 
 /** Private structure for the MV device */
@@ -131,8 +107,11 @@ struct _wlan_private {
        int mesh_open;
        int infra_open;
 
+       char name[DEV_NAME_LEN];
+
+       void *card;
        wlan_adapter *adapter;
-       wlan_dev_t wlan_dev;
+       struct net_device *dev;
 
        struct net_device_stats stats;
        struct net_device *mesh_dev ; /* Virtual device */
@@ -153,6 +132,16 @@ struct _wlan_private {
        u32 bbp_offset;
        u32 rf_offset;
 
+       /** Upload length */
+       u32 upld_len;
+       /* Upload buffer */
+       u8 upld_buf[WLAN_UPLD_SIZE];
+       /* Download sent:
+          bit0 1/0=data_sent/data_tx_done,
+          bit1 1/0=cmd_sent/cmd_tx_done,
+          all other bits reserved 0 */
+       u8 dnld_sent;
+
        const struct firmware *firmware;
        struct device *hotplug_device;
 
@@ -161,6 +150,15 @@ struct _wlan_private {
 
        struct delayed_work assoc_work;
        struct workqueue_struct *assoc_thread;
+       struct work_struct sync_channel;
+
+       /** Hardware access */
+       int (*hw_register_dev) (wlan_private * priv);
+       int (*hw_unregister_dev) (wlan_private *);
+       int (*hw_prog_firmware) (wlan_private *);
+       int (*hw_host_to_card) (wlan_private * priv, u8 type, u8 * payload, u16 nb);
+       int (*hw_get_int_status) (wlan_private * priv, u8 *);
+       int (*hw_read_event_cause) (wlan_private *);
 };
 
 /** Association request
@@ -171,18 +169,21 @@ struct _wlan_private {
 struct assoc_request {
 #define ASSOC_FLAG_SSID                        1
 #define ASSOC_FLAG_CHANNEL             2
-#define ASSOC_FLAG_MODE                        3
-#define ASSOC_FLAG_BSSID               4
-#define ASSOC_FLAG_WEP_KEYS            5
-#define ASSOC_FLAG_WEP_TX_KEYIDX       6
-#define ASSOC_FLAG_WPA_MCAST_KEY       7
-#define ASSOC_FLAG_WPA_UCAST_KEY       8
-#define ASSOC_FLAG_SECINFO             9
-#define ASSOC_FLAG_WPA_IE              10
+#define ASSOC_FLAG_BAND                        3
+#define ASSOC_FLAG_MODE                        4
+#define ASSOC_FLAG_BSSID               5
+#define ASSOC_FLAG_WEP_KEYS            6
+#define ASSOC_FLAG_WEP_TX_KEYIDX       7
+#define ASSOC_FLAG_WPA_MCAST_KEY       8
+#define ASSOC_FLAG_WPA_UCAST_KEY       9
+#define ASSOC_FLAG_SECINFO             10
+#define ASSOC_FLAG_WPA_IE              11
        unsigned long flags;
 
-       struct WLAN_802_11_SSID ssid;
+       u8 ssid[IW_ESSID_MAX_SIZE + 1];
+       u8 ssid_len;
        u8 channel;
+       u8 band;
        u8 mode;
        u8 bssid[ETH_ALEN];
 
@@ -199,12 +200,15 @@ struct assoc_request {
        /** WPA Information Elements*/
        u8 wpa_ie[MAX_WPA_IE_LEN];
        u8 wpa_ie_len;
+
+       /* BSS to associate with for infrastructure of Ad-Hoc join */
+       struct bss_descriptor bss;
 };
 
 /** Wlan adapter data structure*/
 struct _wlan_adapter {
        /** STATUS variables */
-       u32 fwreleasenumber;
+       u8 fwreleasenumber[4];
        u32 fwcapinfo;
        /* protected with big lock */
 
@@ -255,13 +259,14 @@ struct _wlan_adapter {
        /* IW_MODE_* */
        u8 mode;
 
-       struct bss_descriptor *pattemptedbssdesc;
-
-       struct WLAN_802_11_SSID previousssid;
-       u8 previousbssid[ETH_ALEN];
+       u8 prev_ssid[IW_ESSID_MAX_SIZE + 1];
+       u8 prev_ssid_len;
+       u8 prev_bssid[ETH_ALEN];
 
-       struct bss_descriptor *scantable;
-       u32 numinscantable;
+       /* Scan results list */
+       struct list_head network_list;
+       struct list_head network_free_list;
+       struct bss_descriptor *networks;
 
        u8 scantype;
        u32 scanmode;
@@ -288,7 +293,6 @@ struct _wlan_adapter {
        u32 txantenna;
        u32 rxantenna;
 
-       u8 adhocchannel;
        u32 fragthsd;
        u32 rtsthsd;
 
@@ -324,7 +328,8 @@ struct _wlan_adapter {
        u16 locallisteninterval;
        u16 nullpktinterval;
 
-       struct assoc_request * assoc_req;
+       struct assoc_request * pending_assoc_req;
+       struct assoc_request * in_progress_assoc_req;
 
        /** Encryption parameter */
        struct wlan_802_11_security secinfo;
@@ -396,6 +401,8 @@ struct _wlan_adapter {
        u32 radiomode;
        u32 debugmode;
        u8 fw_ready;
+
+       u8 last_scanned_channel;
 };
 
 #endif                         /* _WLAN_DEV_H_ */
index 0064de5429632ee37c8724ca0395a8aab8990f50..96f1974685d4f4662fd88bbd185edf359daaf626 100644 (file)
@@ -1,10 +1,8 @@
-
 #include <linux/netdevice.h>
 #include <linux/ethtool.h>
 #include <linux/delay.h>
 
 #include "host.h"
-#include "sbi.h"
 #include "decl.h"
 #include "defs.h"
 #include "dev.h"
@@ -17,7 +15,8 @@ static const char * mesh_stat_strings[]= {
                        "drop_no_buffers",
                        "fwded_unicast_cnt",
                        "fwded_bcast_cnt",
-                       "drop_blind_table"
+                       "drop_blind_table",
+                       "tx_failed_cnt"
 };
 
 static void libertas_ethtool_get_drvinfo(struct net_device *dev,
@@ -69,7 +68,7 @@ static int libertas_ethtool_get_eeprom(struct net_device *dev,
 
        /* +14 is for action, offset, and NOB in
         * response */
-       lbs_pr_debug(1, "action:%d offset: %x NOB: %02x\n",
+       lbs_deb_ethtool("action:%d offset: %x NOB: %02x\n",
               regctrl.action, regctrl.offset, regctrl.NOB);
 
        ret = libertas_prepare_and_send_command(priv,
@@ -81,8 +80,7 @@ static int libertas_ethtool_get_eeprom(struct net_device *dev,
        if (ret) {
                if (adapter->prdeeprom)
                        kfree(adapter->prdeeprom);
-               LEAVE();
-                       return ret;
+               goto done;
        }
 
        mdelay(10);
@@ -101,7 +99,11 @@ static int libertas_ethtool_get_eeprom(struct net_device *dev,
                kfree(adapter->prdeeprom);
 //     mutex_unlock(&priv->mutex);
 
-        return 0;
+       ret = 0;
+
+done:
+       lbs_deb_enter_args(LBS_DEB_ETHTOOL, "ret %d", ret);
+        return ret;
 }
 
 static void libertas_ethtool_get_stats(struct net_device * dev,
@@ -109,7 +111,7 @@ static void libertas_ethtool_get_stats(struct net_device * dev,
 {
        wlan_private *priv = dev->priv;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_ETHTOOL);
 
        stats->cmd = ETHTOOL_GSTATS;
        BUG_ON(stats->n_stats != MESH_STATS_NUM);
@@ -121,8 +123,9 @@ static void libertas_ethtool_get_stats(struct net_device * dev,
         data[4] = priv->mstats.fwd_unicast_cnt;
         data[5] = priv->mstats.fwd_bcast_cnt;
         data[6] = priv->mstats.drop_blind;
+        data[7] = priv->mstats.tx_failed_cnt;
 
-       LEAVE();
+       lbs_deb_enter(LBS_DEB_ETHTOOL);
 }
 
 static int libertas_ethtool_get_stats_count(struct net_device * dev)
@@ -131,27 +134,32 @@ static int libertas_ethtool_get_stats_count(struct net_device * dev)
        wlan_private *priv = dev->priv;
        struct cmd_ds_mesh_access mesh_access;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_ETHTOOL);
+
        /* Get Mesh Statistics */
        ret = libertas_prepare_and_send_command(priv,
                        cmd_mesh_access, cmd_act_mesh_get_stats,
                        cmd_option_waitforrsp, 0, &mesh_access);
 
        if (ret) {
-               LEAVE();
-               return 0;
+               ret = 0;
+               goto done;
        }
 
-        priv->mstats.fwd_drop_rbt = mesh_access.data[0];
-        priv->mstats.fwd_drop_ttl = mesh_access.data[1];
-        priv->mstats.fwd_drop_noroute = mesh_access.data[2];
-        priv->mstats.fwd_drop_nobuf = mesh_access.data[3];
-        priv->mstats.fwd_unicast_cnt = mesh_access.data[4];
-        priv->mstats.fwd_bcast_cnt = mesh_access.data[5];
-        priv->mstats.drop_blind = mesh_access.data[6];
+        priv->mstats.fwd_drop_rbt = le32_to_cpu(mesh_access.data[0]);
+        priv->mstats.fwd_drop_ttl = le32_to_cpu(mesh_access.data[1]);
+        priv->mstats.fwd_drop_noroute = le32_to_cpu(mesh_access.data[2]);
+        priv->mstats.fwd_drop_nobuf = le32_to_cpu(mesh_access.data[3]);
+        priv->mstats.fwd_unicast_cnt = le32_to_cpu(mesh_access.data[4]);
+        priv->mstats.fwd_bcast_cnt = le32_to_cpu(mesh_access.data[5]);
+        priv->mstats.drop_blind = le32_to_cpu(mesh_access.data[6]);
+        priv->mstats.tx_failed_cnt = le32_to_cpu(mesh_access.data[7]);
 
-       LEAVE();
-       return MESH_STATS_NUM;
+       ret = MESH_STATS_NUM;
+
+done:
+       lbs_deb_enter_args(LBS_DEB_ETHTOOL, "ret %d", ret);
+       return ret;
 }
 
 static void libertas_ethtool_get_strings (struct net_device * dev,
@@ -160,7 +168,8 @@ static void libertas_ethtool_get_strings (struct net_device * dev,
 {
        int i;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_ETHTOOL);
+
        switch (stringset) {
         case ETH_SS_STATS:
                for (i=0; i < MESH_STATS_NUM; i++) {
@@ -170,7 +179,7 @@ static void libertas_ethtool_get_strings (struct net_device * dev,
                }
                break;
         }
-       LEAVE();
+       lbs_deb_enter(LBS_DEB_ETHTOOL);
 }
 
 struct ethtool_ops libertas_ethtool_ops = {
index 5c63c9b1659c1e45e1054bb01fd0969a82dfa563..2dc84ff7a54ac4b574f6c82915d187abaf37deaf 100644 (file)
@@ -1,28 +1,15 @@
 /**
   * This file contains the initialization for FW and HW
   */
-#include <linux/module.h>
-#include <linux/moduleparam.h>
-
-#include <linux/vmalloc.h>
 #include <linux/firmware.h>
-#include <linux/version.h>
 
 #include "host.h"
-#include "sbi.h"
 #include "defs.h"
 #include "decl.h"
 #include "dev.h"
-#include "fw.h"
 #include "wext.h"
 #include "if_usb.h"
 
-char *libertas_fw_name = NULL;
-module_param_named(fw_name, libertas_fw_name, charp, 0644);
-
-unsigned int libertas_debug = 0;
-module_param(libertas_debug, int, 0);
-
 /**
  *  @brief This function checks the validity of Boot2/FW image.
  *
@@ -32,7 +19,7 @@ module_param(libertas_debug, int, 0);
  */
 static int check_fwfile_format(u8 *data, u32 totlen)
 {
-       u bincmd, exit;
+       u32 bincmd, exit;
        u32 blksize, offset, len;
        int ret;
 
@@ -40,8 +27,10 @@ static int check_fwfile_format(u8 *data, u32 totlen)
        exit = len = 0;
 
        do {
-               bincmd = *data;
-               blksize = *(u32*)(data + offsetof(struct fwheader, datalength));
+               struct fwheader *fwh = (void *)data;
+
+               bincmd = le32_to_cpu(fwh->dnldcmd);
+               blksize = le32_to_cpu(fwh->datalength);
                switch (bincmd) {
                case FW_HAS_DATA_TO_RECV:
                        offset = sizeof(struct fwheader) + blksize;
@@ -61,9 +50,9 @@ static int check_fwfile_format(u8 *data, u32 totlen)
        } while (!exit);
 
        if (ret)
-               lbs_pr_err("bin file format check FAIL...\n");
+               lbs_pr_err("firmware file format check FAIL\n");
        else
-               lbs_pr_debug(1, "bin file format check PASS...\n");
+               lbs_deb_fw("firmware file format check PASS\n");
 
        return ret;
 }
@@ -76,32 +65,31 @@ static int check_fwfile_format(u8 *data, u32 totlen)
  *  @param priv    A pointer to wlan_private structure
  *  @return       0 or -1
  */
-static int wlan_setup_station_hw(wlan_private * priv)
+static int wlan_setup_station_hw(wlan_private * priv, char *fw_name)
 {
        int ret = -1;
        wlan_adapter *adapter = priv->adapter;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_FW);
 
-       if ((ret = request_firmware(&priv->firmware, libertas_fw_name,
+       if ((ret = request_firmware(&priv->firmware, fw_name,
                                    priv->hotplug_device)) < 0) {
-               lbs_pr_err("request_firmware() failed, error code = %#x\n",
-                      ret);
-               lbs_pr_err("%s not found in /lib/firmware\n", libertas_fw_name);
+               lbs_pr_err("request_firmware() failed with %#x\n", ret);
+               lbs_pr_err("firmware %s not found\n", fw_name);
                goto done;
        }
 
-       if(check_fwfile_format(priv->firmware->data, priv->firmware->size)) {
+       if (check_fwfile_format(priv->firmware->data, priv->firmware->size)) {
                release_firmware(priv->firmware);
                goto done;
        }
 
-       ret = libertas_sbi_prog_firmware(priv);
+       ret = priv->hw_prog_firmware(priv);
 
        release_firmware(priv->firmware);
 
        if (ret) {
-               lbs_pr_debug(1, "Bootloader in invalid state!\n");
+               lbs_deb_fw("bootloader in invalid state\n");
                ret = -1;
                goto done;
        }
@@ -133,28 +121,24 @@ static int wlan_setup_station_hw(wlan_private * priv)
 
        ret = 0;
 done:
-       LEAVE();
-
-       return (ret);
+       lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret);
+       return ret;
 }
 
 static int wlan_allocate_adapter(wlan_private * priv)
 {
-       u32 ulbufsize;
+       size_t bufsize;
        wlan_adapter *adapter = priv->adapter;
 
-       struct bss_descriptor *ptempscantable;
-
        /* Allocate buffer to store the BSSID list */
-       ulbufsize = sizeof(struct bss_descriptor) * MRVDRV_MAX_BSSID_LIST;
-       if (!(ptempscantable = kmalloc(ulbufsize, GFP_KERNEL))) {
+       bufsize = MAX_NETWORK_COUNT * sizeof(struct bss_descriptor);
+       adapter->networks = kzalloc(bufsize, GFP_KERNEL);
+       if (!adapter->networks) {
+               lbs_pr_err("Out of memory allocating beacons\n");
                libertas_free_adapter(priv);
-               return -1;
+               return -ENOMEM;
        }
 
-       adapter->scantable = ptempscantable;
-       memset(adapter->scantable, 0, ulbufsize);
-
        /* Allocate the command buffers */
        libertas_allocate_cmd_buffer(priv);
 
@@ -202,15 +186,23 @@ static void wlan_init_adapter(wlan_private * priv)
        adapter->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
        adapter->mode = IW_MODE_INFRA;
 
-       adapter->assoc_req = NULL;
+       adapter->pending_assoc_req = NULL;
+       adapter->in_progress_assoc_req = NULL;
+
+       /* Initialize scan result lists */
+       INIT_LIST_HEAD(&adapter->network_free_list);
+       INIT_LIST_HEAD(&adapter->network_list);
+       for (i = 0; i < MAX_NETWORK_COUNT; i++) {
+               list_add_tail(&adapter->networks[i].list,
+                             &adapter->network_free_list);
+       }
 
-       adapter->numinscantable = 0;
-       adapter->pattemptedbssdesc = NULL;
        mutex_init(&adapter->lock);
 
        adapter->prescan = 1;
 
        memset(&adapter->curbssparams, 0, sizeof(adapter->curbssparams));
+       adapter->curbssparams.channel = DEFAULT_AD_HOC_CHANNEL;
 
        /* PnP and power profile */
        adapter->surpriseremoved = 0;
@@ -230,8 +222,6 @@ static void wlan_init_adapter(wlan_private * priv)
        memset(&adapter->capinfo, 0, sizeof(adapter->capinfo));
        adapter->capinfo.shortpreamble = SHORT_PREAMBLE_ALLOWED;
 
-       adapter->adhocchannel = DEFAULT_AD_HOC_CHANNEL;
-
        adapter->psmode = wlan802_11powermodecam;
        adapter->multipledtim = MRVDRV_DEFAULT_MULTIPLE_DTIM;
 
@@ -259,12 +249,12 @@ static void wlan_init_adapter(wlan_private * priv)
 
 static void command_timer_fn(unsigned long data);
 
-int libertas_init_fw(wlan_private * priv)
+int libertas_init_fw(wlan_private * priv, char *fw_name)
 {
        int ret = -1;
        wlan_adapter *adapter = priv->adapter;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_FW);
 
        /* Allocate adapter structure */
        if ((ret = wlan_allocate_adapter(priv)) != 0)
@@ -278,7 +268,7 @@ int libertas_init_fw(wlan_private * priv)
                        (unsigned long)priv);
 
        /* download fimrware etc. */
-       if ((ret = wlan_setup_station_hw(priv)) != 0) {
+       if ((ret = wlan_setup_station_hw(priv, fw_name)) != 0) {
                del_timer_sync(&adapter->command_timer);
                goto done;
        }
@@ -288,7 +278,7 @@ int libertas_init_fw(wlan_private * priv)
 
        ret = 0;
 done:
-       LEAVE();
+       lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret);
        return ret;
 }
 
@@ -297,25 +287,22 @@ void libertas_free_adapter(wlan_private * priv)
        wlan_adapter *adapter = priv->adapter;
 
        if (!adapter) {
-               lbs_pr_debug(1, "Why double free adapter?:)\n");
+               lbs_deb_fw("why double free adapter?\n");
                return;
        }
 
-       lbs_pr_debug(1, "Free command buffer\n");
+       lbs_deb_fw("free command buffer\n");
        libertas_free_cmd_buffer(priv);
 
-       lbs_pr_debug(1, "Free commandTimer\n");
+       lbs_deb_fw("free command_timer\n");
        del_timer(&adapter->command_timer);
 
-       lbs_pr_debug(1, "Free scantable\n");
-       if (adapter->scantable) {
-               kfree(adapter->scantable);
-               adapter->scantable = NULL;
-       }
-
-       lbs_pr_debug(1, "Free adapter\n");
+       lbs_deb_fw("free scan results table\n");
+       kfree(adapter->networks);
+       adapter->networks = NULL;
 
        /* Free the adapter object itself */
+       lbs_deb_fw("free adapter\n");
        kfree(adapter);
        priv->adapter = NULL;
 }
@@ -334,17 +321,17 @@ static void command_timer_fn(unsigned long data)
 
        ptempnode = adapter->cur_cmd;
        if (ptempnode == NULL) {
-               lbs_pr_debug(1, "PTempnode Empty\n");
+               lbs_deb_fw("ptempnode empty\n");
                return;
        }
 
        cmd = (struct cmd_ds_command *)ptempnode->bufvirtualaddr;
        if (!cmd) {
-               lbs_pr_debug(1, "cmd is NULL\n");
+               lbs_deb_fw("cmd is NULL\n");
                return;
        }
 
-       lbs_pr_info("command_timer_fn fired (%x)\n", cmd->command);
+       lbs_deb_fw("command_timer_fn fired, cmd %x\n", cmd->command);
 
        if (!adapter->fw_ready)
                return;
@@ -353,7 +340,7 @@ static void command_timer_fn(unsigned long data)
        adapter->cur_cmd = NULL;
        spin_unlock_irqrestore(&adapter->driver_lock, flags);
 
-       lbs_pr_debug(1, "Re-sending same command as it timeout...!\n");
+       lbs_deb_fw("re-sending same command because of timeout\n");
        libertas_queue_cmd(adapter, ptempnode, 0);
 
        wake_up_interruptible(&priv->mainthread.waitq);
diff --git a/drivers/net/wireless/libertas/fw.h b/drivers/net/wireless/libertas/fw.h
deleted file mode 100644 (file)
index 1f9ae26..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
-  * This header file contains FW interface related definitions.
-  */
-#ifndef _WLAN_FW_H_
-#define _WLAN_FW_H_
-
-#ifndef DEV_NAME_LEN
-#define DEV_NAME_LEN            32
-#endif
-
-int libertas_init_fw(wlan_private * priv);
-
-#endif                         /* _WLAN_FW_H_ */
index c0faaecaf5be31fcb10799718a4a9d9c37ac3d14..7509cc10af3c376a2f3bdf94f942b9bd7d59b920 100644 (file)
 #define cmd_bt_access                 0x0087
 #define cmd_ret_bt_access                 0x8087
 
-#define cmd_fwt_access                0x0088
-#define cmd_ret_fwt_access                0x8088
+#define cmd_fwt_access                0x0095
+#define cmd_ret_fwt_access                0x8095
 
-#define cmd_mesh_access               0x0090
-#define cmd_ret_mesh_access               0x8090
+#define cmd_mesh_access               0x009b
+#define cmd_ret_mesh_access               0x809b
 
 /* For the IEEE Power Save */
 #define cmd_subcmd_enter_ps               0x0030
@@ -287,7 +287,9 @@ enum cmd_bt_access_opts {
        cmd_act_bt_access_add = 5,
        cmd_act_bt_access_del,
        cmd_act_bt_access_list,
-       cmd_act_bt_access_reset
+       cmd_act_bt_access_reset,
+       cmd_act_bt_access_set_invert,
+       cmd_act_bt_access_get_invert
 };
 
 /* Define action or option for cmd_fwt_access */
@@ -308,8 +310,8 @@ enum cmd_mesh_access_opts {
        cmd_act_mesh_get_ttl = 1,
        cmd_act_mesh_set_ttl,
        cmd_act_mesh_get_stats,
-       cmd_act_mesh_get_mpp,
-       cmd_act_mesh_set_mpp,
+       cmd_act_mesh_get_anycast,
+       cmd_act_mesh_set_anycast,
 };
 
 /** Card Event definition */
@@ -334,5 +336,6 @@ enum cmd_mesh_access_opts {
 #define MACREG_INT_CODE_MAX_FAIL               0x0000001b
 #define MACREG_INT_CODE_RSSI_HIGH              0x0000001c
 #define MACREG_INT_CODE_SNR_HIGH               0x0000001d
+#define MACREG_INT_CODE_MESH_AUTO_STARTED      0x00000023
 
 #endif                         /* _HOST_H_ */
index f239e5d2435b159d863f54d22a8026d81c54b02b..3acf93988125696de779207893aa17f8a3d747fd 100644 (file)
 /* TxPD descriptor */
 struct txpd {
        /* Current Tx packet status */
-       u32 tx_status;
+       __le32 tx_status;
        /* Tx control */
-       u32 tx_control;
-       u32 tx_packet_location;
+       __le32 tx_control;
+       __le32 tx_packet_location;
        /* Tx packet length */
-       u16 tx_packet_length;
+       __le16 tx_packet_length;
        /* First 2 byte of destination MAC address */
        u8 tx_dest_addr_high[2];
        /* Last 4 byte of destination MAC address */
@@ -37,7 +37,7 @@ struct txpd {
 /* RxPD Descriptor */
 struct rxpd {
        /* Current Rx packet status */
-       u16 status;
+       __le16 status;
 
        /* SNR */
        u8 snr;
@@ -46,7 +46,7 @@ struct rxpd {
        u8 rx_control;
 
        /* Pkt length */
-       u16 pkt_len;
+       __le16 pkt_len;
 
        /* Noise Floor */
        u8 nf;
@@ -55,10 +55,10 @@ struct rxpd {
        u8 rx_rate;
 
        /* Pkt addr */
-       u32 pkt_ptr;
+       __le32 pkt_ptr;
 
        /* Next Rx RxPD addr */
-       u32 next_rxpd_ptr;
+       __le32 next_rxpd_ptr;
 
        /* Pkt Priority */
        u8 priority;
@@ -89,30 +89,17 @@ struct cmd_ctrl_node {
  * is determined from the keylength field.
  */
 struct WLAN_802_11_KEY {
-       u32 len;
-       u32 flags;  /* KEY_INFO_* from wlan_defs.h */
+       __le32 len;
+       __le32 flags;  /* KEY_INFO_* from wlan_defs.h */
        u8 key[MRVL_MAX_KEY_WPA_KEY_LENGTH];
-       u16 type; /* KEY_TYPE_* from wlan_defs.h */
+       __le16 type; /* KEY_TYPE_* from wlan_defs.h */
 };
 
 struct IE_WPA {
        u8 elementid;
        u8 len;
        u8 oui[4];
-       u16 version;
-};
-
-struct WLAN_802_11_SSID {
-       /* SSID length */
-       u32 ssidlength;
-
-       /* SSID information field */
-       u8 ssid[IW_ESSID_MAX_SIZE];
-};
-
-struct WPA_SUPPLICANT {
-       u8 wpa_ie[256];
-       u8 wpa_ie_len;
+       __le16 version;
 };
 
 /* wlan_offset_value */
@@ -122,9 +109,9 @@ struct wlan_offset_value {
 };
 
 struct WLAN_802_11_FIXED_IEs {
-       u8 timestamp[8];
-       u16 beaconinterval;
-       u16 capabilities;
+       __le64 timestamp;
+       __le16 beaconinterval;
+       u16 capabilities; /* Actually struct ieeetypes_capinfo */
 };
 
 struct WLAN_802_11_VARIABLE_IEs {
@@ -136,10 +123,10 @@ struct WLAN_802_11_VARIABLE_IEs {
 /* Define general data structure */
 /* cmd_DS_GEN */
 struct cmd_ds_gen {
-       u16 command;
-       u16 size;
-       u16 seqnum;
-       u16 result;
+       __le16 command;
+       __le16 size;
+       __le16 seqnum;
+       __le16 result;
 };
 
 #define S_DS_GEN sizeof(struct cmd_ds_gen)
@@ -149,44 +136,44 @@ struct cmd_ds_gen {
  */
 struct cmd_ds_get_hw_spec {
        /* HW Interface version number */
-       u16 hwifversion;
+       __le16 hwifversion;
        /* HW version number */
-       u16 version;
+       __le16 version;
        /* Max number of TxPD FW can handle */
-       u16 nr_txpd;
+       __le16 nr_txpd;
        /* Max no of Multicast address */
-       u16 nr_mcast_adr;
+       __le16 nr_mcast_adr;
        /* MAC address */
        u8 permanentaddr[6];
 
        /* region Code */
-       u16 regioncode;
+       __le16 regioncode;
 
        /* Number of antenna used */
-       u16 nr_antenna;
+       __le16 nr_antenna;
 
-       /* FW release number, example 0x1234=1.2.3.4 */
-       u32 fwreleasenumber;
+       /* FW release number, example 1,2,3,4 = 3.2.1p4 */
+       u8 fwreleasenumber[4];
 
        /* Base Address of TxPD queue */
-       u32 wcb_base;
+       __le32 wcb_base;
        /* Read Pointer of RxPd queue */
-       u32 rxpd_rdptr;
+       __le32 rxpd_rdptr;
 
        /* Write Pointer of RxPd queue */
-       u32 rxpd_wrptr;
+       __le32 rxpd_wrptr;
 
        /*FW/HW capability */
-       u32 fwcapinfo;
+       __le32 fwcapinfo;
 } __attribute__ ((packed));
 
 struct cmd_ds_802_11_reset {
-       u16 action;
+       __le16 action;
 };
 
 struct cmd_ds_802_11_subscribe_event {
-       u16 action;
-       u16 events;
+       __le16 action;
+       __le16 events;
 };
 
 /*
@@ -205,35 +192,35 @@ struct cmd_ds_802_11_scan {
 };
 
 struct cmd_ds_802_11_scan_rsp {
-       u16 bssdescriptsize;
+       __le16 bssdescriptsize;
        u8 nr_sets;
        u8 bssdesc_and_tlvbuffer[1];
 };
 
 struct cmd_ds_802_11_get_log {
-       u32 mcasttxframe;
-       u32 failed;
-       u32 retry;
-       u32 multiretry;
-       u32 framedup;
-       u32 rtssuccess;
-       u32 rtsfailure;
-       u32 ackfailure;
-       u32 rxfrag;
-       u32 mcastrxframe;
-       u32 fcserror;
-       u32 txframe;
-       u32 wepundecryptable;
+       __le32 mcasttxframe;
+       __le32 failed;
+       __le32 retry;
+       __le32 multiretry;
+       __le32 framedup;
+       __le32 rtssuccess;
+       __le32 rtsfailure;
+       __le32 ackfailure;
+       __le32 rxfrag;
+       __le32 mcastrxframe;
+       __le32 fcserror;
+       __le32 txframe;
+       __le32 wepundecryptable;
 };
 
 struct cmd_ds_mac_control {
-       u16 action;
-       u16 reserved;
+       __le16 action;
+       __le16 reserved;
 };
 
 struct cmd_ds_mac_multicast_adr {
-       u16 action;
-       u16 nr_of_adrs;
+       __le16 action;
+       __le16 nr_of_adrs;
        u8 maclist[ETH_ALEN * MRVDRV_MAX_MULTICAST_LIST_SIZE];
 };
 
@@ -245,14 +232,14 @@ struct cmd_ds_802_11_authenticate {
 
 struct cmd_ds_802_11_deauthenticate {
        u8 macaddr[6];
-       u16 reasoncode;
+       __le16 reasoncode;
 };
 
 struct cmd_ds_802_11_associate {
        u8 peerstaaddr[6];
        struct ieeetypes_capinfo capinfo;
-       u16 listeninterval;
-       u16 bcnperiod;
+       __le16 listeninterval;
+       __le16 bcnperiod;
        u8 dtimperiod;
 
 #if 0
@@ -265,7 +252,7 @@ struct cmd_ds_802_11_associate {
 
 struct cmd_ds_802_11_disassociate {
        u8 destmacaddr[6];
-       u16 reasoncode;
+       __le16 reasoncode;
 };
 
 struct cmd_ds_802_11_associate_rsp {
@@ -279,10 +266,10 @@ struct cmd_ds_802_11_ad_hoc_result {
 
 struct cmd_ds_802_11_set_wep {
        /* ACT_ADD, ACT_REMOVE or ACT_ENABLE */
-       u16 action;
+       __le16 action;
 
        /* key Index selected for Tx */
-       u16 keyindex;
+       __le16 keyindex;
 
        /* 40, 128bit or TXWEP */
        u8 keytype[4];
@@ -290,96 +277,96 @@ struct cmd_ds_802_11_set_wep {
 };
 
 struct cmd_ds_802_3_get_stat {
-       u32 xmitok;
-       u32 rcvok;
-       u32 xmiterror;
-       u32 rcverror;
-       u32 rcvnobuffer;
-       u32 rcvcrcerror;
+       __le32 xmitok;
+       __le32 rcvok;
+       __le32 xmiterror;
+       __le32 rcverror;
+       __le32 rcvnobuffer;
+       __le32 rcvcrcerror;
 };
 
 struct cmd_ds_802_11_get_stat {
-       u32 txfragmentcnt;
-       u32 mcasttxframecnt;
-       u32 failedcnt;
-       u32 retrycnt;
-       u32 Multipleretrycnt;
-       u32 rtssuccesscnt;
-       u32 rtsfailurecnt;
-       u32 ackfailurecnt;
-       u32 frameduplicatecnt;
-       u32 rxfragmentcnt;
-       u32 mcastrxframecnt;
-       u32 fcserrorcnt;
-       u32 bcasttxframecnt;
-       u32 bcastrxframecnt;
-       u32 txbeacon;
-       u32 rxbeacon;
-       u32 wepundecryptable;
+       __le32 txfragmentcnt;
+       __le32 mcasttxframecnt;
+       __le32 failedcnt;
+       __le32 retrycnt;
+       __le32 Multipleretrycnt;
+       __le32 rtssuccesscnt;
+       __le32 rtsfailurecnt;
+       __le32 ackfailurecnt;
+       __le32 frameduplicatecnt;
+       __le32 rxfragmentcnt;
+       __le32 mcastrxframecnt;
+       __le32 fcserrorcnt;
+       __le32 bcasttxframecnt;
+       __le32 bcastrxframecnt;
+       __le32 txbeacon;
+       __le32 rxbeacon;
+       __le32 wepundecryptable;
 };
 
 struct cmd_ds_802_11_snmp_mib {
-       u16 querytype;
-       u16 oid;
-       u16 bufsize;
+       __le16 querytype;
+       __le16 oid;
+       __le16 bufsize;
        u8 value[128];
 };
 
 struct cmd_ds_mac_reg_map {
-       u16 buffersize;
+       __le16 buffersize;
        u8 regmap[128];
-       u16 reserved;
+       __le16 reserved;
 };
 
 struct cmd_ds_bbp_reg_map {
-       u16 buffersize;
+       __le16 buffersize;
        u8 regmap[128];
-       u16 reserved;
+       __le16 reserved;
 };
 
 struct cmd_ds_rf_reg_map {
-       u16 buffersize;
+       __le16 buffersize;
        u8 regmap[64];
-       u16 reserved;
+       __le16 reserved;
 };
 
 struct cmd_ds_mac_reg_access {
-       u16 action;
-       u16 offset;
-       u32 value;
+       __le16 action;
+       __le16 offset;
+       __le32 value;
 };
 
 struct cmd_ds_bbp_reg_access {
-       u16 action;
-       u16 offset;
+       __le16 action;
+       __le16 offset;
        u8 value;
        u8 reserved[3];
 };
 
 struct cmd_ds_rf_reg_access {
-       u16 action;
-       u16 offset;
+       __le16 action;
+       __le16 offset;
        u8 value;
        u8 reserved[3];
 };
 
 struct cmd_ds_802_11_radio_control {
-       u16 action;
-       u16 control;
+       __le16 action;
+       __le16 control;
 };
 
 struct cmd_ds_802_11_sleep_params {
        /* ACT_GET/ACT_SET */
-       u16 action;
+       __le16 action;
 
        /* Sleep clock error in ppm */
-       u16 error;
+       __le16 error;
 
        /* Wakeup offset in usec */
-       u16 offset;
+       __le16 offset;
 
        /* Clock stabilization time in usec */
-       u16 stabletime;
+       __le16 stabletime;
 
        /* control periodic calibration */
        u8 calcontrol;
@@ -388,100 +375,100 @@ struct cmd_ds_802_11_sleep_params {
        u8 externalsleepclk;
 
        /* reserved field, should be set to zero */
-       u16 reserved;
+       __le16 reserved;
 };
 
 struct cmd_ds_802_11_inactivity_timeout {
        /* ACT_GET/ACT_SET */
-       u16 action;
+       __le16 action;
 
        /* Inactivity timeout in msec */
-       u16 timeout;
+       __le16 timeout;
 };
 
 struct cmd_ds_802_11_rf_channel {
-       u16 action;
-       u16 currentchannel;
-       u16 rftype;
-       u16 reserved;
+       __le16 action;
+       __le16 currentchannel;
+       __le16 rftype;
+       __le16 reserved;
        u8 channellist[32];
 };
 
 struct cmd_ds_802_11_rssi {
        /* weighting factor */
-       u16 N;
+       __le16 N;
 
-       u16 reserved_0;
-       u16 reserved_1;
-       u16 reserved_2;
+       __le16 reserved_0;
+       __le16 reserved_1;
+       __le16 reserved_2;
 };
 
 struct cmd_ds_802_11_rssi_rsp {
-       u16 SNR;
-       u16 noisefloor;
-       u16 avgSNR;
-       u16 avgnoisefloor;
+       __le16 SNR;
+       __le16 noisefloor;
+       __le16 avgSNR;
+       __le16 avgnoisefloor;
 };
 
 struct cmd_ds_802_11_mac_address {
-       u16 action;
+       __le16 action;
        u8 macadd[ETH_ALEN];
 };
 
 struct cmd_ds_802_11_rf_tx_power {
-       u16 action;
-       u16 currentlevel;
+       __le16 action;
+       __le16 currentlevel;
 };
 
 struct cmd_ds_802_11_rf_antenna {
-       u16 action;
+       __le16 action;
 
        /* Number of antennas or 0xffff(diversity) */
-       u16 antennamode;
+       __le16 antennamode;
 
 };
 
 struct cmd_ds_802_11_ps_mode {
-       u16 action;
-       u16 nullpktinterval;
-       u16 multipledtim;
-       u16 reserved;
-       u16 locallisteninterval;
+       __le16 action;
+       __le16 nullpktinterval;
+       __le16 multipledtim;
+       __le16 reserved;
+       __le16 locallisteninterval;
 };
 
 struct PS_CMD_ConfirmSleep {
-       u16 command;
-       u16 size;
-       u16 seqnum;
-       u16 result;
+       __le16 command;
+       __le16 size;
+       __le16 seqnum;
+       __le16 result;
 
-       u16 action;
-       u16 reserved1;
-       u16 multipledtim;
-       u16 reserved;
-       u16 locallisteninterval;
+       __le16 action;
+       __le16 reserved1;
+       __le16 multipledtim;
+       __le16 reserved;
+       __le16 locallisteninterval;
 };
 
 struct cmd_ds_802_11_data_rate {
-       u16 action;
-       u16 reserverd;
+       __le16 action;
+       __le16 reserverd;
        u8 datarate[G_SUPPORTED_RATES];
 };
 
 struct cmd_ds_802_11_rate_adapt_rateset {
-       u16 action;
-       u16 enablehwauto;
-       u16 bitmap;
+       __le16 action;
+       __le16 enablehwauto;
+       __le16 bitmap;
 };
 
 struct cmd_ds_802_11_ad_hoc_start {
        u8 SSID[IW_ESSID_MAX_SIZE];
        u8 bsstype;
-       u16 beaconperiod;
+       __le16 beaconperiod;
        u8 dtimperiod;
        union IEEEtypes_ssparamset ssparamset;
        union ieeetypes_phyparamset phyparamset;
-       u16 probedelay;
+       __le16 probedelay;
        struct ieeetypes_capinfo cap;
        u8 datarate[G_SUPPORTED_RATES];
        u8 tlv_memory_size_pad[100];
@@ -491,10 +478,10 @@ struct adhoc_bssdesc {
        u8 BSSID[6];
        u8 SSID[32];
        u8 bsstype;
-       u16 beaconperiod;
+       __le16 beaconperiod;
        u8 dtimperiod;
-       u8 timestamp[8];
-       u8 localtime[8];
+       __le64 timestamp;
+       __le64 localtime;
        union ieeetypes_phyparamset phyparamset;
        union IEEEtypes_ssparamset ssparamset;
        struct ieeetypes_capinfo cap;
@@ -508,52 +495,52 @@ struct adhoc_bssdesc {
 
 struct cmd_ds_802_11_ad_hoc_join {
        struct adhoc_bssdesc bssdescriptor;
-       u16 failtimeout;
-       u16 probedelay;
+       __le16 failtimeout;
+       __le16 probedelay;
 
 } __attribute__ ((packed));
 
 struct cmd_ds_802_11_enable_rsn {
-       u16 action;
-       u16 enable;
+       __le16 action;
+       __le16 enable;
 };
 
 struct MrvlIEtype_keyParamSet {
        /* type ID */
-       u16 type;
+       __le16 type;
 
        /* length of Payload */
-       u16 length;
+       __le16 length;
 
        /* type of key: WEP=0, TKIP=1, AES=2 */
-       u16 keytypeid;
+       __le16 keytypeid;
 
        /* key control Info specific to a keytypeid */
-       u16 keyinfo;
+       __le16 keyinfo;
 
        /* length of key */
-       u16 keylen;
+       __le16 keylen;
 
        /* key material of size keylen */
        u8 key[32];
 };
 
 struct cmd_ds_802_11_key_material {
-       u16 action;
+       __le16 action;
        struct MrvlIEtype_keyParamSet keyParamSet[2];
 } __attribute__ ((packed));
 
 struct cmd_ds_802_11_eeprom_access {
-       u16 action;
+       __le16 action;
 
        /* multiple 4 */
-       u16 offset;
-       u16 bytecount;
+       __le16 offset;
+       __le16 bytecount;
        u8 value;
 } __attribute__ ((packed));
 
 struct cmd_ds_802_11_tpc_cfg {
-       u16 action;
+       __le16 action;
        u8 enable;
        s8 P0;
        s8 P1;
@@ -562,13 +549,13 @@ struct cmd_ds_802_11_tpc_cfg {
 } __attribute__ ((packed));
 
 struct cmd_ds_802_11_led_ctrl {
-       u16 action;
-       u16 numled;
+       __le16 action;
+       __le16 numled;
        u8 data[256];
 } __attribute__ ((packed));
 
 struct cmd_ds_802_11_pwr_cfg {
-       u16 action;
+       __le16 action;
        u8 enable;
        s8 PA_P0;
        s8 PA_P1;
@@ -576,21 +563,21 @@ struct cmd_ds_802_11_pwr_cfg {
 } __attribute__ ((packed));
 
 struct cmd_ds_802_11_afc {
-       u16 afc_auto;
+       __le16 afc_auto;
        union {
                struct {
-                       u16 threshold;
-                       u16 period;
+                       __le16 threshold;
+                       __le16 period;
                };
                struct {
-                       s16 timing_offset;
-                       s16 carrier_offset;
+                       __le16 timing_offset; /* signed */
+                       __le16 carrier_offset; /* signed */
                };
        };
 } __attribute__ ((packed));
 
 struct cmd_tx_rate_query {
-       u16 txrate;
+       __le16 txrate;
 } __attribute__ ((packed));
 
 struct cmd_ds_get_tsf {
@@ -598,41 +585,46 @@ struct cmd_ds_get_tsf {
 } __attribute__ ((packed));
 
 struct cmd_ds_bt_access {
-       u16 action;
-       u32 id;
+       __le16 action;
+       __le32 id;
        u8 addr1[ETH_ALEN];
        u8 addr2[ETH_ALEN];
 } __attribute__ ((packed));
 
 struct cmd_ds_fwt_access {
-       u16 action;
-       u32 id;
+       __le16 action;
+       __le32 id;
+       u8 valid;
        u8 da[ETH_ALEN];
        u8 dir;
        u8 ra[ETH_ALEN];
-       u32 ssn;
-       u32 dsn;
-       u32 metric;
+       __le32 ssn;
+       __le32 dsn;
+       __le32 metric;
+       u8 rate;
        u8 hopcount;
        u8 ttl;
-       u32 expiration;
+       __le32 expiration;
        u8 sleepmode;
-       u32 snr;
-       u32 references;
+       __le32 snr;
+       __le32 references;
+       u8 prec[ETH_ALEN];
 } __attribute__ ((packed));
 
-#define MESH_STATS_NUM 7
 struct cmd_ds_mesh_access {
-       u16 action;
-       u32 data[MESH_STATS_NUM + 1];   /* last position reserved */
+       __le16 action;
+       __le32 data[32];        /* last position reserved */
 } __attribute__ ((packed));
 
+/* Number of stats counters returned by the firmware */
+#define MESH_STATS_NUM 8
+
 struct cmd_ds_command {
        /* command header */
-       u16 command;
-       u16 size;
-       u16 seqnum;
-       u16 result;
+       __le16 command;
+       __le16 size;
+       __le16 seqnum;
+       __le16 result;
 
        /* command Body */
        union {
index 567000c3e87bbf9c72185049d5f1f49414da4045..8bca306ffad9e7e3b0916db45cbddbf4283a7851 100644 (file)
@@ -8,6 +8,8 @@
 #include <linux/netdevice.h>
 #include <linux/usb.h>
 
+#define DRV_NAME "usb8xxx"
+
 #include "defs.h"
 #include "dev.h"
 #include "if_usb.h"
  */
 int if_usb_issue_boot_command(wlan_private *priv, int ivalue)
 {
-       struct usb_card_rec     *cardp = priv->wlan_dev.card;
+       struct usb_card_rec     *cardp = priv->card;
        struct bootcmdstr       sbootcmd;
        int i;
 
        /* Prepare command */
-       sbootcmd.u32magicnumber = BOOT_CMD_MAGIC_NUMBER;
+       sbootcmd.u32magicnumber = cpu_to_le32(BOOT_CMD_MAGIC_NUMBER);
        sbootcmd.u8cmd_tag = ivalue;
        for (i=0; i<11; i++)
                sbootcmd.au8dumy[i]=0x00;
index ae6f72a6cdf396d5946e5ff1de1863c18a6d0380..998317571ec26cdc3b97342b2da376a0d2f2561f 100644 (file)
@@ -2,12 +2,15 @@
   * This file contains functions used in USB interface module.
   */
 #include <linux/delay.h>
+#include <linux/moduleparam.h>
 #include <linux/firmware.h>
 #include <linux/netdevice.h>
+#include <linux/list.h>
 #include <linux/usb.h>
 
+#define DRV_NAME "usb8xxx"
+
 #include "host.h"
-#include "sbi.h"
 #include "decl.h"
 #include "defs.h"
 #include "dev.h"
 #define MESSAGE_HEADER_LEN     4
 
 static const char usbdriver_name[] = "usb8xxx";
+static u8 *default_fw_name = "usb8388.bin";
+
+char *libertas_fw_name = NULL;
+module_param_named(fw_name, libertas_fw_name, charp, 0644);
+
+/*
+ * We need to send a RESET command to all USB devices before
+ * we tear down the USB connection. Otherwise we would not
+ * be able to re-init device the device if the module gets
+ * loaded again. This is a list of all initialized USB devices,
+ * for the reset code see if_usb_reset_device()
+*/
+static LIST_HEAD(usb_devices);
 
 static struct usb_device_id if_usb_table[] = {
        /* Enter the device signature inside */
-       {
-               USB_DEVICE(USB8388_VID_1, USB8388_PID_1),
-       },
-       {
-               USB_DEVICE(USB8388_VID_2, USB8388_PID_2),
-       },
+       { USB_DEVICE(0x1286, 0x2001) },
+       { USB_DEVICE(0x05a3, 0x8388) },
        {}      /* Terminating entry */
 };
 
@@ -32,6 +44,13 @@ MODULE_DEVICE_TABLE(usb, if_usb_table);
 
 static void if_usb_receive(struct urb *urb);
 static void if_usb_receive_fwload(struct urb *urb);
+static int if_usb_reset_device(wlan_private *priv);
+static int if_usb_register_dev(wlan_private * priv);
+static int if_usb_unregister_dev(wlan_private *);
+static int if_usb_prog_firmware(wlan_private *);
+static int if_usb_host_to_card(wlan_private * priv, u8 type, u8 * payload, u16 nb);
+static int if_usb_get_int_status(wlan_private * priv, u8 *);
+static int if_usb_read_event_cause(wlan_private *);
 
 /**
  *  @brief  call back function to handle the status of the URB
@@ -42,23 +61,27 @@ static void if_usb_write_bulk_callback(struct urb *urb)
 {
        wlan_private *priv = (wlan_private *) (urb->context);
        wlan_adapter *adapter = priv->adapter;
-       struct net_device *dev = priv->wlan_dev.netdev;
+       struct net_device *dev = priv->dev;
 
        /* handle the transmission complete validations */
 
        if (urb->status != 0) {
                /* print the failure status number for debug */
-               lbs_pr_info("URB in failure status\n");
+               lbs_pr_info("URB in failure status: %d\n", urb->status);
        } else {
-               lbs_dev_dbg(2, &urb->dev->dev, "URB status is successfull\n");
-               lbs_dev_dbg(2, &urb->dev->dev, "Actual length transmitted %d\n",
+               /*
+               lbs_deb_usbd(&urb->dev->dev, "URB status is successfull\n");
+               lbs_deb_usbd(&urb->dev->dev, "Actual length transmitted %d\n",
                       urb->actual_length);
-               priv->wlan_dev.dnld_sent = DNLD_RES_RECEIVED;
+               */
+               priv->dnld_sent = DNLD_RES_RECEIVED;
                /* Wake main thread if commands are pending */
                if (!adapter->cur_cmd)
                        wake_up_interruptible(&priv->mainthread.waitq);
-               if ((adapter->connect_status == libertas_connected))
+               if ((adapter->connect_status == libertas_connected)) {
                        netif_wake_queue(dev);
+                       netif_wake_queue(priv->mesh_dev);
+               }
        }
 
        return;
@@ -71,7 +94,7 @@ static void if_usb_write_bulk_callback(struct urb *urb)
  */
 void if_usb_free(struct usb_card_rec *cardp)
 {
-       ENTER();
+       lbs_deb_enter(LBS_DEB_USB);
 
        /* Unlink tx & rx urb */
        usb_kill_urb(cardp->tx_urb);
@@ -86,8 +109,7 @@ void if_usb_free(struct usb_card_rec *cardp)
        kfree(cardp->bulk_out_buffer);
        cardp->bulk_out_buffer = NULL;
 
-       LEAVE();
-       return;
+       lbs_deb_leave(LBS_DEB_USB);
 }
 
 /**
@@ -102,27 +124,27 @@ static int if_usb_probe(struct usb_interface *intf,
        struct usb_device *udev;
        struct usb_host_interface *iface_desc;
        struct usb_endpoint_descriptor *endpoint;
-       wlan_private *pwlanpriv;
-       struct usb_card_rec *usb_cardp;
+       wlan_private *priv;
+       struct usb_card_rec *cardp;
        int i;
 
        udev = interface_to_usbdev(intf);
 
-       usb_cardp = kzalloc(sizeof(struct usb_card_rec), GFP_KERNEL);
-       if (!usb_cardp) {
+       cardp = kzalloc(sizeof(struct usb_card_rec), GFP_KERNEL);
+       if (!cardp) {
                lbs_pr_err("Out of memory allocating private data.\n");
                goto error;
        }
 
-       usb_cardp->udev = udev;
+       cardp->udev = udev;
        iface_desc = intf->cur_altsetting;
 
-       lbs_dev_dbg(1, &udev->dev, "bcdUSB = 0x%X bDeviceClass = 0x%X"
+       lbs_deb_usbd(&udev->dev, "bcdUSB = 0x%X bDeviceClass = 0x%X"
               " bDeviceSubClass = 0x%X, bDeviceProtocol = 0x%X\n",
-              udev->descriptor.bcdUSB,
-              udev->descriptor.bDeviceClass,
-              udev->descriptor.bDeviceSubClass,
-              udev->descriptor.bDeviceProtocol);
+                    le16_to_cpu(udev->descriptor.bcdUSB),
+                    udev->descriptor.bDeviceClass,
+                    udev->descriptor.bDeviceSubClass,
+                    udev->descriptor.bDeviceProtocol);
 
        for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
                endpoint = &iface_desc->endpoint[i].desc;
@@ -130,23 +152,21 @@ static int if_usb_probe(struct usb_interface *intf,
                    && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
                        USB_ENDPOINT_XFER_BULK)) {
                        /* we found a bulk in endpoint */
-                       lbs_dev_dbg(1, &udev->dev, "Bulk in size is %d\n",
-                              endpoint->wMaxPacketSize);
-                       if (!
-                           (usb_cardp->rx_urb =
-                            usb_alloc_urb(0, GFP_KERNEL))) {
-                               lbs_dev_dbg(1, &udev->dev,
+                       lbs_deb_usbd(&udev->dev, "Bulk in size is %d\n",
+                                    le16_to_cpu(endpoint->wMaxPacketSize));
+                       if (!(cardp->rx_urb = usb_alloc_urb(0, GFP_KERNEL))) {
+                               lbs_deb_usbd(&udev->dev,
                                       "Rx URB allocation failed\n");
                                goto dealloc;
                        }
-                       usb_cardp->rx_urb_recall = 0;
+                       cardp->rx_urb_recall = 0;
 
-                       usb_cardp->bulk_in_size =
-                           endpoint->wMaxPacketSize;
-                       usb_cardp->bulk_in_endpointAddr =
+                       cardp->bulk_in_size =
+                               le16_to_cpu(endpoint->wMaxPacketSize);
+                       cardp->bulk_in_endpointAddr =
                            (endpoint->
                             bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
-                       lbs_dev_dbg(1, &udev->dev, "in_endpoint = %d\n",
+                       lbs_deb_usbd(&udev->dev, "in_endpoint = %d\n",
                               endpoint->bEndpointAddress);
                }
 
@@ -156,55 +176,63 @@ static int if_usb_probe(struct usb_interface *intf,
                    && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
                        USB_ENDPOINT_XFER_BULK)) {
                        /* We found bulk out endpoint */
-                       if (!
-                           (usb_cardp->tx_urb =
-                            usb_alloc_urb(0, GFP_KERNEL))) {
-                               lbs_dev_dbg(1,&udev->dev,
+                       if (!(cardp->tx_urb = usb_alloc_urb(0, GFP_KERNEL))) {
+                               lbs_deb_usbd(&udev->dev,
                                       "Tx URB allocation failed\n");
                                goto dealloc;
                        }
 
-                       usb_cardp->bulk_out_size =
-                           endpoint->wMaxPacketSize;
-                       lbs_dev_dbg(1, &udev->dev,
-                                   "Bulk out size is %d\n",
-                                   endpoint->wMaxPacketSize);
-                       usb_cardp->bulk_out_endpointAddr =
+                       cardp->bulk_out_size =
+                               le16_to_cpu(endpoint->wMaxPacketSize);
+                       lbs_deb_usbd(&udev->dev,
+                                    "Bulk out size is %d\n",
+                                    le16_to_cpu(endpoint->wMaxPacketSize));
+                       cardp->bulk_out_endpointAddr =
                            endpoint->bEndpointAddress;
-                       lbs_dev_dbg(1, &udev->dev, "out_endpoint = %d\n",
+                       lbs_deb_usbd(&udev->dev, "out_endpoint = %d\n",
                                    endpoint->bEndpointAddress);
-                       usb_cardp->bulk_out_buffer =
+                       cardp->bulk_out_buffer =
                            kmalloc(MRVDRV_ETH_TX_PACKET_BUFFER_SIZE,
                                    GFP_KERNEL);
 
-                       if (!usb_cardp->bulk_out_buffer) {
-                               lbs_dev_dbg(1, &udev->dev,
+                       if (!cardp->bulk_out_buffer) {
+                               lbs_deb_usbd(&udev->dev,
                                       "Could not allocate buffer\n");
                                goto dealloc;
                        }
                }
        }
 
-
-       /* At this point wlan_add_card() will be called.  Don't worry
-        * about keeping pwlanpriv around since it will be set on our
-        * usb device data in -> add() -> libertas_sbi_register_dev().
-        */
-       if (!(pwlanpriv = wlan_add_card(usb_cardp)))
+       if (!(priv = libertas_add_card(cardp, &udev->dev)))
                goto dealloc;
 
+       if (libertas_add_mesh(priv, &udev->dev))
+               goto err_add_mesh;
+
+       priv->hw_register_dev = if_usb_register_dev;
+       priv->hw_unregister_dev = if_usb_unregister_dev;
+       priv->hw_prog_firmware = if_usb_prog_firmware;
+       priv->hw_host_to_card = if_usb_host_to_card;
+       priv->hw_get_int_status = if_usb_get_int_status;
+       priv->hw_read_event_cause = if_usb_read_event_cause;
+
+       if (libertas_activate_card(priv, libertas_fw_name))
+               goto err_activate_card;
+
+       list_add_tail(&cardp->list, &usb_devices);
+
        usb_get_dev(udev);
-       usb_set_intfdata(intf, usb_cardp);
+       usb_set_intfdata(intf, cardp);
 
-       /*
-        * return card structure, which can be got back in the
-        * diconnect function as the ptr
-        * argument.
-        */
        return 0;
 
+err_activate_card:
+       libertas_remove_mesh(priv);
+err_add_mesh:
+       free_netdev(priv->dev);
+       kfree(priv->adapter);
 dealloc:
-       if_usb_free(usb_cardp);
+       if_usb_free(cardp);
 
 error:
        return -ENOMEM;
@@ -212,8 +240,7 @@ error:
 
 /**
  *  @brief free resource and cleanup
- *  @param udev                pointer to usb_device
- *  @param ptr         pointer to usb_cardp
+ *  @param intf                USB interface structure
  *  @return            N/A
  */
 static void if_usb_disconnect(struct usb_interface *intf)
@@ -229,9 +256,12 @@ static void if_usb_disconnect(struct usb_interface *intf)
         */
        adapter->surpriseremoved = 1;
 
+       list_del(&cardp->list);
+
        /* card is removed and we can call wlan_remove_card */
-       lbs_dev_dbg(1, &cardp->udev->dev, "call remove card\n");
-       wlan_remove_card(cardp);
+       lbs_deb_usbd(&cardp->udev->dev, "call remove card\n");
+       libertas_remove_mesh(priv);
+       libertas_remove_card(priv);
 
        /* Unlink and free urb */
        if_usb_free(cardp);
@@ -249,7 +279,7 @@ static void if_usb_disconnect(struct usb_interface *intf)
  */
 static int if_prog_firmware(wlan_private * priv)
 {
-       struct usb_card_rec *cardp = priv->wlan_dev.card;
+       struct usb_card_rec *cardp = priv->card;
        struct FWData *fwdata;
        struct fwheader *fwheader;
        u8 *firmware = priv->firmware->data;
@@ -266,8 +296,10 @@ static int if_prog_firmware(wlan_private * priv)
                cardp->fwseqnum = cardp->lastseqnum - 1;
        }
 
-       lbs_dev_dbg(2, &cardp->udev->dev, "totalbytes = %d\n",
+       /*
+       lbs_deb_usbd(&cardp->udev->dev, "totalbytes = %d\n",
                    cardp->totalbytes);
+       */
 
        memcpy(fwheader, &firmware[cardp->totalbytes],
               sizeof(struct fwheader));
@@ -275,40 +307,48 @@ static int if_prog_firmware(wlan_private * priv)
        cardp->fwlastblksent = cardp->totalbytes;
        cardp->totalbytes += sizeof(struct fwheader);
 
-       lbs_dev_dbg(2, &cardp->udev->dev,"Copy Data\n");
+       /* lbs_deb_usbd(&cardp->udev->dev,"Copy Data\n"); */
        memcpy(fwdata->data, &firmware[cardp->totalbytes],
-              fwdata->fwheader.datalength);
+              le32_to_cpu(fwdata->fwheader.datalength));
 
-       lbs_dev_dbg(2, &cardp->udev->dev,
-                   "Data length = %d\n", fwdata->fwheader.datalength);
+       /*
+       lbs_deb_usbd(&cardp->udev->dev,
+                   "Data length = %d\n", le32_to_cpu(fwdata->fwheader.datalength));
+       */
 
        cardp->fwseqnum = cardp->fwseqnum + 1;
 
-       fwdata->seqnum = cardp->fwseqnum;
-       cardp->lastseqnum = fwdata->seqnum;
-       cardp->totalbytes += fwdata->fwheader.datalength;
+       fwdata->seqnum = cpu_to_le32(cardp->fwseqnum);
+       cardp->lastseqnum = cardp->fwseqnum;
+       cardp->totalbytes += le32_to_cpu(fwdata->fwheader.datalength);
 
-       if (fwheader->dnldcmd == FW_HAS_DATA_TO_RECV) {
-               lbs_dev_dbg(2, &cardp->udev->dev, "There is data to follow\n");
-               lbs_dev_dbg(2, &cardp->udev->dev,
+       if (fwheader->dnldcmd == cpu_to_le32(FW_HAS_DATA_TO_RECV)) {
+               /*
+               lbs_deb_usbd(&cardp->udev->dev, "There are data to follow\n");
+               lbs_deb_usbd(&cardp->udev->dev,
                            "seqnum = %d totalbytes = %d\n", cardp->fwseqnum,
                            cardp->totalbytes);
+               */
                memcpy(cardp->bulk_out_buffer, fwheader, FW_DATA_XMIT_SIZE);
                usb_tx_block(priv, cardp->bulk_out_buffer, FW_DATA_XMIT_SIZE);
 
-       } else if (fwdata->fwheader.dnldcmd == FW_HAS_LAST_BLOCK) {
-               lbs_dev_dbg(2, &cardp->udev->dev,
+       } else if (fwdata->fwheader.dnldcmd == cpu_to_le32(FW_HAS_LAST_BLOCK)) {
+               /*
+               lbs_deb_usbd(&cardp->udev->dev,
                            "Host has finished FW downloading\n");
-               lbs_dev_dbg(2, &cardp->udev->dev,
+               lbs_deb_usbd(&cardp->udev->dev,
                            "Donwloading FW JUMP BLOCK\n");
+               */
                memcpy(cardp->bulk_out_buffer, fwheader, FW_DATA_XMIT_SIZE);
                usb_tx_block(priv, cardp->bulk_out_buffer, FW_DATA_XMIT_SIZE);
                cardp->fwfinalblk = 1;
        }
 
-       lbs_dev_dbg(2, &cardp->udev->dev,
+       /*
+       lbs_deb_usbd(&cardp->udev->dev,
                    "The firmware download is done size is %d\n",
                    cardp->totalbytes);
+       */
 
        kfree(fwdata);
 
@@ -318,14 +358,19 @@ static int if_prog_firmware(wlan_private * priv)
 static int libertas_do_reset(wlan_private *priv)
 {
        int ret;
-       struct usb_card_rec *cardp = priv->wlan_dev.card;
+       struct usb_card_rec *cardp = priv->card;
+
+       lbs_deb_enter(LBS_DEB_USB);
 
        ret = usb_reset_device(cardp->udev);
        if (!ret) {
                msleep(10);
-               reset_device(priv);
+               if_usb_reset_device(priv);
                msleep(10);
        }
+
+       lbs_deb_leave_args(LBS_DEB_USB, "ret %d", ret);
+
        return ret;
 }
 
@@ -339,12 +384,12 @@ static int libertas_do_reset(wlan_private *priv)
 int usb_tx_block(wlan_private * priv, u8 * payload, u16 nb)
 {
        /* pointer to card structure */
-       struct usb_card_rec *cardp = priv->wlan_dev.card;
+       struct usb_card_rec *cardp = priv->card;
        int ret = -1;
 
        /* check if device is removed */
        if (priv->adapter->surpriseremoved) {
-               lbs_dev_dbg(1, &cardp->udev->dev, "Device removed\n");
+               lbs_deb_usbd(&cardp->udev->dev, "Device removed\n");
                goto tx_ret;
        }
 
@@ -357,10 +402,10 @@ int usb_tx_block(wlan_private * priv, u8 * payload, u16 nb)
 
        if ((ret = usb_submit_urb(cardp->tx_urb, GFP_ATOMIC))) {
                /*  transfer failed */
-               lbs_dev_dbg(1, &cardp->udev->dev, "usb_submit_urb failed\n");
+               lbs_deb_usbd(&cardp->udev->dev, "usb_submit_urb failed\n");
                ret = -1;
        } else {
-               lbs_dev_dbg(2, &cardp->udev->dev, "usb_submit_urb success\n");
+               /* lbs_deb_usbd(&cardp->udev->dev, "usb_submit_urb success\n"); */
                ret = 0;
        }
 
@@ -372,7 +417,7 @@ static int __if_usb_submit_rx_urb(wlan_private * priv,
                                  void (*callbackfn)
                                  (struct urb *urb))
 {
-       struct usb_card_rec *cardp = priv->wlan_dev.card;
+       struct usb_card_rec *cardp = priv->card;
        struct sk_buff *skb;
        struct read_cb_info *rinfo = &cardp->rinfo;
        int ret = -1;
@@ -394,13 +439,13 @@ static int __if_usb_submit_rx_urb(wlan_private * priv,
 
        cardp->rx_urb->transfer_flags |= URB_ZERO_PACKET;
 
-       lbs_dev_dbg(2, &cardp->udev->dev, "Pointer for rx_urb %p\n", cardp->rx_urb);
+       /* lbs_deb_usbd(&cardp->udev->dev, "Pointer for rx_urb %p\n", cardp->rx_urb); */
        if ((ret = usb_submit_urb(cardp->rx_urb, GFP_ATOMIC))) {
                /* handle failure conditions */
-               lbs_dev_dbg(1, &cardp->udev->dev, "Submit Rx URB failed\n");
+               lbs_deb_usbd(&cardp->udev->dev, "Submit Rx URB failed\n");
                ret = -1;
        } else {
-               lbs_dev_dbg(2, &cardp->udev->dev, "Submit Rx URB success\n");
+               /* lbs_deb_usbd(&cardp->udev->dev, "Submit Rx URB success\n"); */
                ret = 0;
        }
 
@@ -423,12 +468,12 @@ static void if_usb_receive_fwload(struct urb *urb)
        struct read_cb_info *rinfo = (struct read_cb_info *)urb->context;
        wlan_private *priv = rinfo->priv;
        struct sk_buff *skb = rinfo->skb;
-       struct usb_card_rec *cardp = (struct usb_card_rec *)priv->wlan_dev.card;
+       struct usb_card_rec *cardp = (struct usb_card_rec *)priv->card;
        struct fwsyncheader *syncfwheader;
        struct bootcmdrespStr bootcmdresp;
 
        if (urb->status) {
-               lbs_dev_dbg(1, &cardp->udev->dev,
+               lbs_deb_usbd(&cardp->udev->dev,
                            "URB status is failed during fw load\n");
                kfree_skb(skb);
                return;
@@ -437,18 +482,18 @@ static void if_usb_receive_fwload(struct urb *urb)
        if (cardp->bootcmdresp == 0) {
                memcpy (&bootcmdresp, skb->data + IPFIELD_ALIGN_OFFSET,
                        sizeof(bootcmdresp));
-               if (cardp->udev->descriptor.bcdDevice < 0x3106) {
+               if (le16_to_cpu(cardp->udev->descriptor.bcdDevice) < 0x3106) {
                        kfree_skb(skb);
                        if_usb_submit_rx_urb_fwload(priv);
                        cardp->bootcmdresp = 1;
-                       lbs_dev_dbg(1, &cardp->udev->dev,
+                       lbs_deb_usbd(&cardp->udev->dev,
                                    "Received valid boot command response\n");
                        return;
                }
-               if (bootcmdresp.u32magicnumber != BOOT_CMD_MAGIC_NUMBER) {
+               if (bootcmdresp.u32magicnumber != cpu_to_le32(BOOT_CMD_MAGIC_NUMBER)) {
                        lbs_pr_info(
                                "boot cmd response wrong magic number (0x%x)\n",
-                               bootcmdresp.u32magicnumber);
+                               le32_to_cpu(bootcmdresp.u32magicnumber));
                } else if (bootcmdresp.u8cmd_tag != BOOT_CMD_FW_BY_USB) {
                        lbs_pr_info(
                                "boot cmd response cmd_tag error (%d)\n",
@@ -459,7 +504,7 @@ static void if_usb_receive_fwload(struct urb *urb)
                                bootcmdresp.u8result);
                } else {
                        cardp->bootcmdresp = 1;
-                       lbs_dev_dbg(1, &cardp->udev->dev,
+                       lbs_deb_usbd(&cardp->udev->dev,
                                    "Received valid boot command response\n");
                }
                kfree_skb(skb);
@@ -469,7 +514,7 @@ static void if_usb_receive_fwload(struct urb *urb)
 
        syncfwheader = kmalloc(sizeof(struct fwsyncheader), GFP_ATOMIC);
        if (!syncfwheader) {
-               lbs_dev_dbg(1, &cardp->udev->dev, "Failure to allocate syncfwheader\n");
+               lbs_deb_usbd(&cardp->udev->dev, "Failure to allocate syncfwheader\n");
                kfree_skb(skb);
                return;
        }
@@ -478,14 +523,16 @@ static void if_usb_receive_fwload(struct urb *urb)
                        sizeof(struct fwsyncheader));
 
        if (!syncfwheader->cmd) {
-               lbs_dev_dbg(2, &cardp->udev->dev,
+               /*
+               lbs_deb_usbd(&cardp->udev->dev,
                            "FW received Blk with correct CRC\n");
-               lbs_dev_dbg(2, &cardp->udev->dev,
+               lbs_deb_usbd(&cardp->udev->dev,
                            "FW received Blk seqnum = %d\n",
                       syncfwheader->seqnum);
+               */
                cardp->CRC_OK = 1;
        } else {
-               lbs_dev_dbg(1, &cardp->udev->dev,
+               lbs_deb_usbd(&cardp->udev->dev,
                            "FW received Blk with CRC error\n");
                cardp->CRC_OK = 0;
        }
@@ -515,7 +562,7 @@ static inline void process_cmdtypedata(int recvlength, struct sk_buff *skb,
 {
        if (recvlength > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE +
            MESSAGE_HEADER_LEN || recvlength < MRVDRV_MIN_PKT_LEN) {
-               lbs_dev_dbg(1, &cardp->udev->dev,
+               lbs_deb_usbd(&cardp->udev->dev,
                            "Packet length is Invalid\n");
                kfree_skb(skb);
                return;
@@ -525,7 +572,7 @@ static inline void process_cmdtypedata(int recvlength, struct sk_buff *skb,
        skb_put(skb, recvlength);
        skb_pull(skb, MESSAGE_HEADER_LEN);
        libertas_process_rxed_packet(priv, skb);
-       priv->wlan_dev.upld_len = (recvlength - MESSAGE_HEADER_LEN);
+       priv->upld_len = (recvlength - MESSAGE_HEADER_LEN);
 }
 
 static inline void process_cmdrequest(int recvlength, u8 *recvbuff,
@@ -535,7 +582,7 @@ static inline void process_cmdrequest(int recvlength, u8 *recvbuff,
 {
        u8 *cmdbuf;
        if (recvlength > MRVDRV_SIZE_OF_CMD_BUFFER) {
-               lbs_dev_dbg(1, &cardp->udev->dev,
+               lbs_deb_usbd(&cardp->udev->dev,
                            "The receive buffer is too large\n");
                kfree_skb(skb);
                return;
@@ -548,21 +595,21 @@ static inline void process_cmdrequest(int recvlength, u8 *recvbuff,
        /* take care of cur_cmd = NULL case by reading the
         * data to clear the interrupt */
        if (!priv->adapter->cur_cmd) {
-               cmdbuf = priv->wlan_dev.upld_buf;
+               cmdbuf = priv->upld_buf;
                priv->adapter->hisregcpy &= ~his_cmdupldrdy;
        } else
                cmdbuf = priv->adapter->cur_cmd->bufvirtualaddr;
 
        cardp->usb_int_cause |= his_cmdupldrdy;
-       priv->wlan_dev.upld_len = (recvlength - MESSAGE_HEADER_LEN);
+       priv->upld_len = (recvlength - MESSAGE_HEADER_LEN);
        memcpy(cmdbuf, recvbuff + MESSAGE_HEADER_LEN,
-              priv->wlan_dev.upld_len);
+              priv->upld_len);
 
        kfree_skb(skb);
-       libertas_interrupt(priv->wlan_dev.netdev);
+       libertas_interrupt(priv->dev);
        spin_unlock(&priv->adapter->driver_lock);
 
-       lbs_dev_dbg(1, &cardp->udev->dev,
+       lbs_deb_usbd(&cardp->udev->dev,
                    "Wake up main thread to handle cmd response\n");
 
        return;
@@ -580,17 +627,17 @@ static void if_usb_receive(struct urb *urb)
        struct read_cb_info *rinfo = (struct read_cb_info *)urb->context;
        wlan_private *priv = rinfo->priv;
        struct sk_buff *skb = rinfo->skb;
-       struct usb_card_rec *cardp = (struct usb_card_rec *)priv->wlan_dev.card;
+       struct usb_card_rec *cardp = (struct usb_card_rec *)priv->card;
 
        int recvlength = urb->actual_length;
        u8 *recvbuff = NULL;
        u32 recvtype;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_USB);
 
        if (recvlength) {
                if (urb->status) {
-                       lbs_dev_dbg(1, &cardp->udev->dev,
+                       lbs_deb_usbd(&cardp->udev->dev,
                                    "URB status is failed\n");
                        kfree_skb(skb);
                        goto setup_for_next;
@@ -598,12 +645,12 @@ static void if_usb_receive(struct urb *urb)
 
                recvbuff = skb->data + IPFIELD_ALIGN_OFFSET;
                memcpy(&recvtype, recvbuff, sizeof(u32));
-               lbs_dev_dbg(1, &cardp->udev->dev,
+               lbs_deb_usbd(&cardp->udev->dev,
                            "Recv length = 0x%x\n", recvlength);
-               lbs_dev_dbg(1, &cardp->udev->dev,
+               lbs_deb_usbd(&cardp->udev->dev,
                            "Receive type = 0x%X\n", recvtype);
                recvtype = le32_to_cpu(recvtype);
-               lbs_dev_dbg(1, &cardp->udev->dev,
+               lbs_deb_usbd(&cardp->udev->dev,
                            "Receive type after = 0x%X\n", recvtype);
        } else if (urb->status)
                goto rx_exit;
@@ -621,18 +668,18 @@ static void if_usb_receive(struct urb *urb)
        case CMD_TYPE_INDICATION:
                /* Event cause handling */
                spin_lock(&priv->adapter->driver_lock);
-               cardp->usb_event_cause = *(u32 *) (recvbuff + MESSAGE_HEADER_LEN);
-               lbs_dev_dbg(1, &cardp->udev->dev,"**EVENT** 0x%X\n",
+               cardp->usb_event_cause = le32_to_cpu(*(__le32 *) (recvbuff + MESSAGE_HEADER_LEN));
+               lbs_deb_usbd(&cardp->udev->dev,"**EVENT** 0x%X\n",
                            cardp->usb_event_cause);
                if (cardp->usb_event_cause & 0xffff0000) {
                        libertas_send_tx_feedback(priv);
                        spin_unlock(&priv->adapter->driver_lock);
                        break;
                }
-               cardp->usb_event_cause = le32_to_cpu(cardp->usb_event_cause) << 3;
+               cardp->usb_event_cause <<= 3;
                cardp->usb_int_cause |= his_cardevent;
                kfree_skb(skb);
-               libertas_interrupt(priv->wlan_dev.netdev);
+               libertas_interrupt(priv->dev);
                spin_unlock(&priv->adapter->driver_lock);
                goto rx_exit;
        default:
@@ -643,8 +690,7 @@ static void if_usb_receive(struct urb *urb)
 setup_for_next:
        if_usb_submit_rx_urb(priv);
 rx_exit:
-       LEAVE();
-       return;
+       lbs_deb_leave(LBS_DEB_USB);
 }
 
 /**
@@ -655,24 +701,24 @@ rx_exit:
  *  @param len         number of bytes
  *  @return            0 or -1
  */
-int libertas_sbi_host_to_card(wlan_private * priv, u8 type, u8 * payload, u16 nb)
+static int if_usb_host_to_card(wlan_private * priv, u8 type, u8 * payload, u16 nb)
 {
        int ret = -1;
        u32 tmp;
-       struct usb_card_rec *cardp = (struct usb_card_rec *)priv->wlan_dev.card;
+       struct usb_card_rec *cardp = (struct usb_card_rec *)priv->card;
 
-       lbs_dev_dbg(1, &cardp->udev->dev,"*** type = %u\n", type);
-       lbs_dev_dbg(1, &cardp->udev->dev,"size after = %d\n", nb);
+       lbs_deb_usbd(&cardp->udev->dev,"*** type = %u\n", type);
+       lbs_deb_usbd(&cardp->udev->dev,"size after = %d\n", nb);
 
        if (type == MVMS_CMD) {
                tmp = cpu_to_le32(CMD_TYPE_REQUEST);
-               priv->wlan_dev.dnld_sent = DNLD_CMD_SENT;
+               priv->dnld_sent = DNLD_CMD_SENT;
                memcpy(cardp->bulk_out_buffer, (u8 *) & tmp,
                       MESSAGE_HEADER_LEN);
 
        } else {
                tmp = cpu_to_le32(CMD_TYPE_DATA);
-               priv->wlan_dev.dnld_sent = DNLD_DATA_SENT;
+               priv->dnld_sent = DNLD_DATA_SENT;
                memcpy(cardp->bulk_out_buffer, (u8 *) & tmp,
                       MESSAGE_HEADER_LEN);
        }
@@ -686,39 +732,41 @@ int libertas_sbi_host_to_card(wlan_private * priv, u8 type, u8 * payload, u16 nb
 }
 
 /* called with adapter->driver_lock held */
-int libertas_sbi_get_int_status(wlan_private * priv, u8 * ireg)
+static int if_usb_get_int_status(wlan_private * priv, u8 * ireg)
 {
-       struct usb_card_rec *cardp = priv->wlan_dev.card;
+       struct usb_card_rec *cardp = priv->card;
 
        *ireg = cardp->usb_int_cause;
        cardp->usb_int_cause = 0;
 
-       lbs_dev_dbg(1, &cardp->udev->dev,"Int cause is 0x%X\n", *ireg);
+       lbs_deb_usbd(&cardp->udev->dev,"Int cause is 0x%X\n", *ireg);
 
        return 0;
 }
 
-int libertas_sbi_read_event_cause(wlan_private * priv)
+static int if_usb_read_event_cause(wlan_private * priv)
 {
-       struct usb_card_rec *cardp = priv->wlan_dev.card;
+       struct usb_card_rec *cardp = priv->card;
        priv->adapter->eventcause = cardp->usb_event_cause;
        /* Re-submit rx urb here to avoid event lost issue */
        if_usb_submit_rx_urb(priv);
        return 0;
 }
 
-int reset_device(wlan_private *priv)
+static int if_usb_reset_device(wlan_private *priv)
 {
        int ret;
 
+       lbs_deb_enter(LBS_DEB_USB);
        ret = libertas_prepare_and_send_command(priv, cmd_802_11_reset,
                                    cmd_act_halt, 0, 0, NULL);
        msleep_interruptible(10);
 
+       lbs_deb_leave_args(LBS_DEB_USB, "ret %d", ret);
        return ret;
 }
 
-int libertas_sbi_unregister_dev(wlan_private * priv)
+static int if_usb_unregister_dev(wlan_private * priv)
 {
        int ret = 0;
 
@@ -727,7 +775,7 @@ int libertas_sbi_unregister_dev(wlan_private * priv)
         * again.
         */
        if (priv)
-               reset_device(priv);
+               if_usb_reset_device(priv);
 
        return ret;
 }
@@ -738,42 +786,41 @@ int libertas_sbi_unregister_dev(wlan_private * priv)
  *  @param             priv pointer to wlan_private
  *  @return            0 or -1
  */
-int libertas_sbi_register_dev(wlan_private * priv)
+static int if_usb_register_dev(wlan_private * priv)
 {
+       struct usb_card_rec *cardp = (struct usb_card_rec *)priv->card;
 
-       struct usb_card_rec *cardp = (struct usb_card_rec *)priv->wlan_dev.card;
-       ENTER();
+       lbs_deb_enter(LBS_DEB_USB);
 
        cardp->priv = priv;
-       cardp->eth_dev = priv->wlan_dev.netdev;
+       cardp->eth_dev = priv->dev;
        priv->hotplug_device = &(cardp->udev->dev);
 
-       SET_NETDEV_DEV(cardp->eth_dev, &(cardp->udev->dev));
-
-       lbs_dev_dbg(1, &cardp->udev->dev, "udev pointer is at %p\n",
+       lbs_deb_usbd(&cardp->udev->dev, "udev pointer is at %p\n",
                    cardp->udev);
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_USB);
        return 0;
 }
 
 
 
-int libertas_sbi_prog_firmware(wlan_private * priv)
+static int if_usb_prog_firmware(wlan_private * priv)
 {
-       struct usb_card_rec *cardp = priv->wlan_dev.card;
+       struct usb_card_rec *cardp = priv->card;
        int i = 0;
        static int reset_count = 10;
+       int ret = 0;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_USB);
 
        cardp->rinfo.priv = priv;
 
 restart:
        if (if_usb_submit_rx_urb_fwload(priv) < 0) {
-               lbs_dev_dbg(1, &cardp->udev->dev, "URB submission is failed\n");
-               LEAVE();
-               return -1;
+               lbs_deb_usbd(&cardp->udev->dev, "URB submission is failed\n");
+               ret = -1;
+               goto done;
        }
 
        cardp->bootcmdresp = 0;
@@ -811,7 +858,7 @@ restart:
        if_prog_firmware(priv);
 
        do {
-               lbs_dev_dbg(1, &cardp->udev->dev,"Wlan sched timeout\n");
+               lbs_deb_usbd(&cardp->udev->dev,"Wlan sched timeout\n");
                i++;
                msleep_interruptible(100);
                if (priv->adapter->surpriseremoved || i >= 20)
@@ -826,8 +873,8 @@ restart:
                }
 
                lbs_pr_info("FW download failure, time = %d ms\n", i * 100);
-               LEAVE();
-               return -1;
+               ret = -1;
+               goto done;
        }
 
        if_usb_submit_rx_urb(priv);
@@ -837,32 +884,10 @@ restart:
 
        priv->adapter->fw_ready = 1;
 
-       LEAVE();
-       return 0;
-}
-
-/**
- *  @brief Given a usb_card_rec return its wlan_private
- *  @param card                pointer to a usb_card_rec
- *  @return            pointer to wlan_private
- */
-wlan_private *libertas_sbi_get_priv(void *card)
-{
-       struct usb_card_rec *cardp = card;
-       return cardp->priv;
-}
-
-#ifdef ENABLE_PM
-int libertas_sbi_suspend(wlan_private * priv)
-{
-       return 0;
-}
-
-int libertas_sbi_resume(wlan_private * priv)
-{
-       return 0;
+done:
+       lbs_deb_leave_args(LBS_DEB_USB, "ret %d", ret);
+       return ret;
 }
-#endif
 
 #ifdef CONFIG_PM
 static int if_usb_suspend(struct usb_interface *intf, pm_message_t message)
@@ -870,12 +895,13 @@ static int if_usb_suspend(struct usb_interface *intf, pm_message_t message)
        struct usb_card_rec *cardp = usb_get_intfdata(intf);
        wlan_private *priv = cardp->priv;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_USB);
 
        if (priv->adapter->psstate != PS_STATE_FULL_POWER)
                return -1;
 
        netif_device_detach(cardp->eth_dev);
+       netif_device_detach(priv->mesh_dev);
 
        /* Unlink tx & rx urb */
        usb_kill_urb(cardp->tx_urb);
@@ -883,23 +909,25 @@ static int if_usb_suspend(struct usb_interface *intf, pm_message_t message)
 
        cardp->rx_urb_recall = 1;
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_USB);
        return 0;
 }
 
 static int if_usb_resume(struct usb_interface *intf)
 {
        struct usb_card_rec *cardp = usb_get_intfdata(intf);
+       wlan_private *priv = cardp->priv;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_USB);
 
        cardp->rx_urb_recall = 0;
 
        if_usb_submit_rx_urb(cardp->priv);
 
        netif_device_attach(cardp->eth_dev);
+       netif_device_attach(priv->mesh_dev);
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_USB);
        return 0;
 }
 #else
@@ -920,32 +948,40 @@ static struct usb_driver if_usb_driver = {
        .resume = if_usb_resume,
 };
 
-/**
- *  @brief This function registers driver.
- *  @param add         pointer to add_card callback function
- *  @param remove      pointer to remove card callback function
- *  @param arg         pointer to call back function parameter
- *  @return            dummy success variable
- */
-int libertas_sbi_register(void)
+static int if_usb_init_module(void)
 {
-       /*
-        * API registers the Marvell USB driver
-        * to the USB system
-        */
-       usb_register(&if_usb_driver);
+       int ret = 0;
 
-       /* Return success to wlan layer */
-       return 0;
+       lbs_deb_enter(LBS_DEB_MAIN);
+
+       if (libertas_fw_name == NULL) {
+               libertas_fw_name = default_fw_name;
+       }
+
+       ret = usb_register(&if_usb_driver);
+
+       lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret);
+       return ret;
 }
 
-/**
- *  @brief This function removes usb driver.
- *  @return            N/A
- */
-void libertas_sbi_unregister(void)
+static void if_usb_exit_module(void)
 {
+       struct usb_card_rec *cardp, *cardp_temp;
+
+       lbs_deb_enter(LBS_DEB_MAIN);
+
+       list_for_each_entry_safe(cardp, cardp_temp, &usb_devices, list)
+               if_usb_reset_device((wlan_private *) cardp->priv);
+
        /* API unregisters the driver from USB subsystem */
        usb_deregister(&if_usb_driver);
-       return;
+
+       lbs_deb_leave(LBS_DEB_MAIN);
 }
+
+module_init(if_usb_init_module);
+module_exit(if_usb_exit_module);
+
+MODULE_DESCRIPTION("8388 USB WLAN Driver");
+MODULE_AUTHOR("Marvell International Ltd.");
+MODULE_LICENSE("GPL");
index 170dfe6809f5eb1cd9e4ff552dc6edad0651188d..156bb485e1a6f9929ec0b668815bc54c0974471a 100644 (file)
@@ -1,3 +1,8 @@
+#ifndef _LIBERTAS_IF_USB_H
+#define _LIBERTAS_IF_USB_H
+
+#include <linux/list.h>
+
 /**
   * This file contains definition for USB interface.
   */
@@ -7,11 +12,6 @@
 
 #define IPFIELD_ALIGN_OFFSET   2
 
-#define USB8388_VID_1  0x1286
-#define USB8388_PID_1  0x2001
-#define USB8388_VID_2  0x05a3
-#define USB8388_PID_2  0x8388
-
 #define BOOT_CMD_FW_BY_USB     0x01
 #define BOOT_CMD_FW_IN_EEPROM  0x02
 #define BOOT_CMD_UPDATE_BOOT2  0x03
@@ -20,7 +20,7 @@
 
 struct bootcmdstr
 {
-       u32 u32magicnumber;
+       __le32 u32magicnumber;
        u8  u8cmd_tag;
        u8  au8dumy[11];
 };
@@ -30,7 +30,7 @@ struct bootcmdstr
 
 struct bootcmdrespStr
 {
-       u32 u32magicnumber;
+       __le32 u32magicnumber;
        u8  u8cmd_tag;
        u8  u8result;
        u8  au8dumy[2];
@@ -44,6 +44,7 @@ struct read_cb_info {
 
 /** USB card description structure*/
 struct usb_card_rec {
+       struct list_head list;
        struct net_device *eth_dev;
        struct usb_device *udev;
        struct urb *rx_urb, *tx_urb;
@@ -75,33 +76,34 @@ struct usb_card_rec {
 
 /** fwheader */
 struct fwheader {
-       u32 dnldcmd;
-       u32 baseaddr;
-       u32 datalength;
-       u32 CRC;
+       __le32 dnldcmd;
+       __le32 baseaddr;
+       __le32 datalength;
+       __le32 CRC;
 };
 
 #define FW_MAX_DATA_BLK_SIZE   600
 /** FWData */
 struct FWData {
        struct fwheader fwheader;
-       u32 seqnum;
+       __le32 seqnum;
        u8 data[FW_MAX_DATA_BLK_SIZE];
 };
 
 /** fwsyncheader */
 struct fwsyncheader {
-       u32 cmd;
-       u32 seqnum;
+       __le32 cmd;
+       __le32 seqnum;
 };
 
 #define FW_HAS_DATA_TO_RECV            0x00000001
 #define FW_HAS_LAST_BLOCK              0x00000004
 
 #define FW_DATA_XMIT_SIZE \
-       sizeof(struct fwheader) + fwdata->fwheader.datalength + sizeof(u32)
+       sizeof(struct fwheader) + le32_to_cpu(fwdata->fwheader.datalength) + sizeof(u32)
 
 int usb_tx_block(wlan_private *priv, u8 *payload, u16 nb);
 void if_usb_free(struct usb_card_rec *cardp);
 int if_usb_issue_boot_command(wlan_private *priv, int ivalue);
 
+#endif
index a8f76c35899240837ba6aadb47f696a14a52d7b2..f41081585564eb65ba9dd9e6138c36fc85f92695 100644 (file)
@@ -30,6 +30,7 @@
 static int wlan_set_region(wlan_private * priv, u16 region_code)
 {
        int i;
+       int ret = 0;
 
        for (i = 0; i < MRVDRV_MAX_REGION_CODE; i++) {
                // use the region code to search for the index
@@ -42,17 +43,18 @@ static int wlan_set_region(wlan_private * priv, u16 region_code)
 
        // if it's unidentified region code
        if (i >= MRVDRV_MAX_REGION_CODE) {
-               lbs_pr_debug(1, "region Code not identified\n");
-               LEAVE();
-               return -1;
+               lbs_deb_ioctl("region Code not identified\n");
+               ret = -1;
+               goto done;
        }
 
        if (libertas_set_regiontable(priv, priv->adapter->regioncode, 0)) {
-               LEAVE();
-               return -EINVAL;
+               ret = -EINVAL;
        }
 
-       return 0;
+done:
+       lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
+       return ret;
 }
 
 static inline int hex2int(char c)
@@ -125,8 +127,10 @@ static int wlan_bt_add_ioctl(wlan_private * priv, struct ifreq *req)
        char ethaddrs_str[18];
        char *pos;
        u8 ethaddr[ETH_ALEN];
+       int ret;
+
+       lbs_deb_enter(LBS_DEB_IOCTL);
 
-       ENTER();
        if (copy_from_user(ethaddrs_str, wrq->u.data.pointer,
                           sizeof(ethaddrs_str)))
                return -EFAULT;
@@ -136,11 +140,12 @@ static int wlan_bt_add_ioctl(wlan_private * priv, struct ifreq *req)
                return -EINVAL;
        }
 
-       lbs_pr_debug(1, "BT: adding %s\n", ethaddrs_str);
-       LEAVE();
-       return (libertas_prepare_and_send_command(priv, cmd_bt_access,
+       lbs_deb_ioctl("BT: adding %s\n", ethaddrs_str);
+       ret = libertas_prepare_and_send_command(priv, cmd_bt_access,
                                      cmd_act_bt_access_add,
-                                     cmd_option_waitforrsp, 0, ethaddr));
+                                     cmd_option_waitforrsp, 0, ethaddr);
+       lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
+       return ret;
 }
 
 /**
@@ -156,7 +161,8 @@ static int wlan_bt_del_ioctl(wlan_private * priv, struct ifreq *req)
        u8 ethaddr[ETH_ALEN];
        char *pos;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_IOCTL);
+
        if (copy_from_user(ethaddrs_str, wrq->u.data.pointer,
                           sizeof(ethaddrs_str)))
                return -EFAULT;
@@ -166,13 +172,14 @@ static int wlan_bt_del_ioctl(wlan_private * priv, struct ifreq *req)
                return -EINVAL;
        }
 
-       lbs_pr_debug(1, "BT: deleting %s\n", ethaddrs_str);
+       lbs_deb_ioctl("BT: deleting %s\n", ethaddrs_str);
 
        return (libertas_prepare_and_send_command(priv,
                                      cmd_bt_access,
                                      cmd_act_bt_access_del,
                                      cmd_option_waitforrsp, 0, ethaddr));
-       LEAVE();
+
+       lbs_deb_leave(LBS_DEB_IOCTL);
        return 0;
 }
 
@@ -183,7 +190,7 @@ static int wlan_bt_del_ioctl(wlan_private * priv, struct ifreq *req)
  */
 static int wlan_bt_reset_ioctl(wlan_private * priv)
 {
-       ENTER();
+       lbs_deb_enter(LBS_DEB_IOCTL);
 
        lbs_pr_alert( "BT: resetting\n");
 
@@ -192,7 +199,7 @@ static int wlan_bt_reset_ioctl(wlan_private * priv)
                                      cmd_act_bt_access_reset,
                                      cmd_option_waitforrsp, 0, NULL));
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_IOCTL);
        return 0;
 }
 
@@ -209,17 +216,17 @@ static int wlan_bt_list_ioctl(wlan_private * priv, struct ifreq *req)
        struct iwreq *wrq = (struct iwreq *)req;
        /* used to pass id and store the bt entry returned by the FW */
        union {
-               int id;
+               u32 id;
                char addr1addr2[2 * ETH_ALEN];
        } param;
        static char outstr[64];
        char *pbuf = outstr;
        int ret;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_IOCTL);
 
        if (copy_from_user(outstr, wrq->u.data.pointer, sizeof(outstr))) {
-               lbs_pr_debug(1, "Copy from user failed\n");
+               lbs_deb_ioctl("Copy from user failed\n");
                return -1;
        }
        param.id = simple_strtoul(outstr, NULL, 10);
@@ -234,7 +241,7 @@ static int wlan_bt_list_ioctl(wlan_private * priv, struct ifreq *req)
        if (ret == 0) {
                addr1 = param.addr1addr2;
 
-               pos = sprintf(pbuf, "ignoring traffic from ");
+               pos = sprintf(pbuf, "BT includes node ");
                pbuf += pos;
                pos = eth_addr2str(addr1, pbuf);
                pbuf += pos;
@@ -246,11 +253,70 @@ static int wlan_bt_list_ioctl(wlan_private * priv, struct ifreq *req)
        wrq->u.data.length = strlen(outstr);
        if (copy_to_user(wrq->u.data.pointer, (char *)outstr,
                         wrq->u.data.length)) {
-               lbs_pr_debug(1, "BT_LIST: Copy to user failed!\n");
+               lbs_deb_ioctl("BT_LIST: Copy to user failed!\n");
                return -EFAULT;
        }
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_IOCTL);
+       return 0 ;
+}
+
+/**
+ *  @brief          Sets inverted state of blacklist (non-zero if inverted)
+ *  @param priv     A pointer to wlan_private structure
+ *  @param req      A pointer to ifreq structure
+ *  @return         0 --success, otherwise fail
+ */
+static int wlan_bt_set_invert_ioctl(wlan_private * priv, struct ifreq *req)
+{
+       int ret;
+       struct iwreq *wrq = (struct iwreq *)req;
+       union {
+               u32 id;
+               char addr1addr2[2 * ETH_ALEN];
+       } param;
+
+       lbs_deb_enter(LBS_DEB_IOCTL);
+
+       param.id = SUBCMD_DATA(wrq) ;
+       ret = libertas_prepare_and_send_command(priv, cmd_bt_access,
+                                   cmd_act_bt_access_set_invert,
+                                   cmd_option_waitforrsp, 0,
+                                   (char *)&param);
+       if (ret != 0)
+               return -EFAULT;
+       lbs_deb_leave(LBS_DEB_IOCTL);
+       return 0;
+}
+
+/**
+ *  @brief          Gets inverted state of blacklist (non-zero if inverted)
+ *  @param priv     A pointer to wlan_private structure
+ *  @param req      A pointer to ifreq structure
+ *  @return         0 --success, otherwise fail
+ */
+static int wlan_bt_get_invert_ioctl(wlan_private * priv, struct ifreq *req)
+{
+       struct iwreq *wrq = (struct iwreq *)req;
+       int ret;
+       union {
+               u32 id;
+               char addr1addr2[2 * ETH_ALEN];
+       } param;
+
+       lbs_deb_enter(LBS_DEB_IOCTL);
+
+       ret = libertas_prepare_and_send_command(priv, cmd_bt_access,
+                                   cmd_act_bt_access_get_invert,
+                                   cmd_option_waitforrsp, 0,
+                                   (char *)&param);
+
+       if (ret == 0)
+               wrq->u.param.value = le32_to_cpu(param.id);
+       else
+               return -EFAULT;
+
+       lbs_deb_leave(LBS_DEB_IOCTL);
        return 0;
 }
 
@@ -278,8 +344,10 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req)
        char in_str[128];
        static struct cmd_ds_fwt_access fwt_access;
        char *ptr;
+       int ret;
+
+       lbs_deb_enter(LBS_DEB_IOCTL);
 
-       ENTER();
        if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
                return -EFAULT;
 
@@ -297,24 +365,29 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req)
                fwt_access.metric =
                        cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
        else
-               fwt_access.metric = FWT_DEFAULT_METRIC;
+               fwt_access.metric = cpu_to_le32(FWT_DEFAULT_METRIC);
 
        if ((ptr = next_param(ptr)))
                fwt_access.dir = (u8)simple_strtoul(ptr, &ptr, 10);
        else
                fwt_access.dir = FWT_DEFAULT_DIR;
 
+       if ((ptr = next_param(ptr)))
+               fwt_access.rate = (u8) simple_strtoul(ptr, &ptr, 10);
+       else
+               fwt_access.rate = FWT_DEFAULT_RATE;
+
        if ((ptr = next_param(ptr)))
                fwt_access.ssn =
                        cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
        else
-               fwt_access.ssn = FWT_DEFAULT_SSN;
+               fwt_access.ssn = cpu_to_le32(FWT_DEFAULT_SSN);
 
        if ((ptr = next_param(ptr)))
                fwt_access.dsn =
                        cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
        else
-               fwt_access.dsn = FWT_DEFAULT_DSN;
+               fwt_access.dsn = cpu_to_le32(FWT_DEFAULT_DSN);
 
        if ((ptr = next_param(ptr)))
                fwt_access.hopcount = simple_strtoul(ptr, &ptr, 10);
@@ -330,7 +403,7 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req)
                fwt_access.expiration =
                        cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
        else
-               fwt_access.expiration = FWT_DEFAULT_EXPIRATION;
+               fwt_access.expiration = cpu_to_le32(FWT_DEFAULT_EXPIRATION);
 
        if ((ptr = next_param(ptr)))
                fwt_access.sleepmode = (u8)simple_strtoul(ptr, &ptr, 10);
@@ -341,27 +414,29 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req)
                fwt_access.snr =
                        cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
        else
-               fwt_access.snr = FWT_DEFAULT_SNR;
+               fwt_access.snr = cpu_to_le32(FWT_DEFAULT_SNR);
 
 #ifdef DEBUG
        {
                char ethaddr1_str[18], ethaddr2_str[18];
                eth_addr2str(fwt_access.da, ethaddr1_str);
                eth_addr2str(fwt_access.ra, ethaddr2_str);
-               lbs_pr_debug(1, "FWT_ADD: adding (da:%s,%i,ra:%s)\n", ethaddr1_str,
+               lbs_deb_ioctl("FWT_ADD: adding (da:%s,%i,ra:%s)\n", ethaddr1_str,
                       fwt_access.dir, ethaddr2_str);
-               lbs_pr_debug(1, "FWT_ADD: ssn:%u dsn:%u met:%u hop:%u ttl:%u exp:%u slp:%u snr:%u\n",
+               lbs_deb_ioctl("FWT_ADD: ssn:%u dsn:%u met:%u hop:%u ttl:%u exp:%u slp:%u snr:%u\n",
                       fwt_access.ssn, fwt_access.dsn, fwt_access.metric,
                       fwt_access.hopcount, fwt_access.ttl, fwt_access.expiration,
                       fwt_access.sleepmode, fwt_access.snr);
        }
 #endif
 
-       LEAVE();
-       return (libertas_prepare_and_send_command(priv, cmd_fwt_access,
-                                                 cmd_act_fwt_access_add,
-                                                 cmd_option_waitforrsp, 0,
-                                                 (void *)&fwt_access));
+       ret = libertas_prepare_and_send_command(priv, cmd_fwt_access,
+                                               cmd_act_fwt_access_add,
+                                               cmd_option_waitforrsp, 0,
+                                               (void *)&fwt_access);
+
+       lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
+       return ret;
 }
 
 /**
@@ -376,8 +451,10 @@ static int wlan_fwt_del_ioctl(wlan_private * priv, struct ifreq *req)
        char in_str[64];
        static struct cmd_ds_fwt_access fwt_access;
        char *ptr;
+       int ret;
+
+       lbs_deb_enter(LBS_DEB_IOCTL);
 
-       ENTER();
        if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
                return -EFAULT;
 
@@ -399,20 +476,21 @@ static int wlan_fwt_del_ioctl(wlan_private * priv, struct ifreq *req)
 #ifdef DEBUG
        {
                char ethaddr1_str[18], ethaddr2_str[18];
-               lbs_pr_debug(1, "FWT_DEL: line is %s\n", in_str);
+               lbs_deb_ioctl("FWT_DEL: line is %s\n", in_str);
                eth_addr2str(fwt_access.da, ethaddr1_str);
                eth_addr2str(fwt_access.ra, ethaddr2_str);
-               lbs_pr_debug(1, "FWT_DEL: removing (da:%s,ra:%s,dir:%d)\n", ethaddr1_str,
+               lbs_deb_ioctl("FWT_DEL: removing (da:%s,ra:%s,dir:%d)\n", ethaddr1_str,
                       ethaddr2_str, fwt_access.dir);
        }
 #endif
 
-       LEAVE();
-       return (libertas_prepare_and_send_command(priv,
-                                                 cmd_fwt_access,
-                                                 cmd_act_fwt_access_del,
-                                                 cmd_option_waitforrsp, 0,
-                                                 (void *)&fwt_access));
+       ret = libertas_prepare_and_send_command(priv,
+                                               cmd_fwt_access,
+                                               cmd_act_fwt_access_del,
+                                               cmd_option_waitforrsp, 0,
+                                               (void *)&fwt_access);
+       lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
+       return ret;
 }
 
 
@@ -427,15 +505,18 @@ static void print_route(struct cmd_ds_fwt_access fwt_access, char *buf)
        buf += eth_addr2str(fwt_access.da, buf);
        buf += sprintf(buf, " ");
        buf += eth_addr2str(fwt_access.ra, buf);
+       buf += sprintf(buf, " %u", fwt_access.valid);
        buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.metric));
        buf += sprintf(buf, " %u", fwt_access.dir);
+       buf += sprintf(buf, " %u", fwt_access.rate);
        buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.ssn));
        buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.dsn));
        buf += sprintf(buf, " %u", fwt_access.hopcount);
        buf += sprintf(buf, " %u", fwt_access.ttl);
        buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.expiration));
        buf += sprintf(buf, " %u", fwt_access.sleepmode);
-       buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.snr));
+       buf += sprintf(buf, " %u ", le32_to_cpu(fwt_access.snr));
+       buf += eth_addr2str(fwt_access.prec, buf);
 }
 
 /**
@@ -453,7 +534,8 @@ static int wlan_fwt_lookup_ioctl(wlan_private * priv, struct ifreq *req)
        static char out_str[128];
        int ret;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_IOCTL);
+
        if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
                return -EFAULT;
 
@@ -465,9 +547,9 @@ static int wlan_fwt_lookup_ioctl(wlan_private * priv, struct ifreq *req)
 #ifdef DEBUG
        {
                char ethaddr1_str[18];
-               lbs_pr_debug(1, "FWT_LOOKUP: line is %s\n", in_str);
+               lbs_deb_ioctl("FWT_LOOKUP: line is %s\n", in_str);
                eth_addr2str(fwt_access.da, ethaddr1_str);
-               lbs_pr_debug(1, "FWT_LOOKUP: looking for (da:%s)\n", ethaddr1_str);
+               lbs_deb_ioctl("FWT_LOOKUP: looking for (da:%s)\n", ethaddr1_str);
        }
 #endif
 
@@ -485,11 +567,11 @@ static int wlan_fwt_lookup_ioctl(wlan_private * priv, struct ifreq *req)
        wrq->u.data.length = strlen(out_str);
        if (copy_to_user(wrq->u.data.pointer, (char *)out_str,
                         wrq->u.data.length)) {
-               lbs_pr_debug(1, "FWT_LOOKUP: Copy to user failed!\n");
+               lbs_deb_ioctl("FWT_LOOKUP: Copy to user failed!\n");
                return -EFAULT;
        }
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_IOCTL);
        return 0;
 }
 
@@ -500,7 +582,7 @@ static int wlan_fwt_lookup_ioctl(wlan_private * priv, struct ifreq *req)
  */
 static int wlan_fwt_reset_ioctl(wlan_private * priv)
 {
-       lbs_pr_debug(1, "FWT: resetting\n");
+       lbs_deb_ioctl("FWT: resetting\n");
 
        return (libertas_prepare_and_send_command(priv,
                                      cmd_fwt_access,
@@ -522,18 +604,21 @@ static int wlan_fwt_list_ioctl(wlan_private * priv, struct ifreq *req)
        char *ptr = in_str;
        static char out_str[128];
        char *pbuf = out_str;
-       int ret;
+       int ret = 0;
 
-       ENTER();
-       if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
-               return -EFAULT;
+       lbs_deb_enter(LBS_DEB_IOCTL);
+
+       if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) {
+               ret = -EFAULT;
+               goto out;
+       }
 
        fwt_access.id = cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
 
 #ifdef DEBUG
        {
-               lbs_pr_debug(1, "FWT_LIST: line is %s\n", in_str);
-               lbs_pr_debug(1, "FWT_LIST: listing id:%i\n", le32_to_cpu(fwt_access.id));
+               lbs_deb_ioctl("FWT_LIST: line is %s\n", in_str);
+               lbs_deb_ioctl("FWT_LIST: listing id:%i\n", le32_to_cpu(fwt_access.id));
        }
 #endif
 
@@ -549,12 +634,16 @@ static int wlan_fwt_list_ioctl(wlan_private * priv, struct ifreq *req)
        wrq->u.data.length = strlen(out_str);
        if (copy_to_user(wrq->u.data.pointer, (char *)out_str,
                         wrq->u.data.length)) {
-               lbs_pr_debug(1, "FWT_LIST: Copy to user failed!\n");
-               return -EFAULT;
+               lbs_deb_ioctl("FWT_LIST: Copy to user failed!\n");
+               ret = -EFAULT;
+               goto out;
        }
 
-       LEAVE();
-       return 0;
+       ret = 0;
+
+out:
+       lbs_deb_leave(LBS_DEB_IOCTL);
+       return ret;
 }
 
 /**
@@ -573,7 +662,8 @@ static int wlan_fwt_list_route_ioctl(wlan_private * priv, struct ifreq *req)
        char *pbuf = out_str;
        int ret;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_IOCTL);
+
        if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
                return -EFAULT;
 
@@ -581,8 +671,8 @@ static int wlan_fwt_list_route_ioctl(wlan_private * priv, struct ifreq *req)
 
 #ifdef DEBUG
        {
-               lbs_pr_debug(1, "FWT_LIST_ROUTE: line is %s\n", in_str);
-               lbs_pr_debug(1, "FWT_LIST_ROUTE: listing id:%i\n", le32_to_cpu(fwt_access.id));
+               lbs_deb_ioctl("FWT_LIST_ROUTE: line is %s\n", in_str);
+               lbs_deb_ioctl("FWT_LIST_ROUTE: listing id:%i\n", le32_to_cpu(fwt_access.id));
        }
 #endif
 
@@ -591,28 +681,18 @@ static int wlan_fwt_list_route_ioctl(wlan_private * priv, struct ifreq *req)
                                    cmd_option_waitforrsp, 0, (void *)&fwt_access);
 
        if (ret == 0) {
-               pbuf += sprintf(pbuf, " ");
-               pbuf += eth_addr2str(fwt_access.da, pbuf);
-               pbuf += sprintf(pbuf, " %u", le32_to_cpu(fwt_access.metric));
-               pbuf += sprintf(pbuf, " %u", fwt_access.dir);
-               /* note that the firmware returns the nid in the id field */
-               pbuf += sprintf(pbuf, " %u", le32_to_cpu(fwt_access.id));
-               pbuf += sprintf(pbuf, " %u", le32_to_cpu(fwt_access.ssn));
-               pbuf += sprintf(pbuf, " %u", le32_to_cpu(fwt_access.dsn));
-               pbuf += sprintf(pbuf, "  hop %u", fwt_access.hopcount);
-               pbuf += sprintf(pbuf, "  ttl %u", fwt_access.ttl);
-               pbuf += sprintf(pbuf, " %u", le32_to_cpu(fwt_access.expiration));
+               print_route(fwt_access, pbuf);
        } else
                pbuf += sprintf(pbuf, " (null)");
 
        wrq->u.data.length = strlen(out_str);
        if (copy_to_user(wrq->u.data.pointer, (char *)out_str,
                         wrq->u.data.length)) {
-               lbs_pr_debug(1, "FWT_LIST_ROUTE: Copy to user failed!\n");
+               lbs_deb_ioctl("FWT_LIST_ROUTE: Copy to user failed!\n");
                return -EFAULT;
        }
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_IOCTL);
        return 0;
 }
 
@@ -632,7 +712,8 @@ static int wlan_fwt_list_neighbor_ioctl(wlan_private * priv, struct ifreq *req)
        char *pbuf = out_str;
        int ret;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_IOCTL);
+
        if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
                return -EFAULT;
 
@@ -641,8 +722,8 @@ static int wlan_fwt_list_neighbor_ioctl(wlan_private * priv, struct ifreq *req)
 
 #ifdef DEBUG
        {
-               lbs_pr_debug(1, "FWT_LIST_NEIGHBOR: line is %s\n", in_str);
-               lbs_pr_debug(1, "FWT_LIST_NEIGHBOR: listing id:%i\n", le32_to_cpu(fwt_access.id));
+               lbs_deb_ioctl("FWT_LIST_NEIGHBOR: line is %s\n", in_str);
+               lbs_deb_ioctl("FWT_LIST_NEIGHBOR: listing id:%i\n", le32_to_cpu(fwt_access.id));
        }
 #endif
 
@@ -663,11 +744,11 @@ static int wlan_fwt_list_neighbor_ioctl(wlan_private * priv, struct ifreq *req)
        wrq->u.data.length = strlen(out_str);
        if (copy_to_user(wrq->u.data.pointer, (char *)out_str,
                         wrq->u.data.length)) {
-               lbs_pr_debug(1, "FWT_LIST_NEIGHBOR: Copy to user failed!\n");
+               lbs_deb_ioctl("FWT_LIST_NEIGHBOR: Copy to user failed!\n");
                return -EFAULT;
        }
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_IOCTL);
        return 0;
 }
 
@@ -684,9 +765,9 @@ static int wlan_fwt_cleanup_ioctl(wlan_private * priv, struct ifreq *req)
        static struct cmd_ds_fwt_access fwt_access;
        int ret;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_IOCTL);
 
-       lbs_pr_debug(1, "FWT: cleaning up\n");
+       lbs_deb_ioctl("FWT: cleaning up\n");
 
        memset(&fwt_access, 0, sizeof(fwt_access));
 
@@ -700,7 +781,7 @@ static int wlan_fwt_cleanup_ioctl(wlan_private * priv, struct ifreq *req)
        else
                return -EFAULT;
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_IOCTL);
        return 0;
 }
 
@@ -716,9 +797,9 @@ static int wlan_fwt_time_ioctl(wlan_private * priv, struct ifreq *req)
        static struct cmd_ds_fwt_access fwt_access;
        int ret;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_IOCTL);
 
-       lbs_pr_debug(1, "FWT: getting time\n");
+       lbs_deb_ioctl("FWT: getting time\n");
 
        memset(&fwt_access, 0, sizeof(fwt_access));
 
@@ -732,7 +813,7 @@ static int wlan_fwt_time_ioctl(wlan_private * priv, struct ifreq *req)
        else
                return -EFAULT;
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_IOCTL);
        return 0;
 }
 
@@ -748,7 +829,7 @@ static int wlan_mesh_get_ttl_ioctl(wlan_private * priv, struct ifreq *req)
        struct cmd_ds_mesh_access mesh_access;
        int ret;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_IOCTL);
 
        memset(&mesh_access, 0, sizeof(mesh_access));
 
@@ -762,7 +843,7 @@ static int wlan_mesh_get_ttl_ioctl(wlan_private * priv, struct ifreq *req)
        else
                return -EFAULT;
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_IOCTL);
        return 0;
 }
 
@@ -777,13 +858,13 @@ static int wlan_mesh_set_ttl_ioctl(wlan_private * priv, int ttl)
        struct cmd_ds_mesh_access mesh_access;
        int ret;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_IOCTL);
 
        if( (ttl > 0xff) || (ttl < 0) )
                return -EINVAL;
 
        memset(&mesh_access, 0, sizeof(mesh_access));
-       mesh_access.data[0] = ttl;
+       mesh_access.data[0] = cpu_to_le32(ttl);
 
        ret = libertas_prepare_and_send_command(priv, cmd_mesh_access,
                                                cmd_act_mesh_set_ttl,
@@ -793,7 +874,7 @@ static int wlan_mesh_set_ttl_ioctl(wlan_private * priv, int ttl)
        if (ret != 0)
                ret = -EFAULT;
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_IOCTL);
        return ret;
 }
 
@@ -815,9 +896,9 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
        wlan_adapter *adapter = priv->adapter;
        struct iwreq *wrq = (struct iwreq *)req;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_IOCTL);
 
-       lbs_pr_debug(1, "libertas_do_ioctl: ioctl cmd = 0x%x\n", cmd);
+       lbs_deb_ioctl("libertas_do_ioctl: ioctl cmd = 0x%x\n", cmd);
        switch (cmd) {
        case WLAN_SETNONE_GETNONE:      /* set WPA mode on/off ioctl #20 */
                switch (wrq->u.data.flags) {
@@ -848,6 +929,10 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
                        ret = wlan_mesh_set_ttl_ioctl(priv, idata);
                        break;
 
+               case WLAN_SUBCMD_BT_SET_INVERT:
+                       ret = wlan_bt_set_invert_ioctl(priv, req);
+                       break ;
+
                default:
                        ret = -EOPNOTSUPP;
                        break;
@@ -905,6 +990,10 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
                        ret = wlan_mesh_get_ttl_ioctl(priv, req);
                        break;
 
+               case WLAN_SUBCMD_BT_GET_INVERT:
+                       ret = wlan_bt_get_invert_ioctl(priv, req);
+                       break ;
+
                default:
                        ret = -EOPNOTSUPP;
 
@@ -937,7 +1026,7 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
                                            (data, wrq->u.data.pointer,
                                             sizeof(int) *
                                             wrq->u.data.length)) {
-                                               lbs_pr_debug(1,
+                                               lbs_deb_ioctl(
                                                       "Copy from user failed\n");
                                                return -EFAULT;
                                        }
@@ -970,7 +1059,7 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
                                if (copy_to_user(wrq->u.data.pointer, data,
                                                 sizeof(int) *
                                                 gpio->header.len)) {
-                                       lbs_pr_debug(1, "Copy to user failed\n");
+                                       lbs_deb_ioctl("Copy to user failed\n");
                                        return -EFAULT;
                                }
 
@@ -984,7 +1073,8 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
                ret = -EINVAL;
                break;
        }
-       LEAVE();
+
+       lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
        return ret;
 }
 
index d4926b83e14549fe5d1569473721a78b119c494d..78ac3064a0bd20d3852c1d1e7b530573df26aa9a 100644 (file)
@@ -7,6 +7,7 @@
 #include <linux/netdevice.h>
 #include <linux/if_arp.h>
 #include <linux/wireless.h>
+#include <linux/etherdevice.h>
 
 #include <net/iw_handler.h>
 
@@ -14,6 +15,7 @@
 #include "decl.h"
 #include "join.h"
 #include "dev.h"
+#include "assoc.h"
 
 #define AD_HOC_CAP_PRIVACY_ON 1
 
@@ -60,7 +62,7 @@ static int get_common_rates(wlan_adapter * adapter, u8 * rate1,
        lbs_dbg_hex("rate1 (AP) rates:", tmp, sizeof(tmp));
        lbs_dbg_hex("rate2 (Card) rates:", rate2, rate2_size);
        lbs_dbg_hex("Common rates:", ptr, rate1_size);
-       lbs_pr_debug(1, "Tx datarate is set to 0x%X\n", adapter->datarate);
+       lbs_deb_join("Tx datarate is set to 0x%X\n", adapter->datarate);
 
        if (!adapter->is_datarate_auto) {
                while (*ptr) {
@@ -104,24 +106,22 @@ int libertas_send_deauth(wlan_private * priv)
  *
  *  @return          0-success, otherwise fail
  */
-int wlan_associate(wlan_private * priv, struct bss_descriptor * pbssdesc)
+int wlan_associate(wlan_private * priv, struct assoc_request * assoc_req)
 {
        wlan_adapter *adapter = priv->adapter;
        int ret;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_JOIN);
 
        ret = libertas_prepare_and_send_command(priv, cmd_802_11_authenticate,
                                    0, cmd_option_waitforrsp,
-                                   0, pbssdesc->macaddress);
+                                   0, assoc_req->bss.bssid);
 
-       if (ret) {
-               LEAVE();
-               return ret;
-       }
+       if (ret)
+               goto done;
 
        /* set preamble to firmware */
-       if (adapter->capinfo.shortpreamble && pbssdesc->cap.shortpreamble)
+       if (adapter->capinfo.shortpreamble && assoc_req->bss.cap.shortpreamble)
                adapter->preamble = cmd_type_short_preamble;
        else
                adapter->preamble = cmd_type_long_preamble;
@@ -129,9 +129,10 @@ int wlan_associate(wlan_private * priv, struct bss_descriptor * pbssdesc)
        libertas_set_radio_control(priv);
 
        ret = libertas_prepare_and_send_command(priv, cmd_802_11_associate,
-                                   0, cmd_option_waitforrsp, 0, pbssdesc);
+                                   0, cmd_option_waitforrsp, 0, assoc_req);
 
-       LEAVE();
+done:
+       lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
        return ret;
 }
 
@@ -142,7 +143,7 @@ int wlan_associate(wlan_private * priv, struct bss_descriptor * pbssdesc)
  *  @param adhocssid    The ssid of the Adhoc Network
  *  @return             0--success, -1--fail
  */
-int libertas_start_adhoc_network(wlan_private * priv, struct WLAN_802_11_SSID *adhocssid)
+int libertas_start_adhoc_network(wlan_private * priv, struct assoc_request * assoc_req)
 {
        wlan_adapter *adapter = priv->adapter;
        int ret = 0;
@@ -150,22 +151,20 @@ int libertas_start_adhoc_network(wlan_private * priv, struct WLAN_802_11_SSID *a
        adapter->adhoccreate = 1;
 
        if (!adapter->capinfo.shortpreamble) {
-               lbs_pr_debug(1, "AdhocStart: Long preamble\n");
+               lbs_deb_join("AdhocStart: Long preamble\n");
                adapter->preamble = cmd_type_long_preamble;
        } else {
-               lbs_pr_debug(1, "AdhocStart: Short preamble\n");
+               lbs_deb_join("AdhocStart: Short preamble\n");
                adapter->preamble = cmd_type_short_preamble;
        }
 
        libertas_set_radio_control(priv);
 
-       lbs_pr_debug(1, "Adhoc channel = %d\n", adapter->adhocchannel);
-       lbs_pr_debug(1, "curbssparams.channel = %d\n",
-              adapter->curbssparams.channel);
-       lbs_pr_debug(1, "curbssparams.band = %d\n", adapter->curbssparams.band);
+       lbs_deb_join("AdhocStart: channel = %d\n", assoc_req->channel);
+       lbs_deb_join("AdhocStart: band = %d\n", assoc_req->band);
 
        ret = libertas_prepare_and_send_command(priv, cmd_802_11_ad_hoc_start,
-                                   0, cmd_option_waitforrsp, 0, adhocssid);
+                                   0, cmd_option_waitforrsp, 0, assoc_req);
 
        return ret;
 }
@@ -179,52 +178,53 @@ int libertas_start_adhoc_network(wlan_private * priv, struct WLAN_802_11_SSID *a
  *
  *  @return             0--success, -1--fail
  */
-int libertas_join_adhoc_network(wlan_private * priv, struct bss_descriptor * pbssdesc)
+int libertas_join_adhoc_network(wlan_private * priv, struct assoc_request * assoc_req)
 {
        wlan_adapter *adapter = priv->adapter;
+       struct bss_descriptor * bss = &assoc_req->bss;
        int ret = 0;
 
-       lbs_pr_debug(1, "libertas_join_adhoc_network: CurBss.ssid =%s\n",
-              adapter->curbssparams.ssid.ssid);
-       lbs_pr_debug(1, "libertas_join_adhoc_network: CurBss.ssid_len =%u\n",
-              adapter->curbssparams.ssid.ssidlength);
-       lbs_pr_debug(1, "libertas_join_adhoc_network: ssid =%s\n", pbssdesc->ssid.ssid);
-       lbs_pr_debug(1, "libertas_join_adhoc_network: ssid len =%u\n",
-              pbssdesc->ssid.ssidlength);
+       lbs_deb_join("%s: Current SSID '%s', ssid length %u\n",
+                    __func__,
+                    escape_essid(adapter->curbssparams.ssid,
+                                 adapter->curbssparams.ssid_len),
+                    adapter->curbssparams.ssid_len);
+       lbs_deb_join("%s: requested ssid '%s', ssid length %u\n",
+                    __func__, escape_essid(bss->ssid, bss->ssid_len),
+                    bss->ssid_len);
 
        /* check if the requested SSID is already joined */
-       if (adapter->curbssparams.ssid.ssidlength
-           && !libertas_SSID_cmp(&pbssdesc->ssid, &adapter->curbssparams.ssid)
+       if (adapter->curbssparams.ssid_len
+           && !libertas_ssid_cmp(adapter->curbssparams.ssid,
+                                 adapter->curbssparams.ssid_len,
+                                 bss->ssid, bss->ssid_len)
            && (adapter->mode == IW_MODE_ADHOC)) {
-
-        lbs_pr_debug(1,
+               lbs_deb_join(
                       "ADHOC_J_CMD: New ad-hoc SSID is the same as current, "
                       "not attempting to re-join");
-
                return -1;
        }
 
        /*Use shortpreamble only when both creator and card supports
           short preamble */
-       if (!pbssdesc->cap.shortpreamble || !adapter->capinfo.shortpreamble) {
-               lbs_pr_debug(1, "AdhocJoin: Long preamble\n");
+       if (!bss->cap.shortpreamble || !adapter->capinfo.shortpreamble) {
+               lbs_deb_join("AdhocJoin: Long preamble\n");
                adapter->preamble = cmd_type_long_preamble;
        } else {
-               lbs_pr_debug(1, "AdhocJoin: Short preamble\n");
+               lbs_deb_join("AdhocJoin: Short preamble\n");
                adapter->preamble = cmd_type_short_preamble;
        }
 
        libertas_set_radio_control(priv);
 
-       lbs_pr_debug(1, "curbssparams.channel = %d\n",
-              adapter->curbssparams.channel);
-       lbs_pr_debug(1, "curbssparams.band = %c\n", adapter->curbssparams.band);
+       lbs_deb_join("AdhocJoin: channel = %d\n", assoc_req->channel);
+       lbs_deb_join("AdhocJoin: band = %c\n", assoc_req->band);
 
        adapter->adhoccreate = 0;
 
        ret = libertas_prepare_and_send_command(priv, cmd_802_11_ad_hoc_join,
                                    0, cmd_option_waitforrsp,
-                                   OID_802_11_SSID, pbssdesc);
+                                   OID_802_11_SSID, assoc_req);
 
        return ret;
 }
@@ -265,6 +265,8 @@ int libertas_cmd_80211_authenticate(wlan_private * priv,
        int ret = -1;
        u8 *bssid = pdata_buf;
 
+       lbs_deb_enter(LBS_DEB_JOIN);
+
        cmd->command = cpu_to_le16(cmd_802_11_authenticate);
        cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_authenticate)
                                + S_DS_GEN);
@@ -281,18 +283,19 @@ int libertas_cmd_80211_authenticate(wlan_private * priv,
                pauthenticate->authtype = 0x80;
                break;
        default:
-               lbs_pr_debug(1, "AUTH_CMD: invalid auth alg 0x%X\n",
+               lbs_deb_join("AUTH_CMD: invalid auth alg 0x%X\n",
                             adapter->secinfo.auth_mode);
                goto out;
        }
 
        memcpy(pauthenticate->macaddr, bssid, ETH_ALEN);
 
-       lbs_pr_debug(1, "AUTH_CMD: Bssid is : %x:%x:%x:%x:%x:%x\n",
-              bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], bssid[5]);
+       lbs_deb_join("AUTH_CMD: BSSID is : " MAC_FMT " auth=0x%X\n",
+                    MAC_ARG(bssid), pauthenticate->authtype);
        ret = 0;
 
 out:
+       lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
        return ret;
 }
 
@@ -302,22 +305,20 @@ int libertas_cmd_80211_deauthenticate(wlan_private * priv,
        wlan_adapter *adapter = priv->adapter;
        struct cmd_ds_802_11_deauthenticate *dauth = &cmd->params.deauth;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_JOIN);
 
        cmd->command = cpu_to_le16(cmd_802_11_deauthenticate);
-       cmd->size =
-           cpu_to_le16(sizeof(struct cmd_ds_802_11_deauthenticate) +
+       cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_deauthenticate) +
                             S_DS_GEN);
 
        /* set AP MAC address */
-       memmove(dauth->macaddr, adapter->curbssparams.bssid,
-               ETH_ALEN);
+       memmove(dauth->macaddr, adapter->curbssparams.bssid, ETH_ALEN);
 
        /* Reason code 3 = Station is leaving */
 #define REASON_CODE_STA_LEAVING 3
        dauth->reasoncode = cpu_to_le16(REASON_CODE_STA_LEAVING);
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_JOIN);
        return 0;
 }
 
@@ -327,20 +328,20 @@ int libertas_cmd_80211_associate(wlan_private * priv,
        wlan_adapter *adapter = priv->adapter;
        struct cmd_ds_802_11_associate *passo = &cmd->params.associate;
        int ret = 0;
-       struct bss_descriptor *pbssdesc;
+       struct assoc_request * assoc_req = pdata_buf;
+       struct bss_descriptor * bss = &assoc_req->bss;
        u8 *card_rates;
        u8 *pos;
        int card_rates_size;
-       u16 tmpcap;
+       u16 tmpcap, tmplen;
        struct mrvlietypes_ssidparamset *ssid;
        struct mrvlietypes_phyparamset *phy;
        struct mrvlietypes_ssparamset *ss;
        struct mrvlietypes_ratesparamset *rates;
        struct mrvlietypes_rsnparamset *rsn;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_JOIN);
 
-       pbssdesc = pdata_buf;
        pos = (u8 *) passo;
 
        if (!adapter) {
@@ -350,15 +351,11 @@ int libertas_cmd_80211_associate(wlan_private * priv,
 
        cmd->command = cpu_to_le16(cmd_802_11_associate);
 
-       /* Save so we know which BSS Desc to use in the response handler */
-       adapter->pattemptedbssdesc = pbssdesc;
-
-       memcpy(passo->peerstaaddr,
-              pbssdesc->macaddress, sizeof(passo->peerstaaddr));
+       memcpy(passo->peerstaaddr, bss->bssid, sizeof(passo->peerstaaddr));
        pos += sizeof(passo->peerstaaddr);
 
        /* set the listen interval */
-       passo->listeninterval = adapter->listeninterval;
+       passo->listeninterval = cpu_to_le16(adapter->listeninterval);
 
        pos += sizeof(passo->capinfo);
        pos += sizeof(passo->listeninterval);
@@ -367,30 +364,30 @@ int libertas_cmd_80211_associate(wlan_private * priv,
 
        ssid = (struct mrvlietypes_ssidparamset *) pos;
        ssid->header.type = cpu_to_le16(TLV_TYPE_SSID);
-       ssid->header.len = pbssdesc->ssid.ssidlength;
-       memcpy(ssid->ssid, pbssdesc->ssid.ssid, ssid->header.len);
-       pos += sizeof(ssid->header) + ssid->header.len;
-       ssid->header.len = cpu_to_le16(ssid->header.len);
+       tmplen = bss->ssid_len;
+       ssid->header.len = cpu_to_le16(tmplen);
+       memcpy(ssid->ssid, bss->ssid, tmplen);
+       pos += sizeof(ssid->header) + tmplen;
 
        phy = (struct mrvlietypes_phyparamset *) pos;
        phy->header.type = cpu_to_le16(TLV_TYPE_PHY_DS);
-       phy->header.len = sizeof(phy->fh_ds.dsparamset);
+       tmplen = sizeof(phy->fh_ds.dsparamset);
+       phy->header.len = cpu_to_le16(tmplen);
        memcpy(&phy->fh_ds.dsparamset,
-              &pbssdesc->phyparamset.dsparamset.currentchan,
-              sizeof(phy->fh_ds.dsparamset));
-       pos += sizeof(phy->header) + phy->header.len;
-       phy->header.len = cpu_to_le16(phy->header.len);
+              &bss->phyparamset.dsparamset.currentchan,
+              tmplen);
+       pos += sizeof(phy->header) + tmplen;
 
        ss = (struct mrvlietypes_ssparamset *) pos;
        ss->header.type = cpu_to_le16(TLV_TYPE_CF);
-       ss->header.len = sizeof(ss->cf_ibss.cfparamset);
-       pos += sizeof(ss->header) + ss->header.len;
-       ss->header.len = cpu_to_le16(ss->header.len);
+       tmplen = sizeof(ss->cf_ibss.cfparamset);
+       ss->header.len = cpu_to_le16(tmplen);
+       pos += sizeof(ss->header) + tmplen;
 
        rates = (struct mrvlietypes_ratesparamset *) pos;
        rates->header.type = cpu_to_le16(TLV_TYPE_RATES);
 
-       memcpy(&rates->rates, &pbssdesc->libertas_supported_rates, WLAN_SUPPORTED_RATES);
+       memcpy(&rates->rates, &bss->libertas_supported_rates, WLAN_SUPPORTED_RATES);
 
        card_rates = libertas_supported_rates;
        card_rates_size = sizeof(libertas_supported_rates);
@@ -401,41 +398,42 @@ int libertas_cmd_80211_associate(wlan_private * priv,
                goto done;
        }
 
-       rates->header.len = min_t(size_t, strlen(rates->rates), WLAN_SUPPORTED_RATES);
-       adapter->curbssparams.numofrates = rates->header.len;
+       tmplen = min_t(size_t, strlen(rates->rates), WLAN_SUPPORTED_RATES);
+       adapter->curbssparams.numofrates = tmplen;
 
-       pos += sizeof(rates->header) + rates->header.len;
-       rates->header.len = cpu_to_le16(rates->header.len);
+       pos += sizeof(rates->header) + tmplen;
+       rates->header.len = cpu_to_le16(tmplen);
 
-       if (adapter->secinfo.WPAenabled || adapter->secinfo.WPA2enabled) {
+       if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) {
                rsn = (struct mrvlietypes_rsnparamset *) pos;
-               rsn->header.type = (u16) adapter->wpa_ie[0];    /* WPA_IE or WPA2_IE */
-               rsn->header.type = cpu_to_le16(rsn->header.type);
-               rsn->header.len = (u16) adapter->wpa_ie[1];
-               memcpy(rsn->rsnie, &adapter->wpa_ie[2], rsn->header.len);
+               /* WPA_IE or WPA2_IE */
+               rsn->header.type = cpu_to_le16((u16) assoc_req->wpa_ie[0]);
+               tmplen = (u16) assoc_req->wpa_ie[1];
+               rsn->header.len = cpu_to_le16(tmplen);
+               memcpy(rsn->rsnie, &assoc_req->wpa_ie[2], tmplen);
                lbs_dbg_hex("ASSOC_CMD: RSN IE", (u8 *) rsn,
-                       sizeof(rsn->header) + rsn->header.len);
-               pos += sizeof(rsn->header) + rsn->header.len;
-               rsn->header.len = cpu_to_le16(rsn->header.len);
+                       sizeof(rsn->header) + tmplen);
+               pos += sizeof(rsn->header) + tmplen;
        }
 
        /* update curbssparams */
-       adapter->curbssparams.channel =
-           (pbssdesc->phyparamset.dsparamset.currentchan);
+       adapter->curbssparams.channel = bss->phyparamset.dsparamset.currentchan;
 
        /* Copy the infra. association rates into Current BSS state structure */
        memcpy(&adapter->curbssparams.datarates, &rates->rates,
-              min_t(size_t, sizeof(adapter->curbssparams.datarates), rates->header.len));
+              min_t(size_t, sizeof(adapter->curbssparams.datarates),
+                    cpu_to_le16(rates->header.len)));
 
-       lbs_pr_debug(1, "ASSOC_CMD: rates->header.len = %d\n", rates->header.len);
+       lbs_deb_join("ASSOC_CMD: rates->header.len = %d\n",
+                    cpu_to_le16(rates->header.len));
 
        /* set IBSS field */
-       if (pbssdesc->mode == IW_MODE_INFRA) {
+       if (bss->mode == IW_MODE_INFRA) {
 #define CAPINFO_ESS_MODE 1
                passo->capinfo.ess = CAPINFO_ESS_MODE;
        }
 
-       if (libertas_parse_dnld_countryinfo_11d(priv)) {
+       if (libertas_parse_dnld_countryinfo_11d(priv, bss)) {
                ret = -1;
                goto done;
        }
@@ -443,31 +441,28 @@ int libertas_cmd_80211_associate(wlan_private * priv,
        cmd->size = cpu_to_le16((u16) (pos - (u8 *) passo) + S_DS_GEN);
 
        /* set the capability info at last */
-       memcpy(&tmpcap, &pbssdesc->cap, sizeof(passo->capinfo));
+       memcpy(&tmpcap, &bss->cap, sizeof(passo->capinfo));
        tmpcap &= CAPINFO_MASK;
-       lbs_pr_debug(1, "ASSOC_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n",
-              tmpcap, CAPINFO_MASK);
-       tmpcap = cpu_to_le16(tmpcap);
+       lbs_deb_join("ASSOC_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n",
+                    tmpcap, CAPINFO_MASK);
        memcpy(&passo->capinfo, &tmpcap, sizeof(passo->capinfo));
 
-      done:
-       LEAVE();
+done:
+       lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
        return ret;
 }
 
 int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
-                                struct cmd_ds_command *cmd, void *pssid)
+                                struct cmd_ds_command *cmd, void *pdata_buf)
 {
        wlan_adapter *adapter = priv->adapter;
        struct cmd_ds_802_11_ad_hoc_start *adhs = &cmd->params.ads;
        int ret = 0;
        int cmdappendsize = 0;
        int i;
-       u16 tmpcap;
-       struct bss_descriptor *pbssdesc;
-       struct WLAN_802_11_SSID *ssid = pssid;
+       struct assoc_request * assoc_req = pdata_buf;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_JOIN);
 
        if (!adapter) {
                ret = -1;
@@ -476,9 +471,6 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
 
        cmd->command = cpu_to_le16(cmd_802_11_ad_hoc_start);
 
-       pbssdesc = &adapter->curbssparams.bssdescriptor;
-       adapter->pattemptedbssdesc = pbssdesc;
-
        /*
         * Fill in the parameters for 2 data structures:
         *   1. cmd_ds_802_11_ad_hoc_start command
@@ -492,20 +484,16 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
         */
 
        memset(adhs->SSID, 0, IW_ESSID_MAX_SIZE);
+       memcpy(adhs->SSID, assoc_req->ssid, assoc_req->ssid_len);
 
-       memcpy(adhs->SSID, ssid->ssid, ssid->ssidlength);
-
-       lbs_pr_debug(1, "ADHOC_S_CMD: SSID = %s\n", adhs->SSID);
-
-       memset(pbssdesc->ssid.ssid, 0, IW_ESSID_MAX_SIZE);
-       memcpy(pbssdesc->ssid.ssid, ssid->ssid, ssid->ssidlength);
-
-       pbssdesc->ssid.ssidlength = ssid->ssidlength;
+       lbs_deb_join("ADHOC_S_CMD: SSID '%s', ssid length %u\n",
+                    escape_essid(assoc_req->ssid, assoc_req->ssid_len),
+                    assoc_req->ssid_len);
 
        /* set the BSS type */
        adhs->bsstype = cmd_bss_type_ibss;
-       pbssdesc->mode = IW_MODE_ADHOC;
-       adhs->beaconperiod = adapter->beaconperiod;
+       adapter->mode = IW_MODE_ADHOC;
+       adhs->beaconperiod = cpu_to_le16(adapter->beaconperiod);
 
        /* set Physical param set */
 #define DS_PARA_IE_ID   3
@@ -514,18 +502,12 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
        adhs->phyparamset.dsparamset.elementid = DS_PARA_IE_ID;
        adhs->phyparamset.dsparamset.len = DS_PARA_IE_LEN;
 
-       WARN_ON(!adapter->adhocchannel);
+       WARN_ON(!assoc_req->channel);
 
-       lbs_pr_debug(1, "ADHOC_S_CMD: Creating ADHOC on channel %d\n",
-              adapter->adhocchannel);
+       lbs_deb_join("ADHOC_S_CMD: Creating ADHOC on channel %d\n",
+                    assoc_req->channel);
 
-       adapter->curbssparams.channel = adapter->adhocchannel;
-
-       pbssdesc->channel = adapter->adhocchannel;
-       adhs->phyparamset.dsparamset.currentchan = adapter->adhocchannel;
-
-       memcpy(&pbssdesc->phyparamset,
-              &adhs->phyparamset, sizeof(union ieeetypes_phyparamset));
+       adhs->phyparamset.dsparamset.currentchan = assoc_req->channel;
 
        /* set IBSS param set */
 #define IBSS_PARA_IE_ID   6
@@ -533,26 +515,21 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
 
        adhs->ssparamset.ibssparamset.elementid = IBSS_PARA_IE_ID;
        adhs->ssparamset.ibssparamset.len = IBSS_PARA_IE_LEN;
-       adhs->ssparamset.ibssparamset.atimwindow = adapter->atimwindow;
-       memcpy(&pbssdesc->ssparamset,
-              &adhs->ssparamset, sizeof(union IEEEtypes_ssparamset));
+       adhs->ssparamset.ibssparamset.atimwindow = cpu_to_le16(adapter->atimwindow);
 
        /* set capability info */
        adhs->cap.ess = 0;
        adhs->cap.ibss = 1;
-       pbssdesc->cap.ibss = 1;
 
        /* probedelay */
        adhs->probedelay = cpu_to_le16(cmd_scan_probe_delay_time);
 
        /* set up privacy in adapter->scantable[i] */
-       if (adapter->secinfo.wep_enabled) {
-               lbs_pr_debug(1, "ADHOC_S_CMD: WEP enabled, setting privacy on\n");
-               pbssdesc->privacy = wlan802_11privfilter8021xWEP;
+       if (assoc_req->secinfo.wep_enabled) {
+               lbs_deb_join("ADHOC_S_CMD: WEP enabled, setting privacy on\n");
                adhs->cap.privacy = AD_HOC_CAP_PRIVACY_ON;
        } else {
-               lbs_pr_debug(1, "ADHOC_S_CMD: WEP disabled, setting privacy off\n");
-               pbssdesc->privacy = wlan802_11privfilteracceptall;
+               lbs_deb_join("ADHOC_S_CMD: WEP disabled, setting privacy off\n");
        }
 
        memset(adhs->datarate, 0, sizeof(adhs->datarate));
@@ -574,29 +551,24 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
        memcpy(&adapter->curbssparams.datarates,
               &adhs->datarate, adapter->curbssparams.numofrates);
 
-       lbs_pr_debug(1, "ADHOC_S_CMD: rates=%02x %02x %02x %02x \n",
+       lbs_deb_join("ADHOC_S_CMD: rates=%02x %02x %02x %02x \n",
               adhs->datarate[0], adhs->datarate[1],
               adhs->datarate[2], adhs->datarate[3]);
 
-       lbs_pr_debug(1, "ADHOC_S_CMD: AD HOC Start command is ready\n");
+       lbs_deb_join("ADHOC_S_CMD: AD HOC Start command is ready\n");
 
        if (libertas_create_dnld_countryinfo_11d(priv)) {
-               lbs_pr_debug(1, "ADHOC_S_CMD: dnld_countryinfo_11d failed\n");
+               lbs_deb_join("ADHOC_S_CMD: dnld_countryinfo_11d failed\n");
                ret = -1;
                goto done;
        }
 
-       cmd->size =
-           cpu_to_le16(sizeof(struct cmd_ds_802_11_ad_hoc_start)
-                            + S_DS_GEN + cmdappendsize);
-
-       memcpy(&tmpcap, &adhs->cap, sizeof(u16));
-       tmpcap = cpu_to_le16(tmpcap);
-       memcpy(&adhs->cap, &tmpcap, sizeof(u16));
+       cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_ad_hoc_start) +
+                               S_DS_GEN + cmdappendsize);
 
        ret = 0;
 done:
-       LEAVE();
+       lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
        return ret;
 }
 
@@ -614,7 +586,8 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
 {
        wlan_adapter *adapter = priv->adapter;
        struct cmd_ds_802_11_ad_hoc_join *padhocjoin = &cmd->params.adj;
-       struct bss_descriptor *pbssdesc = pdata_buf;
+       struct assoc_request * assoc_req = pdata_buf;
+       struct bss_descriptor *bss = &assoc_req->bss;
        int cmdappendsize = 0;
        int ret = 0;
        u8 *card_rates;
@@ -622,70 +595,59 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
        u16 tmpcap;
        int i;
 
-       ENTER();
-
-       adapter->pattemptedbssdesc = pbssdesc;
+       lbs_deb_enter(LBS_DEB_JOIN);
 
        cmd->command = cpu_to_le16(cmd_802_11_ad_hoc_join);
 
        padhocjoin->bssdescriptor.bsstype = cmd_bss_type_ibss;
 
-       padhocjoin->bssdescriptor.beaconperiod = pbssdesc->beaconperiod;
-
-       memcpy(&padhocjoin->bssdescriptor.BSSID,
-              &pbssdesc->macaddress, ETH_ALEN);
+       padhocjoin->bssdescriptor.beaconperiod = cpu_to_le16(bss->beaconperiod);
 
-       memcpy(&padhocjoin->bssdescriptor.SSID,
-              &pbssdesc->ssid.ssid, pbssdesc->ssid.ssidlength);
+       memcpy(&padhocjoin->bssdescriptor.BSSID, &bss->bssid, ETH_ALEN);
+       memcpy(&padhocjoin->bssdescriptor.SSID, &bss->ssid, bss->ssid_len);
 
        memcpy(&padhocjoin->bssdescriptor.phyparamset,
-              &pbssdesc->phyparamset, sizeof(union ieeetypes_phyparamset));
+              &bss->phyparamset, sizeof(union ieeetypes_phyparamset));
 
        memcpy(&padhocjoin->bssdescriptor.ssparamset,
-              &pbssdesc->ssparamset, sizeof(union IEEEtypes_ssparamset));
+              &bss->ssparamset, sizeof(union IEEEtypes_ssparamset));
 
-       memcpy(&tmpcap, &pbssdesc->cap, sizeof(struct ieeetypes_capinfo));
+       memcpy(&tmpcap, &bss->cap, sizeof(struct ieeetypes_capinfo));
        tmpcap &= CAPINFO_MASK;
 
-       lbs_pr_debug(1, "ADHOC_J_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n",
+       lbs_deb_join("ADHOC_J_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n",
               tmpcap, CAPINFO_MASK);
        memcpy(&padhocjoin->bssdescriptor.cap, &tmpcap,
               sizeof(struct ieeetypes_capinfo));
 
        /* information on BSSID descriptor passed to FW */
-    lbs_pr_debug(1,
-              "ADHOC_J_CMD: BSSID = %2x-%2x-%2x-%2x-%2x-%2x, SSID = %s\n",
-              padhocjoin->bssdescriptor.BSSID[0],
-              padhocjoin->bssdescriptor.BSSID[1],
-              padhocjoin->bssdescriptor.BSSID[2],
-              padhocjoin->bssdescriptor.BSSID[3],
-              padhocjoin->bssdescriptor.BSSID[4],
-              padhocjoin->bssdescriptor.BSSID[5],
+       lbs_deb_join(
+              "ADHOC_J_CMD: BSSID = " MAC_FMT ", SSID = '%s'\n",
+              MAC_ARG(padhocjoin->bssdescriptor.BSSID),
               padhocjoin->bssdescriptor.SSID);
 
        /* failtimeout */
        padhocjoin->failtimeout = cpu_to_le16(MRVDRV_ASSOCIATION_TIME_OUT);
 
        /* probedelay */
-       padhocjoin->probedelay =
-           cpu_to_le16(cmd_scan_probe_delay_time);
+       padhocjoin->probedelay = cpu_to_le16(cmd_scan_probe_delay_time);
 
        /* Copy Data rates from the rates recorded in scan response */
        memset(padhocjoin->bssdescriptor.datarates, 0,
               sizeof(padhocjoin->bssdescriptor.datarates));
-       memcpy(padhocjoin->bssdescriptor.datarates, pbssdesc->datarates,
+       memcpy(padhocjoin->bssdescriptor.datarates, bss->datarates,
               min(sizeof(padhocjoin->bssdescriptor.datarates),
-                  sizeof(pbssdesc->datarates)));
+                  sizeof(bss->datarates)));
 
        card_rates = libertas_supported_rates;
        card_rates_size = sizeof(libertas_supported_rates);
 
-       adapter->curbssparams.channel = pbssdesc->channel;
+       adapter->curbssparams.channel = bss->channel;
 
        if (get_common_rates(adapter, padhocjoin->bssdescriptor.datarates,
                             sizeof(padhocjoin->bssdescriptor.datarates),
                             card_rates, card_rates_size)) {
-               lbs_pr_debug(1, "ADHOC_J_CMD: get_common_rates returns error.\n");
+               lbs_deb_join("ADHOC_J_CMD: get_common_rates returns error.\n");
                ret = -1;
                goto done;
        }
@@ -704,17 +666,17 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
               adapter->curbssparams.numofrates);
 
        padhocjoin->bssdescriptor.ssparamset.ibssparamset.atimwindow =
-           cpu_to_le16(pbssdesc->atimwindow);
+           cpu_to_le16(bss->atimwindow);
 
-       if (adapter->secinfo.wep_enabled) {
+       if (assoc_req->secinfo.wep_enabled) {
                padhocjoin->bssdescriptor.cap.privacy = AD_HOC_CAP_PRIVACY_ON;
        }
 
        if (adapter->psmode == wlan802_11powermodemax_psp) {
                /* wake up first */
-               enum WLAN_802_11_POWER_MODE Localpsmode;
+               __le32 Localpsmode;
 
-               Localpsmode = wlan802_11powermodecam;
+               Localpsmode = cpu_to_le32(wlan802_11powermodecam);
                ret = libertas_prepare_and_send_command(priv,
                                            cmd_802_11_ps_mode,
                                            cmd_act_set,
@@ -726,24 +688,16 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
                }
        }
 
-       if (libertas_parse_dnld_countryinfo_11d(priv)) {
+       if (libertas_parse_dnld_countryinfo_11d(priv, bss)) {
                ret = -1;
                goto done;
        }
 
-       cmd->size =
-           cpu_to_le16(sizeof(struct cmd_ds_802_11_ad_hoc_join)
-                            + S_DS_GEN + cmdappendsize);
-
-       memcpy(&tmpcap, &padhocjoin->bssdescriptor.cap,
-              sizeof(struct ieeetypes_capinfo));
-       tmpcap = cpu_to_le16(tmpcap);
-
-       memcpy(&padhocjoin->bssdescriptor.cap,
-              &tmpcap, sizeof(struct ieeetypes_capinfo));
+       cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_ad_hoc_join) +
+                               S_DS_GEN + cmdappendsize);
 
-      done:
-       LEAVE();
+done:
+       lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
        return ret;
 }
 
@@ -754,19 +708,24 @@ int libertas_ret_80211_associate(wlan_private * priv,
        int ret = 0;
        union iwreq_data wrqu;
        struct ieeetypes_assocrsp *passocrsp;
-       struct bss_descriptor *pbssdesc;
+       struct bss_descriptor * bss;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_JOIN);
 
-       passocrsp = (struct ieeetypes_assocrsp *) & resp->params;
+       if (!adapter->in_progress_assoc_req) {
+               lbs_deb_join("ASSOC_RESP: no in-progress association request\n");
+               ret = -1;
+               goto done;
+       }
+       bss = &adapter->in_progress_assoc_req->bss;
 
-       if (passocrsp->statuscode) {
+       passocrsp = (struct ieeetypes_assocrsp *) & resp->params;
 
+       if (le16_to_cpu(passocrsp->statuscode)) {
                libertas_mac_event_disconnected(priv);
 
-        lbs_pr_debug(1,
-                      "ASSOC_RESP: Association failed, status code = %d\n",
-                      passocrsp->statuscode);
+               lbs_deb_join("ASSOC_RESP: Association failed, status code = %d\n",
+                            le16_to_cpu(passocrsp->statuscode));
 
                ret = -1;
                goto done;
@@ -778,24 +737,15 @@ int libertas_ret_80211_associate(wlan_private * priv,
        /* Send a Media Connected event, according to the Spec */
        adapter->connect_status = libertas_connected;
 
-       /* Set the attempted BSSID Index to current */
-       pbssdesc = adapter->pattemptedbssdesc;
-
-       lbs_pr_debug(1, "ASSOC_RESP: %s\n", pbssdesc->ssid.ssid);
+       lbs_deb_join("ASSOC_RESP: assocated to '%s'\n",
+                    escape_essid(bss->ssid, bss->ssid_len));
 
-       /* Set the new SSID to current SSID */
-       memcpy(&adapter->curbssparams.ssid,
-              &pbssdesc->ssid, sizeof(struct WLAN_802_11_SSID));
-
-       /* Set the new BSSID (AP's MAC address) to current BSSID */
-       memcpy(adapter->curbssparams.bssid,
-              pbssdesc->macaddress, ETH_ALEN);
-
-       /* Make a copy of current BSSID descriptor */
-       memcpy(&adapter->curbssparams.bssdescriptor,
-              pbssdesc, sizeof(struct bss_descriptor));
+       /* Update current SSID and BSSID */
+       memcpy(&adapter->curbssparams.ssid, &bss->ssid, IW_ESSID_MAX_SIZE);
+       adapter->curbssparams.ssid_len = bss->ssid_len;
+       memcpy(adapter->curbssparams.bssid, bss->bssid, ETH_ALEN);
 
-       lbs_pr_debug(1, "ASSOC_RESP: currentpacketfilter is %x\n",
+       lbs_deb_join("ASSOC_RESP: currentpacketfilter is %x\n",
               adapter->currentpacketfilter);
 
        adapter->SNR[TYPE_RXPD][TYPE_AVG] = 0;
@@ -806,28 +756,31 @@ int libertas_ret_80211_associate(wlan_private * priv,
        adapter->nextSNRNF = 0;
        adapter->numSNRNF = 0;
 
-       netif_carrier_on(priv->wlan_dev.netdev);
-       netif_wake_queue(priv->wlan_dev.netdev);
+       netif_carrier_on(priv->dev);
+       netif_wake_queue(priv->dev);
 
-       lbs_pr_debug(1, "ASSOC_RESP: Associated \n");
+       netif_carrier_on(priv->mesh_dev);
+       netif_wake_queue(priv->mesh_dev);
+
+       lbs_deb_join("ASSOC_RESP: Associated \n");
 
        memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN);
        wrqu.ap_addr.sa_family = ARPHRD_ETHER;
-       wireless_send_event(priv->wlan_dev.netdev, SIOCGIWAP, &wrqu, NULL);
+       wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);
 
-      done:
-       LEAVE();
+done:
+       lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
        return ret;
 }
 
 int libertas_ret_80211_disassociate(wlan_private * priv,
                                 struct cmd_ds_command *resp)
 {
-       ENTER();
+       lbs_deb_enter(LBS_DEB_JOIN);
 
        libertas_mac_event_disconnected(priv);
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_JOIN);
        return 0;
 }
 
@@ -840,90 +793,85 @@ int libertas_ret_80211_ad_hoc_start(wlan_private * priv,
        u16 result = le16_to_cpu(resp->result);
        struct cmd_ds_802_11_ad_hoc_result *padhocresult;
        union iwreq_data wrqu;
-       struct bss_descriptor *pbssdesc;
+       struct bss_descriptor *bss;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_JOIN);
 
        padhocresult = &resp->params.result;
 
-       lbs_pr_debug(1, "ADHOC_S_RESP: size = %d\n", le16_to_cpu(resp->size));
-       lbs_pr_debug(1, "ADHOC_S_RESP: command = %x\n", command);
-       lbs_pr_debug(1, "ADHOC_S_RESP: result = %x\n", result);
+       lbs_deb_join("ADHOC_RESP: size = %d\n", le16_to_cpu(resp->size));
+       lbs_deb_join("ADHOC_RESP: command = %x\n", command);
+       lbs_deb_join("ADHOC_RESP: result = %x\n", result);
 
-       pbssdesc = adapter->pattemptedbssdesc;
+       if (!adapter->in_progress_assoc_req) {
+               lbs_deb_join("ADHOC_RESP: no in-progress association request\n");
+               ret = -1;
+               goto done;
+       }
+       bss = &adapter->in_progress_assoc_req->bss;
 
        /*
         * Join result code 0 --> SUCCESS
         */
        if (result) {
-               lbs_pr_debug(1, "ADHOC_RESP failed\n");
+               lbs_deb_join("ADHOC_RESP: failed\n");
                if (adapter->connect_status == libertas_connected) {
                        libertas_mac_event_disconnected(priv);
                }
-
-               memset(&adapter->curbssparams.bssdescriptor,
-                      0x00, sizeof(adapter->curbssparams.bssdescriptor));
-
-               LEAVE();
-               return -1;
+               ret = -1;
+               goto done;
        }
 
        /*
         * Now the join cmd should be successful
         * If BSSID has changed use SSID to compare instead of BSSID
         */
-       lbs_pr_debug(1, "ADHOC_J_RESP  %s\n", pbssdesc->ssid.ssid);
+       lbs_deb_join("ADHOC_RESP: associated to '%s'\n",
+                    escape_essid(bss->ssid, bss->ssid_len));
 
        /* Send a Media Connected event, according to the Spec */
        adapter->connect_status = libertas_connected;
 
        if (command == cmd_ret_802_11_ad_hoc_start) {
                /* Update the created network descriptor with the new BSSID */
-               memcpy(pbssdesc->macaddress,
-                      padhocresult->BSSID, ETH_ALEN);
-       } else {
-
-               /* Make a copy of current BSSID descriptor, only needed for join since
-                *   the current descriptor is already being used for adhoc start
-                */
-               memmove(&adapter->curbssparams.bssdescriptor,
-                       pbssdesc, sizeof(struct bss_descriptor));
+               memcpy(bss->bssid, padhocresult->BSSID, ETH_ALEN);
        }
 
        /* Set the BSSID from the joined/started descriptor */
-       memcpy(&adapter->curbssparams.bssid,
-              pbssdesc->macaddress, ETH_ALEN);
+       memcpy(&adapter->curbssparams.bssid, bss->bssid, ETH_ALEN);
 
        /* Set the new SSID to current SSID */
-       memcpy(&adapter->curbssparams.ssid,
-              &pbssdesc->ssid, sizeof(struct WLAN_802_11_SSID));
+       memcpy(&adapter->curbssparams.ssid, &bss->ssid, IW_ESSID_MAX_SIZE);
+       adapter->curbssparams.ssid_len = bss->ssid_len;
 
-       netif_carrier_on(priv->wlan_dev.netdev);
-       netif_wake_queue(priv->wlan_dev.netdev);
+       netif_carrier_on(priv->dev);
+       netif_wake_queue(priv->dev);
+
+       netif_carrier_on(priv->mesh_dev);
+       netif_wake_queue(priv->mesh_dev);
 
        memset(&wrqu, 0, sizeof(wrqu));
        memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN);
        wrqu.ap_addr.sa_family = ARPHRD_ETHER;
-       wireless_send_event(priv->wlan_dev.netdev, SIOCGIWAP, &wrqu, NULL);
+       wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);
 
-       lbs_pr_debug(1, "ADHOC_RESP: - Joined/Started Ad Hoc\n");
-       lbs_pr_debug(1, "ADHOC_RESP: channel = %d\n", adapter->adhocchannel);
-       lbs_pr_debug(1, "ADHOC_RESP: BSSID = %02x:%02x:%02x:%02x:%02x:%02x\n",
-              padhocresult->BSSID[0], padhocresult->BSSID[1],
-              padhocresult->BSSID[2], padhocresult->BSSID[3],
-              padhocresult->BSSID[4], padhocresult->BSSID[5]);
+       lbs_deb_join("ADHOC_RESP: - Joined/Started Ad Hoc\n");
+       lbs_deb_join("ADHOC_RESP: channel = %d\n", adapter->curbssparams.channel);
+       lbs_deb_join("ADHOC_RESP: BSSID = " MAC_FMT "\n",
+              MAC_ARG(padhocresult->BSSID));
 
-       LEAVE();
+done:
+       lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
        return ret;
 }
 
 int libertas_ret_80211_ad_hoc_stop(wlan_private * priv,
                                struct cmd_ds_command *resp)
 {
-       ENTER();
+       lbs_deb_enter(LBS_DEB_JOIN);
 
        libertas_mac_event_disconnected(priv);
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_JOIN);
        return 0;
 }
index 115f5a8ba34603733683c329cb4171beb57c1084..d522630ff8cf0a76c55124eff395aeeb1418c8ce 100644 (file)
@@ -9,6 +9,7 @@
 #define _WLAN_JOIN_H
 
 #include "defs.h"
+#include "dev.h"
 
 struct cmd_ds_command;
 extern int libertas_cmd_80211_authenticate(wlan_private * priv,
@@ -21,7 +22,7 @@ extern int libertas_cmd_80211_ad_hoc_stop(wlan_private * priv,
                                       struct cmd_ds_command *cmd);
 extern int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
                                        struct cmd_ds_command *cmd,
-                                       void *pssid);
+                                       void *pdata_buf);
 extern int libertas_cmd_80211_deauthenticate(wlan_private * priv,
                                          struct cmd_ds_command *cmd);
 extern int libertas_cmd_80211_associate(wlan_private * priv,
@@ -39,12 +40,10 @@ extern int libertas_ret_80211_associate(wlan_private * priv,
 
 extern int libertas_reassociation_thread(void *data);
 
-struct WLAN_802_11_SSID;
-struct bss_descriptor;
-
 extern int libertas_start_adhoc_network(wlan_private * priv,
-                            struct WLAN_802_11_SSID *adhocssid);
-extern int libertas_join_adhoc_network(wlan_private * priv, struct bss_descriptor *pbssdesc);
+                            struct assoc_request * assoc_req);
+extern int libertas_join_adhoc_network(wlan_private * priv,
+                               struct assoc_request * assoc_req);
 extern int libertas_stop_adhoc_network(wlan_private * priv);
 
 extern int libertas_send_deauthentication(wlan_private * priv);
@@ -52,6 +51,6 @@ extern int libertas_send_deauth(wlan_private * priv);
 
 extern int libertas_do_adhocstop_ioctl(wlan_private * priv);
 
-int wlan_associate(wlan_private * priv, struct bss_descriptor * pbssdesc);
+int wlan_associate(wlan_private * priv, struct assoc_request * assoc_req);
 
 #endif
index b9b25ce6591934e1ebbb0808765dc778bf1682c9..623ab4b1697388103305d04257bc4f535d6e9066 100644 (file)
@@ -4,6 +4,7 @@
   * thread etc..
   */
 
+#include <linux/moduleparam.h>
 #include <linux/delay.h>
 #include <linux/freezer.h>
 #include <linux/etherdevice.h>
 #include <linux/if_arp.h>
 
 #include <net/iw_handler.h>
+#include <net/ieee80211.h>
 
 #include "host.h"
-#include "sbi.h"
 #include "decl.h"
 #include "dev.h"
-#include "fw.h"
 #include "wext.h"
 #include "debugfs.h"
 #include "assoc.h"
 
-#define DRIVER_RELEASE_VERSION "320.p0"
+#define DRIVER_RELEASE_VERSION "322.p0"
 const char libertas_driver_version[] = "COMM-USB8388-" DRIVER_RELEASE_VERSION
 #ifdef  DEBUG
     "-dbg"
 #endif
     "";
 
-#ifdef ENABLE_PM
-static struct pm_dev *wlan_pm_dev = NULL;
-#endif
+
+/* Module parameters */
+unsigned int libertas_debug = 0;
+module_param(libertas_debug, int, 0644);
+EXPORT_SYMBOL_GPL(libertas_debug);
+
 
 #define WLAN_TX_PWR_DEFAULT            20      /*100mW */
 #define WLAN_TX_PWR_US_DEFAULT         20      /*100mW */
@@ -145,14 +148,6 @@ static struct region_cfp_table region_cfp_table[] = {
 /*Add new region here */
 };
 
-/**
- * the rates supported by the card
- */
-u8 libertas_wlan_data_rates[WLAN_SUPPORTED_RATES] =
-    { 0x02, 0x04, 0x0B, 0x16, 0x00, 0x0C, 0x12,
-       0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x00
-};
-
 /**
  * the rates supported
  */
@@ -172,67 +167,56 @@ u8 libertas_adhoc_rates_g[G_SUPPORTED_RATES] =
  */
 u8 libertas_adhoc_rates_b[4] = { 0x82, 0x84, 0x8b, 0x96 };
 
-/**
- * the global variable of a pointer to wlan_private
- * structure variable
- */
-static wlan_private *wlanpriv = NULL;
-
-#define MAX_DEVS 5
-static struct net_device *libertas_devs[MAX_DEVS];
-static int libertas_found = 0;
-
 /**
  * the table to keep region code
  */
 u16 libertas_region_code_to_index[MRVDRV_MAX_REGION_CODE] =
     { 0x10, 0x20, 0x30, 0x31, 0x32, 0x40 };
 
-static u8 *default_fw_name = "usb8388.bin";
-
 /**
  * Attributes exported through sysfs
  */
 
 /**
- * @brief Get function for sysfs attribute libertas_mpp
+ * @brief Get function for sysfs attribute anycast_mask
  */
-static ssize_t libertas_mpp_get(struct device * dev,
+static ssize_t libertas_anycast_get(struct device * dev,
                struct device_attribute *attr, char * buf) {
        struct cmd_ds_mesh_access mesh_access;
 
        memset(&mesh_access, 0, sizeof(mesh_access));
        libertas_prepare_and_send_command(to_net_dev(dev)->priv,
                        cmd_mesh_access,
-                       cmd_act_mesh_get_mpp,
+                       cmd_act_mesh_get_anycast,
                        cmd_option_waitforrsp, 0, (void *)&mesh_access);
 
-       return snprintf(buf, 3, "%d\n", mesh_access.data[0]);
+       return snprintf(buf, 12, "0x%X\n", le32_to_cpu(mesh_access.data[0]));
 }
 
 /**
- * @brief Set function for sysfs attribute libertas_mpp
+ * @brief Set function for sysfs attribute anycast_mask
  */
-static ssize_t libertas_mpp_set(struct device * dev,
+static ssize_t libertas_anycast_set(struct device * dev,
                struct device_attribute *attr, const char * buf, size_t count) {
        struct cmd_ds_mesh_access mesh_access;
-
+       uint32_t datum;
 
        memset(&mesh_access, 0, sizeof(mesh_access));
-       sscanf(buf, "%d", &(mesh_access.data[0]));
+       sscanf(buf, "%x", &datum);
+       mesh_access.data[0] = cpu_to_le32(datum);
+
        libertas_prepare_and_send_command((to_net_dev(dev))->priv,
                        cmd_mesh_access,
-                       cmd_act_mesh_set_mpp,
+                       cmd_act_mesh_set_anycast,
                        cmd_option_waitforrsp, 0, (void *)&mesh_access);
        return strlen(buf);
 }
 
 /**
- * libertas_mpp attribute to be exported per mshX interface
- * through sysfs (/sys/class/net/mshX/libertas-mpp)
+ * anycast_mask attribute to be exported per mshX interface
+ * through sysfs (/sys/class/net/mshX/anycast_mask)
  */
-static DEVICE_ATTR(libertas_mpp, 0644, libertas_mpp_get,
-               libertas_mpp_set );
+static DEVICE_ATTR(anycast_mask, 0644, libertas_anycast_get, libertas_anycast_set);
 
 /**
  *  @brief Check if the device can be open and wait if necessary.
@@ -245,7 +229,8 @@ static DEVICE_ATTR(libertas_mpp, 0644, libertas_mpp_get,
  * function to work around the issue.
  *
  */
-static int pre_open_check(struct net_device *dev) {
+static int pre_open_check(struct net_device *dev)
+{
        wlan_private *priv = (wlan_private *) dev->priv;
        wlan_adapter *adapter = priv->adapter;
        int i = 0;
@@ -255,8 +240,7 @@ static int pre_open_check(struct net_device *dev) {
                msleep_interruptible(100);
        }
        if (!adapter->fw_ready) {
-               lbs_pr_info("FW not ready, pre_open_check() return failure\n");
-               LEAVE();
+               lbs_pr_err("firmware not ready\n");
                return -1;
        }
 
@@ -274,17 +258,19 @@ static int wlan_dev_open(struct net_device *dev)
        wlan_private *priv = (wlan_private *) dev->priv;
        wlan_adapter *adapter = priv->adapter;
 
-       ENTER();
-
+       lbs_deb_enter(LBS_DEB_NET);
 
        priv->open = 1;
 
        if (adapter->connect_status == libertas_connected) {
-               netif_carrier_on(priv->wlan_dev.netdev);
-       } else
-               netif_carrier_off(priv->wlan_dev.netdev);
+               netif_carrier_on(priv->dev);
+               netif_carrier_on(priv->mesh_dev);
+       } else {
+               netif_carrier_off(priv->dev);
+               netif_carrier_off(priv->mesh_dev);
+       }
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_NET);
        return 0;
 }
 /**
@@ -297,12 +283,12 @@ static int mesh_open(struct net_device *dev)
 {
        wlan_private *priv = (wlan_private *) dev->priv ;
 
-       if(pre_open_check(dev) == -1)
+       if (pre_open_check(dev) == -1)
                return -1;
        priv->mesh_open = 1 ;
-       netif_start_queue(priv->mesh_dev);
+       netif_wake_queue(priv->mesh_dev);
        if (priv->infra_open == 0)
-               return wlan_dev_open(priv->wlan_dev.netdev) ;
+               return wlan_dev_open(priv->dev) ;
        return 0;
 }
 
@@ -319,9 +305,9 @@ static int wlan_open(struct net_device *dev)
        if(pre_open_check(dev) == -1)
                return -1;
        priv->infra_open = 1 ;
-       netif_wake_queue(priv->wlan_dev.netdev);
+       netif_wake_queue(priv->dev);
        if (priv->open == 0)
-               return wlan_dev_open(priv->wlan_dev.netdev) ;
+               return wlan_dev_open(priv->dev) ;
        return 0;
 }
 
@@ -329,12 +315,12 @@ static int wlan_dev_close(struct net_device *dev)
 {
        wlan_private *priv = dev->priv;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_NET);
 
-       netif_carrier_off(priv->wlan_dev.netdev);
+       netif_carrier_off(priv->dev);
        priv->open = 0;
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_NET);
        return 0;
 }
 
@@ -351,7 +337,7 @@ static int mesh_close(struct net_device *dev)
        priv->mesh_open = 0;
        netif_stop_queue(priv->mesh_dev);
        if (priv->infra_open == 0)
-               return wlan_dev_close( ((wlan_private *) dev->priv)->wlan_dev.netdev) ;
+               return wlan_dev_close(dev);
        else
                return 0;
 }
@@ -362,147 +348,38 @@ static int mesh_close(struct net_device *dev)
  *  @param dev     A pointer to net_device structure
  *  @return       0
  */
-static int wlan_close(struct net_device *dev) {
+static int wlan_close(struct net_device *dev)
+{
        wlan_private *priv = (wlan_private *) dev->priv;
 
-       netif_stop_queue(priv->wlan_dev.netdev);
+       netif_stop_queue(dev);
        priv->infra_open = 0;
        if (priv->mesh_open == 0)
-               return wlan_dev_close( ((wlan_private *) dev->priv)->wlan_dev.netdev) ;
+               return wlan_dev_close(dev);
        else
                return 0;
 }
 
 
-#ifdef ENABLE_PM
-
-/**
- *  @brief This function is a callback function. it is called by
- *  kernel to enter or exit power saving mode.
- *
- *  @param pmdev   A pointer to pm_dev
- *  @param pmreq   pm_request_t
- *  @param pmdata  A pointer to pmdata
- *  @return       0 or -1
- */
-static int wlan_pm_callback(struct pm_dev *pmdev, pm_request_t pmreq,
-                           void *pmdata)
-{
-       wlan_private *priv = wlanpriv;
-       wlan_adapter *adapter = priv->adapter;
-       struct net_device *dev = priv->wlan_dev.netdev;
-
-       lbs_pr_debug(1, "WPRM_PM_CALLBACK: pmreq = %d.\n", pmreq);
-
-       switch (pmreq) {
-       case PM_SUSPEND:
-               lbs_pr_debug(1, "WPRM_PM_CALLBACK: enter PM_SUSPEND.\n");
-
-               /* in associated mode */
-               if (adapter->connect_status == libertas_connected) {
-                       if ((adapter->psstate != PS_STATE_SLEEP)
-                           ) {
-                               lbs_pr_debug(1,
-                                      "wlan_pm_callback: can't enter sleep mode\n");
-                               return -1;
-                       } else {
-
-                               /*
-                                * Detach the network interface
-                                * if the network is running
-                                */
-                               if (netif_running(dev)) {
-                                       netif_device_detach(dev);
-                                       lbs_pr_debug(1,
-                                              "netif_device_detach().\n");
-                               }
-                               libertas_sbi_suspend(priv);
-                       }
-                       break;
-               }
-
-               /* in non associated mode */
-
-               /*
-                * Detach the network interface
-                * if the network is running
-                */
-               if (netif_running(dev))
-                       netif_device_detach(dev);
-
-               /*
-                * Storing and restoring of the regs be taken care
-                * at the driver rest will be done at wlan driver
-                * this makes driver independent of the card
-                */
-
-               libertas_sbi_suspend(priv);
-
-               break;
-
-       case PM_RESUME:
-               /* in associated mode */
-               if (adapter->connect_status == libertas_connected) {
-                       {
-                               /*
-                                * Bring the inteface up first
-                                * This case should not happen still ...
-                                */
-                               libertas_sbi_resume(priv);
-
-                               /*
-                                * Attach the network interface
-                                * if the network is running
-                                */
-                               if (netif_running(dev)) {
-                                       netif_device_attach(dev);
-                                       lbs_pr_debug(1,
-                                              "after netif_device_attach().\n");
-                               }
-                               lbs_pr_debug(1,
-                                      "After netif attach, in associated mode.\n");
-                       }
-                       break;
-               }
-
-               /* in non associated mode */
-
-               /*
-                * Bring the inteface up first
-                * This case should not happen still ...
-                */
-
-               libertas_sbi_resume(priv);
-
-               if (netif_running(dev))
-                       netif_device_attach(dev);
-
-               lbs_pr_debug(1, "after netif attach, in NON associated mode.\n");
-               break;
-       }
-
-       return 0;
-}
-#endif                         /* ENABLE_PM */
-
 static int wlan_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
        int ret = 0;
        wlan_private *priv = dev->priv;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_NET);
 
-       if (priv->wlan_dev.dnld_sent || priv->adapter->TxLockFlag) {
+       if (priv->dnld_sent || priv->adapter->TxLockFlag) {
                priv->stats.tx_dropped++;
                goto done;
        }
 
-       netif_stop_queue(priv->wlan_dev.netdev);
+       netif_stop_queue(priv->dev);
+       netif_stop_queue(priv->mesh_dev);
 
        if (libertas_process_tx(priv, skb) == 0)
                dev->trans_start = jiffies;
 done:
-       LEAVE();
+       lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret);
        return ret;
 }
 
@@ -513,33 +390,43 @@ done:
 static int mesh_pre_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
        wlan_private *priv = dev->priv;
-       ENTER();
+       int ret;
+
+       lbs_deb_enter(LBS_DEB_MESH);
+
        SET_MESH_FRAME(skb);
-       LEAVE();
 
-       return wlan_hard_start_xmit(skb, priv->wlan_dev.netdev);
+       ret = wlan_hard_start_xmit(skb, priv->dev);
+       lbs_deb_leave_args(LBS_DEB_MESH, "ret %d", ret);
+       return ret;
 }
 
 /**
  * @brief Mark non-mesh packets and handover them to wlan_hard_start_xmit
  *
  */
-static int wlan_pre_start_xmit(struct sk_buff *skb, struct net_device *dev) {
-       ENTER();
+static int wlan_pre_start_xmit(struct sk_buff *skb, struct net_device *dev)
+{
+       int ret;
+
+       lbs_deb_enter(LBS_DEB_NET);
+
        UNSET_MESH_FRAME(skb);
-       LEAVE();
-       return wlan_hard_start_xmit(skb, dev);
+
+       ret = wlan_hard_start_xmit(skb, dev);
+       lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret);
+       return ret;
 }
 
 static void wlan_tx_timeout(struct net_device *dev)
 {
        wlan_private *priv = (wlan_private *) dev->priv;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_TX);
 
-       lbs_pr_err("tx watch dog timeout!\n");
+       lbs_pr_err("tx watch dog timeout\n");
 
-       priv->wlan_dev.dnld_sent = DNLD_RES_RECEIVED;
+       priv->dnld_sent = DNLD_RES_RECEIVED;
        dev->trans_start = jiffies;
 
        if (priv->adapter->currenttxskb) {
@@ -550,10 +437,12 @@ static void wlan_tx_timeout(struct net_device *dev)
                        libertas_send_tx_feedback(priv);
                } else
                        wake_up_interruptible(&priv->mainthread.waitq);
-       } else if (priv->adapter->connect_status == libertas_connected)
-               netif_wake_queue(priv->wlan_dev.netdev);
+       } else if (priv->adapter->connect_status == libertas_connected) {
+               netif_wake_queue(priv->dev);
+               netif_wake_queue(priv->mesh_dev);
+       }
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_TX);
 }
 
 /**
@@ -576,7 +465,10 @@ static int wlan_set_mac_address(struct net_device *dev, void *addr)
        wlan_adapter *adapter = priv->adapter;
        struct sockaddr *phwaddr = addr;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_NET);
+
+       /* In case it was called from the mesh device */
+       dev = priv->dev ;
 
        memset(adapter->current_addr, 0, ETH_ALEN);
 
@@ -591,17 +483,18 @@ static int wlan_set_mac_address(struct net_device *dev, void *addr)
                                    cmd_option_waitforrsp, 0, NULL);
 
        if (ret) {
-               lbs_pr_debug(1, "set mac address failed.\n");
+               lbs_deb_net("set MAC address failed\n");
                ret = -1;
                goto done;
        }
 
        lbs_dbg_hex("adapter->macaddr:", adapter->current_addr, ETH_ALEN);
        memcpy(dev->dev_addr, adapter->current_addr, ETH_ALEN);
-       memcpy(((wlan_private *) dev->priv)->mesh_dev->dev_addr, adapter->current_addr, ETH_ALEN);
+       if (priv->mesh_dev)
+               memcpy(priv->mesh_dev->dev_addr, adapter->current_addr, ETH_ALEN);
 
 done:
-       LEAVE();
+       lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret);
        return ret;
 }
 
@@ -626,12 +519,12 @@ static void wlan_set_multicast_list(struct net_device *dev)
        wlan_adapter *adapter = priv->adapter;
        int oldpacketfilter;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_NET);
 
        oldpacketfilter = adapter->currentpacketfilter;
 
        if (dev->flags & IFF_PROMISC) {
-               lbs_pr_debug(1, "enable Promiscuous mode\n");
+               lbs_deb_net("enable promiscuous mode\n");
                adapter->currentpacketfilter |=
                    cmd_act_mac_promiscuous_enable;
                adapter->currentpacketfilter &=
@@ -644,7 +537,7 @@ static void wlan_set_multicast_list(struct net_device *dev)
 
                if (dev->flags & IFF_ALLMULTI || dev->mc_count >
                    MRVDRV_MAX_MULTICAST_LIST_SIZE) {
-                       lbs_pr_debug(1, "Enabling All Multicast!\n");
+                       lbs_deb_net( "enabling all multicast\n");
                        adapter->currentpacketfilter |=
                            cmd_act_mac_all_multicast_enable;
                        adapter->currentpacketfilter &=
@@ -654,8 +547,8 @@ static void wlan_set_multicast_list(struct net_device *dev)
                            ~cmd_act_mac_all_multicast_enable;
 
                        if (!dev->mc_count) {
-                               lbs_pr_debug(1, "No multicast addresses - "
-                                      "disabling multicast!\n");
+                               lbs_deb_net("no multicast addresses, "
+                                      "disabling multicast\n");
                                adapter->currentpacketfilter &=
                                    ~cmd_act_mac_multicast_enable;
                        } else {
@@ -667,12 +560,12 @@ static void wlan_set_multicast_list(struct net_device *dev)
                                adapter->nr_of_multicastmacaddr =
                                    wlan_copy_multicast_address(adapter, dev);
 
-                               lbs_pr_debug(1, "Multicast addresses: %d\n",
+                               lbs_deb_net("multicast addresses: %d\n",
                                       dev->mc_count);
 
                                for (i = 0; i < dev->mc_count; i++) {
-                                       lbs_pr_debug(1, "Multicast address %d:"
-                                              "%x %x %x %x %x %x\n", i,
+                                       lbs_deb_net("Multicast address %d:"
+                                              MAC_FMT "\n", i,
                                               adapter->multicastlist[i][0],
                                               adapter->multicastlist[i][1],
                                               adapter->multicastlist[i][2],
@@ -680,7 +573,7 @@ static void wlan_set_multicast_list(struct net_device *dev)
                                               adapter->multicastlist[i][4],
                                               adapter->multicastlist[i][5]);
                                }
-                               /* set multicast addresses to firmware */
+                               /* send multicast addresses to firmware */
                                libertas_prepare_and_send_command(priv,
                                                      cmd_mac_multicast_adr,
                                                      cmd_act_set, 0, 0,
@@ -693,13 +586,13 @@ static void wlan_set_multicast_list(struct net_device *dev)
                libertas_set_mac_packet_filter(priv);
        }
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_NET);
 }
 
 /**
- *  @brief This function hanldes the major job in WLAN driver.
- *  it handles the event generated by firmware, rx data received
- *  from firmware and tx data sent from kernel.
+ *  @brief This function handles the major jobs in the WLAN driver.
+ *  It handles all events generated by firmware, RX data received
+ *  from firmware and TX data sent from kernel.
  *
  *  @param data    A pointer to wlan_thread structure
  *  @return       0
@@ -712,26 +605,26 @@ static int wlan_service_main_thread(void *data)
        wait_queue_t wait;
        u8 ireg = 0;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_THREAD);
 
        wlan_activate_thread(thread);
 
        init_waitqueue_entry(&wait, current);
 
        for (;;) {
-               lbs_pr_debug(1, "main-thread 111: intcounter=%d "
+               lbs_deb_thread( "main-thread 111: intcounter=%d "
                       "currenttxskb=%p dnld_sent=%d\n",
                       adapter->intcounter,
-                      adapter->currenttxskb, priv->wlan_dev.dnld_sent);
+                      adapter->currenttxskb, priv->dnld_sent);
 
                add_wait_queue(&thread->waitq, &wait);
                set_current_state(TASK_INTERRUPTIBLE);
                spin_lock_irq(&adapter->driver_lock);
                if ((adapter->psstate == PS_STATE_SLEEP) ||
                    (!adapter->intcounter
-                    && (priv->wlan_dev.dnld_sent || adapter->cur_cmd ||
+                    && (priv->dnld_sent || adapter->cur_cmd ||
                         list_empty(&adapter->cmdpendingq)))) {
-                       lbs_pr_debug(1,
+                       lbs_deb_thread(
                               "main-thread sleeping... Conn=%d IntC=%d PS_mode=%d PS_State=%d\n",
                               adapter->connect_status, adapter->intcounter,
                               adapter->psmode, adapter->psstate);
@@ -741,23 +634,23 @@ static int wlan_service_main_thread(void *data)
                        spin_unlock_irq(&adapter->driver_lock);
 
 
-               lbs_pr_debug(1,
+               lbs_deb_thread(
                       "main-thread 222 (waking up): intcounter=%d currenttxskb=%p "
                       "dnld_sent=%d\n", adapter->intcounter,
-                      adapter->currenttxskb, priv->wlan_dev.dnld_sent);
+                      adapter->currenttxskb, priv->dnld_sent);
 
                set_current_state(TASK_RUNNING);
                remove_wait_queue(&thread->waitq, &wait);
                try_to_freeze();
 
-               lbs_pr_debug(1, "main-thread 333: intcounter=%d currenttxskb=%p "
+               lbs_deb_thread("main-thread 333: intcounter=%d currenttxskb=%p "
                       "dnld_sent=%d\n",
                       adapter->intcounter,
-                      adapter->currenttxskb, priv->wlan_dev.dnld_sent);
+                      adapter->currenttxskb, priv->dnld_sent);
 
                if (kthread_should_stop()
                    || adapter->surpriseremoved) {
-                       lbs_pr_debug(1,
+                       lbs_deb_thread(
                               "main-thread: break from main thread: surpriseremoved=0x%x\n",
                               adapter->surpriseremoved);
                        break;
@@ -768,10 +661,10 @@ static int wlan_service_main_thread(void *data)
                if (adapter->intcounter) {
                        u8 int_status;
                        adapter->intcounter = 0;
-                       int_status = libertas_sbi_get_int_status(priv, &ireg);
+                       int_status = priv->hw_get_int_status(priv, &ireg);
 
                        if (int_status) {
-                               lbs_pr_debug(1,
+                               lbs_deb_thread(
                                       "main-thread: reading HOST_INT_STATUS_REG failed\n");
                                spin_unlock_irq(&adapter->driver_lock);
                                continue;
@@ -779,14 +672,14 @@ static int wlan_service_main_thread(void *data)
                        adapter->hisregcpy |= ireg;
                }
 
-               lbs_pr_debug(1, "main-thread 444: intcounter=%d currenttxskb=%p "
+               lbs_deb_thread("main-thread 444: intcounter=%d currenttxskb=%p "
                       "dnld_sent=%d\n",
                       adapter->intcounter,
-                      adapter->currenttxskb, priv->wlan_dev.dnld_sent);
+                      adapter->currenttxskb, priv->dnld_sent);
 
                /* command response? */
                if (adapter->hisregcpy & his_cmdupldrdy) {
-                       lbs_pr_debug(1, "main-thread: cmd response ready.\n");
+                       lbs_deb_thread("main-thread: cmd response ready\n");
 
                        adapter->hisregcpy &= ~his_cmdupldrdy;
                        spin_unlock_irq(&adapter->driver_lock);
@@ -796,13 +689,13 @@ static int wlan_service_main_thread(void *data)
 
                /* Any Card Event */
                if (adapter->hisregcpy & his_cardevent) {
-                       lbs_pr_debug(1, "main-thread: Card Event Activity.\n");
+                       lbs_deb_thread("main-thread: Card Event Activity\n");
 
                        adapter->hisregcpy &= ~his_cardevent;
 
-                       if (libertas_sbi_read_event_cause(priv)) {
+                       if (priv->hw_read_event_cause(priv)) {
                                lbs_pr_alert(
-                                      "main-thread: libertas_sbi_read_event_cause failed.\n");
+                                      "main-thread: hw_read_event_cause failed\n");
                                spin_unlock_irq(&adapter->driver_lock);
                                continue;
                        }
@@ -813,15 +706,15 @@ static int wlan_service_main_thread(void *data)
 
                /* Check if we need to confirm Sleep Request received previously */
                if (adapter->psstate == PS_STATE_PRE_SLEEP) {
-                       if (!priv->wlan_dev.dnld_sent && !adapter->cur_cmd) {
+                       if (!priv->dnld_sent && !adapter->cur_cmd) {
                                if (adapter->connect_status ==
                                    libertas_connected) {
-                                       lbs_pr_debug(1,
+                                       lbs_deb_thread(
                                               "main_thread: PRE_SLEEP--intcounter=%d currenttxskb=%p "
                                               "dnld_sent=%d cur_cmd=%p, confirm now\n",
                                               adapter->intcounter,
                                               adapter->currenttxskb,
-                                              priv->wlan_dev.dnld_sent,
+                                              priv->dnld_sent,
                                               adapter->cur_cmd);
 
                                        libertas_ps_confirm_sleep(priv,
@@ -847,7 +740,7 @@ static int wlan_service_main_thread(void *data)
                        continue;
 
                /* Execute the next command */
-               if (!priv->wlan_dev.dnld_sent && !priv->adapter->cur_cmd)
+               if (!priv->dnld_sent && !priv->adapter->cur_cmd)
                        libertas_execute_next_command(priv);
 
                /* Wake-up command waiters which can't sleep in
@@ -864,7 +757,7 @@ static int wlan_service_main_thread(void *data)
        wake_up_all(&adapter->cmd_pending);
        wlan_deactivate_thread(thread);
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_THREAD);
        return 0;
 }
 
@@ -875,49 +768,32 @@ static int wlan_service_main_thread(void *data)
  *  @param card    A pointer to card
  *  @return       A pointer to wlan_private structure
  */
-wlan_private *wlan_add_card(void *card)
+wlan_private *libertas_add_card(void *card, struct device *dmdev)
 {
        struct net_device *dev = NULL;
-       struct net_device *mesh_dev = NULL;
        wlan_private *priv = NULL;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_NET);
 
        /* Allocate an Ethernet device and register it */
        if (!(dev = alloc_etherdev(sizeof(wlan_private)))) {
-               lbs_pr_alert( "Init ethernet device failed!\n");
+               lbs_pr_err("init ethX device failed\n");
                return NULL;
        }
-
        priv = dev->priv;
 
        /* allocate buffer for wlan_adapter */
-       if (!(priv->adapter = kmalloc(sizeof(wlan_adapter), GFP_KERNEL))) {
-               lbs_pr_alert( "Allocate buffer for wlan_adapter failed!\n");
-               goto err_kmalloc;
-       }
-
-       /* Allocate a virtual mesh device */
-       if (!(mesh_dev = alloc_netdev(0, "msh%d", ether_setup))) {
-               lbs_pr_debug(1, "Init ethernet device failed!\n");
-               return NULL;
+       if (!(priv->adapter = kzalloc(sizeof(wlan_adapter), GFP_KERNEL))) {
+               lbs_pr_err("allocate buffer for wlan_adapter failed\n");
+               goto err_kzalloc;
        }
 
-       /* Both intervaces share the priv structure */
-       mesh_dev->priv = priv;
-
-       /* init wlan_adapter */
-       memset(priv->adapter, 0, sizeof(wlan_adapter));
-
-       priv->wlan_dev.netdev = dev;
-       priv->wlan_dev.card = card;
+       priv->dev = dev;
+       priv->card = card;
        priv->mesh_open = 0;
        priv->infra_open = 0;
-       priv->mesh_dev = mesh_dev;
-       wlanpriv = priv;
 
        SET_MODULE_OWNER(dev);
-       SET_MODULE_OWNER(mesh_dev);
 
        /* Setup the OS Interface to our functions */
        dev->open = wlan_open;
@@ -925,116 +801,172 @@ wlan_private *wlan_add_card(void *card)
        dev->stop = wlan_close;
        dev->do_ioctl = libertas_do_ioctl;
        dev->set_mac_address = wlan_set_mac_address;
-       mesh_dev->open = mesh_open;
-       mesh_dev->hard_start_xmit = mesh_pre_start_xmit;
-       mesh_dev->stop = mesh_close;
-       mesh_dev->do_ioctl = libertas_do_ioctl;
-       memcpy(mesh_dev->dev_addr, wlanpriv->wlan_dev.netdev->dev_addr,
-                       sizeof(wlanpriv->wlan_dev.netdev->dev_addr));
-
-#define        WLAN_WATCHDOG_TIMEOUT   (5 * HZ)
-
        dev->tx_timeout = wlan_tx_timeout;
        dev->get_stats = wlan_get_stats;
-       dev->watchdog_timeo = WLAN_WATCHDOG_TIMEOUT;
+       dev->watchdog_timeo = 5 * HZ;
        dev->ethtool_ops = &libertas_ethtool_ops;
-       mesh_dev->get_stats = wlan_get_stats;
-       mesh_dev->ethtool_ops = &libertas_ethtool_ops;
-
 #ifdef WIRELESS_EXT
        dev->wireless_handlers = (struct iw_handler_def *)&libertas_handler_def;
-       mesh_dev->wireless_handlers = (struct iw_handler_def *)&libertas_handler_def;
 #endif
 #define NETIF_F_DYNALLOC 16
        dev->features |= NETIF_F_DYNALLOC;
        dev->flags |= IFF_BROADCAST | IFF_MULTICAST;
        dev->set_multicast_list = wlan_set_multicast_list;
 
+       SET_NETDEV_DEV(dev, dmdev);
+
        INIT_LIST_HEAD(&priv->adapter->cmdfreeq);
        INIT_LIST_HEAD(&priv->adapter->cmdpendingq);
 
        spin_lock_init(&priv->adapter->driver_lock);
        init_waitqueue_head(&priv->adapter->cmd_pending);
        priv->adapter->nr_cmd_pending = 0;
+       goto done;
 
-       lbs_pr_debug(1, "Starting kthread...\n");
+err_kzalloc:
+       free_netdev(dev);
+       priv = NULL;
+done:
+       lbs_deb_leave_args(LBS_DEB_NET, "priv %p", priv);
+       return priv;
+}
+EXPORT_SYMBOL_GPL(libertas_add_card);
+
+int libertas_activate_card(wlan_private *priv, char *fw_name)
+{
+       struct net_device *dev = priv->dev;
+       int ret = -1;
+
+       lbs_deb_enter(LBS_DEB_MAIN);
+
+       lbs_deb_thread("Starting kthread...\n");
        priv->mainthread.priv = priv;
        wlan_create_thread(wlan_service_main_thread,
                           &priv->mainthread, "wlan_main_service");
 
        priv->assoc_thread =
                create_singlethread_workqueue("libertas_assoc");
-       INIT_DELAYED_WORK(&priv->assoc_work, wlan_association_worker);
+       INIT_DELAYED_WORK(&priv->assoc_work, libertas_association_worker);
+       INIT_WORK(&priv->sync_channel, libertas_sync_channel);
 
        /*
         * Register the device. Fillup the private data structure with
         * relevant information from the card and request for the required
         * IRQ.
         */
-       if (libertas_sbi_register_dev(priv) < 0) {
-               lbs_pr_info("failed to register wlan device!\n");
+       if (priv->hw_register_dev(priv) < 0) {
+               lbs_pr_err("failed to register WLAN device\n");
                goto err_registerdev;
        }
 
        /* init FW and HW */
-       if (libertas_init_fw(priv)) {
-               lbs_pr_debug(1, "Firmware Init failed\n");
+       if (fw_name && libertas_init_fw(priv, fw_name)) {
+               lbs_pr_err("firmware init failed\n");
                goto err_registerdev;
        }
 
        if (register_netdev(dev)) {
-               lbs_pr_err("Cannot register network device!\n");
-               goto err_init_fw;
-       }
-
-       /* Register virtual mesh interface */
-       if (register_netdev(mesh_dev)) {
-               lbs_pr_info("Cannot register mesh virtual interface!\n");
+               lbs_pr_err("cannot register ethX device\n");
                goto err_init_fw;
        }
 
-       lbs_pr_info("%s: Marvell Wlan 802.11 adapter ", dev->name);
+       lbs_pr_info("%s: Marvell WLAN 802.11 adapter\n", dev->name);
 
        libertas_debugfs_init_one(priv, dev);
 
-       if (libertas_found == MAX_DEVS)
-               goto err_init_fw;
-       libertas_devs[libertas_found] = dev;
-       libertas_found++;
-#ifdef ENABLE_PM
-       if (!(wlan_pm_dev = pm_register(PM_UNKNOWN_DEV, 0, wlan_pm_callback)))
-               lbs_pr_alert( "failed to register PM callback\n");
-#endif
-       if (device_create_file(&(mesh_dev->dev), &dev_attr_libertas_mpp))
-               goto err_create_file;
-
-       LEAVE();
-       return priv;
+       ret = 0;
+       goto done;
 
-err_create_file:
-       device_remove_file(&(mesh_dev->dev), &dev_attr_libertas_mpp);
 err_init_fw:
-       libertas_sbi_unregister_dev(priv);
+       priv->hw_unregister_dev(priv);
 err_registerdev:
        destroy_workqueue(priv->assoc_thread);
        /* Stop the thread servicing the interrupts */
        wake_up_interruptible(&priv->mainthread.waitq);
        wlan_terminate_thread(&priv->mainthread);
-       kfree(priv->adapter);
-err_kmalloc:
-       free_netdev(dev);
+done:
+       lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret);
+       return ret;
+}
+EXPORT_SYMBOL_GPL(libertas_activate_card);
+
+
+/**
+ * @brief This function adds mshX interface
+ *
+ *  @param priv    A pointer to the wlan_private structure
+ *  @return       0 if successful, -X otherwise
+ */
+int libertas_add_mesh(wlan_private *priv, struct device *dev)
+{
+       struct net_device *mesh_dev = NULL;
+       int ret = 0;
+
+       lbs_deb_enter(LBS_DEB_MESH);
+
+       /* Allocate a virtual mesh device */
+       if (!(mesh_dev = alloc_netdev(0, "msh%d", ether_setup))) {
+               lbs_deb_mesh("init mshX device failed\n");
+               ret = -ENOMEM;
+               goto done;
+       }
+       mesh_dev->priv = priv;
+       priv->mesh_dev = mesh_dev;
+
+       SET_MODULE_OWNER(mesh_dev);
+
+       mesh_dev->open = mesh_open;
+       mesh_dev->hard_start_xmit = mesh_pre_start_xmit;
+       mesh_dev->stop = mesh_close;
+       mesh_dev->do_ioctl = libertas_do_ioctl;
+       mesh_dev->get_stats = wlan_get_stats;
+       mesh_dev->set_mac_address = wlan_set_mac_address;
+       mesh_dev->ethtool_ops = &libertas_ethtool_ops;
+       memcpy(mesh_dev->dev_addr, priv->dev->dev_addr,
+                       sizeof(priv->dev->dev_addr));
+
+       SET_NETDEV_DEV(priv->mesh_dev, dev);
+
+#ifdef WIRELESS_EXT
+       mesh_dev->wireless_handlers = (struct iw_handler_def *)&mesh_handler_def;
+#endif
+#define NETIF_F_DYNALLOC 16
+
+       /* Register virtual mesh interface */
+       ret = register_netdev(mesh_dev);
+       if (ret) {
+               lbs_pr_err("cannot register mshX virtual interface\n");
+               goto err_free;
+       }
+
+       ret = device_create_file(&(mesh_dev->dev), &dev_attr_anycast_mask);
+       if (ret)
+               goto err_unregister;
+
+       /* Everything successful */
+       ret = 0;
+       goto done;
+
+
+err_unregister:
+       unregister_netdev(mesh_dev);
+
+err_free:
        free_netdev(mesh_dev);
-       wlanpriv = NULL;
 
-       LEAVE();
-       return NULL;
+done:
+       lbs_deb_leave_args(LBS_DEB_MESH, "ret %d", ret);
+       return ret;
 }
+EXPORT_SYMBOL_GPL(libertas_add_mesh);
 
 static void wake_pending_cmdnodes(wlan_private *priv)
 {
        struct cmd_ctrl_node *cmdnode;
        unsigned long flags;
 
+       lbs_deb_enter(LBS_DEB_CMD);
+
        spin_lock_irqsave(&priv->adapter->driver_lock, flags);
        list_for_each_entry(cmdnode, &priv->adapter->cmdpendingq, list) {
                cmdnode->cmdwaitqwoken = 1;
@@ -1044,40 +976,29 @@ static void wake_pending_cmdnodes(wlan_private *priv)
 }
 
 
-int wlan_remove_card(void *card)
+int libertas_remove_card(wlan_private *priv)
 {
-       wlan_private *priv = libertas_sbi_get_priv(card);
        wlan_adapter *adapter;
        struct net_device *dev;
-       struct net_device *mesh_dev;
        union iwreq_data wrqu;
-       int i;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_NET);
 
-       if (!priv) {
-               LEAVE();
-               return 0;
-       }
+       if (!priv)
+               goto out;
 
        adapter = priv->adapter;
 
-       if (!adapter) {
-               LEAVE();
-               return 0;
-       }
+       if (!adapter)
+               goto out;
 
-       dev = priv->wlan_dev.netdev;
-       mesh_dev = priv->mesh_dev;
+       dev = priv->dev;
 
-       netif_stop_queue(mesh_dev);
-       netif_stop_queue(priv->wlan_dev.netdev);
-       netif_carrier_off(priv->wlan_dev.netdev);
+       netif_stop_queue(priv->dev);
+       netif_carrier_off(priv->dev);
 
        wake_pending_cmdnodes(priv);
 
-       device_remove_file(&(mesh_dev->dev), &dev_attr_libertas_mpp);
-       unregister_netdev(mesh_dev);
        unregister_netdev(dev);
 
        cancel_delayed_work(&priv->assoc_work);
@@ -1090,11 +1011,7 @@ int wlan_remove_card(void *card)
 
        memset(wrqu.ap_addr.sa_data, 0xaa, ETH_ALEN);
        wrqu.ap_addr.sa_family = ARPHRD_ETHER;
-       wireless_send_event(priv->wlan_dev.netdev, SIOCGIWAP, &wrqu, NULL);
-
-#ifdef ENABLE_PM
-       pm_unregister(wlan_pm_dev);
-#endif
+       wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);
 
        adapter->surpriseremoved = 1;
 
@@ -1103,28 +1020,45 @@ int wlan_remove_card(void *card)
 
        libertas_debugfs_remove_one(priv);
 
-       lbs_pr_debug(1, "Free adapter\n");
+       lbs_deb_net("free adapter\n");
        libertas_free_adapter(priv);
 
-       for (i = 0; i<libertas_found; i++) {
-               if (libertas_devs[i]==priv->wlan_dev.netdev) {
-                       libertas_devs[i] = libertas_devs[--libertas_found];
-                       libertas_devs[libertas_found] = NULL ;
-                       break ;
-               }
-       }
+       lbs_deb_net("unregister finish\n");
+
+       priv->dev = NULL;
+       free_netdev(dev);
+
+out:
+       lbs_deb_leave(LBS_DEB_NET);
+       return 0;
+}
+EXPORT_SYMBOL_GPL(libertas_remove_card);
+
+
+void libertas_remove_mesh(wlan_private *priv)
+{
+       struct net_device *mesh_dev;
+
+       lbs_deb_enter(LBS_DEB_NET);
+
+       if (!priv)
+               goto out;
+
+       mesh_dev = priv->mesh_dev;
+
+       netif_stop_queue(mesh_dev);
+       netif_carrier_off(priv->mesh_dev);
 
-       lbs_pr_debug(1, "Unregister finish\n");
+       device_remove_file(&(mesh_dev->dev), &dev_attr_anycast_mask);
+       unregister_netdev(mesh_dev);
 
-       priv->wlan_dev.netdev = NULL;
        priv->mesh_dev = NULL ;
        free_netdev(mesh_dev);
-       free_netdev(dev);
-       wlanpriv = NULL;
 
-       LEAVE();
-       return 0;
+out:
+       lbs_deb_leave(LBS_DEB_NET);
 }
+EXPORT_SYMBOL_GPL(libertas_remove_mesh);
 
 /**
  *  @brief This function finds the CFP in
@@ -1139,33 +1073,34 @@ struct chan_freq_power *libertas_get_region_cfp_table(u8 region, u8 band, int *c
 {
        int i, end;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_MAIN);
 
        end = sizeof(region_cfp_table)/sizeof(struct region_cfp_table);
 
        for (i = 0; i < end ; i++) {
-               lbs_pr_debug(1, "region_cfp_table[i].region=%d\n",
+               lbs_deb_main("region_cfp_table[i].region=%d\n",
                        region_cfp_table[i].region);
                if (region_cfp_table[i].region == region) {
                        *cfp_no = region_cfp_table[i].cfp_no_BG;
-                       LEAVE();
+                       lbs_deb_leave(LBS_DEB_MAIN);
                        return region_cfp_table[i].cfp_BG;
                }
        }
 
-       LEAVE();
+       lbs_deb_leave_args(LBS_DEB_MAIN, "ret NULL");
        return NULL;
 }
 
 int libertas_set_regiontable(wlan_private * priv, u8 region, u8 band)
 {
        wlan_adapter *adapter = priv->adapter;
+       int ret = 0;
        int i = 0;
 
        struct chan_freq_power *cfp;
        int cfp_no;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_MAIN);
 
        memset(adapter->region_channel, 0, sizeof(adapter->region_channel));
 
@@ -1175,17 +1110,19 @@ int libertas_set_regiontable(wlan_private * priv, u8 region, u8 band)
                        adapter->region_channel[i].nrcfp = cfp_no;
                        adapter->region_channel[i].CFP = cfp;
                } else {
-                       lbs_pr_debug(1, "wrong region code %#x in band B-G\n",
+                       lbs_deb_main("wrong region code %#x in band B/G\n",
                               region);
-                       return -1;
+                       ret = -1;
+                       goto out;
                }
                adapter->region_channel[i].valid = 1;
                adapter->region_channel[i].region = region;
                adapter->region_channel[i].band = band;
                i++;
        }
-       LEAVE();
-       return 0;
+out:
+       lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret);
+       return ret;
 }
 
 /**
@@ -1200,9 +1137,9 @@ void libertas_interrupt(struct net_device *dev)
 {
        wlan_private *priv = dev->priv;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_THREAD);
 
-       lbs_pr_debug(1, "libertas_interrupt: intcounter=%d\n",
+       lbs_deb_thread("libertas_interrupt: intcounter=%d\n",
               priv->adapter->intcounter);
 
        priv->adapter->intcounter++;
@@ -1210,56 +1147,35 @@ void libertas_interrupt(struct net_device *dev)
        if (priv->adapter->psstate == PS_STATE_SLEEP) {
                priv->adapter->psstate = PS_STATE_AWAKE;
                netif_wake_queue(dev);
+               netif_wake_queue(priv->mesh_dev);
        }
 
        wake_up_interruptible(&priv->mainthread.waitq);
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_THREAD);
 }
+EXPORT_SYMBOL_GPL(libertas_interrupt);
 
-static int wlan_init_module(void)
+static int libertas_init_module(void)
 {
-       int ret = 0;
-
-       ENTER();
-
-       if (libertas_fw_name == NULL) {
-               libertas_fw_name = default_fw_name;
-       }
-
+       lbs_deb_enter(LBS_DEB_MAIN);
        libertas_debugfs_init();
-
-       if (libertas_sbi_register()) {
-               ret = -1;
-               libertas_debugfs_remove();
-               goto done;
-       }
-
-done:
-       LEAVE();
-       return ret;
+       lbs_deb_leave(LBS_DEB_MAIN);
+       return 0;
 }
 
-static void wlan_cleanup_module(void)
+static void libertas_exit_module(void)
 {
-       int i;
-
-       ENTER();
-
-       for (i = 0; i<libertas_found; i++) {
-               wlan_private *priv = libertas_devs[i]->priv;
-               reset_device(priv);
-       }
+       lbs_deb_enter(LBS_DEB_MAIN);
 
-       libertas_sbi_unregister();
        libertas_debugfs_remove();
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_MAIN);
 }
 
-module_init(wlan_init_module);
-module_exit(wlan_cleanup_module);
+module_init(libertas_init_module);
+module_exit(libertas_exit_module);
 
-MODULE_DESCRIPTION("M-WLAN Driver");
+MODULE_DESCRIPTION("Libertas WLAN Driver Library");
 MODULE_AUTHOR("Marvell International Ltd.");
 MODULE_LICENSE("GPL");
index 96619a32951bc9dc14904dd3267c13c25d5f7189..88d9d2d787d5ae38486736c4e5876c639145fb3f 100644 (file)
@@ -106,10 +106,10 @@ static void wlan_compute_rssi(wlan_private * priv, struct rxpd *p_rx_pd)
 {
        wlan_adapter *adapter = priv->adapter;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_RX);
 
-       lbs_pr_debug(1, "rxpd: SNR = %d, NF = %d\n", p_rx_pd->snr, p_rx_pd->nf);
-       lbs_pr_debug(1, "Before computing SNR: SNR- avg = %d, NF-avg = %d\n",
+       lbs_deb_rx("rxpd: SNR %d, NF %d\n", p_rx_pd->snr, p_rx_pd->nf);
+       lbs_deb_rx("before computing SNR: SNR-avg = %d, NF-avg = %d\n",
               adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
               adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
 
@@ -121,7 +121,7 @@ static void wlan_compute_rssi(wlan_private * priv, struct rxpd *p_rx_pd)
 
        adapter->SNR[TYPE_RXPD][TYPE_AVG] = wlan_getavgsnr(priv) * AVG_SCALE;
        adapter->NF[TYPE_RXPD][TYPE_AVG] = wlan_getavgnf(priv) * AVG_SCALE;
-       lbs_pr_debug(1, "After computing SNR: SNR-avg = %d, NF-avg = %d\n",
+       lbs_deb_rx("after computing SNR: SNR-avg = %d, NF-avg = %d\n",
               adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
               adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
 
@@ -133,18 +133,17 @@ static void wlan_compute_rssi(wlan_private * priv, struct rxpd *p_rx_pd)
            CAL_RSSI(adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
                     adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_RX);
 }
 
 void libertas_upload_rx_packet(wlan_private * priv, struct sk_buff *skb)
 {
-       lbs_pr_debug(1, "skb->data=%p\n", skb->data);
+       lbs_deb_rx("skb->data %p\n", skb->data);
 
-       if(IS_MESH_FRAME(skb))
-               skb->dev = priv->mesh_dev;
+       if (priv->mesh_dev && IS_MESH_FRAME(skb))
+               skb->protocol = eth_type_trans(skb, priv->mesh_dev);
        else
-               skb->dev = priv->wlan_dev.netdev;
-       skb->protocol = eth_type_trans(skb, priv->wlan_dev.netdev);
+               skb->protocol = eth_type_trans(skb, priv->dev);
        skb->ip_summed = CHECKSUM_UNNECESSARY;
 
        netif_rx(skb);
@@ -171,7 +170,7 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
 
        const u8 rfc1042_eth_hdr[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 };
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_RX);
 
        if (priv->adapter->debugmode & MRVDRV_DEBUG_RX_PATH)
                lbs_dbg_hex("RX packet: ", skb->data,
@@ -191,7 +190,7 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
                 min_t(unsigned int, skb->len, 100));
 
        if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) {
-               lbs_pr_debug(1, "RX error: FRAME RECEIVED WITH BAD LENGTH\n");
+               lbs_deb_rx("rx err: frame received with bad length\n");
                priv->stats.rx_length_errors++;
                ret = 0;
                goto done;
@@ -200,15 +199,15 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
        /*
         * Check rxpd status and update 802.3 stat,
         */
-       if (!(p_rx_pd->status & MRVDRV_RXPD_STATUS_OK)) {
-               lbs_pr_debug(1, "RX error: frame received with bad status\n");
-               lbs_pr_alert("rxpd Not OK\n");
+       if (!(p_rx_pd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK))) {
+               lbs_deb_rx("rx err: frame received with bad status\n");
+               lbs_pr_alert("rxpd not ok\n");
                priv->stats.rx_errors++;
                ret = 0;
                goto done;
        }
 
-       lbs_pr_debug(1, "RX Data: skb->len - sizeof(RxPd) = %d - %zd = %zd\n",
+       lbs_deb_rx("rx data: skb->len-sizeof(RxPd) = %d-%zd = %zd\n",
               skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd));
 
        lbs_dbg_hex("RX Data: Dest", p_rx_pkt->eth803_hdr.dest_addr,
@@ -266,7 +265,7 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
 
        wlan_compute_rssi(priv, p_rx_pd);
 
-       lbs_pr_debug(1, "RX Data: size of actual packet = %d\n", skb->len);
+       lbs_deb_rx("rx data: size of actual packet %d\n", skb->len);
        priv->stats.rx_bytes += skb->len;
        priv->stats.rx_packets++;
 
@@ -274,10 +273,10 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
 
        ret = 0;
 done:
-       LEAVE();
-
+       lbs_deb_leave_args(LBS_DEB_RX, "ret %d", ret);
        return ret;
 }
+EXPORT_SYMBOL_GPL(libertas_process_rxed_packet);
 
 /**
  *  @brief This function converts Tx/Rx rates from the Marvell WLAN format
@@ -314,7 +313,7 @@ static u8 convert_mv_rate_to_radiotap(u8 rate)
        case 11:                /*  54 Mbps */
                return 108;
        }
-       lbs_pr_alert( "Invalid Marvell WLAN rate (%i)\n", rate);
+       lbs_pr_alert("Invalid Marvell WLAN rate %i\n", rate);
        return 0;
 }
 
@@ -336,7 +335,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
        struct rx_radiotap_hdr radiotap_hdr;
        struct rx_radiotap_hdr *pradiotap_hdr;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_RX);
 
        p_rx_pkt = (struct rx80211packethdr *) skb->data;
        prxpd = &p_rx_pkt->rx_pd;
@@ -344,7 +343,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
        // lbs_dbg_hex("RX Data: Before chop rxpd", skb->data, min(skb->len, 100));
 
        if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) {
-               lbs_pr_debug(1, "RX error: FRAME RECEIVED WITH BAD LENGTH\n");
+               lbs_deb_rx("rx err: frame received wit bad length\n");
                priv->stats.rx_length_errors++;
                ret = 0;
                goto done;
@@ -353,12 +352,12 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
        /*
         * Check rxpd status and update 802.3 stat,
         */
-       if (!(prxpd->status & MRVDRV_RXPD_STATUS_OK)) {
-               //lbs_pr_debug(1, "RX error: frame received with bad status\n");
+       if (!(prxpd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK))) {
+               //lbs_deb_rx("rx err: frame received with bad status\n");
                priv->stats.rx_errors++;
        }
 
-       lbs_pr_debug(1, "RX Data: skb->len - sizeof(RxPd) = %d - %zd = %zd\n",
+       lbs_deb_rx("rx data: skb->len-sizeof(RxPd) = %d-%zd = %zd\n",
               skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd));
 
        /* create the exported radio header */
@@ -386,7 +385,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
                /* XXX must check no carryout */
                radiotap_hdr.antsignal = prxpd->snr + prxpd->nf;
                radiotap_hdr.rx_flags = 0;
-               if (!(prxpd->status & MRVDRV_RXPD_STATUS_OK))
+               if (!(prxpd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK)))
                        radiotap_hdr.rx_flags |= IEEE80211_RADIOTAP_F_RX_BADFCS;
                //memset(radiotap_hdr.pad, 0x11, IEEE80211_RADIOTAP_HDRLEN - 18);
 
@@ -399,7 +398,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
                if ((skb_headroom(skb) < sizeof(struct rx_radiotap_hdr)) &&
                    pskb_expand_head(skb, sizeof(struct rx_radiotap_hdr), 0,
                                     GFP_ATOMIC)) {
-                       lbs_pr_alert( "%s: couldn't pskb_expand_head\n",
+                       lbs_pr_alert("%s: couldn't pskb_expand_head\n",
                               __func__);
                }
 
@@ -414,7 +413,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
 
        default:
                /* unknown header */
-               lbs_pr_alert( "Unknown radiomode (%i)\n",
+               lbs_pr_alert("Unknown radiomode %i\n",
                       priv->adapter->radiomode);
                /* don't export any header */
                /* chop the rxpd */
@@ -431,15 +430,16 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
 
        wlan_compute_rssi(priv, prxpd);
 
-       lbs_pr_debug(1, "RX Data: size of actual packet = %d\n", skb->len);
+       lbs_deb_rx("rx data: size of actual packet %d\n", skb->len);
        priv->stats.rx_bytes += skb->len;
        priv->stats.rx_packets++;
 
        libertas_upload_rx_packet(priv, skb);
 
        ret = 0;
-done:
-       LEAVE();
 
-       return (ret);
+done:
+       skb->protocol = __constant_htons(0x0019);       /* ETH_P_80211_RAW */
+       lbs_deb_leave_args(LBS_DEB_RX, "ret %d", ret);
+       return ret;
 }
diff --git a/drivers/net/wireless/libertas/sbi.h b/drivers/net/wireless/libertas/sbi.h
deleted file mode 100644 (file)
index 59d3a59..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
-  * This file contains IF layer definitions.
-  */
-
-#ifndef        _SBI_H_
-#define        _SBI_H_
-
-#include <linux/interrupt.h>
-
-#include "defs.h"
-
-/** INT status Bit Definition*/
-#define his_cmddnldrdy                 0x01
-#define his_cardevent                  0x02
-#define his_cmdupldrdy                 0x04
-
-#ifndef DEV_NAME_LEN
-#define DEV_NAME_LEN                   32
-#endif
-
-#define SBI_EVENT_CAUSE_SHIFT          3
-
-/* Probe and Check if the card is present*/
-int libertas_sbi_register_dev(wlan_private * priv);
-int libertas_sbi_unregister_dev(wlan_private *);
-int libertas_sbi_get_int_status(wlan_private * priv, u8 *);
-int libertas_sbi_register(void);
-void libertas_sbi_unregister(void);
-int libertas_sbi_prog_firmware(wlan_private *);
-
-int libertas_sbi_read_event_cause(wlan_private *);
-int libertas_sbi_host_to_card(wlan_private * priv, u8 type, u8 * payload, u16 nb);
-wlan_private *libertas_sbi_get_priv(void *card);
-
-#ifdef ENABLE_PM
-int libertas_sbi_suspend(wlan_private *);
-int libertas_sbi_resume(wlan_private *);
-#endif
-
-#endif                         /* _SBI_H */
index 3c0b1a2a172748a150a9cec7c8b2f4db195f3cfd..606af50fa09b79584ec4df8ce5617fe22d41f5b9 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/if.h>
 #include <linux/netdevice.h>
 #include <linux/wireless.h>
+#include <linux/etherdevice.h>
 
 #include <net/ieee80211.h>
 #include <net/iw_handler.h>
 //! Scan time specified in the channel TLV for each channel for active scans
 #define MRVDRV_ACTIVE_SCAN_CHAN_TIME   100
 
-//! Macro to enable/disable SSID checking before storing a scan table
-#ifdef DISCARD_BAD_SSID
-#define CHECK_SSID_IS_VALID(x) ssid_valid(&bssidEntry.ssid)
-#else
-#define CHECK_SSID_IS_VALID(x) 1
-#endif
+static const u8 zeromac[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+static const u8 bcastmac[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
+
+static inline void clear_bss_descriptor (struct bss_descriptor * bss)
+{
+       /* Don't blow away ->list, just BSS data */
+       memset(bss, 0, offsetof(struct bss_descriptor, list));
+}
+
+static inline int match_bss_no_security(struct wlan_802_11_security * secinfo,
+                       struct bss_descriptor * match_bss)
+{
+       if (   !secinfo->wep_enabled
+           && !secinfo->WPAenabled
+           && !secinfo->WPA2enabled
+           && match_bss->wpa_ie[0] != WPA_IE
+           && match_bss->rsn_ie[0] != WPA2_IE
+           && !match_bss->privacy) {
+               return 1;
+       }
+       return 0;
+}
+
+static inline int match_bss_static_wep(struct wlan_802_11_security * secinfo,
+                       struct bss_descriptor * match_bss)
+{
+       if ( secinfo->wep_enabled
+          && !secinfo->WPAenabled
+          && !secinfo->WPA2enabled
+          && match_bss->privacy) {
+               return 1;
+       }
+       return 0;
+}
+
+static inline int match_bss_wpa(struct wlan_802_11_security * secinfo,
+                       struct bss_descriptor * match_bss)
+{
+       if (  !secinfo->wep_enabled
+          && secinfo->WPAenabled
+          && (match_bss->wpa_ie[0] == WPA_IE)
+          /* privacy bit may NOT be set in some APs like LinkSys WRT54G
+             && bss->privacy */
+          ) {
+               return 1;
+       }
+       return 0;
+}
+
+static inline int match_bss_wpa2(struct wlan_802_11_security * secinfo,
+                       struct bss_descriptor * match_bss)
+{
+       if (  !secinfo->wep_enabled
+          && secinfo->WPA2enabled
+          && (match_bss->rsn_ie[0] == WPA2_IE)
+          /* privacy bit may NOT be set in some APs like LinkSys WRT54G
+             && bss->privacy */
+          ) {
+               return 1;
+       }
+       return 0;
+}
+
+static inline int match_bss_dynamic_wep(struct wlan_802_11_security * secinfo,
+                       struct bss_descriptor * match_bss)
+{
+       if (  !secinfo->wep_enabled
+          && !secinfo->WPAenabled
+          && !secinfo->WPA2enabled
+          && (match_bss->wpa_ie[0] != WPA_IE)
+          && (match_bss->rsn_ie[0] != WPA2_IE)
+          && match_bss->privacy) {
+               return 1;
+       }
+       return 0;
+}
 
 /**
  *  @brief Check if a scanned network compatible with the driver settings
  *
  *  @return        Index in scantable, or error code if negative
  */
-static int is_network_compatible(wlan_adapter * adapter, int index, u8 mode)
+static int is_network_compatible(wlan_adapter * adapter,
+               struct bss_descriptor * bss, u8 mode)
 {
-       ENTER();
-
-       if (adapter->scantable[index].mode == mode) {
-               if (   !adapter->secinfo.wep_enabled
-                   && !adapter->secinfo.WPAenabled
-                   && !adapter->secinfo.WPA2enabled
-                   && adapter->scantable[index].wpa_ie[0] != WPA_IE
-                   && adapter->scantable[index].rsn_ie[0] != WPA2_IE
-                   && !adapter->scantable[index].privacy) {
-                       /* no security */
-                       LEAVE();
-                       return index;
-               } else if (   adapter->secinfo.wep_enabled
-                          && !adapter->secinfo.WPAenabled
-                          && !adapter->secinfo.WPA2enabled
-                          && adapter->scantable[index].privacy) {
-                       /* static WEP enabled */
-                       LEAVE();
-                       return index;
-               } else if (   !adapter->secinfo.wep_enabled
-                          && adapter->secinfo.WPAenabled
-                          && !adapter->secinfo.WPA2enabled
-                          && (adapter->scantable[index].wpa_ie[0] == WPA_IE)
-                          /* privacy bit may NOT be set in some APs like LinkSys WRT54G
-                             && adapter->scantable[index].privacy */
-                   ) {
-                       /* WPA enabled */
-                       lbs_pr_debug(1,
-                              "is_network_compatible() WPA: index=%d wpa_ie=%#x "
-                              "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s "
-                              "privacy=%#x\n", index,
-                              adapter->scantable[index].wpa_ie[0],
-                              adapter->scantable[index].rsn_ie[0],
-                              adapter->secinfo.wep_enabled ? "e" : "d",
-                              adapter->secinfo.WPAenabled ? "e" : "d",
-                              adapter->secinfo.WPA2enabled ? "e" : "d",
-                              adapter->scantable[index].privacy);
-                       LEAVE();
-                       return index;
-               } else if (   !adapter->secinfo.wep_enabled
-                          && !adapter->secinfo.WPAenabled
-                          && adapter->secinfo.WPA2enabled
-                          && (adapter->scantable[index].rsn_ie[0] == WPA2_IE)
-                          /* privacy bit may NOT be set in some APs like LinkSys WRT54G
-                             && adapter->scantable[index].privacy */
-                   ) {
-                       /* WPA2 enabled */
-                       lbs_pr_debug(1,
-                              "is_network_compatible() WPA2: index=%d wpa_ie=%#x "
-                              "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s "
-                              "privacy=%#x\n", index,
-                              adapter->scantable[index].wpa_ie[0],
-                              adapter->scantable[index].rsn_ie[0],
-                              adapter->secinfo.wep_enabled ? "e" : "d",
-                              adapter->secinfo.WPAenabled ? "e" : "d",
-                              adapter->secinfo.WPA2enabled ? "e" : "d",
-                              adapter->scantable[index].privacy);
-                       LEAVE();
-                       return index;
-               } else if (   !adapter->secinfo.wep_enabled
-                          && !adapter->secinfo.WPAenabled
-                          && !adapter->secinfo.WPA2enabled
-                          && (adapter->scantable[index].wpa_ie[0] != WPA_IE)
-                          && (adapter->scantable[index].rsn_ie[0] != WPA2_IE)
-                          && adapter->scantable[index].privacy) {
-                       /* dynamic WEP enabled */
-                       lbs_pr_debug(1,
-                              "is_network_compatible() dynamic WEP: index=%d "
-                              "wpa_ie=%#x wpa2_ie=%#x privacy=%#x\n",
-                              index,
-                              adapter->scantable[index].wpa_ie[0],
-                              adapter->scantable[index].rsn_ie[0],
-                              adapter->scantable[index].privacy);
-                       LEAVE();
-                       return index;
-               }
-
-               /* security doesn't match */
-               lbs_pr_debug(1,
-                      "is_network_compatible() FAILED: index=%d wpa_ie=%#x "
-                      "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s privacy=%#x\n",
-                      index,
-                      adapter->scantable[index].wpa_ie[0],
-                      adapter->scantable[index].rsn_ie[0],
+       int matched = 0;
+
+       lbs_deb_enter(LBS_DEB_ASSOC);
+
+       if (bss->mode != mode)
+               goto done;
+
+       if ((matched = match_bss_no_security(&adapter->secinfo, bss))) {
+               goto done;
+       } else if ((matched = match_bss_static_wep(&adapter->secinfo, bss))) {
+               goto done;
+       } else if ((matched = match_bss_wpa(&adapter->secinfo, bss))) {
+               lbs_deb_scan(
+                      "is_network_compatible() WPA: wpa_ie=%#x "
+                      "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s "
+                      "privacy=%#x\n", bss->wpa_ie[0], bss->rsn_ie[0],
                       adapter->secinfo.wep_enabled ? "e" : "d",
                       adapter->secinfo.WPAenabled ? "e" : "d",
                       adapter->secinfo.WPA2enabled ? "e" : "d",
-                      adapter->scantable[index].privacy);
-               LEAVE();
-               return -ECONNREFUSED;
-       }
-
-       /* mode doesn't match */
-       LEAVE();
-       return -ENETUNREACH;
-}
-
-/**
- *  @brief This function validates a SSID as being able to be printed
- *
- *  @param pssid   SSID structure to validate
- *
- *  @return        TRUE or FALSE
- */
-static u8 ssid_valid(struct WLAN_802_11_SSID *pssid)
-{
-       int ssididx;
-
-       for (ssididx = 0; ssididx < pssid->ssidlength; ssididx++) {
-               if (!isprint(pssid->ssid[ssididx])) {
-                       return 0;
-               }
+                      bss->privacy);
+               goto done;
+       } else if ((matched = match_bss_wpa2(&adapter->secinfo, bss))) {
+               lbs_deb_scan(
+                      "is_network_compatible() WPA2: wpa_ie=%#x "
+                      "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s "
+                      "privacy=%#x\n", bss->wpa_ie[0], bss->rsn_ie[0],
+                      adapter->secinfo.wep_enabled ? "e" : "d",
+                      adapter->secinfo.WPAenabled ? "e" : "d",
+                      adapter->secinfo.WPA2enabled ? "e" : "d",
+                      bss->privacy);
+               goto done;
+       } else if ((matched = match_bss_dynamic_wep(&adapter->secinfo, bss))) {
+               lbs_deb_scan(
+                      "is_network_compatible() dynamic WEP: "
+                      "wpa_ie=%#x wpa2_ie=%#x privacy=%#x\n",
+                      bss->wpa_ie[0],
+                      bss->rsn_ie[0],
+                      bss->privacy);
+               goto done;
        }
 
-       return 1;
+       /* bss security settings don't match those configured on card */
+       lbs_deb_scan(
+              "is_network_compatible() FAILED: wpa_ie=%#x "
+              "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s privacy=%#x\n",
+              bss->wpa_ie[0], bss->rsn_ie[0],
+              adapter->secinfo.wep_enabled ? "e" : "d",
+              adapter->secinfo.WPAenabled ? "e" : "d",
+              adapter->secinfo.WPA2enabled ? "e" : "d",
+              bss->privacy);
+
+done:
+       lbs_deb_leave(LBS_DEB_SCAN);
+       return matched;
 }
 
 /**
@@ -220,44 +231,19 @@ static u8 ssid_valid(struct WLAN_802_11_SSID *pssid)
 static void wlan_scan_process_results(wlan_private * priv)
 {
        wlan_adapter *adapter = priv->adapter;
-       int foundcurrent;
-       int i;
-
-       foundcurrent = 0;
-
-       if (adapter->connect_status == libertas_connected) {
-               /* try to find the current BSSID in the new scan list */
-               for (i = 0; i < adapter->numinscantable; i++) {
-                       if (!libertas_SSID_cmp(&adapter->scantable[i].ssid,
-                                    &adapter->curbssparams.ssid) &&
-                           !memcmp(adapter->curbssparams.bssid,
-                                   adapter->scantable[i].macaddress,
-                                   ETH_ALEN)) {
-                               foundcurrent = 1;
-                       }
-               }
+       struct bss_descriptor * iter_bss;
+       int i = 0;
 
-               if (foundcurrent) {
-                       /* Make a copy of current BSSID descriptor */
-                       memcpy(&adapter->curbssparams.bssdescriptor,
-                              &adapter->scantable[i],
-                              sizeof(adapter->curbssparams.bssdescriptor));
-               }
-       }
+       if (adapter->connect_status == libertas_connected)
+               return;
 
-       for (i = 0; i < adapter->numinscantable; i++) {
-               lbs_pr_debug(1, "Scan:(%02d) %02x:%02x:%02x:%02x:%02x:%02x, "
-                      "RSSI[%03d], SSID[%s]\n",
-                      i,
-                      adapter->scantable[i].macaddress[0],
-                      adapter->scantable[i].macaddress[1],
-                      adapter->scantable[i].macaddress[2],
-                      adapter->scantable[i].macaddress[3],
-                      adapter->scantable[i].macaddress[4],
-                      adapter->scantable[i].macaddress[5],
-                      (s32) adapter->scantable[i].rssi,
-                      adapter->scantable[i].ssid.ssid);
+       mutex_lock(&adapter->lock);
+       list_for_each_entry (iter_bss, &adapter->network_list, list) {
+               lbs_deb_scan("Scan:(%02d) " MAC_FMT ", RSSI[%03d], SSID[%s]\n",
+                      i++, MAC_ARG(iter_bss->bssid), (s32) iter_bss->rssi,
+                      escape_essid(iter_bss->ssid, iter_bss->ssid_len));
        }
+       mutex_unlock(&adapter->lock);
 }
 
 /**
@@ -338,14 +324,12 @@ static void wlan_scan_create_channel_list(wlan_private * priv,
 
                        if (scantype == cmd_scan_type_passive) {
                                scanchanlist[chanidx].maxscantime =
-                                   cpu_to_le16
-                                   (MRVDRV_PASSIVE_SCAN_CHAN_TIME);
+                                   cpu_to_le16(MRVDRV_PASSIVE_SCAN_CHAN_TIME);
                                scanchanlist[chanidx].chanscanmode.passivescan =
                                    1;
                        } else {
                                scanchanlist[chanidx].maxscantime =
-                                   cpu_to_le16
-                                   (MRVDRV_ACTIVE_SCAN_CHAN_TIME);
+                                   cpu_to_le16(MRVDRV_ACTIVE_SCAN_CHAN_TIME);
                                scanchanlist[chanidx].chanscanmode.passivescan =
                                    0;
                        }
@@ -408,13 +392,11 @@ wlan_scan_setup_scan_config(wlan_private * priv,
                            u8 * pscancurrentonly)
 {
        wlan_adapter *adapter = priv->adapter;
-       const u8 zeromac[ETH_ALEN] = { 0, 0, 0, 0, 0, 0 };
        struct mrvlietypes_numprobes *pnumprobestlv;
        struct mrvlietypes_ssidparamset *pssidtlv;
        struct wlan_scan_cmd_config * pscancfgout = NULL;
        u8 *ptlvpos;
        u16 numprobes;
-       u16 ssidlen;
        int chanidx;
        int scantype;
        int scandur;
@@ -471,21 +453,18 @@ wlan_scan_setup_scan_config(wlan_private * priv,
                 * Set the BSSID filter to the incoming configuration,
                 *   if non-zero.  If not set, it will remain disabled (all zeros).
                 */
-               memcpy(pscancfgout->specificBSSID,
-                      puserscanin->specificBSSID,
-                      sizeof(pscancfgout->specificBSSID));
-
-               ssidlen = strlen(puserscanin->specificSSID);
+               memcpy(pscancfgout->bssid, puserscanin->bssid,
+                      sizeof(pscancfgout->bssid));
 
-               if (ssidlen) {
+               if (puserscanin->ssid_len) {
                        pssidtlv =
                            (struct mrvlietypes_ssidparamset *) pscancfgout->
                            tlvbuffer;
                        pssidtlv->header.type = cpu_to_le16(TLV_TYPE_SSID);
-                       pssidtlv->header.len = cpu_to_le16(ssidlen);
-                       memcpy(pssidtlv->ssid, puserscanin->specificSSID,
-                              ssidlen);
-                       ptlvpos += sizeof(pssidtlv->header) + ssidlen;
+                       pssidtlv->header.len = cpu_to_le16(puserscanin->ssid_len);
+                       memcpy(pssidtlv->ssid, puserscanin->ssid,
+                              puserscanin->ssid_len);
+                       ptlvpos += sizeof(pssidtlv->header) + puserscanin->ssid_len;
                }
 
                /*
@@ -494,8 +473,8 @@ wlan_scan_setup_scan_config(wlan_private * priv,
                 *    scan results.  That is not an issue with an SSID or BSSID
                 *    filter applied to the scan results in the firmware.
                 */
-               if (ssidlen || (memcmp(pscancfgout->specificBSSID,
-                                      &zeromac, sizeof(zeromac)) != 0)) {
+               if (   puserscanin->ssid_len
+                   || (compare_ether_addr(pscancfgout->bssid, &zeromac[0]) != 0)) {
                        *pmaxchanperscan = MRVDRV_MAX_CHANNELS_PER_SCAN;
                        *pfilteredscan = 1;
                }
@@ -507,16 +486,11 @@ wlan_scan_setup_scan_config(wlan_private * priv,
        /* If the input config or adapter has the number of Probes set, add tlv */
        if (numprobes) {
                pnumprobestlv = (struct mrvlietypes_numprobes *) ptlvpos;
-               pnumprobestlv->header.type =
-                   cpu_to_le16(TLV_TYPE_NUMPROBES);
-               pnumprobestlv->header.len = sizeof(pnumprobestlv->numprobes);
+               pnumprobestlv->header.type = cpu_to_le16(TLV_TYPE_NUMPROBES);
+               pnumprobestlv->header.len = cpu_to_le16(2);
                pnumprobestlv->numprobes = cpu_to_le16(numprobes);
 
-               ptlvpos +=
-                   sizeof(pnumprobestlv->header) + pnumprobestlv->header.len;
-
-               pnumprobestlv->header.len =
-                   cpu_to_le16(pnumprobestlv->header.len);
+               ptlvpos += sizeof(*pnumprobestlv);
        }
 
        /*
@@ -529,7 +503,7 @@ wlan_scan_setup_scan_config(wlan_private * priv,
 
        if (puserscanin && puserscanin->chanlist[0].channumber) {
 
-               lbs_pr_debug(1, "Scan: Using supplied channel list\n");
+               lbs_deb_scan("Scan: Using supplied channel list\n");
 
                for (chanidx = 0;
                     chanidx < WLAN_IOCTL_USER_SCAN_CHAN_MAX
@@ -573,11 +547,11 @@ wlan_scan_setup_scan_config(wlan_private * priv,
                                       ==
                                       priv->adapter->curbssparams.channel)) {
                        *pscancurrentonly = 1;
-                       lbs_pr_debug(1, "Scan: Scanning current channel only");
+                       lbs_deb_scan("Scan: Scanning current channel only");
                }
 
        } else {
-               lbs_pr_debug(1, "Scan: Creating full region channel list\n");
+               lbs_deb_scan("Scan: Creating full region channel list\n");
                wlan_scan_create_channel_list(priv, pscanchanlist,
                                              *pfilteredscan);
        }
@@ -613,7 +587,9 @@ static int wlan_scan_channel_list(wlan_private * priv,
                                  u8 filteredscan,
                                  struct wlan_scan_cmd_config * pscancfgout,
                                  struct mrvlietypes_chanlistparamset * pchantlvout,
-                                 struct chanscanparamset * pscanchanlist)
+                                 struct chanscanparamset * pscanchanlist,
+                                 const struct wlan_ioctl_user_scan_cfg * puserscanin,
+                                 int full_scan)
 {
        struct chanscanparamset *ptmpchan;
        struct chanscanparamset *pstartchan;
@@ -621,11 +597,13 @@ static int wlan_scan_channel_list(wlan_private * priv,
        int doneearly;
        int tlvidx;
        int ret = 0;
+       int scanned = 0;
+       union iwreq_data wrqu;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_ASSOC);
 
        if (pscancfgout == 0 || pchantlvout == 0 || pscanchanlist == 0) {
-               lbs_pr_debug(1, "Scan: Null detect: %p, %p, %p\n",
+               lbs_deb_scan("Scan: Null detect: %p, %p, %p\n",
                       pscancfgout, pchantlvout, pscanchanlist);
                return -1;
        }
@@ -635,6 +613,9 @@ static int wlan_scan_channel_list(wlan_private * priv,
        /* Set the temp channel struct pointer to the start of the desired list */
        ptmpchan = pscanchanlist;
 
+       if (priv->adapter->last_scanned_channel && !puserscanin)
+               ptmpchan += priv->adapter->last_scanned_channel;
+
        /* Loop through the desired channel list, sending a new firmware scan
         *   commands for each maxchanperscan channels (or for 1,6,11 individually
         *   if configured accordingly)
@@ -654,9 +635,9 @@ static int wlan_scan_channel_list(wlan_private * priv,
                 *    - doneearly is set (controlling individual scanning of 1,6,11)
                 */
                while (tlvidx < maxchanperscan && ptmpchan->channumber
-                      && !doneearly) {
+                      && !doneearly && scanned < 2) {
 
-            lbs_pr_debug(1,
+            lbs_deb_scan(
                     "Scan: Chan(%3d), Radio(%d), mode(%d,%d), Dur(%d)\n",
                 ptmpchan->channumber, ptmpchan->radiotype,
                 ptmpchan->chanscanmode.passivescan,
@@ -668,8 +649,11 @@ static int wlan_scan_channel_list(wlan_private * priv,
                               ptmpchan, sizeof(pchantlvout->chanscanparam));
 
                        /* Increment the TLV header length by the size appended */
-                       pchantlvout->header.len +=
-                           sizeof(pchantlvout->chanscanparam);
+                       /* Ew, it would be _so_ nice if we could just declare the
+                          variable little-endian and let GCC handle it for us */
+                       pchantlvout->header.len =
+                               cpu_to_le16(le16_to_cpu(pchantlvout->header.len) +
+                                           sizeof(pchantlvout->chanscanparam));
 
                        /*
                         *  The tlv buffer length is set to the number of bytes of the
@@ -683,7 +667,7 @@ static int wlan_scan_channel_list(wlan_private * priv,
                        /*  Add the size of the channel tlv header and the data length */
                        pscancfgout->tlvbufferlen +=
                            (sizeof(pchantlvout->header)
-                            + pchantlvout->header.len);
+                            + le16_to_cpu(pchantlvout->header.len));
 
                        /* Increment the index to the channel tlv we are constructing */
                        tlvidx++;
@@ -701,6 +685,7 @@ static int wlan_scan_channel_list(wlan_private * priv,
 
                        /* Increment the tmp pointer to the next channel to be scanned */
                        ptmpchan++;
+                       scanned++;
 
                        /* Stop the loop if the *next* channel is in the 1,6,11 set.
                         *  This will cause it to be the only channel scanned on the next
@@ -716,12 +701,71 @@ static int wlan_scan_channel_list(wlan_private * priv,
                /* Send the scan command to the firmware with the specified cfg */
                ret = libertas_prepare_and_send_command(priv, cmd_802_11_scan, 0,
                                            0, 0, pscancfgout);
+               if (scanned >= 2 && !full_scan) {
+                       ret = 0;
+                       goto done;
+               }
+               scanned = 0;
        }
 
-       LEAVE();
+done:
+       priv->adapter->last_scanned_channel = ptmpchan->channumber;
+
+       /* Tell userspace the scan table has been updated */
+       memset(&wrqu, 0, sizeof(union iwreq_data));
+       wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL);
+
+       lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret);
        return ret;
 }
 
+static void
+clear_selected_scan_list_entries(wlan_adapter * adapter,
+                                 const struct wlan_ioctl_user_scan_cfg * scan_cfg)
+{
+       struct bss_descriptor * bss;
+       struct bss_descriptor * safe;
+       u32 clear_ssid_flag = 0, clear_bssid_flag = 0;
+
+       if (!scan_cfg)
+               return;
+
+       if (scan_cfg->clear_ssid && scan_cfg->ssid_len)
+               clear_ssid_flag = 1;
+
+       if (scan_cfg->clear_bssid
+           && (compare_ether_addr(scan_cfg->bssid, &zeromac[0]) != 0)
+           && (compare_ether_addr(scan_cfg->bssid, &bcastmac[0]) != 0)) {
+               clear_bssid_flag = 1;
+       }
+
+       if (!clear_ssid_flag && !clear_bssid_flag)
+               return;
+
+       mutex_lock(&adapter->lock);
+       list_for_each_entry_safe (bss, safe, &adapter->network_list, list) {
+               u32 clear = 0;
+
+               /* Check for an SSID match */
+               if (   clear_ssid_flag
+                   && (bss->ssid_len == scan_cfg->ssid_len)
+                   && !memcmp(bss->ssid, scan_cfg->ssid, bss->ssid_len))
+                       clear = 1;
+
+               /* Check for a BSSID match */
+               if (   clear_bssid_flag
+                   && !compare_ether_addr(bss->bssid, scan_cfg->bssid))
+                       clear = 1;
+
+               if (clear) {
+                       list_move_tail (&bss->list, &adapter->network_free_list);
+                       clear_bss_descriptor(bss);
+               }
+       }
+       mutex_unlock(&adapter->lock);
+}
+
+
 /**
  *  @brief Internal function used to start a scan based on an input config
  *
@@ -736,19 +780,19 @@ static int wlan_scan_channel_list(wlan_private * priv,
  *  @return              0 or < 0 if error
  */
 int wlan_scan_networks(wlan_private * priv,
-                             const struct wlan_ioctl_user_scan_cfg * puserscanin)
+                             const struct wlan_ioctl_user_scan_cfg * puserscanin,
+                             int full_scan)
 {
-       wlan_adapter *adapter = priv->adapter;
+       wlan_adapter * adapter = priv->adapter;
        struct mrvlietypes_chanlistparamset *pchantlvout;
        struct chanscanparamset * scan_chan_list = NULL;
        struct wlan_scan_cmd_config * scan_cfg = NULL;
-       u8 keeppreviousscan;
        u8 filteredscan;
        u8 scancurrentchanonly;
        int maxchanperscan;
        int ret;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_ASSOC);
 
        scan_chan_list = kzalloc(sizeof(struct chanscanparamset) *
                                WLAN_IOCTL_USER_SCAN_CHAN_MAX, GFP_KERNEL);
@@ -769,22 +813,14 @@ int wlan_scan_networks(wlan_private * priv,
                goto out;
        }
 
-       keeppreviousscan = 0;
-
-       if (puserscanin) {
-               keeppreviousscan = puserscanin->keeppreviousscan;
-       }
-
-       if (!keeppreviousscan) {
-               memset(adapter->scantable, 0x00,
-                      sizeof(struct bss_descriptor) * MRVDRV_MAX_BSSID_LIST);
-               adapter->numinscantable = 0;
-       }
+       clear_selected_scan_list_entries(adapter, puserscanin);
 
        /* Keep the data path active if we are only scanning our current channel */
        if (!scancurrentchanonly) {
-               netif_stop_queue(priv->wlan_dev.netdev);
-               netif_carrier_off(priv->wlan_dev.netdev);
+               netif_stop_queue(priv->dev);
+               netif_carrier_off(priv->dev);
+               netif_stop_queue(priv->mesh_dev);
+               netif_carrier_off(priv->mesh_dev);
        }
 
        ret = wlan_scan_channel_list(priv,
@@ -792,7 +828,9 @@ int wlan_scan_networks(wlan_private * priv,
                                     filteredscan,
                                     scan_cfg,
                                     pchantlvout,
-                                    scan_chan_list);
+                                    scan_chan_list,
+                                    puserscanin,
+                                    full_scan);
 
        /*  Process the resulting scan table:
         *    - Remove any bad ssids
@@ -801,8 +839,10 @@ int wlan_scan_networks(wlan_private * priv,
        wlan_scan_process_results(priv);
 
        if (priv->adapter->connect_status == libertas_connected) {
-               netif_carrier_on(priv->wlan_dev.netdev);
-               netif_wake_queue(priv->wlan_dev.netdev);
+               netif_carrier_on(priv->dev);
+               netif_wake_queue(priv->dev);
+               netif_carrier_on(priv->mesh_dev);
+               netif_wake_queue(priv->mesh_dev);
        }
 
 out:
@@ -812,7 +852,7 @@ out:
        if (scan_chan_list)
                kfree(scan_chan_list);
 
-       LEAVE();
+       lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret);
        return ret;
 }
 
@@ -843,7 +883,7 @@ void wlan_ret_802_11_scan_get_tlv_ptrs(struct mrvlietypes_data * ptlv,
        tlvbufleft = tlvbufsize;
        *ptsftlv = NULL;
 
-       lbs_pr_debug(1, "SCAN_RESP: tlvbufsize = %d\n", tlvbufsize);
+       lbs_deb_scan("SCAN_RESP: tlvbufsize = %d\n", tlvbufsize);
        lbs_dbg_hex("SCAN_RESP: TLV Buf", (u8 *) ptlv, tlvbufsize);
 
        while (tlvbufleft >= sizeof(struct mrvlietypesheader)) {
@@ -856,7 +896,7 @@ void wlan_ret_802_11_scan_get_tlv_ptrs(struct mrvlietypes_data * ptlv,
                        break;
 
                default:
-                       lbs_pr_debug(1, "SCAN_RESP: Unhandled TLV = %d\n",
+                       lbs_deb_scan("SCAN_RESP: Unhandled TLV = %d\n",
                               tlvtype);
                        /* Give up, this seems corrupted */
                        return;
@@ -875,12 +915,12 @@ void wlan_ret_802_11_scan_get_tlv_ptrs(struct mrvlietypes_data * ptlv,
  *   response or beacon from the scan command.  Record information as needed
  *   in the scan table struct bss_descriptor for that entry.
  *
- *  @param pBSSIDEntry  Output parameter: Pointer to the BSS Entry
+ *  @param bss  Output parameter: Pointer to the BSS Entry
  *
  *  @return             0 or -1
  */
-static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
-                                        u8 ** pbeaconinfo, int *bytesleft)
+static int libertas_process_bss(struct bss_descriptor * bss,
+                               u8 ** pbeaconinfo, int *bytesleft)
 {
        enum ieeetypes_elementid elemID;
        struct ieeetypes_fhparamset *pFH;
@@ -897,13 +937,14 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
        u16 beaconsize;
        u8 founddatarateie;
        int bytesleftforcurrentbeacon;
+       int ret;
 
        struct IE_WPA *pIe;
        const u8 oui01[4] = { 0x00, 0x50, 0xf2, 0x01 };
 
        struct ieeetypes_countryinfoset *pcountryinfo;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_ASSOC);
 
        founddatarateie = 0;
        ratesize = 0;
@@ -911,8 +952,7 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
 
        if (*bytesleft >= sizeof(beaconsize)) {
                /* Extract & convert beacon size from the command buffer */
-               memcpy(&beaconsize, *pbeaconinfo, sizeof(beaconsize));
-               beaconsize = le16_to_cpu(beaconsize);
+               beaconsize = le16_to_cpup((void *)*pbeaconinfo);
                *bytesleft -= sizeof(beaconsize);
                *pbeaconinfo += sizeof(beaconsize);
        }
@@ -934,17 +974,14 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
 
        bytesleftforcurrentbeacon = beaconsize;
 
-       memcpy(pBSSEntry->macaddress, pcurrentptr, ETH_ALEN);
-       lbs_pr_debug(1, "InterpretIE: AP MAC Addr-%x:%x:%x:%x:%x:%x\n",
-              pBSSEntry->macaddress[0], pBSSEntry->macaddress[1],
-              pBSSEntry->macaddress[2], pBSSEntry->macaddress[3],
-              pBSSEntry->macaddress[4], pBSSEntry->macaddress[5]);
+       memcpy(bss->bssid, pcurrentptr, ETH_ALEN);
+       lbs_deb_scan("process_bss: AP BSSID " MAC_FMT "\n", MAC_ARG(bss->bssid));
 
        pcurrentptr += ETH_ALEN;
        bytesleftforcurrentbeacon -= ETH_ALEN;
 
        if (bytesleftforcurrentbeacon < 12) {
-               lbs_pr_debug(1, "InterpretIE: Not enough bytes left\n");
+               lbs_deb_scan("process_bss: Not enough bytes left\n");
                return -1;
        }
 
@@ -954,51 +991,48 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
         */
 
        /* RSSI is 1 byte long */
-       pBSSEntry->rssi = le32_to_cpu((long)(*pcurrentptr));
-       lbs_pr_debug(1, "InterpretIE: RSSI=%02X\n", *pcurrentptr);
+       bss->rssi = *pcurrentptr;
+       lbs_deb_scan("process_bss: RSSI=%02X\n", *pcurrentptr);
        pcurrentptr += 1;
        bytesleftforcurrentbeacon -= 1;
 
        /* time stamp is 8 bytes long */
-       memcpy(fixedie.timestamp, pcurrentptr, 8);
-       memcpy(pBSSEntry->timestamp, pcurrentptr, 8);
+       fixedie.timestamp = bss->timestamp = le64_to_cpup((void *)pcurrentptr);
        pcurrentptr += 8;
        bytesleftforcurrentbeacon -= 8;
 
        /* beacon interval is 2 bytes long */
-       memcpy(&fixedie.beaconinterval, pcurrentptr, 2);
-       pBSSEntry->beaconperiod = le16_to_cpu(fixedie.beaconinterval);
+       fixedie.beaconinterval = bss->beaconperiod = le16_to_cpup((void *)pcurrentptr);
        pcurrentptr += 2;
        bytesleftforcurrentbeacon -= 2;
 
        /* capability information is 2 bytes long */
-       memcpy(&fixedie.capabilities, pcurrentptr, 2);
-       lbs_pr_debug(1, "InterpretIE: fixedie.capabilities=0x%X\n",
+        memcpy(&fixedie.capabilities, pcurrentptr, 2);
+       lbs_deb_scan("process_bss: fixedie.capabilities=0x%X\n",
               fixedie.capabilities);
-       fixedie.capabilities = le16_to_cpu(fixedie.capabilities);
        pcap = (struct ieeetypes_capinfo *) & fixedie.capabilities;
-       memcpy(&pBSSEntry->cap, pcap, sizeof(struct ieeetypes_capinfo));
+       memcpy(&bss->cap, pcap, sizeof(struct ieeetypes_capinfo));
        pcurrentptr += 2;
        bytesleftforcurrentbeacon -= 2;
 
        /* rest of the current buffer are IE's */
-       lbs_pr_debug(1, "InterpretIE: IElength for this AP = %d\n",
+       lbs_deb_scan("process_bss: IE length for this AP = %d\n",
               bytesleftforcurrentbeacon);
 
-       lbs_dbg_hex("InterpretIE: IE info", (u8 *) pcurrentptr,
+       lbs_dbg_hex("process_bss: IE info", (u8 *) pcurrentptr,
                bytesleftforcurrentbeacon);
 
        if (pcap->privacy) {
-               lbs_pr_debug(1, "InterpretIE: AP WEP enabled\n");
-               pBSSEntry->privacy = wlan802_11privfilter8021xWEP;
+               lbs_deb_scan("process_bss: AP WEP enabled\n");
+               bss->privacy = wlan802_11privfilter8021xWEP;
        } else {
-               pBSSEntry->privacy = wlan802_11privfilteracceptall;
+               bss->privacy = wlan802_11privfilteracceptall;
        }
 
        if (pcap->ibss == 1) {
-               pBSSEntry->mode = IW_MODE_ADHOC;
+               bss->mode = IW_MODE_ADHOC;
        } else {
-               pBSSEntry->mode = IW_MODE_INFRA;
+               bss->mode = IW_MODE_INFRA;
        }
 
        /* process variable IE */
@@ -1007,94 +1041,83 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
                elemlen = *((u8 *) pcurrentptr + 1);
 
                if (bytesleftforcurrentbeacon < elemlen) {
-                       lbs_pr_debug(1, "InterpretIE: error in processing IE, "
+                       lbs_deb_scan("process_bss: error in processing IE, "
                               "bytes left < IE length\n");
                        bytesleftforcurrentbeacon = 0;
                        continue;
                }
 
                switch (elemID) {
-
                case SSID:
-                       pBSSEntry->ssid.ssidlength = elemlen;
-                       memcpy(pBSSEntry->ssid.ssid, (pcurrentptr + 2),
-                              elemlen);
-                       lbs_pr_debug(1, "ssid: %32s", pBSSEntry->ssid.ssid);
+                       bss->ssid_len = elemlen;
+                       memcpy(bss->ssid, (pcurrentptr + 2), elemlen);
+                       lbs_deb_scan("ssid '%s', ssid length %u\n",
+                                    escape_essid(bss->ssid, bss->ssid_len),
+                                    bss->ssid_len);
                        break;
 
                case SUPPORTED_RATES:
-                       memcpy(pBSSEntry->datarates, (pcurrentptr + 2),
-                              elemlen);
-                       memmove(pBSSEntry->libertas_supported_rates, (pcurrentptr + 2),
+                       memcpy(bss->datarates, (pcurrentptr + 2), elemlen);
+                       memmove(bss->libertas_supported_rates, (pcurrentptr + 2),
                                elemlen);
                        ratesize = elemlen;
                        founddatarateie = 1;
                        break;
 
                case EXTRA_IE:
-                       lbs_pr_debug(1, "InterpretIE: EXTRA_IE Found!\n");
-                       pBSSEntry->extra_ie = 1;
+                       lbs_deb_scan("process_bss: EXTRA_IE Found!\n");
                        break;
 
                case FH_PARAM_SET:
                        pFH = (struct ieeetypes_fhparamset *) pcurrentptr;
-                       memmove(&pBSSEntry->phyparamset.fhparamset, pFH,
+                       memmove(&bss->phyparamset.fhparamset, pFH,
                                sizeof(struct ieeetypes_fhparamset));
-                       pBSSEntry->phyparamset.fhparamset.dwelltime
-                           =
-                           le16_to_cpu(pBSSEntry->phyparamset.fhparamset.
-                                            dwelltime);
+#if 0 /* I think we can store these LE */
+                       bss->phyparamset.fhparamset.dwelltime
+                           = le16_to_cpu(bss->phyparamset.fhparamset.dwelltime);
+#endif
                        break;
 
                case DS_PARAM_SET:
                        pDS = (struct ieeetypes_dsparamset *) pcurrentptr;
-
-                       pBSSEntry->channel = pDS->currentchan;
-
-                       memcpy(&pBSSEntry->phyparamset.dsparamset, pDS,
+                       bss->channel = pDS->currentchan;
+                       memcpy(&bss->phyparamset.dsparamset, pDS,
                               sizeof(struct ieeetypes_dsparamset));
                        break;
 
                case CF_PARAM_SET:
                        pCF = (struct ieeetypes_cfparamset *) pcurrentptr;
-
-                       memcpy(&pBSSEntry->ssparamset.cfparamset, pCF,
+                       memcpy(&bss->ssparamset.cfparamset, pCF,
                               sizeof(struct ieeetypes_cfparamset));
                        break;
 
                case IBSS_PARAM_SET:
                        pibss = (struct ieeetypes_ibssparamset *) pcurrentptr;
-                       pBSSEntry->atimwindow =
-                           le32_to_cpu(pibss->atimwindow);
-
-                       memmove(&pBSSEntry->ssparamset.ibssparamset, pibss,
+                       bss->atimwindow = le32_to_cpu(pibss->atimwindow);
+                       memmove(&bss->ssparamset.ibssparamset, pibss,
                                sizeof(struct ieeetypes_ibssparamset));
-
-                       pBSSEntry->ssparamset.ibssparamset.atimwindow
-                           =
-                           le16_to_cpu(pBSSEntry->ssparamset.ibssparamset.
-                                            atimwindow);
+#if 0
+                       bss->ssparamset.ibssparamset.atimwindow
+                           = le16_to_cpu(bss->ssparamset.ibssparamset.atimwindow);
+#endif
                        break;
 
                        /* Handle Country Info IE */
                case COUNTRY_INFO:
-                       pcountryinfo =
-                           (struct ieeetypes_countryinfoset *) pcurrentptr;
-
-                       if (pcountryinfo->len <
-                           sizeof(pcountryinfo->countrycode)
+                       pcountryinfo = (struct ieeetypes_countryinfoset *) pcurrentptr;
+                       if (pcountryinfo->len < sizeof(pcountryinfo->countrycode)
                            || pcountryinfo->len > 254) {
-                               lbs_pr_debug(1, "InterpretIE: 11D- Err "
+                               lbs_deb_scan("process_bss: 11D- Err "
                                       "CountryInfo len =%d min=%zd max=254\n",
                                       pcountryinfo->len,
                                       sizeof(pcountryinfo->countrycode));
-                               LEAVE();
-                               return -1;
+                               ret = -1;
+                               goto done;
                        }
 
-                       memcpy(&pBSSEntry->countryinfo,
+                       memcpy(&bss->countryinfo,
                               pcountryinfo, pcountryinfo->len + 2);
-                       lbs_dbg_hex("InterpretIE: 11D- CountryInfo:",
+                       lbs_dbg_hex("process_bss: 11D- CountryInfo:",
                                (u8 *) pcountryinfo,
                                (u32) (pcountryinfo->len + 2));
                        break;
@@ -1114,12 +1137,10 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
                                        bytestocopy = elemlen;
                                }
 
-                               pRate = (u8 *) pBSSEntry->datarates;
+                               pRate = (u8 *) bss->datarates;
                                pRate += ratesize;
                                memmove(pRate, (pcurrentptr + 2), bytestocopy);
-
-                               pRate = (u8 *) pBSSEntry->libertas_supported_rates;
-
+                               pRate = (u8 *) bss->libertas_supported_rates;
                                pRate += ratesize;
                                memmove(pRate, (pcurrentptr + 2), bytestocopy);
                        }
@@ -1132,24 +1153,17 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
                        if (memcmp(pIe->oui, oui01, sizeof(oui01)))
                                break;
 
-                       pBSSEntry->wpa_ie_len = min_t(size_t,
-                               elemlen + IE_ID_LEN_FIELDS_BYTES,
-                               sizeof(pBSSEntry->wpa_ie));
-                       memcpy(pBSSEntry->wpa_ie, pcurrentptr,
-                               pBSSEntry->wpa_ie_len);
-                       lbs_dbg_hex("InterpretIE: Resp WPA_IE",
-                               pBSSEntry->wpa_ie, elemlen);
+                       bss->wpa_ie_len = min(elemlen + IE_ID_LEN_FIELDS_BYTES,
+                               MAX_WPA_IE_LEN);
+                       memcpy(bss->wpa_ie, pcurrentptr, bss->wpa_ie_len);
+                       lbs_dbg_hex("process_bss: WPA IE", bss->wpa_ie, elemlen);
                        break;
                case WPA2_IE:
                        pIe = (struct IE_WPA *)pcurrentptr;
-
-                       pBSSEntry->rsn_ie_len = min_t(size_t,
-                               elemlen + IE_ID_LEN_FIELDS_BYTES,
-                               sizeof(pBSSEntry->rsn_ie));
-                       memcpy(pBSSEntry->rsn_ie, pcurrentptr,
-                               pBSSEntry->rsn_ie_len);
-                       lbs_dbg_hex("InterpretIE: Resp WPA2_IE",
-                               pBSSEntry->rsn_ie, elemlen);
+                       bss->rsn_ie_len = min(elemlen + IE_ID_LEN_FIELDS_BYTES,
+                               MAX_WPA_IE_LEN);
+                       memcpy(bss->rsn_ie, pcurrentptr, bss->rsn_ie_len);
+                       lbs_dbg_hex("process_bss: RSN_IE", bss->rsn_ie, elemlen);
                        break;
                case TIM:
                        break;
@@ -1165,7 +1179,14 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
 
        }                       /* while (bytesleftforcurrentbeacon > 2) */
 
-       return 0;
+       /* Timestamp */
+       bss->last_scanned = jiffies;
+
+       ret = 0;
+
+done:
+       lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret);
+       return ret;
 }
 
 /**
@@ -1176,15 +1197,12 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
  *
  *  @return         0--ssid is same, otherwise is different
  */
-int libertas_SSID_cmp(struct WLAN_802_11_SSID *ssid1, struct WLAN_802_11_SSID *ssid2)
+int libertas_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len)
 {
-       if (!ssid1 || !ssid2)
-               return -1;
-
-       if (ssid1->ssidlength != ssid2->ssidlength)
+       if (ssid1_len != ssid2_len)
                return -1;
 
-       return memcmp(ssid1->ssid, ssid2->ssid, ssid1->ssidlength);
+       return memcmp(ssid1, ssid2, ssid1_len);
 }
 
 /**
@@ -1196,38 +1214,41 @@ int libertas_SSID_cmp(struct WLAN_802_11_SSID *ssid1, struct WLAN_802_11_SSID *s
  *
  *  @return         index in BSSID list, or error return code (< 0)
  */
-int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, u8 mode)
+struct bss_descriptor * libertas_find_bssid_in_list(wlan_adapter * adapter,
+               u8 * bssid, u8 mode)
 {
-       int ret = -ENETUNREACH;
-       int i;
+       struct bss_descriptor * iter_bss;
+       struct bss_descriptor * found_bss = NULL;
 
        if (!bssid)
-               return -EFAULT;
+               return NULL;
 
-       lbs_pr_debug(1, "FindBSSID: Num of BSSIDs = %d\n",
-              adapter->numinscantable);
+       lbs_dbg_hex("libertas_find_BSSID_in_list: looking for ",
+               bssid, ETH_ALEN);
 
-       /* Look through the scan table for a compatible match. The ret return
-        *   variable will be equal to the index in the scan table (greater
-        *   than zero) if the network is compatible.  The loop will continue
-        *   past a matched bssid that is not compatible in case there is an
-        *   AP with multiple SSIDs assigned to the same BSSID
+       /* Look through the scan table for a compatible match.  The loop will
+        *   continue past a matched bssid that is not compatible in case there
+        *   is an AP with multiple SSIDs assigned to the same BSSID
         */
-       for (i = 0; ret < 0 && i < adapter->numinscantable; i++) {
-               if (!memcmp(adapter->scantable[i].macaddress, bssid, ETH_ALEN)) {
-                       switch (mode) {
-                       case IW_MODE_INFRA:
-                       case IW_MODE_ADHOC:
-                               ret = is_network_compatible(adapter, i, mode);
-                               break;
-                       default:
-                               ret = i;
+       mutex_lock(&adapter->lock);
+       list_for_each_entry (iter_bss, &adapter->network_list, list) {
+               if (compare_ether_addr(iter_bss->bssid, bssid))
+                       continue; /* bssid doesn't match */
+               switch (mode) {
+               case IW_MODE_INFRA:
+               case IW_MODE_ADHOC:
+                       if (!is_network_compatible(adapter, iter_bss, mode))
                                break;
-                       }
+                       found_bss = iter_bss;
+                       break;
+               default:
+                       found_bss = iter_bss;
+                       break;
                }
        }
+       mutex_unlock(&adapter->lock);
 
-       return ret;
+       return found_bss;
 }
 
 /**
@@ -1240,61 +1261,60 @@ int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, u8 mode)
  *
  *  @return         index in BSSID list
  */
-int libertas_find_SSID_in_list(wlan_adapter * adapter,
-                  struct WLAN_802_11_SSID *ssid, u8 * bssid, u8 mode)
+struct bss_descriptor * libertas_find_ssid_in_list(wlan_adapter * adapter,
+                  u8 *ssid, u8 ssid_len, u8 * bssid, u8 mode,
+                  int channel)
 {
-       int net = -ENETUNREACH;
        u8 bestrssi = 0;
-       int i;
-       int j;
+       struct bss_descriptor * iter_bss = NULL;
+       struct bss_descriptor * found_bss = NULL;
+       struct bss_descriptor * tmp_oldest = NULL;
 
-       lbs_pr_debug(1, "Num of Entries in Table = %d\n", adapter->numinscantable);
-
-       for (i = 0; i < adapter->numinscantable; i++) {
-               if (!libertas_SSID_cmp(&adapter->scantable[i].ssid, ssid) &&
-                   (!bssid ||
-                    !memcmp(adapter->scantable[i].
-                            macaddress, bssid, ETH_ALEN))) {
-                       switch (mode) {
-                       case IW_MODE_INFRA:
-                       case IW_MODE_ADHOC:
-                               j = is_network_compatible(adapter, i, mode);
-
-                               if (j >= 0) {
-                                       if (bssid) {
-                                               return i;
-                                       }
-
-                                       if (SCAN_RSSI
-                                           (adapter->scantable[i].rssi)
-                                           > bestrssi) {
-                                               bestrssi =
-                                                   SCAN_RSSI(adapter->
-                                                             scantable[i].
-                                                             rssi);
-                                               net = i;
-                                       }
-                               } else {
-                                       if (net == -ENETUNREACH) {
-                                               net = j;
-                                       }
-                               }
-                               break;
-                       case IW_MODE_AUTO:
-                       default:
-                               if (SCAN_RSSI(adapter->scantable[i].rssi)
-                                   > bestrssi) {
-                                       bestrssi =
-                                           SCAN_RSSI(adapter->scantable[i].
-                                                     rssi);
-                                       net = i;
-                               }
+       mutex_lock(&adapter->lock);
+
+       list_for_each_entry (iter_bss, &adapter->network_list, list) {
+               if (   !tmp_oldest
+                   || (iter_bss->last_scanned < tmp_oldest->last_scanned))
+                       tmp_oldest = iter_bss;
+
+               if (libertas_ssid_cmp(iter_bss->ssid, iter_bss->ssid_len,
+                                     ssid, ssid_len) != 0)
+                       continue; /* ssid doesn't match */
+               if (bssid && compare_ether_addr(iter_bss->bssid, bssid) != 0)
+                       continue; /* bssid doesn't match */
+               if ((channel > 0) && (iter_bss->channel != channel))
+                       continue; /* channel doesn't match */
+
+               switch (mode) {
+               case IW_MODE_INFRA:
+               case IW_MODE_ADHOC:
+                       if (!is_network_compatible(adapter, iter_bss, mode))
                                break;
+
+                       if (bssid) {
+                               /* Found requested BSSID */
+                               found_bss = iter_bss;
+                               goto out;
+                       }
+
+                       if (SCAN_RSSI(iter_bss->rssi) > bestrssi) {
+                               bestrssi = SCAN_RSSI(iter_bss->rssi);
+                               found_bss = iter_bss;
                        }
+                       break;
+               case IW_MODE_AUTO:
+               default:
+                       if (SCAN_RSSI(iter_bss->rssi) > bestrssi) {
+                               bestrssi = SCAN_RSSI(iter_bss->rssi);
+                               found_bss = iter_bss;
+                       }
+                       break;
                }
        }
 
-       return net;
+out:
+       mutex_unlock(&adapter->lock);
+       return found_bss;
 }
 
 /**
@@ -1307,43 +1327,38 @@ int libertas_find_SSID_in_list(wlan_adapter * adapter,
  *
  *  @return         index in BSSID list
  */
-int libertas_find_best_SSID_in_list(wlan_adapter * adapter, u8 mode)
+struct bss_descriptor * libertas_find_best_ssid_in_list(wlan_adapter * adapter,
+               u8 mode)
 {
-       int bestnet = -ENETUNREACH;
        u8 bestrssi = 0;
-       int i;
+       struct bss_descriptor * iter_bss;
+       struct bss_descriptor * best_bss = NULL;
 
-       ENTER();
+       mutex_lock(&adapter->lock);
 
-       lbs_pr_debug(1, "Num of BSSIDs = %d\n", adapter->numinscantable);
-
-       for (i = 0; i < adapter->numinscantable; i++) {
+       list_for_each_entry (iter_bss, &adapter->network_list, list) {
                switch (mode) {
                case IW_MODE_INFRA:
                case IW_MODE_ADHOC:
-                       if (is_network_compatible(adapter, i, mode) >= 0) {
-                               if (SCAN_RSSI(adapter->scantable[i].rssi) >
-                                   bestrssi) {
-                                       bestrssi =
-                                           SCAN_RSSI(adapter->scantable[i].
-                                                     rssi);
-                                       bestnet = i;
-                               }
-                       }
+                       if (!is_network_compatible(adapter, iter_bss, mode))
+                               break;
+                       if (SCAN_RSSI(iter_bss->rssi) <= bestrssi)
+                               break;
+                       bestrssi = SCAN_RSSI(iter_bss->rssi);
+                       best_bss = iter_bss;
                        break;
                case IW_MODE_AUTO:
                default:
-                       if (SCAN_RSSI(adapter->scantable[i].rssi) > bestrssi) {
-                               bestrssi =
-                                   SCAN_RSSI(adapter->scantable[i].rssi);
-                               bestnet = i;
-                       }
+                       if (SCAN_RSSI(iter_bss->rssi) <= bestrssi)
+                               break;
+                       bestrssi = SCAN_RSSI(iter_bss->rssi);
+                       best_bss = iter_bss;
                        break;
                }
        }
 
-       LEAVE();
-       return bestnet;
+       mutex_unlock(&adapter->lock);
+       return best_bss;
 }
 
 /**
@@ -1354,41 +1369,30 @@ int libertas_find_best_SSID_in_list(wlan_adapter * adapter, u8 mode)
  *
  *  @return             0--success, otherwise--fail
  */
-int libertas_find_best_network_SSID(wlan_private * priv,
-                                    struct WLAN_802_11_SSID *pSSID,
-                                    u8 preferred_mode, u8 *out_mode)
+int libertas_find_best_network_ssid(wlan_private * priv,
+               u8 *out_ssid, u8 *out_ssid_len, u8 preferred_mode, u8 *out_mode)
 {
        wlan_adapter *adapter = priv->adapter;
-       int ret = 0;
-       struct bss_descriptor *preqbssid;
-       int i;
+       int ret = -1;
+       struct bss_descriptor * found;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_ASSOC);
 
-       memset(pSSID, 0, sizeof(struct WLAN_802_11_SSID));
-
-       wlan_scan_networks(priv, NULL);
+       wlan_scan_networks(priv, NULL, 1);
        if (adapter->surpriseremoved)
                return -1;
-       wait_event_interruptible(adapter->cmd_pending, !adapter->nr_cmd_pending);
 
-       i = libertas_find_best_SSID_in_list(adapter, preferred_mode);
-       if (i < 0) {
-               ret = -1;
-               goto out;
-       }
-
-       preqbssid = &adapter->scantable[i];
-       memcpy(pSSID, &preqbssid->ssid,
-              sizeof(struct WLAN_802_11_SSID));
-       *out_mode = preqbssid->mode;
+       wait_event_interruptible(adapter->cmd_pending, !adapter->nr_cmd_pending);
 
-       if (!pSSID->ssidlength) {
-               ret = -1;
+       found = libertas_find_best_ssid_in_list(adapter, preferred_mode);
+       if (found && (found->ssid_len > 0)) {
+               memcpy(out_ssid, &found->ssid, IW_ESSID_MAX_SIZE);
+               *out_ssid_len = found->ssid_len;
+               *out_mode = found->mode;
+               ret = 0;
        }
 
-out:
-       LEAVE();
+       lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret);
        return ret;
 }
 
@@ -1407,20 +1411,15 @@ int libertas_set_scan(struct net_device *dev, struct iw_request_info *info,
 {
        wlan_private *priv = dev->priv;
        wlan_adapter *adapter = priv->adapter;
-       union iwreq_data wrqu;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_SCAN);
 
-       if (!wlan_scan_networks(priv, NULL)) {
-               memset(&wrqu, 0, sizeof(union iwreq_data));
-               wireless_send_event(priv->wlan_dev.netdev, SIOCGIWSCAN, &wrqu,
-                                   NULL);
-       }
+       wlan_scan_networks(priv, NULL, 0);
 
        if (adapter->surpriseremoved)
                return -1;
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_SCAN);
        return 0;
 }
 
@@ -1433,32 +1432,31 @@ int libertas_set_scan(struct net_device *dev, struct iw_request_info *info,
  *
  *  @return                0-success, otherwise fail
  */
-int libertas_send_specific_SSID_scan(wlan_private * priv,
-                        struct WLAN_802_11_SSID *prequestedssid,
-                        u8 keeppreviousscan)
+int libertas_send_specific_ssid_scan(wlan_private * priv,
+                       u8 *ssid, u8 ssid_len, u8 clear_ssid)
 {
        wlan_adapter *adapter = priv->adapter;
        struct wlan_ioctl_user_scan_cfg scancfg;
+       int ret = 0;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_ASSOC);
 
-       if (prequestedssid == NULL) {
-               return -1;
-       }
+       if (!ssid_len)
+               goto out;
 
        memset(&scancfg, 0x00, sizeof(scancfg));
+       memcpy(scancfg.ssid, ssid, ssid_len);
+       scancfg.ssid_len = ssid_len;
+       scancfg.clear_ssid = clear_ssid;
 
-       memcpy(scancfg.specificSSID, prequestedssid->ssid,
-              prequestedssid->ssidlength);
-       scancfg.keeppreviousscan = keeppreviousscan;
-
-       wlan_scan_networks(priv, &scancfg);
+       wlan_scan_networks(priv, &scancfg, 1);
        if (adapter->surpriseremoved)
                return -1;
        wait_event_interruptible(adapter->cmd_pending, !adapter->nr_cmd_pending);
 
-       LEAVE();
-       return 0;
+out:
+       lbs_deb_leave(LBS_DEB_ASSOC);
+       return ret;
 }
 
 /**
@@ -1470,304 +1468,235 @@ int libertas_send_specific_SSID_scan(wlan_private * priv,
  *
  *  @return          0-success, otherwise fail
  */
-int libertas_send_specific_BSSID_scan(wlan_private * priv, u8 * bssid, u8 keeppreviousscan)
+int libertas_send_specific_bssid_scan(wlan_private * priv, u8 * bssid, u8 clear_bssid)
 {
        struct wlan_ioctl_user_scan_cfg scancfg;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_ASSOC);
 
-       if (bssid == NULL) {
-               return -1;
-       }
+       if (bssid == NULL)
+               goto out;
 
        memset(&scancfg, 0x00, sizeof(scancfg));
-       memcpy(scancfg.specificBSSID, bssid, sizeof(scancfg.specificBSSID));
-       scancfg.keeppreviousscan = keeppreviousscan;
+       memcpy(scancfg.bssid, bssid, ETH_ALEN);
+       scancfg.clear_bssid = clear_bssid;
 
-       wlan_scan_networks(priv, &scancfg);
+       wlan_scan_networks(priv, &scancfg, 1);
        if (priv->adapter->surpriseremoved)
                return -1;
        wait_event_interruptible(priv->adapter->cmd_pending,
                !priv->adapter->nr_cmd_pending);
 
-       LEAVE();
+out:
+       lbs_deb_leave(LBS_DEB_ASSOC);
        return 0;
 }
 
-/**
- *  @brief  Retrieve the scan table entries via wireless tools IOCTL call
- *
- *  @param dev          A pointer to net_device structure
- *  @param info         A pointer to iw_request_info structure
- *  @param dwrq         A pointer to iw_point structure
- *  @param extra        A pointer to extra data buf
- *
- *  @return             0 --success, otherwise fail
- */
-int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
-                 struct iw_point *dwrq, char *extra)
+static inline char *libertas_translate_scan(wlan_private *priv,
+                                       char *start, char *stop,
+                                       struct bss_descriptor *bss)
 {
-       wlan_private *priv = dev->priv;
        wlan_adapter *adapter = priv->adapter;
-       int ret = 0;
-       char *current_ev = extra;
-       char *end_buf = extra + IW_SCAN_MAX_DATA;
        struct chan_freq_power *cfp;
-       struct bss_descriptor *pscantable;
        char *current_val;      /* For rates */
        struct iw_event iwe;    /* Temporary buffer */
-       int i;
        int j;
-       int rate;
 #define PERFECT_RSSI ((u8)50)
 #define WORST_RSSI   ((u8)0)
 #define RSSI_DIFF    ((u8)(PERFECT_RSSI - WORST_RSSI))
        u8 rssi;
 
-       u8 buf[16 + 256 * 2];
-       u8 *ptr;
-
-       ENTER();
-
-       /*
-        * if there's either commands in the queue or one being
-        * processed return -EAGAIN for iwlist to retry later.
-        */
-    if (adapter->nr_cmd_pending)
-               return -EAGAIN;
-
-       if (adapter->connect_status == libertas_connected)
-               lbs_pr_debug(1, "Current ssid: %32s\n",
-                      adapter->curbssparams.ssid.ssid);
+       cfp = libertas_find_cfp_by_band_and_channel(adapter, 0, bss->channel);
+       if (!cfp) {
+               lbs_deb_scan("Invalid channel number %d\n", bss->channel);
+               return NULL;
+       }
 
-       lbs_pr_debug(1, "Scan: Get: numinscantable = %d\n",
-              adapter->numinscantable);
+       /* First entry *MUST* be the AP BSSID */
+       iwe.cmd = SIOCGIWAP;
+       iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
+       memcpy(iwe.u.ap_addr.sa_data, &bss->bssid, ETH_ALEN);
+       start = iwe_stream_add_event(start, stop, &iwe, IW_EV_ADDR_LEN);
+
+       /* SSID */
+       iwe.cmd = SIOCGIWESSID;
+       iwe.u.data.flags = 1;
+       iwe.u.data.length = min((u32) bss->ssid_len, (u32) IW_ESSID_MAX_SIZE);
+       start = iwe_stream_add_point(start, stop, &iwe, bss->ssid);
+
+       /* Mode */
+       iwe.cmd = SIOCGIWMODE;
+       iwe.u.mode = bss->mode;
+       start = iwe_stream_add_event(start, stop, &iwe, IW_EV_UINT_LEN);
+
+       /* Frequency */
+       iwe.cmd = SIOCGIWFREQ;
+       iwe.u.freq.m = (long)cfp->freq * 100000;
+       iwe.u.freq.e = 1;
+       start = iwe_stream_add_event(start, stop, &iwe, IW_EV_FREQ_LEN);
+
+       /* Add quality statistics */
+       iwe.cmd = IWEVQUAL;
+       iwe.u.qual.updated = IW_QUAL_ALL_UPDATED;
+       iwe.u.qual.level = SCAN_RSSI(bss->rssi);
+
+       rssi = iwe.u.qual.level - MRVDRV_NF_DEFAULT_SCAN_VALUE;
+       iwe.u.qual.qual =
+           (100 * RSSI_DIFF * RSSI_DIFF - (PERFECT_RSSI - rssi) *
+            (15 * (RSSI_DIFF) + 62 * (PERFECT_RSSI - rssi))) /
+           (RSSI_DIFF * RSSI_DIFF);
+       if (iwe.u.qual.qual > 100)
+               iwe.u.qual.qual = 100;
+
+       if (adapter->NF[TYPE_BEACON][TYPE_NOAVG] == 0) {
+               iwe.u.qual.noise = MRVDRV_NF_DEFAULT_SCAN_VALUE;
+       } else {
+               iwe.u.qual.noise =
+                   CAL_NF(adapter->NF[TYPE_BEACON][TYPE_NOAVG]);
+       }
 
-       /* The old API using SIOCGIWAPLIST had a hard limit of IW_MAX_AP.
-        * The new API using SIOCGIWSCAN is only limited by buffer size
-        * WE-14 -> WE-16 the buffer is limited to IW_SCAN_MAX_DATA bytes
-        * which is 4096.
+       /* Locally created ad-hoc BSSs won't have beacons if this is the
+        * only station in the adhoc network; so get signal strength
+        * from receive statistics.
         */
-       for (i = 0; i < adapter->numinscantable; i++) {
-               if ((current_ev + MAX_SCAN_CELL_SIZE) >= end_buf) {
-                       lbs_pr_debug(1, "i=%d break out: current_ev=%p end_buf=%p "
-                              "MAX_SCAN_CELL_SIZE=%zd\n",
-                              i, current_ev, end_buf, MAX_SCAN_CELL_SIZE);
-                       break;
-               }
-
-               pscantable = &adapter->scantable[i];
-
-               lbs_pr_debug(1, "i=%d  ssid: %32s\n", i, pscantable->ssid.ssid);
-
-               cfp =
-                   libertas_find_cfp_by_band_and_channel(adapter, 0,
-                                                pscantable->channel);
-               if (!cfp) {
-                       lbs_pr_debug(1, "Invalid channel number %d\n",
-                              pscantable->channel);
-                       continue;
-               }
-
-               if (!ssid_valid(&adapter->scantable[i].ssid)) {
-                       continue;
-               }
-
-               /* First entry *MUST* be the AP MAC address */
-               iwe.cmd = SIOCGIWAP;
-               iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
-               memcpy(iwe.u.ap_addr.sa_data,
-                      &adapter->scantable[i].macaddress, ETH_ALEN);
-
-               iwe.len = IW_EV_ADDR_LEN;
-               current_ev =
-                   iwe_stream_add_event(current_ev, end_buf, &iwe, iwe.len);
-
-               //Add the ESSID
-               iwe.u.data.length = adapter->scantable[i].ssid.ssidlength;
-
-               if (iwe.u.data.length > 32) {
-                       iwe.u.data.length = 32;
-               }
-
-               iwe.cmd = SIOCGIWESSID;
-               iwe.u.data.flags = 1;
-               iwe.len = IW_EV_POINT_LEN + iwe.u.data.length;
-               current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe,
-                                                 adapter->scantable[i].ssid.
-                                                 ssid);
-
-               //Add mode
-               iwe.cmd = SIOCGIWMODE;
-               iwe.u.mode = adapter->scantable[i].mode;
-               iwe.len = IW_EV_UINT_LEN;
-               current_ev =
-                   iwe_stream_add_event(current_ev, end_buf, &iwe, iwe.len);
-
-               //frequency
-               iwe.cmd = SIOCGIWFREQ;
-               iwe.u.freq.m = (long)cfp->freq * 100000;
-               iwe.u.freq.e = 1;
-               iwe.len = IW_EV_FREQ_LEN;
-               current_ev =
-                   iwe_stream_add_event(current_ev, end_buf, &iwe, iwe.len);
-
-               /* Add quality statistics */
-               iwe.cmd = IWEVQUAL;
-               iwe.u.qual.updated = IW_QUAL_ALL_UPDATED;
-               iwe.u.qual.level = SCAN_RSSI(adapter->scantable[i].rssi);
-
-               rssi = iwe.u.qual.level - MRVDRV_NF_DEFAULT_SCAN_VALUE;
-               iwe.u.qual.qual =
-                   (100 * RSSI_DIFF * RSSI_DIFF - (PERFECT_RSSI - rssi) *
-                    (15 * (RSSI_DIFF) + 62 * (PERFECT_RSSI - rssi))) /
-                   (RSSI_DIFF * RSSI_DIFF);
-               if (iwe.u.qual.qual > 100)
-                       iwe.u.qual.qual = 100;
-               else if (iwe.u.qual.qual < 1)
-                       iwe.u.qual.qual = 0;
-
-               if (adapter->NF[TYPE_BEACON][TYPE_NOAVG] == 0) {
-                       iwe.u.qual.noise = MRVDRV_NF_DEFAULT_SCAN_VALUE;
-               } else {
-                       iwe.u.qual.noise =
-                           CAL_NF(adapter->NF[TYPE_BEACON][TYPE_NOAVG]);
-               }
-               if ((adapter->mode == IW_MODE_ADHOC) &&
-                   !libertas_SSID_cmp(&adapter->curbssparams.ssid,
-                            &adapter->scantable[i].ssid)
-                   && adapter->adhoccreate) {
-                       ret = libertas_prepare_and_send_command(priv,
-                                                   cmd_802_11_rssi,
-                                                   0,
-                                                   cmd_option_waitforrsp,
-                                                   0, NULL);
-
-                       if (!ret) {
-                               iwe.u.qual.level =
-                                   CAL_RSSI(adapter->SNR[TYPE_RXPD][TYPE_AVG] /
-                                            AVG_SCALE,
-                                            adapter->NF[TYPE_RXPD][TYPE_AVG] /
-                                            AVG_SCALE);
-                       }
-               }
-               iwe.len = IW_EV_QUAL_LEN;
-               current_ev =
-                   iwe_stream_add_event(current_ev, end_buf, &iwe, iwe.len);
-
-               /* Add encryption capability */
-               iwe.cmd = SIOCGIWENCODE;
-               if (adapter->scantable[i].privacy) {
-                       iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
-               } else {
-                       iwe.u.data.flags = IW_ENCODE_DISABLED;
-               }
-               iwe.u.data.length = 0;
-               iwe.len = IW_EV_POINT_LEN + iwe.u.data.length;
-               current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe,
-                                                 adapter->scantable->ssid.
-                                                 ssid);
+       if ((adapter->mode == IW_MODE_ADHOC)
+           && adapter->adhoccreate
+           && !libertas_ssid_cmp(adapter->curbssparams.ssid,
+                                 adapter->curbssparams.ssid_len,
+                                 bss->ssid, bss->ssid_len)) {
+               int snr, nf;
+               snr = adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE;
+               nf = adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE;
+               iwe.u.qual.level = CAL_RSSI(snr, nf);
+       }
+       start = iwe_stream_add_event(start, stop, &iwe, IW_EV_QUAL_LEN);
 
-               current_val = current_ev + IW_EV_LCP_LEN;
+       /* Add encryption capability */
+       iwe.cmd = SIOCGIWENCODE;
+       if (bss->privacy) {
+               iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
+       } else {
+               iwe.u.data.flags = IW_ENCODE_DISABLED;
+       }
+       iwe.u.data.length = 0;
+       start = iwe_stream_add_point(start, stop, &iwe, bss->ssid);
 
-               iwe.cmd = SIOCGIWRATE;
+       current_val = start + IW_EV_LCP_LEN;
 
-               iwe.u.bitrate.fixed = 0;
-               iwe.u.bitrate.disabled = 0;
-               iwe.u.bitrate.value = 0;
+       iwe.cmd = SIOCGIWRATE;
+       iwe.u.bitrate.fixed = 0;
+       iwe.u.bitrate.disabled = 0;
+       iwe.u.bitrate.value = 0;
 
+       for (j = 0; j < sizeof(bss->libertas_supported_rates); j++) {
+               u8 rate = bss->libertas_supported_rates[j];
+               if (rate == 0)
+                       break; /* no more rates */
                /* Bit rate given in 500 kb/s units (+ 0x80) */
-               for (j = 0; j < sizeof(adapter->scantable[i].libertas_supported_rates);
-                    j++) {
-                       if (adapter->scantable[i].libertas_supported_rates[j] == 0) {
-                               break;
-                       }
-                       rate =
-                           (adapter->scantable[i].libertas_supported_rates[j] & 0x7F) *
-                           500000;
-                       if (rate > iwe.u.bitrate.value) {
-                               iwe.u.bitrate.value = rate;
-                       }
-
-                       iwe.u.bitrate.value =
-                           (adapter->scantable[i].libertas_supported_rates[j]
-                            & 0x7f) * 500000;
-                       iwe.len = IW_EV_PARAM_LEN;
-                       current_ev =
-                           iwe_stream_add_value(current_ev, current_val,
-                                                end_buf, &iwe, iwe.len);
+               iwe.u.bitrate.value = (rate & 0x7f) * 500000;
+               current_val = iwe_stream_add_value(start, current_val,
+                                        stop, &iwe, IW_EV_PARAM_LEN);
+       }
+       if ((bss->mode == IW_MODE_ADHOC)
+           && !libertas_ssid_cmp(adapter->curbssparams.ssid,
+                                 adapter->curbssparams.ssid_len,
+                                 bss->ssid, bss->ssid_len)
+           && adapter->adhoccreate) {
+               iwe.u.bitrate.value = 22 * 500000;
+               current_val = iwe_stream_add_value(start, current_val,
+                                        stop, &iwe, IW_EV_PARAM_LEN);
+       }
+       /* Check if we added any event */
+       if((current_val - start) > IW_EV_LCP_LEN)
+               start = current_val;
+
+       memset(&iwe, 0, sizeof(iwe));
+       if (bss->wpa_ie_len) {
+               char buf[MAX_WPA_IE_LEN];
+               memcpy(buf, bss->wpa_ie, bss->wpa_ie_len);
+               iwe.cmd = IWEVGENIE;
+               iwe.u.data.length = bss->wpa_ie_len;
+               start = iwe_stream_add_point(start, stop, &iwe, buf);
+       }
 
-               }
-               if ((adapter->scantable[i].mode == IW_MODE_ADHOC)
-                   && !libertas_SSID_cmp(&adapter->curbssparams.ssid,
-                               &adapter->scantable[i].ssid)
-                   && adapter->adhoccreate) {
-                       iwe.u.bitrate.value = 22 * 500000;
-               }
-               iwe.len = IW_EV_PARAM_LEN;
-               current_ev =
-                   iwe_stream_add_value(current_ev, current_val, end_buf, &iwe,
-                                        iwe.len);
-
-               /* Add new value to event */
-               current_val = current_ev + IW_EV_LCP_LEN;
-
-               if (adapter->scantable[i].rsn_ie[0] == WPA2_IE) {
-                       memset(&iwe, 0, sizeof(iwe));
-                       memset(buf, 0, sizeof(buf));
-                       memcpy(buf, adapter->scantable[i].rsn_ie,
-                                       adapter->scantable[i].rsn_ie_len);
-                       iwe.cmd = IWEVGENIE;
-                       iwe.u.data.length = adapter->scantable[i].rsn_ie_len;
-                       iwe.len = IW_EV_POINT_LEN + iwe.u.data.length;
-                       current_ev = iwe_stream_add_point(current_ev, end_buf,
-                                       &iwe, buf);
-               }
-               if (adapter->scantable[i].wpa_ie[0] == WPA_IE) {
-                       memset(&iwe, 0, sizeof(iwe));
-                       memset(buf, 0, sizeof(buf));
-                       memcpy(buf, adapter->scantable[i].wpa_ie,
-                                       adapter->scantable[i].wpa_ie_len);
-                       iwe.cmd = IWEVGENIE;
-                       iwe.u.data.length = adapter->scantable[i].wpa_ie_len;
-                       iwe.len = IW_EV_POINT_LEN + iwe.u.data.length;
-                       current_ev = iwe_stream_add_point(current_ev, end_buf,
-                                       &iwe, buf);
-               }
+       memset(&iwe, 0, sizeof(iwe));
+       if (bss->rsn_ie_len) {
+               char buf[MAX_WPA_IE_LEN];
+               memcpy(buf, bss->rsn_ie, bss->rsn_ie_len);
+               iwe.cmd = IWEVGENIE;
+               iwe.u.data.length = bss->rsn_ie_len;
+               start = iwe_stream_add_point(start, stop, &iwe, buf);
+       }
 
+       return start;
+}
 
-               if (adapter->scantable[i].extra_ie != 0) {
-                       memset(&iwe, 0, sizeof(iwe));
-                       memset(buf, 0, sizeof(buf));
-                       ptr = buf;
-                       ptr += sprintf(ptr, "extra_ie");
-                       iwe.u.data.length = strlen(buf);
+/**
+ *  @brief  Retrieve the scan table entries via wireless tools IOCTL call
+ *
+ *  @param dev          A pointer to net_device structure
+ *  @param info         A pointer to iw_request_info structure
+ *  @param dwrq         A pointer to iw_point structure
+ *  @param extra        A pointer to extra data buf
+ *
+ *  @return             0 --success, otherwise fail
+ */
+int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
+                 struct iw_point *dwrq, char *extra)
+{
+#define SCAN_ITEM_SIZE 128
+       wlan_private *priv = dev->priv;
+       wlan_adapter *adapter = priv->adapter;
+       int err = 0;
+       char *ev = extra;
+       char *stop = ev + dwrq->length;
+       struct bss_descriptor * iter_bss;
+       struct bss_descriptor * safe;
+
+       lbs_deb_enter(LBS_DEB_ASSOC);
+
+       /* If we've got an uncompleted scan, schedule the next part */
+       if (!adapter->nr_cmd_pending && adapter->last_scanned_channel)
+               wlan_scan_networks(priv, NULL, 0);
+
+       /* Update RSSI if current BSS is a locally created ad-hoc BSS */
+       if ((adapter->mode == IW_MODE_ADHOC) && adapter->adhoccreate) {
+               libertas_prepare_and_send_command(priv, cmd_802_11_rssi, 0,
+                                       cmd_option_waitforrsp, 0, NULL);
+       }
 
-                       lbs_pr_debug(1, "iwe.u.data.length %d\n",
-                              iwe.u.data.length);
-                       lbs_pr_debug(1, "BUF: %s \n", buf);
+       mutex_lock(&adapter->lock);
+       list_for_each_entry_safe (iter_bss, safe, &adapter->network_list, list) {
+               char * next_ev;
+               unsigned long stale_time;
 
-                       iwe.cmd = IWEVCUSTOM;
-                       iwe.len = IW_EV_POINT_LEN + iwe.u.data.length;
-                       current_ev =
-                           iwe_stream_add_point(current_ev, end_buf, &iwe,
-                                                buf);
+               if (stop - ev < SCAN_ITEM_SIZE) {
+                       err = -E2BIG;
+                       break;
                }
 
-               current_val = current_ev + IW_EV_LCP_LEN;
+               /* Prune old an old scan result */
+               stale_time = iter_bss->last_scanned + DEFAULT_MAX_SCAN_AGE;
+               if (time_after(jiffies, stale_time)) {
+                       list_move_tail (&iter_bss->list,
+                                       &adapter->network_free_list);
+                       clear_bss_descriptor(iter_bss);
+                       continue;
+               }
 
-               /*
-                * Check if we added any event
-                */
-               if ((current_val - current_ev) > IW_EV_LCP_LEN)
-                       current_ev = current_val;
+               /* Translate to WE format this entry */
+               next_ev = libertas_translate_scan(priv, ev, stop, iter_bss);
+               if (next_ev == NULL)
+                       continue;
+               ev = next_ev;
        }
+       mutex_unlock(&adapter->lock);
 
-       dwrq->length = (current_ev - extra);
+       dwrq->length = (ev - extra);
        dwrq->flags = 0;
 
-       LEAVE();
-       return 0;
+       lbs_deb_leave(LBS_DEB_ASSOC);
+       return err;
 }
 
 /**
@@ -1796,13 +1725,13 @@ int libertas_cmd_80211_scan(wlan_private * priv,
        struct cmd_ds_802_11_scan *pscan = &cmd->params.scan;
        struct wlan_scan_cmd_config *pscancfg;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_ASSOC);
 
        pscancfg = pdata_buf;
 
        /* Set fixed field variables in scan command */
        pscan->bsstype = pscancfg->bsstype;
-       memcpy(pscan->BSSID, pscancfg->specificBSSID, sizeof(pscan->BSSID));
+       memcpy(pscan->BSSID, pscancfg->bssid, sizeof(pscan->BSSID));
        memcpy(pscan->tlvbuffer, pscancfg->tlvbuffer, pscancfg->tlvbufferlen);
 
        cmd->command = cpu_to_le16(cmd_802_11_scan);
@@ -1812,12 +1741,26 @@ int libertas_cmd_80211_scan(wlan_private * priv,
                                     + sizeof(pscan->BSSID)
                                     + pscancfg->tlvbufferlen + S_DS_GEN);
 
-       lbs_pr_debug(1, "SCAN_CMD: command=%x, size=%x, seqnum=%x\n",
-              cmd->command, cmd->size, cmd->seqnum);
-       LEAVE();
+       lbs_deb_scan("SCAN_CMD: command=%x, size=%x, seqnum=%x\n",
+                    le16_to_cpu(cmd->command), le16_to_cpu(cmd->size),
+                    le16_to_cpu(cmd->seqnum));
+
+       lbs_deb_leave(LBS_DEB_ASSOC);
        return 0;
 }
 
+static inline int is_same_network(struct bss_descriptor *src,
+                                 struct bss_descriptor *dst)
+{
+       /* A network is only a duplicate if the channel, BSSID, and ESSID
+        * all match.  We treat all <hidden> with the same BSSID and channel
+        * as one network */
+       return ((src->ssid_len == dst->ssid_len) &&
+               (src->channel == dst->channel) &&
+               !compare_ether_addr(src->bssid, dst->bssid) &&
+               !memcmp(src->ssid, dst->ssid, src->ssid_len));
+}
+
 /**
  *  @brief This function handles the command response of scan
  *
@@ -1846,38 +1789,45 @@ int libertas_ret_80211_scan(wlan_private * priv, struct cmd_ds_command *resp)
 {
        wlan_adapter *adapter = priv->adapter;
        struct cmd_ds_802_11_scan_rsp *pscan;
-       struct bss_descriptor newbssentry;
        struct mrvlietypes_data *ptlv;
        struct mrvlietypes_tsftimestamp *ptsftlv;
+       struct bss_descriptor * iter_bss;
+       struct bss_descriptor * safe;
        u8 *pbssinfo;
        u16 scanrespsize;
        int bytesleft;
-       int numintable;
-       int bssIdx;
        int idx;
        int tlvbufsize;
-       u64 tsfval;
+       int ret;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_ASSOC);
+
+       /* Prune old entries from scan table */
+       list_for_each_entry_safe (iter_bss, safe, &adapter->network_list, list) {
+               unsigned long stale_time = iter_bss->last_scanned + DEFAULT_MAX_SCAN_AGE;
+               if (time_before(jiffies, stale_time))
+                       continue;
+               list_move_tail (&iter_bss->list, &adapter->network_free_list);
+               clear_bss_descriptor(iter_bss);
+       }
 
        pscan = &resp->params.scanresp;
 
-       if (pscan->nr_sets > MRVDRV_MAX_BSSID_LIST) {
-        lbs_pr_debug(1,
-                      "SCAN_RESP: Invalid number of AP returned (%d)!!\n",
-                      pscan->nr_sets);
-               LEAVE();
-               return -1;
+       if (pscan->nr_sets > MAX_NETWORK_COUNT) {
+               lbs_deb_scan(
+                      "SCAN_RESP: too many scan results (%d, max %d)!!\n",
+                      pscan->nr_sets, MAX_NETWORK_COUNT);
+               ret = -1;
+               goto done;
        }
 
        bytesleft = le16_to_cpu(pscan->bssdescriptsize);
-       lbs_pr_debug(1, "SCAN_RESP: bssdescriptsize %d\n", bytesleft);
+       lbs_deb_scan("SCAN_RESP: bssdescriptsize %d\n", bytesleft);
 
        scanrespsize = le16_to_cpu(resp->size);
-       lbs_pr_debug(1, "SCAN_RESP: returned %d AP before parsing\n",
+       lbs_deb_scan("SCAN_RESP: returned %d AP before parsing\n",
               pscan->nr_sets);
 
-       numintable = adapter->numinscantable;
        pbssinfo = pscan->bssdesc_and_tlvbuffer;
 
        /* The size of the TLV buffer is equal to the entire command response
@@ -1901,105 +1851,68 @@ int libertas_ret_80211_scan(wlan_private * priv, struct cmd_ds_command *resp)
         *    or as an addition at the end of the table
         */
        for (idx = 0; idx < pscan->nr_sets && bytesleft; idx++) {
-               /* Zero out the newbssentry we are about to store info in */
-               memset(&newbssentry, 0x00, sizeof(newbssentry));
+               struct bss_descriptor new;
+               struct bss_descriptor * found = NULL;
+               struct bss_descriptor * oldest = NULL;
 
                /* Process the data fields and IEs returned for this BSS */
-               if ((InterpretBSSDescriptionWithIE(&newbssentry,
-                                                  &pbssinfo,
-                                                  &bytesleft) ==
-                    0)
-                   && CHECK_SSID_IS_VALID(&newbssentry.ssid)) {
-
-            lbs_pr_debug(1,
-                              "SCAN_RESP: BSSID = %02x:%02x:%02x:%02x:%02x:%02x\n",
-                              newbssentry.macaddress[0],
-                              newbssentry.macaddress[1],
-                              newbssentry.macaddress[2],
-                              newbssentry.macaddress[3],
-                              newbssentry.macaddress[4],
-                              newbssentry.macaddress[5]);
-
-                       /*
-                        * Search the scan table for the same bssid
-                        */
-                       for (bssIdx = 0; bssIdx < numintable; bssIdx++) {
-                               if (memcmp(newbssentry.macaddress,
-                                          adapter->scantable[bssIdx].
-                                          macaddress,
-                                          sizeof(newbssentry.macaddress)) ==
-                                   0) {
-                                       /*
-                                        * If the SSID matches as well, it is a duplicate of
-                                        *   this entry.  Keep the bssIdx set to this
-                                        *   entry so we replace the old contents in the table
-                                        */
-                                       if ((newbssentry.ssid.ssidlength ==
-                                            adapter->scantable[bssIdx].ssid.
-                                            ssidlength)
-                                           &&
-                                           (memcmp
-                                            (newbssentry.ssid.ssid,
-                                             adapter->scantable[bssIdx].ssid.
-                                             ssid,
-                                             newbssentry.ssid.ssidlength) ==
-                                            0)) {
-                        lbs_pr_debug(1,
-                                                      "SCAN_RESP: Duplicate of index: %d\n",
-                                                      bssIdx);
-                                               break;
-                                       }
-                               }
-                       }
-                       /*
-                        * If the bssIdx is equal to the number of entries in the table,
-                        *   the new entry was not a duplicate; append it to the scan
-                        *   table
-                        */
-                       if (bssIdx == numintable) {
-                               /* Range check the bssIdx, keep it limited to the last entry */
-                               if (bssIdx == MRVDRV_MAX_BSSID_LIST) {
-                                       bssIdx--;
-                               } else {
-                                       numintable++;
-                               }
-                       }
-
-                       /*
-                        * If the TSF TLV was appended to the scan results, save the
-                        *   this entries TSF value in the networktsf field.  The
-                        *   networktsf is the firmware's TSF value at the time the
-                        *   beacon or probe response was received.
-                        */
-                       if (ptsftlv) {
-                               memcpy(&tsfval, &ptsftlv->tsftable[idx],
-                                      sizeof(tsfval));
-                               tsfval = le64_to_cpu(tsfval);
+               memset(&new, 0, sizeof (struct bss_descriptor));
+               if (libertas_process_bss(&new, &pbssinfo, &bytesleft) != 0) {
+                       /* error parsing the scan response, skipped */
+                       lbs_deb_scan("SCAN_RESP: process_bss returned ERROR\n");
+                       continue;
+               }
 
-                               memcpy(&newbssentry.networktsf,
-                                      &tsfval, sizeof(newbssentry.networktsf));
+               /* Try to find this bss in the scan table */
+               list_for_each_entry (iter_bss, &adapter->network_list, list) {
+                       if (is_same_network(iter_bss, &new)) {
+                               found = iter_bss;
+                               break;
                        }
 
-                       /* Copy the locally created newbssentry to the scan table */
-                       memcpy(&adapter->scantable[bssIdx],
-                              &newbssentry,
-                              sizeof(adapter->scantable[bssIdx]));
+                       if ((oldest == NULL) ||
+                           (iter_bss->last_scanned < oldest->last_scanned))
+                               oldest = iter_bss;
+               }
 
+               if (found) {
+                       /* found, clear it */
+                       clear_bss_descriptor(found);
+               } else if (!list_empty(&adapter->network_free_list)) {
+                       /* Pull one from the free list */
+                       found = list_entry(adapter->network_free_list.next,
+                                          struct bss_descriptor, list);
+                       list_move_tail(&found->list, &adapter->network_list);
+               } else if (oldest) {
+                       /* If there are no more slots, expire the oldest */
+                       found = oldest;
+                       clear_bss_descriptor(found);
+                       list_move_tail(&found->list, &adapter->network_list);
                } else {
+                       continue;
+               }
+
+               lbs_deb_scan("SCAN_RESP: BSSID = " MAC_FMT "\n",
+                      new.bssid[0], new.bssid[1], new.bssid[2],
+                      new.bssid[3], new.bssid[4], new.bssid[5]);
 
-                       /* error parsing/interpreting the scan response, skipped */
-                       lbs_pr_debug(1, "SCAN_RESP: "
-                              "InterpretBSSDescriptionWithIE returned ERROR\n");
+               /*
+                * If the TSF TLV was appended to the scan results, save the
+                *   this entries TSF value in the networktsf field.  The
+                *   networktsf is the firmware's TSF value at the time the
+                *   beacon or probe response was received.
+                */
+               if (ptsftlv) {
+                       new.networktsf = le64_to_cpup(&ptsftlv->tsftable[idx]);
                }
-       }
 
-       lbs_pr_debug(1, "SCAN_RESP: Scanned %2d APs, %d valid, %d total\n",
-              pscan->nr_sets, numintable - adapter->numinscantable,
-              numintable);
+               /* Copy the locally created newbssentry to the scan table */
+               memcpy(found, &new, offsetof(struct bss_descriptor, list));
+       }
 
-       /* Update the total number of BSSIDs in the scan table */
-       adapter->numinscantable = numintable;
+       ret = 0;
 
-       LEAVE();
-       return 0;
+done:
+       lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret);
+       return ret;
 }
index 405f4f0fe575b2164295c6475cc78c1634e76558..bd019e5ff1eb24f294fb7c12d0874017ecef7136 100644 (file)
@@ -51,7 +51,7 @@ struct wlan_scan_cmd_config {
     /**
      *  @brief Specific BSSID used to filter scan results in the firmware
      */
-       u8 specificBSSID[ETH_ALEN];
+       u8 bssid[ETH_ALEN];
 
     /**
      *  @brief length of TLVs sent in command starting at tlvBuffer
@@ -91,15 +91,6 @@ struct wlan_ioctl_user_scan_chan {
  *  @sa libertas_set_user_scan_ioctl
  */
 struct wlan_ioctl_user_scan_cfg {
-
-    /**
-     *  @brief Flag set to keep the previous scan table intact
-     *
-     *  If set, the scan results will accumulate, replacing any previous
-     *   matched entries for a BSS with the new scan data
-     */
-       u8 keeppreviousscan;    //!< Do not erase the existing scan results
-
     /**
      *  @brief BSS type to be sent in the firmware command
      *
@@ -117,15 +108,22 @@ struct wlan_ioctl_user_scan_cfg {
      */
        u8 numprobes;
 
-    /**
-     *  @brief BSSID filter sent in the firmware command to limit the results
-     */
-       u8 specificBSSID[ETH_ALEN];
+       /**
+        *  @brief BSSID filter sent in the firmware command to limit the results
+        */
+       u8 bssid[ETH_ALEN];
 
-    /**
-     *  @brief SSID filter sent in the firmware command to limit the results
-     */
-       char specificSSID[IW_ESSID_MAX_SIZE + 1];
+       /* Clear existing scan results matching this BSSID */
+       u8 clear_bssid;
+
+       /**
+        *  @brief SSID filter sent in the firmware command to limit the results
+        */
+       char ssid[IW_ESSID_MAX_SIZE];
+       u8 ssid_len;
+
+       /* Clear existing scan results matching this SSID */
+       u8 clear_ssid;
 
     /**
      *  @brief Variable number (fixed maximum) of channels to scan up
@@ -137,9 +135,10 @@ struct wlan_ioctl_user_scan_cfg {
  *  @brief Structure used to store information for each beacon/probe response
  */
 struct bss_descriptor {
-       u8 macaddress[ETH_ALEN];
+       u8 bssid[ETH_ALEN];
 
-       struct WLAN_802_11_SSID ssid;
+       u8 ssid[IW_ESSID_MAX_SIZE + 1];
+       u8 ssid_len;
 
        /* WEP encryption requirement */
        u32 privacy;
@@ -156,15 +155,15 @@ struct bss_descriptor {
        u8 mode;
        u8 libertas_supported_rates[WLAN_SUPPORTED_RATES];
 
-       int extra_ie;
+       __le64 timestamp;       //!< TSF value included in the beacon/probe response
+       unsigned long last_scanned;
 
-       u8 timestamp[8];        //!< TSF value included in the beacon/probe response
        union ieeetypes_phyparamset phyparamset;
        union IEEEtypes_ssparamset ssparamset;
        struct ieeetypes_capinfo cap;
        u8 datarates[WLAN_SUPPORTED_RATES];
 
-       __le64 networktsf;              //!< TSF timestamp from the current firmware TSF
+       u64 networktsf;         //!< TSF timestamp from the current firmware TSF
 
        struct ieeetypes_countryinfofullset countryinfo;
 
@@ -172,24 +171,29 @@ struct bss_descriptor {
        size_t wpa_ie_len;
        u8 rsn_ie[MAX_WPA_IE_LEN];
        size_t rsn_ie_len;
+
+       struct list_head list;
 };
 
-extern int libertas_SSID_cmp(struct WLAN_802_11_SSID *ssid1,
-                  struct WLAN_802_11_SSID *ssid2);
-extern int libertas_find_SSID_in_list(wlan_adapter * adapter, struct WLAN_802_11_SSID *ssid,
-                         u8 * bssid, u8 mode);
-int libertas_find_best_SSID_in_list(wlan_adapter * adapter, u8 mode);
-extern int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, u8 mode);
+extern int libertas_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len);
+
+struct bss_descriptor * libertas_find_ssid_in_list(wlan_adapter * adapter,
+                       u8 *ssid, u8 ssid_len, u8 * bssid, u8 mode,
+                       int channel);
+
+struct bss_descriptor * libertas_find_best_ssid_in_list(wlan_adapter * adapter,
+                       u8 mode);
+
+extern struct bss_descriptor * libertas_find_bssid_in_list(wlan_adapter * adapter,
+                       u8 * bssid, u8 mode);
 
-int libertas_find_best_network_SSID(wlan_private * priv,
-                       struct WLAN_802_11_SSID *pSSID,
-                       u8 preferred_mode, u8 *out_mode);
+int libertas_find_best_network_ssid(wlan_private * priv, u8 *out_ssid,
+                       u8 *out_ssid_len, u8 preferred_mode, u8 *out_mode);
 
-extern int libertas_send_specific_SSID_scan(wlan_private * priv,
-                               struct WLAN_802_11_SSID *prequestedssid,
-                               u8 keeppreviousscan);
-extern int libertas_send_specific_BSSID_scan(wlan_private * priv,
-                                u8 * bssid, u8 keeppreviousscan);
+extern int libertas_send_specific_ssid_scan(wlan_private * priv, u8 *ssid,
+                               u8 ssid_len, u8 clear_ssid);
+extern int libertas_send_specific_bssid_scan(wlan_private * priv,
+                                u8 * bssid, u8 clear_bssid);
 
 extern int libertas_cmd_80211_scan(wlan_private * priv,
                                struct cmd_ds_command *cmd,
@@ -199,7 +203,8 @@ extern int libertas_ret_80211_scan(wlan_private * priv,
                                struct cmd_ds_command *resp);
 
 int wlan_scan_networks(wlan_private * priv,
-                const struct wlan_ioctl_user_scan_cfg * puserscanin);
+                const struct wlan_ioctl_user_scan_cfg * puserscanin,
+                int full_scan);
 
 struct ifreq;
 
index 207b8a6cc33d632c0214a5d75eac182ff7dc5ef6..b1f34d92ff3e3ca81592d35199b4fe04a25a7966 100644 (file)
@@ -21,11 +21,11 @@ static inline void wlan_activate_thread(struct wlan_thread * thr)
 
 static inline void wlan_deactivate_thread(struct wlan_thread * thr)
 {
-       ENTER();
+       lbs_deb_enter(LBS_DEB_THREAD);
 
        thr->pid = 0;
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_THREAD);
 }
 
 static inline void wlan_create_thread(int (*wlanfunc) (void *),
@@ -36,7 +36,7 @@ static inline void wlan_create_thread(int (*wlanfunc) (void *),
 
 static inline int wlan_terminate_thread(struct wlan_thread * thr)
 {
-       ENTER();
+       lbs_deb_enter(LBS_DEB_THREAD);
 
        /* Check if the thread is active or not */
        if (!thr->pid) {
@@ -45,7 +45,7 @@ static inline int wlan_terminate_thread(struct wlan_thread * thr)
        }
        kthread_stop(thr->task);
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_THREAD);
        return 0;
 }
 
index d4b13478c9a7efaf3c48c5fda957c2df46b73d21..17c437635a00845932231337c5d8aac1a00a89cf 100644 (file)
@@ -5,7 +5,6 @@
 
 #include "hostcmd.h"
 #include "radiotap.h"
-#include "sbi.h"
 #include "decl.h"
 #include "defs.h"
 #include "dev.h"
@@ -68,7 +67,7 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
        u32 new_rate;
        u8 *ptr = priv->adapter->tmptxbuf;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_TX);
 
        if (priv->adapter->surpriseremoved)
                return -1;
@@ -78,7 +77,7 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
                         min_t(unsigned int, skb->len, 100));
 
        if (!skb->len || (skb->len > MRVDRV_ETH_TX_PACKET_BUFFER_SIZE)) {
-               lbs_pr_debug(1, "Tx error: Bad skb length %d : %zd\n",
+               lbs_deb_tx("tx err: skb length %d 0 or > %zd\n",
                       skb->len, MRVDRV_ETH_TX_PACKET_BUFFER_SIZE);
                ret = -1;
                goto done;
@@ -86,13 +85,13 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
 
        memset(plocaltxpd, 0, sizeof(struct txpd));
 
-       plocaltxpd->tx_packet_length = skb->len;
+       plocaltxpd->tx_packet_length = cpu_to_le16(skb->len);
 
        /* offset of actual data */
-       plocaltxpd->tx_packet_location = sizeof(struct txpd);
+       plocaltxpd->tx_packet_location = cpu_to_le32(sizeof(struct txpd));
 
        /* TxCtrl set by user or default */
-       plocaltxpd->tx_control = adapter->pkttxctrl;
+       plocaltxpd->tx_control = cpu_to_le32(adapter->pkttxctrl);
 
        p802x_hdr = skb->data;
        if (priv->adapter->radiomode == WLAN_RADIOMODE_RADIOTAP) {
@@ -103,15 +102,16 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
                /* set txpd fields from the radiotap header */
                new_rate = convert_radiotap_rate_to_mv(pradiotap_hdr->rate);
                if (new_rate != 0) {
-                       /* erase tx_control[4:0] */
-                       plocaltxpd->tx_control &= ~0x1f;
-                       /* write new tx_control[4:0] */
-                       plocaltxpd->tx_control |= new_rate;
+                       /* use new tx_control[4:0] */
+                       new_rate |= (adapter->pkttxctrl & ~0x1f);
+                       plocaltxpd->tx_control = cpu_to_le32(new_rate);
                }
 
                /* skip the radiotap header */
                p802x_hdr += sizeof(struct tx_radiotap_hdr);
-               plocaltxpd->tx_packet_length -= sizeof(struct tx_radiotap_hdr);
+               plocaltxpd->tx_packet_length =
+                       cpu_to_le16(le16_to_cpu(plocaltxpd->tx_packet_length)
+                                   - sizeof(struct tx_radiotap_hdr));
 
        }
        /* copy destination address from 802.3 or 802.11 header */
@@ -123,28 +123,28 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
        lbs_dbg_hex("txpd", (u8 *) plocaltxpd, sizeof(struct txpd));
 
        if (IS_MESH_FRAME(skb)) {
-               plocaltxpd->tx_control |= TxPD_MESH_FRAME;
+               plocaltxpd->tx_control |= cpu_to_le32(TxPD_MESH_FRAME);
        }
 
        memcpy(ptr, plocaltxpd, sizeof(struct txpd));
 
        ptr += sizeof(struct txpd);
 
-       lbs_dbg_hex("Tx Data", (u8 *) p802x_hdr, plocaltxpd->tx_packet_length);
-       memcpy(ptr, p802x_hdr, plocaltxpd->tx_packet_length);
-       ret = libertas_sbi_host_to_card(priv, MVMS_DAT,
-                              priv->adapter->tmptxbuf,
-                              plocaltxpd->tx_packet_length +
-                              sizeof(struct txpd));
+       lbs_dbg_hex("Tx Data", (u8 *) p802x_hdr, le16_to_cpu(plocaltxpd->tx_packet_length));
+       memcpy(ptr, p802x_hdr, le16_to_cpu(plocaltxpd->tx_packet_length));
+       ret = priv->hw_host_to_card(priv, MVMS_DAT,
+                                   priv->adapter->tmptxbuf,
+                                   le16_to_cpu(plocaltxpd->tx_packet_length) +
+                                   sizeof(struct txpd));
 
        if (ret) {
-               lbs_pr_debug(1, "Tx error: libertas_sbi_host_to_card failed: 0x%X\n", ret);
+               lbs_deb_tx("tx err: hw_host_to_card returned 0x%X\n", ret);
                goto done;
        }
 
-       lbs_pr_debug(1, "SendSinglePacket succeeds\n");
+       lbs_deb_tx("SendSinglePacket succeeds\n");
 
-      done:
+done:
        if (!ret) {
                priv->stats.tx_packets++;
                priv->stats.tx_bytes += skb->len;
@@ -158,7 +158,8 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
                   received from FW */
                skb_orphan(skb);
                /* stop processing outgoing pkts */
-               netif_stop_queue(priv->wlan_dev.netdev);
+               netif_stop_queue(priv->dev);
+               netif_stop_queue(priv->mesh_dev);
                /* freeze any packets already in our queues */
                priv->adapter->TxLockFlag = 1;
        } else {
@@ -166,7 +167,7 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
                priv->adapter->currenttxskb = NULL;
        }
 
-       LEAVE();
+       lbs_deb_leave_args(LBS_DEB_TX, "ret %d", ret);
        return ret;
 }
 
@@ -195,10 +196,13 @@ static void wlan_tx_queue(wlan_private *priv, struct sk_buff *skb)
 
        WARN_ON(priv->adapter->tx_queue_idx >= NR_TX_QUEUE);
        adapter->tx_queue_ps[adapter->tx_queue_idx++] = skb;
-       if (adapter->tx_queue_idx == NR_TX_QUEUE)
-               netif_stop_queue(priv->wlan_dev.netdev);
-       else
-               netif_start_queue(priv->wlan_dev.netdev);
+       if (adapter->tx_queue_idx == NR_TX_QUEUE) {
+               netif_stop_queue(priv->dev);
+               netif_stop_queue(priv->mesh_dev);
+       } else {
+               netif_start_queue(priv->dev);
+               netif_start_queue(priv->mesh_dev);
+       }
 
        spin_unlock(&adapter->txqueue_lock);
 }
@@ -214,13 +218,12 @@ int libertas_process_tx(wlan_private * priv, struct sk_buff *skb)
 {
        int ret = -1;
 
-       ENTER();
-
+       lbs_deb_enter(LBS_DEB_TX);
        lbs_dbg_hex("TX Data", skb->data, min_t(unsigned int, skb->len, 100));
 
-       if (priv->wlan_dev.dnld_sent) {
+       if (priv->dnld_sent) {
                lbs_pr_alert( "TX error: dnld_sent = %d, not sending\n",
-                      priv->wlan_dev.dnld_sent);
+                      priv->dnld_sent);
                goto done;
        }
 
@@ -234,7 +237,7 @@ int libertas_process_tx(wlan_private * priv, struct sk_buff *skb)
 
        ret = SendSinglePacket(priv, skb);
 done:
-       LEAVE();
+       lbs_deb_leave_args(LBS_DEB_TX, "ret %d", ret);
        return ret;
 }
 
@@ -280,6 +283,9 @@ void libertas_send_tx_feedback(wlan_private * priv)
        libertas_upload_rx_packet(priv, adapter->currenttxskb);
        adapter->currenttxskb = NULL;
        priv->adapter->TxLockFlag = 0;
-       if (priv->adapter->connect_status == libertas_connected)
-               netif_wake_queue(priv->wlan_dev.netdev);
+       if (priv->adapter->connect_status == libertas_connected) {
+               netif_wake_queue(priv->dev);
+               netif_wake_queue(priv->mesh_dev);
+       }
 }
+EXPORT_SYMBOL_GPL(libertas_send_tx_feedback);
index 09d62f8b1a1638b9860ef19dd6cee5cb29724e5a..028e2f3b53d6e0768c2a901bc3e861e10d9add75 100644 (file)
@@ -5,6 +5,7 @@
 #define _WLAN_TYPES_
 
 #include <linux/if_ether.h>
+#include <asm/byteorder.h>
 
 /** IEEE type definitions  */
 enum ieeetypes_elementid {
@@ -29,9 +30,30 @@ enum ieeetypes_elementid {
        EXTRA_IE = 133,
 } __attribute__ ((packed));
 
+#ifdef __BIG_ENDIAN
 #define CAPINFO_MASK   (~(0xda00))
+#else
+#define CAPINFO_MASK   (~(0x00da))
+#endif
 
 struct ieeetypes_capinfo {
+#ifdef __BIG_ENDIAN_BITFIELD
+       u8 chanagility:1;
+       u8 pbcc:1;
+       u8 shortpreamble:1;
+       u8 privacy:1;
+       u8 cfpollrqst:1;
+       u8 cfpollable:1;
+       u8 ibss:1;
+       u8 ess:1;
+       u8 rsrvd1:2;
+       u8 dsssofdm:1;
+       u8 rsvrd2:1;
+       u8 apsd:1;
+       u8 shortslottime:1;
+       u8 rsrvd3:1;
+       u8 spectrummgmt:1;
+#else
        u8 ess:1;
        u8 ibss:1;
        u8 cfpollable:1;
@@ -47,6 +69,7 @@ struct ieeetypes_capinfo {
        u8 rsvrd2:1;
        u8 dsssofdm:1;
        u8 rsrvd1:2;
+#endif
 } __attribute__ ((packed));
 
 struct ieeetypes_cfparamset {
@@ -54,15 +77,15 @@ struct ieeetypes_cfparamset {
        u8 len;
        u8 cfpcnt;
        u8 cfpperiod;
-       u16 cfpmaxduration;
-       u16 cfpdurationremaining;
+       __le16 cfpmaxduration;
+       __le16 cfpdurationremaining;
 } __attribute__ ((packed));
 
 
 struct ieeetypes_ibssparamset {
        u8 elementid;
        u8 len;
-       u16 atimwindow;
+       __le16 atimwindow;
 } __attribute__ ((packed));
 
 union IEEEtypes_ssparamset {
@@ -73,7 +96,7 @@ union IEEEtypes_ssparamset {
 struct ieeetypes_fhparamset {
        u8 elementid;
        u8 len;
-       u16 dwelltime;
+       __le16 dwelltime;
        u8 hopset;
        u8 hoppattern;
        u8 hopindex;
@@ -92,8 +115,8 @@ union ieeetypes_phyparamset {
 
 struct ieeetypes_assocrsp {
        struct ieeetypes_capinfo capability;
-       u16 statuscode;
-       u16 aid;
+       __le16 statuscode;
+       __le16 aid;
        u8 iebuffer[1];
 } __attribute__ ((packed));
 
@@ -138,8 +161,8 @@ struct ieeetypes_assocrsp {
 
 /** TLV related data structures*/
 struct mrvlietypesheader {
-       u16 type;
-       u16 len;
+       __le16 type;
+       __le16 len;
 } __attribute__ ((packed));
 
 struct mrvlietypes_data {
@@ -164,17 +187,23 @@ struct mrvlietypes_wildcardssidparamset {
 } __attribute__ ((packed));
 
 struct chanscanmode {
+#ifdef __BIG_ENDIAN_BITFIELD
+       u8 reserved_2_7:6;
+       u8 disablechanfilt:1;
+       u8 passivescan:1;
+#else
        u8 passivescan:1;
        u8 disablechanfilt:1;
        u8 reserved_2_7:6;
+#endif
 } __attribute__ ((packed));
 
 struct chanscanparamset {
        u8 radiotype;
        u8 channumber;
        struct chanscanmode chanscanmode;
-       u16 minscantime;
-       u16 maxscantime;
+       __le16 minscantime;
+       __le16 maxscantime;
 } __attribute__ ((packed));
 
 struct mrvlietypes_chanlistparamset {
@@ -185,12 +214,12 @@ struct mrvlietypes_chanlistparamset {
 struct cfparamset {
        u8 cfpcnt;
        u8 cfpperiod;
-       u16 cfpmaxduration;
-       u16 cfpdurationremaining;
+       __le16 cfpmaxduration;
+       __le16 cfpdurationremaining;
 } __attribute__ ((packed));
 
 struct ibssparamset {
-       u16 atimwindow;
+       __le16 atimwindow;
 } __attribute__ ((packed));
 
 struct mrvlietypes_ssparamset {
@@ -202,7 +231,7 @@ struct mrvlietypes_ssparamset {
 } __attribute__ ((packed));
 
 struct fhparamset {
-       u16 dwelltime;
+       __le16 dwelltime;
        u8 hopset;
        u8 hoppattern;
        u8 hopindex;
@@ -263,17 +292,17 @@ struct mrvlietypes_beaconsmissed {
 
 struct mrvlietypes_numprobes {
        struct mrvlietypesheader header;
-       u16 numprobes;
+       __le16 numprobes;
 } __attribute__ ((packed));
 
 struct mrvlietypes_bcastprobe {
        struct mrvlietypesheader header;
-       u16 bcastprobe;
+       __le16 bcastprobe;
 } __attribute__ ((packed));
 
 struct mrvlietypes_numssidprobe {
        struct mrvlietypesheader header;
-       u16 numssidprobe;
+       __le16 numssidprobe;
 } __attribute__ ((packed));
 
 struct led_pin {
index 69f52b6e59c865d58a7583d6521d00c370e56a7a..8939251a2f4cd4efe3e775a10d396f39269e1f77 100644 (file)
 #include "assoc.h"
 
 
+/**
+ * the rates supported by the card
+ */
+static u8 libertas_wlan_data_rates[WLAN_SUPPORTED_RATES] =
+    { 0x02, 0x04, 0x0B, 0x16, 0x00, 0x0C, 0x12,
+      0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x00
+};
+
 /**
  *  @brief Convert mw value to dbm value
  *
@@ -102,8 +110,8 @@ struct chan_freq_power *libertas_find_cfp_by_band_and_channel(wlan_adapter * ada
        }
 
        if (!cfp && channel)
-               lbs_pr_debug(1, "libertas_find_cfp_by_band_and_channel(): cannot find "
-                      "cfp by band %d & channel %d\n", band, channel);
+               lbs_deb_wext("libertas_find_cfp_by_band_and_channel: can't find "
+                      "cfp by band %d / channel %d\n", band, channel);
 
        return cfp;
 }
@@ -143,113 +151,12 @@ static struct chan_freq_power *find_cfp_by_band_and_freq(wlan_adapter * adapter,
        }
 
        if (!cfp && freq)
-               lbs_pr_debug(1, "find_cfp_by_band_and_freql(): cannot find cfp by "
-                      "band %d & freq %d\n", band, freq);
+               lbs_deb_wext("find_cfp_by_band_and_freql: can't find cfp by "
+                      "band %d / freq %d\n", band, freq);
 
        return cfp;
 }
 
-static int updatecurrentchannel(wlan_private * priv)
-{
-       int ret;
-
-       /*
-        ** the channel in f/w could be out of sync, get the current channel
-        */
-       ret = libertas_prepare_and_send_command(priv, cmd_802_11_rf_channel,
-                                   cmd_opt_802_11_rf_channel_get,
-                                   cmd_option_waitforrsp, 0, NULL);
-
-       lbs_pr_debug(1, "Current channel = %d\n",
-              priv->adapter->curbssparams.channel);
-
-       return ret;
-}
-
-static int setcurrentchannel(wlan_private * priv, int channel)
-{
-       lbs_pr_debug(1, "Set channel = %d\n", channel);
-
-       /*
-        **  Current channel is not set to adhocchannel requested, set channel
-        */
-       return (libertas_prepare_and_send_command(priv, cmd_802_11_rf_channel,
-                                     cmd_opt_802_11_rf_channel_set,
-                                     cmd_option_waitforrsp, 0, &channel));
-}
-
-static int changeadhocchannel(wlan_private * priv, int channel)
-{
-       int ret = 0;
-       wlan_adapter *adapter = priv->adapter;
-
-       adapter->adhocchannel = channel;
-
-       updatecurrentchannel(priv);
-
-       if (adapter->curbssparams.channel == adapter->adhocchannel) {
-               /* adhocchannel is set to the current channel already */
-               LEAVE();
-               return 0;
-       }
-
-       lbs_pr_debug(1, "Updating channel from %d to %d\n",
-              adapter->curbssparams.channel, adapter->adhocchannel);
-
-       setcurrentchannel(priv, adapter->adhocchannel);
-
-       updatecurrentchannel(priv);
-
-       if (adapter->curbssparams.channel != adapter->adhocchannel) {
-               lbs_pr_debug(1, "failed to updated channel to %d, channel = %d\n",
-                      adapter->adhocchannel, adapter->curbssparams.channel);
-               LEAVE();
-               return -1;
-       }
-
-       if (adapter->connect_status == libertas_connected) {
-               int i;
-               struct WLAN_802_11_SSID curadhocssid;
-
-               lbs_pr_debug(1, "channel Changed while in an IBSS\n");
-
-               /* Copy the current ssid */
-               memcpy(&curadhocssid, &adapter->curbssparams.ssid,
-                      sizeof(struct WLAN_802_11_SSID));
-
-               /* Exit Adhoc mode */
-               lbs_pr_debug(1, "In changeadhocchannel(): Sending Adhoc Stop\n");
-               ret = libertas_stop_adhoc_network(priv);
-
-               if (ret) {
-                       LEAVE();
-                       return ret;
-               }
-               /* Scan for the network, do not save previous results.  Stale
-                *   scan data will cause us to join a non-existant adhoc network
-                */
-               libertas_send_specific_SSID_scan(priv, &curadhocssid, 0);
-
-               // find out the BSSID that matches the current SSID
-               i = libertas_find_SSID_in_list(adapter, &curadhocssid, NULL,
-                                  IW_MODE_ADHOC);
-
-               if (i >= 0) {
-                       lbs_pr_debug(1, "SSID found at %d in List,"
-                              "so join\n", i);
-                       libertas_join_adhoc_network(priv, &adapter->scantable[i]);
-               } else {
-                       // else send START command
-                       lbs_pr_debug(1, "SSID not found in list, "
-                              "so creating adhoc with ssid = %s\n",
-                              curadhocssid.ssid);
-                       libertas_start_adhoc_network(priv, &curadhocssid);
-               }               // end of else (START command)
-       }
-
-       LEAVE();
-       return 0;
-}
 
 /**
  *  @brief Set Radio On/OFF
@@ -263,10 +170,10 @@ int wlan_radio_ioctl(wlan_private * priv, u8 option)
        int ret = 0;
        wlan_adapter *adapter = priv->adapter;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
 
        if (adapter->radioon != option) {
-               lbs_pr_debug(1, "Switching %s the Radio\n", option ? "On" : "Off");
+               lbs_deb_wext("switching radio %s\n", option ? "on" : "off");
                adapter->radioon = option;
 
                ret = libertas_prepare_and_send_command(priv,
@@ -275,7 +182,7 @@ int wlan_radio_ioctl(wlan_private * priv, u8 option)
                                            cmd_option_waitforrsp, 0, NULL);
        }
 
-       LEAVE();
+       lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
        return ret;
 }
 
@@ -312,15 +219,15 @@ static int get_active_data_rates(wlan_adapter * adapter,
 {
        int k = 0;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
 
        if (adapter->connect_status != libertas_connected) {
                if (adapter->mode == IW_MODE_INFRA) {
-                       lbs_pr_debug(1, "Infra\n");
+                       lbs_deb_wext("infra\n");
                        k = copyrates(rates, k, libertas_supported_rates,
                                      sizeof(libertas_supported_rates));
                } else {
-                       lbs_pr_debug(1, "Adhoc G\n");
+                       lbs_deb_wext("Adhoc G\n");
                        k = copyrates(rates, k, libertas_adhoc_rates_g,
                                      sizeof(libertas_adhoc_rates_g));
                }
@@ -329,8 +236,7 @@ static int get_active_data_rates(wlan_adapter * adapter,
                              adapter->curbssparams.numofrates);
        }
 
-       LEAVE();
-
+       lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", k);
        return k;
 }
 
@@ -342,7 +248,7 @@ static int wlan_get_name(struct net_device *dev, struct iw_request_info *info,
        char mrvl[6] = { "MRVL-" };
        int cnt;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
 
        strcpy(cwrq, mrvl);
 
@@ -360,8 +266,7 @@ static int wlan_get_name(struct net_device *dev, struct iw_request_info *info,
        }
        *cwrq = '\0';
 
-       LEAVE();
-
+       lbs_deb_leave(LBS_DEB_WEXT);
        return 0;
 }
 
@@ -372,14 +277,14 @@ static int wlan_get_freq(struct net_device *dev, struct iw_request_info *info,
        wlan_adapter *adapter = priv->adapter;
        struct chan_freq_power *cfp;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
 
        cfp = libertas_find_cfp_by_band_and_channel(adapter, 0,
                                           adapter->curbssparams.channel);
 
        if (!cfp) {
                if (adapter->curbssparams.channel)
-                       lbs_pr_debug(1, "Invalid channel=%d\n",
+                       lbs_deb_wext("invalid channel %d\n",
                               adapter->curbssparams.channel);
                return -EINVAL;
        }
@@ -387,9 +292,8 @@ static int wlan_get_freq(struct net_device *dev, struct iw_request_info *info,
        fwrq->m = (long)cfp->freq * 100000;
        fwrq->e = 1;
 
-       lbs_pr_debug(1, "freq=%u\n", fwrq->m);
-
-       LEAVE();
+       lbs_deb_wext("freq %u\n", fwrq->m);
+       lbs_deb_leave(LBS_DEB_WEXT);
        return 0;
 }
 
@@ -399,7 +303,7 @@ static int wlan_get_wap(struct net_device *dev, struct iw_request_info *info,
        wlan_private *priv = dev->priv;
        wlan_adapter *adapter = priv->adapter;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
 
        if (adapter->connect_status == libertas_connected) {
                memcpy(awrq->sa_data, adapter->curbssparams.bssid, ETH_ALEN);
@@ -408,7 +312,7 @@ static int wlan_get_wap(struct net_device *dev, struct iw_request_info *info,
        }
        awrq->sa_family = ARPHRD_ETHER;
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_WEXT);
        return 0;
 }
 
@@ -418,7 +322,7 @@ static int wlan_set_nick(struct net_device *dev, struct iw_request_info *info,
        wlan_private *priv = dev->priv;
        wlan_adapter *adapter = priv->adapter;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
 
        /*
         * Check the size of the string
@@ -433,7 +337,7 @@ static int wlan_set_nick(struct net_device *dev, struct iw_request_info *info,
        memcpy(adapter->nodename, extra, dwrq->length);
        mutex_unlock(&adapter->lock);
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_WEXT);
        return 0;
 }
 
@@ -443,7 +347,7 @@ static int wlan_get_nick(struct net_device *dev, struct iw_request_info *info,
        wlan_private *priv = dev->priv;
        wlan_adapter *adapter = priv->adapter;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
 
        /*
         * Get the Nick Name saved
@@ -464,19 +368,43 @@ static int wlan_get_nick(struct net_device *dev, struct iw_request_info *info,
         */
        dwrq->length = strlen(extra) + 1;
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_WEXT);
        return 0;
 }
 
+static int mesh_get_nick(struct net_device *dev, struct iw_request_info *info,
+                        struct iw_point *dwrq, char *extra)
+{
+       wlan_private *priv = dev->priv;
+       wlan_adapter *adapter = priv->adapter;
+
+       lbs_deb_enter(LBS_DEB_WEXT);
+
+       /* Use nickname to indicate that mesh is on */
+
+       if (adapter->connect_status == libertas_connected) {
+               strncpy(extra, "Mesh", 12);
+               extra[12] = '\0';
+               dwrq->length = strlen(extra) + 1;
+       }
+
+       else {
+               extra[0] = '\0';
+               dwrq->length = 1 ;
+       }
+
+       lbs_deb_leave(LBS_DEB_WEXT);
+       return 0;
+}
 static int wlan_set_rts(struct net_device *dev, struct iw_request_info *info,
                        struct iw_param *vwrq, char *extra)
 {
        int ret = 0;
        wlan_private *priv = dev->priv;
        wlan_adapter *adapter = priv->adapter;
-       int rthr = vwrq->value;
+       u32 rthr = vwrq->value;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
 
        if (vwrq->disabled) {
                adapter->rtsthsd = rthr = MRVDRV_RTS_MAX_VALUE;
@@ -490,7 +418,7 @@ static int wlan_set_rts(struct net_device *dev, struct iw_request_info *info,
                                    cmd_act_set, cmd_option_waitforrsp,
                                    OID_802_11_RTS_THRESHOLD, &rthr);
 
-       LEAVE();
+       lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
        return ret;
 }
 
@@ -501,35 +429,34 @@ static int wlan_get_rts(struct net_device *dev, struct iw_request_info *info,
        wlan_private *priv = dev->priv;
        wlan_adapter *adapter = priv->adapter;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
 
        adapter->rtsthsd = 0;
        ret = libertas_prepare_and_send_command(priv, cmd_802_11_snmp_mib,
                                    cmd_act_get, cmd_option_waitforrsp,
                                    OID_802_11_RTS_THRESHOLD, NULL);
-       if (ret) {
-               LEAVE();
-               return ret;
-       }
+       if (ret)
+               goto out;
 
        vwrq->value = adapter->rtsthsd;
        vwrq->disabled = ((vwrq->value < MRVDRV_RTS_MIN_VALUE)
                          || (vwrq->value > MRVDRV_RTS_MAX_VALUE));
        vwrq->fixed = 1;
 
-       LEAVE();
-       return 0;
+out:
+       lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
+       return ret;
 }
 
 static int wlan_set_frag(struct net_device *dev, struct iw_request_info *info,
                         struct iw_param *vwrq, char *extra)
 {
        int ret = 0;
-       int fthr = vwrq->value;
+       u32 fthr = vwrq->value;
        wlan_private *priv = dev->priv;
        wlan_adapter *adapter = priv->adapter;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
 
        if (vwrq->disabled) {
                adapter->fragthsd = fthr = MRVDRV_FRAG_MAX_VALUE;
@@ -543,7 +470,8 @@ static int wlan_set_frag(struct net_device *dev, struct iw_request_info *info,
        ret = libertas_prepare_and_send_command(priv, cmd_802_11_snmp_mib,
                                    cmd_act_set, cmd_option_waitforrsp,
                                    OID_802_11_FRAGMENTATION_THRESHOLD, &fthr);
-       LEAVE();
+
+       lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
        return ret;
 }
 
@@ -554,24 +482,23 @@ static int wlan_get_frag(struct net_device *dev, struct iw_request_info *info,
        wlan_private *priv = dev->priv;
        wlan_adapter *adapter = priv->adapter;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
 
        adapter->fragthsd = 0;
        ret = libertas_prepare_and_send_command(priv,
                                    cmd_802_11_snmp_mib,
                                    cmd_act_get, cmd_option_waitforrsp,
                                    OID_802_11_FRAGMENTATION_THRESHOLD, NULL);
-       if (ret) {
-               LEAVE();
-               return ret;
-       }
+       if (ret)
+               goto out;
 
        vwrq->value = adapter->fragthsd;
        vwrq->disabled = ((vwrq->value < MRVDRV_FRAG_MIN_VALUE)
                          || (vwrq->value > MRVDRV_FRAG_MAX_VALUE));
        vwrq->fixed = 1;
 
-       LEAVE();
+out:
+       lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
        return ret;
 }
 
@@ -581,11 +508,23 @@ static int wlan_get_mode(struct net_device *dev,
        wlan_private *priv = dev->priv;
        wlan_adapter *adapter = priv->adapter;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
 
        *uwrq = adapter->mode;
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_WEXT);
+       return 0;
+}
+
+static int mesh_wlan_get_mode(struct net_device *dev,
+                             struct iw_request_info *info, u32 * uwrq,
+                             char *extra)
+{
+       lbs_deb_enter(LBS_DEB_WEXT);
+
+       *uwrq = IW_MODE_REPEAT ;
+
+       lbs_deb_leave(LBS_DEB_WEXT);
        return 0;
 }
 
@@ -597,19 +536,17 @@ static int wlan_get_txpow(struct net_device *dev,
        wlan_private *priv = dev->priv;
        wlan_adapter *adapter = priv->adapter;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
 
        ret = libertas_prepare_and_send_command(priv,
                                    cmd_802_11_rf_tx_power,
                                    cmd_act_tx_power_opt_get,
                                    cmd_option_waitforrsp, 0, NULL);
 
-       if (ret) {
-               LEAVE();
-               return ret;
-       }
+       if (ret)
+               goto out;
 
-       lbs_pr_debug(1, "TXPOWER GET %d dbm.\n", adapter->txpowerlevel);
+       lbs_deb_wext("tx power level %d dbm\n", adapter->txpowerlevel);
        vwrq->value = adapter->txpowerlevel;
        vwrq->fixed = 1;
        if (adapter->radioon) {
@@ -619,8 +556,9 @@ static int wlan_get_txpow(struct net_device *dev,
                vwrq->disabled = 1;
        }
 
-       LEAVE();
-       return 0;
+out:
+       lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
+       return ret;
 }
 
 static int wlan_set_retry(struct net_device *dev, struct iw_request_info *info,
@@ -630,7 +568,7 @@ static int wlan_set_retry(struct net_device *dev, struct iw_request_info *info,
        wlan_private *priv = dev->priv;
        wlan_adapter *adapter = priv->adapter;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
 
        if (vwrq->flags == IW_RETRY_LIMIT) {
                /* The MAC has a 4-bit Total_Tx_Count register
@@ -648,16 +586,15 @@ static int wlan_set_retry(struct net_device *dev, struct iw_request_info *info,
                                            cmd_option_waitforrsp,
                                            OID_802_11_TX_RETRYCOUNT, NULL);
 
-               if (ret) {
-                       LEAVE();
-                       return ret;
-               }
+               if (ret)
+                       goto out;
        } else {
                return -EOPNOTSUPP;
        }
 
-       LEAVE();
-       return 0;
+out:
+       lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
+       return ret;
 }
 
 static int wlan_get_retry(struct net_device *dev, struct iw_request_info *info,
@@ -667,16 +604,16 @@ static int wlan_get_retry(struct net_device *dev, struct iw_request_info *info,
        wlan_adapter *adapter = priv->adapter;
        int ret = 0;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
+
        adapter->txretrycount = 0;
        ret = libertas_prepare_and_send_command(priv,
                                    cmd_802_11_snmp_mib,
                                    cmd_act_get, cmd_option_waitforrsp,
                                    OID_802_11_TX_RETRYCOUNT, NULL);
-       if (ret) {
-               LEAVE();
-               return ret;
-       }
+       if (ret)
+               goto out;
+
        vwrq->disabled = 0;
        if (!vwrq->flags) {
                vwrq->flags = IW_RETRY_LIMIT;
@@ -684,8 +621,9 @@ static int wlan_get_retry(struct net_device *dev, struct iw_request_info *info,
                vwrq->value = adapter->txretrycount - 1;
        }
 
-       LEAVE();
-       return 0;
+out:
+       lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
+       return ret;
 }
 
 static inline void sort_channels(struct iw_freq *freq, int num)
@@ -739,7 +677,7 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info,
 
        u8 flag = 0;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
 
        dwrq->length = sizeof(struct iw_range);
        memset(range, 0, sizeof(struct iw_range));
@@ -755,7 +693,7 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info,
                range->bitrate[i] = (rates[i] & 0x7f) * 500000;
        }
        range->num_bitrates = i;
-       lbs_pr_debug(1, "IW_MAX_BITRATES=%d num_bitrates=%d\n", IW_MAX_BITRATES,
+       lbs_deb_wext("IW_MAX_BITRATES %d, num_bitrates %d\n", IW_MAX_BITRATES,
               range->num_bitrates);
 
        range->num_frequency = 0;
@@ -768,18 +706,17 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info,
                    &adapter->parsed_region_chan;
 
                if (parsed_region_chan == NULL) {
-                       lbs_pr_debug(1, "11D:parsed_region_chan is NULL\n");
-                       LEAVE();
-                       return 0;
+                       lbs_deb_wext("11d: parsed_region_chan is NULL\n");
+                       goto out;
                }
                band = parsed_region_chan->band;
-               lbs_pr_debug(1, "band=%d NoOfChan=%d\n", band,
+               lbs_deb_wext("band %d, nr_char %d\n", band,
                       parsed_region_chan->nr_chan);
 
                for (i = 0; (range->num_frequency < IW_MAX_FREQUENCIES)
                     && (i < parsed_region_chan->nr_chan); i++) {
                        chan_no = parsed_region_chan->chanpwr[i].chan;
-                       lbs_pr_debug(1, "chan_no=%d\n", chan_no);
+                       lbs_deb_wext("chan_no %d\n", chan_no);
                        range->freq[range->num_frequency].i = (long)chan_no;
                        range->freq[range->num_frequency].m =
                            (long)libertas_chan_2_freq(chan_no, band) * 100000;
@@ -808,7 +745,7 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info,
                }
        }
 
-       lbs_pr_debug(1, "IW_MAX_FREQUENCIES=%d num_frequency=%d\n",
+       lbs_deb_wext("IW_MAX_FREQUENCIES %d, num_frequency %d\n",
               IW_MAX_FREQUENCIES, range->num_frequency);
 
        range->num_channels = range->num_frequency;
@@ -903,7 +840,8 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info,
                                  | IW_ENC_CAPA_CIPHER_CCMP;
        }
 
-       LEAVE();
+out:
+       lbs_deb_leave(LBS_DEB_WEXT);
        return 0;
 }
 
@@ -913,7 +851,7 @@ static int wlan_set_power(struct net_device *dev, struct iw_request_info *info,
        wlan_private *priv = dev->priv;
        wlan_adapter *adapter = priv->adapter;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
 
        /* PS is currently supported only in Infrastructure mode
         * Remove this check if it is to be supported in IBSS mode also
@@ -929,11 +867,11 @@ static int wlan_set_power(struct net_device *dev, struct iw_request_info *info,
        }
 
        if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) {
-               lbs_pr_debug(1,
-                      "Setting power timeout command is not supported\n");
+               lbs_deb_wext(
+                      "setting power timeout is not supported\n");
                return -EINVAL;
        } else if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_PERIOD) {
-               lbs_pr_debug(1, "Setting power period command is not supported\n");
+               lbs_deb_wext("setting power period not supported\n");
                return -EINVAL;
        }
 
@@ -947,7 +885,7 @@ static int wlan_set_power(struct net_device *dev, struct iw_request_info *info,
                libertas_ps_sleep(priv, cmd_option_waitforrsp);
        }
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_WEXT);
        return 0;
 }
 
@@ -958,19 +896,20 @@ static int wlan_get_power(struct net_device *dev, struct iw_request_info *info,
        wlan_adapter *adapter = priv->adapter;
        int mode;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
 
        mode = adapter->psmode;
 
        if ((vwrq->disabled = (mode == wlan802_11powermodecam))
-           || adapter->connect_status == libertas_disconnected) {
-               LEAVE();
-               return 0;
+           || adapter->connect_status == libertas_disconnected)
+       {
+               goto out;
        }
 
        vwrq->value = 0;
 
-       LEAVE();
+out:
+       lbs_deb_leave(LBS_DEB_WEXT);
        return 0;
 }
 
@@ -1063,6 +1002,16 @@ static const struct iw_priv_args wlan_private_args[] = {
         IW_PRIV_TYPE_CHAR | 128,
         IW_PRIV_TYPE_CHAR | 128,
         "bt_list"},
+       {
+        WLAN_SUBCMD_BT_SET_INVERT,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        IW_PRIV_TYPE_NONE,
+        "bt_set_invert"},
+       {
+        WLAN_SUBCMD_BT_GET_INVERT,
+        IW_PRIV_TYPE_NONE,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        "bt_get_invert"},
        /* FWT Management */
        {
         WLAN_SUBCMD_FWT_ADD,
@@ -1125,7 +1074,7 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev)
        u8 rssi;
        u32 tx_retries;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
 
        priv->wstats.status = adapter->mode;
 
@@ -1145,8 +1094,8 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev)
                    CAL_NF(adapter->NF[TYPE_BEACON][TYPE_NOAVG]);
        }
 
-       lbs_pr_debug(1, "Signal Level = %#x\n", priv->wstats.qual.level);
-       lbs_pr_debug(1, "Noise = %#x\n", priv->wstats.qual.noise);
+       lbs_deb_wext("signal level %#x\n", priv->wstats.qual.level);
+       lbs_deb_wext("noise %#x\n", priv->wstats.qual.noise);
 
        rssi = priv->wstats.qual.level - priv->wstats.qual.noise;
        if (rssi < 15)
@@ -1166,7 +1115,7 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev)
        /* Quality by TX errors */
        priv->wstats.discard.retries = priv->stats.tx_errors;
 
-       tx_retries = adapter->logmsg.retry;
+       tx_retries = le16_to_cpu(adapter->logmsg.retry);
 
        if (tx_retries > 75)
                tx_qual = (90 - tx_retries) * POOR / 15;
@@ -1182,10 +1131,10 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev)
                    (PERFECT - VERY_GOOD) / 50 + VERY_GOOD;
        quality = min(quality, tx_qual);
 
-       priv->wstats.discard.code = adapter->logmsg.wepundecryptable;
-       priv->wstats.discard.fragment = adapter->logmsg.fcserror;
+       priv->wstats.discard.code = le16_to_cpu(adapter->logmsg.wepundecryptable);
+       priv->wstats.discard.fragment = le16_to_cpu(adapter->logmsg.rxfrag);
        priv->wstats.discard.retries = tx_retries;
-       priv->wstats.discard.misc = adapter->logmsg.ackfailure;
+       priv->wstats.discard.misc = le16_to_cpu(adapter->logmsg.ackfailure);
 
        /* Calculate quality */
        priv->wstats.qual.qual = max(quality, (u32)100);
@@ -1209,7 +1158,7 @@ out:
                    IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID;
        }
 
-       LEAVE ();
+       lbs_deb_leave(LBS_DEB_WEXT);
        return &priv->wstats;
 
 
@@ -1218,81 +1167,59 @@ out:
 static int wlan_set_freq(struct net_device *dev, struct iw_request_info *info,
                  struct iw_freq *fwrq, char *extra)
 {
-       int ret = 0;
+       int ret = -EINVAL;
        wlan_private *priv = dev->priv;
        wlan_adapter *adapter = priv->adapter;
-       int rc = -EINPROGRESS;  /* Call commit handler */
        struct chan_freq_power *cfp;
+       struct assoc_request * assoc_req;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
 
-       /*
-        * If setting by frequency, convert to a channel
-        */
-       if (fwrq->e == 1) {
+       mutex_lock(&adapter->lock);
+       assoc_req = wlan_get_association_request(adapter);
+       if (!assoc_req) {
+               ret = -ENOMEM;
+               goto out;
+       }
 
+       /* If setting by frequency, convert to a channel */
+       if (fwrq->e == 1) {
                long f = fwrq->m / 100000;
-               int c = 0;
 
                cfp = find_cfp_by_band_and_freq(adapter, 0, f);
                if (!cfp) {
-                       lbs_pr_debug(1, "Invalid freq=%ld\n", f);
-                       return -EINVAL;
+                       lbs_deb_wext("invalid freq %ld\n", f);
+                       goto out;
                }
 
-               c = (int)cfp->channel;
-
-               if (c < 0)
-                       return -EINVAL;
-
                fwrq->e = 0;
-               fwrq->m = c;
+               fwrq->m = (int) cfp->channel;
        }
 
-       /*
-        * Setting by channel number
-        */
+       /* Setting by channel number */
        if (fwrq->m > 1000 || fwrq->e > 0) {
-               rc = -EOPNOTSUPP;
-       } else {
-               int channel = fwrq->m;
+               goto out;
+       }
 
-               cfp = libertas_find_cfp_by_band_and_channel(adapter, 0, channel);
-               if (!cfp) {
-                       rc = -EINVAL;
-               } else {
-                       if (adapter->mode == IW_MODE_ADHOC) {
-                               rc = changeadhocchannel(priv, channel);
-                               /*  If station is WEP enabled, send the
-                                *  command to set WEP in firmware
-                                */
-                               if (adapter->secinfo.wep_enabled) {
-                                       lbs_pr_debug(1, "set_freq: WEP enabled\n");
-                                       ret = libertas_prepare_and_send_command(priv,
-                                                                   cmd_802_11_set_wep,
-                                                                   cmd_act_add,
-                                                                   cmd_option_waitforrsp,
-                                                                   0,
-                                                                   NULL);
-
-                                       if (ret) {
-                                               LEAVE();
-                                               return ret;
-                                       }
-
-                                       adapter->currentpacketfilter |=
-                                           cmd_act_mac_wep_enable;
-
-                                       libertas_set_mac_packet_filter(priv);
-                               }
-                       } else {
-                               rc = -EOPNOTSUPP;
-                       }
-               }
+       cfp = libertas_find_cfp_by_band_and_channel(adapter, 0, fwrq->m);
+       if (!cfp) {
+               goto out;
+       }
+
+       assoc_req->channel = fwrq->m;
+       ret = 0;
+
+out:
+       if (ret == 0) {
+               set_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags);
+               wlan_postpone_association_work(priv);
+       } else {
+               wlan_cancel_association_work(priv);
        }
+       mutex_unlock(&adapter->lock);
 
-       LEAVE();
-       return rc;
+       lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
+       return ret;
 }
 
 /**
@@ -1338,9 +1265,9 @@ static int wlan_set_rate(struct net_device *dev, struct iw_request_info *info,
        u8 rates[WLAN_SUPPORTED_RATES];
        u8 *rate;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
 
-       lbs_pr_debug(1, "Vwrq->value = %d\n", vwrq->value);
+       lbs_deb_wext("vwrq->value %d\n", vwrq->value);
 
        if (vwrq->value == -1) {
                action = cmd_act_set_tx_auto;   // Auto
@@ -1357,15 +1284,15 @@ static int wlan_set_rate(struct net_device *dev, struct iw_request_info *info,
                get_active_data_rates(adapter, rates);
                rate = rates;
                while (*rate) {
-                       lbs_pr_debug(1, "Rate=0x%X  Wanted=0x%X\n", *rate,
+                       lbs_deb_wext("rate=0x%X, wanted data_rate 0x%X\n", *rate,
                               data_rate);
                        if ((*rate & 0x7f) == (data_rate & 0x7f))
                                break;
                        rate++;
                }
                if (!*rate) {
-                       lbs_pr_alert( "The fixed data rate 0x%X is out "
-                              "of range.\n", data_rate);
+                       lbs_pr_alert("fixed data rate 0x%X out "
+                              "of range\n", data_rate);
                        return -EINVAL;
                }
 
@@ -1377,7 +1304,7 @@ static int wlan_set_rate(struct net_device *dev, struct iw_request_info *info,
        ret = libertas_prepare_and_send_command(priv, cmd_802_11_data_rate,
                                    action, cmd_option_waitforrsp, 0, NULL);
 
-       LEAVE();
+       lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
        return ret;
 }
 
@@ -1387,7 +1314,7 @@ static int wlan_get_rate(struct net_device *dev, struct iw_request_info *info,
        wlan_private *priv = dev->priv;
        wlan_adapter *adapter = priv->adapter;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
 
        if (adapter->is_datarate_auto) {
                vwrq->fixed = 0;
@@ -1397,7 +1324,7 @@ static int wlan_get_rate(struct net_device *dev, struct iw_request_info *info,
 
        vwrq->value = adapter->datarate * 500000;
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_WEXT);
        return 0;
 }
 
@@ -1409,12 +1336,12 @@ static int wlan_set_mode(struct net_device *dev,
        wlan_adapter *adapter = priv->adapter;
        struct assoc_request * assoc_req;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
 
        if (   (*uwrq != IW_MODE_ADHOC)
            && (*uwrq != IW_MODE_INFRA)
            && (*uwrq != IW_MODE_AUTO)) {
-               lbs_pr_debug(1, "Invalid mode: 0x%x\n", *uwrq);
+               lbs_deb_wext("Invalid mode: 0x%x\n", *uwrq);
                ret = -EINVAL;
                goto out;
        }
@@ -1428,12 +1355,12 @@ static int wlan_set_mode(struct net_device *dev,
                assoc_req->mode = *uwrq;
                set_bit(ASSOC_FLAG_MODE, &assoc_req->flags);
                wlan_postpone_association_work(priv);
-               lbs_pr_debug(1, "Switching to mode: 0x%x\n", *uwrq);
+               lbs_deb_wext("Switching to mode: 0x%x\n", *uwrq);
        }
        mutex_unlock(&adapter->lock);
 
 out:
-       LEAVE();
+       lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
        return ret;
 }
 
@@ -1455,9 +1382,9 @@ static int wlan_get_encode(struct net_device *dev,
        wlan_adapter *adapter = priv->adapter;
        int index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
 
-       lbs_pr_debug(1, "flags=0x%x index=%d length=%d wep_tx_keyidx=%d\n",
+       lbs_deb_wext("flags 0x%x, index %d, length %d, wep_tx_keyidx %d\n",
               dwrq->flags, index, dwrq->length, adapter->wep_tx_keyidx);
 
        dwrq->flags = 0;
@@ -1513,13 +1440,13 @@ static int wlan_get_encode(struct net_device *dev,
 
        dwrq->flags |= IW_ENCODE_NOKEY;
 
-       lbs_pr_debug(1, "key:%02x:%02x:%02x:%02x:%02x:%02x keylen=%d\n",
+       lbs_deb_wext("key: " MAC_FMT ", keylen %d\n",
               extra[0], extra[1], extra[2],
               extra[3], extra[4], extra[5], dwrq->length);
 
-       lbs_pr_debug(1, "Return flags=0x%x\n", dwrq->flags);
+       lbs_deb_wext("return flags 0x%x\n", dwrq->flags);
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_WEXT);
        return 0;
 }
 
@@ -1539,20 +1466,21 @@ static int wlan_set_wep_key(struct assoc_request *assoc_req,
                            u16 index,
                            int set_tx_key)
 {
+       int ret = 0;
        struct WLAN_802_11_KEY *pkey;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
 
        /* Paranoid validation of key index */
        if (index > 3) {
-               LEAVE();
-               return -EINVAL;
+               ret = -EINVAL;
+               goto out;
        }
 
        /* validate max key length */
        if (key_length > KEY_LEN_WEP_104) {
-               LEAVE();
-               return -EINVAL;
+               ret = -EINVAL;
+               goto out;
        }
 
        pkey = &assoc_req->wep_keys[index];
@@ -1570,17 +1498,18 @@ static int wlan_set_wep_key(struct assoc_request *assoc_req,
        if (set_tx_key) {
                /* Ensure the chosen key is valid */
                if (!pkey->len) {
-                       lbs_pr_debug(1, "key not set, so cannot enable it\n");
-                       LEAVE();
-                       return -EINVAL;
+                       lbs_deb_wext("key not set, so cannot enable it\n");
+                       ret = -EINVAL;
+                       goto out;
                }
                assoc_req->wep_tx_keyidx = index;
        }
 
        assoc_req->secinfo.wep_enabled = 1;
 
-       LEAVE();
-       return 0;
+out:
+       lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
+       return ret;
 }
 
 static int validate_key_index(u16 def_index, u16 raw_index,
@@ -1605,6 +1534,8 @@ static void disable_wep(struct assoc_request *assoc_req)
 {
        int i;
 
+       lbs_deb_enter(LBS_DEB_WEXT);
+
        /* Set Open System auth mode */
        assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
 
@@ -1615,6 +1546,27 @@ static void disable_wep(struct assoc_request *assoc_req)
 
        set_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags);
        set_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags);
+
+       lbs_deb_leave(LBS_DEB_WEXT);
+}
+
+static void disable_wpa(struct assoc_request *assoc_req)
+{
+       lbs_deb_enter(LBS_DEB_WEXT);
+
+       memset(&assoc_req->wpa_mcast_key, 0, sizeof (struct WLAN_802_11_KEY));
+       assoc_req->wpa_mcast_key.flags = KEY_INFO_WPA_MCAST;
+       set_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags);
+
+       memset(&assoc_req->wpa_unicast_key, 0, sizeof (struct WLAN_802_11_KEY));
+       assoc_req->wpa_unicast_key.flags = KEY_INFO_WPA_UNICAST;
+       set_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags);
+
+       assoc_req->secinfo.WPAenabled = 0;
+       assoc_req->secinfo.WPA2enabled = 0;
+       set_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags);
+
+       lbs_deb_leave(LBS_DEB_WEXT);
 }
 
 /**
@@ -1636,7 +1588,7 @@ static int wlan_set_encode(struct net_device *dev,
        struct assoc_request * assoc_req;
        u16 is_default = 0, index = 0, set_tx_key = 0;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
 
        mutex_lock(&adapter->lock);
        assoc_req = wlan_get_association_request(adapter);
@@ -1647,6 +1599,7 @@ static int wlan_set_encode(struct net_device *dev,
 
        if (dwrq->flags & IW_ENCODE_DISABLED) {
                disable_wep (assoc_req);
+               disable_wpa (assoc_req);
                goto out;
        }
 
@@ -1688,7 +1641,7 @@ out:
        }
        mutex_unlock(&adapter->lock);
 
-       LEAVE();
+       lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
        return ret;
 }
 
@@ -1712,7 +1665,7 @@ static int wlan_get_encodeext(struct net_device *dev,
        struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
        int index, max_key_len;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
 
        max_key_len = dwrq->length - sizeof(*ext);
        if (max_key_len < 0)
@@ -1748,6 +1701,7 @@ static int wlan_get_encodeext(struct net_device *dev,
                if (   adapter->secinfo.wep_enabled
                    && !adapter->secinfo.WPAenabled
                    && !adapter->secinfo.WPA2enabled) {
+                       /* WEP */
                        ext->alg = IW_ENCODE_ALG_WEP;
                        ext->key_len = adapter->wep_keys[index].len;
                        key = &adapter->wep_keys[index].key[0];
@@ -1755,8 +1709,27 @@ static int wlan_get_encodeext(struct net_device *dev,
                           && (adapter->secinfo.WPAenabled ||
                               adapter->secinfo.WPA2enabled)) {
                        /* WPA */
-                       ext->alg = IW_ENCODE_ALG_TKIP;
-                       ext->key_len = 0;
+                       struct WLAN_802_11_KEY * pkey = NULL;
+
+                       if (   adapter->wpa_mcast_key.len
+                           && (adapter->wpa_mcast_key.flags & KEY_INFO_WPA_ENABLED))
+                               pkey = &adapter->wpa_mcast_key;
+                       else if (   adapter->wpa_unicast_key.len
+                                && (adapter->wpa_unicast_key.flags & KEY_INFO_WPA_ENABLED))
+                               pkey = &adapter->wpa_unicast_key;
+
+                       if (pkey) {
+                               if (pkey->type == KEY_TYPE_ID_AES) {
+                                       ext->alg = IW_ENCODE_ALG_CCMP;
+                               } else {
+                                       ext->alg = IW_ENCODE_ALG_TKIP;
+                               }
+                               ext->key_len = pkey->len;
+                               key = &pkey->key[0];
+                       } else {
+                               ext->alg = IW_ENCODE_ALG_TKIP;
+                               ext->key_len = 0;
+                       }
                } else {
                        goto out;
                }
@@ -1775,7 +1748,7 @@ static int wlan_get_encodeext(struct net_device *dev,
        ret = 0;
 
 out:
-       LEAVE();
+       lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
        return ret;
 }
 
@@ -1800,7 +1773,7 @@ static int wlan_set_encodeext(struct net_device *dev,
        int alg = ext->alg;
        struct assoc_request * assoc_req;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
 
        mutex_lock(&adapter->lock);
        assoc_req = wlan_get_association_request(adapter);
@@ -1811,6 +1784,7 @@ static int wlan_set_encodeext(struct net_device *dev,
 
        if ((alg == IW_ENCODE_ALG_NONE) || (dwrq->flags & IW_ENCODE_DISABLED)) {
                disable_wep (assoc_req);
+               disable_wpa (assoc_req);
        } else if (alg == IW_ENCODE_ALG_WEP) {
                u16 is_default = 0, index, set_tx_key = 0;
 
@@ -1846,7 +1820,6 @@ static int wlan_set_encodeext(struct net_device *dev,
                        set_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags);
                if (set_tx_key)
                        set_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags);
-
        } else if ((alg == IW_ENCODE_ALG_TKIP) || (alg == IW_ENCODE_ALG_CCMP)) {
                struct WLAN_802_11_KEY * pkey;
 
@@ -1855,36 +1828,43 @@ static int wlan_set_encodeext(struct net_device *dev,
                        && (ext->key_len != KEY_LEN_WPA_TKIP))
                    || ((alg == IW_ENCODE_ALG_CCMP)
                        && (ext->key_len != KEY_LEN_WPA_AES))) {
-                               lbs_pr_debug(1, "Invalid size %d for key of alg"
-                                      "type %d.\n",
+                               lbs_deb_wext("invalid size %d for key of alg"
+                                      "type %d\n",
                                       ext->key_len,
                                       alg);
                                ret = -EINVAL;
                                goto out;
                }
 
-               if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY)
+               if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) {
                        pkey = &assoc_req->wpa_mcast_key;
-               else
+                       set_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags);
+               } else {
                        pkey = &assoc_req->wpa_unicast_key;
+                       set_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags);
+               }
 
                memset(pkey, 0, sizeof (struct WLAN_802_11_KEY));
                memcpy(pkey->key, ext->key, ext->key_len);
                pkey->len = ext->key_len;
-               pkey->flags = KEY_INFO_WPA_ENABLED;
+               if (pkey->len)
+                       pkey->flags |= KEY_INFO_WPA_ENABLED;
 
+               /* Do this after zeroing key structure */
                if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) {
                        pkey->flags |= KEY_INFO_WPA_MCAST;
-                       set_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags);
                } else {
                        pkey->flags |= KEY_INFO_WPA_UNICAST;
-                       set_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags);
                }
 
-               if (alg == IW_ENCODE_ALG_TKIP)
+               if (alg == IW_ENCODE_ALG_TKIP) {
                        pkey->type = KEY_TYPE_ID_TKIP;
-               else if (alg == IW_ENCODE_ALG_CCMP)
+               } else if (alg == IW_ENCODE_ALG_CCMP) {
                        pkey->type = KEY_TYPE_ID_AES;
+               } else {
+                       ret = -EINVAL;
+                       goto out;
+               }
 
                /* If WPA isn't enabled yet, do that now */
                if (   assoc_req->secinfo.WPAenabled == 0
@@ -1905,7 +1885,7 @@ out:
        }
        mutex_unlock(&adapter->lock);
 
-       LEAVE();
+       lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
        return ret;
 }
 
@@ -1920,7 +1900,7 @@ static int wlan_set_genie(struct net_device *dev,
        int ret = 0;
        struct assoc_request * assoc_req;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
 
        mutex_lock(&adapter->lock);
        assoc_req = wlan_get_association_request(adapter);
@@ -1952,7 +1932,7 @@ out:
        }
        mutex_unlock(&adapter->lock);
 
-       LEAVE();
+       lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
        return ret;
 }
 
@@ -1961,27 +1941,28 @@ static int wlan_get_genie(struct net_device *dev,
                          struct iw_point *dwrq,
                          char *extra)
 {
+       int ret = 0;
        wlan_private *priv = dev->priv;
        wlan_adapter *adapter = priv->adapter;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
 
        if (adapter->wpa_ie_len == 0) {
                dwrq->length = 0;
-               LEAVE();
-               return 0;
+               goto out;
        }
 
        if (dwrq->length < adapter->wpa_ie_len) {
-               LEAVE();
-               return -E2BIG;
+               ret = -E2BIG;
+               goto out;
        }
 
        dwrq->length = adapter->wpa_ie_len;
        memcpy(extra, &adapter->wpa_ie[0], adapter->wpa_ie_len);
 
-       LEAVE();
-       return 0;
+out:
+       lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
+       return ret;
 }
 
 
@@ -1996,7 +1977,7 @@ static int wlan_set_auth(struct net_device *dev,
        int ret = 0;
        int updated = 0;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
 
        mutex_lock(&adapter->lock);
        assoc_req = wlan_get_association_request(adapter);
@@ -2010,6 +1991,7 @@ static int wlan_set_auth(struct net_device *dev,
        case IW_AUTH_CIPHER_PAIRWISE:
        case IW_AUTH_CIPHER_GROUP:
        case IW_AUTH_KEY_MGMT:
+       case IW_AUTH_DROP_UNENCRYPTED:
                /*
                 * libertas does not use these parameters
                 */
@@ -2019,6 +2001,7 @@ static int wlan_set_auth(struct net_device *dev,
                if (dwrq->value & IW_AUTH_WPA_VERSION_DISABLED) {
                        assoc_req->secinfo.WPAenabled = 0;
                        assoc_req->secinfo.WPA2enabled = 0;
+                       disable_wpa (assoc_req);
                }
                if (dwrq->value & IW_AUTH_WPA_VERSION_WPA) {
                        assoc_req->secinfo.WPAenabled = 1;
@@ -2033,17 +2016,6 @@ static int wlan_set_auth(struct net_device *dev,
                updated = 1;
                break;
 
-       case IW_AUTH_DROP_UNENCRYPTED:
-               if (dwrq->value) {
-                       adapter->currentpacketfilter |=
-                           cmd_act_mac_strict_protection_enable;
-               } else {
-                       adapter->currentpacketfilter &=
-                           ~cmd_act_mac_strict_protection_enable;
-               }
-               updated = 1;
-               break;
-
        case IW_AUTH_80211_AUTH_ALG:
                if (dwrq->value & IW_AUTH_ALG_SHARED_KEY) {
                        assoc_req->secinfo.auth_mode = IW_AUTH_ALG_SHARED_KEY;
@@ -2069,6 +2041,7 @@ static int wlan_set_auth(struct net_device *dev,
                } else {
                        assoc_req->secinfo.WPAenabled = 0;
                        assoc_req->secinfo.WPA2enabled = 0;
+                       disable_wpa (assoc_req);
                }
                updated = 1;
                break;
@@ -2088,7 +2061,7 @@ out:
        }
        mutex_unlock(&adapter->lock);
 
-       LEAVE();
+       lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
        return ret;
 }
 
@@ -2097,10 +2070,11 @@ static int wlan_get_auth(struct net_device *dev,
                         struct iw_param *dwrq,
                         char *extra)
 {
+       int ret = 0;
        wlan_private *priv = dev->priv;
        wlan_adapter *adapter = priv->adapter;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
 
        switch (dwrq->flags & IW_AUTH_INDEX) {
        case IW_AUTH_WPA_VERSION:
@@ -2113,13 +2087,6 @@ static int wlan_get_auth(struct net_device *dev,
                        dwrq->value |= IW_AUTH_WPA_VERSION_DISABLED;
                break;
 
-       case IW_AUTH_DROP_UNENCRYPTED:
-               dwrq->value = 0;
-               if (adapter->currentpacketfilter &
-                   cmd_act_mac_strict_protection_enable)
-                       dwrq->value = 1;
-               break;
-
        case IW_AUTH_80211_AUTH_ALG:
                dwrq->value = adapter->secinfo.auth_mode;
                break;
@@ -2130,12 +2097,11 @@ static int wlan_get_auth(struct net_device *dev,
                break;
 
        default:
-               LEAVE();
-               return -EOPNOTSUPP;
+               ret = -EOPNOTSUPP;
        }
 
-       LEAVE();
-       return 0;
+       lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
+       return ret;
 }
 
 
@@ -2148,7 +2114,7 @@ static int wlan_set_txpow(struct net_device *dev, struct iw_request_info *info,
 
        u16 dbm;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
 
        if (vwrq->disabled) {
                wlan_radio_ioctl(priv, RADIO_OFF);
@@ -2169,14 +2135,14 @@ static int wlan_set_txpow(struct net_device *dev, struct iw_request_info *info,
        if (vwrq->fixed == 0)
                dbm = 0xffff;
 
-       lbs_pr_debug(1, "<1>TXPOWER SET %d dbm.\n", dbm);
+       lbs_deb_wext("txpower set %d dbm\n", dbm);
 
        ret = libertas_prepare_and_send_command(priv,
                                    cmd_802_11_rf_tx_power,
                                    cmd_act_tx_power_opt_set_low,
                                    cmd_option_waitforrsp, 0, (void *)&dbm);
 
-       LEAVE();
+       lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
        return ret;
 }
 
@@ -2186,7 +2152,8 @@ static int wlan_get_essid(struct net_device *dev, struct iw_request_info *info,
        wlan_private *priv = dev->priv;
        wlan_adapter *adapter = priv->adapter;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
+
        /*
         * Note : if dwrq->flags != 0, we should get the relevant SSID from
         * the SSID list...
@@ -2196,12 +2163,12 @@ static int wlan_get_essid(struct net_device *dev, struct iw_request_info *info,
         * Get the current SSID
         */
        if (adapter->connect_status == libertas_connected) {
-               memcpy(extra, adapter->curbssparams.ssid.ssid,
-                      adapter->curbssparams.ssid.ssidlength);
-               extra[adapter->curbssparams.ssid.ssidlength] = '\0';
+               memcpy(extra, adapter->curbssparams.ssid,
+                      adapter->curbssparams.ssid_len);
+               extra[adapter->curbssparams.ssid_len] = '\0';
        } else {
                memset(extra, 0, 32);
-               extra[adapter->curbssparams.ssid.ssidlength] = '\0';
+               extra[adapter->curbssparams.ssid_len] = '\0';
        }
        /*
         * If none, we may want to get the one that was set
@@ -2209,14 +2176,14 @@ static int wlan_get_essid(struct net_device *dev, struct iw_request_info *info,
 
        /* To make the driver backward compatible with WPA supplicant v0.2.4 */
        if (dwrq->length == 32) /* check with WPA supplicant buffer size */
-               dwrq->length = min_t(size_t, adapter->curbssparams.ssid.ssidlength,
+               dwrq->length = min_t(size_t, adapter->curbssparams.ssid_len,
                                   IW_ESSID_MAX_SIZE);
        else
-               dwrq->length = adapter->curbssparams.ssid.ssidlength + 1;
+               dwrq->length = adapter->curbssparams.ssid_len + 1;
 
        dwrq->flags = 1;        /* active */
 
-       LEAVE();
+       lbs_deb_leave(LBS_DEB_WEXT);
        return 0;
 }
 
@@ -2226,38 +2193,43 @@ static int wlan_set_essid(struct net_device *dev, struct iw_request_info *info,
        wlan_private *priv = dev->priv;
        wlan_adapter *adapter = priv->adapter;
        int ret = 0;
-       struct WLAN_802_11_SSID ssid;
+       u8 ssid[IW_ESSID_MAX_SIZE];
+       u8 ssid_len = 0;
        struct assoc_request * assoc_req;
-       int ssid_len = dwrq->length;
+       int in_ssid_len = dwrq->length;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
 
        /*
         * WE-20 and earlier NULL pad the end of the SSID and increment
         * SSID length so it can be used like a string.  WE-21 and later don't,
         * but some userspace tools aren't able to cope with the change.
         */
-       if ((ssid_len > 0) && (extra[ssid_len - 1] == '\0'))
-               ssid_len--;
+       if ((in_ssid_len > 0) && (extra[in_ssid_len - 1] == '\0'))
+               in_ssid_len--;
 
        /* Check the size of the string */
-       if (ssid_len > IW_ESSID_MAX_SIZE) {
+       if (in_ssid_len > IW_ESSID_MAX_SIZE) {
                ret = -E2BIG;
                goto out;
        }
 
-       memset(&ssid, 0, sizeof(struct WLAN_802_11_SSID));
+       memset(&ssid, 0, sizeof(ssid));
 
-       if (!dwrq->flags || !ssid_len) {
+       if (!dwrq->flags || !in_ssid_len) {
                /* "any" SSID requested; leave SSID blank */
        } else {
                /* Specific SSID requested */
-               memcpy(&ssid.ssid, extra, ssid_len);
-               ssid.ssidlength = ssid_len;
+               memcpy(&ssid, extra, in_ssid_len);
+               ssid_len = in_ssid_len;
        }
 
-       lbs_pr_debug(1, "Requested new SSID = %s\n",
-              (ssid.ssidlength > 0) ? (char *)ssid.ssid : "any");
+       if (!ssid_len) {
+               lbs_deb_wext("requested any SSID\n");
+       } else {
+               lbs_deb_wext("requested SSID '%s'\n",
+                            escape_essid(ssid, ssid_len));
+       }
 
 out:
        mutex_lock(&adapter->lock);
@@ -2268,7 +2240,8 @@ out:
                        ret = -ENOMEM;
                } else {
                        /* Copy the SSID to the association request */
-                       memcpy(&assoc_req->ssid, &ssid, sizeof(struct WLAN_802_11_SSID));
+                       memcpy(&assoc_req->ssid, &ssid, IW_ESSID_MAX_SIZE);
+                       assoc_req->ssid_len = ssid_len;
                        set_bit(ASSOC_FLAG_SSID, &assoc_req->flags);
                        wlan_postpone_association_work(priv);
                }
@@ -2281,7 +2254,7 @@ out:
 
        mutex_unlock(&adapter->lock);
 
-       LEAVE();
+       lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
        return ret;
 }
 
@@ -2302,12 +2275,12 @@ static int wlan_set_wap(struct net_device *dev, struct iw_request_info *info,
        struct assoc_request * assoc_req;
        int ret = 0;
 
-       ENTER();
+       lbs_deb_enter(LBS_DEB_WEXT);
 
        if (awrq->sa_family != ARPHRD_ETHER)
                return -EINVAL;
 
-       lbs_pr_debug(1, "ASSOC: WAP: sa_data: " MAC_FMT "\n", MAC_ARG(awrq->sa_data));
+       lbs_deb_wext("ASSOC: WAP: sa_data " MAC_FMT "\n", MAC_ARG(awrq->sa_data));
 
        mutex_lock(&adapter->lock);
 
@@ -2330,22 +2303,23 @@ static int wlan_set_wap(struct net_device *dev, struct iw_request_info *info,
 
 void libertas_get_fwversion(wlan_adapter * adapter, char *fwversion, int maxlen)
 {
-       union {
-               u32 l;
-               u8 c[4];
-       } ver;
        char fwver[32];
 
        mutex_lock(&adapter->lock);
-       ver.l = adapter->fwreleasenumber;
-       mutex_unlock(&adapter->lock);
 
-       if (ver.c[3] == 0)
-               sprintf(fwver, "%u.%u.%u", ver.c[2], ver.c[1], ver.c[0]);
+       if (adapter->fwreleasenumber[3] == 0)
+               sprintf(fwver, "%u.%u.%u",
+                       adapter->fwreleasenumber[2],
+                       adapter->fwreleasenumber[1],
+                       adapter->fwreleasenumber[0]);
        else
                sprintf(fwver, "%u.%u.%u.p%u",
-                       ver.c[2], ver.c[1], ver.c[0], ver.c[3]);
+                       adapter->fwreleasenumber[2],
+                       adapter->fwreleasenumber[1],
+                       adapter->fwreleasenumber[0],
+                       adapter->fwreleasenumber[3]);
 
+       mutex_unlock(&adapter->lock);
        snprintf(fwversion, maxlen, fwver);
 }
 
@@ -2411,6 +2385,63 @@ static const iw_handler wlan_handler[] = {
        (iw_handler) NULL,              /* SIOCSIWPMKSA */
 };
 
+static const iw_handler mesh_wlan_handler[] = {
+       (iw_handler) NULL,      /* SIOCSIWCOMMIT */
+       (iw_handler) wlan_get_name,     /* SIOCGIWNAME */
+       (iw_handler) NULL,      /* SIOCSIWNWID */
+       (iw_handler) NULL,      /* SIOCGIWNWID */
+       (iw_handler) wlan_set_freq,     /* SIOCSIWFREQ */
+       (iw_handler) wlan_get_freq,     /* SIOCGIWFREQ */
+       (iw_handler) NULL,              /* SIOCSIWMODE */
+       (iw_handler) mesh_wlan_get_mode,        /* SIOCGIWMODE */
+       (iw_handler) NULL,      /* SIOCSIWSENS */
+       (iw_handler) NULL,      /* SIOCGIWSENS */
+       (iw_handler) NULL,      /* SIOCSIWRANGE */
+       (iw_handler) wlan_get_range,    /* SIOCGIWRANGE */
+       (iw_handler) NULL,      /* SIOCSIWPRIV */
+       (iw_handler) NULL,      /* SIOCGIWPRIV */
+       (iw_handler) NULL,      /* SIOCSIWSTATS */
+       (iw_handler) NULL,      /* SIOCGIWSTATS */
+       iw_handler_set_spy,     /* SIOCSIWSPY */
+       iw_handler_get_spy,     /* SIOCGIWSPY */
+       iw_handler_set_thrspy,  /* SIOCSIWTHRSPY */
+       iw_handler_get_thrspy,  /* SIOCGIWTHRSPY */
+       (iw_handler) NULL,      /* SIOCSIWAP */
+       (iw_handler) NULL,      /* SIOCGIWAP */
+       (iw_handler) NULL,      /* SIOCSIWMLME */
+       (iw_handler) NULL,      /* SIOCGIWAPLIST - deprecated */
+       (iw_handler) libertas_set_scan, /* SIOCSIWSCAN */
+       (iw_handler) libertas_get_scan, /* SIOCGIWSCAN */
+       (iw_handler) NULL,              /* SIOCSIWESSID */
+       (iw_handler) NULL,              /* SIOCGIWESSID */
+       (iw_handler) NULL,              /* SIOCSIWNICKN */
+       (iw_handler) mesh_get_nick,     /* SIOCGIWNICKN */
+       (iw_handler) NULL,      /* -- hole -- */
+       (iw_handler) NULL,      /* -- hole -- */
+       (iw_handler) wlan_set_rate,     /* SIOCSIWRATE */
+       (iw_handler) wlan_get_rate,     /* SIOCGIWRATE */
+       (iw_handler) wlan_set_rts,      /* SIOCSIWRTS */
+       (iw_handler) wlan_get_rts,      /* SIOCGIWRTS */
+       (iw_handler) wlan_set_frag,     /* SIOCSIWFRAG */
+       (iw_handler) wlan_get_frag,     /* SIOCGIWFRAG */
+       (iw_handler) wlan_set_txpow,    /* SIOCSIWTXPOW */
+       (iw_handler) wlan_get_txpow,    /* SIOCGIWTXPOW */
+       (iw_handler) wlan_set_retry,    /* SIOCSIWRETRY */
+       (iw_handler) wlan_get_retry,    /* SIOCGIWRETRY */
+       (iw_handler) wlan_set_encode,   /* SIOCSIWENCODE */
+       (iw_handler) wlan_get_encode,   /* SIOCGIWENCODE */
+       (iw_handler) wlan_set_power,    /* SIOCSIWPOWER */
+       (iw_handler) wlan_get_power,    /* SIOCGIWPOWER */
+       (iw_handler) NULL,      /* -- hole -- */
+       (iw_handler) NULL,      /* -- hole -- */
+       (iw_handler) wlan_set_genie,    /* SIOCSIWGENIE */
+       (iw_handler) wlan_get_genie,    /* SIOCGIWGENIE */
+       (iw_handler) wlan_set_auth,     /* SIOCSIWAUTH */
+       (iw_handler) wlan_get_auth,     /* SIOCGIWAUTH */
+       (iw_handler) wlan_set_encodeext,/* SIOCSIWENCODEEXT */
+       (iw_handler) wlan_get_encodeext,/* SIOCGIWENCODEEXT */
+       (iw_handler) NULL,              /* SIOCSIWPMKSA */
+};
 struct iw_handler_def libertas_handler_def = {
        .num_standard   = sizeof(wlan_handler) / sizeof(iw_handler),
        .num_private    = sizeof(wlan_private_handler) / sizeof(iw_handler),
@@ -2421,3 +2452,14 @@ struct iw_handler_def libertas_handler_def = {
        .private_args   = (struct iw_priv_args *)wlan_private_args,
        .get_wireless_stats = wlan_get_wireless_stats,
 };
+
+struct iw_handler_def mesh_handler_def = {
+       .num_standard   = sizeof(mesh_wlan_handler) / sizeof(iw_handler),
+       .num_private    = sizeof(wlan_private_handler) / sizeof(iw_handler),
+       .num_private_args = sizeof(wlan_private_args) /
+               sizeof(struct iw_priv_args),
+       .standard       = (iw_handler *) mesh_wlan_handler,
+       .private        = (iw_handler *) wlan_private_handler,
+       .private_args   = (struct iw_priv_args *)wlan_private_args,
+       .get_wireless_stats = wlan_get_wireless_stats,
+};
index 15cfaaf0797ff7b43faee11f376fe45c9e79657d..d555056b25b736715bd96eec834c0044ee6a8f71 100644 (file)
 #define WLAN_SUBCMD_FWT_CLEANUP                        15
 #define WLAN_SUBCMD_FWT_TIME                   16
 #define WLAN_SUBCMD_MESH_GET_TTL               17
+#define WLAN_SUBCMD_BT_GET_INVERT              18
 
 #define WLAN_SETONEINT_GETNONE         (WLANIOCTL + 24)
 #define WLANSETREGION                          8
 #define WLAN_SUBCMD_MESH_SET_TTL               18
+#define WLAN_SUBCMD_BT_SET_INVERT              19
 
 #define WLAN_SET128CHAR_GET128CHAR     (WLANIOCTL + 25)
 #define WLAN_SUBCMD_BT_ADD                     18
 #define WLAN_SUBCMD_BT_DEL                     19
 #define WLAN_SUBCMD_BT_LIST                    20
-#define WLAN_SUBCMD_FWT_ADD                            21
-#define WLAN_SUBCMD_FWT_DEL            22
-#define WLAN_SUBCMD_FWT_LOOKUP         23
-#define WLAN_SUBCMD_FWT_LIST_NEIGHBOR                  24
+#define WLAN_SUBCMD_FWT_ADD                    21
+#define WLAN_SUBCMD_FWT_DEL                    22
+#define WLAN_SUBCMD_FWT_LOOKUP                 23
+#define WLAN_SUBCMD_FWT_LIST_NEIGHBOR          24
 #define WLAN_SUBCMD_FWT_LIST                   25
-#define WLAN_SUBCMD_FWT_LIST_ROUTE                     26
+#define WLAN_SUBCMD_FWT_LIST_ROUTE             26
 
 #define WLAN_SET_GET_SIXTEEN_INT       (WLANIOCTL + 29)
 #define WLAN_LED_GPIO_CTRL                     5
@@ -56,6 +58,7 @@ struct wlan_ioctl_regrdwr {
 };
 
 extern struct iw_handler_def libertas_handler_def;
+extern struct iw_handler_def mesh_handler_def;
 int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int i);
 int wlan_radio_ioctl(wlan_private * priv, u8 option);
 
index 894fdb9d44c0b832ddd5d2a23f2ceedaa71d0b16..b3c4dbff26b84c8797f411aa22d7351b97e388af 100644 (file)
@@ -32,6 +32,7 @@
 */
 
 #include <linux/types.h>
+#include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/spinlock.h>
@@ -292,7 +293,6 @@ static int ioc_count;
 #define PDIR_INDEX(iovp)    ((iovp)>>IOVP_SHIFT)
 #define MKIOVP(pdir_idx)    ((long)(pdir_idx) << IOVP_SHIFT)
 #define MKIOVA(iovp,offset) (dma_addr_t)((long)iovp | (long)offset)
-#define ROUNDUP(x,y) ((x + ((y)-1)) & ~((y)-1))
 
 /*
 ** Don't worry about the 150% average search length on a miss.
@@ -668,7 +668,7 @@ ccio_mark_invalid(struct ioc *ioc, dma_addr_t iova, size_t byte_cnt)
        size_t saved_byte_cnt;
 
        /* round up to nearest page size */
-       saved_byte_cnt = byte_cnt = ROUNDUP(byte_cnt, IOVP_SIZE);
+       saved_byte_cnt = byte_cnt = ALIGN(byte_cnt, IOVP_SIZE);
 
        while(byte_cnt > 0) {
                /* invalidate one page at a time */
@@ -751,7 +751,7 @@ ccio_map_single(struct device *dev, void *addr, size_t size,
        offset = ((unsigned long) addr) & ~IOVP_MASK;
 
        /* round up to nearest IOVP_SIZE */
-       size = ROUNDUP(size + offset, IOVP_SIZE);
+       size = ALIGN(size + offset, IOVP_SIZE);
        spin_lock_irqsave(&ioc->res_lock, flags);
 
 #ifdef CCIO_MAP_STATS
@@ -814,7 +814,7 @@ ccio_unmap_single(struct device *dev, dma_addr_t iova, size_t size,
 
        iova ^= offset;        /* clear offset bits */
        size += offset;
-       size = ROUNDUP(size, IOVP_SIZE);
+       size = ALIGN(size, IOVP_SIZE);
 
        spin_lock_irqsave(&ioc->res_lock, flags);
 
@@ -1227,7 +1227,7 @@ ccio_get_iotlb_size(struct parisc_device *dev)
 #endif /* 0 */
 
 /* We *can't* support JAVA (T600). Venture there at your own risk. */
-static struct parisc_device_id ccio_tbl[] = {
+static const struct parisc_device_id ccio_tbl[] = {
        { HPHW_IOA, HVERSION_REV_ANY_ID, U2_IOA_RUNWAY, 0xb }, /* U2 */
        { HPHW_IOA, HVERSION_REV_ANY_ID, UTURN_IOA_RUNWAY, 0xb }, /* UTurn */
        { 0, }
@@ -1370,7 +1370,7 @@ ccio_ioc_init(struct ioc *ioc)
        }
 }
 
-static void
+static void __init
 ccio_init_resource(struct resource *res, char *name, void __iomem *ioaddr)
 {
        int result;
@@ -1537,7 +1537,7 @@ int ccio_request_resource(const struct parisc_device *dev,
  * If so, initialize the chip and tell other partners in crime they
  * have work to do.
  */
-static int ccio_probe(struct parisc_device *dev)
+static int __init ccio_probe(struct parisc_device *dev)
 {
        int i;
        struct ioc *ioc, **ioc_p = &ioc_list;
index 309076b39853be3a0f51a565dec251f9156c82ba..771cef592542fd75182b69a1e6d324c8fdc63d7b 100644 (file)
@@ -307,7 +307,7 @@ static void init_eisa_pic(void)
 
 #define is_mongoose(dev) (dev->id.sversion == 0x00076)
 
-static int __devinit eisa_probe(struct parisc_device *dev)
+static int __init eisa_probe(struct parisc_device *dev)
 {
        int i, result;
 
@@ -387,7 +387,7 @@ static int __devinit eisa_probe(struct parisc_device *dev)
        return 0;
 }
 
-static struct parisc_device_id eisa_tbl[] = {
+static const struct parisc_device_id eisa_tbl[] = {
        { HPHW_BA, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00076 }, /* Mongoose */
        { HPHW_BA, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00090 }, /* Wax EISA */
        { 0, }
index 38d9e1aba1d0f534e60a1dc6c4dca4ba1e67f056..0a1f99a2e93edf262b904fe886f1c2fc074c6de4 100644 (file)
@@ -138,7 +138,7 @@ iommu_coalesce_chunks(struct ioc *ioc, struct scatterlist *startsg, int nents,
                        ** exceed DMA_CHUNK_SIZE if we coalesce the
                        ** next entry.
                        */   
-                       if(unlikely(ROUNDUP(dma_len + dma_offset + startsg->length,
+                       if(unlikely(ALIGN(dma_len + dma_offset + startsg->length,
                                            IOVP_SIZE) > DMA_CHUNK_SIZE))
                                break;
 
@@ -158,7 +158,7 @@ iommu_coalesce_chunks(struct ioc *ioc, struct scatterlist *startsg, int nents,
                ** Allocate space for DMA stream.
                */
                sg_dma_len(contig_sg) = dma_len;
-               dma_len = ROUNDUP(dma_len + dma_offset, IOVP_SIZE);
+               dma_len = ALIGN(dma_len + dma_offset, IOVP_SIZE);
                sg_dma_address(contig_sg) =
                        PIDE_FLAG 
                        | (iommu_alloc_range(ioc, dma_len) << IOVP_SHIFT)
index 815e445c3125c3d3d3cd8ceaf220fbaa81912ede..924ef0609460f4a338e0423101741ab92f96c8e1 100644 (file)
@@ -1067,7 +1067,7 @@ pdc_stable_init(void)
                        error = subsys_create_file(&stable_subsys, attr);
        
        /* register the paths subsys as a subsystem of stable subsys */
-       kset_set_kset_s(&paths_subsys, stable_subsys);
+       kobj_set_kset_s(&paths_subsys, stable_subsys);
        if ((rc = subsystem_register(&paths_subsys)))
                goto fail_subsysreg;
 
index 6dedbdef7106518ba583eb72bd81f70bd130bb6e..90cca5e3805f584cbf3a571098e64f684aca3797 100644 (file)
@@ -41,6 +41,7 @@
 #include <linux/reboot.h>
 #include <linux/sched.h>
 #include <linux/kthread.h>
+#include <linux/pm.h>
 
 #include <asm/pdc.h>
 #include <asm/io.h>
index 322957ac2ad1d2c03bda2139641838d4a88fcd4e..d044c48323e662c5130fd23935201754713ad13e 100644 (file)
@@ -113,8 +113,6 @@ module_param(sba_reserve_agpgart, int, 0444);
 MODULE_PARM_DESC(sba_reserve_agpgart, "Reserve half of IO pdir as AGPGART");
 #endif
 
-#define ROUNDUP(x,y) ((x + ((y)-1)) & ~((y)-1))
-
 
 /************************************
 ** SBA register read and write support
@@ -352,7 +350,7 @@ sba_search_bitmap(struct ioc *ioc, unsigned long bits_wanted)
                ** SBA HW features in the unmap path.
                */
                unsigned long o = 1 << get_order(bits_wanted << PAGE_SHIFT);
-               uint bitshiftcnt = ROUNDUP(ioc->res_bitshift, o);
+               uint bitshiftcnt = ALIGN(ioc->res_bitshift, o);
                unsigned long mask;
 
                if (bitshiftcnt >= BITS_PER_LONG) {
@@ -779,7 +777,7 @@ sba_unmap_single(struct device *dev, dma_addr_t iova, size_t size,
        offset = iova & ~IOVP_MASK;
        iova ^= offset;        /* clear offset bits */
        size += offset;
-       size = ROUNDUP(size, IOVP_SIZE);
+       size = ALIGN(size, IOVP_SIZE);
 
        spin_lock_irqsave(&ioc->res_lock, flags);
 
index 1fd97f7c8b98fcb461b34f2fc73683ce0f431367..a708c329675e6305396f2d43a0cd3ad37c8ccb19 100644 (file)
@@ -389,7 +389,7 @@ int superio_fixup_irq(struct pci_dev *pcidev)
        return local_irq;
 }
 
-static void __devinit superio_serial_init(void)
+static void __init superio_serial_init(void)
 {
 #ifdef CONFIG_SERIAL_8250
        int retval;
@@ -423,7 +423,7 @@ static void __devinit superio_serial_init(void)
 }
 
 
-static void __devinit superio_parport_init(void)
+static void __init superio_parport_init(void)
 {
 #ifdef CONFIG_PARPORT_PC
        if (!parport_pc_probe_port(sio_dev.pp_base,
@@ -450,7 +450,7 @@ static void superio_fixup_pci(struct pci_dev *pdev)
 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87415, superio_fixup_pci);
 
 
-static int __devinit
+static int __init
 superio_probe(struct pci_dev *dev, const struct pci_device_id *id)
 {
        struct superio_device *sio = &sio_dev;
@@ -485,7 +485,7 @@ superio_probe(struct pci_dev *dev, const struct pci_device_id *id)
        return -ENODEV;
 }
 
-static struct pci_device_id superio_tbl[] = {
+static const struct pci_device_id superio_tbl[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87560_LIO) },
        { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87560_USB) },
        { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87415) },
index 17bf9937d276d66e792adaf17763c5550e65a716..43652ba523ebfa80dca52a1c79b4eaedf97fdf5e 100644 (file)
@@ -350,7 +350,7 @@ struct parport *__devinit parport_gsc_probe_port (unsigned long base,
 
 #define PARPORT_GSC_OFFSET 0x800
 
-static int __initdata parport_count;
+static int __devinitdata parport_count;
 
 static int __devinit parport_init_chip(struct parisc_device *dev)
 {
index 8263f752809d2ff64b00bb97f685ae7bbc9657d8..bb90df8bdce4ef7c204f8e93bc664e85649eedfc 100644 (file)
@@ -463,7 +463,7 @@ static inline unsigned long get_timeout(idescsi_pc_t *pc)
 
 static int idescsi_expiry(ide_drive_t *drive)
 {
-       idescsi_scsi_t *scsi = drive->driver_data;
+       idescsi_scsi_t *scsi = drive_to_idescsi(drive);
        idescsi_pc_t   *pc   = scsi->pc;
 
 #if IDESCSI_DEBUG_LOG
index 00d1255e4c12026cd3ff7104e3861e217a0649fe..e88da72f8304e9a6abc00daa73590e409e76e88b 100644 (file)
@@ -167,9 +167,9 @@ static void pl010_rx_chars(struct uart_amba_port *uap)
        ignore_char:
                status = readb(uap->port.membase + UART01x_FR);
        }
-       spin_unlock(&port->lock);
+       spin_unlock(&uap->port.lock);
        tty_flip_buffer_push(tty);
-       spin_lock(&port->lock);
+       spin_lock(&uap->port.lock);
 }
 
 static void pl010_tx_chars(struct uart_amba_port *uap)
index 787dc7168f3e00925f9a7b26bacefb995f58fdd4..22569bd5d821e37e7f0b9f5aaaf15909831032dc 100644 (file)
@@ -185,6 +185,7 @@ static void bfin_serial_rx_chars(struct bfin_serial_port *uart)
                uart->port.icount.brk++;
                if (uart_handle_break(&uart->port))
                        goto ignore_char;
+               status &= ~(PE | FE);
        }
        if (status & PE)
                uart->port.icount.parity++;
@@ -341,6 +342,7 @@ static void bfin_serial_dma_rx_chars(struct bfin_serial_port *uart)
                uart->port.icount.brk++;
                if (uart_handle_break(&uart->port))
                        goto dma_ignore_char;
+               status &= ~(PE | FE);
        }
        if (status & PE)
                uart->port.icount.parity++;
@@ -517,6 +519,14 @@ static void bfin_serial_mctrl_check(struct bfin_serial_port *uart)
  */
 static void bfin_serial_break_ctl(struct uart_port *port, int break_state)
 {
+       struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
+       u16 lcr = UART_GET_LCR(uart);
+       if (break_state)
+               lcr |= SB;
+       else
+               lcr &= ~SB;
+       UART_PUT_LCR(uart, lcr);
+       SSYNC();
 }
 
 static int bfin_serial_startup(struct uart_port *port)
@@ -625,11 +635,12 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios,
 
        if (termios->c_cflag & CSTOPB)
                lcr |= STB;
-       if (termios->c_cflag & PARENB) {
+       if (termios->c_cflag & PARENB)
                lcr |= PEN;
-               if (!(termios->c_cflag & PARODD))
-                       lcr |= EPS;
-       }
+       if (!(termios->c_cflag & PARODD))
+               lcr |= EPS;
+       if (termios->c_cflag & CMSPAR)
+               lcr |= STP;
 
        port->read_status_mask = OE;
        if (termios->c_iflag & INPCK)
index 7d2d9ec6cac31ac3aac880027041427a9a6dbdb3..48587c27050d335fb083d9ea989181a50c7063a3 100644 (file)
@@ -582,14 +582,19 @@ static irqreturn_t dma_irq_handler(int irq, void *dev_id)
        dev_dbg(&drv_data->pdev->dev, "in dma_irq_handler\n");
        clear_dma_irqstat(CH_SPI);
 
+       /* Wait for DMA to complete */
+       while (get_dma_curr_irqstat(CH_SPI) & DMA_RUN)
+               continue;
+
        /*
-        * wait for the last transaction shifted out.  yes, these two
-        * while loops are supposed to be the same (see the HRM).
+        * wait for the last transaction shifted out.  HRM states:
+        * at this point there may still be data in the SPI DMA FIFO waiting
+        * to be transmitted ... software needs to poll TXS in the SPI_STAT
+        * register until it goes low for 2 successive reads
         */
        if (drv_data->tx != NULL) {
-               while (bfin_read_SPI_STAT() & TXS)
-                       continue;
-               while (bfin_read_SPI_STAT() & TXS)
+               while ((bfin_read_SPI_STAT() & TXS) ||
+                      (bfin_read_SPI_STAT() & TXS))
                        continue;
        }
 
@@ -1082,7 +1087,7 @@ static int setup(struct spi_device *spi)
  */
 static void cleanup(struct spi_device *spi)
 {
-       struct chip_data *chip = spi_get_ctldata((struct spi_device *)spi);
+       struct chip_data *chip = spi_get_ctldata(spi);
 
        kfree(chip);
 }
index 3524e3fc08b91ed27316748dc5ea528e3f7d61a0..61de78a9f6ee76156523e7041b04fd8b3b8434dd 100644 (file)
@@ -2182,7 +2182,7 @@ struct dec_serial_hook zs_kgdbhook = {
        .init_info      = kgdbhook_init_info,
        .rx_char        = kgdbhook_rx_char,
        .cflags         = B38400 | CS8 | CLOCAL,
-}
+};
 
 void __init zs_kgdb_hook(int tty_num)
 {
index 30b7bfbc985a752065b62770c9e52aa0f5cde8f8..8bcf7fe1dd80c7b531c417f5c58e565b8fd8653f 100644 (file)
@@ -476,8 +476,6 @@ static int cxacru_start_wait_urb(struct urb *urb, struct completion *done,
        add_timer(&timer);
        wait_for_completion(done);
        status = urb->status;
-       if (status == -ECONNRESET)
-               status = -ETIMEDOUT;
        del_timer_sync(&timer);
 
        if (actual_length)
@@ -629,10 +627,22 @@ static int cxacru_card_status(struct cxacru_data *instance)
        return 0;
 }
 
+static void cxacru_remove_device_files(struct usbatm_data *usbatm_instance,
+               struct atm_dev *atm_dev)
+{
+       struct usb_interface *intf = usbatm_instance->usb_intf;
+
+       #define CXACRU_DEVICE_REMOVE_FILE(_name) \
+               device_remove_file(&intf->dev, &dev_attr_##_name);
+       CXACRU_ALL_FILES(REMOVE);
+       #undef CXACRU_DEVICE_REMOVE_FILE
+}
+
 static int cxacru_atm_start(struct usbatm_data *usbatm_instance,
                struct atm_dev *atm_dev)
 {
        struct cxacru_data *instance = usbatm_instance->driver_data;
+       struct usb_interface *intf = usbatm_instance->usb_intf;
        /*
        struct atm_dev *atm_dev = usbatm_instance->atm_dev;
        */
@@ -649,14 +659,18 @@ static int cxacru_atm_start(struct usbatm_data *usbatm_instance,
                return ret;
        }
 
+       #define CXACRU_DEVICE_CREATE_FILE(_name) \
+               ret = device_create_file(&intf->dev, &dev_attr_##_name); \
+               if (unlikely(ret)) \
+                       goto fail_sysfs;
+       CXACRU_ALL_FILES(CREATE);
+       #undef CXACRU_DEVICE_CREATE_FILE
+
        /* start ADSL */
        mutex_lock(&instance->adsl_state_serialize);
        ret = cxacru_cm(instance, CM_REQUEST_CHIP_ADSL_LINE_START, NULL, 0, NULL, 0);
-       if (ret < 0) {
+       if (ret < 0)
                atm_err(usbatm_instance, "cxacru_atm_start: CHIP_ADSL_LINE_START returned %d\n", ret);
-               mutex_unlock(&instance->adsl_state_serialize);
-               return ret;
-       }
 
        /* Start status polling */
        mutex_lock(&instance->poll_state_serialize);
@@ -680,6 +694,11 @@ static int cxacru_atm_start(struct usbatm_data *usbatm_instance,
        if (start_polling)
                cxacru_poll_status(&instance->poll_work.work);
        return 0;
+
+fail_sysfs:
+       usb_err(usbatm_instance, "cxacru_atm_start: device_create_file failed (%d)\n", ret);
+       cxacru_remove_device_files(usbatm_instance, atm_dev);
+       return ret;
 }
 
 static void cxacru_poll_status(struct work_struct *work)
@@ -1065,13 +1084,6 @@ static int cxacru_bind(struct usbatm_data *usbatm_instance,
                goto fail;
        }
 
-       #define CXACRU_DEVICE_CREATE_FILE(_name) \
-               ret = device_create_file(&intf->dev, &dev_attr_##_name); \
-               if (unlikely(ret)) \
-                       goto fail_sysfs;
-       CXACRU_ALL_FILES(CREATE);
-       #undef CXACRU_DEVICE_CREATE_FILE
-
        usb_fill_int_urb(instance->rcv_urb,
                        usb_dev, usb_rcvintpipe(usb_dev, CXACRU_EP_CMD),
                        instance->rcv_buf, PAGE_SIZE,
@@ -1092,14 +1104,6 @@ static int cxacru_bind(struct usbatm_data *usbatm_instance,
 
        return 0;
 
- fail_sysfs:
-       dbg("cxacru_bind: device_create_file failed (%d)\n", ret);
-
-       #define CXACRU_DEVICE_REMOVE_FILE(_name) \
-               device_remove_file(&intf->dev, &dev_attr_##_name);
-       CXACRU_ALL_FILES(REMOVE);
-       #undef CXACRU_DEVICE_REVOVE_FILE
-
  fail:
        free_page((unsigned long) instance->snd_buf);
        free_page((unsigned long) instance->rcv_buf);
@@ -1146,11 +1150,6 @@ static void cxacru_unbind(struct usbatm_data *usbatm_instance,
        free_page((unsigned long) instance->snd_buf);
        free_page((unsigned long) instance->rcv_buf);
 
-       #define CXACRU_DEVICE_REMOVE_FILE(_name) \
-               device_remove_file(&intf->dev, &dev_attr_##_name);
-       CXACRU_ALL_FILES(REMOVE);
-       #undef CXACRU_DEVICE_REVOVE_FILE
-
        kfree(instance);
 
        usbatm_instance->driver_data = NULL;
@@ -1231,6 +1230,7 @@ static struct usbatm_driver cxacru_driver = {
        .heavy_init     = cxacru_heavy_init,
        .unbind         = cxacru_unbind,
        .atm_start      = cxacru_atm_start,
+       .atm_stop       = cxacru_remove_device_files,
        .bulk_in        = CXACRU_EP_DATA,
        .bulk_out       = CXACRU_EP_DATA,
        .rx_padding     = 3,
index 7b1edfe46b28b54856a443ecdddeb697b00fe930..6778f9af794381ec0ae40df7253aa26f0bbddfbc 100644 (file)
@@ -347,10 +347,8 @@ static int handle_bidir (struct usblp *usblp)
        if (usblp->bidir && usblp->used && !usblp->sleeping) {
                usblp->readcount = 0;
                usblp->readurb->dev = usblp->dev;
-               if (usb_submit_urb(usblp->readurb, GFP_KERNEL) < 0) {
-                       usblp->used = 0;
+               if (usb_submit_urb(usblp->readurb, GFP_KERNEL) < 0)
                        return -EIO;
-               }
        }
 
        return 0;
@@ -412,6 +410,7 @@ static int usblp_open(struct inode *inode, struct file *file)
        usblp->readurb->status = 0;
 
        if (handle_bidir(usblp) < 0) {
+               usblp->used = 0;
                file->private_data = NULL;
                retval = -EIO;
        }
index f493fb1eaa274fccef4266ae6784e91c165c3935..346fc030c929ae172b6658df8f1a2b54113e1ac3 100644 (file)
@@ -40,21 +40,25 @@ config USB_DEVICEFS
 config USB_DEVICE_CLASS
        bool "USB device class-devices (DEPRECATED)"
        depends on USB
-       default n
+       default y
        ---help---
          Userspace access to USB devices is granted by device-nodes exported
          directly from the usbdev in sysfs. Old versions of the driver
          core and udev needed additional class devices to export device nodes.
 
          These additional devices are difficult to handle in userspace, if
-         information about USB interfaces must be available. One device contains
-         the device node, the other device contains the interface data. Both
-         devices are at the same level in sysfs (siblings) and one can't access
-         the other. The device node created directly by the usbdev is the parent
-         device of the interface and therefore easily accessible from the interface
-         event.
-
-         This option provides backward compatibility if needed.
+         information about USB interfaces must be available. One device
+         contains the device node, the other device contains the interface
+         data. Both devices are at the same level in sysfs (siblings) and one
+         can't access the other. The device node created directly by the
+         usb device is the parent device of the interface and therefore
+         easily accessible from the interface event.
+
+         This option provides backward compatibility for libusb device
+         nodes (lsusb) when usbfs is not used, and the following udev rule
+         doesn't exist:
+           SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", \
+           NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0644"
 
 config USB_DYNAMIC_MINORS
        bool "Dynamic USB minor allocation (EXPERIMENTAL)"
index 2d4fd530e5e448d42fa7f2b40641ccbe39bdd934..dd3482328ad2603e7726e10d07dd4f2dc09ffc58 100644 (file)
@@ -1,4 +1,5 @@
 #include <linux/usb.h>
+#include <linux/usb/ch9.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
@@ -49,7 +50,7 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,
        unsigned char *buffer0 = buffer;
        struct usb_endpoint_descriptor *d;
        struct usb_host_endpoint *endpoint;
-       int n, i;
+       int n, i, j;
 
        d = (struct usb_endpoint_descriptor *) buffer;
        buffer += d->bLength;
@@ -84,6 +85,45 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,
        memcpy(&endpoint->desc, d, n);
        INIT_LIST_HEAD(&endpoint->urb_list);
 
+       /* If the bInterval value is outside the legal range,
+        * set it to a default value: 32 ms */
+       i = 0;          /* i = min, j = max, n = default */
+       j = 255;
+       if (usb_endpoint_xfer_int(d)) {
+               i = 1;
+               switch (to_usb_device(ddev)->speed) {
+               case USB_SPEED_HIGH:
+                       n = 9;          /* 32 ms = 2^(9-1) uframes */
+                       j = 16;
+                       break;
+               default:                /* USB_SPEED_FULL or _LOW */
+                       /* For low-speed, 10 ms is the official minimum.
+                        * But some "overclocked" devices might want faster
+                        * polling so we'll allow it. */
+                       n = 32;
+                       break;
+               }
+       } else if (usb_endpoint_xfer_isoc(d)) {
+               i = 1;
+               j = 16;
+               switch (to_usb_device(ddev)->speed) {
+               case USB_SPEED_HIGH:
+                       n = 9;          /* 32 ms = 2^(9-1) uframes */
+                       break;
+               default:                /* USB_SPEED_FULL */
+                       n = 6;          /* 32 ms = 2^(6-1) frames */
+                       break;
+               }
+       }
+       if (d->bInterval < i || d->bInterval > j) {
+               dev_warn(ddev, "config %d interface %d altsetting %d "
+                   "endpoint 0x%X has an invalid bInterval %d, "
+                   "changing to %d\n",
+                   cfgno, inum, asnum,
+                   d->bEndpointAddress, d->bInterval, n);
+               endpoint->desc.bInterval = n;
+       }
+
        /* Skip over any Class Specific or Vendor Specific descriptors;
         * find the next endpoint or interface descriptor */
        endpoint->extra = buffer;
index f28af06905a5caaee0245e5a85f78176ca015b0d..6042364402b8fb0b4fe1551fe8b5c57b8ae190c5 100644 (file)
@@ -132,7 +132,7 @@ ep_matches (
         * where it's an output parameter representing the full speed limit.
         * the usb spec fixes high speed bulk maxpacket at 512 bytes.
         */
-       max = 0x7ff & le16_to_cpup (&desc->wMaxPacketSize);
+       max = 0x7ff & le16_to_cpu(desc->wMaxPacketSize);
        switch (type) {
        case USB_ENDPOINT_XFER_INT:
                /* INT:  limit 64 bytes full speed, 1024 high speed */
index 188c74a95216860cb1740243211b94ef013cbddd..46d0e52527447aea5d9f63073d964317dd0bd0a9 100644 (file)
@@ -1369,12 +1369,12 @@ config_buf (struct dev_data *dev, u8 type, unsigned index)
                hs = !hs;
        if (hs) {
                dev->req->buf = dev->hs_config;
-               len = le16_to_cpup (&dev->hs_config->wTotalLength);
+               len = le16_to_cpu(dev->hs_config->wTotalLength);
        } else
 #endif
        {
                dev->req->buf = dev->config;
-               len = le16_to_cpup (&dev->config->wTotalLength);
+               len = le16_to_cpu(dev->config->wTotalLength);
        }
        ((u8 *)dev->req->buf) [1] = type;
        return len;
@@ -1885,7 +1885,7 @@ dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
 
        /* full or low speed config */
        dev->config = (void *) kbuf;
-       total = le16_to_cpup (&dev->config->wTotalLength);
+       total = le16_to_cpu(dev->config->wTotalLength);
        if (!is_valid_config (dev->config) || total >= length)
                goto fail;
        kbuf += total;
@@ -1894,7 +1894,7 @@ dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
        /* optional high speed config */
        if (kbuf [1] == USB_DT_CONFIG) {
                dev->hs_config = (void *) kbuf;
-               total = le16_to_cpup (&dev->hs_config->wTotalLength);
+               total = le16_to_cpu(dev->hs_config->wTotalLength);
                if (!is_valid_config (dev->hs_config) || total >= length)
                        goto fail;
                kbuf += total;
index 52779c52b56d97231aecfc5703e062ff68c8c64e..d975ecf18e00537bb6a67895f04f4a5bd00b6ee5 100644 (file)
@@ -2440,9 +2440,9 @@ static void handle_stat0_irqs (struct net2280 *dev, u32 stat)
 
                tmp = 0;
 
-#define        w_value         le16_to_cpup (&u.r.wValue)
-#define        w_index         le16_to_cpup (&u.r.wIndex)
-#define        w_length        le16_to_cpup (&u.r.wLength)
+#define        w_value         le16_to_cpu(u.r.wValue)
+#define        w_index         le16_to_cpu(u.r.wIndex)
+#define        w_length        le16_to_cpu(u.r.wLength)
 
                /* ack the irq */
                writel (1 << SETUP_PACKET_INTERRUPT, &dev->regs->irqstat0);
index 15772541c0ecefe9ed51825ae6aaf3a787c8b674..56ebbb4446123dca4a962ab79395d93395a43188 100644 (file)
@@ -1651,9 +1651,9 @@ static void ep0_irq(struct omap_udc *udc, u16 irq_src)
                        UDC_EP_NUM_REG = 0;
                } while (UDC_IRQ_SRC_REG & UDC_SETUP);
 
-#define        w_value         le16_to_cpup (&u.r.wValue)
-#define        w_index         le16_to_cpup (&u.r.wIndex)
-#define        w_length        le16_to_cpup (&u.r.wLength)
+#define        w_value         le16_to_cpu(u.r.wValue)
+#define        w_index         le16_to_cpu(u.r.wIndex)
+#define        w_length        le16_to_cpu(u.r.wLength)
 
                /* Delegate almost all control requests to the gadget driver,
                 * except for a handful of ch9 status/feature requests that
index 6ec8cf1a3ccb1cd14d39667231da28b36abdecdf..708657c89132068f2bfdbb8cc7f3552cbc182cbe 100644 (file)
@@ -186,10 +186,14 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
                DEBUG("query OID %08x value, len %d:\n", OID, buf_len);
                for (i = 0; i < buf_len; i += 16) {
                        DEBUG ("%03d: %08x %08x %08x %08x\n", i,
-                               le32_to_cpup((__le32 *)&buf[i]),
-                               le32_to_cpup((__le32 *)&buf[i + 4]),
-                               le32_to_cpup((__le32 *)&buf[i + 8]),
-                               le32_to_cpup((__le32 *)&buf[i + 12]));
+                               le32_to_cpu(get_unaligned((__le32 *)
+                                       &buf[i])),
+                               le32_to_cpu(get_unaligned((__le32 *)
+                                       &buf[i + 4])),
+                               le32_to_cpu(get_unaligned((__le32 *)
+                                       &buf[i + 8])),
+                               le32_to_cpu(get_unaligned((__le32 *)
+                                       &buf[i + 12])));
                }
        }
 
@@ -665,7 +669,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
                break;
        case OID_PNP_QUERY_POWER:
                DEBUG("%s: OID_PNP_QUERY_POWER D%d\n", __FUNCTION__,
-                               le32_to_cpup((__le32 *) buf) - 1);
+                               le32_to_cpu(get_unaligned((__le32 *)buf)) - 1);
                /* only suspend is a real power state, and
                 * it can't be entered by OID_PNP_SET_POWER...
                 */
@@ -704,10 +708,14 @@ static int gen_ndis_set_resp (u8 configNr, u32 OID, u8 *buf, u32 buf_len,
                DEBUG("set OID %08x value, len %d:\n", OID, buf_len);
                for (i = 0; i < buf_len; i += 16) {
                        DEBUG ("%03d: %08x %08x %08x %08x\n", i,
-                               le32_to_cpup((__le32 *)&buf[i]),
-                               le32_to_cpup((__le32 *)&buf[i + 4]),
-                               le32_to_cpup((__le32 *)&buf[i + 8]),
-                               le32_to_cpup((__le32 *)&buf[i + 12]));
+                               le32_to_cpu(get_unaligned((__le32 *)
+                                       &buf[i])),
+                               le32_to_cpu(get_unaligned((__le32 *)
+                                       &buf[i + 4])),
+                               le32_to_cpu(get_unaligned((__le32 *)
+                                       &buf[i + 8])),
+                               le32_to_cpu(get_unaligned((__le32 *)
+                                       &buf[i + 12])));
                }
        }
 
@@ -721,7 +729,8 @@ static int gen_ndis_set_resp (u8 configNr, u32 OID, u8 *buf, u32 buf_len,
                 *      PROMISCUOUS, DIRECTED,
                 *      MULTICAST, ALL_MULTICAST, BROADCAST
                 */
-               *params->filter = (u16) le32_to_cpup((__le32 *)buf);
+               *params->filter = (u16) le32_to_cpu(get_unaligned(
+                               (__le32 *)buf));
                DEBUG("%s: OID_GEN_CURRENT_PACKET_FILTER %08x\n",
                        __FUNCTION__, *params->filter);
 
@@ -771,7 +780,7 @@ update_linkstate:
                 * resuming, Windows forces a reset, and then SET_POWER D0.
                 * FIXME ... then things go batty; Windows wedges itself.
                 */
-               i = le32_to_cpup((__force __le32 *)buf);
+               i = le32_to_cpu(get_unaligned((__le32 *)buf));
                DEBUG("%s: OID_PNP_SET_POWER D%d\n", __FUNCTION__, i - 1);
                switch (i) {
                case NdisDeviceStateD0:
@@ -1058,8 +1067,8 @@ int rndis_msg_parser (u8 configNr, u8 *buf)
                return -ENOMEM;
 
        tmp = (__le32 *) buf;
-       MsgType   = le32_to_cpup(tmp++);
-       MsgLength = le32_to_cpup(tmp++);
+       MsgType   = le32_to_cpu(get_unaligned(tmp++));
+       MsgLength = le32_to_cpu(get_unaligned(tmp++));
 
        if (configNr >= RNDIS_MAX_CONFIGS)
                return -ENOTSUPP;
index 216c9c9d4d6d58b07b0ed39d86ce77e080367740..bb9cc595219e84cb0582250dc857d9892a503c0a 100644 (file)
@@ -417,6 +417,8 @@ ohci_hub_status_data (struct usb_hcd *hcd, char *buf)
        unsigned long   flags;
 
        spin_lock_irqsave (&ohci->lock, flags);
+       if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags))
+               goto done;
 
        /* undocumented erratum seen on at least rev D */
        if ((ohci->flags & OHCI_QUIRK_AMD756)
index d230ee72f9cd7751343275b08b0faf2acb99a5a0..54979c239c6329d7382176e7996a5384c371b160 100644 (file)
@@ -1179,8 +1179,8 @@ UNUSUAL_DEV( 0x0a17, 0x006, 0x0000, 0xffff,
                 US_SC_DEVICE, US_PR_DEVICE, NULL,
                 US_FL_FIX_INQUIRY ),
 
-/* These are virtual windows driver CDs, which the zd1211rw driver automatically
- * converts into a WLAN devices. */
+/* These are virtual windows driver CDs, which the zd1211rw driver
+ * automatically converts into WLAN devices. */
 UNUSUAL_DEV( 0x0ace, 0x2011, 0x0101, 0x0101,
                 "ZyXEL",
                 "G-220F USB-WLAN Install",
@@ -1193,6 +1193,14 @@ UNUSUAL_DEV( 0x0ace, 0x20ff, 0x0101, 0x0101,
                US_SC_DEVICE, US_PR_DEVICE, NULL,
                US_FL_IGNORE_DEVICE ),
 
+/* SanDisk that has a second LUN for a driver ISO, reported by
+ * Ben Collins <bcollins@ubuntu.com> */
+UNUSUAL_DEV( 0x0781, 0x5406, 0x0000, 0xffff,
+               "SanDisk",
+               "U3 Cruzer Micro driver ISO",
+               US_SC_DEVICE, US_PR_DEVICE, NULL,
+               US_FL_SINGLE_LUN ),
+
 #ifdef CONFIG_USB_STORAGE_ISD200
 UNUSUAL_DEV(  0x0bf6, 0xa001, 0x0100, 0x0110,
                "ATI",
@@ -1271,6 +1279,15 @@ UNUSUAL_DEV( 0x0dd8, 0x1060, 0x0000, 0xffff,
                US_SC_DEVICE, US_PR_DEVICE, NULL,
                US_FL_FIX_INQUIRY ),
 
+/* Reported by Edward Chapman (taken from linux-usb mailing list)
+   Netac OnlyDisk Mini U2CV2 512MB USB 2.0 Flash Drive */
+UNUSUAL_DEV( 0x0dd8, 0xd202, 0x0000, 0x9999,
+               "Netac",
+               "USB Flash Disk",
+               US_SC_DEVICE, US_PR_DEVICE, NULL,
+               US_FL_IGNORE_RESIDUE ),
+
+
 /* Patch by Stephan Walter <stephan.walter@epfl.ch>
  * I don't know why, but it works... */
 UNUSUAL_DEV( 0x0dda, 0x0001, 0x0012, 0x0012,
index 9b26dda18a38c1e13fde4b3b92610a36d840d7ef..ac46cc3f6a2a1286586d51cc3bec3dce23ff0d19 100644 (file)
@@ -47,7 +47,7 @@ targets := promcon_tbl.c
 quiet_cmd_conmakehash = CNMKHSH $@
       cmd_conmakehash = scripts/conmakehash $< | \
                sed -e '/\#include <[^>]*>/p' -e 's/types/init/' \
-               -e 's/dfont\(_uni.*\]\)/promfont\1 __initdata/' > $@
+               -e 's/dfont\(_uni.*\]\)/promfont\1 /' > $@
 
 $(obj)/promcon_tbl.c: $(src)/prom.uni
        $(call cmd,conmakehash)
index 717b360d041536ee80f8a4ce8ee99c7bf88c7c9e..870017d449702cf0da0916cedec3dd4efe759bcd 100644 (file)
@@ -240,7 +240,7 @@ static void sti_flush(unsigned long from, unsigned long len)
        flush_icache_range(from, from+len);
 }
 
-void __init
+void __devinit
 sti_rom_copy(unsigned long base, unsigned long count, void *dest)
 {
        unsigned long dest_len = count;
@@ -269,7 +269,7 @@ sti_rom_copy(unsigned long base, unsigned long count, void *dest)
 static char default_sti_path[21] __read_mostly;
 
 #ifndef MODULE
-static int __init sti_setup(char *str)
+static int __devinit sti_setup(char *str)
 {
        if (str)
                strlcpy (default_sti_path, str, sizeof (default_sti_path));
@@ -288,12 +288,12 @@ __setup("sti=", sti_setup);
 
 
 
-static char __initdata *font_name[MAX_STI_ROMS] = { "VGA8x16", };
-static int __initdata  font_index[MAX_STI_ROMS], 
-                       font_height[MAX_STI_ROMS],
-                       font_width[MAX_STI_ROMS];
+static char __devinitdata      *font_name[MAX_STI_ROMS] = { "VGA8x16", };
+static int __devinitdata       font_index[MAX_STI_ROMS],
+                               font_height[MAX_STI_ROMS],
+                               font_width[MAX_STI_ROMS];
 #ifndef MODULE
-static int __init sti_font_setup(char *str)
+static int __devinit sti_font_setup(char *str)
 {
        char *x;
        int i = 0;
@@ -346,7 +346,7 @@ __setup("sti_font=", sti_font_setup);
 
 
        
-static void __init
+static void __devinit
 sti_dump_globcfg(struct sti_glob_cfg *glob_cfg, unsigned int sti_mem_request)
 {
        struct sti_glob_cfg_ext *cfg;
@@ -386,7 +386,7 @@ sti_dump_globcfg(struct sti_glob_cfg *glob_cfg, unsigned int sti_mem_request)
                cfg->sti_mem_addr, sti_mem_request));
 }
 
-static void __init
+static void __devinit
 sti_dump_outptr(struct sti_struct *sti)
 {
        DPRINTK((KERN_INFO
@@ -400,7 +400,7 @@ sti_dump_outptr(struct sti_struct *sti)
                 sti->outptr.attributes));
 }
 
-static int __init
+static int __devinit
 sti_init_glob_cfg(struct sti_struct *sti,
            unsigned long rom_address, unsigned long hpa)
 {
@@ -482,7 +482,7 @@ sti_init_glob_cfg(struct sti_struct *sti,
 }
 
 #ifdef CONFIG_FB
-struct sti_cooked_font * __init
+struct sti_cooked_font * __devinit
 sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name)
 {
        const struct font_desc *fbfont;
@@ -538,14 +538,14 @@ sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name)
        return cooked_font;
 }
 #else
-struct sti_cooked_font * __init
+struct sti_cooked_font * __devinit
 sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name)
 {
        return NULL;
 }
 #endif
 
-struct sti_cooked_font * __init
+struct sti_cooked_font * __devinit
 sti_select_font(struct sti_cooked_rom *rom,
            int (*search_font_fnc) (struct sti_cooked_rom *,int,int) )
 {
@@ -572,7 +572,7 @@ sti_select_font(struct sti_cooked_rom *rom,
 }
 
 
-static void __init 
+static void __devinit
 sti_dump_rom(struct sti_rom *rom)
 {
        printk(KERN_INFO "    id %04x-%04x, conforms to spec rev. %d.%02x\n",
@@ -590,7 +590,7 @@ sti_dump_rom(struct sti_rom *rom)
 }
 
 
-static int __init 
+static int __devinit
 sti_cook_fonts(struct sti_cooked_rom *cooked_rom,
                        struct sti_rom *raw_rom)
 {
@@ -625,7 +625,7 @@ sti_cook_fonts(struct sti_cooked_rom *cooked_rom,
 }
 
 
-static int __init 
+static int __devinit
 sti_search_font(struct sti_cooked_rom *rom, int height, int width)
 {
        struct sti_cooked_font *font;
@@ -642,7 +642,7 @@ sti_search_font(struct sti_cooked_rom *rom, int height, int width)
 #define BMODE_RELOCATE(offset)         offset = (offset) / 4;
 #define BMODE_LAST_ADDR_OFFS           0x50
 
-static void * __init
+static void * __devinit
 sti_bmode_font_raw(struct sti_cooked_font *f)
 {
        unsigned char *n, *p, *q;
@@ -660,7 +660,7 @@ sti_bmode_font_raw(struct sti_cooked_font *f)
        return n + 3;
 }
 
-static void __init
+static void __devinit
 sti_bmode_rom_copy(unsigned long base, unsigned long count, void *dest)
 {
        unsigned long dest_len = count;
@@ -675,7 +675,7 @@ sti_bmode_rom_copy(unsigned long base, unsigned long count, void *dest)
        sti_flush(dest_start, dest_len);
 }
 
-static struct sti_rom * __init
+static struct sti_rom * __devinit
 sti_get_bmode_rom (unsigned long address)
 {
        struct sti_rom *raw;
@@ -711,7 +711,7 @@ sti_get_bmode_rom (unsigned long address)
        return raw;
 }
 
-struct sti_rom * __init
+struct sti_rom * __devinit
 sti_get_wmode_rom (unsigned long address)
 {
        struct sti_rom *raw;
@@ -727,7 +727,7 @@ sti_get_wmode_rom (unsigned long address)
        return raw;
 }
 
-int __init
+int __devinit
 sti_read_rom(int wordmode, struct sti_struct *sti, unsigned long address)
 {
        struct sti_cooked_rom *cooked;
@@ -783,7 +783,7 @@ out_err:
        return 0;
 }
 
-static struct sti_struct * __init
+static struct sti_struct * __devinit
 sti_try_rom_generic(unsigned long address, unsigned long hpa, struct pci_dev *pd)
 {
        struct sti_struct *sti;
@@ -898,7 +898,7 @@ out_err:
        return NULL;
 }
 
-static void __init sticore_check_for_default_sti(struct sti_struct *sti, char *path)
+static void __devinit sticore_check_for_default_sti(struct sti_struct *sti, char *path)
 {
        if (strcmp (path, default_sti_path) == 0)
                default_sti = sti;
@@ -909,7 +909,7 @@ static void __init sticore_check_for_default_sti(struct sti_struct *sti, char *p
  * in the additional address field addr[1] while on
  * older Systems the PDC stores it in page0->proc_sti 
  */
-static int __init sticore_pa_init(struct parisc_device *dev)
+static int __devinit sticore_pa_init(struct parisc_device *dev)
 {
        char pa_path[21];
        struct sti_struct *sti = NULL;
@@ -1015,7 +1015,7 @@ static struct parisc_driver pa_sti_driver = {
 
 static int sticore_initialized __read_mostly;
 
-static void __init sti_init_roms(void)
+static void __devinit sti_init_roms(void)
 {
        if (sticore_initialized)
                return;
index 1d4e8354b56159b407783eb073a70a4c464fcbf2..3f6c98fad437fca8f542dbd11a29a19e55d52bce 100644 (file)
@@ -656,7 +656,7 @@ static int ffb_setcolreg(unsigned regno,
 {
        u32 value;
 
-       if (regno >= 256)
+       if (regno >= 16)
                return 1;
 
        red >>= 8;
@@ -903,7 +903,7 @@ ffb_init_fix(struct fb_info *info)
 struct all_info {
        struct fb_info info;
        struct ffb_par par;
-       u32 pseudo_palette[256];
+       u32 pseudo_palette[16];
 };
 
 static int ffb_init_one(struct of_device *op)
index 4316c7fe8e21c52d92fa4cca203bb796d7594a54..c3869a96ab5877162ea6e72960f7d0fdf73e9cd1 100644 (file)
@@ -28,7 +28,7 @@ struct s3d_info {
        unsigned int            depth;
        unsigned int            fb_size;
 
-       u32                     pseudo_palette[256];
+       u32                     pseudo_palette[16];
 };
 
 static int __devinit s3d_get_props(struct s3d_info *sp)
@@ -52,15 +52,14 @@ static int s3d_setcolreg(unsigned regno,
 {
        u32 value;
 
-       if (regno >= 256)
-               return 1;
+       if (regno < 16) {
+               red >>= 8;
+               green >>= 8;
+               blue >>= 8;
 
-       red >>= 8;
-       green >>= 8;
-       blue >>= 8;
-
-       value = (blue << 24) | (green << 16) | (red << 8);
-       ((u32 *)info->pseudo_palette)[regno] = value;
+               value = (blue << 24) | (green << 16) | (red << 8);
+               ((u32 *)info->pseudo_palette)[regno] = value;
+       }
 
        return 0;
 }
index 08880a62bfa3302e3983169b73dd461f6c50913d..71bf3f1f00bcf1b9f2aa018281494a9a2a6b0e72 100644 (file)
@@ -50,7 +50,7 @@ struct e3d_info {
        u32                     fb8_0_off;
        u32                     fb8_1_off;
 
-       u32                     pseudo_palette[256];
+       u32                     pseudo_palette[16];
 };
 
 static int __devinit e3d_get_props(struct e3d_info *ep)
@@ -126,7 +126,9 @@ static int e3d_setcolreg(unsigned regno,
        blue_8 = blue >> 8;
 
        value = (blue_8 << 24) | (green_8 << 16) | (red_8 << 8);
-       ((u32 *)info->pseudo_palette)[regno] = value;
+
+       if (info->fix.visual == FB_VISUAL_TRUECOLOR && regno < 16)
+               ((u32 *)info->pseudo_palette)[regno] = value;
 
 
        red_10 = red >> 6;
index 7b0265d7f3a84a88f537b8e9174a27e4c3e650b6..861141b4f6d6f4cbbfcd96366074db8e4adbeaf3 100644 (file)
@@ -558,7 +558,7 @@ static int load_flat_file(struct linux_binprm * bprm,
                        if (!realdatastart)
                                realdatastart = (unsigned long) -ENOMEM;
                        printk("Unable to allocate RAM for process data, errno %d\n",
-                                       (int)-datapos);
+                                       (int)-realdatastart);
                        do_munmap(current->mm, textpos, text_len);
                        ret = realdatastart;
                        goto err;
index 6017c465440eaef7299e60632b0f03b71dcbffe4..07838b2ac1ce8bf38f463c7ca818645b3fa05c8f 100644 (file)
@@ -7,16 +7,16 @@
  *
  *   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 
+ *   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 
+ *   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/fs.h>
@@ -39,7 +39,7 @@ cifs_dump_mem(char *label, void *data, int length)
        char *charptr = data;
        char buf[10], line[80];
 
-       printk(KERN_DEBUG "%s: dump of %d bytes of data at 0x%p\n", 
+       printk(KERN_DEBUG "%s: dump of %d bytes of data at 0x%p\n",
                label, length, data);
        for (i = 0; i < length; i += 16) {
                line[0] = 0;
@@ -60,10 +60,10 @@ cifs_dump_mem(char *label, void *data, int length)
 #ifdef CONFIG_CIFS_DEBUG2
 void cifs_dump_detail(struct smb_hdr * smb)
 {
-       cERROR(1,("Cmd: %d Err: 0x%x Flags: 0x%x Flgs2: 0x%x Mid: %d Pid: %d",
+       cERROR(1, ("Cmd: %d Err: 0x%x Flags: 0x%x Flgs2: 0x%x Mid: %d Pid: %d",
                  smb->Command, smb->Status.CifsError,
                  smb->Flags, smb->Flags2, smb->Mid, smb->Pid));
-       cERROR(1,("smb buf %p len %d", smb, smbCalcSize_LE(smb)));
+       cERROR(1, ("smb buf %p len %d", smb, smbCalcSize_LE(smb)));
 }
 
 
@@ -72,36 +72,35 @@ void cifs_dump_mids(struct TCP_Server_Info * server)
        struct list_head *tmp;
        struct mid_q_entry * mid_entry;
 
-       if(server == NULL)
+       if (server == NULL)
                return;
 
-       cERROR(1,("Dump pending requests:"));
+       cERROR(1, ("Dump pending requests:"));
        spin_lock(&GlobalMid_Lock);
        list_for_each(tmp, &server->pending_mid_q) {
                mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
-               if(mid_entry) {
-                       cERROR(1,("State: %d Cmd: %d Pid: %d Tsk: %p Mid %d",
+               if (mid_entry) {
+                       cERROR(1, ("State: %d Cmd: %d Pid: %d Tsk: %p Mid %d",
                                mid_entry->midState,
                                (int)mid_entry->command,
                                mid_entry->pid,
                                mid_entry->tsk,
                                mid_entry->mid));
 #ifdef CONFIG_CIFS_STATS2
-                       cERROR(1,("IsLarge: %d buf: %p time rcv: %ld now: %ld",
+                       cERROR(1, ("IsLarge: %d buf: %p time rcv: %ld now: %ld",
                                mid_entry->largeBuf,
                                mid_entry->resp_buf,
                                mid_entry->when_received,
                                jiffies));
 #endif /* STATS2 */
-                       cERROR(1,("IsMult: %d IsEnd: %d", mid_entry->multiRsp,
+                       cERROR(1, ("IsMult: %d IsEnd: %d", mid_entry->multiRsp,
                                  mid_entry->multiEnd));
-                       if(mid_entry->resp_buf) {
+                       if (mid_entry->resp_buf) {
                                cifs_dump_detail(mid_entry->resp_buf);
                                cifs_dump_mem("existing buf: ",
                                        mid_entry->resp_buf,
                                        62 /* fixme */);
                        }
-                       
                }
        }
        spin_unlock(&GlobalMid_Lock);
@@ -129,9 +128,10 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
                    "Display Internal CIFS Data Structures for Debugging\n"
                    "---------------------------------------------------\n");
        buf += length;
-       length = sprintf(buf,"CIFS Version %s\n",CIFS_VERSION);
+       length = sprintf(buf, "CIFS Version %s\n", CIFS_VERSION);
        buf += length;
-       length = sprintf(buf,"Active VFS Requests: %d\n", GlobalTotalActiveXid);
+       length = sprintf(buf,
+               "Active VFS Requests: %d\n", GlobalTotalActiveXid);
        buf += length;
        length = sprintf(buf, "Servers:");
        buf += length;
@@ -141,7 +141,7 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
        list_for_each(tmp, &GlobalSMBSessionList) {
                i++;
                ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList);
-               if((ses->serverDomain == NULL) || (ses->serverOS == NULL) ||
+               if ((ses->serverDomain == NULL) || (ses->serverOS == NULL) ||
                   (ses->serverNOS == NULL)) {
                        buf += sprintf(buf, "\nentry for %s not fully "
                                        "displayed\n\t", ses->serverName);
@@ -149,15 +149,18 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
                } else {
                        length =
                            sprintf(buf,
-                                   "\n%d) Name: %s  Domain: %s Mounts: %d OS: %s  \n\tNOS: %s\tCapability: 0x%x\n\tSMB session status: %d\t",
+                                   "\n%d) Name: %s  Domain: %s Mounts: %d OS:"
+                                   " %s  \n\tNOS: %s\tCapability: 0x%x\n\tSMB"
+                                   " session status: %d\t",
                                i, ses->serverName, ses->serverDomain,
                                atomic_read(&ses->inUse),
                                ses->serverOS, ses->serverNOS,
-                               ses->capabilities,ses->status);
+                               ses->capabilities, ses->status);
                        buf += length;
                }
-               if(ses->server) {
-                       buf += sprintf(buf, "TCP status: %d\n\tLocal Users To Server: %d SecMode: 0x%x Req On Wire: %d",
+               if (ses->server) {
+                       buf += sprintf(buf, "TCP status: %d\n\tLocal Users To "
+                                   "Server: %d SecMode: 0x%x Req On Wire: %d",
                                ses->server->tcpStatus,
                                atomic_read(&ses->server->socketUseCount),
                                ses->server->secMode,
@@ -165,7 +168,7 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
 
 #ifdef CONFIG_CIFS_STATS2
                        buf += sprintf(buf, " In Send: %d In MaxReq Wait: %d",
-                               atomic_read(&ses->server->inSend), 
+                               atomic_read(&ses->server->inSend),
                                atomic_read(&ses->server->num_waiters));
 #endif
 
@@ -177,17 +180,19 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
                                mid_entry = list_entry(tmp1, struct
                                        mid_q_entry,
                                        qhead);
-                               if(mid_entry) {
-                                       length = sprintf(buf,"State: %d com: %d pid: %d tsk: %p mid %d\n",
-                                               mid_entry->midState,
-                                               (int)mid_entry->command,
-                                               mid_entry->pid,
-                                               mid_entry->tsk,
-                                               mid_entry->mid);
+                               if (mid_entry) {
+                                       length = sprintf(buf,
+                                                       "State: %d com: %d pid:"
+                                                       " %d tsk: %p mid %d\n",
+                                                       mid_entry->midState,
+                                                       (int)mid_entry->command,
+                                                       mid_entry->pid,
+                                                       mid_entry->tsk,
+                                                       mid_entry->mid);
                                        buf += length;
                                }
                        }
-                       spin_unlock(&GlobalMid_Lock); 
+                       spin_unlock(&GlobalMid_Lock);
                }
 
        }
@@ -207,7 +212,8 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
                dev_type = le32_to_cpu(tcon->fsDevInfo.DeviceType);
                length =
                    sprintf(buf,
-                           "\n%d) %s Uses: %d Type: %s DevInfo: 0x%x Attributes: 0x%x\nPathComponentMax: %d Status: %d",
+                           "\n%d) %s Uses: %d Type: %s DevInfo: 0x%x "
+                           "Attributes: 0x%x\nPathComponentMax: %d Status: %d",
                            i, tcon->treeName,
                            atomic_read(&tcon->useCount),
                            tcon->nativeFileSystem,
@@ -215,7 +221,7 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
                            le32_to_cpu(tcon->fsAttrInfo.Attributes),
                            le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength),
                            tcon->tidStatus);
-               buf += length;        
+               buf += length;
                if (dev_type == FILE_DEVICE_DISK)
                        length = sprintf(buf, " type: DISK ");
                else if (dev_type == FILE_DEVICE_CD_ROM)
@@ -224,7 +230,7 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
                        length =
                            sprintf(buf, " type: %d ", dev_type);
                buf += length;
-               if(tcon->tidStatus == CifsNeedReconnect) {
+               if (tcon->tidStatus == CifsNeedReconnect) {
                        buf += sprintf(buf, "\tDISCONNECTED ");
                        length += 14;
                }
@@ -238,9 +244,9 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
        /* Now calculate total size of returned data */
        length = buf - original_buf;
 
-       if(offset + count >= length)
+       if (offset + count >= length)
                *eof = 1;
-       if(length < offset) {
+       if (length < offset) {
                *eof = 1;
                return 0;
        } else {
@@ -256,18 +262,18 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
 
 static int
 cifs_stats_write(struct file *file, const char __user *buffer,
-               unsigned long count, void *data)
+                unsigned long count, void *data)
 {
-        char c;
-        int rc;
+       char c;
+       int rc;
        struct list_head *tmp;
        struct cifsTconInfo *tcon;
 
-        rc = get_user(c, buffer);
-        if (rc)
-                return rc;
+       rc = get_user(c, buffer);
+       if (rc)
+               return rc;
 
-        if (c == '1' || c == 'y' || c == 'Y' || c == '0') {
+       if (c == '1' || c == 'y' || c == 'Y' || c == '0') {
                read_lock(&GlobalSMBSeslock);
 #ifdef CONFIG_CIFS_STATS2
                atomic_set(&totBufAllocCount, 0);
@@ -297,14 +303,14 @@ cifs_stats_write(struct file *file, const char __user *buffer,
                read_unlock(&GlobalSMBSeslock);
        }
 
-        return count;
+       return count;
 }
 
 static int
 cifs_stats_read(char *buf, char **beginBuffer, off_t offset,
                  int count, int *eof, void *data)
 {
-       int item_length,i,length;
+       int item_length, i, length;
        struct list_head *tmp;
        struct cifsTconInfo *tcon;
 
@@ -314,44 +320,44 @@ cifs_stats_read(char *buf, char **beginBuffer, off_t offset,
                        "Resources in use\nCIFS Session: %d\n",
                        sesInfoAllocCount.counter);
        buf += length;
-       item_length = 
-               sprintf(buf,"Share (unique mount targets): %d\n",
+       item_length =
+               sprintf(buf, "Share (unique mount targets): %d\n",
                        tconInfoAllocCount.counter);
        length += item_length;
-       buf += item_length;      
-       item_length = 
-               sprintf(buf,"SMB Request/Response Buffer: %d Pool size: %d\n",
+       buf += item_length;
+       item_length =
+               sprintf(buf, "SMB Request/Response Buffer: %d Pool size: %d\n",
                        bufAllocCount.counter,
                        cifs_min_rcv + tcpSesAllocCount.counter);
        length += item_length;
        buf += item_length;
-       item_length = 
-               sprintf(buf,"SMB Small Req/Resp Buffer: %d Pool size: %d\n",
-                       smBufAllocCount.counter,cifs_min_small);
+       item_length =
+               sprintf(buf, "SMB Small Req/Resp Buffer: %d Pool size: %d\n",
+                       smBufAllocCount.counter, cifs_min_small);
        length += item_length;
        buf += item_length;
 #ifdef CONFIG_CIFS_STATS2
-        item_length = sprintf(buf, "Total Large %d Small %d Allocations\n",
+       item_length = sprintf(buf, "Total Large %d Small %d Allocations\n",
                                atomic_read(&totBufAllocCount),
-                               atomic_read(&totSmBufAllocCount));
+                               atomic_read(&totSmBufAllocCount));
        length += item_length;
        buf += item_length;
 #endif /* CONFIG_CIFS_STATS2 */
 
-       item_length = 
-               sprintf(buf,"Operations (MIDs): %d\n",
+       item_length =
+               sprintf(buf, "Operations (MIDs): %d\n",
                        midCount.counter);
        length += item_length;
        buf += item_length;
        item_length = sprintf(buf,
                "\n%d session %d share reconnects\n",
-               tcpSesReconnectCount.counter,tconInfoReconnectCount.counter);
+               tcpSesReconnectCount.counter, tconInfoReconnectCount.counter);
        length += item_length;
        buf += item_length;
 
        item_length = sprintf(buf,
                "Total vfs operations: %d maximum at one time: %d\n",
-               GlobalCurrentXid,GlobalMaxActiveXid);
+               GlobalCurrentXid, GlobalMaxActiveXid);
        length += item_length;
        buf += item_length;
 
@@ -360,10 +366,10 @@ cifs_stats_read(char *buf, char **beginBuffer, off_t offset,
        list_for_each(tmp, &GlobalTreeConnectionList) {
                i++;
                tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList);
-               item_length = sprintf(buf,"\n%d) %s",i, tcon->treeName);
+               item_length = sprintf(buf, "\n%d) %s", i, tcon->treeName);
                buf += item_length;
                length += item_length;
-               if(tcon->tidStatus == CifsNeedReconnect) {
+               if (tcon->tidStatus == CifsNeedReconnect) {
                        buf += sprintf(buf, "\tDISCONNECTED ");
                        length += 14;
                }
@@ -380,15 +386,15 @@ cifs_stats_read(char *buf, char **beginBuffer, off_t offset,
                item_length = sprintf(buf, "\nWrites: %d Bytes: %lld",
                        atomic_read(&tcon->num_writes),
                        (long long)(tcon->bytes_written));
-                buf += item_length;
-                length += item_length;
-                item_length = sprintf(buf, 
+               buf += item_length;
+               length += item_length;
+               item_length = sprintf(buf,
                        "\nLocks: %d HardLinks: %d Symlinks: %d",
-                        atomic_read(&tcon->num_locks),
+                       atomic_read(&tcon->num_locks),
                        atomic_read(&tcon->num_hardlinks),
                        atomic_read(&tcon->num_symlinks));
-                buf += item_length;
-                length += item_length;
+               buf += item_length;
+               length += item_length;
 
                item_length = sprintf(buf, "\nOpens: %d Closes: %d Deletes: %d",
                        atomic_read(&tcon->num_opens),
@@ -415,12 +421,12 @@ cifs_stats_read(char *buf, char **beginBuffer, off_t offset,
        }
        read_unlock(&GlobalSMBSeslock);
 
-       buf += sprintf(buf,"\n");
+       buf += sprintf(buf, "\n");
        length++;
 
-       if(offset + count >= length)
+       if (offset + count >= length)
                *eof = 1;
-       if(length < offset) {
+       if (length < offset) {
                *eof = 1;
                return 0;
        } else {
@@ -428,7 +434,7 @@ cifs_stats_read(char *buf, char **beginBuffer, off_t offset,
        }
        if (length > count)
                length = count;
-               
+
        return length;
 }
 #endif
@@ -547,11 +553,11 @@ cifs_proc_clean(void)
        remove_proc_entry("MultiuserMount", proc_fs_cifs);
        remove_proc_entry("OplockEnabled", proc_fs_cifs);
 /*     remove_proc_entry("NTLMV2Enabled",proc_fs_cifs); */
-       remove_proc_entry("SecurityFlags",proc_fs_cifs);
-/*     remove_proc_entry("PacketSigningEnabled",proc_fs_cifs); */
-       remove_proc_entry("LinuxExtensionsEnabled",proc_fs_cifs);
-       remove_proc_entry("Experimental",proc_fs_cifs);
-       remove_proc_entry("LookupCacheEnabled",proc_fs_cifs);
+       remove_proc_entry("SecurityFlags", proc_fs_cifs);
+/*     remove_proc_entry("PacketSigningEnabled", proc_fs_cifs); */
+       remove_proc_entry("LinuxExtensionsEnabled", proc_fs_cifs);
+       remove_proc_entry("Experimental", proc_fs_cifs);
+       remove_proc_entry("LookupCacheEnabled", proc_fs_cifs);
        remove_proc_entry("cifs", proc_root_fs);
 }
 
@@ -590,7 +596,7 @@ cifsFYI_write(struct file *file, const char __user *buffer,
                cifsFYI = 0;
        else if (c == '1' || c == 'y' || c == 'Y')
                cifsFYI = 1;
-       else if((c > '1') && (c <= '9'))
+       else if ((c > '1') && (c <= '9'))
                cifsFYI = (int) (c - '0'); /* see cifs_debug.h for meanings */
 
        return count;
@@ -637,28 +643,28 @@ oplockEnabled_write(struct file *file, const char __user *buffer,
 
 static int
 experimEnabled_read(char *page, char **start, off_t off,
-                   int count, int *eof, void *data)
+                   int count, int *eof, void *data)
 {
-        int len;
+       int len;
 
-        len = sprintf(page, "%d\n", experimEnabled);
+       len = sprintf(page, "%d\n", experimEnabled);
 
-        len -= off;
-        *start = page + off;
+       len -= off;
+       *start = page + off;
 
-        if (len > count)
-                len = count;
-        else
-                *eof = 1;
+       if (len > count)
+               len = count;
+       else
+               *eof = 1;
 
-        if (len < 0)
-                len = 0;
+       if (len < 0)
+               len = 0;
 
-        return len;
+       return len;
 }
 static int
 experimEnabled_write(struct file *file, const char __user *buffer,
-                    unsigned long count, void *data)
+                    unsigned long count, void *data)
 {
        char c;
        int rc;
@@ -678,46 +684,46 @@ experimEnabled_write(struct file *file, const char __user *buffer,
 
 static int
 linuxExtensionsEnabled_read(char *page, char **start, off_t off,
-                   int count, int *eof, void *data)
+                           int count, int *eof, void *data)
 {
-        int len;
+       int len;
 
-        len = sprintf(page, "%d\n", linuxExtEnabled);
-        len -= off;
-        *start = page + off;
+       len = sprintf(page, "%d\n", linuxExtEnabled);
+       len -= off;
+       *start = page + off;
 
-        if (len > count)
-                len = count;
-        else
-                *eof = 1;
+       if (len > count)
+               len = count;
+       else
+               *eof = 1;
 
-        if (len < 0)
-                len = 0;
+       if (len < 0)
+               len = 0;
 
-        return len;
+       return len;
 }
 static int
 linuxExtensionsEnabled_write(struct file *file, const char __user *buffer,
-                    unsigned long count, void *data)
+                            unsigned long count, void *data)
 {
-        char c;
-        int rc;
-
-        rc = get_user(c, buffer);
-        if (rc)
-                return rc;
-        if (c == '0' || c == 'n' || c == 'N')
-                linuxExtEnabled = 0;
-        else if (c == '1' || c == 'y' || c == 'Y')
-                linuxExtEnabled = 1;
-
-        return count;
+       char c;
+       int rc;
+
+       rc = get_user(c, buffer);
+       if (rc)
+               return rc;
+       if (c == '0' || c == 'n' || c == 'N')
+               linuxExtEnabled = 0;
+       else if (c == '1' || c == 'y' || c == 'Y')
+               linuxExtEnabled = 1;
+
+       return count;
 }
 
 
 static int
 lookupFlag_read(char *page, char **start, off_t off,
-                  int count, int *eof, void *data)
+               int count, int *eof, void *data)
 {
        int len;
 
@@ -860,15 +866,15 @@ security_flags_write(struct file *file, const char __user *buffer,
        char flags_string[12];
        char c;
 
-       if((count < 1) || (count > 11))
+       if ((count < 1) || (count > 11))
                return -EINVAL;
 
        memset(flags_string, 0, 12);
 
-       if(copy_from_user(flags_string, buffer, count))
+       if (copy_from_user(flags_string, buffer, count))
                return -EFAULT;
 
-       if(count < 3) {
+       if (count < 3) {
                /* single char or single char followed by null */
                c = flags_string[0];
                if (c == '0' || c == 'n' || c == 'N')
@@ -881,15 +887,15 @@ security_flags_write(struct file *file, const char __user *buffer,
 
        flags = simple_strtoul(flags_string, NULL, 0);
 
-       cFYI(1,("sec flags 0x%x", flags));
+       cFYI(1, ("sec flags 0x%x", flags));
 
-       if(flags <= 0)  {
-               cERROR(1,("invalid security flags %s",flags_string));
+       if (flags <= 0)  {
+               cERROR(1, ("invalid security flags %s", flags_string));
                return -EINVAL;
        }
 
-       if(flags & ~CIFSSEC_MASK) {
-               cERROR(1,("attempt to set unsupported security flags 0x%x",
+       if (flags & ~CIFSSEC_MASK) {
+               cERROR(1, ("attempt to set unsupported security flags 0x%x",
                        flags & ~CIFSSEC_MASK));
                return -EINVAL;
        }
index 793c4b95c164ac461e9eabc70e895ed7b3190926..701e9a9185f2cf4ec62d45c56853d1d47b2b9e56 100644 (file)
@@ -6,16 +6,16 @@
  *
  *   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 
+ *   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 
+ *   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/fs.h>
@@ -32,7 +32,7 @@
  *
  */
 int
-cifs_strfromUCS_le(char *to, const __le16 * from,      
+cifs_strfromUCS_le(char *to, const __le16 * from,
                   int len, const struct nls_table *codepage)
 {
        int i;
@@ -66,7 +66,7 @@ cifs_strtoUCS(__le16 * to, const char *from, int len,
 {
        int charlen;
        int i;
-       wchar_t * wchar_to = (wchar_t *)to; /* needed to quiet sparse */  
+       wchar_t * wchar_to = (wchar_t *)to; /* needed to quiet sparse */
 
        for (i = 0; len && *from; i++, from += charlen, len -= charlen) {
 
@@ -79,7 +79,7 @@ cifs_strtoUCS(__le16 * to, const char *from, int len,
                        /* A question mark */
                        to[i] = cpu_to_le16(0x003f);
                        charlen = 1;
-               } else 
+               } else
                        to[i] = cpu_to_le16(wchar_to[i]);
 
        }
index d38c69b591cfe0907d3d9e08bdb0da0380321709..7c04752b76cb88f1678e3f76cd4a2642a4a1a929 100644 (file)
@@ -825,8 +825,8 @@ cifs_init_mids(void)
                                sizeof (struct oplock_q_entry), 0,
                                SLAB_HWCACHE_ALIGN, NULL, NULL);
        if (cifs_oplock_cachep == NULL) {
-               kmem_cache_destroy(cifs_mid_cachep);
                mempool_destroy(cifs_mid_poolp);
+               kmem_cache_destroy(cifs_mid_cachep);
                return -ENOMEM;
        }
 
index 14de58fa14379a7aa344df861a2acbd02d867892..57419a176688356cec33d80e2c89d22b13d0fedc 100644 (file)
@@ -433,8 +433,8 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses)
        cFYI(1,("secFlags 0x%x",secFlags));
 
        pSMB->hdr.Mid = GetNextMid(server);
-       pSMB->hdr.Flags2 |= SMBFLG2_UNICODE;
-       if((secFlags & CIFSSEC_MUST_KRB5) == CIFSSEC_MUST_KRB5)
+       pSMB->hdr.Flags2 |= (SMBFLG2_UNICODE | SMBFLG2_ERR_STATUS);
+       if ((secFlags & CIFSSEC_MUST_KRB5) == CIFSSEC_MUST_KRB5)
                pSMB->hdr.Flags2 |= SMBFLG2_EXT_SEC;
        
        count = 0;
index 216fb625843f4b29feb6011e8fe71a14f223a996..f4e92661b22306ffa1d019f81a47e501fc374a04 100644 (file)
@@ -2069,8 +2069,15 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
                        srvTcp->tcpStatus = CifsExiting;
                        spin_unlock(&GlobalMid_Lock);
                        if (srvTcp->tsk) {
+                               struct task_struct *tsk;
+                               /* If we could verify that kthread_stop would
+                                  always wake up processes blocked in
+                                  tcp in recv_mesg then we could remove the
+                                  send_sig call */
                                send_sig(SIGKILL,srvTcp->tsk,1);
-                               kthread_stop(srvTcp->tsk);
+                               tsk = srvTcp->tsk;
+                               if(tsk)
+                                       kthread_stop(tsk);
                        }
                }
                 /* If find_unc succeeded then rc == 0 so we can not end */
@@ -2085,8 +2092,11 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
                                        /* if the socketUseCount is now zero */
                                        if ((temp_rc == -ESHUTDOWN) &&
                                           (pSesInfo->server) && (pSesInfo->server->tsk)) {
+                                               struct task_struct *tsk;
                                                send_sig(SIGKILL,pSesInfo->server->tsk,1);
-                                               kthread_stop(pSesInfo->server->tsk);
+                                               tsk = pSesInfo->server->tsk;
+                                               if (tsk)
+                                                       kthread_stop(tsk);
                                        }
                                } else
                                        cFYI(1, ("No session or bad tcon"));
@@ -3334,7 +3344,7 @@ cifs_umount(struct super_block *sb, struct cifs_sb_info *cifs_sb)
                                return 0;
                        } else if (rc == -ESHUTDOWN) {
                                cFYI(1,("Waking up socket by sending it signal"));
-                               if(cifsd_task) {
+                               if (cifsd_task) {
                                        send_sig(SIGKILL,cifsd_task,1);
                                        kthread_stop(cifsd_task);
                                }
index e5210519ac4bbdda5109cb2714200118ded4c804..8e86aaceb68a476b1bd349979db176f2c1467032 100644 (file)
@@ -2,7 +2,7 @@
  *   fs/cifs/dir.c
  *
  *   vfs operations that deal with dentries
- * 
+ *
  *   Copyright (C) International Business Machines  Corp., 2002,2005
  *   Author(s): Steve French (sfrench@us.ibm.com)
  *
 static void
 renew_parental_timestamps(struct dentry *direntry)
 {
-       /* BB check if there is a way to get the kernel to do this or if we really need this */
+       /* BB check if there is a way to get the kernel to do this or if we
+          really need this */
        do {
                direntry->d_time = jiffies;
                direntry = direntry->d_parent;
-       } while (!IS_ROOT(direntry));   
+       } while (!IS_ROOT(direntry));
 }
 
 /* Note: caller must free return buffer */
@@ -51,7 +52,7 @@ build_path_from_dentry(struct dentry *direntry)
        char *full_path;
        char dirsep;
 
-       if(direntry == NULL)
+       if (direntry == NULL)
                return NULL;  /* not much we can do if dentry is freed and
                we need to reopen the file after it was closed implicitly
                when the server crashed */
@@ -59,18 +60,18 @@ build_path_from_dentry(struct dentry *direntry)
        dirsep = CIFS_DIR_SEP(CIFS_SB(direntry->d_sb));
        pplen = CIFS_SB(direntry->d_sb)->prepathlen;
 cifs_bp_rename_retry:
-       namelen = pplen; 
+       namelen = pplen;
        for (temp = direntry; !IS_ROOT(temp);) {
                namelen += (1 + temp->d_name.len);
                temp = temp->d_parent;
-               if(temp == NULL) {
-                       cERROR(1,("corrupt dentry"));
+               if (temp == NULL) {
+                       cERROR(1, ("corrupt dentry"));
                        return NULL;
                }
        }
 
        full_path = kmalloc(namelen+1, GFP_KERNEL);
-       if(full_path == NULL)
+       if (full_path == NULL)
                return full_path;
        full_path[namelen] = 0; /* trailing null */
        for (temp = direntry; !IS_ROOT(temp);) {
@@ -84,8 +85,8 @@ cifs_bp_rename_retry:
                        cFYI(0, ("name: %s", full_path + namelen));
                }
                temp = temp->d_parent;
-               if(temp == NULL) {
-                       cERROR(1,("corrupt dentry"));
+               if (temp == NULL) {
+                       cERROR(1, ("corrupt dentry"));
                        kfree(full_path);
                        return NULL;
                }
@@ -94,7 +95,7 @@ cifs_bp_rename_retry:
                cERROR(1,
                       ("did not end path lookup where expected namelen is %d",
                        namelen));
-               /* presumably this is only possible if racing with a rename 
+               /* presumably this is only possible if racing with a rename
                of one of the parent directories  (we can not lock the dentries
                above us to prevent this, but retrying should be harmless) */
                kfree(full_path);
@@ -106,7 +107,7 @@ cifs_bp_rename_retry:
           since the '\' is a valid posix character so we can not switch
           those safely to '/' if any are found in the middle of the prepath */
        /* BB test paths to Windows with '/' in the midst of prepath */
-       strncpy(full_path,CIFS_SB(direntry->d_sb)->prepath,pplen);
+       strncpy(full_path, CIFS_SB(direntry->d_sb)->prepath, pplen);
        return full_path;
 }
 
@@ -147,12 +148,12 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
        pTcon = cifs_sb->tcon;
 
        full_path = build_path_from_dentry(direntry);
-       if(full_path == NULL) {
+       if (full_path == NULL) {
                FreeXid(xid);
                return -ENOMEM;
        }
 
-       if(nd && (nd->flags & LOOKUP_OPEN)) {
+       if (nd && (nd->flags & LOOKUP_OPEN)) {
                int oflags = nd->intent.open.flags;
 
                desiredAccess = 0;
@@ -164,28 +165,29 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
                                write_only = TRUE;
                }
 
-               if((oflags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))
+               if ((oflags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))
                        disposition = FILE_CREATE;
-               else if((oflags & (O_CREAT | O_TRUNC)) == (O_CREAT | O_TRUNC))
+               else if ((oflags & (O_CREAT | O_TRUNC)) == (O_CREAT | O_TRUNC))
                        disposition = FILE_OVERWRITE_IF;
-               else if((oflags & O_CREAT) == O_CREAT)
+               else if ((oflags & O_CREAT) == O_CREAT)
                        disposition = FILE_OPEN_IF;
                else {
-                       cFYI(1,("Create flag not set in create function"));
+                       cFYI(1, ("Create flag not set in create function"));
                }
        }
 
-       /* BB add processing to set equivalent of mode - e.g. via CreateX with ACLs */
+       /* BB add processing to set equivalent of mode - e.g. via CreateX with
+          ACLs */
        if (oplockEnabled)
                oplock = REQ_OPLOCK;
 
-       buf = kmalloc(sizeof(FILE_ALL_INFO),GFP_KERNEL);
-       if(buf == NULL) {
+       buf = kmalloc(sizeof(FILE_ALL_INFO), GFP_KERNEL);
+       if (buf == NULL) {
                kfree(full_path);
                FreeXid(xid);
                return -ENOMEM;
        }
-       if (cifs_sb->tcon->ses->capabilities & CAP_NT_SMBS) 
+       if (cifs_sb->tcon->ses->capabilities & CAP_NT_SMBS)
                rc = CIFSSMBOpen(xid, pTcon, full_path, disposition,
                         desiredAccess, CREATE_NOT_DIR,
                         &fileHandle, &oplock, buf, cifs_sb->local_nls,
@@ -193,27 +195,28 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
        else
                rc = -EIO; /* no NT SMB support fall into legacy open below */
 
-       if(rc == -EIO) {
+       if (rc == -EIO) {
                /* old server, retry the open legacy style */
                rc = SMBLegacyOpen(xid, pTcon, full_path, disposition,
                        desiredAccess, CREATE_NOT_DIR,
                        &fileHandle, &oplock, buf, cifs_sb->local_nls,
                        cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
-       } 
+       }
        if (rc) {
                cFYI(1, ("cifs_create returned 0x%x", rc));
        } else {
                /* If Open reported that we actually created a file
                then we now have to set the mode if possible */
                if ((cifs_sb->tcon->ses->capabilities & CAP_UNIX) &&
-                       (oplock & CIFS_CREATE_ACTION))
-                       if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
+                       (oplock & CIFS_CREATE_ACTION)) {
+                       mode &= ~current->fs->umask;
+                       if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
                                CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode,
                                        (__u64)current->fsuid,
                                        (__u64)current->fsgid,
                                        0 /* dev */,
-                                       cifs_sb->local_nls, 
-                                       cifs_sb->mnt_cifs_flags & 
+                                       cifs_sb->local_nls,
+                                       cifs_sb->mnt_cifs_flags &
                                                CIFS_MOUNT_MAP_SPECIAL_CHR);
                        } else {
                                CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode,
@@ -221,26 +224,28 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
                                        (__u64)-1,
                                        0 /* dev */,
                                        cifs_sb->local_nls,
-                                       cifs_sb->mnt_cifs_flags & 
+                                       cifs_sb->mnt_cifs_flags &
                                                CIFS_MOUNT_MAP_SPECIAL_CHR);
                        }
-               else {
-                       /* BB implement mode setting via Windows security descriptors */
-                       /* eg CIFSSMBWinSetPerms(xid,pTcon,full_path,mode,-1,-1,local_nls);*/
-                       /* could set r/o dos attribute if mode & 0222 == 0 */
+               } else {
+                       /* BB implement mode setting via Windows security
+                          descriptors e.g. */
+                       /* CIFSSMBWinSetPerms(xid,pTcon,path,mode,-1,-1,nls);*/
+
+                       /* Could set r/o dos attribute if mode & 0222 == 0 */
                }
 
        /* BB server might mask mode so we have to query for Unix case*/
                if (pTcon->ses->capabilities & CAP_UNIX)
                        rc = cifs_get_inode_info_unix(&newinode, full_path,
-                                                inode->i_sb,xid);
+                                                inode->i_sb, xid);
                else {
                        rc = cifs_get_inode_info(&newinode, full_path,
-                                                buf, inode->i_sb,xid);
-                       if(newinode) {
+                                                buf, inode->i_sb, xid);
+                       if (newinode) {
                                newinode->i_mode = mode;
-                               if((oplock & CIFS_CREATE_ACTION) &&
-                                 (cifs_sb->mnt_cifs_flags & 
+                               if ((oplock & CIFS_CREATE_ACTION) &&
+                                   (cifs_sb->mnt_cifs_flags &
                                     CIFS_MOUNT_SET_UID)) {
                                        newinode->i_uid = current->fsuid;
                                        newinode->i_gid = current->fsgid;
@@ -259,14 +264,14 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
                                direntry->d_op = &cifs_dentry_ops;
                        d_instantiate(direntry, newinode);
                }
-               if((nd->flags & LOOKUP_OPEN) == FALSE) {
+               if ((nd->flags & LOOKUP_OPEN) == FALSE) {
                        /* mknod case - do not leave file open */
                        CIFSSMBClose(xid, pTcon, fileHandle);
-               } else if(newinode) {
+               } else if (newinode) {
                        pCifsFile =
                           kzalloc(sizeof (struct cifsFileInfo), GFP_KERNEL);
-                       
-                       if(pCifsFile == NULL)
+
+                       if (pCifsFile == NULL)
                                goto cifs_create_out;
                        pCifsFile->netfid = fileHandle;
                        pCifsFile->pid = current->tgid;
@@ -276,33 +281,33 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
                        init_MUTEX(&pCifsFile->fh_sem);
                        mutex_init(&pCifsFile->lock_mutex);
                        INIT_LIST_HEAD(&pCifsFile->llist);
-                       atomic_set(&pCifsFile->wrtPending,0);
+                       atomic_set(&pCifsFile->wrtPending, 0);
 
-                       /* set the following in open now 
+                       /* set the following in open now
                                pCifsFile->pfile = file; */
                        write_lock(&GlobalSMBSeslock);
-                       list_add(&pCifsFile->tlist,&pTcon->openFileList);
+                       list_add(&pCifsFile->tlist, &pTcon->openFileList);
                        pCifsInode = CIFS_I(newinode);
-                       if(pCifsInode) {
+                       if (pCifsInode) {
                                /* if readable file instance put first in list*/
                                if (write_only == TRUE) {
-                                               list_add_tail(&pCifsFile->flist,
+                                       list_add_tail(&pCifsFile->flist,
                                                &pCifsInode->openFileList);
                                } else {
                                        list_add(&pCifsFile->flist,
                                                &pCifsInode->openFileList);
                                }
-                               if((oplock & 0xF) == OPLOCK_EXCLUSIVE) {
+                               if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) {
                                        pCifsInode->clientCanCacheAll = TRUE;
                                        pCifsInode->clientCanCacheRead = TRUE;
-                                       cFYI(1,("Exclusive Oplock for inode %p",
+                                       cFYI(1, ("Exclusive Oplock inode %p",
                                                newinode));
-                               } else if((oplock & 0xF) == OPLOCK_READ)
+                               } else if ((oplock & 0xF) == OPLOCK_READ)
                                        pCifsInode->clientCanCacheRead = TRUE;
                        }
                        write_unlock(&GlobalSMBSeslock);
                }
-       } 
+       }
 cifs_create_out:
        kfree(buf);
        kfree(full_path);
@@ -310,8 +315,8 @@ cifs_create_out:
        return rc;
 }
 
-int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode, 
-               dev_t device_number) 
+int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode,
+               dev_t device_number)
 {
        int rc = -EPERM;
        int xid;
@@ -329,43 +334,45 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode,
        pTcon = cifs_sb->tcon;
 
        full_path = build_path_from_dentry(direntry);
-       if(full_path == NULL)
+       if (full_path == NULL)
                rc = -ENOMEM;
        else if (pTcon->ses->capabilities & CAP_UNIX) {
-               if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
+               mode &= ~current->fs->umask;
+               if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
                        rc = CIFSSMBUnixSetPerms(xid, pTcon, full_path,
-                               mode,(__u64)current->fsuid,(__u64)current->fsgid,
+                               mode, (__u64)current->fsuid,
+                               (__u64)current->fsgid,
                                device_number, cifs_sb->local_nls,
-                               cifs_sb->mnt_cifs_flags & 
+                               cifs_sb->mnt_cifs_flags &
                                        CIFS_MOUNT_MAP_SPECIAL_CHR);
                } else {
                        rc = CIFSSMBUnixSetPerms(xid, pTcon,
                                full_path, mode, (__u64)-1, (__u64)-1,
                                device_number, cifs_sb->local_nls,
-                               cifs_sb->mnt_cifs_flags & 
+                               cifs_sb->mnt_cifs_flags &
                                        CIFS_MOUNT_MAP_SPECIAL_CHR);
                }
 
-               if(!rc) {
+               if (!rc) {
                        rc = cifs_get_inode_info_unix(&newinode, full_path,
-                                               inode->i_sb,xid);
+                                               inode->i_sb, xid);
                        if (pTcon->nocase)
                                direntry->d_op = &cifs_ci_dentry_ops;
                        else
                                direntry->d_op = &cifs_dentry_ops;
-                       if(rc == 0)
+                       if (rc == 0)
                                d_instantiate(direntry, newinode);
                }
        } else {
-               if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) {
+               if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) {
                        int oplock = 0;
                        u16 fileHandle;
                        FILE_ALL_INFO * buf;
 
-                       cFYI(1,("sfu compat create special file"));
+                       cFYI(1, ("sfu compat create special file"));
 
-                       buf = kmalloc(sizeof(FILE_ALL_INFO),GFP_KERNEL);
-                       if(buf == NULL) {
+                       buf = kmalloc(sizeof(FILE_ALL_INFO), GFP_KERNEL);
+                       if (buf == NULL) {
                                kfree(full_path);
                                FreeXid(xid);
                                return -ENOMEM;
@@ -373,39 +380,38 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode,
 
                        rc = CIFSSMBOpen(xid, pTcon, full_path,
                                         FILE_CREATE, /* fail if exists */
-                                        GENERIC_WRITE /* BB would 
+                                        GENERIC_WRITE /* BB would
                                          WRITE_OWNER | WRITE_DAC be better? */,
                                         /* Create a file and set the
                                            file attribute to SYSTEM */
                                         CREATE_NOT_DIR | CREATE_OPTION_SPECIAL,
                                         &fileHandle, &oplock, buf,
                                         cifs_sb->local_nls,
-                                        cifs_sb->mnt_cifs_flags & 
+                                        cifs_sb->mnt_cifs_flags &
                                            CIFS_MOUNT_MAP_SPECIAL_CHR);
 
                        /* BB FIXME - add handling for backlevel servers
                           which need legacy open and check for all
-                          calls to SMBOpen for fallback to 
-                          SMBLeagcyOpen */
-                       if(!rc) {
+                          calls to SMBOpen for fallback to SMBLeagcyOpen */
+                       if (!rc) {
                                /* BB Do not bother to decode buf since no
                                   local inode yet to put timestamps in,
                                   but we can reuse it safely */
                                int bytes_written;
                                struct win_dev *pdev;
                                pdev = (struct win_dev *)buf;
-                               if(S_ISCHR(mode)) {
+                               if (S_ISCHR(mode)) {
                                        memcpy(pdev->type, "IntxCHR", 8);
                                        pdev->major =
                                              cpu_to_le64(MAJOR(device_number));
-                                       pdev->minor = 
+                                       pdev->minor =
                                              cpu_to_le64(MINOR(device_number));
                                        rc = CIFSSMBWrite(xid, pTcon,
                                                fileHandle,
                                                sizeof(struct win_dev),
                                                0, &bytes_written, (char *)pdev,
                                                NULL, 0);
-                               } else if(S_ISBLK(mode)) {
+                               } else if (S_ISBLK(mode)) {
                                        memcpy(pdev->type, "IntxBLK", 8);
                                        pdev->major =
                                              cpu_to_le64(MAJOR(device_number));
@@ -432,7 +438,8 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode,
 
 
 struct dentry *
-cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, struct nameidata *nd)
+cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
+           struct nameidata *nd)
 {
        int xid;
        int rc = 0; /* to get around spurious gcc warning, set to zero here */
@@ -447,8 +454,6 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, struct name
             (" parent inode = 0x%p name is: %s and dentry = 0x%p",
              parent_dir_inode, direntry->d_name.name, direntry));
 
-       /* BB Add check of incoming data - e.g. frame not longer than maximum SMB - let server check the namelen BB */
-
        /* check whether path exists */
 
        cifs_sb = CIFS_SB(parent_dir_inode->i_sb);
@@ -472,7 +477,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, struct name
        deadlock in the cases (beginning of sys_rename itself)
        in which we already have the sb rename sem */
        full_path = build_path_from_dentry(direntry);
-       if(full_path == NULL) {
+       if (full_path == NULL) {
                FreeXid(xid);
                return ERR_PTR(-ENOMEM);
        }
@@ -487,10 +492,10 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, struct name
 
        if (pTcon->ses->capabilities & CAP_UNIX)
                rc = cifs_get_inode_info_unix(&newInode, full_path,
-                                             parent_dir_inode->i_sb,xid);
+                                             parent_dir_inode->i_sb, xid);
        else
                rc = cifs_get_inode_info(&newInode, full_path, NULL,
-                                        parent_dir_inode->i_sb,xid);
+                                        parent_dir_inode->i_sb, xid);
 
        if ((rc == 0) && (newInode != NULL)) {
                if (pTcon->nocase)
@@ -499,7 +504,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, struct name
                        direntry->d_op = &cifs_dentry_ops;
                d_add(direntry, newInode);
 
-               /* since paths are not looked up by component - the parent 
+               /* since paths are not looked up by component - the parent
                   directories are presumed to be good here */
                renew_parental_timestamps(direntry);
 
@@ -511,13 +516,13 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, struct name
                else
                        direntry->d_op = &cifs_dentry_ops;
                d_add(direntry, NULL);
-       /*      if it was once a directory (but how can we tell?) we could do  
-                       shrink_dcache_parent(direntry); */
+       /*      if it was once a directory (but how can we tell?) we could do
+               shrink_dcache_parent(direntry); */
        } else {
-               cERROR(1,("Error 0x%x on cifs_get_inode_info in lookup of %s",
-                          rc,full_path));
-               /* BB special case check for Access Denied - watch security 
-               exposure of returning dir info implicitly via different rc 
+               cERROR(1, ("Error 0x%x on cifs_get_inode_info in lookup of %s",
+                          rc, full_path));
+               /* BB special case check for Access Denied - watch security
+               exposure of returning dir info implicitly via different rc
                if file exists or not but no access BB */
        }
 
@@ -538,11 +543,11 @@ cifs_d_revalidate(struct dentry *direntry, struct nameidata *nd)
        } else {
                cFYI(1, ("neg dentry 0x%p name = %s",
                         direntry, direntry->d_name.name));
-               if(time_after(jiffies, direntry->d_time + HZ) || 
+               if (time_after(jiffies, direntry->d_time + HZ) ||
                        !lookupCacheEnabled) {
                        d_drop(direntry);
                        isValid = 0;
-               } 
+               }
        }
 
        return isValid;
@@ -559,8 +564,7 @@ cifs_d_revalidate(struct dentry *direntry, struct nameidata *nd)
 
 struct dentry_operations cifs_dentry_ops = {
        .d_revalidate = cifs_d_revalidate,
-/* d_delete:       cifs_d_delete,       *//* not needed except for debugging */
-       /* no need for d_hash, d_compare, d_release, d_iput ... yet. BB confirm this BB */
+/* d_delete:       cifs_d_delete,      */ /* not needed except for debugging */
 };
 
 static int cifs_ci_hash(struct dentry *dentry, struct qstr *q)
index da12b482ebe5364d1bc4e6dba9bba25ffa25e12c..8e375bb4b37994b9a71c0d31df09962fd10f8082 100644 (file)
@@ -2,7 +2,7 @@
  *   fs/cifs/fcntl.c
  *
  *   vfs operations that deal with the file control API
- * 
+ *
  *   Copyright (C) International Business Machines  Corp., 2003,2004
  *   Author(s): Steve French (sfrench@us.ibm.com)
  *
@@ -35,35 +35,34 @@ static __u32 convert_to_cifs_notify_flags(unsigned long fcntl_notify_flags)
 
        /* No way on Linux VFS to ask to monitor xattr
        changes (and no stream support either */
-       if(fcntl_notify_flags & DN_ACCESS) {
+       if (fcntl_notify_flags & DN_ACCESS) {
                cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_LAST_ACCESS;
        }
-       if(fcntl_notify_flags & DN_MODIFY) {
+       if (fcntl_notify_flags & DN_MODIFY) {
                /* What does this mean on directories? */
                cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_LAST_WRITE |
                        FILE_NOTIFY_CHANGE_SIZE;
        }
-       if(fcntl_notify_flags & DN_CREATE) {
-               cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_CREATION | 
+       if (fcntl_notify_flags & DN_CREATE) {
+               cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_CREATION |
                        FILE_NOTIFY_CHANGE_LAST_WRITE;
        }
-       if(fcntl_notify_flags & DN_DELETE) {
+       if (fcntl_notify_flags & DN_DELETE) {
                cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_LAST_WRITE;
        }
-       if(fcntl_notify_flags & DN_RENAME) {
+       if (fcntl_notify_flags & DN_RENAME) {
                /* BB review this - checking various server behaviors */
-               cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_DIR_NAME | 
+               cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_DIR_NAME |
                        FILE_NOTIFY_CHANGE_FILE_NAME;
        }
-       if(fcntl_notify_flags & DN_ATTRIB) {
-               cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_SECURITY | 
+       if (fcntl_notify_flags & DN_ATTRIB) {
+               cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_SECURITY |
                        FILE_NOTIFY_CHANGE_ATTRIBUTES;
        }
-/*     if(fcntl_notify_flags & DN_MULTISHOT) {
+/*     if (fcntl_notify_flags & DN_MULTISHOT) {
                cifs_ntfy_flags |= ;
        } */ /* BB fixme - not sure how to handle this with CIFS yet */
 
-
        return cifs_ntfy_flags;
 }
 
@@ -78,8 +77,7 @@ int cifs_dir_notify(struct file * file, unsigned long arg)
        __u32 filter = FILE_NOTIFY_CHANGE_NAME | FILE_NOTIFY_CHANGE_ATTRIBUTES;
        __u16 netfid;
 
-
-       if(experimEnabled == 0)
+       if (experimEnabled == 0)
                return 0;
 
        xid = GetXid();
@@ -88,21 +86,21 @@ int cifs_dir_notify(struct file * file, unsigned long arg)
 
        full_path = build_path_from_dentry(file->f_path.dentry);
 
-       if(full_path == NULL) {
+       if (full_path == NULL) {
                rc = -ENOMEM;
        } else {
-               cFYI(1,("dir notify on file %s Arg 0x%lx",full_path,arg));
-               rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN, 
+               cFYI(1, ("dir notify on file %s Arg 0x%lx", full_path, arg));
+               rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN,
                        GENERIC_READ | SYNCHRONIZE, 0 /* create options */,
-                       &netfid, &oplock,NULL, cifs_sb->local_nls,
+                       &netfid, &oplock, NULL, cifs_sb->local_nls,
                        cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
                /* BB fixme - add this handle to a notify handle list */
-               if(rc) {
-                       cFYI(1,("Could not open directory for notify"));
+               if (rc) {
+                       cFYI(1, ("Could not open directory for notify"));
                } else {
                        filter = convert_to_cifs_notify_flags(arg);
-                       if(filter != 0) {
-                               rc = CIFSSMBNotify(xid, pTcon, 
+                       if (filter != 0) {
+                               rc = CIFSSMBNotify(xid, pTcon,
                                        0 /* no subdirs */, netfid,
                                        filter, file, arg & DN_MULTISHOT,
                                        cifs_sb->local_nls);
@@ -113,10 +111,10 @@ int cifs_dir_notify(struct file * file, unsigned long arg)
                        it would close automatically but may be a way
                        to do it easily when inode freed or when
                        notify info is cleared/changed */
-                       cFYI(1,("notify rc %d",rc));
+                       cFYI(1, ("notify rc %d", rc));
                }
        }
-       
+
        FreeXid(xid);
        return rc;
 }
index 3e87dad3367c731c626ac951e764fb5277b170e6..f0ff12b3f398fcd09bae2f39934263b803bdb1e1 100644 (file)
@@ -986,7 +986,8 @@ mkdir_get_info:
                  * failed to get it from the server or was set bogus */ 
                if ((direntry->d_inode) && (direntry->d_inode->i_nlink < 2))
                                direntry->d_inode->i_nlink = 2; 
-               if (cifs_sb->tcon->ses->capabilities & CAP_UNIX)
+               if (cifs_sb->tcon->ses->capabilities & CAP_UNIX) {
+                       mode &= ~current->fs->umask;
                        if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
                                CIFSSMBUnixSetPerms(xid, pTcon, full_path,
                                                    mode,
@@ -1004,7 +1005,7 @@ mkdir_get_info:
                                                    cifs_sb->mnt_cifs_flags & 
                                                    CIFS_MOUNT_MAP_SPECIAL_CHR);
                        }
-               else {
+               else {
                        /* BB to be implemented via Windows secrty descriptors
                           eg CIFSSMBWinSetPerms(xid, pTcon, full_path, mode,
                                                 -1, -1, local_nls); */
index e34c7db00f6feccaba099b9604352e7745322a03..a414f1775ae05185d07f320525dd0a8513b2e769 100644 (file)
@@ -30,7 +30,7 @@
 
 #define CIFS_IOC_CHECKUMOUNT _IO(0xCF, 2)
 
-int cifs_ioctl (struct inode * inode, struct file * filep, 
+int cifs_ioctl (struct inode * inode, struct file * filep,
                unsigned int command, unsigned long arg)
 {
        int rc = -ENOTTY; /* strange error - but the precedent */
@@ -47,13 +47,13 @@ int cifs_ioctl (struct inode * inode, struct file * filep,
 
        xid = GetXid();
 
-        cFYI(1,("ioctl file %p  cmd %u  arg %lu",filep,command,arg));
+       cFYI(1, ("ioctl file %p  cmd %u  arg %lu", filep, command, arg));
 
        cifs_sb = CIFS_SB(inode->i_sb);
 
 #ifdef CONFIG_CIFS_POSIX
        tcon = cifs_sb->tcon;
-       if(tcon)
+       if (tcon)
                caps = le64_to_cpu(tcon->fsUnixInfo.Capability);
        else {
                rc = -EIO;
@@ -62,24 +62,24 @@ int cifs_ioctl (struct inode * inode, struct file * filep,
        }
 #endif /* CONFIG_CIFS_POSIX */
 
-       switch(command) {
+       switch (command) {
                case CIFS_IOC_CHECKUMOUNT:
-                       cFYI(1,("User unmount attempted"));
-                       if(cifs_sb->mnt_uid == current->uid)
+                       cFYI(1, ("User unmount attempted"));
+                       if (cifs_sb->mnt_uid == current->uid)
                                rc = 0;
                        else {
                                rc = -EACCES;
-                               cFYI(1,("uids do not match"));
+                               cFYI(1, ("uids do not match"));
                        }
                        break;
 #ifdef CONFIG_CIFS_POSIX
                case FS_IOC_GETFLAGS:
-                       if(CIFS_UNIX_EXTATTR_CAP & caps) {
+                       if (CIFS_UNIX_EXTATTR_CAP & caps) {
                                if (pSMBFile == NULL)
                                        break;
                                rc = CIFSGetExtAttr(xid, tcon, pSMBFile->netfid,
                                        &ExtAttrBits, &ExtAttrMask);
-                               if(rc == 0)
+                               if (rc == 0)
                                        rc = put_user(ExtAttrBits &
                                                FS_FL_USER_VISIBLE,
                                                (int __user *)arg);
@@ -87,8 +87,8 @@ int cifs_ioctl (struct inode * inode, struct file * filep,
                        break;
 
                case FS_IOC_SETFLAGS:
-                       if(CIFS_UNIX_EXTATTR_CAP & caps) {
-                               if(get_user(ExtAttrBits,(int __user *)arg)) {
+                       if (CIFS_UNIX_EXTATTR_CAP & caps) {
+                               if (get_user(ExtAttrBits, (int __user *)arg)) {
                                        rc = -EFAULT;
                                        break;
                                }
@@ -96,16 +96,15 @@ int cifs_ioctl (struct inode * inode, struct file * filep,
                                        break;
                                /* rc= CIFSGetExtAttr(xid,tcon,pSMBFile->netfid,
                                        extAttrBits, &ExtAttrMask);*/
-                               
                        }
-                       cFYI(1,("set flags not implemented yet"));
+                       cFYI(1, ("set flags not implemented yet"));
                        break;
 #endif /* CONFIG_CIFS_POSIX */
                default:
-                       cFYI(1,("unsupported ioctl"));
+                       cFYI(1, ("unsupported ioctl"));
                        break;
        }
 
        FreeXid(xid);
        return rc;
-} 
+}
index aede606132aaa091028aa515b60f5addc6911a69..8b69fcceb597d59398760980a06c93096d2fcaf3 100644 (file)
@@ -18,7 +18,7 @@
  *
  *   You should have received a copy of the GNU Lesser General Public License
  *   along with this library; if not, write to the Free Software
- *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
 /* NB: unlike smb/cifs packets, the RFC1002 structures are big endian */
index 9804c0cdcb4200020398a1e87efb715cec697bec..cc5efc13496ab5eb431a3aafa4f91d7df5842eb2 100644 (file)
@@ -655,10 +655,9 @@ static int fuse_get_sb_blk(struct file_system_type *fs_type,
 static struct file_system_type fuseblk_fs_type = {
        .owner          = THIS_MODULE,
        .name           = "fuseblk",
-       .fs_flags       = FS_HAS_SUBTYPE,
        .get_sb         = fuse_get_sb_blk,
        .kill_sb        = kill_block_super,
-       .fs_flags       = FS_REQUIRES_DEV,
+       .fs_flags       = FS_REQUIRES_DEV | FS_HAS_SUBTYPE,
 };
 
 static inline int register_fuseblk(void)
index aa083dd34e924199816587d57861d48dfa84dbfe..e6b46b3ac2fe6b6402502b0f0bda2c84400ceb94 100644 (file)
@@ -736,15 +736,13 @@ static int can_do_hugetlb_shm(void)
                        can_do_mlock());
 }
 
-struct file *hugetlb_zero_setup(size_t size)
+struct file *hugetlb_file_setup(const char *name, size_t size)
 {
        int error = -ENOMEM;
        struct file *file;
        struct inode *inode;
        struct dentry *dentry, *root;
        struct qstr quick_string;
-       char buf[16];
-       static atomic_t counter;
 
        if (!hugetlbfs_vfsmount)
                return ERR_PTR(-ENOENT);
@@ -756,8 +754,7 @@ struct file *hugetlb_zero_setup(size_t size)
                return ERR_PTR(-ENOMEM);
 
        root = hugetlbfs_vfsmount->mnt_root;
-       snprintf(buf, 16, "%u", atomic_inc_return(&counter));
-       quick_string.name = buf;
+       quick_string.name = name;
        quick_string.len = strlen(quick_string.name);
        quick_string.hash = 0;
        dentry = d_alloc(root, &quick_string);
index 0023b31e48a896502fa18ff11764e82def0e9ba3..a480b09c79b916de88252129919bedbbfb10850a 100644 (file)
@@ -798,6 +798,11 @@ int ocfs2_map_and_write_splice_data(struct inode *inode,
        }
        to = from + bytes;
 
+       BUG_ON(from > PAGE_CACHE_SIZE);
+       BUG_ON(to > PAGE_CACHE_SIZE);
+       BUG_ON(from < cluster_start);
+       BUG_ON(to > cluster_end);
+
        if (wc->w_this_page_new)
                ret = ocfs2_map_page_blocks(wc->w_this_page, p_blkno, inode,
                                            cluster_start, cluster_end, 1);
@@ -809,11 +814,6 @@ int ocfs2_map_and_write_splice_data(struct inode *inode,
                goto out;
        }
 
-       BUG_ON(from > PAGE_CACHE_SIZE);
-       BUG_ON(to > PAGE_CACHE_SIZE);
-       BUG_ON(from > osb->s_clustersize);
-       BUG_ON(to > osb->s_clustersize);
-
        src = buf->ops->map(sp->s_pipe, buf, 1);
        dst = kmap_atomic(wc->w_this_page, KM_USER1);
        memcpy(dst + from, src + src_from, bytes);
@@ -890,6 +890,11 @@ int ocfs2_map_and_write_user_data(struct inode *inode,
 
        to = from + bytes;
 
+       BUG_ON(from > PAGE_CACHE_SIZE);
+       BUG_ON(to > PAGE_CACHE_SIZE);
+       BUG_ON(from < cluster_start);
+       BUG_ON(to > cluster_end);
+
        if (wc->w_this_page_new)
                ret = ocfs2_map_page_blocks(wc->w_this_page, p_blkno, inode,
                                            cluster_start, cluster_end, 1);
@@ -901,11 +906,6 @@ int ocfs2_map_and_write_user_data(struct inode *inode,
                goto out;
        }
 
-       BUG_ON(from > PAGE_CACHE_SIZE);
-       BUG_ON(to > PAGE_CACHE_SIZE);
-       BUG_ON(from > osb->s_clustersize);
-       BUG_ON(to > osb->s_clustersize);
-
        dst = kmap(wc->w_this_page);
        memcpy(dst + from, bp->b_src_buf + src_from, bytes);
        kunmap(wc->w_this_page);
index a93620ce4aca80e7444ca01cffd24ee45b16b359..2b205f5d5790e73d281f6fbf7e298d2f7dc3b782 100644 (file)
@@ -144,8 +144,7 @@ static struct kobj_type mlog_ktype = {
 };
 
 static struct kset mlog_kset = {
-       .kobj  = {.name = "logmask"},
-       .ktype = &mlog_ktype
+       .kobj   = {.name = "logmask", .ktype = &mlog_ktype},
 };
 
 int mlog_sys_init(struct kset *o2cb_subsys)
index 9345a46ffb325f3dda57a0aeb048e3428475ad0c..5d258c40a2fd9c59fead95c4d3d84d7a4092bce3 100644 (file)
@@ -195,6 +195,11 @@ static int ramfs_nommu_setattr(struct dentry *dentry, struct iattr *ia)
        unsigned int old_ia_valid = ia->ia_valid;
        int ret = 0;
 
+       /* POSIX UID/GID verification for setting inode attributes */
+       ret = inode_change_ok(inode, ia);
+       if (ret)
+               return ret;
+
        /* by providing our own setattr() method, we skip this quotaism */
        if ((old_ia_valid & ATTR_UID && ia->ia_uid != inode->i_uid) ||
            (old_ia_valid & ATTR_GID && ia->ia_gid != inode->i_gid))
index 12f28281d2b1e1f8d1627995f03efcfeb25a4945..e7d7080de2f9799860a475a4df50a7742561d09f 100644 (file)
@@ -176,6 +176,7 @@ static const struct pipe_buf_operations user_page_pipe_buf_ops = {
 static ssize_t splice_to_pipe(struct pipe_inode_info *pipe,
                              struct splice_pipe_desc *spd)
 {
+       unsigned int spd_pages = spd->nr_pages;
        int ret, do_wakeup, page_nr;
 
        ret = 0;
@@ -244,17 +245,18 @@ static ssize_t splice_to_pipe(struct pipe_inode_info *pipe,
                pipe->waiting_writers--;
        }
 
-       if (pipe->inode)
+       if (pipe->inode) {
                mutex_unlock(&pipe->inode->i_mutex);
 
-       if (do_wakeup) {
-               smp_mb();
-               if (waitqueue_active(&pipe->wait))
-                       wake_up_interruptible(&pipe->wait);
-               kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
+               if (do_wakeup) {
+                       smp_mb();
+                       if (waitqueue_active(&pipe->wait))
+                               wake_up_interruptible(&pipe->wait);
+                       kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
+               }
        }
 
-       while (page_nr < spd->nr_pages)
+       while (page_nr < spd_pages)
                page_cache_release(spd->pages[page_nr++]);
 
        return ret;
@@ -272,7 +274,6 @@ __generic_file_splice_read(struct file *in, loff_t *ppos,
        struct page *page;
        pgoff_t index, end_index;
        loff_t isize;
-       size_t total_len;
        int error, page_nr;
        struct splice_pipe_desc spd = {
                .pages = pages,
@@ -298,7 +299,6 @@ __generic_file_splice_read(struct file *in, loff_t *ppos,
         * Now fill in the holes:
         */
        error = 0;
-       total_len = 0;
 
        /*
         * Lookup the (hopefully) full range of pages we need.
@@ -415,43 +415,47 @@ __generic_file_splice_read(struct file *in, loff_t *ppos,
 
                                break;
                        }
+               }
+fill_it:
+               /*
+                * i_size must be checked after PageUptodate.
+                */
+               isize = i_size_read(mapping->host);
+               end_index = (isize - 1) >> PAGE_CACHE_SHIFT;
+               if (unlikely(!isize || index > end_index))
+                       break;
+
+               /*
+                * if this is the last page, see if we need to shrink
+                * the length and stop
+                */
+               if (end_index == index) {
+                       unsigned int plen;
 
                        /*
-                        * i_size must be checked after ->readpage().
+                        * max good bytes in this page
                         */
-                       isize = i_size_read(mapping->host);
-                       end_index = (isize - 1) >> PAGE_CACHE_SHIFT;
-                       if (unlikely(!isize || index > end_index))
+                       plen = ((isize - 1) & ~PAGE_CACHE_MASK) + 1;
+                       if (plen <= loff)
                                break;
 
                        /*
-                        * if this is the last page, see if we need to shrink
-                        * the length and stop
+                        * force quit after adding this page
                         */
-                       if (end_index == index) {
-                               loff = PAGE_CACHE_SIZE - (isize & ~PAGE_CACHE_MASK);
-                               if (total_len + loff > isize)
-                                       break;
-                               /*
-                                * force quit after adding this page
-                                */
-                               len = this_len;
-                               this_len = min(this_len, loff);
-                               loff = 0;
-                       }
+                       this_len = min(this_len, plen - loff);
+                       len = this_len;
                }
-fill_it:
+
                partial[page_nr].offset = loff;
                partial[page_nr].len = this_len;
                len -= this_len;
-               total_len += this_len;
                loff = 0;
                spd.nr_pages++;
                index++;
        }
 
        /*
-        * Release any pages at the end, if we quit early. 'i' is how far
+        * Release any pages at the end, if we quit early. 'page_nr' is how far
         * we got, 'nr_pages' is how many pages are in the map.
         */
        while (page_nr < nr_pages)
@@ -478,10 +482,18 @@ ssize_t generic_file_splice_read(struct file *in, loff_t *ppos,
 {
        ssize_t spliced;
        int ret;
+       loff_t isize, left;
+
+       isize = i_size_read(in->f_mapping->host);
+       if (unlikely(*ppos >= isize))
+               return 0;
+
+       left = isize - *ppos;
+       if (unlikely(left < len))
+               len = left;
 
        ret = 0;
        spliced = 0;
-
        while (len) {
                ret = __generic_file_splice_read(in, ppos, pipe, len, flags);
 
@@ -644,7 +656,6 @@ find_page:
         * accessed, we are now done!
         */
        mark_page_accessed(page);
-       balance_dirty_pages_ratelimited(mapping);
 out:
        page_cache_release(page);
        unlock_page(page);
@@ -802,7 +813,10 @@ generic_file_splice_write_nolock(struct pipe_inode_info *pipe, struct file *out,
 
        ret = __splice_from_pipe(pipe, out, ppos, len, flags, pipe_to_file);
        if (ret > 0) {
+               unsigned long nr_pages;
+
                *ppos += ret;
+               nr_pages = (ret + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
 
                /*
                 * If file or inode is SYNC and we actually wrote some data,
@@ -815,6 +829,7 @@ generic_file_splice_write_nolock(struct pipe_inode_info *pipe, struct file *out,
                        if (err)
                                ret = err;
                }
+               balance_dirty_pages_ratelimited_nr(mapping, nr_pages);
        }
 
        return ret;
@@ -853,7 +868,10 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out,
 
        ret = splice_from_pipe(pipe, out, ppos, len, flags, pipe_to_file);
        if (ret > 0) {
+               unsigned long nr_pages;
+
                *ppos += ret;
+               nr_pages = (ret + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
 
                /*
                 * If file or inode is SYNC and we actually wrote some data,
@@ -868,6 +886,7 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out,
                        if (err)
                                ret = err;
                }
+               balance_dirty_pages_ratelimited_nr(mapping, nr_pages);
        }
 
        return ret;
@@ -922,7 +941,6 @@ static long do_splice_to(struct file *in, loff_t *ppos,
                         struct pipe_inode_info *pipe, size_t len,
                         unsigned int flags)
 {
-       loff_t isize, left;
        int ret;
 
        if (unlikely(!in->f_op || !in->f_op->splice_read))
@@ -935,14 +953,6 @@ static long do_splice_to(struct file *in, loff_t *ppos,
        if (unlikely(ret < 0))
                return ret;
 
-       isize = i_size_read(in->f_mapping->host);
-       if (unlikely(*ppos >= isize))
-               return 0;
-       
-       left = isize - *ppos;
-       if (unlikely(left < len))
-               len = left;
-
        return in->f_op->splice_read(in, ppos, pipe, len, flags);
 }
 
@@ -1058,8 +1068,6 @@ out_release:
        return ret;
 }
 
-EXPORT_SYMBOL(do_splice_direct);
-
 /*
  * After the inode slimming patch, i_pipe/i_bdev/i_cdev share the same
  * location, so checking ->i_pipe is not enough to verify that this is a
index 85a668680f82af4e550b3b381cf7340419eb7d86..c4342a0199727b19fe832c4eaff371c0c8e1b9ee 100644 (file)
 #include "sysfs.h"
 
 DECLARE_RWSEM(sysfs_rename_sem);
+spinlock_t sysfs_lock = SPIN_LOCK_UNLOCKED;
 
 static void sysfs_d_iput(struct dentry * dentry, struct inode * inode)
 {
        struct sysfs_dirent * sd = dentry->d_fsdata;
 
        if (sd) {
-               BUG_ON(sd->s_dentry != dentry);
-               sd->s_dentry = NULL;
+               /* sd->s_dentry is protected with sysfs_lock.  This
+                * allows sysfs_drop_dentry() to dereference it.
+                */
+               spin_lock(&sysfs_lock);
+
+               /* The dentry might have been deleted or another
+                * lookup could have happened updating sd->s_dentry to
+                * point the new dentry.  Ignore if it isn't pointing
+                * to this dentry.
+                */
+               if (sd->s_dentry == dentry)
+                       sd->s_dentry = NULL;
+               spin_unlock(&sysfs_lock);
                sysfs_put(sd);
        }
        iput(inode);
@@ -30,6 +42,14 @@ static struct dentry_operations sysfs_dentry_ops = {
        .d_iput         = sysfs_d_iput,
 };
 
+static unsigned int sysfs_inode_counter;
+ino_t sysfs_get_inum(void)
+{
+       if (unlikely(sysfs_inode_counter < 3))
+               sysfs_inode_counter = 3;
+       return sysfs_inode_counter++;
+}
+
 /*
  * Allocates a new sysfs_dirent and links it to the parent sysfs_dirent
  */
@@ -41,6 +61,7 @@ static struct sysfs_dirent * __sysfs_new_dirent(void * element)
        if (!sd)
                return NULL;
 
+       sd->s_ino = sysfs_get_inum();
        atomic_set(&sd->s_count, 1);
        atomic_set(&sd->s_event, 1);
        INIT_LIST_HEAD(&sd->s_children);
@@ -238,7 +259,10 @@ static int sysfs_attach_attr(struct sysfs_dirent * sd, struct dentry * dentry)
         }
 
        dentry->d_fsdata = sysfs_get(sd);
+       /* protect sd->s_dentry against sysfs_d_iput */
+       spin_lock(&sysfs_lock);
        sd->s_dentry = dentry;
+       spin_unlock(&sysfs_lock);
        error = sysfs_create(dentry, (attr->mode & S_IALLUGO) | S_IFREG, init);
        if (error) {
                sysfs_put(sd);
@@ -260,7 +284,10 @@ static int sysfs_attach_link(struct sysfs_dirent * sd, struct dentry * dentry)
        int err = 0;
 
        dentry->d_fsdata = sysfs_get(sd);
+       /* protect sd->s_dentry against sysfs_d_iput */
+       spin_lock(&sysfs_lock);
        sd->s_dentry = dentry;
+       spin_unlock(&sysfs_lock);
        err = sysfs_create(dentry, S_IFLNK|S_IRWXUGO, init_symlink);
        if (!err) {
                dentry->d_op = &sysfs_dentry_ops;
@@ -509,7 +536,7 @@ static int sysfs_readdir(struct file * filp, void * dirent, filldir_t filldir)
 
        switch (i) {
                case 0:
-                       ino = dentry->d_inode->i_ino;
+                       ino = parent_sd->s_ino;
                        if (filldir(dirent, ".", 1, i, ino, DT_DIR) < 0)
                                break;
                        filp->f_pos++;
@@ -538,10 +565,7 @@ static int sysfs_readdir(struct file * filp, void * dirent, filldir_t filldir)
 
                                name = sysfs_get_name(next);
                                len = strlen(name);
-                               if (next->s_dentry)
-                                       ino = next->s_dentry->d_inode->i_ino;
-                               else
-                                       ino = iunique(sysfs_sb, 2);
+                               ino = next->s_ino;
 
                                if (filldir(dirent, name, len, filp->f_pos, ino,
                                                 dt_type(next)) < 0)
index bdd30e74de6b00c16685e98745d2fe96325c483b..5266eec15f6e35766c84939f1c7663690d6c3930 100644 (file)
@@ -141,6 +141,7 @@ struct inode * sysfs_new_inode(mode_t mode, struct sysfs_dirent * sd)
                inode->i_mapping->a_ops = &sysfs_aops;
                inode->i_mapping->backing_dev_info = &sysfs_backing_dev_info;
                inode->i_op = &sysfs_inode_operations;
+               inode->i_ino = sd->s_ino;
                lockdep_set_class(&inode->i_mutex, &sysfs_inode_imutex_key);
 
                if (sd->s_iattr) {
@@ -245,13 +246,27 @@ static inline void orphan_all_buffers(struct inode *node)
  */
 void sysfs_drop_dentry(struct sysfs_dirent * sd, struct dentry * parent)
 {
-       struct dentry * dentry = sd->s_dentry;
+       struct dentry *dentry = NULL;
        struct inode *inode;
 
+       /* We're not holding a reference to ->s_dentry dentry but the
+        * field will stay valid as long as sysfs_lock is held.
+        */
+       spin_lock(&sysfs_lock);
+       spin_lock(&dcache_lock);
+
+       /* dget dentry if it's still alive */
+       if (sd->s_dentry && sd->s_dentry->d_inode)
+               dentry = dget_locked(sd->s_dentry);
+
+       spin_unlock(&dcache_lock);
+       spin_unlock(&sysfs_lock);
+
+       /* drop dentry */
        if (dentry) {
                spin_lock(&dcache_lock);
                spin_lock(&dentry->d_lock);
-               if (!(d_unhashed(dentry) && dentry->d_inode)) {
+               if (!d_unhashed(dentry) && dentry->d_inode) {
                        inode = dentry->d_inode;
                        spin_lock(&inode->i_lock);
                        __iget(inode);
@@ -267,6 +282,8 @@ void sysfs_drop_dentry(struct sysfs_dirent * sd, struct dentry * parent)
                        spin_unlock(&dentry->d_lock);
                        spin_unlock(&dcache_lock);
                }
+
+               dput(dentry);
        }
 }
 
index 23a48a38e6af01455575083f8242ef4538f76cac..00ab9125d398984efa12496fa3b48ff405f62bad 100644 (file)
@@ -33,6 +33,7 @@ static struct sysfs_dirent sysfs_root = {
        .s_element      = NULL,
        .s_type         = SYSFS_ROOT,
        .s_iattr        = NULL,
+       .s_ino          = 1,
 };
 
 static void sysfs_clear_inode(struct inode *inode)
index a77c57e5a6d5d983116203656559911142251c87..502c949c402d9dd3de49ac922d9f1e1db2543e2a 100644 (file)
@@ -5,6 +5,7 @@ struct sysfs_dirent {
        void                    * s_element;
        int                     s_type;
        umode_t                 s_mode;
+       ino_t                   s_ino;
        struct dentry           * s_dentry;
        struct iattr            * s_iattr;
        atomic_t                s_event;
@@ -32,6 +33,7 @@ extern const unsigned char * sysfs_get_name(struct sysfs_dirent *sd);
 extern void sysfs_drop_dentry(struct sysfs_dirent *sd, struct dentry *parent);
 extern int sysfs_setattr(struct dentry *dentry, struct iattr *iattr);
 
+extern spinlock_t sysfs_lock;
 extern struct rw_semaphore sysfs_rename_sem;
 extern struct super_block * sysfs_sb;
 extern const struct file_operations sysfs_dir_operations;
index 1f0129405cf47e636220a59ccd1e4f040940057d..bf7de0bdbab3b6554cbf7ba3eb20dc8ad92a7183 100644 (file)
@@ -100,14 +100,23 @@ no_delete:
        clear_inode(inode);
 }
 
+/*
+ * If we are going to release inode from memory, we discard preallocation and
+ * truncate last inode extent to proper length. We could use drop_inode() but
+ * it's called under inode_lock and thus we cannot mark inode dirty there.  We
+ * use clear_inode() but we have to make sure to write inode as it's not written
+ * automatically.
+ */
 void udf_clear_inode(struct inode *inode)
 {
        if (!(inode->i_sb->s_flags & MS_RDONLY)) {
                lock_kernel();
+               /* Discard preallocation for directories, symlinks, etc. */
                udf_discard_prealloc(inode);
+               udf_truncate_tail_extent(inode);
                unlock_kernel();
+               write_inode_now(inode, 1);
        }
-
        kfree(UDF_I_DATA(inode));
        UDF_I_DATA(inode) = NULL;
 }
index 77975ae291a55410c72db68025add299aa0c06f5..60d277644248617aee14d98ddff62cf0e11c8f6a 100644 (file)
@@ -61,7 +61,11 @@ static void extent_trunc(struct inode * inode, struct extent_position *epos,
        }
 }
 
-void udf_discard_prealloc(struct inode * inode)
+/*
+ * Truncate the last extent to match i_size. This function assumes
+ * that preallocation extent is already truncated.
+ */
+void udf_truncate_tail_extent(struct inode *inode)
 {
        struct extent_position epos = { NULL, 0, {0, 0}};
        kernel_lb_addr eloc;
@@ -71,7 +75,10 @@ void udf_discard_prealloc(struct inode * inode)
        int adsize;
 
        if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB ||
-               inode->i_size == UDF_I_LENEXTENTS(inode))
+           inode->i_size == UDF_I_LENEXTENTS(inode))
+               return;
+       /* Are we going to delete the file anyway? */
+       if (inode->i_nlink == 0)
                return;
 
        if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_SHORT)
@@ -79,36 +86,76 @@ void udf_discard_prealloc(struct inode * inode)
        else if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_LONG)
                adsize = sizeof(long_ad);
        else
-               adsize = 0;
-
-       epos.block = UDF_I_LOCATION(inode);
+               BUG();
 
        /* Find the last extent in the file */
        while ((netype = udf_next_aext(inode, &epos, &eloc, &elen, 1)) != -1)
        {
                etype = netype;
                lbcount += elen;
-               if (lbcount > inode->i_size && lbcount - elen < inode->i_size)
-               {
-                       WARN_ON(lbcount - inode->i_size >= inode->i_sb->s_blocksize);
+               if (lbcount > inode->i_size) {
+                       if (lbcount - inode->i_size >= inode->i_sb->s_blocksize)
+                               printk(KERN_WARNING
+                                      "udf_truncate_tail_extent(): Too long "
+                                      "extent after EOF in inode %u: i_size: "
+                                      "%Ld lbcount: %Ld extent %u+%u\n",
+                                      (unsigned)inode->i_ino,
+                                      (long long)inode->i_size,
+                                      (long long)lbcount,
+                                      (unsigned)eloc.logicalBlockNum,
+                                      (unsigned)elen);
                        nelen = elen - (lbcount - inode->i_size);
                        epos.offset -= adsize;
                        extent_trunc(inode, &epos, eloc, etype, elen, nelen);
                        epos.offset += adsize;
-                       lbcount = inode->i_size;
+                       if (udf_next_aext(inode, &epos, &eloc, &elen, 1) != -1)
+                               printk(KERN_ERR "udf_truncate_tail_extent(): "
+                                      "Extent after EOF in inode %u.\n",
+                                      (unsigned)inode->i_ino);
+                       break;
                }
        }
+       /* This inode entry is in-memory only and thus we don't have to mark
+        * the inode dirty */
+       UDF_I_LENEXTENTS(inode) = inode->i_size;
+       brelse(epos.bh);
+}
+
+void udf_discard_prealloc(struct inode *inode)
+{
+       struct extent_position epos = { NULL, 0, {0, 0}};
+       kernel_lb_addr eloc;
+       uint32_t elen;
+       uint64_t lbcount = 0;
+       int8_t etype = -1, netype;
+       int adsize;
+
+       if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB ||
+               inode->i_size == UDF_I_LENEXTENTS(inode))
+               return;
+
+       if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_SHORT)
+               adsize = sizeof(short_ad);
+       else if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_LONG)
+               adsize = sizeof(long_ad);
+       else
+               adsize = 0;
+
+       epos.block = UDF_I_LOCATION(inode);
+
+       /* Find the last extent in the file */
+       while ((netype = udf_next_aext(inode, &epos, &eloc, &elen, 1)) != -1) {
+               etype = netype;
+               lbcount += elen;
+       }
        if (etype == (EXT_NOT_RECORDED_ALLOCATED >> 30)) {
                epos.offset -= adsize;
                lbcount -= elen;
                extent_trunc(inode, &epos, eloc, etype, elen, 0);
-               if (!epos.bh)
-               {
+               if (!epos.bh) {
                        UDF_I_LENALLOC(inode) = epos.offset - udf_file_entry_alloc_offset(inode);
                        mark_inode_dirty(inode);
-               }
-               else
-               {
+               } else {
                        struct allocExtDesc *aed = (struct allocExtDesc *)(epos.bh->b_data);
                        aed->lengthAllocDescs = cpu_to_le32(epos.offset - sizeof(struct allocExtDesc));
                        if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || UDF_SB_UDFREV(inode->i_sb) >= 0x0201)
@@ -118,9 +165,9 @@ void udf_discard_prealloc(struct inode * inode)
                        mark_buffer_dirty_inode(epos.bh, inode);
                }
        }
+       /* This inode entry is in-memory only and thus we don't have to mark
+        * the inode dirty */
        UDF_I_LENEXTENTS(inode) = lbcount;
-
-       WARN_ON(lbcount != inode->i_size);
        brelse(epos.bh);
 }
 
index 67ded289497cfc3ba1e88a6f67d86f0fa6685c5d..f581f2f69c0f3f85af7cb14b627d86661c6447f7 100644 (file)
@@ -146,6 +146,7 @@ extern void udf_free_inode(struct inode *);
 extern struct inode * udf_new_inode (struct inode *, int, int *);
 
 /* truncate.c */
+extern void udf_truncate_tail_extent(struct inode *);
 extern void udf_discard_prealloc(struct inode *);
 extern void udf_truncate_extents(struct inode *);
 
index 795fcc266228b93f914a42b9a037fb4bb7046003..01b433de22726baabddcfa1ff461a9718cacf60a 100644 (file)
@@ -14,8 +14,8 @@
 #define AT91_SHDWC_H
 
 #define AT91_SHDW_CR           (AT91_SHDWC + 0x00)     /* Shut Down Control Register */
-#define                AT91_SHDW_SHDW          (1    << 0)             /* Processor Reset */
-#define                AT91_SHDW_KEY           (0xff << 24)            /* KEY Password */
+#define                AT91_SHDW_SHDW          (1    << 0)             /* Shut Down command */
+#define                AT91_SHDW_KEY           (0xa5 << 24)            /* KEY Password */
 
 #define AT91_SHDW_MR           (AT91_SHDWC + 0x04)     /* Shut Down Mode Register */
 #define                AT91_SHDW_WKMODE0       (3 << 0)                /* Wake-up 0 Mode Selection */
index 7251a344c740455a7e627a01e996e89c81b8e5e1..1014e9bf181ff14645d76d2450981a21a349fdba 100644 (file)
@@ -15,7 +15,7 @@
 
 #define AT91_WDT_CR            (AT91_WDT + 0x00)       /* Watchdog Control Register */
 #define                AT91_WDT_WDRSTT         (1    << 0)             /* Restart */
-#define                AT91_WDT_KEY            (0xff << 24)            /* KEY Password */
+#define                AT91_WDT_KEY            (0xa5 << 24)            /* KEY Password */
 
 #define AT91_WDT_MR            (AT91_WDT + 0x04)       /* Watchdog Mode Register */
 #define                AT91_WDT_WDV            (0xfff << 0)            /* Counter Value */
index aeba24347f8e43355619711b3a4f10e4ec0a8c4d..9e99241f3edf41b12c11a7a99a7abda56adde01c 100644 (file)
@@ -45,7 +45,8 @@ static inline int gpio_direction_input(unsigned gpio)
 
 static inline int gpio_direction_output(unsigned gpio, int value)
 {
-       return pxa_gpio_mode(gpio | GPIO_OUT | (value ? 0 : GPIO_DFLT_LOW));
+       return pxa_gpio_mode(gpio | GPIO_OUT |
+                         (value ? GPIO_DFLT_HIGH : GPIO_DFLT_LOW));
 }
 
 static inline int __gpio_get_value(unsigned gpio)
index dcebf6d61903b07686b808eba4e2f97a8d95ffeb..168b93fee529a322641238f0a012d158b580868c 100644 (file)
@@ -18,4 +18,8 @@
 
 #define ANUBIS_CTRL1_NANDSEL           (0x3)
 
+/* IDREG - revision */
+
+#define ANUBIS_IDREG_REVMASK           (0x7)
+
 #endif /* __ASM_ARCH_ANUBISCPLD_H */
index ab076de4a0d01f91a3659289bfb281a544e5952c..830d114261da8745eec077b7cc2235673d21cf3a 100644 (file)
 #define ANUBIS_VA_CTRL1            ANUBIS_IOADDR(0x00000000)    /* 0x01800000 */
 #define ANUBIS_PA_CTRL1            (ANUBIS_PA_CPLD)
 
-#define ANUBIS_VA_CTRL2            ANUBIS_IOADDR(0x00100000)    /* 0x01900000 */
-#define ANUBIS_PA_CTRL2            (ANUBIS_PA_CPLD)
-
-#define ANUBIS_VA_CTRL3            ANUBIS_IOADDR(0x00200000)    /* 0x01A00000 */
-#define ANUBIS_PA_CTRL3            (ANUBIS_PA_CPLD)
-
-#define ANUBIS_VA_CTRL4            ANUBIS_IOADDR(0x00300000)    /* 0x01B00000 */
-#define ANUBIS_PA_CTRL4            (ANUBIS_PA_CPLD)
+#define ANUBIS_VA_IDREG            ANUBIS_IOADDR(0x00300000)    /* 0x01B00000 */
+#define ANUBIS_PA_IDREG            (ANUBIS_PA_CPLD + (3<<23))
 
 #define ANUBIS_IDEPRI      ANUBIS_IOADDR(0x01000000)
 #define ANUBIS_IDEPRIAUX    ANUBIS_IOADDR(0x01100000)
index 3b6498468d621690a4c6d150a3ae5f4ae525c07a..229ab2351db6e1fdf3092efdcfb85ef8d37cbfa8 100644 (file)
@@ -1,6 +1,6 @@
 /* linux/include/asm-arm/arch-s3c2410/osiris-cpld.h
  *
- * Copyright (c) 2005 Simtec Electronics
+ * Copyright 2005 Simtec Electronics
  *     http://www.simtec.co.uk/products/
  *     Ben Dooks <ben@simtec.co.uk>
  *
 #ifndef __ASM_ARCH_OSIRISCPLD_H
 #define __ASM_ARCH_OSIRISCPLD_H
 
-/* CTRL1 - NAND WP control */
+/* CTRL0 - NAND WP control */
 
-#define OSIRIS_CTRL1_NANDSEL           (0x3)
-#define OSIRIS_CTRL1_BOOT_INT          (1<<3)
-#define OSIRIS_CTRL1_PCMCIA            (1<<4)
-#define OSIRIS_CTRL1_PCMCIA_nWAIT      (1<<6)
-#define OSIRIS_CTRL1_PCMCIA_nIOIS16    (1<<7)
+#define OSIRIS_CTRL0_NANDSEL           (0x3)
+#define OSIRIS_CTRL0_BOOT_INT          (1<<3)
+#define OSIRIS_CTRL0_PCMCIA            (1<<4)
+#define OSIRIS_CTRL0_FIX8              (1<<5)
+#define OSIRIS_CTRL0_PCMCIA_nWAIT      (1<<6)
+#define OSIRIS_CTRL0_PCMCIA_nIOIS16    (1<<7)
+
+#define OSIRIS_CTRL1_FIX8              (1<<0)
+
+#define OSIRIS_ID_REVMASK              (0x7)
 
 #endif /* __ASM_ARCH_OSIRISCPLD_H */
index a14164dfa525ae9638f40dedd4bd2cad5a7717bc..b5c74d2b9aaaa84cea710ce784e1b8d1c9fbbc20 100644 (file)
 
 /* we put the CPLD registers next, to get them out of the way */
 
-#define OSIRIS_VA_CTRL1            OSIRIS_IOADDR(0x00000000)
-#define OSIRIS_PA_CTRL1            (OSIRIS_PA_CPLD)
+#define OSIRIS_VA_CTRL0                OSIRIS_IOADDR(0x00000000)
+#define OSIRIS_PA_CTRL0                (OSIRIS_PA_CPLD)
 
-#define OSIRIS_VA_CTRL2            OSIRIS_IOADDR(0x00100000)
-#define OSIRIS_PA_CTRL2            (OSIRIS_PA_CPLD + (1<<23))
+#define OSIRIS_VA_CTRL1                OSIRIS_IOADDR(0x00100000)
+#define OSIRIS_PA_CTRL1                (OSIRIS_PA_CPLD + (1<<23))
 
-#define OSIRIS_VA_CTRL3            OSIRIS_IOADDR(0x00200000)
-#define OSIRIS_PA_CTRL3            (OSIRIS_PA_CPLD + (2<<23))
+#define OSIRIS_VA_CTRL2                OSIRIS_IOADDR(0x00200000)
+#define OSIRIS_PA_CTRL2                (OSIRIS_PA_CPLD + (2<<23))
 
-#define OSIRIS_VA_CTRL4            OSIRIS_IOADDR(0x00300000)
-#define OSIRIS_PA_CTRL4            (OSIRIS_PA_CPLD + (3<<23))
+#define OSIRIS_VA_CTRL3                OSIRIS_IOADDR(0x00300000)
+#define OSIRIS_PA_CTRL3                (OSIRIS_PA_CPLD + (2<<23))
+
+#define OSIRIS_VA_IDREG                OSIRIS_IOADDR(0x00700000)
+#define OSIRIS_PA_IDREG                (OSIRIS_PA_CPLD + (7<<23))
 
 #endif /* __ASM_ARCH_OSIRISMAP_H */
index dbe4b4e31a5b5d39026d955ff34463227fffe3ef..5a25632b1bc079aac63f66af28cb5447b80bf2de 100644 (file)
@@ -4,4 +4,8 @@
 #define __ALIGN .align 0
 #define __ALIGN_STR ".align 0"
 
+#define ENDPROC(name) \
+  .type name, %function; \
+  END(name)
+
 #endif
index 80a21aa9ae77016158e12bad83064ca4a9d2a39f..af7f9535bab32bcaf29a1d253756cfb3f7526142 100644 (file)
@@ -14,6 +14,8 @@ int gpio_direction_output(unsigned int gpio, int value);
 int gpio_get_value(unsigned int gpio);
 void gpio_set_value(unsigned int gpio, int value);
 
+#include <asm-generic/gpio.h>          /* cansleep wrappers */
+
 static inline int gpio_to_irq(unsigned int gpio)
 {
        return gpio + GPIO_IRQ_BASE;
index dabb955f3c00fd167dfca1671ea36f6257ba3371..d3cf35ab11ab127854c90385554f743848bfe371 100644 (file)
@@ -4,6 +4,15 @@
 #define L1_CACHE_SHIFT 5
 #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
 
+/*
+ * Memory returned by kmalloc() may be used for DMA, so we must make
+ * sure that all such allocations are cache aligned. Otherwise,
+ * unrelated code may cause parts of the buffer to be read into the
+ * cache before the transfer is done, causing old data to be seen by
+ * the CPU.
+ */
+#define ARCH_KMALLOC_MINALIGN  L1_CACHE_BYTES
+
 #ifndef __ASSEMBLER__
 struct cache_info {
        unsigned int ways;
index 14e58de7397357bbc7aa6411426e06bd78775298..db3b615ffbab351fce0e377c3ce167b8177d9f07 100644 (file)
@@ -6,7 +6,11 @@
 #ifndef _BLACKFIN_H_
 #define _BLACKFIN_H_
 
-#include <asm/macros.h>
+#define LO(con32) ((con32) & 0xFFFF)
+#define lo(con32) ((con32) & 0xFFFF)
+#define HI(con32) (((con32) >> 16) & 0xFFFF)
+#define hi(con32) (((con32) >> 16) & 0xFFFF)
+
 #include <asm/mach/blackfin.h>
 #include <asm/bfin-global.h>
 
index aa0d5503e232f4512ae26da27518bb93107c8ad8..d98d77ad71f76ac48a1525eeb1f9c668cbb7d6eb 100644 (file)
@@ -332,6 +332,7 @@ struct gpio_port_s {
        unsigned short inen;
 
        unsigned short fer;
+       unsigned short reserved;
 };
 #endif /*CONFIG_PM*/
 
index 76103526aec1c94dfab649f9a03e35f8dfdb0e6c..be1ece8c0c2775c277023ad74c88067054ee830e 100644 (file)
 
 #if defined(ANOMALY_05000198)
 
+#define bfin_read8(addr) ({ unsigned char __v; \
+               __asm__ __volatile__ ("NOP;\n\t" \
+                       "%0 = b[%1] (z);\n\t" \
+                       : "=d"(__v) : "a"(addr)); \
+               __v; })
+
 #define bfin_read16(addr) ({ unsigned __v; \
                        __asm__ __volatile__ ("NOP;\n\t"\
                                                                "%0 = w[%1] (z);\n\t"\
                                             "%0 = [%1];\n\t"\
   : "=d"(__v) : "a"(addr)); __v; })
 
+#define bfin_write8(addr, val) ({ \
+               __asm__ __volatile__ ("NOP;\n\t" \
+                       "b[%0] = %1;\n\t" \
+                       : : "a"(addr), "d"(val) : "memory");})
+
 #define bfin_write16(addr,val) ({\
                       __asm__ __volatile__ ("NOP;\n\t"\
                                             "w[%0] = %1;\n\t"\
 
 #else
 
+#define bfin_read8(addr) ({ unsigned char __v; \
+               __asm__ __volatile__ ( \
+                       "%0 = b[%1] (z);\n\t" \
+                       :"=d"(__v) : "a"(addr)); \
+               __v; })
+
 #define bfin_read16(addr) ({ unsigned __v; \
                        __asm__ __volatile__ (\
                                                                "%0 = w[%1] (z);\n\t"\
                                             "%0 = [%1];\n\t"\
   : "=d"(__v) : "a"(addr)); __v; })
 
+#define bfin_write8(addr, val) ({ \
+               __asm__ __volatile__ ( \
+                       "b[%0] = %1; \n\t" \
+                       ::"a"(addr), "d"(val) : "memory");})
+
 #define bfin_write16(addr,val) ({\
                       __asm__ __volatile__ (\
                                             "w[%0] = %1;\n\t"\
index c0c04a2f2dd5ede7b320ad0e772eb0385a6b96ac..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,95 +0,0 @@
-/************************************************************************
- *
- * macros.h
- *
- * (c) Copyright 2001-2003 Analog Devices, Inc.  All rights reserved.
- *
- ************************************************************************/
-
-/* Defines various assembly macros. */
-
-#ifndef _MACROS_H
-#define _MACROS_H
-
-#define LO(con32) ((con32) & 0xFFFF)
-#define lo(con32) ((con32) & 0xFFFF)
-#define HI(con32) (((con32) >> 16) & 0xFFFF)
-#define hi(con32) (((con32) >> 16) & 0xFFFF)
-
-/*
- * Set the corresponding bits in a System Register (SR);
- * All bits set in "mask" will be set in the system register
- * specified by "sys_reg" bitset_SR(sys_reg, mask), where
- * sys_reg is the system register and mask are the bits to be set.
- */
-#define bitset_SR(sys_reg, mask)\
-               [--SP] = (R7:6);\
-               r7 = sys_reg;\
-               r6.l = (mask) & 0xffff;\
-               r6.h = (mask) >> 16;\
-               r7 = r7 | r6;\
-               sys_reg = r7;\
-               csync;\
-               (R7:6) = [SP++]
-
-/*
- * Clear the corresponding bits in a System Register (SR);
- * All bits set in "mask" will be cleared in the SR
- * specified by "sys_reg" bitclr_SR(sys_reg, mask), where
- * sys_reg is the SR and mask are the bits to be cleared.
- */
-#define bitclr_SR(sys_reg, mask)\
-               [--SP] = (R7:6);\
-               r7 = sys_reg;\
-               r7 =~ r7;\
-               r6.l = (mask) & 0xffff;\
-               r6.h = (mask) >> 16;\
-               r7 = r7 | r6;\
-               r7 =~ r7;\
-               sys_reg = r7;\
-               csync;\
-               (R7:6) = [SP++]
-
-/*
- * Set the corresponding bits in a Memory Mapped Register (MMR);
- * All bits set in "mask" will be set in the MMR specified by "mmr_reg"
- * bitset_MMR(mmr_reg, mask), where mmr_reg is the MMR and mask are
- * the bits to be set.
- */
-#define bitset_MMR(mmr_reg, mask)\
-               [--SP] = (R7:6);\
-               [--SP] = P5;\
-               p5.l = mmr_reg & 0xffff;\
-               p5.h = mmr_reg >> 16;\
-               r7 = [p5];\
-               r6.l = (mask) & 0xffff;\
-               r6.h = (mask) >> 16;\
-               r7 = r7 | r6;\
-               [p5] = r7;\
-               csync;\
-               p5 = [SP++];\
-               (R7:6) = [SP++]
-
-/*
- * Clear the corresponding bits in a Memory Mapped Register (MMR);
- * All bits set in "mask" will be cleared in the MMR specified by "mmr_reg"
- * bitclr_MMRreg(mmr_reg, mask), where sys_reg is the MMR and mask are
- * the bits to be cleared.
- */
-#define bitclr_MMR(mmr_reg, mask)\
-               [--SP] = (R7:6);\
-               [--SP] = P5;\
-               p5.l = mmr_reg & 0xffff;\
-               p5.h = mmr_reg >> 16;\
-               r7 = [p5];\
-               r7 =~ r7;\
-               r6.l = (mask) & 0xffff;\
-               r6.h = (mask) >> 16;\
-               r7 = r7 | r6;\
-               r7 =~ r7;\
-               [p5] = r7;\
-               csync;\
-               p5 = [SP++];\
-               (R7:6) = [SP++]
-
-#endif                         /* _MACROS_H */
index be303b3eef4096e06be42497583fec69ea097e94..6931af525da3201873274337a993d342d2c9b14b 100644 (file)
@@ -12,6 +12,7 @@
 #ifndef _ASM_SYSTEM_H
 #define _ASM_SYSTEM_H
 
+#include <linux/types.h>
 #include <linux/linkage.h>
 
 struct thread_struct;
index dc8f99ee305fc4edd43232abdc0e5564b2c15434..7d7bcf990e9917abf9ab98208417a6d5ef59d017 100644 (file)
@@ -27,13 +27,20 @@ do {                                                                        \
  * Largely same as above, but only sets the access flags (dirty,
  * accessed, and writable). Furthermore, we know it always gets set
  * to a "more permissive" setting, which allows most architectures
- * to optimize this.
+ * to optimize this. We return whether the PTE actually changed, which
+ * in turn instructs the caller to do things like update__mmu_cache.
+ * This used to be done in the caller, but sparc needs minor faults to
+ * force that call on sun4c so we changed this macro slightly
  */
 #define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
-do {                                                                     \
-       set_pte_at((__vma)->vm_mm, (__address), __ptep, __entry);         \
-       flush_tlb_page(__vma, __address);                                 \
-} while (0)
+({                                                                       \
+       int __changed = !pte_same(*(__ptep), __entry);                    \
+       if (__changed) {                                                  \
+               set_pte_at((__vma)->vm_mm, (__address), __ptep, __entry); \
+               flush_tlb_page(__vma, __address);                         \
+       }                                                                 \
+       __changed;                                                        \
+})
 #endif
 
 #ifndef __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
index 2394589786bae215942e38e80c940efee25cd1df..628fa7747d0cce02dfd866c181c31dbd413c952c 100644 (file)
@@ -285,32 +285,36 @@ static inline pte_t native_local_ptep_get_and_clear(pte_t *ptep)
  */
 #define  __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
 #define ptep_set_access_flags(vma, address, ptep, entry, dirty)                \
-do {                                                                   \
-       if (dirty) {                                                    \
+({                                                                     \
+       int __changed = !pte_same(*(ptep), entry);                      \
+       if (__changed && dirty) {                                       \
                (ptep)->pte_low = (entry).pte_low;                      \
                pte_update_defer((vma)->vm_mm, (address), (ptep));      \
                flush_tlb_page(vma, address);                           \
        }                                                               \
-} while (0)
+       __changed;                                                      \
+})
 
 #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
 #define ptep_test_and_clear_dirty(vma, addr, ptep) ({                  \
-       int ret = 0;                                                    \
-       if (pte_dirty(*ptep))                                           \
-               ret = test_and_clear_bit(_PAGE_BIT_DIRTY, &ptep->pte_low); \
-       if (ret)                                                        \
-               pte_update_defer(vma->vm_mm, addr, ptep);               \
-       ret;                                                            \
+       int __ret = 0;                                                  \
+       if (pte_dirty(*(ptep)))                                         \
+               __ret = test_and_clear_bit(_PAGE_BIT_DIRTY,             \
+                                               &(ptep)->pte_low);      \
+       if (__ret)                                                      \
+               pte_update((vma)->vm_mm, addr, ptep);                   \
+       __ret;                                                          \
 })
 
 #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
 #define ptep_test_and_clear_young(vma, addr, ptep) ({                  \
-       int ret = 0;                                                    \
-       if (pte_young(*ptep))                                           \
-               ret = test_and_clear_bit(_PAGE_BIT_ACCESSED, &ptep->pte_low); \
-       if (ret)                                                        \
-               pte_update_defer(vma->vm_mm, addr, ptep);               \
-       ret;                                                            \
+       int __ret = 0;                                                  \
+       if (pte_young(*(ptep)))                                         \
+               __ret = test_and_clear_bit(_PAGE_BIT_ACCESSED,          \
+                                               &(ptep)->pte_low);      \
+       if (__ret)                                                      \
+               pte_update((vma)->vm_mm, addr, ptep);                   \
+       __ret;                                                          \
 })
 
 /*
index 670b706411b88c01c5a1785e467f387510ecfe2a..6580f31b31352c414fa55f6e5ddadcf287a9e9e3 100644 (file)
@@ -533,16 +533,23 @@ extern void lazy_mmu_prot_update (pte_t pte);
  * daccess_bit in ivt.S).
  */
 #ifdef CONFIG_SMP
-# define ptep_set_access_flags(__vma, __addr, __ptep, __entry, __safely_writable)      \
-do {                                                                                   \
-       if (__safely_writable) {                                                        \
-               set_pte(__ptep, __entry);                                               \
-               flush_tlb_page(__vma, __addr);                                          \
-       }                                                                               \
-} while (0)
+# define ptep_set_access_flags(__vma, __addr, __ptep, __entry, __safely_writable) \
+({                                                                     \
+       int __changed = !pte_same(*(__ptep), __entry);                  \
+       if (__changed && __safely_writable) {                           \
+               set_pte(__ptep, __entry);                               \
+               flush_tlb_page(__vma, __addr);                          \
+       }                                                               \
+       __changed;                                                      \
+})
 #else
-# define ptep_set_access_flags(__vma, __addr, __ptep, __entry, __safely_writable)      \
-       ptep_establish(__vma, __addr, __ptep, __entry)
+# define ptep_set_access_flags(__vma, __addr, __ptep, __entry, __safely_writable) \
+({                                                                     \
+       int __changed = !pte_same(*(__ptep), __entry);                  \
+       if (__changed)                                                  \
+               ptep_establish(__vma, __addr, __ptep, __entry);         \
+       __changed;                                                      \
+})
 #endif
 
 #  ifdef CONFIG_VIRTUAL_MEM_MAP
index 92e62ef711edbac3d7aeedd7d73ffcccfc705fa4..c5f20df780e927e3146137989000ce0f0b39db9e 100644 (file)
        .endm
 #endif /* CONFIG_MIPS_MT_SMTC */
 
-#ifdef CONFIG_CPU_SB1
-       .macro  fpu_enable_hazard
-       .set    push
-       .set    noreorder
-       .set    mips2
-       SSNOP
-       bnezl   $0, .+4
-        SSNOP
-       .set    pop
-       .endm
-#else
-       .macro  fpu_enable_hazard
-       .endm
-#endif
-
 /*
  * Temporary until all gas have MT ASE support
  */
index d995413e11fd87af0844e82b6d10c90e3324b60b..ffe245b4258f3303bbaf6088c7306f7924b1c2f7 100644 (file)
@@ -238,10 +238,11 @@ static inline int test_and_set_bit(unsigned long nr,
        volatile unsigned long *addr)
 {
        unsigned short bit = nr & SZLONG_MASK;
+       unsigned long res;
 
        if (cpu_has_llsc && R10000_LLSC_WAR) {
                unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
-               unsigned long temp, res;
+               unsigned long temp;
 
                __asm__ __volatile__(
                "       .set    mips3                                   \n"
@@ -254,11 +255,9 @@ static inline int test_and_set_bit(unsigned long nr,
                : "=&r" (temp), "=m" (*m), "=&r" (res)
                : "r" (1UL << bit), "m" (*m)
                : "memory");
-
-               return res != 0;
        } else if (cpu_has_llsc) {
                unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
-               unsigned long temp, res;
+               unsigned long temp;
 
                __asm__ __volatile__(
                "       .set    push                                    \n"
@@ -277,25 +276,22 @@ static inline int test_and_set_bit(unsigned long nr,
                : "=&r" (temp), "=m" (*m), "=&r" (res)
                : "r" (1UL << bit), "m" (*m)
                : "memory");
-
-               return res != 0;
        } else {
                volatile unsigned long *a = addr;
                unsigned long mask;
-               int retval;
                unsigned long flags;
 
                a += nr >> SZLONG_LOG;
                mask = 1UL << bit;
                raw_local_irq_save(flags);
-               retval = (mask & *a) != 0;
+               res = (mask & *a);
                *a |= mask;
                raw_local_irq_restore(flags);
-
-               return retval;
        }
 
        smp_mb();
+
+       return res != 0;
 }
 
 /*
@@ -310,6 +306,7 @@ static inline int test_and_clear_bit(unsigned long nr,
        volatile unsigned long *addr)
 {
        unsigned short bit = nr & SZLONG_MASK;
+       unsigned long res;
 
        if (cpu_has_llsc && R10000_LLSC_WAR) {
                unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
@@ -327,12 +324,10 @@ static inline int test_and_clear_bit(unsigned long nr,
                : "=&r" (temp), "=m" (*m), "=&r" (res)
                : "r" (1UL << bit), "m" (*m)
                : "memory");
-
-               return res != 0;
 #ifdef CONFIG_CPU_MIPSR2
        } else if (__builtin_constant_p(nr)) {
                unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
-               unsigned long temp, res;
+               unsigned long temp;
 
                __asm__ __volatile__(
                "1:     " __LL  "%0, %1         # test_and_clear_bit    \n"
@@ -346,12 +341,10 @@ static inline int test_and_clear_bit(unsigned long nr,
                : "=&r" (temp), "=m" (*m), "=&r" (res)
                : "ri" (bit), "m" (*m)
                : "memory");
-
-               return res;
 #endif
        } else if (cpu_has_llsc) {
                unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
-               unsigned long temp, res;
+               unsigned long temp;
 
                __asm__ __volatile__(
                "       .set    push                                    \n"
@@ -371,25 +364,22 @@ static inline int test_and_clear_bit(unsigned long nr,
                : "=&r" (temp), "=m" (*m), "=&r" (res)
                : "r" (1UL << bit), "m" (*m)
                : "memory");
-
-               return res != 0;
        } else {
                volatile unsigned long *a = addr;
                unsigned long mask;
-               int retval;
                unsigned long flags;
 
                a += nr >> SZLONG_LOG;
                mask = 1UL << bit;
                raw_local_irq_save(flags);
-               retval = (mask & *a) != 0;
+               res = (mask & *a);
                *a &= ~mask;
                raw_local_irq_restore(flags);
-
-               return retval;
        }
 
        smp_mb();
+
+       return res != 0;
 }
 
 /*
@@ -404,10 +394,11 @@ static inline int test_and_change_bit(unsigned long nr,
        volatile unsigned long *addr)
 {
        unsigned short bit = nr & SZLONG_MASK;
+       unsigned long res;
 
        if (cpu_has_llsc && R10000_LLSC_WAR) {
                unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
-               unsigned long temp, res;
+               unsigned long temp;
 
                __asm__ __volatile__(
                "       .set    mips3                                   \n"
@@ -420,11 +411,9 @@ static inline int test_and_change_bit(unsigned long nr,
                : "=&r" (temp), "=m" (*m), "=&r" (res)
                : "r" (1UL << bit), "m" (*m)
                : "memory");
-
-               return res != 0;
        } else if (cpu_has_llsc) {
                unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
-               unsigned long temp, res;
+               unsigned long temp;
 
                __asm__ __volatile__(
                "       .set    push                                    \n"
@@ -443,24 +432,22 @@ static inline int test_and_change_bit(unsigned long nr,
                : "=&r" (temp), "=m" (*m), "=&r" (res)
                : "r" (1UL << bit), "m" (*m)
                : "memory");
-
-               return res != 0;
        } else {
                volatile unsigned long *a = addr;
-               unsigned long mask, retval;
+               unsigned long mask;
                unsigned long flags;
 
                a += nr >> SZLONG_LOG;
                mask = 1UL << bit;
                raw_local_irq_save(flags);
-               retval = (mask & *a) != 0;
+               res = (mask & *a);
                *a ^= mask;
                raw_local_irq_restore(flags);
-
-               return retval;
        }
 
        smp_mb();
+
+       return res != 0;
 }
 
 #include <asm-generic/bitops/non-atomic.h>
index b98f1658cfd00a2aac65671daeba3a2e49cc86b9..c8ebcc3e12677cc8eadd22407e7b68ea31e20ca2 100644 (file)
  *  CoreEMUL with   Bonito   System Controller is treated like a Core20K
  *  CoreEMUL with SOC-it 101 System Controller is treated like a CoreMSC
  */
-#define MIPS_REVISION_CORID_CORE_EMUL_BON  0x63
-#define MIPS_REVISION_CORID_CORE_EMUL_MSC  0x65
+#define MIPS_REVISION_CORID_CORE_EMUL_BON  -1
+#define MIPS_REVISION_CORID_CORE_EMUL_MSC  -2
 
 #define MIPS_REVISION_CORID (((*(volatile u32 *)ioremap(MIPS_REVISION_REG, 4)) >> 10) & 0x3f)
 
-extern unsigned int mips_revision_corid;
+extern int mips_revision_corid;
+
+#define MIPS_REVISION_SCON_OTHER          0
+#define MIPS_REVISION_SCON_SOCITSC        1
+#define MIPS_REVISION_SCON_SOCITSCP       2
+
+/* Artificial SCON defines for MIPS_REVISION_SCON_OTHER */
+#define MIPS_REVISION_SCON_UNKNOWN        -1
+#define MIPS_REVISION_SCON_GT64120        -2
+#define MIPS_REVISION_SCON_BONITO         -3
+#define MIPS_REVISION_SCON_BRTL                   -4
+#define MIPS_REVISION_SCON_SOCIT          -5
+#define MIPS_REVISION_SCON_ROCIT          -6
+
+#define MIPS_REVISION_SCONID (((*(volatile u32 *)ioremap(MIPS_REVISION_REG, 4)) >> 24) & 0xff)
+
+extern int mips_revision_sconid;
 
 #ifdef CONFIG_PCI
 extern void mips_pcibios_init(void);
index 8eaefb837b9dd2d2b8acf00e57b21a0beab5b8aa..e036b7dd6deb69ea17aba38a9fe63d1634a53c07 100644 (file)
  * latter, they should be moved elsewhere.
  */
 #define MIPS_MSC01_PCI_REG_BASE                0x1bd00000
+#define MIPS_SOCITSC_PCI_REG_BASE      0x1ff10000
 
 extern unsigned long _pcictrl_msc;
 
index daaf9f98fc63ce7547a3660b915cb0ee2599e547..a9db576a9768e0493711dd07ee39e2bdc63b6e5f 100644 (file)
@@ -33,6 +33,7 @@ extern void prom_meminit(void);
 extern void prom_fixup_mem_map(unsigned long start_mem, unsigned long end_mem);
 extern void mips_display_message(const char *str);
 extern void mips_display_word(unsigned int num);
+extern void mips_scroll_message(void);
 extern int get_ethernet_addr(char *ethernet_addr);
 
 /* Memory descriptor management. */
index 7afa1fdf70ca6a5dcba909b985869f66c72aca76..ed33366b85b8cf782f79a854495c5b24df9908de 100644 (file)
 #include <asm/mipsregs.h>
 #include <asm/asm-offsets.h>
 
+/*
+ * For SMTC kernel, global IE should be left set, and interrupts
+ * controlled exclusively via IXMT.
+ */
+#ifdef CONFIG_MIPS_MT_SMTC
+#define STATMASK 0x1e
+#elif defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
+#define STATMASK 0x3f
+#else
+#define STATMASK 0x1f
+#endif
+
 #ifdef CONFIG_MIPS_MT_SMTC
 #include <asm/mipsmtregs.h>
 #endif /* CONFIG_MIPS_MT_SMTC */
                .set    reorder
                .set    noat
                mfc0    a0, CP0_STATUS
-               ori     a0, 0x1f
-               xori    a0, 0x1f
-               mtc0    a0, CP0_STATUS
                li      v1, 0xff00
+               ori     a0, STATMASK
+               xori    a0, STATMASK
+               mtc0    a0, CP0_STATUS
                and     a0, v1
                LONG_L  v0, PT_STATUS(sp)
                nor     v1, $0, v1
                LONG_L  $31, PT_R31(sp)
                LONG_L  $28, PT_R28(sp)
                LONG_L  $25, PT_R25(sp)
-#ifdef CONFIG_64BIT
-               LONG_L  $8, PT_R8(sp)
-               LONG_L  $9, PT_R9(sp)
-#endif
                LONG_L  $7,  PT_R7(sp)
                LONG_L  $6,  PT_R6(sp)
                LONG_L  $5,  PT_R5(sp)
                .endm
 
 #else
-/*
- * For SMTC kernel, global IE should be left set, and interrupts
- * controlled exclusively via IXMT.
- */
-
-#ifdef CONFIG_MIPS_MT_SMTC
-#define STATMASK 0x1e
-#else
-#define STATMASK 0x1f
-#endif
                .macro  RESTORE_SOME
                .set    push
                .set    reorder
                .macro  CLI
 #if !defined(CONFIG_MIPS_MT_SMTC)
                mfc0    t0, CP0_STATUS
-               li      t1, ST0_CU0 | 0x1f
+               li      t1, ST0_CU0 | STATMASK
                or      t0, t1
-               xori    t0, 0x1f
+               xori    t0, STATMASK
                mtc0    t0, CP0_STATUS
 #else /* CONFIG_MIPS_MT_SMTC */
                /*
                .macro  STI
 #if !defined(CONFIG_MIPS_MT_SMTC)
                mfc0    t0, CP0_STATUS
-               li      t1, ST0_CU0 | 0x1f
+               li      t1, ST0_CU0 | STATMASK
                or      t0, t1
-               xori    t0, 0x1e
+               xori    t0, STATMASK & ~1
                mtc0    t0, CP0_STATUS
 #else /* CONFIG_MIPS_MT_SMTC */
                /*
                .endm
 
 /*
- * Just move to kernel mode and leave interrupts as they are.
+ * Just move to kernel mode and leave interrupts as they are.  Note
+ * for the R3000 this means copying the previous enable from IEp.
  * Set cp0 enable bit as sign that we're running on the kernel stack
  */
                .macro  KMODE
                move    ra, t0
 #endif /* CONFIG_MIPS_MT_SMTC */
                mfc0    t0, CP0_STATUS
-               li      t1, ST0_CU0 | 0x1e
+               li      t1, ST0_CU0 | (STATMASK & ~1)
+#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
+               andi    t2, t0, ST0_IEP
+               srl     t2, 2
+               or      t0, t2
+#endif
                or      t0, t1
-               xori    t0, 0x1e
+               xori    t0, STATMASK & ~1
                mtc0    t0, CP0_STATUS
 #ifdef CONFIG_MIPS_MT_SMTC
                _ehb
index 2f1087b3a20278241d719fa60d594f744780bebf..59d6fec8fbfff9a3c18969a2655b13d392e0aedd 100644 (file)
 #define __NR_epoll_pwait               (__NR_Linux + 313)
 #define __NR_ioprio_set                        (__NR_Linux + 314)
 #define __NR_ioprio_get                        (__NR_Linux + 315)
+#define __NR_utimensat                 (__NR_Linux + 316)
+#define __NR_signalfd                  (__NR_Linux + 317)
+#define __NR_timerfd                   (__NR_Linux + 318)
+#define __NR_eventfd                   (__NR_Linux + 319)
 
 /*
  * Offset of the last Linux o32 flavoured syscall
  */
-#define __NR_Linux_syscalls            315
+#define __NR_Linux_syscalls            319
 
 #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
 
 #define __NR_O32_Linux                 4000
-#define __NR_O32_Linux_syscalls                315
+#define __NR_O32_Linux_syscalls                319
 
 #if _MIPS_SIM == _MIPS_SIM_ABI64
 
 #define __NR_epoll_pwait               (__NR_Linux + 272)
 #define __NR_ioprio_set                        (__NR_Linux + 273)
 #define __NR_ioprio_get                        (__NR_Linux + 274)
+#define __NR_utimensat                 (__NR_Linux + 275)
+#define __NR_signalfd                  (__NR_Linux + 276)
+#define __NR_timerfd                   (__NR_Linux + 277)
+#define __NR_eventfd                   (__NR_Linux + 278)
 
 /*
  * Offset of the last Linux 64-bit flavoured syscall
  */
-#define __NR_Linux_syscalls            274
+#define __NR_Linux_syscalls            278
 
 #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
 
 #define __NR_64_Linux                  5000
-#define __NR_64_Linux_syscalls         274
+#define __NR_64_Linux_syscalls         278
 
 #if _MIPS_SIM == _MIPS_SIM_NABI32
 
 #define __NR_epoll_pwait               (__NR_Linux + 276)
 #define __NR_ioprio_set                        (__NR_Linux + 277)
 #define __NR_ioprio_get                        (__NR_Linux + 278)
+#define __NR_utimensat                 (__NR_Linux + 279)
+#define __NR_signalfd                  (__NR_Linux + 280)
+#define __NR_timerfd                   (__NR_Linux + 281)
+#define __NR_eventfd                   (__NR_Linux + 282)
 
 /*
  * Offset of the last N32 flavoured syscall
  */
-#define __NR_Linux_syscalls            278
+#define __NR_Linux_syscalls            282
 
 #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
 
 #define __NR_N32_Linux                 6000
-#define __NR_N32_Linux_syscalls                278
+#define __NR_N32_Linux_syscalls                282
 
 #ifdef __KERNEL__
 
 #define __ARCH_WANT_SYS_UTIME
 #define __ARCH_WANT_SYS_WAITPID
 #define __ARCH_WANT_SYS_SOCKETCALL
-#define __ARCH_WANT_SYS_FADVISE64
 #define __ARCH_WANT_SYS_GETPGRP
 #define __ARCH_WANT_SYS_LLSEEK
 #define __ARCH_WANT_SYS_NICE
index 76d880dc4baebb4de2e62185cc78197c92be4768..4e9626836bab8d1d7a5fb413709a7b9f9f6e35dc 100644 (file)
@@ -31,10 +31,11 @@ enum cpu_type {
        pcxw    = 8, /* pa8500          pa 2.0  */
        pcxw_   = 9, /* pa8600  (w+)    pa 2.0  */
        pcxw2   = 10, /* pa8700         pa 2.0  */
-       mako    = 11  /* pa8800         pa 2.0  */
+       mako    = 11, /* pa8800         pa 2.0  */
+       mako2   = 12  /* pa8900         pa 2.0  */
 };
 
-extern char *cpu_name_version[][2]; /* mapping from enum cpu_type to strings */
+extern const char * const cpu_name_version[][2]; /* mapping from enum cpu_type to strings */
 
 struct parisc_driver;
 
index 7a09d911b53895eb5976ab96fd62d53989018d11..ad8cd0d069eabd1a69fd6b802028950067b2e05e 100644 (file)
@@ -8,8 +8,10 @@
 
 /*
  * In parisc assembly a semicolon marks a comment while a
- * exclamation mark is used to seperate independend lines.
+ * exclamation mark is used to seperate independent lines.
  */
+#ifdef __ASSEMBLY__
+
 #define ENTRY(name) \
        .export name !\
        ALIGN !\
@@ -24,5 +26,6 @@ name:
        END(name)
 #endif
 
+#endif /* __ASSEMBLY__ */
 
 #endif  /* __ASM_PARISC_LINKAGE_H */
index d2f396721d3eb9461c41c307dc6d6da7c93d7f63..6b294fb07a23d6aa9018599f46c80731abb4bb58 100644 (file)
@@ -69,8 +69,8 @@ struct system_cpuinfo_parisc {
                char   sys_model_name[81]; /* PDC-ROM returnes this model name */
        } pdc;
 
-       char            *cpu_name;      /* e.g. "PA7300LC (PCX-L2)" */
-       char            *family_name;   /* e.g. "1.1e" */
+       const char      *cpu_name;      /* e.g. "PA7300LC (PCX-L2)" */
+       const char      *family_name;   /* e.g. "1.1e" */
 };
 
 
@@ -334,8 +334,8 @@ extern unsigned long get_wchan(struct task_struct *p);
 static inline int parisc_requires_coherency(void)
 {
 #ifdef CONFIG_PA8X00
-       /* FIXME: also pa8900 - when we see one */
-       return boot_cpu_data.cpu_type == mako;
+       return (boot_cpu_data.cpu_type == mako) ||
+               (boot_cpu_data.cpu_type == mako2);
 #else
        return 0;
 #endif
index 2f7c40861c91dbb2cae7ca888271140820b6ba12..f74099bdca3c11c6ee99e106146041c6587c0ad0 100644 (file)
 #define __NR_epoll_pwait       (__NR_Linux + 297)
 #define __NR_statfs64          (__NR_Linux + 298)
 #define __NR_fstatfs64         (__NR_Linux + 299)
+#define __NR_kexec_load                (__NR_Linux + 300)
+#define __NR_utimensat         (__NR_Linux + 301)
+#define __NR_signalfd          (__NR_Linux + 302)
+#define __NR_timerfd           (__NR_Linux + 303)
+#define __NR_eventfd           (__NR_Linux + 304)
+
+#define __NR_Linux_syscalls    (__NR_eventfd + 1)
+
+
+#define __IGNORE_select                /* newselect */
+#define __IGNORE_fadvise64     /* fadvise64_64 */
+#define __IGNORE_utimes                /* utime */
 
-#define __NR_Linux_syscalls     (__NR_fstatfs64 + 1)
 
 #define HPUX_GATEWAY_ADDR       0xC0000004
 #define LINUX_GATEWAY_ADDR      0x100
index c863bdb2889c11fae3879c38be57aef299ef9fbd..7fb730c62f8332cb8cc19a37858f557a8833bf10 100644 (file)
@@ -673,10 +673,14 @@ static inline void __ptep_set_access_flags(pte_t *ptep, pte_t entry, int dirty)
 }
 
 #define  ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
-       do {                                                               \
-               __ptep_set_access_flags(__ptep, __entry, __dirty);         \
-               flush_tlb_page_nohash(__vma, __address);                   \
-       } while(0)
+({                                                                        \
+       int __changed = !pte_same(*(__ptep), __entry);                     \
+       if (__changed) {                                                   \
+               __ptep_set_access_flags(__ptep, __entry, __dirty);         \
+               flush_tlb_page_nohash(__vma, __address);                   \
+       }                                                                  \
+       __changed;                                                         \
+})
 
 /*
  * Macro to mark a page protection value as "uncacheable".
index 704c4e669fe0ac9a1b72818b2922d97732d980b0..3cfd98f44bfe82286b55b1ca5aa2af442e993c4c 100644 (file)
@@ -413,10 +413,14 @@ static inline void __ptep_set_access_flags(pte_t *ptep, pte_t entry, int dirty)
        :"cc");
 }
 #define  ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
-       do {                                                               \
-               __ptep_set_access_flags(__ptep, __entry, __dirty);         \
-               flush_tlb_page_nohash(__vma, __address);                   \
-       } while(0)
+({                                                                        \
+       int __changed = !pte_same(*(__ptep), __entry);                     \
+       if (__changed) {                                                   \
+               __ptep_set_access_flags(__ptep, __entry, __dirty);         \
+               flush_tlb_page_nohash(__vma, __address);                   \
+       }                                                                  \
+       __changed;                                                         \
+})
 
 /*
  * Macro to mark a page protection value as "uncacheable".
index bed452d4a5f0b1486990b223f7a1e711ae20ac81..9d0ce9ff584026df772125dff65d5e03c85395b4 100644 (file)
@@ -694,10 +694,14 @@ static inline void __ptep_set_access_flags(pte_t *ptep, pte_t entry, int dirty)
 }
 
 #define  ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
-       do {                                                               \
-               __ptep_set_access_flags(__ptep, __entry, __dirty);         \
-               flush_tlb_page_nohash(__vma, __address);                   \
-       } while(0)
+({                                                                        \
+       int __changed = !pte_same(*(__ptep), __entry);                     \
+       if (__changed) {                                                   \
+               __ptep_set_access_flags(__ptep, __entry, __dirty);         \
+               flush_tlb_page_nohash(__vma, __address);                   \
+       }                                                                  \
+       __changed;                                                         \
+})
 
 /*
  * Macro to mark a page protection value as "uncacheable".
index 8fe8d42e64c3dcafa0fc486cc8ce46ef723b5593..0a307bb2f35328d784f15c77fe27cd5f3e0814a9 100644 (file)
@@ -744,7 +744,12 @@ ptep_establish(struct vm_area_struct *vma,
 }
 
 #define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
-       ptep_establish(__vma, __address, __ptep, __entry)
+({                                                                       \
+       int __changed = !pte_same(*(__ptep), __entry);                    \
+       if (__changed)                                                    \
+               ptep_establish(__vma, __address, __ptep, __entry);        \
+       __changed;                                                        \
+})
 
 /*
  * Test and clear dirty bit in storage key.
index 3a4acb3e38a15239f695d0f95313977f5cb2f2bc..907c062b4c9a8296eebc5f77964d12296ed35acf 100644 (file)
@@ -1,9 +1,7 @@
-#ifndef __ASM_SH_HITACHI_SE73180_H
-#define __ASM_SH_HITACHI_SE73180_H
+#ifndef __ASM_SH_SE73180_H
+#define __ASM_SH_SE73180_H
 
 /*
- * include/asm-sh/se/se73180.h
- *
  * Copyright (C) 2003 Takashi Kusuda <kusuda-takashi@hitachi-ul.co.jp>
  *
  * SH-Mobile SolutionEngine 73180 support
@@ -62,4 +60,7 @@
 #define __IO_PREFIX    sh73180se
 #include <asm/io_generic.h>
 
-#endif  /* __ASM_SH_HITACHI_SE73180_H */
+/* arch/sh/boards/se/73180/irq.c */
+int shmse_irq_demux(int irq);
+
+#endif  /* __ASM_SH_SE73180_H */
index 4f0a5ba0d6a033cf9c8e0923f343556f550914fa..59229aeba27b9c51a15a39985c088719d8bb5811 100644 (file)
@@ -446,6 +446,17 @@ extern int io_remap_pfn_range(struct vm_area_struct *vma,
 #define GET_IOSPACE(pfn)               (pfn >> (BITS_PER_LONG - 4))
 #define GET_PFN(pfn)                   (pfn & 0x0fffffffUL)
 
+#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
+#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
+({                                                                       \
+       int __changed = !pte_same(*(__ptep), __entry);                    \
+       if (__changed) {                                                  \
+               set_pte_at((__vma)->vm_mm, (__address), __ptep, __entry); \
+               flush_tlb_page(__vma, __address);                         \
+       }                                                                 \
+       (sparc_cpu_model == sun4c) || __changed;                          \
+})
+
 #include <asm-generic/pgtable.h>
 
 #endif /* !(__ASSEMBLY__) */
index 03c385de7619e517373fd9216670761354938473..445026fbec35e4619ca3b5a1b005a88f9841d5d6 100644 (file)
@@ -31,7 +31,7 @@ typedef struct {
        unsigned int    ecache_size;
        unsigned int    ecache_line_size;
        int             core_id;
-       unsigned int    __pad3;
+       int             proc_id;
 } cpuinfo_sparc;
 
 DECLARE_PER_CPU(cpuinfo_sparc, __cpu_data);
index 9329429fb7f6af6ae2c50ad92e24e83482b752f4..c58ec1661df864d69c9ff46ebeed26e247727581 100644 (file)
@@ -15,8 +15,7 @@
 static inline int
 dma_supported(struct device *dev, u64 mask)
 {
-       BUG_ON(dev->bus != &pci_bus_type &&
-              dev->bus != &ebus_bus_type);
+       BUG_ON(dev->bus != &pci_bus_type);
 
        return pci_dma_supported(to_pci_dev(dev), mask);
 }
@@ -24,8 +23,7 @@ dma_supported(struct device *dev, u64 mask)
 static inline int
 dma_set_mask(struct device *dev, u64 dma_mask)
 {
-       BUG_ON(dev->bus != &pci_bus_type &&
-              dev->bus != &ebus_bus_type);
+       BUG_ON(dev->bus != &pci_bus_type);
 
        return pci_set_dma_mask(to_pci_dev(dev), dma_mask);
 }
@@ -34,8 +32,7 @@ static inline void *
 dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
                   gfp_t flag)
 {
-       BUG_ON(dev->bus != &pci_bus_type &&
-              dev->bus != &ebus_bus_type);
+       BUG_ON(dev->bus != &pci_bus_type);
 
        return pci_iommu_ops->alloc_consistent(to_pci_dev(dev), size, dma_handle, flag);
 }
@@ -44,8 +41,7 @@ static inline void
 dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
                    dma_addr_t dma_handle)
 {
-       BUG_ON(dev->bus != &pci_bus_type &&
-              dev->bus != &ebus_bus_type);
+       BUG_ON(dev->bus != &pci_bus_type);
 
        pci_free_consistent(to_pci_dev(dev), size, cpu_addr, dma_handle);
 }
@@ -54,8 +50,7 @@ static inline dma_addr_t
 dma_map_single(struct device *dev, void *cpu_addr, size_t size,
               enum dma_data_direction direction)
 {
-       BUG_ON(dev->bus != &pci_bus_type &&
-              dev->bus != &ebus_bus_type);
+       BUG_ON(dev->bus != &pci_bus_type);
 
        return pci_map_single(to_pci_dev(dev), cpu_addr, size, (int)direction);
 }
@@ -64,8 +59,7 @@ static inline void
 dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
                 enum dma_data_direction direction)
 {
-       BUG_ON(dev->bus != &pci_bus_type &&
-              dev->bus != &ebus_bus_type);
+       BUG_ON(dev->bus != &pci_bus_type);
 
        pci_unmap_single(to_pci_dev(dev), dma_addr, size, (int)direction);
 }
@@ -75,8 +69,7 @@ dma_map_page(struct device *dev, struct page *page,
             unsigned long offset, size_t size,
             enum dma_data_direction direction)
 {
-       BUG_ON(dev->bus != &pci_bus_type &&
-              dev->bus != &ebus_bus_type);
+       BUG_ON(dev->bus != &pci_bus_type);
 
        return pci_map_page(to_pci_dev(dev), page, offset, size, (int)direction);
 }
@@ -85,8 +78,7 @@ static inline void
 dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
               enum dma_data_direction direction)
 {
-       BUG_ON(dev->bus != &pci_bus_type &&
-              dev->bus != &ebus_bus_type);
+       BUG_ON(dev->bus != &pci_bus_type);
 
        pci_unmap_page(to_pci_dev(dev), dma_address, size, (int)direction);
 }
@@ -95,8 +87,7 @@ static inline int
 dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
           enum dma_data_direction direction)
 {
-       BUG_ON(dev->bus != &pci_bus_type &&
-              dev->bus != &ebus_bus_type);
+       BUG_ON(dev->bus != &pci_bus_type);
 
        return pci_map_sg(to_pci_dev(dev), sg, nents, (int)direction);
 }
@@ -105,8 +96,7 @@ static inline void
 dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
             enum dma_data_direction direction)
 {
-       BUG_ON(dev->bus != &pci_bus_type &&
-              dev->bus != &ebus_bus_type);
+       BUG_ON(dev->bus != &pci_bus_type);
 
        pci_unmap_sg(to_pci_dev(dev), sg, nhwentries, (int)direction);
 }
@@ -115,8 +105,7 @@ static inline void
 dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
                        enum dma_data_direction direction)
 {
-       BUG_ON(dev->bus != &pci_bus_type &&
-              dev->bus != &ebus_bus_type);
+       BUG_ON(dev->bus != &pci_bus_type);
 
        pci_dma_sync_single_for_cpu(to_pci_dev(dev), dma_handle,
                                    size, (int)direction);
@@ -126,8 +115,7 @@ static inline void
 dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size,
                           enum dma_data_direction direction)
 {
-       BUG_ON(dev->bus != &pci_bus_type &&
-              dev->bus != &ebus_bus_type);
+       BUG_ON(dev->bus != &pci_bus_type);
 
        pci_dma_sync_single_for_device(to_pci_dev(dev), dma_handle,
                                       size, (int)direction);
@@ -137,8 +125,7 @@ static inline void
 dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
                    enum dma_data_direction direction)
 {
-       BUG_ON(dev->bus != &pci_bus_type &&
-              dev->bus != &ebus_bus_type);
+       BUG_ON(dev->bus != &pci_bus_type);
 
        pci_dma_sync_sg_for_cpu(to_pci_dev(dev), sg, nelems, (int)direction);
 }
@@ -147,8 +134,7 @@ static inline void
 dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
                       enum dma_data_direction direction)
 {
-       BUG_ON(dev->bus != &pci_bus_type &&
-              dev->bus != &ebus_bus_type);
+       BUG_ON(dev->bus != &pci_bus_type);
 
        pci_dma_sync_sg_for_device(to_pci_dev(dev), sg, nelems, (int)direction);
 }
@@ -162,6 +148,22 @@ dma_mapping_error(dma_addr_t dma_addr)
 #else
 
 struct device;
+struct page;
+struct scatterlist;
+
+static inline int
+dma_supported(struct device *dev, u64 mask)
+{
+       BUG();
+       return 0;
+}
+
+static inline int
+dma_set_mask(struct device *dev, u64 dma_mask)
+{
+       BUG();
+       return 0;
+}
 
 static inline void *dma_alloc_coherent(struct device *dev, size_t size,
                         dma_addr_t *dma_handle, gfp_t flag)
@@ -176,6 +178,52 @@ static inline void dma_free_coherent(struct device *dev, size_t size,
        BUG();
 }
 
+static inline dma_addr_t
+dma_map_single(struct device *dev, void *cpu_addr, size_t size,
+              enum dma_data_direction direction)
+{
+       BUG();
+       return 0;
+}
+
+static inline void
+dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
+                enum dma_data_direction direction)
+{
+       BUG();
+}
+
+static inline dma_addr_t
+dma_map_page(struct device *dev, struct page *page,
+            unsigned long offset, size_t size,
+            enum dma_data_direction direction)
+{
+       BUG();
+       return 0;
+}
+
+static inline void
+dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
+              enum dma_data_direction direction)
+{
+       BUG();
+}
+
+static inline int
+dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
+          enum dma_data_direction direction)
+{
+       BUG();
+       return 0;
+}
+
+static inline void
+dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
+            enum dma_data_direction direction)
+{
+       BUG();
+}
+
 static inline void
 dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
                        enum dma_data_direction direction)
@@ -190,6 +238,27 @@ dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t siz
        BUG();
 }
 
+static inline void
+dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
+                   enum dma_data_direction direction)
+{
+       BUG();
+}
+
+static inline void
+dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
+                      enum dma_data_direction direction)
+{
+       BUG();
+}
+
+static inline int
+dma_mapping_error(dma_addr_t dma_addr)
+{
+       BUG();
+       return 0;
+}
+
 #endif /* PCI */
 
 
index 4a43075a0619c5b5ccca6bdb4fc2516b39ed269e..db2130a95d68dea4f49e88aca19c9cb0c8a43105 100644 (file)
@@ -2615,8 +2615,9 @@ struct ldc_mtable_entry {
 /* ldc_revoke()
  * TRAP:       HV_FAST_TRAP
  * FUNCTION:   HV_FAST_LDC_REVOKE
- * ARG0:       cookie
- * ARG1:       ldc_mtable_entry cookie
+ * ARG0:       channel ID
+ * ARG1:       cookie
+ * ARG2:       ldc_mtable_entry cookie
  * RET0:       status
  */
 #define HV_FAST_LDC_REVOKE             0xef
@@ -2663,7 +2664,8 @@ extern unsigned long sun4v_ldc_mapin(unsigned long channel,
                                     unsigned long *ra,
                                     unsigned long *perm);
 extern unsigned long sun4v_ldc_unmap(unsigned long ra);
-extern unsigned long sun4v_ldc_revoke(unsigned long cookie,
+extern unsigned long sun4v_ldc_revoke(unsigned long channel,
+                                     unsigned long cookie,
                                      unsigned long mte_cookie);
 #endif
 
@@ -2798,6 +2800,11 @@ struct hv_mmu_statistics {
  */
 #define HV_FAST_MMUSTAT_INFO           0x103
 
+#ifndef __ASSEMBLY__
+extern unsigned long sun4v_mmustat_conf(unsigned long ra, unsigned long *orig_ra);
+extern unsigned long sun4v_mmustat_info(unsigned long *ra);
+#endif
+
 /* NCS crypto services  */
 
 /* ncs_request() sub-function numbers */
index 5d233b42fe135b87b51d9c2f3e1339554ce8e7f5..90781e34a95ca9b67bf1414ccd191466b9139300 100644 (file)
@@ -46,6 +46,7 @@ extern void irq_install_pre_handler(int virt_irq,
 #define irq_canonicalize(irq)  (irq)
 extern unsigned int build_irq(int inofixup, unsigned long iclr, unsigned long imap);
 extern unsigned int sun4v_build_irq(u32 devhandle, unsigned int devino);
+extern unsigned int sun4v_build_virq(u32 devhandle, unsigned int devino);
 extern unsigned int sun4v_build_msi(u32 devhandle, unsigned int *virt_irq_p,
                                    unsigned int msi_devino_start,
                                    unsigned int msi_devino_end);
index 6340a5253a347df28c3d7b0223fca8f791d51aa0..23cc63f049a896769f4ed62e8d6ef8044f57d817 100644 (file)
@@ -145,7 +145,7 @@ static int parport_isa_probe(int count)
                         */
                        if (parport_pc_probe_port(base, base + 0x400,
                                                  child->irq, PARPORT_DMA_NOFIFO,
-                                                 child->bus->self))
+                                                 &child->bus->self->dev))
                                count++;
                }
        }
@@ -199,7 +199,8 @@ static int parport_pc_find_nonpci_ports (int autoirq, int autodma)
 
                                if (parport_pc_probe_port(base, base + 0x400,
                                                          edev->irqs[0],
-                                                         count, ebus->self))
+                                                         count,
+                                                         &ebus->self->dev))
                                        count++;
                        }
                }
index f76e1492add5f34aebfb331a86de57aef81083ef..4fb8c4bfb84869bf58c302f811bdb2857aecd69d 100644 (file)
@@ -33,6 +33,8 @@ extern cpumask_t phys_cpu_present_map;
 #define cpu_possible_map phys_cpu_present_map
 
 extern cpumask_t cpu_sibling_map[NR_CPUS];
+extern cpumask_t cpu_core_map[NR_CPUS];
+extern int sparc64_multi_core;
 
 /*
  *     General functions that each host system must provide.
index e0d450d600ec2a7890cc7bca91572f8e56fd472a..290ac75f385bee443a24eb9bba11fb70783edc46 100644 (file)
@@ -1,12 +1,17 @@
 #ifndef _ASM_SPARC64_TOPOLOGY_H
 #define _ASM_SPARC64_TOPOLOGY_H
 
-#include <asm/spitfire.h>
-#define smt_capable()  (tlb_type == hypervisor)
+#ifdef CONFIG_SMP
+#define topology_physical_package_id(cpu)      (cpu_data(cpu).proc_id)
+#define topology_core_id(cpu)                  (cpu_data(cpu).core_id)
+#define topology_core_siblings(cpu)            (cpu_core_map[cpu])
+#define topology_thread_siblings(cpu)          (cpu_sibling_map[cpu])
+#define mc_capable()                           (sparc64_multi_core)
+#define smt_capable()                          (sparc64_multi_core)
+#endif /* CONFIG_SMP */
 
 #include <asm-generic/topology.h>
 
-#define topology_core_id(cpu)                  (cpu_data(cpu).core_id)
-#define topology_thread_siblings(cpu)          (cpu_sibling_map[cpu])
+#define cpu_coregroup_map(cpu)                 (cpu_core_map[cpu])
 
 #endif /* _ASM_SPARC64_TOPOLOGY_H */
index 50cee7b296f44693a65cea7751253844e12df7df..7016b893ac9d7feef84533d30475998902e53735 100644 (file)
@@ -5,6 +5,7 @@
 #include "choose-mode.h"
 
 #undef STACK_TOP
+#undef STACK_TOP_MAX
 
 extern unsigned long stacksizelim;
 
index 08b9831f2e14f1efab15d594dd594d2a326cc098..0a71e0b9a619c162235f50bdd358da0a4942ff78 100644 (file)
@@ -395,12 +395,14 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
  * bit at the same time. */
 #define  __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
 #define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
-       do {                                                              \
-               if (__dirty) {                                            \
-                       set_pte(__ptep, __entry);                         \
-                       flush_tlb_page(__vma, __address);                 \
-               }                                                         \
-       } while (0)
+({                                                                       \
+       int __changed = !pte_same(*(__ptep), __entry);                    \
+       if (__changed && __dirty) {                                       \
+               set_pte(__ptep, __entry);                                 \
+               flush_tlb_page(__vma, __address);                         \
+       }                                                                 \
+       __changed;                                                        \
+})
 
 /* Encode and de-code a swap entry */
 #define __swp_type(x)                  (((x).val >> 1) & 0x3f)
index d815649617aadb0701dee98672dd53661d9bb7d2..1c1e0d933eea8311db44907231d94a62b025c334 100644 (file)
@@ -7,7 +7,7 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (C) 2001 - 2005 Tensilica Inc.
+ * Copyright (C) 2001 - 2007 Tensilica Inc.
  */
 
 #ifndef _XTENSA_BITOPS_H
 
 #if XCHAL_HAVE_NSA
 
-static __inline__ int __cntlz (unsigned long x)
+static inline unsigned long __cntlz (unsigned long x)
 {
        int lz;
        asm ("nsau %0, %1" : "=r" (lz) : "r" (x));
-       return 31 - lz;
+       return lz;
 }
 
-#else
-
-static __inline__ int __cntlz (unsigned long x)
-{
-       unsigned long sum, x1, x2, x4, x8, x16;
-       x1  = x & 0xAAAAAAAA;
-       x2  = x & 0xCCCCCCCC;
-       x4  = x & 0xF0F0F0F0;
-       x8  = x & 0xFF00FF00;
-       x16 = x & 0xFFFF0000;
-       sum = x2 ? 2 : 0;
-       sum += (x16 != 0) * 16;
-       sum += (x8 != 0) * 8;
-       sum += (x4 != 0) * 4;
-       sum += (x1 != 0);
-
-       return sum;
-}
-
-#endif
-
 /*
  * ffz: Find first zero in word. Undefined if no zero exists.
  * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1).
  */
 
-static __inline__ int ffz(unsigned long x)
+static inline int ffz(unsigned long x)
 {
-       if ((x = ~x) == 0)
-               return 32;
-       return __cntlz(x & -x);
+       return 31 - __cntlz(~x & -~x);
 }
 
 /*
  * __ffs: Find first bit set in word. Return 0 for bit 0
  */
 
-static __inline__ int __ffs(unsigned long x)
+static inline int __ffs(unsigned long x)
 {
-       return __cntlz(x & -x);
+       return 31 - __cntlz(x & -x);
 }
 
 /*
@@ -86,9 +63,9 @@ static __inline__ int __ffs(unsigned long x)
  * differs in spirit from the above ffz (man ffs).
  */
 
-static __inline__ int ffs(unsigned long x)
+static inline int ffs(unsigned long x)
 {
-       return __cntlz(x & -x) + 1;
+       return 32 - __cntlz(x & -x);
 }
 
 /*
@@ -96,20 +73,36 @@ static __inline__ int ffs(unsigned long x)
  * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
  */
 
-static __inline__ int fls (unsigned int x)
+static inline int fls (unsigned int x)
 {
-       return __cntlz(x);
+       return 32 - __cntlz(x);
 }
+
+#else
+
+/* Use the generic implementation if we don't have the nsa/nsau instructions. */
+
+# include <asm-generic/bitops/ffs.h>
+# include <asm-generic/bitops/__ffs.h>
+# include <asm-generic/bitops/ffz.h>
+# include <asm-generic/bitops/fls.h>
+
+#endif
+
 #include <asm-generic/bitops/fls64.h>
 #include <asm-generic/bitops/find.h>
 #include <asm-generic/bitops/ext2-non-atomic.h>
 
 #ifdef __XTENSA_EL__
-# define ext2_set_bit_atomic(lock,nr,addr) test_and_set_bit((nr),(addr))
-# define ext2_clear_bit_atomic(lock,nr,addr) test_and_clear_bit((nr),(addr))
+# define ext2_set_bit_atomic(lock,nr,addr)                             \
+       test_and_set_bit((nr), (unsigned long*)(addr))
+# define ext2_clear_bit_atomic(lock,nr,addr)                           \
+       test_and_clear_bit((nr), (unsigned long*)(addr))
 #elif defined(__XTENSA_EB__)
-# define ext2_set_bit_atomic(lock,nr,addr) test_and_set_bit((nr) ^ 0x18, (addr))
-# define ext2_clear_bit_atomic(lock,nr,addr) test_and_clear_bit((nr)^0x18,(addr))
+# define ext2_set_bit_atomic(lock,nr,addr)                             \
+       test_and_set_bit((nr) ^ 0x18, (unsigned long*)(addr))
+# define ext2_clear_bit_atomic(lock,nr,addr)                           \
+       test_and_clear_bit((nr) ^ 0x18, (unsigned long*)(addr))
 #else
 # error processor byte order undefined!
 #endif
index 0f540a5f4c01c7f6ef799a9b1c997348ce3a6b22..765edf17a9a466b5497046c4c78a50185dc83a92 100644 (file)
@@ -12,6 +12,7 @@
 #define _XTENSA_BYTEORDER_H
 
 #include <asm/types.h>
+#include <linux/compiler.h>
 
 static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
 {
@@ -78,4 +79,4 @@ static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x)
 # error processor byte order undefined!
 #endif
 
-#endif /* __ASM_XTENSA_BYTEORDER_H */
+#endif /* _XTENSA_BYTEORDER_H */
index bd09ec02d57f941182f2de62a4de7476c36250d2..aa2121034558684f3f6a654b383a77bb838ae558 100644 (file)
@@ -64,6 +64,7 @@ typedef struct {
 #  define COPROCESSOR_INFO_SIZE 8
 # endif
 #endif
+#endif /* XCHAL_HAVE_CP */
 
 
 #ifndef __ASSEMBLY__
@@ -74,8 +75,11 @@ extern void save_coprocessor_registers(void*, int);
 # else
 #  define release_coprocessors(task)
 # endif
-#endif
 
-#endif
+typedef unsigned char cp_state_t[XTENSA_CP_EXTRA_SIZE]
+       __attribute__ ((aligned (XTENSA_CP_EXTRA_ALIGN)));
+
+#endif /* !__ASSEMBLY__ */
+
 
 #endif /* _XTENSA_COPROCESSOR_H */
index 20965e3af1dde6117b43811aaf9f319b9ca86c0e..f35678cb0a9b1153cb19bbe109a78d0e5f2b6d2f 100644 (file)
@@ -5,21 +5,12 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (C) 2001 - 2005 Tensilica Inc.
+ * Copyright (C) 2001 - 2007 Tensilica Inc.
  */
 
 #ifndef _XTENSA_DIV64_H
 #define _XTENSA_DIV64_H
 
-#include <linux/types.h>
+#include <asm-generic/div64.h>
 
-#define do_div(n,base) ({ \
-       int __res = n % ((unsigned int) base); \
-       n /= (unsigned int) base; \
-       __res; })
-
-static inline uint64_t div64_64(uint64_t dividend, uint64_t divisor)
-{
-       return dividend / divisor;
-}
-#endif
+#endif /* _XTENSA_DIV64_H */
index f0f9fd8560a5f905aebd43e321688e771dc572fe..1569b53cec91a38a36643480ea5a1d874cca9e1f 100644 (file)
@@ -13,7 +13,6 @@
 #ifndef _XTENSA_ELF_H
 #define _XTENSA_ELF_H
 
-#include <asm/variant/core.h>
 #include <asm/ptrace.h>
 
 /* Xtensa processor ELF architecture-magic number */
@@ -49,7 +48,7 @@ typedef struct {
        elf_greg_t lcount;
        elf_greg_t sar;
        elf_greg_t syscall;
-       elf_greg_t ar[XCHAL_NUM_AREGS];
+       elf_greg_t ar[64];
 } xtensa_gregset_t;
 
 #define ELF_NGREG      (sizeof(xtensa_gregset_t) / sizeof(elf_greg_t))
index 0609fc691b72b97b3d4511f4993788560561b964..46ab12db57397dfc44a7aa84f9c10ac5e97509d9 100644 (file)
@@ -1,99 +1 @@
-/*
- * include/asm-xtensa/fcntl.h
- *
- * 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, 1996, 1997, 1998 by Ralf Baechle
- * Copyright (C) 2001 - 2005 Tensilica Inc.
- */
-
-#ifndef _XTENSA_FCNTL_H
-#define _XTENSA_FCNTL_H
-
-/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
-   located on an ext2 file system */
-#define O_ACCMODE         0003
-#define O_RDONLY            00
-#define O_WRONLY            01
-#define O_RDWR              02
-#define O_CREAT                   0100 /* not fcntl */
-#define O_EXCL            0200 /* not fcntl */
-#define O_NOCTTY          0400 /* not fcntl */
-#define O_TRUNC                  01000 /* not fcntl */
-#define O_APPEND         02000
-#define O_NONBLOCK       04000
-#define O_NDELAY       O_NONBLOCK
-#define O_SYNC          010000
-#define FASYNC          020000 /* fcntl, for BSD compatibility */
-#define O_DIRECT        040000 /* direct disk access hint */
-#define O_LARGEFILE    0100000
-#define O_DIRECTORY    0200000 /* must be a directory */
-#define O_NOFOLLOW     0400000 /* don't follow links */
-#define O_NOATIME      01000000
-
-#define F_DUPFD                0       /* dup */
-#define F_GETFD                1       /* get close_on_exec */
-#define F_SETFD                2       /* set/clear close_on_exec */
-#define F_GETFL                3       /* get file->f_flags */
-#define F_SETFL                4       /* set file->f_flags */
-#define F_GETLK                5
-#define F_SETLK                6
-#define F_SETLKW       7
-
-#define F_SETOWN       8       /*  for sockets. */
-#define F_GETOWN       9       /*  for sockets. */
-#define F_SETSIG       10      /*  for sockets. */
-#define F_GETSIG       11      /*  for sockets. */
-
-#define F_GETLK64      12      /*  using 'struct flock64' */
-#define F_SETLK64      13
-#define F_SETLKW64     14
-
-/* for F_[GET|SET]FL */
-#define FD_CLOEXEC     1       /* actually anything with low bit set goes */
-
-/* for posix fcntl() and lockf() */
-#define F_RDLCK                0
-#define F_WRLCK                1
-#define F_UNLCK                2
-
-/* for old implementation of bsd flock () */
-#define F_EXLCK                4       /* or 3 */
-#define F_SHLCK                8       /* or 4 */
-
-/* for leases */
-#define F_INPROGRESS   16
-
-/* operations for bsd flock(), also used by the kernel implementation */
-#define LOCK_SH                1       /* shared lock */
-#define LOCK_EX                2       /* exclusive lock */
-#define LOCK_NB                4       /* or'd with one of the above to prevent
-                                  blocking */
-#define LOCK_UN                8       /* remove lock */
-
-#define LOCK_MAND      32      /* This is a mandatory flock */
-#define LOCK_READ      64      /* ... Which allows concurrent read operations */
-#define LOCK_WRITE     128     /* ... Which allows concurrent write operations */
-#define LOCK_RW                192     /* ... Which allows concurrent read & write ops */
-
-struct flock {
-       short l_type;
-       short l_whence;
-       off_t l_start;
-       off_t l_len;
-       pid_t l_pid;
-};
-
-struct flock64 {
-       short  l_type;
-       short  l_whence;
-       loff_t l_start;
-       loff_t l_len;
-       pid_t  l_pid;
-};
-
-#define F_LINUX_SPECIFIC_BASE  1024
-
-#endif /* _XTENSA_FCNTL_H */
+#include <asm-generic/fcntl.h>
index 92f948392ebccede88123965b1d71bd91c1a48ca..c0fd8e5b4513562ee5d9884108fbb1723ed7cd8d 100644 (file)
@@ -14,6 +14,7 @@
 #define _XTENSA_MMU_CONTEXT_H
 
 #include <linux/stringify.h>
+#include <linux/sched.h>
 
 #include <asm/pgtable.h>
 #include <asm/cacheflush.h>
index c631d006194b476db9d4f307a3e034f20625aa60..1213cde7543803d813f6a87c261525936138b07f 100644 (file)
@@ -131,6 +131,6 @@ void copy_user_page(void *to,void* from,unsigned long vaddr,struct page* page);
 #define VM_DATA_DEFAULT_FLAGS  (VM_READ | VM_WRITE | VM_EXEC | \
                                 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 
-#endif /* __KERNEL__ */
 #include <asm-generic/memory_model.h>
+#endif /* __KERNEL__ */
 #endif /* _XTENSA_PAGE_H */
index 6f281392e3f854fc0589b104f9d188f3c4210e3a..ce3a336cad07c188ebe7dc10805c2d6c060212a8 100644 (file)
 #ifndef _XTENSA_PARAM_H
 #define _XTENSA_PARAM_H
 
-#include <asm/variant/core.h>
-
 #ifdef __KERNEL__
 # define HZ            100             /* internal timer frequency */
 # define USER_HZ       100             /* for user interfaces in "ticks" */
 # define CLOCKS_PER_SEC (USER_HZ)      /* frequnzy at which times() counts */
 #endif
 
-#define EXEC_PAGESIZE  (1 << XCHAL_MMU_MIN_PTE_PAGE_SIZE)
+#define EXEC_PAGESIZE  4096
 
 #ifndef NGROUPS
 #define NGROUPS                32
index 1b7fe363fad1ea4dda17622cab04471ba5f344a4..77ff02d307bba119141aacfa733d51f01c137168 100644 (file)
@@ -11,8 +11,6 @@
 #ifndef _XTENSA_PTRACE_H
 #define _XTENSA_PTRACE_H
 
-#include <asm/variant/core.h>
-
 /*
  * Kernel stack
  *
@@ -101,7 +99,8 @@ struct pt_regs {
        unsigned long windowbase;       /*  48 */
        unsigned long windowstart;      /*  52 */
        unsigned long syscall;          /*  56 */
-       int reserved[2];                /*  64 */
+       unsigned long icountlevel;      /*  60 */
+       int reserved[1];                /*  64 */
 
        /* Make sure the areg field is 16 bytes aligned. */
        int align[0] __attribute__ ((aligned(16)));
@@ -113,6 +112,9 @@ struct pt_regs {
 };
 
 #ifdef __KERNEL__
+
+#include <asm/variant/core.h>
+
 # define task_pt_regs(tsk) ((struct pt_regs*) \
   (task_stack_page(tsk) + KERNEL_STACK_SIZE - (XCHAL_NUM_AREGS-16)*4) - 1)
 # define user_mode(regs) (((regs)->ps & 0x00000020)!=0)
index d3b65bfa71c3b7314ddf3b8cfc6e451696a85f77..c8cc16c3da9e68f8e409eed03db985298a9eca07 100644 (file)
@@ -9,8 +9,6 @@
 #ifndef _XTENSA_SHMPARAM_H
 #define _XTENSA_SHMPARAM_H
 
-#include <asm/processor.h>
-
 /*
  * Xtensa can have variable size caches, and if
  * the size of single way is larger than the page size,
index a75177291418d5302c72ca2c032a560c90ac23dc..e3381cee5059ae9946f3c53044c8fcac45276651 100644 (file)
@@ -5,21 +5,12 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (C) 2001 - 2003 Tensilica Inc.
+ * Copyright (C) 2001 - 2007 Tensilica Inc.
  */
 
 #ifndef _XTENSA_SIGCONTEXT_H
 #define _XTENSA_SIGCONTEXT_H
 
-#define _ASMLANGUAGE
-#include <asm/processor.h>
-#include <asm/coprocessor.h>
-
-
-struct _cpstate {
-       unsigned char _cpstate[XTENSA_CP_EXTRA_SIZE];
-} __attribute__ ((aligned (XTENSA_CP_EXTRA_ALIGN)));
-
 
 struct sigcontext {
        unsigned long   oldmask;
@@ -27,18 +18,13 @@ struct sigcontext {
        /* CPU registers */
        unsigned long sc_pc;
        unsigned long sc_ps;
-       unsigned long sc_wmask;
-       unsigned long sc_windowbase;
-       unsigned long sc_windowstart;
        unsigned long sc_lbeg;
        unsigned long sc_lend;
        unsigned long sc_lcount;
        unsigned long sc_sar;
-       unsigned long sc_depc;
-       unsigned long sc_dareg0;
-       unsigned long sc_treg[4];
-       unsigned long sc_areg[XCHAL_NUM_AREGS];
-       struct _cpstate *sc_cpstate;
+       unsigned long sc_acclo;
+       unsigned long sc_acchi;
+       unsigned long sc_a[16];
 };
 
-#endif /* __ASM_XTENSA_SIGCONTEXT_H */
+#endif /* _XTENSA_SIGCONTEXT_H */
index 5ae34ab715972a812ef81a8e634e18d8ea50b776..3fa29799b435302e3ca7ddfd4131c4f51d6b2545 100644 (file)
@@ -116,6 +116,7 @@ static inline struct thread_info *current_thread_info(void)
 #define TIF_SINGLESTEP         4       /* restore singlestep on return to user mode */
 #define TIF_IRET               5       /* return with iret */
 #define TIF_MEMDIE             6
+#define TIF_RESTORE_SIGMASK    7       /* restore signal mask in do_signal() */
 #define TIF_POLLING_NRFLAG     16      /* true if poll_idle() is polling TIF_NEED_RESCHED */
 
 #define _TIF_SYSCALL_TRACE     (1<<TIF_SYSCALL_TRACE)
@@ -125,6 +126,7 @@ static inline struct thread_info *current_thread_info(void)
 #define _TIF_SINGLESTEP                (1<<TIF_SINGLESTEP)
 #define _TIF_IRET              (1<<TIF_IRET)
 #define _TIF_POLLING_NRFLAG    (1<<TIF_POLLING_NRFLAG)
+#define _TIF_RESTORE_SIGMASK   (1<<TIF_RESTORE_SIGMASK)
 
 #define _TIF_WORK_MASK         0x0000FFFE      /* work to do on interrupt/exception return */
 #define _TIF_ALLWORK_MASK      0x0000FFFF      /* work to do on any return to u-space */
index 8a7fb6964ce144319576ce856cfd4d16284abf68..9bd34024431c12a2b7cace88e566402fa7334828 100644 (file)
@@ -485,8 +485,8 @@ __SYSCALL(217, sys_sched_get_priority_min, 1)
 __SYSCALL(218, sys_sched_rr_get_interval, 2)
 #define __NR_sched_yield                       219
 __SYSCALL(219, sys_sched_yield, 0)
-#define __NR_sigreturn                         222
-__SYSCALL(222, xtensa_sigreturn, 0)
+#define __NR_available222                      222
+__SYSCALL(222, sys_ni_syscall, 0)
 
 /* Signal Handling */
 
index edb31bfff68fb3586097173f5dc61b7b215333ab..703febb2df31e248243e7017b6a34828ec23128a 100644 (file)
@@ -151,6 +151,7 @@ enum {
        ATA_CMD_WRITE_MULTI_EXT = 0x39,
        ATA_CMD_WRITE_MULTI_FUA_EXT = 0xCE,
        ATA_CMD_SET_FEATURES    = 0xEF,
+       ATA_CMD_SET_MULTI       = 0xC6,
        ATA_CMD_PACKET          = 0xA0,
        ATA_CMD_VERIFY          = 0x40,
        ATA_CMD_VERIFY_EXT      = 0x42,
@@ -249,7 +250,7 @@ enum ata_tf_protocols {
        /* ATA taskfile protocols */
        ATA_PROT_UNKNOWN,       /* unknown/invalid */
        ATA_PROT_NODATA,        /* no data */
-       ATA_PROT_PIO,           /* PIO single sector */
+       ATA_PROT_PIO,           /* PIO data xfer */
        ATA_PROT_DMA,           /* DMA */
        ATA_PROT_NCQ,           /* NCQ */
        ATA_PROT_ATAPI,         /* packet command, PIO data xfer*/
index a461f76fb004e874f38ec245c6a6834b333a5004..dc77fed7b28566c585ccc2193f14dfdea8227421 100644 (file)
@@ -9,6 +9,9 @@
  * to achieve effects such as fast scrolling by changing the origin.
  */
 
+#ifndef _LINUX_CONSOLE_STRUCT_H
+#define _LINUX_CONSOLE_STRUCT_H
+
 #include <linux/wait.h>
 #include <linux/vt.h>
 #include <linux/workqueue.h>
@@ -130,3 +133,5 @@ extern void vc_SAK(struct work_struct *work);
 #define CUR_DEFAULT CUR_UNDERLINE
 
 #define CON_IS_VISIBLE(conp) (*conp->vc_display_fg == conp)
+
+#endif /* _LINUX_CONSOLE_STRUCT_H */
index b4570b62ab8557d9748f7887b878bb341b87c553..2c13715e9ddea9f643c6a66c613ffcabee091f1c 100644 (file)
@@ -163,7 +163,7 @@ static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb)
 
 extern const struct file_operations hugetlbfs_file_operations;
 extern struct vm_operations_struct hugetlb_vm_ops;
-struct file *hugetlb_zero_setup(size_t);
+struct file *hugetlb_file_setup(const char *name, size_t);
 int hugetlb_get_quota(struct address_space *mapping);
 void hugetlb_put_quota(struct address_space *mapping);
 
@@ -185,7 +185,7 @@ static inline void set_file_hugepages(struct file *file)
 
 #define is_file_hugepages(file)                0
 #define set_file_hugepages(file)       BUG()
-#define hugetlb_zero_setup(size)       ERR_PTR(-ENOSYS)
+#define hugetlb_file_setup(name,size)  ERR_PTR(-ENOSYS)
 
 #endif /* !CONFIG_HUGETLBFS */
 
index 6269b1ae892d7fab3b0523bf9d31cd273a00423f..202cdaaee8c339f2ed98d0d561ad67c81b107890 100644 (file)
 #define I2C_DRIVERID_WM8750            90      /* Wolfson WM8750 audio codec */
 #define I2C_DRIVERID_WM8753            91      /* Wolfson WM8753 audio codec */
 
-#define I2C_DRIVERID_MISC      99      /* Whatever until sorted out    */
+#define I2C_DRIVERID_MISC      99      /* Whatever until sorted out    */
 
 #define I2C_DRIVERID_I2CDEV    900
 #define I2C_DRIVERID_ARP        902    /* SMBus ARP Client              */
index 07aba87d369db7d87c781ab5ebe66eda07985875..1e365acdd36922dafcfc0a8b287a5368c5b9c9c2 100644 (file)
@@ -1001,6 +1001,7 @@ struct ide_driver_s {
        struct device_driver    gen_driver;
        int             (*probe)(ide_drive_t *);
        void            (*remove)(ide_drive_t *);
+       void            (*resume)(ide_drive_t *);
        void            (*shutdown)(ide_drive_t *);
 #ifdef CONFIG_IDE_PROC_FS
        ide_proc_entry_t        *proc;
index c0f7aec331c2031f3aa0f1c89db00a7b0b14b699..ae04901aa09a838bef2a20674848f7cb5c72e5fe 100644 (file)
@@ -3,6 +3,7 @@
 
 #ifdef __KERNEL__
 
+#include <linux/bitmap.h>
 #include <linux/if.h>
 #include <linux/netdevice.h>
 #include <linux/rcupdate.h>
 
 struct ipv4_devconf
 {
-       int     accept_redirects;
-       int     send_redirects;
-       int     secure_redirects;
-       int     shared_media;
-       int     accept_source_route;
-       int     rp_filter;
-       int     proxy_arp;
-       int     bootp_relay;
-       int     log_martians;
-       int     forwarding;
-       int     mc_forwarding;
-       int     tag;
-       int     arp_filter;
-       int     arp_announce;
-       int     arp_ignore;
-       int     arp_accept;
-       int     medium_id;
-       int     no_xfrm;
-       int     no_policy;
-       int     force_igmp_version;
-       int     promote_secondaries;
        void    *sysctl;
+       int     data[__NET_IPV4_CONF_MAX - 1];
+       DECLARE_BITMAP(state, __NET_IPV4_CONF_MAX - 1);
 };
 
 extern struct ipv4_devconf ipv4_devconf;
@@ -60,30 +42,70 @@ struct in_device
        struct rcu_head         rcu_head;
 };
 
-#define IN_DEV_FORWARD(in_dev)         ((in_dev)->cnf.forwarding)
-#define IN_DEV_MFORWARD(in_dev)                (ipv4_devconf.mc_forwarding && (in_dev)->cnf.mc_forwarding)
-#define IN_DEV_RPFILTER(in_dev)                (ipv4_devconf.rp_filter && (in_dev)->cnf.rp_filter)
-#define IN_DEV_SOURCE_ROUTE(in_dev)    (ipv4_devconf.accept_source_route && (in_dev)->cnf.accept_source_route)
-#define IN_DEV_BOOTP_RELAY(in_dev)     (ipv4_devconf.bootp_relay && (in_dev)->cnf.bootp_relay)
-
-#define IN_DEV_LOG_MARTIANS(in_dev)    (ipv4_devconf.log_martians || (in_dev)->cnf.log_martians)
-#define IN_DEV_PROXY_ARP(in_dev)       (ipv4_devconf.proxy_arp || (in_dev)->cnf.proxy_arp)
-#define IN_DEV_SHARED_MEDIA(in_dev)    (ipv4_devconf.shared_media || (in_dev)->cnf.shared_media)
-#define IN_DEV_TX_REDIRECTS(in_dev)    (ipv4_devconf.send_redirects || (in_dev)->cnf.send_redirects)
-#define IN_DEV_SEC_REDIRECTS(in_dev)   (ipv4_devconf.secure_redirects || (in_dev)->cnf.secure_redirects)
-#define IN_DEV_IDTAG(in_dev)           ((in_dev)->cnf.tag)
-#define IN_DEV_MEDIUM_ID(in_dev)       ((in_dev)->cnf.medium_id)
-#define IN_DEV_PROMOTE_SECONDARIES(in_dev)     (ipv4_devconf.promote_secondaries || (in_dev)->cnf.promote_secondaries)
+#define IPV4_DEVCONF(cnf, attr) ((cnf).data[NET_IPV4_CONF_ ## attr - 1])
+#define IPV4_DEVCONF_ALL(attr) IPV4_DEVCONF(ipv4_devconf, attr)
+
+static inline int ipv4_devconf_get(struct in_device *in_dev, int index)
+{
+       index--;
+       return in_dev->cnf.data[index];
+}
+
+static inline void ipv4_devconf_set(struct in_device *in_dev, int index,
+                                   int val)
+{
+       index--;
+       set_bit(index, in_dev->cnf.state);
+       in_dev->cnf.data[index] = val;
+}
+
+static inline void ipv4_devconf_setall(struct in_device *in_dev)
+{
+       bitmap_fill(in_dev->cnf.state, __NET_IPV4_CONF_MAX - 1);
+}
+
+#define IN_DEV_CONF_GET(in_dev, attr) \
+       ipv4_devconf_get((in_dev), NET_IPV4_CONF_ ## attr)
+#define IN_DEV_CONF_SET(in_dev, attr, val) \
+       ipv4_devconf_set((in_dev), NET_IPV4_CONF_ ## attr, (val))
+
+#define IN_DEV_ANDCONF(in_dev, attr) \
+       (IPV4_DEVCONF_ALL(attr) && IN_DEV_CONF_GET((in_dev), attr))
+#define IN_DEV_ORCONF(in_dev, attr) \
+       (IPV4_DEVCONF_ALL(attr) || IN_DEV_CONF_GET((in_dev), attr))
+#define IN_DEV_MAXCONF(in_dev, attr) \
+       (max(IPV4_DEVCONF_ALL(attr), IN_DEV_CONF_GET((in_dev), attr)))
+
+#define IN_DEV_FORWARD(in_dev)         IN_DEV_CONF_GET((in_dev), FORWARDING)
+#define IN_DEV_MFORWARD(in_dev)                (IPV4_DEVCONF_ALL(MC_FORWARDING) && \
+                                        IPV4_DEVCONF((in_dev)->cnf, \
+                                                     MC_FORWARDING))
+#define IN_DEV_RPFILTER(in_dev)                IN_DEV_ANDCONF((in_dev), RP_FILTER)
+#define IN_DEV_SOURCE_ROUTE(in_dev)    IN_DEV_ANDCONF((in_dev), \
+                                                      ACCEPT_SOURCE_ROUTE)
+#define IN_DEV_BOOTP_RELAY(in_dev)     IN_DEV_ANDCONF((in_dev), BOOTP_RELAY)
+
+#define IN_DEV_LOG_MARTIANS(in_dev)    IN_DEV_ORCONF((in_dev), LOG_MARTIANS)
+#define IN_DEV_PROXY_ARP(in_dev)       IN_DEV_ORCONF((in_dev), PROXY_ARP)
+#define IN_DEV_SHARED_MEDIA(in_dev)    IN_DEV_ORCONF((in_dev), SHARED_MEDIA)
+#define IN_DEV_TX_REDIRECTS(in_dev)    IN_DEV_ORCONF((in_dev), SEND_REDIRECTS)
+#define IN_DEV_SEC_REDIRECTS(in_dev)   IN_DEV_ORCONF((in_dev), \
+                                                     SECURE_REDIRECTS)
+#define IN_DEV_IDTAG(in_dev)           IN_DEV_CONF_GET(in_dev, TAG)
+#define IN_DEV_MEDIUM_ID(in_dev)       IN_DEV_CONF_GET(in_dev, MEDIUM_ID)
+#define IN_DEV_PROMOTE_SECONDARIES(in_dev) \
+                                       IN_DEV_ORCONF((in_dev), \
+                                                     PROMOTE_SECONDARIES)
 
 #define IN_DEV_RX_REDIRECTS(in_dev) \
        ((IN_DEV_FORWARD(in_dev) && \
-         (ipv4_devconf.accept_redirects && (in_dev)->cnf.accept_redirects)) \
+         IN_DEV_ANDCONF((in_dev), ACCEPT_REDIRECTS)) \
         || (!IN_DEV_FORWARD(in_dev) && \
-         (ipv4_devconf.accept_redirects || (in_dev)->cnf.accept_redirects)))
+         IN_DEV_ORCONF((in_dev), ACCEPT_REDIRECTS)))
 
-#define IN_DEV_ARPFILTER(in_dev)       (ipv4_devconf.arp_filter || (in_dev)->cnf.arp_filter)
-#define IN_DEV_ARP_ANNOUNCE(in_dev)    (max(ipv4_devconf.arp_announce, (in_dev)->cnf.arp_announce))
-#define IN_DEV_ARP_IGNORE(in_dev)      (max(ipv4_devconf.arp_ignore, (in_dev)->cnf.arp_ignore))
+#define IN_DEV_ARPFILTER(in_dev)       IN_DEV_ORCONF((in_dev), ARPFILTER)
+#define IN_DEV_ARP_ANNOUNCE(in_dev)    IN_DEV_MAXCONF((in_dev), ARP_ANNOUNCE)
+#define IN_DEV_ARP_IGNORE(in_dev)      IN_DEV_MAXCONF((in_dev), ARP_IGNORE)
 
 struct in_ifaddr
 {
@@ -108,7 +130,6 @@ extern struct net_device    *ip_dev_find(__be32 addr);
 extern int             inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b);
 extern int             devinet_ioctl(unsigned int cmd, void __user *);
 extern void            devinet_init(void);
-extern struct in_device *inetdev_init(struct net_device *dev);
 extern struct in_device        *inetdev_by_index(int);
 extern __be32          inet_select_addr(const struct net_device *dev, __be32 dst, int scope);
 extern __be32          inet_confirm_addr(const struct net_device *dev, __be32 dst, __be32 local, int scope);
index 45353d757cd0f1ca57cc266aaf228c549fcfbf48..7a485250591491089549455a60c944aa4be0a5ff 100644 (file)
@@ -218,10 +218,14 @@ enum {
        DUMP_PREFIX_ADDRESS,
        DUMP_PREFIX_OFFSET
 };
-extern void hex_dump_to_buffer(const void *buf, size_t len, char *linebuf,
-                               size_t linebuflen);
-extern void print_hex_dump(const char *level, int prefix_type,
-                               void *buf, size_t len);
+extern void hex_dump_to_buffer(const void *buf, size_t len,
+                               int rowsize, int groupsize,
+                               char *linebuf, size_t linebuflen, bool ascii);
+extern void print_hex_dump(const char *level, const char *prefix_str,
+                               int prefix_type, int rowsize, int groupsize,
+                               void *buf, size_t len, bool ascii);
+extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
+                       void *buf, size_t len);
 #define hex_asc(x)     "0123456789abcdef"[x]
 
 #ifdef DEBUG
index c762954bda148fa18ab13f6d1f71aab26d2e3441..2b139f66027f3de7ae5f1a60df00ddf39c8cb147 100644 (file)
@@ -261,6 +261,18 @@ static inline s64 ktime_to_ns(const ktime_t kt)
 
 #endif
 
+/**
+ * ktime_equal - Compares two ktime_t variables to see if they are equal
+ * @cmp1:      comparable1
+ * @cmp2:      comparable2
+ *
+ * Compare two ktime_t variables, returns 1 if equal
+ */
+static inline int ktime_equal(const ktime_t cmp1, const ktime_t cmp2)
+{
+       return cmp1.tv64 == cmp2.tv64;
+}
+
 static inline s64 ktime_to_us(const ktime_t kt)
 {
        struct timeval tv = ktime_to_timeval(kt);
index a6a3113120a482f1174d50bcb00c9e7dab522ca6..745c4f9b4caafab27c1299268cf4eb363d7e7d7f 100644 (file)
@@ -753,6 +753,7 @@ extern u8 ata_check_status(struct ata_port *ap);
 extern u8 ata_altstatus(struct ata_port *ap);
 extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf);
 extern int ata_port_start (struct ata_port *ap);
+extern int ata_sff_port_start (struct ata_port *ap);
 extern irqreturn_t ata_interrupt (int irq, void *dev_instance);
 extern void ata_data_xfer(struct ata_device *adev, unsigned char *buf,
                          unsigned int buflen, int write_data);
index 2f46dd728ee1fa9596e4a491782543fc44946012..e992cd6b28f57798e17d4e3c7f7aa9c81554da01 100644 (file)
@@ -264,6 +264,26 @@ ipt_get_target(struct ipt_entry *e)
        __ret;                                                  \
 })
 
+/* fn returns 0 to continue iteration */
+#define IPT_ENTRY_ITERATE_CONTINUE(entries, size, n, fn, args...) \
+({                                                             \
+       unsigned int __i, __n;                                  \
+       int __ret = 0;                                          \
+       struct ipt_entry *__entry;                              \
+                                                               \
+       for (__i = 0, __n = 0; __i < (size);                    \
+            __i += __entry->next_offset, __n++) {              \
+               __entry = (void *)(entries) + __i;              \
+               if (__n < n)                                    \
+                       continue;                               \
+                                                               \
+               __ret = fn(__entry , ## args);                  \
+               if (__ret != 0)                                 \
+                       break;                                  \
+       }                                                       \
+       __ret;                                                  \
+})
+
 /*
  *     Main firewall chains definitions and global var's definitions.
  */
index 6a115cffea34b51ba2e6aef8e52f2013a6edd97a..9a03b47da603526dc07c29a32c92c6c53d53f6af 100644 (file)
 #define PCI_DEVICE_ID_NVIDIA_NVENET_26              0x054E
 #define PCI_DEVICE_ID_NVIDIA_NVENET_27              0x054F
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE       0x0560
+#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE       0x056C
+#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE       0x0759
 
 #define PCI_VENDOR_ID_IMS              0x10e0
 #define PCI_DEVICE_ID_IMS_TT128                0x9128
index 8bcbc54e1b488213fceff419d0d364cc74b61c43..c8884f9712285b25cc88ff7518c2e0b79e0bcb39 100644 (file)
@@ -16,6 +16,21 @@ struct pipe_buffer {
        unsigned int flags;
 };
 
+struct pipe_inode_info {
+       wait_queue_head_t wait;
+       unsigned int nrbufs, curbuf;
+       struct page *tmp_page;
+       unsigned int readers;
+       unsigned int writers;
+       unsigned int waiting_writers;
+       unsigned int r_counter;
+       unsigned int w_counter;
+       struct fasync_struct *fasync_readers;
+       struct fasync_struct *fasync_writers;
+       struct inode *inode;
+       struct pipe_buffer bufs[PIPE_BUFFERS];
+};
+
 /*
  * Note on the nesting of these functions:
  *
@@ -38,21 +53,6 @@ struct pipe_buf_operations {
        void (*get)(struct pipe_inode_info *, struct pipe_buffer *);
 };
 
-struct pipe_inode_info {
-       wait_queue_head_t wait;
-       unsigned int nrbufs, curbuf;
-       struct page *tmp_page;
-       unsigned int readers;
-       unsigned int writers;
-       unsigned int waiting_writers;
-       unsigned int r_counter;
-       unsigned int w_counter;
-       struct fasync_struct *fasync_readers;
-       struct fasync_struct *fasync_writers;
-       struct inode *inode;
-       struct pipe_buffer bufs[PIPE_BUFFERS];
-};
-
 /* Differs from PIPE_BUF in that PIPE_SIZE is the length of the actual
    memory allocation, whereas PIPE_BUF makes atomicity guarantees.  */
 #define PIPE_SIZE              PAGE_SIZE
index 7c1ffbab78657a105018ffd2c71b8871496255f4..a8a6ea809da096d19fbb0d164c986be671dcef12 100644 (file)
@@ -63,7 +63,7 @@ enum rfkill_state {
  * This structure represents a RF switch located on a network device.
  */
 struct rfkill {
-       char *name;
+       const char *name;
        enum rfkill_type type;
 
        enum rfkill_state state;
index d58e74b98367c756e488b1ce3cf88903e078b7e0..693f0e6c54d47595c6f3268d0e20b5de74303d90 100644 (file)
@@ -1162,6 +1162,7 @@ static inline void put_task_struct(struct task_struct *t)
                                        /* Not implemented yet, only for 486*/
 #define PF_STARTING    0x00000002      /* being created */
 #define PF_EXITING     0x00000004      /* getting shut down */
+#define PF_EXITPIDONE  0x00000008      /* pi exit done on shut down */
 #define PF_FORKNOEXEC  0x00000040      /* forked but didn't exec */
 #define PF_SUPERPRIV   0x00000100      /* used super-user privileges */
 #define PF_DUMPCORE    0x00000200      /* dumped core */
index e7367c74e1bbedbca7c81ad69215d0e751deb9bb..6f0b2f7d00108835253403dc5f74039b49e3d002 100644 (file)
@@ -1579,6 +1579,10 @@ static inline ktime_t net_timedelta(ktime_t t)
        return ktime_sub(ktime_get_real(), t);
 }
 
+static inline ktime_t net_invalid_timestamp(void)
+{
+       return ktime_set(0, 0);
+}
 
 extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len);
 extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
index 0764c829d967ab8c1841cddf79ba51204956e4a8..6207a3d8da7150abbb8c1361331b5f4945162b66 100644 (file)
@@ -28,7 +28,7 @@ struct kmem_cache {
        int size;               /* The size of an object including meta data */
        int objsize;            /* The size of an object without meta data */
        int offset;             /* Free pointer offset. */
-       unsigned int order;
+       int order;
 
        /*
         * Avoid an extra cache line for UP, SMP and for the node local to
@@ -56,7 +56,13 @@ struct kmem_cache {
 /*
  * Kmalloc subsystem.
  */
-#define KMALLOC_SHIFT_LOW 3
+#if defined(ARCH_KMALLOC_MINALIGN) && ARCH_KMALLOC_MINALIGN > 8
+#define KMALLOC_MIN_SIZE ARCH_KMALLOC_MINALIGN
+#else
+#define KMALLOC_MIN_SIZE 8
+#endif
+
+#define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE)
 
 /*
  * We keep the general caches in an array of slab caches that are used for
@@ -70,15 +76,15 @@ extern struct kmem_cache kmalloc_caches[KMALLOC_SHIFT_HIGH + 1];
  */
 static inline int kmalloc_index(size_t size)
 {
-       /*
-        * We should return 0 if size == 0 but we use the smallest object
-        * here for SLAB legacy reasons.
-        */
-       WARN_ON_ONCE(size == 0);
+       if (!size)
+               return 0;
 
        if (size > KMALLOC_MAX_SIZE)
                return -1;
 
+       if (size <= KMALLOC_MIN_SIZE)
+               return KMALLOC_SHIFT_LOW;
+
        if (size > 64 && size <= 96)
                return 1;
        if (size > 128 && size <= 192)
@@ -153,13 +159,25 @@ static inline struct kmem_cache *kmalloc_slab(size_t size)
 #define SLUB_DMA 0
 #endif
 
+
+/*
+ * ZERO_SIZE_PTR will be returned for zero sized kmalloc requests.
+ *
+ * Dereferencing ZERO_SIZE_PTR will lead to a distinct access fault.
+ *
+ * ZERO_SIZE_PTR can be passed to kfree though in the same way that NULL can.
+ * Both make kfree a no-op.
+ */
+#define ZERO_SIZE_PTR ((void *)16)
+
+
 static inline void *kmalloc(size_t size, gfp_t flags)
 {
        if (__builtin_constant_p(size) && !(flags & SLUB_DMA)) {
                struct kmem_cache *s = kmalloc_slab(size);
 
                if (!s)
-                       return NULL;
+                       return ZERO_SIZE_PTR;
 
                return kmem_cache_alloc(s, flags);
        } else
@@ -172,7 +190,7 @@ static inline void *kzalloc(size_t size, gfp_t flags)
                struct kmem_cache *s = kmalloc_slab(size);
 
                if (!s)
-                       return NULL;
+                       return ZERO_SIZE_PTR;
 
                return kmem_cache_zalloc(s, flags);
        } else
@@ -188,7 +206,7 @@ static inline void *kmalloc_node(size_t size, gfp_t flags, int node)
                struct kmem_cache *s = kmalloc_slab(size);
 
                if (!s)
-                       return NULL;
+                       return ZERO_SIZE_PTR;
 
                return kmem_cache_alloc_node(s, flags, node);
        } else
index b6bedc3ee95c8f80fb9be6a6ad413f10c7f67a82..1be5ea0594771c0a49956d117109c810d0a7bdf6 100644 (file)
@@ -341,9 +341,14 @@ extern struct spi_master *spi_busnum_to_master(u16 busnum);
  * chip transactions together.
  *
  * (ii) When the transfer is the last one in the message, the chip may
- * stay selected until the next transfer.  This is purely a performance
- * hint; the controller driver may need to select a different device
- * for the next message.
+ * stay selected until the next transfer.  On multi-device SPI busses
+ * with nothing blocking messages going to other devices, this is just
+ * a performance hint; starting a message to another device deselects
+ * this one.  But in other cases, this can be used to ensure correctness.
+ * Some devices need protocol transactions to be built from a series of
+ * spi_message submissions, where the content of one message is determined
+ * by the results of previous messages and where the whole transaction
+ * ends when the chipselect goes intactive.
  *
  * The code that submits an spi_message (and its spi_transfers)
  * to the lower layers is responsible for managing its memory.
@@ -480,14 +485,15 @@ static inline void spi_message_free(struct spi_message *m)
 /**
  * spi_setup - setup SPI mode and clock rate
  * @spi: the device whose settings are being modified
- * Context: can sleep
+ * Context: can sleep, and no requests are queued to the device
  *
  * SPI protocol drivers may need to update the transfer mode if the
- * device doesn't work with the mode 0 default.  They may likewise need
+ * device doesn't work with its default.  They may likewise need
  * to update clock rates or word sizes from initial values.  This function
  * changes those settings, and must be called from a context that can sleep.
- * The changes take effect the next time the device is selected and data
- * is transferred to or from it.
+ * Except for SPI_CS_HIGH, which takes effect immediately, the changes take
+ * effect the next time the device is selected and data is transferred to
+ * or from it.  When this function returns, the spi device is deselected.
  *
  * Note that this call will fail if the protocol driver specifies an option
  * that the underlying controller or its driver does not support.  For
index e7560389079ceb0980b057eb9290c5429a746b3d..d16a2b57dc8105806a07afa5e97e843cd0844274 100644 (file)
@@ -243,8 +243,7 @@ struct v4l2_capability
 #define V4L2_CAP_SLICED_VBI_CAPTURE    0x00000040  /* Is a sliced VBI capture device */
 #define V4L2_CAP_SLICED_VBI_OUTPUT     0x00000080  /* Is a sliced VBI output device */
 #define V4L2_CAP_RDS_CAPTURE           0x00000100  /* RDS data capture */
-#define V4L2_CAP_VIDEO_OUTPUT_POS       0x00000200  /* Video output can have x,y coords */
-#define V4L2_CAP_VIDEO_OUTPUT_OVERLAY  0x00000400  /* Can do video output overlay */
+#define V4L2_CAP_VIDEO_OUTPUT_OVERLAY  0x00000200  /* Can do video output overlay */
 
 #define V4L2_CAP_TUNER                 0x00010000  /* has a tuner */
 #define V4L2_CAP_AUDIO                 0x00020000  /* has audio support */
@@ -616,12 +615,16 @@ struct v4l2_framebuffer
 #define V4L2_FBUF_CAP_BITMAP_CLIPPING  0x0008
 #define V4L2_FBUF_CAP_LOCAL_ALPHA      0x0010
 #define V4L2_FBUF_CAP_GLOBAL_ALPHA     0x0020
+#define V4L2_FBUF_CAP_LOCAL_INV_ALPHA  0x0040
+#define V4L2_FBUF_CAP_GLOBAL_INV_ALPHA 0x0080
 /*  Flags for the 'flags' field. */
 #define V4L2_FBUF_FLAG_PRIMARY         0x0001
 #define V4L2_FBUF_FLAG_OVERLAY         0x0002
 #define V4L2_FBUF_FLAG_CHROMAKEY       0x0004
 #define V4L2_FBUF_FLAG_LOCAL_ALPHA     0x0008
 #define V4L2_FBUF_FLAG_GLOBAL_ALPHA    0x0010
+#define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020
+#define V4L2_FBUF_FLAG_GLOBAL_INV_ALPHA        0x0040
 
 struct v4l2_clip
 {
index 4f90f5554faccc3bad4dce9d028cb58be3cbe9eb..a6bb94530cfddfbd0e8d3bd10880fdfcd8c996b5 100644 (file)
@@ -203,12 +203,10 @@ static inline int cipso_v4_cache_add(const struct sk_buff *skb,
 
 #ifdef CONFIG_NETLABEL
 void cipso_v4_error(struct sk_buff *skb, int error, u32 gateway);
-int cipso_v4_socket_setattr(const struct socket *sock,
-                           const struct cipso_v4_doi *doi_def,
-                           const struct netlbl_lsm_secattr *secattr);
+int cipso_v4_sock_setattr(struct sock *sk,
+                         const struct cipso_v4_doi *doi_def,
+                         const struct netlbl_lsm_secattr *secattr);
 int cipso_v4_sock_getattr(struct sock *sk, struct netlbl_lsm_secattr *secattr);
-int cipso_v4_socket_getattr(const struct socket *sock,
-                           struct netlbl_lsm_secattr *secattr);
 int cipso_v4_skbuff_getattr(const struct sk_buff *skb,
                            struct netlbl_lsm_secattr *secattr);
 int cipso_v4_validate(unsigned char **option);
@@ -220,9 +218,9 @@ static inline void cipso_v4_error(struct sk_buff *skb,
        return;
 }
 
-static inline int cipso_v4_socket_setattr(const struct socket *sock,
-                                 const struct cipso_v4_doi *doi_def,
-                                 const struct netlbl_lsm_secattr *secattr)
+static inline int cipso_v4_sock_setattr(struct sock *sk,
+                                     const struct cipso_v4_doi *doi_def,
+                                     const struct netlbl_lsm_secattr *secattr)
 {
        return -ENOSYS;
 }
@@ -233,12 +231,6 @@ static inline int cipso_v4_sock_getattr(struct sock *sk,
        return -ENOSYS;
 }
 
-static inline int cipso_v4_socket_getattr(const struct socket *sock,
-                                         struct netlbl_lsm_secattr *secattr)
-{
-       return -ENOSYS;
-}
-
 static inline int cipso_v4_skbuff_getattr(const struct sk_buff *skb,
                                          struct netlbl_lsm_secattr *secattr)
 {
index ed3a8872c6cafa25f550ba6dcaa2b2d30328d339..83e41dd15ccde6e88b304687dac539462815d7dd 100644 (file)
@@ -64,7 +64,7 @@ struct fib_rules_ops
        void                    (*flush_cache)(void);
 
        int                     nlgroup;
-       struct nla_policy       *policy;
+       const struct nla_policy *policy;
        struct list_head        *rules_list;
        struct module           *owner;
 };
index adff4c898d50ea40d5a4b09afedbf708c0c508f8..b6eaca122db871ab4b269a99dcbabda0fe9bcf90 100644 (file)
@@ -60,7 +60,7 @@ struct genl_ops
 {
        u8                      cmd;
        unsigned int            flags;
-       struct nla_policy       *policy;
+       const struct nla_policy *policy;
        int                    (*doit)(struct sk_buff *skb,
                                       struct genl_info *info);
        int                    (*dumpit)(struct sk_buff *skb,
index bb207db03675bbe473b1d7d00e6e3c5c27e1aaf4..abf2820a1125d73af2a83b8dab7a6e66509c88e5 100644 (file)
@@ -143,6 +143,7 @@ struct ip_reply_arg {
        __wsum      csum;
        int         csumoffset; /* u16 offset of csum in iov[0].iov_base */
                                /* -1 if not needed */ 
+       int         bound_dev_if;
 }; 
 
 void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *arg,
index 5a4a0366c24feb89883bcef5898054b0add95fa1..69252cbe05b0392fe392b4ca708784330ba73f29 100644 (file)
@@ -213,7 +213,7 @@ extern void fib_select_default(const struct flowi *flp, struct fib_result *res);
 #endif /* CONFIG_IP_MULTIPLE_TABLES */
 
 /* Exported by fib_frontend.c */
-extern struct nla_policy rtm_ipv4_policy[];
+extern const struct nla_policy rtm_ipv4_policy[];
 extern void            ip_fib_init(void);
 extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
                               struct net_device *dev, __be32 *spec_dst, u32 *itag);
index f0248fb8e196f0c5b4cd669cefe34f536d374bf9..a3d370efb9034b55ea7b31bd5772928a06411151 100644 (file)
@@ -289,4 +289,21 @@ static inline void irlap_clear_disconnect(struct irlap_cb *self)
        self->disconnect_pending = FALSE;
 }
 
+/*
+ * Function irlap_next_state (self, state)
+ *
+ *    Switches state and provides debug information
+ *
+ */
+static inline void irlap_next_state(struct irlap_cb *self, IRLAP_STATE state)
+{
+       /*
+       if (!self || self->magic != LAP_MAGIC)
+               return;
+
+       IRDA_DEBUG(4, "next LAP state = %s\n", irlap_state[state]);
+       */
+       self->state = state;
+}
+
 #endif
index 83da7e1f0d3db8aeaae7d6e21bdcfe7c3e5d2715..9b7d6f2ac9a3ed9c0107a16131be3e165477e6ed 100644 (file)
@@ -332,17 +332,15 @@ static inline int netlbl_secattr_catmap_setrng(
  */
 
 #ifdef CONFIG_NETLABEL
-int netlbl_socket_setattr(const struct socket *sock,
-                         const struct netlbl_lsm_secattr *secattr);
+int netlbl_sock_setattr(struct sock *sk,
+                       const struct netlbl_lsm_secattr *secattr);
 int netlbl_sock_getattr(struct sock *sk,
                        struct netlbl_lsm_secattr *secattr);
-int netlbl_socket_getattr(const struct socket *sock,
-                         struct netlbl_lsm_secattr *secattr);
 int netlbl_skbuff_getattr(const struct sk_buff *skb,
                          struct netlbl_lsm_secattr *secattr);
 void netlbl_skbuff_err(struct sk_buff *skb, int error);
 #else
-static inline int netlbl_socket_setattr(const struct socket *sock,
+static inline int netlbl_sock_setattr(struct sock *sk,
                                     const struct netlbl_lsm_secattr *secattr)
 {
        return -ENOSYS;
@@ -354,12 +352,6 @@ static inline int netlbl_sock_getattr(struct sock *sk,
        return -ENOSYS;
 }
 
-static inline int netlbl_socket_getattr(const struct socket *sock,
-                                       struct netlbl_lsm_secattr *secattr)
-{
-       return -ENOSYS;
-}
-
 static inline int netlbl_skbuff_getattr(const struct sk_buff *skb,
                                        struct netlbl_lsm_secattr *secattr)
 {
index 0bf325c29aff4803a9dcfed9b53d12cce6ac3ae1..7b510a9edb911a34dbf6b356318cb5a45a09d09d 100644 (file)
@@ -222,10 +222,10 @@ extern int                nlmsg_notify(struct sock *sk, struct sk_buff *skb,
                                     gfp_t flags);
 
 extern int             nla_validate(struct nlattr *head, int len, int maxtype,
-                                    struct nla_policy *policy);
+                                    const struct nla_policy *policy);
 extern int             nla_parse(struct nlattr *tb[], int maxtype,
                                  struct nlattr *head, int len,
-                                 struct nla_policy *policy);
+                                 const struct nla_policy *policy);
 extern struct nlattr * nla_find(struct nlattr *head, int len, int attrtype);
 extern size_t          nla_strlcpy(char *dst, const struct nlattr *nla,
                                    size_t dstsize);
@@ -360,7 +360,7 @@ static inline struct nlmsghdr *nlmsg_next(struct nlmsghdr *nlh, int *remaining)
  */
 static inline int nlmsg_parse(struct nlmsghdr *nlh, int hdrlen,
                              struct nlattr *tb[], int maxtype,
-                             struct nla_policy *policy)
+                             const struct nla_policy *policy)
 {
        if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen))
                return -EINVAL;
@@ -392,7 +392,7 @@ static inline struct nlattr *nlmsg_find_attr(struct nlmsghdr *nlh,
  * @policy: validation policy
  */
 static inline int nlmsg_validate(struct nlmsghdr *nlh, int hdrlen, int maxtype,
-                                struct nla_policy *policy)
+                                const struct nla_policy *policy)
 {
        if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen))
                return -EINVAL;
@@ -729,7 +729,7 @@ static inline struct nlattr *nla_find_nested(struct nlattr *nla, int attrtype)
  */
 static inline int nla_parse_nested(struct nlattr *tb[], int maxtype,
                                   struct nlattr *nla,
-                                  struct nla_policy *policy)
+                                  const struct nla_policy *policy)
 {
        return nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy);
 }
@@ -990,7 +990,7 @@ static inline int nla_nest_cancel(struct sk_buff *skb, struct nlattr *start)
  * Returns 0 on success or a negative error code.
  */
 static inline int nla_validate_nested(struct nlattr *start, int maxtype,
-                                     struct nla_policy *policy)
+                                     const struct nla_policy *policy)
 {
        return nla_validate(nla_data(start), nla_len(start), maxtype, policy);
 }
index dda72bf5b9b4cab8775b478b0b24c7454c8c3487..16baef4dab7ed813729d9879be38399b85682f6a 100644 (file)
@@ -503,6 +503,13 @@ static inline int sctp_frag_point(const struct sctp_sock *sp, int pmtu)
        return frag;
 }
 
+static inline void sctp_assoc_pending_pmtu(struct sctp_association *asoc)
+{
+
+       sctp_assoc_sync_pmtu(asoc);
+       asoc->pmtu_pending = 0;
+}
+
 /* Walk through a list of TLV parameters.  Don't trust the
  * individual parameter lengths and instead depend on
  * the chunk length to indicate when to stop.  Make sure
index 5e81984b847861461abb688214c453802c2ee783..ee4559b1130201e845548d07e12bd425cbb1349c 100644 (file)
@@ -912,6 +912,9 @@ struct sctp_transport {
         */
        __u16 pathmaxrxt;
 
+       /* is the Path MTU update pending on this tranport */
+       __u8 pmtu_pending;
+
        /* PMTU       : The current known path MTU.  */
        __u32 pathmtu;
 
@@ -1006,6 +1009,7 @@ void sctp_transport_raise_cwnd(struct sctp_transport *, __u32, __u32);
 void sctp_transport_lower_cwnd(struct sctp_transport *, sctp_lower_cwnd_t);
 unsigned long sctp_transport_timeout(struct sctp_transport *);
 void sctp_transport_reset(struct sctp_transport *);
+void sctp_transport_update_pmtu(struct sctp_transport *, u32);
 
 
 /* This is the structure we use to queue packets as they come into
@@ -1565,6 +1569,9 @@ struct sctp_association {
         */
        __u16 pathmaxrxt;
 
+       /* Flag that path mtu update is pending */
+       __u8   pmtu_pending;
+
        /* Association : The smallest PMTU discovered for all of the
         * PMTU        : peer's transport addresses.
         */
index 496f89d45c8b89eabf7b57bde71016e85552a677..98755ebaf163cfe788b4117167cfeaf1a861f269 100644 (file)
@@ -119,16 +119,9 @@ static inline void udp_lib_close(struct sock *sk, long timeout)
 }
 
 
-struct udp_get_port_ops {
-       int (*saddr_cmp)(const struct sock *sk1, const struct sock *sk2);
-       int (*saddr_any)(const struct sock *sk);
-       unsigned int (*hash_port_and_rcv_saddr)(__u16 port,
-                                               const struct sock *sk);
-};
-
 /* net/ipv4/udp.c */
 extern int     udp_get_port(struct sock *sk, unsigned short snum,
-                            const struct udp_get_port_ops *ops);
+                            int (*saddr_cmp)(const struct sock *, const struct sock *));
 extern void    udp_err(struct sk_buff *, u32);
 
 extern int     udp_sendmsg(struct kiocb *iocb, struct sock *sk,
index 50b4b424d1caab47e79673eb3fa6972c45651e91..635b0eafca95d256e789edb0323cbb8aef759f4f 100644 (file)
@@ -120,5 +120,5 @@ static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb)
 
 extern void    udplite4_register(void);
 extern int     udplite_get_port(struct sock *sk, unsigned short snum,
-                                const struct udp_get_port_ops *ops);
+                       int (*scmp)(const struct sock *, const struct sock *));
 #endif /* _UDPLITE_H */
index 90185e8b335e61b1baad56a27607e02cdc604601..311f25af5e1a7b936a87f8b3a0fd17926688a806 100644 (file)
@@ -964,7 +964,7 @@ struct xfrmk_spdinfo {
 
 extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq);
 extern int xfrm_state_delete(struct xfrm_state *x);
-extern void xfrm_state_flush(u8 proto, struct xfrm_audit *audit_info);
+extern int xfrm_state_flush(u8 proto, struct xfrm_audit *audit_info);
 extern void xfrm_sad_getinfo(struct xfrmk_sadinfo *si);
 extern void xfrm_spd_getinfo(struct xfrmk_spdinfo *si);
 extern int xfrm_replay_check(struct xfrm_state *x, __be32 seq);
@@ -1020,13 +1020,13 @@ struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir,
                                          struct xfrm_sec_ctx *ctx, int delete,
                                          int *err);
 struct xfrm_policy *xfrm_policy_byid(u8, int dir, u32 id, int delete, int *err);
-void xfrm_policy_flush(u8 type, struct xfrm_audit *audit_info);
+int xfrm_policy_flush(u8 type, struct xfrm_audit *audit_info);
 u32 xfrm_get_acqseq(void);
 void xfrm_alloc_spi(struct xfrm_state *x, __be32 minspi, __be32 maxspi);
 struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto,
                                  xfrm_address_t *daddr, xfrm_address_t *saddr,
                                  int create, unsigned short family);
-extern void xfrm_policy_flush(u8 type, struct xfrm_audit *audit_info);
+extern int xfrm_policy_flush(u8 type, struct xfrm_audit *audit_info);
 extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol);
 extern int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *xdst,
                          struct flowi *fl, int family, int strict);
index 4fefbad7096d539d90345621ac6419d2ab904b85..0852f206d8951cb4f53071b36e159ae0332e5093 100644 (file)
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -254,8 +254,10 @@ struct mempolicy *shm_get_policy(struct vm_area_struct *vma, unsigned long addr)
 
        if (sfd->vm_ops->get_policy)
                pol = sfd->vm_ops->get_policy(vma, addr);
-       else
+       else if (vma->vm_policy)
                pol = vma->vm_policy;
+       else
+               pol = current->mempolicy;
        return pol;
 }
 #endif
@@ -364,9 +366,10 @@ static int newseg (struct ipc_namespace *ns, key_t key, int shmflg, size_t size)
                return error;
        }
 
+       sprintf (name, "SYSV%08x", key);
        if (shmflg & SHM_HUGETLB) {
-               /* hugetlb_zero_setup takes care of mlock user accounting */
-               file = hugetlb_zero_setup(size);
+               /* hugetlb_file_setup takes care of mlock user accounting */
+               file = hugetlb_file_setup(name, size);
                shp->mlock_user = current->user;
        } else {
                int acctflag = VM_ACCOUNT;
@@ -377,7 +380,6 @@ static int newseg (struct ipc_namespace *ns, key_t key, int shmflg, size_t size)
                if  ((shmflg & SHM_NORESERVE) &&
                                sysctl_overcommit_memory != OVERCOMMIT_NEVER)
                        acctflag = 0;
-               sprintf (name, "SYSV%08x", key);
                file = shmem_file_setup(name, size, acctflag);
        }
        error = PTR_ERR(file);
@@ -397,6 +399,11 @@ static int newseg (struct ipc_namespace *ns, key_t key, int shmflg, size_t size)
        shp->shm_nattch = 0;
        shp->id = shm_buildid(ns, id, shp->shm_perm.seq);
        shp->shm_file = file;
+       /*
+        * shmid gets reported as "inode#" in /proc/pid/maps.
+        * proc-ps tools use this. Changing this will break them.
+        */
+       file->f_dentry->d_inode->i_ino = shp->id;
 
        ns->shm_tot += numpages;
        shm_unlock(shp);
index f57854b0892275d901e9e1b7b8f2e4784adcc37a..4c49188cc49b67d6f172c5d7d12743109c1f9e3e 100644 (file)
@@ -1682,9 +1682,9 @@ static int pid_array_load(pid_t *pidarray, int npids, struct cpuset *cs)
 
        do_each_thread(g, p) {
                if (p->cpuset == cs) {
-                       pidarray[n++] = p->pid;
                        if (unlikely(n == npids))
                                goto array_full;
+                       pidarray[n++] = p->pid;
                }
        } while_each_thread(g, p);
 
index 5b888c24e43e0ce650e554c5cec34a99f699c1fd..5c8ecbaa19a530cc4d417a897457b0d0318bc39b 100644 (file)
@@ -892,13 +892,29 @@ fastcall NORET_TYPE void do_exit(long code)
        if (unlikely(tsk->flags & PF_EXITING)) {
                printk(KERN_ALERT
                        "Fixing recursive fault but reboot is needed!\n");
+               /*
+                * We can do this unlocked here. The futex code uses
+                * this flag just to verify whether the pi state
+                * cleanup has been done or not. In the worst case it
+                * loops once more. We pretend that the cleanup was
+                * done as there is no way to return. Either the
+                * OWNER_DIED bit is set by now or we push the blocked
+                * task into the wait for ever nirwana as well.
+                */
+               tsk->flags |= PF_EXITPIDONE;
                if (tsk->io_context)
                        exit_io_context();
                set_current_state(TASK_UNINTERRUPTIBLE);
                schedule();
        }
 
+       /*
+        * tsk->flags are checked in the futex code to protect against
+        * an exiting task cleaning up the robust pi futexes.
+        */
+       spin_lock_irq(&tsk->pi_lock);
        tsk->flags |= PF_EXITING;
+       spin_unlock_irq(&tsk->pi_lock);
 
        if (unlikely(in_atomic()))
                printk(KERN_INFO "note: %s[%d] exited with preempt_count %d\n",
@@ -912,7 +928,7 @@ fastcall NORET_TYPE void do_exit(long code)
        }
        group_dead = atomic_dec_and_test(&tsk->signal->live);
        if (group_dead) {
-               hrtimer_cancel(&tsk->signal->real_timer);
+               hrtimer_cancel(&tsk->signal->real_timer);
                exit_itimers(tsk->signal);
        }
        acct_collect(code, group_dead);
@@ -965,6 +981,12 @@ fastcall NORET_TYPE void do_exit(long code)
         * Make sure we are holding no locks:
         */
        debug_check_no_locks_held(tsk);
+       /*
+        * We can do this unlocked here. The futex code uses this flag
+        * just to verify whether the pi state cleanup has been done
+        * or not. In the worst case it loops once more.
+        */
+       tsk->flags |= PF_EXITPIDONE;
 
        if (tsk->io_context)
                exit_io_context();
index b7ce15c67e324b468d13599d47df7423adcd69d4..3b7f7713d9a4148e4ee0c9e9a748be0009b7d5c7 100644 (file)
@@ -430,10 +430,6 @@ static struct task_struct * futex_find_get_task(pid_t pid)
                p = NULL;
                goto out_unlock;
        }
-       if (p->exit_state != 0) {
-               p = NULL;
-               goto out_unlock;
-       }
        get_task_struct(p);
 out_unlock:
        rcu_read_unlock();
@@ -502,7 +498,7 @@ lookup_pi_state(u32 uval, struct futex_hash_bucket *hb,
        struct futex_q *this, *next;
        struct plist_head *head;
        struct task_struct *p;
-       pid_t pid;
+       pid_t pid = uval & FUTEX_TID_MASK;
 
        head = &hb->chain;
 
@@ -520,6 +516,8 @@ lookup_pi_state(u32 uval, struct futex_hash_bucket *hb,
                                return -EINVAL;
 
                        WARN_ON(!atomic_read(&pi_state->refcount));
+                       WARN_ON(pid && pi_state->owner &&
+                               pi_state->owner->pid != pid);
 
                        atomic_inc(&pi_state->refcount);
                        *ps = pi_state;
@@ -530,15 +528,33 @@ lookup_pi_state(u32 uval, struct futex_hash_bucket *hb,
 
        /*
         * We are the first waiter - try to look up the real owner and attach
-        * the new pi_state to it, but bail out when the owner died bit is set
-        * and TID = 0:
+        * the new pi_state to it, but bail out when TID = 0
         */
-       pid = uval & FUTEX_TID_MASK;
-       if (!pid && (uval & FUTEX_OWNER_DIED))
+       if (!pid)
                return -ESRCH;
        p = futex_find_get_task(pid);
-       if (!p)
-               return -ESRCH;
+       if (IS_ERR(p))
+               return PTR_ERR(p);
+
+       /*
+        * We need to look at the task state flags to figure out,
+        * whether the task is exiting. To protect against the do_exit
+        * change of the task flags, we do this protected by
+        * p->pi_lock:
+        */
+       spin_lock_irq(&p->pi_lock);
+       if (unlikely(p->flags & PF_EXITING)) {
+               /*
+                * The task is on the way out. When PF_EXITPIDONE is
+                * set, we know that the task has finished the
+                * cleanup:
+                */
+               int ret = (p->flags & PF_EXITPIDONE) ? -ESRCH : -EAGAIN;
+
+               spin_unlock_irq(&p->pi_lock);
+               put_task_struct(p);
+               return ret;
+       }
 
        pi_state = alloc_pi_state();
 
@@ -551,7 +567,6 @@ lookup_pi_state(u32 uval, struct futex_hash_bucket *hb,
        /* Store the key for possible exit cleanups: */
        pi_state->key = *key;
 
-       spin_lock_irq(&p->pi_lock);
        WARN_ON(!list_empty(&pi_state->list));
        list_add(&pi_state->list, &p->pi_state_list);
        pi_state->owner = p;
@@ -618,6 +633,8 @@ static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_q *this)
         * preserve the owner died bit.)
         */
        if (!(uval & FUTEX_OWNER_DIED)) {
+               int ret = 0;
+
                newval = FUTEX_WAITERS | new_owner->pid;
                /* Keep the FUTEX_WAITER_REQUEUED flag if it was set */
                newval |= (uval & FUTEX_WAITER_REQUEUED);
@@ -625,10 +642,15 @@ static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_q *this)
                pagefault_disable();
                curval = futex_atomic_cmpxchg_inatomic(uaddr, uval, newval);
                pagefault_enable();
+
                if (curval == -EFAULT)
-                       return -EFAULT;
+                       ret = -EFAULT;
                if (curval != uval)
-                       return -EINVAL;
+                       ret = -EINVAL;
+               if (ret) {
+                       spin_unlock(&pi_state->pi_mutex.wait_lock);
+                       return ret;
+               }
        }
 
        spin_lock_irq(&pi_state->owner->pi_lock);
@@ -1174,7 +1196,7 @@ static int futex_requeue(u32 __user *uaddr1, struct rw_semaphore *fshared,
 #ifdef CONFIG_DEBUG_PI_LIST
                                this->list.plist.lock = &hb2->lock;
 #endif
-                       }
+                       }
                        this->key = key2;
                        get_futex_key_refs(&key2);
                        drop_count++;
@@ -1326,12 +1348,10 @@ static void unqueue_me_pi(struct futex_q *q)
 /*
  * Fixup the pi_state owner with current.
  *
- * The cur->mm semaphore must be  held, it is released at return of this
- * function.
+ * Must be called with hash bucket lock held and mm->sem held for non
+ * private futexes.
  */
-static int fixup_pi_state_owner(u32 __user *uaddr, struct rw_semaphore *fshared,
-                               struct futex_q *q,
-                               struct futex_hash_bucket *hb,
+static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q,
                                struct task_struct *curr)
 {
        u32 newtid = curr->pid | FUTEX_WAITERS;
@@ -1355,23 +1375,24 @@ static int fixup_pi_state_owner(u32 __user *uaddr, struct rw_semaphore *fshared,
        list_add(&pi_state->list, &curr->pi_state_list);
        spin_unlock_irq(&curr->pi_lock);
 
-       /* Unqueue and drop the lock */
-       unqueue_me_pi(q);
-       if (fshared)
-               up_read(fshared);
        /*
         * We own it, so we have to replace the pending owner
         * TID. This must be atomic as we have preserve the
         * owner died bit here.
         */
-       ret = get_user(uval, uaddr);
+       ret = get_futex_value_locked(&uval, uaddr);
+
        while (!ret) {
                newval = (uval & FUTEX_OWNER_DIED) | newtid;
                newval |= (uval & FUTEX_WAITER_REQUEUED);
+
+               pagefault_disable();
                curval = futex_atomic_cmpxchg_inatomic(uaddr,
                                                       uval, newval);
+               pagefault_enable();
+
                if (curval == -EFAULT)
-                       ret = -EFAULT;
+                       ret = -EFAULT;
                if (curval == uval)
                        break;
                uval = curval;
@@ -1553,10 +1574,7 @@ static int futex_wait(u32 __user *uaddr, struct rw_semaphore *fshared,
                         */
                        uaddr = q.pi_state->key.uaddr;
 
-                       /* mmap_sem and hash_bucket lock are unlocked at
-                          return of this function */
-                       ret = fixup_pi_state_owner(uaddr, fshared,
-                                                  &q, hb, curr);
+                       ret = fixup_pi_state_owner(uaddr, &q, curr);
                } else {
                        /*
                         * Catch the rare case, where the lock was released
@@ -1567,12 +1585,13 @@ static int futex_wait(u32 __user *uaddr, struct rw_semaphore *fshared,
                                if (rt_mutex_trylock(&q.pi_state->pi_mutex))
                                        ret = 0;
                        }
-                       /* Unqueue and drop the lock */
-                       unqueue_me_pi(&q);
-                       if (fshared)
-                               up_read(fshared);
                }
 
+               /* Unqueue and drop the lock */
+               unqueue_me_pi(&q);
+               if (fshared)
+                       up_read(fshared);
+
                debug_rt_mutex_free_waiter(&q.waiter);
 
                return ret;
@@ -1688,7 +1707,7 @@ static int futex_lock_pi(u32 __user *uaddr, struct rw_semaphore *fshared,
        struct futex_hash_bucket *hb;
        u32 uval, newval, curval;
        struct futex_q q;
-       int ret, lock_held, attempt = 0;
+       int ret, lock_taken, ownerdied = 0, attempt = 0;
 
        if (refill_pi_state_cache())
                return -ENOMEM;
@@ -1709,10 +1728,11 @@ static int futex_lock_pi(u32 __user *uaddr, struct rw_semaphore *fshared,
        if (unlikely(ret != 0))
                goto out_release_sem;
 
+ retry_unlocked:
        hb = queue_lock(&q, -1, NULL);
 
  retry_locked:
-       lock_held = 0;
+       ret = lock_taken = 0;
 
        /*
         * To avoid races, we attempt to take the lock here again
@@ -1728,43 +1748,44 @@ static int futex_lock_pi(u32 __user *uaddr, struct rw_semaphore *fshared,
        if (unlikely(curval == -EFAULT))
                goto uaddr_faulted;
 
-       /* We own the lock already */
+       /*
+        * Detect deadlocks. In case of REQUEUE_PI this is a valid
+        * situation and we return success to user space.
+        */
        if (unlikely((curval & FUTEX_TID_MASK) == current->pid)) {
-               if (!detect && 0)
-                       force_sig(SIGKILL, current);
-               /*
-                * Normally, this check is done in user space.
-                * In case of requeue, the owner may attempt to lock this futex,
-                * even if the ownership has already been given by the previous
-                * waker.
-                * In the usual case, this is a case of deadlock, but not in case
-                * of REQUEUE_PI.
-                */
                if (!(curval & FUTEX_WAITER_REQUEUED))
                        ret = -EDEADLK;
                goto out_unlock_release_sem;
        }
 
        /*
-        * Surprise - we got the lock. Just return
-        * to userspace:
+        * Surprise - we got the lock. Just return to userspace:
         */
        if (unlikely(!curval))
                goto out_unlock_release_sem;
 
        uval = curval;
+
        /*
-        * In case of a requeue, check if there already is an owner
-        * If not, just take the futex.
+        * Set the WAITERS flag, so the owner will know it has someone
+        * to wake at next unlock
         */
-       if ((curval & FUTEX_WAITER_REQUEUED) && !(curval & FUTEX_TID_MASK)) {
-               /* set current as futex owner */
-               newval = curval | current->pid;
-               lock_held = 1;
-       } else
-               /* Set the WAITERS flag, so the owner will know it has someone
-                  to wake at next unlock */
-               newval = curval | FUTEX_WAITERS;
+       newval = curval | FUTEX_WAITERS;
+
+       /*
+        * There are two cases, where a futex might have no owner (the
+        * owner TID is 0): OWNER_DIED or REQUEUE. We take over the
+        * futex in this case. We also do an unconditional take over,
+        * when the owner of the futex died.
+        *
+        * This is safe as we are protected by the hash bucket lock !
+        */
+       if (unlikely(ownerdied || !(curval & FUTEX_TID_MASK))) {
+               /* Keep the OWNER_DIED and REQUEUE bits */
+               newval = (curval & ~FUTEX_TID_MASK) | current->pid;
+               ownerdied = 0;
+               lock_taken = 1;
+       }
 
        pagefault_disable();
        curval = futex_atomic_cmpxchg_inatomic(uaddr, uval, newval);
@@ -1775,8 +1796,13 @@ static int futex_lock_pi(u32 __user *uaddr, struct rw_semaphore *fshared,
        if (unlikely(curval != uval))
                goto retry_locked;
 
-       if (lock_held) {
-               set_pi_futex_owner(hb, &q.key, curr);
+       /*
+        * We took the lock due to requeue or owner died take over.
+        */
+       if (unlikely(lock_taken)) {
+               /* For requeue we need to fixup the pi_futex */
+               if (curval & FUTEX_WAITER_REQUEUED)
+                       set_pi_futex_owner(hb, &q.key, curr);
                goto out_unlock_release_sem;
        }
 
@@ -1787,34 +1813,40 @@ static int futex_lock_pi(u32 __user *uaddr, struct rw_semaphore *fshared,
        ret = lookup_pi_state(uval, hb, &q.key, &q.pi_state);
 
        if (unlikely(ret)) {
-               /*
-                * There were no waiters and the owner task lookup
-                * failed. When the OWNER_DIED bit is set, then we
-                * know that this is a robust futex and we actually
-                * take the lock. This is safe as we are protected by
-                * the hash bucket lock. We also set the waiters bit
-                * unconditionally here, to simplify glibc handling of
-                * multiple tasks racing to acquire the lock and
-                * cleanup the problems which were left by the dead
-                * owner.
-                */
-               if (curval & FUTEX_OWNER_DIED) {
-                       uval = newval;
-                       newval = current->pid |
-                               FUTEX_OWNER_DIED | FUTEX_WAITERS;
+               switch (ret) {
 
-                       pagefault_disable();
-                       curval = futex_atomic_cmpxchg_inatomic(uaddr,
-                                                              uval, newval);
-                       pagefault_enable();
+               case -EAGAIN:
+                       /*
+                        * Task is exiting and we just wait for the
+                        * exit to complete.
+                        */
+                       queue_unlock(&q, hb);
+                       if (fshared)
+                               up_read(fshared);
+                       cond_resched();
+                       goto retry;
 
-                       if (unlikely(curval == -EFAULT))
+               case -ESRCH:
+                       /*
+                        * No owner found for this futex. Check if the
+                        * OWNER_DIED bit is set to figure out whether
+                        * this is a robust futex or not.
+                        */
+                       if (get_futex_value_locked(&curval, uaddr))
                                goto uaddr_faulted;
-                       if (unlikely(curval != uval))
+
+                       /*
+                        * We simply start over in case of a robust
+                        * futex. The code above will take the futex
+                        * and return happy.
+                        */
+                       if (curval & FUTEX_OWNER_DIED) {
+                               ownerdied = 1;
                                goto retry_locked;
-                       ret = 0;
+                       }
+               default:
+                       goto out_unlock_release_sem;
                }
-               goto out_unlock_release_sem;
        }
 
        /*
@@ -1845,31 +1877,42 @@ static int futex_lock_pi(u32 __user *uaddr, struct rw_semaphore *fshared,
                down_read(fshared);
        spin_lock(q.lock_ptr);
 
-       /*
-        * Got the lock. We might not be the anticipated owner if we
-        * did a lock-steal - fix up the PI-state in that case.
-        */
-       if (!ret && q.pi_state->owner != curr)
-               /* mmap_sem is unlocked at return of this function */
-               ret = fixup_pi_state_owner(uaddr, fshared, &q, hb, curr);
-       else {
+       if (!ret) {
+               /*
+                * Got the lock. We might not be the anticipated owner
+                * if we did a lock-steal - fix up the PI-state in
+                * that case:
+                */
+               if (q.pi_state->owner != curr)
+                       ret = fixup_pi_state_owner(uaddr, &q, curr);
+       } else {
                /*
                 * Catch the rare case, where the lock was released
-                * when we were on the way back before we locked
-                * the hash bucket.
+                * when we were on the way back before we locked the
+                * hash bucket.
                 */
-               if (ret && q.pi_state->owner == curr) {
-                       if (rt_mutex_trylock(&q.pi_state->pi_mutex))
-                               ret = 0;
+               if (q.pi_state->owner == curr &&
+                   rt_mutex_trylock(&q.pi_state->pi_mutex)) {
+                       ret = 0;
+               } else {
+                       /*
+                        * Paranoia check. If we did not take the lock
+                        * in the trylock above, then we should not be
+                        * the owner of the rtmutex, neither the real
+                        * nor the pending one:
+                        */
+                       if (rt_mutex_owner(&q.pi_state->pi_mutex) == curr)
+                               printk(KERN_ERR "futex_lock_pi: ret = %d "
+                                      "pi-mutex: %p pi-state %p\n", ret,
+                                      q.pi_state->pi_mutex.owner,
+                                      q.pi_state->owner);
                }
-               /* Unqueue and drop the lock */
-               unqueue_me_pi(&q);
-               if (fshared)
-                       up_read(fshared);
        }
 
-       if (!detect && ret == -EDEADLK && 0)
-               force_sig(SIGKILL, current);
+       /* Unqueue and drop the lock */
+       unqueue_me_pi(&q);
+       if (fshared)
+               up_read(fshared);
 
        return ret != -EINTR ? ret : -ERESTARTNOINTR;
 
@@ -1887,16 +1930,19 @@ static int futex_lock_pi(u32 __user *uaddr, struct rw_semaphore *fshared,
         * non-atomically.  Therefore, if get_user below is not
         * enough, we need to handle the fault ourselves, while
         * still holding the mmap_sem.
+        *
+        * ... and hb->lock. :-) --ANK
         */
+       queue_unlock(&q, hb);
+
        if (attempt++) {
                ret = futex_handle_fault((unsigned long)uaddr, fshared,
                                         attempt);
                if (ret)
-                       goto out_unlock_release_sem;
-               goto retry_locked;
+                       goto out_release_sem;
+               goto retry_unlocked;
        }
 
-       queue_unlock(&q, hb);
        if (fshared)
                up_read(fshared);
 
@@ -1940,9 +1986,9 @@ retry:
                goto out;
 
        hb = hash_futex(&key);
+retry_unlocked:
        spin_lock(&hb->lock);
 
-retry_locked:
        /*
         * To avoid races, try to do the TID -> 0 atomic transition
         * again. If it succeeds then we can return without waking
@@ -2005,16 +2051,19 @@ pi_faulted:
         * non-atomically.  Therefore, if get_user below is not
         * enough, we need to handle the fault ourselves, while
         * still holding the mmap_sem.
+        *
+        * ... and hb->lock. --ANK
         */
+       spin_unlock(&hb->lock);
+
        if (attempt++) {
                ret = futex_handle_fault((unsigned long)uaddr, fshared,
                                         attempt);
                if (ret)
-                       goto out_unlock;
-               goto retry_locked;
+                       goto out;
+               goto retry_unlocked;
        }
 
-       spin_unlock(&hb->lock);
        if (fshared)
                up_read(fshared);
 
index 24d7d78e6f42ff71e95401b82460924709346f1a..d65305b515b1ec8c359532b3f29812178fbbb6ad 100644 (file)
@@ -99,6 +99,8 @@ static ssize_t snapshot_read(struct file *filp, char __user *buf,
        ssize_t res;
 
        data = filp->private_data;
+       if (!data->ready)
+               return -ENODATA;
        res = snapshot_read_next(&data->handle, count);
        if (res > 0) {
                if (copy_to_user(buf, data_of(data->handle), res))
@@ -245,7 +247,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
                break;
 
        case SNAPSHOT_UNFREEZE:
-               if (!data->frozen)
+               if (!data->frozen || data->ready)
                        break;
                mutex_lock(&pm_mutex);
                thaw_processes();
index 12879f6c1ec3b9a53069690f0205082ea581565c..a6fbb41305210c9d3d45c56a670f3fe96af6ce64 100644 (file)
@@ -189,6 +189,19 @@ int rt_mutex_adjust_prio_chain(struct task_struct *task,
        if (!waiter || !waiter->task)
                goto out_unlock_pi;
 
+       /*
+        * Check the orig_waiter state. After we dropped the locks,
+        * the previous owner of the lock might have released the lock
+        * and made us the pending owner:
+        */
+       if (orig_waiter && !orig_waiter->task)
+               goto out_unlock_pi;
+
+       /*
+        * Drop out, when the task has no waiters. Note,
+        * top_waiter can be NULL, when we are in the deboosting
+        * mode!
+        */
        if (top_waiter && (!task_has_pi_waiters(task) ||
                           top_waiter != task_top_pi_waiter(task)))
                goto out_unlock_pi;
@@ -636,9 +649,16 @@ rt_mutex_slowlock(struct rt_mutex *lock, int state,
                         * all over without going into schedule to try
                         * to get the lock now:
                         */
-                       if (unlikely(!waiter.task))
+                       if (unlikely(!waiter.task)) {
+                               /*
+                                * Reset the return value. We might
+                                * have returned with -EDEADLK and the
+                                * owner released the lock while we
+                                * were walking the pi chain.
+                                */
+                               ret = 0;
                                continue;
-
+                       }
                        if (unlikely(ret))
                                break;
                }
index acdfc0549c6fd88c254f8d07009edcc123804bfb..fe590e00db8df24823280b0bbf94a1daead4cfb5 100644 (file)
@@ -105,7 +105,11 @@ static int recalc_sigpending_tsk(struct task_struct *t)
                set_tsk_thread_flag(t, TIF_SIGPENDING);
                return 1;
        }
-       clear_tsk_thread_flag(t, TIF_SIGPENDING);
+       /*
+        * We must never clear the flag in another thread, or in current
+        * when it's possible the current syscall is returning -ERESTART*.
+        * So we don't clear it here, and only callers who know they should do.
+        */
        return 0;
 }
 
@@ -121,7 +125,9 @@ void recalc_sigpending_and_wake(struct task_struct *t)
 
 void recalc_sigpending(void)
 {
-       recalc_sigpending_tsk(current);
+       if (!recalc_sigpending_tsk(current))
+               clear_thread_flag(TIF_SIGPENDING);
+
 }
 
 /* Given the mask, find the first available signal that should be serviced. */
@@ -385,7 +391,8 @@ int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
                        }
                }
        }
-       recalc_sigpending_tsk(tsk);
+       if (likely(tsk == current))
+               recalc_sigpending();
        if (signr && unlikely(sig_kernel_stop(signr))) {
                /*
                 * Set a marker that we have dequeued a stop signal.  Our
@@ -1580,8 +1587,9 @@ static void ptrace_stop(int exit_code, int nostop_code, siginfo_t *info)
        /*
         * Queued signals ignored us while we were stopped for tracing.
         * So check for any that we should take before resuming user mode.
+        * This sets TIF_SIGPENDING, but never clears it.
         */
-       recalc_sigpending();
+       recalc_sigpending_tsk(current);
 }
 
 void ptrace_notify(int exit_code)
index e6da5b7fc29a1f7ad57842e6f477f096f45c89a7..473f5aed6caeebe88e813429a6e690e3c4ba42c9 100644 (file)
  * hex_dump_to_buffer - convert a blob of data to "hex ASCII" in memory
  * @buf: data blob to dump
  * @len: number of bytes in the @buf
+ * @rowsize: number of bytes to print per line; must be 16 or 32
+ * @groupsize: number of bytes to print at a time (1, 2, 4, 8; default = 1)
  * @linebuf: where to put the converted data
  * @linebuflen: total size of @linebuf, including space for terminating NUL
+ * @ascii: include ASCII after the hex output
  *
  * hex_dump_to_buffer() works on one "line" of output at a time, i.e.,
- * 16 bytes of input data converted to hex + ASCII output.
+ * 16 or 32 bytes of input data converted to hex + ASCII output.
  *
  * Given a buffer of u8 data, hex_dump_to_buffer() converts the input data
  * to a hex + ASCII dump at the supplied memory location.
  * The converted output is always NUL-terminated.
  *
  * E.g.:
- *     hex_dump_to_buffer(frame->data, frame->len, linebuf, sizeof(linebuf));
+ *   hex_dump_to_buffer(frame->data, frame->len, 16, 1,
+ *                     linebuf, sizeof(linebuf), 1);
  *
  * example output buffer:
- * 40414243 44454647 48494a4b 4c4d4e4f  @ABCDEFGHIJKLMNO
+ * 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f  @ABCDEFGHIJKLMNO
  */
-void hex_dump_to_buffer(const void *buf, size_t len, char *linebuf,
-                       size_t linebuflen)
+void hex_dump_to_buffer(const void *buf, size_t len, int rowsize,
+                       int groupsize, char *linebuf, size_t linebuflen,
+                       bool ascii)
 {
        const u8 *ptr = buf;
        u8 ch;
        int j, lx = 0;
+       int ascii_column;
 
-       for (j = 0; (j < 16) && (j < len) && (lx + 3) < linebuflen; j++) {
-               if (j && !(j % 4))
+       if (rowsize != 16 && rowsize != 32)
+               rowsize = 16;
+
+       if (!len)
+               goto nil;
+       if (len > rowsize)              /* limit to one line at a time */
+               len = rowsize;
+       if ((len % groupsize) != 0)     /* no mixed size output */
+               groupsize = 1;
+
+       switch (groupsize) {
+       case 8: {
+               const u64 *ptr8 = buf;
+               int ngroups = len / groupsize;
+
+               for (j = 0; j < ngroups; j++)
+                       lx += scnprintf(linebuf + lx, linebuflen - lx,
+                               "%16.16llx ", (unsigned long long)*(ptr8 + j));
+               ascii_column = 17 * ngroups + 2;
+               break;
+       }
+
+       case 4: {
+               const u32 *ptr4 = buf;
+               int ngroups = len / groupsize;
+
+               for (j = 0; j < ngroups; j++)
+                       lx += scnprintf(linebuf + lx, linebuflen - lx,
+                               "%8.8x ", *(ptr4 + j));
+               ascii_column = 9 * ngroups + 2;
+               break;
+       }
+
+       case 2: {
+               const u16 *ptr2 = buf;
+               int ngroups = len / groupsize;
+
+               for (j = 0; j < ngroups; j++)
+                       lx += scnprintf(linebuf + lx, linebuflen - lx,
+                               "%4.4x ", *(ptr2 + j));
+               ascii_column = 5 * ngroups + 2;
+               break;
+       }
+
+       default:
+               for (j = 0; (j < rowsize) && (j < len) && (lx + 4) < linebuflen;
+                    j++) {
+                       ch = ptr[j];
+                       linebuf[lx++] = hex_asc(ch >> 4);
+                       linebuf[lx++] = hex_asc(ch & 0x0f);
                        linebuf[lx++] = ' ';
-               ch = ptr[j];
-               linebuf[lx++] = hex_asc(ch >> 4);
-               linebuf[lx++] = hex_asc(ch & 0x0f);
+               }
+               ascii_column = 3 * rowsize + 2;
+               break;
        }
-       if ((lx + 2) < linebuflen) {
-               linebuf[lx++] = ' ';
+       if (!ascii)
+               goto nil;
+
+       while (lx < (linebuflen - 1) && lx < (ascii_column - 1))
                linebuf[lx++] = ' ';
-       }
-       for (j = 0; (j < 16) && (j < len) && (lx + 2) < linebuflen; j++)
+       for (j = 0; (j < rowsize) && (j < len) && (lx + 2) < linebuflen; j++)
                linebuf[lx++] = isprint(ptr[j]) ? ptr[j] : '.';
+nil:
        linebuf[lx++] = '\0';
 }
 EXPORT_SYMBOL(hex_dump_to_buffer);
@@ -59,46 +115,83 @@ EXPORT_SYMBOL(hex_dump_to_buffer);
 /**
  * print_hex_dump - print a text hex dump to syslog for a binary blob of data
  * @level: kernel log level (e.g. KERN_DEBUG)
+ * @prefix_str: string to prefix each line with;
+ *  caller supplies trailing spaces for alignment if desired
  * @prefix_type: controls whether prefix of an offset, address, or none
  *  is printed (%DUMP_PREFIX_OFFSET, %DUMP_PREFIX_ADDRESS, %DUMP_PREFIX_NONE)
+ * @rowsize: number of bytes to print per line; must be 16 or 32
+ * @groupsize: number of bytes to print at a time (1, 2, 4, 8; default = 1)
  * @buf: data blob to dump
  * @len: number of bytes in the @buf
+ * @ascii: include ASCII after the hex output
  *
  * Given a buffer of u8 data, print_hex_dump() prints a hex + ASCII dump
  * to the kernel log at the specified kernel log level, with an optional
  * leading prefix.
  *
+ * print_hex_dump() works on one "line" of output at a time, i.e.,
+ * 16 or 32 bytes of input data converted to hex + ASCII output.
+ * print_hex_dump() iterates over the entire input @buf, breaking it into
+ * "line size" chunks to format and print.
+ *
  * E.g.:
- *   print_hex_dump(KERN_DEBUG, DUMP_PREFIX_ADDRESS, frame->data, frame->len);
+ *   print_hex_dump(KERN_DEBUG, "raw data: ", DUMP_PREFIX_ADDRESS,
+ *             16, 1, frame->data, frame->len, 1);
  *
- * Example output using %DUMP_PREFIX_OFFSET:
- * 0009ab42: 40414243 44454647 48494a4b 4c4d4e4f  @ABCDEFGHIJKLMNO
- * Example output using %DUMP_PREFIX_ADDRESS:
- * ffffffff88089af0: 70717273 74757677 78797a7b 7c7d7e7f  pqrstuvwxyz{|}~.
+ * Example output using %DUMP_PREFIX_OFFSET and 1-byte mode:
+ * 0009ab42: 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f  @ABCDEFGHIJKLMNO
+ * Example output using %DUMP_PREFIX_ADDRESS and 4-byte mode:
+ * ffffffff88089af0: 73727170 77767574 7b7a7978 7f7e7d7c  pqrstuvwxyz{|}~.
  */
-void print_hex_dump(const char *level, int prefix_type, void *buf, size_t len)
+void print_hex_dump(const char *level, const char *prefix_str, int prefix_type,
+                       int rowsize, int groupsize,
+                       void *buf, size_t len, bool ascii)
 {
        u8 *ptr = buf;
        int i, linelen, remaining = len;
-       unsigned char linebuf[100];
+       unsigned char linebuf[200];
 
-       for (i = 0; i < len; i += 16) {
-               linelen = min(remaining, 16);
-               remaining -= 16;
-               hex_dump_to_buffer(ptr + i, linelen, linebuf, sizeof(linebuf));
+       if (rowsize != 16 && rowsize != 32)
+               rowsize = 16;
+
+       for (i = 0; i < len; i += rowsize) {
+               linelen = min(remaining, rowsize);
+               remaining -= rowsize;
+               hex_dump_to_buffer(ptr + i, linelen, rowsize, groupsize,
+                               linebuf, sizeof(linebuf), ascii);
 
                switch (prefix_type) {
                case DUMP_PREFIX_ADDRESS:
-                       printk("%s%*p: %s\n", level,
+                       printk("%s%s%*p: %s\n", level, prefix_str,
                                (int)(2 * sizeof(void *)), ptr + i, linebuf);
                        break;
                case DUMP_PREFIX_OFFSET:
-                       printk("%s%.8x: %s\n", level, i, linebuf);
+                       printk("%s%s%.8x: %s\n", level, prefix_str, i, linebuf);
                        break;
                default:
-                       printk("%s%s\n", level, linebuf);
+                       printk("%s%s%s\n", level, prefix_str, linebuf);
                        break;
                }
        }
 }
 EXPORT_SYMBOL(print_hex_dump);
+
+/**
+ * print_hex_dump_bytes - shorthand form of print_hex_dump() with default params
+ * @prefix_str: string to prefix each line with;
+ *  caller supplies trailing spaces for alignment if desired
+ * @prefix_type: controls whether prefix of an offset, address, or none
+ *  is printed (%DUMP_PREFIX_OFFSET, %DUMP_PREFIX_ADDRESS, %DUMP_PREFIX_NONE)
+ * @buf: data blob to dump
+ * @len: number of bytes in the @buf
+ *
+ * Calls print_hex_dump(), with log level of KERN_DEBUG,
+ * rowsize of 16, groupsize of 1, and ASCII output included.
+ */
+void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
+                       void *buf, size_t len)
+{
+       print_hex_dump(KERN_DEBUG, prefix_str, prefix_type, 16, 1,
+                       buf, len, 1);
+}
+EXPORT_SYMBOL(print_hex_dump_bytes);
index fc5f3f6e73299a27e394294efb4564dea3511c2c..ac1520651b9b457d89e96bd2447aae02d6f8bb46 100644 (file)
@@ -202,14 +202,14 @@ int kobject_shadow_add(struct kobject * kobj, struct dentry *shadow_parent)
 
                /* be noisy on error issues */
                if (error == -EEXIST)
-                       printk("kobject_add failed for %s with -EEXIST, "
-                              "don't try to register things with the "
-                              "same name in the same directory.\n",
+                       printk(KERN_ERR "kobject_add failed for %s with "
+                              "-EEXIST, don't try to register things with "
+                              "the same name in the same directory.\n",
                               kobject_name(kobj));
                else
-                       printk("kobject_add failed for %s (%d)\n",
+                       printk(KERN_ERR "kobject_add failed for %s (%d)\n",
                               kobject_name(kobj), error);
-                dump_stack();
+               dump_stack();
        }
 
        return error;
index eb7180db303326f73f7e099f84e2557e84cc87b1..a45d1f0691cecb63e088d02fb3ff287f025e4d78 100644 (file)
@@ -326,9 +326,10 @@ static void set_huge_ptep_writable(struct vm_area_struct *vma,
        pte_t entry;
 
        entry = pte_mkwrite(pte_mkdirty(*ptep));
-       ptep_set_access_flags(vma, address, ptep, entry, 1);
-       update_mmu_cache(vma, address, entry);
-       lazy_mmu_prot_update(entry);
+       if (ptep_set_access_flags(vma, address, ptep, entry, 1)) {
+               update_mmu_cache(vma, address, entry);
+               lazy_mmu_prot_update(entry);
+       }
 }
 
 
index cb94488ab96dad4eb3840fa037a7b08673154674..f64cbf9baa3633fc1755f675ec2b46c920c4ecef 100644 (file)
@@ -1691,9 +1691,10 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
                flush_cache_page(vma, address, pte_pfn(orig_pte));
                entry = pte_mkyoung(orig_pte);
                entry = maybe_mkwrite(pte_mkdirty(entry), vma);
-               ptep_set_access_flags(vma, address, page_table, entry, 1);
-               update_mmu_cache(vma, address, entry);
-               lazy_mmu_prot_update(entry);
+               if (ptep_set_access_flags(vma, address, page_table, entry,1)) {
+                       update_mmu_cache(vma, address, entry);
+                       lazy_mmu_prot_update(entry);
+               }
                ret |= VM_FAULT_WRITE;
                goto unlock;
        }
@@ -2525,10 +2526,9 @@ static inline int handle_pte_fault(struct mm_struct *mm,
                pte_t *pte, pmd_t *pmd, int write_access)
 {
        pte_t entry;
-       pte_t old_entry;
        spinlock_t *ptl;
 
-       old_entry = entry = *pte;
+       entry = *pte;
        if (!pte_present(entry)) {
                if (pte_none(entry)) {
                        if (vma->vm_ops) {
@@ -2561,8 +2561,7 @@ static inline int handle_pte_fault(struct mm_struct *mm,
                entry = pte_mkdirty(entry);
        }
        entry = pte_mkyoung(entry);
-       if (!pte_same(old_entry, entry)) {
-               ptep_set_access_flags(vma, address, pte, entry, write_access);
+       if (ptep_set_access_flags(vma, address, pte, entry, write_access)) {
                update_mmu_cache(vma, address, entry);
                lazy_mmu_prot_update(entry);
        } else {
index bd8e33582d25555af55c93d258a842c173a8072c..05ace44852eb88c9f2c6fa50b98d3ecd569d202c 100644 (file)
@@ -1968,7 +1968,7 @@ void zone_init_free_lists(struct pglist_data *pgdat, struct zone *zone,
        memmap_init_zone((size), (nid), (zone), (start_pfn), MEMMAP_EARLY)
 #endif
 
-static int __cpuinit zone_batchsize(struct zone *zone)
+static int __devinit zone_batchsize(struct zone *zone)
 {
        int batch;
 
index e537317bec4d5d02977bf92021d87242e2ff549b..b6aae2b33393d96d694145326c6591acf6f83b4b 100644 (file)
@@ -967,6 +967,8 @@ static inline int shmem_parse_mpol(char *value, int *policy, nodemask_t *policy_
                *nodelist++ = '\0';
                if (nodelist_parse(nodelist, *policy_nodes))
                        goto out;
+               if (!nodes_subset(*policy_nodes, node_online_map))
+                       goto out;
        }
        if (!strcmp(value, "default")) {
                *policy = MPOL_DEFAULT;
index 2e71a328aa09540a75f83ab289a3da8931920914..6d65cf4e4b2e03fb1cbd860a1932ce0cd5cb2621 100644 (file)
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -3539,7 +3539,7 @@ static inline void __cache_free(struct kmem_cache *cachep, void *objp)
        check_irq_off();
        objp = cache_free_debugcheck(cachep, objp, __builtin_return_address(0));
 
-       if (use_alien_caches && cache_free_alien(cachep, objp))
+       if (cache_free_alien(cachep, objp))
                return;
 
        if (likely(ac->avail < ac->limit)) {
index 51663a3c3c243c1afeaba27e21b7333808bc1cff..fa28b16236442d80408c792f0140c26015846eca 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2241,7 +2241,7 @@ void *__kmalloc(size_t size, gfp_t flags)
 
        if (s)
                return slab_alloc(s, flags, -1, __builtin_return_address(0));
-       return NULL;
+       return ZERO_SIZE_PTR;
 }
 EXPORT_SYMBOL(__kmalloc);
 
@@ -2252,16 +2252,20 @@ void *__kmalloc_node(size_t size, gfp_t flags, int node)
 
        if (s)
                return slab_alloc(s, flags, node, __builtin_return_address(0));
-       return NULL;
+       return ZERO_SIZE_PTR;
 }
 EXPORT_SYMBOL(__kmalloc_node);
 #endif
 
 size_t ksize(const void *object)
 {
-       struct page *page = get_object_page(object);
+       struct page *page;
        struct kmem_cache *s;
 
+       if (object == ZERO_SIZE_PTR)
+               return 0;
+
+       page = get_object_page(object);
        BUG_ON(!page);
        s = page->slab;
        BUG_ON(!s);
@@ -2293,7 +2297,13 @@ void kfree(const void *x)
        struct kmem_cache *s;
        struct page *page;
 
-       if (!x)
+       /*
+        * This has to be an unsigned comparison. According to Linus
+        * some gcc version treat a pointer as a signed entity. Then
+        * this comparison would be true for all "negative" pointers
+        * (which would cover the whole upper half of the address space).
+        */
+       if ((unsigned long)x <= (unsigned long)ZERO_SIZE_PTR)
                return;
 
        page = virt_to_head_page(x);
@@ -2398,12 +2408,12 @@ void *krealloc(const void *p, size_t new_size, gfp_t flags)
        void *ret;
        size_t ks;
 
-       if (unlikely(!p))
+       if (unlikely(!p || p == ZERO_SIZE_PTR))
                return kmalloc(new_size, flags);
 
        if (unlikely(!new_size)) {
                kfree(p);
-               return NULL;
+               return ZERO_SIZE_PTR;
        }
 
        ks = ksize(p);
@@ -2426,6 +2436,7 @@ EXPORT_SYMBOL(krealloc);
 void __init kmem_cache_init(void)
 {
        int i;
+       int caches = 0;
 
 #ifdef CONFIG_NUMA
        /*
@@ -2436,20 +2447,29 @@ void __init kmem_cache_init(void)
        create_kmalloc_cache(&kmalloc_caches[0], "kmem_cache_node",
                sizeof(struct kmem_cache_node), GFP_KERNEL);
        kmalloc_caches[0].refcount = -1;
+       caches++;
 #endif
 
        /* Able to allocate the per node structures */
        slab_state = PARTIAL;
 
        /* Caches that are not of the two-to-the-power-of size */
-       create_kmalloc_cache(&kmalloc_caches[1],
+       if (KMALLOC_MIN_SIZE <= 64) {
+               create_kmalloc_cache(&kmalloc_caches[1],
                                "kmalloc-96", 96, GFP_KERNEL);
-       create_kmalloc_cache(&kmalloc_caches[2],
+               caches++;
+       }
+       if (KMALLOC_MIN_SIZE <= 128) {
+               create_kmalloc_cache(&kmalloc_caches[2],
                                "kmalloc-192", 192, GFP_KERNEL);
+               caches++;
+       }
 
-       for (i = KMALLOC_SHIFT_LOW; i <= KMALLOC_SHIFT_HIGH; i++)
+       for (i = KMALLOC_SHIFT_LOW; i <= KMALLOC_SHIFT_HIGH; i++) {
                create_kmalloc_cache(&kmalloc_caches[i],
                        "kmalloc", 1 << i, GFP_KERNEL);
+               caches++;
+       }
 
        slab_state = UP;
 
@@ -2466,8 +2486,8 @@ void __init kmem_cache_init(void)
                                nr_cpu_ids * sizeof(struct page *);
 
        printk(KERN_INFO "SLUB: Genslabs=%d, HWalign=%d, Order=%d-%d, MinObjects=%d,"
-               " Processors=%d, Nodes=%d\n",
-               KMALLOC_SHIFT_HIGH, cache_line_size(),
+               " CPUs=%d, Nodes=%d\n",
+               caches, cache_line_size(),
                slub_min_order, slub_max_order, slub_min_objects,
                nr_cpu_ids, nr_node_ids);
 }
@@ -2652,7 +2672,7 @@ void *__kmalloc_track_caller(size_t size, gfp_t gfpflags, void *caller)
        struct kmem_cache *s = get_slab(size, gfpflags);
 
        if (!s)
-               return NULL;
+               return ZERO_SIZE_PTR;
 
        return slab_alloc(s, gfpflags, -1, caller);
 }
@@ -2663,7 +2683,7 @@ void *__kmalloc_node_track_caller(size_t size, gfp_t gfpflags,
        struct kmem_cache *s = get_slab(size, gfpflags);
 
        if (!s)
-               return NULL;
+               return ZERO_SIZE_PTR;
 
        return slab_alloc(s, gfpflags, node, caller);
 }
@@ -2857,7 +2877,7 @@ static int alloc_loc_track(struct loc_track *t, unsigned long max)
 
        order = get_order(sizeof(struct location) * max);
 
-       l = (void *)__get_free_pages(GFP_KERNEL, order);
+       l = (void *)__get_free_pages(GFP_ATOMIC, order);
 
        if (!l)
                return 0;
index 545e4d3afcdff14877204b270bf6e671c33d5509..e03b39f3540f79adf384c476f185e7a9da91e4ac 100644 (file)
@@ -240,6 +240,27 @@ static struct page __init *sparse_early_mem_map_alloc(unsigned long pnum)
        return NULL;
 }
 
+/*
+ * Allocate the accumulated non-linear sections, allocate a mem_map
+ * for each and record the physical to section mapping.
+ */
+void __init sparse_init(void)
+{
+       unsigned long pnum;
+       struct page *map;
+
+       for (pnum = 0; pnum < NR_MEM_SECTIONS; pnum++) {
+               if (!valid_section_nr(pnum))
+                       continue;
+
+               map = sparse_early_mem_map_alloc(pnum);
+               if (!map)
+                       continue;
+               sparse_init_one_section(__nr_to_section(pnum), pnum, map);
+       }
+}
+
+#ifdef CONFIG_MEMORY_HOTPLUG
 static struct page *__kmalloc_section_memmap(unsigned long nr_pages)
 {
        struct page *page, *ret;
@@ -279,27 +300,6 @@ static void __kfree_section_memmap(struct page *memmap, unsigned long nr_pages)
                           get_order(sizeof(struct page) * nr_pages));
 }
 
-/*
- * Allocate the accumulated non-linear sections, allocate a mem_map
- * for each and record the physical to section mapping.
- */
-void __init sparse_init(void)
-{
-       unsigned long pnum;
-       struct page *map;
-
-       for (pnum = 0; pnum < NR_MEM_SECTIONS; pnum++) {
-               if (!valid_section_nr(pnum))
-                       continue;
-
-               map = sparse_early_mem_map_alloc(pnum);
-               if (!map)
-                       continue;
-               sparse_init_one_section(__nr_to_section(pnum), pnum, map);
-       }
-}
-
-#ifdef CONFIG_MEMORY_HOTPLUG
 /*
  * returns the number of sections whose mem_maps were properly
  * set.  If this is <=0, then that means that the passed-in
index 5a7f20f7857468aeab6ba56ba391c228a59efc91..26090621ea6b6b6e5c5210a6cfaaa2915a135e5e 100644 (file)
@@ -2577,7 +2577,7 @@ unsigned dev_get_flags(const struct net_device *dev)
 
 int dev_change_flags(struct net_device *dev, unsigned flags)
 {
-       int ret;
+       int ret, changes;
        int old_flags = dev->flags;
 
        /*
@@ -2632,8 +2632,10 @@ int dev_change_flags(struct net_device *dev, unsigned flags)
                dev_set_allmulti(dev, inc);
        }
 
-       if (old_flags ^ dev->flags)
-               rtmsg_ifinfo(RTM_NEWLINK, dev, old_flags ^ dev->flags);
+       /* Exclude state transition flags, already notified */
+       changes = (old_flags ^ dev->flags) & ~(IFF_UP | IFF_RUNNING);
+       if (changes)
+               rtmsg_ifinfo(RTM_NEWLINK, dev, changes);
 
        return ret;
 }
index 764bccb3d99265b2a014b41167d999cf1574e639..c6a05879d58cd3c87fb854541bb3c3440d858de9 100644 (file)
@@ -111,13 +111,7 @@ out:
        spin_unlock(&dst_lock);
 }
 
-static int dst_discard_in(struct sk_buff *skb)
-{
-       kfree_skb(skb);
-       return 0;
-}
-
-static int dst_discard_out(struct sk_buff *skb)
+static int dst_discard(struct sk_buff *skb)
 {
        kfree_skb(skb);
        return 0;
@@ -138,8 +132,7 @@ void * dst_alloc(struct dst_ops * ops)
        dst->ops = ops;
        dst->lastuse = jiffies;
        dst->path = dst;
-       dst->input = dst_discard_in;
-       dst->output = dst_discard_out;
+       dst->input = dst->output = dst_discard;
 #if RT_CACHE_DEBUG >= 2
        atomic_inc(&dst_total);
 #endif
@@ -153,8 +146,7 @@ static void ___dst_free(struct dst_entry * dst)
           protocol module is unloaded.
         */
        if (dst->dev == NULL || !(dst->dev->flags&IFF_UP)) {
-               dst->input = dst_discard_in;
-               dst->output = dst_discard_out;
+               dst->input = dst->output = dst_discard;
        }
        dst->obsolete = 2;
 }
@@ -242,8 +234,7 @@ static inline void dst_ifdown(struct dst_entry *dst, struct net_device *dev,
                return;
 
        if (!unregister) {
-               dst->input = dst_discard_in;
-               dst->output = dst_discard_out;
+               dst->input = dst->output = dst_discard;
        } else {
                dst->dev = &loopback_dev;
                dev_hold(&loopback_dev);
index 6f3bb73053c23fc6d4427957567d3a84c6033b62..9df26a07f0672ccabe610f366026fa4b2123524c 100644 (file)
@@ -1761,7 +1761,7 @@ static inline struct neigh_parms *lookup_neigh_params(struct neigh_table *tbl,
        return NULL;
 }
 
-static struct nla_policy nl_neightbl_policy[NDTA_MAX+1] __read_mostly = {
+static const struct nla_policy nl_neightbl_policy[NDTA_MAX+1] = {
        [NDTA_NAME]             = { .type = NLA_STRING },
        [NDTA_THRESH1]          = { .type = NLA_U32 },
        [NDTA_THRESH2]          = { .type = NLA_U32 },
@@ -1770,7 +1770,7 @@ static struct nla_policy nl_neightbl_policy[NDTA_MAX+1] __read_mostly = {
        [NDTA_PARMS]            = { .type = NLA_NESTED },
 };
 
-static struct nla_policy nl_ntbl_parm_policy[NDTPA_MAX+1] __read_mostly = {
+static const struct nla_policy nl_ntbl_parm_policy[NDTPA_MAX+1] = {
        [NDTPA_IFINDEX]                 = { .type = NLA_U32 },
        [NDTPA_QUEUE_LEN]               = { .type = NLA_U32 },
        [NDTPA_PROXY_QLEN]              = { .type = NLA_U32 },
index 27da9cdec6a83b5bdcb41110c9dd7a28eac914fc..02e8bf084277963300be7cd68f7a8b6de67cab59 100644 (file)
@@ -551,7 +551,7 @@ cont:
        return skb->len;
 }
 
-static struct nla_policy ifla_policy[IFLA_MAX+1] __read_mostly = {
+static const struct nla_policy ifla_policy[IFLA_MAX+1] = {
        [IFLA_IFNAME]           = { .type = NLA_STRING, .len = IFNAMSIZ-1 },
        [IFLA_MAP]              = { .len = sizeof(struct rtnl_link_ifmap) },
        [IFLA_MTU]              = { .type = NLA_U32 },
@@ -580,7 +580,7 @@ static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
 
        err = -EINVAL;
        ifm = nlmsg_data(nlh);
-       if (ifm->ifi_index >= 0)
+       if (ifm->ifi_index > 0)
                dev = dev_get_by_index(ifm->ifi_index);
        else if (tb[IFLA_IFNAME])
                dev = dev_get_by_name(ifname);
@@ -672,7 +672,7 @@ static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
         * name provided implies that a name change has been
         * requested.
         */
-       if (ifm->ifi_index >= 0 && ifname[0]) {
+       if (ifm->ifi_index > 0 && ifname[0]) {
                err = dev_change_name(dev, ifname);
                if (err < 0)
                        goto errout_dev;
@@ -740,7 +740,7 @@ static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
                return err;
 
        ifm = nlmsg_data(nlh);
-       if (ifm->ifi_index >= 0) {
+       if (ifm->ifi_index > 0) {
                dev = dev_get_by_index(ifm->ifi_index);
                if (dev == NULL)
                        return -ENODEV;
index 764a56a13e3831f8a93d7908164c57476d25e874..ab41c1879fd498612f15e5356ab6a06a063d4050 100644 (file)
@@ -638,7 +638,7 @@ static struct dn_dev *dn_dev_by_index(int ifindex)
        return dn_dev;
 }
 
-static struct nla_policy dn_ifa_policy[IFA_MAX+1] __read_mostly = {
+static const struct nla_policy dn_ifa_policy[IFA_MAX+1] = {
        [IFA_ADDRESS]           = { .type = NLA_U16 },
        [IFA_LOCAL]             = { .type = NLA_U16 },
        [IFA_LABEL]             = { .type = NLA_STRING,
index 17a1932216d63f01d8b3d4ff6e802d825eecc008..84ff3dd370709fc8c8c7f2927d1e6f9861019ea5 100644 (file)
@@ -108,7 +108,7 @@ errout:
        return err;
 }
 
-static struct nla_policy dn_fib_rule_policy[FRA_MAX+1] __read_mostly = {
+static const struct nla_policy dn_fib_rule_policy[FRA_MAX+1] = {
        FRA_GENERIC_POLICY,
 };
 
index 7110779a0244598b17518c46cc4784370198f3d0..e00767e8ebd94ed4facfc11b3a3b746e84a50345 100644 (file)
@@ -877,7 +877,7 @@ static int arp_process(struct sk_buff *skb)
 
        n = __neigh_lookup(&arp_tbl, &sip, dev, 0);
 
-       if (ipv4_devconf.arp_accept) {
+       if (IPV4_DEVCONF_ALL(ARP_ACCEPT)) {
                /* Unsolicited ARP is not accepted by default.
                   It is possible, that this option should be enabled for some
                   devices (strip is candidate)
@@ -987,11 +987,11 @@ static int arp_req_set(struct arpreq *r, struct net_device * dev)
                        return 0;
                }
                if (dev == NULL) {
-                       ipv4_devconf.proxy_arp = 1;
+                       IPV4_DEVCONF_ALL(PROXY_ARP) = 1;
                        return 0;
                }
                if (__in_dev_get_rtnl(dev)) {
-                       __in_dev_get_rtnl(dev)->cnf.proxy_arp = 1;
+                       IN_DEV_CONF_SET(__in_dev_get_rtnl(dev), PROXY_ARP, 1);
                        return 0;
                }
                return -ENXIO;
@@ -1093,11 +1093,12 @@ static int arp_req_delete(struct arpreq *r, struct net_device * dev)
                        return pneigh_delete(&arp_tbl, &ip, dev);
                if (mask == 0) {
                        if (dev == NULL) {
-                               ipv4_devconf.proxy_arp = 0;
+                               IPV4_DEVCONF_ALL(PROXY_ARP) = 0;
                                return 0;
                        }
                        if (__in_dev_get_rtnl(dev)) {
-                               __in_dev_get_rtnl(dev)->cnf.proxy_arp = 0;
+                               IN_DEV_CONF_SET(__in_dev_get_rtnl(dev),
+                                               PROXY_ARP, 0);
                                return 0;
                        }
                        return -ENXIO;
index 86a2b52aad3836c6aef2edf83413c3bda42a1319..ab56a052ce31cb53e873df670a4afdc8dc68972a 100644 (file)
@@ -45,6 +45,7 @@
 #include <net/cipso_ipv4.h>
 #include <asm/atomic.h>
 #include <asm/bug.h>
+#include <asm/unaligned.h>
 
 struct cipso_v4_domhsh_entry {
        char *domain;
@@ -1000,7 +1001,7 @@ static int cipso_v4_map_cat_enum_valid(const struct cipso_v4_doi *doi_def,
                return -EFAULT;
 
        for (iter = 0; iter < enumcat_len; iter += 2) {
-               cat = ntohs(*((__be16 *)&enumcat[iter]));
+               cat = ntohs(get_unaligned((__be16 *)&enumcat[iter]));
                if (cat <= cat_prev)
                        return -EFAULT;
                cat_prev = cat;
@@ -1068,8 +1069,8 @@ static int cipso_v4_map_cat_enum_ntoh(const struct cipso_v4_doi *doi_def,
 
        for (iter = 0; iter < net_cat_len; iter += 2) {
                ret_val = netlbl_secattr_catmap_setbit(secattr->mls_cat,
-                                           ntohs(*((__be16 *)&net_cat[iter])),
-                                           GFP_ATOMIC);
+                               ntohs(get_unaligned((__be16 *)&net_cat[iter])),
+                               GFP_ATOMIC);
                if (ret_val != 0)
                        return ret_val;
        }
@@ -1102,9 +1103,10 @@ static int cipso_v4_map_cat_rng_valid(const struct cipso_v4_doi *doi_def,
                return -EFAULT;
 
        for (iter = 0; iter < rngcat_len; iter += 4) {
-               cat_high = ntohs(*((__be16 *)&rngcat[iter]));
+               cat_high = ntohs(get_unaligned((__be16 *)&rngcat[iter]));
                if ((iter + 4) <= rngcat_len)
-                       cat_low = ntohs(*((__be16 *)&rngcat[iter + 2]));
+                       cat_low = ntohs(
+                               get_unaligned((__be16 *)&rngcat[iter + 2]));
                else
                        cat_low = 0;
 
@@ -1201,9 +1203,10 @@ static int cipso_v4_map_cat_rng_ntoh(const struct cipso_v4_doi *doi_def,
        u16 cat_high;
 
        for (net_iter = 0; net_iter < net_cat_len; net_iter += 4) {
-               cat_high = ntohs(*((__be16 *)&net_cat[net_iter]));
+               cat_high = ntohs(get_unaligned((__be16 *)&net_cat[net_iter]));
                if ((net_iter + 4) <= net_cat_len)
-                       cat_low = ntohs(*((__be16 *)&net_cat[net_iter + 2]));
+                       cat_low = ntohs(
+                             get_unaligned((__be16 *)&net_cat[net_iter + 2]));
                else
                        cat_low = 0;
 
@@ -1565,7 +1568,7 @@ int cipso_v4_validate(unsigned char **option)
        }
 
        rcu_read_lock();
-       doi_def = cipso_v4_doi_search(ntohl(*((__be32 *)&opt[2])));
+       doi_def = cipso_v4_doi_search(ntohl(get_unaligned((__be32 *)&opt[2])));
        if (doi_def == NULL) {
                err_offset = 2;
                goto validate_return_locked;
@@ -1709,22 +1712,22 @@ void cipso_v4_error(struct sk_buff *skb, int error, u32 gateway)
 }
 
 /**
- * cipso_v4_socket_setattr - Add a CIPSO option to a socket
- * @sock: the socket
+ * cipso_v4_sock_setattr - Add a CIPSO option to a socket
+ * @sk: the socket
  * @doi_def: the CIPSO DOI to use
  * @secattr: the specific security attributes of the socket
  *
  * Description:
  * Set the CIPSO option on the given socket using the DOI definition and
  * security attributes passed to the function.  This function requires
- * exclusive access to @sock->sk, which means it either needs to be in the
- * process of being created or locked via lock_sock(sock->sk).  Returns zero on
- * success and negative values on failure.
+ * exclusive access to @sk, which means it either needs to be in the
+ * process of being created or locked.  Returns zero on success and negative
+ * values on failure.
  *
  */
-int cipso_v4_socket_setattr(const struct socket *sock,
-                           const struct cipso_v4_doi *doi_def,
-                           const struct netlbl_lsm_secattr *secattr)
+int cipso_v4_sock_setattr(struct sock *sk,
+                         const struct cipso_v4_doi *doi_def,
+                         const struct netlbl_lsm_secattr *secattr)
 {
        int ret_val = -EPERM;
        u32 iter;
@@ -1732,7 +1735,6 @@ int cipso_v4_socket_setattr(const struct socket *sock,
        u32 buf_len = 0;
        u32 opt_len;
        struct ip_options *opt = NULL;
-       struct sock *sk;
        struct inet_sock *sk_inet;
        struct inet_connection_sock *sk_conn;
 
@@ -1740,7 +1742,6 @@ int cipso_v4_socket_setattr(const struct socket *sock,
         * defined yet but it is not a problem as the only users of these
         * "lite" PF_INET sockets are functions which do an accept() call
         * afterwards so we will label the socket as part of the accept(). */
-       sk = sock->sk;
        if (sk == NULL)
                return 0;
 
@@ -1858,7 +1859,7 @@ int cipso_v4_sock_getattr(struct sock *sk, struct netlbl_lsm_secattr *secattr)
        if (ret_val == 0)
                return ret_val;
 
-       doi = ntohl(*(__be32 *)&cipso_ptr[2]);
+       doi = ntohl(get_unaligned((__be32 *)&cipso_ptr[2]));
        rcu_read_lock();
        doi_def = cipso_v4_doi_search(doi);
        if (doi_def == NULL) {
@@ -1891,29 +1892,6 @@ int cipso_v4_sock_getattr(struct sock *sk, struct netlbl_lsm_secattr *secattr)
        return ret_val;
 }
 
-/**
- * cipso_v4_socket_getattr - Get the security attributes from a socket
- * @sock: the socket
- * @secattr: the security attributes
- *
- * Description:
- * Query @sock to see if there is a CIPSO option attached to the socket and if
- * there is return the CIPSO security attributes in @secattr.  Returns zero on
- * success and negative values on failure.
- *
- */
-int cipso_v4_socket_getattr(const struct socket *sock,
-                           struct netlbl_lsm_secattr *secattr)
-{
-       int ret_val;
-
-       lock_sock(sock->sk);
-       ret_val = cipso_v4_sock_getattr(sock->sk, secattr);
-       release_sock(sock->sk);
-
-       return ret_val;
-}
-
 /**
  * cipso_v4_skbuff_getattr - Get the security attributes from the CIPSO option
  * @skb: the packet
@@ -1936,7 +1914,7 @@ int cipso_v4_skbuff_getattr(const struct sk_buff *skb,
        if (cipso_v4_cache_check(cipso_ptr, cipso_ptr[1], secattr) == 0)
                return 0;
 
-       doi = ntohl(*(__be32 *)&cipso_ptr[2]);
+       doi = ntohl(get_unaligned((__be32 *)&cipso_ptr[2]));
        rcu_read_lock();
        doi_def = cipso_v4_doi_search(doi);
        if (doi_def == NULL)
index 7f95e6e9beebd55ff6ade8adfcfcbacf9488f89f..abf6352f990f33ff380a27f364325b4f57153b56 100644 (file)
 #include <net/rtnetlink.h>
 
 struct ipv4_devconf ipv4_devconf = {
-       .accept_redirects = 1,
-       .send_redirects =  1,
-       .secure_redirects = 1,
-       .shared_media =   1,
+       .data = {
+               [NET_IPV4_CONF_ACCEPT_REDIRECTS - 1] = 1,
+               [NET_IPV4_CONF_SEND_REDIRECTS - 1] = 1,
+               [NET_IPV4_CONF_SECURE_REDIRECTS - 1] = 1,
+               [NET_IPV4_CONF_SHARED_MEDIA - 1] = 1,
+       },
 };
 
 static struct ipv4_devconf ipv4_devconf_dflt = {
-       .accept_redirects =  1,
-       .send_redirects =    1,
-       .secure_redirects =  1,
-       .shared_media =      1,
-       .accept_source_route = 1,
+       .data = {
+               [NET_IPV4_CONF_ACCEPT_REDIRECTS - 1] = 1,
+               [NET_IPV4_CONF_SEND_REDIRECTS - 1] = 1,
+               [NET_IPV4_CONF_SECURE_REDIRECTS - 1] = 1,
+               [NET_IPV4_CONF_SHARED_MEDIA - 1] = 1,
+               [NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE - 1] = 1,
+       },
 };
 
-static struct nla_policy ifa_ipv4_policy[IFA_MAX+1] __read_mostly = {
+#define IPV4_DEVCONF_DFLT(attr) IPV4_DEVCONF(ipv4_devconf_dflt, attr)
+
+static const struct nla_policy ifa_ipv4_policy[IFA_MAX+1] = {
        [IFA_LOCAL]             = { .type = NLA_U32 },
        [IFA_ADDRESS]           = { .type = NLA_U32 },
        [IFA_BROADCAST]         = { .type = NLA_U32 },
@@ -141,7 +147,7 @@ void in_dev_finish_destroy(struct in_device *idev)
        }
 }
 
-struct in_device *inetdev_init(struct net_device *dev)
+static struct in_device *inetdev_init(struct net_device *dev)
 {
        struct in_device *in_dev;
 
@@ -321,12 +327,8 @@ static void __inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap,
                }
 
        }
-       if (destroy) {
+       if (destroy)
                inet_free_ifa(ifa1);
-
-               if (!in_dev->ifa_list)
-                       inetdev_destroy(in_dev);
-       }
 }
 
 static void inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap,
@@ -399,12 +401,10 @@ static int inet_set_ifa(struct net_device *dev, struct in_ifaddr *ifa)
        ASSERT_RTNL();
 
        if (!in_dev) {
-               in_dev = inetdev_init(dev);
-               if (!in_dev) {
-                       inet_free_ifa(ifa);
-                       return -ENOBUFS;
-               }
+               inet_free_ifa(ifa);
+               return -ENOBUFS;
        }
+       ipv4_devconf_setall(in_dev);
        if (ifa->ifa_dev != in_dev) {
                BUG_TRAP(!ifa->ifa_dev);
                in_dev_hold(in_dev);
@@ -514,13 +514,12 @@ static struct in_ifaddr *rtm_to_ifaddr(struct nlmsghdr *nlh)
 
        in_dev = __in_dev_get_rtnl(dev);
        if (in_dev == NULL) {
-               in_dev = inetdev_init(dev);
-               if (in_dev == NULL) {
-                       err = -ENOBUFS;
-                       goto errout;
-               }
+               err = -ENOBUFS;
+               goto errout;
        }
 
+       ipv4_devconf_setall(in_dev);
+
        ifa = inet_alloc_ifa();
        if (ifa == NULL) {
                /*
@@ -1057,11 +1056,12 @@ static int inetdev_event(struct notifier_block *this, unsigned long event,
        if (!in_dev) {
                if (event == NETDEV_REGISTER) {
                        in_dev = inetdev_init(dev);
-                       if (!in_dev)
-                               panic("devinet: Failed to create loopback\n");
                        if (dev == &loopback_dev) {
-                               in_dev->cnf.no_xfrm = 1;
-                               in_dev->cnf.no_policy = 1;
+                               if (!in_dev)
+                                       panic("devinet: "
+                                             "Failed to create loopback\n");
+                               IN_DEV_CONF_SET(in_dev, NOXFRM, 1);
+                               IN_DEV_CONF_SET(in_dev, NOPOLICY, 1);
                        }
                }
                goto out;
@@ -1237,13 +1237,98 @@ errout:
 
 #ifdef CONFIG_SYSCTL
 
+static void devinet_copy_dflt_conf(int i)
+{
+       struct net_device *dev;
+
+       read_lock(&dev_base_lock);
+       for_each_netdev(dev) {
+               struct in_device *in_dev;
+               rcu_read_lock();
+               in_dev = __in_dev_get_rcu(dev);
+               if (in_dev && !test_bit(i, in_dev->cnf.state))
+                       in_dev->cnf.data[i] = ipv4_devconf_dflt.data[i];
+               rcu_read_unlock();
+       }
+       read_unlock(&dev_base_lock);
+}
+
+static int devinet_conf_proc(ctl_table *ctl, int write,
+                            struct file* filp, void __user *buffer,
+                            size_t *lenp, loff_t *ppos)
+{
+       int ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
+
+       if (write) {
+               struct ipv4_devconf *cnf = ctl->extra1;
+               int i = (int *)ctl->data - cnf->data;
+
+               set_bit(i, cnf->state);
+
+               if (cnf == &ipv4_devconf_dflt)
+                       devinet_copy_dflt_conf(i);
+       }
+
+       return ret;
+}
+
+static int devinet_conf_sysctl(ctl_table *table, int __user *name, int nlen,
+                              void __user *oldval, size_t __user *oldlenp,
+                              void __user *newval, size_t newlen)
+{
+       struct ipv4_devconf *cnf;
+       int *valp = table->data;
+       int new;
+       int i;
+
+       if (!newval || !newlen)
+               return 0;
+
+       if (newlen != sizeof(int))
+               return -EINVAL;
+
+       if (get_user(new, (int __user *)newval))
+               return -EFAULT;
+
+       if (new == *valp)
+               return 0;
+
+       if (oldval && oldlenp) {
+               size_t len;
+
+               if (get_user(len, oldlenp))
+                       return -EFAULT;
+
+               if (len) {
+                       if (len > table->maxlen)
+                               len = table->maxlen;
+                       if (copy_to_user(oldval, valp, len))
+                               return -EFAULT;
+                       if (put_user(len, oldlenp))
+                               return -EFAULT;
+               }
+       }
+
+       *valp = new;
+
+       cnf = table->extra1;
+       i = (int *)table->data - cnf->data;
+
+       set_bit(i, cnf->state);
+
+       if (cnf == &ipv4_devconf_dflt)
+               devinet_copy_dflt_conf(i);
+
+       return 1;
+}
+
 void inet_forward_change(void)
 {
        struct net_device *dev;
-       int on = ipv4_devconf.forwarding;
+       int on = IPV4_DEVCONF_ALL(FORWARDING);
 
-       ipv4_devconf.accept_redirects = !on;
-       ipv4_devconf_dflt.forwarding = on;
+       IPV4_DEVCONF_ALL(ACCEPT_REDIRECTS) = !on;
+       IPV4_DEVCONF_DFLT(FORWARDING) = on;
 
        read_lock(&dev_base_lock);
        for_each_netdev(dev) {
@@ -1251,7 +1336,7 @@ void inet_forward_change(void)
                rcu_read_lock();
                in_dev = __in_dev_get_rcu(dev);
                if (in_dev)
-                       in_dev->cnf.forwarding = on;
+                       IN_DEV_CONF_SET(in_dev, FORWARDING, on);
                rcu_read_unlock();
        }
        read_unlock(&dev_base_lock);
@@ -1268,9 +1353,9 @@ static int devinet_sysctl_forward(ctl_table *ctl, int write,
        int ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
 
        if (write && *valp != val) {
-               if (valp == &ipv4_devconf.forwarding)
+               if (valp == &IPV4_DEVCONF_ALL(FORWARDING))
                        inet_forward_change();
-               else if (valp != &ipv4_devconf_dflt.forwarding)
+               else if (valp != &IPV4_DEVCONF_DFLT(FORWARDING))
                        rt_cache_flush(0);
        }
 
@@ -1295,42 +1380,43 @@ int ipv4_doint_and_flush_strategy(ctl_table *table, int __user *name, int nlen,
                                  void __user *oldval, size_t __user *oldlenp,
                                  void __user *newval, size_t newlen)
 {
-       int *valp = table->data;
-       int new;
+       int ret = devinet_conf_sysctl(table, name, nlen, oldval, oldlenp,
+                                     newval, newlen);
 
-       if (!newval || !newlen)
-               return 0;
+       if (ret == 1)
+               rt_cache_flush(0);
 
-       if (newlen != sizeof(int))
-               return -EINVAL;
+       return ret;
+}
 
-       if (get_user(new, (int __user *)newval))
-               return -EFAULT;
 
-       if (new == *valp)
-               return 0;
+#define DEVINET_SYSCTL_ENTRY(attr, name, mval, proc, sysctl) \
+       { \
+               .ctl_name       = NET_IPV4_CONF_ ## attr, \
+               .procname       = name, \
+               .data           = ipv4_devconf.data + \
+                                 NET_IPV4_CONF_ ## attr - 1, \
+               .maxlen         = sizeof(int), \
+               .mode           = mval, \
+               .proc_handler   = proc, \
+               .strategy       = sysctl, \
+               .extra1         = &ipv4_devconf, \
+       }
 
-       if (oldval && oldlenp) {
-               size_t len;
+#define DEVINET_SYSCTL_RW_ENTRY(attr, name) \
+       DEVINET_SYSCTL_ENTRY(attr, name, 0644, devinet_conf_proc, \
+                            devinet_conf_sysctl)
 
-               if (get_user(len, oldlenp))
-                       return -EFAULT;
+#define DEVINET_SYSCTL_RO_ENTRY(attr, name) \
+       DEVINET_SYSCTL_ENTRY(attr, name, 0444, devinet_conf_proc, \
+                            devinet_conf_sysctl)
 
-               if (len) {
-                       if (len > table->maxlen)
-                               len = table->maxlen;
-                       if (copy_to_user(oldval, valp, len))
-                               return -EFAULT;
-                       if (put_user(len, oldlenp))
-                               return -EFAULT;
-               }
-       }
-
-       *valp = new;
-       rt_cache_flush(0);
-       return 1;
-}
+#define DEVINET_SYSCTL_COMPLEX_ENTRY(attr, name, proc, sysctl) \
+       DEVINET_SYSCTL_ENTRY(attr, name, 0644, proc, sysctl)
 
+#define DEVINET_SYSCTL_FLUSHING_ENTRY(attr, name) \
+       DEVINET_SYSCTL_COMPLEX_ENTRY(attr, name, ipv4_doint_and_flush, \
+                                    ipv4_doint_and_flush_strategy)
 
 static struct devinet_sysctl_table {
        struct ctl_table_header *sysctl_header;
@@ -1341,178 +1427,34 @@ static struct devinet_sysctl_table {
        ctl_table               devinet_root_dir[2];
 } devinet_sysctl = {
        .devinet_vars = {
-               {
-                       .ctl_name       = NET_IPV4_CONF_FORWARDING,
-                       .procname       = "forwarding",
-                       .data           = &ipv4_devconf.forwarding,
-                       .maxlen         = sizeof(int),
-                       .mode           = 0644,
-                       .proc_handler   = &devinet_sysctl_forward,
-               },
-               {
-                       .ctl_name       = NET_IPV4_CONF_MC_FORWARDING,
-                       .procname       = "mc_forwarding",
-                       .data           = &ipv4_devconf.mc_forwarding,
-                       .maxlen         = sizeof(int),
-                       .mode           = 0444,
-                       .proc_handler   = &proc_dointvec,
-               },
-               {
-                       .ctl_name       = NET_IPV4_CONF_ACCEPT_REDIRECTS,
-                       .procname       = "accept_redirects",
-                       .data           = &ipv4_devconf.accept_redirects,
-                       .maxlen         = sizeof(int),
-                       .mode           = 0644,
-                       .proc_handler   = &proc_dointvec,
-               },
-               {
-                       .ctl_name       = NET_IPV4_CONF_SECURE_REDIRECTS,
-                       .procname       = "secure_redirects",
-                       .data           = &ipv4_devconf.secure_redirects,
-                       .maxlen         = sizeof(int),
-                       .mode           = 0644,
-                       .proc_handler   = &proc_dointvec,
-               },
-               {
-                       .ctl_name       = NET_IPV4_CONF_SHARED_MEDIA,
-                       .procname       = "shared_media",
-                       .data           = &ipv4_devconf.shared_media,
-                       .maxlen         = sizeof(int),
-                       .mode           = 0644,
-                       .proc_handler   = &proc_dointvec,
-               },
-               {
-                       .ctl_name       = NET_IPV4_CONF_RP_FILTER,
-                       .procname       = "rp_filter",
-                       .data           = &ipv4_devconf.rp_filter,
-                       .maxlen         = sizeof(int),
-                       .mode           = 0644,
-                       .proc_handler   = &proc_dointvec,
-               },
-               {
-                       .ctl_name       = NET_IPV4_CONF_SEND_REDIRECTS,
-                       .procname       = "send_redirects",
-                       .data           = &ipv4_devconf.send_redirects,
-                       .maxlen         = sizeof(int),
-                       .mode           = 0644,
-                       .proc_handler   = &proc_dointvec,
-               },
-               {
-                       .ctl_name       = NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE,
-                       .procname       = "accept_source_route",
-                       .data           = &ipv4_devconf.accept_source_route,
-                       .maxlen         = sizeof(int),
-                       .mode           = 0644,
-                       .proc_handler   = &proc_dointvec,
-               },
-               {
-                       .ctl_name       = NET_IPV4_CONF_PROXY_ARP,
-                       .procname       = "proxy_arp",
-                       .data           = &ipv4_devconf.proxy_arp,
-                       .maxlen         = sizeof(int),
-                       .mode           = 0644,
-                       .proc_handler   = &proc_dointvec,
-               },
-               {
-                       .ctl_name       = NET_IPV4_CONF_MEDIUM_ID,
-                       .procname       = "medium_id",
-                       .data           = &ipv4_devconf.medium_id,
-                       .maxlen         = sizeof(int),
-                       .mode           = 0644,
-                       .proc_handler   = &proc_dointvec,
-               },
-               {
-                       .ctl_name       = NET_IPV4_CONF_BOOTP_RELAY,
-                       .procname       = "bootp_relay",
-                       .data           = &ipv4_devconf.bootp_relay,
-                       .maxlen         = sizeof(int),
-                       .mode           = 0644,
-                       .proc_handler   = &proc_dointvec,
-               },
-               {
-                       .ctl_name       = NET_IPV4_CONF_LOG_MARTIANS,
-                       .procname       = "log_martians",
-                       .data           = &ipv4_devconf.log_martians,
-                       .maxlen         = sizeof(int),
-                       .mode           = 0644,
-                       .proc_handler   = &proc_dointvec,
-               },
-               {
-                       .ctl_name       = NET_IPV4_CONF_TAG,
-                       .procname       = "tag",
-                       .data           = &ipv4_devconf.tag,
-                       .maxlen         = sizeof(int),
-                       .mode           = 0644,
-                       .proc_handler   = &proc_dointvec,
-               },
-               {
-                       .ctl_name       = NET_IPV4_CONF_ARPFILTER,
-                       .procname       = "arp_filter",
-                       .data           = &ipv4_devconf.arp_filter,
-                       .maxlen         = sizeof(int),
-                       .mode           = 0644,
-                       .proc_handler   = &proc_dointvec,
-               },
-               {
-                       .ctl_name       = NET_IPV4_CONF_ARP_ANNOUNCE,
-                       .procname       = "arp_announce",
-                       .data           = &ipv4_devconf.arp_announce,
-                       .maxlen         = sizeof(int),
-                       .mode           = 0644,
-                       .proc_handler   = &proc_dointvec,
-               },
-               {
-                       .ctl_name       = NET_IPV4_CONF_ARP_IGNORE,
-                       .procname       = "arp_ignore",
-                       .data           = &ipv4_devconf.arp_ignore,
-                       .maxlen         = sizeof(int),
-                       .mode           = 0644,
-                       .proc_handler   = &proc_dointvec,
-               },
-               {
-                       .ctl_name       = NET_IPV4_CONF_ARP_ACCEPT,
-                       .procname       = "arp_accept",
-                       .data           = &ipv4_devconf.arp_accept,
-                       .maxlen         = sizeof(int),
-                       .mode           = 0644,
-                       .proc_handler   = &proc_dointvec,
-               },
-               {
-                       .ctl_name       = NET_IPV4_CONF_NOXFRM,
-                       .procname       = "disable_xfrm",
-                       .data           = &ipv4_devconf.no_xfrm,
-                       .maxlen         = sizeof(int),
-                       .mode           = 0644,
-                       .proc_handler   = &ipv4_doint_and_flush,
-                       .strategy       = &ipv4_doint_and_flush_strategy,
-               },
-               {
-                       .ctl_name       = NET_IPV4_CONF_NOPOLICY,
-                       .procname       = "disable_policy",
-                       .data           = &ipv4_devconf.no_policy,
-                       .maxlen         = sizeof(int),
-                       .mode           = 0644,
-                       .proc_handler   = &ipv4_doint_and_flush,
-                       .strategy       = &ipv4_doint_and_flush_strategy,
-               },
-               {
-                       .ctl_name       = NET_IPV4_CONF_FORCE_IGMP_VERSION,
-                       .procname       = "force_igmp_version",
-                       .data           = &ipv4_devconf.force_igmp_version,
-                       .maxlen         = sizeof(int),
-                       .mode           = 0644,
-                       .proc_handler   = &ipv4_doint_and_flush,
-                       .strategy       = &ipv4_doint_and_flush_strategy,
-               },
-               {
-                       .ctl_name       = NET_IPV4_CONF_PROMOTE_SECONDARIES,
-                       .procname       = "promote_secondaries",
-                       .data           = &ipv4_devconf.promote_secondaries,
-                       .maxlen         = sizeof(int),
-                       .mode           = 0644,
-                       .proc_handler   = &ipv4_doint_and_flush,
-                       .strategy       = &ipv4_doint_and_flush_strategy,
-               },
+               DEVINET_SYSCTL_COMPLEX_ENTRY(FORWARDING, "forwarding",
+                                            devinet_sysctl_forward,
+                                            devinet_conf_sysctl),
+               DEVINET_SYSCTL_RO_ENTRY(MC_FORWARDING, "mc_forwarding"),
+
+               DEVINET_SYSCTL_RW_ENTRY(ACCEPT_REDIRECTS, "accept_redirects"),
+               DEVINET_SYSCTL_RW_ENTRY(SECURE_REDIRECTS, "secure_redirects"),
+               DEVINET_SYSCTL_RW_ENTRY(SHARED_MEDIA, "shared_media"),
+               DEVINET_SYSCTL_RW_ENTRY(RP_FILTER, "rp_filter"),
+               DEVINET_SYSCTL_RW_ENTRY(SEND_REDIRECTS, "send_redirects"),
+               DEVINET_SYSCTL_RW_ENTRY(ACCEPT_SOURCE_ROUTE,
+                                       "accept_source_route"),
+               DEVINET_SYSCTL_RW_ENTRY(PROXY_ARP, "proxy_arp"),
+               DEVINET_SYSCTL_RW_ENTRY(MEDIUM_ID, "medium_id"),
+               DEVINET_SYSCTL_RW_ENTRY(BOOTP_RELAY, "bootp_relay"),
+               DEVINET_SYSCTL_RW_ENTRY(LOG_MARTIANS, "log_martians"),
+               DEVINET_SYSCTL_RW_ENTRY(TAG, "tag"),
+               DEVINET_SYSCTL_RW_ENTRY(ARPFILTER, "arp_filter"),
+               DEVINET_SYSCTL_RW_ENTRY(ARP_ANNOUNCE, "arp_announce"),
+               DEVINET_SYSCTL_RW_ENTRY(ARP_IGNORE, "arp_ignore"),
+               DEVINET_SYSCTL_RW_ENTRY(ARP_ACCEPT, "arp_accept"),
+
+               DEVINET_SYSCTL_FLUSHING_ENTRY(NOXFRM, "disable_xfrm"),
+               DEVINET_SYSCTL_FLUSHING_ENTRY(NOPOLICY, "disable_policy"),
+               DEVINET_SYSCTL_FLUSHING_ENTRY(FORCE_IGMP_VERSION,
+                                             "force_igmp_version"),
+               DEVINET_SYSCTL_FLUSHING_ENTRY(PROMOTE_SECONDARIES,
+                                             "promote_secondaries"),
        },
        .devinet_dev = {
                {
@@ -1561,6 +1503,7 @@ static void devinet_sysctl_register(struct in_device *in_dev,
                return;
        for (i = 0; i < ARRAY_SIZE(t->devinet_vars) - 1; i++) {
                t->devinet_vars[i].data += (char *)p - (char *)&ipv4_devconf;
+               t->devinet_vars[i].extra1 = p;
        }
 
        if (dev) {
index 9ad1f6252a9729fd5bc9e9ec1af69e690ad75e3e..311d633f7f397b545b6a0839319c1d446c18eb27 100644 (file)
@@ -441,7 +441,7 @@ int ip_rt_ioctl(unsigned int cmd, void __user *arg)
        return -EINVAL;
 }
 
-struct nla_policy rtm_ipv4_policy[RTA_MAX+1] __read_mostly = {
+const struct nla_policy rtm_ipv4_policy[RTA_MAX+1] = {
        [RTA_DST]               = { .type = NLA_U32 },
        [RTA_SRC]               = { .type = NLA_U32 },
        [RTA_IIF]               = { .type = NLA_U32 },
index 33083ad52e9ff2d0678f9a2914c230a98b1a40d5..2a947840210ece1a1e218972725e5bda5b21ea6f 100644 (file)
@@ -169,7 +169,7 @@ static struct fib_table *fib_empty_table(void)
        return NULL;
 }
 
-static struct nla_policy fib4_rule_policy[FRA_MAX+1] __read_mostly = {
+static const struct nla_policy fib4_rule_policy[FRA_MAX+1] = {
        FRA_GENERIC_POLICY,
        [FRA_FLOW]      = { .type = NLA_U32 },
 };
index f4dd47453108e5041dd4394308d64567522ec1ac..a646409c2d068040ac0054b9f2cf3a29472a495d 100644 (file)
  * contradict to specs provided this delay is small enough.
  */
 
-#define IGMP_V1_SEEN(in_dev) (ipv4_devconf.force_igmp_version == 1 || \
-               (in_dev)->cnf.force_igmp_version == 1 || \
-               ((in_dev)->mr_v1_seen && \
-               time_before(jiffies, (in_dev)->mr_v1_seen)))
-#define IGMP_V2_SEEN(in_dev) (ipv4_devconf.force_igmp_version == 2 || \
-               (in_dev)->cnf.force_igmp_version == 2 || \
-               ((in_dev)->mr_v2_seen && \
-               time_before(jiffies, (in_dev)->mr_v2_seen)))
+#define IGMP_V1_SEEN(in_dev) \
+       (IPV4_DEVCONF_ALL(FORCE_IGMP_VERSION) == 1 || \
+        IN_DEV_CONF_GET((in_dev), FORCE_IGMP_VERSION) == 1 || \
+        ((in_dev)->mr_v1_seen && \
+         time_before(jiffies, (in_dev)->mr_v1_seen)))
+#define IGMP_V2_SEEN(in_dev) \
+       (IPV4_DEVCONF_ALL(FORCE_IGMP_VERSION) == 2 || \
+        IN_DEV_CONF_GET((in_dev), FORCE_IGMP_VERSION) == 2 || \
+        ((in_dev)->mr_v2_seen && \
+         time_before(jiffies, (in_dev)->mr_v2_seen)))
 
 static void igmpv3_add_delrec(struct in_device *in_dev, struct ip_mc_list *im);
 static void igmpv3_del_delrec(struct in_device *in_dev, __be32 multiaddr);
index d6427d9185125c34140f5306b98a692b255a6619..34ea4547ebbea10cda26bca8a6f05307218b9518 100644 (file)
@@ -1352,7 +1352,8 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *ar
        }
 
        {
-               struct flowi fl = { .nl_u = { .ip4_u =
+               struct flowi fl = { .oif = arg->bound_dev_if,
+                                   .nl_u = { .ip4_u =
                                              { .daddr = daddr,
                                                .saddr = rt->rt_spec_dst,
                                                .tos = RT_TOS(ip_hdr(skb)->tos) } },
@@ -1376,6 +1377,7 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *ar
        inet->tos = ip_hdr(skb)->tos;
        sk->sk_priority = skb->priority;
        sk->sk_protocol = ip_hdr(skb)->protocol;
+       sk->sk_bound_dev_if = arg->bound_dev_if;
        ip_append_data(sk, ip_reply_glue_bits, arg->iov->iov_base, len, 0,
                       &ipc, rt, MSG_DONTWAIT);
        if ((skb = skb_peek(&sk->sk_write_queue)) != NULL) {
index 0ebae413ae873c733d21880c8ceadf5ebbde18b1..d96582acdf69a7b4110cc4dfafc2d2c290d7a379 100644 (file)
@@ -152,9 +152,11 @@ struct net_device *ipmr_new_tunnel(struct vifctl *v)
                        dev->flags |= IFF_MULTICAST;
 
                        in_dev = __in_dev_get_rtnl(dev);
-                       if (in_dev == NULL && (in_dev = inetdev_init(dev)) == NULL)
+                       if (in_dev == NULL)
                                goto failure;
-                       in_dev->cnf.rp_filter = 0;
+
+                       ipv4_devconf_setall(in_dev);
+                       IPV4_DEVCONF(in_dev->cnf, RP_FILTER) = 0;
 
                        if (dev_open(dev))
                                goto failure;
@@ -218,10 +220,15 @@ static struct net_device *ipmr_reg_vif(void)
        }
        dev->iflink = 0;
 
-       if ((in_dev = inetdev_init(dev)) == NULL)
+       rcu_read_lock();
+       if ((in_dev = __in_dev_get_rcu(dev)) == NULL) {
+               rcu_read_unlock();
                goto failure;
+       }
 
-       in_dev->cnf.rp_filter = 0;
+       ipv4_devconf_setall(in_dev);
+       IPV4_DEVCONF(in_dev->cnf, RP_FILTER) = 0;
+       rcu_read_unlock();
 
        if (dev_open(dev))
                goto failure;
@@ -281,7 +288,7 @@ static int vif_delete(int vifi)
        dev_set_allmulti(dev, -1);
 
        if ((in_dev = __in_dev_get_rtnl(dev)) != NULL) {
-               in_dev->cnf.mc_forwarding--;
+               IPV4_DEVCONF(in_dev->cnf, MC_FORWARDING)--;
                ip_rt_multicast_event(in_dev);
        }
 
@@ -426,7 +433,7 @@ static int vif_add(struct vifctl *vifc, int mrtsock)
 
        if ((in_dev = __in_dev_get_rtnl(dev)) == NULL)
                return -EADDRNOTAVAIL;
-       in_dev->cnf.mc_forwarding++;
+       IPV4_DEVCONF(in_dev->cnf, MC_FORWARDING)++;
        dev_set_allmulti(dev, +1);
        ip_rt_multicast_event(in_dev);
 
@@ -841,7 +848,7 @@ static void mrtsock_destruct(struct sock *sk)
 {
        rtnl_lock();
        if (sk == mroute_socket) {
-               ipv4_devconf.mc_forwarding--;
+               IPV4_DEVCONF_ALL(MC_FORWARDING)--;
 
                write_lock_bh(&mrt_lock);
                mroute_socket=NULL;
@@ -890,7 +897,7 @@ int ip_mroute_setsockopt(struct sock *sk,int optname,char __user *optval,int opt
                        mroute_socket=sk;
                        write_unlock_bh(&mrt_lock);
 
-                       ipv4_devconf.mc_forwarding++;
+                       IPV4_DEVCONF_ALL(MC_FORWARDING)++;
                }
                rtnl_unlock();
                return ret;
index e3f83bf160d9ebf01d518664237c8864bee58a22..9bacf1a0363085793544d85a1658f8ce91f2d8ba 100644 (file)
@@ -499,7 +499,8 @@ check_entry(struct ipt_entry *e, const char *name)
 }
 
 static inline int check_match(struct ipt_entry_match *m, const char *name,
-                               const struct ipt_ip *ip, unsigned int hookmask)
+                               const struct ipt_ip *ip, unsigned int hookmask,
+                               unsigned int *i)
 {
        struct xt_match *match;
        int ret;
@@ -515,6 +516,8 @@ static inline int check_match(struct ipt_entry_match *m, const char *name,
                         m->u.kernel.match->name);
                ret = -EINVAL;
        }
+       if (!ret)
+               (*i)++;
        return ret;
 }
 
@@ -537,11 +540,10 @@ find_check_match(struct ipt_entry_match *m,
        }
        m->u.kernel.match = match;
 
-       ret = check_match(m, name, ip, hookmask);
+       ret = check_match(m, name, ip, hookmask, i);
        if (ret)
                goto err;
 
-       (*i)++;
        return 0;
 err:
        module_put(m->u.kernel.match->me);
@@ -1425,7 +1427,7 @@ out:
 }
 
 static inline int
-compat_check_calc_match(struct ipt_entry_match *m,
+compat_find_calc_match(struct ipt_entry_match *m,
            const char *name,
            const struct ipt_ip *ip,
            unsigned int hookmask,
@@ -1448,6 +1450,31 @@ compat_check_calc_match(struct ipt_entry_match *m,
        return 0;
 }
 
+static inline int
+compat_release_match(struct ipt_entry_match *m, unsigned int *i)
+{
+       if (i && (*i)-- == 0)
+               return 1;
+
+       module_put(m->u.kernel.match->me);
+       return 0;
+}
+
+static inline int
+compat_release_entry(struct ipt_entry *e, unsigned int *i)
+{
+       struct ipt_entry_target *t;
+
+       if (i && (*i)-- == 0)
+               return 1;
+
+       /* Cleanup all matches */
+       IPT_MATCH_ITERATE(e, compat_release_match, NULL);
+       t = ipt_get_target(e);
+       module_put(t->u.kernel.target->me);
+       return 0;
+}
+
 static inline int
 check_compat_entry_size_and_hooks(struct ipt_entry *e,
                           struct xt_table_info *newinfo,
@@ -1485,10 +1512,10 @@ check_compat_entry_size_and_hooks(struct ipt_entry *e,
        off = 0;
        entry_offset = (void *)e - (void *)base;
        j = 0;
-       ret = IPT_MATCH_ITERATE(e, compat_check_calc_match, name, &e->ip,
+       ret = IPT_MATCH_ITERATE(e, compat_find_calc_match, name, &e->ip,
                        e->comefrom, &off, &j);
        if (ret != 0)
-               goto cleanup_matches;
+               goto release_matches;
 
        t = ipt_get_target(e);
        target = try_then_request_module(xt_find_target(AF_INET,
@@ -1499,7 +1526,7 @@ check_compat_entry_size_and_hooks(struct ipt_entry *e,
                duprintf("check_compat_entry_size_and_hooks: `%s' not found\n",
                                                        t->u.user.name);
                ret = target ? PTR_ERR(target) : -ENOENT;
-               goto cleanup_matches;
+               goto release_matches;
        }
        t->u.kernel.target = target;
 
@@ -1526,8 +1553,8 @@ check_compat_entry_size_and_hooks(struct ipt_entry *e,
 
 out:
        module_put(t->u.kernel.target->me);
-cleanup_matches:
-       IPT_MATCH_ITERATE(e, cleanup_match, &j);
+release_matches:
+       IPT_MATCH_ITERATE(e, compat_release_match, &j);
        return ret;
 }
 
@@ -1574,15 +1601,26 @@ static int compat_copy_entry_from_user(struct ipt_entry *e, void **dstptr,
        return ret;
 }
 
-static inline int compat_check_entry(struct ipt_entry *e, const char *name)
+static inline int compat_check_entry(struct ipt_entry *e, const char *name,
+                                               unsigned int *i)
 {
-       int ret;
+       int j, ret;
 
-       ret = IPT_MATCH_ITERATE(e, check_match, name, &e->ip, e->comefrom);
+       j = 0;
+       ret = IPT_MATCH_ITERATE(e, check_match, name, &e->ip, e->comefrom, &j);
        if (ret)
-               return ret;
+               goto cleanup_matches;
+
+       ret = check_target(e, name);
+       if (ret)
+               goto cleanup_matches;
 
-       return check_target(e, name);
+       (*i)++;
+       return 0;
+
+ cleanup_matches:
+       IPT_MATCH_ITERATE(e, cleanup_match, &j);
+       return ret;
 }
 
 static int
@@ -1673,10 +1711,17 @@ translate_compat_table(const char *name,
        if (!mark_source_chains(newinfo, valid_hooks, entry1))
                goto free_newinfo;
 
+       i = 0;
        ret = IPT_ENTRY_ITERATE(entry1, newinfo->size, compat_check_entry,
-                                                                       name);
-       if (ret)
-               goto free_newinfo;
+                                                               name, &i);
+       if (ret) {
+               j -= i;
+               IPT_ENTRY_ITERATE_CONTINUE(entry1, newinfo->size, i,
+                                               compat_release_entry, &j);
+               IPT_ENTRY_ITERATE(entry1, newinfo->size, cleanup_entry, &i);
+               xt_free_table_info(newinfo);
+               return ret;
+       }
 
        /* And one copy for every other CPU */
        for_each_possible_cpu(i)
@@ -1691,7 +1736,7 @@ translate_compat_table(const char *name,
 free_newinfo:
        xt_free_table_info(newinfo);
 out:
-       IPT_ENTRY_ITERATE(entry0, total_size, cleanup_entry, &j);
+       IPT_ENTRY_ITERATE(entry0, total_size, compat_release_entry, &j);
        return ret;
 out_unlock:
        compat_flush_offsets();
index fd62a41d69cc82e3cc2da81b088ac36d4316a265..6dc72a815f77623a2973f94a5d3a84eafae1f80f 100644 (file)
@@ -133,6 +133,7 @@ static unsigned int ipv4_conntrack_help(unsigned int hooknum,
        struct nf_conn *ct;
        enum ip_conntrack_info ctinfo;
        struct nf_conn_help *help;
+       struct nf_conntrack_helper *helper;
 
        /* This is where we call the helper: as the packet goes out. */
        ct = nf_ct_get(*pskb, &ctinfo);
@@ -140,12 +141,14 @@ static unsigned int ipv4_conntrack_help(unsigned int hooknum,
                return NF_ACCEPT;
 
        help = nfct_help(ct);
-       if (!help || !help->helper)
+       if (!help)
                return NF_ACCEPT;
-
-       return help->helper->help(pskb,
-                                 skb_network_offset(*pskb) + ip_hdrlen(*pskb),
-                                 ct, ctinfo);
+       /* rcu_read_lock()ed by nf_hook_slow */
+       helper = rcu_dereference(help->helper);
+       if (!helper)
+               return NF_ACCEPT;
+       return helper->help(pskb, skb_network_offset(*pskb) + ip_hdrlen(*pskb),
+                           ct, ctinfo);
 }
 
 static unsigned int ipv4_conntrack_defrag(unsigned int hooknum,
index cdbc6c1358494c616d8146c9a23712ca6c92e308..3b690cf2a4ee62263a16c11c6f69d861f42e1056 100644 (file)
@@ -260,7 +260,7 @@ static int snmp_seq_show(struct seq_file *seq, void *v)
                seq_printf(seq, " %s", snmp4_ipstats_list[i].name);
 
        seq_printf(seq, "\nIp: %d %d",
-                       ipv4_devconf.forwarding ? 1 : 2, sysctl_ip_default_ttl);
+                  IPV4_DEVCONF_ALL(FORWARDING) ? 1 : 2, sysctl_ip_default_ttl);
 
        for (i = 0; snmp4_ipstats_list[i].name != NULL; i++)
                seq_printf(seq, " %lu",
index 8603cfb271f2c49d673d6ac24999872597a2f080..29ca63e81ced23877fe568573b8522e0ce16d8a1 100644 (file)
@@ -1636,7 +1636,7 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
 
        atomic_set(&rth->u.dst.__refcnt, 1);
        rth->u.dst.flags= DST_HOST;
-       if (in_dev->cnf.no_policy)
+       if (IN_DEV_CONF_GET(in_dev, NOPOLICY))
                rth->u.dst.flags |= DST_NOPOLICY;
        rth->fl.fl4_dst = daddr;
        rth->rt_dst     = daddr;
@@ -1778,9 +1778,9 @@ static inline int __mkroute_input(struct sk_buff *skb,
        if (res->fi->fib_nhs > 1)
                rth->u.dst.flags |= DST_BALANCED;
 #endif
-       if (in_dev->cnf.no_policy)
+       if (IN_DEV_CONF_GET(in_dev, NOPOLICY))
                rth->u.dst.flags |= DST_NOPOLICY;
-       if (out_dev->cnf.no_xfrm)
+       if (IN_DEV_CONF_GET(out_dev, NOXFRM))
                rth->u.dst.flags |= DST_NOXFRM;
        rth->fl.fl4_dst = daddr;
        rth->rt_dst     = daddr;
@@ -2021,7 +2021,7 @@ local_input:
 
        atomic_set(&rth->u.dst.__refcnt, 1);
        rth->u.dst.flags= DST_HOST;
-       if (in_dev->cnf.no_policy)
+       if (IN_DEV_CONF_GET(in_dev, NOPOLICY))
                rth->u.dst.flags |= DST_NOPOLICY;
        rth->fl.fl4_dst = daddr;
        rth->rt_dst     = daddr;
@@ -2218,9 +2218,9 @@ static inline int __mkroute_output(struct rtable **result,
                        rth->u.dst.flags |= DST_BALANCED;
        }
 #endif
-       if (in_dev->cnf.no_xfrm)
+       if (IN_DEV_CONF_GET(in_dev, NOXFRM))
                rth->u.dst.flags |= DST_NOXFRM;
-       if (in_dev->cnf.no_policy)
+       if (IN_DEV_CONF_GET(in_dev, NOPOLICY))
                rth->u.dst.flags |= DST_NOPOLICY;
 
        rth->fl.fl4_dst = oldflp->fl4_dst;
@@ -2759,7 +2759,7 @@ static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
                __be32 dst = rt->rt_dst;
 
                if (MULTICAST(dst) && !LOCAL_MCAST(dst) &&
-                   ipv4_devconf.mc_forwarding) {
+                   IPV4_DEVCONF_ALL(MC_FORWARDING)) {
                        int err = ipmr_get_route(skb, r, nowait);
                        if (err <= 0) {
                                if (!nowait) {
index 6817d6485df5c195430ab808c2c345e8d6e15ba4..53ef0f4bbdaa507137d0a99b7a120fe43bddf1bb 100644 (file)
@@ -37,12 +37,12 @@ static
 int ipv4_sysctl_forward(ctl_table *ctl, int write, struct file * filp,
                        void __user *buffer, size_t *lenp, loff_t *ppos)
 {
-       int val = ipv4_devconf.forwarding;
+       int val = IPV4_DEVCONF_ALL(FORWARDING);
        int ret;
 
        ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
 
-       if (write && ipv4_devconf.forwarding != val)
+       if (write && IPV4_DEVCONF_ALL(FORWARDING) != val)
                inet_forward_change();
 
        return ret;
@@ -222,7 +222,7 @@ ctl_table ipv4_table[] = {
        {
                .ctl_name       = NET_IPV4_FORWARD,
                .procname       = "ip_forward",
-               .data           = &ipv4_devconf.forwarding,
+               .data           = &IPV4_DEVCONF_ALL(FORWARDING),
                .maxlen         = sizeof(int),
                .mode           = 0644,
                .proc_handler   = &ipv4_sysctl_forward,
index 281c9f9132570afd83a7e11772d49771c8300d6c..dd9ef65ad3ff9e26fbeee30676edb4c99df4e7ad 100644 (file)
@@ -29,7 +29,7 @@ static int fast_convergence = 1;
 static int max_increment = 16;
 static int low_window = 14;
 static int beta = 819;         /* = 819/1024 (BICTCP_BETA_SCALE) */
-static int initial_ssthresh = 100;
+static int initial_ssthresh;
 static int smooth_part = 20;
 
 module_param(fast_convergence, int, 0644);
index 14224487b16ba4de368e5b341cbfb6ba5a159014..ebfaac2f9f462854ce98c5e96a707ae5649e8287 100644 (file)
@@ -29,7 +29,7 @@
 static int fast_convergence __read_mostly = 1;
 static int max_increment __read_mostly = 16;
 static int beta __read_mostly = 819;   /* = 819/1024 (BICTCP_BETA_SCALE) */
-static int initial_ssthresh __read_mostly = 100;
+static int initial_ssthresh __read_mostly;
 static int bic_scale __read_mostly = 41;
 static int tcp_friendliness __read_mostly = 1;
 
index 4adc47c55351a49d09d172b1cb5a3baa194207bc..b2b2256d3b8450c944bc8d3a8869a76aaf2ceb69 100644 (file)
@@ -90,6 +90,9 @@ static void tcp_illinois_acked(struct sock *sk, u32 pkts_acked, ktime_t last)
 
        ca->acked = pkts_acked;
 
+       if (ktime_equal(last, net_invalid_timestamp()))
+               return;
+
        rtt = ktime_to_us(net_timedelta(last));
 
        /* ignore bogus values, this prevents wraparound in alpha math */
index 74683d81c3f18f8c3450b3100ff89373179ea101..69f9f1ef3ef69bc1d3ed88fa410443ac32af40a3 100644 (file)
@@ -953,7 +953,7 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
        int prior_fackets;
        u32 lost_retrans = 0;
        int flag = 0;
-       int dup_sack = 0;
+       int found_dup_sack = 0;
        int cached_fack_count;
        int i;
        int first_sack_index;
@@ -964,20 +964,20 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
 
        /* Check for D-SACK. */
        if (before(ntohl(sp[0].start_seq), TCP_SKB_CB(ack_skb)->ack_seq)) {
-               dup_sack = 1;
+               found_dup_sack = 1;
                tp->rx_opt.sack_ok |= 4;
                NET_INC_STATS_BH(LINUX_MIB_TCPDSACKRECV);
        } else if (num_sacks > 1 &&
                        !after(ntohl(sp[0].end_seq), ntohl(sp[1].end_seq)) &&
                        !before(ntohl(sp[0].start_seq), ntohl(sp[1].start_seq))) {
-               dup_sack = 1;
+               found_dup_sack = 1;
                tp->rx_opt.sack_ok |= 4;
                NET_INC_STATS_BH(LINUX_MIB_TCPDSACKOFORECV);
        }
 
        /* D-SACK for already forgotten data...
         * Do dumb counting. */
-       if (dup_sack &&
+       if (found_dup_sack &&
                        !after(ntohl(sp[0].end_seq), prior_snd_una) &&
                        after(ntohl(sp[0].end_seq), tp->undo_marker))
                tp->undo_retrans--;
@@ -1058,6 +1058,7 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
                __u32 start_seq = ntohl(sp->start_seq);
                __u32 end_seq = ntohl(sp->end_seq);
                int fack_count;
+               int dup_sack = (found_dup_sack && (i == first_sack_index));
 
                skb = cached_skb;
                fack_count = cached_fack_count;
@@ -2037,7 +2038,7 @@ static void tcp_try_to_open(struct sock *sk, int flag)
 {
        struct tcp_sock *tp = tcp_sk(sk);
 
-       tp->left_out = tp->sacked_out;
+       tcp_sync_left_out(tp);
 
        if (tp->retrans_out == 0)
                tp->retrans_stamp = 0;
@@ -2409,7 +2410,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p)
        int acked = 0;
        int prior_packets = tp->packets_out;
        __s32 seq_rtt = -1;
-       ktime_t last_ackt = ktime_set(0,0);
+       ktime_t last_ackt = net_invalid_timestamp();
 
        while ((skb = tcp_write_queue_head(sk)) &&
               skb != tcp_send_head(sk)) {
@@ -2487,6 +2488,10 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p)
                tcp_ack_update_rtt(sk, acked, seq_rtt);
                tcp_ack_packets_out(sk);
 
+               /* Is the ACK triggering packet unambiguous? */
+               if (acked & FLAG_RETRANS_DATA_ACKED)
+                       last_ackt = net_invalid_timestamp();
+
                if (ca_ops->pkts_acked)
                        ca_ops->pkts_acked(sk, pkts_acked, last_ackt);
        }
@@ -2932,6 +2937,7 @@ void tcp_parse_options(struct sk_buff *skb, struct tcp_options_received *opt_rx,
                                           opt_rx->sack_ok) {
                                                TCP_SKB_CB(skb)->sacked = (ptr - 2) - (unsigned char *)th;
                                        }
+                                       break;
 #ifdef CONFIG_TCP_MD5SIG
                                case TCPOPT_MD5SIG:
                                        /*
index 47c61055eb601ae73a68b899fdccf5bb8e1921b2..354721d67f69d21df640d32f24c86ccd3ec90ad9 100644 (file)
@@ -705,6 +705,8 @@ static void tcp_v4_send_ack(struct tcp_timewait_sock *twsk,
                                      ip_hdr(skb)->saddr, /* XXX */
                                      arg.iov[0].iov_len, IPPROTO_TCP, 0);
        arg.csumoffset = offsetof(struct tcphdr, check) / 2;
+       if (twsk)
+               arg.bound_dev_if = twsk->tw_sk.tw_bound_dev_if;
 
        ip_send_reply(tcp_socket->sk, skb, &arg, arg.iov[0].iov_len);
 
@@ -876,6 +878,7 @@ int tcp_v4_md5_do_add(struct sock *sk, __be32 addr,
                                kfree(newkey);
                                return -ENOMEM;
                        }
+                       sk->sk_route_caps &= ~NETIF_F_GSO_MASK;
                }
                if (tcp_alloc_md5sig_pool() == NULL) {
                        kfree(newkey);
@@ -1005,7 +1008,7 @@ static int tcp_v4_parse_md5_keys(struct sock *sk, char __user *optval,
                        return -EINVAL;
 
                tp->md5sig_info = p;
-
+               sk->sk_route_caps &= ~NETIF_F_GSO_MASK;
        }
 
        newkey = kmemdup(cmd.tcpm_key, cmd.tcpm_keylen, GFP_KERNEL);
index 43294ad9f63ef839cd26f693ccf1a4eb8b4173ee..e49836ce012e768a4586432f7b62be9a0b6e5140 100644 (file)
@@ -266,7 +266,8 @@ static void tcp_lp_pkts_acked(struct sock *sk, u32 num_acked, ktime_t last)
        struct tcp_sock *tp = tcp_sk(sk);
        struct lp *lp = inet_csk_ca(sk);
 
-       tcp_lp_rtt_sample(sk,  ktime_to_us(net_timedelta(last)));
+       if (!ktime_equal(last, net_invalid_timestamp()))
+               tcp_lp_rtt_sample(sk,  ktime_to_us(net_timedelta(last)));
 
        /* calc inference */
        if (tcp_time_stamp > tp->rx_opt.rcv_tsecr)
index 760165a0800c317884015f7997b3106aa7ad8562..d9323dfff82620487b413ce9e6b61fa426108e37 100644 (file)
@@ -62,6 +62,9 @@ struct {
  * Print to log with timestamps.
  * FIXME: causes an extra copy
  */
+static void printl(const char *fmt, ...)
+       __attribute__ ((format (printf, 1, 2)));
+
 static void printl(const char *fmt, ...)
 {
        va_list args;
@@ -80,8 +83,7 @@ static void printl(const char *fmt, ...)
 
        kfifo_put(tcpw.fifo, tbuf, len);
        wake_up(&tcpw.wait);
-} __attribute__ ((format (printf, 1, 2)));
-
+}
 
 /*
  * Hook inserted to be called before each receive packet.
index e61340150ba6c3aacdf9d5012b7e50f382e5be4d..e9b151b3a598e46dfd162bdc4645bdb083d48e83 100644 (file)
@@ -292,9 +292,9 @@ static void tcp_retransmit_timer(struct sock *sk)
                 * we cannot allow such beasts to hang infinitely.
                 */
 #ifdef TCP_DEBUG
-               if (net_ratelimit()) {
+               if (1) {
                        struct inet_sock *inet = inet_sk(sk);
-                       printk(KERN_DEBUG "TCP: Treason uncloaked! Peer %u.%u.%u.%u:%u/%u shrinks window %u:%u. Repaired.\n",
+                       LIMIT_NETDEBUG(KERN_DEBUG "TCP: Treason uncloaked! Peer %u.%u.%u.%u:%u/%u shrinks window %u:%u. Repaired.\n",
                               NIPQUAD(inet->daddr), ntohs(inet->dport),
                               inet->num, tp->snd_una, tp->snd_nxt);
                }
index 73e19cf7df2176e6189c45569939bf42e51f0363..e218a51ceced186b9c37acab906009dfbfe94233 100644 (file)
@@ -117,6 +117,9 @@ void tcp_vegas_pkts_acked(struct sock *sk, u32 cnt, ktime_t last)
        struct vegas *vegas = inet_csk_ca(sk);
        u32 vrtt;
 
+       if (ktime_equal(last, net_invalid_timestamp()))
+               return;
+
        /* Never allow zero rtt or baseRTT */
        vrtt = ktime_to_us(net_timedelta(last)) + 1;
 
index 9edb340f2f95c6e003f5ff09f135425423881134..ec854cc5fad50fd90899818086310cd51b61cbdc 100644 (file)
@@ -74,6 +74,9 @@ static void tcp_veno_pkts_acked(struct sock *sk, u32 cnt, ktime_t last)
        struct veno *veno = inet_csk_ca(sk);
        u32 vrtt;
 
+       if (ktime_equal(last, net_invalid_timestamp()))
+               return;
+
        /* Never allow zero rtt or baseRTT */
        vrtt = ktime_to_us(net_timedelta(last)) + 1;
 
index 5da703e699da243afcf6e660d0e6a3df09979981..facb7e29304e7df9a7a172d2e4ad2f63acfa1074 100644 (file)
@@ -114,36 +114,14 @@ DEFINE_RWLOCK(udp_hash_lock);
 
 static int udp_port_rover;
 
-/*
- * Note about this hash function :
- * Typical use is probably daddr = 0, only dport is going to vary hash
- */
-static inline unsigned int udp_hash_port(__u16 port)
-{
-       return port;
-}
-
-static inline int __udp_lib_port_inuse(unsigned int hash, int port,
-                                      const struct sock *this_sk,
-                                      struct hlist_head udptable[],
-                                      const struct udp_get_port_ops *ops)
+static inline int __udp_lib_lport_inuse(__u16 num, struct hlist_head udptable[])
 {
        struct sock *sk;
        struct hlist_node *node;
-       struct inet_sock *inet;
 
-       sk_for_each(sk, node, &udptable[hash & (UDP_HTABLE_SIZE - 1)]) {
-               if (sk->sk_hash != hash)
-                       continue;
-               inet = inet_sk(sk);
-               if (inet->num != port)
-                       continue;
-               if (this_sk) {
-                       if (ops->saddr_cmp(sk, this_sk))
-                               return 1;
-               } else if (ops->saddr_any(sk))
+       sk_for_each(sk, node, &udptable[num & (UDP_HTABLE_SIZE - 1)])
+               if (sk->sk_hash == num)
                        return 1;
-       }
        return 0;
 }
 
@@ -154,16 +132,16 @@ static inline int __udp_lib_port_inuse(unsigned int hash, int port,
  *  @snum:        port number to look up
  *  @udptable:    hash list table, must be of UDP_HTABLE_SIZE
  *  @port_rover:  pointer to record of last unallocated port
- *  @ops:         AF-dependent address operations
+ *  @saddr_comp:  AF-dependent comparison of bound local IP addresses
  */
 int __udp_lib_get_port(struct sock *sk, unsigned short snum,
                       struct hlist_head udptable[], int *port_rover,
-                      const struct udp_get_port_ops *ops)
+                      int (*saddr_comp)(const struct sock *sk1,
+                                        const struct sock *sk2 )    )
 {
        struct hlist_node *node;
        struct hlist_head *head;
        struct sock *sk2;
-       unsigned int hash;
        int    error = 1;
 
        write_lock_bh(&udp_hash_lock);
@@ -178,8 +156,7 @@ int __udp_lib_get_port(struct sock *sk, unsigned short snum,
                for (i = 0; i < UDP_HTABLE_SIZE; i++, result++) {
                        int size;
 
-                       hash = ops->hash_port_and_rcv_saddr(result, sk);
-                       head = &udptable[hash & (UDP_HTABLE_SIZE - 1)];
+                       head = &udptable[result & (UDP_HTABLE_SIZE - 1)];
                        if (hlist_empty(head)) {
                                if (result > sysctl_local_port_range[1])
                                        result = sysctl_local_port_range[0] +
@@ -204,16 +181,7 @@ int __udp_lib_get_port(struct sock *sk, unsigned short snum,
                                result = sysctl_local_port_range[0]
                                        + ((result - sysctl_local_port_range[0]) &
                                           (UDP_HTABLE_SIZE - 1));
-                       hash = udp_hash_port(result);
-                       if (__udp_lib_port_inuse(hash, result,
-                                                NULL, udptable, ops))
-                               continue;
-                       if (ops->saddr_any(sk))
-                               break;
-
-                       hash = ops->hash_port_and_rcv_saddr(result, sk);
-                       if (! __udp_lib_port_inuse(hash, result,
-                                                  sk, udptable, ops))
+                       if (! __udp_lib_lport_inuse(result, udptable))
                                break;
                }
                if (i >= (1 << 16) / UDP_HTABLE_SIZE)
@@ -221,40 +189,21 @@ int __udp_lib_get_port(struct sock *sk, unsigned short snum,
 gotit:
                *port_rover = snum = result;
        } else {
-               hash = udp_hash_port(snum);
-               head = &udptable[hash & (UDP_HTABLE_SIZE - 1)];
+               head = &udptable[snum & (UDP_HTABLE_SIZE - 1)];
 
                sk_for_each(sk2, node, head)
-                       if (sk2->sk_hash == hash &&
-                           sk2 != sk &&
-                           inet_sk(sk2)->num == snum &&
-                           (!sk2->sk_reuse || !sk->sk_reuse) &&
-                           (!sk2->sk_bound_dev_if || !sk->sk_bound_dev_if ||
-                            sk2->sk_bound_dev_if == sk->sk_bound_dev_if) &&
-                           ops->saddr_cmp(sk, sk2))
+                       if (sk2->sk_hash == snum                             &&
+                           sk2 != sk                                        &&
+                           (!sk2->sk_reuse        || !sk->sk_reuse)         &&
+                           (!sk2->sk_bound_dev_if || !sk->sk_bound_dev_if
+                            || sk2->sk_bound_dev_if == sk->sk_bound_dev_if) &&
+                           (*saddr_comp)(sk, sk2)                             )
                                goto fail;
-
-               if (!ops->saddr_any(sk)) {
-                       hash = ops->hash_port_and_rcv_saddr(snum, sk);
-                       head = &udptable[hash & (UDP_HTABLE_SIZE - 1)];
-
-                       sk_for_each(sk2, node, head)
-                               if (sk2->sk_hash == hash &&
-                                   sk2 != sk &&
-                                   inet_sk(sk2)->num == snum &&
-                                   (!sk2->sk_reuse || !sk->sk_reuse) &&
-                                   (!sk2->sk_bound_dev_if ||
-                                    !sk->sk_bound_dev_if ||
-                                    sk2->sk_bound_dev_if ==
-                                    sk->sk_bound_dev_if) &&
-                                   ops->saddr_cmp(sk, sk2))
-                                       goto fail;
-               }
        }
        inet_sk(sk)->num = snum;
-       sk->sk_hash = hash;
+       sk->sk_hash = snum;
        if (sk_unhashed(sk)) {
-               head = &udptable[hash & (UDP_HTABLE_SIZE - 1)];
+               head = &udptable[snum & (UDP_HTABLE_SIZE - 1)];
                sk_add_node(sk, head);
                sock_prot_inc_use(sk->sk_prot);
        }
@@ -265,12 +214,12 @@ fail:
 }
 
 int udp_get_port(struct sock *sk, unsigned short snum,
-                const struct udp_get_port_ops *ops)
+                       int (*scmp)(const struct sock *, const struct sock *))
 {
-       return  __udp_lib_get_port(sk, snum, udp_hash, &udp_port_rover, ops);
+       return  __udp_lib_get_port(sk, snum, udp_hash, &udp_port_rover, scmp);
 }
 
-static int ipv4_rcv_saddr_equal(const struct sock *sk1, const struct sock *sk2)
+int ipv4_rcv_saddr_equal(const struct sock *sk1, const struct sock *sk2)
 {
        struct inet_sock *inet1 = inet_sk(sk1), *inet2 = inet_sk(sk2);
 
@@ -279,33 +228,9 @@ static int ipv4_rcv_saddr_equal(const struct sock *sk1, const struct sock *sk2)
                   inet1->rcv_saddr == inet2->rcv_saddr      ));
 }
 
-static int ipv4_rcv_saddr_any(const struct sock *sk)
-{
-       return !inet_sk(sk)->rcv_saddr;
-}
-
-static inline unsigned int ipv4_hash_port_and_addr(__u16 port, __be32 addr)
-{
-       addr ^= addr >> 16;
-       addr ^= addr >> 8;
-       return port ^ addr;
-}
-
-static unsigned int ipv4_hash_port_and_rcv_saddr(__u16 port,
-                                                const struct sock *sk)
-{
-       return ipv4_hash_port_and_addr(port, inet_sk(sk)->rcv_saddr);
-}
-
-const struct udp_get_port_ops udp_ipv4_ops = {
-       .saddr_cmp = ipv4_rcv_saddr_equal,
-       .saddr_any = ipv4_rcv_saddr_any,
-       .hash_port_and_rcv_saddr = ipv4_hash_port_and_rcv_saddr,
-};
-
 static inline int udp_v4_get_port(struct sock *sk, unsigned short snum)
 {
-       return udp_get_port(sk, snum, &udp_ipv4_ops);
+       return udp_get_port(sk, snum, ipv4_rcv_saddr_equal);
 }
 
 /* UDP is nearly always wildcards out the wazoo, it makes no sense to try
@@ -317,77 +242,63 @@ static struct sock *__udp4_lib_lookup(__be32 saddr, __be16 sport,
 {
        struct sock *sk, *result = NULL;
        struct hlist_node *node;
-       unsigned int hash, hashwild;
-       int score, best = -1, hport = ntohs(dport);
-
-       hash = ipv4_hash_port_and_addr(hport, daddr);
-       hashwild = udp_hash_port(hport);
+       unsigned short hnum = ntohs(dport);
+       int badness = -1;
 
        read_lock(&udp_hash_lock);
-
-lookup:
-
-       sk_for_each(sk, node, &udptable[hash & (UDP_HTABLE_SIZE - 1)]) {
+       sk_for_each(sk, node, &udptable[hnum & (UDP_HTABLE_SIZE - 1)]) {
                struct inet_sock *inet = inet_sk(sk);
 
-               if (sk->sk_hash != hash || ipv6_only_sock(sk) ||
-                       inet->num != hport)
-                       continue;
-
-               score = (sk->sk_family == PF_INET ? 1 : 0);
-               if (inet->rcv_saddr) {
-                       if (inet->rcv_saddr != daddr)
-                               continue;
-                       score+=2;
-               }
-               if (inet->daddr) {
-                       if (inet->daddr != saddr)
-                               continue;
-                       score+=2;
-               }
-               if (inet->dport) {
-                       if (inet->dport != sport)
-                               continue;
-                       score+=2;
-               }
-               if (sk->sk_bound_dev_if) {
-                       if (sk->sk_bound_dev_if != dif)
-                               continue;
-                       score+=2;
-               }
-               if (score == 9) {
-                       result = sk;
-                       goto found;
-               } else if (score > best) {
-                       result = sk;
-                       best = score;
+               if (sk->sk_hash == hnum && !ipv6_only_sock(sk)) {
+                       int score = (sk->sk_family == PF_INET ? 1 : 0);
+                       if (inet->rcv_saddr) {
+                               if (inet->rcv_saddr != daddr)
+                                       continue;
+                               score+=2;
+                       }
+                       if (inet->daddr) {
+                               if (inet->daddr != saddr)
+                                       continue;
+                               score+=2;
+                       }
+                       if (inet->dport) {
+                               if (inet->dport != sport)
+                                       continue;
+                               score+=2;
+                       }
+                       if (sk->sk_bound_dev_if) {
+                               if (sk->sk_bound_dev_if != dif)
+                                       continue;
+                               score+=2;
+                       }
+                       if (score == 9) {
+                               result = sk;
+                               break;
+                       } else if (score > badness) {
+                               result = sk;
+                               badness = score;
+                       }
                }
        }
-
-       if (hash != hashwild) {
-               hash = hashwild;
-               goto lookup;
-       }
-found:
        if (result)
                sock_hold(result);
        read_unlock(&udp_hash_lock);
        return result;
 }
 
-static inline struct sock *udp_v4_mcast_next(struct sock *sk, unsigned int hnum,
-                                            int hport, __be32 loc_addr,
+static inline struct sock *udp_v4_mcast_next(struct sock *sk,
+                                            __be16 loc_port, __be32 loc_addr,
                                             __be16 rmt_port, __be32 rmt_addr,
                                             int dif)
 {
        struct hlist_node *node;
        struct sock *s = sk;
+       unsigned short hnum = ntohs(loc_port);
 
        sk_for_each_from(s, node) {
                struct inet_sock *inet = inet_sk(s);
 
                if (s->sk_hash != hnum                                  ||
-                   inet->num != hport                                  ||
                    (inet->daddr && inet->daddr != rmt_addr)            ||
                    (inet->dport != rmt_port && inet->dport)            ||
                    (inet->rcv_saddr && inet->rcv_saddr != loc_addr)    ||
@@ -1221,45 +1132,29 @@ static int __udp4_lib_mcast_deliver(struct sk_buff *skb,
                                    __be32 saddr, __be32 daddr,
                                    struct hlist_head udptable[])
 {
-       struct sock *sk, *skw, *sknext;
+       struct sock *sk;
        int dif;
-       int hport = ntohs(uh->dest);
-       unsigned int hash = ipv4_hash_port_and_addr(hport, daddr);
-       unsigned int hashwild = udp_hash_port(hport);
-
-       dif = skb->dev->ifindex;
 
        read_lock(&udp_hash_lock);
-
-       sk = sk_head(&udptable[hash & (UDP_HTABLE_SIZE - 1)]);
-       skw = sk_head(&udptable[hashwild & (UDP_HTABLE_SIZE - 1)]);
-
-       sk = udp_v4_mcast_next(sk, hash, hport, daddr, uh->source, saddr, dif);
-       if (!sk) {
-               hash = hashwild;
-               sk = udp_v4_mcast_next(skw, hash, hport, daddr, uh->source,
-                       saddr, dif);
-       }
+       sk = sk_head(&udptable[ntohs(uh->dest) & (UDP_HTABLE_SIZE - 1)]);
+       dif = skb->dev->ifindex;
+       sk = udp_v4_mcast_next(sk, uh->dest, daddr, uh->source, saddr, dif);
        if (sk) {
+               struct sock *sknext = NULL;
+
                do {
                        struct sk_buff *skb1 = skb;
-                       sknext = udp_v4_mcast_next(sk_next(sk), hash, hport,
-                                               daddr, uh->source, saddr, dif);
-                       if (!sknext && hash != hashwild) {
-                               hash = hashwild;
-                               sknext = udp_v4_mcast_next(skw, hash, hport,
-                                       daddr, uh->source, saddr, dif);
-                       }
+
+                       sknext = udp_v4_mcast_next(sk_next(sk), uh->dest, daddr,
+                                                  uh->source, saddr, dif);
                        if (sknext)
                                skb1 = skb_clone(skb, GFP_ATOMIC);
 
                        if (skb1) {
                                int ret = udp_queue_rcv_skb(sk, skb1);
                                if (ret > 0)
-                                       /*
-                                        * we should probably re-process
-                                        * instead of dropping packets here.
-                                        */
+                                       /* we should probably re-process instead
+                                        * of dropping packets here. */
                                        kfree_skb(skb1);
                        }
                        sk = sknext;
@@ -1346,7 +1241,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
                return __udp4_lib_mcast_deliver(skb, uh, saddr, daddr, udptable);
 
        sk = __udp4_lib_lookup(saddr, uh->source, daddr, uh->dest,
-                              skb->dev->ifindex, udptable);
+                              skb->dev->ifindex, udptable        );
 
        if (sk != NULL) {
                int ret = udp_queue_rcv_skb(sk, skb);
index 06d94195e644848fa464f54456c4abb450496a25..820a477cfaa6e9899234b03ee8120c9ca158babd 100644 (file)
@@ -5,14 +5,14 @@
 #include <net/protocol.h>
 #include <net/inet_common.h>
 
-extern const struct udp_get_port_ops udp_ipv4_ops;
-
 extern int     __udp4_lib_rcv(struct sk_buff *, struct hlist_head [], int );
 extern void    __udp4_lib_err(struct sk_buff *, u32, struct hlist_head []);
 
 extern int     __udp_lib_get_port(struct sock *sk, unsigned short snum,
                                   struct hlist_head udptable[], int *port_rover,
-                                  const struct udp_get_port_ops *ops);
+                                  int (*)(const struct sock*,const struct sock*));
+extern int     ipv4_rcv_saddr_equal(const struct sock *, const struct sock *);
+
 
 extern int     udp_setsockopt(struct sock *sk, int level, int optname,
                               char __user *optval, int optlen);
index 3653b32dce2d79f6ec18eb2a484aaf325448578a..f34fd686a8f15ac6e49b687742701c1037ab1417 100644 (file)
@@ -19,15 +19,14 @@ struct hlist_head   udplite_hash[UDP_HTABLE_SIZE];
 static int             udplite_port_rover;
 
 int udplite_get_port(struct sock *sk, unsigned short p,
-                    const struct udp_get_port_ops *ops)
+                    int (*c)(const struct sock *, const struct sock *))
 {
-       return  __udp_lib_get_port(sk, p, udplite_hash,
-                                  &udplite_port_rover, ops);
+       return  __udp_lib_get_port(sk, p, udplite_hash, &udplite_port_rover, c);
 }
 
 static int udplite_v4_get_port(struct sock *sk, unsigned short snum)
 {
-       return udplite_get_port(sk, snum, &udp_ipv4_ops);
+       return udplite_get_port(sk, snum, ipv4_rcv_saddr_equal);
 }
 
 static int udplite_rcv(struct sk_buff *skb)
index 329de679ac383c656122a80013076133d7643fc6..f96ed76d8fa4be902ea922f113bb6a18dab6010b 100644 (file)
@@ -2154,6 +2154,15 @@ static void addrconf_dev_config(struct net_device *dev)
 
        ASSERT_RTNL();
 
+       if ((dev->type != ARPHRD_ETHER) &&
+           (dev->type != ARPHRD_FDDI) &&
+           (dev->type != ARPHRD_IEEE802_TR) &&
+           (dev->type != ARPHRD_ARCNET) &&
+           (dev->type != ARPHRD_INFINIBAND)) {
+               /* Alas, we support only Ethernet autoconfiguration. */
+               return;
+       }
+
        idev = addrconf_add_dev(dev);
        if (idev == NULL)
                return;
@@ -2241,36 +2250,16 @@ static void addrconf_ip6_tnl_config(struct net_device *dev)
        ip6_tnl_add_linklocal(idev);
 }
 
-static int ipv6_hwtype(struct net_device *dev)
-{
-       if ((dev->type == ARPHRD_ETHER) ||
-           (dev->type == ARPHRD_LOOPBACK) ||
-           (dev->type == ARPHRD_SIT) ||
-           (dev->type == ARPHRD_TUNNEL6) ||
-           (dev->type == ARPHRD_FDDI) ||
-           (dev->type == ARPHRD_IEEE802_TR) ||
-           (dev->type == ARPHRD_ARCNET) ||
-           (dev->type == ARPHRD_INFINIBAND))
-               return 1;
-
-       return 0;
-}
-
 static int addrconf_notify(struct notifier_block *this, unsigned long event,
                           void * data)
 {
        struct net_device *dev = (struct net_device *) data;
-       struct inet6_dev *idev;
+       struct inet6_dev *idev = __in6_dev_get(dev);
        int run_pending = 0;
 
-       if (!ipv6_hwtype(dev))
-               return NOTIFY_OK;
-
-       idev = __in6_dev_get(dev);
-
        switch(event) {
        case NETDEV_REGISTER:
-               if (!idev) {
+               if (!idev && dev->mtu >= IPV6_MIN_MTU) {
                        idev = ipv6_add_dev(dev);
                        if (!idev)
                                printk(KERN_WARNING "IPv6: add_dev failed for %s\n",
@@ -2990,7 +2979,7 @@ static struct in6_addr *extract_addr(struct nlattr *addr, struct nlattr *local)
        return pfx;
 }
 
-static struct nla_policy ifa_ipv6_policy[IFA_MAX+1] __read_mostly = {
+static const struct nla_policy ifa_ipv6_policy[IFA_MAX+1] = {
        [IFA_ADDRESS]           = { .len = sizeof(struct in6_addr) },
        [IFA_LOCAL]             = { .len = sizeof(struct in6_addr) },
        [IFA_CACHEINFO]         = { .len = sizeof(struct ifa_cacheinfo) },
index fc3882c906049ce8b051b30c1658fa20e1f6fce6..53b3998a486ced67d9eae000cff6c9a1269ecf66 100644 (file)
@@ -157,7 +157,7 @@ static int fib6_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
        return 1;
 }
 
-static struct nla_policy fib6_rule_policy[FRA_MAX+1] __read_mostly = {
+static const struct nla_policy fib6_rule_policy[FRA_MAX+1] = {
        FRA_GENERIC_POLICY,
 };
 
index dc442fb791b0c2c7dcc58a2c8d45eca3dc76ff4a..1b1797f1f33d0e839926dab7b3fcc88cfacb85c8 100644 (file)
@@ -160,6 +160,7 @@ static unsigned int ipv6_confirm(unsigned int hooknum,
 {
        struct nf_conn *ct;
        struct nf_conn_help *help;
+       struct nf_conntrack_helper *helper;
        enum ip_conntrack_info ctinfo;
        unsigned int ret, protoff;
        unsigned int extoff = (u8 *)(ipv6_hdr(*pskb) + 1) - (*pskb)->data;
@@ -172,7 +173,11 @@ static unsigned int ipv6_confirm(unsigned int hooknum,
                goto out;
 
        help = nfct_help(ct);
-       if (!help || !help->helper)
+       if (!help)
+               goto out;
+       /* rcu_read_lock()ed by nf_hook_slow */
+       helper = rcu_dereference(help->helper);
+       if (!helper)
                goto out;
 
        protoff = nf_ct_ipv6_skip_exthdr(*pskb, extoff, &pnum,
@@ -182,7 +187,7 @@ static unsigned int ipv6_confirm(unsigned int hooknum,
                return NF_ACCEPT;
        }
 
-       ret = help->helper->help(pskb, protoff, ct, ctinfo);
+       ret = helper->help(pskb, protoff, ct, ctinfo);
        if (ret != NF_ACCEPT)
                return ret;
 out:
index 1324b06796c0b10aeb8915daebece85e55c854ed..fe8d9837f9f89a2067b5f633d5a9cdd992385bf2 100644 (file)
@@ -1999,7 +1999,7 @@ void rt6_mtu_change(struct net_device *dev, unsigned mtu)
        fib6_clean_all(rt6_mtu_change_route, 0, &arg);
 }
 
-static struct nla_policy rtm_ipv6_policy[RTA_MAX+1] __read_mostly = {
+static const struct nla_policy rtm_ipv6_policy[RTA_MAX+1] = {
        [RTA_GATEWAY]           = { .len = sizeof(struct in6_addr) },
        [RTA_OIF]               = { .type = NLA_U32 },
        [RTA_IIF]               = { .type = NLA_U32 },
index 4f06a51ad4fd73ebd6406a1cadb4b1840e6db8ca..193d9d60bb7a8fabb0ab3eec481e1a7ce0ff1b86 100644 (file)
@@ -590,6 +590,7 @@ static int tcp_v6_md5_do_add(struct sock *sk, struct in6_addr *peer,
                                kfree(newkey);
                                return -ENOMEM;
                        }
+                       sk->sk_route_caps &= ~NETIF_F_GSO_MASK;
                }
                tcp_alloc_md5sig_pool();
                if (tp->md5sig_info->alloced6 == tp->md5sig_info->entries6) {
@@ -724,6 +725,7 @@ static int tcp_v6_parse_md5_keys (struct sock *sk, char __user *optval,
                        return -ENOMEM;
 
                tp->md5sig_info = p;
+               sk->sk_route_caps &= ~NETIF_F_GSO_MASK;
        }
 
        newkey = kmemdup(cmd.tcpm_key, cmd.tcpm_keylen, GFP_KERNEL);
index d1fbddd172e76c277625254641e59ae884488f0a..4210951edb6e9f0d6b8d88d917d99dd34689c5db 100644 (file)
 
 DEFINE_SNMP_STAT(struct udp_mib, udp_stats_in6) __read_mostly;
 
-static int ipv6_rcv_saddr_any(const struct sock *sk)
-{
-       struct ipv6_pinfo *np = inet6_sk(sk);
-
-       return ipv6_addr_any(&np->rcv_saddr);
-}
-
-static unsigned int ipv6_hash_port_and_rcv_saddr(__u16 port,
-                                                const struct sock *sk)
-{
-       return port;
-}
-
-const struct udp_get_port_ops udp_ipv6_ops = {
-       .saddr_cmp = ipv6_rcv_saddr_equal,
-       .saddr_any = ipv6_rcv_saddr_any,
-       .hash_port_and_rcv_saddr = ipv6_hash_port_and_rcv_saddr,
-};
-
 static inline int udp_v6_get_port(struct sock *sk, unsigned short snum)
 {
-       return udp_get_port(sk, snum, &udp_ipv6_ops);
+       return udp_get_port(sk, snum, ipv6_rcv_saddr_equal);
 }
 
 static struct sock *__udp6_lib_lookup(struct in6_addr *saddr, __be16 sport,
index 36b0c11a28a312dcad2bfa6f82d4bbd057dd307e..6e252f318f7c91c81f5cdf04d2822b476f26a8ae 100644 (file)
@@ -6,8 +6,6 @@
 #include <net/addrconf.h>
 #include <net/inet_common.h>
 
-extern const struct udp_get_port_ops udp_ipv6_ops;
-
 extern int     __udp6_lib_rcv(struct sk_buff **, struct hlist_head [], int );
 extern void    __udp6_lib_err(struct sk_buff *, struct inet6_skb_parm *,
                               int , int , int , __be32 , struct hlist_head []);
index c40a51362f89ed6861d64acccdf371712ca7c61b..f54016a55004d2d931471c06f14db922efa5f84d 100644 (file)
@@ -37,7 +37,7 @@ static struct inet6_protocol udplitev6_protocol = {
 
 static int udplite_v6_get_port(struct sock *sk, unsigned short snum)
 {
-       return udplite_get_port(sk, snum, &udp_ipv6_ops);
+       return udplite_get_port(sk, snum, ipv6_rcv_saddr_equal);
 }
 
 struct proto udplitev6_prot = {
index 0b02073ffdf306b6895ce36513db54dbf439cb9d..a8b8873aa263f181c0f722d37ceeb96ba3feef9b 100644 (file)
@@ -316,23 +316,6 @@ void irlap_do_event(struct irlap_cb *self, IRLAP_EVENT event,
        }
 }
 
-/*
- * Function irlap_next_state (self, state)
- *
- *    Switches state and provides debug information
- *
- */
-static inline void irlap_next_state(struct irlap_cb *self, IRLAP_STATE state)
-{
-       /*
-       if (!self || self->magic != LAP_MAGIC)
-               return;
-
-       IRDA_DEBUG(4, "next LAP state = %s\n", irlap_state[state]);
-       */
-       self->state = state;
-}
-
 /*
  * Function irlap_state_ndm (event, skb, frame)
  *
@@ -1086,7 +1069,6 @@ static int irlap_state_xmit_p(struct irlap_cb *self, IRLAP_EVENT event,
                        } else {
                                /* Final packet of window */
                                irlap_send_data_primary_poll(self, skb);
-                               irlap_next_state(self, LAP_NRM_P);
 
                                /*
                                 * Make sure state machine does not try to send
@@ -1436,14 +1418,14 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event,
                 */
                self->remote_busy = FALSE;
 
+               /* Stop final timer */
+               del_timer(&self->final_timer);
+
                /*
                 *  Nr as expected?
                 */
                ret = irlap_validate_nr_received(self, info->nr);
                if (ret == NR_EXPECTED) {
-                       /* Stop final timer */
-                       del_timer(&self->final_timer);
-
                        /* Update Nr received */
                        irlap_update_nr_received(self, info->nr);
 
@@ -1475,14 +1457,12 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event,
 
                        /* Resend rejected frames */
                        irlap_resend_rejected_frames(self, CMD_FRAME);
-
-                       /* Final timer ??? Jean II */
+                       irlap_start_final_timer(self, self->final_timeout * 2);
 
                        irlap_next_state(self, LAP_NRM_P);
                } else if (ret == NR_INVALID) {
                        IRDA_DEBUG(1, "%s(), Received RR with "
                                   "invalid nr !\n", __FUNCTION__);
-                       del_timer(&self->final_timer);
 
                        irlap_next_state(self, LAP_RESET_WAIT);
 
index 3c5a68e36414f98a2cc9aad8340f250022e827fe..3013c49ab975e865b593746911f0d88f2921c8b0 100644 (file)
@@ -798,16 +798,19 @@ void irlap_send_data_primary_poll(struct irlap_cb *self, struct sk_buff *skb)
                self->vs = (self->vs + 1) % 8;
                self->ack_required = FALSE;
 
+               irlap_next_state(self, LAP_NRM_P);
                irlap_send_i_frame(self, tx_skb, CMD_FRAME);
        } else {
                IRDA_DEBUG(4, "%s(), sending unreliable frame\n", __FUNCTION__);
 
                if (self->ack_required) {
                        irlap_send_ui_frame(self, skb_get(skb), self->caddr, CMD_FRAME);
+                       irlap_next_state(self, LAP_NRM_P);
                        irlap_send_rr_frame(self, CMD_FRAME);
                        self->ack_required = FALSE;
                } else {
                        skb->data[1] |= PF_BIT;
+                       irlap_next_state(self, LAP_NRM_P);
                        irlap_send_ui_frame(self, skb_get(skb), self->caddr, CMD_FRAME);
                }
        }
index d302ddae580c567b19dc7edc3925f883453bc126..0f8304b0246bac224f241d7036341bf83db55532 100644 (file)
@@ -1682,6 +1682,7 @@ static int pfkey_flush(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hd
        unsigned proto;
        struct km_event c;
        struct xfrm_audit audit_info;
+       int err;
 
        proto = pfkey_satype2proto(hdr->sadb_msg_satype);
        if (proto == 0)
@@ -1689,7 +1690,9 @@ static int pfkey_flush(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hd
 
        audit_info.loginuid = audit_get_loginuid(current->audit_context);
        audit_info.secid = 0;
-       xfrm_state_flush(proto, &audit_info);
+       err = xfrm_state_flush(proto, &audit_info);
+       if (err)
+               return err;
        c.data.proto = proto;
        c.seq = hdr->sadb_msg_seq;
        c.pid = hdr->sadb_msg_pid;
@@ -2683,10 +2686,13 @@ static int pfkey_spdflush(struct sock *sk, struct sk_buff *skb, struct sadb_msg
 {
        struct km_event c;
        struct xfrm_audit audit_info;
+       int err;
 
        audit_info.loginuid = audit_get_loginuid(current->audit_context);
        audit_info.secid = 0;
-       xfrm_policy_flush(XFRM_POLICY_TYPE_MAIN, &audit_info);
+       err = xfrm_policy_flush(XFRM_POLICY_TYPE_MAIN, &audit_info);
+       if (err)
+               return err;
        c.data.type = XFRM_POLICY_TYPE_MAIN;
        c.event = XFRM_MSG_FLUSHPOLICY;
        c.pid = hdr->sadb_msg_pid;
index bb6c0feb2d48b3643098621bc879e6cd7981cede..476c8486f789819518ccdc47b7dfb3c6856f8397 100644 (file)
@@ -112,7 +112,7 @@ DEBUGFS_READONLY_FILE(wep_iv, 20, "%#06x",
                      local->wep_iv & 0xffffff);
 DEBUGFS_READONLY_FILE(tx_power_reduction, 20, "%d.%d dBm",
                      local->hw.conf.tx_power_reduction / 10,
-                     local->hw.conf.tx_power_reduction & 10);
+                     local->hw.conf.tx_power_reduction % 10);
 DEBUGFS_READONLY_FILE(rate_ctrl_alg, 100, "%s",
                      local->rate_ctrl ? local->rate_ctrl->ops->name : "<unset>");
 
index 9f30ae4c2ab3e4be6f97f05d816528bb3e411a2c..91b545c144c1d957e0127169b3bdc8e6edfa8a15 100644 (file)
@@ -2592,11 +2592,17 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw)
 
        read_lock(&local->sub_if_lock);
        list_for_each_entry(sdata, &local->sub_if_list, list) {
+
+               /* No need to wake the master device. */
+               if (sdata->dev == local->mdev)
+                       continue;
+
                if (sdata->type == IEEE80211_IF_TYPE_STA) {
                        if (sdata->u.sta.associated)
                                ieee80211_send_nullfunc(local, sdata, 0);
                        ieee80211_sta_timer((unsigned long)sdata);
                }
+
                netif_wake_queue(sdata->dev);
        }
        read_unlock(&local->sub_if_lock);
@@ -2738,6 +2744,12 @@ static int ieee80211_sta_start_scan(struct net_device *dev,
 
        read_lock(&local->sub_if_lock);
        list_for_each_entry(sdata, &local->sub_if_list, list) {
+
+               /* Don't stop the master interface, otherwise we can't transmit
+                * probes! */
+               if (sdata->dev == local->mdev)
+                       continue;
+
                netif_stop_queue(sdata->dev);
                if (sdata->type == IEEE80211_IF_TYPE_STA &&
                    sdata->u.sta.associated)
index b8869eab7650f233ae50181838f93323ec121290..0568f2e86b5990cc713bd4a374fe3995a04dc898 100644 (file)
@@ -208,13 +208,14 @@ static int __init nf_conntrack_amanda_init(void)
 {
        int ret, i;
 
-       ret = -ENOMEM;
        for (i = 0; i < ARRAY_SIZE(search); i++) {
                search[i].ts = textsearch_prepare(ts_algo, search[i].string,
                                                  search[i].len,
                                                  GFP_KERNEL, TS_AUTOLOAD);
-               if (search[i].ts == NULL)
+               if (IS_ERR(search[i].ts)) {
+                       ret = PTR_ERR(search[i].ts);
                        goto err1;
+               }
        }
        ret = nf_conntrack_helper_register(&amanda_helper[0]);
        if (ret < 0)
@@ -227,10 +228,9 @@ static int __init nf_conntrack_amanda_init(void)
 err2:
        nf_conntrack_helper_unregister(&amanda_helper[0]);
 err1:
-       for (; i >= 0; i--) {
-               if (search[i].ts)
-                       textsearch_destroy(search[i].ts);
-       }
+       while (--i >= 0)
+               textsearch_destroy(search[i].ts);
+
        return ret;
 }
 
index 483e927a9ca4130182815670c138b87eca3a856b..7a15e30356f2284613c708dc081ceebfeff94e23 100644 (file)
@@ -350,9 +350,15 @@ static void death_by_timeout(unsigned long ul_conntrack)
 {
        struct nf_conn *ct = (void *)ul_conntrack;
        struct nf_conn_help *help = nfct_help(ct);
+       struct nf_conntrack_helper *helper;
 
-       if (help && help->helper && help->helper->destroy)
-               help->helper->destroy(ct);
+       if (help) {
+               rcu_read_lock();
+               helper = rcu_dereference(help->helper);
+               if (helper && helper->destroy)
+                       helper->destroy(ct);
+               rcu_read_unlock();
+       }
 
        write_lock_bh(&nf_conntrack_lock);
        /* Inside lock so preempt is disabled on module removal path.
@@ -661,6 +667,7 @@ init_conntrack(const struct nf_conntrack_tuple *tuple,
               unsigned int dataoff)
 {
        struct nf_conn *conntrack;
+       struct nf_conn_help *help;
        struct nf_conntrack_tuple repl_tuple;
        struct nf_conntrack_expect *exp;
        u_int32_t features = 0;
@@ -691,6 +698,7 @@ init_conntrack(const struct nf_conntrack_tuple *tuple,
        write_lock_bh(&nf_conntrack_lock);
        exp = find_expectation(tuple);
 
+       help = nfct_help(conntrack);
        if (exp) {
                DEBUGP("conntrack: expectation arrives ct=%p exp=%p\n",
                        conntrack, exp);
@@ -698,7 +706,7 @@ init_conntrack(const struct nf_conntrack_tuple *tuple,
                __set_bit(IPS_EXPECTED_BIT, &conntrack->status);
                conntrack->master = exp->master;
                if (exp->helper)
-                       nfct_help(conntrack)->helper = exp->helper;
+                       rcu_assign_pointer(help->helper, exp->helper);
 #ifdef CONFIG_NF_CONNTRACK_MARK
                conntrack->mark = exp->master->mark;
 #endif
@@ -708,10 +716,11 @@ init_conntrack(const struct nf_conntrack_tuple *tuple,
                nf_conntrack_get(&conntrack->master->ct_general);
                NF_CT_STAT_INC(expect_new);
        } else {
-               struct nf_conn_help *help = nfct_help(conntrack);
-
-               if (help)
-                       help->helper = __nf_ct_helper_find(&repl_tuple);
+               if (help) {
+                       /* not in hash table yet, so not strictly necessary */
+                       rcu_assign_pointer(help->helper,
+                                          __nf_ct_helper_find(&repl_tuple));
+               }
                NF_CT_STAT_INC(new);
        }
 
@@ -893,7 +902,8 @@ void nf_conntrack_alter_reply(struct nf_conn *ct,
                helper = __nf_ct_helper_find(newreply);
                if (helper)
                        memset(&help->help, 0, sizeof(help->help));
-               help->helper = helper;
+               /* not in hash table yet, so not strictly necessary */
+               rcu_assign_pointer(help->helper, helper);
        }
        write_unlock_bh(&nf_conntrack_lock);
 }
index 117cbfdb910c57bf08b4f62e1a254cccb32df7c1..504fb6c083f99bc30a9fac847943fa2dac4c51cb 100644 (file)
@@ -337,6 +337,10 @@ int nf_conntrack_expect_related(struct nf_conntrack_expect *expect)
        NF_CT_ASSERT(master_help);
 
        write_lock_bh(&nf_conntrack_lock);
+       if (!master_help->helper) {
+               ret = -ESHUTDOWN;
+               goto out;
+       }
        list_for_each_entry(i, &nf_conntrack_expect_list, list) {
                if (expect_matches(i, expect)) {
                        /* Refresh timer: if it's dying, ignore.. */
index 0743be4434b019d201a0caa4dc5826d7061d4f75..f868b7fbd9b4caee49d1e49b560ff6daeaa185bf 100644 (file)
@@ -93,7 +93,7 @@ static inline int unhelp(struct nf_conntrack_tuple_hash *i,
 
        if (help && help->helper == me) {
                nf_conntrack_event(IPCT_HELPER, ct);
-               help->helper = NULL;
+               rcu_assign_pointer(help->helper, NULL);
        }
        return 0;
 }
index d6d39e2413278b5b8fa9a60523be7a74ded14979..3f73327794ab40a7bb4ae05d0a8b3334458f9eea 100644 (file)
@@ -171,21 +171,29 @@ ctnetlink_dump_helpinfo(struct sk_buff *skb, const struct nf_conn *ct)
 {
        struct nfattr *nest_helper;
        const struct nf_conn_help *help = nfct_help(ct);
+       struct nf_conntrack_helper *helper;
 
-       if (!help || !help->helper)
+       if (!help)
                return 0;
 
+       rcu_read_lock();
+       helper = rcu_dereference(help->helper);
+       if (!helper)
+               goto out;
+
        nest_helper = NFA_NEST(skb, CTA_HELP);
-       NFA_PUT(skb, CTA_HELP_NAME, strlen(help->helper->name), help->helper->name);
+       NFA_PUT(skb, CTA_HELP_NAME, strlen(helper->name), helper->name);
 
-       if (help->helper->to_nfattr)
-               help->helper->to_nfattr(skb, ct);
+       if (helper->to_nfattr)
+               helper->to_nfattr(skb, ct);
 
        NFA_NEST_END(skb, nest_helper);
-
+out:
+       rcu_read_unlock();
        return 0;
 
 nfattr_failure:
+       rcu_read_unlock();
        return -1;
 }
 
@@ -842,7 +850,7 @@ ctnetlink_change_helper(struct nf_conn *ct, struct nfattr *cda[])
                if (help && help->helper) {
                        /* we had a helper before ... */
                        nf_ct_remove_expectations(ct);
-                       help->helper = NULL;
+                       rcu_assign_pointer(help->helper, NULL);
                }
 
                return 0;
@@ -866,7 +874,7 @@ ctnetlink_change_helper(struct nf_conn *ct, struct nfattr *cda[])
 
        /* need to zero data of old helper */
        memset(&help->help, 0, sizeof(help->help));
-       help->helper = helper;
+       rcu_assign_pointer(help->helper, helper);
 
        return 0;
 }
@@ -950,6 +958,7 @@ ctnetlink_create_conntrack(struct nfattr *cda[],
        struct nf_conn *ct;
        int err = -EINVAL;
        struct nf_conn_help *help;
+       struct nf_conntrack_helper *helper = NULL;
 
        ct = nf_conntrack_alloc(otuple, rtuple);
        if (ct == NULL || IS_ERR(ct))
@@ -980,14 +989,17 @@ ctnetlink_create_conntrack(struct nfattr *cda[],
 #endif
 
        help = nfct_help(ct);
-       if (help)
-               help->helper = nf_ct_helper_find_get(rtuple);
+       if (help) {
+               helper = nf_ct_helper_find_get(rtuple);
+               /* not in hash table yet so not strictly necessary */
+               rcu_assign_pointer(help->helper, helper);
+       }
 
        add_timer(&ct->timeout);
        nf_conntrack_hash_insert(ct);
 
-       if (help && help->helper)
-               nf_ct_helper_put(help->helper);
+       if (helper)
+               nf_ct_helper_put(helper);
 
        return 0;
 
index 5434472420fe68dc83cc231cbc6436d5d47854d9..339c397d1b5facb318419deeeb6fb2e1e876de62 100644 (file)
@@ -100,7 +100,6 @@ int nf_ct_gre_keymap_add(struct nf_conn *ct, enum ip_conntrack_dir dir,
        struct nf_conn_help *help = nfct_help(ct);
        struct nf_ct_gre_keymap **kmp, *km;
 
-       BUG_ON(strcmp(help->helper->name, "pptp"));
        kmp = &help->help.ct_pptp_info.keymap[dir];
        if (*kmp) {
                /* check whether it's a retransmission */
@@ -137,7 +136,6 @@ void nf_ct_gre_keymap_destroy(struct nf_conn *ct)
        enum ip_conntrack_dir dir;
 
        DEBUGP("entering for ct %p\n", ct);
-       BUG_ON(strcmp(help->helper->name, "pptp"));
 
        write_lock_bh(&nf_ct_gre_lock);
        for (dir = IP_CT_DIR_ORIGINAL; dir < IP_CT_DIR_MAX; dir++) {
index 07e47dbcb0a9cd1fa455ef8b7f7d60c19ac33971..24b660f16ce3b5c74bb74035ed935f7a2f96ed86 100644 (file)
@@ -59,7 +59,7 @@ static struct genl_family netlbl_cipsov4_gnl_family = {
 };
 
 /* NetLabel Netlink attribute policy */
-static struct nla_policy netlbl_cipsov4_genl_policy[NLBL_CIPSOV4_A_MAX + 1] = {
+static const struct nla_policy netlbl_cipsov4_genl_policy[NLBL_CIPSOV4_A_MAX + 1] = {
        [NLBL_CIPSOV4_A_DOI] = { .type = NLA_U32 },
        [NLBL_CIPSOV4_A_MTYPE] = { .type = NLA_U32 },
        [NLBL_CIPSOV4_A_TAG] = { .type = NLA_U8 },
index f2535e7f286979bf5488b7464a39a64c7d79ace7..b165712aaa702ae09d4d35c252c089ac5506a906 100644 (file)
@@ -246,19 +246,18 @@ int netlbl_secattr_catmap_setrng(struct netlbl_lsm_secattr_catmap *catmap,
 
 /**
  * netlbl_socket_setattr - Label a socket using the correct protocol
- * @sock: the socket to label
+ * @sk: the socket to label
  * @secattr: the security attributes
  *
  * Description:
  * Attach the correct label to the given socket using the security attributes
- * specified in @secattr.  This function requires exclusive access to
- * @sock->sk, which means it either needs to be in the process of being
- * created or locked via lock_sock(sock->sk).  Returns zero on success,
- * negative values on failure.
+ * specified in @secattr.  This function requires exclusive access to @sk,
+ * which means it either needs to be in the process of being created or locked.
+ * Returns zero on success, negative values on failure.
  *
  */
-int netlbl_socket_setattr(const struct socket *sock,
-                         const struct netlbl_lsm_secattr *secattr)
+int netlbl_sock_setattr(struct sock *sk,
+                       const struct netlbl_lsm_secattr *secattr)
 {
        int ret_val = -ENOENT;
        struct netlbl_dom_map *dom_entry;
@@ -269,9 +268,9 @@ int netlbl_socket_setattr(const struct socket *sock,
                goto socket_setattr_return;
        switch (dom_entry->type) {
        case NETLBL_NLTYPE_CIPSOV4:
-               ret_val = cipso_v4_socket_setattr(sock,
-                                                 dom_entry->type_def.cipsov4,
-                                                 secattr);
+               ret_val = cipso_v4_sock_setattr(sk,
+                                               dom_entry->type_def.cipsov4,
+                                               secattr);
                break;
        case NETLBL_NLTYPE_UNLABELED:
                ret_val = 0;
@@ -308,30 +307,6 @@ int netlbl_sock_getattr(struct sock *sk, struct netlbl_lsm_secattr *secattr)
        return netlbl_unlabel_getattr(secattr);
 }
 
-/**
- * netlbl_socket_getattr - Determine the security attributes of a socket
- * @sock: the socket
- * @secattr: the security attributes
- *
- * Description:
- * Examines the given socket to see any NetLabel style labeling has been
- * applied to the socket, if so it parses the socket label and returns the
- * security attributes in @secattr.  Returns zero on success, negative values
- * on failure.
- *
- */
-int netlbl_socket_getattr(const struct socket *sock,
-                         struct netlbl_lsm_secattr *secattr)
-{
-       int ret_val;
-
-       ret_val = cipso_v4_socket_getattr(sock, secattr);
-       if (ret_val == 0)
-               return 0;
-
-       return netlbl_unlabel_getattr(secattr);
-}
-
 /**
  * netlbl_skbuff_getattr - Determine the security attributes of a packet
  * @skb: the packet
index e8c80f33f3d717ee91e43dd2f41388d914564bbb..e00fc219c72b7c70cd6c581ccd474e0a8c3b2034 100644 (file)
@@ -59,7 +59,7 @@ static struct genl_family netlbl_mgmt_gnl_family = {
 };
 
 /* NetLabel Netlink attribute policy */
-static struct nla_policy netlbl_mgmt_genl_policy[NLBL_MGMT_A_MAX + 1] = {
+static const struct nla_policy netlbl_mgmt_genl_policy[NLBL_MGMT_A_MAX + 1] = {
        [NLBL_MGMT_A_DOMAIN] = { .type = NLA_NUL_STRING },
        [NLBL_MGMT_A_PROTOCOL] = { .type = NLA_U32 },
        [NLBL_MGMT_A_VERSION] = { .type = NLA_U32 },
index b931edee4b8be1c3836a200461915a0ed9d4e8a9..5c303c68af1d074e003e778b25360160f71b986f 100644 (file)
@@ -61,7 +61,7 @@ static struct genl_family netlbl_unlabel_gnl_family = {
 };
 
 /* NetLabel Netlink attribute policy */
-static struct nla_policy netlbl_unlabel_genl_policy[NLBL_UNLABEL_A_MAX + 1] = {
+static const struct nla_policy netlbl_unlabel_genl_policy[NLBL_UNLABEL_A_MAX + 1] = {
        [NLBL_UNLABEL_A_ACPTFLG] = { .type = NLA_U8 },
 };
 
index df5f820a4c325be1547b778031b1f9bfcd159ca7..c591212793ee4d7cbd981cabe753a5825f68b4fc 100644 (file)
@@ -24,9 +24,9 @@ static u16 nla_attr_minlen[NLA_TYPE_MAX+1] __read_mostly = {
 };
 
 static int validate_nla(struct nlattr *nla, int maxtype,
-                       struct nla_policy *policy)
+                       const struct nla_policy *policy)
 {
-       struct nla_policy *pt;
+       const struct nla_policy *pt;
        int minlen = 0, attrlen = nla_len(nla);
 
        if (nla->nla_type <= 0 || nla->nla_type > maxtype)
@@ -99,7 +99,7 @@ static int validate_nla(struct nlattr *nla, int maxtype,
  * Returns 0 on success or a negative error code.
  */
 int nla_validate(struct nlattr *head, int len, int maxtype,
-                struct nla_policy *policy)
+                const struct nla_policy *policy)
 {
        struct nlattr *nla;
        int rem, err;
@@ -130,7 +130,7 @@ errout:
  * Returns 0 on success or a negative error code.
  */
 int nla_parse(struct nlattr *tb[], int maxtype, struct nlattr *head, int len,
-             struct nla_policy *policy)
+             const struct nla_policy *policy)
 {
        struct nlattr *nla;
        int rem, err;
index 6e31234a41966e0df32becfe61613036ac6fd2bd..b9ab62f938d07111f2b7489ad9f5ca9d31dbb746 100644 (file)
@@ -472,7 +472,7 @@ static struct sk_buff *ctrl_build_msg(struct genl_family *family, u32 pid,
        return skb;
 }
 
-static struct nla_policy ctrl_policy[CTRL_ATTR_MAX+1] __read_mostly = {
+static const struct nla_policy ctrl_policy[CTRL_ATTR_MAX+1] = {
        [CTRL_ATTR_FAMILY_ID]   = { .type = NLA_U16 },
        [CTRL_ATTR_FAMILY_NAME] = { .type = NLA_NUL_STRING,
                                    .len = GENL_NAMSIZ - 1 },
index 43cb3e051ecebab820eec310f94e8ce3c98aa4e0..482750efc2355b4ea3f875044cd8b0323f848c62 100644 (file)
@@ -211,7 +211,7 @@ static struct rxrpc_connection *rxrpc_alloc_connection(gfp_t gfp)
                conn->header_size = sizeof(struct rxrpc_header);
        }
 
-       _leave(" = %p{%d}", conn, conn->debug_id);
+       _leave(" = %p{%d}", conn, conn ? conn->debug_id : 0);
        return conn;
 }
 
index be7d299acd73e8f9ab3d39b8ffd9c6469db89419..d1c383fca82c277b2d7c2138b9f4226d25500a5f 100644 (file)
@@ -599,6 +599,7 @@ static void atm_tc_destroy(struct Qdisc *sch)
        /* races ? */
        while ((flow = p->flows)) {
                tcf_destroy_chain(flow->filter_list);
+               flow->filter_list = NULL;
                if (flow->ref > 1)
                        printk(KERN_ERR "atm_destroy: %p->ref = %d\n",flow,
                            flow->ref);
index a294542cb8e4724eba3f3995e775568123cb481b..ee2d5967d109bdd61c7eb67c4ec04d585974b1f5 100644 (file)
@@ -1748,10 +1748,12 @@ cbq_destroy(struct Qdisc* sch)
         * classes from root to leafs which means that filters can still
         * be bound to classes which have been destroyed already. --TGR '04
         */
-       for (h = 0; h < 16; h++)
-               for (cl = q->classes[h]; cl; cl = cl->next)
+       for (h = 0; h < 16; h++) {
+               for (cl = q->classes[h]; cl; cl = cl->next) {
                        tcf_destroy_chain(cl->filter_list);
-
+                       cl->filter_list = NULL;
+               }
+       }
        for (h = 0; h < 16; h++) {
                struct cbq_class *next;
 
index df94e3cdfba3ede94fd9ee5a9fb4de4478913b92..498edb0cd4e5f7156cb98506304db1f48bcc8cef 100644 (file)
@@ -1231,6 +1231,10 @@ void sctp_assoc_sync_pmtu(struct sctp_association *asoc)
        /* Get the lowest pmtu of all the transports. */
        list_for_each(pos, &asoc->peer.transport_addr_list) {
                t = list_entry(pos, struct sctp_transport, transports);
+               if (t->pmtu_pending && t->dst) {
+                       sctp_transport_update_pmtu(t, dst_mtu(t->dst));
+                       t->pmtu_pending = 0;
+               }
                if (!pmtu || (t->pathmtu < pmtu))
                        pmtu = t->pathmtu;
        }
index 885109fb3dda129a551ccac0ca4e88d29236c712..d57ff7f3c5764510e32c8b1812c2c89492df9da8 100644 (file)
@@ -367,24 +367,18 @@ static void sctp_add_backlog(struct sock *sk, struct sk_buff *skb)
 void sctp_icmp_frag_needed(struct sock *sk, struct sctp_association *asoc,
                           struct sctp_transport *t, __u32 pmtu)
 {
-       if (sock_owned_by_user(sk) || !t || (t->pathmtu == pmtu))
+       if (!t || (t->pathmtu == pmtu))
                return;
 
+       if (sock_owned_by_user(sk)) {
+               asoc->pmtu_pending = 1;
+               t->pmtu_pending = 1;
+               return;
+       }
+
        if (t->param_flags & SPP_PMTUD_ENABLE) {
-               if (unlikely(pmtu < SCTP_DEFAULT_MINSEGMENT)) {
-                       printk(KERN_WARNING "%s: Reported pmtu %d too low, "
-                              "using default minimum of %d\n",
-                              __FUNCTION__, pmtu,
-                              SCTP_DEFAULT_MINSEGMENT);
-                       /* Use default minimum segment size and disable
-                        * pmtu discovery on this transport.
-                        */
-                       t->pathmtu = SCTP_DEFAULT_MINSEGMENT;
-                       t->param_flags = (t->param_flags & ~SPP_PMTUD) |
-                               SPP_PMTUD_DISABLE;
-               } else {
-                       t->pathmtu = pmtu;
-               }
+               /* Update transports view of the MTU */
+               sctp_transport_update_pmtu(t, pmtu);
 
                /* Update association pmtu. */
                sctp_assoc_sync_pmtu(asoc);
index 4dcdabf56473cb9e07cd33c8e29f71677d73f923..6edaaa009d627ed17ef559f75a950d75a9aa3dec 100644 (file)
@@ -333,12 +333,19 @@ SCTP_STATIC int sctp_do_bind(struct sock *sk, union sctp_addr *addr, int len)
        if (!sp->pf->bind_verify(sp, addr))
                return -EADDRNOTAVAIL;
 
-       /* We must either be unbound, or bind to the same port.  */
-       if (bp->port && (snum != bp->port)) {
-               SCTP_DEBUG_PRINTK("sctp_do_bind:"
+       /* We must either be unbound, or bind to the same port.
+        * It's OK to allow 0 ports if we are already bound.
+        * We'll just inhert an already bound port in this case
+        */
+       if (bp->port) {
+               if (!snum)
+                       snum = bp->port;
+               else if (snum != bp->port) {
+                       SCTP_DEBUG_PRINTK("sctp_do_bind:"
                                  " New port %d does not match existing port "
                                  "%d.\n", snum, bp->port);
-               return -EINVAL;
+                       return -EINVAL;
+               }
        }
 
        if (snum && snum < PROT_SOCK && !capable(CAP_NET_BIND_SERVICE))
@@ -1655,6 +1662,9 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
                goto out_free;
        }
 
+       if (asoc->pmtu_pending)
+               sctp_assoc_pending_pmtu(asoc);
+
        /* If fragmentation is disabled and the message length exceeds the
         * association fragmentation point, return EMSGSIZE.  The I-D
         * does not specify what this error is, but this looks like
@@ -3550,6 +3560,7 @@ SCTP_STATIC int sctp_do_peeloff(struct sctp_association *asoc,
        struct sock *sk = asoc->base.sk;
        struct socket *sock;
        struct inet_sock *inetsk;
+       struct sctp_af *af;
        int err = 0;
 
        /* An association cannot be branched off from an already peeled-off
@@ -3571,8 +3582,9 @@ SCTP_STATIC int sctp_do_peeloff(struct sctp_association *asoc,
        /* Make peeled-off sockets more like 1-1 accepted sockets.
         * Set the daddr and initialize id to something more random
         */
+       af = sctp_get_af_specific(asoc->peer.primary_addr.sa.sa_family);
+       af->to_sk_daddr(&asoc->peer.primary_addr, sk);
        inetsk = inet_sk(sock->sk);
-       inetsk->daddr = asoc->peer.primary_addr.v4.sin_addr.s_addr;
        inetsk->id = asoc->next_tsn ^ jiffies;
 
        *sockp = sock;
@@ -4343,11 +4355,12 @@ copy_getaddrs:
                err = -EFAULT;
                goto error;
        }
-       if (put_user(cnt, &((struct sctp_getaddrs __user *)optval)->addr_num))
-               return -EFAULT;
+       if (put_user(cnt, &((struct sctp_getaddrs __user *)optval)->addr_num)) {
+               err = -EFAULT;
+               goto error;
+       }
        if (put_user(bytes_copied, optlen))
-               return -EFAULT;
-
+               err = -EFAULT;
 error:
        kfree(addrs);
        return err;
index 961df275d5b91077dedeb63fad37f8be6f5a89f4..5f467c914f8025fe595cf2a87bc355308abb587f 100644 (file)
@@ -241,6 +241,45 @@ void sctp_transport_pmtu(struct sctp_transport *transport)
                transport->pathmtu = SCTP_DEFAULT_MAXSEGMENT;
 }
 
+/* this is a complete rip-off from __sk_dst_check
+ * the cookie is always 0 since this is how it's used in the
+ * pmtu code
+ */
+static struct dst_entry *sctp_transport_dst_check(struct sctp_transport *t)
+{
+       struct dst_entry *dst = t->dst;
+
+       if (dst && dst->obsolete && dst->ops->check(dst, 0) == NULL) {
+               dst_release(t->dst);
+               t->dst = NULL;
+               return NULL;
+       }
+
+       return dst;
+}
+
+void sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu)
+{
+       struct dst_entry *dst;
+
+       if (unlikely(pmtu < SCTP_DEFAULT_MINSEGMENT)) {
+               printk(KERN_WARNING "%s: Reported pmtu %d too low, "
+                      "using default minimum of %d\n",
+                      __FUNCTION__, pmtu,
+                      SCTP_DEFAULT_MINSEGMENT);
+               /* Use default minimum segment size and disable
+                * pmtu discovery on this transport.
+                */
+               t->pathmtu = SCTP_DEFAULT_MINSEGMENT;
+       } else {
+               t->pathmtu = pmtu;
+       }
+
+       dst = sctp_transport_dst_check(t);
+       if (dst)
+               dst->ops->update_pmtu(dst, pmtu);
+}
+
 /* Caches the dst entry and source address for a transport's destination
  * address.
  */
index 87c794d8fa2d55a272934e72330abc346335e5e5..d70fa30d4294383f4cbdc45feec8a1df90f65a2b 100644 (file)
@@ -1744,20 +1744,23 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
                int chunk;
                struct sk_buff *skb;
 
+               unix_state_lock(sk);
                skb = skb_dequeue(&sk->sk_receive_queue);
                if (skb==NULL)
                {
                        if (copied >= target)
-                               break;
+                               goto unlock;
 
                        /*
                         *      POSIX 1003.1g mandates this order.
                         */
 
                        if ((err = sock_error(sk)) != 0)
-                               break;
+                               goto unlock;
                        if (sk->sk_shutdown & RCV_SHUTDOWN)
-                               break;
+                               goto unlock;
+
+                       unix_state_unlock(sk);
                        err = -EAGAIN;
                        if (!timeo)
                                break;
@@ -1771,7 +1774,11 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
                        }
                        mutex_lock(&u->readlock);
                        continue;
+ unlock:
+                       unix_state_unlock(sk);
+                       break;
                }
+               unix_state_unlock(sk);
 
                if (check_creds) {
                        /* Never glue messages from different writers */
index 3ebae14429636b017cdd2420b68a17f71ee1a11b..88aaacd9f82275a3266b67165bb9a470d8069f4c 100644 (file)
@@ -33,7 +33,7 @@ static ssize_t _show_permaddr(struct device *dev,
                              struct device_attribute *attr,
                              char *buf)
 {
-       char *addr = dev_to_rdev(dev)->wiphy.perm_addr;
+       unsigned char *addr = dev_to_rdev(dev)->wiphy.perm_addr;
 
        return sprintf(buf, "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
                       addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
index 64a375178c5f28b2b4adb61ed9a76a62a9e15a09..157bfbd250ba62f2c451805106b25a1f13b581bf 100644 (file)
@@ -834,11 +834,67 @@ struct xfrm_policy *xfrm_policy_byid(u8 type, int dir, u32 id, int delete,
 }
 EXPORT_SYMBOL(xfrm_policy_byid);
 
-void xfrm_policy_flush(u8 type, struct xfrm_audit *audit_info)
+#ifdef CONFIG_SECURITY_NETWORK_XFRM
+static inline int
+xfrm_policy_flush_secctx_check(u8 type, struct xfrm_audit *audit_info)
 {
-       int dir;
+       int dir, err = 0;
+
+       for (dir = 0; dir < XFRM_POLICY_MAX; dir++) {
+               struct xfrm_policy *pol;
+               struct hlist_node *entry;
+               int i;
+
+               hlist_for_each_entry(pol, entry,
+                                    &xfrm_policy_inexact[dir], bydst) {
+                       if (pol->type != type)
+                               continue;
+                       err = security_xfrm_policy_delete(pol);
+                       if (err) {
+                               xfrm_audit_log(audit_info->loginuid,
+                                              audit_info->secid,
+                                              AUDIT_MAC_IPSEC_DELSPD, 0,
+                                              pol, NULL);
+                               return err;
+                       }
+                }
+               for (i = xfrm_policy_bydst[dir].hmask; i >= 0; i--) {
+                       hlist_for_each_entry(pol, entry,
+                                            xfrm_policy_bydst[dir].table + i,
+                                            bydst) {
+                               if (pol->type != type)
+                                       continue;
+                               err = security_xfrm_policy_delete(pol);
+                               if (err) {
+                                       xfrm_audit_log(audit_info->loginuid,
+                                                      audit_info->secid,
+                                                      AUDIT_MAC_IPSEC_DELSPD,
+                                                      0, pol, NULL);
+                                       return err;
+                               }
+                       }
+               }
+       }
+       return err;
+}
+#else
+static inline int
+xfrm_policy_flush_secctx_check(u8 type, struct xfrm_audit *audit_info)
+{
+       return 0;
+}
+#endif
+
+int xfrm_policy_flush(u8 type, struct xfrm_audit *audit_info)
+{
+       int dir, err = 0;
 
        write_lock_bh(&xfrm_policy_lock);
+
+       err = xfrm_policy_flush_secctx_check(type, audit_info);
+       if (err)
+               goto out;
+
        for (dir = 0; dir < XFRM_POLICY_MAX; dir++) {
                struct xfrm_policy *pol;
                struct hlist_node *entry;
@@ -891,7 +947,9 @@ void xfrm_policy_flush(u8 type, struct xfrm_audit *audit_info)
                xfrm_policy_count[dir] -= killed;
        }
        atomic_inc(&flow_cache_genid);
+out:
        write_unlock_bh(&xfrm_policy_lock);
+       return err;
 }
 EXPORT_SYMBOL(xfrm_policy_flush);
 
@@ -2583,4 +2641,3 @@ restore_state:
 }
 EXPORT_SYMBOL(xfrm_migrate);
 #endif
-
index 372f06eb8bb7e389298c555999f785232a92ff94..85f3f43a6cca402a3339aa4ef8317d7b41eaaa00 100644 (file)
@@ -391,12 +391,48 @@ int xfrm_state_delete(struct xfrm_state *x)
 }
 EXPORT_SYMBOL(xfrm_state_delete);
 
-void xfrm_state_flush(u8 proto, struct xfrm_audit *audit_info)
+#ifdef CONFIG_SECURITY_NETWORK_XFRM
+static inline int
+xfrm_state_flush_secctx_check(u8 proto, struct xfrm_audit *audit_info)
 {
-       int i;
-       int err = 0;
+       int i, err = 0;
+
+       for (i = 0; i <= xfrm_state_hmask; i++) {
+               struct hlist_node *entry;
+               struct xfrm_state *x;
+
+               hlist_for_each_entry(x, entry, xfrm_state_bydst+i, bydst) {
+                       if (xfrm_id_proto_match(x->id.proto, proto) &&
+                          (err = security_xfrm_state_delete(x)) != 0) {
+                               xfrm_audit_log(audit_info->loginuid,
+                                              audit_info->secid,
+                                              AUDIT_MAC_IPSEC_DELSA,
+                                               0, NULL, x);
+
+                               return err;
+                       }
+               }
+       }
+
+       return err;
+}
+#else
+static inline int
+xfrm_state_flush_secctx_check(u8 proto, struct xfrm_audit *audit_info)
+{
+       return 0;
+}
+#endif
+
+int xfrm_state_flush(u8 proto, struct xfrm_audit *audit_info)
+{
+       int i, err = 0;
 
        spin_lock_bh(&xfrm_state_lock);
+       err = xfrm_state_flush_secctx_check(proto, audit_info);
+       if (err)
+               goto out;
+
        for (i = 0; i <= xfrm_state_hmask; i++) {
                struct hlist_node *entry;
                struct xfrm_state *x;
@@ -419,8 +455,12 @@ restart:
                        }
                }
        }
+       err = 0;
+
+out:
        spin_unlock_bh(&xfrm_state_lock);
        wake_up(&km_waitq);
+       return err;
 }
 EXPORT_SYMBOL(xfrm_state_flush);
 
index b14c7e590c31b8e5898ba2f389f7accbe17ec853..c06883bf620ee21fa896654847fc4ee85f445e33 100644 (file)
@@ -1418,10 +1418,13 @@ static int xfrm_flush_sa(struct sk_buff *skb, struct nlmsghdr *nlh,
        struct km_event c;
        struct xfrm_usersa_flush *p = NLMSG_DATA(nlh);
        struct xfrm_audit audit_info;
+       int err;
 
        audit_info.loginuid = NETLINK_CB(skb).loginuid;
        audit_info.secid = NETLINK_CB(skb).sid;
-       xfrm_state_flush(p->proto, &audit_info);
+       err = xfrm_state_flush(p->proto, &audit_info);
+       if (err)
+               return err;
        c.data.proto = p->proto;
        c.event = nlh->nlmsg_type;
        c.seq = nlh->nlmsg_seq;
@@ -1582,7 +1585,9 @@ static int xfrm_flush_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
 
        audit_info.loginuid = NETLINK_CB(skb).loginuid;
        audit_info.secid = NETLINK_CB(skb).sid;
-       xfrm_policy_flush(type, &audit_info);
+       err = xfrm_policy_flush(type, &audit_info);
+       if (err)
+               return err;
        c.data.type = type;
        c.event = nlh->nlmsg_type;
        c.seq = nlh->nlmsg_seq;
old mode 100644 (file)
new mode 100755 (executable)
index e216d49..aea90d3
@@ -1,14 +1,15 @@
 #!/usr/bin/perl -w
 # (c) 2001, Dave Jones. <davej@codemonkey.org.uk> (the file handling bit)
-# (c) 2005, Joel Scohpp <jschopp@austin.ibm.com> (the ugly bit)
+# (c) 2005, Joel Schopp <jschopp@austin.ibm.com> (the ugly bit)
 # (c) 2007, Andy Whitcroft <apw@uk.ibm.com> (new conditions, test suite, etc)
 # Licensed under the terms of the GNU GPL License version 2
 
 use strict;
 
 my $P = $0;
+$P =~ s@.*/@@g;
 
-my $V = '0.01';
+my $V = '0.04';
 
 use Getopt::Long qw(:config no_auto_abbrev);
 
@@ -26,7 +27,7 @@ GetOptions(
 my $exit = 0;
 
 if ($#ARGV < 0) {
-       print "usage: patchstylecheckemail.pl [options] patchfile\n";
+       print "usage: $P [options] patchfile\n";
        print "version: $V\n";
        print "options: -q           => quiet\n";
        print "         --no-tree    => run without a kernel tree\n";
@@ -38,7 +39,8 @@ if ($tree && !top_of_kernel_tree()) {
        exit(2);
 }
 
-my @deprecated = ();
+my @dep_includes = ();
+my @dep_functions = ();
 my $removal = 'Documentation/feature-removal-schedule.txt';
 if ($tree && -f $removal) {
        open(REMOVE, "<$removal") || die "$P: $removal: open failed - $!\n";
@@ -46,22 +48,27 @@ if ($tree && -f $removal) {
                if (/^Files:\s+(.*\S)/) {
                        for my $file (split(/[, ]+/, $1)) {
                                if ($file =~ m@include/(.*)@) {
-                                       push(@deprecated, $1);
+                                       push(@dep_includes, $1);
                                }
                        }
+
+               } elsif (/^Funcs:\s+(.*\S)/) {
+                       for my $func (split(/[, ]+/, $1)) {
+                               push(@dep_functions, $func);
+                       }
                }
        }
 }
 
-my @lines = ();
+my @rawlines = ();
 while (<>) {
        chomp;
-       push(@lines, $_);
+       push(@rawlines, $_);
        if (eof(ARGV)) {
-               if (!process($ARGV, @lines)) {
+               if (!process($ARGV, @rawlines)) {
                        $exit = 1;
                }
-               @lines = ();
+               @rawlines = ();
        }
 }
 
@@ -99,6 +106,130 @@ sub expand_tabs {
        return $res;
 }
 
+sub line_stats {
+       my ($line) = @_;
+
+       # Drop the diff line leader and expand tabs
+       $line =~ s/^.//;
+       $line = expand_tabs($line);
+
+       # Pick the indent from the front of the line.
+       my ($white) = ($line =~ /^(\s*)/);
+
+       return (length($line), length($white));
+}
+
+sub sanitise_line {
+       my ($line) = @_;
+
+       my $res = '';
+       my $l = '';
+
+       my $quote = '';
+
+       foreach my $c (split(//, $line)) {
+               if ($l ne "\\" && ($c eq "'" || $c eq '"')) {
+                       if ($quote eq '') {
+                               $quote = $c;
+                               $res .= $c;
+                               $l = $c;
+                               next;
+                       } elsif ($quote eq $c) {
+                               $quote = '';
+                       }
+               }
+               if ($quote && $c ne "\t") {
+                       $res .= "X";
+               } else {
+                       $res .= $c;
+               }
+
+               $l = $c;
+       }
+
+       return $res;
+}
+
+sub ctx_block_get {
+       my ($linenr, $remain, $outer) = @_;
+       my $line;
+       my $start = $linenr - 1;
+       my $blk = '';
+       my @o;
+       my @c;
+       my @res = ();
+
+       for ($line = $start; $remain > 0; $line++) {
+               next if ($rawlines[$line] =~ /^-/);
+               $remain--;
+
+               $blk .= $rawlines[$line];
+
+               @o = ($blk =~ /\{/g);
+               @c = ($blk =~ /\}/g);
+
+               if (!$outer || (scalar(@o) - scalar(@c)) == 1) {
+                       push(@res, $rawlines[$line]);
+               }
+
+               last if (scalar(@o) == scalar(@c));
+       }
+
+       return @res;
+}
+sub ctx_block_outer {
+       my ($linenr, $remain) = @_;
+
+       return ctx_block_get($linenr, $remain, 1);
+}
+sub ctx_block {
+       my ($linenr, $remain) = @_;
+
+       return ctx_block_get($linenr, $remain, 0);
+}
+
+sub ctx_locate_comment {
+       my ($first_line, $end_line) = @_;
+
+       # Catch a comment on the end of the line itself.
+       my ($current_comment) = ($rawlines[$end_line - 1] =~ m@.*(/\*.*\*/)\s*$@);
+       return $current_comment if (defined $current_comment);
+
+       # Look through the context and try and figure out if there is a
+       # comment.
+       my $in_comment = 0;
+       $current_comment = '';
+       for (my $linenr = $first_line; $linenr < $end_line; $linenr++) {
+               my $line = $rawlines[$linenr - 1];
+               #warn "           $line\n";
+               if ($linenr == $first_line and $line =~ m@^.\s*\*@) {
+                       $in_comment = 1;
+               }
+               if ($line =~ m@/\*@) {
+                       $in_comment = 1;
+               }
+               if (!$in_comment && $current_comment ne '') {
+                       $current_comment = '';
+               }
+               $current_comment .= $line . "\n" if ($in_comment);
+               if ($line =~ m@\*/@) {
+                       $in_comment = 0;
+               }
+       }
+
+       chomp($current_comment);
+       return($current_comment);
+}
+sub ctx_has_comment {
+       my ($first_line, $end_line) = @_;
+       my $cmt = ctx_locate_comment($first_line, $end_line);
+
+       ##print "LINE: $rawlines[$end_line - 1 ]\n";
+       ##print "CMMT: $cmt\n";
+
+       return ($cmt ne '');
+}
+
 sub cat_vet {
        my ($vet) = @_;
 
@@ -116,7 +247,7 @@ sub process {
        my $prevline="";
        my $stashline="";
 
-       my $lineforcounting='';
+       my $length;
        my $indent;
        my $previndent=0;
        my $stashindent=0;
@@ -139,13 +270,14 @@ sub process {
 #extract the filename as it passes
                if ($line=~/^\+\+\+\s+(\S+)/) {
                        $realfile=$1;
+                       $realfile =~ s@^[^/]*/@@;
                        $in_comment = 0;
                        next;
                }
 #extract the line range in the file after the patch is applied
                if ($line=~/^\@\@ -\d+,\d+ \+(\d+)(,(\d+))? \@\@/) {
                        $is_patch = 1;
-                       $first_line = 1;
+                       $first_line = $linenr + 1;
                        $in_comment = 0;
                        $realline=$1-1;
                        if (defined $2) {
@@ -156,10 +288,11 @@ sub process {
                        next;
                }
 
-#track the line number as we move through the hunk
-               if ($line=~/^[ \+]/) {
+# track the line number as we move through the hunk, note that
+# new versions of GNU diff omit the leading space on completely
+# blank context lines so we need to count that too.
+               if ($line =~ /^( |\+|$)/) {
                        $realline++;
-                       $realcnt-- if ($realcnt != 0);
 
                        # track any sort of multi-line comment.  Obviously if
                        # the added text or context do not include the whole
@@ -168,7 +301,7 @@ sub process {
                        # Guestimate if this is a continuing comment.  If this
                        # is the start of a diff block and this line starts
                        # ' *' then it is very likely a comment.
-                       if ($first_line and $line =~ m@^.\s*\*@) {
+                       if ($linenr == $first_line and $line =~ m@^.\s*\*@) {
                                $in_comment = 1;
                        }
                        if ($line =~ m@/\*@) {
@@ -178,23 +311,20 @@ sub process {
                                $in_comment = 0;
                        }
 
-                       $lineforcounting = $line;
-                       $lineforcounting =~ s/^\+//;
-                       $lineforcounting = expand_tabs($lineforcounting);
-
-                       my ($white) = ($lineforcounting =~ /^(\s*)/);
-                       $indent = length($white);
+                       # Measure the line length and indent.
+                       ($length, $indent) = line_stats($line);
 
                        # Track the previous line.
                        ($prevline, $stashline) = ($stashline, $line);
                        ($previndent, $stashindent) = ($stashindent, $indent);
-                       $first_line = 0;
                }
+               $realcnt-- if ($realcnt != 0);
 
 #make up the handle for any error we report on this line
-               $here = "PATCH: $ARGV:$linenr:";
-               $here .= "\nFILE: $realfile:$realline:" if ($realcnt != 0);
+               $here = "#$linenr: ";
+               $here .= "FILE: $realfile:$realline:" if ($realcnt != 0);
 
+               my $hereline = "$here\n$line\n";
                my $herecurr = "$here\n$line\n\n";
                my $hereprev = "$here\n$prevline\n$line\n\n";
 
@@ -203,6 +333,8 @@ sub process {
                        $signoff++;
 
                } elsif ($line =~ /^\s*signed-off-by:/i) {
+                       # This is a signoff, if ugly, so do not double report.
+                       $signoff++;
                        if (!($line =~ /^\s*Signed-off-by:/)) {
                                print "use Signed-off-by:\n";
                                print "$herecurr";
@@ -215,21 +347,28 @@ sub process {
                        }
                }
 
-#ignore lines not being added
-               if ($line=~/^[^\+]/) {next;}
+# Check for wrappage within a valid hunk of the file
+               if ($realcnt != 0 && $line !~ m{^(?:\+|-| |$)}) {
+                       print "patch seems to be corrupt (line wrapped?) [$realcnt]\n";
+                       print "$herecurr";
+                       $clean = 0;
+               }
+
+#ignore lines being removed
+               if ($line=~/^-/) {next;}
 
-# check we are in a valid source file *.[hcsS] if not then ignore this hunk
-               next if ($realfile !~ /\.[hcsS]$/);
+# check we are in a valid source file if not then ignore this hunk
+               next if ($realfile !~ /\.(h|c|s|S|pl|sh)$/);
 
 #trailing whitespace
-               if ($line=~/\S\s+$/) {
+               if ($line=~/\+.*\S\s+$/) {
                        my $herevet = "$here\n" . cat_vet($line) . "\n\n";
                        print "trailing whitespace\n";
                        print "$herevet";
                        $clean = 0;
                }
 #80 column limit
-               if (!($prevline=~/\/\*\*/) && length($lineforcounting) > 80) {
+               if ($line =~ /^\+/ && !($prevline=~/\/\*\*/) && $length > 80) {
                        print "line over 80 characters\n";
                        print "$herecurr";
                        $clean = 0;
@@ -253,19 +392,59 @@ sub process {
                #
                next if ($in_comment);
 
+               # Remove comments from the line before processing.
+               $line =~ s@/\*.*\*/@@g;
+               $line =~ s@/\*.*@@;
+               $line =~ s@.*\*/@@;
+
+               #
+               # Checks which may be anchored in the context.
+               #
+
+               # Check for switch () and associated case and default
+               # statements should be at the same indent.
+               if ($line=~/\bswitch\s*\(.*\)/) {
+                       my $err = '';
+                       my $sep = '';
+                       my @ctx = ctx_block_outer($linenr, $realcnt);
+                       shift(@ctx);
+                       for my $ctx (@ctx) {
+                               my ($clen, $cindent) = line_stats($ctx);
+                               if ($ctx =~ /^\+\s*(case\s+|default:)/ &&
+                                                       $indent != $cindent) {
+                                       $err .= "$sep$ctx\n";
+                                       $sep = '';
+                               } else {
+                                       $sep = "[...]\n";
+                               }
+                       }
+                       if ($err ne '') {
+                               print "switch and case should be at the same indent\n";
+                               print "$here\n$line\n$err\n";
+                               $clean = 0;
+                       }
+               }
+
+#ignore lines not being added
+               if ($line=~/^[^\+]/) {next;}
+
+               #
+               # Checks which are anchored on the added line.
+               #
+
 # no C99 // comments
-               if ($line =~ m@//@ and !($line =~ m@\".*//.*\"@)) {
+               if ($line =~ m{//}) {
                        print "do not use C99 // comments\n";
                        print "$herecurr";
                        $clean = 0;
                }
-
-               # Remove comments from the line before processing.
-               $line =~ s@/\*.*\*/@@g;
-               $line =~ s@/\*.*@@;
-               $line =~ s@.*\*/@@;
+               # Remove C99 comments.
                $line =~ s@//.*@@;
 
+               # Standardise the strings and chars within the input
+               # to simplify matching.
+               $line = sanitise_line($line);
+
 #EXPORT_SYMBOL should immediately follow its function closing }.
                if (($line =~ /EXPORT_SYMBOL.*\(.*\)/) ||
                    ($line =~ /EXPORT_UNUSED_SYMBOL.*\(.*\)/)) {
@@ -293,8 +472,28 @@ sub process {
                }
 
 # * goes on variable not on type
-               if ($line=~/[A-Za-z\d_]+\* [A-Za-z\d_]+/) {
-                       print "\"foo* bar\" should be \"foo *bar\"\n";
+               my $type = '(?:char|short|int|long|unsigned|float|double|' .
+                          'struct\s+[A-Za-z\d_]+|' .
+                          'union\s+[A-Za-z\d_]+)';
+
+               if ($line =~ m{[A-Za-z\d_]+(\*+) [A-Za-z\d_]+}) {
+                       print "\"foo$1 bar\" should be \"foo $1bar\"\n";
+                       print "$herecurr";
+                       $clean = 0;
+               }
+               if ($line =~ m{$type (\*) [A-Za-z\d_]+} ||
+                   $line =~ m{[A-Za-z\d_]+ (\*\*+) [A-Za-z\d_]+}) {
+                       print "\"foo $1 bar\" should be \"foo $1bar\"\n";
+                       print "$herecurr";
+                       $clean = 0;
+               }
+               if ($line =~ m{\([A-Za-z\d_\s]+[A-Za-z\d_](\*+)\)}) {
+                       print "\"(foo$1)\" should be \"(foo $1)\"\n";
+                       print "$herecurr";
+                       $clean = 0;
+               }
+               if ($line =~ m{\([A-Za-z\d_\s]+[A-Za-z\d_]\s+(\*+)\s+\)}) {
+                       print "\"(foo $1 )\" should be \"(foo $1)\"\n";
                        print "$herecurr";
                        $clean = 0;
                }
@@ -306,11 +505,29 @@ sub process {
 #                      $clean = 0;
 #              }
 
-# printk should use KERN_* levels
+# printk should use KERN_* levels.  Note that follow on printk's on the
+# same line do not need a level, so we use the current block context
+# to try and find and validate the current printk.  In summary the current
+# printk includes all preceeding printk's which have no newline on the end.
+# we assume the first bad printk is the one to report.
                if ($line =~ /\bprintk\((?!KERN_)/) {
-                       print "printk() should include KERN_ facility level\n";
-                       print "$herecurr";
-                       $clean = 0;
+                       my $ok = 0;
+                       for (my $ln = $linenr - 1; $ln >= $first_line; $ln--) {
+                               #print "CHECK<$lines[$ln - 1]\n";
+                               # we have a preceeding printk if it ends
+                               # with "\n" ignore it, else it is to blame
+                               if ($lines[$ln - 1] =~ m{\bprintk\(}) {
+                                       if ($rawlines[$ln - 1] !~ m{\\n"}) {
+                                               $ok = 1;
+                                       }
+                                       last;
+                               }
+                       }
+                       if ($ok == 0) {
+                               print "printk() should include KERN_ facility level\n";
+                               print "$herecurr";
+                               $clean = 0;
+                       }
                }
 
 #function brace can't be on same line, except for #defines of do while, or if closed on same line
@@ -320,86 +537,91 @@ sub process {
                        print "$herecurr";
                        $clean = 0;
                }
+               # Note we expand the line with the leading + as the real
+               # line will be displayed with the leading + and the tabs
+               # will therefore also expand that way.
                my $opline = $line;
-               $opline =~ s/^.//;
+               $opline = expand_tabs($opline);
+               $opline =~ s/^./ /;
                if (!($line=~/\#\s*include/)) {
                        # Check operator spacing.
                        my @elements = split(/(<<=|>>=|<=|>=|==|!=|\+=|-=|\*=|\/=|%=|\^=|\|=|&=|->|<<|>>|<|>|=|!|~|&&|\|\||,|\^|\+\+|--|;|&|\||\+|-|\*|\/\/|\/)/, $opline);
+                       my $off = 0;
                        for (my $n = 0; $n < $#elements; $n += 2) {
-                               # $wN says we have white-space before or after
-                               # $sN says we have a separator before or after
-                               # $oN says we have another operator before or after
-                               my $w1 = $elements[$n] =~ /\s$/;
-                               my $s1 = $elements[$n] =~ /(\[|\(|\s)$/;
-                               my $o1 = $elements[$n] eq '';
+                               $off += length($elements[$n]);
+
+                               my $a = '';
+                               $a = 'V' if ($elements[$n] ne '');
+                               $a = 'W' if ($elements[$n] =~ /\s$/);
+                               $a = 'B' if ($elements[$n] =~ /(\[|\()$/);
+                               $a = 'O' if ($elements[$n] eq '');
+                               $a = 'E' if ($elements[$n] eq '' && $n == 0);
+
                                my $op = $elements[$n + 1];
-                               my $w2 = 1;
-                               my $s2 = 1;
-                               my $o2 = 0;
-                               # If we have something after the operator handle it.
+
+                               my $c = '';
                                if (defined $elements[$n + 2]) {
-                                       $w2 = $elements[$n + 2] =~ /^\s/;
-                                       $s2 = $elements[$n + 2] =~ /^(\s|\)|\]|;)/;
-                                       $o2 = $elements[$n + 2] eq '';
+                                       $c = 'V' if ($elements[$n + 2] ne '');
+                                       $c = 'W' if ($elements[$n + 2] =~ /^\s/);
+                                       $c = 'B' if ($elements[$n + 2] =~ /^(\)|\]|;)/);
+                                       $c = 'O' if ($elements[$n + 2] eq '');
+                               } else {
+                                       $c = 'E';
                                }
 
-                               # Generate the context.
-                               my $at = "here: ";
-                               for (my $m = $n; $m >= 0; $m--) {
-                                       if ($elements[$m] ne '') {
-                                               $at .= $elements[$m];
-                                               last;
-                                       }
-                               }
-                               $at .= $op;
-                               for (my $m = $n + 2; defined $elements[$m]; $m++) {
-                                       if ($elements[$m] ne '') {
-                                               $at .= $elements[$m];
-                                               last;
-                                       }
+                               # Pick up the preceeding and succeeding characters.
+                               my $ca = substr($opline, $off - 1, 1);
+                               my $cc = '';
+                               if (length($opline) > ($off + length($elements[$n]))) {
+                                       $cc = substr($opline, $off + 1 + length($elements[$n]), 1);
                                }
 
+                               my $ctx = "${a}x${c}";
+
+                               my $at = "(ctx:$ctx)";
+
+                               my $ptr = (" " x $off) . "^";
+                               my $hereptr = "$hereline$ptr\n\n";
+
                                ##print "<$s1:$op:$s2> <$elements[$n]:$elements[$n + 1]:$elements[$n + 2]>\n";
-                               # Skip things apparently in quotes.
-                               next if ($line=~/\".*\Q$op\E.*\"/ or $line=~/\'\Q$op\E\'/);
 
                                # We need ; as an operator.  // is a comment.
                                if ($op eq ';' or $op eq '//') {
 
                                # -> should have no spaces
                                } elsif ($op eq '->') {
-                                       if ($s1 or $s2) {
+                                       if ($ctx =~ /Wx.|.xW/) {
                                                print "no spaces around that '$op' $at\n";
-                                               print "$herecurr";
+                                               print "$hereptr";
                                                $clean = 0;
                                        }
 
                                # , must have a space on the right.
                                } elsif ($op eq ',') {
-                                       if (!$s2) {
+                                       if ($ctx !~ /.xW|.xE/) {
                                                print "need space after that '$op' $at\n";
-                                               print "$herecurr";
+                                               print "$hereptr";
                                                $clean = 0;
                                        }
 
                                # unary ! and unary ~ are allowed no space on the right
                                } elsif ($op eq '!' or $op eq '~') {
-                                       if (!$s1 && !$o1) {
+                                       if ($ctx !~ /[WOEB]x./) {
                                                print "need space before that '$op' $at\n";
-                                               print "$herecurr";
+                                               print "$hereptr";
                                                $clean = 0;
                                        }
-                                       if ($s2) {
+                                       if ($ctx =~ /.xW/) {
                                                print "no space after that '$op' $at\n";
-                                               print "$herecurr";
+                                               print "$hereptr";
                                                $clean = 0;
                                        }
 
                                # unary ++ and unary -- are allowed no space on one side.
                                } elsif ($op eq '++' or $op eq '--') {
-                                       if (($s1 && $s2) || ((!$s1 && !$o1) && (!$s2 && !$o2))) {
+                                       if ($ctx !~ /[WOB]x[^W]|[^W]x[WOB]/) {
                                                print "need space one side of that '$op' $at\n";
-                                               print "$herecurr";
+                                               print "$hereptr";
                                                $clean = 0;
                                        }
 
@@ -415,15 +637,28 @@ sub process {
                                #
                                # - is the same
                                #
-                               # * is the same only adding:
+                               } elsif ($op eq '&' or $op eq '-') {
+                                       if ($ctx !~ /VxV|[EW]x[WE]|[EWB]x[VO]/) {
+                                               print "need space before that '$op' $at\n";
+                                               print "$hereptr";
+                                               $clean = 0;
+                                       }
+
+                               # * is the same as & only adding:
                                # type:
                                #       (foo *)
                                #       (foo **)
                                #
-                               } elsif ($op eq '&' or $op eq '-' or $op eq '*') {
-                                       if ($w2 and !$w1) {
+                               } elsif ($op eq '*') {
+                                       if ($ca eq '*') {
+                                               if ($cc =~ /\s/) {
+                                                       print "no space after that '$op' $at\n";
+                                                       print "$hereptr";
+                                                       $clean = 0;
+                                               }
+                                       } elsif ($ctx !~ /VxV|[EW]x[WE]|[EWB]x[VO]|OxV|WxB/) {
                                                print "need space before that '$op' $at\n";
-                                               print "$herecurr";
+                                               print "$hereptr";
                                                $clean = 0;
                                        }
 
@@ -431,18 +666,19 @@ sub process {
                                } elsif ($op eq '<<' or $op eq '>>' or $op eq '+' or $op eq '/' or
                                         $op eq '^' or $op eq '|')
                                {
-                                       if ($s1 != $s2) {
+                                       if ($ctx !~ /VxV|WxW|VxE|WxE/) {
                                                print "need consistent spacing around '$op' $at\n";
-                                               print "$herecurr";
+                                               print "$hereptr";
                                                $clean = 0;
                                        }
 
                                # All the others need spaces both sides.
-                               } elsif (!$s1 or !$s2) {
+                               } elsif ($ctx !~ /[EW]x[WE]/) {
                                        print "need spaces around that '$op' $at\n";
-                                       print "$herecurr";
+                                       print "$hereptr";
                                        $clean = 0;
                                }
+                               $off += length($elements[$n + 1]);
                        }
                }
 
@@ -454,7 +690,7 @@ sub process {
                }
 
 #goto labels aren't indented, allow a single space however
-               if ($line=~/^.\s+[A-Za-z\d_]+:/ and
+               if ($line=~/^.\s+[A-Za-z\d_]+:(?![0-9]+)/ and
                   !($line=~/^. [A-Za-z\d_]+:/) and !($line=~/^.\s+default:/)) {
                        print "labels should not be indented\n";
                        print "$herecurr";
@@ -462,15 +698,16 @@ sub process {
                }
 
 # Need a space before open parenthesis after if, while etc
-               if ($line=~/(if|while|for|switch)\(/) {
+               if ($line=~/\b(if|while|for|switch)\(/) {
                        print "need a space before the open parenthesis\n";
                        print "$herecurr";
                        $clean = 0;
                }
 
 # Check for illegal assignment in if conditional.
-               if ($line=~/(if|while)\s*\(.*[^<>!=]=[^=].*\)/) {
-                       print "do not use assignment in if condition\n";
+               if ($line=~/\b(if|while)\s*\(.*[^<>!=]=[^=].*\)/) {
+                       #next if ($line=~/\".*\Q$op\E.*\"/ or $line=~/\'\Q$op\E\'/);
+                       print "do not use assignment in condition\n";
                        print "$herecurr";
                        $clean = 0;
                }
@@ -484,17 +721,6 @@ sub process {
                        $clean = 0;
                }
 
-               # Check for switch () {<nl>case, these must be at the
-               # same indent.  We will only catch the first one, as our
-               # context is very small but people tend to be consistent
-               # so we will catch them out more often than not.
-               if ($prevline=~/\s*switch\s*\(.*\)/ and $line=~/\s*case\s+/
-                                               and $previndent != $indent) {
-                       print "switch and case should be at the same indent\n";
-                       print "$hereprev";
-                       $clean = 0;
-               }
-
 #studly caps, commented out until figure out how to distinguish between use of existing and adding new
 #              if (($line=~/[\w_][a-z\d]+[A-Z]/) and !($line=~/print/)) {
 #                  print "No studly caps, use _\n";
@@ -520,11 +746,11 @@ sub process {
                }
 
 #if/while/etc brace do not go on next line, unless #defining a do while loop, or if that brace on the next line is for something else
-               if ($prevline=~/(if|while|for|switch)\s*\(/) {
+               if ($prevline=~/\b(if|while|for|switch)\s*\(/) {
                        my @opened = $prevline=~/\(/g;
                        my @closed = $prevline=~/\)/g;
                        my $nr_line = $linenr;
-                       my $remaining = $realcnt;
+                       my $remaining = $realcnt - 1;
                        my $next_line = $line;
                        my $extra_lines = 0;
                        my $display_segment = $prevline;
@@ -540,10 +766,10 @@ sub process {
                                @closed = $prevline=~/\)/g;
                        }
 
-                       if (($prevline=~/(if|while|for|switch)\s*\(.*\)\s*$/) and ($next_line=~/{/) and
-                          !($next_line=~/(if|while|for)/) and !($next_line=~/\#define.*do.*while/)) {
+                       if (($prevline=~/\b(if|while|for|switch)\s*\(.*\)\s*$/) and ($next_line=~/{/) and
+                          !($next_line=~/\b(if|while|for)/) and !($next_line=~/\#define.*do.*while/)) {
                                print "That { should be on the previous line\n";
-                               print "$display_segment\n$next_line\n\n";
+                               print "$here\n$display_segment\n$next_line\n\n";
                                $clean = 0;
                        }
                }
@@ -558,7 +784,7 @@ sub process {
                }
 
 # don't include deprecated include files
-               for my $inc (@deprecated) {
+               for my $inc (@dep_includes) {
                        if ($line =~ m@\#\s*include\s*\<$inc>@) {
                                print "Don't use <$inc>: see Documentation/feature-removal-schedule.txt\n";
                                print "$herecurr";
@@ -566,9 +792,56 @@ sub process {
                        }
                }
 
-# don't use kernel_thread()
-               if ($line =~ /\bkernel_thread\b/) {
-                       print "Don't use kernel_thread(), use kthread(): see Documentation/feature-removal-schedule.txt\n";
+# don't use deprecated functions
+               for my $func (@dep_functions) {
+                       if ($line =~ /\b$func\b/) {
+                               print "Don't use $func(): see Documentation/feature-removal-schedule.txt\n";
+                               print "$herecurr";
+                               $clean = 0;
+                       }
+               }
+
+# no volatiles please
+               if ($line =~ /\bvolatile\b/ && $line !~ /\basm\s+volatile\b/) {
+                       print "Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt\n";
+                       print "$herecurr";
+                       $clean = 0;
+               }
+
+# warn about #if 0
+               if ($line =~ /^.#\s*if\s+0\b/) {
+                       print "#if 0 -- if this code redundant remove it\n";
+                       print "$herecurr";
+                       $clean = 0;
+               }
+
+# warn about #ifdefs in C files
+#              if ($line =~ /^.#\s*if(|n)def/ && ($realfile =~ /\.c$/)) {
+#                      print "#ifdef in C files should be avoided\n";
+#                      print "$herecurr";
+#                      $clean = 0;
+#              }
+
+# check for spinlock_t definitions without a comment.
+               if ($line =~ /^.\s*(struct\s+mutex|spinlock_t)\s+\S+;/) {
+                       my $which = $1;
+                       if (!ctx_has_comment($first_line, $linenr)) {
+                               print "$1 definition without comment\n";
+                               print "$herecurr";
+                               $clean = 0;
+                       }
+               }
+# check for memory barriers without a comment.
+               if ($line =~ /\b(mb|rmb|wmb|read_barrier_depends|smp_mb|smp_rmb|smp_wmb|smp_read_barrier_depends)\(/) {
+                       if (!ctx_has_comment($first_line, $linenr)) {
+                               print "memory barrier without comment\n";
+                               print "$herecurr";
+                               $clean = 0;
+                       }
+               }
+# check of hardware specific defines
+               if ($line =~ m@^.#\s*if.*\b(__i386__|__powerpc64__|__sun__|__s390x__)\b@) {
+                       print "architecture specific defines should be avoided\n";
                        print "$herecurr";
                        $clean = 0;
                }
index 8e5610d428c55a5b81b14555924c67384e03697f..3645e980da717e018afa6cdab248358a29ebcbe0 100644 (file)
@@ -1052,6 +1052,7 @@ static int init_section_ref_ok(const char *name)
                ".plt",  /* seen on ARCH=um build on x86_64. Harmless */
                "__ftr_fixup",          /* powerpc cpu feature fixup */
                "__fw_ftr_fixup",       /* powerpc firmware feature fixup */
+               ".cranges",     /* used by sh64 */
                NULL
        };
        /* Start of section names */
@@ -1132,6 +1133,7 @@ static int exit_section_ref_ok(const char *name)
                ".fixup",
                ".smp_locks",
                ".plt",  /* seen on ARCH=um build on x86_64. Harmless */
+               ".cranges",     /* used by sh64 */
                NULL
        };
        /* Start of section names */
index bf8750791dd19613a6ae40a77dc9be4feb167c90..e64eca246f1ab25ce57cb1190cc578fa643421e9 100644 (file)
@@ -36,8 +36,8 @@
 #include "security.h"
 
 /**
- * selinux_netlbl_socket_setsid - Label a socket using the NetLabel mechanism
- * @sock: the socket to label
+ * selinux_netlbl_sock_setsid - Label a socket using the NetLabel mechanism
+ * @sk: the socket to label
  * @sid: the SID to use
  *
  * Description:
  * this function and rcu_read_unlock() after this function returns.
  *
  */
-static int selinux_netlbl_socket_setsid(struct socket *sock, u32 sid)
+static int selinux_netlbl_sock_setsid(struct sock *sk, u32 sid)
 {
        int rc;
-       struct sk_security_struct *sksec = sock->sk->sk_security;
+       struct sk_security_struct *sksec = sk->sk_security;
        struct netlbl_lsm_secattr secattr;
 
        rc = security_netlbl_sid_to_secattr(sid, &secattr);
        if (rc != 0)
                return rc;
 
-       rc = netlbl_socket_setattr(sock, &secattr);
+       rc = netlbl_sock_setattr(sk, &secattr);
        if (rc == 0) {
                spin_lock_bh(&sksec->nlbl_lock);
                sksec->nlbl_state = NLBL_LABELED;
@@ -206,7 +206,7 @@ void selinux_netlbl_sock_graft(struct sock *sk, struct socket *sock)
        /* Try to set the NetLabel on the socket to save time later, if we fail
         * here we will pick up the pieces in later calls to
         * selinux_netlbl_inode_permission(). */
-       selinux_netlbl_socket_setsid(sock, sksec->sid);
+       selinux_netlbl_sock_setsid(sk, sksec->sid);
 
        rcu_read_unlock();
 }
@@ -223,14 +223,15 @@ void selinux_netlbl_sock_graft(struct sock *sk, struct socket *sock)
 int selinux_netlbl_socket_post_create(struct socket *sock)
 {
        int rc = 0;
+       struct sock *sk = sock->sk;
        struct inode_security_struct *isec = SOCK_INODE(sock)->i_security;
-       struct sk_security_struct *sksec = sock->sk->sk_security;
+       struct sk_security_struct *sksec = sk->sk_security;
 
        sksec->sclass = isec->sclass;
 
        rcu_read_lock();
        if (sksec->nlbl_state == NLBL_REQUIRE)
-               rc = selinux_netlbl_socket_setsid(sock, sksec->sid);
+               rc = selinux_netlbl_sock_setsid(sk, sksec->sid);
        rcu_read_unlock();
 
        return rc;
@@ -251,14 +252,16 @@ int selinux_netlbl_socket_post_create(struct socket *sock)
 int selinux_netlbl_inode_permission(struct inode *inode, int mask)
 {
        int rc;
-       struct sk_security_struct *sksec;
+       struct sock *sk;
        struct socket *sock;
+       struct sk_security_struct *sksec;
 
        if (!S_ISSOCK(inode->i_mode) ||
            ((mask & (MAY_WRITE | MAY_APPEND)) == 0))
                return 0;
        sock = SOCKET_I(inode);
-       sksec = sock->sk->sk_security;
+       sk = sock->sk;
+       sksec = sk->sk_security;
 
        rcu_read_lock();
        if (sksec->nlbl_state != NLBL_REQUIRE) {
@@ -266,9 +269,9 @@ int selinux_netlbl_inode_permission(struct inode *inode, int mask)
                return 0;
        }
        local_bh_disable();
-       bh_lock_sock_nested(sock->sk);
-       rc = selinux_netlbl_socket_setsid(sock, sksec->sid);
-       bh_unlock_sock(sock->sk);
+       bh_lock_sock_nested(sk);
+       rc = selinux_netlbl_sock_setsid(sk, sksec->sid);
+       bh_unlock_sock(sk);
        local_bh_enable();
        rcu_read_unlock();
 
@@ -345,14 +348,17 @@ int selinux_netlbl_socket_setsockopt(struct socket *sock,
                                     int optname)
 {
        int rc = 0;
-       struct sk_security_struct *sksec = sock->sk->sk_security;
+       struct sock *sk = sock->sk;
+       struct sk_security_struct *sksec = sk->sk_security;
        struct netlbl_lsm_secattr secattr;
 
        rcu_read_lock();
        if (level == IPPROTO_IP && optname == IP_OPTIONS &&
            sksec->nlbl_state == NLBL_LABELED) {
                netlbl_secattr_init(&secattr);
-               rc = netlbl_socket_getattr(sock, &secattr);
+               lock_sock(sk);
+               rc = netlbl_sock_getattr(sk, &secattr);
+               release_sock(sk);
                if (rc == 0 && secattr.flags != NETLBL_SECATTR_NONE)
                        rc = -EACCES;
                netlbl_secattr_destroy(&secattr);