aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CREDITS16
-rw-r--r--MAINTAINERS82
-rw-r--r--Makefile4
-rw-r--r--arch/arm/mach-s3c2440/mach-anubis.c4
-rw-r--r--arch/arm/mach-s3c2440/mach-osiris.c58
-rw-r--r--arch/arm/vfp/entry.S4
-rw-r--r--arch/arm/vfp/vfpmodule.c5
-rw-r--r--arch/avr32/boards/atstk1000/atstk1002.c1
-rw-r--r--arch/avr32/mm/fault.c2
-rw-r--r--arch/blackfin/Kconfig35
-rw-r--r--arch/blackfin/configs/BF533-EZKIT_defconfig241
-rw-r--r--arch/blackfin/configs/BF533-STAMP_defconfig92
-rw-r--r--arch/blackfin/configs/BF537-STAMP_defconfig98
-rw-r--r--arch/blackfin/configs/BF561-EZKIT_defconfig192
-rw-r--r--arch/blackfin/configs/PNAV-10_defconfig119
-rw-r--r--arch/blackfin/defconfig1327
-rw-r--r--arch/blackfin/kernel/bfin_dma_5xx.c6
-rw-r--r--arch/blackfin/kernel/bfin_gpio.c14
-rw-r--r--arch/blackfin/kernel/entry.S5
-rw-r--r--arch/blackfin/kernel/irqchip.c2
-rw-r--r--arch/blackfin/kernel/setup.c248
-rw-r--r--arch/blackfin/kernel/traps.c2
-rw-r--r--arch/blackfin/kernel/vmlinux.lds.S166
-rw-r--r--arch/blackfin/lib/divsi3.S3
-rw-r--r--arch/blackfin/lib/ins.S4
-rw-r--r--arch/blackfin/lib/memchr.S2
-rw-r--r--arch/blackfin/lib/memcmp.S2
-rw-r--r--arch/blackfin/lib/memcpy.S2
-rw-r--r--arch/blackfin/lib/memmove.S2
-rw-r--r--arch/blackfin/lib/memset.S2
-rw-r--r--arch/blackfin/lib/modsi3.S2
-rw-r--r--arch/blackfin/lib/outs.S3
-rw-r--r--arch/blackfin/lib/smulsi3_highpart.S2
-rw-r--r--arch/blackfin/lib/udivsi3.S2
-rw-r--r--arch/blackfin/lib/umodsi3.S4
-rw-r--r--arch/blackfin/lib/umulsi3_highpart.S2
-rw-r--r--arch/blackfin/mach-bf533/boards/cm_bf533.c2
-rw-r--r--arch/blackfin/mach-bf533/boards/ezkit.c2
-rw-r--r--arch/blackfin/mach-bf533/head.S30
-rw-r--r--arch/blackfin/mach-bf533/ints-priority.c2
-rw-r--r--arch/blackfin/mach-bf537/boards/generic_board.c2
-rw-r--r--arch/blackfin/mach-bf537/boards/pnav10.c2
-rw-r--r--arch/blackfin/mach-bf537/boards/stamp.c2
-rw-r--r--arch/blackfin/mach-bf537/head.S35
-rw-r--r--arch/blackfin/mach-bf537/ints-priority.c2
-rw-r--r--arch/blackfin/mach-bf561/boards/cm_bf561.c4
-rw-r--r--arch/blackfin/mach-bf561/head.S33
-rw-r--r--arch/blackfin/mach-bf561/ints-priority.c2
-rw-r--r--arch/blackfin/mach-common/cache.S10
-rw-r--r--arch/blackfin/mach-common/cacheinit.S4
-rw-r--r--arch/blackfin/mach-common/cplbhdlr.S4
-rw-r--r--arch/blackfin/mach-common/cplbinfo.c2
-rw-r--r--arch/blackfin/mach-common/cplbmgr.S1
-rw-r--r--arch/blackfin/mach-common/entry.S18
-rw-r--r--arch/blackfin/mach-common/interrupt.S2
-rw-r--r--arch/blackfin/mach-common/ints-priority-dc.c2
-rw-r--r--arch/blackfin/mach-common/ints-priority-sc.c2
-rw-r--r--arch/blackfin/mach-common/lock.S4
-rw-r--r--arch/blackfin/mach-common/pm.c2
-rw-r--r--arch/blackfin/mm/blackfin_sram.c111
-rw-r--r--arch/blackfin/mm/init.c20
-rw-r--r--arch/i386/Kconfig.debug1
-rw-r--r--arch/i386/kernel/cpu/mtrr/generic.c4
-rw-r--r--arch/i386/kernel/cpu/mtrr/main.c2
-rw-r--r--arch/i386/kernel/cpu/perfctr-watchdog.c26
-rw-r--r--arch/i386/kernel/pci-dma.c27
-rw-r--r--arch/i386/mm/pageattr.c30
-rw-r--r--arch/m68k/Kconfig3
-rw-r--r--arch/mips/kernel/smp-mt.c12
-rw-r--r--arch/mips/kernel/smtc.c6
-rw-r--r--arch/mips/kernel/time.c49
-rw-r--r--arch/mips/kernel/traps.c20
-rw-r--r--arch/mips/mips-boards/atlas/atlas_int.c8
-rw-r--r--arch/mips/mips-boards/generic/init.c62
-rw-r--r--arch/mips/mips-boards/generic/pci.c20
-rw-r--r--arch/mips/mips-boards/generic/time.c97
-rw-r--r--arch/mips/mips-boards/malta/malta_int.c56
-rw-r--r--arch/mips/mips-boards/malta/malta_setup.c4
-rw-r--r--arch/mips/mips-boards/sead/sead_int.c2
-rw-r--r--arch/mips/mips-boards/sead/sead_setup.c2
-rw-r--r--arch/mips/mips-boards/sim/sim_int.c2
-rw-r--r--arch/mips/mips-boards/sim/sim_time.c8
-rw-r--r--arch/mips/oprofile/op_model_mipsxx.c7
-rw-r--r--arch/parisc/hpux/fs.c5
-rw-r--r--arch/parisc/kernel/entry.S40
-rw-r--r--arch/parisc/kernel/firmware.c4
-rw-r--r--arch/parisc/kernel/hardware.c14
-rw-r--r--arch/parisc/kernel/hpmc.S5
-rw-r--r--arch/parisc/kernel/irq.c26
-rw-r--r--arch/parisc/kernel/pci-dma.c94
-rw-r--r--arch/parisc/kernel/perf.c18
-rw-r--r--arch/parisc/kernel/process.c4
-rw-r--r--arch/parisc/kernel/processor.c14
-rw-r--r--arch/parisc/kernel/setup.c5
-rw-r--r--arch/parisc/kernel/signal32.h2
-rw-r--r--arch/parisc/kernel/smp.c8
-rw-r--r--arch/parisc/kernel/sys_parisc32.c13
-rw-r--r--arch/parisc/kernel/syscall.S12
-rw-r--r--arch/parisc/kernel/syscall_table.S16
-rw-r--r--arch/parisc/kernel/time.c2
-rw-r--r--arch/parisc/kernel/traps.c9
-rw-r--r--arch/parisc/kernel/unwind.c4
-rw-r--r--arch/parisc/math-emu/dbl_float.h4
-rw-r--r--arch/parisc/math-emu/dfsqrt.c2
-rw-r--r--arch/parisc/math-emu/sfsqrt.c2
-rw-r--r--arch/parisc/math-emu/sgl_float.h4
-rw-r--r--arch/parisc/mm/init.c10
-rw-r--r--arch/powerpc/kernel/udbg.c8
-rw-r--r--arch/powerpc/lib/rheap.c48
-rw-r--r--arch/powerpc/mm/fault.c5
-rw-r--r--arch/powerpc/platforms/powermac/setup.c16
-rw-r--r--arch/powerpc/platforms/powermac/smp.c1
-rw-r--r--arch/s390/appldata/appldata_base.c5
-rw-r--r--arch/s390/kernel/entry.S8
-rw-r--r--arch/s390/kernel/entry64.S8
-rw-r--r--arch/s390/kernel/setup.c1
-rw-r--r--arch/s390/kernel/traps.c9
-rw-r--r--arch/sh/kernel/signal.c9
-rw-r--r--arch/sh/kernel/traps.c3
-rw-r--r--arch/sh64/kernel/signal.c1
-rw-r--r--arch/sparc64/kernel/entry.S5
-rw-r--r--arch/sparc64/kernel/irq.c131
-rw-r--r--arch/sparc64/kernel/pci_common.c12
-rw-r--r--arch/um/include/common-offsets.h1
-rw-r--r--arch/um/os-Linux/main.c4
-rw-r--r--arch/um/os-Linux/skas/mem.c13
-rw-r--r--arch/um/os-Linux/skas/process.c13
-rw-r--r--arch/um/os-Linux/start_up.c7
-rw-r--r--arch/x86_64/Kconfig.debug1
-rw-r--r--arch/x86_64/ia32/ia32entry.S6
-rw-r--r--arch/x86_64/ia32/sys_ia32.c19
-rw-r--r--arch/x86_64/kernel/pci-dma.c12
-rw-r--r--arch/x86_64/mm/pageattr.c7
-rw-r--r--block/ll_rw_blk.c9
-rw-r--r--drivers/acpi/toshiba_acpi.c2
-rw-r--r--drivers/char/agp/intel-agp.c97
-rw-r--r--drivers/char/drm/drm_pciids.h5
-rw-r--r--drivers/char/drm/i915_dma.c90
-rw-r--r--drivers/char/drm/i915_drm.h5
-rw-r--r--drivers/char/drm/i915_drv.h2
-rw-r--r--drivers/char/drm/radeon_ioc32.c31
-rw-r--r--drivers/char/random.c2
-rw-r--r--drivers/char/tty_io.c14
-rw-r--r--drivers/ide/ide.c9
-rw-r--r--drivers/input/Kconfig13
-rw-r--r--drivers/input/Makefile1
-rw-r--r--drivers/input/input-polldev.c (renamed from drivers/input/misc/input-polldev.c)0
-rw-r--r--drivers/input/keyboard/Kconfig3
-rw-r--r--drivers/input/misc/Kconfig11
-rw-r--r--drivers/input/misc/Makefile1
-rw-r--r--drivers/input/serio/i8042-x86ia64io.h18
-rw-r--r--drivers/input/touchscreen/usbtouchscreen.c44
-rw-r--r--drivers/kvm/kvm.h3
-rw-r--r--drivers/kvm/kvm_main.c22
-rw-r--r--drivers/kvm/vmx.c12
-rw-r--r--drivers/macintosh/Kconfig2
-rw-r--r--drivers/md/raid1.c21
-rw-r--r--drivers/md/raid10.c6
-rw-r--r--drivers/message/fusion/mptspi.c8
-rw-r--r--drivers/mmc/core/sd.c15
-rw-r--r--drivers/mmc/host/omap.c24
-rw-r--r--drivers/net/e100.c72
-rw-r--r--drivers/net/ehea/ehea.h2
-rw-r--r--drivers/net/ehea/ehea_main.c12
-rw-r--r--drivers/net/ibmveth.c80
-rw-r--r--drivers/net/lasi_82596.c1
-rw-r--r--drivers/net/mipsnet.c2
-rw-r--r--drivers/net/myri10ge/myri10ge.c29
-rw-r--r--drivers/net/netxen/netxen_nic.h48
-rw-r--r--drivers/net/netxen/netxen_nic_ethtool.c8
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c12
-rw-r--r--drivers/net/netxen/netxen_nic_init.c44
-rw-r--r--drivers/net/netxen/netxen_nic_isr.c24
-rw-r--r--drivers/net/netxen/netxen_nic_main.c7
-rw-r--r--drivers/net/netxen/netxen_nic_niu.c8
-rw-r--r--drivers/net/phy/marvell.c62
-rw-r--r--drivers/net/ppp_mppe.c10
-rw-r--r--drivers/net/smc91x.h2
-rw-r--r--drivers/net/usb/Kconfig4
-rw-r--r--drivers/net/via-velocity.c2
-rw-r--r--drivers/net/wireless/Kconfig19
-rw-r--r--drivers/net/wireless/libertas/11d.c152
-rw-r--r--drivers/net/wireless/libertas/11d.h6
-rw-r--r--drivers/net/wireless/libertas/Makefile4
-rw-r--r--drivers/net/wireless/libertas/README52
-rw-r--r--drivers/net/wireless/libertas/assoc.c358
-rw-r--r--drivers/net/wireless/libertas/assoc.h10
-rw-r--r--drivers/net/wireless/libertas/cmd.c559
-rw-r--r--drivers/net/wireless/libertas/cmdresp.c376
-rw-r--r--drivers/net/wireless/libertas/debugfs.c432
-rw-r--r--drivers/net/wireless/libertas/decl.h20
-rw-r--r--drivers/net/wireless/libertas/defs.h101
-rw-r--r--drivers/net/wireless/libertas/dev.h99
-rw-r--r--drivers/net/wireless/libertas/ethtool.c55
-rw-r--r--drivers/net/wireless/libertas/fw.c111
-rw-r--r--drivers/net/wireless/libertas/fw.h13
-rw-r--r--drivers/net/wireless/libertas/host.h17
-rw-r--r--drivers/net/wireless/libertas/hostcmd.h392
-rw-r--r--drivers/net/wireless/libertas/if_bootcmd.c6
-rw-r--r--drivers/net/wireless/libertas/if_usb.c448
-rw-r--r--drivers/net/wireless/libertas/if_usb.h32
-rw-r--r--drivers/net/wireless/libertas/ioctl.c286
-rw-r--r--drivers/net/wireless/libertas/join.c464
-rw-r--r--drivers/net/wireless/libertas/join.h13
-rw-r--r--drivers/net/wireless/libertas/main.c690
-rw-r--r--drivers/net/wireless/libertas/rx.c64
-rw-r--r--drivers/net/wireless/libertas/sbi.h40
-rw-r--r--drivers/net/wireless/libertas/scan.c1529
-rw-r--r--drivers/net/wireless/libertas/scan.h81
-rw-r--r--drivers/net/wireless/libertas/thread.h8
-rw-r--r--drivers/net/wireless/libertas/tx.c74
-rw-r--r--drivers/net/wireless/libertas/types.h63
-rw-r--r--drivers/net/wireless/libertas/wext.c778
-rw-r--r--drivers/net/wireless/libertas/wext.h13
-rw-r--r--drivers/parisc/ccio-dma.c14
-rw-r--r--drivers/parisc/eisa.c4
-rw-r--r--drivers/parisc/iommu-helpers.h4
-rw-r--r--drivers/parisc/pdc_stable.c2
-rw-r--r--drivers/parisc/power.c1
-rw-r--r--drivers/parisc/sba_iommu.c6
-rw-r--r--drivers/parisc/superio.c8
-rw-r--r--drivers/parport/parport_gsc.c2
-rw-r--r--drivers/s390/char/zcore.c3
-rw-r--r--drivers/scsi/esp_scsi.c1
-rw-r--r--drivers/scsi/ide-scsi.c2
-rw-r--r--drivers/serial/bfin_5xx.c19
-rw-r--r--drivers/spi/spi_bfin5xx.c17
-rw-r--r--drivers/video/console/sticore.c50
-rw-r--r--fs/fuse/inode.c3
-rw-r--r--fs/hugetlbfs/inode.c7
-rw-r--r--fs/splice.c26
-rw-r--r--fs/sysfs/dir.c38
-rw-r--r--fs/sysfs/inode.c21
-rw-r--r--fs/sysfs/mount.c1
-rw-r--r--fs/sysfs/sysfs.h2
-rw-r--r--fs/udf/inode.c11
-rw-r--r--fs/udf/truncate.c79
-rw-r--r--fs/udf/udfdecl.h1
-rw-r--r--fs/xfs/linux-2.6/xfs_lrw.c2
-rw-r--r--include/asm-arm/arch-s3c2410/anubis-cpld.h4
-rw-r--r--include/asm-arm/arch-s3c2410/anubis-map.h10
-rw-r--r--include/asm-arm/arch-s3c2410/osiris-cpld.h19
-rw-r--r--include/asm-arm/arch-s3c2410/osiris-map.h19
-rw-r--r--include/asm-arm/linkage.h4
-rw-r--r--include/asm-avr32/arch-at32ap/gpio.h2
-rw-r--r--include/asm-avr32/cache.h9
-rw-r--r--include/asm-blackfin/blackfin.h6
-rw-r--r--include/asm-blackfin/gpio.h1
-rw-r--r--include/asm-blackfin/mach-common/def_LPBlackfin.h22
-rw-r--r--include/asm-blackfin/macros.h95
-rw-r--r--include/asm-generic/pgtable.h17
-rw-r--r--include/asm-i386/dma-mapping.h6
-rw-r--r--include/asm-i386/pgtable.h34
-rw-r--r--include/asm-ia64/pgtable.h25
-rw-r--r--include/asm-mips/irq.h9
-rw-r--r--include/asm-mips/mips-boards/atlasint.h6
-rw-r--r--include/asm-mips/mips-boards/generic.h22
-rw-r--r--include/asm-mips/mips-boards/maltaint.h6
-rw-r--r--include/asm-mips/mips-boards/msc01_pci.h1
-rw-r--r--include/asm-mips/mips-boards/seadint.h7
-rw-r--r--include/asm-mips/mips-boards/simint.h4
-rw-r--r--include/asm-parisc/hardware.h5
-rw-r--r--include/asm-parisc/linkage.h5
-rw-r--r--include/asm-parisc/processor.h8
-rw-r--r--include/asm-parisc/unistd.h13
-rw-r--r--include/asm-powerpc/pgtable-ppc32.h12
-rw-r--r--include/asm-powerpc/pgtable-ppc64.h12
-rw-r--r--include/asm-ppc/pgtable.h12
-rw-r--r--include/asm-s390/pgtable.h7
-rw-r--r--include/asm-s390/processor.h5
-rw-r--r--include/asm-s390/ptrace.h9
-rw-r--r--include/asm-sparc/pgtable.h11
-rw-r--r--include/asm-sparc64/dma-mapping.h42
-rw-r--r--include/asm-sparc64/hypervisor.h8
-rw-r--r--include/asm-sparc64/irq.h1
-rw-r--r--include/asm-sparc64/parport.h5
-rw-r--r--include/asm-um/a.out.h1
-rw-r--r--include/asm-x86_64/pgtable.h14
-rw-r--r--include/asm-x86_64/unistd.h4
-rw-r--r--include/linux/futex.h9
-rw-r--r--include/linux/hugetlb.h4
-rw-r--r--include/linux/ktime.h12
-rw-r--r--include/linux/skbuff.h4
-rw-r--r--include/linux/slub_def.h13
-rw-r--r--include/linux/spi/spi.h20
-rw-r--r--include/net/irda/irlap.h17
-rw-r--r--include/net/sctp/sctp.h7
-rw-r--r--include/net/sctp/structs.h7
-rw-r--r--ipc/shm.c15
-rw-r--r--kernel/cpuset.c2
-rw-r--r--kernel/futex.c415
-rw-r--r--kernel/futex_compat.c3
-rw-r--r--kernel/power/user.c4
-rw-r--r--kernel/rtmutex.c41
-rw-r--r--kernel/rtmutex_common.h34
-rw-r--r--kernel/sched.c77
-rw-r--r--kernel/signal.c8
-rw-r--r--mm/hugetlb.c7
-rw-r--r--mm/memory.c13
-rw-r--r--mm/page_alloc.c2
-rw-r--r--mm/slub.c22
-rw-r--r--net/ipv4/tcp_bic.c2
-rw-r--r--net/ipv4/tcp_cubic.c2
-rw-r--r--net/ipv4/tcp_illinois.c3
-rw-r--r--net/ipv4/tcp_input.c18
-rw-r--r--net/ipv4/tcp_ipv4.c3
-rw-r--r--net/ipv4/tcp_lp.c3
-rw-r--r--net/ipv4/tcp_vegas.c3
-rw-r--r--net/ipv4/tcp_veno.c3
-rw-r--r--net/ipv6/addrconf.c33
-rw-r--r--net/ipv6/tcp_ipv6.c2
-rw-r--r--net/irda/irlap_event.c28
-rw-r--r--net/irda/irlap_frame.c3
-rw-r--r--net/mac80211/debugfs.c2
-rw-r--r--net/mac80211/ieee80211_sta.c12
-rw-r--r--net/rxrpc/ar-connection.c2
-rw-r--r--net/sctp/associola.c4
-rw-r--r--net/sctp/input.c24
-rw-r--r--net/sctp/socket.c31
-rw-r--r--net/sctp/transport.c39
-rw-r--r--net/wireless/sysfs.c2
-rw-r--r--scripts/mod/modpost.c2
-rw-r--r--sound/ppc/pmac.c8
323 files changed, 7004 insertions, 7224 deletions
diff --git a/CREDITS b/CREDITS
index 273d72b610c3..79fd13dbb8e4 100644
--- a/CREDITS
+++ b/CREDITS
@@ -3301,14 +3301,6 @@ S: 12725 SW Millikan Way, Suite 400
3301S: Beaverton, Oregon 97005 3301S: Beaverton, Oregon 97005
3302S: USA 3302S: USA
3303 3303
3304N: Li Yang
3305E: leoli@freescale.com
3306D: Freescale Highspeed USB device driver
3307D: Freescale QE SoC support and Ethernet driver
3308S: B-1206 Jingmao Guojigongyu
3309S: 16 Baliqiao Nanjie, Beijing 101100
3310S: People's Repulic of China
3311
3312N: Marcelo Tosatti 3304N: Marcelo Tosatti
3313E: marcelo@kvack.org 3305E: marcelo@kvack.org
3314D: v2.4 kernel maintainer 3306D: v2.4 kernel maintainer
@@ -3726,6 +3718,14 @@ S: 542 West 112th Street, 5N
3726S: New York, New York 10025 3718S: New York, New York 10025
3727S: USA 3719S: USA
3728 3720
3721N: Li Yang
3722E: leoli@freescale.com
3723D: Freescale Highspeed USB device driver
3724D: Freescale QE SoC support and Ethernet driver
3725S: B-1206 Jingmao Guojigongyu
3726S: 16 Baliqiao Nanjie, Beijing 101100
3727S: People's Repulic of China
3728
3729N: Victor Yodaiken 3729N: Victor Yodaiken
3730E: yodaiken@fsmlabs.com 3730E: yodaiken@fsmlabs.com
3731D: RTLinux (RealTime Linux) 3731D: RTLinux (RealTime Linux)
diff --git a/MAINTAINERS b/MAINTAINERS
index 4c715a7e059a..4ce895a4b5ba 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -723,42 +723,52 @@ M: rpurdie@rpsys.net
723S: Maintained 723S: Maintained
724 724
725BLACKFIN ARCHITECTURE 725BLACKFIN ARCHITECTURE
726P: Aubrey Li 726P: Aubrey Li
727M: aubrey.li@analog.com 727M: aubrey.li@analog.com
728P: Bernd Schmidt 728P: Bernd Schmidt
729M: bernd.schmidt@analog.com 729M: bernd.schmidt@analog.com
730P: Bryan Wu 730P: Bryan Wu
731M: bryan.wu@analog.com 731M: bryan.wu@analog.com
732P: Grace Pan 732P: Grace Pan
733M: grace.pan@analog.com 733M: grace.pan@analog.com
734P: Michael Hennerich 734P: Marc Hoffman
735M: michael.hennerich@analog.com 735M: marc.hoffman@analog.com
736P: Mike Frysinger 736P: Michael Hennerich
737M: michael.frysinger@analog.com 737M: michael.hennerich@analog.com
738P: Jane Lv 738P: Mike Frysinger
739M: jane.lv@analog.com 739M: michael.frysinger@analog.com
740P: Jerry Zeng 740P: Jerry Zeng
741M: jerry.zeng@analog.com 741M: jerry.zeng@analog.com
742P: Jie Zhang 742P: Jie Zhang
743M: jie.zhang@analog.com 743M: jie.zhang@analog.com
744P: Robin Getz 744P: Robin Getz
745M: robin.getz@analog.com 745M: robin.getz@analog.com
746P: Roy Huang 746P: Roy Huang
747M: roy.huang@analog.com 747M: roy.huang@analog.com
748P: Sonic Zhang 748P: Sonic Zhang
749M: sonic.zhang@analog.com 749M: sonic.zhang@analog.com
750P: Yi Li 750P: Vivi Li
751M: yi.li@analog.com 751M: vivi.li@analog.com
752L: uclinux-dist-devel@blackfin.uclinux.org 752P: Yi Li
753W: http://blackfin.uclinux.org 753M: yi.li@analog.com
754S: Supported 754L: uclinux-dist-devel@blackfin.uclinux.org (subscribers-only)
755W: http://blackfin.uclinux.org
756S: Supported
757
758BLACKFIN RTC DRIVER
759P: Mike Frysinger
760M: michael.frysinger@analog.com
761M: vapier.adi@gmail.com
762L: uclinux-dist-devel@blackfin.uclinux.org (subscribers-only)
763W: http://blackfin.uclinux.org
764S: Supported
755 765
756BLACKFIN SERIAL DRIVER 766BLACKFIN SERIAL DRIVER
757P: Aubrey Li 767P: Aubrey Li
758M: aubrey.li@analog.com 768M: aubrey.li@analog.com
759L: uclinux-dist-devel@blackfin.uclinux.org 769L: uclinux-dist-devel@blackfin.uclinux.org (subscribers-only)
760W: http://blackfin.uclinux.org 770W: http://blackfin.uclinux.org
761S: Supported 771S: Supported
762 772
763BAYCOM/HDLCDRV DRIVERS FOR AX.25 773BAYCOM/HDLCDRV DRIVERS FOR AX.25
764P: Thomas Sailer 774P: Thomas Sailer
@@ -4012,11 +4022,11 @@ S: Supported
4012 4022
4013XFS FILESYSTEM 4023XFS FILESYSTEM
4014P: Silicon Graphics Inc 4024P: Silicon Graphics Inc
4015P: Tim Shimmin, David Chatterton 4025P: Tim Shimmin
4016M: xfs-masters@oss.sgi.com 4026M: xfs-masters@oss.sgi.com
4017L: xfs@oss.sgi.com 4027L: xfs@oss.sgi.com
4018W: http://oss.sgi.com/projects/xfs 4028W: http://oss.sgi.com/projects/xfs
4019T: git git://oss.sgi.com:8090/xfs/xfs-2.6 4029T: git git://oss.sgi.com:8090/xfs/xfs-2.6.git
4020S: Supported 4030S: Supported
4021 4031
4022XILINX UARTLITE SERIAL DRIVER 4032XILINX UARTLITE SERIAL DRIVER
diff --git a/Makefile b/Makefile
index 30d685b629a4..b76ee94a6c9f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,8 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 22 3SUBLEVEL = 22
4EXTRAVERSION = -rc4 4EXTRAVERSION = -rc5
5NAME = Jeff Thinks I Should Change This, But To What? 5NAME = Holy Dancing Manatees, Batman!
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
8# To see a list of typical targets execute "make help" 8# To see a list of typical targets execute "make help"
diff --git a/arch/arm/mach-s3c2440/mach-anubis.c b/arch/arm/mach-s3c2440/mach-anubis.c
index b5d387ef37e1..bff7ddd06a52 100644
--- a/arch/arm/mach-s3c2440/mach-anubis.c
+++ b/arch/arm/mach-s3c2440/mach-anubis.c
@@ -76,8 +76,8 @@ static struct map_desc anubis_iodesc[] __initdata = {
76 .length = SZ_4K, 76 .length = SZ_4K,
77 .type = MT_DEVICE, 77 .type = MT_DEVICE,
78 }, { 78 }, {
79 .virtual = (u32)ANUBIS_VA_CTRL2, 79 .virtual = (u32)ANUBIS_VA_IDREG,
80 .pfn = __phys_to_pfn(ANUBIS_PA_CTRL2), 80 .pfn = __phys_to_pfn(ANUBIS_PA_IDREG),
81 .length = SZ_4K, 81 .length = SZ_4K,
82 .type = MT_DEVICE, 82 .type = MT_DEVICE,
83 }, 83 },
diff --git a/arch/arm/mach-s3c2440/mach-osiris.c b/arch/arm/mach-s3c2440/mach-osiris.c
index 4d6c7a574c1a..15811601f03d 100644
--- a/arch/arm/mach-s3c2440/mach-osiris.c
+++ b/arch/arm/mach-s3c2440/mach-osiris.c
@@ -16,6 +16,7 @@
16#include <linux/timer.h> 16#include <linux/timer.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/device.h> 18#include <linux/device.h>
19#include <linux/sysdev.h>
19#include <linux/serial_core.h> 20#include <linux/serial_core.h>
20 21
21#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
@@ -65,6 +66,11 @@ static struct map_desc osiris_iodesc[] __initdata = {
65 /* CPLD control registers */ 66 /* CPLD control registers */
66 67
67 { 68 {
69 .virtual = (u32)OSIRIS_VA_CTRL0,
70 .pfn = __phys_to_pfn(OSIRIS_PA_CTRL0),
71 .length = SZ_16K,
72 .type = MT_DEVICE,
73 }, {
68 .virtual = (u32)OSIRIS_VA_CTRL1, 74 .virtual = (u32)OSIRIS_VA_CTRL1,
69 .pfn = __phys_to_pfn(OSIRIS_PA_CTRL1), 75 .pfn = __phys_to_pfn(OSIRIS_PA_CTRL1),
70 .length = SZ_16K, 76 .length = SZ_16K,
@@ -74,6 +80,11 @@ static struct map_desc osiris_iodesc[] __initdata = {
74 .pfn = __phys_to_pfn(OSIRIS_PA_CTRL2), 80 .pfn = __phys_to_pfn(OSIRIS_PA_CTRL2),
75 .length = SZ_16K, 81 .length = SZ_16K,
76 .type = MT_DEVICE, 82 .type = MT_DEVICE,
83 }, {
84 .virtual = (u32)OSIRIS_VA_IDREG,
85 .pfn = __phys_to_pfn(OSIRIS_PA_IDREG),
86 .length = SZ_16K,
87 .type = MT_DEVICE,
77 }, 88 },
78}; 89};
79 90
@@ -195,13 +206,13 @@ static void osiris_nand_select(struct s3c2410_nand_set *set, int slot)
195 pr_debug("osiris_nand: selecting slot %d (set %p,%p)\n", 206 pr_debug("osiris_nand: selecting slot %d (set %p,%p)\n",
196 slot, set, set->nr_map); 207 slot, set, set->nr_map);
197 208
198 tmp = __raw_readb(OSIRIS_VA_CTRL1); 209 tmp = __raw_readb(OSIRIS_VA_CTRL0);
199 tmp &= ~OSIRIS_CTRL1_NANDSEL; 210 tmp &= ~OSIRIS_CTRL0_NANDSEL;
200 tmp |= slot; 211 tmp |= slot;
201 212
202 pr_debug("osiris_nand: ctrl1 now %02x\n", tmp); 213 pr_debug("osiris_nand: ctrl0 now %02x\n", tmp);
203 214
204 __raw_writeb(tmp, OSIRIS_VA_CTRL1); 215 __raw_writeb(tmp, OSIRIS_VA_CTRL0);
205} 216}
206 217
207static struct s3c2410_platform_nand osiris_nand_info = { 218static struct s3c2410_platform_nand osiris_nand_info = {
@@ -235,10 +246,45 @@ static struct platform_device osiris_pcmcia = {
235 .resource = osiris_pcmcia_resource, 246 .resource = osiris_pcmcia_resource,
236}; 247};
237 248
249/* Osiris power management device */
250
251#ifdef CONFIG_PM
252static unsigned char pm_osiris_ctrl0;
253
254static int osiris_pm_suspend(struct sys_device *sd, pm_message_t state)
255{
256 pm_osiris_ctrl0 = __raw_readb(OSIRIS_VA_CTRL0);
257 return 0;
258}
259
260static int osiris_pm_resume(struct sys_device *sd)
261{
262 if (pm_osiris_ctrl0 & OSIRIS_CTRL0_FIX8)
263 __raw_writeb(OSIRIS_CTRL1_FIX8, OSIRIS_VA_CTRL1);
264
265 return 0;
266}
267
268#else
269#define osiris_pm_suspend NULL
270#define osiris_pm_resume NULL
271#endif
272
273static struct sysdev_class osiris_pm_sysclass = {
274 set_kset_name("mach-osiris"),
275 .suspend = osiris_pm_suspend,
276 .resume = osiris_pm_resume,
277};
278
279static struct sys_device osiris_pm_sysdev = {
280 .cls = &osiris_pm_sysclass,
281};
282
238/* Standard Osiris devices */ 283/* Standard Osiris devices */
239 284
240static struct platform_device *osiris_devices[] __initdata = { 285static struct platform_device *osiris_devices[] __initdata = {
241 &s3c_device_i2c, 286 &s3c_device_i2c,
287 &s3c_device_wdt,
242 &s3c_device_nand, 288 &s3c_device_nand,
243 &osiris_pcmcia, 289 &osiris_pcmcia,
244}; 290};
@@ -288,6 +334,9 @@ static void __init osiris_map_io(void)
288 334
289static void __init osiris_init(void) 335static void __init osiris_init(void)
290{ 336{
337 sysdev_class_register(&osiris_pm_sysclass);
338 sysdev_register(&osiris_pm_sysdev);
339
291 platform_add_devices(osiris_devices, ARRAY_SIZE(osiris_devices)); 340 platform_add_devices(osiris_devices, ARRAY_SIZE(osiris_devices));
292}; 341};
293 342
@@ -299,5 +348,6 @@ MACHINE_START(OSIRIS, "Simtec-OSIRIS")
299 .map_io = osiris_map_io, 348 .map_io = osiris_map_io,
300 .init_machine = osiris_init, 349 .init_machine = osiris_init,
301 .init_irq = s3c24xx_init_irq, 350 .init_irq = s3c24xx_init_irq,
351 .init_machine = osiris_init,
302 .timer = &s3c24xx_timer, 352 .timer = &s3c24xx_timer,
303MACHINE_END 353MACHINE_END
diff --git a/arch/arm/vfp/entry.S b/arch/arm/vfp/entry.S
index ca2a5ad19ea6..806ce26d5243 100644
--- a/arch/arm/vfp/entry.S
+++ b/arch/arm/vfp/entry.S
@@ -29,6 +29,10 @@ do_vfp:
29 add r10, r10, #TI_VFPSTATE @ r10 = workspace 29 add r10, r10, #TI_VFPSTATE @ r10 = workspace
30 ldr pc, [r4] @ call VFP entry point 30 ldr pc, [r4] @ call VFP entry point
31 31
32ENTRY(vfp_null_entry)
33 mov pc, lr
34ENDPROC(vfp_null_entry)
35
32.LCvfp: 36.LCvfp:
33 .word vfp_vector 37 .word vfp_vector
34 38
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index f1e5951dc721..1106b5f9cf19 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -26,8 +26,9 @@
26 */ 26 */
27void vfp_testing_entry(void); 27void vfp_testing_entry(void);
28void vfp_support_entry(void); 28void vfp_support_entry(void);
29void vfp_null_entry(void);
29 30
30void (*vfp_vector)(void) = vfp_testing_entry; 31void (*vfp_vector)(void) = vfp_null_entry;
31union vfp_state *last_VFP_context[NR_CPUS]; 32union vfp_state *last_VFP_context[NR_CPUS];
32 33
33/* 34/*
@@ -321,8 +322,10 @@ static int __init vfp_init(void)
321 * The handler is already setup to just log calls, so 322 * The handler is already setup to just log calls, so
322 * we just need to read the VFPSID register. 323 * we just need to read the VFPSID register.
323 */ 324 */
325 vfp_vector = vfp_testing_entry;
324 vfpsid = fmrx(FPSID); 326 vfpsid = fmrx(FPSID);
325 barrier(); 327 barrier();
328 vfp_vector = vfp_null_entry;
326 329
327 printk(KERN_INFO "VFP support v0.3: "); 330 printk(KERN_INFO "VFP support v0.3: ");
328 if (VFP_arch) { 331 if (VFP_arch) {
diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c
index fe1dbe2e28f4..e253e86a1a39 100644
--- a/arch/avr32/boards/atstk1000/atstk1002.c
+++ b/arch/avr32/boards/atstk1000/atstk1002.c
@@ -42,6 +42,7 @@ static struct spi_board_info spi0_board_info[] __initdata = {
42 .modalias = "ltv350qv", 42 .modalias = "ltv350qv",
43 .max_speed_hz = 16000000, 43 .max_speed_hz = 16000000,
44 .chip_select = 1, 44 .chip_select = 1,
45 .mode = SPI_MODE_3,
45 }, 46 },
46}; 47};
47 48
diff --git a/arch/avr32/mm/fault.c b/arch/avr32/mm/fault.c
index e011f1ce1875..4b2495285d94 100644
--- a/arch/avr32/mm/fault.c
+++ b/arch/avr32/mm/fault.c
@@ -158,7 +158,7 @@ bad_area:
158 up_read(&mm->mmap_sem); 158 up_read(&mm->mmap_sem);
159 159
160 if (user_mode(regs)) { 160 if (user_mode(regs)) {
161 if (exception_trace) 161 if (exception_trace && printk_ratelimit())
162 printk("%s%s[%d]: segfault at %08lx pc %08lx " 162 printk("%s%s[%d]: segfault at %08lx pc %08lx "
163 "sp %08lx ecr %lu\n", 163 "sp %08lx ecr %lu\n",
164 is_init(tsk) ? KERN_EMERG : KERN_INFO, 164 is_init(tsk) ? KERN_EMERG : KERN_INFO,
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index b1b111bb2f3a..1fad8560c7af 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -394,41 +394,6 @@ config BFIN_IDLE_LED_PIN
394 default 0x08 if (BFIN533_STAMP && BFIN_IDLE_LED_NUM = 2) 394 default 0x08 if (BFIN533_STAMP && BFIN_IDLE_LED_NUM = 2)
395 default 0x10 if (BFIN533_STAMP && BFIN_IDLE_LED_NUM = 3) 395 default 0x10 if (BFIN533_STAMP && BFIN_IDLE_LED_NUM = 3)
396 396
397comment "Console UART Setup"
398
399choice
400 prompt "Baud Rate"
401 default BAUD_57600
402config BAUD_9600
403 bool "9600"
404config BAUD_19200
405 bool "19200"
406config BAUD_38400
407 bool "38400"
408config BAUD_57600
409 bool "57600"
410config BAUD_115200
411 bool "115200"
412endchoice
413
414choice
415 prompt "Parity"
416 default BAUD_NO_PARITY
417config BAUD_NO_PARITY
418 bool "No Parity"
419config BAUD_PARITY
420 bool "Parity"
421endchoice
422
423choice
424 prompt "Stop Bits"
425 default BAUD_1_STOPBIT
426config BAUD_1_STOPBIT
427 bool "1"
428config BAUD_2_STOPBIT
429 bool "2"
430endchoice
431
432endmenu 397endmenu
433 398
434 399
diff --git a/arch/blackfin/configs/BF533-EZKIT_defconfig b/arch/blackfin/configs/BF533-EZKIT_defconfig
index 377c8e05e4ab..90d58aabe693 100644
--- a/arch/blackfin/configs/BF533-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF533-EZKIT_defconfig
@@ -1,20 +1,21 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.19.3 3# Linux kernel version: 2.6.21.3
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
7CONFIG_RWSEM_GENERIC_SPINLOCK=y 7CONFIG_RWSEM_GENERIC_SPINLOCK=y
8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set 8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
9CONFIG_BLACKFIN=y 9CONFIG_BLACKFIN=y
10CONFIG_ZONE_DMA=y
10CONFIG_BFIN=y 11CONFIG_BFIN=y
11CONFIG_SEMAPHORE_SLEEPERS=y 12CONFIG_SEMAPHORE_SLEEPERS=y
12CONFIG_GENERIC_FIND_NEXT_BIT=y 13CONFIG_GENERIC_FIND_NEXT_BIT=y
13CONFIG_GENERIC_HWEIGHT=y 14CONFIG_GENERIC_HWEIGHT=y
14CONFIG_GENERIC_HARDIRQS=y 15CONFIG_GENERIC_HARDIRQS=y
15CONFIG_GENERIC_IRQ_PROBE=y 16CONFIG_GENERIC_IRQ_PROBE=y
17# CONFIG_GENERIC_TIME is not set
16CONFIG_GENERIC_CALIBRATE_DELAY=y 18CONFIG_GENERIC_CALIBRATE_DELAY=y
17CONFIG_UCLINUX=y
18CONFIG_FORCE_MAX_ZONEORDER=14 19CONFIG_FORCE_MAX_ZONEORDER=14
19CONFIG_IRQCHIP_DEMUX_GPIO=y 20CONFIG_IRQCHIP_DEMUX_GPIO=y
20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 21CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
@@ -33,13 +34,16 @@ CONFIG_LOCALVERSION=""
33CONFIG_LOCALVERSION_AUTO=y 34CONFIG_LOCALVERSION_AUTO=y
34CONFIG_SYSVIPC=y 35CONFIG_SYSVIPC=y
35# CONFIG_IPC_NS is not set 36# CONFIG_IPC_NS is not set
37CONFIG_SYSVIPC_SYSCTL=y
36# CONFIG_POSIX_MQUEUE is not set 38# CONFIG_POSIX_MQUEUE is not set
37# CONFIG_BSD_PROCESS_ACCT is not set 39# CONFIG_BSD_PROCESS_ACCT is not set
38# CONFIG_TASKSTATS is not set 40# CONFIG_TASKSTATS is not set
39# CONFIG_UTS_NS is not set 41# CONFIG_UTS_NS is not set
40# CONFIG_AUDIT is not set 42# CONFIG_AUDIT is not set
41# CONFIG_IKCONFIG is not set 43# CONFIG_IKCONFIG is not set
44CONFIG_SYSFS_DEPRECATED=y
42# CONFIG_RELAY is not set 45# CONFIG_RELAY is not set
46CONFIG_BLK_DEV_INITRD=y
43CONFIG_INITRAMFS_SOURCE="" 47CONFIG_INITRAMFS_SOURCE=""
44# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 48# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
45CONFIG_SYSCTL=y 49CONFIG_SYSCTL=y
@@ -54,9 +58,7 @@ CONFIG_BUG=y
54CONFIG_ELF_CORE=y 58CONFIG_ELF_CORE=y
55CONFIG_BASE_FULL=y 59CONFIG_BASE_FULL=y
56CONFIG_FUTEX=y 60CONFIG_FUTEX=y
57CONFIG_EPOLL=y
58CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3 61CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3
59# CONFIG_LIMIT_PAGECACHE is not set
60CONFIG_BUDDY=y 62CONFIG_BUDDY=y
61# CONFIG_NP2 is not set 63# CONFIG_NP2 is not set
62CONFIG_SLAB=y 64CONFIG_SLAB=y
@@ -80,7 +82,9 @@ CONFIG_KMOD=y
80# Block layer 82# Block layer
81# 83#
82CONFIG_BLOCK=y 84CONFIG_BLOCK=y
85# CONFIG_LBD is not set
83# CONFIG_BLK_DEV_IO_TRACE is not set 86# CONFIG_BLK_DEV_IO_TRACE is not set
87# CONFIG_LSF is not set
84 88
85# 89#
86# IO Schedulers 90# IO Schedulers
@@ -109,7 +113,6 @@ CONFIG_PREEMPT_VOLUNTARY=y
109# CONFIG_BF532 is not set 113# CONFIG_BF532 is not set
110CONFIG_BF533=y 114CONFIG_BF533=y
111# CONFIG_BF534 is not set 115# CONFIG_BF534 is not set
112# CONFIG_BF535 is not set
113# CONFIG_BF536 is not set 116# CONFIG_BF536 is not set
114# CONFIG_BF537 is not set 117# CONFIG_BF537 is not set
115# CONFIG_BF561 is not set 118# CONFIG_BF561 is not set
@@ -125,6 +128,7 @@ CONFIG_BFIN533_EZKIT=y
125# CONFIG_BFIN537_BLUETECHNIX_CM is not set 128# CONFIG_BFIN537_BLUETECHNIX_CM is not set
126# CONFIG_BFIN561_BLUETECHNIX_CM is not set 129# CONFIG_BFIN561_BLUETECHNIX_CM is not set
127# CONFIG_BFIN561_EZKIT is not set 130# CONFIG_BFIN561_EZKIT is not set
131# CONFIG_BFIN561_TEPLA is not set
128# CONFIG_PNAV10 is not set 132# CONFIG_PNAV10 is not set
129# CONFIG_GENERIC_BOARD is not set 133# CONFIG_GENERIC_BOARD is not set
130CONFIG_MEM_MT48LC16M16A2TG_75=y 134CONFIG_MEM_MT48LC16M16A2TG_75=y
@@ -168,6 +172,7 @@ CONFIG_WDTIMER=13
168# 172#
169# Board customizations 173# Board customizations
170# 174#
175# CONFIG_CMDLINE_BOOL is not set
171 176
172# 177#
173# Board Setup 178# Board Setup
@@ -178,19 +183,6 @@ CONFIG_MEM_ADD_WIDTH=9
178CONFIG_BOOT_LOAD=0x1000 183CONFIG_BOOT_LOAD=0x1000
179 184
180# 185#
181# Console UART Setup
182#
183# CONFIG_BAUD_9600 is not set
184# CONFIG_BAUD_19200 is not set
185# CONFIG_BAUD_38400 is not set
186CONFIG_BAUD_57600=y
187# CONFIG_BAUD_115200 is not set
188CONFIG_BAUD_NO_PARITY=y
189# CONFIG_BAUD_PARITY is not set
190CONFIG_BAUD_1_STOPBIT=y
191# CONFIG_BAUD_2_STOPBIT is not set
192
193#
194# Blackfin Kernel Optimizations 186# Blackfin Kernel Optimizations
195# 187#
196 188
@@ -199,6 +191,7 @@ CONFIG_BAUD_1_STOPBIT=y
199# 191#
200# CONFIG_HZ_100 is not set 192# CONFIG_HZ_100 is not set
201CONFIG_HZ_250=y 193CONFIG_HZ_250=y
194# CONFIG_HZ_300 is not set
202# CONFIG_HZ_1000 is not set 195# CONFIG_HZ_1000 is not set
203CONFIG_HZ=250 196CONFIG_HZ=250
204 197
@@ -217,6 +210,7 @@ CONFIG_MEMSET_L1=y
217CONFIG_MEMCPY_L1=y 210CONFIG_MEMCPY_L1=y
218CONFIG_SYS_BFIN_SPINLOCK_L1=y 211CONFIG_SYS_BFIN_SPINLOCK_L1=y
219# CONFIG_IP_CHECKSUM_L1 is not set 212# CONFIG_IP_CHECKSUM_L1 is not set
213CONFIG_CACHELINE_ALIGNED_L1=y
220# CONFIG_SYSCALL_TAB_L1 is not set 214# CONFIG_SYSCALL_TAB_L1 is not set
221# CONFIG_CPLB_SWITCH_TAB_L1 is not set 215# CONFIG_CPLB_SWITCH_TAB_L1 is not set
222CONFIG_RAMKERNEL=y 216CONFIG_RAMKERNEL=y
@@ -230,6 +224,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y
230# CONFIG_SPARSEMEM_STATIC is not set 224# CONFIG_SPARSEMEM_STATIC is not set
231CONFIG_SPLIT_PTLOCK_CPUS=4 225CONFIG_SPLIT_PTLOCK_CPUS=4
232# CONFIG_RESOURCES_64BIT is not set 226# CONFIG_RESOURCES_64BIT is not set
227CONFIG_ZONE_DMA_FLAG=1
233CONFIG_LARGE_ALLOCS=y 228CONFIG_LARGE_ALLOCS=y
234CONFIG_BFIN_DMA_5XX=y 229CONFIG_BFIN_DMA_5XX=y
235# CONFIG_DMA_UNCACHED_2M is not set 230# CONFIG_DMA_UNCACHED_2M is not set
@@ -302,7 +297,7 @@ CONFIG_BINFMT_ZFLAT=y
302# Power management options 297# Power management options
303# 298#
304CONFIG_PM=y 299CONFIG_PM=y
305CONFIG_PM_LEGACY=y 300# CONFIG_PM_LEGACY is not set
306# CONFIG_PM_DEBUG is not set 301# CONFIG_PM_DEBUG is not set
307# CONFIG_PM_SYSFS_DEPRECATED is not set 302# CONFIG_PM_SYSFS_DEPRECATED is not set
308CONFIG_PM_WAKEUP_GPIO_BY_SIC_IWR=y 303CONFIG_PM_WAKEUP_GPIO_BY_SIC_IWR=y
@@ -330,6 +325,7 @@ CONFIG_UNIX=y
330CONFIG_XFRM=y 325CONFIG_XFRM=y
331# CONFIG_XFRM_USER is not set 326# CONFIG_XFRM_USER is not set
332# CONFIG_XFRM_SUB_POLICY is not set 327# CONFIG_XFRM_SUB_POLICY is not set
328# CONFIG_XFRM_MIGRATE is not set
333# CONFIG_NET_KEY is not set 329# CONFIG_NET_KEY is not set
334CONFIG_INET=y 330CONFIG_INET=y
335# CONFIG_IP_MULTICAST is not set 331# CONFIG_IP_MULTICAST is not set
@@ -356,6 +352,7 @@ CONFIG_INET_TCP_DIAG=y
356# CONFIG_TCP_CONG_ADVANCED is not set 352# CONFIG_TCP_CONG_ADVANCED is not set
357CONFIG_TCP_CONG_CUBIC=y 353CONFIG_TCP_CONG_CUBIC=y
358CONFIG_DEFAULT_TCP_CONG="cubic" 354CONFIG_DEFAULT_TCP_CONG="cubic"
355# CONFIG_TCP_MD5SIG is not set
359# CONFIG_IPV6 is not set 356# CONFIG_IPV6 is not set
360# CONFIG_INET6_XFRM_TUNNEL is not set 357# CONFIG_INET6_XFRM_TUNNEL is not set
361# CONFIG_INET6_TUNNEL is not set 358# CONFIG_INET6_TUNNEL is not set
@@ -399,7 +396,48 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
399# 396#
400# CONFIG_NET_PKTGEN is not set 397# CONFIG_NET_PKTGEN is not set
401# CONFIG_HAMRADIO is not set 398# CONFIG_HAMRADIO is not set
402# CONFIG_IRDA is not set 399CONFIG_IRDA=m
400
401#
402# IrDA protocols
403#
404CONFIG_IRLAN=m
405CONFIG_IRCOMM=m
406# CONFIG_IRDA_ULTRA is not set
407
408#
409# IrDA options
410#
411CONFIG_IRDA_CACHE_LAST_LSAP=y
412# CONFIG_IRDA_FAST_RR is not set
413# CONFIG_IRDA_DEBUG is not set
414
415#
416# Infrared-port device drivers
417#
418
419#
420# SIR device drivers
421#
422CONFIG_IRTTY_SIR=m
423
424#
425# Dongle support
426#
427# CONFIG_DONGLE is not set
428
429#
430# Old SIR device drivers
431#
432# CONFIG_IRPORT_SIR is not set
433
434#
435# Old Serial dongle support
436#
437
438#
439# FIR device drivers
440#
403# CONFIG_BT is not set 441# CONFIG_BT is not set
404# CONFIG_IEEE80211 is not set 442# CONFIG_IEEE80211 is not set
405 443
@@ -434,6 +472,7 @@ CONFIG_MTD_PARTITIONS=y
434# User Modules And Translation Layers 472# User Modules And Translation Layers
435# 473#
436CONFIG_MTD_CHAR=m 474CONFIG_MTD_CHAR=m
475CONFIG_MTD_BLKDEVS=y
437CONFIG_MTD_BLOCK=y 476CONFIG_MTD_BLOCK=y
438# CONFIG_FTL is not set 477# CONFIG_FTL is not set
439# CONFIG_NFTL is not set 478# CONFIG_NFTL is not set
@@ -489,6 +528,8 @@ CONFIG_BFIN_FLASH_BANK_3=0x7BB0
489# 528#
490# Self-contained MTD device drivers 529# Self-contained MTD device drivers
491# 530#
531# CONFIG_MTD_DATAFLASH is not set
532# CONFIG_MTD_M25P80 is not set
492# CONFIG_MTD_SLRAM is not set 533# CONFIG_MTD_SLRAM is not set
493# CONFIG_MTD_PHRAM is not set 534# CONFIG_MTD_PHRAM is not set
494# CONFIG_MTD_MTDRAM is not set 535# CONFIG_MTD_MTDRAM is not set
@@ -519,6 +560,7 @@ CONFIG_BFIN_FLASH_BANK_3=0x7BB0
519# 560#
520# Plug and Play support 561# Plug and Play support
521# 562#
563# CONFIG_PNPACPI is not set
522 564
523# 565#
524# Block devices 566# Block devices
@@ -530,14 +572,12 @@ CONFIG_BLK_DEV_RAM=y
530CONFIG_BLK_DEV_RAM_COUNT=16 572CONFIG_BLK_DEV_RAM_COUNT=16
531CONFIG_BLK_DEV_RAM_SIZE=4096 573CONFIG_BLK_DEV_RAM_SIZE=4096
532CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 574CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
533# CONFIG_BLK_DEV_INITRD is not set
534# CONFIG_CDROM_PKTCDVD is not set 575# CONFIG_CDROM_PKTCDVD is not set
535# CONFIG_ATA_OVER_ETH is not set 576# CONFIG_ATA_OVER_ETH is not set
536 577
537# 578#
538# Misc devices 579# Misc devices
539# 580#
540# CONFIG_TIFM_CORE is not set
541 581
542# 582#
543# ATA/ATAPI/MFM/RLL support 583# ATA/ATAPI/MFM/RLL support
@@ -636,7 +676,26 @@ CONFIG_SMC91X=y
636# 676#
637# Input device support 677# Input device support
638# 678#
639# CONFIG_INPUT is not set 679CONFIG_INPUT=m
680# CONFIG_INPUT_FF_MEMLESS is not set
681
682#
683# Userland interfaces
684#
685# CONFIG_INPUT_MOUSEDEV is not set
686# CONFIG_INPUT_JOYDEV is not set
687# CONFIG_INPUT_TSDEV is not set
688CONFIG_INPUT_EVDEV=m
689# CONFIG_INPUT_EVBUG is not set
690
691#
692# Input Device Drivers
693#
694# CONFIG_INPUT_KEYBOARD is not set
695# CONFIG_INPUT_MOUSE is not set
696# CONFIG_INPUT_JOYSTICK is not set
697# CONFIG_INPUT_TOUCHSCREEN is not set
698# CONFIG_INPUT_MISC is not set
640 699
641# 700#
642# Hardware I/O ports 701# Hardware I/O ports
@@ -649,12 +708,14 @@ CONFIG_SMC91X=y
649# 708#
650# CONFIG_AD9960 is not set 709# CONFIG_AD9960 is not set
651# CONFIG_SPI_ADC_BF533 is not set 710# CONFIG_SPI_ADC_BF533 is not set
652# CONFIG_BF533_PFLAGS is not set 711# CONFIG_BF5xx_PFLAGS is not set
653# CONFIG_BF5xx_PPIFCD is not set 712# CONFIG_BF5xx_PPIFCD is not set
654# CONFIG_BF5xx_TIMERS is not set 713# CONFIG_BF5xx_TIMERS is not set
655# CONFIG_BF5xx_PPI is not set 714# CONFIG_BF5xx_PPI is not set
656# CONFIG_BFIN_SPORT is not set 715CONFIG_BFIN_SPORT=y
657# CONFIG_BFIN_TIMER_LATENCY is not set 716# CONFIG_BFIN_TIMER_LATENCY is not set
717# CONFIG_AD5304 is not set
718# CONFIG_BF5xx_FBDMA is not set
658# CONFIG_VT is not set 719# CONFIG_VT is not set
659# CONFIG_SERIAL_NONSTANDARD is not set 720# CONFIG_SERIAL_NONSTANDARD is not set
660 721
@@ -691,16 +752,19 @@ CONFIG_UNIX98_PTYS=y
691# 752#
692# Watchdog Cards 753# Watchdog Cards
693# 754#
694# CONFIG_WATCHDOG is not set 755CONFIG_WATCHDOG=y
756# CONFIG_WATCHDOG_NOWAYOUT is not set
757
758#
759# Watchdog Device Drivers
760#
761# CONFIG_SOFT_WATCHDOG is not set
762CONFIG_BFIN_WDT=y
695CONFIG_HW_RANDOM=y 763CONFIG_HW_RANDOM=y
696# CONFIG_GEN_RTC is not set 764# CONFIG_GEN_RTC is not set
697CONFIG_BLACKFIN_DPMC=y 765CONFIG_BLACKFIN_DPMC=y
698# CONFIG_DTLK is not set 766# CONFIG_DTLK is not set
699# CONFIG_R3964 is not set 767# CONFIG_R3964 is not set
700
701#
702# Ftape, the floppy tape device driver
703#
704# CONFIG_RAW_DRIVER is not set 768# CONFIG_RAW_DRIVER is not set
705 769
706# 770#
@@ -716,8 +780,19 @@ CONFIG_BLACKFIN_DPMC=y
716# 780#
717# SPI support 781# SPI support
718# 782#
719# CONFIG_SPI is not set 783CONFIG_SPI=y
720# CONFIG_SPI_MASTER is not set 784CONFIG_SPI_MASTER=y
785
786#
787# SPI Master Controller Drivers
788#
789CONFIG_SPI_BFIN=y
790# CONFIG_SPI_BITBANG is not set
791
792#
793# SPI Protocol Masters
794#
795# CONFIG_SPI_AT25 is not set
721 796
722# 797#
723# Dallas's 1-wire bus 798# Dallas's 1-wire bus
@@ -731,10 +806,17 @@ CONFIG_HWMON=y
731# CONFIG_HWMON_VID is not set 806# CONFIG_HWMON_VID is not set
732# CONFIG_SENSORS_ABITUGURU is not set 807# CONFIG_SENSORS_ABITUGURU is not set
733# CONFIG_SENSORS_F71805F is not set 808# CONFIG_SENSORS_F71805F is not set
809# CONFIG_SENSORS_LM70 is not set
810# CONFIG_SENSORS_PC87427 is not set
734# CONFIG_SENSORS_VT1211 is not set 811# CONFIG_SENSORS_VT1211 is not set
735# CONFIG_HWMON_DEBUG_CHIP is not set 812# CONFIG_HWMON_DEBUG_CHIP is not set
736 813
737# 814#
815# Multifunction device drivers
816#
817# CONFIG_MFD_SM501 is not set
818
819#
738# Multimedia devices 820# Multimedia devices
739# 821#
740# CONFIG_VIDEO_DEV is not set 822# CONFIG_VIDEO_DEV is not set
@@ -747,9 +829,8 @@ CONFIG_HWMON=y
747# 829#
748# Graphics support 830# Graphics support
749# 831#
750CONFIG_FIRMWARE_EDID=y
751# CONFIG_FB is not set
752# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 832# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
833# CONFIG_FB is not set
753 834
754# 835#
755# Sound 836# Sound
@@ -757,6 +838,12 @@ CONFIG_FIRMWARE_EDID=y
757# CONFIG_SOUND is not set 838# CONFIG_SOUND is not set
758 839
759# 840#
841# HID Devices
842#
843CONFIG_HID=m
844# CONFIG_HID_DEBUG is not set
845
846#
760# USB support 847# USB support
761# 848#
762CONFIG_USB_ARCH_HAS_HCD=y 849CONFIG_USB_ARCH_HAS_HCD=y
@@ -776,6 +863,7 @@ CONFIG_USB_ARCH_HAS_HCD=y
776# 863#
777# MMC/SD Card support 864# MMC/SD Card support
778# 865#
866# CONFIG_SPI_MMC is not set
779# CONFIG_MMC is not set 867# CONFIG_MMC is not set
780 868
781# 869#
@@ -821,8 +909,10 @@ CONFIG_RTC_INTF_DEV=y
821# 909#
822# CONFIG_RTC_DRV_DS1553 is not set 910# CONFIG_RTC_DRV_DS1553 is not set
823# CONFIG_RTC_DRV_DS1742 is not set 911# CONFIG_RTC_DRV_DS1742 is not set
912# CONFIG_RTC_DRV_RS5C348 is not set
824# CONFIG_RTC_DRV_M48T86 is not set 913# CONFIG_RTC_DRV_M48T86 is not set
825# CONFIG_RTC_DRV_TEST is not set 914# CONFIG_RTC_DRV_TEST is not set
915# CONFIG_RTC_DRV_MAX6902 is not set
826# CONFIG_RTC_DRV_V3020 is not set 916# CONFIG_RTC_DRV_V3020 is not set
827CONFIG_RTC_DRV_BFIN=y 917CONFIG_RTC_DRV_BFIN=y
828 918
@@ -840,6 +930,14 @@ CONFIG_RTC_DRV_BFIN=y
840# 930#
841 931
842# 932#
933# Auxiliary Display support
934#
935
936#
937# Virtualization
938#
939
940#
843# PBX support 941# PBX support
844# 942#
845# CONFIG_PBX is not set 943# CONFIG_PBX is not set
@@ -847,13 +945,9 @@ CONFIG_RTC_DRV_BFIN=y
847# 945#
848# File systems 946# File systems
849# 947#
850CONFIG_EXT2_FS=y 948# CONFIG_EXT2_FS is not set
851CONFIG_EXT2_FS_XATTR=y
852# CONFIG_EXT2_FS_POSIX_ACL is not set
853# CONFIG_EXT2_FS_SECURITY is not set
854# CONFIG_EXT3_FS is not set 949# CONFIG_EXT3_FS is not set
855# CONFIG_EXT4DEV_FS is not set 950# CONFIG_EXT4DEV_FS is not set
856CONFIG_FS_MBCACHE=y
857# CONFIG_REISERFS_FS is not set 951# CONFIG_REISERFS_FS is not set
858# CONFIG_JFS_FS is not set 952# CONFIG_JFS_FS is not set
859# CONFIG_FS_POSIX_ACL is not set 953# CONFIG_FS_POSIX_ACL is not set
@@ -862,7 +956,8 @@ CONFIG_FS_MBCACHE=y
862# CONFIG_OCFS2_FS is not set 956# CONFIG_OCFS2_FS is not set
863# CONFIG_MINIX_FS is not set 957# CONFIG_MINIX_FS is not set
864# CONFIG_ROMFS_FS is not set 958# CONFIG_ROMFS_FS is not set
865# CONFIG_INOTIFY is not set 959CONFIG_INOTIFY=y
960CONFIG_INOTIFY_USER=y
866# CONFIG_QUOTA is not set 961# CONFIG_QUOTA is not set
867# CONFIG_DNOTIFY is not set 962# CONFIG_DNOTIFY is not set
868# CONFIG_AUTOFS_FS is not set 963# CONFIG_AUTOFS_FS is not set
@@ -913,7 +1008,6 @@ CONFIG_YAFFS_CHECKPOINT_RESERVED_BLOCKS=10
913# CONFIG_YAFFS_DISABLE_WIDE_TNODES is not set 1008# CONFIG_YAFFS_DISABLE_WIDE_TNODES is not set
914# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set 1009# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set
915CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y 1010CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y
916# CONFIG_JFFS_FS is not set
917CONFIG_JFFS2_FS=m 1011CONFIG_JFFS2_FS=m
918CONFIG_JFFS2_FS_DEBUG=0 1012CONFIG_JFFS2_FS_DEBUG=0
919CONFIG_JFFS2_FS_WRITEBUFFER=y 1013CONFIG_JFFS2_FS_WRITEBUFFER=y
@@ -945,7 +1039,8 @@ CONFIG_NFS_COMMON=y
945CONFIG_SUNRPC=m 1039CONFIG_SUNRPC=m
946# CONFIG_RPCSEC_GSS_KRB5 is not set 1040# CONFIG_RPCSEC_GSS_KRB5 is not set
947# CONFIG_RPCSEC_GSS_SPKM3 is not set 1041# CONFIG_RPCSEC_GSS_SPKM3 is not set
948# CONFIG_SMB_FS is not set 1042CONFIG_SMB_FS=m
1043# CONFIG_SMB_NLS_DEFAULT is not set
949# CONFIG_CIFS is not set 1044# CONFIG_CIFS is not set
950# CONFIG_NCP_FS is not set 1045# CONFIG_NCP_FS is not set
951# CONFIG_CODA_FS is not set 1046# CONFIG_CODA_FS is not set
@@ -961,7 +1056,51 @@ CONFIG_MSDOS_PARTITION=y
961# 1056#
962# Native Language Support 1057# Native Language Support
963# 1058#
964# CONFIG_NLS is not set 1059CONFIG_NLS=m
1060CONFIG_NLS_DEFAULT="iso8859-1"
1061# CONFIG_NLS_CODEPAGE_437 is not set
1062# CONFIG_NLS_CODEPAGE_737 is not set
1063# CONFIG_NLS_CODEPAGE_775 is not set
1064# CONFIG_NLS_CODEPAGE_850 is not set
1065# CONFIG_NLS_CODEPAGE_852 is not set
1066# CONFIG_NLS_CODEPAGE_855 is not set
1067# CONFIG_NLS_CODEPAGE_857 is not set
1068# CONFIG_NLS_CODEPAGE_860 is not set
1069# CONFIG_NLS_CODEPAGE_861 is not set
1070# CONFIG_NLS_CODEPAGE_862 is not set
1071# CONFIG_NLS_CODEPAGE_863 is not set
1072# CONFIG_NLS_CODEPAGE_864 is not set
1073# CONFIG_NLS_CODEPAGE_865 is not set
1074# CONFIG_NLS_CODEPAGE_866 is not set
1075# CONFIG_NLS_CODEPAGE_869 is not set
1076# CONFIG_NLS_CODEPAGE_936 is not set
1077# CONFIG_NLS_CODEPAGE_950 is not set
1078# CONFIG_NLS_CODEPAGE_932 is not set
1079# CONFIG_NLS_CODEPAGE_949 is not set
1080# CONFIG_NLS_CODEPAGE_874 is not set
1081# CONFIG_NLS_ISO8859_8 is not set
1082# CONFIG_NLS_CODEPAGE_1250 is not set
1083# CONFIG_NLS_CODEPAGE_1251 is not set
1084# CONFIG_NLS_ASCII is not set
1085# CONFIG_NLS_ISO8859_1 is not set
1086# CONFIG_NLS_ISO8859_2 is not set
1087# CONFIG_NLS_ISO8859_3 is not set
1088# CONFIG_NLS_ISO8859_4 is not set
1089# CONFIG_NLS_ISO8859_5 is not set
1090# CONFIG_NLS_ISO8859_6 is not set
1091# CONFIG_NLS_ISO8859_7 is not set
1092# CONFIG_NLS_ISO8859_9 is not set
1093# CONFIG_NLS_ISO8859_13 is not set
1094# CONFIG_NLS_ISO8859_14 is not set
1095# CONFIG_NLS_ISO8859_15 is not set
1096# CONFIG_NLS_KOI8_R is not set
1097# CONFIG_NLS_KOI8_U is not set
1098# CONFIG_NLS_UTF8 is not set
1099
1100#
1101# Distributed Lock Manager
1102#
1103# CONFIG_DLM is not set
965 1104
966# 1105#
967# Profiling support 1106# Profiling support
@@ -975,19 +1114,16 @@ CONFIG_MSDOS_PARTITION=y
975CONFIG_ENABLE_MUST_CHECK=y 1114CONFIG_ENABLE_MUST_CHECK=y
976# CONFIG_MAGIC_SYSRQ is not set 1115# CONFIG_MAGIC_SYSRQ is not set
977# CONFIG_UNUSED_SYMBOLS is not set 1116# CONFIG_UNUSED_SYMBOLS is not set
1117# CONFIG_DEBUG_FS is not set
1118# CONFIG_HEADERS_CHECK is not set
978# CONFIG_DEBUG_KERNEL is not set 1119# CONFIG_DEBUG_KERNEL is not set
979CONFIG_LOG_BUF_SHIFT=14 1120CONFIG_LOG_BUF_SHIFT=14
980# CONFIG_DEBUG_BUGVERBOSE is not set 1121# CONFIG_DEBUG_BUGVERBOSE is not set
981# CONFIG_DEBUG_FS is not set
982# CONFIG_UNWIND_INFO is not set
983# CONFIG_HEADERS_CHECK is not set
984# CONFIG_DEBUG_SERIAL_EARLY_INIT is not set 1122# CONFIG_DEBUG_SERIAL_EARLY_INIT is not set
985CONFIG_DEBUG_HUNT_FOR_ZERO=y 1123CONFIG_DEBUG_HUNT_FOR_ZERO=y
986# CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE is not set 1124# CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE is not set
987# CONFIG_BOOTPARAM is not set
988# CONFIG_NO_KERNEL_MSG is not set
989CONFIG_CPLB_INFO=y 1125CONFIG_CPLB_INFO=y
990# CONFIG_NO_ACCESS_CHECK is not set 1126CONFIG_ACCESS_CHECK=y
991 1127
992# 1128#
993# Security options 1129# Security options
@@ -995,7 +1131,7 @@ CONFIG_CPLB_INFO=y
995# CONFIG_KEYS is not set 1131# CONFIG_KEYS is not set
996CONFIG_SECURITY=y 1132CONFIG_SECURITY=y
997# CONFIG_SECURITY_NETWORK is not set 1133# CONFIG_SECURITY_NETWORK is not set
998CONFIG_SECURITY_CAPABILITIES=y 1134CONFIG_SECURITY_CAPABILITIES=m
999 1135
1000# 1136#
1001# Cryptographic options 1137# Cryptographic options
@@ -1005,10 +1141,13 @@ CONFIG_SECURITY_CAPABILITIES=y
1005# 1141#
1006# Library routines 1142# Library routines
1007# 1143#
1008# CONFIG_CRC_CCITT is not set 1144CONFIG_BITREVERSE=y
1145CONFIG_CRC_CCITT=m
1009# CONFIG_CRC16 is not set 1146# CONFIG_CRC16 is not set
1010CONFIG_CRC32=y 1147CONFIG_CRC32=y
1011# CONFIG_LIBCRC32C is not set 1148# CONFIG_LIBCRC32C is not set
1012CONFIG_ZLIB_INFLATE=y 1149CONFIG_ZLIB_INFLATE=y
1013CONFIG_ZLIB_DEFLATE=m 1150CONFIG_ZLIB_DEFLATE=m
1014CONFIG_PLIST=y 1151CONFIG_PLIST=y
1152CONFIG_HAS_IOMEM=y
1153CONFIG_HAS_IOPORT=y
diff --git a/arch/blackfin/configs/BF533-STAMP_defconfig b/arch/blackfin/configs/BF533-STAMP_defconfig
index 14a948c288a5..fee918957392 100644
--- a/arch/blackfin/configs/BF533-STAMP_defconfig
+++ b/arch/blackfin/configs/BF533-STAMP_defconfig
@@ -1,12 +1,13 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20.4 3# Linux kernel version: 2.6.21.3
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
7CONFIG_RWSEM_GENERIC_SPINLOCK=y 7CONFIG_RWSEM_GENERIC_SPINLOCK=y
8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set 8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
9CONFIG_BLACKFIN=y 9CONFIG_BLACKFIN=y
10CONFIG_ZONE_DMA=y
10CONFIG_BFIN=y 11CONFIG_BFIN=y
11CONFIG_SEMAPHORE_SLEEPERS=y 12CONFIG_SEMAPHORE_SLEEPERS=y
12CONFIG_GENERIC_FIND_NEXT_BIT=y 13CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -33,6 +34,7 @@ CONFIG_LOCALVERSION=""
33CONFIG_LOCALVERSION_AUTO=y 34CONFIG_LOCALVERSION_AUTO=y
34CONFIG_SYSVIPC=y 35CONFIG_SYSVIPC=y
35# CONFIG_IPC_NS is not set 36# CONFIG_IPC_NS is not set
37CONFIG_SYSVIPC_SYSCTL=y
36# CONFIG_POSIX_MQUEUE is not set 38# CONFIG_POSIX_MQUEUE is not set
37# CONFIG_BSD_PROCESS_ACCT is not set 39# CONFIG_BSD_PROCESS_ACCT is not set
38# CONFIG_TASKSTATS is not set 40# CONFIG_TASKSTATS is not set
@@ -41,6 +43,7 @@ CONFIG_SYSVIPC=y
41# CONFIG_IKCONFIG is not set 43# CONFIG_IKCONFIG is not set
42CONFIG_SYSFS_DEPRECATED=y 44CONFIG_SYSFS_DEPRECATED=y
43# CONFIG_RELAY is not set 45# CONFIG_RELAY is not set
46CONFIG_BLK_DEV_INITRD=y
44CONFIG_INITRAMFS_SOURCE="" 47CONFIG_INITRAMFS_SOURCE=""
45# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 48# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
46CONFIG_SYSCTL=y 49CONFIG_SYSCTL=y
@@ -55,9 +58,7 @@ CONFIG_BUG=y
55CONFIG_ELF_CORE=y 58CONFIG_ELF_CORE=y
56CONFIG_BASE_FULL=y 59CONFIG_BASE_FULL=y
57CONFIG_FUTEX=y 60CONFIG_FUTEX=y
58CONFIG_EPOLL=y
59CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3 61CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3
60# CONFIG_LIMIT_PAGECACHE is not set
61CONFIG_BUDDY=y 62CONFIG_BUDDY=y
62# CONFIG_NP2 is not set 63# CONFIG_NP2 is not set
63CONFIG_SLAB=y 64CONFIG_SLAB=y
@@ -127,6 +128,7 @@ CONFIG_BFIN533_STAMP=y
127# CONFIG_BFIN537_BLUETECHNIX_CM is not set 128# CONFIG_BFIN537_BLUETECHNIX_CM is not set
128# CONFIG_BFIN561_BLUETECHNIX_CM is not set 129# CONFIG_BFIN561_BLUETECHNIX_CM is not set
129# CONFIG_BFIN561_EZKIT is not set 130# CONFIG_BFIN561_EZKIT is not set
131# CONFIG_BFIN561_TEPLA is not set
130# CONFIG_PNAV10 is not set 132# CONFIG_PNAV10 is not set
131# CONFIG_GENERIC_BOARD is not set 133# CONFIG_GENERIC_BOARD is not set
132CONFIG_MEM_MT48LC64M4A2FB_7E=y 134CONFIG_MEM_MT48LC64M4A2FB_7E=y
@@ -193,19 +195,6 @@ CONFIG_BFIN_IDLE_LED_PORT=0xFFC00700
193CONFIG_BFIN_IDLE_LED_DPORT=0xFFC00730 195CONFIG_BFIN_IDLE_LED_DPORT=0xFFC00730
194 196
195# 197#
196# Console UART Setup
197#
198# CONFIG_BAUD_9600 is not set
199# CONFIG_BAUD_19200 is not set
200# CONFIG_BAUD_38400 is not set
201CONFIG_BAUD_57600=y
202# CONFIG_BAUD_115200 is not set
203CONFIG_BAUD_NO_PARITY=y
204# CONFIG_BAUD_PARITY is not set
205CONFIG_BAUD_1_STOPBIT=y
206# CONFIG_BAUD_2_STOPBIT is not set
207
208#
209# Blackfin Kernel Optimizations 198# Blackfin Kernel Optimizations
210# 199#
211 200
@@ -233,6 +222,7 @@ CONFIG_MEMSET_L1=y
233CONFIG_MEMCPY_L1=y 222CONFIG_MEMCPY_L1=y
234CONFIG_SYS_BFIN_SPINLOCK_L1=y 223CONFIG_SYS_BFIN_SPINLOCK_L1=y
235# CONFIG_IP_CHECKSUM_L1 is not set 224# CONFIG_IP_CHECKSUM_L1 is not set
225CONFIG_CACHELINE_ALIGNED_L1=y
236# CONFIG_SYSCALL_TAB_L1 is not set 226# CONFIG_SYSCALL_TAB_L1 is not set
237# CONFIG_CPLB_SWITCH_TAB_L1 is not set 227# CONFIG_CPLB_SWITCH_TAB_L1 is not set
238CONFIG_RAMKERNEL=y 228CONFIG_RAMKERNEL=y
@@ -246,6 +236,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y
246# CONFIG_SPARSEMEM_STATIC is not set 236# CONFIG_SPARSEMEM_STATIC is not set
247CONFIG_SPLIT_PTLOCK_CPUS=4 237CONFIG_SPLIT_PTLOCK_CPUS=4
248# CONFIG_RESOURCES_64BIT is not set 238# CONFIG_RESOURCES_64BIT is not set
239CONFIG_ZONE_DMA_FLAG=1
249CONFIG_LARGE_ALLOCS=y 240CONFIG_LARGE_ALLOCS=y
250CONFIG_BFIN_DMA_5XX=y 241CONFIG_BFIN_DMA_5XX=y
251# CONFIG_DMA_UNCACHED_2M is not set 242# CONFIG_DMA_UNCACHED_2M is not set
@@ -318,7 +309,7 @@ CONFIG_BINFMT_ZFLAT=y
318# Power management options 309# Power management options
319# 310#
320CONFIG_PM=y 311CONFIG_PM=y
321CONFIG_PM_LEGACY=y 312# CONFIG_PM_LEGACY is not set
322# CONFIG_PM_DEBUG is not set 313# CONFIG_PM_DEBUG is not set
323# CONFIG_PM_SYSFS_DEPRECATED is not set 314# CONFIG_PM_SYSFS_DEPRECATED is not set
324CONFIG_PM_WAKEUP_GPIO_BY_SIC_IWR=y 315CONFIG_PM_WAKEUP_GPIO_BY_SIC_IWR=y
@@ -346,6 +337,7 @@ CONFIG_UNIX=y
346CONFIG_XFRM=y 337CONFIG_XFRM=y
347# CONFIG_XFRM_USER is not set 338# CONFIG_XFRM_USER is not set
348# CONFIG_XFRM_SUB_POLICY is not set 339# CONFIG_XFRM_SUB_POLICY is not set
340# CONFIG_XFRM_MIGRATE is not set
349# CONFIG_NET_KEY is not set 341# CONFIG_NET_KEY is not set
350CONFIG_INET=y 342CONFIG_INET=y
351# CONFIG_IP_MULTICAST is not set 343# CONFIG_IP_MULTICAST is not set
@@ -580,6 +572,7 @@ CONFIG_BFIN_FLASH_BANK_3=0x7BB0
580# 572#
581# Plug and Play support 573# Plug and Play support
582# 574#
575# CONFIG_PNPACPI is not set
583 576
584# 577#
585# Block devices 578# Block devices
@@ -591,14 +584,12 @@ CONFIG_BLK_DEV_RAM=y
591CONFIG_BLK_DEV_RAM_COUNT=16 584CONFIG_BLK_DEV_RAM_COUNT=16
592CONFIG_BLK_DEV_RAM_SIZE=4096 585CONFIG_BLK_DEV_RAM_SIZE=4096
593CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 586CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
594# CONFIG_BLK_DEV_INITRD is not set
595# CONFIG_CDROM_PKTCDVD is not set 587# CONFIG_CDROM_PKTCDVD is not set
596# CONFIG_ATA_OVER_ETH is not set 588# CONFIG_ATA_OVER_ETH is not set
597 589
598# 590#
599# Misc devices 591# Misc devices
600# 592#
601# CONFIG_TIFM_CORE is not set
602 593
603# 594#
604# ATA/ATAPI/MFM/RLL support 595# ATA/ATAPI/MFM/RLL support
@@ -733,7 +724,7 @@ CONFIG_BFIN_TWIKEYPAD_IRQ_PFX=39
733# 724#
734# CONFIG_AD9960 is not set 725# CONFIG_AD9960 is not set
735# CONFIG_SPI_ADC_BF533 is not set 726# CONFIG_SPI_ADC_BF533 is not set
736# CONFIG_BF533_PFLAGS is not set 727# CONFIG_BF5xx_PFLAGS is not set
737# CONFIG_BF5xx_PPIFCD is not set 728# CONFIG_BF5xx_PPIFCD is not set
738# CONFIG_BF5xx_TIMERS is not set 729# CONFIG_BF5xx_TIMERS is not set
739# CONFIG_BF5xx_PPI is not set 730# CONFIG_BF5xx_PPI is not set
@@ -742,6 +733,8 @@ CONFIG_BFIN_SPORT=y
742CONFIG_TWI_LCD=m 733CONFIG_TWI_LCD=m
743CONFIG_TWI_LCD_SLAVE_ADDR=34 734CONFIG_TWI_LCD_SLAVE_ADDR=34
744# CONFIG_AD5304 is not set 735# CONFIG_AD5304 is not set
736# CONFIG_BF5xx_TEA5764 is not set
737# CONFIG_BF5xx_FBDMA is not set
745# CONFIG_VT is not set 738# CONFIG_VT is not set
746# CONFIG_SERIAL_NONSTANDARD is not set 739# CONFIG_SERIAL_NONSTANDARD is not set
747 740
@@ -778,7 +771,14 @@ CONFIG_UNIX98_PTYS=y
778# 771#
779# Watchdog Cards 772# Watchdog Cards
780# 773#
781# CONFIG_WATCHDOG is not set 774CONFIG_WATCHDOG=y
775# CONFIG_WATCHDOG_NOWAYOUT is not set
776
777#
778# Watchdog Device Drivers
779#
780# CONFIG_SOFT_WATCHDOG is not set
781CONFIG_BFIN_WDT=y
782CONFIG_HW_RANDOM=y 782CONFIG_HW_RANDOM=y
783# CONFIG_GEN_RTC is not set 783# CONFIG_GEN_RTC is not set
784CONFIG_BLACKFIN_DPMC=y 784CONFIG_BLACKFIN_DPMC=y
@@ -840,12 +840,13 @@ CONFIG_SPI_MASTER=y
840# 840#
841# SPI Master Controller Drivers 841# SPI Master Controller Drivers
842# 842#
843CONFIG_SPI_BFIN=y
843# CONFIG_SPI_BITBANG is not set 844# CONFIG_SPI_BITBANG is not set
844 845
845# 846#
846# SPI Protocol Masters 847# SPI Protocol Masters
847# 848#
848CONFIG_SPI_BFIN=y 849# CONFIG_SPI_AT25 is not set
849 850
850# 851#
851# Dallas's 1-wire bus 852# Dallas's 1-wire bus
@@ -861,6 +862,7 @@ CONFIG_HWMON=y
861# CONFIG_SENSORS_ADM1021 is not set 862# CONFIG_SENSORS_ADM1021 is not set
862# CONFIG_SENSORS_ADM1025 is not set 863# CONFIG_SENSORS_ADM1025 is not set
863# CONFIG_SENSORS_ADM1026 is not set 864# CONFIG_SENSORS_ADM1026 is not set
865# CONFIG_SENSORS_ADM1029 is not set
864# CONFIG_SENSORS_ADM1031 is not set 866# CONFIG_SENSORS_ADM1031 is not set
865# CONFIG_SENSORS_ADM9240 is not set 867# CONFIG_SENSORS_ADM9240 is not set
866# CONFIG_SENSORS_ASB100 is not set 868# CONFIG_SENSORS_ASB100 is not set
@@ -900,6 +902,11 @@ CONFIG_HWMON=y
900# CONFIG_HWMON_DEBUG_CHIP is not set 902# CONFIG_HWMON_DEBUG_CHIP is not set
901 903
902# 904#
905# Multifunction device drivers
906#
907# CONFIG_MFD_SM501 is not set
908
909#
903# Multimedia devices 910# Multimedia devices
904# 911#
905# CONFIG_VIDEO_DEV is not set 912# CONFIG_VIDEO_DEV is not set
@@ -912,15 +919,22 @@ CONFIG_HWMON=y
912# 919#
913# Graphics support 920# Graphics support
914# 921#
915CONFIG_FIRMWARE_EDID=y 922# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
916CONFIG_FB=m 923CONFIG_FB=m
924CONFIG_FIRMWARE_EDID=y
925# CONFIG_FB_DDC is not set
917CONFIG_FB_CFB_FILLRECT=m 926CONFIG_FB_CFB_FILLRECT=m
918CONFIG_FB_CFB_COPYAREA=m 927CONFIG_FB_CFB_COPYAREA=m
919CONFIG_FB_CFB_IMAGEBLIT=m 928CONFIG_FB_CFB_IMAGEBLIT=m
929# CONFIG_FB_SVGALIB is not set
920# CONFIG_FB_MACMODES is not set 930# CONFIG_FB_MACMODES is not set
921# CONFIG_FB_BACKLIGHT is not set 931# CONFIG_FB_BACKLIGHT is not set
922# CONFIG_FB_MODE_HELPERS is not set 932# CONFIG_FB_MODE_HELPERS is not set
923# CONFIG_FB_TILEBLITTING is not set 933# CONFIG_FB_TILEBLITTING is not set
934
935#
936# Frame buffer hardware drivers
937#
924CONFIG_FB_BFIN_7171=m 938CONFIG_FB_BFIN_7171=m
925CONFIG_FB_BFIN_7393=m 939CONFIG_FB_BFIN_7393=m
926CONFIG_NTSC=y 940CONFIG_NTSC=y
@@ -938,7 +952,6 @@ CONFIG_ADV7393_1XMEM=y
938# Logo configuration 952# Logo configuration
939# 953#
940# CONFIG_LOGO is not set 954# CONFIG_LOGO is not set
941# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
942 955
943# 956#
944# Sound 957# Sound
@@ -971,6 +984,18 @@ CONFIG_SND_VERBOSE_PROCFS=y
971# CONFIG_SND_MPU401 is not set 984# CONFIG_SND_MPU401 is not set
972 985
973# 986#
987# ALSA Blackfin devices
988#
989# CONFIG_SND_BLACKFIN_AD1836 is not set
990# CONFIG_SND_BLACKFIN_AD1981B is not set
991# CONFIG_SND_BFIN_AD73311 is not set
992
993#
994# SoC audio support
995#
996# CONFIG_SND_SOC is not set
997
998#
974# Open Sound System 999# Open Sound System
975# 1000#
976# CONFIG_SOUND_PRIME is not set 1001# CONFIG_SOUND_PRIME is not set
@@ -979,6 +1004,7 @@ CONFIG_SND_VERBOSE_PROCFS=y
979# HID Devices 1004# HID Devices
980# 1005#
981CONFIG_HID=y 1006CONFIG_HID=y
1007# CONFIG_HID_DEBUG is not set
982 1008
983# 1009#
984# USB support 1010# USB support
@@ -1051,7 +1077,6 @@ CONFIG_RTC_INTF_DEV=y
1051# CONFIG_RTC_DRV_DS1672 is not set 1077# CONFIG_RTC_DRV_DS1672 is not set
1052# CONFIG_RTC_DRV_DS1742 is not set 1078# CONFIG_RTC_DRV_DS1742 is not set
1053# CONFIG_RTC_DRV_PCF8563 is not set 1079# CONFIG_RTC_DRV_PCF8563 is not set
1054# CONFIG_RTC_DRV_PCF8583 is not set
1055# CONFIG_RTC_DRV_RS5C348 is not set 1080# CONFIG_RTC_DRV_RS5C348 is not set
1056# CONFIG_RTC_DRV_RS5C372 is not set 1081# CONFIG_RTC_DRV_RS5C372 is not set
1057# CONFIG_RTC_DRV_M48T86 is not set 1082# CONFIG_RTC_DRV_M48T86 is not set
@@ -1074,6 +1099,10 @@ CONFIG_RTC_DRV_BFIN=y
1074# 1099#
1075 1100
1076# 1101#
1102# Auxiliary Display support
1103#
1104
1105#
1077# Virtualization 1106# Virtualization
1078# 1107#
1079 1108
@@ -1085,13 +1114,9 @@ CONFIG_RTC_DRV_BFIN=y
1085# 1114#
1086# File systems 1115# File systems
1087# 1116#
1088CONFIG_EXT2_FS=y 1117# CONFIG_EXT2_FS is not set
1089CONFIG_EXT2_FS_XATTR=y
1090# CONFIG_EXT2_FS_POSIX_ACL is not set
1091# CONFIG_EXT2_FS_SECURITY is not set
1092# CONFIG_EXT3_FS is not set 1118# CONFIG_EXT3_FS is not set
1093# CONFIG_EXT4DEV_FS is not set 1119# CONFIG_EXT4DEV_FS is not set
1094CONFIG_FS_MBCACHE=y
1095# CONFIG_REISERFS_FS is not set 1120# CONFIG_REISERFS_FS is not set
1096# CONFIG_JFS_FS is not set 1121# CONFIG_JFS_FS is not set
1097# CONFIG_FS_POSIX_ACL is not set 1122# CONFIG_FS_POSIX_ACL is not set
@@ -1103,7 +1128,7 @@ CONFIG_FS_MBCACHE=y
1103CONFIG_INOTIFY=y 1128CONFIG_INOTIFY=y
1104CONFIG_INOTIFY_USER=y 1129CONFIG_INOTIFY_USER=y
1105# CONFIG_QUOTA is not set 1130# CONFIG_QUOTA is not set
1106CONFIG_DNOTIFY=y 1131# CONFIG_DNOTIFY is not set
1107# CONFIG_AUTOFS_FS is not set 1132# CONFIG_AUTOFS_FS is not set
1108# CONFIG_AUTOFS4_FS is not set 1133# CONFIG_AUTOFS4_FS is not set
1109# CONFIG_FUSE_FS is not set 1134# CONFIG_FUSE_FS is not set
@@ -1275,7 +1300,7 @@ CONFIG_ACCESS_CHECK=y
1275# CONFIG_KEYS is not set 1300# CONFIG_KEYS is not set
1276CONFIG_SECURITY=y 1301CONFIG_SECURITY=y
1277# CONFIG_SECURITY_NETWORK is not set 1302# CONFIG_SECURITY_NETWORK is not set
1278CONFIG_SECURITY_CAPABILITIES=y 1303CONFIG_SECURITY_CAPABILITIES=m
1279 1304
1280# 1305#
1281# Cryptographic options 1306# Cryptographic options
@@ -1293,4 +1318,5 @@ CONFIG_CRC32=y
1293CONFIG_ZLIB_INFLATE=y 1318CONFIG_ZLIB_INFLATE=y
1294CONFIG_ZLIB_DEFLATE=m 1319CONFIG_ZLIB_DEFLATE=m
1295CONFIG_PLIST=y 1320CONFIG_PLIST=y
1296CONFIG_IOMAP_COPY=y 1321CONFIG_HAS_IOMEM=y
1322CONFIG_HAS_IOPORT=y
diff --git a/arch/blackfin/configs/BF537-STAMP_defconfig b/arch/blackfin/configs/BF537-STAMP_defconfig
index 8ed67dc450fd..37688bb55b9a 100644
--- a/arch/blackfin/configs/BF537-STAMP_defconfig
+++ b/arch/blackfin/configs/BF537-STAMP_defconfig
@@ -1,12 +1,13 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20.4 3# Linux kernel version: 2.6.21.3
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
7CONFIG_RWSEM_GENERIC_SPINLOCK=y 7CONFIG_RWSEM_GENERIC_SPINLOCK=y
8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set 8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
9CONFIG_BLACKFIN=y 9CONFIG_BLACKFIN=y
10CONFIG_ZONE_DMA=y
10CONFIG_BFIN=y 11CONFIG_BFIN=y
11CONFIG_SEMAPHORE_SLEEPERS=y 12CONFIG_SEMAPHORE_SLEEPERS=y
12CONFIG_GENERIC_FIND_NEXT_BIT=y 13CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -33,6 +34,7 @@ CONFIG_LOCALVERSION=""
33CONFIG_LOCALVERSION_AUTO=y 34CONFIG_LOCALVERSION_AUTO=y
34CONFIG_SYSVIPC=y 35CONFIG_SYSVIPC=y
35# CONFIG_IPC_NS is not set 36# CONFIG_IPC_NS is not set
37CONFIG_SYSVIPC_SYSCTL=y
36# CONFIG_POSIX_MQUEUE is not set 38# CONFIG_POSIX_MQUEUE is not set
37# CONFIG_BSD_PROCESS_ACCT is not set 39# CONFIG_BSD_PROCESS_ACCT is not set
38# CONFIG_TASKSTATS is not set 40# CONFIG_TASKSTATS is not set
@@ -41,6 +43,7 @@ CONFIG_SYSVIPC=y
41# CONFIG_IKCONFIG is not set 43# CONFIG_IKCONFIG is not set
42CONFIG_SYSFS_DEPRECATED=y 44CONFIG_SYSFS_DEPRECATED=y
43# CONFIG_RELAY is not set 45# CONFIG_RELAY is not set
46CONFIG_BLK_DEV_INITRD=y
44CONFIG_INITRAMFS_SOURCE="" 47CONFIG_INITRAMFS_SOURCE=""
45# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 48# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
46CONFIG_SYSCTL=y 49CONFIG_SYSCTL=y
@@ -55,9 +58,7 @@ CONFIG_BUG=y
55CONFIG_ELF_CORE=y 58CONFIG_ELF_CORE=y
56CONFIG_BASE_FULL=y 59CONFIG_BASE_FULL=y
57CONFIG_FUTEX=y 60CONFIG_FUTEX=y
58CONFIG_EPOLL=y
59CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3 61CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3
60# CONFIG_LIMIT_PAGECACHE is not set
61CONFIG_BUDDY=y 62CONFIG_BUDDY=y
62# CONFIG_NP2 is not set 63# CONFIG_NP2 is not set
63CONFIG_SLAB=y 64CONFIG_SLAB=y
@@ -127,6 +128,7 @@ CONFIG_BFIN537_STAMP=y
127# CONFIG_BFIN537_BLUETECHNIX_CM is not set 128# CONFIG_BFIN537_BLUETECHNIX_CM is not set
128# CONFIG_BFIN561_BLUETECHNIX_CM is not set 129# CONFIG_BFIN561_BLUETECHNIX_CM is not set
129# CONFIG_BFIN561_EZKIT is not set 130# CONFIG_BFIN561_EZKIT is not set
131# CONFIG_BFIN561_TEPLA is not set
130# CONFIG_PNAV10 is not set 132# CONFIG_PNAV10 is not set
131# CONFIG_GENERIC_BOARD is not set 133# CONFIG_GENERIC_BOARD is not set
132CONFIG_MEM_MT48LC32M8A2_75=y 134CONFIG_MEM_MT48LC32M8A2_75=y
@@ -196,19 +198,6 @@ CONFIG_MEM_ADD_WIDTH=10
196CONFIG_BOOT_LOAD=0x1000 198CONFIG_BOOT_LOAD=0x1000
197 199
198# 200#
199# Console UART Setup
200#
201# CONFIG_BAUD_9600 is not set
202# CONFIG_BAUD_19200 is not set
203# CONFIG_BAUD_38400 is not set
204CONFIG_BAUD_57600=y
205# CONFIG_BAUD_115200 is not set
206CONFIG_BAUD_NO_PARITY=y
207# CONFIG_BAUD_PARITY is not set
208CONFIG_BAUD_1_STOPBIT=y
209# CONFIG_BAUD_2_STOPBIT is not set
210
211#
212# Blackfin Kernel Optimizations 201# Blackfin Kernel Optimizations
213# 202#
214 203
@@ -236,6 +225,7 @@ CONFIG_MEMSET_L1=y
236CONFIG_MEMCPY_L1=y 225CONFIG_MEMCPY_L1=y
237CONFIG_SYS_BFIN_SPINLOCK_L1=y 226CONFIG_SYS_BFIN_SPINLOCK_L1=y
238# CONFIG_IP_CHECKSUM_L1 is not set 227# CONFIG_IP_CHECKSUM_L1 is not set
228CONFIG_CACHELINE_ALIGNED_L1=y
239# CONFIG_SYSCALL_TAB_L1 is not set 229# CONFIG_SYSCALL_TAB_L1 is not set
240# CONFIG_CPLB_SWITCH_TAB_L1 is not set 230# CONFIG_CPLB_SWITCH_TAB_L1 is not set
241CONFIG_RAMKERNEL=y 231CONFIG_RAMKERNEL=y
@@ -249,6 +239,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y
249# CONFIG_SPARSEMEM_STATIC is not set 239# CONFIG_SPARSEMEM_STATIC is not set
250CONFIG_SPLIT_PTLOCK_CPUS=4 240CONFIG_SPLIT_PTLOCK_CPUS=4
251# CONFIG_RESOURCES_64BIT is not set 241# CONFIG_RESOURCES_64BIT is not set
242CONFIG_ZONE_DMA_FLAG=1
252CONFIG_LARGE_ALLOCS=y 243CONFIG_LARGE_ALLOCS=y
253CONFIG_BFIN_DMA_5XX=y 244CONFIG_BFIN_DMA_5XX=y
254# CONFIG_DMA_UNCACHED_2M is not set 245# CONFIG_DMA_UNCACHED_2M is not set
@@ -321,7 +312,7 @@ CONFIG_BINFMT_ZFLAT=y
321# Power management options 312# Power management options
322# 313#
323CONFIG_PM=y 314CONFIG_PM=y
324CONFIG_PM_LEGACY=y 315# CONFIG_PM_LEGACY is not set
325# CONFIG_PM_DEBUG is not set 316# CONFIG_PM_DEBUG is not set
326# CONFIG_PM_SYSFS_DEPRECATED is not set 317# CONFIG_PM_SYSFS_DEPRECATED is not set
327CONFIG_PM_WAKEUP_GPIO_BY_SIC_IWR=y 318CONFIG_PM_WAKEUP_GPIO_BY_SIC_IWR=y
@@ -349,6 +340,7 @@ CONFIG_UNIX=y
349CONFIG_XFRM=y 340CONFIG_XFRM=y
350# CONFIG_XFRM_USER is not set 341# CONFIG_XFRM_USER is not set
351# CONFIG_XFRM_SUB_POLICY is not set 342# CONFIG_XFRM_SUB_POLICY is not set
343# CONFIG_XFRM_MIGRATE is not set
352# CONFIG_NET_KEY is not set 344# CONFIG_NET_KEY is not set
353CONFIG_INET=y 345CONFIG_INET=y
354# CONFIG_IP_MULTICAST is not set 346# CONFIG_IP_MULTICAST is not set
@@ -593,6 +585,7 @@ CONFIG_MTD_NAND_IDS=m
593# 585#
594# Plug and Play support 586# Plug and Play support
595# 587#
588# CONFIG_PNPACPI is not set
596 589
597# 590#
598# Block devices 591# Block devices
@@ -604,14 +597,12 @@ CONFIG_BLK_DEV_RAM=y
604CONFIG_BLK_DEV_RAM_COUNT=16 597CONFIG_BLK_DEV_RAM_COUNT=16
605CONFIG_BLK_DEV_RAM_SIZE=4096 598CONFIG_BLK_DEV_RAM_SIZE=4096
606CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 599CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
607# CONFIG_BLK_DEV_INITRD is not set
608# CONFIG_CDROM_PKTCDVD is not set 600# CONFIG_CDROM_PKTCDVD is not set
609# CONFIG_ATA_OVER_ETH is not set 601# CONFIG_ATA_OVER_ETH is not set
610 602
611# 603#
612# Misc devices 604# Misc devices
613# 605#
614# CONFIG_TIFM_CORE is not set
615 606
616# 607#
617# ATA/ATAPI/MFM/RLL support 608# ATA/ATAPI/MFM/RLL support
@@ -751,7 +742,7 @@ CONFIG_BFIN_TWIKEYPAD_IRQ_PFX=72
751# 742#
752# CONFIG_AD9960 is not set 743# CONFIG_AD9960 is not set
753# CONFIG_SPI_ADC_BF533 is not set 744# CONFIG_SPI_ADC_BF533 is not set
754# CONFIG_BF533_PFLAGS is not set 745# CONFIG_BF5xx_PFLAGS is not set
755# CONFIG_BF5xx_PPIFCD is not set 746# CONFIG_BF5xx_PPIFCD is not set
756# CONFIG_BF5xx_TIMERS is not set 747# CONFIG_BF5xx_TIMERS is not set
757# CONFIG_BF5xx_PPI is not set 748# CONFIG_BF5xx_PPI is not set
@@ -760,6 +751,8 @@ CONFIG_BFIN_SPORT=y
760CONFIG_TWI_LCD=m 751CONFIG_TWI_LCD=m
761CONFIG_TWI_LCD_SLAVE_ADDR=34 752CONFIG_TWI_LCD_SLAVE_ADDR=34
762# CONFIG_AD5304 is not set 753# CONFIG_AD5304 is not set
754# CONFIG_BF5xx_TEA5764 is not set
755# CONFIG_BF5xx_FBDMA is not set
763# CONFIG_VT is not set 756# CONFIG_VT is not set
764# CONFIG_SERIAL_NONSTANDARD is not set 757# CONFIG_SERIAL_NONSTANDARD is not set
765 758
@@ -804,7 +797,14 @@ CONFIG_CAN_BLACKFIN=m
804# 797#
805# Watchdog Cards 798# Watchdog Cards
806# 799#
807# CONFIG_WATCHDOG is not set 800CONFIG_WATCHDOG=y
801# CONFIG_WATCHDOG_NOWAYOUT is not set
802
803#
804# Watchdog Device Drivers
805#
806# CONFIG_SOFT_WATCHDOG is not set
807CONFIG_BFIN_WDT=y
808CONFIG_HW_RANDOM=y 808CONFIG_HW_RANDOM=y
809# CONFIG_GEN_RTC is not set 809# CONFIG_GEN_RTC is not set
810CONFIG_BLACKFIN_DPMC=y 810CONFIG_BLACKFIN_DPMC=y
@@ -868,12 +868,13 @@ CONFIG_SPI_MASTER=y
868# 868#
869# SPI Master Controller Drivers 869# SPI Master Controller Drivers
870# 870#
871CONFIG_SPI_BFIN=y
871# CONFIG_SPI_BITBANG is not set 872# CONFIG_SPI_BITBANG is not set
872 873
873# 874#
874# SPI Protocol Masters 875# SPI Protocol Masters
875# 876#
876CONFIG_SPI_BFIN=y 877# CONFIG_SPI_AT25 is not set
877 878
878# 879#
879# Dallas's 1-wire bus 880# Dallas's 1-wire bus
@@ -889,6 +890,7 @@ CONFIG_HWMON=y
889# CONFIG_SENSORS_ADM1021 is not set 890# CONFIG_SENSORS_ADM1021 is not set
890# CONFIG_SENSORS_ADM1025 is not set 891# CONFIG_SENSORS_ADM1025 is not set
891# CONFIG_SENSORS_ADM1026 is not set 892# CONFIG_SENSORS_ADM1026 is not set
893# CONFIG_SENSORS_ADM1029 is not set
892# CONFIG_SENSORS_ADM1031 is not set 894# CONFIG_SENSORS_ADM1031 is not set
893# CONFIG_SENSORS_ADM9240 is not set 895# CONFIG_SENSORS_ADM9240 is not set
894# CONFIG_SENSORS_ASB100 is not set 896# CONFIG_SENSORS_ASB100 is not set
@@ -928,6 +930,11 @@ CONFIG_HWMON=y
928# CONFIG_HWMON_DEBUG_CHIP is not set 930# CONFIG_HWMON_DEBUG_CHIP is not set
929 931
930# 932#
933# Multifunction device drivers
934#
935# CONFIG_MFD_SM501 is not set
936
937#
931# Multimedia devices 938# Multimedia devices
932# 939#
933# CONFIG_VIDEO_DEV is not set 940# CONFIG_VIDEO_DEV is not set
@@ -940,15 +947,24 @@ CONFIG_HWMON=y
940# 947#
941# Graphics support 948# Graphics support
942# 949#
943CONFIG_FIRMWARE_EDID=y 950CONFIG_BACKLIGHT_LCD_SUPPORT=y
951CONFIG_BACKLIGHT_CLASS_DEVICE=m
952CONFIG_LCD_CLASS_DEVICE=m
944CONFIG_FB=m 953CONFIG_FB=m
954CONFIG_FIRMWARE_EDID=y
955# CONFIG_FB_DDC is not set
945CONFIG_FB_CFB_FILLRECT=m 956CONFIG_FB_CFB_FILLRECT=m
946CONFIG_FB_CFB_COPYAREA=m 957CONFIG_FB_CFB_COPYAREA=m
947CONFIG_FB_CFB_IMAGEBLIT=m 958CONFIG_FB_CFB_IMAGEBLIT=m
959# CONFIG_FB_SVGALIB is not set
948# CONFIG_FB_MACMODES is not set 960# CONFIG_FB_MACMODES is not set
949# CONFIG_FB_BACKLIGHT is not set 961# CONFIG_FB_BACKLIGHT is not set
950# CONFIG_FB_MODE_HELPERS is not set 962# CONFIG_FB_MODE_HELPERS is not set
951# CONFIG_FB_TILEBLITTING is not set 963# CONFIG_FB_TILEBLITTING is not set
964
965#
966# Frame buffer hardware drivers
967#
952CONFIG_FB_BFIN_7171=m 968CONFIG_FB_BFIN_7171=m
953CONFIG_FB_BFIN_7393=m 969CONFIG_FB_BFIN_7393=m
954CONFIG_NTSC=y 970CONFIG_NTSC=y
@@ -970,11 +986,6 @@ CONFIG_LQ035_SLAVE_ADDR=0x58
970# Logo configuration 986# Logo configuration
971# 987#
972# CONFIG_LOGO is not set 988# CONFIG_LOGO is not set
973CONFIG_BACKLIGHT_LCD_SUPPORT=y
974CONFIG_BACKLIGHT_CLASS_DEVICE=m
975CONFIG_BACKLIGHT_DEVICE=y
976CONFIG_LCD_CLASS_DEVICE=m
977CONFIG_LCD_DEVICE=y
978 989
979# 990#
980# Sound 991# Sound
@@ -1007,6 +1018,18 @@ CONFIG_SND_VERBOSE_PROCFS=y
1007# CONFIG_SND_MPU401 is not set 1018# CONFIG_SND_MPU401 is not set
1008 1019
1009# 1020#
1021# ALSA Blackfin devices
1022#
1023# CONFIG_SND_BLACKFIN_AD1836 is not set
1024# CONFIG_SND_BLACKFIN_AD1981B is not set
1025# CONFIG_SND_BFIN_AD73311 is not set
1026
1027#
1028# SoC audio support
1029#
1030# CONFIG_SND_SOC is not set
1031
1032#
1010# Open Sound System 1033# Open Sound System
1011# 1034#
1012# CONFIG_SOUND_PRIME is not set 1035# CONFIG_SOUND_PRIME is not set
@@ -1015,6 +1038,7 @@ CONFIG_SND_VERBOSE_PROCFS=y
1015# HID Devices 1038# HID Devices
1016# 1039#
1017CONFIG_HID=y 1040CONFIG_HID=y
1041# CONFIG_HID_DEBUG is not set
1018 1042
1019# 1043#
1020# USB support 1044# USB support
@@ -1087,7 +1111,6 @@ CONFIG_RTC_INTF_DEV=y
1087# CONFIG_RTC_DRV_DS1672 is not set 1111# CONFIG_RTC_DRV_DS1672 is not set
1088# CONFIG_RTC_DRV_DS1742 is not set 1112# CONFIG_RTC_DRV_DS1742 is not set
1089# CONFIG_RTC_DRV_PCF8563 is not set 1113# CONFIG_RTC_DRV_PCF8563 is not set
1090# CONFIG_RTC_DRV_PCF8583 is not set
1091# CONFIG_RTC_DRV_RS5C348 is not set 1114# CONFIG_RTC_DRV_RS5C348 is not set
1092# CONFIG_RTC_DRV_RS5C372 is not set 1115# CONFIG_RTC_DRV_RS5C372 is not set
1093# CONFIG_RTC_DRV_M48T86 is not set 1116# CONFIG_RTC_DRV_M48T86 is not set
@@ -1110,6 +1133,10 @@ CONFIG_RTC_DRV_BFIN=y
1110# 1133#
1111 1134
1112# 1135#
1136# Auxiliary Display support
1137#
1138
1139#
1113# Virtualization 1140# Virtualization
1114# 1141#
1115 1142
@@ -1121,13 +1148,9 @@ CONFIG_RTC_DRV_BFIN=y
1121# 1148#
1122# File systems 1149# File systems
1123# 1150#
1124CONFIG_EXT2_FS=y 1151# CONFIG_EXT2_FS is not set
1125CONFIG_EXT2_FS_XATTR=y
1126# CONFIG_EXT2_FS_POSIX_ACL is not set
1127# CONFIG_EXT2_FS_SECURITY is not set
1128# CONFIG_EXT3_FS is not set 1152# CONFIG_EXT3_FS is not set
1129# CONFIG_EXT4DEV_FS is not set 1153# CONFIG_EXT4DEV_FS is not set
1130CONFIG_FS_MBCACHE=y
1131# CONFIG_REISERFS_FS is not set 1154# CONFIG_REISERFS_FS is not set
1132# CONFIG_JFS_FS is not set 1155# CONFIG_JFS_FS is not set
1133# CONFIG_FS_POSIX_ACL is not set 1156# CONFIG_FS_POSIX_ACL is not set
@@ -1139,7 +1162,7 @@ CONFIG_FS_MBCACHE=y
1139CONFIG_INOTIFY=y 1162CONFIG_INOTIFY=y
1140CONFIG_INOTIFY_USER=y 1163CONFIG_INOTIFY_USER=y
1141# CONFIG_QUOTA is not set 1164# CONFIG_QUOTA is not set
1142CONFIG_DNOTIFY=y 1165# CONFIG_DNOTIFY is not set
1143# CONFIG_AUTOFS_FS is not set 1166# CONFIG_AUTOFS_FS is not set
1144# CONFIG_AUTOFS4_FS is not set 1167# CONFIG_AUTOFS4_FS is not set
1145# CONFIG_FUSE_FS is not set 1168# CONFIG_FUSE_FS is not set
@@ -1311,7 +1334,7 @@ CONFIG_ACCESS_CHECK=y
1311# CONFIG_KEYS is not set 1334# CONFIG_KEYS is not set
1312CONFIG_SECURITY=y 1335CONFIG_SECURITY=y
1313# CONFIG_SECURITY_NETWORK is not set 1336# CONFIG_SECURITY_NETWORK is not set
1314CONFIG_SECURITY_CAPABILITIES=y 1337CONFIG_SECURITY_CAPABILITIES=m
1315 1338
1316# 1339#
1317# Cryptographic options 1340# Cryptographic options
@@ -1329,4 +1352,5 @@ CONFIG_CRC32=y
1329CONFIG_ZLIB_INFLATE=y 1352CONFIG_ZLIB_INFLATE=y
1330CONFIG_ZLIB_DEFLATE=m 1353CONFIG_ZLIB_DEFLATE=m
1331CONFIG_PLIST=y 1354CONFIG_PLIST=y
1332CONFIG_IOMAP_COPY=y 1355CONFIG_HAS_IOMEM=y
1356CONFIG_HAS_IOPORT=y
diff --git a/arch/blackfin/configs/BF561-EZKIT_defconfig b/arch/blackfin/configs/BF561-EZKIT_defconfig
index e32ca2072cbf..fe4e67debaca 100644
--- a/arch/blackfin/configs/BF561-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF561-EZKIT_defconfig
@@ -1,20 +1,21 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.19.3 3# Linux kernel version: 2.6.21.3
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
7CONFIG_RWSEM_GENERIC_SPINLOCK=y 7CONFIG_RWSEM_GENERIC_SPINLOCK=y
8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set 8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
9CONFIG_BLACKFIN=y 9CONFIG_BLACKFIN=y
10CONFIG_ZONE_DMA=y
10CONFIG_BFIN=y 11CONFIG_BFIN=y
11CONFIG_SEMAPHORE_SLEEPERS=y 12CONFIG_SEMAPHORE_SLEEPERS=y
12CONFIG_GENERIC_FIND_NEXT_BIT=y 13CONFIG_GENERIC_FIND_NEXT_BIT=y
13CONFIG_GENERIC_HWEIGHT=y 14CONFIG_GENERIC_HWEIGHT=y
14CONFIG_GENERIC_HARDIRQS=y 15CONFIG_GENERIC_HARDIRQS=y
15CONFIG_GENERIC_IRQ_PROBE=y 16CONFIG_GENERIC_IRQ_PROBE=y
17# CONFIG_GENERIC_TIME is not set
16CONFIG_GENERIC_CALIBRATE_DELAY=y 18CONFIG_GENERIC_CALIBRATE_DELAY=y
17CONFIG_UCLINUX=y
18CONFIG_FORCE_MAX_ZONEORDER=14 19CONFIG_FORCE_MAX_ZONEORDER=14
19CONFIG_IRQCHIP_DEMUX_GPIO=y 20CONFIG_IRQCHIP_DEMUX_GPIO=y
20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 21CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
@@ -33,18 +34,21 @@ CONFIG_LOCALVERSION=""
33CONFIG_LOCALVERSION_AUTO=y 34CONFIG_LOCALVERSION_AUTO=y
34CONFIG_SYSVIPC=y 35CONFIG_SYSVIPC=y
35# CONFIG_IPC_NS is not set 36# CONFIG_IPC_NS is not set
37CONFIG_SYSVIPC_SYSCTL=y
36# CONFIG_POSIX_MQUEUE is not set 38# CONFIG_POSIX_MQUEUE is not set
37# CONFIG_BSD_PROCESS_ACCT is not set 39# CONFIG_BSD_PROCESS_ACCT is not set
38# CONFIG_TASKSTATS is not set 40# CONFIG_TASKSTATS is not set
39# CONFIG_UTS_NS is not set 41# CONFIG_UTS_NS is not set
40# CONFIG_AUDIT is not set 42# CONFIG_AUDIT is not set
41# CONFIG_IKCONFIG is not set 43# CONFIG_IKCONFIG is not set
44CONFIG_SYSFS_DEPRECATED=y
42# CONFIG_RELAY is not set 45# CONFIG_RELAY is not set
46CONFIG_BLK_DEV_INITRD=y
43CONFIG_INITRAMFS_SOURCE="" 47CONFIG_INITRAMFS_SOURCE=""
44# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 48# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
45CONFIG_SYSCTL=y 49CONFIG_SYSCTL=y
46CONFIG_EMBEDDED=y 50CONFIG_EMBEDDED=y
47# CONFIG_UID16 is not set 51CONFIG_UID16=y
48CONFIG_SYSCTL_SYSCALL=y 52CONFIG_SYSCTL_SYSCALL=y
49CONFIG_KALLSYMS=y 53CONFIG_KALLSYMS=y
50# CONFIG_KALLSYMS_EXTRA_PASS is not set 54# CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -54,9 +58,7 @@ CONFIG_BUG=y
54CONFIG_ELF_CORE=y 58CONFIG_ELF_CORE=y
55CONFIG_BASE_FULL=y 59CONFIG_BASE_FULL=y
56CONFIG_FUTEX=y 60CONFIG_FUTEX=y
57CONFIG_EPOLL=y
58CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3 61CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3
59# CONFIG_LIMIT_PAGECACHE is not set
60CONFIG_BUDDY=y 62CONFIG_BUDDY=y
61# CONFIG_NP2 is not set 63# CONFIG_NP2 is not set
62CONFIG_SLAB=y 64CONFIG_SLAB=y
@@ -80,7 +82,9 @@ CONFIG_KMOD=y
80# Block layer 82# Block layer
81# 83#
82CONFIG_BLOCK=y 84CONFIG_BLOCK=y
85# CONFIG_LBD is not set
83# CONFIG_BLK_DEV_IO_TRACE is not set 86# CONFIG_BLK_DEV_IO_TRACE is not set
87# CONFIG_LSF is not set
84 88
85# 89#
86# IO Schedulers 90# IO Schedulers
@@ -109,7 +113,6 @@ CONFIG_PREEMPT_VOLUNTARY=y
109# CONFIG_BF532 is not set 113# CONFIG_BF532 is not set
110# CONFIG_BF533 is not set 114# CONFIG_BF533 is not set
111# CONFIG_BF534 is not set 115# CONFIG_BF534 is not set
112# CONFIG_BF535 is not set
113# CONFIG_BF536 is not set 116# CONFIG_BF536 is not set
114# CONFIG_BF537 is not set 117# CONFIG_BF537 is not set
115CONFIG_BF561=y 118CONFIG_BF561=y
@@ -125,6 +128,7 @@ CONFIG_BFIN_DUAL_CORE=y
125# CONFIG_BFIN537_BLUETECHNIX_CM is not set 128# CONFIG_BFIN537_BLUETECHNIX_CM is not set
126# CONFIG_BFIN561_BLUETECHNIX_CM is not set 129# CONFIG_BFIN561_BLUETECHNIX_CM is not set
127CONFIG_BFIN561_EZKIT=y 130CONFIG_BFIN561_EZKIT=y
131# CONFIG_BFIN561_TEPLA is not set
128# CONFIG_PNAV10 is not set 132# CONFIG_PNAV10 is not set
129# CONFIG_GENERIC_BOARD is not set 133# CONFIG_GENERIC_BOARD is not set
130CONFIG_MEM_MT48LC16M16A2TG_75=y 134CONFIG_MEM_MT48LC16M16A2TG_75=y
@@ -214,6 +218,7 @@ CONFIG_IRQ_WDTIMER=13
214# 218#
215# Board customizations 219# Board customizations
216# 220#
221# CONFIG_CMDLINE_BOOL is not set
217 222
218# 223#
219# Board Setup 224# Board Setup
@@ -224,19 +229,6 @@ CONFIG_MEM_ADD_WIDTH=9
224CONFIG_BOOT_LOAD=0x1000 229CONFIG_BOOT_LOAD=0x1000
225 230
226# 231#
227# Console UART Setup
228#
229# CONFIG_BAUD_9600 is not set
230# CONFIG_BAUD_19200 is not set
231# CONFIG_BAUD_38400 is not set
232CONFIG_BAUD_57600=y
233# CONFIG_BAUD_115200 is not set
234CONFIG_BAUD_NO_PARITY=y
235# CONFIG_BAUD_PARITY is not set
236CONFIG_BAUD_1_STOPBIT=y
237# CONFIG_BAUD_2_STOPBIT is not set
238
239#
240# Blackfin Kernel Optimizations 232# Blackfin Kernel Optimizations
241# 233#
242 234
@@ -245,6 +237,7 @@ CONFIG_BAUD_1_STOPBIT=y
245# 237#
246# CONFIG_HZ_100 is not set 238# CONFIG_HZ_100 is not set
247CONFIG_HZ_250=y 239CONFIG_HZ_250=y
240# CONFIG_HZ_300 is not set
248# CONFIG_HZ_1000 is not set 241# CONFIG_HZ_1000 is not set
249CONFIG_HZ=250 242CONFIG_HZ=250
250 243
@@ -263,6 +256,7 @@ CONFIG_MEMSET_L1=y
263CONFIG_MEMCPY_L1=y 256CONFIG_MEMCPY_L1=y
264CONFIG_SYS_BFIN_SPINLOCK_L1=y 257CONFIG_SYS_BFIN_SPINLOCK_L1=y
265# CONFIG_IP_CHECKSUM_L1 is not set 258# CONFIG_IP_CHECKSUM_L1 is not set
259CONFIG_CACHELINE_ALIGNED_L1=y
266# CONFIG_SYSCALL_TAB_L1 is not set 260# CONFIG_SYSCALL_TAB_L1 is not set
267# CONFIG_CPLB_SWITCH_TAB_L1 is not set 261# CONFIG_CPLB_SWITCH_TAB_L1 is not set
268CONFIG_RAMKERNEL=y 262CONFIG_RAMKERNEL=y
@@ -276,6 +270,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y
276# CONFIG_SPARSEMEM_STATIC is not set 270# CONFIG_SPARSEMEM_STATIC is not set
277CONFIG_SPLIT_PTLOCK_CPUS=4 271CONFIG_SPLIT_PTLOCK_CPUS=4
278# CONFIG_RESOURCES_64BIT is not set 272# CONFIG_RESOURCES_64BIT is not set
273CONFIG_ZONE_DMA_FLAG=1
279CONFIG_LARGE_ALLOCS=y 274CONFIG_LARGE_ALLOCS=y
280CONFIG_BFIN_DMA_5XX=y 275CONFIG_BFIN_DMA_5XX=y
281# CONFIG_DMA_UNCACHED_2M is not set 276# CONFIG_DMA_UNCACHED_2M is not set
@@ -368,6 +363,7 @@ CONFIG_UNIX=y
368CONFIG_XFRM=y 363CONFIG_XFRM=y
369# CONFIG_XFRM_USER is not set 364# CONFIG_XFRM_USER is not set
370# CONFIG_XFRM_SUB_POLICY is not set 365# CONFIG_XFRM_SUB_POLICY is not set
366# CONFIG_XFRM_MIGRATE is not set
371# CONFIG_NET_KEY is not set 367# CONFIG_NET_KEY is not set
372CONFIG_INET=y 368CONFIG_INET=y
373# CONFIG_IP_MULTICAST is not set 369# CONFIG_IP_MULTICAST is not set
@@ -394,6 +390,7 @@ CONFIG_INET_TCP_DIAG=y
394# CONFIG_TCP_CONG_ADVANCED is not set 390# CONFIG_TCP_CONG_ADVANCED is not set
395CONFIG_TCP_CONG_CUBIC=y 391CONFIG_TCP_CONG_CUBIC=y
396CONFIG_DEFAULT_TCP_CONG="cubic" 392CONFIG_DEFAULT_TCP_CONG="cubic"
393# CONFIG_TCP_MD5SIG is not set
397# CONFIG_IPV6 is not set 394# CONFIG_IPV6 is not set
398# CONFIG_INET6_XFRM_TUNNEL is not set 395# CONFIG_INET6_XFRM_TUNNEL is not set
399# CONFIG_INET6_TUNNEL is not set 396# CONFIG_INET6_TUNNEL is not set
@@ -437,7 +434,48 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
437# 434#
438# CONFIG_NET_PKTGEN is not set 435# CONFIG_NET_PKTGEN is not set
439# CONFIG_HAMRADIO is not set 436# CONFIG_HAMRADIO is not set
440# CONFIG_IRDA is not set 437CONFIG_IRDA=m
438
439#
440# IrDA protocols
441#
442CONFIG_IRLAN=m
443CONFIG_IRCOMM=m
444# CONFIG_IRDA_ULTRA is not set
445
446#
447# IrDA options
448#
449CONFIG_IRDA_CACHE_LAST_LSAP=y
450# CONFIG_IRDA_FAST_RR is not set
451# CONFIG_IRDA_DEBUG is not set
452
453#
454# Infrared-port device drivers
455#
456
457#
458# SIR device drivers
459#
460CONFIG_IRTTY_SIR=m
461
462#
463# Dongle support
464#
465# CONFIG_DONGLE is not set
466
467#
468# Old SIR device drivers
469#
470# CONFIG_IRPORT_SIR is not set
471
472#
473# Old Serial dongle support
474#
475
476#
477# FIR device drivers
478#
441# CONFIG_BT is not set 479# CONFIG_BT is not set
442# CONFIG_IEEE80211 is not set 480# CONFIG_IEEE80211 is not set
443 481
@@ -472,6 +510,7 @@ CONFIG_MTD_PARTITIONS=y
472# User Modules And Translation Layers 510# User Modules And Translation Layers
473# 511#
474CONFIG_MTD_CHAR=m 512CONFIG_MTD_CHAR=m
513CONFIG_MTD_BLKDEVS=y
475CONFIG_MTD_BLOCK=y 514CONFIG_MTD_BLOCK=y
476# CONFIG_FTL is not set 515# CONFIG_FTL is not set
477# CONFIG_NFTL is not set 516# CONFIG_NFTL is not set
@@ -528,6 +567,8 @@ CONFIG_BFIN_FLASH_BANK_3=0x7BB0
528# 567#
529# Self-contained MTD device drivers 568# Self-contained MTD device drivers
530# 569#
570# CONFIG_MTD_DATAFLASH is not set
571# CONFIG_MTD_M25P80 is not set
531# CONFIG_MTD_SLRAM is not set 572# CONFIG_MTD_SLRAM is not set
532# CONFIG_MTD_PHRAM is not set 573# CONFIG_MTD_PHRAM is not set
533# CONFIG_MTD_MTDRAM is not set 574# CONFIG_MTD_MTDRAM is not set
@@ -558,6 +599,7 @@ CONFIG_BFIN_FLASH_BANK_3=0x7BB0
558# 599#
559# Plug and Play support 600# Plug and Play support
560# 601#
602# CONFIG_PNPACPI is not set
561 603
562# 604#
563# Block devices 605# Block devices
@@ -569,14 +611,12 @@ CONFIG_BLK_DEV_RAM=y
569CONFIG_BLK_DEV_RAM_COUNT=16 611CONFIG_BLK_DEV_RAM_COUNT=16
570CONFIG_BLK_DEV_RAM_SIZE=4096 612CONFIG_BLK_DEV_RAM_SIZE=4096
571CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 613CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
572# CONFIG_BLK_DEV_INITRD is not set
573# CONFIG_CDROM_PKTCDVD is not set 614# CONFIG_CDROM_PKTCDVD is not set
574# CONFIG_ATA_OVER_ETH is not set 615# CONFIG_ATA_OVER_ETH is not set
575 616
576# 617#
577# Misc devices 618# Misc devices
578# 619#
579# CONFIG_TIFM_CORE is not set
580 620
581# 621#
582# ATA/ATAPI/MFM/RLL support 622# ATA/ATAPI/MFM/RLL support
@@ -675,7 +715,26 @@ CONFIG_SMC91X=y
675# 715#
676# Input device support 716# Input device support
677# 717#
678# CONFIG_INPUT is not set 718CONFIG_INPUT=m
719# CONFIG_INPUT_FF_MEMLESS is not set
720
721#
722# Userland interfaces
723#
724# CONFIG_INPUT_MOUSEDEV is not set
725# CONFIG_INPUT_JOYDEV is not set
726# CONFIG_INPUT_TSDEV is not set
727CONFIG_INPUT_EVDEV=m
728# CONFIG_INPUT_EVBUG is not set
729
730#
731# Input Device Drivers
732#
733# CONFIG_INPUT_KEYBOARD is not set
734# CONFIG_INPUT_MOUSE is not set
735# CONFIG_INPUT_JOYSTICK is not set
736# CONFIG_INPUT_TOUCHSCREEN is not set
737# CONFIG_INPUT_MISC is not set
679 738
680# 739#
681# Hardware I/O ports 740# Hardware I/O ports
@@ -688,12 +747,14 @@ CONFIG_SMC91X=y
688# 747#
689# CONFIG_AD9960 is not set 748# CONFIG_AD9960 is not set
690# CONFIG_SPI_ADC_BF533 is not set 749# CONFIG_SPI_ADC_BF533 is not set
691# CONFIG_BF533_PFLAGS is not set 750# CONFIG_BF5xx_PFLAGS is not set
692# CONFIG_BF5xx_PPIFCD is not set 751# CONFIG_BF5xx_PPIFCD is not set
693# CONFIG_BF5xx_TIMERS is not set 752# CONFIG_BF5xx_TIMERS is not set
694# CONFIG_BF5xx_PPI is not set 753# CONFIG_BF5xx_PPI is not set
695# CONFIG_BFIN_SPORT is not set 754# CONFIG_BFIN_SPORT is not set
696# CONFIG_BFIN_TIMER_LATENCY is not set 755# CONFIG_BFIN_TIMER_LATENCY is not set
756# CONFIG_AD5304 is not set
757# CONFIG_BF5xx_FBDMA is not set
697# CONFIG_VT is not set 758# CONFIG_VT is not set
698# CONFIG_SERIAL_NONSTANDARD is not set 759# CONFIG_SERIAL_NONSTANDARD is not set
699 760
@@ -730,16 +791,19 @@ CONFIG_UNIX98_PTYS=y
730# 791#
731# Watchdog Cards 792# Watchdog Cards
732# 793#
733# CONFIG_WATCHDOG is not set 794CONFIG_WATCHDOG=y
795# CONFIG_WATCHDOG_NOWAYOUT is not set
796
797#
798# Watchdog Device Drivers
799#
800# CONFIG_SOFT_WATCHDOG is not set
801CONFIG_BFIN_WDT=y
734CONFIG_HW_RANDOM=y 802CONFIG_HW_RANDOM=y
735# CONFIG_GEN_RTC is not set 803# CONFIG_GEN_RTC is not set
736# CONFIG_BLACKFIN_DPMC is not set 804# CONFIG_BLACKFIN_DPMC is not set
737# CONFIG_DTLK is not set 805# CONFIG_DTLK is not set
738# CONFIG_R3964 is not set 806# CONFIG_R3964 is not set
739
740#
741# Ftape, the floppy tape device driver
742#
743# CONFIG_RAW_DRIVER is not set 807# CONFIG_RAW_DRIVER is not set
744 808
745# 809#
@@ -755,8 +819,19 @@ CONFIG_HW_RANDOM=y
755# 819#
756# SPI support 820# SPI support
757# 821#
758# CONFIG_SPI is not set 822CONFIG_SPI=y
759# CONFIG_SPI_MASTER is not set 823CONFIG_SPI_MASTER=y
824
825#
826# SPI Master Controller Drivers
827#
828CONFIG_SPI_BFIN=y
829# CONFIG_SPI_BITBANG is not set
830
831#
832# SPI Protocol Masters
833#
834# CONFIG_SPI_AT25 is not set
760 835
761# 836#
762# Dallas's 1-wire bus 837# Dallas's 1-wire bus
@@ -770,10 +845,17 @@ CONFIG_HWMON=y
770# CONFIG_HWMON_VID is not set 845# CONFIG_HWMON_VID is not set
771# CONFIG_SENSORS_ABITUGURU is not set 846# CONFIG_SENSORS_ABITUGURU is not set
772# CONFIG_SENSORS_F71805F is not set 847# CONFIG_SENSORS_F71805F is not set
848# CONFIG_SENSORS_LM70 is not set
849# CONFIG_SENSORS_PC87427 is not set
773# CONFIG_SENSORS_VT1211 is not set 850# CONFIG_SENSORS_VT1211 is not set
774# CONFIG_HWMON_DEBUG_CHIP is not set 851# CONFIG_HWMON_DEBUG_CHIP is not set
775 852
776# 853#
854# Multifunction device drivers
855#
856# CONFIG_MFD_SM501 is not set
857
858#
777# Multimedia devices 859# Multimedia devices
778# 860#
779# CONFIG_VIDEO_DEV is not set 861# CONFIG_VIDEO_DEV is not set
@@ -786,9 +868,8 @@ CONFIG_HWMON=y
786# 868#
787# Graphics support 869# Graphics support
788# 870#
789CONFIG_FIRMWARE_EDID=y
790# CONFIG_FB is not set
791# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 871# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
872# CONFIG_FB is not set
792 873
793# 874#
794# Sound 875# Sound
@@ -796,6 +877,12 @@ CONFIG_FIRMWARE_EDID=y
796# CONFIG_SOUND is not set 877# CONFIG_SOUND is not set
797 878
798# 879#
880# HID Devices
881#
882CONFIG_HID=m
883# CONFIG_HID_DEBUG is not set
884
885#
799# USB support 886# USB support
800# 887#
801CONFIG_USB_ARCH_HAS_HCD=y 888CONFIG_USB_ARCH_HAS_HCD=y
@@ -815,6 +902,7 @@ CONFIG_USB_ARCH_HAS_HCD=y
815# 902#
816# MMC/SD Card support 903# MMC/SD Card support
817# 904#
905# CONFIG_SPI_MMC is not set
818# CONFIG_MMC is not set 906# CONFIG_MMC is not set
819 907
820# 908#
@@ -857,6 +945,14 @@ CONFIG_USB_ARCH_HAS_HCD=y
857# 945#
858 946
859# 947#
948# Auxiliary Display support
949#
950
951#
952# Virtualization
953#
954
955#
860# PBX support 956# PBX support
861# 957#
862# CONFIG_PBX is not set 958# CONFIG_PBX is not set
@@ -864,13 +960,9 @@ CONFIG_USB_ARCH_HAS_HCD=y
864# 960#
865# File systems 961# File systems
866# 962#
867CONFIG_EXT2_FS=y 963# CONFIG_EXT2_FS is not set
868CONFIG_EXT2_FS_XATTR=y
869# CONFIG_EXT2_FS_POSIX_ACL is not set
870# CONFIG_EXT2_FS_SECURITY is not set
871# CONFIG_EXT3_FS is not set 964# CONFIG_EXT3_FS is not set
872# CONFIG_EXT4DEV_FS is not set 965# CONFIG_EXT4DEV_FS is not set
873CONFIG_FS_MBCACHE=y
874# CONFIG_REISERFS_FS is not set 966# CONFIG_REISERFS_FS is not set
875# CONFIG_JFS_FS is not set 967# CONFIG_JFS_FS is not set
876# CONFIG_FS_POSIX_ACL is not set 968# CONFIG_FS_POSIX_ACL is not set
@@ -882,7 +974,7 @@ CONFIG_FS_MBCACHE=y
882CONFIG_INOTIFY=y 974CONFIG_INOTIFY=y
883CONFIG_INOTIFY_USER=y 975CONFIG_INOTIFY_USER=y
884# CONFIG_QUOTA is not set 976# CONFIG_QUOTA is not set
885CONFIG_DNOTIFY=y 977# CONFIG_DNOTIFY is not set
886# CONFIG_AUTOFS_FS is not set 978# CONFIG_AUTOFS_FS is not set
887# CONFIG_AUTOFS4_FS is not set 979# CONFIG_AUTOFS4_FS is not set
888# CONFIG_FUSE_FS is not set 980# CONFIG_FUSE_FS is not set
@@ -931,7 +1023,6 @@ CONFIG_YAFFS_CHECKPOINT_RESERVED_BLOCKS=10
931# CONFIG_YAFFS_DISABLE_WIDE_TNODES is not set 1023# CONFIG_YAFFS_DISABLE_WIDE_TNODES is not set
932# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set 1024# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set
933CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y 1025CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y
934# CONFIG_JFFS_FS is not set
935CONFIG_JFFS2_FS=m 1026CONFIG_JFFS2_FS=m
936CONFIG_JFFS2_FS_DEBUG=0 1027CONFIG_JFFS2_FS_DEBUG=0
937CONFIG_JFFS2_FS_WRITEBUFFER=y 1028CONFIG_JFFS2_FS_WRITEBUFFER=y
@@ -1022,6 +1113,11 @@ CONFIG_NLS_DEFAULT="iso8859-1"
1022# CONFIG_NLS_UTF8 is not set 1113# CONFIG_NLS_UTF8 is not set
1023 1114
1024# 1115#
1116# Distributed Lock Manager
1117#
1118# CONFIG_DLM is not set
1119
1120#
1025# Profiling support 1121# Profiling support
1026# 1122#
1027# CONFIG_PROFILING is not set 1123# CONFIG_PROFILING is not set
@@ -1033,20 +1129,17 @@ CONFIG_NLS_DEFAULT="iso8859-1"
1033CONFIG_ENABLE_MUST_CHECK=y 1129CONFIG_ENABLE_MUST_CHECK=y
1034# CONFIG_MAGIC_SYSRQ is not set 1130# CONFIG_MAGIC_SYSRQ is not set
1035# CONFIG_UNUSED_SYMBOLS is not set 1131# CONFIG_UNUSED_SYMBOLS is not set
1132# CONFIG_DEBUG_FS is not set
1133# CONFIG_HEADERS_CHECK is not set
1036# CONFIG_DEBUG_KERNEL is not set 1134# CONFIG_DEBUG_KERNEL is not set
1037CONFIG_LOG_BUF_SHIFT=14 1135CONFIG_LOG_BUF_SHIFT=14
1038# CONFIG_DEBUG_BUGVERBOSE is not set 1136# CONFIG_DEBUG_BUGVERBOSE is not set
1039# CONFIG_DEBUG_FS is not set
1040# CONFIG_UNWIND_INFO is not set
1041# CONFIG_HEADERS_CHECK is not set
1042# CONFIG_DEBUG_SERIAL_EARLY_INIT is not set 1137# CONFIG_DEBUG_SERIAL_EARLY_INIT is not set
1043CONFIG_DEBUG_HUNT_FOR_ZERO=y 1138CONFIG_DEBUG_HUNT_FOR_ZERO=y
1044# CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE is not set 1139# CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE is not set
1045# CONFIG_DUAL_CORE_TEST_MODULE is not set 1140# CONFIG_DUAL_CORE_TEST_MODULE is not set
1046# CONFIG_BOOTPARAM is not set
1047# CONFIG_NO_KERNEL_MSG is not set
1048CONFIG_CPLB_INFO=y 1141CONFIG_CPLB_INFO=y
1049# CONFIG_NO_ACCESS_CHECK is not set 1142CONFIG_ACCESS_CHECK=y
1050 1143
1051# 1144#
1052# Security options 1145# Security options
@@ -1054,7 +1147,7 @@ CONFIG_CPLB_INFO=y
1054# CONFIG_KEYS is not set 1147# CONFIG_KEYS is not set
1055CONFIG_SECURITY=y 1148CONFIG_SECURITY=y
1056# CONFIG_SECURITY_NETWORK is not set 1149# CONFIG_SECURITY_NETWORK is not set
1057CONFIG_SECURITY_CAPABILITIES=y 1150CONFIG_SECURITY_CAPABILITIES=m
1058 1151
1059# 1152#
1060# Cryptographic options 1153# Cryptographic options
@@ -1064,10 +1157,13 @@ CONFIG_SECURITY_CAPABILITIES=y
1064# 1157#
1065# Library routines 1158# Library routines
1066# 1159#
1067# CONFIG_CRC_CCITT is not set 1160CONFIG_BITREVERSE=y
1161CONFIG_CRC_CCITT=m
1068# CONFIG_CRC16 is not set 1162# CONFIG_CRC16 is not set
1069CONFIG_CRC32=y 1163CONFIG_CRC32=y
1070# CONFIG_LIBCRC32C is not set 1164# CONFIG_LIBCRC32C is not set
1071CONFIG_ZLIB_INFLATE=y 1165CONFIG_ZLIB_INFLATE=y
1072CONFIG_ZLIB_DEFLATE=m 1166CONFIG_ZLIB_DEFLATE=m
1073CONFIG_PLIST=y 1167CONFIG_PLIST=y
1168CONFIG_HAS_IOMEM=y
1169CONFIG_HAS_IOPORT=y
diff --git a/arch/blackfin/configs/PNAV-10_defconfig b/arch/blackfin/configs/PNAV-10_defconfig
index 97b4ffa2b4ac..a783ff69ace1 100644
--- a/arch/blackfin/configs/PNAV-10_defconfig
+++ b/arch/blackfin/configs/PNAV-10_defconfig
@@ -1,20 +1,21 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.19.3 3# Linux kernel version: 2.6.21.3
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
7CONFIG_RWSEM_GENERIC_SPINLOCK=y 7CONFIG_RWSEM_GENERIC_SPINLOCK=y
8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set 8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
9CONFIG_BLACKFIN=y 9CONFIG_BLACKFIN=y
10CONFIG_ZONE_DMA=y
10CONFIG_BFIN=y 11CONFIG_BFIN=y
11CONFIG_SEMAPHORE_SLEEPERS=y 12CONFIG_SEMAPHORE_SLEEPERS=y
12CONFIG_GENERIC_FIND_NEXT_BIT=y 13CONFIG_GENERIC_FIND_NEXT_BIT=y
13CONFIG_GENERIC_HWEIGHT=y 14CONFIG_GENERIC_HWEIGHT=y
14CONFIG_GENERIC_HARDIRQS=y 15CONFIG_GENERIC_HARDIRQS=y
15CONFIG_GENERIC_IRQ_PROBE=y 16CONFIG_GENERIC_IRQ_PROBE=y
17# CONFIG_GENERIC_TIME is not set
16CONFIG_GENERIC_CALIBRATE_DELAY=y 18CONFIG_GENERIC_CALIBRATE_DELAY=y
17CONFIG_UCLINUX=y
18CONFIG_FORCE_MAX_ZONEORDER=14 19CONFIG_FORCE_MAX_ZONEORDER=14
19CONFIG_IRQCHIP_DEMUX_GPIO=y 20CONFIG_IRQCHIP_DEMUX_GPIO=y
20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 21CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
@@ -33,14 +34,16 @@ CONFIG_LOCALVERSION=""
33CONFIG_LOCALVERSION_AUTO=y 34CONFIG_LOCALVERSION_AUTO=y
34CONFIG_SYSVIPC=y 35CONFIG_SYSVIPC=y
35# CONFIG_IPC_NS is not set 36# CONFIG_IPC_NS is not set
37CONFIG_SYSVIPC_SYSCTL=y
36# CONFIG_POSIX_MQUEUE is not set 38# CONFIG_POSIX_MQUEUE is not set
37# CONFIG_BSD_PROCESS_ACCT is not set 39# CONFIG_BSD_PROCESS_ACCT is not set
38# CONFIG_TASKSTATS is not set 40# CONFIG_TASKSTATS is not set
39# CONFIG_UTS_NS is not set 41# CONFIG_UTS_NS is not set
40# CONFIG_AUDIT is not set 42# CONFIG_AUDIT is not set
41# CONFIG_IKCONFIG is not set 43# CONFIG_IKCONFIG is not set
44CONFIG_SYSFS_DEPRECATED=y
42# CONFIG_RELAY is not set 45# CONFIG_RELAY is not set
43CONFIG_INITRAMFS_SOURCE="" 46# CONFIG_BLK_DEV_INITRD is not set
44# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 47# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
45CONFIG_SYSCTL=y 48CONFIG_SYSCTL=y
46CONFIG_EMBEDDED=y 49CONFIG_EMBEDDED=y
@@ -54,9 +57,7 @@ CONFIG_BUG=y
54CONFIG_ELF_CORE=y 57CONFIG_ELF_CORE=y
55CONFIG_BASE_FULL=y 58CONFIG_BASE_FULL=y
56CONFIG_FUTEX=y 59CONFIG_FUTEX=y
57CONFIG_EPOLL=y
58CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=9 60CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=9
59# CONFIG_LIMIT_PAGECACHE is not set
60CONFIG_BUDDY=y 61CONFIG_BUDDY=y
61# CONFIG_NP2 is not set 62# CONFIG_NP2 is not set
62CONFIG_SLAB=y 63CONFIG_SLAB=y
@@ -80,7 +81,9 @@ CONFIG_KMOD=y
80# Block layer 81# Block layer
81# 82#
82CONFIG_BLOCK=y 83CONFIG_BLOCK=y
84# CONFIG_LBD is not set
83# CONFIG_BLK_DEV_IO_TRACE is not set 85# CONFIG_BLK_DEV_IO_TRACE is not set
86# CONFIG_LSF is not set
84 87
85# 88#
86# IO Schedulers 89# IO Schedulers
@@ -109,7 +112,6 @@ CONFIG_PREEMPT_VOLUNTARY=y
109# CONFIG_BF532 is not set 112# CONFIG_BF532 is not set
110# CONFIG_BF533 is not set 113# CONFIG_BF533 is not set
111# CONFIG_BF534 is not set 114# CONFIG_BF534 is not set
112# CONFIG_BF535 is not set
113# CONFIG_BF536 is not set 115# CONFIG_BF536 is not set
114CONFIG_BF537=y 116CONFIG_BF537=y
115# CONFIG_BF561 is not set 117# CONFIG_BF561 is not set
@@ -125,6 +127,7 @@ CONFIG_BFIN_SINGLE_CORE=y
125# CONFIG_BFIN537_BLUETECHNIX_CM is not set 127# CONFIG_BFIN537_BLUETECHNIX_CM is not set
126# CONFIG_BFIN561_BLUETECHNIX_CM is not set 128# CONFIG_BFIN561_BLUETECHNIX_CM is not set
127# CONFIG_BFIN561_EZKIT is not set 129# CONFIG_BFIN561_EZKIT is not set
130# CONFIG_BFIN561_TEPLA is not set
128CONFIG_PNAV10=y 131CONFIG_PNAV10=y
129# CONFIG_GENERIC_BOARD is not set 132# CONFIG_GENERIC_BOARD is not set
130CONFIG_MEM_MT48LC32M8A2_75=y 133CONFIG_MEM_MT48LC32M8A2_75=y
@@ -183,6 +186,7 @@ CONFIG_IRQ_WATCH=13
183# 186#
184# Board customizations 187# Board customizations
185# 188#
189# CONFIG_CMDLINE_BOOL is not set
186 190
187# 191#
188# Board Setup 192# Board Setup
@@ -193,19 +197,6 @@ CONFIG_MEM_ADD_WIDTH=10
193CONFIG_BOOT_LOAD=0x1000 197CONFIG_BOOT_LOAD=0x1000
194 198
195# 199#
196# Console UART Setup
197#
198# CONFIG_BAUD_9600 is not set
199# CONFIG_BAUD_19200 is not set
200# CONFIG_BAUD_38400 is not set
201# CONFIG_BAUD_57600 is not set
202CONFIG_BAUD_115200=y
203CONFIG_BAUD_NO_PARITY=y
204# CONFIG_BAUD_PARITY is not set
205CONFIG_BAUD_1_STOPBIT=y
206# CONFIG_BAUD_2_STOPBIT is not set
207
208#
209# Blackfin Kernel Optimizations 200# Blackfin Kernel Optimizations
210# 201#
211 202
@@ -214,6 +205,7 @@ CONFIG_BAUD_1_STOPBIT=y
214# 205#
215# CONFIG_HZ_100 is not set 206# CONFIG_HZ_100 is not set
216CONFIG_HZ_250=y 207CONFIG_HZ_250=y
208# CONFIG_HZ_300 is not set
217# CONFIG_HZ_1000 is not set 209# CONFIG_HZ_1000 is not set
218CONFIG_HZ=250 210CONFIG_HZ=250
219 211
@@ -232,6 +224,7 @@ CONFIG_MEMSET_L1=y
232CONFIG_MEMCPY_L1=y 224CONFIG_MEMCPY_L1=y
233CONFIG_SYS_BFIN_SPINLOCK_L1=y 225CONFIG_SYS_BFIN_SPINLOCK_L1=y
234CONFIG_IP_CHECKSUM_L1=y 226CONFIG_IP_CHECKSUM_L1=y
227CONFIG_CACHELINE_ALIGNED_L1=y
235CONFIG_SYSCALL_TAB_L1=y 228CONFIG_SYSCALL_TAB_L1=y
236CONFIG_CPLB_SWITCH_TAB_L1=y 229CONFIG_CPLB_SWITCH_TAB_L1=y
237CONFIG_RAMKERNEL=y 230CONFIG_RAMKERNEL=y
@@ -245,6 +238,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y
245# CONFIG_SPARSEMEM_STATIC is not set 238# CONFIG_SPARSEMEM_STATIC is not set
246CONFIG_SPLIT_PTLOCK_CPUS=4 239CONFIG_SPLIT_PTLOCK_CPUS=4
247# CONFIG_RESOURCES_64BIT is not set 240# CONFIG_RESOURCES_64BIT is not set
241CONFIG_ZONE_DMA_FLAG=1
248CONFIG_LARGE_ALLOCS=y 242CONFIG_LARGE_ALLOCS=y
249CONFIG_BFIN_DMA_5XX=y 243CONFIG_BFIN_DMA_5XX=y
250# CONFIG_DMA_UNCACHED_2M is not set 244# CONFIG_DMA_UNCACHED_2M is not set
@@ -338,6 +332,7 @@ CONFIG_UNIX=y
338CONFIG_XFRM=y 332CONFIG_XFRM=y
339# CONFIG_XFRM_USER is not set 333# CONFIG_XFRM_USER is not set
340# CONFIG_XFRM_SUB_POLICY is not set 334# CONFIG_XFRM_SUB_POLICY is not set
335# CONFIG_XFRM_MIGRATE is not set
341# CONFIG_NET_KEY is not set 336# CONFIG_NET_KEY is not set
342CONFIG_INET=y 337CONFIG_INET=y
343# CONFIG_IP_MULTICAST is not set 338# CONFIG_IP_MULTICAST is not set
@@ -364,6 +359,7 @@ CONFIG_INET_TCP_DIAG=y
364# CONFIG_TCP_CONG_ADVANCED is not set 359# CONFIG_TCP_CONG_ADVANCED is not set
365CONFIG_TCP_CONG_CUBIC=y 360CONFIG_TCP_CONG_CUBIC=y
366CONFIG_DEFAULT_TCP_CONG="cubic" 361CONFIG_DEFAULT_TCP_CONG="cubic"
362# CONFIG_TCP_MD5SIG is not set
367# CONFIG_IPV6 is not set 363# CONFIG_IPV6 is not set
368# CONFIG_INET6_XFRM_TUNNEL is not set 364# CONFIG_INET6_XFRM_TUNNEL is not set
369# CONFIG_INET6_TUNNEL is not set 365# CONFIG_INET6_TUNNEL is not set
@@ -442,6 +438,7 @@ CONFIG_MTD_PARTITIONS=y
442# User Modules And Translation Layers 438# User Modules And Translation Layers
443# 439#
444CONFIG_MTD_CHAR=m 440CONFIG_MTD_CHAR=m
441CONFIG_MTD_BLKDEVS=y
445CONFIG_MTD_BLOCK=y 442CONFIG_MTD_BLOCK=y
446# CONFIG_FTL is not set 443# CONFIG_FTL is not set
447# CONFIG_NFTL is not set 444# CONFIG_NFTL is not set
@@ -522,6 +519,7 @@ CONFIG_MTD_NAND_IDS=y
522# 519#
523# Plug and Play support 520# Plug and Play support
524# 521#
522# CONFIG_PNPACPI is not set
525 523
526# 524#
527# Block devices 525# Block devices
@@ -533,14 +531,12 @@ CONFIG_BLK_DEV_RAM=y
533CONFIG_BLK_DEV_RAM_COUNT=16 531CONFIG_BLK_DEV_RAM_COUNT=16
534CONFIG_BLK_DEV_RAM_SIZE=4096 532CONFIG_BLK_DEV_RAM_SIZE=4096
535CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 533CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
536# CONFIG_BLK_DEV_INITRD is not set
537# CONFIG_CDROM_PKTCDVD is not set 534# CONFIG_CDROM_PKTCDVD is not set
538# CONFIG_ATA_OVER_ETH is not set 535# CONFIG_ATA_OVER_ETH is not set
539 536
540# 537#
541# Misc devices 538# Misc devices
542# 539#
543# CONFIG_TIFM_CORE is not set
544 540
545# 541#
546# ATA/ATAPI/MFM/RLL support 542# ATA/ATAPI/MFM/RLL support
@@ -674,6 +670,7 @@ CONFIG_TOUCHSCREEN_AD7877=y
674# CONFIG_TOUCHSCREEN_PENMOUNT is not set 670# CONFIG_TOUCHSCREEN_PENMOUNT is not set
675# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set 671# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
676# CONFIG_TOUCHSCREEN_TOUCHWIN is not set 672# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
673# CONFIG_TOUCHSCREEN_UCB1400 is not set
677CONFIG_INPUT_MISC=y 674CONFIG_INPUT_MISC=y
678CONFIG_INPUT_UINPUT=y 675CONFIG_INPUT_UINPUT=y
679# CONFIG_BF53X_PFBUTTONS is not set 676# CONFIG_BF53X_PFBUTTONS is not set
@@ -690,7 +687,7 @@ CONFIG_INPUT_UINPUT=y
690# 687#
691# CONFIG_AD9960 is not set 688# CONFIG_AD9960 is not set
692# CONFIG_SPI_ADC_BF533 is not set 689# CONFIG_SPI_ADC_BF533 is not set
693# CONFIG_BF533_PFLAGS is not set 690# CONFIG_BF5xx_PFLAGS is not set
694# CONFIG_BF5xx_PPIFCD is not set 691# CONFIG_BF5xx_PPIFCD is not set
695# CONFIG_BF5xx_TIMERS is not set 692# CONFIG_BF5xx_TIMERS is not set
696# CONFIG_BF5xx_PPI is not set 693# CONFIG_BF5xx_PPI is not set
@@ -699,6 +696,8 @@ CONFIG_BFIN_SPORT=y
699CONFIG_TWI_LCD=m 696CONFIG_TWI_LCD=m
700CONFIG_TWI_LCD_SLAVE_ADDR=34 697CONFIG_TWI_LCD_SLAVE_ADDR=34
701# CONFIG_AD5304 is not set 698# CONFIG_AD5304 is not set
699# CONFIG_BF5xx_TEA5764 is not set
700# CONFIG_BF5xx_FBDMA is not set
702# CONFIG_VT is not set 701# CONFIG_VT is not set
703# CONFIG_SERIAL_NONSTANDARD is not set 702# CONFIG_SERIAL_NONSTANDARD is not set
704 703
@@ -750,10 +749,6 @@ CONFIG_HW_RANDOM=y
750CONFIG_BLACKFIN_DPMC=y 749CONFIG_BLACKFIN_DPMC=y
751# CONFIG_DTLK is not set 750# CONFIG_DTLK is not set
752# CONFIG_R3964 is not set 751# CONFIG_R3964 is not set
753
754#
755# Ftape, the floppy tape device driver
756#
757# CONFIG_RAW_DRIVER is not set 752# CONFIG_RAW_DRIVER is not set
758 753
759# 754#
@@ -777,9 +772,9 @@ CONFIG_I2C_CHARDEV=y
777# 772#
778# I2C Hardware Bus support 773# I2C Hardware Bus support
779# 774#
780# CONFIG_I2C_BFIN_GPIO is not set 775# CONFIG_I2C_BLACKFIN_GPIO is not set
781CONFIG_I2C_BFIN_TWI=y 776CONFIG_I2C_BLACKFIN_TWI=y
782CONFIG_TWICLK_KHZ=50 777CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=50
783# CONFIG_I2C_OCORES is not set 778# CONFIG_I2C_OCORES is not set
784# CONFIG_I2C_PARPORT_LIGHT is not set 779# CONFIG_I2C_PARPORT_LIGHT is not set
785# CONFIG_I2C_STUB is not set 780# CONFIG_I2C_STUB is not set
@@ -812,12 +807,13 @@ CONFIG_SPI_MASTER=y
812# 807#
813# SPI Master Controller Drivers 808# SPI Master Controller Drivers
814# 809#
815# CONFIG_SPI_BITBANG is not set
816CONFIG_SPI_BFIN=y 810CONFIG_SPI_BFIN=y
811# CONFIG_SPI_BITBANG is not set
817 812
818# 813#
819# SPI Protocol Masters 814# SPI Protocol Masters
820# 815#
816# CONFIG_SPI_AT25 is not set
821 817
822# 818#
823# Dallas's 1-wire bus 819# Dallas's 1-wire bus
@@ -833,6 +829,7 @@ CONFIG_HWMON=y
833# CONFIG_SENSORS_ADM1021 is not set 829# CONFIG_SENSORS_ADM1021 is not set
834# CONFIG_SENSORS_ADM1025 is not set 830# CONFIG_SENSORS_ADM1025 is not set
835# CONFIG_SENSORS_ADM1026 is not set 831# CONFIG_SENSORS_ADM1026 is not set
832# CONFIG_SENSORS_ADM1029 is not set
836# CONFIG_SENSORS_ADM1031 is not set 833# CONFIG_SENSORS_ADM1031 is not set
837# CONFIG_SENSORS_ADM9240 is not set 834# CONFIG_SENSORS_ADM9240 is not set
838# CONFIG_SENSORS_ASB100 is not set 835# CONFIG_SENSORS_ASB100 is not set
@@ -857,6 +854,7 @@ CONFIG_HWMON=y
857# CONFIG_SENSORS_LM92 is not set 854# CONFIG_SENSORS_LM92 is not set
858# CONFIG_SENSORS_MAX1619 is not set 855# CONFIG_SENSORS_MAX1619 is not set
859# CONFIG_SENSORS_PC87360 is not set 856# CONFIG_SENSORS_PC87360 is not set
857# CONFIG_SENSORS_PC87427 is not set
860# CONFIG_SENSORS_SMSC47M1 is not set 858# CONFIG_SENSORS_SMSC47M1 is not set
861# CONFIG_SENSORS_SMSC47M192 is not set 859# CONFIG_SENSORS_SMSC47M192 is not set
862# CONFIG_SENSORS_SMSC47B397 is not set 860# CONFIG_SENSORS_SMSC47B397 is not set
@@ -864,12 +862,18 @@ CONFIG_HWMON=y
864# CONFIG_SENSORS_W83781D is not set 862# CONFIG_SENSORS_W83781D is not set
865# CONFIG_SENSORS_W83791D is not set 863# CONFIG_SENSORS_W83791D is not set
866# CONFIG_SENSORS_W83792D is not set 864# CONFIG_SENSORS_W83792D is not set
865# CONFIG_SENSORS_W83793 is not set
867# CONFIG_SENSORS_W83L785TS is not set 866# CONFIG_SENSORS_W83L785TS is not set
868# CONFIG_SENSORS_W83627HF is not set 867# CONFIG_SENSORS_W83627HF is not set
869# CONFIG_SENSORS_W83627EHF is not set 868# CONFIG_SENSORS_W83627EHF is not set
870# CONFIG_HWMON_DEBUG_CHIP is not set 869# CONFIG_HWMON_DEBUG_CHIP is not set
871 870
872# 871#
872# Multifunction device drivers
873#
874# CONFIG_MFD_SM501 is not set
875
876#
873# Multimedia devices 877# Multimedia devices
874# 878#
875# CONFIG_VIDEO_DEV is not set 879# CONFIG_VIDEO_DEV is not set
@@ -882,15 +886,24 @@ CONFIG_HWMON=y
882# 886#
883# Graphics support 887# Graphics support
884# 888#
885CONFIG_FIRMWARE_EDID=y 889CONFIG_BACKLIGHT_LCD_SUPPORT=y
890CONFIG_BACKLIGHT_CLASS_DEVICE=y
891CONFIG_LCD_CLASS_DEVICE=y
886CONFIG_FB=y 892CONFIG_FB=y
893CONFIG_FIRMWARE_EDID=y
894# CONFIG_FB_DDC is not set
887CONFIG_FB_CFB_FILLRECT=y 895CONFIG_FB_CFB_FILLRECT=y
888CONFIG_FB_CFB_COPYAREA=y 896CONFIG_FB_CFB_COPYAREA=y
889CONFIG_FB_CFB_IMAGEBLIT=y 897CONFIG_FB_CFB_IMAGEBLIT=y
898# CONFIG_FB_SVGALIB is not set
890# CONFIG_FB_MACMODES is not set 899# CONFIG_FB_MACMODES is not set
891# CONFIG_FB_BACKLIGHT is not set 900# CONFIG_FB_BACKLIGHT is not set
892# CONFIG_FB_MODE_HELPERS is not set 901# CONFIG_FB_MODE_HELPERS is not set
893# CONFIG_FB_TILEBLITTING is not set 902# CONFIG_FB_TILEBLITTING is not set
903
904#
905# Frame buffer hardware drivers
906#
894# CONFIG_FB_BFIN_7171 is not set 907# CONFIG_FB_BFIN_7171 is not set
895# CONFIG_FB_BFIN_7393 is not set 908# CONFIG_FB_BFIN_7393 is not set
896CONFIG_FB_BF537_LQ035=y 909CONFIG_FB_BF537_LQ035=y
@@ -904,11 +917,6 @@ CONFIG_FB_BFIN_LANDSCAPE=y
904# Logo configuration 917# Logo configuration
905# 918#
906# CONFIG_LOGO is not set 919# CONFIG_LOGO is not set
907CONFIG_BACKLIGHT_LCD_SUPPORT=y
908CONFIG_BACKLIGHT_CLASS_DEVICE=y
909CONFIG_BACKLIGHT_DEVICE=y
910CONFIG_LCD_CLASS_DEVICE=y
911CONFIG_LCD_DEVICE=y
912 920
913# 921#
914# Sound 922# Sound
@@ -946,14 +954,24 @@ CONFIG_SND_BLACKFIN_AD1981B=m
946# CONFIG_SND_BFIN_AD73311 is not set 954# CONFIG_SND_BFIN_AD73311 is not set
947 955
948# 956#
957# SoC audio support
958#
959# CONFIG_SND_SOC is not set
960
961#
949# Open Sound System 962# Open Sound System
950# 963#
951CONFIG_SOUND_PRIME=y 964CONFIG_SOUND_PRIME=y
952CONFIG_OSS_OBSOLETE_DRIVER=y 965# CONFIG_OBSOLETE_OSS is not set
953# CONFIG_SOUND_MSNDCLAS is not set 966# CONFIG_SOUND_MSNDCLAS is not set
954# CONFIG_SOUND_MSNDPIN is not set 967# CONFIG_SOUND_MSNDPIN is not set
955 968
956# 969#
970# HID Devices
971#
972# CONFIG_HID is not set
973
974#
957# USB support 975# USB support
958# 976#
959CONFIG_USB_ARCH_HAS_HCD=y 977CONFIG_USB_ARCH_HAS_HCD=y
@@ -1024,7 +1042,6 @@ CONFIG_RTC_INTF_DEV=y
1024# CONFIG_RTC_DRV_DS1672 is not set 1042# CONFIG_RTC_DRV_DS1672 is not set
1025# CONFIG_RTC_DRV_DS1742 is not set 1043# CONFIG_RTC_DRV_DS1742 is not set
1026# CONFIG_RTC_DRV_PCF8563 is not set 1044# CONFIG_RTC_DRV_PCF8563 is not set
1027# CONFIG_RTC_DRV_PCF8583 is not set
1028# CONFIG_RTC_DRV_RS5C348 is not set 1045# CONFIG_RTC_DRV_RS5C348 is not set
1029# CONFIG_RTC_DRV_RS5C372 is not set 1046# CONFIG_RTC_DRV_RS5C372 is not set
1030# CONFIG_RTC_DRV_M48T86 is not set 1047# CONFIG_RTC_DRV_M48T86 is not set
@@ -1047,6 +1064,14 @@ CONFIG_RTC_DRV_BFIN=y
1047# 1064#
1048 1065
1049# 1066#
1067# Auxiliary Display support
1068#
1069
1070#
1071# Virtualization
1072#
1073
1074#
1050# PBX support 1075# PBX support
1051# 1076#
1052# CONFIG_PBX is not set 1077# CONFIG_PBX is not set
@@ -1121,7 +1146,6 @@ CONFIG_YAFFS_CHECKPOINT_RESERVED_BLOCKS=10
1121# CONFIG_YAFFS_DISABLE_WIDE_TNODES is not set 1146# CONFIG_YAFFS_DISABLE_WIDE_TNODES is not set
1122# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set 1147# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set
1123CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y 1148CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y
1124# CONFIG_JFFS_FS is not set
1125# CONFIG_JFFS2_FS is not set 1149# CONFIG_JFFS2_FS is not set
1126# CONFIG_CRAMFS is not set 1150# CONFIG_CRAMFS is not set
1127# CONFIG_VXFS_FS is not set 1151# CONFIG_VXFS_FS is not set
@@ -1204,6 +1228,11 @@ CONFIG_NLS_DEFAULT="iso8859-1"
1204# CONFIG_NLS_UTF8 is not set 1228# CONFIG_NLS_UTF8 is not set
1205 1229
1206# 1230#
1231# Distributed Lock Manager
1232#
1233# CONFIG_DLM is not set
1234
1235#
1207# Profiling support 1236# Profiling support
1208# 1237#
1209# CONFIG_PROFILING is not set 1238# CONFIG_PROFILING is not set
@@ -1215,19 +1244,16 @@ CONFIG_NLS_DEFAULT="iso8859-1"
1215CONFIG_ENABLE_MUST_CHECK=y 1244CONFIG_ENABLE_MUST_CHECK=y
1216# CONFIG_MAGIC_SYSRQ is not set 1245# CONFIG_MAGIC_SYSRQ is not set
1217# CONFIG_UNUSED_SYMBOLS is not set 1246# CONFIG_UNUSED_SYMBOLS is not set
1247# CONFIG_DEBUG_FS is not set
1248# CONFIG_HEADERS_CHECK is not set
1218# CONFIG_DEBUG_KERNEL is not set 1249# CONFIG_DEBUG_KERNEL is not set
1219CONFIG_LOG_BUF_SHIFT=14 1250CONFIG_LOG_BUF_SHIFT=14
1220# CONFIG_DEBUG_BUGVERBOSE is not set 1251# CONFIG_DEBUG_BUGVERBOSE is not set
1221# CONFIG_DEBUG_FS is not set
1222# CONFIG_UNWIND_INFO is not set
1223# CONFIG_HEADERS_CHECK is not set
1224# CONFIG_DEBUG_SERIAL_EARLY_INIT is not set 1252# CONFIG_DEBUG_SERIAL_EARLY_INIT is not set
1225# CONFIG_DEBUG_HUNT_FOR_ZERO is not set 1253# CONFIG_DEBUG_HUNT_FOR_ZERO is not set
1226# CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE is not set 1254# CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE is not set
1227# CONFIG_BOOTPARAM is not set
1228# CONFIG_NO_KERNEL_MSG is not set
1229# CONFIG_CPLB_INFO is not set 1255# CONFIG_CPLB_INFO is not set
1230# CONFIG_NO_ACCESS_CHECK is not set 1256# CONFIG_ACCESS_CHECK is not set
1231 1257
1232# 1258#
1233# Security options 1259# Security options
@@ -1245,9 +1271,12 @@ CONFIG_SECURITY_CAPABILITIES=y
1245# 1271#
1246# Library routines 1272# Library routines
1247# 1273#
1274CONFIG_BITREVERSE=y
1248CONFIG_CRC_CCITT=m 1275CONFIG_CRC_CCITT=m
1249# CONFIG_CRC16 is not set 1276# CONFIG_CRC16 is not set
1250CONFIG_CRC32=y 1277CONFIG_CRC32=y
1251# CONFIG_LIBCRC32C is not set 1278# CONFIG_LIBCRC32C is not set
1252CONFIG_ZLIB_INFLATE=y 1279CONFIG_ZLIB_INFLATE=y
1253CONFIG_PLIST=y 1280CONFIG_PLIST=y
1281CONFIG_HAS_IOMEM=y
1282CONFIG_HAS_IOPORT=y
diff --git a/arch/blackfin/defconfig b/arch/blackfin/defconfig
deleted file mode 100644
index a513fbe39567..000000000000
--- a/arch/blackfin/defconfig
+++ /dev/null
@@ -1,1327 +0,0 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20.4
4#
5# CONFIG_MMU is not set
6# CONFIG_FPU is not set
7CONFIG_RWSEM_GENERIC_SPINLOCK=y
8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
9CONFIG_BLACKFIN=y
10CONFIG_BFIN=y
11CONFIG_SEMAPHORE_SLEEPERS=y
12CONFIG_GENERIC_FIND_NEXT_BIT=y
13CONFIG_GENERIC_HWEIGHT=y
14CONFIG_GENERIC_HARDIRQS=y
15CONFIG_GENERIC_IRQ_PROBE=y
16# CONFIG_GENERIC_TIME is not set
17CONFIG_GENERIC_CALIBRATE_DELAY=y
18CONFIG_FORCE_MAX_ZONEORDER=14
19CONFIG_IRQCHIP_DEMUX_GPIO=y
20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
21
22#
23# Code maturity level options
24#
25CONFIG_EXPERIMENTAL=y
26CONFIG_BROKEN_ON_SMP=y
27CONFIG_INIT_ENV_ARG_LIMIT=32
28
29#
30# General setup
31#
32CONFIG_LOCALVERSION=""
33CONFIG_LOCALVERSION_AUTO=y
34CONFIG_SYSVIPC=y
35# CONFIG_IPC_NS is not set
36# CONFIG_POSIX_MQUEUE is not set
37# CONFIG_BSD_PROCESS_ACCT is not set
38# CONFIG_TASKSTATS is not set
39# CONFIG_UTS_NS is not set
40# CONFIG_AUDIT is not set
41# CONFIG_IKCONFIG is not set
42CONFIG_SYSFS_DEPRECATED=y
43# CONFIG_RELAY is not set
44CONFIG_INITRAMFS_SOURCE=""
45# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
46CONFIG_SYSCTL=y
47CONFIG_EMBEDDED=y
48CONFIG_UID16=y
49CONFIG_SYSCTL_SYSCALL=y
50CONFIG_KALLSYMS=y
51# CONFIG_KALLSYMS_EXTRA_PASS is not set
52CONFIG_HOTPLUG=y
53CONFIG_PRINTK=y
54CONFIG_BUG=y
55CONFIG_ELF_CORE=y
56CONFIG_BASE_FULL=y
57CONFIG_FUTEX=y
58CONFIG_EPOLL=y
59CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3
60# CONFIG_LIMIT_PAGECACHE is not set
61CONFIG_BUDDY=y
62# CONFIG_NP2 is not set
63CONFIG_SLAB=y
64CONFIG_VM_EVENT_COUNTERS=y
65CONFIG_RT_MUTEXES=y
66CONFIG_TINY_SHMEM=y
67CONFIG_BASE_SMALL=0
68# CONFIG_SLOB is not set
69
70#
71# Loadable module support
72#
73CONFIG_MODULES=y
74CONFIG_MODULE_UNLOAD=y
75# CONFIG_MODULE_FORCE_UNLOAD is not set
76# CONFIG_MODVERSIONS is not set
77# CONFIG_MODULE_SRCVERSION_ALL is not set
78CONFIG_KMOD=y
79
80#
81# Block layer
82#
83CONFIG_BLOCK=y
84# CONFIG_LBD is not set
85# CONFIG_BLK_DEV_IO_TRACE is not set
86# CONFIG_LSF is not set
87
88#
89# IO Schedulers
90#
91CONFIG_IOSCHED_NOOP=y
92CONFIG_IOSCHED_AS=y
93# CONFIG_IOSCHED_DEADLINE is not set
94CONFIG_IOSCHED_CFQ=y
95CONFIG_DEFAULT_AS=y
96# CONFIG_DEFAULT_DEADLINE is not set
97# CONFIG_DEFAULT_CFQ is not set
98# CONFIG_DEFAULT_NOOP is not set
99CONFIG_DEFAULT_IOSCHED="anticipatory"
100# CONFIG_PREEMPT_NONE is not set
101CONFIG_PREEMPT_VOLUNTARY=y
102# CONFIG_PREEMPT is not set
103
104#
105# Blackfin Processor Options
106#
107
108#
109# Processor and Board Settings
110#
111# CONFIG_BF531 is not set
112# CONFIG_BF532 is not set
113# CONFIG_BF533 is not set
114# CONFIG_BF534 is not set
115# CONFIG_BF536 is not set
116CONFIG_BF537=y
117# CONFIG_BF561 is not set
118CONFIG_BF_REV_0_2=y
119# CONFIG_BF_REV_0_3 is not set
120# CONFIG_BF_REV_0_4 is not set
121# CONFIG_BF_REV_0_5 is not set
122CONFIG_BFIN_SINGLE_CORE=y
123# CONFIG_BFIN533_EZKIT is not set
124# CONFIG_BFIN533_STAMP is not set
125CONFIG_BFIN537_STAMP=y
126# CONFIG_BFIN533_BLUETECHNIX_CM is not set
127# CONFIG_BFIN537_BLUETECHNIX_CM is not set
128# CONFIG_BFIN561_BLUETECHNIX_CM is not set
129# CONFIG_BFIN561_EZKIT is not set
130# CONFIG_PNAV10 is not set
131# CONFIG_GENERIC_BOARD is not set
132CONFIG_MEM_MT48LC32M8A2_75=y
133CONFIG_IRQ_PLL_WAKEUP=7
134
135#
136# BF537 Specific Configuration
137#
138
139#
140# PORT F/G Selection
141#
142CONFIG_BF537_PORT_F=y
143# CONFIG_BF537_PORT_G is not set
144# CONFIG_BF537_PORT_H is not set
145
146#
147# Interrupt Priority Assignment
148#
149
150#
151# Priority
152#
153CONFIG_IRQ_DMA_ERROR=7
154CONFIG_IRQ_ERROR=7
155CONFIG_IRQ_RTC=8
156CONFIG_IRQ_PPI=8
157CONFIG_IRQ_SPORT0_RX=9
158CONFIG_IRQ_SPORT0_TX=9
159CONFIG_IRQ_SPORT1_RX=9
160CONFIG_IRQ_SPORT1_TX=9
161CONFIG_IRQ_TWI=10
162CONFIG_IRQ_SPI=10
163CONFIG_IRQ_UART0_RX=10
164CONFIG_IRQ_UART0_TX=10
165CONFIG_IRQ_UART1_RX=10
166CONFIG_IRQ_UART1_TX=10
167CONFIG_IRQ_CAN_RX=11
168CONFIG_IRQ_CAN_TX=11
169CONFIG_IRQ_MAC_RX=11
170CONFIG_IRQ_MAC_TX=11
171CONFIG_IRQ_TMR0=12
172CONFIG_IRQ_TMR1=12
173CONFIG_IRQ_TMR2=12
174CONFIG_IRQ_TMR3=12
175CONFIG_IRQ_TMR4=12
176CONFIG_IRQ_TMR5=12
177CONFIG_IRQ_TMR6=12
178CONFIG_IRQ_TMR7=12
179CONFIG_IRQ_PROG_INTA=12
180CONFIG_IRQ_PORTG_INTB=12
181CONFIG_IRQ_MEM_DMA0=13
182CONFIG_IRQ_MEM_DMA1=13
183CONFIG_IRQ_WATCH=13
184
185#
186# Board customizations
187#
188# CONFIG_CMDLINE_BOOL is not set
189
190#
191# Board Setup
192#
193CONFIG_CLKIN_HZ=25000000
194CONFIG_MEM_SIZE=64
195CONFIG_MEM_ADD_WIDTH=10
196CONFIG_BOOT_LOAD=0x1000
197
198#
199# Console UART Setup
200#
201# CONFIG_BAUD_9600 is not set
202# CONFIG_BAUD_19200 is not set
203# CONFIG_BAUD_38400 is not set
204CONFIG_BAUD_57600=y
205# CONFIG_BAUD_115200 is not set
206CONFIG_BAUD_NO_PARITY=y
207# CONFIG_BAUD_PARITY is not set
208CONFIG_BAUD_1_STOPBIT=y
209# CONFIG_BAUD_2_STOPBIT is not set
210
211#
212# Blackfin Kernel Optimizations
213#
214
215#
216# Timer Tick
217#
218# CONFIG_HZ_100 is not set
219CONFIG_HZ_250=y
220# CONFIG_HZ_300 is not set
221# CONFIG_HZ_1000 is not set
222CONFIG_HZ=250
223
224#
225# Memory Optimizations
226#
227CONFIG_I_ENTRY_L1=y
228CONFIG_EXCPT_IRQ_SYSC_L1=y
229CONFIG_DO_IRQ_L1=y
230CONFIG_CORE_TIMER_IRQ_L1=y
231CONFIG_IDLE_L1=y
232CONFIG_SCHEDULE_L1=y
233CONFIG_ARITHMETIC_OPS_L1=y
234CONFIG_ACCESS_OK_L1=y
235CONFIG_MEMSET_L1=y
236CONFIG_MEMCPY_L1=y
237CONFIG_SYS_BFIN_SPINLOCK_L1=y
238# CONFIG_IP_CHECKSUM_L1 is not set
239# CONFIG_SYSCALL_TAB_L1 is not set
240# CONFIG_CPLB_SWITCH_TAB_L1 is not set
241CONFIG_RAMKERNEL=y
242# CONFIG_ROMKERNEL is not set
243CONFIG_SELECT_MEMORY_MODEL=y
244CONFIG_FLATMEM_MANUAL=y
245# CONFIG_DISCONTIGMEM_MANUAL is not set
246# CONFIG_SPARSEMEM_MANUAL is not set
247CONFIG_FLATMEM=y
248CONFIG_FLAT_NODE_MEM_MAP=y
249# CONFIG_SPARSEMEM_STATIC is not set
250CONFIG_SPLIT_PTLOCK_CPUS=4
251# CONFIG_RESOURCES_64BIT is not set
252CONFIG_LARGE_ALLOCS=y
253CONFIG_BFIN_DMA_5XX=y
254# CONFIG_DMA_UNCACHED_2M is not set
255CONFIG_DMA_UNCACHED_1M=y
256# CONFIG_DMA_UNCACHED_NONE is not set
257
258#
259# Cache Support
260#
261CONFIG_BLKFIN_CACHE=y
262CONFIG_BLKFIN_DCACHE=y
263# CONFIG_BLKFIN_DCACHE_BANKA is not set
264# CONFIG_BLKFIN_CACHE_LOCK is not set
265# CONFIG_BLKFIN_WB is not set
266CONFIG_BLKFIN_WT=y
267CONFIG_L1_MAX_PIECE=16
268
269#
270# Clock Settings
271#
272# CONFIG_BFIN_KERNEL_CLOCK is not set
273
274#
275# Asynchonous Memory Configuration
276#
277
278#
279# EBIU_AMBCTL Global Control
280#
281CONFIG_C_AMCKEN=y
282CONFIG_C_CDPRIO=y
283# CONFIG_C_AMBEN is not set
284# CONFIG_C_AMBEN_B0 is not set
285# CONFIG_C_AMBEN_B0_B1 is not set
286# CONFIG_C_AMBEN_B0_B1_B2 is not set
287CONFIG_C_AMBEN_ALL=y
288
289#
290# EBIU_AMBCTL Control
291#
292CONFIG_BANK_0=0x7BB0
293CONFIG_BANK_1=0x7BB0
294CONFIG_BANK_2=0x7BB0
295CONFIG_BANK_3=0x99B3
296
297#
298# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
299#
300# CONFIG_PCI is not set
301
302#
303# PCCARD (PCMCIA/CardBus) support
304#
305# CONFIG_PCCARD is not set
306
307#
308# PCI Hotplug Support
309#
310
311#
312# Executable file formats
313#
314CONFIG_BINFMT_ELF_FDPIC=y
315CONFIG_BINFMT_FLAT=y
316CONFIG_BINFMT_ZFLAT=y
317# CONFIG_BINFMT_SHARED_FLAT is not set
318# CONFIG_BINFMT_MISC is not set
319
320#
321# Power management options
322#
323CONFIG_PM=y
324CONFIG_PM_LEGACY=y
325# CONFIG_PM_DEBUG is not set
326# CONFIG_PM_SYSFS_DEPRECATED is not set
327CONFIG_PM_WAKEUP_GPIO_BY_SIC_IWR=y
328# CONFIG_PM_WAKEUP_BY_GPIO is not set
329# CONFIG_PM_WAKEUP_GPIO_API is not set
330CONFIG_PM_WAKEUP_SIC_IWR=0x80000000
331
332#
333# CPU Frequency scaling
334#
335# CONFIG_CPU_FREQ is not set
336
337#
338# Networking
339#
340CONFIG_NET=y
341
342#
343# Networking options
344#
345# CONFIG_NETDEBUG is not set
346CONFIG_PACKET=y
347# CONFIG_PACKET_MMAP is not set
348CONFIG_UNIX=y
349CONFIG_XFRM=y
350# CONFIG_XFRM_USER is not set
351# CONFIG_XFRM_SUB_POLICY is not set
352# CONFIG_NET_KEY is not set
353CONFIG_INET=y
354# CONFIG_IP_MULTICAST is not set
355# CONFIG_IP_ADVANCED_ROUTER is not set
356CONFIG_IP_FIB_HASH=y
357CONFIG_IP_PNP=y
358# CONFIG_IP_PNP_DHCP is not set
359# CONFIG_IP_PNP_BOOTP is not set
360# CONFIG_IP_PNP_RARP is not set
361# CONFIG_NET_IPIP is not set
362# CONFIG_NET_IPGRE is not set
363# CONFIG_ARPD is not set
364CONFIG_SYN_COOKIES=y
365# CONFIG_INET_AH is not set
366# CONFIG_INET_ESP is not set
367# CONFIG_INET_IPCOMP is not set
368# CONFIG_INET_XFRM_TUNNEL is not set
369# CONFIG_INET_TUNNEL is not set
370CONFIG_INET_XFRM_MODE_TRANSPORT=y
371CONFIG_INET_XFRM_MODE_TUNNEL=y
372CONFIG_INET_XFRM_MODE_BEET=y
373CONFIG_INET_DIAG=y
374CONFIG_INET_TCP_DIAG=y
375# CONFIG_TCP_CONG_ADVANCED is not set
376CONFIG_TCP_CONG_CUBIC=y
377CONFIG_DEFAULT_TCP_CONG="cubic"
378# CONFIG_TCP_MD5SIG is not set
379# CONFIG_IPV6 is not set
380# CONFIG_INET6_XFRM_TUNNEL is not set
381# CONFIG_INET6_TUNNEL is not set
382# CONFIG_NETLABEL is not set
383# CONFIG_NETWORK_SECMARK is not set
384# CONFIG_NETFILTER is not set
385
386#
387# DCCP Configuration (EXPERIMENTAL)
388#
389# CONFIG_IP_DCCP is not set
390
391#
392# SCTP Configuration (EXPERIMENTAL)
393#
394# CONFIG_IP_SCTP is not set
395
396#
397# TIPC Configuration (EXPERIMENTAL)
398#
399# CONFIG_TIPC is not set
400# CONFIG_ATM is not set
401# CONFIG_BRIDGE is not set
402# CONFIG_VLAN_8021Q is not set
403# CONFIG_DECNET is not set
404# CONFIG_LLC2 is not set
405# CONFIG_IPX is not set
406# CONFIG_ATALK is not set
407# CONFIG_X25 is not set
408# CONFIG_LAPB is not set
409# CONFIG_ECONET is not set
410# CONFIG_WAN_ROUTER is not set
411
412#
413# QoS and/or fair queueing
414#
415# CONFIG_NET_SCHED is not set
416
417#
418# Network testing
419#
420# CONFIG_NET_PKTGEN is not set
421# CONFIG_HAMRADIO is not set
422CONFIG_IRDA=m
423
424#
425# IrDA protocols
426#
427CONFIG_IRLAN=m
428CONFIG_IRCOMM=m
429# CONFIG_IRDA_ULTRA is not set
430
431#
432# IrDA options
433#
434CONFIG_IRDA_CACHE_LAST_LSAP=y
435# CONFIG_IRDA_FAST_RR is not set
436# CONFIG_IRDA_DEBUG is not set
437
438#
439# Infrared-port device drivers
440#
441
442#
443# SIR device drivers
444#
445CONFIG_IRTTY_SIR=m
446
447#
448# Dongle support
449#
450# CONFIG_DONGLE is not set
451
452#
453# Old SIR device drivers
454#
455# CONFIG_IRPORT_SIR is not set
456
457#
458# Old Serial dongle support
459#
460
461#
462# FIR device drivers
463#
464# CONFIG_BT is not set
465# CONFIG_IEEE80211 is not set
466
467#
468# Device Drivers
469#
470
471#
472# Generic Driver Options
473#
474CONFIG_STANDALONE=y
475CONFIG_PREVENT_FIRMWARE_BUILD=y
476# CONFIG_FW_LOADER is not set
477# CONFIG_SYS_HYPERVISOR is not set
478
479#
480# Connector - unified userspace <-> kernelspace linker
481#
482# CONFIG_CONNECTOR is not set
483
484#
485# Memory Technology Devices (MTD)
486#
487CONFIG_MTD=y
488# CONFIG_MTD_DEBUG is not set
489# CONFIG_MTD_CONCAT is not set
490CONFIG_MTD_PARTITIONS=y
491# CONFIG_MTD_REDBOOT_PARTS is not set
492# CONFIG_MTD_CMDLINE_PARTS is not set
493
494#
495# User Modules And Translation Layers
496#
497CONFIG_MTD_CHAR=m
498CONFIG_MTD_BLKDEVS=y
499CONFIG_MTD_BLOCK=y
500# CONFIG_FTL is not set
501# CONFIG_NFTL is not set
502# CONFIG_INFTL is not set
503# CONFIG_RFD_FTL is not set
504# CONFIG_SSFDC is not set
505
506#
507# RAM/ROM/Flash chip drivers
508#
509# CONFIG_MTD_CFI is not set
510CONFIG_MTD_JEDECPROBE=m
511CONFIG_MTD_GEN_PROBE=m
512# CONFIG_MTD_CFI_ADV_OPTIONS is not set
513CONFIG_MTD_MAP_BANK_WIDTH_1=y
514CONFIG_MTD_MAP_BANK_WIDTH_2=y
515CONFIG_MTD_MAP_BANK_WIDTH_4=y
516# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
517# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
518# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
519CONFIG_MTD_CFI_I1=y
520CONFIG_MTD_CFI_I2=y
521# CONFIG_MTD_CFI_I4 is not set
522# CONFIG_MTD_CFI_I8 is not set
523# CONFIG_MTD_CFI_INTELEXT is not set
524# CONFIG_MTD_CFI_AMDSTD is not set
525# CONFIG_MTD_CFI_STAA is not set
526CONFIG_MTD_MW320D=m
527CONFIG_MTD_RAM=y
528CONFIG_MTD_ROM=m
529# CONFIG_MTD_ABSENT is not set
530# CONFIG_MTD_OBSOLETE_CHIPS is not set
531
532#
533# Mapping drivers for chip access
534#
535CONFIG_MTD_COMPLEX_MAPPINGS=y
536# CONFIG_MTD_PHYSMAP is not set
537CONFIG_MTD_BF5xx=m
538CONFIG_BFIN_FLASH_SIZE=0x400000
539CONFIG_EBIU_FLASH_BASE=0x20000000
540
541#
542# FLASH_EBIU_AMBCTL Control
543#
544CONFIG_BFIN_FLASH_BANK_0=0x7BB0
545CONFIG_BFIN_FLASH_BANK_1=0x7BB0
546CONFIG_BFIN_FLASH_BANK_2=0x7BB0
547CONFIG_BFIN_FLASH_BANK_3=0x7BB0
548CONFIG_MTD_UCLINUX=y
549# CONFIG_MTD_PLATRAM is not set
550
551#
552# Self-contained MTD device drivers
553#
554# CONFIG_MTD_DATAFLASH is not set
555# CONFIG_MTD_M25P80 is not set
556# CONFIG_MTD_SLRAM is not set
557# CONFIG_MTD_PHRAM is not set
558# CONFIG_MTD_MTDRAM is not set
559# CONFIG_MTD_BLOCK2MTD is not set
560
561#
562# Disk-On-Chip Device Drivers
563#
564# CONFIG_MTD_DOC2000 is not set
565# CONFIG_MTD_DOC2001 is not set
566# CONFIG_MTD_DOC2001PLUS is not set
567
568#
569# NAND Flash Device Drivers
570#
571CONFIG_MTD_NAND=m
572# CONFIG_MTD_NAND_VERIFY_WRITE is not set
573# CONFIG_MTD_NAND_ECC_SMC is not set
574CONFIG_MTD_NAND_BFIN=m
575CONFIG_BFIN_NAND_BASE=0x20212000
576CONFIG_BFIN_NAND_CLE=2
577CONFIG_BFIN_NAND_ALE=1
578CONFIG_BFIN_NAND_READY=3
579CONFIG_MTD_NAND_IDS=m
580# CONFIG_MTD_NAND_DISKONCHIP is not set
581# CONFIG_MTD_NAND_NANDSIM is not set
582
583#
584# OneNAND Flash Device Drivers
585#
586# CONFIG_MTD_ONENAND is not set
587
588#
589# Parallel port support
590#
591# CONFIG_PARPORT is not set
592
593#
594# Plug and Play support
595#
596
597#
598# Block devices
599#
600# CONFIG_BLK_DEV_COW_COMMON is not set
601# CONFIG_BLK_DEV_LOOP is not set
602# CONFIG_BLK_DEV_NBD is not set
603CONFIG_BLK_DEV_RAM=y
604CONFIG_BLK_DEV_RAM_COUNT=16
605CONFIG_BLK_DEV_RAM_SIZE=4096
606CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
607# CONFIG_BLK_DEV_INITRD is not set
608# CONFIG_CDROM_PKTCDVD is not set
609# CONFIG_ATA_OVER_ETH is not set
610
611#
612# Misc devices
613#
614# CONFIG_TIFM_CORE is not set
615
616#
617# ATA/ATAPI/MFM/RLL support
618#
619# CONFIG_IDE is not set
620
621#
622# SCSI device support
623#
624# CONFIG_RAID_ATTRS is not set
625# CONFIG_SCSI is not set
626# CONFIG_SCSI_NETLINK is not set
627
628#
629# Serial ATA (prod) and Parallel ATA (experimental) drivers
630#
631# CONFIG_ATA is not set
632
633#
634# Multi-device support (RAID and LVM)
635#
636# CONFIG_MD is not set
637
638#
639# Fusion MPT device support
640#
641# CONFIG_FUSION is not set
642
643#
644# IEEE 1394 (FireWire) support
645#
646
647#
648# I2O device support
649#
650
651#
652# Network device support
653#
654CONFIG_NETDEVICES=y
655# CONFIG_DUMMY is not set
656# CONFIG_BONDING is not set
657# CONFIG_EQUALIZER is not set
658# CONFIG_TUN is not set
659
660#
661# PHY device support
662#
663# CONFIG_PHYLIB is not set
664
665#
666# Ethernet (10 or 100Mbit)
667#
668CONFIG_NET_ETHERNET=y
669CONFIG_MII=y
670# CONFIG_SMC91X is not set
671CONFIG_BFIN_MAC=y
672CONFIG_BFIN_MAC_USE_L1=y
673CONFIG_BFIN_TX_DESC_NUM=10
674CONFIG_BFIN_RX_DESC_NUM=20
675# CONFIG_BFIN_MAC_RMII is not set
676
677#
678# Ethernet (1000 Mbit)
679#
680
681#
682# Ethernet (10000 Mbit)
683#
684
685#
686# Token Ring devices
687#
688
689#
690# Wireless LAN (non-hamradio)
691#
692# CONFIG_NET_RADIO is not set
693
694#
695# Wan interfaces
696#
697# CONFIG_WAN is not set
698# CONFIG_PPP is not set
699# CONFIG_SLIP is not set
700# CONFIG_SHAPER is not set
701# CONFIG_NETCONSOLE is not set
702# CONFIG_NETPOLL is not set
703# CONFIG_NET_POLL_CONTROLLER is not set
704
705#
706# ISDN subsystem
707#
708# CONFIG_ISDN is not set
709
710#
711# Telephony Support
712#
713# CONFIG_PHONE is not set
714
715#
716# Input device support
717#
718CONFIG_INPUT=y
719# CONFIG_INPUT_FF_MEMLESS is not set
720
721#
722# Userland interfaces
723#
724# CONFIG_INPUT_MOUSEDEV is not set
725# CONFIG_INPUT_JOYDEV is not set
726# CONFIG_INPUT_TSDEV is not set
727CONFIG_INPUT_EVDEV=m
728# CONFIG_INPUT_EVBUG is not set
729
730#
731# Input Device Drivers
732#
733# CONFIG_INPUT_KEYBOARD is not set
734# CONFIG_INPUT_MOUSE is not set
735# CONFIG_INPUT_JOYSTICK is not set
736# CONFIG_INPUT_TOUCHSCREEN is not set
737CONFIG_INPUT_MISC=y
738# CONFIG_INPUT_UINPUT is not set
739# CONFIG_BF53X_PFBUTTONS is not set
740CONFIG_TWI_KEYPAD=m
741CONFIG_BFIN_TWIKEYPAD_IRQ_PFX=72
742
743#
744# Hardware I/O ports
745#
746# CONFIG_SERIO is not set
747# CONFIG_GAMEPORT is not set
748
749#
750# Character devices
751#
752# CONFIG_AD9960 is not set
753# CONFIG_SPI_ADC_BF533 is not set
754# CONFIG_BF533_PFLAGS is not set
755# CONFIG_BF5xx_PPIFCD is not set
756# CONFIG_BF5xx_TIMERS is not set
757# CONFIG_BF5xx_PPI is not set
758CONFIG_BFIN_SPORT=y
759# CONFIG_BFIN_TIMER_LATENCY is not set
760CONFIG_TWI_LCD=m
761CONFIG_TWI_LCD_SLAVE_ADDR=34
762# CONFIG_AD5304 is not set
763# CONFIG_VT is not set
764# CONFIG_SERIAL_NONSTANDARD is not set
765
766#
767# Serial drivers
768#
769# CONFIG_SERIAL_8250 is not set
770
771#
772# Non-8250 serial port support
773#
774CONFIG_SERIAL_BFIN=y
775CONFIG_SERIAL_BFIN_CONSOLE=y
776CONFIG_SERIAL_BFIN_DMA=y
777# CONFIG_SERIAL_BFIN_PIO is not set
778CONFIG_SERIAL_BFIN_UART0=y
779# CONFIG_BFIN_UART0_CTSRTS is not set
780# CONFIG_SERIAL_BFIN_UART1 is not set
781CONFIG_SERIAL_CORE=y
782CONFIG_SERIAL_CORE_CONSOLE=y
783# CONFIG_SERIAL_BFIN_SPORT is not set
784CONFIG_UNIX98_PTYS=y
785# CONFIG_LEGACY_PTYS is not set
786
787#
788# CAN, the car bus and industrial fieldbus
789#
790CONFIG_CAN4LINUX=y
791
792#
793# linux embedded drivers
794#
795# CONFIG_CAN_MCF5282 is not set
796# CONFIG_CAN_UNCTWINCAN is not set
797CONFIG_CAN_BLACKFIN=m
798
799#
800# IPMI
801#
802# CONFIG_IPMI_HANDLER is not set
803
804#
805# Watchdog Cards
806#
807# CONFIG_WATCHDOG is not set
808CONFIG_HW_RANDOM=y
809# CONFIG_GEN_RTC is not set
810CONFIG_BLACKFIN_DPMC=y
811# CONFIG_DTLK is not set
812# CONFIG_R3964 is not set
813# CONFIG_RAW_DRIVER is not set
814
815#
816# TPM devices
817#
818# CONFIG_TCG_TPM is not set
819
820#
821# I2C support
822#
823CONFIG_I2C=m
824CONFIG_I2C_CHARDEV=m
825
826#
827# I2C Algorithms
828#
829# CONFIG_I2C_ALGOBIT is not set
830# CONFIG_I2C_ALGOPCF is not set
831# CONFIG_I2C_ALGOPCA is not set
832
833#
834# I2C Hardware Bus support
835#
836# CONFIG_I2C_BLACKFIN_GPIO is not set
837# CONFIG_I2C_BLACKFIN_TWI is not set
838# CONFIG_I2C_OCORES is not set
839# CONFIG_I2C_PARPORT_LIGHT is not set
840# CONFIG_I2C_STUB is not set
841# CONFIG_I2C_PCA_ISA is not set
842
843#
844# Miscellaneous I2C Chip support
845#
846# CONFIG_SENSORS_DS1337 is not set
847# CONFIG_SENSORS_DS1374 is not set
848CONFIG_SENSORS_AD5252=m
849# CONFIG_SENSORS_EEPROM is not set
850# CONFIG_SENSORS_PCF8574 is not set
851# CONFIG_SENSORS_PCF8575 is not set
852# CONFIG_SENSORS_PCA9543 is not set
853# CONFIG_SENSORS_PCA9539 is not set
854# CONFIG_SENSORS_PCF8591 is not set
855# CONFIG_SENSORS_MAX6875 is not set
856# CONFIG_I2C_DEBUG_CORE is not set
857# CONFIG_I2C_DEBUG_ALGO is not set
858# CONFIG_I2C_DEBUG_BUS is not set
859# CONFIG_I2C_DEBUG_CHIP is not set
860
861#
862# SPI support
863#
864CONFIG_SPI=y
865CONFIG_SPI_MASTER=y
866
867#
868# SPI Master Controller Drivers
869#
870# CONFIG_SPI_BITBANG is not set
871
872#
873# SPI Protocol Masters
874#
875CONFIG_SPI_BFIN=y
876
877#
878# Dallas's 1-wire bus
879#
880# CONFIG_W1 is not set
881
882#
883# Hardware Monitoring support
884#
885CONFIG_HWMON=y
886# CONFIG_HWMON_VID is not set
887# CONFIG_SENSORS_ABITUGURU is not set
888# CONFIG_SENSORS_ADM1021 is not set
889# CONFIG_SENSORS_ADM1025 is not set
890# CONFIG_SENSORS_ADM1026 is not set
891# CONFIG_SENSORS_ADM1031 is not set
892# CONFIG_SENSORS_ADM9240 is not set
893# CONFIG_SENSORS_ASB100 is not set
894# CONFIG_SENSORS_ATXP1 is not set
895# CONFIG_SENSORS_DS1621 is not set
896# CONFIG_SENSORS_F71805F is not set
897# CONFIG_SENSORS_FSCHER is not set
898# CONFIG_SENSORS_FSCPOS is not set
899# CONFIG_SENSORS_GL518SM is not set
900# CONFIG_SENSORS_GL520SM is not set
901# CONFIG_SENSORS_IT87 is not set
902# CONFIG_SENSORS_LM63 is not set
903# CONFIG_SENSORS_LM70 is not set
904# CONFIG_SENSORS_LM75 is not set
905# CONFIG_SENSORS_LM77 is not set
906# CONFIG_SENSORS_LM78 is not set
907# CONFIG_SENSORS_LM80 is not set
908# CONFIG_SENSORS_LM83 is not set
909# CONFIG_SENSORS_LM85 is not set
910# CONFIG_SENSORS_LM87 is not set
911# CONFIG_SENSORS_LM90 is not set
912# CONFIG_SENSORS_LM92 is not set
913# CONFIG_SENSORS_MAX1619 is not set
914# CONFIG_SENSORS_PC87360 is not set
915# CONFIG_SENSORS_PC87427 is not set
916# CONFIG_SENSORS_SMSC47M1 is not set
917# CONFIG_SENSORS_SMSC47M192 is not set
918# CONFIG_SENSORS_SMSC47B397 is not set
919# CONFIG_SENSORS_VT1211 is not set
920# CONFIG_SENSORS_W83781D is not set
921# CONFIG_SENSORS_W83791D is not set
922# CONFIG_SENSORS_W83792D is not set
923# CONFIG_SENSORS_W83793 is not set
924# CONFIG_SENSORS_W83L785TS is not set
925# CONFIG_SENSORS_W83627HF is not set
926# CONFIG_SENSORS_W83627EHF is not set
927# CONFIG_HWMON_DEBUG_CHIP is not set
928
929#
930# Multimedia devices
931#
932# CONFIG_VIDEO_DEV is not set
933
934#
935# Digital Video Broadcasting Devices
936#
937# CONFIG_DVB is not set
938
939#
940# Graphics support
941#
942CONFIG_FIRMWARE_EDID=y
943CONFIG_FB=m
944CONFIG_FB_CFB_FILLRECT=m
945CONFIG_FB_CFB_COPYAREA=m
946CONFIG_FB_CFB_IMAGEBLIT=m
947# CONFIG_FB_MACMODES is not set
948# CONFIG_FB_BACKLIGHT is not set
949# CONFIG_FB_MODE_HELPERS is not set
950# CONFIG_FB_TILEBLITTING is not set
951CONFIG_FB_BFIN_7171=m
952CONFIG_FB_BFIN_7393=m
953CONFIG_NTSC=y
954# CONFIG_PAL is not set
955# CONFIG_NTSC_640x480 is not set
956# CONFIG_PAL_640x480 is not set
957# CONFIG_NTSC_YCBCR is not set
958# CONFIG_PAL_YCBCR is not set
959CONFIG_ADV7393_1XMEM=y
960# CONFIG_ADV7393_2XMEM is not set
961# CONFIG_FB_S1D13XXX is not set
962# CONFIG_FB_VIRTUAL is not set
963
964#
965# Logo configuration
966#
967# CONFIG_LOGO is not set
968CONFIG_BACKLIGHT_LCD_SUPPORT=y
969CONFIG_BACKLIGHT_CLASS_DEVICE=m
970CONFIG_BACKLIGHT_DEVICE=y
971CONFIG_LCD_CLASS_DEVICE=m
972CONFIG_LCD_DEVICE=y
973
974#
975# Sound
976#
977CONFIG_SOUND=m
978
979#
980# Advanced Linux Sound Architecture
981#
982CONFIG_SND=m
983CONFIG_SND_TIMER=m
984CONFIG_SND_PCM=m
985# CONFIG_SND_SEQUENCER is not set
986CONFIG_SND_OSSEMUL=y
987CONFIG_SND_MIXER_OSS=m
988CONFIG_SND_PCM_OSS=m
989CONFIG_SND_PCM_OSS_PLUGINS=y
990# CONFIG_SND_DYNAMIC_MINORS is not set
991CONFIG_SND_SUPPORT_OLD_API=y
992CONFIG_SND_VERBOSE_PROCFS=y
993# CONFIG_SND_VERBOSE_PRINTK is not set
994# CONFIG_SND_DEBUG is not set
995
996#
997# Generic devices
998#
999# CONFIG_SND_DUMMY is not set
1000# CONFIG_SND_MTPAV is not set
1001# CONFIG_SND_SERIAL_U16550 is not set
1002# CONFIG_SND_MPU401 is not set
1003
1004#
1005# Open Sound System
1006#
1007# CONFIG_SOUND_PRIME is not set
1008
1009#
1010# HID Devices
1011#
1012CONFIG_HID=y
1013
1014#
1015# USB support
1016#
1017CONFIG_USB_ARCH_HAS_HCD=y
1018# CONFIG_USB_ARCH_HAS_OHCI is not set
1019# CONFIG_USB_ARCH_HAS_EHCI is not set
1020# CONFIG_USB is not set
1021
1022#
1023# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
1024#
1025
1026#
1027# USB Gadget Support
1028#
1029# CONFIG_USB_GADGET is not set
1030
1031#
1032# MMC/SD Card support
1033#
1034# CONFIG_SPI_MMC is not set
1035# CONFIG_MMC is not set
1036
1037#
1038# LED devices
1039#
1040# CONFIG_NEW_LEDS is not set
1041
1042#
1043# LED drivers
1044#
1045
1046#
1047# LED Triggers
1048#
1049
1050#
1051# InfiniBand support
1052#
1053
1054#
1055# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
1056#
1057
1058#
1059# Real Time Clock
1060#
1061CONFIG_RTC_LIB=y
1062CONFIG_RTC_CLASS=y
1063CONFIG_RTC_HCTOSYS=y
1064CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
1065# CONFIG_RTC_DEBUG is not set
1066
1067#
1068# RTC interfaces
1069#
1070CONFIG_RTC_INTF_SYSFS=y
1071CONFIG_RTC_INTF_PROC=y
1072CONFIG_RTC_INTF_DEV=y
1073# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
1074
1075#
1076# RTC drivers
1077#
1078# CONFIG_RTC_DRV_X1205 is not set
1079# CONFIG_RTC_DRV_DS1307 is not set
1080# CONFIG_RTC_DRV_DS1553 is not set
1081# CONFIG_RTC_DRV_ISL1208 is not set
1082# CONFIG_RTC_DRV_DS1672 is not set
1083# CONFIG_RTC_DRV_DS1742 is not set
1084# CONFIG_RTC_DRV_PCF8563 is not set
1085# CONFIG_RTC_DRV_PCF8583 is not set
1086# CONFIG_RTC_DRV_RS5C348 is not set
1087# CONFIG_RTC_DRV_RS5C372 is not set
1088# CONFIG_RTC_DRV_M48T86 is not set
1089# CONFIG_RTC_DRV_TEST is not set
1090# CONFIG_RTC_DRV_MAX6902 is not set
1091# CONFIG_RTC_DRV_V3020 is not set
1092CONFIG_RTC_DRV_BFIN=y
1093
1094#
1095# DMA Engine support
1096#
1097# CONFIG_DMA_ENGINE is not set
1098
1099#
1100# DMA Clients
1101#
1102
1103#
1104# DMA Devices
1105#
1106
1107#
1108# Virtualization
1109#
1110
1111#
1112# PBX support
1113#
1114# CONFIG_PBX is not set
1115
1116#
1117# File systems
1118#
1119CONFIG_EXT2_FS=y
1120CONFIG_EXT2_FS_XATTR=y
1121# CONFIG_EXT2_FS_POSIX_ACL is not set
1122# CONFIG_EXT2_FS_SECURITY is not set
1123# CONFIG_EXT3_FS is not set
1124# CONFIG_EXT4DEV_FS is not set
1125CONFIG_FS_MBCACHE=y
1126# CONFIG_REISERFS_FS is not set
1127# CONFIG_JFS_FS is not set
1128# CONFIG_FS_POSIX_ACL is not set
1129# CONFIG_XFS_FS is not set
1130# CONFIG_GFS2_FS is not set
1131# CONFIG_OCFS2_FS is not set
1132# CONFIG_MINIX_FS is not set
1133# CONFIG_ROMFS_FS is not set
1134CONFIG_INOTIFY=y
1135CONFIG_INOTIFY_USER=y
1136# CONFIG_QUOTA is not set
1137CONFIG_DNOTIFY=y
1138# CONFIG_AUTOFS_FS is not set
1139# CONFIG_AUTOFS4_FS is not set
1140# CONFIG_FUSE_FS is not set
1141
1142#
1143# CD-ROM/DVD Filesystems
1144#
1145# CONFIG_ISO9660_FS is not set
1146# CONFIG_UDF_FS is not set
1147
1148#
1149# DOS/FAT/NT Filesystems
1150#
1151# CONFIG_MSDOS_FS is not set
1152# CONFIG_VFAT_FS is not set
1153# CONFIG_NTFS_FS is not set
1154
1155#
1156# Pseudo filesystems
1157#
1158CONFIG_PROC_FS=y
1159CONFIG_PROC_SYSCTL=y
1160CONFIG_SYSFS=y
1161# CONFIG_TMPFS is not set
1162# CONFIG_HUGETLB_PAGE is not set
1163CONFIG_RAMFS=y
1164# CONFIG_CONFIGFS_FS is not set
1165
1166#
1167# Miscellaneous filesystems
1168#
1169# CONFIG_ADFS_FS is not set
1170# CONFIG_AFFS_FS is not set
1171# CONFIG_HFS_FS is not set
1172# CONFIG_HFSPLUS_FS is not set
1173# CONFIG_BEFS_FS is not set
1174# CONFIG_BFS_FS is not set
1175# CONFIG_EFS_FS is not set
1176CONFIG_YAFFS_FS=m
1177CONFIG_YAFFS_YAFFS1=y
1178# CONFIG_YAFFS_DOES_ECC is not set
1179CONFIG_YAFFS_YAFFS2=y
1180CONFIG_YAFFS_AUTO_YAFFS2=y
1181# CONFIG_YAFFS_DISABLE_LAZY_LOAD is not set
1182CONFIG_YAFFS_CHECKPOINT_RESERVED_BLOCKS=10
1183# CONFIG_YAFFS_DISABLE_WIDE_TNODES is not set
1184# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set
1185CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y
1186CONFIG_JFFS2_FS=m
1187CONFIG_JFFS2_FS_DEBUG=0
1188CONFIG_JFFS2_FS_WRITEBUFFER=y
1189# CONFIG_JFFS2_SUMMARY is not set
1190# CONFIG_JFFS2_FS_XATTR is not set
1191# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1192CONFIG_JFFS2_ZLIB=y
1193CONFIG_JFFS2_RTIME=y
1194# CONFIG_JFFS2_RUBIN is not set
1195# CONFIG_CRAMFS is not set
1196# CONFIG_VXFS_FS is not set
1197# CONFIG_HPFS_FS is not set
1198# CONFIG_QNX4FS_FS is not set
1199# CONFIG_SYSV_FS is not set
1200# CONFIG_UFS_FS is not set
1201
1202#
1203# Network File Systems
1204#
1205CONFIG_NFS_FS=m
1206CONFIG_NFS_V3=y
1207# CONFIG_NFS_V3_ACL is not set
1208# CONFIG_NFS_V4 is not set
1209# CONFIG_NFS_DIRECTIO is not set
1210# CONFIG_NFSD is not set
1211CONFIG_LOCKD=m
1212CONFIG_LOCKD_V4=y
1213CONFIG_NFS_COMMON=y
1214CONFIG_SUNRPC=m
1215# CONFIG_RPCSEC_GSS_KRB5 is not set
1216# CONFIG_RPCSEC_GSS_SPKM3 is not set
1217CONFIG_SMB_FS=m
1218# CONFIG_SMB_NLS_DEFAULT is not set
1219# CONFIG_CIFS is not set
1220# CONFIG_NCP_FS is not set
1221# CONFIG_CODA_FS is not set
1222# CONFIG_AFS_FS is not set
1223# CONFIG_9P_FS is not set
1224
1225#
1226# Partition Types
1227#
1228# CONFIG_PARTITION_ADVANCED is not set
1229CONFIG_MSDOS_PARTITION=y
1230
1231#
1232# Native Language Support
1233#
1234CONFIG_NLS=m
1235CONFIG_NLS_DEFAULT="iso8859-1"
1236# CONFIG_NLS_CODEPAGE_437 is not set
1237# CONFIG_NLS_CODEPAGE_737 is not set
1238# CONFIG_NLS_CODEPAGE_775 is not set
1239# CONFIG_NLS_CODEPAGE_850 is not set
1240# CONFIG_NLS_CODEPAGE_852 is not set
1241# CONFIG_NLS_CODEPAGE_855 is not set
1242# CONFIG_NLS_CODEPAGE_857 is not set
1243# CONFIG_NLS_CODEPAGE_860 is not set
1244# CONFIG_NLS_CODEPAGE_861 is not set
1245# CONFIG_NLS_CODEPAGE_862 is not set
1246# CONFIG_NLS_CODEPAGE_863 is not set
1247# CONFIG_NLS_CODEPAGE_864 is not set
1248# CONFIG_NLS_CODEPAGE_865 is not set
1249# CONFIG_NLS_CODEPAGE_866 is not set
1250# CONFIG_NLS_CODEPAGE_869 is not set
1251# CONFIG_NLS_CODEPAGE_936 is not set
1252# CONFIG_NLS_CODEPAGE_950 is not set
1253# CONFIG_NLS_CODEPAGE_932 is not set
1254# CONFIG_NLS_CODEPAGE_949 is not set
1255# CONFIG_NLS_CODEPAGE_874 is not set
1256# CONFIG_NLS_ISO8859_8 is not set
1257# CONFIG_NLS_CODEPAGE_1250 is not set
1258# CONFIG_NLS_CODEPAGE_1251 is not set
1259# CONFIG_NLS_ASCII is not set
1260# CONFIG_NLS_ISO8859_1 is not set
1261# CONFIG_NLS_ISO8859_2 is not set
1262# CONFIG_NLS_ISO8859_3 is not set
1263# CONFIG_NLS_ISO8859_4 is not set
1264# CONFIG_NLS_ISO8859_5 is not set
1265# CONFIG_NLS_ISO8859_6 is not set
1266# CONFIG_NLS_ISO8859_7 is not set
1267# CONFIG_NLS_ISO8859_9 is not set
1268# CONFIG_NLS_ISO8859_13 is not set
1269# CONFIG_NLS_ISO8859_14 is not set
1270# CONFIG_NLS_ISO8859_15 is not set
1271# CONFIG_NLS_KOI8_R is not set
1272# CONFIG_NLS_KOI8_U is not set
1273# CONFIG_NLS_UTF8 is not set
1274
1275#
1276# Distributed Lock Manager
1277#
1278# CONFIG_DLM is not set
1279
1280#
1281# Profiling support
1282#
1283# CONFIG_PROFILING is not set
1284
1285#
1286# Kernel hacking
1287#
1288# CONFIG_PRINTK_TIME is not set
1289CONFIG_ENABLE_MUST_CHECK=y
1290# CONFIG_MAGIC_SYSRQ is not set
1291# CONFIG_UNUSED_SYMBOLS is not set
1292# CONFIG_DEBUG_FS is not set
1293# CONFIG_HEADERS_CHECK is not set
1294# CONFIG_DEBUG_KERNEL is not set
1295CONFIG_LOG_BUF_SHIFT=14
1296# CONFIG_DEBUG_BUGVERBOSE is not set
1297# CONFIG_DEBUG_SERIAL_EARLY_INIT is not set
1298CONFIG_DEBUG_HUNT_FOR_ZERO=y
1299# CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE is not set
1300CONFIG_CPLB_INFO=y
1301CONFIG_ACCESS_CHECK=y
1302
1303#
1304# Security options
1305#
1306# CONFIG_KEYS is not set
1307CONFIG_SECURITY=y
1308# CONFIG_SECURITY_NETWORK is not set
1309CONFIG_SECURITY_CAPABILITIES=y
1310
1311#
1312# Cryptographic options
1313#
1314# CONFIG_CRYPTO is not set
1315
1316#
1317# Library routines
1318#
1319CONFIG_BITREVERSE=y
1320CONFIG_CRC_CCITT=m
1321# CONFIG_CRC16 is not set
1322CONFIG_CRC32=y
1323# CONFIG_LIBCRC32C is not set
1324CONFIG_ZLIB_INFLATE=y
1325CONFIG_ZLIB_DEFLATE=m
1326CONFIG_PLIST=y
1327CONFIG_IOMAP_COPY=y
diff --git a/arch/blackfin/kernel/bfin_dma_5xx.c b/arch/blackfin/kernel/bfin_dma_5xx.c
index 0ccb0dc3f833..069a896a8f26 100644
--- a/arch/blackfin/kernel/bfin_dma_5xx.c
+++ b/arch/blackfin/kernel/bfin_dma_5xx.c
@@ -595,7 +595,7 @@ unsigned short get_dma_curr_ycount(unsigned int channel)
595} 595}
596EXPORT_SYMBOL(get_dma_curr_ycount); 596EXPORT_SYMBOL(get_dma_curr_ycount);
597 597
598void *_dma_memcpy(void *dest, const void *src, size_t size) 598static void *__dma_memcpy(void *dest, const void *src, size_t size)
599{ 599{
600 int direction; /* 1 - address decrease, 0 - address increase */ 600 int direction; /* 1 - address decrease, 0 - address increase */
601 int flag_align; /* 1 - address aligned, 0 - address unaligned */ 601 int flag_align; /* 1 - address aligned, 0 - address unaligned */
@@ -744,8 +744,8 @@ void *dma_memcpy(void *dest, const void *src, size_t size)
744 bulk = (size >> 16) << 16; 744 bulk = (size >> 16) << 16;
745 rest = size - bulk; 745 rest = size - bulk;
746 if (bulk) 746 if (bulk)
747 _dma_memcpy(dest, src, bulk); 747 __dma_memcpy(dest, src, bulk);
748 addr = _dma_memcpy(dest+bulk, src+bulk, rest); 748 addr = __dma_memcpy(dest+bulk, src+bulk, rest);
749 return addr; 749 return addr;
750} 750}
751 751
diff --git a/arch/blackfin/kernel/bfin_gpio.c b/arch/blackfin/kernel/bfin_gpio.c
index 3f49fae1cb1f..bb1f4fb2467c 100644
--- a/arch/blackfin/kernel/bfin_gpio.c
+++ b/arch/blackfin/kernel/bfin_gpio.c
@@ -138,7 +138,7 @@ static unsigned int sic_iwr_irqs[gpio_bank(MAX_BLACKFIN_GPIOS)] = {IRQ_PROG0_INT
138 138
139inline int check_gpio(unsigned short gpio) 139inline int check_gpio(unsigned short gpio)
140{ 140{
141 if (gpio > MAX_BLACKFIN_GPIOS) 141 if (gpio >= MAX_BLACKFIN_GPIOS)
142 return -EINVAL; 142 return -EINVAL;
143 return 0; 143 return 0;
144} 144}
@@ -494,19 +494,24 @@ u32 gpio_pm_setup(void)
494 gpio_bank_saved[bank].dir = gpio_bankb[bank]->dir; 494 gpio_bank_saved[bank].dir = gpio_bankb[bank]->dir;
495 gpio_bank_saved[bank].edge = gpio_bankb[bank]->edge; 495 gpio_bank_saved[bank].edge = gpio_bankb[bank]->edge;
496 gpio_bank_saved[bank].both = gpio_bankb[bank]->both; 496 gpio_bank_saved[bank].both = gpio_bankb[bank]->both;
497 gpio_bank_saved[bank].reserved = reserved_map[bank];
497 498
498 gpio = i; 499 gpio = i;
499 500
500 while (mask) { 501 while (mask) {
501 if (mask & 1) { 502 if (mask & 1) {
502 bfin_gpio_wakeup_type(gpio, wakeup_flags_map[gpio]); 503 reserved_map[gpio_bank(gpio)] |=
504 gpio_bit(gpio);
505 bfin_gpio_wakeup_type(gpio,
506 wakeup_flags_map[gpio]);
503 set_gpio_data(gpio, 0); /*Clear*/ 507 set_gpio_data(gpio, 0); /*Clear*/
504 } 508 }
505 gpio++; 509 gpio++;
506 mask >>= 1; 510 mask >>= 1;
507 } 511 }
508 512
509 sic_iwr |= 1 << (sic_iwr_irqs[bank] - (IRQ_CORETMR + 1)); 513 sic_iwr |= 1 <<
514 (sic_iwr_irqs[bank] - (IRQ_CORETMR + 1));
510 gpio_bankb[bank]->maskb_set = wakeup_map[gpio_bank(i)]; 515 gpio_bankb[bank]->maskb_set = wakeup_map[gpio_bank(i)];
511 } 516 }
512 } 517 }
@@ -535,6 +540,9 @@ void gpio_pm_restore(void)
535 gpio_bankb[bank]->polar = gpio_bank_saved[bank].polar; 540 gpio_bankb[bank]->polar = gpio_bank_saved[bank].polar;
536 gpio_bankb[bank]->edge = gpio_bank_saved[bank].edge; 541 gpio_bankb[bank]->edge = gpio_bank_saved[bank].edge;
537 gpio_bankb[bank]->both = gpio_bank_saved[bank].both; 542 gpio_bankb[bank]->both = gpio_bank_saved[bank].both;
543
544 reserved_map[bank] = gpio_bank_saved[bank].reserved;
545
538 } 546 }
539 547
540 gpio_bankb[bank]->maskb = gpio_bank_saved[bank].maskb; 548 gpio_bankb[bank]->maskb = gpio_bank_saved[bank].maskb;
diff --git a/arch/blackfin/kernel/entry.S b/arch/blackfin/kernel/entry.S
index 5880b270bd50..65c5ba4260b0 100644
--- a/arch/blackfin/kernel/entry.S
+++ b/arch/blackfin/kernel/entry.S
@@ -58,10 +58,12 @@ ENTRY(_ret_from_fork)
58 RESTORE_ALL_SYS 58 RESTORE_ALL_SYS
59 p0 = reti; 59 p0 = reti;
60 jump (p0); 60 jump (p0);
61ENDPROC(_ret_from_fork)
61 62
62ENTRY(_sys_fork) 63ENTRY(_sys_fork)
63 r0 = -EINVAL; 64 r0 = -EINVAL;
64 rts; 65 rts;
66ENDPROC(_sys_fork)
65 67
66ENTRY(_sys_vfork) 68ENTRY(_sys_vfork)
67 r0 = sp; 69 r0 = sp;
@@ -72,6 +74,7 @@ ENTRY(_sys_vfork)
72 SP += 12; 74 SP += 12;
73 rets = [sp++]; 75 rets = [sp++];
74 rts; 76 rts;
77ENDPROC(_sys_vfork)
75 78
76ENTRY(_sys_clone) 79ENTRY(_sys_clone)
77 r0 = sp; 80 r0 = sp;
@@ -82,6 +85,7 @@ ENTRY(_sys_clone)
82 SP += 12; 85 SP += 12;
83 rets = [sp++]; 86 rets = [sp++];
84 rts; 87 rts;
88ENDPROC(_sys_clone)
85 89
86ENTRY(_sys_rt_sigreturn) 90ENTRY(_sys_rt_sigreturn)
87 r0 = sp; 91 r0 = sp;
@@ -92,3 +96,4 @@ ENTRY(_sys_rt_sigreturn)
92 SP += 12; 96 SP += 12;
93 rets = [sp++]; 97 rets = [sp++];
94 rts; 98 rts;
99ENDPROC(_sys_rt_sigreturn)
diff --git a/arch/blackfin/kernel/irqchip.c b/arch/blackfin/kernel/irqchip.c
index df5bf022cf79..80996a1a94ca 100644
--- a/arch/blackfin/kernel/irqchip.c
+++ b/arch/blackfin/kernel/irqchip.c
@@ -91,7 +91,7 @@ int show_interrupts(struct seq_file *p, void *v)
91} 91}
92 92
93/* 93/*
94 * do_IRQ handles all hardware IRQ's. Decoded IRQs should not 94 * do_IRQ handles all hardware IRQs. Decoded IRQs should not
95 * come via this function. Instead, they should provide their 95 * come via this function. Instead, they should provide their
96 * own 'handler' 96 * own 'handler'
97 */ 97 */
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index 02dc74301920..a24fa1ab802b 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -61,7 +61,7 @@ EXPORT_SYMBOL(memory_mtd_start);
61EXPORT_SYMBOL(mtd_size); 61EXPORT_SYMBOL(mtd_size);
62#endif 62#endif
63 63
64char command_line[COMMAND_LINE_SIZE]; 64char __initdata command_line[COMMAND_LINE_SIZE];
65 65
66#if defined(CONFIG_BLKFIN_DCACHE) || defined(CONFIG_BLKFIN_CACHE) 66#if defined(CONFIG_BLKFIN_DCACHE) || defined(CONFIG_BLKFIN_CACHE)
67static void generate_cpl_tables(void); 67static void generate_cpl_tables(void);
@@ -90,7 +90,7 @@ void __init bf53x_cache_init(void)
90#endif 90#endif
91} 91}
92 92
93void bf53x_relocate_l1_mem(void) 93void __init bf53x_relocate_l1_mem(void)
94{ 94{
95 unsigned long l1_code_length; 95 unsigned long l1_code_length;
96 unsigned long l1_data_a_length; 96 unsigned long l1_data_a_length;
@@ -205,7 +205,6 @@ void __init setup_arch(char **cmdline_p)
205#endif 205#endif
206 206
207#if defined(CONFIG_CMDLINE_BOOL) 207#if defined(CONFIG_CMDLINE_BOOL)
208 memset(command_line, 0, sizeof(command_line));
209 strncpy(&command_line[0], CONFIG_CMDLINE, sizeof(command_line)); 208 strncpy(&command_line[0], CONFIG_CMDLINE, sizeof(command_line));
210 command_line[sizeof(command_line) - 1] = 0; 209 command_line[sizeof(command_line) - 1] = 0;
211#endif 210#endif
@@ -213,7 +212,7 @@ void __init setup_arch(char **cmdline_p)
213 /* Keep a copy of command line */ 212 /* Keep a copy of command line */
214 *cmdline_p = &command_line[0]; 213 *cmdline_p = &command_line[0];
215 memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); 214 memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
216 boot_command_line[COMMAND_LINE_SIZE - 1] = 0; 215 boot_command_line[COMMAND_LINE_SIZE - 1] = '\0';
217 216
218 /* setup memory defaults from the user config */ 217 /* setup memory defaults from the user config */
219 physical_mem_end = 0; 218 physical_mem_end = 0;
@@ -411,7 +410,7 @@ static int __init topology_init(void)
411subsys_initcall(topology_init); 410subsys_initcall(topology_init);
412 411
413#if defined(CONFIG_BLKFIN_DCACHE) || defined(CONFIG_BLKFIN_CACHE) 412#if defined(CONFIG_BLKFIN_DCACHE) || defined(CONFIG_BLKFIN_CACHE)
414u16 lock_kernel_check(u32 start, u32 end) 413static u16 __init lock_kernel_check(u32 start, u32 end)
415{ 414{
416 if ((start <= (u32) _stext && end >= (u32) _end) 415 if ((start <= (u32) _stext && end >= (u32) _end)
417 || (start >= (u32) _stext && end <= (u32) _end)) 416 || (start >= (u32) _stext && end <= (u32) _end))
@@ -471,6 +470,67 @@ close_cplbtab(struct cplb_tab *table)
471 return 0; 470 return 0;
472} 471}
473 472
473/* helper function */
474static void __fill_code_cplbtab(struct cplb_tab *t, int i,
475 u32 a_start, u32 a_end)
476{
477 if (cplb_data[i].psize) {
478 fill_cplbtab(t,
479 cplb_data[i].start,
480 cplb_data[i].end,
481 cplb_data[i].psize,
482 cplb_data[i].i_conf);
483 } else {
484#if (defined(CONFIG_BLKFIN_CACHE) && defined(ANOMALY_05000263))
485 if (i == SDRAM_KERN) {
486 fill_cplbtab(t,
487 cplb_data[i].start,
488 cplb_data[i].end,
489 SIZE_4M,
490 cplb_data[i].i_conf);
491 } else {
492#endif
493 fill_cplbtab(t,
494 cplb_data[i].start,
495 a_start,
496 SIZE_1M,
497 cplb_data[i].i_conf);
498 fill_cplbtab(t,
499 a_start,
500 a_end,
501 SIZE_4M,
502 cplb_data[i].i_conf);
503 fill_cplbtab(t, a_end,
504 cplb_data[i].end,
505 SIZE_1M,
506 cplb_data[i].i_conf);
507 }
508 }
509}
510
511static void __fill_data_cplbtab(struct cplb_tab *t, int i,
512 u32 a_start, u32 a_end)
513{
514 if (cplb_data[i].psize) {
515 fill_cplbtab(t,
516 cplb_data[i].start,
517 cplb_data[i].end,
518 cplb_data[i].psize,
519 cplb_data[i].d_conf);
520 } else {
521 fill_cplbtab(t,
522 cplb_data[i].start,
523 a_start, SIZE_1M,
524 cplb_data[i].d_conf);
525 fill_cplbtab(t, a_start,
526 a_end, SIZE_4M,
527 cplb_data[i].d_conf);
528 fill_cplbtab(t, a_end,
529 cplb_data[i].end,
530 SIZE_1M,
531 cplb_data[i].d_conf);
532 }
533}
474static void __init generate_cpl_tables(void) 534static void __init generate_cpl_tables(void)
475{ 535{
476 536
@@ -540,130 +600,78 @@ static void __init generate_cpl_tables(void)
540 cplb_data[RES_MEM].i_conf = SDRAM_INON_CHBL; 600 cplb_data[RES_MEM].i_conf = SDRAM_INON_CHBL;
541 601
542 for (i = ZERO_P; i <= L2_MEM; i++) { 602 for (i = ZERO_P; i <= L2_MEM; i++) {
603 if (!cplb_data[i].valid)
604 continue;
543 605
544 if (cplb_data[i].valid) { 606 as_1m = cplb_data[i].start % SIZE_1M;
545 607
546 as_1m = cplb_data[i].start % SIZE_1M; 608 /*
609 * We need to make sure all sections are properly 1M aligned
610 * However between Kernel Memory and the Kernel mtd section,
611 * depending on the rootfs size, there can be overlapping
612 * memory areas.
613 */
547 614
548 /* We need to make sure all sections are properly 1M aligned 615 if (as_1m && i != L1I_MEM && i != L1D_MEM) {
549 * However between Kernel Memory and the Kernel mtd section, depending on the
550 * rootfs size, there can be overlapping memory areas.
551 */
552
553 if (as_1m && i!=L1I_MEM && i!=L1D_MEM) {
554#ifdef CONFIG_MTD_UCLINUX 616#ifdef CONFIG_MTD_UCLINUX
555 if (i == SDRAM_RAM_MTD) { 617 if (i == SDRAM_RAM_MTD) {
556 if ((cplb_data[SDRAM_KERN].end + 1) > cplb_data[SDRAM_RAM_MTD].start) 618 if ((cplb_data[SDRAM_KERN].end + 1) >
557 cplb_data[SDRAM_RAM_MTD].start = (cplb_data[i].start & (-2*SIZE_1M)) + SIZE_1M; 619 cplb_data[SDRAM_RAM_MTD].start)
558 else 620 cplb_data[SDRAM_RAM_MTD].start =
559 cplb_data[SDRAM_RAM_MTD].start = (cplb_data[i].start & (-2*SIZE_1M)); 621 (cplb_data[i].start &
560 } else 622 (-2*SIZE_1M)) + SIZE_1M;
623 else
624 cplb_data[SDRAM_RAM_MTD].start =
625 (cplb_data[i].start &
626 (-2*SIZE_1M));
627 } else
561#endif 628#endif
562 printk(KERN_WARNING "Unaligned Start of %s at 0x%X\n", 629 printk(KERN_WARNING
563 cplb_data[i].name, cplb_data[i].start); 630 "Unaligned Start of %s at 0x%X\n",
564 } 631 cplb_data[i].name, cplb_data[i].start);
632 }
565 633
566 as = cplb_data[i].start % SIZE_4M; 634 as = cplb_data[i].start % SIZE_4M;
567 ae = cplb_data[i].end % SIZE_4M; 635 ae = cplb_data[i].end % SIZE_4M;
568
569 if (as)
570 a_start = cplb_data[i].start + (SIZE_4M - (as));
571 else
572 a_start = cplb_data[i].start;
573
574 a_end = cplb_data[i].end - ae;
575
576 for (j = INITIAL_T; j <= SWITCH_T; j++) {
577
578 switch (j) {
579 case INITIAL_T:
580 if (cplb_data[i].attr & INITIAL_T) {
581 t_i = &cplb.init_i;
582 t_d = &cplb.init_d;
583 process = 1;
584 } else
585 process = 0;
586 break;
587 case SWITCH_T:
588 if (cplb_data[i].attr & SWITCH_T) {
589 t_i = &cplb.switch_i;
590 t_d = &cplb.switch_d;
591 process = 1;
592 } else
593 process = 0;
594 break;
595 default:
596 process = 0;
597 break;
598 }
599 636
600 if (process) { 637 if (as)
601 if (cplb_data[i].attr & I_CPLB) { 638 a_start = cplb_data[i].start + (SIZE_4M - (as));
602 639 else
603 if (cplb_data[i].psize) { 640 a_start = cplb_data[i].start;
604 fill_cplbtab(t_i,
605 cplb_data[i].start,
606 cplb_data[i].end,
607 cplb_data[i].psize,
608 cplb_data[i].i_conf);
609 } else {
610 /*icplb_table */
611#if (defined(CONFIG_BLKFIN_CACHE) && defined(ANOMALY_05000263))
612 if (i == SDRAM_KERN) {
613 fill_cplbtab(t_i,
614 cplb_data[i].start,
615 cplb_data[i].end,
616 SIZE_4M,
617 cplb_data[i].i_conf);
618 } else
619#endif
620 {
621 fill_cplbtab(t_i,
622 cplb_data[i].start,
623 a_start,
624 SIZE_1M,
625 cplb_data[i].i_conf);
626 fill_cplbtab(t_i,
627 a_start,
628 a_end,
629 SIZE_4M,
630 cplb_data[i].i_conf);
631 fill_cplbtab(t_i, a_end,
632 cplb_data[i].end,
633 SIZE_1M,
634 cplb_data[i].i_conf);
635 }
636 }
637 641
638 } 642 a_end = cplb_data[i].end - ae;
639 if (cplb_data[i].attr & D_CPLB) {
640
641 if (cplb_data[i].psize) {
642 fill_cplbtab(t_d,
643 cplb_data[i].start,
644 cplb_data[i].end,
645 cplb_data[i].psize,
646 cplb_data[i].d_conf);
647 } else {
648/*dcplb_table*/
649 fill_cplbtab(t_d,
650 cplb_data[i].start,
651 a_start, SIZE_1M,
652 cplb_data[i].d_conf);
653 fill_cplbtab(t_d, a_start,
654 a_end, SIZE_4M,
655 cplb_data[i].d_conf);
656 fill_cplbtab(t_d, a_end,
657 cplb_data[i].end,
658 SIZE_1M,
659 cplb_data[i].d_conf);
660 643
661 } 644 for (j = INITIAL_T; j <= SWITCH_T; j++) {
662 645
663 } 646 switch (j) {
664 } 647 case INITIAL_T:
648 if (cplb_data[i].attr & INITIAL_T) {
649 t_i = &cplb.init_i;
650 t_d = &cplb.init_d;
651 process = 1;
652 } else
653 process = 0;
654 break;
655 case SWITCH_T:
656 if (cplb_data[i].attr & SWITCH_T) {
657 t_i = &cplb.switch_i;
658 t_d = &cplb.switch_d;
659 process = 1;
660 } else
661 process = 0;
662 break;
663 default:
664 process = 0;
665 break;
665 } 666 }
666 667
668 if (!process)
669 continue;
670 if (cplb_data[i].attr & I_CPLB)
671 __fill_code_cplbtab(t_i, i, a_start, a_end);
672
673 if (cplb_data[i].attr & D_CPLB)
674 __fill_data_cplbtab(t_d, i, a_start, a_end);
667 } 675 }
668 } 676 }
669 677
@@ -681,7 +689,7 @@ static void __init generate_cpl_tables(void)
681 689
682#endif 690#endif
683 691
684static inline u_long get_vco(void) 692static u_long get_vco(void)
685{ 693{
686 u_long msel; 694 u_long msel;
687 u_long vco; 695 u_long vco;
@@ -889,8 +897,8 @@ struct seq_operations cpuinfo_op = {
889 .show = show_cpuinfo, 897 .show = show_cpuinfo,
890}; 898};
891 899
892void cmdline_init(unsigned long r0) 900void __init cmdline_init(const char *r0)
893{ 901{
894 if (r0) 902 if (r0)
895 strncpy(command_line, (char *)r0, COMMAND_LINE_SIZE); 903 strncpy(command_line, r0, COMMAND_LINE_SIZE);
896} 904}
diff --git a/arch/blackfin/kernel/traps.c b/arch/blackfin/kernel/traps.c
index 9932edee8cb4..5ab87b0b92dd 100644
--- a/arch/blackfin/kernel/traps.c
+++ b/arch/blackfin/kernel/traps.c
@@ -557,7 +557,7 @@ void dump_bfin_regs(struct pt_regs *fp, void *retaddr)
557 break; 557 break;
558#ifndef CONFIG_DEBUG_HWERR 558#ifndef CONFIG_DEBUG_HWERR
559 /* If one of the last few instructions was a STI 559 /* If one of the last few instructions was a STI
560 * it is likily that the error occured awhile ago 560 * it is likely that the error occured awhile ago
561 * and we just noticed 561 * and we just noticed
562 */ 562 */
563 if (x >= 0x0040 && x <= 0x0047 && i <= 0) 563 if (x >= 0x0040 && x <= 0x0047 && i <= 0)
diff --git a/arch/blackfin/kernel/vmlinux.lds.S b/arch/blackfin/kernel/vmlinux.lds.S
index 86fe67995802..1ef1e36b3957 100644
--- a/arch/blackfin/kernel/vmlinux.lds.S
+++ b/arch/blackfin/kernel/vmlinux.lds.S
@@ -7,7 +7,7 @@
7 * Description: Master linker script for blackfin architecture 7 * Description: Master linker script for blackfin architecture
8 * 8 *
9 * Modified: 9 * Modified:
10 * Copyright 2004-2006 Analog Devices Inc. 10 * Copyright 2004-2007 Analog Devices Inc.
11 * 11 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/ 12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
13 * 13 *
@@ -32,97 +32,54 @@
32#include <asm-generic/vmlinux.lds.h> 32#include <asm-generic/vmlinux.lds.h>
33#include <asm/mem_map.h> 33#include <asm/mem_map.h>
34 34
35
36OUTPUT_FORMAT("elf32-bfin") 35OUTPUT_FORMAT("elf32-bfin")
37ENTRY(__start) 36ENTRY(__start)
38_jiffies = _jiffies_64; 37_jiffies = _jiffies_64;
39 38
40MEMORY
41{
42 ram : ORIGIN = CONFIG_BOOT_LOAD, LENGTH = (CONFIG_MEM_SIZE * 1024 * 1024) - (CONFIG_BOOT_LOAD)
43 l1_data_a : ORIGIN = L1_DATA_A_START, LENGTH = L1_DATA_A_LENGTH
44 l1_data_b : ORIGIN = L1_DATA_B_START, LENGTH = L1_DATA_B_LENGTH
45 l1_code : ORIGIN = L1_CODE_START, LENGTH = L1_CODE_LENGTH
46 l1_scratch : ORIGIN = L1_SCRATCH_START, LENGTH = L1_SCRATCH_LENGTH
47}
48
49SECTIONS 39SECTIONS
50{ 40{
51 . = CONFIG_BOOT_LOAD; 41 . = CONFIG_BOOT_LOAD;
52
53 .text : 42 .text :
54 { 43 {
55 _text = .; 44 __text = .;
56 __stext = .; 45 _text = .;
46 __stext = .;
57 TEXT_TEXT 47 TEXT_TEXT
58 SCHED_TEXT 48 SCHED_TEXT
49 LOCK_TEXT
59 *(.text.lock) 50 *(.text.lock)
51 *(.fixup)
52
60 . = ALIGN(16); 53 . = ALIGN(16);
61 ___start___ex_table = .; 54 ___start___ex_table = .;
62 *(__ex_table) 55 *(__ex_table)
63 ___stop___ex_table = .; 56 ___stop___ex_table = .;
64
65 *($code)
66 *(.rodata)
67 *(.rodata.*)
68 *(__vermagic) /* Kernel version magic */
69 *(.rodata1)
70 *(.fixup)
71 *(.spinlock.text)
72 57
73 /* Kernel symbol table: Normal symbols */
74 . = ALIGN(4); 58 . = ALIGN(4);
75 ___start___ksymtab = .;
76 *(__ksymtab)
77 ___stop___ksymtab = .;
78
79 /* Kernel symbol table: GPL-only symbols */
80 ___start___ksymtab_gpl = .;
81 *(__ksymtab_gpl)
82 ___stop___ksymtab_gpl = .;
83
84 /* Kernel symbol table: Normal unused symbols */ \
85 ___start___ksymtab_unused = .;
86 *(__ksymtab_unused)
87 ___stop___ksymtab_unused = .;
88
89 /* Kernel symbol table: GPL-only unused symbols */
90 ___start___ksymtab_unused_gpl = .;
91 *(__ksymtab_unused_gpl)
92 ___stop___ksymtab_unused_gpl = .;
93
94
95 /* Kernel symbol table: GPL-future symbols */
96 ___start___ksymtab_gpl_future = .;
97 *(__ksymtab_gpl_future)
98 ___stop___ksymtab_gpl_future = .;
99
100 /* Kernel symbol table: Normal symbols */
101 ___start___kcrctab = .;
102 *(__kcrctab)
103 ___stop___kcrctab = .;
104
105 /* Kernel symbol table: GPL-only symbols */
106 ___start___kcrctab_gpl = .;
107 *(__kcrctab_gpl)
108 ___stop___kcrctab_gpl = .;
109
110 /* Kernel symbol table: GPL-future symbols */
111 ___start___kcrctab_gpl_future = .;
112 *(__kcrctab_gpl_future)
113 ___stop___kcrctab_gpl_future = .;
114
115 /* Kernel symbol table: strings */
116 *(__ksymtab_strings)
117
118 . = ALIGN(4);
119 __etext = .; 59 __etext = .;
120 } > ram 60 }
61
62 RODATA
63
64 .data :
65 {
66 __sdata = .;
67 . = ALIGN(0x2000);
68 *(.data.init_task)
69 DATA_DATA
70 CONSTRUCTORS
71
72 . = ALIGN(32);
73 *(.data.cacheline_aligned)
74
75 . = ALIGN(0x2000);
76 __edata = .;
77 }
121 78
79 ___init_begin = .;
122 .init : 80 .init :
123 { 81 {
124 . = ALIGN(4096); 82 . = ALIGN(4096);
125 ___init_begin = .;
126 __sinittext = .; 83 __sinittext = .;
127 *(.init.text) 84 *(.init.text)
128 __einittext = .; 85 __einittext = .;
@@ -148,39 +105,39 @@ SECTIONS
148 *(.init.ramfs) 105 *(.init.ramfs)
149 ___initramfs_end = .; 106 ___initramfs_end = .;
150 . = ALIGN(4); 107 . = ALIGN(4);
151 ___init_end = .; 108 }
152 } > ram
153 109
154 __l1_lma_start = .; 110 __l1_lma_start = .;
155 111
156 .text_l1 : 112 .text_l1 L1_CODE_START : AT(LOADADDR(.init) + SIZEOF(.init))
157 { 113 {
158 . = ALIGN(4); 114 . = ALIGN(4);
159 __stext_l1 = .; 115 __stext_l1 = .;
160 *(.l1.text) 116 *(.l1.text)
161 117
162 . = ALIGN(4); 118 . = ALIGN(4);
163 __etext_l1 = .; 119 __etext_l1 = .;
164 } > l1_code AT > ram 120 }
165 121
166 .data_l1 : 122 .data_l1 L1_DATA_A_START : AT(LOADADDR(.text_l1) + SIZEOF(.text_l1))
167 { 123 {
168 . = ALIGN(4); 124 . = ALIGN(4);
169 __sdata_l1 = .; 125 __sdata_l1 = .;
170 *(.l1.data) 126 *(.l1.data)
171 __edata_l1 = .; 127 __edata_l1 = .;
172 128
173 . = ALIGN(4); 129 . = ALIGN(4);
174 __sbss_l1 = .; 130 __sbss_l1 = .;
175 *(.l1.bss) 131 *(.l1.bss)
176 132
177 . = ALIGN(32); 133 . = ALIGN(32);
178 *(.data_l1.cacheline_aligned) 134 *(.data_l1.cacheline_aligned)
179 135
180 . = ALIGN(4); 136 . = ALIGN(4);
181 __ebss_l1 = .; 137 __ebss_l1 = .;
182 } > l1_data_a AT > ram 138 }
183 .data_b_l1 : 139
140 .data_b_l1 L1_DATA_B_START : AT(LOADADDR(.data_l1) + SIZEOF(.data_l1))
184 { 141 {
185 . = ALIGN(4); 142 . = ALIGN(4);
186 __sdata_b_l1 = .; 143 __sdata_b_l1 = .;
@@ -193,36 +150,25 @@ SECTIONS
193 150
194 . = ALIGN(4); 151 . = ALIGN(4);
195 __ebss_b_l1 = .; 152 __ebss_b_l1 = .;
196 } > l1_data_b AT > ram 153 }
197 154
198 .data : 155 ___init_end = LOADADDR(.data_b_l1) + SIZEOF(.data_b_l1);
199 {
200 __sdata = .;
201 . = ALIGN(0x2000);
202 *(.data.init_task)
203 DATA_DATA
204 156
205 . = ALIGN(32); 157 .bss LOADADDR(.data_b_l1) + SIZEOF(.data_b_l1) :
206 *(.data.cacheline_aligned)
207
208 . = ALIGN(0x2000);
209 __edata = .;
210 } > ram
211
212 /DISCARD/ : { /* Exit code and data*/
213 *(.exit.text)
214 *(.exit.data)
215 *(.exitcall.exit)
216 } > ram
217
218 .bss :
219 { 158 {
220 . = ALIGN(4); 159 . = ALIGN(4);
221 ___bss_start = .; 160 ___bss_start = .;
222 *(.bss) 161 *(.bss)
223 *(COMMON) 162 *(COMMON)
224 . = ALIGN(4); 163 . = ALIGN(4);
225 ___bss_stop = .; 164 ___bss_stop = .;
226 __end = . ; 165 __end = .;
227 } > ram 166 }
167
168 /DISCARD/ :
169 {
170 *(.exit.text)
171 *(.exit.data)
172 *(.exitcall.exit)
173 }
228} 174}
diff --git a/arch/blackfin/lib/divsi3.S b/arch/blackfin/lib/divsi3.S
index 3e29861852b2..2ac59c70dd94 100644
--- a/arch/blackfin/lib/divsi3.S
+++ b/arch/blackfin/lib/divsi3.S
@@ -44,6 +44,7 @@
44 */ 44 */
45 45
46.global ___divsi3; 46.global ___divsi3;
47.type ___divsi3, STT_FUNC;
47 48
48#ifdef CONFIG_ARITHMETIC_OPS_L1 49#ifdef CONFIG_ARITHMETIC_OPS_L1
49.section .l1.text 50.section .l1.text
@@ -214,3 +215,5 @@ ___divsi3 :
214.Lret_zero: 215.Lret_zero:
215 R0 = 0; 216 R0 = 0;
216 RTS; 217 RTS;
218
219.size ___divsi3, .-___divsi3
diff --git a/arch/blackfin/lib/ins.S b/arch/blackfin/lib/ins.S
index 7d5e9846311d..a17cc77ac36f 100644
--- a/arch/blackfin/lib/ins.S
+++ b/arch/blackfin/lib/ins.S
@@ -46,7 +46,7 @@ ENTRY(_insl)
46.Llong_loop_e: NOP; 46.Llong_loop_e: NOP;
47 sti R3; 47 sti R3;
48 RTS; 48 RTS;
49 49ENDPROC(_insl)
50 50
51ENTRY(_insw) 51ENTRY(_insw)
52 P0 = R0; /* P0 = port */ 52 P0 = R0; /* P0 = port */
@@ -61,6 +61,7 @@ ENTRY(_insw)
61.Lword_loop_e: NOP; 61.Lword_loop_e: NOP;
62 sti R3; 62 sti R3;
63 RTS; 63 RTS;
64ENDPROC(_insw)
64 65
65ENTRY(_insb) 66ENTRY(_insb)
66 P0 = R0; /* P0 = port */ 67 P0 = R0; /* P0 = port */
@@ -75,3 +76,4 @@ ENTRY(_insb)
75.Lbyte_loop_e: NOP; 76.Lbyte_loop_e: NOP;
76 sti R3; 77 sti R3;
77 RTS; 78 RTS;
79ENDPROC(_insb)
diff --git a/arch/blackfin/lib/memchr.S b/arch/blackfin/lib/memchr.S
index 498122250d07..5da428134d32 100644
--- a/arch/blackfin/lib/memchr.S
+++ b/arch/blackfin/lib/memchr.S
@@ -67,4 +67,4 @@ ENTRY(_memchr)
67 R0 += -1; 67 R0 += -1;
68 RTS; 68 RTS;
69 69
70.size _memchr,.-_memchr 70ENDPROC(_memchr)
diff --git a/arch/blackfin/lib/memcmp.S b/arch/blackfin/lib/memcmp.S
index 5b9502368fc6..a6b8ee6a6bf2 100644
--- a/arch/blackfin/lib/memcmp.S
+++ b/arch/blackfin/lib/memcmp.S
@@ -107,4 +107,4 @@ ENTRY(_memcmp)
107 P3 = I1; 107 P3 = I1;
108 RTS; 108 RTS;
109 109
110.size _memcmp,.-_memcmp 110ENDPROC(_memcmp)
diff --git a/arch/blackfin/lib/memcpy.S b/arch/blackfin/lib/memcpy.S
index c1e00eff541c..34b5a91c215c 100644
--- a/arch/blackfin/lib/memcpy.S
+++ b/arch/blackfin/lib/memcpy.S
@@ -140,3 +140,5 @@ ENTRY(_memcpy)
140 B[P0--] = R1; 140 B[P0--] = R1;
141 141
142 RTS; 142 RTS;
143
144ENDPROC(_memcpy)
diff --git a/arch/blackfin/lib/memmove.S b/arch/blackfin/lib/memmove.S
index 2e5fb7f8df13..c371585e9dbd 100644
--- a/arch/blackfin/lib/memmove.S
+++ b/arch/blackfin/lib/memmove.S
@@ -100,4 +100,4 @@ ENTRY(_memmove)
100 P3 = I1; 100 P3 = I1;
101 RTS; 101 RTS;
102 102
103.size _memmove,.-_memmove 103ENDPROC(_memmove)
diff --git a/arch/blackfin/lib/memset.S b/arch/blackfin/lib/memset.S
index ba6d047568dd..8159136a29ea 100644
--- a/arch/blackfin/lib/memset.S
+++ b/arch/blackfin/lib/memset.S
@@ -106,4 +106,4 @@ ENTRY(_memset)
106 B[P0++] = R1; 106 B[P0++] = R1;
107 JUMP .Laligned; 107 JUMP .Laligned;
108 108
109.size _memset,.-_memset 109ENDPROC(_memset)
diff --git a/arch/blackfin/lib/modsi3.S b/arch/blackfin/lib/modsi3.S
index 528b8b1ccb34..ca1dd3973b39 100644
--- a/arch/blackfin/lib/modsi3.S
+++ b/arch/blackfin/lib/modsi3.S
@@ -77,3 +77,5 @@ ___modsi3:
77 R0 = 0; 77 R0 = 0;
78.LRETURN_R0: 78.LRETURN_R0:
79 RTS; 79 RTS;
80
81.size ___modsi3, .-___modsi3
diff --git a/arch/blackfin/lib/outs.S b/arch/blackfin/lib/outs.S
index f8c876fe8930..4c3da8ae094e 100644
--- a/arch/blackfin/lib/outs.S
+++ b/arch/blackfin/lib/outs.S
@@ -40,6 +40,7 @@ ENTRY(_outsl)
40.Llong_loop_s: R0 = [P1++]; 40.Llong_loop_s: R0 = [P1++];
41.Llong_loop_e: [P0] = R0; 41.Llong_loop_e: [P0] = R0;
42 RTS; 42 RTS;
43ENDPROC(_outsl)
43 44
44ENTRY(_outsw) 45ENTRY(_outsw)
45 P0 = R0; /* P0 = port */ 46 P0 = R0; /* P0 = port */
@@ -50,6 +51,7 @@ ENTRY(_outsw)
50.Lword_loop_s: R0 = W[P1++]; 51.Lword_loop_s: R0 = W[P1++];
51.Lword_loop_e: W[P0] = R0; 52.Lword_loop_e: W[P0] = R0;
52 RTS; 53 RTS;
54ENDPROC(_outsw)
53 55
54ENTRY(_outsb) 56ENTRY(_outsb)
55 P0 = R0; /* P0 = port */ 57 P0 = R0; /* P0 = port */
@@ -60,3 +62,4 @@ ENTRY(_outsb)
60.Lbyte_loop_s: R0 = B[P1++]; 62.Lbyte_loop_s: R0 = B[P1++];
61.Lbyte_loop_e: B[P0] = R0; 63.Lbyte_loop_e: B[P0] = R0;
62 RTS; 64 RTS;
65ENDPROC(_outsb)
diff --git a/arch/blackfin/lib/smulsi3_highpart.S b/arch/blackfin/lib/smulsi3_highpart.S
index 10b8f8da576f..e383cd3eca5d 100644
--- a/arch/blackfin/lib/smulsi3_highpart.S
+++ b/arch/blackfin/lib/smulsi3_highpart.S
@@ -28,3 +28,5 @@ ___smulsi3_highpart:
28 28
29 R0 = R0 + R1; 29 R0 = R0 + R1;
30 RTS; 30 RTS;
31
32.size ___smulsi3_highpart, .-___smulsi3_highpart
diff --git a/arch/blackfin/lib/udivsi3.S b/arch/blackfin/lib/udivsi3.S
index d39a12916259..58fd96d74766 100644
--- a/arch/blackfin/lib/udivsi3.S
+++ b/arch/blackfin/lib/udivsi3.S
@@ -296,3 +296,5 @@ ENTRY(___udivsi3)
296 R1 = R0 - R3; 296 R1 = R0 - R3;
297 IF CC R0 = R1; 297 IF CC R0 = R1;
298 RTS; 298 RTS;
299
300ENDPROC(___udivsi3)
diff --git a/arch/blackfin/lib/umodsi3.S b/arch/blackfin/lib/umodsi3.S
index b55ce96ab89f..4f2b76ee7626 100644
--- a/arch/blackfin/lib/umodsi3.S
+++ b/arch/blackfin/lib/umodsi3.S
@@ -34,7 +34,9 @@
34#endif 34#endif
35 35
36.extern ___udivsi3; 36.extern ___udivsi3;
37.type ___udivsi3, STT_FUNC;
37.globl ___umodsi3 38.globl ___umodsi3
39.type ___umodsi3, STT_FUNC;
38___umodsi3: 40___umodsi3:
39 41
40 CC=R0==0; 42 CC=R0==0;
@@ -64,3 +66,5 @@ ___umodsi3:
64 R0 = 0; 66 R0 = 0;
65.LRETURN_R0: 67.LRETURN_R0:
66 RTS; 68 RTS;
69
70.size ___umodsi3, .-___umodsi3
diff --git a/arch/blackfin/lib/umulsi3_highpart.S b/arch/blackfin/lib/umulsi3_highpart.S
index aac8218fb258..67b799351e3e 100644
--- a/arch/blackfin/lib/umulsi3_highpart.S
+++ b/arch/blackfin/lib/umulsi3_highpart.S
@@ -21,3 +21,5 @@ ___umulsi3_highpart:
21 R1 = PACK(R1.l,R0.h); 21 R1 = PACK(R1.l,R0.h);
22 R0 = R1 + R2; 22 R0 = R1 + R2;
23 RTS; 23 RTS;
24
25.size ___umulsi3_highpart, .-___umulsi3_highpart
diff --git a/arch/blackfin/mach-bf533/boards/cm_bf533.c b/arch/blackfin/mach-bf533/boards/cm_bf533.c
index 23a7f607df3f..edd31ce4f8d2 100644
--- a/arch/blackfin/mach-bf533/boards/cm_bf533.c
+++ b/arch/blackfin/mach-bf533/boards/cm_bf533.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * File: arch/blackfin/mach-bf533/boards/cm_bf533.c 2 * File: arch/blackfin/mach-bf533/boards/cm_bf533.c
3 * Based on: arch/blackfin/mach-bf533/boards/ezkit.c 3 * Based on: arch/blackfin/mach-bf533/boards/ezkit.c
4 * Author: Aidan Williams <aidan@nicta.com.au> Copright 2005 4 * Author: Aidan Williams <aidan@nicta.com.au> Copyright 2005
5 * 5 *
6 * Created: 2005 6 * Created: 2005
7 * Description: Board description file 7 * Description: Board description file
diff --git a/arch/blackfin/mach-bf533/boards/ezkit.c b/arch/blackfin/mach-bf533/boards/ezkit.c
index 747298ea907b..0b522d95160d 100644
--- a/arch/blackfin/mach-bf533/boards/ezkit.c
+++ b/arch/blackfin/mach-bf533/boards/ezkit.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * File: arch/blackfin/mach-bf533/ezkit.c 2 * File: arch/blackfin/mach-bf533/ezkit.c
3 * Based on: Orginal Work 3 * Based on: Original Work
4 * Author: Aidan Williams <aidan@nicta.com.au> 4 * Author: Aidan Williams <aidan@nicta.com.au>
5 * 5 *
6 * Created: 2005 6 * Created: 2005
diff --git a/arch/blackfin/mach-bf533/head.S b/arch/blackfin/mach-bf533/head.S
index 4db9e6240906..7e2aa8d0f44f 100644
--- a/arch/blackfin/mach-bf533/head.S
+++ b/arch/blackfin/mach-bf533/head.S
@@ -28,6 +28,7 @@
28 */ 28 */
29 29
30#include <linux/linkage.h> 30#include <linux/linkage.h>
31#include <linux/init.h>
31#include <asm/blackfin.h> 32#include <asm/blackfin.h>
32#if CONFIG_BFIN_KERNEL_CLOCK 33#if CONFIG_BFIN_KERNEL_CLOCK
33#include <asm/mach/mem_init.h> 34#include <asm/mach/mem_init.h>
@@ -45,19 +46,19 @@
45 46
46#define INITIAL_STACK 0xFFB01000 47#define INITIAL_STACK 0xFFB01000
47 48
48.text 49__INIT
49 50
50ENTRY(__start) 51ENTRY(__start)
51ENTRY(__stext)
52 /* R0: argument of command line string, passed from uboot, save it */ 52 /* R0: argument of command line string, passed from uboot, save it */
53 R7 = R0; 53 R7 = R0;
54 /* Set the SYSCFG register */ 54 /* Set the SYSCFG register:
55 * Enable Cycle Counter and Nesting Of Interrupts (3rd Bit)
56 */
55 R0 = 0x36; 57 R0 = 0x36;
56 /*Enable Cycle Counter and Nesting Of Interrupts(3rd Bit)*/
57 SYSCFG = R0; 58 SYSCFG = R0;
58 R0 = 0; 59 R0 = 0;
59 60
60 /*Clear Out All the data and pointer Registers*/ 61 /* Clear Out All the data and pointer Registers */
61 R1 = R0; 62 R1 = R0;
62 R2 = R0; 63 R2 = R0;
63 R3 = R0; 64 R3 = R0;
@@ -79,7 +80,7 @@ ENTRY(__stext)
79 L2 = r0; 80 L2 = r0;
80 L3 = r0; 81 L3 = r0;
81 82
82 /* Clear Out All the DAG Registers*/ 83 /* Clear Out All the DAG Registers */
83 B0 = r0; 84 B0 = r0;
84 B1 = r0; 85 B1 = r0;
85 B2 = r0; 86 B2 = r0;
@@ -265,6 +266,7 @@ ENTRY(__stext)
265 266
266.LWAIT_HERE: 267.LWAIT_HERE:
267 jump .LWAIT_HERE; 268 jump .LWAIT_HERE;
269ENDPROC(__start)
268 270
269ENTRY(_real_start) 271ENTRY(_real_start)
270 [ -- sp ] = reti; 272 [ -- sp ] = reti;
@@ -303,7 +305,7 @@ ENTRY(_real_start)
303.L_clear_zero: 305.L_clear_zero:
304 W[p1++] = r0; 306 W[p1++] = r0;
305 307
306/* pass the uboot arguments to the global value command line */ 308 /* pass the uboot arguments to the global value command line */
307 R0 = R7; 309 R0 = R7;
308 call _cmdline_init; 310 call _cmdline_init;
309 311
@@ -322,7 +324,7 @@ ENTRY(_real_start)
322 [p1] = r1; 324 [p1] = r1;
323 325
324 /* 326 /*
325 * load the current thread pointer and stack 327 * load the current thread pointer and stack
326 */ 328 */
327 r1.l = _init_thread_union; 329 r1.l = _init_thread_union;
328 r1.h = _init_thread_union; 330 r1.h = _init_thread_union;
@@ -333,9 +335,10 @@ ENTRY(_real_start)
333 sp = r1; 335 sp = r1;
334 usp = sp; 336 usp = sp;
335 fp = sp; 337 fp = sp;
336 call _start_kernel; 338 jump.l _start_kernel;
337.L_exit: 339ENDPROC(_real_start)
338 jump.s .L_exit; 340
341__FINIT
339 342
340.section .l1.text 343.section .l1.text
341#if CONFIG_BFIN_KERNEL_CLOCK 344#if CONFIG_BFIN_KERNEL_CLOCK
@@ -439,12 +442,13 @@ ENTRY(_start_dma_code)
439 442
440 p0.h = hi(SIC_IWR); 443 p0.h = hi(SIC_IWR);
441 p0.l = lo(SIC_IWR); 444 p0.l = lo(SIC_IWR);
442 r0.l = lo(IWR_ENABLE_ALL) 445 r0.l = lo(IWR_ENABLE_ALL);
443 r0.h = hi(IWR_ENABLE_ALL) 446 r0.h = hi(IWR_ENABLE_ALL);
444 [p0] = r0; 447 [p0] = r0;
445 SSYNC; 448 SSYNC;
446 449
447 RTS; 450 RTS;
451ENDPROC(_start_dma_code)
448#endif /* CONFIG_BFIN_KERNEL_CLOCK */ 452#endif /* CONFIG_BFIN_KERNEL_CLOCK */
449 453
450ENTRY(_bfin_reset) 454ENTRY(_bfin_reset)
diff --git a/arch/blackfin/mach-bf533/ints-priority.c b/arch/blackfin/mach-bf533/ints-priority.c
index 36a693345204..a3e1789167be 100644
--- a/arch/blackfin/mach-bf533/ints-priority.c
+++ b/arch/blackfin/mach-bf533/ints-priority.c
@@ -4,7 +4,7 @@
4 * Author: Michael Hennerich 4 * Author: Michael Hennerich
5 * 5 *
6 * Created: ? 6 * Created: ?
7 * Description: Set up the interupt priorities 7 * Description: Set up the interrupt priorities
8 * 8 *
9 * Modified: 9 * Modified:
10 * Copyright 2004-2006 Analog Devices Inc. 10 * Copyright 2004-2006 Analog Devices Inc.
diff --git a/arch/blackfin/mach-bf537/boards/generic_board.c b/arch/blackfin/mach-bf537/boards/generic_board.c
index 9019c0edbe7c..fd57e7439e0f 100644
--- a/arch/blackfin/mach-bf537/boards/generic_board.c
+++ b/arch/blackfin/mach-bf537/boards/generic_board.c
@@ -55,7 +55,7 @@ static struct resource bfin_pcmcia_cf_resources[] = {
55 .end = 0x20312000, 55 .end = 0x20312000,
56 .flags = IORESOURCE_MEM, 56 .flags = IORESOURCE_MEM,
57 },{ 57 },{
58 .start = 0x20311000, /* Attribute Memeory */ 58 .start = 0x20311000, /* Attribute Memory */
59 .end = 0x20311FFF, 59 .end = 0x20311FFF,
60 .flags = IORESOURCE_MEM, 60 .flags = IORESOURCE_MEM,
61 },{ 61 },{
diff --git a/arch/blackfin/mach-bf537/boards/pnav10.c b/arch/blackfin/mach-bf537/boards/pnav10.c
index 40d3a1b70ee7..8aaf76dfce80 100644
--- a/arch/blackfin/mach-bf537/boards/pnav10.c
+++ b/arch/blackfin/mach-bf537/boards/pnav10.c
@@ -59,7 +59,7 @@ static struct resource bfin_pcmcia_cf_resources[] = {
59 .end = 0x20312000, 59 .end = 0x20312000,
60 .flags = IORESOURCE_MEM, 60 .flags = IORESOURCE_MEM,
61 },{ 61 },{
62 .start = 0x20311000, /* Attribute Memeory */ 62 .start = 0x20311000, /* Attribute Memory */
63 .end = 0x20311FFF, 63 .end = 0x20311FFF,
64 .flags = IORESOURCE_MEM, 64 .flags = IORESOURCE_MEM,
65 },{ 65 },{
diff --git a/arch/blackfin/mach-bf537/boards/stamp.c b/arch/blackfin/mach-bf537/boards/stamp.c
index ba2f875a7f7d..3a29b4d15f25 100644
--- a/arch/blackfin/mach-bf537/boards/stamp.c
+++ b/arch/blackfin/mach-bf537/boards/stamp.c
@@ -108,7 +108,7 @@ static struct resource bfin_pcmcia_cf_resources[] = {
108 .end = 0x20312000, 108 .end = 0x20312000,
109 .flags = IORESOURCE_MEM, 109 .flags = IORESOURCE_MEM,
110 },{ 110 },{
111 .start = 0x20311000, /* Attribute Memeory */ 111 .start = 0x20311000, /* Attribute Memory */
112 .end = 0x20311FFF, 112 .end = 0x20311FFF,
113 .flags = IORESOURCE_MEM, 113 .flags = IORESOURCE_MEM,
114 },{ 114 },{
diff --git a/arch/blackfin/mach-bf537/head.S b/arch/blackfin/mach-bf537/head.S
index 2c2652bee7e5..7d902bbd860f 100644
--- a/arch/blackfin/mach-bf537/head.S
+++ b/arch/blackfin/mach-bf537/head.S
@@ -28,6 +28,7 @@
28 */ 28 */
29 29
30#include <linux/linkage.h> 30#include <linux/linkage.h>
31#include <linux/init.h>
31#include <asm/blackfin.h> 32#include <asm/blackfin.h>
32#if CONFIG_BFIN_KERNEL_CLOCK 33#if CONFIG_BFIN_KERNEL_CLOCK
33#include <asm/mach/mem_init.h> 34#include <asm/mach/mem_init.h>
@@ -40,20 +41,21 @@
40.extern ___bss_start 41.extern ___bss_start
41.extern _bf53x_relocate_l1_mem 42.extern _bf53x_relocate_l1_mem
42 43
43#define INITIAL_STACK 0xFFB01000 44#define INITIAL_STACK 0xFFB01000
44 45
45.text 46__INIT
46 47
47ENTRY(__start) 48ENTRY(__start)
48ENTRY(__stext)
49 /* R0: argument of command line string, passed from uboot, save it */ 49 /* R0: argument of command line string, passed from uboot, save it */
50 R7 = R0; 50 R7 = R0;
51 /* Set the SYSCFG register */ 51 /* Set the SYSCFG register:
52 * Enable Cycle Counter and Nesting Of Interrupts (3rd Bit)
53 */
52 R0 = 0x36; 54 R0 = 0x36;
53 SYSCFG = R0; /*Enable Cycle Counter and Nesting Of Interrupts(3rd Bit)*/ 55 SYSCFG = R0;
54 R0 = 0; 56 R0 = 0;
55 57
56 /* Clear Out All the data and pointer Registers*/ 58 /* Clear Out All the data and pointer Registers */
57 R1 = R0; 59 R1 = R0;
58 R2 = R0; 60 R2 = R0;
59 R3 = R0; 61 R3 = R0;
@@ -75,7 +77,7 @@ ENTRY(__stext)
75 L2 = r0; 77 L2 = r0;
76 L3 = r0; 78 L3 = r0;
77 79
78 /* Clear Out All the DAG Registers*/ 80 /* Clear Out All the DAG Registers */
79 B0 = r0; 81 B0 = r0;
80 B1 = r0; 82 B1 = r0;
81 B2 = r0; 83 B2 = r0;
@@ -191,7 +193,7 @@ ENTRY(__stext)
191 193
192 p0.h = hi(UART_DLL); 194 p0.h = hi(UART_DLL);
193 p0.l = lo(UART_DLL); 195 p0.l = lo(UART_DLL);
194 r0 = 0x00(Z); 196 r0 = 0x0(Z);
195 w[p0] = r0.L; 197 w[p0] = r0.L;
196 ssync; 198 ssync;
197 199
@@ -218,6 +220,7 @@ ENTRY(__stext)
218#if CONFIG_BFIN_KERNEL_CLOCK 220#if CONFIG_BFIN_KERNEL_CLOCK
219 call _start_dma_code; 221 call _start_dma_code;
220#endif 222#endif
223
221 /* Code for initializing Async memory banks */ 224 /* Code for initializing Async memory banks */
222 225
223 p2.h = hi(EBIU_AMBCTL1); 226 p2.h = hi(EBIU_AMBCTL1);
@@ -272,6 +275,7 @@ ENTRY(__stext)
272 275
273.LWAIT_HERE: 276.LWAIT_HERE:
274 jump .LWAIT_HERE; 277 jump .LWAIT_HERE;
278ENDPROC(__start)
275 279
276ENTRY(_real_start) 280ENTRY(_real_start)
277 [ -- sp ] = reti; 281 [ -- sp ] = reti;
@@ -291,7 +295,7 @@ ENTRY(_real_start)
291 p2.h = ___bss_stop; 295 p2.h = ___bss_stop;
292 r0 = 0; 296 r0 = 0;
293 p2 -= p1; 297 p2 -= p1;
294 lsetup (.L_clear_bss, .L_clear_bss ) lc0 = p2; 298 lsetup (.L_clear_bss, .L_clear_bss) lc0 = p2;
295.L_clear_bss: 299.L_clear_bss:
296 B[p1++] = r0; 300 B[p1++] = r0;
297 301
@@ -306,7 +310,7 @@ ENTRY(_real_start)
306 r0 = r0 >> 1; 310 r0 = r0 >> 1;
307 p2 = r0; 311 p2 = r0;
308 r0 = 0; 312 r0 = 0;
309 lsetup (.L_clear_zero, .L_clear_zero ) lc0 = p2; 313 lsetup (.L_clear_zero, .L_clear_zero) lc0 = p2;
310.L_clear_zero: 314.L_clear_zero:
311 W[p1++] = r0; 315 W[p1++] = r0;
312 316
@@ -328,9 +332,8 @@ ENTRY(_real_start)
328 r1 = p3; 332 r1 = p3;
329 [p1] = r1; 333 [p1] = r1;
330 334
331
332 /* 335 /*
333 * load the current thread pointer and stack 336 * load the current thread pointer and stack
334 */ 337 */
335 r1.l = _init_thread_union; 338 r1.l = _init_thread_union;
336 r1.h = _init_thread_union; 339 r1.h = _init_thread_union;
@@ -341,9 +344,10 @@ ENTRY(_real_start)
341 sp = r1; 344 sp = r1;
342 usp = sp; 345 usp = sp;
343 fp = sp; 346 fp = sp;
344 call _start_kernel; 347 jump.l _start_kernel;
345.L_exit: 348ENDPROC(_real_start)
346 jump.s .L_exit; 349
350__FINIT
347 351
348.section .l1.text 352.section .l1.text
349#if CONFIG_BFIN_KERNEL_CLOCK 353#if CONFIG_BFIN_KERNEL_CLOCK
@@ -462,6 +466,7 @@ ENTRY(_start_dma_code)
462 SSYNC; 466 SSYNC;
463 467
464 RTS; 468 RTS;
469ENDPROC(_start_dma_code)
465#endif /* CONFIG_BFIN_KERNEL_CLOCK */ 470#endif /* CONFIG_BFIN_KERNEL_CLOCK */
466 471
467ENTRY(_bfin_reset) 472ENTRY(_bfin_reset)
diff --git a/arch/blackfin/mach-bf537/ints-priority.c b/arch/blackfin/mach-bf537/ints-priority.c
index fd6308eccbe6..2dbf3df465d1 100644
--- a/arch/blackfin/mach-bf537/ints-priority.c
+++ b/arch/blackfin/mach-bf537/ints-priority.c
@@ -4,7 +4,7 @@
4 * Author: Michael Hennerich 4 * Author: Michael Hennerich
5 * 5 *
6 * Created: 6 * Created:
7 * Description: Set up the interupt priorities 7 * Description: Set up the interrupt priorities
8 * 8 *
9 * Modified: 9 * Modified:
10 * Copyright 2004-2006 Analog Devices Inc. 10 * Copyright 2004-2006 Analog Devices Inc.
diff --git a/arch/blackfin/mach-bf561/boards/cm_bf561.c b/arch/blackfin/mach-bf561/boards/cm_bf561.c
index 6824e956d153..3dc5c042048c 100644
--- a/arch/blackfin/mach-bf561/boards/cm_bf561.c
+++ b/arch/blackfin/mach-bf561/boards/cm_bf561.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * File: arch/blackfin/mach-bf533/boards/cm_bf561.c 2 * File: arch/blackfin/mach-bf533/boards/cm_bf561.c
3 * Based on: arch/blackfin/mach-bf533/boards/ezkit.c 3 * Based on: arch/blackfin/mach-bf533/boards/ezkit.c
4 * Author: Aidan Williams <aidan@nicta.com.au> Copright 2005 4 * Author: Aidan Williams <aidan@nicta.com.au> Copyright 2005
5 * 5 *
6 * Created: 2006 6 * Created: 2006
7 * Description: Board description file 7 * Description: Board description file
@@ -43,7 +43,7 @@
43char *bfin_board_name = "Bluetechnix CM BF561"; 43char *bfin_board_name = "Bluetechnix CM BF561";
44 44
45#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) 45#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
46/* all SPI perpherals info goes here */ 46/* all SPI peripherals info goes here */
47 47
48#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE) 48#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
49static struct mtd_partition bfin_spi_flash_partitions[] = { 49static struct mtd_partition bfin_spi_flash_partitions[] = {
diff --git a/arch/blackfin/mach-bf561/head.S b/arch/blackfin/mach-bf561/head.S
index ad9187a866a5..31cbc75c85cf 100644
--- a/arch/blackfin/mach-bf561/head.S
+++ b/arch/blackfin/mach-bf561/head.S
@@ -28,6 +28,7 @@
28 */ 28 */
29 29
30#include <linux/linkage.h> 30#include <linux/linkage.h>
31#include <linux/init.h>
31#include <asm/blackfin.h> 32#include <asm/blackfin.h>
32#if CONFIG_BFIN_KERNEL_CLOCK 33#if CONFIG_BFIN_KERNEL_CLOCK
33#include <asm/mach/mem_init.h> 34#include <asm/mach/mem_init.h>
@@ -42,18 +43,19 @@
42 43
43#define INITIAL_STACK 0xFFB01000 44#define INITIAL_STACK 0xFFB01000
44 45
45.text 46__INIT
46 47
47ENTRY(__start) 48ENTRY(__start)
48ENTRY(__stext) 49 /* R0: argument of command line string, passed from uboot, save it */
49 /* R0: argument of command line string, passed from uboot, save it */
50 R7 = R0; 50 R7 = R0;
51 /* Set the SYSCFG register */ 51 /* Set the SYSCFG register:
52 * Enable Cycle Counter and Nesting Of Interrupts (3rd Bit)
53 */
52 R0 = 0x36; 54 R0 = 0x36;
53 SYSCFG = R0; /*Enable Cycle Counter and Nesting Of Interrupts(3rd Bit)*/ 55 SYSCFG = R0;
54 R0 = 0; 56 R0 = 0;
55 57
56 /*Clear Out All the data and pointer Registers*/ 58 /* Clear Out All the data and pointer Registers */
57 R1 = R0; 59 R1 = R0;
58 R2 = R0; 60 R2 = R0;
59 R3 = R0; 61 R3 = R0;
@@ -75,7 +77,7 @@ ENTRY(__stext)
75 L2 = r0; 77 L2 = r0;
76 L3 = r0; 78 L3 = r0;
77 79
78 /* Clear Out All the DAG Registers*/ 80 /* Clear Out All the DAG Registers */
79 B0 = r0; 81 B0 = r0;
80 B1 = r0; 82 B1 = r0;
81 B2 = r0; 83 B2 = r0;
@@ -219,6 +221,7 @@ ENTRY(__stext)
219 221
220.LWAIT_HERE: 222.LWAIT_HERE:
221 jump .LWAIT_HERE; 223 jump .LWAIT_HERE;
224ENDPROC(__start)
222 225
223ENTRY(_real_start) 226ENTRY(_real_start)
224 [ -- sp ] = reti; 227 [ -- sp ] = reti;
@@ -238,7 +241,7 @@ ENTRY(_real_start)
238 p2.h = ___bss_stop; 241 p2.h = ___bss_stop;
239 r0 = 0; 242 r0 = 0;
240 p2 -= p1; 243 p2 -= p1;
241 lsetup (.L_clear_bss, .L_clear_bss ) lc0 = p2; 244 lsetup (.L_clear_bss, .L_clear_bss) lc0 = p2;
242.L_clear_bss: 245.L_clear_bss:
243 B[p1++] = r0; 246 B[p1++] = r0;
244 247
@@ -253,11 +256,11 @@ ENTRY(_real_start)
253 r0 = r0 >> 1; 256 r0 = r0 >> 1;
254 p2 = r0; 257 p2 = r0;
255 r0 = 0; 258 r0 = 0;
256 lsetup (.L_clear_zero, .L_clear_zero ) lc0 = p2; 259 lsetup (.L_clear_zero, .L_clear_zero) lc0 = p2;
257.L_clear_zero: 260.L_clear_zero:
258 W[p1++] = r0; 261 W[p1++] = r0;
259 262
260/* pass the uboot arguments to the global value command line */ 263 /* pass the uboot arguments to the global value command line */
261 R0 = R7; 264 R0 = R7;
262 call _cmdline_init; 265 call _cmdline_init;
263 266
@@ -287,9 +290,10 @@ ENTRY(_real_start)
287 sp = r1; 290 sp = r1;
288 usp = sp; 291 usp = sp;
289 fp = sp; 292 fp = sp;
290 call _start_kernel; 293 jump.l _start_kernel;
291.L_exit: 294ENDPROC(_real_start)
292 jump.s .L_exit; 295
296__FINIT
293 297
294.section .l1.text 298.section .l1.text
295#if CONFIG_BFIN_KERNEL_CLOCK 299#if CONFIG_BFIN_KERNEL_CLOCK
@@ -350,7 +354,7 @@ ENTRY(_start_dma_code)
350 if ! CC jump .Lcheck_again; 354 if ! CC jump .Lcheck_again;
351 355
352 /* Configure SCLK & CCLK Dividers */ 356 /* Configure SCLK & CCLK Dividers */
353 r0 = (CONFIG_CCLK_ACT_DIV | CONFIG_SCLK_DIV); 357 r0 = (CONFIG_CCLK_ACT_DIV | CONFIG_SCLK_DIV);
354 p0.h = hi(PLL_DIV); 358 p0.h = hi(PLL_DIV);
355 p0.l = lo(PLL_DIV); 359 p0.l = lo(PLL_DIV);
356 w[p0] = r0.l; 360 w[p0] = r0.l;
@@ -391,6 +395,7 @@ ENTRY(_start_dma_code)
391 SSYNC; 395 SSYNC;
392 396
393 RTS; 397 RTS;
398ENDPROC(_start_dma_code)
394#endif /* CONFIG_BFIN_KERNEL_CLOCK */ 399#endif /* CONFIG_BFIN_KERNEL_CLOCK */
395 400
396ENTRY(_bfin_reset) 401ENTRY(_bfin_reset)
diff --git a/arch/blackfin/mach-bf561/ints-priority.c b/arch/blackfin/mach-bf561/ints-priority.c
index 89c52ff95b27..86e3b0ee93f4 100644
--- a/arch/blackfin/mach-bf561/ints-priority.c
+++ b/arch/blackfin/mach-bf561/ints-priority.c
@@ -4,7 +4,7 @@
4 * Author: Michael Hennerich 4 * Author: Michael Hennerich
5 * 5 *
6 * Created: 6 * Created:
7 * Description: Set up the interupt priorities 7 * Description: Set up the interrupt priorities
8 * 8 *
9 * Modified: 9 * Modified:
10 * Copyright 2004-2006 Analog Devices Inc. 10 * Copyright 2004-2006 Analog Devices Inc.
diff --git a/arch/blackfin/mach-common/cache.S b/arch/blackfin/mach-common/cache.S
index bb9446ef66ef..8bd2af1935bd 100644
--- a/arch/blackfin/mach-common/cache.S
+++ b/arch/blackfin/mach-common/cache.S
@@ -70,6 +70,7 @@ ENTRY(_cache_invalidate)
70.Lno_dcache_b: 70.Lno_dcache_b:
71 R7 = [SP++]; 71 R7 = [SP++];
72 RTS; 72 RTS;
73ENDPROC(_cache_invalidate)
73 74
74/* Invalidate the Entire Instruction cache by 75/* Invalidate the Entire Instruction cache by
75 * disabling IMC bit 76 * disabling IMC bit
@@ -106,6 +107,8 @@ ENTRY(_invalidate_entire_icache)
106 107
107 ( R7:5) = [SP++]; 108 ( R7:5) = [SP++];
108 RTS; 109 RTS;
110ENDPROC(_invalidate_entire_icache)
111ENDPROC(_icache_invalidate)
109 112
110/* 113/*
111 * blackfin_cache_flush_range(start, end) 114 * blackfin_cache_flush_range(start, end)
@@ -129,6 +132,7 @@ ENTRY(_blackfin_icache_flush_range)
129 IFLUSH [P0]; 132 IFLUSH [P0];
130 SSYNC; 133 SSYNC;
131 RTS; 134 RTS;
135ENDPROC(_blackfin_icache_flush_range)
132 136
133/* 137/*
134 * blackfin_icache_dcache_flush_range(start, end) 138 * blackfin_icache_dcache_flush_range(start, end)
@@ -155,6 +159,7 @@ ENTRY(_blackfin_icache_dcache_flush_range)
155 FLUSH [P0]; 159 FLUSH [P0];
156 SSYNC; 160 SSYNC;
157 RTS; 161 RTS;
162ENDPROC(_blackfin_icache_dcache_flush_range)
158 163
159/* Throw away all D-cached data in specified region without any obligation to 164/* Throw away all D-cached data in specified region without any obligation to
160 * write them back. However, we must clean the D-cached entries around the 165 * write them back. However, we must clean the D-cached entries around the
@@ -183,6 +188,7 @@ ENTRY(_blackfin_dcache_invalidate_range)
183 FLUSHINV[P0]; 188 FLUSHINV[P0];
184 SSYNC; 189 SSYNC;
185 RTS; 190 RTS;
191ENDPROC(_blackfin_dcache_invalidate_range)
186 192
187/* Invalidate the Entire Data cache by 193/* Invalidate the Entire Data cache by
188 * clearing DMC[1:0] bits 194 * clearing DMC[1:0] bits
@@ -221,6 +227,8 @@ ENTRY(_dcache_invalidate)
221 227
222 ( R7:6) = [SP++]; 228 ( R7:6) = [SP++];
223 RTS; 229 RTS;
230ENDPROC(_dcache_invalidate)
231ENDPROC(_invalidate_entire_dcache)
224 232
225ENTRY(_blackfin_dcache_flush_range) 233ENTRY(_blackfin_dcache_flush_range)
226 R2 = -L1_CACHE_BYTES; 234 R2 = -L1_CACHE_BYTES;
@@ -241,6 +249,7 @@ ENTRY(_blackfin_dcache_flush_range)
241 FLUSH[P0]; 249 FLUSH[P0];
242 SSYNC; 250 SSYNC;
243 RTS; 251 RTS;
252ENDPROC(_blackfin_dcache_flush_range)
244 253
245ENTRY(_blackfin_dflush_page) 254ENTRY(_blackfin_dflush_page)
246 P1 = 1 << (PAGE_SHIFT - L1_CACHE_SHIFT); 255 P1 = 1 << (PAGE_SHIFT - L1_CACHE_SHIFT);
@@ -251,3 +260,4 @@ ENTRY(_blackfin_dflush_page)
251.Lfl1: FLUSH [P0++]; 260.Lfl1: FLUSH [P0++];
252 SSYNC; 261 SSYNC;
253 RTS; 262 RTS;
263ENDPROC(_blackfin_dflush_page)
diff --git a/arch/blackfin/mach-common/cacheinit.S b/arch/blackfin/mach-common/cacheinit.S
index 8c17f099e5eb..7924a90d9658 100644
--- a/arch/blackfin/mach-common/cacheinit.S
+++ b/arch/blackfin/mach-common/cacheinit.S
@@ -86,6 +86,8 @@ ENTRY(_bfin_icache_init)
86 SSYNC; 86 SSYNC;
87 STI R2; 87 STI R2;
88 RTS; 88 RTS;
89
90ENDPROC(_bfin_icache_init)
89#endif 91#endif
90 92
91#if defined(CONFIG_BLKFIN_DCACHE) 93#if defined(CONFIG_BLKFIN_DCACHE)
@@ -134,4 +136,6 @@ ENTRY(_bfin_dcache_init)
134 SSYNC; 136 SSYNC;
135 STI R2; 137 STI R2;
136 RTS; 138 RTS;
139
140ENDPROC(_bfin_dcache_init)
137#endif 141#endif
diff --git a/arch/blackfin/mach-common/cplbhdlr.S b/arch/blackfin/mach-common/cplbhdlr.S
index b979067c49ef..2f3c72c23997 100644
--- a/arch/blackfin/mach-common/cplbhdlr.S
+++ b/arch/blackfin/mach-common/cplbhdlr.S
@@ -42,8 +42,6 @@
42 42
43.align 2 43.align 2
44 44
45.global __cplb_hdr;
46.type __cplb_hdr, STT_FUNC;
47ENTRY(__cplb_hdr) 45ENTRY(__cplb_hdr)
48 R2 = SEQSTAT; 46 R2 = SEQSTAT;
49 47
@@ -128,3 +126,5 @@ ENTRY(__cplb_hdr)
128 call _panic_cplb_error; 126 call _panic_cplb_error;
129 SP += 12; 127 SP += 12;
130 JUMP _handle_bad_cplb; 128 JUMP _handle_bad_cplb;
129
130ENDPROC(__cplb_hdr)
diff --git a/arch/blackfin/mach-common/cplbinfo.c b/arch/blackfin/mach-common/cplbinfo.c
index d65fac39d1bf..caa9623e6bd6 100644
--- a/arch/blackfin/mach-common/cplbinfo.c
+++ b/arch/blackfin/mach-common/cplbinfo.c
@@ -82,7 +82,7 @@ static char *cplb_print_entry(char *buf, int type)
82 int entry = 0, used_cplb = 0; 82 int entry = 0, used_cplb = 0;
83 83
84 if (type == CPLB_I) { 84 if (type == CPLB_I) {
85 buf += sprintf(buf, "Instrction CPLB entry:\n"); 85 buf += sprintf(buf, "Instruction CPLB entry:\n");
86 p_addr = ipdt_table; 86 p_addr = ipdt_table;
87 p_data = ipdt_table + 1; 87 p_data = ipdt_table + 1;
88 p_icount = ipdt_swapcount_table; 88 p_icount = ipdt_swapcount_table;
diff --git a/arch/blackfin/mach-common/cplbmgr.S b/arch/blackfin/mach-common/cplbmgr.S
index f5efc4bc65e6..e4b47e09cf13 100644
--- a/arch/blackfin/mach-common/cplbmgr.S
+++ b/arch/blackfin/mach-common/cplbmgr.S
@@ -592,6 +592,7 @@ ENTRY(_cplb_mgr)
592 ( R7:4,P5:3 ) = [SP++]; 592 ( R7:4,P5:3 ) = [SP++];
593 R0 = CPLB_RELOADED; 593 R0 = CPLB_RELOADED;
594 RTS; 594 RTS;
595ENDPROC(_cplb_mgr)
595 596
596.data 597.data
597.align 4; 598.align 4;
diff --git a/arch/blackfin/mach-common/entry.S b/arch/blackfin/mach-common/entry.S
index 7d0368772cda..40045b1386ad 100644
--- a/arch/blackfin/mach-common/entry.S
+++ b/arch/blackfin/mach-common/entry.S
@@ -103,6 +103,7 @@ ENTRY(_ex_dcplb)
103 if !cc jump _return_from_exception; 103 if !cc jump _return_from_exception;
104 /* fall through */ 104 /* fall through */
105#endif 105#endif
106ENDPROC(_ex_dcplb)
106 107
107ENTRY(_ex_icplb) 108ENTRY(_ex_icplb)
108 (R7:6,P5:4) = [sp++]; 109 (R7:6,P5:4) = [sp++];
@@ -113,6 +114,7 @@ ENTRY(_ex_icplb)
113 RESTORE_ALL_SYS 114 RESTORE_ALL_SYS
114 SP = RETN; 115 SP = RETN;
115 rtx; 116 rtx;
117ENDPROC(_ex_icplb)
116 118
117ENTRY(_ex_spinlock) 119ENTRY(_ex_spinlock)
118 /* Transform this into a syscall - twiddle the syscall vector. */ 120 /* Transform this into a syscall - twiddle the syscall vector. */
@@ -123,6 +125,7 @@ ENTRY(_ex_spinlock)
123 [p5] = r7; 125 [p5] = r7;
124 csync; 126 csync;
125 /* Fall through. */ 127 /* Fall through. */
128ENDPROC(_ex_spinlock)
126 129
127ENTRY(_ex_syscall) 130ENTRY(_ex_syscall)
128 DEBUG_START_HWTRACE 131 DEBUG_START_HWTRACE
@@ -131,6 +134,7 @@ ENTRY(_ex_syscall)
131 raise 15; /* invoked by TRAP #0, for sys call */ 134 raise 15; /* invoked by TRAP #0, for sys call */
132 sp = retn; 135 sp = retn;
133 rtx 136 rtx
137ENDPROC(_ex_syscall)
134 138
135ENTRY(_spinlock_bh) 139ENTRY(_spinlock_bh)
136 SAVE_ALL_SYS 140 SAVE_ALL_SYS
@@ -150,12 +154,14 @@ ENTRY(_spinlock_bh)
150 [SP + PT_R0] = R0; 154 [SP + PT_R0] = R0;
151 RESTORE_ALL_SYS 155 RESTORE_ALL_SYS
152 rti; 156 rti;
157ENDPROC(_spinlock_bh)
153 158
154ENTRY(_ex_soft_bp) 159ENTRY(_ex_soft_bp)
155 r7 = retx; 160 r7 = retx;
156 r7 += -2; 161 r7 += -2;
157 retx = r7; 162 retx = r7;
158 jump.s _ex_trap_c; 163 jump.s _ex_trap_c;
164ENDPROC(_ex_soft_bp)
159 165
160ENTRY(_ex_single_step) 166ENTRY(_ex_single_step)
161 r7 = retx; 167 r7 = retx;
@@ -191,6 +197,7 @@ _return_from_exception:
191 ASTAT = [sp++]; 197 ASTAT = [sp++];
192 sp = retn; 198 sp = retn;
193 rtx; 199 rtx;
200ENDPROC(_ex_soft_bp)
194 201
195ENTRY(_handle_bad_cplb) 202ENTRY(_handle_bad_cplb)
196 /* To get here, we just tried and failed to change a CPLB 203 /* To get here, we just tried and failed to change a CPLB
@@ -250,6 +257,7 @@ ENTRY(_ex_trap_c)
250 SP = RETN; 257 SP = RETN;
251 raise 5; 258 raise 5;
252 rtx; 259 rtx;
260ENDPROC(_ex_trap_c)
253 261
254ENTRY(_exception_to_level5) 262ENTRY(_exception_to_level5)
255 SAVE_ALL_SYS 263 SAVE_ALL_SYS
@@ -314,6 +322,7 @@ ENTRY(_exception_to_level5)
314 call _ret_from_exception; 322 call _ret_from_exception;
315 RESTORE_ALL_SYS 323 RESTORE_ALL_SYS
316 rti; 324 rti;
325ENDPROC(_exception_to_level5)
317 326
318ENTRY(_trap) /* Exception: 4th entry into system event table(supervisor mode)*/ 327ENTRY(_trap) /* Exception: 4th entry into system event table(supervisor mode)*/
319 /* Since the kernel stack can be anywhere, it's not guaranteed to be 328 /* 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)*/
342 r7 = -ENOSYS; /* signextending enough */ 351 r7 = -ENOSYS; /* signextending enough */
343 [sp + PT_R0] = r7; /* return value from system call */ 352 [sp + PT_R0] = r7; /* return value from system call */
344 jump .Lsyscall_really_exit; 353 jump .Lsyscall_really_exit;
354ENDPROC(_trap)
345 355
346ENTRY(_kernel_execve) 356ENTRY(_kernel_execve)
347 link SIZEOF_PTREGS; 357 link SIZEOF_PTREGS;
@@ -396,6 +406,7 @@ ENTRY(_kernel_execve)
3961: 4061:
397 unlink; 407 unlink;
398 rts; 408 rts;
409ENDPROC(_kernel_execve)
399 410
400ENTRY(_system_call) 411ENTRY(_system_call)
401 /* Store IPEND */ 412 /* Store IPEND */
@@ -503,6 +514,7 @@ ENTRY(_system_call)
503 r5 = [sp + PT_RESERVED]; 514 r5 = [sp + PT_RESERVED];
504 rets = r5; 515 rets = r5;
505 rts; 516 rts;
517ENDPROC(_system_call)
506 518
507_sys_trace: 519_sys_trace:
508 call _syscall_trace; 520 call _syscall_trace;
@@ -531,6 +543,7 @@ _sys_trace:
531 543
532 call _syscall_trace; 544 call _syscall_trace;
533 jump .Lresume_userspace; 545 jump .Lresume_userspace;
546ENDPROC(_sys_trace)
534 547
535ENTRY(_resume) 548ENTRY(_resume)
536 /* 549 /*
@@ -580,6 +593,7 @@ _new_old_task:
580 * in "new" task. 593 * in "new" task.
581 */ 594 */
582 rts; 595 rts;
596ENDPROC(_resume)
583 597
584ENTRY(_ret_from_exception) 598ENTRY(_ret_from_exception)
585 p2.l = lo(IPEND); 599 p2.l = lo(IPEND);
@@ -638,6 +652,7 @@ ENTRY(_ret_from_exception)
638 syscfg = r0; 652 syscfg = r0;
6395: 6535:
640 rts; 654 rts;
655ENDPROC(_ret_from_exception)
641 656
642ENTRY(_return_from_int) 657ENTRY(_return_from_int)
643 /* If someone else already raised IRQ 15, do nothing. */ 658 /* If someone else already raised IRQ 15, do nothing. */
@@ -680,6 +695,7 @@ ENTRY(_return_from_int)
680 rti; 695 rti;
6812: 6962:
682 rts; 697 rts;
698ENDPROC(_return_from_int)
683 699
684ENTRY(_lower_to_irq14) 700ENTRY(_lower_to_irq14)
685#if defined(ANOMALY_05000281) 701#if defined(ANOMALY_05000281)
@@ -745,6 +761,7 @@ _schedule_and_signal:
7451: 7611:
746 RESTORE_CONTEXT 762 RESTORE_CONTEXT
747 rti; 763 rti;
764ENDPROC(_lower_to_irq14)
748 765
749/* Make sure when we start, that the circular buffer is initialized properly 766/* Make sure when we start, that the circular buffer is initialized properly
750 * R0 and P0 are call clobbered, so we can use them here. 767 * R0 and P0 are call clobbered, so we can use them here.
@@ -758,6 +775,7 @@ ENTRY(_init_exception_buff)
758 p0.l = _out_ptr_excause; 775 p0.l = _out_ptr_excause;
759 [p0] = r0; 776 [p0] = r0;
760 rts; 777 rts;
778ENDPROC(_init_exception_buff)
761 779
762/* 780/*
763 * Put these in the kernel data section - that should always be covered by 781 * Put these in the kernel data section - that should always be covered by
diff --git a/arch/blackfin/mach-common/interrupt.S b/arch/blackfin/mach-common/interrupt.S
index dd45664f0d02..b69f517a650b 100644
--- a/arch/blackfin/mach-common/interrupt.S
+++ b/arch/blackfin/mach-common/interrupt.S
@@ -66,6 +66,7 @@ ENTRY(_evt_emulation)
66 SP += 12; 66 SP += 12;
67 /* - GDB stub fills this in by itself (if defined) */ 67 /* - GDB stub fills this in by itself (if defined) */
68 rte; 68 rte;
69ENDPROC(_evt_emulation)
69#endif 70#endif
70 71
71/* Common interrupt entry code. First we do CLI, then push 72/* Common interrupt entry code. First we do CLI, then push
@@ -251,3 +252,4 @@ ENTRY(_evt_system_call)
251#endif 252#endif
252 call _system_call; 253 call _system_call;
253 jump .Lcommon_restore_context; 254 jump .Lcommon_restore_context;
255ENDPROC(_evt_system_call)
diff --git a/arch/blackfin/mach-common/ints-priority-dc.c b/arch/blackfin/mach-common/ints-priority-dc.c
index f3cf07036c2a..80943bbd37c2 100644
--- a/arch/blackfin/mach-common/ints-priority-dc.c
+++ b/arch/blackfin/mach-common/ints-priority-dc.c
@@ -4,7 +4,7 @@
4 * Author: 4 * Author:
5 * 5 *
6 * Created: ? 6 * Created: ?
7 * Description: Set up the interupt priorities 7 * Description: Set up the interrupt priorities
8 * 8 *
9 * Modified: 9 * Modified:
10 * 1996 Roman Zippel 10 * 1996 Roman Zippel
diff --git a/arch/blackfin/mach-common/ints-priority-sc.c b/arch/blackfin/mach-common/ints-priority-sc.c
index 34b62288ec3c..2cfc7d5aec5c 100644
--- a/arch/blackfin/mach-common/ints-priority-sc.c
+++ b/arch/blackfin/mach-common/ints-priority-sc.c
@@ -4,7 +4,7 @@
4 * Author: 4 * Author:
5 * 5 *
6 * Created: ? 6 * Created: ?
7 * Description: Set up the interupt priorities 7 * Description: Set up the interrupt priorities
8 * 8 *
9 * Modified: 9 * Modified:
10 * 1996 Roman Zippel 10 * 1996 Roman Zippel
diff --git a/arch/blackfin/mach-common/lock.S b/arch/blackfin/mach-common/lock.S
index 2cbb15b33925..386ac8dda076 100644
--- a/arch/blackfin/mach-common/lock.S
+++ b/arch/blackfin/mach-common/lock.S
@@ -155,6 +155,7 @@ ENTRY(_cache_grab_lock)
155 ( R7:0,P5:0 ) = [SP++]; 155 ( R7:0,P5:0 ) = [SP++];
156 156
157 RTS; 157 RTS;
158ENDPROC(_cache_grab_lock)
158 159
159/* After the execution of critical code, the code is now locked into 160/* After the execution of critical code, the code is now locked into
160 * the cache way. Now we need to set ILOC. 161 * the cache way. Now we need to set ILOC.
@@ -186,6 +187,7 @@ ENTRY(_cache_lock)
186 187
187 ( R7:0,P5:0 ) = [SP++]; 188 ( R7:0,P5:0 ) = [SP++];
188 RTS; 189 RTS;
190ENDPROC(_cache_lock)
189 191
190#endif /* BLKFIN_CACHE_LOCK */ 192#endif /* BLKFIN_CACHE_LOCK */
191 193
@@ -193,7 +195,6 @@ ENTRY(_cache_lock)
193 */ 195 */
194 196
195ENTRY(_read_iloc) 197ENTRY(_read_iloc)
196
197 P1.H = (IMEM_CONTROL >> 16); 198 P1.H = (IMEM_CONTROL >> 16);
198 P1.L = (IMEM_CONTROL & 0xFFFF); 199 P1.L = (IMEM_CONTROL & 0xFFFF);
199 R1 = 0xF; 200 R1 = 0xF;
@@ -202,3 +203,4 @@ ENTRY(_read_iloc)
202 R0 = R0 & R1; 203 R0 = R0 & R1;
203 204
204 RTS; 205 RTS;
206ENDPROC(_read_iloc)
diff --git a/arch/blackfin/mach-common/pm.c b/arch/blackfin/mach-common/pm.c
index afed5246dd9e..150ef5d088dc 100644
--- a/arch/blackfin/mach-common/pm.c
+++ b/arch/blackfin/mach-common/pm.c
@@ -39,7 +39,7 @@
39#include <asm/io.h> 39#include <asm/io.h>
40#include <asm/dpmc.h> 40#include <asm/dpmc.h>
41#include <asm/irq.h> 41#include <asm/irq.h>
42 42#include <asm/gpio.h>
43 43
44#ifdef CONFIG_PM_WAKEUP_GPIO_POLAR_H 44#ifdef CONFIG_PM_WAKEUP_GPIO_POLAR_H
45#define WAKEUP_TYPE PM_WAKE_HIGH 45#define WAKEUP_TYPE PM_WAKE_HIGH
diff --git a/arch/blackfin/mm/blackfin_sram.c b/arch/blackfin/mm/blackfin_sram.c
index dd0c6501c424..68107924639e 100644
--- a/arch/blackfin/mm/blackfin_sram.c
+++ b/arch/blackfin/mm/blackfin_sram.c
@@ -7,7 +7,7 @@
7 * Description: SRAM driver for Blackfin ADSP-BF5xx 7 * Description: SRAM driver for Blackfin ADSP-BF5xx
8 * 8 *
9 * Modified: 9 * Modified:
10 * Copyright 2004-2006 Analog Devices Inc. 10 * Copyright 2004-2007 Analog Devices Inc.
11 * 11 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/ 12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
13 * 13 *
@@ -63,6 +63,7 @@ struct l1_sram_piece {
63 void *paddr; 63 void *paddr;
64 int size; 64 int size;
65 int flag; 65 int flag;
66 pid_t pid;
66}; 67};
67 68
68static struct l1_sram_piece l1_ssram[CONFIG_L1_MAX_PIECE]; 69static 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];
80#endif 81#endif
81 82
82/* L1 Scratchpad SRAM initialization function */ 83/* L1 Scratchpad SRAM initialization function */
83void l1sram_init(void) 84void __init l1sram_init(void)
84{ 85{
85 printk(KERN_INFO "Blackfin Scratchpad data SRAM: %d KB\n", 86 printk(KERN_INFO "Blackfin Scratchpad data SRAM: %d KB\n",
86 L1_SCRATCH_LENGTH >> 10); 87 L1_SCRATCH_LENGTH >> 10);
@@ -94,42 +95,43 @@ void l1sram_init(void)
94 spin_lock_init(&l1sram_lock); 95 spin_lock_init(&l1sram_lock);
95} 96}
96 97
97void l1_data_sram_init(void) 98void __init l1_data_sram_init(void)
98{ 99{
99#if L1_DATA_A_LENGTH != 0 100#if L1_DATA_A_LENGTH != 0
100 printk(KERN_INFO "Blackfin DATA_A SRAM: %d KB\n",
101 L1_DATA_A_LENGTH >> 10);
102
103 memset(&l1_data_A_sram, 0x00, sizeof(l1_data_A_sram)); 101 memset(&l1_data_A_sram, 0x00, sizeof(l1_data_A_sram));
104 l1_data_A_sram[0].paddr = (void*)L1_DATA_A_START + 102 l1_data_A_sram[0].paddr = (void *)L1_DATA_A_START +
105 (_ebss_l1 - _sdata_l1); 103 (_ebss_l1 - _sdata_l1);
106 l1_data_A_sram[0].size = L1_DATA_A_LENGTH - (_ebss_l1 - _sdata_l1); 104 l1_data_A_sram[0].size = L1_DATA_A_LENGTH - (_ebss_l1 - _sdata_l1);
107 l1_data_A_sram[0].flag = SRAM_SLT_FREE; 105 l1_data_A_sram[0].flag = SRAM_SLT_FREE;
106
107 printk(KERN_INFO "Blackfin Data A SRAM: %d KB (%d KB free)\n",
108 L1_DATA_A_LENGTH >> 10, l1_data_A_sram[0].size >> 10);
108#endif 109#endif
109#if L1_DATA_B_LENGTH != 0 110#if L1_DATA_B_LENGTH != 0
110 printk(KERN_INFO "Blackfin DATA_B SRAM: %d KB\n",
111 L1_DATA_B_LENGTH >> 10);
112
113 memset(&l1_data_B_sram, 0x00, sizeof(l1_data_B_sram)); 111 memset(&l1_data_B_sram, 0x00, sizeof(l1_data_B_sram));
114 l1_data_B_sram[0].paddr = (void*)L1_DATA_B_START; 112 l1_data_B_sram[0].paddr = (void *)L1_DATA_B_START +
115 l1_data_B_sram[0].size = L1_DATA_B_LENGTH; 113 (_ebss_b_l1 - _sdata_b_l1);
114 l1_data_B_sram[0].size = L1_DATA_B_LENGTH - (_ebss_b_l1 - _sdata_b_l1);
116 l1_data_B_sram[0].flag = SRAM_SLT_FREE; 115 l1_data_B_sram[0].flag = SRAM_SLT_FREE;
116
117 printk(KERN_INFO "Blackfin Data B SRAM: %d KB (%d KB free)\n",
118 L1_DATA_B_LENGTH >> 10, l1_data_B_sram[0].size >> 10);
117#endif 119#endif
118 120
119 /* mutex initialize */ 121 /* mutex initialize */
120 spin_lock_init(&l1_data_sram_lock); 122 spin_lock_init(&l1_data_sram_lock);
121} 123}
122 124
123void l1_inst_sram_init(void) 125void __init l1_inst_sram_init(void)
124{ 126{
125#if L1_CODE_LENGTH != 0 127#if L1_CODE_LENGTH != 0
126 printk(KERN_INFO "Blackfin Instruction SRAM: %d KB\n",
127 L1_CODE_LENGTH >> 10);
128
129 memset(&l1_inst_sram, 0x00, sizeof(l1_inst_sram)); 128 memset(&l1_inst_sram, 0x00, sizeof(l1_inst_sram));
130 l1_inst_sram[0].paddr = (void*)L1_CODE_START + (_etext_l1 - _stext_l1); 129 l1_inst_sram[0].paddr = (void*)L1_CODE_START + (_etext_l1 - _stext_l1);
131 l1_inst_sram[0].size = L1_CODE_LENGTH - (_etext_l1 - _stext_l1); 130 l1_inst_sram[0].size = L1_CODE_LENGTH - (_etext_l1 - _stext_l1);
132 l1_inst_sram[0].flag = SRAM_SLT_FREE; 131 l1_inst_sram[0].flag = SRAM_SLT_FREE;
132
133 printk(KERN_INFO "Blackfin Instruction SRAM: %d KB (%d KB free)\n",
134 L1_CODE_LENGTH >> 10, l1_inst_sram[0].size >> 10);
133#endif 135#endif
134 136
135 /* mutex initialize */ 137 /* mutex initialize */
@@ -149,12 +151,13 @@ static void *_l1_sram_alloc(size_t size, struct l1_sram_piece *pfree, int count)
149 size = (size + 3) & ~3; 151 size = (size + 3) & ~3;
150 152
151 /* not use the good method to match the best slot !!! */ 153 /* not use the good method to match the best slot !!! */
152 /* search an available memeory slot */ 154 /* search an available memory slot */
153 for (i = 0; i < count; i++) { 155 for (i = 0; i < count; i++) {
154 if ((pfree[i].flag == SRAM_SLT_FREE) 156 if ((pfree[i].flag == SRAM_SLT_FREE)
155 && (pfree[i].size >= size)) { 157 && (pfree[i].size >= size)) {
156 addr = pfree[i].paddr; 158 addr = pfree[i].paddr;
157 pfree[i].flag = SRAM_SLT_ALLOCATED; 159 pfree[i].flag = SRAM_SLT_ALLOCATED;
160 pfree[i].pid = current->pid;
158 index = i; 161 index = i;
159 break; 162 break;
160 } 163 }
@@ -162,10 +165,11 @@ static void *_l1_sram_alloc(size_t size, struct l1_sram_piece *pfree, int count)
162 if (i >= count) 165 if (i >= count)
163 return NULL; 166 return NULL;
164 167
165 /* updated the NULL memeory slot !!! */ 168 /* updated the NULL memory slot !!! */
166 if (pfree[i].size > size) { 169 if (pfree[i].size > size) {
167 for (i = 0; i < count; i++) { 170 for (i = 0; i < count; i++) {
168 if (pfree[i].flag == SRAM_SLT_NULL) { 171 if (pfree[i].flag == SRAM_SLT_NULL) {
172 pfree[i].pid = 0;
169 pfree[i].flag = SRAM_SLT_FREE; 173 pfree[i].flag = SRAM_SLT_FREE;
170 pfree[i].paddr = addr + size; 174 pfree[i].paddr = addr + size;
171 pfree[i].size = pfree[index].size - size; 175 pfree[i].size = pfree[index].size - size;
@@ -186,7 +190,7 @@ static void *_l1_sram_alloc_max(struct l1_sram_piece *pfree, int count,
186 int i, index = -1; 190 int i, index = -1;
187 void *addr = NULL; 191 void *addr = NULL;
188 192
189 /* search an available memeory slot */ 193 /* search an available memory slot */
190 for (i = 0; i < count; i++) { 194 for (i = 0; i < count; i++) {
191 if (pfree[i].flag == SRAM_SLT_FREE && pfree[i].size > best) { 195 if (pfree[i].flag == SRAM_SLT_FREE && pfree[i].size > best) {
192 addr = pfree[i].paddr; 196 addr = pfree[i].paddr;
@@ -198,13 +202,15 @@ static void *_l1_sram_alloc_max(struct l1_sram_piece *pfree, int count,
198 return NULL; 202 return NULL;
199 *psize = best; 203 *psize = best;
200 204
205 pfree[index].pid = current->pid;
201 pfree[index].flag = SRAM_SLT_ALLOCATED; 206 pfree[index].flag = SRAM_SLT_ALLOCATED;
202 return addr; 207 return addr;
203} 208}
204 209
205/* L1 memory free function */ 210/* L1 memory free function */
206static int _l1_sram_free(const void *addr, 211static int _l1_sram_free(const void *addr,
207 struct l1_sram_piece *pfree, int count) 212 struct l1_sram_piece *pfree,
213 int count)
208{ 214{
209 int i, index = 0; 215 int i, index = 0;
210 216
@@ -222,12 +228,14 @@ static int _l1_sram_free(const void *addr,
222 if (i >= count) 228 if (i >= count)
223 return -1; 229 return -1;
224 230
231 pfree[index].pid = 0;
225 pfree[index].flag = SRAM_SLT_FREE; 232 pfree[index].flag = SRAM_SLT_FREE;
226 233
227 /* link the next address slot */ 234 /* link the next address slot */
228 for (i = 0; i < count; i++) { 235 for (i = 0; i < count; i++) {
229 if (((pfree[index].paddr + pfree[index].size) == pfree[i].paddr) 236 if (((pfree[index].paddr + pfree[index].size) == pfree[i].paddr)
230 && (pfree[i].flag == SRAM_SLT_FREE)) { 237 && (pfree[i].flag == SRAM_SLT_FREE)) {
238 pfree[i].pid = 0;
231 pfree[i].flag = SRAM_SLT_NULL; 239 pfree[i].flag = SRAM_SLT_NULL;
232 pfree[index].size += pfree[i].size; 240 pfree[index].size += pfree[i].size;
233 pfree[index].flag = SRAM_SLT_FREE; 241 pfree[index].flag = SRAM_SLT_FREE;
@@ -538,3 +546,64 @@ void *sram_alloc_with_lsl(size_t size, unsigned long flags)
538 return addr; 546 return addr;
539} 547}
540EXPORT_SYMBOL(sram_alloc_with_lsl); 548EXPORT_SYMBOL(sram_alloc_with_lsl);
549
550#ifdef CONFIG_PROC_FS
551/* Once we get a real allocator, we'll throw all of this away.
552 * Until then, we need some sort of visibility into the L1 alloc.
553 */
554static void _l1sram_proc_read(char *buf, int *len, const char *desc,
555 struct l1_sram_piece *pfree, const int array_size)
556{
557 int i;
558
559 *len += sprintf(&buf[*len], "--- L1 %-14s Size PID State\n", desc);
560 for (i = 0; i < array_size; ++i) {
561 const char *alloc_type;
562 switch (pfree[i].flag) {
563 case SRAM_SLT_NULL: alloc_type = "NULL"; break;
564 case SRAM_SLT_FREE: alloc_type = "FREE"; break;
565 case SRAM_SLT_ALLOCATED: alloc_type = "ALLOCATED"; break;
566 default: alloc_type = "????"; break;
567 }
568 *len += sprintf(&buf[*len], "%p-%p %8i %4i %s\n",
569 pfree[i].paddr, pfree[i].paddr + pfree[i].size,
570 pfree[i].size, pfree[i].pid, alloc_type);
571 }
572}
573static int l1sram_proc_read(char *buf, char **start, off_t offset, int count,
574 int *eof, void *data)
575{
576 int len = 0;
577
578 _l1sram_proc_read(buf, &len, "Scratchpad",
579 l1_ssram, ARRAY_SIZE(l1_ssram));
580#if L1_DATA_A_LENGTH != 0
581 _l1sram_proc_read(buf, &len, "Data A",
582 l1_data_A_sram, ARRAY_SIZE(l1_data_A_sram));
583#endif
584#if L1_DATA_B_LENGTH != 0
585 _l1sram_proc_read(buf, &len, "Data B",
586 l1_data_B_sram, ARRAY_SIZE(l1_data_B_sram));
587#endif
588#if L1_CODE_LENGTH != 0
589 _l1sram_proc_read(buf, &len, "Instruction",
590 l1_inst_sram, ARRAY_SIZE(l1_inst_sram));
591#endif
592
593 return len;
594}
595
596static int __init l1sram_proc_init(void)
597{
598 struct proc_dir_entry *ptr;
599 ptr = create_proc_entry("sram", S_IFREG | S_IRUGO, NULL);
600 if (!ptr) {
601 printk(KERN_WARNING "unable to create /proc/sram\n");
602 return -1;
603 }
604 ptr->owner = THIS_MODULE;
605 ptr->read_proc = l1sram_proc_read;
606 return 0;
607}
608late_initcall(l1sram_proc_init);
609#endif
diff --git a/arch/blackfin/mm/init.c b/arch/blackfin/mm/init.c
index d6cf1059560d..570356dbe028 100644
--- a/arch/blackfin/mm/init.c
+++ b/arch/blackfin/mm/init.c
@@ -7,7 +7,7 @@
7 * Description: 7 * Description:
8 * 8 *
9 * Modified: 9 * Modified:
10 * Copyright 2004-2006 Analog Devices Inc. 10 * Copyright 2004-2007 Analog Devices Inc.
11 * 11 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/ 12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
13 * 13 *
@@ -53,7 +53,7 @@ static unsigned long empty_bad_page;
53 53
54unsigned long empty_zero_page; 54unsigned long empty_zero_page;
55 55
56void show_mem(void) 56void __init show_mem(void)
57{ 57{
58 unsigned long i; 58 unsigned long i;
59 int free = 0, total = 0, reserved = 0, shared = 0; 59 int free = 0, total = 0, reserved = 0, shared = 0;
@@ -86,7 +86,7 @@ void show_mem(void)
86 * The parameters are pointers to where to stick the starting and ending 86 * The parameters are pointers to where to stick the starting and ending
87 * addresses of available kernel virtual memory. 87 * addresses of available kernel virtual memory.
88 */ 88 */
89void paging_init(void) 89void __init paging_init(void)
90{ 90{
91 /* 91 /*
92 * make sure start_mem is page aligned, otherwise bootmem and 92 * make sure start_mem is page aligned, otherwise bootmem and
@@ -125,7 +125,7 @@ void paging_init(void)
125 } 125 }
126} 126}
127 127
128void mem_init(void) 128void __init mem_init(void)
129{ 129{
130 unsigned int codek = 0, datak = 0, initk = 0; 130 unsigned int codek = 0, datak = 0, initk = 0;
131 unsigned long tmp; 131 unsigned long tmp;
@@ -169,7 +169,7 @@ void mem_init(void)
169} 169}
170 170
171#ifdef CONFIG_BLK_DEV_INITRD 171#ifdef CONFIG_BLK_DEV_INITRD
172void free_initrd_mem(unsigned long start, unsigned long end) 172void __init free_initrd_mem(unsigned long start, unsigned long end)
173{ 173{
174 int pages = 0; 174 int pages = 0;
175 for (; start < end; start += PAGE_SIZE) { 175 for (; start < end; start += PAGE_SIZE) {
@@ -183,14 +183,14 @@ void free_initrd_mem(unsigned long start, unsigned long end)
183} 183}
184#endif 184#endif
185 185
186void free_initmem(void) 186void __init free_initmem(void)
187{ 187{
188#ifdef CONFIG_RAMKERNEL 188#ifdef CONFIG_RAMKERNEL
189 unsigned long addr; 189 unsigned long addr;
190/* 190 /*
191 * the following code should be cool even if these sections 191 * the following code should be cool even if these sections
192 * are not page aligned. 192 * are not page aligned.
193 */ 193 */
194 addr = PAGE_ALIGN((unsigned long)(__init_begin)); 194 addr = PAGE_ALIGN((unsigned long)(__init_begin));
195 /* next to check that the page we free is not a partial page */ 195 /* next to check that the page we free is not a partial page */
196 for (; addr + PAGE_SIZE < (unsigned long)(__init_end); 196 for (; addr + PAGE_SIZE < (unsigned long)(__init_end);
diff --git a/arch/i386/Kconfig.debug b/arch/i386/Kconfig.debug
index b31c0802e1cc..6293920cd1be 100644
--- a/arch/i386/Kconfig.debug
+++ b/arch/i386/Kconfig.debug
@@ -49,6 +49,7 @@ config DEBUG_PAGEALLOC
49config DEBUG_RODATA 49config DEBUG_RODATA
50 bool "Write protect kernel read-only data structures" 50 bool "Write protect kernel read-only data structures"
51 depends on DEBUG_KERNEL 51 depends on DEBUG_KERNEL
52 depends on !KPROBES # temporary for 2.6.22
52 help 53 help
53 Mark the kernel read-only data as write-protected in the pagetables, 54 Mark the kernel read-only data as write-protected in the pagetables,
54 in order to catch accidental (and incorrect) writes to such const 55 in order to catch accidental (and incorrect) writes to such const
diff --git a/arch/i386/kernel/cpu/mtrr/generic.c b/arch/i386/kernel/cpu/mtrr/generic.c
index c4ebb5126ef7..6d5937891b46 100644
--- a/arch/i386/kernel/cpu/mtrr/generic.c
+++ b/arch/i386/kernel/cpu/mtrr/generic.c
@@ -42,7 +42,7 @@ static int mtrr_show;
42module_param_named(show, mtrr_show, bool, 0); 42module_param_named(show, mtrr_show, bool, 0);
43 43
44/* Get the MSR pair relating to a var range */ 44/* Get the MSR pair relating to a var range */
45static void __init 45static void
46get_mtrr_var_range(unsigned int index, struct mtrr_var_range *vr) 46get_mtrr_var_range(unsigned int index, struct mtrr_var_range *vr)
47{ 47{
48 rdmsr(MTRRphysBase_MSR(index), vr->base_lo, vr->base_hi); 48 rdmsr(MTRRphysBase_MSR(index), vr->base_lo, vr->base_hi);
@@ -68,7 +68,7 @@ void mtrr_save_fixed_ranges(void *info)
68 get_fixed_ranges(mtrr_state.fixed_ranges); 68 get_fixed_ranges(mtrr_state.fixed_ranges);
69} 69}
70 70
71static void __cpuinit print_fixed(unsigned base, unsigned step, const mtrr_type*types) 71static void print_fixed(unsigned base, unsigned step, const mtrr_type*types)
72{ 72{
73 unsigned i; 73 unsigned i;
74 74
diff --git a/arch/i386/kernel/cpu/mtrr/main.c b/arch/i386/kernel/cpu/mtrr/main.c
index 7202b98aac4f..55b005152a11 100644
--- a/arch/i386/kernel/cpu/mtrr/main.c
+++ b/arch/i386/kernel/cpu/mtrr/main.c
@@ -639,7 +639,7 @@ static struct sysdev_driver mtrr_sysdev_driver = {
639 * initialized (i.e. before smp_init()). 639 * initialized (i.e. before smp_init()).
640 * 640 *
641 */ 641 */
642void mtrr_bp_init(void) 642__init void mtrr_bp_init(void)
643{ 643{
644 init_ifs(); 644 init_ifs();
645 645
diff --git a/arch/i386/kernel/cpu/perfctr-watchdog.c b/arch/i386/kernel/cpu/perfctr-watchdog.c
index 2b04c8f1db62..f0b67630b90d 100644
--- a/arch/i386/kernel/cpu/perfctr-watchdog.c
+++ b/arch/i386/kernel/cpu/perfctr-watchdog.c
@@ -28,7 +28,7 @@ struct wd_ops {
28 void (*unreserve)(void); 28 void (*unreserve)(void);
29 int (*setup)(unsigned nmi_hz); 29 int (*setup)(unsigned nmi_hz);
30 void (*rearm)(struct nmi_watchdog_ctlblk *wd, unsigned nmi_hz); 30 void (*rearm)(struct nmi_watchdog_ctlblk *wd, unsigned nmi_hz);
31 void (*stop)(void *); 31 void (*stop)(void);
32 unsigned perfctr; 32 unsigned perfctr;
33 unsigned evntsel; 33 unsigned evntsel;
34 u64 checkbit; 34 u64 checkbit;
@@ -142,7 +142,7 @@ void disable_lapic_nmi_watchdog(void)
142 if (atomic_read(&nmi_active) <= 0) 142 if (atomic_read(&nmi_active) <= 0)
143 return; 143 return;
144 144
145 on_each_cpu(wd_ops->stop, NULL, 0, 1); 145 on_each_cpu(stop_apic_nmi_watchdog, NULL, 0, 1);
146 wd_ops->unreserve(); 146 wd_ops->unreserve();
147 147
148 BUG_ON(atomic_read(&nmi_active) != 0); 148 BUG_ON(atomic_read(&nmi_active) != 0);
@@ -255,7 +255,7 @@ static int setup_k7_watchdog(unsigned nmi_hz)
255 return 1; 255 return 1;
256} 256}
257 257
258static void single_msr_stop_watchdog(void *arg) 258static void single_msr_stop_watchdog(void)
259{ 259{
260 struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk); 260 struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk);
261 261
@@ -276,8 +276,8 @@ static int single_msr_reserve(void)
276 276
277static void single_msr_unreserve(void) 277static void single_msr_unreserve(void)
278{ 278{
279 release_evntsel_nmi(wd_ops->perfctr); 279 release_evntsel_nmi(wd_ops->evntsel);
280 release_perfctr_nmi(wd_ops->evntsel); 280 release_perfctr_nmi(wd_ops->perfctr);
281} 281}
282 282
283static void single_msr_rearm(struct nmi_watchdog_ctlblk *wd, unsigned nmi_hz) 283static void single_msr_rearm(struct nmi_watchdog_ctlblk *wd, unsigned nmi_hz)
@@ -442,7 +442,7 @@ static int setup_p4_watchdog(unsigned nmi_hz)
442 return 1; 442 return 1;
443} 443}
444 444
445static void stop_p4_watchdog(void *arg) 445static void stop_p4_watchdog(void)
446{ 446{
447 struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk); 447 struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk);
448 wrmsr(wd->cccr_msr, 0, 0); 448 wrmsr(wd->cccr_msr, 0, 0);
@@ -475,10 +475,10 @@ static void p4_unreserve(void)
475{ 475{
476#ifdef CONFIG_SMP 476#ifdef CONFIG_SMP
477 if (smp_num_siblings > 1) 477 if (smp_num_siblings > 1)
478 release_evntsel_nmi(MSR_P4_IQ_PERFCTR1); 478 release_perfctr_nmi(MSR_P4_IQ_PERFCTR1);
479#endif 479#endif
480 release_evntsel_nmi(MSR_P4_IQ_PERFCTR0); 480 release_evntsel_nmi(MSR_P4_CRU_ESCR0);
481 release_perfctr_nmi(MSR_P4_CRU_ESCR0); 481 release_perfctr_nmi(MSR_P4_IQ_PERFCTR0);
482} 482}
483 483
484static void p4_rearm(struct nmi_watchdog_ctlblk *wd, unsigned nmi_hz) 484static void p4_rearm(struct nmi_watchdog_ctlblk *wd, unsigned nmi_hz)
@@ -614,6 +614,12 @@ int lapic_watchdog_init(unsigned nmi_hz)
614 probe_nmi_watchdog(); 614 probe_nmi_watchdog();
615 if (!wd_ops) 615 if (!wd_ops)
616 return -1; 616 return -1;
617
618 if (!wd_ops->reserve()) {
619 printk(KERN_ERR
620 "NMI watchdog: cannot reserve perfctrs\n");
621 return -1;
622 }
617 } 623 }
618 624
619 if (!(wd_ops->setup(nmi_hz))) { 625 if (!(wd_ops->setup(nmi_hz))) {
@@ -628,7 +634,7 @@ int lapic_watchdog_init(unsigned nmi_hz)
628void lapic_watchdog_stop(void) 634void lapic_watchdog_stop(void)
629{ 635{
630 if (wd_ops) 636 if (wd_ops)
631 wd_ops->stop(NULL); 637 wd_ops->stop();
632} 638}
633 639
634unsigned lapic_adjust_nmi_hz(unsigned hz) 640unsigned lapic_adjust_nmi_hz(unsigned hz)
diff --git a/arch/i386/kernel/pci-dma.c b/arch/i386/kernel/pci-dma.c
index 30b754f7cbec..048f09b62553 100644
--- a/arch/i386/kernel/pci-dma.c
+++ b/arch/i386/kernel/pci-dma.c
@@ -12,6 +12,7 @@
12#include <linux/string.h> 12#include <linux/string.h>
13#include <linux/pci.h> 13#include <linux/pci.h>
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/pci.h>
15#include <asm/io.h> 16#include <asm/io.h>
16 17
17struct dma_coherent_mem { 18struct dma_coherent_mem {
@@ -148,3 +149,29 @@ void *dma_mark_declared_memory_occupied(struct device *dev,
148 return mem->virt_base + (pos << PAGE_SHIFT); 149 return mem->virt_base + (pos << PAGE_SHIFT);
149} 150}
150EXPORT_SYMBOL(dma_mark_declared_memory_occupied); 151EXPORT_SYMBOL(dma_mark_declared_memory_occupied);
152
153#ifdef CONFIG_PCI
154/* Many VIA bridges seem to corrupt data for DAC. Disable it here */
155
156int forbid_dac;
157EXPORT_SYMBOL(forbid_dac);
158
159static __devinit void via_no_dac(struct pci_dev *dev)
160{
161 if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI && forbid_dac == 0) {
162 printk(KERN_INFO "PCI: VIA PCI bridge detected. Disabling DAC.\n");
163 forbid_dac = 1;
164 }
165}
166DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_ANY_ID, via_no_dac);
167
168static int check_iommu(char *s)
169{
170 if (!strcmp(s, "usedac")) {
171 forbid_dac = -1;
172 return 1;
173 }
174 return 0;
175}
176__setup("iommu=", check_iommu);
177#endif
diff --git a/arch/i386/mm/pageattr.c b/arch/i386/mm/pageattr.c
index 47bd477c8ecc..2eb14a73be9c 100644
--- a/arch/i386/mm/pageattr.c
+++ b/arch/i386/mm/pageattr.c
@@ -68,14 +68,23 @@ static struct page *split_large_page(unsigned long address, pgprot_t prot,
68 return base; 68 return base;
69} 69}
70 70
71static void flush_kernel_map(void *arg) 71static void cache_flush_page(struct page *p)
72{ 72{
73 unsigned long adr = (unsigned long)arg; 73 unsigned long adr = (unsigned long)page_address(p);
74 int i;
75 for (i = 0; i < PAGE_SIZE; i += boot_cpu_data.x86_clflush_size)
76 asm volatile("clflush (%0)" :: "r" (adr + i));
77}
78
79static void flush_kernel_map(void *arg)
80{
81 struct list_head *lh = (struct list_head *)arg;
82 struct page *p;
74 83
75 if (adr && cpu_has_clflush) { 84 /* High level code is not ready for clflush yet */
76 int i; 85 if (0 && cpu_has_clflush) {
77 for (i = 0; i < PAGE_SIZE; i += boot_cpu_data.x86_clflush_size) 86 list_for_each_entry (p, lh, lru)
78 asm volatile("clflush (%0)" :: "r" (adr + i)); 87 cache_flush_page(p);
79 } else if (boot_cpu_data.x86_model >= 4) 88 } else if (boot_cpu_data.x86_model >= 4)
80 wbinvd(); 89 wbinvd();
81 90
@@ -181,9 +190,9 @@ __change_page_attr(struct page *page, pgprot_t prot)
181 return 0; 190 return 0;
182} 191}
183 192
184static inline void flush_map(void *adr) 193static inline void flush_map(struct list_head *l)
185{ 194{
186 on_each_cpu(flush_kernel_map, adr, 1, 1); 195 on_each_cpu(flush_kernel_map, l, 1, 1);
187} 196}
188 197
189/* 198/*
@@ -225,11 +234,8 @@ void global_flush_tlb(void)
225 spin_lock_irq(&cpa_lock); 234 spin_lock_irq(&cpa_lock);
226 list_replace_init(&df_list, &l); 235 list_replace_init(&df_list, &l);
227 spin_unlock_irq(&cpa_lock); 236 spin_unlock_irq(&cpa_lock);
228 if (!cpu_has_clflush) 237 flush_map(&l);
229 flush_map(NULL);
230 list_for_each_entry_safe(pg, next, &l, lru) { 238 list_for_each_entry_safe(pg, next, &l, lru) {
231 if (cpu_has_clflush)
232 flush_map(page_address(pg));
233 __free_page(pg); 239 __free_page(pg);
234 } 240 }
235} 241}
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 85cdd23b0447..a86e2e9a639f 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -418,9 +418,6 @@ config STRAM_PROC
418 help 418 help
419 Say Y here to report ST-RAM usage statistics in /proc/stram. 419 Say Y here to report ST-RAM usage statistics in /proc/stram.
420 420
421config ATARI_KBD_CORE
422 bool
423
424config HEARTBEAT 421config HEARTBEAT
425 bool "Use power LED as a heartbeat" if AMIGA || APOLLO || ATARI || MAC ||Q40 422 bool "Use power LED as a heartbeat" if AMIGA || APOLLO || ATARI || MAC ||Q40
426 default y if !AMIGA && !APOLLO && !ATARI && !MAC && !Q40 && HP300 423 default y if !AMIGA && !APOLLO && !ATARI && !MAC && !Q40 && HP300
diff --git a/arch/mips/kernel/smp-mt.c b/arch/mips/kernel/smp-mt.c
index 64b62bdfb4f6..b8fa7ddd78f6 100644
--- a/arch/mips/kernel/smp-mt.c
+++ b/arch/mips/kernel/smp-mt.c
@@ -129,13 +129,13 @@ static irqreturn_t ipi_call_interrupt(int irq, void *dev_id)
129 129
130static struct irqaction irq_resched = { 130static struct irqaction irq_resched = {
131 .handler = ipi_resched_interrupt, 131 .handler = ipi_resched_interrupt,
132 .flags = IRQF_DISABLED, 132 .flags = IRQF_DISABLED|IRQF_PERCPU,
133 .name = "IPI_resched" 133 .name = "IPI_resched"
134}; 134};
135 135
136static struct irqaction irq_call = { 136static struct irqaction irq_call = {
137 .handler = ipi_call_interrupt, 137 .handler = ipi_call_interrupt,
138 .flags = IRQF_DISABLED, 138 .flags = IRQF_DISABLED|IRQF_PERCPU,
139 .name = "IPI_call" 139 .name = "IPI_call"
140}; 140};
141 141
@@ -275,10 +275,7 @@ void __init plat_prepare_cpus(unsigned int max_cpus)
275 setup_irq(cpu_ipi_resched_irq, &irq_resched); 275 setup_irq(cpu_ipi_resched_irq, &irq_resched);
276 setup_irq(cpu_ipi_call_irq, &irq_call); 276 setup_irq(cpu_ipi_call_irq, &irq_call);
277 277
278 /* need to mark IPI's as IRQ_PER_CPU */
279 irq_desc[cpu_ipi_resched_irq].status |= IRQ_PER_CPU;
280 set_irq_handler(cpu_ipi_resched_irq, handle_percpu_irq); 278 set_irq_handler(cpu_ipi_resched_irq, handle_percpu_irq);
281 irq_desc[cpu_ipi_call_irq].status |= IRQ_PER_CPU;
282 set_irq_handler(cpu_ipi_call_irq, handle_percpu_irq); 279 set_irq_handler(cpu_ipi_call_irq, handle_percpu_irq);
283} 280}
284 281
@@ -326,8 +323,11 @@ void prom_boot_secondary(int cpu, struct task_struct *idle)
326 323
327void prom_init_secondary(void) 324void prom_init_secondary(void)
328{ 325{
326 /* Enable per-cpu interrupts */
327
328 /* This is Malta specific: IPI,performance and timer inetrrupts */
329 write_c0_status((read_c0_status() & ~ST0_IM ) | 329 write_c0_status((read_c0_status() & ~ST0_IM ) |
330 (STATUSF_IP0 | STATUSF_IP1 | STATUSF_IP7)); 330 (STATUSF_IP0 | STATUSF_IP1 | STATUSF_IP6 | STATUSF_IP7));
331} 331}
332 332
333void prom_smp_finish(void) 333void prom_smp_finish(void)
diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c
index 21eb5993a19f..2e011470c347 100644
--- a/arch/mips/kernel/smtc.c
+++ b/arch/mips/kernel/smtc.c
@@ -13,9 +13,9 @@
13#include <asm/system.h> 13#include <asm/system.h>
14#include <asm/hardirq.h> 14#include <asm/hardirq.h>
15#include <asm/hazards.h> 15#include <asm/hazards.h>
16#include <asm/irq.h>
16#include <asm/mmu_context.h> 17#include <asm/mmu_context.h>
17#include <asm/smp.h> 18#include <asm/smp.h>
18#include <asm/mips-boards/maltaint.h>
19#include <asm/mipsregs.h> 19#include <asm/mipsregs.h>
20#include <asm/cacheflush.h> 20#include <asm/cacheflush.h>
21#include <asm/time.h> 21#include <asm/time.h>
@@ -614,7 +614,7 @@ int setup_irq_smtc(unsigned int irq, struct irqaction * new,
614#ifdef CONFIG_SMTC_IDLE_HOOK_DEBUG 614#ifdef CONFIG_SMTC_IDLE_HOOK_DEBUG
615 unsigned int vpe = current_cpu_data.vpe_id; 615 unsigned int vpe = current_cpu_data.vpe_id;
616 616
617 vpemask[vpe][irq - MIPSCPU_INT_BASE] = 1; 617 vpemask[vpe][irq - MIPS_CPU_IRQ_BASE] = 1;
618#endif 618#endif
619 irq_hwmask[irq] = hwmask; 619 irq_hwmask[irq] = hwmask;
620 620
@@ -822,7 +822,7 @@ void ipi_decode(struct smtc_ipi *pipi)
822 switch (type_copy) { 822 switch (type_copy) {
823 case SMTC_CLOCK_TICK: 823 case SMTC_CLOCK_TICK:
824 irq_enter(); 824 irq_enter();
825 kstat_this_cpu.irqs[MIPSCPU_INT_BASE + MIPSCPU_INT_CPUCTR]++; 825 kstat_this_cpu.irqs[MIPS_CPU_IRQ_BASE + cp0_perfcount_irq]++;
826 /* Invoke Clock "Interrupt" */ 826 /* Invoke Clock "Interrupt" */
827 ipi_timer_latch[dest_copy] = 0; 827 ipi_timer_latch[dest_copy] = 0;
828#ifdef CONFIG_SMTC_IDLE_HOOK_DEBUG 828#ifdef CONFIG_SMTC_IDLE_HOOK_DEBUG
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
index 751b4a18b133..d48d1d5bea0a 100644
--- a/arch/mips/kernel/time.c
+++ b/arch/mips/kernel/time.c
@@ -199,6 +199,35 @@ int (*perf_irq)(void) = null_perf_irq;
199EXPORT_SYMBOL(null_perf_irq); 199EXPORT_SYMBOL(null_perf_irq);
200EXPORT_SYMBOL(perf_irq); 200EXPORT_SYMBOL(perf_irq);
201 201
202/*
203 * Timer interrupt
204 */
205int cp0_compare_irq;
206
207/*
208 * Performance counter IRQ or -1 if shared with timer
209 */
210int cp0_perfcount_irq;
211EXPORT_SYMBOL_GPL(cp0_perfcount_irq);
212
213/*
214 * Possibly handle a performance counter interrupt.
215 * Return true if the timer interrupt should not be checked
216 */
217static inline int handle_perf_irq (int r2)
218{
219 /*
220 * The performance counter overflow interrupt may be shared with the
221 * timer interrupt (cp0_perfcount_irq < 0). If it is and a
222 * performance counter has overflowed (perf_irq() == IRQ_HANDLED)
223 * and we can't reliably determine if a counter interrupt has also
224 * happened (!r2) then don't check for a timer interrupt.
225 */
226 return (cp0_perfcount_irq < 0) &&
227 perf_irq() == IRQ_HANDLED &&
228 !r2;
229}
230
202asmlinkage void ll_timer_interrupt(int irq) 231asmlinkage void ll_timer_interrupt(int irq)
203{ 232{
204 int r2 = cpu_has_mips_r2; 233 int r2 = cpu_has_mips_r2;
@@ -206,19 +235,13 @@ asmlinkage void ll_timer_interrupt(int irq)
206 irq_enter(); 235 irq_enter();
207 kstat_this_cpu.irqs[irq]++; 236 kstat_this_cpu.irqs[irq]++;
208 237
209 /* 238 if (handle_perf_irq(r2))
210 * Suckage alert: 239 goto out;
211 * Before R2 of the architecture there was no way to see if a
212 * performance counter interrupt was pending, so we have to run the
213 * performance counter interrupt handler anyway.
214 */
215 if (!r2 || (read_c0_cause() & (1 << 26)))
216 if (perf_irq())
217 goto out;
218 240
219 /* we keep interrupt disabled all the time */ 241 if (r2 && ((read_c0_cause() & (1 << 30)) == 0))
220 if (!r2 || (read_c0_cause() & (1 << 30))) 242 goto out;
221 timer_interrupt(irq, NULL); 243
244 timer_interrupt(irq, NULL);
222 245
223out: 246out:
224 irq_exit(); 247 irq_exit();
@@ -258,7 +281,7 @@ unsigned int mips_hpt_frequency;
258 281
259static struct irqaction timer_irqaction = { 282static struct irqaction timer_irqaction = {
260 .handler = timer_interrupt, 283 .handler = timer_interrupt,
261 .flags = IRQF_DISABLED, 284 .flags = IRQF_DISABLED | IRQF_PERCPU,
262 .name = "timer", 285 .name = "timer",
263}; 286};
264 287
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index a7a17eb9bfcd..b1233644fcca 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -1350,9 +1350,6 @@ void __init per_cpu_trap_init(void)
1350 if (!secondaryTC) { 1350 if (!secondaryTC) {
1351#endif /* CONFIG_MIPS_MT_SMTC */ 1351#endif /* CONFIG_MIPS_MT_SMTC */
1352 1352
1353 /*
1354 * Interrupt handling.
1355 */
1356 if (cpu_has_veic || cpu_has_vint) { 1353 if (cpu_has_veic || cpu_has_vint) {
1357 write_c0_ebase (ebase); 1354 write_c0_ebase (ebase);
1358 /* Setting vector spacing enables EI/VI mode */ 1355 /* Setting vector spacing enables EI/VI mode */
@@ -1366,6 +1363,23 @@ void __init per_cpu_trap_init(void)
1366 } else 1363 } else
1367 set_c0_cause(CAUSEF_IV); 1364 set_c0_cause(CAUSEF_IV);
1368 } 1365 }
1366
1367 /*
1368 * Before R2 both interrupt numbers were fixed to 7, so on R2 only:
1369 *
1370 * o read IntCtl.IPTI to determine the timer interrupt
1371 * o read IntCtl.IPPCI to determine the performance counter interrupt
1372 */
1373 if (cpu_has_mips_r2) {
1374 cp0_compare_irq = (read_c0_intctl () >> 29) & 7;
1375 cp0_perfcount_irq = -1;
1376 } else {
1377 cp0_compare_irq = CP0_LEGACY_COMPARE_IRQ;
1378 cp0_perfcount_irq = (read_c0_intctl () >> 26) & 7;
1379 if (cp0_perfcount_irq != cp0_compare_irq)
1380 cp0_perfcount_irq = -1;
1381 }
1382
1369#ifdef CONFIG_MIPS_MT_SMTC 1383#ifdef CONFIG_MIPS_MT_SMTC
1370 } 1384 }
1371#endif /* CONFIG_MIPS_MT_SMTC */ 1385#endif /* CONFIG_MIPS_MT_SMTC */
diff --git a/arch/mips/mips-boards/atlas/atlas_int.c b/arch/mips/mips-boards/atlas/atlas_int.c
index 9f49da95aacf..6c8f0255e85d 100644
--- a/arch/mips/mips-boards/atlas/atlas_int.c
+++ b/arch/mips/mips-boards/atlas/atlas_int.c
@@ -189,7 +189,7 @@ asmlinkage void plat_irq_dispatch(void)
189 if (irq == MIPSCPU_INT_ATLAS) 189 if (irq == MIPSCPU_INT_ATLAS)
190 atlas_hw0_irqdispatch(); 190 atlas_hw0_irqdispatch();
191 else if (irq >= 0) 191 else if (irq >= 0)
192 do_IRQ(MIPSCPU_INT_BASE + irq); 192 do_IRQ(MIPS_CPU_IRQ_BASE + irq);
193 else 193 else
194 spurious_interrupt(); 194 spurious_interrupt();
195} 195}
@@ -261,11 +261,11 @@ void __init arch_init_irq(void)
261 } else if (cpu_has_vint) { 261 } else if (cpu_has_vint) {
262 set_vi_handler (MIPSCPU_INT_ATLAS, atlas_hw0_irqdispatch); 262 set_vi_handler (MIPSCPU_INT_ATLAS, atlas_hw0_irqdispatch);
263#ifdef CONFIG_MIPS_MT_SMTC 263#ifdef CONFIG_MIPS_MT_SMTC
264 setup_irq_smtc (MIPSCPU_INT_BASE + MIPSCPU_INT_ATLAS, 264 setup_irq_smtc (MIPS_CPU_IRQ_BASE + MIPSCPU_INT_ATLAS,
265 &atlasirq, (0x100 << MIPSCPU_INT_ATLAS)); 265 &atlasirq, (0x100 << MIPSCPU_INT_ATLAS));
266#else /* Not SMTC */ 266#else /* Not SMTC */
267 setup_irq(MIPSCPU_INT_BASE + MIPSCPU_INT_ATLAS, &atlasirq); 267 setup_irq(MIPS_CPU_IRQ_BASE + MIPSCPU_INT_ATLAS, &atlasirq);
268#endif /* CONFIG_MIPS_MT_SMTC */ 268#endif /* CONFIG_MIPS_MT_SMTC */
269 } else 269 } else
270 setup_irq(MIPSCPU_INT_BASE + MIPSCPU_INT_ATLAS, &atlasirq); 270 setup_irq(MIPS_CPU_IRQ_BASE + MIPSCPU_INT_ATLAS, &atlasirq);
271} 271}
diff --git a/arch/mips/mips-boards/generic/init.c b/arch/mips/mips-boards/generic/init.c
index 88e9c2a7a2f9..4eabc1eadd23 100644
--- a/arch/mips/mips-boards/generic/init.c
+++ b/arch/mips/mips-boards/generic/init.c
@@ -57,7 +57,8 @@ int *_prom_argv, *_prom_envp;
57 57
58int init_debug = 0; 58int init_debug = 0;
59 59
60unsigned int mips_revision_corid; 60int mips_revision_corid;
61int mips_revision_sconid;
61 62
62/* Bonito64 system controller register base. */ 63/* Bonito64 system controller register base. */
63unsigned long _pcictrl_bonito; 64unsigned long _pcictrl_bonito;
@@ -275,13 +276,38 @@ void __init prom_init(void)
275 else 276 else
276 mips_revision_corid = MIPS_REVISION_CORID_CORE_EMUL_MSC; 277 mips_revision_corid = MIPS_REVISION_CORID_CORE_EMUL_MSC;
277 } 278 }
278 switch(mips_revision_corid) { 279
280 mips_revision_sconid = MIPS_REVISION_SCONID;
281 if (mips_revision_sconid == MIPS_REVISION_SCON_OTHER) {
282 switch (mips_revision_corid) {
283 case MIPS_REVISION_CORID_QED_RM5261:
284 case MIPS_REVISION_CORID_CORE_LV:
285 case MIPS_REVISION_CORID_CORE_FPGA:
286 case MIPS_REVISION_CORID_CORE_FPGAR2:
287 mips_revision_sconid = MIPS_REVISION_SCON_GT64120;
288 break;
289 case MIPS_REVISION_CORID_CORE_EMUL_BON:
290 case MIPS_REVISION_CORID_BONITO64:
291 case MIPS_REVISION_CORID_CORE_20K:
292 mips_revision_sconid = MIPS_REVISION_SCON_BONITO;
293 break;
294 case MIPS_REVISION_CORID_CORE_MSC:
295 case MIPS_REVISION_CORID_CORE_FPGA2:
296 case MIPS_REVISION_CORID_CORE_FPGA3:
297 case MIPS_REVISION_CORID_CORE_24K:
298 case MIPS_REVISION_CORID_CORE_EMUL_MSC:
299 mips_revision_sconid = MIPS_REVISION_SCON_SOCIT;
300 break;
301 default:
302 mips_display_message("CC Error");
303 while (1); /* We die here... */
304 }
305 }
306
307 switch (mips_revision_sconid) {
279 u32 start, map, mask, data; 308 u32 start, map, mask, data;
280 309
281 case MIPS_REVISION_CORID_QED_RM5261: 310 case MIPS_REVISION_SCON_GT64120:
282 case MIPS_REVISION_CORID_CORE_LV:
283 case MIPS_REVISION_CORID_CORE_FPGA:
284 case MIPS_REVISION_CORID_CORE_FPGAR2:
285 /* 311 /*
286 * Setup the North bridge to do Master byte-lane swapping 312 * Setup the North bridge to do Master byte-lane swapping
287 * when running in bigendian. 313 * when running in bigendian.
@@ -305,9 +331,7 @@ void __init prom_init(void)
305 set_io_port_base(MALTA_GT_PORT_BASE); 331 set_io_port_base(MALTA_GT_PORT_BASE);
306 break; 332 break;
307 333
308 case MIPS_REVISION_CORID_CORE_EMUL_BON: 334 case MIPS_REVISION_SCON_BONITO:
309 case MIPS_REVISION_CORID_BONITO64:
310 case MIPS_REVISION_CORID_CORE_20K:
311 _pcictrl_bonito_pcicfg = (unsigned long)ioremap(BONITO_PCICFG_BASE, BONITO_PCICFG_SIZE); 335 _pcictrl_bonito_pcicfg = (unsigned long)ioremap(BONITO_PCICFG_BASE, BONITO_PCICFG_SIZE);
312 336
313 /* 337 /*
@@ -334,13 +358,10 @@ void __init prom_init(void)
334 set_io_port_base(MALTA_BONITO_PORT_BASE); 358 set_io_port_base(MALTA_BONITO_PORT_BASE);
335 break; 359 break;
336 360
337 case MIPS_REVISION_CORID_CORE_MSC: 361 case MIPS_REVISION_SCON_SOCIT:
338 case MIPS_REVISION_CORID_CORE_FPGA2: 362 case MIPS_REVISION_SCON_ROCIT:
339 case MIPS_REVISION_CORID_CORE_FPGA3:
340 case MIPS_REVISION_CORID_CORE_24K:
341 case MIPS_REVISION_CORID_CORE_EMUL_MSC:
342 _pcictrl_msc = (unsigned long)ioremap(MIPS_MSC01_PCI_REG_BASE, 0x2000); 363 _pcictrl_msc = (unsigned long)ioremap(MIPS_MSC01_PCI_REG_BASE, 0x2000);
343 364 mips_pci_controller:
344 mb(); 365 mb();
345 MSC_READ(MSC01_PCI_CFG, data); 366 MSC_READ(MSC01_PCI_CFG, data);
346 MSC_WRITE(MSC01_PCI_CFG, data & ~MSC01_PCI_CFG_EN_BIT); 367 MSC_WRITE(MSC01_PCI_CFG, data & ~MSC01_PCI_CFG_EN_BIT);
@@ -374,10 +395,15 @@ void __init prom_init(void)
374 set_io_port_base(MALTA_MSC_PORT_BASE); 395 set_io_port_base(MALTA_MSC_PORT_BASE);
375 break; 396 break;
376 397
398 case MIPS_REVISION_SCON_SOCITSC:
399 case MIPS_REVISION_SCON_SOCITSCP:
400 _pcictrl_msc = (unsigned long)ioremap(MIPS_SOCITSC_PCI_REG_BASE, 0x2000);
401 goto mips_pci_controller;
402
377 default: 403 default:
378 /* Unknown Core card */ 404 /* Unknown system controller */
379 mips_display_message("CC Error"); 405 mips_display_message("SC Error");
380 while(1); /* We die here... */ 406 while (1); /* We die here... */
381 } 407 }
382#endif 408#endif
383 board_nmi_handler_setup = mips_nmi_setup; 409 board_nmi_handler_setup = mips_nmi_setup;
diff --git a/arch/mips/mips-boards/generic/pci.c b/arch/mips/mips-boards/generic/pci.c
index f98d60f78658..c9852206890a 100644
--- a/arch/mips/mips-boards/generic/pci.c
+++ b/arch/mips/mips-boards/generic/pci.c
@@ -92,11 +92,8 @@ void __init mips_pcibios_init(void)
92 struct pci_controller *controller; 92 struct pci_controller *controller;
93 resource_size_t start, end, map, start1, end1, map1, map2, map3, mask; 93 resource_size_t start, end, map, start1, end1, map1, map2, map3, mask;
94 94
95 switch (mips_revision_corid) { 95 switch (mips_revision_sconid) {
96 case MIPS_REVISION_CORID_QED_RM5261: 96 case MIPS_REVISION_SCON_GT64120:
97 case MIPS_REVISION_CORID_CORE_LV:
98 case MIPS_REVISION_CORID_CORE_FPGA:
99 case MIPS_REVISION_CORID_CORE_FPGAR2:
100 /* 97 /*
101 * Due to a bug in the Galileo system controller, we need 98 * Due to a bug in the Galileo system controller, we need
102 * to setup the PCI BAR for the Galileo internal registers. 99 * to setup the PCI BAR for the Galileo internal registers.
@@ -161,9 +158,7 @@ void __init mips_pcibios_init(void)
161 controller = &gt64120_controller; 158 controller = &gt64120_controller;
162 break; 159 break;
163 160
164 case MIPS_REVISION_CORID_BONITO64: 161 case MIPS_REVISION_SCON_BONITO:
165 case MIPS_REVISION_CORID_CORE_20K:
166 case MIPS_REVISION_CORID_CORE_EMUL_BON:
167 /* Set up resource ranges from the controller's registers. */ 162 /* Set up resource ranges from the controller's registers. */
168 map = BONITO_PCIMAP; 163 map = BONITO_PCIMAP;
169 map1 = (BONITO_PCIMAP & BONITO_PCIMAP_PCIMAP_LO0) >> 164 map1 = (BONITO_PCIMAP & BONITO_PCIMAP_PCIMAP_LO0) >>
@@ -195,11 +190,10 @@ void __init mips_pcibios_init(void)
195 controller = &bonito64_controller; 190 controller = &bonito64_controller;
196 break; 191 break;
197 192
198 case MIPS_REVISION_CORID_CORE_MSC: 193 case MIPS_REVISION_SCON_SOCIT:
199 case MIPS_REVISION_CORID_CORE_FPGA2: 194 case MIPS_REVISION_SCON_ROCIT:
200 case MIPS_REVISION_CORID_CORE_FPGA3: 195 case MIPS_REVISION_SCON_SOCITSC:
201 case MIPS_REVISION_CORID_CORE_24K: 196 case MIPS_REVISION_SCON_SOCITSCP:
202 case MIPS_REVISION_CORID_CORE_EMUL_MSC:
203 /* Set up resource ranges from the controller's registers. */ 197 /* Set up resource ranges from the controller's registers. */
204 MSC_READ(MSC01_PCI_SC2PMBASL, start); 198 MSC_READ(MSC01_PCI_SC2PMBASL, start);
205 MSC_READ(MSC01_PCI_SC2PMMSKL, mask); 199 MSC_READ(MSC01_PCI_SC2PMMSKL, mask);
diff --git a/arch/mips/mips-boards/generic/time.c b/arch/mips/mips-boards/generic/time.c
index b41db9e7ab1f..c45d556aa96b 100644
--- a/arch/mips/mips-boards/generic/time.c
+++ b/arch/mips/mips-boards/generic/time.c
@@ -53,9 +53,8 @@
53 53
54unsigned long cpu_khz; 54unsigned long cpu_khz;
55 55
56#define CPUCTR_IMASKBIT (0x100 << MIPSCPU_INT_CPUCTR)
57
58static int mips_cpu_timer_irq; 56static int mips_cpu_timer_irq;
57extern int cp0_perfcount_irq;
59extern void smtc_timer_broadcast(int); 58extern void smtc_timer_broadcast(int);
60 59
61static void mips_timer_dispatch(void) 60static void mips_timer_dispatch(void)
@@ -63,6 +62,11 @@ static void mips_timer_dispatch(void)
63 do_IRQ(mips_cpu_timer_irq); 62 do_IRQ(mips_cpu_timer_irq);
64} 63}
65 64
65static void mips_perf_dispatch(void)
66{
67 do_IRQ(cp0_perfcount_irq);
68}
69
66/* 70/*
67 * Redeclare until I get around mopping the timer code insanity on MIPS. 71 * Redeclare until I get around mopping the timer code insanity on MIPS.
68 */ 72 */
@@ -70,6 +74,24 @@ extern int null_perf_irq(void);
70 74
71extern int (*perf_irq)(void); 75extern int (*perf_irq)(void);
72 76
77/*
78 * Possibly handle a performance counter interrupt.
79 * Return true if the timer interrupt should not be checked
80 */
81static inline int handle_perf_irq (int r2)
82{
83 /*
84 * The performance counter overflow interrupt may be shared with the
85 * timer interrupt (cp0_perfcount_irq < 0). If it is and a
86 * performance counter has overflowed (perf_irq() == IRQ_HANDLED)
87 * and we can't reliably determine if a counter interrupt has also
88 * happened (!r2) then don't check for a timer interrupt.
89 */
90 return (cp0_perfcount_irq < 0) &&
91 perf_irq() == IRQ_HANDLED &&
92 !r2;
93}
94
73irqreturn_t mips_timer_interrupt(int irq, void *dev_id) 95irqreturn_t mips_timer_interrupt(int irq, void *dev_id)
74{ 96{
75 int cpu = smp_processor_id(); 97 int cpu = smp_processor_id();
@@ -92,8 +114,7 @@ irqreturn_t mips_timer_interrupt(int irq, void *dev_id)
92 * We could be here due to timer interrupt, 114 * We could be here due to timer interrupt,
93 * perf counter overflow, or both. 115 * perf counter overflow, or both.
94 */ 116 */
95 if (read_c0_cause() & (1 << 26)) 117 (void) handle_perf_irq(1);
96 perf_irq();
97 118
98 if (read_c0_cause() & (1 << 30)) { 119 if (read_c0_cause() & (1 << 30)) {
99 /* 120 /*
@@ -115,19 +136,19 @@ irqreturn_t mips_timer_interrupt(int irq, void *dev_id)
115#else /* CONFIG_MIPS_MT_SMTC */ 136#else /* CONFIG_MIPS_MT_SMTC */
116 int r2 = cpu_has_mips_r2; 137 int r2 = cpu_has_mips_r2;
117 138
139 if (handle_perf_irq(r2))
140 goto out;
141
142 if (r2 && ((read_c0_cause() & (1 << 30)) == 0))
143 goto out;
144
118 if (cpu == 0) { 145 if (cpu == 0) {
119 /* 146 /*
120 * CPU 0 handles the global timer interrupt job and process 147 * CPU 0 handles the global timer interrupt job and process
121 * accounting resets count/compare registers to trigger next 148 * accounting resets count/compare registers to trigger next
122 * timer int. 149 * timer int.
123 */ 150 */
124 if (!r2 || (read_c0_cause() & (1 << 26))) 151 timer_interrupt(irq, NULL);
125 if (perf_irq())
126 goto out;
127
128 /* we keep interrupt disabled all the time */
129 if (!r2 || (read_c0_cause() & (1 << 30)))
130 timer_interrupt(irq, NULL);
131 } else { 152 } else {
132 /* Everyone else needs to reset the timer int here as 153 /* Everyone else needs to reset the timer int here as
133 ll_local_timer_interrupt doesn't */ 154 ll_local_timer_interrupt doesn't */
@@ -225,35 +246,67 @@ void __init mips_time_init(void)
225 mips_scroll_message(); 246 mips_scroll_message();
226} 247}
227 248
249irqreturn_t mips_perf_interrupt(int irq, void *dev_id)
250{
251 return perf_irq();
252}
253
254static struct irqaction perf_irqaction = {
255 .handler = mips_perf_interrupt,
256 .flags = IRQF_DISABLED | IRQF_PERCPU,
257 .name = "performance",
258};
259
260void __init plat_perf_setup(struct irqaction *irq)
261{
262 cp0_perfcount_irq = -1;
263
264#ifdef MSC01E_INT_BASE
265 if (cpu_has_veic) {
266 set_vi_handler (MSC01E_INT_PERFCTR, mips_perf_dispatch);
267 cp0_perfcount_irq = MSC01E_INT_BASE + MSC01E_INT_PERFCTR;
268 } else
269#endif
270 if (cp0_perfcount_irq >= 0) {
271 if (cpu_has_vint)
272 set_vi_handler(cp0_perfcount_irq, mips_perf_dispatch);
273#ifdef CONFIG_MIPS_MT_SMTC
274 setup_irq_smtc(cp0_perfcount_irq, irq,
275 0x100 << cp0_perfcount_irq);
276#else
277 setup_irq(cp0_perfcount_irq, irq);
278#endif /* CONFIG_MIPS_MT_SMTC */
279#ifdef CONFIG_SMP
280 set_irq_handler(cp0_perfcount_irq, handle_percpu_irq);
281#endif
282 }
283}
284
228void __init plat_timer_setup(struct irqaction *irq) 285void __init plat_timer_setup(struct irqaction *irq)
229{ 286{
230#ifdef MSC01E_INT_BASE 287#ifdef MSC01E_INT_BASE
231 if (cpu_has_veic) { 288 if (cpu_has_veic) {
232 set_vi_handler (MSC01E_INT_CPUCTR, mips_timer_dispatch); 289 set_vi_handler (MSC01E_INT_CPUCTR, mips_timer_dispatch);
233 mips_cpu_timer_irq = MSC01E_INT_BASE + MSC01E_INT_CPUCTR; 290 mips_cpu_timer_irq = MSC01E_INT_BASE + MSC01E_INT_CPUCTR;
234 } else 291 }
292 else
235#endif 293#endif
236 { 294 {
237 if (cpu_has_vint) 295 if (cpu_has_vint)
238 set_vi_handler (MIPSCPU_INT_CPUCTR, mips_timer_dispatch); 296 set_vi_handler(cp0_compare_irq, mips_timer_dispatch);
239 mips_cpu_timer_irq = MIPSCPU_INT_BASE + MIPSCPU_INT_CPUCTR; 297 mips_cpu_timer_irq = MIPS_CPU_IRQ_BASE + cp0_compare_irq;
240 } 298 }
241 299
242
243 /* we are using the cpu counter for timer interrupts */ 300 /* we are using the cpu counter for timer interrupts */
244 irq->handler = mips_timer_interrupt; /* we use our own handler */ 301 irq->handler = mips_timer_interrupt; /* we use our own handler */
245#ifdef CONFIG_MIPS_MT_SMTC 302#ifdef CONFIG_MIPS_MT_SMTC
246 setup_irq_smtc(mips_cpu_timer_irq, irq, CPUCTR_IMASKBIT); 303 setup_irq_smtc(mips_cpu_timer_irq, irq, 0x100 << cp0_compare_irq);
247#else 304#else
248 setup_irq(mips_cpu_timer_irq, irq); 305 setup_irq(mips_cpu_timer_irq, irq);
249#endif /* CONFIG_MIPS_MT_SMTC */ 306#endif /* CONFIG_MIPS_MT_SMTC */
250
251#ifdef CONFIG_SMP 307#ifdef CONFIG_SMP
252 /* irq_desc(riptor) is a global resource, when the interrupt overlaps
253 on seperate cpu's the first one tries to handle the second interrupt.
254 The effect is that the int remains disabled on the second cpu.
255 Mark the interrupt with IRQ_PER_CPU to avoid any confusion */
256 irq_desc[mips_cpu_timer_irq].status |= IRQ_PER_CPU;
257 set_irq_handler(mips_cpu_timer_irq, handle_percpu_irq); 308 set_irq_handler(mips_cpu_timer_irq, handle_percpu_irq);
258#endif 309#endif
310
311 plat_perf_setup(&perf_irqaction);
259} 312}
diff --git a/arch/mips/mips-boards/malta/malta_int.c b/arch/mips/mips-boards/malta/malta_int.c
index 1cd830e3d933..c78d48349600 100644
--- a/arch/mips/mips-boards/malta/malta_int.c
+++ b/arch/mips/mips-boards/malta/malta_int.c
@@ -53,25 +53,19 @@ static inline int mips_pcibios_iack(void)
53 * Determine highest priority pending interrupt by performing 53 * Determine highest priority pending interrupt by performing
54 * a PCI Interrupt Acknowledge cycle. 54 * a PCI Interrupt Acknowledge cycle.
55 */ 55 */
56 switch(mips_revision_corid) { 56 switch (mips_revision_sconid) {
57 case MIPS_REVISION_CORID_CORE_MSC: 57 case MIPS_REVISION_SCON_SOCIT:
58 case MIPS_REVISION_CORID_CORE_FPGA2: 58 case MIPS_REVISION_SCON_ROCIT:
59 case MIPS_REVISION_CORID_CORE_FPGA3: 59 case MIPS_REVISION_SCON_SOCITSC:
60 case MIPS_REVISION_CORID_CORE_24K: 60 case MIPS_REVISION_SCON_SOCITSCP:
61 case MIPS_REVISION_CORID_CORE_EMUL_MSC:
62 MSC_READ(MSC01_PCI_IACK, irq); 61 MSC_READ(MSC01_PCI_IACK, irq);
63 irq &= 0xff; 62 irq &= 0xff;
64 break; 63 break;
65 case MIPS_REVISION_CORID_QED_RM5261: 64 case MIPS_REVISION_SCON_GT64120:
66 case MIPS_REVISION_CORID_CORE_LV:
67 case MIPS_REVISION_CORID_CORE_FPGA:
68 case MIPS_REVISION_CORID_CORE_FPGAR2:
69 irq = GT_READ(GT_PCI0_IACK_OFS); 65 irq = GT_READ(GT_PCI0_IACK_OFS);
70 irq &= 0xff; 66 irq &= 0xff;
71 break; 67 break;
72 case MIPS_REVISION_CORID_BONITO64: 68 case MIPS_REVISION_SCON_BONITO:
73 case MIPS_REVISION_CORID_CORE_20K:
74 case MIPS_REVISION_CORID_CORE_EMUL_BON:
75 /* The following will generate a PCI IACK cycle on the 69 /* The following will generate a PCI IACK cycle on the
76 * Bonito controller. It's a little bit kludgy, but it 70 * Bonito controller. It's a little bit kludgy, but it
77 * was the easiest way to implement it in hardware at 71 * was the easiest way to implement it in hardware at
@@ -89,7 +83,7 @@ static inline int mips_pcibios_iack(void)
89 BONITO_PCIMAP_CFG = 0; 83 BONITO_PCIMAP_CFG = 0;
90 break; 84 break;
91 default: 85 default:
92 printk("Unknown Core card, don't know the system controller.\n"); 86 printk("Unknown system controller.\n");
93 return -1; 87 return -1;
94 } 88 }
95 return irq; 89 return irq;
@@ -144,27 +138,21 @@ static void corehi_irqdispatch(void)
144 Do it for the others too. 138 Do it for the others too.
145 */ 139 */
146 140
147 switch(mips_revision_corid) { 141 switch (mips_revision_sconid) {
148 case MIPS_REVISION_CORID_CORE_MSC: 142 case MIPS_REVISION_SCON_SOCIT:
149 case MIPS_REVISION_CORID_CORE_FPGA2: 143 case MIPS_REVISION_SCON_ROCIT:
150 case MIPS_REVISION_CORID_CORE_FPGA3: 144 case MIPS_REVISION_SCON_SOCITSC:
151 case MIPS_REVISION_CORID_CORE_24K: 145 case MIPS_REVISION_SCON_SOCITSCP:
152 case MIPS_REVISION_CORID_CORE_EMUL_MSC:
153 ll_msc_irq(); 146 ll_msc_irq();
154 break; 147 break;
155 case MIPS_REVISION_CORID_QED_RM5261: 148 case MIPS_REVISION_SCON_GT64120:
156 case MIPS_REVISION_CORID_CORE_LV:
157 case MIPS_REVISION_CORID_CORE_FPGA:
158 case MIPS_REVISION_CORID_CORE_FPGAR2:
159 intrcause = GT_READ(GT_INTRCAUSE_OFS); 149 intrcause = GT_READ(GT_INTRCAUSE_OFS);
160 datalo = GT_READ(GT_CPUERR_ADDRLO_OFS); 150 datalo = GT_READ(GT_CPUERR_ADDRLO_OFS);
161 datahi = GT_READ(GT_CPUERR_ADDRHI_OFS); 151 datahi = GT_READ(GT_CPUERR_ADDRHI_OFS);
162 printk("GT_INTRCAUSE = %08x\n", intrcause); 152 printk("GT_INTRCAUSE = %08x\n", intrcause);
163 printk("GT_CPUERR_ADDR = %02x%08x\n", datahi, datalo); 153 printk("GT_CPUERR_ADDR = %02x%08x\n", datahi, datalo);
164 break; 154 break;
165 case MIPS_REVISION_CORID_BONITO64: 155 case MIPS_REVISION_SCON_BONITO:
166 case MIPS_REVISION_CORID_CORE_20K:
167 case MIPS_REVISION_CORID_CORE_EMUL_BON:
168 pcibadaddr = BONITO_PCIBADADDR; 156 pcibadaddr = BONITO_PCIBADADDR;
169 pcimstat = BONITO_PCIMSTAT; 157 pcimstat = BONITO_PCIMSTAT;
170 intisr = BONITO_INTISR; 158 intisr = BONITO_INTISR;
@@ -269,7 +257,7 @@ asmlinkage void plat_irq_dispatch(void)
269 if (irq == MIPSCPU_INT_I8259A) 257 if (irq == MIPSCPU_INT_I8259A)
270 malta_hw0_irqdispatch(); 258 malta_hw0_irqdispatch();
271 else if (irq > 0) 259 else if (irq > 0)
272 do_IRQ(MIPSCPU_INT_BASE + irq); 260 do_IRQ(MIPS_CPU_IRQ_BASE + irq);
273 else 261 else
274 spurious_interrupt(); 262 spurious_interrupt();
275} 263}
@@ -338,17 +326,17 @@ void __init arch_init_irq(void)
338 set_vi_handler (MIPSCPU_INT_I8259A, malta_hw0_irqdispatch); 326 set_vi_handler (MIPSCPU_INT_I8259A, malta_hw0_irqdispatch);
339 set_vi_handler (MIPSCPU_INT_COREHI, corehi_irqdispatch); 327 set_vi_handler (MIPSCPU_INT_COREHI, corehi_irqdispatch);
340#ifdef CONFIG_MIPS_MT_SMTC 328#ifdef CONFIG_MIPS_MT_SMTC
341 setup_irq_smtc (MIPSCPU_INT_BASE+MIPSCPU_INT_I8259A, &i8259irq, 329 setup_irq_smtc (MIPS_CPU_IRQ_BASE+MIPSCPU_INT_I8259A, &i8259irq,
342 (0x100 << MIPSCPU_INT_I8259A)); 330 (0x100 << MIPSCPU_INT_I8259A));
343 setup_irq_smtc (MIPSCPU_INT_BASE+MIPSCPU_INT_COREHI, 331 setup_irq_smtc (MIPS_CPU_IRQ_BASE+MIPSCPU_INT_COREHI,
344 &corehi_irqaction, (0x100 << MIPSCPU_INT_COREHI)); 332 &corehi_irqaction, (0x100 << MIPSCPU_INT_COREHI));
345#else /* Not SMTC */ 333#else /* Not SMTC */
346 setup_irq (MIPSCPU_INT_BASE+MIPSCPU_INT_I8259A, &i8259irq); 334 setup_irq (MIPS_CPU_IRQ_BASE+MIPSCPU_INT_I8259A, &i8259irq);
347 setup_irq (MIPSCPU_INT_BASE+MIPSCPU_INT_COREHI, &corehi_irqaction); 335 setup_irq (MIPS_CPU_IRQ_BASE+MIPSCPU_INT_COREHI, &corehi_irqaction);
348#endif /* CONFIG_MIPS_MT_SMTC */ 336#endif /* CONFIG_MIPS_MT_SMTC */
349 } 337 }
350 else { 338 else {
351 setup_irq (MIPSCPU_INT_BASE+MIPSCPU_INT_I8259A, &i8259irq); 339 setup_irq (MIPS_CPU_IRQ_BASE+MIPSCPU_INT_I8259A, &i8259irq);
352 setup_irq (MIPSCPU_INT_BASE+MIPSCPU_INT_COREHI, &corehi_irqaction); 340 setup_irq (MIPS_CPU_IRQ_BASE+MIPSCPU_INT_COREHI, &corehi_irqaction);
353 } 341 }
354} 342}
diff --git a/arch/mips/mips-boards/malta/malta_setup.c b/arch/mips/mips-boards/malta/malta_setup.c
index c14b7bf89950..8f1b78dfd89f 100644
--- a/arch/mips/mips-boards/malta/malta_setup.c
+++ b/arch/mips/mips-boards/malta/malta_setup.c
@@ -103,9 +103,7 @@ void __init plat_mem_setup(void)
103 kgdb_config (); 103 kgdb_config ();
104#endif 104#endif
105 105
106 if ((mips_revision_corid == MIPS_REVISION_CORID_BONITO64) || 106 if (mips_revision_sconid == MIPS_REVISION_SCON_BONITO) {
107 (mips_revision_corid == MIPS_REVISION_CORID_CORE_20K) ||
108 (mips_revision_corid == MIPS_REVISION_CORID_CORE_EMUL_BON)) {
109 char *argptr; 107 char *argptr;
110 108
111 argptr = prom_getcmdline(); 109 argptr = prom_getcmdline();
diff --git a/arch/mips/mips-boards/sead/sead_int.c b/arch/mips/mips-boards/sead/sead_int.c
index c4b9de3a7f27..9ca0f82f1360 100644
--- a/arch/mips/mips-boards/sead/sead_int.c
+++ b/arch/mips/mips-boards/sead/sead_int.c
@@ -106,7 +106,7 @@ asmlinkage void plat_irq_dispatch(void)
106 irq = irq_ffs(pending); 106 irq = irq_ffs(pending);
107 107
108 if (irq >= 0) 108 if (irq >= 0)
109 do_IRQ(MIPSCPU_INT_BASE + irq); 109 do_IRQ(MIPS_CPU_IRQ_BASE + irq);
110 else 110 else
111 spurious_interrupt(); 111 spurious_interrupt();
112} 112}
diff --git a/arch/mips/mips-boards/sead/sead_setup.c b/arch/mips/mips-boards/sead/sead_setup.c
index 811aba100605..bb801409d39b 100644
--- a/arch/mips/mips-boards/sead/sead_setup.c
+++ b/arch/mips/mips-boards/sead/sead_setup.c
@@ -68,7 +68,7 @@ static void __init serial_init(void)
68#else 68#else
69 s.iobase = SEAD_UART0_REGS_BASE+3; 69 s.iobase = SEAD_UART0_REGS_BASE+3;
70#endif 70#endif
71 s.irq = MIPSCPU_INT_BASE + MIPSCPU_INT_UART0; 71 s.irq = MIPS_CPU_IRQ_BASE + MIPSCPU_INT_UART0;
72 s.uartclk = SEAD_BASE_BAUD * 16; 72 s.uartclk = SEAD_BASE_BAUD * 16;
73 s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ; 73 s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ;
74 s.iotype = UPIO_PORT; 74 s.iotype = UPIO_PORT;
diff --git a/arch/mips/mips-boards/sim/sim_int.c b/arch/mips/mips-boards/sim/sim_int.c
index 15ac0655c1ff..766e0159ee5b 100644
--- a/arch/mips/mips-boards/sim/sim_int.c
+++ b/arch/mips/mips-boards/sim/sim_int.c
@@ -77,7 +77,7 @@ asmlinkage void plat_irq_dispatch(void)
77 irq = irq_ffs(pending); 77 irq = irq_ffs(pending);
78 78
79 if (irq > 0) 79 if (irq > 0)
80 do_IRQ(MIPSCPU_INT_BASE + irq); 80 do_IRQ(MIPS_CPU_IRQ_BASE + irq);
81 else 81 else
82 spurious_interrupt(); 82 spurious_interrupt();
83} 83}
diff --git a/arch/mips/mips-boards/sim/sim_time.c b/arch/mips/mips-boards/sim/sim_time.c
index d3a21c741514..7224ffe31d36 100644
--- a/arch/mips/mips-boards/sim/sim_time.c
+++ b/arch/mips/mips-boards/sim/sim_time.c
@@ -71,8 +71,8 @@ irqreturn_t sim_timer_interrupt(int irq, void *dev_id)
71 71
72 int vpflags = dvpe(); 72 int vpflags = dvpe();
73 write_c0_compare (read_c0_count() - 1); 73 write_c0_compare (read_c0_count() - 1);
74 clear_c0_cause(0x100 << MIPSCPU_INT_CPUCTR); 74 clear_c0_cause(0x100 << cp0_compare_irq);
75 set_c0_status(0x100 << MIPSCPU_INT_CPUCTR); 75 set_c0_status(0x100 << cp0_compare_irq);
76 irq_enable_hazard(); 76 irq_enable_hazard();
77 evpe(vpflags); 77 evpe(vpflags);
78 78
@@ -183,8 +183,8 @@ void __init plat_timer_setup(struct irqaction *irq)
183 } 183 }
184 else { 184 else {
185 if (cpu_has_vint) 185 if (cpu_has_vint)
186 set_vi_handler(MIPSCPU_INT_CPUCTR, mips_timer_dispatch); 186 set_vi_handler(cp0_compare_irq, mips_timer_dispatch);
187 mips_cpu_timer_irq = MIPSCPU_INT_BASE + MIPSCPU_INT_CPUCTR; 187 mips_cpu_timer_irq = MIPS_CPU_IRQ_BASE + cp0_compare_irq;
188 } 188 }
189 189
190 /* we are using the cpu counter for timer interrupts */ 190 /* we are using the cpu counter for timer interrupts */
diff --git a/arch/mips/oprofile/op_model_mipsxx.c b/arch/mips/oprofile/op_model_mipsxx.c
index 4f94fa261aae..1ea5c9c1010b 100644
--- a/arch/mips/oprofile/op_model_mipsxx.c
+++ b/arch/mips/oprofile/op_model_mipsxx.c
@@ -177,7 +177,10 @@ static int mipsxx_perfcount_handler(void)
177 unsigned int counters = op_model_mipsxx_ops.num_counters; 177 unsigned int counters = op_model_mipsxx_ops.num_counters;
178 unsigned int control; 178 unsigned int control;
179 unsigned int counter; 179 unsigned int counter;
180 int handled = 0; 180 int handled = IRQ_NONE;
181
182 if (cpu_has_mips_r2 && !(read_c0_cause() & (1 << 26)))
183 return handled;
181 184
182 switch (counters) { 185 switch (counters) {
183#define HANDLE_COUNTER(n) \ 186#define HANDLE_COUNTER(n) \
@@ -188,7 +191,7 @@ static int mipsxx_perfcount_handler(void)
188 (counter & M_COUNTER_OVERFLOW)) { \ 191 (counter & M_COUNTER_OVERFLOW)) { \
189 oprofile_add_sample(get_irq_regs(), n); \ 192 oprofile_add_sample(get_irq_regs(), n); \
190 w_c0_perfcntr ## n(reg.counter[n]); \ 193 w_c0_perfcntr ## n(reg.counter[n]); \
191 handled = 1; \ 194 handled = IRQ_HANDLED; \
192 } 195 }
193 HANDLE_COUNTER(3) 196 HANDLE_COUNTER(3)
194 HANDLE_COUNTER(2) 197 HANDLE_COUNTER(2)
diff --git a/arch/parisc/hpux/fs.c b/arch/parisc/hpux/fs.c
index d86e15776779..f2042e6466a4 100644
--- a/arch/parisc/hpux/fs.c
+++ b/arch/parisc/hpux/fs.c
@@ -21,6 +21,7 @@
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */ 22 */
23 23
24#include <linux/kernel.h>
24#include <linux/mm.h> 25#include <linux/mm.h>
25#include <linux/sched.h> 26#include <linux/sched.h>
26#include <linux/file.h> 27#include <linux/file.h>
@@ -69,7 +70,6 @@ struct getdents_callback {
69}; 70};
70 71
71#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de))) 72#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
72#define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1))
73 73
74static int filldir(void * __buf, const char * name, int namlen, loff_t offset, 74static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
75 u64 ino, unsigned d_type) 75 u64 ino, unsigned d_type)
@@ -77,7 +77,7 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
77 struct hpux_dirent __user * dirent; 77 struct hpux_dirent __user * dirent;
78 struct getdents_callback * buf = (struct getdents_callback *) __buf; 78 struct getdents_callback * buf = (struct getdents_callback *) __buf;
79 ino_t d_ino; 79 ino_t d_ino;
80 int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1); 80 int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 1, sizeof(long));
81 81
82 buf->error = -EINVAL; /* only used if we fail.. */ 82 buf->error = -EINVAL; /* only used if we fail.. */
83 if (reclen > buf->count) 83 if (reclen > buf->count)
@@ -102,7 +102,6 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
102} 102}
103 103
104#undef NAME_OFFSET 104#undef NAME_OFFSET
105#undef ROUND_UP
106 105
107int hpux_getdents(unsigned int fd, struct hpux_dirent __user *dirent, unsigned int count) 106int hpux_getdents(unsigned int fd, struct hpux_dirent __user *dirent, unsigned int count)
108{ 107{
diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S
index 8474f9e5ca10..42598abf4576 100644
--- a/arch/parisc/kernel/entry.S
+++ b/arch/parisc/kernel/entry.S
@@ -954,21 +954,6 @@ intr_return:
954 /* NOTE: Need to enable interrupts incase we schedule. */ 954 /* NOTE: Need to enable interrupts incase we schedule. */
955 ssm PSW_SM_I, %r0 955 ssm PSW_SM_I, %r0
956 956
957 /* Check for software interrupts */
958
959 .import irq_stat,data
960
961 load32 irq_stat,%r19
962#ifdef CONFIG_SMP
963 mfctl %cr30,%r1
964 ldw TI_CPU(%r1),%r1 /* get cpu # - int */
965 /* shift left ____cacheline_aligned (aka L1_CACHE_BYTES) amount
966 ** irq_stat[] is defined using ____cacheline_aligned.
967 */
968 SHLREG %r1,L1_CACHE_SHIFT,%r20
969 add %r19,%r20,%r19 /* now have &irq_stat[smp_processor_id()] */
970#endif /* CONFIG_SMP */
971
972intr_check_resched: 957intr_check_resched:
973 958
974 /* check for reschedule */ 959 /* check for reschedule */
@@ -2034,10 +2019,9 @@ ENTRY(syscall_exit)
2034 STREG %r28,TASK_PT_GR28(%r1) 2019 STREG %r28,TASK_PT_GR28(%r1)
2035 2020
2036#ifdef CONFIG_HPUX 2021#ifdef CONFIG_HPUX
2037
2038/* <linux/personality.h> cannot be easily included */ 2022/* <linux/personality.h> cannot be easily included */
2039#define PER_HPUX 0x10 2023#define PER_HPUX 0x10
2040 LDREG TASK_PERSONALITY(%r1),%r19 2024 ldw TASK_PERSONALITY(%r1),%r19
2041 2025
2042 /* We can't use "CMPIB<> PER_HPUX" since "im5" field is sign extended */ 2026 /* We can't use "CMPIB<> PER_HPUX" since "im5" field is sign extended */
2043 ldo -PER_HPUX(%r19), %r19 2027 ldo -PER_HPUX(%r19), %r19
@@ -2055,24 +2039,6 @@ ENTRY(syscall_exit)
2055 */ 2039 */
2056 loadgp 2040 loadgp
2057 2041
2058syscall_check_bh:
2059
2060 /* Check for software interrupts */
2061
2062 .import irq_stat,data
2063
2064 load32 irq_stat,%r19
2065
2066#ifdef CONFIG_SMP
2067 /* sched.h: int processor */
2068 /* %r26 is used as scratch register to index into irq_stat[] */
2069 ldw TI_CPU-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r26 /* cpu # */
2070
2071 /* shift left ____cacheline_aligned (aka L1_CACHE_BYTES) bits */
2072 SHLREG %r26,L1_CACHE_SHIFT,%r20
2073 add %r19,%r20,%r19 /* now have &irq_stat[smp_processor_id()] */
2074#endif /* CONFIG_SMP */
2075
2076syscall_check_resched: 2042syscall_check_resched:
2077 2043
2078 /* check for reschedule */ 2044 /* check for reschedule */
@@ -2114,7 +2080,7 @@ syscall_restore:
2114 /* Are we being ptraced? */ 2080 /* Are we being ptraced? */
2115 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 2081 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1
2116 2082
2117 LDREG TASK_PTRACE(%r1), %r19 2083 ldw TASK_PTRACE(%r1), %r19
2118 bb,< %r19,31,syscall_restore_rfi 2084 bb,< %r19,31,syscall_restore_rfi
2119 nop 2085 nop
2120 2086
@@ -2244,7 +2210,7 @@ syscall_do_resched:
2244#else 2210#else
2245 nop 2211 nop
2246#endif 2212#endif
2247 b syscall_check_bh /* if resched, we start over again */ 2213 b syscall_check_resched /* if resched, we start over again */
2248 nop 2214 nop
2249ENDPROC(syscall_exit) 2215ENDPROC(syscall_exit)
2250 2216
diff --git a/arch/parisc/kernel/firmware.c b/arch/parisc/kernel/firmware.c
index 39dc835bf89e..fd6552c4c08c 100644
--- a/arch/parisc/kernel/firmware.c
+++ b/arch/parisc/kernel/firmware.c
@@ -634,7 +634,7 @@ EXPORT_SYMBOL(pdc_lan_station_id);
634 * pdc_stable_read - Read data from Stable Storage. 634 * pdc_stable_read - Read data from Stable Storage.
635 * @staddr: Stable Storage address to access. 635 * @staddr: Stable Storage address to access.
636 * @memaddr: The memory address where Stable Storage data shall be copied. 636 * @memaddr: The memory address where Stable Storage data shall be copied.
637 * @count: number of bytes to transfert. count is multiple of 4. 637 * @count: number of bytes to transfer. count is multiple of 4.
638 * 638 *
639 * This PDC call reads from the Stable Storage address supplied in staddr 639 * This PDC call reads from the Stable Storage address supplied in staddr
640 * and copies count bytes to the memory address memaddr. 640 * and copies count bytes to the memory address memaddr.
@@ -660,7 +660,7 @@ EXPORT_SYMBOL(pdc_stable_read);
660 * pdc_stable_write - Write data to Stable Storage. 660 * pdc_stable_write - Write data to Stable Storage.
661 * @staddr: Stable Storage address to access. 661 * @staddr: Stable Storage address to access.
662 * @memaddr: The memory address where Stable Storage data shall be read from. 662 * @memaddr: The memory address where Stable Storage data shall be read from.
663 * @count: number of bytes to transfert. count is multiple of 4. 663 * @count: number of bytes to transfer. count is multiple of 4.
664 * 664 *
665 * This PDC call reads count bytes from the supplied memaddr address, 665 * This PDC call reads count bytes from the supplied memaddr address,
666 * and copies count bytes to the Stable Storage address staddr. 666 * and copies count bytes to the Stable Storage address staddr.
diff --git a/arch/parisc/kernel/hardware.c b/arch/parisc/kernel/hardware.c
index 18ba4cb9159b..04848b2b381c 100644
--- a/arch/parisc/kernel/hardware.c
+++ b/arch/parisc/kernel/hardware.c
@@ -38,7 +38,7 @@
38 * so don't reference this table after starting the init process 38 * so don't reference this table after starting the init process
39 */ 39 */
40 40
41static struct hp_hardware hp_hardware_list[] __initdata = { 41static struct hp_hardware hp_hardware_list[] __devinitdata = {
42 {HPHW_NPROC,0x01,0x4,0x0,"Indigo (840, 930)"}, 42 {HPHW_NPROC,0x01,0x4,0x0,"Indigo (840, 930)"},
43 {HPHW_NPROC,0x8,0x4,0x01,"Firefox(825,925)"}, 43 {HPHW_NPROC,0x8,0x4,0x01,"Firefox(825,925)"},
44 {HPHW_NPROC,0xA,0x4,0x01,"Top Gun (835,834,935,635)"}, 44 {HPHW_NPROC,0xA,0x4,0x01,"Top Gun (835,834,935,635)"},
@@ -1219,7 +1219,7 @@ static struct hp_cpu_type_mask {
1219 unsigned short model; 1219 unsigned short model;
1220 unsigned short mask; 1220 unsigned short mask;
1221 enum cpu_type cpu; 1221 enum cpu_type cpu;
1222} hp_cpu_type_mask_list[] __initdata = { 1222} hp_cpu_type_mask_list[] __devinitdata = {
1223 1223
1224 { 0x0000, 0x0ff0, pcx }, /* 0x0000 - 0x000f */ 1224 { 0x0000, 0x0ff0, pcx }, /* 0x0000 - 0x000f */
1225 { 0x0048, 0x0ff0, pcxl }, /* 0x0040 - 0x004f */ 1225 { 0x0048, 0x0ff0, pcxl }, /* 0x0040 - 0x004f */
@@ -1296,10 +1296,11 @@ static struct hp_cpu_type_mask {
1296 { 0x05f0, 0x0ff0, pcxw2 }, /* 0x05f0 - 0x05ff */ 1296 { 0x05f0, 0x0ff0, pcxw2 }, /* 0x05f0 - 0x05ff */
1297 { 0x0600, 0x0fe0, pcxl }, /* 0x0600 - 0x061f */ 1297 { 0x0600, 0x0fe0, pcxl }, /* 0x0600 - 0x061f */
1298 { 0x0880, 0x0ff0, mako }, /* 0x0880 - 0x088f */ 1298 { 0x0880, 0x0ff0, mako }, /* 0x0880 - 0x088f */
1299 { 0x0890, 0x0ff0, mako2 }, /* 0x0890 - 0x089f */
1299 { 0x0000, 0x0000, pcx } /* terminate table */ 1300 { 0x0000, 0x0000, pcx } /* terminate table */
1300}; 1301};
1301 1302
1302char *cpu_name_version[][2] = { 1303const char * const cpu_name_version[][2] = {
1303 [pcx] = { "PA7000 (PCX)", "1.0" }, 1304 [pcx] = { "PA7000 (PCX)", "1.0" },
1304 [pcxs] = { "PA7000 (PCX-S)", "1.1a" }, 1305 [pcxs] = { "PA7000 (PCX-S)", "1.1a" },
1305 [pcxt] = { "PA7100 (PCX-T)", "1.1b" }, 1306 [pcxt] = { "PA7100 (PCX-T)", "1.1b" },
@@ -1311,10 +1312,11 @@ char *cpu_name_version[][2] = {
1311 [pcxw] = { "PA8500 (PCX-W)", "2.0" }, 1312 [pcxw] = { "PA8500 (PCX-W)", "2.0" },
1312 [pcxw_] = { "PA8600 (PCX-W+)", "2.0" }, 1313 [pcxw_] = { "PA8600 (PCX-W+)", "2.0" },
1313 [pcxw2] = { "PA8700 (PCX-W2)", "2.0" }, 1314 [pcxw2] = { "PA8700 (PCX-W2)", "2.0" },
1314 [mako] = { "PA8800 (Mako)", "2.0" } 1315 [mako] = { "PA8800 (Mako)", "2.0" },
1316 [mako2] = { "PA8900 (Shortfin)", "2.0" }
1315}; 1317};
1316 1318
1317const char * __init 1319const char * __devinit
1318parisc_hardware_description(struct parisc_device_id *id) 1320parisc_hardware_description(struct parisc_device_id *id)
1319{ 1321{
1320 struct hp_hardware *listptr; 1322 struct hp_hardware *listptr;
@@ -1353,7 +1355,7 @@ parisc_hardware_description(struct parisc_device_id *id)
1353 1355
1354 1356
1355/* Interpret hversion (ret[0]) from PDC_MODEL(4)/PDC_MODEL_INFO(0) */ 1357/* Interpret hversion (ret[0]) from PDC_MODEL(4)/PDC_MODEL_INFO(0) */
1356enum cpu_type __init 1358enum cpu_type __cpuinit
1357parisc_get_cpu_type(unsigned long hversion) 1359parisc_get_cpu_type(unsigned long hversion)
1358{ 1360{
1359 struct hp_cpu_type_mask *ptr; 1361 struct hp_cpu_type_mask *ptr;
diff --git a/arch/parisc/kernel/hpmc.S b/arch/parisc/kernel/hpmc.S
index d8baa158d8a0..43b41df0b541 100644
--- a/arch/parisc/kernel/hpmc.S
+++ b/arch/parisc/kernel/hpmc.S
@@ -295,8 +295,5 @@ os_hpmc_6:
295 b . 295 b .
296 nop 296 nop
297ENDPROC(os_hpmc) 297ENDPROC(os_hpmc)
298 298ENTRY(os_hpmc_end) /* this label used to compute os_hpmc checksum */
299 /* this label used to compute os_hpmc checksum */
300ENTRY(os_hpmc_end)
301
302 nop 299 nop
diff --git a/arch/parisc/kernel/irq.c b/arch/parisc/kernel/irq.c
index c5c9125dacec..76ce5e3b0050 100644
--- a/arch/parisc/kernel/irq.c
+++ b/arch/parisc/kernel/irq.c
@@ -46,14 +46,10 @@ extern irqreturn_t ipi_interrupt(int, void *);
46static volatile unsigned long cpu_eiem = 0; 46static volatile unsigned long cpu_eiem = 0;
47 47
48/* 48/*
49** ack bitmap ... habitually set to 1, but reset to zero 49** local ACK bitmap ... habitually set to 1, but reset to zero
50** between ->ack() and ->end() of the interrupt to prevent 50** between ->ack() and ->end() of the interrupt to prevent
51** re-interruption of a processing interrupt. 51** re-interruption of a processing interrupt.
52*/ 52*/
53static volatile unsigned long global_ack_eiem = ~0UL;
54/*
55** Local bitmap, same as above but for per-cpu interrupts
56*/
57static DEFINE_PER_CPU(unsigned long, local_ack_eiem) = ~0UL; 53static DEFINE_PER_CPU(unsigned long, local_ack_eiem) = ~0UL;
58 54
59static void cpu_disable_irq(unsigned int irq) 55static void cpu_disable_irq(unsigned int irq)
@@ -94,13 +90,11 @@ void cpu_ack_irq(unsigned int irq)
94 int cpu = smp_processor_id(); 90 int cpu = smp_processor_id();
95 91
96 /* Clear in EIEM so we can no longer process */ 92 /* Clear in EIEM so we can no longer process */
97 if (CHECK_IRQ_PER_CPU(irq_desc[irq].status)) 93 per_cpu(local_ack_eiem, cpu) &= ~mask;
98 per_cpu(local_ack_eiem, cpu) &= ~mask;
99 else
100 global_ack_eiem &= ~mask;
101 94
102 /* disable the interrupt */ 95 /* disable the interrupt */
103 set_eiem(cpu_eiem & global_ack_eiem & per_cpu(local_ack_eiem, cpu)); 96 set_eiem(cpu_eiem & per_cpu(local_ack_eiem, cpu));
97
104 /* and now ack it */ 98 /* and now ack it */
105 mtctl(mask, 23); 99 mtctl(mask, 23);
106} 100}
@@ -111,13 +105,10 @@ void cpu_end_irq(unsigned int irq)
111 int cpu = smp_processor_id(); 105 int cpu = smp_processor_id();
112 106
113 /* set it in the eiems---it's no longer in process */ 107 /* set it in the eiems---it's no longer in process */
114 if (CHECK_IRQ_PER_CPU(irq_desc[irq].status)) 108 per_cpu(local_ack_eiem, cpu) |= mask;
115 per_cpu(local_ack_eiem, cpu) |= mask;
116 else
117 global_ack_eiem |= mask;
118 109
119 /* enable the interrupt */ 110 /* enable the interrupt */
120 set_eiem(cpu_eiem & global_ack_eiem & per_cpu(local_ack_eiem, cpu)); 111 set_eiem(cpu_eiem & per_cpu(local_ack_eiem, cpu));
121} 112}
122 113
123#ifdef CONFIG_SMP 114#ifdef CONFIG_SMP
@@ -354,8 +345,7 @@ void do_cpu_irq_mask(struct pt_regs *regs)
354 local_irq_disable(); 345 local_irq_disable();
355 irq_enter(); 346 irq_enter();
356 347
357 eirr_val = mfctl(23) & cpu_eiem & global_ack_eiem & 348 eirr_val = mfctl(23) & cpu_eiem & per_cpu(local_ack_eiem, cpu);
358 per_cpu(local_ack_eiem, cpu);
359 if (!eirr_val) 349 if (!eirr_val)
360 goto set_out; 350 goto set_out;
361 irq = eirr_to_irq(eirr_val); 351 irq = eirr_to_irq(eirr_val);
@@ -381,7 +371,7 @@ void do_cpu_irq_mask(struct pt_regs *regs)
381 return; 371 return;
382 372
383 set_out: 373 set_out:
384 set_eiem(cpu_eiem & global_ack_eiem & per_cpu(local_ack_eiem, cpu)); 374 set_eiem(cpu_eiem & per_cpu(local_ack_eiem, cpu));
385 goto out; 375 goto out;
386} 376}
387 377
diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
index 0c3aecb85a5c..23c1388df1f5 100644
--- a/arch/parisc/kernel/pci-dma.c
+++ b/arch/parisc/kernel/pci-dma.c
@@ -21,6 +21,7 @@
21#include <linux/mm.h> 21#include <linux/mm.h>
22#include <linux/pci.h> 22#include <linux/pci.h>
23#include <linux/proc_fs.h> 23#include <linux/proc_fs.h>
24#include <linux/seq_file.h>
24#include <linux/slab.h> 25#include <linux/slab.h>
25#include <linux/string.h> 26#include <linux/string.h>
26#include <linux/types.h> 27#include <linux/types.h>
@@ -34,7 +35,6 @@
34#include <asm/tlbflush.h> /* for purge_tlb_*() macros */ 35#include <asm/tlbflush.h> /* for purge_tlb_*() macros */
35 36
36static struct proc_dir_entry * proc_gsc_root __read_mostly = NULL; 37static struct proc_dir_entry * proc_gsc_root __read_mostly = NULL;
37static int pcxl_proc_info(char *buffer, char **start, off_t offset, int length);
38static unsigned long pcxl_used_bytes __read_mostly = 0; 38static unsigned long pcxl_used_bytes __read_mostly = 0;
39static unsigned long pcxl_used_pages __read_mostly = 0; 39static unsigned long pcxl_used_pages __read_mostly = 0;
40 40
@@ -330,6 +330,54 @@ pcxl_free_range(unsigned long vaddr, size_t size)
330 dump_resmap(); 330 dump_resmap();
331} 331}
332 332
333static int proc_pcxl_dma_show(struct seq_file *m, void *v)
334{
335#if 0
336 u_long i = 0;
337 unsigned long *res_ptr = (u_long *)pcxl_res_map;
338#endif
339 unsigned long total_pages = pcxl_res_size << 3; /* 8 bits per byte */
340
341 seq_printf(m, "\nDMA Mapping Area size : %d bytes (%ld pages)\n",
342 PCXL_DMA_MAP_SIZE, total_pages);
343
344 seq_printf(m, "Resource bitmap : %d bytes\n", pcxl_res_size);
345
346 seq_puts(m, " total: free: used: % used:\n");
347 seq_printf(m, "blocks %8d %8ld %8ld %8ld%%\n", pcxl_res_size,
348 pcxl_res_size - pcxl_used_bytes, pcxl_used_bytes,
349 (pcxl_used_bytes * 100) / pcxl_res_size);
350
351 seq_printf(m, "pages %8ld %8ld %8ld %8ld%%\n", total_pages,
352 total_pages - pcxl_used_pages, pcxl_used_pages,
353 (pcxl_used_pages * 100 / total_pages));
354
355#if 0
356 seq_puts(m, "\nResource bitmap:");
357
358 for(; i < (pcxl_res_size / sizeof(u_long)); ++i, ++res_ptr) {
359 if ((i & 7) == 0)
360 seq_puts(m,"\n ");
361 seq_printf(m, "%s %08lx", buf, *res_ptr);
362 }
363#endif
364 seq_putc(m, '\n');
365 return 0;
366}
367
368static int proc_pcxl_dma_open(struct inode *inode, struct file *file)
369{
370 return single_open(file, proc_pcxl_dma_show, NULL);
371}
372
373static const struct file_operations proc_pcxl_dma_ops = {
374 .owner = THIS_MODULE,
375 .open = proc_pcxl_dma_open,
376 .read = seq_read,
377 .llseek = seq_lseek,
378 .release = single_release,
379};
380
333static int __init 381static int __init
334pcxl_dma_init(void) 382pcxl_dma_init(void)
335{ 383{
@@ -348,9 +396,10 @@ pcxl_dma_init(void)
348 "pcxl_dma_init: Unable to create gsc /proc dir entry\n"); 396 "pcxl_dma_init: Unable to create gsc /proc dir entry\n");
349 else { 397 else {
350 struct proc_dir_entry* ent; 398 struct proc_dir_entry* ent;
351 ent = create_proc_info_entry("pcxl_dma", 0, 399 ent = create_proc_entry("pcxl_dma", 0, proc_gsc_root);
352 proc_gsc_root, pcxl_proc_info); 400 if (ent)
353 if (!ent) 401 ent->proc_fops = &proc_pcxl_dma_ops;
402 else
354 printk(KERN_WARNING 403 printk(KERN_WARNING
355 "pci-dma.c: Unable to create pcxl_dma /proc entry.\n"); 404 "pci-dma.c: Unable to create pcxl_dma /proc entry.\n");
356 } 405 }
@@ -551,40 +600,3 @@ struct hppa_dma_ops pcx_dma_ops = {
551 .dma_sync_sg_for_cpu = pa11_dma_sync_sg_for_cpu, 600 .dma_sync_sg_for_cpu = pa11_dma_sync_sg_for_cpu,
552 .dma_sync_sg_for_device = pa11_dma_sync_sg_for_device, 601 .dma_sync_sg_for_device = pa11_dma_sync_sg_for_device,
553}; 602};
554
555
556static int pcxl_proc_info(char *buf, char **start, off_t offset, int len)
557{
558#if 0
559 u_long i = 0;
560 unsigned long *res_ptr = (u_long *)pcxl_res_map;
561#endif
562 unsigned long total_pages = pcxl_res_size << 3; /* 8 bits per byte */
563
564 sprintf(buf, "\nDMA Mapping Area size : %d bytes (%ld pages)\n",
565 PCXL_DMA_MAP_SIZE, total_pages);
566
567 sprintf(buf, "%sResource bitmap : %d bytes\n", buf, pcxl_res_size);
568
569 strcat(buf, " total: free: used: % used:\n");
570 sprintf(buf, "%sblocks %8d %8ld %8ld %8ld%%\n", buf, pcxl_res_size,
571 pcxl_res_size - pcxl_used_bytes, pcxl_used_bytes,
572 (pcxl_used_bytes * 100) / pcxl_res_size);
573
574 sprintf(buf, "%spages %8ld %8ld %8ld %8ld%%\n", buf, total_pages,
575 total_pages - pcxl_used_pages, pcxl_used_pages,
576 (pcxl_used_pages * 100 / total_pages));
577
578#if 0
579 strcat(buf, "\nResource bitmap:");
580
581 for(; i < (pcxl_res_size / sizeof(u_long)); ++i, ++res_ptr) {
582 if ((i & 7) == 0)
583 strcat(buf,"\n ");
584 sprintf(buf, "%s %08lx", buf, *res_ptr);
585 }
586#endif
587 strcat(buf, "\n");
588 return strlen(buf);
589}
590
diff --git a/arch/parisc/kernel/perf.c b/arch/parisc/kernel/perf.c
index a46bc62b643e..89d6d5ad44b5 100644
--- a/arch/parisc/kernel/perf.c
+++ b/arch/parisc/kernel/perf.c
@@ -171,7 +171,7 @@ static const uint64_t perf_bitmasks[] = {
171 171
172/* 172/*
173 * Write control bitmasks for Pa-8700 processor given 173 * Write control bitmasks for Pa-8700 processor given
174 * somethings have changed slightly. 174 * some things have changed slightly.
175 */ 175 */
176static const uint64_t perf_bitmasks_piranha[] = { 176static const uint64_t perf_bitmasks_piranha[] = {
177 0x0000000000000000ul, /* first dbl word must be zero */ 177 0x0000000000000000ul, /* first dbl word must be zero */
@@ -511,10 +511,12 @@ static int __init perf_init(void)
511 } else if (boot_cpu_data.cpu_type == pcxw || 511 } else if (boot_cpu_data.cpu_type == pcxw ||
512 boot_cpu_data.cpu_type == pcxw_ || 512 boot_cpu_data.cpu_type == pcxw_ ||
513 boot_cpu_data.cpu_type == pcxw2 || 513 boot_cpu_data.cpu_type == pcxw2 ||
514 boot_cpu_data.cpu_type == mako) { 514 boot_cpu_data.cpu_type == mako ||
515 boot_cpu_data.cpu_type == mako2) {
515 perf_processor_interface = CUDA_INTF; 516 perf_processor_interface = CUDA_INTF;
516 if (boot_cpu_data.cpu_type == pcxw2 || 517 if (boot_cpu_data.cpu_type == pcxw2 ||
517 boot_cpu_data.cpu_type == mako) 518 boot_cpu_data.cpu_type == mako ||
519 boot_cpu_data.cpu_type == mako2)
518 bitmask_array = perf_bitmasks_piranha; 520 bitmask_array = perf_bitmasks_piranha;
519 } else { 521 } else {
520 perf_processor_interface = UNKNOWN_INTF; 522 perf_processor_interface = UNKNOWN_INTF;
@@ -574,27 +576,27 @@ static int perf_stop_counters(uint32_t *raddr)
574 if (!perf_rdr_read_ubuf(16, userbuf)) 576 if (!perf_rdr_read_ubuf(16, userbuf))
575 return -13; 577 return -13;
576 578
577 /* Counter0 is bits 1398 thru 1429 */ 579 /* Counter0 is bits 1398 to 1429 */
578 tmp64 = (userbuf[21] << 22) & 0x00000000ffc00000; 580 tmp64 = (userbuf[21] << 22) & 0x00000000ffc00000;
579 tmp64 |= (userbuf[22] >> 42) & 0x00000000003fffff; 581 tmp64 |= (userbuf[22] >> 42) & 0x00000000003fffff;
580 /* OR sticky0 (bit 1430) to counter0 bit 32 */ 582 /* OR sticky0 (bit 1430) to counter0 bit 32 */
581 tmp64 |= (userbuf[22] >> 10) & 0x0000000080000000; 583 tmp64 |= (userbuf[22] >> 10) & 0x0000000080000000;
582 raddr[0] = (uint32_t)tmp64; 584 raddr[0] = (uint32_t)tmp64;
583 585
584 /* Counter1 is bits 1431 thru 1462 */ 586 /* Counter1 is bits 1431 to 1462 */
585 tmp64 = (userbuf[22] >> 9) & 0x00000000ffffffff; 587 tmp64 = (userbuf[22] >> 9) & 0x00000000ffffffff;
586 /* OR sticky1 (bit 1463) to counter1 bit 32 */ 588 /* OR sticky1 (bit 1463) to counter1 bit 32 */
587 tmp64 |= (userbuf[22] << 23) & 0x0000000080000000; 589 tmp64 |= (userbuf[22] << 23) & 0x0000000080000000;
588 raddr[1] = (uint32_t)tmp64; 590 raddr[1] = (uint32_t)tmp64;
589 591
590 /* Counter2 is bits 1464 thru 1495 */ 592 /* Counter2 is bits 1464 to 1495 */
591 tmp64 = (userbuf[22] << 24) & 0x00000000ff000000; 593 tmp64 = (userbuf[22] << 24) & 0x00000000ff000000;
592 tmp64 |= (userbuf[23] >> 40) & 0x0000000000ffffff; 594 tmp64 |= (userbuf[23] >> 40) & 0x0000000000ffffff;
593 /* OR sticky2 (bit 1496) to counter2 bit 32 */ 595 /* OR sticky2 (bit 1496) to counter2 bit 32 */
594 tmp64 |= (userbuf[23] >> 8) & 0x0000000080000000; 596 tmp64 |= (userbuf[23] >> 8) & 0x0000000080000000;
595 raddr[2] = (uint32_t)tmp64; 597 raddr[2] = (uint32_t)tmp64;
596 598
597 /* Counter3 is bits 1497 thru 1528 */ 599 /* Counter3 is bits 1497 to 1528 */
598 tmp64 = (userbuf[23] >> 7) & 0x00000000ffffffff; 600 tmp64 = (userbuf[23] >> 7) & 0x00000000ffffffff;
599 /* OR sticky3 (bit 1529) to counter3 bit 32 */ 601 /* OR sticky3 (bit 1529) to counter3 bit 32 */
600 tmp64 |= (userbuf[23] << 25) & 0x0000000080000000; 602 tmp64 |= (userbuf[23] << 25) & 0x0000000080000000;
@@ -616,7 +618,7 @@ static int perf_stop_counters(uint32_t *raddr)
616 userbuf[23] = 0; 618 userbuf[23] = 0;
617 619
618 /* 620 /*
619 * Write back the zero'ed bytes + the image given 621 * Write back the zeroed bytes + the image given
620 * the read was destructive. 622 * the read was destructive.
621 */ 623 */
622 perf_rdr_write(16, userbuf); 624 perf_rdr_write(16, userbuf);
diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
index 0dd3847f494c..355664812b83 100644
--- a/arch/parisc/kernel/process.c
+++ b/arch/parisc/kernel/process.c
@@ -381,6 +381,10 @@ get_wchan(struct task_struct *p)
381 struct unwind_frame_info info; 381 struct unwind_frame_info info;
382 unsigned long ip; 382 unsigned long ip;
383 int count = 0; 383 int count = 0;
384
385 if (!p || p == current || p->state == TASK_RUNNING)
386 return 0;
387
384 /* 388 /*
385 * These bracket the sleeping functions.. 389 * These bracket the sleeping functions..
386 */ 390 */
diff --git a/arch/parisc/kernel/processor.c b/arch/parisc/kernel/processor.c
index 566226d78bc9..549f5484342c 100644
--- a/arch/parisc/kernel/processor.c
+++ b/arch/parisc/kernel/processor.c
@@ -63,7 +63,7 @@ extern int update_cr16_clocksource(void); /* from time.c */
63** will call register_parisc_driver(&cpu_driver) before calling do_inventory(). 63** will call register_parisc_driver(&cpu_driver) before calling do_inventory().
64** 64**
65** The goal of consolidating CPU initialization into one place is 65** The goal of consolidating CPU initialization into one place is
66** to make sure all CPU's get initialized the same way. 66** to make sure all CPUs get initialized the same way.
67** The code path not shared is how PDC hands control of the CPU to the OS. 67** The code path not shared is how PDC hands control of the CPU to the OS.
68** The initialization of OS data structures is the same (done below). 68** The initialization of OS data structures is the same (done below).
69*/ 69*/
@@ -76,7 +76,7 @@ extern int update_cr16_clocksource(void); /* from time.c */
76 * (return 1). If so, initialize the chip and tell other partners in crime 76 * (return 1). If so, initialize the chip and tell other partners in crime
77 * they have work to do. 77 * they have work to do.
78 */ 78 */
79static int __init processor_probe(struct parisc_device *dev) 79static int __cpuinit processor_probe(struct parisc_device *dev)
80{ 80{
81 unsigned long txn_addr; 81 unsigned long txn_addr;
82 unsigned long cpuid; 82 unsigned long cpuid;
@@ -166,7 +166,7 @@ static int __init processor_probe(struct parisc_device *dev)
166#endif 166#endif
167 167
168 /* 168 /*
169 ** CONFIG_SMP: init_smp_config() will attempt to get CPU's into 169 ** CONFIG_SMP: init_smp_config() will attempt to get CPUs into
170 ** OS control. RENDEZVOUS is the default state - see mem_set above. 170 ** OS control. RENDEZVOUS is the default state - see mem_set above.
171 ** p->state = STATE_RENDEZVOUS; 171 ** p->state = STATE_RENDEZVOUS;
172 */ 172 */
@@ -334,7 +334,7 @@ int __init init_per_cpu(int cpunum)
334} 334}
335 335
336/* 336/*
337 * Display cpu info for all cpu's. 337 * Display CPU info for all CPUs.
338 */ 338 */
339int 339int
340show_cpuinfo (struct seq_file *m, void *v) 340show_cpuinfo (struct seq_file *m, void *v)
@@ -381,19 +381,19 @@ show_cpuinfo (struct seq_file *m, void *v)
381 return 0; 381 return 0;
382} 382}
383 383
384static struct parisc_device_id processor_tbl[] __read_mostly = { 384static const struct parisc_device_id processor_tbl[] = {
385 { HPHW_NPROC, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, SVERSION_ANY_ID }, 385 { HPHW_NPROC, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, SVERSION_ANY_ID },
386 { 0, } 386 { 0, }
387}; 387};
388 388
389static struct parisc_driver cpu_driver __read_mostly = { 389static struct parisc_driver cpu_driver = {
390 .name = "CPU", 390 .name = "CPU",
391 .id_table = processor_tbl, 391 .id_table = processor_tbl,
392 .probe = processor_probe 392 .probe = processor_probe
393}; 393};
394 394
395/** 395/**
396 * processor_init - Processor initalization procedure. 396 * processor_init - Processor initialization procedure.
397 * 397 *
398 * Register this driver. 398 * Register this driver.
399 */ 399 */
diff --git a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c
index 9818919571fd..c44b8c51f5d1 100644
--- a/arch/parisc/kernel/setup.c
+++ b/arch/parisc/kernel/setup.c
@@ -45,7 +45,7 @@
45#include <asm/io.h> 45#include <asm/io.h>
46#include <asm/setup.h> 46#include <asm/setup.h>
47 47
48char __initdata command_line[COMMAND_LINE_SIZE]; 48static char __initdata command_line[COMMAND_LINE_SIZE];
49 49
50/* Intended for ccio/sba/cpu statistics under /proc/bus/{runway|gsc} */ 50/* Intended for ccio/sba/cpu statistics under /proc/bus/{runway|gsc} */
51struct proc_dir_entry * proc_runway_root __read_mostly = NULL; 51struct proc_dir_entry * proc_runway_root __read_mostly = NULL;
@@ -162,7 +162,7 @@ void __init setup_arch(char **cmdline_p)
162} 162}
163 163
164/* 164/*
165 * Display cpu info for all cpu's. 165 * Display CPU info for all CPUs.
166 * for parisc this is in processor.c 166 * for parisc this is in processor.c
167 */ 167 */
168extern int show_cpuinfo (struct seq_file *m, void *v); 168extern int show_cpuinfo (struct seq_file *m, void *v);
@@ -225,6 +225,7 @@ static void __init parisc_proc_mkdir(void)
225 } 225 }
226 break; 226 break;
227 case mako: 227 case mako:
228 case mako2:
228 if (NULL == proc_mckinley_root) 229 if (NULL == proc_mckinley_root)
229 { 230 {
230 proc_mckinley_root = proc_mkdir("bus/mckinley", NULL); 231 proc_mckinley_root = proc_mkdir("bus/mckinley", NULL);
diff --git a/arch/parisc/kernel/signal32.h b/arch/parisc/kernel/signal32.h
index e39b38a67a87..c7800846422c 100644
--- a/arch/parisc/kernel/signal32.h
+++ b/arch/parisc/kernel/signal32.h
@@ -113,7 +113,7 @@ int copy_siginfo_from_user32 (siginfo_t *to, compat_siginfo_t __user *from);
113/* In a deft move of uber-hackery, we decide to carry the top half of all 113/* In a deft move of uber-hackery, we decide to carry the top half of all
114 * 64-bit registers in a non-portable, non-ABI, hidden structure. 114 * 64-bit registers in a non-portable, non-ABI, hidden structure.
115 * Userspace can read the hidden structure if it *wants* but is never 115 * Userspace can read the hidden structure if it *wants* but is never
116 * guaranteed to be in the same place. Infact the uc_sigmask from the 116 * guaranteed to be in the same place. In fact the uc_sigmask from the
117 * ucontext_t structure may push the hidden register file downards 117 * ucontext_t structure may push the hidden register file downards
118 */ 118 */
119struct compat_regfile { 119struct compat_regfile {
diff --git a/arch/parisc/kernel/smp.c b/arch/parisc/kernel/smp.c
index 6ba9257fdb7f..04c7e1d36cea 100644
--- a/arch/parisc/kernel/smp.c
+++ b/arch/parisc/kernel/smp.c
@@ -8,7 +8,7 @@
8** Lots of stuff stolen from arch/alpha/kernel/smp.c 8** Lots of stuff stolen from arch/alpha/kernel/smp.c
9** ...and then parisc stole from arch/ia64/kernel/smp.c. Thanks David! :^) 9** ...and then parisc stole from arch/ia64/kernel/smp.c. Thanks David! :^)
10** 10**
11** Thanks to John Curry and Ullas Ponnadi. I learned alot from their work. 11** Thanks to John Curry and Ullas Ponnadi. I learned a lot from their work.
12** -grant (1/12/2001) 12** -grant (1/12/2001)
13** 13**
14** This program is free software; you can redistribute it and/or modify 14** This program is free software; you can redistribute it and/or modify
@@ -419,7 +419,7 @@ smp_cpu_init(int cpunum)
419 BUG(); 419 BUG();
420 enter_lazy_tlb(&init_mm, current); 420 enter_lazy_tlb(&init_mm, current);
421 421
422 init_IRQ(); /* make sure no IRQ's are enabled or pending */ 422 init_IRQ(); /* make sure no IRQs are enabled or pending */
423 start_cpu_itimer(); 423 start_cpu_itimer();
424} 424}
425 425
@@ -461,7 +461,7 @@ void __init smp_callin(void)
461/* 461/*
462 * Bring one cpu online. 462 * Bring one cpu online.
463 */ 463 */
464int __init smp_boot_one_cpu(int cpuid) 464int __cpuinit smp_boot_one_cpu(int cpuid)
465{ 465{
466 struct task_struct *idle; 466 struct task_struct *idle;
467 long timeout; 467 long timeout;
@@ -552,7 +552,7 @@ void __devinit smp_prepare_boot_cpu(void)
552 552
553/* 553/*
554** inventory.c:do_inventory() hasn't yet been run and thus we 554** inventory.c:do_inventory() hasn't yet been run and thus we
555** don't 'discover' the additional CPU's until later. 555** don't 'discover' the additional CPUs until later.
556*/ 556*/
557void __init smp_prepare_cpus(unsigned int max_cpus) 557void __init smp_prepare_cpus(unsigned int max_cpus)
558{ 558{
diff --git a/arch/parisc/kernel/sys_parisc32.c b/arch/parisc/kernel/sys_parisc32.c
index ce3245f87fdd..bb23ff71c28e 100644
--- a/arch/parisc/kernel/sys_parisc32.c
+++ b/arch/parisc/kernel/sys_parisc32.c
@@ -311,14 +311,13 @@ struct readdir32_callback {
311 int count; 311 int count;
312}; 312};
313 313
314#define ROUND_UP(x,a) ((__typeof__(x))(((unsigned long)(x) + ((a) - 1)) & ~((a) - 1)))
315#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de))) 314#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
316static int filldir32 (void *__buf, const char *name, int namlen, 315static int filldir32 (void *__buf, const char *name, int namlen,
317 loff_t offset, u64 ino, unsigned int d_type) 316 loff_t offset, u64 ino, unsigned int d_type)
318{ 317{
319 struct linux32_dirent __user * dirent; 318 struct linux32_dirent __user * dirent;
320 struct getdents32_callback * buf = (struct getdents32_callback *) __buf; 319 struct getdents32_callback * buf = (struct getdents32_callback *) __buf;
321 int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1, 4); 320 int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 1, 4);
322 u32 d_ino; 321 u32 d_ino;
323 322
324 buf->error = -EINVAL; /* only used if we fail.. */ 323 buf->error = -EINVAL; /* only used if we fail.. */
@@ -350,6 +349,10 @@ sys32_getdents (unsigned int fd, void __user * dirent, unsigned int count)
350 struct getdents32_callback buf; 349 struct getdents32_callback buf;
351 int error; 350 int error;
352 351
352 error = -EFAULT;
353 if (!access_ok(VERIFY_WRITE, dirent, count))
354 goto out;
355
353 error = -EBADF; 356 error = -EBADF;
354 file = fget(fd); 357 file = fget(fd);
355 if (!file) 358 if (!file)
@@ -366,8 +369,10 @@ sys32_getdents (unsigned int fd, void __user * dirent, unsigned int count)
366 error = buf.error; 369 error = buf.error;
367 lastdirent = buf.previous; 370 lastdirent = buf.previous;
368 if (lastdirent) { 371 if (lastdirent) {
369 put_user(file->f_pos, &lastdirent->d_off); 372 if (put_user(file->f_pos, &lastdirent->d_off))
370 error = count - buf.count; 373 error = -EFAULT;
374 else
375 error = count - buf.count;
371 } 376 }
372 377
373out_putf: 378out_putf:
diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S
index 10859f53e94f..56f6231cb863 100644
--- a/arch/parisc/kernel/syscall.S
+++ b/arch/parisc/kernel/syscall.S
@@ -181,7 +181,7 @@ linux_gateway_entry:
181 /* Are we being ptraced? */ 181 /* Are we being ptraced? */
182 mfctl %cr30, %r1 182 mfctl %cr30, %r1
183 LDREG TI_TASK(%r1),%r1 183 LDREG TI_TASK(%r1),%r1
184 LDREG TASK_PTRACE(%r1), %r1 184 ldw TASK_PTRACE(%r1), %r1
185 bb,<,n %r1,31,.Ltracesys 185 bb,<,n %r1,31,.Ltracesys
186 186
187 /* Note! We cannot use the syscall table that is mapped 187 /* Note! We cannot use the syscall table that is mapped
@@ -198,7 +198,7 @@ linux_gateway_entry:
198 ldil L%sys_call_table, %r1 198 ldil L%sys_call_table, %r1
199 ldo R%sys_call_table(%r1), %r19 199 ldo R%sys_call_table(%r1), %r19
200#endif 200#endif
201 comiclr,>>= __NR_Linux_syscalls, %r20, %r0 201 comiclr,>> __NR_Linux_syscalls, %r20, %r0
202 b,n .Lsyscall_nosys 202 b,n .Lsyscall_nosys
203 203
204 LDREGX %r20(%r19), %r19 204 LDREGX %r20(%r19), %r19
@@ -501,7 +501,7 @@ lws_compare_and_swap:
501 shlw %r20, 4, %r20 501 shlw %r20, 4, %r20
502 add %r20, %r28, %r20 502 add %r20, %r28, %r20
503 503
504# ifdef ENABLE_LWS_DEBUG 504# if ENABLE_LWS_DEBUG
505 /* 505 /*
506 DEBUG, check for deadlock! 506 DEBUG, check for deadlock!
507 If the thread register values are the same 507 If the thread register values are the same
@@ -550,7 +550,7 @@ cas_wouldblock:
550 perspective 550 perspective
551 */ 551 */
552cas_action: 552cas_action:
553#if defined CONFIG_SMP && defined ENABLE_LWS_DEBUG 553#if defined CONFIG_SMP && ENABLE_LWS_DEBUG
554 /* DEBUG */ 554 /* DEBUG */
555 mfctl %cr27, %r1 555 mfctl %cr27, %r1
556 stw %r1, 4(%sr2,%r20) 556 stw %r1, 4(%sr2,%r20)
@@ -562,7 +562,7 @@ cas_action:
562#ifdef CONFIG_SMP 562#ifdef CONFIG_SMP
563 /* Free lock */ 563 /* Free lock */
564 stw %r20, 0(%sr2,%r20) 564 stw %r20, 0(%sr2,%r20)
565# ifdef ENABLE_LWS_DEBUG 565# if ENABLE_LWS_DEBUG
566 /* Clear thread register indicator */ 566 /* Clear thread register indicator */
567 stw %r0, 4(%sr2,%r20) 567 stw %r0, 4(%sr2,%r20)
568# endif 568# endif
@@ -576,7 +576,7 @@ cas_action:
576#ifdef CONFIG_SMP 576#ifdef CONFIG_SMP
577 /* Free lock */ 577 /* Free lock */
578 stw %r20, 0(%sr2,%r20) 578 stw %r20, 0(%sr2,%r20)
579# ifdef ENABLE_LWS_DEBUG 579# if ENABLE_LWS_DEBUG
580 stw %r0, 4(%sr2,%r20) 580 stw %r0, 4(%sr2,%r20)
581# endif 581# endif
582#endif 582#endif
diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S
index 8bf87e5d9c37..627f3c28ad8c 100644
--- a/arch/parisc/kernel/syscall_table.S
+++ b/arch/parisc/kernel/syscall_table.S
@@ -30,11 +30,6 @@
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 */ 31 */
32 32
33#undef ENTRY_SAME
34#undef ENTRY_DIFF
35#undef ENTRY_UHOH
36#undef ENTRY_COMP
37#undef ENTRY_OURS
38#if defined(CONFIG_64BIT) && !defined(SYSCALL_TABLE_64BIT) 33#if defined(CONFIG_64BIT) && !defined(SYSCALL_TABLE_64BIT)
39/* Use ENTRY_SAME for 32-bit syscalls which are the same on wide and 34/* Use ENTRY_SAME for 32-bit syscalls which are the same on wide and
40 * narrow palinux. Use ENTRY_DIFF for those where a 32-bit specific 35 * narrow palinux. Use ENTRY_DIFF for those where a 32-bit specific
@@ -405,5 +400,16 @@
405 ENTRY_SAME(epoll_pwait) 400 ENTRY_SAME(epoll_pwait)
406 ENTRY_COMP(statfs64) 401 ENTRY_COMP(statfs64)
407 ENTRY_COMP(fstatfs64) 402 ENTRY_COMP(fstatfs64)
403 ENTRY_COMP(kexec_load) /* 300 */
404 ENTRY_COMP(utimensat)
405 ENTRY_COMP(signalfd)
406 ENTRY_COMP(timerfd)
407 ENTRY_SAME(eventfd)
408
408 /* Nothing yet */ 409 /* Nothing yet */
409 410
411#undef ENTRY_SAME
412#undef ENTRY_DIFF
413#undef ENTRY_UHOH
414#undef ENTRY_COMP
415#undef ENTRY_OURS
diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c
index 07a991aa9b0c..8b3062a5c812 100644
--- a/arch/parisc/kernel/time.c
+++ b/arch/parisc/kernel/time.c
@@ -191,7 +191,7 @@ int update_cr16_clocksource(void)
191{ 191{
192 int change = 0; 192 int change = 0;
193 193
194 /* since the cr16 cycle counters are not syncronized across CPUs, 194 /* since the cr16 cycle counters are not synchronized across CPUs,
195 we'll check if we should switch to a safe clocksource: */ 195 we'll check if we should switch to a safe clocksource: */
196 if (clocksource_cr16.rating != 0 && num_online_cpus() > 1) { 196 if (clocksource_cr16.rating != 0 && num_online_cpus() > 1) {
197 clocksource_change_rating(&clocksource_cr16, 0); 197 clocksource_change_rating(&clocksource_cr16, 0);
diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c
index 745ff741490a..c3ec9f1ec0f3 100644
--- a/arch/parisc/kernel/traps.c
+++ b/arch/parisc/kernel/traps.c
@@ -615,7 +615,7 @@ void handle_interruption(int code, struct pt_regs *regs)
615 615
616 case 13: 616 case 13:
617 /* Conditional Trap 617 /* Conditional Trap
618 The condition succees in an instruction which traps 618 The condition succeeds in an instruction which traps
619 on condition */ 619 on condition */
620 if(user_mode(regs)){ 620 if(user_mode(regs)){
621 si.si_signo = SIGFPE; 621 si.si_signo = SIGFPE;
@@ -802,13 +802,14 @@ void handle_interruption(int code, struct pt_regs *regs)
802 802
803int __init check_ivt(void *iva) 803int __init check_ivt(void *iva)
804{ 804{
805 extern const u32 os_hpmc[];
806 extern const u32 os_hpmc_end[];
807
805 int i; 808 int i;
806 u32 check = 0; 809 u32 check = 0;
807 u32 *ivap; 810 u32 *ivap;
808 u32 *hpmcp; 811 u32 *hpmcp;
809 u32 length; 812 u32 length;
810 extern void os_hpmc(void);
811 extern void os_hpmc_end(void);
812 813
813 if (strcmp((char *)iva, "cows can fly")) 814 if (strcmp((char *)iva, "cows can fly"))
814 return -1; 815 return -1;
@@ -820,7 +821,7 @@ int __init check_ivt(void *iva)
820 821
821 /* Compute Checksum for HPMC handler */ 822 /* Compute Checksum for HPMC handler */
822 823
823 length = (u32)((unsigned long)os_hpmc_end - (unsigned long)os_hpmc); 824 length = os_hpmc_end - os_hpmc;
824 ivap[7] = length; 825 ivap[7] = length;
825 826
826 hpmcp = (u32 *)os_hpmc; 827 hpmcp = (u32 *)os_hpmc;
diff --git a/arch/parisc/kernel/unwind.c b/arch/parisc/kernel/unwind.c
index 89c03707eccc..e70f57e27643 100644
--- a/arch/parisc/kernel/unwind.c
+++ b/arch/parisc/kernel/unwind.c
@@ -216,8 +216,10 @@ static void unwind_frame_regs(struct unwind_frame_info *info)
216 /* Handle some frequent special cases.... */ 216 /* Handle some frequent special cases.... */
217 { 217 {
218 char symname[KSYM_NAME_LEN+1]; 218 char symname[KSYM_NAME_LEN+1];
219 char *modname;
219 220
220 kallsyms_lookup(info->ip, NULL, NULL, NULL, symname); 221 kallsyms_lookup(info->ip, NULL, NULL, &modname,
222 symname);
221 223
222 dbg("info->ip = 0x%lx, name = %s\n", info->ip, symname); 224 dbg("info->ip = 0x%lx, name = %s\n", info->ip, symname);
223 225
diff --git a/arch/parisc/math-emu/dbl_float.h b/arch/parisc/math-emu/dbl_float.h
index 1570e2e0a327..0c2fa9a951b3 100644
--- a/arch/parisc/math-emu/dbl_float.h
+++ b/arch/parisc/math-emu/dbl_float.h
@@ -22,7 +22,7 @@
22 PA header file -- do not include this header file for non-PA builds. 22 PA header file -- do not include this header file for non-PA builds.
23#endif 23#endif
24 24
25/* 32-bit word grabing functions */ 25/* 32-bit word grabbing functions */
26#define Dbl_firstword(value) Dallp1(value) 26#define Dbl_firstword(value) Dallp1(value)
27#define Dbl_secondword(value) Dallp2(value) 27#define Dbl_secondword(value) Dallp2(value)
28#define Dbl_thirdword(value) dummy_location 28#define Dbl_thirdword(value) dummy_location
@@ -37,7 +37,7 @@
37#define Dbl_allp1(object) Dallp1(object) 37#define Dbl_allp1(object) Dallp1(object)
38#define Dbl_allp2(object) Dallp2(object) 38#define Dbl_allp2(object) Dallp2(object)
39 39
40/* dbl_and_signs ands the sign bits of each argument and puts the result 40/* dbl_and_signs ANDs the sign bits of each argument and puts the result
41 * into the first argument. dbl_or_signs ors those same sign bits */ 41 * into the first argument. dbl_or_signs ors those same sign bits */
42#define Dbl_and_signs( src1dst, src2) \ 42#define Dbl_and_signs( src1dst, src2) \
43 Dallp1(src1dst) = (Dallp1(src2)|~((unsigned int)1<<31)) & Dallp1(src1dst) 43 Dallp1(src1dst) = (Dallp1(src2)|~((unsigned int)1<<31)) & Dallp1(src1dst)
diff --git a/arch/parisc/math-emu/dfsqrt.c b/arch/parisc/math-emu/dfsqrt.c
index b6ed1066f1e4..9542c6d281a5 100644
--- a/arch/parisc/math-emu/dfsqrt.c
+++ b/arch/parisc/math-emu/dfsqrt.c
@@ -76,7 +76,7 @@ dbl_fsqrt(
76 } 76 }
77 /* 77 /*
78 * Return quiet NaN or positive infinity. 78 * Return quiet NaN or positive infinity.
79 * Fall thru to negative test if negative infinity. 79 * Fall through to negative test if negative infinity.
80 */ 80 */
81 if (Dbl_iszero_sign(srcp1) || 81 if (Dbl_iszero_sign(srcp1) ||
82 Dbl_isnotzero_mantissa(srcp1,srcp2)) { 82 Dbl_isnotzero_mantissa(srcp1,srcp2)) {
diff --git a/arch/parisc/math-emu/sfsqrt.c b/arch/parisc/math-emu/sfsqrt.c
index cd3f6db1f6fb..4657a12c9107 100644
--- a/arch/parisc/math-emu/sfsqrt.c
+++ b/arch/parisc/math-emu/sfsqrt.c
@@ -76,7 +76,7 @@ sgl_fsqrt(
76 } 76 }
77 /* 77 /*
78 * Return quiet NaN or positive infinity. 78 * Return quiet NaN or positive infinity.
79 * Fall thru to negative test if negative infinity. 79 * Fall through to negative test if negative infinity.
80 */ 80 */
81 if (Sgl_iszero_sign(src) || Sgl_isnotzero_mantissa(src)) { 81 if (Sgl_iszero_sign(src) || Sgl_isnotzero_mantissa(src)) {
82 *dstptr = src; 82 *dstptr = src;
diff --git a/arch/parisc/math-emu/sgl_float.h b/arch/parisc/math-emu/sgl_float.h
index 82519a5c2ba5..4ee4cc95e4bf 100644
--- a/arch/parisc/math-emu/sgl_float.h
+++ b/arch/parisc/math-emu/sgl_float.h
@@ -23,7 +23,7 @@
23 PA header file -- do not include this header file for non-PA builds. 23 PA header file -- do not include this header file for non-PA builds.
24#endif 24#endif
25 25
26/* 32-bit word grabing functions */ 26/* 32-bit word grabbing functions */
27#define Sgl_firstword(value) Sall(value) 27#define Sgl_firstword(value) Sall(value)
28#define Sgl_secondword(value) dummy_location 28#define Sgl_secondword(value) dummy_location
29#define Sgl_thirdword(value) dummy_location 29#define Sgl_thirdword(value) dummy_location
@@ -36,7 +36,7 @@
36#define Sgl_exponentmantissa(object) Sexponentmantissa(object) 36#define Sgl_exponentmantissa(object) Sexponentmantissa(object)
37#define Sgl_all(object) Sall(object) 37#define Sgl_all(object) Sall(object)
38 38
39/* sgl_and_signs ands the sign bits of each argument and puts the result 39/* sgl_and_signs ANDs the sign bits of each argument and puts the result
40 * into the first argument. sgl_or_signs ors those same sign bits */ 40 * into the first argument. sgl_or_signs ors those same sign bits */
41#define Sgl_and_signs( src1dst, src2) \ 41#define Sgl_and_signs( src1dst, src2) \
42 Sall(src1dst) = (Sall(src2)|~((unsigned int)1<<31)) & Sall(src1dst) 42 Sall(src1dst) = (Sall(src2)|~((unsigned int)1<<31)) & Sall(src1dst)
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index 75ea9f2a8a41..e724b362c49a 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -890,7 +890,7 @@ void __init paging_init(void)
890#ifdef CONFIG_PA20 890#ifdef CONFIG_PA20
891 891
892/* 892/*
893 * Currently, all PA20 chips have 18 bit protection id's, which is the 893 * Currently, all PA20 chips have 18 bit protection IDs, which is the
894 * limiting factor (space ids are 32 bits). 894 * limiting factor (space ids are 32 bits).
895 */ 895 */
896 896
@@ -899,10 +899,10 @@ void __init paging_init(void)
899#else 899#else
900 900
901/* 901/*
902 * Currently we have a one-to-one relationship between space id's and 902 * Currently we have a one-to-one relationship between space IDs and
903 * protection id's. Older parisc chips (PCXS, PCXT, PCXL, PCXL2) only 903 * protection IDs. Older parisc chips (PCXS, PCXT, PCXL, PCXL2) only
904 * support 15 bit protection id's, so that is the limiting factor. 904 * support 15 bit protection IDs, so that is the limiting factor.
905 * PCXT' has 18 bit protection id's, but only 16 bit spaceids, so it's 905 * PCXT' has 18 bit protection IDs, but only 16 bit spaceids, so it's
906 * probably not worth the effort for a special case here. 906 * probably not worth the effort for a special case here.
907 */ 907 */
908 908
diff --git a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c
index 87703df87509..cbca1df8bc60 100644
--- a/arch/powerpc/kernel/udbg.c
+++ b/arch/powerpc/kernel/udbg.c
@@ -151,12 +151,18 @@ static struct console udbg_console = {
151 151
152static int early_console_initialized; 152static int early_console_initialized;
153 153
154/* called by setup_system */ 154/*
155 * Called by setup_system after ppc_md->probe and ppc_md->early_init.
156 * Call it again after setting udbg_putc in ppc_md->setup_arch.
157 */
155void register_early_udbg_console(void) 158void register_early_udbg_console(void)
156{ 159{
157 if (early_console_initialized) 160 if (early_console_initialized)
158 return; 161 return;
159 162
163 if (!udbg_putc)
164 return;
165
160 if (strstr(boot_command_line, "udbg-immortal")) { 166 if (strstr(boot_command_line, "udbg-immortal")) {
161 printk(KERN_INFO "early console immortal !\n"); 167 printk(KERN_INFO "early console immortal !\n");
162 udbg_console.flags &= ~CON_BOOT; 168 udbg_console.flags &= ~CON_BOOT;
diff --git a/arch/powerpc/lib/rheap.c b/arch/powerpc/lib/rheap.c
index 180ee2933ab9..2f24ea0d723a 100644
--- a/arch/powerpc/lib/rheap.c
+++ b/arch/powerpc/lib/rheap.c
@@ -437,27 +437,26 @@ unsigned long rh_alloc_align(rh_info_t * info, int size, int alignment, const ch
437 struct list_head *l; 437 struct list_head *l;
438 rh_block_t *blk; 438 rh_block_t *blk;
439 rh_block_t *newblk; 439 rh_block_t *newblk;
440 unsigned long start; 440 unsigned long start, sp_size;
441 441
442 /* Validate size, and alignment must be power of two */ 442 /* Validate size, and alignment must be power of two */
443 if (size <= 0 || (alignment & (alignment - 1)) != 0) 443 if (size <= 0 || (alignment & (alignment - 1)) != 0)
444 return (unsigned long) -EINVAL; 444 return (unsigned long) -EINVAL;
445 445
446 /* given alignment larger that default rheap alignment */
447 if (alignment > info->alignment)
448 size += alignment - 1;
449
450 /* Align to configured alignment */ 446 /* Align to configured alignment */
451 size = (size + (info->alignment - 1)) & ~(info->alignment - 1); 447 size = (size + (info->alignment - 1)) & ~(info->alignment - 1);
452 448
453 if (assure_empty(info, 1) < 0) 449 if (assure_empty(info, 2) < 0)
454 return (unsigned long) -ENOMEM; 450 return (unsigned long) -ENOMEM;
455 451
456 blk = NULL; 452 blk = NULL;
457 list_for_each(l, &info->free_list) { 453 list_for_each(l, &info->free_list) {
458 blk = list_entry(l, rh_block_t, list); 454 blk = list_entry(l, rh_block_t, list);
459 if (size <= blk->size) 455 if (size <= blk->size) {
460 break; 456 start = (blk->start + alignment - 1) & ~(alignment - 1);
457 if (start + size <= blk->start + blk->size)
458 break;
459 }
461 blk = NULL; 460 blk = NULL;
462 } 461 }
463 462
@@ -470,25 +469,36 @@ unsigned long rh_alloc_align(rh_info_t * info, int size, int alignment, const ch
470 list_del(&blk->list); 469 list_del(&blk->list);
471 newblk = blk; 470 newblk = blk;
472 } else { 471 } else {
472 /* Fragment caused, split if needed */
473 /* Create block for fragment in the beginning */
474 sp_size = start - blk->start;
475 if (sp_size) {
476 rh_block_t *spblk;
477
478 spblk = get_slot(info);
479 spblk->start = blk->start;
480 spblk->size = sp_size;
481 /* add before the blk */
482 list_add(&spblk->list, blk->list.prev);
483 }
473 newblk = get_slot(info); 484 newblk = get_slot(info);
474 newblk->start = blk->start; 485 newblk->start = start;
475 newblk->size = size; 486 newblk->size = size;
476 487
477 /* blk still in free list, with updated start, size */ 488 /* blk still in free list, with updated start and size
478 blk->start += size; 489 * for fragment in the end */
479 blk->size -= size; 490 blk->start = start + size;
491 blk->size -= sp_size + size;
492 /* No fragment in the end, remove blk */
493 if (blk->size == 0) {
494 list_del(&blk->list);
495 release_slot(info, blk);
496 }
480 } 497 }
481 498
482 newblk->owner = owner; 499 newblk->owner = owner;
483 start = newblk->start;
484 attach_taken_block(info, newblk); 500 attach_taken_block(info, newblk);
485 501
486 /* for larger alignment return fixed up pointer */
487 /* this is no problem with the deallocator since */
488 /* we scan for pointers that lie in the blocks */
489 if (alignment > info->alignment)
490 start = (start + alignment - 1) & ~(alignment - 1);
491
492 return start; 502 return start;
493} 503}
494 504
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index bfe901353142..115b25f50bf8 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -279,14 +279,13 @@ good_area:
279#endif /* CONFIG_8xx */ 279#endif /* CONFIG_8xx */
280 280
281 if (is_exec) { 281 if (is_exec) {
282#ifdef CONFIG_PPC64 282#if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE))
283 /* protection fault */ 283 /* protection fault */
284 if (error_code & DSISR_PROTFAULT) 284 if (error_code & DSISR_PROTFAULT)
285 goto bad_area; 285 goto bad_area;
286 if (!(vma->vm_flags & VM_EXEC)) 286 if (!(vma->vm_flags & VM_EXEC))
287 goto bad_area; 287 goto bad_area;
288#endif 288#else
289#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
290 pte_t *ptep; 289 pte_t *ptep;
291 pmd_t *pmdp; 290 pmd_t *pmdp;
292 291
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index 07b1c4ec428d..7ccb9236e8b4 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -363,8 +363,19 @@ static void __init pmac_setup_arch(void)
363 smp_ops = &core99_smp_ops; 363 smp_ops = &core99_smp_ops;
364 } 364 }
365#ifdef CONFIG_PPC32 365#ifdef CONFIG_PPC32
366 else 366 else {
367 /*
368 * We have to set bits in cpu_possible_map here since the
369 * secondary CPU(s) aren't in the device tree, and
370 * setup_per_cpu_areas only allocates per-cpu data for
371 * CPUs in the cpu_possible_map.
372 */
373 int cpu;
374
375 for (cpu = 1; cpu < 4 && cpu < NR_CPUS; ++cpu)
376 cpu_set(cpu, cpu_possible_map);
367 smp_ops = &psurge_smp_ops; 377 smp_ops = &psurge_smp_ops;
378 }
368#endif 379#endif
369#endif /* CONFIG_SMP */ 380#endif /* CONFIG_SMP */
370 381
@@ -443,6 +454,9 @@ static int initializing = 1;
443 454
444static int pmac_late_init(void) 455static int pmac_late_init(void)
445{ 456{
457 if (!machine_is(powermac))
458 return -ENODEV;
459
446 initializing = 0; 460 initializing = 0;
447 /* this is udbg (which is __init) and we can later use it during 461 /* this is udbg (which is __init) and we can later use it during
448 * cpu hotplug (in smp_core99_kick_cpu) */ 462 * cpu hotplug (in smp_core99_kick_cpu) */
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c
index 686ed82bde79..cb2d894541c6 100644
--- a/arch/powerpc/platforms/powermac/smp.c
+++ b/arch/powerpc/platforms/powermac/smp.c
@@ -317,7 +317,6 @@ static int __init smp_psurge_probe(void)
317 ncpus = NR_CPUS; 317 ncpus = NR_CPUS;
318 for (i = 1; i < ncpus ; ++i) { 318 for (i = 1; i < ncpus ; ++i) {
319 cpu_set(i, cpu_present_map); 319 cpu_set(i, cpu_present_map);
320 cpu_set(i, cpu_possible_map);
321 set_hard_smp_processor_id(i, i); 320 set_hard_smp_processor_id(i, i);
322 } 321 }
323 322
diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c
index 81a2b92ab0c2..6ffbab77ae4d 100644
--- a/arch/s390/appldata/appldata_base.c
+++ b/arch/s390/appldata/appldata_base.c
@@ -535,8 +535,7 @@ void appldata_unregister_ops(struct appldata_ops *ops)
535 535
536/******************************* init / exit *********************************/ 536/******************************* init / exit *********************************/
537 537
538static void 538static void __cpuinit appldata_online_cpu(int cpu)
539appldata_online_cpu(int cpu)
540{ 539{
541 init_virt_timer(&per_cpu(appldata_timer, cpu)); 540 init_virt_timer(&per_cpu(appldata_timer, cpu));
542 per_cpu(appldata_timer, cpu).function = appldata_timer_function; 541 per_cpu(appldata_timer, cpu).function = appldata_timer_function;
@@ -580,7 +579,7 @@ appldata_cpu_notify(struct notifier_block *self,
580 return NOTIFY_OK; 579 return NOTIFY_OK;
581} 580}
582 581
583static struct notifier_block appldata_nb = { 582static struct notifier_block __cpuinitdata appldata_nb = {
584 .notifier_call = appldata_cpu_notify, 583 .notifier_call = appldata_cpu_notify,
585}; 584};
586 585
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index c8a2212014e0..6234c6978a1f 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -769,10 +769,13 @@ mcck_return:
769 769
770 RESTORE_ALL __LC_RETURN_MCCK_PSW,0 770 RESTORE_ALL __LC_RETURN_MCCK_PSW,0
771 771
772#ifdef CONFIG_SMP
773/* 772/*
774 * Restart interruption handler, kick starter for additional CPUs 773 * Restart interruption handler, kick starter for additional CPUs
775 */ 774 */
775#ifdef CONFIG_SMP
776#ifndef CONFIG_HOTPLUG_CPU
777 .section .init.text,"ax"
778#endif
776 .globl restart_int_handler 779 .globl restart_int_handler
777restart_int_handler: 780restart_int_handler:
778 l %r15,__LC_SAVE_AREA+60 # load ksp 781 l %r15,__LC_SAVE_AREA+60 # load ksp
@@ -785,6 +788,9 @@ restart_int_handler:
785 br %r14 # branch to start_secondary 788 br %r14 # branch to start_secondary
786restart_addr: 789restart_addr:
787 .long start_secondary 790 .long start_secondary
791#ifndef CONFIG_HOTPLUG_CPU
792 .previous
793#endif
788#else 794#else
789/* 795/*
790 * If we do not run with SMP enabled, let the new CPU crash ... 796 * If we do not run with SMP enabled, let the new CPU crash ...
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index 93745fd8f555..685f11faa4bc 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -745,10 +745,13 @@ mcck_return:
745#endif 745#endif
746 lpswe __LC_RETURN_MCCK_PSW # back to caller 746 lpswe __LC_RETURN_MCCK_PSW # back to caller
747 747
748#ifdef CONFIG_SMP
749/* 748/*
750 * Restart interruption handler, kick starter for additional CPUs 749 * Restart interruption handler, kick starter for additional CPUs
751 */ 750 */
751#ifdef CONFIG_SMP
752#ifndef CONFIG_HOTPLUG_CPU
753 .section .init.text,"ax"
754#endif
752 .globl restart_int_handler 755 .globl restart_int_handler
753restart_int_handler: 756restart_int_handler:
754 lg %r15,__LC_SAVE_AREA+120 # load ksp 757 lg %r15,__LC_SAVE_AREA+120 # load ksp
@@ -759,6 +762,9 @@ restart_int_handler:
759 lmg %r6,%r15,__SF_GPRS(%r15) # load registers from clone 762 lmg %r6,%r15,__SF_GPRS(%r15) # load registers from clone
760 stosm __SF_EMPTY(%r15),0x04 # now we can turn dat on 763 stosm __SF_EMPTY(%r15),0x04 # now we can turn dat on
761 jg start_secondary 764 jg start_secondary
765#ifndef CONFIG_HOTPLUG_CPU
766 .previous
767#endif
762#else 768#else
763/* 769/*
764 * If we do not run with SMP enabled, let the new CPU crash ... 770 * If we do not run with SMP enabled, let the new CPU crash ...
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 51d6309e7f3b..7e1bfb984064 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -300,6 +300,7 @@ static void __init setup_zfcpdump(unsigned int console_devno)
300 else 300 else
301 sprintf(str, "cio_ignore=all,!0.0.%04x", 301 sprintf(str, "cio_ignore=all,!0.0.%04x",
302 ipl_info.data.fcp.dev_id.devno); 302 ipl_info.data.fcp.dev_id.devno);
303 strcat(COMMAND_LINE, " ");
303 strcat(COMMAND_LINE, str); 304 strcat(COMMAND_LINE, str);
304 console_loglevel = 2; 305 console_loglevel = 2;
305} 306}
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
index cbfe73034c30..ee9186f8fb08 100644
--- a/arch/s390/kernel/traps.c
+++ b/arch/s390/kernel/traps.c
@@ -253,19 +253,22 @@ void die(const char * str, struct pt_regs * regs, long err)
253{ 253{
254 static int die_counter; 254 static int die_counter;
255 255
256 oops_enter();
256 debug_stop_all(); 257 debug_stop_all();
257 console_verbose(); 258 console_verbose();
258 spin_lock_irq(&die_lock); 259 spin_lock_irq(&die_lock);
259 bust_spinlocks(1); 260 bust_spinlocks(1);
260 printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter); 261 printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
261 show_regs(regs); 262 print_modules();
263 show_regs(regs);
262 bust_spinlocks(0); 264 bust_spinlocks(0);
263 spin_unlock_irq(&die_lock); 265 spin_unlock_irq(&die_lock);
264 if (in_interrupt()) 266 if (in_interrupt())
265 panic("Fatal exception in interrupt"); 267 panic("Fatal exception in interrupt");
266 if (panic_on_oops) 268 if (panic_on_oops)
267 panic("Fatal exception: panic_on_oops"); 269 panic("Fatal exception: panic_on_oops");
268 do_exit(SIGSEGV); 270 oops_exit();
271 do_exit(SIGSEGV);
269} 272}
270 273
271static void inline 274static void inline
diff --git a/arch/sh/kernel/signal.c b/arch/sh/kernel/signal.c
index b32c35a7c0a3..e323e299878b 100644
--- a/arch/sh/kernel/signal.c
+++ b/arch/sh/kernel/signal.c
@@ -268,7 +268,7 @@ asmlinkage int sys_rt_sigreturn(unsigned long r4, unsigned long r5,
268badframe: 268badframe:
269 force_sig(SIGSEGV, current); 269 force_sig(SIGSEGV, current);
270 return 0; 270 return 0;
271} 271}
272 272
273/* 273/*
274 * Set up a signal frame. 274 * Set up a signal frame.
@@ -481,7 +481,7 @@ give_sigsegv:
481 481
482static int 482static int
483handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, 483handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
484 sigset_t *oldset, struct pt_regs *regs) 484 sigset_t *oldset, struct pt_regs *regs, unsigned int save_r0)
485{ 485{
486 int ret; 486 int ret;
487 487
@@ -489,6 +489,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
489 if (regs->tra >= 0) { 489 if (regs->tra >= 0) {
490 /* If so, check system call restarting.. */ 490 /* If so, check system call restarting.. */
491 switch (regs->regs[0]) { 491 switch (regs->regs[0]) {
492 case -ERESTART_RESTARTBLOCK:
492 case -ERESTARTNOHAND: 493 case -ERESTARTNOHAND:
493 regs->regs[0] = -EINTR; 494 regs->regs[0] = -EINTR;
494 break; 495 break;
@@ -500,6 +501,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
500 } 501 }
501 /* fallthrough */ 502 /* fallthrough */
502 case -ERESTARTNOINTR: 503 case -ERESTARTNOINTR:
504 regs->regs[0] = save_r0;
503 regs->pc -= instruction_size( 505 regs->pc -= instruction_size(
504 ctrl_inw(regs->pc - 4)); 506 ctrl_inw(regs->pc - 4));
505 break; 507 break;
@@ -583,7 +585,8 @@ static void do_signal(struct pt_regs *regs, unsigned int save_r0)
583 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 585 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
584 if (signr > 0) { 586 if (signr > 0) {
585 /* Whee! Actually deliver the signal. */ 587 /* Whee! Actually deliver the signal. */
586 if (handle_signal(signr, &ka, &info, oldset, regs) == 0) { 588 if (handle_signal(signr, &ka, &info, oldset,
589 regs, save_r0) == 0) {
587 /* a signal was successfully delivered; the saved 590 /* a signal was successfully delivered; the saved
588 * sigmask will have been stored in the signal frame, 591 * sigmask will have been stored in the signal frame,
589 * and will be restored by sigreturn, so we can simply 592 * and will be restored by sigreturn, so we can simply
diff --git a/arch/sh/kernel/traps.c b/arch/sh/kernel/traps.c
index 5b75cb6f8f9b..8f18930d5bf8 100644
--- a/arch/sh/kernel/traps.c
+++ b/arch/sh/kernel/traps.c
@@ -83,6 +83,8 @@ void die(const char * str, struct pt_regs * regs, long err)
83{ 83{
84 static int die_counter; 84 static int die_counter;
85 85
86 oops_enter();
87
86 console_verbose(); 88 console_verbose();
87 spin_lock_irq(&die_lock); 89 spin_lock_irq(&die_lock);
88 bust_spinlocks(1); 90 bust_spinlocks(1);
@@ -112,6 +114,7 @@ void die(const char * str, struct pt_regs * regs, long err)
112 if (panic_on_oops) 114 if (panic_on_oops)
113 panic("Fatal exception"); 115 panic("Fatal exception");
114 116
117 oops_exit();
115 do_exit(SIGSEGV); 118 do_exit(SIGSEGV);
116} 119}
117 120
diff --git a/arch/sh64/kernel/signal.c b/arch/sh64/kernel/signal.c
index c8525ade0564..0bb4a8f94276 100644
--- a/arch/sh64/kernel/signal.c
+++ b/arch/sh64/kernel/signal.c
@@ -640,6 +640,7 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
640 if (regs->syscall_nr >= 0) { 640 if (regs->syscall_nr >= 0) {
641 /* If so, check system call restarting.. */ 641 /* If so, check system call restarting.. */
642 switch (regs->regs[REG_RET]) { 642 switch (regs->regs[REG_RET]) {
643 case -ERESTART_RESTARTBLOCK:
643 case -ERESTARTNOHAND: 644 case -ERESTARTNOHAND:
644 regs->regs[REG_RET] = -EINTR; 645 regs->regs[REG_RET] = -EINTR;
645 break; 646 break;
diff --git a/arch/sparc64/kernel/entry.S b/arch/sparc64/kernel/entry.S
index 7d1a11822a1e..8059531bf0ac 100644
--- a/arch/sparc64/kernel/entry.S
+++ b/arch/sparc64/kernel/entry.S
@@ -2357,8 +2357,9 @@ sun4v_ldc_unmap:
2357 nop 2357 nop
2358 .size sun4v_ldc_unmap, .-sun4v_ldc_unmap 2358 .size sun4v_ldc_unmap, .-sun4v_ldc_unmap
2359 2359
2360 /* %o0: cookie 2360 /* %o0: channel
2361 * %o1: mte_cookie 2361 * %o1: cookie
2362 * %o2: mte_cookie
2362 * 2363 *
2363 * returns %o0: status 2364 * returns %o0: status
2364 */ 2365 */
diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c
index a36f8dd0c021..e60d283f60bc 100644
--- a/arch/sparc64/kernel/irq.c
+++ b/arch/sparc64/kernel/irq.c
@@ -1,7 +1,6 @@
1/* $Id: irq.c,v 1.114 2002/01/11 08:45:38 davem Exp $ 1/* irq.c: UltraSparc IRQ handling/init/registry.
2 * irq.c: UltraSparc IRQ handling/init/registry.
3 * 2 *
4 * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) 3 * Copyright (C) 1997, 2007 David S. Miller (davem@davemloft.net)
5 * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be) 4 * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be)
6 * Copyright (C) 1998 Jakub Jelinek (jj@ultra.linux.cz) 5 * Copyright (C) 1998 Jakub Jelinek (jj@ultra.linux.cz)
7 */ 6 */
@@ -43,6 +42,7 @@
43#include <asm/cpudata.h> 42#include <asm/cpudata.h>
44#include <asm/auxio.h> 43#include <asm/auxio.h>
45#include <asm/head.h> 44#include <asm/head.h>
45#include <asm/hypervisor.h>
46 46
47/* UPA nodes send interrupt packet to UltraSparc with first data reg 47/* UPA nodes send interrupt packet to UltraSparc with first data reg
48 * value low 5 (7 on Starfire) bits holding the IRQ identifier being 48 * 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)
380 } 380 }
381} 381}
382 382
383static void sun4v_virq_enable(unsigned int virt_irq)
384{
385 struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq);
386 unsigned int ino = bucket - &ivector_table[0];
387
388 if (likely(bucket)) {
389 unsigned long cpuid, dev_handle, dev_ino;
390 int err;
391
392 cpuid = irq_choose_cpu(virt_irq);
393
394 dev_handle = ino & IMAP_IGN;
395 dev_ino = ino & IMAP_INO;
396
397 err = sun4v_vintr_set_target(dev_handle, dev_ino, cpuid);
398 if (err != HV_EOK)
399 printk("sun4v_vintr_set_target(%lx,%lx,%lu): "
400 "err(%d)\n",
401 dev_handle, dev_ino, cpuid, err);
402 err = sun4v_vintr_set_state(dev_handle, dev_ino,
403 HV_INTR_ENABLED);
404 if (err != HV_EOK)
405 printk("sun4v_vintr_set_state(%lx,%lx,"
406 "HV_INTR_ENABLED): err(%d)\n",
407 dev_handle, dev_ino, err);
408 }
409}
410
411static void sun4v_virq_disable(unsigned int virt_irq)
412{
413 struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq);
414 unsigned int ino = bucket - &ivector_table[0];
415
416 if (likely(bucket)) {
417 unsigned long dev_handle, dev_ino;
418 int err;
419
420 dev_handle = ino & IMAP_IGN;
421 dev_ino = ino & IMAP_INO;
422
423 err = sun4v_vintr_set_state(dev_handle, dev_ino,
424 HV_INTR_DISABLED);
425 if (err != HV_EOK)
426 printk("sun4v_vintr_set_state(%lx,%lx,"
427 "HV_INTR_DISABLED): err(%d)\n",
428 dev_handle, dev_ino, err);
429 }
430}
431
432static void sun4v_virq_end(unsigned int virt_irq)
433{
434 struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq);
435 unsigned int ino = bucket - &ivector_table[0];
436
437 if (likely(bucket)) {
438 unsigned long dev_handle, dev_ino;
439 int err;
440
441 dev_handle = ino & IMAP_IGN;
442 dev_ino = ino & IMAP_INO;
443
444 err = sun4v_vintr_set_state(dev_handle, dev_ino,
445 HV_INTR_STATE_IDLE);
446 if (err != HV_EOK)
447 printk("sun4v_vintr_set_state(%lx,%lx,"
448 "HV_INTR_STATE_IDLE): err(%d)\n",
449 dev_handle, dev_ino, err);
450 }
451}
452
383static void run_pre_handler(unsigned int virt_irq) 453static void run_pre_handler(unsigned int virt_irq)
384{ 454{
385 struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq); 455 struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq);
@@ -434,6 +504,21 @@ static struct irq_chip sun4v_msi = {
434}; 504};
435#endif 505#endif
436 506
507static struct irq_chip sun4v_virq = {
508 .typename = "vsun4v",
509 .enable = sun4v_virq_enable,
510 .disable = sun4v_virq_disable,
511 .end = sun4v_virq_end,
512};
513
514static struct irq_chip sun4v_virq_ack = {
515 .typename = "vsun4v+ack",
516 .enable = sun4v_virq_enable,
517 .disable = sun4v_virq_disable,
518 .ack = run_pre_handler,
519 .end = sun4v_virq_end,
520};
521
437void irq_install_pre_handler(int virt_irq, 522void irq_install_pre_handler(int virt_irq,
438 void (*func)(unsigned int, void *, void *), 523 void (*func)(unsigned int, void *, void *),
439 void *arg1, void *arg2) 524 void *arg1, void *arg2)
@@ -447,7 +532,8 @@ void irq_install_pre_handler(int virt_irq,
447 532
448 chip = get_irq_chip(virt_irq); 533 chip = get_irq_chip(virt_irq);
449 if (chip == &sun4u_irq_ack || 534 if (chip == &sun4u_irq_ack ||
450 chip == &sun4v_irq_ack 535 chip == &sun4v_irq_ack ||
536 chip == &sun4v_virq_ack
451#ifdef CONFIG_PCI_MSI 537#ifdef CONFIG_PCI_MSI
452 || chip == &sun4v_msi 538 || chip == &sun4v_msi
453#endif 539#endif
@@ -455,7 +541,9 @@ void irq_install_pre_handler(int virt_irq,
455 return; 541 return;
456 542
457 chip = (chip == &sun4u_irq ? 543 chip = (chip == &sun4u_irq ?
458 &sun4u_irq_ack : &sun4v_irq_ack); 544 &sun4u_irq_ack :
545 (chip == &sun4v_irq ?
546 &sun4v_irq_ack : &sun4v_virq_ack));
459 set_irq_chip(virt_irq, chip); 547 set_irq_chip(virt_irq, chip);
460} 548}
461 549
@@ -492,19 +580,18 @@ out:
492 return bucket->virt_irq; 580 return bucket->virt_irq;
493} 581}
494 582
495unsigned int sun4v_build_irq(u32 devhandle, unsigned int devino) 583static unsigned int sun4v_build_common(unsigned long sysino,
584 struct irq_chip *chip)
496{ 585{
497 struct ino_bucket *bucket; 586 struct ino_bucket *bucket;
498 struct irq_handler_data *data; 587 struct irq_handler_data *data;
499 unsigned long sysino;
500 588
501 BUG_ON(tlb_type != hypervisor); 589 BUG_ON(tlb_type != hypervisor);
502 590
503 sysino = sun4v_devino_to_sysino(devhandle, devino);
504 bucket = &ivector_table[sysino]; 591 bucket = &ivector_table[sysino];
505 if (!bucket->virt_irq) { 592 if (!bucket->virt_irq) {
506 bucket->virt_irq = virt_irq_alloc(__irq(bucket)); 593 bucket->virt_irq = virt_irq_alloc(__irq(bucket));
507 set_irq_chip(bucket->virt_irq, &sun4v_irq); 594 set_irq_chip(bucket->virt_irq, chip);
508 } 595 }
509 596
510 data = get_irq_chip_data(bucket->virt_irq); 597 data = get_irq_chip_data(bucket->virt_irq);
@@ -529,6 +616,32 @@ out:
529 return bucket->virt_irq; 616 return bucket->virt_irq;
530} 617}
531 618
619unsigned int sun4v_build_irq(u32 devhandle, unsigned int devino)
620{
621 unsigned long sysino = sun4v_devino_to_sysino(devhandle, devino);
622
623 return sun4v_build_common(sysino, &sun4v_irq);
624}
625
626unsigned int sun4v_build_virq(u32 devhandle, unsigned int devino)
627{
628 unsigned long sysino, hv_err;
629
630 BUG_ON(devhandle & ~IMAP_IGN);
631 BUG_ON(devino & ~IMAP_INO);
632
633 sysino = devhandle | devino;
634
635 hv_err = sun4v_vintr_set_cookie(devhandle, devino, sysino);
636 if (hv_err) {
637 prom_printf("IRQ: Fatal, cannot set cookie for [%x:%x] "
638 "err=%lu\n", devhandle, devino, hv_err);
639 prom_halt();
640 }
641
642 return sun4v_build_common(sysino, &sun4v_virq);
643}
644
532#ifdef CONFIG_PCI_MSI 645#ifdef CONFIG_PCI_MSI
533unsigned int sun4v_build_msi(u32 devhandle, unsigned int *virt_irq_p, 646unsigned int sun4v_build_msi(u32 devhandle, unsigned int *virt_irq_p,
534 unsigned int msi_start, unsigned int msi_end) 647 unsigned int msi_start, unsigned int msi_end)
diff --git a/arch/sparc64/kernel/pci_common.c b/arch/sparc64/kernel/pci_common.c
index f974fefc3ebc..4249214608af 100644
--- a/arch/sparc64/kernel/pci_common.c
+++ b/arch/sparc64/kernel/pci_common.c
@@ -291,8 +291,9 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm)
291 291
292 for (i = 0; i < num_pbm_ranges; i++) { 292 for (i = 0; i < num_pbm_ranges; i++) {
293 const struct linux_prom_pci_ranges *pr = &pbm_ranges[i]; 293 const struct linux_prom_pci_ranges *pr = &pbm_ranges[i];
294 unsigned long a; 294 unsigned long a, size;
295 u32 parent_phys_hi, parent_phys_lo; 295 u32 parent_phys_hi, parent_phys_lo;
296 u32 size_hi, size_lo;
296 int type; 297 int type;
297 298
298 parent_phys_hi = pr->parent_phys_hi; 299 parent_phys_hi = pr->parent_phys_hi;
@@ -300,9 +301,14 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm)
300 if (tlb_type == hypervisor) 301 if (tlb_type == hypervisor)
301 parent_phys_hi &= 0x0fffffff; 302 parent_phys_hi &= 0x0fffffff;
302 303
304 size_hi = pr->size_hi;
305 size_lo = pr->size_lo;
306
303 type = (pr->child_phys_hi >> 24) & 0x3; 307 type = (pr->child_phys_hi >> 24) & 0x3;
304 a = (((unsigned long)parent_phys_hi << 32UL) | 308 a = (((unsigned long)parent_phys_hi << 32UL) |
305 ((unsigned long)parent_phys_lo << 0UL)); 309 ((unsigned long)parent_phys_lo << 0UL));
310 size = (((unsigned long)size_hi << 32UL) |
311 ((unsigned long)size_lo << 0UL));
306 312
307 switch (type) { 313 switch (type) {
308 case 0: 314 case 0:
@@ -313,7 +319,7 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm)
313 case 1: 319 case 1:
314 /* 16-bit IO space, 16MB */ 320 /* 16-bit IO space, 16MB */
315 pbm->io_space.start = a; 321 pbm->io_space.start = a;
316 pbm->io_space.end = a + ((16UL*1024UL*1024UL) - 1UL); 322 pbm->io_space.end = a + size - 1UL;
317 pbm->io_space.flags = IORESOURCE_IO; 323 pbm->io_space.flags = IORESOURCE_IO;
318 saw_io = 1; 324 saw_io = 1;
319 break; 325 break;
@@ -321,7 +327,7 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm)
321 case 2: 327 case 2:
322 /* 32-bit MEM space, 2GB */ 328 /* 32-bit MEM space, 2GB */
323 pbm->mem_space.start = a; 329 pbm->mem_space.start = a;
324 pbm->mem_space.end = a + (0x80000000UL - 1UL); 330 pbm->mem_space.end = a + size - 1UL;
325 pbm->mem_space.flags = IORESOURCE_MEM; 331 pbm->mem_space.flags = IORESOURCE_MEM;
326 saw_mem = 1; 332 saw_mem = 1;
327 break; 333 break;
diff --git a/arch/um/include/common-offsets.h b/arch/um/include/common-offsets.h
index 541f4a8ca512..7376ee44e330 100644
--- a/arch/um/include/common-offsets.h
+++ b/arch/um/include/common-offsets.h
@@ -9,6 +9,7 @@ OFFSET(HOST_TASK_REGS, task_struct, thread.regs);
9OFFSET(HOST_TASK_PID, task_struct, pid); 9OFFSET(HOST_TASK_PID, task_struct, pid);
10 10
11DEFINE(UM_KERN_PAGE_SIZE, PAGE_SIZE); 11DEFINE(UM_KERN_PAGE_SIZE, PAGE_SIZE);
12DEFINE(UM_KERN_PAGE_MASK, PAGE_MASK);
12DEFINE(UM_NSEC_PER_SEC, NSEC_PER_SEC); 13DEFINE(UM_NSEC_PER_SEC, NSEC_PER_SEC);
13 14
14DEFINE_STR(UM_KERN_EMERG, KERN_EMERG); 15DEFINE_STR(UM_KERN_EMERG, KERN_EMERG);
diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c
index ea9a23696f36..fb510d40480c 100644
--- a/arch/um/os-Linux/main.c
+++ b/arch/um/os-Linux/main.c
@@ -24,6 +24,7 @@
24#include "uml-config.h" 24#include "uml-config.h"
25#include "os.h" 25#include "os.h"
26#include "um_malloc.h" 26#include "um_malloc.h"
27#include "kern_constants.h"
27 28
28/* Set in main, unchanged thereafter */ 29/* Set in main, unchanged thereafter */
29char *linux_prog; 30char *linux_prog;
@@ -232,7 +233,8 @@ void *__wrap_malloc(int size)
232 233
233 if(!CAN_KMALLOC()) 234 if(!CAN_KMALLOC())
234 return __real_malloc(size); 235 return __real_malloc(size);
235 else if(size <= PAGE_SIZE) /* finding contiguos pages can be hard*/ 236 else if(size <= UM_KERN_PAGE_SIZE)
237 /* finding contiguous pages can be hard*/
236 ret = um_kmalloc(size); 238 ret = um_kmalloc(size);
237 else ret = um_vmalloc(size); 239 else ret = um_vmalloc(size);
238 240
diff --git a/arch/um/os-Linux/skas/mem.c b/arch/um/os-Linux/skas/mem.c
index 5c8946320799..0f7df4eb903f 100644
--- a/arch/um/os-Linux/skas/mem.c
+++ b/arch/um/os-Linux/skas/mem.c
@@ -25,6 +25,7 @@
25#include "sysdep/ptrace.h" 25#include "sysdep/ptrace.h"
26#include "sysdep/stub.h" 26#include "sysdep/stub.h"
27#include "init.h" 27#include "init.h"
28#include "kern_constants.h"
28 29
29extern unsigned long batch_syscall_stub, __syscall_stub_start; 30extern unsigned long batch_syscall_stub, __syscall_stub_start;
30 31
@@ -149,8 +150,8 @@ long run_syscall_stub(struct mm_id * mm_idp, int syscall,
149 *stack = 0; 150 *stack = 0;
150 multi_op_count++; 151 multi_op_count++;
151 152
152 if(!done && ((((unsigned long) stack) & ~PAGE_MASK) < 153 if(!done && ((((unsigned long) stack) & ~UM_KERN_PAGE_MASK) <
153 PAGE_SIZE - 10 * sizeof(long))){ 154 UM_KERN_PAGE_SIZE - 10 * sizeof(long))){
154 *addr = stack; 155 *addr = stack;
155 return 0; 156 return 0;
156 } 157 }
@@ -168,8 +169,8 @@ long syscall_stub_data(struct mm_id * mm_idp,
168 /* If *addr still is uninitialized, it *must* contain NULL. 169 /* If *addr still is uninitialized, it *must* contain NULL.
169 * Thus in this case do_syscall_stub correctly won't be called. 170 * Thus in this case do_syscall_stub correctly won't be called.
170 */ 171 */
171 if((((unsigned long) *addr) & ~PAGE_MASK) >= 172 if((((unsigned long) *addr) & ~UM_KERN_PAGE_MASK) >=
172 PAGE_SIZE - (10 + data_count) * sizeof(long)) { 173 UM_KERN_PAGE_SIZE - (10 + data_count) * sizeof(long)) {
173 ret = do_syscall_stub(mm_idp, addr); 174 ret = do_syscall_stub(mm_idp, addr);
174 /* in case of error, don't overwrite data on stack */ 175 /* in case of error, don't overwrite data on stack */
175 if(ret) 176 if(ret)
@@ -183,8 +184,8 @@ long syscall_stub_data(struct mm_id * mm_idp,
183 184
184 memcpy(stack + 1, data, data_count * sizeof(long)); 185 memcpy(stack + 1, data, data_count * sizeof(long));
185 186
186 *stub_addr = (void *)(((unsigned long)(stack + 1) & ~PAGE_MASK) + 187 *stub_addr = (void *)(((unsigned long)(stack + 1) &
187 UML_CONFIG_STUB_DATA); 188 ~UM_KERN_PAGE_MASK) + UML_CONFIG_STUB_DATA);
188 189
189 return 0; 190 return 0;
190} 191}
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index f9d2f8545afe..46c00cc429bc 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -252,11 +252,12 @@ int start_userspace(unsigned long stub_stack)
252 unsigned long sp; 252 unsigned long sp;
253 int pid, status, n, flags; 253 int pid, status, n, flags;
254 254
255 stack = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC, 255 stack = mmap(NULL, UM_KERN_PAGE_SIZE,
256 PROT_READ | PROT_WRITE | PROT_EXEC,
256 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); 257 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
257 if(stack == MAP_FAILED) 258 if(stack == MAP_FAILED)
258 panic("start_userspace : mmap failed, errno = %d", errno); 259 panic("start_userspace : mmap failed, errno = %d", errno);
259 sp = (unsigned long) stack + PAGE_SIZE - sizeof(void *); 260 sp = (unsigned long) stack + UM_KERN_PAGE_SIZE - sizeof(void *);
260 261
261 flags = CLONE_FILES | SIGCHLD; 262 flags = CLONE_FILES | SIGCHLD;
262 if(proc_mm) flags |= CLONE_VM; 263 if(proc_mm) flags |= CLONE_VM;
@@ -279,7 +280,7 @@ int start_userspace(unsigned long stub_stack)
279 panic("start_userspace : PTRACE_OLDSETOPTIONS failed, errno=%d\n", 280 panic("start_userspace : PTRACE_OLDSETOPTIONS failed, errno=%d\n",
280 errno); 281 errno);
281 282
282 if(munmap(stack, PAGE_SIZE) < 0) 283 if(munmap(stack, UM_KERN_PAGE_SIZE) < 0)
283 panic("start_userspace : munmap failed, errno = %d\n", errno); 284 panic("start_userspace : munmap failed, errno = %d\n", errno);
284 285
285 return(pid); 286 return(pid);
@@ -365,7 +366,7 @@ static int __init init_thread_regs(void)
365 thread_regs[REGS_IP_INDEX] = UML_CONFIG_STUB_CODE + 366 thread_regs[REGS_IP_INDEX] = UML_CONFIG_STUB_CODE +
366 (unsigned long) stub_clone_handler - 367 (unsigned long) stub_clone_handler -
367 (unsigned long) &__syscall_stub_start; 368 (unsigned long) &__syscall_stub_start;
368 thread_regs[REGS_SP_INDEX] = UML_CONFIG_STUB_DATA + PAGE_SIZE - 369 thread_regs[REGS_SP_INDEX] = UML_CONFIG_STUB_DATA + UM_KERN_PAGE_SIZE -
369 sizeof(void *); 370 sizeof(void *);
370#ifdef __SIGNAL_FRAMESIZE 371#ifdef __SIGNAL_FRAMESIZE
371 thread_regs[REGS_SP_INDEX] -= __SIGNAL_FRAMESIZE; 372 thread_regs[REGS_SP_INDEX] -= __SIGNAL_FRAMESIZE;
@@ -453,7 +454,7 @@ void map_stub_pages(int fd, unsigned long code,
453 .u = 454 .u =
454 { .mmap = 455 { .mmap =
455 { .addr = code, 456 { .addr = code,
456 .len = PAGE_SIZE, 457 .len = UM_KERN_PAGE_SIZE,
457 .prot = PROT_EXEC, 458 .prot = PROT_EXEC,
458 .flags = MAP_FIXED | MAP_PRIVATE, 459 .flags = MAP_FIXED | MAP_PRIVATE,
459 .fd = code_fd, 460 .fd = code_fd,
@@ -476,7 +477,7 @@ void map_stub_pages(int fd, unsigned long code,
476 .u = 477 .u =
477 { .mmap = 478 { .mmap =
478 { .addr = data, 479 { .addr = data,
479 .len = PAGE_SIZE, 480 .len = UM_KERN_PAGE_SIZE,
480 .prot = PROT_READ | PROT_WRITE, 481 .prot = PROT_READ | PROT_WRITE,
481 .flags = MAP_FIXED | MAP_SHARED, 482 .flags = MAP_FIXED | MAP_SHARED,
482 .fd = map_fd, 483 .fd = map_fd,
diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c
index 3fc13fa8729d..46f613975c19 100644
--- a/arch/um/os-Linux/start_up.c
+++ b/arch/um/os-Linux/start_up.c
@@ -107,11 +107,12 @@ static int start_ptraced_child(void **stack_out)
107 unsigned long sp; 107 unsigned long sp;
108 int pid, n, status; 108 int pid, n, status;
109 109
110 stack = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC, 110 stack = mmap(NULL, UM_KERN_PAGE_SIZE,
111 PROT_READ | PROT_WRITE | PROT_EXEC,
111 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); 112 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
112 if(stack == MAP_FAILED) 113 if(stack == MAP_FAILED)
113 fatal_perror("check_ptrace : mmap failed"); 114 fatal_perror("check_ptrace : mmap failed");
114 sp = (unsigned long) stack + PAGE_SIZE - sizeof(void *); 115 sp = (unsigned long) stack + UM_KERN_PAGE_SIZE - sizeof(void *);
115 pid = clone(ptrace_child, (void *) sp, SIGCHLD, NULL); 116 pid = clone(ptrace_child, (void *) sp, SIGCHLD, NULL);
116 if(pid < 0) 117 if(pid < 0)
117 fatal_perror("start_ptraced_child : clone failed"); 118 fatal_perror("start_ptraced_child : clone failed");
@@ -153,7 +154,7 @@ static int stop_ptraced_child(int pid, void *stack, int exitcode,
153 ret = -1; 154 ret = -1;
154 } 155 }
155 156
156 if(munmap(stack, PAGE_SIZE) < 0) 157 if(munmap(stack, UM_KERN_PAGE_SIZE) < 0)
157 fatal_perror("check_ptrace : munmap failed"); 158 fatal_perror("check_ptrace : munmap failed");
158 return ret; 159 return ret;
159} 160}
diff --git a/arch/x86_64/Kconfig.debug b/arch/x86_64/Kconfig.debug
index 775d211a5cf9..8a8677518447 100644
--- a/arch/x86_64/Kconfig.debug
+++ b/arch/x86_64/Kconfig.debug
@@ -9,6 +9,7 @@ source "lib/Kconfig.debug"
9config DEBUG_RODATA 9config DEBUG_RODATA
10 bool "Write protect kernel read-only data structures" 10 bool "Write protect kernel read-only data structures"
11 depends on DEBUG_KERNEL 11 depends on DEBUG_KERNEL
12 depends on !KPROBES # temporary for 2.6.22
12 help 13 help
13 Mark the kernel read-only data as write-protected in the pagetables, 14 Mark the kernel read-only data as write-protected in the pagetables,
14 in order to catch accidental (and incorrect) writes to such const data. 15 in order to catch accidental (and incorrect) writes to such const data.
diff --git a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S
index 21868f9bed7c..47565c3345d2 100644
--- a/arch/x86_64/ia32/ia32entry.S
+++ b/arch/x86_64/ia32/ia32entry.S
@@ -620,7 +620,7 @@ ia32_sys_call_table:
620 .quad quiet_ni_syscall /* tux */ 620 .quad quiet_ni_syscall /* tux */
621 .quad quiet_ni_syscall /* security */ 621 .quad quiet_ni_syscall /* security */
622 .quad sys_gettid 622 .quad sys_gettid
623 .quad sys_readahead /* 225 */ 623 .quad sys32_readahead /* 225 */
624 .quad sys_setxattr 624 .quad sys_setxattr
625 .quad sys_lsetxattr 625 .quad sys_lsetxattr
626 .quad sys_fsetxattr 626 .quad sys_fsetxattr
@@ -645,7 +645,7 @@ ia32_sys_call_table:
645 .quad compat_sys_io_getevents 645 .quad compat_sys_io_getevents
646 .quad compat_sys_io_submit 646 .quad compat_sys_io_submit
647 .quad sys_io_cancel 647 .quad sys_io_cancel
648 .quad sys_fadvise64 /* 250 */ 648 .quad sys32_fadvise64 /* 250 */
649 .quad quiet_ni_syscall /* free_huge_pages */ 649 .quad quiet_ni_syscall /* free_huge_pages */
650 .quad sys_exit_group 650 .quad sys_exit_group
651 .quad sys32_lookup_dcookie 651 .quad sys32_lookup_dcookie
@@ -709,7 +709,7 @@ ia32_sys_call_table:
709 .quad compat_sys_set_robust_list 709 .quad compat_sys_set_robust_list
710 .quad compat_sys_get_robust_list 710 .quad compat_sys_get_robust_list
711 .quad sys_splice 711 .quad sys_splice
712 .quad sys_sync_file_range 712 .quad sys32_sync_file_range
713 .quad sys_tee /* 315 */ 713 .quad sys_tee /* 315 */
714 .quad compat_sys_vmsplice 714 .quad compat_sys_vmsplice
715 .quad compat_sys_move_pages 715 .quad compat_sys_move_pages
diff --git a/arch/x86_64/ia32/sys_ia32.c b/arch/x86_64/ia32/sys_ia32.c
index 200fdde18d96..99a78a3cce7c 100644
--- a/arch/x86_64/ia32/sys_ia32.c
+++ b/arch/x86_64/ia32/sys_ia32.c
@@ -860,3 +860,22 @@ long sys32_lookup_dcookie(u32 addr_low, u32 addr_high,
860 return sys_lookup_dcookie(((u64)addr_high << 32) | addr_low, buf, len); 860 return sys_lookup_dcookie(((u64)addr_high << 32) | addr_low, buf, len);
861} 861}
862 862
863asmlinkage ssize_t sys32_readahead(int fd, unsigned off_lo, unsigned off_hi, size_t count)
864{
865 return sys_readahead(fd, ((u64)off_hi << 32) | off_lo, count);
866}
867
868asmlinkage long sys32_sync_file_range(int fd, unsigned off_low, unsigned off_hi,
869 unsigned n_low, unsigned n_hi, int flags)
870{
871 return sys_sync_file_range(fd,
872 ((u64)off_hi << 32) | off_low,
873 ((u64)n_hi << 32) | n_low, flags);
874}
875
876asmlinkage long sys32_fadvise64(int fd, unsigned offset_lo, unsigned offset_hi, size_t len,
877 int advice)
878{
879 return sys_fadvise64_64(fd, ((u64)offset_hi << 32) | offset_lo,
880 len, advice);
881}
diff --git a/arch/x86_64/kernel/pci-dma.c b/arch/x86_64/kernel/pci-dma.c
index 651ccfb06697..9f80aad3fe2d 100644
--- a/arch/x86_64/kernel/pci-dma.c
+++ b/arch/x86_64/kernel/pci-dma.c
@@ -322,5 +322,17 @@ static int __init pci_iommu_init(void)
322 return 0; 322 return 0;
323} 323}
324 324
325#ifdef CONFIG_PCI
326/* Many VIA bridges seem to corrupt data for DAC. Disable it here */
327
328static __devinit void via_no_dac(struct pci_dev *dev)
329{
330 if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI && forbid_dac == 0) {
331 printk(KERN_INFO "PCI: VIA PCI bridge detected. Disabling DAC.\n");
332 forbid_dac = 1;
333 }
334}
335DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_ANY_ID, via_no_dac);
336#endif
325/* Must execute after PCI subsystem */ 337/* Must execute after PCI subsystem */
326fs_initcall(pci_iommu_init); 338fs_initcall(pci_iommu_init);
diff --git a/arch/x86_64/mm/pageattr.c b/arch/x86_64/mm/pageattr.c
index d653d0bf3df6..9148f4a4cec6 100644
--- a/arch/x86_64/mm/pageattr.c
+++ b/arch/x86_64/mm/pageattr.c
@@ -74,10 +74,11 @@ static void flush_kernel_map(void *arg)
74 struct page *pg; 74 struct page *pg;
75 75
76 /* When clflush is available always use it because it is 76 /* When clflush is available always use it because it is
77 much cheaper than WBINVD */ 77 much cheaper than WBINVD. Disable clflush for now because
78 if (!cpu_has_clflush) 78 the high level code is not ready yet */
79 if (1 || !cpu_has_clflush)
79 asm volatile("wbinvd" ::: "memory"); 80 asm volatile("wbinvd" ::: "memory");
80 list_for_each_entry(pg, l, lru) { 81 else list_for_each_entry(pg, l, lru) {
81 void *adr = page_address(pg); 82 void *adr = page_address(pg);
82 if (cpu_has_clflush) 83 if (cpu_has_clflush)
83 cache_flush_page(adr); 84 cache_flush_page(adr);
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index 6b5173ac8131..c99b46354859 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -340,6 +340,15 @@ unsigned blk_ordered_req_seq(struct request *rq)
340 if (rq == &q->post_flush_rq) 340 if (rq == &q->post_flush_rq)
341 return QUEUE_ORDSEQ_POSTFLUSH; 341 return QUEUE_ORDSEQ_POSTFLUSH;
342 342
343 /*
344 * !fs requests don't need to follow barrier ordering. Always
345 * put them at the front. This fixes the following deadlock.
346 *
347 * http://thread.gmane.org/gmane.linux.kernel/537473
348 */
349 if (!blk_fs_request(rq))
350 return QUEUE_ORDSEQ_DRAIN;
351
343 if ((rq->cmd_flags & REQ_ORDERED_COLOR) == 352 if ((rq->cmd_flags & REQ_ORDERED_COLOR) ==
344 (q->orig_bar_rq->cmd_flags & REQ_ORDERED_COLOR)) 353 (q->orig_bar_rq->cmd_flags & REQ_ORDERED_COLOR))
345 return QUEUE_ORDSEQ_DRAIN; 354 return QUEUE_ORDSEQ_DRAIN;
diff --git a/drivers/acpi/toshiba_acpi.c b/drivers/acpi/toshiba_acpi.c
index 1cfbecb0ac10..13369b45563f 100644
--- a/drivers/acpi/toshiba_acpi.c
+++ b/drivers/acpi/toshiba_acpi.c
@@ -524,7 +524,7 @@ static acpi_status __init add_device(void)
524 return AE_OK; 524 return AE_OK;
525} 525}
526 526
527static acpi_status __exit remove_device(void) 527static acpi_status remove_device(void)
528{ 528{
529 ProcItem *item; 529 ProcItem *item;
530 530
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index d383168b75fa..0439ee951a11 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -1810,68 +1810,69 @@ static int find_gmch(u16 device)
1810static const struct intel_driver_description { 1810static const struct intel_driver_description {
1811 unsigned int chip_id; 1811 unsigned int chip_id;
1812 unsigned int gmch_chip_id; 1812 unsigned int gmch_chip_id;
1813 unsigned int multi_gmch_chip; /* if we have more gfx chip type on this HB. */
1813 char *name; 1814 char *name;
1814 const struct agp_bridge_driver *driver; 1815 const struct agp_bridge_driver *driver;
1815 const struct agp_bridge_driver *gmch_driver; 1816 const struct agp_bridge_driver *gmch_driver;
1816} intel_agp_chipsets[] = { 1817} intel_agp_chipsets[] = {
1817 { PCI_DEVICE_ID_INTEL_82443LX_0, 0, "440LX", &intel_generic_driver, NULL }, 1818 { PCI_DEVICE_ID_INTEL_82443LX_0, 0, 0, "440LX", &intel_generic_driver, NULL },
1818 { PCI_DEVICE_ID_INTEL_82443BX_0, 0, "440BX", &intel_generic_driver, NULL }, 1819 { PCI_DEVICE_ID_INTEL_82443BX_0, 0, 0, "440BX", &intel_generic_driver, NULL },
1819 { PCI_DEVICE_ID_INTEL_82443GX_0, 0, "440GX", &intel_generic_driver, NULL }, 1820 { PCI_DEVICE_ID_INTEL_82443GX_0, 0, 0, "440GX", &intel_generic_driver, NULL },
1820 { PCI_DEVICE_ID_INTEL_82810_MC1, PCI_DEVICE_ID_INTEL_82810_IG1, "i810", 1821 { PCI_DEVICE_ID_INTEL_82810_MC1, PCI_DEVICE_ID_INTEL_82810_IG1, 0, "i810",
1821 NULL, &intel_810_driver }, 1822 NULL, &intel_810_driver },
1822 { PCI_DEVICE_ID_INTEL_82810_MC3, PCI_DEVICE_ID_INTEL_82810_IG3, "i810", 1823 { PCI_DEVICE_ID_INTEL_82810_MC3, PCI_DEVICE_ID_INTEL_82810_IG3, 0, "i810",
1823 NULL, &intel_810_driver }, 1824 NULL, &intel_810_driver },
1824 { PCI_DEVICE_ID_INTEL_82810E_MC, PCI_DEVICE_ID_INTEL_82810E_IG, "i810", 1825 { PCI_DEVICE_ID_INTEL_82810E_MC, PCI_DEVICE_ID_INTEL_82810E_IG, 0, "i810",
1825 NULL, &intel_810_driver }, 1826 NULL, &intel_810_driver },
1826 { PCI_DEVICE_ID_INTEL_82815_MC, PCI_DEVICE_ID_INTEL_82815_CGC, "i815", 1827 { PCI_DEVICE_ID_INTEL_82815_MC, PCI_DEVICE_ID_INTEL_82815_CGC, 0, "i815",
1827 &intel_810_driver, &intel_815_driver }, 1828 &intel_815_driver, &intel_810_driver },
1828 { PCI_DEVICE_ID_INTEL_82820_HB, 0, "i820", &intel_820_driver, NULL }, 1829 { PCI_DEVICE_ID_INTEL_82820_HB, 0, 0, "i820", &intel_820_driver, NULL },
1829 { PCI_DEVICE_ID_INTEL_82820_UP_HB, 0, "i820", &intel_820_driver, NULL }, 1830 { PCI_DEVICE_ID_INTEL_82820_UP_HB, 0, 0, "i820", &intel_820_driver, NULL },
1830 { PCI_DEVICE_ID_INTEL_82830_HB, PCI_DEVICE_ID_INTEL_82830_CGC, "830M", 1831 { PCI_DEVICE_ID_INTEL_82830_HB, PCI_DEVICE_ID_INTEL_82830_CGC, 0, "830M",
1831 &intel_830mp_driver, &intel_830_driver }, 1832 &intel_830mp_driver, &intel_830_driver },
1832 { PCI_DEVICE_ID_INTEL_82840_HB, 0, "i840", &intel_840_driver, NULL }, 1833 { PCI_DEVICE_ID_INTEL_82840_HB, 0, 0, "i840", &intel_840_driver, NULL },
1833 { PCI_DEVICE_ID_INTEL_82845_HB, 0, "845G", &intel_845_driver, NULL }, 1834 { PCI_DEVICE_ID_INTEL_82845_HB, 0, 0, "845G", &intel_845_driver, NULL },
1834 { PCI_DEVICE_ID_INTEL_82845G_HB, PCI_DEVICE_ID_INTEL_82845G_IG, "830M", 1835 { PCI_DEVICE_ID_INTEL_82845G_HB, PCI_DEVICE_ID_INTEL_82845G_IG, 0, "830M",
1835 &intel_845_driver, &intel_830_driver }, 1836 &intel_845_driver, &intel_830_driver },
1836 { PCI_DEVICE_ID_INTEL_82850_HB, 0, "i850", &intel_850_driver, NULL }, 1837 { PCI_DEVICE_ID_INTEL_82850_HB, 0, 0, "i850", &intel_850_driver, NULL },
1837 { PCI_DEVICE_ID_INTEL_82855PM_HB, 0, "855PM", &intel_845_driver, NULL }, 1838 { PCI_DEVICE_ID_INTEL_82855PM_HB, 0, 0, "855PM", &intel_845_driver, NULL },
1838 { PCI_DEVICE_ID_INTEL_82855GM_HB, PCI_DEVICE_ID_INTEL_82855GM_IG, "855GM", 1839 { PCI_DEVICE_ID_INTEL_82855GM_HB, PCI_DEVICE_ID_INTEL_82855GM_IG, 0, "855GM",
1839 &intel_845_driver, &intel_830_driver }, 1840 &intel_845_driver, &intel_830_driver },
1840 { PCI_DEVICE_ID_INTEL_82860_HB, 0, "i860", &intel_860_driver, NULL }, 1841 { PCI_DEVICE_ID_INTEL_82860_HB, 0, 0, "i860", &intel_860_driver, NULL },
1841 { PCI_DEVICE_ID_INTEL_82865_HB, PCI_DEVICE_ID_INTEL_82865_IG, "865", 1842 { PCI_DEVICE_ID_INTEL_82865_HB, PCI_DEVICE_ID_INTEL_82865_IG, 0, "865",
1842 &intel_845_driver, &intel_830_driver }, 1843 &intel_845_driver, &intel_830_driver },
1843 { PCI_DEVICE_ID_INTEL_82875_HB, 0, "i875", &intel_845_driver, NULL }, 1844 { PCI_DEVICE_ID_INTEL_82875_HB, 0, 0, "i875", &intel_845_driver, NULL },
1844 { PCI_DEVICE_ID_INTEL_82915G_HB, PCI_DEVICE_ID_INTEL_82915G_IG, "915G", 1845 { PCI_DEVICE_ID_INTEL_82915G_HB, PCI_DEVICE_ID_INTEL_82915G_IG, 0, "915G",
1845 &intel_845_driver, &intel_915_driver }, 1846 &intel_845_driver, &intel_915_driver },
1846 { PCI_DEVICE_ID_INTEL_82915GM_HB, PCI_DEVICE_ID_INTEL_82915GM_IG, "915GM", 1847 { PCI_DEVICE_ID_INTEL_82915GM_HB, PCI_DEVICE_ID_INTEL_82915GM_IG, 0, "915GM",
1847 &intel_845_driver, &intel_915_driver }, 1848 &intel_845_driver, &intel_915_driver },
1848 { PCI_DEVICE_ID_INTEL_82945G_HB, PCI_DEVICE_ID_INTEL_82945G_IG, "945G", 1849 { PCI_DEVICE_ID_INTEL_82945G_HB, PCI_DEVICE_ID_INTEL_82945G_IG, 0, "945G",
1849 &intel_845_driver, &intel_915_driver }, 1850 &intel_845_driver, &intel_915_driver },
1850 { PCI_DEVICE_ID_INTEL_82945GM_HB, PCI_DEVICE_ID_INTEL_82945GM_IG, "945GM", 1851 { PCI_DEVICE_ID_INTEL_82945GM_HB, PCI_DEVICE_ID_INTEL_82945GM_IG, 1, "945GM",
1851 &intel_845_driver, &intel_915_driver }, 1852 &intel_845_driver, &intel_915_driver },
1852 { PCI_DEVICE_ID_INTEL_82945GM_HB, PCI_DEVICE_ID_INTEL_82945GME_IG, "945GME", 1853 { PCI_DEVICE_ID_INTEL_82945GM_HB, PCI_DEVICE_ID_INTEL_82945GME_IG, 0, "945GME",
1853 &intel_845_driver, &intel_915_driver }, 1854 &intel_845_driver, &intel_915_driver },
1854 { PCI_DEVICE_ID_INTEL_82946GZ_HB, PCI_DEVICE_ID_INTEL_82946GZ_IG, "946GZ", 1855 { PCI_DEVICE_ID_INTEL_82946GZ_HB, PCI_DEVICE_ID_INTEL_82946GZ_IG, 0, "946GZ",
1855 &intel_845_driver, &intel_i965_driver }, 1856 &intel_845_driver, &intel_i965_driver },
1856 { PCI_DEVICE_ID_INTEL_82965G_1_HB, PCI_DEVICE_ID_INTEL_82965G_1_IG, "965G", 1857 { PCI_DEVICE_ID_INTEL_82965G_1_HB, PCI_DEVICE_ID_INTEL_82965G_1_IG, 0, "965G",
1857 &intel_845_driver, &intel_i965_driver }, 1858 &intel_845_driver, &intel_i965_driver },
1858 { PCI_DEVICE_ID_INTEL_82965Q_HB, PCI_DEVICE_ID_INTEL_82965Q_IG, "965Q", 1859 { PCI_DEVICE_ID_INTEL_82965Q_HB, PCI_DEVICE_ID_INTEL_82965Q_IG, 0, "965Q",
1859 &intel_845_driver, &intel_i965_driver }, 1860 &intel_845_driver, &intel_i965_driver },
1860 { PCI_DEVICE_ID_INTEL_82965G_HB, PCI_DEVICE_ID_INTEL_82965G_IG, "965G", 1861 { PCI_DEVICE_ID_INTEL_82965G_HB, PCI_DEVICE_ID_INTEL_82965G_IG, 0, "965G",
1861 &intel_845_driver, &intel_i965_driver }, 1862 &intel_845_driver, &intel_i965_driver },
1862 { PCI_DEVICE_ID_INTEL_82965GM_HB, PCI_DEVICE_ID_INTEL_82965GM_IG, "965GM", 1863 { PCI_DEVICE_ID_INTEL_82965GM_HB, PCI_DEVICE_ID_INTEL_82965GM_IG, 1, "965GM",
1863 &intel_845_driver, &intel_i965_driver }, 1864 &intel_845_driver, &intel_i965_driver },
1864 { PCI_DEVICE_ID_INTEL_82965GM_HB, PCI_DEVICE_ID_INTEL_82965GME_IG, "965GME/GLE", 1865 { PCI_DEVICE_ID_INTEL_82965GM_HB, PCI_DEVICE_ID_INTEL_82965GME_IG, 0, "965GME/GLE",
1865 &intel_845_driver, &intel_i965_driver }, 1866 &intel_845_driver, &intel_i965_driver },
1866 { PCI_DEVICE_ID_INTEL_7505_0, 0, "E7505", &intel_7505_driver, NULL }, 1867 { PCI_DEVICE_ID_INTEL_7505_0, 0, 0, "E7505", &intel_7505_driver, NULL },
1867 { PCI_DEVICE_ID_INTEL_7205_0, 0, "E7205", &intel_7505_driver, NULL }, 1868 { PCI_DEVICE_ID_INTEL_7205_0, 0, 0, "E7205", &intel_7505_driver, NULL },
1868 { PCI_DEVICE_ID_INTEL_G33_HB, PCI_DEVICE_ID_INTEL_G33_IG, "G33", 1869 { PCI_DEVICE_ID_INTEL_G33_HB, PCI_DEVICE_ID_INTEL_G33_IG, 0, "G33",
1869 &intel_845_driver, &intel_g33_driver }, 1870 &intel_845_driver, &intel_g33_driver },
1870 { PCI_DEVICE_ID_INTEL_Q35_HB, PCI_DEVICE_ID_INTEL_Q35_IG, "Q35", 1871 { PCI_DEVICE_ID_INTEL_Q35_HB, PCI_DEVICE_ID_INTEL_Q35_IG, 0, "Q35",
1871 &intel_845_driver, &intel_g33_driver }, 1872 &intel_845_driver, &intel_g33_driver },
1872 { PCI_DEVICE_ID_INTEL_Q33_HB, PCI_DEVICE_ID_INTEL_Q33_IG, "Q33", 1873 { PCI_DEVICE_ID_INTEL_Q33_HB, PCI_DEVICE_ID_INTEL_Q33_IG, 0, "Q33",
1873 &intel_845_driver, &intel_g33_driver }, 1874 &intel_845_driver, &intel_g33_driver },
1874 { 0, 0, NULL, NULL, NULL } 1875 { 0, 0, 0, NULL, NULL, NULL }
1875}; 1876};
1876 1877
1877static int __devinit agp_intel_probe(struct pci_dev *pdev, 1878static int __devinit agp_intel_probe(struct pci_dev *pdev,
@@ -1892,10 +1893,19 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
1892 /* In case that multiple models of gfx chip may 1893 /* In case that multiple models of gfx chip may
1893 stand on same host bridge type, this can be 1894 stand on same host bridge type, this can be
1894 sure we detect the right IGD. */ 1895 sure we detect the right IGD. */
1895 if ((pdev->device == intel_agp_chipsets[i].chip_id) && 1896 if (pdev->device == intel_agp_chipsets[i].chip_id) {
1896 ((intel_agp_chipsets[i].gmch_chip_id == 0) || 1897 if ((intel_agp_chipsets[i].gmch_chip_id != 0) &&
1897 find_gmch(intel_agp_chipsets[i].gmch_chip_id))) 1898 find_gmch(intel_agp_chipsets[i].gmch_chip_id)) {
1898 break; 1899 bridge->driver =
1900 intel_agp_chipsets[i].gmch_driver;
1901 break;
1902 } else if (intel_agp_chipsets[i].multi_gmch_chip) {
1903 continue;
1904 } else {
1905 bridge->driver = intel_agp_chipsets[i].driver;
1906 break;
1907 }
1908 }
1899 } 1909 }
1900 1910
1901 if (intel_agp_chipsets[i].name == NULL) { 1911 if (intel_agp_chipsets[i].name == NULL) {
@@ -1906,11 +1916,6 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
1906 return -ENODEV; 1916 return -ENODEV;
1907 } 1917 }
1908 1918
1909 if (intel_agp_chipsets[i].gmch_chip_id != 0)
1910 bridge->driver = intel_agp_chipsets[i].gmch_driver;
1911 else
1912 bridge->driver = intel_agp_chipsets[i].driver;
1913
1914 if (bridge->driver == NULL) { 1919 if (bridge->driver == NULL) {
1915 printk(KERN_WARNING PFX "Failed to find bridge device " 1920 printk(KERN_WARNING PFX "Failed to find bridge device "
1916 "(chip_id: %04x)\n", intel_agp_chipsets[i].gmch_chip_id); 1921 "(chip_id: %04x)\n", intel_agp_chipsets[i].gmch_chip_id);
diff --git a/drivers/char/drm/drm_pciids.h b/drivers/char/drm/drm_pciids.h
index 177ccc07f968..aa6335032d1e 100644
--- a/drivers/char/drm/drm_pciids.h
+++ b/drivers/char/drm/drm_pciids.h
@@ -300,10 +300,15 @@
300 {0x8086, 0x2592, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ 300 {0x8086, 0x2592, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
301 {0x8086, 0x2772, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ 301 {0x8086, 0x2772, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
302 {0x8086, 0x27a2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ 302 {0x8086, 0x27a2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
303 {0x8086, 0x27ae, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
303 {0x8086, 0x2972, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ 304 {0x8086, 0x2972, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
304 {0x8086, 0x2982, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ 305 {0x8086, 0x2982, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
305 {0x8086, 0x2992, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ 306 {0x8086, 0x2992, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
306 {0x8086, 0x29a2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ 307 {0x8086, 0x29a2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
308 {0x8086, 0x29b2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
309 {0x8086, 0x29c2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
310 {0x8086, 0x29d2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
307 {0x8086, 0x2a02, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ 311 {0x8086, 0x2a02, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
312 {0x8086, 0x2a12, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
308 {0, 0, 0} 313 {0, 0, 0}
309 314
diff --git a/drivers/char/drm/i915_dma.c b/drivers/char/drm/i915_dma.c
index 1ba15d9a171a..ea52740af4f6 100644
--- a/drivers/char/drm/i915_dma.c
+++ b/drivers/char/drm/i915_dma.c
@@ -35,7 +35,12 @@
35 dev->pci_device == 0x2982 || \ 35 dev->pci_device == 0x2982 || \
36 dev->pci_device == 0x2992 || \ 36 dev->pci_device == 0x2992 || \
37 dev->pci_device == 0x29A2 || \ 37 dev->pci_device == 0x29A2 || \
38 dev->pci_device == 0x2A02) 38 dev->pci_device == 0x2A02 || \
39 dev->pci_device == 0x2A12)
40
41#define IS_G33(dev) (dev->pci_device == 0x29b2 || \
42 dev->pci_device == 0x29c2 || \
43 dev->pci_device == 0x29d2)
39 44
40/* Really want an OS-independent resettable timer. Would like to have 45/* Really want an OS-independent resettable timer. Would like to have
41 * this loop run for (eg) 3 sec, but have the timer reset every time 46 * 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)
106 I915_WRITE(0x02080, 0x1ffff000); 111 I915_WRITE(0x02080, 0x1ffff000);
107 } 112 }
108 113
114 if (dev_priv->status_gfx_addr) {
115 dev_priv->status_gfx_addr = 0;
116 drm_core_ioremapfree(&dev_priv->hws_map, dev);
117 I915_WRITE(0x2080, 0x1ffff000);
118 }
119
109 drm_free(dev->dev_private, sizeof(drm_i915_private_t), 120 drm_free(dev->dev_private, sizeof(drm_i915_private_t),
110 DRM_MEM_DRIVER); 121 DRM_MEM_DRIVER);
111 122
@@ -179,26 +190,24 @@ static int i915_initialize(drm_device_t * dev,
179 dev_priv->allow_batchbuffer = 1; 190 dev_priv->allow_batchbuffer = 1;
180 191
181 /* Program Hardware Status Page */ 192 /* Program Hardware Status Page */
182 dev_priv->status_page_dmah = drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE, 193 if (!IS_G33(dev)) {
183 0xffffffff); 194 dev_priv->status_page_dmah =
195 drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE, 0xffffffff);
196
197 if (!dev_priv->status_page_dmah) {
198 dev->dev_private = (void *)dev_priv;
199 i915_dma_cleanup(dev);
200 DRM_ERROR("Can not allocate hardware status page\n");
201 return DRM_ERR(ENOMEM);
202 }
203 dev_priv->hw_status_page = dev_priv->status_page_dmah->vaddr;
204 dev_priv->dma_status_page = dev_priv->status_page_dmah->busaddr;
184 205
185 if (!dev_priv->status_page_dmah) { 206 memset(dev_priv->hw_status_page, 0, PAGE_SIZE);
186 dev->dev_private = (void *)dev_priv; 207 I915_WRITE(0x02080, dev_priv->dma_status_page);
187 i915_dma_cleanup(dev);
188 DRM_ERROR("Can not allocate hardware status page\n");
189 return DRM_ERR(ENOMEM);
190 } 208 }
191 dev_priv->hw_status_page = dev_priv->status_page_dmah->vaddr;
192 dev_priv->dma_status_page = dev_priv->status_page_dmah->busaddr;
193
194 memset(dev_priv->hw_status_page, 0, PAGE_SIZE);
195 DRM_DEBUG("hw status page @ %p\n", dev_priv->hw_status_page);
196
197 I915_WRITE(0x02080, dev_priv->dma_status_page);
198 DRM_DEBUG("Enabled hardware status page\n"); 209 DRM_DEBUG("Enabled hardware status page\n");
199
200 dev->dev_private = (void *)dev_priv; 210 dev->dev_private = (void *)dev_priv;
201
202 return 0; 211 return 0;
203} 212}
204 213
@@ -231,7 +240,10 @@ static int i915_dma_resume(drm_device_t * dev)
231 } 240 }
232 DRM_DEBUG("hw status page @ %p\n", dev_priv->hw_status_page); 241 DRM_DEBUG("hw status page @ %p\n", dev_priv->hw_status_page);
233 242
234 I915_WRITE(0x02080, dev_priv->dma_status_page); 243 if (dev_priv->status_gfx_addr != 0)
244 I915_WRITE(0x02080, dev_priv->status_gfx_addr);
245 else
246 I915_WRITE(0x02080, dev_priv->dma_status_page);
235 DRM_DEBUG("Enabled hardware status page\n"); 247 DRM_DEBUG("Enabled hardware status page\n");
236 248
237 return 0; 249 return 0;
@@ -739,6 +751,47 @@ static int i915_setparam(DRM_IOCTL_ARGS)
739 return 0; 751 return 0;
740} 752}
741 753
754static int i915_set_status_page(DRM_IOCTL_ARGS)
755{
756 DRM_DEVICE;
757 drm_i915_private_t *dev_priv = dev->dev_private;
758 drm_i915_hws_addr_t hws;
759
760 if (!dev_priv) {
761 DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
762 return DRM_ERR(EINVAL);
763 }
764 DRM_COPY_FROM_USER_IOCTL(hws, (drm_i915_hws_addr_t __user *) data,
765 sizeof(hws));
766 printk(KERN_DEBUG "set status page addr 0x%08x\n", (u32)hws.addr);
767
768 dev_priv->status_gfx_addr = hws.addr & (0x1ffff<<12);
769
770 dev_priv->hws_map.offset = dev->agp->agp_info.aper_base + hws.addr;
771 dev_priv->hws_map.size = 4*1024;
772 dev_priv->hws_map.type = 0;
773 dev_priv->hws_map.flags = 0;
774 dev_priv->hws_map.mtrr = 0;
775
776 drm_core_ioremap(&dev_priv->hws_map, dev);
777 if (dev_priv->hws_map.handle == NULL) {
778 dev->dev_private = (void *)dev_priv;
779 i915_dma_cleanup(dev);
780 dev_priv->status_gfx_addr = 0;
781 DRM_ERROR("can not ioremap virtual address for"
782 " G33 hw status page\n");
783 return DRM_ERR(ENOMEM);
784 }
785 dev_priv->hw_status_page = dev_priv->hws_map.handle;
786
787 memset(dev_priv->hw_status_page, 0, PAGE_SIZE);
788 I915_WRITE(0x02080, dev_priv->status_gfx_addr);
789 DRM_DEBUG("load hws 0x2080 with gfx mem 0x%x\n",
790 dev_priv->status_gfx_addr);
791 DRM_DEBUG("load hws at %p\n", dev_priv->hw_status_page);
792 return 0;
793}
794
742int i915_driver_load(drm_device_t *dev, unsigned long flags) 795int i915_driver_load(drm_device_t *dev, unsigned long flags)
743{ 796{
744 /* i915 has 4 more counters */ 797 /* i915 has 4 more counters */
@@ -785,6 +838,7 @@ drm_ioctl_desc_t i915_ioctls[] = {
785 [DRM_IOCTL_NR(DRM_I915_SET_VBLANK_PIPE)] = { i915_vblank_pipe_set, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY }, 838 [DRM_IOCTL_NR(DRM_I915_SET_VBLANK_PIPE)] = { i915_vblank_pipe_set, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY },
786 [DRM_IOCTL_NR(DRM_I915_GET_VBLANK_PIPE)] = { i915_vblank_pipe_get, DRM_AUTH }, 839 [DRM_IOCTL_NR(DRM_I915_GET_VBLANK_PIPE)] = { i915_vblank_pipe_get, DRM_AUTH },
787 [DRM_IOCTL_NR(DRM_I915_VBLANK_SWAP)] = {i915_vblank_swap, DRM_AUTH}, 840 [DRM_IOCTL_NR(DRM_I915_VBLANK_SWAP)] = {i915_vblank_swap, DRM_AUTH},
841 [DRM_IOCTL_NR(DRM_I915_HWS_ADDR)] = {i915_set_status_page, DRM_AUTH},
788}; 842};
789 843
790int i915_max_ioctl = DRM_ARRAY_SIZE(i915_ioctls); 844int i915_max_ioctl = DRM_ARRAY_SIZE(i915_ioctls);
diff --git a/drivers/char/drm/i915_drm.h b/drivers/char/drm/i915_drm.h
index 96a468886a7a..7b7b68b96f31 100644
--- a/drivers/char/drm/i915_drm.h
+++ b/drivers/char/drm/i915_drm.h
@@ -142,6 +142,7 @@ typedef struct _drm_i915_sarea {
142#define DRM_I915_SET_VBLANK_PIPE 0x0d 142#define DRM_I915_SET_VBLANK_PIPE 0x0d
143#define DRM_I915_GET_VBLANK_PIPE 0x0e 143#define DRM_I915_GET_VBLANK_PIPE 0x0e
144#define DRM_I915_VBLANK_SWAP 0x0f 144#define DRM_I915_VBLANK_SWAP 0x0f
145#define DRM_I915_HWS_ADDR 0x11
145 146
146#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) 147#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
147#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) 148#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
@@ -262,4 +263,8 @@ typedef struct drm_i915_vblank_swap {
262 unsigned int sequence; 263 unsigned int sequence;
263} drm_i915_vblank_swap_t; 264} drm_i915_vblank_swap_t;
264 265
266typedef struct drm_i915_hws_addr {
267 uint64_t addr;
268} drm_i915_hws_addr_t;
269
265#endif /* _I915_DRM_H_ */ 270#endif /* _I915_DRM_H_ */
diff --git a/drivers/char/drm/i915_drv.h b/drivers/char/drm/i915_drv.h
index 93cdcfe6aa84..85e323acb95d 100644
--- a/drivers/char/drm/i915_drv.h
+++ b/drivers/char/drm/i915_drv.h
@@ -91,6 +91,8 @@ typedef struct drm_i915_private {
91 void *hw_status_page; 91 void *hw_status_page;
92 dma_addr_t dma_status_page; 92 dma_addr_t dma_status_page;
93 unsigned long counter; 93 unsigned long counter;
94 unsigned int status_gfx_addr;
95 drm_local_map_t hws_map;
94 96
95 unsigned int cpp; 97 unsigned int cpp;
96 int back_offset; 98 int back_offset;
diff --git a/drivers/char/drm/radeon_ioc32.c b/drivers/char/drm/radeon_ioc32.c
index 1f1f9cc055a4..56decda2a71f 100644
--- a/drivers/char/drm/radeon_ioc32.c
+++ b/drivers/char/drm/radeon_ioc32.c
@@ -349,6 +349,36 @@ static int compat_radeon_irq_emit(struct file *file, unsigned int cmd,
349 DRM_IOCTL_RADEON_IRQ_EMIT, (unsigned long)request); 349 DRM_IOCTL_RADEON_IRQ_EMIT, (unsigned long)request);
350} 350}
351 351
352/* The two 64-bit arches where alignof(u64)==4 in 32-bit code */
353#if defined (CONFIG_X86_64) || defined(CONFIG_IA64)
354typedef struct drm_radeon_setparam32 {
355 int param;
356 u64 value;
357} __attribute__((packed)) drm_radeon_setparam32_t;
358
359static int compat_radeon_cp_setparam(struct file *file, unsigned int cmd,
360 unsigned long arg)
361{
362 drm_radeon_setparam32_t req32;
363 drm_radeon_setparam_t __user *request;
364
365 if (copy_from_user(&req32, (void __user *) arg, sizeof(req32)))
366 return -EFAULT;
367
368 request = compat_alloc_user_space(sizeof(*request));
369 if (!access_ok(VERIFY_WRITE, request, sizeof(*request))
370 || __put_user(req32.param, &request->param)
371 || __put_user((void __user *)(unsigned long)req32.value,
372 &request->value))
373 return -EFAULT;
374
375 return drm_ioctl(file->f_dentry->d_inode, file,
376 DRM_IOCTL_RADEON_SETPARAM, (unsigned long) request);
377}
378#else
379#define compat_radeon_cp_setparam NULL
380#endif /* X86_64 || IA64 */
381
352drm_ioctl_compat_t *radeon_compat_ioctls[] = { 382drm_ioctl_compat_t *radeon_compat_ioctls[] = {
353 [DRM_RADEON_CP_INIT] = compat_radeon_cp_init, 383 [DRM_RADEON_CP_INIT] = compat_radeon_cp_init,
354 [DRM_RADEON_CLEAR] = compat_radeon_cp_clear, 384 [DRM_RADEON_CLEAR] = compat_radeon_cp_clear,
@@ -357,6 +387,7 @@ drm_ioctl_compat_t *radeon_compat_ioctls[] = {
357 [DRM_RADEON_VERTEX2] = compat_radeon_cp_vertex2, 387 [DRM_RADEON_VERTEX2] = compat_radeon_cp_vertex2,
358 [DRM_RADEON_CMDBUF] = compat_radeon_cp_cmdbuf, 388 [DRM_RADEON_CMDBUF] = compat_radeon_cp_cmdbuf,
359 [DRM_RADEON_GETPARAM] = compat_radeon_cp_getparam, 389 [DRM_RADEON_GETPARAM] = compat_radeon_cp_getparam,
390 [DRM_RADEON_SETPARAM] = compat_radeon_cp_setparam,
360 [DRM_RADEON_ALLOC] = compat_radeon_mem_alloc, 391 [DRM_RADEON_ALLOC] = compat_radeon_mem_alloc,
361 [DRM_RADEON_IRQ_EMIT] = compat_radeon_irq_emit, 392 [DRM_RADEON_IRQ_EMIT] = compat_radeon_irq_emit,
362}; 393};
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 0474cac4a84e..7f5271272f91 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -794,7 +794,7 @@ static void extract_buf(struct entropy_store *r, __u8 *out)
794 794
795 buf[0] ^= buf[3]; 795 buf[0] ^= buf[3];
796 buf[1] ^= buf[4]; 796 buf[1] ^= buf[4];
797 buf[0] ^= rol32(buf[3], 16); 797 buf[2] ^= rol32(buf[2], 16);
798 memcpy(out, buf, EXTRACT_SIZE); 798 memcpy(out, buf, EXTRACT_SIZE);
799 memset(buf, 0, sizeof(buf)); 799 memset(buf, 0, sizeof(buf));
800} 800}
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 3752edc30c36..a96f26a63fa2 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -1173,8 +1173,14 @@ static unsigned int hung_up_tty_poll(struct file * filp, poll_table * wait)
1173 return POLLIN | POLLOUT | POLLERR | POLLHUP | POLLRDNORM | POLLWRNORM; 1173 return POLLIN | POLLOUT | POLLERR | POLLHUP | POLLRDNORM | POLLWRNORM;
1174} 1174}
1175 1175
1176static long hung_up_tty_ioctl(struct file * file, 1176static int hung_up_tty_ioctl(struct inode * inode, struct file * file,
1177 unsigned int cmd, unsigned long arg) 1177 unsigned int cmd, unsigned long arg)
1178{
1179 return cmd == TIOCSPGRP ? -ENOTTY : -EIO;
1180}
1181
1182static long hung_up_tty_compat_ioctl(struct file * file,
1183 unsigned int cmd, unsigned long arg)
1178{ 1184{
1179 return cmd == TIOCSPGRP ? -ENOTTY : -EIO; 1185 return cmd == TIOCSPGRP ? -ENOTTY : -EIO;
1180} 1186}
@@ -1222,8 +1228,8 @@ static const struct file_operations hung_up_tty_fops = {
1222 .read = hung_up_tty_read, 1228 .read = hung_up_tty_read,
1223 .write = hung_up_tty_write, 1229 .write = hung_up_tty_write,
1224 .poll = hung_up_tty_poll, 1230 .poll = hung_up_tty_poll,
1225 .unlocked_ioctl = hung_up_tty_ioctl, 1231 .ioctl = hung_up_tty_ioctl,
1226 .compat_ioctl = hung_up_tty_ioctl, 1232 .compat_ioctl = hung_up_tty_compat_ioctl,
1227 .release = tty_release, 1233 .release = tty_release,
1228}; 1234};
1229 1235
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 0af0d1614f75..0cd76bf66833 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -1010,7 +1010,6 @@ static int generic_ide_resume(struct device *dev)
1010{ 1010{
1011 ide_drive_t *drive = dev->driver_data; 1011 ide_drive_t *drive = dev->driver_data;
1012 ide_hwif_t *hwif = HWIF(drive); 1012 ide_hwif_t *hwif = HWIF(drive);
1013 ide_driver_t *drv = to_ide_driver(dev->driver);
1014 struct request rq; 1013 struct request rq;
1015 struct request_pm_state rqpm; 1014 struct request_pm_state rqpm;
1016 ide_task_t args; 1015 ide_task_t args;
@@ -1033,8 +1032,12 @@ static int generic_ide_resume(struct device *dev)
1033 1032
1034 err = ide_do_drive_cmd(drive, &rq, ide_head_wait); 1033 err = ide_do_drive_cmd(drive, &rq, ide_head_wait);
1035 1034
1036 if (err == 0 && drv && drv->resume) 1035 if (err == 0 && dev->driver) {
1037 drv->resume(drive); 1036 ide_driver_t *drv = to_ide_driver(dev->driver);
1037
1038 if (drv->resume)
1039 drv->resume(drive);
1040 }
1038 1041
1039 return err; 1042 return err;
1040} 1043}
diff --git a/drivers/input/Kconfig b/drivers/input/Kconfig
index f814fb3a469d..2d87357e2b2b 100644
--- a/drivers/input/Kconfig
+++ b/drivers/input/Kconfig
@@ -39,6 +39,19 @@ config INPUT_FF_MEMLESS
39 To compile this driver as a module, choose M here: the 39 To compile this driver as a module, choose M here: the
40 module will be called ff-memless. 40 module will be called ff-memless.
41 41
42config INPUT_POLLDEV
43 tristate "Polled input device skeleton"
44 help
45 Say Y here if you are using a driver for an input
46 device that periodically polls hardware state. This
47 option is only useful for out-of-tree drivers since
48 in-tree drivers select it automatically.
49
50 If unsure, say N.
51
52 To compile this driver as a module, choose M here: the
53 module will be called input-polldev.
54
42comment "Userland interfaces" 55comment "Userland interfaces"
43 56
44config INPUT_MOUSEDEV 57config INPUT_MOUSEDEV
diff --git a/drivers/input/Makefile b/drivers/input/Makefile
index 8a2dd987546c..15eb752697b3 100644
--- a/drivers/input/Makefile
+++ b/drivers/input/Makefile
@@ -8,6 +8,7 @@ obj-$(CONFIG_INPUT) += input-core.o
8input-core-objs := input.o ff-core.o 8input-core-objs := input.o ff-core.o
9 9
10obj-$(CONFIG_INPUT_FF_MEMLESS) += ff-memless.o 10obj-$(CONFIG_INPUT_FF_MEMLESS) += ff-memless.o
11obj-$(CONFIG_INPUT_POLLDEV) += input-polldev.o
11 12
12obj-$(CONFIG_INPUT_MOUSEDEV) += mousedev.o 13obj-$(CONFIG_INPUT_MOUSEDEV) += mousedev.o
13obj-$(CONFIG_INPUT_JOYDEV) += joydev.o 14obj-$(CONFIG_INPUT_JOYDEV) += joydev.o
diff --git a/drivers/input/misc/input-polldev.c b/drivers/input/input-polldev.c
index b773d4c756a6..b773d4c756a6 100644
--- a/drivers/input/misc/input-polldev.c
+++ b/drivers/input/input-polldev.c
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index bd707b86c114..c97d5eb0075d 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -164,6 +164,9 @@ config KEYBOARD_AMIGA
164 To compile this driver as a module, choose M here: the 164 To compile this driver as a module, choose M here: the
165 module will be called amikbd. 165 module will be called amikbd.
166 166
167config ATARI_KBD_CORE
168 bool
169
167config KEYBOARD_ATARI 170config KEYBOARD_ATARI
168 tristate "Atari keyboard" 171 tristate "Atari keyboard"
169 depends on ATARI 172 depends on ATARI
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 842a7b4d16f8..88e29074ac90 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -170,17 +170,6 @@ config INPUT_UINPUT
170 To compile this driver as a module, choose M here: the 170 To compile this driver as a module, choose M here: the
171 module will be called uinput. 171 module will be called uinput.
172 172
173config INPUT_POLLDEV
174 tristate "Polled input device skeleton"
175 help
176 Say Y here if you are using a driver for an input
177 device that periodically polls hardware state. This
178 option is only useful for out-of-tree drivers since
179 in-tree drivers select it automatically.
180
181 To compile this driver as a module, choose M here: the
182 module will be called input-polldev.
183
184config HP_SDC_RTC 173config HP_SDC_RTC
185 tristate "HP SDC Real Time Clock" 174 tristate "HP SDC Real Time Clock"
186 depends on GSC || HP300 175 depends on GSC || HP300
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index 8b2f7799e25c..3585b5038418 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -4,7 +4,6 @@
4 4
5# Each configuration option enables a list of files. 5# Each configuration option enables a list of files.
6 6
7obj-$(CONFIG_INPUT_POLLDEV) += input-polldev.o
8obj-$(CONFIG_INPUT_SPARCSPKR) += sparcspkr.o 7obj-$(CONFIG_INPUT_SPARCSPKR) += sparcspkr.o
9obj-$(CONFIG_INPUT_PCSPKR) += pcspkr.o 8obj-$(CONFIG_INPUT_PCSPKR) += pcspkr.o
10obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o 9obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
index 6858bc58f0fd..f4a2517925e4 100644
--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-x86ia64io.h
@@ -69,6 +69,15 @@ static inline void i8042_write_command(int val)
69 69
70static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = { 70static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = {
71 { 71 {
72 /* AUX LOOP command does not raise AUX IRQ */
73 .ident = "ASUS P65UP5",
74 .matches = {
75 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
76 DMI_MATCH(DMI_BOARD_NAME, "P/I-P65UP5"),
77 DMI_MATCH(DMI_BOARD_VERSION, "REV 2.X"),
78 },
79 },
80 {
72 .ident = "Compaq Proliant 8500", 81 .ident = "Compaq Proliant 8500",
73 .matches = { 82 .matches = {
74 DMI_MATCH(DMI_SYS_VENDOR, "Compaq"), 83 DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
@@ -92,6 +101,15 @@ static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = {
92 DMI_MATCH(DMI_PRODUCT_VERSION, "00"), 101 DMI_MATCH(DMI_PRODUCT_VERSION, "00"),
93 }, 102 },
94 }, 103 },
104 {
105 /* AUX LOOP does not work properly */
106 .ident = "ULI EV4873",
107 .matches = {
108 DMI_MATCH(DMI_SYS_VENDOR, "ULI"),
109 DMI_MATCH(DMI_PRODUCT_NAME, "EV4873"),
110 DMI_MATCH(DMI_PRODUCT_VERSION, "5a"),
111 },
112 },
95 { } 113 { }
96}; 114};
97 115
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c
index 8e18e6c64777..e3f22852bd09 100644
--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -91,7 +91,7 @@ struct usbtouch_usb {
91}; 91};
92 92
93 93
94#if defined(CONFIG_USB_TOUCHSCREEN_EGALAX) || defined(CONFIG_USB_TOUCHSCREEN_ETURBO) 94#if defined(CONFIG_TOUCHSCREEN_USB_EGALAX) || defined(CONFIG_TOUCHSCREEN_USB_ETURBO)
95#define MULTI_PACKET 95#define MULTI_PACKET
96#endif 96#endif
97 97
@@ -113,7 +113,7 @@ enum {
113}; 113};
114 114
115static struct usb_device_id usbtouch_devices[] = { 115static struct usb_device_id usbtouch_devices[] = {
116#ifdef CONFIG_USB_TOUCHSCREEN_EGALAX 116#ifdef CONFIG_TOUCHSCREEN_USB_EGALAX
117 {USB_DEVICE(0x3823, 0x0001), .driver_info = DEVTYPE_EGALAX}, 117 {USB_DEVICE(0x3823, 0x0001), .driver_info = DEVTYPE_EGALAX},
118 {USB_DEVICE(0x3823, 0x0002), .driver_info = DEVTYPE_EGALAX}, 118 {USB_DEVICE(0x3823, 0x0002), .driver_info = DEVTYPE_EGALAX},
119 {USB_DEVICE(0x0123, 0x0001), .driver_info = DEVTYPE_EGALAX}, 119 {USB_DEVICE(0x0123, 0x0001), .driver_info = DEVTYPE_EGALAX},
@@ -123,30 +123,30 @@ static struct usb_device_id usbtouch_devices[] = {
123 {USB_DEVICE(0x1234, 0x0002), .driver_info = DEVTYPE_EGALAX}, 123 {USB_DEVICE(0x1234, 0x0002), .driver_info = DEVTYPE_EGALAX},
124#endif 124#endif
125 125
126#ifdef CONFIG_USB_TOUCHSCREEN_PANJIT 126#ifdef CONFIG_TOUCHSCREEN_USB_PANJIT
127 {USB_DEVICE(0x134c, 0x0001), .driver_info = DEVTYPE_PANJIT}, 127 {USB_DEVICE(0x134c, 0x0001), .driver_info = DEVTYPE_PANJIT},
128 {USB_DEVICE(0x134c, 0x0002), .driver_info = DEVTYPE_PANJIT}, 128 {USB_DEVICE(0x134c, 0x0002), .driver_info = DEVTYPE_PANJIT},
129 {USB_DEVICE(0x134c, 0x0003), .driver_info = DEVTYPE_PANJIT}, 129 {USB_DEVICE(0x134c, 0x0003), .driver_info = DEVTYPE_PANJIT},
130 {USB_DEVICE(0x134c, 0x0004), .driver_info = DEVTYPE_PANJIT}, 130 {USB_DEVICE(0x134c, 0x0004), .driver_info = DEVTYPE_PANJIT},
131#endif 131#endif
132 132
133#ifdef CONFIG_USB_TOUCHSCREEN_3M 133#ifdef CONFIG_TOUCHSCREEN_USB_3M
134 {USB_DEVICE(0x0596, 0x0001), .driver_info = DEVTYPE_3M}, 134 {USB_DEVICE(0x0596, 0x0001), .driver_info = DEVTYPE_3M},
135#endif 135#endif
136 136
137#ifdef CONFIG_USB_TOUCHSCREEN_ITM 137#ifdef CONFIG_TOUCHSCREEN_USB_ITM
138 {USB_DEVICE(0x0403, 0xf9e9), .driver_info = DEVTYPE_ITM}, 138 {USB_DEVICE(0x0403, 0xf9e9), .driver_info = DEVTYPE_ITM},
139#endif 139#endif
140 140
141#ifdef CONFIG_USB_TOUCHSCREEN_ETURBO 141#ifdef CONFIG_TOUCHSCREEN_USB_ETURBO
142 {USB_DEVICE(0x1234, 0x5678), .driver_info = DEVTYPE_ETURBO}, 142 {USB_DEVICE(0x1234, 0x5678), .driver_info = DEVTYPE_ETURBO},
143#endif 143#endif
144 144
145#ifdef CONFIG_USB_TOUCHSCREEN_GUNZE 145#ifdef CONFIG_TOUCHSCREEN_USB_GUNZE
146 {USB_DEVICE(0x0637, 0x0001), .driver_info = DEVTYPE_GUNZE}, 146 {USB_DEVICE(0x0637, 0x0001), .driver_info = DEVTYPE_GUNZE},
147#endif 147#endif
148 148
149#ifdef CONFIG_USB_TOUCHSCREEN_DMC_TSC10 149#ifdef CONFIG_TOUCHSCREEN_USB_DMC_TSC10
150 {USB_DEVICE(0x0afa, 0x03e8), .driver_info = DEVTYPE_DMC_TSC10}, 150 {USB_DEVICE(0x0afa, 0x03e8), .driver_info = DEVTYPE_DMC_TSC10},
151#endif 151#endif
152 152
@@ -158,7 +158,7 @@ static struct usb_device_id usbtouch_devices[] = {
158 * eGalax part 158 * eGalax part
159 */ 159 */
160 160
161#ifdef CONFIG_USB_TOUCHSCREEN_EGALAX 161#ifdef CONFIG_TOUCHSCREEN_USB_EGALAX
162 162
163#define EGALAX_PKT_TYPE_MASK 0xFE 163#define EGALAX_PKT_TYPE_MASK 0xFE
164#define EGALAX_PKT_TYPE_REPT 0x80 164#define EGALAX_PKT_TYPE_REPT 0x80
@@ -197,7 +197,7 @@ static int egalax_get_pkt_len(unsigned char *buf, int len)
197/***************************************************************************** 197/*****************************************************************************
198 * PanJit Part 198 * PanJit Part
199 */ 199 */
200#ifdef CONFIG_USB_TOUCHSCREEN_PANJIT 200#ifdef CONFIG_TOUCHSCREEN_USB_PANJIT
201static int panjit_read_data(struct usbtouch_usb *dev, unsigned char *pkt) 201static int panjit_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
202{ 202{
203 dev->x = ((pkt[2] & 0x0F) << 8) | pkt[1]; 203 dev->x = ((pkt[2] & 0x0F) << 8) | pkt[1];
@@ -212,7 +212,7 @@ static int panjit_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
212/***************************************************************************** 212/*****************************************************************************
213 * 3M/Microtouch Part 213 * 3M/Microtouch Part
214 */ 214 */
215#ifdef CONFIG_USB_TOUCHSCREEN_3M 215#ifdef CONFIG_TOUCHSCREEN_USB_3M
216 216
217#define MTOUCHUSB_ASYNC_REPORT 1 217#define MTOUCHUSB_ASYNC_REPORT 1
218#define MTOUCHUSB_RESET 7 218#define MTOUCHUSB_RESET 7
@@ -262,7 +262,7 @@ static int mtouch_init(struct usbtouch_usb *usbtouch)
262/***************************************************************************** 262/*****************************************************************************
263 * ITM Part 263 * ITM Part
264 */ 264 */
265#ifdef CONFIG_USB_TOUCHSCREEN_ITM 265#ifdef CONFIG_TOUCHSCREEN_USB_ITM
266static int itm_read_data(struct usbtouch_usb *dev, unsigned char *pkt) 266static int itm_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
267{ 267{
268 int touch; 268 int touch;
@@ -296,7 +296,7 @@ static int itm_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
296/***************************************************************************** 296/*****************************************************************************
297 * eTurboTouch part 297 * eTurboTouch part
298 */ 298 */
299#ifdef CONFIG_USB_TOUCHSCREEN_ETURBO 299#ifdef CONFIG_TOUCHSCREEN_USB_ETURBO
300static int eturbo_read_data(struct usbtouch_usb *dev, unsigned char *pkt) 300static int eturbo_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
301{ 301{
302 unsigned int shift; 302 unsigned int shift;
@@ -327,7 +327,7 @@ static int eturbo_get_pkt_len(unsigned char *buf, int len)
327/***************************************************************************** 327/*****************************************************************************
328 * Gunze part 328 * Gunze part
329 */ 329 */
330#ifdef CONFIG_USB_TOUCHSCREEN_GUNZE 330#ifdef CONFIG_TOUCHSCREEN_USB_GUNZE
331static int gunze_read_data(struct usbtouch_usb *dev, unsigned char *pkt) 331static int gunze_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
332{ 332{
333 if (!(pkt[0] & 0x80) || ((pkt[1] | pkt[2] | pkt[3]) & 0x80)) 333 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)
348 * http://www.dmccoltd.com/files/controler/tsc10usb_pi_e.pdf 348 * http://www.dmccoltd.com/files/controler/tsc10usb_pi_e.pdf
349 * http://www.dmccoltd.com/files/controler/tsc25_usb_e.pdf 349 * http://www.dmccoltd.com/files/controler/tsc25_usb_e.pdf
350 */ 350 */
351#ifdef CONFIG_USB_TOUCHSCREEN_DMC_TSC10 351#ifdef CONFIG_TOUCHSCREEN_USB_DMC_TSC10
352 352
353/* supported data rates. currently using 130 */ 353/* supported data rates. currently using 130 */
354#define TSC10_RATE_POINT 0x50 354#define TSC10_RATE_POINT 0x50
@@ -419,7 +419,7 @@ static int dmc_tsc10_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
419 * the different device descriptors 419 * the different device descriptors
420 */ 420 */
421static struct usbtouch_device_info usbtouch_dev_info[] = { 421static struct usbtouch_device_info usbtouch_dev_info[] = {
422#ifdef CONFIG_USB_TOUCHSCREEN_EGALAX 422#ifdef CONFIG_TOUCHSCREEN_USB_EGALAX
423 [DEVTYPE_EGALAX] = { 423 [DEVTYPE_EGALAX] = {
424 .min_xc = 0x0, 424 .min_xc = 0x0,
425 .max_xc = 0x07ff, 425 .max_xc = 0x07ff,
@@ -433,7 +433,7 @@ static struct usbtouch_device_info usbtouch_dev_info[] = {
433 }, 433 },
434#endif 434#endif
435 435
436#ifdef CONFIG_USB_TOUCHSCREEN_PANJIT 436#ifdef CONFIG_TOUCHSCREEN_USB_PANJIT
437 [DEVTYPE_PANJIT] = { 437 [DEVTYPE_PANJIT] = {
438 .min_xc = 0x0, 438 .min_xc = 0x0,
439 .max_xc = 0x0fff, 439 .max_xc = 0x0fff,
@@ -444,7 +444,7 @@ static struct usbtouch_device_info usbtouch_dev_info[] = {
444 }, 444 },
445#endif 445#endif
446 446
447#ifdef CONFIG_USB_TOUCHSCREEN_3M 447#ifdef CONFIG_TOUCHSCREEN_USB_3M
448 [DEVTYPE_3M] = { 448 [DEVTYPE_3M] = {
449 .min_xc = 0x0, 449 .min_xc = 0x0,
450 .max_xc = 0x4000, 450 .max_xc = 0x4000,
@@ -456,7 +456,7 @@ static struct usbtouch_device_info usbtouch_dev_info[] = {
456 }, 456 },
457#endif 457#endif
458 458
459#ifdef CONFIG_USB_TOUCHSCREEN_ITM 459#ifdef CONFIG_TOUCHSCREEN_USB_ITM
460 [DEVTYPE_ITM] = { 460 [DEVTYPE_ITM] = {
461 .min_xc = 0x0, 461 .min_xc = 0x0,
462 .max_xc = 0x0fff, 462 .max_xc = 0x0fff,
@@ -468,7 +468,7 @@ static struct usbtouch_device_info usbtouch_dev_info[] = {
468 }, 468 },
469#endif 469#endif
470 470
471#ifdef CONFIG_USB_TOUCHSCREEN_ETURBO 471#ifdef CONFIG_TOUCHSCREEN_USB_ETURBO
472 [DEVTYPE_ETURBO] = { 472 [DEVTYPE_ETURBO] = {
473 .min_xc = 0x0, 473 .min_xc = 0x0,
474 .max_xc = 0x07ff, 474 .max_xc = 0x07ff,
@@ -482,7 +482,7 @@ static struct usbtouch_device_info usbtouch_dev_info[] = {
482 }, 482 },
483#endif 483#endif
484 484
485#ifdef CONFIG_USB_TOUCHSCREEN_GUNZE 485#ifdef CONFIG_TOUCHSCREEN_USB_GUNZE
486 [DEVTYPE_GUNZE] = { 486 [DEVTYPE_GUNZE] = {
487 .min_xc = 0x0, 487 .min_xc = 0x0,
488 .max_xc = 0x0fff, 488 .max_xc = 0x0fff,
@@ -493,7 +493,7 @@ static struct usbtouch_device_info usbtouch_dev_info[] = {
493 }, 493 },
494#endif 494#endif
495 495
496#ifdef CONFIG_USB_TOUCHSCREEN_DMC_TSC10 496#ifdef CONFIG_TOUCHSCREEN_USB_DMC_TSC10
497 [DEVTYPE_DMC_TSC10] = { 497 [DEVTYPE_DMC_TSC10] = {
498 .min_xc = 0x0, 498 .min_xc = 0x0,
499 .max_xc = 0x03ff, 499 .max_xc = 0x03ff,
diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h
index 1c040d80c641..152312c1fafa 100644
--- a/drivers/kvm/kvm.h
+++ b/drivers/kvm/kvm.h
@@ -304,6 +304,7 @@ struct kvm_vcpu {
304 char *host_fx_image; 304 char *host_fx_image;
305 char *guest_fx_image; 305 char *guest_fx_image;
306 int fpu_active; 306 int fpu_active;
307 int guest_fpu_loaded;
307 308
308 int mmio_needed; 309 int mmio_needed;
309 int mmio_read_completed; 310 int mmio_read_completed;
@@ -508,6 +509,8 @@ void fx_init(struct kvm_vcpu *vcpu);
508void load_msrs(struct vmx_msr_entry *e, int n); 509void load_msrs(struct vmx_msr_entry *e, int n);
509void save_msrs(struct vmx_msr_entry *e, int n); 510void save_msrs(struct vmx_msr_entry *e, int n);
510void kvm_resched(struct kvm_vcpu *vcpu); 511void kvm_resched(struct kvm_vcpu *vcpu);
512void kvm_load_guest_fpu(struct kvm_vcpu *vcpu);
513void kvm_put_guest_fpu(struct kvm_vcpu *vcpu);
511 514
512int kvm_read_guest(struct kvm_vcpu *vcpu, 515int kvm_read_guest(struct kvm_vcpu *vcpu,
513 gva_t addr, 516 gva_t addr,
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index da985b31b17e..8f1f07adb04e 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -253,6 +253,28 @@ int kvm_write_guest(struct kvm_vcpu *vcpu, gva_t addr, unsigned long size,
253} 253}
254EXPORT_SYMBOL_GPL(kvm_write_guest); 254EXPORT_SYMBOL_GPL(kvm_write_guest);
255 255
256void kvm_load_guest_fpu(struct kvm_vcpu *vcpu)
257{
258 if (!vcpu->fpu_active || vcpu->guest_fpu_loaded)
259 return;
260
261 vcpu->guest_fpu_loaded = 1;
262 fx_save(vcpu->host_fx_image);
263 fx_restore(vcpu->guest_fx_image);
264}
265EXPORT_SYMBOL_GPL(kvm_load_guest_fpu);
266
267void kvm_put_guest_fpu(struct kvm_vcpu *vcpu)
268{
269 if (!vcpu->guest_fpu_loaded)
270 return;
271
272 vcpu->guest_fpu_loaded = 0;
273 fx_save(vcpu->guest_fx_image);
274 fx_restore(vcpu->host_fx_image);
275}
276EXPORT_SYMBOL_GPL(kvm_put_guest_fpu);
277
256/* 278/*
257 * Switches to specified vcpu, until a matching vcpu_put() 279 * Switches to specified vcpu, until a matching vcpu_put()
258 */ 280 */
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c
index 184238e2ece4..c1ac106ace8c 100644
--- a/drivers/kvm/vmx.c
+++ b/drivers/kvm/vmx.c
@@ -280,6 +280,7 @@ static void vmx_vcpu_load(struct kvm_vcpu *vcpu)
280 280
281static void vmx_vcpu_put(struct kvm_vcpu *vcpu) 281static void vmx_vcpu_put(struct kvm_vcpu *vcpu)
282{ 282{
283 kvm_put_guest_fpu(vcpu);
283 put_cpu(); 284 put_cpu();
284} 285}
285 286
@@ -1847,10 +1848,8 @@ again:
1847 if (vcpu->guest_debug.enabled) 1848 if (vcpu->guest_debug.enabled)
1848 kvm_guest_debug_pre(vcpu); 1849 kvm_guest_debug_pre(vcpu);
1849 1850
1850 if (vcpu->fpu_active) { 1851 kvm_load_guest_fpu(vcpu);
1851 fx_save(vcpu->host_fx_image); 1852
1852 fx_restore(vcpu->guest_fx_image);
1853 }
1854 /* 1853 /*
1855 * Loading guest fpu may have cleared host cr0.ts 1854 * Loading guest fpu may have cleared host cr0.ts
1856 */ 1855 */
@@ -2012,11 +2011,6 @@ again:
2012 } 2011 }
2013#endif 2012#endif
2014 2013
2015 if (vcpu->fpu_active) {
2016 fx_save(vcpu->guest_fx_image);
2017 fx_restore(vcpu->host_fx_image);
2018 }
2019
2020 vcpu->interrupt_window_open = (vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) & 3) == 0; 2014 vcpu->interrupt_window_open = (vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) & 3) == 0;
2021 2015
2022 asm ("mov %0, %%ds; mov %0, %%es" : : "r"(__USER_DS)); 2016 asm ("mov %0, %%ds; mov %0, %%es" : : "r"(__USER_DS));
diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig
index ee699a7d6214..0852d330c265 100644
--- a/drivers/macintosh/Kconfig
+++ b/drivers/macintosh/Kconfig
@@ -2,7 +2,7 @@
2menuconfig MACINTOSH_DRIVERS 2menuconfig MACINTOSH_DRIVERS
3 bool "Macintosh device drivers" 3 bool "Macintosh device drivers"
4 depends on PPC || MAC || X86 4 depends on PPC || MAC || X86
5 default y 5 default y if MAC
6 6
7if MACINTOSH_DRIVERS 7if MACINTOSH_DRIVERS
8 8
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 3a95cc5e029c..46677d7d9980 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1240,17 +1240,24 @@ static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio)
1240 } 1240 }
1241 r1_bio->read_disk = primary; 1241 r1_bio->read_disk = primary;
1242 for (i=0; i<mddev->raid_disks; i++) 1242 for (i=0; i<mddev->raid_disks; i++)
1243 if (r1_bio->bios[i]->bi_end_io == end_sync_read && 1243 if (r1_bio->bios[i]->bi_end_io == end_sync_read) {
1244 test_bit(BIO_UPTODATE, &r1_bio->bios[i]->bi_flags)) {
1245 int j; 1244 int j;
1246 int vcnt = r1_bio->sectors >> (PAGE_SHIFT- 9); 1245 int vcnt = r1_bio->sectors >> (PAGE_SHIFT- 9);
1247 struct bio *pbio = r1_bio->bios[primary]; 1246 struct bio *pbio = r1_bio->bios[primary];
1248 struct bio *sbio = r1_bio->bios[i]; 1247 struct bio *sbio = r1_bio->bios[i];
1249 for (j = vcnt; j-- ; ) 1248
1250 if (memcmp(page_address(pbio->bi_io_vec[j].bv_page), 1249 if (test_bit(BIO_UPTODATE, &sbio->bi_flags)) {
1251 page_address(sbio->bi_io_vec[j].bv_page), 1250 for (j = vcnt; j-- ; ) {
1252 PAGE_SIZE)) 1251 struct page *p, *s;
1253 break; 1252 p = pbio->bi_io_vec[j].bv_page;
1253 s = sbio->bi_io_vec[j].bv_page;
1254 if (memcmp(page_address(p),
1255 page_address(s),
1256 PAGE_SIZE))
1257 break;
1258 }
1259 } else
1260 j = 0;
1254 if (j >= 0) 1261 if (j >= 0)
1255 mddev->resync_mismatches += r1_bio->sectors; 1262 mddev->resync_mismatches += r1_bio->sectors;
1256 if (j < 0 || test_bit(MD_RECOVERY_CHECK, &mddev->recovery)) { 1263 if (j < 0 || test_bit(MD_RECOVERY_CHECK, &mddev->recovery)) {
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 82249a69014f..9eb66c1b523b 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -1867,6 +1867,7 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
1867 int d = r10_bio->devs[i].devnum; 1867 int d = r10_bio->devs[i].devnum;
1868 bio = r10_bio->devs[i].bio; 1868 bio = r10_bio->devs[i].bio;
1869 bio->bi_end_io = NULL; 1869 bio->bi_end_io = NULL;
1870 clear_bit(BIO_UPTODATE, &bio->bi_flags);
1870 if (conf->mirrors[d].rdev == NULL || 1871 if (conf->mirrors[d].rdev == NULL ||
1871 test_bit(Faulty, &conf->mirrors[d].rdev->flags)) 1872 test_bit(Faulty, &conf->mirrors[d].rdev->flags))
1872 continue; 1873 continue;
@@ -2037,6 +2038,11 @@ static int run(mddev_t *mddev)
2037 /* 'size' is now the number of chunks in the array */ 2038 /* 'size' is now the number of chunks in the array */
2038 /* calculate "used chunks per device" in 'stride' */ 2039 /* calculate "used chunks per device" in 'stride' */
2039 stride = size * conf->copies; 2040 stride = size * conf->copies;
2041
2042 /* We need to round up when dividing by raid_disks to
2043 * get the stride size.
2044 */
2045 stride += conf->raid_disks - 1;
2040 sector_div(stride, conf->raid_disks); 2046 sector_div(stride, conf->raid_disks);
2041 mddev->size = stride << (conf->chunk_shift-1); 2047 mddev->size = stride << (conf->chunk_shift-1);
2042 2048
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c
index d75f7ffbb02e..37bf65348372 100644
--- a/drivers/message/fusion/mptspi.c
+++ b/drivers/message/fusion/mptspi.c
@@ -727,13 +727,15 @@ static int mptspi_slave_configure(struct scsi_device *sdev)
727 struct _MPT_SCSI_HOST *hd = 727 struct _MPT_SCSI_HOST *hd =
728 (struct _MPT_SCSI_HOST *)sdev->host->hostdata; 728 (struct _MPT_SCSI_HOST *)sdev->host->hostdata;
729 VirtTarget *vtarget = scsi_target(sdev)->hostdata; 729 VirtTarget *vtarget = scsi_target(sdev)->hostdata;
730 int ret = mptscsih_slave_configure(sdev); 730 int ret;
731
732 mptspi_initTarget(hd, vtarget, sdev);
733
734 ret = mptscsih_slave_configure(sdev);
731 735
732 if (ret) 736 if (ret)
733 return ret; 737 return ret;
734 738
735 mptspi_initTarget(hd, vtarget, sdev);
736
737 ddvprintk((MYIOC_s_INFO_FMT "id=%d min_period=0x%02x" 739 ddvprintk((MYIOC_s_INFO_FMT "id=%d min_period=0x%02x"
738 " max_offset=0x%02x max_width=%d\n", hd->ioc->name, 740 " max_offset=0x%02x max_width=%d\n", hd->ioc->name,
739 sdev->id, spi_min_period(scsi_target(sdev)), 741 sdev->id, spi_min_period(scsi_target(sdev)),
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 41bfb5dfe6ff..918477c490b0 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -427,6 +427,21 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
427 mmc_set_bus_width(host, MMC_BUS_WIDTH_4); 427 mmc_set_bus_width(host, MMC_BUS_WIDTH_4);
428 } 428 }
429 429
430 /*
431 * Check if read-only switch is active.
432 */
433 if (!oldcard) {
434 if (!host->ops->get_ro) {
435 printk(KERN_WARNING "%s: host does not "
436 "support reading read-only "
437 "switch. assuming write-enable.\n",
438 mmc_hostname(host));
439 } else {
440 if (host->ops->get_ro(host))
441 mmc_card_set_readonly(card);
442 }
443 }
444
430 if (!oldcard) 445 if (!oldcard)
431 host->card = card; 446 host->card = card;
432 447
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 1914e65d4db1..b0824a38f425 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -522,28 +522,10 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id)
522 } 522 }
523 523
524 if (status & OMAP_MMC_STAT_CARD_ERR) { 524 if (status & OMAP_MMC_STAT_CARD_ERR) {
525 if (host->cmd && host->cmd->opcode == MMC_STOP_TRANSMISSION) { 525 dev_dbg(mmc_dev(host->mmc),
526 u32 response = OMAP_MMC_READ(host, RSP6) 526 "ignoring card status error (CMD%d)\n",
527 | (OMAP_MMC_READ(host, RSP7) << 16);
528 /* STOP sometimes sets must-ignore bits */
529 if (!(response & (R1_CC_ERROR
530 | R1_ILLEGAL_COMMAND
531 | R1_COM_CRC_ERROR))) {
532 end_command = 1;
533 continue;
534 }
535 }
536
537 dev_dbg(mmc_dev(host->mmc), "card status error (CMD%d)\n",
538 host->cmd->opcode); 527 host->cmd->opcode);
539 if (host->cmd) { 528 end_command = 1;
540 host->cmd->error = MMC_ERR_FAILED;
541 end_command = 1;
542 }
543 if (host->data) {
544 host->data->error = MMC_ERR_FAILED;
545 transfer_error = 1;
546 }
547 } 529 }
548 530
549 /* 531 /*
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 61696637a21e..763810c7f33a 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -285,6 +285,12 @@ enum scb_status {
285 rus_mask = 0x3C, 285 rus_mask = 0x3C,
286}; 286};
287 287
288enum ru_state {
289 RU_SUSPENDED = 0,
290 RU_RUNNING = 1,
291 RU_UNINITIALIZED = -1,
292};
293
288enum scb_stat_ack { 294enum scb_stat_ack {
289 stat_ack_not_ours = 0x00, 295 stat_ack_not_ours = 0x00,
290 stat_ack_sw_gen = 0x04, 296 stat_ack_sw_gen = 0x04,
@@ -526,6 +532,7 @@ struct nic {
526 struct rx *rx_to_use; 532 struct rx *rx_to_use;
527 struct rx *rx_to_clean; 533 struct rx *rx_to_clean;
528 struct rfd blank_rfd; 534 struct rfd blank_rfd;
535 enum ru_state ru_running;
529 536
530 spinlock_t cb_lock ____cacheline_aligned; 537 spinlock_t cb_lock ____cacheline_aligned;
531 spinlock_t cmd_lock; 538 spinlock_t cmd_lock;
@@ -947,7 +954,7 @@ static void e100_get_defaults(struct nic *nic)
947 ((nic->mac >= mac_82558_D101_A4) ? cb_cid : cb_i)); 954 ((nic->mac >= mac_82558_D101_A4) ? cb_cid : cb_i));
948 955
949 /* Template for a freshly allocated RFD */ 956 /* Template for a freshly allocated RFD */
950 nic->blank_rfd.command = cpu_to_le16(cb_el & cb_s); 957 nic->blank_rfd.command = cpu_to_le16(cb_el);
951 nic->blank_rfd.rbd = 0xFFFFFFFF; 958 nic->blank_rfd.rbd = 0xFFFFFFFF;
952 nic->blank_rfd.size = cpu_to_le16(VLAN_ETH_FRAME_LEN); 959 nic->blank_rfd.size = cpu_to_le16(VLAN_ETH_FRAME_LEN);
953 960
@@ -1742,11 +1749,19 @@ static int e100_alloc_cbs(struct nic *nic)
1742 return 0; 1749 return 0;
1743} 1750}
1744 1751
1745static inline void e100_start_receiver(struct nic *nic) 1752static inline void e100_start_receiver(struct nic *nic, struct rx *rx)
1746{ 1753{
1747 /* Start if RFA is non-NULL */ 1754 if(!nic->rxs) return;
1748 if(nic->rx_to_clean->skb) 1755 if(RU_SUSPENDED != nic->ru_running) return;
1749 e100_exec_cmd(nic, ruc_start, nic->rx_to_clean->dma_addr); 1756
1757 /* handle init time starts */
1758 if(!rx) rx = nic->rxs;
1759
1760 /* (Re)start RU if suspended or idle and RFA is non-NULL */
1761 if(rx->skb) {
1762 e100_exec_cmd(nic, ruc_start, rx->dma_addr);
1763 nic->ru_running = RU_RUNNING;
1764 }
1750} 1765}
1751 1766
1752#define RFD_BUF_LEN (sizeof(struct rfd) + VLAN_ETH_FRAME_LEN) 1767#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)
1775 put_unaligned(cpu_to_le32(rx->dma_addr), 1790 put_unaligned(cpu_to_le32(rx->dma_addr),
1776 (u32 *)&prev_rfd->link); 1791 (u32 *)&prev_rfd->link);
1777 wmb(); 1792 wmb();
1778 prev_rfd->command &= ~cpu_to_le16(cb_el & cb_s); 1793 prev_rfd->command &= ~cpu_to_le16(cb_el);
1779 pci_dma_sync_single_for_device(nic->pdev, rx->prev->dma_addr, 1794 pci_dma_sync_single_for_device(nic->pdev, rx->prev->dma_addr,
1780 sizeof(struct rfd), PCI_DMA_TODEVICE); 1795 sizeof(struct rfd), PCI_DMA_TODEVICE);
1781 } 1796 }
@@ -1813,6 +1828,10 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
1813 pci_unmap_single(nic->pdev, rx->dma_addr, 1828 pci_unmap_single(nic->pdev, rx->dma_addr,
1814 RFD_BUF_LEN, PCI_DMA_FROMDEVICE); 1829 RFD_BUF_LEN, PCI_DMA_FROMDEVICE);
1815 1830
1831 /* this allows for a fast restart without re-enabling interrupts */
1832 if(le16_to_cpu(rfd->command) & cb_el)
1833 nic->ru_running = RU_SUSPENDED;
1834
1816 /* Pull off the RFD and put the actual data (minus eth hdr) */ 1835 /* Pull off the RFD and put the actual data (minus eth hdr) */
1817 skb_reserve(skb, sizeof(struct rfd)); 1836 skb_reserve(skb, sizeof(struct rfd));
1818 skb_put(skb, actual_size); 1837 skb_put(skb, actual_size);
@@ -1843,18 +1862,45 @@ static void e100_rx_clean(struct nic *nic, unsigned int *work_done,
1843 unsigned int work_to_do) 1862 unsigned int work_to_do)
1844{ 1863{
1845 struct rx *rx; 1864 struct rx *rx;
1865 int restart_required = 0;
1866 struct rx *rx_to_start = NULL;
1867
1868 /* are we already rnr? then pay attention!!! this ensures that
1869 * the state machine progression never allows a start with a
1870 * partially cleaned list, avoiding a race between hardware
1871 * and rx_to_clean when in NAPI mode */
1872 if(RU_SUSPENDED == nic->ru_running)
1873 restart_required = 1;
1846 1874
1847 /* Indicate newly arrived packets */ 1875 /* Indicate newly arrived packets */
1848 for(rx = nic->rx_to_clean; rx->skb; rx = nic->rx_to_clean = rx->next) { 1876 for(rx = nic->rx_to_clean; rx->skb; rx = nic->rx_to_clean = rx->next) {
1849 if(e100_rx_indicate(nic, rx, work_done, work_to_do)) 1877 int err = e100_rx_indicate(nic, rx, work_done, work_to_do);
1878 if(-EAGAIN == err) {
1879 /* hit quota so have more work to do, restart once
1880 * cleanup is complete */
1881 restart_required = 0;
1882 break;
1883 } else if(-ENODATA == err)
1850 break; /* No more to clean */ 1884 break; /* No more to clean */
1851 } 1885 }
1852 1886
1887 /* save our starting point as the place we'll restart the receiver */
1888 if(restart_required)
1889 rx_to_start = nic->rx_to_clean;
1890
1853 /* Alloc new skbs to refill list */ 1891 /* Alloc new skbs to refill list */
1854 for(rx = nic->rx_to_use; !rx->skb; rx = nic->rx_to_use = rx->next) { 1892 for(rx = nic->rx_to_use; !rx->skb; rx = nic->rx_to_use = rx->next) {
1855 if(unlikely(e100_rx_alloc_skb(nic, rx))) 1893 if(unlikely(e100_rx_alloc_skb(nic, rx)))
1856 break; /* Better luck next time (see watchdog) */ 1894 break; /* Better luck next time (see watchdog) */
1857 } 1895 }
1896
1897 if(restart_required) {
1898 // ack the rnr?
1899 writeb(stat_ack_rnr, &nic->csr->scb.stat_ack);
1900 e100_start_receiver(nic, rx_to_start);
1901 if(work_done)
1902 (*work_done)++;
1903 }
1858} 1904}
1859 1905
1860static void e100_rx_clean_list(struct nic *nic) 1906static void e100_rx_clean_list(struct nic *nic)
@@ -1862,6 +1908,8 @@ static void e100_rx_clean_list(struct nic *nic)
1862 struct rx *rx; 1908 struct rx *rx;
1863 unsigned int i, count = nic->params.rfds.count; 1909 unsigned int i, count = nic->params.rfds.count;
1864 1910
1911 nic->ru_running = RU_UNINITIALIZED;
1912
1865 if(nic->rxs) { 1913 if(nic->rxs) {
1866 for(rx = nic->rxs, i = 0; i < count; rx++, i++) { 1914 for(rx = nic->rxs, i = 0; i < count; rx++, i++) {
1867 if(rx->skb) { 1915 if(rx->skb) {
@@ -1883,6 +1931,7 @@ static int e100_rx_alloc_list(struct nic *nic)
1883 unsigned int i, count = nic->params.rfds.count; 1931 unsigned int i, count = nic->params.rfds.count;
1884 1932
1885 nic->rx_to_use = nic->rx_to_clean = NULL; 1933 nic->rx_to_use = nic->rx_to_clean = NULL;
1934 nic->ru_running = RU_UNINITIALIZED;
1886 1935
1887 if(!(nic->rxs = kcalloc(count, sizeof(struct rx), GFP_ATOMIC))) 1936 if(!(nic->rxs = kcalloc(count, sizeof(struct rx), GFP_ATOMIC)))
1888 return -ENOMEM; 1937 return -ENOMEM;
@@ -1897,6 +1946,7 @@ static int e100_rx_alloc_list(struct nic *nic)
1897 } 1946 }
1898 1947
1899 nic->rx_to_use = nic->rx_to_clean = nic->rxs; 1948 nic->rx_to_use = nic->rx_to_clean = nic->rxs;
1949 nic->ru_running = RU_SUSPENDED;
1900 1950
1901 return 0; 1951 return 0;
1902} 1952}
@@ -1916,6 +1966,10 @@ static irqreturn_t e100_intr(int irq, void *dev_id)
1916 /* Ack interrupt(s) */ 1966 /* Ack interrupt(s) */
1917 iowrite8(stat_ack, &nic->csr->scb.stat_ack); 1967 iowrite8(stat_ack, &nic->csr->scb.stat_ack);
1918 1968
1969 /* We hit Receive No Resource (RNR); restart RU after cleaning */
1970 if(stat_ack & stat_ack_rnr)
1971 nic->ru_running = RU_SUSPENDED;
1972
1919 if(likely(netif_rx_schedule_prep(netdev))) { 1973 if(likely(netif_rx_schedule_prep(netdev))) {
1920 e100_disable_irq(nic); 1974 e100_disable_irq(nic);
1921 __netif_rx_schedule(netdev); 1975 __netif_rx_schedule(netdev);
@@ -2007,7 +2061,7 @@ static int e100_up(struct nic *nic)
2007 if((err = e100_hw_init(nic))) 2061 if((err = e100_hw_init(nic)))
2008 goto err_clean_cbs; 2062 goto err_clean_cbs;
2009 e100_set_multicast_list(nic->netdev); 2063 e100_set_multicast_list(nic->netdev);
2010 e100_start_receiver(nic); 2064 e100_start_receiver(nic, NULL);
2011 mod_timer(&nic->watchdog, jiffies); 2065 mod_timer(&nic->watchdog, jiffies);
2012 if((err = request_irq(nic->pdev->irq, e100_intr, IRQF_SHARED, 2066 if((err = request_irq(nic->pdev->irq, e100_intr, IRQF_SHARED,
2013 nic->netdev->name, nic->netdev))) 2067 nic->netdev->name, nic->netdev)))
@@ -2088,7 +2142,7 @@ static int e100_loopback_test(struct nic *nic, enum loopback loopback_mode)
2088 mdio_write(nic->netdev, nic->mii.phy_id, MII_BMCR, 2142 mdio_write(nic->netdev, nic->mii.phy_id, MII_BMCR,
2089 BMCR_LOOPBACK); 2143 BMCR_LOOPBACK);
2090 2144
2091 e100_start_receiver(nic); 2145 e100_start_receiver(nic, NULL);
2092 2146
2093 if(!(skb = netdev_alloc_skb(nic->netdev, ETH_DATA_LEN))) { 2147 if(!(skb = netdev_alloc_skb(nic->netdev, ETH_DATA_LEN))) {
2094 err = -ENOMEM; 2148 err = -ENOMEM;
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index e85a933a4762..c0f81b5a30fb 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -39,7 +39,7 @@
39#include <asm/io.h> 39#include <asm/io.h>
40 40
41#define DRV_NAME "ehea" 41#define DRV_NAME "ehea"
42#define DRV_VERSION "EHEA_0061" 42#define DRV_VERSION "EHEA_0064"
43 43
44#define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \ 44#define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \
45 | NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR) 45 | NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR)
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index 152bb2016a2c..9e13433a268a 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -451,7 +451,8 @@ static struct ehea_cqe *ehea_proc_rwqes(struct net_device *dev,
451 processed_rq3++; 451 processed_rq3++;
452 } 452 }
453 453
454 if (cqe->status & EHEA_CQE_VLAN_TAG_XTRACT) 454 if ((cqe->status & EHEA_CQE_VLAN_TAG_XTRACT)
455 && port->vgrp)
455 vlan_hwaccel_receive_skb(skb, port->vgrp, 456 vlan_hwaccel_receive_skb(skb, port->vgrp,
456 cqe->vlan_tag); 457 cqe->vlan_tag);
457 else 458 else
@@ -1910,10 +1911,7 @@ static void ehea_vlan_rx_register(struct net_device *dev,
1910 goto out; 1911 goto out;
1911 } 1912 }
1912 1913
1913 if (grp) 1914 memset(cb1->vlan_filter, 0, sizeof(cb1->vlan_filter));
1914 memset(cb1->vlan_filter, 0, sizeof(cb1->vlan_filter));
1915 else
1916 memset(cb1->vlan_filter, 0xFF, sizeof(cb1->vlan_filter));
1917 1915
1918 hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id, 1916 hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id,
1919 H_PORT_CB1, H_PORT_CB1_ALL, cb1); 1917 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)
1947 } 1945 }
1948 1946
1949 index = (vid / 64); 1947 index = (vid / 64);
1950 cb1->vlan_filter[index] |= ((u64)(1 << (vid & 0x3F))); 1948 cb1->vlan_filter[index] |= ((u64)(0x8000000000000000 >> (vid & 0x3F)));
1951 1949
1952 hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id, 1950 hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id,
1953 H_PORT_CB1, H_PORT_CB1_ALL, cb1); 1951 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)
1982 } 1980 }
1983 1981
1984 index = (vid / 64); 1982 index = (vid / 64);
1985 cb1->vlan_filter[index] &= ~((u64)(1 << (vid & 0x3F))); 1983 cb1->vlan_filter[index] &= ~((u64)(0x8000000000000000 >> (vid & 0x3F)));
1986 1984
1987 hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id, 1985 hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id,
1988 H_PORT_CB1, H_PORT_CB1_ALL, cb1); 1986 H_PORT_CB1, H_PORT_CB1_ALL, cb1);
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c
index 3bec0f733f01..6ec3d500f334 100644
--- a/drivers/net/ibmveth.c
+++ b/drivers/net/ibmveth.c
@@ -915,17 +915,36 @@ static int ibmveth_change_mtu(struct net_device *dev, int new_mtu)
915{ 915{
916 struct ibmveth_adapter *adapter = dev->priv; 916 struct ibmveth_adapter *adapter = dev->priv;
917 int new_mtu_oh = new_mtu + IBMVETH_BUFF_OH; 917 int new_mtu_oh = new_mtu + IBMVETH_BUFF_OH;
918 int i; 918 int reinit = 0;
919 int i, rc;
919 920
920 if (new_mtu < IBMVETH_MAX_MTU) 921 if (new_mtu < IBMVETH_MAX_MTU)
921 return -EINVAL; 922 return -EINVAL;
922 923
924 for (i = 0; i < IbmVethNumBufferPools; i++)
925 if (new_mtu_oh < adapter->rx_buff_pool[i].buff_size)
926 break;
927
928 if (i == IbmVethNumBufferPools)
929 return -EINVAL;
930
923 /* Look for an active buffer pool that can hold the new MTU */ 931 /* Look for an active buffer pool that can hold the new MTU */
924 for(i = 0; i<IbmVethNumBufferPools; i++) { 932 for(i = 0; i<IbmVethNumBufferPools; i++) {
925 if (!adapter->rx_buff_pool[i].active) 933 if (!adapter->rx_buff_pool[i].active) {
926 continue; 934 adapter->rx_buff_pool[i].active = 1;
935 reinit = 1;
936 }
937
927 if (new_mtu_oh < adapter->rx_buff_pool[i].buff_size) { 938 if (new_mtu_oh < adapter->rx_buff_pool[i].buff_size) {
928 dev->mtu = new_mtu; 939 if (reinit && netif_running(adapter->netdev)) {
940 adapter->pool_config = 1;
941 ibmveth_close(adapter->netdev);
942 adapter->pool_config = 0;
943 dev->mtu = new_mtu;
944 if ((rc = ibmveth_open(adapter->netdev)))
945 return rc;
946 } else
947 dev->mtu = new_mtu;
929 return 0; 948 return 0;
930 } 949 }
931 } 950 }
@@ -1243,16 +1262,19 @@ const char * buf, size_t count)
1243 1262
1244 if (attr == &veth_active_attr) { 1263 if (attr == &veth_active_attr) {
1245 if (value && !pool->active) { 1264 if (value && !pool->active) {
1246 if(ibmveth_alloc_buffer_pool(pool)) { 1265 if (netif_running(netdev)) {
1247 ibmveth_error_printk("unable to alloc pool\n"); 1266 if(ibmveth_alloc_buffer_pool(pool)) {
1248 return -ENOMEM; 1267 ibmveth_error_printk("unable to alloc pool\n");
1249 } 1268 return -ENOMEM;
1250 pool->active = 1; 1269 }
1251 adapter->pool_config = 1; 1270 pool->active = 1;
1252 ibmveth_close(netdev); 1271 adapter->pool_config = 1;
1253 adapter->pool_config = 0; 1272 ibmveth_close(netdev);
1254 if ((rc = ibmveth_open(netdev))) 1273 adapter->pool_config = 0;
1255 return rc; 1274 if ((rc = ibmveth_open(netdev)))
1275 return rc;
1276 } else
1277 pool->active = 1;
1256 } else if (!value && pool->active) { 1278 } else if (!value && pool->active) {
1257 int mtu = netdev->mtu + IBMVETH_BUFF_OH; 1279 int mtu = netdev->mtu + IBMVETH_BUFF_OH;
1258 int i; 1280 int i;
@@ -1281,23 +1303,29 @@ const char * buf, size_t count)
1281 if (value <= 0 || value > IBMVETH_MAX_POOL_COUNT) 1303 if (value <= 0 || value > IBMVETH_MAX_POOL_COUNT)
1282 return -EINVAL; 1304 return -EINVAL;
1283 else { 1305 else {
1284 adapter->pool_config = 1; 1306 if (netif_running(netdev)) {
1285 ibmveth_close(netdev); 1307 adapter->pool_config = 1;
1286 adapter->pool_config = 0; 1308 ibmveth_close(netdev);
1287 pool->size = value; 1309 adapter->pool_config = 0;
1288 if ((rc = ibmveth_open(netdev))) 1310 pool->size = value;
1289 return rc; 1311 if ((rc = ibmveth_open(netdev)))
1312 return rc;
1313 } else
1314 pool->size = value;
1290 } 1315 }
1291 } else if (attr == &veth_size_attr) { 1316 } else if (attr == &veth_size_attr) {
1292 if (value <= IBMVETH_BUFF_OH || value > IBMVETH_MAX_BUF_SIZE) 1317 if (value <= IBMVETH_BUFF_OH || value > IBMVETH_MAX_BUF_SIZE)
1293 return -EINVAL; 1318 return -EINVAL;
1294 else { 1319 else {
1295 adapter->pool_config = 1; 1320 if (netif_running(netdev)) {
1296 ibmveth_close(netdev); 1321 adapter->pool_config = 1;
1297 adapter->pool_config = 0; 1322 ibmveth_close(netdev);
1298 pool->buff_size = value; 1323 adapter->pool_config = 0;
1299 if ((rc = ibmveth_open(netdev))) 1324 pool->buff_size = value;
1300 return rc; 1325 if ((rc = ibmveth_open(netdev)))
1326 return rc;
1327 } else
1328 pool->buff_size = value;
1301 } 1329 }
1302 } 1330 }
1303 1331
diff --git a/drivers/net/lasi_82596.c b/drivers/net/lasi_82596.c
index 6b49fc4bd1a1..741780e14b2c 100644
--- a/drivers/net/lasi_82596.c
+++ b/drivers/net/lasi_82596.c
@@ -83,6 +83,7 @@
83#include <linux/init.h> 83#include <linux/init.h>
84#include <linux/types.h> 84#include <linux/types.h>
85#include <linux/bitops.h> 85#include <linux/bitops.h>
86#include <linux/dma-mapping.h>
86 87
87#include <asm/io.h> 88#include <asm/io.h>
88#include <asm/pgtable.h> 89#include <asm/pgtable.h>
diff --git a/drivers/net/mipsnet.c b/drivers/net/mipsnet.c
index 638a279ec505..9853c74f6bbf 100644
--- a/drivers/net/mipsnet.c
+++ b/drivers/net/mipsnet.c
@@ -240,7 +240,7 @@ static int __init mipsnet_probe(struct device *dev)
240 * TODO: probe for these or load them from PARAM 240 * TODO: probe for these or load them from PARAM
241 */ 241 */
242 netdev->base_addr = 0x4200; 242 netdev->base_addr = 0x4200;
243 netdev->irq = MIPSCPU_INT_BASE + MIPSCPU_INT_MB0 + 243 netdev->irq = MIPS_CPU_IRQ_BASE + MIPSCPU_INT_MB0 +
244 inl(mipsnet_reg_address(netdev, interruptInfo)); 244 inl(mipsnet_reg_address(netdev, interruptInfo));
245 245
246 // Get the io region now, get irq on open() 246 // Get the io region now, get irq on open()
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index b53b7ad999bc..0f9904fe3a5a 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -71,7 +71,7 @@
71#include "myri10ge_mcp.h" 71#include "myri10ge_mcp.h"
72#include "myri10ge_mcp_gen_header.h" 72#include "myri10ge_mcp_gen_header.h"
73 73
74#define MYRI10GE_VERSION_STR "1.3.0-1.233" 74#define MYRI10GE_VERSION_STR "1.3.1-1.248"
75 75
76MODULE_DESCRIPTION("Myricom 10G driver (10GbE)"); 76MODULE_DESCRIPTION("Myricom 10G driver (10GbE)");
77MODULE_AUTHOR("Maintainer: help@myri.com"); 77MODULE_AUTHOR("Maintainer: help@myri.com");
@@ -279,6 +279,8 @@ static int myri10ge_fill_thresh = 256;
279module_param(myri10ge_fill_thresh, int, S_IRUGO | S_IWUSR); 279module_param(myri10ge_fill_thresh, int, S_IRUGO | S_IWUSR);
280MODULE_PARM_DESC(myri10ge_fill_thresh, "Number of empty rx slots allowed\n"); 280MODULE_PARM_DESC(myri10ge_fill_thresh, "Number of empty rx slots allowed\n");
281 281
282static int myri10ge_reset_recover = 1;
283
282static int myri10ge_wcfifo = 0; 284static int myri10ge_wcfifo = 0;
283module_param(myri10ge_wcfifo, int, S_IRUGO); 285module_param(myri10ge_wcfifo, int, S_IRUGO);
284MODULE_PARM_DESC(myri10ge_wcfifo, "Enable WC Fifo when WC is enabled\n"); 286MODULE_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)
1154 struct mcp_irq_data *stats = mgp->fw_stats; 1156 struct mcp_irq_data *stats = mgp->fw_stats;
1155 1157
1156 if (unlikely(stats->stats_updated)) { 1158 if (unlikely(stats->stats_updated)) {
1157 if (mgp->link_state != stats->link_up) { 1159 unsigned link_up = ntohl(stats->link_up);
1158 mgp->link_state = stats->link_up; 1160 if (mgp->link_state != link_up) {
1159 if (mgp->link_state) { 1161 mgp->link_state = link_up;
1162
1163 if (mgp->link_state == MXGEFW_LINK_UP) {
1160 if (netif_msg_link(mgp)) 1164 if (netif_msg_link(mgp))
1161 printk(KERN_INFO 1165 printk(KERN_INFO
1162 "myri10ge: %s: link up\n", 1166 "myri10ge: %s: link up\n",
@@ -1166,8 +1170,11 @@ static inline void myri10ge_check_statblock(struct myri10ge_priv *mgp)
1166 } else { 1170 } else {
1167 if (netif_msg_link(mgp)) 1171 if (netif_msg_link(mgp))
1168 printk(KERN_INFO 1172 printk(KERN_INFO
1169 "myri10ge: %s: link down\n", 1173 "myri10ge: %s: link %s\n",
1170 mgp->dev->name); 1174 mgp->dev->name,
1175 (link_up == MXGEFW_LINK_MYRINET ?
1176 "mismatch (Myrinet detected)" :
1177 "down"));
1171 netif_carrier_off(mgp->dev); 1178 netif_carrier_off(mgp->dev);
1172 mgp->link_changes++; 1179 mgp->link_changes++;
1173 } 1180 }
@@ -2730,8 +2737,14 @@ static void myri10ge_watchdog(struct work_struct *work)
2730 * For now, just report it */ 2737 * For now, just report it */
2731 reboot = myri10ge_read_reboot(mgp); 2738 reboot = myri10ge_read_reboot(mgp);
2732 printk(KERN_ERR 2739 printk(KERN_ERR
2733 "myri10ge: %s: NIC rebooted (0x%x), resetting\n", 2740 "myri10ge: %s: NIC rebooted (0x%x),%s resetting\n",
2734 mgp->dev->name, reboot); 2741 mgp->dev->name, reboot,
2742 myri10ge_reset_recover ? " " : " not");
2743 if (myri10ge_reset_recover == 0)
2744 return;
2745
2746 myri10ge_reset_recover--;
2747
2735 /* 2748 /*
2736 * A rebooted nic will come back with config space as 2749 * A rebooted nic will come back with config space as
2737 * it was after power was applied to PCIe bus. 2750 * it was after power was applied to PCIe bus.
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index ad6688eab265..91f25e0a638e 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -68,9 +68,10 @@
68#define _NETXEN_NIC_LINUX_SUBVERSION 2 68#define _NETXEN_NIC_LINUX_SUBVERSION 2
69#define NETXEN_NIC_LINUX_VERSIONID "3.4.2" 69#define NETXEN_NIC_LINUX_VERSIONID "3.4.2"
70 70
71#define NUM_FLASH_SECTORS (64) 71#define NETXEN_NUM_FLASH_SECTORS (64)
72#define FLASH_SECTOR_SIZE (64 * 1024) 72#define NETXEN_FLASH_SECTOR_SIZE (64 * 1024)
73#define FLASH_TOTAL_SIZE (NUM_FLASH_SECTORS * FLASH_SECTOR_SIZE) 73#define NETXEN_FLASH_TOTAL_SIZE (NETXEN_NUM_FLASH_SECTORS \
74 * NETXEN_FLASH_SECTOR_SIZE)
74 75
75#define PHAN_VENDOR_ID 0x4040 76#define PHAN_VENDOR_ID 0x4040
76 77
@@ -677,28 +678,28 @@ struct netxen_new_user_info {
677 678
678/* Flash memory map */ 679/* Flash memory map */
679typedef enum { 680typedef enum {
680 CRBINIT_START = 0, /* Crbinit section */ 681 NETXEN_CRBINIT_START = 0, /* Crbinit section */
681 BRDCFG_START = 0x4000, /* board config */ 682 NETXEN_BRDCFG_START = 0x4000, /* board config */
682 INITCODE_START = 0x6000, /* pegtune code */ 683 NETXEN_INITCODE_START = 0x6000, /* pegtune code */
683 BOOTLD_START = 0x10000, /* bootld */ 684 NETXEN_BOOTLD_START = 0x10000, /* bootld */
684 IMAGE_START = 0x43000, /* compressed image */ 685 NETXEN_IMAGE_START = 0x43000, /* compressed image */
685 SECONDARY_START = 0x200000, /* backup images */ 686 NETXEN_SECONDARY_START = 0x200000, /* backup images */
686 PXE_START = 0x3E0000, /* user defined region */ 687 NETXEN_PXE_START = 0x3E0000, /* user defined region */
687 USER_START = 0x3E8000, /* User defined region for new boards */ 688 NETXEN_USER_START = 0x3E8000, /* User defined region for new boards */
688 FIXED_START = 0x3F0000 /* backup of crbinit */ 689 NETXEN_FIXED_START = 0x3F0000 /* backup of crbinit */
689} netxen_flash_map_t; 690} netxen_flash_map_t;
690 691
691#define USER_START_OLD PXE_START /* for backward compatibility */ 692#define NETXEN_USER_START_OLD NETXEN_PXE_START /* for backward compatibility */
692 693
693#define FLASH_START (CRBINIT_START) 694#define NETXEN_FLASH_START (NETXEN_CRBINIT_START)
694#define INIT_SECTOR (0) 695#define NETXEN_INIT_SECTOR (0)
695#define PRIMARY_START (BOOTLD_START) 696#define NETXEN_PRIMARY_START (NETXEN_BOOTLD_START)
696#define FLASH_CRBINIT_SIZE (0x4000) 697#define NETXEN_FLASH_CRBINIT_SIZE (0x4000)
697#define FLASH_BRDCFG_SIZE (sizeof(struct netxen_board_info)) 698#define NETXEN_FLASH_BRDCFG_SIZE (sizeof(struct netxen_board_info))
698#define FLASH_USER_SIZE (sizeof(struct netxen_user_info)/sizeof(u32)) 699#define NETXEN_FLASH_USER_SIZE (sizeof(struct netxen_user_info)/sizeof(u32))
699#define FLASH_SECONDARY_SIZE (USER_START-SECONDARY_START) 700#define NETXEN_FLASH_SECONDARY_SIZE (NETXEN_USER_START-NETXEN_SECONDARY_START)
700#define NUM_PRIMARY_SECTORS (0x20) 701#define NETXEN_NUM_PRIMARY_SECTORS (0x20)
701#define NUM_CONFIG_SECTORS (1) 702#define NETXEN_NUM_CONFIG_SECTORS (1)
702#define PFX "NetXen: " 703#define PFX "NetXen: "
703extern char netxen_nic_driver_name[]; 704extern char netxen_nic_driver_name[];
704 705
@@ -1048,6 +1049,7 @@ int netxen_rom_se(struct netxen_adapter *adapter, int addr);
1048int netxen_do_rom_se(struct netxen_adapter *adapter, int addr); 1049int netxen_do_rom_se(struct netxen_adapter *adapter, int addr);
1049 1050
1050/* Functions from netxen_nic_isr.c */ 1051/* Functions from netxen_nic_isr.c */
1052int netxen_nic_link_ok(struct netxen_adapter *adapter);
1051void netxen_nic_isr_other(struct netxen_adapter *adapter); 1053void netxen_nic_isr_other(struct netxen_adapter *adapter);
1052void netxen_indicate_link_status(struct netxen_adapter *adapter, u32 link); 1054void netxen_indicate_link_status(struct netxen_adapter *adapter, u32 link);
1053void netxen_handle_port_int(struct netxen_adapter *adapter, u32 enable); 1055void netxen_handle_port_int(struct netxen_adapter *adapter, u32 enable);
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c
index 16fabb377488..0175f6c353f6 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -94,7 +94,7 @@ static const char netxen_nic_gstrings_test[][ETH_GSTRING_LEN] = {
94 94
95static int netxen_nic_get_eeprom_len(struct net_device *dev) 95static int netxen_nic_get_eeprom_len(struct net_device *dev)
96{ 96{
97 return FLASH_TOTAL_SIZE; 97 return NETXEN_FLASH_TOTAL_SIZE;
98} 98}
99 99
100static void 100static void
@@ -470,7 +470,7 @@ netxen_nic_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
470 return 0; 470 return 0;
471 } 471 }
472 472
473 if (offset == BOOTLD_START) { 473 if (offset == NETXEN_BOOTLD_START) {
474 ret = netxen_flash_erase_primary(adapter); 474 ret = netxen_flash_erase_primary(adapter);
475 if (ret != FLASH_SUCCESS) { 475 if (ret != FLASH_SUCCESS) {
476 printk(KERN_ERR "%s: Flash erase failed.\n", 476 printk(KERN_ERR "%s: Flash erase failed.\n",
@@ -478,10 +478,10 @@ netxen_nic_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
478 return ret; 478 return ret;
479 } 479 }
480 480
481 ret = netxen_rom_se(adapter, USER_START); 481 ret = netxen_rom_se(adapter, NETXEN_USER_START);
482 if (ret != FLASH_SUCCESS) 482 if (ret != FLASH_SUCCESS)
483 return ret; 483 return ret;
484 ret = netxen_rom_se(adapter, FIXED_START); 484 ret = netxen_rom_se(adapter, NETXEN_FIXED_START);
485 if (ret != FLASH_SUCCESS) 485 if (ret != FLASH_SUCCESS)
486 return ret; 486 return ret;
487 487
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index baff17a24d63..c012764d1145 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -257,7 +257,7 @@ u64 ctx_addr_sig_regs[][3] = {
257#define ADDR_IN_RANGE(addr, low, high) \ 257#define ADDR_IN_RANGE(addr, low, high) \
258 (((addr) <= (high)) && ((addr) >= (low))) 258 (((addr) <= (high)) && ((addr) >= (low)))
259 259
260#define NETXEN_FLASH_BASE (BOOTLD_START) 260#define NETXEN_FLASH_BASE (NETXEN_BOOTLD_START)
261#define NETXEN_PHANTOM_MEM_BASE (NETXEN_FLASH_BASE) 261#define NETXEN_PHANTOM_MEM_BASE (NETXEN_FLASH_BASE)
262#define NETXEN_MAX_MTU 8000 + NETXEN_ENET_HEADER_SIZE + NETXEN_ETH_FCS_SIZE 262#define NETXEN_MAX_MTU 8000 + NETXEN_ENET_HEADER_SIZE + NETXEN_ETH_FCS_SIZE
263#define NETXEN_MIN_MTU 64 263#define NETXEN_MIN_MTU 64
@@ -611,7 +611,7 @@ int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, u64 mac[])
611 u32 *pmac = (u32 *) & mac[0]; 611 u32 *pmac = (u32 *) & mac[0];
612 612
613 if (netxen_get_flash_block(adapter, 613 if (netxen_get_flash_block(adapter,
614 USER_START + 614 NETXEN_USER_START +
615 offsetof(struct netxen_new_user_info, 615 offsetof(struct netxen_new_user_info,
616 mac_addr), 616 mac_addr),
617 FLASH_NUM_PORTS * sizeof(u64), pmac) == -1) { 617 FLASH_NUM_PORTS * sizeof(u64), pmac) == -1) {
@@ -619,7 +619,7 @@ int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, u64 mac[])
619 } 619 }
620 if (*mac == ~0ULL) { 620 if (*mac == ~0ULL) {
621 if (netxen_get_flash_block(adapter, 621 if (netxen_get_flash_block(adapter,
622 USER_START_OLD + 622 NETXEN_USER_START_OLD +
623 offsetof(struct netxen_user_old_info, 623 offsetof(struct netxen_user_old_info,
624 mac_addr), 624 mac_addr),
625 FLASH_NUM_PORTS * sizeof(u64), 625 FLASH_NUM_PORTS * sizeof(u64),
@@ -942,7 +942,7 @@ netxen_nic_pci_set_window(struct netxen_adapter *adapter,
942int 942int
943netxen_nic_erase_pxe(struct netxen_adapter *adapter) 943netxen_nic_erase_pxe(struct netxen_adapter *adapter)
944{ 944{
945 if (netxen_rom_fast_write(adapter, PXE_START, 0) == -1) { 945 if (netxen_rom_fast_write(adapter, NETXEN_PXE_START, 0) == -1) {
946 printk(KERN_ERR "%s: erase pxe failed\n", 946 printk(KERN_ERR "%s: erase pxe failed\n",
947 netxen_nic_driver_name); 947 netxen_nic_driver_name);
948 return -1; 948 return -1;
@@ -953,7 +953,7 @@ netxen_nic_erase_pxe(struct netxen_adapter *adapter)
953int netxen_nic_get_board_info(struct netxen_adapter *adapter) 953int netxen_nic_get_board_info(struct netxen_adapter *adapter)
954{ 954{
955 int rv = 0; 955 int rv = 0;
956 int addr = BRDCFG_START; 956 int addr = NETXEN_BRDCFG_START;
957 struct netxen_board_info *boardinfo; 957 struct netxen_board_info *boardinfo;
958 int index; 958 int index;
959 u32 *ptr32; 959 u32 *ptr32;
@@ -1115,7 +1115,7 @@ void netxen_nic_flash_print(struct netxen_adapter *adapter)
1115 u32 fw_build = 0; 1115 u32 fw_build = 0;
1116 char brd_name[NETXEN_MAX_SHORT_NAME]; 1116 char brd_name[NETXEN_MAX_SHORT_NAME];
1117 struct netxen_new_user_info user_info; 1117 struct netxen_new_user_info user_info;
1118 int i, addr = USER_START; 1118 int i, addr = NETXEN_USER_START;
1119 __le32 *ptr32; 1119 __le32 *ptr32;
1120 1120
1121 struct netxen_board_info *board_info = &(adapter->ahw.boardcfg); 1121 struct netxen_board_info *board_info = &(adapter->ahw.boardcfg);
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index a36892457761..bb23f4c360db 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -585,7 +585,7 @@ int netxen_backup_crbinit(struct netxen_adapter *adapter)
585{ 585{
586 int ret = FLASH_SUCCESS; 586 int ret = FLASH_SUCCESS;
587 int val; 587 int val;
588 char *buffer = kmalloc(FLASH_SECTOR_SIZE, GFP_KERNEL); 588 char *buffer = kmalloc(NETXEN_FLASH_SECTOR_SIZE, GFP_KERNEL);
589 589
590 if (!buffer) 590 if (!buffer)
591 return -ENOMEM; 591 return -ENOMEM;
@@ -601,13 +601,13 @@ int netxen_backup_crbinit(struct netxen_adapter *adapter)
601 goto out_kfree; 601 goto out_kfree;
602 602
603 /* copy sector 0 to sector 63 */ 603 /* copy sector 0 to sector 63 */
604 ret = netxen_rom_fast_read_words(adapter, CRBINIT_START, 604 ret = netxen_rom_fast_read_words(adapter, NETXEN_CRBINIT_START,
605 buffer, FLASH_SECTOR_SIZE); 605 buffer, NETXEN_FLASH_SECTOR_SIZE);
606 if (ret != FLASH_SUCCESS) 606 if (ret != FLASH_SUCCESS)
607 goto out_kfree; 607 goto out_kfree;
608 608
609 ret = netxen_rom_fast_write_words(adapter, FIXED_START, 609 ret = netxen_rom_fast_write_words(adapter, NETXEN_FIXED_START,
610 buffer, FLASH_SECTOR_SIZE); 610 buffer, NETXEN_FLASH_SECTOR_SIZE);
611 if (ret != FLASH_SUCCESS) 611 if (ret != FLASH_SUCCESS)
612 goto out_kfree; 612 goto out_kfree;
613 613
@@ -654,7 +654,8 @@ void check_erased_flash(struct netxen_adapter *adapter, int addr)
654 int count = 0, erased_errors = 0; 654 int count = 0, erased_errors = 0;
655 int range; 655 int range;
656 656
657 range = (addr == USER_START) ? FIXED_START : addr + FLASH_SECTOR_SIZE; 657 range = (addr == NETXEN_USER_START) ?
658 NETXEN_FIXED_START : addr + NETXEN_FLASH_SECTOR_SIZE;
658 659
659 for (i = addr; i < range; i += 4) { 660 for (i = addr; i < range; i += 4) {
660 netxen_rom_fast_read(adapter, i, &val); 661 netxen_rom_fast_read(adapter, i, &val);
@@ -689,7 +690,7 @@ netxen_flash_erase_sections(struct netxen_adapter *adapter, int start, int end)
689 int i; 690 int i;
690 691
691 for (i = start; i < end; i++) { 692 for (i = start; i < end; i++) {
692 ret = netxen_rom_se(adapter, i * FLASH_SECTOR_SIZE); 693 ret = netxen_rom_se(adapter, i * NETXEN_FLASH_SECTOR_SIZE);
693 if (ret) 694 if (ret)
694 break; 695 break;
695 ret = netxen_rom_wip_poll(adapter); 696 ret = netxen_rom_wip_poll(adapter);
@@ -706,8 +707,8 @@ netxen_flash_erase_secondary(struct netxen_adapter *adapter)
706 int ret = FLASH_SUCCESS; 707 int ret = FLASH_SUCCESS;
707 int start, end; 708 int start, end;
708 709
709 start = SECONDARY_START / FLASH_SECTOR_SIZE; 710 start = NETXEN_SECONDARY_START / NETXEN_FLASH_SECTOR_SIZE;
710 end = USER_START / FLASH_SECTOR_SIZE; 711 end = NETXEN_USER_START / NETXEN_FLASH_SECTOR_SIZE;
711 ret = netxen_flash_erase_sections(adapter, start, end); 712 ret = netxen_flash_erase_sections(adapter, start, end);
712 713
713 return ret; 714 return ret;
@@ -719,8 +720,8 @@ netxen_flash_erase_primary(struct netxen_adapter *adapter)
719 int ret = FLASH_SUCCESS; 720 int ret = FLASH_SUCCESS;
720 int start, end; 721 int start, end;
721 722
722 start = PRIMARY_START / FLASH_SECTOR_SIZE; 723 start = NETXEN_PRIMARY_START / NETXEN_FLASH_SECTOR_SIZE;
723 end = SECONDARY_START / FLASH_SECTOR_SIZE; 724 end = NETXEN_SECONDARY_START / NETXEN_FLASH_SECTOR_SIZE;
724 ret = netxen_flash_erase_sections(adapter, start, end); 725 ret = netxen_flash_erase_sections(adapter, start, end);
725 726
726 return ret; 727 return ret;
@@ -1036,18 +1037,23 @@ void netxen_watchdog_task(struct work_struct *work)
1036 if ((adapter->portnum == 0) && netxen_nic_check_temp(adapter)) 1037 if ((adapter->portnum == 0) && netxen_nic_check_temp(adapter))
1037 return; 1038 return;
1038 1039
1040 if (adapter->handle_phy_intr)
1041 adapter->handle_phy_intr(adapter);
1042
1039 netdev = adapter->netdev; 1043 netdev = adapter->netdev;
1040 if ((netif_running(netdev)) && !netif_carrier_ok(netdev)) { 1044 if ((netif_running(netdev)) && !netif_carrier_ok(netdev) &&
1041 printk(KERN_INFO "%s port %d, %s carrier is now ok\n", 1045 netxen_nic_link_ok(adapter) ) {
1042 netxen_nic_driver_name, adapter->portnum, netdev->name); 1046 printk(KERN_INFO "%s %s (port %d), Link is up\n",
1047 netxen_nic_driver_name, netdev->name, adapter->portnum);
1043 netif_carrier_on(netdev); 1048 netif_carrier_on(netdev);
1044 }
1045
1046 if (netif_queue_stopped(netdev))
1047 netif_wake_queue(netdev); 1049 netif_wake_queue(netdev);
1050 } else if(!(netif_running(netdev)) && netif_carrier_ok(netdev)) {
1051 printk(KERN_ERR "%s %s Link is Down\n",
1052 netxen_nic_driver_name, netdev->name);
1053 netif_carrier_off(netdev);
1054 netif_stop_queue(netdev);
1055 }
1048 1056
1049 if (adapter->handle_phy_intr)
1050 adapter->handle_phy_intr(adapter);
1051 mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); 1057 mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ);
1052} 1058}
1053 1059
diff --git a/drivers/net/netxen/netxen_nic_isr.c b/drivers/net/netxen/netxen_nic_isr.c
index b213b062eb56..b2de6b6c2a7f 100644
--- a/drivers/net/netxen/netxen_nic_isr.c
+++ b/drivers/net/netxen/netxen_nic_isr.c
@@ -169,6 +169,24 @@ void netxen_nic_gbe_handle_phy_intr(struct netxen_adapter *adapter)
169 netxen_nic_isr_other(adapter); 169 netxen_nic_isr_other(adapter);
170} 170}
171 171
172int netxen_nic_link_ok(struct netxen_adapter *adapter)
173{
174 switch (adapter->ahw.board_type) {
175 case NETXEN_NIC_GBE:
176 return ((adapter->ahw.qg_linksup) & 1);
177
178 case NETXEN_NIC_XGBE:
179 return ((adapter->ahw.xg_linkup) & 1);
180
181 default:
182 printk(KERN_ERR"%s: Function: %s, Unknown board type\n",
183 netxen_nic_driver_name, __FUNCTION__);
184 break;
185 }
186
187 return 0;
188}
189
172void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter) 190void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter)
173{ 191{
174 struct net_device *netdev = adapter->netdev; 192 struct net_device *netdev = adapter->netdev;
@@ -183,6 +201,10 @@ void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter)
183 printk(KERN_INFO "%s: %s NIC Link is down\n", 201 printk(KERN_INFO "%s: %s NIC Link is down\n",
184 netxen_nic_driver_name, netdev->name); 202 netxen_nic_driver_name, netdev->name);
185 adapter->ahw.xg_linkup = 0; 203 adapter->ahw.xg_linkup = 0;
204 if (netif_running(netdev)) {
205 netif_carrier_off(netdev);
206 netif_stop_queue(netdev);
207 }
186 /* read twice to clear sticky bits */ 208 /* read twice to clear sticky bits */
187 /* WINDOW = 0 */ 209 /* WINDOW = 0 */
188 netxen_nic_read_w0(adapter, NETXEN_NIU_XG_STATUS, &val1); 210 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)
196 printk(KERN_INFO "%s: %s NIC Link is up\n", 218 printk(KERN_INFO "%s: %s NIC Link is up\n",
197 netxen_nic_driver_name, netdev->name); 219 netxen_nic_driver_name, netdev->name);
198 adapter->ahw.xg_linkup = 1; 220 adapter->ahw.xg_linkup = 1;
221 netif_carrier_on(netdev);
222 netif_wake_queue(netdev);
199 } 223 }
200} 224}
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index c61181f23bd5..6167b58d2731 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -542,6 +542,13 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
542 NETXEN_ROMUSB_GLB_PEGTUNE_DONE)); 542 NETXEN_ROMUSB_GLB_PEGTUNE_DONE));
543 /* Handshake with the card before we register the devices. */ 543 /* Handshake with the card before we register the devices. */
544 netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); 544 netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE);
545
546 /* leave the hw in the same state as reboot */
547 writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE));
548 netxen_pinit_from_rom(adapter, 0);
549 udelay(500);
550 netxen_load_firmware(adapter);
551 netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE);
545 } 552 }
546 553
547 /* 554 /*
diff --git a/drivers/net/netxen/netxen_nic_niu.c b/drivers/net/netxen/netxen_nic_niu.c
index cef90a78351e..75102d30730f 100644
--- a/drivers/net/netxen/netxen_nic_niu.c
+++ b/drivers/net/netxen/netxen_nic_niu.c
@@ -454,16 +454,12 @@ int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port)
454 454
455int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port) 455int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port)
456{ 456{
457 u32 reg;
458 u32 portnum = physical_port[adapter->portnum]; 457 u32 portnum = physical_port[adapter->portnum];
459 458
460 netxen_crb_writelit_adapter(adapter, 459 netxen_crb_writelit_adapter(adapter,
461 NETXEN_NIU_XGE_CONFIG_0+(0x10000*portnum), 0x5); 460 NETXEN_NIU_XGE_CONFIG_1+(0x10000*portnum), 0x1447);
462 netxen_nic_hw_read_wx(adapter,
463 NETXEN_NIU_XGE_CONFIG_1+(0x10000*portnum), &reg, 4);
464 reg = (reg & ~0x2000UL);
465 netxen_crb_writelit_adapter(adapter, 461 netxen_crb_writelit_adapter(adapter,
466 NETXEN_NIU_XGE_CONFIG_1+(0x10000*portnum), reg); 462 NETXEN_NIU_XGE_CONFIG_0+(0x10000*portnum), 0x5);
467 463
468 return 0; 464 return 0;
469} 465}
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 22aec5cce683..b87f8d2a888b 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -54,6 +54,12 @@
54#define MII_M1111_PHY_LED_CONTROL 0x18 54#define MII_M1111_PHY_LED_CONTROL 0x18
55#define MII_M1111_PHY_LED_DIRECT 0x4100 55#define MII_M1111_PHY_LED_DIRECT 0x4100
56#define MII_M1111_PHY_LED_COMBINE 0x411c 56#define MII_M1111_PHY_LED_COMBINE 0x411c
57#define MII_M1111_PHY_EXT_CR 0x14
58#define MII_M1111_RX_DELAY 0x80
59#define MII_M1111_TX_DELAY 0x2
60#define MII_M1111_PHY_EXT_SR 0x1b
61#define MII_M1111_HWCFG_MODE_MASK 0xf
62#define MII_M1111_HWCFG_MODE_RGMII 0xb
57 63
58MODULE_DESCRIPTION("Marvell PHY driver"); 64MODULE_DESCRIPTION("Marvell PHY driver");
59MODULE_AUTHOR("Andy Fleming"); 65MODULE_AUTHOR("Andy Fleming");
@@ -131,6 +137,45 @@ static int marvell_config_aneg(struct phy_device *phydev)
131 return err; 137 return err;
132} 138}
133 139
140static int m88e1111_config_init(struct phy_device *phydev)
141{
142 int err;
143
144 if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) ||
145 (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)) {
146 int temp;
147
148 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) {
149 temp = phy_read(phydev, MII_M1111_PHY_EXT_CR);
150 if (temp < 0)
151 return temp;
152
153 temp |= (MII_M1111_RX_DELAY | MII_M1111_TX_DELAY);
154
155 err = phy_write(phydev, MII_M1111_PHY_EXT_CR, temp);
156 if (err < 0)
157 return err;
158 }
159
160 temp = phy_read(phydev, MII_M1111_PHY_EXT_SR);
161 if (temp < 0)
162 return temp;
163
164 temp &= ~(MII_M1111_HWCFG_MODE_MASK);
165 temp |= MII_M1111_HWCFG_MODE_RGMII;
166
167 err = phy_write(phydev, MII_M1111_PHY_EXT_SR, temp);
168 if (err < 0)
169 return err;
170 }
171
172 err = phy_write(phydev, MII_BMCR, BMCR_RESET);
173 if (err < 0)
174 return err;
175
176 return 0;
177}
178
134static int m88e1145_config_init(struct phy_device *phydev) 179static int m88e1145_config_init(struct phy_device *phydev)
135{ 180{
136 int err; 181 int err;
@@ -152,7 +197,7 @@ static int m88e1145_config_init(struct phy_device *phydev)
152 if (err < 0) 197 if (err < 0)
153 return err; 198 return err;
154 199
155 if (phydev->interface == PHY_INTERFACE_MODE_RGMII) { 200 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) {
156 int temp = phy_read(phydev, MII_M1145_PHY_EXT_CR); 201 int temp = phy_read(phydev, MII_M1145_PHY_EXT_CR);
157 if (temp < 0) 202 if (temp < 0)
158 return temp; 203 return temp;
@@ -206,7 +251,7 @@ static struct phy_driver m88e1101_driver = {
206 .driver = {.owner = THIS_MODULE,}, 251 .driver = {.owner = THIS_MODULE,},
207}; 252};
208 253
209static struct phy_driver m88e1111s_driver = { 254static struct phy_driver m88e1111_driver = {
210 .phy_id = 0x01410cc0, 255 .phy_id = 0x01410cc0,
211 .phy_id_mask = 0xfffffff0, 256 .phy_id_mask = 0xfffffff0,
212 .name = "Marvell 88E1111", 257 .name = "Marvell 88E1111",
@@ -216,6 +261,7 @@ static struct phy_driver m88e1111s_driver = {
216 .read_status = &genphy_read_status, 261 .read_status = &genphy_read_status,
217 .ack_interrupt = &marvell_ack_interrupt, 262 .ack_interrupt = &marvell_ack_interrupt,
218 .config_intr = &marvell_config_intr, 263 .config_intr = &marvell_config_intr,
264 .config_init = &m88e1111_config_init,
219 .driver = {.owner = THIS_MODULE,}, 265 .driver = {.owner = THIS_MODULE,},
220}; 266};
221 267
@@ -241,9 +287,9 @@ static int __init marvell_init(void)
241 if (ret) 287 if (ret)
242 return ret; 288 return ret;
243 289
244 ret = phy_driver_register(&m88e1111s_driver); 290 ret = phy_driver_register(&m88e1111_driver);
245 if (ret) 291 if (ret)
246 goto err1111s; 292 goto err1111;
247 293
248 ret = phy_driver_register(&m88e1145_driver); 294 ret = phy_driver_register(&m88e1145_driver);
249 if (ret) 295 if (ret)
@@ -251,9 +297,9 @@ static int __init marvell_init(void)
251 297
252 return 0; 298 return 0;
253 299
254 err1145: 300err1145:
255 phy_driver_unregister(&m88e1111s_driver); 301 phy_driver_unregister(&m88e1111_driver);
256 err1111s: 302err1111:
257 phy_driver_unregister(&m88e1101_driver); 303 phy_driver_unregister(&m88e1101_driver);
258 return ret; 304 return ret;
259} 305}
@@ -261,7 +307,7 @@ static int __init marvell_init(void)
261static void __exit marvell_exit(void) 307static void __exit marvell_exit(void)
262{ 308{
263 phy_driver_unregister(&m88e1101_driver); 309 phy_driver_unregister(&m88e1101_driver);
264 phy_driver_unregister(&m88e1111s_driver); 310 phy_driver_unregister(&m88e1111_driver);
265 phy_driver_unregister(&m88e1145_driver); 311 phy_driver_unregister(&m88e1145_driver);
266} 312}
267 313
diff --git a/drivers/net/ppp_mppe.c b/drivers/net/ppp_mppe.c
index d5bdd2574659..5ae80bbe2edc 100644
--- a/drivers/net/ppp_mppe.c
+++ b/drivers/net/ppp_mppe.c
@@ -493,14 +493,14 @@ mppe_decompress(void *arg, unsigned char *ibuf, int isize, unsigned char *obuf,
493 493
494 /* 494 /*
495 * Make sure we have enough room to decrypt the packet. 495 * Make sure we have enough room to decrypt the packet.
496 * Note that for our test we only subtract 1 byte whereas in 496 * To account for possible PFC we should only subtract 1
497 * mppe_compress() we added 2 bytes (+MPPE_OVHD); 497 * byte whereas in mppe_compress() we added 2 bytes (+MPPE_OVHD);
498 * this is to account for possible PFC. 498 * However, we assume no PFC, thus subtracting 2 bytes.
499 */ 499 */
500 if (osize < isize - MPPE_OVHD - 1) { 500 if (osize < isize - MPPE_OVHD - 2) {
501 printk(KERN_DEBUG "mppe_decompress[%d]: osize too small! " 501 printk(KERN_DEBUG "mppe_decompress[%d]: osize too small! "
502 "(have: %d need: %d)\n", state->unit, 502 "(have: %d need: %d)\n", state->unit,
503 osize, isize - MPPE_OVHD - 1); 503 osize, isize - MPPE_OVHD - 2);
504 return DECOMP_ERROR; 504 return DECOMP_ERROR;
505 } 505 }
506 osize = isize - MPPE_OVHD - 2; /* assume no PFC */ 506 osize = isize - MPPE_OVHD - 2; /* assume no PFC */
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h
index 506bffcbc6dc..f8429449dc1e 100644
--- a/drivers/net/smc91x.h
+++ b/drivers/net/smc91x.h
@@ -58,6 +58,8 @@
58#elif defined(CONFIG_BFIN) 58#elif defined(CONFIG_BFIN)
59 59
60#define SMC_IRQ_FLAGS IRQF_TRIGGER_HIGH 60#define SMC_IRQ_FLAGS IRQF_TRIGGER_HIGH
61#define RPC_LSA_DEFAULT RPC_LED_100_10
62#define RPC_LSB_DEFAULT RPC_LED_TX_RX
61 63
62# if defined (CONFIG_BFIN561_EZKIT) 64# if defined (CONFIG_BFIN561_EZKIT)
63#define SMC_CAN_USE_8BIT 0 65#define SMC_CAN_USE_8BIT 0
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig
index 3de564b23147..8dc09a3790cb 100644
--- a/drivers/net/usb/Kconfig
+++ b/drivers/net/usb/Kconfig
@@ -313,8 +313,8 @@ config USB_KC2190
313 boolean "KT Technology KC2190 based cables (InstaNet)" 313 boolean "KT Technology KC2190 based cables (InstaNet)"
314 depends on USB_NET_CDC_SUBSET && EXPERIMENTAL 314 depends on USB_NET_CDC_SUBSET && EXPERIMENTAL
315 help 315 help
316  Choose this option if you're using a host-to-host cable 316 Choose this option if you're using a host-to-host cable
317  with one of these chips. 317 with one of these chips.
318 318
319config USB_NET_ZAURUS 319config USB_NET_ZAURUS
320 tristate "Sharp Zaurus (stock ROMs) and compatible" 320 tristate "Sharp Zaurus (stock ROMs) and compatible"
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index 25b75b615188..b670b97bcfde 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -1562,7 +1562,7 @@ static void velocity_print_link_status(struct velocity_info *vptr)
1562 if (vptr->mii_status & VELOCITY_LINK_FAIL) { 1562 if (vptr->mii_status & VELOCITY_LINK_FAIL) {
1563 VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: failed to detect cable link\n", vptr->dev->name); 1563 VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: failed to detect cable link\n", vptr->dev->name);
1564 } else if (vptr->options.spd_dpx == SPD_DPX_AUTO) { 1564 } else if (vptr->options.spd_dpx == SPD_DPX_AUTO) {
1565 VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link autonegation", vptr->dev->name); 1565 VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link auto-negotiation", vptr->dev->name);
1566 1566
1567 if (vptr->mii_status & VELOCITY_SPEED_1000) 1567 if (vptr->mii_status & VELOCITY_SPEED_1000)
1568 VELOCITY_PRT(MSG_LEVEL_INFO, " speed 1000M bps"); 1568 VELOCITY_PRT(MSG_LEVEL_INFO, " speed 1000M bps");
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
index e3f5bb0fe603..fa2399cbd5ca 100644
--- a/drivers/net/wireless/Kconfig
+++ b/drivers/net/wireless/Kconfig
@@ -266,16 +266,23 @@ config IPW2200_DEBUG
266 266
267 If you are not sure, say N here. 267 If you are not sure, say N here.
268 268
269config LIBERTAS_USB 269config LIBERTAS
270 tristate "Marvell Libertas 8388 802.11a/b/g cards" 270 tristate "Marvell 8xxx Libertas WLAN driver support"
271 depends on USB && WLAN_80211 271 depends on WLAN_80211
272 select IEEE80211
272 select FW_LOADER 273 select FW_LOADER
273 ---help--- 274 ---help---
275 A library for Marvell Libertas 8xxx devices.
276
277config LIBERTAS_USB
278 tristate "Marvell Libertas 8388 USB 802.11b/g cards"
279 depends on LIBERTAS && USB
280 ---help---
274 A driver for Marvell Libertas 8388 USB devices. 281 A driver for Marvell Libertas 8388 USB devices.
275 282
276config LIBERTAS_USB_DEBUG 283config LIBERTAS_DEBUG
277 bool "Enable full debugging output in the Libertas USB module." 284 bool "Enable full debugging output in the Libertas module."
278 depends on LIBERTAS_USB 285 depends on LIBERTAS
279 ---help--- 286 ---help---
280 Debugging support. 287 Debugging support.
281 288
diff --git a/drivers/net/wireless/libertas/11d.c b/drivers/net/wireless/libertas/11d.c
index e0ecc4d483bb..4cf0ff7b833d 100644
--- a/drivers/net/wireless/libertas/11d.c
+++ b/drivers/net/wireless/libertas/11d.c
@@ -95,7 +95,7 @@ static u8 wlan_get_chan_11d(u8 band, u8 firstchan, u8 nrchan, u8 * chan)
95 95
96 for (i = 0; i < cfp_no; i++) { 96 for (i = 0; i < cfp_no; i++) {
97 if ((cfp + i)->channel == firstchan) { 97 if ((cfp + i)->channel == firstchan) {
98 lbs_pr_debug(1, "firstchan found\n"); 98 lbs_deb_11d("firstchan found\n");
99 break; 99 break;
100 } 100 }
101 } 101 }
@@ -129,12 +129,12 @@ static u8 wlan_channel_known_11d(u8 chan,
129 129
130 for (i = 0; i < nr_chan; i++) { 130 for (i = 0; i < nr_chan; i++) {
131 if (chan == chanpwr[i].chan) { 131 if (chan == chanpwr[i].chan) {
132 lbs_pr_debug(1, "11D: Found Chan:%d\n", chan); 132 lbs_deb_11d("11D: Found Chan:%d\n", chan);
133 return 1; 133 return 1;
134 } 134 }
135 } 135 }
136 136
137 lbs_pr_debug(1, "11D: Not Find Chan:%d\n", chan); 137 lbs_deb_11d("11D: Not Find Chan:%d\n", chan);
138 return 0; 138 return 0;
139} 139}
140 140
@@ -174,7 +174,7 @@ static int generate_domain_info_11d(struct parsed_region_chan_11d
174 memcpy(domaininfo->countrycode, parsed_region_chan->countrycode, 174 memcpy(domaininfo->countrycode, parsed_region_chan->countrycode,
175 COUNTRY_CODE_LEN); 175 COUNTRY_CODE_LEN);
176 176
177 lbs_pr_debug(1, "11D:nrchan=%d\n", nr_chan); 177 lbs_deb_11d("11D:nrchan=%d\n", nr_chan);
178 lbs_dbg_hex("11D:parsed_region_chan:", (char *)parsed_region_chan, 178 lbs_dbg_hex("11D:parsed_region_chan:", (char *)parsed_region_chan,
179 sizeof(struct parsed_region_chan_11d)); 179 sizeof(struct parsed_region_chan_11d));
180 180
@@ -212,7 +212,7 @@ static int generate_domain_info_11d(struct parsed_region_chan_11d
212 } 212 }
213 domaininfo->nr_subband = nr_subband; 213 domaininfo->nr_subband = nr_subband;
214 214
215 lbs_pr_debug(1, "nr_subband=%x\n", domaininfo->nr_subband); 215 lbs_deb_11d("nr_subband=%x\n", domaininfo->nr_subband);
216 lbs_dbg_hex("11D:domaininfo:", (char *)domaininfo, 216 lbs_dbg_hex("11D:domaininfo:", (char *)domaininfo,
217 COUNTRY_CODE_LEN + 1 + 217 COUNTRY_CODE_LEN + 1 +
218 sizeof(struct ieeetypes_subbandset) * nr_subband); 218 sizeof(struct ieeetypes_subbandset) * nr_subband);
@@ -233,13 +233,13 @@ static void wlan_generate_parsed_region_chan_11d(struct region_channel * region_
233 struct chan_freq_power *cfp; 233 struct chan_freq_power *cfp;
234 234
235 if (region_chan == NULL) { 235 if (region_chan == NULL) {
236 lbs_pr_debug(1, "11D: region_chan is NULL\n"); 236 lbs_deb_11d("11D: region_chan is NULL\n");
237 return; 237 return;
238 } 238 }
239 239
240 cfp = region_chan->CFP; 240 cfp = region_chan->CFP;
241 if (cfp == NULL) { 241 if (cfp == NULL) {
242 lbs_pr_debug(1, "11D: cfp equal NULL \n"); 242 lbs_deb_11d("11D: cfp equal NULL \n");
243 return; 243 return;
244 } 244 }
245 245
@@ -248,19 +248,19 @@ static void wlan_generate_parsed_region_chan_11d(struct region_channel * region_
248 memcpy(parsed_region_chan->countrycode, 248 memcpy(parsed_region_chan->countrycode,
249 wlan_code_2_region(region_chan->region), COUNTRY_CODE_LEN); 249 wlan_code_2_region(region_chan->region), COUNTRY_CODE_LEN);
250 250
251 lbs_pr_debug(1, "11D: region[0x%x] band[%d]\n", parsed_region_chan->region, 251 lbs_deb_11d("11D: region[0x%x] band[%d]\n", parsed_region_chan->region,
252 parsed_region_chan->band); 252 parsed_region_chan->band);
253 253
254 for (i = 0; i < region_chan->nrcfp; i++, cfp++) { 254 for (i = 0; i < region_chan->nrcfp; i++, cfp++) {
255 parsed_region_chan->chanpwr[i].chan = cfp->channel; 255 parsed_region_chan->chanpwr[i].chan = cfp->channel;
256 parsed_region_chan->chanpwr[i].pwr = cfp->maxtxpower; 256 parsed_region_chan->chanpwr[i].pwr = cfp->maxtxpower;
257 lbs_pr_debug(1, "11D: Chan[%d] Pwr[%d]\n", 257 lbs_deb_11d("11D: Chan[%d] Pwr[%d]\n",
258 parsed_region_chan->chanpwr[i].chan, 258 parsed_region_chan->chanpwr[i].chan,
259 parsed_region_chan->chanpwr[i].pwr); 259 parsed_region_chan->chanpwr[i].pwr);
260 } 260 }
261 parsed_region_chan->nr_chan = region_chan->nrcfp; 261 parsed_region_chan->nr_chan = region_chan->nrcfp;
262 262
263 lbs_pr_debug(1, "11D: nrchan[%d]\n", parsed_region_chan->nr_chan); 263 lbs_deb_11d("11D: nrchan[%d]\n", parsed_region_chan->nr_chan);
264 264
265 return; 265 return;
266} 266}
@@ -277,8 +277,9 @@ static u8 wlan_region_chan_supported_11d(u8 region, u8 band, u8 chan)
277 struct chan_freq_power *cfp; 277 struct chan_freq_power *cfp;
278 int cfp_no; 278 int cfp_no;
279 u8 idx; 279 u8 idx;
280 int ret = 0;
280 281
281 ENTER(); 282 lbs_deb_enter(LBS_DEB_11D);
282 283
283 cfp = libertas_get_region_cfp_table(region, band, &cfp_no); 284 cfp = libertas_get_region_cfp_table(region, band, &cfp_no);
284 if (cfp == NULL) 285 if (cfp == NULL)
@@ -288,16 +289,19 @@ static u8 wlan_region_chan_supported_11d(u8 region, u8 band, u8 chan)
288 if (chan == (cfp + idx)->channel) { 289 if (chan == (cfp + idx)->channel) {
289 /* If Mrvl Chip Supported? */ 290 /* If Mrvl Chip Supported? */
290 if ((cfp + idx)->unsupported) { 291 if ((cfp + idx)->unsupported) {
291 return 0; 292 ret = 0;
292 } else { 293 } else {
293 return 1; 294 ret = 1;
294 } 295 }
296 goto done;
295 } 297 }
296 } 298 }
297 299
298 /*chan is not in the region table */ 300 /*chan is not in the region table */
299 LEAVE(); 301
300 return 0; 302done:
303 lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret);
304 return ret;
301} 305}
302 306
303/** 307/**
@@ -321,7 +325,7 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
321 325
322 u8 j, i; 326 u8 j, i;
323 327
324 ENTER(); 328 lbs_deb_enter(LBS_DEB_11D);
325 329
326 /*validation Rules: 330 /*validation Rules:
327 1. valid region Code 331 1. valid region Code
@@ -337,15 +341,14 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
337 if ((*(countryinfo->countrycode)) == 0 341 if ((*(countryinfo->countrycode)) == 0
338 || (countryinfo->len <= COUNTRY_CODE_LEN)) { 342 || (countryinfo->len <= COUNTRY_CODE_LEN)) {
339 /* No region Info or Wrong region info: treat as No 11D info */ 343 /* No region Info or Wrong region info: treat as No 11D info */
340 LEAVE(); 344 goto done;
341 return 0;
342 } 345 }
343 346
344 /*Step1: check region_code */ 347 /*Step1: check region_code */
345 parsed_region_chan->region = region = 348 parsed_region_chan->region = region =
346 wlan_region_2_code(countryinfo->countrycode); 349 wlan_region_2_code(countryinfo->countrycode);
347 350
348 lbs_pr_debug(1, "regioncode=%x\n", (u8) parsed_region_chan->region); 351 lbs_deb_11d("regioncode=%x\n", (u8) parsed_region_chan->region);
349 lbs_dbg_hex("CountryCode:", (char *)countryinfo->countrycode, 352 lbs_dbg_hex("CountryCode:", (char *)countryinfo->countrycode,
350 COUNTRY_CODE_LEN); 353 COUNTRY_CODE_LEN);
351 354
@@ -361,7 +364,7 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
361 364
362 if (countryinfo->subband[j].firstchan <= lastchan) { 365 if (countryinfo->subband[j].firstchan <= lastchan) {
363 /*Step2&3. Check First Chan Num increment and no overlap */ 366 /*Step2&3. Check First Chan Num increment and no overlap */
364 lbs_pr_debug(1, "11D: Chan[%d>%d] Overlap\n", 367 lbs_deb_11d("11D: Chan[%d>%d] Overlap\n",
365 countryinfo->subband[j].firstchan, lastchan); 368 countryinfo->subband[j].firstchan, lastchan);
366 continue; 369 continue;
367 } 370 }
@@ -374,7 +377,7 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
374 377
375 if (!wlan_get_chan_11d(band, firstchan, i, &curchan)) { 378 if (!wlan_get_chan_11d(band, firstchan, i, &curchan)) {
376 /* Chan is not found in UN table */ 379 /* Chan is not found in UN table */
377 lbs_pr_debug(1, "chan is not supported: %d \n", i); 380 lbs_deb_11d("chan is not supported: %d \n", i);
378 break; 381 break;
379 } 382 }
380 383
@@ -389,7 +392,7 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
389 idx++; 392 idx++;
390 } else { 393 } else {
391 /*not supported and ignore the chan */ 394 /*not supported and ignore the chan */
392 lbs_pr_debug(1, 395 lbs_deb_11d(
393 "11D:i[%d] chan[%d] unsupported in region[%x] band[%d]\n", 396 "11D:i[%d] chan[%d] unsupported in region[%x] band[%d]\n",
394 i, curchan, region, band); 397 i, curchan, region, band);
395 } 398 }
@@ -401,11 +404,12 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
401 404
402 parsed_region_chan->nr_chan = idx; 405 parsed_region_chan->nr_chan = idx;
403 406
404 lbs_pr_debug(1, "nrchan=%x\n", parsed_region_chan->nr_chan); 407 lbs_deb_11d("nrchan=%x\n", parsed_region_chan->nr_chan);
405 lbs_dbg_hex("11D:parsed_region_chan:", (u8 *) parsed_region_chan, 408 lbs_dbg_hex("11D:parsed_region_chan:", (u8 *) parsed_region_chan,
406 2 + COUNTRY_CODE_LEN + sizeof(struct parsed_region_chan_11d) * idx); 409 2 + COUNTRY_CODE_LEN + sizeof(struct parsed_region_chan_11d) * idx);
407 410
408 LEAVE(); 411done:
412 lbs_deb_enter(LBS_DEB_11D);
409 return 0; 413 return 0;
410} 414}
411 415
@@ -420,16 +424,16 @@ u8 libertas_get_scan_type_11d(u8 chan,
420{ 424{
421 u8 scan_type = cmd_scan_type_passive; 425 u8 scan_type = cmd_scan_type_passive;
422 426
423 ENTER(); 427 lbs_deb_enter(LBS_DEB_11D);
424 428
425 if (wlan_channel_known_11d(chan, parsed_region_chan)) { 429 if (wlan_channel_known_11d(chan, parsed_region_chan)) {
426 lbs_pr_debug(1, "11D: Found and do Active Scan\n"); 430 lbs_deb_11d("11D: Found and do Active Scan\n");
427 scan_type = cmd_scan_type_active; 431 scan_type = cmd_scan_type_active;
428 } else { 432 } else {
429 lbs_pr_debug(1, "11D: Not Find and do Passive Scan\n"); 433 lbs_deb_11d("11D: Not Find and do Passive Scan\n");
430 } 434 }
431 435
432 LEAVE(); 436 lbs_deb_leave_args(LBS_DEB_11D, "ret scan_type %d", scan_type);
433 return scan_type; 437 return scan_type;
434 438
435} 439}
@@ -456,7 +460,7 @@ static int wlan_enable_11d(wlan_private * priv, u8 flag)
456 OID_802_11D_ENABLE, 460 OID_802_11D_ENABLE,
457 &priv->adapter->enable11d); 461 &priv->adapter->enable11d);
458 if (ret) 462 if (ret)
459 lbs_pr_debug(1, "11D: Fail to enable 11D \n"); 463 lbs_deb_11d("11D: Fail to enable 11D \n");
460 464
461 return 0; 465 return 0;
462} 466}
@@ -471,7 +475,7 @@ static int set_domain_info_11d(wlan_private * priv)
471 int ret; 475 int ret;
472 476
473 if (!priv->adapter->enable11d) { 477 if (!priv->adapter->enable11d) {
474 lbs_pr_debug(1, "11D: dnld domain Info with 11d disabled\n"); 478 lbs_deb_11d("11D: dnld domain Info with 11d disabled\n");
475 return 0; 479 return 0;
476 } 480 }
477 481
@@ -479,7 +483,7 @@ static int set_domain_info_11d(wlan_private * priv)
479 cmd_act_set, 483 cmd_act_set,
480 cmd_option_waitforrsp, 0, NULL); 484 cmd_option_waitforrsp, 0, NULL);
481 if (ret) 485 if (ret)
482 lbs_pr_debug(1, "11D: Fail to dnld domain Info\n"); 486 lbs_deb_11d("11D: Fail to dnld domain Info\n");
483 487
484 return ret; 488 return ret;
485} 489}
@@ -501,7 +505,7 @@ int libertas_set_universaltable(wlan_private * priv, u8 band)
501 505
502 adapter->universal_channel[i].nrcfp = 506 adapter->universal_channel[i].nrcfp =
503 sizeof(channel_freq_power_UN_BG) / size; 507 sizeof(channel_freq_power_UN_BG) / size;
504 lbs_pr_debug(1, "11D: BG-band nrcfp=%d\n", 508 lbs_deb_11d("11D: BG-band nrcfp=%d\n",
505 adapter->universal_channel[i].nrcfp); 509 adapter->universal_channel[i].nrcfp);
506 510
507 adapter->universal_channel[i].CFP = channel_freq_power_UN_BG; 511 adapter->universal_channel[i].CFP = channel_freq_power_UN_BG;
@@ -531,9 +535,9 @@ int libertas_cmd_802_11d_domain_info(wlan_private * priv,
531 wlan_adapter *adapter = priv->adapter; 535 wlan_adapter *adapter = priv->adapter;
532 u8 nr_subband = adapter->domainreg.nr_subband; 536 u8 nr_subband = adapter->domainreg.nr_subband;
533 537
534 ENTER(); 538 lbs_deb_enter(LBS_DEB_11D);
535 539
536 lbs_pr_debug(1, "nr_subband=%x\n", nr_subband); 540 lbs_deb_11d("nr_subband=%x\n", nr_subband);
537 541
538 cmd->command = cpu_to_le16(cmdno); 542 cmd->command = cpu_to_le16(cmdno);
539 pdomaininfo->action = cpu_to_le16(cmdoption); 543 pdomaininfo->action = cpu_to_le16(cmdoption);
@@ -542,8 +546,7 @@ int libertas_cmd_802_11d_domain_info(wlan_private * priv,
542 cpu_to_le16(sizeof(pdomaininfo->action) + S_DS_GEN); 546 cpu_to_le16(sizeof(pdomaininfo->action) + S_DS_GEN);
543 lbs_dbg_hex("11D: 802_11D_DOMAIN_INFO:", (u8 *) cmd, 547 lbs_dbg_hex("11D: 802_11D_DOMAIN_INFO:", (u8 *) cmd,
544 (int)(cmd->size)); 548 (int)(cmd->size));
545 LEAVE(); 549 goto done;
546 return 0;
547 } 550 }
548 551
549 domain->header.type = cpu_to_le16(TLV_TYPE_DOMAIN); 552 domain->header.type = cpu_to_le16(TLV_TYPE_DOMAIN);
@@ -567,10 +570,10 @@ int libertas_cmd_802_11d_domain_info(wlan_private * priv,
567 cpu_to_le16(sizeof(pdomaininfo->action) + S_DS_GEN); 570 cpu_to_le16(sizeof(pdomaininfo->action) + S_DS_GEN);
568 } 571 }
569 572
570 lbs_dbg_hex("11D:802_11D_DOMAIN_INFO:", (u8 *) cmd, (int)(cmd->size)); 573 lbs_dbg_hex("11D:802_11D_DOMAIN_INFO:", (u8 *) cmd, le16_to_cpu(cmd->size));
571
572 LEAVE();
573 574
575done:
576 lbs_deb_enter(LBS_DEB_11D);
574 return 0; 577 return 0;
575} 578}
576 579
@@ -585,17 +588,17 @@ int libertas_cmd_enable_11d(wlan_private * priv, struct iwreq *wrq)
585 int data = 0; 588 int data = 0;
586 int *val; 589 int *val;
587 590
588 ENTER(); 591 lbs_deb_enter(LBS_DEB_11D);
589 data = SUBCMD_DATA(wrq); 592 data = SUBCMD_DATA(wrq);
590 593
591 lbs_pr_debug(1, "enable 11D: %s\n", 594 lbs_deb_11d("enable 11D: %s\n",
592 (data == 1) ? "enable" : "Disable"); 595 (data == 1) ? "enable" : "Disable");
593 596
594 wlan_enable_11d(priv, data); 597 wlan_enable_11d(priv, data);
595 val = (int *)wrq->u.name; 598 val = (int *)wrq->u.name;
596 *val = priv->adapter->enable11d; 599 *val = priv->adapter->enable11d;
597 600
598 LEAVE(); 601 lbs_deb_enter(LBS_DEB_11D);
599 return 0; 602 return 0;
600} 603}
601 604
@@ -608,25 +611,24 @@ int libertas_cmd_enable_11d(wlan_private * priv, struct iwreq *wrq)
608int libertas_ret_802_11d_domain_info(wlan_private * priv, 611int libertas_ret_802_11d_domain_info(wlan_private * priv,
609 struct cmd_ds_command *resp) 612 struct cmd_ds_command *resp)
610{ 613{
611 struct cmd_ds_802_11d_domain_info 614 struct cmd_ds_802_11d_domain_info *domaininfo = &resp->params.domaininforesp;
612 *domaininfo = &resp->params.domaininforesp;
613 struct mrvlietypes_domainparamset *domain = &domaininfo->domain; 615 struct mrvlietypes_domainparamset *domain = &domaininfo->domain;
614 u16 action = le16_to_cpu(domaininfo->action); 616 u16 action = le16_to_cpu(domaininfo->action);
615 s16 ret = 0; 617 s16 ret = 0;
616 u8 nr_subband = 0; 618 u8 nr_subband = 0;
617 619
618 ENTER(); 620 lbs_deb_enter(LBS_DEB_11D);
619 621
620 lbs_dbg_hex("11D DOMAIN Info Rsp Data:", (u8 *) resp, 622 lbs_dbg_hex("11D DOMAIN Info Rsp Data:", (u8 *) resp,
621 (int)le16_to_cpu(resp->size)); 623 (int)le16_to_cpu(resp->size));
622 624
623 nr_subband = (domain->header.len - 3) / sizeof(struct ieeetypes_subbandset); 625 nr_subband = (le16_to_cpu(domain->header.len) - COUNTRY_CODE_LEN) /
624 /* countrycode 3 bytes */ 626 sizeof(struct ieeetypes_subbandset);
625 627
626 lbs_pr_debug(1, "11D Domain Info Resp: nr_subband=%d\n", nr_subband); 628 lbs_deb_11d("11D Domain Info Resp: nr_subband=%d\n", nr_subband);
627 629
628 if (nr_subband > MRVDRV_MAX_SUBBAND_802_11D) { 630 if (nr_subband > MRVDRV_MAX_SUBBAND_802_11D) {
629 lbs_pr_debug(1, "Invalid Numrer of Subband returned!!\n"); 631 lbs_deb_11d("Invalid Numrer of Subband returned!!\n");
630 return -1; 632 return -1;
631 } 633 }
632 634
@@ -637,12 +639,12 @@ int libertas_ret_802_11d_domain_info(wlan_private * priv,
637 case cmd_act_get: 639 case cmd_act_get:
638 break; 640 break;
639 default: 641 default:
640 lbs_pr_debug(1, "Invalid action:%d\n", domaininfo->action); 642 lbs_deb_11d("Invalid action:%d\n", domaininfo->action);
641 ret = -1; 643 ret = -1;
642 break; 644 break;
643 } 645 }
644 646
645 LEAVE(); 647 lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret);
646 return ret; 648 return ret;
647} 649}
648 650
@@ -651,23 +653,22 @@ int libertas_ret_802_11d_domain_info(wlan_private * priv,
651 * @param priv pointer to wlan_private 653 * @param priv pointer to wlan_private
652 * @return 0; -1 654 * @return 0; -1
653 */ 655 */
654int libertas_parse_dnld_countryinfo_11d(wlan_private * priv) 656int libertas_parse_dnld_countryinfo_11d(wlan_private * priv,
657 struct bss_descriptor * bss)
655{ 658{
656 int ret; 659 int ret;
657 wlan_adapter *adapter = priv->adapter; 660 wlan_adapter *adapter = priv->adapter;
658 661
659 ENTER(); 662 lbs_deb_enter(LBS_DEB_11D);
660 if (priv->adapter->enable11d) { 663 if (priv->adapter->enable11d) {
661 memset(&adapter->parsed_region_chan, 0, 664 memset(&adapter->parsed_region_chan, 0,
662 sizeof(struct parsed_region_chan_11d)); 665 sizeof(struct parsed_region_chan_11d));
663 ret = parse_domain_info_11d(&adapter->pattemptedbssdesc-> 666 ret = parse_domain_info_11d(&bss->countryinfo, 0,
664 countryinfo, 0,
665 &adapter->parsed_region_chan); 667 &adapter->parsed_region_chan);
666 668
667 if (ret == -1) { 669 if (ret == -1) {
668 lbs_pr_debug(1, "11D: Err Parse domain_info from AP..\n"); 670 lbs_deb_11d("11D: Err Parse domain_info from AP..\n");
669 LEAVE(); 671 goto done;
670 return ret;
671 } 672 }
672 673
673 memset(&adapter->domainreg, 0, 674 memset(&adapter->domainreg, 0,
@@ -678,13 +679,15 @@ int libertas_parse_dnld_countryinfo_11d(wlan_private * priv)
678 ret = set_domain_info_11d(priv); 679 ret = set_domain_info_11d(priv);
679 680
680 if (ret) { 681 if (ret) {
681 lbs_pr_debug(1, "11D: Err set domainInfo to FW\n"); 682 lbs_deb_11d("11D: Err set domainInfo to FW\n");
682 LEAVE(); 683 goto done;
683 return ret;
684 } 684 }
685 } 685 }
686 LEAVE(); 686 ret = 0;
687 return 0; 687
688done:
689 lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret);
690 return ret;
688} 691}
689 692
690/** 693/**
@@ -699,8 +702,8 @@ int libertas_create_dnld_countryinfo_11d(wlan_private * priv)
699 struct region_channel *region_chan; 702 struct region_channel *region_chan;
700 u8 j; 703 u8 j;
701 704
702 ENTER(); 705 lbs_deb_enter(LBS_DEB_11D);
703 lbs_pr_debug(1, "11D:curbssparams.band[%d]\n", adapter->curbssparams.band); 706 lbs_deb_11d("11D:curbssparams.band[%d]\n", adapter->curbssparams.band);
704 707
705 if (priv->adapter->enable11d) { 708 if (priv->adapter->enable11d) {
706 /* update parsed_region_chan_11; dnld domaininf to FW */ 709 /* update parsed_region_chan_11; dnld domaininf to FW */
@@ -709,7 +712,7 @@ int libertas_create_dnld_countryinfo_11d(wlan_private * priv)
709 sizeof(adapter->region_channel[0]); j++) { 712 sizeof(adapter->region_channel[0]); j++) {
710 region_chan = &adapter->region_channel[j]; 713 region_chan = &adapter->region_channel[j];
711 714
712 lbs_pr_debug(1, "11D:[%d] region_chan->band[%d]\n", j, 715 lbs_deb_11d("11D:[%d] region_chan->band[%d]\n", j,
713 region_chan->band); 716 region_chan->band);
714 717
715 if (!region_chan || !region_chan->valid 718 if (!region_chan || !region_chan->valid
@@ -722,10 +725,10 @@ int libertas_create_dnld_countryinfo_11d(wlan_private * priv)
722 725
723 if (j >= sizeof(adapter->region_channel) / 726 if (j >= sizeof(adapter->region_channel) /
724 sizeof(adapter->region_channel[0])) { 727 sizeof(adapter->region_channel[0])) {
725 lbs_pr_debug(1, "11D:region_chan not found. band[%d]\n", 728 lbs_deb_11d("11D:region_chan not found. band[%d]\n",
726 adapter->curbssparams.band); 729 adapter->curbssparams.band);
727 LEAVE(); 730 ret = -1;
728 return -1; 731 goto done;
729 } 732 }
730 733
731 memset(&adapter->parsed_region_chan, 0, 734 memset(&adapter->parsed_region_chan, 0,
@@ -742,13 +745,14 @@ int libertas_create_dnld_countryinfo_11d(wlan_private * priv)
742 ret = set_domain_info_11d(priv); 745 ret = set_domain_info_11d(priv);
743 746
744 if (ret) { 747 if (ret) {
745 lbs_pr_debug(1, "11D: Err set domainInfo to FW\n"); 748 lbs_deb_11d("11D: Err set domainInfo to FW\n");
746 LEAVE(); 749 goto done;
747 return ret;
748 } 750 }
749 751
750 } 752 }
753 ret = 0;
751 754
752 LEAVE(); 755done:
753 return 0; 756 lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret);
757 return ret;
754} 758}
diff --git a/drivers/net/wireless/libertas/11d.h b/drivers/net/wireless/libertas/11d.h
index db2ebea9f231..73e42e712911 100644
--- a/drivers/net/wireless/libertas/11d.h
+++ b/drivers/net/wireless/libertas/11d.h
@@ -47,7 +47,7 @@ struct mrvlietypes_domainparamset {
47} __attribute__ ((packed)); 47} __attribute__ ((packed));
48 48
49struct cmd_ds_802_11d_domain_info { 49struct cmd_ds_802_11d_domain_info {
50 u16 action; 50 __le16 action;
51 struct mrvlietypes_domainparamset domain; 51 struct mrvlietypes_domainparamset domain;
52} __attribute__ ((packed)); 52} __attribute__ ((packed));
53 53
@@ -98,7 +98,9 @@ int libertas_cmd_enable_11d(wlan_private * priv, struct iwreq *wrq);
98int libertas_ret_802_11d_domain_info(wlan_private * priv, 98int libertas_ret_802_11d_domain_info(wlan_private * priv,
99 struct cmd_ds_command *resp); 99 struct cmd_ds_command *resp);
100 100
101int libertas_parse_dnld_countryinfo_11d(wlan_private * priv); 101struct bss_descriptor;
102int libertas_parse_dnld_countryinfo_11d(wlan_private * priv,
103 struct bss_descriptor * bss);
102 104
103int libertas_create_dnld_countryinfo_11d(wlan_private * priv); 105int libertas_create_dnld_countryinfo_11d(wlan_private * priv);
104 106
diff --git a/drivers/net/wireless/libertas/Makefile b/drivers/net/wireless/libertas/Makefile
index 56a8ea1fbf04..a1097f59fd46 100644
--- a/drivers/net/wireless/libertas/Makefile
+++ b/drivers/net/wireless/libertas/Makefile
@@ -1,4 +1,4 @@
1usb8xxx-objs := main.o fw.o wext.o \ 1libertas-objs := main.o fw.o wext.o \
2 rx.o tx.o cmd.o \ 2 rx.o tx.o cmd.o \
3 cmdresp.o scan.o \ 3 cmdresp.o scan.o \
4 join.o 11d.o \ 4 join.o 11d.o \
@@ -8,5 +8,5 @@ usb8xxx-objs := main.o fw.o wext.o \
8usb8xxx-objs += if_bootcmd.o 8usb8xxx-objs += if_bootcmd.o
9usb8xxx-objs += if_usb.o 9usb8xxx-objs += if_usb.o
10 10
11obj-$(CONFIG_LIBERTAS) += libertas.o
11obj-$(CONFIG_LIBERTAS_USB) += usb8xxx.o 12obj-$(CONFIG_LIBERTAS_USB) += usb8xxx.o
12
diff --git a/drivers/net/wireless/libertas/README b/drivers/net/wireless/libertas/README
index 378577200b56..1f92f50b643c 100644
--- a/drivers/net/wireless/libertas/README
+++ b/drivers/net/wireless/libertas/README
@@ -1,7 +1,7 @@
1================================================================================ 1================================================================================
2 README for USB8388 2 README for USB8388
3 3
4 (c) Copyright © 2003-2006, Marvell International Ltd. 4 (c) Copyright © 2003-2006, Marvell International Ltd.
5 All Rights Reserved 5 All Rights Reserved
6 6
7 This software file (the "File") is distributed by Marvell International 7 This software file (the "File") is distributed by Marvell International
@@ -47,15 +47,19 @@ Version 5 Command:
47 iwpriv ethX ledgpio <n> 47 iwpriv ethX ledgpio <n>
48 48
49BT Commands: 49BT Commands:
50 The blinding table (BT) contains a list of mac addresses that should be 50 The blinding table (BT) contains a list of mac addresses that will be,
51 ignored by the firmware. It is primarily used for debugging and 51 by default, ignored by the firmware. It is also possible to invert this
52 testing networks. It can be edited and inspected with the following 52 behavior so that we will ignore all traffic except for the portion
53 commands: 53 coming from mac addresess in the list. It is primarily used for
54 debugging and testing networks. It can be edited and inspected with
55 the following commands:
54 56
55 iwpriv ethX bt_reset 57 iwpriv ethX bt_reset
56 iwpriv ethX bt_add <mac_address> 58 iwpriv ethX bt_add <mac_address>
57 iwpriv ethX bt_del <mac_address> 59 iwpriv ethX bt_del <mac_address>
58 iwpriv ethX bt_list <id> 60 iwpriv ethX bt_list <id>
61 iwpriv ethX bt_get_invert <n>
62 iwpriv ethX bt_set_invert <n>
59 63
60FWT Commands: 64FWT Commands:
61 The forwarding table (FWT) is a feature used to manage mesh network 65 The forwarding table (FWT) is a feature used to manage mesh network
@@ -135,7 +139,7 @@ fwt_add
135 This command is used to insert an entry into the FWT table. The list of 139 This command is used to insert an entry into the FWT table. The list of
136 parameters must follow the following structure: 140 parameters must follow the following structure:
137 141
138 iwpriv ethX fwt_add da ra [metric dir ssn dsn hopcount ttl expiration sleepmode snr] 142 iwpriv ethX fwt_add da ra [metric dir rate ssn dsn hopcount ttl expiration sleepmode snr]
139 143
140 The parameters between brackets are optional, but they must appear in 144 The parameters between brackets are optional, but they must appear in
141 the order specified. For example, if you want to specify the metric, 145 the order specified. For example, if you want to specify the metric,
@@ -150,6 +154,9 @@ fwt_add
150 preferred, default is 0) 154 preferred, default is 0)
151 dir -- direction (1 for direct, 0 for reverse, 155 dir -- direction (1 for direct, 0 for reverse,
152 default is 1) 156 default is 1)
157 rate -- data rate used for transmission to the RA,
158 as specified for the rateadapt command,
159 default is 3 (11Mbps)
153 ssn -- Source Sequence Number (time at the RA for 160 ssn -- Source Sequence Number (time at the RA for
154 reverse routes. Default is 0) 161 reverse routes. Default is 0)
155 dsn -- Destination Sequence Number (time at the DA 162 dsn -- Destination Sequence Number (time at the DA
@@ -207,13 +214,17 @@ fwt_list
207 214
208 The output is a string of the following form: 215 The output is a string of the following form:
209 216
210 da ra metric dir ssn dsn hopcount ttl expiration sleepmode snr 217 da ra valid metric dir rate ssn dsn hopcount ttl expiration
218 sleepmode snr precursor
211 219
212 where the different fields are:- 220 where the different fields are:-
213 da -- DA MAC address (in the form "00:11:22:33:44:55") 221 da -- DA MAC address (in the form "00:11:22:33:44:55")
214 ra -- RA MAC address (in the form "00:11:22:33:44:55") 222 ra -- RA MAC address (in the form "00:11:22:33:44:55")
223 valid -- whether the route is valid (0 if not valid)
215 metric -- route metric (cost: smaller-metric routes are preferred) 224 metric -- route metric (cost: smaller-metric routes are preferred)
216 dir -- direction (1 for direct, 0 for reverse) 225 dir -- direction (1 for direct, 0 for reverse)
226 rate -- data rate used for transmission to the RA,
227 as specified for the rateadapt command
217 ssn -- Source Sequence Number (time at the RA for reverse routes) 228 ssn -- Source Sequence Number (time at the RA for reverse routes)
218 dsn -- Destination Sequence Number (time at the DA for direct routes) 229 dsn -- Destination Sequence Number (time at the DA for direct routes)
219 hopcount -- hop count (currently unused) 230 hopcount -- hop count (currently unused)
@@ -221,33 +232,10 @@ fwt_list
221 expiration -- entry expiration (in ticks, where a tick is 1024us, or ~ 1ms. Use 0 for an indefinite entry) 232 expiration -- entry expiration (in ticks, where a tick is 1024us, or ~ 1ms. Use 0 for an indefinite entry)
222 sleepmode -- RA's sleep mode (currently unused) 233 sleepmode -- RA's sleep mode (currently unused)
223 snr -- SNR in the link to RA (currently unused) 234 snr -- SNR in the link to RA (currently unused)
235 precursor -- predecessor in direct routes
224 236
225fwt_list_route 237fwt_list_route
226 This command is used to list a route from the FWT table. The only 238 This command is equivalent to fwt_list.
227 parameter is the route ID. If you want to list all the routes in a
228 table, start with rid=0, and keep incrementing rid until you get a
229 "(null)" string. This function is similar to fwt_list. The only
230 difference is the output format. Also note that this command is meant
231 for debugging. It is expected that users will use fwt_lookup and
232 fwt_list. One important reason for this is that the route id may change
233 as the route table is altered.
234
235 iwpriv ethX fwt_list_route rid
236
237 The output is a string of the following form:
238
239 da metric dir nid ssn dsn hopcount ttl expiration
240
241 where the different fields are:-
242 da -- DA MAC address (in the form "00:11:22:33:44:55")
243 metric -- route metric (cost: smaller-metric routes are preferred)
244 dir -- direction (1 for direct, 0 for reverse)
245 nid -- Next-hop (neighbor) host ID (nid)
246 ssn -- Source Sequence Number (time at the RA for reverse routes)
247 dsn -- Destination Sequence Number (time at the DA for direct routes)
248 hopcount -- hop count (currently unused)
249 ttl -- TTL count (only used in reverse entries)
250 expiration -- entry expiration (in ticks, where a tick is 1024us, or ~ 1ms. Use 0 for an indefinite entry)
251 239
252fwt_list_neigh 240fwt_list_neigh
253 This command is used to list a neighbor from the FWT table. The only 241 This command is used to list a neighbor from the FWT table. The only
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c
index c260bd1b3d46..f67efa0815fe 100644
--- a/drivers/net/wireless/libertas/assoc.c
+++ b/drivers/net/wireless/libertas/assoc.c
@@ -2,6 +2,7 @@
2 2
3#include <linux/bitops.h> 3#include <linux/bitops.h>
4#include <net/ieee80211.h> 4#include <net/ieee80211.h>
5#include <linux/etherdevice.h>
5 6
6#include "assoc.h" 7#include "assoc.h"
7#include "join.h" 8#include "join.h"
@@ -13,59 +14,88 @@
13static const u8 bssid_any[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; 14static const u8 bssid_any[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
14static const u8 bssid_off[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; 15static const u8 bssid_off[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
15 16
17static void print_assoc_req(const char * extra, struct assoc_request * assoc_req)
18{
19 lbs_deb_assoc(
20 "#### Association Request: %s\n"
21 " flags: 0x%08lX\n"
22 " SSID: '%s'\n"
23 " channel: %d\n"
24 " band: %d\n"
25 " mode: %d\n"
26 " BSSID: " MAC_FMT "\n"
27 " Encryption:%s%s%s\n"
28 " auth: %d\n",
29 extra, assoc_req->flags,
30 escape_essid(assoc_req->ssid, assoc_req->ssid_len),
31 assoc_req->channel, assoc_req->band, assoc_req->mode,
32 MAC_ARG(assoc_req->bssid),
33 assoc_req->secinfo.WPAenabled ? " WPA" : "",
34 assoc_req->secinfo.WPA2enabled ? " WPA2" : "",
35 assoc_req->secinfo.wep_enabled ? " WEP" : "",
36 assoc_req->secinfo.auth_mode);
37}
38
39
16static int assoc_helper_essid(wlan_private *priv, 40static int assoc_helper_essid(wlan_private *priv,
17 struct assoc_request * assoc_req) 41 struct assoc_request * assoc_req)
18{ 42{
19 wlan_adapter *adapter = priv->adapter; 43 wlan_adapter *adapter = priv->adapter;
20 int ret = 0; 44 int ret = 0;
21 int i; 45 struct bss_descriptor * bss;
46 int channel = -1;
22 47
23 ENTER(); 48 lbs_deb_enter(LBS_DEB_ASSOC);
24 49
25 lbs_pr_debug(1, "New SSID requested: %s\n", assoc_req->ssid.ssid); 50 /* FIXME: take channel into account when picking SSIDs if a channel
51 * is set.
52 */
53
54 if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags))
55 channel = assoc_req->channel;
56
57 lbs_deb_assoc("New SSID requested: '%s'\n",
58 escape_essid(assoc_req->ssid, assoc_req->ssid_len));
26 if (assoc_req->mode == IW_MODE_INFRA) { 59 if (assoc_req->mode == IW_MODE_INFRA) {
27 if (adapter->prescan) { 60 if (adapter->prescan) {
28 libertas_send_specific_SSID_scan(priv, &assoc_req->ssid, 1); 61 libertas_send_specific_ssid_scan(priv, assoc_req->ssid,
62 assoc_req->ssid_len, 0);
29 } 63 }
30 64
31 i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid, 65 bss = libertas_find_ssid_in_list(adapter, assoc_req->ssid,
32 NULL, IW_MODE_INFRA); 66 assoc_req->ssid_len, NULL, IW_MODE_INFRA, channel);
33 if (i >= 0) { 67 if (bss != NULL) {
34 lbs_pr_debug(1, 68 lbs_deb_assoc("SSID found in scan list, associating\n");
35 "SSID found in scan list ... associating...\n"); 69 memcpy(&assoc_req->bss, bss, sizeof(struct bss_descriptor));
36 70 ret = wlan_associate(priv, assoc_req);
37 ret = wlan_associate(priv, &adapter->scantable[i]);
38 if (ret == 0) {
39 memcpy(&assoc_req->bssid,
40 &adapter->scantable[i].macaddress,
41 ETH_ALEN);
42 }
43 } else { 71 } else {
44 lbs_pr_debug(1, "SSID '%s' not found; cannot associate\n", 72 lbs_deb_assoc("SSID not found; cannot associate\n");
45 assoc_req->ssid.ssid);
46 } 73 }
47 } else if (assoc_req->mode == IW_MODE_ADHOC) { 74 } else if (assoc_req->mode == IW_MODE_ADHOC) {
48 /* Scan for the network, do not save previous results. Stale 75 /* Scan for the network, do not save previous results. Stale
49 * scan data will cause us to join a non-existant adhoc network 76 * scan data will cause us to join a non-existant adhoc network
50 */ 77 */
51 libertas_send_specific_SSID_scan(priv, &assoc_req->ssid, 0); 78 libertas_send_specific_ssid_scan(priv, assoc_req->ssid,
79 assoc_req->ssid_len, 1);
52 80
53 /* Search for the requested SSID in the scan table */ 81 /* Search for the requested SSID in the scan table */
54 i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid, NULL, 82 bss = libertas_find_ssid_in_list(adapter, assoc_req->ssid,
55 IW_MODE_ADHOC); 83 assoc_req->ssid_len, NULL, IW_MODE_ADHOC, channel);
56 if (i >= 0) { 84 if (bss != NULL) {
57 lbs_pr_debug(1, "SSID found at %d in List, so join\n", ret); 85 lbs_deb_assoc("SSID found, will join\n");
58 libertas_join_adhoc_network(priv, &adapter->scantable[i]); 86 memcpy(&assoc_req->bss, bss, sizeof(struct bss_descriptor));
87 libertas_join_adhoc_network(priv, assoc_req);
59 } else { 88 } else {
60 /* else send START command */ 89 /* else send START command */
61 lbs_pr_debug(1, "SSID not found in list, so creating adhoc" 90 lbs_deb_assoc("SSID not found, creating adhoc network\n");
62 " with SSID '%s'\n", assoc_req->ssid.ssid); 91 memcpy(&assoc_req->bss.ssid, &assoc_req->ssid,
63 libertas_start_adhoc_network(priv, &assoc_req->ssid); 92 IW_ESSID_MAX_SIZE);
93 assoc_req->bss.ssid_len = assoc_req->ssid_len;
94 libertas_start_adhoc_network(priv, assoc_req);
64 } 95 }
65 memcpy(&assoc_req->bssid, &adapter->current_addr, ETH_ALEN);
66 } 96 }
67 97
68 LEAVE(); 98 lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
69 return ret; 99 return ret;
70} 100}
71 101
@@ -74,33 +104,31 @@ static int assoc_helper_bssid(wlan_private *priv,
74 struct assoc_request * assoc_req) 104 struct assoc_request * assoc_req)
75{ 105{
76 wlan_adapter *adapter = priv->adapter; 106 wlan_adapter *adapter = priv->adapter;
77 int i, ret = 0; 107 int ret = 0;
78 108 struct bss_descriptor * bss;
79 ENTER();
80 109
81 lbs_pr_debug(1, "ASSOC: WAP: BSSID = " MAC_FMT "\n", 110 lbs_deb_enter_args(LBS_DEB_ASSOC, "BSSID " MAC_FMT,
82 MAC_ARG(assoc_req->bssid)); 111 MAC_ARG(assoc_req->bssid));
83 112
84 /* Search for index position in list for requested MAC */ 113 /* Search for index position in list for requested MAC */
85 i = libertas_find_BSSID_in_list(adapter, assoc_req->bssid, 114 bss = libertas_find_bssid_in_list(adapter, assoc_req->bssid,
86 assoc_req->mode); 115 assoc_req->mode);
87 if (i < 0) { 116 if (bss == NULL) {
88 lbs_pr_debug(1, "ASSOC: WAP: BSSID " MAC_FMT " not found, " 117 lbs_deb_assoc("ASSOC: WAP: BSSID " MAC_FMT " not found, "
89 "cannot associate.\n", MAC_ARG(assoc_req->bssid)); 118 "cannot associate.\n", MAC_ARG(assoc_req->bssid));
90 goto out; 119 goto out;
91 } 120 }
92 121
122 memcpy(&assoc_req->bss, bss, sizeof(struct bss_descriptor));
93 if (assoc_req->mode == IW_MODE_INFRA) { 123 if (assoc_req->mode == IW_MODE_INFRA) {
94 ret = wlan_associate(priv, &adapter->scantable[i]); 124 ret = wlan_associate(priv, assoc_req);
95 lbs_pr_debug(1, "ASSOC: return from wlan_associate(bssd) was %d\n", ret); 125 lbs_deb_assoc("ASSOC: wlan_associate(bssid) returned %d\n", ret);
96 } else if (assoc_req->mode == IW_MODE_ADHOC) { 126 } else if (assoc_req->mode == IW_MODE_ADHOC) {
97 libertas_join_adhoc_network(priv, &adapter->scantable[i]); 127 libertas_join_adhoc_network(priv, assoc_req);
98 } 128 }
99 memcpy(&assoc_req->ssid, &adapter->scantable[i].ssid,
100 sizeof(struct WLAN_802_11_SSID));
101 129
102out: 130out:
103 LEAVE(); 131 lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
104 return ret; 132 return ret;
105} 133}
106 134
@@ -113,12 +141,12 @@ static int assoc_helper_associate(wlan_private *priv,
113 /* If we're given and 'any' BSSID, try associating based on SSID */ 141 /* If we're given and 'any' BSSID, try associating based on SSID */
114 142
115 if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) { 143 if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) {
116 if (memcmp(bssid_any, assoc_req->bssid, ETH_ALEN) 144 if (compare_ether_addr(bssid_any, assoc_req->bssid)
117 && memcmp(bssid_off, assoc_req->bssid, ETH_ALEN)) { 145 && compare_ether_addr(bssid_off, assoc_req->bssid)) {
118 ret = assoc_helper_bssid(priv, assoc_req); 146 ret = assoc_helper_bssid(priv, assoc_req);
119 done = 1; 147 done = 1;
120 if (ret) { 148 if (ret) {
121 lbs_pr_debug(1, "ASSOC: bssid: ret = %d\n", ret); 149 lbs_deb_assoc("ASSOC: bssid: ret = %d\n", ret);
122 } 150 }
123 } 151 }
124 } 152 }
@@ -126,7 +154,7 @@ static int assoc_helper_associate(wlan_private *priv,
126 if (!done && test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) { 154 if (!done && test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) {
127 ret = assoc_helper_essid(priv, assoc_req); 155 ret = assoc_helper_essid(priv, assoc_req);
128 if (ret) { 156 if (ret) {
129 lbs_pr_debug(1, "ASSOC: bssid: ret = %d\n", ret); 157 lbs_deb_assoc("ASSOC: bssid: ret = %d\n", ret);
130 } 158 }
131 } 159 }
132 160
@@ -140,12 +168,10 @@ static int assoc_helper_mode(wlan_private *priv,
140 wlan_adapter *adapter = priv->adapter; 168 wlan_adapter *adapter = priv->adapter;
141 int ret = 0; 169 int ret = 0;
142 170
143 ENTER(); 171 lbs_deb_enter(LBS_DEB_ASSOC);
144 172
145 if (assoc_req->mode == adapter->mode) { 173 if (assoc_req->mode == adapter->mode)
146 LEAVE(); 174 goto done;
147 return 0;
148 }
149 175
150 if (assoc_req->mode == IW_MODE_INFRA) { 176 if (assoc_req->mode == IW_MODE_INFRA) {
151 if (adapter->psstate != PS_STATE_FULL_POWER) 177 if (adapter->psstate != PS_STATE_FULL_POWER)
@@ -158,9 +184,81 @@ static int assoc_helper_mode(wlan_private *priv,
158 cmd_802_11_snmp_mib, 184 cmd_802_11_snmp_mib,
159 0, cmd_option_waitforrsp, 185 0, cmd_option_waitforrsp,
160 OID_802_11_INFRASTRUCTURE_MODE, 186 OID_802_11_INFRASTRUCTURE_MODE,
161 (void *) (size_t) assoc_req->mode); 187 /* Shoot me now */ (void *) (size_t) assoc_req->mode);
162 188
163 LEAVE(); 189done:
190 lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
191 return ret;
192}
193
194
195static int update_channel(wlan_private * priv)
196{
197 /* the channel in f/w could be out of sync, get the current channel */
198 return libertas_prepare_and_send_command(priv, cmd_802_11_rf_channel,
199 cmd_opt_802_11_rf_channel_get,
200 cmd_option_waitforrsp, 0, NULL);
201}
202
203void libertas_sync_channel(struct work_struct *work)
204{
205 wlan_private *priv = container_of(work, wlan_private, sync_channel);
206
207 if (update_channel(priv) != 0)
208 lbs_pr_info("Channel synchronization failed.");
209}
210
211static int assoc_helper_channel(wlan_private *priv,
212 struct assoc_request * assoc_req)
213{
214 wlan_adapter *adapter = priv->adapter;
215 int ret = 0;
216
217 lbs_deb_enter(LBS_DEB_ASSOC);
218
219 ret = update_channel(priv);
220 if (ret < 0) {
221 lbs_deb_assoc("ASSOC: channel: error getting channel.");
222 }
223
224 if (assoc_req->channel == adapter->curbssparams.channel)
225 goto done;
226
227 lbs_deb_assoc("ASSOC: channel: %d -> %d\n",
228 adapter->curbssparams.channel, assoc_req->channel);
229
230 ret = libertas_prepare_and_send_command(priv, cmd_802_11_rf_channel,
231 cmd_opt_802_11_rf_channel_set,
232 cmd_option_waitforrsp, 0, &assoc_req->channel);
233 if (ret < 0) {
234 lbs_deb_assoc("ASSOC: channel: error setting channel.");
235 }
236
237 ret = update_channel(priv);
238 if (ret < 0) {
239 lbs_deb_assoc("ASSOC: channel: error getting channel.");
240 }
241
242 if (assoc_req->channel != adapter->curbssparams.channel) {
243 lbs_deb_assoc("ASSOC: channel: failed to update channel to %d",
244 assoc_req->channel);
245 goto done;
246 }
247
248 if ( assoc_req->secinfo.wep_enabled
249 && (assoc_req->wep_keys[0].len
250 || assoc_req->wep_keys[1].len
251 || assoc_req->wep_keys[2].len
252 || assoc_req->wep_keys[3].len)) {
253 /* Make sure WEP keys are re-sent to firmware */
254 set_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags);
255 }
256
257 /* Must restart/rejoin adhoc networks after channel change */
258 set_bit(ASSOC_FLAG_SSID, &assoc_req->flags);
259
260done:
261 lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
164 return ret; 262 return ret;
165} 263}
166 264
@@ -172,7 +270,7 @@ static int assoc_helper_wep_keys(wlan_private *priv,
172 int i; 270 int i;
173 int ret = 0; 271 int ret = 0;
174 272
175 ENTER(); 273 lbs_deb_enter(LBS_DEB_ASSOC);
176 274
177 /* Set or remove WEP keys */ 275 /* Set or remove WEP keys */
178 if ( assoc_req->wep_keys[0].len 276 if ( assoc_req->wep_keys[0].len
@@ -216,7 +314,7 @@ static int assoc_helper_wep_keys(wlan_private *priv,
216 mutex_unlock(&adapter->lock); 314 mutex_unlock(&adapter->lock);
217 315
218out: 316out:
219 LEAVE(); 317 lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
220 return ret; 318 return ret;
221} 319}
222 320
@@ -226,14 +324,24 @@ static int assoc_helper_secinfo(wlan_private *priv,
226 wlan_adapter *adapter = priv->adapter; 324 wlan_adapter *adapter = priv->adapter;
227 int ret = 0; 325 int ret = 0;
228 326
229 ENTER(); 327 lbs_deb_enter(LBS_DEB_ASSOC);
230 328
231 memcpy(&adapter->secinfo, &assoc_req->secinfo, 329 memcpy(&adapter->secinfo, &assoc_req->secinfo,
232 sizeof(struct wlan_802_11_security)); 330 sizeof(struct wlan_802_11_security));
233 331
234 ret = libertas_set_mac_packet_filter(priv); 332 ret = libertas_set_mac_packet_filter(priv);
333 if (ret)
334 goto out;
235 335
236 LEAVE(); 336 /* enable/disable RSN */
337 ret = libertas_prepare_and_send_command(priv,
338 cmd_802_11_enable_rsn,
339 cmd_act_set,
340 cmd_option_waitforrsp,
341 0, assoc_req);
342
343out:
344 lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
237 return ret; 345 return ret;
238} 346}
239 347
@@ -243,16 +351,7 @@ static int assoc_helper_wpa_keys(wlan_private *priv,
243{ 351{
244 int ret = 0; 352 int ret = 0;
245 353
246 ENTER(); 354 lbs_deb_enter(LBS_DEB_ASSOC);
247
248 /* enable/Disable RSN */
249 ret = libertas_prepare_and_send_command(priv,
250 cmd_802_11_enable_rsn,
251 cmd_act_set,
252 cmd_option_waitforrsp,
253 0, assoc_req);
254 if (ret)
255 goto out;
256 355
257 ret = libertas_prepare_and_send_command(priv, 356 ret = libertas_prepare_and_send_command(priv,
258 cmd_802_11_key_material, 357 cmd_802_11_key_material,
@@ -260,8 +359,7 @@ static int assoc_helper_wpa_keys(wlan_private *priv,
260 cmd_option_waitforrsp, 359 cmd_option_waitforrsp,
261 0, assoc_req); 360 0, assoc_req);
262 361
263out: 362 lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
264 LEAVE();
265 return ret; 363 return ret;
266} 364}
267 365
@@ -272,7 +370,7 @@ static int assoc_helper_wpa_ie(wlan_private *priv,
272 wlan_adapter *adapter = priv->adapter; 370 wlan_adapter *adapter = priv->adapter;
273 int ret = 0; 371 int ret = 0;
274 372
275 ENTER(); 373 lbs_deb_enter(LBS_DEB_ASSOC);
276 374
277 if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) { 375 if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) {
278 memcpy(&adapter->wpa_ie, &assoc_req->wpa_ie, assoc_req->wpa_ie_len); 376 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,
282 adapter->wpa_ie_len = 0; 380 adapter->wpa_ie_len = 0;
283 } 381 }
284 382
285 LEAVE(); 383 lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
286 return ret; 384 return ret;
287} 385}
288 386
@@ -294,25 +392,30 @@ static int should_deauth_infrastructure(wlan_adapter *adapter,
294 return 0; 392 return 0;
295 393
296 if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) { 394 if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) {
297 lbs_pr_debug(1, "Deauthenticating due to new SSID in " 395 lbs_deb_assoc("Deauthenticating due to new SSID in "
298 " configuration request.\n"); 396 " configuration request.\n");
299 return 1; 397 return 1;
300 } 398 }
301 399
302 if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) { 400 if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) {
303 if (adapter->secinfo.auth_mode != assoc_req->secinfo.auth_mode) { 401 if (adapter->secinfo.auth_mode != assoc_req->secinfo.auth_mode) {
304 lbs_pr_debug(1, "Deauthenticating due to updated security " 402 lbs_deb_assoc("Deauthenticating due to updated security "
305 "info in configuration request.\n"); 403 "info in configuration request.\n");
306 return 1; 404 return 1;
307 } 405 }
308 } 406 }
309 407
310 if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) { 408 if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) {
311 lbs_pr_debug(1, "Deauthenticating due to new BSSID in " 409 lbs_deb_assoc("Deauthenticating due to new BSSID in "
312 " configuration request.\n"); 410 " configuration request.\n");
313 return 1; 411 return 1;
314 } 412 }
315 413
414 if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) {
415 lbs_deb_assoc("Deauthenticating due to channel switch.\n");
416 return 1;
417 }
418
316 /* FIXME: deal with 'auto' mode somehow */ 419 /* FIXME: deal with 'auto' mode somehow */
317 if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) { 420 if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) {
318 if (assoc_req->mode != IW_MODE_INFRA) 421 if (assoc_req->mode != IW_MODE_INFRA)
@@ -329,10 +432,9 @@ static int should_stop_adhoc(wlan_adapter *adapter,
329 if (adapter->connect_status != libertas_connected) 432 if (adapter->connect_status != libertas_connected)
330 return 0; 433 return 0;
331 434
332 if (adapter->curbssparams.ssid.ssidlength != assoc_req->ssid.ssidlength) 435 if (libertas_ssid_cmp(adapter->curbssparams.ssid,
333 return 1; 436 adapter->curbssparams.ssid_len,
334 if (memcmp(adapter->curbssparams.ssid.ssid, assoc_req->ssid.ssid, 437 assoc_req->ssid, assoc_req->ssid_len) != 0)
335 adapter->curbssparams.ssid.ssidlength))
336 return 1; 438 return 1;
337 439
338 /* FIXME: deal with 'auto' mode somehow */ 440 /* FIXME: deal with 'auto' mode somehow */
@@ -341,11 +443,16 @@ static int should_stop_adhoc(wlan_adapter *adapter,
341 return 1; 443 return 1;
342 } 444 }
343 445
446 if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) {
447 if (assoc_req->channel != adapter->curbssparams.channel)
448 return 1;
449 }
450
344 return 0; 451 return 0;
345} 452}
346 453
347 454
348void wlan_association_worker(struct work_struct *work) 455void libertas_association_worker(struct work_struct *work)
349{ 456{
350 wlan_private *priv = container_of(work, wlan_private, assoc_work.work); 457 wlan_private *priv = container_of(work, wlan_private, assoc_work.work);
351 wlan_adapter *adapter = priv->adapter; 458 wlan_adapter *adapter = priv->adapter;
@@ -353,40 +460,38 @@ void wlan_association_worker(struct work_struct *work)
353 int ret = 0; 460 int ret = 0;
354 int find_any_ssid = 0; 461 int find_any_ssid = 0;
355 462
356 ENTER(); 463 lbs_deb_enter(LBS_DEB_ASSOC);
357 464
358 mutex_lock(&adapter->lock); 465 mutex_lock(&adapter->lock);
359 assoc_req = adapter->assoc_req; 466 assoc_req = adapter->pending_assoc_req;
360 adapter->assoc_req = NULL; 467 adapter->pending_assoc_req = NULL;
468 adapter->in_progress_assoc_req = assoc_req;
361 mutex_unlock(&adapter->lock); 469 mutex_unlock(&adapter->lock);
362 470
363 if (!assoc_req) { 471 if (!assoc_req)
364 LEAVE(); 472 goto done;
365 return;
366 }
367 473
368 lbs_pr_debug(1, "ASSOC: starting new association request: flags = 0x%lX\n", 474 print_assoc_req(__func__, assoc_req);
369 assoc_req->flags);
370 475
371 /* If 'any' SSID was specified, find an SSID to associate with */ 476 /* If 'any' SSID was specified, find an SSID to associate with */
372 if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags) 477 if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)
373 && !assoc_req->ssid.ssidlength) 478 && !assoc_req->ssid_len)
374 find_any_ssid = 1; 479 find_any_ssid = 1;
375 480
376 /* But don't use 'any' SSID if there's a valid locked BSSID to use */ 481 /* But don't use 'any' SSID if there's a valid locked BSSID to use */
377 if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) { 482 if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) {
378 if (memcmp(&assoc_req->bssid, bssid_any, ETH_ALEN) 483 if (compare_ether_addr(assoc_req->bssid, bssid_any)
379 && memcmp(&assoc_req->bssid, bssid_off, ETH_ALEN)) 484 && compare_ether_addr(assoc_req->bssid, bssid_off))
380 find_any_ssid = 0; 485 find_any_ssid = 0;
381 } 486 }
382 487
383 if (find_any_ssid) { 488 if (find_any_ssid) {
384 u8 new_mode; 489 u8 new_mode;
385 490
386 ret = libertas_find_best_network_SSID(priv, &assoc_req->ssid, 491 ret = libertas_find_best_network_ssid(priv, assoc_req->ssid,
387 assoc_req->mode, &new_mode); 492 &assoc_req->ssid_len, assoc_req->mode, &new_mode);
388 if (ret) { 493 if (ret) {
389 lbs_pr_debug(1, "Could not find best network\n"); 494 lbs_deb_assoc("Could not find best network\n");
390 ret = -ENETUNREACH; 495 ret = -ENETUNREACH;
391 goto out; 496 goto out;
392 } 497 }
@@ -406,7 +511,7 @@ void wlan_association_worker(struct work_struct *work)
406 if (should_deauth_infrastructure(adapter, assoc_req)) { 511 if (should_deauth_infrastructure(adapter, assoc_req)) {
407 ret = libertas_send_deauthentication(priv); 512 ret = libertas_send_deauthentication(priv);
408 if (ret) { 513 if (ret) {
409 lbs_pr_debug(1, "Deauthentication due to new " 514 lbs_deb_assoc("Deauthentication due to new "
410 "configuration request failed: %d\n", 515 "configuration request failed: %d\n",
411 ret); 516 ret);
412 } 517 }
@@ -415,7 +520,7 @@ void wlan_association_worker(struct work_struct *work)
415 if (should_stop_adhoc(adapter, assoc_req)) { 520 if (should_stop_adhoc(adapter, assoc_req)) {
416 ret = libertas_stop_adhoc_network(priv); 521 ret = libertas_stop_adhoc_network(priv);
417 if (ret) { 522 if (ret) {
418 lbs_pr_debug(1, "Teardown of AdHoc network due to " 523 lbs_deb_assoc("Teardown of AdHoc network due to "
419 "new configuration request failed: %d\n", 524 "new configuration request failed: %d\n",
420 ret); 525 ret);
421 } 526 }
@@ -427,7 +532,16 @@ void wlan_association_worker(struct work_struct *work)
427 if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) { 532 if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) {
428 ret = assoc_helper_mode(priv, assoc_req); 533 ret = assoc_helper_mode(priv, assoc_req);
429 if (ret) { 534 if (ret) {
430lbs_pr_debug(1, "ASSOC(:%d) mode: ret = %d\n", __LINE__, ret); 535lbs_deb_assoc("ASSOC(:%d) mode: ret = %d\n", __LINE__, ret);
536 goto out;
537 }
538 }
539
540 if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) {
541 ret = assoc_helper_channel(priv, assoc_req);
542 if (ret) {
543 lbs_deb_assoc("ASSOC(:%d) channel: ret = %d\n",
544 __LINE__, ret);
431 goto out; 545 goto out;
432 } 546 }
433 } 547 }
@@ -436,7 +550,7 @@ lbs_pr_debug(1, "ASSOC(:%d) mode: ret = %d\n", __LINE__, ret);
436 || test_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags)) { 550 || test_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags)) {
437 ret = assoc_helper_wep_keys(priv, assoc_req); 551 ret = assoc_helper_wep_keys(priv, assoc_req);
438 if (ret) { 552 if (ret) {
439lbs_pr_debug(1, "ASSOC(:%d) wep_keys: ret = %d\n", __LINE__, ret); 553lbs_deb_assoc("ASSOC(:%d) wep_keys: ret = %d\n", __LINE__, ret);
440 goto out; 554 goto out;
441 } 555 }
442 } 556 }
@@ -444,7 +558,7 @@ lbs_pr_debug(1, "ASSOC(:%d) wep_keys: ret = %d\n", __LINE__, ret);
444 if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) { 558 if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) {
445 ret = assoc_helper_secinfo(priv, assoc_req); 559 ret = assoc_helper_secinfo(priv, assoc_req);
446 if (ret) { 560 if (ret) {
447lbs_pr_debug(1, "ASSOC(:%d) secinfo: ret = %d\n", __LINE__, ret); 561lbs_deb_assoc("ASSOC(:%d) secinfo: ret = %d\n", __LINE__, ret);
448 goto out; 562 goto out;
449 } 563 }
450 } 564 }
@@ -452,7 +566,7 @@ lbs_pr_debug(1, "ASSOC(:%d) secinfo: ret = %d\n", __LINE__, ret);
452 if (test_bit(ASSOC_FLAG_WPA_IE, &assoc_req->flags)) { 566 if (test_bit(ASSOC_FLAG_WPA_IE, &assoc_req->flags)) {
453 ret = assoc_helper_wpa_ie(priv, assoc_req); 567 ret = assoc_helper_wpa_ie(priv, assoc_req);
454 if (ret) { 568 if (ret) {
455lbs_pr_debug(1, "ASSOC(:%d) wpa_ie: ret = %d\n", __LINE__, ret); 569lbs_deb_assoc("ASSOC(:%d) wpa_ie: ret = %d\n", __LINE__, ret);
456 goto out; 570 goto out;
457 } 571 }
458 } 572 }
@@ -461,7 +575,7 @@ lbs_pr_debug(1, "ASSOC(:%d) wpa_ie: ret = %d\n", __LINE__, ret);
461 || test_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags)) { 575 || test_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags)) {
462 ret = assoc_helper_wpa_keys(priv, assoc_req); 576 ret = assoc_helper_wpa_keys(priv, assoc_req);
463 if (ret) { 577 if (ret) {
464lbs_pr_debug(1, "ASSOC(:%d) wpa_keys: ret = %d\n", __LINE__, ret); 578lbs_deb_assoc("ASSOC(:%d) wpa_keys: ret = %d\n", __LINE__, ret);
465 goto out; 579 goto out;
466 } 580 }
467 } 581 }
@@ -475,21 +589,23 @@ lbs_pr_debug(1, "ASSOC(:%d) wpa_keys: ret = %d\n", __LINE__, ret);
475 589
476 ret = assoc_helper_associate(priv, assoc_req); 590 ret = assoc_helper_associate(priv, assoc_req);
477 if (ret) { 591 if (ret) {
478 lbs_pr_debug(1, "ASSOC: association attempt unsuccessful: %d\n", 592 lbs_deb_assoc("ASSOC: association attempt unsuccessful: %d\n",
479 ret); 593 ret);
480 success = 0; 594 success = 0;
481 } 595 }
482 596
483 if (adapter->connect_status != libertas_connected) { 597 if (adapter->connect_status != libertas_connected) {
484 lbs_pr_debug(1, "ASSOC: assoication attempt unsuccessful, " 598 lbs_deb_assoc("ASSOC: assoication attempt unsuccessful, "
485 "not connected.\n"); 599 "not connected.\n");
486 success = 0; 600 success = 0;
487 } 601 }
488 602
489 if (success) { 603 if (success) {
490 lbs_pr_debug(1, "ASSOC: association attempt successful. " 604 lbs_deb_assoc("ASSOC: association attempt successful. "
491 "Associated to '%s' (" MAC_FMT ")\n", 605 "Associated to '%s' (" MAC_FMT ")\n",
492 assoc_req->ssid.ssid, MAC_ARG(assoc_req->bssid)); 606 escape_essid(adapter->curbssparams.ssid,
607 adapter->curbssparams.ssid_len),
608 MAC_ARG(adapter->curbssparams.bssid));
493 libertas_prepare_and_send_command(priv, 609 libertas_prepare_and_send_command(priv,
494 cmd_802_11_rssi, 610 cmd_802_11_rssi,
495 0, cmd_option_waitforrsp, 0, NULL); 611 0, cmd_option_waitforrsp, 0, NULL);
@@ -498,18 +614,23 @@ lbs_pr_debug(1, "ASSOC(:%d) wpa_keys: ret = %d\n", __LINE__, ret);
498 cmd_802_11_get_log, 614 cmd_802_11_get_log,
499 0, cmd_option_waitforrsp, 0, NULL); 615 0, cmd_option_waitforrsp, 0, NULL);
500 } else { 616 } else {
501
502 ret = -1; 617 ret = -1;
503 } 618 }
504 } 619 }
505 620
506out: 621out:
507 if (ret) { 622 if (ret) {
508 lbs_pr_debug(1, "ASSOC: reconfiguration attempt unsuccessful: %d\n", 623 lbs_deb_assoc("ASSOC: reconfiguration attempt unsuccessful: %d\n",
509 ret); 624 ret);
510 } 625 }
626
627 mutex_lock(&adapter->lock);
628 adapter->in_progress_assoc_req = NULL;
629 mutex_unlock(&adapter->lock);
511 kfree(assoc_req); 630 kfree(assoc_req);
512 LEAVE(); 631
632done:
633 lbs_deb_leave(LBS_DEB_ASSOC);
513} 634}
514 635
515 636
@@ -520,9 +641,10 @@ struct assoc_request * wlan_get_association_request(wlan_adapter *adapter)
520{ 641{
521 struct assoc_request * assoc_req; 642 struct assoc_request * assoc_req;
522 643
523 if (!adapter->assoc_req) { 644 if (!adapter->pending_assoc_req) {
524 adapter->assoc_req = kzalloc(sizeof(struct assoc_request), GFP_KERNEL); 645 adapter->pending_assoc_req = kzalloc(sizeof(struct assoc_request),
525 if (!adapter->assoc_req) { 646 GFP_KERNEL);
647 if (!adapter->pending_assoc_req) {
526 lbs_pr_info("Not enough memory to allocate association" 648 lbs_pr_info("Not enough memory to allocate association"
527 " request!\n"); 649 " request!\n");
528 return NULL; 650 return NULL;
@@ -532,15 +654,19 @@ struct assoc_request * wlan_get_association_request(wlan_adapter *adapter)
532 /* Copy current configuration attributes to the association request, 654 /* Copy current configuration attributes to the association request,
533 * but don't overwrite any that are already set. 655 * but don't overwrite any that are already set.
534 */ 656 */
535 assoc_req = adapter->assoc_req; 657 assoc_req = adapter->pending_assoc_req;
536 if (!test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) { 658 if (!test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) {
537 memcpy(&assoc_req->ssid, adapter->curbssparams.ssid.ssid, 659 memcpy(&assoc_req->ssid, &adapter->curbssparams.ssid,
538 adapter->curbssparams.ssid.ssidlength); 660 IW_ESSID_MAX_SIZE);
661 assoc_req->ssid_len = adapter->curbssparams.ssid_len;
539 } 662 }
540 663
541 if (!test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) 664 if (!test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags))
542 assoc_req->channel = adapter->curbssparams.channel; 665 assoc_req->channel = adapter->curbssparams.channel;
543 666
667 if (!test_bit(ASSOC_FLAG_BAND, &assoc_req->flags))
668 assoc_req->band = adapter->curbssparams.band;
669
544 if (!test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) 670 if (!test_bit(ASSOC_FLAG_MODE, &assoc_req->flags))
545 assoc_req->mode = adapter->mode; 671 assoc_req->mode = adapter->mode;
546 672
@@ -581,7 +707,7 @@ struct assoc_request * wlan_get_association_request(wlan_adapter *adapter)
581 assoc_req->wpa_ie_len = adapter->wpa_ie_len; 707 assoc_req->wpa_ie_len = adapter->wpa_ie_len;
582 } 708 }
583 709
710 print_assoc_req(__func__, assoc_req);
711
584 return assoc_req; 712 return assoc_req;
585} 713}
586
587
diff --git a/drivers/net/wireless/libertas/assoc.h b/drivers/net/wireless/libertas/assoc.h
index 2ffd82d99b34..5e9c31f0932b 100644
--- a/drivers/net/wireless/libertas/assoc.h
+++ b/drivers/net/wireless/libertas/assoc.h
@@ -5,10 +5,12 @@
5 5
6#include "dev.h" 6#include "dev.h"
7 7
8void wlan_association_worker(struct work_struct *work); 8void libertas_association_worker(struct work_struct *work);
9 9
10struct assoc_request * wlan_get_association_request(wlan_adapter *adapter); 10struct assoc_request * wlan_get_association_request(wlan_adapter *adapter);
11 11
12void libertas_sync_channel(struct work_struct *work);
13
12#define ASSOC_DELAY (HZ / 2) 14#define ASSOC_DELAY (HZ / 2)
13static inline void wlan_postpone_association_work(wlan_private *priv) 15static inline void wlan_postpone_association_work(wlan_private *priv)
14{ 16{
@@ -21,9 +23,9 @@ static inline void wlan_postpone_association_work(wlan_private *priv)
21static inline void wlan_cancel_association_work(wlan_private *priv) 23static inline void wlan_cancel_association_work(wlan_private *priv)
22{ 24{
23 cancel_delayed_work(&priv->assoc_work); 25 cancel_delayed_work(&priv->assoc_work);
24 if (priv->adapter->assoc_req) { 26 if (priv->adapter->pending_assoc_req) {
25 kfree(priv->adapter->assoc_req); 27 kfree(priv->adapter->pending_assoc_req);
26 priv->adapter->assoc_req = NULL; 28 priv->adapter->pending_assoc_req = NULL;
27 } 29 }
28} 30}
29 31
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index de9cb46a70ff..124e029f1bf4 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -6,7 +6,6 @@
6#include <net/iw_handler.h> 6#include <net/iw_handler.h>
7#include "host.h" 7#include "host.h"
8#include "hostcmd.h" 8#include "hostcmd.h"
9#include "sbi.h"
10#include "decl.h" 9#include "decl.h"
11#include "defs.h" 10#include "defs.h"
12#include "dev.h" 11#include "dev.h"
@@ -26,13 +25,11 @@ static u16 commands_allowed_in_ps[] = {
26 * @param command the command ID 25 * @param command the command ID
27 * @return TRUE or FALSE 26 * @return TRUE or FALSE
28 */ 27 */
29static u8 is_command_allowed_in_ps(u16 command) 28static u8 is_command_allowed_in_ps(__le16 command)
30{ 29{
31 int count = sizeof(commands_allowed_in_ps)
32 / sizeof(commands_allowed_in_ps[0]);
33 int i; 30 int i;
34 31
35 for (i = 0; i < count; i++) { 32 for (i = 0; i < ARRAY_SIZE(commands_allowed_in_ps); i++) {
36 if (command == cpu_to_le16(commands_allowed_in_ps[i])) 33 if (command == cpu_to_le16(commands_allowed_in_ps[i]))
37 return 1; 34 return 1;
38 } 35 }
@@ -44,14 +41,13 @@ static int wlan_cmd_hw_spec(wlan_private * priv, struct cmd_ds_command *cmd)
44{ 41{
45 struct cmd_ds_get_hw_spec *hwspec = &cmd->params.hwspec; 42 struct cmd_ds_get_hw_spec *hwspec = &cmd->params.hwspec;
46 43
47 ENTER(); 44 lbs_deb_enter(LBS_DEB_CMD);
48 45
49 cmd->command = cpu_to_le16(cmd_get_hw_spec); 46 cmd->command = cpu_to_le16(cmd_get_hw_spec);
50 cmd->size = 47 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_get_hw_spec) + S_DS_GEN);
51 cpu_to_le16(sizeof(struct cmd_ds_get_hw_spec) + S_DS_GEN);
52 memcpy(hwspec->permanentaddr, priv->adapter->current_addr, ETH_ALEN); 48 memcpy(hwspec->permanentaddr, priv->adapter->current_addr, ETH_ALEN);
53 49
54 LEAVE(); 50 lbs_deb_leave(LBS_DEB_CMD);
55 return 0; 51 return 0;
56} 52}
57 53
@@ -60,21 +56,19 @@ static int wlan_cmd_802_11_ps_mode(wlan_private * priv,
60 u16 cmd_action) 56 u16 cmd_action)
61{ 57{
62 struct cmd_ds_802_11_ps_mode *psm = &cmd->params.psmode; 58 struct cmd_ds_802_11_ps_mode *psm = &cmd->params.psmode;
63 u16 action = cmd_action;
64 wlan_adapter *adapter = priv->adapter; 59 wlan_adapter *adapter = priv->adapter;
65 60
66 ENTER(); 61 lbs_deb_enter(LBS_DEB_CMD);
67 62
68 cmd->command = cpu_to_le16(cmd_802_11_ps_mode); 63 cmd->command = cpu_to_le16(cmd_802_11_ps_mode);
69 cmd->size = 64 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_ps_mode) +
70 cpu_to_le16(sizeof(struct cmd_ds_802_11_ps_mode) + 65 S_DS_GEN);
71 S_DS_GEN);
72 psm->action = cpu_to_le16(cmd_action); 66 psm->action = cpu_to_le16(cmd_action);
73 psm->multipledtim = 0; 67 psm->multipledtim = 0;
74 switch (action) { 68 switch (cmd_action) {
75 case cmd_subcmd_enter_ps: 69 case cmd_subcmd_enter_ps:
76 lbs_pr_debug(1, "PS command:" "SubCode- Enter PS\n"); 70 lbs_deb_cmd("PS command:" "SubCode- Enter PS\n");
77 lbs_pr_debug(1, "locallisteninterval = %d\n", 71 lbs_deb_cmd("locallisteninterval = %d\n",
78 adapter->locallisteninterval); 72 adapter->locallisteninterval);
79 73
80 psm->locallisteninterval = 74 psm->locallisteninterval =
@@ -86,18 +80,18 @@ static int wlan_cmd_802_11_ps_mode(wlan_private * priv,
86 break; 80 break;
87 81
88 case cmd_subcmd_exit_ps: 82 case cmd_subcmd_exit_ps:
89 lbs_pr_debug(1, "PS command:" "SubCode- Exit PS\n"); 83 lbs_deb_cmd("PS command:" "SubCode- Exit PS\n");
90 break; 84 break;
91 85
92 case cmd_subcmd_sleep_confirmed: 86 case cmd_subcmd_sleep_confirmed:
93 lbs_pr_debug(1, "PS command: SubCode- sleep confirm\n"); 87 lbs_deb_cmd("PS command: SubCode- sleep confirm\n");
94 break; 88 break;
95 89
96 default: 90 default:
97 break; 91 break;
98 } 92 }
99 93
100 LEAVE(); 94 lbs_deb_leave(LBS_DEB_CMD);
101 return 0; 95 return 0;
102} 96}
103 97
@@ -115,8 +109,7 @@ static int wlan_cmd_802_11_inactivity_timeout(wlan_private * priv,
115 cmd->params.inactivity_timeout.action = cpu_to_le16(cmd_action); 109 cmd->params.inactivity_timeout.action = cpu_to_le16(cmd_action);
116 110
117 if (cmd_action) 111 if (cmd_action)
118 cmd->params.inactivity_timeout.timeout = 112 cmd->params.inactivity_timeout.timeout = cpu_to_le16(*timeout);
119 cpu_to_le16(*timeout);
120 else 113 else
121 cmd->params.inactivity_timeout.timeout = 0; 114 cmd->params.inactivity_timeout.timeout = 0;
122 115
@@ -130,11 +123,10 @@ static int wlan_cmd_802_11_sleep_params(wlan_private * priv,
130 wlan_adapter *adapter = priv->adapter; 123 wlan_adapter *adapter = priv->adapter;
131 struct cmd_ds_802_11_sleep_params *sp = &cmd->params.sleep_params; 124 struct cmd_ds_802_11_sleep_params *sp = &cmd->params.sleep_params;
132 125
133 ENTER(); 126 lbs_deb_enter(LBS_DEB_CMD);
134 127
135 cmd->size = 128 cmd->size = cpu_to_le16((sizeof(struct cmd_ds_802_11_sleep_params)) +
136 cpu_to_le16((sizeof(struct cmd_ds_802_11_sleep_params)) + 129 S_DS_GEN);
137 S_DS_GEN);
138 cmd->command = cpu_to_le16(cmd_802_11_sleep_params); 130 cmd->command = cpu_to_le16(cmd_802_11_sleep_params);
139 131
140 if (cmd_action == cmd_act_get) { 132 if (cmd_action == cmd_act_get) {
@@ -151,7 +143,7 @@ static int wlan_cmd_802_11_sleep_params(wlan_private * priv,
151 sp->reserved = cpu_to_le16(adapter->sp.sp_reserved); 143 sp->reserved = cpu_to_le16(adapter->sp.sp_reserved);
152 } 144 }
153 145
154 LEAVE(); 146 lbs_deb_leave(LBS_DEB_CMD);
155 return 0; 147 return 0;
156} 148}
157 149
@@ -165,17 +157,16 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv,
165 int ret = 0; 157 int ret = 0;
166 struct assoc_request * assoc_req = pdata_buf; 158 struct assoc_request * assoc_req = pdata_buf;
167 159
168 ENTER(); 160 lbs_deb_enter(LBS_DEB_CMD);
169 161
170 cmd->command = cpu_to_le16(cmd_802_11_set_wep); 162 cmd->command = cpu_to_le16(cmd_802_11_set_wep);
171 cmd->size = cpu_to_le16((sizeof(struct cmd_ds_802_11_set_wep)) 163 cmd->size = cpu_to_le16(sizeof(*wep) + S_DS_GEN);
172 + S_DS_GEN);
173 164
174 if (cmd_act == cmd_act_add) { 165 if (cmd_act == cmd_act_add) {
175 int i; 166 int i;
176 167
177 if (!assoc_req) { 168 if (!assoc_req) {
178 lbs_pr_debug(1, "Invalid association request!"); 169 lbs_deb_cmd("Invalid association request!");
179 ret = -1; 170 ret = -1;
180 goto done; 171 goto done;
181 } 172 }
@@ -183,11 +174,10 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv,
183 wep->action = cpu_to_le16(cmd_act_add); 174 wep->action = cpu_to_le16(cmd_act_add);
184 175
185 /* default tx key index */ 176 /* default tx key index */
186 wep->keyindex = cpu_to_le16((u16) 177 wep->keyindex = cpu_to_le16((u16)(assoc_req->wep_tx_keyidx &
187 (assoc_req->wep_tx_keyidx & 178 (u32)cmd_WEP_KEY_INDEX_MASK));
188 (u32)cmd_WEP_KEY_INDEX_MASK));
189 179
190 lbs_pr_debug(1, "Tx key Index: %u\n", wep->keyindex); 180 lbs_deb_cmd("Tx key Index: %u\n", le16_to_cpu(wep->keyindex));
191 181
192 /* Copy key types and material to host command structure */ 182 /* Copy key types and material to host command structure */
193 for (i = 0; i < 4; i++) { 183 for (i = 0; i < 4; i++) {
@@ -195,19 +185,21 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv,
195 185
196 switch (pkey->len) { 186 switch (pkey->len) {
197 case KEY_LEN_WEP_40: 187 case KEY_LEN_WEP_40:
198 wep->keytype[i] = cmd_type_wep_40_bit; 188 wep->keytype[i] =
189 cpu_to_le16(cmd_type_wep_40_bit);
199 memmove(&wep->keymaterial[i], pkey->key, 190 memmove(&wep->keymaterial[i], pkey->key,
200 pkey->len); 191 pkey->len);
201 break; 192 break;
202 case KEY_LEN_WEP_104: 193 case KEY_LEN_WEP_104:
203 wep->keytype[i] = cmd_type_wep_104_bit; 194 wep->keytype[i] =
195 cpu_to_le16(cmd_type_wep_104_bit);
204 memmove(&wep->keymaterial[i], pkey->key, 196 memmove(&wep->keymaterial[i], pkey->key,
205 pkey->len); 197 pkey->len);
206 break; 198 break;
207 case 0: 199 case 0:
208 break; 200 break;
209 default: 201 default:
210 lbs_pr_debug(1, "Invalid WEP key %d length of %d\n", 202 lbs_deb_cmd("Invalid WEP key %d length of %d\n",
211 i, pkey->len); 203 i, pkey->len);
212 ret = -1; 204 ret = -1;
213 goto done; 205 goto done;
@@ -219,36 +211,37 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv,
219 wep->action = cpu_to_le16(cmd_act_remove); 211 wep->action = cpu_to_le16(cmd_act_remove);
220 212
221 /* default tx key index */ 213 /* default tx key index */
222 wep->keyindex = cpu_to_le16((u16) 214 wep->keyindex = cpu_to_le16((u16)(adapter->wep_tx_keyidx &
223 (adapter->wep_tx_keyidx & 215 (u32)cmd_WEP_KEY_INDEX_MASK));
224 (u32)cmd_WEP_KEY_INDEX_MASK));
225 } 216 }
226 217
227 ret = 0; 218 ret = 0;
228 219
229done: 220done:
230 LEAVE(); 221 lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
231 return ret; 222 return ret;
232} 223}
233 224
234static int wlan_cmd_802_11_enable_rsn(wlan_private * priv, 225static int wlan_cmd_802_11_enable_rsn(wlan_private * priv,
235 struct cmd_ds_command *cmd, 226 struct cmd_ds_command *cmd,
236 u16 cmd_action) 227 u16 cmd_action,
228 void * pdata_buf)
237{ 229{
238 struct cmd_ds_802_11_enable_rsn *penableRSN = &cmd->params.enbrsn; 230 struct cmd_ds_802_11_enable_rsn *penableRSN = &cmd->params.enbrsn;
239 wlan_adapter *adapter = priv->adapter; 231 struct assoc_request * assoc_req = pdata_buf;
232
233 lbs_deb_enter(LBS_DEB_CMD);
240 234
241 cmd->command = cpu_to_le16(cmd_802_11_enable_rsn); 235 cmd->command = cpu_to_le16(cmd_802_11_enable_rsn);
242 cmd->size = 236 cmd->size = cpu_to_le16(sizeof(*penableRSN) + S_DS_GEN);
243 cpu_to_le16(sizeof(struct cmd_ds_802_11_enable_rsn) +
244 S_DS_GEN);
245 penableRSN->action = cpu_to_le16(cmd_action); 237 penableRSN->action = cpu_to_le16(cmd_action);
246 if (adapter->secinfo.WPAenabled || adapter->secinfo.WPA2enabled) { 238 if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) {
247 penableRSN->enable = cpu_to_le16(cmd_enable_rsn); 239 penableRSN->enable = cpu_to_le16(cmd_enable_rsn);
248 } else { 240 } else {
249 penableRSN->enable = cpu_to_le16(cmd_disable_rsn); 241 penableRSN->enable = cpu_to_le16(cmd_disable_rsn);
250 } 242 }
251 243
244 lbs_deb_leave(LBS_DEB_CMD);
252 return 0; 245 return 0;
253} 246}
254 247
@@ -259,14 +252,12 @@ static void set_one_wpa_key(struct MrvlIEtype_keyParamSet * pkeyparamset,
259 pkeyparamset->keytypeid = cpu_to_le16(pkey->type); 252 pkeyparamset->keytypeid = cpu_to_le16(pkey->type);
260 253
261 if (pkey->flags & KEY_INFO_WPA_ENABLED) { 254 if (pkey->flags & KEY_INFO_WPA_ENABLED) {
262 pkeyparamset->keyinfo = cpu_to_le16(KEY_INFO_WPA_ENABLED); 255 pkeyparamset->keyinfo |= cpu_to_le16(KEY_INFO_WPA_ENABLED);
263 } else {
264 pkeyparamset->keyinfo = cpu_to_le16(!KEY_INFO_WPA_ENABLED);
265 } 256 }
266
267 if (pkey->flags & KEY_INFO_WPA_UNICAST) { 257 if (pkey->flags & KEY_INFO_WPA_UNICAST) {
268 pkeyparamset->keyinfo |= cpu_to_le16(KEY_INFO_WPA_UNICAST); 258 pkeyparamset->keyinfo |= cpu_to_le16(KEY_INFO_WPA_UNICAST);
269 } else if (pkey->flags & KEY_INFO_WPA_MCAST) { 259 }
260 if (pkey->flags & KEY_INFO_WPA_MCAST) {
270 pkeyparamset->keyinfo |= cpu_to_le16(KEY_INFO_WPA_MCAST); 261 pkeyparamset->keyinfo |= cpu_to_le16(KEY_INFO_WPA_MCAST);
271 } 262 }
272 263
@@ -284,46 +275,45 @@ static int wlan_cmd_802_11_key_material(wlan_private * priv,
284 u16 cmd_action, 275 u16 cmd_action,
285 u32 cmd_oid, void *pdata_buf) 276 u32 cmd_oid, void *pdata_buf)
286{ 277{
287 wlan_adapter *adapter = priv->adapter;
288 struct cmd_ds_802_11_key_material *pkeymaterial = 278 struct cmd_ds_802_11_key_material *pkeymaterial =
289 &cmd->params.keymaterial; 279 &cmd->params.keymaterial;
280 struct assoc_request * assoc_req = pdata_buf;
290 int ret = 0; 281 int ret = 0;
291 int index = 0; 282 int index = 0;
292 283
293 ENTER(); 284 lbs_deb_enter(LBS_DEB_CMD);
294 285
295 cmd->command = cpu_to_le16(cmd_802_11_key_material); 286 cmd->command = cpu_to_le16(cmd_802_11_key_material);
296 pkeymaterial->action = cpu_to_le16(cmd_action); 287 pkeymaterial->action = cpu_to_le16(cmd_action);
297 288
298 if (cmd_action == cmd_act_get) { 289 if (cmd_action == cmd_act_get) {
299 cmd->size = cpu_to_le16( S_DS_GEN 290 cmd->size = cpu_to_le16(S_DS_GEN + sizeof (pkeymaterial->action));
300 + sizeof (pkeymaterial->action));
301 ret = 0; 291 ret = 0;
302 goto done; 292 goto done;
303 } 293 }
304 294
305 memset(&pkeymaterial->keyParamSet, 0, sizeof(pkeymaterial->keyParamSet)); 295 memset(&pkeymaterial->keyParamSet, 0, sizeof(pkeymaterial->keyParamSet));
306 296
307 if (adapter->wpa_unicast_key.len) { 297 if (test_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags)) {
308 set_one_wpa_key(&pkeymaterial->keyParamSet[index], 298 set_one_wpa_key(&pkeymaterial->keyParamSet[index],
309 &adapter->wpa_unicast_key); 299 &assoc_req->wpa_unicast_key);
310 index++; 300 index++;
311 } 301 }
312 302
313 if (adapter->wpa_mcast_key.len) { 303 if (test_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags)) {
314 set_one_wpa_key(&pkeymaterial->keyParamSet[index], 304 set_one_wpa_key(&pkeymaterial->keyParamSet[index],
315 &adapter->wpa_mcast_key); 305 &assoc_req->wpa_mcast_key);
316 index++; 306 index++;
317 } 307 }
318 308
319 cmd->size = cpu_to_le16( S_DS_GEN 309 cmd->size = cpu_to_le16( S_DS_GEN
320 + sizeof (pkeymaterial->action) 310 + sizeof (pkeymaterial->action)
321 + index * sizeof(struct MrvlIEtype_keyParamSet)); 311 + (index * sizeof(struct MrvlIEtype_keyParamSet)));
322 312
323 ret = 0; 313 ret = 0;
324 314
325done: 315done:
326 LEAVE(); 316 lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
327 return ret; 317 return ret;
328} 318}
329 319
@@ -354,8 +344,7 @@ static int wlan_cmd_802_11_get_stat(wlan_private * priv,
354{ 344{
355 cmd->command = cpu_to_le16(cmd_802_11_get_stat); 345 cmd->command = cpu_to_le16(cmd_802_11_get_stat);
356 cmd->size = 346 cmd->size =
357 cpu_to_le16(sizeof(struct cmd_ds_802_11_get_stat) + 347 cpu_to_le16(sizeof(struct cmd_ds_802_11_get_stat) + S_DS_GEN);
358 S_DS_GEN);
359 348
360 return 0; 349 return 0;
361} 350}
@@ -369,14 +358,12 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv,
369 wlan_adapter *adapter = priv->adapter; 358 wlan_adapter *adapter = priv->adapter;
370 u8 ucTemp; 359 u8 ucTemp;
371 360
372 ENTER(); 361 lbs_deb_enter(LBS_DEB_CMD);
373 362
374 lbs_pr_debug(1, "SNMP_CMD: cmd_oid = 0x%x\n", cmd_oid); 363 lbs_deb_cmd("SNMP_CMD: cmd_oid = 0x%x\n", cmd_oid);
375 364
376 cmd->command = cpu_to_le16(cmd_802_11_snmp_mib); 365 cmd->command = cpu_to_le16(cmd_802_11_snmp_mib);
377 cmd->size = 366 cmd->size = cpu_to_le16(sizeof(*pSNMPMIB) + S_DS_GEN);
378 cpu_to_le16(sizeof(struct cmd_ds_802_11_snmp_mib) +
379 S_DS_GEN);
380 367
381 switch (cmd_oid) { 368 switch (cmd_oid) {
382 case OID_802_11_INFRASTRUCTURE_MODE: 369 case OID_802_11_INFRASTRUCTURE_MODE:
@@ -407,7 +394,7 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv,
407 pSNMPMIB->querytype = cmd_act_set; 394 pSNMPMIB->querytype = cmd_act_set;
408 pSNMPMIB->bufsize = sizeof(u16); 395 pSNMPMIB->bufsize = sizeof(u16);
409 ulTemp = *(u32 *)pdata_buf; 396 ulTemp = *(u32 *)pdata_buf;
410 *((unsigned short *)(pSNMPMIB->value)) = 397 *((__le16 *)(pSNMPMIB->value)) =
411 cpu_to_le16((u16) ulTemp); 398 cpu_to_le16((u16) ulTemp);
412 } 399 }
413 break; 400 break;
@@ -420,15 +407,12 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv,
420 pSNMPMIB->oid = cpu_to_le16((u16) fragthresh_i); 407 pSNMPMIB->oid = cpu_to_le16((u16) fragthresh_i);
421 408
422 if (cmd_action == cmd_act_get) { 409 if (cmd_action == cmd_act_get) {
423 pSNMPMIB->querytype = 410 pSNMPMIB->querytype = cpu_to_le16(cmd_act_get);
424 cpu_to_le16(cmd_act_get);
425 } else if (cmd_action == cmd_act_set) { 411 } else if (cmd_action == cmd_act_set) {
426 pSNMPMIB->querytype = 412 pSNMPMIB->querytype = cpu_to_le16(cmd_act_set);
427 cpu_to_le16(cmd_act_set); 413 pSNMPMIB->bufsize = cpu_to_le16(sizeof(u16));
428 pSNMPMIB->bufsize =
429 cpu_to_le16(sizeof(u16));
430 ulTemp = *((u32 *) pdata_buf); 414 ulTemp = *((u32 *) pdata_buf);
431 *((unsigned short *)(pSNMPMIB->value)) = 415 *((__le16 *)(pSNMPMIB->value)) =
432 cpu_to_le16((u16) ulTemp); 416 cpu_to_le16((u16) ulTemp);
433 417
434 } 418 }
@@ -443,16 +427,12 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv,
443 pSNMPMIB->oid = le16_to_cpu((u16) rtsthresh_i); 427 pSNMPMIB->oid = le16_to_cpu((u16) rtsthresh_i);
444 428
445 if (cmd_action == cmd_act_get) { 429 if (cmd_action == cmd_act_get) {
446 pSNMPMIB->querytype = 430 pSNMPMIB->querytype = cpu_to_le16(cmd_act_get);
447 cpu_to_le16(cmd_act_get);
448 } else if (cmd_action == cmd_act_set) { 431 } else if (cmd_action == cmd_act_set) {
449 pSNMPMIB->querytype = 432 pSNMPMIB->querytype = cpu_to_le16(cmd_act_set);
450 cpu_to_le16(cmd_act_set); 433 pSNMPMIB->bufsize = cpu_to_le16(sizeof(u16));
451 pSNMPMIB->bufsize = 434 ulTemp = *((u32 *)pdata_buf);
452 cpu_to_le16(sizeof(u16)); 435 *(__le16 *)(pSNMPMIB->value) =
453 ulTemp = *((u32 *)
454 pdata_buf);
455 *(unsigned short *)(pSNMPMIB->value) =
456 cpu_to_le16((u16) ulTemp); 436 cpu_to_le16((u16) ulTemp);
457 437
458 } 438 }
@@ -462,13 +442,11 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv,
462 pSNMPMIB->oid = cpu_to_le16((u16) short_retrylim_i); 442 pSNMPMIB->oid = cpu_to_le16((u16) short_retrylim_i);
463 443
464 if (cmd_action == cmd_act_get) { 444 if (cmd_action == cmd_act_get) {
465 pSNMPMIB->querytype = 445 pSNMPMIB->querytype = cpu_to_le16(cmd_act_get);
466 cpu_to_le16(cmd_act_get);
467 } else if (cmd_action == cmd_act_set) { 446 } else if (cmd_action == cmd_act_set) {
468 pSNMPMIB->querytype = 447 pSNMPMIB->querytype = cpu_to_le16(cmd_act_set);
469 cpu_to_le16(cmd_act_set);
470 pSNMPMIB->bufsize = cpu_to_le16(sizeof(u16)); 448 pSNMPMIB->bufsize = cpu_to_le16(sizeof(u16));
471 *((unsigned short *)(pSNMPMIB->value)) = 449 *((__le16 *)(pSNMPMIB->value)) =
472 cpu_to_le16((u16) adapter->txretrycount); 450 cpu_to_le16((u16) adapter->txretrycount);
473 } 451 }
474 452
@@ -477,16 +455,18 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv,
477 break; 455 break;
478 } 456 }
479 457
480 lbs_pr_debug(1, 458 lbs_deb_cmd(
481 "SNMP_CMD: command=0x%x, size=0x%x, seqnum=0x%x, result=0x%x\n", 459 "SNMP_CMD: command=0x%x, size=0x%x, seqnum=0x%x, result=0x%x\n",
482 cmd->command, cmd->size, cmd->seqnum, cmd->result); 460 le16_to_cpu(cmd->command), le16_to_cpu(cmd->size),
461 le16_to_cpu(cmd->seqnum), le16_to_cpu(cmd->result));
483 462
484 lbs_pr_debug(1, 463 lbs_deb_cmd(
485 "SNMP_CMD: action=0x%x, oid=0x%x, oidsize=0x%x, value=0x%x\n", 464 "SNMP_CMD: action=0x%x, oid=0x%x, oidsize=0x%x, value=0x%x\n",
486 pSNMPMIB->querytype, pSNMPMIB->oid, pSNMPMIB->bufsize, 465 le16_to_cpu(pSNMPMIB->querytype), le16_to_cpu(pSNMPMIB->oid),
487 *(u16 *) pSNMPMIB->value); 466 le16_to_cpu(pSNMPMIB->bufsize),
467 le16_to_cpu(*(__le16 *) pSNMPMIB->value));
488 468
489 LEAVE(); 469 lbs_deb_leave(LBS_DEB_CMD);
490 return 0; 470 return 0;
491} 471}
492 472
@@ -495,10 +475,9 @@ static int wlan_cmd_802_11_radio_control(wlan_private * priv,
495 int cmd_action) 475 int cmd_action)
496{ 476{
497 wlan_adapter *adapter = priv->adapter; 477 wlan_adapter *adapter = priv->adapter;
498 struct cmd_ds_802_11_radio_control *pradiocontrol = 478 struct cmd_ds_802_11_radio_control *pradiocontrol = &cmd->params.radio;
499 &cmd->params.radio;
500 479
501 ENTER(); 480 lbs_deb_enter(LBS_DEB_CMD);
502 481
503 cmd->size = 482 cmd->size =
504 cpu_to_le16((sizeof(struct cmd_ds_802_11_radio_control)) + 483 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,
527 else 506 else
528 pradiocontrol->control &= cpu_to_le16(~TURN_ON_RF); 507 pradiocontrol->control &= cpu_to_le16(~TURN_ON_RF);
529 508
530 LEAVE(); 509 lbs_deb_leave(LBS_DEB_CMD);
531 return 0; 510 return 0;
532} 511}
533 512
@@ -538,16 +517,16 @@ static int wlan_cmd_802_11_rf_tx_power(wlan_private * priv,
538 517
539 struct cmd_ds_802_11_rf_tx_power *prtp = &cmd->params.txp; 518 struct cmd_ds_802_11_rf_tx_power *prtp = &cmd->params.txp;
540 519
541 ENTER(); 520 lbs_deb_enter(LBS_DEB_CMD);
542 521
543 cmd->size = 522 cmd->size =
544 cpu_to_le16((sizeof(struct cmd_ds_802_11_rf_tx_power)) + 523 cpu_to_le16((sizeof(struct cmd_ds_802_11_rf_tx_power)) + S_DS_GEN);
545 S_DS_GEN);
546 cmd->command = cpu_to_le16(cmd_802_11_rf_tx_power); 524 cmd->command = cpu_to_le16(cmd_802_11_rf_tx_power);
547 prtp->action = cmd_action; 525 prtp->action = cpu_to_le16(cmd_action);
548 526
549 lbs_pr_debug(1, "RF_TX_POWER_CMD: size:%d cmd:0x%x Act:%d\n", cmd->size, 527 lbs_deb_cmd("RF_TX_POWER_CMD: size:%d cmd:0x%x Act:%d\n",
550 cmd->command, prtp->action); 528 le16_to_cpu(cmd->size), le16_to_cpu(cmd->command),
529 le16_to_cpu(prtp->action));
551 530
552 switch (cmd_action) { 531 switch (cmd_action) {
553 case cmd_act_tx_power_opt_get: 532 case cmd_act_tx_power_opt_get:
@@ -557,14 +536,12 @@ static int wlan_cmd_802_11_rf_tx_power(wlan_private * priv,
557 536
558 case cmd_act_tx_power_opt_set_high: 537 case cmd_act_tx_power_opt_set_high:
559 prtp->action = cpu_to_le16(cmd_act_set); 538 prtp->action = cpu_to_le16(cmd_act_set);
560 prtp->currentlevel = 539 prtp->currentlevel = cpu_to_le16(cmd_act_tx_power_index_high);
561 cpu_to_le16(cmd_act_tx_power_index_high);
562 break; 540 break;
563 541
564 case cmd_act_tx_power_opt_set_mid: 542 case cmd_act_tx_power_opt_set_mid:
565 prtp->action = cpu_to_le16(cmd_act_set); 543 prtp->action = cpu_to_le16(cmd_act_set);
566 prtp->currentlevel = 544 prtp->currentlevel = cpu_to_le16(cmd_act_tx_power_index_mid);
567 cpu_to_le16(cmd_act_tx_power_index_mid);
568 break; 545 break;
569 546
570 case cmd_act_tx_power_opt_set_low: 547 case cmd_act_tx_power_opt_set_low:
@@ -572,7 +549,8 @@ static int wlan_cmd_802_11_rf_tx_power(wlan_private * priv,
572 prtp->currentlevel = cpu_to_le16(*((u16 *) pdata_buf)); 549 prtp->currentlevel = cpu_to_le16(*((u16 *) pdata_buf));
573 break; 550 break;
574 } 551 }
575 LEAVE(); 552
553 lbs_deb_leave(LBS_DEB_CMD);
576 return 0; 554 return 0;
577} 555}
578 556
@@ -583,15 +561,12 @@ static int wlan_cmd_802_11_rf_antenna(wlan_private * priv,
583 struct cmd_ds_802_11_rf_antenna *rant = &cmd->params.rant; 561 struct cmd_ds_802_11_rf_antenna *rant = &cmd->params.rant;
584 562
585 cmd->command = cpu_to_le16(cmd_802_11_rf_antenna); 563 cmd->command = cpu_to_le16(cmd_802_11_rf_antenna);
586 cmd->size = 564 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_rf_antenna) +
587 cpu_to_le16(sizeof(struct cmd_ds_802_11_rf_antenna) + 565 S_DS_GEN);
588 S_DS_GEN);
589 566
590 rant->action = cpu_to_le16(cmd_action); 567 rant->action = cpu_to_le16(cmd_action);
591 if ((cmd_action == cmd_act_set_rx) || 568 if ((cmd_action == cmd_act_set_rx) || (cmd_action == cmd_act_set_tx)) {
592 (cmd_action == cmd_act_set_tx)) { 569 rant->antennamode = cpu_to_le16((u16) (*(u32 *) pdata_buf));
593 rant->antennamode =
594 cpu_to_le16((u16) (*(u32 *) pdata_buf));
595 } 570 }
596 571
597 return 0; 572 return 0;
@@ -610,13 +585,13 @@ static int wlan_cmd_802_11_rate_adapt_rateset(wlan_private * priv,
610 + S_DS_GEN); 585 + S_DS_GEN);
611 cmd->command = cpu_to_le16(cmd_802_11_rate_adapt_rateset); 586 cmd->command = cpu_to_le16(cmd_802_11_rate_adapt_rateset);
612 587
613 ENTER(); 588 lbs_deb_enter(LBS_DEB_CMD);
614 589
615 rateadapt->action = cmd_action; 590 rateadapt->action = cpu_to_le16(cmd_action);
616 rateadapt->enablehwauto = adapter->enablehwauto; 591 rateadapt->enablehwauto = cpu_to_le16(adapter->enablehwauto);
617 rateadapt->bitmap = adapter->ratebitmap; 592 rateadapt->bitmap = cpu_to_le16(adapter->ratebitmap);
618 593
619 LEAVE(); 594 lbs_deb_leave(LBS_DEB_CMD);
620 return 0; 595 return 0;
621} 596}
622 597
@@ -626,12 +601,10 @@ static int wlan_cmd_802_11_data_rate(wlan_private * priv,
626{ 601{
627 struct cmd_ds_802_11_data_rate *pdatarate = &cmd->params.drate; 602 struct cmd_ds_802_11_data_rate *pdatarate = &cmd->params.drate;
628 wlan_adapter *adapter = priv->adapter; 603 wlan_adapter *adapter = priv->adapter;
629 u16 action = cmd_action;
630 604
631 ENTER(); 605 lbs_deb_enter(LBS_DEB_CMD);
632 606
633 cmd->size = 607 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_data_rate) +
634 cpu_to_le16(sizeof(struct cmd_ds_802_11_data_rate) +
635 S_DS_GEN); 608 S_DS_GEN);
636 609
637 cmd->command = cpu_to_le16(cmd_802_11_data_rate); 610 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,
640 613
641 pdatarate->action = cpu_to_le16(cmd_action); 614 pdatarate->action = cpu_to_le16(cmd_action);
642 615
643 if (action == cmd_act_set_tx_fix_rate) { 616 if (cmd_action == cmd_act_set_tx_fix_rate) {
644 pdatarate->datarate[0] = libertas_data_rate_to_index(adapter->datarate); 617 pdatarate->datarate[0] = libertas_data_rate_to_index(adapter->datarate);
645 lbs_pr_debug(1, "Setting FW for fixed rate 0x%02X\n", 618 lbs_deb_cmd("Setting FW for fixed rate 0x%02X\n",
646 adapter->datarate); 619 adapter->datarate);
647 } else if (action == cmd_act_set_tx_auto) { 620 } else if (cmd_action == cmd_act_set_tx_auto) {
648 lbs_pr_debug(1, "Setting FW for AUTO rate\n"); 621 lbs_deb_cmd("Setting FW for AUTO rate\n");
649 } 622 }
650 623
651 LEAVE(); 624 lbs_deb_leave(LBS_DEB_CMD);
652 return 0; 625 return 0;
653} 626}
654 627
@@ -659,8 +632,7 @@ static int wlan_cmd_mac_multicast_adr(wlan_private * priv,
659 struct cmd_ds_mac_multicast_adr *pMCastAdr = &cmd->params.madr; 632 struct cmd_ds_mac_multicast_adr *pMCastAdr = &cmd->params.madr;
660 wlan_adapter *adapter = priv->adapter; 633 wlan_adapter *adapter = priv->adapter;
661 634
662 cmd->size = 635 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mac_multicast_adr) +
663 cpu_to_le16(sizeof(struct cmd_ds_mac_multicast_adr) +
664 S_DS_GEN); 636 S_DS_GEN);
665 cmd->command = cpu_to_le16(cmd_mac_multicast_adr); 637 cmd->command = cpu_to_le16(cmd_mac_multicast_adr);
666 638
@@ -680,8 +652,8 @@ static int wlan_cmd_802_11_rf_channel(wlan_private * priv,
680 struct cmd_ds_802_11_rf_channel *rfchan = &cmd->params.rfchannel; 652 struct cmd_ds_802_11_rf_channel *rfchan = &cmd->params.rfchannel;
681 653
682 cmd->command = cpu_to_le16(cmd_802_11_rf_channel); 654 cmd->command = cpu_to_le16(cmd_802_11_rf_channel);
683 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_rf_channel) 655 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_rf_channel) +
684 + S_DS_GEN); 656 S_DS_GEN);
685 657
686 if (option == cmd_opt_802_11_rf_channel_set) { 658 if (option == cmd_opt_802_11_rf_channel_set) {
687 rfchan->currentchannel = cpu_to_le16(*((u16 *) pdata_buf)); 659 rfchan->currentchannel = cpu_to_le16(*((u16 *) pdata_buf));
@@ -698,9 +670,8 @@ static int wlan_cmd_802_11_rssi(wlan_private * priv,
698 wlan_adapter *adapter = priv->adapter; 670 wlan_adapter *adapter = priv->adapter;
699 671
700 cmd->command = cpu_to_le16(cmd_802_11_rssi); 672 cmd->command = cpu_to_le16(cmd_802_11_rssi);
701 cmd->size = 673 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_rssi) + S_DS_GEN);
702 cpu_to_le16(sizeof(struct cmd_ds_802_11_rssi) + S_DS_GEN); 674 cmd->params.rssi.N = cpu_to_le16(priv->adapter->bcn_avg_factor);
703 cmd->params.rssi.N = priv->adapter->bcn_avg_factor;
704 675
705 /* reset Beacon SNR/NF/RSSI values */ 676 /* reset Beacon SNR/NF/RSSI values */
706 adapter->SNR[TYPE_BEACON][TYPE_NOAVG] = 0; 677 adapter->SNR[TYPE_BEACON][TYPE_NOAVG] = 0;
@@ -719,7 +690,7 @@ static int wlan_cmd_reg_access(wlan_private * priv,
719{ 690{
720 struct wlan_offset_value *offval; 691 struct wlan_offset_value *offval;
721 692
722 ENTER(); 693 lbs_deb_enter(LBS_DEB_CMD);
723 694
724 offval = (struct wlan_offset_value *)pdata_buf; 695 offval = (struct wlan_offset_value *)pdata_buf;
725 696
@@ -729,9 +700,8 @@ static int wlan_cmd_reg_access(wlan_private * priv,
729 struct cmd_ds_mac_reg_access *macreg; 700 struct cmd_ds_mac_reg_access *macreg;
730 701
731 cmdptr->size = 702 cmdptr->size =
732 cpu_to_le16(sizeof 703 cpu_to_le16(sizeof (struct cmd_ds_mac_reg_access)
733 (struct cmd_ds_mac_reg_access) 704 + S_DS_GEN);
734 + S_DS_GEN);
735 macreg = 705 macreg =
736 (struct cmd_ds_mac_reg_access *)&cmdptr->params. 706 (struct cmd_ds_mac_reg_access *)&cmdptr->params.
737 macreg; 707 macreg;
@@ -785,7 +755,7 @@ static int wlan_cmd_reg_access(wlan_private * priv,
785 break; 755 break;
786 } 756 }
787 757
788 LEAVE(); 758 lbs_deb_leave(LBS_DEB_CMD);
789 return 0; 759 return 0;
790} 760}
791 761
@@ -796,8 +766,7 @@ static int wlan_cmd_802_11_mac_address(wlan_private * priv,
796 wlan_adapter *adapter = priv->adapter; 766 wlan_adapter *adapter = priv->adapter;
797 767
798 cmd->command = cpu_to_le16(cmd_802_11_mac_address); 768 cmd->command = cpu_to_le16(cmd_802_11_mac_address);
799 cmd->size = 769 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_mac_address) +
800 cpu_to_le16(sizeof(struct cmd_ds_802_11_mac_address) +
801 S_DS_GEN); 770 S_DS_GEN);
802 cmd->result = 0; 771 cmd->result = 0;
803 772
@@ -818,12 +787,11 @@ static int wlan_cmd_802_11_eeprom_access(wlan_private * priv,
818{ 787{
819 struct wlan_ioctl_regrdwr *ea = pdata_buf; 788 struct wlan_ioctl_regrdwr *ea = pdata_buf;
820 789
821 ENTER(); 790 lbs_deb_enter(LBS_DEB_CMD);
822 791
823 cmd->command = cpu_to_le16(cmd_802_11_eeprom_access); 792 cmd->command = cpu_to_le16(cmd_802_11_eeprom_access);
824 cmd->size = 793 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_eeprom_access) +
825 cpu_to_le16(sizeof(struct cmd_ds_802_11_eeprom_access) + 794 S_DS_GEN);
826 S_DS_GEN);
827 cmd->result = 0; 795 cmd->result = 0;
828 796
829 cmd->params.rdeeprom.action = cpu_to_le16(ea->action); 797 cmd->params.rdeeprom.action = cpu_to_le16(ea->action);
@@ -839,11 +807,10 @@ static int wlan_cmd_bt_access(wlan_private * priv,
839 u16 cmd_action, void *pdata_buf) 807 u16 cmd_action, void *pdata_buf)
840{ 808{
841 struct cmd_ds_bt_access *bt_access = &cmd->params.bt; 809 struct cmd_ds_bt_access *bt_access = &cmd->params.bt;
842 lbs_pr_debug(1, "BT CMD(%d)\n", cmd_action); 810 lbs_deb_cmd("BT CMD(%d)\n", cmd_action);
843 811
844 cmd->command = cpu_to_le16(cmd_bt_access); 812 cmd->command = cpu_to_le16(cmd_bt_access);
845 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_bt_access) 813 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_bt_access) + S_DS_GEN);
846 + S_DS_GEN);
847 cmd->result = 0; 814 cmd->result = 0;
848 bt_access->action = cpu_to_le16(cmd_action); 815 bt_access->action = cpu_to_le16(cmd_action);
849 816
@@ -861,6 +828,11 @@ static int wlan_cmd_bt_access(wlan_private * priv,
861 break; 828 break;
862 case cmd_act_bt_access_reset: 829 case cmd_act_bt_access_reset:
863 break; 830 break;
831 case cmd_act_bt_access_set_invert:
832 bt_access->id = cpu_to_le32(*(u32 *) pdata_buf);
833 break;
834 case cmd_act_bt_access_get_invert:
835 break;
864 default: 836 default:
865 break; 837 break;
866 } 838 }
@@ -872,11 +844,10 @@ static int wlan_cmd_fwt_access(wlan_private * priv,
872 u16 cmd_action, void *pdata_buf) 844 u16 cmd_action, void *pdata_buf)
873{ 845{
874 struct cmd_ds_fwt_access *fwt_access = &cmd->params.fwt; 846 struct cmd_ds_fwt_access *fwt_access = &cmd->params.fwt;
875 lbs_pr_debug(1, "FWT CMD(%d)\n", cmd_action); 847 lbs_deb_cmd("FWT CMD(%d)\n", cmd_action);
876 848
877 cmd->command = cpu_to_le16(cmd_fwt_access); 849 cmd->command = cpu_to_le16(cmd_fwt_access);
878 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_fwt_access) 850 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_fwt_access) + S_DS_GEN);
879 + S_DS_GEN);
880 cmd->result = 0; 851 cmd->result = 0;
881 852
882 if (pdata_buf) 853 if (pdata_buf)
@@ -894,11 +865,10 @@ static int wlan_cmd_mesh_access(wlan_private * priv,
894 u16 cmd_action, void *pdata_buf) 865 u16 cmd_action, void *pdata_buf)
895{ 866{
896 struct cmd_ds_mesh_access *mesh_access = &cmd->params.mesh; 867 struct cmd_ds_mesh_access *mesh_access = &cmd->params.mesh;
897 lbs_pr_debug(1, "FWT CMD(%d)\n", cmd_action); 868 lbs_deb_cmd("FWT CMD(%d)\n", cmd_action);
898 869
899 cmd->command = cpu_to_le16(cmd_mesh_access); 870 cmd->command = cpu_to_le16(cmd_mesh_access);
900 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mesh_access) 871 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mesh_access) + S_DS_GEN);
901 + S_DS_GEN);
902 cmd->result = 0; 872 cmd->result = 0;
903 873
904 if (pdata_buf) 874 if (pdata_buf)
@@ -916,23 +886,23 @@ void libertas_queue_cmd(wlan_adapter * adapter, struct cmd_ctrl_node *cmdnode, u
916 unsigned long flags; 886 unsigned long flags;
917 struct cmd_ds_command *cmdptr; 887 struct cmd_ds_command *cmdptr;
918 888
919 ENTER(); 889 lbs_deb_enter(LBS_DEB_CMD);
920 890
921 if (!cmdnode) { 891 if (!cmdnode) {
922 lbs_pr_debug(1, "QUEUE_CMD: cmdnode is NULL\n"); 892 lbs_deb_cmd("QUEUE_CMD: cmdnode is NULL\n");
923 goto done; 893 goto done;
924 } 894 }
925 895
926 cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr; 896 cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr;
927 if (!cmdptr) { 897 if (!cmdptr) {
928 lbs_pr_debug(1, "QUEUE_CMD: cmdptr is NULL\n"); 898 lbs_deb_cmd("QUEUE_CMD: cmdptr is NULL\n");
929 goto done; 899 goto done;
930 } 900 }
931 901
932 /* Exit_PS command needs to be queued in the header always. */ 902 /* Exit_PS command needs to be queued in the header always. */
933 if (cmdptr->command == cmd_802_11_ps_mode) { 903 if (cmdptr->command == cmd_802_11_ps_mode) {
934 struct cmd_ds_802_11_ps_mode *psm = &cmdptr->params.psmode; 904 struct cmd_ds_802_11_ps_mode *psm = &cmdptr->params.psmode;
935 if (psm->action == cmd_subcmd_exit_ps) { 905 if (psm->action == cpu_to_le16(cmd_subcmd_exit_ps)) {
936 if (adapter->psstate != PS_STATE_FULL_POWER) 906 if (adapter->psstate != PS_STATE_FULL_POWER)
937 addtail = 0; 907 addtail = 0;
938 } 908 }
@@ -948,13 +918,12 @@ void libertas_queue_cmd(wlan_adapter * adapter, struct cmd_ctrl_node *cmdnode, u
948 918
949 spin_unlock_irqrestore(&adapter->driver_lock, flags); 919 spin_unlock_irqrestore(&adapter->driver_lock, flags);
950 920
951 lbs_pr_debug(1, "QUEUE_CMD: Inserted node=%p, cmd=0x%x in cmdpendingq\n", 921 lbs_deb_cmd("QUEUE_CMD: Inserted node=%p, cmd=0x%x in cmdpendingq\n",
952 cmdnode, 922 cmdnode,
953 ((struct cmd_ds_gen*)cmdnode->bufvirtualaddr)->command); 923 le16_to_cpu(((struct cmd_ds_gen*)cmdnode->bufvirtualaddr)->command));
954 924
955done: 925done:
956 LEAVE(); 926 lbs_deb_leave(LBS_DEB_CMD);
957 return;
958} 927}
959 928
960/* 929/*
@@ -974,10 +943,10 @@ static int DownloadcommandToStation(wlan_private * priv,
974 u16 cmdsize; 943 u16 cmdsize;
975 u16 command; 944 u16 command;
976 945
977 ENTER(); 946 lbs_deb_enter(LBS_DEB_CMD);
978 947
979 if (!adapter || !cmdnode) { 948 if (!adapter || !cmdnode) {
980 lbs_pr_debug(1, "DNLD_CMD: adapter = %p, cmdnode = %p\n", 949 lbs_deb_cmd("DNLD_CMD: adapter = %p, cmdnode = %p\n",
981 adapter, cmdnode); 950 adapter, cmdnode);
982 if (cmdnode) { 951 if (cmdnode) {
983 spin_lock_irqsave(&adapter->driver_lock, flags); 952 spin_lock_irqsave(&adapter->driver_lock, flags);
@@ -993,7 +962,7 @@ static int DownloadcommandToStation(wlan_private * priv,
993 962
994 spin_lock_irqsave(&adapter->driver_lock, flags); 963 spin_lock_irqsave(&adapter->driver_lock, flags);
995 if (!cmdptr || !cmdptr->size) { 964 if (!cmdptr || !cmdptr->size) {
996 lbs_pr_debug(1, "DNLD_CMD: cmdptr is Null or cmd size is Zero, " 965 lbs_deb_cmd("DNLD_CMD: cmdptr is Null or cmd size is Zero, "
997 "Not sending\n"); 966 "Not sending\n");
998 __libertas_cleanup_and_insert_cmd(priv, cmdnode); 967 __libertas_cleanup_and_insert_cmd(priv, cmdnode);
999 spin_unlock_irqrestore(&adapter->driver_lock, flags); 968 spin_unlock_irqrestore(&adapter->driver_lock, flags);
@@ -1004,8 +973,8 @@ static int DownloadcommandToStation(wlan_private * priv,
1004 adapter->cur_cmd = cmdnode; 973 adapter->cur_cmd = cmdnode;
1005 adapter->cur_cmd_retcode = 0; 974 adapter->cur_cmd_retcode = 0;
1006 spin_unlock_irqrestore(&adapter->driver_lock, flags); 975 spin_unlock_irqrestore(&adapter->driver_lock, flags);
1007 lbs_pr_debug(1, "DNLD_CMD:: Before download, size of cmd = %d\n", 976 lbs_deb_cmd("DNLD_CMD:: Before download, size of cmd = %d\n",
1008 cmdptr->size); 977 le16_to_cpu(cmdptr->size));
1009 978
1010 cmdsize = cmdptr->size; 979 cmdsize = cmdptr->size;
1011 980
@@ -1014,10 +983,10 @@ static int DownloadcommandToStation(wlan_private * priv,
1014 cmdnode->cmdwaitqwoken = 0; 983 cmdnode->cmdwaitqwoken = 0;
1015 cmdsize = cpu_to_le16(cmdsize); 984 cmdsize = cpu_to_le16(cmdsize);
1016 985
1017 ret = libertas_sbi_host_to_card(priv, MVMS_CMD, (u8 *) cmdptr, cmdsize); 986 ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmdptr, cmdsize);
1018 987
1019 if (ret != 0) { 988 if (ret != 0) {
1020 lbs_pr_debug(1, "DNLD_CMD: Host to Card failed\n"); 989 lbs_deb_cmd("DNLD_CMD: Host to Card failed\n");
1021 spin_lock_irqsave(&adapter->driver_lock, flags); 990 spin_lock_irqsave(&adapter->driver_lock, flags);
1022 __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd); 991 __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd);
1023 adapter->cur_cmd = NULL; 992 adapter->cur_cmd = NULL;
@@ -1026,12 +995,11 @@ static int DownloadcommandToStation(wlan_private * priv,
1026 goto done; 995 goto done;
1027 } 996 }
1028 997
1029 lbs_pr_debug(1, "DNLD_CMD: Sent command 0x%x @ %lu\n", command, jiffies); 998 lbs_deb_cmd("DNLD_CMD: Sent command 0x%x @ %lu\n", command, jiffies);
1030 lbs_dbg_hex("DNLD_CMD: command", cmdnode->bufvirtualaddr, cmdsize); 999 lbs_dbg_hex("DNLD_CMD: command", cmdnode->bufvirtualaddr, cmdsize);
1031 1000
1032 /* Setup the timer after transmit command */ 1001 /* Setup the timer after transmit command */
1033 if (command == cmd_802_11_scan 1002 if (command == cmd_802_11_scan || command == cmd_802_11_authenticate
1034 || command == cmd_802_11_authenticate
1035 || command == cmd_802_11_associate) 1003 || command == cmd_802_11_associate)
1036 mod_timer(&adapter->command_timer, jiffies + (10*HZ)); 1004 mod_timer(&adapter->command_timer, jiffies + (10*HZ));
1037 else 1005 else
@@ -1039,8 +1007,8 @@ static int DownloadcommandToStation(wlan_private * priv,
1039 1007
1040 ret = 0; 1008 ret = 0;
1041 1009
1042 done: 1010done:
1043 LEAVE(); 1011 lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
1044 return ret; 1012 return ret;
1045} 1013}
1046 1014
@@ -1049,17 +1017,16 @@ static int wlan_cmd_mac_control(wlan_private * priv,
1049{ 1017{
1050 struct cmd_ds_mac_control *mac = &cmd->params.macctrl; 1018 struct cmd_ds_mac_control *mac = &cmd->params.macctrl;
1051 1019
1052 ENTER(); 1020 lbs_deb_enter(LBS_DEB_CMD);
1053 1021
1054 cmd->command = cpu_to_le16(cmd_mac_control); 1022 cmd->command = cpu_to_le16(cmd_mac_control);
1055 cmd->size = 1023 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mac_control) + S_DS_GEN);
1056 cpu_to_le16(sizeof(struct cmd_ds_mac_control) + S_DS_GEN);
1057 mac->action = cpu_to_le16(priv->adapter->currentpacketfilter); 1024 mac->action = cpu_to_le16(priv->adapter->currentpacketfilter);
1058 1025
1059 lbs_pr_debug(1, "wlan_cmd_mac_control(): action=0x%X size=%d\n", 1026 lbs_deb_cmd("wlan_cmd_mac_control(): action=0x%X size=%d\n",
1060 mac->action, cmd->size); 1027 le16_to_cpu(mac->action), le16_to_cpu(cmd->size));
1061 1028
1062 LEAVE(); 1029 lbs_deb_leave(LBS_DEB_CMD);
1063 return 0; 1030 return 0;
1064} 1031}
1065 1032
@@ -1093,17 +1060,17 @@ int libertas_set_radio_control(wlan_private * priv)
1093{ 1060{
1094 int ret = 0; 1061 int ret = 0;
1095 1062
1096 ENTER(); 1063 lbs_deb_enter(LBS_DEB_CMD);
1097 1064
1098 ret = libertas_prepare_and_send_command(priv, 1065 ret = libertas_prepare_and_send_command(priv,
1099 cmd_802_11_radio_control, 1066 cmd_802_11_radio_control,
1100 cmd_act_set, 1067 cmd_act_set,
1101 cmd_option_waitforrsp, 0, NULL); 1068 cmd_option_waitforrsp, 0, NULL);
1102 1069
1103 lbs_pr_debug(1, "RADIO_SET: on or off: 0x%X, preamble = 0x%X\n", 1070 lbs_deb_cmd("RADIO_SET: on or off: 0x%X, preamble = 0x%X\n",
1104 priv->adapter->radioon, priv->adapter->preamble); 1071 priv->adapter->radioon, priv->adapter->preamble);
1105 1072
1106 LEAVE(); 1073 lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
1107 return ret; 1074 return ret;
1108} 1075}
1109 1076
@@ -1111,16 +1078,16 @@ int libertas_set_mac_packet_filter(wlan_private * priv)
1111{ 1078{
1112 int ret = 0; 1079 int ret = 0;
1113 1080
1114 ENTER(); 1081 lbs_deb_enter(LBS_DEB_CMD);
1115 1082
1116 lbs_pr_debug(1, "libertas_set_mac_packet_filter value = %x\n", 1083 lbs_deb_cmd("libertas_set_mac_packet_filter value = %x\n",
1117 priv->adapter->currentpacketfilter); 1084 priv->adapter->currentpacketfilter);
1118 1085
1119 /* Send MAC control command to station */ 1086 /* Send MAC control command to station */
1120 ret = libertas_prepare_and_send_command(priv, 1087 ret = libertas_prepare_and_send_command(priv,
1121 cmd_mac_control, 0, 0, 0, NULL); 1088 cmd_mac_control, 0, 0, 0, NULL);
1122 1089
1123 LEAVE(); 1090 lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
1124 return ret; 1091 return ret;
1125} 1092}
1126 1093
@@ -1146,16 +1113,16 @@ int libertas_prepare_and_send_command(wlan_private * priv,
1146 struct cmd_ds_command *cmdptr; 1113 struct cmd_ds_command *cmdptr;
1147 unsigned long flags; 1114 unsigned long flags;
1148 1115
1149 ENTER(); 1116 lbs_deb_enter(LBS_DEB_CMD);
1150 1117
1151 if (!adapter) { 1118 if (!adapter) {
1152 lbs_pr_debug(1, "PREP_CMD: adapter is Null\n"); 1119 lbs_deb_cmd("PREP_CMD: adapter is Null\n");
1153 ret = -1; 1120 ret = -1;
1154 goto done; 1121 goto done;
1155 } 1122 }
1156 1123
1157 if (adapter->surpriseremoved) { 1124 if (adapter->surpriseremoved) {
1158 lbs_pr_debug(1, "PREP_CMD: Card is Removed\n"); 1125 lbs_deb_cmd("PREP_CMD: Card is Removed\n");
1159 ret = -1; 1126 ret = -1;
1160 goto done; 1127 goto done;
1161 } 1128 }
@@ -1163,7 +1130,7 @@ int libertas_prepare_and_send_command(wlan_private * priv,
1163 cmdnode = libertas_get_free_cmd_ctrl_node(priv); 1130 cmdnode = libertas_get_free_cmd_ctrl_node(priv);
1164 1131
1165 if (cmdnode == NULL) { 1132 if (cmdnode == NULL) {
1166 lbs_pr_debug(1, "PREP_CMD: No free cmdnode\n"); 1133 lbs_deb_cmd("PREP_CMD: No free cmdnode\n");
1167 1134
1168 /* Wake up main thread to execute next command */ 1135 /* Wake up main thread to execute next command */
1169 wake_up_interruptible(&priv->mainthread.waitq); 1136 wake_up_interruptible(&priv->mainthread.waitq);
@@ -1175,11 +1142,11 @@ int libertas_prepare_and_send_command(wlan_private * priv,
1175 1142
1176 cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr; 1143 cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr;
1177 1144
1178 lbs_pr_debug(1, "PREP_CMD: Val of cmd ptr=%p, command=0x%X\n", 1145 lbs_deb_cmd("PREP_CMD: Val of cmd ptr=%p, command=0x%X\n",
1179 cmdptr, cmd_no); 1146 cmdptr, cmd_no);
1180 1147
1181 if (!cmdptr) { 1148 if (!cmdptr) {
1182 lbs_pr_debug(1, "PREP_CMD: bufvirtualaddr of cmdnode is NULL\n"); 1149 lbs_deb_cmd("PREP_CMD: bufvirtualaddr of cmdnode is NULL\n");
1183 libertas_cleanup_and_insert_cmd(priv, cmdnode); 1150 libertas_cleanup_and_insert_cmd(priv, cmdnode);
1184 ret = -1; 1151 ret = -1;
1185 goto done; 1152 goto done;
@@ -1189,7 +1156,7 @@ int libertas_prepare_and_send_command(wlan_private * priv,
1189 adapter->seqnum++; 1156 adapter->seqnum++;
1190 cmdptr->seqnum = cpu_to_le16(adapter->seqnum); 1157 cmdptr->seqnum = cpu_to_le16(adapter->seqnum);
1191 1158
1192 cmdptr->command = cmd_no; 1159 cmdptr->command = cpu_to_le16(cmd_no);
1193 cmdptr->result = 0; 1160 cmdptr->result = 0;
1194 1161
1195 switch (cmd_no) { 1162 switch (cmd_no) {
@@ -1298,13 +1265,13 @@ int libertas_prepare_and_send_command(wlan_private * priv,
1298 break; 1265 break;
1299 1266
1300 case cmd_802_11_enable_rsn: 1267 case cmd_802_11_enable_rsn:
1301 ret = wlan_cmd_802_11_enable_rsn(priv, cmdptr, cmd_action); 1268 ret = wlan_cmd_802_11_enable_rsn(priv, cmdptr, cmd_action,
1269 pdata_buf);
1302 break; 1270 break;
1303 1271
1304 case cmd_802_11_key_material: 1272 case cmd_802_11_key_material:
1305 ret = wlan_cmd_802_11_key_material(priv, cmdptr, 1273 ret = wlan_cmd_802_11_key_material(priv, cmdptr, cmd_action,
1306 cmd_action, cmd_oid, 1274 cmd_oid, pdata_buf);
1307 pdata_buf);
1308 break; 1275 break;
1309 1276
1310 case cmd_802_11_pairwise_tsc: 1277 case cmd_802_11_pairwise_tsc:
@@ -1325,9 +1292,8 @@ int libertas_prepare_and_send_command(wlan_private * priv,
1325 case cmd_802_11_get_afc: 1292 case cmd_802_11_get_afc:
1326 1293
1327 cmdptr->command = cpu_to_le16(cmd_no); 1294 cmdptr->command = cpu_to_le16(cmd_no);
1328 cmdptr->size = 1295 cmdptr->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_afc) +
1329 cpu_to_le16(sizeof(struct cmd_ds_802_11_afc) + 1296 S_DS_GEN);
1330 S_DS_GEN);
1331 1297
1332 memmove(&cmdptr->params.afc, 1298 memmove(&cmdptr->params.afc,
1333 pdata_buf, sizeof(struct cmd_ds_802_11_afc)); 1299 pdata_buf, sizeof(struct cmd_ds_802_11_afc));
@@ -1406,29 +1372,26 @@ int libertas_prepare_and_send_command(wlan_private * priv,
1406 1372
1407 case cmd_get_tsf: 1373 case cmd_get_tsf:
1408 cmdptr->command = cpu_to_le16(cmd_get_tsf); 1374 cmdptr->command = cpu_to_le16(cmd_get_tsf);
1409 cmdptr->size = 1375 cmdptr->size = cpu_to_le16(sizeof(struct cmd_ds_get_tsf) +
1410 cpu_to_le16(sizeof(struct cmd_ds_get_tsf) 1376 S_DS_GEN);
1411 + S_DS_GEN);
1412 ret = 0; 1377 ret = 0;
1413 break; 1378 break;
1414 case cmd_802_11_tx_rate_query: 1379 case cmd_802_11_tx_rate_query:
1415 cmdptr->command = 1380 cmdptr->command = cpu_to_le16(cmd_802_11_tx_rate_query);
1416 cpu_to_le16(cmd_802_11_tx_rate_query); 1381 cmdptr->size = cpu_to_le16(sizeof(struct cmd_tx_rate_query) +
1417 cmdptr->size = 1382 S_DS_GEN);
1418 cpu_to_le16(sizeof(struct cmd_tx_rate_query) +
1419 S_DS_GEN);
1420 adapter->txrate = 0; 1383 adapter->txrate = 0;
1421 ret = 0; 1384 ret = 0;
1422 break; 1385 break;
1423 default: 1386 default:
1424 lbs_pr_debug(1, "PREP_CMD: unknown command- %#x\n", cmd_no); 1387 lbs_deb_cmd("PREP_CMD: unknown command- %#x\n", cmd_no);
1425 ret = -1; 1388 ret = -1;
1426 break; 1389 break;
1427 } 1390 }
1428 1391
1429 /* return error, since the command preparation failed */ 1392 /* return error, since the command preparation failed */
1430 if (ret != 0) { 1393 if (ret != 0) {
1431 lbs_pr_debug(1, "PREP_CMD: command preparation failed\n"); 1394 lbs_deb_cmd("PREP_CMD: command preparation failed\n");
1432 libertas_cleanup_and_insert_cmd(priv, cmdnode); 1395 libertas_cleanup_and_insert_cmd(priv, cmdnode);
1433 ret = -1; 1396 ret = -1;
1434 goto done; 1397 goto done;
@@ -1441,7 +1404,7 @@ int libertas_prepare_and_send_command(wlan_private * priv,
1441 wake_up_interruptible(&priv->mainthread.waitq); 1404 wake_up_interruptible(&priv->mainthread.waitq);
1442 1405
1443 if (wait_option & cmd_option_waitforrsp) { 1406 if (wait_option & cmd_option_waitforrsp) {
1444 lbs_pr_debug(1, "PREP_CMD: Wait for CMD response\n"); 1407 lbs_deb_cmd("PREP_CMD: Wait for CMD response\n");
1445 might_sleep(); 1408 might_sleep();
1446 wait_event_interruptible(cmdnode->cmdwait_q, 1409 wait_event_interruptible(cmdnode->cmdwait_q,
1447 cmdnode->cmdwaitqwoken); 1410 cmdnode->cmdwaitqwoken);
@@ -1449,7 +1412,7 @@ int libertas_prepare_and_send_command(wlan_private * priv,
1449 1412
1450 spin_lock_irqsave(&adapter->driver_lock, flags); 1413 spin_lock_irqsave(&adapter->driver_lock, flags);
1451 if (adapter->cur_cmd_retcode) { 1414 if (adapter->cur_cmd_retcode) {
1452 lbs_pr_debug(1, "PREP_CMD: command failed with return code=%d\n", 1415 lbs_deb_cmd("PREP_CMD: command failed with return code=%d\n",
1453 adapter->cur_cmd_retcode); 1416 adapter->cur_cmd_retcode);
1454 adapter->cur_cmd_retcode = 0; 1417 adapter->cur_cmd_retcode = 0;
1455 ret = -1; 1418 ret = -1;
@@ -1457,9 +1420,10 @@ int libertas_prepare_and_send_command(wlan_private * priv,
1457 spin_unlock_irqrestore(&adapter->driver_lock, flags); 1420 spin_unlock_irqrestore(&adapter->driver_lock, flags);
1458 1421
1459done: 1422done:
1460 LEAVE(); 1423 lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
1461 return ret; 1424 return ret;
1462} 1425}
1426EXPORT_SYMBOL_GPL(libertas_prepare_and_send_command);
1463 1427
1464/** 1428/**
1465 * @brief This function allocates the command buffer and link 1429 * @brief This function allocates the command buffer and link
@@ -1477,33 +1441,29 @@ int libertas_allocate_cmd_buffer(wlan_private * priv)
1477 u8 *ptempvirtualaddr; 1441 u8 *ptempvirtualaddr;
1478 wlan_adapter *adapter = priv->adapter; 1442 wlan_adapter *adapter = priv->adapter;
1479 1443
1480 ENTER(); 1444 lbs_deb_enter(LBS_DEB_CMD);
1481 1445
1482 /* Allocate and initialize cmdCtrlNode */ 1446 /* Allocate and initialize cmdCtrlNode */
1483 ulbufsize = sizeof(struct cmd_ctrl_node) * MRVDRV_NUM_OF_CMD_BUFFER; 1447 ulbufsize = sizeof(struct cmd_ctrl_node) * MRVDRV_NUM_OF_CMD_BUFFER;
1484 1448
1485 if (!(tempcmd_array = kmalloc(ulbufsize, GFP_KERNEL))) { 1449 if (!(tempcmd_array = kzalloc(ulbufsize, GFP_KERNEL))) {
1486 lbs_pr_debug(1, 1450 lbs_deb_cmd(
1487 "ALLOC_CMD_BUF: failed to allocate tempcmd_array\n"); 1451 "ALLOC_CMD_BUF: failed to allocate tempcmd_array\n");
1488 ret = -1; 1452 ret = -1;
1489 goto done; 1453 goto done;
1490 } 1454 }
1491
1492 adapter->cmd_array = tempcmd_array; 1455 adapter->cmd_array = tempcmd_array;
1493 memset(adapter->cmd_array, 0, ulbufsize);
1494 1456
1495 /* Allocate and initialize command buffers */ 1457 /* Allocate and initialize command buffers */
1496 ulbufsize = MRVDRV_SIZE_OF_CMD_BUFFER; 1458 ulbufsize = MRVDRV_SIZE_OF_CMD_BUFFER;
1497 for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) { 1459 for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) {
1498 if (!(ptempvirtualaddr = kmalloc(ulbufsize, GFP_KERNEL))) { 1460 if (!(ptempvirtualaddr = kzalloc(ulbufsize, GFP_KERNEL))) {
1499 lbs_pr_debug(1, 1461 lbs_deb_cmd(
1500 "ALLOC_CMD_BUF: ptempvirtualaddr: out of memory\n"); 1462 "ALLOC_CMD_BUF: ptempvirtualaddr: out of memory\n");
1501 ret = -1; 1463 ret = -1;
1502 goto done; 1464 goto done;
1503 } 1465 }
1504 1466
1505 memset(ptempvirtualaddr, 0, ulbufsize);
1506
1507 /* Update command buffer virtual */ 1467 /* Update command buffer virtual */
1508 tempcmd_array[i].bufvirtualaddr = ptempvirtualaddr; 1468 tempcmd_array[i].bufvirtualaddr = ptempvirtualaddr;
1509 } 1469 }
@@ -1514,8 +1474,9 @@ int libertas_allocate_cmd_buffer(wlan_private * priv)
1514 } 1474 }
1515 1475
1516 ret = 0; 1476 ret = 0;
1517 done: 1477
1518 LEAVE(); 1478done:
1479 lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
1519 return ret; 1480 return ret;
1520} 1481}
1521 1482
@@ -1527,16 +1488,16 @@ int libertas_allocate_cmd_buffer(wlan_private * priv)
1527 */ 1488 */
1528int libertas_free_cmd_buffer(wlan_private * priv) 1489int libertas_free_cmd_buffer(wlan_private * priv)
1529{ 1490{
1530 u32 ulbufsize; 1491 u32 ulbufsize; /* Someone needs to die for this. Slowly and painfully */
1531 unsigned int i; 1492 unsigned int i;
1532 struct cmd_ctrl_node *tempcmd_array; 1493 struct cmd_ctrl_node *tempcmd_array;
1533 wlan_adapter *adapter = priv->adapter; 1494 wlan_adapter *adapter = priv->adapter;
1534 1495
1535 ENTER(); 1496 lbs_deb_enter(LBS_DEB_CMD);
1536 1497
1537 /* need to check if cmd array is allocated or not */ 1498 /* need to check if cmd array is allocated or not */
1538 if (adapter->cmd_array == NULL) { 1499 if (adapter->cmd_array == NULL) {
1539 lbs_pr_debug(1, "FREE_CMD_BUF: cmd_array is Null\n"); 1500 lbs_deb_cmd("FREE_CMD_BUF: cmd_array is Null\n");
1540 goto done; 1501 goto done;
1541 } 1502 }
1542 1503
@@ -1546,7 +1507,7 @@ int libertas_free_cmd_buffer(wlan_private * priv)
1546 ulbufsize = MRVDRV_SIZE_OF_CMD_BUFFER; 1507 ulbufsize = MRVDRV_SIZE_OF_CMD_BUFFER;
1547 for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) { 1508 for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) {
1548 if (tempcmd_array[i].bufvirtualaddr) { 1509 if (tempcmd_array[i].bufvirtualaddr) {
1549 lbs_pr_debug(1, "Free all the array\n"); 1510 lbs_deb_cmd("Free all the array\n");
1550 kfree(tempcmd_array[i].bufvirtualaddr); 1511 kfree(tempcmd_array[i].bufvirtualaddr);
1551 tempcmd_array[i].bufvirtualaddr = NULL; 1512 tempcmd_array[i].bufvirtualaddr = NULL;
1552 } 1513 }
@@ -1554,13 +1515,13 @@ int libertas_free_cmd_buffer(wlan_private * priv)
1554 1515
1555 /* Release cmd_ctrl_node */ 1516 /* Release cmd_ctrl_node */
1556 if (adapter->cmd_array) { 1517 if (adapter->cmd_array) {
1557 lbs_pr_debug(1, "Free cmd_array\n"); 1518 lbs_deb_cmd("Free cmd_array\n");
1558 kfree(adapter->cmd_array); 1519 kfree(adapter->cmd_array);
1559 adapter->cmd_array = NULL; 1520 adapter->cmd_array = NULL;
1560 } 1521 }
1561 1522
1562done: 1523done:
1563 LEAVE(); 1524 lbs_deb_leave(LBS_DEB_CMD);
1564 return 0; 1525 return 0;
1565} 1526}
1566 1527
@@ -1586,16 +1547,18 @@ struct cmd_ctrl_node *libertas_get_free_cmd_ctrl_node(wlan_private * priv)
1586 tempnode = (struct cmd_ctrl_node *)adapter->cmdfreeq.next; 1547 tempnode = (struct cmd_ctrl_node *)adapter->cmdfreeq.next;
1587 list_del((struct list_head *)tempnode); 1548 list_del((struct list_head *)tempnode);
1588 } else { 1549 } else {
1589 lbs_pr_debug(1, "GET_CMD_NODE: cmd_ctrl_node is not available\n"); 1550 lbs_deb_cmd("GET_CMD_NODE: cmd_ctrl_node is not available\n");
1590 tempnode = NULL; 1551 tempnode = NULL;
1591 } 1552 }
1592 1553
1593 spin_unlock_irqrestore(&adapter->driver_lock, flags); 1554 spin_unlock_irqrestore(&adapter->driver_lock, flags);
1594 1555
1595 if (tempnode) { 1556 if (tempnode) {
1557 /*
1596 lbs_pr_debug(3, "GET_CMD_NODE: cmdCtrlNode available\n"); 1558 lbs_pr_debug(3, "GET_CMD_NODE: cmdCtrlNode available\n");
1597 lbs_pr_debug(3, "GET_CMD_NODE: cmdCtrlNode Address = %p\n", 1559 lbs_pr_debug(3, "GET_CMD_NODE: cmdCtrlNode Address = %p\n",
1598 tempnode); 1560 tempnode);
1561 */
1599 cleanup_cmdnode(tempnode); 1562 cleanup_cmdnode(tempnode);
1600 } 1563 }
1601 1564
@@ -1638,7 +1601,7 @@ void libertas_set_cmd_ctrl_node(wlan_private * priv,
1638 struct cmd_ctrl_node *ptempnode, 1601 struct cmd_ctrl_node *ptempnode,
1639 u32 cmd_oid, u16 wait_option, void *pdata_buf) 1602 u32 cmd_oid, u16 wait_option, void *pdata_buf)
1640{ 1603{
1641 ENTER(); 1604 lbs_deb_enter(LBS_DEB_CMD);
1642 1605
1643 if (!ptempnode) 1606 if (!ptempnode)
1644 return; 1607 return;
@@ -1647,7 +1610,7 @@ void libertas_set_cmd_ctrl_node(wlan_private * priv,
1647 ptempnode->wait_option = wait_option; 1610 ptempnode->wait_option = wait_option;
1648 ptempnode->pdata_buf = pdata_buf; 1611 ptempnode->pdata_buf = pdata_buf;
1649 1612
1650 LEAVE(); 1613 lbs_deb_leave(LBS_DEB_CMD);
1651} 1614}
1652 1615
1653/** 1616/**
@@ -1666,7 +1629,7 @@ int libertas_execute_next_command(wlan_private * priv)
1666 unsigned long flags; 1629 unsigned long flags;
1667 int ret = 0; 1630 int ret = 0;
1668 1631
1669 lbs_pr_debug(1, "libertas_execute_next_command\n"); 1632 lbs_deb_enter(LBS_DEB_CMD);
1670 1633
1671 spin_lock_irqsave(&adapter->driver_lock, flags); 1634 spin_lock_irqsave(&adapter->driver_lock, flags);
1672 1635
@@ -1685,23 +1648,24 @@ int libertas_execute_next_command(wlan_private * priv)
1685 spin_unlock_irqrestore(&adapter->driver_lock, flags); 1648 spin_unlock_irqrestore(&adapter->driver_lock, flags);
1686 1649
1687 if (cmdnode) { 1650 if (cmdnode) {
1688 lbs_pr_debug(1, 1651 lbs_deb_cmd(
1689 "EXEC_NEXT_CMD: Got next command from cmdpendingq\n"); 1652 "EXEC_NEXT_CMD: Got next command from cmdpendingq\n");
1690 cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr; 1653 cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr;
1691 1654
1692 if (is_command_allowed_in_ps(cmdptr->command)) { 1655 if (is_command_allowed_in_ps(cmdptr->command)) {
1693 if ((adapter->psstate == PS_STATE_SLEEP) 1656 if ((adapter->psstate == PS_STATE_SLEEP) ||
1694 || (adapter->psstate == PS_STATE_PRE_SLEEP) 1657 (adapter->psstate == PS_STATE_PRE_SLEEP)) {
1695 ) { 1658 lbs_deb_cmd(
1696 lbs_pr_debug(1,
1697 "EXEC_NEXT_CMD: Cannot send cmd 0x%x in psstate %d\n", 1659 "EXEC_NEXT_CMD: Cannot send cmd 0x%x in psstate %d\n",
1698 cmdptr->command, adapter->psstate); 1660 le16_to_cpu(cmdptr->command),
1661 adapter->psstate);
1699 ret = -1; 1662 ret = -1;
1700 goto done; 1663 goto done;
1701 } 1664 }
1702 lbs_pr_debug(1, "EXEC_NEXT_CMD: OK to send command " 1665 lbs_deb_cmd("EXEC_NEXT_CMD: OK to send command "
1703 "0x%x in psstate %d\n", 1666 "0x%x in psstate %d\n",
1704 cmdptr->command, adapter->psstate); 1667 le16_to_cpu(cmdptr->command),
1668 adapter->psstate);
1705 } else if (adapter->psstate != PS_STATE_FULL_POWER) { 1669 } else if (adapter->psstate != PS_STATE_FULL_POWER) {
1706 /* 1670 /*
1707 * 1. Non-PS command: 1671 * 1. Non-PS command:
@@ -1737,12 +1701,12 @@ int libertas_execute_next_command(wlan_private * priv)
1737 struct cmd_ds_802_11_ps_mode *psm = 1701 struct cmd_ds_802_11_ps_mode *psm =
1738 &cmdptr->params.psmode; 1702 &cmdptr->params.psmode;
1739 1703
1740 lbs_pr_debug(1, 1704 lbs_deb_cmd(
1741 "EXEC_NEXT_CMD: PS cmd- action=0x%x\n", 1705 "EXEC_NEXT_CMD: PS cmd- action=0x%x\n",
1742 psm->action); 1706 psm->action);
1743 if (psm->action != 1707 if (psm->action !=
1744 cpu_to_le16(cmd_subcmd_exit_ps)) { 1708 cpu_to_le16(cmd_subcmd_exit_ps)) {
1745 lbs_pr_debug(1, 1709 lbs_deb_cmd(
1746 "EXEC_NEXT_CMD: Ignore Enter PS cmd\n"); 1710 "EXEC_NEXT_CMD: Ignore Enter PS cmd\n");
1747 list_del((struct list_head *)cmdnode); 1711 list_del((struct list_head *)cmdnode);
1748 libertas_cleanup_and_insert_cmd(priv, cmdnode); 1712 libertas_cleanup_and_insert_cmd(priv, cmdnode);
@@ -1751,10 +1715,9 @@ int libertas_execute_next_command(wlan_private * priv)
1751 goto done; 1715 goto done;
1752 } 1716 }
1753 1717
1754 if ((adapter->psstate == PS_STATE_SLEEP) 1718 if ((adapter->psstate == PS_STATE_SLEEP) ||
1755 || (adapter->psstate == PS_STATE_PRE_SLEEP) 1719 (adapter->psstate == PS_STATE_PRE_SLEEP)) {
1756 ) { 1720 lbs_deb_cmd(
1757 lbs_pr_debug(1,
1758 "EXEC_NEXT_CMD: Ignore ExitPS cmd in sleep\n"); 1721 "EXEC_NEXT_CMD: Ignore ExitPS cmd in sleep\n");
1759 list_del((struct list_head *)cmdnode); 1722 list_del((struct list_head *)cmdnode);
1760 libertas_cleanup_and_insert_cmd(priv, cmdnode); 1723 libertas_cleanup_and_insert_cmd(priv, cmdnode);
@@ -1764,13 +1727,13 @@ int libertas_execute_next_command(wlan_private * priv)
1764 goto done; 1727 goto done;
1765 } 1728 }
1766 1729
1767 lbs_pr_debug(1, 1730 lbs_deb_cmd(
1768 "EXEC_NEXT_CMD: Sending Exit_PS down...\n"); 1731 "EXEC_NEXT_CMD: Sending Exit_PS down...\n");
1769 } 1732 }
1770 } 1733 }
1771 list_del((struct list_head *)cmdnode); 1734 list_del((struct list_head *)cmdnode);
1772 lbs_pr_debug(1, "EXEC_NEXT_CMD: Sending 0x%04X command\n", 1735 lbs_deb_cmd("EXEC_NEXT_CMD: Sending 0x%04X command\n",
1773 cmdptr->command); 1736 le16_to_cpu(cmdptr->command));
1774 DownloadcommandToStation(priv, cmdnode); 1737 DownloadcommandToStation(priv, cmdnode);
1775 } else { 1738 } else {
1776 /* 1739 /*
@@ -1780,18 +1743,18 @@ int libertas_execute_next_command(wlan_private * priv)
1780 if ((adapter->psmode != wlan802_11powermodecam) && 1743 if ((adapter->psmode != wlan802_11powermodecam) &&
1781 (adapter->psstate == PS_STATE_FULL_POWER) && 1744 (adapter->psstate == PS_STATE_FULL_POWER) &&
1782 (adapter->connect_status == libertas_connected)) { 1745 (adapter->connect_status == libertas_connected)) {
1783 if (adapter->secinfo.WPAenabled 1746 if (adapter->secinfo.WPAenabled ||
1784 || adapter->secinfo.WPA2enabled) { 1747 adapter->secinfo.WPA2enabled) {
1785 /* check for valid WPA group keys */ 1748 /* check for valid WPA group keys */
1786 if (adapter->wpa_mcast_key.len 1749 if (adapter->wpa_mcast_key.len ||
1787 || adapter->wpa_unicast_key.len) { 1750 adapter->wpa_unicast_key.len) {
1788 lbs_pr_debug(1, 1751 lbs_deb_cmd(
1789 "EXEC_NEXT_CMD: WPA enabled and GTK_SET" 1752 "EXEC_NEXT_CMD: WPA enabled and GTK_SET"
1790 " go back to PS_SLEEP"); 1753 " go back to PS_SLEEP");
1791 libertas_ps_sleep(priv, 0); 1754 libertas_ps_sleep(priv, 0);
1792 } 1755 }
1793 } else { 1756 } else {
1794 lbs_pr_debug(1, 1757 lbs_deb_cmd(
1795 "EXEC_NEXT_CMD: command PendQ is empty," 1758 "EXEC_NEXT_CMD: command PendQ is empty,"
1796 " go back to PS_SLEEP"); 1759 " go back to PS_SLEEP");
1797 libertas_ps_sleep(priv, 0); 1760 libertas_ps_sleep(priv, 0);
@@ -1801,6 +1764,7 @@ int libertas_execute_next_command(wlan_private * priv)
1801 1764
1802 ret = 0; 1765 ret = 0;
1803done: 1766done:
1767 lbs_deb_leave(LBS_DEB_CMD);
1804 return ret; 1768 return ret;
1805} 1769}
1806 1770
@@ -1809,7 +1773,7 @@ void libertas_send_iwevcustom_event(wlan_private * priv, s8 * str)
1809 union iwreq_data iwrq; 1773 union iwreq_data iwrq;
1810 u8 buf[50]; 1774 u8 buf[50];
1811 1775
1812 ENTER(); 1776 lbs_deb_enter(LBS_DEB_CMD);
1813 1777
1814 memset(&iwrq, 0, sizeof(union iwreq_data)); 1778 memset(&iwrq, 0, sizeof(union iwreq_data));
1815 memset(buf, 0, sizeof(buf)); 1779 memset(buf, 0, sizeof(buf));
@@ -1819,15 +1783,13 @@ void libertas_send_iwevcustom_event(wlan_private * priv, s8 * str)
1819 iwrq.data.length = strlen(buf) + 1 + IW_EV_LCP_LEN; 1783 iwrq.data.length = strlen(buf) + 1 + IW_EV_LCP_LEN;
1820 1784
1821 /* Send Event to upper layer */ 1785 /* Send Event to upper layer */
1822 lbs_pr_debug(1, "Event Indication string = %s\n", 1786 lbs_deb_cmd("Event Indication string = %s\n", (char *)buf);
1823 (char *)buf); 1787 lbs_deb_cmd("Event Indication String length = %d\n", iwrq.data.length);
1824 lbs_pr_debug(1, "Event Indication String length = %d\n", iwrq.data.length);
1825 1788
1826 lbs_pr_debug(1, "Sending wireless event IWEVCUSTOM for %s\n", str); 1789 lbs_deb_cmd("Sending wireless event IWEVCUSTOM for %s\n", str);
1827 wireless_send_event(priv->wlan_dev.netdev, IWEVCUSTOM, &iwrq, buf); 1790 wireless_send_event(priv->dev, IWEVCUSTOM, &iwrq, buf);
1828 1791
1829 LEAVE(); 1792 lbs_deb_leave(LBS_DEB_CMD);
1830 return;
1831} 1793}
1832 1794
1833static int sendconfirmsleep(wlan_private * priv, u8 * cmdptr, u16 size) 1795static int sendconfirmsleep(wlan_private * priv, u8 * cmdptr, u16 size)
@@ -1836,19 +1798,19 @@ static int sendconfirmsleep(wlan_private * priv, u8 * cmdptr, u16 size)
1836 wlan_adapter *adapter = priv->adapter; 1798 wlan_adapter *adapter = priv->adapter;
1837 int ret = 0; 1799 int ret = 0;
1838 1800
1839 ENTER(); 1801 lbs_deb_enter(LBS_DEB_CMD);
1840 1802
1841 lbs_pr_debug(1, "SEND_SLEEPC_CMD: Before download, size of cmd = %d\n", 1803 lbs_deb_cmd("SEND_SLEEPC_CMD: Before download, size of cmd = %d\n",
1842 size); 1804 size);
1843 1805
1844 lbs_dbg_hex("SEND_SLEEPC_CMD: Sleep confirm command", cmdptr, size); 1806 lbs_dbg_hex("SEND_SLEEPC_CMD: Sleep confirm command", cmdptr, size);
1845 1807
1846 ret = libertas_sbi_host_to_card(priv, MVMS_CMD, cmdptr, size); 1808 ret = priv->hw_host_to_card(priv, MVMS_CMD, cmdptr, size);
1847 priv->wlan_dev.dnld_sent = DNLD_RES_RECEIVED; 1809 priv->dnld_sent = DNLD_RES_RECEIVED;
1848 1810
1849 spin_lock_irqsave(&adapter->driver_lock, flags); 1811 spin_lock_irqsave(&adapter->driver_lock, flags);
1850 if (adapter->intcounter || adapter->currenttxskb) 1812 if (adapter->intcounter || adapter->currenttxskb)
1851 lbs_pr_debug(1, "SEND_SLEEPC_CMD: intcounter=%d currenttxskb=%p\n", 1813 lbs_deb_cmd("SEND_SLEEPC_CMD: intcounter=%d currenttxskb=%p\n",
1852 adapter->intcounter, adapter->currenttxskb); 1814 adapter->intcounter, adapter->currenttxskb);
1853 spin_unlock_irqrestore(&adapter->driver_lock, flags); 1815 spin_unlock_irqrestore(&adapter->driver_lock, flags);
1854 1816
@@ -1860,23 +1822,22 @@ static int sendconfirmsleep(wlan_private * priv, u8 * cmdptr, u16 size)
1860 if (!adapter->intcounter) { 1822 if (!adapter->intcounter) {
1861 adapter->psstate = PS_STATE_SLEEP; 1823 adapter->psstate = PS_STATE_SLEEP;
1862 } else { 1824 } else {
1863 lbs_pr_debug(1, "SEND_SLEEPC_CMD: After sent,IntC=%d\n", 1825 lbs_deb_cmd("SEND_SLEEPC_CMD: After sent,IntC=%d\n",
1864 adapter->intcounter); 1826 adapter->intcounter);
1865 } 1827 }
1866 spin_unlock_irqrestore(&adapter->driver_lock, flags); 1828 spin_unlock_irqrestore(&adapter->driver_lock, flags);
1867 1829
1868 lbs_pr_debug(1, "SEND_SLEEPC_CMD: Sent Confirm Sleep command\n"); 1830 lbs_deb_cmd("SEND_SLEEPC_CMD: Sent Confirm Sleep command\n");
1869 lbs_pr_debug(1, "+"); 1831 lbs_deb_cmd("+");
1870 } 1832 }
1871 1833
1872 LEAVE(); 1834 lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
1873 return ret; 1835 return ret;
1874} 1836}
1875 1837
1876void libertas_ps_sleep(wlan_private * priv, int wait_option) 1838void libertas_ps_sleep(wlan_private * priv, int wait_option)
1877{ 1839{
1878 1840 lbs_deb_enter(LBS_DEB_CMD);
1879 ENTER();
1880 1841
1881 /* 1842 /*
1882 * PS is currently supported only in Infrastructure mode 1843 * PS is currently supported only in Infrastructure mode
@@ -1886,8 +1847,7 @@ void libertas_ps_sleep(wlan_private * priv, int wait_option)
1886 libertas_prepare_and_send_command(priv, cmd_802_11_ps_mode, 1847 libertas_prepare_and_send_command(priv, cmd_802_11_ps_mode,
1887 cmd_subcmd_enter_ps, wait_option, 0, NULL); 1848 cmd_subcmd_enter_ps, wait_option, 0, NULL);
1888 1849
1889 LEAVE(); 1850 lbs_deb_leave(LBS_DEB_CMD);
1890 return;
1891} 1851}
1892 1852
1893/** 1853/**
@@ -1899,20 +1859,19 @@ void libertas_ps_sleep(wlan_private * priv, int wait_option)
1899 */ 1859 */
1900void libertas_ps_wakeup(wlan_private * priv, int wait_option) 1860void libertas_ps_wakeup(wlan_private * priv, int wait_option)
1901{ 1861{
1902 enum WLAN_802_11_POWER_MODE Localpsmode; 1862 __le32 Localpsmode;
1903 1863
1904 ENTER(); 1864 lbs_deb_enter(LBS_DEB_CMD);
1905 1865
1906 Localpsmode = wlan802_11powermodecam; 1866 Localpsmode = cpu_to_le32(wlan802_11powermodecam);
1907 1867
1908 lbs_pr_debug(1, "Exit_PS: Localpsmode = %d\n", Localpsmode); 1868 lbs_deb_cmd("Exit_PS: Localpsmode = %d\n", wlan802_11powermodecam);
1909 1869
1910 libertas_prepare_and_send_command(priv, cmd_802_11_ps_mode, 1870 libertas_prepare_and_send_command(priv, cmd_802_11_ps_mode,
1911 cmd_subcmd_exit_ps, 1871 cmd_subcmd_exit_ps,
1912 wait_option, 0, &Localpsmode); 1872 wait_option, 0, &Localpsmode);
1913 1873
1914 LEAVE(); 1874 lbs_deb_leave(LBS_DEB_CMD);
1915 return;
1916} 1875}
1917 1876
1918/** 1877/**
@@ -1929,31 +1888,31 @@ void libertas_ps_confirm_sleep(wlan_private * priv, u16 psmode)
1929 wlan_adapter *adapter = priv->adapter; 1888 wlan_adapter *adapter = priv->adapter;
1930 u8 allowed = 1; 1889 u8 allowed = 1;
1931 1890
1932 ENTER(); 1891 lbs_deb_enter(LBS_DEB_CMD);
1933 1892
1934 if (priv->wlan_dev.dnld_sent) { 1893 if (priv->dnld_sent) {
1935 allowed = 0; 1894 allowed = 0;
1936 lbs_pr_debug(1, "D"); 1895 lbs_deb_cmd("D");
1937 } 1896 }
1938 1897
1939 spin_lock_irqsave(&adapter->driver_lock, flags); 1898 spin_lock_irqsave(&adapter->driver_lock, flags);
1940 if (adapter->cur_cmd) { 1899 if (adapter->cur_cmd) {
1941 allowed = 0; 1900 allowed = 0;
1942 lbs_pr_debug(1, "C"); 1901 lbs_deb_cmd("C");
1943 } 1902 }
1944 if (adapter->intcounter > 0) { 1903 if (adapter->intcounter > 0) {
1945 allowed = 0; 1904 allowed = 0;
1946 lbs_pr_debug(1, "I%d", adapter->intcounter); 1905 lbs_deb_cmd("I%d", adapter->intcounter);
1947 } 1906 }
1948 spin_unlock_irqrestore(&adapter->driver_lock, flags); 1907 spin_unlock_irqrestore(&adapter->driver_lock, flags);
1949 1908
1950 if (allowed) { 1909 if (allowed) {
1951 lbs_pr_debug(1, "Sending libertas_ps_confirm_sleep\n"); 1910 lbs_deb_cmd("Sending libertas_ps_confirm_sleep\n");
1952 sendconfirmsleep(priv, (u8 *) & adapter->libertas_ps_confirm_sleep, 1911 sendconfirmsleep(priv, (u8 *) & adapter->libertas_ps_confirm_sleep,
1953 sizeof(struct PS_CMD_ConfirmSleep)); 1912 sizeof(struct PS_CMD_ConfirmSleep));
1954 } else { 1913 } else {
1955 lbs_pr_debug(1, "Sleep Confirm has been delayed\n"); 1914 lbs_deb_cmd("Sleep Confirm has been delayed\n");
1956 } 1915 }
1957 1916
1958 LEAVE(); 1917 lbs_deb_leave(LBS_DEB_CMD);
1959} 1918}
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
index c86454034b58..0c3b9a583d83 100644
--- a/drivers/net/wireless/libertas/cmdresp.c
+++ b/drivers/net/wireless/libertas/cmdresp.c
@@ -9,7 +9,6 @@
9#include <net/iw_handler.h> 9#include <net/iw_handler.h>
10 10
11#include "host.h" 11#include "host.h"
12#include "sbi.h"
13#include "decl.h" 12#include "decl.h"
14#include "defs.h" 13#include "defs.h"
15#include "dev.h" 14#include "dev.h"
@@ -32,7 +31,7 @@ void libertas_mac_event_disconnected(wlan_private * priv)
32 if (adapter->connect_status != libertas_connected) 31 if (adapter->connect_status != libertas_connected)
33 return; 32 return;
34 33
35 lbs_pr_debug(1, "Handles disconnect event.\n"); 34 lbs_deb_cmd("Handles disconnect event.\n");
36 35
37 memset(wrqu.ap_addr.sa_data, 0x00, ETH_ALEN); 36 memset(wrqu.ap_addr.sa_data, 0x00, ETH_ALEN);
38 wrqu.ap_addr.sa_family = ARPHRD_ETHER; 37 wrqu.ap_addr.sa_family = ARPHRD_ETHER;
@@ -43,15 +42,15 @@ void libertas_mac_event_disconnected(wlan_private * priv)
43 */ 42 */
44 43
45 msleep_interruptible(1000); 44 msleep_interruptible(1000);
46 wireless_send_event(priv->wlan_dev.netdev, SIOCGIWAP, &wrqu, NULL); 45 wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);
47 46
48 /* Free Tx and Rx packets */ 47 /* Free Tx and Rx packets */
49 kfree_skb(priv->adapter->currenttxskb); 48 kfree_skb(priv->adapter->currenttxskb);
50 priv->adapter->currenttxskb = NULL; 49 priv->adapter->currenttxskb = NULL;
51 50
52 /* report disconnect to upper layer */ 51 /* report disconnect to upper layer */
53 netif_stop_queue(priv->wlan_dev.netdev); 52 netif_stop_queue(priv->dev);
54 netif_carrier_off(priv->wlan_dev.netdev); 53 netif_carrier_off(priv->dev);
55 54
56 /* reset SNR/NF/RSSI values */ 55 /* reset SNR/NF/RSSI values */
57 memset(adapter->SNR, 0x00, sizeof(adapter->SNR)); 56 memset(adapter->SNR, 0x00, sizeof(adapter->SNR));
@@ -62,35 +61,32 @@ void libertas_mac_event_disconnected(wlan_private * priv)
62 adapter->nextSNRNF = 0; 61 adapter->nextSNRNF = 0;
63 adapter->numSNRNF = 0; 62 adapter->numSNRNF = 0;
64 adapter->rxpd_rate = 0; 63 adapter->rxpd_rate = 0;
65 lbs_pr_debug(1, "Current SSID=%s, ssid length=%u\n", 64 lbs_deb_cmd("Current SSID='%s', ssid length=%u\n",
66 adapter->curbssparams.ssid.ssid, 65 escape_essid(adapter->curbssparams.ssid,
67 adapter->curbssparams.ssid.ssidlength); 66 adapter->curbssparams.ssid_len),
68 lbs_pr_debug(1, "Previous SSID=%s, ssid length=%u\n", 67 adapter->curbssparams.ssid_len);
69 adapter->previousssid.ssid, adapter->previousssid.ssidlength); 68 lbs_deb_cmd("Previous SSID='%s', ssid length=%u\n",
70 69 escape_essid(adapter->prev_ssid, adapter->prev_ssid_len),
71 /* reset internal flags */ 70 adapter->prev_ssid_len);
72 adapter->secinfo.WPAenabled = 0;
73 adapter->secinfo.WPA2enabled = 0;
74 adapter->wpa_ie_len = 0;
75 71
76 adapter->connect_status = libertas_disconnected; 72 adapter->connect_status = libertas_disconnected;
77 73
78 /* 74 /* Save previous SSID and BSSID for possible reassociation */
79 * memorize the previous SSID and BSSID 75 memcpy(&adapter->prev_ssid, &adapter->curbssparams.ssid,
80 * it could be used for re-assoc 76 IW_ESSID_MAX_SIZE);
81 */ 77 adapter->prev_ssid_len = adapter->curbssparams.ssid_len;
82 memcpy(&adapter->previousssid, 78 memcpy(adapter->prev_bssid, adapter->curbssparams.bssid, ETH_ALEN);
83 &adapter->curbssparams.ssid, sizeof(struct WLAN_802_11_SSID));
84 memcpy(adapter->previousbssid,
85 adapter->curbssparams.bssid, ETH_ALEN);
86 79
87 /* need to erase the current SSID and BSSID info */ 80 /* Clear out associated SSID and BSSID since connection is
88 adapter->pattemptedbssdesc = NULL; 81 * no longer valid.
89 memset(&adapter->curbssparams, 0, sizeof(adapter->curbssparams)); 82 */
83 memset(&adapter->curbssparams.bssid, 0, ETH_ALEN);
84 memset(&adapter->curbssparams.ssid, 0, IW_ESSID_MAX_SIZE);
85 adapter->curbssparams.ssid_len = 0;
90 86
91 if (adapter->psstate != PS_STATE_FULL_POWER) { 87 if (adapter->psstate != PS_STATE_FULL_POWER) {
92 /* make firmware to exit PS mode */ 88 /* make firmware to exit PS mode */
93 lbs_pr_debug(1, "Disconnected, so exit PS mode.\n"); 89 lbs_deb_cmd("Disconnected, so exit PS mode.\n");
94 libertas_ps_wakeup(priv, 0); 90 libertas_ps_wakeup(priv, 0);
95 } 91 }
96} 92}
@@ -122,55 +118,45 @@ static void handle_mic_failureevent(wlan_private * priv, u32 event)
122static int wlan_ret_reg_access(wlan_private * priv, 118static int wlan_ret_reg_access(wlan_private * priv,
123 u16 type, struct cmd_ds_command *resp) 119 u16 type, struct cmd_ds_command *resp)
124{ 120{
121 int ret = 0;
125 wlan_adapter *adapter = priv->adapter; 122 wlan_adapter *adapter = priv->adapter;
126 123
127 ENTER(); 124 lbs_deb_enter(LBS_DEB_CMD);
128 125
129 switch (type) { 126 switch (type) {
130 case cmd_ret_mac_reg_access: 127 case cmd_ret_mac_reg_access:
131 { 128 {
132 struct cmd_ds_mac_reg_access *reg; 129 struct cmd_ds_mac_reg_access *reg = &resp->params.macreg;
133
134 reg =
135 (struct cmd_ds_mac_reg_access *)&resp->params.
136 macreg;
137 130
138 adapter->offsetvalue.offset = reg->offset; 131 adapter->offsetvalue.offset = (u32)le16_to_cpu(reg->offset);
139 adapter->offsetvalue.value = reg->value; 132 adapter->offsetvalue.value = le32_to_cpu(reg->value);
140 break; 133 break;
141 } 134 }
142 135
143 case cmd_ret_bbp_reg_access: 136 case cmd_ret_bbp_reg_access:
144 { 137 {
145 struct cmd_ds_bbp_reg_access *reg; 138 struct cmd_ds_bbp_reg_access *reg = &resp->params.bbpreg;
146 reg =
147 (struct cmd_ds_bbp_reg_access *)&resp->params.
148 bbpreg;
149 139
150 adapter->offsetvalue.offset = reg->offset; 140 adapter->offsetvalue.offset = (u32)le16_to_cpu(reg->offset);
151 adapter->offsetvalue.value = reg->value; 141 adapter->offsetvalue.value = reg->value;
152 break; 142 break;
153 } 143 }
154 144
155 case cmd_ret_rf_reg_access: 145 case cmd_ret_rf_reg_access:
156 { 146 {
157 struct cmd_ds_rf_reg_access *reg; 147 struct cmd_ds_rf_reg_access *reg = &resp->params.rfreg;
158 reg =
159 (struct cmd_ds_rf_reg_access *)&resp->params.
160 rfreg;
161 148
162 adapter->offsetvalue.offset = reg->offset; 149 adapter->offsetvalue.offset = (u32)le16_to_cpu(reg->offset);
163 adapter->offsetvalue.value = reg->value; 150 adapter->offsetvalue.value = reg->value;
164 break; 151 break;
165 } 152 }
166 153
167 default: 154 default:
168 LEAVE(); 155 ret = -1;
169 return -1;
170 } 156 }
171 157
172 LEAVE(); 158 lbs_deb_enter_args(LBS_DEB_CMD, "ret %d", ret);
173 return 0; 159 return ret;
174} 160}
175 161
176static int wlan_ret_get_hw_spec(wlan_private * priv, 162static int wlan_ret_get_hw_spec(wlan_private * priv,
@@ -181,19 +167,20 @@ static int wlan_ret_get_hw_spec(wlan_private * priv,
181 wlan_adapter *adapter = priv->adapter; 167 wlan_adapter *adapter = priv->adapter;
182 int ret = 0; 168 int ret = 0;
183 169
184 ENTER(); 170 lbs_deb_enter(LBS_DEB_CMD);
185 171
186 adapter->fwcapinfo = le32_to_cpu(hwspec->fwcapinfo); 172 adapter->fwcapinfo = le32_to_cpu(hwspec->fwcapinfo);
187 173
188 adapter->fwreleasenumber = hwspec->fwreleasenumber; 174 memcpy(adapter->fwreleasenumber, hwspec->fwreleasenumber, 4);
189 175
190 lbs_pr_debug(1, "GET_HW_SPEC: FWReleaseVersion- 0x%X\n", 176 lbs_deb_cmd("GET_HW_SPEC: FWReleaseVersion- %u.%u.%u.p%u\n",
191 adapter->fwreleasenumber); 177 adapter->fwreleasenumber[2], adapter->fwreleasenumber[1],
192 lbs_pr_debug(1, "GET_HW_SPEC: Permanent addr- %2x:%2x:%2x:%2x:%2x:%2x\n", 178 adapter->fwreleasenumber[0], adapter->fwreleasenumber[3]);
179 lbs_deb_cmd("GET_HW_SPEC: Permanent addr- %2x:%2x:%2x:%2x:%2x:%2x\n",
193 hwspec->permanentaddr[0], hwspec->permanentaddr[1], 180 hwspec->permanentaddr[0], hwspec->permanentaddr[1],
194 hwspec->permanentaddr[2], hwspec->permanentaddr[3], 181 hwspec->permanentaddr[2], hwspec->permanentaddr[3],
195 hwspec->permanentaddr[4], hwspec->permanentaddr[5]); 182 hwspec->permanentaddr[4], hwspec->permanentaddr[5]);
196 lbs_pr_debug(1, "GET_HW_SPEC: hwifversion=0x%X version=0x%X\n", 183 lbs_deb_cmd("GET_HW_SPEC: hwifversion=0x%X version=0x%X\n",
197 hwspec->hwifversion, hwspec->version); 184 hwspec->hwifversion, hwspec->version);
198 185
199 adapter->regioncode = le16_to_cpu(hwspec->regioncode); 186 adapter->regioncode = le16_to_cpu(hwspec->regioncode);
@@ -210,17 +197,15 @@ static int wlan_ret_get_hw_spec(wlan_private * priv,
210 if (i >= MRVDRV_MAX_REGION_CODE) { 197 if (i >= MRVDRV_MAX_REGION_CODE) {
211 adapter->regioncode = 0x10; 198 adapter->regioncode = 0x10;
212 adapter->regiontableindex = 0; 199 adapter->regiontableindex = 0;
213 lbs_pr_info( 200 lbs_pr_info("unidentified region code; using the default (USA)\n");
214 "unidentified region code, use the default (USA)\n");
215 } 201 }
216 202
217 if (adapter->current_addr[0] == 0xff) { 203 if (adapter->current_addr[0] == 0xff)
218 memmove(adapter->current_addr, hwspec->permanentaddr, 204 memmove(adapter->current_addr, hwspec->permanentaddr, ETH_ALEN);
219 ETH_ALEN);
220 }
221 205
222 memcpy(priv->wlan_dev.netdev->dev_addr, adapter->current_addr, ETH_ALEN); 206 memcpy(priv->dev->dev_addr, adapter->current_addr, ETH_ALEN);
223 memcpy(priv->mesh_dev->dev_addr, adapter->current_addr, ETH_ALEN); 207 if (priv->mesh_dev)
208 memcpy(priv->mesh_dev->dev_addr, adapter->current_addr, ETH_ALEN);
224 209
225 if (libertas_set_regiontable(priv, adapter->regioncode, 0)) { 210 if (libertas_set_regiontable(priv, adapter->regioncode, 0)) {
226 ret = -1; 211 ret = -1;
@@ -232,8 +217,8 @@ static int wlan_ret_get_hw_spec(wlan_private * priv,
232 goto done; 217 goto done;
233 } 218 }
234 219
235 done: 220done:
236 LEAVE(); 221 lbs_deb_enter_args(LBS_DEB_CMD, "ret %d", ret);
237 return ret; 222 return ret;
238} 223}
239 224
@@ -243,19 +228,21 @@ static int wlan_ret_802_11_sleep_params(wlan_private * priv,
243 struct cmd_ds_802_11_sleep_params *sp = &resp->params.sleep_params; 228 struct cmd_ds_802_11_sleep_params *sp = &resp->params.sleep_params;
244 wlan_adapter *adapter = priv->adapter; 229 wlan_adapter *adapter = priv->adapter;
245 230
246 ENTER(); 231 lbs_deb_enter(LBS_DEB_CMD);
232
233 lbs_deb_cmd("error=%x offset=%x stabletime=%x calcontrol=%x\n"
234 " extsleepclk=%x\n", le16_to_cpu(sp->error),
235 le16_to_cpu(sp->offset), le16_to_cpu(sp->stabletime),
236 sp->calcontrol, sp->externalsleepclk);
247 237
248 lbs_pr_debug(1, "error=%x offset=%x stabletime=%x calcontrol=%x\n"
249 " extsleepclk=%x\n", sp->error, sp->offset,
250 sp->stabletime, sp->calcontrol, sp->externalsleepclk);
251 adapter->sp.sp_error = le16_to_cpu(sp->error); 238 adapter->sp.sp_error = le16_to_cpu(sp->error);
252 adapter->sp.sp_offset = le16_to_cpu(sp->offset); 239 adapter->sp.sp_offset = le16_to_cpu(sp->offset);
253 adapter->sp.sp_stabletime = le16_to_cpu(sp->stabletime); 240 adapter->sp.sp_stabletime = le16_to_cpu(sp->stabletime);
254 adapter->sp.sp_calcontrol = le16_to_cpu(sp->calcontrol); 241 adapter->sp.sp_calcontrol = sp->calcontrol;
255 adapter->sp.sp_extsleepclk = le16_to_cpu(sp->externalsleepclk); 242 adapter->sp.sp_extsleepclk = sp->externalsleepclk;
256 adapter->sp.sp_reserved = le16_to_cpu(sp->reserved); 243 adapter->sp.sp_reserved = le16_to_cpu(sp->reserved);
257 244
258 LEAVE(); 245 lbs_deb_enter(LBS_DEB_CMD);
259 return 0; 246 return 0;
260} 247}
261 248
@@ -281,42 +268,38 @@ static int wlan_ret_802_11_snmp_mib(wlan_private * priv,
281 u16 oid = le16_to_cpu(smib->oid); 268 u16 oid = le16_to_cpu(smib->oid);
282 u16 querytype = le16_to_cpu(smib->querytype); 269 u16 querytype = le16_to_cpu(smib->querytype);
283 270
284 ENTER(); 271 lbs_deb_enter(LBS_DEB_CMD);
285 272
286 lbs_pr_debug(1, "SNMP_RESP: value of the oid = %x, querytype=%x\n", oid, 273 lbs_deb_cmd("SNMP_RESP: value of the oid = %x, querytype=%x\n", oid,
287 querytype); 274 querytype);
288 lbs_pr_debug(1, "SNMP_RESP: Buf size = %x\n", 275 lbs_deb_cmd("SNMP_RESP: Buf size = %x\n", le16_to_cpu(smib->bufsize));
289 le16_to_cpu(smib->bufsize));
290 276
291 if (querytype == cmd_act_get) { 277 if (querytype == cmd_act_get) {
292 switch (oid) { 278 switch (oid) {
293 case fragthresh_i: 279 case fragthresh_i:
294 priv->adapter->fragthsd = 280 priv->adapter->fragthsd =
295 le16_to_cpu(* 281 le16_to_cpu(*((__le16 *)(smib->value)));
296 ((unsigned short *)(smib->value))); 282 lbs_deb_cmd("SNMP_RESP: fragthsd =%u\n",
297 lbs_pr_debug(1, "SNMP_RESP: fragthsd =%u\n", 283 priv->adapter->fragthsd);
298 priv->adapter->fragthsd);
299 break; 284 break;
300 case rtsthresh_i: 285 case rtsthresh_i:
301 priv->adapter->rtsthsd = 286 priv->adapter->rtsthsd =
302 le16_to_cpu(* 287 le16_to_cpu(*((__le16 *)(smib->value)));
303 ((unsigned short *)(smib->value))); 288 lbs_deb_cmd("SNMP_RESP: rtsthsd =%u\n",
304 lbs_pr_debug(1, "SNMP_RESP: rtsthsd =%u\n", 289 priv->adapter->rtsthsd);
305 priv->adapter->rtsthsd);
306 break; 290 break;
307 case short_retrylim_i: 291 case short_retrylim_i:
308 priv->adapter->txretrycount = 292 priv->adapter->txretrycount =
309 le16_to_cpu(* 293 le16_to_cpu(*((__le16 *)(smib->value)));
310 ((unsigned short *)(smib->value))); 294 lbs_deb_cmd("SNMP_RESP: txretrycount =%u\n",
311 lbs_pr_debug(1, "SNMP_RESP: txretrycount =%u\n", 295 priv->adapter->rtsthsd);
312 priv->adapter->rtsthsd);
313 break; 296 break;
314 default: 297 default:
315 break; 298 break;
316 } 299 }
317 } 300 }
318 301
319 LEAVE(); 302 lbs_deb_enter(LBS_DEB_CMD);
320 return 0; 303 return 0;
321} 304}
322 305
@@ -328,7 +311,7 @@ static int wlan_ret_802_11_key_material(wlan_private * priv,
328 wlan_adapter *adapter = priv->adapter; 311 wlan_adapter *adapter = priv->adapter;
329 u16 action = le16_to_cpu(pkeymaterial->action); 312 u16 action = le16_to_cpu(pkeymaterial->action);
330 313
331 ENTER(); 314 lbs_deb_enter(LBS_DEB_CMD);
332 315
333 /* Copy the returned key to driver private data */ 316 /* Copy the returned key to driver private data */
334 if (action == cmd_act_get) { 317 if (action == cmd_act_get) {
@@ -371,7 +354,7 @@ static int wlan_ret_802_11_key_material(wlan_private * priv,
371 } 354 }
372 } 355 }
373 356
374 LEAVE(); 357 lbs_deb_enter(LBS_DEB_CMD);
375 return 0; 358 return 0;
376} 359}
377 360
@@ -381,11 +364,11 @@ static int wlan_ret_802_11_mac_address(wlan_private * priv,
381 struct cmd_ds_802_11_mac_address *macadd = &resp->params.macadd; 364 struct cmd_ds_802_11_mac_address *macadd = &resp->params.macadd;
382 wlan_adapter *adapter = priv->adapter; 365 wlan_adapter *adapter = priv->adapter;
383 366
384 ENTER(); 367 lbs_deb_enter(LBS_DEB_CMD);
385 368
386 memcpy(adapter->current_addr, macadd->macadd, ETH_ALEN); 369 memcpy(adapter->current_addr, macadd->macadd, ETH_ALEN);
387 370
388 LEAVE(); 371 lbs_deb_enter(LBS_DEB_CMD);
389 return 0; 372 return 0;
390} 373}
391 374
@@ -395,13 +378,13 @@ static int wlan_ret_802_11_rf_tx_power(wlan_private * priv,
395 struct cmd_ds_802_11_rf_tx_power *rtp = &resp->params.txp; 378 struct cmd_ds_802_11_rf_tx_power *rtp = &resp->params.txp;
396 wlan_adapter *adapter = priv->adapter; 379 wlan_adapter *adapter = priv->adapter;
397 380
398 ENTER(); 381 lbs_deb_enter(LBS_DEB_CMD);
399 382
400 adapter->txpowerlevel = le16_to_cpu(rtp->currentlevel); 383 adapter->txpowerlevel = le16_to_cpu(rtp->currentlevel);
401 384
402 lbs_pr_debug(1, "Current TxPower Level = %d\n", adapter->txpowerlevel); 385 lbs_deb_cmd("Current TxPower Level = %d\n", adapter->txpowerlevel);
403 386
404 LEAVE(); 387 lbs_deb_enter(LBS_DEB_CMD);
405 return 0; 388 return 0;
406} 389}
407 390
@@ -413,14 +396,12 @@ static int wlan_ret_802_11_rf_antenna(wlan_private * priv,
413 u16 action = le16_to_cpu(pAntenna->action); 396 u16 action = le16_to_cpu(pAntenna->action);
414 397
415 if (action == cmd_act_get_rx) 398 if (action == cmd_act_get_rx)
416 adapter->rxantennamode = 399 adapter->rxantennamode = le16_to_cpu(pAntenna->antennamode);
417 le16_to_cpu(pAntenna->antennamode);
418 400
419 if (action == cmd_act_get_tx) 401 if (action == cmd_act_get_tx)
420 adapter->txantennamode = 402 adapter->txantennamode = le16_to_cpu(pAntenna->antennamode);
421 le16_to_cpu(pAntenna->antennamode);
422 403
423 lbs_pr_debug(1, "RF_ANT_RESP: action = 0x%x, mode = 0x%04x\n", 404 lbs_deb_cmd("RF_ANT_RESP: action = 0x%x, mode = 0x%04x\n",
424 action, le16_to_cpu(pAntenna->antennamode)); 405 action, le16_to_cpu(pAntenna->antennamode));
425 406
426 return 0; 407 return 0;
@@ -429,19 +410,17 @@ static int wlan_ret_802_11_rf_antenna(wlan_private * priv,
429static int wlan_ret_802_11_rate_adapt_rateset(wlan_private * priv, 410static int wlan_ret_802_11_rate_adapt_rateset(wlan_private * priv,
430 struct cmd_ds_command *resp) 411 struct cmd_ds_command *resp)
431{ 412{
432 struct cmd_ds_802_11_rate_adapt_rateset *rates = 413 struct cmd_ds_802_11_rate_adapt_rateset *rates = &resp->params.rateset;
433 &resp->params.rateset;
434 wlan_adapter *adapter = priv->adapter; 414 wlan_adapter *adapter = priv->adapter;
435 415
436 ENTER(); 416 lbs_deb_enter(LBS_DEB_CMD);
437 417
438 if (rates->action == cmd_act_get) { 418 if (rates->action == cmd_act_get) {
439 adapter->enablehwauto = rates->enablehwauto; 419 adapter->enablehwauto = le16_to_cpu(rates->enablehwauto);
440 adapter->ratebitmap = rates->bitmap; 420 adapter->ratebitmap = le16_to_cpu(rates->bitmap);
441 } 421 }
442 422
443 LEAVE(); 423 lbs_deb_enter(LBS_DEB_CMD);
444
445 return 0; 424 return 0;
446} 425}
447 426
@@ -452,43 +431,42 @@ static int wlan_ret_802_11_data_rate(wlan_private * priv,
452 wlan_adapter *adapter = priv->adapter; 431 wlan_adapter *adapter = priv->adapter;
453 u8 dot11datarate; 432 u8 dot11datarate;
454 433
455 ENTER(); 434 lbs_deb_enter(LBS_DEB_CMD);
456 435
457 lbs_dbg_hex("DATA_RATE_RESP: data_rate- ", 436 lbs_dbg_hex("DATA_RATE_RESP: data_rate- ",
458 (u8 *) pdatarate, sizeof(struct cmd_ds_802_11_data_rate)); 437 (u8 *) pdatarate, sizeof(struct cmd_ds_802_11_data_rate));
459 438
460 dot11datarate = pdatarate->datarate[0]; 439 dot11datarate = pdatarate->datarate[0];
461 if (pdatarate->action == cmd_act_get_tx_rate) { 440 if (pdatarate->action == cpu_to_le16(cmd_act_get_tx_rate)) {
462 memcpy(adapter->libertas_supported_rates, pdatarate->datarate, 441 memcpy(adapter->libertas_supported_rates, pdatarate->datarate,
463 sizeof(adapter->libertas_supported_rates)); 442 sizeof(adapter->libertas_supported_rates));
464 } 443 }
465 adapter->datarate = libertas_index_to_data_rate(dot11datarate); 444 adapter->datarate = libertas_index_to_data_rate(dot11datarate);
466 445
467 LEAVE(); 446 lbs_deb_enter(LBS_DEB_CMD);
468 return 0; 447 return 0;
469} 448}
470 449
471static int wlan_ret_802_11_rf_channel(wlan_private * priv, 450static int wlan_ret_802_11_rf_channel(wlan_private * priv,
472 struct cmd_ds_command *resp) 451 struct cmd_ds_command *resp)
473{ 452{
474 struct cmd_ds_802_11_rf_channel *rfchannel = 453 struct cmd_ds_802_11_rf_channel *rfchannel = &resp->params.rfchannel;
475 &resp->params.rfchannel;
476 wlan_adapter *adapter = priv->adapter; 454 wlan_adapter *adapter = priv->adapter;
477 u16 action = le16_to_cpu(rfchannel->action); 455 u16 action = le16_to_cpu(rfchannel->action);
478 u16 newchannel = le16_to_cpu(rfchannel->currentchannel); 456 u16 newchannel = le16_to_cpu(rfchannel->currentchannel);
479 457
480 ENTER(); 458 lbs_deb_enter(LBS_DEB_CMD);
481 459
482 if (action == cmd_opt_802_11_rf_channel_get 460 if (action == cmd_opt_802_11_rf_channel_get
483 && adapter->curbssparams.channel != newchannel) { 461 && adapter->curbssparams.channel != newchannel) {
484 lbs_pr_debug(1, "channel Switch: %d to %d\n", 462 lbs_deb_cmd("channel Switch: %d to %d\n",
485 adapter->curbssparams.channel, newchannel); 463 adapter->curbssparams.channel, newchannel);
486 464
487 /* Update the channel again */ 465 /* Update the channel again */
488 adapter->curbssparams.channel = newchannel; 466 adapter->curbssparams.channel = newchannel;
489 } 467 }
490 468
491 LEAVE(); 469 lbs_deb_enter(LBS_DEB_CMD);
492 return 0; 470 return 0;
493} 471}
494 472
@@ -500,12 +478,10 @@ static int wlan_ret_802_11_rssi(wlan_private * priv,
500 478
501 /* store the non average value */ 479 /* store the non average value */
502 adapter->SNR[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->SNR); 480 adapter->SNR[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->SNR);
503 adapter->NF[TYPE_BEACON][TYPE_NOAVG] = 481 adapter->NF[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->noisefloor);
504 le16_to_cpu(rssirsp->noisefloor);
505 482
506 adapter->SNR[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgSNR); 483 adapter->SNR[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgSNR);
507 adapter->NF[TYPE_BEACON][TYPE_AVG] = 484 adapter->NF[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgnoisefloor);
508 le16_to_cpu(rssirsp->avgnoisefloor);
509 485
510 adapter->RSSI[TYPE_BEACON][TYPE_NOAVG] = 486 adapter->RSSI[TYPE_BEACON][TYPE_NOAVG] =
511 CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_NOAVG], 487 CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_NOAVG],
@@ -515,7 +491,7 @@ static int wlan_ret_802_11_rssi(wlan_private * priv,
515 CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_AVG] / AVG_SCALE, 491 CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_AVG] / AVG_SCALE,
516 adapter->NF[TYPE_BEACON][TYPE_AVG] / AVG_SCALE); 492 adapter->NF[TYPE_BEACON][TYPE_AVG] / AVG_SCALE);
517 493
518 lbs_pr_debug(1, "Beacon RSSI value = 0x%x\n", 494 lbs_deb_cmd("Beacon RSSI value = 0x%x\n",
519 adapter->RSSI[TYPE_BEACON][TYPE_AVG]); 495 adapter->RSSI[TYPE_BEACON][TYPE_AVG]);
520 496
521 return 0; 497 return 0;
@@ -528,11 +504,11 @@ static int wlan_ret_802_11_eeprom_access(wlan_private * priv,
528 struct wlan_ioctl_regrdwr *pbuf; 504 struct wlan_ioctl_regrdwr *pbuf;
529 pbuf = (struct wlan_ioctl_regrdwr *) adapter->prdeeprom; 505 pbuf = (struct wlan_ioctl_regrdwr *) adapter->prdeeprom;
530 506
531 lbs_pr_debug(1, "eeprom read len=%x\n", 507 lbs_deb_cmd("eeprom read len=%x\n",
532 le16_to_cpu(resp->params.rdeeprom.bytecount)); 508 le16_to_cpu(resp->params.rdeeprom.bytecount));
533 if (pbuf->NOB < le16_to_cpu(resp->params.rdeeprom.bytecount)) { 509 if (pbuf->NOB < le16_to_cpu(resp->params.rdeeprom.bytecount)) {
534 pbuf->NOB = 0; 510 pbuf->NOB = 0;
535 lbs_pr_debug(1, "eeprom read return length is too big\n"); 511 lbs_deb_cmd("eeprom read return length is too big\n");
536 return -1; 512 return -1;
537 } 513 }
538 pbuf->NOB = le16_to_cpu(resp->params.rdeeprom.bytecount); 514 pbuf->NOB = le16_to_cpu(resp->params.rdeeprom.bytecount);
@@ -549,17 +525,15 @@ static int wlan_ret_802_11_eeprom_access(wlan_private * priv,
549static int wlan_ret_get_log(wlan_private * priv, 525static int wlan_ret_get_log(wlan_private * priv,
550 struct cmd_ds_command *resp) 526 struct cmd_ds_command *resp)
551{ 527{
552 struct cmd_ds_802_11_get_log *logmessage = 528 struct cmd_ds_802_11_get_log *logmessage = &resp->params.glog;
553 (struct cmd_ds_802_11_get_log *)&resp->params.glog;
554 wlan_adapter *adapter = priv->adapter; 529 wlan_adapter *adapter = priv->adapter;
555 530
556 ENTER(); 531 lbs_deb_enter(LBS_DEB_CMD);
557 532
558 /* TODO Convert it to Big Endian before copy */ 533 /* Stored little-endian */
559 memcpy(&adapter->logmsg, logmessage, 534 memcpy(&adapter->logmsg, logmessage, sizeof(struct cmd_ds_802_11_get_log));
560 sizeof(struct cmd_ds_802_11_get_log));
561 535
562 LEAVE(); 536 lbs_deb_enter(LBS_DEB_CMD);
563 return 0; 537 return 0;
564} 538}
565 539
@@ -620,8 +594,7 @@ static inline int handle_cmd_response(u16 respcmd,
620 case cmd_ret_802_11_set_afc: 594 case cmd_ret_802_11_set_afc:
621 case cmd_ret_802_11_get_afc: 595 case cmd_ret_802_11_get_afc:
622 spin_lock_irqsave(&adapter->driver_lock, flags); 596 spin_lock_irqsave(&adapter->driver_lock, flags);
623 memmove(adapter->cur_cmd->pdata_buf, 597 memmove(adapter->cur_cmd->pdata_buf, &resp->params.afc,
624 &resp->params.afc,
625 sizeof(struct cmd_ds_802_11_afc)); 598 sizeof(struct cmd_ds_802_11_afc));
626 spin_unlock_irqrestore(&adapter->driver_lock, flags); 599 spin_unlock_irqrestore(&adapter->driver_lock, flags);
627 600
@@ -663,7 +636,7 @@ static inline int handle_cmd_response(u16 respcmd,
663 break; 636 break;
664 637
665 case cmd_ret_802_11_key_material: 638 case cmd_ret_802_11_key_material:
666 lbs_pr_debug(1, "CMD_RESP: KEY_MATERIAL command response\n"); 639 lbs_deb_cmd("CMD_RESP: KEY_MATERIAL command response\n");
667 ret = wlan_ret_802_11_key_material(priv, resp); 640 ret = wlan_ret_802_11_key_material(priv, resp);
668 break; 641 break;
669 642
@@ -687,22 +660,19 @@ static inline int handle_cmd_response(u16 respcmd,
687 660
688 case cmd_ret_802_11_tpc_cfg: 661 case cmd_ret_802_11_tpc_cfg:
689 spin_lock_irqsave(&adapter->driver_lock, flags); 662 spin_lock_irqsave(&adapter->driver_lock, flags);
690 memmove(adapter->cur_cmd->pdata_buf, 663 memmove(adapter->cur_cmd->pdata_buf, &resp->params.tpccfg,
691 &resp->params.tpccfg,
692 sizeof(struct cmd_ds_802_11_tpc_cfg)); 664 sizeof(struct cmd_ds_802_11_tpc_cfg));
693 spin_unlock_irqrestore(&adapter->driver_lock, flags); 665 spin_unlock_irqrestore(&adapter->driver_lock, flags);
694 break; 666 break;
695 case cmd_ret_802_11_led_gpio_ctrl: 667 case cmd_ret_802_11_led_gpio_ctrl:
696 spin_lock_irqsave(&adapter->driver_lock, flags); 668 spin_lock_irqsave(&adapter->driver_lock, flags);
697 memmove(adapter->cur_cmd->pdata_buf, 669 memmove(adapter->cur_cmd->pdata_buf, &resp->params.ledgpio,
698 &resp->params.ledgpio,
699 sizeof(struct cmd_ds_802_11_led_ctrl)); 670 sizeof(struct cmd_ds_802_11_led_ctrl));
700 spin_unlock_irqrestore(&adapter->driver_lock, flags); 671 spin_unlock_irqrestore(&adapter->driver_lock, flags);
701 break; 672 break;
702 case cmd_ret_802_11_pwr_cfg: 673 case cmd_ret_802_11_pwr_cfg:
703 spin_lock_irqsave(&adapter->driver_lock, flags); 674 spin_lock_irqsave(&adapter->driver_lock, flags);
704 memmove(adapter->cur_cmd->pdata_buf, 675 memmove(adapter->cur_cmd->pdata_buf, &resp->params.pwrcfg,
705 &resp->params.pwrcfg,
706 sizeof(struct cmd_ds_802_11_pwr_cfg)); 676 sizeof(struct cmd_ds_802_11_pwr_cfg));
707 spin_unlock_irqrestore(&adapter->driver_lock, flags); 677 spin_unlock_irqrestore(&adapter->driver_lock, flags);
708 678
@@ -724,23 +694,21 @@ static inline int handle_cmd_response(u16 respcmd,
724 case cmd_ret_fwt_access: 694 case cmd_ret_fwt_access:
725 spin_lock_irqsave(&adapter->driver_lock, flags); 695 spin_lock_irqsave(&adapter->driver_lock, flags);
726 if (adapter->cur_cmd->pdata_buf) 696 if (adapter->cur_cmd->pdata_buf)
727 memcpy(adapter->cur_cmd->pdata_buf, 697 memcpy(adapter->cur_cmd->pdata_buf, &resp->params.fwt,
728 &resp->params.fwt, 698 sizeof(resp->params.fwt));
729 sizeof(resp->params.fwt));
730 spin_unlock_irqrestore(&adapter->driver_lock, flags); 699 spin_unlock_irqrestore(&adapter->driver_lock, flags);
731 break; 700 break;
732 case cmd_ret_mesh_access: 701 case cmd_ret_mesh_access:
733 if (adapter->cur_cmd->pdata_buf) 702 if (adapter->cur_cmd->pdata_buf)
734 memcpy(adapter->cur_cmd->pdata_buf, 703 memcpy(adapter->cur_cmd->pdata_buf, &resp->params.mesh,
735 &resp->params.mesh,
736 sizeof(resp->params.mesh)); 704 sizeof(resp->params.mesh));
737 break; 705 break;
738 case cmd_rte_802_11_tx_rate_query: 706 case cmd_rte_802_11_tx_rate_query:
739 priv->adapter->txrate = resp->params.txrate.txrate; 707 priv->adapter->txrate = resp->params.txrate.txrate;
740 break; 708 break;
741 default: 709 default:
742 lbs_pr_debug(1, "CMD_RESP: Unknown command response %#x\n", 710 lbs_deb_cmd("CMD_RESP: Unknown command response %#x\n",
743 resp->command); 711 resp->command);
744 break; 712 break;
745 } 713 }
746 return ret; 714 return ret;
@@ -755,9 +723,9 @@ int libertas_process_rx_command(wlan_private * priv)
755 ulong flags; 723 ulong flags;
756 u16 result; 724 u16 result;
757 725
758 ENTER(); 726 lbs_deb_enter(LBS_DEB_CMD);
759 727
760 lbs_pr_debug(1, "CMD_RESP: @ %lu\n", jiffies); 728 lbs_deb_cmd("CMD_RESP: @ %lu\n", jiffies);
761 729
762 /* Now we got response from FW, cancel the command timer */ 730 /* Now we got response from FW, cancel the command timer */
763 del_timer(&adapter->command_timer); 731 del_timer(&adapter->command_timer);
@@ -766,7 +734,7 @@ int libertas_process_rx_command(wlan_private * priv)
766 spin_lock_irqsave(&adapter->driver_lock, flags); 734 spin_lock_irqsave(&adapter->driver_lock, flags);
767 735
768 if (!adapter->cur_cmd) { 736 if (!adapter->cur_cmd) {
769 lbs_pr_debug(1, "CMD_RESP: NULL cur_cmd=%p\n", adapter->cur_cmd); 737 lbs_deb_cmd("CMD_RESP: NULL cur_cmd=%p\n", adapter->cur_cmd);
770 ret = -1; 738 ret = -1;
771 spin_unlock_irqrestore(&adapter->driver_lock, flags); 739 spin_unlock_irqrestore(&adapter->driver_lock, flags);
772 goto done; 740 goto done;
@@ -774,17 +742,17 @@ int libertas_process_rx_command(wlan_private * priv)
774 resp = (struct cmd_ds_command *)(adapter->cur_cmd->bufvirtualaddr); 742 resp = (struct cmd_ds_command *)(adapter->cur_cmd->bufvirtualaddr);
775 743
776 lbs_dbg_hex("CMD_RESP:", adapter->cur_cmd->bufvirtualaddr, 744 lbs_dbg_hex("CMD_RESP:", adapter->cur_cmd->bufvirtualaddr,
777 priv->wlan_dev.upld_len); 745 priv->upld_len);
778 746
779 respcmd = le16_to_cpu(resp->command); 747 respcmd = le16_to_cpu(resp->command);
780 748
781 result = le16_to_cpu(resp->result); 749 result = le16_to_cpu(resp->result);
782 750
783 lbs_pr_debug(1, "CMD_RESP: %x result: %d length: %d\n", respcmd, 751 lbs_deb_cmd("CMD_RESP: %x result: %d length: %d\n", respcmd,
784 result, priv->wlan_dev.upld_len); 752 result, priv->upld_len);
785 753
786 if (!(respcmd & 0x8000)) { 754 if (!(respcmd & 0x8000)) {
787 lbs_pr_debug(1, "Invalid response to command!"); 755 lbs_deb_cmd("Invalid response to command!");
788 adapter->cur_cmd_retcode = -1; 756 adapter->cur_cmd_retcode = -1;
789 __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd); 757 __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd);
790 adapter->nr_cmd_pending--; 758 adapter->nr_cmd_pending--;
@@ -795,56 +763,52 @@ int libertas_process_rx_command(wlan_private * priv)
795 } 763 }
796 764
797 /* Store the response code to cur_cmd_retcode. */ 765 /* Store the response code to cur_cmd_retcode. */
798 adapter->cur_cmd_retcode = le16_to_cpu(resp->result); 766 adapter->cur_cmd_retcode = result;;
799 767
800 if (respcmd == cmd_ret_802_11_ps_mode) { 768 if (respcmd == cmd_ret_802_11_ps_mode) {
801 struct cmd_ds_802_11_ps_mode *psmode; 769 struct cmd_ds_802_11_ps_mode *psmode = &resp->params.psmode;
770 u16 action = le16_to_cpu(psmode->action);
802 771
803 psmode = &resp->params.psmode; 772 lbs_deb_cmd(
804 lbs_pr_debug(1,
805 "CMD_RESP: PS_MODE cmd reply result=%#x action=0x%X\n", 773 "CMD_RESP: PS_MODE cmd reply result=%#x action=0x%X\n",
806 resp->result, psmode->action); 774 result, action);
807 psmode->action = cpu_to_le16(psmode->action);
808 775
809 if (result) { 776 if (result) {
810 lbs_pr_debug(1, "CMD_RESP: PS command failed- %#x \n", 777 lbs_deb_cmd("CMD_RESP: PS command failed- %#x \n",
811 resp->result); 778 result);
812 if (adapter->mode == IW_MODE_ADHOC) { 779 /*
813 /* 780 * We should not re-try enter-ps command in
814 * We should not re-try enter-ps command in 781 * ad-hoc mode. It takes place in
815 * ad-hoc mode. It takes place in 782 * libertas_execute_next_command().
816 * libertas_execute_next_command(). 783 */
817 */ 784 if (adapter->mode == IW_MODE_ADHOC &&
818 if (psmode->action == cmd_subcmd_enter_ps) 785 action == cmd_subcmd_enter_ps)
819 adapter->psmode = 786 adapter->psmode = wlan802_11powermodecam;
820 wlan802_11powermodecam; 787 } else if (action == cmd_subcmd_enter_ps) {
821 }
822 } else if (psmode->action == cmd_subcmd_enter_ps) {
823 adapter->needtowakeup = 0; 788 adapter->needtowakeup = 0;
824 adapter->psstate = PS_STATE_AWAKE; 789 adapter->psstate = PS_STATE_AWAKE;
825 790
826 lbs_pr_debug(1, "CMD_RESP: Enter_PS command response\n"); 791 lbs_deb_cmd("CMD_RESP: Enter_PS command response\n");
827 if (adapter->connect_status != libertas_connected) { 792 if (adapter->connect_status != libertas_connected) {
828 /* 793 /*
829 * When Deauth Event received before Enter_PS command 794 * When Deauth Event received before Enter_PS command
830 * response, We need to wake up the firmware. 795 * response, We need to wake up the firmware.
831 */ 796 */
832 lbs_pr_debug(1, 797 lbs_deb_cmd(
833 "Disconnected, Going to invoke libertas_ps_wakeup\n"); 798 "Disconnected, Going to invoke libertas_ps_wakeup\n");
834 799
835 mutex_unlock(&adapter->lock);
836 spin_unlock_irqrestore(&adapter->driver_lock, flags); 800 spin_unlock_irqrestore(&adapter->driver_lock, flags);
801 mutex_unlock(&adapter->lock);
837 libertas_ps_wakeup(priv, 0); 802 libertas_ps_wakeup(priv, 0);
838 mutex_lock(&adapter->lock); 803 mutex_lock(&adapter->lock);
839 spin_lock_irqsave(&adapter->driver_lock, flags); 804 spin_lock_irqsave(&adapter->driver_lock, flags);
840 } 805 }
841 } else if (psmode->action == cmd_subcmd_exit_ps) { 806 } else if (action == cmd_subcmd_exit_ps) {
842 adapter->needtowakeup = 0; 807 adapter->needtowakeup = 0;
843 adapter->psstate = PS_STATE_FULL_POWER; 808 adapter->psstate = PS_STATE_FULL_POWER;
844 lbs_pr_debug(1, "CMD_RESP: Exit_PS command response\n"); 809 lbs_deb_cmd("CMD_RESP: Exit_PS command response\n");
845 } else { 810 } else {
846 lbs_pr_debug(1, "CMD_RESP: PS- action=0x%X\n", 811 lbs_deb_cmd("CMD_RESP: PS- action=0x%X\n", action);
847 psmode->action);
848 } 812 }
849 813
850 __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd); 814 __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd);
@@ -865,15 +829,15 @@ int libertas_process_rx_command(wlan_private * priv)
865 829
866 /* If the command is not successful, cleanup and return failure */ 830 /* If the command is not successful, cleanup and return failure */
867 if ((result != 0 || !(respcmd & 0x8000))) { 831 if ((result != 0 || !(respcmd & 0x8000))) {
868 lbs_pr_debug(1, "CMD_RESP: command reply %#x result=%#x\n", 832 lbs_deb_cmd("CMD_RESP: command reply %#x result=%#x\n",
869 resp->command, resp->result); 833 respcmd, result);
870 /* 834 /*
871 * Handling errors here 835 * Handling errors here
872 */ 836 */
873 switch (respcmd) { 837 switch (respcmd) {
874 case cmd_ret_hw_spec_info: 838 case cmd_ret_hw_spec_info:
875 case cmd_ret_802_11_reset: 839 case cmd_ret_802_11_reset:
876 lbs_pr_debug(1, "CMD_RESP: Reset command failed\n"); 840 lbs_deb_cmd("CMD_RESP: Reset command failed\n");
877 break; 841 break;
878 842
879 } 843 }
@@ -903,7 +867,7 @@ int libertas_process_rx_command(wlan_private * priv)
903 867
904done: 868done:
905 mutex_unlock(&adapter->lock); 869 mutex_unlock(&adapter->lock);
906 LEAVE(); 870 lbs_deb_enter_args(LBS_DEB_CMD, "ret %d", ret);
907 return ret; 871 return ret;
908} 872}
909 873
@@ -917,37 +881,37 @@ int libertas_process_event(wlan_private * priv)
917 eventcause = adapter->eventcause; 881 eventcause = adapter->eventcause;
918 spin_unlock_irq(&adapter->driver_lock); 882 spin_unlock_irq(&adapter->driver_lock);
919 883
920 ENTER(); 884 lbs_deb_enter(LBS_DEB_CMD);
921 885
922 lbs_pr_debug(1, "EVENT Cause %x\n", eventcause); 886 lbs_deb_cmd("EVENT Cause %x\n", eventcause);
923 887
924 switch (eventcause >> SBI_EVENT_CAUSE_SHIFT) { 888 switch (eventcause >> SBI_EVENT_CAUSE_SHIFT) {
925 case MACREG_INT_CODE_LINK_SENSED: 889 case MACREG_INT_CODE_LINK_SENSED:
926 lbs_pr_debug(1, "EVENT: MACREG_INT_CODE_LINK_SENSED\n"); 890 lbs_deb_cmd("EVENT: MACREG_INT_CODE_LINK_SENSED\n");
927 break; 891 break;
928 892
929 case MACREG_INT_CODE_DEAUTHENTICATED: 893 case MACREG_INT_CODE_DEAUTHENTICATED:
930 lbs_pr_debug(1, "EVENT: Deauthenticated\n"); 894 lbs_deb_cmd("EVENT: Deauthenticated\n");
931 libertas_mac_event_disconnected(priv); 895 libertas_mac_event_disconnected(priv);
932 break; 896 break;
933 897
934 case MACREG_INT_CODE_DISASSOCIATED: 898 case MACREG_INT_CODE_DISASSOCIATED:
935 lbs_pr_debug(1, "EVENT: Disassociated\n"); 899 lbs_deb_cmd("EVENT: Disassociated\n");
936 libertas_mac_event_disconnected(priv); 900 libertas_mac_event_disconnected(priv);
937 break; 901 break;
938 902
939 case MACREG_INT_CODE_LINK_LOSE_NO_SCAN: 903 case MACREG_INT_CODE_LINK_LOSE_NO_SCAN:
940 lbs_pr_debug(1, "EVENT: Link lost\n"); 904 lbs_deb_cmd("EVENT: Link lost\n");
941 libertas_mac_event_disconnected(priv); 905 libertas_mac_event_disconnected(priv);
942 break; 906 break;
943 907
944 case MACREG_INT_CODE_PS_SLEEP: 908 case MACREG_INT_CODE_PS_SLEEP:
945 lbs_pr_debug(1, "EVENT: SLEEP\n"); 909 lbs_deb_cmd("EVENT: SLEEP\n");
946 lbs_pr_debug(1, "_"); 910 lbs_deb_cmd("_");
947 911
948 /* handle unexpected PS SLEEP event */ 912 /* handle unexpected PS SLEEP event */
949 if (adapter->psstate == PS_STATE_FULL_POWER) { 913 if (adapter->psstate == PS_STATE_FULL_POWER) {
950 lbs_pr_debug(1, 914 lbs_deb_cmd(
951 "EVENT: In FULL POWER mode - ignore PS SLEEP\n"); 915 "EVENT: In FULL POWER mode - ignore PS SLEEP\n");
952 break; 916 break;
953 } 917 }
@@ -958,12 +922,12 @@ int libertas_process_event(wlan_private * priv)
958 break; 922 break;
959 923
960 case MACREG_INT_CODE_PS_AWAKE: 924 case MACREG_INT_CODE_PS_AWAKE:
961 lbs_pr_debug(1, "EVENT: AWAKE \n"); 925 lbs_deb_cmd("EVENT: AWAKE \n");
962 lbs_pr_debug(1, "|"); 926 lbs_deb_cmd("|");
963 927
964 /* handle unexpected PS AWAKE event */ 928 /* handle unexpected PS AWAKE event */
965 if (adapter->psstate == PS_STATE_FULL_POWER) { 929 if (adapter->psstate == PS_STATE_FULL_POWER) {
966 lbs_pr_debug(1, 930 lbs_deb_cmd(
967 "EVENT: In FULL POWER mode - ignore PS AWAKE\n"); 931 "EVENT: In FULL POWER mode - ignore PS AWAKE\n");
968 break; 932 break;
969 } 933 }
@@ -977,18 +941,18 @@ int libertas_process_event(wlan_private * priv)
977 * adapter->needtowakeup will be set to FALSE 941 * adapter->needtowakeup will be set to FALSE
978 * in libertas_ps_wakeup() 942 * in libertas_ps_wakeup()
979 */ 943 */
980 lbs_pr_debug(1, "Waking up...\n"); 944 lbs_deb_cmd("Waking up...\n");
981 libertas_ps_wakeup(priv, 0); 945 libertas_ps_wakeup(priv, 0);
982 } 946 }
983 break; 947 break;
984 948
985 case MACREG_INT_CODE_MIC_ERR_UNICAST: 949 case MACREG_INT_CODE_MIC_ERR_UNICAST:
986 lbs_pr_debug(1, "EVENT: UNICAST MIC ERROR\n"); 950 lbs_deb_cmd("EVENT: UNICAST MIC ERROR\n");
987 handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_UNICAST); 951 handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_UNICAST);
988 break; 952 break;
989 953
990 case MACREG_INT_CODE_MIC_ERR_MULTICAST: 954 case MACREG_INT_CODE_MIC_ERR_MULTICAST:
991 lbs_pr_debug(1, "EVENT: MULTICAST MIC ERROR\n"); 955 lbs_deb_cmd("EVENT: MULTICAST MIC ERROR\n");
992 handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_MULTICAST); 956 handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_MULTICAST);
993 break; 957 break;
994 case MACREG_INT_CODE_MIB_CHANGED: 958 case MACREG_INT_CODE_MIB_CHANGED:
@@ -996,7 +960,7 @@ int libertas_process_event(wlan_private * priv)
996 break; 960 break;
997 961
998 case MACREG_INT_CODE_ADHOC_BCN_LOST: 962 case MACREG_INT_CODE_ADHOC_BCN_LOST:
999 lbs_pr_debug(1, "EVENT: HWAC - ADHOC BCN LOST\n"); 963 lbs_deb_cmd("EVENT: HWAC - ADHOC BCN LOST\n");
1000 break; 964 break;
1001 965
1002 case MACREG_INT_CODE_RSSI_LOW: 966 case MACREG_INT_CODE_RSSI_LOW:
@@ -1015,6 +979,17 @@ int libertas_process_event(wlan_private * priv)
1015 lbs_pr_alert( "EVENT: SNR_HIGH\n"); 979 lbs_pr_alert( "EVENT: SNR_HIGH\n");
1016 break; 980 break;
1017 981
982 case MACREG_INT_CODE_MESH_AUTO_STARTED:
983 lbs_pr_alert( "EVENT: MESH_AUTO_STARTED\n");
984 adapter->connect_status = libertas_connected ;
985 if (priv->mesh_open == 1) {
986 netif_wake_queue(priv->mesh_dev) ;
987 netif_carrier_on(priv->mesh_dev) ;
988 }
989 adapter->mode = IW_MODE_ADHOC ;
990 schedule_work(&priv->sync_channel);
991 break;
992
1018 default: 993 default:
1019 lbs_pr_alert( "EVENT: unknown event id: %#x\n", 994 lbs_pr_alert( "EVENT: unknown event id: %#x\n",
1020 eventcause >> SBI_EVENT_CAUSE_SHIFT); 995 eventcause >> SBI_EVENT_CAUSE_SHIFT);
@@ -1024,6 +999,7 @@ int libertas_process_event(wlan_private * priv)
1024 spin_lock_irq(&adapter->driver_lock); 999 spin_lock_irq(&adapter->driver_lock);
1025 adapter->eventcause = 0; 1000 adapter->eventcause = 0;
1026 spin_unlock_irq(&adapter->driver_lock); 1001 spin_unlock_irq(&adapter->driver_lock);
1027 LEAVE(); 1002
1003 lbs_deb_enter_args(LBS_DEB_CMD, "ret %d", ret);
1028 return ret; 1004 return ret;
1029} 1005}
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c
index 7d7bc5e86a56..715cbdaa1d4b 100644
--- a/drivers/net/wireless/libertas/debugfs.c
+++ b/drivers/net/wireless/libertas/debugfs.c
@@ -4,6 +4,7 @@
4#include <linux/delay.h> 4#include <linux/delay.h>
5#include <linux/mm.h> 5#include <linux/mm.h>
6#include <net/iw_handler.h> 6#include <net/iw_handler.h>
7
7#include "dev.h" 8#include "dev.h"
8#include "decl.h" 9#include "decl.h"
9#include "host.h" 10#include "host.h"
@@ -15,7 +16,9 @@ static char *szStates[] = {
15 "Disconnected" 16 "Disconnected"
16}; 17};
17 18
18void libertas_debug_init(wlan_private * priv, struct net_device *dev); 19#ifdef PROC_DEBUG
20static void libertas_debug_init(wlan_private * priv, struct net_device *dev);
21#endif
19 22
20static int open_file_generic(struct inode *inode, struct file *file) 23static int open_file_generic(struct inode *inode, struct file *file)
21{ 24{
@@ -60,43 +63,33 @@ static ssize_t libertas_getscantable(struct file *file, char __user *userbuf,
60 int numscansdone = 0, res; 63 int numscansdone = 0, res;
61 unsigned long addr = get_zeroed_page(GFP_KERNEL); 64 unsigned long addr = get_zeroed_page(GFP_KERNEL);
62 char *buf = (char *)addr; 65 char *buf = (char *)addr;
66 struct bss_descriptor * iter_bss;
63 67
64 pos += snprintf(buf+pos, len-pos, 68 pos += snprintf(buf+pos, len-pos,
65 "---------------------------------------");
66 pos += snprintf(buf+pos, len-pos,
67 "---------------------------------------\n");
68 pos += snprintf(buf+pos, len-pos,
69 "# | ch | ss | bssid | cap | TSF | Qual | SSID \n"); 69 "# | ch | ss | bssid | cap | TSF | Qual | SSID \n");
70 pos += snprintf(buf+pos, len-pos,
71 "---------------------------------------");
72 pos += snprintf(buf+pos, len-pos,
73 "---------------------------------------\n");
74 70
75 while (numscansdone < priv->adapter->numinscantable) { 71 mutex_lock(&priv->adapter->lock);
76 struct bss_descriptor *pbssinfo; 72 list_for_each_entry (iter_bss, &priv->adapter->network_list, list) {
77 u16 cap; 73 u16 cap;
78 74
79 pbssinfo = &priv->adapter->scantable[numscansdone]; 75 memcpy(&cap, &iter_bss->cap, sizeof(cap));
80 memcpy(&cap, &pbssinfo->cap, sizeof(cap));
81 pos += snprintf(buf+pos, len-pos, 76 pos += snprintf(buf+pos, len-pos,
82 "%02u| %03d | %03ld | %02x:%02x:%02x:%02x:%02x:%02x |", 77 "%02u| %03d | %03ld | " MAC_FMT " |",
83 numscansdone, pbssinfo->channel, pbssinfo->rssi, 78 numscansdone, iter_bss->channel, iter_bss->rssi,
84 pbssinfo->macaddress[0], pbssinfo->macaddress[1], 79 MAC_ARG(iter_bss->bssid));
85 pbssinfo->macaddress[2], pbssinfo->macaddress[3],
86 pbssinfo->macaddress[4], pbssinfo->macaddress[5]);
87 pos += snprintf(buf+pos, len-pos, " %04x-", cap); 80 pos += snprintf(buf+pos, len-pos, " %04x-", cap);
88 pos += snprintf(buf+pos, len-pos, "%c%c%c |", 81 pos += snprintf(buf+pos, len-pos, "%c%c%c |",
89 pbssinfo->cap.ibss ? 'A' : 'I', 82 iter_bss->cap.ibss ? 'A' : 'I',
90 pbssinfo->cap.privacy ? 'P' : ' ', 83 iter_bss->cap.privacy ? 'P' : ' ',
91 pbssinfo->cap.spectrummgmt ? 'S' : ' '); 84 iter_bss->cap.spectrummgmt ? 'S' : ' ');
92 pos += snprintf(buf+pos, len-pos, " %08llx |", pbssinfo->networktsf); 85 pos += snprintf(buf+pos, len-pos, " %08llx |", iter_bss->networktsf);
93 pos += snprintf(buf+pos, len-pos, " %d |", 86 pos += snprintf(buf+pos, len-pos, " %d |", SCAN_RSSI(iter_bss->rssi));
94 SCAN_RSSI(priv->adapter->scantable[numscansdone].rssi)); 87 pos += snprintf(buf+pos, len-pos, " %s\n",
95 88 escape_essid(iter_bss->ssid, iter_bss->ssid_len));
96 pos += snprintf(buf+pos, len-pos, " %s\n", pbssinfo->ssid.ssid);
97 89
98 numscansdone++; 90 numscansdone++;
99 } 91 }
92 mutex_unlock(&priv->adapter->lock);
100 93
101 res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); 94 res = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
102 95
@@ -111,7 +104,6 @@ static ssize_t libertas_sleepparams_write(struct file *file,
111 wlan_private *priv = file->private_data; 104 wlan_private *priv = file->private_data;
112 ssize_t buf_size, res; 105 ssize_t buf_size, res;
113 int p1, p2, p3, p4, p5, p6; 106 int p1, p2, p3, p4, p5, p6;
114 struct sleep_params sp;
115 unsigned long addr = get_zeroed_page(GFP_KERNEL); 107 unsigned long addr = get_zeroed_page(GFP_KERNEL);
116 char *buf = (char *)addr; 108 char *buf = (char *)addr;
117 109
@@ -125,14 +117,12 @@ static ssize_t libertas_sleepparams_write(struct file *file,
125 res = -EFAULT; 117 res = -EFAULT;
126 goto out_unlock; 118 goto out_unlock;
127 } 119 }
128 sp.sp_error = p1; 120 priv->adapter->sp.sp_error = p1;
129 sp.sp_offset = p2; 121 priv->adapter->sp.sp_offset = p2;
130 sp.sp_stabletime = p3; 122 priv->adapter->sp.sp_stabletime = p3;
131 sp.sp_calcontrol = p4; 123 priv->adapter->sp.sp_calcontrol = p4;
132 sp.sp_extsleepclk = p5; 124 priv->adapter->sp.sp_extsleepclk = p5;
133 sp.sp_reserved = p6; 125 priv->adapter->sp.sp_reserved = p6;
134
135 memcpy(&priv->adapter->sp, &sp, sizeof(struct sleep_params));
136 126
137 res = libertas_prepare_and_send_command(priv, 127 res = libertas_prepare_and_send_command(priv,
138 cmd_802_11_sleep_params, 128 cmd_802_11_sleep_params,
@@ -185,7 +175,6 @@ static ssize_t libertas_extscan(struct file *file, const char __user *userbuf,
185{ 175{
186 wlan_private *priv = file->private_data; 176 wlan_private *priv = file->private_data;
187 ssize_t res, buf_size; 177 ssize_t res, buf_size;
188 struct WLAN_802_11_SSID extscan_ssid;
189 union iwreq_data wrqu; 178 union iwreq_data wrqu;
190 unsigned long addr = get_zeroed_page(GFP_KERNEL); 179 unsigned long addr = get_zeroed_page(GFP_KERNEL);
191 char *buf = (char *)addr; 180 char *buf = (char *)addr;
@@ -196,13 +185,10 @@ static ssize_t libertas_extscan(struct file *file, const char __user *userbuf,
196 goto out_unlock; 185 goto out_unlock;
197 } 186 }
198 187
199 memcpy(&extscan_ssid.ssid, buf, strlen(buf)-1); 188 libertas_send_specific_ssid_scan(priv, buf, strlen(buf)-1, 0);
200 extscan_ssid.ssidlength = strlen(buf)-1;
201
202 libertas_send_specific_SSID_scan(priv, &extscan_ssid, 1);
203 189
204 memset(&wrqu, 0, sizeof(union iwreq_data)); 190 memset(&wrqu, 0, sizeof(union iwreq_data));
205 wireless_send_event(priv->wlan_dev.netdev, SIOCGIWSCAN, &wrqu, NULL); 191 wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL);
206 192
207out_unlock: 193out_unlock:
208 free_page(addr); 194 free_page(addr);
@@ -251,16 +237,13 @@ static void libertas_parse_bssid(char *buf, size_t count,
251{ 237{
252 char *hold; 238 char *hold;
253 unsigned int mac[ETH_ALEN]; 239 unsigned int mac[ETH_ALEN];
254 int i;
255 240
256 hold = strstr(buf, "bssid="); 241 hold = strstr(buf, "bssid=");
257 if (!hold) 242 if (!hold)
258 return; 243 return;
259 hold += 6; 244 hold += 6;
260 sscanf(hold, "%2x:%2x:%2x:%2x:%2x:%2x", mac, mac+1, mac+2, mac+3, 245 sscanf(hold, MAC_FMT, mac, mac+1, mac+2, mac+3, mac+4, mac+5);
261 mac+4, mac+5); 246 memcpy(scan_cfg->bssid, mac, ETH_ALEN);
262 for(i=0;i<ETH_ALEN;i++)
263 scan_cfg->specificBSSID[i] = mac[i];
264} 247}
265 248
266static void libertas_parse_ssid(char *buf, size_t count, 249static void libertas_parse_ssid(char *buf, size_t count,
@@ -278,28 +261,26 @@ static void libertas_parse_ssid(char *buf, size_t count,
278 end = buf + count - 1; 261 end = buf + count - 1;
279 262
280 size = min((size_t)IW_ESSID_MAX_SIZE, (size_t) (end - hold)); 263 size = min((size_t)IW_ESSID_MAX_SIZE, (size_t) (end - hold));
281 strncpy(scan_cfg->specificSSID, hold, size); 264 strncpy(scan_cfg->ssid, hold, size);
282 265
283 return; 266 return;
284} 267}
285 268
286static void libertas_parse_keep(char *buf, size_t count, 269static int libertas_parse_clear(char *buf, size_t count, const char *tag)
287 struct wlan_ioctl_user_scan_cfg *scan_cfg)
288{ 270{
289 char *hold; 271 char *hold;
290 int val; 272 int val;
291 273
292 hold = strstr(buf, "keep="); 274 hold = strstr(buf, tag);
293 if (!hold) 275 if (!hold)
294 return; 276 return 0;
295 hold += 5; 277 hold += strlen(tag);
296 sscanf(hold, "%d", &val); 278 sscanf(hold, "%d", &val);
297 279
298 if (val != 0) 280 if (val != 0)
299 val = 1; 281 val = 1;
300 282
301 scan_cfg->keeppreviousscan = val; 283 return val;
302 return;
303} 284}
304 285
305static int libertas_parse_dur(char *buf, size_t count, 286static int libertas_parse_dur(char *buf, size_t count,
@@ -382,17 +363,18 @@ static ssize_t libertas_setuserscan(struct file *file,
382 dur = libertas_parse_dur(buf, count, scan_cfg); 363 dur = libertas_parse_dur(buf, count, scan_cfg);
383 libertas_parse_chan(buf, count, scan_cfg, dur); 364 libertas_parse_chan(buf, count, scan_cfg, dur);
384 libertas_parse_bssid(buf, count, scan_cfg); 365 libertas_parse_bssid(buf, count, scan_cfg);
366 scan_cfg->clear_bssid = libertas_parse_clear(buf, count, "clear_bssid=");
385 libertas_parse_ssid(buf, count, scan_cfg); 367 libertas_parse_ssid(buf, count, scan_cfg);
386 libertas_parse_keep(buf, count, scan_cfg); 368 scan_cfg->clear_ssid = libertas_parse_clear(buf, count, "clear_ssid=");
387 libertas_parse_probes(buf, count, scan_cfg); 369 libertas_parse_probes(buf, count, scan_cfg);
388 libertas_parse_type(buf, count, scan_cfg); 370 libertas_parse_type(buf, count, scan_cfg);
389 371
390 wlan_scan_networks(priv, scan_cfg); 372 wlan_scan_networks(priv, scan_cfg, 1);
391 wait_event_interruptible(priv->adapter->cmd_pending, 373 wait_event_interruptible(priv->adapter->cmd_pending,
392 !priv->adapter->nr_cmd_pending); 374 !priv->adapter->nr_cmd_pending);
393 375
394 memset(&wrqu, 0x00, sizeof(union iwreq_data)); 376 memset(&wrqu, 0x00, sizeof(union iwreq_data));
395 wireless_send_event(priv->wlan_dev.netdev, SIOCGIWSCAN, &wrqu, NULL); 377 wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL);
396 378
397out_unlock: 379out_unlock:
398 free_page(addr); 380 free_page(addr);
@@ -407,11 +389,11 @@ static int libertas_event_initcmd(wlan_private *priv, void **response_buf,
407 u16 wait_option = cmd_option_waitforrsp; 389 u16 wait_option = cmd_option_waitforrsp;
408 390
409 if (!(*cmdnode = libertas_get_free_cmd_ctrl_node(priv))) { 391 if (!(*cmdnode = libertas_get_free_cmd_ctrl_node(priv))) {
410 lbs_pr_debug(1, "failed libertas_get_free_cmd_ctrl_node\n"); 392 lbs_deb_debugfs("failed libertas_get_free_cmd_ctrl_node\n");
411 return -ENOMEM; 393 return -ENOMEM;
412 } 394 }
413 if (!(*response_buf = kmalloc(3000, GFP_KERNEL))) { 395 if (!(*response_buf = kmalloc(3000, GFP_KERNEL))) {
414 lbs_pr_debug(1, "failed to allocate response buffer!\n"); 396 lbs_deb_debugfs("failed to allocate response buffer!\n");
415 return -ENOMEM; 397 return -ENOMEM;
416 } 398 }
417 libertas_set_cmd_ctrl_node(priv, *cmdnode, 0, wait_option, NULL); 399 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,
420 (*cmdnode)->cmdflags |= CMD_F_HOSTCMD; 402 (*cmdnode)->cmdflags |= CMD_F_HOSTCMD;
421 (*cmdnode)->cmdwaitqwoken = 0; 403 (*cmdnode)->cmdwaitqwoken = 0;
422 *cmd = (struct cmd_ds_command *)(*cmdnode)->bufvirtualaddr; 404 *cmd = (struct cmd_ds_command *)(*cmdnode)->bufvirtualaddr;
423 (*cmd)->command = cmd_802_11_subscribe_event; 405 (*cmd)->command = cpu_to_le16(cmd_802_11_subscribe_event);
424 (*cmd)->seqnum = ++priv->adapter->seqnum; 406 (*cmd)->seqnum = cpu_to_le16(++priv->adapter->seqnum);
425 (*cmd)->result = 0; 407 (*cmd)->result = 0;
426 return 0; 408 return 0;
427} 409}
@@ -447,26 +429,25 @@ static ssize_t libertas_lowrssi_read(struct file *file, char __user *userbuf,
447 } 429 }
448 430
449 event = &pcmdptr->params.subscribe_event; 431 event = &pcmdptr->params.subscribe_event;
450 event->action = cmd_act_get; 432 event->action = cpu_to_le16(cmd_act_get);
451 pcmdptr->size = 433 pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
452 cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
453 libertas_queue_cmd(adapter, pcmdnode, 1); 434 libertas_queue_cmd(adapter, pcmdnode, 1);
454 wake_up_interruptible(&priv->mainthread.waitq); 435 wake_up_interruptible(&priv->mainthread.waitq);
455 436
456 /* Sleep until response is generated by FW */ 437 /* Sleep until response is generated by FW */
457 wait_event_interruptible(pcmdnode->cmdwait_q, 438 wait_event_interruptible(pcmdnode->cmdwait_q,
458 pcmdnode->cmdwaitqwoken); 439 pcmdnode->cmdwaitqwoken);
459 440
460 pcmdptr = response_buf; 441 pcmdptr = response_buf;
461 if (pcmdptr->result) { 442 if (pcmdptr->result) {
462 lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, 443 lbs_pr_err("%s: fail, result=%d\n", __func__,
463 pcmdptr->result); 444 le16_to_cpu(pcmdptr->result));
464 kfree(response_buf); 445 kfree(response_buf);
465 free_page(addr); 446 free_page(addr);
466 return 0; 447 return 0;
467 } 448 }
468 449
469 if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { 450 if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
470 lbs_pr_err("command response incorrect!\n"); 451 lbs_pr_err("command response incorrect!\n");
471 kfree(response_buf); 452 kfree(response_buf);
472 free_page(addr); 453 free_page(addr);
@@ -474,17 +455,17 @@ static ssize_t libertas_lowrssi_read(struct file *file, char __user *userbuf,
474 } 455 }
475 456
476 cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); 457 cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
477 event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); 458 event = (void *)(response_buf + S_DS_GEN);
478 while (cmd_len < pcmdptr->size) { 459 while (cmd_len < le16_to_cpu(pcmdptr->size)) {
479 struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); 460 struct mrvlietypesheader *header = (void *)(response_buf + cmd_len);
480 switch(header->type) { 461 switch (header->type) {
481 struct mrvlietypes_rssithreshold *Lowrssi; 462 struct mrvlietypes_rssithreshold *Lowrssi;
482 case TLV_TYPE_RSSI_LOW: 463 case __constant_cpu_to_le16(TLV_TYPE_RSSI_LOW):
483 Lowrssi = (struct mrvlietypes_rssithreshold *)(response_buf + cmd_len); 464 Lowrssi = (void *)(response_buf + cmd_len);
484 pos += snprintf(buf+pos, len-pos, "%d %d %d\n", 465 pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
485 Lowrssi->rssivalue, 466 Lowrssi->rssivalue,
486 Lowrssi->rssifreq, 467 Lowrssi->rssifreq,
487 (event->events & 0x0001)?1:0); 468 (event->events & cpu_to_le16(0x0001))?1:0);
488 default: 469 default:
489 cmd_len += sizeof(struct mrvlietypes_snrthreshold); 470 cmd_len += sizeof(struct mrvlietypes_snrthreshold);
490 break; 471 break;
@@ -512,21 +493,20 @@ static u16 libertas_get_events_bitmap(wlan_private *priv)
512 return res; 493 return res;
513 494
514 event = &pcmdptr->params.subscribe_event; 495 event = &pcmdptr->params.subscribe_event;
515 event->action = cmd_act_get; 496 event->action = cpu_to_le16(cmd_act_get);
516 pcmdptr->size = 497 pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
517 cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
518 libertas_queue_cmd(adapter, pcmdnode, 1); 498 libertas_queue_cmd(adapter, pcmdnode, 1);
519 wake_up_interruptible(&priv->mainthread.waitq); 499 wake_up_interruptible(&priv->mainthread.waitq);
520 500
521 /* Sleep until response is generated by FW */ 501 /* Sleep until response is generated by FW */
522 wait_event_interruptible(pcmdnode->cmdwait_q, 502 wait_event_interruptible(pcmdnode->cmdwait_q,
523 pcmdnode->cmdwaitqwoken); 503 pcmdnode->cmdwaitqwoken);
524 504
525 pcmdptr = response_buf; 505 pcmdptr = response_buf;
526 506
527 if (pcmdptr->result) { 507 if (pcmdptr->result) {
528 lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, 508 lbs_pr_err("%s: fail, result=%d\n", __func__,
529 pcmdptr->result); 509 le16_to_cpu(pcmdptr->result));
530 kfree(response_buf); 510 kfree(response_buf);
531 return 0; 511 return 0;
532 } 512 }
@@ -538,7 +518,7 @@ static u16 libertas_get_events_bitmap(wlan_private *priv)
538 } 518 }
539 519
540 event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); 520 event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN);
541 event_bitmap = event->events; 521 event_bitmap = le16_to_cpu(event->events);
542 kfree(response_buf); 522 kfree(response_buf);
543 return event_bitmap; 523 return event_bitmap;
544} 524}
@@ -579,7 +559,7 @@ static ssize_t libertas_lowrssi_write(struct file *file,
579 goto out_unlock; 559 goto out_unlock;
580 560
581 event = &pcmdptr->params.subscribe_event; 561 event = &pcmdptr->params.subscribe_event;
582 event->action = cmd_act_set; 562 event->action = cpu_to_le16(cmd_act_set);
583 pcmdptr->size = cpu_to_le16(S_DS_GEN + 563 pcmdptr->size = cpu_to_le16(S_DS_GEN +
584 sizeof(struct cmd_ds_802_11_subscribe_event) + 564 sizeof(struct cmd_ds_802_11_subscribe_event) +
585 sizeof(struct mrvlietypes_rssithreshold)); 565 sizeof(struct mrvlietypes_rssithreshold));
@@ -588,30 +568,30 @@ static ssize_t libertas_lowrssi_write(struct file *file,
588 ptr = (u8*) pcmdptr+cmd_len; 568 ptr = (u8*) pcmdptr+cmd_len;
589 rssi_threshold = (struct mrvlietypes_rssithreshold *)(ptr); 569 rssi_threshold = (struct mrvlietypes_rssithreshold *)(ptr);
590 rssi_threshold->header.type = cpu_to_le16(0x0104); 570 rssi_threshold->header.type = cpu_to_le16(0x0104);
591 rssi_threshold->header.len = 2; 571 rssi_threshold->header.len = cpu_to_le16(2);
592 rssi_threshold->rssivalue = cpu_to_le16(value); 572 rssi_threshold->rssivalue = value;
593 rssi_threshold->rssifreq = cpu_to_le16(freq); 573 rssi_threshold->rssifreq = freq;
594 event_bitmap |= subscribed ? 0x0001 : 0x0; 574 event_bitmap |= subscribed ? 0x0001 : 0x0;
595 event->events = event_bitmap; 575 event->events = cpu_to_le16(event_bitmap);
596 576
597 libertas_queue_cmd(adapter, pcmdnode, 1); 577 libertas_queue_cmd(adapter, pcmdnode, 1);
598 wake_up_interruptible(&priv->mainthread.waitq); 578 wake_up_interruptible(&priv->mainthread.waitq);
599 579
600 /* Sleep until response is generated by FW */ 580 /* Sleep until response is generated by FW */
601 wait_event_interruptible(pcmdnode->cmdwait_q, 581 wait_event_interruptible(pcmdnode->cmdwait_q,
602 pcmdnode->cmdwaitqwoken); 582 pcmdnode->cmdwaitqwoken);
603 583
604 pcmdptr = response_buf; 584 pcmdptr = response_buf;
605 585
606 if (pcmdptr->result) { 586 if (pcmdptr->result) {
607 lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, 587 lbs_pr_err("%s: fail, result=%d\n", __func__,
608 pcmdptr->result); 588 le16_to_cpu(pcmdptr->result));
609 kfree(response_buf); 589 kfree(response_buf);
610 free_page(addr); 590 free_page(addr);
611 return 0; 591 return 0;
612 } 592 }
613 593
614 if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { 594 if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
615 lbs_pr_err("command response incorrect!\n"); 595 lbs_pr_err("command response incorrect!\n");
616 kfree(response_buf); 596 kfree(response_buf);
617 free_page(addr); 597 free_page(addr);
@@ -645,27 +625,26 @@ static ssize_t libertas_lowsnr_read(struct file *file, char __user *userbuf,
645 } 625 }
646 626
647 event = &pcmdptr->params.subscribe_event; 627 event = &pcmdptr->params.subscribe_event;
648 event->action = cmd_act_get; 628 event->action = cpu_to_le16(cmd_act_get);
649 pcmdptr->size = 629 pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
650 cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
651 libertas_queue_cmd(adapter, pcmdnode, 1); 630 libertas_queue_cmd(adapter, pcmdnode, 1);
652 wake_up_interruptible(&priv->mainthread.waitq); 631 wake_up_interruptible(&priv->mainthread.waitq);
653 632
654 /* Sleep until response is generated by FW */ 633 /* Sleep until response is generated by FW */
655 wait_event_interruptible(pcmdnode->cmdwait_q, 634 wait_event_interruptible(pcmdnode->cmdwait_q,
656 pcmdnode->cmdwaitqwoken); 635 pcmdnode->cmdwaitqwoken);
657 636
658 pcmdptr = response_buf; 637 pcmdptr = response_buf;
659 638
660 if (pcmdptr->result) { 639 if (pcmdptr->result) {
661 lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, 640 lbs_pr_err("%s: fail, result=%d\n", __func__,
662 pcmdptr->result); 641 le16_to_cpu(pcmdptr->result));
663 kfree(response_buf); 642 kfree(response_buf);
664 free_page(addr); 643 free_page(addr);
665 return 0; 644 return 0;
666 } 645 }
667 646
668 if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { 647 if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
669 lbs_pr_err("command response incorrect!\n"); 648 lbs_pr_err("command response incorrect!\n");
670 kfree(response_buf); 649 kfree(response_buf);
671 free_page(addr); 650 free_page(addr);
@@ -673,17 +652,17 @@ static ssize_t libertas_lowsnr_read(struct file *file, char __user *userbuf,
673 } 652 }
674 653
675 cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); 654 cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
676 event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); 655 event = (void *)(response_buf + S_DS_GEN);
677 while (cmd_len < pcmdptr->size) { 656 while (cmd_len < le16_to_cpu(pcmdptr->size)) {
678 struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); 657 struct mrvlietypesheader *header = (void *)(response_buf + cmd_len);
679 switch(header->type) { 658 switch (header->type) {
680 struct mrvlietypes_snrthreshold *LowSnr; 659 struct mrvlietypes_snrthreshold *LowSnr;
681 case TLV_TYPE_SNR_LOW: 660 case __constant_cpu_to_le16(TLV_TYPE_SNR_LOW):
682 LowSnr = (struct mrvlietypes_snrthreshold *)(response_buf + cmd_len); 661 LowSnr = (void *)(response_buf + cmd_len);
683 pos += snprintf(buf+pos, len-pos, "%d %d %d\n", 662 pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
684 LowSnr->snrvalue, 663 LowSnr->snrvalue,
685 LowSnr->snrfreq, 664 LowSnr->snrfreq,
686 (event->events & 0x0002)?1:0); 665 (event->events & cpu_to_le16(0x0002))?1:0);
687 default: 666 default:
688 cmd_len += sizeof(struct mrvlietypes_snrthreshold); 667 cmd_len += sizeof(struct mrvlietypes_snrthreshold);
689 break; 668 break;
@@ -733,7 +712,7 @@ static ssize_t libertas_lowsnr_write(struct file *file,
733 goto out_unlock; 712 goto out_unlock;
734 713
735 event = &pcmdptr->params.subscribe_event; 714 event = &pcmdptr->params.subscribe_event;
736 event->action = cmd_act_set; 715 event->action = cpu_to_le16(cmd_act_set);
737 pcmdptr->size = cpu_to_le16(S_DS_GEN + 716 pcmdptr->size = cpu_to_le16(S_DS_GEN +
738 sizeof(struct cmd_ds_802_11_subscribe_event) + 717 sizeof(struct cmd_ds_802_11_subscribe_event) +
739 sizeof(struct mrvlietypes_snrthreshold)); 718 sizeof(struct mrvlietypes_snrthreshold));
@@ -741,30 +720,30 @@ static ssize_t libertas_lowsnr_write(struct file *file,
741 ptr = (u8*) pcmdptr+cmd_len; 720 ptr = (u8*) pcmdptr+cmd_len;
742 snr_threshold = (struct mrvlietypes_snrthreshold *)(ptr); 721 snr_threshold = (struct mrvlietypes_snrthreshold *)(ptr);
743 snr_threshold->header.type = cpu_to_le16(TLV_TYPE_SNR_LOW); 722 snr_threshold->header.type = cpu_to_le16(TLV_TYPE_SNR_LOW);
744 snr_threshold->header.len = 2; 723 snr_threshold->header.len = cpu_to_le16(2);
745 snr_threshold->snrvalue = cpu_to_le16(value); 724 snr_threshold->snrvalue = value;
746 snr_threshold->snrfreq = cpu_to_le16(freq); 725 snr_threshold->snrfreq = freq;
747 event_bitmap |= subscribed ? 0x0002 : 0x0; 726 event_bitmap |= subscribed ? 0x0002 : 0x0;
748 event->events = event_bitmap; 727 event->events = cpu_to_le16(event_bitmap);
749 728
750 libertas_queue_cmd(adapter, pcmdnode, 1); 729 libertas_queue_cmd(adapter, pcmdnode, 1);
751 wake_up_interruptible(&priv->mainthread.waitq); 730 wake_up_interruptible(&priv->mainthread.waitq);
752 731
753 /* Sleep until response is generated by FW */ 732 /* Sleep until response is generated by FW */
754 wait_event_interruptible(pcmdnode->cmdwait_q, 733 wait_event_interruptible(pcmdnode->cmdwait_q,
755 pcmdnode->cmdwaitqwoken); 734 pcmdnode->cmdwaitqwoken);
756 735
757 pcmdptr = response_buf; 736 pcmdptr = response_buf;
758 737
759 if (pcmdptr->result) { 738 if (pcmdptr->result) {
760 lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, 739 lbs_pr_err("%s: fail, result=%d\n", __func__,
761 pcmdptr->result); 740 le16_to_cpu(pcmdptr->result));
762 kfree(response_buf); 741 kfree(response_buf);
763 free_page(addr); 742 free_page(addr);
764 return 0; 743 return 0;
765 } 744 }
766 745
767 if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { 746 if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
768 lbs_pr_err("command response incorrect!\n"); 747 lbs_pr_err("command response incorrect!\n");
769 kfree(response_buf); 748 kfree(response_buf);
770 free_page(addr); 749 free_page(addr);
@@ -799,27 +778,26 @@ static ssize_t libertas_failcount_read(struct file *file, char __user *userbuf,
799 } 778 }
800 779
801 event = &pcmdptr->params.subscribe_event; 780 event = &pcmdptr->params.subscribe_event;
802 event->action = cmd_act_get; 781 event->action = cpu_to_le16(cmd_act_get);
803 pcmdptr->size = 782 pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
804 cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
805 libertas_queue_cmd(adapter, pcmdnode, 1); 783 libertas_queue_cmd(adapter, pcmdnode, 1);
806 wake_up_interruptible(&priv->mainthread.waitq); 784 wake_up_interruptible(&priv->mainthread.waitq);
807 785
808 /* Sleep until response is generated by FW */ 786 /* Sleep until response is generated by FW */
809 wait_event_interruptible(pcmdnode->cmdwait_q, 787 wait_event_interruptible(pcmdnode->cmdwait_q,
810 pcmdnode->cmdwaitqwoken); 788 pcmdnode->cmdwaitqwoken);
811 789
812 pcmdptr = response_buf; 790 pcmdptr = response_buf;
813 791
814 if (pcmdptr->result) { 792 if (pcmdptr->result) {
815 lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, 793 lbs_pr_err("%s: fail, result=%d\n", __func__,
816 pcmdptr->result); 794 le16_to_cpu(pcmdptr->result));
817 kfree(response_buf); 795 kfree(response_buf);
818 free_page(addr); 796 free_page(addr);
819 return 0; 797 return 0;
820 } 798 }
821 799
822 if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { 800 if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
823 lbs_pr_err("command response incorrect!\n"); 801 lbs_pr_err("command response incorrect!\n");
824 kfree(response_buf); 802 kfree(response_buf);
825 free_page(addr); 803 free_page(addr);
@@ -827,17 +805,17 @@ static ssize_t libertas_failcount_read(struct file *file, char __user *userbuf,
827 } 805 }
828 806
829 cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); 807 cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
830 event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); 808 event = (void *)(response_buf + S_DS_GEN);
831 while (cmd_len < pcmdptr->size) { 809 while (cmd_len < le16_to_cpu(pcmdptr->size)) {
832 struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); 810 struct mrvlietypesheader *header = (void *)(response_buf + cmd_len);
833 switch(header->type) { 811 switch (header->type) {
834 struct mrvlietypes_failurecount *failcount; 812 struct mrvlietypes_failurecount *failcount;
835 case TLV_TYPE_FAILCOUNT: 813 case __constant_cpu_to_le16(TLV_TYPE_FAILCOUNT):
836 failcount = (struct mrvlietypes_failurecount *)(response_buf + cmd_len); 814 failcount = (void *)(response_buf + cmd_len);
837 pos += snprintf(buf+pos, len-pos, "%d %d %d\n", 815 pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
838 failcount->failvalue, 816 failcount->failvalue,
839 failcount->Failfreq, 817 failcount->Failfreq,
840 (event->events & 0x0004)?1:0); 818 (event->events & cpu_to_le16(0x0004))?1:0);
841 default: 819 default:
842 cmd_len += sizeof(struct mrvlietypes_failurecount); 820 cmd_len += sizeof(struct mrvlietypes_failurecount);
843 break; 821 break;
@@ -886,7 +864,7 @@ static ssize_t libertas_failcount_write(struct file *file,
886 goto out_unlock; 864 goto out_unlock;
887 865
888 event = &pcmdptr->params.subscribe_event; 866 event = &pcmdptr->params.subscribe_event;
889 event->action = cmd_act_set; 867 event->action = cpu_to_le16(cmd_act_set);
890 pcmdptr->size = cpu_to_le16(S_DS_GEN + 868 pcmdptr->size = cpu_to_le16(S_DS_GEN +
891 sizeof(struct cmd_ds_802_11_subscribe_event) + 869 sizeof(struct cmd_ds_802_11_subscribe_event) +
892 sizeof(struct mrvlietypes_failurecount)); 870 sizeof(struct mrvlietypes_failurecount));
@@ -894,30 +872,30 @@ static ssize_t libertas_failcount_write(struct file *file,
894 ptr = (u8*) pcmdptr+cmd_len; 872 ptr = (u8*) pcmdptr+cmd_len;
895 failcount = (struct mrvlietypes_failurecount *)(ptr); 873 failcount = (struct mrvlietypes_failurecount *)(ptr);
896 failcount->header.type = cpu_to_le16(TLV_TYPE_FAILCOUNT); 874 failcount->header.type = cpu_to_le16(TLV_TYPE_FAILCOUNT);
897 failcount->header.len = 2; 875 failcount->header.len = cpu_to_le16(2);
898 failcount->failvalue = cpu_to_le16(value); 876 failcount->failvalue = value;
899 failcount->Failfreq = cpu_to_le16(freq); 877 failcount->Failfreq = freq;
900 event_bitmap |= subscribed ? 0x0004 : 0x0; 878 event_bitmap |= subscribed ? 0x0004 : 0x0;
901 event->events = event_bitmap; 879 event->events = cpu_to_le16(event_bitmap);
902 880
903 libertas_queue_cmd(adapter, pcmdnode, 1); 881 libertas_queue_cmd(adapter, pcmdnode, 1);
904 wake_up_interruptible(&priv->mainthread.waitq); 882 wake_up_interruptible(&priv->mainthread.waitq);
905 883
906 /* Sleep until response is generated by FW */ 884 /* Sleep until response is generated by FW */
907 wait_event_interruptible(pcmdnode->cmdwait_q, 885 wait_event_interruptible(pcmdnode->cmdwait_q,
908 pcmdnode->cmdwaitqwoken); 886 pcmdnode->cmdwaitqwoken);
909 887
910 pcmdptr = (struct cmd_ds_command *)response_buf; 888 pcmdptr = (struct cmd_ds_command *)response_buf;
911 889
912 if (pcmdptr->result) { 890 if (pcmdptr->result) {
913 lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, 891 lbs_pr_err("%s: fail, result=%d\n", __func__,
914 pcmdptr->result); 892 le16_to_cpu(pcmdptr->result));
915 kfree(response_buf); 893 kfree(response_buf);
916 free_page(addr); 894 free_page(addr);
917 return 0; 895 return 0;
918 } 896 }
919 897
920 if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { 898 if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
921 lbs_pr_err("command response incorrect!\n"); 899 lbs_pr_err("command response incorrect!\n");
922 kfree(response_buf); 900 kfree(response_buf);
923 free_page(addr); 901 free_page(addr);
@@ -951,27 +929,26 @@ static ssize_t libertas_bcnmiss_read(struct file *file, char __user *userbuf,
951 } 929 }
952 930
953 event = &pcmdptr->params.subscribe_event; 931 event = &pcmdptr->params.subscribe_event;
954 event->action = cmd_act_get; 932 event->action = cpu_to_le16(cmd_act_get);
955 pcmdptr->size = 933 pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
956 cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
957 libertas_queue_cmd(adapter, pcmdnode, 1); 934 libertas_queue_cmd(adapter, pcmdnode, 1);
958 wake_up_interruptible(&priv->mainthread.waitq); 935 wake_up_interruptible(&priv->mainthread.waitq);
959 936
960 /* Sleep until response is generated by FW */ 937 /* Sleep until response is generated by FW */
961 wait_event_interruptible(pcmdnode->cmdwait_q, 938 wait_event_interruptible(pcmdnode->cmdwait_q,
962 pcmdnode->cmdwaitqwoken); 939 pcmdnode->cmdwaitqwoken);
963 940
964 pcmdptr = response_buf; 941 pcmdptr = response_buf;
965 942
966 if (pcmdptr->result) { 943 if (pcmdptr->result) {
967 lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, 944 lbs_pr_err("%s: fail, result=%d\n", __func__,
968 pcmdptr->result); 945 le16_to_cpu(pcmdptr->result));
969 free_page(addr); 946 free_page(addr);
970 kfree(response_buf); 947 kfree(response_buf);
971 return 0; 948 return 0;
972 } 949 }
973 950
974 if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { 951 if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
975 lbs_pr_err("command response incorrect!\n"); 952 lbs_pr_err("command response incorrect!\n");
976 free_page(addr); 953 free_page(addr);
977 kfree(response_buf); 954 kfree(response_buf);
@@ -979,16 +956,16 @@ static ssize_t libertas_bcnmiss_read(struct file *file, char __user *userbuf,
979 } 956 }
980 957
981 cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); 958 cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
982 event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); 959 event = (void *)(response_buf + S_DS_GEN);
983 while (cmd_len < pcmdptr->size) { 960 while (cmd_len < le16_to_cpu(pcmdptr->size)) {
984 struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); 961 struct mrvlietypesheader *header = (void *)(response_buf + cmd_len);
985 switch(header->type) { 962 switch (header->type) {
986 struct mrvlietypes_beaconsmissed *bcnmiss; 963 struct mrvlietypes_beaconsmissed *bcnmiss;
987 case TLV_TYPE_BCNMISS: 964 case __constant_cpu_to_le16(TLV_TYPE_BCNMISS):
988 bcnmiss = (struct mrvlietypes_beaconsmissed *)(response_buf + cmd_len); 965 bcnmiss = (void *)(response_buf + cmd_len);
989 pos += snprintf(buf+pos, len-pos, "%d N/A %d\n", 966 pos += snprintf(buf+pos, len-pos, "%d N/A %d\n",
990 bcnmiss->beaconmissed, 967 bcnmiss->beaconmissed,
991 (event->events & 0x0008)?1:0); 968 (event->events & cpu_to_le16(0x0008))?1:0);
992 default: 969 default:
993 cmd_len += sizeof(struct mrvlietypes_beaconsmissed); 970 cmd_len += sizeof(struct mrvlietypes_beaconsmissed);
994 break; 971 break;
@@ -1038,7 +1015,7 @@ static ssize_t libertas_bcnmiss_write(struct file *file,
1038 goto out_unlock; 1015 goto out_unlock;
1039 1016
1040 event = &pcmdptr->params.subscribe_event; 1017 event = &pcmdptr->params.subscribe_event;
1041 event->action = cmd_act_set; 1018 event->action = cpu_to_le16(cmd_act_set);
1042 pcmdptr->size = cpu_to_le16(S_DS_GEN + 1019 pcmdptr->size = cpu_to_le16(S_DS_GEN +
1043 sizeof(struct cmd_ds_802_11_subscribe_event) + 1020 sizeof(struct cmd_ds_802_11_subscribe_event) +
1044 sizeof(struct mrvlietypes_beaconsmissed)); 1021 sizeof(struct mrvlietypes_beaconsmissed));
@@ -1046,29 +1023,29 @@ static ssize_t libertas_bcnmiss_write(struct file *file,
1046 ptr = (u8*) pcmdptr+cmd_len; 1023 ptr = (u8*) pcmdptr+cmd_len;
1047 bcnmiss = (struct mrvlietypes_beaconsmissed *)(ptr); 1024 bcnmiss = (struct mrvlietypes_beaconsmissed *)(ptr);
1048 bcnmiss->header.type = cpu_to_le16(TLV_TYPE_BCNMISS); 1025 bcnmiss->header.type = cpu_to_le16(TLV_TYPE_BCNMISS);
1049 bcnmiss->header.len = 2; 1026 bcnmiss->header.len = cpu_to_le16(2);
1050 bcnmiss->beaconmissed = cpu_to_le16(value); 1027 bcnmiss->beaconmissed = value;
1051 event_bitmap |= subscribed ? 0x0008 : 0x0; 1028 event_bitmap |= subscribed ? 0x0008 : 0x0;
1052 event->events = event_bitmap; 1029 event->events = cpu_to_le16(event_bitmap);
1053 1030
1054 libertas_queue_cmd(adapter, pcmdnode, 1); 1031 libertas_queue_cmd(adapter, pcmdnode, 1);
1055 wake_up_interruptible(&priv->mainthread.waitq); 1032 wake_up_interruptible(&priv->mainthread.waitq);
1056 1033
1057 /* Sleep until response is generated by FW */ 1034 /* Sleep until response is generated by FW */
1058 wait_event_interruptible(pcmdnode->cmdwait_q, 1035 wait_event_interruptible(pcmdnode->cmdwait_q,
1059 pcmdnode->cmdwaitqwoken); 1036 pcmdnode->cmdwaitqwoken);
1060 1037
1061 pcmdptr = response_buf; 1038 pcmdptr = response_buf;
1062 1039
1063 if (pcmdptr->result) { 1040 if (pcmdptr->result) {
1064 lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, 1041 lbs_pr_err("%s: fail, result=%d\n", __func__,
1065 pcmdptr->result); 1042 le16_to_cpu(pcmdptr->result));
1066 kfree(response_buf); 1043 kfree(response_buf);
1067 free_page(addr); 1044 free_page(addr);
1068 return 0; 1045 return 0;
1069 } 1046 }
1070 1047
1071 if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { 1048 if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
1072 lbs_pr_err("command response incorrect!\n"); 1049 lbs_pr_err("command response incorrect!\n");
1073 free_page(addr); 1050 free_page(addr);
1074 kfree(response_buf); 1051 kfree(response_buf);
@@ -1102,27 +1079,26 @@ static ssize_t libertas_highrssi_read(struct file *file, char __user *userbuf,
1102 } 1079 }
1103 1080
1104 event = &pcmdptr->params.subscribe_event; 1081 event = &pcmdptr->params.subscribe_event;
1105 event->action = cmd_act_get; 1082 event->action = cpu_to_le16(cmd_act_get);
1106 pcmdptr->size = 1083 pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
1107 cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
1108 libertas_queue_cmd(adapter, pcmdnode, 1); 1084 libertas_queue_cmd(adapter, pcmdnode, 1);
1109 wake_up_interruptible(&priv->mainthread.waitq); 1085 wake_up_interruptible(&priv->mainthread.waitq);
1110 1086
1111 /* Sleep until response is generated by FW */ 1087 /* Sleep until response is generated by FW */
1112 wait_event_interruptible(pcmdnode->cmdwait_q, 1088 wait_event_interruptible(pcmdnode->cmdwait_q,
1113 pcmdnode->cmdwaitqwoken); 1089 pcmdnode->cmdwaitqwoken);
1114 1090
1115 pcmdptr = response_buf; 1091 pcmdptr = response_buf;
1116 1092
1117 if (pcmdptr->result) { 1093 if (pcmdptr->result) {
1118 lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, 1094 lbs_pr_err("%s: fail, result=%d\n", __func__,
1119 pcmdptr->result); 1095 le16_to_cpu(pcmdptr->result));
1120 kfree(response_buf); 1096 kfree(response_buf);
1121 free_page(addr); 1097 free_page(addr);
1122 return 0; 1098 return 0;
1123 } 1099 }
1124 1100
1125 if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { 1101 if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
1126 lbs_pr_err("command response incorrect!\n"); 1102 lbs_pr_err("command response incorrect!\n");
1127 kfree(response_buf); 1103 kfree(response_buf);
1128 free_page(addr); 1104 free_page(addr);
@@ -1130,17 +1106,17 @@ static ssize_t libertas_highrssi_read(struct file *file, char __user *userbuf,
1130 } 1106 }
1131 1107
1132 cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); 1108 cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
1133 event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); 1109 event = (void *)(response_buf + S_DS_GEN);
1134 while (cmd_len < pcmdptr->size) { 1110 while (cmd_len < le16_to_cpu(pcmdptr->size)) {
1135 struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); 1111 struct mrvlietypesheader *header = (void *)(response_buf + cmd_len);
1136 switch(header->type) { 1112 switch (header->type) {
1137 struct mrvlietypes_rssithreshold *Highrssi; 1113 struct mrvlietypes_rssithreshold *Highrssi;
1138 case TLV_TYPE_RSSI_HIGH: 1114 case __constant_cpu_to_le16(TLV_TYPE_RSSI_HIGH):
1139 Highrssi = (struct mrvlietypes_rssithreshold *)(response_buf + cmd_len); 1115 Highrssi = (void *)(response_buf + cmd_len);
1140 pos += snprintf(buf+pos, len-pos, "%d %d %d\n", 1116 pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
1141 Highrssi->rssivalue, 1117 Highrssi->rssivalue,
1142 Highrssi->rssifreq, 1118 Highrssi->rssifreq,
1143 (event->events & 0x0010)?1:0); 1119 (event->events & cpu_to_le16(0x0010))?1:0);
1144 default: 1120 default:
1145 cmd_len += sizeof(struct mrvlietypes_snrthreshold); 1121 cmd_len += sizeof(struct mrvlietypes_snrthreshold);
1146 break; 1122 break;
@@ -1190,7 +1166,7 @@ static ssize_t libertas_highrssi_write(struct file *file,
1190 goto out_unlock; 1166 goto out_unlock;
1191 1167
1192 event = &pcmdptr->params.subscribe_event; 1168 event = &pcmdptr->params.subscribe_event;
1193 event->action = cmd_act_set; 1169 event->action = cpu_to_le16(cmd_act_set);
1194 pcmdptr->size = cpu_to_le16(S_DS_GEN + 1170 pcmdptr->size = cpu_to_le16(S_DS_GEN +
1195 sizeof(struct cmd_ds_802_11_subscribe_event) + 1171 sizeof(struct cmd_ds_802_11_subscribe_event) +
1196 sizeof(struct mrvlietypes_rssithreshold)); 1172 sizeof(struct mrvlietypes_rssithreshold));
@@ -1198,29 +1174,29 @@ static ssize_t libertas_highrssi_write(struct file *file,
1198 ptr = (u8*) pcmdptr+cmd_len; 1174 ptr = (u8*) pcmdptr+cmd_len;
1199 rssi_threshold = (struct mrvlietypes_rssithreshold *)(ptr); 1175 rssi_threshold = (struct mrvlietypes_rssithreshold *)(ptr);
1200 rssi_threshold->header.type = cpu_to_le16(TLV_TYPE_RSSI_HIGH); 1176 rssi_threshold->header.type = cpu_to_le16(TLV_TYPE_RSSI_HIGH);
1201 rssi_threshold->header.len = 2; 1177 rssi_threshold->header.len = cpu_to_le16(2);
1202 rssi_threshold->rssivalue = cpu_to_le16(value); 1178 rssi_threshold->rssivalue = value;
1203 rssi_threshold->rssifreq = cpu_to_le16(freq); 1179 rssi_threshold->rssifreq = freq;
1204 event_bitmap |= subscribed ? 0x0010 : 0x0; 1180 event_bitmap |= subscribed ? 0x0010 : 0x0;
1205 event->events = event_bitmap; 1181 event->events = cpu_to_le16(event_bitmap);
1206 1182
1207 libertas_queue_cmd(adapter, pcmdnode, 1); 1183 libertas_queue_cmd(adapter, pcmdnode, 1);
1208 wake_up_interruptible(&priv->mainthread.waitq); 1184 wake_up_interruptible(&priv->mainthread.waitq);
1209 1185
1210 /* Sleep until response is generated by FW */ 1186 /* Sleep until response is generated by FW */
1211 wait_event_interruptible(pcmdnode->cmdwait_q, 1187 wait_event_interruptible(pcmdnode->cmdwait_q,
1212 pcmdnode->cmdwaitqwoken); 1188 pcmdnode->cmdwaitqwoken);
1213 1189
1214 pcmdptr = response_buf; 1190 pcmdptr = response_buf;
1215 1191
1216 if (pcmdptr->result) { 1192 if (pcmdptr->result) {
1217 lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, 1193 lbs_pr_err("%s: fail, result=%d\n", __func__,
1218 pcmdptr->result); 1194 le16_to_cpu(pcmdptr->result));
1219 kfree(response_buf); 1195 kfree(response_buf);
1220 return 0; 1196 return 0;
1221 } 1197 }
1222 1198
1223 if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { 1199 if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
1224 lbs_pr_err("command response incorrect!\n"); 1200 lbs_pr_err("command response incorrect!\n");
1225 kfree(response_buf); 1201 kfree(response_buf);
1226 return 0; 1202 return 0;
@@ -1253,27 +1229,26 @@ static ssize_t libertas_highsnr_read(struct file *file, char __user *userbuf,
1253 } 1229 }
1254 1230
1255 event = &pcmdptr->params.subscribe_event; 1231 event = &pcmdptr->params.subscribe_event;
1256 event->action = cmd_act_get; 1232 event->action = cpu_to_le16(cmd_act_get);
1257 pcmdptr->size = 1233 pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
1258 cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
1259 libertas_queue_cmd(adapter, pcmdnode, 1); 1234 libertas_queue_cmd(adapter, pcmdnode, 1);
1260 wake_up_interruptible(&priv->mainthread.waitq); 1235 wake_up_interruptible(&priv->mainthread.waitq);
1261 1236
1262 /* Sleep until response is generated by FW */ 1237 /* Sleep until response is generated by FW */
1263 wait_event_interruptible(pcmdnode->cmdwait_q, 1238 wait_event_interruptible(pcmdnode->cmdwait_q,
1264 pcmdnode->cmdwaitqwoken); 1239 pcmdnode->cmdwaitqwoken);
1265 1240
1266 pcmdptr = response_buf; 1241 pcmdptr = response_buf;
1267 1242
1268 if (pcmdptr->result) { 1243 if (pcmdptr->result) {
1269 lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, 1244 lbs_pr_err("%s: fail, result=%d\n", __func__,
1270 pcmdptr->result); 1245 le16_to_cpu(pcmdptr->result));
1271 kfree(response_buf); 1246 kfree(response_buf);
1272 free_page(addr); 1247 free_page(addr);
1273 return 0; 1248 return 0;
1274 } 1249 }
1275 1250
1276 if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { 1251 if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
1277 lbs_pr_err("command response incorrect!\n"); 1252 lbs_pr_err("command response incorrect!\n");
1278 kfree(response_buf); 1253 kfree(response_buf);
1279 free_page(addr); 1254 free_page(addr);
@@ -1281,17 +1256,17 @@ static ssize_t libertas_highsnr_read(struct file *file, char __user *userbuf,
1281 } 1256 }
1282 1257
1283 cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); 1258 cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
1284 event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); 1259 event = (void *)(response_buf + S_DS_GEN);
1285 while (cmd_len < pcmdptr->size) { 1260 while (cmd_len < le16_to_cpu(pcmdptr->size)) {
1286 struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); 1261 struct mrvlietypesheader *header = (void *)(response_buf + cmd_len);
1287 switch(header->type) { 1262 switch (header->type) {
1288 struct mrvlietypes_snrthreshold *HighSnr; 1263 struct mrvlietypes_snrthreshold *HighSnr;
1289 case TLV_TYPE_SNR_HIGH: 1264 case __constant_cpu_to_le16(TLV_TYPE_SNR_HIGH):
1290 HighSnr = (struct mrvlietypes_snrthreshold *)(response_buf + cmd_len); 1265 HighSnr = (void *)(response_buf + cmd_len);
1291 pos += snprintf(buf+pos, len-pos, "%d %d %d\n", 1266 pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
1292 HighSnr->snrvalue, 1267 HighSnr->snrvalue,
1293 HighSnr->snrfreq, 1268 HighSnr->snrfreq,
1294 (event->events & 0x0020)?1:0); 1269 (event->events & cpu_to_le16(0x0020))?1:0);
1295 default: 1270 default:
1296 cmd_len += sizeof(struct mrvlietypes_snrthreshold); 1271 cmd_len += sizeof(struct mrvlietypes_snrthreshold);
1297 break; 1272 break;
@@ -1341,7 +1316,7 @@ static ssize_t libertas_highsnr_write(struct file *file,
1341 goto out_unlock; 1316 goto out_unlock;
1342 1317
1343 event = &pcmdptr->params.subscribe_event; 1318 event = &pcmdptr->params.subscribe_event;
1344 event->action = cmd_act_set; 1319 event->action = cpu_to_le16(cmd_act_set);
1345 pcmdptr->size = cpu_to_le16(S_DS_GEN + 1320 pcmdptr->size = cpu_to_le16(S_DS_GEN +
1346 sizeof(struct cmd_ds_802_11_subscribe_event) + 1321 sizeof(struct cmd_ds_802_11_subscribe_event) +
1347 sizeof(struct mrvlietypes_snrthreshold)); 1322 sizeof(struct mrvlietypes_snrthreshold));
@@ -1349,30 +1324,30 @@ static ssize_t libertas_highsnr_write(struct file *file,
1349 ptr = (u8*) pcmdptr+cmd_len; 1324 ptr = (u8*) pcmdptr+cmd_len;
1350 snr_threshold = (struct mrvlietypes_snrthreshold *)(ptr); 1325 snr_threshold = (struct mrvlietypes_snrthreshold *)(ptr);
1351 snr_threshold->header.type = cpu_to_le16(TLV_TYPE_SNR_HIGH); 1326 snr_threshold->header.type = cpu_to_le16(TLV_TYPE_SNR_HIGH);
1352 snr_threshold->header.len = 2; 1327 snr_threshold->header.len = cpu_to_le16(2);
1353 snr_threshold->snrvalue = cpu_to_le16(value); 1328 snr_threshold->snrvalue = value;
1354 snr_threshold->snrfreq = cpu_to_le16(freq); 1329 snr_threshold->snrfreq = freq;
1355 event_bitmap |= subscribed ? 0x0020 : 0x0; 1330 event_bitmap |= subscribed ? 0x0020 : 0x0;
1356 event->events = event_bitmap; 1331 event->events = cpu_to_le16(event_bitmap);
1357 1332
1358 libertas_queue_cmd(adapter, pcmdnode, 1); 1333 libertas_queue_cmd(adapter, pcmdnode, 1);
1359 wake_up_interruptible(&priv->mainthread.waitq); 1334 wake_up_interruptible(&priv->mainthread.waitq);
1360 1335
1361 /* Sleep until response is generated by FW */ 1336 /* Sleep until response is generated by FW */
1362 wait_event_interruptible(pcmdnode->cmdwait_q, 1337 wait_event_interruptible(pcmdnode->cmdwait_q,
1363 pcmdnode->cmdwaitqwoken); 1338 pcmdnode->cmdwaitqwoken);
1364 1339
1365 pcmdptr = response_buf; 1340 pcmdptr = response_buf;
1366 1341
1367 if (pcmdptr->result) { 1342 if (pcmdptr->result) {
1368 lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, 1343 lbs_pr_err("%s: fail, result=%d\n", __func__,
1369 pcmdptr->result); 1344 le16_to_cpu(pcmdptr->result));
1370 kfree(response_buf); 1345 kfree(response_buf);
1371 free_page(addr); 1346 free_page(addr);
1372 return 0; 1347 return 0;
1373 } 1348 }
1374 1349
1375 if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { 1350 if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
1376 lbs_pr_err("command response incorrect!\n"); 1351 lbs_pr_err("command response incorrect!\n");
1377 kfree(response_buf); 1352 kfree(response_buf);
1378 free_page(addr); 1353 free_page(addr);
@@ -1760,7 +1735,7 @@ void libertas_debugfs_remove_one(wlan_private *priv)
1760 1735
1761 debugfs_remove(priv->regs_dir); 1736 debugfs_remove(priv->regs_dir);
1762 1737
1763 for(i=0; i<ARRAY_SIZE(debugfs_files); i++) 1738 for(i=0; i<ARRAY_SIZE(debugfs_events_files); i++)
1764 debugfs_remove(priv->debugfs_events_files[i]); 1739 debugfs_remove(priv->debugfs_events_files[i]);
1765 1740
1766 debugfs_remove(priv->events_dir); 1741 debugfs_remove(priv->events_dir);
@@ -1769,13 +1744,19 @@ void libertas_debugfs_remove_one(wlan_private *priv)
1769#endif 1744#endif
1770 for(i=0; i<ARRAY_SIZE(debugfs_files); i++) 1745 for(i=0; i<ARRAY_SIZE(debugfs_files); i++)
1771 debugfs_remove(priv->debugfs_files[i]); 1746 debugfs_remove(priv->debugfs_files[i]);
1747 debugfs_remove(priv->debugfs_dir);
1772} 1748}
1773 1749
1750
1751
1774/* debug entry */ 1752/* debug entry */
1775 1753
1754#ifdef PROC_DEBUG
1755
1776#define item_size(n) (FIELD_SIZEOF(wlan_adapter, n)) 1756#define item_size(n) (FIELD_SIZEOF(wlan_adapter, n))
1777#define item_addr(n) (offsetof(wlan_adapter, n)) 1757#define item_addr(n) (offsetof(wlan_adapter, n))
1778 1758
1759
1779struct debug_data { 1760struct debug_data {
1780 char name[32]; 1761 char name[32];
1781 u32 size; 1762 u32 size;
@@ -1863,7 +1844,7 @@ static ssize_t wlan_debugfs_write(struct file *f, const char __user *buf,
1863 return 0; 1844 return 0;
1864 1845
1865 if (copy_from_user(pdata, buf, cnt)) { 1846 if (copy_from_user(pdata, buf, cnt)) {
1866 lbs_pr_debug(1, "Copy from user failed\n"); 1847 lbs_deb_debugfs("Copy from user failed\n");
1867 kfree(pdata); 1848 kfree(pdata);
1868 return 0; 1849 return 0;
1869 } 1850 }
@@ -1913,7 +1894,7 @@ static struct file_operations libertas_debug_fops = {
1913 * @param dev pointer net_device 1894 * @param dev pointer net_device
1914 * @return N/A 1895 * @return N/A
1915 */ 1896 */
1916void libertas_debug_init(wlan_private * priv, struct net_device *dev) 1897static void libertas_debug_init(wlan_private * priv, struct net_device *dev)
1917{ 1898{
1918 int i; 1899 int i;
1919 1900
@@ -1927,4 +1908,5 @@ void libertas_debug_init(wlan_private * priv, struct net_device *dev)
1927 priv->debugfs_dir, &items[0], 1908 priv->debugfs_dir, &items[0],
1928 &libertas_debug_fops); 1909 &libertas_debug_fops);
1929} 1910}
1911#endif
1930 1912
diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h
index dfe27642322c..40f56bb1eac8 100644
--- a/drivers/net/wireless/libertas/decl.h
+++ b/drivers/net/wireless/libertas/decl.h
@@ -6,6 +6,8 @@
6#ifndef _WLAN_DECL_H_ 6#ifndef _WLAN_DECL_H_
7#define _WLAN_DECL_H_ 7#define _WLAN_DECL_H_
8 8
9#include <linux/device.h>
10
9#include "defs.h" 11#include "defs.h"
10 12
11/** Function Prototype Declaration */ 13/** Function Prototype Declaration */
@@ -66,18 +68,24 @@ void libertas_ps_wakeup(wlan_private * priv, int wait_option);
66 68
67void libertas_tx_runqueue(wlan_private *priv); 69void libertas_tx_runqueue(wlan_private *priv);
68 70
69extern struct chan_freq_power *libertas_find_cfp_by_band_and_channel( 71struct chan_freq_power *libertas_find_cfp_by_band_and_channel(
70 wlan_adapter * adapter, u8 band, u16 channel); 72 wlan_adapter * adapter, u8 band, u16 channel);
71 73
72extern void libertas_mac_event_disconnected(wlan_private * priv); 74void libertas_mac_event_disconnected(wlan_private * priv);
73 75
74void libertas_send_iwevcustom_event(wlan_private * priv, s8 * str); 76void libertas_send_iwevcustom_event(wlan_private * priv, s8 * str);
75 77
76int reset_device(wlan_private *priv); 78/* fw.c */
79int libertas_init_fw(wlan_private * priv, char *fw_name);
80
77/* main.c */ 81/* main.c */
78extern struct chan_freq_power *libertas_get_region_cfp_table(u8 region, u8 band, 82struct chan_freq_power *libertas_get_region_cfp_table(u8 region, u8 band,
79 int *cfp_no); 83 int *cfp_no);
80wlan_private *wlan_add_card(void *card); 84wlan_private *libertas_add_card(void *card, struct device *dmdev);
81int wlan_remove_card(void *card); 85int libertas_activate_card(wlan_private *priv, char *fw_name);
86int libertas_remove_card(wlan_private *priv);
87int libertas_add_mesh(wlan_private *priv, struct device *dev);
88void libertas_remove_mesh(wlan_private *priv);
89
82 90
83#endif /* _WLAN_DECL_H_ */ 91#endif /* _WLAN_DECL_H_ */
diff --git a/drivers/net/wireless/libertas/defs.h b/drivers/net/wireless/libertas/defs.h
index 80dd9ea19c8e..4dd43e59bda0 100644
--- a/drivers/net/wireless/libertas/defs.h
+++ b/drivers/net/wireless/libertas/defs.h
@@ -7,14 +7,79 @@
7 7
8#include <linux/spinlock.h> 8#include <linux/spinlock.h>
9 9
10extern unsigned int libertas_debug;
11
12#ifdef CONFIG_LIBERTAS_DEBUG 10#ifdef CONFIG_LIBERTAS_DEBUG
13#define DEBUG 11#define DEBUG
14#define PROC_DEBUG 12#define PROC_DEBUG
15#endif 13#endif
16 14
17#define DRV_NAME "usb8xxx" 15#ifndef DRV_NAME
16#define DRV_NAME "libertas"
17#endif
18
19
20#define LBS_DEB_ENTER 0x00000001
21#define LBS_DEB_LEAVE 0x00000002
22#define LBS_DEB_MAIN 0x00000004
23#define LBS_DEB_NET 0x00000008
24#define LBS_DEB_MESH 0x00000010
25#define LBS_DEB_WEXT 0x00000020
26#define LBS_DEB_IOCTL 0x00000040
27#define LBS_DEB_SCAN 0x00000080
28#define LBS_DEB_ASSOC 0x00000100
29#define LBS_DEB_JOIN 0x00000200
30#define LBS_DEB_11D 0x00000400
31#define LBS_DEB_DEBUGFS 0x00000800
32#define LBS_DEB_ETHTOOL 0x00001000
33#define LBS_DEB_HOST 0x00002000
34#define LBS_DEB_CMD 0x00004000
35#define LBS_DEB_RX 0x00008000
36#define LBS_DEB_TX 0x00010000
37#define LBS_DEB_USB 0x00020000
38#define LBS_DEB_CS 0x00040000
39#define LBS_DEB_FW 0x00080000
40#define LBS_DEB_THREAD 0x00100000
41#define LBS_DEB_HEX 0x00200000
42
43extern unsigned int libertas_debug;
44
45#ifdef DEBUG
46#define LBS_DEB_LL(grp, fmt, args...) \
47do { if ((libertas_debug & (grp)) == (grp)) \
48 printk(KERN_DEBUG DRV_NAME "%s: " fmt, \
49 in_interrupt() ? " (INT)" : "", ## args); } while (0)
50#else
51#define LBS_DEB_LL(grp, fmt, args...) do {} while (0)
52#endif
53
54#define lbs_deb_enter(grp) \
55 LBS_DEB_LL(grp | LBS_DEB_ENTER, "%s():%d enter\n", __FUNCTION__, __LINE__);
56#define lbs_deb_enter_args(grp, fmt, args...) \
57 LBS_DEB_LL(grp | LBS_DEB_ENTER, "%s(" fmt "):%d\n", __FUNCTION__, ## args, __LINE__);
58#define lbs_deb_leave(grp) \
59 LBS_DEB_LL(grp | LBS_DEB_LEAVE, "%s():%d leave\n", __FUNCTION__, __LINE__);
60#define lbs_deb_leave_args(grp, fmt, args...) \
61 LBS_DEB_LL(grp | LBS_DEB_LEAVE, "%s():%d leave, " fmt "\n", \
62 __FUNCTION__, __LINE__, ##args);
63#define lbs_deb_main(fmt, args...) LBS_DEB_LL(LBS_DEB_MAIN, fmt, ##args)
64#define lbs_deb_net(fmt, args...) LBS_DEB_LL(LBS_DEB_NET, fmt, ##args)
65#define lbs_deb_mesh(fmt, args...) LBS_DEB_LL(LBS_DEB_MESH, fmt, ##args)
66#define lbs_deb_wext(fmt, args...) LBS_DEB_LL(LBS_DEB_WEXT, fmt, ##args)
67#define lbs_deb_ioctl(fmt, args...) LBS_DEB_LL(LBS_DEB_IOCTL, fmt, ##args)
68#define lbs_deb_scan(fmt, args...) LBS_DEB_LL(LBS_DEB_SCAN, fmt, ##args)
69#define lbs_deb_assoc(fmt, args...) LBS_DEB_LL(LBS_DEB_ASSOC, fmt, ##args)
70#define lbs_deb_join(fmt, args...) LBS_DEB_LL(LBS_DEB_JOIN, fmt, ##args)
71#define lbs_deb_11d(fmt, args...) LBS_DEB_LL(LBS_DEB_11D, fmt, ##args)
72#define lbs_deb_debugfs(fmt, args...) LBS_DEB_LL(LBS_DEB_DEBUGFS, fmt, ##args)
73#define lbs_deb_ethtool(fmt, args...) LBS_DEB_LL(LBS_DEB_ETHTOOL, fmt, ##args)
74#define lbs_deb_host(fmt, args...) LBS_DEB_LL(LBS_DEB_HOST, fmt, ##args)
75#define lbs_deb_cmd(fmt, args...) LBS_DEB_LL(LBS_DEB_CMD, fmt, ##args)
76#define lbs_deb_rx(fmt, args...) LBS_DEB_LL(LBS_DEB_RX, fmt, ##args)
77#define lbs_deb_tx(fmt, args...) LBS_DEB_LL(LBS_DEB_TX, fmt, ##args)
78#define lbs_deb_fw(fmt, args...) LBS_DEB_LL(LBS_DEB_FW, fmt, ##args)
79#define lbs_deb_usb(fmt, args...) LBS_DEB_LL(LBS_DEB_USB, fmt, ##args)
80#define lbs_deb_usbd(dev, fmt, args...) LBS_DEB_LL(LBS_DEB_USB, "%s:" fmt, (dev)->bus_id, ##args)
81#define lbs_deb_cs(fmt, args...) LBS_DEB_LL(LBS_DEB_CS, fmt, ##args)
82#define lbs_deb_thread(fmt, args...) LBS_DEB_LL(LBS_DEB_THREAD, fmt, ##args)
18 83
19#define lbs_pr_info(format, args...) \ 84#define lbs_pr_info(format, args...) \
20 printk(KERN_INFO DRV_NAME": " format, ## args) 85 printk(KERN_INFO DRV_NAME": " format, ## args)
@@ -24,37 +89,25 @@ extern unsigned int libertas_debug;
24 printk(KERN_ALERT DRV_NAME": " format, ## args) 89 printk(KERN_ALERT DRV_NAME": " format, ## args)
25 90
26#ifdef DEBUG 91#ifdef DEBUG
27#define lbs_pr_debug(level, format, args...) \
28 do { if (libertas_debug >= level) \
29 printk(KERN_INFO DRV_NAME": " format, ##args); } while (0)
30#define lbs_dev_dbg(level, device, format, args...) \
31 lbs_pr_debug(level, "%s: " format, \
32 (device)->bus_id , ## args)
33
34static inline void lbs_dbg_hex(char *prompt, u8 * buf, int len) 92static inline void lbs_dbg_hex(char *prompt, u8 * buf, int len)
35{ 93{
36 int i = 0; 94 int i = 0;
37 95
38 if (!libertas_debug) 96 if (!(libertas_debug & LBS_DEB_HEX))
39 return; 97 return;
40 98
41 printk(KERN_DEBUG "%s: ", prompt); 99 printk(KERN_DEBUG "%s: ", prompt);
42 for (i = 1; i <= len; i++) { 100 for (i = 1; i <= len; i++) {
43 printk(KERN_DEBUG "%02x ", (u8) * buf); 101 printk("%02x ", (u8) * buf);
44 buf++; 102 buf++;
45 } 103 }
46 printk("\n"); 104 printk("\n");
47} 105}
48#else 106#else
49#define lbs_pr_debug(level, format, args...) do {} while (0)
50#define lbs_dev_dbg(level, device, format, args...) do {} while (0)
51#define lbs_dbg_hex(x,y,z) do {} while (0) 107#define lbs_dbg_hex(x,y,z) do {} while (0)
52#endif 108#endif
53 109
54#define ENTER() lbs_pr_debug(1, "Enter: %s, %s:%i\n", \ 110
55 __FUNCTION__, __FILE__, __LINE__)
56#define LEAVE() lbs_pr_debug(1, "Leave: %s, %s:%i\n", \
57 __FUNCTION__, __FILE__, __LINE__)
58 111
59/** Buffer Constants */ 112/** Buffer Constants */
60 113
@@ -74,7 +127,6 @@ static inline void lbs_dbg_hex(char *prompt, u8 * buf, int len)
74#define MRVDRV_NUM_OF_CMD_BUFFER 10 127#define MRVDRV_NUM_OF_CMD_BUFFER 10
75#define MRVDRV_SIZE_OF_CMD_BUFFER (2 * 1024) 128#define MRVDRV_SIZE_OF_CMD_BUFFER (2 * 1024)
76#define MRVDRV_MAX_CHANNEL_SIZE 14 129#define MRVDRV_MAX_CHANNEL_SIZE 14
77#define MRVDRV_MAX_BSSID_LIST 64
78#define MRVDRV_ASSOCIATION_TIME_OUT 255 130#define MRVDRV_ASSOCIATION_TIME_OUT 255
79#define MRVDRV_SNAP_HEADER_LEN 8 131#define MRVDRV_SNAP_HEADER_LEN 8
80 132
@@ -104,6 +156,13 @@ static inline void lbs_dbg_hex(char *prompt, u8 * buf, int len)
104#define MRVDRV_MAX_BEACON_INTERVAL 1000 156#define MRVDRV_MAX_BEACON_INTERVAL 1000
105#define MRVDRV_BEACON_INTERVAL 100 157#define MRVDRV_BEACON_INTERVAL 100
106 158
159/** INT status Bit Definition*/
160#define his_cmddnldrdy 0x01
161#define his_cardevent 0x02
162#define his_cmdupldrdy 0x04
163
164#define SBI_EVENT_CAUSE_SHIFT 3
165
107/** TxPD status */ 166/** TxPD status */
108 167
109/* Station firmware use TxPD status field to report final Tx transmit 168/* Station firmware use TxPD status field to report final Tx transmit
@@ -205,8 +264,6 @@ typedef struct _wlan_adapter wlan_adapter;
205extern const char libertas_driver_version[]; 264extern const char libertas_driver_version[];
206extern u16 libertas_region_code_to_index[MRVDRV_MAX_REGION_CODE]; 265extern u16 libertas_region_code_to_index[MRVDRV_MAX_REGION_CODE];
207 266
208extern u8 libertas_wlan_data_rates[WLAN_SUPPORTED_RATES];
209
210extern u8 libertas_supported_rates[G_SUPPORTED_RATES]; 267extern u8 libertas_supported_rates[G_SUPPORTED_RATES];
211 268
212extern u8 libertas_adhoc_rates_g[G_SUPPORTED_RATES]; 269extern u8 libertas_adhoc_rates_g[G_SUPPORTED_RATES];
@@ -316,6 +373,8 @@ enum SNMP_MIB_VALUE_e {
316/* Default values for fwt commands. */ 373/* Default values for fwt commands. */
317#define FWT_DEFAULT_METRIC 0 374#define FWT_DEFAULT_METRIC 0
318#define FWT_DEFAULT_DIR 1 375#define FWT_DEFAULT_DIR 1
376/* Default Rate, 11Mbps */
377#define FWT_DEFAULT_RATE 3
319#define FWT_DEFAULT_SSN 0xffffffff 378#define FWT_DEFAULT_SSN 0xffffffff
320#define FWT_DEFAULT_DSN 0 379#define FWT_DEFAULT_DSN 0
321#define FWT_DEFAULT_HOPCOUNT 0 380#define FWT_DEFAULT_HOPCOUNT 0
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h
index e8b9020f9bd6..785192b884bc 100644
--- a/drivers/net/wireless/libertas/dev.h
+++ b/drivers/net/wireless/libertas/dev.h
@@ -63,11 +63,11 @@ struct wlan_802_11_security {
63 63
64/** Current Basic Service Set State Structure */ 64/** Current Basic Service Set State Structure */
65struct current_bss_params { 65struct current_bss_params {
66 struct bss_descriptor bssdescriptor;
67 /** bssid */ 66 /** bssid */
68 u8 bssid[ETH_ALEN]; 67 u8 bssid[ETH_ALEN];
69 /** ssid */ 68 /** ssid */
70 struct WLAN_802_11_SSID ssid; 69 u8 ssid[IW_ESSID_MAX_SIZE + 1];
70 u8 ssid_len;
71 71
72 /** band */ 72 /** band */
73 u8 band; 73 u8 band;
@@ -89,31 +89,6 @@ struct sleep_params {
89 u16 sp_reserved; 89 u16 sp_reserved;
90}; 90};
91 91
92/** Data structure for the Marvell WLAN device */
93typedef struct _wlan_dev {
94 /** device name */
95 char name[DEV_NAME_LEN];
96 /** card pointer */
97 void *card;
98 /** IO port */
99 u32 ioport;
100 /** Upload received */
101 u32 upld_rcv;
102 /** Upload type */
103 u32 upld_typ;
104 /** Upload length */
105 u32 upld_len;
106 /** netdev pointer */
107 struct net_device *netdev;
108 /* Upload buffer */
109 u8 upld_buf[WLAN_UPLD_SIZE];
110 /* Download sent:
111 bit0 1/0=data_sent/data_tx_done,
112 bit1 1/0=cmd_sent/cmd_tx_done,
113 all other bits reserved 0 */
114 u8 dnld_sent;
115} wlan_dev_t, *pwlan_dev_t;
116
117/* Mesh statistics */ 92/* Mesh statistics */
118struct wlan_mesh_stats { 93struct wlan_mesh_stats {
119 u32 fwd_bcast_cnt; /* Fwd: Broadcast counter */ 94 u32 fwd_bcast_cnt; /* Fwd: Broadcast counter */
@@ -123,6 +98,7 @@ struct wlan_mesh_stats {
123 u32 fwd_drop_noroute; /* Fwd: No route to Destination */ 98 u32 fwd_drop_noroute; /* Fwd: No route to Destination */
124 u32 fwd_drop_nobuf; /* Fwd: Run out of internal buffers */ 99 u32 fwd_drop_nobuf; /* Fwd: Run out of internal buffers */
125 u32 drop_blind; /* Rx: Dropped by blinding table */ 100 u32 drop_blind; /* Rx: Dropped by blinding table */
101 u32 tx_failed_cnt; /* Tx: Failed transmissions */
126}; 102};
127 103
128/** Private structure for the MV device */ 104/** Private structure for the MV device */
@@ -131,8 +107,11 @@ struct _wlan_private {
131 int mesh_open; 107 int mesh_open;
132 int infra_open; 108 int infra_open;
133 109
110 char name[DEV_NAME_LEN];
111
112 void *card;
134 wlan_adapter *adapter; 113 wlan_adapter *adapter;
135 wlan_dev_t wlan_dev; 114 struct net_device *dev;
136 115
137 struct net_device_stats stats; 116 struct net_device_stats stats;
138 struct net_device *mesh_dev ; /* Virtual device */ 117 struct net_device *mesh_dev ; /* Virtual device */
@@ -153,6 +132,16 @@ struct _wlan_private {
153 u32 bbp_offset; 132 u32 bbp_offset;
154 u32 rf_offset; 133 u32 rf_offset;
155 134
135 /** Upload length */
136 u32 upld_len;
137 /* Upload buffer */
138 u8 upld_buf[WLAN_UPLD_SIZE];
139 /* Download sent:
140 bit0 1/0=data_sent/data_tx_done,
141 bit1 1/0=cmd_sent/cmd_tx_done,
142 all other bits reserved 0 */
143 u8 dnld_sent;
144
156 const struct firmware *firmware; 145 const struct firmware *firmware;
157 struct device *hotplug_device; 146 struct device *hotplug_device;
158 147
@@ -161,6 +150,15 @@ struct _wlan_private {
161 150
162 struct delayed_work assoc_work; 151 struct delayed_work assoc_work;
163 struct workqueue_struct *assoc_thread; 152 struct workqueue_struct *assoc_thread;
153 struct work_struct sync_channel;
154
155 /** Hardware access */
156 int (*hw_register_dev) (wlan_private * priv);
157 int (*hw_unregister_dev) (wlan_private *);
158 int (*hw_prog_firmware) (wlan_private *);
159 int (*hw_host_to_card) (wlan_private * priv, u8 type, u8 * payload, u16 nb);
160 int (*hw_get_int_status) (wlan_private * priv, u8 *);
161 int (*hw_read_event_cause) (wlan_private *);
164}; 162};
165 163
166/** Association request 164/** Association request
@@ -171,18 +169,21 @@ struct _wlan_private {
171struct assoc_request { 169struct assoc_request {
172#define ASSOC_FLAG_SSID 1 170#define ASSOC_FLAG_SSID 1
173#define ASSOC_FLAG_CHANNEL 2 171#define ASSOC_FLAG_CHANNEL 2
174#define ASSOC_FLAG_MODE 3 172#define ASSOC_FLAG_BAND 3
175#define ASSOC_FLAG_BSSID 4 173#define ASSOC_FLAG_MODE 4
176#define ASSOC_FLAG_WEP_KEYS 5 174#define ASSOC_FLAG_BSSID 5
177#define ASSOC_FLAG_WEP_TX_KEYIDX 6 175#define ASSOC_FLAG_WEP_KEYS 6
178#define ASSOC_FLAG_WPA_MCAST_KEY 7 176#define ASSOC_FLAG_WEP_TX_KEYIDX 7
179#define ASSOC_FLAG_WPA_UCAST_KEY 8 177#define ASSOC_FLAG_WPA_MCAST_KEY 8
180#define ASSOC_FLAG_SECINFO 9 178#define ASSOC_FLAG_WPA_UCAST_KEY 9
181#define ASSOC_FLAG_WPA_IE 10 179#define ASSOC_FLAG_SECINFO 10
180#define ASSOC_FLAG_WPA_IE 11
182 unsigned long flags; 181 unsigned long flags;
183 182
184 struct WLAN_802_11_SSID ssid; 183 u8 ssid[IW_ESSID_MAX_SIZE + 1];
184 u8 ssid_len;
185 u8 channel; 185 u8 channel;
186 u8 band;
186 u8 mode; 187 u8 mode;
187 u8 bssid[ETH_ALEN]; 188 u8 bssid[ETH_ALEN];
188 189
@@ -199,12 +200,15 @@ struct assoc_request {
199 /** WPA Information Elements*/ 200 /** WPA Information Elements*/
200 u8 wpa_ie[MAX_WPA_IE_LEN]; 201 u8 wpa_ie[MAX_WPA_IE_LEN];
201 u8 wpa_ie_len; 202 u8 wpa_ie_len;
203
204 /* BSS to associate with for infrastructure of Ad-Hoc join */
205 struct bss_descriptor bss;
202}; 206};
203 207
204/** Wlan adapter data structure*/ 208/** Wlan adapter data structure*/
205struct _wlan_adapter { 209struct _wlan_adapter {
206 /** STATUS variables */ 210 /** STATUS variables */
207 u32 fwreleasenumber; 211 u8 fwreleasenumber[4];
208 u32 fwcapinfo; 212 u32 fwcapinfo;
209 /* protected with big lock */ 213 /* protected with big lock */
210 214
@@ -255,13 +259,14 @@ struct _wlan_adapter {
255 /* IW_MODE_* */ 259 /* IW_MODE_* */
256 u8 mode; 260 u8 mode;
257 261
258 struct bss_descriptor *pattemptedbssdesc; 262 u8 prev_ssid[IW_ESSID_MAX_SIZE + 1];
259 263 u8 prev_ssid_len;
260 struct WLAN_802_11_SSID previousssid; 264 u8 prev_bssid[ETH_ALEN];
261 u8 previousbssid[ETH_ALEN];
262 265
263 struct bss_descriptor *scantable; 266 /* Scan results list */
264 u32 numinscantable; 267 struct list_head network_list;
268 struct list_head network_free_list;
269 struct bss_descriptor *networks;
265 270
266 u8 scantype; 271 u8 scantype;
267 u32 scanmode; 272 u32 scanmode;
@@ -288,7 +293,6 @@ struct _wlan_adapter {
288 u32 txantenna; 293 u32 txantenna;
289 u32 rxantenna; 294 u32 rxantenna;
290 295
291 u8 adhocchannel;
292 u32 fragthsd; 296 u32 fragthsd;
293 u32 rtsthsd; 297 u32 rtsthsd;
294 298
@@ -324,7 +328,8 @@ struct _wlan_adapter {
324 u16 locallisteninterval; 328 u16 locallisteninterval;
325 u16 nullpktinterval; 329 u16 nullpktinterval;
326 330
327 struct assoc_request * assoc_req; 331 struct assoc_request * pending_assoc_req;
332 struct assoc_request * in_progress_assoc_req;
328 333
329 /** Encryption parameter */ 334 /** Encryption parameter */
330 struct wlan_802_11_security secinfo; 335 struct wlan_802_11_security secinfo;
@@ -396,6 +401,8 @@ struct _wlan_adapter {
396 u32 radiomode; 401 u32 radiomode;
397 u32 debugmode; 402 u32 debugmode;
398 u8 fw_ready; 403 u8 fw_ready;
404
405 u8 last_scanned_channel;
399}; 406};
400 407
401#endif /* _WLAN_DEV_H_ */ 408#endif /* _WLAN_DEV_H_ */
diff --git a/drivers/net/wireless/libertas/ethtool.c b/drivers/net/wireless/libertas/ethtool.c
index 0064de542963..96f1974685d4 100644
--- a/drivers/net/wireless/libertas/ethtool.c
+++ b/drivers/net/wireless/libertas/ethtool.c
@@ -1,10 +1,8 @@
1
2#include <linux/netdevice.h> 1#include <linux/netdevice.h>
3#include <linux/ethtool.h> 2#include <linux/ethtool.h>
4#include <linux/delay.h> 3#include <linux/delay.h>
5 4
6#include "host.h" 5#include "host.h"
7#include "sbi.h"
8#include "decl.h" 6#include "decl.h"
9#include "defs.h" 7#include "defs.h"
10#include "dev.h" 8#include "dev.h"
@@ -17,7 +15,8 @@ static const char * mesh_stat_strings[]= {
17 "drop_no_buffers", 15 "drop_no_buffers",
18 "fwded_unicast_cnt", 16 "fwded_unicast_cnt",
19 "fwded_bcast_cnt", 17 "fwded_bcast_cnt",
20 "drop_blind_table" 18 "drop_blind_table",
19 "tx_failed_cnt"
21}; 20};
22 21
23static void libertas_ethtool_get_drvinfo(struct net_device *dev, 22static void libertas_ethtool_get_drvinfo(struct net_device *dev,
@@ -69,7 +68,7 @@ static int libertas_ethtool_get_eeprom(struct net_device *dev,
69 68
70 /* +14 is for action, offset, and NOB in 69 /* +14 is for action, offset, and NOB in
71 * response */ 70 * response */
72 lbs_pr_debug(1, "action:%d offset: %x NOB: %02x\n", 71 lbs_deb_ethtool("action:%d offset: %x NOB: %02x\n",
73 regctrl.action, regctrl.offset, regctrl.NOB); 72 regctrl.action, regctrl.offset, regctrl.NOB);
74 73
75 ret = libertas_prepare_and_send_command(priv, 74 ret = libertas_prepare_and_send_command(priv,
@@ -81,8 +80,7 @@ static int libertas_ethtool_get_eeprom(struct net_device *dev,
81 if (ret) { 80 if (ret) {
82 if (adapter->prdeeprom) 81 if (adapter->prdeeprom)
83 kfree(adapter->prdeeprom); 82 kfree(adapter->prdeeprom);
84 LEAVE(); 83 goto done;
85 return ret;
86 } 84 }
87 85
88 mdelay(10); 86 mdelay(10);
@@ -101,7 +99,11 @@ static int libertas_ethtool_get_eeprom(struct net_device *dev,
101 kfree(adapter->prdeeprom); 99 kfree(adapter->prdeeprom);
102// mutex_unlock(&priv->mutex); 100// mutex_unlock(&priv->mutex);
103 101
104 return 0; 102 ret = 0;
103
104done:
105 lbs_deb_enter_args(LBS_DEB_ETHTOOL, "ret %d", ret);
106 return ret;
105} 107}
106 108
107static void libertas_ethtool_get_stats(struct net_device * dev, 109static void libertas_ethtool_get_stats(struct net_device * dev,
@@ -109,7 +111,7 @@ static void libertas_ethtool_get_stats(struct net_device * dev,
109{ 111{
110 wlan_private *priv = dev->priv; 112 wlan_private *priv = dev->priv;
111 113
112 ENTER(); 114 lbs_deb_enter(LBS_DEB_ETHTOOL);
113 115
114 stats->cmd = ETHTOOL_GSTATS; 116 stats->cmd = ETHTOOL_GSTATS;
115 BUG_ON(stats->n_stats != MESH_STATS_NUM); 117 BUG_ON(stats->n_stats != MESH_STATS_NUM);
@@ -121,8 +123,9 @@ static void libertas_ethtool_get_stats(struct net_device * dev,
121 data[4] = priv->mstats.fwd_unicast_cnt; 123 data[4] = priv->mstats.fwd_unicast_cnt;
122 data[5] = priv->mstats.fwd_bcast_cnt; 124 data[5] = priv->mstats.fwd_bcast_cnt;
123 data[6] = priv->mstats.drop_blind; 125 data[6] = priv->mstats.drop_blind;
126 data[7] = priv->mstats.tx_failed_cnt;
124 127
125 LEAVE(); 128 lbs_deb_enter(LBS_DEB_ETHTOOL);
126} 129}
127 130
128static int libertas_ethtool_get_stats_count(struct net_device * dev) 131static 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)
131 wlan_private *priv = dev->priv; 134 wlan_private *priv = dev->priv;
132 struct cmd_ds_mesh_access mesh_access; 135 struct cmd_ds_mesh_access mesh_access;
133 136
134 ENTER(); 137 lbs_deb_enter(LBS_DEB_ETHTOOL);
138
135 /* Get Mesh Statistics */ 139 /* Get Mesh Statistics */
136 ret = libertas_prepare_and_send_command(priv, 140 ret = libertas_prepare_and_send_command(priv,
137 cmd_mesh_access, cmd_act_mesh_get_stats, 141 cmd_mesh_access, cmd_act_mesh_get_stats,
138 cmd_option_waitforrsp, 0, &mesh_access); 142 cmd_option_waitforrsp, 0, &mesh_access);
139 143
140 if (ret) { 144 if (ret) {
141 LEAVE(); 145 ret = 0;
142 return 0; 146 goto done;
143 } 147 }
144 148
145 priv->mstats.fwd_drop_rbt = mesh_access.data[0]; 149 priv->mstats.fwd_drop_rbt = le32_to_cpu(mesh_access.data[0]);
146 priv->mstats.fwd_drop_ttl = mesh_access.data[1]; 150 priv->mstats.fwd_drop_ttl = le32_to_cpu(mesh_access.data[1]);
147 priv->mstats.fwd_drop_noroute = mesh_access.data[2]; 151 priv->mstats.fwd_drop_noroute = le32_to_cpu(mesh_access.data[2]);
148 priv->mstats.fwd_drop_nobuf = mesh_access.data[3]; 152 priv->mstats.fwd_drop_nobuf = le32_to_cpu(mesh_access.data[3]);
149 priv->mstats.fwd_unicast_cnt = mesh_access.data[4]; 153 priv->mstats.fwd_unicast_cnt = le32_to_cpu(mesh_access.data[4]);
150 priv->mstats.fwd_bcast_cnt = mesh_access.data[5]; 154 priv->mstats.fwd_bcast_cnt = le32_to_cpu(mesh_access.data[5]);
151 priv->mstats.drop_blind = mesh_access.data[6]; 155 priv->mstats.drop_blind = le32_to_cpu(mesh_access.data[6]);
156 priv->mstats.tx_failed_cnt = le32_to_cpu(mesh_access.data[7]);
152 157
153 LEAVE(); 158 ret = MESH_STATS_NUM;
154 return MESH_STATS_NUM; 159
160done:
161 lbs_deb_enter_args(LBS_DEB_ETHTOOL, "ret %d", ret);
162 return ret;
155} 163}
156 164
157static void libertas_ethtool_get_strings (struct net_device * dev, 165static void libertas_ethtool_get_strings (struct net_device * dev,
@@ -160,7 +168,8 @@ static void libertas_ethtool_get_strings (struct net_device * dev,
160{ 168{
161 int i; 169 int i;
162 170
163 ENTER(); 171 lbs_deb_enter(LBS_DEB_ETHTOOL);
172
164 switch (stringset) { 173 switch (stringset) {
165 case ETH_SS_STATS: 174 case ETH_SS_STATS:
166 for (i=0; i < MESH_STATS_NUM; i++) { 175 for (i=0; i < MESH_STATS_NUM; i++) {
@@ -170,7 +179,7 @@ static void libertas_ethtool_get_strings (struct net_device * dev,
170 } 179 }
171 break; 180 break;
172 } 181 }
173 LEAVE(); 182 lbs_deb_enter(LBS_DEB_ETHTOOL);
174} 183}
175 184
176struct ethtool_ops libertas_ethtool_ops = { 185struct ethtool_ops libertas_ethtool_ops = {
diff --git a/drivers/net/wireless/libertas/fw.c b/drivers/net/wireless/libertas/fw.c
index 5c63c9b1659c..2dc84ff7a54a 100644
--- a/drivers/net/wireless/libertas/fw.c
+++ b/drivers/net/wireless/libertas/fw.c
@@ -1,28 +1,15 @@
1/** 1/**
2 * This file contains the initialization for FW and HW 2 * This file contains the initialization for FW and HW
3 */ 3 */
4#include <linux/module.h>
5#include <linux/moduleparam.h>
6
7#include <linux/vmalloc.h>
8#include <linux/firmware.h> 4#include <linux/firmware.h>
9#include <linux/version.h>
10 5
11#include "host.h" 6#include "host.h"
12#include "sbi.h"
13#include "defs.h" 7#include "defs.h"
14#include "decl.h" 8#include "decl.h"
15#include "dev.h" 9#include "dev.h"
16#include "fw.h"
17#include "wext.h" 10#include "wext.h"
18#include "if_usb.h" 11#include "if_usb.h"
19 12
20char *libertas_fw_name = NULL;
21module_param_named(fw_name, libertas_fw_name, charp, 0644);
22
23unsigned int libertas_debug = 0;
24module_param(libertas_debug, int, 0);
25
26/** 13/**
27 * @brief This function checks the validity of Boot2/FW image. 14 * @brief This function checks the validity of Boot2/FW image.
28 * 15 *
@@ -32,7 +19,7 @@ module_param(libertas_debug, int, 0);
32 */ 19 */
33static int check_fwfile_format(u8 *data, u32 totlen) 20static int check_fwfile_format(u8 *data, u32 totlen)
34{ 21{
35 u8 bincmd, exit; 22 u32 bincmd, exit;
36 u32 blksize, offset, len; 23 u32 blksize, offset, len;
37 int ret; 24 int ret;
38 25
@@ -40,8 +27,10 @@ static int check_fwfile_format(u8 *data, u32 totlen)
40 exit = len = 0; 27 exit = len = 0;
41 28
42 do { 29 do {
43 bincmd = *data; 30 struct fwheader *fwh = (void *)data;
44 blksize = *(u32*)(data + offsetof(struct fwheader, datalength)); 31
32 bincmd = le32_to_cpu(fwh->dnldcmd);
33 blksize = le32_to_cpu(fwh->datalength);
45 switch (bincmd) { 34 switch (bincmd) {
46 case FW_HAS_DATA_TO_RECV: 35 case FW_HAS_DATA_TO_RECV:
47 offset = sizeof(struct fwheader) + blksize; 36 offset = sizeof(struct fwheader) + blksize;
@@ -61,9 +50,9 @@ static int check_fwfile_format(u8 *data, u32 totlen)
61 } while (!exit); 50 } while (!exit);
62 51
63 if (ret) 52 if (ret)
64 lbs_pr_err("bin file format check FAIL...\n"); 53 lbs_pr_err("firmware file format check FAIL\n");
65 else 54 else
66 lbs_pr_debug(1, "bin file format check PASS...\n"); 55 lbs_deb_fw("firmware file format check PASS\n");
67 56
68 return ret; 57 return ret;
69} 58}
@@ -76,32 +65,31 @@ static int check_fwfile_format(u8 *data, u32 totlen)
76 * @param priv A pointer to wlan_private structure 65 * @param priv A pointer to wlan_private structure
77 * @return 0 or -1 66 * @return 0 or -1
78 */ 67 */
79static int wlan_setup_station_hw(wlan_private * priv) 68static int wlan_setup_station_hw(wlan_private * priv, char *fw_name)
80{ 69{
81 int ret = -1; 70 int ret = -1;
82 wlan_adapter *adapter = priv->adapter; 71 wlan_adapter *adapter = priv->adapter;
83 72
84 ENTER(); 73 lbs_deb_enter(LBS_DEB_FW);
85 74
86 if ((ret = request_firmware(&priv->firmware, libertas_fw_name, 75 if ((ret = request_firmware(&priv->firmware, fw_name,
87 priv->hotplug_device)) < 0) { 76 priv->hotplug_device)) < 0) {
88 lbs_pr_err("request_firmware() failed, error code = %#x\n", 77 lbs_pr_err("request_firmware() failed with %#x\n", ret);
89 ret); 78 lbs_pr_err("firmware %s not found\n", fw_name);
90 lbs_pr_err("%s not found in /lib/firmware\n", libertas_fw_name);
91 goto done; 79 goto done;
92 } 80 }
93 81
94 if(check_fwfile_format(priv->firmware->data, priv->firmware->size)) { 82 if (check_fwfile_format(priv->firmware->data, priv->firmware->size)) {
95 release_firmware(priv->firmware); 83 release_firmware(priv->firmware);
96 goto done; 84 goto done;
97 } 85 }
98 86
99 ret = libertas_sbi_prog_firmware(priv); 87 ret = priv->hw_prog_firmware(priv);
100 88
101 release_firmware(priv->firmware); 89 release_firmware(priv->firmware);
102 90
103 if (ret) { 91 if (ret) {
104 lbs_pr_debug(1, "Bootloader in invalid state!\n"); 92 lbs_deb_fw("bootloader in invalid state\n");
105 ret = -1; 93 ret = -1;
106 goto done; 94 goto done;
107 } 95 }
@@ -133,28 +121,24 @@ static int wlan_setup_station_hw(wlan_private * priv)
133 121
134 ret = 0; 122 ret = 0;
135done: 123done:
136 LEAVE(); 124 lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret);
137 125 return ret;
138 return (ret);
139} 126}
140 127
141static int wlan_allocate_adapter(wlan_private * priv) 128static int wlan_allocate_adapter(wlan_private * priv)
142{ 129{
143 u32 ulbufsize; 130 size_t bufsize;
144 wlan_adapter *adapter = priv->adapter; 131 wlan_adapter *adapter = priv->adapter;
145 132
146 struct bss_descriptor *ptempscantable;
147
148 /* Allocate buffer to store the BSSID list */ 133 /* Allocate buffer to store the BSSID list */
149 ulbufsize = sizeof(struct bss_descriptor) * MRVDRV_MAX_BSSID_LIST; 134 bufsize = MAX_NETWORK_COUNT * sizeof(struct bss_descriptor);
150 if (!(ptempscantable = kmalloc(ulbufsize, GFP_KERNEL))) { 135 adapter->networks = kzalloc(bufsize, GFP_KERNEL);
136 if (!adapter->networks) {
137 lbs_pr_err("Out of memory allocating beacons\n");
151 libertas_free_adapter(priv); 138 libertas_free_adapter(priv);
152 return -1; 139 return -ENOMEM;
153 } 140 }
154 141
155 adapter->scantable = ptempscantable;
156 memset(adapter->scantable, 0, ulbufsize);
157
158 /* Allocate the command buffers */ 142 /* Allocate the command buffers */
159 libertas_allocate_cmd_buffer(priv); 143 libertas_allocate_cmd_buffer(priv);
160 144
@@ -202,15 +186,23 @@ static void wlan_init_adapter(wlan_private * priv)
202 adapter->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; 186 adapter->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
203 adapter->mode = IW_MODE_INFRA; 187 adapter->mode = IW_MODE_INFRA;
204 188
205 adapter->assoc_req = NULL; 189 adapter->pending_assoc_req = NULL;
190 adapter->in_progress_assoc_req = NULL;
191
192 /* Initialize scan result lists */
193 INIT_LIST_HEAD(&adapter->network_free_list);
194 INIT_LIST_HEAD(&adapter->network_list);
195 for (i = 0; i < MAX_NETWORK_COUNT; i++) {
196 list_add_tail(&adapter->networks[i].list,
197 &adapter->network_free_list);
198 }
206 199
207 adapter->numinscantable = 0;
208 adapter->pattemptedbssdesc = NULL;
209 mutex_init(&adapter->lock); 200 mutex_init(&adapter->lock);
210 201
211 adapter->prescan = 1; 202 adapter->prescan = 1;
212 203
213 memset(&adapter->curbssparams, 0, sizeof(adapter->curbssparams)); 204 memset(&adapter->curbssparams, 0, sizeof(adapter->curbssparams));
205 adapter->curbssparams.channel = DEFAULT_AD_HOC_CHANNEL;
214 206
215 /* PnP and power profile */ 207 /* PnP and power profile */
216 adapter->surpriseremoved = 0; 208 adapter->surpriseremoved = 0;
@@ -230,8 +222,6 @@ static void wlan_init_adapter(wlan_private * priv)
230 memset(&adapter->capinfo, 0, sizeof(adapter->capinfo)); 222 memset(&adapter->capinfo, 0, sizeof(adapter->capinfo));
231 adapter->capinfo.shortpreamble = SHORT_PREAMBLE_ALLOWED; 223 adapter->capinfo.shortpreamble = SHORT_PREAMBLE_ALLOWED;
232 224
233 adapter->adhocchannel = DEFAULT_AD_HOC_CHANNEL;
234
235 adapter->psmode = wlan802_11powermodecam; 225 adapter->psmode = wlan802_11powermodecam;
236 adapter->multipledtim = MRVDRV_DEFAULT_MULTIPLE_DTIM; 226 adapter->multipledtim = MRVDRV_DEFAULT_MULTIPLE_DTIM;
237 227
@@ -259,12 +249,12 @@ static void wlan_init_adapter(wlan_private * priv)
259 249
260static void command_timer_fn(unsigned long data); 250static void command_timer_fn(unsigned long data);
261 251
262int libertas_init_fw(wlan_private * priv) 252int libertas_init_fw(wlan_private * priv, char *fw_name)
263{ 253{
264 int ret = -1; 254 int ret = -1;
265 wlan_adapter *adapter = priv->adapter; 255 wlan_adapter *adapter = priv->adapter;
266 256
267 ENTER(); 257 lbs_deb_enter(LBS_DEB_FW);
268 258
269 /* Allocate adapter structure */ 259 /* Allocate adapter structure */
270 if ((ret = wlan_allocate_adapter(priv)) != 0) 260 if ((ret = wlan_allocate_adapter(priv)) != 0)
@@ -278,7 +268,7 @@ int libertas_init_fw(wlan_private * priv)
278 (unsigned long)priv); 268 (unsigned long)priv);
279 269
280 /* download fimrware etc. */ 270 /* download fimrware etc. */
281 if ((ret = wlan_setup_station_hw(priv)) != 0) { 271 if ((ret = wlan_setup_station_hw(priv, fw_name)) != 0) {
282 del_timer_sync(&adapter->command_timer); 272 del_timer_sync(&adapter->command_timer);
283 goto done; 273 goto done;
284 } 274 }
@@ -288,7 +278,7 @@ int libertas_init_fw(wlan_private * priv)
288 278
289 ret = 0; 279 ret = 0;
290done: 280done:
291 LEAVE(); 281 lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret);
292 return ret; 282 return ret;
293} 283}
294 284
@@ -297,25 +287,22 @@ void libertas_free_adapter(wlan_private * priv)
297 wlan_adapter *adapter = priv->adapter; 287 wlan_adapter *adapter = priv->adapter;
298 288
299 if (!adapter) { 289 if (!adapter) {
300 lbs_pr_debug(1, "Why double free adapter?:)\n"); 290 lbs_deb_fw("why double free adapter?\n");
301 return; 291 return;
302 } 292 }
303 293
304 lbs_pr_debug(1, "Free command buffer\n"); 294 lbs_deb_fw("free command buffer\n");
305 libertas_free_cmd_buffer(priv); 295 libertas_free_cmd_buffer(priv);
306 296
307 lbs_pr_debug(1, "Free commandTimer\n"); 297 lbs_deb_fw("free command_timer\n");
308 del_timer(&adapter->command_timer); 298 del_timer(&adapter->command_timer);
309 299
310 lbs_pr_debug(1, "Free scantable\n"); 300 lbs_deb_fw("free scan results table\n");
311 if (adapter->scantable) { 301 kfree(adapter->networks);
312 kfree(adapter->scantable); 302 adapter->networks = NULL;
313 adapter->scantable = NULL;
314 }
315
316 lbs_pr_debug(1, "Free adapter\n");
317 303
318 /* Free the adapter object itself */ 304 /* Free the adapter object itself */
305 lbs_deb_fw("free adapter\n");
319 kfree(adapter); 306 kfree(adapter);
320 priv->adapter = NULL; 307 priv->adapter = NULL;
321} 308}
@@ -334,17 +321,17 @@ static void command_timer_fn(unsigned long data)
334 321
335 ptempnode = adapter->cur_cmd; 322 ptempnode = adapter->cur_cmd;
336 if (ptempnode == NULL) { 323 if (ptempnode == NULL) {
337 lbs_pr_debug(1, "PTempnode Empty\n"); 324 lbs_deb_fw("ptempnode empty\n");
338 return; 325 return;
339 } 326 }
340 327
341 cmd = (struct cmd_ds_command *)ptempnode->bufvirtualaddr; 328 cmd = (struct cmd_ds_command *)ptempnode->bufvirtualaddr;
342 if (!cmd) { 329 if (!cmd) {
343 lbs_pr_debug(1, "cmd is NULL\n"); 330 lbs_deb_fw("cmd is NULL\n");
344 return; 331 return;
345 } 332 }
346 333
347 lbs_pr_info("command_timer_fn fired (%x)\n", cmd->command); 334 lbs_deb_fw("command_timer_fn fired, cmd %x\n", cmd->command);
348 335
349 if (!adapter->fw_ready) 336 if (!adapter->fw_ready)
350 return; 337 return;
@@ -353,7 +340,7 @@ static void command_timer_fn(unsigned long data)
353 adapter->cur_cmd = NULL; 340 adapter->cur_cmd = NULL;
354 spin_unlock_irqrestore(&adapter->driver_lock, flags); 341 spin_unlock_irqrestore(&adapter->driver_lock, flags);
355 342
356 lbs_pr_debug(1, "Re-sending same command as it timeout...!\n"); 343 lbs_deb_fw("re-sending same command because of timeout\n");
357 libertas_queue_cmd(adapter, ptempnode, 0); 344 libertas_queue_cmd(adapter, ptempnode, 0);
358 345
359 wake_up_interruptible(&priv->mainthread.waitq); 346 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
index 1f9ae267a9e0..000000000000
--- a/drivers/net/wireless/libertas/fw.h
+++ /dev/null
@@ -1,13 +0,0 @@
1/**
2 * This header file contains FW interface related definitions.
3 */
4#ifndef _WLAN_FW_H_
5#define _WLAN_FW_H_
6
7#ifndef DEV_NAME_LEN
8#define DEV_NAME_LEN 32
9#endif
10
11int libertas_init_fw(wlan_private * priv);
12
13#endif /* _WLAN_FW_H_ */
diff --git a/drivers/net/wireless/libertas/host.h b/drivers/net/wireless/libertas/host.h
index c0faaecaf5be..7509cc10af3c 100644
--- a/drivers/net/wireless/libertas/host.h
+++ b/drivers/net/wireless/libertas/host.h
@@ -99,11 +99,11 @@
99#define cmd_bt_access 0x0087 99#define cmd_bt_access 0x0087
100#define cmd_ret_bt_access 0x8087 100#define cmd_ret_bt_access 0x8087
101 101
102#define cmd_fwt_access 0x0088 102#define cmd_fwt_access 0x0095
103#define cmd_ret_fwt_access 0x8088 103#define cmd_ret_fwt_access 0x8095
104 104
105#define cmd_mesh_access 0x0090 105#define cmd_mesh_access 0x009b
106#define cmd_ret_mesh_access 0x8090 106#define cmd_ret_mesh_access 0x809b
107 107
108/* For the IEEE Power Save */ 108/* For the IEEE Power Save */
109#define cmd_subcmd_enter_ps 0x0030 109#define cmd_subcmd_enter_ps 0x0030
@@ -287,7 +287,9 @@ enum cmd_bt_access_opts {
287 cmd_act_bt_access_add = 5, 287 cmd_act_bt_access_add = 5,
288 cmd_act_bt_access_del, 288 cmd_act_bt_access_del,
289 cmd_act_bt_access_list, 289 cmd_act_bt_access_list,
290 cmd_act_bt_access_reset 290 cmd_act_bt_access_reset,
291 cmd_act_bt_access_set_invert,
292 cmd_act_bt_access_get_invert
291}; 293};
292 294
293/* Define action or option for cmd_fwt_access */ 295/* Define action or option for cmd_fwt_access */
@@ -308,8 +310,8 @@ enum cmd_mesh_access_opts {
308 cmd_act_mesh_get_ttl = 1, 310 cmd_act_mesh_get_ttl = 1,
309 cmd_act_mesh_set_ttl, 311 cmd_act_mesh_set_ttl,
310 cmd_act_mesh_get_stats, 312 cmd_act_mesh_get_stats,
311 cmd_act_mesh_get_mpp, 313 cmd_act_mesh_get_anycast,
312 cmd_act_mesh_set_mpp, 314 cmd_act_mesh_set_anycast,
313}; 315};
314 316
315/** Card Event definition */ 317/** Card Event definition */
@@ -334,5 +336,6 @@ enum cmd_mesh_access_opts {
334#define MACREG_INT_CODE_MAX_FAIL 0x0000001b 336#define MACREG_INT_CODE_MAX_FAIL 0x0000001b
335#define MACREG_INT_CODE_RSSI_HIGH 0x0000001c 337#define MACREG_INT_CODE_RSSI_HIGH 0x0000001c
336#define MACREG_INT_CODE_SNR_HIGH 0x0000001d 338#define MACREG_INT_CODE_SNR_HIGH 0x0000001d
339#define MACREG_INT_CODE_MESH_AUTO_STARTED 0x00000023
337 340
338#endif /* _HOST_H_ */ 341#endif /* _HOST_H_ */
diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h
index f239e5d2435b..3acf93988125 100644
--- a/drivers/net/wireless/libertas/hostcmd.h
+++ b/drivers/net/wireless/libertas/hostcmd.h
@@ -14,12 +14,12 @@
14/* TxPD descriptor */ 14/* TxPD descriptor */
15struct txpd { 15struct txpd {
16 /* Current Tx packet status */ 16 /* Current Tx packet status */
17 u32 tx_status; 17 __le32 tx_status;
18 /* Tx control */ 18 /* Tx control */
19 u32 tx_control; 19 __le32 tx_control;
20 u32 tx_packet_location; 20 __le32 tx_packet_location;
21 /* Tx packet length */ 21 /* Tx packet length */
22 u16 tx_packet_length; 22 __le16 tx_packet_length;
23 /* First 2 byte of destination MAC address */ 23 /* First 2 byte of destination MAC address */
24 u8 tx_dest_addr_high[2]; 24 u8 tx_dest_addr_high[2];
25 /* Last 4 byte of destination MAC address */ 25 /* Last 4 byte of destination MAC address */
@@ -37,7 +37,7 @@ struct txpd {
37/* RxPD Descriptor */ 37/* RxPD Descriptor */
38struct rxpd { 38struct rxpd {
39 /* Current Rx packet status */ 39 /* Current Rx packet status */
40 u16 status; 40 __le16 status;
41 41
42 /* SNR */ 42 /* SNR */
43 u8 snr; 43 u8 snr;
@@ -46,7 +46,7 @@ struct rxpd {
46 u8 rx_control; 46 u8 rx_control;
47 47
48 /* Pkt length */ 48 /* Pkt length */
49 u16 pkt_len; 49 __le16 pkt_len;
50 50
51 /* Noise Floor */ 51 /* Noise Floor */
52 u8 nf; 52 u8 nf;
@@ -55,10 +55,10 @@ struct rxpd {
55 u8 rx_rate; 55 u8 rx_rate;
56 56
57 /* Pkt addr */ 57 /* Pkt addr */
58 u32 pkt_ptr; 58 __le32 pkt_ptr;
59 59
60 /* Next Rx RxPD addr */ 60 /* Next Rx RxPD addr */
61 u32 next_rxpd_ptr; 61 __le32 next_rxpd_ptr;
62 62
63 /* Pkt Priority */ 63 /* Pkt Priority */
64 u8 priority; 64 u8 priority;
@@ -89,30 +89,17 @@ struct cmd_ctrl_node {
89 * is determined from the keylength field. 89 * is determined from the keylength field.
90 */ 90 */
91struct WLAN_802_11_KEY { 91struct WLAN_802_11_KEY {
92 u32 len; 92 __le32 len;
93 u32 flags; /* KEY_INFO_* from wlan_defs.h */ 93 __le32 flags; /* KEY_INFO_* from wlan_defs.h */
94 u8 key[MRVL_MAX_KEY_WPA_KEY_LENGTH]; 94 u8 key[MRVL_MAX_KEY_WPA_KEY_LENGTH];
95 u16 type; /* KEY_TYPE_* from wlan_defs.h */ 95 __le16 type; /* KEY_TYPE_* from wlan_defs.h */
96}; 96};
97 97
98struct IE_WPA { 98struct IE_WPA {
99 u8 elementid; 99 u8 elementid;
100 u8 len; 100 u8 len;
101 u8 oui[4]; 101 u8 oui[4];
102 u16 version; 102 __le16 version;
103};
104
105struct WLAN_802_11_SSID {
106 /* SSID length */
107 u32 ssidlength;
108
109 /* SSID information field */
110 u8 ssid[IW_ESSID_MAX_SIZE];
111};
112
113struct WPA_SUPPLICANT {
114 u8 wpa_ie[256];
115 u8 wpa_ie_len;
116}; 103};
117 104
118/* wlan_offset_value */ 105/* wlan_offset_value */
@@ -122,9 +109,9 @@ struct wlan_offset_value {
122}; 109};
123 110
124struct WLAN_802_11_FIXED_IEs { 111struct WLAN_802_11_FIXED_IEs {
125 u8 timestamp[8]; 112 __le64 timestamp;
126 u16 beaconinterval; 113 __le16 beaconinterval;
127 u16 capabilities; 114 u16 capabilities; /* Actually struct ieeetypes_capinfo */
128}; 115};
129 116
130struct WLAN_802_11_VARIABLE_IEs { 117struct WLAN_802_11_VARIABLE_IEs {
@@ -136,10 +123,10 @@ struct WLAN_802_11_VARIABLE_IEs {
136/* Define general data structure */ 123/* Define general data structure */
137/* cmd_DS_GEN */ 124/* cmd_DS_GEN */
138struct cmd_ds_gen { 125struct cmd_ds_gen {
139 u16 command; 126 __le16 command;
140 u16 size; 127 __le16 size;
141 u16 seqnum; 128 __le16 seqnum;
142 u16 result; 129 __le16 result;
143}; 130};
144 131
145#define S_DS_GEN sizeof(struct cmd_ds_gen) 132#define S_DS_GEN sizeof(struct cmd_ds_gen)
@@ -149,44 +136,44 @@ struct cmd_ds_gen {
149 */ 136 */
150struct cmd_ds_get_hw_spec { 137struct cmd_ds_get_hw_spec {
151 /* HW Interface version number */ 138 /* HW Interface version number */
152 u16 hwifversion; 139 __le16 hwifversion;
153 /* HW version number */ 140 /* HW version number */
154 u16 version; 141 __le16 version;
155 /* Max number of TxPD FW can handle */ 142 /* Max number of TxPD FW can handle */
156 u16 nr_txpd; 143 __le16 nr_txpd;
157 /* Max no of Multicast address */ 144 /* Max no of Multicast address */
158 u16 nr_mcast_adr; 145 __le16 nr_mcast_adr;
159 /* MAC address */ 146 /* MAC address */
160 u8 permanentaddr[6]; 147 u8 permanentaddr[6];
161 148
162 /* region Code */ 149 /* region Code */
163 u16 regioncode; 150 __le16 regioncode;
164 151
165 /* Number of antenna used */ 152 /* Number of antenna used */
166 u16 nr_antenna; 153 __le16 nr_antenna;
167 154
168 /* FW release number, example 0x1234=1.2.3.4 */ 155 /* FW release number, example 1,2,3,4 = 3.2.1p4 */
169 u32 fwreleasenumber; 156 u8 fwreleasenumber[4];
170 157
171 /* Base Address of TxPD queue */ 158 /* Base Address of TxPD queue */
172 u32 wcb_base; 159 __le32 wcb_base;
173 /* Read Pointer of RxPd queue */ 160 /* Read Pointer of RxPd queue */
174 u32 rxpd_rdptr; 161 __le32 rxpd_rdptr;
175 162
176 /* Write Pointer of RxPd queue */ 163 /* Write Pointer of RxPd queue */
177 u32 rxpd_wrptr; 164 __le32 rxpd_wrptr;
178 165
179 /*FW/HW capability */ 166 /*FW/HW capability */
180 u32 fwcapinfo; 167 __le32 fwcapinfo;
181} __attribute__ ((packed)); 168} __attribute__ ((packed));
182 169
183struct cmd_ds_802_11_reset { 170struct cmd_ds_802_11_reset {
184 u16 action; 171 __le16 action;
185}; 172};
186 173
187struct cmd_ds_802_11_subscribe_event { 174struct cmd_ds_802_11_subscribe_event {
188 u16 action; 175 __le16 action;
189 u16 events; 176 __le16 events;
190}; 177};
191 178
192/* 179/*
@@ -205,35 +192,35 @@ struct cmd_ds_802_11_scan {
205}; 192};
206 193
207struct cmd_ds_802_11_scan_rsp { 194struct cmd_ds_802_11_scan_rsp {
208 u16 bssdescriptsize; 195 __le16 bssdescriptsize;
209 u8 nr_sets; 196 u8 nr_sets;
210 u8 bssdesc_and_tlvbuffer[1]; 197 u8 bssdesc_and_tlvbuffer[1];
211}; 198};
212 199
213struct cmd_ds_802_11_get_log { 200struct cmd_ds_802_11_get_log {
214 u32 mcasttxframe; 201 __le32 mcasttxframe;
215 u32 failed; 202 __le32 failed;
216 u32 retry; 203 __le32 retry;
217 u32 multiretry; 204 __le32 multiretry;
218 u32 framedup; 205 __le32 framedup;
219 u32 rtssuccess; 206 __le32 rtssuccess;
220 u32 rtsfailure; 207 __le32 rtsfailure;
221 u32 ackfailure; 208 __le32 ackfailure;
222 u32 rxfrag; 209 __le32 rxfrag;
223 u32 mcastrxframe; 210 __le32 mcastrxframe;
224 u32 fcserror; 211 __le32 fcserror;
225 u32 txframe; 212 __le32 txframe;
226 u32 wepundecryptable; 213 __le32 wepundecryptable;
227}; 214};
228 215
229struct cmd_ds_mac_control { 216struct cmd_ds_mac_control {
230 u16 action; 217 __le16 action;
231 u16 reserved; 218 __le16 reserved;
232}; 219};
233 220
234struct cmd_ds_mac_multicast_adr { 221struct cmd_ds_mac_multicast_adr {
235 u16 action; 222 __le16 action;
236 u16 nr_of_adrs; 223 __le16 nr_of_adrs;
237 u8 maclist[ETH_ALEN * MRVDRV_MAX_MULTICAST_LIST_SIZE]; 224 u8 maclist[ETH_ALEN * MRVDRV_MAX_MULTICAST_LIST_SIZE];
238}; 225};
239 226
@@ -245,14 +232,14 @@ struct cmd_ds_802_11_authenticate {
245 232
246struct cmd_ds_802_11_deauthenticate { 233struct cmd_ds_802_11_deauthenticate {
247 u8 macaddr[6]; 234 u8 macaddr[6];
248 u16 reasoncode; 235 __le16 reasoncode;
249}; 236};
250 237
251struct cmd_ds_802_11_associate { 238struct cmd_ds_802_11_associate {
252 u8 peerstaaddr[6]; 239 u8 peerstaaddr[6];
253 struct ieeetypes_capinfo capinfo; 240 struct ieeetypes_capinfo capinfo;
254 u16 listeninterval; 241 __le16 listeninterval;
255 u16 bcnperiod; 242 __le16 bcnperiod;
256 u8 dtimperiod; 243 u8 dtimperiod;
257 244
258#if 0 245#if 0
@@ -265,7 +252,7 @@ struct cmd_ds_802_11_associate {
265 252
266struct cmd_ds_802_11_disassociate { 253struct cmd_ds_802_11_disassociate {
267 u8 destmacaddr[6]; 254 u8 destmacaddr[6];
268 u16 reasoncode; 255 __le16 reasoncode;
269}; 256};
270 257
271struct cmd_ds_802_11_associate_rsp { 258struct cmd_ds_802_11_associate_rsp {
@@ -279,10 +266,10 @@ struct cmd_ds_802_11_ad_hoc_result {
279 266
280struct cmd_ds_802_11_set_wep { 267struct cmd_ds_802_11_set_wep {
281 /* ACT_ADD, ACT_REMOVE or ACT_ENABLE */ 268 /* ACT_ADD, ACT_REMOVE or ACT_ENABLE */
282 u16 action; 269 __le16 action;
283 270
284 /* key Index selected for Tx */ 271 /* key Index selected for Tx */
285 u16 keyindex; 272 __le16 keyindex;
286 273
287 /* 40, 128bit or TXWEP */ 274 /* 40, 128bit or TXWEP */
288 u8 keytype[4]; 275 u8 keytype[4];
@@ -290,96 +277,96 @@ struct cmd_ds_802_11_set_wep {
290}; 277};
291 278
292struct cmd_ds_802_3_get_stat { 279struct cmd_ds_802_3_get_stat {
293 u32 xmitok; 280 __le32 xmitok;
294 u32 rcvok; 281 __le32 rcvok;
295 u32 xmiterror; 282 __le32 xmiterror;
296 u32 rcverror; 283 __le32 rcverror;
297 u32 rcvnobuffer; 284 __le32 rcvnobuffer;
298 u32 rcvcrcerror; 285 __le32 rcvcrcerror;
299}; 286};
300 287
301struct cmd_ds_802_11_get_stat { 288struct cmd_ds_802_11_get_stat {
302 u32 txfragmentcnt; 289 __le32 txfragmentcnt;
303 u32 mcasttxframecnt; 290 __le32 mcasttxframecnt;
304 u32 failedcnt; 291 __le32 failedcnt;
305 u32 retrycnt; 292 __le32 retrycnt;
306 u32 Multipleretrycnt; 293 __le32 Multipleretrycnt;
307 u32 rtssuccesscnt; 294 __le32 rtssuccesscnt;
308 u32 rtsfailurecnt; 295 __le32 rtsfailurecnt;
309 u32 ackfailurecnt; 296 __le32 ackfailurecnt;
310 u32 frameduplicatecnt; 297 __le32 frameduplicatecnt;
311 u32 rxfragmentcnt; 298 __le32 rxfragmentcnt;
312 u32 mcastrxframecnt; 299 __le32 mcastrxframecnt;
313 u32 fcserrorcnt; 300 __le32 fcserrorcnt;
314 u32 bcasttxframecnt; 301 __le32 bcasttxframecnt;
315 u32 bcastrxframecnt; 302 __le32 bcastrxframecnt;
316 u32 txbeacon; 303 __le32 txbeacon;
317 u32 rxbeacon; 304 __le32 rxbeacon;
318 u32 wepundecryptable; 305 __le32 wepundecryptable;
319}; 306};
320 307
321struct cmd_ds_802_11_snmp_mib { 308struct cmd_ds_802_11_snmp_mib {
322 u16 querytype; 309 __le16 querytype;
323 u16 oid; 310 __le16 oid;
324 u16 bufsize; 311 __le16 bufsize;
325 u8 value[128]; 312 u8 value[128];
326}; 313};
327 314
328struct cmd_ds_mac_reg_map { 315struct cmd_ds_mac_reg_map {
329 u16 buffersize; 316 __le16 buffersize;
330 u8 regmap[128]; 317 u8 regmap[128];
331 u16 reserved; 318 __le16 reserved;
332}; 319};
333 320
334struct cmd_ds_bbp_reg_map { 321struct cmd_ds_bbp_reg_map {
335 u16 buffersize; 322 __le16 buffersize;
336 u8 regmap[128]; 323 u8 regmap[128];
337 u16 reserved; 324 __le16 reserved;
338}; 325};
339 326
340struct cmd_ds_rf_reg_map { 327struct cmd_ds_rf_reg_map {
341 u16 buffersize; 328 __le16 buffersize;
342 u8 regmap[64]; 329 u8 regmap[64];
343 u16 reserved; 330 __le16 reserved;
344}; 331};
345 332
346struct cmd_ds_mac_reg_access { 333struct cmd_ds_mac_reg_access {
347 u16 action; 334 __le16 action;
348 u16 offset; 335 __le16 offset;
349 u32 value; 336 __le32 value;
350}; 337};
351 338
352struct cmd_ds_bbp_reg_access { 339struct cmd_ds_bbp_reg_access {
353 u16 action; 340 __le16 action;
354 u16 offset; 341 __le16 offset;
355 u8 value; 342 u8 value;
356 u8 reserved[3]; 343 u8 reserved[3];
357}; 344};
358 345
359struct cmd_ds_rf_reg_access { 346struct cmd_ds_rf_reg_access {
360 u16 action; 347 __le16 action;
361 u16 offset; 348 __le16 offset;
362 u8 value; 349 u8 value;
363 u8 reserved[3]; 350 u8 reserved[3];
364}; 351};
365 352
366struct cmd_ds_802_11_radio_control { 353struct cmd_ds_802_11_radio_control {
367 u16 action; 354 __le16 action;
368 u16 control; 355 __le16 control;
369}; 356};
370 357
371struct cmd_ds_802_11_sleep_params { 358struct cmd_ds_802_11_sleep_params {
372 /* ACT_GET/ACT_SET */ 359 /* ACT_GET/ACT_SET */
373 u16 action; 360 __le16 action;
374 361
375 /* Sleep clock error in ppm */ 362 /* Sleep clock error in ppm */
376 u16 error; 363 __le16 error;
377 364
378 /* Wakeup offset in usec */ 365 /* Wakeup offset in usec */
379 u16 offset; 366 __le16 offset;
380 367
381 /* Clock stabilization time in usec */ 368 /* Clock stabilization time in usec */
382 u16 stabletime; 369 __le16 stabletime;
383 370
384 /* control periodic calibration */ 371 /* control periodic calibration */
385 u8 calcontrol; 372 u8 calcontrol;
@@ -388,100 +375,100 @@ struct cmd_ds_802_11_sleep_params {
388 u8 externalsleepclk; 375 u8 externalsleepclk;
389 376
390 /* reserved field, should be set to zero */ 377 /* reserved field, should be set to zero */
391 u16 reserved; 378 __le16 reserved;
392}; 379};
393 380
394struct cmd_ds_802_11_inactivity_timeout { 381struct cmd_ds_802_11_inactivity_timeout {
395 /* ACT_GET/ACT_SET */ 382 /* ACT_GET/ACT_SET */
396 u16 action; 383 __le16 action;
397 384
398 /* Inactivity timeout in msec */ 385 /* Inactivity timeout in msec */
399 u16 timeout; 386 __le16 timeout;
400}; 387};
401 388
402struct cmd_ds_802_11_rf_channel { 389struct cmd_ds_802_11_rf_channel {
403 u16 action; 390 __le16 action;
404 u16 currentchannel; 391 __le16 currentchannel;
405 u16 rftype; 392 __le16 rftype;
406 u16 reserved; 393 __le16 reserved;
407 u8 channellist[32]; 394 u8 channellist[32];
408}; 395};
409 396
410struct cmd_ds_802_11_rssi { 397struct cmd_ds_802_11_rssi {
411 /* weighting factor */ 398 /* weighting factor */
412 u16 N; 399 __le16 N;
413 400
414 u16 reserved_0; 401 __le16 reserved_0;
415 u16 reserved_1; 402 __le16 reserved_1;
416 u16 reserved_2; 403 __le16 reserved_2;
417}; 404};
418 405
419struct cmd_ds_802_11_rssi_rsp { 406struct cmd_ds_802_11_rssi_rsp {
420 u16 SNR; 407 __le16 SNR;
421 u16 noisefloor; 408 __le16 noisefloor;
422 u16 avgSNR; 409 __le16 avgSNR;
423 u16 avgnoisefloor; 410 __le16 avgnoisefloor;
424}; 411};
425 412
426struct cmd_ds_802_11_mac_address { 413struct cmd_ds_802_11_mac_address {
427 u16 action; 414 __le16 action;
428 u8 macadd[ETH_ALEN]; 415 u8 macadd[ETH_ALEN];
429}; 416};
430 417
431struct cmd_ds_802_11_rf_tx_power { 418struct cmd_ds_802_11_rf_tx_power {
432 u16 action; 419 __le16 action;
433 u16 currentlevel; 420 __le16 currentlevel;
434}; 421};
435 422
436struct cmd_ds_802_11_rf_antenna { 423struct cmd_ds_802_11_rf_antenna {
437 u16 action; 424 __le16 action;
438 425
439 /* Number of antennas or 0xffff(diversity) */ 426 /* Number of antennas or 0xffff(diversity) */
440 u16 antennamode; 427 __le16 antennamode;
441 428
442}; 429};
443 430
444struct cmd_ds_802_11_ps_mode { 431struct cmd_ds_802_11_ps_mode {
445 u16 action; 432 __le16 action;
446 u16 nullpktinterval; 433 __le16 nullpktinterval;
447 u16 multipledtim; 434 __le16 multipledtim;
448 u16 reserved; 435 __le16 reserved;
449 u16 locallisteninterval; 436 __le16 locallisteninterval;
450}; 437};
451 438
452struct PS_CMD_ConfirmSleep { 439struct PS_CMD_ConfirmSleep {
453 u16 command; 440 __le16 command;
454 u16 size; 441 __le16 size;
455 u16 seqnum; 442 __le16 seqnum;
456 u16 result; 443 __le16 result;
457 444
458 u16 action; 445 __le16 action;
459 u16 reserved1; 446 __le16 reserved1;
460 u16 multipledtim; 447 __le16 multipledtim;
461 u16 reserved; 448 __le16 reserved;
462 u16 locallisteninterval; 449 __le16 locallisteninterval;
463}; 450};
464 451
465struct cmd_ds_802_11_data_rate { 452struct cmd_ds_802_11_data_rate {
466 u16 action; 453 __le16 action;
467 u16 reserverd; 454 __le16 reserverd;
468 u8 datarate[G_SUPPORTED_RATES]; 455 u8 datarate[G_SUPPORTED_RATES];
469}; 456};
470 457
471struct cmd_ds_802_11_rate_adapt_rateset { 458struct cmd_ds_802_11_rate_adapt_rateset {
472 u16 action; 459 __le16 action;
473 u16 enablehwauto; 460 __le16 enablehwauto;
474 u16 bitmap; 461 __le16 bitmap;
475}; 462};
476 463
477struct cmd_ds_802_11_ad_hoc_start { 464struct cmd_ds_802_11_ad_hoc_start {
478 u8 SSID[IW_ESSID_MAX_SIZE]; 465 u8 SSID[IW_ESSID_MAX_SIZE];
479 u8 bsstype; 466 u8 bsstype;
480 u16 beaconperiod; 467 __le16 beaconperiod;
481 u8 dtimperiod; 468 u8 dtimperiod;
482 union IEEEtypes_ssparamset ssparamset; 469 union IEEEtypes_ssparamset ssparamset;
483 union ieeetypes_phyparamset phyparamset; 470 union ieeetypes_phyparamset phyparamset;
484 u16 probedelay; 471 __le16 probedelay;
485 struct ieeetypes_capinfo cap; 472 struct ieeetypes_capinfo cap;
486 u8 datarate[G_SUPPORTED_RATES]; 473 u8 datarate[G_SUPPORTED_RATES];
487 u8 tlv_memory_size_pad[100]; 474 u8 tlv_memory_size_pad[100];
@@ -491,10 +478,10 @@ struct adhoc_bssdesc {
491 u8 BSSID[6]; 478 u8 BSSID[6];
492 u8 SSID[32]; 479 u8 SSID[32];
493 u8 bsstype; 480 u8 bsstype;
494 u16 beaconperiod; 481 __le16 beaconperiod;
495 u8 dtimperiod; 482 u8 dtimperiod;
496 u8 timestamp[8]; 483 __le64 timestamp;
497 u8 localtime[8]; 484 __le64 localtime;
498 union ieeetypes_phyparamset phyparamset; 485 union ieeetypes_phyparamset phyparamset;
499 union IEEEtypes_ssparamset ssparamset; 486 union IEEEtypes_ssparamset ssparamset;
500 struct ieeetypes_capinfo cap; 487 struct ieeetypes_capinfo cap;
@@ -508,52 +495,52 @@ struct adhoc_bssdesc {
508 495
509struct cmd_ds_802_11_ad_hoc_join { 496struct cmd_ds_802_11_ad_hoc_join {
510 struct adhoc_bssdesc bssdescriptor; 497 struct adhoc_bssdesc bssdescriptor;
511 u16 failtimeout; 498 __le16 failtimeout;
512 u16 probedelay; 499 __le16 probedelay;
513 500
514} __attribute__ ((packed)); 501} __attribute__ ((packed));
515 502
516struct cmd_ds_802_11_enable_rsn { 503struct cmd_ds_802_11_enable_rsn {
517 u16 action; 504 __le16 action;
518 u16 enable; 505 __le16 enable;
519}; 506};
520 507
521struct MrvlIEtype_keyParamSet { 508struct MrvlIEtype_keyParamSet {
522 /* type ID */ 509 /* type ID */
523 u16 type; 510 __le16 type;
524 511
525 /* length of Payload */ 512 /* length of Payload */
526 u16 length; 513 __le16 length;
527 514
528 /* type of key: WEP=0, TKIP=1, AES=2 */ 515 /* type of key: WEP=0, TKIP=1, AES=2 */
529 u16 keytypeid; 516 __le16 keytypeid;
530 517
531 /* key control Info specific to a keytypeid */ 518 /* key control Info specific to a keytypeid */
532 u16 keyinfo; 519 __le16 keyinfo;
533 520
534 /* length of key */ 521 /* length of key */
535 u16 keylen; 522 __le16 keylen;
536 523
537 /* key material of size keylen */ 524 /* key material of size keylen */
538 u8 key[32]; 525 u8 key[32];
539}; 526};
540 527
541struct cmd_ds_802_11_key_material { 528struct cmd_ds_802_11_key_material {
542 u16 action; 529 __le16 action;
543 struct MrvlIEtype_keyParamSet keyParamSet[2]; 530 struct MrvlIEtype_keyParamSet keyParamSet[2];
544} __attribute__ ((packed)); 531} __attribute__ ((packed));
545 532
546struct cmd_ds_802_11_eeprom_access { 533struct cmd_ds_802_11_eeprom_access {
547 u16 action; 534 __le16 action;
548 535
549 /* multiple 4 */ 536 /* multiple 4 */
550 u16 offset; 537 __le16 offset;
551 u16 bytecount; 538 __le16 bytecount;
552 u8 value; 539 u8 value;
553} __attribute__ ((packed)); 540} __attribute__ ((packed));
554 541
555struct cmd_ds_802_11_tpc_cfg { 542struct cmd_ds_802_11_tpc_cfg {
556 u16 action; 543 __le16 action;
557 u8 enable; 544 u8 enable;
558 s8 P0; 545 s8 P0;
559 s8 P1; 546 s8 P1;
@@ -562,13 +549,13 @@ struct cmd_ds_802_11_tpc_cfg {
562} __attribute__ ((packed)); 549} __attribute__ ((packed));
563 550
564struct cmd_ds_802_11_led_ctrl { 551struct cmd_ds_802_11_led_ctrl {
565 u16 action; 552 __le16 action;
566 u16 numled; 553 __le16 numled;
567 u8 data[256]; 554 u8 data[256];
568} __attribute__ ((packed)); 555} __attribute__ ((packed));
569 556
570struct cmd_ds_802_11_pwr_cfg { 557struct cmd_ds_802_11_pwr_cfg {
571 u16 action; 558 __le16 action;
572 u8 enable; 559 u8 enable;
573 s8 PA_P0; 560 s8 PA_P0;
574 s8 PA_P1; 561 s8 PA_P1;
@@ -576,21 +563,21 @@ struct cmd_ds_802_11_pwr_cfg {
576} __attribute__ ((packed)); 563} __attribute__ ((packed));
577 564
578struct cmd_ds_802_11_afc { 565struct cmd_ds_802_11_afc {
579 u16 afc_auto; 566 __le16 afc_auto;
580 union { 567 union {
581 struct { 568 struct {
582 u16 threshold; 569 __le16 threshold;
583 u16 period; 570 __le16 period;
584 }; 571 };
585 struct { 572 struct {
586 s16 timing_offset; 573 __le16 timing_offset; /* signed */
587 s16 carrier_offset; 574 __le16 carrier_offset; /* signed */
588 }; 575 };
589 }; 576 };
590} __attribute__ ((packed)); 577} __attribute__ ((packed));
591 578
592struct cmd_tx_rate_query { 579struct cmd_tx_rate_query {
593 u16 txrate; 580 __le16 txrate;
594} __attribute__ ((packed)); 581} __attribute__ ((packed));
595 582
596struct cmd_ds_get_tsf { 583struct cmd_ds_get_tsf {
@@ -598,41 +585,46 @@ struct cmd_ds_get_tsf {
598} __attribute__ ((packed)); 585} __attribute__ ((packed));
599 586
600struct cmd_ds_bt_access { 587struct cmd_ds_bt_access {
601 u16 action; 588 __le16 action;
602 u32 id; 589 __le32 id;
603 u8 addr1[ETH_ALEN]; 590 u8 addr1[ETH_ALEN];
604 u8 addr2[ETH_ALEN]; 591 u8 addr2[ETH_ALEN];
605} __attribute__ ((packed)); 592} __attribute__ ((packed));
606 593
607struct cmd_ds_fwt_access { 594struct cmd_ds_fwt_access {
608 u16 action; 595 __le16 action;
609 u32 id; 596 __le32 id;
597 u8 valid;
610 u8 da[ETH_ALEN]; 598 u8 da[ETH_ALEN];
611 u8 dir; 599 u8 dir;
612 u8 ra[ETH_ALEN]; 600 u8 ra[ETH_ALEN];
613 u32 ssn; 601 __le32 ssn;
614 u32 dsn; 602 __le32 dsn;
615 u32 metric; 603 __le32 metric;
604 u8 rate;
616 u8 hopcount; 605 u8 hopcount;
617 u8 ttl; 606 u8 ttl;
618 u32 expiration; 607 __le32 expiration;
619 u8 sleepmode; 608 u8 sleepmode;
620 u32 snr; 609 __le32 snr;
621 u32 references; 610 __le32 references;
611 u8 prec[ETH_ALEN];
622} __attribute__ ((packed)); 612} __attribute__ ((packed));
623 613
624#define MESH_STATS_NUM 7
625struct cmd_ds_mesh_access { 614struct cmd_ds_mesh_access {
626 u16 action; 615 __le16 action;
627 u32 data[MESH_STATS_NUM + 1]; /* last position reserved */ 616 __le32 data[32]; /* last position reserved */
628} __attribute__ ((packed)); 617} __attribute__ ((packed));
629 618
619/* Number of stats counters returned by the firmware */
620#define MESH_STATS_NUM 8
621
630struct cmd_ds_command { 622struct cmd_ds_command {
631 /* command header */ 623 /* command header */
632 u16 command; 624 __le16 command;
633 u16 size; 625 __le16 size;
634 u16 seqnum; 626 __le16 seqnum;
635 u16 result; 627 __le16 result;
636 628
637 /* command Body */ 629 /* command Body */
638 union { 630 union {
diff --git a/drivers/net/wireless/libertas/if_bootcmd.c b/drivers/net/wireless/libertas/if_bootcmd.c
index 567000c3e87b..8bca306ffad9 100644
--- a/drivers/net/wireless/libertas/if_bootcmd.c
+++ b/drivers/net/wireless/libertas/if_bootcmd.c
@@ -8,6 +8,8 @@
8#include <linux/netdevice.h> 8#include <linux/netdevice.h>
9#include <linux/usb.h> 9#include <linux/usb.h>
10 10
11#define DRV_NAME "usb8xxx"
12
11#include "defs.h" 13#include "defs.h"
12#include "dev.h" 14#include "dev.h"
13#include "if_usb.h" 15#include "if_usb.h"
@@ -20,12 +22,12 @@
20 */ 22 */
21int if_usb_issue_boot_command(wlan_private *priv, int ivalue) 23int if_usb_issue_boot_command(wlan_private *priv, int ivalue)
22{ 24{
23 struct usb_card_rec *cardp = priv->wlan_dev.card; 25 struct usb_card_rec *cardp = priv->card;
24 struct bootcmdstr sbootcmd; 26 struct bootcmdstr sbootcmd;
25 int i; 27 int i;
26 28
27 /* Prepare command */ 29 /* Prepare command */
28 sbootcmd.u32magicnumber = BOOT_CMD_MAGIC_NUMBER; 30 sbootcmd.u32magicnumber = cpu_to_le32(BOOT_CMD_MAGIC_NUMBER);
29 sbootcmd.u8cmd_tag = ivalue; 31 sbootcmd.u8cmd_tag = ivalue;
30 for (i=0; i<11; i++) 32 for (i=0; i<11; i++)
31 sbootcmd.au8dumy[i]=0x00; 33 sbootcmd.au8dumy[i]=0x00;
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index ae6f72a6cdf3..998317571ec2 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -2,12 +2,15 @@
2 * This file contains functions used in USB interface module. 2 * This file contains functions used in USB interface module.
3 */ 3 */
4#include <linux/delay.h> 4#include <linux/delay.h>
5#include <linux/moduleparam.h>
5#include <linux/firmware.h> 6#include <linux/firmware.h>
6#include <linux/netdevice.h> 7#include <linux/netdevice.h>
8#include <linux/list.h>
7#include <linux/usb.h> 9#include <linux/usb.h>
8 10
11#define DRV_NAME "usb8xxx"
12
9#include "host.h" 13#include "host.h"
10#include "sbi.h"
11#include "decl.h" 14#include "decl.h"
12#include "defs.h" 15#include "defs.h"
13#include "dev.h" 16#include "dev.h"
@@ -16,15 +19,24 @@
16#define MESSAGE_HEADER_LEN 4 19#define MESSAGE_HEADER_LEN 4
17 20
18static const char usbdriver_name[] = "usb8xxx"; 21static const char usbdriver_name[] = "usb8xxx";
22static u8 *default_fw_name = "usb8388.bin";
23
24char *libertas_fw_name = NULL;
25module_param_named(fw_name, libertas_fw_name, charp, 0644);
26
27/*
28 * We need to send a RESET command to all USB devices before
29 * we tear down the USB connection. Otherwise we would not
30 * be able to re-init device the device if the module gets
31 * loaded again. This is a list of all initialized USB devices,
32 * for the reset code see if_usb_reset_device()
33*/
34static LIST_HEAD(usb_devices);
19 35
20static struct usb_device_id if_usb_table[] = { 36static struct usb_device_id if_usb_table[] = {
21 /* Enter the device signature inside */ 37 /* Enter the device signature inside */
22 { 38 { USB_DEVICE(0x1286, 0x2001) },
23 USB_DEVICE(USB8388_VID_1, USB8388_PID_1), 39 { USB_DEVICE(0x05a3, 0x8388) },
24 },
25 {
26 USB_DEVICE(USB8388_VID_2, USB8388_PID_2),
27 },
28 {} /* Terminating entry */ 40 {} /* Terminating entry */
29}; 41};
30 42
@@ -32,6 +44,13 @@ MODULE_DEVICE_TABLE(usb, if_usb_table);
32 44
33static void if_usb_receive(struct urb *urb); 45static void if_usb_receive(struct urb *urb);
34static void if_usb_receive_fwload(struct urb *urb); 46static void if_usb_receive_fwload(struct urb *urb);
47static int if_usb_reset_device(wlan_private *priv);
48static int if_usb_register_dev(wlan_private * priv);
49static int if_usb_unregister_dev(wlan_private *);
50static int if_usb_prog_firmware(wlan_private *);
51static int if_usb_host_to_card(wlan_private * priv, u8 type, u8 * payload, u16 nb);
52static int if_usb_get_int_status(wlan_private * priv, u8 *);
53static int if_usb_read_event_cause(wlan_private *);
35 54
36/** 55/**
37 * @brief call back function to handle the status of the URB 56 * @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)
42{ 61{
43 wlan_private *priv = (wlan_private *) (urb->context); 62 wlan_private *priv = (wlan_private *) (urb->context);
44 wlan_adapter *adapter = priv->adapter; 63 wlan_adapter *adapter = priv->adapter;
45 struct net_device *dev = priv->wlan_dev.netdev; 64 struct net_device *dev = priv->dev;
46 65
47 /* handle the transmission complete validations */ 66 /* handle the transmission complete validations */
48 67
49 if (urb->status != 0) { 68 if (urb->status != 0) {
50 /* print the failure status number for debug */ 69 /* print the failure status number for debug */
51 lbs_pr_info("URB in failure status\n"); 70 lbs_pr_info("URB in failure status: %d\n", urb->status);
52 } else { 71 } else {
53 lbs_dev_dbg(2, &urb->dev->dev, "URB status is successfull\n"); 72 /*
54 lbs_dev_dbg(2, &urb->dev->dev, "Actual length transmitted %d\n", 73 lbs_deb_usbd(&urb->dev->dev, "URB status is successfull\n");
74 lbs_deb_usbd(&urb->dev->dev, "Actual length transmitted %d\n",
55 urb->actual_length); 75 urb->actual_length);
56 priv->wlan_dev.dnld_sent = DNLD_RES_RECEIVED; 76 */
77 priv->dnld_sent = DNLD_RES_RECEIVED;
57 /* Wake main thread if commands are pending */ 78 /* Wake main thread if commands are pending */
58 if (!adapter->cur_cmd) 79 if (!adapter->cur_cmd)
59 wake_up_interruptible(&priv->mainthread.waitq); 80 wake_up_interruptible(&priv->mainthread.waitq);
60 if ((adapter->connect_status == libertas_connected)) 81 if ((adapter->connect_status == libertas_connected)) {
61 netif_wake_queue(dev); 82 netif_wake_queue(dev);
83 netif_wake_queue(priv->mesh_dev);
84 }
62 } 85 }
63 86
64 return; 87 return;
@@ -71,7 +94,7 @@ static void if_usb_write_bulk_callback(struct urb *urb)
71 */ 94 */
72void if_usb_free(struct usb_card_rec *cardp) 95void if_usb_free(struct usb_card_rec *cardp)
73{ 96{
74 ENTER(); 97 lbs_deb_enter(LBS_DEB_USB);
75 98
76 /* Unlink tx & rx urb */ 99 /* Unlink tx & rx urb */
77 usb_kill_urb(cardp->tx_urb); 100 usb_kill_urb(cardp->tx_urb);
@@ -86,8 +109,7 @@ void if_usb_free(struct usb_card_rec *cardp)
86 kfree(cardp->bulk_out_buffer); 109 kfree(cardp->bulk_out_buffer);
87 cardp->bulk_out_buffer = NULL; 110 cardp->bulk_out_buffer = NULL;
88 111
89 LEAVE(); 112 lbs_deb_leave(LBS_DEB_USB);
90 return;
91} 113}
92 114
93/** 115/**
@@ -102,27 +124,27 @@ static int if_usb_probe(struct usb_interface *intf,
102 struct usb_device *udev; 124 struct usb_device *udev;
103 struct usb_host_interface *iface_desc; 125 struct usb_host_interface *iface_desc;
104 struct usb_endpoint_descriptor *endpoint; 126 struct usb_endpoint_descriptor *endpoint;
105 wlan_private *pwlanpriv; 127 wlan_private *priv;
106 struct usb_card_rec *usb_cardp; 128 struct usb_card_rec *cardp;
107 int i; 129 int i;
108 130
109 udev = interface_to_usbdev(intf); 131 udev = interface_to_usbdev(intf);
110 132
111 usb_cardp = kzalloc(sizeof(struct usb_card_rec), GFP_KERNEL); 133 cardp = kzalloc(sizeof(struct usb_card_rec), GFP_KERNEL);
112 if (!usb_cardp) { 134 if (!cardp) {
113 lbs_pr_err("Out of memory allocating private data.\n"); 135 lbs_pr_err("Out of memory allocating private data.\n");
114 goto error; 136 goto error;
115 } 137 }
116 138
117 usb_cardp->udev = udev; 139 cardp->udev = udev;
118 iface_desc = intf->cur_altsetting; 140 iface_desc = intf->cur_altsetting;
119 141
120 lbs_dev_dbg(1, &udev->dev, "bcdUSB = 0x%X bDeviceClass = 0x%X" 142 lbs_deb_usbd(&udev->dev, "bcdUSB = 0x%X bDeviceClass = 0x%X"
121 " bDeviceSubClass = 0x%X, bDeviceProtocol = 0x%X\n", 143 " bDeviceSubClass = 0x%X, bDeviceProtocol = 0x%X\n",
122 udev->descriptor.bcdUSB, 144 le16_to_cpu(udev->descriptor.bcdUSB),
123 udev->descriptor.bDeviceClass, 145 udev->descriptor.bDeviceClass,
124 udev->descriptor.bDeviceSubClass, 146 udev->descriptor.bDeviceSubClass,
125 udev->descriptor.bDeviceProtocol); 147 udev->descriptor.bDeviceProtocol);
126 148
127 for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { 149 for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
128 endpoint = &iface_desc->endpoint[i].desc; 150 endpoint = &iface_desc->endpoint[i].desc;
@@ -130,23 +152,21 @@ static int if_usb_probe(struct usb_interface *intf,
130 && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == 152 && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
131 USB_ENDPOINT_XFER_BULK)) { 153 USB_ENDPOINT_XFER_BULK)) {
132 /* we found a bulk in endpoint */ 154 /* we found a bulk in endpoint */
133 lbs_dev_dbg(1, &udev->dev, "Bulk in size is %d\n", 155 lbs_deb_usbd(&udev->dev, "Bulk in size is %d\n",
134 endpoint->wMaxPacketSize); 156 le16_to_cpu(endpoint->wMaxPacketSize));
135 if (! 157 if (!(cardp->rx_urb = usb_alloc_urb(0, GFP_KERNEL))) {
136 (usb_cardp->rx_urb = 158 lbs_deb_usbd(&udev->dev,
137 usb_alloc_urb(0, GFP_KERNEL))) {
138 lbs_dev_dbg(1, &udev->dev,
139 "Rx URB allocation failed\n"); 159 "Rx URB allocation failed\n");
140 goto dealloc; 160 goto dealloc;
141 } 161 }
142 usb_cardp->rx_urb_recall = 0; 162 cardp->rx_urb_recall = 0;
143 163
144 usb_cardp->bulk_in_size = 164 cardp->bulk_in_size =
145 endpoint->wMaxPacketSize; 165 le16_to_cpu(endpoint->wMaxPacketSize);
146 usb_cardp->bulk_in_endpointAddr = 166 cardp->bulk_in_endpointAddr =
147 (endpoint-> 167 (endpoint->
148 bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); 168 bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
149 lbs_dev_dbg(1, &udev->dev, "in_endpoint = %d\n", 169 lbs_deb_usbd(&udev->dev, "in_endpoint = %d\n",
150 endpoint->bEndpointAddress); 170 endpoint->bEndpointAddress);
151 } 171 }
152 172
@@ -156,55 +176,63 @@ static int if_usb_probe(struct usb_interface *intf,
156 && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == 176 && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
157 USB_ENDPOINT_XFER_BULK)) { 177 USB_ENDPOINT_XFER_BULK)) {
158 /* We found bulk out endpoint */ 178 /* We found bulk out endpoint */
159 if (! 179 if (!(cardp->tx_urb = usb_alloc_urb(0, GFP_KERNEL))) {
160 (usb_cardp->tx_urb = 180 lbs_deb_usbd(&udev->dev,
161 usb_alloc_urb(0, GFP_KERNEL))) {
162 lbs_dev_dbg(1,&udev->dev,
163 "Tx URB allocation failed\n"); 181 "Tx URB allocation failed\n");
164 goto dealloc; 182 goto dealloc;
165 } 183 }
166 184
167 usb_cardp->bulk_out_size = 185 cardp->bulk_out_size =
168 endpoint->wMaxPacketSize; 186 le16_to_cpu(endpoint->wMaxPacketSize);
169 lbs_dev_dbg(1, &udev->dev, 187 lbs_deb_usbd(&udev->dev,
170 "Bulk out size is %d\n", 188 "Bulk out size is %d\n",
171 endpoint->wMaxPacketSize); 189 le16_to_cpu(endpoint->wMaxPacketSize));
172 usb_cardp->bulk_out_endpointAddr = 190 cardp->bulk_out_endpointAddr =
173 endpoint->bEndpointAddress; 191 endpoint->bEndpointAddress;
174 lbs_dev_dbg(1, &udev->dev, "out_endpoint = %d\n", 192 lbs_deb_usbd(&udev->dev, "out_endpoint = %d\n",
175 endpoint->bEndpointAddress); 193 endpoint->bEndpointAddress);
176 usb_cardp->bulk_out_buffer = 194 cardp->bulk_out_buffer =
177 kmalloc(MRVDRV_ETH_TX_PACKET_BUFFER_SIZE, 195 kmalloc(MRVDRV_ETH_TX_PACKET_BUFFER_SIZE,
178 GFP_KERNEL); 196 GFP_KERNEL);
179 197
180 if (!usb_cardp->bulk_out_buffer) { 198 if (!cardp->bulk_out_buffer) {
181 lbs_dev_dbg(1, &udev->dev, 199 lbs_deb_usbd(&udev->dev,
182 "Could not allocate buffer\n"); 200 "Could not allocate buffer\n");
183 goto dealloc; 201 goto dealloc;
184 } 202 }
185 } 203 }
186 } 204 }
187 205
188 206 if (!(priv = libertas_add_card(cardp, &udev->dev)))
189 /* At this point wlan_add_card() will be called. Don't worry
190 * about keeping pwlanpriv around since it will be set on our
191 * usb device data in -> add() -> libertas_sbi_register_dev().
192 */
193 if (!(pwlanpriv = wlan_add_card(usb_cardp)))
194 goto dealloc; 207 goto dealloc;
195 208
209 if (libertas_add_mesh(priv, &udev->dev))
210 goto err_add_mesh;
211
212 priv->hw_register_dev = if_usb_register_dev;
213 priv->hw_unregister_dev = if_usb_unregister_dev;
214 priv->hw_prog_firmware = if_usb_prog_firmware;
215 priv->hw_host_to_card = if_usb_host_to_card;
216 priv->hw_get_int_status = if_usb_get_int_status;
217 priv->hw_read_event_cause = if_usb_read_event_cause;
218
219 if (libertas_activate_card(priv, libertas_fw_name))
220 goto err_activate_card;
221
222 list_add_tail(&cardp->list, &usb_devices);
223
196 usb_get_dev(udev); 224 usb_get_dev(udev);
197 usb_set_intfdata(intf, usb_cardp); 225 usb_set_intfdata(intf, cardp);
198 226
199 /*
200 * return card structure, which can be got back in the
201 * diconnect function as the ptr
202 * argument.
203 */
204 return 0; 227 return 0;
205 228
229err_activate_card:
230 libertas_remove_mesh(priv);
231err_add_mesh:
232 free_netdev(priv->dev);
233 kfree(priv->adapter);
206dealloc: 234dealloc:
207 if_usb_free(usb_cardp); 235 if_usb_free(cardp);
208 236
209error: 237error:
210 return -ENOMEM; 238 return -ENOMEM;
@@ -212,8 +240,7 @@ error:
212 240
213/** 241/**
214 * @brief free resource and cleanup 242 * @brief free resource and cleanup
215 * @param udev pointer to usb_device 243 * @param intf USB interface structure
216 * @param ptr pointer to usb_cardp
217 * @return N/A 244 * @return N/A
218 */ 245 */
219static void if_usb_disconnect(struct usb_interface *intf) 246static void if_usb_disconnect(struct usb_interface *intf)
@@ -229,9 +256,12 @@ static void if_usb_disconnect(struct usb_interface *intf)
229 */ 256 */
230 adapter->surpriseremoved = 1; 257 adapter->surpriseremoved = 1;
231 258
259 list_del(&cardp->list);
260
232 /* card is removed and we can call wlan_remove_card */ 261 /* card is removed and we can call wlan_remove_card */
233 lbs_dev_dbg(1, &cardp->udev->dev, "call remove card\n"); 262 lbs_deb_usbd(&cardp->udev->dev, "call remove card\n");
234 wlan_remove_card(cardp); 263 libertas_remove_mesh(priv);
264 libertas_remove_card(priv);
235 265
236 /* Unlink and free urb */ 266 /* Unlink and free urb */
237 if_usb_free(cardp); 267 if_usb_free(cardp);
@@ -249,7 +279,7 @@ static void if_usb_disconnect(struct usb_interface *intf)
249 */ 279 */
250static int if_prog_firmware(wlan_private * priv) 280static int if_prog_firmware(wlan_private * priv)
251{ 281{
252 struct usb_card_rec *cardp = priv->wlan_dev.card; 282 struct usb_card_rec *cardp = priv->card;
253 struct FWData *fwdata; 283 struct FWData *fwdata;
254 struct fwheader *fwheader; 284 struct fwheader *fwheader;
255 u8 *firmware = priv->firmware->data; 285 u8 *firmware = priv->firmware->data;
@@ -266,8 +296,10 @@ static int if_prog_firmware(wlan_private * priv)
266 cardp->fwseqnum = cardp->lastseqnum - 1; 296 cardp->fwseqnum = cardp->lastseqnum - 1;
267 } 297 }
268 298
269 lbs_dev_dbg(2, &cardp->udev->dev, "totalbytes = %d\n", 299 /*
300 lbs_deb_usbd(&cardp->udev->dev, "totalbytes = %d\n",
270 cardp->totalbytes); 301 cardp->totalbytes);
302 */
271 303
272 memcpy(fwheader, &firmware[cardp->totalbytes], 304 memcpy(fwheader, &firmware[cardp->totalbytes],
273 sizeof(struct fwheader)); 305 sizeof(struct fwheader));
@@ -275,40 +307,48 @@ static int if_prog_firmware(wlan_private * priv)
275 cardp->fwlastblksent = cardp->totalbytes; 307 cardp->fwlastblksent = cardp->totalbytes;
276 cardp->totalbytes += sizeof(struct fwheader); 308 cardp->totalbytes += sizeof(struct fwheader);
277 309
278 lbs_dev_dbg(2, &cardp->udev->dev,"Copy Data\n"); 310 /* lbs_deb_usbd(&cardp->udev->dev,"Copy Data\n"); */
279 memcpy(fwdata->data, &firmware[cardp->totalbytes], 311 memcpy(fwdata->data, &firmware[cardp->totalbytes],
280 fwdata->fwheader.datalength); 312 le32_to_cpu(fwdata->fwheader.datalength));
281 313
282 lbs_dev_dbg(2, &cardp->udev->dev, 314 /*
283 "Data length = %d\n", fwdata->fwheader.datalength); 315 lbs_deb_usbd(&cardp->udev->dev,
316 "Data length = %d\n", le32_to_cpu(fwdata->fwheader.datalength));
317 */
284 318
285 cardp->fwseqnum = cardp->fwseqnum + 1; 319 cardp->fwseqnum = cardp->fwseqnum + 1;
286 320
287 fwdata->seqnum = cardp->fwseqnum; 321 fwdata->seqnum = cpu_to_le32(cardp->fwseqnum);
288 cardp->lastseqnum = fwdata->seqnum; 322 cardp->lastseqnum = cardp->fwseqnum;
289 cardp->totalbytes += fwdata->fwheader.datalength; 323 cardp->totalbytes += le32_to_cpu(fwdata->fwheader.datalength);
290 324
291 if (fwheader->dnldcmd == FW_HAS_DATA_TO_RECV) { 325 if (fwheader->dnldcmd == cpu_to_le32(FW_HAS_DATA_TO_RECV)) {
292 lbs_dev_dbg(2, &cardp->udev->dev, "There is data to follow\n"); 326 /*
293 lbs_dev_dbg(2, &cardp->udev->dev, 327 lbs_deb_usbd(&cardp->udev->dev, "There are data to follow\n");
328 lbs_deb_usbd(&cardp->udev->dev,
294 "seqnum = %d totalbytes = %d\n", cardp->fwseqnum, 329 "seqnum = %d totalbytes = %d\n", cardp->fwseqnum,
295 cardp->totalbytes); 330 cardp->totalbytes);
331 */
296 memcpy(cardp->bulk_out_buffer, fwheader, FW_DATA_XMIT_SIZE); 332 memcpy(cardp->bulk_out_buffer, fwheader, FW_DATA_XMIT_SIZE);
297 usb_tx_block(priv, cardp->bulk_out_buffer, FW_DATA_XMIT_SIZE); 333 usb_tx_block(priv, cardp->bulk_out_buffer, FW_DATA_XMIT_SIZE);
298 334
299 } else if (fwdata->fwheader.dnldcmd == FW_HAS_LAST_BLOCK) { 335 } else if (fwdata->fwheader.dnldcmd == cpu_to_le32(FW_HAS_LAST_BLOCK)) {
300 lbs_dev_dbg(2, &cardp->udev->dev, 336 /*
337 lbs_deb_usbd(&cardp->udev->dev,
301 "Host has finished FW downloading\n"); 338 "Host has finished FW downloading\n");
302 lbs_dev_dbg(2, &cardp->udev->dev, 339 lbs_deb_usbd(&cardp->udev->dev,
303 "Donwloading FW JUMP BLOCK\n"); 340 "Donwloading FW JUMP BLOCK\n");
341 */
304 memcpy(cardp->bulk_out_buffer, fwheader, FW_DATA_XMIT_SIZE); 342 memcpy(cardp->bulk_out_buffer, fwheader, FW_DATA_XMIT_SIZE);
305 usb_tx_block(priv, cardp->bulk_out_buffer, FW_DATA_XMIT_SIZE); 343 usb_tx_block(priv, cardp->bulk_out_buffer, FW_DATA_XMIT_SIZE);
306 cardp->fwfinalblk = 1; 344 cardp->fwfinalblk = 1;
307 } 345 }
308 346
309 lbs_dev_dbg(2, &cardp->udev->dev, 347 /*
348 lbs_deb_usbd(&cardp->udev->dev,
310 "The firmware download is done size is %d\n", 349 "The firmware download is done size is %d\n",
311 cardp->totalbytes); 350 cardp->totalbytes);
351 */
312 352
313 kfree(fwdata); 353 kfree(fwdata);
314 354
@@ -318,14 +358,19 @@ static int if_prog_firmware(wlan_private * priv)
318static int libertas_do_reset(wlan_private *priv) 358static int libertas_do_reset(wlan_private *priv)
319{ 359{
320 int ret; 360 int ret;
321 struct usb_card_rec *cardp = priv->wlan_dev.card; 361 struct usb_card_rec *cardp = priv->card;
362
363 lbs_deb_enter(LBS_DEB_USB);
322 364
323 ret = usb_reset_device(cardp->udev); 365 ret = usb_reset_device(cardp->udev);
324 if (!ret) { 366 if (!ret) {
325 msleep(10); 367 msleep(10);
326 reset_device(priv); 368 if_usb_reset_device(priv);
327 msleep(10); 369 msleep(10);
328 } 370 }
371
372 lbs_deb_leave_args(LBS_DEB_USB, "ret %d", ret);
373
329 return ret; 374 return ret;
330} 375}
331 376
@@ -339,12 +384,12 @@ static int libertas_do_reset(wlan_private *priv)
339int usb_tx_block(wlan_private * priv, u8 * payload, u16 nb) 384int usb_tx_block(wlan_private * priv, u8 * payload, u16 nb)
340{ 385{
341 /* pointer to card structure */ 386 /* pointer to card structure */
342 struct usb_card_rec *cardp = priv->wlan_dev.card; 387 struct usb_card_rec *cardp = priv->card;
343 int ret = -1; 388 int ret = -1;
344 389
345 /* check if device is removed */ 390 /* check if device is removed */
346 if (priv->adapter->surpriseremoved) { 391 if (priv->adapter->surpriseremoved) {
347 lbs_dev_dbg(1, &cardp->udev->dev, "Device removed\n"); 392 lbs_deb_usbd(&cardp->udev->dev, "Device removed\n");
348 goto tx_ret; 393 goto tx_ret;
349 } 394 }
350 395
@@ -357,10 +402,10 @@ int usb_tx_block(wlan_private * priv, u8 * payload, u16 nb)
357 402
358 if ((ret = usb_submit_urb(cardp->tx_urb, GFP_ATOMIC))) { 403 if ((ret = usb_submit_urb(cardp->tx_urb, GFP_ATOMIC))) {
359 /* transfer failed */ 404 /* transfer failed */
360 lbs_dev_dbg(1, &cardp->udev->dev, "usb_submit_urb failed\n"); 405 lbs_deb_usbd(&cardp->udev->dev, "usb_submit_urb failed\n");
361 ret = -1; 406 ret = -1;
362 } else { 407 } else {
363 lbs_dev_dbg(2, &cardp->udev->dev, "usb_submit_urb success\n"); 408 /* lbs_deb_usbd(&cardp->udev->dev, "usb_submit_urb success\n"); */
364 ret = 0; 409 ret = 0;
365 } 410 }
366 411
@@ -372,7 +417,7 @@ static int __if_usb_submit_rx_urb(wlan_private * priv,
372 void (*callbackfn) 417 void (*callbackfn)
373 (struct urb *urb)) 418 (struct urb *urb))
374{ 419{
375 struct usb_card_rec *cardp = priv->wlan_dev.card; 420 struct usb_card_rec *cardp = priv->card;
376 struct sk_buff *skb; 421 struct sk_buff *skb;
377 struct read_cb_info *rinfo = &cardp->rinfo; 422 struct read_cb_info *rinfo = &cardp->rinfo;
378 int ret = -1; 423 int ret = -1;
@@ -394,13 +439,13 @@ static int __if_usb_submit_rx_urb(wlan_private * priv,
394 439
395 cardp->rx_urb->transfer_flags |= URB_ZERO_PACKET; 440 cardp->rx_urb->transfer_flags |= URB_ZERO_PACKET;
396 441
397 lbs_dev_dbg(2, &cardp->udev->dev, "Pointer for rx_urb %p\n", cardp->rx_urb); 442 /* lbs_deb_usbd(&cardp->udev->dev, "Pointer for rx_urb %p\n", cardp->rx_urb); */
398 if ((ret = usb_submit_urb(cardp->rx_urb, GFP_ATOMIC))) { 443 if ((ret = usb_submit_urb(cardp->rx_urb, GFP_ATOMIC))) {
399 /* handle failure conditions */ 444 /* handle failure conditions */
400 lbs_dev_dbg(1, &cardp->udev->dev, "Submit Rx URB failed\n"); 445 lbs_deb_usbd(&cardp->udev->dev, "Submit Rx URB failed\n");
401 ret = -1; 446 ret = -1;
402 } else { 447 } else {
403 lbs_dev_dbg(2, &cardp->udev->dev, "Submit Rx URB success\n"); 448 /* lbs_deb_usbd(&cardp->udev->dev, "Submit Rx URB success\n"); */
404 ret = 0; 449 ret = 0;
405 } 450 }
406 451
@@ -423,12 +468,12 @@ static void if_usb_receive_fwload(struct urb *urb)
423 struct read_cb_info *rinfo = (struct read_cb_info *)urb->context; 468 struct read_cb_info *rinfo = (struct read_cb_info *)urb->context;
424 wlan_private *priv = rinfo->priv; 469 wlan_private *priv = rinfo->priv;
425 struct sk_buff *skb = rinfo->skb; 470 struct sk_buff *skb = rinfo->skb;
426 struct usb_card_rec *cardp = (struct usb_card_rec *)priv->wlan_dev.card; 471 struct usb_card_rec *cardp = (struct usb_card_rec *)priv->card;
427 struct fwsyncheader *syncfwheader; 472 struct fwsyncheader *syncfwheader;
428 struct bootcmdrespStr bootcmdresp; 473 struct bootcmdrespStr bootcmdresp;
429 474
430 if (urb->status) { 475 if (urb->status) {
431 lbs_dev_dbg(1, &cardp->udev->dev, 476 lbs_deb_usbd(&cardp->udev->dev,
432 "URB status is failed during fw load\n"); 477 "URB status is failed during fw load\n");
433 kfree_skb(skb); 478 kfree_skb(skb);
434 return; 479 return;
@@ -437,18 +482,18 @@ static void if_usb_receive_fwload(struct urb *urb)
437 if (cardp->bootcmdresp == 0) { 482 if (cardp->bootcmdresp == 0) {
438 memcpy (&bootcmdresp, skb->data + IPFIELD_ALIGN_OFFSET, 483 memcpy (&bootcmdresp, skb->data + IPFIELD_ALIGN_OFFSET,
439 sizeof(bootcmdresp)); 484 sizeof(bootcmdresp));
440 if (cardp->udev->descriptor.bcdDevice < 0x3106) { 485 if (le16_to_cpu(cardp->udev->descriptor.bcdDevice) < 0x3106) {
441 kfree_skb(skb); 486 kfree_skb(skb);
442 if_usb_submit_rx_urb_fwload(priv); 487 if_usb_submit_rx_urb_fwload(priv);
443 cardp->bootcmdresp = 1; 488 cardp->bootcmdresp = 1;
444 lbs_dev_dbg(1, &cardp->udev->dev, 489 lbs_deb_usbd(&cardp->udev->dev,
445 "Received valid boot command response\n"); 490 "Received valid boot command response\n");
446 return; 491 return;
447 } 492 }
448 if (bootcmdresp.u32magicnumber != BOOT_CMD_MAGIC_NUMBER) { 493 if (bootcmdresp.u32magicnumber != cpu_to_le32(BOOT_CMD_MAGIC_NUMBER)) {
449 lbs_pr_info( 494 lbs_pr_info(
450 "boot cmd response wrong magic number (0x%x)\n", 495 "boot cmd response wrong magic number (0x%x)\n",
451 bootcmdresp.u32magicnumber); 496 le32_to_cpu(bootcmdresp.u32magicnumber));
452 } else if (bootcmdresp.u8cmd_tag != BOOT_CMD_FW_BY_USB) { 497 } else if (bootcmdresp.u8cmd_tag != BOOT_CMD_FW_BY_USB) {
453 lbs_pr_info( 498 lbs_pr_info(
454 "boot cmd response cmd_tag error (%d)\n", 499 "boot cmd response cmd_tag error (%d)\n",
@@ -459,7 +504,7 @@ static void if_usb_receive_fwload(struct urb *urb)
459 bootcmdresp.u8result); 504 bootcmdresp.u8result);
460 } else { 505 } else {
461 cardp->bootcmdresp = 1; 506 cardp->bootcmdresp = 1;
462 lbs_dev_dbg(1, &cardp->udev->dev, 507 lbs_deb_usbd(&cardp->udev->dev,
463 "Received valid boot command response\n"); 508 "Received valid boot command response\n");
464 } 509 }
465 kfree_skb(skb); 510 kfree_skb(skb);
@@ -469,7 +514,7 @@ static void if_usb_receive_fwload(struct urb *urb)
469 514
470 syncfwheader = kmalloc(sizeof(struct fwsyncheader), GFP_ATOMIC); 515 syncfwheader = kmalloc(sizeof(struct fwsyncheader), GFP_ATOMIC);
471 if (!syncfwheader) { 516 if (!syncfwheader) {
472 lbs_dev_dbg(1, &cardp->udev->dev, "Failure to allocate syncfwheader\n"); 517 lbs_deb_usbd(&cardp->udev->dev, "Failure to allocate syncfwheader\n");
473 kfree_skb(skb); 518 kfree_skb(skb);
474 return; 519 return;
475 } 520 }
@@ -478,14 +523,16 @@ static void if_usb_receive_fwload(struct urb *urb)
478 sizeof(struct fwsyncheader)); 523 sizeof(struct fwsyncheader));
479 524
480 if (!syncfwheader->cmd) { 525 if (!syncfwheader->cmd) {
481 lbs_dev_dbg(2, &cardp->udev->dev, 526 /*
527 lbs_deb_usbd(&cardp->udev->dev,
482 "FW received Blk with correct CRC\n"); 528 "FW received Blk with correct CRC\n");
483 lbs_dev_dbg(2, &cardp->udev->dev, 529 lbs_deb_usbd(&cardp->udev->dev,
484 "FW received Blk seqnum = %d\n", 530 "FW received Blk seqnum = %d\n",
485 syncfwheader->seqnum); 531 syncfwheader->seqnum);
532 */
486 cardp->CRC_OK = 1; 533 cardp->CRC_OK = 1;
487 } else { 534 } else {
488 lbs_dev_dbg(1, &cardp->udev->dev, 535 lbs_deb_usbd(&cardp->udev->dev,
489 "FW received Blk with CRC error\n"); 536 "FW received Blk with CRC error\n");
490 cardp->CRC_OK = 0; 537 cardp->CRC_OK = 0;
491 } 538 }
@@ -515,7 +562,7 @@ static inline void process_cmdtypedata(int recvlength, struct sk_buff *skb,
515{ 562{
516 if (recvlength > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE + 563 if (recvlength > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE +
517 MESSAGE_HEADER_LEN || recvlength < MRVDRV_MIN_PKT_LEN) { 564 MESSAGE_HEADER_LEN || recvlength < MRVDRV_MIN_PKT_LEN) {
518 lbs_dev_dbg(1, &cardp->udev->dev, 565 lbs_deb_usbd(&cardp->udev->dev,
519 "Packet length is Invalid\n"); 566 "Packet length is Invalid\n");
520 kfree_skb(skb); 567 kfree_skb(skb);
521 return; 568 return;
@@ -525,7 +572,7 @@ static inline void process_cmdtypedata(int recvlength, struct sk_buff *skb,
525 skb_put(skb, recvlength); 572 skb_put(skb, recvlength);
526 skb_pull(skb, MESSAGE_HEADER_LEN); 573 skb_pull(skb, MESSAGE_HEADER_LEN);
527 libertas_process_rxed_packet(priv, skb); 574 libertas_process_rxed_packet(priv, skb);
528 priv->wlan_dev.upld_len = (recvlength - MESSAGE_HEADER_LEN); 575 priv->upld_len = (recvlength - MESSAGE_HEADER_LEN);
529} 576}
530 577
531static inline void process_cmdrequest(int recvlength, u8 *recvbuff, 578static inline void process_cmdrequest(int recvlength, u8 *recvbuff,
@@ -535,7 +582,7 @@ static inline void process_cmdrequest(int recvlength, u8 *recvbuff,
535{ 582{
536 u8 *cmdbuf; 583 u8 *cmdbuf;
537 if (recvlength > MRVDRV_SIZE_OF_CMD_BUFFER) { 584 if (recvlength > MRVDRV_SIZE_OF_CMD_BUFFER) {
538 lbs_dev_dbg(1, &cardp->udev->dev, 585 lbs_deb_usbd(&cardp->udev->dev,
539 "The receive buffer is too large\n"); 586 "The receive buffer is too large\n");
540 kfree_skb(skb); 587 kfree_skb(skb);
541 return; 588 return;
@@ -548,21 +595,21 @@ static inline void process_cmdrequest(int recvlength, u8 *recvbuff,
548 /* take care of cur_cmd = NULL case by reading the 595 /* take care of cur_cmd = NULL case by reading the
549 * data to clear the interrupt */ 596 * data to clear the interrupt */
550 if (!priv->adapter->cur_cmd) { 597 if (!priv->adapter->cur_cmd) {
551 cmdbuf = priv->wlan_dev.upld_buf; 598 cmdbuf = priv->upld_buf;
552 priv->adapter->hisregcpy &= ~his_cmdupldrdy; 599 priv->adapter->hisregcpy &= ~his_cmdupldrdy;
553 } else 600 } else
554 cmdbuf = priv->adapter->cur_cmd->bufvirtualaddr; 601 cmdbuf = priv->adapter->cur_cmd->bufvirtualaddr;
555 602
556 cardp->usb_int_cause |= his_cmdupldrdy; 603 cardp->usb_int_cause |= his_cmdupldrdy;
557 priv->wlan_dev.upld_len = (recvlength - MESSAGE_HEADER_LEN); 604 priv->upld_len = (recvlength - MESSAGE_HEADER_LEN);
558 memcpy(cmdbuf, recvbuff + MESSAGE_HEADER_LEN, 605 memcpy(cmdbuf, recvbuff + MESSAGE_HEADER_LEN,
559 priv->wlan_dev.upld_len); 606 priv->upld_len);
560 607
561 kfree_skb(skb); 608 kfree_skb(skb);
562 libertas_interrupt(priv->wlan_dev.netdev); 609 libertas_interrupt(priv->dev);
563 spin_unlock(&priv->adapter->driver_lock); 610 spin_unlock(&priv->adapter->driver_lock);
564 611
565 lbs_dev_dbg(1, &cardp->udev->dev, 612 lbs_deb_usbd(&cardp->udev->dev,
566 "Wake up main thread to handle cmd response\n"); 613 "Wake up main thread to handle cmd response\n");
567 614
568 return; 615 return;
@@ -580,17 +627,17 @@ static void if_usb_receive(struct urb *urb)
580 struct read_cb_info *rinfo = (struct read_cb_info *)urb->context; 627 struct read_cb_info *rinfo = (struct read_cb_info *)urb->context;
581 wlan_private *priv = rinfo->priv; 628 wlan_private *priv = rinfo->priv;
582 struct sk_buff *skb = rinfo->skb; 629 struct sk_buff *skb = rinfo->skb;
583 struct usb_card_rec *cardp = (struct usb_card_rec *)priv->wlan_dev.card; 630 struct usb_card_rec *cardp = (struct usb_card_rec *)priv->card;
584 631
585 int recvlength = urb->actual_length; 632 int recvlength = urb->actual_length;
586 u8 *recvbuff = NULL; 633 u8 *recvbuff = NULL;
587 u32 recvtype; 634 u32 recvtype;
588 635
589 ENTER(); 636 lbs_deb_enter(LBS_DEB_USB);
590 637
591 if (recvlength) { 638 if (recvlength) {
592 if (urb->status) { 639 if (urb->status) {
593 lbs_dev_dbg(1, &cardp->udev->dev, 640 lbs_deb_usbd(&cardp->udev->dev,
594 "URB status is failed\n"); 641 "URB status is failed\n");
595 kfree_skb(skb); 642 kfree_skb(skb);
596 goto setup_for_next; 643 goto setup_for_next;
@@ -598,12 +645,12 @@ static void if_usb_receive(struct urb *urb)
598 645
599 recvbuff = skb->data + IPFIELD_ALIGN_OFFSET; 646 recvbuff = skb->data + IPFIELD_ALIGN_OFFSET;
600 memcpy(&recvtype, recvbuff, sizeof(u32)); 647 memcpy(&recvtype, recvbuff, sizeof(u32));
601 lbs_dev_dbg(1, &cardp->udev->dev, 648 lbs_deb_usbd(&cardp->udev->dev,
602 "Recv length = 0x%x\n", recvlength); 649 "Recv length = 0x%x\n", recvlength);
603 lbs_dev_dbg(1, &cardp->udev->dev, 650 lbs_deb_usbd(&cardp->udev->dev,
604 "Receive type = 0x%X\n", recvtype); 651 "Receive type = 0x%X\n", recvtype);
605 recvtype = le32_to_cpu(recvtype); 652 recvtype = le32_to_cpu(recvtype);
606 lbs_dev_dbg(1, &cardp->udev->dev, 653 lbs_deb_usbd(&cardp->udev->dev,
607 "Receive type after = 0x%X\n", recvtype); 654 "Receive type after = 0x%X\n", recvtype);
608 } else if (urb->status) 655 } else if (urb->status)
609 goto rx_exit; 656 goto rx_exit;
@@ -621,18 +668,18 @@ static void if_usb_receive(struct urb *urb)
621 case CMD_TYPE_INDICATION: 668 case CMD_TYPE_INDICATION:
622 /* Event cause handling */ 669 /* Event cause handling */
623 spin_lock(&priv->adapter->driver_lock); 670 spin_lock(&priv->adapter->driver_lock);
624 cardp->usb_event_cause = *(u32 *) (recvbuff + MESSAGE_HEADER_LEN); 671 cardp->usb_event_cause = le32_to_cpu(*(__le32 *) (recvbuff + MESSAGE_HEADER_LEN));
625 lbs_dev_dbg(1, &cardp->udev->dev,"**EVENT** 0x%X\n", 672 lbs_deb_usbd(&cardp->udev->dev,"**EVENT** 0x%X\n",
626 cardp->usb_event_cause); 673 cardp->usb_event_cause);
627 if (cardp->usb_event_cause & 0xffff0000) { 674 if (cardp->usb_event_cause & 0xffff0000) {
628 libertas_send_tx_feedback(priv); 675 libertas_send_tx_feedback(priv);
629 spin_unlock(&priv->adapter->driver_lock); 676 spin_unlock(&priv->adapter->driver_lock);
630 break; 677 break;
631 } 678 }
632 cardp->usb_event_cause = le32_to_cpu(cardp->usb_event_cause) << 3; 679 cardp->usb_event_cause <<= 3;
633 cardp->usb_int_cause |= his_cardevent; 680 cardp->usb_int_cause |= his_cardevent;
634 kfree_skb(skb); 681 kfree_skb(skb);
635 libertas_interrupt(priv->wlan_dev.netdev); 682 libertas_interrupt(priv->dev);
636 spin_unlock(&priv->adapter->driver_lock); 683 spin_unlock(&priv->adapter->driver_lock);
637 goto rx_exit; 684 goto rx_exit;
638 default: 685 default:
@@ -643,8 +690,7 @@ static void if_usb_receive(struct urb *urb)
643setup_for_next: 690setup_for_next:
644 if_usb_submit_rx_urb(priv); 691 if_usb_submit_rx_urb(priv);
645rx_exit: 692rx_exit:
646 LEAVE(); 693 lbs_deb_leave(LBS_DEB_USB);
647 return;
648} 694}
649 695
650/** 696/**
@@ -655,24 +701,24 @@ rx_exit:
655 * @param len number of bytes 701 * @param len number of bytes
656 * @return 0 or -1 702 * @return 0 or -1
657 */ 703 */
658int libertas_sbi_host_to_card(wlan_private * priv, u8 type, u8 * payload, u16 nb) 704static int if_usb_host_to_card(wlan_private * priv, u8 type, u8 * payload, u16 nb)
659{ 705{
660 int ret = -1; 706 int ret = -1;
661 u32 tmp; 707 u32 tmp;
662 struct usb_card_rec *cardp = (struct usb_card_rec *)priv->wlan_dev.card; 708 struct usb_card_rec *cardp = (struct usb_card_rec *)priv->card;
663 709
664 lbs_dev_dbg(1, &cardp->udev->dev,"*** type = %u\n", type); 710 lbs_deb_usbd(&cardp->udev->dev,"*** type = %u\n", type);
665 lbs_dev_dbg(1, &cardp->udev->dev,"size after = %d\n", nb); 711 lbs_deb_usbd(&cardp->udev->dev,"size after = %d\n", nb);
666 712
667 if (type == MVMS_CMD) { 713 if (type == MVMS_CMD) {
668 tmp = cpu_to_le32(CMD_TYPE_REQUEST); 714 tmp = cpu_to_le32(CMD_TYPE_REQUEST);
669 priv->wlan_dev.dnld_sent = DNLD_CMD_SENT; 715 priv->dnld_sent = DNLD_CMD_SENT;
670 memcpy(cardp->bulk_out_buffer, (u8 *) & tmp, 716 memcpy(cardp->bulk_out_buffer, (u8 *) & tmp,
671 MESSAGE_HEADER_LEN); 717 MESSAGE_HEADER_LEN);
672 718
673 } else { 719 } else {
674 tmp = cpu_to_le32(CMD_TYPE_DATA); 720 tmp = cpu_to_le32(CMD_TYPE_DATA);
675 priv->wlan_dev.dnld_sent = DNLD_DATA_SENT; 721 priv->dnld_sent = DNLD_DATA_SENT;
676 memcpy(cardp->bulk_out_buffer, (u8 *) & tmp, 722 memcpy(cardp->bulk_out_buffer, (u8 *) & tmp,
677 MESSAGE_HEADER_LEN); 723 MESSAGE_HEADER_LEN);
678 } 724 }
@@ -686,39 +732,41 @@ int libertas_sbi_host_to_card(wlan_private * priv, u8 type, u8 * payload, u16 nb
686} 732}
687 733
688/* called with adapter->driver_lock held */ 734/* called with adapter->driver_lock held */
689int libertas_sbi_get_int_status(wlan_private * priv, u8 * ireg) 735static int if_usb_get_int_status(wlan_private * priv, u8 * ireg)
690{ 736{
691 struct usb_card_rec *cardp = priv->wlan_dev.card; 737 struct usb_card_rec *cardp = priv->card;
692 738
693 *ireg = cardp->usb_int_cause; 739 *ireg = cardp->usb_int_cause;
694 cardp->usb_int_cause = 0; 740 cardp->usb_int_cause = 0;
695 741
696 lbs_dev_dbg(1, &cardp->udev->dev,"Int cause is 0x%X\n", *ireg); 742 lbs_deb_usbd(&cardp->udev->dev,"Int cause is 0x%X\n", *ireg);
697 743
698 return 0; 744 return 0;
699} 745}
700 746
701int libertas_sbi_read_event_cause(wlan_private * priv) 747static int if_usb_read_event_cause(wlan_private * priv)
702{ 748{
703 struct usb_card_rec *cardp = priv->wlan_dev.card; 749 struct usb_card_rec *cardp = priv->card;
704 priv->adapter->eventcause = cardp->usb_event_cause; 750 priv->adapter->eventcause = cardp->usb_event_cause;
705 /* Re-submit rx urb here to avoid event lost issue */ 751 /* Re-submit rx urb here to avoid event lost issue */
706 if_usb_submit_rx_urb(priv); 752 if_usb_submit_rx_urb(priv);
707 return 0; 753 return 0;
708} 754}
709 755
710int reset_device(wlan_private *priv) 756static int if_usb_reset_device(wlan_private *priv)
711{ 757{
712 int ret; 758 int ret;
713 759
760 lbs_deb_enter(LBS_DEB_USB);
714 ret = libertas_prepare_and_send_command(priv, cmd_802_11_reset, 761 ret = libertas_prepare_and_send_command(priv, cmd_802_11_reset,
715 cmd_act_halt, 0, 0, NULL); 762 cmd_act_halt, 0, 0, NULL);
716 msleep_interruptible(10); 763 msleep_interruptible(10);
717 764
765 lbs_deb_leave_args(LBS_DEB_USB, "ret %d", ret);
718 return ret; 766 return ret;
719} 767}
720 768
721int libertas_sbi_unregister_dev(wlan_private * priv) 769static int if_usb_unregister_dev(wlan_private * priv)
722{ 770{
723 int ret = 0; 771 int ret = 0;
724 772
@@ -727,7 +775,7 @@ int libertas_sbi_unregister_dev(wlan_private * priv)
727 * again. 775 * again.
728 */ 776 */
729 if (priv) 777 if (priv)
730 reset_device(priv); 778 if_usb_reset_device(priv);
731 779
732 return ret; 780 return ret;
733} 781}
@@ -738,42 +786,41 @@ int libertas_sbi_unregister_dev(wlan_private * priv)
738 * @param priv pointer to wlan_private 786 * @param priv pointer to wlan_private
739 * @return 0 or -1 787 * @return 0 or -1
740 */ 788 */
741int libertas_sbi_register_dev(wlan_private * priv) 789static int if_usb_register_dev(wlan_private * priv)
742{ 790{
791 struct usb_card_rec *cardp = (struct usb_card_rec *)priv->card;
743 792
744 struct usb_card_rec *cardp = (struct usb_card_rec *)priv->wlan_dev.card; 793 lbs_deb_enter(LBS_DEB_USB);
745 ENTER();
746 794
747 cardp->priv = priv; 795 cardp->priv = priv;
748 cardp->eth_dev = priv->wlan_dev.netdev; 796 cardp->eth_dev = priv->dev;
749 priv->hotplug_device = &(cardp->udev->dev); 797 priv->hotplug_device = &(cardp->udev->dev);
750 798
751 SET_NETDEV_DEV(cardp->eth_dev, &(cardp->udev->dev)); 799 lbs_deb_usbd(&cardp->udev->dev, "udev pointer is at %p\n",
752
753 lbs_dev_dbg(1, &cardp->udev->dev, "udev pointer is at %p\n",
754 cardp->udev); 800 cardp->udev);
755 801
756 LEAVE(); 802 lbs_deb_leave(LBS_DEB_USB);
757 return 0; 803 return 0;
758} 804}
759 805
760 806
761 807
762int libertas_sbi_prog_firmware(wlan_private * priv) 808static int if_usb_prog_firmware(wlan_private * priv)
763{ 809{
764 struct usb_card_rec *cardp = priv->wlan_dev.card; 810 struct usb_card_rec *cardp = priv->card;
765 int i = 0; 811 int i = 0;
766 static int reset_count = 10; 812 static int reset_count = 10;
813 int ret = 0;
767 814
768 ENTER(); 815 lbs_deb_enter(LBS_DEB_USB);
769 816
770 cardp->rinfo.priv = priv; 817 cardp->rinfo.priv = priv;
771 818
772restart: 819restart:
773 if (if_usb_submit_rx_urb_fwload(priv) < 0) { 820 if (if_usb_submit_rx_urb_fwload(priv) < 0) {
774 lbs_dev_dbg(1, &cardp->udev->dev, "URB submission is failed\n"); 821 lbs_deb_usbd(&cardp->udev->dev, "URB submission is failed\n");
775 LEAVE(); 822 ret = -1;
776 return -1; 823 goto done;
777 } 824 }
778 825
779 cardp->bootcmdresp = 0; 826 cardp->bootcmdresp = 0;
@@ -811,7 +858,7 @@ restart:
811 if_prog_firmware(priv); 858 if_prog_firmware(priv);
812 859
813 do { 860 do {
814 lbs_dev_dbg(1, &cardp->udev->dev,"Wlan sched timeout\n"); 861 lbs_deb_usbd(&cardp->udev->dev,"Wlan sched timeout\n");
815 i++; 862 i++;
816 msleep_interruptible(100); 863 msleep_interruptible(100);
817 if (priv->adapter->surpriseremoved || i >= 20) 864 if (priv->adapter->surpriseremoved || i >= 20)
@@ -826,8 +873,8 @@ restart:
826 } 873 }
827 874
828 lbs_pr_info("FW download failure, time = %d ms\n", i * 100); 875 lbs_pr_info("FW download failure, time = %d ms\n", i * 100);
829 LEAVE(); 876 ret = -1;
830 return -1; 877 goto done;
831 } 878 }
832 879
833 if_usb_submit_rx_urb(priv); 880 if_usb_submit_rx_urb(priv);
@@ -837,32 +884,10 @@ restart:
837 884
838 priv->adapter->fw_ready = 1; 885 priv->adapter->fw_ready = 1;
839 886
840 LEAVE(); 887done:
841 return 0; 888 lbs_deb_leave_args(LBS_DEB_USB, "ret %d", ret);
842} 889 return ret;
843
844/**
845 * @brief Given a usb_card_rec return its wlan_private
846 * @param card pointer to a usb_card_rec
847 * @return pointer to wlan_private
848 */
849wlan_private *libertas_sbi_get_priv(void *card)
850{
851 struct usb_card_rec *cardp = card;
852 return cardp->priv;
853}
854
855#ifdef ENABLE_PM
856int libertas_sbi_suspend(wlan_private * priv)
857{
858 return 0;
859}
860
861int libertas_sbi_resume(wlan_private * priv)
862{
863 return 0;
864} 890}
865#endif
866 891
867#ifdef CONFIG_PM 892#ifdef CONFIG_PM
868static int if_usb_suspend(struct usb_interface *intf, pm_message_t message) 893static 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)
870 struct usb_card_rec *cardp = usb_get_intfdata(intf); 895 struct usb_card_rec *cardp = usb_get_intfdata(intf);
871 wlan_private *priv = cardp->priv; 896 wlan_private *priv = cardp->priv;
872 897
873 ENTER(); 898 lbs_deb_enter(LBS_DEB_USB);
874 899
875 if (priv->adapter->psstate != PS_STATE_FULL_POWER) 900 if (priv->adapter->psstate != PS_STATE_FULL_POWER)
876 return -1; 901 return -1;
877 902
878 netif_device_detach(cardp->eth_dev); 903 netif_device_detach(cardp->eth_dev);
904 netif_device_detach(priv->mesh_dev);
879 905
880 /* Unlink tx & rx urb */ 906 /* Unlink tx & rx urb */
881 usb_kill_urb(cardp->tx_urb); 907 usb_kill_urb(cardp->tx_urb);
@@ -883,23 +909,25 @@ static int if_usb_suspend(struct usb_interface *intf, pm_message_t message)
883 909
884 cardp->rx_urb_recall = 1; 910 cardp->rx_urb_recall = 1;
885 911
886 LEAVE(); 912 lbs_deb_leave(LBS_DEB_USB);
887 return 0; 913 return 0;
888} 914}
889 915
890static int if_usb_resume(struct usb_interface *intf) 916static int if_usb_resume(struct usb_interface *intf)
891{ 917{
892 struct usb_card_rec *cardp = usb_get_intfdata(intf); 918 struct usb_card_rec *cardp = usb_get_intfdata(intf);
919 wlan_private *priv = cardp->priv;
893 920
894 ENTER(); 921 lbs_deb_enter(LBS_DEB_USB);
895 922
896 cardp->rx_urb_recall = 0; 923 cardp->rx_urb_recall = 0;
897 924
898 if_usb_submit_rx_urb(cardp->priv); 925 if_usb_submit_rx_urb(cardp->priv);
899 926
900 netif_device_attach(cardp->eth_dev); 927 netif_device_attach(cardp->eth_dev);
928 netif_device_attach(priv->mesh_dev);
901 929
902 LEAVE(); 930 lbs_deb_leave(LBS_DEB_USB);
903 return 0; 931 return 0;
904} 932}
905#else 933#else
@@ -920,32 +948,40 @@ static struct usb_driver if_usb_driver = {
920 .resume = if_usb_resume, 948 .resume = if_usb_resume,
921}; 949};
922 950
923/** 951static int if_usb_init_module(void)
924 * @brief This function registers driver.
925 * @param add pointer to add_card callback function
926 * @param remove pointer to remove card callback function
927 * @param arg pointer to call back function parameter
928 * @return dummy success variable
929 */
930int libertas_sbi_register(void)
931{ 952{
932 /* 953 int ret = 0;
933 * API registers the Marvell USB driver
934 * to the USB system
935 */
936 usb_register(&if_usb_driver);
937 954
938 /* Return success to wlan layer */ 955 lbs_deb_enter(LBS_DEB_MAIN);
939 return 0; 956
957 if (libertas_fw_name == NULL) {
958 libertas_fw_name = default_fw_name;
959 }
960
961 ret = usb_register(&if_usb_driver);
962
963 lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret);
964 return ret;
940} 965}
941 966
942/** 967static void if_usb_exit_module(void)
943 * @brief This function removes usb driver.
944 * @return N/A
945 */
946void libertas_sbi_unregister(void)
947{ 968{
969 struct usb_card_rec *cardp, *cardp_temp;
970
971 lbs_deb_enter(LBS_DEB_MAIN);
972
973 list_for_each_entry_safe(cardp, cardp_temp, &usb_devices, list)
974 if_usb_reset_device((wlan_private *) cardp->priv);
975
948 /* API unregisters the driver from USB subsystem */ 976 /* API unregisters the driver from USB subsystem */
949 usb_deregister(&if_usb_driver); 977 usb_deregister(&if_usb_driver);
950 return; 978
979 lbs_deb_leave(LBS_DEB_MAIN);
951} 980}
981
982module_init(if_usb_init_module);
983module_exit(if_usb_exit_module);
984
985MODULE_DESCRIPTION("8388 USB WLAN Driver");
986MODULE_AUTHOR("Marvell International Ltd.");
987MODULE_LICENSE("GPL");
diff --git a/drivers/net/wireless/libertas/if_usb.h b/drivers/net/wireless/libertas/if_usb.h
index 170dfe6809f5..156bb485e1a6 100644
--- a/drivers/net/wireless/libertas/if_usb.h
+++ b/drivers/net/wireless/libertas/if_usb.h
@@ -1,3 +1,8 @@
1#ifndef _LIBERTAS_IF_USB_H
2#define _LIBERTAS_IF_USB_H
3
4#include <linux/list.h>
5
1/** 6/**
2 * This file contains definition for USB interface. 7 * This file contains definition for USB interface.
3 */ 8 */
@@ -7,11 +12,6 @@
7 12
8#define IPFIELD_ALIGN_OFFSET 2 13#define IPFIELD_ALIGN_OFFSET 2
9 14
10#define USB8388_VID_1 0x1286
11#define USB8388_PID_1 0x2001
12#define USB8388_VID_2 0x05a3
13#define USB8388_PID_2 0x8388
14
15#define BOOT_CMD_FW_BY_USB 0x01 15#define BOOT_CMD_FW_BY_USB 0x01
16#define BOOT_CMD_FW_IN_EEPROM 0x02 16#define BOOT_CMD_FW_IN_EEPROM 0x02
17#define BOOT_CMD_UPDATE_BOOT2 0x03 17#define BOOT_CMD_UPDATE_BOOT2 0x03
@@ -20,7 +20,7 @@
20 20
21struct bootcmdstr 21struct bootcmdstr
22{ 22{
23 u32 u32magicnumber; 23 __le32 u32magicnumber;
24 u8 u8cmd_tag; 24 u8 u8cmd_tag;
25 u8 au8dumy[11]; 25 u8 au8dumy[11];
26}; 26};
@@ -30,7 +30,7 @@ struct bootcmdstr
30 30
31struct bootcmdrespStr 31struct bootcmdrespStr
32{ 32{
33 u32 u32magicnumber; 33 __le32 u32magicnumber;
34 u8 u8cmd_tag; 34 u8 u8cmd_tag;
35 u8 u8result; 35 u8 u8result;
36 u8 au8dumy[2]; 36 u8 au8dumy[2];
@@ -44,6 +44,7 @@ struct read_cb_info {
44 44
45/** USB card description structure*/ 45/** USB card description structure*/
46struct usb_card_rec { 46struct usb_card_rec {
47 struct list_head list;
47 struct net_device *eth_dev; 48 struct net_device *eth_dev;
48 struct usb_device *udev; 49 struct usb_device *udev;
49 struct urb *rx_urb, *tx_urb; 50 struct urb *rx_urb, *tx_urb;
@@ -75,33 +76,34 @@ struct usb_card_rec {
75 76
76/** fwheader */ 77/** fwheader */
77struct fwheader { 78struct fwheader {
78 u32 dnldcmd; 79 __le32 dnldcmd;
79 u32 baseaddr; 80 __le32 baseaddr;
80 u32 datalength; 81 __le32 datalength;
81 u32 CRC; 82 __le32 CRC;
82}; 83};
83 84
84#define FW_MAX_DATA_BLK_SIZE 600 85#define FW_MAX_DATA_BLK_SIZE 600
85/** FWData */ 86/** FWData */
86struct FWData { 87struct FWData {
87 struct fwheader fwheader; 88 struct fwheader fwheader;
88 u32 seqnum; 89 __le32 seqnum;
89 u8 data[FW_MAX_DATA_BLK_SIZE]; 90 u8 data[FW_MAX_DATA_BLK_SIZE];
90}; 91};
91 92
92/** fwsyncheader */ 93/** fwsyncheader */
93struct fwsyncheader { 94struct fwsyncheader {
94 u32 cmd; 95 __le32 cmd;
95 u32 seqnum; 96 __le32 seqnum;
96}; 97};
97 98
98#define FW_HAS_DATA_TO_RECV 0x00000001 99#define FW_HAS_DATA_TO_RECV 0x00000001
99#define FW_HAS_LAST_BLOCK 0x00000004 100#define FW_HAS_LAST_BLOCK 0x00000004
100 101
101#define FW_DATA_XMIT_SIZE \ 102#define FW_DATA_XMIT_SIZE \
102 sizeof(struct fwheader) + fwdata->fwheader.datalength + sizeof(u32) 103 sizeof(struct fwheader) + le32_to_cpu(fwdata->fwheader.datalength) + sizeof(u32)
103 104
104int usb_tx_block(wlan_private *priv, u8 *payload, u16 nb); 105int usb_tx_block(wlan_private *priv, u8 *payload, u16 nb);
105void if_usb_free(struct usb_card_rec *cardp); 106void if_usb_free(struct usb_card_rec *cardp);
106int if_usb_issue_boot_command(wlan_private *priv, int ivalue); 107int if_usb_issue_boot_command(wlan_private *priv, int ivalue);
107 108
109#endif
diff --git a/drivers/net/wireless/libertas/ioctl.c b/drivers/net/wireless/libertas/ioctl.c
index a8f76c358992..f41081585564 100644
--- a/drivers/net/wireless/libertas/ioctl.c
+++ b/drivers/net/wireless/libertas/ioctl.c
@@ -30,6 +30,7 @@
30static int wlan_set_region(wlan_private * priv, u16 region_code) 30static int wlan_set_region(wlan_private * priv, u16 region_code)
31{ 31{
32 int i; 32 int i;
33 int ret = 0;
33 34
34 for (i = 0; i < MRVDRV_MAX_REGION_CODE; i++) { 35 for (i = 0; i < MRVDRV_MAX_REGION_CODE; i++) {
35 // use the region code to search for the index 36 // use the region code to search for the index
@@ -42,17 +43,18 @@ static int wlan_set_region(wlan_private * priv, u16 region_code)
42 43
43 // if it's unidentified region code 44 // if it's unidentified region code
44 if (i >= MRVDRV_MAX_REGION_CODE) { 45 if (i >= MRVDRV_MAX_REGION_CODE) {
45 lbs_pr_debug(1, "region Code not identified\n"); 46 lbs_deb_ioctl("region Code not identified\n");
46 LEAVE(); 47 ret = -1;
47 return -1; 48 goto done;
48 } 49 }
49 50
50 if (libertas_set_regiontable(priv, priv->adapter->regioncode, 0)) { 51 if (libertas_set_regiontable(priv, priv->adapter->regioncode, 0)) {
51 LEAVE(); 52 ret = -EINVAL;
52 return -EINVAL;
53 } 53 }
54 54
55 return 0; 55done:
56 lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
57 return ret;
56} 58}
57 59
58static inline int hex2int(char c) 60static inline int hex2int(char c)
@@ -125,8 +127,10 @@ static int wlan_bt_add_ioctl(wlan_private * priv, struct ifreq *req)
125 char ethaddrs_str[18]; 127 char ethaddrs_str[18];
126 char *pos; 128 char *pos;
127 u8 ethaddr[ETH_ALEN]; 129 u8 ethaddr[ETH_ALEN];
130 int ret;
131
132 lbs_deb_enter(LBS_DEB_IOCTL);
128 133
129 ENTER();
130 if (copy_from_user(ethaddrs_str, wrq->u.data.pointer, 134 if (copy_from_user(ethaddrs_str, wrq->u.data.pointer,
131 sizeof(ethaddrs_str))) 135 sizeof(ethaddrs_str)))
132 return -EFAULT; 136 return -EFAULT;
@@ -136,11 +140,12 @@ static int wlan_bt_add_ioctl(wlan_private * priv, struct ifreq *req)
136 return -EINVAL; 140 return -EINVAL;
137 } 141 }
138 142
139 lbs_pr_debug(1, "BT: adding %s\n", ethaddrs_str); 143 lbs_deb_ioctl("BT: adding %s\n", ethaddrs_str);
140 LEAVE(); 144 ret = libertas_prepare_and_send_command(priv, cmd_bt_access,
141 return (libertas_prepare_and_send_command(priv, cmd_bt_access,
142 cmd_act_bt_access_add, 145 cmd_act_bt_access_add,
143 cmd_option_waitforrsp, 0, ethaddr)); 146 cmd_option_waitforrsp, 0, ethaddr);
147 lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
148 return ret;
144} 149}
145 150
146/** 151/**
@@ -156,7 +161,8 @@ static int wlan_bt_del_ioctl(wlan_private * priv, struct ifreq *req)
156 u8 ethaddr[ETH_ALEN]; 161 u8 ethaddr[ETH_ALEN];
157 char *pos; 162 char *pos;
158 163
159 ENTER(); 164 lbs_deb_enter(LBS_DEB_IOCTL);
165
160 if (copy_from_user(ethaddrs_str, wrq->u.data.pointer, 166 if (copy_from_user(ethaddrs_str, wrq->u.data.pointer,
161 sizeof(ethaddrs_str))) 167 sizeof(ethaddrs_str)))
162 return -EFAULT; 168 return -EFAULT;
@@ -166,13 +172,14 @@ static int wlan_bt_del_ioctl(wlan_private * priv, struct ifreq *req)
166 return -EINVAL; 172 return -EINVAL;
167 } 173 }
168 174
169 lbs_pr_debug(1, "BT: deleting %s\n", ethaddrs_str); 175 lbs_deb_ioctl("BT: deleting %s\n", ethaddrs_str);
170 176
171 return (libertas_prepare_and_send_command(priv, 177 return (libertas_prepare_and_send_command(priv,
172 cmd_bt_access, 178 cmd_bt_access,
173 cmd_act_bt_access_del, 179 cmd_act_bt_access_del,
174 cmd_option_waitforrsp, 0, ethaddr)); 180 cmd_option_waitforrsp, 0, ethaddr));
175 LEAVE(); 181
182 lbs_deb_leave(LBS_DEB_IOCTL);
176 return 0; 183 return 0;
177} 184}
178 185
@@ -183,7 +190,7 @@ static int wlan_bt_del_ioctl(wlan_private * priv, struct ifreq *req)
183 */ 190 */
184static int wlan_bt_reset_ioctl(wlan_private * priv) 191static int wlan_bt_reset_ioctl(wlan_private * priv)
185{ 192{
186 ENTER(); 193 lbs_deb_enter(LBS_DEB_IOCTL);
187 194
188 lbs_pr_alert( "BT: resetting\n"); 195 lbs_pr_alert( "BT: resetting\n");
189 196
@@ -192,7 +199,7 @@ static int wlan_bt_reset_ioctl(wlan_private * priv)
192 cmd_act_bt_access_reset, 199 cmd_act_bt_access_reset,
193 cmd_option_waitforrsp, 0, NULL)); 200 cmd_option_waitforrsp, 0, NULL));
194 201
195 LEAVE(); 202 lbs_deb_leave(LBS_DEB_IOCTL);
196 return 0; 203 return 0;
197} 204}
198 205
@@ -209,17 +216,17 @@ static int wlan_bt_list_ioctl(wlan_private * priv, struct ifreq *req)
209 struct iwreq *wrq = (struct iwreq *)req; 216 struct iwreq *wrq = (struct iwreq *)req;
210 /* used to pass id and store the bt entry returned by the FW */ 217 /* used to pass id and store the bt entry returned by the FW */
211 union { 218 union {
212 int id; 219 u32 id;
213 char addr1addr2[2 * ETH_ALEN]; 220 char addr1addr2[2 * ETH_ALEN];
214 } param; 221 } param;
215 static char outstr[64]; 222 static char outstr[64];
216 char *pbuf = outstr; 223 char *pbuf = outstr;
217 int ret; 224 int ret;
218 225
219 ENTER(); 226 lbs_deb_enter(LBS_DEB_IOCTL);
220 227
221 if (copy_from_user(outstr, wrq->u.data.pointer, sizeof(outstr))) { 228 if (copy_from_user(outstr, wrq->u.data.pointer, sizeof(outstr))) {
222 lbs_pr_debug(1, "Copy from user failed\n"); 229 lbs_deb_ioctl("Copy from user failed\n");
223 return -1; 230 return -1;
224 } 231 }
225 param.id = simple_strtoul(outstr, NULL, 10); 232 param.id = simple_strtoul(outstr, NULL, 10);
@@ -234,7 +241,7 @@ static int wlan_bt_list_ioctl(wlan_private * priv, struct ifreq *req)
234 if (ret == 0) { 241 if (ret == 0) {
235 addr1 = param.addr1addr2; 242 addr1 = param.addr1addr2;
236 243
237 pos = sprintf(pbuf, "ignoring traffic from "); 244 pos = sprintf(pbuf, "BT includes node ");
238 pbuf += pos; 245 pbuf += pos;
239 pos = eth_addr2str(addr1, pbuf); 246 pos = eth_addr2str(addr1, pbuf);
240 pbuf += pos; 247 pbuf += pos;
@@ -246,11 +253,70 @@ static int wlan_bt_list_ioctl(wlan_private * priv, struct ifreq *req)
246 wrq->u.data.length = strlen(outstr); 253 wrq->u.data.length = strlen(outstr);
247 if (copy_to_user(wrq->u.data.pointer, (char *)outstr, 254 if (copy_to_user(wrq->u.data.pointer, (char *)outstr,
248 wrq->u.data.length)) { 255 wrq->u.data.length)) {
249 lbs_pr_debug(1, "BT_LIST: Copy to user failed!\n"); 256 lbs_deb_ioctl("BT_LIST: Copy to user failed!\n");
250 return -EFAULT; 257 return -EFAULT;
251 } 258 }
252 259
253 LEAVE(); 260 lbs_deb_leave(LBS_DEB_IOCTL);
261 return 0 ;
262}
263
264/**
265 * @brief Sets inverted state of blacklist (non-zero if inverted)
266 * @param priv A pointer to wlan_private structure
267 * @param req A pointer to ifreq structure
268 * @return 0 --success, otherwise fail
269 */
270static int wlan_bt_set_invert_ioctl(wlan_private * priv, struct ifreq *req)
271{
272 int ret;
273 struct iwreq *wrq = (struct iwreq *)req;
274 union {
275 u32 id;
276 char addr1addr2[2 * ETH_ALEN];
277 } param;
278
279 lbs_deb_enter(LBS_DEB_IOCTL);
280
281 param.id = SUBCMD_DATA(wrq) ;
282 ret = libertas_prepare_and_send_command(priv, cmd_bt_access,
283 cmd_act_bt_access_set_invert,
284 cmd_option_waitforrsp, 0,
285 (char *)&param);
286 if (ret != 0)
287 return -EFAULT;
288 lbs_deb_leave(LBS_DEB_IOCTL);
289 return 0;
290}
291
292/**
293 * @brief Gets inverted state of blacklist (non-zero if inverted)
294 * @param priv A pointer to wlan_private structure
295 * @param req A pointer to ifreq structure
296 * @return 0 --success, otherwise fail
297 */
298static int wlan_bt_get_invert_ioctl(wlan_private * priv, struct ifreq *req)
299{
300 struct iwreq *wrq = (struct iwreq *)req;
301 int ret;
302 union {
303 u32 id;
304 char addr1addr2[2 * ETH_ALEN];
305 } param;
306
307 lbs_deb_enter(LBS_DEB_IOCTL);
308
309 ret = libertas_prepare_and_send_command(priv, cmd_bt_access,
310 cmd_act_bt_access_get_invert,
311 cmd_option_waitforrsp, 0,
312 (char *)&param);
313
314 if (ret == 0)
315 wrq->u.param.value = le32_to_cpu(param.id);
316 else
317 return -EFAULT;
318
319 lbs_deb_leave(LBS_DEB_IOCTL);
254 return 0; 320 return 0;
255} 321}
256 322
@@ -278,8 +344,10 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req)
278 char in_str[128]; 344 char in_str[128];
279 static struct cmd_ds_fwt_access fwt_access; 345 static struct cmd_ds_fwt_access fwt_access;
280 char *ptr; 346 char *ptr;
347 int ret;
348
349 lbs_deb_enter(LBS_DEB_IOCTL);
281 350
282 ENTER();
283 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) 351 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
284 return -EFAULT; 352 return -EFAULT;
285 353
@@ -297,7 +365,7 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req)
297 fwt_access.metric = 365 fwt_access.metric =
298 cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); 366 cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
299 else 367 else
300 fwt_access.metric = FWT_DEFAULT_METRIC; 368 fwt_access.metric = cpu_to_le32(FWT_DEFAULT_METRIC);
301 369
302 if ((ptr = next_param(ptr))) 370 if ((ptr = next_param(ptr)))
303 fwt_access.dir = (u8)simple_strtoul(ptr, &ptr, 10); 371 fwt_access.dir = (u8)simple_strtoul(ptr, &ptr, 10);
@@ -305,16 +373,21 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req)
305 fwt_access.dir = FWT_DEFAULT_DIR; 373 fwt_access.dir = FWT_DEFAULT_DIR;
306 374
307 if ((ptr = next_param(ptr))) 375 if ((ptr = next_param(ptr)))
376 fwt_access.rate = (u8) simple_strtoul(ptr, &ptr, 10);
377 else
378 fwt_access.rate = FWT_DEFAULT_RATE;
379
380 if ((ptr = next_param(ptr)))
308 fwt_access.ssn = 381 fwt_access.ssn =
309 cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); 382 cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
310 else 383 else
311 fwt_access.ssn = FWT_DEFAULT_SSN; 384 fwt_access.ssn = cpu_to_le32(FWT_DEFAULT_SSN);
312 385
313 if ((ptr = next_param(ptr))) 386 if ((ptr = next_param(ptr)))
314 fwt_access.dsn = 387 fwt_access.dsn =
315 cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); 388 cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
316 else 389 else
317 fwt_access.dsn = FWT_DEFAULT_DSN; 390 fwt_access.dsn = cpu_to_le32(FWT_DEFAULT_DSN);
318 391
319 if ((ptr = next_param(ptr))) 392 if ((ptr = next_param(ptr)))
320 fwt_access.hopcount = simple_strtoul(ptr, &ptr, 10); 393 fwt_access.hopcount = simple_strtoul(ptr, &ptr, 10);
@@ -330,7 +403,7 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req)
330 fwt_access.expiration = 403 fwt_access.expiration =
331 cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); 404 cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
332 else 405 else
333 fwt_access.expiration = FWT_DEFAULT_EXPIRATION; 406 fwt_access.expiration = cpu_to_le32(FWT_DEFAULT_EXPIRATION);
334 407
335 if ((ptr = next_param(ptr))) 408 if ((ptr = next_param(ptr)))
336 fwt_access.sleepmode = (u8)simple_strtoul(ptr, &ptr, 10); 409 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)
341 fwt_access.snr = 414 fwt_access.snr =
342 cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); 415 cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
343 else 416 else
344 fwt_access.snr = FWT_DEFAULT_SNR; 417 fwt_access.snr = cpu_to_le32(FWT_DEFAULT_SNR);
345 418
346#ifdef DEBUG 419#ifdef DEBUG
347 { 420 {
348 char ethaddr1_str[18], ethaddr2_str[18]; 421 char ethaddr1_str[18], ethaddr2_str[18];
349 eth_addr2str(fwt_access.da, ethaddr1_str); 422 eth_addr2str(fwt_access.da, ethaddr1_str);
350 eth_addr2str(fwt_access.ra, ethaddr2_str); 423 eth_addr2str(fwt_access.ra, ethaddr2_str);
351 lbs_pr_debug(1, "FWT_ADD: adding (da:%s,%i,ra:%s)\n", ethaddr1_str, 424 lbs_deb_ioctl("FWT_ADD: adding (da:%s,%i,ra:%s)\n", ethaddr1_str,
352 fwt_access.dir, ethaddr2_str); 425 fwt_access.dir, ethaddr2_str);
353 lbs_pr_debug(1, "FWT_ADD: ssn:%u dsn:%u met:%u hop:%u ttl:%u exp:%u slp:%u snr:%u\n", 426 lbs_deb_ioctl("FWT_ADD: ssn:%u dsn:%u met:%u hop:%u ttl:%u exp:%u slp:%u snr:%u\n",
354 fwt_access.ssn, fwt_access.dsn, fwt_access.metric, 427 fwt_access.ssn, fwt_access.dsn, fwt_access.metric,
355 fwt_access.hopcount, fwt_access.ttl, fwt_access.expiration, 428 fwt_access.hopcount, fwt_access.ttl, fwt_access.expiration,
356 fwt_access.sleepmode, fwt_access.snr); 429 fwt_access.sleepmode, fwt_access.snr);
357 } 430 }
358#endif 431#endif
359 432
360 LEAVE(); 433 ret = libertas_prepare_and_send_command(priv, cmd_fwt_access,
361 return (libertas_prepare_and_send_command(priv, cmd_fwt_access, 434 cmd_act_fwt_access_add,
362 cmd_act_fwt_access_add, 435 cmd_option_waitforrsp, 0,
363 cmd_option_waitforrsp, 0, 436 (void *)&fwt_access);
364 (void *)&fwt_access)); 437
438 lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
439 return ret;
365} 440}
366 441
367/** 442/**
@@ -376,8 +451,10 @@ static int wlan_fwt_del_ioctl(wlan_private * priv, struct ifreq *req)
376 char in_str[64]; 451 char in_str[64];
377 static struct cmd_ds_fwt_access fwt_access; 452 static struct cmd_ds_fwt_access fwt_access;
378 char *ptr; 453 char *ptr;
454 int ret;
455
456 lbs_deb_enter(LBS_DEB_IOCTL);
379 457
380 ENTER();
381 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) 458 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
382 return -EFAULT; 459 return -EFAULT;
383 460
@@ -399,20 +476,21 @@ static int wlan_fwt_del_ioctl(wlan_private * priv, struct ifreq *req)
399#ifdef DEBUG 476#ifdef DEBUG
400 { 477 {
401 char ethaddr1_str[18], ethaddr2_str[18]; 478 char ethaddr1_str[18], ethaddr2_str[18];
402 lbs_pr_debug(1, "FWT_DEL: line is %s\n", in_str); 479 lbs_deb_ioctl("FWT_DEL: line is %s\n", in_str);
403 eth_addr2str(fwt_access.da, ethaddr1_str); 480 eth_addr2str(fwt_access.da, ethaddr1_str);
404 eth_addr2str(fwt_access.ra, ethaddr2_str); 481 eth_addr2str(fwt_access.ra, ethaddr2_str);
405 lbs_pr_debug(1, "FWT_DEL: removing (da:%s,ra:%s,dir:%d)\n", ethaddr1_str, 482 lbs_deb_ioctl("FWT_DEL: removing (da:%s,ra:%s,dir:%d)\n", ethaddr1_str,
406 ethaddr2_str, fwt_access.dir); 483 ethaddr2_str, fwt_access.dir);
407 } 484 }
408#endif 485#endif
409 486
410 LEAVE(); 487 ret = libertas_prepare_and_send_command(priv,
411 return (libertas_prepare_and_send_command(priv, 488 cmd_fwt_access,
412 cmd_fwt_access, 489 cmd_act_fwt_access_del,
413 cmd_act_fwt_access_del, 490 cmd_option_waitforrsp, 0,
414 cmd_option_waitforrsp, 0, 491 (void *)&fwt_access);
415 (void *)&fwt_access)); 492 lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
493 return ret;
416} 494}
417 495
418 496
@@ -427,15 +505,18 @@ static void print_route(struct cmd_ds_fwt_access fwt_access, char *buf)
427 buf += eth_addr2str(fwt_access.da, buf); 505 buf += eth_addr2str(fwt_access.da, buf);
428 buf += sprintf(buf, " "); 506 buf += sprintf(buf, " ");
429 buf += eth_addr2str(fwt_access.ra, buf); 507 buf += eth_addr2str(fwt_access.ra, buf);
508 buf += sprintf(buf, " %u", fwt_access.valid);
430 buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.metric)); 509 buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.metric));
431 buf += sprintf(buf, " %u", fwt_access.dir); 510 buf += sprintf(buf, " %u", fwt_access.dir);
511 buf += sprintf(buf, " %u", fwt_access.rate);
432 buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.ssn)); 512 buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.ssn));
433 buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.dsn)); 513 buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.dsn));
434 buf += sprintf(buf, " %u", fwt_access.hopcount); 514 buf += sprintf(buf, " %u", fwt_access.hopcount);
435 buf += sprintf(buf, " %u", fwt_access.ttl); 515 buf += sprintf(buf, " %u", fwt_access.ttl);
436 buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.expiration)); 516 buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.expiration));
437 buf += sprintf(buf, " %u", fwt_access.sleepmode); 517 buf += sprintf(buf, " %u", fwt_access.sleepmode);
438 buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.snr)); 518 buf += sprintf(buf, " %u ", le32_to_cpu(fwt_access.snr));
519 buf += eth_addr2str(fwt_access.prec, buf);
439} 520}
440 521
441/** 522/**
@@ -453,7 +534,8 @@ static int wlan_fwt_lookup_ioctl(wlan_private * priv, struct ifreq *req)
453 static char out_str[128]; 534 static char out_str[128];
454 int ret; 535 int ret;
455 536
456 ENTER(); 537 lbs_deb_enter(LBS_DEB_IOCTL);
538
457 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) 539 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
458 return -EFAULT; 540 return -EFAULT;
459 541
@@ -465,9 +547,9 @@ static int wlan_fwt_lookup_ioctl(wlan_private * priv, struct ifreq *req)
465#ifdef DEBUG 547#ifdef DEBUG
466 { 548 {
467 char ethaddr1_str[18]; 549 char ethaddr1_str[18];
468 lbs_pr_debug(1, "FWT_LOOKUP: line is %s\n", in_str); 550 lbs_deb_ioctl("FWT_LOOKUP: line is %s\n", in_str);
469 eth_addr2str(fwt_access.da, ethaddr1_str); 551 eth_addr2str(fwt_access.da, ethaddr1_str);
470 lbs_pr_debug(1, "FWT_LOOKUP: looking for (da:%s)\n", ethaddr1_str); 552 lbs_deb_ioctl("FWT_LOOKUP: looking for (da:%s)\n", ethaddr1_str);
471 } 553 }
472#endif 554#endif
473 555
@@ -485,11 +567,11 @@ static int wlan_fwt_lookup_ioctl(wlan_private * priv, struct ifreq *req)
485 wrq->u.data.length = strlen(out_str); 567 wrq->u.data.length = strlen(out_str);
486 if (copy_to_user(wrq->u.data.pointer, (char *)out_str, 568 if (copy_to_user(wrq->u.data.pointer, (char *)out_str,
487 wrq->u.data.length)) { 569 wrq->u.data.length)) {
488 lbs_pr_debug(1, "FWT_LOOKUP: Copy to user failed!\n"); 570 lbs_deb_ioctl("FWT_LOOKUP: Copy to user failed!\n");
489 return -EFAULT; 571 return -EFAULT;
490 } 572 }
491 573
492 LEAVE(); 574 lbs_deb_leave(LBS_DEB_IOCTL);
493 return 0; 575 return 0;
494} 576}
495 577
@@ -500,7 +582,7 @@ static int wlan_fwt_lookup_ioctl(wlan_private * priv, struct ifreq *req)
500 */ 582 */
501static int wlan_fwt_reset_ioctl(wlan_private * priv) 583static int wlan_fwt_reset_ioctl(wlan_private * priv)
502{ 584{
503 lbs_pr_debug(1, "FWT: resetting\n"); 585 lbs_deb_ioctl("FWT: resetting\n");
504 586
505 return (libertas_prepare_and_send_command(priv, 587 return (libertas_prepare_and_send_command(priv,
506 cmd_fwt_access, 588 cmd_fwt_access,
@@ -522,18 +604,21 @@ static int wlan_fwt_list_ioctl(wlan_private * priv, struct ifreq *req)
522 char *ptr = in_str; 604 char *ptr = in_str;
523 static char out_str[128]; 605 static char out_str[128];
524 char *pbuf = out_str; 606 char *pbuf = out_str;
525 int ret; 607 int ret = 0;
526 608
527 ENTER(); 609 lbs_deb_enter(LBS_DEB_IOCTL);
528 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) 610
529 return -EFAULT; 611 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) {
612 ret = -EFAULT;
613 goto out;
614 }
530 615
531 fwt_access.id = cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); 616 fwt_access.id = cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
532 617
533#ifdef DEBUG 618#ifdef DEBUG
534 { 619 {
535 lbs_pr_debug(1, "FWT_LIST: line is %s\n", in_str); 620 lbs_deb_ioctl("FWT_LIST: line is %s\n", in_str);
536 lbs_pr_debug(1, "FWT_LIST: listing id:%i\n", le32_to_cpu(fwt_access.id)); 621 lbs_deb_ioctl("FWT_LIST: listing id:%i\n", le32_to_cpu(fwt_access.id));
537 } 622 }
538#endif 623#endif
539 624
@@ -549,12 +634,16 @@ static int wlan_fwt_list_ioctl(wlan_private * priv, struct ifreq *req)
549 wrq->u.data.length = strlen(out_str); 634 wrq->u.data.length = strlen(out_str);
550 if (copy_to_user(wrq->u.data.pointer, (char *)out_str, 635 if (copy_to_user(wrq->u.data.pointer, (char *)out_str,
551 wrq->u.data.length)) { 636 wrq->u.data.length)) {
552 lbs_pr_debug(1, "FWT_LIST: Copy to user failed!\n"); 637 lbs_deb_ioctl("FWT_LIST: Copy to user failed!\n");
553 return -EFAULT; 638 ret = -EFAULT;
639 goto out;
554 } 640 }
555 641
556 LEAVE(); 642 ret = 0;
557 return 0; 643
644out:
645 lbs_deb_leave(LBS_DEB_IOCTL);
646 return ret;
558} 647}
559 648
560/** 649/**
@@ -573,7 +662,8 @@ static int wlan_fwt_list_route_ioctl(wlan_private * priv, struct ifreq *req)
573 char *pbuf = out_str; 662 char *pbuf = out_str;
574 int ret; 663 int ret;
575 664
576 ENTER(); 665 lbs_deb_enter(LBS_DEB_IOCTL);
666
577 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) 667 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
578 return -EFAULT; 668 return -EFAULT;
579 669
@@ -581,8 +671,8 @@ static int wlan_fwt_list_route_ioctl(wlan_private * priv, struct ifreq *req)
581 671
582#ifdef DEBUG 672#ifdef DEBUG
583 { 673 {
584 lbs_pr_debug(1, "FWT_LIST_ROUTE: line is %s\n", in_str); 674 lbs_deb_ioctl("FWT_LIST_ROUTE: line is %s\n", in_str);
585 lbs_pr_debug(1, "FWT_LIST_ROUTE: listing id:%i\n", le32_to_cpu(fwt_access.id)); 675 lbs_deb_ioctl("FWT_LIST_ROUTE: listing id:%i\n", le32_to_cpu(fwt_access.id));
586 } 676 }
587#endif 677#endif
588 678
@@ -591,28 +681,18 @@ static int wlan_fwt_list_route_ioctl(wlan_private * priv, struct ifreq *req)
591 cmd_option_waitforrsp, 0, (void *)&fwt_access); 681 cmd_option_waitforrsp, 0, (void *)&fwt_access);
592 682
593 if (ret == 0) { 683 if (ret == 0) {
594 pbuf += sprintf(pbuf, " "); 684 print_route(fwt_access, pbuf);
595 pbuf += eth_addr2str(fwt_access.da, pbuf);
596 pbuf += sprintf(pbuf, " %u", le32_to_cpu(fwt_access.metric));
597 pbuf += sprintf(pbuf, " %u", fwt_access.dir);
598 /* note that the firmware returns the nid in the id field */
599 pbuf += sprintf(pbuf, " %u", le32_to_cpu(fwt_access.id));
600 pbuf += sprintf(pbuf, " %u", le32_to_cpu(fwt_access.ssn));
601 pbuf += sprintf(pbuf, " %u", le32_to_cpu(fwt_access.dsn));
602 pbuf += sprintf(pbuf, " hop %u", fwt_access.hopcount);
603 pbuf += sprintf(pbuf, " ttl %u", fwt_access.ttl);
604 pbuf += sprintf(pbuf, " %u", le32_to_cpu(fwt_access.expiration));
605 } else 685 } else
606 pbuf += sprintf(pbuf, " (null)"); 686 pbuf += sprintf(pbuf, " (null)");
607 687
608 wrq->u.data.length = strlen(out_str); 688 wrq->u.data.length = strlen(out_str);
609 if (copy_to_user(wrq->u.data.pointer, (char *)out_str, 689 if (copy_to_user(wrq->u.data.pointer, (char *)out_str,
610 wrq->u.data.length)) { 690 wrq->u.data.length)) {
611 lbs_pr_debug(1, "FWT_LIST_ROUTE: Copy to user failed!\n"); 691 lbs_deb_ioctl("FWT_LIST_ROUTE: Copy to user failed!\n");
612 return -EFAULT; 692 return -EFAULT;
613 } 693 }
614 694
615 LEAVE(); 695 lbs_deb_leave(LBS_DEB_IOCTL);
616 return 0; 696 return 0;
617} 697}
618 698
@@ -632,7 +712,8 @@ static int wlan_fwt_list_neighbor_ioctl(wlan_private * priv, struct ifreq *req)
632 char *pbuf = out_str; 712 char *pbuf = out_str;
633 int ret; 713 int ret;
634 714
635 ENTER(); 715 lbs_deb_enter(LBS_DEB_IOCTL);
716
636 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) 717 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
637 return -EFAULT; 718 return -EFAULT;
638 719
@@ -641,8 +722,8 @@ static int wlan_fwt_list_neighbor_ioctl(wlan_private * priv, struct ifreq *req)
641 722
642#ifdef DEBUG 723#ifdef DEBUG
643 { 724 {
644 lbs_pr_debug(1, "FWT_LIST_NEIGHBOR: line is %s\n", in_str); 725 lbs_deb_ioctl("FWT_LIST_NEIGHBOR: line is %s\n", in_str);
645 lbs_pr_debug(1, "FWT_LIST_NEIGHBOR: listing id:%i\n", le32_to_cpu(fwt_access.id)); 726 lbs_deb_ioctl("FWT_LIST_NEIGHBOR: listing id:%i\n", le32_to_cpu(fwt_access.id));
646 } 727 }
647#endif 728#endif
648 729
@@ -663,11 +744,11 @@ static int wlan_fwt_list_neighbor_ioctl(wlan_private * priv, struct ifreq *req)
663 wrq->u.data.length = strlen(out_str); 744 wrq->u.data.length = strlen(out_str);
664 if (copy_to_user(wrq->u.data.pointer, (char *)out_str, 745 if (copy_to_user(wrq->u.data.pointer, (char *)out_str,
665 wrq->u.data.length)) { 746 wrq->u.data.length)) {
666 lbs_pr_debug(1, "FWT_LIST_NEIGHBOR: Copy to user failed!\n"); 747 lbs_deb_ioctl("FWT_LIST_NEIGHBOR: Copy to user failed!\n");
667 return -EFAULT; 748 return -EFAULT;
668 } 749 }
669 750
670 LEAVE(); 751 lbs_deb_leave(LBS_DEB_IOCTL);
671 return 0; 752 return 0;
672} 753}
673 754
@@ -684,9 +765,9 @@ static int wlan_fwt_cleanup_ioctl(wlan_private * priv, struct ifreq *req)
684 static struct cmd_ds_fwt_access fwt_access; 765 static struct cmd_ds_fwt_access fwt_access;
685 int ret; 766 int ret;
686 767
687 ENTER(); 768 lbs_deb_enter(LBS_DEB_IOCTL);
688 769
689 lbs_pr_debug(1, "FWT: cleaning up\n"); 770 lbs_deb_ioctl("FWT: cleaning up\n");
690 771
691 memset(&fwt_access, 0, sizeof(fwt_access)); 772 memset(&fwt_access, 0, sizeof(fwt_access));
692 773
@@ -700,7 +781,7 @@ static int wlan_fwt_cleanup_ioctl(wlan_private * priv, struct ifreq *req)
700 else 781 else
701 return -EFAULT; 782 return -EFAULT;
702 783
703 LEAVE(); 784 lbs_deb_leave(LBS_DEB_IOCTL);
704 return 0; 785 return 0;
705} 786}
706 787
@@ -716,9 +797,9 @@ static int wlan_fwt_time_ioctl(wlan_private * priv, struct ifreq *req)
716 static struct cmd_ds_fwt_access fwt_access; 797 static struct cmd_ds_fwt_access fwt_access;
717 int ret; 798 int ret;
718 799
719 ENTER(); 800 lbs_deb_enter(LBS_DEB_IOCTL);
720 801
721 lbs_pr_debug(1, "FWT: getting time\n"); 802 lbs_deb_ioctl("FWT: getting time\n");
722 803
723 memset(&fwt_access, 0, sizeof(fwt_access)); 804 memset(&fwt_access, 0, sizeof(fwt_access));
724 805
@@ -732,7 +813,7 @@ static int wlan_fwt_time_ioctl(wlan_private * priv, struct ifreq *req)
732 else 813 else
733 return -EFAULT; 814 return -EFAULT;
734 815
735 LEAVE(); 816 lbs_deb_leave(LBS_DEB_IOCTL);
736 return 0; 817 return 0;
737} 818}
738 819
@@ -748,7 +829,7 @@ static int wlan_mesh_get_ttl_ioctl(wlan_private * priv, struct ifreq *req)
748 struct cmd_ds_mesh_access mesh_access; 829 struct cmd_ds_mesh_access mesh_access;
749 int ret; 830 int ret;
750 831
751 ENTER(); 832 lbs_deb_enter(LBS_DEB_IOCTL);
752 833
753 memset(&mesh_access, 0, sizeof(mesh_access)); 834 memset(&mesh_access, 0, sizeof(mesh_access));
754 835
@@ -762,7 +843,7 @@ static int wlan_mesh_get_ttl_ioctl(wlan_private * priv, struct ifreq *req)
762 else 843 else
763 return -EFAULT; 844 return -EFAULT;
764 845
765 LEAVE(); 846 lbs_deb_leave(LBS_DEB_IOCTL);
766 return 0; 847 return 0;
767} 848}
768 849
@@ -777,13 +858,13 @@ static int wlan_mesh_set_ttl_ioctl(wlan_private * priv, int ttl)
777 struct cmd_ds_mesh_access mesh_access; 858 struct cmd_ds_mesh_access mesh_access;
778 int ret; 859 int ret;
779 860
780 ENTER(); 861 lbs_deb_enter(LBS_DEB_IOCTL);
781 862
782 if( (ttl > 0xff) || (ttl < 0) ) 863 if( (ttl > 0xff) || (ttl < 0) )
783 return -EINVAL; 864 return -EINVAL;
784 865
785 memset(&mesh_access, 0, sizeof(mesh_access)); 866 memset(&mesh_access, 0, sizeof(mesh_access));
786 mesh_access.data[0] = ttl; 867 mesh_access.data[0] = cpu_to_le32(ttl);
787 868
788 ret = libertas_prepare_and_send_command(priv, cmd_mesh_access, 869 ret = libertas_prepare_and_send_command(priv, cmd_mesh_access,
789 cmd_act_mesh_set_ttl, 870 cmd_act_mesh_set_ttl,
@@ -793,7 +874,7 @@ static int wlan_mesh_set_ttl_ioctl(wlan_private * priv, int ttl)
793 if (ret != 0) 874 if (ret != 0)
794 ret = -EFAULT; 875 ret = -EFAULT;
795 876
796 LEAVE(); 877 lbs_deb_leave(LBS_DEB_IOCTL);
797 return ret; 878 return ret;
798} 879}
799 880
@@ -815,9 +896,9 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
815 wlan_adapter *adapter = priv->adapter; 896 wlan_adapter *adapter = priv->adapter;
816 struct iwreq *wrq = (struct iwreq *)req; 897 struct iwreq *wrq = (struct iwreq *)req;
817 898
818 ENTER(); 899 lbs_deb_enter(LBS_DEB_IOCTL);
819 900
820 lbs_pr_debug(1, "libertas_do_ioctl: ioctl cmd = 0x%x\n", cmd); 901 lbs_deb_ioctl("libertas_do_ioctl: ioctl cmd = 0x%x\n", cmd);
821 switch (cmd) { 902 switch (cmd) {
822 case WLAN_SETNONE_GETNONE: /* set WPA mode on/off ioctl #20 */ 903 case WLAN_SETNONE_GETNONE: /* set WPA mode on/off ioctl #20 */
823 switch (wrq->u.data.flags) { 904 switch (wrq->u.data.flags) {
@@ -848,6 +929,10 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
848 ret = wlan_mesh_set_ttl_ioctl(priv, idata); 929 ret = wlan_mesh_set_ttl_ioctl(priv, idata);
849 break; 930 break;
850 931
932 case WLAN_SUBCMD_BT_SET_INVERT:
933 ret = wlan_bt_set_invert_ioctl(priv, req);
934 break ;
935
851 default: 936 default:
852 ret = -EOPNOTSUPP; 937 ret = -EOPNOTSUPP;
853 break; 938 break;
@@ -905,6 +990,10 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
905 ret = wlan_mesh_get_ttl_ioctl(priv, req); 990 ret = wlan_mesh_get_ttl_ioctl(priv, req);
906 break; 991 break;
907 992
993 case WLAN_SUBCMD_BT_GET_INVERT:
994 ret = wlan_bt_get_invert_ioctl(priv, req);
995 break ;
996
908 default: 997 default:
909 ret = -EOPNOTSUPP; 998 ret = -EOPNOTSUPP;
910 999
@@ -937,7 +1026,7 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
937 (data, wrq->u.data.pointer, 1026 (data, wrq->u.data.pointer,
938 sizeof(int) * 1027 sizeof(int) *
939 wrq->u.data.length)) { 1028 wrq->u.data.length)) {
940 lbs_pr_debug(1, 1029 lbs_deb_ioctl(
941 "Copy from user failed\n"); 1030 "Copy from user failed\n");
942 return -EFAULT; 1031 return -EFAULT;
943 } 1032 }
@@ -970,7 +1059,7 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
970 if (copy_to_user(wrq->u.data.pointer, data, 1059 if (copy_to_user(wrq->u.data.pointer, data,
971 sizeof(int) * 1060 sizeof(int) *
972 gpio->header.len)) { 1061 gpio->header.len)) {
973 lbs_pr_debug(1, "Copy to user failed\n"); 1062 lbs_deb_ioctl("Copy to user failed\n");
974 return -EFAULT; 1063 return -EFAULT;
975 } 1064 }
976 1065
@@ -984,7 +1073,8 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
984 ret = -EINVAL; 1073 ret = -EINVAL;
985 break; 1074 break;
986 } 1075 }
987 LEAVE(); 1076
1077 lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
988 return ret; 1078 return ret;
989} 1079}
990 1080
diff --git a/drivers/net/wireless/libertas/join.c b/drivers/net/wireless/libertas/join.c
index d4926b83e145..78ac3064a0bd 100644
--- a/drivers/net/wireless/libertas/join.c
+++ b/drivers/net/wireless/libertas/join.c
@@ -7,6 +7,7 @@
7#include <linux/netdevice.h> 7#include <linux/netdevice.h>
8#include <linux/if_arp.h> 8#include <linux/if_arp.h>
9#include <linux/wireless.h> 9#include <linux/wireless.h>
10#include <linux/etherdevice.h>
10 11
11#include <net/iw_handler.h> 12#include <net/iw_handler.h>
12 13
@@ -14,6 +15,7 @@
14#include "decl.h" 15#include "decl.h"
15#include "join.h" 16#include "join.h"
16#include "dev.h" 17#include "dev.h"
18#include "assoc.h"
17 19
18#define AD_HOC_CAP_PRIVACY_ON 1 20#define AD_HOC_CAP_PRIVACY_ON 1
19 21
@@ -60,7 +62,7 @@ static int get_common_rates(wlan_adapter * adapter, u8 * rate1,
60 lbs_dbg_hex("rate1 (AP) rates:", tmp, sizeof(tmp)); 62 lbs_dbg_hex("rate1 (AP) rates:", tmp, sizeof(tmp));
61 lbs_dbg_hex("rate2 (Card) rates:", rate2, rate2_size); 63 lbs_dbg_hex("rate2 (Card) rates:", rate2, rate2_size);
62 lbs_dbg_hex("Common rates:", ptr, rate1_size); 64 lbs_dbg_hex("Common rates:", ptr, rate1_size);
63 lbs_pr_debug(1, "Tx datarate is set to 0x%X\n", adapter->datarate); 65 lbs_deb_join("Tx datarate is set to 0x%X\n", adapter->datarate);
64 66
65 if (!adapter->is_datarate_auto) { 67 if (!adapter->is_datarate_auto) {
66 while (*ptr) { 68 while (*ptr) {
@@ -104,24 +106,22 @@ int libertas_send_deauth(wlan_private * priv)
104 * 106 *
105 * @return 0-success, otherwise fail 107 * @return 0-success, otherwise fail
106 */ 108 */
107int wlan_associate(wlan_private * priv, struct bss_descriptor * pbssdesc) 109int wlan_associate(wlan_private * priv, struct assoc_request * assoc_req)
108{ 110{
109 wlan_adapter *adapter = priv->adapter; 111 wlan_adapter *adapter = priv->adapter;
110 int ret; 112 int ret;
111 113
112 ENTER(); 114 lbs_deb_enter(LBS_DEB_JOIN);
113 115
114 ret = libertas_prepare_and_send_command(priv, cmd_802_11_authenticate, 116 ret = libertas_prepare_and_send_command(priv, cmd_802_11_authenticate,
115 0, cmd_option_waitforrsp, 117 0, cmd_option_waitforrsp,
116 0, pbssdesc->macaddress); 118 0, assoc_req->bss.bssid);
117 119
118 if (ret) { 120 if (ret)
119 LEAVE(); 121 goto done;
120 return ret;
121 }
122 122
123 /* set preamble to firmware */ 123 /* set preamble to firmware */
124 if (adapter->capinfo.shortpreamble && pbssdesc->cap.shortpreamble) 124 if (adapter->capinfo.shortpreamble && assoc_req->bss.cap.shortpreamble)
125 adapter->preamble = cmd_type_short_preamble; 125 adapter->preamble = cmd_type_short_preamble;
126 else 126 else
127 adapter->preamble = cmd_type_long_preamble; 127 adapter->preamble = cmd_type_long_preamble;
@@ -129,9 +129,10 @@ int wlan_associate(wlan_private * priv, struct bss_descriptor * pbssdesc)
129 libertas_set_radio_control(priv); 129 libertas_set_radio_control(priv);
130 130
131 ret = libertas_prepare_and_send_command(priv, cmd_802_11_associate, 131 ret = libertas_prepare_and_send_command(priv, cmd_802_11_associate,
132 0, cmd_option_waitforrsp, 0, pbssdesc); 132 0, cmd_option_waitforrsp, 0, assoc_req);
133 133
134 LEAVE(); 134done:
135 lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
135 return ret; 136 return ret;
136} 137}
137 138
@@ -142,7 +143,7 @@ int wlan_associate(wlan_private * priv, struct bss_descriptor * pbssdesc)
142 * @param adhocssid The ssid of the Adhoc Network 143 * @param adhocssid The ssid of the Adhoc Network
143 * @return 0--success, -1--fail 144 * @return 0--success, -1--fail
144 */ 145 */
145int libertas_start_adhoc_network(wlan_private * priv, struct WLAN_802_11_SSID *adhocssid) 146int libertas_start_adhoc_network(wlan_private * priv, struct assoc_request * assoc_req)
146{ 147{
147 wlan_adapter *adapter = priv->adapter; 148 wlan_adapter *adapter = priv->adapter;
148 int ret = 0; 149 int ret = 0;
@@ -150,22 +151,20 @@ int libertas_start_adhoc_network(wlan_private * priv, struct WLAN_802_11_SSID *a
150 adapter->adhoccreate = 1; 151 adapter->adhoccreate = 1;
151 152
152 if (!adapter->capinfo.shortpreamble) { 153 if (!adapter->capinfo.shortpreamble) {
153 lbs_pr_debug(1, "AdhocStart: Long preamble\n"); 154 lbs_deb_join("AdhocStart: Long preamble\n");
154 adapter->preamble = cmd_type_long_preamble; 155 adapter->preamble = cmd_type_long_preamble;
155 } else { 156 } else {
156 lbs_pr_debug(1, "AdhocStart: Short preamble\n"); 157 lbs_deb_join("AdhocStart: Short preamble\n");
157 adapter->preamble = cmd_type_short_preamble; 158 adapter->preamble = cmd_type_short_preamble;
158 } 159 }
159 160
160 libertas_set_radio_control(priv); 161 libertas_set_radio_control(priv);
161 162
162 lbs_pr_debug(1, "Adhoc channel = %d\n", adapter->adhocchannel); 163 lbs_deb_join("AdhocStart: channel = %d\n", assoc_req->channel);
163 lbs_pr_debug(1, "curbssparams.channel = %d\n", 164 lbs_deb_join("AdhocStart: band = %d\n", assoc_req->band);
164 adapter->curbssparams.channel);
165 lbs_pr_debug(1, "curbssparams.band = %d\n", adapter->curbssparams.band);
166 165
167 ret = libertas_prepare_and_send_command(priv, cmd_802_11_ad_hoc_start, 166 ret = libertas_prepare_and_send_command(priv, cmd_802_11_ad_hoc_start,
168 0, cmd_option_waitforrsp, 0, adhocssid); 167 0, cmd_option_waitforrsp, 0, assoc_req);
169 168
170 return ret; 169 return ret;
171} 170}
@@ -179,52 +178,53 @@ int libertas_start_adhoc_network(wlan_private * priv, struct WLAN_802_11_SSID *a
179 * 178 *
180 * @return 0--success, -1--fail 179 * @return 0--success, -1--fail
181 */ 180 */
182int libertas_join_adhoc_network(wlan_private * priv, struct bss_descriptor * pbssdesc) 181int libertas_join_adhoc_network(wlan_private * priv, struct assoc_request * assoc_req)
183{ 182{
184 wlan_adapter *adapter = priv->adapter; 183 wlan_adapter *adapter = priv->adapter;
184 struct bss_descriptor * bss = &assoc_req->bss;
185 int ret = 0; 185 int ret = 0;
186 186
187 lbs_pr_debug(1, "libertas_join_adhoc_network: CurBss.ssid =%s\n", 187 lbs_deb_join("%s: Current SSID '%s', ssid length %u\n",
188 adapter->curbssparams.ssid.ssid); 188 __func__,
189 lbs_pr_debug(1, "libertas_join_adhoc_network: CurBss.ssid_len =%u\n", 189 escape_essid(adapter->curbssparams.ssid,
190 adapter->curbssparams.ssid.ssidlength); 190 adapter->curbssparams.ssid_len),
191 lbs_pr_debug(1, "libertas_join_adhoc_network: ssid =%s\n", pbssdesc->ssid.ssid); 191 adapter->curbssparams.ssid_len);
192 lbs_pr_debug(1, "libertas_join_adhoc_network: ssid len =%u\n", 192 lbs_deb_join("%s: requested ssid '%s', ssid length %u\n",
193 pbssdesc->ssid.ssidlength); 193 __func__, escape_essid(bss->ssid, bss->ssid_len),
194 bss->ssid_len);
194 195
195 /* check if the requested SSID is already joined */ 196 /* check if the requested SSID is already joined */
196 if (adapter->curbssparams.ssid.ssidlength 197 if (adapter->curbssparams.ssid_len
197 && !libertas_SSID_cmp(&pbssdesc->ssid, &adapter->curbssparams.ssid) 198 && !libertas_ssid_cmp(adapter->curbssparams.ssid,
199 adapter->curbssparams.ssid_len,
200 bss->ssid, bss->ssid_len)
198 && (adapter->mode == IW_MODE_ADHOC)) { 201 && (adapter->mode == IW_MODE_ADHOC)) {
199 202 lbs_deb_join(
200 lbs_pr_debug(1,
201 "ADHOC_J_CMD: New ad-hoc SSID is the same as current, " 203 "ADHOC_J_CMD: New ad-hoc SSID is the same as current, "
202 "not attempting to re-join"); 204 "not attempting to re-join");
203
204 return -1; 205 return -1;
205 } 206 }
206 207
207 /*Use shortpreamble only when both creator and card supports 208 /*Use shortpreamble only when both creator and card supports
208 short preamble */ 209 short preamble */
209 if (!pbssdesc->cap.shortpreamble || !adapter->capinfo.shortpreamble) { 210 if (!bss->cap.shortpreamble || !adapter->capinfo.shortpreamble) {
210 lbs_pr_debug(1, "AdhocJoin: Long preamble\n"); 211 lbs_deb_join("AdhocJoin: Long preamble\n");
211 adapter->preamble = cmd_type_long_preamble; 212 adapter->preamble = cmd_type_long_preamble;
212 } else { 213 } else {
213 lbs_pr_debug(1, "AdhocJoin: Short preamble\n"); 214 lbs_deb_join("AdhocJoin: Short preamble\n");
214 adapter->preamble = cmd_type_short_preamble; 215 adapter->preamble = cmd_type_short_preamble;
215 } 216 }
216 217
217 libertas_set_radio_control(priv); 218 libertas_set_radio_control(priv);
218 219
219 lbs_pr_debug(1, "curbssparams.channel = %d\n", 220 lbs_deb_join("AdhocJoin: channel = %d\n", assoc_req->channel);
220 adapter->curbssparams.channel); 221 lbs_deb_join("AdhocJoin: band = %c\n", assoc_req->band);
221 lbs_pr_debug(1, "curbssparams.band = %c\n", adapter->curbssparams.band);
222 222
223 adapter->adhoccreate = 0; 223 adapter->adhoccreate = 0;
224 224
225 ret = libertas_prepare_and_send_command(priv, cmd_802_11_ad_hoc_join, 225 ret = libertas_prepare_and_send_command(priv, cmd_802_11_ad_hoc_join,
226 0, cmd_option_waitforrsp, 226 0, cmd_option_waitforrsp,
227 OID_802_11_SSID, pbssdesc); 227 OID_802_11_SSID, assoc_req);
228 228
229 return ret; 229 return ret;
230} 230}
@@ -265,6 +265,8 @@ int libertas_cmd_80211_authenticate(wlan_private * priv,
265 int ret = -1; 265 int ret = -1;
266 u8 *bssid = pdata_buf; 266 u8 *bssid = pdata_buf;
267 267
268 lbs_deb_enter(LBS_DEB_JOIN);
269
268 cmd->command = cpu_to_le16(cmd_802_11_authenticate); 270 cmd->command = cpu_to_le16(cmd_802_11_authenticate);
269 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_authenticate) 271 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_authenticate)
270 + S_DS_GEN); 272 + S_DS_GEN);
@@ -281,18 +283,19 @@ int libertas_cmd_80211_authenticate(wlan_private * priv,
281 pauthenticate->authtype = 0x80; 283 pauthenticate->authtype = 0x80;
282 break; 284 break;
283 default: 285 default:
284 lbs_pr_debug(1, "AUTH_CMD: invalid auth alg 0x%X\n", 286 lbs_deb_join("AUTH_CMD: invalid auth alg 0x%X\n",
285 adapter->secinfo.auth_mode); 287 adapter->secinfo.auth_mode);
286 goto out; 288 goto out;
287 } 289 }
288 290
289 memcpy(pauthenticate->macaddr, bssid, ETH_ALEN); 291 memcpy(pauthenticate->macaddr, bssid, ETH_ALEN);
290 292
291 lbs_pr_debug(1, "AUTH_CMD: Bssid is : %x:%x:%x:%x:%x:%x\n", 293 lbs_deb_join("AUTH_CMD: BSSID is : " MAC_FMT " auth=0x%X\n",
292 bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], bssid[5]); 294 MAC_ARG(bssid), pauthenticate->authtype);
293 ret = 0; 295 ret = 0;
294 296
295out: 297out:
298 lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
296 return ret; 299 return ret;
297} 300}
298 301
@@ -302,22 +305,20 @@ int libertas_cmd_80211_deauthenticate(wlan_private * priv,
302 wlan_adapter *adapter = priv->adapter; 305 wlan_adapter *adapter = priv->adapter;
303 struct cmd_ds_802_11_deauthenticate *dauth = &cmd->params.deauth; 306 struct cmd_ds_802_11_deauthenticate *dauth = &cmd->params.deauth;
304 307
305 ENTER(); 308 lbs_deb_enter(LBS_DEB_JOIN);
306 309
307 cmd->command = cpu_to_le16(cmd_802_11_deauthenticate); 310 cmd->command = cpu_to_le16(cmd_802_11_deauthenticate);
308 cmd->size = 311 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_deauthenticate) +
309 cpu_to_le16(sizeof(struct cmd_ds_802_11_deauthenticate) +
310 S_DS_GEN); 312 S_DS_GEN);
311 313
312 /* set AP MAC address */ 314 /* set AP MAC address */
313 memmove(dauth->macaddr, adapter->curbssparams.bssid, 315 memmove(dauth->macaddr, adapter->curbssparams.bssid, ETH_ALEN);
314 ETH_ALEN);
315 316
316 /* Reason code 3 = Station is leaving */ 317 /* Reason code 3 = Station is leaving */
317#define REASON_CODE_STA_LEAVING 3 318#define REASON_CODE_STA_LEAVING 3
318 dauth->reasoncode = cpu_to_le16(REASON_CODE_STA_LEAVING); 319 dauth->reasoncode = cpu_to_le16(REASON_CODE_STA_LEAVING);
319 320
320 LEAVE(); 321 lbs_deb_leave(LBS_DEB_JOIN);
321 return 0; 322 return 0;
322} 323}
323 324
@@ -327,20 +328,20 @@ int libertas_cmd_80211_associate(wlan_private * priv,
327 wlan_adapter *adapter = priv->adapter; 328 wlan_adapter *adapter = priv->adapter;
328 struct cmd_ds_802_11_associate *passo = &cmd->params.associate; 329 struct cmd_ds_802_11_associate *passo = &cmd->params.associate;
329 int ret = 0; 330 int ret = 0;
330 struct bss_descriptor *pbssdesc; 331 struct assoc_request * assoc_req = pdata_buf;
332 struct bss_descriptor * bss = &assoc_req->bss;
331 u8 *card_rates; 333 u8 *card_rates;
332 u8 *pos; 334 u8 *pos;
333 int card_rates_size; 335 int card_rates_size;
334 u16 tmpcap; 336 u16 tmpcap, tmplen;
335 struct mrvlietypes_ssidparamset *ssid; 337 struct mrvlietypes_ssidparamset *ssid;
336 struct mrvlietypes_phyparamset *phy; 338 struct mrvlietypes_phyparamset *phy;
337 struct mrvlietypes_ssparamset *ss; 339 struct mrvlietypes_ssparamset *ss;
338 struct mrvlietypes_ratesparamset *rates; 340 struct mrvlietypes_ratesparamset *rates;
339 struct mrvlietypes_rsnparamset *rsn; 341 struct mrvlietypes_rsnparamset *rsn;
340 342
341 ENTER(); 343 lbs_deb_enter(LBS_DEB_JOIN);
342 344
343 pbssdesc = pdata_buf;
344 pos = (u8 *) passo; 345 pos = (u8 *) passo;
345 346
346 if (!adapter) { 347 if (!adapter) {
@@ -350,15 +351,11 @@ int libertas_cmd_80211_associate(wlan_private * priv,
350 351
351 cmd->command = cpu_to_le16(cmd_802_11_associate); 352 cmd->command = cpu_to_le16(cmd_802_11_associate);
352 353
353 /* Save so we know which BSS Desc to use in the response handler */ 354 memcpy(passo->peerstaaddr, bss->bssid, sizeof(passo->peerstaaddr));
354 adapter->pattemptedbssdesc = pbssdesc;
355
356 memcpy(passo->peerstaaddr,
357 pbssdesc->macaddress, sizeof(passo->peerstaaddr));
358 pos += sizeof(passo->peerstaaddr); 355 pos += sizeof(passo->peerstaaddr);
359 356
360 /* set the listen interval */ 357 /* set the listen interval */
361 passo->listeninterval = adapter->listeninterval; 358 passo->listeninterval = cpu_to_le16(adapter->listeninterval);
362 359
363 pos += sizeof(passo->capinfo); 360 pos += sizeof(passo->capinfo);
364 pos += sizeof(passo->listeninterval); 361 pos += sizeof(passo->listeninterval);
@@ -367,30 +364,30 @@ int libertas_cmd_80211_associate(wlan_private * priv,
367 364
368 ssid = (struct mrvlietypes_ssidparamset *) pos; 365 ssid = (struct mrvlietypes_ssidparamset *) pos;
369 ssid->header.type = cpu_to_le16(TLV_TYPE_SSID); 366 ssid->header.type = cpu_to_le16(TLV_TYPE_SSID);
370 ssid->header.len = pbssdesc->ssid.ssidlength; 367 tmplen = bss->ssid_len;
371 memcpy(ssid->ssid, pbssdesc->ssid.ssid, ssid->header.len); 368 ssid->header.len = cpu_to_le16(tmplen);
372 pos += sizeof(ssid->header) + ssid->header.len; 369 memcpy(ssid->ssid, bss->ssid, tmplen);
373 ssid->header.len = cpu_to_le16(ssid->header.len); 370 pos += sizeof(ssid->header) + tmplen;
374 371
375 phy = (struct mrvlietypes_phyparamset *) pos; 372 phy = (struct mrvlietypes_phyparamset *) pos;
376 phy->header.type = cpu_to_le16(TLV_TYPE_PHY_DS); 373 phy->header.type = cpu_to_le16(TLV_TYPE_PHY_DS);
377 phy->header.len = sizeof(phy->fh_ds.dsparamset); 374 tmplen = sizeof(phy->fh_ds.dsparamset);
375 phy->header.len = cpu_to_le16(tmplen);
378 memcpy(&phy->fh_ds.dsparamset, 376 memcpy(&phy->fh_ds.dsparamset,
379 &pbssdesc->phyparamset.dsparamset.currentchan, 377 &bss->phyparamset.dsparamset.currentchan,
380 sizeof(phy->fh_ds.dsparamset)); 378 tmplen);
381 pos += sizeof(phy->header) + phy->header.len; 379 pos += sizeof(phy->header) + tmplen;
382 phy->header.len = cpu_to_le16(phy->header.len);
383 380
384 ss = (struct mrvlietypes_ssparamset *) pos; 381 ss = (struct mrvlietypes_ssparamset *) pos;
385 ss->header.type = cpu_to_le16(TLV_TYPE_CF); 382 ss->header.type = cpu_to_le16(TLV_TYPE_CF);
386 ss->header.len = sizeof(ss->cf_ibss.cfparamset); 383 tmplen = sizeof(ss->cf_ibss.cfparamset);
387 pos += sizeof(ss->header) + ss->header.len; 384 ss->header.len = cpu_to_le16(tmplen);
388 ss->header.len = cpu_to_le16(ss->header.len); 385 pos += sizeof(ss->header) + tmplen;
389 386
390 rates = (struct mrvlietypes_ratesparamset *) pos; 387 rates = (struct mrvlietypes_ratesparamset *) pos;
391 rates->header.type = cpu_to_le16(TLV_TYPE_RATES); 388 rates->header.type = cpu_to_le16(TLV_TYPE_RATES);
392 389
393 memcpy(&rates->rates, &pbssdesc->libertas_supported_rates, WLAN_SUPPORTED_RATES); 390 memcpy(&rates->rates, &bss->libertas_supported_rates, WLAN_SUPPORTED_RATES);
394 391
395 card_rates = libertas_supported_rates; 392 card_rates = libertas_supported_rates;
396 card_rates_size = sizeof(libertas_supported_rates); 393 card_rates_size = sizeof(libertas_supported_rates);
@@ -401,41 +398,42 @@ int libertas_cmd_80211_associate(wlan_private * priv,
401 goto done; 398 goto done;
402 } 399 }
403 400
404 rates->header.len = min_t(size_t, strlen(rates->rates), WLAN_SUPPORTED_RATES); 401 tmplen = min_t(size_t, strlen(rates->rates), WLAN_SUPPORTED_RATES);
405 adapter->curbssparams.numofrates = rates->header.len; 402 adapter->curbssparams.numofrates = tmplen;
406 403
407 pos += sizeof(rates->header) + rates->header.len; 404 pos += sizeof(rates->header) + tmplen;
408 rates->header.len = cpu_to_le16(rates->header.len); 405 rates->header.len = cpu_to_le16(tmplen);
409 406
410 if (adapter->secinfo.WPAenabled || adapter->secinfo.WPA2enabled) { 407 if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) {
411 rsn = (struct mrvlietypes_rsnparamset *) pos; 408 rsn = (struct mrvlietypes_rsnparamset *) pos;
412 rsn->header.type = (u16) adapter->wpa_ie[0]; /* WPA_IE or WPA2_IE */ 409 /* WPA_IE or WPA2_IE */
413 rsn->header.type = cpu_to_le16(rsn->header.type); 410 rsn->header.type = cpu_to_le16((u16) assoc_req->wpa_ie[0]);
414 rsn->header.len = (u16) adapter->wpa_ie[1]; 411 tmplen = (u16) assoc_req->wpa_ie[1];
415 memcpy(rsn->rsnie, &adapter->wpa_ie[2], rsn->header.len); 412 rsn->header.len = cpu_to_le16(tmplen);
413 memcpy(rsn->rsnie, &assoc_req->wpa_ie[2], tmplen);
416 lbs_dbg_hex("ASSOC_CMD: RSN IE", (u8 *) rsn, 414 lbs_dbg_hex("ASSOC_CMD: RSN IE", (u8 *) rsn,
417 sizeof(rsn->header) + rsn->header.len); 415 sizeof(rsn->header) + tmplen);
418 pos += sizeof(rsn->header) + rsn->header.len; 416 pos += sizeof(rsn->header) + tmplen;
419 rsn->header.len = cpu_to_le16(rsn->header.len);
420 } 417 }
421 418
422 /* update curbssparams */ 419 /* update curbssparams */
423 adapter->curbssparams.channel = 420 adapter->curbssparams.channel = bss->phyparamset.dsparamset.currentchan;
424 (pbssdesc->phyparamset.dsparamset.currentchan);
425 421
426 /* Copy the infra. association rates into Current BSS state structure */ 422 /* Copy the infra. association rates into Current BSS state structure */
427 memcpy(&adapter->curbssparams.datarates, &rates->rates, 423 memcpy(&adapter->curbssparams.datarates, &rates->rates,
428 min_t(size_t, sizeof(adapter->curbssparams.datarates), rates->header.len)); 424 min_t(size_t, sizeof(adapter->curbssparams.datarates),
425 cpu_to_le16(rates->header.len)));
429 426
430 lbs_pr_debug(1, "ASSOC_CMD: rates->header.len = %d\n", rates->header.len); 427 lbs_deb_join("ASSOC_CMD: rates->header.len = %d\n",
428 cpu_to_le16(rates->header.len));
431 429
432 /* set IBSS field */ 430 /* set IBSS field */
433 if (pbssdesc->mode == IW_MODE_INFRA) { 431 if (bss->mode == IW_MODE_INFRA) {
434#define CAPINFO_ESS_MODE 1 432#define CAPINFO_ESS_MODE 1
435 passo->capinfo.ess = CAPINFO_ESS_MODE; 433 passo->capinfo.ess = CAPINFO_ESS_MODE;
436 } 434 }
437 435
438 if (libertas_parse_dnld_countryinfo_11d(priv)) { 436 if (libertas_parse_dnld_countryinfo_11d(priv, bss)) {
439 ret = -1; 437 ret = -1;
440 goto done; 438 goto done;
441 } 439 }
@@ -443,31 +441,28 @@ int libertas_cmd_80211_associate(wlan_private * priv,
443 cmd->size = cpu_to_le16((u16) (pos - (u8 *) passo) + S_DS_GEN); 441 cmd->size = cpu_to_le16((u16) (pos - (u8 *) passo) + S_DS_GEN);
444 442
445 /* set the capability info at last */ 443 /* set the capability info at last */
446 memcpy(&tmpcap, &pbssdesc->cap, sizeof(passo->capinfo)); 444 memcpy(&tmpcap, &bss->cap, sizeof(passo->capinfo));
447 tmpcap &= CAPINFO_MASK; 445 tmpcap &= CAPINFO_MASK;
448 lbs_pr_debug(1, "ASSOC_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n", 446 lbs_deb_join("ASSOC_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n",
449 tmpcap, CAPINFO_MASK); 447 tmpcap, CAPINFO_MASK);
450 tmpcap = cpu_to_le16(tmpcap);
451 memcpy(&passo->capinfo, &tmpcap, sizeof(passo->capinfo)); 448 memcpy(&passo->capinfo, &tmpcap, sizeof(passo->capinfo));
452 449
453 done: 450done:
454 LEAVE(); 451 lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
455 return ret; 452 return ret;
456} 453}
457 454
458int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, 455int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
459 struct cmd_ds_command *cmd, void *pssid) 456 struct cmd_ds_command *cmd, void *pdata_buf)
460{ 457{
461 wlan_adapter *adapter = priv->adapter; 458 wlan_adapter *adapter = priv->adapter;
462 struct cmd_ds_802_11_ad_hoc_start *adhs = &cmd->params.ads; 459 struct cmd_ds_802_11_ad_hoc_start *adhs = &cmd->params.ads;
463 int ret = 0; 460 int ret = 0;
464 int cmdappendsize = 0; 461 int cmdappendsize = 0;
465 int i; 462 int i;
466 u16 tmpcap; 463 struct assoc_request * assoc_req = pdata_buf;
467 struct bss_descriptor *pbssdesc;
468 struct WLAN_802_11_SSID *ssid = pssid;
469 464
470 ENTER(); 465 lbs_deb_enter(LBS_DEB_JOIN);
471 466
472 if (!adapter) { 467 if (!adapter) {
473 ret = -1; 468 ret = -1;
@@ -476,9 +471,6 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
476 471
477 cmd->command = cpu_to_le16(cmd_802_11_ad_hoc_start); 472 cmd->command = cpu_to_le16(cmd_802_11_ad_hoc_start);
478 473
479 pbssdesc = &adapter->curbssparams.bssdescriptor;
480 adapter->pattemptedbssdesc = pbssdesc;
481
482 /* 474 /*
483 * Fill in the parameters for 2 data structures: 475 * Fill in the parameters for 2 data structures:
484 * 1. cmd_ds_802_11_ad_hoc_start command 476 * 1. cmd_ds_802_11_ad_hoc_start command
@@ -492,20 +484,16 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
492 */ 484 */
493 485
494 memset(adhs->SSID, 0, IW_ESSID_MAX_SIZE); 486 memset(adhs->SSID, 0, IW_ESSID_MAX_SIZE);
487 memcpy(adhs->SSID, assoc_req->ssid, assoc_req->ssid_len);
495 488
496 memcpy(adhs->SSID, ssid->ssid, ssid->ssidlength); 489 lbs_deb_join("ADHOC_S_CMD: SSID '%s', ssid length %u\n",
497 490 escape_essid(assoc_req->ssid, assoc_req->ssid_len),
498 lbs_pr_debug(1, "ADHOC_S_CMD: SSID = %s\n", adhs->SSID); 491 assoc_req->ssid_len);
499
500 memset(pbssdesc->ssid.ssid, 0, IW_ESSID_MAX_SIZE);
501 memcpy(pbssdesc->ssid.ssid, ssid->ssid, ssid->ssidlength);
502
503 pbssdesc->ssid.ssidlength = ssid->ssidlength;
504 492
505 /* set the BSS type */ 493 /* set the BSS type */
506 adhs->bsstype = cmd_bss_type_ibss; 494 adhs->bsstype = cmd_bss_type_ibss;
507 pbssdesc->mode = IW_MODE_ADHOC; 495 adapter->mode = IW_MODE_ADHOC;
508 adhs->beaconperiod = adapter->beaconperiod; 496 adhs->beaconperiod = cpu_to_le16(adapter->beaconperiod);
509 497
510 /* set Physical param set */ 498 /* set Physical param set */
511#define DS_PARA_IE_ID 3 499#define DS_PARA_IE_ID 3
@@ -514,18 +502,12 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
514 adhs->phyparamset.dsparamset.elementid = DS_PARA_IE_ID; 502 adhs->phyparamset.dsparamset.elementid = DS_PARA_IE_ID;
515 adhs->phyparamset.dsparamset.len = DS_PARA_IE_LEN; 503 adhs->phyparamset.dsparamset.len = DS_PARA_IE_LEN;
516 504
517 WARN_ON(!adapter->adhocchannel); 505 WARN_ON(!assoc_req->channel);
518 506
519 lbs_pr_debug(1, "ADHOC_S_CMD: Creating ADHOC on channel %d\n", 507 lbs_deb_join("ADHOC_S_CMD: Creating ADHOC on channel %d\n",
520 adapter->adhocchannel); 508 assoc_req->channel);
521 509
522 adapter->curbssparams.channel = adapter->adhocchannel; 510 adhs->phyparamset.dsparamset.currentchan = assoc_req->channel;
523
524 pbssdesc->channel = adapter->adhocchannel;
525 adhs->phyparamset.dsparamset.currentchan = adapter->adhocchannel;
526
527 memcpy(&pbssdesc->phyparamset,
528 &adhs->phyparamset, sizeof(union ieeetypes_phyparamset));
529 511
530 /* set IBSS param set */ 512 /* set IBSS param set */
531#define IBSS_PARA_IE_ID 6 513#define IBSS_PARA_IE_ID 6
@@ -533,26 +515,21 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
533 515
534 adhs->ssparamset.ibssparamset.elementid = IBSS_PARA_IE_ID; 516 adhs->ssparamset.ibssparamset.elementid = IBSS_PARA_IE_ID;
535 adhs->ssparamset.ibssparamset.len = IBSS_PARA_IE_LEN; 517 adhs->ssparamset.ibssparamset.len = IBSS_PARA_IE_LEN;
536 adhs->ssparamset.ibssparamset.atimwindow = adapter->atimwindow; 518 adhs->ssparamset.ibssparamset.atimwindow = cpu_to_le16(adapter->atimwindow);
537 memcpy(&pbssdesc->ssparamset,
538 &adhs->ssparamset, sizeof(union IEEEtypes_ssparamset));
539 519
540 /* set capability info */ 520 /* set capability info */
541 adhs->cap.ess = 0; 521 adhs->cap.ess = 0;
542 adhs->cap.ibss = 1; 522 adhs->cap.ibss = 1;
543 pbssdesc->cap.ibss = 1;
544 523
545 /* probedelay */ 524 /* probedelay */
546 adhs->probedelay = cpu_to_le16(cmd_scan_probe_delay_time); 525 adhs->probedelay = cpu_to_le16(cmd_scan_probe_delay_time);
547 526
548 /* set up privacy in adapter->scantable[i] */ 527 /* set up privacy in adapter->scantable[i] */
549 if (adapter->secinfo.wep_enabled) { 528 if (assoc_req->secinfo.wep_enabled) {
550 lbs_pr_debug(1, "ADHOC_S_CMD: WEP enabled, setting privacy on\n"); 529 lbs_deb_join("ADHOC_S_CMD: WEP enabled, setting privacy on\n");
551 pbssdesc->privacy = wlan802_11privfilter8021xWEP;
552 adhs->cap.privacy = AD_HOC_CAP_PRIVACY_ON; 530 adhs->cap.privacy = AD_HOC_CAP_PRIVACY_ON;
553 } else { 531 } else {
554 lbs_pr_debug(1, "ADHOC_S_CMD: WEP disabled, setting privacy off\n"); 532 lbs_deb_join("ADHOC_S_CMD: WEP disabled, setting privacy off\n");
555 pbssdesc->privacy = wlan802_11privfilteracceptall;
556 } 533 }
557 534
558 memset(adhs->datarate, 0, sizeof(adhs->datarate)); 535 memset(adhs->datarate, 0, sizeof(adhs->datarate));
@@ -574,29 +551,24 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
574 memcpy(&adapter->curbssparams.datarates, 551 memcpy(&adapter->curbssparams.datarates,
575 &adhs->datarate, adapter->curbssparams.numofrates); 552 &adhs->datarate, adapter->curbssparams.numofrates);
576 553
577 lbs_pr_debug(1, "ADHOC_S_CMD: rates=%02x %02x %02x %02x \n", 554 lbs_deb_join("ADHOC_S_CMD: rates=%02x %02x %02x %02x \n",
578 adhs->datarate[0], adhs->datarate[1], 555 adhs->datarate[0], adhs->datarate[1],
579 adhs->datarate[2], adhs->datarate[3]); 556 adhs->datarate[2], adhs->datarate[3]);
580 557
581 lbs_pr_debug(1, "ADHOC_S_CMD: AD HOC Start command is ready\n"); 558 lbs_deb_join("ADHOC_S_CMD: AD HOC Start command is ready\n");
582 559
583 if (libertas_create_dnld_countryinfo_11d(priv)) { 560 if (libertas_create_dnld_countryinfo_11d(priv)) {
584 lbs_pr_debug(1, "ADHOC_S_CMD: dnld_countryinfo_11d failed\n"); 561 lbs_deb_join("ADHOC_S_CMD: dnld_countryinfo_11d failed\n");
585 ret = -1; 562 ret = -1;
586 goto done; 563 goto done;
587 } 564 }
588 565
589 cmd->size = 566 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_ad_hoc_start) +
590 cpu_to_le16(sizeof(struct cmd_ds_802_11_ad_hoc_start) 567 S_DS_GEN + cmdappendsize);
591 + S_DS_GEN + cmdappendsize);
592
593 memcpy(&tmpcap, &adhs->cap, sizeof(u16));
594 tmpcap = cpu_to_le16(tmpcap);
595 memcpy(&adhs->cap, &tmpcap, sizeof(u16));
596 568
597 ret = 0; 569 ret = 0;
598done: 570done:
599 LEAVE(); 571 lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
600 return ret; 572 return ret;
601} 573}
602 574
@@ -614,7 +586,8 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
614{ 586{
615 wlan_adapter *adapter = priv->adapter; 587 wlan_adapter *adapter = priv->adapter;
616 struct cmd_ds_802_11_ad_hoc_join *padhocjoin = &cmd->params.adj; 588 struct cmd_ds_802_11_ad_hoc_join *padhocjoin = &cmd->params.adj;
617 struct bss_descriptor *pbssdesc = pdata_buf; 589 struct assoc_request * assoc_req = pdata_buf;
590 struct bss_descriptor *bss = &assoc_req->bss;
618 int cmdappendsize = 0; 591 int cmdappendsize = 0;
619 int ret = 0; 592 int ret = 0;
620 u8 *card_rates; 593 u8 *card_rates;
@@ -622,70 +595,59 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
622 u16 tmpcap; 595 u16 tmpcap;
623 int i; 596 int i;
624 597
625 ENTER(); 598 lbs_deb_enter(LBS_DEB_JOIN);
626
627 adapter->pattemptedbssdesc = pbssdesc;
628 599
629 cmd->command = cpu_to_le16(cmd_802_11_ad_hoc_join); 600 cmd->command = cpu_to_le16(cmd_802_11_ad_hoc_join);
630 601
631 padhocjoin->bssdescriptor.bsstype = cmd_bss_type_ibss; 602 padhocjoin->bssdescriptor.bsstype = cmd_bss_type_ibss;
632 603
633 padhocjoin->bssdescriptor.beaconperiod = pbssdesc->beaconperiod; 604 padhocjoin->bssdescriptor.beaconperiod = cpu_to_le16(bss->beaconperiod);
634
635 memcpy(&padhocjoin->bssdescriptor.BSSID,
636 &pbssdesc->macaddress, ETH_ALEN);
637 605
638 memcpy(&padhocjoin->bssdescriptor.SSID, 606 memcpy(&padhocjoin->bssdescriptor.BSSID, &bss->bssid, ETH_ALEN);
639 &pbssdesc->ssid.ssid, pbssdesc->ssid.ssidlength); 607 memcpy(&padhocjoin->bssdescriptor.SSID, &bss->ssid, bss->ssid_len);
640 608
641 memcpy(&padhocjoin->bssdescriptor.phyparamset, 609 memcpy(&padhocjoin->bssdescriptor.phyparamset,
642 &pbssdesc->phyparamset, sizeof(union ieeetypes_phyparamset)); 610 &bss->phyparamset, sizeof(union ieeetypes_phyparamset));
643 611
644 memcpy(&padhocjoin->bssdescriptor.ssparamset, 612 memcpy(&padhocjoin->bssdescriptor.ssparamset,
645 &pbssdesc->ssparamset, sizeof(union IEEEtypes_ssparamset)); 613 &bss->ssparamset, sizeof(union IEEEtypes_ssparamset));
646 614
647 memcpy(&tmpcap, &pbssdesc->cap, sizeof(struct ieeetypes_capinfo)); 615 memcpy(&tmpcap, &bss->cap, sizeof(struct ieeetypes_capinfo));
648 tmpcap &= CAPINFO_MASK; 616 tmpcap &= CAPINFO_MASK;
649 617
650 lbs_pr_debug(1, "ADHOC_J_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n", 618 lbs_deb_join("ADHOC_J_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n",
651 tmpcap, CAPINFO_MASK); 619 tmpcap, CAPINFO_MASK);
652 memcpy(&padhocjoin->bssdescriptor.cap, &tmpcap, 620 memcpy(&padhocjoin->bssdescriptor.cap, &tmpcap,
653 sizeof(struct ieeetypes_capinfo)); 621 sizeof(struct ieeetypes_capinfo));
654 622
655 /* information on BSSID descriptor passed to FW */ 623 /* information on BSSID descriptor passed to FW */
656 lbs_pr_debug(1, 624 lbs_deb_join(
657 "ADHOC_J_CMD: BSSID = %2x-%2x-%2x-%2x-%2x-%2x, SSID = %s\n", 625 "ADHOC_J_CMD: BSSID = " MAC_FMT ", SSID = '%s'\n",
658 padhocjoin->bssdescriptor.BSSID[0], 626 MAC_ARG(padhocjoin->bssdescriptor.BSSID),
659 padhocjoin->bssdescriptor.BSSID[1],
660 padhocjoin->bssdescriptor.BSSID[2],
661 padhocjoin->bssdescriptor.BSSID[3],
662 padhocjoin->bssdescriptor.BSSID[4],
663 padhocjoin->bssdescriptor.BSSID[5],
664 padhocjoin->bssdescriptor.SSID); 627 padhocjoin->bssdescriptor.SSID);
665 628
666 /* failtimeout */ 629 /* failtimeout */
667 padhocjoin->failtimeout = cpu_to_le16(MRVDRV_ASSOCIATION_TIME_OUT); 630 padhocjoin->failtimeout = cpu_to_le16(MRVDRV_ASSOCIATION_TIME_OUT);
668 631
669 /* probedelay */ 632 /* probedelay */
670 padhocjoin->probedelay = 633 padhocjoin->probedelay = cpu_to_le16(cmd_scan_probe_delay_time);
671 cpu_to_le16(cmd_scan_probe_delay_time);
672 634
673 /* Copy Data rates from the rates recorded in scan response */ 635 /* Copy Data rates from the rates recorded in scan response */
674 memset(padhocjoin->bssdescriptor.datarates, 0, 636 memset(padhocjoin->bssdescriptor.datarates, 0,
675 sizeof(padhocjoin->bssdescriptor.datarates)); 637 sizeof(padhocjoin->bssdescriptor.datarates));
676 memcpy(padhocjoin->bssdescriptor.datarates, pbssdesc->datarates, 638 memcpy(padhocjoin->bssdescriptor.datarates, bss->datarates,
677 min(sizeof(padhocjoin->bssdescriptor.datarates), 639 min(sizeof(padhocjoin->bssdescriptor.datarates),
678 sizeof(pbssdesc->datarates))); 640 sizeof(bss->datarates)));
679 641
680 card_rates = libertas_supported_rates; 642 card_rates = libertas_supported_rates;
681 card_rates_size = sizeof(libertas_supported_rates); 643 card_rates_size = sizeof(libertas_supported_rates);
682 644
683 adapter->curbssparams.channel = pbssdesc->channel; 645 adapter->curbssparams.channel = bss->channel;
684 646
685 if (get_common_rates(adapter, padhocjoin->bssdescriptor.datarates, 647 if (get_common_rates(adapter, padhocjoin->bssdescriptor.datarates,
686 sizeof(padhocjoin->bssdescriptor.datarates), 648 sizeof(padhocjoin->bssdescriptor.datarates),
687 card_rates, card_rates_size)) { 649 card_rates, card_rates_size)) {
688 lbs_pr_debug(1, "ADHOC_J_CMD: get_common_rates returns error.\n"); 650 lbs_deb_join("ADHOC_J_CMD: get_common_rates returns error.\n");
689 ret = -1; 651 ret = -1;
690 goto done; 652 goto done;
691 } 653 }
@@ -704,17 +666,17 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
704 adapter->curbssparams.numofrates); 666 adapter->curbssparams.numofrates);
705 667
706 padhocjoin->bssdescriptor.ssparamset.ibssparamset.atimwindow = 668 padhocjoin->bssdescriptor.ssparamset.ibssparamset.atimwindow =
707 cpu_to_le16(pbssdesc->atimwindow); 669 cpu_to_le16(bss->atimwindow);
708 670
709 if (adapter->secinfo.wep_enabled) { 671 if (assoc_req->secinfo.wep_enabled) {
710 padhocjoin->bssdescriptor.cap.privacy = AD_HOC_CAP_PRIVACY_ON; 672 padhocjoin->bssdescriptor.cap.privacy = AD_HOC_CAP_PRIVACY_ON;
711 } 673 }
712 674
713 if (adapter->psmode == wlan802_11powermodemax_psp) { 675 if (adapter->psmode == wlan802_11powermodemax_psp) {
714 /* wake up first */ 676 /* wake up first */
715 enum WLAN_802_11_POWER_MODE Localpsmode; 677 __le32 Localpsmode;
716 678
717 Localpsmode = wlan802_11powermodecam; 679 Localpsmode = cpu_to_le32(wlan802_11powermodecam);
718 ret = libertas_prepare_and_send_command(priv, 680 ret = libertas_prepare_and_send_command(priv,
719 cmd_802_11_ps_mode, 681 cmd_802_11_ps_mode,
720 cmd_act_set, 682 cmd_act_set,
@@ -726,24 +688,16 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
726 } 688 }
727 } 689 }
728 690
729 if (libertas_parse_dnld_countryinfo_11d(priv)) { 691 if (libertas_parse_dnld_countryinfo_11d(priv, bss)) {
730 ret = -1; 692 ret = -1;
731 goto done; 693 goto done;
732 } 694 }
733 695
734 cmd->size = 696 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_ad_hoc_join) +
735 cpu_to_le16(sizeof(struct cmd_ds_802_11_ad_hoc_join) 697 S_DS_GEN + cmdappendsize);
736 + S_DS_GEN + cmdappendsize);
737
738 memcpy(&tmpcap, &padhocjoin->bssdescriptor.cap,
739 sizeof(struct ieeetypes_capinfo));
740 tmpcap = cpu_to_le16(tmpcap);
741
742 memcpy(&padhocjoin->bssdescriptor.cap,
743 &tmpcap, sizeof(struct ieeetypes_capinfo));
744 698
745 done: 699done:
746 LEAVE(); 700 lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
747 return ret; 701 return ret;
748} 702}
749 703
@@ -754,19 +708,24 @@ int libertas_ret_80211_associate(wlan_private * priv,
754 int ret = 0; 708 int ret = 0;
755 union iwreq_data wrqu; 709 union iwreq_data wrqu;
756 struct ieeetypes_assocrsp *passocrsp; 710 struct ieeetypes_assocrsp *passocrsp;
757 struct bss_descriptor *pbssdesc; 711 struct bss_descriptor * bss;
758 712
759 ENTER(); 713 lbs_deb_enter(LBS_DEB_JOIN);
760 714
761 passocrsp = (struct ieeetypes_assocrsp *) & resp->params; 715 if (!adapter->in_progress_assoc_req) {
716 lbs_deb_join("ASSOC_RESP: no in-progress association request\n");
717 ret = -1;
718 goto done;
719 }
720 bss = &adapter->in_progress_assoc_req->bss;
762 721
763 if (passocrsp->statuscode) { 722 passocrsp = (struct ieeetypes_assocrsp *) & resp->params;
764 723
724 if (le16_to_cpu(passocrsp->statuscode)) {
765 libertas_mac_event_disconnected(priv); 725 libertas_mac_event_disconnected(priv);
766 726
767 lbs_pr_debug(1, 727 lbs_deb_join("ASSOC_RESP: Association failed, status code = %d\n",
768 "ASSOC_RESP: Association failed, status code = %d\n", 728 le16_to_cpu(passocrsp->statuscode));
769 passocrsp->statuscode);
770 729
771 ret = -1; 730 ret = -1;
772 goto done; 731 goto done;
@@ -778,24 +737,15 @@ int libertas_ret_80211_associate(wlan_private * priv,
778 /* Send a Media Connected event, according to the Spec */ 737 /* Send a Media Connected event, according to the Spec */
779 adapter->connect_status = libertas_connected; 738 adapter->connect_status = libertas_connected;
780 739
781 /* Set the attempted BSSID Index to current */ 740 lbs_deb_join("ASSOC_RESP: assocated to '%s'\n",
782 pbssdesc = adapter->pattemptedbssdesc; 741 escape_essid(bss->ssid, bss->ssid_len));
783
784 lbs_pr_debug(1, "ASSOC_RESP: %s\n", pbssdesc->ssid.ssid);
785 742
786 /* Set the new SSID to current SSID */ 743 /* Update current SSID and BSSID */
787 memcpy(&adapter->curbssparams.ssid, 744 memcpy(&adapter->curbssparams.ssid, &bss->ssid, IW_ESSID_MAX_SIZE);
788 &pbssdesc->ssid, sizeof(struct WLAN_802_11_SSID)); 745 adapter->curbssparams.ssid_len = bss->ssid_len;
789 746 memcpy(adapter->curbssparams.bssid, bss->bssid, ETH_ALEN);
790 /* Set the new BSSID (AP's MAC address) to current BSSID */
791 memcpy(adapter->curbssparams.bssid,
792 pbssdesc->macaddress, ETH_ALEN);
793
794 /* Make a copy of current BSSID descriptor */
795 memcpy(&adapter->curbssparams.bssdescriptor,
796 pbssdesc, sizeof(struct bss_descriptor));
797 747
798 lbs_pr_debug(1, "ASSOC_RESP: currentpacketfilter is %x\n", 748 lbs_deb_join("ASSOC_RESP: currentpacketfilter is %x\n",
799 adapter->currentpacketfilter); 749 adapter->currentpacketfilter);
800 750
801 adapter->SNR[TYPE_RXPD][TYPE_AVG] = 0; 751 adapter->SNR[TYPE_RXPD][TYPE_AVG] = 0;
@@ -806,28 +756,31 @@ int libertas_ret_80211_associate(wlan_private * priv,
806 adapter->nextSNRNF = 0; 756 adapter->nextSNRNF = 0;
807 adapter->numSNRNF = 0; 757 adapter->numSNRNF = 0;
808 758
809 netif_carrier_on(priv->wlan_dev.netdev); 759 netif_carrier_on(priv->dev);
810 netif_wake_queue(priv->wlan_dev.netdev); 760 netif_wake_queue(priv->dev);
811 761
812 lbs_pr_debug(1, "ASSOC_RESP: Associated \n"); 762 netif_carrier_on(priv->mesh_dev);
763 netif_wake_queue(priv->mesh_dev);
764
765 lbs_deb_join("ASSOC_RESP: Associated \n");
813 766
814 memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN); 767 memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN);
815 wrqu.ap_addr.sa_family = ARPHRD_ETHER; 768 wrqu.ap_addr.sa_family = ARPHRD_ETHER;
816 wireless_send_event(priv->wlan_dev.netdev, SIOCGIWAP, &wrqu, NULL); 769 wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);
817 770
818 done: 771done:
819 LEAVE(); 772 lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
820 return ret; 773 return ret;
821} 774}
822 775
823int libertas_ret_80211_disassociate(wlan_private * priv, 776int libertas_ret_80211_disassociate(wlan_private * priv,
824 struct cmd_ds_command *resp) 777 struct cmd_ds_command *resp)
825{ 778{
826 ENTER(); 779 lbs_deb_enter(LBS_DEB_JOIN);
827 780
828 libertas_mac_event_disconnected(priv); 781 libertas_mac_event_disconnected(priv);
829 782
830 LEAVE(); 783 lbs_deb_leave(LBS_DEB_JOIN);
831 return 0; 784 return 0;
832} 785}
833 786
@@ -840,90 +793,85 @@ int libertas_ret_80211_ad_hoc_start(wlan_private * priv,
840 u16 result = le16_to_cpu(resp->result); 793 u16 result = le16_to_cpu(resp->result);
841 struct cmd_ds_802_11_ad_hoc_result *padhocresult; 794 struct cmd_ds_802_11_ad_hoc_result *padhocresult;
842 union iwreq_data wrqu; 795 union iwreq_data wrqu;
843 struct bss_descriptor *pbssdesc; 796 struct bss_descriptor *bss;
844 797
845 ENTER(); 798 lbs_deb_enter(LBS_DEB_JOIN);
846 799
847 padhocresult = &resp->params.result; 800 padhocresult = &resp->params.result;
848 801
849 lbs_pr_debug(1, "ADHOC_S_RESP: size = %d\n", le16_to_cpu(resp->size)); 802 lbs_deb_join("ADHOC_RESP: size = %d\n", le16_to_cpu(resp->size));
850 lbs_pr_debug(1, "ADHOC_S_RESP: command = %x\n", command); 803 lbs_deb_join("ADHOC_RESP: command = %x\n", command);
851 lbs_pr_debug(1, "ADHOC_S_RESP: result = %x\n", result); 804 lbs_deb_join("ADHOC_RESP: result = %x\n", result);
852 805
853 pbssdesc = adapter->pattemptedbssdesc; 806 if (!adapter->in_progress_assoc_req) {
807 lbs_deb_join("ADHOC_RESP: no in-progress association request\n");
808 ret = -1;
809 goto done;
810 }
811 bss = &adapter->in_progress_assoc_req->bss;
854 812
855 /* 813 /*
856 * Join result code 0 --> SUCCESS 814 * Join result code 0 --> SUCCESS
857 */ 815 */
858 if (result) { 816 if (result) {
859 lbs_pr_debug(1, "ADHOC_RESP failed\n"); 817 lbs_deb_join("ADHOC_RESP: failed\n");
860 if (adapter->connect_status == libertas_connected) { 818 if (adapter->connect_status == libertas_connected) {
861 libertas_mac_event_disconnected(priv); 819 libertas_mac_event_disconnected(priv);
862 } 820 }
863 821 ret = -1;
864 memset(&adapter->curbssparams.bssdescriptor, 822 goto done;
865 0x00, sizeof(adapter->curbssparams.bssdescriptor));
866
867 LEAVE();
868 return -1;
869 } 823 }
870 824
871 /* 825 /*
872 * Now the join cmd should be successful 826 * Now the join cmd should be successful
873 * If BSSID has changed use SSID to compare instead of BSSID 827 * If BSSID has changed use SSID to compare instead of BSSID
874 */ 828 */
875 lbs_pr_debug(1, "ADHOC_J_RESP %s\n", pbssdesc->ssid.ssid); 829 lbs_deb_join("ADHOC_RESP: associated to '%s'\n",
830 escape_essid(bss->ssid, bss->ssid_len));
876 831
877 /* Send a Media Connected event, according to the Spec */ 832 /* Send a Media Connected event, according to the Spec */
878 adapter->connect_status = libertas_connected; 833 adapter->connect_status = libertas_connected;
879 834
880 if (command == cmd_ret_802_11_ad_hoc_start) { 835 if (command == cmd_ret_802_11_ad_hoc_start) {
881 /* Update the created network descriptor with the new BSSID */ 836 /* Update the created network descriptor with the new BSSID */
882 memcpy(pbssdesc->macaddress, 837 memcpy(bss->bssid, padhocresult->BSSID, ETH_ALEN);
883 padhocresult->BSSID, ETH_ALEN);
884 } else {
885
886 /* Make a copy of current BSSID descriptor, only needed for join since
887 * the current descriptor is already being used for adhoc start
888 */
889 memmove(&adapter->curbssparams.bssdescriptor,
890 pbssdesc, sizeof(struct bss_descriptor));
891 } 838 }
892 839
893 /* Set the BSSID from the joined/started descriptor */ 840 /* Set the BSSID from the joined/started descriptor */
894 memcpy(&adapter->curbssparams.bssid, 841 memcpy(&adapter->curbssparams.bssid, bss->bssid, ETH_ALEN);
895 pbssdesc->macaddress, ETH_ALEN);
896 842
897 /* Set the new SSID to current SSID */ 843 /* Set the new SSID to current SSID */
898 memcpy(&adapter->curbssparams.ssid, 844 memcpy(&adapter->curbssparams.ssid, &bss->ssid, IW_ESSID_MAX_SIZE);
899 &pbssdesc->ssid, sizeof(struct WLAN_802_11_SSID)); 845 adapter->curbssparams.ssid_len = bss->ssid_len;
900 846
901 netif_carrier_on(priv->wlan_dev.netdev); 847 netif_carrier_on(priv->dev);
902 netif_wake_queue(priv->wlan_dev.netdev); 848 netif_wake_queue(priv->dev);
849
850 netif_carrier_on(priv->mesh_dev);
851 netif_wake_queue(priv->mesh_dev);
903 852
904 memset(&wrqu, 0, sizeof(wrqu)); 853 memset(&wrqu, 0, sizeof(wrqu));
905 memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN); 854 memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN);
906 wrqu.ap_addr.sa_family = ARPHRD_ETHER; 855 wrqu.ap_addr.sa_family = ARPHRD_ETHER;
907 wireless_send_event(priv->wlan_dev.netdev, SIOCGIWAP, &wrqu, NULL); 856 wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);
908 857
909 lbs_pr_debug(1, "ADHOC_RESP: - Joined/Started Ad Hoc\n"); 858 lbs_deb_join("ADHOC_RESP: - Joined/Started Ad Hoc\n");
910 lbs_pr_debug(1, "ADHOC_RESP: channel = %d\n", adapter->adhocchannel); 859 lbs_deb_join("ADHOC_RESP: channel = %d\n", adapter->curbssparams.channel);
911 lbs_pr_debug(1, "ADHOC_RESP: BSSID = %02x:%02x:%02x:%02x:%02x:%02x\n", 860 lbs_deb_join("ADHOC_RESP: BSSID = " MAC_FMT "\n",
912 padhocresult->BSSID[0], padhocresult->BSSID[1], 861 MAC_ARG(padhocresult->BSSID));
913 padhocresult->BSSID[2], padhocresult->BSSID[3],
914 padhocresult->BSSID[4], padhocresult->BSSID[5]);
915 862
916 LEAVE(); 863done:
864 lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
917 return ret; 865 return ret;
918} 866}
919 867
920int libertas_ret_80211_ad_hoc_stop(wlan_private * priv, 868int libertas_ret_80211_ad_hoc_stop(wlan_private * priv,
921 struct cmd_ds_command *resp) 869 struct cmd_ds_command *resp)
922{ 870{
923 ENTER(); 871 lbs_deb_enter(LBS_DEB_JOIN);
924 872
925 libertas_mac_event_disconnected(priv); 873 libertas_mac_event_disconnected(priv);
926 874
927 LEAVE(); 875 lbs_deb_leave(LBS_DEB_JOIN);
928 return 0; 876 return 0;
929} 877}
diff --git a/drivers/net/wireless/libertas/join.h b/drivers/net/wireless/libertas/join.h
index 115f5a8ba346..d522630ff8cf 100644
--- a/drivers/net/wireless/libertas/join.h
+++ b/drivers/net/wireless/libertas/join.h
@@ -9,6 +9,7 @@
9#define _WLAN_JOIN_H 9#define _WLAN_JOIN_H
10 10
11#include "defs.h" 11#include "defs.h"
12#include "dev.h"
12 13
13struct cmd_ds_command; 14struct cmd_ds_command;
14extern int libertas_cmd_80211_authenticate(wlan_private * priv, 15extern int libertas_cmd_80211_authenticate(wlan_private * priv,
@@ -21,7 +22,7 @@ extern int libertas_cmd_80211_ad_hoc_stop(wlan_private * priv,
21 struct cmd_ds_command *cmd); 22 struct cmd_ds_command *cmd);
22extern int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, 23extern int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
23 struct cmd_ds_command *cmd, 24 struct cmd_ds_command *cmd,
24 void *pssid); 25 void *pdata_buf);
25extern int libertas_cmd_80211_deauthenticate(wlan_private * priv, 26extern int libertas_cmd_80211_deauthenticate(wlan_private * priv,
26 struct cmd_ds_command *cmd); 27 struct cmd_ds_command *cmd);
27extern int libertas_cmd_80211_associate(wlan_private * priv, 28extern int libertas_cmd_80211_associate(wlan_private * priv,
@@ -39,12 +40,10 @@ extern int libertas_ret_80211_associate(wlan_private * priv,
39 40
40extern int libertas_reassociation_thread(void *data); 41extern int libertas_reassociation_thread(void *data);
41 42
42struct WLAN_802_11_SSID;
43struct bss_descriptor;
44
45extern int libertas_start_adhoc_network(wlan_private * priv, 43extern int libertas_start_adhoc_network(wlan_private * priv,
46 struct WLAN_802_11_SSID *adhocssid); 44 struct assoc_request * assoc_req);
47extern int libertas_join_adhoc_network(wlan_private * priv, struct bss_descriptor *pbssdesc); 45extern int libertas_join_adhoc_network(wlan_private * priv,
46 struct assoc_request * assoc_req);
48extern int libertas_stop_adhoc_network(wlan_private * priv); 47extern int libertas_stop_adhoc_network(wlan_private * priv);
49 48
50extern int libertas_send_deauthentication(wlan_private * priv); 49extern int libertas_send_deauthentication(wlan_private * priv);
@@ -52,6 +51,6 @@ extern int libertas_send_deauth(wlan_private * priv);
52 51
53extern int libertas_do_adhocstop_ioctl(wlan_private * priv); 52extern int libertas_do_adhocstop_ioctl(wlan_private * priv);
54 53
55int wlan_associate(wlan_private * priv, struct bss_descriptor * pbssdesc); 54int wlan_associate(wlan_private * priv, struct assoc_request * assoc_req);
56 55
57#endif 56#endif
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index b9b25ce65919..623ab4b16973 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -4,6 +4,7 @@
4 * thread etc.. 4 * thread etc..
5 */ 5 */
6 6
7#include <linux/moduleparam.h>
7#include <linux/delay.h> 8#include <linux/delay.h>
8#include <linux/freezer.h> 9#include <linux/freezer.h>
9#include <linux/etherdevice.h> 10#include <linux/etherdevice.h>
@@ -11,26 +12,28 @@
11#include <linux/if_arp.h> 12#include <linux/if_arp.h>
12 13
13#include <net/iw_handler.h> 14#include <net/iw_handler.h>
15#include <net/ieee80211.h>
14 16
15#include "host.h" 17#include "host.h"
16#include "sbi.h"
17#include "decl.h" 18#include "decl.h"
18#include "dev.h" 19#include "dev.h"
19#include "fw.h"
20#include "wext.h" 20#include "wext.h"
21#include "debugfs.h" 21#include "debugfs.h"
22#include "assoc.h" 22#include "assoc.h"
23 23
24#define DRIVER_RELEASE_VERSION "320.p0" 24#define DRIVER_RELEASE_VERSION "322.p0"
25const char libertas_driver_version[] = "COMM-USB8388-" DRIVER_RELEASE_VERSION 25const char libertas_driver_version[] = "COMM-USB8388-" DRIVER_RELEASE_VERSION
26#ifdef DEBUG 26#ifdef DEBUG
27 "-dbg" 27 "-dbg"
28#endif 28#endif
29 ""; 29 "";
30 30
31#ifdef ENABLE_PM 31
32static struct pm_dev *wlan_pm_dev = NULL; 32/* Module parameters */
33#endif 33unsigned int libertas_debug = 0;
34module_param(libertas_debug, int, 0644);
35EXPORT_SYMBOL_GPL(libertas_debug);
36
34 37
35#define WLAN_TX_PWR_DEFAULT 20 /*100mW */ 38#define WLAN_TX_PWR_DEFAULT 20 /*100mW */
36#define WLAN_TX_PWR_US_DEFAULT 20 /*100mW */ 39#define WLAN_TX_PWR_US_DEFAULT 20 /*100mW */
@@ -146,14 +149,6 @@ static struct region_cfp_table region_cfp_table[] = {
146}; 149};
147 150
148/** 151/**
149 * the rates supported by the card
150 */
151u8 libertas_wlan_data_rates[WLAN_SUPPORTED_RATES] =
152 { 0x02, 0x04, 0x0B, 0x16, 0x00, 0x0C, 0x12,
153 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x00
154};
155
156/**
157 * the rates supported 152 * the rates supported
158 */ 153 */
159u8 libertas_supported_rates[G_SUPPORTED_RATES] = 154u8 libertas_supported_rates[G_SUPPORTED_RATES] =
@@ -173,66 +168,55 @@ u8 libertas_adhoc_rates_g[G_SUPPORTED_RATES] =
173u8 libertas_adhoc_rates_b[4] = { 0x82, 0x84, 0x8b, 0x96 }; 168u8 libertas_adhoc_rates_b[4] = { 0x82, 0x84, 0x8b, 0x96 };
174 169
175/** 170/**
176 * the global variable of a pointer to wlan_private
177 * structure variable
178 */
179static wlan_private *wlanpriv = NULL;
180
181#define MAX_DEVS 5
182static struct net_device *libertas_devs[MAX_DEVS];
183static int libertas_found = 0;
184
185/**
186 * the table to keep region code 171 * the table to keep region code
187 */ 172 */
188u16 libertas_region_code_to_index[MRVDRV_MAX_REGION_CODE] = 173u16 libertas_region_code_to_index[MRVDRV_MAX_REGION_CODE] =
189 { 0x10, 0x20, 0x30, 0x31, 0x32, 0x40 }; 174 { 0x10, 0x20, 0x30, 0x31, 0x32, 0x40 };
190 175
191static u8 *default_fw_name = "usb8388.bin";
192
193/** 176/**
194 * Attributes exported through sysfs 177 * Attributes exported through sysfs
195 */ 178 */
196 179
197/** 180/**
198 * @brief Get function for sysfs attribute libertas_mpp 181 * @brief Get function for sysfs attribute anycast_mask
199 */ 182 */
200static ssize_t libertas_mpp_get(struct device * dev, 183static ssize_t libertas_anycast_get(struct device * dev,
201 struct device_attribute *attr, char * buf) { 184 struct device_attribute *attr, char * buf) {
202 struct cmd_ds_mesh_access mesh_access; 185 struct cmd_ds_mesh_access mesh_access;
203 186
204 memset(&mesh_access, 0, sizeof(mesh_access)); 187 memset(&mesh_access, 0, sizeof(mesh_access));
205 libertas_prepare_and_send_command(to_net_dev(dev)->priv, 188 libertas_prepare_and_send_command(to_net_dev(dev)->priv,
206 cmd_mesh_access, 189 cmd_mesh_access,
207 cmd_act_mesh_get_mpp, 190 cmd_act_mesh_get_anycast,
208 cmd_option_waitforrsp, 0, (void *)&mesh_access); 191 cmd_option_waitforrsp, 0, (void *)&mesh_access);
209 192
210 return snprintf(buf, 3, "%d\n", mesh_access.data[0]); 193 return snprintf(buf, 12, "0x%X\n", le32_to_cpu(mesh_access.data[0]));
211} 194}
212 195
213/** 196/**
214 * @brief Set function for sysfs attribute libertas_mpp 197 * @brief Set function for sysfs attribute anycast_mask
215 */ 198 */
216static ssize_t libertas_mpp_set(struct device * dev, 199static ssize_t libertas_anycast_set(struct device * dev,
217 struct device_attribute *attr, const char * buf, size_t count) { 200 struct device_attribute *attr, const char * buf, size_t count) {
218 struct cmd_ds_mesh_access mesh_access; 201 struct cmd_ds_mesh_access mesh_access;
219 202 uint32_t datum;
220 203
221 memset(&mesh_access, 0, sizeof(mesh_access)); 204 memset(&mesh_access, 0, sizeof(mesh_access));
222 sscanf(buf, "%d", &(mesh_access.data[0])); 205 sscanf(buf, "%x", &datum);
206 mesh_access.data[0] = cpu_to_le32(datum);
207
223 libertas_prepare_and_send_command((to_net_dev(dev))->priv, 208 libertas_prepare_and_send_command((to_net_dev(dev))->priv,
224 cmd_mesh_access, 209 cmd_mesh_access,
225 cmd_act_mesh_set_mpp, 210 cmd_act_mesh_set_anycast,
226 cmd_option_waitforrsp, 0, (void *)&mesh_access); 211 cmd_option_waitforrsp, 0, (void *)&mesh_access);
227 return strlen(buf); 212 return strlen(buf);
228} 213}
229 214
230/** 215/**
231 * libertas_mpp attribute to be exported per mshX interface 216 * anycast_mask attribute to be exported per mshX interface
232 * through sysfs (/sys/class/net/mshX/libertas-mpp) 217 * through sysfs (/sys/class/net/mshX/anycast_mask)
233 */ 218 */
234static DEVICE_ATTR(libertas_mpp, 0644, libertas_mpp_get, 219static DEVICE_ATTR(anycast_mask, 0644, libertas_anycast_get, libertas_anycast_set);
235 libertas_mpp_set );
236 220
237/** 221/**
238 * @brief Check if the device can be open and wait if necessary. 222 * @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,
245 * function to work around the issue. 229 * function to work around the issue.
246 * 230 *
247 */ 231 */
248static int pre_open_check(struct net_device *dev) { 232static int pre_open_check(struct net_device *dev)
233{
249 wlan_private *priv = (wlan_private *) dev->priv; 234 wlan_private *priv = (wlan_private *) dev->priv;
250 wlan_adapter *adapter = priv->adapter; 235 wlan_adapter *adapter = priv->adapter;
251 int i = 0; 236 int i = 0;
@@ -255,8 +240,7 @@ static int pre_open_check(struct net_device *dev) {
255 msleep_interruptible(100); 240 msleep_interruptible(100);
256 } 241 }
257 if (!adapter->fw_ready) { 242 if (!adapter->fw_ready) {
258 lbs_pr_info("FW not ready, pre_open_check() return failure\n"); 243 lbs_pr_err("firmware not ready\n");
259 LEAVE();
260 return -1; 244 return -1;
261 } 245 }
262 246
@@ -274,17 +258,19 @@ static int wlan_dev_open(struct net_device *dev)
274 wlan_private *priv = (wlan_private *) dev->priv; 258 wlan_private *priv = (wlan_private *) dev->priv;
275 wlan_adapter *adapter = priv->adapter; 259 wlan_adapter *adapter = priv->adapter;
276 260
277 ENTER(); 261 lbs_deb_enter(LBS_DEB_NET);
278
279 262
280 priv->open = 1; 263 priv->open = 1;
281 264
282 if (adapter->connect_status == libertas_connected) { 265 if (adapter->connect_status == libertas_connected) {
283 netif_carrier_on(priv->wlan_dev.netdev); 266 netif_carrier_on(priv->dev);
284 } else 267 netif_carrier_on(priv->mesh_dev);
285 netif_carrier_off(priv->wlan_dev.netdev); 268 } else {
269 netif_carrier_off(priv->dev);
270 netif_carrier_off(priv->mesh_dev);
271 }
286 272
287 LEAVE(); 273 lbs_deb_leave(LBS_DEB_NET);
288 return 0; 274 return 0;
289} 275}
290/** 276/**
@@ -297,12 +283,12 @@ static int mesh_open(struct net_device *dev)
297{ 283{
298 wlan_private *priv = (wlan_private *) dev->priv ; 284 wlan_private *priv = (wlan_private *) dev->priv ;
299 285
300 if(pre_open_check(dev) == -1) 286 if (pre_open_check(dev) == -1)
301 return -1; 287 return -1;
302 priv->mesh_open = 1 ; 288 priv->mesh_open = 1 ;
303 netif_start_queue(priv->mesh_dev); 289 netif_wake_queue(priv->mesh_dev);
304 if (priv->infra_open == 0) 290 if (priv->infra_open == 0)
305 return wlan_dev_open(priv->wlan_dev.netdev) ; 291 return wlan_dev_open(priv->dev) ;
306 return 0; 292 return 0;
307} 293}
308 294
@@ -319,9 +305,9 @@ static int wlan_open(struct net_device *dev)
319 if(pre_open_check(dev) == -1) 305 if(pre_open_check(dev) == -1)
320 return -1; 306 return -1;
321 priv->infra_open = 1 ; 307 priv->infra_open = 1 ;
322 netif_wake_queue(priv->wlan_dev.netdev); 308 netif_wake_queue(priv->dev);
323 if (priv->open == 0) 309 if (priv->open == 0)
324 return wlan_dev_open(priv->wlan_dev.netdev) ; 310 return wlan_dev_open(priv->dev) ;
325 return 0; 311 return 0;
326} 312}
327 313
@@ -329,12 +315,12 @@ static int wlan_dev_close(struct net_device *dev)
329{ 315{
330 wlan_private *priv = dev->priv; 316 wlan_private *priv = dev->priv;
331 317
332 ENTER(); 318 lbs_deb_enter(LBS_DEB_NET);
333 319
334 netif_carrier_off(priv->wlan_dev.netdev); 320 netif_carrier_off(priv->dev);
335 priv->open = 0; 321 priv->open = 0;
336 322
337 LEAVE(); 323 lbs_deb_leave(LBS_DEB_NET);
338 return 0; 324 return 0;
339} 325}
340 326
@@ -351,7 +337,7 @@ static int mesh_close(struct net_device *dev)
351 priv->mesh_open = 0; 337 priv->mesh_open = 0;
352 netif_stop_queue(priv->mesh_dev); 338 netif_stop_queue(priv->mesh_dev);
353 if (priv->infra_open == 0) 339 if (priv->infra_open == 0)
354 return wlan_dev_close( ((wlan_private *) dev->priv)->wlan_dev.netdev) ; 340 return wlan_dev_close(dev);
355 else 341 else
356 return 0; 342 return 0;
357} 343}
@@ -362,147 +348,38 @@ static int mesh_close(struct net_device *dev)
362 * @param dev A pointer to net_device structure 348 * @param dev A pointer to net_device structure
363 * @return 0 349 * @return 0
364 */ 350 */
365static int wlan_close(struct net_device *dev) { 351static int wlan_close(struct net_device *dev)
352{
366 wlan_private *priv = (wlan_private *) dev->priv; 353 wlan_private *priv = (wlan_private *) dev->priv;
367 354
368 netif_stop_queue(priv->wlan_dev.netdev); 355 netif_stop_queue(dev);
369 priv->infra_open = 0; 356 priv->infra_open = 0;
370 if (priv->mesh_open == 0) 357 if (priv->mesh_open == 0)
371 return wlan_dev_close( ((wlan_private *) dev->priv)->wlan_dev.netdev) ; 358 return wlan_dev_close(dev);
372 else 359 else
373 return 0; 360 return 0;
374} 361}
375 362
376 363
377#ifdef ENABLE_PM
378
379/**
380 * @brief This function is a callback function. it is called by
381 * kernel to enter or exit power saving mode.
382 *
383 * @param pmdev A pointer to pm_dev
384 * @param pmreq pm_request_t
385 * @param pmdata A pointer to pmdata
386 * @return 0 or -1
387 */
388static int wlan_pm_callback(struct pm_dev *pmdev, pm_request_t pmreq,
389 void *pmdata)
390{
391 wlan_private *priv = wlanpriv;
392 wlan_adapter *adapter = priv->adapter;
393 struct net_device *dev = priv->wlan_dev.netdev;
394
395 lbs_pr_debug(1, "WPRM_PM_CALLBACK: pmreq = %d.\n", pmreq);
396
397 switch (pmreq) {
398 case PM_SUSPEND:
399 lbs_pr_debug(1, "WPRM_PM_CALLBACK: enter PM_SUSPEND.\n");
400
401 /* in associated mode */
402 if (adapter->connect_status == libertas_connected) {
403 if ((adapter->psstate != PS_STATE_SLEEP)
404 ) {
405 lbs_pr_debug(1,
406 "wlan_pm_callback: can't enter sleep mode\n");
407 return -1;
408 } else {
409
410 /*
411 * Detach the network interface
412 * if the network is running
413 */
414 if (netif_running(dev)) {
415 netif_device_detach(dev);
416 lbs_pr_debug(1,
417 "netif_device_detach().\n");
418 }
419 libertas_sbi_suspend(priv);
420 }
421 break;
422 }
423
424 /* in non associated mode */
425
426 /*
427 * Detach the network interface
428 * if the network is running
429 */
430 if (netif_running(dev))
431 netif_device_detach(dev);
432
433 /*
434 * Storing and restoring of the regs be taken care
435 * at the driver rest will be done at wlan driver
436 * this makes driver independent of the card
437 */
438
439 libertas_sbi_suspend(priv);
440
441 break;
442
443 case PM_RESUME:
444 /* in associated mode */
445 if (adapter->connect_status == libertas_connected) {
446 {
447 /*
448 * Bring the inteface up first
449 * This case should not happen still ...
450 */
451 libertas_sbi_resume(priv);
452
453 /*
454 * Attach the network interface
455 * if the network is running
456 */
457 if (netif_running(dev)) {
458 netif_device_attach(dev);
459 lbs_pr_debug(1,
460 "after netif_device_attach().\n");
461 }
462 lbs_pr_debug(1,
463 "After netif attach, in associated mode.\n");
464 }
465 break;
466 }
467
468 /* in non associated mode */
469
470 /*
471 * Bring the inteface up first
472 * This case should not happen still ...
473 */
474
475 libertas_sbi_resume(priv);
476
477 if (netif_running(dev))
478 netif_device_attach(dev);
479
480 lbs_pr_debug(1, "after netif attach, in NON associated mode.\n");
481 break;
482 }
483
484 return 0;
485}
486#endif /* ENABLE_PM */
487
488static int wlan_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) 364static int wlan_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
489{ 365{
490 int ret = 0; 366 int ret = 0;
491 wlan_private *priv = dev->priv; 367 wlan_private *priv = dev->priv;
492 368
493 ENTER(); 369 lbs_deb_enter(LBS_DEB_NET);
494 370
495 if (priv->wlan_dev.dnld_sent || priv->adapter->TxLockFlag) { 371 if (priv->dnld_sent || priv->adapter->TxLockFlag) {
496 priv->stats.tx_dropped++; 372 priv->stats.tx_dropped++;
497 goto done; 373 goto done;
498 } 374 }
499 375
500 netif_stop_queue(priv->wlan_dev.netdev); 376 netif_stop_queue(priv->dev);
377 netif_stop_queue(priv->mesh_dev);
501 378
502 if (libertas_process_tx(priv, skb) == 0) 379 if (libertas_process_tx(priv, skb) == 0)
503 dev->trans_start = jiffies; 380 dev->trans_start = jiffies;
504done: 381done:
505 LEAVE(); 382 lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret);
506 return ret; 383 return ret;
507} 384}
508 385
@@ -513,33 +390,43 @@ done:
513static int mesh_pre_start_xmit(struct sk_buff *skb, struct net_device *dev) 390static int mesh_pre_start_xmit(struct sk_buff *skb, struct net_device *dev)
514{ 391{
515 wlan_private *priv = dev->priv; 392 wlan_private *priv = dev->priv;
516 ENTER(); 393 int ret;
394
395 lbs_deb_enter(LBS_DEB_MESH);
396
517 SET_MESH_FRAME(skb); 397 SET_MESH_FRAME(skb);
518 LEAVE();
519 398
520 return wlan_hard_start_xmit(skb, priv->wlan_dev.netdev); 399 ret = wlan_hard_start_xmit(skb, priv->dev);
400 lbs_deb_leave_args(LBS_DEB_MESH, "ret %d", ret);
401 return ret;
521} 402}
522 403
523/** 404/**
524 * @brief Mark non-mesh packets and handover them to wlan_hard_start_xmit 405 * @brief Mark non-mesh packets and handover them to wlan_hard_start_xmit
525 * 406 *
526 */ 407 */
527static int wlan_pre_start_xmit(struct sk_buff *skb, struct net_device *dev) { 408static int wlan_pre_start_xmit(struct sk_buff *skb, struct net_device *dev)
528 ENTER(); 409{
410 int ret;
411
412 lbs_deb_enter(LBS_DEB_NET);
413
529 UNSET_MESH_FRAME(skb); 414 UNSET_MESH_FRAME(skb);
530 LEAVE(); 415
531 return wlan_hard_start_xmit(skb, dev); 416 ret = wlan_hard_start_xmit(skb, dev);
417 lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret);
418 return ret;
532} 419}
533 420
534static void wlan_tx_timeout(struct net_device *dev) 421static void wlan_tx_timeout(struct net_device *dev)
535{ 422{
536 wlan_private *priv = (wlan_private *) dev->priv; 423 wlan_private *priv = (wlan_private *) dev->priv;
537 424
538 ENTER(); 425 lbs_deb_enter(LBS_DEB_TX);
539 426
540 lbs_pr_err("tx watch dog timeout!\n"); 427 lbs_pr_err("tx watch dog timeout\n");
541 428
542 priv->wlan_dev.dnld_sent = DNLD_RES_RECEIVED; 429 priv->dnld_sent = DNLD_RES_RECEIVED;
543 dev->trans_start = jiffies; 430 dev->trans_start = jiffies;
544 431
545 if (priv->adapter->currenttxskb) { 432 if (priv->adapter->currenttxskb) {
@@ -550,10 +437,12 @@ static void wlan_tx_timeout(struct net_device *dev)
550 libertas_send_tx_feedback(priv); 437 libertas_send_tx_feedback(priv);
551 } else 438 } else
552 wake_up_interruptible(&priv->mainthread.waitq); 439 wake_up_interruptible(&priv->mainthread.waitq);
553 } else if (priv->adapter->connect_status == libertas_connected) 440 } else if (priv->adapter->connect_status == libertas_connected) {
554 netif_wake_queue(priv->wlan_dev.netdev); 441 netif_wake_queue(priv->dev);
442 netif_wake_queue(priv->mesh_dev);
443 }
555 444
556 LEAVE(); 445 lbs_deb_leave(LBS_DEB_TX);
557} 446}
558 447
559/** 448/**
@@ -576,7 +465,10 @@ static int wlan_set_mac_address(struct net_device *dev, void *addr)
576 wlan_adapter *adapter = priv->adapter; 465 wlan_adapter *adapter = priv->adapter;
577 struct sockaddr *phwaddr = addr; 466 struct sockaddr *phwaddr = addr;
578 467
579 ENTER(); 468 lbs_deb_enter(LBS_DEB_NET);
469
470 /* In case it was called from the mesh device */
471 dev = priv->dev ;
580 472
581 memset(adapter->current_addr, 0, ETH_ALEN); 473 memset(adapter->current_addr, 0, ETH_ALEN);
582 474
@@ -591,17 +483,18 @@ static int wlan_set_mac_address(struct net_device *dev, void *addr)
591 cmd_option_waitforrsp, 0, NULL); 483 cmd_option_waitforrsp, 0, NULL);
592 484
593 if (ret) { 485 if (ret) {
594 lbs_pr_debug(1, "set mac address failed.\n"); 486 lbs_deb_net("set MAC address failed\n");
595 ret = -1; 487 ret = -1;
596 goto done; 488 goto done;
597 } 489 }
598 490
599 lbs_dbg_hex("adapter->macaddr:", adapter->current_addr, ETH_ALEN); 491 lbs_dbg_hex("adapter->macaddr:", adapter->current_addr, ETH_ALEN);
600 memcpy(dev->dev_addr, adapter->current_addr, ETH_ALEN); 492 memcpy(dev->dev_addr, adapter->current_addr, ETH_ALEN);
601 memcpy(((wlan_private *) dev->priv)->mesh_dev->dev_addr, adapter->current_addr, ETH_ALEN); 493 if (priv->mesh_dev)
494 memcpy(priv->mesh_dev->dev_addr, adapter->current_addr, ETH_ALEN);
602 495
603done: 496done:
604 LEAVE(); 497 lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret);
605 return ret; 498 return ret;
606} 499}
607 500
@@ -626,12 +519,12 @@ static void wlan_set_multicast_list(struct net_device *dev)
626 wlan_adapter *adapter = priv->adapter; 519 wlan_adapter *adapter = priv->adapter;
627 int oldpacketfilter; 520 int oldpacketfilter;
628 521
629 ENTER(); 522 lbs_deb_enter(LBS_DEB_NET);
630 523
631 oldpacketfilter = adapter->currentpacketfilter; 524 oldpacketfilter = adapter->currentpacketfilter;
632 525
633 if (dev->flags & IFF_PROMISC) { 526 if (dev->flags & IFF_PROMISC) {
634 lbs_pr_debug(1, "enable Promiscuous mode\n"); 527 lbs_deb_net("enable promiscuous mode\n");
635 adapter->currentpacketfilter |= 528 adapter->currentpacketfilter |=
636 cmd_act_mac_promiscuous_enable; 529 cmd_act_mac_promiscuous_enable;
637 adapter->currentpacketfilter &= 530 adapter->currentpacketfilter &=
@@ -644,7 +537,7 @@ static void wlan_set_multicast_list(struct net_device *dev)
644 537
645 if (dev->flags & IFF_ALLMULTI || dev->mc_count > 538 if (dev->flags & IFF_ALLMULTI || dev->mc_count >
646 MRVDRV_MAX_MULTICAST_LIST_SIZE) { 539 MRVDRV_MAX_MULTICAST_LIST_SIZE) {
647 lbs_pr_debug(1, "Enabling All Multicast!\n"); 540 lbs_deb_net( "enabling all multicast\n");
648 adapter->currentpacketfilter |= 541 adapter->currentpacketfilter |=
649 cmd_act_mac_all_multicast_enable; 542 cmd_act_mac_all_multicast_enable;
650 adapter->currentpacketfilter &= 543 adapter->currentpacketfilter &=
@@ -654,8 +547,8 @@ static void wlan_set_multicast_list(struct net_device *dev)
654 ~cmd_act_mac_all_multicast_enable; 547 ~cmd_act_mac_all_multicast_enable;
655 548
656 if (!dev->mc_count) { 549 if (!dev->mc_count) {
657 lbs_pr_debug(1, "No multicast addresses - " 550 lbs_deb_net("no multicast addresses, "
658 "disabling multicast!\n"); 551 "disabling multicast\n");
659 adapter->currentpacketfilter &= 552 adapter->currentpacketfilter &=
660 ~cmd_act_mac_multicast_enable; 553 ~cmd_act_mac_multicast_enable;
661 } else { 554 } else {
@@ -667,12 +560,12 @@ static void wlan_set_multicast_list(struct net_device *dev)
667 adapter->nr_of_multicastmacaddr = 560 adapter->nr_of_multicastmacaddr =
668 wlan_copy_multicast_address(adapter, dev); 561 wlan_copy_multicast_address(adapter, dev);
669 562
670 lbs_pr_debug(1, "Multicast addresses: %d\n", 563 lbs_deb_net("multicast addresses: %d\n",
671 dev->mc_count); 564 dev->mc_count);
672 565
673 for (i = 0; i < dev->mc_count; i++) { 566 for (i = 0; i < dev->mc_count; i++) {
674 lbs_pr_debug(1, "Multicast address %d:" 567 lbs_deb_net("Multicast address %d:"
675 "%x %x %x %x %x %x\n", i, 568 MAC_FMT "\n", i,
676 adapter->multicastlist[i][0], 569 adapter->multicastlist[i][0],
677 adapter->multicastlist[i][1], 570 adapter->multicastlist[i][1],
678 adapter->multicastlist[i][2], 571 adapter->multicastlist[i][2],
@@ -680,7 +573,7 @@ static void wlan_set_multicast_list(struct net_device *dev)
680 adapter->multicastlist[i][4], 573 adapter->multicastlist[i][4],
681 adapter->multicastlist[i][5]); 574 adapter->multicastlist[i][5]);
682 } 575 }
683 /* set multicast addresses to firmware */ 576 /* send multicast addresses to firmware */
684 libertas_prepare_and_send_command(priv, 577 libertas_prepare_and_send_command(priv,
685 cmd_mac_multicast_adr, 578 cmd_mac_multicast_adr,
686 cmd_act_set, 0, 0, 579 cmd_act_set, 0, 0,
@@ -693,13 +586,13 @@ static void wlan_set_multicast_list(struct net_device *dev)
693 libertas_set_mac_packet_filter(priv); 586 libertas_set_mac_packet_filter(priv);
694 } 587 }
695 588
696 LEAVE(); 589 lbs_deb_leave(LBS_DEB_NET);
697} 590}
698 591
699/** 592/**
700 * @brief This function hanldes the major job in WLAN driver. 593 * @brief This function handles the major jobs in the WLAN driver.
701 * it handles the event generated by firmware, rx data received 594 * It handles all events generated by firmware, RX data received
702 * from firmware and tx data sent from kernel. 595 * from firmware and TX data sent from kernel.
703 * 596 *
704 * @param data A pointer to wlan_thread structure 597 * @param data A pointer to wlan_thread structure
705 * @return 0 598 * @return 0
@@ -712,26 +605,26 @@ static int wlan_service_main_thread(void *data)
712 wait_queue_t wait; 605 wait_queue_t wait;
713 u8 ireg = 0; 606 u8 ireg = 0;
714 607
715 ENTER(); 608 lbs_deb_enter(LBS_DEB_THREAD);
716 609
717 wlan_activate_thread(thread); 610 wlan_activate_thread(thread);
718 611
719 init_waitqueue_entry(&wait, current); 612 init_waitqueue_entry(&wait, current);
720 613
721 for (;;) { 614 for (;;) {
722 lbs_pr_debug(1, "main-thread 111: intcounter=%d " 615 lbs_deb_thread( "main-thread 111: intcounter=%d "
723 "currenttxskb=%p dnld_sent=%d\n", 616 "currenttxskb=%p dnld_sent=%d\n",
724 adapter->intcounter, 617 adapter->intcounter,
725 adapter->currenttxskb, priv->wlan_dev.dnld_sent); 618 adapter->currenttxskb, priv->dnld_sent);
726 619
727 add_wait_queue(&thread->waitq, &wait); 620 add_wait_queue(&thread->waitq, &wait);
728 set_current_state(TASK_INTERRUPTIBLE); 621 set_current_state(TASK_INTERRUPTIBLE);
729 spin_lock_irq(&adapter->driver_lock); 622 spin_lock_irq(&adapter->driver_lock);
730 if ((adapter->psstate == PS_STATE_SLEEP) || 623 if ((adapter->psstate == PS_STATE_SLEEP) ||
731 (!adapter->intcounter 624 (!adapter->intcounter
732 && (priv->wlan_dev.dnld_sent || adapter->cur_cmd || 625 && (priv->dnld_sent || adapter->cur_cmd ||
733 list_empty(&adapter->cmdpendingq)))) { 626 list_empty(&adapter->cmdpendingq)))) {
734 lbs_pr_debug(1, 627 lbs_deb_thread(
735 "main-thread sleeping... Conn=%d IntC=%d PS_mode=%d PS_State=%d\n", 628 "main-thread sleeping... Conn=%d IntC=%d PS_mode=%d PS_State=%d\n",
736 adapter->connect_status, adapter->intcounter, 629 adapter->connect_status, adapter->intcounter,
737 adapter->psmode, adapter->psstate); 630 adapter->psmode, adapter->psstate);
@@ -741,23 +634,23 @@ static int wlan_service_main_thread(void *data)
741 spin_unlock_irq(&adapter->driver_lock); 634 spin_unlock_irq(&adapter->driver_lock);
742 635
743 636
744 lbs_pr_debug(1, 637 lbs_deb_thread(
745 "main-thread 222 (waking up): intcounter=%d currenttxskb=%p " 638 "main-thread 222 (waking up): intcounter=%d currenttxskb=%p "
746 "dnld_sent=%d\n", adapter->intcounter, 639 "dnld_sent=%d\n", adapter->intcounter,
747 adapter->currenttxskb, priv->wlan_dev.dnld_sent); 640 adapter->currenttxskb, priv->dnld_sent);
748 641
749 set_current_state(TASK_RUNNING); 642 set_current_state(TASK_RUNNING);
750 remove_wait_queue(&thread->waitq, &wait); 643 remove_wait_queue(&thread->waitq, &wait);
751 try_to_freeze(); 644 try_to_freeze();
752 645
753 lbs_pr_debug(1, "main-thread 333: intcounter=%d currenttxskb=%p " 646 lbs_deb_thread("main-thread 333: intcounter=%d currenttxskb=%p "
754 "dnld_sent=%d\n", 647 "dnld_sent=%d\n",
755 adapter->intcounter, 648 adapter->intcounter,
756 adapter->currenttxskb, priv->wlan_dev.dnld_sent); 649 adapter->currenttxskb, priv->dnld_sent);
757 650
758 if (kthread_should_stop() 651 if (kthread_should_stop()
759 || adapter->surpriseremoved) { 652 || adapter->surpriseremoved) {
760 lbs_pr_debug(1, 653 lbs_deb_thread(
761 "main-thread: break from main thread: surpriseremoved=0x%x\n", 654 "main-thread: break from main thread: surpriseremoved=0x%x\n",
762 adapter->surpriseremoved); 655 adapter->surpriseremoved);
763 break; 656 break;
@@ -768,10 +661,10 @@ static int wlan_service_main_thread(void *data)
768 if (adapter->intcounter) { 661 if (adapter->intcounter) {
769 u8 int_status; 662 u8 int_status;
770 adapter->intcounter = 0; 663 adapter->intcounter = 0;
771 int_status = libertas_sbi_get_int_status(priv, &ireg); 664 int_status = priv->hw_get_int_status(priv, &ireg);
772 665
773 if (int_status) { 666 if (int_status) {
774 lbs_pr_debug(1, 667 lbs_deb_thread(
775 "main-thread: reading HOST_INT_STATUS_REG failed\n"); 668 "main-thread: reading HOST_INT_STATUS_REG failed\n");
776 spin_unlock_irq(&adapter->driver_lock); 669 spin_unlock_irq(&adapter->driver_lock);
777 continue; 670 continue;
@@ -779,14 +672,14 @@ static int wlan_service_main_thread(void *data)
779 adapter->hisregcpy |= ireg; 672 adapter->hisregcpy |= ireg;
780 } 673 }
781 674
782 lbs_pr_debug(1, "main-thread 444: intcounter=%d currenttxskb=%p " 675 lbs_deb_thread("main-thread 444: intcounter=%d currenttxskb=%p "
783 "dnld_sent=%d\n", 676 "dnld_sent=%d\n",
784 adapter->intcounter, 677 adapter->intcounter,
785 adapter->currenttxskb, priv->wlan_dev.dnld_sent); 678 adapter->currenttxskb, priv->dnld_sent);
786 679
787 /* command response? */ 680 /* command response? */
788 if (adapter->hisregcpy & his_cmdupldrdy) { 681 if (adapter->hisregcpy & his_cmdupldrdy) {
789 lbs_pr_debug(1, "main-thread: cmd response ready.\n"); 682 lbs_deb_thread("main-thread: cmd response ready\n");
790 683
791 adapter->hisregcpy &= ~his_cmdupldrdy; 684 adapter->hisregcpy &= ~his_cmdupldrdy;
792 spin_unlock_irq(&adapter->driver_lock); 685 spin_unlock_irq(&adapter->driver_lock);
@@ -796,13 +689,13 @@ static int wlan_service_main_thread(void *data)
796 689
797 /* Any Card Event */ 690 /* Any Card Event */
798 if (adapter->hisregcpy & his_cardevent) { 691 if (adapter->hisregcpy & his_cardevent) {
799 lbs_pr_debug(1, "main-thread: Card Event Activity.\n"); 692 lbs_deb_thread("main-thread: Card Event Activity\n");
800 693
801 adapter->hisregcpy &= ~his_cardevent; 694 adapter->hisregcpy &= ~his_cardevent;
802 695
803 if (libertas_sbi_read_event_cause(priv)) { 696 if (priv->hw_read_event_cause(priv)) {
804 lbs_pr_alert( 697 lbs_pr_alert(
805 "main-thread: libertas_sbi_read_event_cause failed.\n"); 698 "main-thread: hw_read_event_cause failed\n");
806 spin_unlock_irq(&adapter->driver_lock); 699 spin_unlock_irq(&adapter->driver_lock);
807 continue; 700 continue;
808 } 701 }
@@ -813,15 +706,15 @@ static int wlan_service_main_thread(void *data)
813 706
814 /* Check if we need to confirm Sleep Request received previously */ 707 /* Check if we need to confirm Sleep Request received previously */
815 if (adapter->psstate == PS_STATE_PRE_SLEEP) { 708 if (adapter->psstate == PS_STATE_PRE_SLEEP) {
816 if (!priv->wlan_dev.dnld_sent && !adapter->cur_cmd) { 709 if (!priv->dnld_sent && !adapter->cur_cmd) {
817 if (adapter->connect_status == 710 if (adapter->connect_status ==
818 libertas_connected) { 711 libertas_connected) {
819 lbs_pr_debug(1, 712 lbs_deb_thread(
820 "main_thread: PRE_SLEEP--intcounter=%d currenttxskb=%p " 713 "main_thread: PRE_SLEEP--intcounter=%d currenttxskb=%p "
821 "dnld_sent=%d cur_cmd=%p, confirm now\n", 714 "dnld_sent=%d cur_cmd=%p, confirm now\n",
822 adapter->intcounter, 715 adapter->intcounter,
823 adapter->currenttxskb, 716 adapter->currenttxskb,
824 priv->wlan_dev.dnld_sent, 717 priv->dnld_sent,
825 adapter->cur_cmd); 718 adapter->cur_cmd);
826 719
827 libertas_ps_confirm_sleep(priv, 720 libertas_ps_confirm_sleep(priv,
@@ -847,7 +740,7 @@ static int wlan_service_main_thread(void *data)
847 continue; 740 continue;
848 741
849 /* Execute the next command */ 742 /* Execute the next command */
850 if (!priv->wlan_dev.dnld_sent && !priv->adapter->cur_cmd) 743 if (!priv->dnld_sent && !priv->adapter->cur_cmd)
851 libertas_execute_next_command(priv); 744 libertas_execute_next_command(priv);
852 745
853 /* Wake-up command waiters which can't sleep in 746 /* Wake-up command waiters which can't sleep in
@@ -864,7 +757,7 @@ static int wlan_service_main_thread(void *data)
864 wake_up_all(&adapter->cmd_pending); 757 wake_up_all(&adapter->cmd_pending);
865 wlan_deactivate_thread(thread); 758 wlan_deactivate_thread(thread);
866 759
867 LEAVE(); 760 lbs_deb_leave(LBS_DEB_THREAD);
868 return 0; 761 return 0;
869} 762}
870 763
@@ -875,49 +768,32 @@ static int wlan_service_main_thread(void *data)
875 * @param card A pointer to card 768 * @param card A pointer to card
876 * @return A pointer to wlan_private structure 769 * @return A pointer to wlan_private structure
877 */ 770 */
878wlan_private *wlan_add_card(void *card) 771wlan_private *libertas_add_card(void *card, struct device *dmdev)
879{ 772{
880 struct net_device *dev = NULL; 773 struct net_device *dev = NULL;
881 struct net_device *mesh_dev = NULL;
882 wlan_private *priv = NULL; 774 wlan_private *priv = NULL;
883 775
884 ENTER(); 776 lbs_deb_enter(LBS_DEB_NET);
885 777
886 /* Allocate an Ethernet device and register it */ 778 /* Allocate an Ethernet device and register it */
887 if (!(dev = alloc_etherdev(sizeof(wlan_private)))) { 779 if (!(dev = alloc_etherdev(sizeof(wlan_private)))) {
888 lbs_pr_alert( "Init ethernet device failed!\n"); 780 lbs_pr_err("init ethX device failed\n");
889 return NULL; 781 return NULL;
890 } 782 }
891
892 priv = dev->priv; 783 priv = dev->priv;
893 784
894 /* allocate buffer for wlan_adapter */ 785 /* allocate buffer for wlan_adapter */
895 if (!(priv->adapter = kmalloc(sizeof(wlan_adapter), GFP_KERNEL))) { 786 if (!(priv->adapter = kzalloc(sizeof(wlan_adapter), GFP_KERNEL))) {
896 lbs_pr_alert( "Allocate buffer for wlan_adapter failed!\n"); 787 lbs_pr_err("allocate buffer for wlan_adapter failed\n");
897 goto err_kmalloc; 788 goto err_kzalloc;
898 }
899
900 /* Allocate a virtual mesh device */
901 if (!(mesh_dev = alloc_netdev(0, "msh%d", ether_setup))) {
902 lbs_pr_debug(1, "Init ethernet device failed!\n");
903 return NULL;
904 } 789 }
905 790
906 /* Both intervaces share the priv structure */ 791 priv->dev = dev;
907 mesh_dev->priv = priv; 792 priv->card = card;
908
909 /* init wlan_adapter */
910 memset(priv->adapter, 0, sizeof(wlan_adapter));
911
912 priv->wlan_dev.netdev = dev;
913 priv->wlan_dev.card = card;
914 priv->mesh_open = 0; 793 priv->mesh_open = 0;
915 priv->infra_open = 0; 794 priv->infra_open = 0;
916 priv->mesh_dev = mesh_dev;
917 wlanpriv = priv;
918 795
919 SET_MODULE_OWNER(dev); 796 SET_MODULE_OWNER(dev);
920 SET_MODULE_OWNER(mesh_dev);
921 797
922 /* Setup the OS Interface to our functions */ 798 /* Setup the OS Interface to our functions */
923 dev->open = wlan_open; 799 dev->open = wlan_open;
@@ -925,116 +801,172 @@ wlan_private *wlan_add_card(void *card)
925 dev->stop = wlan_close; 801 dev->stop = wlan_close;
926 dev->do_ioctl = libertas_do_ioctl; 802 dev->do_ioctl = libertas_do_ioctl;
927 dev->set_mac_address = wlan_set_mac_address; 803 dev->set_mac_address = wlan_set_mac_address;
928 mesh_dev->open = mesh_open;
929 mesh_dev->hard_start_xmit = mesh_pre_start_xmit;
930 mesh_dev->stop = mesh_close;
931 mesh_dev->do_ioctl = libertas_do_ioctl;
932 memcpy(mesh_dev->dev_addr, wlanpriv->wlan_dev.netdev->dev_addr,
933 sizeof(wlanpriv->wlan_dev.netdev->dev_addr));
934
935#define WLAN_WATCHDOG_TIMEOUT (5 * HZ)
936
937 dev->tx_timeout = wlan_tx_timeout; 804 dev->tx_timeout = wlan_tx_timeout;
938 dev->get_stats = wlan_get_stats; 805 dev->get_stats = wlan_get_stats;
939 dev->watchdog_timeo = WLAN_WATCHDOG_TIMEOUT; 806 dev->watchdog_timeo = 5 * HZ;
940 dev->ethtool_ops = &libertas_ethtool_ops; 807 dev->ethtool_ops = &libertas_ethtool_ops;
941 mesh_dev->get_stats = wlan_get_stats;
942 mesh_dev->ethtool_ops = &libertas_ethtool_ops;
943
944#ifdef WIRELESS_EXT 808#ifdef WIRELESS_EXT
945 dev->wireless_handlers = (struct iw_handler_def *)&libertas_handler_def; 809 dev->wireless_handlers = (struct iw_handler_def *)&libertas_handler_def;
946 mesh_dev->wireless_handlers = (struct iw_handler_def *)&libertas_handler_def;
947#endif 810#endif
948#define NETIF_F_DYNALLOC 16 811#define NETIF_F_DYNALLOC 16
949 dev->features |= NETIF_F_DYNALLOC; 812 dev->features |= NETIF_F_DYNALLOC;
950 dev->flags |= IFF_BROADCAST | IFF_MULTICAST; 813 dev->flags |= IFF_BROADCAST | IFF_MULTICAST;
951 dev->set_multicast_list = wlan_set_multicast_list; 814 dev->set_multicast_list = wlan_set_multicast_list;
952 815
816 SET_NETDEV_DEV(dev, dmdev);
817
953 INIT_LIST_HEAD(&priv->adapter->cmdfreeq); 818 INIT_LIST_HEAD(&priv->adapter->cmdfreeq);
954 INIT_LIST_HEAD(&priv->adapter->cmdpendingq); 819 INIT_LIST_HEAD(&priv->adapter->cmdpendingq);
955 820
956 spin_lock_init(&priv->adapter->driver_lock); 821 spin_lock_init(&priv->adapter->driver_lock);
957 init_waitqueue_head(&priv->adapter->cmd_pending); 822 init_waitqueue_head(&priv->adapter->cmd_pending);
958 priv->adapter->nr_cmd_pending = 0; 823 priv->adapter->nr_cmd_pending = 0;
824 goto done;
959 825
960 lbs_pr_debug(1, "Starting kthread...\n"); 826err_kzalloc:
827 free_netdev(dev);
828 priv = NULL;
829done:
830 lbs_deb_leave_args(LBS_DEB_NET, "priv %p", priv);
831 return priv;
832}
833EXPORT_SYMBOL_GPL(libertas_add_card);
834
835int libertas_activate_card(wlan_private *priv, char *fw_name)
836{
837 struct net_device *dev = priv->dev;
838 int ret = -1;
839
840 lbs_deb_enter(LBS_DEB_MAIN);
841
842 lbs_deb_thread("Starting kthread...\n");
961 priv->mainthread.priv = priv; 843 priv->mainthread.priv = priv;
962 wlan_create_thread(wlan_service_main_thread, 844 wlan_create_thread(wlan_service_main_thread,
963 &priv->mainthread, "wlan_main_service"); 845 &priv->mainthread, "wlan_main_service");
964 846
965 priv->assoc_thread = 847 priv->assoc_thread =
966 create_singlethread_workqueue("libertas_assoc"); 848 create_singlethread_workqueue("libertas_assoc");
967 INIT_DELAYED_WORK(&priv->assoc_work, wlan_association_worker); 849 INIT_DELAYED_WORK(&priv->assoc_work, libertas_association_worker);
850 INIT_WORK(&priv->sync_channel, libertas_sync_channel);
968 851
969 /* 852 /*
970 * Register the device. Fillup the private data structure with 853 * Register the device. Fillup the private data structure with
971 * relevant information from the card and request for the required 854 * relevant information from the card and request for the required
972 * IRQ. 855 * IRQ.
973 */ 856 */
974 if (libertas_sbi_register_dev(priv) < 0) { 857 if (priv->hw_register_dev(priv) < 0) {
975 lbs_pr_info("failed to register wlan device!\n"); 858 lbs_pr_err("failed to register WLAN device\n");
976 goto err_registerdev; 859 goto err_registerdev;
977 } 860 }
978 861
979 /* init FW and HW */ 862 /* init FW and HW */
980 if (libertas_init_fw(priv)) { 863 if (fw_name && libertas_init_fw(priv, fw_name)) {
981 lbs_pr_debug(1, "Firmware Init failed\n"); 864 lbs_pr_err("firmware init failed\n");
982 goto err_registerdev; 865 goto err_registerdev;
983 } 866 }
984 867
985 if (register_netdev(dev)) { 868 if (register_netdev(dev)) {
986 lbs_pr_err("Cannot register network device!\n"); 869 lbs_pr_err("cannot register ethX device\n");
987 goto err_init_fw;
988 }
989
990 /* Register virtual mesh interface */
991 if (register_netdev(mesh_dev)) {
992 lbs_pr_info("Cannot register mesh virtual interface!\n");
993 goto err_init_fw; 870 goto err_init_fw;
994 } 871 }
995 872
996 lbs_pr_info("%s: Marvell Wlan 802.11 adapter ", dev->name); 873 lbs_pr_info("%s: Marvell WLAN 802.11 adapter\n", dev->name);
997 874
998 libertas_debugfs_init_one(priv, dev); 875 libertas_debugfs_init_one(priv, dev);
999 876
1000 if (libertas_found == MAX_DEVS) 877 ret = 0;
1001 goto err_init_fw; 878 goto done;
1002 libertas_devs[libertas_found] = dev;
1003 libertas_found++;
1004#ifdef ENABLE_PM
1005 if (!(wlan_pm_dev = pm_register(PM_UNKNOWN_DEV, 0, wlan_pm_callback)))
1006 lbs_pr_alert( "failed to register PM callback\n");
1007#endif
1008 if (device_create_file(&(mesh_dev->dev), &dev_attr_libertas_mpp))
1009 goto err_create_file;
1010
1011 LEAVE();
1012 return priv;
1013 879
1014err_create_file:
1015 device_remove_file(&(mesh_dev->dev), &dev_attr_libertas_mpp);
1016err_init_fw: 880err_init_fw:
1017 libertas_sbi_unregister_dev(priv); 881 priv->hw_unregister_dev(priv);
1018err_registerdev: 882err_registerdev:
1019 destroy_workqueue(priv->assoc_thread); 883 destroy_workqueue(priv->assoc_thread);
1020 /* Stop the thread servicing the interrupts */ 884 /* Stop the thread servicing the interrupts */
1021 wake_up_interruptible(&priv->mainthread.waitq); 885 wake_up_interruptible(&priv->mainthread.waitq);
1022 wlan_terminate_thread(&priv->mainthread); 886 wlan_terminate_thread(&priv->mainthread);
1023 kfree(priv->adapter); 887done:
1024err_kmalloc: 888 lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret);
1025 free_netdev(dev); 889 return ret;
890}
891EXPORT_SYMBOL_GPL(libertas_activate_card);
892
893
894/**
895 * @brief This function adds mshX interface
896 *
897 * @param priv A pointer to the wlan_private structure
898 * @return 0 if successful, -X otherwise
899 */
900int libertas_add_mesh(wlan_private *priv, struct device *dev)
901{
902 struct net_device *mesh_dev = NULL;
903 int ret = 0;
904
905 lbs_deb_enter(LBS_DEB_MESH);
906
907 /* Allocate a virtual mesh device */
908 if (!(mesh_dev = alloc_netdev(0, "msh%d", ether_setup))) {
909 lbs_deb_mesh("init mshX device failed\n");
910 ret = -ENOMEM;
911 goto done;
912 }
913 mesh_dev->priv = priv;
914 priv->mesh_dev = mesh_dev;
915
916 SET_MODULE_OWNER(mesh_dev);
917
918 mesh_dev->open = mesh_open;
919 mesh_dev->hard_start_xmit = mesh_pre_start_xmit;
920 mesh_dev->stop = mesh_close;
921 mesh_dev->do_ioctl = libertas_do_ioctl;
922 mesh_dev->get_stats = wlan_get_stats;
923 mesh_dev->set_mac_address = wlan_set_mac_address;
924 mesh_dev->ethtool_ops = &libertas_ethtool_ops;
925 memcpy(mesh_dev->dev_addr, priv->dev->dev_addr,
926 sizeof(priv->dev->dev_addr));
927
928 SET_NETDEV_DEV(priv->mesh_dev, dev);
929
930#ifdef WIRELESS_EXT
931 mesh_dev->wireless_handlers = (struct iw_handler_def *)&mesh_handler_def;
932#endif
933#define NETIF_F_DYNALLOC 16
934
935 /* Register virtual mesh interface */
936 ret = register_netdev(mesh_dev);
937 if (ret) {
938 lbs_pr_err("cannot register mshX virtual interface\n");
939 goto err_free;
940 }
941
942 ret = device_create_file(&(mesh_dev->dev), &dev_attr_anycast_mask);
943 if (ret)
944 goto err_unregister;
945
946 /* Everything successful */
947 ret = 0;
948 goto done;
949
950
951err_unregister:
952 unregister_netdev(mesh_dev);
953
954err_free:
1026 free_netdev(mesh_dev); 955 free_netdev(mesh_dev);
1027 wlanpriv = NULL;
1028 956
1029 LEAVE(); 957done:
1030 return NULL; 958 lbs_deb_leave_args(LBS_DEB_MESH, "ret %d", ret);
959 return ret;
1031} 960}
961EXPORT_SYMBOL_GPL(libertas_add_mesh);
1032 962
1033static void wake_pending_cmdnodes(wlan_private *priv) 963static void wake_pending_cmdnodes(wlan_private *priv)
1034{ 964{
1035 struct cmd_ctrl_node *cmdnode; 965 struct cmd_ctrl_node *cmdnode;
1036 unsigned long flags; 966 unsigned long flags;
1037 967
968 lbs_deb_enter(LBS_DEB_CMD);
969
1038 spin_lock_irqsave(&priv->adapter->driver_lock, flags); 970 spin_lock_irqsave(&priv->adapter->driver_lock, flags);
1039 list_for_each_entry(cmdnode, &priv->adapter->cmdpendingq, list) { 971 list_for_each_entry(cmdnode, &priv->adapter->cmdpendingq, list) {
1040 cmdnode->cmdwaitqwoken = 1; 972 cmdnode->cmdwaitqwoken = 1;
@@ -1044,40 +976,29 @@ static void wake_pending_cmdnodes(wlan_private *priv)
1044} 976}
1045 977
1046 978
1047int wlan_remove_card(void *card) 979int libertas_remove_card(wlan_private *priv)
1048{ 980{
1049 wlan_private *priv = libertas_sbi_get_priv(card);
1050 wlan_adapter *adapter; 981 wlan_adapter *adapter;
1051 struct net_device *dev; 982 struct net_device *dev;
1052 struct net_device *mesh_dev;
1053 union iwreq_data wrqu; 983 union iwreq_data wrqu;
1054 int i;
1055 984
1056 ENTER(); 985 lbs_deb_enter(LBS_DEB_NET);
1057 986
1058 if (!priv) { 987 if (!priv)
1059 LEAVE(); 988 goto out;
1060 return 0;
1061 }
1062 989
1063 adapter = priv->adapter; 990 adapter = priv->adapter;
1064 991
1065 if (!adapter) { 992 if (!adapter)
1066 LEAVE(); 993 goto out;
1067 return 0;
1068 }
1069 994
1070 dev = priv->wlan_dev.netdev; 995 dev = priv->dev;
1071 mesh_dev = priv->mesh_dev;
1072 996
1073 netif_stop_queue(mesh_dev); 997 netif_stop_queue(priv->dev);
1074 netif_stop_queue(priv->wlan_dev.netdev); 998 netif_carrier_off(priv->dev);
1075 netif_carrier_off(priv->wlan_dev.netdev);
1076 999
1077 wake_pending_cmdnodes(priv); 1000 wake_pending_cmdnodes(priv);
1078 1001
1079 device_remove_file(&(mesh_dev->dev), &dev_attr_libertas_mpp);
1080 unregister_netdev(mesh_dev);
1081 unregister_netdev(dev); 1002 unregister_netdev(dev);
1082 1003
1083 cancel_delayed_work(&priv->assoc_work); 1004 cancel_delayed_work(&priv->assoc_work);
@@ -1090,11 +1011,7 @@ int wlan_remove_card(void *card)
1090 1011
1091 memset(wrqu.ap_addr.sa_data, 0xaa, ETH_ALEN); 1012 memset(wrqu.ap_addr.sa_data, 0xaa, ETH_ALEN);
1092 wrqu.ap_addr.sa_family = ARPHRD_ETHER; 1013 wrqu.ap_addr.sa_family = ARPHRD_ETHER;
1093 wireless_send_event(priv->wlan_dev.netdev, SIOCGIWAP, &wrqu, NULL); 1014 wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);
1094
1095#ifdef ENABLE_PM
1096 pm_unregister(wlan_pm_dev);
1097#endif
1098 1015
1099 adapter->surpriseremoved = 1; 1016 adapter->surpriseremoved = 1;
1100 1017
@@ -1103,28 +1020,45 @@ int wlan_remove_card(void *card)
1103 1020
1104 libertas_debugfs_remove_one(priv); 1021 libertas_debugfs_remove_one(priv);
1105 1022
1106 lbs_pr_debug(1, "Free adapter\n"); 1023 lbs_deb_net("free adapter\n");
1107 libertas_free_adapter(priv); 1024 libertas_free_adapter(priv);
1108 1025
1109 for (i = 0; i<libertas_found; i++) { 1026 lbs_deb_net("unregister finish\n");
1110 if (libertas_devs[i]==priv->wlan_dev.netdev) { 1027
1111 libertas_devs[i] = libertas_devs[--libertas_found]; 1028 priv->dev = NULL;
1112 libertas_devs[libertas_found] = NULL ; 1029 free_netdev(dev);
1113 break ; 1030
1114 } 1031out:
1115 } 1032 lbs_deb_leave(LBS_DEB_NET);
1033 return 0;
1034}
1035EXPORT_SYMBOL_GPL(libertas_remove_card);
1036
1037
1038void libertas_remove_mesh(wlan_private *priv)
1039{
1040 struct net_device *mesh_dev;
1041
1042 lbs_deb_enter(LBS_DEB_NET);
1043
1044 if (!priv)
1045 goto out;
1046
1047 mesh_dev = priv->mesh_dev;
1048
1049 netif_stop_queue(mesh_dev);
1050 netif_carrier_off(priv->mesh_dev);
1116 1051
1117 lbs_pr_debug(1, "Unregister finish\n"); 1052 device_remove_file(&(mesh_dev->dev), &dev_attr_anycast_mask);
1053 unregister_netdev(mesh_dev);
1118 1054
1119 priv->wlan_dev.netdev = NULL;
1120 priv->mesh_dev = NULL ; 1055 priv->mesh_dev = NULL ;
1121 free_netdev(mesh_dev); 1056 free_netdev(mesh_dev);
1122 free_netdev(dev);
1123 wlanpriv = NULL;
1124 1057
1125 LEAVE(); 1058out:
1126 return 0; 1059 lbs_deb_leave(LBS_DEB_NET);
1127} 1060}
1061EXPORT_SYMBOL_GPL(libertas_remove_mesh);
1128 1062
1129/** 1063/**
1130 * @brief This function finds the CFP in 1064 * @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
1139{ 1073{
1140 int i, end; 1074 int i, end;
1141 1075
1142 ENTER(); 1076 lbs_deb_enter(LBS_DEB_MAIN);
1143 1077
1144 end = sizeof(region_cfp_table)/sizeof(struct region_cfp_table); 1078 end = sizeof(region_cfp_table)/sizeof(struct region_cfp_table);
1145 1079
1146 for (i = 0; i < end ; i++) { 1080 for (i = 0; i < end ; i++) {
1147 lbs_pr_debug(1, "region_cfp_table[i].region=%d\n", 1081 lbs_deb_main("region_cfp_table[i].region=%d\n",
1148 region_cfp_table[i].region); 1082 region_cfp_table[i].region);
1149 if (region_cfp_table[i].region == region) { 1083 if (region_cfp_table[i].region == region) {
1150 *cfp_no = region_cfp_table[i].cfp_no_BG; 1084 *cfp_no = region_cfp_table[i].cfp_no_BG;
1151 LEAVE(); 1085 lbs_deb_leave(LBS_DEB_MAIN);
1152 return region_cfp_table[i].cfp_BG; 1086 return region_cfp_table[i].cfp_BG;
1153 } 1087 }
1154 } 1088 }
1155 1089
1156 LEAVE(); 1090 lbs_deb_leave_args(LBS_DEB_MAIN, "ret NULL");
1157 return NULL; 1091 return NULL;
1158} 1092}
1159 1093
1160int libertas_set_regiontable(wlan_private * priv, u8 region, u8 band) 1094int libertas_set_regiontable(wlan_private * priv, u8 region, u8 band)
1161{ 1095{
1162 wlan_adapter *adapter = priv->adapter; 1096 wlan_adapter *adapter = priv->adapter;
1097 int ret = 0;
1163 int i = 0; 1098 int i = 0;
1164 1099
1165 struct chan_freq_power *cfp; 1100 struct chan_freq_power *cfp;
1166 int cfp_no; 1101 int cfp_no;
1167 1102
1168 ENTER(); 1103 lbs_deb_enter(LBS_DEB_MAIN);
1169 1104
1170 memset(adapter->region_channel, 0, sizeof(adapter->region_channel)); 1105 memset(adapter->region_channel, 0, sizeof(adapter->region_channel));
1171 1106
@@ -1175,17 +1110,19 @@ int libertas_set_regiontable(wlan_private * priv, u8 region, u8 band)
1175 adapter->region_channel[i].nrcfp = cfp_no; 1110 adapter->region_channel[i].nrcfp = cfp_no;
1176 adapter->region_channel[i].CFP = cfp; 1111 adapter->region_channel[i].CFP = cfp;
1177 } else { 1112 } else {
1178 lbs_pr_debug(1, "wrong region code %#x in band B-G\n", 1113 lbs_deb_main("wrong region code %#x in band B/G\n",
1179 region); 1114 region);
1180 return -1; 1115 ret = -1;
1116 goto out;
1181 } 1117 }
1182 adapter->region_channel[i].valid = 1; 1118 adapter->region_channel[i].valid = 1;
1183 adapter->region_channel[i].region = region; 1119 adapter->region_channel[i].region = region;
1184 adapter->region_channel[i].band = band; 1120 adapter->region_channel[i].band = band;
1185 i++; 1121 i++;
1186 } 1122 }
1187 LEAVE(); 1123out:
1188 return 0; 1124 lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret);
1125 return ret;
1189} 1126}
1190 1127
1191/** 1128/**
@@ -1200,9 +1137,9 @@ void libertas_interrupt(struct net_device *dev)
1200{ 1137{
1201 wlan_private *priv = dev->priv; 1138 wlan_private *priv = dev->priv;
1202 1139
1203 ENTER(); 1140 lbs_deb_enter(LBS_DEB_THREAD);
1204 1141
1205 lbs_pr_debug(1, "libertas_interrupt: intcounter=%d\n", 1142 lbs_deb_thread("libertas_interrupt: intcounter=%d\n",
1206 priv->adapter->intcounter); 1143 priv->adapter->intcounter);
1207 1144
1208 priv->adapter->intcounter++; 1145 priv->adapter->intcounter++;
@@ -1210,56 +1147,35 @@ void libertas_interrupt(struct net_device *dev)
1210 if (priv->adapter->psstate == PS_STATE_SLEEP) { 1147 if (priv->adapter->psstate == PS_STATE_SLEEP) {
1211 priv->adapter->psstate = PS_STATE_AWAKE; 1148 priv->adapter->psstate = PS_STATE_AWAKE;
1212 netif_wake_queue(dev); 1149 netif_wake_queue(dev);
1150 netif_wake_queue(priv->mesh_dev);
1213 } 1151 }
1214 1152
1215 wake_up_interruptible(&priv->mainthread.waitq); 1153 wake_up_interruptible(&priv->mainthread.waitq);
1216 1154
1217 LEAVE(); 1155 lbs_deb_leave(LBS_DEB_THREAD);
1218} 1156}
1157EXPORT_SYMBOL_GPL(libertas_interrupt);
1219 1158
1220static int wlan_init_module(void) 1159static int libertas_init_module(void)
1221{ 1160{
1222 int ret = 0; 1161 lbs_deb_enter(LBS_DEB_MAIN);
1223
1224 ENTER();
1225
1226 if (libertas_fw_name == NULL) {
1227 libertas_fw_name = default_fw_name;
1228 }
1229
1230 libertas_debugfs_init(); 1162 libertas_debugfs_init();
1231 1163 lbs_deb_leave(LBS_DEB_MAIN);
1232 if (libertas_sbi_register()) { 1164 return 0;
1233 ret = -1;
1234 libertas_debugfs_remove();
1235 goto done;
1236 }
1237
1238done:
1239 LEAVE();
1240 return ret;
1241} 1165}
1242 1166
1243static void wlan_cleanup_module(void) 1167static void libertas_exit_module(void)
1244{ 1168{
1245 int i; 1169 lbs_deb_enter(LBS_DEB_MAIN);
1246
1247 ENTER();
1248
1249 for (i = 0; i<libertas_found; i++) {
1250 wlan_private *priv = libertas_devs[i]->priv;
1251 reset_device(priv);
1252 }
1253 1170
1254 libertas_sbi_unregister();
1255 libertas_debugfs_remove(); 1171 libertas_debugfs_remove();
1256 1172
1257 LEAVE(); 1173 lbs_deb_leave(LBS_DEB_MAIN);
1258} 1174}
1259 1175
1260module_init(wlan_init_module); 1176module_init(libertas_init_module);
1261module_exit(wlan_cleanup_module); 1177module_exit(libertas_exit_module);
1262 1178
1263MODULE_DESCRIPTION("M-WLAN Driver"); 1179MODULE_DESCRIPTION("Libertas WLAN Driver Library");
1264MODULE_AUTHOR("Marvell International Ltd."); 1180MODULE_AUTHOR("Marvell International Ltd.");
1265MODULE_LICENSE("GPL"); 1181MODULE_LICENSE("GPL");
diff --git a/drivers/net/wireless/libertas/rx.c b/drivers/net/wireless/libertas/rx.c
index 96619a32951b..88d9d2d787d5 100644
--- a/drivers/net/wireless/libertas/rx.c
+++ b/drivers/net/wireless/libertas/rx.c
@@ -106,10 +106,10 @@ static void wlan_compute_rssi(wlan_private * priv, struct rxpd *p_rx_pd)
106{ 106{
107 wlan_adapter *adapter = priv->adapter; 107 wlan_adapter *adapter = priv->adapter;
108 108
109 ENTER(); 109 lbs_deb_enter(LBS_DEB_RX);
110 110
111 lbs_pr_debug(1, "rxpd: SNR = %d, NF = %d\n", p_rx_pd->snr, p_rx_pd->nf); 111 lbs_deb_rx("rxpd: SNR %d, NF %d\n", p_rx_pd->snr, p_rx_pd->nf);
112 lbs_pr_debug(1, "Before computing SNR: SNR- avg = %d, NF-avg = %d\n", 112 lbs_deb_rx("before computing SNR: SNR-avg = %d, NF-avg = %d\n",
113 adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE, 113 adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
114 adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE); 114 adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
115 115
@@ -121,7 +121,7 @@ static void wlan_compute_rssi(wlan_private * priv, struct rxpd *p_rx_pd)
121 121
122 adapter->SNR[TYPE_RXPD][TYPE_AVG] = wlan_getavgsnr(priv) * AVG_SCALE; 122 adapter->SNR[TYPE_RXPD][TYPE_AVG] = wlan_getavgsnr(priv) * AVG_SCALE;
123 adapter->NF[TYPE_RXPD][TYPE_AVG] = wlan_getavgnf(priv) * AVG_SCALE; 123 adapter->NF[TYPE_RXPD][TYPE_AVG] = wlan_getavgnf(priv) * AVG_SCALE;
124 lbs_pr_debug(1, "After computing SNR: SNR-avg = %d, NF-avg = %d\n", 124 lbs_deb_rx("after computing SNR: SNR-avg = %d, NF-avg = %d\n",
125 adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE, 125 adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
126 adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE); 126 adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
127 127
@@ -133,18 +133,17 @@ static void wlan_compute_rssi(wlan_private * priv, struct rxpd *p_rx_pd)
133 CAL_RSSI(adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE, 133 CAL_RSSI(adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
134 adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE); 134 adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
135 135
136 LEAVE(); 136 lbs_deb_leave(LBS_DEB_RX);
137} 137}
138 138
139void libertas_upload_rx_packet(wlan_private * priv, struct sk_buff *skb) 139void libertas_upload_rx_packet(wlan_private * priv, struct sk_buff *skb)
140{ 140{
141 lbs_pr_debug(1, "skb->data=%p\n", skb->data); 141 lbs_deb_rx("skb->data %p\n", skb->data);
142 142
143 if(IS_MESH_FRAME(skb)) 143 if (priv->mesh_dev && IS_MESH_FRAME(skb))
144 skb->dev = priv->mesh_dev; 144 skb->protocol = eth_type_trans(skb, priv->mesh_dev);
145 else 145 else
146 skb->dev = priv->wlan_dev.netdev; 146 skb->protocol = eth_type_trans(skb, priv->dev);
147 skb->protocol = eth_type_trans(skb, priv->wlan_dev.netdev);
148 skb->ip_summed = CHECKSUM_UNNECESSARY; 147 skb->ip_summed = CHECKSUM_UNNECESSARY;
149 148
150 netif_rx(skb); 149 netif_rx(skb);
@@ -171,7 +170,7 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
171 170
172 const u8 rfc1042_eth_hdr[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; 171 const u8 rfc1042_eth_hdr[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 };
173 172
174 ENTER(); 173 lbs_deb_enter(LBS_DEB_RX);
175 174
176 if (priv->adapter->debugmode & MRVDRV_DEBUG_RX_PATH) 175 if (priv->adapter->debugmode & MRVDRV_DEBUG_RX_PATH)
177 lbs_dbg_hex("RX packet: ", skb->data, 176 lbs_dbg_hex("RX packet: ", skb->data,
@@ -191,7 +190,7 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
191 min_t(unsigned int, skb->len, 100)); 190 min_t(unsigned int, skb->len, 100));
192 191
193 if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) { 192 if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) {
194 lbs_pr_debug(1, "RX error: FRAME RECEIVED WITH BAD LENGTH\n"); 193 lbs_deb_rx("rx err: frame received with bad length\n");
195 priv->stats.rx_length_errors++; 194 priv->stats.rx_length_errors++;
196 ret = 0; 195 ret = 0;
197 goto done; 196 goto done;
@@ -200,15 +199,15 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
200 /* 199 /*
201 * Check rxpd status and update 802.3 stat, 200 * Check rxpd status and update 802.3 stat,
202 */ 201 */
203 if (!(p_rx_pd->status & MRVDRV_RXPD_STATUS_OK)) { 202 if (!(p_rx_pd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK))) {
204 lbs_pr_debug(1, "RX error: frame received with bad status\n"); 203 lbs_deb_rx("rx err: frame received with bad status\n");
205 lbs_pr_alert("rxpd Not OK\n"); 204 lbs_pr_alert("rxpd not ok\n");
206 priv->stats.rx_errors++; 205 priv->stats.rx_errors++;
207 ret = 0; 206 ret = 0;
208 goto done; 207 goto done;
209 } 208 }
210 209
211 lbs_pr_debug(1, "RX Data: skb->len - sizeof(RxPd) = %d - %zd = %zd\n", 210 lbs_deb_rx("rx data: skb->len-sizeof(RxPd) = %d-%zd = %zd\n",
212 skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd)); 211 skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd));
213 212
214 lbs_dbg_hex("RX Data: Dest", p_rx_pkt->eth803_hdr.dest_addr, 213 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)
266 265
267 wlan_compute_rssi(priv, p_rx_pd); 266 wlan_compute_rssi(priv, p_rx_pd);
268 267
269 lbs_pr_debug(1, "RX Data: size of actual packet = %d\n", skb->len); 268 lbs_deb_rx("rx data: size of actual packet %d\n", skb->len);
270 priv->stats.rx_bytes += skb->len; 269 priv->stats.rx_bytes += skb->len;
271 priv->stats.rx_packets++; 270 priv->stats.rx_packets++;
272 271
@@ -274,10 +273,10 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
274 273
275 ret = 0; 274 ret = 0;
276done: 275done:
277 LEAVE(); 276 lbs_deb_leave_args(LBS_DEB_RX, "ret %d", ret);
278
279 return ret; 277 return ret;
280} 278}
279EXPORT_SYMBOL_GPL(libertas_process_rxed_packet);
281 280
282/** 281/**
283 * @brief This function converts Tx/Rx rates from the Marvell WLAN format 282 * @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)
314 case 11: /* 54 Mbps */ 313 case 11: /* 54 Mbps */
315 return 108; 314 return 108;
316 } 315 }
317 lbs_pr_alert( "Invalid Marvell WLAN rate (%i)\n", rate); 316 lbs_pr_alert("Invalid Marvell WLAN rate %i\n", rate);
318 return 0; 317 return 0;
319} 318}
320 319
@@ -336,7 +335,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
336 struct rx_radiotap_hdr radiotap_hdr; 335 struct rx_radiotap_hdr radiotap_hdr;
337 struct rx_radiotap_hdr *pradiotap_hdr; 336 struct rx_radiotap_hdr *pradiotap_hdr;
338 337
339 ENTER(); 338 lbs_deb_enter(LBS_DEB_RX);
340 339
341 p_rx_pkt = (struct rx80211packethdr *) skb->data; 340 p_rx_pkt = (struct rx80211packethdr *) skb->data;
342 prxpd = &p_rx_pkt->rx_pd; 341 prxpd = &p_rx_pkt->rx_pd;
@@ -344,7 +343,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
344 // lbs_dbg_hex("RX Data: Before chop rxpd", skb->data, min(skb->len, 100)); 343 // lbs_dbg_hex("RX Data: Before chop rxpd", skb->data, min(skb->len, 100));
345 344
346 if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) { 345 if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) {
347 lbs_pr_debug(1, "RX error: FRAME RECEIVED WITH BAD LENGTH\n"); 346 lbs_deb_rx("rx err: frame received wit bad length\n");
348 priv->stats.rx_length_errors++; 347 priv->stats.rx_length_errors++;
349 ret = 0; 348 ret = 0;
350 goto done; 349 goto done;
@@ -353,12 +352,12 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
353 /* 352 /*
354 * Check rxpd status and update 802.3 stat, 353 * Check rxpd status and update 802.3 stat,
355 */ 354 */
356 if (!(prxpd->status & MRVDRV_RXPD_STATUS_OK)) { 355 if (!(prxpd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK))) {
357 //lbs_pr_debug(1, "RX error: frame received with bad status\n"); 356 //lbs_deb_rx("rx err: frame received with bad status\n");
358 priv->stats.rx_errors++; 357 priv->stats.rx_errors++;
359 } 358 }
360 359
361 lbs_pr_debug(1, "RX Data: skb->len - sizeof(RxPd) = %d - %zd = %zd\n", 360 lbs_deb_rx("rx data: skb->len-sizeof(RxPd) = %d-%zd = %zd\n",
362 skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd)); 361 skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd));
363 362
364 /* create the exported radio header */ 363 /* create the exported radio header */
@@ -386,7 +385,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
386 /* XXX must check no carryout */ 385 /* XXX must check no carryout */
387 radiotap_hdr.antsignal = prxpd->snr + prxpd->nf; 386 radiotap_hdr.antsignal = prxpd->snr + prxpd->nf;
388 radiotap_hdr.rx_flags = 0; 387 radiotap_hdr.rx_flags = 0;
389 if (!(prxpd->status & MRVDRV_RXPD_STATUS_OK)) 388 if (!(prxpd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK)))
390 radiotap_hdr.rx_flags |= IEEE80211_RADIOTAP_F_RX_BADFCS; 389 radiotap_hdr.rx_flags |= IEEE80211_RADIOTAP_F_RX_BADFCS;
391 //memset(radiotap_hdr.pad, 0x11, IEEE80211_RADIOTAP_HDRLEN - 18); 390 //memset(radiotap_hdr.pad, 0x11, IEEE80211_RADIOTAP_HDRLEN - 18);
392 391
@@ -399,7 +398,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
399 if ((skb_headroom(skb) < sizeof(struct rx_radiotap_hdr)) && 398 if ((skb_headroom(skb) < sizeof(struct rx_radiotap_hdr)) &&
400 pskb_expand_head(skb, sizeof(struct rx_radiotap_hdr), 0, 399 pskb_expand_head(skb, sizeof(struct rx_radiotap_hdr), 0,
401 GFP_ATOMIC)) { 400 GFP_ATOMIC)) {
402 lbs_pr_alert( "%s: couldn't pskb_expand_head\n", 401 lbs_pr_alert("%s: couldn't pskb_expand_head\n",
403 __func__); 402 __func__);
404 } 403 }
405 404
@@ -414,7 +413,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
414 413
415 default: 414 default:
416 /* unknown header */ 415 /* unknown header */
417 lbs_pr_alert( "Unknown radiomode (%i)\n", 416 lbs_pr_alert("Unknown radiomode %i\n",
418 priv->adapter->radiomode); 417 priv->adapter->radiomode);
419 /* don't export any header */ 418 /* don't export any header */
420 /* chop the rxpd */ 419 /* chop the rxpd */
@@ -431,15 +430,16 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
431 430
432 wlan_compute_rssi(priv, prxpd); 431 wlan_compute_rssi(priv, prxpd);
433 432
434 lbs_pr_debug(1, "RX Data: size of actual packet = %d\n", skb->len); 433 lbs_deb_rx("rx data: size of actual packet %d\n", skb->len);
435 priv->stats.rx_bytes += skb->len; 434 priv->stats.rx_bytes += skb->len;
436 priv->stats.rx_packets++; 435 priv->stats.rx_packets++;
437 436
438 libertas_upload_rx_packet(priv, skb); 437 libertas_upload_rx_packet(priv, skb);
439 438
440 ret = 0; 439 ret = 0;
441done:
442 LEAVE();
443 440
444 return (ret); 441done:
442 skb->protocol = __constant_htons(0x0019); /* ETH_P_80211_RAW */
443 lbs_deb_leave_args(LBS_DEB_RX, "ret %d", ret);
444 return ret;
445} 445}
diff --git a/drivers/net/wireless/libertas/sbi.h b/drivers/net/wireless/libertas/sbi.h
deleted file mode 100644
index 59d3a59ccef0..000000000000
--- a/drivers/net/wireless/libertas/sbi.h
+++ /dev/null
@@ -1,40 +0,0 @@
1/**
2 * This file contains IF layer definitions.
3 */
4
5#ifndef _SBI_H_
6#define _SBI_H_
7
8#include <linux/interrupt.h>
9
10#include "defs.h"
11
12/** INT status Bit Definition*/
13#define his_cmddnldrdy 0x01
14#define his_cardevent 0x02
15#define his_cmdupldrdy 0x04
16
17#ifndef DEV_NAME_LEN
18#define DEV_NAME_LEN 32
19#endif
20
21#define SBI_EVENT_CAUSE_SHIFT 3
22
23/* Probe and Check if the card is present*/
24int libertas_sbi_register_dev(wlan_private * priv);
25int libertas_sbi_unregister_dev(wlan_private *);
26int libertas_sbi_get_int_status(wlan_private * priv, u8 *);
27int libertas_sbi_register(void);
28void libertas_sbi_unregister(void);
29int libertas_sbi_prog_firmware(wlan_private *);
30
31int libertas_sbi_read_event_cause(wlan_private *);
32int libertas_sbi_host_to_card(wlan_private * priv, u8 type, u8 * payload, u16 nb);
33wlan_private *libertas_sbi_get_priv(void *card);
34
35#ifdef ENABLE_PM
36int libertas_sbi_suspend(wlan_private *);
37int libertas_sbi_resume(wlan_private *);
38#endif
39
40#endif /* _SBI_H */
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
index 3c0b1a2a1727..606af50fa09b 100644
--- a/drivers/net/wireless/libertas/scan.c
+++ b/drivers/net/wireless/libertas/scan.c
@@ -8,6 +8,7 @@
8#include <linux/if.h> 8#include <linux/if.h>
9#include <linux/netdevice.h> 9#include <linux/netdevice.h>
10#include <linux/wireless.h> 10#include <linux/wireless.h>
11#include <linux/etherdevice.h>
11 12
12#include <net/ieee80211.h> 13#include <net/ieee80211.h>
13#include <net/iw_handler.h> 14#include <net/iw_handler.h>
@@ -58,12 +59,82 @@
58//! Scan time specified in the channel TLV for each channel for active scans 59//! Scan time specified in the channel TLV for each channel for active scans
59#define MRVDRV_ACTIVE_SCAN_CHAN_TIME 100 60#define MRVDRV_ACTIVE_SCAN_CHAN_TIME 100
60 61
61//! Macro to enable/disable SSID checking before storing a scan table 62static const u8 zeromac[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
62#ifdef DISCARD_BAD_SSID 63static const u8 bcastmac[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
63#define CHECK_SSID_IS_VALID(x) ssid_valid(&bssidEntry.ssid) 64
64#else 65static inline void clear_bss_descriptor (struct bss_descriptor * bss)
65#define CHECK_SSID_IS_VALID(x) 1 66{
66#endif 67 /* Don't blow away ->list, just BSS data */
68 memset(bss, 0, offsetof(struct bss_descriptor, list));
69}
70
71static inline int match_bss_no_security(struct wlan_802_11_security * secinfo,
72 struct bss_descriptor * match_bss)
73{
74 if ( !secinfo->wep_enabled
75 && !secinfo->WPAenabled
76 && !secinfo->WPA2enabled
77 && match_bss->wpa_ie[0] != WPA_IE
78 && match_bss->rsn_ie[0] != WPA2_IE
79 && !match_bss->privacy) {
80 return 1;
81 }
82 return 0;
83}
84
85static inline int match_bss_static_wep(struct wlan_802_11_security * secinfo,
86 struct bss_descriptor * match_bss)
87{
88 if ( secinfo->wep_enabled
89 && !secinfo->WPAenabled
90 && !secinfo->WPA2enabled
91 && match_bss->privacy) {
92 return 1;
93 }
94 return 0;
95}
96
97static inline int match_bss_wpa(struct wlan_802_11_security * secinfo,
98 struct bss_descriptor * match_bss)
99{
100 if ( !secinfo->wep_enabled
101 && secinfo->WPAenabled
102 && (match_bss->wpa_ie[0] == WPA_IE)
103 /* privacy bit may NOT be set in some APs like LinkSys WRT54G
104 && bss->privacy */
105 ) {
106 return 1;
107 }
108 return 0;
109}
110
111static inline int match_bss_wpa2(struct wlan_802_11_security * secinfo,
112 struct bss_descriptor * match_bss)
113{
114 if ( !secinfo->wep_enabled
115 && secinfo->WPA2enabled
116 && (match_bss->rsn_ie[0] == WPA2_IE)
117 /* privacy bit may NOT be set in some APs like LinkSys WRT54G
118 && bss->privacy */
119 ) {
120 return 1;
121 }
122 return 0;
123}
124
125static inline int match_bss_dynamic_wep(struct wlan_802_11_security * secinfo,
126 struct bss_descriptor * match_bss)
127{
128 if ( !secinfo->wep_enabled
129 && !secinfo->WPAenabled
130 && !secinfo->WPA2enabled
131 && (match_bss->wpa_ie[0] != WPA_IE)
132 && (match_bss->rsn_ie[0] != WPA2_IE)
133 && match_bss->privacy) {
134 return 1;
135 }
136 return 0;
137}
67 138
68/** 139/**
69 * @brief Check if a scanned network compatible with the driver settings 140 * @brief Check if a scanned network compatible with the driver settings
@@ -84,123 +155,63 @@
84 * 155 *
85 * @return Index in scantable, or error code if negative 156 * @return Index in scantable, or error code if negative
86 */ 157 */
87static int is_network_compatible(wlan_adapter * adapter, int index, u8 mode) 158static int is_network_compatible(wlan_adapter * adapter,
159 struct bss_descriptor * bss, u8 mode)
88{ 160{
89 ENTER(); 161 int matched = 0;
90 162
91 if (adapter->scantable[index].mode == mode) { 163 lbs_deb_enter(LBS_DEB_ASSOC);
92 if ( !adapter->secinfo.wep_enabled 164
93 && !adapter->secinfo.WPAenabled 165 if (bss->mode != mode)
94 && !adapter->secinfo.WPA2enabled 166 goto done;
95 && adapter->scantable[index].wpa_ie[0] != WPA_IE 167
96 && adapter->scantable[index].rsn_ie[0] != WPA2_IE 168 if ((matched = match_bss_no_security(&adapter->secinfo, bss))) {
97 && !adapter->scantable[index].privacy) { 169 goto done;
98 /* no security */ 170 } else if ((matched = match_bss_static_wep(&adapter->secinfo, bss))) {
99 LEAVE(); 171 goto done;
100 return index; 172 } else if ((matched = match_bss_wpa(&adapter->secinfo, bss))) {
101 } else if ( adapter->secinfo.wep_enabled 173 lbs_deb_scan(
102 && !adapter->secinfo.WPAenabled 174 "is_network_compatible() WPA: wpa_ie=%#x "
103 && !adapter->secinfo.WPA2enabled 175 "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s "
104 && adapter->scantable[index].privacy) { 176 "privacy=%#x\n", bss->wpa_ie[0], bss->rsn_ie[0],
105 /* static WEP enabled */
106 LEAVE();
107 return index;
108 } else if ( !adapter->secinfo.wep_enabled
109 && adapter->secinfo.WPAenabled
110 && !adapter->secinfo.WPA2enabled
111 && (adapter->scantable[index].wpa_ie[0] == WPA_IE)
112 /* privacy bit may NOT be set in some APs like LinkSys WRT54G
113 && adapter->scantable[index].privacy */
114 ) {
115 /* WPA enabled */
116 lbs_pr_debug(1,
117 "is_network_compatible() WPA: index=%d wpa_ie=%#x "
118 "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s "
119 "privacy=%#x\n", index,
120 adapter->scantable[index].wpa_ie[0],
121 adapter->scantable[index].rsn_ie[0],
122 adapter->secinfo.wep_enabled ? "e" : "d",
123 adapter->secinfo.WPAenabled ? "e" : "d",
124 adapter->secinfo.WPA2enabled ? "e" : "d",
125 adapter->scantable[index].privacy);
126 LEAVE();
127 return index;
128 } else if ( !adapter->secinfo.wep_enabled
129 && !adapter->secinfo.WPAenabled
130 && adapter->secinfo.WPA2enabled
131 && (adapter->scantable[index].rsn_ie[0] == WPA2_IE)
132 /* privacy bit may NOT be set in some APs like LinkSys WRT54G
133 && adapter->scantable[index].privacy */
134 ) {
135 /* WPA2 enabled */
136 lbs_pr_debug(1,
137 "is_network_compatible() WPA2: index=%d wpa_ie=%#x "
138 "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s "
139 "privacy=%#x\n", index,
140 adapter->scantable[index].wpa_ie[0],
141 adapter->scantable[index].rsn_ie[0],
142 adapter->secinfo.wep_enabled ? "e" : "d",
143 adapter->secinfo.WPAenabled ? "e" : "d",
144 adapter->secinfo.WPA2enabled ? "e" : "d",
145 adapter->scantable[index].privacy);
146 LEAVE();
147 return index;
148 } else if ( !adapter->secinfo.wep_enabled
149 && !adapter->secinfo.WPAenabled
150 && !adapter->secinfo.WPA2enabled
151 && (adapter->scantable[index].wpa_ie[0] != WPA_IE)
152 && (adapter->scantable[index].rsn_ie[0] != WPA2_IE)
153 && adapter->scantable[index].privacy) {
154 /* dynamic WEP enabled */
155 lbs_pr_debug(1,
156 "is_network_compatible() dynamic WEP: index=%d "
157 "wpa_ie=%#x wpa2_ie=%#x privacy=%#x\n",
158 index,
159 adapter->scantable[index].wpa_ie[0],
160 adapter->scantable[index].rsn_ie[0],
161 adapter->scantable[index].privacy);
162 LEAVE();
163 return index;
164 }
165
166 /* security doesn't match */
167 lbs_pr_debug(1,
168 "is_network_compatible() FAILED: index=%d wpa_ie=%#x "
169 "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s privacy=%#x\n",
170 index,
171 adapter->scantable[index].wpa_ie[0],
172 adapter->scantable[index].rsn_ie[0],
173 adapter->secinfo.wep_enabled ? "e" : "d", 177 adapter->secinfo.wep_enabled ? "e" : "d",
174 adapter->secinfo.WPAenabled ? "e" : "d", 178 adapter->secinfo.WPAenabled ? "e" : "d",
175 adapter->secinfo.WPA2enabled ? "e" : "d", 179 adapter->secinfo.WPA2enabled ? "e" : "d",
176 adapter->scantable[index].privacy); 180 bss->privacy);
177 LEAVE(); 181 goto done;
178 return -ECONNREFUSED; 182 } else if ((matched = match_bss_wpa2(&adapter->secinfo, bss))) {
179 } 183 lbs_deb_scan(
180 184 "is_network_compatible() WPA2: wpa_ie=%#x "
181 /* mode doesn't match */ 185 "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s "
182 LEAVE(); 186 "privacy=%#x\n", bss->wpa_ie[0], bss->rsn_ie[0],
183 return -ENETUNREACH; 187 adapter->secinfo.wep_enabled ? "e" : "d",
184} 188 adapter->secinfo.WPAenabled ? "e" : "d",
185 189 adapter->secinfo.WPA2enabled ? "e" : "d",
186/** 190 bss->privacy);
187 * @brief This function validates a SSID as being able to be printed 191 goto done;
188 * 192 } else if ((matched = match_bss_dynamic_wep(&adapter->secinfo, bss))) {
189 * @param pssid SSID structure to validate 193 lbs_deb_scan(
190 * 194 "is_network_compatible() dynamic WEP: "
191 * @return TRUE or FALSE 195 "wpa_ie=%#x wpa2_ie=%#x privacy=%#x\n",
192 */ 196 bss->wpa_ie[0],
193static u8 ssid_valid(struct WLAN_802_11_SSID *pssid) 197 bss->rsn_ie[0],
194{ 198 bss->privacy);
195 int ssididx; 199 goto done;
196
197 for (ssididx = 0; ssididx < pssid->ssidlength; ssididx++) {
198 if (!isprint(pssid->ssid[ssididx])) {
199 return 0;
200 }
201 } 200 }
202 201
203 return 1; 202 /* bss security settings don't match those configured on card */
203 lbs_deb_scan(
204 "is_network_compatible() FAILED: wpa_ie=%#x "
205 "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s privacy=%#x\n",
206 bss->wpa_ie[0], bss->rsn_ie[0],
207 adapter->secinfo.wep_enabled ? "e" : "d",
208 adapter->secinfo.WPAenabled ? "e" : "d",
209 adapter->secinfo.WPA2enabled ? "e" : "d",
210 bss->privacy);
211
212done:
213 lbs_deb_leave(LBS_DEB_SCAN);
214 return matched;
204} 215}
205 216
206/** 217/**
@@ -220,44 +231,19 @@ static u8 ssid_valid(struct WLAN_802_11_SSID *pssid)
220static void wlan_scan_process_results(wlan_private * priv) 231static void wlan_scan_process_results(wlan_private * priv)
221{ 232{
222 wlan_adapter *adapter = priv->adapter; 233 wlan_adapter *adapter = priv->adapter;
223 int foundcurrent; 234 struct bss_descriptor * iter_bss;
224 int i; 235 int i = 0;
225
226 foundcurrent = 0;
227
228 if (adapter->connect_status == libertas_connected) {
229 /* try to find the current BSSID in the new scan list */
230 for (i = 0; i < adapter->numinscantable; i++) {
231 if (!libertas_SSID_cmp(&adapter->scantable[i].ssid,
232 &adapter->curbssparams.ssid) &&
233 !memcmp(adapter->curbssparams.bssid,
234 adapter->scantable[i].macaddress,
235 ETH_ALEN)) {
236 foundcurrent = 1;
237 }
238 }
239 236
240 if (foundcurrent) { 237 if (adapter->connect_status == libertas_connected)
241 /* Make a copy of current BSSID descriptor */ 238 return;
242 memcpy(&adapter->curbssparams.bssdescriptor,
243 &adapter->scantable[i],
244 sizeof(adapter->curbssparams.bssdescriptor));
245 }
246 }
247 239
248 for (i = 0; i < adapter->numinscantable; i++) { 240 mutex_lock(&adapter->lock);
249 lbs_pr_debug(1, "Scan:(%02d) %02x:%02x:%02x:%02x:%02x:%02x, " 241 list_for_each_entry (iter_bss, &adapter->network_list, list) {
250 "RSSI[%03d], SSID[%s]\n", 242 lbs_deb_scan("Scan:(%02d) " MAC_FMT ", RSSI[%03d], SSID[%s]\n",
251 i, 243 i++, MAC_ARG(iter_bss->bssid), (s32) iter_bss->rssi,
252 adapter->scantable[i].macaddress[0], 244 escape_essid(iter_bss->ssid, iter_bss->ssid_len));
253 adapter->scantable[i].macaddress[1],
254 adapter->scantable[i].macaddress[2],
255 adapter->scantable[i].macaddress[3],
256 adapter->scantable[i].macaddress[4],
257 adapter->scantable[i].macaddress[5],
258 (s32) adapter->scantable[i].rssi,
259 adapter->scantable[i].ssid.ssid);
260 } 245 }
246 mutex_unlock(&adapter->lock);
261} 247}
262 248
263/** 249/**
@@ -338,14 +324,12 @@ static void wlan_scan_create_channel_list(wlan_private * priv,
338 324
339 if (scantype == cmd_scan_type_passive) { 325 if (scantype == cmd_scan_type_passive) {
340 scanchanlist[chanidx].maxscantime = 326 scanchanlist[chanidx].maxscantime =
341 cpu_to_le16 327 cpu_to_le16(MRVDRV_PASSIVE_SCAN_CHAN_TIME);
342 (MRVDRV_PASSIVE_SCAN_CHAN_TIME);
343 scanchanlist[chanidx].chanscanmode.passivescan = 328 scanchanlist[chanidx].chanscanmode.passivescan =
344 1; 329 1;
345 } else { 330 } else {
346 scanchanlist[chanidx].maxscantime = 331 scanchanlist[chanidx].maxscantime =
347 cpu_to_le16 332 cpu_to_le16(MRVDRV_ACTIVE_SCAN_CHAN_TIME);
348 (MRVDRV_ACTIVE_SCAN_CHAN_TIME);
349 scanchanlist[chanidx].chanscanmode.passivescan = 333 scanchanlist[chanidx].chanscanmode.passivescan =
350 0; 334 0;
351 } 335 }
@@ -408,13 +392,11 @@ wlan_scan_setup_scan_config(wlan_private * priv,
408 u8 * pscancurrentonly) 392 u8 * pscancurrentonly)
409{ 393{
410 wlan_adapter *adapter = priv->adapter; 394 wlan_adapter *adapter = priv->adapter;
411 const u8 zeromac[ETH_ALEN] = { 0, 0, 0, 0, 0, 0 };
412 struct mrvlietypes_numprobes *pnumprobestlv; 395 struct mrvlietypes_numprobes *pnumprobestlv;
413 struct mrvlietypes_ssidparamset *pssidtlv; 396 struct mrvlietypes_ssidparamset *pssidtlv;
414 struct wlan_scan_cmd_config * pscancfgout = NULL; 397 struct wlan_scan_cmd_config * pscancfgout = NULL;
415 u8 *ptlvpos; 398 u8 *ptlvpos;
416 u16 numprobes; 399 u16 numprobes;
417 u16 ssidlen;
418 int chanidx; 400 int chanidx;
419 int scantype; 401 int scantype;
420 int scandur; 402 int scandur;
@@ -471,21 +453,18 @@ wlan_scan_setup_scan_config(wlan_private * priv,
471 * Set the BSSID filter to the incoming configuration, 453 * Set the BSSID filter to the incoming configuration,
472 * if non-zero. If not set, it will remain disabled (all zeros). 454 * if non-zero. If not set, it will remain disabled (all zeros).
473 */ 455 */
474 memcpy(pscancfgout->specificBSSID, 456 memcpy(pscancfgout->bssid, puserscanin->bssid,
475 puserscanin->specificBSSID, 457 sizeof(pscancfgout->bssid));
476 sizeof(pscancfgout->specificBSSID));
477
478 ssidlen = strlen(puserscanin->specificSSID);
479 458
480 if (ssidlen) { 459 if (puserscanin->ssid_len) {
481 pssidtlv = 460 pssidtlv =
482 (struct mrvlietypes_ssidparamset *) pscancfgout-> 461 (struct mrvlietypes_ssidparamset *) pscancfgout->
483 tlvbuffer; 462 tlvbuffer;
484 pssidtlv->header.type = cpu_to_le16(TLV_TYPE_SSID); 463 pssidtlv->header.type = cpu_to_le16(TLV_TYPE_SSID);
485 pssidtlv->header.len = cpu_to_le16(ssidlen); 464 pssidtlv->header.len = cpu_to_le16(puserscanin->ssid_len);
486 memcpy(pssidtlv->ssid, puserscanin->specificSSID, 465 memcpy(pssidtlv->ssid, puserscanin->ssid,
487 ssidlen); 466 puserscanin->ssid_len);
488 ptlvpos += sizeof(pssidtlv->header) + ssidlen; 467 ptlvpos += sizeof(pssidtlv->header) + puserscanin->ssid_len;
489 } 468 }
490 469
491 /* 470 /*
@@ -494,8 +473,8 @@ wlan_scan_setup_scan_config(wlan_private * priv,
494 * scan results. That is not an issue with an SSID or BSSID 473 * scan results. That is not an issue with an SSID or BSSID
495 * filter applied to the scan results in the firmware. 474 * filter applied to the scan results in the firmware.
496 */ 475 */
497 if (ssidlen || (memcmp(pscancfgout->specificBSSID, 476 if ( puserscanin->ssid_len
498 &zeromac, sizeof(zeromac)) != 0)) { 477 || (compare_ether_addr(pscancfgout->bssid, &zeromac[0]) != 0)) {
499 *pmaxchanperscan = MRVDRV_MAX_CHANNELS_PER_SCAN; 478 *pmaxchanperscan = MRVDRV_MAX_CHANNELS_PER_SCAN;
500 *pfilteredscan = 1; 479 *pfilteredscan = 1;
501 } 480 }
@@ -507,16 +486,11 @@ wlan_scan_setup_scan_config(wlan_private * priv,
507 /* If the input config or adapter has the number of Probes set, add tlv */ 486 /* If the input config or adapter has the number of Probes set, add tlv */
508 if (numprobes) { 487 if (numprobes) {
509 pnumprobestlv = (struct mrvlietypes_numprobes *) ptlvpos; 488 pnumprobestlv = (struct mrvlietypes_numprobes *) ptlvpos;
510 pnumprobestlv->header.type = 489 pnumprobestlv->header.type = cpu_to_le16(TLV_TYPE_NUMPROBES);
511 cpu_to_le16(TLV_TYPE_NUMPROBES); 490 pnumprobestlv->header.len = cpu_to_le16(2);
512 pnumprobestlv->header.len = sizeof(pnumprobestlv->numprobes);
513 pnumprobestlv->numprobes = cpu_to_le16(numprobes); 491 pnumprobestlv->numprobes = cpu_to_le16(numprobes);
514 492
515 ptlvpos += 493 ptlvpos += sizeof(*pnumprobestlv);
516 sizeof(pnumprobestlv->header) + pnumprobestlv->header.len;
517
518 pnumprobestlv->header.len =
519 cpu_to_le16(pnumprobestlv->header.len);
520 } 494 }
521 495
522 /* 496 /*
@@ -529,7 +503,7 @@ wlan_scan_setup_scan_config(wlan_private * priv,
529 503
530 if (puserscanin && puserscanin->chanlist[0].channumber) { 504 if (puserscanin && puserscanin->chanlist[0].channumber) {
531 505
532 lbs_pr_debug(1, "Scan: Using supplied channel list\n"); 506 lbs_deb_scan("Scan: Using supplied channel list\n");
533 507
534 for (chanidx = 0; 508 for (chanidx = 0;
535 chanidx < WLAN_IOCTL_USER_SCAN_CHAN_MAX 509 chanidx < WLAN_IOCTL_USER_SCAN_CHAN_MAX
@@ -573,11 +547,11 @@ wlan_scan_setup_scan_config(wlan_private * priv,
573 == 547 ==
574 priv->adapter->curbssparams.channel)) { 548 priv->adapter->curbssparams.channel)) {
575 *pscancurrentonly = 1; 549 *pscancurrentonly = 1;
576 lbs_pr_debug(1, "Scan: Scanning current channel only"); 550 lbs_deb_scan("Scan: Scanning current channel only");
577 } 551 }
578 552
579 } else { 553 } else {
580 lbs_pr_debug(1, "Scan: Creating full region channel list\n"); 554 lbs_deb_scan("Scan: Creating full region channel list\n");
581 wlan_scan_create_channel_list(priv, pscanchanlist, 555 wlan_scan_create_channel_list(priv, pscanchanlist,
582 *pfilteredscan); 556 *pfilteredscan);
583 } 557 }
@@ -613,7 +587,9 @@ static int wlan_scan_channel_list(wlan_private * priv,
613 u8 filteredscan, 587 u8 filteredscan,
614 struct wlan_scan_cmd_config * pscancfgout, 588 struct wlan_scan_cmd_config * pscancfgout,
615 struct mrvlietypes_chanlistparamset * pchantlvout, 589 struct mrvlietypes_chanlistparamset * pchantlvout,
616 struct chanscanparamset * pscanchanlist) 590 struct chanscanparamset * pscanchanlist,
591 const struct wlan_ioctl_user_scan_cfg * puserscanin,
592 int full_scan)
617{ 593{
618 struct chanscanparamset *ptmpchan; 594 struct chanscanparamset *ptmpchan;
619 struct chanscanparamset *pstartchan; 595 struct chanscanparamset *pstartchan;
@@ -621,11 +597,13 @@ static int wlan_scan_channel_list(wlan_private * priv,
621 int doneearly; 597 int doneearly;
622 int tlvidx; 598 int tlvidx;
623 int ret = 0; 599 int ret = 0;
600 int scanned = 0;
601 union iwreq_data wrqu;
624 602
625 ENTER(); 603 lbs_deb_enter(LBS_DEB_ASSOC);
626 604
627 if (pscancfgout == 0 || pchantlvout == 0 || pscanchanlist == 0) { 605 if (pscancfgout == 0 || pchantlvout == 0 || pscanchanlist == 0) {
628 lbs_pr_debug(1, "Scan: Null detect: %p, %p, %p\n", 606 lbs_deb_scan("Scan: Null detect: %p, %p, %p\n",
629 pscancfgout, pchantlvout, pscanchanlist); 607 pscancfgout, pchantlvout, pscanchanlist);
630 return -1; 608 return -1;
631 } 609 }
@@ -635,6 +613,9 @@ static int wlan_scan_channel_list(wlan_private * priv,
635 /* Set the temp channel struct pointer to the start of the desired list */ 613 /* Set the temp channel struct pointer to the start of the desired list */
636 ptmpchan = pscanchanlist; 614 ptmpchan = pscanchanlist;
637 615
616 if (priv->adapter->last_scanned_channel && !puserscanin)
617 ptmpchan += priv->adapter->last_scanned_channel;
618
638 /* Loop through the desired channel list, sending a new firmware scan 619 /* Loop through the desired channel list, sending a new firmware scan
639 * commands for each maxchanperscan channels (or for 1,6,11 individually 620 * commands for each maxchanperscan channels (or for 1,6,11 individually
640 * if configured accordingly) 621 * if configured accordingly)
@@ -654,9 +635,9 @@ static int wlan_scan_channel_list(wlan_private * priv,
654 * - doneearly is set (controlling individual scanning of 1,6,11) 635 * - doneearly is set (controlling individual scanning of 1,6,11)
655 */ 636 */
656 while (tlvidx < maxchanperscan && ptmpchan->channumber 637 while (tlvidx < maxchanperscan && ptmpchan->channumber
657 && !doneearly) { 638 && !doneearly && scanned < 2) {
658 639
659 lbs_pr_debug(1, 640 lbs_deb_scan(
660 "Scan: Chan(%3d), Radio(%d), mode(%d,%d), Dur(%d)\n", 641 "Scan: Chan(%3d), Radio(%d), mode(%d,%d), Dur(%d)\n",
661 ptmpchan->channumber, ptmpchan->radiotype, 642 ptmpchan->channumber, ptmpchan->radiotype,
662 ptmpchan->chanscanmode.passivescan, 643 ptmpchan->chanscanmode.passivescan,
@@ -668,8 +649,11 @@ static int wlan_scan_channel_list(wlan_private * priv,
668 ptmpchan, sizeof(pchantlvout->chanscanparam)); 649 ptmpchan, sizeof(pchantlvout->chanscanparam));
669 650
670 /* Increment the TLV header length by the size appended */ 651 /* Increment the TLV header length by the size appended */
671 pchantlvout->header.len += 652 /* Ew, it would be _so_ nice if we could just declare the
672 sizeof(pchantlvout->chanscanparam); 653 variable little-endian and let GCC handle it for us */
654 pchantlvout->header.len =
655 cpu_to_le16(le16_to_cpu(pchantlvout->header.len) +
656 sizeof(pchantlvout->chanscanparam));
673 657
674 /* 658 /*
675 * The tlv buffer length is set to the number of bytes of the 659 * 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,
683 /* Add the size of the channel tlv header and the data length */ 667 /* Add the size of the channel tlv header and the data length */
684 pscancfgout->tlvbufferlen += 668 pscancfgout->tlvbufferlen +=
685 (sizeof(pchantlvout->header) 669 (sizeof(pchantlvout->header)
686 + pchantlvout->header.len); 670 + le16_to_cpu(pchantlvout->header.len));
687 671
688 /* Increment the index to the channel tlv we are constructing */ 672 /* Increment the index to the channel tlv we are constructing */
689 tlvidx++; 673 tlvidx++;
@@ -701,6 +685,7 @@ static int wlan_scan_channel_list(wlan_private * priv,
701 685
702 /* Increment the tmp pointer to the next channel to be scanned */ 686 /* Increment the tmp pointer to the next channel to be scanned */
703 ptmpchan++; 687 ptmpchan++;
688 scanned++;
704 689
705 /* Stop the loop if the *next* channel is in the 1,6,11 set. 690 /* Stop the loop if the *next* channel is in the 1,6,11 set.
706 * This will cause it to be the only channel scanned on the next 691 * 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,
716 /* Send the scan command to the firmware with the specified cfg */ 701 /* Send the scan command to the firmware with the specified cfg */
717 ret = libertas_prepare_and_send_command(priv, cmd_802_11_scan, 0, 702 ret = libertas_prepare_and_send_command(priv, cmd_802_11_scan, 0,
718 0, 0, pscancfgout); 703 0, 0, pscancfgout);
704 if (scanned >= 2 && !full_scan) {
705 ret = 0;
706 goto done;
707 }
708 scanned = 0;
719 } 709 }
720 710
721 LEAVE(); 711done:
712 priv->adapter->last_scanned_channel = ptmpchan->channumber;
713
714 /* Tell userspace the scan table has been updated */
715 memset(&wrqu, 0, sizeof(union iwreq_data));
716 wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL);
717
718 lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret);
722 return ret; 719 return ret;
723} 720}
724 721
722static void
723clear_selected_scan_list_entries(wlan_adapter * adapter,
724 const struct wlan_ioctl_user_scan_cfg * scan_cfg)
725{
726 struct bss_descriptor * bss;
727 struct bss_descriptor * safe;
728 u32 clear_ssid_flag = 0, clear_bssid_flag = 0;
729
730 if (!scan_cfg)
731 return;
732
733 if (scan_cfg->clear_ssid && scan_cfg->ssid_len)
734 clear_ssid_flag = 1;
735
736 if (scan_cfg->clear_bssid
737 && (compare_ether_addr(scan_cfg->bssid, &zeromac[0]) != 0)
738 && (compare_ether_addr(scan_cfg->bssid, &bcastmac[0]) != 0)) {
739 clear_bssid_flag = 1;
740 }
741
742 if (!clear_ssid_flag && !clear_bssid_flag)
743 return;
744
745 mutex_lock(&adapter->lock);
746 list_for_each_entry_safe (bss, safe, &adapter->network_list, list) {
747 u32 clear = 0;
748
749 /* Check for an SSID match */
750 if ( clear_ssid_flag
751 && (bss->ssid_len == scan_cfg->ssid_len)
752 && !memcmp(bss->ssid, scan_cfg->ssid, bss->ssid_len))
753 clear = 1;
754
755 /* Check for a BSSID match */
756 if ( clear_bssid_flag
757 && !compare_ether_addr(bss->bssid, scan_cfg->bssid))
758 clear = 1;
759
760 if (clear) {
761 list_move_tail (&bss->list, &adapter->network_free_list);
762 clear_bss_descriptor(bss);
763 }
764 }
765 mutex_unlock(&adapter->lock);
766}
767
768
725/** 769/**
726 * @brief Internal function used to start a scan based on an input config 770 * @brief Internal function used to start a scan based on an input config
727 * 771 *
@@ -736,19 +780,19 @@ static int wlan_scan_channel_list(wlan_private * priv,
736 * @return 0 or < 0 if error 780 * @return 0 or < 0 if error
737 */ 781 */
738int wlan_scan_networks(wlan_private * priv, 782int wlan_scan_networks(wlan_private * priv,
739 const struct wlan_ioctl_user_scan_cfg * puserscanin) 783 const struct wlan_ioctl_user_scan_cfg * puserscanin,
784 int full_scan)
740{ 785{
741 wlan_adapter *adapter = priv->adapter; 786 wlan_adapter * adapter = priv->adapter;
742 struct mrvlietypes_chanlistparamset *pchantlvout; 787 struct mrvlietypes_chanlistparamset *pchantlvout;
743 struct chanscanparamset * scan_chan_list = NULL; 788 struct chanscanparamset * scan_chan_list = NULL;
744 struct wlan_scan_cmd_config * scan_cfg = NULL; 789 struct wlan_scan_cmd_config * scan_cfg = NULL;
745 u8 keeppreviousscan;
746 u8 filteredscan; 790 u8 filteredscan;
747 u8 scancurrentchanonly; 791 u8 scancurrentchanonly;
748 int maxchanperscan; 792 int maxchanperscan;
749 int ret; 793 int ret;
750 794
751 ENTER(); 795 lbs_deb_enter(LBS_DEB_ASSOC);
752 796
753 scan_chan_list = kzalloc(sizeof(struct chanscanparamset) * 797 scan_chan_list = kzalloc(sizeof(struct chanscanparamset) *
754 WLAN_IOCTL_USER_SCAN_CHAN_MAX, GFP_KERNEL); 798 WLAN_IOCTL_USER_SCAN_CHAN_MAX, GFP_KERNEL);
@@ -769,22 +813,14 @@ int wlan_scan_networks(wlan_private * priv,
769 goto out; 813 goto out;
770 } 814 }
771 815
772 keeppreviousscan = 0; 816 clear_selected_scan_list_entries(adapter, puserscanin);
773
774 if (puserscanin) {
775 keeppreviousscan = puserscanin->keeppreviousscan;
776 }
777
778 if (!keeppreviousscan) {
779 memset(adapter->scantable, 0x00,
780 sizeof(struct bss_descriptor) * MRVDRV_MAX_BSSID_LIST);
781 adapter->numinscantable = 0;
782 }
783 817
784 /* Keep the data path active if we are only scanning our current channel */ 818 /* Keep the data path active if we are only scanning our current channel */
785 if (!scancurrentchanonly) { 819 if (!scancurrentchanonly) {
786 netif_stop_queue(priv->wlan_dev.netdev); 820 netif_stop_queue(priv->dev);
787 netif_carrier_off(priv->wlan_dev.netdev); 821 netif_carrier_off(priv->dev);
822 netif_stop_queue(priv->mesh_dev);
823 netif_carrier_off(priv->mesh_dev);
788 } 824 }
789 825
790 ret = wlan_scan_channel_list(priv, 826 ret = wlan_scan_channel_list(priv,
@@ -792,7 +828,9 @@ int wlan_scan_networks(wlan_private * priv,
792 filteredscan, 828 filteredscan,
793 scan_cfg, 829 scan_cfg,
794 pchantlvout, 830 pchantlvout,
795 scan_chan_list); 831 scan_chan_list,
832 puserscanin,
833 full_scan);
796 834
797 /* Process the resulting scan table: 835 /* Process the resulting scan table:
798 * - Remove any bad ssids 836 * - Remove any bad ssids
@@ -801,8 +839,10 @@ int wlan_scan_networks(wlan_private * priv,
801 wlan_scan_process_results(priv); 839 wlan_scan_process_results(priv);
802 840
803 if (priv->adapter->connect_status == libertas_connected) { 841 if (priv->adapter->connect_status == libertas_connected) {
804 netif_carrier_on(priv->wlan_dev.netdev); 842 netif_carrier_on(priv->dev);
805 netif_wake_queue(priv->wlan_dev.netdev); 843 netif_wake_queue(priv->dev);
844 netif_carrier_on(priv->mesh_dev);
845 netif_wake_queue(priv->mesh_dev);
806 } 846 }
807 847
808out: 848out:
@@ -812,7 +852,7 @@ out:
812 if (scan_chan_list) 852 if (scan_chan_list)
813 kfree(scan_chan_list); 853 kfree(scan_chan_list);
814 854
815 LEAVE(); 855 lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret);
816 return ret; 856 return ret;
817} 857}
818 858
@@ -843,7 +883,7 @@ void wlan_ret_802_11_scan_get_tlv_ptrs(struct mrvlietypes_data * ptlv,
843 tlvbufleft = tlvbufsize; 883 tlvbufleft = tlvbufsize;
844 *ptsftlv = NULL; 884 *ptsftlv = NULL;
845 885
846 lbs_pr_debug(1, "SCAN_RESP: tlvbufsize = %d\n", tlvbufsize); 886 lbs_deb_scan("SCAN_RESP: tlvbufsize = %d\n", tlvbufsize);
847 lbs_dbg_hex("SCAN_RESP: TLV Buf", (u8 *) ptlv, tlvbufsize); 887 lbs_dbg_hex("SCAN_RESP: TLV Buf", (u8 *) ptlv, tlvbufsize);
848 888
849 while (tlvbufleft >= sizeof(struct mrvlietypesheader)) { 889 while (tlvbufleft >= sizeof(struct mrvlietypesheader)) {
@@ -856,7 +896,7 @@ void wlan_ret_802_11_scan_get_tlv_ptrs(struct mrvlietypes_data * ptlv,
856 break; 896 break;
857 897
858 default: 898 default:
859 lbs_pr_debug(1, "SCAN_RESP: Unhandled TLV = %d\n", 899 lbs_deb_scan("SCAN_RESP: Unhandled TLV = %d\n",
860 tlvtype); 900 tlvtype);
861 /* Give up, this seems corrupted */ 901 /* Give up, this seems corrupted */
862 return; 902 return;
@@ -875,12 +915,12 @@ void wlan_ret_802_11_scan_get_tlv_ptrs(struct mrvlietypes_data * ptlv,
875 * response or beacon from the scan command. Record information as needed 915 * response or beacon from the scan command. Record information as needed
876 * in the scan table struct bss_descriptor for that entry. 916 * in the scan table struct bss_descriptor for that entry.
877 * 917 *
878 * @param pBSSIDEntry Output parameter: Pointer to the BSS Entry 918 * @param bss Output parameter: Pointer to the BSS Entry
879 * 919 *
880 * @return 0 or -1 920 * @return 0 or -1
881 */ 921 */
882static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry, 922static int libertas_process_bss(struct bss_descriptor * bss,
883 u8 ** pbeaconinfo, int *bytesleft) 923 u8 ** pbeaconinfo, int *bytesleft)
884{ 924{
885 enum ieeetypes_elementid elemID; 925 enum ieeetypes_elementid elemID;
886 struct ieeetypes_fhparamset *pFH; 926 struct ieeetypes_fhparamset *pFH;
@@ -897,13 +937,14 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
897 u16 beaconsize; 937 u16 beaconsize;
898 u8 founddatarateie; 938 u8 founddatarateie;
899 int bytesleftforcurrentbeacon; 939 int bytesleftforcurrentbeacon;
940 int ret;
900 941
901 struct IE_WPA *pIe; 942 struct IE_WPA *pIe;
902 const u8 oui01[4] = { 0x00, 0x50, 0xf2, 0x01 }; 943 const u8 oui01[4] = { 0x00, 0x50, 0xf2, 0x01 };
903 944
904 struct ieeetypes_countryinfoset *pcountryinfo; 945 struct ieeetypes_countryinfoset *pcountryinfo;
905 946
906 ENTER(); 947 lbs_deb_enter(LBS_DEB_ASSOC);
907 948
908 founddatarateie = 0; 949 founddatarateie = 0;
909 ratesize = 0; 950 ratesize = 0;
@@ -911,8 +952,7 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
911 952
912 if (*bytesleft >= sizeof(beaconsize)) { 953 if (*bytesleft >= sizeof(beaconsize)) {
913 /* Extract & convert beacon size from the command buffer */ 954 /* Extract & convert beacon size from the command buffer */
914 memcpy(&beaconsize, *pbeaconinfo, sizeof(beaconsize)); 955 beaconsize = le16_to_cpup((void *)*pbeaconinfo);
915 beaconsize = le16_to_cpu(beaconsize);
916 *bytesleft -= sizeof(beaconsize); 956 *bytesleft -= sizeof(beaconsize);
917 *pbeaconinfo += sizeof(beaconsize); 957 *pbeaconinfo += sizeof(beaconsize);
918 } 958 }
@@ -934,17 +974,14 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
934 974
935 bytesleftforcurrentbeacon = beaconsize; 975 bytesleftforcurrentbeacon = beaconsize;
936 976
937 memcpy(pBSSEntry->macaddress, pcurrentptr, ETH_ALEN); 977 memcpy(bss->bssid, pcurrentptr, ETH_ALEN);
938 lbs_pr_debug(1, "InterpretIE: AP MAC Addr-%x:%x:%x:%x:%x:%x\n", 978 lbs_deb_scan("process_bss: AP BSSID " MAC_FMT "\n", MAC_ARG(bss->bssid));
939 pBSSEntry->macaddress[0], pBSSEntry->macaddress[1],
940 pBSSEntry->macaddress[2], pBSSEntry->macaddress[3],
941 pBSSEntry->macaddress[4], pBSSEntry->macaddress[5]);
942 979
943 pcurrentptr += ETH_ALEN; 980 pcurrentptr += ETH_ALEN;
944 bytesleftforcurrentbeacon -= ETH_ALEN; 981 bytesleftforcurrentbeacon -= ETH_ALEN;
945 982
946 if (bytesleftforcurrentbeacon < 12) { 983 if (bytesleftforcurrentbeacon < 12) {
947 lbs_pr_debug(1, "InterpretIE: Not enough bytes left\n"); 984 lbs_deb_scan("process_bss: Not enough bytes left\n");
948 return -1; 985 return -1;
949 } 986 }
950 987
@@ -954,51 +991,48 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
954 */ 991 */
955 992
956 /* RSSI is 1 byte long */ 993 /* RSSI is 1 byte long */
957 pBSSEntry->rssi = le32_to_cpu((long)(*pcurrentptr)); 994 bss->rssi = *pcurrentptr;
958 lbs_pr_debug(1, "InterpretIE: RSSI=%02X\n", *pcurrentptr); 995 lbs_deb_scan("process_bss: RSSI=%02X\n", *pcurrentptr);
959 pcurrentptr += 1; 996 pcurrentptr += 1;
960 bytesleftforcurrentbeacon -= 1; 997 bytesleftforcurrentbeacon -= 1;
961 998
962 /* time stamp is 8 bytes long */ 999 /* time stamp is 8 bytes long */
963 memcpy(fixedie.timestamp, pcurrentptr, 8); 1000 fixedie.timestamp = bss->timestamp = le64_to_cpup((void *)pcurrentptr);
964 memcpy(pBSSEntry->timestamp, pcurrentptr, 8);
965 pcurrentptr += 8; 1001 pcurrentptr += 8;
966 bytesleftforcurrentbeacon -= 8; 1002 bytesleftforcurrentbeacon -= 8;
967 1003
968 /* beacon interval is 2 bytes long */ 1004 /* beacon interval is 2 bytes long */
969 memcpy(&fixedie.beaconinterval, pcurrentptr, 2); 1005 fixedie.beaconinterval = bss->beaconperiod = le16_to_cpup((void *)pcurrentptr);
970 pBSSEntry->beaconperiod = le16_to_cpu(fixedie.beaconinterval);
971 pcurrentptr += 2; 1006 pcurrentptr += 2;
972 bytesleftforcurrentbeacon -= 2; 1007 bytesleftforcurrentbeacon -= 2;
973 1008
974 /* capability information is 2 bytes long */ 1009 /* capability information is 2 bytes long */
975 memcpy(&fixedie.capabilities, pcurrentptr, 2); 1010 memcpy(&fixedie.capabilities, pcurrentptr, 2);
976 lbs_pr_debug(1, "InterpretIE: fixedie.capabilities=0x%X\n", 1011 lbs_deb_scan("process_bss: fixedie.capabilities=0x%X\n",
977 fixedie.capabilities); 1012 fixedie.capabilities);
978 fixedie.capabilities = le16_to_cpu(fixedie.capabilities);
979 pcap = (struct ieeetypes_capinfo *) & fixedie.capabilities; 1013 pcap = (struct ieeetypes_capinfo *) & fixedie.capabilities;
980 memcpy(&pBSSEntry->cap, pcap, sizeof(struct ieeetypes_capinfo)); 1014 memcpy(&bss->cap, pcap, sizeof(struct ieeetypes_capinfo));
981 pcurrentptr += 2; 1015 pcurrentptr += 2;
982 bytesleftforcurrentbeacon -= 2; 1016 bytesleftforcurrentbeacon -= 2;
983 1017
984 /* rest of the current buffer are IE's */ 1018 /* rest of the current buffer are IE's */
985 lbs_pr_debug(1, "InterpretIE: IElength for this AP = %d\n", 1019 lbs_deb_scan("process_bss: IE length for this AP = %d\n",
986 bytesleftforcurrentbeacon); 1020 bytesleftforcurrentbeacon);
987 1021
988 lbs_dbg_hex("InterpretIE: IE info", (u8 *) pcurrentptr, 1022 lbs_dbg_hex("process_bss: IE info", (u8 *) pcurrentptr,
989 bytesleftforcurrentbeacon); 1023 bytesleftforcurrentbeacon);
990 1024
991 if (pcap->privacy) { 1025 if (pcap->privacy) {
992 lbs_pr_debug(1, "InterpretIE: AP WEP enabled\n"); 1026 lbs_deb_scan("process_bss: AP WEP enabled\n");
993 pBSSEntry->privacy = wlan802_11privfilter8021xWEP; 1027 bss->privacy = wlan802_11privfilter8021xWEP;
994 } else { 1028 } else {
995 pBSSEntry->privacy = wlan802_11privfilteracceptall; 1029 bss->privacy = wlan802_11privfilteracceptall;
996 } 1030 }
997 1031
998 if (pcap->ibss == 1) { 1032 if (pcap->ibss == 1) {
999 pBSSEntry->mode = IW_MODE_ADHOC; 1033 bss->mode = IW_MODE_ADHOC;
1000 } else { 1034 } else {
1001 pBSSEntry->mode = IW_MODE_INFRA; 1035 bss->mode = IW_MODE_INFRA;
1002 } 1036 }
1003 1037
1004 /* process variable IE */ 1038 /* process variable IE */
@@ -1007,94 +1041,83 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
1007 elemlen = *((u8 *) pcurrentptr + 1); 1041 elemlen = *((u8 *) pcurrentptr + 1);
1008 1042
1009 if (bytesleftforcurrentbeacon < elemlen) { 1043 if (bytesleftforcurrentbeacon < elemlen) {
1010 lbs_pr_debug(1, "InterpretIE: error in processing IE, " 1044 lbs_deb_scan("process_bss: error in processing IE, "
1011 "bytes left < IE length\n"); 1045 "bytes left < IE length\n");
1012 bytesleftforcurrentbeacon = 0; 1046 bytesleftforcurrentbeacon = 0;
1013 continue; 1047 continue;
1014 } 1048 }
1015 1049
1016 switch (elemID) { 1050 switch (elemID) {
1017
1018 case SSID: 1051 case SSID:
1019 pBSSEntry->ssid.ssidlength = elemlen; 1052 bss->ssid_len = elemlen;
1020 memcpy(pBSSEntry->ssid.ssid, (pcurrentptr + 2), 1053 memcpy(bss->ssid, (pcurrentptr + 2), elemlen);
1021 elemlen); 1054 lbs_deb_scan("ssid '%s', ssid length %u\n",
1022 lbs_pr_debug(1, "ssid: %32s", pBSSEntry->ssid.ssid); 1055 escape_essid(bss->ssid, bss->ssid_len),
1056 bss->ssid_len);
1023 break; 1057 break;
1024 1058
1025 case SUPPORTED_RATES: 1059 case SUPPORTED_RATES:
1026 memcpy(pBSSEntry->datarates, (pcurrentptr + 2), 1060 memcpy(bss->datarates, (pcurrentptr + 2), elemlen);
1027 elemlen); 1061 memmove(bss->libertas_supported_rates, (pcurrentptr + 2),
1028 memmove(pBSSEntry->libertas_supported_rates, (pcurrentptr + 2),
1029 elemlen); 1062 elemlen);
1030 ratesize = elemlen; 1063 ratesize = elemlen;
1031 founddatarateie = 1; 1064 founddatarateie = 1;
1032 break; 1065 break;
1033 1066
1034 case EXTRA_IE: 1067 case EXTRA_IE:
1035 lbs_pr_debug(1, "InterpretIE: EXTRA_IE Found!\n"); 1068 lbs_deb_scan("process_bss: EXTRA_IE Found!\n");
1036 pBSSEntry->extra_ie = 1;
1037 break; 1069 break;
1038 1070
1039 case FH_PARAM_SET: 1071 case FH_PARAM_SET:
1040 pFH = (struct ieeetypes_fhparamset *) pcurrentptr; 1072 pFH = (struct ieeetypes_fhparamset *) pcurrentptr;
1041 memmove(&pBSSEntry->phyparamset.fhparamset, pFH, 1073 memmove(&bss->phyparamset.fhparamset, pFH,
1042 sizeof(struct ieeetypes_fhparamset)); 1074 sizeof(struct ieeetypes_fhparamset));
1043 pBSSEntry->phyparamset.fhparamset.dwelltime 1075#if 0 /* I think we can store these LE */
1044 = 1076 bss->phyparamset.fhparamset.dwelltime
1045 le16_to_cpu(pBSSEntry->phyparamset.fhparamset. 1077 = le16_to_cpu(bss->phyparamset.fhparamset.dwelltime);
1046 dwelltime); 1078#endif
1047 break; 1079 break;
1048 1080
1049 case DS_PARAM_SET: 1081 case DS_PARAM_SET:
1050 pDS = (struct ieeetypes_dsparamset *) pcurrentptr; 1082 pDS = (struct ieeetypes_dsparamset *) pcurrentptr;
1051 1083 bss->channel = pDS->currentchan;
1052 pBSSEntry->channel = pDS->currentchan; 1084 memcpy(&bss->phyparamset.dsparamset, pDS,
1053
1054 memcpy(&pBSSEntry->phyparamset.dsparamset, pDS,
1055 sizeof(struct ieeetypes_dsparamset)); 1085 sizeof(struct ieeetypes_dsparamset));
1056 break; 1086 break;
1057 1087
1058 case CF_PARAM_SET: 1088 case CF_PARAM_SET:
1059 pCF = (struct ieeetypes_cfparamset *) pcurrentptr; 1089 pCF = (struct ieeetypes_cfparamset *) pcurrentptr;
1060 1090 memcpy(&bss->ssparamset.cfparamset, pCF,
1061 memcpy(&pBSSEntry->ssparamset.cfparamset, pCF,
1062 sizeof(struct ieeetypes_cfparamset)); 1091 sizeof(struct ieeetypes_cfparamset));
1063 break; 1092 break;
1064 1093
1065 case IBSS_PARAM_SET: 1094 case IBSS_PARAM_SET:
1066 pibss = (struct ieeetypes_ibssparamset *) pcurrentptr; 1095 pibss = (struct ieeetypes_ibssparamset *) pcurrentptr;
1067 pBSSEntry->atimwindow = 1096 bss->atimwindow = le32_to_cpu(pibss->atimwindow);
1068 le32_to_cpu(pibss->atimwindow); 1097 memmove(&bss->ssparamset.ibssparamset, pibss,
1069
1070 memmove(&pBSSEntry->ssparamset.ibssparamset, pibss,
1071 sizeof(struct ieeetypes_ibssparamset)); 1098 sizeof(struct ieeetypes_ibssparamset));
1072 1099#if 0
1073 pBSSEntry->ssparamset.ibssparamset.atimwindow 1100 bss->ssparamset.ibssparamset.atimwindow
1074 = 1101 = le16_to_cpu(bss->ssparamset.ibssparamset.atimwindow);
1075 le16_to_cpu(pBSSEntry->ssparamset.ibssparamset. 1102#endif
1076 atimwindow);
1077 break; 1103 break;
1078 1104
1079 /* Handle Country Info IE */ 1105 /* Handle Country Info IE */
1080 case COUNTRY_INFO: 1106 case COUNTRY_INFO:
1081 pcountryinfo = 1107 pcountryinfo = (struct ieeetypes_countryinfoset *) pcurrentptr;
1082 (struct ieeetypes_countryinfoset *) pcurrentptr; 1108 if (pcountryinfo->len < sizeof(pcountryinfo->countrycode)
1083
1084 if (pcountryinfo->len <
1085 sizeof(pcountryinfo->countrycode)
1086 || pcountryinfo->len > 254) { 1109 || pcountryinfo->len > 254) {
1087 lbs_pr_debug(1, "InterpretIE: 11D- Err " 1110 lbs_deb_scan("process_bss: 11D- Err "
1088 "CountryInfo len =%d min=%zd max=254\n", 1111 "CountryInfo len =%d min=%zd max=254\n",
1089 pcountryinfo->len, 1112 pcountryinfo->len,
1090 sizeof(pcountryinfo->countrycode)); 1113 sizeof(pcountryinfo->countrycode));
1091 LEAVE(); 1114 ret = -1;
1092 return -1; 1115 goto done;
1093 } 1116 }
1094 1117
1095 memcpy(&pBSSEntry->countryinfo, 1118 memcpy(&bss->countryinfo,
1096 pcountryinfo, pcountryinfo->len + 2); 1119 pcountryinfo, pcountryinfo->len + 2);
1097 lbs_dbg_hex("InterpretIE: 11D- CountryInfo:", 1120 lbs_dbg_hex("process_bss: 11D- CountryInfo:",
1098 (u8 *) pcountryinfo, 1121 (u8 *) pcountryinfo,
1099 (u32) (pcountryinfo->len + 2)); 1122 (u32) (pcountryinfo->len + 2));
1100 break; 1123 break;
@@ -1114,12 +1137,10 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
1114 bytestocopy = elemlen; 1137 bytestocopy = elemlen;
1115 } 1138 }
1116 1139
1117 pRate = (u8 *) pBSSEntry->datarates; 1140 pRate = (u8 *) bss->datarates;
1118 pRate += ratesize; 1141 pRate += ratesize;
1119 memmove(pRate, (pcurrentptr + 2), bytestocopy); 1142 memmove(pRate, (pcurrentptr + 2), bytestocopy);
1120 1143 pRate = (u8 *) bss->libertas_supported_rates;
1121 pRate = (u8 *) pBSSEntry->libertas_supported_rates;
1122
1123 pRate += ratesize; 1144 pRate += ratesize;
1124 memmove(pRate, (pcurrentptr + 2), bytestocopy); 1145 memmove(pRate, (pcurrentptr + 2), bytestocopy);
1125 } 1146 }
@@ -1132,24 +1153,17 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
1132 if (memcmp(pIe->oui, oui01, sizeof(oui01))) 1153 if (memcmp(pIe->oui, oui01, sizeof(oui01)))
1133 break; 1154 break;
1134 1155
1135 pBSSEntry->wpa_ie_len = min_t(size_t, 1156 bss->wpa_ie_len = min(elemlen + IE_ID_LEN_FIELDS_BYTES,
1136 elemlen + IE_ID_LEN_FIELDS_BYTES, 1157 MAX_WPA_IE_LEN);
1137 sizeof(pBSSEntry->wpa_ie)); 1158 memcpy(bss->wpa_ie, pcurrentptr, bss->wpa_ie_len);
1138 memcpy(pBSSEntry->wpa_ie, pcurrentptr, 1159 lbs_dbg_hex("process_bss: WPA IE", bss->wpa_ie, elemlen);
1139 pBSSEntry->wpa_ie_len);
1140 lbs_dbg_hex("InterpretIE: Resp WPA_IE",
1141 pBSSEntry->wpa_ie, elemlen);
1142 break; 1160 break;
1143 case WPA2_IE: 1161 case WPA2_IE:
1144 pIe = (struct IE_WPA *)pcurrentptr; 1162 pIe = (struct IE_WPA *)pcurrentptr;
1145 1163 bss->rsn_ie_len = min(elemlen + IE_ID_LEN_FIELDS_BYTES,
1146 pBSSEntry->rsn_ie_len = min_t(size_t, 1164 MAX_WPA_IE_LEN);
1147 elemlen + IE_ID_LEN_FIELDS_BYTES, 1165 memcpy(bss->rsn_ie, pcurrentptr, bss->rsn_ie_len);
1148 sizeof(pBSSEntry->rsn_ie)); 1166 lbs_dbg_hex("process_bss: RSN_IE", bss->rsn_ie, elemlen);
1149 memcpy(pBSSEntry->rsn_ie, pcurrentptr,
1150 pBSSEntry->rsn_ie_len);
1151 lbs_dbg_hex("InterpretIE: Resp WPA2_IE",
1152 pBSSEntry->rsn_ie, elemlen);
1153 break; 1167 break;
1154 case TIM: 1168 case TIM:
1155 break; 1169 break;
@@ -1165,7 +1179,14 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
1165 1179
1166 } /* while (bytesleftforcurrentbeacon > 2) */ 1180 } /* while (bytesleftforcurrentbeacon > 2) */
1167 1181
1168 return 0; 1182 /* Timestamp */
1183 bss->last_scanned = jiffies;
1184
1185 ret = 0;
1186
1187done:
1188 lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret);
1189 return ret;
1169} 1190}
1170 1191
1171/** 1192/**
@@ -1176,15 +1197,12 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
1176 * 1197 *
1177 * @return 0--ssid is same, otherwise is different 1198 * @return 0--ssid is same, otherwise is different
1178 */ 1199 */
1179int libertas_SSID_cmp(struct WLAN_802_11_SSID *ssid1, struct WLAN_802_11_SSID *ssid2) 1200int libertas_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len)
1180{ 1201{
1181 if (!ssid1 || !ssid2) 1202 if (ssid1_len != ssid2_len)
1182 return -1;
1183
1184 if (ssid1->ssidlength != ssid2->ssidlength)
1185 return -1; 1203 return -1;
1186 1204
1187 return memcmp(ssid1->ssid, ssid2->ssid, ssid1->ssidlength); 1205 return memcmp(ssid1, ssid2, ssid1_len);
1188} 1206}
1189 1207
1190/** 1208/**
@@ -1196,38 +1214,41 @@ int libertas_SSID_cmp(struct WLAN_802_11_SSID *ssid1, struct WLAN_802_11_SSID *s
1196 * 1214 *
1197 * @return index in BSSID list, or error return code (< 0) 1215 * @return index in BSSID list, or error return code (< 0)
1198 */ 1216 */
1199int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, u8 mode) 1217struct bss_descriptor * libertas_find_bssid_in_list(wlan_adapter * adapter,
1218 u8 * bssid, u8 mode)
1200{ 1219{
1201 int ret = -ENETUNREACH; 1220 struct bss_descriptor * iter_bss;
1202 int i; 1221 struct bss_descriptor * found_bss = NULL;
1203 1222
1204 if (!bssid) 1223 if (!bssid)
1205 return -EFAULT; 1224 return NULL;
1206 1225
1207 lbs_pr_debug(1, "FindBSSID: Num of BSSIDs = %d\n", 1226 lbs_dbg_hex("libertas_find_BSSID_in_list: looking for ",
1208 adapter->numinscantable); 1227 bssid, ETH_ALEN);
1209 1228
1210 /* Look through the scan table for a compatible match. The ret return 1229 /* Look through the scan table for a compatible match. The loop will
1211 * variable will be equal to the index in the scan table (greater 1230 * continue past a matched bssid that is not compatible in case there
1212 * than zero) if the network is compatible. The loop will continue 1231 * is an AP with multiple SSIDs assigned to the same BSSID
1213 * past a matched bssid that is not compatible in case there is an
1214 * AP with multiple SSIDs assigned to the same BSSID
1215 */ 1232 */
1216 for (i = 0; ret < 0 && i < adapter->numinscantable; i++) { 1233 mutex_lock(&adapter->lock);
1217 if (!memcmp(adapter->scantable[i].macaddress, bssid, ETH_ALEN)) { 1234 list_for_each_entry (iter_bss, &adapter->network_list, list) {
1218 switch (mode) { 1235 if (compare_ether_addr(iter_bss->bssid, bssid))
1219 case IW_MODE_INFRA: 1236 continue; /* bssid doesn't match */
1220 case IW_MODE_ADHOC: 1237 switch (mode) {
1221 ret = is_network_compatible(adapter, i, mode); 1238 case IW_MODE_INFRA:
1222 break; 1239 case IW_MODE_ADHOC:
1223 default: 1240 if (!is_network_compatible(adapter, iter_bss, mode))
1224 ret = i;
1225 break; 1241 break;
1226 } 1242 found_bss = iter_bss;
1243 break;
1244 default:
1245 found_bss = iter_bss;
1246 break;
1227 } 1247 }
1228 } 1248 }
1249 mutex_unlock(&adapter->lock);
1229 1250
1230 return ret; 1251 return found_bss;
1231} 1252}
1232 1253
1233/** 1254/**
@@ -1240,61 +1261,60 @@ int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, u8 mode)
1240 * 1261 *
1241 * @return index in BSSID list 1262 * @return index in BSSID list
1242 */ 1263 */
1243int libertas_find_SSID_in_list(wlan_adapter * adapter, 1264struct bss_descriptor * libertas_find_ssid_in_list(wlan_adapter * adapter,
1244 struct WLAN_802_11_SSID *ssid, u8 * bssid, u8 mode) 1265 u8 *ssid, u8 ssid_len, u8 * bssid, u8 mode,
1266 int channel)
1245{ 1267{
1246 int net = -ENETUNREACH;
1247 u8 bestrssi = 0; 1268 u8 bestrssi = 0;
1248 int i; 1269 struct bss_descriptor * iter_bss = NULL;
1249 int j; 1270 struct bss_descriptor * found_bss = NULL;
1271 struct bss_descriptor * tmp_oldest = NULL;
1250 1272
1251 lbs_pr_debug(1, "Num of Entries in Table = %d\n", adapter->numinscantable); 1273 mutex_lock(&adapter->lock);
1252 1274
1253 for (i = 0; i < adapter->numinscantable; i++) { 1275 list_for_each_entry (iter_bss, &adapter->network_list, list) {
1254 if (!libertas_SSID_cmp(&adapter->scantable[i].ssid, ssid) && 1276 if ( !tmp_oldest
1255 (!bssid || 1277 || (iter_bss->last_scanned < tmp_oldest->last_scanned))
1256 !memcmp(adapter->scantable[i]. 1278 tmp_oldest = iter_bss;
1257 macaddress, bssid, ETH_ALEN))) { 1279
1258 switch (mode) { 1280 if (libertas_ssid_cmp(iter_bss->ssid, iter_bss->ssid_len,
1259 case IW_MODE_INFRA: 1281 ssid, ssid_len) != 0)
1260 case IW_MODE_ADHOC: 1282 continue; /* ssid doesn't match */
1261 j = is_network_compatible(adapter, i, mode); 1283 if (bssid && compare_ether_addr(iter_bss->bssid, bssid) != 0)
1262 1284 continue; /* bssid doesn't match */
1263 if (j >= 0) { 1285 if ((channel > 0) && (iter_bss->channel != channel))
1264 if (bssid) { 1286 continue; /* channel doesn't match */
1265 return i; 1287
1266 } 1288 switch (mode) {
1267 1289 case IW_MODE_INFRA:
1268 if (SCAN_RSSI 1290 case IW_MODE_ADHOC:
1269 (adapter->scantable[i].rssi) 1291 if (!is_network_compatible(adapter, iter_bss, mode))
1270 > bestrssi) {
1271 bestrssi =
1272 SCAN_RSSI(adapter->
1273 scantable[i].
1274 rssi);
1275 net = i;
1276 }
1277 } else {
1278 if (net == -ENETUNREACH) {
1279 net = j;
1280 }
1281 }
1282 break;
1283 case IW_MODE_AUTO:
1284 default:
1285 if (SCAN_RSSI(adapter->scantable[i].rssi)
1286 > bestrssi) {
1287 bestrssi =
1288 SCAN_RSSI(adapter->scantable[i].
1289 rssi);
1290 net = i;
1291 }
1292 break; 1292 break;
1293
1294 if (bssid) {
1295 /* Found requested BSSID */
1296 found_bss = iter_bss;
1297 goto out;
1298 }
1299
1300 if (SCAN_RSSI(iter_bss->rssi) > bestrssi) {
1301 bestrssi = SCAN_RSSI(iter_bss->rssi);
1302 found_bss = iter_bss;
1293 } 1303 }
1304 break;
1305 case IW_MODE_AUTO:
1306 default:
1307 if (SCAN_RSSI(iter_bss->rssi) > bestrssi) {
1308 bestrssi = SCAN_RSSI(iter_bss->rssi);
1309 found_bss = iter_bss;
1310 }
1311 break;
1294 } 1312 }
1295 } 1313 }
1296 1314
1297 return net; 1315out:
1316 mutex_unlock(&adapter->lock);
1317 return found_bss;
1298} 1318}
1299 1319
1300/** 1320/**
@@ -1307,43 +1327,38 @@ int libertas_find_SSID_in_list(wlan_adapter * adapter,
1307 * 1327 *
1308 * @return index in BSSID list 1328 * @return index in BSSID list
1309 */ 1329 */
1310int libertas_find_best_SSID_in_list(wlan_adapter * adapter, u8 mode) 1330struct bss_descriptor * libertas_find_best_ssid_in_list(wlan_adapter * adapter,
1331 u8 mode)
1311{ 1332{
1312 int bestnet = -ENETUNREACH;
1313 u8 bestrssi = 0; 1333 u8 bestrssi = 0;
1314 int i; 1334 struct bss_descriptor * iter_bss;
1335 struct bss_descriptor * best_bss = NULL;
1315 1336
1316 ENTER(); 1337 mutex_lock(&adapter->lock);
1317 1338
1318 lbs_pr_debug(1, "Num of BSSIDs = %d\n", adapter->numinscantable); 1339 list_for_each_entry (iter_bss, &adapter->network_list, list) {
1319
1320 for (i = 0; i < adapter->numinscantable; i++) {
1321 switch (mode) { 1340 switch (mode) {
1322 case IW_MODE_INFRA: 1341 case IW_MODE_INFRA:
1323 case IW_MODE_ADHOC: 1342 case IW_MODE_ADHOC:
1324 if (is_network_compatible(adapter, i, mode) >= 0) { 1343 if (!is_network_compatible(adapter, iter_bss, mode))
1325 if (SCAN_RSSI(adapter->scantable[i].rssi) > 1344 break;
1326 bestrssi) { 1345 if (SCAN_RSSI(iter_bss->rssi) <= bestrssi)
1327 bestrssi = 1346 break;
1328 SCAN_RSSI(adapter->scantable[i]. 1347 bestrssi = SCAN_RSSI(iter_bss->rssi);
1329 rssi); 1348 best_bss = iter_bss;
1330 bestnet = i;
1331 }
1332 }
1333 break; 1349 break;
1334 case IW_MODE_AUTO: 1350 case IW_MODE_AUTO:
1335 default: 1351 default:
1336 if (SCAN_RSSI(adapter->scantable[i].rssi) > bestrssi) { 1352 if (SCAN_RSSI(iter_bss->rssi) <= bestrssi)
1337 bestrssi = 1353 break;
1338 SCAN_RSSI(adapter->scantable[i].rssi); 1354 bestrssi = SCAN_RSSI(iter_bss->rssi);
1339 bestnet = i; 1355 best_bss = iter_bss;
1340 }
1341 break; 1356 break;
1342 } 1357 }
1343 } 1358 }
1344 1359
1345 LEAVE(); 1360 mutex_unlock(&adapter->lock);
1346 return bestnet; 1361 return best_bss;
1347} 1362}
1348 1363
1349/** 1364/**
@@ -1354,41 +1369,30 @@ int libertas_find_best_SSID_in_list(wlan_adapter * adapter, u8 mode)
1354 * 1369 *
1355 * @return 0--success, otherwise--fail 1370 * @return 0--success, otherwise--fail
1356 */ 1371 */
1357int libertas_find_best_network_SSID(wlan_private * priv, 1372int libertas_find_best_network_ssid(wlan_private * priv,
1358 struct WLAN_802_11_SSID *pSSID, 1373 u8 *out_ssid, u8 *out_ssid_len, u8 preferred_mode, u8 *out_mode)
1359 u8 preferred_mode, u8 *out_mode)
1360{ 1374{
1361 wlan_adapter *adapter = priv->adapter; 1375 wlan_adapter *adapter = priv->adapter;
1362 int ret = 0; 1376 int ret = -1;
1363 struct bss_descriptor *preqbssid; 1377 struct bss_descriptor * found;
1364 int i;
1365 1378
1366 ENTER(); 1379 lbs_deb_enter(LBS_DEB_ASSOC);
1367 1380
1368 memset(pSSID, 0, sizeof(struct WLAN_802_11_SSID)); 1381 wlan_scan_networks(priv, NULL, 1);
1369
1370 wlan_scan_networks(priv, NULL);
1371 if (adapter->surpriseremoved) 1382 if (adapter->surpriseremoved)
1372 return -1; 1383 return -1;
1373 wait_event_interruptible(adapter->cmd_pending, !adapter->nr_cmd_pending);
1374 1384
1375 i = libertas_find_best_SSID_in_list(adapter, preferred_mode); 1385 wait_event_interruptible(adapter->cmd_pending, !adapter->nr_cmd_pending);
1376 if (i < 0) {
1377 ret = -1;
1378 goto out;
1379 }
1380
1381 preqbssid = &adapter->scantable[i];
1382 memcpy(pSSID, &preqbssid->ssid,
1383 sizeof(struct WLAN_802_11_SSID));
1384 *out_mode = preqbssid->mode;
1385 1386
1386 if (!pSSID->ssidlength) { 1387 found = libertas_find_best_ssid_in_list(adapter, preferred_mode);
1387 ret = -1; 1388 if (found && (found->ssid_len > 0)) {
1389 memcpy(out_ssid, &found->ssid, IW_ESSID_MAX_SIZE);
1390 *out_ssid_len = found->ssid_len;
1391 *out_mode = found->mode;
1392 ret = 0;
1388 } 1393 }
1389 1394
1390out: 1395 lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret);
1391 LEAVE();
1392 return ret; 1396 return ret;
1393} 1397}
1394 1398
@@ -1407,20 +1411,15 @@ int libertas_set_scan(struct net_device *dev, struct iw_request_info *info,
1407{ 1411{
1408 wlan_private *priv = dev->priv; 1412 wlan_private *priv = dev->priv;
1409 wlan_adapter *adapter = priv->adapter; 1413 wlan_adapter *adapter = priv->adapter;
1410 union iwreq_data wrqu;
1411 1414
1412 ENTER(); 1415 lbs_deb_enter(LBS_DEB_SCAN);
1413 1416
1414 if (!wlan_scan_networks(priv, NULL)) { 1417 wlan_scan_networks(priv, NULL, 0);
1415 memset(&wrqu, 0, sizeof(union iwreq_data));
1416 wireless_send_event(priv->wlan_dev.netdev, SIOCGIWSCAN, &wrqu,
1417 NULL);
1418 }
1419 1418
1420 if (adapter->surpriseremoved) 1419 if (adapter->surpriseremoved)
1421 return -1; 1420 return -1;
1422 1421
1423 LEAVE(); 1422 lbs_deb_leave(LBS_DEB_SCAN);
1424 return 0; 1423 return 0;
1425} 1424}
1426 1425
@@ -1433,32 +1432,31 @@ int libertas_set_scan(struct net_device *dev, struct iw_request_info *info,
1433 * 1432 *
1434 * @return 0-success, otherwise fail 1433 * @return 0-success, otherwise fail
1435 */ 1434 */
1436int libertas_send_specific_SSID_scan(wlan_private * priv, 1435int libertas_send_specific_ssid_scan(wlan_private * priv,
1437 struct WLAN_802_11_SSID *prequestedssid, 1436 u8 *ssid, u8 ssid_len, u8 clear_ssid)
1438 u8 keeppreviousscan)
1439{ 1437{
1440 wlan_adapter *adapter = priv->adapter; 1438 wlan_adapter *adapter = priv->adapter;
1441 struct wlan_ioctl_user_scan_cfg scancfg; 1439 struct wlan_ioctl_user_scan_cfg scancfg;
1440 int ret = 0;
1442 1441
1443 ENTER(); 1442 lbs_deb_enter(LBS_DEB_ASSOC);
1444 1443
1445 if (prequestedssid == NULL) { 1444 if (!ssid_len)
1446 return -1; 1445 goto out;
1447 }
1448 1446
1449 memset(&scancfg, 0x00, sizeof(scancfg)); 1447 memset(&scancfg, 0x00, sizeof(scancfg));
1448 memcpy(scancfg.ssid, ssid, ssid_len);
1449 scancfg.ssid_len = ssid_len;
1450 scancfg.clear_ssid = clear_ssid;
1450 1451
1451 memcpy(scancfg.specificSSID, prequestedssid->ssid, 1452 wlan_scan_networks(priv, &scancfg, 1);
1452 prequestedssid->ssidlength);
1453 scancfg.keeppreviousscan = keeppreviousscan;
1454
1455 wlan_scan_networks(priv, &scancfg);
1456 if (adapter->surpriseremoved) 1453 if (adapter->surpriseremoved)
1457 return -1; 1454 return -1;
1458 wait_event_interruptible(adapter->cmd_pending, !adapter->nr_cmd_pending); 1455 wait_event_interruptible(adapter->cmd_pending, !adapter->nr_cmd_pending);
1459 1456
1460 LEAVE(); 1457out:
1461 return 0; 1458 lbs_deb_leave(LBS_DEB_ASSOC);
1459 return ret;
1462} 1460}
1463 1461
1464/** 1462/**
@@ -1470,304 +1468,235 @@ int libertas_send_specific_SSID_scan(wlan_private * priv,
1470 * 1468 *
1471 * @return 0-success, otherwise fail 1469 * @return 0-success, otherwise fail
1472 */ 1470 */
1473int libertas_send_specific_BSSID_scan(wlan_private * priv, u8 * bssid, u8 keeppreviousscan) 1471int libertas_send_specific_bssid_scan(wlan_private * priv, u8 * bssid, u8 clear_bssid)
1474{ 1472{
1475 struct wlan_ioctl_user_scan_cfg scancfg; 1473 struct wlan_ioctl_user_scan_cfg scancfg;
1476 1474
1477 ENTER(); 1475 lbs_deb_enter(LBS_DEB_ASSOC);
1478 1476
1479 if (bssid == NULL) { 1477 if (bssid == NULL)
1480 return -1; 1478 goto out;
1481 }
1482 1479
1483 memset(&scancfg, 0x00, sizeof(scancfg)); 1480 memset(&scancfg, 0x00, sizeof(scancfg));
1484 memcpy(scancfg.specificBSSID, bssid, sizeof(scancfg.specificBSSID)); 1481 memcpy(scancfg.bssid, bssid, ETH_ALEN);
1485 scancfg.keeppreviousscan = keeppreviousscan; 1482 scancfg.clear_bssid = clear_bssid;
1486 1483
1487 wlan_scan_networks(priv, &scancfg); 1484 wlan_scan_networks(priv, &scancfg, 1);
1488 if (priv->adapter->surpriseremoved) 1485 if (priv->adapter->surpriseremoved)
1489 return -1; 1486 return -1;
1490 wait_event_interruptible(priv->adapter->cmd_pending, 1487 wait_event_interruptible(priv->adapter->cmd_pending,
1491 !priv->adapter->nr_cmd_pending); 1488 !priv->adapter->nr_cmd_pending);
1492 1489
1493 LEAVE(); 1490out:
1491 lbs_deb_leave(LBS_DEB_ASSOC);
1494 return 0; 1492 return 0;
1495} 1493}
1496 1494
1497/** 1495static inline char *libertas_translate_scan(wlan_private *priv,
1498 * @brief Retrieve the scan table entries via wireless tools IOCTL call 1496 char *start, char *stop,
1499 * 1497 struct bss_descriptor *bss)
1500 * @param dev A pointer to net_device structure
1501 * @param info A pointer to iw_request_info structure
1502 * @param dwrq A pointer to iw_point structure
1503 * @param extra A pointer to extra data buf
1504 *
1505 * @return 0 --success, otherwise fail
1506 */
1507int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
1508 struct iw_point *dwrq, char *extra)
1509{ 1498{
1510 wlan_private *priv = dev->priv;
1511 wlan_adapter *adapter = priv->adapter; 1499 wlan_adapter *adapter = priv->adapter;
1512 int ret = 0;
1513 char *current_ev = extra;
1514 char *end_buf = extra + IW_SCAN_MAX_DATA;
1515 struct chan_freq_power *cfp; 1500 struct chan_freq_power *cfp;
1516 struct bss_descriptor *pscantable;
1517 char *current_val; /* For rates */ 1501 char *current_val; /* For rates */
1518 struct iw_event iwe; /* Temporary buffer */ 1502 struct iw_event iwe; /* Temporary buffer */
1519 int i;
1520 int j; 1503 int j;
1521 int rate;
1522#define PERFECT_RSSI ((u8)50) 1504#define PERFECT_RSSI ((u8)50)
1523#define WORST_RSSI ((u8)0) 1505#define WORST_RSSI ((u8)0)
1524#define RSSI_DIFF ((u8)(PERFECT_RSSI - WORST_RSSI)) 1506#define RSSI_DIFF ((u8)(PERFECT_RSSI - WORST_RSSI))
1525 u8 rssi; 1507 u8 rssi;
1526 1508
1527 u8 buf[16 + 256 * 2]; 1509 cfp = libertas_find_cfp_by_band_and_channel(adapter, 0, bss->channel);
1528 u8 *ptr; 1510 if (!cfp) {
1529 1511 lbs_deb_scan("Invalid channel number %d\n", bss->channel);
1530 ENTER(); 1512 return NULL;
1531 1513 }
1532 /*
1533 * if there's either commands in the queue or one being
1534 * processed return -EAGAIN for iwlist to retry later.
1535 */
1536 if (adapter->nr_cmd_pending)
1537 return -EAGAIN;
1538
1539 if (adapter->connect_status == libertas_connected)
1540 lbs_pr_debug(1, "Current ssid: %32s\n",
1541 adapter->curbssparams.ssid.ssid);
1542 1514
1543 lbs_pr_debug(1, "Scan: Get: numinscantable = %d\n", 1515 /* First entry *MUST* be the AP BSSID */
1544 adapter->numinscantable); 1516 iwe.cmd = SIOCGIWAP;
1517 iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
1518 memcpy(iwe.u.ap_addr.sa_data, &bss->bssid, ETH_ALEN);
1519 start = iwe_stream_add_event(start, stop, &iwe, IW_EV_ADDR_LEN);
1520
1521 /* SSID */
1522 iwe.cmd = SIOCGIWESSID;
1523 iwe.u.data.flags = 1;
1524 iwe.u.data.length = min((u32) bss->ssid_len, (u32) IW_ESSID_MAX_SIZE);
1525 start = iwe_stream_add_point(start, stop, &iwe, bss->ssid);
1526
1527 /* Mode */
1528 iwe.cmd = SIOCGIWMODE;
1529 iwe.u.mode = bss->mode;
1530 start = iwe_stream_add_event(start, stop, &iwe, IW_EV_UINT_LEN);
1531
1532 /* Frequency */
1533 iwe.cmd = SIOCGIWFREQ;
1534 iwe.u.freq.m = (long)cfp->freq * 100000;
1535 iwe.u.freq.e = 1;
1536 start = iwe_stream_add_event(start, stop, &iwe, IW_EV_FREQ_LEN);
1537
1538 /* Add quality statistics */
1539 iwe.cmd = IWEVQUAL;
1540 iwe.u.qual.updated = IW_QUAL_ALL_UPDATED;
1541 iwe.u.qual.level = SCAN_RSSI(bss->rssi);
1542
1543 rssi = iwe.u.qual.level - MRVDRV_NF_DEFAULT_SCAN_VALUE;
1544 iwe.u.qual.qual =
1545 (100 * RSSI_DIFF * RSSI_DIFF - (PERFECT_RSSI - rssi) *
1546 (15 * (RSSI_DIFF) + 62 * (PERFECT_RSSI - rssi))) /
1547 (RSSI_DIFF * RSSI_DIFF);
1548 if (iwe.u.qual.qual > 100)
1549 iwe.u.qual.qual = 100;
1550
1551 if (adapter->NF[TYPE_BEACON][TYPE_NOAVG] == 0) {
1552 iwe.u.qual.noise = MRVDRV_NF_DEFAULT_SCAN_VALUE;
1553 } else {
1554 iwe.u.qual.noise =
1555 CAL_NF(adapter->NF[TYPE_BEACON][TYPE_NOAVG]);
1556 }
1545 1557
1546 /* The old API using SIOCGIWAPLIST had a hard limit of IW_MAX_AP. 1558 /* Locally created ad-hoc BSSs won't have beacons if this is the
1547 * The new API using SIOCGIWSCAN is only limited by buffer size 1559 * only station in the adhoc network; so get signal strength
1548 * WE-14 -> WE-16 the buffer is limited to IW_SCAN_MAX_DATA bytes 1560 * from receive statistics.
1549 * which is 4096.
1550 */ 1561 */
1551 for (i = 0; i < adapter->numinscantable; i++) { 1562 if ((adapter->mode == IW_MODE_ADHOC)
1552 if ((current_ev + MAX_SCAN_CELL_SIZE) >= end_buf) { 1563 && adapter->adhoccreate
1553 lbs_pr_debug(1, "i=%d break out: current_ev=%p end_buf=%p " 1564 && !libertas_ssid_cmp(adapter->curbssparams.ssid,
1554 "MAX_SCAN_CELL_SIZE=%zd\n", 1565 adapter->curbssparams.ssid_len,
1555 i, current_ev, end_buf, MAX_SCAN_CELL_SIZE); 1566 bss->ssid, bss->ssid_len)) {
1556 break; 1567 int snr, nf;
1557 } 1568 snr = adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE;
1558 1569 nf = adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE;
1559 pscantable = &adapter->scantable[i]; 1570 iwe.u.qual.level = CAL_RSSI(snr, nf);
1560 1571 }
1561 lbs_pr_debug(1, "i=%d ssid: %32s\n", i, pscantable->ssid.ssid); 1572 start = iwe_stream_add_event(start, stop, &iwe, IW_EV_QUAL_LEN);
1562
1563 cfp =
1564 libertas_find_cfp_by_band_and_channel(adapter, 0,
1565 pscantable->channel);
1566 if (!cfp) {
1567 lbs_pr_debug(1, "Invalid channel number %d\n",
1568 pscantable->channel);
1569 continue;
1570 }
1571
1572 if (!ssid_valid(&adapter->scantable[i].ssid)) {
1573 continue;
1574 }
1575
1576 /* First entry *MUST* be the AP MAC address */
1577 iwe.cmd = SIOCGIWAP;
1578 iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
1579 memcpy(iwe.u.ap_addr.sa_data,
1580 &adapter->scantable[i].macaddress, ETH_ALEN);
1581
1582 iwe.len = IW_EV_ADDR_LEN;
1583 current_ev =
1584 iwe_stream_add_event(current_ev, end_buf, &iwe, iwe.len);
1585
1586 //Add the ESSID
1587 iwe.u.data.length = adapter->scantable[i].ssid.ssidlength;
1588
1589 if (iwe.u.data.length > 32) {
1590 iwe.u.data.length = 32;
1591 }
1592
1593 iwe.cmd = SIOCGIWESSID;
1594 iwe.u.data.flags = 1;
1595 iwe.len = IW_EV_POINT_LEN + iwe.u.data.length;
1596 current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe,
1597 adapter->scantable[i].ssid.
1598 ssid);
1599
1600 //Add mode
1601 iwe.cmd = SIOCGIWMODE;
1602 iwe.u.mode = adapter->scantable[i].mode;
1603 iwe.len = IW_EV_UINT_LEN;
1604 current_ev =
1605 iwe_stream_add_event(current_ev, end_buf, &iwe, iwe.len);
1606
1607 //frequency
1608 iwe.cmd = SIOCGIWFREQ;
1609 iwe.u.freq.m = (long)cfp->freq * 100000;
1610 iwe.u.freq.e = 1;
1611 iwe.len = IW_EV_FREQ_LEN;
1612 current_ev =
1613 iwe_stream_add_event(current_ev, end_buf, &iwe, iwe.len);
1614
1615 /* Add quality statistics */
1616 iwe.cmd = IWEVQUAL;
1617 iwe.u.qual.updated = IW_QUAL_ALL_UPDATED;
1618 iwe.u.qual.level = SCAN_RSSI(adapter->scantable[i].rssi);
1619
1620 rssi = iwe.u.qual.level - MRVDRV_NF_DEFAULT_SCAN_VALUE;
1621 iwe.u.qual.qual =
1622 (100 * RSSI_DIFF * RSSI_DIFF - (PERFECT_RSSI - rssi) *
1623 (15 * (RSSI_DIFF) + 62 * (PERFECT_RSSI - rssi))) /
1624 (RSSI_DIFF * RSSI_DIFF);
1625 if (iwe.u.qual.qual > 100)
1626 iwe.u.qual.qual = 100;
1627 else if (iwe.u.qual.qual < 1)
1628 iwe.u.qual.qual = 0;
1629
1630 if (adapter->NF[TYPE_BEACON][TYPE_NOAVG] == 0) {
1631 iwe.u.qual.noise = MRVDRV_NF_DEFAULT_SCAN_VALUE;
1632 } else {
1633 iwe.u.qual.noise =
1634 CAL_NF(adapter->NF[TYPE_BEACON][TYPE_NOAVG]);
1635 }
1636 if ((adapter->mode == IW_MODE_ADHOC) &&
1637 !libertas_SSID_cmp(&adapter->curbssparams.ssid,
1638 &adapter->scantable[i].ssid)
1639 && adapter->adhoccreate) {
1640 ret = libertas_prepare_and_send_command(priv,
1641 cmd_802_11_rssi,
1642 0,
1643 cmd_option_waitforrsp,
1644 0, NULL);
1645
1646 if (!ret) {
1647 iwe.u.qual.level =
1648 CAL_RSSI(adapter->SNR[TYPE_RXPD][TYPE_AVG] /
1649 AVG_SCALE,
1650 adapter->NF[TYPE_RXPD][TYPE_AVG] /
1651 AVG_SCALE);
1652 }
1653 }
1654 iwe.len = IW_EV_QUAL_LEN;
1655 current_ev =
1656 iwe_stream_add_event(current_ev, end_buf, &iwe, iwe.len);
1657
1658 /* Add encryption capability */
1659 iwe.cmd = SIOCGIWENCODE;
1660 if (adapter->scantable[i].privacy) {
1661 iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
1662 } else {
1663 iwe.u.data.flags = IW_ENCODE_DISABLED;
1664 }
1665 iwe.u.data.length = 0;
1666 iwe.len = IW_EV_POINT_LEN + iwe.u.data.length;
1667 current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe,
1668 adapter->scantable->ssid.
1669 ssid);
1670 1573
1671 current_val = current_ev + IW_EV_LCP_LEN; 1574 /* Add encryption capability */
1575 iwe.cmd = SIOCGIWENCODE;
1576 if (bss->privacy) {
1577 iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
1578 } else {
1579 iwe.u.data.flags = IW_ENCODE_DISABLED;
1580 }
1581 iwe.u.data.length = 0;
1582 start = iwe_stream_add_point(start, stop, &iwe, bss->ssid);
1672 1583
1673 iwe.cmd = SIOCGIWRATE; 1584 current_val = start + IW_EV_LCP_LEN;
1674 1585
1675 iwe.u.bitrate.fixed = 0; 1586 iwe.cmd = SIOCGIWRATE;
1676 iwe.u.bitrate.disabled = 0; 1587 iwe.u.bitrate.fixed = 0;
1677 iwe.u.bitrate.value = 0; 1588 iwe.u.bitrate.disabled = 0;
1589 iwe.u.bitrate.value = 0;
1678 1590
1591 for (j = 0; j < sizeof(bss->libertas_supported_rates); j++) {
1592 u8 rate = bss->libertas_supported_rates[j];
1593 if (rate == 0)
1594 break; /* no more rates */
1679 /* Bit rate given in 500 kb/s units (+ 0x80) */ 1595 /* Bit rate given in 500 kb/s units (+ 0x80) */
1680 for (j = 0; j < sizeof(adapter->scantable[i].libertas_supported_rates); 1596 iwe.u.bitrate.value = (rate & 0x7f) * 500000;
1681 j++) { 1597 current_val = iwe_stream_add_value(start, current_val,
1682 if (adapter->scantable[i].libertas_supported_rates[j] == 0) { 1598 stop, &iwe, IW_EV_PARAM_LEN);
1683 break; 1599 }
1684 } 1600 if ((bss->mode == IW_MODE_ADHOC)
1685 rate = 1601 && !libertas_ssid_cmp(adapter->curbssparams.ssid,
1686 (adapter->scantable[i].libertas_supported_rates[j] & 0x7F) * 1602 adapter->curbssparams.ssid_len,
1687 500000; 1603 bss->ssid, bss->ssid_len)
1688 if (rate > iwe.u.bitrate.value) { 1604 && adapter->adhoccreate) {
1689 iwe.u.bitrate.value = rate; 1605 iwe.u.bitrate.value = 22 * 500000;
1690 } 1606 current_val = iwe_stream_add_value(start, current_val,
1691 1607 stop, &iwe, IW_EV_PARAM_LEN);
1692 iwe.u.bitrate.value = 1608 }
1693 (adapter->scantable[i].libertas_supported_rates[j] 1609 /* Check if we added any event */
1694 & 0x7f) * 500000; 1610 if((current_val - start) > IW_EV_LCP_LEN)
1695 iwe.len = IW_EV_PARAM_LEN; 1611 start = current_val;
1696 current_ev = 1612
1697 iwe_stream_add_value(current_ev, current_val, 1613 memset(&iwe, 0, sizeof(iwe));
1698 end_buf, &iwe, iwe.len); 1614 if (bss->wpa_ie_len) {
1615 char buf[MAX_WPA_IE_LEN];
1616 memcpy(buf, bss->wpa_ie, bss->wpa_ie_len);
1617 iwe.cmd = IWEVGENIE;
1618 iwe.u.data.length = bss->wpa_ie_len;
1619 start = iwe_stream_add_point(start, stop, &iwe, buf);
1620 }
1699 1621
1700 } 1622 memset(&iwe, 0, sizeof(iwe));
1701 if ((adapter->scantable[i].mode == IW_MODE_ADHOC) 1623 if (bss->rsn_ie_len) {
1702 && !libertas_SSID_cmp(&adapter->curbssparams.ssid, 1624 char buf[MAX_WPA_IE_LEN];
1703 &adapter->scantable[i].ssid) 1625 memcpy(buf, bss->rsn_ie, bss->rsn_ie_len);
1704 && adapter->adhoccreate) { 1626 iwe.cmd = IWEVGENIE;
1705 iwe.u.bitrate.value = 22 * 500000; 1627 iwe.u.data.length = bss->rsn_ie_len;
1706 } 1628 start = iwe_stream_add_point(start, stop, &iwe, buf);
1707 iwe.len = IW_EV_PARAM_LEN; 1629 }
1708 current_ev =
1709 iwe_stream_add_value(current_ev, current_val, end_buf, &iwe,
1710 iwe.len);
1711
1712 /* Add new value to event */
1713 current_val = current_ev + IW_EV_LCP_LEN;
1714
1715 if (adapter->scantable[i].rsn_ie[0] == WPA2_IE) {
1716 memset(&iwe, 0, sizeof(iwe));
1717 memset(buf, 0, sizeof(buf));
1718 memcpy(buf, adapter->scantable[i].rsn_ie,
1719 adapter->scantable[i].rsn_ie_len);
1720 iwe.cmd = IWEVGENIE;
1721 iwe.u.data.length = adapter->scantable[i].rsn_ie_len;
1722 iwe.len = IW_EV_POINT_LEN + iwe.u.data.length;
1723 current_ev = iwe_stream_add_point(current_ev, end_buf,
1724 &iwe, buf);
1725 }
1726 if (adapter->scantable[i].wpa_ie[0] == WPA_IE) {
1727 memset(&iwe, 0, sizeof(iwe));
1728 memset(buf, 0, sizeof(buf));
1729 memcpy(buf, adapter->scantable[i].wpa_ie,
1730 adapter->scantable[i].wpa_ie_len);
1731 iwe.cmd = IWEVGENIE;
1732 iwe.u.data.length = adapter->scantable[i].wpa_ie_len;
1733 iwe.len = IW_EV_POINT_LEN + iwe.u.data.length;
1734 current_ev = iwe_stream_add_point(current_ev, end_buf,
1735 &iwe, buf);
1736 }
1737 1630
1631 return start;
1632}
1738 1633
1739 if (adapter->scantable[i].extra_ie != 0) { 1634/**
1740 memset(&iwe, 0, sizeof(iwe)); 1635 * @brief Retrieve the scan table entries via wireless tools IOCTL call
1741 memset(buf, 0, sizeof(buf)); 1636 *
1742 ptr = buf; 1637 * @param dev A pointer to net_device structure
1743 ptr += sprintf(ptr, "extra_ie"); 1638 * @param info A pointer to iw_request_info structure
1744 iwe.u.data.length = strlen(buf); 1639 * @param dwrq A pointer to iw_point structure
1640 * @param extra A pointer to extra data buf
1641 *
1642 * @return 0 --success, otherwise fail
1643 */
1644int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
1645 struct iw_point *dwrq, char *extra)
1646{
1647#define SCAN_ITEM_SIZE 128
1648 wlan_private *priv = dev->priv;
1649 wlan_adapter *adapter = priv->adapter;
1650 int err = 0;
1651 char *ev = extra;
1652 char *stop = ev + dwrq->length;
1653 struct bss_descriptor * iter_bss;
1654 struct bss_descriptor * safe;
1655
1656 lbs_deb_enter(LBS_DEB_ASSOC);
1657
1658 /* If we've got an uncompleted scan, schedule the next part */
1659 if (!adapter->nr_cmd_pending && adapter->last_scanned_channel)
1660 wlan_scan_networks(priv, NULL, 0);
1661
1662 /* Update RSSI if current BSS is a locally created ad-hoc BSS */
1663 if ((adapter->mode == IW_MODE_ADHOC) && adapter->adhoccreate) {
1664 libertas_prepare_and_send_command(priv, cmd_802_11_rssi, 0,
1665 cmd_option_waitforrsp, 0, NULL);
1666 }
1745 1667
1746 lbs_pr_debug(1, "iwe.u.data.length %d\n", 1668 mutex_lock(&adapter->lock);
1747 iwe.u.data.length); 1669 list_for_each_entry_safe (iter_bss, safe, &adapter->network_list, list) {
1748 lbs_pr_debug(1, "BUF: %s \n", buf); 1670 char * next_ev;
1671 unsigned long stale_time;
1749 1672
1750 iwe.cmd = IWEVCUSTOM; 1673 if (stop - ev < SCAN_ITEM_SIZE) {
1751 iwe.len = IW_EV_POINT_LEN + iwe.u.data.length; 1674 err = -E2BIG;
1752 current_ev = 1675 break;
1753 iwe_stream_add_point(current_ev, end_buf, &iwe,
1754 buf);
1755 } 1676 }
1756 1677
1757 current_val = current_ev + IW_EV_LCP_LEN; 1678 /* Prune old an old scan result */
1679 stale_time = iter_bss->last_scanned + DEFAULT_MAX_SCAN_AGE;
1680 if (time_after(jiffies, stale_time)) {
1681 list_move_tail (&iter_bss->list,
1682 &adapter->network_free_list);
1683 clear_bss_descriptor(iter_bss);
1684 continue;
1685 }
1758 1686
1759 /* 1687 /* Translate to WE format this entry */
1760 * Check if we added any event 1688 next_ev = libertas_translate_scan(priv, ev, stop, iter_bss);
1761 */ 1689 if (next_ev == NULL)
1762 if ((current_val - current_ev) > IW_EV_LCP_LEN) 1690 continue;
1763 current_ev = current_val; 1691 ev = next_ev;
1764 } 1692 }
1693 mutex_unlock(&adapter->lock);
1765 1694
1766 dwrq->length = (current_ev - extra); 1695 dwrq->length = (ev - extra);
1767 dwrq->flags = 0; 1696 dwrq->flags = 0;
1768 1697
1769 LEAVE(); 1698 lbs_deb_leave(LBS_DEB_ASSOC);
1770 return 0; 1699 return err;
1771} 1700}
1772 1701
1773/** 1702/**
@@ -1796,13 +1725,13 @@ int libertas_cmd_80211_scan(wlan_private * priv,
1796 struct cmd_ds_802_11_scan *pscan = &cmd->params.scan; 1725 struct cmd_ds_802_11_scan *pscan = &cmd->params.scan;
1797 struct wlan_scan_cmd_config *pscancfg; 1726 struct wlan_scan_cmd_config *pscancfg;
1798 1727
1799 ENTER(); 1728 lbs_deb_enter(LBS_DEB_ASSOC);
1800 1729
1801 pscancfg = pdata_buf; 1730 pscancfg = pdata_buf;
1802 1731
1803 /* Set fixed field variables in scan command */ 1732 /* Set fixed field variables in scan command */
1804 pscan->bsstype = pscancfg->bsstype; 1733 pscan->bsstype = pscancfg->bsstype;
1805 memcpy(pscan->BSSID, pscancfg->specificBSSID, sizeof(pscan->BSSID)); 1734 memcpy(pscan->BSSID, pscancfg->bssid, sizeof(pscan->BSSID));
1806 memcpy(pscan->tlvbuffer, pscancfg->tlvbuffer, pscancfg->tlvbufferlen); 1735 memcpy(pscan->tlvbuffer, pscancfg->tlvbuffer, pscancfg->tlvbufferlen);
1807 1736
1808 cmd->command = cpu_to_le16(cmd_802_11_scan); 1737 cmd->command = cpu_to_le16(cmd_802_11_scan);
@@ -1812,12 +1741,26 @@ int libertas_cmd_80211_scan(wlan_private * priv,
1812 + sizeof(pscan->BSSID) 1741 + sizeof(pscan->BSSID)
1813 + pscancfg->tlvbufferlen + S_DS_GEN); 1742 + pscancfg->tlvbufferlen + S_DS_GEN);
1814 1743
1815 lbs_pr_debug(1, "SCAN_CMD: command=%x, size=%x, seqnum=%x\n", 1744 lbs_deb_scan("SCAN_CMD: command=%x, size=%x, seqnum=%x\n",
1816 cmd->command, cmd->size, cmd->seqnum); 1745 le16_to_cpu(cmd->command), le16_to_cpu(cmd->size),
1817 LEAVE(); 1746 le16_to_cpu(cmd->seqnum));
1747
1748 lbs_deb_leave(LBS_DEB_ASSOC);
1818 return 0; 1749 return 0;
1819} 1750}
1820 1751
1752static inline int is_same_network(struct bss_descriptor *src,
1753 struct bss_descriptor *dst)
1754{
1755 /* A network is only a duplicate if the channel, BSSID, and ESSID
1756 * all match. We treat all <hidden> with the same BSSID and channel
1757 * as one network */
1758 return ((src->ssid_len == dst->ssid_len) &&
1759 (src->channel == dst->channel) &&
1760 !compare_ether_addr(src->bssid, dst->bssid) &&
1761 !memcmp(src->ssid, dst->ssid, src->ssid_len));
1762}
1763
1821/** 1764/**
1822 * @brief This function handles the command response of scan 1765 * @brief This function handles the command response of scan
1823 * 1766 *
@@ -1846,38 +1789,45 @@ int libertas_ret_80211_scan(wlan_private * priv, struct cmd_ds_command *resp)
1846{ 1789{
1847 wlan_adapter *adapter = priv->adapter; 1790 wlan_adapter *adapter = priv->adapter;
1848 struct cmd_ds_802_11_scan_rsp *pscan; 1791 struct cmd_ds_802_11_scan_rsp *pscan;
1849 struct bss_descriptor newbssentry;
1850 struct mrvlietypes_data *ptlv; 1792 struct mrvlietypes_data *ptlv;
1851 struct mrvlietypes_tsftimestamp *ptsftlv; 1793 struct mrvlietypes_tsftimestamp *ptsftlv;
1794 struct bss_descriptor * iter_bss;
1795 struct bss_descriptor * safe;
1852 u8 *pbssinfo; 1796 u8 *pbssinfo;
1853 u16 scanrespsize; 1797 u16 scanrespsize;
1854 int bytesleft; 1798 int bytesleft;
1855 int numintable;
1856 int bssIdx;
1857 int idx; 1799 int idx;
1858 int tlvbufsize; 1800 int tlvbufsize;
1859 u64 tsfval; 1801 int ret;
1860 1802
1861 ENTER(); 1803 lbs_deb_enter(LBS_DEB_ASSOC);
1804
1805 /* Prune old entries from scan table */
1806 list_for_each_entry_safe (iter_bss, safe, &adapter->network_list, list) {
1807 unsigned long stale_time = iter_bss->last_scanned + DEFAULT_MAX_SCAN_AGE;
1808 if (time_before(jiffies, stale_time))
1809 continue;
1810 list_move_tail (&iter_bss->list, &adapter->network_free_list);
1811 clear_bss_descriptor(iter_bss);
1812 }
1862 1813
1863 pscan = &resp->params.scanresp; 1814 pscan = &resp->params.scanresp;
1864 1815
1865 if (pscan->nr_sets > MRVDRV_MAX_BSSID_LIST) { 1816 if (pscan->nr_sets > MAX_NETWORK_COUNT) {
1866 lbs_pr_debug(1, 1817 lbs_deb_scan(
1867 "SCAN_RESP: Invalid number of AP returned (%d)!!\n", 1818 "SCAN_RESP: too many scan results (%d, max %d)!!\n",
1868 pscan->nr_sets); 1819 pscan->nr_sets, MAX_NETWORK_COUNT);
1869 LEAVE(); 1820 ret = -1;
1870 return -1; 1821 goto done;
1871 } 1822 }
1872 1823
1873 bytesleft = le16_to_cpu(pscan->bssdescriptsize); 1824 bytesleft = le16_to_cpu(pscan->bssdescriptsize);
1874 lbs_pr_debug(1, "SCAN_RESP: bssdescriptsize %d\n", bytesleft); 1825 lbs_deb_scan("SCAN_RESP: bssdescriptsize %d\n", bytesleft);
1875 1826
1876 scanrespsize = le16_to_cpu(resp->size); 1827 scanrespsize = le16_to_cpu(resp->size);
1877 lbs_pr_debug(1, "SCAN_RESP: returned %d AP before parsing\n", 1828 lbs_deb_scan("SCAN_RESP: returned %d AP before parsing\n",
1878 pscan->nr_sets); 1829 pscan->nr_sets);
1879 1830
1880 numintable = adapter->numinscantable;
1881 pbssinfo = pscan->bssdesc_and_tlvbuffer; 1831 pbssinfo = pscan->bssdesc_and_tlvbuffer;
1882 1832
1883 /* The size of the TLV buffer is equal to the entire command response 1833 /* 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)
1901 * or as an addition at the end of the table 1851 * or as an addition at the end of the table
1902 */ 1852 */
1903 for (idx = 0; idx < pscan->nr_sets && bytesleft; idx++) { 1853 for (idx = 0; idx < pscan->nr_sets && bytesleft; idx++) {
1904 /* Zero out the newbssentry we are about to store info in */ 1854 struct bss_descriptor new;
1905 memset(&newbssentry, 0x00, sizeof(newbssentry)); 1855 struct bss_descriptor * found = NULL;
1856 struct bss_descriptor * oldest = NULL;
1906 1857
1907 /* Process the data fields and IEs returned for this BSS */ 1858 /* Process the data fields and IEs returned for this BSS */
1908 if ((InterpretBSSDescriptionWithIE(&newbssentry, 1859 memset(&new, 0, sizeof (struct bss_descriptor));
1909 &pbssinfo, 1860 if (libertas_process_bss(&new, &pbssinfo, &bytesleft) != 0) {
1910 &bytesleft) == 1861 /* error parsing the scan response, skipped */
1911 0) 1862 lbs_deb_scan("SCAN_RESP: process_bss returned ERROR\n");
1912 && CHECK_SSID_IS_VALID(&newbssentry.ssid)) { 1863 continue;
1913 1864 }
1914 lbs_pr_debug(1,
1915 "SCAN_RESP: BSSID = %02x:%02x:%02x:%02x:%02x:%02x\n",
1916 newbssentry.macaddress[0],
1917 newbssentry.macaddress[1],
1918 newbssentry.macaddress[2],
1919 newbssentry.macaddress[3],
1920 newbssentry.macaddress[4],
1921 newbssentry.macaddress[5]);
1922
1923 /*
1924 * Search the scan table for the same bssid
1925 */
1926 for (bssIdx = 0; bssIdx < numintable; bssIdx++) {
1927 if (memcmp(newbssentry.macaddress,
1928 adapter->scantable[bssIdx].
1929 macaddress,
1930 sizeof(newbssentry.macaddress)) ==
1931 0) {
1932 /*
1933 * If the SSID matches as well, it is a duplicate of
1934 * this entry. Keep the bssIdx set to this
1935 * entry so we replace the old contents in the table
1936 */
1937 if ((newbssentry.ssid.ssidlength ==
1938 adapter->scantable[bssIdx].ssid.
1939 ssidlength)
1940 &&
1941 (memcmp
1942 (newbssentry.ssid.ssid,
1943 adapter->scantable[bssIdx].ssid.
1944 ssid,
1945 newbssentry.ssid.ssidlength) ==
1946 0)) {
1947 lbs_pr_debug(1,
1948 "SCAN_RESP: Duplicate of index: %d\n",
1949 bssIdx);
1950 break;
1951 }
1952 }
1953 }
1954 /*
1955 * If the bssIdx is equal to the number of entries in the table,
1956 * the new entry was not a duplicate; append it to the scan
1957 * table
1958 */
1959 if (bssIdx == numintable) {
1960 /* Range check the bssIdx, keep it limited to the last entry */
1961 if (bssIdx == MRVDRV_MAX_BSSID_LIST) {
1962 bssIdx--;
1963 } else {
1964 numintable++;
1965 }
1966 }
1967
1968 /*
1969 * If the TSF TLV was appended to the scan results, save the
1970 * this entries TSF value in the networktsf field. The
1971 * networktsf is the firmware's TSF value at the time the
1972 * beacon or probe response was received.
1973 */
1974 if (ptsftlv) {
1975 memcpy(&tsfval, &ptsftlv->tsftable[idx],
1976 sizeof(tsfval));
1977 tsfval = le64_to_cpu(tsfval);
1978 1865
1979 memcpy(&newbssentry.networktsf, 1866 /* Try to find this bss in the scan table */
1980 &tsfval, sizeof(newbssentry.networktsf)); 1867 list_for_each_entry (iter_bss, &adapter->network_list, list) {
1868 if (is_same_network(iter_bss, &new)) {
1869 found = iter_bss;
1870 break;
1981 } 1871 }
1982 1872
1983 /* Copy the locally created newbssentry to the scan table */ 1873 if ((oldest == NULL) ||
1984 memcpy(&adapter->scantable[bssIdx], 1874 (iter_bss->last_scanned < oldest->last_scanned))
1985 &newbssentry, 1875 oldest = iter_bss;
1986 sizeof(adapter->scantable[bssIdx])); 1876 }
1987 1877
1878 if (found) {
1879 /* found, clear it */
1880 clear_bss_descriptor(found);
1881 } else if (!list_empty(&adapter->network_free_list)) {
1882 /* Pull one from the free list */
1883 found = list_entry(adapter->network_free_list.next,
1884 struct bss_descriptor, list);
1885 list_move_tail(&found->list, &adapter->network_list);
1886 } else if (oldest) {
1887 /* If there are no more slots, expire the oldest */
1888 found = oldest;
1889 clear_bss_descriptor(found);
1890 list_move_tail(&found->list, &adapter->network_list);
1988 } else { 1891 } else {
1892 continue;
1893 }
1894
1895 lbs_deb_scan("SCAN_RESP: BSSID = " MAC_FMT "\n",
1896 new.bssid[0], new.bssid[1], new.bssid[2],
1897 new.bssid[3], new.bssid[4], new.bssid[5]);
1989 1898
1990 /* error parsing/interpreting the scan response, skipped */ 1899 /*
1991 lbs_pr_debug(1, "SCAN_RESP: " 1900 * If the TSF TLV was appended to the scan results, save the
1992 "InterpretBSSDescriptionWithIE returned ERROR\n"); 1901 * this entries TSF value in the networktsf field. The
1902 * networktsf is the firmware's TSF value at the time the
1903 * beacon or probe response was received.
1904 */
1905 if (ptsftlv) {
1906 new.networktsf = le64_to_cpup(&ptsftlv->tsftable[idx]);
1993 } 1907 }
1994 }
1995 1908
1996 lbs_pr_debug(1, "SCAN_RESP: Scanned %2d APs, %d valid, %d total\n", 1909 /* Copy the locally created newbssentry to the scan table */
1997 pscan->nr_sets, numintable - adapter->numinscantable, 1910 memcpy(found, &new, offsetof(struct bss_descriptor, list));
1998 numintable); 1911 }
1999 1912
2000 /* Update the total number of BSSIDs in the scan table */ 1913 ret = 0;
2001 adapter->numinscantable = numintable;
2002 1914
2003 LEAVE(); 1915done:
2004 return 0; 1916 lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret);
1917 return ret;
2005} 1918}
diff --git a/drivers/net/wireless/libertas/scan.h b/drivers/net/wireless/libertas/scan.h
index 405f4f0fe575..bd019e5ff1eb 100644
--- a/drivers/net/wireless/libertas/scan.h
+++ b/drivers/net/wireless/libertas/scan.h
@@ -51,7 +51,7 @@ struct wlan_scan_cmd_config {
51 /** 51 /**
52 * @brief Specific BSSID used to filter scan results in the firmware 52 * @brief Specific BSSID used to filter scan results in the firmware
53 */ 53 */
54 u8 specificBSSID[ETH_ALEN]; 54 u8 bssid[ETH_ALEN];
55 55
56 /** 56 /**
57 * @brief length of TLVs sent in command starting at tlvBuffer 57 * @brief length of TLVs sent in command starting at tlvBuffer
@@ -91,15 +91,6 @@ struct wlan_ioctl_user_scan_chan {
91 * @sa libertas_set_user_scan_ioctl 91 * @sa libertas_set_user_scan_ioctl
92 */ 92 */
93struct wlan_ioctl_user_scan_cfg { 93struct wlan_ioctl_user_scan_cfg {
94
95 /**
96 * @brief Flag set to keep the previous scan table intact
97 *
98 * If set, the scan results will accumulate, replacing any previous
99 * matched entries for a BSS with the new scan data
100 */
101 u8 keeppreviousscan; //!< Do not erase the existing scan results
102
103 /** 94 /**
104 * @brief BSS type to be sent in the firmware command 95 * @brief BSS type to be sent in the firmware command
105 * 96 *
@@ -117,15 +108,22 @@ struct wlan_ioctl_user_scan_cfg {
117 */ 108 */
118 u8 numprobes; 109 u8 numprobes;
119 110
120 /** 111 /**
121 * @brief BSSID filter sent in the firmware command to limit the results 112 * @brief BSSID filter sent in the firmware command to limit the results
122 */ 113 */
123 u8 specificBSSID[ETH_ALEN]; 114 u8 bssid[ETH_ALEN];
124 115
125 /** 116 /* Clear existing scan results matching this BSSID */
126 * @brief SSID filter sent in the firmware command to limit the results 117 u8 clear_bssid;
127 */ 118
128 char specificSSID[IW_ESSID_MAX_SIZE + 1]; 119 /**
120 * @brief SSID filter sent in the firmware command to limit the results
121 */
122 char ssid[IW_ESSID_MAX_SIZE];
123 u8 ssid_len;
124
125 /* Clear existing scan results matching this SSID */
126 u8 clear_ssid;
129 127
130 /** 128 /**
131 * @brief Variable number (fixed maximum) of channels to scan up 129 * @brief Variable number (fixed maximum) of channels to scan up
@@ -137,9 +135,10 @@ struct wlan_ioctl_user_scan_cfg {
137 * @brief Structure used to store information for each beacon/probe response 135 * @brief Structure used to store information for each beacon/probe response
138 */ 136 */
139struct bss_descriptor { 137struct bss_descriptor {
140 u8 macaddress[ETH_ALEN]; 138 u8 bssid[ETH_ALEN];
141 139
142 struct WLAN_802_11_SSID ssid; 140 u8 ssid[IW_ESSID_MAX_SIZE + 1];
141 u8 ssid_len;
143 142
144 /* WEP encryption requirement */ 143 /* WEP encryption requirement */
145 u32 privacy; 144 u32 privacy;
@@ -156,15 +155,15 @@ struct bss_descriptor {
156 u8 mode; 155 u8 mode;
157 u8 libertas_supported_rates[WLAN_SUPPORTED_RATES]; 156 u8 libertas_supported_rates[WLAN_SUPPORTED_RATES];
158 157
159 int extra_ie; 158 __le64 timestamp; //!< TSF value included in the beacon/probe response
159 unsigned long last_scanned;
160 160
161 u8 timestamp[8]; //!< TSF value included in the beacon/probe response
162 union ieeetypes_phyparamset phyparamset; 161 union ieeetypes_phyparamset phyparamset;
163 union IEEEtypes_ssparamset ssparamset; 162 union IEEEtypes_ssparamset ssparamset;
164 struct ieeetypes_capinfo cap; 163 struct ieeetypes_capinfo cap;
165 u8 datarates[WLAN_SUPPORTED_RATES]; 164 u8 datarates[WLAN_SUPPORTED_RATES];
166 165
167 __le64 networktsf; //!< TSF timestamp from the current firmware TSF 166 u64 networktsf; //!< TSF timestamp from the current firmware TSF
168 167
169 struct ieeetypes_countryinfofullset countryinfo; 168 struct ieeetypes_countryinfofullset countryinfo;
170 169
@@ -172,24 +171,29 @@ struct bss_descriptor {
172 size_t wpa_ie_len; 171 size_t wpa_ie_len;
173 u8 rsn_ie[MAX_WPA_IE_LEN]; 172 u8 rsn_ie[MAX_WPA_IE_LEN];
174 size_t rsn_ie_len; 173 size_t rsn_ie_len;
174
175 struct list_head list;
175}; 176};
176 177
177extern int libertas_SSID_cmp(struct WLAN_802_11_SSID *ssid1, 178extern int libertas_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len);
178 struct WLAN_802_11_SSID *ssid2); 179
179extern int libertas_find_SSID_in_list(wlan_adapter * adapter, struct WLAN_802_11_SSID *ssid, 180struct bss_descriptor * libertas_find_ssid_in_list(wlan_adapter * adapter,
180 u8 * bssid, u8 mode); 181 u8 *ssid, u8 ssid_len, u8 * bssid, u8 mode,
181int libertas_find_best_SSID_in_list(wlan_adapter * adapter, u8 mode); 182 int channel);
182extern int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, u8 mode); 183
184struct bss_descriptor * libertas_find_best_ssid_in_list(wlan_adapter * adapter,
185 u8 mode);
186
187extern struct bss_descriptor * libertas_find_bssid_in_list(wlan_adapter * adapter,
188 u8 * bssid, u8 mode);
183 189
184int libertas_find_best_network_SSID(wlan_private * priv, 190int libertas_find_best_network_ssid(wlan_private * priv, u8 *out_ssid,
185 struct WLAN_802_11_SSID *pSSID, 191 u8 *out_ssid_len, u8 preferred_mode, u8 *out_mode);
186 u8 preferred_mode, u8 *out_mode);
187 192
188extern int libertas_send_specific_SSID_scan(wlan_private * priv, 193extern int libertas_send_specific_ssid_scan(wlan_private * priv, u8 *ssid,
189 struct WLAN_802_11_SSID *prequestedssid, 194 u8 ssid_len, u8 clear_ssid);
190 u8 keeppreviousscan); 195extern int libertas_send_specific_bssid_scan(wlan_private * priv,
191extern int libertas_send_specific_BSSID_scan(wlan_private * priv, 196 u8 * bssid, u8 clear_bssid);
192 u8 * bssid, u8 keeppreviousscan);
193 197
194extern int libertas_cmd_80211_scan(wlan_private * priv, 198extern int libertas_cmd_80211_scan(wlan_private * priv,
195 struct cmd_ds_command *cmd, 199 struct cmd_ds_command *cmd,
@@ -199,7 +203,8 @@ extern int libertas_ret_80211_scan(wlan_private * priv,
199 struct cmd_ds_command *resp); 203 struct cmd_ds_command *resp);
200 204
201int wlan_scan_networks(wlan_private * priv, 205int wlan_scan_networks(wlan_private * priv,
202 const struct wlan_ioctl_user_scan_cfg * puserscanin); 206 const struct wlan_ioctl_user_scan_cfg * puserscanin,
207 int full_scan);
203 208
204struct ifreq; 209struct ifreq;
205 210
diff --git a/drivers/net/wireless/libertas/thread.h b/drivers/net/wireless/libertas/thread.h
index 207b8a6cc33d..b1f34d92ff3e 100644
--- a/drivers/net/wireless/libertas/thread.h
+++ b/drivers/net/wireless/libertas/thread.h
@@ -21,11 +21,11 @@ static inline void wlan_activate_thread(struct wlan_thread * thr)
21 21
22static inline void wlan_deactivate_thread(struct wlan_thread * thr) 22static inline void wlan_deactivate_thread(struct wlan_thread * thr)
23{ 23{
24 ENTER(); 24 lbs_deb_enter(LBS_DEB_THREAD);
25 25
26 thr->pid = 0; 26 thr->pid = 0;
27 27
28 LEAVE(); 28 lbs_deb_leave(LBS_DEB_THREAD);
29} 29}
30 30
31static inline void wlan_create_thread(int (*wlanfunc) (void *), 31static inline void wlan_create_thread(int (*wlanfunc) (void *),
@@ -36,7 +36,7 @@ static inline void wlan_create_thread(int (*wlanfunc) (void *),
36 36
37static inline int wlan_terminate_thread(struct wlan_thread * thr) 37static inline int wlan_terminate_thread(struct wlan_thread * thr)
38{ 38{
39 ENTER(); 39 lbs_deb_enter(LBS_DEB_THREAD);
40 40
41 /* Check if the thread is active or not */ 41 /* Check if the thread is active or not */
42 if (!thr->pid) { 42 if (!thr->pid) {
@@ -45,7 +45,7 @@ static inline int wlan_terminate_thread(struct wlan_thread * thr)
45 } 45 }
46 kthread_stop(thr->task); 46 kthread_stop(thr->task);
47 47
48 LEAVE(); 48 lbs_deb_leave(LBS_DEB_THREAD);
49 return 0; 49 return 0;
50} 50}
51 51
diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c
index d4b13478c9a7..17c437635a00 100644
--- a/drivers/net/wireless/libertas/tx.c
+++ b/drivers/net/wireless/libertas/tx.c
@@ -5,7 +5,6 @@
5 5
6#include "hostcmd.h" 6#include "hostcmd.h"
7#include "radiotap.h" 7#include "radiotap.h"
8#include "sbi.h"
9#include "decl.h" 8#include "decl.h"
10#include "defs.h" 9#include "defs.h"
11#include "dev.h" 10#include "dev.h"
@@ -68,7 +67,7 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
68 u32 new_rate; 67 u32 new_rate;
69 u8 *ptr = priv->adapter->tmptxbuf; 68 u8 *ptr = priv->adapter->tmptxbuf;
70 69
71 ENTER(); 70 lbs_deb_enter(LBS_DEB_TX);
72 71
73 if (priv->adapter->surpriseremoved) 72 if (priv->adapter->surpriseremoved)
74 return -1; 73 return -1;
@@ -78,7 +77,7 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
78 min_t(unsigned int, skb->len, 100)); 77 min_t(unsigned int, skb->len, 100));
79 78
80 if (!skb->len || (skb->len > MRVDRV_ETH_TX_PACKET_BUFFER_SIZE)) { 79 if (!skb->len || (skb->len > MRVDRV_ETH_TX_PACKET_BUFFER_SIZE)) {
81 lbs_pr_debug(1, "Tx error: Bad skb length %d : %zd\n", 80 lbs_deb_tx("tx err: skb length %d 0 or > %zd\n",
82 skb->len, MRVDRV_ETH_TX_PACKET_BUFFER_SIZE); 81 skb->len, MRVDRV_ETH_TX_PACKET_BUFFER_SIZE);
83 ret = -1; 82 ret = -1;
84 goto done; 83 goto done;
@@ -86,13 +85,13 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
86 85
87 memset(plocaltxpd, 0, sizeof(struct txpd)); 86 memset(plocaltxpd, 0, sizeof(struct txpd));
88 87
89 plocaltxpd->tx_packet_length = skb->len; 88 plocaltxpd->tx_packet_length = cpu_to_le16(skb->len);
90 89
91 /* offset of actual data */ 90 /* offset of actual data */
92 plocaltxpd->tx_packet_location = sizeof(struct txpd); 91 plocaltxpd->tx_packet_location = cpu_to_le32(sizeof(struct txpd));
93 92
94 /* TxCtrl set by user or default */ 93 /* TxCtrl set by user or default */
95 plocaltxpd->tx_control = adapter->pkttxctrl; 94 plocaltxpd->tx_control = cpu_to_le32(adapter->pkttxctrl);
96 95
97 p802x_hdr = skb->data; 96 p802x_hdr = skb->data;
98 if (priv->adapter->radiomode == WLAN_RADIOMODE_RADIOTAP) { 97 if (priv->adapter->radiomode == WLAN_RADIOMODE_RADIOTAP) {
@@ -103,15 +102,16 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
103 /* set txpd fields from the radiotap header */ 102 /* set txpd fields from the radiotap header */
104 new_rate = convert_radiotap_rate_to_mv(pradiotap_hdr->rate); 103 new_rate = convert_radiotap_rate_to_mv(pradiotap_hdr->rate);
105 if (new_rate != 0) { 104 if (new_rate != 0) {
106 /* erase tx_control[4:0] */ 105 /* use new tx_control[4:0] */
107 plocaltxpd->tx_control &= ~0x1f; 106 new_rate |= (adapter->pkttxctrl & ~0x1f);
108 /* write new tx_control[4:0] */ 107 plocaltxpd->tx_control = cpu_to_le32(new_rate);
109 plocaltxpd->tx_control |= new_rate;
110 } 108 }
111 109
112 /* skip the radiotap header */ 110 /* skip the radiotap header */
113 p802x_hdr += sizeof(struct tx_radiotap_hdr); 111 p802x_hdr += sizeof(struct tx_radiotap_hdr);
114 plocaltxpd->tx_packet_length -= sizeof(struct tx_radiotap_hdr); 112 plocaltxpd->tx_packet_length =
113 cpu_to_le16(le16_to_cpu(plocaltxpd->tx_packet_length)
114 - sizeof(struct tx_radiotap_hdr));
115 115
116 } 116 }
117 /* copy destination address from 802.3 or 802.11 header */ 117 /* copy destination address from 802.3 or 802.11 header */
@@ -123,28 +123,28 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
123 lbs_dbg_hex("txpd", (u8 *) plocaltxpd, sizeof(struct txpd)); 123 lbs_dbg_hex("txpd", (u8 *) plocaltxpd, sizeof(struct txpd));
124 124
125 if (IS_MESH_FRAME(skb)) { 125 if (IS_MESH_FRAME(skb)) {
126 plocaltxpd->tx_control |= TxPD_MESH_FRAME; 126 plocaltxpd->tx_control |= cpu_to_le32(TxPD_MESH_FRAME);
127 } 127 }
128 128
129 memcpy(ptr, plocaltxpd, sizeof(struct txpd)); 129 memcpy(ptr, plocaltxpd, sizeof(struct txpd));
130 130
131 ptr += sizeof(struct txpd); 131 ptr += sizeof(struct txpd);
132 132
133 lbs_dbg_hex("Tx Data", (u8 *) p802x_hdr, plocaltxpd->tx_packet_length); 133 lbs_dbg_hex("Tx Data", (u8 *) p802x_hdr, le16_to_cpu(plocaltxpd->tx_packet_length));
134 memcpy(ptr, p802x_hdr, plocaltxpd->tx_packet_length); 134 memcpy(ptr, p802x_hdr, le16_to_cpu(plocaltxpd->tx_packet_length));
135 ret = libertas_sbi_host_to_card(priv, MVMS_DAT, 135 ret = priv->hw_host_to_card(priv, MVMS_DAT,
136 priv->adapter->tmptxbuf, 136 priv->adapter->tmptxbuf,
137 plocaltxpd->tx_packet_length + 137 le16_to_cpu(plocaltxpd->tx_packet_length) +
138 sizeof(struct txpd)); 138 sizeof(struct txpd));
139 139
140 if (ret) { 140 if (ret) {
141 lbs_pr_debug(1, "Tx error: libertas_sbi_host_to_card failed: 0x%X\n", ret); 141 lbs_deb_tx("tx err: hw_host_to_card returned 0x%X\n", ret);
142 goto done; 142 goto done;
143 } 143 }
144 144
145 lbs_pr_debug(1, "SendSinglePacket succeeds\n"); 145 lbs_deb_tx("SendSinglePacket succeeds\n");
146 146
147 done: 147done:
148 if (!ret) { 148 if (!ret) {
149 priv->stats.tx_packets++; 149 priv->stats.tx_packets++;
150 priv->stats.tx_bytes += skb->len; 150 priv->stats.tx_bytes += skb->len;
@@ -158,7 +158,8 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
158 received from FW */ 158 received from FW */
159 skb_orphan(skb); 159 skb_orphan(skb);
160 /* stop processing outgoing pkts */ 160 /* stop processing outgoing pkts */
161 netif_stop_queue(priv->wlan_dev.netdev); 161 netif_stop_queue(priv->dev);
162 netif_stop_queue(priv->mesh_dev);
162 /* freeze any packets already in our queues */ 163 /* freeze any packets already in our queues */
163 priv->adapter->TxLockFlag = 1; 164 priv->adapter->TxLockFlag = 1;
164 } else { 165 } else {
@@ -166,7 +167,7 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
166 priv->adapter->currenttxskb = NULL; 167 priv->adapter->currenttxskb = NULL;
167 } 168 }
168 169
169 LEAVE(); 170 lbs_deb_leave_args(LBS_DEB_TX, "ret %d", ret);
170 return ret; 171 return ret;
171} 172}
172 173
@@ -195,10 +196,13 @@ static void wlan_tx_queue(wlan_private *priv, struct sk_buff *skb)
195 196
196 WARN_ON(priv->adapter->tx_queue_idx >= NR_TX_QUEUE); 197 WARN_ON(priv->adapter->tx_queue_idx >= NR_TX_QUEUE);
197 adapter->tx_queue_ps[adapter->tx_queue_idx++] = skb; 198 adapter->tx_queue_ps[adapter->tx_queue_idx++] = skb;
198 if (adapter->tx_queue_idx == NR_TX_QUEUE) 199 if (adapter->tx_queue_idx == NR_TX_QUEUE) {
199 netif_stop_queue(priv->wlan_dev.netdev); 200 netif_stop_queue(priv->dev);
200 else 201 netif_stop_queue(priv->mesh_dev);
201 netif_start_queue(priv->wlan_dev.netdev); 202 } else {
203 netif_start_queue(priv->dev);
204 netif_start_queue(priv->mesh_dev);
205 }
202 206
203 spin_unlock(&adapter->txqueue_lock); 207 spin_unlock(&adapter->txqueue_lock);
204} 208}
@@ -214,13 +218,12 @@ int libertas_process_tx(wlan_private * priv, struct sk_buff *skb)
214{ 218{
215 int ret = -1; 219 int ret = -1;
216 220
217 ENTER(); 221 lbs_deb_enter(LBS_DEB_TX);
218
219 lbs_dbg_hex("TX Data", skb->data, min_t(unsigned int, skb->len, 100)); 222 lbs_dbg_hex("TX Data", skb->data, min_t(unsigned int, skb->len, 100));
220 223
221 if (priv->wlan_dev.dnld_sent) { 224 if (priv->dnld_sent) {
222 lbs_pr_alert( "TX error: dnld_sent = %d, not sending\n", 225 lbs_pr_alert( "TX error: dnld_sent = %d, not sending\n",
223 priv->wlan_dev.dnld_sent); 226 priv->dnld_sent);
224 goto done; 227 goto done;
225 } 228 }
226 229
@@ -234,7 +237,7 @@ int libertas_process_tx(wlan_private * priv, struct sk_buff *skb)
234 237
235 ret = SendSinglePacket(priv, skb); 238 ret = SendSinglePacket(priv, skb);
236done: 239done:
237 LEAVE(); 240 lbs_deb_leave_args(LBS_DEB_TX, "ret %d", ret);
238 return ret; 241 return ret;
239} 242}
240 243
@@ -280,6 +283,9 @@ void libertas_send_tx_feedback(wlan_private * priv)
280 libertas_upload_rx_packet(priv, adapter->currenttxskb); 283 libertas_upload_rx_packet(priv, adapter->currenttxskb);
281 adapter->currenttxskb = NULL; 284 adapter->currenttxskb = NULL;
282 priv->adapter->TxLockFlag = 0; 285 priv->adapter->TxLockFlag = 0;
283 if (priv->adapter->connect_status == libertas_connected) 286 if (priv->adapter->connect_status == libertas_connected) {
284 netif_wake_queue(priv->wlan_dev.netdev); 287 netif_wake_queue(priv->dev);
288 netif_wake_queue(priv->mesh_dev);
289 }
285} 290}
291EXPORT_SYMBOL_GPL(libertas_send_tx_feedback);
diff --git a/drivers/net/wireless/libertas/types.h b/drivers/net/wireless/libertas/types.h
index 09d62f8b1a16..028e2f3b53d6 100644
--- a/drivers/net/wireless/libertas/types.h
+++ b/drivers/net/wireless/libertas/types.h
@@ -5,6 +5,7 @@
5#define _WLAN_TYPES_ 5#define _WLAN_TYPES_
6 6
7#include <linux/if_ether.h> 7#include <linux/if_ether.h>
8#include <asm/byteorder.h>
8 9
9/** IEEE type definitions */ 10/** IEEE type definitions */
10enum ieeetypes_elementid { 11enum ieeetypes_elementid {
@@ -29,9 +30,30 @@ enum ieeetypes_elementid {
29 EXTRA_IE = 133, 30 EXTRA_IE = 133,
30} __attribute__ ((packed)); 31} __attribute__ ((packed));
31 32
33#ifdef __BIG_ENDIAN
32#define CAPINFO_MASK (~(0xda00)) 34#define CAPINFO_MASK (~(0xda00))
35#else
36#define CAPINFO_MASK (~(0x00da))
37#endif
33 38
34struct ieeetypes_capinfo { 39struct ieeetypes_capinfo {
40#ifdef __BIG_ENDIAN_BITFIELD
41 u8 chanagility:1;
42 u8 pbcc:1;
43 u8 shortpreamble:1;
44 u8 privacy:1;
45 u8 cfpollrqst:1;
46 u8 cfpollable:1;
47 u8 ibss:1;
48 u8 ess:1;
49 u8 rsrvd1:2;
50 u8 dsssofdm:1;
51 u8 rsvrd2:1;
52 u8 apsd:1;
53 u8 shortslottime:1;
54 u8 rsrvd3:1;
55 u8 spectrummgmt:1;
56#else
35 u8 ess:1; 57 u8 ess:1;
36 u8 ibss:1; 58 u8 ibss:1;
37 u8 cfpollable:1; 59 u8 cfpollable:1;
@@ -47,6 +69,7 @@ struct ieeetypes_capinfo {
47 u8 rsvrd2:1; 69 u8 rsvrd2:1;
48 u8 dsssofdm:1; 70 u8 dsssofdm:1;
49 u8 rsrvd1:2; 71 u8 rsrvd1:2;
72#endif
50} __attribute__ ((packed)); 73} __attribute__ ((packed));
51 74
52struct ieeetypes_cfparamset { 75struct ieeetypes_cfparamset {
@@ -54,15 +77,15 @@ struct ieeetypes_cfparamset {
54 u8 len; 77 u8 len;
55 u8 cfpcnt; 78 u8 cfpcnt;
56 u8 cfpperiod; 79 u8 cfpperiod;
57 u16 cfpmaxduration; 80 __le16 cfpmaxduration;
58 u16 cfpdurationremaining; 81 __le16 cfpdurationremaining;
59} __attribute__ ((packed)); 82} __attribute__ ((packed));
60 83
61 84
62struct ieeetypes_ibssparamset { 85struct ieeetypes_ibssparamset {
63 u8 elementid; 86 u8 elementid;
64 u8 len; 87 u8 len;
65 u16 atimwindow; 88 __le16 atimwindow;
66} __attribute__ ((packed)); 89} __attribute__ ((packed));
67 90
68union IEEEtypes_ssparamset { 91union IEEEtypes_ssparamset {
@@ -73,7 +96,7 @@ union IEEEtypes_ssparamset {
73struct ieeetypes_fhparamset { 96struct ieeetypes_fhparamset {
74 u8 elementid; 97 u8 elementid;
75 u8 len; 98 u8 len;
76 u16 dwelltime; 99 __le16 dwelltime;
77 u8 hopset; 100 u8 hopset;
78 u8 hoppattern; 101 u8 hoppattern;
79 u8 hopindex; 102 u8 hopindex;
@@ -92,8 +115,8 @@ union ieeetypes_phyparamset {
92 115
93struct ieeetypes_assocrsp { 116struct ieeetypes_assocrsp {
94 struct ieeetypes_capinfo capability; 117 struct ieeetypes_capinfo capability;
95 u16 statuscode; 118 __le16 statuscode;
96 u16 aid; 119 __le16 aid;
97 u8 iebuffer[1]; 120 u8 iebuffer[1];
98} __attribute__ ((packed)); 121} __attribute__ ((packed));
99 122
@@ -138,8 +161,8 @@ struct ieeetypes_assocrsp {
138 161
139/** TLV related data structures*/ 162/** TLV related data structures*/
140struct mrvlietypesheader { 163struct mrvlietypesheader {
141 u16 type; 164 __le16 type;
142 u16 len; 165 __le16 len;
143} __attribute__ ((packed)); 166} __attribute__ ((packed));
144 167
145struct mrvlietypes_data { 168struct mrvlietypes_data {
@@ -164,17 +187,23 @@ struct mrvlietypes_wildcardssidparamset {
164} __attribute__ ((packed)); 187} __attribute__ ((packed));
165 188
166struct chanscanmode { 189struct chanscanmode {
190#ifdef __BIG_ENDIAN_BITFIELD
191 u8 reserved_2_7:6;
192 u8 disablechanfilt:1;
193 u8 passivescan:1;
194#else
167 u8 passivescan:1; 195 u8 passivescan:1;
168 u8 disablechanfilt:1; 196 u8 disablechanfilt:1;
169 u8 reserved_2_7:6; 197 u8 reserved_2_7:6;
198#endif
170} __attribute__ ((packed)); 199} __attribute__ ((packed));
171 200
172struct chanscanparamset { 201struct chanscanparamset {
173 u8 radiotype; 202 u8 radiotype;
174 u8 channumber; 203 u8 channumber;
175 struct chanscanmode chanscanmode; 204 struct chanscanmode chanscanmode;
176 u16 minscantime; 205 __le16 minscantime;
177 u16 maxscantime; 206 __le16 maxscantime;
178} __attribute__ ((packed)); 207} __attribute__ ((packed));
179 208
180struct mrvlietypes_chanlistparamset { 209struct mrvlietypes_chanlistparamset {
@@ -185,12 +214,12 @@ struct mrvlietypes_chanlistparamset {
185struct cfparamset { 214struct cfparamset {
186 u8 cfpcnt; 215 u8 cfpcnt;
187 u8 cfpperiod; 216 u8 cfpperiod;
188 u16 cfpmaxduration; 217 __le16 cfpmaxduration;
189 u16 cfpdurationremaining; 218 __le16 cfpdurationremaining;
190} __attribute__ ((packed)); 219} __attribute__ ((packed));
191 220
192struct ibssparamset { 221struct ibssparamset {
193 u16 atimwindow; 222 __le16 atimwindow;
194} __attribute__ ((packed)); 223} __attribute__ ((packed));
195 224
196struct mrvlietypes_ssparamset { 225struct mrvlietypes_ssparamset {
@@ -202,7 +231,7 @@ struct mrvlietypes_ssparamset {
202} __attribute__ ((packed)); 231} __attribute__ ((packed));
203 232
204struct fhparamset { 233struct fhparamset {
205 u16 dwelltime; 234 __le16 dwelltime;
206 u8 hopset; 235 u8 hopset;
207 u8 hoppattern; 236 u8 hoppattern;
208 u8 hopindex; 237 u8 hopindex;
@@ -263,17 +292,17 @@ struct mrvlietypes_beaconsmissed {
263 292
264struct mrvlietypes_numprobes { 293struct mrvlietypes_numprobes {
265 struct mrvlietypesheader header; 294 struct mrvlietypesheader header;
266 u16 numprobes; 295 __le16 numprobes;
267} __attribute__ ((packed)); 296} __attribute__ ((packed));
268 297
269struct mrvlietypes_bcastprobe { 298struct mrvlietypes_bcastprobe {
270 struct mrvlietypesheader header; 299 struct mrvlietypesheader header;
271 u16 bcastprobe; 300 __le16 bcastprobe;
272} __attribute__ ((packed)); 301} __attribute__ ((packed));
273 302
274struct mrvlietypes_numssidprobe { 303struct mrvlietypes_numssidprobe {
275 struct mrvlietypesheader header; 304 struct mrvlietypesheader header;
276 u16 numssidprobe; 305 __le16 numssidprobe;
277} __attribute__ ((packed)); 306} __attribute__ ((packed));
278 307
279struct led_pin { 308struct led_pin {
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c
index 69f52b6e59c8..8939251a2f4c 100644
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -22,6 +22,14 @@
22 22
23 23
24/** 24/**
25 * the rates supported by the card
26 */
27static u8 libertas_wlan_data_rates[WLAN_SUPPORTED_RATES] =
28 { 0x02, 0x04, 0x0B, 0x16, 0x00, 0x0C, 0x12,
29 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x00
30};
31
32/**
25 * @brief Convert mw value to dbm value 33 * @brief Convert mw value to dbm value
26 * 34 *
27 * @param mw the value of mw 35 * @param mw the value of mw
@@ -102,8 +110,8 @@ struct chan_freq_power *libertas_find_cfp_by_band_and_channel(wlan_adapter * ada
102 } 110 }
103 111
104 if (!cfp && channel) 112 if (!cfp && channel)
105 lbs_pr_debug(1, "libertas_find_cfp_by_band_and_channel(): cannot find " 113 lbs_deb_wext("libertas_find_cfp_by_band_and_channel: can't find "
106 "cfp by band %d & channel %d\n", band, channel); 114 "cfp by band %d / channel %d\n", band, channel);
107 115
108 return cfp; 116 return cfp;
109} 117}
@@ -143,113 +151,12 @@ static struct chan_freq_power *find_cfp_by_band_and_freq(wlan_adapter * adapter,
143 } 151 }
144 152
145 if (!cfp && freq) 153 if (!cfp && freq)
146 lbs_pr_debug(1, "find_cfp_by_band_and_freql(): cannot find cfp by " 154 lbs_deb_wext("find_cfp_by_band_and_freql: can't find cfp by "
147 "band %d & freq %d\n", band, freq); 155 "band %d / freq %d\n", band, freq);
148 156
149 return cfp; 157 return cfp;
150} 158}
151 159
152static int updatecurrentchannel(wlan_private * priv)
153{
154 int ret;
155
156 /*
157 ** the channel in f/w could be out of sync, get the current channel
158 */
159 ret = libertas_prepare_and_send_command(priv, cmd_802_11_rf_channel,
160 cmd_opt_802_11_rf_channel_get,
161 cmd_option_waitforrsp, 0, NULL);
162
163 lbs_pr_debug(1, "Current channel = %d\n",
164 priv->adapter->curbssparams.channel);
165
166 return ret;
167}
168
169static int setcurrentchannel(wlan_private * priv, int channel)
170{
171 lbs_pr_debug(1, "Set channel = %d\n", channel);
172
173 /*
174 ** Current channel is not set to adhocchannel requested, set channel
175 */
176 return (libertas_prepare_and_send_command(priv, cmd_802_11_rf_channel,
177 cmd_opt_802_11_rf_channel_set,
178 cmd_option_waitforrsp, 0, &channel));
179}
180
181static int changeadhocchannel(wlan_private * priv, int channel)
182{
183 int ret = 0;
184 wlan_adapter *adapter = priv->adapter;
185
186 adapter->adhocchannel = channel;
187
188 updatecurrentchannel(priv);
189
190 if (adapter->curbssparams.channel == adapter->adhocchannel) {
191 /* adhocchannel is set to the current channel already */
192 LEAVE();
193 return 0;
194 }
195
196 lbs_pr_debug(1, "Updating channel from %d to %d\n",
197 adapter->curbssparams.channel, adapter->adhocchannel);
198
199 setcurrentchannel(priv, adapter->adhocchannel);
200
201 updatecurrentchannel(priv);
202
203 if (adapter->curbssparams.channel != adapter->adhocchannel) {
204 lbs_pr_debug(1, "failed to updated channel to %d, channel = %d\n",
205 adapter->adhocchannel, adapter->curbssparams.channel);
206 LEAVE();
207 return -1;
208 }
209
210 if (adapter->connect_status == libertas_connected) {
211 int i;
212 struct WLAN_802_11_SSID curadhocssid;
213
214 lbs_pr_debug(1, "channel Changed while in an IBSS\n");
215
216 /* Copy the current ssid */
217 memcpy(&curadhocssid, &adapter->curbssparams.ssid,
218 sizeof(struct WLAN_802_11_SSID));
219
220 /* Exit Adhoc mode */
221 lbs_pr_debug(1, "In changeadhocchannel(): Sending Adhoc Stop\n");
222 ret = libertas_stop_adhoc_network(priv);
223
224 if (ret) {
225 LEAVE();
226 return ret;
227 }
228 /* Scan for the network, do not save previous results. Stale
229 * scan data will cause us to join a non-existant adhoc network
230 */
231 libertas_send_specific_SSID_scan(priv, &curadhocssid, 0);
232
233 // find out the BSSID that matches the current SSID
234 i = libertas_find_SSID_in_list(adapter, &curadhocssid, NULL,
235 IW_MODE_ADHOC);
236
237 if (i >= 0) {
238 lbs_pr_debug(1, "SSID found at %d in List,"
239 "so join\n", i);
240 libertas_join_adhoc_network(priv, &adapter->scantable[i]);
241 } else {
242 // else send START command
243 lbs_pr_debug(1, "SSID not found in list, "
244 "so creating adhoc with ssid = %s\n",
245 curadhocssid.ssid);
246 libertas_start_adhoc_network(priv, &curadhocssid);
247 } // end of else (START command)
248 }
249
250 LEAVE();
251 return 0;
252}
253 160
254/** 161/**
255 * @brief Set Radio On/OFF 162 * @brief Set Radio On/OFF
@@ -263,10 +170,10 @@ int wlan_radio_ioctl(wlan_private * priv, u8 option)
263 int ret = 0; 170 int ret = 0;
264 wlan_adapter *adapter = priv->adapter; 171 wlan_adapter *adapter = priv->adapter;
265 172
266 ENTER(); 173 lbs_deb_enter(LBS_DEB_WEXT);
267 174
268 if (adapter->radioon != option) { 175 if (adapter->radioon != option) {
269 lbs_pr_debug(1, "Switching %s the Radio\n", option ? "On" : "Off"); 176 lbs_deb_wext("switching radio %s\n", option ? "on" : "off");
270 adapter->radioon = option; 177 adapter->radioon = option;
271 178
272 ret = libertas_prepare_and_send_command(priv, 179 ret = libertas_prepare_and_send_command(priv,
@@ -275,7 +182,7 @@ int wlan_radio_ioctl(wlan_private * priv, u8 option)
275 cmd_option_waitforrsp, 0, NULL); 182 cmd_option_waitforrsp, 0, NULL);
276 } 183 }
277 184
278 LEAVE(); 185 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
279 return ret; 186 return ret;
280} 187}
281 188
@@ -312,15 +219,15 @@ static int get_active_data_rates(wlan_adapter * adapter,
312{ 219{
313 int k = 0; 220 int k = 0;
314 221
315 ENTER(); 222 lbs_deb_enter(LBS_DEB_WEXT);
316 223
317 if (adapter->connect_status != libertas_connected) { 224 if (adapter->connect_status != libertas_connected) {
318 if (adapter->mode == IW_MODE_INFRA) { 225 if (adapter->mode == IW_MODE_INFRA) {
319 lbs_pr_debug(1, "Infra\n"); 226 lbs_deb_wext("infra\n");
320 k = copyrates(rates, k, libertas_supported_rates, 227 k = copyrates(rates, k, libertas_supported_rates,
321 sizeof(libertas_supported_rates)); 228 sizeof(libertas_supported_rates));
322 } else { 229 } else {
323 lbs_pr_debug(1, "Adhoc G\n"); 230 lbs_deb_wext("Adhoc G\n");
324 k = copyrates(rates, k, libertas_adhoc_rates_g, 231 k = copyrates(rates, k, libertas_adhoc_rates_g,
325 sizeof(libertas_adhoc_rates_g)); 232 sizeof(libertas_adhoc_rates_g));
326 } 233 }
@@ -329,8 +236,7 @@ static int get_active_data_rates(wlan_adapter * adapter,
329 adapter->curbssparams.numofrates); 236 adapter->curbssparams.numofrates);
330 } 237 }
331 238
332 LEAVE(); 239 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", k);
333
334 return k; 240 return k;
335} 241}
336 242
@@ -342,7 +248,7 @@ static int wlan_get_name(struct net_device *dev, struct iw_request_info *info,
342 char mrvl[6] = { "MRVL-" }; 248 char mrvl[6] = { "MRVL-" };
343 int cnt; 249 int cnt;
344 250
345 ENTER(); 251 lbs_deb_enter(LBS_DEB_WEXT);
346 252
347 strcpy(cwrq, mrvl); 253 strcpy(cwrq, mrvl);
348 254
@@ -360,8 +266,7 @@ static int wlan_get_name(struct net_device *dev, struct iw_request_info *info,
360 } 266 }
361 *cwrq = '\0'; 267 *cwrq = '\0';
362 268
363 LEAVE(); 269 lbs_deb_leave(LBS_DEB_WEXT);
364
365 return 0; 270 return 0;
366} 271}
367 272
@@ -372,14 +277,14 @@ static int wlan_get_freq(struct net_device *dev, struct iw_request_info *info,
372 wlan_adapter *adapter = priv->adapter; 277 wlan_adapter *adapter = priv->adapter;
373 struct chan_freq_power *cfp; 278 struct chan_freq_power *cfp;
374 279
375 ENTER(); 280 lbs_deb_enter(LBS_DEB_WEXT);
376 281
377 cfp = libertas_find_cfp_by_band_and_channel(adapter, 0, 282 cfp = libertas_find_cfp_by_band_and_channel(adapter, 0,
378 adapter->curbssparams.channel); 283 adapter->curbssparams.channel);
379 284
380 if (!cfp) { 285 if (!cfp) {
381 if (adapter->curbssparams.channel) 286 if (adapter->curbssparams.channel)
382 lbs_pr_debug(1, "Invalid channel=%d\n", 287 lbs_deb_wext("invalid channel %d\n",
383 adapter->curbssparams.channel); 288 adapter->curbssparams.channel);
384 return -EINVAL; 289 return -EINVAL;
385 } 290 }
@@ -387,9 +292,8 @@ static int wlan_get_freq(struct net_device *dev, struct iw_request_info *info,
387 fwrq->m = (long)cfp->freq * 100000; 292 fwrq->m = (long)cfp->freq * 100000;
388 fwrq->e = 1; 293 fwrq->e = 1;
389 294
390 lbs_pr_debug(1, "freq=%u\n", fwrq->m); 295 lbs_deb_wext("freq %u\n", fwrq->m);
391 296 lbs_deb_leave(LBS_DEB_WEXT);
392 LEAVE();
393 return 0; 297 return 0;
394} 298}
395 299
@@ -399,7 +303,7 @@ static int wlan_get_wap(struct net_device *dev, struct iw_request_info *info,
399 wlan_private *priv = dev->priv; 303 wlan_private *priv = dev->priv;
400 wlan_adapter *adapter = priv->adapter; 304 wlan_adapter *adapter = priv->adapter;
401 305
402 ENTER(); 306 lbs_deb_enter(LBS_DEB_WEXT);
403 307
404 if (adapter->connect_status == libertas_connected) { 308 if (adapter->connect_status == libertas_connected) {
405 memcpy(awrq->sa_data, adapter->curbssparams.bssid, ETH_ALEN); 309 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,
408 } 312 }
409 awrq->sa_family = ARPHRD_ETHER; 313 awrq->sa_family = ARPHRD_ETHER;
410 314
411 LEAVE(); 315 lbs_deb_leave(LBS_DEB_WEXT);
412 return 0; 316 return 0;
413} 317}
414 318
@@ -418,7 +322,7 @@ static int wlan_set_nick(struct net_device *dev, struct iw_request_info *info,
418 wlan_private *priv = dev->priv; 322 wlan_private *priv = dev->priv;
419 wlan_adapter *adapter = priv->adapter; 323 wlan_adapter *adapter = priv->adapter;
420 324
421 ENTER(); 325 lbs_deb_enter(LBS_DEB_WEXT);
422 326
423 /* 327 /*
424 * Check the size of the string 328 * Check the size of the string
@@ -433,7 +337,7 @@ static int wlan_set_nick(struct net_device *dev, struct iw_request_info *info,
433 memcpy(adapter->nodename, extra, dwrq->length); 337 memcpy(adapter->nodename, extra, dwrq->length);
434 mutex_unlock(&adapter->lock); 338 mutex_unlock(&adapter->lock);
435 339
436 LEAVE(); 340 lbs_deb_leave(LBS_DEB_WEXT);
437 return 0; 341 return 0;
438} 342}
439 343
@@ -443,7 +347,7 @@ static int wlan_get_nick(struct net_device *dev, struct iw_request_info *info,
443 wlan_private *priv = dev->priv; 347 wlan_private *priv = dev->priv;
444 wlan_adapter *adapter = priv->adapter; 348 wlan_adapter *adapter = priv->adapter;
445 349
446 ENTER(); 350 lbs_deb_enter(LBS_DEB_WEXT);
447 351
448 /* 352 /*
449 * Get the Nick Name saved 353 * Get the Nick Name saved
@@ -464,19 +368,43 @@ static int wlan_get_nick(struct net_device *dev, struct iw_request_info *info,
464 */ 368 */
465 dwrq->length = strlen(extra) + 1; 369 dwrq->length = strlen(extra) + 1;
466 370
467 LEAVE(); 371 lbs_deb_leave(LBS_DEB_WEXT);
468 return 0; 372 return 0;
469} 373}
470 374
375static int mesh_get_nick(struct net_device *dev, struct iw_request_info *info,
376 struct iw_point *dwrq, char *extra)
377{
378 wlan_private *priv = dev->priv;
379 wlan_adapter *adapter = priv->adapter;
380
381 lbs_deb_enter(LBS_DEB_WEXT);
382
383 /* Use nickname to indicate that mesh is on */
384
385 if (adapter->connect_status == libertas_connected) {
386 strncpy(extra, "Mesh", 12);
387 extra[12] = '\0';
388 dwrq->length = strlen(extra) + 1;
389 }
390
391 else {
392 extra[0] = '\0';
393 dwrq->length = 1 ;
394 }
395
396 lbs_deb_leave(LBS_DEB_WEXT);
397 return 0;
398}
471static int wlan_set_rts(struct net_device *dev, struct iw_request_info *info, 399static int wlan_set_rts(struct net_device *dev, struct iw_request_info *info,
472 struct iw_param *vwrq, char *extra) 400 struct iw_param *vwrq, char *extra)
473{ 401{
474 int ret = 0; 402 int ret = 0;
475 wlan_private *priv = dev->priv; 403 wlan_private *priv = dev->priv;
476 wlan_adapter *adapter = priv->adapter; 404 wlan_adapter *adapter = priv->adapter;
477 int rthr = vwrq->value; 405 u32 rthr = vwrq->value;
478 406
479 ENTER(); 407 lbs_deb_enter(LBS_DEB_WEXT);
480 408
481 if (vwrq->disabled) { 409 if (vwrq->disabled) {
482 adapter->rtsthsd = rthr = MRVDRV_RTS_MAX_VALUE; 410 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,
490 cmd_act_set, cmd_option_waitforrsp, 418 cmd_act_set, cmd_option_waitforrsp,
491 OID_802_11_RTS_THRESHOLD, &rthr); 419 OID_802_11_RTS_THRESHOLD, &rthr);
492 420
493 LEAVE(); 421 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
494 return ret; 422 return ret;
495} 423}
496 424
@@ -501,35 +429,34 @@ static int wlan_get_rts(struct net_device *dev, struct iw_request_info *info,
501 wlan_private *priv = dev->priv; 429 wlan_private *priv = dev->priv;
502 wlan_adapter *adapter = priv->adapter; 430 wlan_adapter *adapter = priv->adapter;
503 431
504 ENTER(); 432 lbs_deb_enter(LBS_DEB_WEXT);
505 433
506 adapter->rtsthsd = 0; 434 adapter->rtsthsd = 0;
507 ret = libertas_prepare_and_send_command(priv, cmd_802_11_snmp_mib, 435 ret = libertas_prepare_and_send_command(priv, cmd_802_11_snmp_mib,
508 cmd_act_get, cmd_option_waitforrsp, 436 cmd_act_get, cmd_option_waitforrsp,
509 OID_802_11_RTS_THRESHOLD, NULL); 437 OID_802_11_RTS_THRESHOLD, NULL);
510 if (ret) { 438 if (ret)
511 LEAVE(); 439 goto out;
512 return ret;
513 }
514 440
515 vwrq->value = adapter->rtsthsd; 441 vwrq->value = adapter->rtsthsd;
516 vwrq->disabled = ((vwrq->value < MRVDRV_RTS_MIN_VALUE) 442 vwrq->disabled = ((vwrq->value < MRVDRV_RTS_MIN_VALUE)
517 || (vwrq->value > MRVDRV_RTS_MAX_VALUE)); 443 || (vwrq->value > MRVDRV_RTS_MAX_VALUE));
518 vwrq->fixed = 1; 444 vwrq->fixed = 1;
519 445
520 LEAVE(); 446out:
521 return 0; 447 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
448 return ret;
522} 449}
523 450
524static int wlan_set_frag(struct net_device *dev, struct iw_request_info *info, 451static int wlan_set_frag(struct net_device *dev, struct iw_request_info *info,
525 struct iw_param *vwrq, char *extra) 452 struct iw_param *vwrq, char *extra)
526{ 453{
527 int ret = 0; 454 int ret = 0;
528 int fthr = vwrq->value; 455 u32 fthr = vwrq->value;
529 wlan_private *priv = dev->priv; 456 wlan_private *priv = dev->priv;
530 wlan_adapter *adapter = priv->adapter; 457 wlan_adapter *adapter = priv->adapter;
531 458
532 ENTER(); 459 lbs_deb_enter(LBS_DEB_WEXT);
533 460
534 if (vwrq->disabled) { 461 if (vwrq->disabled) {
535 adapter->fragthsd = fthr = MRVDRV_FRAG_MAX_VALUE; 462 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,
543 ret = libertas_prepare_and_send_command(priv, cmd_802_11_snmp_mib, 470 ret = libertas_prepare_and_send_command(priv, cmd_802_11_snmp_mib,
544 cmd_act_set, cmd_option_waitforrsp, 471 cmd_act_set, cmd_option_waitforrsp,
545 OID_802_11_FRAGMENTATION_THRESHOLD, &fthr); 472 OID_802_11_FRAGMENTATION_THRESHOLD, &fthr);
546 LEAVE(); 473
474 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
547 return ret; 475 return ret;
548} 476}
549 477
@@ -554,24 +482,23 @@ static int wlan_get_frag(struct net_device *dev, struct iw_request_info *info,
554 wlan_private *priv = dev->priv; 482 wlan_private *priv = dev->priv;
555 wlan_adapter *adapter = priv->adapter; 483 wlan_adapter *adapter = priv->adapter;
556 484
557 ENTER(); 485 lbs_deb_enter(LBS_DEB_WEXT);
558 486
559 adapter->fragthsd = 0; 487 adapter->fragthsd = 0;
560 ret = libertas_prepare_and_send_command(priv, 488 ret = libertas_prepare_and_send_command(priv,
561 cmd_802_11_snmp_mib, 489 cmd_802_11_snmp_mib,
562 cmd_act_get, cmd_option_waitforrsp, 490 cmd_act_get, cmd_option_waitforrsp,
563 OID_802_11_FRAGMENTATION_THRESHOLD, NULL); 491 OID_802_11_FRAGMENTATION_THRESHOLD, NULL);
564 if (ret) { 492 if (ret)
565 LEAVE(); 493 goto out;
566 return ret;
567 }
568 494
569 vwrq->value = adapter->fragthsd; 495 vwrq->value = adapter->fragthsd;
570 vwrq->disabled = ((vwrq->value < MRVDRV_FRAG_MIN_VALUE) 496 vwrq->disabled = ((vwrq->value < MRVDRV_FRAG_MIN_VALUE)
571 || (vwrq->value > MRVDRV_FRAG_MAX_VALUE)); 497 || (vwrq->value > MRVDRV_FRAG_MAX_VALUE));
572 vwrq->fixed = 1; 498 vwrq->fixed = 1;
573 499
574 LEAVE(); 500out:
501 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
575 return ret; 502 return ret;
576} 503}
577 504
@@ -581,11 +508,23 @@ static int wlan_get_mode(struct net_device *dev,
581 wlan_private *priv = dev->priv; 508 wlan_private *priv = dev->priv;
582 wlan_adapter *adapter = priv->adapter; 509 wlan_adapter *adapter = priv->adapter;
583 510
584 ENTER(); 511 lbs_deb_enter(LBS_DEB_WEXT);
585 512
586 *uwrq = adapter->mode; 513 *uwrq = adapter->mode;
587 514
588 LEAVE(); 515 lbs_deb_leave(LBS_DEB_WEXT);
516 return 0;
517}
518
519static int mesh_wlan_get_mode(struct net_device *dev,
520 struct iw_request_info *info, u32 * uwrq,
521 char *extra)
522{
523 lbs_deb_enter(LBS_DEB_WEXT);
524
525 *uwrq = IW_MODE_REPEAT ;
526
527 lbs_deb_leave(LBS_DEB_WEXT);
589 return 0; 528 return 0;
590} 529}
591 530
@@ -597,19 +536,17 @@ static int wlan_get_txpow(struct net_device *dev,
597 wlan_private *priv = dev->priv; 536 wlan_private *priv = dev->priv;
598 wlan_adapter *adapter = priv->adapter; 537 wlan_adapter *adapter = priv->adapter;
599 538
600 ENTER(); 539 lbs_deb_enter(LBS_DEB_WEXT);
601 540
602 ret = libertas_prepare_and_send_command(priv, 541 ret = libertas_prepare_and_send_command(priv,
603 cmd_802_11_rf_tx_power, 542 cmd_802_11_rf_tx_power,
604 cmd_act_tx_power_opt_get, 543 cmd_act_tx_power_opt_get,
605 cmd_option_waitforrsp, 0, NULL); 544 cmd_option_waitforrsp, 0, NULL);
606 545
607 if (ret) { 546 if (ret)
608 LEAVE(); 547 goto out;
609 return ret;
610 }
611 548
612 lbs_pr_debug(1, "TXPOWER GET %d dbm.\n", adapter->txpowerlevel); 549 lbs_deb_wext("tx power level %d dbm\n", adapter->txpowerlevel);
613 vwrq->value = adapter->txpowerlevel; 550 vwrq->value = adapter->txpowerlevel;
614 vwrq->fixed = 1; 551 vwrq->fixed = 1;
615 if (adapter->radioon) { 552 if (adapter->radioon) {
@@ -619,8 +556,9 @@ static int wlan_get_txpow(struct net_device *dev,
619 vwrq->disabled = 1; 556 vwrq->disabled = 1;
620 } 557 }
621 558
622 LEAVE(); 559out:
623 return 0; 560 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
561 return ret;
624} 562}
625 563
626static int wlan_set_retry(struct net_device *dev, struct iw_request_info *info, 564static 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,
630 wlan_private *priv = dev->priv; 568 wlan_private *priv = dev->priv;
631 wlan_adapter *adapter = priv->adapter; 569 wlan_adapter *adapter = priv->adapter;
632 570
633 ENTER(); 571 lbs_deb_enter(LBS_DEB_WEXT);
634 572
635 if (vwrq->flags == IW_RETRY_LIMIT) { 573 if (vwrq->flags == IW_RETRY_LIMIT) {
636 /* The MAC has a 4-bit Total_Tx_Count register 574 /* 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,
648 cmd_option_waitforrsp, 586 cmd_option_waitforrsp,
649 OID_802_11_TX_RETRYCOUNT, NULL); 587 OID_802_11_TX_RETRYCOUNT, NULL);
650 588
651 if (ret) { 589 if (ret)
652 LEAVE(); 590 goto out;
653 return ret;
654 }
655 } else { 591 } else {
656 return -EOPNOTSUPP; 592 return -EOPNOTSUPP;
657 } 593 }
658 594
659 LEAVE(); 595out:
660 return 0; 596 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
597 return ret;
661} 598}
662 599
663static int wlan_get_retry(struct net_device *dev, struct iw_request_info *info, 600static 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,
667 wlan_adapter *adapter = priv->adapter; 604 wlan_adapter *adapter = priv->adapter;
668 int ret = 0; 605 int ret = 0;
669 606
670 ENTER(); 607 lbs_deb_enter(LBS_DEB_WEXT);
608
671 adapter->txretrycount = 0; 609 adapter->txretrycount = 0;
672 ret = libertas_prepare_and_send_command(priv, 610 ret = libertas_prepare_and_send_command(priv,
673 cmd_802_11_snmp_mib, 611 cmd_802_11_snmp_mib,
674 cmd_act_get, cmd_option_waitforrsp, 612 cmd_act_get, cmd_option_waitforrsp,
675 OID_802_11_TX_RETRYCOUNT, NULL); 613 OID_802_11_TX_RETRYCOUNT, NULL);
676 if (ret) { 614 if (ret)
677 LEAVE(); 615 goto out;
678 return ret; 616
679 }
680 vwrq->disabled = 0; 617 vwrq->disabled = 0;
681 if (!vwrq->flags) { 618 if (!vwrq->flags) {
682 vwrq->flags = IW_RETRY_LIMIT; 619 vwrq->flags = IW_RETRY_LIMIT;
@@ -684,8 +621,9 @@ static int wlan_get_retry(struct net_device *dev, struct iw_request_info *info,
684 vwrq->value = adapter->txretrycount - 1; 621 vwrq->value = adapter->txretrycount - 1;
685 } 622 }
686 623
687 LEAVE(); 624out:
688 return 0; 625 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
626 return ret;
689} 627}
690 628
691static inline void sort_channels(struct iw_freq *freq, int num) 629static 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,
739 677
740 u8 flag = 0; 678 u8 flag = 0;
741 679
742 ENTER(); 680 lbs_deb_enter(LBS_DEB_WEXT);
743 681
744 dwrq->length = sizeof(struct iw_range); 682 dwrq->length = sizeof(struct iw_range);
745 memset(range, 0, sizeof(struct iw_range)); 683 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,
755 range->bitrate[i] = (rates[i] & 0x7f) * 500000; 693 range->bitrate[i] = (rates[i] & 0x7f) * 500000;
756 } 694 }
757 range->num_bitrates = i; 695 range->num_bitrates = i;
758 lbs_pr_debug(1, "IW_MAX_BITRATES=%d num_bitrates=%d\n", IW_MAX_BITRATES, 696 lbs_deb_wext("IW_MAX_BITRATES %d, num_bitrates %d\n", IW_MAX_BITRATES,
759 range->num_bitrates); 697 range->num_bitrates);
760 698
761 range->num_frequency = 0; 699 range->num_frequency = 0;
@@ -768,18 +706,17 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info,
768 &adapter->parsed_region_chan; 706 &adapter->parsed_region_chan;
769 707
770 if (parsed_region_chan == NULL) { 708 if (parsed_region_chan == NULL) {
771 lbs_pr_debug(1, "11D:parsed_region_chan is NULL\n"); 709 lbs_deb_wext("11d: parsed_region_chan is NULL\n");
772 LEAVE(); 710 goto out;
773 return 0;
774 } 711 }
775 band = parsed_region_chan->band; 712 band = parsed_region_chan->band;
776 lbs_pr_debug(1, "band=%d NoOfChan=%d\n", band, 713 lbs_deb_wext("band %d, nr_char %d\n", band,
777 parsed_region_chan->nr_chan); 714 parsed_region_chan->nr_chan);
778 715
779 for (i = 0; (range->num_frequency < IW_MAX_FREQUENCIES) 716 for (i = 0; (range->num_frequency < IW_MAX_FREQUENCIES)
780 && (i < parsed_region_chan->nr_chan); i++) { 717 && (i < parsed_region_chan->nr_chan); i++) {
781 chan_no = parsed_region_chan->chanpwr[i].chan; 718 chan_no = parsed_region_chan->chanpwr[i].chan;
782 lbs_pr_debug(1, "chan_no=%d\n", chan_no); 719 lbs_deb_wext("chan_no %d\n", chan_no);
783 range->freq[range->num_frequency].i = (long)chan_no; 720 range->freq[range->num_frequency].i = (long)chan_no;
784 range->freq[range->num_frequency].m = 721 range->freq[range->num_frequency].m =
785 (long)libertas_chan_2_freq(chan_no, band) * 100000; 722 (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,
808 } 745 }
809 } 746 }
810 747
811 lbs_pr_debug(1, "IW_MAX_FREQUENCIES=%d num_frequency=%d\n", 748 lbs_deb_wext("IW_MAX_FREQUENCIES %d, num_frequency %d\n",
812 IW_MAX_FREQUENCIES, range->num_frequency); 749 IW_MAX_FREQUENCIES, range->num_frequency);
813 750
814 range->num_channels = range->num_frequency; 751 range->num_channels = range->num_frequency;
@@ -903,7 +840,8 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info,
903 | IW_ENC_CAPA_CIPHER_CCMP; 840 | IW_ENC_CAPA_CIPHER_CCMP;
904 } 841 }
905 842
906 LEAVE(); 843out:
844 lbs_deb_leave(LBS_DEB_WEXT);
907 return 0; 845 return 0;
908} 846}
909 847
@@ -913,7 +851,7 @@ static int wlan_set_power(struct net_device *dev, struct iw_request_info *info,
913 wlan_private *priv = dev->priv; 851 wlan_private *priv = dev->priv;
914 wlan_adapter *adapter = priv->adapter; 852 wlan_adapter *adapter = priv->adapter;
915 853
916 ENTER(); 854 lbs_deb_enter(LBS_DEB_WEXT);
917 855
918 /* PS is currently supported only in Infrastructure mode 856 /* PS is currently supported only in Infrastructure mode
919 * Remove this check if it is to be supported in IBSS mode also 857 * 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,
929 } 867 }
930 868
931 if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { 869 if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) {
932 lbs_pr_debug(1, 870 lbs_deb_wext(
933 "Setting power timeout command is not supported\n"); 871 "setting power timeout is not supported\n");
934 return -EINVAL; 872 return -EINVAL;
935 } else if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_PERIOD) { 873 } else if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_PERIOD) {
936 lbs_pr_debug(1, "Setting power period command is not supported\n"); 874 lbs_deb_wext("setting power period not supported\n");
937 return -EINVAL; 875 return -EINVAL;
938 } 876 }
939 877
@@ -947,7 +885,7 @@ static int wlan_set_power(struct net_device *dev, struct iw_request_info *info,
947 libertas_ps_sleep(priv, cmd_option_waitforrsp); 885 libertas_ps_sleep(priv, cmd_option_waitforrsp);
948 } 886 }
949 887
950 LEAVE(); 888 lbs_deb_leave(LBS_DEB_WEXT);
951 return 0; 889 return 0;
952} 890}
953 891
@@ -958,19 +896,20 @@ static int wlan_get_power(struct net_device *dev, struct iw_request_info *info,
958 wlan_adapter *adapter = priv->adapter; 896 wlan_adapter *adapter = priv->adapter;
959 int mode; 897 int mode;
960 898
961 ENTER(); 899 lbs_deb_enter(LBS_DEB_WEXT);
962 900
963 mode = adapter->psmode; 901 mode = adapter->psmode;
964 902
965 if ((vwrq->disabled = (mode == wlan802_11powermodecam)) 903 if ((vwrq->disabled = (mode == wlan802_11powermodecam))
966 || adapter->connect_status == libertas_disconnected) { 904 || adapter->connect_status == libertas_disconnected)
967 LEAVE(); 905 {
968 return 0; 906 goto out;
969 } 907 }
970 908
971 vwrq->value = 0; 909 vwrq->value = 0;
972 910
973 LEAVE(); 911out:
912 lbs_deb_leave(LBS_DEB_WEXT);
974 return 0; 913 return 0;
975} 914}
976 915
@@ -1063,6 +1002,16 @@ static const struct iw_priv_args wlan_private_args[] = {
1063 IW_PRIV_TYPE_CHAR | 128, 1002 IW_PRIV_TYPE_CHAR | 128,
1064 IW_PRIV_TYPE_CHAR | 128, 1003 IW_PRIV_TYPE_CHAR | 128,
1065 "bt_list"}, 1004 "bt_list"},
1005 {
1006 WLAN_SUBCMD_BT_SET_INVERT,
1007 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1008 IW_PRIV_TYPE_NONE,
1009 "bt_set_invert"},
1010 {
1011 WLAN_SUBCMD_BT_GET_INVERT,
1012 IW_PRIV_TYPE_NONE,
1013 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1014 "bt_get_invert"},
1066 /* FWT Management */ 1015 /* FWT Management */
1067 { 1016 {
1068 WLAN_SUBCMD_FWT_ADD, 1017 WLAN_SUBCMD_FWT_ADD,
@@ -1125,7 +1074,7 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev)
1125 u8 rssi; 1074 u8 rssi;
1126 u32 tx_retries; 1075 u32 tx_retries;
1127 1076
1128 ENTER(); 1077 lbs_deb_enter(LBS_DEB_WEXT);
1129 1078
1130 priv->wstats.status = adapter->mode; 1079 priv->wstats.status = adapter->mode;
1131 1080
@@ -1145,8 +1094,8 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev)
1145 CAL_NF(adapter->NF[TYPE_BEACON][TYPE_NOAVG]); 1094 CAL_NF(adapter->NF[TYPE_BEACON][TYPE_NOAVG]);
1146 } 1095 }
1147 1096
1148 lbs_pr_debug(1, "Signal Level = %#x\n", priv->wstats.qual.level); 1097 lbs_deb_wext("signal level %#x\n", priv->wstats.qual.level);
1149 lbs_pr_debug(1, "Noise = %#x\n", priv->wstats.qual.noise); 1098 lbs_deb_wext("noise %#x\n", priv->wstats.qual.noise);
1150 1099
1151 rssi = priv->wstats.qual.level - priv->wstats.qual.noise; 1100 rssi = priv->wstats.qual.level - priv->wstats.qual.noise;
1152 if (rssi < 15) 1101 if (rssi < 15)
@@ -1166,7 +1115,7 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev)
1166 /* Quality by TX errors */ 1115 /* Quality by TX errors */
1167 priv->wstats.discard.retries = priv->stats.tx_errors; 1116 priv->wstats.discard.retries = priv->stats.tx_errors;
1168 1117
1169 tx_retries = adapter->logmsg.retry; 1118 tx_retries = le16_to_cpu(adapter->logmsg.retry);
1170 1119
1171 if (tx_retries > 75) 1120 if (tx_retries > 75)
1172 tx_qual = (90 - tx_retries) * POOR / 15; 1121 tx_qual = (90 - tx_retries) * POOR / 15;
@@ -1182,10 +1131,10 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev)
1182 (PERFECT - VERY_GOOD) / 50 + VERY_GOOD; 1131 (PERFECT - VERY_GOOD) / 50 + VERY_GOOD;
1183 quality = min(quality, tx_qual); 1132 quality = min(quality, tx_qual);
1184 1133
1185 priv->wstats.discard.code = adapter->logmsg.wepundecryptable; 1134 priv->wstats.discard.code = le16_to_cpu(adapter->logmsg.wepundecryptable);
1186 priv->wstats.discard.fragment = adapter->logmsg.fcserror; 1135 priv->wstats.discard.fragment = le16_to_cpu(adapter->logmsg.rxfrag);
1187 priv->wstats.discard.retries = tx_retries; 1136 priv->wstats.discard.retries = tx_retries;
1188 priv->wstats.discard.misc = adapter->logmsg.ackfailure; 1137 priv->wstats.discard.misc = le16_to_cpu(adapter->logmsg.ackfailure);
1189 1138
1190 /* Calculate quality */ 1139 /* Calculate quality */
1191 priv->wstats.qual.qual = max(quality, (u32)100); 1140 priv->wstats.qual.qual = max(quality, (u32)100);
@@ -1209,7 +1158,7 @@ out:
1209 IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID; 1158 IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID;
1210 } 1159 }
1211 1160
1212 LEAVE (); 1161 lbs_deb_leave(LBS_DEB_WEXT);
1213 return &priv->wstats; 1162 return &priv->wstats;
1214 1163
1215 1164
@@ -1218,81 +1167,59 @@ out:
1218static int wlan_set_freq(struct net_device *dev, struct iw_request_info *info, 1167static int wlan_set_freq(struct net_device *dev, struct iw_request_info *info,
1219 struct iw_freq *fwrq, char *extra) 1168 struct iw_freq *fwrq, char *extra)
1220{ 1169{
1221 int ret = 0; 1170 int ret = -EINVAL;
1222 wlan_private *priv = dev->priv; 1171 wlan_private *priv = dev->priv;
1223 wlan_adapter *adapter = priv->adapter; 1172 wlan_adapter *adapter = priv->adapter;
1224 int rc = -EINPROGRESS; /* Call commit handler */
1225 struct chan_freq_power *cfp; 1173 struct chan_freq_power *cfp;
1174 struct assoc_request * assoc_req;
1226 1175
1227 ENTER(); 1176 lbs_deb_enter(LBS_DEB_WEXT);
1228 1177
1229 /* 1178 mutex_lock(&adapter->lock);
1230 * If setting by frequency, convert to a channel 1179 assoc_req = wlan_get_association_request(adapter);
1231 */ 1180 if (!assoc_req) {
1232 if (fwrq->e == 1) { 1181 ret = -ENOMEM;
1182 goto out;
1183 }
1233 1184
1185 /* If setting by frequency, convert to a channel */
1186 if (fwrq->e == 1) {
1234 long f = fwrq->m / 100000; 1187 long f = fwrq->m / 100000;
1235 int c = 0;
1236 1188
1237 cfp = find_cfp_by_band_and_freq(adapter, 0, f); 1189 cfp = find_cfp_by_band_and_freq(adapter, 0, f);
1238 if (!cfp) { 1190 if (!cfp) {
1239 lbs_pr_debug(1, "Invalid freq=%ld\n", f); 1191 lbs_deb_wext("invalid freq %ld\n", f);
1240 return -EINVAL; 1192 goto out;
1241 } 1193 }
1242 1194
1243 c = (int)cfp->channel;
1244
1245 if (c < 0)
1246 return -EINVAL;
1247
1248 fwrq->e = 0; 1195 fwrq->e = 0;
1249 fwrq->m = c; 1196 fwrq->m = (int) cfp->channel;
1250 } 1197 }
1251 1198
1252 /* 1199 /* Setting by channel number */
1253 * Setting by channel number
1254 */
1255 if (fwrq->m > 1000 || fwrq->e > 0) { 1200 if (fwrq->m > 1000 || fwrq->e > 0) {
1256 rc = -EOPNOTSUPP; 1201 goto out;
1257 } else { 1202 }
1258 int channel = fwrq->m;
1259 1203
1260 cfp = libertas_find_cfp_by_band_and_channel(adapter, 0, channel); 1204 cfp = libertas_find_cfp_by_band_and_channel(adapter, 0, fwrq->m);
1261 if (!cfp) { 1205 if (!cfp) {
1262 rc = -EINVAL; 1206 goto out;
1263 } else { 1207 }
1264 if (adapter->mode == IW_MODE_ADHOC) { 1208
1265 rc = changeadhocchannel(priv, channel); 1209 assoc_req->channel = fwrq->m;
1266 /* If station is WEP enabled, send the 1210 ret = 0;
1267 * command to set WEP in firmware 1211
1268 */ 1212out:
1269 if (adapter->secinfo.wep_enabled) { 1213 if (ret == 0) {
1270 lbs_pr_debug(1, "set_freq: WEP enabled\n"); 1214 set_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags);
1271 ret = libertas_prepare_and_send_command(priv, 1215 wlan_postpone_association_work(priv);
1272 cmd_802_11_set_wep, 1216 } else {
1273 cmd_act_add, 1217 wlan_cancel_association_work(priv);
1274 cmd_option_waitforrsp,
1275 0,
1276 NULL);
1277
1278 if (ret) {
1279 LEAVE();
1280 return ret;
1281 }
1282
1283 adapter->currentpacketfilter |=
1284 cmd_act_mac_wep_enable;
1285
1286 libertas_set_mac_packet_filter(priv);
1287 }
1288 } else {
1289 rc = -EOPNOTSUPP;
1290 }
1291 }
1292 } 1218 }
1219 mutex_unlock(&adapter->lock);
1293 1220
1294 LEAVE(); 1221 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
1295 return rc; 1222 return ret;
1296} 1223}
1297 1224
1298/** 1225/**
@@ -1338,9 +1265,9 @@ static int wlan_set_rate(struct net_device *dev, struct iw_request_info *info,
1338 u8 rates[WLAN_SUPPORTED_RATES]; 1265 u8 rates[WLAN_SUPPORTED_RATES];
1339 u8 *rate; 1266 u8 *rate;
1340 1267
1341 ENTER(); 1268 lbs_deb_enter(LBS_DEB_WEXT);
1342 1269
1343 lbs_pr_debug(1, "Vwrq->value = %d\n", vwrq->value); 1270 lbs_deb_wext("vwrq->value %d\n", vwrq->value);
1344 1271
1345 if (vwrq->value == -1) { 1272 if (vwrq->value == -1) {
1346 action = cmd_act_set_tx_auto; // Auto 1273 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,
1357 get_active_data_rates(adapter, rates); 1284 get_active_data_rates(adapter, rates);
1358 rate = rates; 1285 rate = rates;
1359 while (*rate) { 1286 while (*rate) {
1360 lbs_pr_debug(1, "Rate=0x%X Wanted=0x%X\n", *rate, 1287 lbs_deb_wext("rate=0x%X, wanted data_rate 0x%X\n", *rate,
1361 data_rate); 1288 data_rate);
1362 if ((*rate & 0x7f) == (data_rate & 0x7f)) 1289 if ((*rate & 0x7f) == (data_rate & 0x7f))
1363 break; 1290 break;
1364 rate++; 1291 rate++;
1365 } 1292 }
1366 if (!*rate) { 1293 if (!*rate) {
1367 lbs_pr_alert( "The fixed data rate 0x%X is out " 1294 lbs_pr_alert("fixed data rate 0x%X out "
1368 "of range.\n", data_rate); 1295 "of range\n", data_rate);
1369 return -EINVAL; 1296 return -EINVAL;
1370 } 1297 }
1371 1298
@@ -1377,7 +1304,7 @@ static int wlan_set_rate(struct net_device *dev, struct iw_request_info *info,
1377 ret = libertas_prepare_and_send_command(priv, cmd_802_11_data_rate, 1304 ret = libertas_prepare_and_send_command(priv, cmd_802_11_data_rate,
1378 action, cmd_option_waitforrsp, 0, NULL); 1305 action, cmd_option_waitforrsp, 0, NULL);
1379 1306
1380 LEAVE(); 1307 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
1381 return ret; 1308 return ret;
1382} 1309}
1383 1310
@@ -1387,7 +1314,7 @@ static int wlan_get_rate(struct net_device *dev, struct iw_request_info *info,
1387 wlan_private *priv = dev->priv; 1314 wlan_private *priv = dev->priv;
1388 wlan_adapter *adapter = priv->adapter; 1315 wlan_adapter *adapter = priv->adapter;
1389 1316
1390 ENTER(); 1317 lbs_deb_enter(LBS_DEB_WEXT);
1391 1318
1392 if (adapter->is_datarate_auto) { 1319 if (adapter->is_datarate_auto) {
1393 vwrq->fixed = 0; 1320 vwrq->fixed = 0;
@@ -1397,7 +1324,7 @@ static int wlan_get_rate(struct net_device *dev, struct iw_request_info *info,
1397 1324
1398 vwrq->value = adapter->datarate * 500000; 1325 vwrq->value = adapter->datarate * 500000;
1399 1326
1400 LEAVE(); 1327 lbs_deb_leave(LBS_DEB_WEXT);
1401 return 0; 1328 return 0;
1402} 1329}
1403 1330
@@ -1409,12 +1336,12 @@ static int wlan_set_mode(struct net_device *dev,
1409 wlan_adapter *adapter = priv->adapter; 1336 wlan_adapter *adapter = priv->adapter;
1410 struct assoc_request * assoc_req; 1337 struct assoc_request * assoc_req;
1411 1338
1412 ENTER(); 1339 lbs_deb_enter(LBS_DEB_WEXT);
1413 1340
1414 if ( (*uwrq != IW_MODE_ADHOC) 1341 if ( (*uwrq != IW_MODE_ADHOC)
1415 && (*uwrq != IW_MODE_INFRA) 1342 && (*uwrq != IW_MODE_INFRA)
1416 && (*uwrq != IW_MODE_AUTO)) { 1343 && (*uwrq != IW_MODE_AUTO)) {
1417 lbs_pr_debug(1, "Invalid mode: 0x%x\n", *uwrq); 1344 lbs_deb_wext("Invalid mode: 0x%x\n", *uwrq);
1418 ret = -EINVAL; 1345 ret = -EINVAL;
1419 goto out; 1346 goto out;
1420 } 1347 }
@@ -1428,12 +1355,12 @@ static int wlan_set_mode(struct net_device *dev,
1428 assoc_req->mode = *uwrq; 1355 assoc_req->mode = *uwrq;
1429 set_bit(ASSOC_FLAG_MODE, &assoc_req->flags); 1356 set_bit(ASSOC_FLAG_MODE, &assoc_req->flags);
1430 wlan_postpone_association_work(priv); 1357 wlan_postpone_association_work(priv);
1431 lbs_pr_debug(1, "Switching to mode: 0x%x\n", *uwrq); 1358 lbs_deb_wext("Switching to mode: 0x%x\n", *uwrq);
1432 } 1359 }
1433 mutex_unlock(&adapter->lock); 1360 mutex_unlock(&adapter->lock);
1434 1361
1435out: 1362out:
1436 LEAVE(); 1363 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
1437 return ret; 1364 return ret;
1438} 1365}
1439 1366
@@ -1455,9 +1382,9 @@ static int wlan_get_encode(struct net_device *dev,
1455 wlan_adapter *adapter = priv->adapter; 1382 wlan_adapter *adapter = priv->adapter;
1456 int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; 1383 int index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
1457 1384
1458 ENTER(); 1385 lbs_deb_enter(LBS_DEB_WEXT);
1459 1386
1460 lbs_pr_debug(1, "flags=0x%x index=%d length=%d wep_tx_keyidx=%d\n", 1387 lbs_deb_wext("flags 0x%x, index %d, length %d, wep_tx_keyidx %d\n",
1461 dwrq->flags, index, dwrq->length, adapter->wep_tx_keyidx); 1388 dwrq->flags, index, dwrq->length, adapter->wep_tx_keyidx);
1462 1389
1463 dwrq->flags = 0; 1390 dwrq->flags = 0;
@@ -1513,13 +1440,13 @@ static int wlan_get_encode(struct net_device *dev,
1513 1440
1514 dwrq->flags |= IW_ENCODE_NOKEY; 1441 dwrq->flags |= IW_ENCODE_NOKEY;
1515 1442
1516 lbs_pr_debug(1, "key:%02x:%02x:%02x:%02x:%02x:%02x keylen=%d\n", 1443 lbs_deb_wext("key: " MAC_FMT ", keylen %d\n",
1517 extra[0], extra[1], extra[2], 1444 extra[0], extra[1], extra[2],
1518 extra[3], extra[4], extra[5], dwrq->length); 1445 extra[3], extra[4], extra[5], dwrq->length);
1519 1446
1520 lbs_pr_debug(1, "Return flags=0x%x\n", dwrq->flags); 1447 lbs_deb_wext("return flags 0x%x\n", dwrq->flags);
1521 1448
1522 LEAVE(); 1449 lbs_deb_leave(LBS_DEB_WEXT);
1523 return 0; 1450 return 0;
1524} 1451}
1525 1452
@@ -1539,20 +1466,21 @@ static int wlan_set_wep_key(struct assoc_request *assoc_req,
1539 u16 index, 1466 u16 index,
1540 int set_tx_key) 1467 int set_tx_key)
1541{ 1468{
1469 int ret = 0;
1542 struct WLAN_802_11_KEY *pkey; 1470 struct WLAN_802_11_KEY *pkey;
1543 1471
1544 ENTER(); 1472 lbs_deb_enter(LBS_DEB_WEXT);
1545 1473
1546 /* Paranoid validation of key index */ 1474 /* Paranoid validation of key index */
1547 if (index > 3) { 1475 if (index > 3) {
1548 LEAVE(); 1476 ret = -EINVAL;
1549 return -EINVAL; 1477 goto out;
1550 } 1478 }
1551 1479
1552 /* validate max key length */ 1480 /* validate max key length */
1553 if (key_length > KEY_LEN_WEP_104) { 1481 if (key_length > KEY_LEN_WEP_104) {
1554 LEAVE(); 1482 ret = -EINVAL;
1555 return -EINVAL; 1483 goto out;
1556 } 1484 }
1557 1485
1558 pkey = &assoc_req->wep_keys[index]; 1486 pkey = &assoc_req->wep_keys[index];
@@ -1570,17 +1498,18 @@ static int wlan_set_wep_key(struct assoc_request *assoc_req,
1570 if (set_tx_key) { 1498 if (set_tx_key) {
1571 /* Ensure the chosen key is valid */ 1499 /* Ensure the chosen key is valid */
1572 if (!pkey->len) { 1500 if (!pkey->len) {
1573 lbs_pr_debug(1, "key not set, so cannot enable it\n"); 1501 lbs_deb_wext("key not set, so cannot enable it\n");
1574 LEAVE(); 1502 ret = -EINVAL;
1575 return -EINVAL; 1503 goto out;
1576 } 1504 }
1577 assoc_req->wep_tx_keyidx = index; 1505 assoc_req->wep_tx_keyidx = index;
1578 } 1506 }
1579 1507
1580 assoc_req->secinfo.wep_enabled = 1; 1508 assoc_req->secinfo.wep_enabled = 1;
1581 1509
1582 LEAVE(); 1510out:
1583 return 0; 1511 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
1512 return ret;
1584} 1513}
1585 1514
1586static int validate_key_index(u16 def_index, u16 raw_index, 1515static int validate_key_index(u16 def_index, u16 raw_index,
@@ -1605,6 +1534,8 @@ static void disable_wep(struct assoc_request *assoc_req)
1605{ 1534{
1606 int i; 1535 int i;
1607 1536
1537 lbs_deb_enter(LBS_DEB_WEXT);
1538
1608 /* Set Open System auth mode */ 1539 /* Set Open System auth mode */
1609 assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; 1540 assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
1610 1541
@@ -1615,6 +1546,27 @@ static void disable_wep(struct assoc_request *assoc_req)
1615 1546
1616 set_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags); 1547 set_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags);
1617 set_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags); 1548 set_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags);
1549
1550 lbs_deb_leave(LBS_DEB_WEXT);
1551}
1552
1553static void disable_wpa(struct assoc_request *assoc_req)
1554{
1555 lbs_deb_enter(LBS_DEB_WEXT);
1556
1557 memset(&assoc_req->wpa_mcast_key, 0, sizeof (struct WLAN_802_11_KEY));
1558 assoc_req->wpa_mcast_key.flags = KEY_INFO_WPA_MCAST;
1559 set_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags);
1560
1561 memset(&assoc_req->wpa_unicast_key, 0, sizeof (struct WLAN_802_11_KEY));
1562 assoc_req->wpa_unicast_key.flags = KEY_INFO_WPA_UNICAST;
1563 set_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags);
1564
1565 assoc_req->secinfo.WPAenabled = 0;
1566 assoc_req->secinfo.WPA2enabled = 0;
1567 set_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags);
1568
1569 lbs_deb_leave(LBS_DEB_WEXT);
1618} 1570}
1619 1571
1620/** 1572/**
@@ -1636,7 +1588,7 @@ static int wlan_set_encode(struct net_device *dev,
1636 struct assoc_request * assoc_req; 1588 struct assoc_request * assoc_req;
1637 u16 is_default = 0, index = 0, set_tx_key = 0; 1589 u16 is_default = 0, index = 0, set_tx_key = 0;
1638 1590
1639 ENTER(); 1591 lbs_deb_enter(LBS_DEB_WEXT);
1640 1592
1641 mutex_lock(&adapter->lock); 1593 mutex_lock(&adapter->lock);
1642 assoc_req = wlan_get_association_request(adapter); 1594 assoc_req = wlan_get_association_request(adapter);
@@ -1647,6 +1599,7 @@ static int wlan_set_encode(struct net_device *dev,
1647 1599
1648 if (dwrq->flags & IW_ENCODE_DISABLED) { 1600 if (dwrq->flags & IW_ENCODE_DISABLED) {
1649 disable_wep (assoc_req); 1601 disable_wep (assoc_req);
1602 disable_wpa (assoc_req);
1650 goto out; 1603 goto out;
1651 } 1604 }
1652 1605
@@ -1688,7 +1641,7 @@ out:
1688 } 1641 }
1689 mutex_unlock(&adapter->lock); 1642 mutex_unlock(&adapter->lock);
1690 1643
1691 LEAVE(); 1644 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
1692 return ret; 1645 return ret;
1693} 1646}
1694 1647
@@ -1712,7 +1665,7 @@ static int wlan_get_encodeext(struct net_device *dev,
1712 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; 1665 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
1713 int index, max_key_len; 1666 int index, max_key_len;
1714 1667
1715 ENTER(); 1668 lbs_deb_enter(LBS_DEB_WEXT);
1716 1669
1717 max_key_len = dwrq->length - sizeof(*ext); 1670 max_key_len = dwrq->length - sizeof(*ext);
1718 if (max_key_len < 0) 1671 if (max_key_len < 0)
@@ -1748,6 +1701,7 @@ static int wlan_get_encodeext(struct net_device *dev,
1748 if ( adapter->secinfo.wep_enabled 1701 if ( adapter->secinfo.wep_enabled
1749 && !adapter->secinfo.WPAenabled 1702 && !adapter->secinfo.WPAenabled
1750 && !adapter->secinfo.WPA2enabled) { 1703 && !adapter->secinfo.WPA2enabled) {
1704 /* WEP */
1751 ext->alg = IW_ENCODE_ALG_WEP; 1705 ext->alg = IW_ENCODE_ALG_WEP;
1752 ext->key_len = adapter->wep_keys[index].len; 1706 ext->key_len = adapter->wep_keys[index].len;
1753 key = &adapter->wep_keys[index].key[0]; 1707 key = &adapter->wep_keys[index].key[0];
@@ -1755,8 +1709,27 @@ static int wlan_get_encodeext(struct net_device *dev,
1755 && (adapter->secinfo.WPAenabled || 1709 && (adapter->secinfo.WPAenabled ||
1756 adapter->secinfo.WPA2enabled)) { 1710 adapter->secinfo.WPA2enabled)) {
1757 /* WPA */ 1711 /* WPA */
1758 ext->alg = IW_ENCODE_ALG_TKIP; 1712 struct WLAN_802_11_KEY * pkey = NULL;
1759 ext->key_len = 0; 1713
1714 if ( adapter->wpa_mcast_key.len
1715 && (adapter->wpa_mcast_key.flags & KEY_INFO_WPA_ENABLED))
1716 pkey = &adapter->wpa_mcast_key;
1717 else if ( adapter->wpa_unicast_key.len
1718 && (adapter->wpa_unicast_key.flags & KEY_INFO_WPA_ENABLED))
1719 pkey = &adapter->wpa_unicast_key;
1720
1721 if (pkey) {
1722 if (pkey->type == KEY_TYPE_ID_AES) {
1723 ext->alg = IW_ENCODE_ALG_CCMP;
1724 } else {
1725 ext->alg = IW_ENCODE_ALG_TKIP;
1726 }
1727 ext->key_len = pkey->len;
1728 key = &pkey->key[0];
1729 } else {
1730 ext->alg = IW_ENCODE_ALG_TKIP;
1731 ext->key_len = 0;
1732 }
1760 } else { 1733 } else {
1761 goto out; 1734 goto out;
1762 } 1735 }
@@ -1775,7 +1748,7 @@ static int wlan_get_encodeext(struct net_device *dev,
1775 ret = 0; 1748 ret = 0;
1776 1749
1777out: 1750out:
1778 LEAVE(); 1751 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
1779 return ret; 1752 return ret;
1780} 1753}
1781 1754
@@ -1800,7 +1773,7 @@ static int wlan_set_encodeext(struct net_device *dev,
1800 int alg = ext->alg; 1773 int alg = ext->alg;
1801 struct assoc_request * assoc_req; 1774 struct assoc_request * assoc_req;
1802 1775
1803 ENTER(); 1776 lbs_deb_enter(LBS_DEB_WEXT);
1804 1777
1805 mutex_lock(&adapter->lock); 1778 mutex_lock(&adapter->lock);
1806 assoc_req = wlan_get_association_request(adapter); 1779 assoc_req = wlan_get_association_request(adapter);
@@ -1811,6 +1784,7 @@ static int wlan_set_encodeext(struct net_device *dev,
1811 1784
1812 if ((alg == IW_ENCODE_ALG_NONE) || (dwrq->flags & IW_ENCODE_DISABLED)) { 1785 if ((alg == IW_ENCODE_ALG_NONE) || (dwrq->flags & IW_ENCODE_DISABLED)) {
1813 disable_wep (assoc_req); 1786 disable_wep (assoc_req);
1787 disable_wpa (assoc_req);
1814 } else if (alg == IW_ENCODE_ALG_WEP) { 1788 } else if (alg == IW_ENCODE_ALG_WEP) {
1815 u16 is_default = 0, index, set_tx_key = 0; 1789 u16 is_default = 0, index, set_tx_key = 0;
1816 1790
@@ -1846,7 +1820,6 @@ static int wlan_set_encodeext(struct net_device *dev,
1846 set_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags); 1820 set_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags);
1847 if (set_tx_key) 1821 if (set_tx_key)
1848 set_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags); 1822 set_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags);
1849
1850 } else if ((alg == IW_ENCODE_ALG_TKIP) || (alg == IW_ENCODE_ALG_CCMP)) { 1823 } else if ((alg == IW_ENCODE_ALG_TKIP) || (alg == IW_ENCODE_ALG_CCMP)) {
1851 struct WLAN_802_11_KEY * pkey; 1824 struct WLAN_802_11_KEY * pkey;
1852 1825
@@ -1855,36 +1828,43 @@ static int wlan_set_encodeext(struct net_device *dev,
1855 && (ext->key_len != KEY_LEN_WPA_TKIP)) 1828 && (ext->key_len != KEY_LEN_WPA_TKIP))
1856 || ((alg == IW_ENCODE_ALG_CCMP) 1829 || ((alg == IW_ENCODE_ALG_CCMP)
1857 && (ext->key_len != KEY_LEN_WPA_AES))) { 1830 && (ext->key_len != KEY_LEN_WPA_AES))) {
1858 lbs_pr_debug(1, "Invalid size %d for key of alg" 1831 lbs_deb_wext("invalid size %d for key of alg"
1859 "type %d.\n", 1832 "type %d\n",
1860 ext->key_len, 1833 ext->key_len,
1861 alg); 1834 alg);
1862 ret = -EINVAL; 1835 ret = -EINVAL;
1863 goto out; 1836 goto out;
1864 } 1837 }
1865 1838
1866 if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) 1839 if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) {
1867 pkey = &assoc_req->wpa_mcast_key; 1840 pkey = &assoc_req->wpa_mcast_key;
1868 else 1841 set_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags);
1842 } else {
1869 pkey = &assoc_req->wpa_unicast_key; 1843 pkey = &assoc_req->wpa_unicast_key;
1844 set_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags);
1845 }
1870 1846
1871 memset(pkey, 0, sizeof (struct WLAN_802_11_KEY)); 1847 memset(pkey, 0, sizeof (struct WLAN_802_11_KEY));
1872 memcpy(pkey->key, ext->key, ext->key_len); 1848 memcpy(pkey->key, ext->key, ext->key_len);
1873 pkey->len = ext->key_len; 1849 pkey->len = ext->key_len;
1874 pkey->flags = KEY_INFO_WPA_ENABLED; 1850 if (pkey->len)
1851 pkey->flags |= KEY_INFO_WPA_ENABLED;
1875 1852
1853 /* Do this after zeroing key structure */
1876 if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { 1854 if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) {
1877 pkey->flags |= KEY_INFO_WPA_MCAST; 1855 pkey->flags |= KEY_INFO_WPA_MCAST;
1878 set_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags);
1879 } else { 1856 } else {
1880 pkey->flags |= KEY_INFO_WPA_UNICAST; 1857 pkey->flags |= KEY_INFO_WPA_UNICAST;
1881 set_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags);
1882 } 1858 }
1883 1859
1884 if (alg == IW_ENCODE_ALG_TKIP) 1860 if (alg == IW_ENCODE_ALG_TKIP) {
1885 pkey->type = KEY_TYPE_ID_TKIP; 1861 pkey->type = KEY_TYPE_ID_TKIP;
1886 else if (alg == IW_ENCODE_ALG_CCMP) 1862 } else if (alg == IW_ENCODE_ALG_CCMP) {
1887 pkey->type = KEY_TYPE_ID_AES; 1863 pkey->type = KEY_TYPE_ID_AES;
1864 } else {
1865 ret = -EINVAL;
1866 goto out;
1867 }
1888 1868
1889 /* If WPA isn't enabled yet, do that now */ 1869 /* If WPA isn't enabled yet, do that now */
1890 if ( assoc_req->secinfo.WPAenabled == 0 1870 if ( assoc_req->secinfo.WPAenabled == 0
@@ -1905,7 +1885,7 @@ out:
1905 } 1885 }
1906 mutex_unlock(&adapter->lock); 1886 mutex_unlock(&adapter->lock);
1907 1887
1908 LEAVE(); 1888 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
1909 return ret; 1889 return ret;
1910} 1890}
1911 1891
@@ -1920,7 +1900,7 @@ static int wlan_set_genie(struct net_device *dev,
1920 int ret = 0; 1900 int ret = 0;
1921 struct assoc_request * assoc_req; 1901 struct assoc_request * assoc_req;
1922 1902
1923 ENTER(); 1903 lbs_deb_enter(LBS_DEB_WEXT);
1924 1904
1925 mutex_lock(&adapter->lock); 1905 mutex_lock(&adapter->lock);
1926 assoc_req = wlan_get_association_request(adapter); 1906 assoc_req = wlan_get_association_request(adapter);
@@ -1952,7 +1932,7 @@ out:
1952 } 1932 }
1953 mutex_unlock(&adapter->lock); 1933 mutex_unlock(&adapter->lock);
1954 1934
1955 LEAVE(); 1935 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
1956 return ret; 1936 return ret;
1957} 1937}
1958 1938
@@ -1961,27 +1941,28 @@ static int wlan_get_genie(struct net_device *dev,
1961 struct iw_point *dwrq, 1941 struct iw_point *dwrq,
1962 char *extra) 1942 char *extra)
1963{ 1943{
1944 int ret = 0;
1964 wlan_private *priv = dev->priv; 1945 wlan_private *priv = dev->priv;
1965 wlan_adapter *adapter = priv->adapter; 1946 wlan_adapter *adapter = priv->adapter;
1966 1947
1967 ENTER(); 1948 lbs_deb_enter(LBS_DEB_WEXT);
1968 1949
1969 if (adapter->wpa_ie_len == 0) { 1950 if (adapter->wpa_ie_len == 0) {
1970 dwrq->length = 0; 1951 dwrq->length = 0;
1971 LEAVE(); 1952 goto out;
1972 return 0;
1973 } 1953 }
1974 1954
1975 if (dwrq->length < adapter->wpa_ie_len) { 1955 if (dwrq->length < adapter->wpa_ie_len) {
1976 LEAVE(); 1956 ret = -E2BIG;
1977 return -E2BIG; 1957 goto out;
1978 } 1958 }
1979 1959
1980 dwrq->length = adapter->wpa_ie_len; 1960 dwrq->length = adapter->wpa_ie_len;
1981 memcpy(extra, &adapter->wpa_ie[0], adapter->wpa_ie_len); 1961 memcpy(extra, &adapter->wpa_ie[0], adapter->wpa_ie_len);
1982 1962
1983 LEAVE(); 1963out:
1984 return 0; 1964 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
1965 return ret;
1985} 1966}
1986 1967
1987 1968
@@ -1996,7 +1977,7 @@ static int wlan_set_auth(struct net_device *dev,
1996 int ret = 0; 1977 int ret = 0;
1997 int updated = 0; 1978 int updated = 0;
1998 1979
1999 ENTER(); 1980 lbs_deb_enter(LBS_DEB_WEXT);
2000 1981
2001 mutex_lock(&adapter->lock); 1982 mutex_lock(&adapter->lock);
2002 assoc_req = wlan_get_association_request(adapter); 1983 assoc_req = wlan_get_association_request(adapter);
@@ -2010,6 +1991,7 @@ static int wlan_set_auth(struct net_device *dev,
2010 case IW_AUTH_CIPHER_PAIRWISE: 1991 case IW_AUTH_CIPHER_PAIRWISE:
2011 case IW_AUTH_CIPHER_GROUP: 1992 case IW_AUTH_CIPHER_GROUP:
2012 case IW_AUTH_KEY_MGMT: 1993 case IW_AUTH_KEY_MGMT:
1994 case IW_AUTH_DROP_UNENCRYPTED:
2013 /* 1995 /*
2014 * libertas does not use these parameters 1996 * libertas does not use these parameters
2015 */ 1997 */
@@ -2019,6 +2001,7 @@ static int wlan_set_auth(struct net_device *dev,
2019 if (dwrq->value & IW_AUTH_WPA_VERSION_DISABLED) { 2001 if (dwrq->value & IW_AUTH_WPA_VERSION_DISABLED) {
2020 assoc_req->secinfo.WPAenabled = 0; 2002 assoc_req->secinfo.WPAenabled = 0;
2021 assoc_req->secinfo.WPA2enabled = 0; 2003 assoc_req->secinfo.WPA2enabled = 0;
2004 disable_wpa (assoc_req);
2022 } 2005 }
2023 if (dwrq->value & IW_AUTH_WPA_VERSION_WPA) { 2006 if (dwrq->value & IW_AUTH_WPA_VERSION_WPA) {
2024 assoc_req->secinfo.WPAenabled = 1; 2007 assoc_req->secinfo.WPAenabled = 1;
@@ -2033,17 +2016,6 @@ static int wlan_set_auth(struct net_device *dev,
2033 updated = 1; 2016 updated = 1;
2034 break; 2017 break;
2035 2018
2036 case IW_AUTH_DROP_UNENCRYPTED:
2037 if (dwrq->value) {
2038 adapter->currentpacketfilter |=
2039 cmd_act_mac_strict_protection_enable;
2040 } else {
2041 adapter->currentpacketfilter &=
2042 ~cmd_act_mac_strict_protection_enable;
2043 }
2044 updated = 1;
2045 break;
2046
2047 case IW_AUTH_80211_AUTH_ALG: 2019 case IW_AUTH_80211_AUTH_ALG:
2048 if (dwrq->value & IW_AUTH_ALG_SHARED_KEY) { 2020 if (dwrq->value & IW_AUTH_ALG_SHARED_KEY) {
2049 assoc_req->secinfo.auth_mode = IW_AUTH_ALG_SHARED_KEY; 2021 assoc_req->secinfo.auth_mode = IW_AUTH_ALG_SHARED_KEY;
@@ -2069,6 +2041,7 @@ static int wlan_set_auth(struct net_device *dev,
2069 } else { 2041 } else {
2070 assoc_req->secinfo.WPAenabled = 0; 2042 assoc_req->secinfo.WPAenabled = 0;
2071 assoc_req->secinfo.WPA2enabled = 0; 2043 assoc_req->secinfo.WPA2enabled = 0;
2044 disable_wpa (assoc_req);
2072 } 2045 }
2073 updated = 1; 2046 updated = 1;
2074 break; 2047 break;
@@ -2088,7 +2061,7 @@ out:
2088 } 2061 }
2089 mutex_unlock(&adapter->lock); 2062 mutex_unlock(&adapter->lock);
2090 2063
2091 LEAVE(); 2064 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
2092 return ret; 2065 return ret;
2093} 2066}
2094 2067
@@ -2097,10 +2070,11 @@ static int wlan_get_auth(struct net_device *dev,
2097 struct iw_param *dwrq, 2070 struct iw_param *dwrq,
2098 char *extra) 2071 char *extra)
2099{ 2072{
2073 int ret = 0;
2100 wlan_private *priv = dev->priv; 2074 wlan_private *priv = dev->priv;
2101 wlan_adapter *adapter = priv->adapter; 2075 wlan_adapter *adapter = priv->adapter;
2102 2076
2103 ENTER(); 2077 lbs_deb_enter(LBS_DEB_WEXT);
2104 2078
2105 switch (dwrq->flags & IW_AUTH_INDEX) { 2079 switch (dwrq->flags & IW_AUTH_INDEX) {
2106 case IW_AUTH_WPA_VERSION: 2080 case IW_AUTH_WPA_VERSION:
@@ -2113,13 +2087,6 @@ static int wlan_get_auth(struct net_device *dev,
2113 dwrq->value |= IW_AUTH_WPA_VERSION_DISABLED; 2087 dwrq->value |= IW_AUTH_WPA_VERSION_DISABLED;
2114 break; 2088 break;
2115 2089
2116 case IW_AUTH_DROP_UNENCRYPTED:
2117 dwrq->value = 0;
2118 if (adapter->currentpacketfilter &
2119 cmd_act_mac_strict_protection_enable)
2120 dwrq->value = 1;
2121 break;
2122
2123 case IW_AUTH_80211_AUTH_ALG: 2090 case IW_AUTH_80211_AUTH_ALG:
2124 dwrq->value = adapter->secinfo.auth_mode; 2091 dwrq->value = adapter->secinfo.auth_mode;
2125 break; 2092 break;
@@ -2130,12 +2097,11 @@ static int wlan_get_auth(struct net_device *dev,
2130 break; 2097 break;
2131 2098
2132 default: 2099 default:
2133 LEAVE(); 2100 ret = -EOPNOTSUPP;
2134 return -EOPNOTSUPP;
2135 } 2101 }
2136 2102
2137 LEAVE(); 2103 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
2138 return 0; 2104 return ret;
2139} 2105}
2140 2106
2141 2107
@@ -2148,7 +2114,7 @@ static int wlan_set_txpow(struct net_device *dev, struct iw_request_info *info,
2148 2114
2149 u16 dbm; 2115 u16 dbm;
2150 2116
2151 ENTER(); 2117 lbs_deb_enter(LBS_DEB_WEXT);
2152 2118
2153 if (vwrq->disabled) { 2119 if (vwrq->disabled) {
2154 wlan_radio_ioctl(priv, RADIO_OFF); 2120 wlan_radio_ioctl(priv, RADIO_OFF);
@@ -2169,14 +2135,14 @@ static int wlan_set_txpow(struct net_device *dev, struct iw_request_info *info,
2169 if (vwrq->fixed == 0) 2135 if (vwrq->fixed == 0)
2170 dbm = 0xffff; 2136 dbm = 0xffff;
2171 2137
2172 lbs_pr_debug(1, "<1>TXPOWER SET %d dbm.\n", dbm); 2138 lbs_deb_wext("txpower set %d dbm\n", dbm);
2173 2139
2174 ret = libertas_prepare_and_send_command(priv, 2140 ret = libertas_prepare_and_send_command(priv,
2175 cmd_802_11_rf_tx_power, 2141 cmd_802_11_rf_tx_power,
2176 cmd_act_tx_power_opt_set_low, 2142 cmd_act_tx_power_opt_set_low,
2177 cmd_option_waitforrsp, 0, (void *)&dbm); 2143 cmd_option_waitforrsp, 0, (void *)&dbm);
2178 2144
2179 LEAVE(); 2145 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
2180 return ret; 2146 return ret;
2181} 2147}
2182 2148
@@ -2186,7 +2152,8 @@ static int wlan_get_essid(struct net_device *dev, struct iw_request_info *info,
2186 wlan_private *priv = dev->priv; 2152 wlan_private *priv = dev->priv;
2187 wlan_adapter *adapter = priv->adapter; 2153 wlan_adapter *adapter = priv->adapter;
2188 2154
2189 ENTER(); 2155 lbs_deb_enter(LBS_DEB_WEXT);
2156
2190 /* 2157 /*
2191 * Note : if dwrq->flags != 0, we should get the relevant SSID from 2158 * Note : if dwrq->flags != 0, we should get the relevant SSID from
2192 * the SSID list... 2159 * the SSID list...
@@ -2196,12 +2163,12 @@ static int wlan_get_essid(struct net_device *dev, struct iw_request_info *info,
2196 * Get the current SSID 2163 * Get the current SSID
2197 */ 2164 */
2198 if (adapter->connect_status == libertas_connected) { 2165 if (adapter->connect_status == libertas_connected) {
2199 memcpy(extra, adapter->curbssparams.ssid.ssid, 2166 memcpy(extra, adapter->curbssparams.ssid,
2200 adapter->curbssparams.ssid.ssidlength); 2167 adapter->curbssparams.ssid_len);
2201 extra[adapter->curbssparams.ssid.ssidlength] = '\0'; 2168 extra[adapter->curbssparams.ssid_len] = '\0';
2202 } else { 2169 } else {
2203 memset(extra, 0, 32); 2170 memset(extra, 0, 32);
2204 extra[adapter->curbssparams.ssid.ssidlength] = '\0'; 2171 extra[adapter->curbssparams.ssid_len] = '\0';
2205 } 2172 }
2206 /* 2173 /*
2207 * If none, we may want to get the one that was set 2174 * 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,
2209 2176
2210 /* To make the driver backward compatible with WPA supplicant v0.2.4 */ 2177 /* To make the driver backward compatible with WPA supplicant v0.2.4 */
2211 if (dwrq->length == 32) /* check with WPA supplicant buffer size */ 2178 if (dwrq->length == 32) /* check with WPA supplicant buffer size */
2212 dwrq->length = min_t(size_t, adapter->curbssparams.ssid.ssidlength, 2179 dwrq->length = min_t(size_t, adapter->curbssparams.ssid_len,
2213 IW_ESSID_MAX_SIZE); 2180 IW_ESSID_MAX_SIZE);
2214 else 2181 else
2215 dwrq->length = adapter->curbssparams.ssid.ssidlength + 1; 2182 dwrq->length = adapter->curbssparams.ssid_len + 1;
2216 2183
2217 dwrq->flags = 1; /* active */ 2184 dwrq->flags = 1; /* active */
2218 2185
2219 LEAVE(); 2186 lbs_deb_leave(LBS_DEB_WEXT);
2220 return 0; 2187 return 0;
2221} 2188}
2222 2189
@@ -2226,38 +2193,43 @@ static int wlan_set_essid(struct net_device *dev, struct iw_request_info *info,
2226 wlan_private *priv = dev->priv; 2193 wlan_private *priv = dev->priv;
2227 wlan_adapter *adapter = priv->adapter; 2194 wlan_adapter *adapter = priv->adapter;
2228 int ret = 0; 2195 int ret = 0;
2229 struct WLAN_802_11_SSID ssid; 2196 u8 ssid[IW_ESSID_MAX_SIZE];
2197 u8 ssid_len = 0;
2230 struct assoc_request * assoc_req; 2198 struct assoc_request * assoc_req;
2231 int ssid_len = dwrq->length; 2199 int in_ssid_len = dwrq->length;
2232 2200
2233 ENTER(); 2201 lbs_deb_enter(LBS_DEB_WEXT);
2234 2202
2235 /* 2203 /*
2236 * WE-20 and earlier NULL pad the end of the SSID and increment 2204 * WE-20 and earlier NULL pad the end of the SSID and increment
2237 * SSID length so it can be used like a string. WE-21 and later don't, 2205 * SSID length so it can be used like a string. WE-21 and later don't,
2238 * but some userspace tools aren't able to cope with the change. 2206 * but some userspace tools aren't able to cope with the change.
2239 */ 2207 */
2240 if ((ssid_len > 0) && (extra[ssid_len - 1] == '\0')) 2208 if ((in_ssid_len > 0) && (extra[in_ssid_len - 1] == '\0'))
2241 ssid_len--; 2209 in_ssid_len--;
2242 2210
2243 /* Check the size of the string */ 2211 /* Check the size of the string */
2244 if (ssid_len > IW_ESSID_MAX_SIZE) { 2212 if (in_ssid_len > IW_ESSID_MAX_SIZE) {
2245 ret = -E2BIG; 2213 ret = -E2BIG;
2246 goto out; 2214 goto out;
2247 } 2215 }
2248 2216
2249 memset(&ssid, 0, sizeof(struct WLAN_802_11_SSID)); 2217 memset(&ssid, 0, sizeof(ssid));
2250 2218
2251 if (!dwrq->flags || !ssid_len) { 2219 if (!dwrq->flags || !in_ssid_len) {
2252 /* "any" SSID requested; leave SSID blank */ 2220 /* "any" SSID requested; leave SSID blank */
2253 } else { 2221 } else {
2254 /* Specific SSID requested */ 2222 /* Specific SSID requested */
2255 memcpy(&ssid.ssid, extra, ssid_len); 2223 memcpy(&ssid, extra, in_ssid_len);
2256 ssid.ssidlength = ssid_len; 2224 ssid_len = in_ssid_len;
2257 } 2225 }
2258 2226
2259 lbs_pr_debug(1, "Requested new SSID = %s\n", 2227 if (!ssid_len) {
2260 (ssid.ssidlength > 0) ? (char *)ssid.ssid : "any"); 2228 lbs_deb_wext("requested any SSID\n");
2229 } else {
2230 lbs_deb_wext("requested SSID '%s'\n",
2231 escape_essid(ssid, ssid_len));
2232 }
2261 2233
2262out: 2234out:
2263 mutex_lock(&adapter->lock); 2235 mutex_lock(&adapter->lock);
@@ -2268,7 +2240,8 @@ out:
2268 ret = -ENOMEM; 2240 ret = -ENOMEM;
2269 } else { 2241 } else {
2270 /* Copy the SSID to the association request */ 2242 /* Copy the SSID to the association request */
2271 memcpy(&assoc_req->ssid, &ssid, sizeof(struct WLAN_802_11_SSID)); 2243 memcpy(&assoc_req->ssid, &ssid, IW_ESSID_MAX_SIZE);
2244 assoc_req->ssid_len = ssid_len;
2272 set_bit(ASSOC_FLAG_SSID, &assoc_req->flags); 2245 set_bit(ASSOC_FLAG_SSID, &assoc_req->flags);
2273 wlan_postpone_association_work(priv); 2246 wlan_postpone_association_work(priv);
2274 } 2247 }
@@ -2281,7 +2254,7 @@ out:
2281 2254
2282 mutex_unlock(&adapter->lock); 2255 mutex_unlock(&adapter->lock);
2283 2256
2284 LEAVE(); 2257 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
2285 return ret; 2258 return ret;
2286} 2259}
2287 2260
@@ -2302,12 +2275,12 @@ static int wlan_set_wap(struct net_device *dev, struct iw_request_info *info,
2302 struct assoc_request * assoc_req; 2275 struct assoc_request * assoc_req;
2303 int ret = 0; 2276 int ret = 0;
2304 2277
2305 ENTER(); 2278 lbs_deb_enter(LBS_DEB_WEXT);
2306 2279
2307 if (awrq->sa_family != ARPHRD_ETHER) 2280 if (awrq->sa_family != ARPHRD_ETHER)
2308 return -EINVAL; 2281 return -EINVAL;
2309 2282
2310 lbs_pr_debug(1, "ASSOC: WAP: sa_data: " MAC_FMT "\n", MAC_ARG(awrq->sa_data)); 2283 lbs_deb_wext("ASSOC: WAP: sa_data " MAC_FMT "\n", MAC_ARG(awrq->sa_data));
2311 2284
2312 mutex_lock(&adapter->lock); 2285 mutex_lock(&adapter->lock);
2313 2286
@@ -2330,22 +2303,23 @@ static int wlan_set_wap(struct net_device *dev, struct iw_request_info *info,
2330 2303
2331void libertas_get_fwversion(wlan_adapter * adapter, char *fwversion, int maxlen) 2304void libertas_get_fwversion(wlan_adapter * adapter, char *fwversion, int maxlen)
2332{ 2305{
2333 union {
2334 u32 l;
2335 u8 c[4];
2336 } ver;
2337 char fwver[32]; 2306 char fwver[32];
2338 2307
2339 mutex_lock(&adapter->lock); 2308 mutex_lock(&adapter->lock);
2340 ver.l = adapter->fwreleasenumber;
2341 mutex_unlock(&adapter->lock);
2342 2309
2343 if (ver.c[3] == 0) 2310 if (adapter->fwreleasenumber[3] == 0)
2344 sprintf(fwver, "%u.%u.%u", ver.c[2], ver.c[1], ver.c[0]); 2311 sprintf(fwver, "%u.%u.%u",
2312 adapter->fwreleasenumber[2],
2313 adapter->fwreleasenumber[1],
2314 adapter->fwreleasenumber[0]);
2345 else 2315 else
2346 sprintf(fwver, "%u.%u.%u.p%u", 2316 sprintf(fwver, "%u.%u.%u.p%u",
2347 ver.c[2], ver.c[1], ver.c[0], ver.c[3]); 2317 adapter->fwreleasenumber[2],
2318 adapter->fwreleasenumber[1],
2319 adapter->fwreleasenumber[0],
2320 adapter->fwreleasenumber[3]);
2348 2321
2322 mutex_unlock(&adapter->lock);
2349 snprintf(fwversion, maxlen, fwver); 2323 snprintf(fwversion, maxlen, fwver);
2350} 2324}
2351 2325
@@ -2411,6 +2385,63 @@ static const iw_handler wlan_handler[] = {
2411 (iw_handler) NULL, /* SIOCSIWPMKSA */ 2385 (iw_handler) NULL, /* SIOCSIWPMKSA */
2412}; 2386};
2413 2387
2388static const iw_handler mesh_wlan_handler[] = {
2389 (iw_handler) NULL, /* SIOCSIWCOMMIT */
2390 (iw_handler) wlan_get_name, /* SIOCGIWNAME */
2391 (iw_handler) NULL, /* SIOCSIWNWID */
2392 (iw_handler) NULL, /* SIOCGIWNWID */
2393 (iw_handler) wlan_set_freq, /* SIOCSIWFREQ */
2394 (iw_handler) wlan_get_freq, /* SIOCGIWFREQ */
2395 (iw_handler) NULL, /* SIOCSIWMODE */
2396 (iw_handler) mesh_wlan_get_mode, /* SIOCGIWMODE */
2397 (iw_handler) NULL, /* SIOCSIWSENS */
2398 (iw_handler) NULL, /* SIOCGIWSENS */
2399 (iw_handler) NULL, /* SIOCSIWRANGE */
2400 (iw_handler) wlan_get_range, /* SIOCGIWRANGE */
2401 (iw_handler) NULL, /* SIOCSIWPRIV */
2402 (iw_handler) NULL, /* SIOCGIWPRIV */
2403 (iw_handler) NULL, /* SIOCSIWSTATS */
2404 (iw_handler) NULL, /* SIOCGIWSTATS */
2405 iw_handler_set_spy, /* SIOCSIWSPY */
2406 iw_handler_get_spy, /* SIOCGIWSPY */
2407 iw_handler_set_thrspy, /* SIOCSIWTHRSPY */
2408 iw_handler_get_thrspy, /* SIOCGIWTHRSPY */
2409 (iw_handler) NULL, /* SIOCSIWAP */
2410 (iw_handler) NULL, /* SIOCGIWAP */
2411 (iw_handler) NULL, /* SIOCSIWMLME */
2412 (iw_handler) NULL, /* SIOCGIWAPLIST - deprecated */
2413 (iw_handler) libertas_set_scan, /* SIOCSIWSCAN */
2414 (iw_handler) libertas_get_scan, /* SIOCGIWSCAN */
2415 (iw_handler) NULL, /* SIOCSIWESSID */
2416 (iw_handler) NULL, /* SIOCGIWESSID */
2417 (iw_handler) NULL, /* SIOCSIWNICKN */
2418 (iw_handler) mesh_get_nick, /* SIOCGIWNICKN */
2419 (iw_handler) NULL, /* -- hole -- */
2420 (iw_handler) NULL, /* -- hole -- */
2421 (iw_handler) wlan_set_rate, /* SIOCSIWRATE */
2422 (iw_handler) wlan_get_rate, /* SIOCGIWRATE */
2423 (iw_handler) wlan_set_rts, /* SIOCSIWRTS */
2424 (iw_handler) wlan_get_rts, /* SIOCGIWRTS */
2425 (iw_handler) wlan_set_frag, /* SIOCSIWFRAG */
2426 (iw_handler) wlan_get_frag, /* SIOCGIWFRAG */
2427 (iw_handler) wlan_set_txpow, /* SIOCSIWTXPOW */
2428 (iw_handler) wlan_get_txpow, /* SIOCGIWTXPOW */
2429 (iw_handler) wlan_set_retry, /* SIOCSIWRETRY */
2430 (iw_handler) wlan_get_retry, /* SIOCGIWRETRY */
2431 (iw_handler) wlan_set_encode, /* SIOCSIWENCODE */
2432 (iw_handler) wlan_get_encode, /* SIOCGIWENCODE */
2433 (iw_handler) wlan_set_power, /* SIOCSIWPOWER */
2434 (iw_handler) wlan_get_power, /* SIOCGIWPOWER */
2435 (iw_handler) NULL, /* -- hole -- */
2436 (iw_handler) NULL, /* -- hole -- */
2437 (iw_handler) wlan_set_genie, /* SIOCSIWGENIE */
2438 (iw_handler) wlan_get_genie, /* SIOCGIWGENIE */
2439 (iw_handler) wlan_set_auth, /* SIOCSIWAUTH */
2440 (iw_handler) wlan_get_auth, /* SIOCGIWAUTH */
2441 (iw_handler) wlan_set_encodeext,/* SIOCSIWENCODEEXT */
2442 (iw_handler) wlan_get_encodeext,/* SIOCGIWENCODEEXT */
2443 (iw_handler) NULL, /* SIOCSIWPMKSA */
2444};
2414struct iw_handler_def libertas_handler_def = { 2445struct iw_handler_def libertas_handler_def = {
2415 .num_standard = sizeof(wlan_handler) / sizeof(iw_handler), 2446 .num_standard = sizeof(wlan_handler) / sizeof(iw_handler),
2416 .num_private = sizeof(wlan_private_handler) / sizeof(iw_handler), 2447 .num_private = sizeof(wlan_private_handler) / sizeof(iw_handler),
@@ -2421,3 +2452,14 @@ struct iw_handler_def libertas_handler_def = {
2421 .private_args = (struct iw_priv_args *)wlan_private_args, 2452 .private_args = (struct iw_priv_args *)wlan_private_args,
2422 .get_wireless_stats = wlan_get_wireless_stats, 2453 .get_wireless_stats = wlan_get_wireless_stats,
2423}; 2454};
2455
2456struct iw_handler_def mesh_handler_def = {
2457 .num_standard = sizeof(mesh_wlan_handler) / sizeof(iw_handler),
2458 .num_private = sizeof(wlan_private_handler) / sizeof(iw_handler),
2459 .num_private_args = sizeof(wlan_private_args) /
2460 sizeof(struct iw_priv_args),
2461 .standard = (iw_handler *) mesh_wlan_handler,
2462 .private = (iw_handler *) wlan_private_handler,
2463 .private_args = (struct iw_priv_args *)wlan_private_args,
2464 .get_wireless_stats = wlan_get_wireless_stats,
2465};
diff --git a/drivers/net/wireless/libertas/wext.h b/drivers/net/wireless/libertas/wext.h
index 15cfaaf0797f..d555056b25b7 100644
--- a/drivers/net/wireless/libertas/wext.h
+++ b/drivers/net/wireless/libertas/wext.h
@@ -20,21 +20,23 @@
20#define WLAN_SUBCMD_FWT_CLEANUP 15 20#define WLAN_SUBCMD_FWT_CLEANUP 15
21#define WLAN_SUBCMD_FWT_TIME 16 21#define WLAN_SUBCMD_FWT_TIME 16
22#define WLAN_SUBCMD_MESH_GET_TTL 17 22#define WLAN_SUBCMD_MESH_GET_TTL 17
23#define WLAN_SUBCMD_BT_GET_INVERT 18
23 24
24#define WLAN_SETONEINT_GETNONE (WLANIOCTL + 24) 25#define WLAN_SETONEINT_GETNONE (WLANIOCTL + 24)
25#define WLANSETREGION 8 26#define WLANSETREGION 8
26#define WLAN_SUBCMD_MESH_SET_TTL 18 27#define WLAN_SUBCMD_MESH_SET_TTL 18
28#define WLAN_SUBCMD_BT_SET_INVERT 19
27 29
28#define WLAN_SET128CHAR_GET128CHAR (WLANIOCTL + 25) 30#define WLAN_SET128CHAR_GET128CHAR (WLANIOCTL + 25)
29#define WLAN_SUBCMD_BT_ADD 18 31#define WLAN_SUBCMD_BT_ADD 18
30#define WLAN_SUBCMD_BT_DEL 19 32#define WLAN_SUBCMD_BT_DEL 19
31#define WLAN_SUBCMD_BT_LIST 20 33#define WLAN_SUBCMD_BT_LIST 20
32#define WLAN_SUBCMD_FWT_ADD 21 34#define WLAN_SUBCMD_FWT_ADD 21
33#define WLAN_SUBCMD_FWT_DEL 22 35#define WLAN_SUBCMD_FWT_DEL 22
34#define WLAN_SUBCMD_FWT_LOOKUP 23 36#define WLAN_SUBCMD_FWT_LOOKUP 23
35#define WLAN_SUBCMD_FWT_LIST_NEIGHBOR 24 37#define WLAN_SUBCMD_FWT_LIST_NEIGHBOR 24
36#define WLAN_SUBCMD_FWT_LIST 25 38#define WLAN_SUBCMD_FWT_LIST 25
37#define WLAN_SUBCMD_FWT_LIST_ROUTE 26 39#define WLAN_SUBCMD_FWT_LIST_ROUTE 26
38 40
39#define WLAN_SET_GET_SIXTEEN_INT (WLANIOCTL + 29) 41#define WLAN_SET_GET_SIXTEEN_INT (WLANIOCTL + 29)
40#define WLAN_LED_GPIO_CTRL 5 42#define WLAN_LED_GPIO_CTRL 5
@@ -56,6 +58,7 @@ struct wlan_ioctl_regrdwr {
56}; 58};
57 59
58extern struct iw_handler_def libertas_handler_def; 60extern struct iw_handler_def libertas_handler_def;
61extern struct iw_handler_def mesh_handler_def;
59int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int i); 62int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int i);
60int wlan_radio_ioctl(wlan_private * priv, u8 option); 63int wlan_radio_ioctl(wlan_private * priv, u8 option);
61 64
diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c
index 894fdb9d44c0..b3c4dbff26b8 100644
--- a/drivers/parisc/ccio-dma.c
+++ b/drivers/parisc/ccio-dma.c
@@ -32,6 +32,7 @@
32*/ 32*/
33 33
34#include <linux/types.h> 34#include <linux/types.h>
35#include <linux/kernel.h>
35#include <linux/init.h> 36#include <linux/init.h>
36#include <linux/mm.h> 37#include <linux/mm.h>
37#include <linux/spinlock.h> 38#include <linux/spinlock.h>
@@ -292,7 +293,6 @@ static int ioc_count;
292#define PDIR_INDEX(iovp) ((iovp)>>IOVP_SHIFT) 293#define PDIR_INDEX(iovp) ((iovp)>>IOVP_SHIFT)
293#define MKIOVP(pdir_idx) ((long)(pdir_idx) << IOVP_SHIFT) 294#define MKIOVP(pdir_idx) ((long)(pdir_idx) << IOVP_SHIFT)
294#define MKIOVA(iovp,offset) (dma_addr_t)((long)iovp | (long)offset) 295#define MKIOVA(iovp,offset) (dma_addr_t)((long)iovp | (long)offset)
295#define ROUNDUP(x,y) ((x + ((y)-1)) & ~((y)-1))
296 296
297/* 297/*
298** Don't worry about the 150% average search length on a miss. 298** 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)
668 size_t saved_byte_cnt; 668 size_t saved_byte_cnt;
669 669
670 /* round up to nearest page size */ 670 /* round up to nearest page size */
671 saved_byte_cnt = byte_cnt = ROUNDUP(byte_cnt, IOVP_SIZE); 671 saved_byte_cnt = byte_cnt = ALIGN(byte_cnt, IOVP_SIZE);
672 672
673 while(byte_cnt > 0) { 673 while(byte_cnt > 0) {
674 /* invalidate one page at a time */ 674 /* invalidate one page at a time */
@@ -751,7 +751,7 @@ ccio_map_single(struct device *dev, void *addr, size_t size,
751 offset = ((unsigned long) addr) & ~IOVP_MASK; 751 offset = ((unsigned long) addr) & ~IOVP_MASK;
752 752
753 /* round up to nearest IOVP_SIZE */ 753 /* round up to nearest IOVP_SIZE */
754 size = ROUNDUP(size + offset, IOVP_SIZE); 754 size = ALIGN(size + offset, IOVP_SIZE);
755 spin_lock_irqsave(&ioc->res_lock, flags); 755 spin_lock_irqsave(&ioc->res_lock, flags);
756 756
757#ifdef CCIO_MAP_STATS 757#ifdef CCIO_MAP_STATS
@@ -814,7 +814,7 @@ ccio_unmap_single(struct device *dev, dma_addr_t iova, size_t size,
814 814
815 iova ^= offset; /* clear offset bits */ 815 iova ^= offset; /* clear offset bits */
816 size += offset; 816 size += offset;
817 size = ROUNDUP(size, IOVP_SIZE); 817 size = ALIGN(size, IOVP_SIZE);
818 818
819 spin_lock_irqsave(&ioc->res_lock, flags); 819 spin_lock_irqsave(&ioc->res_lock, flags);
820 820
@@ -1227,7 +1227,7 @@ ccio_get_iotlb_size(struct parisc_device *dev)
1227#endif /* 0 */ 1227#endif /* 0 */
1228 1228
1229/* We *can't* support JAVA (T600). Venture there at your own risk. */ 1229/* We *can't* support JAVA (T600). Venture there at your own risk. */
1230static struct parisc_device_id ccio_tbl[] = { 1230static const struct parisc_device_id ccio_tbl[] = {
1231 { HPHW_IOA, HVERSION_REV_ANY_ID, U2_IOA_RUNWAY, 0xb }, /* U2 */ 1231 { HPHW_IOA, HVERSION_REV_ANY_ID, U2_IOA_RUNWAY, 0xb }, /* U2 */
1232 { HPHW_IOA, HVERSION_REV_ANY_ID, UTURN_IOA_RUNWAY, 0xb }, /* UTurn */ 1232 { HPHW_IOA, HVERSION_REV_ANY_ID, UTURN_IOA_RUNWAY, 0xb }, /* UTurn */
1233 { 0, } 1233 { 0, }
@@ -1370,7 +1370,7 @@ ccio_ioc_init(struct ioc *ioc)
1370 } 1370 }
1371} 1371}
1372 1372
1373static void 1373static void __init
1374ccio_init_resource(struct resource *res, char *name, void __iomem *ioaddr) 1374ccio_init_resource(struct resource *res, char *name, void __iomem *ioaddr)
1375{ 1375{
1376 int result; 1376 int result;
@@ -1537,7 +1537,7 @@ int ccio_request_resource(const struct parisc_device *dev,
1537 * If so, initialize the chip and tell other partners in crime they 1537 * If so, initialize the chip and tell other partners in crime they
1538 * have work to do. 1538 * have work to do.
1539 */ 1539 */
1540static int ccio_probe(struct parisc_device *dev) 1540static int __init ccio_probe(struct parisc_device *dev)
1541{ 1541{
1542 int i; 1542 int i;
1543 struct ioc *ioc, **ioc_p = &ioc_list; 1543 struct ioc *ioc, **ioc_p = &ioc_list;
diff --git a/drivers/parisc/eisa.c b/drivers/parisc/eisa.c
index 309076b39853..771cef592542 100644
--- a/drivers/parisc/eisa.c
+++ b/drivers/parisc/eisa.c
@@ -307,7 +307,7 @@ static void init_eisa_pic(void)
307 307
308#define is_mongoose(dev) (dev->id.sversion == 0x00076) 308#define is_mongoose(dev) (dev->id.sversion == 0x00076)
309 309
310static int __devinit eisa_probe(struct parisc_device *dev) 310static int __init eisa_probe(struct parisc_device *dev)
311{ 311{
312 int i, result; 312 int i, result;
313 313
@@ -387,7 +387,7 @@ static int __devinit eisa_probe(struct parisc_device *dev)
387 return 0; 387 return 0;
388} 388}
389 389
390static struct parisc_device_id eisa_tbl[] = { 390static const struct parisc_device_id eisa_tbl[] = {
391 { HPHW_BA, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00076 }, /* Mongoose */ 391 { HPHW_BA, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00076 }, /* Mongoose */
392 { HPHW_BA, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00090 }, /* Wax EISA */ 392 { HPHW_BA, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00090 }, /* Wax EISA */
393 { 0, } 393 { 0, }
diff --git a/drivers/parisc/iommu-helpers.h b/drivers/parisc/iommu-helpers.h
index 38d9e1aba1d0..0a1f99a2e93e 100644
--- a/drivers/parisc/iommu-helpers.h
+++ b/drivers/parisc/iommu-helpers.h
@@ -138,7 +138,7 @@ iommu_coalesce_chunks(struct ioc *ioc, struct scatterlist *startsg, int nents,
138 ** exceed DMA_CHUNK_SIZE if we coalesce the 138 ** exceed DMA_CHUNK_SIZE if we coalesce the
139 ** next entry. 139 ** next entry.
140 */ 140 */
141 if(unlikely(ROUNDUP(dma_len + dma_offset + startsg->length, 141 if(unlikely(ALIGN(dma_len + dma_offset + startsg->length,
142 IOVP_SIZE) > DMA_CHUNK_SIZE)) 142 IOVP_SIZE) > DMA_CHUNK_SIZE))
143 break; 143 break;
144 144
@@ -158,7 +158,7 @@ iommu_coalesce_chunks(struct ioc *ioc, struct scatterlist *startsg, int nents,
158 ** Allocate space for DMA stream. 158 ** Allocate space for DMA stream.
159 */ 159 */
160 sg_dma_len(contig_sg) = dma_len; 160 sg_dma_len(contig_sg) = dma_len;
161 dma_len = ROUNDUP(dma_len + dma_offset, IOVP_SIZE); 161 dma_len = ALIGN(dma_len + dma_offset, IOVP_SIZE);
162 sg_dma_address(contig_sg) = 162 sg_dma_address(contig_sg) =
163 PIDE_FLAG 163 PIDE_FLAG
164 | (iommu_alloc_range(ioc, dma_len) << IOVP_SHIFT) 164 | (iommu_alloc_range(ioc, dma_len) << IOVP_SHIFT)
diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c
index 815e445c3125..924ef0609460 100644
--- a/drivers/parisc/pdc_stable.c
+++ b/drivers/parisc/pdc_stable.c
@@ -1067,7 +1067,7 @@ pdc_stable_init(void)
1067 error = subsys_create_file(&stable_subsys, attr); 1067 error = subsys_create_file(&stable_subsys, attr);
1068 1068
1069 /* register the paths subsys as a subsystem of stable subsys */ 1069 /* register the paths subsys as a subsystem of stable subsys */
1070 kset_set_kset_s(&paths_subsys, stable_subsys); 1070 kobj_set_kset_s(&paths_subsys, stable_subsys);
1071 if ((rc = subsystem_register(&paths_subsys))) 1071 if ((rc = subsystem_register(&paths_subsys)))
1072 goto fail_subsysreg; 1072 goto fail_subsysreg;
1073 1073
diff --git a/drivers/parisc/power.c b/drivers/parisc/power.c
index 6dedbdef7106..90cca5e3805f 100644
--- a/drivers/parisc/power.c
+++ b/drivers/parisc/power.c
@@ -41,6 +41,7 @@
41#include <linux/reboot.h> 41#include <linux/reboot.h>
42#include <linux/sched.h> 42#include <linux/sched.h>
43#include <linux/kthread.h> 43#include <linux/kthread.h>
44#include <linux/pm.h>
44 45
45#include <asm/pdc.h> 46#include <asm/pdc.h>
46#include <asm/io.h> 47#include <asm/io.h>
diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c
index 322957ac2ad1..d044c48323e6 100644
--- a/drivers/parisc/sba_iommu.c
+++ b/drivers/parisc/sba_iommu.c
@@ -113,8 +113,6 @@ module_param(sba_reserve_agpgart, int, 0444);
113MODULE_PARM_DESC(sba_reserve_agpgart, "Reserve half of IO pdir as AGPGART"); 113MODULE_PARM_DESC(sba_reserve_agpgart, "Reserve half of IO pdir as AGPGART");
114#endif 114#endif
115 115
116#define ROUNDUP(x,y) ((x + ((y)-1)) & ~((y)-1))
117
118 116
119/************************************ 117/************************************
120** SBA register read and write support 118** SBA register read and write support
@@ -352,7 +350,7 @@ sba_search_bitmap(struct ioc *ioc, unsigned long bits_wanted)
352 ** SBA HW features in the unmap path. 350 ** SBA HW features in the unmap path.
353 */ 351 */
354 unsigned long o = 1 << get_order(bits_wanted << PAGE_SHIFT); 352 unsigned long o = 1 << get_order(bits_wanted << PAGE_SHIFT);
355 uint bitshiftcnt = ROUNDUP(ioc->res_bitshift, o); 353 uint bitshiftcnt = ALIGN(ioc->res_bitshift, o);
356 unsigned long mask; 354 unsigned long mask;
357 355
358 if (bitshiftcnt >= BITS_PER_LONG) { 356 if (bitshiftcnt >= BITS_PER_LONG) {
@@ -779,7 +777,7 @@ sba_unmap_single(struct device *dev, dma_addr_t iova, size_t size,
779 offset = iova & ~IOVP_MASK; 777 offset = iova & ~IOVP_MASK;
780 iova ^= offset; /* clear offset bits */ 778 iova ^= offset; /* clear offset bits */
781 size += offset; 779 size += offset;
782 size = ROUNDUP(size, IOVP_SIZE); 780 size = ALIGN(size, IOVP_SIZE);
783 781
784 spin_lock_irqsave(&ioc->res_lock, flags); 782 spin_lock_irqsave(&ioc->res_lock, flags);
785 783
diff --git a/drivers/parisc/superio.c b/drivers/parisc/superio.c
index 1fd97f7c8b98..a708c329675e 100644
--- a/drivers/parisc/superio.c
+++ b/drivers/parisc/superio.c
@@ -389,7 +389,7 @@ int superio_fixup_irq(struct pci_dev *pcidev)
389 return local_irq; 389 return local_irq;
390} 390}
391 391
392static void __devinit superio_serial_init(void) 392static void __init superio_serial_init(void)
393{ 393{
394#ifdef CONFIG_SERIAL_8250 394#ifdef CONFIG_SERIAL_8250
395 int retval; 395 int retval;
@@ -423,7 +423,7 @@ static void __devinit superio_serial_init(void)
423} 423}
424 424
425 425
426static void __devinit superio_parport_init(void) 426static void __init superio_parport_init(void)
427{ 427{
428#ifdef CONFIG_PARPORT_PC 428#ifdef CONFIG_PARPORT_PC
429 if (!parport_pc_probe_port(sio_dev.pp_base, 429 if (!parport_pc_probe_port(sio_dev.pp_base,
@@ -450,7 +450,7 @@ static void superio_fixup_pci(struct pci_dev *pdev)
450DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87415, superio_fixup_pci); 450DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87415, superio_fixup_pci);
451 451
452 452
453static int __devinit 453static int __init
454superio_probe(struct pci_dev *dev, const struct pci_device_id *id) 454superio_probe(struct pci_dev *dev, const struct pci_device_id *id)
455{ 455{
456 struct superio_device *sio = &sio_dev; 456 struct superio_device *sio = &sio_dev;
@@ -485,7 +485,7 @@ superio_probe(struct pci_dev *dev, const struct pci_device_id *id)
485 return -ENODEV; 485 return -ENODEV;
486} 486}
487 487
488static struct pci_device_id superio_tbl[] = { 488static const struct pci_device_id superio_tbl[] = {
489 { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87560_LIO) }, 489 { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87560_LIO) },
490 { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87560_USB) }, 490 { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87560_USB) },
491 { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87415) }, 491 { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87415) },
diff --git a/drivers/parport/parport_gsc.c b/drivers/parport/parport_gsc.c
index 17bf9937d276..43652ba523eb 100644
--- a/drivers/parport/parport_gsc.c
+++ b/drivers/parport/parport_gsc.c
@@ -350,7 +350,7 @@ struct parport *__devinit parport_gsc_probe_port (unsigned long base,
350 350
351#define PARPORT_GSC_OFFSET 0x800 351#define PARPORT_GSC_OFFSET 0x800
352 352
353static int __initdata parport_count; 353static int __devinitdata parport_count;
354 354
355static int __devinit parport_init_chip(struct parisc_device *dev) 355static int __devinit parport_init_chip(struct parisc_device *dev)
356{ 356{
diff --git a/drivers/s390/char/zcore.c b/drivers/s390/char/zcore.c
index 66eb0688d523..4e711a985d59 100644
--- a/drivers/s390/char/zcore.c
+++ b/drivers/s390/char/zcore.c
@@ -267,7 +267,9 @@ struct zcore_header {
267 u64 tod; 267 u64 tod;
268 cpuid_t cpu_id; 268 cpuid_t cpu_id;
269 u32 arch_id; 269 u32 arch_id;
270 u32 volnr;
270 u32 build_arch; 271 u32 build_arch;
272 u64 rmem_size;
271 char pad2[4016]; 273 char pad2[4016];
272} __attribute__((packed,__aligned__(16))); 274} __attribute__((packed,__aligned__(16)));
273 275
@@ -559,6 +561,7 @@ static void __init zcore_header_init(int arch, struct zcore_header *hdr)
559 else 561 else
560 hdr->arch_id = DUMP_ARCH_S390; 562 hdr->arch_id = DUMP_ARCH_S390;
561 hdr->mem_size = sys_info.mem_size; 563 hdr->mem_size = sys_info.mem_size;
564 hdr->rmem_size = sys_info.mem_size;
562 hdr->mem_end = sys_info.mem_size; 565 hdr->mem_end = sys_info.mem_size;
563 hdr->num_pages = sys_info.mem_size / PAGE_SIZE; 566 hdr->num_pages = sys_info.mem_size / PAGE_SIZE;
564 hdr->tod = get_clock(); 567 hdr->tod = get_clock();
diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c
index ec71061aef61..71caf2ded6ba 100644
--- a/drivers/scsi/esp_scsi.c
+++ b/drivers/scsi/esp_scsi.c
@@ -2033,6 +2033,7 @@ static void esp_reset_cleanup(struct esp *esp)
2033 starget_for_each_device(tp->starget, NULL, 2033 starget_for_each_device(tp->starget, NULL,
2034 esp_clear_hold); 2034 esp_clear_hold);
2035 } 2035 }
2036 esp->flags &= ~ESP_FLAG_RESETTING;
2036} 2037}
2037 2038
2038/* Runs under host->lock */ 2039/* Runs under host->lock */
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index 8263f752809d..bb90df8bdce4 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -463,7 +463,7 @@ static inline unsigned long get_timeout(idescsi_pc_t *pc)
463 463
464static int idescsi_expiry(ide_drive_t *drive) 464static int idescsi_expiry(ide_drive_t *drive)
465{ 465{
466 idescsi_scsi_t *scsi = drive->driver_data; 466 idescsi_scsi_t *scsi = drive_to_idescsi(drive);
467 idescsi_pc_t *pc = scsi->pc; 467 idescsi_pc_t *pc = scsi->pc;
468 468
469#if IDESCSI_DEBUG_LOG 469#if IDESCSI_DEBUG_LOG
diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c
index 787dc7168f3e..22569bd5d821 100644
--- a/drivers/serial/bfin_5xx.c
+++ b/drivers/serial/bfin_5xx.c
@@ -185,6 +185,7 @@ static void bfin_serial_rx_chars(struct bfin_serial_port *uart)
185 uart->port.icount.brk++; 185 uart->port.icount.brk++;
186 if (uart_handle_break(&uart->port)) 186 if (uart_handle_break(&uart->port))
187 goto ignore_char; 187 goto ignore_char;
188 status &= ~(PE | FE);
188 } 189 }
189 if (status & PE) 190 if (status & PE)
190 uart->port.icount.parity++; 191 uart->port.icount.parity++;
@@ -341,6 +342,7 @@ static void bfin_serial_dma_rx_chars(struct bfin_serial_port *uart)
341 uart->port.icount.brk++; 342 uart->port.icount.brk++;
342 if (uart_handle_break(&uart->port)) 343 if (uart_handle_break(&uart->port))
343 goto dma_ignore_char; 344 goto dma_ignore_char;
345 status &= ~(PE | FE);
344 } 346 }
345 if (status & PE) 347 if (status & PE)
346 uart->port.icount.parity++; 348 uart->port.icount.parity++;
@@ -517,6 +519,14 @@ static void bfin_serial_mctrl_check(struct bfin_serial_port *uart)
517 */ 519 */
518static void bfin_serial_break_ctl(struct uart_port *port, int break_state) 520static void bfin_serial_break_ctl(struct uart_port *port, int break_state)
519{ 521{
522 struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
523 u16 lcr = UART_GET_LCR(uart);
524 if (break_state)
525 lcr |= SB;
526 else
527 lcr &= ~SB;
528 UART_PUT_LCR(uart, lcr);
529 SSYNC();
520} 530}
521 531
522static int bfin_serial_startup(struct uart_port *port) 532static int bfin_serial_startup(struct uart_port *port)
@@ -625,11 +635,12 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios,
625 635
626 if (termios->c_cflag & CSTOPB) 636 if (termios->c_cflag & CSTOPB)
627 lcr |= STB; 637 lcr |= STB;
628 if (termios->c_cflag & PARENB) { 638 if (termios->c_cflag & PARENB)
629 lcr |= PEN; 639 lcr |= PEN;
630 if (!(termios->c_cflag & PARODD)) 640 if (!(termios->c_cflag & PARODD))
631 lcr |= EPS; 641 lcr |= EPS;
632 } 642 if (termios->c_cflag & CMSPAR)
643 lcr |= STP;
633 644
634 port->read_status_mask = OE; 645 port->read_status_mask = OE;
635 if (termios->c_iflag & INPCK) 646 if (termios->c_iflag & INPCK)
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c
index 7d2d9ec6cac3..48587c27050d 100644
--- a/drivers/spi/spi_bfin5xx.c
+++ b/drivers/spi/spi_bfin5xx.c
@@ -582,14 +582,19 @@ static irqreturn_t dma_irq_handler(int irq, void *dev_id)
582 dev_dbg(&drv_data->pdev->dev, "in dma_irq_handler\n"); 582 dev_dbg(&drv_data->pdev->dev, "in dma_irq_handler\n");
583 clear_dma_irqstat(CH_SPI); 583 clear_dma_irqstat(CH_SPI);
584 584
585 /* Wait for DMA to complete */
586 while (get_dma_curr_irqstat(CH_SPI) & DMA_RUN)
587 continue;
588
585 /* 589 /*
586 * wait for the last transaction shifted out. yes, these two 590 * wait for the last transaction shifted out. HRM states:
587 * while loops are supposed to be the same (see the HRM). 591 * at this point there may still be data in the SPI DMA FIFO waiting
592 * to be transmitted ... software needs to poll TXS in the SPI_STAT
593 * register until it goes low for 2 successive reads
588 */ 594 */
589 if (drv_data->tx != NULL) { 595 if (drv_data->tx != NULL) {
590 while (bfin_read_SPI_STAT() & TXS) 596 while ((bfin_read_SPI_STAT() & TXS) ||
591 continue; 597 (bfin_read_SPI_STAT() & TXS))
592 while (bfin_read_SPI_STAT() & TXS)
593 continue; 598 continue;
594 } 599 }
595 600
@@ -1082,7 +1087,7 @@ static int setup(struct spi_device *spi)
1082 */ 1087 */
1083static void cleanup(struct spi_device *spi) 1088static void cleanup(struct spi_device *spi)
1084{ 1089{
1085 struct chip_data *chip = spi_get_ctldata((struct spi_device *)spi); 1090 struct chip_data *chip = spi_get_ctldata(spi);
1086 1091
1087 kfree(chip); 1092 kfree(chip);
1088} 1093}
diff --git a/drivers/video/console/sticore.c b/drivers/video/console/sticore.c
index 717b360d0415..870017d44970 100644
--- a/drivers/video/console/sticore.c
+++ b/drivers/video/console/sticore.c
@@ -240,7 +240,7 @@ static void sti_flush(unsigned long from, unsigned long len)
240 flush_icache_range(from, from+len); 240 flush_icache_range(from, from+len);
241} 241}
242 242
243void __init 243void __devinit
244sti_rom_copy(unsigned long base, unsigned long count, void *dest) 244sti_rom_copy(unsigned long base, unsigned long count, void *dest)
245{ 245{
246 unsigned long dest_len = count; 246 unsigned long dest_len = count;
@@ -269,7 +269,7 @@ sti_rom_copy(unsigned long base, unsigned long count, void *dest)
269static char default_sti_path[21] __read_mostly; 269static char default_sti_path[21] __read_mostly;
270 270
271#ifndef MODULE 271#ifndef MODULE
272static int __init sti_setup(char *str) 272static int __devinit sti_setup(char *str)
273{ 273{
274 if (str) 274 if (str)
275 strlcpy (default_sti_path, str, sizeof (default_sti_path)); 275 strlcpy (default_sti_path, str, sizeof (default_sti_path));
@@ -288,12 +288,12 @@ __setup("sti=", sti_setup);
288 288
289 289
290 290
291static char __initdata *font_name[MAX_STI_ROMS] = { "VGA8x16", }; 291static char __devinitdata *font_name[MAX_STI_ROMS] = { "VGA8x16", };
292static int __initdata font_index[MAX_STI_ROMS], 292static int __devinitdata font_index[MAX_STI_ROMS],
293 font_height[MAX_STI_ROMS], 293 font_height[MAX_STI_ROMS],
294 font_width[MAX_STI_ROMS]; 294 font_width[MAX_STI_ROMS];
295#ifndef MODULE 295#ifndef MODULE
296static int __init sti_font_setup(char *str) 296static int __devinit sti_font_setup(char *str)
297{ 297{
298 char *x; 298 char *x;
299 int i = 0; 299 int i = 0;
@@ -346,7 +346,7 @@ __setup("sti_font=", sti_font_setup);
346 346
347 347
348 348
349static void __init 349static void __devinit
350sti_dump_globcfg(struct sti_glob_cfg *glob_cfg, unsigned int sti_mem_request) 350sti_dump_globcfg(struct sti_glob_cfg *glob_cfg, unsigned int sti_mem_request)
351{ 351{
352 struct sti_glob_cfg_ext *cfg; 352 struct sti_glob_cfg_ext *cfg;
@@ -386,7 +386,7 @@ sti_dump_globcfg(struct sti_glob_cfg *glob_cfg, unsigned int sti_mem_request)
386 cfg->sti_mem_addr, sti_mem_request)); 386 cfg->sti_mem_addr, sti_mem_request));
387} 387}
388 388
389static void __init 389static void __devinit
390sti_dump_outptr(struct sti_struct *sti) 390sti_dump_outptr(struct sti_struct *sti)
391{ 391{
392 DPRINTK((KERN_INFO 392 DPRINTK((KERN_INFO
@@ -400,7 +400,7 @@ sti_dump_outptr(struct sti_struct *sti)
400 sti->outptr.attributes)); 400 sti->outptr.attributes));
401} 401}
402 402
403static int __init 403static int __devinit
404sti_init_glob_cfg(struct sti_struct *sti, 404sti_init_glob_cfg(struct sti_struct *sti,
405 unsigned long rom_address, unsigned long hpa) 405 unsigned long rom_address, unsigned long hpa)
406{ 406{
@@ -482,7 +482,7 @@ sti_init_glob_cfg(struct sti_struct *sti,
482} 482}
483 483
484#ifdef CONFIG_FB 484#ifdef CONFIG_FB
485struct sti_cooked_font * __init 485struct sti_cooked_font * __devinit
486sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name) 486sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name)
487{ 487{
488 const struct font_desc *fbfont; 488 const struct font_desc *fbfont;
@@ -538,14 +538,14 @@ sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name)
538 return cooked_font; 538 return cooked_font;
539} 539}
540#else 540#else
541struct sti_cooked_font * __init 541struct sti_cooked_font * __devinit
542sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name) 542sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name)
543{ 543{
544 return NULL; 544 return NULL;
545} 545}
546#endif 546#endif
547 547
548struct sti_cooked_font * __init 548struct sti_cooked_font * __devinit
549sti_select_font(struct sti_cooked_rom *rom, 549sti_select_font(struct sti_cooked_rom *rom,
550 int (*search_font_fnc) (struct sti_cooked_rom *,int,int) ) 550 int (*search_font_fnc) (struct sti_cooked_rom *,int,int) )
551{ 551{
@@ -572,7 +572,7 @@ sti_select_font(struct sti_cooked_rom *rom,
572} 572}
573 573
574 574
575static void __init 575static void __devinit
576sti_dump_rom(struct sti_rom *rom) 576sti_dump_rom(struct sti_rom *rom)
577{ 577{
578 printk(KERN_INFO " id %04x-%04x, conforms to spec rev. %d.%02x\n", 578 printk(KERN_INFO " id %04x-%04x, conforms to spec rev. %d.%02x\n",
@@ -590,7 +590,7 @@ sti_dump_rom(struct sti_rom *rom)
590} 590}
591 591
592 592
593static int __init 593static int __devinit
594sti_cook_fonts(struct sti_cooked_rom *cooked_rom, 594sti_cook_fonts(struct sti_cooked_rom *cooked_rom,
595 struct sti_rom *raw_rom) 595 struct sti_rom *raw_rom)
596{ 596{
@@ -625,7 +625,7 @@ sti_cook_fonts(struct sti_cooked_rom *cooked_rom,
625} 625}
626 626
627 627
628static int __init 628static int __devinit
629sti_search_font(struct sti_cooked_rom *rom, int height, int width) 629sti_search_font(struct sti_cooked_rom *rom, int height, int width)
630{ 630{
631 struct sti_cooked_font *font; 631 struct sti_cooked_font *font;
@@ -642,7 +642,7 @@ sti_search_font(struct sti_cooked_rom *rom, int height, int width)
642#define BMODE_RELOCATE(offset) offset = (offset) / 4; 642#define BMODE_RELOCATE(offset) offset = (offset) / 4;
643#define BMODE_LAST_ADDR_OFFS 0x50 643#define BMODE_LAST_ADDR_OFFS 0x50
644 644
645static void * __init 645static void * __devinit
646sti_bmode_font_raw(struct sti_cooked_font *f) 646sti_bmode_font_raw(struct sti_cooked_font *f)
647{ 647{
648 unsigned char *n, *p, *q; 648 unsigned char *n, *p, *q;
@@ -660,7 +660,7 @@ sti_bmode_font_raw(struct sti_cooked_font *f)
660 return n + 3; 660 return n + 3;
661} 661}
662 662
663static void __init 663static void __devinit
664sti_bmode_rom_copy(unsigned long base, unsigned long count, void *dest) 664sti_bmode_rom_copy(unsigned long base, unsigned long count, void *dest)
665{ 665{
666 unsigned long dest_len = count; 666 unsigned long dest_len = count;
@@ -675,7 +675,7 @@ sti_bmode_rom_copy(unsigned long base, unsigned long count, void *dest)
675 sti_flush(dest_start, dest_len); 675 sti_flush(dest_start, dest_len);
676} 676}
677 677
678static struct sti_rom * __init 678static struct sti_rom * __devinit
679sti_get_bmode_rom (unsigned long address) 679sti_get_bmode_rom (unsigned long address)
680{ 680{
681 struct sti_rom *raw; 681 struct sti_rom *raw;
@@ -711,7 +711,7 @@ sti_get_bmode_rom (unsigned long address)
711 return raw; 711 return raw;
712} 712}
713 713
714struct sti_rom * __init 714struct sti_rom * __devinit
715sti_get_wmode_rom (unsigned long address) 715sti_get_wmode_rom (unsigned long address)
716{ 716{
717 struct sti_rom *raw; 717 struct sti_rom *raw;
@@ -727,7 +727,7 @@ sti_get_wmode_rom (unsigned long address)
727 return raw; 727 return raw;
728} 728}
729 729
730int __init 730int __devinit
731sti_read_rom(int wordmode, struct sti_struct *sti, unsigned long address) 731sti_read_rom(int wordmode, struct sti_struct *sti, unsigned long address)
732{ 732{
733 struct sti_cooked_rom *cooked; 733 struct sti_cooked_rom *cooked;
@@ -783,7 +783,7 @@ out_err:
783 return 0; 783 return 0;
784} 784}
785 785
786static struct sti_struct * __init 786static struct sti_struct * __devinit
787sti_try_rom_generic(unsigned long address, unsigned long hpa, struct pci_dev *pd) 787sti_try_rom_generic(unsigned long address, unsigned long hpa, struct pci_dev *pd)
788{ 788{
789 struct sti_struct *sti; 789 struct sti_struct *sti;
@@ -898,7 +898,7 @@ out_err:
898 return NULL; 898 return NULL;
899} 899}
900 900
901static void __init sticore_check_for_default_sti(struct sti_struct *sti, char *path) 901static void __devinit sticore_check_for_default_sti(struct sti_struct *sti, char *path)
902{ 902{
903 if (strcmp (path, default_sti_path) == 0) 903 if (strcmp (path, default_sti_path) == 0)
904 default_sti = sti; 904 default_sti = sti;
@@ -909,7 +909,7 @@ static void __init sticore_check_for_default_sti(struct sti_struct *sti, char *p
909 * in the additional address field addr[1] while on 909 * in the additional address field addr[1] while on
910 * older Systems the PDC stores it in page0->proc_sti 910 * older Systems the PDC stores it in page0->proc_sti
911 */ 911 */
912static int __init sticore_pa_init(struct parisc_device *dev) 912static int __devinit sticore_pa_init(struct parisc_device *dev)
913{ 913{
914 char pa_path[21]; 914 char pa_path[21];
915 struct sti_struct *sti = NULL; 915 struct sti_struct *sti = NULL;
@@ -1015,7 +1015,7 @@ static struct parisc_driver pa_sti_driver = {
1015 1015
1016static int sticore_initialized __read_mostly; 1016static int sticore_initialized __read_mostly;
1017 1017
1018static void __init sti_init_roms(void) 1018static void __devinit sti_init_roms(void)
1019{ 1019{
1020 if (sticore_initialized) 1020 if (sticore_initialized)
1021 return; 1021 return;
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 9804c0cdcb42..cc5efc13496a 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -655,10 +655,9 @@ static int fuse_get_sb_blk(struct file_system_type *fs_type,
655static struct file_system_type fuseblk_fs_type = { 655static struct file_system_type fuseblk_fs_type = {
656 .owner = THIS_MODULE, 656 .owner = THIS_MODULE,
657 .name = "fuseblk", 657 .name = "fuseblk",
658 .fs_flags = FS_HAS_SUBTYPE,
659 .get_sb = fuse_get_sb_blk, 658 .get_sb = fuse_get_sb_blk,
660 .kill_sb = kill_block_super, 659 .kill_sb = kill_block_super,
661 .fs_flags = FS_REQUIRES_DEV, 660 .fs_flags = FS_REQUIRES_DEV | FS_HAS_SUBTYPE,
662}; 661};
663 662
664static inline int register_fuseblk(void) 663static inline int register_fuseblk(void)
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index aa083dd34e92..e6b46b3ac2fe 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -736,15 +736,13 @@ static int can_do_hugetlb_shm(void)
736 can_do_mlock()); 736 can_do_mlock());
737} 737}
738 738
739struct file *hugetlb_zero_setup(size_t size) 739struct file *hugetlb_file_setup(const char *name, size_t size)
740{ 740{
741 int error = -ENOMEM; 741 int error = -ENOMEM;
742 struct file *file; 742 struct file *file;
743 struct inode *inode; 743 struct inode *inode;
744 struct dentry *dentry, *root; 744 struct dentry *dentry, *root;
745 struct qstr quick_string; 745 struct qstr quick_string;
746 char buf[16];
747 static atomic_t counter;
748 746
749 if (!hugetlbfs_vfsmount) 747 if (!hugetlbfs_vfsmount)
750 return ERR_PTR(-ENOENT); 748 return ERR_PTR(-ENOENT);
@@ -756,8 +754,7 @@ struct file *hugetlb_zero_setup(size_t size)
756 return ERR_PTR(-ENOMEM); 754 return ERR_PTR(-ENOMEM);
757 755
758 root = hugetlbfs_vfsmount->mnt_root; 756 root = hugetlbfs_vfsmount->mnt_root;
759 snprintf(buf, 16, "%u", atomic_inc_return(&counter)); 757 quick_string.name = name;
760 quick_string.name = buf;
761 quick_string.len = strlen(quick_string.name); 758 quick_string.len = strlen(quick_string.name);
762 quick_string.hash = 0; 759 quick_string.hash = 0;
763 dentry = d_alloc(root, &quick_string); 760 dentry = d_alloc(root, &quick_string);
diff --git a/fs/splice.c b/fs/splice.c
index cb211360273a..e7d7080de2f9 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -176,6 +176,7 @@ static const struct pipe_buf_operations user_page_pipe_buf_ops = {
176static ssize_t splice_to_pipe(struct pipe_inode_info *pipe, 176static ssize_t splice_to_pipe(struct pipe_inode_info *pipe,
177 struct splice_pipe_desc *spd) 177 struct splice_pipe_desc *spd)
178{ 178{
179 unsigned int spd_pages = spd->nr_pages;
179 int ret, do_wakeup, page_nr; 180 int ret, do_wakeup, page_nr;
180 181
181 ret = 0; 182 ret = 0;
@@ -244,17 +245,18 @@ static ssize_t splice_to_pipe(struct pipe_inode_info *pipe,
244 pipe->waiting_writers--; 245 pipe->waiting_writers--;
245 } 246 }
246 247
247 if (pipe->inode) 248 if (pipe->inode) {
248 mutex_unlock(&pipe->inode->i_mutex); 249 mutex_unlock(&pipe->inode->i_mutex);
249 250
250 if (do_wakeup) { 251 if (do_wakeup) {
251 smp_mb(); 252 smp_mb();
252 if (waitqueue_active(&pipe->wait)) 253 if (waitqueue_active(&pipe->wait))
253 wake_up_interruptible(&pipe->wait); 254 wake_up_interruptible(&pipe->wait);
254 kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN); 255 kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
256 }
255 } 257 }
256 258
257 while (page_nr < spd->nr_pages) 259 while (page_nr < spd_pages)
258 page_cache_release(spd->pages[page_nr++]); 260 page_cache_release(spd->pages[page_nr++]);
259 261
260 return ret; 262 return ret;
@@ -811,7 +813,10 @@ generic_file_splice_write_nolock(struct pipe_inode_info *pipe, struct file *out,
811 813
812 ret = __splice_from_pipe(pipe, out, ppos, len, flags, pipe_to_file); 814 ret = __splice_from_pipe(pipe, out, ppos, len, flags, pipe_to_file);
813 if (ret > 0) { 815 if (ret > 0) {
816 unsigned long nr_pages;
817
814 *ppos += ret; 818 *ppos += ret;
819 nr_pages = (ret + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
815 820
816 /* 821 /*
817 * If file or inode is SYNC and we actually wrote some data, 822 * If file or inode is SYNC and we actually wrote some data,
@@ -824,7 +829,7 @@ generic_file_splice_write_nolock(struct pipe_inode_info *pipe, struct file *out,
824 if (err) 829 if (err)
825 ret = err; 830 ret = err;
826 } 831 }
827 balance_dirty_pages_ratelimited(mapping); 832 balance_dirty_pages_ratelimited_nr(mapping, nr_pages);
828 } 833 }
829 834
830 return ret; 835 return ret;
@@ -863,7 +868,10 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out,
863 868
864 ret = splice_from_pipe(pipe, out, ppos, len, flags, pipe_to_file); 869 ret = splice_from_pipe(pipe, out, ppos, len, flags, pipe_to_file);
865 if (ret > 0) { 870 if (ret > 0) {
871 unsigned long nr_pages;
872
866 *ppos += ret; 873 *ppos += ret;
874 nr_pages = (ret + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
867 875
868 /* 876 /*
869 * If file or inode is SYNC and we actually wrote some data, 877 * If file or inode is SYNC and we actually wrote some data,
@@ -878,7 +886,7 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out,
878 if (err) 886 if (err)
879 ret = err; 887 ret = err;
880 } 888 }
881 balance_dirty_pages_ratelimited(mapping); 889 balance_dirty_pages_ratelimited_nr(mapping, nr_pages);
882 } 890 }
883 891
884 return ret; 892 return ret;
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index 85a668680f82..c4342a019972 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -13,14 +13,26 @@
13#include "sysfs.h" 13#include "sysfs.h"
14 14
15DECLARE_RWSEM(sysfs_rename_sem); 15DECLARE_RWSEM(sysfs_rename_sem);
16spinlock_t sysfs_lock = SPIN_LOCK_UNLOCKED;
16 17
17static void sysfs_d_iput(struct dentry * dentry, struct inode * inode) 18static void sysfs_d_iput(struct dentry * dentry, struct inode * inode)
18{ 19{
19 struct sysfs_dirent * sd = dentry->d_fsdata; 20 struct sysfs_dirent * sd = dentry->d_fsdata;
20 21
21 if (sd) { 22 if (sd) {
22 BUG_ON(sd->s_dentry != dentry); 23 /* sd->s_dentry is protected with sysfs_lock. This
23 sd->s_dentry = NULL; 24 * allows sysfs_drop_dentry() to dereference it.
25 */
26 spin_lock(&sysfs_lock);
27
28 /* The dentry might have been deleted or another
29 * lookup could have happened updating sd->s_dentry to
30 * point the new dentry. Ignore if it isn't pointing
31 * to this dentry.
32 */
33 if (sd->s_dentry == dentry)
34 sd->s_dentry = NULL;
35 spin_unlock(&sysfs_lock);
24 sysfs_put(sd); 36 sysfs_put(sd);
25 } 37 }
26 iput(inode); 38 iput(inode);
@@ -30,6 +42,14 @@ static struct dentry_operations sysfs_dentry_ops = {
30 .d_iput = sysfs_d_iput, 42 .d_iput = sysfs_d_iput,
31}; 43};
32 44
45static unsigned int sysfs_inode_counter;
46ino_t sysfs_get_inum(void)
47{
48 if (unlikely(sysfs_inode_counter < 3))
49 sysfs_inode_counter = 3;
50 return sysfs_inode_counter++;
51}
52
33/* 53/*
34 * Allocates a new sysfs_dirent and links it to the parent sysfs_dirent 54 * Allocates a new sysfs_dirent and links it to the parent sysfs_dirent
35 */ 55 */
@@ -41,6 +61,7 @@ static struct sysfs_dirent * __sysfs_new_dirent(void * element)
41 if (!sd) 61 if (!sd)
42 return NULL; 62 return NULL;
43 63
64 sd->s_ino = sysfs_get_inum();
44 atomic_set(&sd->s_count, 1); 65 atomic_set(&sd->s_count, 1);
45 atomic_set(&sd->s_event, 1); 66 atomic_set(&sd->s_event, 1);
46 INIT_LIST_HEAD(&sd->s_children); 67 INIT_LIST_HEAD(&sd->s_children);
@@ -238,7 +259,10 @@ static int sysfs_attach_attr(struct sysfs_dirent * sd, struct dentry * dentry)
238 } 259 }
239 260
240 dentry->d_fsdata = sysfs_get(sd); 261 dentry->d_fsdata = sysfs_get(sd);
262 /* protect sd->s_dentry against sysfs_d_iput */
263 spin_lock(&sysfs_lock);
241 sd->s_dentry = dentry; 264 sd->s_dentry = dentry;
265 spin_unlock(&sysfs_lock);
242 error = sysfs_create(dentry, (attr->mode & S_IALLUGO) | S_IFREG, init); 266 error = sysfs_create(dentry, (attr->mode & S_IALLUGO) | S_IFREG, init);
243 if (error) { 267 if (error) {
244 sysfs_put(sd); 268 sysfs_put(sd);
@@ -260,7 +284,10 @@ static int sysfs_attach_link(struct sysfs_dirent * sd, struct dentry * dentry)
260 int err = 0; 284 int err = 0;
261 285
262 dentry->d_fsdata = sysfs_get(sd); 286 dentry->d_fsdata = sysfs_get(sd);
287 /* protect sd->s_dentry against sysfs_d_iput */
288 spin_lock(&sysfs_lock);
263 sd->s_dentry = dentry; 289 sd->s_dentry = dentry;
290 spin_unlock(&sysfs_lock);
264 err = sysfs_create(dentry, S_IFLNK|S_IRWXUGO, init_symlink); 291 err = sysfs_create(dentry, S_IFLNK|S_IRWXUGO, init_symlink);
265 if (!err) { 292 if (!err) {
266 dentry->d_op = &sysfs_dentry_ops; 293 dentry->d_op = &sysfs_dentry_ops;
@@ -509,7 +536,7 @@ static int sysfs_readdir(struct file * filp, void * dirent, filldir_t filldir)
509 536
510 switch (i) { 537 switch (i) {
511 case 0: 538 case 0:
512 ino = dentry->d_inode->i_ino; 539 ino = parent_sd->s_ino;
513 if (filldir(dirent, ".", 1, i, ino, DT_DIR) < 0) 540 if (filldir(dirent, ".", 1, i, ino, DT_DIR) < 0)
514 break; 541 break;
515 filp->f_pos++; 542 filp->f_pos++;
@@ -538,10 +565,7 @@ static int sysfs_readdir(struct file * filp, void * dirent, filldir_t filldir)
538 565
539 name = sysfs_get_name(next); 566 name = sysfs_get_name(next);
540 len = strlen(name); 567 len = strlen(name);
541 if (next->s_dentry) 568 ino = next->s_ino;
542 ino = next->s_dentry->d_inode->i_ino;
543 else
544 ino = iunique(sysfs_sb, 2);
545 569
546 if (filldir(dirent, name, len, filp->f_pos, ino, 570 if (filldir(dirent, name, len, filp->f_pos, ino,
547 dt_type(next)) < 0) 571 dt_type(next)) < 0)
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c
index bdd30e74de6b..5266eec15f6e 100644
--- a/fs/sysfs/inode.c
+++ b/fs/sysfs/inode.c
@@ -141,6 +141,7 @@ struct inode * sysfs_new_inode(mode_t mode, struct sysfs_dirent * sd)
141 inode->i_mapping->a_ops = &sysfs_aops; 141 inode->i_mapping->a_ops = &sysfs_aops;
142 inode->i_mapping->backing_dev_info = &sysfs_backing_dev_info; 142 inode->i_mapping->backing_dev_info = &sysfs_backing_dev_info;
143 inode->i_op = &sysfs_inode_operations; 143 inode->i_op = &sysfs_inode_operations;
144 inode->i_ino = sd->s_ino;
144 lockdep_set_class(&inode->i_mutex, &sysfs_inode_imutex_key); 145 lockdep_set_class(&inode->i_mutex, &sysfs_inode_imutex_key);
145 146
146 if (sd->s_iattr) { 147 if (sd->s_iattr) {
@@ -245,13 +246,27 @@ static inline void orphan_all_buffers(struct inode *node)
245 */ 246 */
246void sysfs_drop_dentry(struct sysfs_dirent * sd, struct dentry * parent) 247void sysfs_drop_dentry(struct sysfs_dirent * sd, struct dentry * parent)
247{ 248{
248 struct dentry * dentry = sd->s_dentry; 249 struct dentry *dentry = NULL;
249 struct inode *inode; 250 struct inode *inode;
250 251
252 /* We're not holding a reference to ->s_dentry dentry but the
253 * field will stay valid as long as sysfs_lock is held.
254 */
255 spin_lock(&sysfs_lock);
256 spin_lock(&dcache_lock);
257
258 /* dget dentry if it's still alive */
259 if (sd->s_dentry && sd->s_dentry->d_inode)
260 dentry = dget_locked(sd->s_dentry);
261
262 spin_unlock(&dcache_lock);
263 spin_unlock(&sysfs_lock);
264
265 /* drop dentry */
251 if (dentry) { 266 if (dentry) {
252 spin_lock(&dcache_lock); 267 spin_lock(&dcache_lock);
253 spin_lock(&dentry->d_lock); 268 spin_lock(&dentry->d_lock);
254 if (!(d_unhashed(dentry) && dentry->d_inode)) { 269 if (!d_unhashed(dentry) && dentry->d_inode) {
255 inode = dentry->d_inode; 270 inode = dentry->d_inode;
256 spin_lock(&inode->i_lock); 271 spin_lock(&inode->i_lock);
257 __iget(inode); 272 __iget(inode);
@@ -267,6 +282,8 @@ void sysfs_drop_dentry(struct sysfs_dirent * sd, struct dentry * parent)
267 spin_unlock(&dentry->d_lock); 282 spin_unlock(&dentry->d_lock);
268 spin_unlock(&dcache_lock); 283 spin_unlock(&dcache_lock);
269 } 284 }
285
286 dput(dentry);
270 } 287 }
271} 288}
272 289
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c
index 23a48a38e6af..00ab9125d398 100644
--- a/fs/sysfs/mount.c
+++ b/fs/sysfs/mount.c
@@ -33,6 +33,7 @@ static struct sysfs_dirent sysfs_root = {
33 .s_element = NULL, 33 .s_element = NULL,
34 .s_type = SYSFS_ROOT, 34 .s_type = SYSFS_ROOT,
35 .s_iattr = NULL, 35 .s_iattr = NULL,
36 .s_ino = 1,
36}; 37};
37 38
38static void sysfs_clear_inode(struct inode *inode) 39static void sysfs_clear_inode(struct inode *inode)
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h
index a77c57e5a6d5..502c949c402d 100644
--- a/fs/sysfs/sysfs.h
+++ b/fs/sysfs/sysfs.h
@@ -5,6 +5,7 @@ struct sysfs_dirent {
5 void * s_element; 5 void * s_element;
6 int s_type; 6 int s_type;
7 umode_t s_mode; 7 umode_t s_mode;
8 ino_t s_ino;
8 struct dentry * s_dentry; 9 struct dentry * s_dentry;
9 struct iattr * s_iattr; 10 struct iattr * s_iattr;
10 atomic_t s_event; 11 atomic_t s_event;
@@ -32,6 +33,7 @@ extern const unsigned char * sysfs_get_name(struct sysfs_dirent *sd);
32extern void sysfs_drop_dentry(struct sysfs_dirent *sd, struct dentry *parent); 33extern void sysfs_drop_dentry(struct sysfs_dirent *sd, struct dentry *parent);
33extern int sysfs_setattr(struct dentry *dentry, struct iattr *iattr); 34extern int sysfs_setattr(struct dentry *dentry, struct iattr *iattr);
34 35
36extern spinlock_t sysfs_lock;
35extern struct rw_semaphore sysfs_rename_sem; 37extern struct rw_semaphore sysfs_rename_sem;
36extern struct super_block * sysfs_sb; 38extern struct super_block * sysfs_sb;
37extern const struct file_operations sysfs_dir_operations; 39extern const struct file_operations sysfs_dir_operations;
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 1f0129405cf4..bf7de0bdbab3 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -100,14 +100,23 @@ no_delete:
100 clear_inode(inode); 100 clear_inode(inode);
101} 101}
102 102
103/*
104 * If we are going to release inode from memory, we discard preallocation and
105 * truncate last inode extent to proper length. We could use drop_inode() but
106 * it's called under inode_lock and thus we cannot mark inode dirty there. We
107 * use clear_inode() but we have to make sure to write inode as it's not written
108 * automatically.
109 */
103void udf_clear_inode(struct inode *inode) 110void udf_clear_inode(struct inode *inode)
104{ 111{
105 if (!(inode->i_sb->s_flags & MS_RDONLY)) { 112 if (!(inode->i_sb->s_flags & MS_RDONLY)) {
106 lock_kernel(); 113 lock_kernel();
114 /* Discard preallocation for directories, symlinks, etc. */
107 udf_discard_prealloc(inode); 115 udf_discard_prealloc(inode);
116 udf_truncate_tail_extent(inode);
108 unlock_kernel(); 117 unlock_kernel();
118 write_inode_now(inode, 1);
109 } 119 }
110
111 kfree(UDF_I_DATA(inode)); 120 kfree(UDF_I_DATA(inode));
112 UDF_I_DATA(inode) = NULL; 121 UDF_I_DATA(inode) = NULL;
113} 122}
diff --git a/fs/udf/truncate.c b/fs/udf/truncate.c
index 77975ae291a5..60d277644248 100644
--- a/fs/udf/truncate.c
+++ b/fs/udf/truncate.c
@@ -61,7 +61,11 @@ static void extent_trunc(struct inode * inode, struct extent_position *epos,
61 } 61 }
62} 62}
63 63
64void udf_discard_prealloc(struct inode * inode) 64/*
65 * Truncate the last extent to match i_size. This function assumes
66 * that preallocation extent is already truncated.
67 */
68void udf_truncate_tail_extent(struct inode *inode)
65{ 69{
66 struct extent_position epos = { NULL, 0, {0, 0}}; 70 struct extent_position epos = { NULL, 0, {0, 0}};
67 kernel_lb_addr eloc; 71 kernel_lb_addr eloc;
@@ -71,7 +75,10 @@ void udf_discard_prealloc(struct inode * inode)
71 int adsize; 75 int adsize;
72 76
73 if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB || 77 if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB ||
74 inode->i_size == UDF_I_LENEXTENTS(inode)) 78 inode->i_size == UDF_I_LENEXTENTS(inode))
79 return;
80 /* Are we going to delete the file anyway? */
81 if (inode->i_nlink == 0)
75 return; 82 return;
76 83
77 if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_SHORT) 84 if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_SHORT)
@@ -79,36 +86,76 @@ void udf_discard_prealloc(struct inode * inode)
79 else if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_LONG) 86 else if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_LONG)
80 adsize = sizeof(long_ad); 87 adsize = sizeof(long_ad);
81 else 88 else
82 adsize = 0; 89 BUG();
83
84 epos.block = UDF_I_LOCATION(inode);
85 90
86 /* Find the last extent in the file */ 91 /* Find the last extent in the file */
87 while ((netype = udf_next_aext(inode, &epos, &eloc, &elen, 1)) != -1) 92 while ((netype = udf_next_aext(inode, &epos, &eloc, &elen, 1)) != -1)
88 { 93 {
89 etype = netype; 94 etype = netype;
90 lbcount += elen; 95 lbcount += elen;
91 if (lbcount > inode->i_size && lbcount - elen < inode->i_size) 96 if (lbcount > inode->i_size) {
92 { 97 if (lbcount - inode->i_size >= inode->i_sb->s_blocksize)
93 WARN_ON(lbcount - inode->i_size >= inode->i_sb->s_blocksize); 98 printk(KERN_WARNING
99 "udf_truncate_tail_extent(): Too long "
100 "extent after EOF in inode %u: i_size: "
101 "%Ld lbcount: %Ld extent %u+%u\n",
102 (unsigned)inode->i_ino,
103 (long long)inode->i_size,
104 (long long)lbcount,
105 (unsigned)eloc.logicalBlockNum,
106 (unsigned)elen);
94 nelen = elen - (lbcount - inode->i_size); 107 nelen = elen - (lbcount - inode->i_size);
95 epos.offset -= adsize; 108 epos.offset -= adsize;
96 extent_trunc(inode, &epos, eloc, etype, elen, nelen); 109 extent_trunc(inode, &epos, eloc, etype, elen, nelen);
97 epos.offset += adsize; 110 epos.offset += adsize;
98 lbcount = inode->i_size; 111 if (udf_next_aext(inode, &epos, &eloc, &elen, 1) != -1)
112 printk(KERN_ERR "udf_truncate_tail_extent(): "
113 "Extent after EOF in inode %u.\n",
114 (unsigned)inode->i_ino);
115 break;
99 } 116 }
100 } 117 }
118 /* This inode entry is in-memory only and thus we don't have to mark
119 * the inode dirty */
120 UDF_I_LENEXTENTS(inode) = inode->i_size;
121 brelse(epos.bh);
122}
123
124void udf_discard_prealloc(struct inode *inode)
125{
126 struct extent_position epos = { NULL, 0, {0, 0}};
127 kernel_lb_addr eloc;
128 uint32_t elen;
129 uint64_t lbcount = 0;
130 int8_t etype = -1, netype;
131 int adsize;
132
133 if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB ||
134 inode->i_size == UDF_I_LENEXTENTS(inode))
135 return;
136
137 if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_SHORT)
138 adsize = sizeof(short_ad);
139 else if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_LONG)
140 adsize = sizeof(long_ad);
141 else
142 adsize = 0;
143
144 epos.block = UDF_I_LOCATION(inode);
145
146 /* Find the last extent in the file */
147 while ((netype = udf_next_aext(inode, &epos, &eloc, &elen, 1)) != -1) {
148 etype = netype;
149 lbcount += elen;
150 }
101 if (etype == (EXT_NOT_RECORDED_ALLOCATED >> 30)) { 151 if (etype == (EXT_NOT_RECORDED_ALLOCATED >> 30)) {
102 epos.offset -= adsize; 152 epos.offset -= adsize;
103 lbcount -= elen; 153 lbcount -= elen;
104 extent_trunc(inode, &epos, eloc, etype, elen, 0); 154 extent_trunc(inode, &epos, eloc, etype, elen, 0);
105 if (!epos.bh) 155 if (!epos.bh) {
106 {
107 UDF_I_LENALLOC(inode) = epos.offset - udf_file_entry_alloc_offset(inode); 156 UDF_I_LENALLOC(inode) = epos.offset - udf_file_entry_alloc_offset(inode);
108 mark_inode_dirty(inode); 157 mark_inode_dirty(inode);
109 } 158 } else {
110 else
111 {
112 struct allocExtDesc *aed = (struct allocExtDesc *)(epos.bh->b_data); 159 struct allocExtDesc *aed = (struct allocExtDesc *)(epos.bh->b_data);
113 aed->lengthAllocDescs = cpu_to_le32(epos.offset - sizeof(struct allocExtDesc)); 160 aed->lengthAllocDescs = cpu_to_le32(epos.offset - sizeof(struct allocExtDesc));
114 if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || UDF_SB_UDFREV(inode->i_sb) >= 0x0201) 161 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)
118 mark_buffer_dirty_inode(epos.bh, inode); 165 mark_buffer_dirty_inode(epos.bh, inode);
119 } 166 }
120 } 167 }
168 /* This inode entry is in-memory only and thus we don't have to mark
169 * the inode dirty */
121 UDF_I_LENEXTENTS(inode) = lbcount; 170 UDF_I_LENEXTENTS(inode) = lbcount;
122
123 WARN_ON(lbcount != inode->i_size);
124 brelse(epos.bh); 171 brelse(epos.bh);
125} 172}
126 173
diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h
index 67ded289497c..f581f2f69c0f 100644
--- a/fs/udf/udfdecl.h
+++ b/fs/udf/udfdecl.h
@@ -146,6 +146,7 @@ extern void udf_free_inode(struct inode *);
146extern struct inode * udf_new_inode (struct inode *, int, int *); 146extern struct inode * udf_new_inode (struct inode *, int, int *);
147 147
148/* truncate.c */ 148/* truncate.c */
149extern void udf_truncate_tail_extent(struct inode *);
149extern void udf_discard_prealloc(struct inode *); 150extern void udf_discard_prealloc(struct inode *);
150extern void udf_truncate_extents(struct inode *); 151extern void udf_truncate_extents(struct inode *);
151 152
diff --git a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c
index 86fb671a8bcc..ed90403f0ee7 100644
--- a/fs/xfs/linux-2.6/xfs_lrw.c
+++ b/fs/xfs/linux-2.6/xfs_lrw.c
@@ -159,7 +159,7 @@ xfs_iozero(
159 if (status) 159 if (status)
160 goto unlock; 160 goto unlock;
161 161
162 memclear_highpage_flush(page, offset, bytes); 162 zero_user_page(page, offset, bytes, KM_USER0);
163 163
164 status = mapping->a_ops->commit_write(NULL, page, offset, 164 status = mapping->a_ops->commit_write(NULL, page, offset,
165 offset + bytes); 165 offset + bytes);
diff --git a/include/asm-arm/arch-s3c2410/anubis-cpld.h b/include/asm-arm/arch-s3c2410/anubis-cpld.h
index dcebf6d61903..168b93fee529 100644
--- a/include/asm-arm/arch-s3c2410/anubis-cpld.h
+++ b/include/asm-arm/arch-s3c2410/anubis-cpld.h
@@ -18,4 +18,8 @@
18 18
19#define ANUBIS_CTRL1_NANDSEL (0x3) 19#define ANUBIS_CTRL1_NANDSEL (0x3)
20 20
21/* IDREG - revision */
22
23#define ANUBIS_IDREG_REVMASK (0x7)
24
21#endif /* __ASM_ARCH_ANUBISCPLD_H */ 25#endif /* __ASM_ARCH_ANUBISCPLD_H */
diff --git a/include/asm-arm/arch-s3c2410/anubis-map.h b/include/asm-arm/arch-s3c2410/anubis-map.h
index ab076de4a0d0..830d114261da 100644
--- a/include/asm-arm/arch-s3c2410/anubis-map.h
+++ b/include/asm-arm/arch-s3c2410/anubis-map.h
@@ -27,14 +27,8 @@
27#define ANUBIS_VA_CTRL1 ANUBIS_IOADDR(0x00000000) /* 0x01800000 */ 27#define ANUBIS_VA_CTRL1 ANUBIS_IOADDR(0x00000000) /* 0x01800000 */
28#define ANUBIS_PA_CTRL1 (ANUBIS_PA_CPLD) 28#define ANUBIS_PA_CTRL1 (ANUBIS_PA_CPLD)
29 29
30#define ANUBIS_VA_CTRL2 ANUBIS_IOADDR(0x00100000) /* 0x01900000 */ 30#define ANUBIS_VA_IDREG ANUBIS_IOADDR(0x00300000) /* 0x01B00000 */
31#define ANUBIS_PA_CTRL2 (ANUBIS_PA_CPLD) 31#define ANUBIS_PA_IDREG (ANUBIS_PA_CPLD + (3<<23))
32
33#define ANUBIS_VA_CTRL3 ANUBIS_IOADDR(0x00200000) /* 0x01A00000 */
34#define ANUBIS_PA_CTRL3 (ANUBIS_PA_CPLD)
35
36#define ANUBIS_VA_CTRL4 ANUBIS_IOADDR(0x00300000) /* 0x01B00000 */
37#define ANUBIS_PA_CTRL4 (ANUBIS_PA_CPLD)
38 32
39#define ANUBIS_IDEPRI ANUBIS_IOADDR(0x01000000) 33#define ANUBIS_IDEPRI ANUBIS_IOADDR(0x01000000)
40#define ANUBIS_IDEPRIAUX ANUBIS_IOADDR(0x01100000) 34#define ANUBIS_IDEPRIAUX ANUBIS_IOADDR(0x01100000)
diff --git a/include/asm-arm/arch-s3c2410/osiris-cpld.h b/include/asm-arm/arch-s3c2410/osiris-cpld.h
index 3b6498468d62..229ab2351db6 100644
--- a/include/asm-arm/arch-s3c2410/osiris-cpld.h
+++ b/include/asm-arm/arch-s3c2410/osiris-cpld.h
@@ -1,6 +1,6 @@
1/* linux/include/asm-arm/arch-s3c2410/osiris-cpld.h 1/* linux/include/asm-arm/arch-s3c2410/osiris-cpld.h
2 * 2 *
3 * Copyright (c) 2005 Simtec Electronics 3 * Copyright 2005 Simtec Electronics
4 * http://www.simtec.co.uk/products/ 4 * http://www.simtec.co.uk/products/
5 * Ben Dooks <ben@simtec.co.uk> 5 * Ben Dooks <ben@simtec.co.uk>
6 * 6 *
@@ -14,12 +14,17 @@
14#ifndef __ASM_ARCH_OSIRISCPLD_H 14#ifndef __ASM_ARCH_OSIRISCPLD_H
15#define __ASM_ARCH_OSIRISCPLD_H 15#define __ASM_ARCH_OSIRISCPLD_H
16 16
17/* CTRL1 - NAND WP control */ 17/* CTRL0 - NAND WP control */
18 18
19#define OSIRIS_CTRL1_NANDSEL (0x3) 19#define OSIRIS_CTRL0_NANDSEL (0x3)
20#define OSIRIS_CTRL1_BOOT_INT (1<<3) 20#define OSIRIS_CTRL0_BOOT_INT (1<<3)
21#define OSIRIS_CTRL1_PCMCIA (1<<4) 21#define OSIRIS_CTRL0_PCMCIA (1<<4)
22#define OSIRIS_CTRL1_PCMCIA_nWAIT (1<<6) 22#define OSIRIS_CTRL0_FIX8 (1<<5)
23#define OSIRIS_CTRL1_PCMCIA_nIOIS16 (1<<7) 23#define OSIRIS_CTRL0_PCMCIA_nWAIT (1<<6)
24#define OSIRIS_CTRL0_PCMCIA_nIOIS16 (1<<7)
25
26#define OSIRIS_CTRL1_FIX8 (1<<0)
27
28#define OSIRIS_ID_REVMASK (0x7)
24 29
25#endif /* __ASM_ARCH_OSIRISCPLD_H */ 30#endif /* __ASM_ARCH_OSIRISCPLD_H */
diff --git a/include/asm-arm/arch-s3c2410/osiris-map.h b/include/asm-arm/arch-s3c2410/osiris-map.h
index a14164dfa525..b5c74d2b9aaa 100644
--- a/include/asm-arm/arch-s3c2410/osiris-map.h
+++ b/include/asm-arm/arch-s3c2410/osiris-map.h
@@ -24,16 +24,19 @@
24 24
25/* we put the CPLD registers next, to get them out of the way */ 25/* we put the CPLD registers next, to get them out of the way */
26 26
27#define OSIRIS_VA_CTRL1 OSIRIS_IOADDR(0x00000000) 27#define OSIRIS_VA_CTRL0 OSIRIS_IOADDR(0x00000000)
28#define OSIRIS_PA_CTRL1 (OSIRIS_PA_CPLD) 28#define OSIRIS_PA_CTRL0 (OSIRIS_PA_CPLD)
29 29
30#define OSIRIS_VA_CTRL2 OSIRIS_IOADDR(0x00100000) 30#define OSIRIS_VA_CTRL1 OSIRIS_IOADDR(0x00100000)
31#define OSIRIS_PA_CTRL2 (OSIRIS_PA_CPLD + (1<<23)) 31#define OSIRIS_PA_CTRL1 (OSIRIS_PA_CPLD + (1<<23))
32 32
33#define OSIRIS_VA_CTRL3 OSIRIS_IOADDR(0x00200000) 33#define OSIRIS_VA_CTRL2 OSIRIS_IOADDR(0x00200000)
34#define OSIRIS_PA_CTRL3 (OSIRIS_PA_CPLD + (2<<23)) 34#define OSIRIS_PA_CTRL2 (OSIRIS_PA_CPLD + (2<<23))
35 35
36#define OSIRIS_VA_CTRL4 OSIRIS_IOADDR(0x00300000) 36#define OSIRIS_VA_CTRL3 OSIRIS_IOADDR(0x00300000)
37#define OSIRIS_PA_CTRL4 (OSIRIS_PA_CPLD + (3<<23)) 37#define OSIRIS_PA_CTRL3 (OSIRIS_PA_CPLD + (2<<23))
38
39#define OSIRIS_VA_IDREG OSIRIS_IOADDR(0x00700000)
40#define OSIRIS_PA_IDREG (OSIRIS_PA_CPLD + (7<<23))
38 41
39#endif /* __ASM_ARCH_OSIRISMAP_H */ 42#endif /* __ASM_ARCH_OSIRISMAP_H */
diff --git a/include/asm-arm/linkage.h b/include/asm-arm/linkage.h
index dbe4b4e31a5b..5a25632b1bc0 100644
--- a/include/asm-arm/linkage.h
+++ b/include/asm-arm/linkage.h
@@ -4,4 +4,8 @@
4#define __ALIGN .align 0 4#define __ALIGN .align 0
5#define __ALIGN_STR ".align 0" 5#define __ALIGN_STR ".align 0"
6 6
7#define ENDPROC(name) \
8 .type name, %function; \
9 END(name)
10
7#endif 11#endif
diff --git a/include/asm-avr32/arch-at32ap/gpio.h b/include/asm-avr32/arch-at32ap/gpio.h
index 80a21aa9ae77..af7f9535bab3 100644
--- a/include/asm-avr32/arch-at32ap/gpio.h
+++ b/include/asm-avr32/arch-at32ap/gpio.h
@@ -14,6 +14,8 @@ int gpio_direction_output(unsigned int gpio, int value);
14int gpio_get_value(unsigned int gpio); 14int gpio_get_value(unsigned int gpio);
15void gpio_set_value(unsigned int gpio, int value); 15void gpio_set_value(unsigned int gpio, int value);
16 16
17#include <asm-generic/gpio.h> /* cansleep wrappers */
18
17static inline int gpio_to_irq(unsigned int gpio) 19static inline int gpio_to_irq(unsigned int gpio)
18{ 20{
19 return gpio + GPIO_IRQ_BASE; 21 return gpio + GPIO_IRQ_BASE;
diff --git a/include/asm-avr32/cache.h b/include/asm-avr32/cache.h
index dabb955f3c00..d3cf35ab11ab 100644
--- a/include/asm-avr32/cache.h
+++ b/include/asm-avr32/cache.h
@@ -4,6 +4,15 @@
4#define L1_CACHE_SHIFT 5 4#define L1_CACHE_SHIFT 5
5#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) 5#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
6 6
7/*
8 * Memory returned by kmalloc() may be used for DMA, so we must make
9 * sure that all such allocations are cache aligned. Otherwise,
10 * unrelated code may cause parts of the buffer to be read into the
11 * cache before the transfer is done, causing old data to be seen by
12 * the CPU.
13 */
14#define ARCH_KMALLOC_MINALIGN L1_CACHE_BYTES
15
7#ifndef __ASSEMBLER__ 16#ifndef __ASSEMBLER__
8struct cache_info { 17struct cache_info {
9 unsigned int ways; 18 unsigned int ways;
diff --git a/include/asm-blackfin/blackfin.h b/include/asm-blackfin/blackfin.h
index 14e58de73973..db3b615ffbab 100644
--- a/include/asm-blackfin/blackfin.h
+++ b/include/asm-blackfin/blackfin.h
@@ -6,7 +6,11 @@
6#ifndef _BLACKFIN_H_ 6#ifndef _BLACKFIN_H_
7#define _BLACKFIN_H_ 7#define _BLACKFIN_H_
8 8
9#include <asm/macros.h> 9#define LO(con32) ((con32) & 0xFFFF)
10#define lo(con32) ((con32) & 0xFFFF)
11#define HI(con32) (((con32) >> 16) & 0xFFFF)
12#define hi(con32) (((con32) >> 16) & 0xFFFF)
13
10#include <asm/mach/blackfin.h> 14#include <asm/mach/blackfin.h>
11#include <asm/bfin-global.h> 15#include <asm/bfin-global.h>
12 16
diff --git a/include/asm-blackfin/gpio.h b/include/asm-blackfin/gpio.h
index aa0d5503e232..d98d77ad71f7 100644
--- a/include/asm-blackfin/gpio.h
+++ b/include/asm-blackfin/gpio.h
@@ -332,6 +332,7 @@ struct gpio_port_s {
332 unsigned short inen; 332 unsigned short inen;
333 333
334 unsigned short fer; 334 unsigned short fer;
335 unsigned short reserved;
335}; 336};
336#endif /*CONFIG_PM*/ 337#endif /*CONFIG_PM*/
337 338
diff --git a/include/asm-blackfin/mach-common/def_LPBlackfin.h b/include/asm-blackfin/mach-common/def_LPBlackfin.h
index 76103526aec1..be1ece8c0c27 100644
--- a/include/asm-blackfin/mach-common/def_LPBlackfin.h
+++ b/include/asm-blackfin/mach-common/def_LPBlackfin.h
@@ -42,6 +42,12 @@
42 42
43#if defined(ANOMALY_05000198) 43#if defined(ANOMALY_05000198)
44 44
45#define bfin_read8(addr) ({ unsigned char __v; \
46 __asm__ __volatile__ ("NOP;\n\t" \
47 "%0 = b[%1] (z);\n\t" \
48 : "=d"(__v) : "a"(addr)); \
49 __v; })
50
45#define bfin_read16(addr) ({ unsigned __v; \ 51#define bfin_read16(addr) ({ unsigned __v; \
46 __asm__ __volatile__ ("NOP;\n\t"\ 52 __asm__ __volatile__ ("NOP;\n\t"\
47 "%0 = w[%1] (z);\n\t"\ 53 "%0 = w[%1] (z);\n\t"\
@@ -52,6 +58,11 @@
52 "%0 = [%1];\n\t"\ 58 "%0 = [%1];\n\t"\
53 : "=d"(__v) : "a"(addr)); __v; }) 59 : "=d"(__v) : "a"(addr)); __v; })
54 60
61#define bfin_write8(addr, val) ({ \
62 __asm__ __volatile__ ("NOP;\n\t" \
63 "b[%0] = %1;\n\t" \
64 : : "a"(addr), "d"(val) : "memory");})
65
55#define bfin_write16(addr,val) ({\ 66#define bfin_write16(addr,val) ({\
56 __asm__ __volatile__ ("NOP;\n\t"\ 67 __asm__ __volatile__ ("NOP;\n\t"\
57 "w[%0] = %1;\n\t"\ 68 "w[%0] = %1;\n\t"\
@@ -64,6 +75,12 @@
64 75
65#else 76#else
66 77
78#define bfin_read8(addr) ({ unsigned char __v; \
79 __asm__ __volatile__ ( \
80 "%0 = b[%1] (z);\n\t" \
81 :"=d"(__v) : "a"(addr)); \
82 __v; })
83
67#define bfin_read16(addr) ({ unsigned __v; \ 84#define bfin_read16(addr) ({ unsigned __v; \
68 __asm__ __volatile__ (\ 85 __asm__ __volatile__ (\
69 "%0 = w[%1] (z);\n\t"\ 86 "%0 = w[%1] (z);\n\t"\
@@ -74,6 +91,11 @@
74 "%0 = [%1];\n\t"\ 91 "%0 = [%1];\n\t"\
75 : "=d"(__v) : "a"(addr)); __v; }) 92 : "=d"(__v) : "a"(addr)); __v; })
76 93
94#define bfin_write8(addr, val) ({ \
95 __asm__ __volatile__ ( \
96 "b[%0] = %1; \n\t" \
97 ::"a"(addr), "d"(val) : "memory");})
98
77#define bfin_write16(addr,val) ({\ 99#define bfin_write16(addr,val) ({\
78 __asm__ __volatile__ (\ 100 __asm__ __volatile__ (\
79 "w[%0] = %1;\n\t"\ 101 "w[%0] = %1;\n\t"\
diff --git a/include/asm-blackfin/macros.h b/include/asm-blackfin/macros.h
index c0c04a2f2dd5..e69de29bb2d1 100644
--- a/include/asm-blackfin/macros.h
+++ b/include/asm-blackfin/macros.h
@@ -1,95 +0,0 @@
1/************************************************************************
2 *
3 * macros.h
4 *
5 * (c) Copyright 2001-2003 Analog Devices, Inc. All rights reserved.
6 *
7 ************************************************************************/
8
9/* Defines various assembly macros. */
10
11#ifndef _MACROS_H
12#define _MACROS_H
13
14#define LO(con32) ((con32) & 0xFFFF)
15#define lo(con32) ((con32) & 0xFFFF)
16#define HI(con32) (((con32) >> 16) & 0xFFFF)
17#define hi(con32) (((con32) >> 16) & 0xFFFF)
18
19/*
20 * Set the corresponding bits in a System Register (SR);
21 * All bits set in "mask" will be set in the system register
22 * specified by "sys_reg" bitset_SR(sys_reg, mask), where
23 * sys_reg is the system register and mask are the bits to be set.
24 */
25#define bitset_SR(sys_reg, mask)\
26 [--SP] = (R7:6);\
27 r7 = sys_reg;\
28 r6.l = (mask) & 0xffff;\
29 r6.h = (mask) >> 16;\
30 r7 = r7 | r6;\
31 sys_reg = r7;\
32 csync;\
33 (R7:6) = [SP++]
34
35/*
36 * Clear the corresponding bits in a System Register (SR);
37 * All bits set in "mask" will be cleared in the SR
38 * specified by "sys_reg" bitclr_SR(sys_reg, mask), where
39 * sys_reg is the SR and mask are the bits to be cleared.
40 */
41#define bitclr_SR(sys_reg, mask)\
42 [--SP] = (R7:6);\
43 r7 = sys_reg;\
44 r7 =~ r7;\
45 r6.l = (mask) & 0xffff;\
46 r6.h = (mask) >> 16;\
47 r7 = r7 | r6;\
48 r7 =~ r7;\
49 sys_reg = r7;\
50 csync;\
51 (R7:6) = [SP++]
52
53/*
54 * Set the corresponding bits in a Memory Mapped Register (MMR);
55 * All bits set in "mask" will be set in the MMR specified by "mmr_reg"
56 * bitset_MMR(mmr_reg, mask), where mmr_reg is the MMR and mask are
57 * the bits to be set.
58 */
59#define bitset_MMR(mmr_reg, mask)\
60 [--SP] = (R7:6);\
61 [--SP] = P5;\
62 p5.l = mmr_reg & 0xffff;\
63 p5.h = mmr_reg >> 16;\
64 r7 = [p5];\
65 r6.l = (mask) & 0xffff;\
66 r6.h = (mask) >> 16;\
67 r7 = r7 | r6;\
68 [p5] = r7;\
69 csync;\
70 p5 = [SP++];\
71 (R7:6) = [SP++]
72
73/*
74 * Clear the corresponding bits in a Memory Mapped Register (MMR);
75 * All bits set in "mask" will be cleared in the MMR specified by "mmr_reg"
76 * bitclr_MMRreg(mmr_reg, mask), where sys_reg is the MMR and mask are
77 * the bits to be cleared.
78 */
79#define bitclr_MMR(mmr_reg, mask)\
80 [--SP] = (R7:6);\
81 [--SP] = P5;\
82 p5.l = mmr_reg & 0xffff;\
83 p5.h = mmr_reg >> 16;\
84 r7 = [p5];\
85 r7 =~ r7;\
86 r6.l = (mask) & 0xffff;\
87 r6.h = (mask) >> 16;\
88 r7 = r7 | r6;\
89 r7 =~ r7;\
90 [p5] = r7;\
91 csync;\
92 p5 = [SP++];\
93 (R7:6) = [SP++]
94
95#endif /* _MACROS_H */
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index dc8f99ee305f..7d7bcf990e99 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -27,13 +27,20 @@ do { \
27 * Largely same as above, but only sets the access flags (dirty, 27 * Largely same as above, but only sets the access flags (dirty,
28 * accessed, and writable). Furthermore, we know it always gets set 28 * accessed, and writable). Furthermore, we know it always gets set
29 * to a "more permissive" setting, which allows most architectures 29 * to a "more permissive" setting, which allows most architectures
30 * to optimize this. 30 * to optimize this. We return whether the PTE actually changed, which
31 * in turn instructs the caller to do things like update__mmu_cache.
32 * This used to be done in the caller, but sparc needs minor faults to
33 * force that call on sun4c so we changed this macro slightly
31 */ 34 */
32#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \ 35#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
33do { \ 36({ \
34 set_pte_at((__vma)->vm_mm, (__address), __ptep, __entry); \ 37 int __changed = !pte_same(*(__ptep), __entry); \
35 flush_tlb_page(__vma, __address); \ 38 if (__changed) { \
36} while (0) 39 set_pte_at((__vma)->vm_mm, (__address), __ptep, __entry); \
40 flush_tlb_page(__vma, __address); \
41 } \
42 __changed; \
43})
37#endif 44#endif
38 45
39#ifndef __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG 46#ifndef __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
diff --git a/include/asm-i386/dma-mapping.h b/include/asm-i386/dma-mapping.h
index 183eebeebbdc..f1d72d177f68 100644
--- a/include/asm-i386/dma-mapping.h
+++ b/include/asm-i386/dma-mapping.h
@@ -123,6 +123,8 @@ dma_mapping_error(dma_addr_t dma_addr)
123 return 0; 123 return 0;
124} 124}
125 125
126extern int forbid_dac;
127
126static inline int 128static inline int
127dma_supported(struct device *dev, u64 mask) 129dma_supported(struct device *dev, u64 mask)
128{ 130{
@@ -134,6 +136,10 @@ dma_supported(struct device *dev, u64 mask)
134 if(mask < 0x00ffffff) 136 if(mask < 0x00ffffff)
135 return 0; 137 return 0;
136 138
139 /* Work around chipset bugs */
140 if (forbid_dac > 0 && mask > 0xffffffffULL)
141 return 0;
142
137 return 1; 143 return 1;
138} 144}
139 145
diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h
index 2394589786ba..628fa7747d0c 100644
--- a/include/asm-i386/pgtable.h
+++ b/include/asm-i386/pgtable.h
@@ -285,32 +285,36 @@ static inline pte_t native_local_ptep_get_and_clear(pte_t *ptep)
285 */ 285 */
286#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS 286#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
287#define ptep_set_access_flags(vma, address, ptep, entry, dirty) \ 287#define ptep_set_access_flags(vma, address, ptep, entry, dirty) \
288do { \ 288({ \
289 if (dirty) { \ 289 int __changed = !pte_same(*(ptep), entry); \
290 if (__changed && dirty) { \
290 (ptep)->pte_low = (entry).pte_low; \ 291 (ptep)->pte_low = (entry).pte_low; \
291 pte_update_defer((vma)->vm_mm, (address), (ptep)); \ 292 pte_update_defer((vma)->vm_mm, (address), (ptep)); \
292 flush_tlb_page(vma, address); \ 293 flush_tlb_page(vma, address); \
293 } \ 294 } \
294} while (0) 295 __changed; \
296})
295 297
296#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY 298#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
297#define ptep_test_and_clear_dirty(vma, addr, ptep) ({ \ 299#define ptep_test_and_clear_dirty(vma, addr, ptep) ({ \
298 int ret = 0; \ 300 int __ret = 0; \
299 if (pte_dirty(*ptep)) \ 301 if (pte_dirty(*(ptep))) \
300 ret = test_and_clear_bit(_PAGE_BIT_DIRTY, &ptep->pte_low); \ 302 __ret = test_and_clear_bit(_PAGE_BIT_DIRTY, \
301 if (ret) \ 303 &(ptep)->pte_low); \
302 pte_update_defer(vma->vm_mm, addr, ptep); \ 304 if (__ret) \
303 ret; \ 305 pte_update((vma)->vm_mm, addr, ptep); \
306 __ret; \
304}) 307})
305 308
306#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG 309#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
307#define ptep_test_and_clear_young(vma, addr, ptep) ({ \ 310#define ptep_test_and_clear_young(vma, addr, ptep) ({ \
308 int ret = 0; \ 311 int __ret = 0; \
309 if (pte_young(*ptep)) \ 312 if (pte_young(*(ptep))) \
310 ret = test_and_clear_bit(_PAGE_BIT_ACCESSED, &ptep->pte_low); \ 313 __ret = test_and_clear_bit(_PAGE_BIT_ACCESSED, \
311 if (ret) \ 314 &(ptep)->pte_low); \
312 pte_update_defer(vma->vm_mm, addr, ptep); \ 315 if (__ret) \
313 ret; \ 316 pte_update((vma)->vm_mm, addr, ptep); \
317 __ret; \
314}) 318})
315 319
316/* 320/*
diff --git a/include/asm-ia64/pgtable.h b/include/asm-ia64/pgtable.h
index 670b706411b8..6580f31b3135 100644
--- a/include/asm-ia64/pgtable.h
+++ b/include/asm-ia64/pgtable.h
@@ -533,16 +533,23 @@ extern void lazy_mmu_prot_update (pte_t pte);
533 * daccess_bit in ivt.S). 533 * daccess_bit in ivt.S).
534 */ 534 */
535#ifdef CONFIG_SMP 535#ifdef CONFIG_SMP
536# define ptep_set_access_flags(__vma, __addr, __ptep, __entry, __safely_writable) \ 536# define ptep_set_access_flags(__vma, __addr, __ptep, __entry, __safely_writable) \
537do { \ 537({ \
538 if (__safely_writable) { \ 538 int __changed = !pte_same(*(__ptep), __entry); \
539 set_pte(__ptep, __entry); \ 539 if (__changed && __safely_writable) { \
540 flush_tlb_page(__vma, __addr); \ 540 set_pte(__ptep, __entry); \
541 } \ 541 flush_tlb_page(__vma, __addr); \
542} while (0) 542 } \
543 __changed; \
544})
543#else 545#else
544# define ptep_set_access_flags(__vma, __addr, __ptep, __entry, __safely_writable) \ 546# define ptep_set_access_flags(__vma, __addr, __ptep, __entry, __safely_writable) \
545 ptep_establish(__vma, __addr, __ptep, __entry) 547({ \
548 int __changed = !pte_same(*(__ptep), __entry); \
549 if (__changed) \
550 ptep_establish(__vma, __addr, __ptep, __entry); \
551 __changed; \
552})
546#endif 553#endif
547 554
548# ifdef CONFIG_VIRTUAL_MEM_MAP 555# ifdef CONFIG_VIRTUAL_MEM_MAP
diff --git a/include/asm-mips/irq.h b/include/asm-mips/irq.h
index 91803ba30ff2..3ca6a076124d 100644
--- a/include/asm-mips/irq.h
+++ b/include/asm-mips/irq.h
@@ -72,4 +72,13 @@ extern int allocate_irqno(void);
72extern void alloc_legacy_irqno(void); 72extern void alloc_legacy_irqno(void);
73extern void free_irqno(unsigned int irq); 73extern void free_irqno(unsigned int irq);
74 74
75/*
76 * Before R2 the timer and performance counter interrupts were both fixed to
77 * IE7. Since R2 their number has to be read from the c0_intctl register.
78 */
79#define CP0_LEGACY_COMPARE_IRQ 7
80
81extern int cp0_compare_irq;
82extern int cp0_perfcount_irq;
83
75#endif /* _ASM_IRQ_H */ 84#endif /* _ASM_IRQ_H */
diff --git a/include/asm-mips/mips-boards/atlasint.h b/include/asm-mips/mips-boards/atlasint.h
index 76add42e486e..93ba1c1b2a4f 100644
--- a/include/asm-mips/mips-boards/atlasint.h
+++ b/include/asm-mips/mips-boards/atlasint.h
@@ -28,11 +28,6 @@
28 28
29#include <irq.h> 29#include <irq.h>
30 30
31/*
32 * Interrupts 0..7 are used for Atlas CPU interrupts (nonEIC mode)
33 */
34#define MIPSCPU_INT_BASE MIPS_CPU_IRQ_BASE
35
36/* CPU interrupt offsets */ 31/* CPU interrupt offsets */
37#define MIPSCPU_INT_SW0 0 32#define MIPSCPU_INT_SW0 0
38#define MIPSCPU_INT_SW1 1 33#define MIPSCPU_INT_SW1 1
@@ -42,7 +37,6 @@
42#define MIPSCPU_INT_MB2 4 37#define MIPSCPU_INT_MB2 4
43#define MIPSCPU_INT_MB3 5 38#define MIPSCPU_INT_MB3 5
44#define MIPSCPU_INT_MB4 6 39#define MIPSCPU_INT_MB4 6
45#define MIPSCPU_INT_CPUCTR 7
46 40
47/* 41/*
48 * Interrupts 8..39 are used for Atlas interrupt controller interrupts 42 * Interrupts 8..39 are used for Atlas interrupt controller interrupts
diff --git a/include/asm-mips/mips-boards/generic.h b/include/asm-mips/mips-boards/generic.h
index b98f1658cfd0..c8ebcc3e1267 100644
--- a/include/asm-mips/mips-boards/generic.h
+++ b/include/asm-mips/mips-boards/generic.h
@@ -73,12 +73,28 @@
73 * CoreEMUL with Bonito System Controller is treated like a Core20K 73 * CoreEMUL with Bonito System Controller is treated like a Core20K
74 * CoreEMUL with SOC-it 101 System Controller is treated like a CoreMSC 74 * CoreEMUL with SOC-it 101 System Controller is treated like a CoreMSC
75 */ 75 */
76#define MIPS_REVISION_CORID_CORE_EMUL_BON 0x63 76#define MIPS_REVISION_CORID_CORE_EMUL_BON -1
77#define MIPS_REVISION_CORID_CORE_EMUL_MSC 0x65 77#define MIPS_REVISION_CORID_CORE_EMUL_MSC -2
78 78
79#define MIPS_REVISION_CORID (((*(volatile u32 *)ioremap(MIPS_REVISION_REG, 4)) >> 10) & 0x3f) 79#define MIPS_REVISION_CORID (((*(volatile u32 *)ioremap(MIPS_REVISION_REG, 4)) >> 10) & 0x3f)
80 80
81extern unsigned int mips_revision_corid; 81extern int mips_revision_corid;
82
83#define MIPS_REVISION_SCON_OTHER 0
84#define MIPS_REVISION_SCON_SOCITSC 1
85#define MIPS_REVISION_SCON_SOCITSCP 2
86
87/* Artificial SCON defines for MIPS_REVISION_SCON_OTHER */
88#define MIPS_REVISION_SCON_UNKNOWN -1
89#define MIPS_REVISION_SCON_GT64120 -2
90#define MIPS_REVISION_SCON_BONITO -3
91#define MIPS_REVISION_SCON_BRTL -4
92#define MIPS_REVISION_SCON_SOCIT -5
93#define MIPS_REVISION_SCON_ROCIT -6
94
95#define MIPS_REVISION_SCONID (((*(volatile u32 *)ioremap(MIPS_REVISION_REG, 4)) >> 24) & 0xff)
96
97extern int mips_revision_sconid;
82 98
83#ifdef CONFIG_PCI 99#ifdef CONFIG_PCI
84extern void mips_pcibios_init(void); 100extern void mips_pcibios_init(void);
diff --git a/include/asm-mips/mips-boards/maltaint.h b/include/asm-mips/mips-boards/maltaint.h
index 9180d6466113..7461318f1cd1 100644
--- a/include/asm-mips/mips-boards/maltaint.h
+++ b/include/asm-mips/mips-boards/maltaint.h
@@ -32,11 +32,6 @@
32 */ 32 */
33#define MALTA_INT_BASE 0 33#define MALTA_INT_BASE 0
34 34
35/*
36 * Interrupts 16..23 are used for Malta CPU interrupts (nonEIC mode)
37 */
38#define MIPSCPU_INT_BASE MIPS_CPU_IRQ_BASE
39
40/* CPU interrupt offsets */ 35/* CPU interrupt offsets */
41#define MIPSCPU_INT_SW0 0 36#define MIPSCPU_INT_SW0 0
42#define MIPSCPU_INT_SW1 1 37#define MIPSCPU_INT_SW1 1
@@ -49,7 +44,6 @@
49#define MIPSCPU_INT_COREHI MIPSCPU_INT_MB3 44#define MIPSCPU_INT_COREHI MIPSCPU_INT_MB3
50#define MIPSCPU_INT_MB4 6 45#define MIPSCPU_INT_MB4 6
51#define MIPSCPU_INT_CORELO MIPSCPU_INT_MB4 46#define MIPSCPU_INT_CORELO MIPSCPU_INT_MB4
52#define MIPSCPU_INT_CPUCTR 7
53 47
54/* 48/*
55 * Interrupts 64..127 are used for Soc-it Classic interrupts 49 * Interrupts 64..127 are used for Soc-it Classic interrupts
diff --git a/include/asm-mips/mips-boards/msc01_pci.h b/include/asm-mips/mips-boards/msc01_pci.h
index 8eaefb837b9d..e036b7dd6deb 100644
--- a/include/asm-mips/mips-boards/msc01_pci.h
+++ b/include/asm-mips/mips-boards/msc01_pci.h
@@ -208,6 +208,7 @@
208 * latter, they should be moved elsewhere. 208 * latter, they should be moved elsewhere.
209 */ 209 */
210#define MIPS_MSC01_PCI_REG_BASE 0x1bd00000 210#define MIPS_MSC01_PCI_REG_BASE 0x1bd00000
211#define MIPS_SOCITSC_PCI_REG_BASE 0x1ff10000
211 212
212extern unsigned long _pcictrl_msc; 213extern unsigned long _pcictrl_msc;
213 214
diff --git a/include/asm-mips/mips-boards/seadint.h b/include/asm-mips/mips-boards/seadint.h
index 4f6a3933699d..e710bae07340 100644
--- a/include/asm-mips/mips-boards/seadint.h
+++ b/include/asm-mips/mips-boards/seadint.h
@@ -22,14 +22,7 @@
22 22
23#include <irq.h> 23#include <irq.h>
24 24
25/*
26 * Interrupts 0..7 are used for SEAD CPU interrupts
27 */
28#define MIPSCPU_INT_BASE MIPS_CPU_IRQ_BASE
29
30#define MIPSCPU_INT_UART0 2 25#define MIPSCPU_INT_UART0 2
31#define MIPSCPU_INT_UART1 3 26#define MIPSCPU_INT_UART1 3
32 27
33#define MIPSCPU_INT_CPUCTR 7
34
35#endif /* !(_MIPS_SEADINT_H) */ 28#endif /* !(_MIPS_SEADINT_H) */
diff --git a/include/asm-mips/mips-boards/simint.h b/include/asm-mips/mips-boards/simint.h
index 54f2fe621d69..8ef6db76d5c1 100644
--- a/include/asm-mips/mips-boards/simint.h
+++ b/include/asm-mips/mips-boards/simint.h
@@ -21,15 +21,11 @@
21 21
22#define SIM_INT_BASE 0 22#define SIM_INT_BASE 0
23#define MIPSCPU_INT_MB0 2 23#define MIPSCPU_INT_MB0 2
24#define MIPSCPU_INT_BASE MIPS_CPU_IRQ_BASE
25#define MIPS_CPU_TIMER_IRQ 7 24#define MIPS_CPU_TIMER_IRQ 7
26 25
27 26
28#define MIPSCPU_INT_CPUCTR 7
29
30#define MSC01E_INT_BASE 64 27#define MSC01E_INT_BASE 64
31 28
32#define MIPSCPU_INT_CPUCTR 7
33#define MSC01E_INT_CPUCTR 11 29#define MSC01E_INT_CPUCTR 11
34 30
35#endif 31#endif
diff --git a/include/asm-parisc/hardware.h b/include/asm-parisc/hardware.h
index 76d880dc4bae..4e9626836bab 100644
--- a/include/asm-parisc/hardware.h
+++ b/include/asm-parisc/hardware.h
@@ -31,10 +31,11 @@ enum cpu_type {
31 pcxw = 8, /* pa8500 pa 2.0 */ 31 pcxw = 8, /* pa8500 pa 2.0 */
32 pcxw_ = 9, /* pa8600 (w+) pa 2.0 */ 32 pcxw_ = 9, /* pa8600 (w+) pa 2.0 */
33 pcxw2 = 10, /* pa8700 pa 2.0 */ 33 pcxw2 = 10, /* pa8700 pa 2.0 */
34 mako = 11 /* pa8800 pa 2.0 */ 34 mako = 11, /* pa8800 pa 2.0 */
35 mako2 = 12 /* pa8900 pa 2.0 */
35}; 36};
36 37
37extern char *cpu_name_version[][2]; /* mapping from enum cpu_type to strings */ 38extern const char * const cpu_name_version[][2]; /* mapping from enum cpu_type to strings */
38 39
39struct parisc_driver; 40struct parisc_driver;
40 41
diff --git a/include/asm-parisc/linkage.h b/include/asm-parisc/linkage.h
index 7a09d911b538..ad8cd0d069ea 100644
--- a/include/asm-parisc/linkage.h
+++ b/include/asm-parisc/linkage.h
@@ -8,8 +8,10 @@
8 8
9/* 9/*
10 * In parisc assembly a semicolon marks a comment while a 10 * In parisc assembly a semicolon marks a comment while a
11 * exclamation mark is used to seperate independend lines. 11 * exclamation mark is used to seperate independent lines.
12 */ 12 */
13#ifdef __ASSEMBLY__
14
13#define ENTRY(name) \ 15#define ENTRY(name) \
14 .export name !\ 16 .export name !\
15 ALIGN !\ 17 ALIGN !\
@@ -24,5 +26,6 @@ name:
24 END(name) 26 END(name)
25#endif 27#endif
26 28
29#endif /* __ASSEMBLY__ */
27 30
28#endif /* __ASM_PARISC_LINKAGE_H */ 31#endif /* __ASM_PARISC_LINKAGE_H */
diff --git a/include/asm-parisc/processor.h b/include/asm-parisc/processor.h
index d2f396721d3e..6b294fb07a23 100644
--- a/include/asm-parisc/processor.h
+++ b/include/asm-parisc/processor.h
@@ -69,8 +69,8 @@ struct system_cpuinfo_parisc {
69 char sys_model_name[81]; /* PDC-ROM returnes this model name */ 69 char sys_model_name[81]; /* PDC-ROM returnes this model name */
70 } pdc; 70 } pdc;
71 71
72 char *cpu_name; /* e.g. "PA7300LC (PCX-L2)" */ 72 const char *cpu_name; /* e.g. "PA7300LC (PCX-L2)" */
73 char *family_name; /* e.g. "1.1e" */ 73 const char *family_name; /* e.g. "1.1e" */
74}; 74};
75 75
76 76
@@ -334,8 +334,8 @@ extern unsigned long get_wchan(struct task_struct *p);
334static inline int parisc_requires_coherency(void) 334static inline int parisc_requires_coherency(void)
335{ 335{
336#ifdef CONFIG_PA8X00 336#ifdef CONFIG_PA8X00
337 /* FIXME: also pa8900 - when we see one */ 337 return (boot_cpu_data.cpu_type == mako) ||
338 return boot_cpu_data.cpu_type == mako; 338 (boot_cpu_data.cpu_type == mako2);
339#else 339#else
340 return 0; 340 return 0;
341#endif 341#endif
diff --git a/include/asm-parisc/unistd.h b/include/asm-parisc/unistd.h
index 2f7c40861c91..f74099bdca3c 100644
--- a/include/asm-parisc/unistd.h
+++ b/include/asm-parisc/unistd.h
@@ -792,8 +792,19 @@
792#define __NR_epoll_pwait (__NR_Linux + 297) 792#define __NR_epoll_pwait (__NR_Linux + 297)
793#define __NR_statfs64 (__NR_Linux + 298) 793#define __NR_statfs64 (__NR_Linux + 298)
794#define __NR_fstatfs64 (__NR_Linux + 299) 794#define __NR_fstatfs64 (__NR_Linux + 299)
795#define __NR_kexec_load (__NR_Linux + 300)
796#define __NR_utimensat (__NR_Linux + 301)
797#define __NR_signalfd (__NR_Linux + 302)
798#define __NR_timerfd (__NR_Linux + 303)
799#define __NR_eventfd (__NR_Linux + 304)
800
801#define __NR_Linux_syscalls (__NR_eventfd + 1)
802
803
804#define __IGNORE_select /* newselect */
805#define __IGNORE_fadvise64 /* fadvise64_64 */
806#define __IGNORE_utimes /* utime */
795 807
796#define __NR_Linux_syscalls (__NR_fstatfs64 + 1)
797 808
798#define HPUX_GATEWAY_ADDR 0xC0000004 809#define HPUX_GATEWAY_ADDR 0xC0000004
799#define LINUX_GATEWAY_ADDR 0x100 810#define LINUX_GATEWAY_ADDR 0x100
diff --git a/include/asm-powerpc/pgtable-ppc32.h b/include/asm-powerpc/pgtable-ppc32.h
index c863bdb2889c..7fb730c62f83 100644
--- a/include/asm-powerpc/pgtable-ppc32.h
+++ b/include/asm-powerpc/pgtable-ppc32.h
@@ -673,10 +673,14 @@ static inline void __ptep_set_access_flags(pte_t *ptep, pte_t entry, int dirty)
673} 673}
674 674
675#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \ 675#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
676 do { \ 676({ \
677 __ptep_set_access_flags(__ptep, __entry, __dirty); \ 677 int __changed = !pte_same(*(__ptep), __entry); \
678 flush_tlb_page_nohash(__vma, __address); \ 678 if (__changed) { \
679 } while(0) 679 __ptep_set_access_flags(__ptep, __entry, __dirty); \
680 flush_tlb_page_nohash(__vma, __address); \
681 } \
682 __changed; \
683})
680 684
681/* 685/*
682 * Macro to mark a page protection value as "uncacheable". 686 * Macro to mark a page protection value as "uncacheable".
diff --git a/include/asm-powerpc/pgtable-ppc64.h b/include/asm-powerpc/pgtable-ppc64.h
index 704c4e669fe0..3cfd98f44bfe 100644
--- a/include/asm-powerpc/pgtable-ppc64.h
+++ b/include/asm-powerpc/pgtable-ppc64.h
@@ -413,10 +413,14 @@ static inline void __ptep_set_access_flags(pte_t *ptep, pte_t entry, int dirty)
413 :"cc"); 413 :"cc");
414} 414}
415#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \ 415#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
416 do { \ 416({ \
417 __ptep_set_access_flags(__ptep, __entry, __dirty); \ 417 int __changed = !pte_same(*(__ptep), __entry); \
418 flush_tlb_page_nohash(__vma, __address); \ 418 if (__changed) { \
419 } while(0) 419 __ptep_set_access_flags(__ptep, __entry, __dirty); \
420 flush_tlb_page_nohash(__vma, __address); \
421 } \
422 __changed; \
423})
420 424
421/* 425/*
422 * Macro to mark a page protection value as "uncacheable". 426 * Macro to mark a page protection value as "uncacheable".
diff --git a/include/asm-ppc/pgtable.h b/include/asm-ppc/pgtable.h
index bed452d4a5f0..9d0ce9ff5840 100644
--- a/include/asm-ppc/pgtable.h
+++ b/include/asm-ppc/pgtable.h
@@ -694,10 +694,14 @@ static inline void __ptep_set_access_flags(pte_t *ptep, pte_t entry, int dirty)
694} 694}
695 695
696#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \ 696#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
697 do { \ 697({ \
698 __ptep_set_access_flags(__ptep, __entry, __dirty); \ 698 int __changed = !pte_same(*(__ptep), __entry); \
699 flush_tlb_page_nohash(__vma, __address); \ 699 if (__changed) { \
700 } while(0) 700 __ptep_set_access_flags(__ptep, __entry, __dirty); \
701 flush_tlb_page_nohash(__vma, __address); \
702 } \
703 __changed; \
704})
701 705
702/* 706/*
703 * Macro to mark a page protection value as "uncacheable". 707 * Macro to mark a page protection value as "uncacheable".
diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h
index 8fe8d42e64c3..0a307bb2f353 100644
--- a/include/asm-s390/pgtable.h
+++ b/include/asm-s390/pgtable.h
@@ -744,7 +744,12 @@ ptep_establish(struct vm_area_struct *vma,
744} 744}
745 745
746#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \ 746#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
747 ptep_establish(__vma, __address, __ptep, __entry) 747({ \
748 int __changed = !pte_same(*(__ptep), __entry); \
749 if (__changed) \
750 ptep_establish(__vma, __address, __ptep, __entry); \
751 __changed; \
752})
748 753
749/* 754/*
750 * Test and clear dirty bit in storage key. 755 * Test and clear dirty bit in storage key.
diff --git a/include/asm-s390/processor.h b/include/asm-s390/processor.h
index e0fcea8c64c3..5cb480af65d5 100644
--- a/include/asm-s390/processor.h
+++ b/include/asm-s390/processor.h
@@ -216,6 +216,11 @@ static inline void cpu_relax(void)
216 barrier(); 216 barrier();
217} 217}
218 218
219static inline void psw_set_key(unsigned int key)
220{
221 asm volatile("spka 0(%0)" : : "d" (key));
222}
223
219/* 224/*
220 * Set PSW to specified value. 225 * Set PSW to specified value.
221 */ 226 */
diff --git a/include/asm-s390/ptrace.h b/include/asm-s390/ptrace.h
index fa6ca87080e8..332ee73688fc 100644
--- a/include/asm-s390/ptrace.h
+++ b/include/asm-s390/ptrace.h
@@ -470,14 +470,7 @@ struct user_regs_struct
470#define regs_return_value(regs)((regs)->gprs[2]) 470#define regs_return_value(regs)((regs)->gprs[2])
471#define profile_pc(regs) instruction_pointer(regs) 471#define profile_pc(regs) instruction_pointer(regs)
472extern void show_regs(struct pt_regs * regs); 472extern void show_regs(struct pt_regs * regs);
473#endif 473#endif /* __KERNEL__ */
474
475static inline void
476psw_set_key(unsigned int key)
477{
478 asm volatile("spka 0(%0)" : : "d" (key));
479}
480
481#endif /* __ASSEMBLY__ */ 474#endif /* __ASSEMBLY__ */
482 475
483#endif /* _S390_PTRACE_H */ 476#endif /* _S390_PTRACE_H */
diff --git a/include/asm-sparc/pgtable.h b/include/asm-sparc/pgtable.h
index 4f0a5ba0d6a0..59229aeba27b 100644
--- a/include/asm-sparc/pgtable.h
+++ b/include/asm-sparc/pgtable.h
@@ -446,6 +446,17 @@ extern int io_remap_pfn_range(struct vm_area_struct *vma,
446#define GET_IOSPACE(pfn) (pfn >> (BITS_PER_LONG - 4)) 446#define GET_IOSPACE(pfn) (pfn >> (BITS_PER_LONG - 4))
447#define GET_PFN(pfn) (pfn & 0x0fffffffUL) 447#define GET_PFN(pfn) (pfn & 0x0fffffffUL)
448 448
449#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
450#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
451({ \
452 int __changed = !pte_same(*(__ptep), __entry); \
453 if (__changed) { \
454 set_pte_at((__vma)->vm_mm, (__address), __ptep, __entry); \
455 flush_tlb_page(__vma, __address); \
456 } \
457 (sparc_cpu_model == sun4c) || __changed; \
458})
459
449#include <asm-generic/pgtable.h> 460#include <asm-generic/pgtable.h>
450 461
451#endif /* !(__ASSEMBLY__) */ 462#endif /* !(__ASSEMBLY__) */
diff --git a/include/asm-sparc64/dma-mapping.h b/include/asm-sparc64/dma-mapping.h
index 4e21c2f3065c..c58ec1661df8 100644
--- a/include/asm-sparc64/dma-mapping.h
+++ b/include/asm-sparc64/dma-mapping.h
@@ -15,8 +15,7 @@
15static inline int 15static inline int
16dma_supported(struct device *dev, u64 mask) 16dma_supported(struct device *dev, u64 mask)
17{ 17{
18 BUG_ON(dev->bus != &pci_bus_type && 18 BUG_ON(dev->bus != &pci_bus_type);
19 dev->bus != &ebus_bus_type);
20 19
21 return pci_dma_supported(to_pci_dev(dev), mask); 20 return pci_dma_supported(to_pci_dev(dev), mask);
22} 21}
@@ -24,8 +23,7 @@ dma_supported(struct device *dev, u64 mask)
24static inline int 23static inline int
25dma_set_mask(struct device *dev, u64 dma_mask) 24dma_set_mask(struct device *dev, u64 dma_mask)
26{ 25{
27 BUG_ON(dev->bus != &pci_bus_type && 26 BUG_ON(dev->bus != &pci_bus_type);
28 dev->bus != &ebus_bus_type);
29 27
30 return pci_set_dma_mask(to_pci_dev(dev), dma_mask); 28 return pci_set_dma_mask(to_pci_dev(dev), dma_mask);
31} 29}
@@ -34,8 +32,7 @@ static inline void *
34dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, 32dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
35 gfp_t flag) 33 gfp_t flag)
36{ 34{
37 BUG_ON(dev->bus != &pci_bus_type && 35 BUG_ON(dev->bus != &pci_bus_type);
38 dev->bus != &ebus_bus_type);
39 36
40 return pci_iommu_ops->alloc_consistent(to_pci_dev(dev), size, dma_handle, flag); 37 return pci_iommu_ops->alloc_consistent(to_pci_dev(dev), size, dma_handle, flag);
41} 38}
@@ -44,8 +41,7 @@ static inline void
44dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, 41dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
45 dma_addr_t dma_handle) 42 dma_addr_t dma_handle)
46{ 43{
47 BUG_ON(dev->bus != &pci_bus_type && 44 BUG_ON(dev->bus != &pci_bus_type);
48 dev->bus != &ebus_bus_type);
49 45
50 pci_free_consistent(to_pci_dev(dev), size, cpu_addr, dma_handle); 46 pci_free_consistent(to_pci_dev(dev), size, cpu_addr, dma_handle);
51} 47}
@@ -54,8 +50,7 @@ static inline dma_addr_t
54dma_map_single(struct device *dev, void *cpu_addr, size_t size, 50dma_map_single(struct device *dev, void *cpu_addr, size_t size,
55 enum dma_data_direction direction) 51 enum dma_data_direction direction)
56{ 52{
57 BUG_ON(dev->bus != &pci_bus_type && 53 BUG_ON(dev->bus != &pci_bus_type);
58 dev->bus != &ebus_bus_type);
59 54
60 return pci_map_single(to_pci_dev(dev), cpu_addr, size, (int)direction); 55 return pci_map_single(to_pci_dev(dev), cpu_addr, size, (int)direction);
61} 56}
@@ -64,8 +59,7 @@ static inline void
64dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, 59dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
65 enum dma_data_direction direction) 60 enum dma_data_direction direction)
66{ 61{
67 BUG_ON(dev->bus != &pci_bus_type && 62 BUG_ON(dev->bus != &pci_bus_type);
68 dev->bus != &ebus_bus_type);
69 63
70 pci_unmap_single(to_pci_dev(dev), dma_addr, size, (int)direction); 64 pci_unmap_single(to_pci_dev(dev), dma_addr, size, (int)direction);
71} 65}
@@ -75,8 +69,7 @@ dma_map_page(struct device *dev, struct page *page,
75 unsigned long offset, size_t size, 69 unsigned long offset, size_t size,
76 enum dma_data_direction direction) 70 enum dma_data_direction direction)
77{ 71{
78 BUG_ON(dev->bus != &pci_bus_type && 72 BUG_ON(dev->bus != &pci_bus_type);
79 dev->bus != &ebus_bus_type);
80 73
81 return pci_map_page(to_pci_dev(dev), page, offset, size, (int)direction); 74 return pci_map_page(to_pci_dev(dev), page, offset, size, (int)direction);
82} 75}
@@ -85,8 +78,7 @@ static inline void
85dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size, 78dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
86 enum dma_data_direction direction) 79 enum dma_data_direction direction)
87{ 80{
88 BUG_ON(dev->bus != &pci_bus_type && 81 BUG_ON(dev->bus != &pci_bus_type);
89 dev->bus != &ebus_bus_type);
90 82
91 pci_unmap_page(to_pci_dev(dev), dma_address, size, (int)direction); 83 pci_unmap_page(to_pci_dev(dev), dma_address, size, (int)direction);
92} 84}
@@ -95,8 +87,7 @@ static inline int
95dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, 87dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
96 enum dma_data_direction direction) 88 enum dma_data_direction direction)
97{ 89{
98 BUG_ON(dev->bus != &pci_bus_type && 90 BUG_ON(dev->bus != &pci_bus_type);
99 dev->bus != &ebus_bus_type);
100 91
101 return pci_map_sg(to_pci_dev(dev), sg, nents, (int)direction); 92 return pci_map_sg(to_pci_dev(dev), sg, nents, (int)direction);
102} 93}
@@ -105,8 +96,7 @@ static inline void
105dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries, 96dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
106 enum dma_data_direction direction) 97 enum dma_data_direction direction)
107{ 98{
108 BUG_ON(dev->bus != &pci_bus_type && 99 BUG_ON(dev->bus != &pci_bus_type);
109 dev->bus != &ebus_bus_type);
110 100
111 pci_unmap_sg(to_pci_dev(dev), sg, nhwentries, (int)direction); 101 pci_unmap_sg(to_pci_dev(dev), sg, nhwentries, (int)direction);
112} 102}
@@ -115,8 +105,7 @@ static inline void
115dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size, 105dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
116 enum dma_data_direction direction) 106 enum dma_data_direction direction)
117{ 107{
118 BUG_ON(dev->bus != &pci_bus_type && 108 BUG_ON(dev->bus != &pci_bus_type);
119 dev->bus != &ebus_bus_type);
120 109
121 pci_dma_sync_single_for_cpu(to_pci_dev(dev), dma_handle, 110 pci_dma_sync_single_for_cpu(to_pci_dev(dev), dma_handle,
122 size, (int)direction); 111 size, (int)direction);
@@ -126,8 +115,7 @@ static inline void
126dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size, 115dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size,
127 enum dma_data_direction direction) 116 enum dma_data_direction direction)
128{ 117{
129 BUG_ON(dev->bus != &pci_bus_type && 118 BUG_ON(dev->bus != &pci_bus_type);
130 dev->bus != &ebus_bus_type);
131 119
132 pci_dma_sync_single_for_device(to_pci_dev(dev), dma_handle, 120 pci_dma_sync_single_for_device(to_pci_dev(dev), dma_handle,
133 size, (int)direction); 121 size, (int)direction);
@@ -137,8 +125,7 @@ static inline void
137dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems, 125dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
138 enum dma_data_direction direction) 126 enum dma_data_direction direction)
139{ 127{
140 BUG_ON(dev->bus != &pci_bus_type && 128 BUG_ON(dev->bus != &pci_bus_type);
141 dev->bus != &ebus_bus_type);
142 129
143 pci_dma_sync_sg_for_cpu(to_pci_dev(dev), sg, nelems, (int)direction); 130 pci_dma_sync_sg_for_cpu(to_pci_dev(dev), sg, nelems, (int)direction);
144} 131}
@@ -147,8 +134,7 @@ static inline void
147dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems, 134dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
148 enum dma_data_direction direction) 135 enum dma_data_direction direction)
149{ 136{
150 BUG_ON(dev->bus != &pci_bus_type && 137 BUG_ON(dev->bus != &pci_bus_type);
151 dev->bus != &ebus_bus_type);
152 138
153 pci_dma_sync_sg_for_device(to_pci_dev(dev), sg, nelems, (int)direction); 139 pci_dma_sync_sg_for_device(to_pci_dev(dev), sg, nelems, (int)direction);
154} 140}
diff --git a/include/asm-sparc64/hypervisor.h b/include/asm-sparc64/hypervisor.h
index 5c2f9d4b9f06..db2130a95d68 100644
--- a/include/asm-sparc64/hypervisor.h
+++ b/include/asm-sparc64/hypervisor.h
@@ -2615,8 +2615,9 @@ struct ldc_mtable_entry {
2615/* ldc_revoke() 2615/* ldc_revoke()
2616 * TRAP: HV_FAST_TRAP 2616 * TRAP: HV_FAST_TRAP
2617 * FUNCTION: HV_FAST_LDC_REVOKE 2617 * FUNCTION: HV_FAST_LDC_REVOKE
2618 * ARG0: cookie 2618 * ARG0: channel ID
2619 * ARG1: ldc_mtable_entry cookie 2619 * ARG1: cookie
2620 * ARG2: ldc_mtable_entry cookie
2620 * RET0: status 2621 * RET0: status
2621 */ 2622 */
2622#define HV_FAST_LDC_REVOKE 0xef 2623#define HV_FAST_LDC_REVOKE 0xef
@@ -2663,7 +2664,8 @@ extern unsigned long sun4v_ldc_mapin(unsigned long channel,
2663 unsigned long *ra, 2664 unsigned long *ra,
2664 unsigned long *perm); 2665 unsigned long *perm);
2665extern unsigned long sun4v_ldc_unmap(unsigned long ra); 2666extern unsigned long sun4v_ldc_unmap(unsigned long ra);
2666extern unsigned long sun4v_ldc_revoke(unsigned long cookie, 2667extern unsigned long sun4v_ldc_revoke(unsigned long channel,
2668 unsigned long cookie,
2667 unsigned long mte_cookie); 2669 unsigned long mte_cookie);
2668#endif 2670#endif
2669 2671
diff --git a/include/asm-sparc64/irq.h b/include/asm-sparc64/irq.h
index 5d233b42fe13..90781e34a95c 100644
--- a/include/asm-sparc64/irq.h
+++ b/include/asm-sparc64/irq.h
@@ -46,6 +46,7 @@ extern void irq_install_pre_handler(int virt_irq,
46#define irq_canonicalize(irq) (irq) 46#define irq_canonicalize(irq) (irq)
47extern unsigned int build_irq(int inofixup, unsigned long iclr, unsigned long imap); 47extern unsigned int build_irq(int inofixup, unsigned long iclr, unsigned long imap);
48extern unsigned int sun4v_build_irq(u32 devhandle, unsigned int devino); 48extern unsigned int sun4v_build_irq(u32 devhandle, unsigned int devino);
49extern unsigned int sun4v_build_virq(u32 devhandle, unsigned int devino);
49extern unsigned int sun4v_build_msi(u32 devhandle, unsigned int *virt_irq_p, 50extern unsigned int sun4v_build_msi(u32 devhandle, unsigned int *virt_irq_p,
50 unsigned int msi_devino_start, 51 unsigned int msi_devino_start,
51 unsigned int msi_devino_end); 52 unsigned int msi_devino_end);
diff --git a/include/asm-sparc64/parport.h b/include/asm-sparc64/parport.h
index 6340a5253a34..23cc63f049a8 100644
--- a/include/asm-sparc64/parport.h
+++ b/include/asm-sparc64/parport.h
@@ -145,7 +145,7 @@ static int parport_isa_probe(int count)
145 */ 145 */
146 if (parport_pc_probe_port(base, base + 0x400, 146 if (parport_pc_probe_port(base, base + 0x400,
147 child->irq, PARPORT_DMA_NOFIFO, 147 child->irq, PARPORT_DMA_NOFIFO,
148 child->bus->self)) 148 &child->bus->self->dev))
149 count++; 149 count++;
150 } 150 }
151 } 151 }
@@ -199,7 +199,8 @@ static int parport_pc_find_nonpci_ports (int autoirq, int autodma)
199 199
200 if (parport_pc_probe_port(base, base + 0x400, 200 if (parport_pc_probe_port(base, base + 0x400,
201 edev->irqs[0], 201 edev->irqs[0],
202 count, ebus->self)) 202 count,
203 &ebus->self->dev))
203 count++; 204 count++;
204 } 205 }
205 } 206 }
diff --git a/include/asm-um/a.out.h b/include/asm-um/a.out.h
index 50cee7b296f4..7016b893ac9d 100644
--- a/include/asm-um/a.out.h
+++ b/include/asm-um/a.out.h
@@ -5,6 +5,7 @@
5#include "choose-mode.h" 5#include "choose-mode.h"
6 6
7#undef STACK_TOP 7#undef STACK_TOP
8#undef STACK_TOP_MAX
8 9
9extern unsigned long stacksizelim; 10extern unsigned long stacksizelim;
10 11
diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h
index 08b9831f2e14..0a71e0b9a619 100644
--- a/include/asm-x86_64/pgtable.h
+++ b/include/asm-x86_64/pgtable.h
@@ -395,12 +395,14 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
395 * bit at the same time. */ 395 * bit at the same time. */
396#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS 396#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
397#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \ 397#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
398 do { \ 398({ \
399 if (__dirty) { \ 399 int __changed = !pte_same(*(__ptep), __entry); \
400 set_pte(__ptep, __entry); \ 400 if (__changed && __dirty) { \
401 flush_tlb_page(__vma, __address); \ 401 set_pte(__ptep, __entry); \
402 } \ 402 flush_tlb_page(__vma, __address); \
403 } while (0) 403 } \
404 __changed; \
405})
404 406
405/* Encode and de-code a swap entry */ 407/* Encode and de-code a swap entry */
406#define __swp_type(x) (((x).val >> 1) & 0x3f) 408#define __swp_type(x) (((x).val >> 1) & 0x3f)
diff --git a/include/asm-x86_64/unistd.h b/include/asm-x86_64/unistd.h
index ae1ed05f2814..8696f8ad401e 100644
--- a/include/asm-x86_64/unistd.h
+++ b/include/asm-x86_64/unistd.h
@@ -626,9 +626,9 @@ __SYSCALL(__NR_utimensat, sys_utimensat)
626__SYSCALL(__NR_epoll_pwait, sys_epoll_pwait) 626__SYSCALL(__NR_epoll_pwait, sys_epoll_pwait)
627#define __NR_signalfd 282 627#define __NR_signalfd 282
628__SYSCALL(__NR_signalfd, sys_signalfd) 628__SYSCALL(__NR_signalfd, sys_signalfd)
629#define __NR_timerfd 282 629#define __NR_timerfd 283
630__SYSCALL(__NR_timerfd, sys_timerfd) 630__SYSCALL(__NR_timerfd, sys_timerfd)
631#define __NR_eventfd 283 631#define __NR_eventfd 284
632__SYSCALL(__NR_eventfd, sys_eventfd) 632__SYSCALL(__NR_eventfd, sys_eventfd)
633 633
634#ifndef __NO_STUBS 634#ifndef __NO_STUBS
diff --git a/include/linux/futex.h b/include/linux/futex.h
index 899fc7f20edd..99650353adfa 100644
--- a/include/linux/futex.h
+++ b/include/linux/futex.h
@@ -17,7 +17,6 @@ union ktime;
17#define FUTEX_LOCK_PI 6 17#define FUTEX_LOCK_PI 6
18#define FUTEX_UNLOCK_PI 7 18#define FUTEX_UNLOCK_PI 7
19#define FUTEX_TRYLOCK_PI 8 19#define FUTEX_TRYLOCK_PI 8
20#define FUTEX_CMP_REQUEUE_PI 9
21 20
22#define FUTEX_PRIVATE_FLAG 128 21#define FUTEX_PRIVATE_FLAG 128
23#define FUTEX_CMD_MASK ~FUTEX_PRIVATE_FLAG 22#define FUTEX_CMD_MASK ~FUTEX_PRIVATE_FLAG
@@ -98,14 +97,9 @@ struct robust_list_head {
98#define FUTEX_OWNER_DIED 0x40000000 97#define FUTEX_OWNER_DIED 0x40000000
99 98
100/* 99/*
101 * Some processes have been requeued on this PI-futex
102 */
103#define FUTEX_WAITER_REQUEUED 0x20000000
104
105/*
106 * The rest of the robust-futex field is for the TID: 100 * The rest of the robust-futex field is for the TID:
107 */ 101 */
108#define FUTEX_TID_MASK 0x0fffffff 102#define FUTEX_TID_MASK 0x3fffffff
109 103
110/* 104/*
111 * This limit protects against a deliberately circular list. 105 * This limit protects against a deliberately circular list.
@@ -139,7 +133,6 @@ handle_futex_death(u32 __user *uaddr, struct task_struct *curr, int pi);
139#define FUT_OFF_MMSHARED 2 /* We set bit 1 if key has a reference on mm */ 133#define FUT_OFF_MMSHARED 2 /* We set bit 1 if key has a reference on mm */
140 134
141union futex_key { 135union futex_key {
142 u32 __user *uaddr;
143 struct { 136 struct {
144 unsigned long pgoff; 137 unsigned long pgoff;
145 struct inode *inode; 138 struct inode *inode;
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index b4570b62ab85..2c13715e9dde 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -163,7 +163,7 @@ static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb)
163 163
164extern const struct file_operations hugetlbfs_file_operations; 164extern const struct file_operations hugetlbfs_file_operations;
165extern struct vm_operations_struct hugetlb_vm_ops; 165extern struct vm_operations_struct hugetlb_vm_ops;
166struct file *hugetlb_zero_setup(size_t); 166struct file *hugetlb_file_setup(const char *name, size_t);
167int hugetlb_get_quota(struct address_space *mapping); 167int hugetlb_get_quota(struct address_space *mapping);
168void hugetlb_put_quota(struct address_space *mapping); 168void hugetlb_put_quota(struct address_space *mapping);
169 169
@@ -185,7 +185,7 @@ static inline void set_file_hugepages(struct file *file)
185 185
186#define is_file_hugepages(file) 0 186#define is_file_hugepages(file) 0
187#define set_file_hugepages(file) BUG() 187#define set_file_hugepages(file) BUG()
188#define hugetlb_zero_setup(size) ERR_PTR(-ENOSYS) 188#define hugetlb_file_setup(name,size) ERR_PTR(-ENOSYS)
189 189
190#endif /* !CONFIG_HUGETLBFS */ 190#endif /* !CONFIG_HUGETLBFS */
191 191
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index c762954bda14..2b139f66027f 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -261,6 +261,18 @@ static inline s64 ktime_to_ns(const ktime_t kt)
261 261
262#endif 262#endif
263 263
264/**
265 * ktime_equal - Compares two ktime_t variables to see if they are equal
266 * @cmp1: comparable1
267 * @cmp2: comparable2
268 *
269 * Compare two ktime_t variables, returns 1 if equal
270 */
271static inline int ktime_equal(const ktime_t cmp1, const ktime_t cmp2)
272{
273 return cmp1.tv64 == cmp2.tv64;
274}
275
264static inline s64 ktime_to_us(const ktime_t kt) 276static inline s64 ktime_to_us(const ktime_t kt)
265{ 277{
266 struct timeval tv = ktime_to_timeval(kt); 278 struct timeval tv = ktime_to_timeval(kt);
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index e7367c74e1bb..6f0b2f7d0010 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -1579,6 +1579,10 @@ static inline ktime_t net_timedelta(ktime_t t)
1579 return ktime_sub(ktime_get_real(), t); 1579 return ktime_sub(ktime_get_real(), t);
1580} 1580}
1581 1581
1582static inline ktime_t net_invalid_timestamp(void)
1583{
1584 return ktime_set(0, 0);
1585}
1582 1586
1583extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len); 1587extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len);
1584extern __sum16 __skb_checksum_complete(struct sk_buff *skb); 1588extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index a0ad37463d62..6207a3d8da71 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -28,7 +28,7 @@ struct kmem_cache {
28 int size; /* The size of an object including meta data */ 28 int size; /* The size of an object including meta data */
29 int objsize; /* The size of an object without meta data */ 29 int objsize; /* The size of an object without meta data */
30 int offset; /* Free pointer offset. */ 30 int offset; /* Free pointer offset. */
31 unsigned int order; 31 int order;
32 32
33 /* 33 /*
34 * Avoid an extra cache line for UP, SMP and for the node local to 34 * Avoid an extra cache line for UP, SMP and for the node local to
@@ -56,7 +56,13 @@ struct kmem_cache {
56/* 56/*
57 * Kmalloc subsystem. 57 * Kmalloc subsystem.
58 */ 58 */
59#define KMALLOC_SHIFT_LOW 3 59#if defined(ARCH_KMALLOC_MINALIGN) && ARCH_KMALLOC_MINALIGN > 8
60#define KMALLOC_MIN_SIZE ARCH_KMALLOC_MINALIGN
61#else
62#define KMALLOC_MIN_SIZE 8
63#endif
64
65#define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE)
60 66
61/* 67/*
62 * We keep the general caches in an array of slab caches that are used for 68 * We keep the general caches in an array of slab caches that are used for
@@ -76,6 +82,9 @@ static inline int kmalloc_index(size_t size)
76 if (size > KMALLOC_MAX_SIZE) 82 if (size > KMALLOC_MAX_SIZE)
77 return -1; 83 return -1;
78 84
85 if (size <= KMALLOC_MIN_SIZE)
86 return KMALLOC_SHIFT_LOW;
87
79 if (size > 64 && size <= 96) 88 if (size > 64 && size <= 96)
80 return 1; 89 return 1;
81 if (size > 128 && size <= 192) 90 if (size > 128 && size <= 192)
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index b6bedc3ee95c..1be5ea059477 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -341,9 +341,14 @@ extern struct spi_master *spi_busnum_to_master(u16 busnum);
341 * chip transactions together. 341 * chip transactions together.
342 * 342 *
343 * (ii) When the transfer is the last one in the message, the chip may 343 * (ii) When the transfer is the last one in the message, the chip may
344 * stay selected until the next transfer. This is purely a performance 344 * stay selected until the next transfer. On multi-device SPI busses
345 * hint; the controller driver may need to select a different device 345 * with nothing blocking messages going to other devices, this is just
346 * for the next message. 346 * a performance hint; starting a message to another device deselects
347 * this one. But in other cases, this can be used to ensure correctness.
348 * Some devices need protocol transactions to be built from a series of
349 * spi_message submissions, where the content of one message is determined
350 * by the results of previous messages and where the whole transaction
351 * ends when the chipselect goes intactive.
347 * 352 *
348 * The code that submits an spi_message (and its spi_transfers) 353 * The code that submits an spi_message (and its spi_transfers)
349 * to the lower layers is responsible for managing its memory. 354 * to the lower layers is responsible for managing its memory.
@@ -480,14 +485,15 @@ static inline void spi_message_free(struct spi_message *m)
480/** 485/**
481 * spi_setup - setup SPI mode and clock rate 486 * spi_setup - setup SPI mode and clock rate
482 * @spi: the device whose settings are being modified 487 * @spi: the device whose settings are being modified
483 * Context: can sleep 488 * Context: can sleep, and no requests are queued to the device
484 * 489 *
485 * SPI protocol drivers may need to update the transfer mode if the 490 * SPI protocol drivers may need to update the transfer mode if the
486 * device doesn't work with the mode 0 default. They may likewise need 491 * device doesn't work with its default. They may likewise need
487 * to update clock rates or word sizes from initial values. This function 492 * to update clock rates or word sizes from initial values. This function
488 * changes those settings, and must be called from a context that can sleep. 493 * changes those settings, and must be called from a context that can sleep.
489 * The changes take effect the next time the device is selected and data 494 * Except for SPI_CS_HIGH, which takes effect immediately, the changes take
490 * is transferred to or from it. 495 * effect the next time the device is selected and data is transferred to
496 * or from it. When this function returns, the spi device is deselected.
491 * 497 *
492 * Note that this call will fail if the protocol driver specifies an option 498 * Note that this call will fail if the protocol driver specifies an option
493 * that the underlying controller or its driver does not support. For 499 * that the underlying controller or its driver does not support. For
diff --git a/include/net/irda/irlap.h b/include/net/irda/irlap.h
index f0248fb8e196..a3d370efb903 100644
--- a/include/net/irda/irlap.h
+++ b/include/net/irda/irlap.h
@@ -289,4 +289,21 @@ static inline void irlap_clear_disconnect(struct irlap_cb *self)
289 self->disconnect_pending = FALSE; 289 self->disconnect_pending = FALSE;
290} 290}
291 291
292/*
293 * Function irlap_next_state (self, state)
294 *
295 * Switches state and provides debug information
296 *
297 */
298static inline void irlap_next_state(struct irlap_cb *self, IRLAP_STATE state)
299{
300 /*
301 if (!self || self->magic != LAP_MAGIC)
302 return;
303
304 IRDA_DEBUG(4, "next LAP state = %s\n", irlap_state[state]);
305 */
306 self->state = state;
307}
308
292#endif 309#endif
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index dda72bf5b9b4..16baef4dab7e 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -503,6 +503,13 @@ static inline int sctp_frag_point(const struct sctp_sock *sp, int pmtu)
503 return frag; 503 return frag;
504} 504}
505 505
506static inline void sctp_assoc_pending_pmtu(struct sctp_association *asoc)
507{
508
509 sctp_assoc_sync_pmtu(asoc);
510 asoc->pmtu_pending = 0;
511}
512
506/* Walk through a list of TLV parameters. Don't trust the 513/* Walk through a list of TLV parameters. Don't trust the
507 * individual parameter lengths and instead depend on 514 * individual parameter lengths and instead depend on
508 * the chunk length to indicate when to stop. Make sure 515 * the chunk length to indicate when to stop. Make sure
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 5e81984b8478..ee4559b11302 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -912,6 +912,9 @@ struct sctp_transport {
912 */ 912 */
913 __u16 pathmaxrxt; 913 __u16 pathmaxrxt;
914 914
915 /* is the Path MTU update pending on this tranport */
916 __u8 pmtu_pending;
917
915 /* PMTU : The current known path MTU. */ 918 /* PMTU : The current known path MTU. */
916 __u32 pathmtu; 919 __u32 pathmtu;
917 920
@@ -1006,6 +1009,7 @@ void sctp_transport_raise_cwnd(struct sctp_transport *, __u32, __u32);
1006void sctp_transport_lower_cwnd(struct sctp_transport *, sctp_lower_cwnd_t); 1009void sctp_transport_lower_cwnd(struct sctp_transport *, sctp_lower_cwnd_t);
1007unsigned long sctp_transport_timeout(struct sctp_transport *); 1010unsigned long sctp_transport_timeout(struct sctp_transport *);
1008void sctp_transport_reset(struct sctp_transport *); 1011void sctp_transport_reset(struct sctp_transport *);
1012void sctp_transport_update_pmtu(struct sctp_transport *, u32);
1009 1013
1010 1014
1011/* This is the structure we use to queue packets as they come into 1015/* This is the structure we use to queue packets as they come into
@@ -1565,6 +1569,9 @@ struct sctp_association {
1565 */ 1569 */
1566 __u16 pathmaxrxt; 1570 __u16 pathmaxrxt;
1567 1571
1572 /* Flag that path mtu update is pending */
1573 __u8 pmtu_pending;
1574
1568 /* Association : The smallest PMTU discovered for all of the 1575 /* Association : The smallest PMTU discovered for all of the
1569 * PMTU : peer's transport addresses. 1576 * PMTU : peer's transport addresses.
1570 */ 1577 */
diff --git a/ipc/shm.c b/ipc/shm.c
index 4fefbad7096d..0852f206d895 100644
--- 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)
254 254
255 if (sfd->vm_ops->get_policy) 255 if (sfd->vm_ops->get_policy)
256 pol = sfd->vm_ops->get_policy(vma, addr); 256 pol = sfd->vm_ops->get_policy(vma, addr);
257 else 257 else if (vma->vm_policy)
258 pol = vma->vm_policy; 258 pol = vma->vm_policy;
259 else
260 pol = current->mempolicy;
259 return pol; 261 return pol;
260} 262}
261#endif 263#endif
@@ -364,9 +366,10 @@ static int newseg (struct ipc_namespace *ns, key_t key, int shmflg, size_t size)
364 return error; 366 return error;
365 } 367 }
366 368
369 sprintf (name, "SYSV%08x", key);
367 if (shmflg & SHM_HUGETLB) { 370 if (shmflg & SHM_HUGETLB) {
368 /* hugetlb_zero_setup takes care of mlock user accounting */ 371 /* hugetlb_file_setup takes care of mlock user accounting */
369 file = hugetlb_zero_setup(size); 372 file = hugetlb_file_setup(name, size);
370 shp->mlock_user = current->user; 373 shp->mlock_user = current->user;
371 } else { 374 } else {
372 int acctflag = VM_ACCOUNT; 375 int acctflag = VM_ACCOUNT;
@@ -377,7 +380,6 @@ static int newseg (struct ipc_namespace *ns, key_t key, int shmflg, size_t size)
377 if ((shmflg & SHM_NORESERVE) && 380 if ((shmflg & SHM_NORESERVE) &&
378 sysctl_overcommit_memory != OVERCOMMIT_NEVER) 381 sysctl_overcommit_memory != OVERCOMMIT_NEVER)
379 acctflag = 0; 382 acctflag = 0;
380 sprintf (name, "SYSV%08x", key);
381 file = shmem_file_setup(name, size, acctflag); 383 file = shmem_file_setup(name, size, acctflag);
382 } 384 }
383 error = PTR_ERR(file); 385 error = PTR_ERR(file);
@@ -397,6 +399,11 @@ static int newseg (struct ipc_namespace *ns, key_t key, int shmflg, size_t size)
397 shp->shm_nattch = 0; 399 shp->shm_nattch = 0;
398 shp->id = shm_buildid(ns, id, shp->shm_perm.seq); 400 shp->id = shm_buildid(ns, id, shp->shm_perm.seq);
399 shp->shm_file = file; 401 shp->shm_file = file;
402 /*
403 * shmid gets reported as "inode#" in /proc/pid/maps.
404 * proc-ps tools use this. Changing this will break them.
405 */
406 file->f_dentry->d_inode->i_ino = shp->id;
400 407
401 ns->shm_tot += numpages; 408 ns->shm_tot += numpages;
402 shm_unlock(shp); 409 shm_unlock(shp);
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index f57854b08922..4c49188cc49b 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1682,9 +1682,9 @@ static int pid_array_load(pid_t *pidarray, int npids, struct cpuset *cs)
1682 1682
1683 do_each_thread(g, p) { 1683 do_each_thread(g, p) {
1684 if (p->cpuset == cs) { 1684 if (p->cpuset == cs) {
1685 pidarray[n++] = p->pid;
1686 if (unlikely(n == npids)) 1685 if (unlikely(n == npids))
1687 goto array_full; 1686 goto array_full;
1687 pidarray[n++] = p->pid;
1688 } 1688 }
1689 } while_each_thread(g, p); 1689 } while_each_thread(g, p);
1690 1690
diff --git a/kernel/futex.c b/kernel/futex.c
index 3b7f7713d9a4..df248f5e0836 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -56,12 +56,6 @@
56 56
57#include "rtmutex_common.h" 57#include "rtmutex_common.h"
58 58
59#ifdef CONFIG_DEBUG_RT_MUTEXES
60# include "rtmutex-debug.h"
61#else
62# include "rtmutex.h"
63#endif
64
65#define FUTEX_HASHBITS (CONFIG_BASE_SMALL ? 4 : 8) 59#define FUTEX_HASHBITS (CONFIG_BASE_SMALL ? 4 : 8)
66 60
67/* 61/*
@@ -111,12 +105,6 @@ struct futex_q {
111 /* Optional priority inheritance state: */ 105 /* Optional priority inheritance state: */
112 struct futex_pi_state *pi_state; 106 struct futex_pi_state *pi_state;
113 struct task_struct *task; 107 struct task_struct *task;
114
115 /*
116 * This waiter is used in case of requeue from a
117 * normal futex to a PI-futex
118 */
119 struct rt_mutex_waiter waiter;
120}; 108};
121 109
122/* 110/*
@@ -216,9 +204,6 @@ int get_futex_key(u32 __user *uaddr, struct rw_semaphore *fshared,
216 if (unlikely((vma->vm_flags & (VM_IO|VM_READ)) != VM_READ)) 204 if (unlikely((vma->vm_flags & (VM_IO|VM_READ)) != VM_READ))
217 return (vma->vm_flags & VM_IO) ? -EPERM : -EACCES; 205 return (vma->vm_flags & VM_IO) ? -EPERM : -EACCES;
218 206
219 /* Save the user address in the ley */
220 key->uaddr = uaddr;
221
222 /* 207 /*
223 * Private mappings are handled in a simple way. 208 * Private mappings are handled in a simple way.
224 * 209 *
@@ -636,8 +621,6 @@ static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_q *this)
636 int ret = 0; 621 int ret = 0;
637 622
638 newval = FUTEX_WAITERS | new_owner->pid; 623 newval = FUTEX_WAITERS | new_owner->pid;
639 /* Keep the FUTEX_WAITER_REQUEUED flag if it was set */
640 newval |= (uval & FUTEX_WAITER_REQUEUED);
641 624
642 pagefault_disable(); 625 pagefault_disable();
643 curval = futex_atomic_cmpxchg_inatomic(uaddr, uval, newval); 626 curval = futex_atomic_cmpxchg_inatomic(uaddr, uval, newval);
@@ -750,259 +733,6 @@ out:
750} 733}
751 734
752/* 735/*
753 * Called from futex_requeue_pi.
754 * Set FUTEX_WAITERS and FUTEX_WAITER_REQUEUED flags on the
755 * PI-futex value; search its associated pi_state if an owner exist
756 * or create a new one without owner.
757 */
758static inline int
759lookup_pi_state_for_requeue(u32 __user *uaddr, struct futex_hash_bucket *hb,
760 union futex_key *key,
761 struct futex_pi_state **pi_state)
762{
763 u32 curval, uval, newval;
764
765retry:
766 /*
767 * We can't handle a fault cleanly because we can't
768 * release the locks here. Simply return the fault.
769 */
770 if (get_futex_value_locked(&curval, uaddr))
771 return -EFAULT;
772
773 /* set the flags FUTEX_WAITERS and FUTEX_WAITER_REQUEUED */
774 if ((curval & (FUTEX_WAITERS | FUTEX_WAITER_REQUEUED))
775 != (FUTEX_WAITERS | FUTEX_WAITER_REQUEUED)) {
776 /*
777 * No waiters yet, we prepare the futex to have some waiters.
778 */
779
780 uval = curval;
781 newval = uval | FUTEX_WAITERS | FUTEX_WAITER_REQUEUED;
782
783 pagefault_disable();
784 curval = futex_atomic_cmpxchg_inatomic(uaddr, uval, newval);
785 pagefault_enable();
786
787 if (unlikely(curval == -EFAULT))
788 return -EFAULT;
789 if (unlikely(curval != uval))
790 goto retry;
791 }
792
793 if (!(curval & FUTEX_TID_MASK)
794 || lookup_pi_state(curval, hb, key, pi_state)) {
795 /* the futex has no owner (yet) or the lookup failed:
796 allocate one pi_state without owner */
797
798 *pi_state = alloc_pi_state();
799
800 /* Already stores the key: */
801 (*pi_state)->key = *key;
802
803 /* init the mutex without owner */
804 __rt_mutex_init(&(*pi_state)->pi_mutex, NULL);
805 }
806
807 return 0;
808}
809
810/*
811 * Keep the first nr_wake waiter from futex1, wake up one,
812 * and requeue the next nr_requeue waiters following hashed on
813 * one physical page to another physical page (PI-futex uaddr2)
814 */
815static int futex_requeue_pi(u32 __user *uaddr1,
816 struct rw_semaphore *fshared,
817 u32 __user *uaddr2,
818 int nr_wake, int nr_requeue, u32 *cmpval)
819{
820 union futex_key key1, key2;
821 struct futex_hash_bucket *hb1, *hb2;
822 struct plist_head *head1;
823 struct futex_q *this, *next;
824 struct futex_pi_state *pi_state2 = NULL;
825 struct rt_mutex_waiter *waiter, *top_waiter = NULL;
826 struct rt_mutex *lock2 = NULL;
827 int ret, drop_count = 0;
828
829 if (refill_pi_state_cache())
830 return -ENOMEM;
831
832retry:
833 /*
834 * First take all the futex related locks:
835 */
836 if (fshared)
837 down_read(fshared);
838
839 ret = get_futex_key(uaddr1, fshared, &key1);
840 if (unlikely(ret != 0))
841 goto out;
842 ret = get_futex_key(uaddr2, fshared, &key2);
843 if (unlikely(ret != 0))
844 goto out;
845
846 hb1 = hash_futex(&key1);
847 hb2 = hash_futex(&key2);
848
849 double_lock_hb(hb1, hb2);
850
851 if (likely(cmpval != NULL)) {
852 u32 curval;
853
854 ret = get_futex_value_locked(&curval, uaddr1);
855
856 if (unlikely(ret)) {
857 spin_unlock(&hb1->lock);
858 if (hb1 != hb2)
859 spin_unlock(&hb2->lock);
860
861 /*
862 * If we would have faulted, release mmap_sem, fault
863 * it in and start all over again.
864 */
865 if (fshared)
866 up_read(fshared);
867
868 ret = get_user(curval, uaddr1);
869
870 if (!ret)
871 goto retry;
872
873 return ret;
874 }
875 if (curval != *cmpval) {
876 ret = -EAGAIN;
877 goto out_unlock;
878 }
879 }
880
881 head1 = &hb1->chain;
882 plist_for_each_entry_safe(this, next, head1, list) {
883 if (!match_futex (&this->key, &key1))
884 continue;
885 if (++ret <= nr_wake) {
886 wake_futex(this);
887 } else {
888 /*
889 * FIRST: get and set the pi_state
890 */
891 if (!pi_state2) {
892 int s;
893 /* do this only the first time we requeue someone */
894 s = lookup_pi_state_for_requeue(uaddr2, hb2,
895 &key2, &pi_state2);
896 if (s) {
897 ret = s;
898 goto out_unlock;
899 }
900
901 lock2 = &pi_state2->pi_mutex;
902 spin_lock(&lock2->wait_lock);
903
904 /* Save the top waiter of the wait_list */
905 if (rt_mutex_has_waiters(lock2))
906 top_waiter = rt_mutex_top_waiter(lock2);
907 } else
908 atomic_inc(&pi_state2->refcount);
909
910
911 this->pi_state = pi_state2;
912
913 /*
914 * SECOND: requeue futex_q to the correct hashbucket
915 */
916
917 /*
918 * If key1 and key2 hash to the same bucket, no need to
919 * requeue.
920 */
921 if (likely(head1 != &hb2->chain)) {
922 plist_del(&this->list, &hb1->chain);
923 plist_add(&this->list, &hb2->chain);
924 this->lock_ptr = &hb2->lock;
925#ifdef CONFIG_DEBUG_PI_LIST
926 this->list.plist.lock = &hb2->lock;
927#endif
928 }
929 this->key = key2;
930 get_futex_key_refs(&key2);
931 drop_count++;
932
933
934 /*
935 * THIRD: queue it to lock2
936 */
937 spin_lock_irq(&this->task->pi_lock);
938 waiter = &this->waiter;
939 waiter->task = this->task;
940 waiter->lock = lock2;
941 plist_node_init(&waiter->list_entry, this->task->prio);
942 plist_node_init(&waiter->pi_list_entry, this->task->prio);
943 plist_add(&waiter->list_entry, &lock2->wait_list);
944 this->task->pi_blocked_on = waiter;
945 spin_unlock_irq(&this->task->pi_lock);
946
947 if (ret - nr_wake >= nr_requeue)
948 break;
949 }
950 }
951
952 /* If we've requeued some tasks and the top_waiter of the rt_mutex
953 has changed, we must adjust the priority of the owner, if any */
954 if (drop_count) {
955 struct task_struct *owner = rt_mutex_owner(lock2);
956 if (owner &&
957 (top_waiter != (waiter = rt_mutex_top_waiter(lock2)))) {
958 int chain_walk = 0;
959
960 spin_lock_irq(&owner->pi_lock);
961 if (top_waiter)
962 plist_del(&top_waiter->pi_list_entry, &owner->pi_waiters);
963 else
964 /*
965 * There was no waiters before the requeue,
966 * the flag must be updated
967 */
968 mark_rt_mutex_waiters(lock2);
969
970 plist_add(&waiter->pi_list_entry, &owner->pi_waiters);
971 __rt_mutex_adjust_prio(owner);
972 if (owner->pi_blocked_on) {
973 chain_walk = 1;
974 get_task_struct(owner);
975 }
976
977 spin_unlock_irq(&owner->pi_lock);
978 spin_unlock(&lock2->wait_lock);
979
980 if (chain_walk)
981 rt_mutex_adjust_prio_chain(owner, 0, lock2, NULL,
982 current);
983 } else {
984 /* No owner or the top_waiter does not change */
985 mark_rt_mutex_waiters(lock2);
986 spin_unlock(&lock2->wait_lock);
987 }
988 }
989
990out_unlock:
991 spin_unlock(&hb1->lock);
992 if (hb1 != hb2)
993 spin_unlock(&hb2->lock);
994
995 /* drop_futex_key_refs() must be called outside the spinlocks. */
996 while (--drop_count >= 0)
997 drop_futex_key_refs(&key1);
998
999out:
1000 if (fshared)
1001 up_read(fshared);
1002 return ret;
1003}
1004
1005/*
1006 * Wake up all waiters hashed on the physical page that is mapped 736 * Wake up all waiters hashed on the physical page that is mapped
1007 * to this virtual address: 737 * to this virtual address:
1008 */ 738 */
@@ -1384,7 +1114,6 @@ static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q,
1384 1114
1385 while (!ret) { 1115 while (!ret) {
1386 newval = (uval & FUTEX_OWNER_DIED) | newtid; 1116 newval = (uval & FUTEX_OWNER_DIED) | newtid;
1387 newval |= (uval & FUTEX_WAITER_REQUEUED);
1388 1117
1389 pagefault_disable(); 1118 pagefault_disable();
1390 curval = futex_atomic_cmpxchg_inatomic(uaddr, 1119 curval = futex_atomic_cmpxchg_inatomic(uaddr,
@@ -1416,7 +1145,7 @@ static int futex_wait(u32 __user *uaddr, struct rw_semaphore *fshared,
1416 struct futex_q q; 1145 struct futex_q q;
1417 u32 uval; 1146 u32 uval;
1418 int ret; 1147 int ret;
1419 struct hrtimer_sleeper t, *to = NULL; 1148 struct hrtimer_sleeper t;
1420 int rem = 0; 1149 int rem = 0;
1421 1150
1422 q.pi_state = NULL; 1151 q.pi_state = NULL;
@@ -1472,14 +1201,6 @@ static int futex_wait(u32 __user *uaddr, struct rw_semaphore *fshared,
1472 if (uval != val) 1201 if (uval != val)
1473 goto out_unlock_release_sem; 1202 goto out_unlock_release_sem;
1474 1203
1475 /*
1476 * This rt_mutex_waiter structure is prepared here and will
1477 * be used only if this task is requeued from a normal futex to
1478 * a PI-futex with futex_requeue_pi.
1479 */
1480 debug_rt_mutex_init_waiter(&q.waiter);
1481 q.waiter.task = NULL;
1482
1483 /* Only actually queue if *uaddr contained val. */ 1204 /* Only actually queue if *uaddr contained val. */
1484 __queue_me(&q, hb); 1205 __queue_me(&q, hb);
1485 1206
@@ -1510,7 +1231,6 @@ static int futex_wait(u32 __user *uaddr, struct rw_semaphore *fshared,
1510 if (!abs_time) 1231 if (!abs_time)
1511 schedule(); 1232 schedule();
1512 else { 1233 else {
1513 to = &t;
1514 hrtimer_init(&t.timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); 1234 hrtimer_init(&t.timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
1515 hrtimer_init_sleeper(&t, current); 1235 hrtimer_init_sleeper(&t, current);
1516 t.timer.expires = *abs_time; 1236 t.timer.expires = *abs_time;
@@ -1538,67 +1258,6 @@ static int futex_wait(u32 __user *uaddr, struct rw_semaphore *fshared,
1538 * we are the only user of it. 1258 * we are the only user of it.
1539 */ 1259 */
1540 1260
1541 if (q.pi_state) {
1542 /*
1543 * We were woken but have been requeued on a PI-futex.
1544 * We have to complete the lock acquisition by taking
1545 * the rtmutex.
1546 */
1547
1548 struct rt_mutex *lock = &q.pi_state->pi_mutex;
1549
1550 spin_lock(&lock->wait_lock);
1551 if (unlikely(q.waiter.task)) {
1552 remove_waiter(lock, &q.waiter);
1553 }
1554 spin_unlock(&lock->wait_lock);
1555
1556 if (rem)
1557 ret = -ETIMEDOUT;
1558 else
1559 ret = rt_mutex_timed_lock(lock, to, 1);
1560
1561 if (fshared)
1562 down_read(fshared);
1563 spin_lock(q.lock_ptr);
1564
1565 /*
1566 * Got the lock. We might not be the anticipated owner if we
1567 * did a lock-steal - fix up the PI-state in that case.
1568 */
1569 if (!ret && q.pi_state->owner != curr) {
1570 /*
1571 * We MUST play with the futex we were requeued on,
1572 * NOT the current futex.
1573 * We can retrieve it from the key of the pi_state
1574 */
1575 uaddr = q.pi_state->key.uaddr;
1576
1577 ret = fixup_pi_state_owner(uaddr, &q, curr);
1578 } else {
1579 /*
1580 * Catch the rare case, where the lock was released
1581 * when we were on the way back before we locked
1582 * the hash bucket.
1583 */
1584 if (ret && q.pi_state->owner == curr) {
1585 if (rt_mutex_trylock(&q.pi_state->pi_mutex))
1586 ret = 0;
1587 }
1588 }
1589
1590 /* Unqueue and drop the lock */
1591 unqueue_me_pi(&q);
1592 if (fshared)
1593 up_read(fshared);
1594
1595 debug_rt_mutex_free_waiter(&q.waiter);
1596
1597 return ret;
1598 }
1599
1600 debug_rt_mutex_free_waiter(&q.waiter);
1601
1602 /* If we were woken (and unqueued), we succeeded, whatever. */ 1261 /* If we were woken (and unqueued), we succeeded, whatever. */
1603 if (!unqueue_me(&q)) 1262 if (!unqueue_me(&q))
1604 return 0; 1263 return 0;
@@ -1648,51 +1307,6 @@ static long futex_wait_restart(struct restart_block *restart)
1648} 1307}
1649 1308
1650 1309
1651static void set_pi_futex_owner(struct futex_hash_bucket *hb,
1652 union futex_key *key, struct task_struct *p)
1653{
1654 struct plist_head *head;
1655 struct futex_q *this, *next;
1656 struct futex_pi_state *pi_state = NULL;
1657 struct rt_mutex *lock;
1658
1659 /* Search a waiter that should already exists */
1660
1661 head = &hb->chain;
1662
1663 plist_for_each_entry_safe(this, next, head, list) {
1664 if (match_futex (&this->key, key)) {
1665 pi_state = this->pi_state;
1666 break;
1667 }
1668 }
1669
1670 BUG_ON(!pi_state);
1671
1672 /* set p as pi_state's owner */
1673 lock = &pi_state->pi_mutex;
1674
1675 spin_lock(&lock->wait_lock);
1676 spin_lock_irq(&p->pi_lock);
1677
1678 list_add(&pi_state->list, &p->pi_state_list);
1679 pi_state->owner = p;
1680
1681
1682 /* set p as pi_mutex's owner */
1683 debug_rt_mutex_proxy_lock(lock, p);
1684 WARN_ON(rt_mutex_owner(lock));
1685 rt_mutex_set_owner(lock, p, 0);
1686 rt_mutex_deadlock_account_lock(lock, p);
1687
1688 plist_add(&rt_mutex_top_waiter(lock)->pi_list_entry,
1689 &p->pi_waiters);
1690 __rt_mutex_adjust_prio(p);
1691
1692 spin_unlock_irq(&p->pi_lock);
1693 spin_unlock(&lock->wait_lock);
1694}
1695
1696/* 1310/*
1697 * Userspace tried a 0 -> TID atomic transition of the futex value 1311 * Userspace tried a 0 -> TID atomic transition of the futex value
1698 * and failed. The kernel side here does the whole locking operation: 1312 * and failed. The kernel side here does the whole locking operation:
@@ -1753,8 +1367,7 @@ static int futex_lock_pi(u32 __user *uaddr, struct rw_semaphore *fshared,
1753 * situation and we return success to user space. 1367 * situation and we return success to user space.
1754 */ 1368 */
1755 if (unlikely((curval & FUTEX_TID_MASK) == current->pid)) { 1369 if (unlikely((curval & FUTEX_TID_MASK) == current->pid)) {
1756 if (!(curval & FUTEX_WAITER_REQUEUED)) 1370 ret = -EDEADLK;
1757 ret = -EDEADLK;
1758 goto out_unlock_release_sem; 1371 goto out_unlock_release_sem;
1759 } 1372 }
1760 1373
@@ -1774,14 +1387,14 @@ static int futex_lock_pi(u32 __user *uaddr, struct rw_semaphore *fshared,
1774 1387
1775 /* 1388 /*
1776 * There are two cases, where a futex might have no owner (the 1389 * There are two cases, where a futex might have no owner (the
1777 * owner TID is 0): OWNER_DIED or REQUEUE. We take over the 1390 * owner TID is 0): OWNER_DIED. We take over the futex in this
1778 * futex in this case. We also do an unconditional take over, 1391 * case. We also do an unconditional take over, when the owner
1779 * when the owner of the futex died. 1392 * of the futex died.
1780 * 1393 *
1781 * This is safe as we are protected by the hash bucket lock ! 1394 * This is safe as we are protected by the hash bucket lock !
1782 */ 1395 */
1783 if (unlikely(ownerdied || !(curval & FUTEX_TID_MASK))) { 1396 if (unlikely(ownerdied || !(curval & FUTEX_TID_MASK))) {
1784 /* Keep the OWNER_DIED and REQUEUE bits */ 1397 /* Keep the OWNER_DIED bit */
1785 newval = (curval & ~FUTEX_TID_MASK) | current->pid; 1398 newval = (curval & ~FUTEX_TID_MASK) | current->pid;
1786 ownerdied = 0; 1399 ownerdied = 0;
1787 lock_taken = 1; 1400 lock_taken = 1;
@@ -1797,14 +1410,10 @@ static int futex_lock_pi(u32 __user *uaddr, struct rw_semaphore *fshared,
1797 goto retry_locked; 1410 goto retry_locked;
1798 1411
1799 /* 1412 /*
1800 * We took the lock due to requeue or owner died take over. 1413 * We took the lock due to owner died take over.
1801 */ 1414 */
1802 if (unlikely(lock_taken)) { 1415 if (unlikely(lock_taken))
1803 /* For requeue we need to fixup the pi_futex */
1804 if (curval & FUTEX_WAITER_REQUEUED)
1805 set_pi_futex_owner(hb, &q.key, curr);
1806 goto out_unlock_release_sem; 1416 goto out_unlock_release_sem;
1807 }
1808 1417
1809 /* 1418 /*
1810 * We dont have the lock. Look up the PI state (or create it if 1419 * We dont have the lock. Look up the PI state (or create it if
@@ -2289,8 +1898,6 @@ retry:
2289 * userspace. 1898 * userspace.
2290 */ 1899 */
2291 mval = (uval & FUTEX_WAITERS) | FUTEX_OWNER_DIED; 1900 mval = (uval & FUTEX_WAITERS) | FUTEX_OWNER_DIED;
2292 /* Also keep the FUTEX_WAITER_REQUEUED flag if set */
2293 mval |= (uval & FUTEX_WAITER_REQUEUED);
2294 nval = futex_atomic_cmpxchg_inatomic(uaddr, uval, mval); 1901 nval = futex_atomic_cmpxchg_inatomic(uaddr, uval, mval);
2295 1902
2296 if (nval == -EFAULT) 1903 if (nval == -EFAULT)
@@ -2427,9 +2034,6 @@ long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
2427 case FUTEX_TRYLOCK_PI: 2034 case FUTEX_TRYLOCK_PI:
2428 ret = futex_lock_pi(uaddr, fshared, 0, timeout, 1); 2035 ret = futex_lock_pi(uaddr, fshared, 0, timeout, 1);
2429 break; 2036 break;
2430 case FUTEX_CMP_REQUEUE_PI:
2431 ret = futex_requeue_pi(uaddr, fshared, uaddr2, val, val2, &val3);
2432 break;
2433 default: 2037 default:
2434 ret = -ENOSYS; 2038 ret = -ENOSYS;
2435 } 2039 }
@@ -2460,8 +2064,7 @@ asmlinkage long sys_futex(u32 __user *uaddr, int op, u32 val,
2460 /* 2064 /*
2461 * requeue parameter in 'utime' if cmd == FUTEX_REQUEUE. 2065 * requeue parameter in 'utime' if cmd == FUTEX_REQUEUE.
2462 */ 2066 */
2463 if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE 2067 if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE)
2464 || cmd == FUTEX_CMP_REQUEUE_PI)
2465 val2 = (u32) (unsigned long) utime; 2068 val2 = (u32) (unsigned long) utime;
2466 2069
2467 return do_futex(uaddr, op, val, tp, uaddr2, val2, val3); 2070 return do_futex(uaddr, op, val, tp, uaddr2, val2, val3);
diff --git a/kernel/futex_compat.c b/kernel/futex_compat.c
index 27478948b318..f7921360efad 100644
--- a/kernel/futex_compat.c
+++ b/kernel/futex_compat.c
@@ -157,8 +157,7 @@ asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, u32 val,
157 t = ktime_add(ktime_get(), t); 157 t = ktime_add(ktime_get(), t);
158 tp = &t; 158 tp = &t;
159 } 159 }
160 if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE 160 if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE)
161 || cmd == FUTEX_CMP_REQUEUE_PI)
162 val2 = (int) (unsigned long) utime; 161 val2 = (int) (unsigned long) utime;
163 162
164 return do_futex(uaddr, op, val, tp, uaddr2, val2, val3); 163 return do_futex(uaddr, op, val, tp, uaddr2, val2, val3);
diff --git a/kernel/power/user.c b/kernel/power/user.c
index 24d7d78e6f42..d65305b515b1 100644
--- a/kernel/power/user.c
+++ b/kernel/power/user.c
@@ -99,6 +99,8 @@ static ssize_t snapshot_read(struct file *filp, char __user *buf,
99 ssize_t res; 99 ssize_t res;
100 100
101 data = filp->private_data; 101 data = filp->private_data;
102 if (!data->ready)
103 return -ENODATA;
102 res = snapshot_read_next(&data->handle, count); 104 res = snapshot_read_next(&data->handle, count);
103 if (res > 0) { 105 if (res > 0) {
104 if (copy_to_user(buf, data_of(data->handle), res)) 106 if (copy_to_user(buf, data_of(data->handle), res))
@@ -245,7 +247,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
245 break; 247 break;
246 248
247 case SNAPSHOT_UNFREEZE: 249 case SNAPSHOT_UNFREEZE:
248 if (!data->frozen) 250 if (!data->frozen || data->ready)
249 break; 251 break;
250 mutex_lock(&pm_mutex); 252 mutex_lock(&pm_mutex);
251 thaw_processes(); 253 thaw_processes();
diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c
index a6fbb4130521..17d28ce20300 100644
--- a/kernel/rtmutex.c
+++ b/kernel/rtmutex.c
@@ -56,7 +56,7 @@
56 * state. 56 * state.
57 */ 57 */
58 58
59void 59static void
60rt_mutex_set_owner(struct rt_mutex *lock, struct task_struct *owner, 60rt_mutex_set_owner(struct rt_mutex *lock, struct task_struct *owner,
61 unsigned long mask) 61 unsigned long mask)
62{ 62{
@@ -81,6 +81,29 @@ static void fixup_rt_mutex_waiters(struct rt_mutex *lock)
81} 81}
82 82
83/* 83/*
84 * We can speed up the acquire/release, if the architecture
85 * supports cmpxchg and if there's no debugging state to be set up
86 */
87#if defined(__HAVE_ARCH_CMPXCHG) && !defined(CONFIG_DEBUG_RT_MUTEXES)
88# define rt_mutex_cmpxchg(l,c,n) (cmpxchg(&l->owner, c, n) == c)
89static inline void mark_rt_mutex_waiters(struct rt_mutex *lock)
90{
91 unsigned long owner, *p = (unsigned long *) &lock->owner;
92
93 do {
94 owner = *p;
95 } while (cmpxchg(p, owner, owner | RT_MUTEX_HAS_WAITERS) != owner);
96}
97#else
98# define rt_mutex_cmpxchg(l,c,n) (0)
99static inline void mark_rt_mutex_waiters(struct rt_mutex *lock)
100{
101 lock->owner = (struct task_struct *)
102 ((unsigned long)lock->owner | RT_MUTEX_HAS_WAITERS);
103}
104#endif
105
106/*
84 * Calculate task priority from the waiter list priority 107 * Calculate task priority from the waiter list priority
85 * 108 *
86 * Return task->normal_prio when the waiter list is empty or when 109 * Return task->normal_prio when the waiter list is empty or when
@@ -100,7 +123,7 @@ int rt_mutex_getprio(struct task_struct *task)
100 * 123 *
101 * This can be both boosting and unboosting. task->pi_lock must be held. 124 * This can be both boosting and unboosting. task->pi_lock must be held.
102 */ 125 */
103void __rt_mutex_adjust_prio(struct task_struct *task) 126static void __rt_mutex_adjust_prio(struct task_struct *task)
104{ 127{
105 int prio = rt_mutex_getprio(task); 128 int prio = rt_mutex_getprio(task);
106 129
@@ -136,11 +159,11 @@ int max_lock_depth = 1024;
136 * Decreases task's usage by one - may thus free the task. 159 * Decreases task's usage by one - may thus free the task.
137 * Returns 0 or -EDEADLK. 160 * Returns 0 or -EDEADLK.
138 */ 161 */
139int rt_mutex_adjust_prio_chain(struct task_struct *task, 162static int rt_mutex_adjust_prio_chain(struct task_struct *task,
140 int deadlock_detect, 163 int deadlock_detect,
141 struct rt_mutex *orig_lock, 164 struct rt_mutex *orig_lock,
142 struct rt_mutex_waiter *orig_waiter, 165 struct rt_mutex_waiter *orig_waiter,
143 struct task_struct *top_task) 166 struct task_struct *top_task)
144{ 167{
145 struct rt_mutex *lock; 168 struct rt_mutex *lock;
146 struct rt_mutex_waiter *waiter, *top_waiter = orig_waiter; 169 struct rt_mutex_waiter *waiter, *top_waiter = orig_waiter;
@@ -514,8 +537,8 @@ static void wakeup_next_waiter(struct rt_mutex *lock)
514 * 537 *
515 * Must be called with lock->wait_lock held 538 * Must be called with lock->wait_lock held
516 */ 539 */
517void remove_waiter(struct rt_mutex *lock, 540static void remove_waiter(struct rt_mutex *lock,
518 struct rt_mutex_waiter *waiter) 541 struct rt_mutex_waiter *waiter)
519{ 542{
520 int first = (waiter == rt_mutex_top_waiter(lock)); 543 int first = (waiter == rt_mutex_top_waiter(lock));
521 struct task_struct *owner = rt_mutex_owner(lock); 544 struct task_struct *owner = rt_mutex_owner(lock);
diff --git a/kernel/rtmutex_common.h b/kernel/rtmutex_common.h
index 242ec7ee740b..9c75856e791e 100644
--- a/kernel/rtmutex_common.h
+++ b/kernel/rtmutex_common.h
@@ -113,29 +113,6 @@ static inline unsigned long rt_mutex_owner_pending(struct rt_mutex *lock)
113} 113}
114 114
115/* 115/*
116 * We can speed up the acquire/release, if the architecture
117 * supports cmpxchg and if there's no debugging state to be set up
118 */
119#if defined(__HAVE_ARCH_CMPXCHG) && !defined(CONFIG_DEBUG_RT_MUTEXES)
120# define rt_mutex_cmpxchg(l,c,n) (cmpxchg(&l->owner, c, n) == c)
121static inline void mark_rt_mutex_waiters(struct rt_mutex *lock)
122{
123 unsigned long owner, *p = (unsigned long *) &lock->owner;
124
125 do {
126 owner = *p;
127 } while (cmpxchg(p, owner, owner | RT_MUTEX_HAS_WAITERS) != owner);
128}
129#else
130# define rt_mutex_cmpxchg(l,c,n) (0)
131static inline void mark_rt_mutex_waiters(struct rt_mutex *lock)
132{
133 lock->owner = (struct task_struct *)
134 ((unsigned long)lock->owner | RT_MUTEX_HAS_WAITERS);
135}
136#endif
137
138/*
139 * PI-futex support (proxy locking functions, etc.): 116 * PI-futex support (proxy locking functions, etc.):
140 */ 117 */
141extern struct task_struct *rt_mutex_next_owner(struct rt_mutex *lock); 118extern struct task_struct *rt_mutex_next_owner(struct rt_mutex *lock);
@@ -143,15 +120,4 @@ extern void rt_mutex_init_proxy_locked(struct rt_mutex *lock,
143 struct task_struct *proxy_owner); 120 struct task_struct *proxy_owner);
144extern void rt_mutex_proxy_unlock(struct rt_mutex *lock, 121extern void rt_mutex_proxy_unlock(struct rt_mutex *lock,
145 struct task_struct *proxy_owner); 122 struct task_struct *proxy_owner);
146
147extern void rt_mutex_set_owner(struct rt_mutex *lock, struct task_struct *owner,
148 unsigned long mask);
149extern void __rt_mutex_adjust_prio(struct task_struct *task);
150extern int rt_mutex_adjust_prio_chain(struct task_struct *task,
151 int deadlock_detect,
152 struct rt_mutex *orig_lock,
153 struct rt_mutex_waiter *orig_waiter,
154 struct task_struct *top_task);
155extern void remove_waiter(struct rt_mutex *lock,
156 struct rt_mutex_waiter *waiter);
157#endif 123#endif
diff --git a/kernel/sched.c b/kernel/sched.c
index 13cdab3b4c48..a7475913b009 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1159,21 +1159,72 @@ void wait_task_inactive(struct task_struct *p)
1159{ 1159{
1160 unsigned long flags; 1160 unsigned long flags;
1161 struct rq *rq; 1161 struct rq *rq;
1162 int preempted; 1162 struct prio_array *array;
1163 int running;
1163 1164
1164repeat: 1165repeat:
1166 /*
1167 * We do the initial early heuristics without holding
1168 * any task-queue locks at all. We'll only try to get
1169 * the runqueue lock when things look like they will
1170 * work out!
1171 */
1172 rq = task_rq(p);
1173
1174 /*
1175 * If the task is actively running on another CPU
1176 * still, just relax and busy-wait without holding
1177 * any locks.
1178 *
1179 * NOTE! Since we don't hold any locks, it's not
1180 * even sure that "rq" stays as the right runqueue!
1181 * But we don't care, since "task_running()" will
1182 * return false if the runqueue has changed and p
1183 * is actually now running somewhere else!
1184 */
1185 while (task_running(rq, p))
1186 cpu_relax();
1187
1188 /*
1189 * Ok, time to look more closely! We need the rq
1190 * lock now, to be *sure*. If we're wrong, we'll
1191 * just go back and repeat.
1192 */
1165 rq = task_rq_lock(p, &flags); 1193 rq = task_rq_lock(p, &flags);
1166 /* Must be off runqueue entirely, not preempted. */ 1194 running = task_running(rq, p);
1167 if (unlikely(p->array || task_running(rq, p))) { 1195 array = p->array;
1168 /* If it's preempted, we yield. It could be a while. */ 1196 task_rq_unlock(rq, &flags);
1169 preempted = !task_running(rq, p); 1197
1170 task_rq_unlock(rq, &flags); 1198 /*
1199 * Was it really running after all now that we
1200 * checked with the proper locks actually held?
1201 *
1202 * Oops. Go back and try again..
1203 */
1204 if (unlikely(running)) {
1171 cpu_relax(); 1205 cpu_relax();
1172 if (preempted)
1173 yield();
1174 goto repeat; 1206 goto repeat;
1175 } 1207 }
1176 task_rq_unlock(rq, &flags); 1208
1209 /*
1210 * It's not enough that it's not actively running,
1211 * it must be off the runqueue _entirely_, and not
1212 * preempted!
1213 *
1214 * So if it wa still runnable (but just not actively
1215 * running right now), it's preempted, and we should
1216 * yield - it could be a while.
1217 */
1218 if (unlikely(array)) {
1219 yield();
1220 goto repeat;
1221 }
1222
1223 /*
1224 * Ahh, all good. It wasn't running, and it wasn't
1225 * runnable, which means that it will never become
1226 * running in the future either. We're all done!
1227 */
1177} 1228}
1178 1229
1179/*** 1230/***
@@ -7071,12 +7122,13 @@ EXPORT_SYMBOL(__might_sleep);
7071void normalize_rt_tasks(void) 7122void normalize_rt_tasks(void)
7072{ 7123{
7073 struct prio_array *array; 7124 struct prio_array *array;
7074 struct task_struct *p; 7125 struct task_struct *g, *p;
7075 unsigned long flags; 7126 unsigned long flags;
7076 struct rq *rq; 7127 struct rq *rq;
7077 7128
7078 read_lock_irq(&tasklist_lock); 7129 read_lock_irq(&tasklist_lock);
7079 for_each_process(p) { 7130
7131 do_each_thread(g, p) {
7080 if (!rt_task(p)) 7132 if (!rt_task(p))
7081 continue; 7133 continue;
7082 7134
@@ -7094,7 +7146,8 @@ void normalize_rt_tasks(void)
7094 7146
7095 __task_rq_unlock(rq); 7147 __task_rq_unlock(rq);
7096 spin_unlock_irqrestore(&p->pi_lock, flags); 7148 spin_unlock_irqrestore(&p->pi_lock, flags);
7097 } 7149 } while_each_thread(g, p);
7150
7098 read_unlock_irq(&tasklist_lock); 7151 read_unlock_irq(&tasklist_lock);
7099} 7152}
7100 7153
diff --git a/kernel/signal.c b/kernel/signal.c
index fe590e00db8d..f9405609774e 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -363,7 +363,13 @@ static int __dequeue_signal(struct sigpending *pending, sigset_t *mask,
363 */ 363 */
364int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info) 364int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
365{ 365{
366 int signr = __dequeue_signal(&tsk->pending, mask, info); 366 int signr = 0;
367
368 /* We only dequeue private signals from ourselves, we don't let
369 * signalfd steal them
370 */
371 if (tsk == current)
372 signr = __dequeue_signal(&tsk->pending, mask, info);
367 if (!signr) { 373 if (!signr) {
368 signr = __dequeue_signal(&tsk->signal->shared_pending, 374 signr = __dequeue_signal(&tsk->signal->shared_pending,
369 mask, info); 375 mask, info);
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index eb7180db3033..a45d1f0691ce 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -326,9 +326,10 @@ static void set_huge_ptep_writable(struct vm_area_struct *vma,
326 pte_t entry; 326 pte_t entry;
327 327
328 entry = pte_mkwrite(pte_mkdirty(*ptep)); 328 entry = pte_mkwrite(pte_mkdirty(*ptep));
329 ptep_set_access_flags(vma, address, ptep, entry, 1); 329 if (ptep_set_access_flags(vma, address, ptep, entry, 1)) {
330 update_mmu_cache(vma, address, entry); 330 update_mmu_cache(vma, address, entry);
331 lazy_mmu_prot_update(entry); 331 lazy_mmu_prot_update(entry);
332 }
332} 333}
333 334
334 335
diff --git a/mm/memory.c b/mm/memory.c
index cb94488ab96d..f64cbf9baa36 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1691,9 +1691,10 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
1691 flush_cache_page(vma, address, pte_pfn(orig_pte)); 1691 flush_cache_page(vma, address, pte_pfn(orig_pte));
1692 entry = pte_mkyoung(orig_pte); 1692 entry = pte_mkyoung(orig_pte);
1693 entry = maybe_mkwrite(pte_mkdirty(entry), vma); 1693 entry = maybe_mkwrite(pte_mkdirty(entry), vma);
1694 ptep_set_access_flags(vma, address, page_table, entry, 1); 1694 if (ptep_set_access_flags(vma, address, page_table, entry,1)) {
1695 update_mmu_cache(vma, address, entry); 1695 update_mmu_cache(vma, address, entry);
1696 lazy_mmu_prot_update(entry); 1696 lazy_mmu_prot_update(entry);
1697 }
1697 ret |= VM_FAULT_WRITE; 1698 ret |= VM_FAULT_WRITE;
1698 goto unlock; 1699 goto unlock;
1699 } 1700 }
@@ -2525,10 +2526,9 @@ static inline int handle_pte_fault(struct mm_struct *mm,
2525 pte_t *pte, pmd_t *pmd, int write_access) 2526 pte_t *pte, pmd_t *pmd, int write_access)
2526{ 2527{
2527 pte_t entry; 2528 pte_t entry;
2528 pte_t old_entry;
2529 spinlock_t *ptl; 2529 spinlock_t *ptl;
2530 2530
2531 old_entry = entry = *pte; 2531 entry = *pte;
2532 if (!pte_present(entry)) { 2532 if (!pte_present(entry)) {
2533 if (pte_none(entry)) { 2533 if (pte_none(entry)) {
2534 if (vma->vm_ops) { 2534 if (vma->vm_ops) {
@@ -2561,8 +2561,7 @@ static inline int handle_pte_fault(struct mm_struct *mm,
2561 entry = pte_mkdirty(entry); 2561 entry = pte_mkdirty(entry);
2562 } 2562 }
2563 entry = pte_mkyoung(entry); 2563 entry = pte_mkyoung(entry);
2564 if (!pte_same(old_entry, entry)) { 2564 if (ptep_set_access_flags(vma, address, pte, entry, write_access)) {
2565 ptep_set_access_flags(vma, address, pte, entry, write_access);
2566 update_mmu_cache(vma, address, entry); 2565 update_mmu_cache(vma, address, entry);
2567 lazy_mmu_prot_update(entry); 2566 lazy_mmu_prot_update(entry);
2568 } else { 2567 } else {
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index bd8e33582d25..05ace44852eb 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1968,7 +1968,7 @@ void zone_init_free_lists(struct pglist_data *pgdat, struct zone *zone,
1968 memmap_init_zone((size), (nid), (zone), (start_pfn), MEMMAP_EARLY) 1968 memmap_init_zone((size), (nid), (zone), (start_pfn), MEMMAP_EARLY)
1969#endif 1969#endif
1970 1970
1971static int __cpuinit zone_batchsize(struct zone *zone) 1971static int __devinit zone_batchsize(struct zone *zone)
1972{ 1972{
1973 int batch; 1973 int batch;
1974 1974
diff --git a/mm/slub.c b/mm/slub.c
index c9ab68881b43..fa28b1623644 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2436,6 +2436,7 @@ EXPORT_SYMBOL(krealloc);
2436void __init kmem_cache_init(void) 2436void __init kmem_cache_init(void)
2437{ 2437{
2438 int i; 2438 int i;
2439 int caches = 0;
2439 2440
2440#ifdef CONFIG_NUMA 2441#ifdef CONFIG_NUMA
2441 /* 2442 /*
@@ -2446,20 +2447,29 @@ void __init kmem_cache_init(void)
2446 create_kmalloc_cache(&kmalloc_caches[0], "kmem_cache_node", 2447 create_kmalloc_cache(&kmalloc_caches[0], "kmem_cache_node",
2447 sizeof(struct kmem_cache_node), GFP_KERNEL); 2448 sizeof(struct kmem_cache_node), GFP_KERNEL);
2448 kmalloc_caches[0].refcount = -1; 2449 kmalloc_caches[0].refcount = -1;
2450 caches++;
2449#endif 2451#endif
2450 2452
2451 /* Able to allocate the per node structures */ 2453 /* Able to allocate the per node structures */
2452 slab_state = PARTIAL; 2454 slab_state = PARTIAL;
2453 2455
2454 /* Caches that are not of the two-to-the-power-of size */ 2456 /* Caches that are not of the two-to-the-power-of size */
2455 create_kmalloc_cache(&kmalloc_caches[1], 2457 if (KMALLOC_MIN_SIZE <= 64) {
2458 create_kmalloc_cache(&kmalloc_caches[1],
2456 "kmalloc-96", 96, GFP_KERNEL); 2459 "kmalloc-96", 96, GFP_KERNEL);
2457 create_kmalloc_cache(&kmalloc_caches[2], 2460 caches++;
2461 }
2462 if (KMALLOC_MIN_SIZE <= 128) {
2463 create_kmalloc_cache(&kmalloc_caches[2],
2458 "kmalloc-192", 192, GFP_KERNEL); 2464 "kmalloc-192", 192, GFP_KERNEL);
2465 caches++;
2466 }
2459 2467
2460 for (i = KMALLOC_SHIFT_LOW; i <= KMALLOC_SHIFT_HIGH; i++) 2468 for (i = KMALLOC_SHIFT_LOW; i <= KMALLOC_SHIFT_HIGH; i++) {
2461 create_kmalloc_cache(&kmalloc_caches[i], 2469 create_kmalloc_cache(&kmalloc_caches[i],
2462 "kmalloc", 1 << i, GFP_KERNEL); 2470 "kmalloc", 1 << i, GFP_KERNEL);
2471 caches++;
2472 }
2463 2473
2464 slab_state = UP; 2474 slab_state = UP;
2465 2475
@@ -2476,8 +2486,8 @@ void __init kmem_cache_init(void)
2476 nr_cpu_ids * sizeof(struct page *); 2486 nr_cpu_ids * sizeof(struct page *);
2477 2487
2478 printk(KERN_INFO "SLUB: Genslabs=%d, HWalign=%d, Order=%d-%d, MinObjects=%d," 2488 printk(KERN_INFO "SLUB: Genslabs=%d, HWalign=%d, Order=%d-%d, MinObjects=%d,"
2479 " Processors=%d, Nodes=%d\n", 2489 " CPUs=%d, Nodes=%d\n",
2480 KMALLOC_SHIFT_HIGH, cache_line_size(), 2490 caches, cache_line_size(),
2481 slub_min_order, slub_max_order, slub_min_objects, 2491 slub_min_order, slub_max_order, slub_min_objects,
2482 nr_cpu_ids, nr_node_ids); 2492 nr_cpu_ids, nr_node_ids);
2483} 2493}
@@ -2867,7 +2877,7 @@ static int alloc_loc_track(struct loc_track *t, unsigned long max)
2867 2877
2868 order = get_order(sizeof(struct location) * max); 2878 order = get_order(sizeof(struct location) * max);
2869 2879
2870 l = (void *)__get_free_pages(GFP_KERNEL, order); 2880 l = (void *)__get_free_pages(GFP_ATOMIC, order);
2871 2881
2872 if (!l) 2882 if (!l)
2873 return 0; 2883 return 0;
diff --git a/net/ipv4/tcp_bic.c b/net/ipv4/tcp_bic.c
index 281c9f913257..dd9ef65ad3ff 100644
--- a/net/ipv4/tcp_bic.c
+++ b/net/ipv4/tcp_bic.c
@@ -29,7 +29,7 @@ static int fast_convergence = 1;
29static int max_increment = 16; 29static int max_increment = 16;
30static int low_window = 14; 30static int low_window = 14;
31static int beta = 819; /* = 819/1024 (BICTCP_BETA_SCALE) */ 31static int beta = 819; /* = 819/1024 (BICTCP_BETA_SCALE) */
32static int initial_ssthresh = 100; 32static int initial_ssthresh;
33static int smooth_part = 20; 33static int smooth_part = 20;
34 34
35module_param(fast_convergence, int, 0644); 35module_param(fast_convergence, int, 0644);
diff --git a/net/ipv4/tcp_cubic.c b/net/ipv4/tcp_cubic.c
index 14224487b16b..ebfaac2f9f46 100644
--- a/net/ipv4/tcp_cubic.c
+++ b/net/ipv4/tcp_cubic.c
@@ -29,7 +29,7 @@
29static int fast_convergence __read_mostly = 1; 29static int fast_convergence __read_mostly = 1;
30static int max_increment __read_mostly = 16; 30static int max_increment __read_mostly = 16;
31static int beta __read_mostly = 819; /* = 819/1024 (BICTCP_BETA_SCALE) */ 31static int beta __read_mostly = 819; /* = 819/1024 (BICTCP_BETA_SCALE) */
32static int initial_ssthresh __read_mostly = 100; 32static int initial_ssthresh __read_mostly;
33static int bic_scale __read_mostly = 41; 33static int bic_scale __read_mostly = 41;
34static int tcp_friendliness __read_mostly = 1; 34static int tcp_friendliness __read_mostly = 1;
35 35
diff --git a/net/ipv4/tcp_illinois.c b/net/ipv4/tcp_illinois.c
index 4adc47c55351..b2b2256d3b84 100644
--- a/net/ipv4/tcp_illinois.c
+++ b/net/ipv4/tcp_illinois.c
@@ -90,6 +90,9 @@ static void tcp_illinois_acked(struct sock *sk, u32 pkts_acked, ktime_t last)
90 90
91 ca->acked = pkts_acked; 91 ca->acked = pkts_acked;
92 92
93 if (ktime_equal(last, net_invalid_timestamp()))
94 return;
95
93 rtt = ktime_to_us(net_timedelta(last)); 96 rtt = ktime_to_us(net_timedelta(last));
94 97
95 /* ignore bogus values, this prevents wraparound in alpha math */ 98 /* ignore bogus values, this prevents wraparound in alpha math */
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 74683d81c3f1..69f9f1ef3ef6 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -953,7 +953,7 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
953 int prior_fackets; 953 int prior_fackets;
954 u32 lost_retrans = 0; 954 u32 lost_retrans = 0;
955 int flag = 0; 955 int flag = 0;
956 int dup_sack = 0; 956 int found_dup_sack = 0;
957 int cached_fack_count; 957 int cached_fack_count;
958 int i; 958 int i;
959 int first_sack_index; 959 int first_sack_index;
@@ -964,20 +964,20 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
964 964
965 /* Check for D-SACK. */ 965 /* Check for D-SACK. */
966 if (before(ntohl(sp[0].start_seq), TCP_SKB_CB(ack_skb)->ack_seq)) { 966 if (before(ntohl(sp[0].start_seq), TCP_SKB_CB(ack_skb)->ack_seq)) {
967 dup_sack = 1; 967 found_dup_sack = 1;
968 tp->rx_opt.sack_ok |= 4; 968 tp->rx_opt.sack_ok |= 4;
969 NET_INC_STATS_BH(LINUX_MIB_TCPDSACKRECV); 969 NET_INC_STATS_BH(LINUX_MIB_TCPDSACKRECV);
970 } else if (num_sacks > 1 && 970 } else if (num_sacks > 1 &&
971 !after(ntohl(sp[0].end_seq), ntohl(sp[1].end_seq)) && 971 !after(ntohl(sp[0].end_seq), ntohl(sp[1].end_seq)) &&
972 !before(ntohl(sp[0].start_seq), ntohl(sp[1].start_seq))) { 972 !before(ntohl(sp[0].start_seq), ntohl(sp[1].start_seq))) {
973 dup_sack = 1; 973 found_dup_sack = 1;
974 tp->rx_opt.sack_ok |= 4; 974 tp->rx_opt.sack_ok |= 4;
975 NET_INC_STATS_BH(LINUX_MIB_TCPDSACKOFORECV); 975 NET_INC_STATS_BH(LINUX_MIB_TCPDSACKOFORECV);
976 } 976 }
977 977
978 /* D-SACK for already forgotten data... 978 /* D-SACK for already forgotten data...
979 * Do dumb counting. */ 979 * Do dumb counting. */
980 if (dup_sack && 980 if (found_dup_sack &&
981 !after(ntohl(sp[0].end_seq), prior_snd_una) && 981 !after(ntohl(sp[0].end_seq), prior_snd_una) &&
982 after(ntohl(sp[0].end_seq), tp->undo_marker)) 982 after(ntohl(sp[0].end_seq), tp->undo_marker))
983 tp->undo_retrans--; 983 tp->undo_retrans--;
@@ -1058,6 +1058,7 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
1058 __u32 start_seq = ntohl(sp->start_seq); 1058 __u32 start_seq = ntohl(sp->start_seq);
1059 __u32 end_seq = ntohl(sp->end_seq); 1059 __u32 end_seq = ntohl(sp->end_seq);
1060 int fack_count; 1060 int fack_count;
1061 int dup_sack = (found_dup_sack && (i == first_sack_index));
1061 1062
1062 skb = cached_skb; 1063 skb = cached_skb;
1063 fack_count = cached_fack_count; 1064 fack_count = cached_fack_count;
@@ -2037,7 +2038,7 @@ static void tcp_try_to_open(struct sock *sk, int flag)
2037{ 2038{
2038 struct tcp_sock *tp = tcp_sk(sk); 2039 struct tcp_sock *tp = tcp_sk(sk);
2039 2040
2040 tp->left_out = tp->sacked_out; 2041 tcp_sync_left_out(tp);
2041 2042
2042 if (tp->retrans_out == 0) 2043 if (tp->retrans_out == 0)
2043 tp->retrans_stamp = 0; 2044 tp->retrans_stamp = 0;
@@ -2409,7 +2410,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p)
2409 int acked = 0; 2410 int acked = 0;
2410 int prior_packets = tp->packets_out; 2411 int prior_packets = tp->packets_out;
2411 __s32 seq_rtt = -1; 2412 __s32 seq_rtt = -1;
2412 ktime_t last_ackt = ktime_set(0,0); 2413 ktime_t last_ackt = net_invalid_timestamp();
2413 2414
2414 while ((skb = tcp_write_queue_head(sk)) && 2415 while ((skb = tcp_write_queue_head(sk)) &&
2415 skb != tcp_send_head(sk)) { 2416 skb != tcp_send_head(sk)) {
@@ -2487,6 +2488,10 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p)
2487 tcp_ack_update_rtt(sk, acked, seq_rtt); 2488 tcp_ack_update_rtt(sk, acked, seq_rtt);
2488 tcp_ack_packets_out(sk); 2489 tcp_ack_packets_out(sk);
2489 2490
2491 /* Is the ACK triggering packet unambiguous? */
2492 if (acked & FLAG_RETRANS_DATA_ACKED)
2493 last_ackt = net_invalid_timestamp();
2494
2490 if (ca_ops->pkts_acked) 2495 if (ca_ops->pkts_acked)
2491 ca_ops->pkts_acked(sk, pkts_acked, last_ackt); 2496 ca_ops->pkts_acked(sk, pkts_acked, last_ackt);
2492 } 2497 }
@@ -2932,6 +2937,7 @@ void tcp_parse_options(struct sk_buff *skb, struct tcp_options_received *opt_rx,
2932 opt_rx->sack_ok) { 2937 opt_rx->sack_ok) {
2933 TCP_SKB_CB(skb)->sacked = (ptr - 2) - (unsigned char *)th; 2938 TCP_SKB_CB(skb)->sacked = (ptr - 2) - (unsigned char *)th;
2934 } 2939 }
2940 break;
2935#ifdef CONFIG_TCP_MD5SIG 2941#ifdef CONFIG_TCP_MD5SIG
2936 case TCPOPT_MD5SIG: 2942 case TCPOPT_MD5SIG:
2937 /* 2943 /*
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 97e294e82679..354721d67f69 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -878,6 +878,7 @@ int tcp_v4_md5_do_add(struct sock *sk, __be32 addr,
878 kfree(newkey); 878 kfree(newkey);
879 return -ENOMEM; 879 return -ENOMEM;
880 } 880 }
881 sk->sk_route_caps &= ~NETIF_F_GSO_MASK;
881 } 882 }
882 if (tcp_alloc_md5sig_pool() == NULL) { 883 if (tcp_alloc_md5sig_pool() == NULL) {
883 kfree(newkey); 884 kfree(newkey);
@@ -1007,7 +1008,7 @@ static int tcp_v4_parse_md5_keys(struct sock *sk, char __user *optval,
1007 return -EINVAL; 1008 return -EINVAL;
1008 1009
1009 tp->md5sig_info = p; 1010 tp->md5sig_info = p;
1010 1011 sk->sk_route_caps &= ~NETIF_F_GSO_MASK;
1011 } 1012 }
1012 1013
1013 newkey = kmemdup(cmd.tcpm_key, cmd.tcpm_keylen, GFP_KERNEL); 1014 newkey = kmemdup(cmd.tcpm_key, cmd.tcpm_keylen, GFP_KERNEL);
diff --git a/net/ipv4/tcp_lp.c b/net/ipv4/tcp_lp.c
index 43294ad9f63e..e49836ce012e 100644
--- a/net/ipv4/tcp_lp.c
+++ b/net/ipv4/tcp_lp.c
@@ -266,7 +266,8 @@ static void tcp_lp_pkts_acked(struct sock *sk, u32 num_acked, ktime_t last)
266 struct tcp_sock *tp = tcp_sk(sk); 266 struct tcp_sock *tp = tcp_sk(sk);
267 struct lp *lp = inet_csk_ca(sk); 267 struct lp *lp = inet_csk_ca(sk);
268 268
269 tcp_lp_rtt_sample(sk, ktime_to_us(net_timedelta(last))); 269 if (!ktime_equal(last, net_invalid_timestamp()))
270 tcp_lp_rtt_sample(sk, ktime_to_us(net_timedelta(last)));
270 271
271 /* calc inference */ 272 /* calc inference */
272 if (tcp_time_stamp > tp->rx_opt.rcv_tsecr) 273 if (tcp_time_stamp > tp->rx_opt.rcv_tsecr)
diff --git a/net/ipv4/tcp_vegas.c b/net/ipv4/tcp_vegas.c
index 73e19cf7df21..e218a51ceced 100644
--- a/net/ipv4/tcp_vegas.c
+++ b/net/ipv4/tcp_vegas.c
@@ -117,6 +117,9 @@ void tcp_vegas_pkts_acked(struct sock *sk, u32 cnt, ktime_t last)
117 struct vegas *vegas = inet_csk_ca(sk); 117 struct vegas *vegas = inet_csk_ca(sk);
118 u32 vrtt; 118 u32 vrtt;
119 119
120 if (ktime_equal(last, net_invalid_timestamp()))
121 return;
122
120 /* Never allow zero rtt or baseRTT */ 123 /* Never allow zero rtt or baseRTT */
121 vrtt = ktime_to_us(net_timedelta(last)) + 1; 124 vrtt = ktime_to_us(net_timedelta(last)) + 1;
122 125
diff --git a/net/ipv4/tcp_veno.c b/net/ipv4/tcp_veno.c
index 9edb340f2f95..ec854cc5fad5 100644
--- a/net/ipv4/tcp_veno.c
+++ b/net/ipv4/tcp_veno.c
@@ -74,6 +74,9 @@ static void tcp_veno_pkts_acked(struct sock *sk, u32 cnt, ktime_t last)
74 struct veno *veno = inet_csk_ca(sk); 74 struct veno *veno = inet_csk_ca(sk);
75 u32 vrtt; 75 u32 vrtt;
76 76
77 if (ktime_equal(last, net_invalid_timestamp()))
78 return;
79
77 /* Never allow zero rtt or baseRTT */ 80 /* Never allow zero rtt or baseRTT */
78 vrtt = ktime_to_us(net_timedelta(last)) + 1; 81 vrtt = ktime_to_us(net_timedelta(last)) + 1;
79 82
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 5a5f8bd4597a..f96ed76d8fa4 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2154,6 +2154,15 @@ static void addrconf_dev_config(struct net_device *dev)
2154 2154
2155 ASSERT_RTNL(); 2155 ASSERT_RTNL();
2156 2156
2157 if ((dev->type != ARPHRD_ETHER) &&
2158 (dev->type != ARPHRD_FDDI) &&
2159 (dev->type != ARPHRD_IEEE802_TR) &&
2160 (dev->type != ARPHRD_ARCNET) &&
2161 (dev->type != ARPHRD_INFINIBAND)) {
2162 /* Alas, we support only Ethernet autoconfiguration. */
2163 return;
2164 }
2165
2157 idev = addrconf_add_dev(dev); 2166 idev = addrconf_add_dev(dev);
2158 if (idev == NULL) 2167 if (idev == NULL)
2159 return; 2168 return;
@@ -2241,36 +2250,16 @@ static void addrconf_ip6_tnl_config(struct net_device *dev)
2241 ip6_tnl_add_linklocal(idev); 2250 ip6_tnl_add_linklocal(idev);
2242} 2251}
2243 2252
2244static int ipv6_hwtype(struct net_device *dev)
2245{
2246 if ((dev->type == ARPHRD_ETHER) ||
2247 (dev->type == ARPHRD_LOOPBACK) ||
2248 (dev->type == ARPHRD_SIT) ||
2249 (dev->type == ARPHRD_TUNNEL6) ||
2250 (dev->type == ARPHRD_FDDI) ||
2251 (dev->type == ARPHRD_IEEE802_TR) ||
2252 (dev->type == ARPHRD_ARCNET) ||
2253 (dev->type == ARPHRD_INFINIBAND))
2254 return 1;
2255
2256 return 0;
2257}
2258
2259static int addrconf_notify(struct notifier_block *this, unsigned long event, 2253static int addrconf_notify(struct notifier_block *this, unsigned long event,
2260 void * data) 2254 void * data)
2261{ 2255{
2262 struct net_device *dev = (struct net_device *) data; 2256 struct net_device *dev = (struct net_device *) data;
2263 struct inet6_dev *idev; 2257 struct inet6_dev *idev = __in6_dev_get(dev);
2264 int run_pending = 0; 2258 int run_pending = 0;
2265 2259
2266 if (!ipv6_hwtype(dev))
2267 return NOTIFY_OK;
2268
2269 idev = __in6_dev_get(dev);
2270
2271 switch(event) { 2260 switch(event) {
2272 case NETDEV_REGISTER: 2261 case NETDEV_REGISTER:
2273 if (!idev) { 2262 if (!idev && dev->mtu >= IPV6_MIN_MTU) {
2274 idev = ipv6_add_dev(dev); 2263 idev = ipv6_add_dev(dev);
2275 if (!idev) 2264 if (!idev)
2276 printk(KERN_WARNING "IPv6: add_dev failed for %s\n", 2265 printk(KERN_WARNING "IPv6: add_dev failed for %s\n",
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 4f06a51ad4fd..193d9d60bb7a 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -590,6 +590,7 @@ static int tcp_v6_md5_do_add(struct sock *sk, struct in6_addr *peer,
590 kfree(newkey); 590 kfree(newkey);
591 return -ENOMEM; 591 return -ENOMEM;
592 } 592 }
593 sk->sk_route_caps &= ~NETIF_F_GSO_MASK;
593 } 594 }
594 tcp_alloc_md5sig_pool(); 595 tcp_alloc_md5sig_pool();
595 if (tp->md5sig_info->alloced6 == tp->md5sig_info->entries6) { 596 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,
724 return -ENOMEM; 725 return -ENOMEM;
725 726
726 tp->md5sig_info = p; 727 tp->md5sig_info = p;
728 sk->sk_route_caps &= ~NETIF_F_GSO_MASK;
727 } 729 }
728 730
729 newkey = kmemdup(cmd.tcpm_key, cmd.tcpm_keylen, GFP_KERNEL); 731 newkey = kmemdup(cmd.tcpm_key, cmd.tcpm_keylen, GFP_KERNEL);
diff --git a/net/irda/irlap_event.c b/net/irda/irlap_event.c
index 0b02073ffdf3..a8b8873aa263 100644
--- a/net/irda/irlap_event.c
+++ b/net/irda/irlap_event.c
@@ -317,23 +317,6 @@ void irlap_do_event(struct irlap_cb *self, IRLAP_EVENT event,
317} 317}
318 318
319/* 319/*
320 * Function irlap_next_state (self, state)
321 *
322 * Switches state and provides debug information
323 *
324 */
325static inline void irlap_next_state(struct irlap_cb *self, IRLAP_STATE state)
326{
327 /*
328 if (!self || self->magic != LAP_MAGIC)
329 return;
330
331 IRDA_DEBUG(4, "next LAP state = %s\n", irlap_state[state]);
332 */
333 self->state = state;
334}
335
336/*
337 * Function irlap_state_ndm (event, skb, frame) 320 * Function irlap_state_ndm (event, skb, frame)
338 * 321 *
339 * NDM (Normal Disconnected Mode) state 322 * NDM (Normal Disconnected Mode) state
@@ -1086,7 +1069,6 @@ static int irlap_state_xmit_p(struct irlap_cb *self, IRLAP_EVENT event,
1086 } else { 1069 } else {
1087 /* Final packet of window */ 1070 /* Final packet of window */
1088 irlap_send_data_primary_poll(self, skb); 1071 irlap_send_data_primary_poll(self, skb);
1089 irlap_next_state(self, LAP_NRM_P);
1090 1072
1091 /* 1073 /*
1092 * Make sure state machine does not try to send 1074 * 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,
1436 */ 1418 */
1437 self->remote_busy = FALSE; 1419 self->remote_busy = FALSE;
1438 1420
1421 /* Stop final timer */
1422 del_timer(&self->final_timer);
1423
1439 /* 1424 /*
1440 * Nr as expected? 1425 * Nr as expected?
1441 */ 1426 */
1442 ret = irlap_validate_nr_received(self, info->nr); 1427 ret = irlap_validate_nr_received(self, info->nr);
1443 if (ret == NR_EXPECTED) { 1428 if (ret == NR_EXPECTED) {
1444 /* Stop final timer */
1445 del_timer(&self->final_timer);
1446
1447 /* Update Nr received */ 1429 /* Update Nr received */
1448 irlap_update_nr_received(self, info->nr); 1430 irlap_update_nr_received(self, info->nr);
1449 1431
@@ -1475,14 +1457,12 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event,
1475 1457
1476 /* Resend rejected frames */ 1458 /* Resend rejected frames */
1477 irlap_resend_rejected_frames(self, CMD_FRAME); 1459 irlap_resend_rejected_frames(self, CMD_FRAME);
1478 1460 irlap_start_final_timer(self, self->final_timeout * 2);
1479 /* Final timer ??? Jean II */
1480 1461
1481 irlap_next_state(self, LAP_NRM_P); 1462 irlap_next_state(self, LAP_NRM_P);
1482 } else if (ret == NR_INVALID) { 1463 } else if (ret == NR_INVALID) {
1483 IRDA_DEBUG(1, "%s(), Received RR with " 1464 IRDA_DEBUG(1, "%s(), Received RR with "
1484 "invalid nr !\n", __FUNCTION__); 1465 "invalid nr !\n", __FUNCTION__);
1485 del_timer(&self->final_timer);
1486 1466
1487 irlap_next_state(self, LAP_RESET_WAIT); 1467 irlap_next_state(self, LAP_RESET_WAIT);
1488 1468
diff --git a/net/irda/irlap_frame.c b/net/irda/irlap_frame.c
index 3c5a68e36414..3013c49ab975 100644
--- a/net/irda/irlap_frame.c
+++ b/net/irda/irlap_frame.c
@@ -798,16 +798,19 @@ void irlap_send_data_primary_poll(struct irlap_cb *self, struct sk_buff *skb)
798 self->vs = (self->vs + 1) % 8; 798 self->vs = (self->vs + 1) % 8;
799 self->ack_required = FALSE; 799 self->ack_required = FALSE;
800 800
801 irlap_next_state(self, LAP_NRM_P);
801 irlap_send_i_frame(self, tx_skb, CMD_FRAME); 802 irlap_send_i_frame(self, tx_skb, CMD_FRAME);
802 } else { 803 } else {
803 IRDA_DEBUG(4, "%s(), sending unreliable frame\n", __FUNCTION__); 804 IRDA_DEBUG(4, "%s(), sending unreliable frame\n", __FUNCTION__);
804 805
805 if (self->ack_required) { 806 if (self->ack_required) {
806 irlap_send_ui_frame(self, skb_get(skb), self->caddr, CMD_FRAME); 807 irlap_send_ui_frame(self, skb_get(skb), self->caddr, CMD_FRAME);
808 irlap_next_state(self, LAP_NRM_P);
807 irlap_send_rr_frame(self, CMD_FRAME); 809 irlap_send_rr_frame(self, CMD_FRAME);
808 self->ack_required = FALSE; 810 self->ack_required = FALSE;
809 } else { 811 } else {
810 skb->data[1] |= PF_BIT; 812 skb->data[1] |= PF_BIT;
813 irlap_next_state(self, LAP_NRM_P);
811 irlap_send_ui_frame(self, skb_get(skb), self->caddr, CMD_FRAME); 814 irlap_send_ui_frame(self, skb_get(skb), self->caddr, CMD_FRAME);
812 } 815 }
813 } 816 }
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
index bb6c0feb2d48..476c8486f789 100644
--- a/net/mac80211/debugfs.c
+++ b/net/mac80211/debugfs.c
@@ -112,7 +112,7 @@ DEBUGFS_READONLY_FILE(wep_iv, 20, "%#06x",
112 local->wep_iv & 0xffffff); 112 local->wep_iv & 0xffffff);
113DEBUGFS_READONLY_FILE(tx_power_reduction, 20, "%d.%d dBm", 113DEBUGFS_READONLY_FILE(tx_power_reduction, 20, "%d.%d dBm",
114 local->hw.conf.tx_power_reduction / 10, 114 local->hw.conf.tx_power_reduction / 10,
115 local->hw.conf.tx_power_reduction & 10); 115 local->hw.conf.tx_power_reduction % 10);
116DEBUGFS_READONLY_FILE(rate_ctrl_alg, 100, "%s", 116DEBUGFS_READONLY_FILE(rate_ctrl_alg, 100, "%s",
117 local->rate_ctrl ? local->rate_ctrl->ops->name : "<unset>"); 117 local->rate_ctrl ? local->rate_ctrl->ops->name : "<unset>");
118 118
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c
index 9f30ae4c2ab3..91b545c144c1 100644
--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -2592,11 +2592,17 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw)
2592 2592
2593 read_lock(&local->sub_if_lock); 2593 read_lock(&local->sub_if_lock);
2594 list_for_each_entry(sdata, &local->sub_if_list, list) { 2594 list_for_each_entry(sdata, &local->sub_if_list, list) {
2595
2596 /* No need to wake the master device. */
2597 if (sdata->dev == local->mdev)
2598 continue;
2599
2595 if (sdata->type == IEEE80211_IF_TYPE_STA) { 2600 if (sdata->type == IEEE80211_IF_TYPE_STA) {
2596 if (sdata->u.sta.associated) 2601 if (sdata->u.sta.associated)
2597 ieee80211_send_nullfunc(local, sdata, 0); 2602 ieee80211_send_nullfunc(local, sdata, 0);
2598 ieee80211_sta_timer((unsigned long)sdata); 2603 ieee80211_sta_timer((unsigned long)sdata);
2599 } 2604 }
2605
2600 netif_wake_queue(sdata->dev); 2606 netif_wake_queue(sdata->dev);
2601 } 2607 }
2602 read_unlock(&local->sub_if_lock); 2608 read_unlock(&local->sub_if_lock);
@@ -2738,6 +2744,12 @@ static int ieee80211_sta_start_scan(struct net_device *dev,
2738 2744
2739 read_lock(&local->sub_if_lock); 2745 read_lock(&local->sub_if_lock);
2740 list_for_each_entry(sdata, &local->sub_if_list, list) { 2746 list_for_each_entry(sdata, &local->sub_if_list, list) {
2747
2748 /* Don't stop the master interface, otherwise we can't transmit
2749 * probes! */
2750 if (sdata->dev == local->mdev)
2751 continue;
2752
2741 netif_stop_queue(sdata->dev); 2753 netif_stop_queue(sdata->dev);
2742 if (sdata->type == IEEE80211_IF_TYPE_STA && 2754 if (sdata->type == IEEE80211_IF_TYPE_STA &&
2743 sdata->u.sta.associated) 2755 sdata->u.sta.associated)
diff --git a/net/rxrpc/ar-connection.c b/net/rxrpc/ar-connection.c
index 43cb3e051ece..482750efc235 100644
--- a/net/rxrpc/ar-connection.c
+++ b/net/rxrpc/ar-connection.c
@@ -211,7 +211,7 @@ static struct rxrpc_connection *rxrpc_alloc_connection(gfp_t gfp)
211 conn->header_size = sizeof(struct rxrpc_header); 211 conn->header_size = sizeof(struct rxrpc_header);
212 } 212 }
213 213
214 _leave(" = %p{%d}", conn, conn->debug_id); 214 _leave(" = %p{%d}", conn, conn ? conn->debug_id : 0);
215 return conn; 215 return conn;
216} 216}
217 217
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index df94e3cdfba3..498edb0cd4e5 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -1231,6 +1231,10 @@ void sctp_assoc_sync_pmtu(struct sctp_association *asoc)
1231 /* Get the lowest pmtu of all the transports. */ 1231 /* Get the lowest pmtu of all the transports. */
1232 list_for_each(pos, &asoc->peer.transport_addr_list) { 1232 list_for_each(pos, &asoc->peer.transport_addr_list) {
1233 t = list_entry(pos, struct sctp_transport, transports); 1233 t = list_entry(pos, struct sctp_transport, transports);
1234 if (t->pmtu_pending && t->dst) {
1235 sctp_transport_update_pmtu(t, dst_mtu(t->dst));
1236 t->pmtu_pending = 0;
1237 }
1234 if (!pmtu || (t->pathmtu < pmtu)) 1238 if (!pmtu || (t->pathmtu < pmtu))
1235 pmtu = t->pathmtu; 1239 pmtu = t->pathmtu;
1236 } 1240 }
diff --git a/net/sctp/input.c b/net/sctp/input.c
index 885109fb3dda..d57ff7f3c576 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -367,24 +367,18 @@ static void sctp_add_backlog(struct sock *sk, struct sk_buff *skb)
367void sctp_icmp_frag_needed(struct sock *sk, struct sctp_association *asoc, 367void sctp_icmp_frag_needed(struct sock *sk, struct sctp_association *asoc,
368 struct sctp_transport *t, __u32 pmtu) 368 struct sctp_transport *t, __u32 pmtu)
369{ 369{
370 if (sock_owned_by_user(sk) || !t || (t->pathmtu == pmtu)) 370 if (!t || (t->pathmtu == pmtu))
371 return; 371 return;
372 372
373 if (sock_owned_by_user(sk)) {
374 asoc->pmtu_pending = 1;
375 t->pmtu_pending = 1;
376 return;
377 }
378
373 if (t->param_flags & SPP_PMTUD_ENABLE) { 379 if (t->param_flags & SPP_PMTUD_ENABLE) {
374 if (unlikely(pmtu < SCTP_DEFAULT_MINSEGMENT)) { 380 /* Update transports view of the MTU */
375 printk(KERN_WARNING "%s: Reported pmtu %d too low, " 381 sctp_transport_update_pmtu(t, pmtu);
376 "using default minimum of %d\n",
377 __FUNCTION__, pmtu,
378 SCTP_DEFAULT_MINSEGMENT);
379 /* Use default minimum segment size and disable
380 * pmtu discovery on this transport.
381 */
382 t->pathmtu = SCTP_DEFAULT_MINSEGMENT;
383 t->param_flags = (t->param_flags & ~SPP_PMTUD) |
384 SPP_PMTUD_DISABLE;
385 } else {
386 t->pathmtu = pmtu;
387 }
388 382
389 /* Update association pmtu. */ 383 /* Update association pmtu. */
390 sctp_assoc_sync_pmtu(asoc); 384 sctp_assoc_sync_pmtu(asoc);
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 4dcdabf56473..6edaaa009d62 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -333,12 +333,19 @@ SCTP_STATIC int sctp_do_bind(struct sock *sk, union sctp_addr *addr, int len)
333 if (!sp->pf->bind_verify(sp, addr)) 333 if (!sp->pf->bind_verify(sp, addr))
334 return -EADDRNOTAVAIL; 334 return -EADDRNOTAVAIL;
335 335
336 /* We must either be unbound, or bind to the same port. */ 336 /* We must either be unbound, or bind to the same port.
337 if (bp->port && (snum != bp->port)) { 337 * It's OK to allow 0 ports if we are already bound.
338 SCTP_DEBUG_PRINTK("sctp_do_bind:" 338 * We'll just inhert an already bound port in this case
339 */
340 if (bp->port) {
341 if (!snum)
342 snum = bp->port;
343 else if (snum != bp->port) {
344 SCTP_DEBUG_PRINTK("sctp_do_bind:"
339 " New port %d does not match existing port " 345 " New port %d does not match existing port "
340 "%d.\n", snum, bp->port); 346 "%d.\n", snum, bp->port);
341 return -EINVAL; 347 return -EINVAL;
348 }
342 } 349 }
343 350
344 if (snum && snum < PROT_SOCK && !capable(CAP_NET_BIND_SERVICE)) 351 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,
1655 goto out_free; 1662 goto out_free;
1656 } 1663 }
1657 1664
1665 if (asoc->pmtu_pending)
1666 sctp_assoc_pending_pmtu(asoc);
1667
1658 /* If fragmentation is disabled and the message length exceeds the 1668 /* If fragmentation is disabled and the message length exceeds the
1659 * association fragmentation point, return EMSGSIZE. The I-D 1669 * association fragmentation point, return EMSGSIZE. The I-D
1660 * does not specify what this error is, but this looks like 1670 * 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,
3550 struct sock *sk = asoc->base.sk; 3560 struct sock *sk = asoc->base.sk;
3551 struct socket *sock; 3561 struct socket *sock;
3552 struct inet_sock *inetsk; 3562 struct inet_sock *inetsk;
3563 struct sctp_af *af;
3553 int err = 0; 3564 int err = 0;
3554 3565
3555 /* An association cannot be branched off from an already peeled-off 3566 /* 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,
3571 /* Make peeled-off sockets more like 1-1 accepted sockets. 3582 /* Make peeled-off sockets more like 1-1 accepted sockets.
3572 * Set the daddr and initialize id to something more random 3583 * Set the daddr and initialize id to something more random
3573 */ 3584 */
3585 af = sctp_get_af_specific(asoc->peer.primary_addr.sa.sa_family);
3586 af->to_sk_daddr(&asoc->peer.primary_addr, sk);
3574 inetsk = inet_sk(sock->sk); 3587 inetsk = inet_sk(sock->sk);
3575 inetsk->daddr = asoc->peer.primary_addr.v4.sin_addr.s_addr;
3576 inetsk->id = asoc->next_tsn ^ jiffies; 3588 inetsk->id = asoc->next_tsn ^ jiffies;
3577 3589
3578 *sockp = sock; 3590 *sockp = sock;
@@ -4343,11 +4355,12 @@ copy_getaddrs:
4343 err = -EFAULT; 4355 err = -EFAULT;
4344 goto error; 4356 goto error;
4345 } 4357 }
4346 if (put_user(cnt, &((struct sctp_getaddrs __user *)optval)->addr_num)) 4358 if (put_user(cnt, &((struct sctp_getaddrs __user *)optval)->addr_num)) {
4347 return -EFAULT; 4359 err = -EFAULT;
4360 goto error;
4361 }
4348 if (put_user(bytes_copied, optlen)) 4362 if (put_user(bytes_copied, optlen))
4349 return -EFAULT; 4363 err = -EFAULT;
4350
4351error: 4364error:
4352 kfree(addrs); 4365 kfree(addrs);
4353 return err; 4366 return err;
diff --git a/net/sctp/transport.c b/net/sctp/transport.c
index 961df275d5b9..5f467c914f80 100644
--- a/net/sctp/transport.c
+++ b/net/sctp/transport.c
@@ -241,6 +241,45 @@ void sctp_transport_pmtu(struct sctp_transport *transport)
241 transport->pathmtu = SCTP_DEFAULT_MAXSEGMENT; 241 transport->pathmtu = SCTP_DEFAULT_MAXSEGMENT;
242} 242}
243 243
244/* this is a complete rip-off from __sk_dst_check
245 * the cookie is always 0 since this is how it's used in the
246 * pmtu code
247 */
248static struct dst_entry *sctp_transport_dst_check(struct sctp_transport *t)
249{
250 struct dst_entry *dst = t->dst;
251
252 if (dst && dst->obsolete && dst->ops->check(dst, 0) == NULL) {
253 dst_release(t->dst);
254 t->dst = NULL;
255 return NULL;
256 }
257
258 return dst;
259}
260
261void sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu)
262{
263 struct dst_entry *dst;
264
265 if (unlikely(pmtu < SCTP_DEFAULT_MINSEGMENT)) {
266 printk(KERN_WARNING "%s: Reported pmtu %d too low, "
267 "using default minimum of %d\n",
268 __FUNCTION__, pmtu,
269 SCTP_DEFAULT_MINSEGMENT);
270 /* Use default minimum segment size and disable
271 * pmtu discovery on this transport.
272 */
273 t->pathmtu = SCTP_DEFAULT_MINSEGMENT;
274 } else {
275 t->pathmtu = pmtu;
276 }
277
278 dst = sctp_transport_dst_check(t);
279 if (dst)
280 dst->ops->update_pmtu(dst, pmtu);
281}
282
244/* Caches the dst entry and source address for a transport's destination 283/* Caches the dst entry and source address for a transport's destination
245 * address. 284 * address.
246 */ 285 */
diff --git a/net/wireless/sysfs.c b/net/wireless/sysfs.c
index 3ebae1442963..88aaacd9f822 100644
--- a/net/wireless/sysfs.c
+++ b/net/wireless/sysfs.c
@@ -33,7 +33,7 @@ static ssize_t _show_permaddr(struct device *dev,
33 struct device_attribute *attr, 33 struct device_attribute *attr,
34 char *buf) 34 char *buf)
35{ 35{
36 char *addr = dev_to_rdev(dev)->wiphy.perm_addr; 36 unsigned char *addr = dev_to_rdev(dev)->wiphy.perm_addr;
37 37
38 return sprintf(buf, "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", 38 return sprintf(buf, "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
39 addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]); 39 addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 8e5610d428c5..3645e980da71 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1052,6 +1052,7 @@ static int init_section_ref_ok(const char *name)
1052 ".plt", /* seen on ARCH=um build on x86_64. Harmless */ 1052 ".plt", /* seen on ARCH=um build on x86_64. Harmless */
1053 "__ftr_fixup", /* powerpc cpu feature fixup */ 1053 "__ftr_fixup", /* powerpc cpu feature fixup */
1054 "__fw_ftr_fixup", /* powerpc firmware feature fixup */ 1054 "__fw_ftr_fixup", /* powerpc firmware feature fixup */
1055 ".cranges", /* used by sh64 */
1055 NULL 1056 NULL
1056 }; 1057 };
1057 /* Start of section names */ 1058 /* Start of section names */
@@ -1132,6 +1133,7 @@ static int exit_section_ref_ok(const char *name)
1132 ".fixup", 1133 ".fixup",
1133 ".smp_locks", 1134 ".smp_locks",
1134 ".plt", /* seen on ARCH=um build on x86_64. Harmless */ 1135 ".plt", /* seen on ARCH=um build on x86_64. Harmless */
1136 ".cranges", /* used by sh64 */
1135 NULL 1137 NULL
1136 }; 1138 };
1137 /* Start of section names */ 1139 /* Start of section names */
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c
index 5a2bef44a2f5..7a22f0f3784a 100644
--- a/sound/ppc/pmac.c
+++ b/sound/ppc/pmac.c
@@ -775,7 +775,8 @@ static int snd_pmac_free(struct snd_pmac *chip)
775 out_le32(&chip->awacs->control, in_le32(&chip->awacs->control) & 0xfff); 775 out_le32(&chip->awacs->control, in_le32(&chip->awacs->control) & 0xfff);
776 } 776 }
777 777
778 snd_pmac_sound_feature(chip, 0); 778 if (chip->node)
779 snd_pmac_sound_feature(chip, 0);
779 780
780 /* clean up mixer if any */ 781 /* clean up mixer if any */
781 if (chip->mixer_free) 782 if (chip->mixer_free)
@@ -925,6 +926,7 @@ static int __init snd_pmac_detect(struct snd_pmac *chip)
925 } 926 }
926 if (! sound) { 927 if (! sound) {
927 of_node_put(chip->node); 928 of_node_put(chip->node);
929 chip->node = NULL;
928 return -ENODEV; 930 return -ENODEV;
929 } 931 }
930 prop = of_get_property(sound, "sub-frame", NULL); 932 prop = of_get_property(sound, "sub-frame", NULL);
@@ -937,7 +939,9 @@ static int __init snd_pmac_detect(struct snd_pmac *chip)
937 printk(KERN_INFO "snd-powermac no longer handles any " 939 printk(KERN_INFO "snd-powermac no longer handles any "
938 "machines with a layout-id property " 940 "machines with a layout-id property "
939 "in the device-tree, use snd-aoa.\n"); 941 "in the device-tree, use snd-aoa.\n");
942 of_node_put(sound);
940 of_node_put(chip->node); 943 of_node_put(chip->node);
944 chip->node = NULL;
941 return -ENODEV; 945 return -ENODEV;
942 } 946 }
943 /* This should be verified on older screamers */ 947 /* This should be verified on older screamers */
@@ -1297,8 +1301,6 @@ int __init snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return)
1297 return 0; 1301 return 0;
1298 1302
1299 __error: 1303 __error:
1300 if (chip->pdev)
1301 pci_dev_put(chip->pdev);
1302 snd_pmac_free(chip); 1304 snd_pmac_free(chip);
1303 return err; 1305 return err;
1304} 1306}